Files
isaac-port/generated-src/grid_entity_wall.cpp
T
shweetandClaude Opus 5.5 3ce74c6e2d Reconstruction layout: generated-src/ (generated) and src/ (curated), CMake, the first takeover: RNG
The decompiled C++ tree moves to generated-src/ (classes.h, C++20); src/ is for code written by hand. A curated function
defines the generated declaration and starts its comment with its address, and source_tree.py stops emitting that body.
src/rng.cpp takes over RNG (SetSeed, the constructor, Next, RandomInt, RandomFloat, Shuffle) with the shift table read
from the exe as a constexpr array; src/log.h names KAGE_LogMessage's levels (1 INFO, 2 NET, 4 WARN, 8 ERROR, 16 ASSERT,
from its prefix jump table). CMakeLists.txt builds src/*.cpp against generated-src/classes.h (clean with -Wall -Wextra).
structs.hpp and headers.py are retired: scripts/merge_fields.py writes the merged field list, classes.h checks the layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 21:10:23 -05:00

197 lines
7.0 KiB
C++

#include "classes.h"
// 007210d0
void GridEntity_Wall::BeginBatches()
{
void *room;
char *pathBuffer;
char *ptr;
uint size;
std_string dungeonAnm2Path;
std_string bossDungeonAnm2Path;
uint local_14;
void *local_10;
undefined1 *puStack_c;
uint local_8;
Game *game;
uint 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<undefined4 *>((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<undefined4 *>((GHIDRA_CAST<char *>(&(bossDungeonAnm2Path._buf)) + 0x0))) = std::_Allocate(0x30);
bossDungeonAnm2Path._size = 0x26;
bossDungeonAnm2Path._capacity = 0x2f;
builtin_strncpy((*GHIDRA_CAST<undefined4 *>((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<undefined4 *>((GHIDRA_CAST<char *>(&(dungeonAnm2Path._buf)) + 0x0))) = std::_Allocate(0x20);
dungeonAnm2Path._size = 0x1f;
dungeonAnm2Path._capacity = 0x1f;
builtin_strncpy((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(dungeonAnm2Path._buf))) + 0x0))),"gfx/grid/Tiles_Itemdungeon.anm2",0x20);
local_8 = 2;
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Load(&dungeonAnm2Path,1);
if (dungeonAnm2Path._capacity < 0x10) {
ExceptionList = local_10;
return;
}
pathBuffer = (*GHIDRA_CAST<undefined4 *>((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<undefined4 *>((GHIDRA_CAST<char *>(&(bossDungeonAnm2Path._buf)) + 0x0))) = std::_Allocate(0x20);
bossDungeonAnm2Path._size = 0x1a;
bossDungeonAnm2Path._capacity = 0x1f;
builtin_strncpy((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(bossDungeonAnm2Path._buf))) + 0x0))),"gfx/grid/Tiles_Rotgut.anm2",0x1b);
local_8 = 1;
}
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Load(&bossDungeonAnm2Path,1);
if (bossDungeonAnm2Path._capacity < 0x10) {
ExceptionList = local_10;
return;
}
pathBuffer = (*GHIDRA_CAST<undefined4 *>((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()
{
byte isAnimSet;
uint row;
void *gridBelow;
uint column;
int iVar1;
void *pvVar2;
char *anim;
Vector local_34;
byte animNameBuf [32];
uint local_c;
uint gridWidth;
Room *room;
local_c = __security_cookie ^ GHIDRA_UINT(&local_34);
room = g_game->_room;
if (room->_roomType != 0x10) {
return;
}
if (room->_backdropType != 0x38) {
iVar1 = (this->_desc)._variant;
if (iVar1 == 1) {
anim = "Decoration1";
}
else if (iVar1 == 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;
(GHIDRA_CAST<Room *>((room)))->Room::GetGridEntityFromPos(&local_34);
Random();
sprintf_s(animNameBuf,0x1f,&DAT_00b69520);
anim = GHIDRA_CAST<char *>(animNameBuf);
}
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Play(GHIDRA_CAST<byte *>(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 = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::GetAnimationData(GHIDRA_CAST<byte *>(local_34.x));
if (pvVar2 != (void *)0x0) {
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x30));
isAnimSet = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST<byte *>(local_34.x),1);
if (((isAnimSet != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) &&
((GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::SetFrameFloat((float)(GHIDRA_INT(column) % iVar1)),
(this->_sprite)._animState._animData != (void *)0x0)) {
(this->_sprite)._animState._isPlaying = 0;
return;
}
}
return;
}