Curation round 25 (code only): the ultra horsemen and the Beast's background, the Scourge and Polty, the player's last gaps with the frame gate removed, game core, debug and daily, local co-op and player-controlled enemies, TMTRAINER, local versus, the vanilla Lua API, the special-daily fix, shared constants folded (60 duplicates, 10 offline gaps)

This commit is contained in:
shweet committed 2026-11-23 07:35:21 -05:00
1 parent 534339a496
commit 5c89798773
280 files changed
+14904 -5309

No files matched your search

-363
View File
@@ -104,78 +104,6 @@ LAB_00499c40:
goto LAB_00499ba3;
}
// 0055d070
uint8_t NpcHelper::polty_target_set(int gridIndex)
{
if (((gridIndex < 0) || (0x1bf < gridIndex)) ||
(*GHIDRA_CAST<short *>((GHIDRA_CAST<char *>(g_game->_room) + gridIndex * 2 + 0xe6c)) < 1)) {
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0xbc4)) = gridIndex;
return 1;
}
return 0;
}
// 0055d0b0
uint8_t NpcHelper::polty_is_target_liftable(Entity_NPC *npc)
{
uint8_t local_AL_113;
int extraout_EDX;
float snapY;
int gridWidth;
Room *room;
gridWidth = npc->_spawnerEntity;
if ((gridWidth == 0) || (*GHIDRA_CAST<int *>((gridWidth + 0x28)) != 5)) {
if (npc->_i2 < 0) {
return 0;
}
room = g_game->_room;
local_AL_113 = Room::CanPickupGridEntity(room,npc->_i2);
if (local_AL_113 == 0) {
return 0;
}
if (npc->_variant == 1) {
return 1;
}
gridWidth = room->_gridWidth;
snapY = (float)(extraout_EDX / gridWidth) * 40.0 + 120.0;
(npc->_pos).x = (float)(extraout_EDX % gridWidth) * 40.0 + 40.0;
}
else {
snapY = *GHIDRA_CAST<float *>((gridWidth + 0x340));
(npc->_pos).x = *GHIDRA_CAST<float *>((gridWidth + 0x33c));
}
(npc->_pos).y = snapY;
(npc->_velocity).x = g_vectorZero.x;
(npc->_velocity).y = g_vectorZero.y;
return 1;
}
// 0055d180
uint8_t NpcHelper::polty_is_pot_cell(Entity_NPC *npc, int gridIndex)
{
uint8_t bVar1;
Game *game;
int gridWidth;
game = g_game;
if (GHIDRA_UINT(gridIndex) < 0x1c0) {
gridWidth = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + gridIndex * 4 + 0x24));
if ((gridWidth != 0) &&
(((*GHIDRA_CAST<int *>((gridWidth + 4)) == 6 || (*GHIDRA_CAST<int *>((gridWidth + 4)) == 0x1a)) &&
(*GHIDRA_CAST<int *>((gridWidth + 0xc)) == 1)))) {
bVar1 = polty_target_set(npc,gridIndex);
if (bVar1 != 0) {
gridWidth = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(game->_room) + 0xc));
(npc->_pos).x = (float)(gridIndex % gridWidth) * 40.0 + 40.0;
(npc->_pos).y = (float)(gridIndex / gridWidth) * 40.0 + 120.0;
return 1;
}
}
}
return 0;
}
// 005688c0
void NpcHelper::mother_set_collision_class(Entity_NPC *npc, int collisionClass)
{
@@ -209,297 +137,6 @@ void NpcHelper::mother_set_collision_class(Entity_NPC *npc, int collisionClass)
return;
}
// 00582f60
void NpcHelper::scourge_whip(Entity_NPC *npc)
{
uint8_t bVar1;
uint8_t *animNameCursor;
uint32_t uVar2;
Entity_NPC *segment;
uint8_t *targetNameCursor;
uint8_t *anim;
bool isLess;
Entity_NPC *local_c;
float pitch;
uint8_t *animData;
Manager *manager;
Entity_NPC *nextSegment;
segment = npc;
while (((nextSegment = GHIDRA_CAST<Entity_NPC *>(segment->_child), nextSegment != GHIDRA_CAST<Entity_NPC *>(0x0) &&
(nextSegment->_type == 0x38d)) && (nextSegment->_variant == 10))) {
segment = nextSegment;
}
segment->_state = 7;
(segment->_targetPosition).x = g_vectorZero.x;
(segment->_targetPosition).y = g_vectorZero.y;
segment = npc;
while (((nextSegment = GHIDRA_CAST<Entity_NPC *>(segment->_parent), nextSegment != GHIDRA_CAST<Entity_NPC *>(0x0) &&
(nextSegment->_type == 0x38d)) && (nextSegment->_variant == 10))) {
segment = nextSegment;
}
animData = (segment->_sprite)._animState._animData;
anim = &DAT_00b62058;
if (npc->_subtype == 0) {
anim = &DAT_00b6208c;
}
local_c = npc;
if (animData != GHIDRA_CAST<uint8_t *>(0x0)) {
animNameCursor = animData;
if (0xf < *GHIDRA_CAST<uint32_t *>((animData + 0x14))) {
animNameCursor = *GHIDRA_CAST<uint8_t **>(animData);
}
targetNameCursor = anim;
do {
bVar1 = *animNameCursor;
isLess = bVar1 < *targetNameCursor;
if (bVar1 != *targetNameCursor) {
LAB_00583024:
uVar2 = -GHIDRA_UINT(isLess) | 1;
goto LAB_00583029;
}
if (bVar1 == 0) break;
bVar1 = animNameCursor[1];
isLess = bVar1 < targetNameCursor[1];
if (bVar1 != targetNameCursor[1]) goto LAB_00583024;
animNameCursor = animNameCursor + 2;
targetNameCursor = targetNameCursor + 2;
} while (bVar1 != 0);
uVar2 = 0;
LAB_00583029:
if ((uVar2 == 0) && ((animData[0x34] == 0 || ((segment->_sprite)._animState._isPlaying != 0))))
goto LAB_00583051;
}
bVar1 = ANM2::SetAnimation(&segment->_sprite,anim,1);
if (bVar1 != 0) {
AnimationState::Rewind(&(segment->_sprite)._animState);
(segment->_sprite)._animState._isPlaying = 1;
}
LAB_00583051:
manager = g_manager;
pitch = 1.0;
if (local_c->_championColorIdx == 0x12) {
pitch = 1.5;
}
else if (local_c->_championColorIdx == 0x13) {
pitch = 0.5;
}
local_c = GHIDRA_CAST<Entity_NPC *>(0x48);
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_c));
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_c),1.0,2,0,pitch,0.0);
return;
}
// 00587480
void NpcHelper::scourge_chain_shoot()
{
Entity *pEVar1;
uint32_t rngResult;
Entity_NPC *in_ECX;
int chainEnd;
float fVar2;
float fVar3;
float fVar4;
float fVar5;
Vector effectPos;
Vector projVelocity;
float local_ec;
float local_e8;
Vector shootPos;
float local_dc;
float soundPitch;
float childChainOffsetY;
float childChainOffsetX;
float local_cc;
float local_c8;
float local_c4;
uint8_t projParams [4];
float fStack_bc;
float fStack_b8;
float fStack_b4;
float fStack_b0;
float fStack_ac;
float fStack_a8;
float fStack_a4;
float fStack_a0;
float fStack_9c;
float fStack_98;
float fStack_94;
float fStack_90;
float fStack_8c;
float fStack_88;
float fStack_84;
float fStack_80;
float fStack_7c;
float fStack_78;
float afStack_74 [2];
float fStack_6c;
uint32_t uStack_68;
uint32_t uStack_64;
float fStack_60;
float fStack_5c;
float fStack_58;
float fStack_54;
float fStack_50;
float fStack_4c;
float fStack_48;
int iStack_44;
uint64_t qStack_40;
float fStack_38;
int iStack_34;
float fStack_30;
int iStack_2c;
uint8_t local_28;
uint8_t *local_24;
uint32_t local_20;
uint8_t local_1c;
float local_14;
Manager *manager;
int nextSegment;
local_14 = (float)(__security_cookie ^ GHIDRA_UINT((afStack_74 + 0x19)));
chainEnd = in_ECX->_child;
while (((nextSegment = *GHIDRA_CAST<int *>((chainEnd + 0x3c0)), nextSegment != 0 &&
(*GHIDRA_CAST<int *>((nextSegment + 0x28)) == 0x38d)) && (*GHIDRA_CAST<int *>((nextSegment + 0x2c)) == 10))) {
chainEnd = nextSegment;
}
local_e8 = (in_ECX->_pos).x;
local_ec = (in_ECX->_pos).y;
childChainOffsetX = *GHIDRA_CAST<float *>((chainEnd + 0x33c)) - local_e8;
childChainOffsetY = *GHIDRA_CAST<float *>((chainEnd + 0x340)) - local_ec;
chainEnd = in_ECX->_entityRef;
while (((nextSegment = *GHIDRA_CAST<int *>((chainEnd + 0x3c0)), nextSegment != 0 &&
(*GHIDRA_CAST<int *>((nextSegment + 0x28)) == 0x38d)) && (*GHIDRA_CAST<int *>((nextSegment + 0x2c)) == 10))) {
chainEnd = nextSegment;
}
local_e8 = *GHIDRA_CAST<float *>((chainEnd + 0x33c)) - local_e8;
local_ec = *GHIDRA_CAST<float *>((chainEnd + 0x340)) - local_ec;
pEVar1 = Entity_NPC::GetPlayerTarget(in_ECX);
local_c8 = local_e8 - childChainOffsetX;
local_cc = (pEVar1->_pos).y - (in_ECX->_pos).y;
local_dc = (pEVar1->_pos).x - (in_ECX->_pos).x;
local_c4 = local_ec - childChainOffsetY;
fVar2 = sqrtf(local_c4 * local_c4 + local_c8 * local_c8);
soundPitch = 1.0;
fVar3 = local_c8;
fVar4 = local_c4;
if (0.0 < fVar2) {
fVar3 = local_c8 * (1.0 / fVar2);
fVar4 = local_c4 * (1.0 / fVar2);
}
fVar2 = -childChainOffsetY * fVar4 - childChainOffsetX * fVar3;
fVar4 = fVar2 * fVar4 + childChainOffsetY;
fVar3 = fVar2 * fVar3 + childChainOffsetX;
fVar2 = fVar4 * local_cc;
local_cc = 0.0;
local_dc = (fVar2 + fVar3 * local_dc) / (fVar4 * fVar4 + fVar3 * fVar3);
do {
fVar3 = local_cc;
rngResult = Random();
if (rngResult % 5 == 0) {
fVar4 = local_dc;
}
else {
rngResult = Random();
fVar4 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) *
2.3283064e-10;
}
shootPos.x = (in_ECX->_pos).x;
shootPos.y = (in_ECX->_pos).y;
fVar2 = childChainOffsetX * fVar4 + shootPos.x;
fVar5 = childChainOffsetY * fVar4 + shootPos.y;
shootPos.x = local_e8 * fVar4 + shootPos.x;
shootPos.y = local_ec * fVar4 + shootPos.y;
if (fVar3 == 0.0) {
local_c4 = fVar2 - shootPos.x;
local_c8 = fVar5 - shootPos.y;
}
else {
local_c4 = shootPos.x - fVar2;
local_c8 = shootPos.y - fVar5;
shootPos.x = fVar2;
shootPos.y = fVar5;
}
fVar3 = sqrtf(local_c4 * local_c4 + local_c8 * local_c8);
if (0.0 < fVar3) {
local_c4 = (1.0 / fVar3) * local_c4;
local_c8 = local_c8 * (1.0 / fVar3);
}
projParams[0] = 1;
fStack_bc = 0.0;
fStack_b8 = 0.0;
fStack_b4 = 0.0;
fStack_b0 = 1.0;
fStack_ac = 1.0;
rngResult = Random();
fStack_60 = g_vectorZero.x;
fStack_58 = g_vectorZero.x;
fStack_50 = g_vectorZero.x;
fStack_48 = -1000.0;
iStack_44 = 0;
fStack_38 = 0.0;
iStack_34 = 0x1e;
fStack_5c = g_vectorZero.y;
fStack_54 = g_vectorZero.y;
fStack_4c = g_vectorZero.y;
fStack_30 = 0.0;
iStack_2c = 0;
local_28 = 0;
local_24 = &DAT_bf800000;
local_20 = 0;
local_1c = 0;
fStack_6c = DAT_00c34cf0;
uStack_68 = 0x2000;
fStack_a8 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)])
* 2.3283064e-10 * 3.1415927;
uStack_64 = 0;
fStack_a4 = 1.0;
fStack_a0 = 0.005;
fStack_9c = 1.01;
fStack_98 = 1.0;
qStack_40 = 0;
fStack_bc = fStack_bc + 10.0;
fStack_b4 = fStack_b4 - 0.14;
fStack_94 = _DAT_00c34cc8;
fStack_90 = fRam00c34ccc;
fStack_8c = fRam00c34cd0;
fStack_88 = fRam00c34cd4;
fStack_84 = _DAT_00c34cd8;
fStack_80 = fRam00c34cdc;
fStack_7c = fRam00c34ce0;
fStack_78 = fRam00c34ce4;
afStack_74[0] = (float)DAT_00c34ce8;
afStack_74[1] = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(DAT_00c34ce8)) + 0x4)));
rngResult = Random();
projVelocity.x =
(float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) *
2.3283064e-10 + 5.0;
projVelocity.y = projVelocity.x * local_c8;
projVelocity.x = projVelocity.x * local_c4;
Entity_NPC::FireProjectiles(in_ECX,&shootPos,&projVelocity,0,GHIDRA_CAST<ProjectileParams *>(projParams));
effectPos.x = local_c4 * 4.0 + shootPos.x;
effectPos.y = local_c8 * 4.0 + shootPos.y;
rngResult = Random();
pEVar1 = Game::Spawn(g_game,1000,2,&effectPos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),1,rngResult);
(**(code **)(*GHIDRA_CAST<int *>(pEVar1) + 0x3c))(&g_colorGreenSplat,0xffffffff,0xff,0,1);
(pEVar1->_sprite)._offset.x = 0.0;
(pEVar1->_sprite)._offset.y = -20.0;
pEVar1->_renderDepthOffset = 10.0;
manager = g_manager;
local_cc = (float)(GHIDRA_INT(local_cc) + 1);
} while (GHIDRA_INT(local_cc) < 2);
if (in_ECX->_championColorIdx == 0x12) {
soundPitch = 1.5;
}
else if (in_ECX->_championColorIdx == 0x13) {
soundPitch = 0.5;
}
local_cc = 2.49431e-43;
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_cc));
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_cc),1.0,2,0,soundPitch,0.0);
return;
}
// 0058ac10
void NpcHelper::singe_explode_at(Entity_NPC *npc, Vector *position)
{