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

95 lines
8.3 KiB
Markdown

# Ultra secret rooms (RoomType 29), the ultra secret pool, red rooms (Red Key, Cracked Key, Soul of Cain)
Ported to isaac-classic (items parity sweep, cluster ultra_secret): the ultra_secret room kind, pool and placement, red
room rules.
## Placement: Level::place_special_rooms 0x739370 (ultra secret step, after the Dark Room's extra room)
- Unless the challenge's room set (ChallengeParams::_roomset) holds 29 (no challenge in challenges.xml filters 29: only
roomfilter 2 and 4), on every floor generate_dungeon 0x740e10 lays (Level::Init 0x744940: not Greed, not Home 13 nor
the Blue Womb 9, whose branch is generate_home, not the Ascent, not challenge 44's random layout).
- Room: RoomConfig::GetRandomRoomWithFallbackStage 0x82cdd0 (seed from an RNG of shifts 0xd, 3, 0x11, reduce weight 1,
the stage's set then stage 0 (special rooms), type 0x1d, shape 13 (any), difficulty 1-10, doors 0, subtype -1). The
special rooms' 9 type-29 rooms are all 1x1, difficulty 1, four doors, weights 1, 1, 1, 1, .75, .5, .25, .1, 1.
- Allowed set: for every room in Level's room list at that point (only special rooms: normal rooms are configured
later), every slot 0-7 whose RoomConfig has no door there, or any slot of a type 5 (boss), 8, 7 or 10 (curse) room:
get_door_target_position's cell, kept when inside 13x13.
- LevelGenerator::try_place_room 0x9ae640 (allowedIndices = that set): every cell that is empty in the LevelGenerator
grid (all rooms, normal ones too), not blocked (LevelGenerator +0x2b8: block_room_area 0x9b1860 for the last boss room
placed, its cells and their 4 neighbours) and NOT in the allowed set:
- score = 10 + Next() % 5 (LevelGenerator RNG);
- any of its 4 neighbours (left, up, right, down) a room or blocked: rejected (score - 90 < 0);
- for each of the 8 cells two steps away ((-2,0),(-1,-1),(0,-2),(1,-1),(2,0),(1,1),(0,2),(-1,1)) holding a room:
count it; for each side d of (left, up, right, down) with d . offset > 0, the room's base slot (d+2)&3 (pointing back
at the candidate) get_door_target_position: off the grid or not in the allowed set -> score -= 100 (stop);
- with a count: < 3 rooms -3, < 2 rooms -3 more; the best score keeps a list (ties appended), drawn by Next() % n.
- Placed: LevelGenerator::place_room, update_room_neighbors; then for each room at the 8 two-step offsets, every slot
0-7 whose target is an empty cell at Manhattan distance 1 from the new room gets its bit in the LevelGenerator room's
door mask (+0x1c): those normal rooms are configured later with a door slot there (the red key outline's way in).
- Level::place_room, Group 99.
## Red rooms
- Entity_Player::UseRedKey 0x5b2360 (UseActiveItem case 0x49 for COLLECTIBLE_RED_KEY 580 @0x5c27a4): the first of the
room's door outline effects (Room +0x7744, 1000.154) within 120 of the player -> Level::MakeRedRoomDoor(current, slot).
AnimateCollectible UseItem; challenge 0x2c adds null effect 0x6d.
- Room::UpdateRedKey 0x8271e0: the outlines exist while anyone holds Red Key (0x244), a Cracked Key (card 0x4e) or Soul
of Cain (0x53) in a pocket slot, or Void (0x1dd) absorbed Red Key; none in the last boss room or a negative-index
room; one per slot whose RoomConfig has the door, with no door entity, CanSpawnDoorOutline: at the door's grid cell
(x * 40 + 40, y * 40 + 120), rotation -90/0/90/180 by side, velocity 15 out.
- Level::CanSpawnDoorOutline 0x74cd70: not the last boss room, grid index >= 0, config has the slot, no door entity;
stage 13 (Home): only toward (3, 7); else get_door_neighbor_room valid and (on the map, or the room is a red room:
flag 0x400). So the floor's edge (I AM ERROR, -2) is reached from red rooms only.
- Level::get_door_neighbor_room 0x74cb50: neighbour -2 (off the map): valid unless challenge 44 or no next stage
(IsNextStageAvailable). Else the cell must be empty and every room beside it must have a door slot back into it
(slot +4 for a large room's second segment), not be the last boss room, and (stage 11, or HasPhotoDoor) not be the
start room seen from below (side 3); challenge 44 lifts all that.
- Level::get_red_room_neighbor_slots 0x74c9e0 (was FUN_0074c9e0): the same per-side test, giving both slots.
- Level::MakeRedRoomDoor 0x74d010: off the map: the slot's door -> -2. Else RNG (dungeonPlacementSeed + row * 0x3a1) *
(col + 1), shifts 4, 3, 0x1b; Home: GetRandomRoom(stage 0x23, type 1, difficulty 10, subtype 0xb); else the type from
Level::roll_red_room_type 0x74cea0 (was FUN_0074cea0): rand & 0x1ff over (2 devil 14) (2 angel 15, devil after a deal)
(3 secret) (3 super secret) (6 shop) (4 treasure) (2 planetarium, treasure 4 before achievement 0x196) (9 curse)
(8 sacrifice) (5 arcade) (2 vault) (2 dice) (4 library) (2 bedroom) (2 barren) (7 miniboss), past 63: normal;
GetRandomRoom 1x1 with doors 15 (library/devil/angel subtype filters, miniboss difficulty 1 or 10 past stage 6), then
stage 0, then type 1. place_room, flag 0x400, doors both ways to every neighbour with data, Room::open_red_room_doors
for the current room, Game::UpdateVisibility.
- Soul of Cain (UseCard case 0x53 @0x7b7aed): sound 0xcc; for slots 0-7: CanSpawnDoorOutline -> MakeRedRoomDoor; then
each door: TryUnlock(force) else Open + TryBlowOpen; collectible effect 0xaf (Dad's Key).
- Cracked Key (UseCard case 0x4e @0x7b7814): UseActiveItem(0x244, flags 1).
## The ultra secret room in play
- Doors: GridEntity_Door::SetRoomTypes 0x710fa0: a red room (flag 0x400) on either side turns room types 7/8 into 1
(a red room's door into a secret room is a normal door) but leaves 29; a door with 7, 8 or 29 on either side is
variant 7 (hidden), and a door whose target is 29 is TryBlowOpen'd at once. LoadSprite 0x70d3f0: 29 takes the
hole-in-wall anm2 (Door_08_HoleInWall, the dark room's in Dark Room) without the secret door sparkle, coloured as the
room's walls. TryBlowOpen 0x70fb60: first visit and variant 7 -> jingle 0x55 (Secret Room Find).
- Maps: Level::ApplyMapEffect 0x748860 (not 7, 8, 29), ApplyBlueMapEffect 0x7488d0 (7, 8 only), ApplyCompassEffect
0x748940 (not 7, 8, 1, 29), ShowMap 0x7489c0 (not 8, 29). Minimap::refresh_room_icons 0x98b5e0: IconUltraSecretRoom.
- Pool: ItemPool::GetPoolForRoom 0x732dc0 (table at ItemPool +0x69c by type - 1): 29 -> POOL_ULTRA_SECRET 24
(itempools.xml ultraSecret, 93 items).
- Backdrop: Room::LoadBackdropGraphics 0x7f1380 case 0x1d -> 0x32 (50: 0Fx_Hallway.png).
- Music: Room::PlayMusic 0x7eb1b0: type 29 -> track 0x33 (51, Secret Room Alt Alt).
- Colour: Room::Init 0x7f2800 (not a red room, or backdrop 53): floor colorize (1, 0.7, 0.7, 0.6), walls (1, 0.4, 0.4,
0.6); a red room's floor (1, 0, 0, 0.3), walls (1, 0.2, 0.2, 0.8); a super secret room (8) floor (1, 0.9, 0.8, 0.4),
walls (1, 0.9, 0.8, 0.5); the Abandoned Mineshaft's (0.9, 0.8, 1) at 0.4/0.5.
- Light: Room::GetLightingAlpha 0x81e250 and render_lighting 0x80ea80: 8 and 29 +0.33 alpha, darkness +0.6;
Room::get_color_modifier 0x823370: 7, 8, 29 faded 0.75 toward identity.
- Contents: the layouts' pedestals (5.100) draw from that pool; their shopkeepers are 17.0 and 17.1 (Level::load_room
0x73e0a0 and NpcAI::ENTITY_SHOPKEEPER 0x6c2220 test room type 29 only for the doors' Open animation, as for 7 and 8);
keys 5.30 and coins 5.20 as laid. No other type-29 case in Room::SpawnEntry 0x7ed310 / Entity_Pickup (the 0x1d hits
there are stage ids and player types).
## Ported to isaac-classic (what was bridged)
- The port's floors are its own 10x8 grower, not LevelGenerator's 13x13: try_place_room is transcribed onto that map
(room placements' new isolated spot), from a draw stream of its own; the allowed set takes every non-normal room on
the map then (the port places all special rooms before), the last boss room is the port's bossRoom. The two-step
normal rooms are drawn again with the extra door slots (the LevelGenerator door-mask bits).
- Red rooms: CanSpawnDoorOutline's last-boss and red-room-only edge rules and get_door_neighbor_room's every-neighbour
door test added to the existing red room port; Soul of Cain's every-slot loop.
- Not ported: Room::UpdateRedKey's outlines for a Cracked Key / Soul of Cain in a pocket (the port shows them for the
red_room_outline trait alone; both cards work without them); get_door_neighbor_room's stage 11 / photo door start
room exception; SetRoomTypes' red-room 7/8 -> normal doors (the port keeps blowing secret rooms beside a red room open
both ways); the super secret and mineshaft colorizes.