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"
// 009e2f20
void RailManager::Render(Vector *offset)
{
RailManager *frontAnimState = this;
byte bVar1;
int gridSize;
AnimationState *frontAnimState;
uint gridIndex;
float pixelScale;
double dVar2;
double dVar3;
int gridEntityOffset;
Vector renderPos;
int gridWidth;
bVar1 = (GHIDRA_CAST<ANM2 *>((&frontAnimState->_sprite)))->ANM2::SetAnimation(&DAT_00b804d8,1);
if (((bVar1 != 0) && ((frontAnimState->_sprite)._animState._animData != (void *)0x0)) &&
((GHIDRA_CAST<AnimationState *>((&(frontAnimState->_sprite)._animState)))->AnimationState::SetFrameFloat(0.0),
(frontAnimState->_sprite)._animState._animData != (void *)0x0)) {
(frontAnimState->_sprite)._animState._isPlaying = 0;
}
gridIndex = 0;
gridSize = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(frontAnimState->_room) + 0x10)) * *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(frontAnimState->_room) + 0xc));
if (0 < gridSize) {
gridEntityOffset = 0x24;
do {
bVar1 = (frontAnimState->_sprite)._filename._buf[gridIndex - 0x1c0];
if (-1 < (char)bVar1) {
if (gridIndex < 0x1c0) {
gridWidth = *GHIDRA_CAST<int *>((gridEntityOffset + GHIDRA_INT(frontAnimState->_room)));
if ((gridWidth != 0) && (*GHIDRA_CAST<int *>((gridWidth + 4)) == 7)) goto LAB_009e3195;
if ((bVar1 == 0xff) || ((bVar1 & 0x40) == 0)) goto LAB_009e2fd2;
bVar1 = bVar1 & 0x3f;
if ((frontAnimState->_sprite)._animState._animData != (void *)0x0) goto LAB_009e2fe1;
}
else {
LAB_009e2fd2:
if ((frontAnimState->_sprite)._animState._animData != (void *)0x0) {
bVar1 = bVar1 & 0xf;
LAB_009e2fe1:
(GHIDRA_CAST<AnimationState *>((&(frontAnimState->_sprite)._animState)))->AnimationState::SetFrameFloat((float)bVar1);
}
}
gridWidth = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(frontAnimState->_room) + 0xc));
pixelScale = g_displayPixelRatio * g_screenPointScale;
dVar2 = floor((double)(((((float)(GHIDRA_INT(gridIndex) % gridWidth) * 40.0 + 40.0) - 60.0) * 0.65
+ (g_screenWidth - 338.0) * 0.5) * pixelScale + 0.5));
dVar3 = floor((double)(((((float)(GHIDRA_INT(gridIndex) / gridWidth) * 40.0 + 120.0) - 140.0) *
0.65 + (g_screenHeight - 182.0) * 0.5) * pixelScale + 0.5));
renderPos.x = (float)dVar2 / pixelScale + offset->x;
renderPos.y = (float)dVar3 / pixelScale + offset->y;
if ((frontAnimState->_sprite)._loaded != 0) {
if ((frontAnimState->_sprite)._overlayRenderFirst == 0) {
AnimationState::Render
(&(frontAnimState->_sprite)._animState,&renderPos,&g_vectorZero,&g_vectorZero);
frontAnimState = &(frontAnimState->_sprite)._overlayAnimState;
}
else {
AnimationState::Render
(&(frontAnimState->_sprite)._overlayAnimState,&renderPos,&g_vectorZero,&g_vectorZero);
frontAnimState = &(frontAnimState->_sprite)._animState;
}
AnimationState::Render(frontAnimState,&renderPos,&g_vectorZero,&g_vectorZero);
}
}
LAB_009e3195:
gridEntityOffset = gridEntityOffset + 4;
gridIndex = gridIndex + 1;
} while (GHIDRA_INT(gridIndex) < gridSize);
}
return;
}