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

+63
View File
@@ -0,0 +1,63 @@
#include "classes.h"
// 0041e4c0
void Point::UpdateNormal(Vector *unk)
{
float fVar1;
float fVar2;
float dirX;
Point newNormalY;
Point PVar3;
Point newNormalX;
float dirY;
Point oldNormalX;
Point oldNormalY;
oldNormalX = this[2];
if (((float)oldNormalX == g_vectorZero.x) && ((float)this[3] == g_vectorZero.y)) {
dirX = unk->x - (float)*this;
dirY = unk->y - (float)this[1];
fVar1 = sqrtf(dirX * dirX + dirY * dirY);
unk = GHIDRA_CAST<Vector *>(dirX);
if (0.0 < fVar1) {
unk = GHIDRA_CAST<Vector *>((dirX * (1.0 / fVar1)));
dirY = dirY * (1.0 / fVar1);
}
fVar1 = cos(1.5707964);
fVar2 = sin(1.5707964);
this[3] = (Point)((float)unk * fVar2 + dirY * fVar1);
this[2] = (Point)((float)unk * fVar1 - dirY * fVar2);
return;
}
oldNormalY = this[3];
dirY = unk->y - (float)this[1];
unk = GHIDRA_CAST<Vector *>((unk->x - (float)*this));
fVar1 = sqrtf(dirY * dirY + (float)unk * (float)unk);
if (0.0 < fVar1) {
unk = GHIDRA_CAST<Vector *>(((float)unk * (1.0 / fVar1)));
dirY = dirY * (1.0 / fVar1);
}
fVar1 = cos(1.5707964);
fVar2 = sin(1.5707964);
newNormalX = (Point)(((float)unk * fVar1 - dirY * fVar2) + (float)oldNormalX);
newNormalY = (Point)((float)unk * fVar2 + dirY * fVar1 + (float)this[3]);
this[2] = newNormalX;
this[3] = newNormalY;
fVar1 = sqrtf((float)newNormalY * (float)newNormalY + (float)newNormalX * (float)newNormalX);
if (fVar1 <= 0.0) {
PVar3 = this[3];
}
else {
newNormalY = (Point)((float)newNormalY * (1.0 / fVar1));
newNormalX = (Point)((float)newNormalX * (1.0 / fVar1));
PVar3 = newNormalY;
}
fVar2 = (float)oldNormalY * (float)newNormalY + (float)oldNormalX * (float)newNormalX;
fVar1 = 0.4;
if (0.4 <= fVar2) {
fVar1 = fVar2;
}
this[3] = (Point)((float)PVar3 / fVar1);
this[2] = (Point)((float)newNormalX / fVar1);
return;
}