- 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>
545 lines
23 KiB
C++
545 lines
23 KiB
C++
#include "classes.h"
|
|
|
|
// 0099a8e0
|
|
void GridEntity_Decoration::Update()
|
|
{
|
|
uint8_t isSecondFoot;
|
|
uint32_t 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];
|
|
uint32_t animNameSize;
|
|
uint32_t animNameCapacity;
|
|
uint32_t securityCookie;
|
|
uint8_t *puStack_20;
|
|
void *local_1c;
|
|
uint8_t *puStack_18;
|
|
std_string *local_14;
|
|
|
|
puStack_20 = GHIDRA_CAST<uint8_t *>((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 ((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8)))) != 1000) && ((this->_sprite)._loaded != 0)) {
|
|
decoration = this;
|
|
AnimationState::Update(&(this->_sprite)._animState);
|
|
AnimationState::Update(&(this->_sprite)._overlayAnimState);
|
|
ANM2::GetAnimation(GHIDRA_CAST<ANM2 *>(&(this->_sprite)._animState),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 = msvc::string::find(GHIDRA_CAST<uint8_t *>(psVar2),animNameSize,0,GHIDRA_CAST<uint8_t *>("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<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((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;
|
|
uint8_t bVar2;
|
|
uint32_t uVar3;
|
|
uint8_t *puddleMatch;
|
|
std_string *psVar4;
|
|
int iVar5;
|
|
std_string *psVar6;
|
|
uint8_t *pbVar7;
|
|
void *pvVar8;
|
|
char *pcVar9;
|
|
GridEntity_Decoration *decoration;
|
|
uint32_t uVar10;
|
|
bool bVar11;
|
|
RNG decorRng;
|
|
int attemptsLeft;
|
|
uint32_t animSeed;
|
|
std_string *local_78;
|
|
uint32_t rngShift3;
|
|
GridEntity_Decoration *savedThis;
|
|
int backdropType;
|
|
std_string *animNameHeap;
|
|
std_string *local_64;
|
|
char isAnimAccepted;
|
|
void *curAnimName [4];
|
|
uint32_t curAnimNameSize;
|
|
uint32_t curAnimNameCapacity;
|
|
std_string anm2Path;
|
|
std_string local_2c;
|
|
uint32_t local_14;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
uint32_t *animNameSize;
|
|
int *puddleCount;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00b0d8bd;
|
|
local_10 = ExceptionList;
|
|
local_14 = __security_cookie ^ GHIDRA_UINT(&(&local_2c)[1]._size);
|
|
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8)))) == 1000) {
|
|
return;
|
|
}
|
|
if ((g_game->_difficulty == 2) || (g_game->_difficulty == 3)) {
|
|
bVar11 = true;
|
|
}
|
|
else {
|
|
bVar11 = false;
|
|
}
|
|
pvVar8 = g_game->_room;
|
|
backdropType = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar8) + 0x1d18));
|
|
iVar5 = 0;
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar8) + 4)) != 0) {
|
|
iVar5 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar8) + 4)) + 0x58));
|
|
}
|
|
uVar10 = this->_gridIndex + iVar5;
|
|
decorRng._shift1 = 5;
|
|
decorRng._shift2 = 9;
|
|
rngShift3 = 7;
|
|
decorRng._shift3 = 7;
|
|
ExceptionList = &local_10;
|
|
decorRng._seed = uVar10;
|
|
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<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) = msvc::_Allocate(0x20);
|
|
local_2c._size = 0x1a;
|
|
local_2c._capacity = 0x1f;
|
|
builtin_strncpy((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(local_2c._buf))) + 0x0))),"gfx/grid/Tiles_Rotgut.anm2",0x1b);
|
|
local_8 = 0;
|
|
ANM2::Load(&this->_sprite,&local_2c,1);
|
|
local_8 = 0xffffffff;
|
|
if (0xf < local_2c._capacity) {
|
|
uVar10 = local_2c._capacity + 1;
|
|
pcVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(local_2c._buf))) + 0x0)));
|
|
if (0xfff < uVar10) {
|
|
pcVar9 = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) + -4));
|
|
uVar10 = local_2c._capacity + 0x24;
|
|
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar9))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(pcVar9,uVar10);
|
|
}
|
|
iVar5 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8))));
|
|
if (iVar5 == 10) {
|
|
ANM2::SetFrame(&this->_sprite,GHIDRA_CAST<std_string *>("Ladder"),0);
|
|
iVar5 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8))));
|
|
}
|
|
if (iVar5 == 0x14) {
|
|
ANM2::SetFrame(&this->_sprite,GHIDRA_CAST<std_string *>("Ladder"),1);
|
|
iVar5 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8))));
|
|
}
|
|
if (iVar5 == 0x1e) {
|
|
ANM2::SetFrame(&this->_sprite,GHIDRA_CAST<std_string *>("Ladder"),2);
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
if (backdropType == 0x37) {
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) = msvc::_Allocate(0x30);
|
|
local_2c._size = 0x26;
|
|
local_2c._capacity = 0x2f;
|
|
builtin_strncpy(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0))))->_buf,"gfx/grid/Tiles_I",0x10);
|
|
((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0))))->_size = 0x646d6574;
|
|
((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0))))->_capacity = 0x65676e75;
|
|
builtin_strncpy((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) + 0x18)))->_buf,"on_Gideon.anm2",0xf);
|
|
local_8 = 1;
|
|
}
|
|
else {
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) = msvc::_Allocate(0x20);
|
|
local_2c._size = 0x1f;
|
|
local_2c._capacity = 0x1f;
|
|
builtin_strncpy(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0))))->_buf,"gfx/grid/Tiles_I",0x10);
|
|
((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0))))->_size = 0x646d6574;
|
|
((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0))))->_capacity = 0x65676e75;
|
|
builtin_strncpy((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) + 0x18)))->_buf,"on.anm2",8);
|
|
local_8 = 2;
|
|
}
|
|
ANM2::Load(&this->_sprite,&local_2c,1);
|
|
local_8 = 0xffffffff;
|
|
if (0xf < local_2c._capacity) {
|
|
uVar10 = local_2c._capacity + 1;
|
|
psVar4 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0)));
|
|
if (0xfff < uVar10) {
|
|
psVar4 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) + -0x18)))->_capacity);
|
|
uVar10 = local_2c._capacity + 0x24;
|
|
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar4))))) goto LAB_0099af04;
|
|
}
|
|
operator_delete(psVar4,uVar10);
|
|
}
|
|
iVar5 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8))));
|
|
if (iVar5 == 10) {
|
|
ANM2::Play(&this->_sprite,GHIDRA_CAST<uint8_t *>("Ladder1"),0);
|
|
iVar5 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8))));
|
|
}
|
|
if (iVar5 == 0x14) {
|
|
ANM2::Play(&this->_sprite,GHIDRA_CAST<uint8_t *>("Ladder2"),0);
|
|
iVar5 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8))));
|
|
}
|
|
if (iVar5 == 0x1e) {
|
|
ANM2::Play(&this->_sprite,GHIDRA_CAST<uint8_t *>("Ladder3"),0);
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
if ((bVar11) && ((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8)))) == 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<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) = msvc::_Allocate(0x20);
|
|
local_2c._size = 0x1c;
|
|
local_2c._capacity = 0x1f;
|
|
builtin_strncpy(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0))))->_buf,"gfx/grid/Props_1",0x10);
|
|
((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0))))->_size = 0x72475f32;
|
|
((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0))))->_capacity = 0x2e646565;
|
|
builtin_strncpy((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) + 0x18)))->_buf,"anm2",5);
|
|
local_8 = 3;
|
|
ANM2::Load(&this->_sprite,&local_2c,1);
|
|
local_8 = 0xffffffff;
|
|
if (0xf < local_2c._capacity) {
|
|
uVar10 = local_2c._capacity + 1;
|
|
psVar4 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0)));
|
|
if (0xfff < uVar10) {
|
|
psVar4 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) + -0x18)))->_capacity);
|
|
uVar10 = local_2c._capacity + 0x24;
|
|
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar4))))) goto LAB_0099af04;
|
|
}
|
|
operator_delete(psVar4,uVar10);
|
|
}
|
|
uVar10 = (GHIDRA_CAST<RNG *>((&decorRng)))->RNG::Next();
|
|
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::PlayRandom(uVar10);
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
(GHIDRA_CAST<msvc::string *>((anm2Path._buf)))->msvc::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 && (uVar10 == (uVar10 / 5) * 5)))))) {
|
|
(GHIDRA_CAST<msvc::string *>((anm2Path._buf)))->msvc::string::assign(GHIDRA_CAST<uint8_t *>("gfx/promo/gfuel/grid/props_gfuel.anm2"),0x25);
|
|
}
|
|
decoration = savedThis;
|
|
if (anm2Path._size != 0) {
|
|
ANM2::Load(&savedThis->_sprite,&anm2Path,1);
|
|
attemptsLeft = 0x14;
|
|
LAB_0099b160:
|
|
iVar5 = attemptsLeft + -1;
|
|
bVar11 = 0 < attemptsLeft;
|
|
attemptsLeft = iVar5;
|
|
if (bVar11) {
|
|
if (uVar10 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
|
|
pcVar1 = (code *)swi(3);
|
|
(*pcVar1)();
|
|
return;
|
|
}
|
|
uVar10 = uVar10 >> ((uint8_t)decorRng._shift1 & 0x1f) ^ uVar10;
|
|
uVar10 = uVar10 << ((uint8_t)decorRng._shift2 & 0x1f) ^ uVar10;
|
|
animSeed = uVar10 >> ((uint8_t)rngShift3 & 0x1f) ^ uVar10;
|
|
(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<uint32_t *>((GHIDRA_CAST<char *>(&(local_2c._buf)) + 0x0))) = GHIDRA_CAST<std_string *>(0x0);
|
|
local_2c._size = 0;
|
|
}
|
|
else {
|
|
(GHIDRA_CAST<msvc::string *>((local_2c._buf)))->msvc::string::string(pvVar8);
|
|
}
|
|
local_64 = &local_2c;
|
|
if (0xf < local_2c._capacity) {
|
|
local_64 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_2c._buf))) + 0x0)));
|
|
}
|
|
animNameHeap = (*GHIDRA_CAST<uint32_t *>((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";
|
|
}
|
|
bVar11 = (uint8_t)psVar6->_buf[0] < (uint8_t)*pcVar9;
|
|
if ((psVar6->_buf[0] == *pcVar9) &&
|
|
((iVar5 == -3 ||
|
|
(((bVar11 = (uint8_t)psVar6->_buf[1] < (uint8_t)pcVar9[1], psVar6->_buf[1] == pcVar9[1] &&
|
|
(bVar11 = (uint8_t)psVar6->_buf[2] < (uint8_t)pcVar9[2], psVar6->_buf[2] == pcVar9[2]))
|
|
&& (bVar11 = (uint8_t)psVar6->_buf[3] < (uint8_t)pcVar9[3], psVar6->_buf[3] == pcVar9[3])
|
|
))))) {
|
|
uVar10 = 0;
|
|
}
|
|
else {
|
|
uVar10 = -GHIDRA_UINT(bVar11) | 1;
|
|
}
|
|
if (uVar10 == 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<uint32_t *>((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";
|
|
uVar10 = 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;
|
|
bVar11 = 3 < uVar10;
|
|
uVar10 = uVar10 - 4;
|
|
} while (bVar11);
|
|
bVar11 = (uint8_t)psVar6->_buf[0] < (uint8_t)*pcVar9;
|
|
if ((psVar6->_buf[0] == *pcVar9) &&
|
|
((uVar10 == 0xfffffffd ||
|
|
(((bVar11 = (uint8_t)psVar6->_buf[1] < (uint8_t)pcVar9[1], psVar6->_buf[1] == pcVar9[1] &&
|
|
(bVar11 = (uint8_t)psVar6->_buf[2] < (uint8_t)pcVar9[2], psVar6->_buf[2] == pcVar9[2]))
|
|
&& (bVar11 = (uint8_t)psVar6->_buf[3] < (uint8_t)pcVar9[3], psVar6->_buf[3] == pcVar9[3])
|
|
))))) {
|
|
uVar10 = 0;
|
|
}
|
|
else {
|
|
uVar10 = -GHIDRA_UINT(bVar11) | 1;
|
|
}
|
|
if (uVar10 == 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<uint32_t *>((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<uint8_t *>(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";
|
|
}
|
|
bVar11 = *pbVar7 < (uint8_t)*pcVar9;
|
|
if (((*pbVar7 == *pcVar9) &&
|
|
(bVar11 = pbVar7[1] < (uint8_t)pcVar9[1], pbVar7[1] == pcVar9[1])) &&
|
|
((iVar5 == -2 ||
|
|
((bVar11 = pbVar7[2] < (uint8_t)pcVar9[2], pbVar7[2] == pcVar9[2] &&
|
|
(bVar11 = pbVar7[3] < (uint8_t)pcVar9[3], pbVar7[3] == pcVar9[3])))))) {
|
|
uVar10 = 0;
|
|
}
|
|
else {
|
|
uVar10 = -GHIDRA_UINT(bVar11) | 1;
|
|
}
|
|
if (uVar10 == 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;
|
|
}
|
|
uVar10 = anm2Path._capacity + 1;
|
|
if (uVar10 < 0x1000) goto LAB_0099b4b8;
|
|
uVar3 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) + (-4 - GHIDRA_INT(*(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) + -4)));
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) + -4);
|
|
joined_r0x0099b4b2:
|
|
uVar10 = anm2Path._capacity + 0x24;
|
|
if (0x1f < uVar3) {
|
|
LAB_0099af04:
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
LAB_0099b4b8:
|
|
operator_delete((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)anm2Path._buf)) + 0x0))),uVar10);
|
|
ExceptionList = local_10;
|
|
return;
|
|
LAB_0099b501:
|
|
isAnimAccepted = '\0';
|
|
LAB_0099b3bd:
|
|
if (0xf < local_2c._capacity) {
|
|
uVar10 = local_2c._capacity + 1;
|
|
psVar4 = animNameHeap;
|
|
if (0xfff < uVar10) {
|
|
psVar4 = GHIDRA_CAST<std_string *>(animNameHeap[-1]._capacity);
|
|
uVar10 = local_2c._capacity + 0x24;
|
|
if (0x1f < GHIDRA_UINT((GHIDRA_INT(animNameHeap) + (-4 - GHIDRA_INT(psVar4))))) goto LAB_0099af04;
|
|
}
|
|
operator_delete(psVar4,uVar10);
|
|
}
|
|
decoration = savedThis;
|
|
uVar10 = animSeed;
|
|
if (isAnimAccepted != '\0') goto LAB_0099b406;
|
|
goto LAB_0099b160;
|
|
LAB_0099b406:
|
|
psVar4 = ANM2::GetAnimation(GHIDRA_CAST<ANM2 *>(&(decoration->_sprite)._animState),GHIDRA_CAST<std_string *>(curAnimName));
|
|
animNameSize = &psVar4->_size;
|
|
if (0xf < psVar4->_capacity) {
|
|
psVar4 = *GHIDRA_CAST<std_string **>(psVar4->_buf);
|
|
}
|
|
uVar10 = msvc::string::find(GHIDRA_CAST<uint8_t *>(psVar4),*animNameSize,0,GHIDRA_CAST<uint8_t *>("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 (uVar10 != 0xffffffff) {
|
|
puddleCount = GHIDRA_CAST<int *>((GHIDRA_INT(g_game->_room) + 0x721c));
|
|
*puddleCount = *puddleCount + 1;
|
|
}
|
|
if (anm2Path._capacity < 0x10) {
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
uVar10 = anm2Path._capacity + 1;
|
|
if (uVar10 < 0x1000) goto LAB_0099b4b8;
|
|
uVar3 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) + (-4 - GHIDRA_INT(*(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) + -4)));
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) + -4);
|
|
goto joined_r0x0099b4b2;
|
|
}
|