Files
isaac-port/notes/items/parity_death_certificate.md
T

8.4 KiB

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 (gx40+40, gy40+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.

Follow-up (minimap, transition, dimension-only rules)

  • Minimap::refresh_room_icons 0x98b5e0 draws g_game->_currentRoomMap: the current dimension's own 13x13 room map, each descriptor's own DisplayFlags/VisitedCount, a window around the current room. In dimension 2 a normal room (type 1) shows no mirror (subtype 0x22) or minecart (subtype 10) icon; other icons as anywhere.
  • RoomTransition::Update 0x8318a0 state 1 runs until no main player is playing an extra animation (DeathTeleport, 21 frames), then state 2 for _duration 3 (direction -1), then ChangeRoom; ChangeRoom's Appear starts at frame 2 (SetFrameFloat 2.0) of its 40.
  • ItemPool::pick_collectible 0x4508c0 (mis-named: it spawns 9.3/9.4 projectiles) only uses stage 0x23 in dimension 2 to pick its projectile variant (0x1c Dross -> 3); no item pool rule depends on dimension 2. A pedestal's saved _itemPoolType (+0x50, the item's first pool) is only read by Init/Morph/DropCollectible/CanFlip/save, never by rerolls.
  • GridEntity_Pit::BeginBatches 0x713760: stage id (0x23 in dimension 2) only gates the G-Fuel flooded-caves pit; the pit sheet comes from the room's backdrop (room +0x1d18), so dimension 2's grid art is backdrop 60's / 53's (rocks_depths, grid_pit_depths, props_05_depths). GridEntity_Rock::SpawnDrops 0x71b410: dimension 2 is never a Mines stage (0x1d/0x1e) for its drops.