Six agents took over Game::Start, Level::SetNextStage, BossPool, save_game_state, level generation to the first room (place_special_rooms, RoomDescriptor, load_room), Room, Camera, Entity/EntityList/EntityRef with a curated skeleton of every Entity_* subclass, Entity_Player, Game::Render, Manager::Update's run branch, RoomTransition, ItemInfoHUD and StatHUD. Integration wrote FirstTrinketOwner and room_shape_get_door_grid_index (checked against the decompile for every shape and slot) and folded the duplicated constants. A run now generates its floor, loads the start room and draws the HUD (under gdb); Isaac renders correctly when drawn, the room itself waits for Room::Render. 2479 functions taken over. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
196 lines
7.0 KiB
C++
196 lines
7.0 KiB
C++
#include "classes.h"
|
|
|
|
// 007210d0
|
|
void GridEntity_Wall::BeginBatches()
|
|
{
|
|
void *room;
|
|
char *pathBuffer;
|
|
char *ptr;
|
|
uint32_t size;
|
|
std_string dungeonAnm2Path;
|
|
std_string bossDungeonAnm2Path;
|
|
uint32_t local_14;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
Game *game;
|
|
uint32_t pathCapacity;
|
|
void *savedExceptionList;
|
|
|
|
savedExceptionList = ExceptionList;
|
|
game = g_game;
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00afcd0d;
|
|
local_10 = ExceptionList;
|
|
local_14 = __security_cookie ^ GHIDRA_UINT(&(&bossDungeonAnm2Path)[1]._size);
|
|
ExceptionList = &local_10;
|
|
this->_collisionClass = 4;
|
|
room = game->_room;
|
|
if (GHIDRA_UINT(this->_gridIndex) < 0x1c0) {
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(room) + this->_gridIndex * 4 + 0x76c)) = 1000;
|
|
room = game->_room;
|
|
}
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(room) + 8)) != 0x10) {
|
|
ExceptionList = savedExceptionList;
|
|
return;
|
|
}
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(room) + 0x1d18)) == 0x37) {
|
|
bossDungeonAnm2Path._size = 0;
|
|
bossDungeonAnm2Path._capacity = 0xf;
|
|
bossDungeonAnm2Path._buf[0] = '\0';
|
|
bossDungeonAnm2Path._buf[1] = '\0';
|
|
bossDungeonAnm2Path._buf[2] = '\0';
|
|
bossDungeonAnm2Path._buf[3] = '\0';
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(bossDungeonAnm2Path._buf)) + 0x0))) = msvc::_Allocate(0x30);
|
|
bossDungeonAnm2Path._size = 0x26;
|
|
bossDungeonAnm2Path._capacity = 0x2f;
|
|
builtin_strncpy((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(bossDungeonAnm2Path._buf))) + 0x0))),"gfx/grid/Tiles_Itemdungeon_Gideon.anm2",
|
|
0x27);
|
|
local_8 = 0;
|
|
}
|
|
else {
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(room) + 0x1d18)) != 0x38) {
|
|
dungeonAnm2Path._size = 0;
|
|
dungeonAnm2Path._capacity = 0xf;
|
|
dungeonAnm2Path._buf[0] = '\0';
|
|
dungeonAnm2Path._buf[1] = '\0';
|
|
dungeonAnm2Path._buf[2] = '\0';
|
|
dungeonAnm2Path._buf[3] = '\0';
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(dungeonAnm2Path._buf)) + 0x0))) = msvc::_Allocate(0x20);
|
|
dungeonAnm2Path._size = 0x1f;
|
|
dungeonAnm2Path._capacity = 0x1f;
|
|
builtin_strncpy((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(dungeonAnm2Path._buf))) + 0x0))),"gfx/grid/Tiles_Itemdungeon.anm2",0x20);
|
|
local_8 = 2;
|
|
ANM2::Load(&this->_sprite,&dungeonAnm2Path,1);
|
|
if (dungeonAnm2Path._capacity < 0x10) {
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
pathBuffer = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(dungeonAnm2Path._buf))) + 0x0)));
|
|
pathCapacity = dungeonAnm2Path._capacity;
|
|
goto LAB_007211c8;
|
|
}
|
|
bossDungeonAnm2Path._size = 0;
|
|
bossDungeonAnm2Path._capacity = 0xf;
|
|
bossDungeonAnm2Path._buf[0] = '\0';
|
|
bossDungeonAnm2Path._buf[1] = '\0';
|
|
bossDungeonAnm2Path._buf[2] = '\0';
|
|
bossDungeonAnm2Path._buf[3] = '\0';
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(bossDungeonAnm2Path._buf)) + 0x0))) = msvc::_Allocate(0x20);
|
|
bossDungeonAnm2Path._size = 0x1a;
|
|
bossDungeonAnm2Path._capacity = 0x1f;
|
|
builtin_strncpy((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(bossDungeonAnm2Path._buf))) + 0x0))),"gfx/grid/Tiles_Rotgut.anm2",0x1b);
|
|
local_8 = 1;
|
|
}
|
|
ANM2::Load(&this->_sprite,&bossDungeonAnm2Path,1);
|
|
if (bossDungeonAnm2Path._capacity < 0x10) {
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
pathBuffer = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(bossDungeonAnm2Path._buf))) + 0x0)));
|
|
pathCapacity = bossDungeonAnm2Path._capacity;
|
|
LAB_007211c8:
|
|
size = pathCapacity + 1;
|
|
ptr = pathBuffer;
|
|
if (0xfff < size) {
|
|
ptr = *GHIDRA_CAST<char **>((pathBuffer + -4));
|
|
size = pathCapacity + 0x24;
|
|
if (GHIDRA_CAST<char *>(0x1f) < pathBuffer + (-4 - GHIDRA_INT(ptr))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(ptr,size);
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 00721310
|
|
void GridEntity_Wall::guard_check_icall()
|
|
{
|
|
uint8_t isAnimSet;
|
|
uint32_t row;
|
|
void *gridBelow;
|
|
uint32_t column;
|
|
int iVar1;
|
|
void *pvVar2;
|
|
char *anim;
|
|
Vector local_34;
|
|
uint8_t animNameBuf [32];
|
|
uint32_t local_c;
|
|
uint32_t gridWidth;
|
|
Room *room;
|
|
|
|
local_c = __security_cookie ^ GHIDRA_UINT(&local_34);
|
|
room = g_game->_room;
|
|
if (room->_roomType != 0x10) {
|
|
return;
|
|
}
|
|
if (room->_backdropType != 0x38) {
|
|
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8)))) == 1) {
|
|
anim = "Decoration1";
|
|
}
|
|
else if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8)))) == 2) {
|
|
anim = "Decoration2";
|
|
}
|
|
else {
|
|
local_34.x = (float)(this->_gridIndex % room->_gridWidth) * 40.0 + 40.0 + 0.0;
|
|
local_34.y = ((float)(this->_gridIndex / room->_gridWidth) * 40.0 + 120.0) - 40.0;
|
|
Room::GetGridEntityFromPos(room,&local_34);
|
|
Random();
|
|
sprintf_s(animNameBuf,0x1f,&DAT_00b69520);
|
|
anim = GHIDRA_CAST<char *>(animNameBuf);
|
|
}
|
|
ANM2::Play(&this->_sprite,GHIDRA_CAST<uint8_t *>(anim),0);
|
|
return;
|
|
}
|
|
gridWidth = room->_gridWidth;
|
|
row = GHIDRA_UINT(this->_gridIndex) / gridWidth;
|
|
column = GHIDRA_UINT(this->_gridIndex) % gridWidth;
|
|
iVar1 = row - 1;
|
|
if ((((GHIDRA_INT(column) < 0) || (GHIDRA_INT(gridWidth) <= GHIDRA_INT(column))) || (iVar1 < 0)) ||
|
|
(room->_gridHeight <= iVar1)) {
|
|
pvVar2 = (void *)0x0;
|
|
if ((-1 < GHIDRA_INT(column)) && (GHIDRA_INT(column) < GHIDRA_INT(gridWidth))) goto LAB_00721391;
|
|
}
|
|
else {
|
|
iVar1 = gridWidth * iVar1 + column;
|
|
if (iVar1 < 0) {
|
|
pvVar2 = (void *)0x0;
|
|
}
|
|
else {
|
|
pvVar2 = room->_gridEntities[iVar1];
|
|
}
|
|
LAB_00721391:
|
|
iVar1 = row + 1;
|
|
if (((-1 < iVar1) && (iVar1 < room->_gridHeight)) &&
|
|
(iVar1 = gridWidth * iVar1 + column, -1 < iVar1)) {
|
|
gridBelow = room->_gridEntities[iVar1];
|
|
goto LAB_007213a9;
|
|
}
|
|
}
|
|
gridBelow = (void *)0x0;
|
|
LAB_007213a9:
|
|
local_34.x = 1.676745e-38;
|
|
if (((pvVar2 == (void *)0x0) || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 4)) == 1)) ||
|
|
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 4)) == 0x13)) {
|
|
local_34.x = 1.6767439e-38;
|
|
}
|
|
else if (((gridBelow == (void *)0x0) || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(gridBelow) + 4)) == 1)) ||
|
|
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(gridBelow) + 4)) == 0x13)) {
|
|
local_34.x = 1.676754e-38;
|
|
}
|
|
pvVar2 = ANM2::GetAnimationData(&this->_sprite,GHIDRA_CAST<uint8_t *>(local_34.x));
|
|
if (pvVar2 != (void *)0x0) {
|
|
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x30));
|
|
isAnimSet = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST<uint8_t *>(local_34.x),1);
|
|
if (((isAnimSet != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) &&
|
|
(AnimationState::SetFrameFloat(&(this->_sprite)._animState,(float)(GHIDRA_INT(column) % iVar1)),
|
|
(this->_sprite)._animState._animData != (void *)0x0)) {
|
|
(this->_sprite)._animState._isPlaying = 0;
|
|
return;
|
|
}
|
|
}
|
|
return;
|
|
}
|