Files
isaac-port/generated-src/grid_entity_wall.cpp
T
shweetandClaude Opus 5.5 780767f5e1 Curation round 2, wave A: anm2 (Anm2Ed JSON), text, config as idiomatic classes; SDL3 platform opens a window
- anm2.h/.cpp take over ANM2, AnimationState, LayerState, AnmCache and the frame data. They read Anm2Ed's JSON documents
  with simdjson and play them as the game does (interpolation baked at load). src/anm2/ and msvc.h are retired.
- font, formatted_text, string_table and rich_text take over the text classes. FormattedText::parse is still bit-exact
  against its assembly.
- options_config and challenge_params take over OptionsConfig, ChallengeParams and the .ini helpers. The tests include
  Save's exact bytes.
- platform.h/.cpp and main.cpp run IsaacMain on SDL3: the window and GL context open, and the run stops at the first
  built-in shader (FUN_00a13fa0).
- source_tree.py: a taken-over parent stays bytes, taken-over methods are not re-emitted as a namespace, and every
  address in a (a, b, c to d) list on a comment counts as taken over.
- log.h: reconstruction_missing() for a taken-over class's methods that are not written yet.
206 functions taken over, boot path 89/615. The full build waits for wave B: item_config, entity_config and mod_manager
still use the old APIs.

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

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;
(GHIDRA_CAST<Room *>((room)))->Room::GetGridEntityFromPos(&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;
}