Files
isaac-port/generated-src/score_sheet.cpp
T
shweetandClaude Opus 5.5 3ce74c6e2d 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>
2026-11-19 21:10:23 -05:00

1052 lines
38 KiB
C++

#include "classes.h"
// 00857220
void ScoreSheet::LoadAnm2()
{
char *pcVar1;
uint uVar2;
std_string leaderboardAnmPath;
std_string scoreAnmPath;
uint local_24;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
puStack_20 = GHIDRA_CAST<undefined1 *>((GHIDRA_INT(register0x00000010) + -4));
local_14 = 0xffffffff;
puStack_18 = &LAB_00b035d5;
local_1c = ExceptionList;
local_24 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U;
ExceptionList = &local_1c;
scoreAnmPath._size = 0;
scoreAnmPath._capacity = 0xf;
scoreAnmPath._buf[0] = '\0';
scoreAnmPath._buf[1] = '\0';
scoreAnmPath._buf[2] = '\0';
scoreAnmPath._buf[3] = '\0';
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(scoreAnmPath._buf)) + 0x0))) = std::_Allocate(0x20);
scoreAnmPath._size = 0x15;
scoreAnmPath._capacity = 0x1f;
builtin_strncpy((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(scoreAnmPath._buf))) + 0x0))),"gfx/ui/ScoreMenu.anm2",0x16);
local_14 = 0;
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((this + 4)))))->ANM2::Load(&scoreAnmPath,1);
local_14 = 0xffffffff;
if (0xf < scoreAnmPath._capacity) {
uVar2 = scoreAnmPath._capacity + 1;
pcVar1 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(scoreAnmPath._buf))) + 0x0)));
if (0xfff < uVar2) {
pcVar1 = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(scoreAnmPath._buf)) + 0x0))) + -4));
uVar2 = scoreAnmPath._capacity + 0x24;
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(scoreAnmPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar1))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pcVar1,uVar2);
}
leaderboardAnmPath._size = 0;
leaderboardAnmPath._capacity = 0xf;
leaderboardAnmPath._buf[0] = '\0';
leaderboardAnmPath._buf[1] = '\0';
leaderboardAnmPath._buf[2] = '\0';
leaderboardAnmPath._buf[3] = '\0';
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(leaderboardAnmPath._buf)) + 0x0))) = std::_Allocate(0x20);
leaderboardAnmPath._size = 0x1b;
leaderboardAnmPath._capacity = 0x1f;
builtin_strncpy((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(leaderboardAnmPath._buf))) + 0x0))),"gfx/ui/LeaderboardMenu.anm2",0x1c);
local_14 = 1;
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((this + 0x49)))))->ANM2::Load(&leaderboardAnmPath,1);
if (0xf < leaderboardAnmPath._capacity) {
uVar2 = leaderboardAnmPath._capacity + 1;
pcVar1 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(leaderboardAnmPath._buf))) + 0x0)));
if (0xfff < uVar2) {
pcVar1 = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(leaderboardAnmPath._buf)) + 0x0))) + -4));
uVar2 = leaderboardAnmPath._capacity + 0x24;
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(leaderboardAnmPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar1))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pcVar1,uVar2);
}
*GHIDRA_CAST<undefined1 *>((this + 0xec)) = 0;
*this = (ScoreSheet)0x1;
this[1] = (ScoreSheet)0x0;
*GHIDRA_CAST<undefined2 *>((this + 0xea)) = 0;
ExceptionList = local_1c;
return;
}
// 009e5300
ScoreSheet::ScoreSheet()
{
this[0x10] = (ScoreSheet)0x0;
this[0x11] = (ScoreSheet)0x0;
this[0x12] = (ScoreSheet)0x0;
this[0x17] = (ScoreSheet)0x0;
this[0x18] = (ScoreSheet)0x0;
this[0x19] = (ScoreSheet)0x0;
this[0x1a] = (ScoreSheet)0x0;
this[0x1b] = (ScoreSheet)0x0;
this[0x1c] = (ScoreSheet)0x0;
this[0x1f] = (ScoreSheet)0x0;
this[0x20] = (ScoreSheet)0x0;
this[0x21] = (ScoreSheet)0x0;
Reset();
return this;
}
// 009e53a0
void ScoreSheet::Reset()
{
int iVar1;
uint buildId;
uint minorVersion;
undefined4 *in_ECX;
char *buildNumberText;
in_ECX[0x18] = in_ECX[0x17];
in_ECX[0x1b] = in_ECX[0x1a];
in_ECX[0x20] = in_ECX[0x1f];
in_ECX[0x11] = in_ECX[0x10];
buildId = DAT_00c5c4dc;
*in_ECX = 0;
in_ECX[1] = 0;
in_ECX[2] = 0;
in_ECX[3] = 0;
in_ECX[4] = 0;
in_ECX[5] = 0;
in_ECX[6] = 0;
in_ECX[7] = 0;
in_ECX[8] = 0;
in_ECX[9] = 0;
in_ECX[10] = 0;
in_ECX[0xb] = 0;
in_ECX[0xc] = 0;
in_ECX[0xd] = 0;
in_ECX[0xe] = 0;
in_ECX[0xf] = 0;
in_ECX[0x13] = 0;
in_ECX[0x14] = 0;
in_ECX[0x15] = 0;
in_ECX[0x16] = 0;
in_ECX[0x1d] = 0;
in_ECX[0x1e] = 0;
*GHIDRA_CAST<undefined1 *>((in_ECX + 0x22)) = 0;
if (buildId == 0xffffffff) {
iVar1 = isdigit(0x4a);
if (iVar1 == 0) {
buildNumberText = "460";
}
else {
buildNumberText = "J460";
}
buildId = atoi(buildNumberText);
iVar1 = atoi("1");
minorVersion = atoi("9");
buildId = (minorVersion | iVar1 << 8) << 0x10 | buildId;
DAT_00c5c4dc = buildId;
}
in_ECX[0x23] = buildId;
return;
}
// 009e54d0
void ScoreSheet::store_state(void *dst)
{
int iVar1;
void *pvVar2;
undefined8 *srcEntry;
int srcOffset;
undefined8 *dstEnd;
pvVar2 = dst;
dst = (void *)0x0;
*GHIDRA_CAST<ScoreSheet *>(pvVar2) = this[0xe];
*GHIDRA_CAST<ScoreSheet *>((GHIDRA_CAST<char *>(pvVar2) + 4)) = this[0xf];
*GHIDRA_CAST<ScoreSheet *>((GHIDRA_CAST<char *>(pvVar2) + 8)) = this[0x13];
*GHIDRA_CAST<ScoreSheet *>((GHIDRA_CAST<char *>(pvVar2) + 0xc)) = this[0x14];
*GHIDRA_CAST<ScoreSheet *>((GHIDRA_CAST<char *>(pvVar2) + 0x10)) = this[0x15];
*GHIDRA_CAST<ScoreSheet *>((GHIDRA_CAST<char *>(pvVar2) + 0x14)) = this[0x16];
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar2) + 0x1c)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar2) + 0x18));
iVar1 = GHIDRA_INT(this[0x18]) - GHIDRA_INT(this[0x17]) >> 0x1f;
if ((GHIDRA_INT(this[0x18]) - GHIDRA_INT(this[0x17])) / 0xc + iVar1 != iVar1) {
srcOffset = 0;
do {
dstEnd = *GHIDRA_CAST<undefined8 **>((GHIDRA_CAST<char *>(pvVar2) + 0x1c));
srcEntry = GHIDRA_CAST<undefined8 *>((GHIDRA_INT(this[0x17]) + srcOffset));
if (dstEnd == *GHIDRA_CAST<undefined8 **>((GHIDRA_CAST<char *>(pvVar2) + 0x20))) {
std::vector<12byte>::_Emplace_reallocate(dstEnd,srcEntry);
}
else {
*dstEnd = *srcEntry;
*GHIDRA_CAST<undefined4 *>((dstEnd + 1)) = *GHIDRA_CAST<undefined4 *>((srcEntry + 1));
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x1c)) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x1c)) + 0xc;
}
srcOffset = srcOffset + 0xc;
dst = (void *)(GHIDRA_INT(dst) + 1);
} while (dst < (void *)((GHIDRA_INT(this[0x18]) - GHIDRA_INT(this[0x17])) / 0xc));
}
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar2) + 0x28)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar2) + 0x24));
dst = (void *)0x0;
iVar1 = GHIDRA_INT(this[0x1b]) - GHIDRA_INT(this[0x1a]) >> 0x1f;
if ((GHIDRA_INT(this[0x1b]) - GHIDRA_INT(this[0x1a])) / 0xc + iVar1 != iVar1) {
srcOffset = 0;
do {
dstEnd = *GHIDRA_CAST<undefined8 **>((GHIDRA_CAST<char *>(pvVar2) + 0x28));
srcEntry = GHIDRA_CAST<undefined8 *>((GHIDRA_INT(this[0x1a]) + srcOffset));
if (dstEnd == *GHIDRA_CAST<undefined8 **>((GHIDRA_CAST<char *>(pvVar2) + 0x2c))) {
std::vector<12byte>::_Emplace_reallocate(dstEnd,srcEntry);
}
else {
*dstEnd = *srcEntry;
*GHIDRA_CAST<undefined4 *>((dstEnd + 1)) = *GHIDRA_CAST<undefined4 *>((srcEntry + 1));
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x28)) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x28)) + 0xc;
}
srcOffset = srcOffset + 0xc;
dst = (void *)(GHIDRA_INT(dst) + 1);
} while (dst < (void *)((GHIDRA_INT(this[0x1b]) - GHIDRA_INT(this[0x1a])) / 0xc));
}
*GHIDRA_CAST<ScoreSheet *>((GHIDRA_CAST<char *>(pvVar2) + 0x30)) = this[0x1d];
*GHIDRA_CAST<ScoreSheet *>((GHIDRA_CAST<char *>(pvVar2) + 0x34)) = this[0x1e];
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar2) + 0x48)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar2) + 0x44));
dst = (void *)0x0;
iVar1 = GHIDRA_INT(this[0x20]) - GHIDRA_INT(this[0x1f]) >> 0x1f;
if ((GHIDRA_INT(this[0x20]) - GHIDRA_INT(this[0x1f])) / 0xc + iVar1 != iVar1) {
srcOffset = 0;
do {
dstEnd = *GHIDRA_CAST<undefined8 **>((GHIDRA_CAST<char *>(pvVar2) + 0x48));
srcEntry = GHIDRA_CAST<undefined8 *>((GHIDRA_INT(this[0x1f]) + srcOffset));
if (dstEnd == *GHIDRA_CAST<undefined8 **>((GHIDRA_CAST<char *>(pvVar2) + 0x4c))) {
std::vector<12byte>::_Emplace_reallocate(dstEnd,srcEntry);
}
else {
*dstEnd = *srcEntry;
*GHIDRA_CAST<undefined4 *>((dstEnd + 1)) = *GHIDRA_CAST<undefined4 *>((srcEntry + 1));
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x48)) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x48)) + 0xc;
}
srcOffset = srcOffset + 0xc;
dst = (void *)(GHIDRA_INT(dst) + 1);
} while (dst < (void *)((GHIDRA_INT(this[0x20]) - GHIDRA_INT(this[0x1f])) / 0xc));
}
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar2) + 0x3c)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar2) + 0x38));
dst = (void *)0x0;
iVar1 = GHIDRA_INT(this[0x11]) - GHIDRA_INT(this[0x10]) >> 0x1f;
if ((GHIDRA_INT(this[0x11]) - GHIDRA_INT(this[0x10])) / 0xc + iVar1 != iVar1) {
srcOffset = 0;
do {
dstEnd = *GHIDRA_CAST<undefined8 **>((GHIDRA_CAST<char *>(pvVar2) + 0x3c));
srcEntry = GHIDRA_CAST<undefined8 *>((GHIDRA_INT(this[0x10]) + srcOffset));
if (dstEnd == *GHIDRA_CAST<undefined8 **>((GHIDRA_CAST<char *>(pvVar2) + 0x40))) {
std::vector<12byte>::_Emplace_reallocate(dstEnd,srcEntry);
}
else {
*dstEnd = *srcEntry;
*GHIDRA_CAST<undefined4 *>((dstEnd + 1)) = *GHIDRA_CAST<undefined4 *>((srcEntry + 1));
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x3c)) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x3c)) + 0xc;
}
srcOffset = srcOffset + 0xc;
dst = (void *)(GHIDRA_INT(dst) + 1);
} while (dst < (void *)((GHIDRA_INT(this[0x11]) - GHIDRA_INT(this[0x10])) / 0xc));
}
return;
}
// 009e5710
void ScoreSheet::restore_state(void *src)
{
int iVar1;
void *pvVar2;
undefined8 *srcEntry;
int iVar3;
int srcOffset;
ScoreSheet dstEnd;
pvVar2 = src;
src = (void *)0x0;
this[0xe] = *GHIDRA_CAST<ScoreSheet *>(pvVar2);
this[0xf] = *GHIDRA_CAST<ScoreSheet *>((GHIDRA_CAST<char *>(pvVar2) + 4));
this[0x13] = *GHIDRA_CAST<ScoreSheet *>((GHIDRA_CAST<char *>(pvVar2) + 8));
this[0x14] = *GHIDRA_CAST<ScoreSheet *>((GHIDRA_CAST<char *>(pvVar2) + 0xc));
this[0x15] = *GHIDRA_CAST<ScoreSheet *>((GHIDRA_CAST<char *>(pvVar2) + 0x10));
this[0x16] = *GHIDRA_CAST<ScoreSheet *>((GHIDRA_CAST<char *>(pvVar2) + 0x14));
this[0x18] = this[0x17];
iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x1c)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x18));
iVar1 = iVar3 >> 0x1f;
if (iVar3 / 0xc + iVar1 != iVar1) {
srcOffset = 0;
do {
dstEnd = this[0x18];
srcEntry = GHIDRA_CAST<undefined8 *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x18)) + srcOffset));
if (dstEnd == this[0x19]) {
std::vector<12byte>::_Emplace_reallocate(dstEnd,srcEntry);
}
else {
*GHIDRA_CAST<undefined8 *>(dstEnd) = *srcEntry;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dstEnd) + 8)) = *GHIDRA_CAST<undefined4 *>((srcEntry + 1));
this[0x18] = (ScoreSheet)(GHIDRA_INT(this[0x18]) + 0xc);
}
srcOffset = srcOffset + 0xc;
src = (void *)(GHIDRA_INT(src) + 1);
} while (src < (void *)((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x1c)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x18))) / 0xc));
}
this[0x1b] = this[0x1a];
src = (void *)0x0;
iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x28)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x24));
iVar1 = iVar3 >> 0x1f;
if (iVar3 / 0xc + iVar1 != iVar1) {
srcOffset = 0;
do {
dstEnd = this[0x1b];
srcEntry = GHIDRA_CAST<undefined8 *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x24)) + srcOffset));
if (dstEnd == this[0x1c]) {
std::vector<12byte>::_Emplace_reallocate(dstEnd,srcEntry);
}
else {
*GHIDRA_CAST<undefined8 *>(dstEnd) = *srcEntry;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dstEnd) + 8)) = *GHIDRA_CAST<undefined4 *>((srcEntry + 1));
this[0x1b] = (ScoreSheet)(GHIDRA_INT(this[0x1b]) + 0xc);
}
srcOffset = srcOffset + 0xc;
src = (void *)(GHIDRA_INT(src) + 1);
} while (src < (void *)((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x28)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x24))) / 0xc));
}
this[0x1d] = *GHIDRA_CAST<ScoreSheet *>((GHIDRA_CAST<char *>(pvVar2) + 0x30));
this[0x1e] = *GHIDRA_CAST<ScoreSheet *>((GHIDRA_CAST<char *>(pvVar2) + 0x34));
this[0x20] = this[0x1f];
src = (void *)0x0;
iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x48)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x44));
iVar1 = iVar3 >> 0x1f;
if (iVar3 / 0xc + iVar1 != iVar1) {
srcOffset = 0;
do {
dstEnd = this[0x20];
srcEntry = GHIDRA_CAST<undefined8 *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x44)) + srcOffset));
if (dstEnd == this[0x21]) {
std::vector<12byte>::_Emplace_reallocate(dstEnd,srcEntry);
}
else {
*GHIDRA_CAST<undefined8 *>(dstEnd) = *srcEntry;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dstEnd) + 8)) = *GHIDRA_CAST<undefined4 *>((srcEntry + 1));
this[0x20] = (ScoreSheet)(GHIDRA_INT(this[0x20]) + 0xc);
}
srcOffset = srcOffset + 0xc;
src = (void *)(GHIDRA_INT(src) + 1);
} while (src < (void *)((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x48)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x44))) / 0xc));
}
this[0x11] = this[0x10];
src = (void *)0x0;
iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x3c)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x38));
iVar1 = iVar3 >> 0x1f;
if (iVar3 / 0xc + iVar1 != iVar1) {
srcOffset = 0;
do {
dstEnd = this[0x11];
srcEntry = GHIDRA_CAST<undefined8 *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x38)) + srcOffset));
if (dstEnd == this[0x12]) {
std::vector<12byte>::_Emplace_reallocate(dstEnd,srcEntry);
}
else {
*GHIDRA_CAST<undefined8 *>(dstEnd) = *srcEntry;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(dstEnd) + 8)) = *GHIDRA_CAST<undefined4 *>((srcEntry + 1));
this[0x11] = (ScoreSheet)(GHIDRA_INT(this[0x11]) + 0xc);
}
srcOffset = srcOffset + 0xc;
src = (void *)(GHIDRA_INT(src) + 1);
} while (src < (void *)((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x3c)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x38))) / 0xc));
}
return;
}
// 009e5960
void ScoreSheet::add_cleared_room(int roomType, int roomShape, int clearCount, byte isFlag)
{
int entryCount;
int entriesLeft;
Game *game;
float in_XMM0_Da;
int entry;
undefined4 uStack_10;
float local_c;
undefined4 local_8;
ScoreSheet entriesEnd;
game = g_game;
local_8 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
if ((clearCount == 1) &&
(find_stage_entry(this,g_game->_stage,g_game->_stageType,
(g_game->_gameStateFlags & 0x1000000000000) != 0), 0.0 < in_XMM0_Da)) {
entry = roomType;
uStack_10 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(uStack_10)) + 0x1))),isFlag);
local_c = in_XMM0_Da;
entryCount = FUN_009e6740(roomShape);
if (0 < entryCount) {
entriesLeft = entryCount;
do {
entriesEnd = this[0x18];
if (entriesEnd == this[0x19]) {
std::vector<12byte>::_Emplace_reallocate(entriesEnd,&entry);
}
else {
*GHIDRA_CAST<ulonglong *>(entriesEnd) = CONCAT44(uStack_10,entry);
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(entriesEnd) + 8)) = local_c;
this[0x18] = (ScoreSheet)(GHIDRA_INT(this[0x18]) + 0xc);
}
entriesLeft = entriesLeft + -1;
} while (entriesLeft != 0);
game = g_game;
}
if ((roomType == 0xb) && (game->_bossChallenge != 0)) {
this[0x1d] = (ScoreSheet)(GHIDRA_INT(this[0x1d]) + entryCount);
}
}
return;
}
// 009e5ab0
void ScoreSheet::add_pickup_points(int variant, int subType, Vector *position)
{
int iVar1;
byte isGFuel;
uint seed;
Entity *pointsText;
int points;
Vector local_1c;
Vector local_14;
void *seedNode;
Game *game;
game = g_game;
if (g_game->_isRoomRespawned == 0) {
points = 0;
if ((variant == 100) && (subType == -1)) {
isGFuel = (GHIDRA_CAST<Seeds *>((&g_game->_seedEffects)))->Seeds::HasSeedEffect(0x4f);
if (isGFuel != 0) {
points = (game->_stage + 4) * 200;
}
}
local_1c.x = 1.10703e-43;
std::set<int>::find_node(&local_14,&local_1c);
if ((((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(seedNode) + 0xd)) == '\0') && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(seedNode) + 0x10)) < 0x50)) &&
(seedNode != (game->_seedEffects)._seedEffects)) &&
(((position->x != g_vectorZero.x || (position->y != g_vectorZero.y)) && (0 < points)))) {
seed = Random();
local_14.x = position->x - 0.0;
local_14.y = position->y - 8.0;
local_1c.x = 0.0;
local_1c.y = -2.0;
pointsText = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(0x2329,2,&local_14,&local_1c,GHIDRA_CAST<Entity *>(0x0),0,seed,0);
iVar1 = *GHIDRA_CAST<int *>(pointsText);
(pointsText->_targetPosition).y = 0.0;
(pointsText->_targetPosition).x = (float)points;
(**(code **)(iVar1 + 0xc))();
}
this[0x14] = (ScoreSheet)(GHIDRA_INT(this[0x14]) + points);
}
return;
}
// 009e5d90
void ScoreSheet::Calculate()
{
Entity_Player *pEVar1;
int iVar2;
int iVar3;
int iVar4;
uint uVar5;
int iVar6;
int iVar7;
ScoreSheet SVar8;
ChallengeParam *challengeParams;
ScoreSheet SVar9;
int stageNum;
float fVar10;
uint uVar11;
char *entryFlag;
int *piVar12;
int *piVar13;
int *piVar14;
undefined1 auVar15 [12];
float decayWeight;
int iVar16;
int iVar17;
float remainingValue;
int iVar18;
int iVar19;
int iVar20;
int iVar21;
float remainingValue;
double dVar23;
int soulHeartsSum;
int redHeartsSum;
int eternalHeartsSum;
int boneHeartsSum;
ScoreSheet local_80;
int parStageCount;
uint local_78;
int local_74;
Entity_Player *local_70;
int *players;
int *playersEnd;
int *playersCapacityEnd;
int *playersBegin;
undefined1 local_59;
undefined4 local_58;
float local_54;
int *local_4c;
int *local_48;
int stageParTimes [9];
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
int local_14;
float chunkScore;
Game *game;
qword gameStateFlags;
char isEntryFlagged;
puStack_20 = GHIDRA_CAST<undefined1 *>((stageParTimes + 0x10));
puStack_18 = &LAB_00b0f92d;
local_1c = ExceptionList;
uVar5 = __security_cookie ^ GHIDRA_UINT((stageParTimes + 0xd));
ExceptionList = &local_1c;
stageParTimes[0] = 0x3c;
stageParTimes[1] = 0x78;
stageParTimes[2] = 0xb4;
stageParTimes[3] = 0xb4;
stageParTimes[4] = 300;
stageParTimes[5] = 300;
stageParTimes[6] = 0x168;
stageParTimes[7] = 0x168;
players = GHIDRA_CAST<int *>(0x0);
playersEnd = GHIDRA_CAST<int *>(0x0);
playersCapacityEnd = GHIDRA_CAST<int *>(0x0);
local_14 = 0;
stageParTimes[8] = uVar5;
if (g_manager->_netplayManager == *GHIDRA_CAST<NetplayManager *>((g_manager + 1))) {
local_70 = (GHIDRA_CAST<Game *>((g_game)))->Game::GetPlayer(0);
}
else {
puStack_20 = GHIDRA_CAST<undefined1 *>((stageParTimes + 0x10));
iVar6 = FUN_0090b070(uVar5);
if (iVar6 == 0) {
local_70 = GHIDRA_CAST<Entity_Player *>(0x0);
}
else {
FUN_0090b070(uVar5);
local_70 = GHIDRA_CAST<Entity_Player *>(FUN_004253d0());
}
}
std::vector<unsigned_int>::_Emplace_reallocate(0,&local_70);
playersBegin = players;
if (*players == 0) goto LAB_009e66e0;
local_48 = *GHIDRA_CAST<int **>((*players + 0x1d98));
if (local_48 != GHIDRA_CAST<int *>(0x0)) {
if (playersEnd == playersCapacityEnd) {
std::vector<unsigned_int>::_Emplace_reallocate(playersEnd,&local_48);
playersBegin = players;
}
else {
*playersEnd = GHIDRA_INT(local_48);
playersEnd = playersEnd + 1;
}
}
local_48 = *GHIDRA_CAST<int **>((*playersBegin + 0x1e68));
local_4c = playersEnd;
if (local_48 != GHIDRA_CAST<int *>(0x0)) {
if (playersEnd == playersCapacityEnd) {
players = playersBegin;
std::vector<unsigned_int>::_Emplace_reallocate(playersEnd,&local_48);
playersBegin = players;
}
else {
*playersEnd = GHIDRA_INT(local_48);
playersEnd = playersEnd + 1;
}
local_48 = *GHIDRA_CAST<int **>((*GHIDRA_CAST<int *>((*playersBegin + 0x1e68)) + 0x1d98));
local_4c = playersEnd;
if (local_48 != GHIDRA_CAST<int *>(0x0)) {
if (playersEnd == playersCapacityEnd) {
players = playersBegin;
std::vector<unsigned_int>::_Emplace_reallocate(playersEnd,&local_48);
playersBegin = players;
}
else {
*playersEnd = GHIDRA_INT(local_48);
playersEnd = playersEnd + 1;
}
local_4c = playersEnd;
}
}
local_48 = *GHIDRA_CAST<int **>((*playersBegin + 0x1e6c));
playersEnd = local_4c;
if (local_48 != GHIDRA_CAST<int *>(0x0)) {
if (local_4c == playersCapacityEnd) {
players = playersBegin;
std::vector<unsigned_int>::_Emplace_reallocate(local_4c,&local_48);
playersBegin = players;
}
else {
*local_4c = GHIDRA_INT(local_48);
playersEnd = local_4c + 1;
}
local_48 = *GHIDRA_CAST<int **>((*GHIDRA_CAST<int *>((*playersBegin + 0x1e6c)) + 0x1d98));
local_4c = playersEnd;
if (local_48 != GHIDRA_CAST<int *>(0x0)) {
if (playersEnd == playersCapacityEnd) {
players = playersBegin;
std::vector<unsigned_int>::_Emplace_reallocate(playersEnd,&local_48);
playersBegin = players;
local_4c = playersEnd;
}
else {
*playersEnd = GHIDRA_INT(local_48);
local_4c = playersEnd + 1;
}
}
}
piVar13 = local_4c;
pEVar1 = GHIDRA_CAST<Entity_Player *>(g_game->_stage);
SVar9 = this[0x16];
if ((SVar9 == (ScoreSheet)0x0) || (local_70 = pEVar1, SVar9 == (ScoreSheet)0x1)) {
local_70 = GHIDRA_CAST<Entity_Player *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(pEVar1[-1])) + 0x2eff))));
}
parStageCount = GHIDRA_INT(&DAT_00000008);
if (GHIDRA_INT(local_70) < 8) {
parStageCount = GHIDRA_INT(local_70);
}
if (((10 < GHIDRA_INT(pEVar1)) || (SVar9 == (ScoreSheet)0x4)) ||
(local_80 = (ScoreSheet)0x0, SVar9 == (ScoreSheet)0x5)) {
local_80 = (ScoreSheet)0x1;
}
*this = (ScoreSheet)0x0;
local_78 = 0;
iVar6 = GHIDRA_INT(this[0x20]) - GHIDRA_INT(this[0x1f]) >> 0x1f;
if ((GHIDRA_INT(this[0x20]) - GHIDRA_INT(this[0x1f])) / 0xc + iVar6 != iVar6) {
iVar6 = 0;
do {
SVar9 = this[0x1f];
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(SVar9) + 8 + iVar6)) == '\0') {
if (*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(SVar9) + iVar6)) < 0xe) {
iVar7 = *GHIDRA_CAST<int *>((&DAT_00b80bd0 + *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(SVar9) + iVar6)) * 4));
}
else {
iVar7 = 0;
}
}
else {
iVar7 = 500;
}
*this = (ScoreSheet)(GHIDRA_INT(*this) + iVar7);
iVar6 = iVar6 + 0xc;
local_78 = local_78 + 1;
} while (local_78 < GHIDRA_UINT(((GHIDRA_INT(this[0x20]) - GHIDRA_INT(SVar9)) / 0xc)));
}
SVar9 = this[0x16];
SVar8 = (ScoreSheet)0x0;
if (SVar9 == (ScoreSheet)0x6) {
SVar8 = (ScoreSheet)0xfa0;
}
this[3] = SVar8;
SVar8 = (ScoreSheet)0x0;
if (SVar9 == (ScoreSheet)0x7) {
SVar8 = (ScoreSheet)0xfa0;
}
this[2] = SVar8;
SVar8 = (ScoreSheet)0x0;
if (SVar9 == (ScoreSheet)0x8) {
SVar8 = (ScoreSheet)0x1a0a;
}
this[4] = SVar8;
game = g_game;
SVar8 = (ScoreSheet)0x0;
if (SVar9 == (ScoreSheet)0xd) {
SVar8 = (ScoreSheet)0x1a0a;
}
this[5] = SVar8;
local_58 = (undefined4)game->_gameStateFlags;
local_59 = (game->_gameStateFlags & 0x200000000) != 0;
local_74 = 0;
redHeartsSum = 0;
iVar6 = 0;
if ((g_game->_gameStateFlags & 0x10000000000) != 0) {
iVar6 = 0x15b3;
}
iVar7 = 0;
if ((bool)local_59) {
iVar7 = 0x115c;
}
soulHeartsSum = 0;
SVar8 = (ScoreSheet)0x0;
this[8] = (ScoreSheet)(iVar6 + iVar7);
eternalHeartsSum = 0;
if (SVar9 == (ScoreSheet)0xb) {
SVar8 = (ScoreSheet)0x1a0a;
}
this[6] = SVar8;
SVar8 = (ScoreSheet)0x0;
if (SVar9 == (ScoreSheet)0xe) {
SVar8 = (ScoreSheet)0x1a0a;
}
this[7] = SVar8;
fVar10 = 0.0;
local_4c = GHIDRA_CAST<int *>(0x0);
boneHeartsSum = 0;
local_48 = playersBegin;
if (playersBegin != piVar13) {
fVar10 = 0.0;
do {
iVar6 = *local_48;
iVar7 = 0x10;
local_78 = 0;
uVar5 = *GHIDRA_CAST<uint *>((iVar6 + 0x1350));
do {
uVar11 = GHIDRA_INT(uVar5) >> 1;
fVar10 = (float)(GHIDRA_INT(fVar10) + (uVar5 & 1));
uVar5 = GHIDRA_INT(uVar5) >> 2;
local_78 = local_78 + (uVar11 & 1);
iVar7 = iVar7 + -1;
} while (iVar7 != 0);
fVar10 = (float)(GHIDRA_INT(fVar10) + local_78);
local_74 = local_74 + *GHIDRA_CAST<int *>((iVar6 + 0x1340));
redHeartsSum = redHeartsSum + *GHIDRA_CAST<int *>((iVar6 + 0x1344));
soulHeartsSum = soulHeartsSum + *GHIDRA_CAST<int *>((iVar6 + 0x134c));
eternalHeartsSum = eternalHeartsSum + *GHIDRA_CAST<int *>((iVar6 + 0x1348));
local_4c = GHIDRA_CAST<int *>((GHIDRA_INT(local_4c) + *GHIDRA_CAST<int *>((iVar6 + 0x194c))));
boneHeartsSum = boneHeartsSum + *GHIDRA_CAST<int *>((iVar6 + 0x1d88));
local_48 = local_48 + 1;
} while (local_48 != piVar13);
local_54 = fVar10;
}
remainingValue = 0.0;
remainingValue =
(float)((double)GHIDRA_INT(this[0x14]) + __uint_to_double_fixup[-(GHIDRA_INT(this[0x14]) >> 0x1f)]);
for (decayWeight = 1.0; (0.0 < remainingValue && (0.001 < decayWeight));
decayWeight = decayWeight * 0.98058254) {
auVar15 = ZEXT812(0x42c80000);
if (remainingValue <= (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(auVar15)) + 0x0)))) {
(*GHIDRA_CAST<undefined8 *>((GHIDRA_CAST<char *>(&(auVar15)) + 0x4))) = (*GHIDRA_CAST<undefined8 *>((GHIDRA_CAST<char *>(&(auVar15)) + 0x4)));
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(auVar15)) + 0x0))) = remainingValue;
}
remainingValue = remainingValue - 100.0;
chunkScore = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(auVar15)) + 0x0))) * decayWeight;
remainingValue = remainingValue + chunkScore + chunkScore;
}
iVar6 = *playersBegin;
this[1] = (ScoreSheet)
(GHIDRA_INT(remainingValue) +
(GHIDRA_INT(local_4c) * 5 +
*GHIDRA_CAST<int *>((iVar6 + 0x1368)) + (*GHIDRA_CAST<int *>((iVar6 + 0x1364)) + *GHIDRA_CAST<int *>((iVar6 + 0x135c))) * 2 +
boneHeartsSum + eternalHeartsSum + GHIDRA_INT(fVar10) + redHeartsSum + soulHeartsSum +
local_74) * 10);
players = playersBegin;
calculate_room_score(this);
local_4c = GHIDRA_CAST<int *>(0x3c);
challengeParams = (GHIDRA_CAST<Game *>((g_game)))->Game::GetChallengeParams();
if ((challengeParams->_pathType == 3) || (this[0x16] == (ScoreSheet)0xe)) {
local_80 = (ScoreSheet)0x0;
parStageCount = GHIDRA_INT(local_70);
if (6 < GHIDRA_INT(local_70)) {
parStageCount = GHIDRA_INT(&DAT_00000006);
}
iVar6 = 0x3c;
local_48 = GHIDRA_CAST<int *>(((GHIDRA_INT(this[0x20]) - GHIDRA_INT(this[0x1f])) / 0xc));
if (local_48 != GHIDRA_CAST<int *>(0x0)) {
entryFlag = GHIDRA_CAST<char *>((GHIDRA_INT(this[0x1f]) + 8));
iVar7 = iVar6;
piVar14 = local_48;
do {
isEntryFlagged = *entryFlag;
entryFlag = entryFlag + 0xc;
iVar6 = iVar7 + 0x4b;
if (isEntryFlagged == '\0') {
iVar6 = iVar7;
}
piVar14 = GHIDRA_CAST<int *>((GHIDRA_INT(piVar14) + -1));
iVar7 = iVar6;
} while (piVar14 != GHIDRA_CAST<int *>(0x0));
local_4c = GHIDRA_CAST<int *>(iVar6);
}
if (this[0x16] == (ScoreSheet)0xe) {
local_4c = GHIDRA_CAST<int *>((iVar6 + 0x1a4));
}
}
piVar14 = GHIDRA_CAST<int *>(0x0);
if ((parStageCount < 1) || (GHIDRA_UINT(parStageCount) < 8)) {
piVar12 = local_4c;
}
else {
uVar5 = parStageCount & 0x80000007;
if (GHIDRA_INT(uVar5) < 0) {
uVar5 = (uVar5 - 1 | 0xfffffff8) + 1;
}
iVar6 = 0;
iVar7 = 0;
iVar16 = 0;
iVar17 = 0;
iVar18 = 0;
iVar19 = 0;
iVar20 = 0;
iVar21 = 0;
do {
iVar6 = iVar6 + stageParTimes[GHIDRA_INT(piVar14)];
iVar7 = iVar7 + stageParTimes[GHIDRA_INT(piVar14) + 1];
iVar16 = iVar16 + stageParTimes[GHIDRA_INT(piVar14) + 2];
iVar17 = iVar17 + stageParTimes[GHIDRA_INT(piVar14) + 3];
piVar12 = piVar14 + 1;
iVar2 = GHIDRA_INT(piVar14) + 5;
iVar3 = GHIDRA_INT(piVar14) + 6;
iVar4 = GHIDRA_INT(piVar14) + 7;
piVar14 = piVar14 + 2;
iVar18 = iVar18 + stageParTimes[GHIDRA_INT(piVar12)];
iVar19 = iVar19 + stageParTimes[iVar2];
iVar20 = iVar20 + stageParTimes[iVar3];
iVar21 = iVar21 + stageParTimes[iVar4];
} while (GHIDRA_INT(piVar14) < GHIDRA_INT((parStageCount - uVar5)));
piVar12 = GHIDRA_CAST<int *>((GHIDRA_INT(local_4c) +
iVar6 + iVar18 + iVar16 + iVar20 + iVar7 + iVar19 + iVar17 + iVar21));
}
local_74 = 0;
if (GHIDRA_INT(piVar14) < parStageCount) {
if (parStageCount - GHIDRA_INT(piVar14) < 2) {
iVar6 = 0;
LAB_009e63f7:
piVar12 = GHIDRA_CAST<int *>((GHIDRA_INT(piVar12) + stageParTimes[GHIDRA_INT(piVar14)]));
}
else {
iVar6 = 0;
local_74 = 0;
do {
iVar6 = iVar6 + stageParTimes[GHIDRA_INT(piVar14)];
local_74 = local_74 + stageParTimes[GHIDRA_INT(piVar14) + 1];
piVar14 = GHIDRA_CAST<int *>((GHIDRA_INT(piVar14) + 2));
} while (GHIDRA_INT(piVar14) < parStageCount + -1);
local_48 = piVar14;
if (GHIDRA_INT(piVar14) < parStageCount) goto LAB_009e63f7;
}
piVar12 = GHIDRA_CAST<int *>((GHIDRA_INT(piVar12) + iVar6 + local_74));
}
iVar6 = GHIDRA_INT(piVar12) + GHIDRA_INT(local_80) * 0x1a4;
SVar9 = this[0x16];
if (((SVar9 == (ScoreSheet)0x6) || (SVar9 == (ScoreSheet)0x7)) || (SVar9 == (ScoreSheet)0x8)) {
iVar6 = iVar6 + 0x1a4;
}
gameStateFlags = g_game->_gameStateFlags;
this[0xb] = (ScoreSheet)0x0;
local_54 = (float)(iVar6 + 0xf0);
if ((gameStateFlags & 0x200000000) == 0) {
local_54 = (float)iVar6;
}
if (local_54 == 0.0) {
SVar9 = (ScoreSheet)0x0;
local_54 = 0.0;
}
else {
fVar10 = log_precise(0.8);
fVar10 = (fVar10 * ((float)g_game->_timeCounter / 30.0)) /
(float)((double)GHIDRA_INT(local_54) + __uint_to_double_fixup[-(GHIDRA_INT(local_54) >> 0x1f)]);
FUN_007df1e0();
local_54 = (1.0 - fVar10) *
(float)(GHIDRA_INT(this[7]) + GHIDRA_INT(this[2]) + GHIDRA_INT(*this) + GHIDRA_INT(this[4]) + GHIDRA_INT(this[8]) +
GHIDRA_INT(this[5]) + GHIDRA_INT(this[6]) + GHIDRA_INT(this[3])) * 0.8;
dVar23 = ceil((double)local_54);
local_54 = (float)dVar23;
SVar9 = (ScoreSheet)GHIDRA_INT(dVar23);
}
this[0xb] = SVar9;
piVar12 = GHIDRA_CAST<int *>(0x0);
local_48 = GHIDRA_CAST<int *>(0x0);
piVar14 = playersBegin;
if (playersBegin != piVar13) {
do {
iVar6 = *piVar14;
piVar14 = piVar14 + 1;
piVar12 = GHIDRA_CAST<int *>((GHIDRA_INT(piVar12) + *GHIDRA_CAST<int *>((iVar6 + 0x16b4))));
} while (piVar14 != piVar13);
local_48 = piVar12;
}
fVar10 = log_precise(0.8);
remainingValue = ((float)((double)GHIDRA_INT(local_48) + __uint_to_double_fixup[-(GHIDRA_INT(local_48) >> 0x1f)]) *
fVar10) / 12.0;
FUN_007df1e0();
local_54 = (1.0 - remainingValue) * (float)GHIDRA_INT(this[9]) * 0.8;
dVar23 = ceil((double)local_54);
local_54 = (float)dVar23;
local_80 = (ScoreSheet)thunk_FUN_00af0780();
stageNum = GHIDRA_INT(local_70);
if (this[0x16] == (ScoreSheet)0xe) {
stageNum = 7;
}
this[10] = local_80;
this[0xc] = (ScoreSheet)0x0;
SVar9 = (ScoreSheet)0x0;
remainingValue = (float)stageNum * 2.5;
if (remainingValue <= 1.0) {
remainingValue = 1.0;
}
if (remainingValue <= 0.0) {
SVar8 = this[1];
}
else {
local_48 = GHIDRA_CAST<int *>(0x0);
piVar14 = playersBegin;
if (playersBegin != piVar13) {
do {
iVar6 = 0;
piVar12 = *GHIDRA_CAST<int **>((*piVar14 + 0x16c8));
for (iVar7 = *GHIDRA_CAST<int *>((*piVar14 + 0x16cc)) - GHIDRA_INT(piVar12) >> 2; iVar7 != 0; iVar7 = iVar7 + -1
) {
iVar6 = iVar6 + *piVar12;
piVar12 = piVar12 + 1;
}
piVar14 = piVar14 + 1;
local_48 = GHIDRA_CAST<int *>((GHIDRA_INT(local_48) + iVar6));
} while (piVar14 != piVar13);
local_80 = this[10];
}
SVar8 = this[1];
remainingValue = ((float)((double)GHIDRA_INT(local_48) + __uint_to_double_fixup[-(GHIDRA_INT(local_48) >> 0x1f)]) *
fVar10) / remainingValue;
FUN_007df1e0();
local_54 = (1.0 - remainingValue) * (float)GHIDRA_INT(SVar8) * 0.8;
dVar23 = ceil((double)local_54);
local_54 = (float)dVar23;
SVar9 = (ScoreSheet)thunk_FUN_00af0780();
this[0xc] = SVar9;
}
this[0xd] = (ScoreSheet)
((((GHIDRA_INT(this[7]) - GHIDRA_INT(SVar9)) - GHIDRA_INT(local_80)) - GHIDRA_INT(this[0xb])) + GHIDRA_INT(this[2]) +
GHIDRA_INT(*this) + GHIDRA_INT(this[4]) + GHIDRA_INT(this[8]) + GHIDRA_INT(this[5]) + GHIDRA_INT(SVar8) + GHIDRA_INT(this[9]) +
GHIDRA_INT(this[6]) + GHIDRA_INT(this[3]));
LAB_009e66e0:
if (playersBegin != GHIDRA_CAST<int *>(0x0)) {
uVar5 = GHIDRA_INT(playersCapacityEnd) - GHIDRA_INT(playersBegin) & 0xfffffffc;
piVar13 = playersBegin;
if (0xfff < uVar5) {
piVar13 = GHIDRA_CAST<int *>(playersBegin[-1]);
uVar5 = uVar5 + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(playersBegin) + (-4 - GHIDRA_INT(piVar13))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(piVar13,uVar5);
}
ExceptionList = local_1c;
return;
}
// 009e6780
void ScoreSheet::calculate_room_score()
{
ScoreSheet SVar1;
int iVar2;
int entryOffset;
ScoreSheet score;
float multiplier;
uint i;
int bonusTotal;
Game *game;
uint gameStateFlagsHigh;
entryOffset = 0;
bonusTotal = 0;
i = 0;
this[9] = (ScoreSheet)0x0;
score = (ScoreSheet)0x0;
SVar1 = this[0x1a];
iVar2 = GHIDRA_INT(this[0x1b]) - GHIDRA_INT(SVar1) >> 0x1f;
if ((GHIDRA_INT(this[0x1b]) - GHIDRA_INT(SVar1)) / 0xc + iVar2 != iVar2) {
do {
score = this[9];
multiplier = *GHIDRA_CAST<float *>((entryOffset + 8 + GHIDRA_INT(SVar1)));
if (*GHIDRA_CAST<char *>((entryOffset + 4 + GHIDRA_INT(SVar1))) == '\0') {
iVar2 = FUN_009e69c0(*GHIDRA_CAST<undefined4 *>((entryOffset + GHIDRA_INT(SVar1))),0);
score = (ScoreSheet)(GHIDRA_INT(score) + GHIDRA_INT(((float)iVar2 * multiplier)));
this[9] = score;
}
else {
iVar2 = FUN_009e69c0(*GHIDRA_CAST<undefined4 *>((entryOffset + GHIDRA_INT(SVar1))),0);
bonusTotal = bonusTotal + GHIDRA_INT(((float)iVar2 * multiplier));
}
entryOffset = entryOffset + 0xc;
i = i + 1;
} while (i < GHIDRA_UINT(((GHIDRA_INT(this[0x1b]) - GHIDRA_INT(SVar1)) / 0xc)));
}
SVar1 = this[0x17];
i = 0;
iVar2 = GHIDRA_INT(this[0x18]) - GHIDRA_INT(SVar1) >> 0x1f;
if ((GHIDRA_INT(this[0x18]) - GHIDRA_INT(SVar1)) / 0xc + iVar2 != iVar2) {
iVar2 = 0;
do {
score = this[9];
multiplier = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(SVar1) + 8 + iVar2));
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(SVar1) + 4 + iVar2)) == '\0') {
entryOffset = FUN_009e69c0(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(SVar1) + iVar2)),1);
score = (ScoreSheet)(GHIDRA_INT(score) + GHIDRA_INT(((float)entryOffset * multiplier)));
this[9] = score;
}
else {
entryOffset = FUN_009e69c0(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(SVar1) + iVar2)),1);
bonusTotal = bonusTotal + GHIDRA_INT(((float)entryOffset * multiplier));
}
iVar2 = iVar2 + 0xc;
i = i + 1;
} while (i < GHIDRA_UINT(((GHIDRA_INT(this[0x18]) - GHIDRA_INT(SVar1)) / 0xc)));
}
if (1999 < bonusTotal) {
*GHIDRA_CAST<undefined1 *>((this + 0x22)) = 1;
}
game = g_game;
iVar2 = 2000;
if (bonusTotal < 2000) {
iVar2 = bonusTotal;
}
score = (ScoreSheet)
((GHIDRA_INT(this[0x1e]) * 3 + GHIDRA_INT(this[0x1d])) * 100 + iVar2 + GHIDRA_INT(this[0x15]) + GHIDRA_INT(score));
this[9] = score;
gameStateFlagsHigh = *GHIDRA_CAST<uint *>((GHIDRA_INT(&game->_gameStateFlags) + 4));
if ((gameStateFlagsHigh & 0x40) != 0) {
score = (ScoreSheet)(GHIDRA_INT(score) + 1000);
this[9] = score;
gameStateFlagsHigh = *GHIDRA_CAST<uint *>((GHIDRA_INT(&game->_gameStateFlags) + 4));
}
if ((gameStateFlagsHigh & 0x80) != 0) {
this[9] = (ScoreSheet)(GHIDRA_INT(score) + 1000);
}
return;
}
// 009e6940
void * ScoreSheet::find_stage_entry(int stage, int stageType, byte isFlag)
{
int iVar1;
byte *entry;
int iVar2;
uint entryCount;
uint index;
index = 0;
iVar2 = GHIDRA_INT(this[0x11]) - GHIDRA_INT(this[0x10]);
entry = GHIDRA_CAST<byte *>((iVar2 * 0x2aaaaaab));
iVar1 = iVar2 >> 0x1f;
iVar2 = iVar2 / 0xc + iVar1;
entryCount = iVar2 - iVar1;
if (iVar2 != iVar1) {
entry = GHIDRA_CAST<byte *>((GHIDRA_INT(this[0x10]) + 8));
while (((*GHIDRA_CAST<int *>((entry + -8)) != stage || (*GHIDRA_CAST<int *>((entry + -4)) != stageType)) ||
(*entry != isFlag))) {
index = index + 1;
entry = entry + 0xc;
if (entryCount <= index) {
return entry;
}
}
if (entryCount == 1) {
return entry;
}
}
return entry;
}