Files
isaac-port/generated-src/grid_entity_tnt.cpp
T
shweetandClaude Opus 5.5 28e2e48842 Curation round 2, wave B: ItemConfig, EntityConfig, mods, Manager and the KAGE platform on SDL3; boots to LuaEngine::Init
- item_config, entity_config and mod_manager take over their families as idiomatic classes (std containers,
  unique_ptr, bitset tear flags). Every big loader reads the imported JSON: entities2.xml gives 1349 entities.
- manager.h/.cpp take over Manager (g_manager) and IsaacStartup. Members are the curated subsystems by value.
- kage_graphics, kage_input and kage_sound take over KAGE's graphics (shaders, render targets, batches, PNG through
  stb_image), input (SDL3 keyboard, mouse, gamepads) and sound (SDL3 audio, wav and stb_vorbis ogg, pitch and volume).
- source_tree.py: classes inside a namespace block in src/ headers count as taken over, and a still-generated class's
  vtable slot keeps its stub unless src/ defines that exact method.
build/isaac opens the window, sets up GL 4.6, framebuffers and PulseAudio, logs the version, and stops at
LuaEngine::Init. 522 functions taken over, boot path 156/615.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 00:03:39 -05:00

177 lines
6.5 KiB
C++

#include "classes.h"
// 0071ee90
void GridEntity_TNT::BeginBatches()
{
uint8_t bVar1;
EntityConfig_Entity *entity;
uint8_t *currentAnimChar;
char *ptr;
uint8_t *idleAnimChar;
uint32_t uVar2;
EntityConfig *entityConfig;
bool isLess;
uint8_t lowerBoundResult [8];
void *lowerBoundNode;
GridEntity_TNT *self;
uint32_t entityKey;
std_string anm2Path;
uint32_t local_14;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
uint8_t *animData;
local_8 = 0xffffffff;
puStack_c = &LAB_00af32ed;
local_10 = ExceptionList;
local_14 = __security_cookie ^ GHIDRA_UINT(&(&anm2Path)[1]._size);
ExceptionList = &local_10;
if (GHIDRA_UINT(this->_gridIndex) < 0x1c0) {
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(g_game->_room) + this->_gridIndex * 4 + 0x76c)) = 1000;
}
anm2Path._size = 0;
anm2Path._capacity = 0xf;
anm2Path._buf[0] = '\0';
anm2Path._buf[1] = '\0';
anm2Path._buf[2] = '\0';
anm2Path._buf[3] = '\0';
self = this;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) = msvc::_Allocate(0x20);
anm2Path._size = 0x16;
anm2Path._capacity = 0x1f;
builtin_strncpy((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(anm2Path._buf))) + 0x0))),"gfx/grid/grid_tnt.anm2",0x17);
local_8 = 0;
ANM2::Load(&this->_sprite,&anm2Path,1);
local_8 = 0xffffffff;
if (0xf < anm2Path._capacity) {
uVar2 = anm2Path._capacity + 1;
ptr = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(anm2Path._buf))) + 0x0)));
if (0xfff < uVar2) {
ptr = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) + -4));
uVar2 = anm2Path._capacity + 0x24;
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) + (-4 - GHIDRA_INT(ptr))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(ptr,uVar2);
}
anm2Path._size = 0;
entityConfig = &g_manager->_entityConfig;
anm2Path._capacity = 0xf;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) & 0xffffff00;
entityKey = 0x3e801b00;
_Find_lower_bound<>(lowerBoundResult,&entityKey);
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(lowerBoundNode) + 0xd)) == '\0') &&
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(lowerBoundNode) + 0x10)) < 0x3e801b01)) &&
(lowerBoundNode != (entityConfig->_entities)._head)) {
entity = GHIDRA_CAST<EntityConfig_Entity *>((GHIDRA_INT(lowerBoundNode) + 0x18));
}
else {
entity = EntityConfig::GetEntity(entityConfig,1000,0,0);
}
if (entity != GHIDRA_CAST<EntityConfig_Entity *>(0x0)) {
EntityConfig::PreloadResources(entityConfig,entity);
}
animData = (this->_sprite)._animState._animData;
if (animData != GHIDRA_CAST<uint8_t *>(0x0)) {
currentAnimChar = animData;
if (0xf < *GHIDRA_CAST<uint32_t *>((animData + 0x14))) {
currentAnimChar = *GHIDRA_CAST<uint8_t **>(animData);
}
idleAnimChar = s_Idle;
do {
bVar1 = *currentAnimChar;
isLess = bVar1 < *idleAnimChar;
if (bVar1 != *idleAnimChar) {
LAB_0071f028:
uVar2 = -GHIDRA_UINT(isLess) | 1;
goto LAB_0071f02d;
}
if (bVar1 == 0) break;
bVar1 = currentAnimChar[1];
isLess = bVar1 < idleAnimChar[1];
if (bVar1 != idleAnimChar[1]) goto LAB_0071f028;
currentAnimChar = currentAnimChar + 2;
idleAnimChar = idleAnimChar + 2;
} while (bVar1 != 0);
uVar2 = 0;
LAB_0071f02d:
if ((uVar2 == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0))))
goto LAB_0071f059;
}
bVar1 = ANM2::SetAnimation(&this->_sprite,s_Idle,1);
if (bVar1 != 0) {
AnimationState::Rewind(&(this->_sprite)._animState);
(this->_sprite)._animState._isPlaying = 1;
}
LAB_0071f059:
self->_frameCnt = GHIDRA_UINT((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((self)) + 0xc)))) < 4)) * 4 + -1;
ExceptionList = local_10;
return;
}
// 0071f090
void GridEntity_TNT::Update()
{
uint8_t isBlownPlaying;
int collisionClass;
uint32_t seed;
Vector *gridPos;
uint32_t extraout_ECX;
Vector posBuf;
collisionClass = 2;
if (3 < *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc))))) {
collisionClass = 0;
}
this->_collisionClass = collisionClass;
switch(*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc))))) {
case 0:
case 1:
ANM2::Play(&this->_sprite,s_Idle,0);
return;
case 2:
ANM2::Play(&this->_sprite,GHIDRA_CAST<uint8_t *>("IdleMedium"),0);
return;
case 3:
goto LAB_0071f222;
case 4:
isBlownPlaying = ANM2::IsPlaying(&this->_sprite,GHIDRA_CAST<uint8_t *>("Blown"));
if (isBlownPlaying == 0) {
this->_frameCnt = this->_frameCnt + -1;
if (this->_frameCnt < 1) {
ANM2::Play(&this->_sprite,GHIDRA_CAST<uint8_t *>("Blown"),0);
if (this->_frameCnt != 0) {
return;
}
seed = Random();
gridPos = (GHIDRA_CAST<GridEntity *>((GHIDRA_CAST<GridEntity *>(this))))->GridEntity::Position(&posBuf);
(GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,1,gridPos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,seed,0);
gridPos = (GHIDRA_CAST<GridEntity *>((GHIDRA_CAST<GridEntity *>(this))))->GridEntity::Position(&posBuf);
(GHIDRA_CAST<Game *>((g_game)))->Game::spawn_bomb_crater(gridPos,GHIDRA_CAST<Entity *>(0x0),1.0);
gridPos = (GHIDRA_CAST<GridEntity *>((GHIDRA_CAST<GridEntity *>(this))))->GridEntity::Position(&posBuf);
(GHIDRA_CAST<Game *>((g_game)))->Game::BombDamage(gridPos,100.0,75.0,0,GHIDRA_CAST<Entity *>(0x0),g_tearFlagsNone,0x1004,0);
(GHIDRA_CAST<GridEntity *>((GHIDRA_CAST<GridEntity *>(this))))->GridEntity::Position(&posBuf);
spawn_rock_particles();
(GHIDRA_CAST<GridEntity *>((GHIDRA_CAST<GridEntity *>(this))))->GridEntity::Position(&posBuf);
FUN_0071f4b0(*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x14)))),extraout_ECX);
if (GHIDRA_UINT(this->_gridIndex) < 0x1c0) {
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(g_game->_room) + this->_gridIndex * 4 + 0x76c)) = 900;
return;
}
return;
}
}
else if (this->_frameCnt < 1) {
return;
}
LAB_0071f222:
ANM2::Play(&this->_sprite,GHIDRA_CAST<uint8_t *>("ReadyToExplode"),0);
return;
default:
return;
}
}