Curation round 17: Theora and Vorbis cutscene videos, Ludovico, Epic and Dr. Fetus, Tractor Beam and Eye of the Occult, familiars and blue spiders, fortune teller and restock, the Bag of Crafting and four tainted characters, ten enemies, water and the ultra secret door, Isaac, ???, the Lamb and Hush
This commit is contained in:
1 parent
e9de039d0f
commit
024cb12016
133 files changed
+13325
-2520
No files matched your search
@@ -0,0 +1,133 @@
|
||||
#include "entity_effect.h"
|
||||
#include "game.h"
|
||||
#include "npc_ai.h"
|
||||
#include "room_grid.h"
|
||||
#include "sfx_manager.h"
|
||||
|
||||
// A beam of light from above (Crack the Sky, Isaac's and the Holy Eye's beams): a spotlight that strikes on its Hit
|
||||
// event, then hurts what stands in it every third frame its beam shows. Subtype 1 is the player's, which takes subtype
|
||||
// 10 after its first strike, 2 a delayed one and 3 a delayed one that also fires a cross of lasers.
|
||||
enum CrackSubtype
|
||||
{
|
||||
CRACK_PLAYER = 1,
|
||||
CRACK_DELAYED = 2,
|
||||
CRACK_DELAYED_CROSS = 3,
|
||||
CRACK_PLAYER_STRUCK = 10
|
||||
};
|
||||
|
||||
// It strikes for 20. A beam that is not a player's hurts players and enemies for 2, one of
|
||||
// a player's or a friendly one hurts enemies for its own damage, every 3 frames, 30 frames apart per victim.
|
||||
constexpr float CRACK_STRIKE_DAMAGE = 20;
|
||||
constexpr float CRACK_HOSTILE_DAMAGE = 2;
|
||||
constexpr int CRACK_HIT_SPACING = 3;
|
||||
constexpr int CRACK_HIT_COUNTDOWN = 30;
|
||||
constexpr int CRACK_SHAKE = 5;
|
||||
// The crater it leaves.
|
||||
constexpr int CRACK_CRATER_SUBTYPE = 1;
|
||||
constexpr float CRACK_CRATER_SCALE = 0.5f;
|
||||
constexpr int CRACK_BEAM_LAYER = 0;
|
||||
constexpr int CRACK_STRUCK = 1;
|
||||
constexpr int CRACK_NPC_TYPE_FIRST = 10;
|
||||
|
||||
// Part of 005cdb20 (Init's case 19) A beam strikes for 20.
|
||||
static void crack_init(Entity_Effect& crack)
|
||||
{
|
||||
crack.collisionDamage = CRACK_STRIKE_DAMAGE;
|
||||
}
|
||||
|
||||
// Hurts what stands in the beam, its source spared: players when it is not a player's, enemies always.
|
||||
static void crack_hit(Entity_Effect& crack)
|
||||
{
|
||||
Entity* source = crack.parent ? crack.parent.get() : &crack;
|
||||
bool isVersus = g_game->deathmatchManager.is_active();
|
||||
bool isHostile = source->type != ENTITY_PLAYER;
|
||||
if (isVersus) isHostile = true;
|
||||
else if (source->HasEntityFlags(FLAG_DELIRIUM_FORM)) isHostile = false;
|
||||
|
||||
for (Entity* entity : entity_query_radius(crack.pos, crack.size, QUERY_ALL))
|
||||
{
|
||||
if (entity == source || entity->isDead || entity->entityCollisionClass == ENTCOLL_NONE) continue;
|
||||
if (entity->maxHitPoints <= 0 || (!isVersus && entity->type == source->type)) continue;
|
||||
|
||||
if (entity->type == ENTITY_PLAYER && isHostile)
|
||||
{
|
||||
if (isVersus) reconstruction_missing("Entity_Effect::Update 005d4380: a versus mode beam's hit");
|
||||
entity->TakeDamage(CRACK_HOSTILE_DAMAGE, 0, EntityRef(source), CRACK_HIT_COUNTDOWN);
|
||||
}
|
||||
else if (entity->type >= CRACK_NPC_TYPE_FIRST)
|
||||
{
|
||||
float damage = isHostile ? CRACK_HOSTILE_DAMAGE : crack.collisionDamage;
|
||||
entity->TakeDamage(damage, 0, EntityRef(source), CRACK_HIT_COUNTDOWN);
|
||||
}
|
||||
}
|
||||
if (crack.subtype == CRACK_PLAYER) crack.subtype = CRACK_PLAYER_STRUCK;
|
||||
}
|
||||
|
||||
// 005e96b5 (Update's case 19) The spotlight charges, strikes with a crater and a shake, hurts every third frame its
|
||||
// beam shows, and goes once its animation ends.
|
||||
static void crack_update(Entity_Effect& crack)
|
||||
{
|
||||
if (crack.state == 0)
|
||||
{
|
||||
crack.sprite.Play(crack.subtype == CRACK_DELAYED_CROSS ? "SpotlightDelayed2"
|
||||
: crack.subtype == CRACK_DELAYED ? "SpotlightDelayed"
|
||||
: "Spotlight");
|
||||
crack.state++;
|
||||
}
|
||||
if (crack.subtype == CRACK_DELAYED_CROSS)
|
||||
reconstruction_missing("Entity_Effect::Update 005d4380: the delayed beam with a cross of lasers");
|
||||
|
||||
if (crack.sprite.IsEventTriggered("Sound")) npc_sound_play(SOUND_LIGHTBOLT_CHARGE, 1, 2, 1);
|
||||
if (crack.sprite.IsEventTriggered("Hit"))
|
||||
{
|
||||
npc_sound_play(SOUND_LIGHTBOLT, 1, 2, 1);
|
||||
game_shake_screen(CRACK_SHAKE);
|
||||
Entity* crater = g_game->Spawn({.position = crack.pos, .subType = CRACK_CRATER_SUBTYPE, .type = ENTITY_EFFECT,
|
||||
.variant = EFFECT_BOMB_CRATER, .seed = crack.dropRNG.Next()});
|
||||
crater->sprite.scale = vector_make(CRACK_CRATER_SCALE, CRACK_CRATER_SCALE);
|
||||
crater->Update();
|
||||
crack.state = CRACK_STRUCK;
|
||||
}
|
||||
|
||||
const AnimationFrame* beam = crack.sprite.animState.GetLayerFrame(CRACK_BEAM_LAYER);
|
||||
if (crack.subtype < CRACK_PLAYER_STRUCK && beam && beam->isVisible)
|
||||
{
|
||||
if ((crack.state - 1) % CRACK_HIT_SPACING == 0) crack_hit(crack);
|
||||
crack.state++;
|
||||
}
|
||||
if (crack.sprite.IsFinished()) crack.Remove();
|
||||
}
|
||||
|
||||
// The ghostly flame the Lamb's body burns with. Fires the players set (and their familiars') are not reconstructed.
|
||||
constexpr float FLAME_FRICTION = 0.95f;
|
||||
constexpr int FLAME_HIT_RESET_FRAMES = 5;
|
||||
|
||||
// Part of 005cdb20 (Init's fire case) A flame keeps off pits, owned by whoever fired the tear or bomb that set it.
|
||||
static void flame_init(Entity_Effect& flame)
|
||||
{
|
||||
flame.entityGridCollisionClass = GRIDCOLL_NOPITS;
|
||||
Entity* spawner = flame.spawnerEntity.get();
|
||||
bool isShot = spawner && (spawner->type == ENTITY_TEAR || spawner->type == ENTITY_BOMB);
|
||||
if (isShot && spawner->spawnerEntity) flame.spawnerEntity = spawner->spawnerEntity.get();
|
||||
}
|
||||
|
||||
// 005f021a (Update's fire case) A flame slows, forgets what it burned every 5 frames, and goes once dead.
|
||||
static void flame_update(Entity_Effect& flame)
|
||||
{
|
||||
flame.friction *= FLAME_FRICTION;
|
||||
if (flame.IsFrame(FLAME_HIT_RESET_FRAMES, (int)flame.index)) flame.hitList.clear();
|
||||
if (flame.spawnerType == ENTITY_PLAYER || flame.spawnerType == ENTITY_FAMILIAR)
|
||||
reconstruction_missing("Entity_Effect::Update 005d4380: a player's fire burning what it touches");
|
||||
flame.state++;
|
||||
if (flame.isDead) flame.Remove();
|
||||
}
|
||||
|
||||
constexpr auto BOSS_EFFECT_BEHAVIOURS = std::to_array<EffectBehaviour>({
|
||||
{EFFECT_BLUE_FLAME, flame_init, effect_finishing<flame_update>, nullptr},
|
||||
{EFFECT_CRACK_THE_SKY, crack_init, effect_finishing<crack_update>, nullptr},
|
||||
});
|
||||
|
||||
std::span<const EffectBehaviour> boss_effect_behaviours()
|
||||
{
|
||||
return BOSS_EFFECT_BEHAVIOURS;
|
||||
}
|
||||
Reference in new issue
Block a user