Curation round 26 (code only): the Siren, Singe's body and Butt Slicker, DebugRenderer and the hitsphere and player-info debug views, saved key bindings for menu actions, Mega Blast, 4.5 Volt, C Section, Mom's Bracelet, Book of the Dead and Everything Jar, and a parity audit of the player, pickups, level, familiars and Entity_NPC fixing about 90 differences; 005832c0 and 0058a010 renamed
This commit is contained in:
1 parent
5c89798773
commit
cc77c923e8
112 files changed
+4358
-1864
No files matched your search
@@ -136,664 +136,3 @@ void NpcHelper::mother_set_collision_class(Entity_NPC *npc, int collisionClass)
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 0058ac10
|
||||
void NpcHelper::singe_explode_at(Entity_NPC *npc, Vector *position)
|
||||
{
|
||||
int iVar1;
|
||||
uint64_t qVar2;
|
||||
uint32_t uVar3;
|
||||
uint32_t angleRoll;
|
||||
Entity *minion;
|
||||
uint64_t *heapCounter;
|
||||
float fVar4;
|
||||
EntityList_EL minions;
|
||||
EntityList_EL nearby;
|
||||
Vector spawnPos;
|
||||
float angle;
|
||||
float angleSin;
|
||||
ColorMod explosionColor;
|
||||
uint32_t local_18;
|
||||
void *local_10;
|
||||
uint8_t *puStack_c;
|
||||
float local_8;
|
||||
uint32_t flagsHigh;
|
||||
Game *game;
|
||||
|
||||
local_8 = -NAN;
|
||||
puStack_c = &LAB_00af54e5;
|
||||
local_10 = ExceptionList;
|
||||
local_18 = __security_cookie ^ GHIDRA_UINT(((&explosionColor)[1]._colorize + 1));
|
||||
ExceptionList = &local_10;
|
||||
explosionColor._offset[0] = 0.0;
|
||||
explosionColor._offset[1] = 0.0;
|
||||
explosionColor._tint[0] = 1.0;
|
||||
explosionColor._tint[1] = 1.0;
|
||||
explosionColor._tint[2] = 1.0;
|
||||
explosionColor._tint[3] = 1.0;
|
||||
explosionColor._offset[2] = 0.0;
|
||||
explosionColor._colorize[0] = 0.0;
|
||||
explosionColor._colorize[1] = 0.0;
|
||||
explosionColor._colorize[2] = 0.0;
|
||||
explosionColor._colorize[3] = 0.0;
|
||||
Game::BombExplosionEffects
|
||||
(g_game,position,60.0,(BitSet128)ZEXT816(0),&explosionColor,GHIDRA_CAST<Entity *>(npc),1.15,1,4,0);
|
||||
Game::ButterBeanFart(g_game,position,120.0,GHIDRA_CAST<Entity *>(npc),0,0);
|
||||
Game::ShakeScreen(g_game,10);
|
||||
game = g_game;
|
||||
npc->_projectileCooldown = npc->_projectileCooldown + 1;
|
||||
EntityList::QueryRadius(GHIDRA_CAST<EntityList *>((GHIDRA_INT(game->_room) + 0x1218)),&nearby,position,100.0,8);
|
||||
local_8 = 0.0;
|
||||
uVar3 = 0;
|
||||
if (nearby._size != 0) {
|
||||
do {
|
||||
iVar1 = *GHIDRA_CAST<int *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(nearby)) + 0x4))) + uVar3 * 4));
|
||||
if ((*GHIDRA_CAST<int *>((iVar1 + 0x28)) == 0x393) && (*GHIDRA_CAST<int *>((iVar1 + 0x2c)) == 1)) {
|
||||
npc->_projectileCooldown = 0;
|
||||
break;
|
||||
}
|
||||
uVar3 = uVar3 + 1;
|
||||
} while (uVar3 < GHIDRA_UINT(nearby._size));
|
||||
}
|
||||
EntityList::QuerySublist(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),&minions,0x393,1,-1,0,0);
|
||||
local_8 = (float)CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),1);
|
||||
if (GHIDRA_UINT(minions._size) < npc->_i1 + 4U) {
|
||||
uVar3 = Random();
|
||||
angleRoll = Random();
|
||||
angle = (float)((double)GHIDRA_INT(angleRoll) + __uint_to_double_fixup[-(GHIDRA_INT(angleRoll) >> 0x1f)]) *
|
||||
2.3283064e-10 * 3.14;
|
||||
angle = angle + angle;
|
||||
angleSin = sin(angle);
|
||||
fVar4 = cos(angle);
|
||||
spawnPos.x = fVar4 * 20.0 + (npc->_pos).x;
|
||||
spawnPos.y = angleSin * 20.0 + (npc->_pos).y;
|
||||
minion = Game::Spawn(g_game,0x393,1,&spawnPos,&g_vectorZero,GHIDRA_CAST<Entity *>(npc),0,uVar3);
|
||||
flagsHigh = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&minion->_flags) + 4));
|
||||
iVar1 = *GHIDRA_CAST<int *>(minion);
|
||||
*GHIDRA_CAST<uint32_t *>(&minion->_flags) = GHIDRA_UINT(minion->_flags) & 0xfffffffb;
|
||||
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&minion->_flags) + 4)) = flagsHigh;
|
||||
(**(code **)(iVar1 + 0xc))();
|
||||
iVar1 = *GHIDRA_CAST<int *>(minion);
|
||||
minion[2]._speedMultiplier = -500.0;
|
||||
minion[2]._prevVelocity.x = 10.0;
|
||||
(**(code **)(iVar1 + 0xc))();
|
||||
}
|
||||
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(minions)) + 0x0))) == '\0') {
|
||||
heapCounter = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
|
||||
if (g_mainHeap == (void *)0x0) {
|
||||
heapCounter = &g_allocatedBytesNoHeap;
|
||||
}
|
||||
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(minions)) + 0x4))) != 0) {
|
||||
uVar3 = *GHIDRA_CAST<uint32_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(minions)) + 0x4))) + -4));
|
||||
qVar2 = *heapCounter;
|
||||
*GHIDRA_CAST<uint32_t *>(heapCounter) = GHIDRA_UINT(*heapCounter) - uVar3;
|
||||
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(heapCounter) + 4)) =
|
||||
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(heapCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < uVar3));
|
||||
free((void *)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(minions)) + 0x4))) + -4));
|
||||
}
|
||||
}
|
||||
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(nearby)) + 0x0))) == '\0') {
|
||||
heapCounter = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
|
||||
if (g_mainHeap == (void *)0x0) {
|
||||
heapCounter = &g_allocatedBytesNoHeap;
|
||||
}
|
||||
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(nearby)) + 0x4))) != 0) {
|
||||
uVar3 = *GHIDRA_CAST<uint32_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(nearby)) + 0x4))) + -4));
|
||||
qVar2 = *heapCounter;
|
||||
*GHIDRA_CAST<uint32_t *>(heapCounter) = GHIDRA_UINT(*heapCounter) - uVar3;
|
||||
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(heapCounter) + 4)) =
|
||||
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(heapCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < uVar3));
|
||||
free((void *)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(nearby)) + 0x4))) + -4));
|
||||
}
|
||||
}
|
||||
ExceptionList = local_10;
|
||||
return;
|
||||
}
|
||||
|
||||
// 0058e260
|
||||
void NpcHelper::siren_charm_familiar(Entity_NPC *npc, Entity_Familiar *familiar)
|
||||
{
|
||||
void *pvVar1;
|
||||
ANM2 *pAVar2;
|
||||
Entity_Familiar *pEVar3;
|
||||
uint32_t seed;
|
||||
Entity *secondEffect;
|
||||
uint32_t *refSlot;
|
||||
Vector local_1c;
|
||||
Vector local_14;
|
||||
int *eraseRef [2];
|
||||
int temp_5f68b46de4;
|
||||
|
||||
pEVar3 = familiar;
|
||||
if ((familiar->_flags & 0x100) == 0) {
|
||||
seed = Random();
|
||||
local_14.x = (pEVar3->_velocity).x;
|
||||
local_14.y = (pEVar3->_velocity).y;
|
||||
local_1c.x = (pEVar3->_pos).x;
|
||||
local_1c.y = (pEVar3->_pos).y;
|
||||
familiar = (Entity_Familiar *)
|
||||
Game::Spawn(g_game,1000,0xa5,&local_1c,&local_14,GHIDRA_CAST<Entity *>(npc),0,seed);
|
||||
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((familiar)) + 0x45c)))) = 0x4b;
|
||||
refSlot = &familiar->_parent;
|
||||
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((familiar)) + 0x460)))) = 0x4b;
|
||||
if (familiar->_parent != 0) {
|
||||
eraseRef[0] = refSlot;
|
||||
msvc::multiset<unsigned_int>::erase(eraseRef);
|
||||
}
|
||||
*refSlot = npc;
|
||||
if (npc != GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
||||
msvc::multiset<unsigned_int>::insert(refSlot);
|
||||
}
|
||||
refSlot = &familiar->_target;
|
||||
if (*refSlot != 0) {
|
||||
eraseRef[0] = refSlot;
|
||||
msvc::multiset<unsigned_int>::erase(eraseRef);
|
||||
}
|
||||
*refSlot = pEVar3;
|
||||
msvc::multiset<unsigned_int>::insert(refSlot);
|
||||
local_14.y = (float)npc->_sirenPlayerEntity;
|
||||
refSlot = &familiar->_child;
|
||||
if (*refSlot != 0) {
|
||||
eraseRef[0] = refSlot;
|
||||
msvc::multiset<unsigned_int>::erase(eraseRef);
|
||||
}
|
||||
*refSlot = local_14.y;
|
||||
if ((void *)local_14.y != (void *)0x0) {
|
||||
msvc::multiset<unsigned_int>::insert(refSlot);
|
||||
}
|
||||
(**(code **)(*GHIDRA_CAST<int *>(familiar) + 0xc))();
|
||||
seed = Random();
|
||||
local_1c.x = (pEVar3->_velocity).x;
|
||||
local_1c.y = (pEVar3->_velocity).y;
|
||||
local_14.x = (pEVar3->_pos).x;
|
||||
local_14.y = (pEVar3->_pos).y;
|
||||
secondEffect = Game::Spawn(g_game,1000,0xa5,&local_14,&local_1c,GHIDRA_CAST<Entity *>(npc),1,seed);
|
||||
temp_5f68b46de4 = secondEffect->_parent;
|
||||
pAVar2 = &secondEffect[1]._sprite;
|
||||
(pAVar2->_filename)._buf[4] = 'K';
|
||||
(pAVar2->_filename)._buf[5] = '\0';
|
||||
(pAVar2->_filename)._buf[6] = '\0';
|
||||
(pAVar2->_filename)._buf[7] = '\0';
|
||||
pAVar2 = &secondEffect[1]._sprite;
|
||||
(pAVar2->_filename)._buf[8] = 'K';
|
||||
(pAVar2->_filename)._buf[9] = '\0';
|
||||
(pAVar2->_filename)._buf[10] = '\0';
|
||||
(pAVar2->_filename)._buf[0xb] = '\0';
|
||||
if (temp_5f68b46de4 != 0) {
|
||||
familiar = GHIDRA_CAST<Entity_Familiar *>(&secondEffect->_parent);
|
||||
msvc::multiset<unsigned_int>::erase(&familiar);
|
||||
}
|
||||
secondEffect->_parent = npc;
|
||||
msvc::multiset<unsigned_int>::insert(&secondEffect->_parent);
|
||||
if (secondEffect->_target != 0) {
|
||||
familiar = GHIDRA_CAST<Entity_Familiar *>(&secondEffect->_target);
|
||||
msvc::multiset<unsigned_int>::erase(&familiar);
|
||||
}
|
||||
secondEffect->_target = pEVar3;
|
||||
msvc::multiset<unsigned_int>::insert(&secondEffect->_target);
|
||||
pvVar1 = npc->_sirenPlayerEntity;
|
||||
refSlot = &secondEffect->_child;
|
||||
if (*refSlot != 0) {
|
||||
familiar = GHIDRA_CAST<Entity_Familiar *>(refSlot);
|
||||
msvc::multiset<unsigned_int>::erase(&familiar);
|
||||
}
|
||||
*refSlot = pvVar1;
|
||||
if (pvVar1 != (void *)0x0) {
|
||||
msvc::multiset<unsigned_int>::insert(refSlot);
|
||||
}
|
||||
(**(code **)(*GHIDRA_CAST<int *>(secondEffect) + 0xc))();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 0058e490
|
||||
void NpcHelper::siren_familiar_counts(int *outFreeCount, int *outCharmedCount, int *outTotalCount)
|
||||
{
|
||||
char isCharmable;
|
||||
uint32_t uVar1;
|
||||
int familiarsData;
|
||||
int extraout_ECX;
|
||||
uint32_t uVar2;
|
||||
uint32_t extraout_EDX;
|
||||
uint64_t *heapAllocatedBytes;
|
||||
EntityList_EL local_24;
|
||||
void *local_10;
|
||||
uint8_t *puStack_c;
|
||||
uint32_t uStack_8;
|
||||
int familiar;
|
||||
Game *game;
|
||||
uint64_t oldAllocatedBytes;
|
||||
|
||||
game = g_game;
|
||||
uStack_8 = 0xffffffff;
|
||||
puStack_c = &LAB_00af1690;
|
||||
local_10 = ExceptionList;
|
||||
uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
|
||||
ExceptionList = &local_10;
|
||||
*outFreeCount = 0;
|
||||
*outCharmedCount = 0;
|
||||
*outTotalCount = 0;
|
||||
EntityList::QuerySublist(GHIDRA_CAST<EntityList *>((GHIDRA_INT(game->_room) + 0x1218)),&local_24,3,-1,-1,0,0);
|
||||
uVar2 = 0;
|
||||
if (local_24._size != 0) {
|
||||
familiarsData = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_24)) + 0x4)));
|
||||
do {
|
||||
familiar = *GHIDRA_CAST<int *>((familiarsData + uVar2 * 4));
|
||||
if ((familiar != 0) && (*GHIDRA_CAST<int *>((familiar + 0x28)) == 3)) {
|
||||
isCharmable = FUN_0060dae0(uVar1);
|
||||
if (isCharmable != '\0') {
|
||||
if ((*GHIDRA_CAST<uint32_t *>((extraout_ECX + 0x168)) & 0x100) == 0) {
|
||||
*outFreeCount = *outFreeCount + 1;
|
||||
}
|
||||
else {
|
||||
*outCharmedCount = *outCharmedCount + 1;
|
||||
}
|
||||
*outTotalCount = *outTotalCount + 1;
|
||||
}
|
||||
familiarsData = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_24)) + 0x4)));
|
||||
uVar2 = extraout_EDX;
|
||||
}
|
||||
uVar2 = uVar2 + 1;
|
||||
} while (uVar2 < GHIDRA_UINT(local_24._size));
|
||||
}
|
||||
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_24)) + 0x0))) == '\0') {
|
||||
if (g_mainHeap == (void *)0x0) {
|
||||
heapAllocatedBytes = &g_allocatedBytesNoHeap;
|
||||
}
|
||||
else {
|
||||
heapAllocatedBytes = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
|
||||
}
|
||||
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_24)) + 0x4))) != 0) {
|
||||
uVar2 = *GHIDRA_CAST<uint32_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_24)) + 0x4))) + -4));
|
||||
oldAllocatedBytes = *heapAllocatedBytes;
|
||||
*GHIDRA_CAST<uint32_t *>(heapAllocatedBytes) = GHIDRA_UINT(*heapAllocatedBytes) - uVar2;
|
||||
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(heapAllocatedBytes) + 4)) =
|
||||
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(heapAllocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocatedBytes) < uVar2));
|
||||
free(GHIDRA_CAST<uint32_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_24)) + 0x4))) + -4)));
|
||||
}
|
||||
}
|
||||
ExceptionList = local_10;
|
||||
return;
|
||||
}
|
||||
|
||||
// 0058e590
|
||||
int NpcHelper::siren_charmed_count(Entity_NPC *npc)
|
||||
{
|
||||
uint64_t qVar1;
|
||||
uint8_t isDetached;
|
||||
uint64_t *allocatedBytes;
|
||||
int extraout_ECX;
|
||||
uint32_t uVar2;
|
||||
uint32_t extraout_EDX;
|
||||
int count;
|
||||
EntityList_EL local_24;
|
||||
Entity_NPC *siren;
|
||||
void *local_10;
|
||||
uint8_t *puStack_c;
|
||||
uint32_t uStack_8;
|
||||
Entity_Familiar *familiar;
|
||||
|
||||
uStack_8 = 0xffffffff;
|
||||
puStack_c = &LAB_00af38e0;
|
||||
local_10 = ExceptionList;
|
||||
ExceptionList = &local_10;
|
||||
count = 0;
|
||||
siren = npc;
|
||||
EntityList::QuerySublist(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),&local_24,3,-1,-1,0,0);
|
||||
uVar2 = 0;
|
||||
if (local_24._size != 0) {
|
||||
do {
|
||||
familiar = *GHIDRA_CAST<Entity_Familiar **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_24)) + 0x4))) + uVar2 * 4));
|
||||
if ((((familiar != GHIDRA_CAST<Entity_Familiar *>(0x0)) && (familiar->_type == 3)) &&
|
||||
((familiar->_flags & 0x100) != 0)) &&
|
||||
((isDetached = Entity_Familiar::is_detached_from_follow(familiar), uVar2 = extraout_EDX,
|
||||
isDetached != 0 && (*(void **)(extraout_ECX + 0x410) == siren->_sirenPlayerEntity)))) {
|
||||
count = count + 1;
|
||||
}
|
||||
uVar2 = uVar2 + 1;
|
||||
} while (uVar2 < GHIDRA_UINT(local_24._size));
|
||||
}
|
||||
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_24)) + 0x0))) == '\0') {
|
||||
if (g_mainHeap == (void *)0x0) {
|
||||
allocatedBytes = &g_allocatedBytesNoHeap;
|
||||
}
|
||||
else {
|
||||
allocatedBytes = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
|
||||
}
|
||||
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_24)) + 0x4))) != 0) {
|
||||
uVar2 = *GHIDRA_CAST<uint32_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_24)) + 0x4))) + -4));
|
||||
qVar1 = *allocatedBytes;
|
||||
*GHIDRA_CAST<uint32_t *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar2;
|
||||
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
|
||||
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar2));
|
||||
free((void *)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_24)) + 0x4))) + -4));
|
||||
}
|
||||
}
|
||||
ExceptionList = local_10;
|
||||
return count;
|
||||
}
|
||||
|
||||
// 0058e680
|
||||
void NpcHelper::siren_pick(Entity_NPC *npc)
|
||||
{
|
||||
RNG rng;
|
||||
uint64_t qVar1;
|
||||
int charmedCount;
|
||||
uint32_t uVar2;
|
||||
int familiar;
|
||||
float fVar3;
|
||||
uint32_t outcomeCount;
|
||||
float fVar4;
|
||||
uint64_t *heapCounter;
|
||||
uint32_t *outcomesBegin;
|
||||
uint32_t *controlledCount;
|
||||
uint32_t *outcomeCursor;
|
||||
float roomCenterY;
|
||||
float rightEdgeStart;
|
||||
float leftEdgeStart;
|
||||
uint32_t *controlledTotal;
|
||||
EntityList_EL local_64;
|
||||
Entity_NPC *local_54;
|
||||
uint32_t *picker;
|
||||
uint32_t *outcomesEnd;
|
||||
uint32_t *outcomesCapacity;
|
||||
float local_44;
|
||||
float local_40;
|
||||
int local_3c [7];
|
||||
uint8_t *puStack_20;
|
||||
void *local_1c;
|
||||
uint8_t *puStack_18;
|
||||
uint32_t local_14;
|
||||
void *room;
|
||||
int *weight;
|
||||
|
||||
puStack_20 = GHIDRA_CAST<uint8_t *>((local_3c + 0xe));
|
||||
puStack_18 = &LAB_00af55ad;
|
||||
local_1c = ExceptionList;
|
||||
local_3c[6] = __security_cookie ^ GHIDRA_UINT((local_3c + 0xb));
|
||||
ExceptionList = &local_1c;
|
||||
controlledCount = GHIDRA_CAST<uint32_t *>(0x0);
|
||||
local_3c[4] = 0xc;
|
||||
local_3c[0] = 3;
|
||||
local_3c[1] = 8;
|
||||
local_3c[2] = 9;
|
||||
local_3c[3] = 10;
|
||||
local_3c[5] = 6;
|
||||
picker = GHIDRA_CAST<uint32_t *>(0x0);
|
||||
outcomesEnd = GHIDRA_CAST<uint32_t *>(0x0);
|
||||
outcomesCapacity = GHIDRA_CAST<uint32_t *>(0x0);
|
||||
local_14 = 0;
|
||||
local_54 = npc;
|
||||
siren_familiar_counts(GHIDRA_CAST<int *>(&local_40),GHIDRA_CAST<int *>(&local_44),&local_64._size);
|
||||
charmedCount = siren_charmed_count(local_54);
|
||||
controlledTotal = GHIDRA_CAST<uint32_t *>(0x0);
|
||||
EntityList::QuerySublist(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),&local_64,3,-1,-1,0,0);
|
||||
fVar4 = 0.0;
|
||||
outcomesBegin = controlledCount;
|
||||
outcomeCursor = GHIDRA_CAST<uint32_t *>(0x0);
|
||||
if ((float)local_64._size != 0.0) {
|
||||
do {
|
||||
familiar = *GHIDRA_CAST<int *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_64)) + 0x4))) + GHIDRA_INT(fVar4) * 4));
|
||||
if ((familiar == 0) || (*GHIDRA_CAST<int *>((familiar + 0x28)) != 3)) {
|
||||
familiar = 0;
|
||||
}
|
||||
if (((*GHIDRA_CAST<uint32_t *>((familiar + 0x168)) & 0x100) != 0) &&
|
||||
(*(void **)(familiar + 0x410) == local_54->_sirenPlayerEntity)) {
|
||||
controlledCount = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(controlledCount) + 1));
|
||||
}
|
||||
fVar4 = (float)(GHIDRA_INT(fVar4) + 1);
|
||||
} while (GHIDRA_UINT(fVar4) < GHIDRA_UINT(local_64._size));
|
||||
outcomesBegin = picker;
|
||||
outcomeCursor = outcomesEnd;
|
||||
controlledTotal = controlledCount;
|
||||
}
|
||||
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_64)) + 0x0))) == '\0') {
|
||||
if (g_mainHeap == (void *)0x0) {
|
||||
heapCounter = &g_allocatedBytesNoHeap;
|
||||
}
|
||||
else {
|
||||
heapCounter = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
|
||||
}
|
||||
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_64)) + 0x4))) != 0) {
|
||||
uVar2 = *GHIDRA_CAST<uint32_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_64)) + 0x4))) + -4));
|
||||
qVar1 = *heapCounter;
|
||||
*GHIDRA_CAST<uint32_t *>(heapCounter) = GHIDRA_UINT(*heapCounter) - uVar2;
|
||||
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(heapCounter) + 4)) =
|
||||
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(heapCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar2));
|
||||
free(GHIDRA_CAST<uint32_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_64)) + 0x4))) + -4)));
|
||||
}
|
||||
local_14 = local_14 & 0xffffff00;
|
||||
}
|
||||
if ((*GHIDRA_CAST<char *>((GHIDRA_INT(&(local_54->_v2).x) + 1)) == '\0') && (GHIDRA_INT(controlledTotal) < 2)) {
|
||||
fVar3 = (float)(GHIDRA_INT(controlledTotal) * -0x21 + 100);
|
||||
fVar4 = 0.0;
|
||||
if (0 < GHIDRA_INT(fVar3)) {
|
||||
fVar4 = fVar3;
|
||||
}
|
||||
if (0 < GHIDRA_INT(fVar4)) {
|
||||
local_64._capacity = 1;
|
||||
local_64._size = GHIDRA_INT(fVar4);
|
||||
msvc::vector<8byte>::_Emplace_reallocate(0,&local_64._capacity);
|
||||
outcomesBegin = picker;
|
||||
outcomeCursor = outcomesEnd;
|
||||
}
|
||||
}
|
||||
if (((*GHIDRA_CAST<char *>((GHIDRA_INT(&(local_54->_v2).x) + 3)) == '\0') && (GHIDRA_INT(local_44) < 6)) &&
|
||||
(0 < GHIDRA_INT(local_40))) {
|
||||
fVar3 = (float)(GHIDRA_INT(local_40) * 0x21 + GHIDRA_INT(local_44) * -0xf);
|
||||
fVar4 = 1.4013e-45;
|
||||
if (1 < GHIDRA_INT(fVar3)) {
|
||||
fVar4 = fVar3;
|
||||
}
|
||||
local_40 = 2.10195e-43;
|
||||
if (GHIDRA_INT(fVar4) < 0x96) {
|
||||
local_40 = fVar4;
|
||||
}
|
||||
uVar2 = 0;
|
||||
outcomeCount = GHIDRA_INT(outcomeCursor) - GHIDRA_INT(outcomesBegin) >> 3;
|
||||
if (outcomeCount != 0) {
|
||||
do {
|
||||
if (outcomesBegin[uVar2 * 2] == 3) {
|
||||
weight = outcomesBegin + uVar2 * 2 + 1;
|
||||
*weight = *weight + GHIDRA_INT(local_40);
|
||||
if (*weight < 0) {
|
||||
outcomesBegin[uVar2 * 2 + 1] = 0;
|
||||
}
|
||||
goto LAB_0058e8af;
|
||||
}
|
||||
uVar2 = uVar2 + 1;
|
||||
} while (uVar2 < outcomeCount);
|
||||
}
|
||||
if (0 < GHIDRA_INT(local_40)) {
|
||||
local_64._capacity = 3;
|
||||
local_64._size = GHIDRA_INT(local_40);
|
||||
if (outcomeCursor == outcomesCapacity) {
|
||||
msvc::vector<8byte>::_Emplace_reallocate(outcomeCursor,&local_64._capacity);
|
||||
outcomesBegin = picker;
|
||||
outcomeCursor = outcomesEnd;
|
||||
}
|
||||
else {
|
||||
*outcomeCursor = 3;
|
||||
outcomeCursor[1] = local_40;
|
||||
outcomesEnd = outcomeCursor + 2;
|
||||
outcomeCursor = outcomesEnd;
|
||||
}
|
||||
}
|
||||
}
|
||||
LAB_0058e8af:
|
||||
if (*GHIDRA_CAST<char *>(&(local_54->_v2).y) == '\0') {
|
||||
fVar4 = 4.62428e-44;
|
||||
if (0x21 < charmedCount * 0x21) {
|
||||
fVar4 = (float)(charmedCount * 0x21);
|
||||
}
|
||||
local_40 = 1.4013e-43;
|
||||
if (GHIDRA_INT(fVar4) < 100) {
|
||||
local_40 = fVar4;
|
||||
}
|
||||
outcomeCount = GHIDRA_INT(outcomeCursor) - GHIDRA_INT(outcomesBegin) >> 3;
|
||||
uVar2 = 0;
|
||||
if (outcomeCount != 0) {
|
||||
do {
|
||||
if (outcomesBegin[uVar2 * 2] == 4) {
|
||||
weight = outcomesBegin + uVar2 * 2 + 1;
|
||||
*weight = *weight + GHIDRA_INT(local_40);
|
||||
if (*weight < 0) {
|
||||
outcomesBegin[uVar2 * 2 + 1] = 0;
|
||||
}
|
||||
goto LAB_0058e94b;
|
||||
}
|
||||
uVar2 = uVar2 + 1;
|
||||
} while (uVar2 < outcomeCount);
|
||||
}
|
||||
if (0 < GHIDRA_INT(local_40)) {
|
||||
local_64._capacity = 4;
|
||||
local_64._size = GHIDRA_INT(local_40);
|
||||
if (outcomeCursor == outcomesCapacity) {
|
||||
msvc::vector<8byte>::_Emplace_reallocate(outcomeCursor,&local_64._capacity);
|
||||
outcomesBegin = picker;
|
||||
outcomeCursor = outcomesEnd;
|
||||
}
|
||||
else {
|
||||
*outcomeCursor = 4;
|
||||
outcomeCursor[1] = local_40;
|
||||
outcomesEnd = outcomeCursor + 2;
|
||||
outcomeCursor = outcomesEnd;
|
||||
}
|
||||
}
|
||||
}
|
||||
LAB_0058e94b:
|
||||
if ((*GHIDRA_CAST<char *>((GHIDRA_INT(&(local_54->_v2).y) + 1)) == '\0') && (local_44 == 0.0)) {
|
||||
local_64._size = GHIDRA_INT((local_54->_pos).y);
|
||||
room = g_game->_room;
|
||||
fVar4 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(room) + 0x1c));
|
||||
fVar3 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(room) + 0x20));
|
||||
rightEdgeStart = fVar4 - 80.0;
|
||||
local_40 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(room) + 0x14));
|
||||
leftEdgeStart = local_40 + 80.0;
|
||||
roomCenterY = (fVar3 - *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(room) + 0x18))) * 0.5 + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(room) + 0x18));
|
||||
local_44 = (local_54->_pos).x;
|
||||
if (rightEdgeStart == fVar4) {
|
||||
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("Start and End parameters cannot be the same!"));
|
||||
}
|
||||
fVar4 = (local_44 - rightEdgeStart) / (fVar4 - rightEdgeStart);
|
||||
if (fVar4 <= 0.0) {
|
||||
fVar4 = 0.0;
|
||||
}
|
||||
if (1.0 <= fVar4) {
|
||||
fVar4 = 1.0;
|
||||
}
|
||||
if (leftEdgeStart == local_40) {
|
||||
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("Start and End parameters cannot be the same!"));
|
||||
}
|
||||
local_44 = (local_44 - leftEdgeStart) / (local_40 - leftEdgeStart);
|
||||
if (local_44 <= 0.0) {
|
||||
local_44 = 0.0;
|
||||
}
|
||||
if (1.0 <= local_44) {
|
||||
local_44 = 1.0;
|
||||
}
|
||||
if (roomCenterY == fVar3) {
|
||||
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("Start and End parameters cannot be the same!"));
|
||||
}
|
||||
outcomeCount = GHIDRA_INT(outcomeCursor) - GHIDRA_INT(outcomesBegin) >> 3;
|
||||
uVar2 = 0;
|
||||
fVar3 = ((float)local_64._size - roomCenterY) / (fVar3 - roomCenterY);
|
||||
if (fVar3 <= 0.0) {
|
||||
fVar3 = 0.0;
|
||||
}
|
||||
if (1.0 <= fVar3) {
|
||||
fVar3 = 1.0;
|
||||
}
|
||||
fVar4 = (float)GHIDRA_INT(((fVar3 + 0.0 + local_44 + 0.0 + fVar4 + 0.0) * 100.0));
|
||||
if (outcomeCount != 0) {
|
||||
do {
|
||||
if (outcomesBegin[uVar2 * 2] == 5) {
|
||||
weight = outcomesBegin + uVar2 * 2 + 1;
|
||||
*weight = *weight + GHIDRA_INT(fVar4);
|
||||
if (*weight < 0) {
|
||||
outcomesBegin[uVar2 * 2 + 1] = 0;
|
||||
}
|
||||
goto LAB_0058eb5f;
|
||||
}
|
||||
uVar2 = uVar2 + 1;
|
||||
} while (uVar2 < outcomeCount);
|
||||
}
|
||||
if (0 < GHIDRA_INT(fVar4)) {
|
||||
local_64._capacity = 5;
|
||||
local_64._size = GHIDRA_INT(fVar4);
|
||||
if (outcomeCursor == outcomesCapacity) {
|
||||
msvc::vector<8byte>::_Emplace_reallocate(outcomeCursor,&local_64._capacity);
|
||||
outcomesBegin = picker;
|
||||
outcomeCursor = outcomesEnd;
|
||||
}
|
||||
else {
|
||||
*outcomeCursor = 5;
|
||||
outcomeCursor[1] = fVar4;
|
||||
outcomesEnd = outcomeCursor + 2;
|
||||
outcomeCursor = outcomesEnd;
|
||||
}
|
||||
}
|
||||
LAB_0058eb5f:
|
||||
if (outcomesBegin != outcomeCursor) goto LAB_0058ebbb;
|
||||
}
|
||||
else if (GHIDRA_INT(local_44) < 1) goto LAB_0058eb5f;
|
||||
uVar2 = 0;
|
||||
outcomeCount = GHIDRA_INT(outcomeCursor) - GHIDRA_INT(outcomesBegin) >> 3;
|
||||
if (outcomeCount != 0) {
|
||||
do {
|
||||
if (outcomesBegin[uVar2 * 2] == 0) {
|
||||
weight = outcomesBegin + uVar2 * 2 + 1;
|
||||
*weight = *weight + 100;
|
||||
if (*weight < 0) {
|
||||
outcomesBegin[uVar2 * 2 + 1] = 0;
|
||||
}
|
||||
goto LAB_0058ebbb;
|
||||
}
|
||||
uVar2 = uVar2 + 1;
|
||||
} while (uVar2 < outcomeCount);
|
||||
}
|
||||
local_64._size = 100;
|
||||
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_64)) + 0x4))) = (*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_64)) + 0x4))) & 0xffffffff;
|
||||
if (outcomeCursor == outcomesCapacity) {
|
||||
msvc::vector<8byte>::_Emplace_reallocate(outcomeCursor,&local_64._capacity);
|
||||
}
|
||||
else {
|
||||
*outcomeCursor = 0;
|
||||
outcomeCursor[1] = 100;
|
||||
outcomesEnd = outcomeCursor + 2;
|
||||
}
|
||||
LAB_0058ebbb:
|
||||
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_64)) + 0x0))) = Random();
|
||||
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_64)) + 0x0))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_64)) + 0x0))) | 1;
|
||||
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_64)) + 0x4))) = 5;
|
||||
local_64._capacity = 9;
|
||||
local_64._size = 7;
|
||||
rng._shift1 = 5;
|
||||
rng._seed = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_64)) + 0x0)));
|
||||
rng._shift2 = 9;
|
||||
rng._shift3 = 7;
|
||||
uVar2 = WeightedOutcomePicker::PickOutcome(GHIDRA_CAST<WeightedOutcomePicker *>(&picker),rng);
|
||||
if (uVar2 == 0) {
|
||||
*GHIDRA_CAST<uint16_t *>((GHIDRA_INT(&local_54->_projectileCooldown) + 2)) = 0;
|
||||
}
|
||||
else {
|
||||
charmedCount = local_3c[uVar2];
|
||||
*GHIDRA_CAST<uint16_t *>(&local_54->_projectileCooldown) = 0xffff;
|
||||
local_54->_state = charmedCount;
|
||||
}
|
||||
if (picker != GHIDRA_CAST<uint32_t *>(0x0)) {
|
||||
uVar2 = GHIDRA_INT(outcomesCapacity) - GHIDRA_INT(picker) & 0xfffffff8;
|
||||
outcomesBegin = picker;
|
||||
if (0xfff < uVar2) {
|
||||
outcomesBegin = GHIDRA_CAST<uint32_t *>(picker[-1]);
|
||||
uVar2 = uVar2 + 0x23;
|
||||
if (0x1f < GHIDRA_UINT((GHIDRA_INT(picker) + (-4 - GHIDRA_INT(outcomesBegin))))) {
|
||||
/* WARNING: Subroutine does not return */
|
||||
_invalid_parameter_noinfo_noreturn();
|
||||
}
|
||||
}
|
||||
operator_delete(outcomesBegin,uVar2);
|
||||
}
|
||||
ExceptionList = local_1c;
|
||||
return;
|
||||
}
|
||||
Reference in new issue
Block a user