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>
1881 lines
81 KiB
C++
1881 lines
81 KiB
C++
#include "classes.h"
|
|
|
|
// 00417540
|
|
void EntityList::sublist_init(EntityList_EL *parent, int capacity)
|
|
{
|
|
int startIdx;
|
|
uint parentCapacity;
|
|
void *parentData;
|
|
|
|
*GHIDRA_CAST<undefined1 *>(this) = 1;
|
|
startIdx = parent->_size;
|
|
parentData = parent->_data;
|
|
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x8)))) = capacity;
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0xc)))) = 0;
|
|
*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x4))) = (void *)(GHIDRA_INT(parentData) + startIdx * 4);
|
|
startIdx = parent->_size;
|
|
parentCapacity = parent->_capacity;
|
|
if (parentCapacity < GHIDRA_UINT((startIdx + capacity))) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: invalid sublist\n"));
|
|
startIdx = parent->_size;
|
|
parentCapacity = parent->_capacity;
|
|
}
|
|
if (parentCapacity < GHIDRA_UINT((startIdx + capacity))) {
|
|
startIdx = 0;
|
|
*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x4))) = parent->_data;
|
|
}
|
|
parent->_size = startIdx + capacity;
|
|
return;
|
|
}
|
|
|
|
// 004176f0
|
|
int EntityList::Size()
|
|
{
|
|
return *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0xc))));
|
|
}
|
|
|
|
// 00418230
|
|
void EntityList::Reset()
|
|
{
|
|
int *piVar1;
|
|
int iVar2;
|
|
int wispIndex;
|
|
uint i;
|
|
Manager *manager;
|
|
undefined4 movedEntity;
|
|
|
|
iVar2 = 0;
|
|
i = 0;
|
|
(this->_updateEL)._size = 0;
|
|
(this->_renderEL)._size = 0;
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x6c)))) = 0;
|
|
if ((this->_mainEL)._size != 0) {
|
|
do {
|
|
piVar1 = *GHIDRA_CAST<int **>((GHIDRA_INT((this->_mainEL)._data) + i * 4));
|
|
if ((piVar1[0x5b] & 0x20U) == 0) {
|
|
(**(code **)(*piVar1 + 0x44))();
|
|
*GHIDRA_CAST<undefined1 *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_mainEL)._data) + i * 4)) + 0x170)) = 0;
|
|
(**(code **)(**GHIDRA_CAST<int **>((GHIDRA_INT((this->_mainEL)._data) + i * 4)) + 0x28))();
|
|
}
|
|
else {
|
|
iVar2 = (this->_updateEL)._size;
|
|
if (GHIDRA_UINT((this->_updateEL)._capacity) < iVar2 + 1U) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: not enough space for push_back\n"));
|
|
iVar2 = (this->_updateEL)._size;
|
|
}
|
|
*GHIDRA_CAST<int **>((GHIDRA_INT((this->_updateEL)._data) + iVar2 * 4)) = piVar1;
|
|
piVar1 = &(this->_updateEL)._size;
|
|
*piVar1 = *piVar1 + 1;
|
|
iVar2 = (this->_renderEL)._size;
|
|
movedEntity = *GHIDRA_CAST<undefined4 *>((GHIDRA_INT((this->_mainEL)._data) + i * 4));
|
|
if (GHIDRA_UINT((this->_renderEL)._capacity) < iVar2 + 1U) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: not enough space for push_back\n"));
|
|
iVar2 = (this->_renderEL)._size;
|
|
}
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT((this->_renderEL)._data) + iVar2 * 4)) = movedEntity;
|
|
piVar1 = &(this->_renderEL)._size;
|
|
*piVar1 = *piVar1 + 1;
|
|
}
|
|
i = i + 1;
|
|
} while (i < GHIDRA_UINT((this->_mainEL)._size));
|
|
iVar2 = (this->_updateEL)._size;
|
|
}
|
|
i = 0;
|
|
(this->_mainEL)._size = 0;
|
|
(this->_wispEL)._size = 0;
|
|
if (iVar2 != 0) {
|
|
iVar2 = 0;
|
|
do {
|
|
movedEntity = *GHIDRA_CAST<undefined4 *>((GHIDRA_INT((this->_updateEL)._data) + i * 4));
|
|
if (GHIDRA_UINT((this->_mainEL)._capacity) < iVar2 + 1U) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: not enough space for push_back\n"));
|
|
iVar2 = (this->_mainEL)._size;
|
|
}
|
|
i = i + 1;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT((this->_mainEL)._data) + iVar2 * 4)) = movedEntity;
|
|
piVar1 = &(this->_mainEL)._size;
|
|
*piVar1 = *piVar1 + 1;
|
|
iVar2 = (this->_mainEL)._size;
|
|
} while (i < GHIDRA_UINT((this->_updateEL)._size));
|
|
}
|
|
i = 0;
|
|
if ((this->_persistentEL)._size != 0) {
|
|
do {
|
|
iVar2 = (this->_updateEL)._size;
|
|
movedEntity = *GHIDRA_CAST<undefined4 *>((GHIDRA_INT((this->_persistentEL)._data) + i * 4));
|
|
if (GHIDRA_UINT((this->_updateEL)._capacity) < iVar2 + 1U) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: not enough space for push_back\n"));
|
|
iVar2 = (this->_updateEL)._size;
|
|
}
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT((this->_updateEL)._data) + iVar2 * 4)) = movedEntity;
|
|
piVar1 = &(this->_updateEL)._size;
|
|
*piVar1 = *piVar1 + 1;
|
|
iVar2 = (this->_renderEL)._size;
|
|
movedEntity = *GHIDRA_CAST<undefined4 *>((GHIDRA_INT((this->_persistentEL)._data) + i * 4));
|
|
if (GHIDRA_UINT((this->_renderEL)._capacity) < iVar2 + 1U) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: not enough space for push_back\n"));
|
|
iVar2 = (this->_renderEL)._size;
|
|
}
|
|
i = i + 1;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT((this->_renderEL)._data) + iVar2 * 4)) = movedEntity;
|
|
piVar1 = &(this->_renderEL)._size;
|
|
*piVar1 = *piVar1 + 1;
|
|
} while (i < GHIDRA_UINT((this->_persistentEL)._size));
|
|
}
|
|
i = 0;
|
|
if ((this->_updateEL)._size != 0) {
|
|
do {
|
|
iVar2 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_updateEL)._data) + i * 4));
|
|
if ((*GHIDRA_CAST<int *>((iVar2 + 0x28)) == 3) && (*GHIDRA_CAST<int *>((iVar2 + 0x2c)) == 0xce)) {
|
|
wispIndex = (this->_wispEL)._size;
|
|
if (GHIDRA_UINT((this->_wispEL)._capacity) < wispIndex + 1U) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: not enough space for push_back\n"));
|
|
wispIndex = (this->_wispEL)._size;
|
|
}
|
|
*GHIDRA_CAST<int *>((GHIDRA_INT((this->_wispEL)._data) + wispIndex * 4)) = iVar2;
|
|
piVar1 = &(this->_wispEL)._size;
|
|
*piVar1 = *piVar1 + 1;
|
|
}
|
|
i = i + 1;
|
|
} while (i < GHIDRA_UINT((this->_updateEL)._size));
|
|
}
|
|
iVar2 = this[1]._persistentEL._capacity;
|
|
piVar1 = &this[1]._persistentEL._capacity;
|
|
this->_renderCursor = 0;
|
|
this->_renderMode = 0;
|
|
*GHIDRA_CAST<undefined4 *>((this + 1)) = 0;
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[1])) + 0x4)))) = 0;
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[1])) + 0x8)))) = 0;
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[1])) + 0xc)))) = 0;
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[1])) + 0x10)))) = 0;
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[1])) + 0x14)))) = 0;
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[1])) + 0x18)))) = 0;
|
|
(GHIDRA_CAST<std::map *>((piVar1)))->std::map::destroy_subtree(piVar1,*(void **)(iVar2 + 4));
|
|
manager = g_manager;
|
|
*GHIDRA_CAST<int *>((iVar2 + 4)) = iVar2;
|
|
*GHIDRA_CAST<int *>(iVar2) = iVar2;
|
|
*GHIDRA_CAST<int *>((iVar2 + 8)) = iVar2;
|
|
this[1]._persistentEL._size = 0;
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x8c)))) = 0;
|
|
*GHIDRA_CAST<undefined4 *>(&this[1]._updateEL) = 0;
|
|
*GHIDRA_CAST<undefined1 *>(&this[1]._updateEL._data) = 0;
|
|
this[1]._updateEL._capacity = -0x123458a;
|
|
if (((manager->_netplayManager != *GHIDRA_CAST<NetplayManager *>((manager + 1))) &&
|
|
(*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[6])) + 0xc)))) != 0)) &&
|
|
(GHIDRA_UINT(manager[1]._state) <
|
|
*GHIDRA_CAST<uint *>((GHIDRA_INT(&this[1]._renderEL) + (*GHIDRA_CAST<uint *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[6])) + 0x8)))) & 0x1f) * 0x18)))) {
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[6])) + 0xc)))) = 0;
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[6])) + 0x8)))) = 0;
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 00418500
|
|
void EntityList::AddEntity(Entity *entity)
|
|
{
|
|
char cVar1;
|
|
uint otherRenderDepth;
|
|
uint newRenderDepth;
|
|
int iVar2;
|
|
Entity *shiftIndex;
|
|
Entity *insertIndex;
|
|
bool isIndexInvalid;
|
|
Entity *newEntity;
|
|
int *sizePtr;
|
|
undefined4 *slot;
|
|
|
|
newEntity = entity;
|
|
if (entity->_valid == 0) {
|
|
iVar2 = entity->_type;
|
|
if (((iVar2 == 1) || (iVar2 == 3)) || ((iVar2 == 8 && (entity->_subtype == 0)))) {
|
|
iVar2 = (this->_persistentEL)._size;
|
|
if (GHIDRA_UINT((this->_persistentEL)._capacity) < iVar2 + 1U) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: not enough space for push_back\n"));
|
|
iVar2 = (this->_persistentEL)._size;
|
|
}
|
|
*GHIDRA_CAST<Entity **>((GHIDRA_INT((this->_persistentEL)._data) + iVar2 * 4)) = entity;
|
|
sizePtr = &(this->_persistentEL)._size;
|
|
*sizePtr = *sizePtr + 1;
|
|
}
|
|
else {
|
|
(GHIDRA_CAST<EntityList_EL *>((&this->_mainEL)))->EntityList_EL::push_back(entity);
|
|
}
|
|
cVar1 = entity->CanShutDoors();
|
|
if ((cVar1 != '\0') && (entity->_type != 0x362)) {
|
|
*GHIDRA_CAST<int *>((this + 1)) = *GHIDRA_CAST<int *>((this + 1)) + 1;
|
|
cVar1 = entity->IsBoss();
|
|
if (cVar1 != '\0') {
|
|
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[1])) + 0x8)))) = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[1])) + 0x8)))) + 1;
|
|
}
|
|
}
|
|
entity->_valid = 1;
|
|
entity = GHIDRA_CAST<Entity *>(0x0);
|
|
insertIndex = GHIDRA_CAST<Entity *>(0x0);
|
|
if ((this->_renderEL)._size != 0) {
|
|
do {
|
|
otherRenderDepth =
|
|
(**(code **)(**GHIDRA_CAST<int **>((GHIDRA_INT((this->_renderEL)._data) + GHIDRA_INT(entity) * 4)) + 0x34))();
|
|
newRenderDepth = newEntity->GetRenderZ();
|
|
insertIndex = entity;
|
|
if (newRenderDepth <= otherRenderDepth) break;
|
|
insertIndex = GHIDRA_CAST<Entity *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((entity)) + 0x1))));
|
|
entity = insertIndex;
|
|
} while (insertIndex < GHIDRA_CAST<undefined1 *>((this->_renderEL)._size));
|
|
}
|
|
shiftIndex = GHIDRA_CAST<Entity *>((this->_renderEL)._size);
|
|
if (GHIDRA_CAST<undefined1 *>((this->_renderEL)._capacity) < &(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((shiftIndex)) + 0x1)))) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: not enough space for insert\n"));
|
|
shiftIndex = GHIDRA_CAST<Entity *>((this->_renderEL)._size);
|
|
}
|
|
isIndexInvalid = false;
|
|
if (shiftIndex < insertIndex) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: invalid index for insert\n"));
|
|
shiftIndex = GHIDRA_CAST<Entity *>((this->_renderEL)._size);
|
|
isIndexInvalid = shiftIndex < insertIndex;
|
|
}
|
|
if (!isIndexInvalid && shiftIndex != insertIndex) {
|
|
do {
|
|
slot = GHIDRA_CAST<undefined4 *>((GHIDRA_INT((this->_renderEL)._data) + GHIDRA_INT(shiftIndex) * 4));
|
|
shiftIndex = GHIDRA_CAST<Entity *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(shiftIndex[-1])) + 0x40f))));
|
|
*slot = slot[-1];
|
|
} while (insertIndex < shiftIndex);
|
|
}
|
|
*GHIDRA_CAST<Entity **>((GHIDRA_INT((this->_renderEL)._data) + GHIDRA_INT(insertIndex) * 4)) = newEntity;
|
|
sizePtr = &(this->_renderEL)._size;
|
|
*sizePtr = *sizePtr + 1;
|
|
if ((newEntity->_type == 3) && (newEntity->_variant == 0xce)) {
|
|
iVar2 = (this->_wispEL)._size;
|
|
if (GHIDRA_UINT((this->_wispEL)._capacity) < iVar2 + 1U) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: not enough space for push_back\n"));
|
|
iVar2 = (this->_wispEL)._size;
|
|
}
|
|
*GHIDRA_CAST<Entity **>((GHIDRA_INT((this->_wispEL)._data) + iVar2 * 4)) = newEntity;
|
|
sizePtr = &(this->_wispEL)._size;
|
|
*sizePtr = *sizePtr + 1;
|
|
}
|
|
}
|
|
else {
|
|
(GHIDRA_CAST<EntityList_EL *>((&this->_updateEL)))->EntityList_EL::remove(entity);
|
|
}
|
|
if ((newEntity->_flags & 8) == 0) {
|
|
iVar2 = (this->_updateEL)._size;
|
|
if (GHIDRA_UINT((this->_updateEL)._capacity) < iVar2 + 1U) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: not enough space for push_back\n"));
|
|
iVar2 = (this->_updateEL)._size;
|
|
}
|
|
*GHIDRA_CAST<Entity **>((GHIDRA_INT((this->_updateEL)._data) + iVar2 * 4)) = newEntity;
|
|
sizePtr = &(this->_updateEL)._size;
|
|
*sizePtr = *sizePtr + 1;
|
|
}
|
|
invalidate_type_cache(this,newEntity->_type,newEntity->_variant,newEntity->_subtype);
|
|
return;
|
|
}
|
|
|
|
// 004186c0
|
|
void EntityList::Update(byte isTransition)
|
|
{
|
|
float fVar1;
|
|
int iVar2;
|
|
EntityList *pEVar3;
|
|
char cVar4;
|
|
byte isAnyFloorEntity;
|
|
uint uVar6;
|
|
uint extraout_EAX;
|
|
EntityConfig_Entity *configEntry;
|
|
EntityPtr *pEVar7;
|
|
float *bossMaxHpPtr;
|
|
undefined4 *puVar8;
|
|
EntityPtr EVar9;
|
|
EntityPtr EVar10;
|
|
void *checksum;
|
|
void *player;
|
|
void *this_02;
|
|
void *this_03;
|
|
void *this_04;
|
|
void *this_05;
|
|
void *pvVar11;
|
|
Game *game;
|
|
EntityPtr extraout_EDX;
|
|
uint uVar12;
|
|
PlayerManager *playerManager;
|
|
int *piVar13;
|
|
uint uVar14;
|
|
EntityList *curList;
|
|
EntityPtr prevPosX;
|
|
EntityPtr prevPosY;
|
|
EntityPtr prevVelocityX;
|
|
EntityPtr prevVelocityY;
|
|
float bossHpFill;
|
|
EntityPtr EVar15;
|
|
EntityPtr posY;
|
|
EntityPtr EVar16;
|
|
double dVar17;
|
|
EntityPtr recordIndex;
|
|
EntityPtr recordType;
|
|
EntityPtr recordVariant;
|
|
EntityPtr recordSubType;
|
|
EntityPtr recordDropSeed;
|
|
EntityPtr recordMtChecksum;
|
|
EntityPtr recordPrevPosX;
|
|
EntityPtr recordPrevPosY;
|
|
EntityPtr recordPrevVelocityX;
|
|
EntityPtr recordPrevVelocityY;
|
|
EntityPtr recordPosX;
|
|
EntityPtr recordPosY;
|
|
EntityPtr recordVelocityX;
|
|
EntityPtr recordVelocityY;
|
|
undefined4 checksumPosX;
|
|
int local_84;
|
|
NetplayManager netplayEnd;
|
|
int *checksumRecord;
|
|
int activeEnemyCount;
|
|
float bossMaxHealth;
|
|
undefined8 local_70;
|
|
NetplayManager local_64;
|
|
EntityPtr prevHealth;
|
|
EntityPtr local_5c;
|
|
uint isListDirty;
|
|
int bossCount;
|
|
EntityList *entityList;
|
|
float local_4c;
|
|
EntityPtr local_48;
|
|
EntityPtr curEntity;
|
|
float local_40;
|
|
EntityPtr local_3c;
|
|
EntityPtr local_38;
|
|
float local_34;
|
|
void *renderTarget;
|
|
EntityPtr local_2c [2];
|
|
bool isWallPass;
|
|
bool local_21;
|
|
undefined1 *puStack_20;
|
|
void *local_1c;
|
|
undefined1 *puStack_18;
|
|
EntityPtr local_14;
|
|
EntityList_EL *checksum;
|
|
undefined4 flagsHigh;
|
|
bool isAnyFloorEntity;
|
|
bool isAnyWallEntity;
|
|
Manager *manager;
|
|
Entity *player;
|
|
undefined1 *storedBossMaxHp;
|
|
|
|
manager = g_manager;
|
|
puStack_20 = GHIDRA_CAST<undefined1 *>((local_2c + 10));
|
|
local_14 = (EntityPtr)0xffffffff;
|
|
puStack_18 = &LAB_00af1575;
|
|
local_1c = ExceptionList;
|
|
uVar6 = __security_cookie ^ GHIDRA_UINT((local_2c + 7));
|
|
ExceptionList = &local_1c;
|
|
checksumRecord = GHIDRA_CAST<int *>(0x0);
|
|
local_64 = g_manager->_netplayManager;
|
|
netplayEnd = *GHIDRA_CAST<NetplayManager *>((g_manager + 1));
|
|
if (local_64 != netplayEnd) {
|
|
*GHIDRA_CAST<undefined4 *>(&this[1]._updateEL) = 0;
|
|
*GHIDRA_CAST<undefined1 *>(&this[1]._updateEL._data) = 0;
|
|
this[1]._updateEL._capacity = -0x123458a;
|
|
uVar14 = *GHIDRA_CAST<uint *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[6])) + 0xc))));
|
|
uVar12 = *GHIDRA_CAST<uint *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[6])) + 0x8))));
|
|
if (uVar14 < 0x20) {
|
|
*GHIDRA_CAST<uint *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[6])) + 0xc)))) = uVar14 + 1;
|
|
uVar12 = uVar12 + uVar14 & 0x1f;
|
|
}
|
|
else {
|
|
*GHIDRA_CAST<uint *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[6])) + 0x8)))) = uVar12 + 1 & 0x1f;
|
|
}
|
|
checksumRecord = GHIDRA_CAST<int *>((GHIDRA_INT(&this[1]._renderEL) + uVar12 * 0x18));
|
|
checksumRecord[2] = checksumRecord[1];
|
|
*checksumRecord = manager[1]._state;
|
|
}
|
|
iVar2 = this[1]._persistentEL._capacity;
|
|
piVar13 = &this[1]._persistentEL._capacity;
|
|
entityList = this;
|
|
(GHIDRA_CAST<std::map *>((piVar13)))->std::map::destroy_subtree(piVar13,*(void **)(iVar2 + 4));
|
|
*GHIDRA_CAST<int *>((iVar2 + 4)) = iVar2;
|
|
isListDirty = extraout_EAX & 0xffffff00;
|
|
*GHIDRA_CAST<int *>(iVar2) = iVar2;
|
|
*GHIDRA_CAST<int *>((iVar2 + 8)) = iVar2;
|
|
this[1]._persistentEL._size = 0;
|
|
local_40 = 0.0;
|
|
activeEnemyCount = 0;
|
|
EVar9 = (EntityPtr)(entityList->_updateEL)._size;
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((entityList)) + 0x8c)))) = 0;
|
|
bossCount = 0;
|
|
local_4c = 0.0;
|
|
bossMaxHealth = 0.0;
|
|
local_34 = 0.0;
|
|
local_38 = (EntityPtr)0x0;
|
|
local_48 = *GHIDRA_CAST<EntityPtr *>((GHIDRA_INT((entityList->_updateEL)._data) + GHIDRA_INT(EVar9) * 4 + -4));
|
|
curList = entityList;
|
|
do {
|
|
EVar10 = local_38;
|
|
if (EVar9 == (EntityPtr)0x0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EntityList: e_update is empty!\n"));
|
|
EVar9 = (EntityPtr)(curList->_updateEL)._size;
|
|
}
|
|
pEVar3 = entityList;
|
|
EVar10 = *GHIDRA_CAST<EntityPtr *>((GHIDRA_INT((curList->_updateEL)._data) + GHIDRA_INT(EVar10) * 4));
|
|
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(EVar10) + 0x172)) != '\0') {
|
|
local_3c = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar10) + 0x16c));
|
|
curList = pEVar3;
|
|
if ((((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar10) + 0x168)) & 8) == 0) ||
|
|
((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar10) + 0x168)) & 0x20000) != 0)) &&
|
|
((isTransition == 0 ||
|
|
(local_3c = (EntityPtr)(GHIDRA_UINT(local_3c) & 0x1000), local_3c != (EntityPtr)0x0)))) {
|
|
(**(code **)(*GHIDRA_CAST<int *>(EVar10) + 8))(uVar6);
|
|
EVar9 = (EntityPtr)(pEVar3->_updateEL)._size;
|
|
}
|
|
}
|
|
local_38 = (EntityPtr)(GHIDRA_INT(local_38) + 1);
|
|
curEntity = EVar9;
|
|
} while ((EVar10 != local_48) && (GHIDRA_UINT(local_38) < GHIDRA_UINT(EVar9)));
|
|
local_3c = (EntityPtr)0x0;
|
|
if (EVar10 == local_48) {
|
|
}
|
|
do {
|
|
if (EVar9 == (EntityPtr)0x0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EntityList: e_update is empty!\n"));
|
|
}
|
|
prevHealth = (EntityPtr)0x0;
|
|
EVar9 = *GHIDRA_CAST<EntityPtr *>((GHIDRA_INT((curList->_updateEL)._data) + GHIDRA_INT(local_3c) * 4));
|
|
curEntity = EVar9;
|
|
local_38 = (EntityPtr)(GHIDRA_INT(EVar9) + 0x28);
|
|
if ((*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2) || (*GHIDRA_CAST<EntityPtr *>(local_38) != (EntityPtr)0x1)) {
|
|
if (GHIDRA_INT(*GHIDRA_CAST<EntityPtr *>(local_38)) - 10U < 0x3de) {
|
|
if (*GHIDRA_CAST<EntityPtr *>(local_38) == (EntityPtr)0x1) goto LAB_004188e4;
|
|
prevHealth = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0xc5c));
|
|
goto LAB_0041890f;
|
|
}
|
|
}
|
|
else {
|
|
LAB_004188e4:
|
|
prevHealth = (EntityPtr)
|
|
(float)((double)*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar9) + 0x16b0)) +
|
|
__uint_to_double_fixup[-(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar9) + 0x16b0)) >> 0x1f)]);
|
|
LAB_0041890f:
|
|
}
|
|
if (*GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(EVar9) + 0x172)) != 0) {
|
|
if ((((((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar9) + 0x168)) & 8) != 0) &&
|
|
((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar9) + 0x168)) & 0x20000) == 0)) ||
|
|
((isTransition != 0 && ((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar9) + 0x16c)) & 0x1000) == 0)))) ||
|
|
((**(code **)(*GHIDRA_CAST<int *>(EVar9) + 0xc))(), *GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(EVar9) + 0x172)) != 0)) &&
|
|
(*GHIDRA_CAST<EntityPtr *>(local_38) != (EntityPtr)0x362)) {
|
|
cVar4 = (**(code **)(*GHIDRA_CAST<int *>(EVar9) + 0x48))();
|
|
if (cVar4 != '\0') {
|
|
activeEnemyCount = activeEnemyCount + 1;
|
|
cVar4 = (**(code **)(*GHIDRA_CAST<int *>(EVar9) + 0x4c))();
|
|
if (cVar4 != '\0') {
|
|
local_2c[0] = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x16c));
|
|
if ((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar9) + 0x168)) & 0x100000) == 0) {
|
|
EVar10 = (EntityPtr)(*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar9) + 0x168)) & 0x80000000);
|
|
if (EVar10 == (EntityPtr)0x0) {
|
|
bossCount = bossCount + 1;
|
|
}
|
|
if ((0 < g_game->_frameCount - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar9) + 0x328))) &&
|
|
(EVar10 == (EntityPtr)0x0)) {
|
|
local_5c = EVar10;
|
|
local_2c[0] = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x380));
|
|
pEVar7 = &local_5c;
|
|
if (0.0 <= (float)*GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x380))) {
|
|
pEVar7 = local_2c;
|
|
}
|
|
local_4c = local_4c + (float)*pEVar7;
|
|
bossMaxHealth = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar9) + 900)) + bossMaxHealth;
|
|
}
|
|
}
|
|
}
|
|
if ((((*GHIDRA_CAST<EntityPtr *>(local_38) == (EntityPtr)0x3e8) &&
|
|
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar9) + 0x2c)) == 0xcb)) &&
|
|
(configEntry = EntityConfig::GetEntity
|
|
(&g_manager->_entityConfig,*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar9) + 0x47c)),
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar9) + 0x480)),
|
|
GHIDRA_INT(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar9) + 0x498)))),
|
|
configEntry != GHIDRA_CAST<EntityConfig_Entity *>(0x0))) && (configEntry->isBoss != 0)) {
|
|
bossCount = bossCount + 1;
|
|
}
|
|
}
|
|
cVar4 = (**(code **)(*GHIDRA_CAST<int *>(EVar9) + 0x48))();
|
|
if ((cVar4 != '\0') || (*GHIDRA_CAST<EntityPtr *>(local_38) == (EntityPtr)0x3c3)) {
|
|
local_2c[0] = *GHIDRA_CAST<EntityPtr *>(&g_game->_deathmatchManager);
|
|
if ((GHIDRA_INT(*GHIDRA_CAST<EntityPtr *>(&g_game->_deathmatchManager)) < 2) ||
|
|
(*GHIDRA_CAST<EntityPtr *>(local_38) != (EntityPtr)0x1)) {
|
|
EVar10 = *GHIDRA_CAST<EntityPtr *>(local_38);
|
|
if ((0x3dd < GHIDRA_INT(EVar10) - 10U) && (EVar10 != (EntityPtr)0x3c3)) goto LAB_00418ba8;
|
|
}
|
|
else {
|
|
EVar10 = (EntityPtr)0x1;
|
|
}
|
|
if ((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar9) + 0x168)) & 0x20000000) == 0) {
|
|
if (EVar10 == (EntityPtr)0x3e) {
|
|
isAnyFloorEntity = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(EVar9))))->Entity::DoesEntityShareStatus();
|
|
EVar10 = extraout_EDX;
|
|
if ((isAnyFloorEntity != 0) &&
|
|
(EVar16 = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x3bc)),
|
|
*GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x3bc)) != (EntityPtr)0x0)) {
|
|
do {
|
|
EVar15 = EVar16;
|
|
EVar16 = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar15) + 0x3bc));
|
|
} while (EVar16 != (EntityPtr)0x0);
|
|
if (EVar15 != EVar9) goto LAB_00418ba8;
|
|
}
|
|
}
|
|
local_5c = (EntityPtr)0x0;
|
|
if ((GHIDRA_INT(local_2c[0]) < 2) || (EVar10 != (EntityPtr)0x1)) {
|
|
if (GHIDRA_INT(EVar10) - 10U < 0x3de) {
|
|
if (EVar10 == (EntityPtr)0x1) goto LAB_00418b25;
|
|
local_5c = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0xc5c));
|
|
}
|
|
}
|
|
else {
|
|
LAB_00418b25:
|
|
local_5c = (EntityPtr)
|
|
(float)((double)*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar9) + 0x16b0)) +
|
|
__uint_to_double_fixup[-(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar9) + 0x16b0)) >> 0x1f)]);
|
|
}
|
|
local_2c[0] = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 900));
|
|
pEVar7 = &local_5c;
|
|
if ((float)*GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 900)) <= (float)local_5c) {
|
|
pEVar7 = local_2c;
|
|
}
|
|
local_2c[0] = (EntityPtr)((float)*pEVar7 - (float)prevHealth);
|
|
prevHealth = (EntityPtr)0x0;
|
|
pEVar7 = local_2c;
|
|
if ((float)local_2c[0] <= 0.0) {
|
|
pEVar7 = &prevHealth;
|
|
}
|
|
local_34 = (float)*pEVar7 + local_34;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
LAB_00418ba8:
|
|
isListDirty = isListDirty & 0xff;
|
|
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(EVar9) + 0x172)) == '\0') {
|
|
isListDirty = 1;
|
|
}
|
|
if ((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar9) + 0x16c)) & 0x100000) != 0) {
|
|
local_40 = (float)(GHIDRA_UINT(local_40) | 1);
|
|
}
|
|
if (local_64 != netplayEnd) {
|
|
checksumPosX = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(EVar9) + 0x33c));
|
|
local_84 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar9) + 0x340));
|
|
local_70 = *GHIDRA_CAST<ulonglong *>((GHIDRA_CAST<char *>(EVar9) + 0x360));
|
|
local_2c[0] = local_3c;
|
|
(GHIDRA_CAST<Checksum *>((&curList[1]._updateEL)))->Checksum::Update(GHIDRA_CAST<byte *>(local_2c),4);
|
|
local_2c[0] = *GHIDRA_CAST<EntityPtr *>(local_38);
|
|
(GHIDRA_CAST<Checksum *>((checksum)))->Checksum::Update(GHIDRA_CAST<byte *>(local_2c),4);
|
|
local_2c[0] = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x2c));
|
|
(GHIDRA_CAST<Checksum *>((player)))->Checksum::Update(GHIDRA_CAST<byte *>(local_2c),4);
|
|
local_2c[0] = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x30));
|
|
(GHIDRA_CAST<Checksum *>((this_02)))->Checksum::Update(GHIDRA_CAST<byte *>(local_2c),4);
|
|
local_2c[0] = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x3dc));
|
|
(GHIDRA_CAST<Checksum *>((this_03)))->Checksum::Update(GHIDRA_CAST<byte *>(local_2c),4);
|
|
(GHIDRA_CAST<Checksum *>((this_04)))->Checksum::Update(GHIDRA_CAST<byte *>(&checksumPosX),8);
|
|
(GHIDRA_CAST<Checksum *>((this_05)))->Checksum::Update(GHIDRA_CAST<byte *>(&local_70),8);
|
|
EVar10 = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x360));
|
|
EVar16 = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x364));
|
|
EVar15 = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x33c));
|
|
posY = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x340));
|
|
prevPosX = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x38c));
|
|
prevPosY = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x390));
|
|
prevVelocityX = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x394));
|
|
prevVelocityY = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x398));
|
|
recordMtChecksum = (EntityPtr)get_mt_state_checksum();
|
|
recordDropSeed = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x3dc));
|
|
recordSubType = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x30));
|
|
recordVariant = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(curEntity) + 0x2c));
|
|
recordType = *GHIDRA_CAST<EntityPtr *>(local_38);
|
|
local_2c[0] = recordMtChecksum;
|
|
recordIndex = local_3c;
|
|
pEVar7 = GHIDRA_CAST<EntityPtr *>(checksumRecord[2]);
|
|
recordPrevPosX = prevPosX;
|
|
recordPrevPosY = prevPosY;
|
|
recordPrevVelocityX = prevVelocityX;
|
|
recordPrevVelocityY = prevVelocityY;
|
|
recordPosX = EVar15;
|
|
recordPosY = posY;
|
|
recordVelocityX = EVar10;
|
|
recordVelocityY = EVar16;
|
|
if (pEVar7 == GHIDRA_CAST<EntityPtr *>(checksumRecord[3])) {
|
|
FUN_0041ccf0(pEVar7,&recordIndex);
|
|
}
|
|
else {
|
|
*pEVar7 = local_3c;
|
|
pEVar7[1] = recordType;
|
|
pEVar7[2] = recordVariant;
|
|
pEVar7[3] = recordSubType;
|
|
pEVar7[4] = recordDropSeed;
|
|
pEVar7[5] = recordMtChecksum;
|
|
pEVar7[6] = prevPosX;
|
|
pEVar7[7] = prevPosY;
|
|
pEVar7[8] = prevVelocityX;
|
|
pEVar7[9] = prevVelocityY;
|
|
pEVar7[10] = EVar15;
|
|
pEVar7[0xb] = posY;
|
|
pEVar7[0xc] = EVar10;
|
|
pEVar7[0xd] = EVar16;
|
|
checksumRecord[2] = checksumRecord[2] + 0x38;
|
|
}
|
|
EVar9 = curEntity;
|
|
curList = entityList;
|
|
}
|
|
local_3c = (EntityPtr)(GHIDRA_INT(local_3c) + 1);
|
|
} while ((EVar9 != local_48) &&
|
|
(EVar9 = (EntityPtr)(curList->_updateEL)._size, GHIDRA_UINT(local_3c) < GHIDRA_UINT(EVar9)));
|
|
uVar6 = 0;
|
|
if (GHIDRA_INT((g_game->_playerManager)._extraPlayers._end) -
|
|
GHIDRA_INT((g_game->_playerManager)._extraPlayers._begin) >> 2 != 0) {
|
|
do {
|
|
(**(code **)(**GHIDRA_CAST<int **>((GHIDRA_INT((g_game->_playerManager)._extraPlayers._begin) + uVar6 * 4)) + 0xc)
|
|
)();
|
|
uVar6 = uVar6 + 1;
|
|
} while (uVar6 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._extraPlayers._end) -
|
|
GHIDRA_INT((g_game->_playerManager)._extraPlayers._begin) >> 2)));
|
|
}
|
|
game = g_game;
|
|
if ((g_manager->_optionsConfig)._enableInterpolation == 0) {
|
|
playerManager = &g_game->_playerManager;
|
|
local_48 = (EntityPtr)0x0;
|
|
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >>
|
|
2 != 0) {
|
|
do {
|
|
pvVar11 = (playerManager->_playerList)._end;
|
|
if (GHIDRA_INT(pvVar11) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("(GHIDRA_CAST<PlayerManager *>(()))->PlayerManager::GetPlayer() : There are no players! \n"));
|
|
pvVar11 = (playerManager->_playerList)._end;
|
|
}
|
|
puVar8 = (playerManager->_playerList)._begin;
|
|
if (GHIDRA_UINT(local_48) < GHIDRA_UINT((GHIDRA_INT(pvVar11) - GHIDRA_INT(puVar8) >> 2))) {
|
|
puVar8 = puVar8 + GHIDRA_INT(local_48);
|
|
}
|
|
player = GHIDRA_CAST<Entity *>(*puVar8);
|
|
if ((isTransition == 0) || ((player->_flags & 0x100000000000) != 0)) {
|
|
flagsHigh = *GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&player->_flags) + 4));
|
|
*GHIDRA_CAST<uint *>(&player->_flags) = GHIDRA_UINT(player->_flags) | 0x4000;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&player->_flags) + 4)) = flagsHigh;
|
|
player->Update();
|
|
(GHIDRA_CAST<Entity *>((player)))->Entity::PlayerCollideWithGrid(0);
|
|
flagsHigh = *GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&player->_flags) + 4));
|
|
*GHIDRA_CAST<uint *>(&player->_flags) = GHIDRA_UINT(player->_flags) & 0xffffbfff;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&player->_flags) + 4)) = flagsHigh;
|
|
}
|
|
local_48 = (EntityPtr)(GHIDRA_INT(local_48) + 1);
|
|
playerManager = &g_game->_playerManager;
|
|
} while (GHIDRA_UINT(local_48) <
|
|
GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((playerManager->_playerList)._begin) >> 2)));
|
|
}
|
|
game = g_game;
|
|
if (GHIDRA_INT((g_game->_playerManager)._extraPlayers._end) -
|
|
GHIDRA_INT((g_game->_playerManager)._extraPlayers._begin) >> 2 != 0) {
|
|
uVar6 = 0;
|
|
do {
|
|
piVar13 = *GHIDRA_CAST<int **>((GHIDRA_INT((game->_playerManager)._extraPlayers._begin) + uVar6 * 4));
|
|
piVar13[0x5a] = piVar13[0x5a] | 0x4000;
|
|
piVar13[0x5b] = piVar13[0x5b];
|
|
(**(code **)(*piVar13 + 0xc))();
|
|
game = g_game;
|
|
uVar6 = uVar6 + 1;
|
|
piVar13[0x5a] = piVar13[0x5a] & 0xffffbfff;
|
|
piVar13[0x5b] = piVar13[0x5b];
|
|
} while (uVar6 < GHIDRA_UINT((GHIDRA_INT((game->_playerManager)._extraPlayers._end) -
|
|
GHIDRA_INT((game->_playerManager)._extraPlayers._begin) >> 2)));
|
|
curList = entityList;
|
|
}
|
|
}
|
|
storedBossMaxHp = &(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(curList[1])) + 0x10)));
|
|
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(curList[1])) + 0x4)))) = *GHIDRA_CAST<int *>((curList + 1)) + activeEnemyCount;
|
|
iVar2 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(curList[1])) + 0x8))));
|
|
*GHIDRA_CAST<undefined4 *>((curList + 1)) = 0;
|
|
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(curList[1])) + 0xc)))) = iVar2 + bossCount;
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(curList[1])) + 0x8)))) = 0;
|
|
*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(curList[1])) + 0x18)))) = local_40;
|
|
if (bossCount < 1) {
|
|
*GHIDRA_CAST<undefined4 *>(storedBossMaxHp) = 0;
|
|
fVar1 = (game->_hud)._bossHPBarFill;
|
|
if (-1.0 < fVar1) {
|
|
(game->_hud)._bossHPBarDamageFlash = 8;
|
|
}
|
|
if ((fVar1 < -1.0) && (fVar1 != -1.0)) {
|
|
(game->_hud)._bossHPBarDamageFlash = -1;
|
|
(game->_hud)._bossHPBarHealFlash = 8;
|
|
}
|
|
(game->_hud)._bossHPBarFill = (float)&DAT_bf800000;
|
|
}
|
|
else {
|
|
bossMaxHpPtr = &bossMaxHealth;
|
|
if (bossMaxHealth < *GHIDRA_CAST<float *>(storedBossMaxHp) || bossMaxHealth == *GHIDRA_CAST<float *>(storedBossMaxHp)) {
|
|
bossMaxHpPtr = GHIDRA_CAST<float *>(storedBossMaxHp);
|
|
}
|
|
bossHpFill = local_4c / *bossMaxHpPtr;
|
|
*GHIDRA_CAST<float *>(storedBossMaxHp) = *bossMaxHpPtr;
|
|
fVar1 = (game->_hud)._bossHPBarFill;
|
|
if (bossHpFill < fVar1) {
|
|
(game->_hud)._bossHPBarDamageFlash = 8;
|
|
}
|
|
if ((fVar1 < bossHpFill) && (fVar1 != -1.0)) {
|
|
(game->_hud)._bossHPBarDamageFlash = -1;
|
|
(game->_hud)._bossHPBarHealFlash = 8;
|
|
}
|
|
(game->_hud)._bossHPBarFill = bossHpFill;
|
|
}
|
|
fVar1 = g_displayPixelRatio;
|
|
*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(curList[1])) + 0x14)))) = local_34;
|
|
local_34 = fVar1 * g_screenPointScale;
|
|
local_40 = (g_screenHeight - 182.0) * 0.5 - 52.0;
|
|
local_2c[0] = (EntityPtr)(local_34 * ((g_screenWidth - 338.0) * 0.5 - 52.0) + 0.5);
|
|
dVar17 = floor((double)(float)local_2c[0]);
|
|
local_4c = (float)dVar17 / local_34;
|
|
local_2c[0] = (EntityPtr)(local_34 * local_40 + 0.5);
|
|
dVar17 = floor((double)(float)local_2c[0]);
|
|
local_2c[0] = (EntityPtr)(float)dVar17;
|
|
local_40 = (float)local_2c[0] / local_34;
|
|
isAnyWallEntity = false;
|
|
isAnyFloorEntity = false;
|
|
local_21 = false;
|
|
isWallPass = false;
|
|
local_34 = 0.0;
|
|
if ((curList->_renderEL)._size != 0) {
|
|
piVar13 = (curList->_renderEL)._data;
|
|
do {
|
|
iVar2 = *piVar13;
|
|
if (*GHIDRA_CAST<char *>((iVar2 + 0x172)) != '\0') {
|
|
local_70 = CONCAT44(*GHIDRA_CAST<undefined4 *>((iVar2 + 0x16c)),(undefined4)local_70);
|
|
if ((*GHIDRA_CAST<uint *>((iVar2 + 0x168)) & 8) != 0) {
|
|
isAnyFloorEntity = true;
|
|
local_21 = true;
|
|
}
|
|
if ((*GHIDRA_CAST<uint *>((iVar2 + 0x168)) & 0x2000) != 0) {
|
|
isAnyWallEntity = true;
|
|
isWallPass = true;
|
|
}
|
|
if (isAnyFloorEntity) {
|
|
if (isAnyWallEntity) goto LAB_0041915c;
|
|
}
|
|
}
|
|
piVar13 = piVar13 + 1;
|
|
local_34 = (float)(GHIDRA_INT(local_34) + 1);
|
|
} while (GHIDRA_UINT(local_34) < GHIDRA_UINT((curList->_renderEL)._size));
|
|
isWallPass = isAnyWallEntity;
|
|
local_21 = isAnyFloorEntity;
|
|
if ((isAnyFloorEntity != false) || (isAnyWallEntity != false)) {
|
|
LAB_0041915c:
|
|
local_70 = 0;
|
|
std::vector::resize(&local_70);
|
|
puVar8 = std::deque::back();
|
|
if (GHIDRA_CAST<byte *>((puVar8 + 1)) != GHIDRA_CAST<byte *>(0x0)) {
|
|
*GHIDRA_CAST<byte *>((puVar8 + 1)) = (byte)(g_graphicsManager_flags >> 5) & 1;
|
|
}
|
|
*puVar8 = g_graphicsManager_renderTarget;
|
|
uVar6 = g_graphicsManager_flags & 0xfffffffd;
|
|
g_graphicsManager_blendMode[0] = 0;
|
|
g_graphicsManager_blendMode[1] = 1;
|
|
g_graphicsManager_blendMode[2] = 7;
|
|
if ((g_graphicsManager_flags & 4) == 0) {
|
|
g_graphicsManager_blendMode[1] = 6;
|
|
}
|
|
g_graphicsManager_blendMode[3] = 1;
|
|
g_graphicsManager_blendMode[4] = 7;
|
|
g_graphicsManager_flags = uVar6;
|
|
if (local_21 != false) {
|
|
(GHIDRA_CAST<shared_ptr *>((&renderTarget)))->shared_ptr::assign((void *)(GHIDRA_INT(g_game->_room) + 0x1bc8));
|
|
local_14 = (EntityPtr)0x0;
|
|
(GHIDRA_CAST<KAGE_Graphics *>((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(renderTarget,0);
|
|
local_14 = (EntityPtr)0x1;
|
|
if (((local_2c[0] != (EntityPtr)0x0) &&
|
|
(cVar4 = (**(code **)(*GHIDRA_CAST<int *>(local_2c[0]) + 0xc))(), cVar4 != '\0')) &&
|
|
(g_renderTargetReleaseFn != (void *)0x0)) {
|
|
(*g_renderTargetReleaseFn)();
|
|
}
|
|
local_14 = (EntityPtr)0xffffffff;
|
|
local_34 = 0.0;
|
|
if ((curList->_renderEL)._size != 0) {
|
|
do {
|
|
piVar13 = *GHIDRA_CAST<int **>((GHIDRA_INT((curList->_renderEL)._data) + GHIDRA_INT(local_34) * 4));
|
|
if ((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(piVar13) + 0x172)) != '\0') && ((piVar13[0x5a] & 8U) != 0)) {
|
|
local_70 = CONCAT44(local_40,local_4c) ^ 0x8000000080000000;
|
|
(**(code **)(*piVar13 + 0x14))();
|
|
local_84 = piVar13[0x5b];
|
|
if (((piVar13[0x5a] & 0x2000U) == 0) && ((piVar13[0x5a] & 0x22000U) == 0)) {
|
|
(**(code **)(*piVar13 + 0x28))();
|
|
isListDirty = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(isListDirty)) + 0x1))),1);
|
|
}
|
|
}
|
|
local_34 = (float)(GHIDRA_INT(local_34) + 1);
|
|
} while (GHIDRA_UINT(local_34) < GHIDRA_UINT((curList->_renderEL)._size));
|
|
}
|
|
_glfw_context_reset();
|
|
}
|
|
if (isWallPass != false) {
|
|
(GHIDRA_CAST<shared_ptr *>((&renderTarget)))->shared_ptr::assign((void *)(GHIDRA_INT(g_game->_room) + 0x1bd0));
|
|
local_14 = (EntityPtr)0x2;
|
|
(GHIDRA_CAST<KAGE_Graphics *>((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget(renderTarget,0);
|
|
local_14 = (EntityPtr)0x3;
|
|
if (((local_2c[0] != (EntityPtr)0x0) &&
|
|
(cVar4 = (**(code **)(*GHIDRA_CAST<int *>(local_2c[0]) + 0xc))(), cVar4 != '\0')) &&
|
|
(g_renderTargetReleaseFn != (void *)0x0)) {
|
|
(*g_renderTargetReleaseFn)();
|
|
}
|
|
local_14 = (EntityPtr)0xffffffff;
|
|
local_34 = 0.0;
|
|
if ((curList->_renderEL)._size != 0) {
|
|
do {
|
|
piVar13 = *GHIDRA_CAST<int **>((GHIDRA_INT((curList->_renderEL)._data) + GHIDRA_INT(local_34) * 4));
|
|
if ((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(piVar13) + 0x172)) != '\0') && ((piVar13[0x5a] & 0x2000U) != 0)) {
|
|
local_70 = CONCAT44(local_40,local_4c) ^ 0x8000000080000000;
|
|
(**(code **)(*piVar13 + 0x14))();
|
|
if ((piVar13[0x5a] & 0x20000U) == 0) {
|
|
(**(code **)(*piVar13 + 0x28))();
|
|
isListDirty = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(isListDirty)) + 0x1))),1);
|
|
}
|
|
}
|
|
local_34 = (float)(GHIDRA_INT(local_34) + 1);
|
|
} while (GHIDRA_UINT(local_34) < GHIDRA_UINT((curList->_renderEL)._size));
|
|
}
|
|
_glfw_context_reset();
|
|
}
|
|
if ((local_21 != false) || (isWallPass != false)) {
|
|
g_graphicsManager_flags = g_graphicsManager_flags | 2;
|
|
if (g_renderTargetStackSize == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("PopRenderTarget: stack is empty!\n"));
|
|
}
|
|
puVar8 = std::deque::back();
|
|
(GHIDRA_CAST<KAGE_Graphics *>((&DAT_00c798e0)))->KAGE_Graphics::SetRenderTarget((void *)*puVar8,*GHIDRA_CAST<byte *>((puVar8 + 1)));
|
|
g_renderTargetStackSize = g_renderTargetStackSize - 1;
|
|
if (g_renderTargetStackSize == 0) {
|
|
DAT_00c7978c = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if ((char)isListDirty != '\0') {
|
|
uVar6 = (curList->_updateEL)._size;
|
|
uVar14 = 0;
|
|
if (uVar6 != 0) {
|
|
do {
|
|
if (*GHIDRA_CAST<char *>((*GHIDRA_CAST<int *>((GHIDRA_INT((curList->_updateEL)._data) + uVar14 * 4)) + 0x172)) == '\0') {
|
|
if (uVar6 <= uVar14) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: invalid index for remove\n"));
|
|
uVar6 = (curList->_updateEL)._size;
|
|
}
|
|
uVar12 = uVar14;
|
|
if (uVar14 < uVar6 - 1) {
|
|
do {
|
|
pvVar11 = (curList->_updateEL)._data;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar11) + uVar12 * 4)) =
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar11) + uVar12 * 4 + 4));
|
|
uVar12 = uVar12 + 1;
|
|
uVar6 = (curList->_updateEL)._size;
|
|
} while (uVar12 < uVar6 - 1);
|
|
}
|
|
uVar6 = uVar6 - 1;
|
|
(curList->_updateEL)._size = uVar6;
|
|
}
|
|
else {
|
|
uVar14 = uVar14 + 1;
|
|
}
|
|
} while (uVar14 < uVar6);
|
|
}
|
|
uVar6 = (curList->_renderEL)._size;
|
|
uVar14 = 0;
|
|
if (uVar6 != 0) {
|
|
do {
|
|
if (*GHIDRA_CAST<char *>((*GHIDRA_CAST<int *>((GHIDRA_INT((curList->_renderEL)._data) + uVar14 * 4)) + 0x172)) == '\0') {
|
|
if (uVar6 <= uVar14) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: invalid index for remove\n"));
|
|
uVar6 = (curList->_renderEL)._size;
|
|
}
|
|
uVar12 = uVar14;
|
|
if (uVar14 < uVar6 - 1) {
|
|
do {
|
|
pvVar11 = (curList->_renderEL)._data;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar11) + uVar12 * 4)) =
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar11) + uVar12 * 4 + 4));
|
|
uVar12 = uVar12 + 1;
|
|
uVar6 = (curList->_renderEL)._size;
|
|
} while (uVar12 < uVar6 - 1);
|
|
}
|
|
uVar6 = uVar6 - 1;
|
|
(curList->_renderEL)._size = uVar6;
|
|
}
|
|
else {
|
|
uVar14 = uVar14 + 1;
|
|
}
|
|
} while (uVar14 < uVar6);
|
|
}
|
|
uVar6 = (curList->_wispEL)._size;
|
|
uVar14 = 0;
|
|
if (uVar6 != 0) {
|
|
do {
|
|
if (*GHIDRA_CAST<char *>((*GHIDRA_CAST<int *>((GHIDRA_INT((curList->_wispEL)._data) + uVar14 * 4)) + 0x172)) == '\0') {
|
|
if (uVar6 <= uVar14) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: invalid index for remove\n"));
|
|
uVar6 = (curList->_wispEL)._size;
|
|
}
|
|
uVar12 = uVar14;
|
|
if (uVar14 < uVar6 - 1) {
|
|
do {
|
|
pvVar11 = (curList->_wispEL)._data;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar11) + uVar12 * 4)) =
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar11) + uVar12 * 4 + 4));
|
|
uVar12 = uVar12 + 1;
|
|
uVar6 = (curList->_wispEL)._size;
|
|
} while (uVar12 < uVar6 - 1);
|
|
}
|
|
uVar6 = uVar6 - 1;
|
|
(curList->_wispEL)._size = uVar6;
|
|
}
|
|
else {
|
|
uVar14 = uVar14 + 1;
|
|
}
|
|
} while (uVar14 < uVar6);
|
|
}
|
|
uVar6 = (curList->_mainEL)._size;
|
|
uVar14 = 0;
|
|
if (uVar6 != 0) {
|
|
do {
|
|
piVar13 = *GHIDRA_CAST<int **>((GHIDRA_INT((curList->_mainEL)._data) + uVar14 * 4));
|
|
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(piVar13) + 0x172)) == '\0') {
|
|
(**(code **)(*piVar13 + 0x44))();
|
|
*GHIDRA_CAST<undefined1 *>((*GHIDRA_CAST<int *>((GHIDRA_INT((curList->_mainEL)._data) + uVar14 * 4)) + 0x170)) = 0;
|
|
uVar6 = (curList->_mainEL)._size;
|
|
if (uVar6 <= uVar14) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: invalid index for remove\n"));
|
|
uVar6 = (curList->_mainEL)._size;
|
|
}
|
|
uVar12 = uVar14;
|
|
if (uVar14 < uVar6 - 1) {
|
|
do {
|
|
pvVar11 = (curList->_mainEL)._data;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar11) + uVar12 * 4)) =
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar11) + uVar12 * 4 + 4));
|
|
uVar12 = uVar12 + 1;
|
|
uVar6 = (curList->_mainEL)._size;
|
|
} while (uVar12 < uVar6 - 1);
|
|
}
|
|
uVar6 = uVar6 - 1;
|
|
(curList->_mainEL)._size = uVar6;
|
|
}
|
|
else {
|
|
uVar14 = uVar14 + 1;
|
|
}
|
|
} while (uVar14 < uVar6);
|
|
}
|
|
uVar6 = (curList->_persistentEL)._size;
|
|
uVar14 = 0;
|
|
if (uVar6 != 0) {
|
|
do {
|
|
piVar13 = *GHIDRA_CAST<int **>((GHIDRA_INT((curList->_persistentEL)._data) + uVar14 * 4));
|
|
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(piVar13) + 0x172)) == '\0') {
|
|
local_21 = SUB41(piVar13[0x5c],0);
|
|
(**(code **)(*piVar13 + 0x44))();
|
|
*GHIDRA_CAST<undefined1 *>((*GHIDRA_CAST<int *>((GHIDRA_INT((curList->_persistentEL)._data) + uVar14 * 4)) + 0x170)) = 0;
|
|
puVar8 = *GHIDRA_CAST<undefined4 **>((GHIDRA_INT((curList->_persistentEL)._data) + uVar14 * 4));
|
|
if (((puVar8[10] == 1) && (local_21 != false)) && (puVar8 != GHIDRA_CAST<undefined4 *>(0x0))) {
|
|
(**(code **)*puVar8)();
|
|
}
|
|
uVar6 = (curList->_persistentEL)._size;
|
|
if (uVar6 <= uVar14) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: invalid index for remove\n"));
|
|
uVar6 = (curList->_persistentEL)._size;
|
|
}
|
|
uVar12 = uVar14;
|
|
if (uVar14 < uVar6 - 1) {
|
|
do {
|
|
pvVar11 = (curList->_persistentEL)._data;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar11) + uVar12 * 4)) =
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar11) + uVar12 * 4 + 4));
|
|
uVar12 = uVar12 + 1;
|
|
uVar6 = (curList->_persistentEL)._size;
|
|
} while (uVar12 < uVar6 - 1);
|
|
}
|
|
uVar6 = uVar6 - 1;
|
|
(curList->_persistentEL)._size = uVar6;
|
|
}
|
|
else {
|
|
uVar14 = uVar14 + 1;
|
|
}
|
|
} while (uVar14 < uVar6);
|
|
}
|
|
}
|
|
if (isTransition == 0) {
|
|
rebuild_sublists(curList);
|
|
}
|
|
sort_by_render_z(curList);
|
|
if (local_64 != netplayEnd) {
|
|
local_64 = (NetplayManager)get_mt_state_checksum();
|
|
checksum = &curList[1]._updateEL;
|
|
(GHIDRA_CAST<Checksum *>((checksum)))->Checksum::Update(GHIDRA_CAST<byte *>(&local_64),4);
|
|
if ((curList[1]._updateEL._size == 0) &&
|
|
(isAnyFloorEntity = *GHIDRA_CAST<byte *>(&curList[1]._updateEL._data), isAnyFloorEntity != 0)) {
|
|
if (isAnyFloorEntity < 4) {
|
|
memset(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((checksum)) + 0x0))) + isAnyFloorEntity,0,GHIDRA_UINT((byte)(4 - isAnyFloorEntity)));
|
|
}
|
|
uVar6 = curList[1]._updateEL._capacity;
|
|
*GHIDRA_CAST<undefined1 *>(&curList[1]._updateEL._data) = 0;
|
|
curList[1]._updateEL._capacity = (uVar6 >> 1) + uVar6 * -0x80000000 + *GHIDRA_CAST<int *>(checksum);
|
|
}
|
|
checksumRecord[5] = curList[1]._updateEL._capacity;
|
|
*GHIDRA_CAST<NetplayManager *>((checksumRecord + 4)) = local_64;
|
|
}
|
|
ExceptionList = local_1c;
|
|
return;
|
|
}
|
|
|
|
// 00419750
|
|
void EntityList::sort_by_render_z()
|
|
{
|
|
uint uVar1;
|
|
uint lowRenderZ;
|
|
undefined4 swapTmp;
|
|
uint *highKey;
|
|
int highOffset;
|
|
void *pvVar3;
|
|
uint local_18;
|
|
uint local_14;
|
|
uint local_10;
|
|
int local_c;
|
|
uint renderCount;
|
|
longlong allocSize;
|
|
undefined4 *entitySlot;
|
|
int highOffset;
|
|
|
|
if (DAT_00c7e810 == (void *)0x0) {
|
|
allocSize = (ulonglong)GHIDRA_UINT((this->_renderEL)._capacity) * 4;
|
|
DAT_00c7e810 = operator_new_tracked
|
|
(-GHIDRA_UINT((GHIDRA_INT(((ulonglong)allocSize >> 0x20)) != 0)) | GHIDRA_UINT(allocSize));
|
|
}
|
|
highOffset = 0;
|
|
local_10 = (this->_renderEL)._size + -1;
|
|
if (0 < GHIDRA_INT(local_10)) {
|
|
do {
|
|
uVar1 = (**(code **)(**GHIDRA_CAST<int **>((GHIDRA_INT((this->_renderEL)._data) + local_10 * 4)) + 0x34))();
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(DAT_00c7e810) + local_10 * 4)) = uVar1;
|
|
if (uVar1 < 10000) {
|
|
for (; highOffset < GHIDRA_INT(local_10); highOffset = highOffset + 1) {
|
|
lowRenderZ = (**(code **)(**GHIDRA_CAST<int **>((GHIDRA_INT((this->_renderEL)._data) + highOffset * 4)) + 0x34))();
|
|
if (9999 < lowRenderZ) {
|
|
pvVar3 = (this->_renderEL)._data;
|
|
swapTmp = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar3) + highOffset * 4));
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar3) + highOffset * 4)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar3) + local_10 * 4));
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT((this->_renderEL)._data) + local_10 * 4)) = swapTmp;
|
|
pvVar3 = DAT_00c7e810;
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(DAT_00c7e810) + highOffset * 4)) = uVar1;
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(pvVar3) + local_10 * 4)) = lowRenderZ;
|
|
break;
|
|
}
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(DAT_00c7e810) + highOffset * 4)) = lowRenderZ;
|
|
}
|
|
}
|
|
local_10 = local_10 + -1;
|
|
} while (highOffset < GHIDRA_INT(local_10));
|
|
}
|
|
swapTmp = (**(code **)(**GHIDRA_CAST<int **>((GHIDRA_INT((this->_renderEL)._data) + highOffset * 4)) + 0x34))();
|
|
pvVar3 = DAT_00c7e810;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(DAT_00c7e810) + highOffset * 4)) = swapTmp;
|
|
highOffset = 0;
|
|
renderCount = (this->_renderEL)._size;
|
|
local_c = local_10 + 1;
|
|
if (GHIDRA_INT((renderCount - 1)) <= GHIDRA_INT(local_10)) {
|
|
local_c = local_10;
|
|
}
|
|
if (0 < local_c) {
|
|
do {
|
|
highOffset = local_c * 4;
|
|
highKey = GHIDRA_CAST<uint *>((highOffset + GHIDRA_INT(pvVar3)));
|
|
if (*highKey < 5000) {
|
|
for (; highOffset < local_c; highOffset = highOffset + 1) {
|
|
if (4999 < *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(pvVar3) + highOffset * 4))) {
|
|
pvVar3 = (this->_renderEL)._data;
|
|
entitySlot = GHIDRA_CAST<undefined4 *>((GHIDRA_INT(pvVar3) + highOffset * 4));
|
|
swapTmp = *entitySlot;
|
|
*entitySlot = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar3) + highOffset));
|
|
pvVar3 = DAT_00c7e810;
|
|
*GHIDRA_CAST<undefined4 *>((highOffset + GHIDRA_INT((this->_renderEL)._data))) = swapTmp;
|
|
uVar1 = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(pvVar3) + highOffset * 4));
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(pvVar3) + highOffset * 4)) = *highKey;
|
|
*highKey = uVar1;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
local_c = local_c + -1;
|
|
} while (highOffset < local_c);
|
|
renderCount = (this->_renderEL)._size;
|
|
}
|
|
highOffset = (GHIDRA_UINT((this->_renderEL)._capacity) >> 4) + 1;
|
|
if ((g_game->_frameCount & 1) == 0) {
|
|
local_14 = 1;
|
|
local_18 = 0;
|
|
while (local_14 < renderCount) {
|
|
if (local_14 != 0) {
|
|
local_10 = local_14;
|
|
local_c = local_18;
|
|
do {
|
|
if (*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(pvVar3) + local_10 * 4 + -4)) <= *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(pvVar3) + local_10 * 4)))
|
|
break;
|
|
pvVar3 = (this->_renderEL)._data;
|
|
highOffset = highOffset + -1;
|
|
entitySlot = GHIDRA_CAST<undefined4 *>((GHIDRA_INT(pvVar3) + local_10 * 4));
|
|
swapTmp = *entitySlot;
|
|
*entitySlot = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar3) + local_c));
|
|
pvVar3 = DAT_00c7e810;
|
|
*GHIDRA_CAST<undefined4 *>((local_c + GHIDRA_INT((this->_renderEL)._data))) = swapTmp;
|
|
swapTmp = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar3) + local_10 * 4));
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar3) + local_10 * 4)) =
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar3) + local_10 * 4 + -4));
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar3) + local_10 * 4 + -4)) = swapTmp;
|
|
local_10 = local_10 - 1;
|
|
local_c = local_c + -4;
|
|
} while (local_10 != 0);
|
|
}
|
|
local_14 = local_14 + 1;
|
|
local_18 = local_18 + 4;
|
|
if (highOffset < 1) {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
local_14 = renderCount - 1;
|
|
local_10 = local_14 * 4;
|
|
do {
|
|
local_10 = local_10 + -4;
|
|
if (local_14 == 0) {
|
|
return;
|
|
}
|
|
if (local_14 < renderCount) {
|
|
local_c = local_10;
|
|
local_18 = local_14;
|
|
do {
|
|
if (*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(pvVar3) + local_18 * 4 + -4)) <= *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(pvVar3) + local_18 * 4)))
|
|
break;
|
|
pvVar3 = (this->_renderEL)._data;
|
|
highOffset = highOffset + -1;
|
|
entitySlot = GHIDRA_CAST<undefined4 *>((GHIDRA_INT(pvVar3) + local_18 * 4));
|
|
swapTmp = *entitySlot;
|
|
*entitySlot = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar3) + local_c));
|
|
pvVar3 = DAT_00c7e810;
|
|
*GHIDRA_CAST<undefined4 *>((local_c + GHIDRA_INT((this->_renderEL)._data))) = swapTmp;
|
|
swapTmp = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar3) + local_18 * 4));
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar3) + local_18 * 4)) =
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar3) + local_18 * 4 + -4));
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar3) + local_18 * 4 + -4)) = swapTmp;
|
|
local_18 = local_18 + 1;
|
|
local_c = local_c + 4;
|
|
} while (local_18 < renderCount);
|
|
}
|
|
local_14 = local_14 - 1;
|
|
} while (0 < highOffset);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 004199d0
|
|
void EntityList::render_up_to(uint maxDepth, Vector *offset)
|
|
{
|
|
Entity *this_00;
|
|
uint uVar1;
|
|
bool isSkipRender;
|
|
float savedOffsetX;
|
|
Vector mirrorOffset;
|
|
int waterFlagsMode3 [2];
|
|
uint waterFlagsMode4 [2];
|
|
byte waterFlagsMode5 [12];
|
|
int gridCollisionClass;
|
|
float mirrorOffsetX;
|
|
float savedOffsetX;
|
|
float savedOffsetY;
|
|
|
|
uVar1 = this->_renderCursor;
|
|
if (uVar1 < GHIDRA_UINT((this->_renderEL)._size)) {
|
|
do {
|
|
this_00 = *GHIDRA_CAST<Entity **>((GHIDRA_INT((this->_renderEL)._data) + uVar1 * 4));
|
|
uVar1 = this_00->GetRenderZ();
|
|
if (maxDepth <= uVar1) {
|
|
return;
|
|
}
|
|
switch(this->_renderMode) {
|
|
case 2:
|
|
break;
|
|
case 3:
|
|
(GHIDRA_CAST<Entity *>((this_00)))->Entity::get_water_splash_variant(waterFlagsMode3);
|
|
isSkipRender = ((byte)waterFlagsMode3[0] & 0x42) == 2;
|
|
LAB_00419a25:
|
|
if (!isSkipRender) goto switchD_00419a0a_default;
|
|
break;
|
|
case 4:
|
|
(GHIDRA_CAST<Entity *>((this_00)))->Entity::get_water_splash_variant(GHIDRA_CAST<int *>(waterFlagsMode4));
|
|
if ((waterFlagsMode4[0] & 0x48) == 0) {
|
|
isSkipRender = (waterFlagsMode4[0] & 6) == 0;
|
|
goto LAB_00419a25;
|
|
}
|
|
break;
|
|
case 5:
|
|
(GHIDRA_CAST<Entity *>((this_00)))->Entity::get_water_splash_variant(GHIDRA_CAST<int *>(waterFlagsMode5));
|
|
mirrorOffsetX = g_vectorZero.x;
|
|
if ((waterFlagsMode5[0] & 0x60) == 0) {
|
|
if ((this_00->_type == 1) &&
|
|
((((gridCollisionClass = this_00->_entityGridCollisionClass, gridCollisionClass == 0 ||
|
|
(gridCollisionClass == 3)) || (gridCollisionClass == 1)) ||
|
|
(gridCollisionClass == 2)))) {
|
|
savedOffsetX = g_vectorZero.y + 4.0;
|
|
}
|
|
else {
|
|
savedOffsetX = g_vectorZero.y - 0.0;
|
|
}
|
|
savedOffsetY = (this_00->_posOffset).y;
|
|
savedOffsetX = (this_00->_posOffset).x;
|
|
(this_00->_posOffset).x = savedOffsetX;
|
|
(this_00->_posOffset).y = -savedOffsetY;
|
|
mirrorOffset.x = mirrorOffsetX + offset->x;
|
|
mirrorOffset.y = savedOffsetX + offset->y;
|
|
DAT_00c7977d = 1;
|
|
this_00->Render(&mirrorOffset);
|
|
(this_00->_posOffset).x = savedOffsetX;
|
|
DAT_00c7977d = 0;
|
|
(this_00->_posOffset).y = savedOffsetY;
|
|
}
|
|
break;
|
|
default:
|
|
switchD_00419a0a_default:
|
|
this_00->Render(offset);
|
|
}
|
|
uVar1 = this->_renderCursor + 1;
|
|
this->_renderCursor = uVar1;
|
|
} while (uVar1 < GHIDRA_UINT((this->_renderEL)._size));
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 00419e70
|
|
void EntityList::rebuild_sublists()
|
|
{
|
|
undefined4 uVar1;
|
|
float fVar2;
|
|
bool bVar3;
|
|
undefined4 uVar4;
|
|
undefined4 *playerSlot;
|
|
int iVar5;
|
|
void *pvVar6;
|
|
void *playerListEnd;
|
|
Entity *this_00;
|
|
Entity *this_01;
|
|
PlayerManager *playerManager;
|
|
uint entityIndex;
|
|
uint listIndex;
|
|
uint local_14;
|
|
Game *game;
|
|
Entity *tmpEntity;
|
|
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x6c)))) = 0;
|
|
FUN_0041baf0();
|
|
FUN_0041baf0();
|
|
FUN_0041baf0();
|
|
FUN_0041baf0();
|
|
FUN_0041baf0();
|
|
FUN_0041baf0();
|
|
FUN_0041baf0();
|
|
FUN_0041baf0();
|
|
local_14 = 0;
|
|
bVar3 = false;
|
|
listIndex = 0;
|
|
if ((this->_updateEL)._size != 0) {
|
|
do {
|
|
tmpEntity = *GHIDRA_CAST<Entity **>((GHIDRA_INT((this->_updateEL)._data) + listIndex * 4));
|
|
tmpEntity->_collidesWithEntity = 0;
|
|
if (tmpEntity->_entityCollisionClass != 0) {
|
|
iVar5 = tmpEntity->_type;
|
|
if (iVar5 == 3) {
|
|
if (tmpEntity->_variant == 0xef) {
|
|
(GHIDRA_CAST<CellSpace *>((*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x8))))))->CellSpace::insert(tmpEntity);
|
|
playerListEnd = *(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x1c)));
|
|
}
|
|
else {
|
|
playerListEnd = *(void **)this;
|
|
}
|
|
LAB_0041a0aa:
|
|
(GHIDRA_CAST<CellSpace *>((playerListEnd)))->CellSpace::insert(tmpEntity);
|
|
LAB_0041a0b4:
|
|
tmpEntity->_collisionIndex = local_14;
|
|
iVar5 = tmpEntity->_type;
|
|
local_14 = local_14 + 1;
|
|
}
|
|
else {
|
|
if (iVar5 == 9) {
|
|
(GHIDRA_CAST<CellSpace *>((*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0xc))))))->CellSpace::insert(tmpEntity);
|
|
if ((!bVar3) && ((tmpEntity[1]._variant & 0x1000U) != 0)) {
|
|
bVar3 = true;
|
|
}
|
|
if ((tmpEntity[1]._type & 0x80U) == 0) goto LAB_0041a0b4;
|
|
playerListEnd = *(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x14)));
|
|
goto LAB_0041a0aa;
|
|
}
|
|
if ((iVar5 == 2) || (iVar5 == 8)) {
|
|
if ((!bVar3) && (iVar5 == 2)) {
|
|
if (((GHIDRA_UINT(tmpEntity[1]._pendingDamageFlags) & GHIDRA_UINT(g_tearFlagShielded._l)) != 0 ||
|
|
(*GHIDRA_CAST<uint *>((GHIDRA_INT(&tmpEntity[1]._pendingDamageFlags) + 4)) &
|
|
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(g_tearFlagShielded._l)) + 0x4)))) != 0) ||
|
|
((tmpEntity[1]._index & GHIDRA_UINT(g_tearFlagShielded._h)) != 0 ||
|
|
(tmpEntity[1]._collisionIndex & (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(g_tearFlagShielded._h)) + 0x4)))) != 0)) {
|
|
bVar3 = true;
|
|
}
|
|
}
|
|
playerListEnd = *(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x4)));
|
|
goto LAB_0041a0aa;
|
|
}
|
|
if ((((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (iVar5 == 1)) || (iVar5 - 10U < 0x3de))
|
|
|| (iVar5 == 4)) {
|
|
(GHIDRA_CAST<CellSpace *>((*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x8))))))->CellSpace::insert(tmpEntity);
|
|
iVar5 = tmpEntity->_type;
|
|
if (((iVar5 == 0x196) || (iVar5 == 0x394)) ||
|
|
((iVar5 == 4 && ((tmpEntity->_variant == 0x13 || (tmpEntity->_variant == 0x14)))))) {
|
|
(GHIDRA_CAST<CellSpace *>((*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x18))))))->CellSpace::insert(tmpEntity);
|
|
iVar5 = tmpEntity->_type;
|
|
}
|
|
if ((((((tmpEntity->_flags & 0x20000000) != 0) || (iVar5 == 0xf5)) || (iVar5 == 0x3c3))
|
|
|| (((tmpEntity->_flags & 0x10000000000000) != 0 || (iVar5 == 0x322)))) ||
|
|
(iVar5 == 0x362)) {
|
|
playerListEnd = *(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x1c)));
|
|
goto LAB_0041a0aa;
|
|
}
|
|
goto LAB_0041a0b4;
|
|
}
|
|
if ((iVar5 == 5) || (iVar5 == 6)) {
|
|
playerListEnd = *(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x10)));
|
|
goto LAB_0041a0aa;
|
|
}
|
|
if (iVar5 == 1) goto LAB_0041a0b4;
|
|
}
|
|
if (iVar5 == 1000) {
|
|
iVar5 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x6c))));
|
|
if (*GHIDRA_CAST<uint *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x68)))) < iVar5 + 1U) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: not enough space for push_back\n"));
|
|
iVar5 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x6c))));
|
|
}
|
|
*GHIDRA_CAST<Entity **>((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x64)))) + iVar5 * 4)) = tmpEntity;
|
|
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x6c)))) = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x6c)))) + 1;
|
|
}
|
|
}
|
|
listIndex = listIndex + 1;
|
|
} while (listIndex < GHIDRA_UINT((this->_updateEL)._size));
|
|
}
|
|
uVar1 = *GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1c))));
|
|
*GHIDRA_CAST<undefined4 *>(&this[1]._mainEL) = uVar1;
|
|
this[1]._mainEL._capacity = 0;
|
|
uVar4 = FUN_0041ca00(local_14 * local_14,uVar1,0);
|
|
uVar1 = *GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(this[1])) + 0x1c))));
|
|
FUN_0041c910(uVar4);
|
|
FUN_0041c910(local_14 * local_14);
|
|
FUN_0041cb90(uVar1,0,uVar1,0);
|
|
this[1]._mainEL._size = local_14;
|
|
if (1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) {
|
|
(GHIDRA_CAST<CellSpace *>((*(void **)this)))->CellSpace::collide(*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x4))));
|
|
(GHIDRA_CAST<CellSpace *>((*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x4))))))->CellSpace::collide(*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x4))));
|
|
}
|
|
(GHIDRA_CAST<CellSpace *>((*(void **)this)))->CellSpace::collide(*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0xc))));
|
|
(GHIDRA_CAST<CellSpace *>((*(void **)this)))->CellSpace::collide(*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x8))));
|
|
playerManager = &g_game->_playerManager;
|
|
local_14 = 0;
|
|
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2
|
|
!= 0) {
|
|
do {
|
|
playerListEnd = *(void **)this;
|
|
pvVar6 = (playerManager->_playerList)._end;
|
|
if (GHIDRA_INT(pvVar6) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("(GHIDRA_CAST<PlayerManager *>(()))->PlayerManager::GetPlayer() : There are no players! \n"));
|
|
pvVar6 = (playerManager->_playerList)._end;
|
|
}
|
|
playerSlot = (playerManager->_playerList)._begin;
|
|
if (local_14 < GHIDRA_UINT((GHIDRA_INT(pvVar6) - GHIDRA_INT(playerSlot) >> 2))) {
|
|
playerSlot = playerSlot + local_14;
|
|
}
|
|
(GHIDRA_CAST<CellSpace *>((playerListEnd)))->CellSpace::collide_entity(GHIDRA_CAST<Entity *>(*playerSlot));
|
|
playerManager = &g_game->_playerManager;
|
|
local_14 = local_14 + 1;
|
|
} while (local_14 <
|
|
GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((playerManager->_playerList)._begin) >> 2)));
|
|
}
|
|
(GHIDRA_CAST<CellSpace *>((*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x4))))))->CellSpace::collide(*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x8))));
|
|
(GHIDRA_CAST<CellSpace *>((*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x8))))))->CellSpace::collide_self();
|
|
local_14 = 0;
|
|
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) {
|
|
do {
|
|
game = g_game;
|
|
playerListEnd = *(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x8)));
|
|
pvVar6 = (g_game->_playerManager)._playerList._end;
|
|
if (GHIDRA_INT(pvVar6) - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("(GHIDRA_CAST<PlayerManager *>(()))->PlayerManager::GetPlayer() : There are no players! \n"));
|
|
pvVar6 = (game->_playerManager)._playerList._end;
|
|
}
|
|
playerSlot = (game->_playerManager)._playerList._begin;
|
|
if (local_14 < GHIDRA_UINT((GHIDRA_INT(pvVar6) - GHIDRA_INT(playerSlot) >> 2))) {
|
|
playerSlot = playerSlot + local_14;
|
|
}
|
|
(GHIDRA_CAST<CellSpace *>((playerListEnd)))->CellSpace::collide_entity(GHIDRA_CAST<Entity *>(*playerSlot));
|
|
local_14 = local_14 + 1;
|
|
} while (local_14 <
|
|
GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2)));
|
|
}
|
|
local_14 = 0;
|
|
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) {
|
|
do {
|
|
game = g_game;
|
|
playerListEnd = *(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0xc)));
|
|
pvVar6 = (g_game->_playerManager)._playerList._end;
|
|
if (GHIDRA_INT(pvVar6) - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("(GHIDRA_CAST<PlayerManager *>(()))->PlayerManager::GetPlayer() : There are no players! \n"));
|
|
pvVar6 = (game->_playerManager)._playerList._end;
|
|
}
|
|
playerSlot = (game->_playerManager)._playerList._begin;
|
|
if (local_14 < GHIDRA_UINT((GHIDRA_INT(pvVar6) - GHIDRA_INT(playerSlot) >> 2))) {
|
|
playerSlot = playerSlot + local_14;
|
|
}
|
|
(GHIDRA_CAST<CellSpace *>((playerListEnd)))->CellSpace::collide_entity(GHIDRA_CAST<Entity *>(*playerSlot));
|
|
local_14 = local_14 + 1;
|
|
} while (local_14 <
|
|
GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2)));
|
|
}
|
|
local_14 = 0;
|
|
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) {
|
|
do {
|
|
game = g_game;
|
|
playerListEnd = *(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x10)));
|
|
pvVar6 = (g_game->_playerManager)._playerList._end;
|
|
if (GHIDRA_INT(pvVar6) - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("(GHIDRA_CAST<PlayerManager *>(()))->PlayerManager::GetPlayer() : There are no players! \n"));
|
|
pvVar6 = (game->_playerManager)._playerList._end;
|
|
}
|
|
playerSlot = (game->_playerManager)._playerList._begin;
|
|
if (local_14 < GHIDRA_UINT((GHIDRA_INT(pvVar6) - GHIDRA_INT(playerSlot) >> 2))) {
|
|
playerSlot = playerSlot + local_14;
|
|
}
|
|
(GHIDRA_CAST<CellSpace *>((playerListEnd)))->CellSpace::collide_entity(GHIDRA_CAST<Entity *>(*playerSlot));
|
|
local_14 = local_14 + 1;
|
|
} while (local_14 <
|
|
GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2)));
|
|
}
|
|
if (1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) {
|
|
playerManager = &g_game->_playerManager;
|
|
local_14 = 0;
|
|
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >>
|
|
2 != 0) {
|
|
do {
|
|
playerListEnd = *(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x4)));
|
|
pvVar6 = (playerManager->_playerList)._end;
|
|
if (GHIDRA_INT(pvVar6) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("(GHIDRA_CAST<PlayerManager *>(()))->PlayerManager::GetPlayer() : There are no players! \n"));
|
|
pvVar6 = (playerManager->_playerList)._end;
|
|
}
|
|
playerSlot = (playerManager->_playerList)._begin;
|
|
if (local_14 < GHIDRA_UINT((GHIDRA_INT(pvVar6) - GHIDRA_INT(playerSlot) >> 2))) {
|
|
playerSlot = playerSlot + local_14;
|
|
}
|
|
(GHIDRA_CAST<CellSpace *>((playerListEnd)))->CellSpace::collide_entity(GHIDRA_CAST<Entity *>(*playerSlot));
|
|
playerManager = &g_game->_playerManager;
|
|
local_14 = local_14 + 1;
|
|
} while (local_14 <
|
|
GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((playerManager->_playerList)._begin) >> 2)));
|
|
}
|
|
}
|
|
(GHIDRA_CAST<CellSpace *>((*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x10))))))->CellSpace::collide_self();
|
|
(GHIDRA_CAST<CellSpace *>((*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x10))))))->CellSpace::collide(*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x18))));
|
|
(GHIDRA_CAST<CellSpace *>((*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x14))))))->CellSpace::collide(*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x8))));
|
|
if (bVar3) {
|
|
(GHIDRA_CAST<CellSpace *>((*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0xc))))))->CellSpace::collide(*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x4))));
|
|
}
|
|
(GHIDRA_CAST<CellSpace *>((*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x1c))))))->CellSpace::collide(*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0xc))));
|
|
(GHIDRA_CAST<CellSpace *>((*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x1c))))))->CellSpace::collide(*(void **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x8))));
|
|
playerManager = &g_game->_playerManager;
|
|
local_14 = 0;
|
|
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2
|
|
!= 0) {
|
|
do {
|
|
playerListEnd = (playerManager->_playerList)._end;
|
|
playerSlot = (playerManager->_playerList)._begin;
|
|
if (GHIDRA_INT(playerListEnd) - GHIDRA_INT(playerSlot) >> 2 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("(GHIDRA_CAST<PlayerManager *>(()))->PlayerManager::GetPlayer() : There are no players! \n"));
|
|
playerListEnd = (playerManager->_playerList)._end;
|
|
playerSlot = (playerManager->_playerList)._begin;
|
|
}
|
|
if (local_14 < GHIDRA_UINT((GHIDRA_INT(playerListEnd) - GHIDRA_INT(playerSlot) >> 2))) {
|
|
playerSlot = playerSlot + local_14;
|
|
}
|
|
tmpEntity = GHIDRA_CAST<Entity *>(*playerSlot);
|
|
this_01 = GHIDRA_CAST<Entity *>(tmpEntity[7]._splatColor._colorize[1]);
|
|
if ((this_01 != GHIDRA_CAST<Entity *>(0x0)) &&
|
|
(((fVar2 = this_01[5]._color._colorize[1], fVar2 == -NAN ||
|
|
(GHIDRA_INT(tmpEntity[5]._color._colorize[1]) <= GHIDRA_INT(fVar2))) || (this_01 == tmpEntity)))) {
|
|
if ((g_game->_frameCount & 1) == 0) {
|
|
if (((((tmpEntity->_sizeMulti).x == g_vectorOne.x) &&
|
|
((tmpEntity->_sizeMulti).y == g_vectorOne.y)) &&
|
|
((this_01->_sizeMulti).x == g_vectorOne.x)) &&
|
|
((this_01->_sizeMulti).y == g_vectorOne.y)) {
|
|
(GHIDRA_CAST<Entity *>((tmpEntity)))->Entity::push_apart_circle(this_01);
|
|
}
|
|
else {
|
|
(GHIDRA_CAST<Entity *>((tmpEntity)))->Entity::push_apart_capsule(this_01);
|
|
}
|
|
if ((((this_01->_sizeMulti).x == g_vectorOne.x) &&
|
|
((this_01->_sizeMulti).y == g_vectorOne.y)) &&
|
|
(((tmpEntity->_sizeMulti).x == g_vectorOne.x &&
|
|
((tmpEntity->_sizeMulti).y == g_vectorOne.y)))) {
|
|
(GHIDRA_CAST<Entity *>((this_01)))->Entity::push_apart_circle(tmpEntity);
|
|
}
|
|
else {
|
|
this_00 = this_01;
|
|
this_01 = tmpEntity;
|
|
LAB_0041a727:
|
|
(GHIDRA_CAST<Entity *>((this_00)))->Entity::push_apart_capsule(this_01);
|
|
}
|
|
}
|
|
else {
|
|
if ((((this_01->_sizeMulti).x == g_vectorOne.x) &&
|
|
((this_01->_sizeMulti).y == g_vectorOne.y)) &&
|
|
(((tmpEntity->_sizeMulti).x == g_vectorOne.x &&
|
|
((tmpEntity->_sizeMulti).y == g_vectorOne.y)))) {
|
|
(GHIDRA_CAST<Entity *>((this_01)))->Entity::push_apart_circle(tmpEntity);
|
|
}
|
|
else {
|
|
(GHIDRA_CAST<Entity *>((this_01)))->Entity::push_apart_capsule(tmpEntity);
|
|
}
|
|
if ((((tmpEntity->_sizeMulti).x != g_vectorOne.x) ||
|
|
((tmpEntity->_sizeMulti).y != g_vectorOne.y)) ||
|
|
(((this_01->_sizeMulti).x != g_vectorOne.x ||
|
|
((this_01->_sizeMulti).y != g_vectorOne.y)))) {
|
|
this_00 = tmpEntity;
|
|
goto LAB_0041a727;
|
|
}
|
|
(GHIDRA_CAST<Entity *>((tmpEntity)))->Entity::push_apart_circle(this_01);
|
|
}
|
|
}
|
|
playerManager = &g_game->_playerManager;
|
|
local_14 = local_14 + 1;
|
|
} while (local_14 <
|
|
GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((playerManager->_playerList)._begin) >> 2)));
|
|
}
|
|
entityIndex = 0;
|
|
if ((this->_updateEL)._size != 0) {
|
|
do {
|
|
tmpEntity = *GHIDRA_CAST<Entity **>((GHIDRA_INT((this->_updateEL)._data) + entityIndex * 4));
|
|
if (tmpEntity->_type != 7) {
|
|
if (tmpEntity->_type == 1) {
|
|
(GHIDRA_CAST<Entity *>((tmpEntity)))->Entity::PlayerCollideWithGrid(0);
|
|
}
|
|
else {
|
|
(GHIDRA_CAST<Entity *>((tmpEntity)))->Entity::CollideWithGrid(0);
|
|
}
|
|
}
|
|
entityIndex = entityIndex + 1;
|
|
} while (entityIndex < GHIDRA_UINT((this->_updateEL)._size));
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 0041b4f0
|
|
void EntityList::AddPersistentEntity(Entity *entity)
|
|
{
|
|
int *piVar1;
|
|
uint i;
|
|
uint size;
|
|
|
|
if (GHIDRA_UINT((this->_persistentEL)._capacity) <= (this->_persistentEL)._size + 0x32U) {
|
|
KAGE_LogMessage(1,(byte *)
|
|
"[warn] Can\'t add more persistent entities, persistent list is full!\n");
|
|
return;
|
|
}
|
|
(GHIDRA_CAST<EntityList_EL *>((&this->_mainEL)))->EntityList_EL::remove(entity);
|
|
size = (this->_persistentEL)._size;
|
|
i = 0;
|
|
if (size != 0) {
|
|
piVar1 = (this->_persistentEL)._data;
|
|
do {
|
|
if (entity == GHIDRA_CAST<Entity *>(*piVar1)) {
|
|
return;
|
|
}
|
|
i = i + 1;
|
|
piVar1 = piVar1 + 1;
|
|
} while (i < size);
|
|
}
|
|
if (GHIDRA_UINT((this->_persistentEL)._capacity) < size + 1) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: not enough space for push_back\n"));
|
|
size = (this->_persistentEL)._size;
|
|
}
|
|
*GHIDRA_CAST<Entity **>((GHIDRA_INT((this->_persistentEL)._data) + size * 4)) = entity;
|
|
piVar1 = &(this->_persistentEL)._size;
|
|
*piVar1 = *piVar1 + 1;
|
|
return;
|
|
}
|
|
|
|
// 0041b570
|
|
void EntityList::invalidate_type_cache(int type, int variant, int subType)
|
|
{
|
|
int iVar1;
|
|
undefined1 findResult [8];
|
|
int foundNode;
|
|
int keyType;
|
|
int keyVariant;
|
|
int keySubType;
|
|
int *cacheHead;
|
|
|
|
iVar1 = variant;
|
|
keySubType = subType;
|
|
cacheHead = &this[1]._persistentEL._capacity;
|
|
keyType = type;
|
|
keyVariant = variant;
|
|
FUN_0041d390(findResult,&keyType);
|
|
if (((*GHIDRA_CAST<char *>((foundNode + 0xd)) == '\0') && (*GHIDRA_CAST<int *>((foundNode + 0x10)) <= type)) &&
|
|
((*GHIDRA_CAST<int *>((foundNode + 0x10)) < type ||
|
|
((*GHIDRA_CAST<int *>((foundNode + 0x14)) <= iVar1 &&
|
|
((*GHIDRA_CAST<int *>((foundNode + 0x14)) < iVar1 || (*GHIDRA_CAST<int *>((foundNode + 0x18)) <= subType)))))))) {
|
|
subType = *cacheHead;
|
|
if (foundNode != subType) {
|
|
FUN_0041cc60(&subType,foundNode);
|
|
goto LAB_0041b5d4;
|
|
}
|
|
}
|
|
else {
|
|
LAB_0041b5d4:
|
|
subType = *cacheHead;
|
|
}
|
|
iVar1 = subType;
|
|
keyVariant = variant;
|
|
keyType = type;
|
|
keySubType = 0xffffffff;
|
|
FUN_0041d390(findResult,&keyType);
|
|
if ((*GHIDRA_CAST<char *>((foundNode + 0xd)) == '\0') && (*GHIDRA_CAST<int *>((foundNode + 0x10)) <= type)) {
|
|
if (type <= *GHIDRA_CAST<int *>((foundNode + 0x10))) {
|
|
if ((variant < *GHIDRA_CAST<int *>((foundNode + 0x14))) ||
|
|
((variant <= *GHIDRA_CAST<int *>((foundNode + 0x14)) && (*GHIDRA_CAST<uint *>((foundNode + 0x18)) < 0x80000000))))
|
|
goto LAB_0041b62c;
|
|
}
|
|
if (foundNode != iVar1) {
|
|
FUN_0041cc60(&variant,foundNode);
|
|
iVar1 = *cacheHead;
|
|
}
|
|
}
|
|
else {
|
|
LAB_0041b62c:
|
|
iVar1 = subType;
|
|
}
|
|
keyType = type;
|
|
keyVariant = 0xffffffff;
|
|
keySubType = 0xffffffff;
|
|
FUN_0041d390(findResult,&keyType);
|
|
if ((((*GHIDRA_CAST<char *>((foundNode + 0xd)) == '\0') && (*GHIDRA_CAST<int *>((foundNode + 0x10)) <= type)) &&
|
|
((*GHIDRA_CAST<int *>((foundNode + 0x10)) < type ||
|
|
((0x7fffffff < *GHIDRA_CAST<uint *>((foundNode + 0x14)) &&
|
|
((GHIDRA_INT(*GHIDRA_CAST<uint *>((foundNode + 0x14))) < -1 || (0x7fffffff < *GHIDRA_CAST<uint *>((foundNode + 0x18))))))))))
|
|
&& (foundNode != iVar1)) {
|
|
FUN_0041cc60(&variant,foundNode);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 0041b7b0
|
|
int EntityList::CountEntities(Entity *spawner, int type, int variant, int subType)
|
|
{
|
|
int iVar1;
|
|
uint i;
|
|
int newCount;
|
|
uint entityCount;
|
|
undefined4 *slot;
|
|
Entity *entity;
|
|
|
|
if (spawner == GHIDRA_CAST<Entity *>(0x0)) {
|
|
iVar1 = FUN_0041b690(type,variant,subType);
|
|
return iVar1;
|
|
}
|
|
iVar1 = 0;
|
|
entityCount = (this->_updateEL)._size;
|
|
if (variant < 0) {
|
|
if (subType < 0) {
|
|
if (type == 0) {
|
|
if (entityCount != 0) {
|
|
slot = (this->_updateEL)._data;
|
|
do {
|
|
entity = GHIDRA_CAST<Entity *>(*slot);
|
|
slot = slot + 1;
|
|
newCount = iVar1 + 1;
|
|
if (entity->_spawnerEntity != (EntityPtr)spawner) {
|
|
newCount = iVar1;
|
|
}
|
|
entityCount = entityCount - 1;
|
|
iVar1 = newCount;
|
|
} while (entityCount != 0);
|
|
return newCount;
|
|
}
|
|
}
|
|
else {
|
|
i = 0;
|
|
if (entityCount != 0) {
|
|
do {
|
|
newCount = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_updateEL)._data) + i * 4));
|
|
if ((*GHIDRA_CAST<int *>((newCount + 0x28)) == type) && (*GHIDRA_CAST<Entity **>((newCount + 0x3c8)) == spawner))
|
|
{
|
|
iVar1 = iVar1 + 1;
|
|
}
|
|
i = i + 1;
|
|
} while (i < entityCount);
|
|
return iVar1;
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
i = 0;
|
|
if (type == 0) {
|
|
if (entityCount != 0) {
|
|
do {
|
|
newCount = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_updateEL)._data) + i * 4));
|
|
if ((*GHIDRA_CAST<int *>((newCount + 0x30)) == subType) &&
|
|
(*GHIDRA_CAST<Entity **>((newCount + 0x3c8)) == spawner)) {
|
|
iVar1 = iVar1 + 1;
|
|
}
|
|
i = i + 1;
|
|
} while (i < entityCount);
|
|
return iVar1;
|
|
}
|
|
}
|
|
else if (entityCount != 0) {
|
|
do {
|
|
newCount = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_updateEL)._data) + i * 4));
|
|
if (((*GHIDRA_CAST<int *>((newCount + 0x28)) == type) && (*GHIDRA_CAST<int *>((newCount + 0x30)) == subType)) &&
|
|
(*GHIDRA_CAST<Entity **>((newCount + 0x3c8)) == spawner)) {
|
|
iVar1 = iVar1 + 1;
|
|
}
|
|
i = i + 1;
|
|
} while (i < entityCount);
|
|
return iVar1;
|
|
}
|
|
}
|
|
}
|
|
else if (subType < 0) {
|
|
i = 0;
|
|
if (type == 0) {
|
|
if (entityCount != 0) {
|
|
do {
|
|
newCount = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_updateEL)._data) + i * 4));
|
|
if ((*GHIDRA_CAST<int *>((newCount + 0x2c)) == variant) && (*GHIDRA_CAST<Entity **>((newCount + 0x3c8)) == spawner))
|
|
{
|
|
iVar1 = iVar1 + 1;
|
|
}
|
|
i = i + 1;
|
|
} while (i < entityCount);
|
|
return iVar1;
|
|
}
|
|
}
|
|
else if (entityCount != 0) {
|
|
do {
|
|
newCount = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_updateEL)._data) + i * 4));
|
|
if (((*GHIDRA_CAST<int *>((newCount + 0x28)) == type) && (*GHIDRA_CAST<int *>((newCount + 0x2c)) == variant)) &&
|
|
(*GHIDRA_CAST<Entity **>((newCount + 0x3c8)) == spawner)) {
|
|
iVar1 = iVar1 + 1;
|
|
}
|
|
i = i + 1;
|
|
} while (i < entityCount);
|
|
return iVar1;
|
|
}
|
|
}
|
|
else if (type == 0) {
|
|
i = 0;
|
|
if (entityCount != 0) {
|
|
do {
|
|
newCount = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_updateEL)._data) + i * 4));
|
|
if (((*GHIDRA_CAST<int *>((newCount + 0x2c)) == variant) && (*GHIDRA_CAST<int *>((newCount + 0x30)) == subType)) &&
|
|
(*GHIDRA_CAST<Entity **>((newCount + 0x3c8)) == spawner)) {
|
|
iVar1 = iVar1 + 1;
|
|
}
|
|
i = i + 1;
|
|
} while (i < entityCount);
|
|
return iVar1;
|
|
}
|
|
}
|
|
else {
|
|
i = 0;
|
|
if (entityCount != 0) {
|
|
do {
|
|
newCount = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_updateEL)._data) + i * 4));
|
|
if ((((*GHIDRA_CAST<int *>((newCount + 0x28)) == type) && (*GHIDRA_CAST<int *>((newCount + 0x2c)) == variant)) &&
|
|
(*GHIDRA_CAST<int *>((newCount + 0x30)) == subType)) && (*GHIDRA_CAST<Entity **>((newCount + 0x3c8)) == spawner))
|
|
{
|
|
iVar1 = iVar1 + 1;
|
|
}
|
|
i = i + 1;
|
|
} while (i < entityCount);
|
|
}
|
|
}
|
|
return iVar1;
|
|
}
|
|
|
|
// 00431640
|
|
byte EntityList::HitListContains(Entity *entity)
|
|
{
|
|
uint hitListIndex;
|
|
uint uVar1;
|
|
uint count;
|
|
uint *lowerBound;
|
|
|
|
hitListIndex = (GHIDRA_CAST<Entity *>((entity)))->Entity::GetHitListIndex();
|
|
lowerBound = *GHIDRA_CAST<uint **>(this);
|
|
uVar1 = GHIDRA_INT(*(uint **))&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x4))) - GHIDRA_INT(lowerBound) >> 2;
|
|
while (count = uVar1, 0 < GHIDRA_INT(count)) {
|
|
uVar1 = count >> 1;
|
|
if (lowerBound[uVar1] < hitListIndex) {
|
|
lowerBound = lowerBound + uVar1 + 1;
|
|
uVar1 = count + (-1 - uVar1);
|
|
}
|
|
}
|
|
if ((lowerBound == *GHIDRA_CAST<uint **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x4))))) || (*lowerBound != hitListIndex)) {
|
|
return 0;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
// 006b8320
|
|
EntityList_EL * EntityList::assign(EntityList_EL *dest, EntityList_EL *source)
|
|
{
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 local_8;
|
|
uint copyCount;
|
|
|
|
puStack_c = &LAB_00afa49e;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
local_8 = 0;
|
|
sublist_init(GHIDRA_CAST<EntityList *>(dest),GHIDRA_CAST<EntityList_EL *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x80)))),source->_size);
|
|
local_8 = 0;
|
|
copyCount = source->_size;
|
|
if (GHIDRA_UINT(dest->_capacity) < copyCount) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: not enough space for copy\n"));
|
|
copyCount = source->_size;
|
|
}
|
|
memcpy(dest->_data,source->_data,copyCount << 2);
|
|
dest->_size = source->_size;
|
|
ExceptionList = local_10;
|
|
return dest;
|
|
}
|
|
|
|
// 0085e0c0
|
|
Entity * EntityList::Get(uint index)
|
|
{
|
|
uint clampedIndex;
|
|
uint clampedIndex;
|
|
|
|
clampedIndex = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0xc)))) - 1;
|
|
clampedIndex = -GHIDRA_UINT((index != 0)) & index;
|
|
if (clampedIndex < clampedIndex) {
|
|
clampedIndex = clampedIndex;
|
|
}
|
|
return *GHIDRA_CAST<Entity **>((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x4)))) + clampedIndex * 4));
|
|
}
|