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
@@ -0,0 +1,115 @@
|
||||
#include "rail_manager.h"
|
||||
#include "entity.h"
|
||||
#include "game.h"
|
||||
#include "grid_entity.h"
|
||||
#include "log.h"
|
||||
#include "room.h"
|
||||
|
||||
constexpr int BACKDROP_ASHPIT = 46;
|
||||
|
||||
// The row and the columns where an L room's walls step in around its missing quarter.
|
||||
constexpr int L_ROW = 7;
|
||||
constexpr int L_LEFT_COLUMN = 13;
|
||||
constexpr int L_RIGHT_COLUMN = 14;
|
||||
|
||||
// The rectangle of walls around a room's floor: the grid's edges, or a narrow room's corridor.
|
||||
struct RailWalls
|
||||
{
|
||||
int bottom = 0;
|
||||
int columnEnd = 0;
|
||||
int columnStart = 0;
|
||||
int left = 0;
|
||||
int right = 0;
|
||||
int rowEnd = 0;
|
||||
int rowStart = 0;
|
||||
int top = 0;
|
||||
};
|
||||
|
||||
static bool is_narrow(RoomShape shape)
|
||||
{
|
||||
return shape == ROOMSHAPE_IH || shape == ROOMSHAPE_IV || shape == ROOMSHAPE_IIV || shape == ROOMSHAPE_IIH;
|
||||
}
|
||||
|
||||
// 009e2830 Loads the rail sprite once, takes the mineshaft's or Ashpit's rails or the usual ones, clears the rails
|
||||
// and lines the room's walls with bumpers: above and below each column first, then left and right of each row, an L
|
||||
// room's walls stepping in around its missing quarter.
|
||||
// The backdrop it checks for Ashpit is still the last room's, as LoadBackdropGraphics comes later in Room::Init.
|
||||
void RailManager::init()
|
||||
{
|
||||
Room& room = *g_game->room;
|
||||
|
||||
if (!sprite.isLoaded)
|
||||
{
|
||||
sprite.Load("gfx/grid/grid_rail.anm2", GRAPHICS_DEFER);
|
||||
sprite.Play(sprite.GetDefaultAnimationName());
|
||||
}
|
||||
rails.fill(RAIL_NONE);
|
||||
|
||||
if (g_game->HasAbandonedMineshaft() && g_game->currentDimensionIdx == 1)
|
||||
sprite.ReplaceSpritesheet(0, "gfx/grid/grid_rails_mineshaft.png");
|
||||
else if (room.backdropType == BACKDROP_ASHPIT)
|
||||
sprite.ReplaceSpritesheet(0, "gfx/grid/grid_rails_ashpit.png");
|
||||
else sprite.ReplaceSpritesheet(0, "gfx/grid/grid_rails.png");
|
||||
sprite.LoadGraphics();
|
||||
|
||||
int width = room.gridWidth;
|
||||
int height = room.gridHeight;
|
||||
RoomShape shape = room.descriptor && room.descriptor->data ? room.descriptor->data->shape : ROOMSHAPE_NULL;
|
||||
RailWalls walls = {height - 1, width, 0, 0, width - 1, height - 1, 0, 0};
|
||||
|
||||
if (is_narrow(shape))
|
||||
{
|
||||
LRoomTileDesc tiles = room.GetLRoomTileDesc();
|
||||
walls = {tiles.bottomRightAY + 1, tiles.bottomRightAX + 1, tiles.topLeftAX - 1, tiles.topLeftAX - 1,
|
||||
tiles.bottomRightAX + 1, tiles.bottomRightAY + 1, tiles.topLeftAY - 1, tiles.topLeftAY - 1};
|
||||
}
|
||||
for (int x = walls.columnStart; x < walls.columnEnd; x++)
|
||||
{
|
||||
int top = walls.top;
|
||||
int bottom = walls.bottom;
|
||||
|
||||
if ((shape == ROOMSHAPE_LTL && x <= L_LEFT_COLUMN) || (shape == ROOMSHAPE_LTR && x > L_RIGHT_COLUMN)) top = L_ROW;
|
||||
if ((shape == ROOMSHAPE_LBL && x < L_LEFT_COLUMN) || (shape == ROOMSHAPE_LBR && x > L_RIGHT_COLUMN))
|
||||
bottom = L_ROW + 1;
|
||||
rails[top * width + x] = RAIL_WALL_TOP;
|
||||
rails[bottom * width + x] = RAIL_WALL_BOTTOM;
|
||||
}
|
||||
for (int y = walls.rowStart; y < walls.rowEnd; y++)
|
||||
{
|
||||
int left = walls.left;
|
||||
int right = walls.right;
|
||||
|
||||
if ((shape == ROOMSHAPE_LTL && y <= L_ROW) || (shape == ROOMSHAPE_LBL && y > L_ROW)) left = L_LEFT_COLUMN;
|
||||
if ((shape == ROOMSHAPE_LTR && y <= L_ROW) || (shape == ROOMSHAPE_LBR && y > L_ROW)) right = L_RIGHT_COLUMN;
|
||||
rails[y * width + left] = RAIL_WALL_LEFT;
|
||||
rails[y * width + right] = RAIL_WALL_RIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
// 009e2f20 Draws each cell's rail by its piece's frame, but under pits, offset on screen.
|
||||
void RailManager::Render(Vector offset)
|
||||
{
|
||||
Room& room = *g_game->room;
|
||||
sprite.SetFrame("rail", 0);
|
||||
|
||||
for (int i = 0; i < room.gridHeight * room.gridWidth; i++)
|
||||
{
|
||||
uint8_t rail = rails[i];
|
||||
GridEntity* entity = room.gridEntities[i];
|
||||
if (rail & RAIL_HIDDEN || (entity && entity->type == GRID_PIT)) continue;
|
||||
|
||||
if (sprite.animState.animData)
|
||||
{
|
||||
uint8_t piece = rail & (rail & RAIL_MINESHAFT ? RAIL_MINESHAFT_PIECE_MASK : RAIL_PIECE_MASK);
|
||||
sprite.animState.SetFrameFloat((float)piece);
|
||||
}
|
||||
Vector screen = render_position_get(room.GetGridPosition(i), RENDER_SNAPPED);
|
||||
sprite.Render({.position = vector_make(screen.x + offset.x, screen.y + offset.y)});
|
||||
}
|
||||
}
|
||||
|
||||
// 009e38a0 The point of a cell's rail nearest a minecart, for its rail following.
|
||||
void RailManager::get_closest_rail_point()
|
||||
{
|
||||
reconstruction_missing("RailManager::get_closest_rail_point 009e38a0");
|
||||
}
|
||||
Reference in new issue
Block a user