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

+108
View File
@@ -0,0 +1,108 @@
#include "classes.h"
// 00431310
void EntityRef::constructor(Entity *entity)
{
float copyX;
uint weaknessBit;
float copyY;
uint friendlyBit;
uint charmedBit;
if (entity == GHIDRA_CAST<Entity *>(0x0)) {
this->_type = 0;
this->_variant = 0;
this->_spawnerType = 0;
this->_spawnerVariant = 0;
copyX = g_vectorZero.x;
copyY = g_vectorZero.y;
}
else {
this->_type = entity->_type;
this->_variant = entity->_variant;
this->_spawnerType = entity->_spawnerType;
this->_spawnerVariant = entity->_spawnerVariant;
copyX = (entity->_pos).x;
copyY = (entity->_pos).y;
}
(this->_position).x = copyX;
(this->_position).y = copyY;
if (entity == GHIDRA_CAST<Entity *>(0x0)) {
copyX = g_vectorZero.x;
copyY = g_vectorZero.y;
}
else {
copyX = (entity->_velocity).x;
copyY = (entity->_velocity).y;
}
(this->_velocity).x = copyX;
(this->_velocity).y = copyY;
if ((entity == GHIDRA_CAST<Entity *>(0x0)) || ((entity->_flags & 0x100) == 0)) {
charmedBit = 0;
if (entity != GHIDRA_CAST<Entity *>(0x0)) goto LAB_004313dc;
charmedBit = 0;
LAB_004313f5:
friendlyBit = 0;
if (entity != GHIDRA_CAST<Entity *>(0x0)) goto LAB_004313fb;
}
else {
charmedBit = 1;
LAB_004313dc:
if ((entity->_flags & 0x20000000) == 0) goto LAB_004313f5;
friendlyBit = 2;
LAB_004313fb:
if ((entity->_flags & 0x40000000000000) != 0) {
weaknessBit = 4;
goto LAB_00431416;
}
}
weaknessBit = 0;
LAB_00431416:
this->_entity = entity;
this->_flags = weaknessBit | friendlyBit | charmedBit;
return;
}
// 00435c70
EntityRef::EntityRef()
{
this->_type = 0;
this->_variant = 0;
this->_spawnerType = 0;
this->_spawnerVariant = 0;
(this->_position).x = g_vectorZero.x;
(this->_position).y = g_vectorZero.y;
(this->_velocity).x = g_vectorZero.x;
(this->_velocity).y = g_vectorZero.y;
this->_flags = 0;
this->_entity = (void *)0x0;
return this;
}
// 00499960
EntityRef * EntityRef::operator_(EntityRef *other)
{
this->_type = other->_type;
this->_variant = other->_variant;
this->_spawnerType = other->_spawnerType;
this->_spawnerVariant = other->_spawnerVariant;
(this->_position).x = (other->_position).x;
(this->_position).y = (other->_position).y;
(this->_velocity).x = (other->_velocity).x;
(this->_velocity).y = (other->_velocity).y;
this->_flags = other->_flags;
this->_entity = other->_entity;
return this;
}
// 004a2910
uint EntityRef::IsFriendly()
{
return CONCAT31((uint3)(GHIDRA_UINT(this->_flags) >> 9),(char)(GHIDRA_UINT(this->_flags) >> 1)) & 0xffffff01;
}
// 004bc670
byte EntityRef::IsCharmed()
{
return (byte)this->_flags & 1;
}