Files
isaac-port/generated-src/grid_entity_decoration.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

547 lines
23 KiB
C++

#include "classes.h"
// 0099a8e0
void GridEntity_Decoration::Update()
{
byte isSecondFoot;
uint uVar1;
Entity_Player *player;
Vector *renderPos;
std_string *psVar2;
std_string *animNameData;
double dVar3;
Vector renderPosBuf;
float texelR;
float texelG;
float texelB;
float texelA;
float local_60;
float sampleY;
float decoRenderX;
float decoRenderY;
Sprite *sprite;
float sampleX;
GridEntity_Decoration *decoration;
float pixelScale;
float scaledCoord;
std_string *animName [4];
uint animNameSize;
uint animNameCapacity;
uint securityCookie;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
std_string *local_14;
puStack_20 = GHIDRA_CAST<undefined1 *>((animName + 0xe));
local_14 = GHIDRA_CAST<std_string *>(0xffffffff);
puStack_18 = &LAB_00af462d;
local_1c = ExceptionList;
securityCookie = __security_cookie ^ GHIDRA_UINT((animName + 0xb));
ExceptionList = &local_1c;
if (((this->_desc)._variant != 1000) && ((this->_sprite)._loaded != 0)) {
decoration = this;
(GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::Update();
(GHIDRA_CAST<AnimationState *>((&(this->_sprite)._overlayAnimState)))->AnimationState::Update();
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>(&(this->_sprite)._animState))))->ANM2::GetAnimation(GHIDRA_CAST<std_string *>(animName));
animNameData = animName[0];
local_14 = GHIDRA_CAST<std_string *>(0x0);
psVar2 = GHIDRA_CAST<std_string *>(animName);
if (0xf < animNameCapacity) {
psVar2 = animName[0];
}
uVar1 = std::string::find(GHIDRA_CAST<byte *>(psVar2),animNameSize,0,GHIDRA_CAST<byte *>("Puddle"),6);
if (uVar1 != 0xffffffff) {
sprite = GHIDRA_CAST<Sprite *>(&this->_sprite);
if ((this->_sprite)._animState._animData != (void *)0x0) {
(this->_sprite)._animState._isPlaying = 0;
}
uVar1 = 0;
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) -
GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) {
do {
player = (GHIDRA_CAST<Game *>((g_game)))->Game::GetPlayer(uVar1);
if (player->_entityGridCollisionClass == 5) {
renderPos = (GHIDRA_CAST<GridEntity *>((GHIDRA_CAST<GridEntity *>(decoration))))->GridEntity::get_render_position(&renderPosBuf);
decoRenderX = renderPos->x;
pixelScale = g_displayPixelRatio * g_screenPointScale;
decoRenderY = renderPos->y;
scaledCoord = ((g_screenWidth - 338.0) * 0.5 + ((player->_pos).x - 60.0) * 0.65) *
pixelScale + 0.5;
dVar3 = floor((double)scaledCoord);
sampleX = (float)dVar3 / pixelScale;
scaledCoord = ((g_screenHeight - 182.0) * 0.5 + ((player->_pos).y - 140.0) * 0.65) *
pixelScale + 0.5;
dVar3 = floor((double)scaledCoord);
scaledCoord = (float)dVar3;
sampleY = scaledCoord / pixelScale;
local_60 = sampleX;
(GHIDRA_CAST<Sprite *>((sprite)))->Sprite::GetTexel(&texelR,sampleX,sampleY,decoRenderX,decoRenderY,0x3c23d70a,
0xffffffff);
if (0.0 < texelA) {
(GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::is_footstep_triggered(-1);
if (player->_canFly == 0) {
isSecondFoot = (GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::is_footstep_triggered(0);
if (isSecondFoot == 0) {
(player->_footprintColor1)._offset[0] = texelR;
(player->_footprintColor1)._offset[1] = texelG;
(player->_footprintColor1)._offset[2] = texelB;
}
else {
(player->_footprintColor2)._offset[0] = texelR;
(player->_footprintColor2)._offset[1] = texelG;
(player->_footprintColor2)._offset[2] = texelB;
}
}
}
}
uVar1 = uVar1 + 1;
} while (uVar1 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2)));
animNameData = animName[0];
}
}
if (0xf < animNameCapacity) {
uVar1 = animNameCapacity + 1;
psVar2 = animNameData;
if (0xfff < uVar1) {
psVar2 = GHIDRA_CAST<std_string *>(animNameData[-1]._capacity);
uVar1 = animNameCapacity + 0x24;
if (GHIDRA_CAST<byte *>(0x1f) < GHIDRA_CAST<byte *>((GHIDRA_INT(animNameData) + (-4 - GHIDRA_INT(psVar2))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(psVar2,uVar1);
}
}
ExceptionList = local_1c;
return;
}
// 0099acc0
void GridEntity_Decoration::BeginBatches()
{
code *pcVar1;
byte bVar2;
uint uVar3;
byte *puddleMatch;
std_string *psVar4;
int iVar5;
std_string *psVar6;
byte *pbVar7;
void *pvVar8;
char *pcVar9;
int iVar10;
GridEntity_Decoration *decoration;
uint uVar11;
bool bVar12;
RNG decorRng;
int attemptsLeft;
uint animSeed;
std_string *local_78;
undefined4 rngShift3;
GridEntity_Decoration *savedThis;
int backdropType;
std_string *animNameHeap;
std_string *local_64;
char isAnimAccepted;
void *curAnimName [4];
uint curAnimNameSize;
uint curAnimNameCapacity;
std_string anm2Path;
std_string local_2c;
uint local_14;
void *local_10;
undefined1 *puStack_c;
uint local_8;
uint *animNameSize;
int *puddleCount;
local_8 = 0xffffffff;
puStack_c = &LAB_00b0d8bd;
local_10 = ExceptionList;
local_14 = __security_cookie ^ GHIDRA_UINT(&(&local_2c)[1]._size);
iVar5 = (this->_desc)._variant;
if (iVar5 == 1000) {
return;
}
if ((g_game->_difficulty == 2) || (g_game->_difficulty == 3)) {
bVar12 = true;
}
else {
bVar12 = false;
}
pvVar8 = g_game->_room;
backdropType = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar8) + 0x1d18));
iVar10 = 0;
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar8) + 4)) != 0) {
iVar10 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar8) + 4)) + 0x58));
}
uVar11 = this->_gridIndex + iVar10;
decorRng._shift1 = 5;
decorRng._shift2 = 9;
rngShift3 = 7;
decorRng._shift3 = 7;
ExceptionList = &local_10;
decorRng._seed = uVar11;
savedThis = this;
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar8) + 8)) == 0x10) {
local_2c._size = 0;
local_2c._capacity = 0xf;
local_2c._buf[0] = '\0';
local_2c._buf[1] = '\0';
local_2c._buf[2] = '\0';
local_2c._buf[3] = '\0';
if (backdropType == 0x38) {
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) = std::_Allocate(0x20);
local_2c._size = 0x1a;
local_2c._capacity = 0x1f;
builtin_strncpy((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(local_2c._buf))) + 0x0))),"gfx/grid/Tiles_Rotgut.anm2",0x1b);
local_8 = 0;
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Load(&local_2c,1);
local_8 = 0xffffffff;
if (0xf < local_2c._capacity) {
uVar11 = local_2c._capacity + 1;
pcVar9 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(local_2c._buf))) + 0x0)));
if (0xfff < uVar11) {
pcVar9 = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) + -4));
uVar11 = local_2c._capacity + 0x24;
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar9))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pcVar9,uVar11);
}
iVar5 = (this->_desc)._variant;
if (iVar5 == 10) {
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::SetFrame(GHIDRA_CAST<std_string *>("Ladder"),0);
iVar5 = (this->_desc)._variant;
}
if (iVar5 == 0x14) {
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::SetFrame(GHIDRA_CAST<std_string *>("Ladder"),1);
iVar5 = (this->_desc)._variant;
}
if (iVar5 == 0x1e) {
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::SetFrame(GHIDRA_CAST<std_string *>("Ladder"),2);
ExceptionList = local_10;
return;
}
ExceptionList = local_10;
return;
}
if (backdropType == 0x37) {
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) = std::_Allocate(0x30);
local_2c._size = 0x26;
local_2c._capacity = 0x2f;
builtin_strncpy(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0))))->_buf,"gfx/grid/Tiles_I",0x10);
((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0))))->_size = 0x646d6574;
((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0))))->_capacity = 0x65676e75;
builtin_strncpy((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) + 0x18)))->_buf,"on_Gideon.anm2",0xf);
local_8 = 1;
}
else {
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) = std::_Allocate(0x20);
local_2c._size = 0x1f;
local_2c._capacity = 0x1f;
builtin_strncpy(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0))))->_buf,"gfx/grid/Tiles_I",0x10);
((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0))))->_size = 0x646d6574;
((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0))))->_capacity = 0x65676e75;
builtin_strncpy((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) + 0x18)))->_buf,"on.anm2",8);
local_8 = 2;
}
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Load(&local_2c,1);
local_8 = 0xffffffff;
if (0xf < local_2c._capacity) {
uVar11 = local_2c._capacity + 1;
psVar4 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0)));
if (0xfff < uVar11) {
psVar4 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) + -0x18)))->_capacity);
uVar11 = local_2c._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar4))))) goto LAB_0099af04;
}
operator_delete(psVar4,uVar11);
}
iVar5 = (this->_desc)._variant;
if (iVar5 == 10) {
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Play(GHIDRA_CAST<byte *>("Ladder1"),0);
iVar5 = (this->_desc)._variant;
}
if (iVar5 == 0x14) {
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Play(GHIDRA_CAST<byte *>("Ladder2"),0);
iVar5 = (this->_desc)._variant;
}
if (iVar5 == 0x1e) {
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Play(GHIDRA_CAST<byte *>("Ladder3"),0);
ExceptionList = local_10;
return;
}
ExceptionList = local_10;
return;
}
if ((bVar12) && ((iVar5 == 10 || (backdropType == 0x14)))) {
local_2c._size = 0;
local_2c._capacity = 0xf;
local_2c._buf[0] = '\0';
local_2c._buf[1] = '\0';
local_2c._buf[2] = '\0';
local_2c._buf[3] = '\0';
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) = std::_Allocate(0x20);
local_2c._size = 0x1c;
local_2c._capacity = 0x1f;
builtin_strncpy(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0))))->_buf,"gfx/grid/Props_1",0x10);
((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0))))->_size = 0x72475f32;
((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0))))->_capacity = 0x2e646565;
builtin_strncpy((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) + 0x18)))->_buf,"anm2",5);
local_8 = 3;
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Load(&local_2c,1);
local_8 = 0xffffffff;
if (0xf < local_2c._capacity) {
uVar11 = local_2c._capacity + 1;
psVar4 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0)));
if (0xfff < uVar11) {
psVar4 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) + -0x18)))->_capacity);
uVar11 = local_2c._capacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar4))))) goto LAB_0099af04;
}
operator_delete(psVar4,uVar11);
}
uVar11 = (GHIDRA_CAST<RNG *>((&decorRng)))->RNG::Next();
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::PlayRandom(uVar11);
ExceptionList = local_10;
return;
}
(GHIDRA_CAST<std::string *>((anm2Path._buf)))->std::string::string((void *)(GHIDRA_INT(pvVar8) + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar8) + 0x1d18)) * 0x13c + 0x1d94));
local_8 = 4;
iVar5 = g_game->_stage;
bVar2 = (GHIDRA_CAST<Seeds *>((&g_game->_seedEffects)))->Seeds::HasSeedEffect(0x4f);
if ((bVar2 != 0) &&
((((iVar5 == 3 || (iVar5 == 4)) || (iVar5 == 0xb)) ||
((1 < iVar5 && (uVar11 == (uVar11 / 5) * 5)))))) {
(GHIDRA_CAST<std::string *>((anm2Path._buf)))->std::string::assign(GHIDRA_CAST<byte *>("gfx/promo/gfuel/grid/props_gfuel.anm2"),0x25);
}
decoration = savedThis;
if (anm2Path._size != 0) {
(GHIDRA_CAST<ANM2 *>((&savedThis->_sprite)))->ANM2::Load(&anm2Path,1);
attemptsLeft = 0x14;
LAB_0099b160:
iVar5 = attemptsLeft + -1;
bVar12 = 0 < attemptsLeft;
attemptsLeft = iVar5;
if (bVar12) {
if (uVar11 == 0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("RNG Seed is zero!\n"));
pcVar1 = (code *)swi(3);
(*pcVar1)();
return;
}
uVar11 = uVar11 >> ((byte)decorRng._shift1 & 0x1f) ^ uVar11;
uVar11 = uVar11 << ((byte)decorRng._shift2 & 0x1f) ^ uVar11;
animSeed = uVar11 >> ((byte)rngShift3 & 0x1f) ^ uVar11;
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&decoration->_sprite))))->Sprite::PlayRandom(animSeed);
pvVar8 = (decoration->_sprite)._animState._animData;
if (pvVar8 == (void *)0x0) {
local_2c._capacity = 0xf;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) = GHIDRA_CAST<std_string *>(0x0);
local_2c._size = 0;
}
else {
(GHIDRA_CAST<std::string *>((local_2c._buf)))->std::string::string(pvVar8);
}
local_64 = &local_2c;
if (0xf < local_2c._capacity) {
local_64 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0)));
}
animNameHeap = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0)));
if (4 < local_2c._size) {
iVar5 = -1;
if (local_2c._size - 5 != -1) {
iVar5 = local_2c._size - 5;
}
psVar4 = GHIDRA_CAST<std_string *>((local_64->_buf + iVar5));
do {
if (psVar4->_buf[0] == 'C') {
pcVar9 = "Caves";
iVar5 = 1;
psVar6 = psVar4;
if (*GHIDRA_CAST<int *>(psVar4->_buf) == 0x65766143) {
psVar6 = GHIDRA_CAST<std_string *>((psVar4->_buf + 4));
iVar5 = -3;
pcVar9 = "s";
}
bVar12 = (byte)psVar6->_buf[0] < (byte)*pcVar9;
if ((psVar6->_buf[0] == *pcVar9) &&
((iVar5 == -3 ||
(((bVar12 = (byte)psVar6->_buf[1] < (byte)pcVar9[1], psVar6->_buf[1] == pcVar9[1] &&
(bVar12 = (byte)psVar6->_buf[2] < (byte)pcVar9[2], psVar6->_buf[2] == pcVar9[2]))
&& (bVar12 = (byte)psVar6->_buf[3] < (byte)pcVar9[3], psVar6->_buf[3] == pcVar9[3])
))))) {
uVar11 = 0;
}
else {
uVar11 = -GHIDRA_UINT(bVar12) | 1;
}
if (uVar11 == 0) {
if ((GHIDRA_INT(psVar4) - GHIDRA_INT(local_64) != -1) && (backdropType != 4)) goto LAB_0099b501;
break;
}
}
if (psVar4 == local_64) break;
psVar4 = GHIDRA_CAST<std_string *>((GHIDRA_INT(&psVar4[-1]._capacity) + 3));
} while( true );
}
local_64 = &local_2c;
if (0xf < local_2c._capacity) {
local_64 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0)));
}
if (8 < local_2c._size) {
iVar5 = -1;
if (local_2c._size - 9 != -1) {
iVar5 = local_2c._size - 9;
}
psVar4 = GHIDRA_CAST<std_string *>((local_64->_buf + iVar5));
do {
if (psVar4->_buf[0] == 'C') {
pcVar9 = "Catacombs";
uVar11 = 5;
psVar6 = psVar4;
do {
if (*GHIDRA_CAST<int *>(psVar6->_buf) != *GHIDRA_CAST<int *>(pcVar9)) break;
psVar6 = GHIDRA_CAST<std_string *>((psVar6->_buf + 4));
pcVar9 = pcVar9 + 4;
bVar12 = 3 < uVar11;
uVar11 = uVar11 - 4;
} while (bVar12);
bVar12 = (byte)psVar6->_buf[0] < (byte)*pcVar9;
if ((psVar6->_buf[0] == *pcVar9) &&
((uVar11 == 0xfffffffd ||
(((bVar12 = (byte)psVar6->_buf[1] < (byte)pcVar9[1], psVar6->_buf[1] == pcVar9[1] &&
(bVar12 = (byte)psVar6->_buf[2] < (byte)pcVar9[2], psVar6->_buf[2] == pcVar9[2]))
&& (bVar12 = (byte)psVar6->_buf[3] < (byte)pcVar9[3], psVar6->_buf[3] == pcVar9[3])
))))) {
uVar11 = 0;
}
else {
uVar11 = -GHIDRA_UINT(bVar12) | 1;
}
if (uVar11 == 0) {
if ((GHIDRA_INT(psVar4) - GHIDRA_INT(local_64) != -1) && (backdropType != 5)) goto LAB_0099b501;
break;
}
}
if (psVar4 == local_64) break;
psVar4 = GHIDRA_CAST<std_string *>((GHIDRA_INT(&psVar4[-1]._capacity) + 3));
} while( true );
}
local_78 = &local_2c;
if (0xf < local_2c._capacity) {
local_78 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0)));
}
if (5 < local_2c._size) {
local_64 = GHIDRA_CAST<std_string *>((local_78->_buf + (local_2c._size - 5)));
for (puddleMatch = memchr(local_78,0x50,GHIDRA_INT(local_64) - GHIDRA_INT(local_78));
puddleMatch != GHIDRA_CAST<byte *>(0x0);
puddleMatch = memchr(puddleMatch + 1,0x50,GHIDRA_INT(local_64) - GHIDRA_INT((puddleMatch + 1)))) {
pcVar9 = "Puddle";
iVar5 = 2;
pbVar7 = puddleMatch;
if (*GHIDRA_CAST<int *>(puddleMatch) == 0x64647550) {
pbVar7 = puddleMatch + 4;
iVar5 = -2;
pcVar9 = "le";
}
bVar12 = *pbVar7 < (byte)*pcVar9;
if (((*pbVar7 == *pcVar9) &&
(bVar12 = pbVar7[1] < (byte)pcVar9[1], pbVar7[1] == pcVar9[1])) &&
((iVar5 == -2 ||
((bVar12 = pbVar7[2] < (byte)pcVar9[2], pbVar7[2] == pcVar9[2] &&
(bVar12 = pbVar7[3] < (byte)pcVar9[3], pbVar7[3] == pcVar9[3])))))) {
uVar11 = 0;
}
else {
uVar11 = -GHIDRA_UINT(bVar12) | 1;
}
if (uVar11 == 0) {
if ((GHIDRA_INT(puddleMatch) - GHIDRA_INT(local_78) != -1) &&
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0x721c)) != 0)) goto LAB_0099b501;
break;
}
}
}
isAnimAccepted = '\x01';
goto LAB_0099b3bd;
}
goto LAB_0099b406;
}
if (anm2Path._capacity < 0x10) {
ExceptionList = local_10;
return;
}
uVar11 = anm2Path._capacity + 1;
if (uVar11 < 0x1000) goto LAB_0099b4b8;
uVar3 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) + (-4 - GHIDRA_INT(*(void **)((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) + -4)));
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) = *(void **)((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) + -4);
joined_r0x0099b4b2:
uVar11 = anm2Path._capacity + 0x24;
if (0x1f < uVar3) {
LAB_0099af04:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
LAB_0099b4b8:
operator_delete((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)anm2Path._buf)) + 0x0))),uVar11);
ExceptionList = local_10;
return;
LAB_0099b501:
isAnimAccepted = '\0';
LAB_0099b3bd:
if (0xf < local_2c._capacity) {
uVar11 = local_2c._capacity + 1;
psVar4 = animNameHeap;
if (0xfff < uVar11) {
psVar4 = GHIDRA_CAST<std_string *>(animNameHeap[-1]._capacity);
uVar11 = local_2c._capacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(animNameHeap) + (-4 - GHIDRA_INT(psVar4))))) goto LAB_0099af04;
}
operator_delete(psVar4,uVar11);
}
decoration = savedThis;
uVar11 = animSeed;
if (isAnimAccepted != '\0') goto LAB_0099b406;
goto LAB_0099b160;
LAB_0099b406:
psVar4 = (GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>(&(decoration->_sprite)._animState))))->ANM2::GetAnimation(GHIDRA_CAST<std_string *>(curAnimName));
animNameSize = &psVar4->_size;
if (0xf < psVar4->_capacity) {
psVar4 = *GHIDRA_CAST<std_string **>(psVar4->_buf);
}
uVar11 = std::string::find(GHIDRA_CAST<byte *>(psVar4),*animNameSize,0,GHIDRA_CAST<byte *>("Puddle"),6);
if (0xf < curAnimNameCapacity) {
uVar3 = curAnimNameCapacity + 1;
pvVar8 = curAnimName[0];
if (0xfff < uVar3) {
pvVar8 = *(void **)(GHIDRA_INT(curAnimName[0]) + -4);
uVar3 = curAnimNameCapacity + 0x24;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(curAnimName[0]) + (-4 - GHIDRA_INT(pvVar8))))) goto LAB_0099af04;
}
operator_delete(pvVar8,uVar3);
}
curAnimNameSize = 0;
curAnimNameCapacity = 0xf;
curAnimName[0] = (void *)(GHIDRA_UINT(curAnimName[0]) & 0xffffff00);
if (uVar11 != 0xffffffff) {
puddleCount = GHIDRA_CAST<int *>((GHIDRA_INT(g_game->_room) + 0x721c));
*puddleCount = *puddleCount + 1;
}
if (anm2Path._capacity < 0x10) {
ExceptionList = local_10;
return;
}
uVar11 = anm2Path._capacity + 1;
if (uVar11 < 0x1000) goto LAB_0099b4b8;
uVar3 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) + (-4 - GHIDRA_INT(*(void **)((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) + -4)));
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) = *(void **)((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) + -4);
goto joined_r0x0099b4b2;
}