diff --git a/db/fields.tsv b/db/fields.tsv index 3806cf2..da8a6c5 100644 --- a/db/fields.tsv +++ b/db/fields.tsv @@ -8,3 +8,10 @@ Entity_Projectile 0x414 float _fallingSpeed Planetoid shot/Blow set 0 (ENTITY_SW Entity_Projectile 0x418 float _fallingAccel setter 00444c90; Planetoid -.095/-.085, BACKSPLIT children -.04 Entity_Projectile 0x42c float _acceleration setter 004aad70; ACCELERATE multiplies velocity by it a tick (00659a62) Entity_Projectile 0x430 float _orbitDistance orbit target distance R in the ORBIT_CW/CCW steering (Planetoid 80, Blow 0) +Entity_Player 0x1e00 int _inventory[16] Tainted Isaac's slots of history indices, -1 empty; slot 0 dropped by a pickup past GetMaxInventorySize (characters_9.md) +Entity_Player 0x1ef8 int _hugCountdown Tainted Magdalene's hug: 9 on a swing, swings again under 3, counted down in the update (characters_9.md) +Entity_Player 0x157c float _meleeDamage EvaluateItems' damage before weapon multipliers; the hug's 2x base (characters_9.md) +Entity_Player 0x2004 bool _darkArtsBlastPending set as Dark Arts ends; the blast waits for the last snare (characters_9.md) +Entity_Player 0x2008 float _darkArtsDamage the snares' summed damage, the end blast's DamageRadius damage (characters_9.md) +Entity_Player 0x200c Entity* _darkArtsLastSnare the newest 1000.194 Dark Snare (characters_9.md) +Entity_Pickup 0x5c8 EntitySaveState* _flipSaveState Flip's ghost item (Room::SpawnEntry), swapped by TryFlip (characters_9.md) diff --git a/db/names.tsv b/db/names.tsv index dd80ead..a8dbc78 100644 --- a/db/names.tsv +++ b/db/names.tsv @@ -1412,3 +1412,9 @@ 009be850 PlayerManager::add_lost_curse null item 112 for every player (white fire) (alt_path.md) 007d87a0 Entity_Player::spawn_ghost_corpse effect 1000.6 playing the player's Death, before the Lost Curse (alt_path.md) 00739370 Level::place_special_rooms the level's special rooms: boss, shops, treasure, mirror/mineshaft/photo door rooms (alt_path.md) +00732fa0 ItemPool::pick_weighted GetCollectible's draw: cumulative base weights (+4), keeps a pick with chance running/base (+8), then running -= DecreaseBy (+0xc), under RemoveOn (+0x10) removed (characters_9.md) +00794e50 Entity_Player::update_effects per-tick player update: Dark Arts snaring (+0x2004/+0x2008/+0x200c), the end blast, Mars, hallowed ground... (characters_9.md) +00848d20 PlayerHUD::render_inventory Tainted Isaac's inventory slots (max/2 columns, 12 px, ui_inventory Dot/Select) (characters_9.md) +00431be0 Entity_Familiar::ai_umbilical_baby familiar 3.240: launch over frames 3-10 (180 * eased f, sinc swing 20), cord capsule hits (radius 16, x3), reel-in (characters_9.md) +0072b230 ItemConfig::load_locust locusts.xml entry loader: +0x74 speed, +0x78 scale, +0x7c collisionInterval, count, gfx/colors (characters_9.md) +007b0070 Entity_Player::spawn_dark_esau Dark Esau 866.0 at a free spot >= 80 px off (20 tries), stored at +0x1fc0 (characters_9.md) diff --git a/notes/README.md b/notes/README.md index 4ab7536..90eec17 100644 --- a/notes/README.md +++ b/notes/README.md @@ -13,7 +13,7 @@ stored here: `./decompile.sh 0xADDR` prints it from the dump, with the current n | `items/items_sweep_11.md` | Nancy Bombs flag roll (GetBombFlags) | | `items/trinkets_cards.md` | Trinkets (Walnut, Torn Pocket, Cracked Crown, Black Feather, Purple Heart, Mysterious Paper, Rainbow Worm, Error, The Twins, 'M, Panic Button), UseCard/UsePill cases | | `items/items_sweep_12.md` | Ghost Bombs soul spawn, Purgatory soul, Rocket in a Jar rockets, Angelic Prism split, orbit layer table, Tinytoma, Daemon's Tail coin test, Guillotine head | -| `characters/` | Rebirth behaviour + port design for tainted characters and Jacob & Esau; `characters_8.md`: T??? poop throw/nuggets/hallowed ground, T.Cain burst tables, T.Eve clot order and tears | +| `characters/` | Rebirth behaviour + port design for tainted characters and Jacob & Esau; `characters_8.md`: T??? poop throw/nuggets/hallowed ground, T.Cain burst tables, T.Eve clot order and tears; `characters_9.md`: AddKnockback, T??? death spill and poop flight, T.Cain burst caller/Daemon's Tail, item pool weights vs crafting, Dark Arts snares, T.Maggy hug, T.Isaac inventory, Flip ghosts, Abyss locusts, T.Lilith cord, Dark Esau | | `_tools/` | the one-shot port-side patch scripts those passes used (they edit isaac-classic data; kept for reference, not maintained) | | `../src/anm2`, `../src/rooms` | reimplementations of the anm2 player and .stb/RoomConfig loader, with their own decompile docs and tests | diff --git a/notes/characters/characters_9.md b/notes/characters/characters_9.md new file mode 100644 index 0000000..b537104 --- /dev/null +++ b/notes/characters/characters_9.md @@ -0,0 +1,155 @@ +# Characters pass 9 (isaac-classic rif/characters-9) + +What the port took from the code. Reprint any function with `./decompile.sh 0xADDR`. + +## Knockback (Entity::AddKnockback 0x6b7a80, Entity::Update 0x6ae820) + +- AddKnockback(ref, dir, duration, impact): skipped for friendly sources; `_knockbackCountdown = duration`, + `_knockbackDirection = dir`; mass (field 0x37c) > 10 divides both by log10(mass) (countdown at least 1). Flags high + word 0x8000 (knocked back), 0x10000 (impact), then CopyStatusEffects. +- Entity::Update while 0x8000: if |dir| >= 2: friction (0x36c) = base friction (0x368) * 0.95, dir *= 0.95 (unless + 0x20000), velocity = dir; on a grid collision with 0x10000: dir = normalized(...) * |dir| * 0.8, damage + `10 + 2 * (stage - 1)`, impact flag cleared; any grid collision halves the countdown. |dir| < 2 ends it. Countdown + decrements once a tick (0x6ae820 ~line 593). +- Tainted Azazel's sneeze 0xa01020: velocity += dir * speedMult * 900 / (mass + 50) / friction, then + AddKnockback(dir * 20, 14, 1). + +## tainted_blue_baby death (player update 0x782af0, on the DeathSound event, type 0x19) + +- ButterBeanFart(pos, radius 120), a poop (245.0) where he died, 6 poop gibs (1000.99), then + `for (i = 0; i < poopMana && i <= 18; ++i) { Spawn(5, 42, 0) (small nugget), velocity = rotated(+-20 deg) * + (rand * 6 + 3); AddPoopMana(-1); }`: the bound shrinks as mana is spent, so about half his poops (rounded up) spill. + +## Thrown poop (NpcAI::ENTITY_POOP 0x571280) + +- In flight (flag 0x4000000): height V1.x += V1.y * speedMult, V1.y += 2 (+0.8 variant 11); grid class 3 above -26. + Lands at height >= 0: flag cleared, velocity x0.6, sound 0x45 (0x1e7 variant 11), anim State<6-hp>, V1 zeroed. +- On the ground (state != 0, not flying): friction (0x36c) *= 0.5 each tick, so the landing slide adds about 0.6 ticks + of throw velocity. + +## tainted_cain burst (0x7d58f0) and its caller (Entity_Pickup::HandleCollision 0x6e8ae0) + +- HandleCollision calls it with pool -1 always (`tainted_cain_pedestal_burst(&pos, rng, -1)`), so the first pickup + is by ItemPool::GetPoolForRoom (00732dc0: a room-type table at ItemPool+0x69c, +0x718 in Greed modes; room type 3 + (error) picks a random entry). The case 9 (red chest pool) cracked key is reached only if a room maps to pool 9. +- Exempt: tag 0x8000 (quest), challenge 0x2b (43, Cantripped!), dimension 2, room index -12 (Genesis). +- Daemon's Tail (trinket 22): first pickup's soul heart weight 10 -> 0 unless rng%5 == 0; in the rest, a heart + (0.35 <= r < 0.55) falls through to the key/bomb branch unless rng%5 == 0 (r < 0.7, so a key). +- Unlock gates: bone heart achievement 0x1d3, rotten 0x1e7, cracked key 0x1eb, giga bomb 0x12e (or Greed/ challenge + overrides at game +0x26630/0x26589). + +## Item pools and the Bag of Crafting (ItemPool 0x735a30 loader, 0x732fa0 pick, 0x7340b0 ResetCollectible) + +- Pool struct at ItemPool+4 + pool*0x34: {+0 total base weight (float), +4/+8 entries begin/end}. Entry 0x18 bytes: + +0 id, +4 base Weight, +8 running weight, +0xc DecreaseBy, +0x10 RemoveOn, +0x14 flag. ResetCollectible sets + +8 = +4 in every pool and clears the removal bitsets (+0x67c removed, +0x68c seen). +- 0x732fa0 (GetCollectible's weighted pick): walks cumulative base weights to the target; accepts with chance + running/base (`1 - frac < +8 / +4`), else rescales the target and repicks (flags add repick budget). On a pick + (flag 1 clear): running -= DecreaseBy; under RemoveOn: running = 0 and the id goes in the +0x67c bitset (not in + challenge 0x2b; item 0x1e4 also removes 0x126). RemoveCollectible (0x733ff0) only sets that bitset. +- CalculateBagOfCraftingOutput (0x7d9d00) weighs `pool weight * entry +4` for items passing Item::IsAvailable(1) + (tag/mode/seed filters only): the base weight, so taken or seen items keep weighing in crafting. + +## dark_arts (player update FUN_00794e50; trigger_collectible_effect_removed 0x793970) + +- While the Dark Arts null effect holds (TemporaryEffects::HasCollectibleEffect), EntityList::query_player_capsule_hits + with his capsule + 10 (+30 more for type 0x18 with a collectible held, likely Birthright, which also spawns a + ring effect at `_marsCooldown`): each active enemy (without the excluded flag) and each projectile without + projectile flag 0x80000000, not in his hit list, gets Spawn(1000, 194 Dark Snare) parented to the previous snare + (player +0x200c, the newest), subtype = previous + 1. Its collision damage = GetTearHitParams(weapon 1, scale 2.0) + damage + subtype * 3.5; player +0x2008 += it; sound 0x1fb (507, Tooth and Nail tick) at pitch 1.5 + 0.05 * subtype. +- On the effect's removal (0x793970 case 0x2c1): the chain's first snare (GetLastParent) gets +0x45c = 1, +0x460 = 1 + (sets it off); player +0x2004 = 1 (blast pending). +- Each tick with +0x2004 set: SetMinDamageCooldown(8); once +0x200c is null or dead: sound 0x50 (80, black poof), + ShakeScreen(10), ground poof (colour 0.6 alpha), Game::DamageRadius(pos, radius 80.0, damage +0x2008, 0.8, flags + ...), +0x2008 = 0, null effect removed. (Arguments from objdump at 0x799756..0x799806.) +- Dark Snare (1000.194) behaviour sits in Entity_Effect::Update (does not decompile); its anm2 has only `Shadow`. +- No kill/shot damage boost found in this code (the wiki's claim). + +## tainted_magdalene hug (Entity_Player::HandleCollision 0x78e1f0, type 0x16) + +- On touching an enemy (IsVulnerableEnemy, no 0x20000000 flag) while +0x1ef8 < 3: GetTearHitParams(out, weapon 10, + scale (2 * +0x157c) / _damage, eye +-1), SpawnEx(8, 1, pos, 0, player, subtype 4) (a club knife), knife +0x334 = + 6.0, offset (0, -14), rotation = atan2 of Vector::ToCardinal(enemy - her) in degrees, its collision damage from the + hit params, SetAttackAnimation; +0x1ef8 = 9. The player update (0x782af0) counts +0x1ef8 down a tick (not under + flag 0x4000) and squashes her sprite by a table at 0xb6bc98 indexed min(6, 8 - n): one swing per 7 ticks. +- +0x157c: EvaluateItems' damage captured before the weapon-type multipliers (Sacred Heart x1.5 etc. applied to it + too; Polyphemus' +2 not the +40), then D8 and the max with the minimum like `_damage`: a "melee damage". + +## tainted_isaac inventory (type 0x15) + +- Slots: player +0x1e00, 16 ints of history indices (-1 empty). GetMaxInventorySize (0x7d4150) = 8, +4 with + Birthright (0x26b). CanAddCollectibleToInventory (0x7d4170): not an active (config type 3), not 0x290 (Damocles' + passive), not Birthright, no tag 0x8000. +- Entity_Pickup::HandleCollision: when slot [max-1] is filled, DropCollectibleByHistoryIndex(slot 0, this pedestal) + (History::RemoveHistoryItemByIndex closes the gap), then shifts slots right and sets slot 0 = -1, so the new item + lands in slot 0. +- The drop key handler FUN_007a42b0: after SwapActiveItems, rotates the filled slots left (slot 0 to the back) and + marks the HUD dirty. +- HUD FUN_00848d20 (from FUN_009a6fe0 at HUD +0x5934 + 58, +0x5938 + 45): max/2 columns, 12 px apart (times the HUD + scale), item icons, ui_inventory.anm2 (Back: Dot, Front: Select). + +## flip (711) ghost pedestals + +- Room::SpawnEntry (0x7ed310): a layout-spawned pickup that CanRerollVariant (variant 100, not a closed chest) while + PlayerManager::FirstCollectibleOwner(Flip) gets a flip save state at Entity_Pickup +0x5c8: {type 5, variant 100, + seed = RNG::Next(), subtype = ItemPool::GetSeededCollectible(seed)}. +- Entity_Pickup::Update: while a Flip owner exists and +0x5c8 is set, +0x5d0 (_altPedestalANM2) copies the pedestal + anm2 with the ghost's gfx; Render (0x6e69b0) draws its layer 1 at alpha 0.05 + rand*0.15 offset (-2.6, -2.6), the + pedestal itself at +2.6 (no offset when empty). +- UseActiveItem case 711: (not in the Genesis room for types 0x1d/0x26) every pickup 5.100 not dead: TryFlip + (0x6e1640): CanFlip (0x7eeeb0, actually "save to state") saves the current pickup, Morph into the flip state + (price etc. from it), the saved current becomes the new flip state (none if it was an empty pedestal); a 1000.15 + poof and sound 0x358 (856, flip poof) per flipped pedestal. + +## abyss locusts (familiar 3.231; Entity_Familiar::Update 0x61da10; locusts.xml loader 0x72b230) + +- Update: variant 0xe7: scale = the eaten item's locust config +0x78 (locusts.xml scale); when 1.0, by the item's + quality (config +0xc0; item 2.186 counts as quality 3) from the table at config +0x2a46c (locusts.xml's + ``: 0.8, 0.9, 1.0, 1.1, 1.2); sprite scale = that * the global scale. +- Loader 0x72b230 offsets in the per-item locust struct: +0x74 speed, +0x78 scale, +0x7c collisionInterval, then + count, gfx/overlayGfx/color/backColor/overlayColor (more not traced). +- GetCollectibleMaxCharge (0x7911f0): Flip (0x2c7) is 4 for types 0x1d/0x26 (Tainted Lazarus forms); 0x2c9 is 30 + for type 0x1a; 0x2d2 300 for 0x25/0x27 with Birthright; Abyss has no override (items.xml 4). + +## tainted_lilith umbilical baby (FUN_00431be0, familiar 3.240 update) + +- t = the familiar's frame counter (+0x3a4). t < 3: invisible, at the player. On becoming visible: a 1000.2 splash + at it (velocity = aim * 6, offset y -12). +- 3 < t <= 10 (launch; dir = its _targetPosition, the aim unit vector): u = (t - 3) / 6; f = u < 1: (1 - cos(pi u)) * + 0.6; u == 1: 1.2; u > 1: 1 + 0.02 sin(10(u - 1)) / (u^2 (u - 1)). Position target = player + dir * 180 f + side * + 20 * sin(10u) / (10u), side = dir rotated -90 deg when dir.x > 0 else +90; velocity = target - pos. +- The cord: points along a quadratic Bezier from the player (height -13) through player + dir * 234 to the baby + (heights blending -13/-15/-20), a sine whip on each point of amplitude by (15 - t) and (t - 6) * (15 - t) / 2. +- t > 4 (still in the launch block): capsule player -> baby, radius 16 (x1.5 with 0xf7 BFFS!; Tainted Lilith 0x20 + with Birthright: a longer chain, +1 radius per link up to 30, damage +3 per link), damage = collision damage * 3, + grid entities in it broken, each enemy once (its hit list); the first hit plays 0x1ef and a splash. +- Retract (state 2, fire released for its 0xd50 countdown, t > 20): +0x51 counts down by speed from 5: x = clamp(c / + 5), g = (1 - x)x + x, position = player + offset * g; under 0 the familiar is removed (Gello's). +- Past the launch, the cord points run a velocity-integrated rope (FUN_00434e70 per point) while held. + +## dark_esau (NpcAI::ENTITY_DARK_ESAU 0x5542e0, type 866; Tainted Jacob 0x25 / ghost 0x27) + +- Init (state 0): with spawn flag 4 plays Appear (spawns its pit 866.1: HoleOpen, ShakeScreen(6) on Shoot, HoleIdle + 150 ticks, HoleClose, removed), state 0x10; else Idle, state 3. Flags 0x80100011, `_isInvicible`, + AddPersistentEntity (he follows into every room), +0xf18 = 5. +- State 0x10 (appear): on Shoot: sound 0x131, ShakeScreen(10), collision class 4, then for 12 interval ticks + FireProjectiles(pos, (8, 8), mode 9, params: flags 0x80, ...). Idle once finished. +- State 3 (stalk): friction x0.8 (x0.64 overall), target = player (or the nearer of his Esau partner); goal = target + + (him - target) resized to 40 (80 when the player is "far"/out, 20 near the partner; accel 4 past 300 px) ; velocity + += resized(goal - him, 3 * clamp(|goal - him| / 200)) / friction. Charge when i1 < 1, not ghost-blocked, distance + < 120 and min(|dx|, |dy|) < 20: Charge, state 8, sound 0x70 (and his partner charges too). +- States 8/9: while Charge (not looping) plays: friction x0.8, velocity += resized(him - target, 0.8) (backs off), the + direction to the target locked once stateFrame > 14; then DashHori/DashUp/DashDown (by the locked direction, sounds + 0x77, 0x1e3) adding dir * 6 * speed a tick (trail effects 1000.59); ends after 12 ticks (60 in state 9) or on a grid + collision: DashEnd, state 3, i1 = 90 (i1 = 60 when a dash ends at room start). +- State 5 (Chained, Anima Sola): pulled 1.4 a tick back toward the chain's owner until the chain (+0xbec) is gone, + then a state 9 dash with stateFrame 30. +- State 13 (Split, Birthright: a second 866.0 subtype 1 Esau), b74 == 1 / 3 branches (launched by Anima Sola: enemies + within 10 take 9 + stage and AddBurn(150, 5.0); variant 3 hits the chained target for 30). +- take_damage_impl (0x7729d0): type 0x25 hit by 866: spawn_ghost_corpse, ChangePlayerType(0x27), SetMinDamageCooldown + (90), no damage. Floor start (0x7a4ba0): 0x27 back to 0x25; for 0x25 (not challenge 0x2c) a null effect (config + +0x1b4 of the null list) lasting (rng % 20) * 30 + 610 ticks. FUN_007b0070 spawns him at a free spot >= 80 px off + (20 tries) and stores him at player +0x1fc0. +- Anima Sola (UseActiveItem case 0x2d2): spawns effect 1000.193 (the chain) targeting the nearest enemy (Dark Esau + for these types), its timeout set; its behaviour sits in Entity_Effect::Update (does not decompile).