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>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-11-19 21:10:23 -05:00
1 parent 2ff2d5d87f
commit 3ce74c6e2d
331 files changed
+485 -7835

No files matched your search

+74
View File
@@ -0,0 +1,74 @@
#include "classes.h"
// 0042cdf0
void GridEntity_Statue::Render()
{
return;
}
// 00838520
void GridEntity_Statue::Update()
{
int state;
if ((this->_sprite)._loaded != 0) {
(GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::Update();
(GHIDRA_CAST<AnimationState *>((&(this->_sprite)._overlayAnimState)))->AnimationState::Update();
}
state = (this->_desc)._state;
if (state == 1) {
this->_collisionClass = 3;
return;
}
if (state == 2) {
this->_collisionClass = 0;
}
return;
}
// 00838ae0
void GridEntity_Statue::BeginBatches()
{
uint seed;
int iVar1;
Entity *statueEffect;
undefined4 gridPathValue;
int gridX;
uint variant;
Vector spawnPos;
iVar1 = (this->_desc)._state;
if (iVar1 < 1) {
(this->_desc)._state = 1;
}
else if (iVar1 != 1) goto LAB_00838bf3;
iVar1 = (this->_desc)._variant;
if (iVar1 == 0) {
seed = Random();
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0xc));
gridX = this->_gridIndex % iVar1;
iVar1 = this->_gridIndex / iVar1;
variant = 6;
}
else {
if (iVar1 != 1) goto LAB_00838bf3;
seed = Random();
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0xc));
gridX = this->_gridIndex % iVar1;
iVar1 = this->_gridIndex / iVar1;
variant = 9;
}
spawnPos.x = (float)gridX * 40.0 + 40.0;
spawnPos.y = (float)iVar1 * 40.0 + 120.0;
statueEffect = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,variant,&spawnPos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,seed,0);
*GHIDRA_CAST<Entity **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x154)))) = statueEffect;
LAB_00838bf3:
if (GHIDRA_UINT(this->_gridIndex) < 0x1c0) {
gridPathValue = 0;
if ((this->_desc)._state == 1) {
gridPathValue = 1000;
}
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(g_game->_room) + this->_gridIndex * 4 + 0x76c)) = gridPathValue;
}
return;
}