Merge items/effect_update: Salvation beam cadence
This commit is contained in:
commit
71e01c6ba8
1 file changed
+31
-16
@@ -266,18 +266,12 @@ 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)).
|
- 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
|
- _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.)
|
spawner runs this first Update itself before its set_state(1): see the tick-by-tick list below.)
|
||||||
- **Subtype 3 (Salvation), until "Hit" has fired** (neither IsEventTriggered nor WasEventTriggered "Hit"; asm
|
- **Subtype 3 (Salvation), until "Hit" has fired** (neither IsEventTriggered nor WasEventTriggered "Hit"; asm
|
||||||
0x5e9772..0x5e9aeb):
|
0x5e9772..0x5e9aeb):
|
||||||
- _state 1: playback speed (sprite +0x104, 0x440e50) = 1.0, _state = -1.
|
- _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);
|
- _state -1: playback speed 0; frame (AnimationState +0x40, 0x40a7c0) -= _speedMultiplier (the room time scale);
|
||||||
<= 0 -> Remove; else set the frame (0x40a740).
|
<= 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
|
- 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,
|
(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)
|
colorize (0.8, 1.6, 1.6, strength p), offset (0.8p, 0.5p, 0.5p), duration 2, priority 0, fadeout 0, share 1)
|
||||||
@@ -288,12 +282,12 @@ SpotlightDelayed2; events 0 "Sound", 1 "Hit"; entities2 collision radius 30)
|
|||||||
ShootAngle(variant 5, pos, i * 90, timeout 30, offset (0, -12), spawner its parent, 0) for i = 0..3, each
|
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),
|
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).
|
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
|
- Damage (subtype < 10, while null layer 0's current frame is visible): on ticks with (_state - 1) % 3 == 0 (C
|
||||||
(_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,
|
remainder: -1 gives -2, no hit), and _state++ on every tick that null frame is visible, hit or not (asm 0x5e9ee5,
|
||||||
0x5ea30d).
|
0x5ea30d). `ANM2::GetLayerFrame 0x40b1a0` is a misnomer: it calls `AnimationState::GetNullFrameById 0x40ac70`,
|
||||||
"Hit" sets _state 1, so hits land on the Hit tick and every 3rd tick after; a set_state(1) from Entity_NPC::Update
|
which matches the animation's **null** layers by id, so index 0 is the null "HitNull" (Id 0). In the dump's anm2
|
||||||
in between (Salvation, every tick the enemy is in the halo) re-arms it, so the rate depends on whether the NPC or
|
HitNull is hidden before the Hit and shown for 16 frames from it: Spotlight frames 4..19 (Hit at 4, 24 frames),
|
||||||
the beam updates first that tick (question file).
|
SpotlightDelayed 20..35 (Hit at 20, 40 frames), SpotlightDelayed2 24..39 (Hit at 24, 44 frames).
|
||||||
- source = its parent, else itself. enemyBeam = the source is not a player; outside deathmatch cleared when the
|
- 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.
|
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
|
- QueryRadius(_size, all partitions): not the source, alive, collision class != 0, max HP > 0; outside deathmatch
|
||||||
@@ -303,7 +297,28 @@ SpotlightDelayed2; events 0 "Sound", 1 "Hit"; entities2 collision radius 30)
|
|||||||
- NPCs (type > 9): TakeDamage(enemyBeam ? 2.0 : _collisionDamage, 0, source, 30).
|
- NPCs (type > 9): TakeDamage(enemyBeam ? 2.0 : _collisionDamage, 0, source, 30).
|
||||||
- Subtype 1 becomes 10 after its first pass (one hit only).
|
- Subtype 1 becomes 10 after its first pass (one hit only).
|
||||||
- Remove when the animation finishes.
|
- 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
|
- Update order (settles the Salvation cadence): `EntityList::Update 0x4186c0` updates `_updateEL` in list order and
|
||||||
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
|
stops at the entity that was last when the loop began; `EntityList::AddEntity 0x418500` push_backs new entities,
|
||||||
each at the hit.
|
and removal shifts the rest down, so order is kept. A spawned entity therefore never gets a list update in the
|
||||||
|
tick it was spawned, and the beam always updates after the NPC that spawned it. The sprite advances in the
|
||||||
|
prologue (`Entity::Update` plays the anm2 at playback speed x time scale) before the case runs.
|
||||||
|
|
||||||
|
### Salvation's beam, tick by tick (Entity_NPC::Update 0x6c4b30 asm 0x6c8cc5..0x6c8d31 + case 19)
|
||||||
|
|
||||||
|
1. Spawn tick, inside the NPC's update (enemy within get_salvation_scale() * 70 + its size of a Salvation holder, no
|
||||||
|
beam in its EntityPtr +0xf58): Spawn 1000.19.3 (Init plays the default "Spotlight", damage 20), SetTarget(NPC),
|
||||||
|
SetParent(player), SetCollisionDamage(3.5), then the NPC calls the beam's Update itself: _state 0 -> Play
|
||||||
|
"SpotlightDelayed2", _state 1 -> speed 1, _state -1. Stored in +0xf58; then set_state(beam, 1).
|
||||||
|
2. Every later tick, the NPC (updating first) calls set_state(beam, 1) while it is still in a halo's range. The beam:
|
||||||
|
its sprite advances by the speed it set last tick; before the Hit: re-armed (1) -> speed 1, _state -1; not
|
||||||
|
re-armed (-1) -> speed 0 and the frame steps back by the time scale, removed at frame 0. So it charges one frame a
|
||||||
|
tick while its enemy stays in range, rewinds one a tick while it is out, and the target's colour ramp follows.
|
||||||
|
3. The Hit lands 24 charged frames after the spawn (SpotlightDelayed2 event "Hit" at 24): sound 0xac, shake 5,
|
||||||
|
crater, the four variant-5 lasers (1.75 each), _state 1, and the damage pass hits (HitNull now visible), _state 2.
|
||||||
|
4. After the Hit the wait branch is skipped (WasEventTriggered), so the speed stays 1 and the animation runs on. While
|
||||||
|
the NPC keeps re-arming (in range, alive), every tick starts at _state 1, so **the beam hits every tick**; once it
|
||||||
|
stops, _state counts on and hits land every 3rd tick after the last re-arm. Hits stop when HitNull hides at frame
|
||||||
|
40 (16 frames: at most 16 hits); the beam is removed when the 44-frame animation finishes.
|
||||||
|
5. Each hit: TakeDamage(3.5, flags 0, source the player, countdown 30) to every alive, collidable, max-HP > 0 entity
|
||||||
|
of type > 9 within its size (30), not only its target; players are never hit (the source is a player and its own
|
||||||
|
type is skipped outside deathmatch).
|
||||||
Reference in new issue
Block a user