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:
1 parent
2ff2d5d87f
commit
3ce74c6e2d
331 files changed
+485
-7835
No files matched your search
@@ -0,0 +1,127 @@
|
||||
#include "classes.h"
|
||||
|
||||
// 004212c0
|
||||
void BossOverlay::update()
|
||||
{
|
||||
byte isEndTriggered;
|
||||
int *in_ECX;
|
||||
int *counter;
|
||||
Game *game;
|
||||
Manager *manager;
|
||||
SoundEffects *sfxManager;
|
||||
|
||||
if (*in_ECX != 0) {
|
||||
if ((*in_ECX == 1) &&
|
||||
(((in_ECX[0xf] == 0 || ((char)in_ECX[0x13] == '\0')) &&
|
||||
((char)in_ECX[(in_ECX[1] + 6) * 0xe] == '\0')))) {
|
||||
*in_ECX = 0;
|
||||
}
|
||||
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(in_ECX) + 0x111)) != '\0') {
|
||||
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((in_ECX + 0xe)))))->AnimationState::Update();
|
||||
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((in_ECX + 0x16)))))->AnimationState::Update();
|
||||
}
|
||||
if (in_ECX[1] == 3) {
|
||||
if (in_ECX[0xf] != 0) {
|
||||
isEndTriggered =
|
||||
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((in_ECX + 0xe)))))->AnimationState::IsEventTriggered(&DAT_00b1c00c);
|
||||
manager = g_manager;
|
||||
if (isEndTriggered != 0) {
|
||||
sfxManager = &g_manager->_sfxManager;
|
||||
counter = (g_manager->_persistentGameData)._cutsceneCounters + 0x19;
|
||||
*counter = *counter + 1;
|
||||
*GHIDRA_CAST<undefined1 *>(&manager->_persistentGameData) = 1;
|
||||
counter = (manager->_persistentGameData)._cutsceneCounters + 2;
|
||||
*counter = *counter + 1;
|
||||
*GHIDRA_CAST<undefined1 *>(&manager->_persistentGameData) = 1;
|
||||
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&((manager->_cutsceneManager))) + 0x848))) = 1;
|
||||
(manager->_cutsceneManager)._isQueuedCleanup = 0;
|
||||
manager->_cutsceneNextMenuState = 1;
|
||||
(manager->_cutsceneManager)._queuedCutsceneId = 0x19;
|
||||
(manager->_achievementOverlay)._isPopupBlocked = 1;
|
||||
if ((manager->_sfxManager)._volumeModifier != 1.0) {
|
||||
(manager->_sfxManager)._volumeModifier = 1.0;
|
||||
(GHIDRA_CAST<SoundEffects *>((sfxManager)))->SoundEffects::ClearVolumeModifier();
|
||||
}
|
||||
game = g_game;
|
||||
(manager->_sfxManager)._volumeModifierStep = 0.005;
|
||||
Game::StartRoomTransition(game,-10,-1,1,GHIDRA_CAST<Entity_Player *>(0x0),-1);
|
||||
(GHIDRA_CAST<RoomTransition *>((&g_game->_roomTransition)))->RoomTransition::Update();
|
||||
return;
|
||||
}
|
||||
if ((in_ECX[0xf] != 0) && ((char)in_ECX[0x13] != '\0')) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
*in_ECX = 0;
|
||||
in_ECX[1] = 0;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 004214b0
|
||||
void BossOverlay::play(int overlayType)
|
||||
{
|
||||
void *sprite = this;
|
||||
byte bVar1;
|
||||
LayerState *layer;
|
||||
byte *currentName;
|
||||
uint compareResult;
|
||||
byte unk;
|
||||
byte *targetName;
|
||||
byte *anim;
|
||||
bool isLess;
|
||||
byte *animData;
|
||||
ANM2 *sprite;
|
||||
|
||||
if (4 < GHIDRA_UINT(overlayType)) {
|
||||
return;
|
||||
}
|
||||
sprite = GHIDRA_CAST<ANM2 *>((GHIDRA_INT(sprite) + 8));
|
||||
(GHIDRA_CAST<ANM2 *>((sprite)))->ANM2::Load(GHIDRA_CAST<std_string *>((GHIDRA_INT(sprite) + overlayType * 0x38 + 0x120)),1);
|
||||
(GHIDRA_CAST<ANM2 *>((sprite)))->ANM2::LoadGraphics(unk);
|
||||
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sprite) + 4)) = overlayType;
|
||||
if ((overlayType == 2) || (overlayType == 3)) {
|
||||
layer = (GHIDRA_CAST<ANM2 *>((sprite)))->ANM2::GetLayer(&DAT_00000004);
|
||||
layer->_bitflags = layer->_bitflags | 0x20;
|
||||
}
|
||||
anim = GHIDRA_CAST<byte *>((GHIDRA_INT(sprite) + overlayType * 0x38 + 0x138));
|
||||
if (0xf < *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(sprite) + overlayType * 0x38 + 0x14c))) {
|
||||
anim = *GHIDRA_CAST<byte **>(anim);
|
||||
}
|
||||
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sprite) + 0x3c)) != 0) {
|
||||
animData = *GHIDRA_CAST<byte **>((GHIDRA_CAST<char *>(sprite) + 0x3c));
|
||||
currentName = animData;
|
||||
if (0xf < *GHIDRA_CAST<uint *>((animData + 0x14))) {
|
||||
currentName = *GHIDRA_CAST<byte **>(animData);
|
||||
}
|
||||
targetName = anim;
|
||||
do {
|
||||
bVar1 = *currentName;
|
||||
isLess = bVar1 < *targetName;
|
||||
if (bVar1 != *targetName) {
|
||||
LAB_00421555:
|
||||
compareResult = -GHIDRA_UINT(isLess) | 1;
|
||||
goto LAB_0042155a;
|
||||
}
|
||||
if (bVar1 == 0) break;
|
||||
bVar1 = currentName[1];
|
||||
isLess = bVar1 < targetName[1];
|
||||
if (bVar1 != targetName[1]) goto LAB_00421555;
|
||||
currentName = currentName + 2;
|
||||
targetName = targetName + 2;
|
||||
} while (bVar1 != 0);
|
||||
compareResult = 0;
|
||||
LAB_0042155a:
|
||||
if ((compareResult == 0) && ((animData[0x34] == 0 || (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(sprite) + 0x4c)) != '\0'))))
|
||||
goto LAB_00421582;
|
||||
}
|
||||
bVar1 = (GHIDRA_CAST<ANM2 *>((sprite)))->ANM2::SetAnimation(anim,1);
|
||||
if (bVar1 != 0) {
|
||||
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((GHIDRA_INT(sprite) + 0x38)))))->AnimationState::Rewind();
|
||||
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(sprite) + 0x4c)) = 1;
|
||||
}
|
||||
LAB_00421582:
|
||||
*GHIDRA_CAST<undefined4 *>(sprite) = 1;
|
||||
return;
|
||||
}
|
||||
Reference in new issue
Block a user