Files
isaac-port/notes/systems/side_view.md
T

5.8 KiB

Side view: crawl spaces and the Beast room (room type 16, Room::is_type_16 0x7ea190)

Read for isaac-classic's side view (rif/side-view, 2026-10-25). Addresses, not copies; ./decompile.sh 0xADDR.

Gravity cells (Room::Init 0x7f2800, its tail at 0x7f448b..0x7f46bf; GridEntity_Gravity 0x99b520/0x99b980)

Room::Init, for a type-16 room: every 5.100 collectible (Room entities query 5,100,-1) is moved by (10, 30) (0xbaa81c 10.0, 0xbaa8d0 30.0); then every grid cell holding no grid entity with gridPath <= 900 gets a GridEntity_Gravity (grid type 0x13 = GRID_GRAVITY, Isaac::CreateGridEntity). Rooms of any other type instead get the random floor decorations (0x7f40a0..0x7f4486, skipped for backdrops 0x12, 0x10, 0x23, a backdrop without props, and stage 1 with flag): count = (r & 3) + r % 5, + r % 9 when the RoomConfig room is wider than 13 xor taller than 7,

  • r % 9 + r % 18 when both (bytes +0x46, +0x47), seeded from the descriptor (+0x58 & 0x7fffffff) + its first field; 2 * count tries, each Room::GetRandomTileIndex (0x81ecc0), kept as GRID_DECORATION variant 0 where no grid entity stands and gridPath <= 900.

GridEntity_Gravity::Update: a player whose grid index is its own gets EntityFlag 0x8000 (FLAG_APPLY_GRAVITY); Entity_Player::Update clears it. PostInit plays Tiles_Itemdungeon "Floor%u" (seed xorshift % 3 + 1), Rotgut's (backdrop 0x38) Tiles_Rotgut "Floor" at a random frame, Gideon's (0x37) Tiles_Itemdungeon_Gideon, only when the cell below is a block (3) or a wall (0xf).

Player movement (Entity_Player::update_body_animations 0x779b40, the movement/velocity update)

With FLAG_APPLY_GRAVITY and not _canFly: the joystick's y is zeroed, the turn-toward-input lerp is skipped and, where other rooms do velocity.y *= friction (0.775 base), velocity.y += 0.225 (no friction on y). Called once per Entity_Player::Update. NPCAI_Pathfinder::SimulatePlayerMovement (0x7e8010) mirrors it in two half steps. So ladders are simply cells without a gravity entity (their decoration holds the cell): free top-down movement there.

Walls, ladders and exits

  • Room::make_wall (0x7ee7e0), type 16 and subtype not 2/3 (Rotgut's): the top wall's cell (2, 0) becomes a GRID_DECORATION variant 10 (the ladder out); on a one-screen room (shape 1) the right wall's cells (14, 3) and (14, 4) become GRID_GRAVITY. make_walls (0x81ee20) skips the Beast room entirely.
  • Room spawns of entity type 0 (0.10, 0.20, 0.30) become GRID_DECORATION of that variant (Room::SpawnEntry's default case); GridEntity_Decoration::BeginBatches (0x99acc0) in type 16 draws them "Ladder1/2/3" (Rotgut: "Ladder" frame 0/1/2).
  • GridEntity_Wall::PostInit (0x721310), type 16: Tiles_Itemdungeon "Brick%d" (rand % 3 + 1) when the cell above is empty, a decoration or gravity, else "LowBrick%d" (rand % 2 + 1); Rotgut's: "Brick" if above open, else "LowBrick" if below open, else "MiddleBrick". Blocks (1900) are ordinary GridEntity_Rock (grid_rock.anm2), collision class 4 in type 16 (GridEntity_Rock::update_collision 0x718f80).
  • Entity::PlayerCollideWithGrid (0x6ab440): in type 16 the room-bounds clamp is skipped (walls hold the player); the Beast room clamps with its +20 y offset instead.
  • Room::update_door_transitions (0x7f01c0), type 16: player y < 120 -> StartRoomTransition(Level+0x18328 the saved room, enterDoor, 2); x > BR.x + 20 -> room -15 from -14 (Rotgut), else -6 (Black Market) when the room config's door mask has bit 2, else -2; x < 0 or y > BR.y + 20 -> -2.
  • Level::GetEnterPosition (0x74a090): -4/-11 from a map room (120, 160), from the Black Market (560, 280), else (480, 280); -13 (440, 168); -14 (320, 160); -15 (80, 400); back in the dungeon return room after a type-16 room (or -13, -18), the position saved at Level+0x18320.
  • Room::Update (0x802980): a cleared type-16 room of subtype 3 transitions back to Level+0x18328 (roomClearDelay 20); subtype 2 does nothing (no TriggerClear); others clear as usual.
  • Room::LoadBackdropGraphics (0x7f1380), type 16 backdrop by subtype: 1 -> 0x37 (Gideon), 2/3 -> 0x38 (Rotgut), 4 -> 0x39 (Beast), else 0x1d (29, reserved: nothing drawn); FXLayers cleared.

Tears, projectiles, pickups, bombs

  • Entity_Tear::Init (0x6660a0) / Entity_Player::FireTear (0x790af0): posOffset.y -18, height raised to -5.1 at most. Entity_Tear::Update (0x6670f0): FallingAccel >= 0.001 -> velocity.y += it; else height > -10 -> velocity.y += 0.5; dies once height >= -5.1 and updateTime > 0.6 range (no special flags); removed outside the room.
  • Entity_Projectile::update_height_collision (0x65b500): sprite offset -15, height capped at -5.1 (never lands), collision classes 4. Entity_Projectile::Update (0x653070): FallingAccel >= 0.001 -> velocity.y += accel * timescale, else height > -10 -> += 0.5; removed when out of the room (moving outward).
  • Entity_Pickup::Update (0x6e3940): unless the point (x, y + size * sizeMulti.y + 0.5) is a wall (collision 4), velocity.y += 0.9 (Beast room: 0.4 and friction * 0.95). Anchored pickups (collectibles, priced) keep their target.
  • Entity_Bomb::Update (0x6a24d0): velocity.y += 0.9 a tick (not variants 19, 20).
  • Entity_NPC::Update (0x6c4b30): no general NPC gravity; a dying non-flier in a gravity cell gets its y velocity halved/zeroed and x set to +-speed (death drop).

We Need To Go Deeper (UseActiveItem case 0x54, 0x5b83e0)

After the dirt patch: not in type 16; the dig spot is moved 70 px (squared 4900, 20 tries) from doors; a trapdoor or crawl space there already: nothing; on a GRID_DECORATION variant < 31 with the Level state flag unset: a crawl space (GRID_STAIRS 0x12) and the flag set (once a floor); else, when Level::CanSpawnTrapDoor, a trapdoor (0x11). The grid there is destroyed first.

Pools

ItemPool::GetPoolForRoom (0x732dc0): its table at ItemPool+0x69c is indexed by room type - 1 off the pools array, so type 16 -> pool 0 (treasure): a crawl space's item is a treasure room item.