namespace ChloeOwO::Trove {
namespace Entities {
struct EntityInfo;
}
namespace Core {
struct WorldMetadata;
struct World {
private:
std::uint8_t gap0[124]; /* 0x0 */
public:
ChloeOwO::Trove::Entities::EntityInfoList entity_info_list; /* 0x7C */
static inline ChloeOwO::Trove::Entities::EntityInfo *(__thiscall *UpdateEntities)(ChloeOwO::Trove::Core::World *const self) = nullptr; /* 55 8B EC 83 EC 20 53 8B D9 C7 45 F8 */
}; /* Size: -- */
}
}
ChloeOwO::Trove::Entities::EntityInfo *ChloeOwO::Trove::OwO::Ext::Trove::Core::WorldExt::UpdateEntities(ChloeOwO::Trove::Core::World &self) {
self.field_158 = 1;
const auto &entity_info_list = self.entity_info_list;
auto head = EntityInfoNode{};
head.entity_info_list = &self.entity_info_list;
head.field_4 = nullptr;
head.data = nullptr;
head.FindEntity(0);
const auto &metadata = *self.metadata;
const auto total_time = metadata.total_time;
auto i = head;
while (!i.IsEnd(entity_info_list)) {
auto &entity = *i.data->entity;
i.Next();
if (total_time > entity.field_88) {
head.field_4 = entity.field_28;
head.data = entity.field_2C;
Trove::Sub002AE910(&self.field_140, &head.field_4);
}
if ((entity.field_3C & 0x10) != 0) {
GameObjectExt::Update(entity);
}
}
auto *const tail = self.entity_info_list.GetTail();
self.field_158 = 0;
return tail;
}
namespace ChloeOwO::Trove {
namespace Entities {
struct GameObject;
struct EntityInfo {
std::int32_t field_0; /* 0x0 */
private:
std::uint8_t gap4[12]; /* 0x4 */
public:
ChloeOwO::Trove::Entities::GameObject *entity; /* 0x10 */
}; /* Size: 0x14 */
}
}
namespace ChloeOwO::Trove::Entities {
struct EntityInfo;
struct EntityInfoList;
struct EntityInfoNode {
ChloeOwO::Trove::Entities::EntityInfoList *entity_info_list; /* 0x0 */
ChloeOwO::Trove::Entities::EntityInfo *field_4; /* 0x4 */
ChloeOwO::Trove::Entities::EntityInfo *data; /* 0x8 */
void FindEntity(std::uint32_t start_index);
void FindEntity(std::uint32_t start_index, std::size_t upper_bound);
bool IsEnd(const ChloeOwO::Trove::Entities::EntityInfoList &list);
ChloeOwO::Trove::Entities::EntityInfoNode *Next();
}; /* Size: 0xC */
}
void ChloeOwO::Trove::Entities::EntityInfoNode::FindEntity(std::uint32_t start_index) {
this->FindEntity(start_index, this->entity_info_list->size);
}
void ChloeOwO::Trove::Entities::EntityInfoNode::FindEntity(std::uint32_t start_index, std::size_t upper_bound) {
auto current_index = start_index;
auto *const entity_info_list = this->entity_info_list;
this->data = 0;
if (start_index < entity_info_list->size) {
if (start_index < upper_bound) {
do {
auto *const current_entity_info_ptr = reinterpret_cast<EntityInfo *>(entity_info_list->base_address + current_index * entity_info_list->stride);
this->field_4 = current_entity_info_ptr;
if (((current_entity_info_ptr->field_0 & 1) == 0) || ((current_entity_info_ptr->field_0 & 0xFFFFFFFE) != 0)) {
break;
}
++current_index;
} while (current_index < upper_bound);
}
auto *const entity_info_ptr = this->field_4;
if ((entity_info_ptr != nullptr) && (((entity_info_ptr->field_0 & 1) == 0) || ((entity_info_ptr->field_0 & 0xFFFFFFFE) != 0))) {
if ((entity_info_ptr->field_0 & 1) != 0) {
this->data = reinterpret_cast<EntityInfo *>(entity_info_ptr->field_0 & 0xFFFFFFFE);
} else {
this->data = entity_info_ptr;
}
}
}
}
bool ChloeOwO::Trove::Entities::EntityInfoNode::IsEnd(const ChloeOwO::Trove::Entities::EntityInfoList &list) {
return (this->data == nullptr) && (this->field_4 == list.GetTail()) && (this->entity_info_list == &list);
}
ChloeOwO::Trove::Entities::EntityInfoNode *ChloeOwO::Trove::Entities::EntityInfoNode::Next() {
const auto v2 = (this->data->field_0 & 0xFFFFFFFE) == 0;
this->data = reinterpret_cast<EntityInfo *>(this->data->field_0 & 0xFFFFFFFE);
if (v2) {
this->FindEntity(
((reinterpret_cast<std::uintptr_t>(this->field_4) - this->entity_info_list->base_address) / this->entity_info_list->stride) + 1,
this->entity_info_list->size);
}
return this;
}
namespace ChloeOwO::Trove::Entities {
struct EntityInfo;
struct EntityInfoList {
std::uintptr_t base_address; /* 0x0 */
std::size_t stride; /* 0x4 */
std::size_t size; /* 0x8 */
ChloeOwO::Trove::Entities::EntityInfo *GetTail() const;
}; /* Size: 0xC */
}
ChloeOwO::Trove::Entities::EntityInfo *ChloeOwO::Trove::Entities::EntityInfoList::GetTail() const {
return (this->size != 0) ? reinterpret_cast<EntityInfo *>(this->base_address + (this->stride * (this->size - 1))) : nullptr;
}
for preload)
<---- me