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

+53
View File
@@ -0,0 +1,53 @@
#include "classes.h"
// 009e3450
byte RoomGridPath::can_step(int fromIndex, int toIndex)
{
uint dRow;
uint cellKind;
uint stepRow;
uint stepCol;
uint dCol;
float *stepEntry;
int iVar1;
byte cellType;
iVar1 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(this) + 0xc));
dRow = toIndex / iVar1 - fromIndex / iVar1;
dCol = toIndex % iVar1 - fromIndex % iVar1;
if (((((dRow ^ GHIDRA_INT(dRow) >> 0x1f) - (GHIDRA_INT(dRow) >> 0x1f)) +
((dCol ^ GHIDRA_INT(dCol) >> 0x1f) - (GHIDRA_INT(dCol) >> 0x1f)) == 1) && (GHIDRA_UINT(fromIndex) < 0x1c0)) &&
(cellType = *GHIDRA_CAST<byte *>((fromIndex + 4 + GHIDRA_INT(this))), cellType != 0xff)) {
iVar1 = 0;
cellKind = cellType & 0xf;
if (0 < *GHIDRA_CAST<int *>((&DAT_00c37610 + cellKind * 0x44))) {
stepEntry = GHIDRA_CAST<float *>((&DAT_00c37614 + cellKind * 0x44));
do {
if (*stepEntry == -13.0) {
stepCol = 0xffffffff;
}
else {
stepCol = 0;
if (*stepEntry == 13.0) {
stepCol = 1;
}
}
if (stepEntry[1] == -13.0) {
stepRow = 0xffffffff;
}
else {
stepRow = 0;
if (stepEntry[1] == 13.0) {
stepRow = 1;
}
}
if ((stepCol == dCol) && (stepRow == dRow)) {
return 1;
}
iVar1 = iVar1 + 1;
stepEntry = stepEntry + 2;
} while (iVar1 < *GHIDRA_CAST<int *>((&DAT_00c37610 + cellKind * 0x44)));
}
}
return 0;
}