Curation round 8: the first room plays: Isaac walks and shoots tears
Eight agents took over Room::Init's pieces, RailManager, Room::Render/render_lighting/Update, the GridEntity hierarchy (walls, doors, rocks, pits, poop ...), Game::Update and interpolate_update, the run's save, update_ingame_input, Game::Spawn with the entity factory and grid collision, the player's movement and tears through Weapon/Weapon_Tears, PlayerManager's positions, the camera focus, MinimapConfig, PlayerHUD, mod shader rendering, Entity_Tear and Entity_Effect. Integration wrote Level::get_secret_exit_kind, shared the secret-exit enum (four copies merged) and fixed the generator's vtable-stub check (word boundary and namespace, not a substring). Under gdb a run reaches the first room: doors, HUD with hearts and minimap, WASD movement with acceleration, arrow-key tears that fly and splash. Floor and walls (Backdrop::RenderFloor/RenderWalls) and room transitions are next. The official build/isaac reaches the start room and stops at Entity_NPC::Redirect. 2770 functions taken over. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b85591bdf4
commit
69a354f843
140 files changed
+23561
-20206
No files matched your search
+105
-36
@@ -2,6 +2,7 @@
|
||||
#include "boss_pool.h"
|
||||
#include "entity_player.h"
|
||||
#include "game.h"
|
||||
#include "grid_entity_door.h"
|
||||
#include "hud.h"
|
||||
#include "manager.h"
|
||||
#include "platform.h"
|
||||
@@ -9,10 +10,27 @@
|
||||
#include "room_transition.h"
|
||||
#include "texture_cache.h"
|
||||
#include <algorithm>
|
||||
#include <bit>
|
||||
#include <bitset>
|
||||
#include <cmath>
|
||||
#include <iterator>
|
||||
|
||||
// Where GetEnterPosition puts the players: a crawlspace's ladder down and its ladder back up, the Black Market's
|
||||
// stairs, and the spots of the secret shop and the two off-map rooms between it and the Black Market.
|
||||
constexpr float DUNGEON_ENTRY_X = 120;
|
||||
constexpr float DUNGEON_ENTRY_Y = 160;
|
||||
constexpr float DUNGEON_EXIT_X = 480;
|
||||
constexpr float DUNGEON_EXIT_Y = 280;
|
||||
constexpr float BLACK_MARKET_EXIT_X = 560;
|
||||
constexpr float SECRET_SHOP_ENTRY_X = 440;
|
||||
constexpr float SECRET_SHOP_ENTRY_Y = 168;
|
||||
constexpr int ROOM_OFF_MAP_14_IDX = -14;
|
||||
constexpr float OFF_MAP_14_ENTRY_X = 320;
|
||||
constexpr float OFF_MAP_14_ENTRY_Y = 160;
|
||||
constexpr int ROOM_OFF_MAP_15_IDX = -15;
|
||||
constexpr float OFF_MAP_15_ENTRY_X = 80;
|
||||
constexpr float OFF_MAP_15_ENTRY_Y = 400;
|
||||
|
||||
constexpr uint32_t LEVEL_STAGE_BASEMENT_I = 1;
|
||||
constexpr uint32_t LEVEL_STAGE_CAVES_I = 3;
|
||||
constexpr uint32_t LEVEL_STAGE_CAVES_II = 4;
|
||||
@@ -45,6 +63,7 @@ constexpr int STAGE_ID_VOID = 26;
|
||||
|
||||
constexpr uint32_t CHALLENGE_XXXXXXXXL = 21;
|
||||
constexpr uint32_t SPECIAL_DAILY_NO_CURSES = 18;
|
||||
constexpr uint32_t SPECIAL_DAILY_DEALS = 17;
|
||||
constexpr uint32_t SPECIAL_DAILY_CURSED = 37;
|
||||
constexpr uint32_t SPECIAL_DAILY_CURSES = CURSE_OF_THE_LOST | CURSE_OF_THE_UNKNOWN | CURSE_OF_BLIND;
|
||||
|
||||
@@ -92,8 +111,6 @@ constexpr int TRINKET_MYOSOTIS = 137;
|
||||
constexpr int TRINKET_DEVILS_CROWN = 146;
|
||||
constexpr int TREASURE_SUBTYPE_KNIFE_PIECE = 34;
|
||||
constexpr int LIL_PORTAL_ROOM_VARIANT = 2;
|
||||
constexpr int GRID_STAIRS = 18;
|
||||
constexpr int GRID_TRAPDOOR = 17;
|
||||
constexpr int GRID_SPAWN_PIT_FIRST = 3000;
|
||||
constexpr int GRID_SPAWN_PIT_END = 3010;
|
||||
constexpr int ROOM_INDEX_OTHER_DIMENSION = -100;
|
||||
@@ -217,8 +234,6 @@ constexpr int GREED_SUBTYPE = 4;
|
||||
constexpr int GREED_SUBTYPE_SUPER = 11;
|
||||
constexpr int GREED_SUBTYPE_DEVIL = 15;
|
||||
constexpr int RED_ROOM_DOOR_TARGET = -2;
|
||||
constexpr int GRID_DOOR = 16;
|
||||
constexpr int DOOR_VARIANT_HIDDEN = 7;
|
||||
constexpr int HUD_REFRESH_FRAMES = 2;
|
||||
constexpr int BACKDROP_CORPSE3 = 44;
|
||||
constexpr int EFFECT_VARIANT_BLOOD_SPLAT = 7;
|
||||
@@ -2133,12 +2148,6 @@ float Level::GetPlanetariumChance()
|
||||
return std::clamp(chance, PLANETARIUM_CHANCE_MIN, 1.0f);
|
||||
}
|
||||
|
||||
// A grid entity's description (type, variant, state), which classes.h still holds as bytes.
|
||||
static GridEntityDesc& grid_desc_get(GridEntity& entity)
|
||||
{
|
||||
return *reinterpret_cast<GridEntityDesc*>(entity._desc);
|
||||
}
|
||||
|
||||
// Devil's Crown's turn of an unvisited treasure room into a devil treasure room: 1 in 4 golden, 1 in 3 stronger, from
|
||||
// up to ten draws of a devil room with the treasure room's doors.
|
||||
static void devils_crown_room_roll(Level& level, RoomDescriptor& desc)
|
||||
@@ -2298,9 +2307,9 @@ static void doors_target(Level& level, RoomDescriptor& desc)
|
||||
|
||||
GridEntity_Door& door = *doors[level.enterDoor];
|
||||
|
||||
door._slot = level.enterDoor;
|
||||
door.slot = level.enterDoor;
|
||||
door.SetRoomTypes(type, ROOM_DEFAULT);
|
||||
door._targetRoomIdx = level.lastRoomIdx;
|
||||
door.targetRoomIdx = level.lastRoomIdx;
|
||||
return;
|
||||
}
|
||||
for (int slot = 0; slot < DOOR_SLOT_COUNT; slot++)
|
||||
@@ -2310,8 +2319,8 @@ static void doors_target(Level& level, RoomDescriptor& desc)
|
||||
bool isRedDoor = target == RED_ROOM_DOOR_TARGET;
|
||||
|
||||
if (!door || (!isRedDoor && (target < 0 || level.currentRoomMap[target] < 0))) continue;
|
||||
door->_slot = slot;
|
||||
door->_targetRoomIdx = target;
|
||||
door->slot = slot;
|
||||
door->targetRoomIdx = target;
|
||||
door->SetRoomTypes(type, isRedDoor ? ROOM_DEFAULT : level.GetRoomByIdx(target)->data->type);
|
||||
}
|
||||
}
|
||||
@@ -2326,18 +2335,18 @@ static void corpse_door_splats_spawn(Level& level)
|
||||
|
||||
for (GridEntity_Door* door : room.doors)
|
||||
{
|
||||
if (!door || std::ranges::find(CORPSE_SPLAT_ROOM_TYPES, door->_targetRoomType) == CORPSE_SPLAT_ROOM_TYPES.end())
|
||||
if (!door || std::ranges::find(CORPSE_SPLAT_ROOM_TYPES, door->targetRoomType) == CORPSE_SPLAT_ROOM_TYPES.end())
|
||||
continue;
|
||||
|
||||
RoomDescriptor& target = *level.GetRoomByIdx(door->_targetRoomIdx);
|
||||
RoomDescriptor& target = *level.GetRoomByIdx(door->targetRoomIdx);
|
||||
|
||||
if (!(target.flags & ROOM_DESCRIPTOR_FLAG_USE_ALTERNATE_BACKDROP)) continue;
|
||||
|
||||
RNG rng = {target.decorationSeed, 2, 15, 17};
|
||||
Vector direction{};
|
||||
int gridIndex = (int)door->_gridIndex;
|
||||
int gridIndex = (int)door->gridIndex;
|
||||
|
||||
Isaac::GetAxisAlignedUnitVectorFromDir(&direction, door->_direction);
|
||||
Isaac::GetAxisAlignedUnitVectorFromDir(&direction, door->direction);
|
||||
|
||||
Vector out = {-direction.x, -direction.y};
|
||||
Vector across = {out.x * rotationCos - out.y * rotationSin, out.x * rotationSin + out.y * rotationCos};
|
||||
@@ -2400,22 +2409,28 @@ void Level::load_room()
|
||||
reconstruction_missing("Level::load_room 0073e0a0: the mineshaft entrance's bridged pits (Room+0x746d)");
|
||||
doors_target(*this, desc);
|
||||
if (GetRoomByIdx(currentRoomIdx)->flags & ROOM_DESCRIPTOR_FLAG_CLEAR)
|
||||
reconstruction_missing("Level::load_room 0073e0a0: a cleared room's special doors (Room::TrySpawnSecretExit "
|
||||
"007f7a40, TrySpawnDevilRoomDoor 007f83b0, TrySpawnBossRushDoor 007f9960, "
|
||||
"TrySpawnTheVoidDoor 008204b0, TrySpawnBlueWombDoor 00820170)");
|
||||
{
|
||||
if (!isGreed)
|
||||
{
|
||||
room->TrySpawnSecretExit(false, false);
|
||||
room->TrySpawnDevilRoomDoor(false, false);
|
||||
room->TrySpawnBossRushDoor(false, false);
|
||||
room->TrySpawnTheVoidDoor(false);
|
||||
}
|
||||
room->TrySpawnBlueWombDoor(false, false, false);
|
||||
}
|
||||
for (int slot = 0; slot < DOOR_SLOT_COUNT; slot++)
|
||||
{
|
||||
RoomShape shape = room->descriptor && room->descriptor->data ? room->descriptor->data->shape : ROOMSHAPE_1x1;
|
||||
int gridIndex = room_shape_get_door_grid_index(slot, room->gridWidth, room->gridHeight, shape);
|
||||
GridEntity* entity = gridIndex >= 0 && gridIndex < ROOM_GRID_CELLS ? room->gridEntities[gridIndex] : nullptr;
|
||||
|
||||
if (room->doors[slot] || !entity || grid_desc_get(*entity)._type != GRID_DOOR) continue;
|
||||
if (static_cast<GridEntity_Door*>(entity)->_direction != DOOR_NONE) continue;
|
||||
if (room->doors[slot] || !entity || entity->type != GRID_DOOR) continue;
|
||||
if (static_cast<GridEntity_Door*>(entity)->direction != DIRECTION_NONE) continue;
|
||||
room->doors[slot] = static_cast<GridEntity_Door*>(entity);
|
||||
room->RemoveDoor(slot);
|
||||
}
|
||||
reconstruction_missing(
|
||||
"Level::load_room 0073e0a0: the Member Card's shop door (Room::TrySpawnSecretShop 007f8190)");
|
||||
room->TrySpawnSecretShop(false);
|
||||
|
||||
int roomStageType = game.challenge == CHALLENGE_RED_REDEMPTION ? GetRoomStageType(currentRoomIdx) : (int)stageType;
|
||||
bool isCorpse = RoomConfig::GetStageID((int)stage, roomStageType, ROOM_MODE_CURRENT) == STAGE_ID_CORPSE;
|
||||
@@ -2428,7 +2443,7 @@ void Level::load_room()
|
||||
"Game::reset_players_for_greed)");
|
||||
if (!game.deathmatchManager.is_active()) game.playerManager.enter_level();
|
||||
room->fxLayers.Update(PLAYER_FOLLOW_SNAP);
|
||||
reconstruction_missing("Level::load_room 0073e0a0: the Red Key's door outlines (Room::UpdateRedKey 008271e0)");
|
||||
room->UpdateRedKey();
|
||||
|
||||
bool isHomePathBoss =
|
||||
game.GetChallengeParams().pathType == PATH_TYPE_HOME &&
|
||||
@@ -2467,8 +2482,8 @@ void Level::UpdateVisibility()
|
||||
if (currentRoomIdx >= 0 && HasMirrorDimension())
|
||||
GetRoomByIdx(currentRoomIdx, 1 - currentDimensionIdx)->displayFlags |= ROOM_DISPLAY_BOX | ROOM_DISPLAY_ICON;
|
||||
for (int slot = 0; slot < DOOR_SLOT_COUNT; slot++)
|
||||
if (GridEntity_Door* door = room->doors[slot]; door && door->_targetRoomIdx >= 0)
|
||||
reveal_room_visibility(*GetRoomByIdx(door->_targetRoomIdx), ¤t, slot);
|
||||
if (GridEntity_Door* door = room->doors[slot]; door && door->targetRoomIdx >= 0)
|
||||
reveal_room_visibility(*GetRoomByIdx(door->targetRoomIdx), ¤t, slot);
|
||||
for (MinimapConfig& config : g_game->minimap.configs) config.refresh();
|
||||
if (hud.hudRefreshType == HUD_REFRESH_FULL) return;
|
||||
hud.hudRefreshType = HUD_REFRESH_PLAYER;
|
||||
@@ -2507,10 +2522,10 @@ void Level::reveal_room_visibility(RoomDescriptor& target, RoomDescriptor* fromR
|
||||
{
|
||||
GridEntity_Door& door = *room->doors[doorSlot];
|
||||
|
||||
if (is_xray() && grid_desc_get(door)._variant == DOOR_VARIANT_HIDDEN)
|
||||
if (is_xray() && door.variant == DOOR_HIDDEN)
|
||||
reconstruction_missing("Level::reveal_room_visibility 0073f620: X-Ray Vision's hidden door opening "
|
||||
"(Game::SpawnEx 006fe410)");
|
||||
isShown = door._isBusted;
|
||||
isShown = door.isBusted;
|
||||
}
|
||||
if (!isShown) isShown = is_xray() || is_spelunker();
|
||||
if (isShown)
|
||||
@@ -2689,10 +2704,27 @@ std::set<int> Level::get_rooms_within_two_doors(int)
|
||||
reconstruction_missing("Level::get_rooms_within_two_doors 007496a0");
|
||||
}
|
||||
|
||||
// 0074a090 Where the players enter the current room.
|
||||
// 0074a090 Where the players enter the current room when no door brings them: a crawlspace's ladder (by the
|
||||
// Black Market's or a room's), the secret shop's and the off-map rooms' spots, or back where a crawlspace was entered.
|
||||
// Elsewhere none, the origin.
|
||||
Vector Level::GetEnterPosition()
|
||||
{
|
||||
reconstruction_missing("Level::GetEnterPosition 0074a090");
|
||||
if (currentRoomIdx == ROOM_DUNGEON_IDX || currentRoomIdx == ROOM_GIDEON_DUNGEON_IDX)
|
||||
{
|
||||
if (lastRoomIdx >= 0) return vector_make(DUNGEON_ENTRY_X, DUNGEON_ENTRY_Y);
|
||||
return vector_make(lastRoomIdx == ROOM_BLACK_MARKET_IDX ? BLACK_MARKET_EXIT_X : DUNGEON_EXIT_X, DUNGEON_EXIT_Y);
|
||||
}
|
||||
if (currentRoomIdx == ROOM_SECRET_SHOP_IDX) return vector_make(SECRET_SHOP_ENTRY_X, SECRET_SHOP_ENTRY_Y);
|
||||
if (currentRoomIdx == ROOM_OFF_MAP_14_IDX) return vector_make(OFF_MAP_14_ENTRY_X, OFF_MAP_14_ENTRY_Y);
|
||||
if (currentRoomIdx == ROOM_OFF_MAP_15_IDX) return vector_make(OFF_MAP_15_ENTRY_X, OFF_MAP_15_ENTRY_Y);
|
||||
if (currentRoomIdx >= 0 && currentRoomIdx == dungeonReturnRoomIndex)
|
||||
{
|
||||
RoomDescriptor* last = GetRoomByIdx(lastRoomIdx);
|
||||
bool isFromDungeon = last->data && last->data->type == ROOM_DUNGEON;
|
||||
if (isFromDungeon || lastRoomIdx == ROOM_SECRET_SHOP_IDX || lastRoomIdx == ROOM_ANGEL_SHOP_IDX)
|
||||
return dungeonReturnPosition;
|
||||
}
|
||||
return g_vectorZero;
|
||||
}
|
||||
|
||||
// 0073d9b0 A door slot as another shape sees it.
|
||||
@@ -2797,10 +2829,29 @@ bool Level::ForceHorsemanBoss(uint32_t)
|
||||
reconstruction_missing("Level::ForceHorsemanBoss 007481d0");
|
||||
}
|
||||
|
||||
// 00749830 Whether a deal room may spawn.
|
||||
// 00749830 Whether the floor's last boss room may open a deal door: not in Red Redemption, Mausoleum II, before the
|
||||
// Ascent or on the way back up; past Basement I (but for the surprise miniboss daily) and up to the Womb, Depths II
|
||||
// once the Womb is unlocked (any floor in Greed); and only when the boss room has two door slots or more.
|
||||
bool Level::CanSpawnDevilRoom()
|
||||
{
|
||||
reconstruction_missing("Level::CanSpawnDevilRoom 00749830");
|
||||
Game& game = *g_game;
|
||||
if (game.challenge == CHALLENGE_RED_REDEMPTION) return false;
|
||||
|
||||
int labyrinthStage = (int)stage_with_labyrinth(*this);
|
||||
bool isAltStage = stageType == STAGETYPE_REPENTANCE || stageType == STAGETYPE_REPENTANCE_B;
|
||||
bool isMausoleumTwo = !is_greed() && isAltStage && labyrinthStage == (int)LEVEL_STAGE_WOMB_II;
|
||||
bool isBackwards = stage - 1 < ASCENT_LAST_STAGE && game_flag_get(LEVEL_GAME_STATE_BACKWARDS_PATH);
|
||||
if (isMausoleumTwo || IsPreAscent() || isBackwards) return false;
|
||||
|
||||
int dealStage = labyrinthStage + (isAltStage ? 1 : 0);
|
||||
if (!is_greed())
|
||||
{
|
||||
if (dealStage == (int)LEVEL_STAGE_BASEMENT_I && game.dailyChallenge._specialDailyId != SPECIAL_DAILY_DEALS)
|
||||
return false;
|
||||
if (dealStage != (int)LEVEL_STAGE_BASEMENT_I && dealStage > (int)LEVEL_STAGE_WOMB_II) return false;
|
||||
if (dealStage == (int)LEVEL_STAGE_DEPTHS_II && !is_unlocked(ACHIEVEMENT_THE_WOMB)) return false;
|
||||
}
|
||||
return std::popcount(roomList[lastBossRoomListIdx].data->doors & 0xff) > 1;
|
||||
}
|
||||
|
||||
// 007499a0 Picks the deal room.
|
||||
@@ -2845,10 +2896,28 @@ int Level::GetAbsoluteStage()
|
||||
reconstruction_missing("Level::GetAbsoluteStage 0074b960");
|
||||
}
|
||||
|
||||
// 0074bae0 The kind of secret exit the floor has.
|
||||
// 0074bae0 The secret exit the floor's depth calls for, an XL floor counting as its second stage and the alternate path
|
||||
// as one deeper. None in Greed, nor on the alternate path's first floors.
|
||||
int Level::get_secret_exit_kind()
|
||||
{
|
||||
reconstruction_missing("Level::get_secret_exit_kind 0074bae0");
|
||||
bool isLabyrinth = curses & CURSE_OF_LABYRINTH;
|
||||
if (is_greed() || ((stage & 1) && IsAltPath() && !isLabyrinth)) return SECRET_EXIT_NONE;
|
||||
|
||||
switch (stage + isLabyrinth + IsAltPath())
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
return SECRET_EXIT_DOWNPOUR;
|
||||
case 3:
|
||||
case 4:
|
||||
return SECRET_EXIT_MINES;
|
||||
case 5:
|
||||
return SECRET_EXIT_MAUSOLEUM;
|
||||
case 7:
|
||||
return IsAltPath() ? SECRET_EXIT_MOMS_HEART : SECRET_EXIT_NONE;
|
||||
default:
|
||||
return SECRET_EXIT_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
// 0074bba0 The secret exit's room.
|
||||
|
||||
Reference in new issue
Block a user