- 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>
226 lines
9.4 KiB
C++
226 lines
9.4 KiB
C++
#include "classes.h"
|
|
|
|
// 00721540
|
|
void GridEntity_Web::BeginBatches()
|
|
{
|
|
uint8_t bVar1;
|
|
uint8_t *curAnimName;
|
|
uint32_t startFrame;
|
|
void *animData;
|
|
char *pcVar2;
|
|
uint32_t startFrame;
|
|
bool bVar4;
|
|
std_string anmPath;
|
|
uint32_t local_14;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00afc99d;
|
|
local_10 = ExceptionList;
|
|
local_14 = __security_cookie ^ GHIDRA_UINT(&(&anmPath)[1]._size);
|
|
ExceptionList = &local_10;
|
|
this->_collisionClass = 0;
|
|
anmPath._size = 0;
|
|
anmPath._capacity = 0xf;
|
|
anmPath._buf[0] = '\0';
|
|
anmPath._buf[1] = '\0';
|
|
anmPath._buf[2] = '\0';
|
|
anmPath._buf[3] = '\0';
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anmPath._buf)) + 0x0))) = msvc::_Allocate(0x20);
|
|
anmPath._size = 0x16;
|
|
anmPath._capacity = 0x1f;
|
|
builtin_strncpy((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(anmPath._buf))) + 0x0))),"gfx/grid/grid_web.anm2",0x17);
|
|
local_8 = 0;
|
|
ANM2::Load(&this->_sprite,&anmPath,1);
|
|
local_8 = 0xffffffff;
|
|
if (0xf < anmPath._capacity) {
|
|
startFrame = anmPath._capacity + 1;
|
|
pcVar2 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(anmPath._buf))) + 0x0)));
|
|
if (0xfff < startFrame) {
|
|
pcVar2 = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anmPath._buf)) + 0x0))) + -4));
|
|
startFrame = anmPath._capacity + 0x24;
|
|
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anmPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar2))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(pcVar2,startFrame);
|
|
}
|
|
anmPath._size = 0;
|
|
anmPath._capacity = 0xf;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anmPath._buf)) + 0x0))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anmPath._buf)) + 0x0))) & 0xffffff00;
|
|
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc)))) != 0) {
|
|
bVar1 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST<uint8_t *>("Bombed"),1);
|
|
if (bVar1 == 0) {
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
if ((this->_sprite)._animState._animData == (void *)0x0) {
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
AnimationState::SetFrameFloat(&(this->_sprite)._animState,0.0);
|
|
if ((this->_sprite)._animState._animData == (void *)0x0) {
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
(this->_sprite)._animState._isPlaying = 0;
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
curAnimName = (this->_sprite)._animState._animData;
|
|
if (curAnimName != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
if (0xf < *GHIDRA_CAST<uint32_t *>((curAnimName + 0x14))) {
|
|
curAnimName = *GHIDRA_CAST<uint8_t **>(curAnimName);
|
|
}
|
|
pcVar2 = "Swaying";
|
|
do {
|
|
bVar1 = *curAnimName;
|
|
bVar4 = bVar1 < (uint8_t)*pcVar2;
|
|
if (bVar1 != *pcVar2) {
|
|
LAB_00721670:
|
|
startFrame = -GHIDRA_UINT(bVar4) | 1;
|
|
goto LAB_00721675;
|
|
}
|
|
if (bVar1 == 0) break;
|
|
bVar1 = curAnimName[1];
|
|
bVar4 = bVar1 < (uint8_t)pcVar2[1];
|
|
if (bVar1 != pcVar2[1]) goto LAB_00721670;
|
|
curAnimName = curAnimName + 2;
|
|
pcVar2 = pcVar2 + 2;
|
|
} while (bVar1 != 0);
|
|
startFrame = 0;
|
|
LAB_00721675:
|
|
if ((startFrame == 0) &&
|
|
((*GHIDRA_CAST<char *>((GHIDRA_INT((this->_sprite)._animState._animData) + 0x34)) == '\0' ||
|
|
((this->_sprite)._animState._isPlaying != 0)))) goto LAB_007216ad;
|
|
}
|
|
bVar1 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST<uint8_t *>("Swaying"),1);
|
|
if (bVar1 != 0) {
|
|
AnimationState::Rewind(&(this->_sprite)._animState);
|
|
(this->_sprite)._animState._isPlaying = 1;
|
|
}
|
|
LAB_007216ad:
|
|
animData = (this->_sprite)._animState._animData;
|
|
if ((animData == (void *)0x0) || (startFrame = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(animData) + 0x30)), startFrame == 0)) {
|
|
startFrame = 0;
|
|
}
|
|
else {
|
|
startFrame = Random();
|
|
startFrame = startFrame % startFrame;
|
|
animData = (this->_sprite)._animState._animData;
|
|
}
|
|
if ((animData != (void *)0x0) &&
|
|
(AnimationState::SetFrameFloat(&(this->_sprite)._animState,(float)GHIDRA_INT(startFrame)),
|
|
(this->_sprite)._animState._animData != (void *)0x0)) {
|
|
(this->_sprite)._animState._isPlaying = 0;
|
|
}
|
|
startFrame = Random();
|
|
(this->_sprite)._flipX = ~(uint8_t)startFrame & 1;
|
|
startFrame = Random();
|
|
(this->_sprite)._rotation = ((float)(startFrame & 3) + 0.0) * 90.0;
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 00721780
|
|
void GridEntity_Web::Update()
|
|
{
|
|
int iVar1;
|
|
ColorMod color;
|
|
uint8_t auVar2 [32];
|
|
uint8_t isHasEvilCharm;
|
|
uint32_t uVar3;
|
|
float *maxAxisDistance;
|
|
uint32_t *puVar4;
|
|
PlayerManager *playerManager;
|
|
bool isEveryFourthFrame;
|
|
float distanceY;
|
|
float distanceX;
|
|
EntityRef sourceRef;
|
|
Entity_Player *player;
|
|
void *playersEnd;
|
|
|
|
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc)))) == 0) {
|
|
uVar3 = g_game->_frameCount & 0x80000003;
|
|
isEveryFourthFrame = uVar3 == 0;
|
|
if (GHIDRA_INT(uVar3) < 0) {
|
|
isEveryFourthFrame = (uVar3 - 1 | 0xfffffffc) == 0xffffffff;
|
|
}
|
|
if (isEveryFourthFrame) {
|
|
playerManager = &g_game->_playerManager;
|
|
uVar3 = 0;
|
|
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin)
|
|
>> 2 != 0) {
|
|
do {
|
|
playersEnd = (playerManager->_playerList)._end;
|
|
puVar4 = (playerManager->_playerList)._begin;
|
|
if (GHIDRA_INT(playersEnd) - GHIDRA_INT(puVar4) >> 2 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("(GHIDRA_CAST<PlayerManager *>(()))->PlayerManager::GetPlayer() : There are no players! \n"));
|
|
playersEnd = (playerManager->_playerList)._end;
|
|
puVar4 = (playerManager->_playerList)._begin;
|
|
}
|
|
if (uVar3 < GHIDRA_UINT((GHIDRA_INT(playersEnd) - GHIDRA_INT(puVar4) >> 2))) {
|
|
puVar4 = puVar4 + uVar3;
|
|
}
|
|
player = GHIDRA_CAST<Entity_Player *>(*puVar4);
|
|
iVar1 = player->_entityGridCollisionClass;
|
|
if ((((iVar1 != 0) && (iVar1 != 3)) && (iVar1 != 1)) && (iVar1 != 2)) {
|
|
isHasEvilCharm = (GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::HasCollectible(0x278,0);
|
|
if ((isHasEvilCharm != 0) ||
|
|
(isHasEvilCharm =
|
|
(GHIDRA_CAST<TemporaryEffects *>((&player->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x278),
|
|
isHasEvilCharm != 0)) {
|
|
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x4)))) == 10) goto LAB_007219cb;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((player)) + 0x26d4))) = (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((player)) + 0x26d4))) != '\0';
|
|
}
|
|
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0xc));
|
|
distanceY = ABS((player->_pos).y - ((float)(this->_gridIndex / iVar1) * 40.0 + 120.0));
|
|
distanceX = ABS((player->_pos).x - ((float)(this->_gridIndex % iVar1) * 40.0 + 40.0));
|
|
maxAxisDistance = &distanceY;
|
|
if (distanceY <= distanceX) {
|
|
maxAxisDistance = &distanceX;
|
|
}
|
|
if (*maxAxisDistance <= 21.0 && *maxAxisDistance != 21.0) {
|
|
sourceRef._type = 0;
|
|
sourceRef._variant = 0;
|
|
sourceRef._spawnerType = 0;
|
|
sourceRef._spawnerVariant = 0;
|
|
sourceRef._position.x = g_vectorZero.x;
|
|
sourceRef._position.y = g_vectorZero.y;
|
|
sourceRef._velocity.x = g_vectorZero.x;
|
|
sourceRef._velocity.y = g_vectorZero.y;
|
|
sourceRef._flags = 0;
|
|
sourceRef._entity = (void *)0x0;
|
|
auVar2 = ZEXT1632(CONCAT412(0x3f800000,CONCAT48(0x3fa66666,0x3f8000003f800000)));
|
|
color._offset[0] = 0.15686275;
|
|
color._tint[0] = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)auVar2)) + 0x0)));
|
|
color._tint[1] = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)auVar2)) + 0x4)));
|
|
color._tint[2] = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)auVar2)) + 0x8)));
|
|
color._tint[3] = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)auVar2)) + 0xc)));
|
|
color._colorize[0] = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)auVar2)) + 0x10)));
|
|
color._colorize[1] = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)auVar2)) + 0x14)));
|
|
color._colorize[2] = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)auVar2)) + 0x18)));
|
|
color._colorize[3] = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)auVar2)) + 0x1c)));
|
|
color._offset[1] = 0.15686275;
|
|
color._offset[2] = 0.15686275;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(player))))->Entity::AddSlowing(&sourceRef,4,0.75,color,0);
|
|
}
|
|
}
|
|
LAB_007219cb:
|
|
uVar3 = uVar3 + 1;
|
|
playerManager = &g_game->_playerManager;
|
|
} while (uVar3 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((playerManager->_playerList)._begin) >> 2)));
|
|
}
|
|
}
|
|
}
|
|
if ((this->_sprite)._loaded != 0) {
|
|
AnimationState::Update(&(this->_sprite)._animState);
|
|
AnimationState::Update(&(this->_sprite)._overlayAnimState);
|
|
}
|
|
return;
|
|
}
|