26 KiB
26 KiB
Entity_Effect::Update per-variant cases (items)
Entity_Effect::Update 0x5d4380 (~200 KB, a 0x7500-byte frame) never decompiles whole. Its switch is
JMP [EDX*4 + 0x606f8c] at 0x5d47cc on variant - 1 (0..0xcb; anything else -> 0x606e88, the shared tail).
Read here: the item-related cases, transcribed from per-case decompiles checked against the asm.
How to read a case (decompile.sh --case, scripts/DecompileCase.java)
./decompile.sh --case 0x6064cc [0x5f2add ...]decompiles single cases (~4 s each after a ~5 s Ghidra start; all 139 distinct targets take ~90 s in one call). It copies project/ to a temp dir, opens it-readOnly, finds the computed JMP whose flows (or jump table, read from memory) contain the case address, patches that JMP into a directJMP case(E9 rel32 + NOPs), re-flows the function body withCreateFunctionCmd.fixupFunctionBody(prologue + that case + whatever it jumps into, e.g. the shared tail) and decompiles that. Changes are discarded; the shared project is never written. Arguments may be labelledlabel=addr; the header then reads//@@ 005d4380 Entity_Effect::Update/case_<label>.- The jump table, variant -> case: read 204 dwords at 0x606f8c (file offset via the PE section table, as scripts/read_value.py does); shared targets: 0x5d4b7a (28 variants, the common "anm2 then remove" case), 0x5eaf9d (15), 0x5ed91f (7), 0x5d47d3 (8, 89, 100, 128, 129, 154, 191: straight to the tail). 127 and 202 share 0x5fa30d.
- Each case decompile starts with the common prologue (time scale, pause timer, Entity::Update, follow parent) and
ends with the common tail:
_timeout> 0 counts down and kills at 0; spawner 3.125 waves call update_wave_chain; FUN_00861410. Only the part betweenlocal_131c = variant - 1and the tail is the case. A few cases typethisoddly (case 180 shows_state/_timeoutas_bodySprite._animStatefields): trust offsets, not names. - Small helpers and anything the decompile garbles:
objdump -d -M intel --start-address=0xA --stop-address=0xB bin/isaac-ng.exeis instant (decompile.sh --asm needs a Ghidra start). Lost float arguments (XMM0..3) and vtable call arguments were read from the asm everywhere below. - Vtable slots used throughout: +0xc Update, +0x20 TakeDamage(damage, flags lo, flags hi, EntityRef*, countdown), +0x28 Remove, +0x3c SetColor(color, duration, priority, fadeout, share), +0x40 SetCollisionDamage (slot 16), +0x4c IsBoss (slot 19). GridEntity +0x10 Hurt(damage, source), +0x14 Destroy(immediate, source).
- Color:
Color::Color 0x435b50takes tint RGB in XMM1..3 and (A, colorize R,G,B,A, offset R,G,B) on the stack; 0x435ad0 takes tint RGB in XMM1..3, A, then offsets as bytes / 255.
Salvation halo (case 123 @0x6064cc, 1000.123 subtype 6 "Thorns Halo" anm2)
- Halo subtypes (entities2.xml): 0 Halo, 1 Telekinesis, 2 Monstrance, 3 Curse, 4 Static, 5 Saturnus, 6 Thorns (Salvation), 7 Static Prerendered, 8 Dark Arts, 9 Breath of Life.
- No parent: subtypes other than 4/7/8/9 Remove at once; those play "Disappear" (velocity 0) and Remove when done.
- Subtype 1 (Telekinesis): "Blink" while _state >= 1 (unless already), else "Idle"; on the anm2 event "Push": QueryRadius(80, enemies) -> each enemy with mass != 0, not flag 0x4000000, not an ancestor of the spawner: push = min(7, size + 80 - dist) * 2 (asm 0x6067ca: the entity's size, not mass) (x0.5 mass > 20, x0.2 > 30, x0.015 > 50: the decompile's nesting), velocity = dir * push + velocity * 0.5. (Decompile; the nesting is as the asm branches.)
- Subtype 9 (Breath of Life): a non-looping animation that finished -> "Idle".
- Parent an enemy: if its type check FUN_00447760 == 0x12 play "Disappear" (or hide when the anm2 lacks it); Remove when finished. Parent not an enemy: subtypes other than 4/7 are visible only while the parent lives.
- Subtypes 4/7: follow the parent (position, velocity, position offset); unless friendly (0x20000000): QueryRadius( sprite scale.x * 40, partitions 0x21) -> each entity with a collision class: TakeDamage(0, flags 0x8000, source the halo, countdown 30) (asm-checked: a zero-damage touch).
- Subtype 6 (Salvation):
_scale <= 1.5-> Play "Idle1", sprite scale = (_scale, _scale); else "Idle2", sprite scale = _scale / 2. That is all the case does. - The halo's size: Entity_Player::Update 0x782af0 every tick sets
_scale = get_salvation_scale() * 1.2, position offset (0, -15), sprite rotation = (frame count - spawn frame) % 360 (+0.5 with entity flag 0x4000).Entity_Player::get_salvation_scale 0x7d4340= clamp(Salvation effect count * 0.1 + 1, 1, 2) (asm). The count grows by 1 per hit up to 10 (TakeDamage, parity_defensive.md), so_scaleruns 1.2 .. 2.4. - Salvation's damage is not in the halo: Entity_NPC::Update 0x6c4b30 (~line 1856 of its decompile), for each
non-friendly vulnerable NPC, finds the nearest player holding 0x2b8 with distSq < (get_salvation_scale() * 70 +
npc size)^2 (FUN_006daa90 squares), and if the NPC has no beam yet (+0x... EntityPtr at
this[1].field_0x4) spawns 1000.19 (Crack the Sky) subtype 3 at the NPC, spawner/parent the player, target the NPC, SetCollisionDamage(3.5) (0x40600000), Update; then (also when it already had one) set_state(beam, 1). The beam is case 19 below (subtype 3).
Trinity Shield (case 47 @0x5f2add, 1000.47, anm2 "1000.046_trinity shield": Idle, Rotation)
- Position offset (0, -10). With a = Math::abs(_rotation) (0x41d510 is ANDPS 0x7fffffff):
- a >= 100: depth offset 0, SetFrame("Rotation", 4), flipY 1 (Sprite +0x101 via 0x505b50), flipX 1, offset y += 10.
- else: depth offset 30, SetFrame("Rotation", 0), flips 0; then if 80 <= _rotation <= 100: depth 0, frame 6; else if -100 <= _rotation <= -80: depth 0, frame 2.
- Target position = 0. QueryRadius(pos, _size, partition 2 = projectiles) -> every type 9 found: Die(). That is the whole block: enemy shots touching the shield die. Its placement/rotation is update_shooting 0x77b020 (parity_defensive.md).
Luna's moonlight (case 39 @0x5f2246, 1000.39 subtype 1, anm2 "1000.039.001_moonlight": layers Main, *Light,
Ground; Appear, Disappear)
- Init (Entity_Effect::Init 0x5cdb20, variant 0x27): entity flag 0x200000; subtype 1 with spawner type 0 (Room::Init's spawn at the room centre in secret rooms): layers 0 and 2 linear filtering, blend mode 2 on layers 0 and 2, layer 2 (Ground) hidden, then spawns a copy (same type/variant/subtype/seed, spawner = it) as its child (child's parent = it); depth offset 10. The copy (spawner type 1000) skips that and gets sorting layer 0 (floor), so it shows the Ground layer under everything.
- Update, the original (spawner type 0):
- _state >= 0: _state++, Play "Appear" (no restart). For each player of variant 0, no parent, collision class != 0:
distSq < 900 (30 px) and _state > 60 -> _state = -1, sound 0x80 (power up1; vol 1, delay 2, pitch 1),
CreateTimer(Entity_Effect::moonlight_timer_callback 0x6073f0, 30 ticks, 0, 0)with parent =Entity_Player::resolve_tainted_soul(player)(0x7cbcb0: Tainted Soul -> the Forgotten body) and entity flag 1 << 37 (FLAG_PERSISTENT); stop looking. - _state < 0: Play "Disappear"; when finished Remove itself and its child.
- _state >= 0: _state++, Play "Appear" (no restart). For each player of variant 0, no parent, collision class != 0:
distSq < 900 (30 px) and _state > 60 -> _state = -1, sound 0x80 (power up1; vol 1, delay 2, pitch 1),
- The copy: no parent -> Remove; else stays at the parent's position.
- moonlight_timer_callback (30 ticks later, if the parent is an alive player): sound 0x84 (power up spewer; vol 1, delay 2, pitch 1); SetColor(tint (2, 3, 4, 1), colorize 0, offset (0.2, 0.2, 0.2), duration 3, priority -1, fadeout 1, share 1); TemporaryEffects::AddEffect(null item 74 "luna secondary" (items.xml: cache firedelay, persistent), cooldown = its config +0x78); AnimateCollectible(0x24d Luna, "UseItem", "PlayerPickupSparkle"); AddSoulHearts(1).
- Subtypes 0 (heaven door) and 2 are notes/systems/ascent.md.
Spear of Destiny (case 83 @0x5fea2f, 1000.83, anm2 body / Idle, Rotation)
- g = (challenge == 30 Guardian). Hit list cleared on IsFrame(g ? 2 : 7, index). Radius g ? 20 : 13.
- With a player spawner: QueryRadius(pos, radius, enemies 8); hit params = GetTearHitParams(weapon 4, damage scale 1.0, displacement Random(2) * 2 - 1, no familiar) (asm 0x5feb5a). Each entity that is a vulnerable enemy, or (not vulnerable but) type 33 fireplace, and not in the hit list: TakeDamage(hitParams.damage (+0x48) * (g ? 1 : 2), flags 0, source the spear, countdown 30); if it IsBoss (vtable 0x4c): AddFear(source = the spear's parent, 30) (asm 0x5fed1d: JZ skips the fear for non-bosses; literal, surprising); add to hit list.
- Every tick (spawner or not): the grid cell under it, if any: Room::DamageGridWithSource(index, 1, EntityRef(spawner or empty)).
Linger Bean's cloud (case 105 @0x600dfc, 1000.105 Brown Cloud, anm2 PoofStart, PoofLoop, PoofEnd)
- Dead: Play "PoofEnd", Remove when finished.
- _state 0: when the start animation finishes Play "PoofLoop", _state = 1.
- _state >= 1 (counts ticks): hit list cleared on IsFrame(7, index). t = _state / 300. Damage multiplier lerp(1.7,
0.58, t); sprite scale = lerp(1.0, 2.1, t) both axes (overwrites any spawn scale every tick). Base damage =
GetTearHitParams(weapon 1, 1.0, 1, 0).damage when the spawner is a player, else 3.5. Radius = sprite scale.x * 50.
- QueryRadius(radius, enemies): vulnerable enemies that are not its ancestors and not in the hit list: TakeDamage(base * mult, 0, source the cloud, 30), add to hit list.
- QueryRadius(radius, tears 4): every type-2 tear (in deathmatch only tears whose spawner is not its ancestor) pushes the cloud: velocity += tear velocity * (1 - dist / radius) * 0.1.
- _state++; at 300 it dies (Dead -> PoofEnd).
- Always: velocity *= 0.7; position clamped into the room (GetClampedPosition margin 0).
- Spawn: update_effects 0x794e50 (parity_tears.md), sound 0x35c lingerbean_cloud.
Death's List skull (case 109 @0x6029b5, 1000.109 Death Skull, anm2 Appear, Idle, Die)
- With a target and
Room::is_deaths_list_done 0x5cd660(room +0x1bbc) false: when "Appear" finishes Play "Idle"; position/velocity = the target's; position offset = the target sprite's "OverlayEffect" null frame position / 0.65 (FUN_0067f2e0) when that null is visible, else (0, -30). Target dead: if _timeout < 1 set it to 2 (the tail then kills it 2 ticks later), else drop the target. - No target or the list is done: Play "Die", Remove when finished.
Larynx's shockwave and Mega Bean (case 127/202 @0x5fa30d; 1000.127 subtype 1 "Mama Mega Explosion", 1000.202)
Larynx's use (UseActiveItem case 0x50 @0x5c50a4, asm):
- n = 1; with use flag 0x400 (custom var data) n = max(1, varData); else when owned (flag 4), slot >= 0 and the slot holds Larynx: n = min(12, GetTotalActiveCharge(slot)), stored as the wild card's var data when that is Larynx.
- Sound (PlaySound 0x6b6470, vol 1, delay 2, loop 0, pitch as given): n <= 4: 0x23f (575) pitch 1.0; 5..8: 0x240 (576) pitch 1.1; n >= 9: 0x241 (577) pitch (n - 8) * 0.2 + 1.1.
- n >= 6 (asm:
CMP ESI,5; JLEafter the sound, so not n = 5): room colour fades: target = lerp(current room colour modifier, ColorModState(R 2, G 0, B 0, A 1, brightness 0, contrast 1) (FUN_004aadf0, asm 0x5c51f0), (n - 5) / 9) (FUN_005b15f0), Game::SetColorModifier(that, 0, rate 0.015), then SetColorModifier(room's own, 1, rate 0.02). - ShakeScreen(n * 3 + 2 + n * n / 12). Spawn 1000.127 subtype 1 at Isaac (velocity 0, spawner Isaac), SetTargetPosition(Isaac's position), SetRadii(10, n * 50 + 30 + n * n * 0.8), SetCollisionDamage(n * 28 + 20) (deathmatch: n * 3.8 + 4), Update. RemoveCollectibleEffect(0x263, all) then AddEffect(Larynx, cooldown n + 8) (TemporaryEffect +8 = cooldown, asm 0x5c53e1). Book of Virtues: wisp with HP scaled by n * 0.5.
The effect (127 red, colour (1, 0.2, 0.2, 1); 202 green (0.2, 1, 0.2, 1)):
- _state 0, subtypes 0/2 (Mama Mega, Mega Bean): radii from the room box (distance to the farthest corner; max + 200), ShakeScreen(50), bloom (6, 1.0), MakeShockwave(target, 0.5, 0.07, 20), 127 plays 0xb8; FUN_008207a0 on the room.
- _state 0, Larynx (subtype 1): _scale = min radius (10); a = lerp(maxR over 60..600 -> 0.01..0.08), s = lerp(.. 0.01..0.07), d = (int)lerp(.. 8..20); MakeShockwave(target, a, s, d); spawn 1000.151 subtype 10 at the target, position offset (0, -14), SetColor(the variant colour, -1, 255, 0, 1), timeout d * 2, SetRadii(10, maxR * 0.3), Update. _state = 1.
- Every later update with Entity::GetIntervalTicks(2.0) > 0:
- Larynx only: again one 1000.151.10 ring as above, plus 3 x 1000.151.11 at angles r + i * 120 + U(-30, 30) (r = U(0, 360)) via FUN_0043eea0, offset (0, -14), same colour, timeout d, SetRadii(10, (0.15 + 0.15u) * maxR), layer 0 size.y = 0.6 + 0.4u.
- _scale = min(_scale + clamp(maxR / 3, 30, 100), maxR). damage = _collisionDamage; repeat = max(damage / (subtype 0 ? 50 : 8), 1).
- Every room entity but its spawner with distSq(target) <= _scale^2:
- non-friendly living enemy: AddVelocity(normalized(away) * 3); first time (hit list): TakeDamage(damage, 0x1000004 (EXPLOSION | CRUSH), source the spawner, 30) (202 also AddFreeze(-50), AddPoison(90, 5.0)); already hit and variant 127: TakeDamage(repeat, same flags) each update.
- projectile without projectile flag 0x80000000: flags cleared, Die.
- slot (type 6,
Entity::is_slot 0x435da0): push 3 and TakeDamage(damage) every update while alive. - pickup: push 3; first time TakeDamage(damage).
- effects 1000.21/33/63/64/159 (tiny bug/fly, worm, beetle, lil ghost): Die.
- Grid cells (x < width, y < height) within _scale: subtypes 0/2 always, Larynx 1 in 4 (Random(4) == 0): grid
Destroy(0, source the effect). Then 1 in 2, if inside the room by -80 and outside (_scale - 50): debris at the cell
- random 0..50 px: subtypes 0/2 a 1000.59 dust cloud (velocity 4..8 outward, spin +-(2..12), timeout 10..19, tinted/blended by subtype and variant, scale 1.2..4.2); Larynx: 1000.2 blood explosion subtype 2/3/4 (maxR <= 150 / <= 300 / more), velocity 4..8 outward, rotation U(0, 360), scale 0.8..1.2, plus a 1000.7 blood splat at scale 3.
- _scale >= maxR: Remove. Subtypes 0/2 at state 1 when dead or _scale > 300: state 2, on normal/hard TrySpawnBossRushDoor(1, 0) and TrySpawnBlueWombDoor(1, 1, 0). Subtype 0 plays 0xba pitch 1.1.
Mega Blast's lost argument (update_effects 0x794e50, asm 0x79d7c6..0x79d931)
- Each tick (duration > 0, controls on): duration--, hit params = GetTearHitParams(weapon 3, 1.0, Random(2) * 2 - 1, 0).
- The laser (variant 6, 0xf with Brimstone 0x44; timeout max(0, duration - 15), offset (0, -30)) gets SetCollisionDamage(hitParams.damage * 5.0); in deathmatch the multiplier keeps that stack slot's value 2.0 stored unconditionally at 0x796763 (no branch skips it: checked), so x2.0 in deathmatch. Then set_disable_follow_parent(room type <= 1), its EntityPtr, tear flags (hit params & ~mask 0xc34b40), SetColor(Isaac's laser colour +0x14c4), Update.
- Correction to parity_combat_actives.md: the 150-tick duration (and 2.0 / 5.0) is the deathmatch branch
(
DeathmatchManager::is_active 0x429550), not greed.
Meat Cleaver's slash (case 176 @0x5df80d, 1000.176 Cleaver Slash, anm2 Slash)
- Depth offset 4. While it has a target: position = the target's, velocity 0; from anm2 frame 3 on: an enemy target
->
Entity_NPC::split 0x6d97e0(target, EntityRef(spawner), no sound); a familiar target of variant 0xce (wisp) -> FUN_0043e9f0 on it; then the target is dropped. Remove when the animation finishes. - Entity_NPC::split (decompiles; read it there): not dead; unsplittable types (0x2d other than variant 10, 0x4e, 0x54, 0x65, 0x66, 0x10a, 0x111..0x113, 0x387.1, 0x3e, 0x38f, 0x390, 0x196, 0x197, 0x3b6, 0x3b7) and scale < 0.5 are left alone; bosses 0x47..0x4c, 0x33, 0x39, 0x50, 0x5e, 0xdc, 0xdf and champion colour 15 take another path; 0x51 (variant 0) is set to min(HP, 40% max). Otherwise two halves at +-size/2 (horizontal for 0x24, 0x104.0, 0x106, 0x107, 0x45.0; else a random angle from its seed), same subtype, champions morphed alike, score x0.5, scale x0.66, max HP and HP x0.4 each.
Vade Retro's ghosts (case 144 @0x5d78ee, 1000.144 Enemy Ghost, anm2 Idle1..4, Explode, Explosion)
Subtype 0, the ghost:
- Room clear and no Exorcist (
Room::has_exorcist 0x5cd670, room +0x7768): 1000.15 subtype 1 poof at it (offset + (0, 4), colorize (1, 0, 0, 1)), Remove. - _state 0 and its spawner a player holding Book of Virtues (0x248) firing (GetFireDirection != -1), on IsFrame(30, index): a tear 2.0 (variant from g_tearFlagsNone, all zero: 0) at the ghost, velocity fire direction * 10, spawner/parent the player, falling speed U(0, 0.2), falling accel 0, SetCollisionDamage(3.5), scale 0.5, colour (tint 1, 0.5, 0.2, alpha 0.5, offset 50/255, 0, 0), tear index Random(2).
- _state 1 (Vade Retro set it): spawn k = (sprite scale.x > 1.15 ? 3 : 1) explosions 1000.144 subtype 1 at angle r
- i * 360 / k (r = U(0, 360)), 40 px out when k = 3 (0 when 1), sprite rotation U(0, 360), SetCollisionDamage(the ghost's collision damage), Update, offset (0, -13); Remove the ghost.
- Otherwise drifts: colour alpha 0.8 (+0xc via 0x407280), friction 0.9; IsFrame(10, seed): flipX = nearest player is to the right; IsFrame(3, seed): tears within 80 whose distance < tear size + 10 push it by tear velocity * 0.1. Subtypes >= 1, the explosion (damage = its collision damage):
- Frame 4: a 1000.15 loaded with "resources/gfx/1000.034_Fart.anm2" playing "Explode", sprite scale and offset (+ (0, 4)) of the explosion, colorize by subtype (2: (1, 1, 1, 1); 3: (1, 0.75, 0.6, 1); else (1, 0, 0, 1)); subtype 2 adds 1000.2.3 "Poof_Large2" (tint 1.5, colorize (1,1,1,1), offset 0.7), subtype not 3 adds 1000.2.0 "Poof_Large1" + a 1000.7 blood splat.
- IsFrame(5, 0) or _state 0: _state = 1, r = sprite scale.x * 80. Unless spawned by an NPC (spawner type 10..999) that is not friendly: QueryRadius(r, partitions 10): projectiles: flags cleared, Die; vulnerable enemies, fireplaces 33, movable TNT 292, poops 245: TakeDamage(damage, 0, empty source, 30) and velocity += away * 4. Grid: the 5x5 cells around, each with collision class > 1 within r + 15: Hurt(1, source the effect).
- Remove when the animation finishes.
Ocular Rift (case 180 @0x5e1225, 1000.180 Rift, anm2 Vortex, Open, Idle, Close)
- First tick (_state 0 -> 1): Play "Open", overlay "Vortex", overlay render priority 1. Each tick layers 1..4 copy layer 0's current frame alpha and scale.
- Dead (_timeout reached 0): Play "Close", Remove when finished.
- Alive: "Open" finished -> "Idle". Owner = the spawner as a player, else its last spawner as a player. R = sprite
scale.x * 256; s = min(1, sprite scale.x). Every room entity (asm 0x5e153b..0x5e1b85) that is a vulnerable enemy
(not the owner), a projectile, a bomb, or an unpriced pickup (chests only while subtype != 0, i.e. closed), not
itself, not exactly on it, friction != 0, within R:
- d = distance; dir = toward the rift; force = 20 for enemies, tears and bombs, else 8; force *= s.
- (Enemies and bombs within their size + rift size + 16 multiply a local by 0.8 that is never read: dead code.)
- IsFrame(10, 0) and an enemy within its size + rift size, vulnerable or a collidable fireplace/TNT/poop: TakeDamage(_collisionDamage, flags 8, source the rift's parent, 30).
- k = d < 8 ? d / 64 : 1 / d; force = force * k / friction.
- Projectiles: velocity *= max(0.5, 1 - 2k); k > 0.3 with falling accel < 0 -> accel 0; alive, inside the rift's size, over 15 frames old and height > -50 -> Die.
- AddVelocity(dir * force).
- Then Game::AttractEntities(pos, Entity_Effect::rift_attract_filter 0x5cd950 (skips the owner), owner, strength 20, radius 250). _size = config collision radius (+0x38) * sprite scale.x.
- IsFrame(10, 0): QueryRadius(_size, all): not the owner; 1000.21/33/63/64/159 Die; vulnerable enemies or collidable fireplace/TNT/poop: flags 8, and with an owner GetTearHitParams(weapon 3, 1.0, 0, spawner) -> get_tear_flags_from_player + Entity_Tear::ApplyTearFlagEffects(target, pos, flags, rift, damage); TakeDamage( _collisionDamage, flags, source the parent, 30).
- Spawn: UpdateBoneTear 0x676be0 (parity_tears.md): scale = the tear's, damage = tear damage * 0.5, timeout 60.
Jacob's Ladder chain lightning (case 167 @0x5e038f, 1000.167)
- _state 0: the initial target goes in the hit list; _state 1.
- Acts only on ticks where the tail marked it dead (its timeout ran out; spawn_chain_lightning 0x707e10 sets it): timeout 1, alive again, _maxRadius -= 1 (arcs left).
- water = room _waterAmount (+0x7240) > 0.1; range = _minRadius, + 200 with water unless the current target exists and is not a ground walker (grid collision class 5 or 6).
- QueryRadius(range, enemies): candidates = vulnerable, not flags 0x20000010, not the current target. Reach = _minRadius (the water range for ground walkers in water); with plain reach, skip unless distSq < (its size + reach)^2. Already hit ones only with entity flag 0x400000 (0x25b / trinket 0x8f). Score = distance (+100 if already hit) + (U - 0.5) * 50, x0.15 for ground walkers in water; lowest score with distance > 0.01 wins.
- A pick, or the first arc (_state 1): direction = pick - pos, or a random vector * U * _minRadius. Laser ShootAngle(variant 10, pos, angle, timeout 3, offset (0, -18), spawner, 1); none -> Remove. The laser: prism touched (no Angelic Prism split), max distance |direction|, SetCollisionDamage(_collisionDamage), tear flags = (the effect's +0x420 flags & a mask) | SPECTRAL (mask bits, static 0xc7fb78: 3, 4, 5, 11, 13, 14, 15, 20, 21, 22, 24, 32, 33, 39, 40, 41, 43, 44, 47, 48, 49, 50, 53, 54, 56, 64, 65, 66, 67, 73, 74), its hit list = the effect's minus the pick, mass 0 (+0x37c), one hit, disable follow parent, Update; _state++.
- Pick: target = it, into the hit list, the effect moves onto it. No pick: _maxRadius = 0. _maxRadius <= 0: Remove.
Crack the Sky (case 19 @0x5e96b5, 1000.19, anm2 "1000.019_crack the sky": Spotlight, SpotlightDelayed,
SpotlightDelayed2; events 0 "Sound", 1 "Hit"; entities2 collision radius 30)
- Init (Entity_Effect::Init 0x5cdb20): collision damage 20. Spawners set their own (Salvation: SetCollisionDamage(3.5)).
- _state 0: Play "SpotlightDelayed2" (subtype 3), "SpotlightDelayed" (subtype 2), else "Spotlight"; _state 1. (Salvation's spawner calls set_state(1) right after spawning, so its first update skips this Play.)
- Subtype 3 (Salvation), until "Hit" has fired (neither IsEventTriggered nor WasEventTriggered "Hit"; asm
0x5e9772..0x5e9aeb):
- _state 1: playback speed (sprite +0x104, 0x440e50) = 1.0, _state = -1.
- _state -1: playback speed 0; frame (AnimationState +0x40, 0x40a7c0) -= _speedMultiplier (the room time scale); <= 0 -> Remove; else set the frame (0x40a740).
- Entity_NPC::Update 0x6c4b30 calls set_state(beam, 1) every tick its enemy is inside a Salvation halo. Read together with the _state++ below (asm 0x5ea30d, every tick layer 0's current frame is visible), the rewind branch is reached only on a tick that starts at -1, i.e. after a tick whose layer-0 frame was hidden or had no frame: with a visible layer 0 the sequence is 1 -> -1 -> 0 (++) and next tick 0 -> Play (no restart) -> 1 -> -1 -> 0, so the beam plays forward whether or not set_state(1) came. In the dump's SpotlightDelayed2 layer 0 is visible on its first frames. See parity_questions/effect_update.md.
- With a target: t = the frame of the current animation's event-1 ("Hit") trigger (animation data +0x28 pairs (event id, frame), +0x2c count; 10 if none); p = min(1, frame / t); the target gets SetColor(tint (1, 1, 1), A 1, colorize (0.8, 1.6, 1.6, strength p), offset (0.8p, 0.5p, 0.5p), duration 2, priority 0, fadeout 0, share 1) (Color 0x435b50; lerp(p, 0, 0.2) = 0.8p, lerp(p, 0, 0.5) = 0.5p). No target: velocity 0.
- Event "Sound" (subtype not 3): sound 0xad (173 light_bolt_delayed; vol 1, delay 2, pitch 1).
- Event "Hit": sound 0xac (172 light_bolt), ShakeScreen(5), 1000.18 Bomb Crater subtype 1 at it (seed from its drop RNG), sprite scale 0.5, Update; _state = 1. Subtype 3 also: target dropped, velocity 0, and 4 lasers ShootAngle(variant 5, pos, i * 90, timeout 30, offset (0, -12), spawner its parent, 0) for i = 0..3, each SetCollisionDamage(_collisionDamage * 0.5), SetColor(tint 1, A 1, colorize (1, 1, 1, 1), offset 0; -1, 255, 0, 1), disable follow parent, depth offset 3000 (i = 3: -10).
- Damage (subtype < 10, while layer 0's current frame (Sprite::GetLayerFrame 0x40b1a0) is visible): on ticks with
(_state - 1) % 3 == 0 (C remainder: -1 gives -2, no hit), and _state++ on every tick the frame is visible, hit or not (asm 0x5e9ee5,
0x5ea30d).
"Hit" sets _state 1, so hits land on the Hit tick and every 3rd tick after; a set_state(1) from Entity_NPC::Update
in between (Salvation, every tick the enemy is in the halo) re-arms it, so the rate depends on whether the NPC or
the beam updates first that tick (question file).
- source = its parent, else itself. enemyBeam = the source is not a player; outside deathmatch cleared when the source has entity flag 1 << 60; in deathmatch always set.
- QueryRadius(_size, all partitions): not the source, alive, collision class != 0, max HP > 0; outside deathmatch
entities of the source's own type are skipped.
- players (type 1), only when enemyBeam: TakeDamage(2.0 (7.0 in deathmatch), flags, source, 30); in deathmatch with tear-flag bit 100 in its +0x420 flags: flags |= 1 << 35 and that bit is cleared (FUN_005cd430 ANDs).
- NPCs (type > 9): TakeDamage(enemyBeam ? 2.0 : _collisionDamage, 0, source, 30).
- Subtype 1 becomes 10 after its first pass (one hit only).
- Remove when the animation finishes.
- Salvation beam, all together: 1000.19.3, parent/spawner the player, damage 3.5 from "Hit" on, every 3rd tick (more often while re-armed, see above) while layer 0 is visible, to everything in its 30-radius except players; four light-beam lasers (variant 5) for 1.75 each at the hit.