From 35955a3517a8848346479a5b5b683b916777a402 Mon Sep 17 00:00:00 2001 From: shweet Date: Fri, 30 Oct 2026 16:45:54 -0400 Subject: [PATCH] Death Certificate and dimension 2: Level::generate_dark_closet 0x751650 (was GenerateHome), Level::enter_dark_closet 0x7515c0, the LevelGenerator's tables and growth, the way back (RemoveOtherOptions, Game::Update, ChangeRoom) and dimension 2's looks; notes/items/parity_death_certificate.md Co-Authored-By: Claude Opus 5.5 --- db/names.tsv | 5 +- notes/items/parity_death_certificate.md | 89 +++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 notes/items/parity_death_certificate.md diff --git a/db/names.tsv b/db/names.tsv index f1f7745..3e85da1 100644 --- a/db/names.tsv +++ b/db/names.tsv @@ -117,7 +117,7 @@ 006f9400 Seeds::GetForcedCurses src/rooms decompile labels (Seeds::GetForcedCurses?) 006f95a0 Seeds::GetPreventedCurses src/rooms decompile labels (Seeds::GetPreventedCurses?) 00744940 Level::Init src/rooms decompile labels (Level::Init) -00751650 Level::GenerateHome src/rooms decompile labels (Level::GenerateHome?) +00751650 Level::generate_dark_closet REPENTOGON ASM.zhl Level_generate_dark_closet_PostGenerateCollectibleSaveState hook; logs "Dark Closet Generated in %d Loops"; lays dimension 2 (stage 35 subtype 34 rooms, every item); notes/items/parity_death_certificate.md 00752c30 std::bitset<8>::to_string src/rooms decompile labels (std::bitset<8>::to_string(out)) 007e9080 RNG::RandomFloat src/rooms decompile labels (RNG::RandomFloat) 007e90f0 RNG::Next src/rooms decompile labels (RNG::Next) @@ -3477,3 +3477,6 @@ 00429560 DeathmatchManager::is_mode_4 returns *this == 4 (Game+0x26614 via GetField26614); TakeDamage Jelly Belly odds Random(2 - it); parity_defensive 007d3560 damage_charge_scale no args (ECX unused): 0.1 (0xbaa120) in deathmatch (game +0x26614 >= 2), else 1 / (stage * 20 + 40), stage + 1 on stage types 4/5; update_effects multiplies the frame's damage dealt by it and 50000 for Berserk! and Tainted Samson's charge (0x79c4a0) 00645bc0 FamiliarAI::lost_soul ? Entity_Familiar::Update case 0xd3 (entities2 3.211 Lost Soul); body not read +007515c0 Level::enter_dark_closet Death Certificate use (UseActiveItem case 0x5c3433): outside dimension 2 lays it once, keeps the current room/dimension/leave door, StartRoomTransition(0x50, -1, 0x14, 0, 2) +009b1910 LevelGenerator::block_cell sets the generator +0x2b8 byte for (x, y) (13x13); generate_dark_closet blocks (1,6), (2,5), (2,7) +009b1a90 LevelGenerator::queue_push_front deque push_front on generate_rooms local queue diff --git a/notes/items/parity_death_certificate.md b/notes/items/parity_death_certificate.md new file mode 100644 index 0000000..15a9994 --- /dev/null +++ b/notes/items/parity_death_certificate.md @@ -0,0 +1,89 @@ +# Parity sweep: Death Certificate (628 / 0x274) and dimension 2 (DIMENSION_DEATH_CERTIFICATE) + +Repentance+ 1.9.7.17. Done in isaac-classic (src/game/rooms/level_generator.cpp, generated_dimension.cpp). + +## Use: UseActiveItem case 0x5c3433 (table B slot 0x54) + +- `SoundEffects::PlayWithFartOverride(0x41e)` (forgetmenow.wav), then `FUN_007515c0` (Level; named + `Level::enter_dark_closet` here). Remove result set when used owned or by Void (flags & 0x44): single use + (items.xml maxcharges 0). +- FUN_007515c0: if `_currentDimensionIdx != 2`: `GetRoomByIdx(0x50, 2)->Data == 0` -> `Level::generate_dark_closet` + (0x751650, REPENTOGON's `Level_generate_dark_closet` asm hook; db/names had `Level::GenerateHome?`); keeps current + room, previous room, dimension, last dimension and leave door in Level (Game +0x18900.. as read by Game::Update); + `_leaveDoor = -1`; `StartRoomTransition(0x50, -1, 0x14, null, 2)`. + +## Level::generate_dark_closet 0x751650 + +- Dimension 2's room map is `_roomMap + 0x152` (169 per dimension); stage binary 0x23 (35, home.stb) loaded, or its + rooms' weights reset (+0x34 = +0x30) when loaded. +- Generator seed: `_generationRNG.Next()`; LevelGenerator RNG shifts (5, 9, 7) (`RoomDescriptor::Init` 0x9adaf0 is + the LevelGenerator constructor). Room-draw RNG: stage seed `_stageSeeds[stage (+1 on Repentance stage types 4/5)]`, + shifts (5, 7, 22). +- `CollectRooms(35, type 1, any shape 0xd, var 0..-1, diff 1..15, doors 0, subtype 0x22)` -> allowed shapes bitset + (home subtype 34: shapes 1, 4, 6, 8). +- Available items: every ItemConfig collectible with `Item::IsAvailable(3)` (flags 1 challenge/daily/greed bans, 2 + achievement) but 0x29c (Dad's Note) and 0x274 (Death Certificate), in id order. +- Blocks cells (1,6), (2,5), (2,7) (FUN_009b1910 sets the generator's +0x2b8 byte grid); start room LevelGenerator_Room + at (2,6), shape 2 (IH), size from 0xc5d388. +- `LevelGenerator::Generate(50, false, false, false, &shapes, 0 dead ends, &start)`; if usable, clears dimension 2's + map and walks `get_all_rooms` (non-dead-ends in index order, then dead ends sorted by distance desc, selection sort): + - room at (2,6) with shape 2: RoomConfig room of type 1, variant 100 (home's start closet, subtype 33); + - else `GetRandomRoom(seed, reduceWeight 1, 35, 1, shape, 0, -1, diff 1..10, &doors(+0x1c), 0x22, 0)`; + - `Level::place_room`; then per spawn entry (16 bytes, stride 0x10): next seed, `Spawn::PickEntry`; a pick of 5.100: + with items left an EntitySaveState {5, 100, item, +0x10 item config +200 (charge), pos (gx*40+40, gy*40+120), + +0x30 options index 1, +0x34/+0x38 seeds, +0x50 `ItemPool::GetFirstItemPoolForCollectible`, scale 1, score 1, + +0x60 auto price 1} pushed to the descriptor's saved entities; the grid index always goes into a set (descriptor + +0x80, read by Room::Init 0x7f2800 to skip those spawns); + - stops once every item is placed (remaining rooms never placed); `update_room_doors` on the new descriptors. +- Log strings: "generate...", "placing rooms...", "Dark Closet Generated in %d Loops". + +## LevelGenerator (0x9adbb0 ..) + +Layout: [0..3] RNG, +0x10 allowed shapes, +0x14 grid[169] room index, +0x2b8 blocked[169], +0x364 rooms (0x48 each), ++0x370 dead ends, +0x37c others, +0x388 boss idx, +0x390 flags (unk3, unk2, unk4, ?). +LevelGenerator_Room: +0 valid, +4 index, +8 x, +0xc y, +0x10 w, +0x14 h, +0x18 shape, +0x1c door mask, +0x20 connect +dir, +0x24 connect slot, +0x28/+0x2c connect cell, +0x30 neighbour set, +0x38 count, +0x3c dead end, +0x40 distance. +- Shape sizes 0xc5d378 (w,h): 0 (0,0); 1-3 (1,1); 4,5 (1,2); 6,7 (2,1); 8-12 (2,2). Cell offsets per shape at + 0xc5c4a0 (static init in get_room_placement_offsets): L shapes leave out (0,0) 9, (1,0) 10, (0,1) 11, (1,1) 12. +- Direction steps 0xc5d3e0: left (-1,0), up (0,-1), right (1,0), down (0,1); door slot & 3. +- has_shape_slot: height 1 -> no slots 4, 6; width 1 -> no 5, 7; closets 3/5 no even slots, 2/7 no odd (unless + ignoreThin). +- get_door_target_position: default {(x-1,y),(x,y-1),(x+w,y),(x,y+h),(x-1,y+1),(x+1,y-1),(x+w,y+1),(x+1,y+h)}; L shapes + their own tables (into their notch). get_door_source_position: the room's own cell the slot opens from. +- get_neighbor_candidates: per slot onto a free cell: a 1x1 (if allowed), then 13 spots (pos0 = target shifted one + further left/up for left/up doors; across = (0,-1) horizontal, (-1,0) vertical): shapes {6|4, 4|6, 4|6, 8, 8, L1, + L2, L3, L3, L4, L4, 2|3, 7|5} at {pos0, target, target+across, pos0, pos0+across, pos0, pos0+across, pos0, + pos0+across, pos0, pos0+across, target, pos0}, each drawn 1 in {48, 24, 24, 24, 24, 72, 72, 36, 36, 36, 36, 24, 24} + (always when 1x1 rooms are not allowed or unk), allowed and placeable; distance + 1. +- generate_rooms: start placed and pushed; pop front; candidates shuffled (Fisher-Yates); branch limit: start room + (target < 16: (Next & 1) + 2, else all), else min(4 coin flips, count); a candidate placeable with fewer than 2 + neighbour cells around its connect cell (XL/Void flags: else 1 in 10) and is_placement_valid is placed; Next % 3 == 0 + -> queue back, else front; stops at target rooms placed (start not counted). +- mark_dead_ends: non-start rooms whose connect cell touches < 2 other rooms' cells; parents cleared. + +## Leaving + +- Entity_Pickup::RemoveOtherOptions 0x6ee750: a collectible of options index 1 taken in dimension 2 with + `_deathCertificateExitTimer < 1` sets it to 0x5a (90). Others of its index poof (1000.15 at +10 y), collectibles + with timeout 4. +- Game::Update 0x6fadc0: while > 0: `_screenShakeTimer = 10`, count down; at 0 in dimension 2: `_leaveDoor = -1`, + `StartRoomTransition(saved room +0x18900, -1, 0x14, null, saved dimension +0x18904)`. +- Entity_Pickup::Update 0x6e3940: while the timer runs, any dimension-2 collectible of option 1 poofs (timeout 4). +- Level::ChangeRoom 0x73fc80: leaving dimension 2 restores the saved room, previous room, dimension, last dimension and + leave door. +- Transition 20: RoomTransition::start 0x82ee40 plays DeathTeleport on main players (controls off); Update waits for + the extra animation, then state 2 (3 frames); ChangeRoom 0x830950: in dimension 2 players at grid index width*4+10 + (cell (10,4) of a 15-wide room), Appear from frame 2, familiars 3.238 moved there; outside, Appear at frame 2. + +## Looks in dimension 2 + +- Game::GetStageID 0x738470 returns 0x23 (Home) in dimension 2 (and many stage-type reads short-circuit to 0x23: + ItemPool::pick_collectible, rocks, pits, Ambush::SpawnWave, update_ambient_effects). +- Room::PlayMusic 0x7eb1b0: track 0x45 (Echoes Reverse), no jingle. +- Room::LoadBackdropGraphics 0x7f1380: backdrop 0x3c (60 special_closet), 0x35 (53 house_closet_b) for a room config + of subtype 0x21 (the start closet). +- Room::GetLightingAlpha 0x81e250: alpha + 0.33 (max 1) in dimension 2 (not render_lighting's darkness + 0.6). +- Room::update_ambient_effects 0x824a70: mists (1000.138) in dimension 2, tint 120/255 grey. +- Entity_Pickup::UpdateSprite/Update: Curse of the Blind ignored in dimension 2. +- Minimap::refresh_room_icons 0x98b5e0: no room icons in dimension 2. +- get_rich_presence_room_status: 0x19 in dimension 2.