Files
isaac-port/notes/entities/dogma_effects.md
T

20 KiB

Dogma fight effects (1000.169-172) and Dogma's brimstone

Read from Entity_Effect::Update 005d4380 with --asm (variant switch at 005d47cc: JMP [(variant-1)*4 + 0x606f8c]), Entity_Effect::Init 005cdb20, NpcAI::ENTITY_DOGMA 004aafa0 and NpcAI::ENTITY_DOGMA_angel 004ae4d0. Effect fields: 0x450 State, 0x454 MinRadius (free float), 0x458 MaxRadius, 0x45c Timeout, 0x460 LifeSpan (Entity_Effect::SetTimeout sets both), 0x464 IsFollowing, 0x468 ParentOffset, 0x474 Rotation, 0x478 Scale. Entity: 0x173 _dead, 0x358 DepthOffset, 0x36c Friction, 0x370 Size, 0x39c speed multiplier (time scale, "ts" below). Common tail 00606e88 (every variant): if timeout > 0: timeout--; if timeout <= 0: _dead = 1. So "timeout ends" = _dead set at the end of that tick; the case code reacts on the next tick. GetIntervalTicks(n, off) = "frame count (+off) crossed a multiple of n this tick" (time-scale aware); effects pass off 0.

creep_static (Entity_Effect::Update case 005eaf9d, 1000.169)

Shared creep case (variants 22-26, 44-46, 53, 54, 56, 92, 94, 169, 204); 169 branches at 005eb8b0 / 005ebbaa / 005ec5d4.

  • Init 005cdb20: sortingLayer 0, renderZOffset 2000, timeout 125 (default; Dogma overrides), field 0x158 |= 0x20 (169 only; unknown). Invisible in room type 16.
  • First tick (state 0 -> 1): s = sprite scale x as spawned. Animation <size>Blood%02u with index rand(6)+1: s < 0.99 SmallBlood, < 1.3 Blood, < 2.1 BigBlood, else BiggestBlood (all 22-frame loops). Size (0x370) = 20 * s * Scale (Scale 0x478 = 1). Sprite scale is then RESET to (Scale, Scale): the spawn scale only picks the art and radius. Starts at frame GameFrameCount % 22; 169 keeps playing (no frame stop, unlike 44/45/92). 0x454 = sprite alpha.
  • Every tick: non-player, non-friendly creep calls Die when the room is clear and its EntityList counter (+0xa8 + +0xac, FUN_00456540: probably live enemies) is <= 0 (also a flooded-stage case for stage ids 12/33).
  • _dead or EntityFlag 0x10000 (FLAG_NO_BLOOD_SPLASH) skips all damage. Dogma's Appear "Splat" creep sets that flag: it is decoration only.
  • Damage (not friendly; friendly static creep does nothing: the enemy-side branch at 005ec5d4 also requires !friendly, so it is unreachable): for each player not dead, EntityCollisionClass != 0, GridCollisionClass == 5 (ground, i.e. not flying), no trinket 14 (Callus), no collectible 571: if dist(player, creep) < Size * spriteScale.x + player.Size AND the creep sprite's texel under the player has alpha > 0.5 (FUN_0040b600 = GetTexel-like, layer -1, both positions * 0.65): unless FUN_007dba30 (Evil Charm 632 immunity to this source) or collectible 571, player TakeDamage(1, DamageFlag 0x10 ACID, source = creep's parent or the creep, countdown 30). No slow, no footprint colour (169 skips SetFootprintColor).
  • Fade (once _dead, 005ed1b0): each tick scale *= 0.98; alpha = clamp((40 - state) / 40, 0, 1) * 0x454; state++; Remove when state > 40. State is 1 when the fade starts, so it lasts 40 ticks.
  • LifeSpan (0x460) is not read by the creep code.

dogma_debris (Entity_Effect::Update case 005dc73f, 1000.170)

  • Init: sortingLayer 0; overlay "Float" (64-frame loop) at a random frame; main "Idle" (11 frames) set, not played, to a random frame (one of 11 pieces); FlipX = rand(2) != 0 (sprite+0x100); FLAG_DONT_OVERWRITE (1<<21).
  • Update: every tick layer 0 takes the Float overlay's null 0 ("Offset") position, rotation and scale. Nothing else: no timeout, no collision (radius 0). Pure decoration for the rest of the room.
  • Spawn (ENTITY_DOGMA 004ab600 loop, on the intro's "Shoot"): 30 pieces, no spawner. Perimeter P = 2w + 2h of the room box (Room +0x14..0x20); t = (rand + i - 0.5) * P / 20 (yes /20 with i < 30), walked clockwise: t <= w top edge (TL.x + t, TL.y); <= w+h right edge; <= 2w+h bottom edge going left; else left edge going up y = TL.y + h - (t - 2w - h), so i >= 20 lands on the left edge's line above the top-left corner. Then pushed outward from the room centre by 10 + 80 * rand. Same moment: all 960.4, 1000.74 and 1000.169 in the room are Removed, doors removed, backdrop swapped.

dogma_blackhole (Entity_Effect::Update case 005dc811, 1000.171)

Anims: IdleClosed 6 loop, Open 14, Idle 16 loop, Death 21 (Shoot f12), Fizzle 21, Trail 15, Swirl 1.

  • Subtype 0 (the hole). Init: FLAG_DONT_OVERWRITE, sprite flag 0x20, IdleClosed, timeout 45. Collision radius 15. Every tick, any state:
    • velocity *= lerp(1, 0.8, min(FrameCount / 20, 1)) (Dogma launches it at 15 toward Isaac).
    • AddVelocity((Room::GetClampedPosition(pos, 80) - pos) * 0.02, capped at length 12) (stays 80 inside the walls).
    • QueryRadius(pos, 100, all): only Dogma's TV (950.1) gets AddVelocity((hole - tv) * 12 / dist^2, capped 12).
    • State 0 (closed): posOffset.y = min(posOffset.y + ts, 0) (Dogma spawns it at (0, -46): lands in 46 ticks). Every 2 ticks a 1000.111 (Haemolacria Trail) at pos, velocity = hole velocity * 0.5, same posOffset, colour (0,0,0,1) permanent, DepthOffset -10. When the timeout ends: state 1, Scale = 4, play Open, _dead cleared, SetTimeout(120), sound 545 (dogma/black hole opening, delay 2).
    • State 1 (open, 120 ticks): Open finished -> Idle. While the animation loops, every 3 ticks ShakeScreen(2). Every 6 ticks: a 1000.171.1 trail at pos, then a projectile 9.0 at pos + FromAngle(trail rotation) * 560 (trail rotation is random), velocity 0, spawner = the hole's spawner, spawnerType/Variant copied, subtype 2, Height -27, FallingSpeed 0, FallingAccel -0.095, Acceleration 0.6, Scale lerp(0.6, 1.8, rand), ProjectileFlags 1<<13 | 1<<27 (NO_WALL_COLLIDE | ACCELERATE by the Lua enum), colour (1,1,1,0) fading in over 10 ticks. Every 14 ticks a 1000.171.2 swirl. Scale += 0.25 * ts (4 -> 34 over the 120 ticks). Pull, every room entity except Dogma (950.*), itself, entities with its own status-effect target, at its exact position, or with Friction 0; only: vulnerable enemies, projectiles, tears, bombs (type 4), players, free (price 0) pickups (chests only with subtype > 0): d = distance; f = d < 64 ? d / 4096 : min(20 / d, 1); tears/projectiles f *= min(their FrameCount / 30, 1); players f *= min(d^2 / 230400, 1) (i.e. (d/480)^2). k = (enemy, tear or bomb ? 6 : 4) * Scale * f / Friction; AddVelocity(unit(hole - e) * k). Tears and projectiles first: velocity *= max(1 - 2f, 0.5) (time-scaled). Tears also lose a flag group (mask DAT_00c34b60) once their speed^2 < 1. Within 48 (d^2 < 2304): tears (not dead, without mask DAT_00c34c50 flags, FrameCount > 15, Height > -50) and projectiles (same tests) are Removed; pickups that CanReroll are Removed; bombs Removed; players TakeDamage(1, flags 0, source hole, countdown 30). At timeout 30: sound 546 (black hole closing bursting) with delay 30. Timeout end: state 2, play Death.
    • State 2: on Death's Shoot (frame 12): ShakeScreen(10), Game::ButterBeanFart(pos, 120) (push-back), 22 projectiles 9.0 (spawner = hole's spawner): dir = RandomVector, position pos + dir * 5, velocity dir * 15 * rand, Height lerp(-22, -30, rand), FallingSpeed 0, FallingAccel lerp(-0.06, -0.09, rand), Scale lerp(0.6, 1.8, rand), Acceleration 0.95, ProjectileFlags 1<<37 (ACCELERATE_EX by the Lua enum). Every projectile 9.0 with the hole's spawnerType and subtype 2 (the ring ones still flying in) Dies. Death finished -> Remove.
    • Fizzle: Dogma's death "Sound" sets state 2, plays Fizzle (no Shoot event: no burst), _dead; removed when it ends. The same pass sets every 950-spawned projectile's flags to 0 and _dead, lasers' timeout to 1, effect 1000.126 state 1.
  • Subtype 1 (Trail): DepthOffset -10; sprite rotation += Rotation (0x474, 0 unless set) * ts; Remove when Trail ends. Init: Trail, scale (1 + rand, 0.5 + 0.5 rand), rotation rand * 360. Dogma's own trails (state 12, every 8 ticks after "Sound" until "Splat") are at Dogma's pos, posOffset (0, -46), sprite scale (0.5 + 0.2 rand, 0.2 + 0.2 rand).
  • Subtype 2 (Swirl): Init scale 3, alpha 0, random rotation. Per tick DepthOffset -10, scale -= 0.1 ts, alpha += 0.07 ts, rotation += 30 ts; Remove when scale <= 0.1 (~29 ticks).
  • Dogma side (state 12, ENTITY_DOGMA spawn at 004ad70a): on "Shoot" sound 544 (black hole shooting), stop 543 (charge), spawn subtype 0 with velocity unit(player - Dogma) * 15, posOffset (0, -46) (0xc2380000), kept at Dogma+0xbec. While 0xbec is set Dogma's move speed (+0xc34) eases toward 0.05 instead of 0.9 (c34 = (c34 - target) * 0.9^ts + target).

dogma_orb (Entity_Effect::Update case 005de1a6, 1000.172)

Anims: Open 14, Idle 12 loop, Attack 8, Fizzle 21, Death 45 (Shoot f12), Swirl 1, Spot 3. Does NOT spawn NPCs or projectiles; its attacks are light beams (laser variant 5) fired by its subtype-1 "spots". (Angel Babies 950.10: spawner not found in these routines.)

  • Subtype 0 (the orb). Init: FLAG_DONT_OVERWRITE, sprite flag 0x20, layer 2 additive, Open, 0x454 = 0. The angel's NukeStart "Shoot" (state 9) spawns it with parent = angel, posOffset (0, -100), 0x454 = 3.0 (volleys left), 0x458 = 0, sound 561, ref at angel+0xbec. Every tick: with a parent, pos/velocity = parent's. DepthOffset 40. Not _dead and the animation finished -> Idle. Every 8 ticks (not _dead) a 1000.172.2 swirl with its posOffset.
    • Volleys (0x454 > 0), each tick while the animation loops (Idle): state++; at state 6 sound 563 (light ray charge, vol 0.2, pitch 1.05946). At state = cumulative sums of {6,5,4,3,3,2,2,1 x11} (6, 11, 15, 18, 21, 23, 25, 26..36) spot j (0..17): a0 = RNG(seed +0x3ec, shift 35).RandomFloat * 360 (same every volley), angle = j * 110 + a0 - 30 + rand * rand * 60; t = 75 - state; r = (rand + rand) * 4 - 4; angle -= (t - 20) * r + 8.33731 * r (pre-undoes its spin); spot timeout t, Rotation r, targetPosition FromAngle(angle) * 21 * sin((0.5 + 0.5 rand) * pi / 2), parent orb, orb's posOffset, sprite scale (1 + rand). At state 75 (all 18 spots expire together): stop 563, sound 564 (light ray fire, vol 0.7), play Attack, state 0, 0x454 -= 1. Three volleys.
    • 0x454 <= 0: state = -1 (the angel's NukeLoop waits for state < 0 and then SpreadAttack, state 13). While the parent remains, SetTimeout(45) every tick. SpreadAttack "Shoot": orb velocity = FromAngle(aim) * 15, parent and 0xbec cleared, sound 562 (light ball throw).
    • Thrown (no parent): velocity *= lerp(1, 0.8, min((LifeSpan - Timeout) / 20, 1)), speed at least 2; posOffset.y = min(posOffset.y + 2, -27.5). First thrown tick (state -> -3): 8 spots, angle i * 45 with the same spin pre-compensation, timeout = orb timeout + 12, radius 21, sprite scale 2. The orb's timeout (~45) ends -> state -2, Death; Death's Shoot (frame 12, when those spots fire) sound 564, velocity 0; Death finished -> Remove.
    • Contact (every tick, not _dead): QueryRadius(pos, Size, partitions 0x29 = familiar | enemy | player); hit list (+0x4a8) cleared every 5 ticks; targets on the other side than the orb (friendly flag vs player/familiar/friendly), not dead, once per hit-list period: enemies TakeDamage(orb CollisionDamage, 0, orb, 30), players/familiars TakeDamage(1, 0, orb, 30). Size: entities2 radius is 0 and nothing here sets it (unconfirmed whether it is ever > 0).
    • Angel death: state -2, Fizzle (once), _dead; Fizzle has no Shoot, removed at its end; spots Removed.
  • Subtype 1 (Spot, the beam telegraph). Init: Spot frame 0, layer 1 hidden, additive. Per tick: with a parent, pos/velocity/posOffset = parent's. State 0: DepthOffset 60; Spot frame by |target| (> 19: 3, > 17: 2, > 12: 1, else 0); state 1. Every tick: if timeout <= 20, Rotation *= 0.9^ts; target rotated by Rotation * ts; sprite rotation = angle(target), sprite offset = target * 0.65. Timeout end: Entity_Laser::ShootAngle(5, pos + target + posOffset + (0, 15), angle(target), timeout 12, posOffset (0, -15), source spot), laser spawner = spot's spawner, laser scale (+0x4e0) = 0.5 * spot sprite scale x, colour white (permanent), disableInitSound = 1; then the spot Removes itself. No parent -> Remove (no beam).
  • Subtype 2 (Swirl): Init scale 0.7, alpha 1, random rotation. Per tick DepthOffset 20, scale += 0.1 ts, alpha -= 0.07 ts, rotation -= 30 ts, Remove at alpha <= 0 (~15 ticks). Moves with its spawn velocity (the angel's RingLoop, state 10, spawns one every 6 ticks with half the angel's velocity and the angel's posOffset).

bullet_poof_static (Entity_Effect::Update case 005d4b7a, 1000.200)

Shares the generic poof case with 3, 11, 12, 13, 15, ...: no own logic. Dogma's death "Sound" spawns one per stored (position, height) pair, sprite offset (0, height), then sound 30 (death burst small).

dogma_brimstone (NpcAI::ENTITY_DOGMA ShootAngle call 004ac5e0, laser 7.1)

State 8 "Shoot": ShootAngle(1, (x, y - 15), axis angle of the facing, timeout max(90 - stateFrame, 0) + 15, posOffset (0, -30), source Dogma). Fields: +0x358 DepthOffset = -50 when aiming up (i1 == 1) else 1000; +0x518 _disableInitSound = 1 (Dogma plays 548 itself on the first frame, ShakeScreen 10); +0x428..0x434 TearFlags = {0, 0, 0x10, 0} = bit 68, the DAT_00c34b70 constant EvaluateItems adds for Eye of the Occult (572), i.e. TEAR_OCCULT; +0x334 _targetPosition = Dogma's target point: first frame start + dir * max(dot(player - start, dir), 100), later eased 0.1 a tick toward the player. With that flag HomingLaser::build_bezier_path 0099c790 bends the beam: a bezier from the origin through _targetPosition (control points at 0.333/0.666), then straight on from it to the wall (CalculateEndPoint). So it is a curving brimstone that tracks Isaac, not a homing or MaxDistance laser.

dogma_projectile_flags (Entity_Projectile::Update 00653070, 9.0 from 950.0)

  • Art: a 950-spawned shot with GODHEAD or LASER_SHOT (high dword & 0xc000, 006534fb) uses "DogmaElectricTear%d" (else "DogmaTear%d"), DepthOffset 300, field 0x158 |= 0x20.
  • Dogma's shots: JacobAttack (state 9) on each "Shoot": sound 550, 3 + (rand & 1) shots at random angles, speed 7, ProjectileParams FallingSpeedModifier rand * 3, FallingAccelModifier -0.096, Scale 1.5, flags high 0x4000 (LASER_SHOT). Godhead (state 11) "Shoot": sound 549, FireProjectiles mode 9 with (7, 8) = a ring of 8 at speed 7, CircleAngle pi/8 on even stateFrames (0 on odd), FallingAccelModifier -0.08, Scale 2.0, flags high 0x8000 (GODHEAD).
  • GODHEAD (bit 47), at FrameCount 1 (00653d82): one 1000.123.4 "Static Halo" at the shot's pos/velocity, spawner = the shot's spawner, sprite scale = shot Scale (0x420) on both axes, parent = the shot.
  • LASER_SHOT (bit 46, 00657c46), only when the shot dies (inside if (_dead), with its impact effects): if it has no target (+0x3c4), target = Game::GetNearestTargetPlayer(pos, 5000) (GetNearestEnemy when the spawner is charmed (EntityFlag 0x100) or the shot has CANT_HIT_PLAYER 1<<31). Spawns 1000.126.1 (Tech Dot) at the shot's pos, spawner = the shot's spawner, colour (1,1,1,1) + (2.5, 2.5, 2.5) offset, targetPosition = unit(target - pos) (or -unit(velocity) without a target). The direction is fixed then.

static_halo (Entity_Effect::Update case 006064cc, 1000.123.4)

  • No parent (the shot is gone): velocity 0, play "Disappear", Remove when it ends.
  • With the parent: pos, velocity and posOffset copied from the shot each tick. Unless the halo is friendly, QueryRadius(pos, 40 * sprite scale x, partitions 0x21 = familiar | player); each with collision class != 0 gets TakeDamage(0.0, DAMAGE_POISON_BURN 1<<15, source halo, countdown 30) every tick. Entity_Player::TakeDamage 007729d0 only logs a 0-damage record for amount <= 0 with that flag and returns 0, and Entity::Update skips records with amount <= 0: so it does not hurt Isaac. It never steers the shot (no homing).

tech_dot (Entity_Effect::Update case 005f9b88, 1000.126.1)

  • Init: sprite rotation random * 90, random FlipX, layer 1 hidden; subtype 1: timeout 60, sound 557 (jacobs ladder laser) pitch 0.9 + 0.2 rand. Anims: Idle 32 loop, Disappear 14 (no events).
  • Timeout end (or a "Shoot" event, none in this anm2): play Disappear; once (state 0 -> 1), if targetPosition != 0: Entity_Laser::ShootAngle(2 = thin red/tech, pos, angle(targetPosition), timeout 10, posOffset = dot's, source = the dot's spawner (Dogma)), laser spawnerType/Variant copied, +0x4e4 DisableFollowParent = 1, laser colour = dot's; for spawnerType 950: disableInitSound and sound 551 (jacobs ladder laser_1) pitch 0.9 + 0.2 rand. No MaxDistance: to the wall. Subtype 1 does no contact damage. Removed when Disappear ends and it has no child.
  • Dogma's death "Sound" sets every 950-spawned 1000.126 to state 1 (no beam).

dogma_scream (NpcAI::ENTITY_DOGMA case 0xd, state 13)

  • While stateFrame < 15 (reset to 0 with V2.x = 0 on "Scream"'s "Shoot": shockwave, sound 552): ShakeScreen(4), V2.x += 40 * ts; every projectile with type 9, spawnerType 950, subtype 0 and dist(Dogma, shot) <= V2.x is rewritten once (subtype := 1 marks it; i1 counts them):
    • SetColor((1,1,1,1) tint with 8 as the next component, i.e. a flash, 12 ticks, priority 255, fade);
    • 0x410 Height = -27.5, 0x414 FallingSpeed = -1, 0x418 FallingAccel = -0.085;
    • 0x428 CurvingStrength = -2, 0x42c Acceleration = 0.85, 0x3c4 target = Dogma's player target;
    • 0x438 ProjectileFlags low |= 0x8080000 (CURVE_RIGHT 1<<19, ACCELERATE 1<<27), high |= 3 (CHANGE_FLAGS_AFTER_TIMEOUT 1<<32, CHANGE_VELOCITY_AFTER_TIMEOUT 1<<33);
    • 0x450/0x454 ChangeFlags = its old flags without ACCELERATE; 0x458 ChangeVelocity = 2.0; 0x45c ChangeTimeout = int(entity time +0x3a4) + 20.
  • Behaviour: for 20 ticks the shot curves and slows: each tick (00658ea2) v += (-vy, vx) * |v| * CurvingStrength * ts then back to |v| (CURVE_RIGHT with -2: it turns the other way, counter-clockwise on screen), then v *= 0.85^ts (ACCELERATE). When the 20 ticks are up (GetIntervalTicks(ChangeTimeout) crosses then): velocity resized to 2 (CHANGE_VELOCITY) and its flags swapped back to the old ones (CHANGE_FLAGS), so it carries on at speed 2 with its original behaviour. The player target only matters if those old flags home (it does not seek on its own).

dogma_brimstone_hits (Entity_Laser::damage_entity 0097e3c0, laser 7.1)

  • Hit test (Entity_Laser::update_line_hits 00971810): along the beam's sample polyline, hit when the distance to it < entity Size + laser Size; laser Size = _scale (0x4e0, 1 for Dogma) * the variant's entities2 radius (16 for 7.1, 5 for 7.2) (Entity_Laser::ResetSpriteScale 0097fc10). Hits go into the laser's hit list (+0x520, once per entity while it stays there; where it is cleared was not traced).
  • Player (single player): TakeDamage(1.0, DAMAGE_LASER 8, source = laser's spawner (Dogma), countdown 30), so half a heart and the player's own invulnerability frames. Co-op players: only when not a descendant of the source.
  • Steering: Entity_Laser::update_laser calls HomingLaser::build_bezier_path every update, which rereads the laser's +0x334 for TEAR_OCCULT lasers, so the curve re-aims every tick. Dogma (state 8, while it has the laser as child and stateFrame < 90) moves that point every tick:
    • V2.x ramps from 0 by 0.02 * ts to 1; step = (player - target) * 0.1 * V2.x, its length clamped to [2, 4]; target += step * min(stateFrame / 20, 1) * ts;
    • if the new point's angle from the origin (Dogma + (0, -15)) differs by more than 10 degrees from the old one, it is rotated back to old + 10 (the code rotates by 10 - delta; for negative deltas that also lands on +10, which may be a sign slip: unconfirmed);
    • if it is closer than 60 to the origin it is pushed out to 60; laser +0x334 = the point.
    • After stateFrame 15: if Isaac's axis direction from Dogma differs from i1 and (rand & 3 == 0 or Isaac within 50 of the point): remove the laser, BrimstoneStart at its second-last frame, i2 = 4, sound 81 vol 0.5, V2.x = 0 (it re-fires on that animation's "Shoot").