Files
isaac-port/generated-src/entity.cpp
T
shweetandClaude Opus 5.5 ddf913f304 Curation round 3: Lua engine, Manager, sound, menus, cutscenes, rooms, item pools, saves; boots past LuaEngine::Init
Seven agents took over LuaEngine (the mod API registration deferred), the rest of Manager (LoadConfigs, fonts, render
surfaces, Update/Render), MusicManager/SFXManager, MenuManager with the title/save/game menus, Cutscene/NightmareScene/
Backdrop, RoomConfig (src/rooms ported and retired) with ItemPool, and PersistentGameData (the original binary save
format) with InfoDisplay. An integration pass moved call sites to the new APIs, declared the taken-over free functions,
fixed two data.cpp crashes (an empty children array, null attribute strings), and made the generator keep a header's own
name where a prototype names another address. Clean build (0 warnings with -Wall -Wextra). build/isaac runs the game's
Lua scripts (without the mod API yet) and stops at reload_resource_paths. 901 functions taken over, boot path 204/615.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 00:53:08 -05:00

9057 lines
320 KiB
C++

#include "classes.h"
// 00417220
uint8_t Entity::IsType(int type, int variant, int subType)
{
if (((this->_type == type) && ((variant == -1 || (this->_variant == variant)))) &&
((subType == -1 || (this->_subtype == subType)))) {
return 1;
}
return 0;
}
// 00417260
int Entity::Type()
{
return this->_type;
}
// 00417270
int Entity::Variant()
{
return this->_variant;
}
// 00417280
int Entity::SubType()
{
return this->_subtype;
}
// 00417290
Vector * Entity::Position(Vector *outPos)
{
float posY;
posY = (this->_pos).y;
outPos->x = (this->_pos).x;
outPos->y = posY;
return outPos;
}
// 004172d0
Vector * Entity::Velocity(Vector *outVelocity)
{
float velocityY;
velocityY = (this->_velocity).y;
outVelocity->x = (this->_velocity).x;
outVelocity->y = velocityY;
return outVelocity;
}
// 004172f0
void Entity::SetPositionOffset(Vector *offset)
{
(this->_posOffset).x = offset->x;
(this->_posOffset).y = offset->y;
return;
}
// 00417310
Vector * Entity::PositionOffset()
{
return &this->_posOffset;
}
// 00417320
Vector * Entity::SpriteScale()
{
return &(this->_sprite)._scale;
}
// 00417330
long double Entity::SpriteRotation()
{
return (long double)(this->_sprite)._rotation;
}
// 00417360
float Entity::MaxHitPoints()
{
return this->_maxHitPoints;
}
// 00417370
long double Entity::HitPoints()
{
return (long double)this->_health;
}
// 00417380
int Entity::EntityCollisionClass()
{
return this->_entityCollisionClass;
}
// 004173b0
uint8_t Entity::is_player()
{
return this->_type == 1;
}
// 004173c0
bool Entity::is_bomb()
{
return this->_type == 4;
}
// 004173e0
void Entity::AddEntityFlags(uint64_t flags)
{
uint32_t *flagsHigh;
*GHIDRA_CAST<uint32_t *>(&this->_flags) = GHIDRA_UINT(this->_flags) | GHIDRA_UINT(flags);
flagsHigh = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
*flagsHigh = *flagsHigh | (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(flags)) + 0x4)));
return;
}
// 00417400
void Entity::ClearEntityFlags(uint64_t flags)
{
uint32_t *flagsHigh;
*GHIDRA_CAST<uint32_t *>(&this->_flags) = GHIDRA_UINT(this->_flags) & ~GHIDRA_UINT(flags);
flagsHigh = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
*flagsHigh = *flagsHigh & ~(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(flags)) + 0x4)));
return;
}
// 00417420
uint64_t Entity::GetEntityFlags()
{
return this->_flags;
}
// 00417430
uint8_t Entity::HasEntityFlags(uint64_t flags)
{
if ((GHIDRA_UINT(flags) & GHIDRA_UINT(this->_flags)) == 0 &&
(*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) & (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(flags)) + 0x4)))) == 0) {
return 0;
}
return 1;
}
// 00417460
uint8_t Entity::Exists()
{
return this->_exists;
}
// 00417470
uint8_t Entity::IsDead()
{
return this->_dead;
}
// 00417480
uint8_t Entity::Visible()
{
return this->_visible;
}
// 004174a0
uint32_t Entity::SpawnerEntity()
{
return this->_spawnerEntity;
}
// 004174b0
RNG * Entity::GetDropRNG()
{
return &this->_dropRNG;
}
// 004288f0
void Entity::SetPosition(Vector *pos)
{
(this->_pos).x = pos->x;
(this->_pos).y = pos->y;
return;
}
// 00428910
void Entity::SetVelocity(Vector *velocity)
{
(this->_velocity).x = velocity->x;
(this->_velocity).y = velocity->y;
return;
}
// 0042a250
uint8_t Entity::IsFamiliar()
{
return this->_type == 3;
}
// 0042a260
uint32_t Entity::Parent()
{
return this->_parent;
}
// 0042d9b0
void Entity::SetSpriteScale(Vector *scale)
{
(this->_sprite)._scale.x = scale->x;
(this->_sprite)._scale.y = scale->y;
return;
}
// 00431430
int Entity::SpawnerType()
{
return this->_spawnerType;
}
// 00431440
int Entity::SpawnerVariant()
{
return this->_spawnerVariant;
}
// 00431450
void Entity::AddVelocity(Vector *velocity, uint8_t isIgnoreSpeedMultiplier)
{
float multiplier;
float velocityY;
if (isIgnoreSpeedMultiplier == 0) {
multiplier = this->_speedMultiplier;
}
else {
multiplier = 1.0;
}
velocityY = velocity->y;
(this->_velocity).x = multiplier * velocity->x + (this->_velocity).x;
(this->_velocity).y = velocityY * multiplier + (this->_velocity).y;
return;
}
// 004314b0
void Entity::AddVelocity_divided(Vector *velocity, uint8_t isIgnoreSpeedMultiplier)
{
float fVar1;
float speedMultiplier;
float velocityY;
fVar1 = this->_friction;
if (fVar1 != 0.0) {
if (isIgnoreSpeedMultiplier == 0) {
speedMultiplier = this->_speedMultiplier;
}
else {
speedMultiplier = 1.0;
}
velocityY = velocity->y;
(this->_velocity).x = (speedMultiplier * velocity->x) / fVar1 + (this->_velocity).x;
(this->_velocity).y = (velocityY * speedMultiplier) / fVar1 + (this->_velocity).y;
}
return;
}
// 00431520
long double Entity::Mass()
{
return (long double)this->_mass;
}
// 00431530
uint8_t Entity::IsTear()
{
return this->_type == 2;
}
// 00431540
uint8_t Entity::IsProjectile()
{
return this->_type == 9;
}
// 00431550
bool Entity::is_pickup()
{
return this->_type == 5;
}
// 00431560
uint32_t Entity::Child()
{
return this->_child;
}
// 00435ce0
void Entity::get_friction()
{
return;
}
// 00435d10
long double Entity::DepthOffset()
{
return (long double)this->_renderDepthOffset;
}
// 00435d20
void Entity::SetField380(float value)
{
this->_health = value;
return;
}
// 00435d60
void Entity::SetTargetPosition(Vector position)
{
(this->_targetPosition).x = position.x;
(this->_targetPosition).y = position.y;
return;
}
// 00435da0
bool Entity::is_slot()
{
return this->_type == 6;
}
// 00435db0
int Entity::GetHitPointsLost()
{
return GHIDRA_INT(this->_updateTime) - GHIDRA_INT(this->_prevUpdateTime);
}
// 00435dd0
ANM2 * Entity::GetSprite()
{
return &this->_sprite;
}
// 00435e00
Entity * Entity::to_npc_or_coop_player()
{
if ((this == GHIDRA_CAST<Entity *>(0x0)) ||
(((*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2 || (this->_type != 1)) &&
(0x3dd < this->_type - 10U)))) {
return GHIDRA_CAST<Entity *>(0x0);
}
return this;
}
// 00435e40
Entity_Tear * Entity::ToTear()
{
if ((this == GHIDRA_CAST<Entity *>(0x0)) || (this->_type != 2)) {
return GHIDRA_CAST<Entity_Tear *>(0x0);
}
return GHIDRA_CAST<Entity_Tear *>(this);
}
// 00436220
void Entity::SetVisibleFlag(uint8_t isVisible)
{
if ((isVisible == 0) || ((this->_flags & 0x20000000) != 0)) {
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[3])) + 0xc))) = 0;
return;
}
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(this[3])) + 0xc))) = 1;
return;
}
// 00440eb0
int Entity::GridCollisionClass()
{
return this->_entityGridCollisionClass;
}
// 00444c60
void Entity::Die()
{
this->_dead = 1;
return;
}
// 004567b0
uint8_t Entity::IsFriendly()
{
if ((this->_flags & 0x20000000) == 0) {
return 0;
}
return 1;
}
// 00499da0
Entity_Player * Entity::ToPlayer()
{
if ((this == GHIDRA_CAST<Entity *>(0x0)) || (this->_type != 1)) {
return GHIDRA_CAST<Entity_Player *>(0x0);
}
return GHIDRA_CAST<Entity_Player *>(this);
}
// 0049cb50
Vector * Entity::SpriteOffset()
{
return &(this->_sprite)._offset;
}
// 004aad30
Vector * Entity::TargetPosition()
{
return &this->_targetPosition;
}
// 004b7080
uint32_t Entity::Target()
{
return this->_target;
}
// 004e47a0
ColorMod * Entity::SplatColor()
{
return &this->_splatColor;
}
// 00505b60
ColorMod * Entity::GetColor()
{
return &(this->_sprite)._color;
}
// 00505b70
int Entity::InitSeed()
{
return this->_initSeed;
}
// 00592250
int Entity::SortingLayer()
{
return this->_sortingLayer;
}
// 005a6ff0
void Entity::MultiplyFriction(float param_2)
{
this->_friction = param_2 * this->_friction;
return;
}
// 005b1570
long double Entity::CollisionDamage()
{
return (long double)this->_collisionDamage;
}
// 005b1580
uint8_t Entity::IsInvincible()
{
return this->_isInvicible;
}
// 005b1590
int Entity::DropSeed()
{
return (this->_dropRNG)._seed;
}
// 005ccbe0
void Entity::SetCollisionDamage(float param_2)
{
this->_collisionDamage = param_2;
return;
}
// 005ccc00
uint8_t Entity::IsBoss()
{
return 0;
}
// 005ccc10
uint8_t Entity::TryThrow()
{
return 0;
}
// 005cd460
void Entity::AddFlagsLow(uint32_t param_2)
{
float *flagsLow;
flagsLow = (this->_sprite)._color._offset;
*flagsLow = (float)(GHIDRA_UINT(*flagsLow) | param_2);
return;
}
// 0060af70
Entity * Entity::AddFear(int param_2, int param_3, int param_4)
{
uint32_t seed;
Entity *effect;
uint32_t *in_EDX;
float parentX;
float parentY;
uint8_t local_3c [2];
uint8_t auStack_3a [2];
uint32_t effectColor;
uint32_t uStack_34;
uint32_t uStack_30;
uint32_t uStack_2c;
uint32_t local_28;
uint32_t uStack_24;
uint32_t uStack_20;
uint32_t uStack_1c;
uint32_t local_18;
uint32_t local_14;
uint32_t local_10;
uint32_t local_c;
float parentX;
float parentY;
local_c = __security_cookie ^ GHIDRA_UINT(local_3c);
seed = Random();
effect = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0x79,GHIDRA_CAST<Vector *>(this),&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,seed,0);
local_18 = 0;
parentY = 0.0;
local_14 = 0;
local_28 = 0;
uStack_24 = 0;
uStack_20 = 0;
uStack_1c = 0;
effectColor = *in_EDX;
uStack_34 = in_EDX[1];
uStack_30 = in_EDX[2];
uStack_2c = in_EDX[3];
local_10 = 0;
effect->SetColor(&effectColor,0xffffffff,0xff);
parentX = parentY * g_vectorOne.x;
if (param_2 < 1) {
param_2 = -1;
}
parentY = parentY * g_vectorOne.y;
*GHIDRA_CAST<int *>((effect[1]._sprite._filename._buf + 4)) = param_2;
*GHIDRA_CAST<int *>((effect[1]._sprite._filename._buf + 8)) = param_2;
(effect->_sprite)._scale.x = parentX;
if (param_3 < 1) {
param_3 = 6;
}
(effect->_sprite)._scale.y = parentY;
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(effect[1])) + 0x40)))) = param_3;
if (param_4 != 0) {
if (effect->_parent != 0) {
msvc::multiset<unsigned_int>::erase(local_3c + -0x14);
}
effect->_parent = param_4;
msvc::multiset<unsigned_int>::insert(&effect->_parent);
parentY = (effect->_pos).x;
parentX = (effect->_pos).y;
parentX = *GHIDRA_CAST<float *>((param_4 + 0x33c));
parentY = *GHIDRA_CAST<float *>((param_4 + 0x340));
effect[1]._sprite._filename._buf[0xc] = '\x01';
effect[1]._sprite._filename._size = GHIDRA_UINT((parentY - parentX));
effect[1]._sprite._filename._capacity = GHIDRA_UINT((parentX - parentY));
}
return effect;
}
// 0064bb70
void Entity::convert_shot_for_enemy_owner(Entity *shot)
{
uint8_t *pbVar1;
int iVar2;
Vector targetPos;
Entity *pEVar3;
uint32_t seed;
Entity *pEVar4;
Entity_NPC *pEVar5;
float fVar6;
uint32_t variant;
Vector local_20;
Vector local_18;
Vector local_10;
uint32_t flagsHigh;
float *shotOffsetY;
if ((((this->_flags & 0x100) != 0) &&
(pEVar4 = *GHIDRA_CAST<Entity **>((*GHIDRA_CAST<int *>((this + 1)) + 0x3c8)), pEVar4 != GHIDRA_CAST<Entity *>(0x0))) &&
(((local_20.x = (float)&pEVar4->_type, 1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager) &&
(*GHIDRA_CAST<int *>(local_20.x) == 1)) || (*GHIDRA_CAST<int *>(local_20.x) - 10U < 0x3de)))) {
iVar2 = shot->_type;
local_18.x = (float)this;
if (iVar2 == 2) {
seed = Random();
local_20.x = (shot->_pos).x;
local_18.x = (shot->_velocity).x * 0.8;
local_20.y = (shot->_pos).y;
local_18.y = (shot->_velocity).y * 0.8;
pEVar4 = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(9,0,&local_20,&local_18,pEVar4,0,seed,0);
iVar2 = *GHIDRA_CAST<int *>(pEVar4);
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(pEVar4[1])) + 0x8)))) = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(shot[1])) + 0x8))));
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(pEVar4[1])) + 0x4)))) = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(shot[1])) + 0x4))));
*GHIDRA_CAST<uint32_t *>((pEVar4 + 1)) = *GHIDRA_CAST<uint32_t *>((shot + 1));
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(pEVar4[1])) + 0x10)))) = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(shot[1])) + 0x10))));
(**(code **)(iVar2 + 0x3c))(&shot->_color,0xffffffff,0xff,0,1);
shot->Remove();
return;
}
if (iVar2 == 3) {
if (shot->_variant == 0x2b) {
seed = Random();
local_20.x = (shot->_velocity).x;
local_20.y = (shot->_velocity).y;
local_10.x = (shot->_pos).x;
local_10.y = (shot->_pos).y;
pEVar4 = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(0x12,0,&local_10,&local_20,pEVar4,0,seed,0);
flagsHigh = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&pEVar4->_flags) + 4));
fVar6 = pEVar4->_maxHitPoints + pEVar4->_maxHitPoints;
*GHIDRA_CAST<uint32_t *>(&pEVar4->_flags) = GHIDRA_UINT(pEVar4->_flags) & 0xfffffffb;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&pEVar4->_flags) + 4)) = flagsHigh;
pEVar4->_maxHitPoints = fVar6;
pEVar4->_health = fVar6;
shot->Remove();
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_18.x) + 0x2c)) == 0x36) {
pbVar1 = &(GHIDRA_CAST<Entity *>((GHIDRA_INT(local_18.x) + 0xc30)))->_collidesWithGrid;
if (*GHIDRA_CAST<int *>(&(GHIDRA_CAST<Entity *>((GHIDRA_INT(local_18.x) + 0xc30)))->_collidesWithGrid) != 0) {
local_18.x = (float)pbVar1;
msvc::multiset<unsigned_int>::erase(&local_18);
}
*GHIDRA_CAST<Entity **>(pbVar1) = pEVar4;
msvc::multiset<unsigned_int>::insert(pbVar1);
}
return;
}
if (shot->_variant == 0x49) {
shotOffsetY = &(shot->_posOffset).y;
if ((*shotOffsetY <= 0.0 && *shotOffsetY != 0.0) ||
(shotOffsetY = shot[3]._sprite._championColor._offset,
*shotOffsetY <= 0.0 && *shotOffsetY != 0.0)) {
local_20.y = (shot->_pos).y;
local_20.x = (shot->_pos).x;
targetPos.y = g_vectorZero.y;
targetPos.x = g_vectorZero.x;
pEVar5 = Entity_NPC::ThrowSpider(&local_20,pEVar4,targetPos,0,(this->_posOffset).y);
}
else {
seed = Random();
local_10.x = (shot->_velocity).x;
local_10.y = (shot->_velocity).y;
local_18.x = (shot->_pos).x;
local_18.y = (shot->_pos).y;
pEVar5 = GHIDRA_CAST<Entity_NPC *>((GHIDRA_CAST<Game *>((g_game)))->Game)::SpawnEx(0x55,0,&local_18,&local_10,pEVar4,0,seed,0);
}
flagsHigh = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&pEVar5->_flags) + 4));
fVar6 = pEVar5->_maxHitPoints + pEVar5->_maxHitPoints;
*GHIDRA_CAST<uint32_t *>(&pEVar5->_flags) = GHIDRA_UINT(pEVar5->_flags) & 0xfffffffb;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&pEVar5->_flags) + 4)) = flagsHigh;
pEVar5->_maxHitPoints = fVar6;
pEVar5->_health = fVar6;
shot->Remove();
return;
}
}
else if (iVar2 == 7) {
local_18.x = (float)&shot->_spawnerEntity;
pEVar3 = this;
if (shot->_spawnerEntity != 0) {
msvc::multiset<unsigned_int>::erase(&local_18);
pEVar3 = GHIDRA_CAST<Entity *>(local_18.x);
}
local_18.x = (float)pEVar3;
shot->_spawnerEntity = pEVar4;
msvc::multiset<unsigned_int>::insert(&shot->_spawnerEntity);
shot->_spawnerType = *GHIDRA_CAST<int *>(local_20.x);
shot->_spawnerVariant = pEVar4->_variant;
}
else if (iVar2 == 1000) {
if (((shot->_variant != 0x2e) || (iVar2 = this[3]._entityRef4._variant, iVar2 == 0)) ||
(*GHIDRA_CAST<float *>((iVar2 + 0x3a4)) <= 30.0)) {
if (shot->_variant != 0x2c) {
return;
}
seed = Random();
variant = 0x19;
}
else {
seed = Random();
variant = 0x16;
}
local_10.x = (shot->_velocity).x;
local_10.y = (shot->_velocity).y;
local_18.x = (shot->_pos).x;
local_18.y = (shot->_pos).y;
pEVar4 = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,variant,&local_18,&local_10,pEVar4,0,seed,0);
iVar2 = *GHIDRA_CAST<int *>(pEVar4);
(pEVar4->_sprite)._scale.x = (shot->_sprite)._scale.x;
(pEVar4->_sprite)._scale.y = (shot->_sprite)._scale.y;
(**(code **)(iVar2 + 0xc))();
shot->Remove();
return;
}
}
return;
}
// 00665a80
uint8_t Entity::CollidesWithGrid()
{
int in_ECX;
return *GHIDRA_CAST<uint8_t *>((in_ECX + 400));
}
// 0067a720
void Entity::GetRootParent()
{
Entity *nextSpawner;
Entity *spawner;
nextSpawner = GHIDRA_CAST<Entity *>(this->_spawnerEntity);
while (spawner = nextSpawner, spawner != GHIDRA_CAST<Entity *>(0x0)) {
this = spawner;
nextSpawner = GHIDRA_CAST<Entity *>(spawner->_spawnerEntity);
}
if (this->_type == 1) {
return;
}
return;
}
// 006a8290
void Entity::constructor()
{
void *referrerHead;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
puStack_c = &LAB_00afa397;
local_10 = ExceptionList;
ExceptionList = &local_10;
*GHIDRA_CAST<uint8_t ***>(this) = IsaacRepentancePlus::Entity::vftable;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8)))) = 0;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc)))) = 0;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x10)))) = 0;
local_8 = 0;
this->_type = 0;
this->_spawnerType = 0;
this->_spawnerVariant = 0;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x3c)))) = 0;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x40)))) = 0xffffffff;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x44)))) = 0xffffffff;
ANM2::constructor(&this->_sprite);
(this->_shadowOffset).y = 0.0;
(this->_shadowOffset).x = 0.0;
this->_valid = 0;
this->_exists = 0;
(this->_collisionPoints)._begin = (void *)0x0;
(this->_collisionPoints)._end = (void *)0x0;
(this->_collisionPoints)._capacity = (void *)0x0;
(this->_gridCollisionVelocity).y = 0.0;
(this->_gridCollisionVelocity).x = 0.0;
(this->_gridCollisionNormal).y = 0.0;
(this->_gridCollisionNormal).x = 0.0;
(this->_renderPosition).y = 0.0;
(this->_renderPosition).x = 0.0;
(this->_colorParams)._begin = (void *)0x0;
(this->_colorParams)._end = (void *)0x0;
(this->_colorParams)._capacity = (void *)0x0;
local_8 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),3);
(this->_color)._tint[0] = 1.0;
(this->_color)._tint[1] = 1.0;
(this->_color)._tint[2] = 1.0;
(this->_color)._tint[3] = 1.0;
(this->_color)._colorize[0] = 0.0;
(this->_color)._colorize[1] = 0.0;
(this->_color)._colorize[2] = 0.0;
(this->_color)._colorize[3] = 0.0;
(this->_color)._offset[0] = 0.0;
(this->_color)._offset[1] = 0.0;
(this->_color)._offset[2] = 0.0;
(this->_splatColor)._tint[0] = 1.0;
(this->_splatColor)._tint[1] = 1.0;
(this->_splatColor)._tint[2] = 1.0;
(this->_splatColor)._tint[3] = 1.0;
(this->_splatColor)._colorize[0] = 0.0;
(this->_splatColor)._colorize[1] = 0.0;
(this->_splatColor)._colorize[2] = 0.0;
(this->_splatColor)._colorize[3] = 0.0;
(this->_splatColor)._offset[0] = 0.0;
(this->_splatColor)._offset[1] = 0.0;
(this->_splatColor)._offset[2] = 0.0;
(this->_charmSource)._type = 0;
(this->_charmSource)._variant = 0;
(this->_charmSource)._spawnerType = 0;
(this->_charmSource)._spawnerVariant = 0;
(this->_charmSource)._position.x = g_vectorZero.x;
(this->_charmSource)._position.y = g_vectorZero.y;
(this->_charmSource)._velocity.x = g_vectorZero.x;
(this->_charmSource)._velocity.y = g_vectorZero.y;
(this->_charmSource)._flags = 0;
(this->_charmSource)._entity = (void *)0x0;
(this->_entityRef2)._type = 0;
(this->_entityRef2)._variant = 0;
(this->_entityRef2)._spawnerType = 0;
(this->_entityRef2)._spawnerVariant = 0;
(this->_entityRef2)._position.x = g_vectorZero.x;
(this->_entityRef2)._position.y = g_vectorZero.y;
(this->_entityRef2)._velocity.x = g_vectorZero.x;
(this->_entityRef2)._velocity.y = g_vectorZero.y;
(this->_entityRef2)._flags = 0;
(this->_entityRef2)._entity = (void *)0x0;
(this->_entityRef3)._type = 0;
(this->_entityRef3)._variant = 0;
(this->_entityRef3)._spawnerType = 0;
(this->_entityRef3)._spawnerVariant = 0;
(this->_entityRef3)._position.x = g_vectorZero.x;
(this->_entityRef3)._position.y = g_vectorZero.y;
(this->_entityRef3)._velocity.x = g_vectorZero.x;
(this->_entityRef3)._velocity.y = g_vectorZero.y;
(this->_entityRef3)._flags = 0;
(this->_entityRef3)._entity = (void *)0x0;
(this->_entityRef4)._type = 0;
(this->_entityRef4)._variant = 0;
(this->_entityRef4)._spawnerType = 0;
(this->_entityRef4)._spawnerVariant = 0;
(this->_entityRef4)._position.x = g_vectorZero.x;
(this->_entityRef4)._position.y = g_vectorZero.y;
(this->_entityRef4)._velocity.x = g_vectorZero.x;
(this->_entityRef4)._velocity.y = g_vectorZero.y;
(this->_entityRef4)._flags = 0;
(this->_entityRef4)._entity = (void *)0x0;
(this->_knockbackDirection).y = 0.0;
(this->_knockbackDirection).x = 0.0;
this->_iceFrozenEffect = 0;
(this->_pausePosition).y = 0.0;
(this->_pausePosition).x = 0.0;
(this->_targetPosition).y = 0.0;
(this->_targetPosition).x = 0.0;
(this->_pos).y = 0.0;
(this->_pos).x = 0.0;
(this->_preInterpolatePos).y = 0.0;
(this->_preInterpolatePos).x = 0.0;
(this->_posOffset).y = 0.0;
(this->_posOffset).x = 0.0;
(this->_velocity).y = 0.0;
(this->_velocity).x = 0.0;
(this->_sizeMulti).y = 0.0;
(this->_sizeMulti).x = 0.0;
(this->_prevPosition).y = 0.0;
(this->_prevPosition).x = 0.0;
(this->_prevVelocity).y = 0.0;
(this->_prevVelocity).x = 0.0;
this->_parent = 0;
this->_child = 0;
this->_target = 0;
this->_spawnerEntity = 0;
(this->_entityPtrReferrers)._head = (void *)0x0;
(this->_entityPtrReferrers)._size = 0;
referrerHead = operator_new(0x14);
*(void **)referrerHead = referrerHead;
*(void **)(GHIDRA_CAST<char *>(referrerHead) + 4) = referrerHead;
*(void **)(GHIDRA_CAST<char *>(referrerHead) + 8) = referrerHead;
*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(referrerHead) + 0xc)) = 0x101;
(this->_entityPtrReferrers)._head = referrerHead;
this->_minecart = 0;
this->_hitEffect = 0;
(this->_dropRNG)._shift1 = 5;
(this->_dropRNG)._shift2 = 9;
(this->_dropRNG)._shift3 = 7;
(this->_dropRNG)._seed = -0x55e8beb1;
(this->_holdPosition).y = 0.0;
(this->_holdPosition).x = 0.0;
this->_scoreMultiplier = 1.0;
this->_luaBridgeRef = (void *)0x0;
ExceptionList = local_10;
return;
}
// 006a8850
void Entity::destructor()
{
std_multiset *referrers;
uint32_t uVar1;
int *erasedRef;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
uint32_t *entityRef;
local_8 = 0xffffffff;
puStack_c = &LAB_00afa3c0;
local_10 = ExceptionList;
uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
ExceptionList = &local_10;
*GHIDRA_CAST<uint8_t ***>(this) = IsaacRepentancePlus::Entity::vftable;
if (this->_exists != 0) {
Remove(this);
}
entityRef = this->_luaBridgeRef;
if (entityRef != GHIDRA_CAST<uint32_t *>(0x0)) {
luaL_unref(*entityRef,0xfff0b9d8,entityRef[1],uVar1);
operator_delete(entityRef,8);
this->_luaBridgeRef = (void *)0x0;
}
entityRef = &this->_hitEffect;
if (*entityRef != 0) {
erasedRef = entityRef;
msvc::multiset<unsigned_int>::erase(&erasedRef);
*entityRef = 0;
}
entityRef = &this->_minecart;
if (*entityRef != 0) {
erasedRef = entityRef;
msvc::multiset<unsigned_int>::erase(&erasedRef);
*entityRef = 0;
}
referrers = &this->_entityPtrReferrers;
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<msvc::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(referrers,(fuzzer_allocator<msvc::_Tree_node<unsigned_int,void*>_> *)referrers,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT((this->_entityPtrReferrers)._head) + 4));
operator_delete(referrers->_head,0x14);
vector_0x3c_tidy();
msvc::vector<Vector>::_Tidy();
local_8 = 2;
ANM2::Reset(&this->_sprite);
AnimationState::~AnimationState(&(this->_sprite)._overlayAnimState);
AnimationState::~AnimationState(&(this->_sprite)._animState);
(GHIDRA_CAST<msvc::string *>(((this->_sprite)._animDefaultName._buf)))->msvc::string::_Tidy_deallocate();
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(&this->_sprite))))->msvc::string::_Tidy_deallocate();
FUN_0041c7d0();
ExceptionList = local_10;
return;
}
// 006a8990
Entity * Entity::GetLastParent()
{
Entity *nextParent;
Entity *parent;
nextParent = GHIDRA_CAST<Entity *>(this->_parent);
while (parent = nextParent, parent != GHIDRA_CAST<Entity *>(0x0)) {
this = parent;
nextParent = GHIDRA_CAST<Entity *>(parent->_parent);
}
return this;
}
// 006a89b0
Entity * Entity::GetLastChild()
{
Entity *child;
Entity *nextChild;
nextChild = GHIDRA_CAST<Entity *>(this->_child);
while (child = nextChild, child != GHIDRA_CAST<Entity *>(0x0)) {
this = child;
nextChild = GHIDRA_CAST<Entity *>(child->_child);
}
return this;
}
// 006a89d0
Entity * Entity::GetLastSpawner()
{
Entity *nextSpawner;
Entity *spawner;
nextSpawner = GHIDRA_CAST<Entity *>(this->_spawnerEntity);
while (spawner = nextSpawner, spawner != GHIDRA_CAST<Entity *>(0x0)) {
this = spawner;
nextSpawner = GHIDRA_CAST<Entity *>(spawner->_spawnerEntity);
}
return this;
}
// 006a89f0
Entity * Entity::GetStatusEffectTarget()
{
uint8_t isSharingStatus;
Entity *extraout_EDX;
Entity *target;
Entity *next;
Entity *parent;
isSharingStatus = DoesEntityShareStatus(this);
target = extraout_EDX;
if (isSharingStatus != 0) {
next = GHIDRA_CAST<Entity *>(extraout_EDX->_parent);
target = extraout_EDX;
while (parent = next, parent != GHIDRA_CAST<Entity *>(0x0)) {
target = parent;
next = GHIDRA_CAST<Entity *>(parent->_parent);
}
}
return target;
}
// 006a8a20
void Entity::CopyStatusEffects()
{
uint8_t isSharingStatus;
char isBoss;
int *child;
uint32_t flagsHigh;
isSharingStatus = DoesEntityShareStatus(this);
if (isSharingStatus != 0) {
for (child = GHIDRA_CAST<int *>(this->_child); child != GHIDRA_CAST<int *>(0x0); child = GHIDRA_CAST<int *>(child[0xf0])) {
child[0x86] = this->_freezeCountdown;
flagsHigh = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
child[0x5a] = child[0x5a] & 0xdeffe01fU | GHIDRA_UINT(this->_flags) & 0x21001fe0;
child[0x5b] = child[0x5b] & 0xfea27fffU | flagsHigh & 0x15d8000;
child[0x87] = this->_poisonCountdown;
child[0x88] = this->_slowingCountdown;
child[0x89] = this->_charmedCountdown;
child[0x8a] = this->_confusionCountdown;
child[0x8b] = this->_midasFreezeCountdown;
child[0x8c] = this->_fearCountdown;
child[0x8d] = this->_burnCountdown;
child[0xba] = this->_bleedingCountdown;
child[0x8f] = this->_shrinkCountdown;
child[200] = GHIDRA_INT(this->_poisonTickDamage);
child[0xc9] = GHIDRA_INT(this->_burnTickDamage);
child[0xbc] = this->_magnetizedCountdown;
child[0xbd] = this->_baitedCountdown;
child[0xbe] = this->_knockbackCountdown;
child[0xc2] = GHIDRA_INT((this->_knockbackDirection).x);
child[0xc3] = GHIDRA_INT((this->_knockbackDirection).y);
child[0xc0] = this->_iceCountdown;
child[0xbf] = this->_weaknessCountdown;
child[0xc1] = this->_brimstoneMarkCountdown;
child[0xed] = GHIDRA_INT(this->_shrinkStatus1);
child[0xee] = GHIDRA_INT(this->_shrinkStatus2);
isBoss = this->IsBoss();
if (((isBoss != '\0') || ((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager) && (this->_type == 1)))) &&
((isBoss = (**(code **)(*child + 0x4c))(), isBoss != '\0' ||
((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager) && (child[10] == 1)))))) {
child[0x8e] = this->_bossStatusEffectCooldown;
}
}
}
return;
}
// 006a8c00
uint8_t Entity::HasCommonParentWithEntity(Entity *other)
{
Entity *pEVar1;
Entity *pEVar2;
Entity *otherRoot;
Entity *nextAncestor;
Entity *ancestor;
if ((other != GHIDRA_CAST<Entity *>(0x0)) && (other->_type == 0xde)) {
return 0;
}
otherRoot = GHIDRA_CAST<Entity *>(0x0);
if (other != GHIDRA_CAST<Entity *>(0x0)) {
nextAncestor = GHIDRA_CAST<Entity *>(other->_parent);
otherRoot = other;
while (ancestor = nextAncestor, ancestor != GHIDRA_CAST<Entity *>(0x0)) {
otherRoot = ancestor;
nextAncestor = GHIDRA_CAST<Entity *>(ancestor->_parent);
}
}
pEVar2 = GHIDRA_CAST<Entity *>(this->_parent);
while (pEVar1 = pEVar2, pEVar1 != GHIDRA_CAST<Entity *>(0x0)) {
this = pEVar1;
pEVar2 = GHIDRA_CAST<Entity *>(pEVar1->_parent);
}
return otherRoot == this;
}
// 006a8c60
uint8_t Entity::is_same_segmented_body(Entity *other)
{
Entity *ancestor;
Entity *nextParent;
int type;
type = this->_type;
if (type < 0xd9) {
if (type != 0xd8) {
switch(type) {
case 0x13:
case 0x1c:
case 0x23:
case 0x3e:
case 0x59:
break;
default:
goto switchD_006a8c86_caseD_14;
}
}
}
else if (type < 0x38e) {
if ((type != 0x38d) && (type != 0xef)) {
if (type != 0xf4) {
return 0;
}
if (this->_variant != 2) {
return 0;
}
if (other == GHIDRA_CAST<Entity *>(0x0)) {
return 1;
}
if (other->_type == 0xde) {
return 0;
}
nextParent = GHIDRA_CAST<Entity *>(other->_parent);
while (ancestor = nextParent, ancestor != GHIDRA_CAST<Entity *>(0x0)) {
other = ancestor;
nextParent = GHIDRA_CAST<Entity *>(ancestor->_parent);
}
nextParent = GHIDRA_CAST<Entity *>(this->_parent);
while (ancestor = nextParent, ancestor != GHIDRA_CAST<Entity *>(0x0)) {
this = ancestor;
nextParent = GHIDRA_CAST<Entity *>(ancestor->_parent);
}
if (other == this) {
return 1;
}
return 0;
}
}
else if ((type != 0x390) && (type != 0x396)) {
return 0;
}
if (other == GHIDRA_CAST<Entity *>(0x0)) {
return 1;
}
if (other->_type != 0xde) {
nextParent = GHIDRA_CAST<Entity *>(other->_parent);
while (ancestor = nextParent, ancestor != GHIDRA_CAST<Entity *>(0x0)) {
other = ancestor;
nextParent = GHIDRA_CAST<Entity *>(ancestor->_parent);
}
nextParent = GHIDRA_CAST<Entity *>(this->_parent);
while (ancestor = nextParent, ancestor != GHIDRA_CAST<Entity *>(0x0)) {
this = ancestor;
nextParent = GHIDRA_CAST<Entity *>(ancestor->_parent);
}
if (other == this) {
return 1;
}
}
switchD_006a8c86_caseD_14:
return 0;
}
// 006a8db0
uint8_t Entity::DoesEntityShareStatus()
{
int entityType;
entityType = this->_type;
if (entityType < 0x38e) {
if (entityType != 0x38d) {
switch(entityType) {
case 0x13:
case 0x1c:
case 0x23:
case 0x3e:
case 0x4f:
case 0x59:
case 0x5c:
case 0x5d:
case 0x61:
case 0x62:
case 0xd8:
case 0xef:
break;
default:
return 0;
case 0xf4:
if (this->_variant != 2) {
return 0;
}
}
}
}
else if ((entityType != 0x390) && (entityType != 0x396)) {
return 0;
}
return 1;
}
// 006a8ee0
uint8_t Entity::IsValidTarget(Entity *target)
{
uint8_t isSameBody;
if (target != this) {
isSameBody = is_same_segmented_body(this,target);
if ((isSameBody == 0) && ((this->_type != 0xde || (target->_type != 0xde)))) {
return 1;
}
}
return 0;
}
// 006a8f20
uint8_t Entity::is_valid_boss_enemy(int unused)
{
char isCanShutDoors;
if (((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (this->_type == 1)) ||
(this->_type - 10U < 0x3de)) {
isCanShutDoors = this->CanShutDoors();
if (((isCanShutDoors != '\0') && (this->_type != 0x362)) && ((this->_flags & 0x20000000) == 0))
{
return 1;
}
}
return 0;
}
// 006a8f80
uint8_t Entity::CanDevolve()
{
void *config;
config = this->_config;
if ((config == (void *)0x0) || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(config) + 0xa4)) == *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(config) + 0xa8)))) {
return 0;
}
return 1;
}
// 006a8fa0
uint8_t Entity::IsDescendantOf(Entity *ancestor)
{
Entity *pEVar1;
void *pvVar2;
uint8_t *visitedFlag;
uint8_t isDescendant;
uint8_t findResult [8];
void *foundNode;
void *visitedSet;
uint32_t visitedCount;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
Entity *current;
pEVar1 = ancestor;
local_8 = 0xffffffff;
puStack_c = &LAB_00afa3ed;
local_10 = ExceptionList;
if (ancestor == GHIDRA_CAST<Entity *>(0x0)) {
return 0;
}
if (ancestor == this) {
return 1;
}
visitedSet = (void *)0x0;
visitedCount = 0;
ExceptionList = &local_10;
visitedSet = operator_new(0x18);
*(void **)visitedSet = visitedSet;
*(void **)(GHIDRA_CAST<char *>(visitedSet) + 4) = visitedSet;
*(void **)(GHIDRA_CAST<char *>(visitedSet) + 8) = visitedSet;
*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(visitedSet) + 0xc)) = 0x101;
local_8 = 0;
current = GHIDRA_CAST<Entity *>(this->_parent);
while (ancestor = current, current != GHIDRA_CAST<Entity *>(0x0)) {
if (current == pEVar1) goto LAB_006a9133;
_Find_lower_bound<>(findResult,&ancestor);
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(foundNode) + 0xd)) == '\0') &&
(*GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(foundNode) + 0x10)) <= current)) && (foundNode != visitedSet)) break;
visitedFlag = GHIDRA_CAST<uint8_t *>(_Entity)::GetAncestorField(&ancestor);
*visitedFlag = 1;
current = GHIDRA_CAST<Entity *>(ancestor->_parent);
}
pvVar2 = visitedSet;
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<msvc::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(&visitedSet,(fuzzer_allocator<msvc::_Tree_node<unsigned_int,void*>_> *)&visitedSet,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(visitedSet) + 4));
*(void **)(GHIDRA_CAST<char *>(pvVar2) + 4) = pvVar2;
*(void **)pvVar2 = pvVar2;
*(void **)(GHIDRA_CAST<char *>(pvVar2) + 8) = pvVar2;
current = GHIDRA_CAST<Entity *>(this->_spawnerEntity);
visitedCount = 0;
while (ancestor = current, current != GHIDRA_CAST<Entity *>(0x0)) {
if (current == pEVar1) goto LAB_006a9133;
_Find_lower_bound<>(findResult,&ancestor);
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(foundNode) + 0xd)) == '\0') &&
(*GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(foundNode) + 0x10)) <= current)) && (foundNode != visitedSet)) break;
visitedFlag = GHIDRA_CAST<uint8_t *>(_Entity)::GetAncestorField(&ancestor);
*visitedFlag = 1;
current = GHIDRA_CAST<Entity *>(ancestor->_spawnerEntity);
}
isDescendant = 0;
LAB_006a90ff:
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<msvc::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(&visitedSet,(fuzzer_allocator<msvc::_Tree_node<unsigned_int,void*>_> *)&visitedSet,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(visitedSet) + 4));
operator_delete(visitedSet,0x18);
ExceptionList = local_10;
return isDescendant;
LAB_006a9133:
isDescendant = 1;
goto LAB_006a90ff;
}
// 006a9140
Entity * Entity::GetPlayerAncestor()
{
void *visitedHead;
uint8_t *visitedFlag;
Entity *ancestor;
uint8_t findResult [8];
void *foundNode;
void *visited;
uint32_t visitedSize;
Entity *current;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00afa41d;
local_10 = ExceptionList;
ExceptionList = &local_10;
visited = (void *)0x0;
visitedSize = 0;
visited = operator_new(0x18);
*(void **)visited = visited;
*(void **)(GHIDRA_CAST<char *>(visited) + 4) = visited;
*(void **)(GHIDRA_CAST<char *>(visited) + 8) = visited;
*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(visited) + 0xc)) = 0x101;
local_8 = 0;
current = this;
if (this != GHIDRA_CAST<Entity *>(0x0)) {
do {
ancestor = current;
if (current->_type == 1) goto LAB_006a926c;
_Find_lower_bound<>(findResult,&current);
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(foundNode) + 0xd)) == '\0') &&
(*GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(foundNode) + 0x10)) <= ancestor)) && (foundNode != visited)) break;
visitedFlag = GHIDRA_CAST<uint8_t *>(_Entity)::GetAncestorField(&current);
*visitedFlag = 1;
current = GHIDRA_CAST<Entity *>(current->_parent);
} while (current != GHIDRA_CAST<Entity *>(0x0));
}
visitedHead = visited;
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<msvc::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(&visited,(fuzzer_allocator<msvc::_Tree_node<unsigned_int,void*>_> *)&visited,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(visited) + 4));
*(void **)(GHIDRA_CAST<char *>(visitedHead) + 4) = visitedHead;
*(void **)visitedHead = visitedHead;
*(void **)(GHIDRA_CAST<char *>(visitedHead) + 8) = visitedHead;
visitedSize = 0;
current = this;
if (this != GHIDRA_CAST<Entity *>(0x0)) {
do {
ancestor = current;
if (current->_type == 1) goto LAB_006a926c;
_Find_lower_bound<>(findResult,&current);
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(foundNode) + 0xd)) == '\0') &&
(*GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(foundNode) + 0x10)) <= ancestor)) && (foundNode != visited)) break;
visitedFlag = GHIDRA_CAST<uint8_t *>(_Entity)::GetAncestorField(&current);
*visitedFlag = 1;
current = GHIDRA_CAST<Entity *>(current->_spawnerEntity);
} while (current != GHIDRA_CAST<Entity *>(0x0));
}
ancestor = GHIDRA_CAST<Entity *>(0x0);
LAB_006a926c:
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<msvc::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(&visited,(fuzzer_allocator<msvc::_Tree_node<unsigned_int,void*>_> *)&visited,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(visited) + 4));
operator_delete(visited,0x18);
ExceptionList = local_10;
return ancestor;
}
// 006a92a0
void Entity::SetParent(Entity *parent)
{
Entity *local_8;
uint32_t *parentRef;
parentRef = &this->_parent;
local_8 = this;
if (*parentRef != 0) {
local_8 = GHIDRA_CAST<Entity *>(parentRef);
msvc::multiset<unsigned_int>::erase(&local_8);
}
*parentRef = parent;
if (parent != GHIDRA_CAST<Entity *>(0x0)) {
msvc::multiset<unsigned_int>::insert(parentRef);
}
return;
}
// 006a92e0
void Entity::SetChild(Entity *child)
{
Entity *local_8;
uint32_t *childRef;
childRef = &this->_child;
local_8 = this;
if (*childRef != 0) {
local_8 = GHIDRA_CAST<Entity *>(childRef);
msvc::multiset<unsigned_int>::erase(&local_8);
}
*childRef = child;
if (child != GHIDRA_CAST<Entity *>(0x0)) {
msvc::multiset<unsigned_int>::insert(childRef);
}
return;
}
// 006a9320
void Entity::SetTarget(Entity *target)
{
Entity *local_8;
uint32_t *targetPtr;
targetPtr = &this->_target;
local_8 = this;
if (*targetPtr != 0) {
local_8 = GHIDRA_CAST<Entity *>(targetPtr);
msvc::multiset<unsigned_int>::erase(&local_8);
}
*targetPtr = target;
if (target != GHIDRA_CAST<Entity *>(0x0)) {
msvc::multiset<unsigned_int>::insert(targetPtr);
}
return;
}
// 006a9360
void Entity::SetSpawnerEntity(Entity *spawner)
{
Entity *local_8;
uint32_t *spawnerPtr;
spawnerPtr = &this->_spawnerEntity;
local_8 = this;
if (*spawnerPtr != 0) {
local_8 = GHIDRA_CAST<Entity *>(spawnerPtr);
msvc::multiset<unsigned_int>::erase(&local_8);
}
*spawnerPtr = spawner;
if (spawner != GHIDRA_CAST<Entity *>(0x0)) {
msvc::multiset<unsigned_int>::insert(spawnerPtr);
}
return;
}
// 006a93a0
void Entity::Init(int type, int variant, int subType, uint32_t initSeed)
{
float fVar1;
uint32_t noScoreFlag;
uint32_t defaultColor [8];
uint32_t local_10;
uint32_t uStack_c;
uint32_t local_8;
float baseFriction;
uint32_t damageEventsBegin;
Game *game;
uint32_t *luaRef;
int vtable;
this->_type = type;
this->_variant = variant;
this->_subtype = subType;
this->_initSeed = initSeed;
(this->_dropRNG)._seed = initSeed;
(this->_dropRNG)._shift1 = 4;
(this->_dropRNG)._shift2 = 3;
(this->_dropRNG)._shift3 = 0x11;
(this->_splatColor)._tint[0] = 1.0;
(this->_splatColor)._tint[1] = 1.0;
(this->_splatColor)._tint[2] = 1.0;
(this->_splatColor)._tint[3] = 1.0;
(this->_splatColor)._colorize[0] = 0.0;
(this->_splatColor)._colorize[1] = 0.0;
(this->_splatColor)._colorize[2] = 0.0;
(this->_splatColor)._colorize[3] = 0.0;
(this->_splatColor)._offset[0] = 0.0;
(this->_splatColor)._offset[1] = 0.0;
(this->_splatColor)._offset[2] = 0.0;
this->LoadEntityConfig();
baseFriction = this->_baseFriction;
(this->_shadowOffset).x = g_vectorZero.x;
fVar1 = g_vectorZero.y;
this->_friction = baseFriction;
game = g_game;
(this->_shadowOffset).y = fVar1;
this->_pauseTimer = 0;
this->_index = 0;
this->_collisionIndex = 0;
this->_spawnFrame = game->_frameCount;
this->_health = this->_maxHitPoints;
this->_spawnGridIndex = -1;
(this->_targetPosition).x = g_vectorZero.x;
(this->_targetPosition).y = g_vectorZero.y;
this->_speedMultiplier = 1.0;
this->_prevUpdateTime = -1e-05;
this->_updateTime = 0.0;
(this->_posOffset).x = g_vectorZero.x;
(this->_posOffset).y = g_vectorZero.y;
this->_renderZOffset = 0;
this->_renderDepthOffset = 0.0;
this->_sortingLayer = 2;
this->_visible = 1;
this->_exists = 1;
this->_dead = 0;
this->_isKillOnTouch = 0;
this->_isInitFlag176 = 0;
this->_removedByFactory = 0;
this->_entityCollisionClass = 4;
this->_collidesWithEntity = 0;
this->_collidesWithGrid = 0;
(this->_gridCollisionNormal).x = g_vectorZero.x;
(this->_gridCollisionNormal).y = g_vectorZero.y;
(this->_gridCollisionVelocity).x = g_vectorZero.x;
(this->_gridCollisionVelocity).y = g_vectorZero.y;
local_10 = 0;
uStack_c = 0;
local_8 = 0;
if (&this->_color != GHIDRA_CAST<ColorMod *>(defaultColor)) {
(this->_color)._tint[0] = 1.0;
(this->_color)._tint[1] = 1.0;
(this->_color)._tint[2] = 1.0;
(this->_color)._tint[3] = 1.0;
(this->_color)._offset[0] = 0.0;
(this->_color)._offset[1] = 0.0;
(this->_color)._colorize[0] = 0.0;
(this->_color)._colorize[1] = 0.0;
(this->_color)._colorize[2] = 0.0;
(this->_color)._colorize[3] = 0.0;
(this->_color)._offset[2] = 0.0;
}
damageEventsBegin = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8))));
luaRef = &this->_minecart;
this->_fireDamageCountdown = 0;
this->_damageCountdown = 0;
this->_freezeCountdown = 0;
this->_poisonCountdown = 0;
this->_poisonTickDamage = 2.0;
this->_burnTickDamage = 2.0;
this->_slowingCountdown = 0;
this->_slowingAmount = 0.9;
this->_charmedCountdown = 0;
this->_confusionCountdown = 0;
this->_midasFreezeCountdown = 0;
this->_fearCountdown = 0;
this->_burnCountdown = 0;
this->_shrinkCountdown = 0;
this->_bleedingCountdown = 0;
this->_bleedDamageAccumulator = 0.0;
this->_poisonDamageTimer = 0;
this->_burnDamageTimer = 0;
this->_magnetizedCountdown = 0;
this->_baitedCountdown = 0;
this->_knockbackCountdown = 0;
this->_iceCountdown = 0;
this->_weaknessCountdown = 0;
this->_brimstoneMarkCountdown = 0;
this->_iceFrozenEffect = 0;
this->_bossStatusEffectCooldown = 0;
*GHIDRA_CAST<uint32_t *>(&this->_flags) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = 0;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc)))) = damageEventsBegin;
this->_pendingDamage = 0.0;
*GHIDRA_CAST<uint32_t *>(&this->_pendingDamageFlags) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_pendingDamageFlags) + 4)) = 0;
this->_isInvicible = 0;
this->_isInterpolating = 0;
this->_holdCountdown = 0;
this->_shrinkStatus1 = 1.0;
this->_shrinkStatus2 = 1.0;
this->_parent = 0;
this->_child = 0;
this->_target = 0;
if (*luaRef != 0) {
type = GHIDRA_INT(luaRef);
msvc::multiset<unsigned_int>::erase(&type);
*luaRef = 0;
}
if (this->_hitEffect != 0) {
type = GHIDRA_INT(&this->_hitEffect);
msvc::multiset<unsigned_int>::erase(&type);
this->_hitEffect = 0;
}
(this->_prevPosition).x = (this->_pos).x;
(this->_prevPosition).y = (this->_pos).y;
(this->_prevVelocity).x = (this->_velocity).x;
(this->_prevVelocity).y = (this->_velocity).y;
vtable = *GHIDRA_CAST<int *>(this);
this->_pitfallState = 0;
this->_pitfallTimer = 0;
(this->_pausePosition).x = g_vectorZero.x;
(this->_pausePosition).y = g_vectorZero.y;
(**(code **)(vtable + 0x60))();
this->_scoreMultiplier = 1.0;
if (this->_type == 0x110) {
noScoreFlag = GHIDRA_UINT(g_game->_gameStateFlags) & 0x4000000;
}
else {
if (this->_type != 0x10f) goto LAB_006a986e;
noScoreFlag = GHIDRA_UINT(g_game->_gameStateFlags) & 0x2000000;
}
if (noScoreFlag != 0) {
this->_scoreMultiplier = 0.0;
}
LAB_006a986e:
luaRef = this->_luaBridgeRef;
if (luaRef != GHIDRA_CAST<uint32_t *>(0x0)) {
luaL_unref(*luaRef,0xfff0b9d8,luaRef[1]);
operator_delete(luaRef,8);
this->_luaBridgeRef = (void *)0x0;
}
return;
}
// 006a98b0
void Entity::LoadEntityConfig()
{
void *pvVar1;
uint8_t isMatch;
EntityConfig *entityConfig;
EntityConfig_Entity *pEVar2;
uint8_t *gridCollisionText;
int entityType;
int variant;
uint8_t *gridCollisionString;
float stageClamped;
float maxHp;
uint32_t gridCollisionCapacity;
uint32_t gridCollisionLength;
float stageHp;
entityConfig = &g_manager->_entityConfig;
variant = this->_variant;
entityType = this->_type;
pEVar2 = EntityConfig::GetEntity(entityConfig,entityType,variant,this->_subtype);
if (pEVar2 != GHIDRA_CAST<EntityConfig_Entity *>(0x0)) {
EntityConfig::PreloadResources(entityConfig,pEVar2);
variant = this->_variant;
entityType = this->_type;
}
pEVar2 = EntityConfig::GetEntity(&g_manager->_entityConfig,entityType,variant,this->_subtype);
this->_config = pEVar2;
if (pEVar2 == GHIDRA_CAST<EntityConfig_Entity *>(0x0)) {
pvVar1 = (this->_collisionPoints)._begin;
this->_size = 1.0;
(this->_sizeMulti).x = g_vectorOne.x;
(this->_sizeMulti).y = g_vectorOne.y;
this->_shadowSize = 0.015625;
this->_collisionDamage = 0.0;
this->_maxHitPoints = 0.0;
this->_mass = 0.0;
(this->_collisionPoints)._end = pvVar1;
this->_entityGridCollisionClass = 3;
this->_baseFriction = 1.0;
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("config for entity %d.%d is missing\n"));
return;
}
this->_shadowSize = pEVar2->shadowSize;
this->_collisionDamage = pEVar2->collisionDamage;
this->_mass = pEVar2->mass;
stageHp = pEVar2->stageHP;
maxHp = pEVar2->baseHP;
if (0.001 < stageHp) {
stageClamped = (float)g_game->_stage;
if (10.0 <= stageClamped) {
stageClamped = 10.0;
}
if (g_game->_stage < 5) {
maxHp = stageClamped * 1.0 * stageHp + maxHp;
}
else {
maxHp = stageClamped * 0.8 * stageHp + maxHp;
}
}
this->_maxHitPoints = maxHp;
this->_size = 0.0;
(this->_sizeMulti).x = g_vectorZero.x;
(this->_sizeMulti).y = g_vectorZero.y;
SetSize(this,pEVar2->collisionRadius,pEVar2->collisionRadiusMulti,pEVar2->gridCollisionPoints);
pvVar1 = this->_config;
this->_baseFriction = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + 0x4c));
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0xc4)) == 0) {
this->_entityGridCollisionClass =
(-GHIDRA_UINT((GHIDRA_INT((this->_collisionPoints)._end) - GHIDRA_INT((this->_collisionPoints)._begin) >> 3 !=
0)) & 2) + 3;
return;
}
gridCollisionCapacity = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(pvVar1) + 200));
gridCollisionString = GHIDRA_CAST<uint8_t *>((GHIDRA_INT(pvVar1) + 0xb4));
gridCollisionLength = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(pvVar1) + 0xc4));
gridCollisionText = gridCollisionString;
if (0xf < gridCollisionCapacity) {
gridCollisionText = *GHIDRA_CAST<uint8_t **>(gridCollisionString);
}
isMatch = str_eq(gridCollisionText,gridCollisionLength,GHIDRA_CAST<uint8_t *>(&DAT_00b671d0),4);
if (isMatch != 0) {
this->_entityGridCollisionClass = 0;
return;
}
gridCollisionText = gridCollisionString;
if (0xf < gridCollisionCapacity) {
gridCollisionText = *GHIDRA_CAST<uint8_t **>(gridCollisionString);
}
isMatch = str_eq(gridCollisionText,gridCollisionLength,GHIDRA_CAST<uint8_t *>("walls"),5);
if (isMatch != 0) {
this->_entityGridCollisionClass = 3;
return;
}
gridCollisionText = gridCollisionString;
if (0xf < gridCollisionCapacity) {
gridCollisionText = *GHIDRA_CAST<uint8_t **>(gridCollisionString);
}
isMatch = str_eq(gridCollisionText,gridCollisionLength,GHIDRA_CAST<uint8_t *>("ground"),6);
if (isMatch != 0) {
this->_entityGridCollisionClass = 5;
return;
}
if (0xf < gridCollisionCapacity) {
gridCollisionString = *GHIDRA_CAST<uint8_t **>(gridCollisionString);
}
isMatch = str_eq(gridCollisionString,gridCollisionLength,GHIDRA_CAST<uint8_t *>("nopits"),6);
if (isMatch == 0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("Invalid grid collision class for entity config %d.%d.%d"));
return;
}
this->_entityGridCollisionClass = 6;
return;
}
// 006a9ba0
void * Entity::GetCollisionCapsule(void *outCapsule, Vector *offset)
{
Vector capsuleCenter;
capsuleCenter.x = offset->x + (this->_pos).x;
capsuleCenter.y = (this->_pos).y + offset->y;
Capsule::constructor
(outCapsule,&capsuleCenter,&this->_sizeMulti,(this->_sprite)._rotation,this->_size);
return outCapsule;
}
// 006a9c10
int Entity::FrameCount()
{
return g_game->_frameCount - this->_spawnFrame;
}
// 006a9c30
bool Entity::HasFullHealth()
{
return this->_maxHitPoints <= this->_health;
}
// 006a9c50
void Entity::AddHealth(float amount)
{
float *clampedHealth;
amount = amount + this->_health;
clampedHealth = &amount;
if (this->_maxHitPoints <= amount) {
clampedHealth = &this->_maxHitPoints;
}
this->_health = *clampedHealth;
return;
}
// 006a9c90
void Entity::CollideWithGrid(uint8_t isSimulated)
{
void *pvVar1;
uint8_t bVar2;
char isDestroyed;
int iVar3;
GridEntity *gridEntity;
uint32_t uVar4;
int neighborRow;
GridEntity *pit;
uint32_t uVar5;
int iVar6;
uint32_t uVar7;
uint8_t *signY;
uint8_t *sign;
float fVar8;
float fVar9;
float fVar10;
float fVar11;
float fVar12;
float fVar13;
uint8_t isNoPush;
float local_70;
float local_6c;
int gridCollisionClass;
GridEntity *cellGridEntity;
uint32_t pointIndex;
uint32_t local_48;
float local_44;
float normalY;
Vector local_38;
uint32_t hitSourceType;
uint32_t hitSourceVariant;
int hitSpawnerType;
int hitSpawnerVariant;
float hitPosX;
float hitPosY;
float hitVelX;
float hitVelY;
uint32_t hitFlags;
Entity *hitSourceEntity;
Vector *clampPos;
void *collisionPointsEnd;
Room *curRoom;
bool isWallCollision;
Vector *pos;
Room *room;
if (isSimulated == 0) {
this->_collidesWithGrid = 0;
}
if (this->_minecart != 0) {
return;
}
gridCollisionClass = this->_entityGridCollisionClass;
if (gridCollisionClass == 0) {
return;
}
room = g_game->_room;
if (((this->_type == 9) && (gridCollisionClass == 4)) && (room->_roomType == 0x10)) {
gridCollisionClass = 6;
}
pos = &this->_pos;
Room::GetClampedPositionImpl(room,&local_38,pos,0.0,0.0,0.0,0.0);
normalY = g_vectorZero.y;
local_44 = g_vectorZero.x;
if (gridCollisionClass == 1) {
if (isSimulated != 0) {
pos->x = local_38.x;
return;
}
pos = &this->_pos;
if ((this->_pos).x == local_38.x) {
this->_collidesWithGrid = 0;
pos->x = local_38.x;
return;
}
this->_collidesWithGrid = 1;
(this->_gridCollisionVelocity).x = (this->_velocity).x;
(this->_gridCollisionVelocity).y = (this->_velocity).y;
if (pos->x <= local_38.x) {
sign = GHIDRA_CAST<uint8_t *>(0x3f800000);
}
else {
sign = &DAT_bf800000;
}
(this->_gridCollisionNormal).x = (float)sign;
(this->_gridCollisionNormal).y = 0.0;
pos->x = local_38.x;
return;
}
if (gridCollisionClass == 2) {
if (isSimulated == 0) {
fVar10 = (this->_pos).y;
if (fVar10 != local_38.y) {
this->_collidesWithGrid = 1;
(this->_gridCollisionVelocity).x = (this->_velocity).x;
(this->_gridCollisionVelocity).y = (this->_velocity).y;
if (fVar10 <= local_38.y) {
sign = GHIDRA_CAST<uint8_t *>(0x3f800000);
}
else {
sign = &DAT_bf800000;
}
(this->_gridCollisionNormal).x = 0.0;
(this->_gridCollisionNormal).y = (float)sign;
(this->_pos).y = local_38.y;
return;
}
this->_collidesWithGrid = 0;
}
(this->_pos).y = local_38.y;
return;
}
if (((gridCollisionClass == 3) || (gridCollisionClass == 5)) ||
((gridCollisionClass == 6 || (gridCollisionClass == 7)))) {
clampPos = &this->_pos;
if (isSimulated == 0) {
if ((clampPos->x == local_38.x) && ((this->_pos).y == local_38.y)) {
this->_collidesWithGrid = 0;
clampPos->x = local_38.x;
(this->_pos).y = local_38.y;
goto LAB_006a9f87;
}
this->_collidesWithGrid = 1;
(this->_gridCollisionVelocity).x = (this->_velocity).x;
(this->_gridCollisionVelocity).y = (this->_velocity).y;
if (clampPos->x != local_38.x) {
if (clampPos->x <= local_38.x) {
sign = &DAT_bf800000;
}
else {
sign = GHIDRA_CAST<uint8_t *>(0x3f800000);
}
local_44 = (float)sign + local_44;
}
fVar10 = (this->_pos).y;
if (fVar10 != local_38.y) {
if (fVar10 <= local_38.y) {
sign = &DAT_bf800000;
}
else {
sign = GHIDRA_CAST<uint8_t *>(0x3f800000);
}
normalY = (float)sign + normalY;
}
}
clampPos->x = local_38.x;
(this->_pos).y = local_38.y;
}
LAB_006a9f87:
if (gridCollisionClass == 4) {
if (isSimulated != 0) {
return;
}
if ((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0x1bb0)) == 0x37) ||
(isNoPush = isSimulated, (*GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 4)) + 0x44)) >> 0xf & 1) != 0
)) {
isNoPush = 1;
}
iVar3 = (GHIDRA_CAST<Room *>((room)))->Room::GetGridCollisionAtPos(this->_pos);
if ((iVar3 == 4) || (iVar3 == 5)) {
isWallCollision = true;
Room::GetClampedPositionImpl(g_game->_room,&local_38,&this->_pos,0.0,0.0,0.0,0.0);
bVar2 = (GHIDRA_CAST<Vector *>((&local_38)))->Vector::operator_ne(&this->_pos);
if (bVar2 != 0) {
if (isNoPush != 0) {
return;
}
if (0.0 <= (local_38.y - (this->_pos).y) * (this->_velocity).y +
(local_38.x - (this->_pos).x) * (this->_velocity).x) {
return;
}
}
}
else {
isWallCollision = false;
}
if ((iVar3 != 3) && (!isWallCollision)) {
if (this->_type != 2) {
return;
}
if (iVar3 != 2) {
return;
}
}
gridEntity = (GHIDRA_CAST<Room *>((room)))->Room::GetGridEntityFromPos(&this->_pos);
if (gridEntity == GHIDRA_CAST<GridEntity *>(0x0)) {
return;
}
gridEntity = (GHIDRA_CAST<Room *>((room)))->Room::GetGridEntityFromPos(&this->_pos);
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((gridEntity)) + 0x4)))) == 7) {
return;
}
this->_collidesWithGrid = 1;
(this->_gridCollisionVelocity).x = (this->_velocity).x;
(this->_gridCollisionVelocity).y = (this->_velocity).y;
return;
}
pvVar1 = (this->_collisionPoints)._begin;
collisionPointsEnd = (this->_collisionPoints)._end;
if (pvVar1 == collisionPointsEnd) {
return;
}
uVar5 = GHIDRA_INT(collisionPointsEnd) - GHIDRA_INT(pvVar1) >> 3;
local_6c = g_vectorZero.x;
local_38.x = g_vectorZero.x;
local_70 = g_vectorZero.y;
local_38.y = g_vectorZero.y;
if (gridCollisionClass == 5) {
if (uVar5 != 0) {
uVar7 = 0;
do {
fVar10 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + uVar7 * 8));
fVar11 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + uVar7 * 8 + 4));
iVar3 = GHIDRA_INT(((((this->_pos).y + fVar11) - 120.0) / 40.0 + 0.5));
iVar6 = GHIDRA_INT((((fVar10 + (this->_pos).x) - 40.0) / 40.0 + 0.5));
if ((((iVar6 < 0) || (room->_gridWidth <= iVar6)) || (iVar3 < 0)) ||
(room->_gridHeight <= iVar3)) {
iVar6 = -1;
}
else {
iVar6 = iVar3 * room->_gridWidth + iVar6;
}
uVar4 = (GHIDRA_CAST<Room *>((room)))->Room::GetGridCollision(iVar6);
if (uVar4 != 0) {
local_6c = fVar10 + local_6c;
local_70 = local_70 + fVar11;
local_38.x = local_6c;
local_38.y = local_70;
}
uVar7 = uVar7 + 1;
} while (uVar7 < uVar5);
}
}
else if (gridCollisionClass == 7) {
if (uVar5 != 0) {
uVar7 = 0;
do {
fVar10 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + uVar7 * 8));
fVar11 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + uVar7 * 8 + 4));
iVar3 = GHIDRA_INT(((((this->_pos).y + fVar11) - 120.0) / 40.0 + 0.5));
iVar6 = GHIDRA_INT((((fVar10 + (this->_pos).x) - 40.0) / 40.0 + 0.5));
if (((iVar6 < 0) || (room->_gridWidth <= iVar6)) ||
((iVar3 < 0 || (room->_gridHeight <= iVar3)))) {
iVar6 = -1;
}
else {
iVar6 = iVar3 * room->_gridWidth + iVar6;
}
uVar4 = (GHIDRA_CAST<Room *>((room)))->Room::GetGridCollision(iVar6);
if (uVar4 != 1) {
local_6c = fVar10 + local_6c;
local_70 = local_70 + fVar11;
local_38.x = local_6c;
local_38.y = local_70;
}
uVar7 = uVar7 + 1;
} while (uVar7 < uVar5);
}
}
else if (gridCollisionClass == 6) {
pointIndex = 0;
if (uVar5 != 0) {
do {
pvVar1 = (this->_collisionPoints)._begin;
iVar6 = GHIDRA_INT(((((this->_pos).x + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + pointIndex * 8))) - 40.0) / 40.0 +
0.5));
iVar3 = GHIDRA_INT((((*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + pointIndex * 8 + 4)) + (this->_pos).y) - 120.0) /
40.0 + 0.5));
if (((iVar6 < 0) || (room->_gridWidth <= iVar6)) ||
((iVar3 < 0 || (room->_gridHeight <= iVar3)))) {
local_48 = (GHIDRA_CAST<Room *>((room)))->Room::GetGridCollision(-1);
if (-1 < iVar6) goto LAB_006aa40c;
LAB_006aa43d:
cellGridEntity = GHIDRA_CAST<GridEntity *>(0x0);
}
else {
local_48 = (GHIDRA_CAST<Room *>((room)))->Room::GetGridCollision(iVar3 * room->_gridWidth + iVar6);
LAB_006aa40c:
if ((((room->_gridWidth <= iVar6) || (iVar3 < 0)) || (room->_gridHeight <= iVar3)) ||
(uVar7 = iVar3 * room->_gridWidth + iVar6, 0x1bf < uVar7)) goto LAB_006aa43d;
cellGridEntity = room->_gridEntities[uVar7];
}
if (((local_48 != 0) && (local_48 != 1)) &&
((cellGridEntity == GHIDRA_CAST<GridEntity *>(0x0) || (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((cellGridEntity)) + 0x4)))) != 7)))) {
pvVar1 = (this->_collisionPoints)._begin;
local_6c = local_6c + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + pointIndex * 8));
local_70 = local_70 + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + pointIndex * 8 + 4));
local_38.x = local_6c;
local_38.y = local_70;
}
if (((isSimulated == 0) && (this->_type == 3)) &&
(((((this->_variant == 0x4b &&
(((local_48 == 3 || (local_48 == 2)) && (pvVar1 = g_game->_room, -1 < iVar6)))) &&
(((iVar6 < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0xc)) && (-1 < iVar3)) &&
(iVar3 < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x10)))))) &&
((iVar6 = iVar3 * *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0xc)) + iVar6, -1 < iVar6 && (iVar6 < 0x1c0))))
&& (gridEntity = room->_gridEntities[iVar6], gridEntity != GHIDRA_CAST<GridEntity *>(0x0))))) {
fVar10 = (this->_velocity).y;
fVar11 = (this->_velocity).x;
if ((25.0 < fVar11 * fVar11 + fVar10 * fVar10) && (gridEntity->_collisionClass == 3)) {
hitPosX = (this->_pos).x;
hitPosY = (this->_pos).y;
hitSpawnerType = this->_spawnerType;
hitSpawnerVariant = this->_spawnerVariant;
hitVelX = (this->_velocity).x;
hitVelY = (this->_velocity).y;
hitSourceType = 3;
hitSourceVariant = 0x4b;
local_48 = GHIDRA_UINT(((this->_flags & 0x100) != 0));
if ((this->_flags & 0x20000000) == 0) {
uVar7 = 0;
}
else {
uVar7 = 2;
}
if ((this->_flags & 0x40000000000000) == 0) {
uVar4 = 0;
}
else {
uVar4 = 4;
}
hitFlags = uVar4 | uVar7 | local_48;
hitSourceEntity = this;
isDestroyed = gridEntity->Destroy(0,&hitSourceType);
if (isDestroyed != '\0') {
curRoom = g_game->_room;
iVar3 = curRoom->_gridWidth;
fVar9 = (float)(gridEntity->_gridIndex % iVar3) * 40.0 + 40.0;
fVar12 = (float)(gridEntity->_gridIndex / iVar3) * 40.0 + 120.0;
fVar10 = fVar9 - (this->_pos).x;
fVar11 = fVar12 - (this->_pos).y;
if (ABS(fVar10) <= ABS(fVar11)) {
sign = GHIDRA_CAST<uint8_t *>(0x0);
if (0.0 <= fVar11) {
signY = GHIDRA_CAST<uint8_t *>(0x3f800000);
}
else {
signY = &DAT_bf800000;
}
}
else {
signY = GHIDRA_CAST<uint8_t *>(0x0);
if (0.0 <= fVar10) {
sign = GHIDRA_CAST<uint8_t *>(0x3f800000);
}
else {
sign = &DAT_bf800000;
}
}
iVar6 = GHIDRA_INT(((((float)sign * 40.0 + fVar9) - 40.0) / 40.0 + 0.5));
if ((((-1 < iVar6) && (iVar6 < iVar3)) &&
(neighborRow = GHIDRA_INT(((((float)signY * 40.0 + fVar12) - 120.0) / 40.0 + 0.5)),
-1 < neighborRow)) &&
((neighborRow < curRoom->_gridHeight &&
(iVar6 = neighborRow * iVar3 + iVar6, -1 < iVar6)))) {
if (iVar6 < 0x1c0) {
pit = room->_gridEntities[iVar6];
}
else {
pit = GHIDRA_CAST<GridEntity *>(0x0);
}
(GHIDRA_CAST<Room *>((curRoom)))->Room::TryMakeBridge(pit,gridEntity);
}
goto LAB_006aa782;
}
}
local_6c = g_vectorZero.x;
local_38.x = g_vectorZero.x;
local_70 = g_vectorZero.y;
local_38.y = g_vectorZero.y;
}
LAB_006aa782:
pointIndex = pointIndex + 1;
} while (pointIndex < uVar5);
}
}
else if (uVar5 != 0) {
uVar7 = 0;
do {
fVar10 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + uVar7 * 8));
fVar11 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + uVar7 * 8 + 4));
iVar6 = GHIDRA_INT(((((this->_pos).x + fVar10) - 40.0) / 40.0 + 0.5));
iVar3 = GHIDRA_INT(((((this->_pos).y + fVar11) - 120.0) / 40.0 + 0.5));
if (((iVar6 < 0) || (room->_gridWidth <= iVar6)) ||
((iVar3 < 0 || (room->_gridHeight <= iVar3)))) {
iVar6 = -1;
}
else {
iVar6 = iVar3 * room->_gridWidth + iVar6;
}
uVar4 = (GHIDRA_CAST<Room *>((room)))->Room::GetGridCollision(iVar6);
if (((uVar4 == 4) || (uVar4 == 5)) && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 8)) != 0x10)) {
local_6c = fVar10 + local_6c;
local_70 = local_70 + fVar11;
local_38.x = local_6c;
local_38.y = local_70;
}
uVar7 = uVar7 + 1;
} while (uVar7 < uVar5);
}
if ((local_6c == g_vectorZero.x) && (local_70 == g_vectorZero.y)) {
if (isSimulated == 0) {
(this->_gridCollisionNormal).x = local_44;
(this->_gridCollisionNormal).y = normalY;
return;
}
return;
}
if ((this->_type != 2) || (0.001 <= local_70 * local_70 + local_6c * local_6c)) {
bVar2 = IsEnemy(this);
if ((bVar2 != 0) &&
((gridCollisionClass == 5 && (local_70 * local_70 + local_6c * local_6c < 0.001)))) {
pos = &this->_pos;
(GHIDRA_CAST<Room *>((g_game->_room)))->Room::FindFreeTilePosition(&local_38,pos,40.0);
fVar10 = 20.0 - this->_size * (this->_sizeMulti).x;
if (local_38.x - pos->x <= 0.0) {
local_38.x = local_38.x + fVar10;
}
else {
local_38.x = local_38.x - fVar10;
}
fVar10 = 20.0 - this->_size * (this->_sizeMulti).y;
if (0.0 < local_38.y - (this->_pos).y) {
pos->x = local_38.x;
(this->_pos).y = local_38.y - fVar10;
return;
}
pos->x = local_38.x;
(this->_pos).y = local_38.y + fVar10;
return;
}
}
else {
iVar3 = (GHIDRA_CAST<Room *>((room)))->Room::GetGridIndex(&this->_pos);
fVar10 = this->_size;
fVar11 = (this->_sizeMulti).x;
fVar9 = fVar10 * fVar11;
fVar13 = (this->_pos).x - ((float)(iVar3 % room->_gridWidth) * 40.0 + 40.0);
fVar12 = (this->_pos).y - ((float)(iVar3 / room->_gridWidth) * 40.0 + 120.0);
if ((ABS(fVar13) + fVar9 < 20.0) || (ABS(fVar12) + fVar10 * (this->_sizeMulti).y < 20.0)) {
local_38.y = (this->_sizeMulti).y;
if (ABS(fVar11 * fVar13) <= ABS(local_38.y * fVar12)) {
local_38.x = 0.0;
local_38.y = local_38.y * fVar10;
if (0.0 < fVar12) {
local_38.y = local_38.y * -1.0;
}
}
else {
local_38.y = 0.0;
local_38.x = fVar9;
if (0.0 < fVar13) {
local_38.x = fVar9 * -1.0;
}
}
}
}
(GHIDRA_CAST<Vector *>((&local_38)))->Vector::Normalize();
if (isSimulated == 0) {
(this->_gridCollisionNormal).x = local_38.x;
(this->_gridCollisionNormal).y = local_38.y;
}
fVar10 = (this->_velocity).y;
fVar11 = (this->_velocity).x;
fVar9 = -local_38.x * fVar11 - fVar10 * local_38.y;
if (0.0 <= fVar9) {
return;
}
if (isSimulated != 0) goto LAB_006aad6f;
(this->_gridCollisionVelocity).x = fVar11;
this->_collidesWithGrid = 1;
(this->_gridCollisionVelocity).y = fVar10;
iVar3 = this->_type;
fVar10 = fVar9 * 1.8 - 0.1;
if (iVar3 == 99) {
fVar11 = -fVar9 * 0.05;
if (1.2 <= fVar11) {
fVar11 = 1.2;
}
play_sound_with_fart_seed(0x1c,fVar11,2,0,1.0);
fVar10 = fVar10 * 1.4;
goto LAB_006aad37;
}
if ((iVar3 == 0xd9) || (iVar3 == 0xdc)) {
LAB_006aad2f:
fVar10 = fVar10 * 1.2;
}
else if (iVar3 == 0x393) {
if (this->_variant == 1) goto LAB_006aac90;
}
else if (iVar3 == 0x37d) {
LAB_006aac90:
uVar5 = Random();
fVar11 = (this->_velocity).y;
fVar12 = (this->_velocity).x;
fVar13 = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) *
2.3283064e-10 * 0.2 + 0.9;
bVar2 = 0;
iVar6 = 2;
fVar11 = sqrtf(fVar12 * fVar12 + fVar11 * fVar11);
iVar3 = 0x1e7;
if (this->_type == 0x37d) {
iVar3 = 0x245;
}
fVar11 = fVar11 * 0.05 + 0.2;
if (1.2 <= fVar11) {
fVar11 = 1.2;
}
play_sound_with_fart_seed(iVar3,fVar11,iVar6,bVar2,fVar13);
goto LAB_006aad2f;
}
LAB_006aad37:
(this->_velocity).x = fVar10 * (this->_gridCollisionNormal).x + (this->_velocity).x;
fVar10 = fVar10 * (this->_gridCollisionNormal).y + (this->_velocity).y;
(this->_velocity).y = fVar10;
LAB_006aad6f:
fVar11 = (this->_velocity).x;
fVar10 = sqrtf(fVar11 * fVar11 + fVar10 * fVar10);
if (0.0 < fVar10) {
fVar11 = local_38.y * (this->_sizeMulti).y;
fVar12 = local_38.x * (this->_sizeMulti).x;
fVar12 = sqrtf(fVar11 * fVar11 + fVar12 * fVar12);
fVar12 = fVar12 * this->_size;
fVar11 = (this->_pos).x;
local_70 = fVar10;
if (fVar10 <= 2.0) {
local_70 = 2.0;
}
local_70 = fVar12 - local_70;
local_6c = fVar12;
if (gridCollisionClass == 5) {
local_44 = 1.68156e-44;
do {
fVar13 = (local_6c - local_70) * 0.5 + local_70;
iVar6 = GHIDRA_INT((((fVar13 * local_38.x + fVar11) - 40.0) / 40.0 + 0.5));
iVar3 = GHIDRA_INT((((fVar13 * local_38.y + (this->_pos).y) - 120.0) / 40.0 + 0.5));
if ((((iVar6 < 0) || (room->_gridWidth <= iVar6)) || (iVar3 < 0)) ||
(room->_gridHeight <= iVar3)) {
iVar6 = -1;
}
else {
iVar6 = iVar3 * room->_gridWidth + iVar6;
}
uVar5 = (GHIDRA_CAST<Room *>((room)))->Room::GetGridCollision(iVar6);
if (uVar5 == 0) {
local_70 = fVar13;
}
else {
local_6c = fVar13;
}
local_44 = (float)(GHIDRA_INT(local_44) + -1);
} while (local_44 != 0.0);
}
else if (gridCollisionClass == 7) {
local_44 = 8.40779e-45;
do {
fVar13 = (local_6c - local_70) * 0.5 + local_70;
iVar6 = GHIDRA_INT((((fVar13 * local_38.x + fVar11) - 40.0) / 40.0 + 0.5));
iVar3 = GHIDRA_INT((((fVar13 * local_38.y + (this->_pos).y) - 120.0) / 40.0 + 0.5));
if (((iVar6 < 0) || (room->_gridWidth <= iVar6)) ||
((iVar3 < 0 || (room->_gridHeight <= iVar3)))) {
iVar6 = -1;
}
else {
iVar6 = iVar3 * room->_gridWidth + iVar6;
}
uVar5 = (GHIDRA_CAST<Room *>((room)))->Room::GetGridCollision(iVar6);
if (uVar5 == 1) {
local_70 = fVar13;
}
else {
local_6c = fVar13;
}
local_44 = (float)(GHIDRA_INT(local_44) + -1);
} while (local_44 != 0.0);
}
else {
fVar13 = (this->_pos).y;
if (gridCollisionClass == 6) {
local_44 = (float)gridCollisionClass;
do {
fVar8 = (local_6c - local_70) * 0.5 + local_70;
iVar6 = GHIDRA_INT((((fVar8 * local_38.x + fVar11) - 40.0) / 40.0 + 0.5));
iVar3 = GHIDRA_INT((((fVar8 * local_38.y + fVar13) - 120.0) / 40.0 + 0.5));
if (((iVar6 < 0) || (room->_gridWidth <= iVar6)) ||
((iVar3 < 0 || (room->_gridHeight <= iVar3)))) {
iVar6 = -1;
}
else {
iVar6 = iVar3 * room->_gridWidth + iVar6;
}
uVar5 = (GHIDRA_CAST<Room *>((room)))->Room::GetGridCollision(iVar6);
if ((uVar5 == 0) || (uVar5 == 1)) {
local_70 = fVar8;
}
else {
local_6c = fVar8;
}
local_44 = (float)(GHIDRA_INT(local_44) + -1);
} while (local_44 != 0.0);
}
else {
local_44 = 8.40779e-45;
do {
fVar8 = (local_6c - local_70) * 0.5 + local_70;
iVar6 = GHIDRA_INT((((fVar8 * local_38.x + fVar11) - 40.0) / 40.0 + 0.5));
iVar3 = GHIDRA_INT((((fVar8 * local_38.y + fVar13) - 120.0) / 40.0 + 0.5));
if ((((iVar6 < 0) || (room->_gridWidth <= iVar6)) || (iVar3 < 0)) ||
(room->_gridHeight <= iVar3)) {
iVar6 = -1;
}
else {
iVar6 = iVar3 * room->_gridWidth + iVar6;
}
uVar5 = (GHIDRA_CAST<Room *>((room)))->Room::GetGridCollision(iVar6);
if ((uVar5 == 4) || (uVar5 == 5)) {
local_6c = fVar8;
}
else {
local_70 = fVar8;
}
local_44 = (float)(GHIDRA_INT(local_44) + -1);
} while (local_44 != 0.0);
}
}
pos->x = local_38.x * (local_70 - fVar12) + pos->x;
(this->_pos).y = local_38.y * (local_70 - fVar12) + (this->_pos).y;
}
if (isSimulated == 0) {
fVar10 = 1.0 - (-fVar9 / fVar10) * 0.5;
(this->_velocity).y = fVar10 * (this->_velocity).y;
(this->_velocity).x = fVar10 * (this->_velocity).x;
}
return;
}
// 006ab240
uint8_t Entity::is_grid_collision_at(Vector *position)
{
uint32_t gridCollision;
int gridY;
uint32_t pointCount;
int iVar1;
void *pvVar2;
uint32_t i;
float offsetY;
float hitSumX;
float hitSumY;
int gridCollisionClass;
float offsetX;
float offsetY;
float pointX;
float pointY;
void *pointsBegin;
float posX;
float posY;
Room *room;
gridCollisionClass = this->_entityGridCollisionClass;
if (gridCollisionClass != 0) {
pointsBegin = (this->_collisionPoints)._begin;
pvVar2 = (this->_collisionPoints)._end;
if (pointsBegin != pvVar2) {
i = 0;
pointCount = GHIDRA_INT(pvVar2) - GHIDRA_INT(pointsBegin) >> 3;
room = g_game->_room;
hitSumX = g_vectorZero.x;
hitSumY = g_vectorZero.y;
offsetY = g_vectorZero.x;
if (pointCount != 0) {
posY = (this->_pos).y;
offsetX = position->x;
offsetY = position->y;
posX = (this->_pos).x;
do {
pointX = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pointsBegin) + i * 8));
pointY = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pointsBegin) + i * 8 + 4));
iVar1 = GHIDRA_INT((((pointX + offsetX + posX) - 40.0) / 40.0 + 0.5));
if ((((-1 < iVar1) && (iVar1 < room->_gridWidth)) &&
(gridY = GHIDRA_INT((((pointY + posY + offsetY) - 120.0) / 40.0 + 0.5)), -1 < gridY)) &&
((gridY < room->_gridHeight && (iVar1 = room->_gridWidth * gridY + iVar1, -1 < iVar1)))
) {
if (iVar1 < 0x1c0) {
pvVar2 = room->_gridEntities[iVar1];
}
else {
pvVar2 = (void *)0x0;
}
gridCollision = (GHIDRA_CAST<Room *>((room)))->Room::GetGridCollision(iVar1);
offsetY = hitSumX;
if (gridCollisionClass == 3) {
if ((gridCollision == 4) ||
(((gridCollision == 3 && (pvVar2 != (void *)0x0)) &&
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 4)) == 0x10)))) {
LAB_006ab3eb:
hitSumX = pointX + hitSumX;
hitSumY = pointY + hitSumY;
offsetY = hitSumX;
}
}
else if (((gridCollisionClass == 5) && (gridCollision != 0)) && (gridCollision != 5))
goto LAB_006ab3eb;
}
i = i + 1;
} while (i < pointCount);
}
if ((offsetY != g_vectorZero.x) || (hitSumY != g_vectorZero.y)) {
return 1;
}
}
}
return 0;
}
// 006ab440
void Entity::PlayerCollideWithGrid(uint8_t isSimulated)
{
Room *gridEntity;
uint8_t bVar1;
char isCollided;
Entity_Player *player;
uint32_t uVar2;
GridEntity *newRock;
uint32_t uVar3;
uint32_t uVar4;
int iVar5;
int iVar6;
int *piVar7;
int iVar8;
GridEntity_Door *gridEntity;
float bridgeDirX;
float fVar9;
float bridgeDirY;
float fVar10;
float fVar11;
float gridCenterY;
int doorCollideInfo;
int local_fc;
int local_f8;
int local_f4;
float local_f0;
float local_ec;
float local_e8;
float local_e4;
uint32_t local_e0;
Entity *local_dc;
int gridCollideInfo;
int local_d4;
int local_d0;
int local_cc;
float local_c8;
float local_c4;
float local_c0;
float local_bc;
uint32_t local_b8;
Entity *local_b4;
int webCollideInfo;
int local_ac;
int local_a8;
int local_a4;
float local_a0;
float local_9c;
float local_98;
float local_94;
uint32_t local_90;
Entity *local_8c;
int megaMushCollideInfo;
int local_84;
int local_80;
int local_7c;
float local_78;
float local_74;
float local_70;
float local_6c;
uint32_t local_68;
Entity *local_64;
Vector *posRef;
Vector local_5c;
Vector local_54;
Vector pointPos;
int pointIndex;
float freeDepth;
float blockedDepth;
uint32_t isCharmed;
float normalY;
float normalX;
void *prevExceptionList;
uint8_t *puStack_18;
uint32_t ehState;
void *collisionPoints;
Game *game;
uint32_t *oldGridEntity;
Vector *pos;
Room *temp_5fd03f2348;
ehState = 0xffffffff;
puStack_18 = &LAB_00afa457;
prevExceptionList = ExceptionList;
ExceptionList = &prevExceptionList;
player = (Entity_Player *)
__RTDynamicCast(this,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor,
&IsaacRepentancePlus::Entity_Player::RTTI_Type_Descriptor,0,
__security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U);
if (player == GHIDRA_CAST<Entity_Player *>(0x0)) {
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("Called PlayerCollideWithGrid with Entity type != Entity_Player\n"))
;
}
if (isSimulated == 0) {
this->_collidesWithGrid = 0;
}
game = g_game;
if (this->_entityGridCollisionClass == 0) {
ExceptionList = prevExceptionList;
return;
}
if ((this->_collisionPoints)._begin == (this->_collisionPoints)._end) {
ExceptionList = prevExceptionList;
return;
}
if (this->_minecart != 0) {
ExceptionList = prevExceptionList;
return;
}
posRef = &this->_pos;
gridEntity = g_game->_room;
Room::GetClampedPositionImpl(gridEntity,&local_54,posRef,0.0,0.0,0.0,0.0);
piVar7 = *GHIDRA_CAST<int **>((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((game->_room)) + 0x4)))) + 0x10));
if (((piVar7 == GHIDRA_CAST<int *>(0x0)) || (piVar7[2] != 0x10)) || (*piVar7 != 0x23)) {
pos = &this->_pos;
iVar6 = (GHIDRA_CAST<Room *>((game->_room)))->Room::GetGridIndex(pos);
if ((iVar6 < 0) ||
(uVar2 = (GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(this))))->Entity_Player::get_grid_collision_at(pos), uVar2 == 4)) {
if (isSimulated == 0) {
if ((pos->x == local_54.x) && ((this->_pos).y == local_54.y)) {
bVar1 = 0;
}
else {
bVar1 = 1;
}
this->_collidesWithGrid = bVar1;
}
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 8)) != 0x10) {
pos->x = local_54.x;
(this->_pos).y = local_54.y;
}
}
}
else {
fVar9 = this->_size;
pos = &this->_pos;
local_54.x = pos->x - 0.0;
local_54.y = (this->_pos).y - 20.0;
Room::GetClampedPositionImpl(gridEntity,&local_5c,&local_54,fVar9,fVar9,fVar9,fVar9);
local_5c.x = local_5c.x + 0.0;
local_5c.y = local_5c.y + 20.0;
if (isSimulated == 0) {
if ((pos->x == local_5c.x) && ((this->_pos).y == local_5c.y)) {
this->_collidesWithGrid = 0;
pos->x = local_5c.x;
(this->_pos).y = local_5c.y;
goto LAB_006ab679;
}
this->_collidesWithGrid = 1;
}
pos->x = local_5c.x;
(this->_pos).y = local_5c.y;
}
LAB_006ab679:
local_5c.y = (float)(GHIDRA_INT((this->_collisionPoints)._end) - GHIDRA_INT((this->_collisionPoints)._begin) >>
3);
normalX = g_vectorZero.x;
normalY = g_vectorZero.y;
pointIndex = 0;
fVar9 = g_vectorZero.x;
fVar11 = g_vectorZero.y;
if (local_5c.y != 0.0) {
do {
collisionPoints = (this->_collisionPoints)._begin;
pointPos.x = (this->_pos).x + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(collisionPoints) + pointIndex * 8));
pointPos.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(collisionPoints) + pointIndex * 8 + 4)) + (this->_pos).y;
iVar6 = GHIDRA_INT(((pointPos.x - 40.0) / 40.0 + 0.5));
iVar5 = GHIDRA_INT(((pointPos.y - 120.0) / 40.0 + 0.5));
if (-1 < iVar6) {
iVar8 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0xc));
if (iVar6 < iVar8) {
if (-1 < iVar5) {
if (iVar5 < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0x10))) {
iVar6 = iVar8 * iVar5 + iVar6;
if (-1 < iVar6) {
if (iVar6 < 0x1c0) {
gridEntity = gridEntity->_gridEntities[iVar6];
}
else {
gridEntity = GHIDRA_CAST<GridEntity_Door *>(0x0);
}
uVar2 = (GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(this))))->Entity_Player::get_grid_collision_at(&pointPos);
if (isSimulated != 0) goto LAB_006abf5a;
bVar1 = (GHIDRA_CAST<TemporaryEffects *>((&player->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x271);
if ((bVar1 != 0) && (gridEntity != GHIDRA_CAST<GridEntity_Door *>(0x0))) {
iVar5 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((gridEntity)) + 0x4))));
if (((iVar5 == 3) || ((iVar5 == 0x18 || (iVar5 == 0xb)))) && (uVar2 != 0)) {
uVar2 = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((gridEntity)) + 0x14))));
if (iVar6 < 0x1c0) {
oldGridEntity = gridEntity->_gridEntities[iVar6];
if ((oldGridEntity != GHIDRA_CAST<uint32_t *>(0x0)) && (oldGridEntity[1] != 1)) {
gridEntity->_gridPaths[iVar6] = 900;
gridEntity->_gridEntities[iVar6] = (void *)0x0;
(**(code **)*oldGridEntity)(1);
}
if (gridEntity->_gridPaths[iVar6] < 0x385) {
newRock = operator_new(0x198);
ehState = 1;
local_54.y = (float)newRock;
if (newRock == GHIDRA_CAST<GridEntity *>(0x0)) {
newRock = GHIDRA_CAST<GridEntity *>(0x0);
}
else {
(GHIDRA_CAST<GridEntity *>((newRock)))->GridEntity::GridEntity();
*GHIDRA_CAST<uint8_t ***>(newRock) = IsaacRepentancePlus::GridEntity_Rock::vftable;
*GHIDRA_CAST<uint32_t *>((newRock + 1)) = 0;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(newRock[1])) + 0x10)))) = 0;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(newRock[1])) + 0x14)))) = 0xf;
*GHIDRA_CAST<uint8_t *>((newRock + 1)) = 0;
newRock[1]._varData = 0;
newRock[1]._spawnFrame = 0;
newRock[1]._rng._seed = 0xf;
*GHIDRA_CAST<uint8_t *>(&newRock[1]._varData) = 0;
newRock[1]._rng._shift1 = 0;
newRock[1]._rng._shift2 = 0;
newRock[1]._rng._shift3 = 0;
}
ehState = 0xffffffff;
if (newRock != GHIDRA_CAST<GridEntity *>(0x0)) {
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((newRock)) + 0x4)))) = 2;
newRock->_gridIndex = iVar6;
if (gridEntity->_gridEntities[iVar6] != GHIDRA_CAST<uint32_t *>(0x0)) {
(*(code *)**GHIDRA_CAST<uint32_t **>(gridEntity->_gridEntities[iVar6]))(1);
}
gridEntity->_gridEntities[iVar6] = newRock;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((newRock)) + 0x8)))) = 0;
newRock->_varData = 0;
(GHIDRA_CAST<GridEntity *>((newRock)))->GridEntity::Init(uVar2);
}
}
piVar7 = gridEntity->_gridEntities[iVar6];
}
else {
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("SpawnGridEntity: Grid index invalid\n"));
piVar7 = GHIDRA_CAST<int *>(0x0);
}
if (piVar7 != GHIDRA_CAST<int *>(0x0)) {
local_78 = (this->_pos).x;
local_74 = (this->_pos).y;
megaMushCollideInfo = this->_type;
local_84 = this->_variant;
local_80 = this->_spawnerType;
local_7c = this->_spawnerVariant;
local_70 = (this->_velocity).x;
local_6c = (this->_velocity).y;
isCharmed = GHIDRA_UINT(((this->_flags & 0x100) != 0));
if ((this->_flags & 0x20000000) == 0) {
uVar2 = 0;
}
else {
uVar2 = 2;
}
if ((this->_flags & 0x40000000000000) == 0) {
uVar3 = 0;
}
else {
uVar3 = 4;
}
local_68 = uVar3 | uVar2 | isCharmed;
local_64 = this;
(**(code **)(*piVar7 + 0x14))(0,&megaMushCollideInfo);
}
}
else {
if ((iVar5 != 0x10) || (uVar2 != 4)) {
if (iVar5 == 10) {
local_a0 = (this->_pos).x;
local_9c = (this->_pos).y;
webCollideInfo = this->_type;
local_ac = this->_variant;
local_a8 = this->_spawnerType;
local_a4 = this->_spawnerVariant;
local_98 = (this->_velocity).x;
local_94 = (this->_velocity).y;
if ((this->_flags & 0x20000000) == 0) {
uVar3 = 0;
}
else {
uVar3 = 2;
}
if ((this->_flags & 0x40000000000000) == 0) {
uVar4 = 0;
}
else {
uVar4 = 4;
}
local_90 = uVar4 | uVar3 | GHIDRA_UINT(((this->_flags & 0x100) != 0));
local_8c = this;
gridEntity->Destroy(0,&webCollideInfo);
}
goto LAB_006abb5a;
}
(GHIDRA_CAST<GridEntity_Door *>((gridEntity)))->GridEntity_Door::TryBlowOpen(1,this);
}
goto LAB_006ab9e8;
}
LAB_006abb5a:
if ((uVar2 != 3) && (uVar2 != 2)) {
if (gridEntity == GHIDRA_CAST<GridEntity_Door *>(0x0)) goto LAB_006abf5a;
goto LAB_006abbad;
}
bVar1 = (GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::CanCrushRocks();
if (bVar1 == 0) {
if (gridEntity == GHIDRA_CAST<GridEntity_Door *>(0x0)) goto LAB_006abf5a;
if ((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((gridEntity)) + 0x4)))) != 0xe) ||
(bVar1 = TemporaryEffects::HasCollectibleEffect
(&player->_temporaryeffects,0x251), bVar1 == 0))
goto LAB_006abbad;
LAB_006abcae:
if ((gridEntity->_collisionClass != 3) && (gridEntity->_collisionClass != 2)) {
LAB_006abbad:
if (((uVar2 == 4) && (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((gridEntity)) + 0x4)))) == 0x10)) &&
(player->_itemState == 0x93)) {
iVar5 = __RTDynamicCast(gridEntity,0,
&IsaacRepentancePlus::GridEntity::RTTI_Type_Descriptor
,&IsaacRepentancePlus::GridEntity_Door::
RTTI_Type_Descriptor,0);
if (((*GHIDRA_CAST<int *>((iVar5 + 0x15c)) == 7) || (*GHIDRA_CAST<int *>((iVar5 + 0x160)) == 7)) ||
((*GHIDRA_CAST<int *>((iVar5 + 0x15c)) == 8 || (*GHIDRA_CAST<int *>((iVar5 + 0x160)) == 8)))) {
local_f0 = (this->_pos).x;
local_ec = (this->_pos).y;
doorCollideInfo = this->_type;
local_fc = this->_variant;
local_f8 = this->_spawnerType;
local_f4 = this->_spawnerVariant;
local_e8 = (this->_velocity).x;
local_e4 = (this->_velocity).y;
if ((this->_flags & 0x20000000) == 0) {
uVar2 = 0;
}
else {
uVar2 = 2;
}
if ((this->_flags & 0x40000000000000) == 0) {
uVar3 = 0;
}
else {
uVar3 = 4;
}
local_e0 = uVar3 | uVar2 | GHIDRA_UINT(((this->_flags & 0x100) != 0));
local_dc = this;
if ((iVar6 < 0x1c0) &&
(piVar7 = *GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(g_game->_room) + iVar6 * 4 + 0x24)),
piVar7 != GHIDRA_CAST<int *>(0x0))) {
(**(code **)(*piVar7 + 0x14))(0,&doorCollideInfo);
}
goto LAB_006ab9e8;
}
}
goto LAB_006abf5a;
}
local_c8 = (this->_pos).x;
local_c4 = (this->_pos).y;
gridCollideInfo = this->_type;
local_d4 = this->_variant;
local_d0 = this->_spawnerType;
local_cc = this->_spawnerVariant;
local_c0 = (this->_velocity).x;
local_bc = (this->_velocity).y;
isCharmed = GHIDRA_UINT(((this->_flags & 0x100) != 0));
if ((this->_flags & 0x20000000) == 0) {
uVar3 = 0;
}
else {
uVar3 = 2;
}
if ((this->_flags & 0x40000000000000) == 0) {
uVar4 = 0;
}
else {
uVar4 = 4;
}
local_b8 = uVar4 | uVar3 | isCharmed;
local_b4 = this;
isCollided = gridEntity->Destroy(0,&gridCollideInfo);
if (isCollided == '\0') goto LAB_006abbad;
temp_5fd03f2348 = g_game->_room;
iVar6 = temp_5fd03f2348->_gridWidth;
fVar10 = (float)(gridEntity->_gridIndex % iVar6) * 40.0 + 40.0;
gridCenterY = (float)(gridEntity->_gridIndex / iVar6) * 40.0 + 120.0;
fVar9 = fVar10 - (this->_pos).x;
fVar11 = gridCenterY - (this->_pos).y;
if (ABS(fVar9) <= ABS(fVar11)) {
bridgeDirX = 0.0;
if (0.0 <= fVar11) {
bridgeDirY = 1.0;
}
else {
bridgeDirY = (float)&DAT_bf800000;
}
}
else {
bridgeDirY = 0.0;
if (0.0 <= fVar9) {
bridgeDirX = 1.0;
}
else {
bridgeDirX = (float)&DAT_bf800000;
}
}
fVar9 = ((bridgeDirX * 40.0 + fVar10) - 40.0) / 40.0 + 0.5;
iVar8 = GHIDRA_INT(fVar9);
iVar5 = GHIDRA_INT((((bridgeDirY * 40.0 + gridCenterY) - 120.0) / 40.0 + 0.5));
if ((((-1 < iVar8) && (iVar8 < iVar6)) && (-1 < iVar5)) &&
((iVar5 < temp_5fd03f2348->_gridHeight &&
(iVar6 = iVar6 * iVar5 + GHIDRA_INT(fVar9), -1 < iVar6)))) {
if (iVar6 < 0x1c0) {
(GHIDRA_CAST<Room *>((temp_5fd03f2348)))->Room::TryMakeBridge(gridEntity->_gridEntities[iVar6],
GHIDRA_CAST<GridEntity *>(gridEntity));
}
else {
(GHIDRA_CAST<Room *>((temp_5fd03f2348)))->Room::TryMakeBridge(GHIDRA_CAST<GridEntity *>(0x0),GHIDRA_CAST<GridEntity *>(gridEntity));
}
goto LAB_006ab9e8;
}
LAB_006abfe6:
fVar9 = normalX;
fVar11 = normalY;
goto LAB_006aba00;
}
if (gridEntity != GHIDRA_CAST<GridEntity_Door *>(0x0)) goto LAB_006abcae;
LAB_006abf5a:
if (this->_entityGridCollisionClass == 3) {
if (uVar2 == 4) goto LAB_006abf9a;
if (uVar2 == 3) {
if (gridEntity == GHIDRA_CAST<GridEntity_Door *>(0x0)) goto LAB_006abfe6;
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((gridEntity)) + 0x4)))) == 0x10) goto LAB_006abf9a;
}
}
else if (((this->_entityGridCollisionClass == 5) && (uVar2 != 0)) && (uVar2 != 5)) {
LAB_006abf9a:
collisionPoints = (this->_collisionPoints)._begin;
normalX = normalX + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(collisionPoints) + pointIndex * 8));
normalY = normalY + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(collisionPoints) + pointIndex * 8 + 4));
}
LAB_006ab9e8:
fVar9 = normalX;
fVar11 = normalY;
}
}
}
}
}
LAB_006aba00:
pointIndex = pointIndex + 1;
} while (GHIDRA_UINT(pointIndex) < GHIDRA_UINT(local_5c.y));
}
fVar9 = fVar9 * fVar9 + fVar11 * fVar11;
if (0.001 <= fVar9) {
fVar9 = sqrtf(fVar9);
if (0.0 < fVar9) {
normalX = normalX * (1.0 / fVar9);
normalY = normalY * (1.0 / fVar9);
}
if (isSimulated == 0) {
(this->_gridCollisionNormal).x = normalX;
(this->_gridCollisionNormal).y = normalY;
}
fVar9 = (this->_velocity).x;
fVar11 = (this->_velocity).y;
fVar10 = -normalX * fVar9 - normalY * fVar11;
if ((fVar10 < 0.0) && (isSimulated == 0)) {
this->_collidesWithGrid = 1;
(this->_gridCollisionVelocity).x = fVar9;
(this->_gridCollisionVelocity).y = fVar11;
fVar11 = fVar10 * 0.9 - 0.1;
fVar9 = (this->_gridCollisionNormal).x;
(this->_velocity).y = (this->_gridCollisionNormal).y * fVar11 + (this->_velocity).y;
(this->_velocity).x = fVar11 * fVar9 + (this->_velocity).x;
}
fVar9 = normalY * (this->_sizeMulti).y;
fVar11 = normalX * (this->_sizeMulti).x;
fVar10 = sqrtf(fVar9 * fVar9 + fVar11 * fVar11);
fVar10 = fVar10 * this->_size;
fVar9 = (this->_velocity).y;
fVar11 = (this->_velocity).x;
freeDepth = sqrtf(fVar11 * fVar11 + fVar9 * fVar9);
if (freeDepth <= 2.0) {
freeDepth = 2.0;
}
freeDepth = fVar10 - freeDepth;
blockedDepth = fVar10;
if (this->_entityGridCollisionClass == 5) {
iVar6 = 0xc;
do {
fVar9 = (blockedDepth - freeDepth) * 0.5 + freeDepth;
pointPos.x = normalX * fVar9 + (this->_pos).x;
pointPos.y = normalY * fVar9 + (this->_pos).y;
uVar2 = (GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(this))))->Entity_Player::get_grid_collision_at(&pointPos);
if ((uVar2 == 0) || (uVar2 == 5)) {
freeDepth = fVar9;
}
else {
blockedDepth = fVar9;
}
iVar6 = iVar6 + -1;
} while (iVar6 != 0);
}
else {
iVar6 = 6;
do {
fVar9 = (blockedDepth - freeDepth) * 0.5 + freeDepth;
pointPos.x = normalX * fVar9 + (this->_pos).x;
pointPos.y = normalY * fVar9 + (this->_pos).y;
uVar2 = (GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(this))))->Entity_Player::get_grid_collision_at(&pointPos);
if (uVar2 == 4) {
blockedDepth = fVar9;
}
else {
freeDepth = fVar9;
}
iVar6 = iVar6 + -1;
} while (iVar6 != 0);
}
posRef->x = normalX * (freeDepth - fVar10) + posRef->x;
posRef->y = normalY * (freeDepth - fVar10) + posRef->y;
}
else if (isSimulated == 0) {
(this->_gridCollisionNormal).x = g_vectorZero.x;
(this->_gridCollisionNormal).y = g_vectorZero.y;
}
ExceptionList = prevExceptionList;
return;
}
// 006ac2a0
void Entity::SetSize(float size, Vector sizeMulti, int numGridCollisionPoints)
{
int oddPointIdx;
float pointX;
double dVar1;
double dVar2;
int evenPointIdx;
Vector point;
void **collisionPointsEnd;
float *pointSlot;
if ((sizeMulti.x == -1.0) && (sizeMulti.y == -1.0)) {
sizeMulti.x = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this->_config) + 0x3c));
sizeMulti.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this->_config) + 0x40));
}
if (numGridCollisionPoints == -1) {
numGridCollisionPoints = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this->_config) + 0x48));
}
if (((this->_size != size) || ((this->_sizeMulti).x != sizeMulti.x)) ||
((this->_sizeMulti).y != sizeMulti.y)) {
this->_size = size;
(this->_collisionPoints)._end = (this->_collisionPoints)._begin;
(this->_sizeMulti).x = sizeMulti.x;
(this->_sizeMulti).y = sizeMulti.y;
evenPointIdx = 0;
if (0 < numGridCollisionPoints) {
do {
dVar1 = (double)((((float)evenPointIdx + (float)evenPointIdx) * 3.1415927) /
(float)numGridCollisionPoints);
dVar2 = dVar1;
libm_sse2_cos_precise();
pointX = (float)dVar2 * this->_size * (this->_sizeMulti).x;
point.x = pointX;
libm_sse2_sin_precise();
pointSlot = (this->_collisionPoints)._end;
point.y = (float)dVar1 * this->_size * (this->_sizeMulti).y;
if (pointSlot == (this->_collisionPoints)._capacity) {
msvc::vector<Vector>::_Emplace_reallocate(pointSlot,&point);
}
else {
*pointSlot = pointX;
pointSlot[1] = point.y;
collisionPointsEnd = &(this->_collisionPoints)._end;
*collisionPointsEnd = (void *)(GHIDRA_INT(*collisionPointsEnd) + 8);
}
evenPointIdx = evenPointIdx + 2;
} while (evenPointIdx < numGridCollisionPoints);
}
oddPointIdx = 1;
if (1 < numGridCollisionPoints) {
do {
dVar1 = (double)((((float)oddPointIdx + (float)oddPointIdx) * 3.1415927) /
(float)numGridCollisionPoints);
dVar2 = dVar1;
libm_sse2_cos_precise();
pointX = (float)dVar2 * this->_size * (this->_sizeMulti).x;
point.x = pointX;
libm_sse2_sin_precise();
pointSlot = (this->_collisionPoints)._end;
point.y = (float)dVar1 * this->_size * (this->_sizeMulti).y;
if (pointSlot == (this->_collisionPoints)._capacity) {
msvc::vector<Vector>::_Emplace_reallocate(pointSlot,&point);
}
else {
*pointSlot = pointX;
pointSlot[1] = point.y;
collisionPointsEnd = &(this->_collisionPoints)._end;
*collisionPointsEnd = (void *)(GHIDRA_INT(*collisionPointsEnd) + 8);
}
oddPointIdx = oddPointIdx + 2;
} while (oddPointIdx < numGridCollisionPoints);
}
}
return;
}
// 006ac530
uint8_t Entity::IsEnemy()
{
if ((*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2) || (this->_type != 1)) {
return this->_type - 10U < 0x3de;
}
return 1;
}
// 006ac560
uint8_t Entity::IsVulnerableEnemy(Entity *source)
{
uint8_t bVar1;
Entity *lastSpawner;
uint8_t extraout_DL;
int entityType;
if (1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) {
if (((source != GHIDRA_CAST<Entity *>(0x0)) && (source->_type == 1)) &&
(bVar1 = IsDescendantOf(this,source), bVar1 != 0)) {
return 0;
}
if ((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (this->_type == 1)) {
entityType = 1;
goto LAB_006ac5c1;
}
}
entityType = this->_type;
if (0x3dd < entityType - 10U) {
return 0;
}
LAB_006ac5c1:
if ((((this->_entityCollisionClass == 1) || (this->_entityCollisionClass == 0)) ||
((this->_isInvicible != 0 || (this->_dead != 0)))) ||
(((bVar1 = HasEntityFlags(this,0x10), bVar1 != 0 && (entityType != 0x322)) &&
(entityType != 0x362)))) {
return 0;
}
if (source == GHIDRA_CAST<Entity *>(0x0)) {
return 1;
}
if ((this->_flags & 0x20000000) == 0) {
return 1;
}
lastSpawner = GetLastSpawner(source);
if ((((lastSpawner->_flags & 0x20000000) == 0) && (lastSpawner->_type != 1)) &&
(lastSpawner->_type != 3)) {
return extraout_DL;
}
return 0;
}
// 006ac6c0
uint8_t Entity::IsFlying()
{
int gridCollisionClass;
gridCollisionClass = this->_entityGridCollisionClass;
if ((((gridCollisionClass == 0) || (gridCollisionClass == 3)) || (gridCollisionClass == 1)) ||
(gridCollisionClass == 2)) {
return 1;
}
return 0;
}
// 006ac6e0
void Entity::ResetColor()
{
float fVar1;
float fVar2;
float fVar3;
ColorMod *spriteColor;
spriteColor = &(this->_sprite)._color;
if (spriteColor != &this->_color) {
fVar1 = (this->_color)._tint[1];
fVar2 = (this->_color)._tint[2];
fVar3 = (this->_color)._tint[3];
spriteColor->_tint[0] = (this->_color)._tint[0];
(this->_sprite)._color._tint[1] = fVar1;
(this->_sprite)._color._tint[2] = fVar2;
(this->_sprite)._color._tint[3] = fVar3;
fVar1 = (this->_color)._colorize[1];
fVar2 = (this->_color)._colorize[2];
fVar3 = (this->_color)._colorize[3];
(this->_sprite)._color._colorize[0] = (this->_color)._colorize[0];
(this->_sprite)._color._colorize[1] = fVar1;
(this->_sprite)._color._colorize[2] = fVar2;
(this->_sprite)._color._colorize[3] = fVar3;
*GHIDRA_CAST<uint64_t *>((this->_sprite)._color._offset) = *GHIDRA_CAST<uint64_t *>((this->_color)._offset);
(this->_sprite)._color._offset[2] = (this->_color)._offset[2];
}
return;
}
// 006ac710
uint8_t Entity::IsFrame(int frequency, int offset)
{
uint8_t isPaused;
Game *game;
game = g_game;
if ((this->_flags & 0x4000) == 0) {
isPaused = (GHIDRA_CAST<Game *>((g_game)))->Game::IsPaused();
if (isPaused == 0) {
return (game->_frameCount + offset) % frequency == 0;
}
}
return 0;
}
// 006ac760
int Entity::GetIntervalTicks(float interval, float offset)
{
uint8_t isPaused;
if ((this->_flags & 0x4000) == 0) {
isPaused = (GHIDRA_CAST<Game *>((g_game)))->Game::IsPaused();
if (isPaused == 0) {
return GHIDRA_INT(((offset + this->_updateTime) / interval)) -
GHIDRA_INT(((offset + this->_prevUpdateTime) / interval));
}
}
return 0;
}
// 006ac7e0
int Entity::CountRelatedEntities(int type, int variant, int unused, void *outEntities)
{
uint8_t isDescendant;
uint64_t *allocatedBytes;
int count;
uint32_t *entitySlot;
uint8_t local_24 [12];
int local_18;
Entity *self;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
uint32_t allocSize;
uint64_t oldAllocated;
uint32_t *outEnd;
local_8 = 0xffffffff;
puStack_c = &LAB_00af69dd;
local_10 = ExceptionList;
ExceptionList = &local_10;
count = 0;
self = this;
EntityList::QuerySublist
(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST<EntityList_EL *>(local_24),type,variant,-1,0
,0);
local_8 = 0;
variant = local_18;
if (local_18 != 0) {
entitySlot = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<uint32_t *>(local_24))) + 0x4)));
do {
isDescendant = IsDescendantOf(GHIDRA_CAST<Entity *>(*entitySlot),self);
if ((isDescendant != 0) && (count = count + 1, outEntities != (void *)0x0)) {
outEnd = *GHIDRA_CAST<uint32_t **>((GHIDRA_CAST<char *>(outEntities) + 4));
if (outEnd == *GHIDRA_CAST<uint32_t **>((GHIDRA_CAST<char *>(outEntities) + 8))) {
msvc::vector<unsigned_int>::_Emplace_reallocate(outEnd,entitySlot);
}
else {
*outEnd = *entitySlot;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(outEntities) + 4)) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(outEntities) + 4)) + 4;
}
}
entitySlot = entitySlot + 1;
variant = variant + -1;
} while (variant != 0);
}
if (local_24[0] == '\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 *>(&(GHIDRA_CAST<uint32_t *>(local_24))) + 0x4))) != GHIDRA_CAST<uint32_t *>(0x0)) {
allocSize = *GHIDRA_CAST<uint32_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_24)) + 0x4))) + -4));
oldAllocated = *allocatedBytes;
*GHIDRA_CAST<uint32_t *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - allocSize;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocated) < allocSize));
free(GHIDRA_CAST<uint32_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_24)) + 0x4))) + -4)));
}
}
ExceptionList = local_10;
return count;
}
// 006ac8d0
int Entity::get_velocity_direction()
{
int direction;
float vx;
float vy;
vx = (this->_velocity).x;
vy = (this->_velocity).y;
if (ABS(vy) < ABS(vx)) {
direction = 2;
if (vx < 0.0) {
direction = 0;
}
return direction;
}
return GHIDRA_UINT((0.0 <= vy)) * 2 + 1;
}
// 006ac920
void Entity::Kill(EntityRef *source)
{
int iVar1;
char cVar2;
uint8_t isItemHeld;
Entity_Player *killerPlayer;
ColorMod *Color;
Color explosionColor;
uint32_t local_c;
local_c = __security_cookie ^ GHIDRA_UINT(&explosionColor);
if (this->_dead == 0) {
this->_dead = 1;
if (source->_entity != GHIDRA_CAST<Entity *>(0x0)) {
killerPlayer = GHIDRA_CAST<Entity_Player *>(GetPlayerAncestor(source->_entity));
if ((((((killerPlayer != GHIDRA_CAST<Entity_Player *>(0x0)) && (iVar1 = this->_type, iVar1 != 0)) &&
(iVar1 != 1)) &&
(((iVar1 != 2 && (iVar1 != 3)) && ((iVar1 != 4 && ((iVar1 != 5 && (iVar1 != 6)))))))) &&
(iVar1 != 7)) && ((iVar1 != 8 && (iVar1 != 9)))) {
if (iVar1 == 0x21) {
isItemHeld = (GHIDRA_CAST<Entity_Player *>((killerPlayer)))->Entity_Player::HasCollectible(0x1a4,0);
if ((isItemHeld != 0) &&
(((iVar1 = this->_variant, iVar1 == 0 || (iVar1 == 1)) || (iVar1 == 10)))) {
::(GHIDRA_CAST<Color *>((&explosionColor)))->Color::Color();
Game::BombExplosionEffects
(g_game,&this->_pos,20.0,(BitSet128)ZEXT816(0),Color,GHIDRA_CAST<Entity *>(killerPlayer),
1.0,1,4,0);
}
}
else if (iVar1 != 1000) {
Player_stats_add(&g_game->_onlinePlayerStats,0x11,killerPlayer,1.0);
cVar2 = this->IsBoss();
if (cVar2 != '\0') {
Player_stats_add(&g_game->_onlinePlayerStats,0x14,killerPlayer,1.0);
if (killerPlayer->_isCoopGhost != 0) {
Player_stats_add(&g_game->_onlinePlayerStats,0x15,killerPlayer,1.0);
}
}
}
}
}
cVar2 = this->IsBoss();
if ((cVar2 == '\0') && (this->_type != 3)) {
BloodExplode(this);
}
LuaEngine::PostEntityKill(this);
}
return;
}
// 006acb00
void Entity::Remove()
{
uint32_t *luaBridgeRef;
this->_exists = 0;
if (this->_dead == 0) {
this->_dead = 1;
}
ReleaseLuaRef(this);
luaBridgeRef = this->_luaBridgeRef;
if (luaBridgeRef != GHIDRA_CAST<uint32_t *>(0x0)) {
luaL_unref(*luaBridgeRef,0xfff0b9d8,luaBridgeRef[1]);
operator_delete(luaBridgeRef,8);
this->_luaBridgeRef = (void *)0x0;
}
return;
}
// 006acb60
void Entity::ClearReferences()
{
std_multiset *referrers;
Entity *referrersHead;
Entity *local_8;
uint32_t *ptrSlot;
local_8 = this;
if (this->_parent != 0) {
local_8 = GHIDRA_CAST<Entity *>(&this->_parent);
msvc::multiset<unsigned_int>::erase(&local_8);
}
this->_parent = 0;
if (this->_child != 0) {
local_8 = GHIDRA_CAST<Entity *>(&this->_child);
msvc::multiset<unsigned_int>::erase(&local_8);
}
this->_child = 0;
if (this->_target != 0) {
local_8 = GHIDRA_CAST<Entity *>(&this->_target);
msvc::multiset<unsigned_int>::erase(&local_8);
}
this->_target = 0;
if (this->_spawnerEntity != 0) {
local_8 = GHIDRA_CAST<Entity *>(&this->_spawnerEntity);
msvc::multiset<unsigned_int>::erase(&local_8);
}
this->_spawnerEntity = 0;
ptrSlot = &this->_minecart;
if (*ptrSlot != 0) {
local_8 = GHIDRA_CAST<Entity *>(ptrSlot);
msvc::multiset<unsigned_int>::erase(&local_8);
*ptrSlot = 0;
}
if (this->_hitEffect != 0) {
local_8 = GHIDRA_CAST<Entity *>(&this->_hitEffect);
msvc::multiset<unsigned_int>::erase(&local_8);
this->_hitEffect = 0;
}
ptrSlot = &this->_iceFrozenEffect;
if (GHIDRA_CAST<int *>(this->_iceFrozenEffect) != GHIDRA_CAST<int *>(0x0)) {
(**(code **)(*GHIDRA_CAST<int *>(this->_iceFrozenEffect) + 0x28))();
}
if (*ptrSlot != 0) {
local_8 = GHIDRA_CAST<Entity *>(ptrSlot);
msvc::multiset<unsigned_int>::erase(&local_8);
}
*ptrSlot = 0;
referrers = &this->_entityPtrReferrers;
referrersHead = referrers->_head;
local_8 = *GHIDRA_CAST<Entity **>(referrersHead);
if (local_8 != referrersHead) {
do {
**GHIDRA_CAST<uint32_t **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((local_8)) + 0x10)))) = 0;
msvc::
_Tree_unchecked_const_iterator<msvc::_Tree_val<msvc::_Tree_simple_types<unsigned_int>_>,msvc::_Iterator_base0>
::operator++((_Tree_unchecked_const_iterator<msvc::_Tree_val<msvc::_Tree_simple_types<unsigned_int>_>,msvc::_Iterator_base0>
*)&local_8);
referrersHead = referrers->_head;
} while (local_8 != referrersHead);
}
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<msvc::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(referrers,(fuzzer_allocator<msvc::_Tree_node<unsigned_int,void*>_> *)referrers,
*(_Tree_node<unsigned_int,void*> **)&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((referrersHead)) + 0x4))));
*GHIDRA_CAST<Entity **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((referrersHead)) + 0x4)))) = referrersHead;
*GHIDRA_CAST<Entity **>(referrersHead) = referrersHead;
*GHIDRA_CAST<Entity **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((referrersHead)) + 0x8)))) = referrersHead;
(this->_entityPtrReferrers)._size = 0;
if (this->_valid != 0) {
(this->_colorParams)._end = (this->_colorParams)._begin;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc)))) = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8))));
(this->_collisionPoints)._end = (this->_collisionPoints)._begin;
ANM2::Reset(&this->_sprite);
}
return;
}
// 006acd10
uint8_t Entity::IsDamageSourceFriendly(EntityRef *source)
{
int iVar1;
bool bVar2;
uint8_t isDescendant;
void *charmer;
int deathmatchMode;
uint64_t flags;
bool isFriendly;
bool isPlayerSource;
iVar1 = this->_type;
if (((iVar1 == 1) && (source->_type == 1)) && (*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2)) {
return 1;
}
flags = this->_flags;
if ((((flags & 0x100) == 0) || (charmer = (this->_charmSource)._entity, charmer == (void *)0x0))
|| ((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(charmer) + 0x28)) != 1 || (this->_charmedCountdown != 0)))) {
bVar2 = false;
}
else {
bVar2 = true;
}
if ((((flags & 0x20000000) != 0) || ((iVar1 == 3 && ((flags & 0x20000100) == 0)))) ||
(isFriendly = false, bVar2)) {
isFriendly = true;
}
deathmatchMode = *GHIDRA_CAST<int *>(&g_game->_deathmatchManager);
if ((deathmatchMode < 2) || (iVar1 != 1)) {
bVar2 = iVar1 - 10U < 0x3de;
}
else {
bVar2 = true;
}
if (((((source->_spawnerType == 1) || (iVar1 = source->_type, iVar1 == 1)) || (iVar1 == 8)) ||
((source->_spawnerType == 3 || (iVar1 == 3)))) ||
(((GHIDRA_UINT(source->_flags) >> 1 & 1) != 0 ||
((iVar1 == 1000 &&
(isDescendant = Entity_Effect::IsPlayerCreep(source->_variant), isDescendant != 0)))))) {
isPlayerSource = true;
}
else {
isPlayerSource = false;
}
if (isFriendly) {
if ((1 < deathmatchMode) &&
(isDescendant = IsDescendantOf(this,source->_entity), isDescendant == 0)) {
if (source->_entity == GHIDRA_CAST<Entity *>(0x0)) {
return 0;
}
isDescendant = IsDescendantOf(source->_entity,(this->_charmSource)._entity);
if (isDescendant == 0) {
return 0;
}
}
if ((bVar2) && (isPlayerSource)) {
return 1;
}
return 0;
}
return 0;
}
// 006ace60
uint8_t Entity::TakeDamage(float damage, uint64_t damageFlags, EntityRef *source, int damageCountdown)
{
float fVar1;
uint8_t bVar2;
char cVar3;
Entity *spawner;
Entity *pEVar4;
float *overlayNull;
Entity_Player *pEVar5;
Entity_Player *pEVar6;
LuaEngine *this_00;
int iVar7;
uint32_t uVar8;
uint32_t *local_44;
float damageInfo [2];
uint32_t damageFlagsLow;
uint32_t damageFlagsHigh;
EntityRef damageSource;
uint32_t *entityRefSlot;
Manager *manager;
uint32_t *pendingFlagsHigh;
float posOffsetY;
if (this->_type == 1) {
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("Entity TakeDamage should not be called for Entity Player!"));
}
uVar8 = GHIDRA_UINT(damageFlags) & 0x2000;
if (((damageFlags & 0x2000) == 0) && (bVar2 = IsDamageSourceFriendly(this,source), bVar2 != 0)) {
return 0;
}
if (damage <= 0.0) goto LAB_006ad14f;
bVar2 = IsVulnerableEnemy(this,GHIDRA_CAST<Entity *>(0x0));
if (bVar2 == 0) {
if (this->_type != 0x3b6) goto LAB_006ad14f;
LAB_006acf1f:
if (this->_variant == 0) {
spawner = GHIDRA_CAST<Entity *>(this->_parent);
pEVar4 = spawner;
joined_r0x006acf5a:
if (pEVar4 != GHIDRA_CAST<Entity *>(0x0)) goto LAB_006acf96;
}
}
else {
iVar7 = this->_type;
if (iVar7 == 0x325) goto LAB_006ad14f;
if (iVar7 == 0x340) {
if ((((this->_variant == 1) &&
(spawner = GHIDRA_CAST<Entity *>(this->_spawnerEntity), spawner != GHIDRA_CAST<Entity *>(0x0))) &&
(spawner->_type == 0x389)) &&
((fVar1 = this[2]._preInterpolatePos.x, fVar1 == 2.24208e-44 || (fVar1 == 7.00649e-45))))
goto LAB_006acf96;
}
else {
if (iVar7 == 0x3b6) goto LAB_006acf1f;
if (((iVar7 == 0x379) && (spawner = GHIDRA_CAST<Entity *>(this->_parent), spawner != GHIDRA_CAST<Entity *>(0x0))) &&
(spawner->_type == 0x399)) {
if (GHIDRA_CAST<Entity *>(spawner->_child) != this) goto LAB_006acf96;
pEVar4 = GHIDRA_CAST<Entity *>(spawner->_entityCollisionClass);
goto joined_r0x006acf5a;
}
}
}
local_44 = GHIDRA_CAST<uint32_t *>(CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_44)) + 0x1))),1));
if ((this->_flags & 0x20000000) == 0) {
local_44 = GHIDRA_CAST<uint32_t *>(((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(local_44))) + 0x1))) << 8));
}
spawner = find_nearest_enemy(&this->_pos,GHIDRA_CAST<float *>(&local_44),(uint8_t)local_44);
if (spawner == GHIDRA_CAST<Entity *>(0x0)) {
LAB_006ad14f:
if (((damageFlags & 2) != 0) && (0.0 < damage)) {
if (0 < this->_fireDamageCountdown) {
return 0;
}
this->_fireDamageCountdown = 10;
}
if ((damageFlags & 0x40) != 0) {
if (0 < this->_damageCountdown) {
return 0;
}
this->_damageCountdown = damageCountdown;
}
if ((((damageFlags & 0x2000) == 0) &&
(cVar3 = this->IsBoss(), cVar3 != '\0')) &&
(1 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2)))) {
iVar7 = 0;
do {
pEVar5 = (GHIDRA_CAST<Game *>((g_game)))->Game::GetPlayer(uVar8);
pEVar6 = GHIDRA_CAST<Entity_Player *>(pEVar5->_twinPlayer);
if ((((pEVar6 == GHIDRA_CAST<Entity_Player *>(0x0)) || (pEVar6->_playerIndex == -1)) ||
((pEVar5->_playerIndex <= pEVar6->_playerIndex || (pEVar5 == pEVar6)))) &&
(pEVar5->_parent == 0)) {
iVar7 = iVar7 + 1;
}
uVar8 = uVar8 + 1;
} while (uVar8 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2)));
if (1 < iVar7) {
damage = damage * 0.8;
}
}
this_00 = GHIDRA_CAST<LuaEngine *>((*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) & 0x400000));
if (this_00 != GHIDRA_CAST<LuaEngine *>(0x0)) {
damage = damage + damage;
}
if ((0.0 < this->_maxHitPoints) &&
(bVar2 = LuaEngine::EntityTakeDamage(this_00,this,damage,damageFlags,source,damageCountdown),
bVar2 != 0)) {
(GHIDRA_CAST<DamageInfo *>((damageInfo)))->DamageInfo::DamageInfo();
damageInfo[0] = damage;
damageFlagsHigh = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(damageFlags)) + 0x4)));
damageFlagsLow = GHIDRA_UINT(damageFlags);
(GHIDRA_CAST<EntityRef *>((&damageSource)))->EntityRef::operator_(source);
FUN_006b7db0(damageInfo);
fVar1 = this->_pendingDamage;
*GHIDRA_CAST<uint32_t *>(&this->_pendingDamageFlags) = GHIDRA_UINT(this->_pendingDamageFlags) | GHIDRA_UINT(damageFlags);
pendingFlagsHigh = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_pendingDamageFlags) + 4));
*pendingFlagsHigh = *pendingFlagsHigh | (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(damageFlags)) + 0x4)));
this->_pendingDamage = damage + fVar1;
if (source->_entity == GHIDRA_CAST<Entity *>(0x0)) {
pEVar6 = GHIDRA_CAST<Entity_Player *>(0x0);
}
else {
pEVar6 = GHIDRA_CAST<Entity_Player *>(GetPlayerAncestor(source->_entity));
}
if ((((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (this->_type == 1)) ||
(this->_type - 10U < 0x3de)) && (pEVar6 != GHIDRA_CAST<Entity_Player *>(0x0))) {
Player_stats_add(&g_game->_onlinePlayerStats,0xf,pEVar6,damage);
iVar7 = __ftoui3();
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pEVar6)) + 0x16b8)))) = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pEVar6)) + 0x16b8)))) + iVar7;
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pEVar6)) + 0x16bc)))) = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pEVar6)) + 0x16bc)))) + iVar7;
}
return 1;
}
return 0;
}
LAB_006acf96:
manager = g_manager;
local_44 = GHIDRA_CAST<uint32_t *>(0x1f5);
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_44));
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_44),1.0,10,0,1.0,0.0);
if (GHIDRA_CAST<int *>(this->_hitEffect) != GHIDRA_CAST<int *>(0x0)) {
(**(code **)(*GHIDRA_CAST<int *>(this->_hitEffect) + 0x28))();
}
uVar8 = Random();
pEVar4 = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0xa0,&this->_pos,&g_vectorZero,spawner,0,uVar8,0);
if (pEVar4->_parent != 0) {
local_44 = &pEVar4->_parent;
msvc::multiset<unsigned_int>::erase(&local_44);
}
pEVar4->_parent = spawner;
if (spawner != GHIDRA_CAST<Entity *>(0x0)) {
msvc::multiset<unsigned_int>::insert(&pEVar4->_parent);
}
entityRefSlot = &pEVar4->_target;
if (pEVar4->_target != 0) {
local_44 = entityRefSlot;
msvc::multiset<unsigned_int>::erase(&local_44);
}
*entityRefSlot = this;
msvc::multiset<unsigned_int>::insert(entityRefSlot);
pEVar4[1]._sprite._filename._size = 0;
pEVar4[1]._sprite._filename._capacity = 0xc1c00000;
if (((this->_sprite)._animState._animData != (void *)0x0) &&
(overlayNull = AnimationState::GetNullFrame
(&(this->_sprite)._animState,GHIDRA_CAST<uint8_t *>("OverlayEffect")),
overlayNull != GHIDRA_CAST<float *>(0x0))) {
fVar1 = overlayNull[1];
posOffsetY = (this->_posOffset).y;
(pEVar4->_posOffset).x = ((*overlayNull - 0.0) * 0.5) / 0.65 + (this->_posOffset).x;
(pEVar4->_posOffset).y = ((fVar1 - 4.0) * 0.5) / 0.65 + posOffsetY;
}
pEVar4->Update();
entityRefSlot = &this->_hitEffect;
if (GHIDRA_CAST<Entity *>(this->_hitEffect) == pEVar4) {
return 0;
}
if (GHIDRA_CAST<Entity *>(this->_hitEffect) != GHIDRA_CAST<Entity *>(0x0)) {
local_44 = entityRefSlot;
msvc::multiset<unsigned_int>::erase(&local_44);
}
*entityRefSlot = pEVar4;
msvc::multiset<unsigned_int>::insert(entityRefSlot);
return 0;
}
// 006ad340
bool Entity::HasMortalDamage()
{
return this->_health <= this->_pendingDamage;
}
// 006ad350
int Entity::apply_second_hand_duration(int duration, EntityRef *source)
{
uint8_t isSecondHand;
int secondHandMultiplier;
Entity *rootSpawner;
Entity *spawner;
if (((this->_type != 1) || (1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager))) &&
(rootSpawner = source->_entity, rootSpawner != GHIDRA_CAST<Entity *>(0x0))) {
for (spawner = GHIDRA_CAST<Entity *>(rootSpawner->_spawnerEntity); spawner != GHIDRA_CAST<Entity *>(0x0);
spawner = GHIDRA_CAST<Entity *>(spawner->_spawnerEntity)) {
rootSpawner = spawner;
}
if ((rootSpawner->_type == 1) &&
(isSecondHand = (GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(rootSpawner))))->Entity_Player::HasTrinket(0x4e,0),
isSecondHand != 0)) {
secondHandMultiplier = (GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(rootSpawner))))->Entity_Player::GetTrinketMultiplier(0x4e);
return secondHandMultiplier * duration * 2;
}
}
return duration;
}
// 006ad3c0
void Entity::AddFreeze(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown)
{
uint8_t bVar1;
char cVar2;
int newCountdown;
int extraout_EDX;
uint8_t auStack_3c [4];
uint32_t freezeColor;
uint32_t uStack_34;
uint32_t uStack_30;
uint32_t uStack_2c;
uint32_t local_28;
uint32_t uStack_24;
uint32_t uStack_20;
uint32_t uStack_1c;
uint32_t local_18;
uint32_t local_14;
uint32_t local_10;
uint32_t local_c;
Entity *ancestor;
int currentCountdown;
uint32_t flagsLow;
Entity *nextParent;
local_c = __security_cookie ^ GHIDRA_UINT(auStack_3c);
bVar1 = IsDamageSourceFriendly(this,ref);
if (bVar1 == 0) {
apply_second_hand_duration(this,duration,ref);
bVar1 = DoesEntityShareStatus(this);
if (bVar1 != 0) {
nextParent = GHIDRA_CAST<Entity *>(this->_parent);
while (ancestor = nextParent, ancestor != GHIDRA_CAST<Entity *>(0x0)) {
this = ancestor;
nextParent = GHIDRA_CAST<Entity *>(ancestor->_parent);
}
}
if (((extraout_EDX != 0) && (flagsLow = GHIDRA_UINT(this->_flags), (flagsLow & 1) == 0)) &&
((this->_bossStatusEffectCooldown < 1 || (ignoreBossStatusCooldown != 0)))) {
currentCountdown = this->_freezeCountdown;
if (extraout_EDX < 1) {
newCountdown = currentCountdown;
if (currentCountdown < -extraout_EDX) {
newCountdown = -extraout_EDX;
}
}
else {
newCountdown = 0x78;
if (currentCountdown + extraout_EDX < 0x78) {
newCountdown = currentCountdown + extraout_EDX;
}
}
this->_freezeCountdown = newCountdown;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
local_28 = 0;
uStack_24 = 0;
uStack_20 = 0;
uStack_1c = 0;
*GHIDRA_CAST<uint32_t *>(&this->_flags) = flagsLow | 0x20;
freezeColor = 0x3e6147ae;
uStack_34 = 0x3e6147ae;
uStack_30 = 0x3e6147ae;
uStack_2c = 0x3f800000;
local_18 = 0x3e20a0a1;
local_14 = 0x3e20a0a1;
local_10 = 0x3e20a0a1;
this->SetColor(&freezeColor,newCountdown,0xff,0,1);
if ((ignoreBossStatusCooldown == 0) && (cVar2 = FUN_006ae7a0(), cVar2 != '\0')) {
this->_bossStatusEffectCooldown = 0xf0;
}
CopyStatusEffects(this);
}
}
return;
}
// 006ad500
void Entity::AddPoison(EntityRef *ref, int duration, float damage, uint8_t ignoreBossStatusCooldown)
{
uint8_t bVar1;
char cVar2;
int newCountdown;
int extraout_EDX;
ColorMod poisonColor;
uint32_t flags;
Entity *nextParent;
int oldCountdown;
Entity *parent;
void *sourceRoot;
void *spawner;
float tickDamage;
bVar1 = IsDamageSourceFriendly(this,ref);
if (bVar1 != 0) {
return;
}
if (this->_type == 1) {
bVar1 = (GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(this))))->Entity_Player::HasCollectible(0x278,0);
if (bVar1 != 0) {
return;
}
bVar1 = TemporaryEffects::HasCollectibleEffect
(GHIDRA_CAST<TemporaryEffects *>(&this[5]._sprite._overlayRenderFirst),0x278);
if (bVar1 != 0) {
return;
}
}
apply_second_hand_duration(this,duration,ref);
if (damage <= 0.0) {
if ((this->_type != 1) && (sourceRoot = ref->_entity, sourceRoot != (void *)0x0)) {
for (spawner = *(void **)(GHIDRA_CAST<char *>(sourceRoot) + 0x3c8); spawner != (void *)0x0;
spawner = *(void **)(GHIDRA_CAST<char *>(spawner) + 0x3c8)) {
sourceRoot = spawner;
}
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sourceRoot) + 0x28)) == 1) {
damage = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(sourceRoot) + 0x157c));
goto LAB_006ad5b4;
}
}
damage = 2.0;
}
LAB_006ad5b4:
bVar1 = DoesEntityShareStatus(this);
if (bVar1 != 0) {
nextParent = GHIDRA_CAST<Entity *>(this->_parent);
while (parent = nextParent, parent != GHIDRA_CAST<Entity *>(0x0)) {
this = parent;
nextParent = GHIDRA_CAST<Entity *>(parent->_parent);
}
}
if (((extraout_EDX != 0) && (flags = GHIDRA_UINT(this->_flags), (flags & 1) == 0)) &&
((this->_bossStatusEffectCooldown < 1 || (ignoreBossStatusCooldown != 0)))) {
oldCountdown = this->_poisonCountdown;
if (extraout_EDX < 1) {
newCountdown = oldCountdown;
if (oldCountdown < -extraout_EDX) {
newCountdown = -extraout_EDX;
}
}
else {
newCountdown = 0x78;
if (oldCountdown + extraout_EDX < 0x78) {
newCountdown = oldCountdown + extraout_EDX;
}
}
this->_poisonCountdown = newCountdown;
if ((flags & 0x40) == 0) {
this->_poisonDamageTimer = 0;
}
tickDamage = this->_poisonTickDamage;
if (tickDamage <= damage) {
tickDamage = damage;
}
poisonColor._tint[1] = 1.0;
poisonColor._tint[3] = 1.0;
this->_poisonTickDamage = tickDamage;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
*GHIDRA_CAST<uint32_t *>(&this->_flags) = flags | 0x40;
poisonColor._offset[0] = 0.0;
poisonColor._offset[2] = 0.0;
poisonColor._colorize[0] = 0.0;
poisonColor._colorize[1] = 0.0;
poisonColor._colorize[2] = 0.0;
poisonColor._colorize[3] = 0.0;
poisonColor._tint[0] = (200.0 - (float)newCountdown) / 200.0 - 0.1;
if (poisonColor._tint[0] <= 0.6) {
poisonColor._tint[0] = 0.6;
}
poisonColor._offset[1] = (float)GHIDRA_INT(((1.0 - poisonColor._tint[0]) * 90.0)) * 0.003921569;
poisonColor._tint[2] = poisonColor._tint[0];
this->SetColor(&poisonColor,newCountdown,0xff,0,1);
if ((ignoreBossStatusCooldown == 0) && (cVar2 = FUN_006ae7a0(), cVar2 != '\0')) {
this->_bossStatusEffectCooldown = 0xf0;
}
CopyStatusEffects(this);
}
return;
}
// 006ad750
void Entity::AddSlowing(EntityRef *ref, int duration, float amount, ColorMod color, uint8_t ignoreBossStatusCooldown)
{
uint8_t bVar1;
char isBoss;
int extraout_EDX;
uint32_t flagsHigh;
uint32_t flagsLow;
Entity *nextParent;
Entity *parent;
int vtable;
bVar1 = IsDamageSourceFriendly(this,ref);
if (bVar1 == 0) {
apply_second_hand_duration(this,duration,ref);
bVar1 = DoesEntityShareStatus(this);
if (bVar1 != 0) {
nextParent = GHIDRA_CAST<Entity *>(this->_parent);
while (parent = nextParent, parent != GHIDRA_CAST<Entity *>(0x0)) {
this = parent;
nextParent = GHIDRA_CAST<Entity *>(parent->_parent);
}
}
if (extraout_EDX < 1) {
if (extraout_EDX < 0) {
flagsLow = GHIDRA_UINT(this->_flags);
flagsHigh = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
if ((flagsLow & 1) == 0) {
this->_slowingCountdown = 2;
*GHIDRA_CAST<uint32_t *>(&this->_flags) = flagsLow | 0x80;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = flagsHigh;
}
}
}
else {
flagsLow = GHIDRA_UINT(this->_flags);
flagsHigh = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
if (((flagsLow & 1) == 0) &&
((this->_bossStatusEffectCooldown < 1 || (ignoreBossStatusCooldown != 0)))) {
vtable = *GHIDRA_CAST<int *>(this);
this->_slowingCountdown = this->_slowingCountdown + extraout_EDX;
*GHIDRA_CAST<uint32_t *>(&this->_flags) = flagsLow | 0x80;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = flagsHigh;
(**(code **)(vtable + 0x3c))(&color,extraout_EDX,0xff,0,1);
if ((ignoreBossStatusCooldown == 0) && (isBoss = FUN_006ae7a0(), isBoss != '\0')) {
this->_bossStatusEffectCooldown = 0xf0;
}
}
}
this->_slowingAmount = amount;
CopyStatusEffects(this);
}
return;
}
// 006ad870
void Entity::AddCharmed(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown, uint8_t addEnemyKillScore)
{
int iVar1;
uint8_t bVar2;
char cVar3;
uint32_t uVar4;
Entity_NPC *npc;
int unusedArg;
int extraout_ECX;
int extraout_EDX;
uint32_t *extraout_EDX_00;
uint32_t *entityIt;
void *sourceEntity;
int iVar5;
Game *game;
uint32_t uVar6;
Entity *statusOwner;
float sourcePosX;
float sourcePosY;
float sourceVelX;
float sourceVelY;
uint8_t auStack_54 [7];
char isAlreadyCharmed;
uint32_t uStack_4c;
int sourceSpawnerVariant;
EntityRef *local_44;
Entity *local_40;
uint32_t uStack_3c;
uint32_t charmColor;
uint32_t uStack_34;
uint32_t uStack_30;
uint32_t uStack_2c;
uint32_t local_28;
uint32_t uStack_24;
uint32_t uStack_20;
uint32_t uStack_1c;
uint32_t local_18;
uint32_t local_14;
uint32_t local_10;
uint32_t local_c;
uint32_t flagsHigh;
Entity *nextParent;
Entity *parentIt;
int *typePtr;
local_c = __security_cookie ^ GHIDRA_UINT(auStack_54);
local_44 = ref;
if ((this->_flags & 0x20000000) != 0) {
return;
}
local_40 = this;
apply_second_hand_duration(this,duration,ref);
bVar2 = DoesEntityShareStatus(this);
statusOwner = this;
if (bVar2 != 0) {
nextParent = GHIDRA_CAST<Entity *>(this->_parent);
statusOwner = this;
while (parentIt = nextParent, parentIt != GHIDRA_CAST<Entity *>(0x0)) {
statusOwner = parentIt;
nextParent = GHIDRA_CAST<Entity *>(parentIt->_parent);
}
}
uVar6 = GHIDRA_UINT(statusOwner->_flags);
isAlreadyCharmed = (uVar6 & 0x20000100) != 0;
if (extraout_EDX < 1) {
if (extraout_EDX < 0) {
typePtr = &this->_type;
if ((((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (*typePtr == 1)) ||
(*typePtr - 10U < 0x3de)) && ((!(bool)isAlreadyCharmed && (addEnemyKillScore != 0)))) {
award_fly_kill_points(&g_game->_scoreSheet,this);
}
flagsHigh = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&statusOwner->_flags) + 4));
*GHIDRA_CAST<uint32_t *>(&statusOwner->_flags) = GHIDRA_UINT(statusOwner->_flags) | 0x20000100;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&statusOwner->_flags) + 4)) = flagsHigh;
statusOwner->_charmedCountdown = 0;
cVar3 = this->IsBoss();
if ((((cVar3 == '\0') && (bVar2 = IsActiveEnemy(this,0), bVar2 != 0)) &&
((*typePtr != 0x17 || ((this->_variant != 0 || (this->_subtype != 1)))))) &&
(bVar2 = HasEntityFlags(this,0x1000000000000000), bVar2 == 0)) {
(GHIDRA_CAST<EntityList *>((GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)))))->EntityList::AddPersistentEntity(this);
}
game = g_game;
if (*GHIDRA_CAST<char *>(&g_game->_seedEffects) == '\0') {
bVar2 = (GHIDRA_CAST<Seeds *>((&g_game->_seedEffects)))->Seeds::AchievementUnlocksDisallowed();
if (bVar2 == 0) {
bVar2 = Manager::IsGameplayInputActive(unusedArg);
if ((((bVar2 == 0) && (game->_isRerun == 0)) &&
((g_manager->_persistentGameData)._achievements[0x183] == 0)) &&
(((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((g_manager)) + 0x8)))) != 2 || (game == GHIDRA_CAST<Game *>(0x0))) ||
(((game->_dailyChallenge)._id == 0 && (game->_isDebug == 0)))))) {
uStack_4c = 0;
iVar5 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(game->_room) + 0x1264));
if (iVar5 != 0) {
iVar1 = *GHIDRA_CAST<int *>(&game->_deathmatchManager);
entityIt = *GHIDRA_CAST<uint32_t **>((GHIDRA_CAST<char *>(game->_room) + 0x125c));
do {
nextParent = GHIDRA_CAST<Entity *>(*entityIt);
if ((((1 < iVar1) && (nextParent->_type == 1)) || (nextParent->_type - 10U < 0x3de))
&& ((nextParent->_flags & 0x20000000) != 0)) {
bVar2 = DoesEntityShareStatus(nextParent);
entityIt = extraout_EDX_00;
if ((bVar2 == 0) || (*GHIDRA_CAST<int *>((extraout_ECX + 0x3bc)) == 0)) {
uStack_4c = uStack_4c + 1;
}
}
this = local_40;
entityIt = entityIt + 1;
iVar5 = iVar5 + -1;
} while (iVar5 != 0);
game = g_game;
if (2 < uStack_4c) {
PersistentGameData::TryUnlock(&g_manager->_persistentGameData,0x183);
game = g_game;
}
}
}
}
}
if (((1 < *GHIDRA_CAST<int *>(&game->_deathmatchManager)) && (statusOwner->_type == 1)) ||
(statusOwner->_type - 10U < 0x3de)) {
statusOwner->ResetColor();
}
}
}
else if (((uVar6 & 1) == 0) &&
((statusOwner->_bossStatusEffectCooldown < 1 || (ignoreBossStatusCooldown != 0)))) {
iVar5 = statusOwner->_charmedCountdown;
local_18 = 0x3e20a0a1;
if (iVar5 < extraout_EDX) {
iVar5 = extraout_EDX;
}
local_14 = 0x3e20a0a1;
statusOwner->_charmedCountdown = iVar5;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&statusOwner->_flags) + 4)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&statusOwner->_flags) + 4));
local_28 = 0;
uStack_24 = 0;
uStack_20 = 0;
uStack_1c = 0;
*GHIDRA_CAST<uint32_t *>(&statusOwner->_flags) = uVar6 | 0x100;
charmColor = 0x3f800000;
uStack_34 = 0;
uStack_30 = 0x3f4ccccd;
uStack_2c = 0x3f800000;
local_10 = 0x3e20a0a1;
statusOwner->SetColor(&charmColor,iVar5,0xff,0,1);
if ((ignoreBossStatusCooldown == 0) && (cVar3 = FUN_006ae7a0(), cVar3 != '\0')) {
statusOwner->_bossStatusEffectCooldown = 0xf0;
}
}
sourceEntity = local_44->_entity;
if (sourceEntity == (void *)0x0) {
uStack_4c = 0;
LAB_006adc22:
local_44 = GHIDRA_CAST<EntityRef *>(0x0);
local_40 = GHIDRA_CAST<Entity *>(0x0);
sourceSpawnerVariant = 0;
sourcePosX = g_vectorZero.x;
sourcePosY = g_vectorZero.y;
sourceVelX = g_vectorZero.x;
sourceVelY = g_vectorZero.y;
LAB_006adc50:
uVar6 = 0;
if (sourceEntity != (void *)0x0) goto LAB_006adc56;
uVar6 = 0;
LAB_006adc72:
uStack_3c = 0;
if (sourceEntity != (void *)0x0) goto LAB_006adc7e;
}
else {
for (; *(void **)(GHIDRA_CAST<char *>(sourceEntity) + 0x3c8) != (void *)0x0;
sourceEntity = *(void **)(GHIDRA_CAST<char *>(sourceEntity) + 0x3c8)) {
}
uStack_4c = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sourceEntity) + 0x28));
if (sourceEntity == (void *)0x0) goto LAB_006adc22;
local_44 = *GHIDRA_CAST<EntityRef **>((GHIDRA_CAST<char *>(sourceEntity) + 0x2c));
sourcePosX = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(sourceEntity) + 0x33c));
sourcePosY = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(sourceEntity) + 0x340));
sourceVelX = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(sourceEntity) + 0x360));
sourceVelY = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(sourceEntity) + 0x364));
local_40 = *GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(sourceEntity) + 0x34));
sourceSpawnerVariant = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sourceEntity) + 0x38));
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(sourceEntity) + 0x168)) & 0x100) == 0) goto LAB_006adc50;
uVar6 = 1;
LAB_006adc56:
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(sourceEntity) + 0x168)) & 0x20000000) == 0) goto LAB_006adc72;
uStack_3c = 2;
LAB_006adc7e:
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(sourceEntity) + 0x16c)) & 0x400000) != 0) {
uVar4 = 4;
goto LAB_006adc99;
}
}
uVar4 = 0;
LAB_006adc99:
(this->_charmSource)._type = uStack_4c;
(this->_charmSource)._variant = GHIDRA_INT(local_44);
(this->_charmSource)._spawnerType = GHIDRA_INT(local_40);
(this->_charmSource)._spawnerVariant = sourceSpawnerVariant;
(this->_charmSource)._position.x = sourcePosX;
(this->_charmSource)._position.y = sourcePosY;
(this->_charmSource)._velocity.x = sourceVelX;
(this->_charmSource)._velocity.y = sourceVelY;
(this->_charmSource)._flags = uVar4 | uStack_3c | uVar6;
(this->_charmSource)._entity = sourceEntity;
CopyStatusEffects(statusOwner);
if (((statusOwner->_charmedCountdown != 0) && (isAlreadyCharmed == '\0')) &&
((((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager) && (statusOwner->_type == 1)) ||
(statusOwner->_type - 10U < 0x3de)) &&
(npc = (Entity_NPC *)
__RTDynamicCast(statusOwner,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor,
&IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0),
npc != GHIDRA_CAST<Entity_NPC *>(0x0))))) {
(GHIDRA_CAST<Entity_NPC *>((npc)))->Entity_NPC::ResetPathFinderTarget();
}
return;
}
// 006add70
void Entity::AddConfusion(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown)
{
uint8_t bVar1;
char cVar2;
int adjustedDuration;
uint32_t confusedFlagBefore;
Entity_NPC *npc;
int cappedCountdown;
uint32_t flagsLow;
int newCountdown;
ColorMod confusionColor;
Entity *ancestor;
uint32_t flagsHigh;
Entity *nextParent;
bVar1 = IsDamageSourceFriendly(this,ref);
if ((bVar1 == 0) &&
((this->_type != 1 ||
((bVar1 = (GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(this))))->Entity_Player::HasCollectible(0x278,0), bVar1 == 0 &&
(bVar1 = TemporaryEffects::HasCollectibleEffect
(GHIDRA_CAST<TemporaryEffects *>(&this[5]._sprite._overlayRenderFirst),0x278),
bVar1 == 0)))))) {
adjustedDuration = apply_second_hand_duration(this,duration,ref);
bVar1 = DoesEntityShareStatus(this);
if (bVar1 != 0) {
nextParent = GHIDRA_CAST<Entity *>(this->_parent);
while (ancestor = nextParent, ancestor != GHIDRA_CAST<Entity *>(0x0)) {
this = ancestor;
nextParent = GHIDRA_CAST<Entity *>(ancestor->_parent);
}
}
flagsLow = GHIDRA_UINT(this->_flags);
confusedFlagBefore = flagsLow & 0x200;
if (((adjustedDuration != 0) && ((flagsLow & 1) == 0)) &&
((this->_bossStatusEffectCooldown < 1 || (ignoreBossStatusCooldown != 0)))) {
newCountdown = this->_confusionCountdown;
if (adjustedDuration < 1) {
if (newCountdown < -adjustedDuration) {
newCountdown = -adjustedDuration;
}
}
else {
cappedCountdown = 0x78;
if (newCountdown + adjustedDuration < 0x78) {
cappedCountdown = newCountdown + adjustedDuration;
}
if (newCountdown < cappedCountdown) {
newCountdown = cappedCountdown;
}
flagsLow = GHIDRA_UINT(this->_flags);
}
this->_confusionCountdown = newCountdown;
flagsHigh = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
*GHIDRA_CAST<uint32_t *>(&this->_flags) = flagsLow | 0x200;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = flagsHigh;
confusionColor._colorize[0] = 0.0;
confusionColor._colorize[1] = 0.0;
confusionColor._colorize[2] = 0.0;
confusionColor._colorize[3] = 0.0;
confusionColor._tint[0] = 0.5;
confusionColor._tint[1] = 0.5;
confusionColor._tint[2] = 0.5;
confusionColor._tint[3] = 1.0;
confusionColor._offset[0] = 0.15686275;
confusionColor._offset[1] = 0.15686275;
confusionColor._offset[2] = 0.15686275;
this->SetColor(&confusionColor,newCountdown,0xff,0,1);
if ((ignoreBossStatusCooldown == 0) && (cVar2 = FUN_006ae7a0(), cVar2 != '\0')) {
this->_bossStatusEffectCooldown = 0xf0;
}
}
CopyStatusEffects(this);
if ((((0 < this->_confusionCountdown) && (confusedFlagBefore == 0)) &&
(bVar1 = IsEnemy(this), bVar1 != 0)) &&
(npc = (Entity_NPC *)
__RTDynamicCast(this,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor,
&IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0),
npc != GHIDRA_CAST<Entity_NPC *>(0x0))) {
(GHIDRA_CAST<Entity_NPC *>((npc)))->Entity_NPC::ResetPathFinderTarget();
}
}
return;
}
// 006adf40
void Entity::AddMidasFreeze(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown)
{
uint8_t bVar1;
char cVar2;
int freezeDuration;
ColorMod midasColor;
Entity *ancestor;
uint32_t flagsHigh;
Entity *nextParent;
bVar1 = IsDamageSourceFriendly(this,ref);
if (bVar1 == 0) {
freezeDuration = apply_second_hand_duration(this,duration,ref);
bVar1 = DoesEntityShareStatus(this);
if (bVar1 != 0) {
nextParent = GHIDRA_CAST<Entity *>(this->_parent);
while (ancestor = nextParent, ancestor != GHIDRA_CAST<Entity *>(0x0)) {
this = ancestor;
nextParent = GHIDRA_CAST<Entity *>(ancestor->_parent);
}
}
if (((0 < freezeDuration) && (this->_midasFreezeCountdown == 0)) &&
((this->_bossStatusEffectCooldown < 1 || (ignoreBossStatusCooldown != 0)))) {
if (this->_type == 0xf5) {
this->_variant = 1;
return;
}
bVar1 = HasEntityFlags(this,1);
if (bVar1 == 0) {
flagsHigh = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
*GHIDRA_CAST<uint32_t *>(&this->_flags) = GHIDRA_UINT(this->_flags) | 0x420;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = flagsHigh;
midasColor._colorize[0] = 0.0;
midasColor._colorize[1] = 0.0;
midasColor._colorize[2] = 0.0;
midasColor._colorize[3] = 0.0;
this->_midasFreezeCountdown = freezeDuration;
this->_freezeCountdown = freezeDuration;
midasColor._tint[0] = 1.5;
midasColor._tint[1] = 1.5;
midasColor._tint[2] = 0.3;
midasColor._tint[3] = 1.0;
midasColor._offset[0] = 0.15686275;
midasColor._offset[1] = 0.15686275;
midasColor._offset[2] = 0.15686275;
this->SetColor(&midasColor,freezeDuration,0xff,0,1);
if ((ignoreBossStatusCooldown == 0) && (cVar2 = FUN_006ae7a0(), cVar2 != '\0')) {
this->_bossStatusEffectCooldown = 0xf0;
}
}
}
CopyStatusEffects(this);
}
return;
}
// 006ae0a0
void Entity::AddFear(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown)
{
uint8_t bVar1;
char isBoss;
int iVar2;
uint32_t extraout_EAX;
Entity_NPC *npc;
int newFearCountdown;
uint8_t auStack_44 [7];
uint8_t isHadFearFlags;
EntityRef *sourceRef;
Color fearColor;
uint32_t local_c;
Game *game;
Entity *nextParent;
int oldFearCountdown;
Entity *parent;
local_c = __security_cookie ^ GHIDRA_UINT(auStack_44);
sourceRef = ref;
bVar1 = IsDamageSourceFriendly(this,ref);
if ((bVar1 == 0) &&
((this->_type != 1 ||
((bVar1 = (GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(this))))->Entity_Player::HasCollectible(0x278,0), bVar1 == 0 &&
(bVar1 = TemporaryEffects::HasCollectibleEffect
(GHIDRA_CAST<TemporaryEffects *>(&this[5]._sprite._overlayRenderFirst),0x278),
bVar1 == 0)))))) {
iVar2 = apply_second_hand_duration(this,duration,ref);
bVar1 = DoesEntityShareStatus(this);
if (bVar1 != 0) {
nextParent = GHIDRA_CAST<Entity *>(this->_parent);
while (parent = nextParent, parent != GHIDRA_CAST<Entity *>(0x0)) {
this = parent;
nextParent = GHIDRA_CAST<Entity *>(parent->_parent);
}
}
if (((iVar2 != 0) && ((this->_flags & 1) == 0)) &&
((this->_bossStatusEffectCooldown < 1 || (ignoreBossStatusCooldown != 0)))) {
isHadFearFlags = HasEntityFlags(this,0x1000800);
oldFearCountdown = this->_fearCountdown;
if (iVar2 < 1) {
newFearCountdown = oldFearCountdown;
if (oldFearCountdown < -iVar2) {
newFearCountdown = -iVar2;
}
}
else {
newFearCountdown = 0x78;
if (oldFearCountdown + iVar2 < 0x78) {
newFearCountdown = oldFearCountdown + iVar2;
}
}
this->_fearCountdown = newFearCountdown;
::(GHIDRA_CAST<Color *>((&fearColor)))->Color::Color();
this->SetColor(extraout_EAX,newFearCountdown,0xff,0,1);
*GHIDRA_CAST<uint32_t *>(&this->_flags) = GHIDRA_UINT(this->_flags) | 0x800;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
if ((((ignoreBossStatusCooldown == 0) &&
(isBoss = FUN_006ae7a0(), game = g_game, isBoss != '\0')) &&
(this->_bossStatusEffectCooldown = 0xf0, game->_challenge == 0x1e)) &&
(sourceRef->_type == 1)) {
iVar2 = this->_bossStatusEffectCooldown;
if (sourceRef->_variant == 0) {
iVar2 = 0x5a;
}
this->_bossStatusEffectCooldown = iVar2;
}
CopyStatusEffects(this);
if (((0 < this->_fearCountdown) && (isHadFearFlags == 0)) &&
((bVar1 = IsEnemy(this), bVar1 != 0 &&
(npc = (Entity_NPC *)
__RTDynamicCast(this,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor,
&IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0),
npc != GHIDRA_CAST<Entity_NPC *>(0x0))))) {
(GHIDRA_CAST<Entity_NPC *>((npc)))->Entity_NPC::ResetPathFinderTarget();
}
}
}
return;
}
// 006ae280
void Entity::AddBurn(EntityRef *ref, int duration, float damage, uint8_t ignoreBossStatusCooldown)
{
uint32_t uVar1;
uint8_t bVar2;
char cVar3;
int newBurnCountdown;
int extraout_EDX;
float burnDamage;
int burnCountdown;
Entity *nextParent;
Entity *parent;
void *sourceEntity;
void *spawner;
uint32_t temp_5fab6eade2;
bVar2 = IsDamageSourceFriendly(this,ref);
if (bVar2 != 0) {
return;
}
if (this->_type == 1) {
bVar2 = (GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(this))))->Entity_Player::HasCollectible(0x278,0);
if (bVar2 != 0) {
return;
}
bVar2 = TemporaryEffects::HasCollectibleEffect
(GHIDRA_CAST<TemporaryEffects *>(&this[5]._sprite._overlayRenderFirst),0x278);
if (bVar2 != 0) {
return;
}
}
apply_second_hand_duration(this,duration,ref);
if (damage <= 0.0) {
if ((this->_type != 1) && (sourceEntity = ref->_entity, sourceEntity != (void *)0x0)) {
for (spawner = *(void **)(GHIDRA_CAST<char *>(sourceEntity) + 0x3c8); spawner != (void *)0x0;
spawner = *(void **)(GHIDRA_CAST<char *>(spawner) + 0x3c8)) {
sourceEntity = spawner;
}
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sourceEntity) + 0x28)) == 1) {
damage = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(sourceEntity) + 0x157c));
goto LAB_006ae326;
}
}
damage = 2.0;
}
LAB_006ae326:
bVar2 = DoesEntityShareStatus(this);
if (bVar2 != 0) {
nextParent = GHIDRA_CAST<Entity *>(this->_parent);
while (parent = nextParent, parent != GHIDRA_CAST<Entity *>(0x0)) {
this = parent;
nextParent = GHIDRA_CAST<Entity *>(parent->_parent);
}
}
if (((extraout_EDX != 0) && (uVar1 = GHIDRA_UINT(this->_flags), (uVar1 & 1) == 0)) &&
((this->_bossStatusEffectCooldown < 1 || (ignoreBossStatusCooldown != 0)))) {
burnCountdown = this->_burnCountdown;
if (extraout_EDX < 1) {
newBurnCountdown = burnCountdown;
if (burnCountdown < -extraout_EDX) {
newBurnCountdown = -extraout_EDX;
}
}
else {
newBurnCountdown = 0xa0;
if (burnCountdown + extraout_EDX < 0xa0) {
newBurnCountdown = burnCountdown + extraout_EDX;
}
}
this->_burnCountdown = newBurnCountdown;
if ((uVar1 & 0x1000) == 0) {
this->_burnDamageTimer = 0;
}
burnDamage = this->_burnTickDamage;
if (burnDamage <= damage) {
burnDamage = damage;
}
this->_burnTickDamage = burnDamage;
temp_5fab6eade2 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
*GHIDRA_CAST<uint32_t *>(&this->_flags) = uVar1 | 0x1000;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = temp_5fab6eade2;
if ((ignoreBossStatusCooldown == 0) && (cVar3 = FUN_006ae7a0(), cVar3 != '\0')) {
this->_bossStatusEffectCooldown = 0xf0;
}
CopyStatusEffects(this);
}
return;
}
// 006ae420
void Entity::AddBleeding(EntityRef *ref, int duration, uint8_t unused)
{
uint8_t bVar1;
char cVar2;
uint32_t refFlagReflected;
int newCountdown;
int extraout_EDX;
Entity *statusOwner;
uint32_t local_38;
EntityRef sourceRef;
Entity *ancestor;
uint32_t *flagsHigh;
Entity *nextParent;
int oldCountdown;
bVar1 = IsDamageSourceFriendly(this,ref);
if (bVar1 != 0) {
return;
}
apply_second_hand_duration(this,duration,ref);
bVar1 = DoesEntityShareStatus(this);
statusOwner = this;
if (bVar1 != 0) {
nextParent = GHIDRA_CAST<Entity *>(this->_parent);
statusOwner = this;
while (ancestor = nextParent, ancestor != GHIDRA_CAST<Entity *>(0x0)) {
statusOwner = ancestor;
nextParent = GHIDRA_CAST<Entity *>(ancestor->_parent);
}
}
if (extraout_EDX == 0) {
return;
}
if ((statusOwner->_flags & 1) != 0) {
return;
}
if (0 < statusOwner->_bossStatusEffectCooldown) {
return;
}
oldCountdown = statusOwner->_bleedingCountdown;
if (extraout_EDX < 1) {
newCountdown = oldCountdown;
if (oldCountdown < -extraout_EDX) {
newCountdown = -extraout_EDX;
}
}
else {
newCountdown = 0x78;
if (oldCountdown + extraout_EDX < 0x78) {
newCountdown = oldCountdown + extraout_EDX;
}
}
statusOwner->_bleedingCountdown = newCountdown;
flagsHigh = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&statusOwner->_flags) + 4));
*flagsHigh = *flagsHigh | 4;
*GHIDRA_CAST<int *>(&statusOwner->_flags) = GHIDRA_INT(statusOwner->_flags);
sourceRef._entity = ref->_entity;
if (sourceRef._entity == (void *)0x0) {
sourceRef._type = 0;
LAB_006ae55a:
sourceRef._variant = 0;
sourceRef._spawnerType = 0;
sourceRef._spawnerVariant = 0;
sourceRef._position.x = g_vectorZero.x;
sourceRef._position.y = g_vectorZero.y;
sourceRef._velocity.x = g_vectorZero.x;
sourceRef._velocity.y = g_vectorZero.y;
LAB_006ae59a:
sourceRef._flags = 0;
if (sourceRef._entity != (void *)0x0) goto LAB_006ae5a0;
sourceRef._flags = 0;
LAB_006ae5bc:
local_38 = 0;
if (sourceRef._entity != (void *)0x0) goto LAB_006ae5c8;
}
else {
while (*(void **)(GHIDRA_CAST<char *>(sourceRef._entity) + 0x3c8) != (void *)0x0) {
sourceRef._entity = *(void **)(GHIDRA_CAST<char *>(sourceRef._entity) + 0x3c8);
}
sourceRef._type = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x28));
if (sourceRef._entity == (void *)0x0) goto LAB_006ae55a;
sourceRef._variant = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x2c));
sourceRef._position.x = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x33c));
sourceRef._position.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x340));
sourceRef._spawnerType = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x34));
sourceRef._spawnerVariant = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x38));
sourceRef._velocity.x = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x360));
sourceRef._velocity.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x364));
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x168)) & 0x100) == 0) goto LAB_006ae59a;
sourceRef._flags = 1;
LAB_006ae5a0:
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x168)) & 0x20000000) == 0) goto LAB_006ae5bc;
local_38 = 2;
LAB_006ae5c8:
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x16c)) & 0x400000) != 0) {
refFlagReflected = 4;
goto LAB_006ae5e3;
}
}
refFlagReflected = 0;
LAB_006ae5e3:
sourceRef._flags = refFlagReflected | local_38 | sourceRef._flags;
(GHIDRA_CAST<EntityRef *>((&this->_entityRef2)))->EntityRef::operator_(&sourceRef);
cVar2 = FUN_006ae7a0();
if (cVar2 != '\0') {
statusOwner->_bossStatusEffectCooldown = 0xf0;
}
CopyStatusEffects(statusOwner);
return;
}
// 006ae630
void Entity::RemoveStatusEffects()
{
uint32_t *flagsHigh;
uint64_t oldFlags;
(this->_colorParams)._end = (this->_colorParams)._begin;
*GHIDRA_CAST<uint32_t *>(&this->_flags) = GHIDRA_UINT(this->_flags) & 0xdeffe01f;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
this->_freezeCountdown = 0;
this->_poisonCountdown = 0;
this->_slowingCountdown = 0;
this->_charmedCountdown = 0;
this->_confusionCountdown = 0;
this->_midasFreezeCountdown = 0;
this->_fearCountdown = 0;
this->_burnCountdown = 0;
this->_shrinkCountdown = 0;
SetSize(this,*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this->_config) + 0x38)),
(Vector)(CONCAT44(g_vectorOne.y,g_vectorOne.x) ^ 0x8000000080000000),-1);
oldFlags = this->_flags;
flagsHigh = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
*flagsHigh = *flagsHigh & 0xfea27ffb;
*GHIDRA_CAST<int *>(&this->_flags) = GHIDRA_INT(oldFlags);
this->_shrinkStatus2 = 1.0;
this->_bleedingCountdown = 0;
this->_bleedDamageAccumulator = 0.0;
this->_magnetizedCountdown = 0;
this->_baitedCountdown = 0;
this->_knockbackCountdown = 0;
this->_iceCountdown = 0;
this->_weaknessCountdown = 0;
this->_brimstoneMarkCountdown = 0;
this->_poisonTickDamage = 2.0;
this->_burnTickDamage = 2.0;
this->ResetColor();
CopyStatusEffects(this);
return;
}
// 006ae7d0
void Entity::PreUpdate()
{
(this->_prevPosition).x = (this->_pos).x;
(this->_prevPosition).y = (this->_pos).y;
(this->_prevVelocity).x = (this->_velocity).x;
(this->_prevVelocity).y = (this->_velocity).y;
return;
}
// 006ae820
void Entity::Update()
{
void **ppvVar1;
code *pcVar2;
int64_t lVar3;
int64_t lVar4;
BitSet128 flags;
uint8_t bVar5;
char cVar6;
Vector *velocityDir;
int iVar7;
ColorMod *color;
ColorMod *from;
EntityRef *sourceRef;
Entity_Tear *pEVar8;
int *piVar9;
Entity *tmpEntity;
uint32_t uVar10;
uint32_t uVar11;
int **ppiVar12;
uint32_t uVar13;
int iVar14;
uint32_t *hitFlashColor;
int unusedArg;
void *pvVar15;
code *extraout_EDX;
float *pfVar16;
void *nextColorParam;
uint32_t flagsLo;
PlayerManager *playerManager;
bool bVar17;
float fVar18;
float newVelocityX;
Entity_Tear *pEVar19;
float fVar20;
uint8_t *pushStrength;
float fVar21;
uint64_t uVar22;
double dVar23;
uint8_t auStack_328 [8];
ItemPool *local_320;
uint8_t local_319;
float *local_318;
float *local_314;
float *local_310;
float *pfStack_30c;
Entity_Tear *local_308;
float *local_304;
uint32_t uStack_300;
Entity *pEStack_2fc;
Game *pGStack_2f8;
float *pfStack_2f4;
int *apiStack_2f0 [2];
Entity *self;
Vector *local_2e4;
int *apiStack_2e0 [2];
Vector VStack_2d8;
uint32_t uStack_2d0;
Vector local_2c8;
uint32_t spawnVariant;
void *pvStack_2bc;
float *pfStack_2b8;
int hitSoundId;
uint32_t newTearFlagsLo;
uint64_t uStack_2ac;
uint32_t uStack_2a4;
float fatalDamage;
float local_290;
float local_28c;
float local_288;
float local_284;
float local_280;
float local_27c;
float fStack_278;
float fStack_274;
float fStack_270;
uint32_t *targetSlot;
int triggerKeyType;
int triggerKeyVariant;
int anyVariantKey [2];
Vector particleVelocity;
uint8_t auStack_250 [4];
uint8_t auStack_24c [8];
float fStack_244;
Color blendedColor;
Vector normalizedVelocity;
KColor debugTextColor;
uint8_t local_1f8 [60];
EntityRef burnSourceRef;
EntityRef bleedSourceRef;
ColorMod lerpedColor;
Color defaultColor;
RNG cardRng;
uint32_t hitColor;
uint32_t uStack_ec;
uint32_t uStack_e8;
uint32_t uStack_e4;
uint32_t uStack_e0;
uint32_t uStack_dc;
uint32_t uStack_d8;
uint32_t uStack_d4;
uint32_t uStack_d0;
uint32_t uStack_cc;
uint32_t uStack_c8;
uint32_t hushBeastHitColor;
uint32_t uStack_c0;
uint32_t uStack_bc;
uint32_t uStack_b8;
uint32_t uStack_b4;
uint32_t uStack_b0;
uint32_t uStack_ac;
uint32_t uStack_a8;
uint32_t uStack_a4;
uint32_t uStack_a0;
uint32_t uStack_9c;
uint32_t poisonColor;
uint32_t uStack_94;
uint32_t uStack_90;
uint32_t uStack_8c;
uint32_t uStack_88;
uint32_t uStack_84;
uint32_t uStack_80;
uint32_t uStack_7c;
uint32_t uStack_78;
uint32_t uStack_74;
uint32_t uStack_70;
uint32_t burnColor;
uint32_t uStack_68;
uint32_t uStack_64;
uint32_t uStack_60;
uint32_t uStack_5c;
uint32_t uStack_58;
uint32_t uStack_54;
uint32_t uStack_50;
uint32_t uStack_4c;
uint32_t uStack_48;
uint32_t uStack_44;
ColorMod bleedFlashColor;
uint32_t local_14;
void *colorParamsEnd;
uint32_t *flagsHiPtr;
Game *game;
Manager *manager;
uint64_t oldFlags;
std_set *spawnTriggerTargets;
local_14 = __security_cookie ^ GHIDRA_UINT(auStack_328);
local_320 = *GHIDRA_CAST<ItemPool **>(&this->_flags);
uVar13 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
self = this;
if ((GHIDRA_UINT(local_320) & 0x4000) == 0) {
this->_prevUpdateTime = this->_updateTime;
this->_updateTime = this->_speedMultiplier + this->_updateTime;
if (((((GHIDRA_UINT(local_320) & 0x20) == 0) && (this->_holdCountdown < 1)) || (this->_dead != 0)) &&
((uVar13 & 1) == 0)) {
local_310 = GHIDRA_CAST<float *>((this->_sprite)._playbackSpeed);
(this->_sprite)._playbackSpeed = (float)local_310 * this->_speedMultiplier;
if ((this->_sprite)._loaded != 0) {
AnimationState::Update(&(this->_sprite)._animState);
AnimationState::Update(&(this->_sprite)._overlayAnimState);
local_320 = *GHIDRA_CAST<ItemPool **>(&this->_flags);
uVar13 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
}
(this->_sprite)._playbackSpeed = (float)local_310;
}
}
if ((uVar13 & 0x8000) != 0) {
local_319 = this->_collidesWithGrid;
if (local_319 == 0) {
local_2e4 = GHIDRA_CAST<Vector *>((this->_velocity).x);
local_304 = GHIDRA_CAST<float *>((this->_velocity).y);
local_310 = GHIDRA_CAST<float *>(sqrtf((float)local_2e4 * (float)local_2e4 +
(float)local_304 * (float)local_304));
fVar18 = (this->_knockbackDirection).x;
fVar20 = (this->_knockbackDirection).y;
fVar18 = sqrtf(fVar18 * fVar18 + fVar20 * fVar20);
if (((float)local_310 < fVar18) ||
(0.0 <= (this->_knockbackDirection).x * (float)local_2e4 +
(this->_knockbackDirection).y * (float)local_304)) goto LAB_006ae9c3;
}
else {
LAB_006ae9c3:
local_310 = GHIDRA_CAST<float *>((this->_knockbackDirection).x);
fVar18 = (this->_knockbackDirection).y;
fVar18 = sqrtf((float)local_310 * (float)local_310 + fVar18 * fVar18);
if (2.0 <= fVar18) {
this->_friction = this->_baseFriction * 0.95;
if ((uVar13 & 0x20000) == 0) {
(this->_knockbackDirection).x = (float)local_310 * 0.95;
local_308 = GHIDRA_CAST<Entity_Tear *>(((this->_knockbackDirection).y * 0.95));
(this->_knockbackDirection).y = (float)local_308;
bVar5 = this->_collidesWithGrid;
local_2c8.x = *GHIDRA_CAST<float *>(&this->_flags);
uVar13 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
}
else {
local_308 = GHIDRA_CAST<Entity_Tear *>((this->_knockbackDirection).y);
local_2c8.x = (float)local_320;
bVar5 = local_319;
}
if (bVar5 != 0) {
if ((uVar13 & 0x10000) != 0) {
velocityDir = (GHIDRA_CAST<Vector *>((&this->_velocity)))->Vector::Normalized(&normalizedVelocity);
fVar18 = (this->_knockbackDirection).x;
fVar20 = sqrtf((float)local_308 * (float)local_308 + fVar18 * fVar18);
fVar18 = velocityDir->y;
(this->_knockbackDirection).x = fVar20 * velocityDir->x * 0.8;
(this->_knockbackDirection).y = fVar20 * fVar18 * 0.8;
iVar7 = _get_index_plus_one_if_kind_4_5();
fVar18 = (float)(iVar7 + -1) + (float)(iVar7 + -1) + 10.0;
sourceRef = (GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>(local_1f8))))->EntityRef::EntityRef();
(*extraout_EDX)(fVar18,0,0,sourceRef,0x1e);
oldFlags = this->_flags;
flagsHiPtr = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
*flagsHiPtr = *flagsHiPtr & 0xfffeffff;
*GHIDRA_CAST<int *>(&this->_flags) = GHIDRA_INT(oldFlags);
}
this->_knockbackCountdown = this->_knockbackCountdown / 2;
}
(this->_velocity).x = (this->_knockbackDirection).x;
(this->_velocity).y = (this->_knockbackDirection).y;
goto LAB_006aeb95;
}
}
*GHIDRA_CAST<ItemPool **>(&this->_flags) = local_320;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = uVar13 & 0xfffe7fff;
this->_knockbackCountdown = 0;
}
LAB_006aeb95:
fVar18 = this->_speedMultiplier;
fVar21 = 1.0;
fVar20 = this->_friction;
if (fVar18 != 1.0) {
fVar20 = fVar20 / ((fVar20 + fVar18) - fVar20 * fVar18);
}
local_2e4 = &this->_pos;
newVelocityX = fVar20 * (this->_velocity).x;
fVar20 = fVar20 * (this->_velocity).y;
(this->_velocity).x = newVelocityX;
(this->_velocity).y = fVar20;
fVar18 = this->_speedMultiplier;
(this->_pos).y = fVar18 * fVar20 + (this->_pos).y;
local_2e4->x = fVar18 * newVelocityX + local_2e4->x;
local_318 = *GHIDRA_CAST<float **>(&this->_flags);
pfVar16 = *GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4));
this->_friction = this->_baseFriction;
if ((GHIDRA_UINT(local_318) & 0x4000) == 0) {
pvVar15 = (this->_colorParams)._begin;
bVar17 = false;
if (pvVar15 != (this->_colorParams)._end) {
do {
iVar7 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar15) + 0x34)) + -1;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar15) + 0x34)) = iVar7;
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(pvVar15) + 0x38)) != '\0') {
bVar17 = true;
}
nextColorParam = (void *)(GHIDRA_INT(pvVar15) + 0x3c);
if (iVar7 == 0) {
FUN_004b6ec0(pvVar15);
bVar17 = true;
ppvVar1 = &(this->_colorParams)._end;
*ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + -0x3c);
nextColorParam = pvVar15;
}
colorParamsEnd = (this->_colorParams)._end;
pvVar15 = nextColorParam;
} while (nextColorParam != colorParamsEnd);
if (bVar17) {
pvVar15 = (this->_colorParams)._begin;
iVar14 = GHIDRA_INT(colorParamsEnd) - GHIDRA_INT(pvVar15);
iVar7 = iVar14 >> 0x1f;
iVar14 = iVar14 / 0x3c + iVar7;
if (iVar14 == iVar7) {
this->ResetColor();
}
else {
color = GHIDRA_CAST<ColorMod *>((GHIDRA_INT(pvVar15) + 0x40));
if (GHIDRA_UINT((iVar14 - iVar7)) < 2) {
color = &this->_color;
}
blendedColor._tint[0] = (GHIDRA_CAST<ColorMod *>((GHIDRA_INT(pvVar15) + 4)))->_tint[0];
blendedColor._tint[1] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar15) + 8));
blendedColor._tint[2] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar15) + 0xc));
blendedColor._tint[3] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar15) + 0x10));
blendedColor._offset[2] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar15) + 0x2c));
blendedColor._colorize[0] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar15) + 0x14));
blendedColor._colorize[1] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar15) + 0x18));
blendedColor._colorize[2] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar15) + 0x1c));
blendedColor._colorize[3] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar15) + 0x20));
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(blendedColor._offset)) + 0x0))) = *GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(pvVar15) + 0x24));
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(pvVar15) + 0x38)) != '\0') {
color = ::Color::Lerp(&lerpedColor,GHIDRA_CAST<ColorMod *>((GHIDRA_INT(pvVar15) + 4)),color,
fVar21 - (float)*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar15) + 0x34)) /
(float)*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar15) + 0x30)));
::(GHIDRA_CAST<Color *>((&blendedColor)))->Color::operator_assign(color);
}
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST<ColorMod *>(&blendedColor));
}
}
}
flagsLo = *GHIDRA_CAST<uint32_t *>(&this->_flags);
local_318 = *GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4));
pfVar16 = local_318;
if (((flagsLo & 1) == 0) &&
(((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager) && (this->_type == 1)) ||
(this->_type - 10U < 0x3de)))) {
bVar5 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0x11);
if ((bVar5 != 0) || (bVar5 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0x15), bVar5 != 0)) {
flagsLo = flagsLo | 0x100;
this->_charmedCountdown = 2;
*GHIDRA_CAST<uint32_t *>(&this->_flags) = flagsLo;
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = local_318;
}
local_310 = GHIDRA_CAST<float *>(flagsLo);
local_304 = local_318;
bVar5 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0x12);
if (bVar5 != 0) {
flagsLo = flagsLo | 0x200;
this->_confusionCountdown = 2;
local_318 = local_304;
*GHIDRA_CAST<uint32_t *>(&this->_flags) = flagsLo;
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = local_304;
}
local_310 = GHIDRA_CAST<float *>(flagsLo);
local_304 = local_318;
bVar5 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0x13);
if ((bVar5 == 0) && (bVar5 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0x15), bVar5 == 0)) {
bVar5 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0x14);
pfVar16 = local_318;
if ((bVar5 == 0) || (((g_game->_frameCount - this->_spawnFrame) / 0x3c & 1U) != 0))
goto LAB_006aeed2;
}
flagsLo = GHIDRA_UINT(local_310) | 0x800;
this->_fearCountdown = 2;
*GHIDRA_CAST<uint32_t *>(&this->_flags) = flagsLo;
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = local_304;
pfVar16 = local_304;
}
LAB_006aeed2:
if (0 < this->_fireDamageCountdown) {
this->_fireDamageCountdown = this->_fireDamageCountdown + -1;
}
if (0 < this->_damageCountdown) {
this->_damageCountdown = this->_damageCountdown + -1;
}
if ((0 < this->_freezeCountdown) &&
(iVar7 = this->_freezeCountdown + -1, this->_freezeCountdown = iVar7, iVar7 < 1)) {
flagsLo = flagsLo & 0xffffffdf;
*GHIDRA_CAST<uint32_t *>(&this->_flags) = flagsLo;
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar16;
}
if ((0 < this->_poisonCountdown) &&
(iVar7 = this->_poisonCountdown + -1, this->_poisonCountdown = iVar7, iVar7 < 1)) {
flagsLo = flagsLo & 0xffffffbf;
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar16;
*GHIDRA_CAST<uint32_t *>(&this->_flags) = flagsLo;
this->_poisonTickDamage = 2.0;
}
if ((0 < this->_slowingCountdown) &&
(iVar7 = this->_slowingCountdown + -1, this->_slowingCountdown = iVar7, iVar7 < 1)) {
flagsLo = flagsLo & 0xffffff7f;
*GHIDRA_CAST<uint32_t *>(&this->_flags) = flagsLo;
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar16;
}
local_314 = pfVar16;
if ((0 < this->_charmedCountdown) &&
(iVar7 = this->_charmedCountdown + -1, this->_charmedCountdown = iVar7, iVar7 < 1)) {
iVar7 = this->_target;
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar16;
flagsLo = flagsLo & 0xfffffeff;
*GHIDRA_CAST<uint32_t *>(&this->_flags) = flagsLo;
if (iVar7 != 0) {
local_320 = GHIDRA_CAST<ItemPool *>(pfVar16);
targetSlot = &this->_target;
msvc::multiset<unsigned_int>::erase(&targetSlot);
flagsLo = *GHIDRA_CAST<uint32_t *>(&this->_flags);
pfVar16 = *GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4));
this->_target = 0;
}
}
if ((0 < this->_confusionCountdown) &&
(iVar7 = this->_confusionCountdown + -1, this->_confusionCountdown = iVar7, iVar7 < 1)) {
flagsLo = flagsLo & 0xfffffdff;
*GHIDRA_CAST<uint32_t *>(&this->_flags) = flagsLo;
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar16;
}
if ((0 < this->_fearCountdown) &&
(iVar7 = this->_fearCountdown + -1, this->_fearCountdown = iVar7, iVar7 < 1)) {
flagsLo = flagsLo & 0xfffff7ff;
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar16;
*GHIDRA_CAST<uint32_t *>(&this->_flags) = flagsLo;
}
fVar18 = this->_shrinkStatus1;
if (this->_shrinkStatus2 != fVar18) {
this->_shrinkStatus1 = (this->_shrinkStatus2 - fVar18) * 5.0 * 0.033333335 + fVar18;
}
local_320 = GHIDRA_CAST<ItemPool *>(pfVar16);
if ((0 < this->_shrinkCountdown) &&
(iVar7 = this->_shrinkCountdown + -1, this->_shrinkCountdown = iVar7, iVar7 < 1)) {
FUN_006b5f40();
flagsLo = *GHIDRA_CAST<uint32_t *>(&this->_flags);
pfVar16 = *GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4));
}
if (0 < this->_burnCountdown) {
iVar7 = this->_burnCountdown + -1;
this->_burnCountdown = iVar7;
if (iVar7 < 1) {
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar16;
*GHIDRA_CAST<uint32_t *>(&this->_flags) = flagsLo & 0xffffefff;
this->_burnTickDamage = 2.0;
}
if ((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(ThreadLocalStoragePointer) + 0xc)) < DAT_00c80a98) &&
(_Init_thread_header(&DAT_00c80a98), DAT_00c80a98 == -1)) {
_DAT_00c80ac0 = 0;
_DAT_00c80ab0 = 0;
uRam00c80ab4 = 0;
uRam00c80ab8 = 0;
uRam00c80abc = 0;
_DAT_00c80aa0 = 0x3f800000;
uRam00c80aa4 = 0x3f800000;
uRam00c80aa8 = 0x3f800000;
uRam00c80aac = 0x3f800000;
_DAT_00c80ac4 = 0;
_DAT_00c80ac8 = 0;
_DAT_00c80adc = 0;
uRam00c80ae0 = 0;
uRam00c80ae4 = 0;
uRam00c80ae8 = 0;
_DAT_00c80aec = 0x3e34b4b5;
_DAT_00c80acc = 0x3f800000;
uRam00c80ad0 = 0x3f800000;
uRam00c80ad4 = 0x3f4dcdcf;
uRam00c80ad8 = 0x3f800000;
_DAT_00c80af0 = 0;
_DAT_00c80af4 = 0;
_DAT_00c80b08 = 0;
uRam00c80b0c = 0;
uRam00c80b10 = 0;
uRam00c80b14 = 0;
_DAT_00c80b18 = 0x3eb4b4b5;
_DAT_00c80af8 = 0x3f800000;
uRam00c80afc = 0x3f800000;
uRam00c80b00 = 0x3f1b9b9c;
uRam00c80b04 = 0x3f800000;
_DAT_00c80b1c = 0;
_DAT_00c80b20 = 0;
_DAT_00c80b34 = 0;
uRam00c80b38 = 0;
uRam00c80b3c = 0;
uRam00c80b40 = 0;
_DAT_00c80b44 = 0x3e8c8c8d;
_DAT_00c80b24 = 0x3f800000;
uRam00c80b28 = 0x3f800000;
uRam00c80b2c = 0x3f4dcdcf;
uRam00c80b30 = 0x3f800000;
_DAT_00c80b48 = 0x3dc8c8ca;
_DAT_00c80b4c = 0;
_DAT_00c80b60 = 0;
uRam00c80b64 = 0;
uRam00c80b68 = 0;
uRam00c80b6c = 0;
_DAT_00c80b70 = 0x3e48c8ca;
_DAT_00c80b50 = 0x3f800000;
uRam00c80b54 = 0x3f800000;
uRam00c80b58 = 0x3f800000;
uRam00c80b5c = 0x3f800000;
_DAT_00c80b74 = 0x3e48c8ca;
_DAT_00c80b78 = 0;
_DAT_00c80b8c = 0;
uRam00c80b90 = 0;
uRam00c80b94 = 0;
uRam00c80b98 = 0;
_DAT_00c80b9c = 0x3dc8c8ca;
_DAT_00c80b7c = 0x3f800000;
uRam00c80b80 = 0x3f800000;
uRam00c80b84 = 0x3f800000;
uRam00c80b88 = 0x3f800000;
_DAT_00c80ba0 = 0x3dc8c8ca;
_DAT_00c80ba4 = 0;
_Init_thread_footer(&DAT_00c80a98);
}
(**(code **)(*GHIDRA_CAST<int *>(this) + 0x3c))
(&DAT_00c80aa0 + ((g_game->_frameCount - this->_spawnFrame) % 6) * 0x2c,1,0xff,0,1);
flagsLo = *GHIDRA_CAST<uint32_t *>(&this->_flags);
pfVar16 = *GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4));
}
if ((this->_midasFreezeCountdown < 1) ||
(iVar7 = this->_midasFreezeCountdown + -1, this->_midasFreezeCountdown = iVar7, 0 < iVar7)) {
pfStack_30c = GHIDRA_CAST<float *>(flagsLo);
}
else {
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar16;
*GHIDRA_CAST<float **>(&this->_flags) = GHIDRA_CAST<float *>((flagsLo & 0xfffffbff));
pfStack_30c = GHIDRA_CAST<float *>((flagsLo & 0xfffffbff));
}
local_314 = GHIDRA_CAST<float *>(flagsLo);
if (0 < this->_bleedingCountdown) {
iVar7 = this->_bleedingCountdown + -1;
this->_bleedingCountdown = iVar7;
if (iVar7 < 1) {
*GHIDRA_CAST<float **>(&this->_flags) = pfStack_30c;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = GHIDRA_UINT(pfVar16) & 0xfffffffb;
this->_bleedDamageAccumulator = 0.0;
}
if ((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(ThreadLocalStoragePointer) + 0xc)) < DAT_00c80ba8) &&
(_Init_thread_header(&DAT_00c80ba8), DAT_00c80ba8 == -1)) {
_DAT_00c80bd0 = 0;
_DAT_00c80bc0 = 0;
uRam00c80bc4 = 0;
uRam00c80bc8 = 0;
uRam00c80bcc = 0;
_DAT_00c80bb0 = 0x3f800000;
uRam00c80bb4 = 0x3f800000;
uRam00c80bb8 = 0x3f800000;
uRam00c80bbc = 0x3f800000;
_DAT_00c80bd4 = 0;
_DAT_00c80bd8 = 0;
_DAT_00c80bec = 0;
uRam00c80bf0 = 0;
uRam00c80bf4 = 0;
uRam00c80bf8 = 0;
_DAT_00c80bfc = 0x3e34b4b5;
_DAT_00c80bdc = 0x3f800000;
uRam00c80be0 = 0x3f3ebebf;
uRam00c80be4 = 0x3f3ebebf;
uRam00c80be8 = 0x3f800000;
_DAT_00c80c00 = 0;
_DAT_00c80c04 = 0;
_DAT_00c80c18 = 0;
uRam00c80c1c = 0;
uRam00c80c20 = 0;
uRam00c80c24 = 0;
_DAT_00c80c28 = 0x3eb4b4b5;
_DAT_00c80c08 = 0x3f800000;
uRam00c80c0c = 0x3ef0f0f2;
uRam00c80c10 = 0x3ef0f0f2;
uRam00c80c14 = 0x3f800000;
_DAT_00c80c2c = 0;
_DAT_00c80c30 = 0;
_DAT_00c80c44 = 0;
uRam00c80c48 = 0;
uRam00c80c4c = 0;
uRam00c80c50 = 0;
_DAT_00c80c54 = 0x3e20a0a1;
_DAT_00c80c34 = 0x3f5cdcde;
uRam00c80c38 = 0x3e70f0f2;
uRam00c80c3c = 0x3e70f0f2;
uRam00c80c40 = 0x3f800000;
_DAT_00c80c58 = 0;
_DAT_00c80c5c = 0;
_DAT_00c80c70 = 0;
uRam00c80c74 = 0;
uRam00c80c78 = 0;
uRam00c80c7c = 0;
_DAT_00c80c80 = 0;
_DAT_00c80c60 = 0x3f70f0f2;
uRam00c80c64 = 0x3f48c8ca;
uRam00c80c68 = 0x3f48c8ca;
uRam00c80c6c = 0x3f800000;
_DAT_00c80c84 = 0;
_DAT_00c80c88 = 0;
_DAT_00c80c9c = 0;
uRam00c80ca0 = 0;
uRam00c80ca4 = 0;
uRam00c80ca8 = 0;
_DAT_00c80cac = 0x3e8c8c8d;
_DAT_00c80c8c = 0x3f800000;
uRam00c80c90 = 0x3f4dcdcf;
uRam00c80c94 = 0x3f4dcdcf;
uRam00c80c98 = 0x3f800000;
_DAT_00c80cb0 = 0;
_DAT_00c80cb4 = 0;
_Init_thread_footer(&DAT_00c80ba8);
}
fVar18 = (this->_pos).y - (this->_prevPosition).y;
fVar20 = (this->_pos).x - (this->_prevPosition).x;
fVar18 = sqrtf(fVar18 * fVar18 + fVar20 * fVar20);
fVar18 = (fVar18 * 0.02) / this->_speedMultiplier;
if (fVar18 <= 0.0) {
fVar18 = 0.0;
}
if (1.0 <= fVar18) {
fVar18 = 1.0;
}
color = (ColorMod *)
(&DAT_00c80bb0 + (GHIDRA_UINT((g_game->_frameCount - this->_spawnFrame)) % 6) * 0x2c);
::(GHIDRA_CAST<Color *>((&defaultColor)))->Color::Color();
color = ::Color::Lerp(&bleedFlashColor,from,color,fVar18);
this->SetColor(color,1,0xff,0,1);
pfStack_30c = *GHIDRA_CAST<float **>(&this->_flags);
pfVar16 = *GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4));
}
if ((0 < this->_magnetizedCountdown) &&
(iVar7 = this->_magnetizedCountdown + -1, this->_magnetizedCountdown = iVar7, iVar7 < 1)) {
pfVar16 = GHIDRA_CAST<float *>((GHIDRA_UINT(pfVar16) & 0xfff7ffff));
*GHIDRA_CAST<float **>(&this->_flags) = pfStack_30c;
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar16;
}
local_320 = GHIDRA_CAST<ItemPool *>(pfStack_30c);
if ((0 < this->_baitedCountdown) &&
(iVar7 = this->_baitedCountdown + -1, this->_baitedCountdown = iVar7, iVar7 < 1)) {
pfVar16 = GHIDRA_CAST<float *>((GHIDRA_UINT(pfVar16) & 0xffefffff));
*GHIDRA_CAST<float **>(&this->_flags) = pfStack_30c;
game = g_game;
fVar18 = 0.0;
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar16;
local_304 = game->_room;
if (local_304[0x499] != 0.0) {
do {
iVar7 = *GHIDRA_CAST<int *>((GHIDRA_INT(local_304[0x497]) + GHIDRA_INT(fVar18) * 4));
if (((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (*GHIDRA_CAST<int *>((iVar7 + 0x28)) == 1)) ||
(*GHIDRA_CAST<int *>((iVar7 + 0x28)) - 10U < 0x3de)) {
local_310 = GHIDRA_CAST<float *>((iVar7 + 0x3c4));
if ((*GHIDRA_CAST<Entity **>((iVar7 + 0x3c4)) == this) &&
((*GHIDRA_CAST<uint32_t *>((iVar7 + 0x168)) & 0x20000100) == 0)) {
if (*GHIDRA_CAST<Entity **>((iVar7 + 0x3c4)) != GHIDRA_CAST<Entity *>(0x0)) {
pvStack_2bc = (void *)(iVar7 + 0x3c4);
msvc::multiset<unsigned_int>::erase(&pvStack_2bc);
}
*local_310 = 0.0;
}
}
fVar18 = (float)(GHIDRA_INT(fVar18) + 1);
} while (GHIDRA_UINT(fVar18) < GHIDRA_UINT(local_304[0x499]));
local_320 = *GHIDRA_CAST<ItemPool **>(&this->_flags);
pfVar16 = *GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4));
}
}
if ((0 < this->_weaknessCountdown) &&
(iVar7 = this->_weaknessCountdown + -1, this->_weaknessCountdown = iVar7, iVar7 < 1)) {
pfVar16 = GHIDRA_CAST<float *>((GHIDRA_UINT(pfVar16) & 0xffbfffff));
*GHIDRA_CAST<ItemPool **>(&this->_flags) = local_320;
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar16;
}
local_2c8.x = (float)local_320;
if ((this->_iceFrozenEffect != 0) && ((GHIDRA_UINT(pfVar16) & 0x80000) == 0)) {
(**(code **)(*GHIDRA_CAST<int *>(this->_iceFrozenEffect) + 0x28))();
local_320 = *GHIDRA_CAST<ItemPool **>(&this->_flags);
pfVar16 = *GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4));
}
if ((0 < this->_knockbackCountdown) &&
(iVar7 = this->_knockbackCountdown + -1, this->_knockbackCountdown = iVar7, iVar7 < 1)) {
pfVar16 = GHIDRA_CAST<float *>((GHIDRA_UINT(pfVar16) & 0xfffe7fff));
*GHIDRA_CAST<ItemPool **>(&this->_flags) = local_320;
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar16;
}
if ((0 < this->_iceCountdown) &&
(iVar7 = this->_iceCountdown + -1, this->_iceCountdown = iVar7, iVar7 < 1)) {
pfVar16 = GHIDRA_CAST<float *>((GHIDRA_UINT(pfVar16) & 0xfffbffff));
*GHIDRA_CAST<ItemPool **>(&this->_flags) = local_320;
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar16;
}
if ((0 < this->_brimstoneMarkCountdown) &&
(iVar7 = this->_brimstoneMarkCountdown + -1, this->_brimstoneMarkCountdown = iVar7, iVar7 < 1
)) {
pfVar16 = GHIDRA_CAST<float *>((GHIDRA_UINT(pfVar16) & 0xfeffffff));
*GHIDRA_CAST<ItemPool **>(&this->_flags) = local_320;
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar16;
}
if (0 < this->_bossStatusEffectCooldown) {
this->_bossStatusEffectCooldown = this->_bossStatusEffectCooldown + -1;
}
local_318 = GHIDRA_CAST<float *>(local_320);
local_314 = GHIDRA_CAST<float *>(local_320);
if (0 < this->_holdCountdown) {
this->_holdCountdown = this->_holdCountdown + -1;
}
}
if ((GHIDRA_UINT(local_318) & 0x4000) == 0) {
if (this->_isInvicible == 0) {
pfVar16 = *GHIDRA_CAST<float **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8))));
local_319 = 0;
local_284 = g_vectorZero.x;
local_280 = g_vectorZero.y;
local_27c = g_vectorZero.x;
fStack_278 = g_vectorZero.y;
fatalDamage = 0.0;
local_290 = fatalDamage;
local_28c = fatalDamage;
local_288 = fatalDamage;
fStack_274 = fatalDamage;
fStack_270 = fatalDamage;
if (pfVar16 != *GHIDRA_CAST<float **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc))))) {
local_320 = GHIDRA_CAST<ItemPool *>((pfVar16 + 0xb));
do {
if (0.0 < *pfVar16) {
if ((GHIDRA_UINT(g_game->_debugFlags) >> 6 & 1) != 0) {
(GHIDRA_CAST<KColor *>((&debugTextColor)))->KColor::SetFromARGB(0xff90ee90);
spawn_debug_damage_text();
}
manager = g_manager;
local_2c8.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(local_320) + -0x20));
if (((GHIDRA_UINT(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(local_320) + -0x24))) & 0x202) != 0) &&
((GHIDRA_UINT(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(local_320) + -0x24))) & 4) == 0)) {
hitSoundId = 0x2b;
seed_fart_sound_override(&hitSoundId);
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(hitSoundId,1.0,2,0,1.0,0.0);
this = self;
}
fVar18 = (GHIDRA_CAST<Entity_Tear *>(this))->_health - *pfVar16;
(GHIDRA_CAST<Entity_Tear *>(this))->_health = fVar18;
if ((0.0 < fVar18) || ((GHIDRA_UINT(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(local_320) + -0x24))) & 1) != 0)) {
if (((GHIDRA_CAST<Entity_Tear *>(this))->_flags & 0x2000000) == 0) {
if (fVar18 < 0.0) {
(GHIDRA_CAST<Entity_Tear *>(this))->_health = 0.0;
}
if (((GHIDRA_CAST<Entity_Tear *>(this))->_type == 0x197) ||
((GHIDRA_CAST<Entity_Tear *>(this))->_type == 0x3b7)) {
uStack_a4 = 0x3ec8c8ca;
uStack_b4 = 0;
uStack_b0 = 0;
uStack_ac = 0;
uStack_a8 = 0;
uStack_a0 = 0;
hushBeastHitColor = 0x3f000000;
uStack_c0 = 0x3f000000;
uStack_bc = 0x3ea8f5c3;
uStack_b8 = 0x3f800000;
uStack_9c = 0;
iVar7 = (GHIDRA_INT((*pfVar16 + 0.5)) + 2) / 3;
iVar14 = 6;
if (iVar7 < 6) {
iVar14 = iVar7;
}
if (iVar14 < 1) {
iVar14 = 1;
}
hitFlashColor = &hushBeastHitColor;
}
else {
uStack_d0 = 0x3f48c8ca;
uStack_e0 = 0;
uStack_dc = 0;
uStack_d8 = 0;
uStack_d4 = 0;
uStack_cc = 0;
hitColor = 0x3f000000;
uStack_ec = 0x3f000000;
uStack_e8 = 0x3f000000;
uStack_e4 = 0x3f800000;
uStack_c8 = 0;
iVar7 = (GHIDRA_INT((*pfVar16 + 0.5)) + 2) / 3;
iVar14 = 6;
if (iVar7 < 6) {
iVar14 = iVar7;
}
if (iVar14 < 1) {
iVar14 = 1;
}
hitFlashColor = &hitColor;
}
this->SetColor(hitFlashColor,iVar14,0,0,0);
}
}
else {
fatalDamage = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(local_320) + -0x1c));
local_290 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(local_320) + -0x18));
local_28c = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(local_320) + -0x14));
local_288 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(local_320) + -0x10));
local_284 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(local_320) + -0xc));
local_280 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(local_320) + -8));
local_27c = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(local_320) + -4));
fStack_278 = *GHIDRA_CAST<float *>(local_320);
fStack_274 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(local_320) + 4));
fStack_270 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(local_320) + 8));
local_319 = 1;
}
}
pfVar16 = pfVar16 + 0xe;
local_320 = GHIDRA_CAST<ItemPool *>((GHIDRA_INT(local_320) + 0x38));
} while (pfVar16 != *GHIDRA_CAST<float **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<Entity_Tear *>(this)))) + 0xc)))));
if (local_319 != 0) {
this->Kill(&fatalDamage);
}
}
}
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<Entity_Tear *>(this)))) + 0xc)))) =
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<Entity_Tear *>(this)))) + 0x8))));
(GHIDRA_CAST<Entity_Tear *>(this))->_pendingDamage = 0.0;
*GHIDRA_CAST<uint32_t *>(&(GHIDRA_CAST<Entity_Tear *>(this))->_pendingDamageFlags) = 0;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(GHIDRA_CAST<Entity_Tear *>(this))->_pendingDamageFlags) + 4)) = 0;
local_318 = *GHIDRA_CAST<float **>(&(GHIDRA_CAST<Entity_Tear *>(this))->_flags);
pfVar16 = *GHIDRA_CAST<float **>((GHIDRA_INT(&(GHIDRA_CAST<Entity_Tear *>(this))->_flags) + 4));
}
if ((GHIDRA_UINT(local_318) & 0x4000) == 0) {
if (((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && ((GHIDRA_CAST<Entity_Tear *>(this))->_type == 1)) ||
((GHIDRA_CAST<Entity_Tear *>(this))->_type - 10U < 0x3de)) {
local_308 = GHIDRA_CAST<Entity_Tear *>(&DAT_00000014);
if (((GHIDRA_UINT(local_318) & 0x40) != 0) &&
(iVar7 = (GHIDRA_CAST<Entity_Tear *>(this))->_poisonDamageTimer,
(GHIDRA_CAST<Entity_Tear *>(this))->_poisonDamageTimer = iVar7 + 1, iVar7 % 0x14 == 1)) {
uStack_78 = 0;
uStack_88 = 0;
uStack_84 = 0;
uStack_80 = 0;
uStack_7c = 0;
poisonColor = 0x3dcccccd;
uStack_94 = 0x3f000000;
uStack_90 = 0x3dcccccd;
uStack_8c = 0x3f800000;
uStack_74 = 0x3f000000;
uStack_70 = 0;
this->SetColor(&poisonColor,2,0xff,0,1);
sourceRef = (GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>((local_1f8 + 0x14)))))->EntityRef::EntityRef();
(**(code **)(*GHIDRA_CAST<int *>(this) + 0x20))
((GHIDRA_CAST<Entity_Tear *>(this))->_poisonTickDamage,0x8000,0,sourceRef);
local_318 = *GHIDRA_CAST<float **>(&(GHIDRA_CAST<Entity_Tear *>(this))->_flags);
pfVar16 = *GHIDRA_CAST<float **>((GHIDRA_INT(&(GHIDRA_CAST<Entity_Tear *>(this))->_flags) + 4));
}
VStack_2d8.x = (float)local_318;
if ((GHIDRA_UINT(local_318) & 0x1000) != 0) {
iVar7 = (GHIDRA_CAST<Entity_Tear *>(this))->_burnDamageTimer;
(GHIDRA_CAST<Entity_Tear *>(this))->_burnDamageTimer = iVar7 + 1;
if (iVar7 % GHIDRA_INT(local_308) == 1) {
uStack_4c = 0x3f000000;
uStack_5c = 0;
uStack_58 = 0;
uStack_54 = 0;
uStack_50 = 0;
burnColor = 0x3f000000;
uStack_68 = 0x3e99999a;
uStack_64 = 0x3dcccccd;
uStack_60 = 0x3f800000;
uStack_48 = 0x3e99999a;
uStack_44 = 0;
this->SetColor(&burnColor,2,0xff,0,1);
sourceRef = (GHIDRA_CAST<EntityRef *>((&burnSourceRef)))->EntityRef::EntityRef();
(**(code **)(*GHIDRA_CAST<int *>(this) + 0x20))
((GHIDRA_CAST<Entity_Tear *>(this))->_burnTickDamage,0x8000,0,sourceRef);
VStack_2d8.x = *GHIDRA_CAST<float *>(&(GHIDRA_CAST<Entity_Tear *>(this))->_flags);
pfVar16 = *GHIDRA_CAST<float **>((GHIDRA_INT(&(GHIDRA_CAST<Entity_Tear *>(this))->_flags) + 4));
}
}
if (((GHIDRA_UINT(pfVar16) & 4) != 0) &&
(bVar5 = IsDescendantOf(this,((GHIDRA_CAST<Entity_Tear *>(this))->_entityRef2)._entity), bVar5 == 0)) {
fVar18 = ((GHIDRA_CAST<Entity_Tear *>(this))->_pos).y - ((GHIDRA_CAST<Entity_Tear *>(this))->_prevPosition).y;
fVar20 = ((GHIDRA_CAST<Entity_Tear *>(this))->_pos).x - ((GHIDRA_CAST<Entity_Tear *>(this))->_prevPosition).x;
fVar18 = sqrtf(fVar18 * fVar18 + fVar20 * fVar20);
game = g_game;
local_310 = GHIDRA_CAST<float *>((fVar18 * (GHIDRA_CAST<Entity_Tear *>(this))->_speedMultiplier * 0.02 +
(GHIDRA_CAST<Entity_Tear *>(this))->_bleedDamageAccumulator));
(GHIDRA_CAST<Entity_Tear *>(this))->_bleedDamageAccumulator = (float)local_310;
iVar7 = game->_stageType;
if ((iVar7 == 4) || (iVar7 == 5)) {
iVar7 = g_game->_stage + 1;
}
else {
iVar7 = game->_stage;
}
local_304 = GHIDRA_CAST<float *>(((float)iVar7 * 0.3 + 2.8));
pfStack_2f4 = local_310;
dVar23 = floor((double)(float)local_310);
local_308 = GHIDRA_CAST<Entity_Tear *>((float)dVar23);
if (*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2) {
pfVar16 = local_304;
}
else {
pfVar16 = GHIDRA_CAST<float *>(0x3f800000);
}
pEVar19 = local_308;
if (10.0 <= (float)local_308) {
pEVar19 = GHIDRA_CAST<Entity_Tear *>(0x41200000);
}
(GHIDRA_CAST<Entity_Tear *>(this))->_bleedDamageAccumulator = (float)pfStack_2f4 - (float)local_308;
fVar18 = (float)pEVar19 * (float)pfVar16;
if (0.0 < fVar18) {
sourceRef = (GHIDRA_CAST<EntityRef *>((&bleedSourceRef)))->EntityRef::EntityRef();
this->TakeDamage(fVar18,0,0,sourceRef,0x1e);
local_310 = GHIDRA_CAST<float *>(0x0);
if (0.0 < (float)local_308) {
do {
VStack_2d8.x = ((((GHIDRA_CAST<Entity_Tear *>(this))->_prevPosition).x -
((GHIDRA_CAST<Entity_Tear *>(this))->_pos).x) * (float)local_310) /
(float)local_308 + ((GHIDRA_CAST<Entity_Tear *>(this))->_pos).x;
VStack_2d8.y = ((((GHIDRA_CAST<Entity_Tear *>(this))->_prevPosition).y -
((GHIDRA_CAST<Entity_Tear *>(this))->_pos).y) * (float)local_310) /
(float)local_308 + ((GHIDRA_CAST<Entity_Tear *>(this))->_pos).y;
pfStack_2f4 = GHIDRA_CAST<float *>(Random());
pGStack_2f8 = g_game;
local_318 = GHIDRA_CAST<float *>(0x0);
spawnVariant = 0x2e;
local_314 = GHIDRA_CAST<float *>(0x3e8);
lua_callback_run_pre_entity_spawn
(GHIDRA_CAST<int *>(&local_314),GHIDRA_CAST<int *>(&spawnVariant),&VStack_2d8,&g_vectorZero,
GHIDRA_CAST<Entity *>(0x0),GHIDRA_CAST<int *>(&local_318),GHIDRA_CAST<uint32_t *>(&pfStack_2f4));
if (*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2) {
LAB_006b0194:
local_320 = GHIDRA_CAST<ItemPool *>(local_318);
}
else {
pfStack_30c = *GHIDRA_CAST<float **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&((g_game->_deathmatchManager))) + 0xc))));
uVar13 = Random();
pfVar16 = local_318;
uStack_2ac = 0x900000005;
pEStack_2fc = GHIDRA_CAST<Entity *>(&DAT_00000007);
uStack_2a4 = 7;
uStack_300 = uVar13;
if (local_314 != GHIDRA_CAST<float *>(&DAT_00000005)) goto LAB_006b0194;
if (spawnVariant < 0x12d) {
if (spawnVariant == 300) {
while ((local_320 = GHIDRA_CAST<ItemPool *>(local_318), local_318 == GHIDRA_CAST<float *>(0x0) ||
(cVar6 = (**(code **)(GHIDRA_INT(*pfStack_30c) + 0x24))(local_318),
cVar6 != '\0'))) {
if (uStack_300 == 0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
pcVar2 = (code *)swi(3);
(*pcVar2)();
return;
}
uStack_300 = uStack_300 >> ((uint8_t)uStack_2ac & 0x1f) ^ uStack_300;
uStack_300 = uStack_300 << ((uint8_t)((uint64_t)uStack_2ac >> 0x20) & 0x1f) ^
uStack_300;
uVar13 = uStack_300 >> ((uint8_t)pEStack_2fc & 0x1f) ^ uStack_300;
uStack_300 = uVar13;
iVar7 = ItemPool::GetCardEx(uVar13,0x19,10,10,1);
cardRng._shift1 = 5;
cardRng._shift2 = 9;
cardRng._shift3 = 7;
cardRng._seed = uVar13;
local_318 = GHIDRA_CAST<float *>(lua_callback_run_get_card(&cardRng,iVar7,1,1,0));
}
}
else {
if (spawnVariant == 0x46) {
uStack_2d0 = GHIDRA_UINT(local_318) >> 0xb;
do {
if (local_318 != GHIDRA_CAST<float *>(0x0)) {
pcVar2 = *(code **)(GHIDRA_INT(*pfStack_30c) + 0x28);
local_320 = GHIDRA_CAST<ItemPool *>(local_318);
iVar7 = ItemPool::GetPillEffect
(&g_game->_itemPool,GHIDRA_UINT(local_318),GHIDRA_CAST<Entity_Player *>(0x0)
);
cVar6 = (*pcVar2)(iVar7);
if (cVar6 == '\0') goto LAB_006b019c;
uVar13 = uStack_300;
}
local_320 = &g_game->_itemPool;
if (uVar13 == 0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
pcVar2 = (code *)swi(3);
(*pcVar2)();
return;
}
uVar13 = uVar13 >> ((uint8_t)uStack_2ac & 0x1f) ^ uVar13;
uVar13 = uVar13 << ((uint8_t)((uint64_t)uStack_2ac >> 0x20) & 0x1f) ^ uVar13;
uVar13 = uVar13 >> ((uint8_t)pEStack_2fc & 0x1f) ^ uVar13;
uStack_300 = uVar13;
uVar10 = ItemPool::GetPill(uVar13);
local_318 = GHIDRA_CAST<float *>((uVar10 | (uStack_2d0 & 1) << 0xb));
} while( true );
}
if (spawnVariant != 100) goto LAB_006b0194;
local_320 = GHIDRA_CAST<ItemPool *>(local_318);
if (local_318 == GHIDRA_CAST<float *>(0x19)) {
LAB_006affca:
bVar17 = false;
}
else {
pfStack_2b8 = local_318;
msvc::set<int>::find_node(auStack_24c,&pfStack_2b8);
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(fStack_244) + 0xd)) == '\0') &&
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(fStack_244) + 0x10)) <= GHIDRA_INT(pfVar16))) &&
(fStack_244 != pfStack_30c[8])) goto LAB_006affca;
bVar17 = true;
}
if ((pfVar16 == GHIDRA_CAST<float *>(0x0)) || (bVar17)) {
local_320 = GHIDRA_CAST<ItemPool *>((**(code **)(GHIDRA_INT(*pfStack_30c) + 0x84))(0));
local_318 = GHIDRA_CAST<float *>(local_320);
}
}
}
else {
if (spawnVariant != 0x15e) goto LAB_006b0194;
while ((local_320 = GHIDRA_CAST<ItemPool *>(local_318), local_318 == GHIDRA_CAST<float *>(0x0) ||
(cVar6 = (**(code **)(GHIDRA_INT(*pfStack_30c) + 0x2c))(local_318), cVar6 != '\0')
)) {
local_318 = GHIDRA_CAST<float *>(ItemPool)::GetTrinket(&g_game->_itemPool,0);
}
}
}
LAB_006b019c:
pEStack_2fc = (GHIDRA_CAST<EntityFactory *>((pGStack_2f8->_entityFactory)))->EntityFactory::Create(GHIDRA_UINT(local_314),0);
lVar3 = CONCAT44(pGStack_2f8,pfStack_2f4);
if (pEStack_2fc == GHIDRA_CAST<Entity *>(0x0)) {
tmpEntity = GHIDRA_CAST<Entity *>(0x0);
}
else {
uVar22 = GetTimeNs();
tmpEntity = pEStack_2fc;
uVar10 = GHIDRA_UINT((uVar22 >> 0x20));
lVar3 = (uVar22 & 0xffffffff) * 0x431bde82;
apiStack_2f0[0] = GHIDRA_CAST<int *>(((uint64_t)lVar3 >> 0x20));
uVar22 = (uint64_t)uVar10 * 0xd7b634db +
((uVar22 & 0xffffffff) * 0xd7b634db >> 0x20);
uVar11 = GHIDRA_UINT((uVar22 >> 0x20));
lVar3 = lVar3 + (uVar22 & 0xffffffff);
uStack_2d0 = GHIDRA_UINT(lVar3);
uVar13 = GHIDRA_UINT(((uint64_t)lVar3 >> 0x20));
lVar3 = (uint64_t)uVar10 * 0x431bde82 +
(uint64_t)CONCAT14(CARRY4(uVar11,uVar13),uVar11 + uVar13);
uVar13 = GHIDRA_UINT(((uint64_t)lVar3 >> 0x20));
uStack_300 = GHIDRA_UINT(lVar3) >> 0x12 | uVar13 * 0x4000;
pfStack_30c = GHIDRA_CAST<float *>((uVar13 >> 0x12));
hitFlashColor = &pEStack_2fc->_spawnerEntity;
pEStack_2fc->_spawnerType = 0;
pEStack_2fc->_spawnerVariant = 0;
if (*hitFlashColor != 0) {
apiStack_2e0[0] = hitFlashColor;
msvc::multiset<unsigned_int>::erase(apiStack_2e0);
}
iVar7 = *GHIDRA_CAST<int *>(tmpEntity);
*hitFlashColor = 0;
(tmpEntity->_pos).x = VStack_2d8.x;
(tmpEntity->_pos).y = VStack_2d8.y;
(tmpEntity->_velocity).x = g_vectorZero.x;
(tmpEntity->_velocity).y = g_vectorZero.y;
(**(code **)(iVar7 + 4))(local_314,spawnVariant,local_320,pfStack_2f4);
pvVar15 = pGStack_2f8->_room;
iVar7 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar15) + 0x1214));
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar15) + 0x1214)) = iVar7 + 1;
tmpEntity->_index = iVar7;
(GHIDRA_CAST<EntityList *>((GHIDRA_CAST<EntityList *>((GHIDRA_INT(pvVar15) + 0x1218)))))->EntityList::AddEntity(tmpEntity);
bVar5 = Game::ShouldEraseEnemy(tmpEntity);
if (bVar5 != 0) {
RemoveWithPoof(tmpEntity,unusedArg);
}
if ((tmpEntity->_exists != 0) &&
((pGStack_2f8->_proceduralItemManager)._proceduralItems._begin !=
(pGStack_2f8->_proceduralItemManager)._proceduralItems._end)) {
triggerKeyVariant = tmpEntity->_variant;
iVar7 = tmpEntity->_type;
spawnTriggerTargets = &(pGStack_2f8->_proceduralItemManager)._spawnTriggerTargets;
triggerKeyType = iVar7;
msvc::map<unsigned_long_long>::find(&local_304,&triggerKeyType);
if (local_304 == spawnTriggerTargets->_head) {
anyVariantKey[1] = 0xffffffff;
anyVariantKey[0] = iVar7;
piVar9 = GHIDRA_CAST<int *>(std)::map<unsigned_long_long>::find(auStack_250,anyVariantKey);
local_304 = GHIDRA_CAST<float *>(*piVar9);
if (local_304 == spawnTriggerTargets->_head) goto LAB_006b0415;
}
uVar13 = 0;
playerManager = &g_game->_playerManager;
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) -
GHIDRA_INT((playerManager->_playerList)._begin) >> 2 != 0) {
do {
pvVar15 = (playerManager->_playerList)._end;
if (GHIDRA_INT(pvVar15) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) {
KAGE_LogMessage(0x10,(uint8_t *)
"(GHIDRA_CAST<PlayerManager *>(()))->PlayerManager::GetPlayer() : There are no players! \n"
);
pvVar15 = (playerManager->_playerList)._end;
}
piVar9 = (playerManager->_playerList)._begin;
if (uVar13 < GHIDRA_UINT((GHIDRA_INT(pvVar15) - GHIDRA_INT(piVar9) >> 2))) {
piVar9 = piVar9 + uVar13;
}
trigger_set_dispatch
((void *)(*piVar9 + 0x1fc8),6,pEStack_2fc,&VStack_2d8,&g_vectorZero)
;
uVar13 = uVar13 + 1;
playerManager = &g_game->_playerManager;
} while (uVar13 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
GHIDRA_INT((playerManager->_playerList)._begin) >> 2)));
}
}
LAB_006b0415:
uVar22 = GetTimeNs();
uVar13 = GHIDRA_UINT((uVar22 >> 0x20));
lVar4 = (uVar22 & 0xffffffff) * 0x431bde82;
uStack_2d0 = GHIDRA_UINT(((uint64_t)lVar4 >> 0x20));
lVar3 = (uint64_t)uVar13 * 0x431bde82;
uVar22 = (uint64_t)uVar13 * 0xd7b634db +
((uVar22 & 0xffffffff) * 0xd7b634db >> 0x20);
uVar10 = GHIDRA_UINT((uVar22 >> 0x20));
lVar4 = lVar4 + (uVar22 & 0xffffffff);
apiStack_2f0[0] = GHIDRA_CAST<int *>(lVar4);
uVar13 = GHIDRA_UINT(((uint64_t)lVar4 >> 0x20));
lVar4 = lVar3 + (uint64_t)CONCAT14(CARRY4(uVar10,uVar13),uVar10 + uVar13);
uVar11 = GHIDRA_UINT(((uint64_t)lVar4 >> 0x20));
uVar13 = GHIDRA_UINT(lVar4) >> 0x12 | uVar11 * 0x4000;
uVar10 = uVar13 - uStack_300;
bVar17 = CARRY4(GHIDRA_UINT(g_entitySpawnTimeMs),uVar10);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(g_entitySpawnTimeMs)) + 0x0))) = GHIDRA_UINT(g_entitySpawnTimeMs) + uVar10;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(g_entitySpawnTimeMs)) + 0x4))) =
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(g_entitySpawnTimeMs)) + 0x4))) +
(((uVar11 >> 0x12) - GHIDRA_INT(pfStack_30c)) - GHIDRA_UINT((uVar13 < uStack_300))) +
GHIDRA_UINT(bVar17);
tmpEntity = pEStack_2fc;
this = self;
}
pGStack_2f8 = GHIDRA_CAST<Game *>(((uint64_t)lVar3 >> 0x20));
pfStack_2f4 = GHIDRA_CAST<float *>(lVar3);
uVar13 = GetHitListIndex(this);
sorted_vector_insert_unique(&tmpEntity[1]._sprite._overlayAnimState,uVar13);
uVar13 = Random();
iVar7 = *GHIDRA_CAST<int *>(tmpEntity);
fVar20 = (float)((double)GHIDRA_INT(uVar13) + __uint_to_double_fixup[-(GHIDRA_INT(uVar13) >> 0x1f)])
* 2.3283064e-10 * 0.5 + 0.2;
fVar18 = fVar20 * g_vectorOne.x;
(tmpEntity->_sprite)._scale.y = fVar20 * g_vectorOne.y;
(tmpEntity->_sprite)._scale.x = fVar18;
(**(code **)(iVar7 + 0xc))();
uVar13 = Random();
tmpEntity = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,7,&VStack_2d8,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,
uVar13,0);
tmpEntity->Update();
uVar13 = Random();
uVar10 = Random();
uVar11 = Random();
fVar18 = (float)((double)GHIDRA_INT(uVar11) + __uint_to_double_fixup[-(GHIDRA_INT(uVar11) >> 0x1f)])
* 2.3283064e-10 * 3.14;
apiStack_2f0[0] = GHIDRA_CAST<int *>((fVar18 + fVar18));
particleVelocity.x = cos((float)apiStack_2f0[0]);
particleVelocity.x = particleVelocity.x * 5.0;
fVar18 = sin((float)apiStack_2f0[0]);
particleVelocity.y = fVar18 * 0.5 * 5.0;
uVar11 = Random();
fVar18 = (float)((double)GHIDRA_INT(uVar11) + __uint_to_double_fixup[-(GHIDRA_INT(uVar11) >> 0x1f)])
* 2.3283064e-10 * 3.14;
apiStack_2f0[0] = GHIDRA_CAST<int *>((fVar18 + fVar18));
fVar18 = cos((float)apiStack_2f0[0]);
local_2c8.x = fVar18 * 0.5 * self->_size + local_2e4->x;
fVar18 = sin((float)apiStack_2f0[0]);
this = self;
local_2c8.y = fVar18 * 0.5 * self->_size + local_2e4->y;
tmpEntity = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,5,&local_2c8,&particleVelocity,self,uVar10 % 3,
uVar13,0);
tmpEntity->Update();
local_310 = GHIDRA_CAST<float *>(((float)local_310 + 1.0));
} while ((float)local_310 < (float)local_308);
}
}
}
}
fVar18 = 1.0;
if (((GHIDRA_CAST<Entity_Tear *>(this))->_dead == 0) &&
(((GHIDRA_CAST<Entity_Tear *>(this))->_flags & 0x8000000000000) != 0)) {
bVar5 = DoesEntityShareStatus(this);
if ((bVar5 != 0) &&
(pEVar19 = GHIDRA_CAST<Entity_Tear *>((GHIDRA_CAST<Entity_Tear *>(this))->_parent),
GHIDRA_CAST<Entity_Tear *>((GHIDRA_CAST<Entity_Tear *>(this))->_parent) != GHIDRA_CAST<Entity_Tear *>(0x0))) {
do {
pEVar8 = pEVar19;
pEVar19 = GHIDRA_CAST<Entity_Tear *>(pEVar8->_parent);
} while (pEVar19 != GHIDRA_CAST<Entity_Tear *>(0x0));
if (pEVar8 != GHIDRA_CAST<Entity_Tear *>(this)) goto LAB_006b0a5d;
}
local_304 = GHIDRA_CAST<float *>(0x0);
pvStack_2bc = g_game->_room;
pGStack_2f8 = GHIDRA_CAST<Game *>(fVar18);
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvStack_2bc) + 0x1264)) != 0) {
do {
pEVar19 = *GHIDRA_CAST<Entity_Tear **>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvStack_2bc) + 0x125c)) + GHIDRA_INT(local_304) * 4));
local_308 = pEVar19;
bVar5 = DoesEntityShareStatus(GHIDRA_CAST<Entity *>(pEVar19));
if (bVar5 != 0) {
pEVar8 = GHIDRA_CAST<Entity_Tear *>(pEVar19->_parent);
local_308 = pEVar19;
if (GHIDRA_CAST<Entity_Tear *>(pEVar19->_parent) != GHIDRA_CAST<Entity_Tear *>(0x0)) {
do {
local_308 = pEVar8;
pEVar8 = GHIDRA_CAST<Entity_Tear *>(local_308->_parent);
} while (GHIDRA_CAST<Entity_Tear *>(local_308->_parent) != GHIDRA_CAST<Entity_Tear *>(0x0));
this = self;
}
}
pEVar8 = GHIDRA_CAST<Entity_Tear *>(GetStatusEffectTarget(this));
if ((((pEVar8 != local_308) &&
((*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2 ||
(bVar5 = IsDescendantOf(GHIDRA_CAST<Entity *>(pEVar19),
((GHIDRA_CAST<Entity_Tear *>(this))->_entityRef3)._entity), bVar5 == 0)))
) && ((bVar5 = IsVulnerableEnemy(GHIDRA_CAST<Entity *>(pEVar19),GHIDRA_CAST<Entity *>(0x0)), bVar5 != 0 ||
((((iVar7 = pEVar19->_type, iVar7 == 9 || (iVar7 == 2)) || (iVar7 == 4)) ||
(((iVar7 == 5 && ((pEVar19->_tearHaloANM2)._numNullLayers == 0)) &&
((bVar5 = Entity_Pickup::IsChest(pEVar19->_variant), bVar5 == 0 ||
(pEVar19->_subtype != 0)))))))))) && (pEVar19 != GHIDRA_CAST<Entity_Tear *>(this))) {
fVar18 = (pEVar19->_pos).x;
fVar20 = ((GHIDRA_CAST<Entity_Tear *>(this))->_pos).x;
if (((fVar18 != fVar20) || ((pEVar19->_pos).y != ((GHIDRA_CAST<Entity_Tear *>(this))->_pos).y)) &&
(pEVar19->_friction != 0.0)) {
local_308 = GHIDRA_CAST<Entity_Tear *>((fVar20 - fVar18));
pEStack_2fc = GHIDRA_CAST<Entity *>((((GHIDRA_CAST<Entity_Tear *>(this))->_pos).y - (pEVar19->_pos).y));
local_2e4 = (Vector *)
((float)pEStack_2fc * (float)pEStack_2fc +
(float)local_308 * (float)local_308);
if ((float)local_2e4 < 65536.0) {
local_310 = GHIDRA_CAST<float *>(sqrtf((float)local_2e4));
fVar18 = sqrtf((float)local_2e4);
tmpEntity = self;
if (0.0 < fVar18) {
local_308 = GHIDRA_CAST<Entity_Tear *>(((float)local_308 * (1.0 / fVar18)));
pEStack_2fc = GHIDRA_CAST<Entity *>(((float)pEStack_2fc * (1.0 / fVar18)));
}
pushStrength = &DAT_42000000;
iVar7 = pEVar19->_type;
if ((((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (iVar7 == 1)) ||
(iVar7 - 10U < 0x3de)) || ((iVar7 == 2 || (iVar7 == 4)))) {
pushStrength = GHIDRA_CAST<uint8_t *>(0x42a00000);
}
if ((((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (iVar7 == 1)) ||
((iVar7 - 10U < 0x3de || (iVar7 == 4)))) &&
((float)local_310 < pEVar19->_size + (GHIDRA_CAST<Entity_Tear *>(this))->_size + 16.0)) {
pGStack_2f8 = GHIDRA_CAST<Game *>(((float)pGStack_2f8 * 0.8));
}
if (8.0 <= (float)local_310) {
fVar18 = 1.0 / (float)local_310;
}
else {
fVar18 = (float)local_310 * 0.015625;
}
if (iVar7 == 9) {
apiStack_2f0[0] = GHIDRA_CAST<int *>(0x3f000000);
fVar20 = (float)(g_game->_frameCount - pEVar19->_spawnFrame) / 30.0;
if (1.0 <= fVar20) {
fVar20 = 1.0;
}
fVar20 = fVar20 * fVar18;
pfVar16 = GHIDRA_CAST<float *>((((float)pushStrength * fVar20) / pEVar19->_friction));
apiStack_2e0[0] = GHIDRA_CAST<int *>((1.0 - (fVar20 + fVar20)));
ppiVar12 = apiStack_2e0;
if ((float)apiStack_2e0[0] <= 0.5) {
ppiVar12 = apiStack_2f0;
}
piVar9 = *ppiVar12;
(pEVar19->_velocity).y = (float)piVar9 * (pEVar19->_velocity).y;
(pEVar19->_velocity).x = (float)piVar9 * (pEVar19->_velocity).x;
if ((0.3 < fVar20) &&
(pEVar19->_fallingAccel <= 0.0 && pEVar19->_fallingAccel != 0.0)) {
pEVar19->_fallingAccel = 0.0;
}
if ((((pEVar19->_dead == 0) &&
((float)local_2e4 <
(GHIDRA_CAST<Entity_Tear *>(this))->_size * (GHIDRA_CAST<Entity_Tear *>(this))->_size)) &&
(0xf < g_game->_frameCount - pEVar19->_spawnFrame)) &&
(-50.0 < pEVar19->_height)) {
pEVar19->_dead = 1;
}
}
else {
local_314 = GHIDRA_CAST<float *>((((float)pushStrength * fVar18) / pEVar19->_friction));
if (iVar7 == 2) {
apiStack_2f0[0] = GHIDRA_CAST<int *>(0x3f000000);
apiStack_2e0[0] = GHIDRA_CAST<int *>((1.0 - (fVar18 + fVar18)));
ppiVar12 = apiStack_2e0;
if ((float)apiStack_2e0[0] <= 0.5) {
ppiVar12 = apiStack_2f0;
}
fVar18 = (float)*ppiVar12 * (pEVar19->_velocity).y;
fVar20 = (float)*ppiVar12 * (pEVar19->_velocity).x;
(pEVar19->_velocity).y = fVar18;
(pEVar19->_velocity).x = fVar20;
local_320 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<ItemPool *>(g_tearFlagOrbit._l))) + 0x4)));
apiStack_2e0[0] =
GHIDRA_CAST<int *>((GHIDRA_UINT((pEVar19->_tearFlags)._h) & GHIDRA_UINT(g_tearFlagOrbit._h)));
apiStack_2f0[0] =
GHIDRA_CAST<int *>((*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(pEVar19->_tearFlags)._h) + 4)) &
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(g_tearFlagOrbit._h))) + 0x4)))));
pfStack_2b8 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(g_tearFlagOrbit._h)) + 0x4)));
uStack_2d0 = GHIDRA_UINT(g_tearFlagOrbit._l);
this = tmpEntity;
if ((((GHIDRA_UINT((pEVar19->_tearFlags)._l) & GHIDRA_UINT(g_tearFlagOrbit._l)) != 0 ||
(*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(pEVar19->_tearFlags)._l) + 4)) &
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(g_tearFlagOrbit._l))) + 0x4)))) != 0) ||
(apiStack_2e0[0] != GHIDRA_CAST<int *>(0x0) || apiStack_2f0[0] != GHIDRA_CAST<int *>(0x0))) &&
(fVar18 * fVar18 + fVar20 * fVar20 < 1.0)) {
newTearFlagsLo = ~GHIDRA_UINT(g_tearFlagOrbit._l) & GHIDRA_UINT((pEVar19->_tearFlags)._l);
local_320 = (ItemPool *)
(~(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(g_tearFlagOrbit._l))) + 0x4))) &
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(pEVar19->_tearFlags)._l) + 4)));
uVar13 = ~GHIDRA_UINT(g_tearFlagOrbit._h) & GHIDRA_UINT((pEVar19->_tearFlags)._h);
uStack_2ac = CONCAT44(uVar13,local_320);
uStack_2a4 = ~(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(g_tearFlagOrbit._h))) + 0x4))) &
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&(pEVar19->_tearFlags)._h) + 4));
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(flags._l)) + 0x4))) = GHIDRA_CAST<float *>(local_320);
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(flags._l)) + 0x0))) = newTearFlagsLo;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(flags._h)) + 0x0))) = uVar13;
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(flags._h)) + 0x4))) = uStack_2a4;
(GHIDRA_CAST<Entity_Tear *>((pEVar19)))->Entity_Tear::SetTearFlags(flags);
}
}
pfVar16 = local_314;
}
(pEVar19->_velocity).x = (float)local_308 * (float)pfVar16 + (pEVar19->_velocity).x;
(pEVar19->_velocity).y =
(float)pEStack_2fc * (float)pfVar16 + (pEVar19->_velocity).y;
}
}
}
local_304 = GHIDRA_CAST<float *>((GHIDRA_INT(local_304) + 1));
} while (local_304 < *GHIDRA_CAST<float **>((GHIDRA_CAST<char *>(pvStack_2bc) + 0x1264)));
}
((GHIDRA_CAST<Entity_Tear *>(this))->_velocity).y =
(float)pGStack_2f8 * ((GHIDRA_CAST<Entity_Tear *>(this))->_velocity).y;
((GHIDRA_CAST<Entity_Tear *>(this))->_velocity).x =
(float)pGStack_2f8 * ((GHIDRA_CAST<Entity_Tear *>(this))->_velocity).x;
}
}
LAB_006b0a5d:
if (((((GHIDRA_CAST<Entity_Tear *>(this))->_flags & 0x4000) == 0) &&
(0.0 < *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(g_game->_room) + 0x7240)))) &&
((((g_manager->_optionsConfig)._enableWaterSurface != 0 &&
(((get_water_splash_variant(this,GHIDRA_CAST<int *>(&local_2c8)),
(GHIDRA_CAST<Entity_Tear *>(this))->_entityCollisionClass != 0 &&
((GHIDRA_CAST<Entity_Tear *>(this))->_entityGridCollisionClass == 5)) ||
((GHIDRA_UINT(local_2c8.x) & 0x80) != 0)))) &&
(fVar18 = ((GHIDRA_CAST<Entity_Tear *>(this))->_velocity).y, fVar20 = ((GHIDRA_CAST<Entity_Tear *>(this))->_velocity).x,
fVar18 = sqrtf(fVar20 * fVar20 + fVar18 * fVar18), 0.01 < fVar18)))) {
iVar7 = 1;
if (1 < GHIDRA_INT((20.0 / fVar18))) {
iVar7 = GHIDRA_INT((20.0 / fVar18));
}
iVar7 = GetIntervalTicks(this,(float)iVar7,0.0);
if (iVar7 != 0) {
uVar13 = Random();
(GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0x85,&(GHIDRA_CAST<Entity_Tear *>(this))->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,
uVar13,0);
}
}
if (10000.0 <= ABS(((GHIDRA_CAST<Entity_Tear *>(this))->_pos).x) + ABS(((GHIDRA_CAST<Entity_Tear *>(this))->_pos).y)) {
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("Invalid entity position detected: %.2f, %.2f (%d.%d.%d)\n"));
}
return;
}
// 006b0eb0
void Entity::Interpolate()
{
Vector *position;
float velocityY;
Vector clampedPos;
uint32_t flagsLow;
Game *game;
float speedMultiplier;
int type;
float velocityX;
float velocityY;
flagsLow = GHIDRA_UINT(this->_flags);
if ((flagsLow & 2) != 0) {
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
*GHIDRA_CAST<uint32_t *>(&this->_flags) = flagsLow & 0xfffffffd;
return;
}
type = this->_type;
position = &this->_pos;
(this->_preInterpolatePos).x = position->x;
(this->_preInterpolatePos).y = (this->_pos).y;
velocityY = this->_friction;
velocityY = (this->_velocity).y;
velocityX = (this->_velocity).x;
speedMultiplier = this->_speedMultiplier;
this->_isInterpolating = 1;
position->x = velocityY * velocityX * speedMultiplier * 0.5 + position->x;
(this->_pos).y = velocityY * velocityY * speedMultiplier * 0.5 + (this->_pos).y;
if (type == 1) {
PlayerCollideWithGrid(this,1);
game = g_game;
if (this->_variant == 1) {
velocityY = this->_size;
Room::GetClampedPositionImpl(g_game->_room,&clampedPos,position,velocityY,velocityY,velocityY,velocityY);
position->x = clampedPos.x;
(this->_pos).y = clampedPos.y;
velocityY = sin(((float)game->_frameCount + 0.5) * 0.2);
(this->_posOffset).y = velocityY + velocityY;
return;
}
}
else {
CollideWithGrid(this,1);
}
return;
}
// 006b1000
int Entity::GetRenderZ()
{
int renderZ;
int clampedZ;
if (this->_sortingLayer == 0) {
renderZ = this->_renderZOffset + 100 + (this->_index & 0x3ffU);
clampedZ = 4999;
if (renderZ < 4999) {
clampedZ = renderZ;
}
renderZ = 0;
if (0 < clampedZ) {
renderZ = clampedZ;
}
return renderZ;
}
if (this->_sortingLayer == 1) {
renderZ = this->_renderZOffset + 0x13ec + (this->_index & 0x3ffU);
clampedZ = 9999;
if (renderZ < 9999) {
clampedZ = renderZ;
}
renderZ = 5000;
if (5000 < clampedZ) {
renderZ = clampedZ;
}
return renderZ;
}
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 8)) == 0x10) {
renderZ = (this->_index & 0x3ffU) + this->_renderZOffset + 0x272e;
clampedZ = 10000;
if (10000 < renderZ) {
clampedZ = renderZ;
}
return clampedZ;
}
renderZ = FUN_006a8120();
renderZ = this->_renderZOffset + renderZ;
clampedZ = 10000;
if (10000 < renderZ) {
clampedZ = renderZ;
}
return clampedZ;
}
// 006b10d0
uint8_t Entity::CanOverwrite()
{
if ((this->_flags & 0x200000) == 0) {
return 1;
}
return 0;
}
// 006b10f0
void Entity::Render(Vector *offset)
{
float pixelScale;
double dVar1;
double dVar2;
float offsetY;
if ((this->_exists != 0) && (this->_visible != 0)) {
pixelScale = g_displayPixelRatio * g_screenPointScale;
dVar1 = floor((double)(((((this->_posOffset).x + (this->_pos).x) - 60.0) * 0.65 +
(g_screenWidth - 338.0) * 0.5) * pixelScale + 0.5));
dVar2 = floor((double)(((((this->_pos).y + (this->_posOffset).y) - 140.0) * 0.65 +
(g_screenHeight - 182.0) * 0.5) * pixelScale + 0.5));
offsetY = offset->y;
(this->_renderPosition).x = (float)dVar1 / pixelScale + offset->x;
(this->_renderPosition).y = (float)dVar2 / pixelScale + offsetY;
ANM2::Render(&this->_sprite,&this->_renderPosition,&g_vectorZero,&g_vectorZero);
}
return;
}
// 006b1260
void Entity::PostRender()
{
void *pvVar1;
KColor *fromColor;
KColor *fromColor_00;
int unused;
uint32_t uVar2;
Game *game;
KColor *collisionColor;
float fVar3;
float fVar4;
float fVar5;
float fVar6;
float fVar7;
double dVar8;
double dVar9;
int segment;
int reverseSegment;
float local_e8;
Vector lineTo;
float screenX;
float local_d8;
Vector lineFrom;
float minorAxisX;
float local_c8;
float majorAxisX;
Vector local_c0;
float negMajorAxisX;
float negMajorAxisY;
float arcPointX;
Vector arcPointA;
Vector arcPointB;
KColor drawColor;
uint8_t renderQuad [44];
float local_4c;
float local_38;
float local_24;
float local_10;
int halfSegmentCount;
int segmentCount;
if (((g_game->_debugFlags & 1) != 0) && (this->_type != 7)) {
fVar3 = g_screenHeight - 182.0;
uVar2 = 0xffffa500;
fVar4 = g_displayPixelRatio * g_screenPointScale;
if (this->_type != 1000) {
uVar2 = 0xffff0000;
}
dVar8 = floor((double)((((this->_pos).x - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * fVar4
+ 0.5));
dVar9 = floor((double)((((this->_pos).y - 140.0) * 0.65 + fVar3 * 0.5) * fVar4 + 0.5));
fVar7 = (float)dVar8 / fVar4 + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(g_game->_room) + 0x1204));
fVar5 = (float)dVar9 / fVar4 + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(g_game->_room) + 0x1208));
fVar3 = fVar5;
fVar4 = fVar7;
(GHIDRA_CAST<KColor *>((&drawColor)))->KColor::SetFromARGB(uVar2);
lineTo.x = fVar4 + 2.0;
lineTo.y = fVar3 + 0.0;
lineFrom.x = fVar4 - 2.0;
lineFrom.y = fVar3 - 0.0;
render_color_quad(&lineFrom,&lineTo,fromColor,fromColor,1.0);
(GHIDRA_CAST<KColor *>((&drawColor)))->KColor::SetFromARGB(uVar2);
lineTo.x = fVar7 + 0.0;
lineTo.y = fVar5 + 2.0;
lineFrom.y = fVar5 - 2.0;
lineFrom.x = fVar7 - 0.0;
render_color_quad(&lineFrom,&lineTo,fromColor_00,fromColor_00,1.0);
}
game = g_game;
if ((GHIDRA_UINT(g_game->_debugFlags) >> 0xc & 1) != 0) {
fVar3 = g_screenHeight - 182.0;
fVar4 = g_displayPixelRatio * g_screenPointScale;
dVar8 = floor((double)((((this->_pos).x - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * fVar4
+ 0.5));
dVar9 = floor((double)((((this->_pos).y - 140.0) * 0.65 + fVar3 * 0.5) * fVar4 + 0.5));
fVar3 = (float)dVar8 / fVar4 + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(game->_room) + 0x1204));
fVar4 = (float)dVar9 / fVar4 + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(game->_room) + 0x1208));
if (this->_entityGridCollisionClass != 0) {
if ((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(ThreadLocalStoragePointer) + 0xc)) < DAT_00c80cb8) &&
(_Init_thread_header(), DAT_00c80cb8 == -1)) {
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>(&DAT_00c80cc0))))->KColor::SetFromARGB(0xff000000);
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>(&DAT_00c80cd4))))->KColor::SetFromARGB(0xff8b0000);
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>(&DAT_00c80ce8))))->KColor::SetFromARGB(0xff006400);
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>(&DAT_00c80cfc))))->KColor::SetFromARGB(0xffffff00);
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>(&DAT_00c80d10))))->KColor::SetFromARGB(0xffffa500);
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>(&DAT_00c80d24))))->KColor::SetFromARGB(0xffff0000);
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>(&DAT_00c80d38))))->KColor::SetFromARGB(0xff00ffff);
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>(&DAT_00c80d4c))))->KColor::SetFromARGB(0xffff00ff);
_Init_thread_footer();
}
uVar2 = this->_entityGridCollisionClass;
if ((GHIDRA_INT(uVar2) < 1) || (7 < uVar2)) {
collisionColor = GHIDRA_CAST<KColor *>(&DAT_00c80cc0);
}
else {
collisionColor = GHIDRA_CAST<KColor *>((&DAT_00c80cc0 + uVar2 * 0x14));
}
uVar2 = 0;
pvVar1 = (this->_collisionPoints)._begin;
if (GHIDRA_INT((this->_collisionPoints)._end) - GHIDRA_INT(pvVar1) >> 3 != 0) {
lineTo.x = 1.0;
lineTo.y = 1.0;
fVar5 = fVar3;
fVar7 = fVar4;
do {
lineFrom.x = fVar5 + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + uVar2 * 8)) * 0.65;
lineFrom.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + uVar2 * 8 + 4)) * 0.65 + fVar7;
render_quad_set_rect(renderQuad,&lineFrom,&lineTo,collisionColor);
if ((local_4c + local_38 + local_24 + local_10) * 0.25 != 0.0) {
shader_push(GHIDRA_CAST<uint8_t *>("KAGE_ColorShader"));
FUN_00a11080();
pvVar1 = kage_graphics_flush((void *)0x0);
render_quad_draw(pvVar1,&drawColor,renderQuad,1,unused);
FUN_00a14200();
fVar5 = fVar3;
fVar7 = fVar4;
}
uVar2 = uVar2 + 1;
pvVar1 = (this->_collisionPoints)._begin;
} while (uVar2 < GHIDRA_UINT((GHIDRA_INT((this->_collisionPoints)._end) - GHIDRA_INT(pvVar1) >> 3)));
}
game = g_game;
}
}
if ((GHIDRA_UINT(game->_debugFlags) >> 5 & 1) != 0) {
fVar3 = g_screenHeight - 182.0;
fVar4 = g_displayPixelRatio * g_screenPointScale;
dVar8 = floor((double)((((this->_pos).x - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * fVar4
+ 0.5));
screenX = (float)dVar8 / fVar4;
dVar8 = floor((double)((((this->_pos).y - 140.0) * 0.65 + fVar3 * 0.5) * fVar4 + 0.5));
screenX = screenX + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(game->_room) + 0x1204));
fVar3 = (float)dVar8 / fVar4 + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(game->_room) + 0x1208));
if ((0.0 < this->_size) && (this->_entityCollisionClass != 0)) {
if ((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(ThreadLocalStoragePointer) + 0xc)) < DAT_00c80d60) &&
(_Init_thread_header(), DAT_00c80d60 == -1)) {
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>(&DAT_00c80d68))))->KColor::SetFromARGB(0xff000000);
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>(&DAT_00c80d7c))))->KColor::SetFromARGB(0xffffa500);
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>(&DAT_00c80d90))))->KColor::SetFromARGB(0xffffc0cb);
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>(&DAT_00c80da4))))->KColor::SetFromARGB(0xff00ff00);
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>(&DAT_00c80db8))))->KColor::SetFromARGB(0xffff0000);
_Init_thread_footer();
}
uVar2 = this->_entityCollisionClass;
if ((GHIDRA_INT(uVar2) < 1) || (4 < uVar2)) {
collisionColor = GHIDRA_CAST<KColor *>(&DAT_00c80d68);
}
else {
collisionColor = GHIDRA_CAST<KColor *>((&DAT_00c80d68 + uVar2 * 0x14));
}
local_e8 = this->_size;
fVar4 = (this->_sizeMulti).x;
fVar5 = (local_e8 * 6.2831855) / 10.0;
if (fVar5 <= 2.0) {
fVar5 = 2.0;
}
if (12.0 <= fVar5) {
fVar5 = 12.0;
}
halfSegmentCount = GHIDRA_INT(fVar5) * 2;
if ((fVar4 == g_vectorOne.x) && ((this->_sizeMulti).y == g_vectorOne.y)) {
fVar4 = cos(0.0);
local_c0.x = fVar4 * this->_size * 0.65 + screenX;
fVar4 = sin(0.0);
segment = 1;
segmentCount = GHIDRA_INT(fVar5) << 2;
if (0 < segmentCount) {
local_c0.y = fVar4 * this->_size * 0.65 + fVar3;
do {
fVar5 = (((float)segment * 180.0) / (float)halfSegmentCount) * 0.017453292;
fVar4 = cos(fVar5);
fVar4 = fVar4 * this->_size * 0.65 + screenX;
lineTo.x = fVar4;
fVar5 = sin(fVar5);
fVar5 = fVar5 * this->_size * 0.65 + fVar3;
lineTo.y = fVar5;
render_color_quad(&local_c0,&lineTo,collisionColor,collisionColor,1.0);
segment = segment + 1;
local_c0.x = fVar4;
local_c0.y = fVar5;
} while (segment <= segmentCount);
return;
}
}
else {
local_d8 = (this->_sprite)._rotation;
fVar4 = fVar4 * local_e8;
local_e8 = local_e8 * (this->_sizeMulti).y;
fVar5 = fVar4;
if (fVar4 < local_e8) {
local_d8 = local_d8 + 90.0;
fVar5 = local_e8;
local_e8 = fVar4;
}
fVar4 = local_d8 * 0.017453292;
majorAxisX = cos(fVar4);
majorAxisX = majorAxisX * (fVar5 - local_e8);
fVar4 = sin(fVar4);
fVar4 = fVar4 * (fVar5 - local_e8);
local_d8 = (local_d8 + 90.0) * 0.017453292;
minorAxisX = cos(local_d8);
minorAxisX = minorAxisX * local_e8;
local_d8 = sin(local_d8);
local_d8 = local_d8 * local_e8;
lineTo.x = (-minorAxisX + majorAxisX) * 0.65 + screenX;
lineFrom.x = (-minorAxisX - majorAxisX) * 0.65 + screenX;
lineTo.y = (-local_d8 + fVar4) * 0.65 + fVar3;
lineFrom.y = (-local_d8 - fVar4) * 0.65 + fVar3;
render_color_quad(&lineFrom,&lineTo,collisionColor,collisionColor,1.0);
fVar5 = (minorAxisX + majorAxisX) * 0.65 + screenX;
fVar7 = (local_d8 + fVar4) * 0.65 + fVar3;
lineFrom.x = (minorAxisX - majorAxisX) * 0.65 + screenX;
lineFrom.y = (local_d8 - fVar4) * 0.65 + fVar3;
lineTo.x = fVar5;
lineTo.y = fVar7;
render_color_quad(&lineFrom,&lineTo,collisionColor,collisionColor,1.0);
negMajorAxisX = -majorAxisX;
negMajorAxisY = -fVar4;
segment = 1;
lineTo.x = (negMajorAxisX + minorAxisX) * 0.65 + screenX;
if (0 < halfSegmentCount) {
reverseSegment = -1;
lineTo.y = (negMajorAxisY + local_d8) * 0.65 + fVar3;
lineFrom.x = fVar5;
lineFrom.y = fVar7;
do {
fVar5 = (((float)reverseSegment * 180.0) / (float)halfSegmentCount) * 0.017453292;
local_c8 = cos(fVar5);
fVar5 = sin(fVar5);
fVar7 = local_c8 * local_d8;
fVar6 = local_c8 * minorAxisX;
local_c8 = (((float)segment * 180.0) / (float)halfSegmentCount) * 0.017453292;
local_c0.x = (fVar5 * minorAxisX + fVar7 + fVar4) * 0.65 + fVar3;
arcPointX = ((fVar6 - fVar5 * local_d8) + majorAxisX) * 0.65 + screenX;
arcPointA.x = arcPointX;
arcPointA.y = local_c0.x;
fVar5 = cos(local_c8);
fVar7 = sin(local_c8);
local_c8 = ((fVar5 * minorAxisX - fVar7 * local_d8) + negMajorAxisX) * 0.65 + screenX;
fVar5 = (fVar5 * local_d8 + fVar7 * minorAxisX + negMajorAxisY) * 0.65 + fVar3;
arcPointB.x = local_c8;
arcPointB.y = fVar5;
render_color_quad(&lineFrom,&arcPointA,collisionColor,collisionColor,1.0);
render_color_quad(&lineTo,&arcPointB,collisionColor,collisionColor,1.0);
lineFrom.x = arcPointX;
lineFrom.y = local_c0.x;
segment = segment + 1;
reverseSegment = reverseSegment + -1;
lineTo.x = local_c8;
lineTo.y = fVar5;
} while (segment <= halfSegmentCount);
}
}
}
}
return;
}
// 006b2000
uint8_t Entity::RenderShadowLayer(Vector *offset)
{
uint8_t *layerName;
float fVar1;
float fVar2;
float fVar3;
LayerState *shadowLayer;
float *extraout_EAX;
double dVar4;
Vector renderPos;
float local_c4;
uint64_t local_c0;
float savedTint;
float fStack_b4;
float fStack_b0;
float fStack_ac;
float savedColorize;
float fStack_a4;
float fStack_a0;
float fStack_9c;
Color shadowColor;
uint32_t local_6c [26];
ColorMod *spriteColor;
local_c0 = CONCAT44((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_c0)) + 0x4))),g_displayPixelRatio * g_screenPointScale);
renderPos.x = ((((this->_shadowOffset).x + (this->_pos).x) - 60.0) * 0.65 +
(g_screenWidth - 338.0) * 0.5) * g_displayPixelRatio * g_screenPointScale + 0.5;
dVar4 = floor((double)renderPos.x);
local_c4 = (float)dVar4 / (float)local_c0;
renderPos.x = ((((this->_pos).y + (this->_shadowOffset).y) - 140.0) * 0.65 +
(g_screenHeight - 182.0) * 0.5) * (float)local_c0 + 0.5;
dVar4 = floor((double)renderPos.x);
renderPos.x = local_c4 + offset->x;
renderPos.y = (float)dVar4 / (float)local_c0 + offset->y;
layerName = GHIDRA_CAST<uint8_t *>((this->_sprite)._shadowLayerIndex);
if (layerName == GHIDRA_CAST<uint8_t *>(0xffffffff)) {
return 0;
}
shadowLayer = ANM2::GetLayer(&this->_sprite,layerName);
spriteColor = &(this->_sprite)._color;
shadowLayer->_visible = 1;
savedTint = spriteColor->_tint[0];
fStack_b4 = (this->_sprite)._color._tint[1];
fStack_b0 = (this->_sprite)._color._tint[2];
fStack_ac = (this->_sprite)._color._tint[3];
local_c4 = (this->_sprite)._color._offset[2];
savedColorize = (this->_sprite)._color._colorize[0];
fStack_a4 = (this->_sprite)._color._colorize[1];
fStack_a0 = (this->_sprite)._color._colorize[2];
fStack_9c = (this->_sprite)._color._colorize[3];
local_c0 = *GHIDRA_CAST<uint64_t *>((this->_sprite)._color._offset);
::(GHIDRA_CAST<Color *>((&shadowColor)))->Color::Color();
if (spriteColor != GHIDRA_CAST<ColorMod *>(extraout_EAX)) {
fVar1 = extraout_EAX[1];
fVar2 = extraout_EAX[2];
fVar3 = extraout_EAX[3];
spriteColor->_tint[0] = *extraout_EAX;
(this->_sprite)._color._tint[1] = fVar1;
(this->_sprite)._color._tint[2] = fVar2;
(this->_sprite)._color._tint[3] = fVar3;
fVar1 = extraout_EAX[5];
fVar2 = extraout_EAX[6];
fVar3 = extraout_EAX[7];
(this->_sprite)._color._colorize[0] = extraout_EAX[4];
(this->_sprite)._color._colorize[1] = fVar1;
(this->_sprite)._color._colorize[2] = fVar2;
(this->_sprite)._color._colorize[3] = fVar3;
*GHIDRA_CAST<uint64_t *>((this->_sprite)._color._offset) = *GHIDRA_CAST<uint64_t *>((extraout_EAX + 8));
(this->_sprite)._color._offset[2] = extraout_EAX[10];
}
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::RenderLayer((this->_sprite)._shadowLayerIndex,&renderPos,
&g_vectorZero,&g_vectorZero);
if (spriteColor != GHIDRA_CAST<ColorMod *>(local_6c)) {
spriteColor->_tint[0] = savedTint;
(this->_sprite)._color._tint[1] = fStack_b4;
(this->_sprite)._color._tint[2] = fStack_b0;
(this->_sprite)._color._tint[3] = fStack_ac;
(this->_sprite)._color._colorize[0] = savedColorize;
(this->_sprite)._color._colorize[1] = fStack_a4;
(this->_sprite)._color._colorize[2] = fStack_a0;
(this->_sprite)._color._colorize[3] = fStack_9c;
*GHIDRA_CAST<uint64_t *>((this->_sprite)._color._offset) = local_c0;
(this->_sprite)._color._offset[2] = local_c4;
}
shadowLayer->_visible = 0;
return 1;
}
// 006b2210
float Entity::IsCollisionIgnored(Entity *other)
{
int iVar1;
uint8_t isOwned;
float mass;
mass = this->_mass;
if (((this->_flags & 0x8000000000000) != 0) &&
(((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager) && (other->_type == 1)) ||
(other->_type - 10U < 0x3de)))) {
mass = mass * 10.0;
}
iVar1 = this->_type;
if (iVar1 == 1) {
if ((other->_type == 3) && (other->_variant == 0xef)) {
mass = mass * 10.0;
}
isOwned = TemporaryEffects::HasCollectibleEffect
(GHIDRA_CAST<TemporaryEffects *>(&this[5]._sprite._overlayRenderFirst),0x271);
if (isOwned != 0) {
mass = mass * 10.0;
}
}
if (((((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (iVar1 == 1)) || (iVar1 - 10U < 0x3de)) &&
((other->_type == 2 || (other->_type == 7)))) &&
((((iVar1 == 0x19 ||
((((iVar1 == 0x3e || (iVar1 == 0x29)) || (iVar1 == 0xfe)) ||
((iVar1 == 0x5b || (iVar1 == 0x17)))))) || (iVar1 == 0x124)) ||
(((iVar1 == 0xf5 || (iVar1 == 0x37)) || (iVar1 == 0x11b)))))) {
mass = mass * 100.0;
}
if ((iVar1 == 1) && (other->_type == 9)) {
isOwned = (GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(this))))->Entity_Player::HasCollectible(0x114,0);
if (isOwned == 0) {
isOwned = TemporaryEffects::HasNullEffect
(GHIDRA_CAST<TemporaryEffects *>(&this[5]._sprite._overlayRenderFirst),0x3b);
if ((isOwned == 0) && (this[4]._health != 4.90454e-44)) {
return mass;
}
}
mass = mass * 20.0;
}
return mass;
}
// 006b25b0
void Entity::push_apart_capsule(Entity *other)
{
float fVar1;
uint8_t bVar2;
Game *extraout_EDX;
Game *game;
Entity *otherEntity;
float otherShare;
float selfShare;
float fVar3;
float fVar4;
float otherShare;
float pushVelX;
float beastDamping;
Vector scratchVec;
Capsule otherCapsule [13];
Capsule selfCapsule [14];
otherEntity = other;
if ((((*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2) || (this->_type != 2)) || (other->_type != 1)) &&
(other->_type < this->_type)) {
otherEntity = this;
this = other;
}
scratchVec.x = (this->_pos).x + g_vectorZero.x;
scratchVec.y = (this->_pos).y + g_vectorZero.y;
Capsule::constructor
(selfCapsule,&scratchVec,&this->_sizeMulti,(this->_sprite)._rotation,this->_size);
scratchVec.x = (otherEntity->_pos).x + g_vectorZero.x;
scratchVec.y = (otherEntity->_pos).y + g_vectorZero.y;
Capsule::constructor
(otherCapsule,&scratchVec,&otherEntity->_sizeMulti,(otherEntity->_sprite)._rotation,
otherEntity->_size);
scratchVec.y = 0.0;
scratchVec.x = 0.0;
bVar2 = Capsule::Collide(selfCapsule,otherCapsule,&scratchVec);
if (bVar2 != 0) {
bVar2 = entity_collision_classes_match(this,otherEntity);
if (bVar2 == 0) {
otherShare = IsCollisionIgnored(this,otherEntity);
selfShare = IsCollisionIgnored(otherEntity,this);
otherShare = otherShare / (selfShare + otherShare);
selfShare = 1.0 - otherShare;
if ((scratchVec.x != g_vectorZero.x) || (scratchVec.y != g_vectorZero.y)) {
fVar1 = (this->_velocity).x;
otherShare = (otherEntity->_velocity).x - fVar1;
fVar3 = (otherEntity->_velocity).y - (this->_velocity).y;
fVar4 = sqrtf(fVar3 * fVar3 + otherShare * otherShare);
fVar3 = sqrtf(scratchVec.x * scratchVec.x + scratchVec.y * scratchVec.y);
beastDamping = 0.25;
pushVelX = (scratchVec.x / fVar3) * fVar4;
fVar4 = (scratchVec.y / fVar3) * fVar4;
game = g_game;
fVar3 = scratchVec.y;
otherShare = scratchVec.x;
if ((this->_flags & 0x40000000) == 0) {
bVar2 = (GHIDRA_CAST<Room *>((g_game->_room)))->Room::IsBeastDungeon();
if ((bVar2 == 0) || (this->_type != 1)) {
(this->_pos).x = (this->_pos).x - otherShare * selfShare;
(this->_pos).y = (this->_pos).y - fVar3 * selfShare;
(this->_velocity).x = (this->_velocity).x - pushVelX * selfShare;
fVar1 = fVar4;
}
else {
(this->_velocity).x = fVar1 - pushVelX * beastDamping * selfShare;
fVar1 = fVar4 * beastDamping;
}
(this->_velocity).y = (this->_velocity).y - fVar1 * selfShare;
game = extraout_EDX;
}
if ((otherEntity->_flags & 0x40000000) == 0) {
bVar2 = (GHIDRA_CAST<Room *>((game->_room)))->Room::IsBeastDungeon();
if ((bVar2 == 0) || (otherEntity->_type != 1)) {
(otherEntity->_pos).x = otherShare * otherShare + (otherEntity->_pos).x;
(otherEntity->_pos).y = fVar3 * otherShare + (otherEntity->_pos).y;
}
else {
pushVelX = pushVelX * beastDamping;
fVar4 = fVar4 * beastDamping;
}
(otherEntity->_velocity).y = fVar4 * otherShare + (otherEntity->_velocity).y;
(otherEntity->_velocity).x = pushVelX * otherShare + (otherEntity->_velocity).x;
}
}
return;
}
}
return;
}
// 006b2940
uint8_t Entity::push_apart_circle(Entity *other)
{
uint8_t bVar1;
Vector *relVelocityDir;
Vector *deltaDir;
uint32_t rngResult;
int unused;
Game *extraout_EDX;
Game *game;
Entity *first;
Entity *second;
float fVar2;
float fVar3;
float pushDirX;
float pushDirY;
float beastDamping;
Vector local_40;
Vector local_38;
Vector local_30;
float local_28;
Entity *local_24;
float local_20;
float local_1c;
float dy;
float dx;
second = other;
local_24 = this;
if ((((*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2) || (this->_type != 2)) || (other->_type != 1)) &&
(other->_type < this->_type)) {
second = this;
local_24 = other;
}
first = local_24;
local_40.y = (second->_pos).y - (local_24->_pos).y;
local_40.x = (second->_pos).x - (local_24->_pos).x;
local_1c = local_24->_size + second->_size;
fVar3 = local_40.y * local_40.y + local_40.x * local_40.x;
if (fVar3 < local_1c * local_1c) {
dy = local_40.y;
dx = local_40.x;
local_28 = sqrtf(fVar3);
bVar1 = entity_collision_classes_match(first,second);
if (bVar1 == 0) {
first->_collidesWithEntity = second->_type != 2;
second->_collidesWithEntity = first->_type != 2;
if (0.0001 <= local_28) {
local_38.y = (first->_velocity).y - (second->_velocity).y;
local_38.x = (first->_velocity).x - (second->_velocity).x;
local_30.y = local_38.x;
local_20 = local_38.y;
fVar3 = sqrtf(local_38.y * local_38.y + local_38.x * local_38.x);
if ((local_1c * 0.5 < fVar3) && (dy * local_20 + dx * local_30.y < 0.0)) {
relVelocityDir = (GHIDRA_CAST<Vector *>((&local_38)))->Vector::Normalized(&local_30);
deltaDir = (GHIDRA_CAST<Vector *>((&local_40)))->Vector::Normalized(&local_38);
fVar3 = relVelocityDir->y * deltaDir->y + relVelocityDir->x * deltaDir->x;
fVar2 = fVar3 * dy;
fVar3 = fVar3 * dx;
dy = fVar2 + fVar2 + dy;
dx = dx + fVar3 + fVar3;
local_28 = sqrtf(dy * dy + dx * dx);
first = local_24;
}
local_24 = GHIDRA_CAST<Entity *>(IsCollisionIgnored(first,second));
fVar3 = IsCollisionIgnored(second,first);
local_24 = GHIDRA_CAST<Entity *>(((float)local_24 / (fVar3 + (float)local_24)));
local_1c = (local_1c - local_28) / local_28;
local_20 = 1.0 - (float)local_24;
if ((first->_type == 1) || ((first->_type == 3 && (first->_variant == 0x43)))) {
local_40.x = -dx * local_20 * local_1c;
local_40.y = -dy * local_20 * local_1c;
bVar1 = is_grid_collision_at(first,&local_40);
if (bVar1 != 0) {
local_24 = GHIDRA_CAST<Entity *>(0x3f800000);
local_20 = 0.0;
}
}
if (first->_type == 1) {
local_20 = local_20 * 0.5;
}
fVar3 = (second->_velocity).y - (first->_velocity).y;
fVar2 = (second->_velocity).x - (first->_velocity).x;
local_30.y = sqrtf(fVar3 * fVar3 + fVar2 * fVar2);
local_38.y = (dx / local_28) * local_30.y;
local_28 = (dy / local_28) * local_30.y;
if ((((first->_type == 0x393) && (first->_variant == 1)) && (second->_type == 0x393)) &&
(second->_variant == 1)) {
rngResult = Random();
fVar3 = local_30.y * 0.05 + 0.2;
if (1.2 <= fVar3) {
fVar3 = 1.2;
}
SoundEffects::PlayWithFartOverride2
(0x1e7,unused,2,0,
(float)((double)GHIDRA_INT(rngResult) +
__uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 0.2
+ 0.9,fVar3);
}
beastDamping = 0.25;
game = g_game;
fVar3 = local_28;
fVar2 = local_38.y;
pushDirX = dx;
pushDirY = dy;
if ((first->_flags & 0x40000000) == 0) {
bVar1 = (GHIDRA_CAST<Room *>((g_game->_room)))->Room::IsBeastDungeon();
if ((bVar1 == 0) || (first->_type != 1)) {
(first->_pos).x = (first->_pos).x - pushDirX * local_20 * local_1c;
(first->_pos).y = (first->_pos).y - pushDirY * local_20 * local_1c;
beastDamping = 0.25;
(first->_velocity).x = (first->_velocity).x - fVar2 * local_20;
(first->_velocity).y = (first->_velocity).y - fVar3 * local_20;
game = extraout_EDX;
}
else {
(first->_velocity).x = (first->_velocity).x - fVar2 * beastDamping * local_20;
(first->_velocity).y = (first->_velocity).y - fVar3 * beastDamping * local_20;
game = extraout_EDX;
}
}
if ((second->_flags & 0x40000000) == 0) {
bVar1 = (GHIDRA_CAST<Room *>((game->_room)))->Room::IsBeastDungeon();
if ((bVar1 == 0) || (second->_type != 1)) {
(second->_pos).x = pushDirX * (float)local_24 * local_1c + (second->_pos).x;
(second->_pos).y = pushDirY * (float)local_24 * local_1c + (second->_pos).y;
}
else {
fVar2 = fVar2 * beastDamping;
fVar3 = fVar3 * beastDamping;
}
(second->_velocity).y = fVar3 * (float)local_24 + (second->_velocity).y;
(second->_velocity).x = fVar2 * (float)local_24 + (second->_velocity).x;
}
}
return 1;
}
}
return 0;
}
// 006b2ee0
void Entity::collide_with_entity()
{
Entity *in_EDX;
if (((((this->_sizeMulti).x == g_vectorOne.x) && ((this->_sizeMulti).y == g_vectorOne.y)) &&
((in_EDX->_sizeMulti).x == g_vectorOne.x)) && ((in_EDX->_sizeMulti).y == g_vectorOne.y)) {
push_apart_circle(this,in_EDX);
return;
}
push_apart_capsule(this,in_EDX);
return;
}
// 006b2f50
uint8_t Entity::ForceCollide(Entity *boom, Entity *collider, uint8_t low)
{
uint8_t bVar1;
uint8_t isColliderCollided;
g_forceCollideDepth = g_forceCollideDepth + 1;
if (low == 0) {
bVar1 = entity_collision_classes_match(boom,collider);
g_forceCollideDepth = g_forceCollideDepth + -1;
return bVar1;
}
bVar1 = boom->HandleCollision(collider,1);
isColliderCollided = collider->HandleCollision(boom,0);
g_forceCollideDepth = g_forceCollideDepth + -1;
return isColliderCollided | bVar1;
}
// 006b2fa0
void Entity::SetColor(ColorMod *color, int duration, int priority, uint8_t isFadeout, uint8_t isShare)
{
float fVar1;
float fVar2;
float fVar3;
uint8_t isStatusShared;
uint32_t extraout_EDX;
int *insertPos;
undefined3 in_stack_00000011;
undefined3 in_stack_00000015;
uint8_t auStack_5c [4];
float colorOffsetZ;
ColorMod *colorLocal;
std_vector *local_50;
float local_4c;
float fStack_48;
float fStack_44;
float fStack_40;
float local_3c;
float fStack_38;
float fStack_34;
float fStack_30;
float local_2c;
uint32_t uStack_28;
float local_24;
float local_20;
int local_1c;
uint32_t local_18;
uint8_t local_14;
uint8_t local_13;
uint32_t local_c;
uint64_t colorOffsetXY;
void **colorParamsEnd;
int *paramsEnd;
ColorMod *spriteColor;
void *topParams;
local_c = __security_cookie ^ GHIDRA_UINT(auStack_5c);
colorLocal = color;
if (duration < 1) {
if (&this->_color != color) {
fVar1 = color->_tint[1];
fVar2 = color->_tint[2];
fVar3 = color->_tint[3];
(this->_color)._tint[0] = color->_tint[0];
(this->_color)._tint[1] = fVar1;
(this->_color)._tint[2] = fVar2;
(this->_color)._tint[3] = fVar3;
fVar1 = color->_colorize[1];
fVar2 = color->_colorize[2];
fVar3 = color->_colorize[3];
(this->_color)._colorize[0] = color->_colorize[0];
(this->_color)._colorize[1] = fVar1;
(this->_color)._colorize[2] = fVar2;
(this->_color)._colorize[3] = fVar3;
*GHIDRA_CAST<uint64_t *>((this->_color)._offset) = *GHIDRA_CAST<uint64_t *>(color->_offset);
(this->_color)._offset[2] = color->_offset[2];
}
this->ResetColor();
}
else {
colorOffsetZ = color->_offset[2];
local_4c = color->_tint[0];
fStack_48 = color->_tint[1];
fStack_44 = color->_tint[2];
fStack_40 = color->_tint[3];
local_3c = color->_colorize[0];
fStack_38 = color->_colorize[1];
fStack_34 = color->_colorize[2];
fStack_30 = color->_colorize[3];
colorOffsetXY = *GHIDRA_CAST<uint64_t *>(color->_offset);
local_20 = (float)duration;
local_1c = duration;
insertPos = (this->_colorParams)._begin;
(*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(&(local_18)) + 0x0))) = CONCAT11(isShare,isFadeout);
paramsEnd = (this->_colorParams)._end;
local_50 = GHIDRA_CAST<std_vector *>(priority);
local_2c = (float)colorOffsetXY;
uStack_28 = (uint32_t)((uint64_t)colorOffsetXY >> 0x20);
for (; (insertPos != paramsEnd && (*insertPos < priority)); insertPos = insertPos + 0xf) {
}
local_24 = colorOffsetZ;
if (paramsEnd == (this->_colorParams)._capacity) {
FUN_006b8160(insertPos,&local_50);
}
else if (insertPos == paramsEnd) {
*paramsEnd = priority;
*GHIDRA_CAST<uint64_t *>((paramsEnd + 9)) = colorOffsetXY;
paramsEnd[0xb] = GHIDRA_INT(colorOffsetZ);
paramsEnd[1] = GHIDRA_INT(local_4c);
paramsEnd[2] = GHIDRA_INT(fStack_48);
paramsEnd[3] = GHIDRA_INT(fStack_44);
paramsEnd[4] = GHIDRA_INT(fStack_40);
paramsEnd[5] = GHIDRA_INT(local_3c);
paramsEnd[6] = GHIDRA_INT(fStack_38);
paramsEnd[7] = GHIDRA_INT(fStack_34);
paramsEnd[8] = GHIDRA_INT(fStack_30);
*GHIDRA_CAST<uint8_t *>((paramsEnd + 0xe)) = isFadeout;
paramsEnd[0xc] = duration;
paramsEnd[0xd] = duration;
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(paramsEnd) + 0x39)) = isShare;
colorParamsEnd = &(this->_colorParams)._end;
*colorParamsEnd = (void *)(GHIDRA_INT(*colorParamsEnd) + 0x3c);
}
else {
fStack_48 = color->_tint[0];
fStack_44 = color->_tint[1];
fStack_40 = color->_tint[2];
local_3c = color->_tint[3];
local_50 = &this->_colorParams;
local_4c = (float)priority;
local_20 = color->_offset[2];
fStack_38 = color->_colorize[0];
fStack_34 = color->_colorize[1];
fStack_30 = color->_colorize[2];
local_2c = color->_colorize[3];
local_18 = duration;
local_14 = isFadeout;
uStack_28 = (uint32_t)*GHIDRA_CAST<uint64_t *>(color->_offset);
local_24 = (float)((uint64_t)*GHIDRA_CAST<uint64_t *>(color->_offset) >> 0x20);
local_13 = isShare;
FUN_004b7020(paramsEnd + -0xf);
colorParamsEnd = &(this->_colorParams)._end;
*colorParamsEnd = (void *)(GHIDRA_INT(*colorParamsEnd) + 0x3c);
FUN_004b6e40(extraout_EDX);
FUN_004b6fc0(&local_4c);
color = colorLocal;
}
topParams = (this->_colorParams)._begin;
spriteColor = &(this->_sprite)._color;
if (spriteColor != GHIDRA_CAST<ColorMod *>((GHIDRA_INT(topParams) + 4))) {
fVar1 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(topParams) + 8));
fVar2 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(topParams) + 0xc));
fVar3 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(topParams) + 0x10));
spriteColor->_tint[0] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(topParams) + 4));
(this->_sprite)._color._tint[1] = fVar1;
(this->_sprite)._color._tint[2] = fVar2;
(this->_sprite)._color._tint[3] = fVar3;
fVar1 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(topParams) + 0x18));
fVar2 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(topParams) + 0x1c));
fVar3 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(topParams) + 0x20));
(this->_sprite)._color._colorize[0] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(topParams) + 0x14));
(this->_sprite)._color._colorize[1] = fVar1;
(this->_sprite)._color._colorize[2] = fVar2;
(this->_sprite)._color._colorize[3] = fVar3;
*GHIDRA_CAST<uint64_t *>((this->_sprite)._color._offset) = *GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(topParams) + 0x24));
(this->_sprite)._color._offset[2] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(topParams) + 0x2c));
}
}
isStatusShared = DoesEntityShareStatus(this);
if (((isStatusShared != 0) && (isShare != 0)) && (GHIDRA_CAST<int *>(this->_child) != GHIDRA_CAST<int *>(0x0))) {
(**(code **)(*GHIDRA_CAST<int *>(this->_child) + 0x3c))(color,duration,priority,_isFadeout,_isShare);
}
return;
}
// 006b45c0
void Entity::BloodExplode()
{
void *pvVar1;
ANM2 *pAVar2;
char cVar3;
uint8_t bVar4;
uint32_t uVar5;
Entity *pEVar6;
LayerState *layer;
uint32_t rngValue;
int iVar7;
Manager *manager;
int *unaff_EDI;
float fVar8;
float fVar9;
int iVar10;
uint8_t auStack_98 [4];
int iStack_94;
Entity *pEStack_90;
Entity *pEStack_8c;
float fStack_88;
float gibSpeed;
Vector gibVelocity;
Vector VStack_78;
float dropVelX;
float dropVelY;
Vector dropVelocity;
KColor bloodColor;
KColor baseBloodColor;
ColorMod tmpColor;
uint32_t local_c;
code *setColorFn;
local_c = __security_cookie ^ GHIDRA_UINT(auStack_98);
if ((this->_flags & 0x4000000000000) != 0) {
cVar3 = this->IsBoss();
if ((cVar3 == '\0') && (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this->_config) + 0x2c)) == '\0')) {
uVar5 = Random();
manager = g_manager;
iStack_94 = 0x1f0;
pEStack_90 = (Entity *)
((float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) *
2.3283064e-10 * 0.2 + 0.9);
seed_fart_sound_override(&iStack_94);
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(iStack_94,1.0,2,0,(float)pEStack_90,0.0);
tmpColor._tint[0] = 0.8;
tmpColor._tint[1] = 0.8;
tmpColor._tint[2] = 0.8;
tmpColor._tint[3] = 1.0;
tmpColor._offset[0] = 0.3;
tmpColor._colorize[0] = 1.0;
tmpColor._colorize[1] = 1.0;
tmpColor._colorize[2] = 1.0;
tmpColor._colorize[3] = 0.5;
tmpColor._offset[1] = 0.5;
tmpColor._offset[2] = 0.8;
uVar5 = Random();
pEStack_90 = (Entity *)
((float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) *
2.3283064e-10);
uVar5 = Random();
Game::SpawnParticles
(g_game,&this->_pos,0x23,(uVar5 & 3) + 3,(float)pEStack_90 + (float)pEStack_90 + 3.0
,&tmpColor,100000.0,0);
return;
}
}
if ((this->_flags & 0x2000000000000) != 0) {
uVar5 = Random();
manager = g_manager;
iStack_94 = 0x1f2;
pEStack_90 = (Entity *)
((float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) *
2.3283064e-10 * 0.2 + 0.9);
seed_fart_sound_override(&iStack_94);
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(iStack_94,1.0,2,0,(float)pEStack_90,0.0);
manager = g_manager;
iStack_94 = 0x89;
seed_fart_sound_override(&iStack_94);
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(iStack_94,1.0,2,0,1.0,0.0);
tmpColor._tint[0] = 0.8;
tmpColor._tint[1] = 0.8;
tmpColor._tint[2] = 0.8;
tmpColor._tint[3] = 1.0;
tmpColor._offset[0] = 0.3;
tmpColor._colorize[0] = 1.0;
tmpColor._colorize[1] = 1.0;
tmpColor._colorize[2] = 1.0;
tmpColor._colorize[3] = 0.5;
tmpColor._offset[1] = 0.5;
tmpColor._offset[2] = 0.8;
uVar5 = Random();
Game::SpawnParticles
(g_game,&this->_pos,4,*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this->_config) + 0x5c)) + uVar5 % 3,5.0,&tmpColor,
100000.0,0);
return;
}
iVar7 = this->_type;
if ((iVar7 == 0x33e) && (this->_variant == 10)) {
iStack_94 = 500;
LAB_006b4a8f:
manager = g_manager;
seed_fart_sound_override(&iStack_94);
fVar9 = 1.0;
LAB_006b4abc:
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(iStack_94,fVar9,2,0,1.0,0.0);
}
else {
uVar5 = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this->_config) + 0x60));
if ((uVar5 >> 0xb & 1) != 0) {
iStack_94 = 0x1f8;
goto LAB_006b4a8f;
}
if ((0 < this->_freezeCountdown) || ((uVar5 & 0x180) != 0)) {
iStack_94 = 0x89;
goto LAB_006b4a8f;
}
bVar4 = IsEnemy(this);
manager = g_manager;
if ((bVar4 != 0) && (this[3]._spawnerType == 0xc)) {
iStack_94 = 0x1e;
goto LAB_006b4a8f;
}
uVar5 = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this->_config) + 0x60));
if ((uVar5 >> 9 & 1) != 0) {
iStack_94 = 0xcf;
seed_fart_sound_override(&iStack_94);
fVar9 = 1.8;
goto LAB_006b4abc;
}
if ((uVar5 >> 10 & 1) != 0) {
iStack_94 = 0x1b;
goto LAB_006b4a8f;
}
if ((uVar5 >> 0xd & 1) != 0) {
iStack_94 = 0x8d;
goto LAB_006b4a8f;
}
if ((uVar5 >> 4 & 1) != 0) {
if (((((this->_dead == 0) || (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this->_config) + 0x2c)) == '\0')) ||
(iVar7 == 0x2e)) ||
(((iVar7 == 0x2f || (iVar7 == 0x30)) ||
((iVar7 == 0x31 || ((iVar7 == 0x32 || (iVar7 == 0x33)))))))) || (iVar7 == 0x34)) {
LAB_006b4a23:
manager = g_manager;
iStack_94 = 0x1c;
seed_fart_sound_override(&iStack_94);
fVar9 = 1.25;
goto LAB_006b4abc;
}
iStack_94 = 0x8d;
goto LAB_006b4a8f;
}
bVar4 = HasEntityFlags(this,0x80000000000000);
pvVar1 = this->_config;
if (bVar4 == 0) {
LAB_006b4a5a:
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x5c)) < 1) goto LAB_006b4a6a;
fVar9 = 1.0;
}
else {
if (0 < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x5c))) {
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(pvVar1) + 0x60)) & 1) != 0) goto LAB_006b4a23;
goto LAB_006b4a5a;
}
LAB_006b4a6a:
fVar9 = 0.8;
}
play_sound_with_fart_seed(0x1e,fVar9,2,0,1.0);
}
manager = g_manager;
if ((this->_type == 0x3d) && (this->_variant == 5)) {
iStack_94 = 0x1ec;
seed_fart_sound_override(&iStack_94);
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(iStack_94,1.0,2,0,1.0,0.0);
uVar5 = Random();
pEVar6 = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0x79,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar5,0);
tmpColor._offset[0] = 0.0;
tmpColor._colorize[0] = 0.0;
tmpColor._colorize[1] = 0.0;
tmpColor._colorize[2] = 0.0;
tmpColor._colorize[3] = 0.0;
tmpColor._offset[1] = 0.0;
tmpColor._offset[2] = 0.0;
tmpColor._tint[0] = 1.0;
tmpColor._tint[1] = 1.0;
tmpColor._tint[2] = 0.0;
tmpColor._tint[3] = 1.0;
pEStack_90 = pEVar6;
pEVar6->SetColor(&tmpColor,0xffffffff,0xff,0,1);
fVar9 = g_vectorOne.x;
fVar8 = g_vectorOne.y * 0.75;
pAVar2 = &pEVar6[1]._sprite;
(pAVar2->_filename)._buf[4] = '\x03';
(pAVar2->_filename)._buf[5] = '\0';
(pAVar2->_filename)._buf[6] = '\0';
(pAVar2->_filename)._buf[7] = '\0';
pAVar2 = &pEVar6[1]._sprite;
(pAVar2->_filename)._buf[8] = '\x03';
(pAVar2->_filename)._buf[9] = '\0';
(pAVar2->_filename)._buf[10] = '\0';
(pAVar2->_filename)._buf[0xb] = '\0';
(pEVar6->_sprite)._scale.y = fVar8;
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(pEVar6[1])) + 0x40)))) = 3;
(pEVar6->_sprite)._scale.x = fVar9 * 0.75;
(pEVar6->_posOffset).x = 0.0;
(pEVar6->_posOffset).y = -10.0;
if ((pEVar6->_sprite)._animState._animData != (void *)0x0) {
AnimationState::SetFrameFloat(&(pEVar6->_sprite)._animState,1.0);
}
uVar5 = g_graphicsManager_flags;
layer = ANM2::GetLayer(&pEStack_90->_sprite,GHIDRA_CAST<uint8_t *>(0x0));
iVar7 = 1;
if ((uVar5 & 4) == 0) {
iVar7 = 6;
}
layer->_blendMode[0] = 0;
layer->_blendMode[1] = iVar7;
layer->_blendMode[2] = 1;
layer->_blendMode[3] = 1;
layer->_blendMode[4] = 1;
}
iStack_94 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this->_config) + 0x5c));
if (iStack_94 < 1) {
VStack_78.x = *GHIDRA_CAST<float *>(&this->_flags);
uVar5 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
LAB_006b4d1e:
pEStack_90 = GHIDRA_CAST<Entity *>((uVar5 & 0x800000));
if (pEStack_90 == GHIDRA_CAST<Entity *>(0x0)) goto LAB_006b4cca;
iStack_94 = iStack_94 * 2;
LAB_006b4d45:
uVar5 = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this->_config) + 0x60));
}
else {
uVar5 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
if ((uVar5 & 0x800) == 0) {
VStack_78.x = *GHIDRA_CAST<float *>(&this->_flags);
goto LAB_006b4d1e;
}
iVar7 = GHIDRA_INT((iStack_94 + (iStack_94 >> 0x1f & 3U))) >> 2;
iStack_94 = 1;
if (1 < iVar7) {
iStack_94 = iVar7;
}
if ((this->_flags & 0x80000000000000) != 0) goto LAB_006b4d45;
LAB_006b4cca:
gibVelocity.y = 0.0;
gibVelocity.x = 0.0;
uVar5 = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this->_config) + 0x60));
iVar7 = iStack_94;
fVar9 = 1.0;
if ((uVar5 >> 0xd & 1) == 0) goto LAB_006b523c;
}
iVar7 = iStack_94;
gibVelocity.y = 0.0;
gibVelocity.x = 0.0;
if ((uVar5 >> 0xd & 1) == 0) {
gibSpeed = 2.0;
if (8 < iStack_94) {
iVar10 = 6;
goto LAB_006b4d65;
}
}
else {
gibSpeed = 4.0;
iVar10 = 0x18;
LAB_006b4d65:
(GHIDRA_CAST<Game *>((g_game)))->Game::ShakeScreen(iVar10);
}
iVar10 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8))));
if (iVar10 != *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc))))) {
pEStack_8c = GHIDRA_CAST<Entity *>(((this->_pos).y - *GHIDRA_CAST<float *>((iVar10 + 0x24))));
fStack_88 = (this->_pos).x - *GHIDRA_CAST<float *>((iVar10 + 0x20));
fVar9 = sqrtf((float)pEStack_8c * (float)pEStack_8c + fStack_88 * fStack_88);
gibVelocity.x = fStack_88;
pEVar6 = pEStack_8c;
if (0.0 < fVar9) {
gibVelocity.x = fStack_88 * (1.0 / fVar9);
pEVar6 = GHIDRA_CAST<Entity *>(((float)pEStack_8c * (1.0 / fVar9)));
}
gibVelocity.x = gibVelocity.x * 16.0;
gibVelocity.y = (float)pEVar6 * 16.0;
}
if ((6 < iVar7) && ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(this->_config) + 0x60)) & 1) != 0)) {
fStack_88 = (float)(iVar7 / 2);
if (fStack_88 == 0.0) {
uVar5 = 0;
}
else {
uVar5 = Random();
uVar5 = uVar5 % GHIDRA_UINT(fStack_88);
}
fStack_88 = (float)(GHIDRA_INT(fStack_88) + uVar5);
baseBloodColor._unk = 0;
baseBloodColor._red = 0.61960787;
baseBloodColor._green = 0.043137256;
baseBloodColor._blue = 0.05882353;
baseBloodColor._alpha = 1.0;
::Color::apply_to_kcolor(&bloodColor,&this->_splatColor,&baseBloodColor);
if (0 < GHIDRA_INT(fStack_88)) {
do {
uVar5 = Random();
fVar9 = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) *
2.3283064e-10 * 3.14;
pEStack_8c = GHIDRA_CAST<Entity *>((fVar9 + fVar9));
uVar5 = Random();
pEStack_90 = (Entity *)
((float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) *
2.3283064e-10 * 10.0);
dropVelX = cos((float)pEStack_8c);
dropVelX = dropVelX * (float)pEStack_90;
dropVelocity.x = dropVelX;
dropVelY = sin((float)pEStack_8c);
dropVelY = dropVelY * (float)pEStack_90;
dropVelocity.y = dropVelY;
uVar5 = Random();
rngValue = Random();
fVar9 = (float)((double)GHIDRA_INT(rngValue) + __uint_to_double_fixup[-(GHIDRA_INT(rngValue) >> 0x1f)]) *
2.3283064e-10 * 3.14;
pEStack_90 = GHIDRA_CAST<Entity *>((fVar9 + fVar9));
rngValue = Random();
pEStack_8c = (Entity *)
((float)((double)GHIDRA_INT(rngValue) +
__uint_to_double_fixup[-(GHIDRA_INT(rngValue) >> 0x1f)]) * 2.3283064e-10 *
20.0);
fVar9 = cos((float)pEStack_90);
VStack_78.x = fVar9 * (float)pEStack_8c + (this->_pos).x;
fVar9 = sin((float)pEStack_90);
VStack_78.y = fVar9 * (float)pEStack_8c + (this->_pos).y;
pEVar6 = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0x3b,&VStack_78,&dropVelocity,this,0,uVar5,0);
pEStack_90 = GHIDRA_CAST<Entity *>(0x3f800000);
if (((pEVar6->_pos).y - (this->_pos).y) * -dropVelX +
((pEVar6->_pos).x - (this->_pos).x) * dropVelY < 0.0) {
pEStack_90 = GHIDRA_CAST<Entity *>(&DAT_bf800000);
}
pEStack_8c = pEVar6;
uVar5 = Random();
iVar7 = *GHIDRA_CAST<int *>(pEVar6);
*GHIDRA_CAST<float *>((pEVar6[1]._sprite._animDefaultName._buf + 4)) =
((float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) *
2.3283064e-10 * 10.0 + 2.0) * (float)pEStack_90;
setColorFn = *(code **)(iVar7 + 0x3c);
uVar5 = Random();
tmpColor._offset[0] = 0.0;
tmpColor._offset[1] = 0.0;
tmpColor._offset[2] = 0.0;
tmpColor._colorize[0] = 0.0;
tmpColor._colorize[1] = 0.0;
tmpColor._colorize[2] = 0.0;
tmpColor._colorize[3] = 0.0;
tmpColor._tint[0] = bloodColor._red;
tmpColor._tint[1] = bloodColor._green;
tmpColor._tint[2] = bloodColor._blue;
tmpColor._tint[3] =
((float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) *
2.3283064e-10 * 0.25 + 0.1) * bloodColor._alpha;
(*setColorFn)(&tmpColor,0xffffffff,0xff,0,1);
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this->_config) + 0x60)) >> 0xd & 1) == 0) {
uVar5 = Random();
iVar7 = uVar5 % 0xf + 0xf;
unaff_EDI[0x117] = iVar7;
unaff_EDI[0x118] = iVar7;
}
else {
uVar5 = Random();
fVar9 = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) *
2.3283064e-10;
fVar8 = fVar9 + fVar9 + 2.0;
fVar9 = fVar8 * g_vectorOne.x;
unaff_EDI[0x3a] = GHIDRA_INT((fVar8 * g_vectorOne.y));
unaff_EDI[0x39] = GHIDRA_INT(fVar9);
uVar5 = Random();
iVar7 = uVar5 % 0x1e + 0x14;
unaff_EDI[0x117] = iVar7;
unaff_EDI[0x118] = iVar7;
unaff_EDI[0xd8] = GHIDRA_INT(((float)unaff_EDI[0xd8] * 4.0));
unaff_EDI[0xd9] = GHIDRA_INT(((float)unaff_EDI[0xd9] * 4.0));
}
(**(code **)(*unaff_EDI + 0xc))();
fStack_88 = (float)(GHIDRA_INT(fStack_88) + -1);
} while (fStack_88 != 0.0);
fStack_88 = 0.0;
iVar7 = iStack_94;
}
}
fVar9 = gibSpeed;
LAB_006b523c:
spawn_gibs(&this->_pos,iVar7,this->_size,GHIDRA_CAST<uint32_t *>((GHIDRA_INT(this->_config) + 0x60)),this,
&this->_splatColor,&gibVelocity,fVar9);
if (((this->_type != 4) && (this->_type != 5)) && ((this->_flags & 0x10000) == 0)) {
uVar5 = Random();
pEVar6 = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,7,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar5,0);
pEVar6->SetColor(&this->_splatColor,0xffffffff,0xff,0,1);
bVar4 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0x17);
if (bVar4 != 0) {
(pEVar6->_sprite)._scale.x = 2.0;
(pEVar6->_sprite)._scale.y = 2.0;
}
pEVar6->Update();
}
return;
}
// 006b5b90
uint8_t Entity::IsActiveEnemy(uint8_t includeDead)
{
bool isExcludedType;
int entityType;
if ((*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2) || (this->_type != 1)) {
entityType = this->_type;
if (0x3dd < entityType - 10U) {
return 0;
}
if (entityType == 0x21) {
return 0;
}
if (entityType == 0x11) {
return 0;
}
if (entityType == 0x124) {
return 0;
}
if (entityType == 0x375) {
isExcludedType = this->_variant == 10;
}
else {
if (entityType == 0x3c0) {
return 0;
}
if (entityType == 0x3c5) {
return 0;
}
isExcludedType = entityType == 0xf5;
}
if (isExcludedType) {
return 0;
}
}
if ((this->_dead == 0) || (includeDead != 0)) {
return 1;
}
return 0;
}
// 006b5c10
void Entity::AddShrink(EntityRef *ref, int duration, uint8_t ignoreBossStatusCooldown, uint8_t unk)
{
uint8_t bVar1;
char cVar2;
Entity_NPC *npc;
int newCountdown;
int extraout_EDX;
Entity *statusOwner;
Entity *ancestor;
uint32_t flagsHigh;
uint32_t flagsLow;
Entity *nextParent;
int oldCountdown;
uint64_t oldFlags;
if (((unk != 0) || (bVar1 = IsDamageSourceFriendly(this,ref), bVar1 == 0)) &&
(cVar2 = this->IsBoss(), cVar2 == '\0')) {
apply_second_hand_duration(this,duration,ref);
bVar1 = DoesEntityShareStatus(this);
statusOwner = this;
if (bVar1 != 0) {
nextParent = GHIDRA_CAST<Entity *>(this->_parent);
statusOwner = this;
while (ancestor = nextParent, ancestor != GHIDRA_CAST<Entity *>(0x0)) {
statusOwner = ancestor;
nextParent = GHIDRA_CAST<Entity *>(ancestor->_parent);
}
}
oldFlags = statusOwner->_flags;
if ((unk != 0) ||
(((extraout_EDX != 0 && ((oldFlags & 1) == 0)) &&
((statusOwner->_bossStatusEffectCooldown < 1 || (ignoreBossStatusCooldown != 0)))))) {
oldCountdown = statusOwner->_shrinkCountdown;
if (extraout_EDX < 1) {
newCountdown = oldCountdown;
if (oldCountdown < -extraout_EDX) {
newCountdown = -extraout_EDX;
}
}
else {
newCountdown = 0x96;
if (oldCountdown + extraout_EDX < 0x96) {
newCountdown = oldCountdown + extraout_EDX;
}
}
statusOwner->_shrinkCountdown = newCountdown;
flagsLow = GHIDRA_UINT(statusOwner->_flags);
if ((flagsLow & 0x1000000) == 0) {
flagsHigh = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&statusOwner->_flags) + 4));
*GHIDRA_CAST<uint32_t *>(&statusOwner->_flags) = flagsLow | 0x1000000;
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&statusOwner->_flags) + 4)) = flagsHigh;
statusOwner->_shrinkStatus2 = 0.333;
SetSize(this,*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this->_config) + 0x38)) * this->_shrinkStatus1,
(Vector)(CONCAT44(g_vectorOne.y,g_vectorOne.x) ^ 0x8000000080000000),-1);
}
if ((ignoreBossStatusCooldown == 0) && (cVar2 = FUN_006ae7a0(), cVar2 != '\0')) {
statusOwner->_bossStatusEffectCooldown = 0xf0;
}
CopyStatusEffects(statusOwner);
if ((((0 < statusOwner->_shrinkCountdown) && ((oldFlags & 0x1000800) == 0)) &&
(bVar1 = IsEnemy(statusOwner), bVar1 != 0)) &&
(npc = (Entity_NPC *)
__RTDynamicCast(statusOwner,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor,
&IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0),
npc != GHIDRA_CAST<Entity_NPC *>(0x0))) {
(GHIDRA_CAST<Entity_NPC *>((npc)))->Entity_NPC::ResetPathFinderTarget();
}
}
}
return;
}
// 006b5e60
void * Entity::GetData(void *outRef)
{
void *luaState;
uint32_t *luaRef;
uint32_t uVar1;
int refId;
luaRef = this->_luaBridgeRef;
if (luaRef == GHIDRA_CAST<uint32_t *>(0x0)) {
luaRef = operator_new(8);
if (luaRef == GHIDRA_CAST<uint32_t *>(0x0)) {
luaRef = GHIDRA_CAST<uint32_t *>(0x0);
}
else {
uVar1 = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(g_luaEngine) + 0x18));
lua_createtable(uVar1,0,0);
*luaRef = uVar1;
uVar1 = luaL_ref(uVar1,0xfff0b9d8);
luaRef[1] = uVar1;
}
this->_luaBridgeRef = luaRef;
}
refId = luaRef[1];
luaState = (void *)*luaRef;
*(void **)outRef = luaState;
if (refId == -1) {
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(outRef) + 4)) = 0xffffffff;
return outRef;
}
(GHIDRA_CAST<LuaRef *>((luaRef)))->LuaRef::push(luaState);
uVar1 = luaL_ref(*luaRef,0xfff0b9d8);
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(outRef) + 4)) = uVar1;
return outRef;
}
// 006b5f10
void * Entity::GetDebugShape(uint8_t isUnknown)
{
void *debugShape;
debugShape = (GHIDRA_CAST<DebugRenderer *>((GHIDRA_CAST<DebugRenderer *>(&g_game->_debugRenderer))))->DebugRenderer::Get(this->_index,isUnknown);
return debugShape;
}
// 006b62b0
uint32_t Entity::GetHitListIndex()
{
Entity *statusTarget;
int entityType;
if (((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (this->_type == 1)) ||
(entityType = this->_type, 0x3dd < entityType - 10U)) goto switchD_006b62ec_caseD_14;
if (entityType < 0xd9) {
if (entityType != 0xd8) {
switch(entityType) {
case 0x13:
case 0x1c:
case 0x23:
case 0x3e:
case 0x59:
break;
default:
goto switchD_006b62ec_caseD_14;
}
}
if ((entityType == 0x59) || (entityType == 0x13)) goto switchD_006b62ec_caseD_14;
if ((entityType != 0x1c) || (this->_variant != 2)) goto LAB_006b633c;
}
else {
if (entityType < 0x38e) {
if (((entityType != 0x38d) && (entityType != 0xef)) &&
((entityType != 0xf4 || (this->_variant != 2)))) goto switchD_006b62ec_caseD_14;
}
else if ((entityType != 0x390) && (entityType != 0x396)) goto switchD_006b62ec_caseD_14;
LAB_006b633c:
if ((entityType != 0x3e) || (this->_variant != 1)) goto LAB_006b6350;
}
if (this->_child != 0) {
switchD_006b62ec_caseD_14:
return this->_index;
}
LAB_006b6350:
statusTarget = GetStatusEffectTarget(this);
return statusTarget->_index;
}
// 006b63b0
Vector * Entity::GetForwardVector(Vector *outForward)
{
float length;
float velocityX;
float velocityY;
velocityY = (this->_velocity).y;
velocityX = (this->_velocity).x;
if (velocityX * velocityX + velocityY * velocityY <= 0.01) {
outForward->x = 0.0;
outForward->y = 1.0;
}
else {
velocityX = (this->_velocity).x;
outForward->y = (this->_velocity).y;
velocityY = outForward->y;
outForward->x = velocityX;
velocityX = outForward->x;
length = sqrtf(velocityY * velocityY + velocityX * velocityX);
if (0.0 < length) {
outForward->x = velocityX * (1.0 / length);
outForward->y = velocityY * (1.0 / length);
return outForward;
}
}
return outForward;
}
// 006b6550
Entity_Effect * Entity::MakeGroundPoof(Vector *position, ColorMod *color, float size)
{
uint32_t rngResult;
Entity *firstPoof;
Entity *secondPoof;
int *unaff_EDI;
float fVar1;
Entity_Effect *pEVar2;
float fVar3;
uint8_t auStack_12 [14];
int vtable;
rngResult = Random();
firstPoof = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0x10,position,&g_vectorZero,this,1,rngResult,0);
fVar3 = 1.4013e-45;
vtable = *GHIDRA_CAST<int *>(firstPoof);
(firstPoof->_sprite)._scale.x = size;
(firstPoof->_sprite)._scale.y = size;
pEVar2 = GHIDRA_CAST<Entity_Effect *>(color);
(**(code **)(vtable + 0x3c))();
rngResult = Random();
*GHIDRA_CAST<uint8_t *>((unaff_EDI + 0x52)) = ~(uint8_t)rngResult & 1;
(**(code **)(*unaff_EDI + 0xc))();
rngResult = Random();
secondPoof = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0x10,position,&g_vectorZero,this,2,rngResult,0);
fVar1 = 1.4013e-45;
vtable = *GHIDRA_CAST<int *>(secondPoof);
(secondPoof->_sprite)._scale.x = fVar3;
(secondPoof->_sprite)._scale.y = fVar3;
(**(code **)(vtable + 0x3c))(color,0xffffffff,0xff,0);
(secondPoof->_posOffset).x = 0.0;
(secondPoof->_posOffset).y = fVar1 * -40.0;
rngResult = Random();
(secondPoof->_sprite)._flipX = ~(uint8_t)rngResult & 1;
secondPoof->Update();
if (pEVar2->_child != 0) {
msvc::multiset<unsigned_int>::erase(auStack_12 + -0x22);
}
pEVar2->_child = secondPoof;
msvc::multiset<unsigned_int>::insert(&pEVar2->_child);
return pEVar2;
}
// 006b66a0
Entity_Effect * Entity::MakeGroundPoofAtSelf(ColorMod *color, float size)
{
Entity_Effect *poof;
poof = MakeGroundPoof(this,&this->_pos,color,size);
return poof;
}
// 006b66c0
Entity_Effect * Entity::MakeBloodPoof(Vector *position, ColorMod *color, float scale)
{
uint32_t rngResult;
Entity *poof;
Entity *childPoof;
int *unaff_EDI;
float fVar1;
Entity_Effect *pEVar2;
float fVar3;
uint8_t auStack_12 [14];
int vtable;
rngResult = Random();
poof = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0x10,position,&g_vectorZero,this,3,rngResult,0);
fVar3 = 1.4013e-45;
vtable = *GHIDRA_CAST<int *>(poof);
(poof->_sprite)._scale.x = scale;
(poof->_sprite)._scale.y = scale;
pEVar2 = GHIDRA_CAST<Entity_Effect *>(color);
(**(code **)(vtable + 0x3c))();
rngResult = Random();
*GHIDRA_CAST<uint8_t *>((unaff_EDI + 0x52)) = ~(uint8_t)rngResult & 1;
(**(code **)(*unaff_EDI + 0xc))();
rngResult = Random();
childPoof = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0x10,position,&g_vectorZero,this,4,rngResult,0);
fVar1 = 1.4013e-45;
vtable = *GHIDRA_CAST<int *>(childPoof);
(childPoof->_sprite)._scale.x = fVar3;
(childPoof->_sprite)._scale.y = fVar3;
(**(code **)(vtable + 0x3c))(color,0xffffffff,0xff,0);
(childPoof->_posOffset).x = 0.0;
(childPoof->_posOffset).y = fVar1 * -40.0;
rngResult = Random();
(childPoof->_sprite)._flipX = ~(uint8_t)rngResult & 1;
childPoof->Update();
if (pEVar2->_child != 0) {
msvc::multiset<unsigned_int>::erase(auStack_12 + -0x22);
}
pEVar2->_child = childPoof;
msvc::multiset<unsigned_int>::insert(&pEVar2->_child);
return pEVar2;
}
// 006b6810
Entity_Effect * Entity::MakeBloodPoofAtPos(ColorMod *color, float scale)
{
Entity_Effect *pEVar1;
pEVar1 = MakeBloodPoof(this,&this->_pos,color,scale);
return pEVar1;
}
// 006b6af0
Vector * Entity::GetNullOffset(Vector *outOffset, uint8_t *nullLayerName)
{
float *nullFrame;
float fVar1;
float cosRotation;
float fVar2;
Vector offset;
if ((this->_sprite)._animState._animData != (void *)0x0) {
nullFrame = AnimationState::GetNullFrame(&(this->_sprite)._animState,nullLayerName);
if ((nullFrame != GHIDRA_CAST<float *>(0x0)) && (*GHIDRA_CAST<char *>((nullFrame + 3)) != '\0')) {
offset.x = (*nullFrame / 0.65) * (this->_sprite)._scale.x;
offset.y = (nullFrame[1] / 0.65) * (this->_sprite)._scale.y;
if ((this->_sprite)._flipX != 0) {
offset.x = -offset.x;
}
if ((this->_sprite)._flipY != 0) {
offset.y = -offset.y;
}
fVar1 = (this->_sprite)._rotation;
if (fVar1 != 0.0) {
fVar1 = fVar1 * 0.017453292;
cosRotation = cos(fVar1);
fVar1 = sin(fVar1);
fVar2 = fVar1 * offset.y;
offset.y = cosRotation * offset.y + fVar1 * offset.x;
offset.x = cosRotation * offset.x - fVar2;
}
outOffset->x = offset.x;
outOffset->y = offset.y;
return outOffset;
}
}
fVar1 = g_vectorZero.y;
outOffset->x = g_vectorZero.x;
outOffset->y = fVar1;
return outOffset;
}
// 006b6c20
Capsule * Entity::GetNullCapsule(Capsule *outCapsule, uint8_t *nullLayerName)
{
float *nullFrame;
float fVar1;
float rotatedYTerm;
float capsuleRotation;
float offsetX;
float offsetY;
Vector scratchVec;
Vector capsuleSize;
if ((this->_sprite)._animState._animData != (void *)0x0) {
nullFrame = AnimationState::GetNullFrame(&(this->_sprite)._animState,nullLayerName);
if ((nullFrame != GHIDRA_CAST<float *>(0x0)) && (*GHIDRA_CAST<char *>((nullFrame + 3)) != '\0')) {
capsuleSize.x = (this->_sprite)._scale.x;
offsetX = (*nullFrame / 0.65) * capsuleSize.x;
capsuleSize.x = ((nullFrame[4] * 4.0) / 0.65) * capsuleSize.x;
capsuleSize.y = (this->_sprite)._scale.y;
capsuleRotation = nullFrame[0x11];
offsetY = (nullFrame[1] / 0.65) * capsuleSize.y;
capsuleSize.y = ((nullFrame[5] * 4.0) / 0.65) * capsuleSize.y;
if ((this->_sprite)._flipX != 0) {
capsuleSize.x = -capsuleSize.x;
}
if ((this->_sprite)._flipY != 0) {
capsuleSize.y = -capsuleSize.y;
}
if (capsuleSize.x < 0.0) {
capsuleSize.x = -capsuleSize.x;
capsuleRotation = 180.0 - capsuleRotation;
offsetX = -offsetX;
}
if (capsuleSize.y < 0.0) {
capsuleSize.y = -capsuleSize.y;
offsetY = -offsetY;
capsuleRotation = -capsuleRotation;
}
fVar1 = (this->_sprite)._rotation;
if (fVar1 != 0.0) {
fVar1 = fVar1 * 0.017453292;
scratchVec.x = cos(fVar1);
fVar1 = sin(fVar1);
capsuleRotation = (this->_sprite)._rotation + capsuleRotation;
rotatedYTerm = offsetY * fVar1;
offsetY = offsetY * scratchVec.x + fVar1 * offsetX;
offsetX = scratchVec.x * offsetX - rotatedYTerm;
}
scratchVec.x = offsetX + (this->_pos).x;
scratchVec.y = offsetY + (this->_pos).y;
(GHIDRA_CAST<Capsule *>((outCapsule)))->Capsule::constructor(&scratchVec,&capsuleSize,capsuleRotation,1.0);
return outCapsule;
}
}
(GHIDRA_CAST<Capsule *>((outCapsule)))->Capsule::constructor(&this->_pos,&g_vectorZero,0.0,0.0);
return outCapsule;
}
// 006b6ed0
int * Entity::get_water_splash_variant(int *outSplash)
{
int iVar1;
uint8_t bVar2;
bool isBelowThreshold;
bool isAtThreshold;
int entityType;
float offsetY;
entityType = this->_type;
if (entityType == 1000) {
if (((this->_variant == 0x85) || (this->_variant == 0x86)) || (this->_variant == 0x8a))
goto LAB_006b6fce;
if (this->_variant == 0x8e) {
if (this->_subtype == 0) {
*outSplash = 0x40;
outSplash[1] = 0;
return outSplash;
}
}
else {
if (this->_variant == 0x9e) goto LAB_006b70a1;
if (((this->_variant == 99) || (this->_variant == 0x1e)) || (this->_variant == 0x99))
goto LAB_006b6fce;
}
iVar1 = this->_variant;
if (((iVar1 == 0xa8) || (iVar1 == 0x10)) || ((iVar1 == 0xa1 || (iVar1 == 0xbd))))
goto LAB_006b6f7a;
}
else if (entityType == 7) goto LAB_006b704a;
if (this->_sortingLayer == 0) {
LAB_006b70a1:
*outSplash = 0x26;
outSplash[1] = 0;
return outSplash;
}
if (this->_sortingLayer == 1) {
*outSplash = 0x25;
outSplash[1] = 0;
return outSplash;
}
if (entityType == 5) {
if (this[1]._sprite._championColor._tint[2] != 0.0) {
LAB_006b6fce:
*outSplash = 0x40;
outSplash[1] = 0;
return outSplash;
}
}
else if ((((entityType == 1000) && (this->_variant == 0xf)) && (this->_spawnerType == 0x327)) &&
(bVar2 = (GHIDRA_CAST<Room *>((g_game->_room)))->Room::IsMirrorWorld(), bVar2 == 0)) {
*outSplash = 0x1b;
outSplash[1] = -0x40000000;
return outSplash;
}
entityType = this->_type;
if (((entityType == 2) || (entityType == 9)) || (entityType == 1000)) {
LAB_006b704a:
outSplash[1] = 0x40000000;
*outSplash = 0x19;
return outSplash;
}
if (entityType == 3) {
if (this->_variant == 0x4f) goto LAB_006b704a;
LAB_006b7131:
if (entityType == 0x32f) {
offsetY = (this->_posOffset).y;
isAtThreshold = offsetY == 0.0;
isBelowThreshold = offsetY < 0.0;
LAB_006b7143:
if (!isBelowThreshold && !isAtThreshold) {
*outSplash = 0x24;
outSplash[1] = 0;
return outSplash;
}
}
else if (entityType == 0x3e) {
if (this->_variant == 3) {
offsetY = (this->_posOffset).y;
outSplash[1] = -0x40000000;
if (0.0 <= offsetY) {
*outSplash = 0x26;
return outSplash;
}
if (offsetY < -16.0) {
*outSplash = 0x19;
return outSplash;
}
*outSplash = 0x80;
return outSplash;
}
}
else if ((entityType == 1) &&
(bVar2 = (GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(this))))->Entity_Player::HasCollectible(0x3e,0), bVar2 != 0)) {
*outSplash = 0x39;
outSplash[1] = -0x40000000;
return outSplash;
}
}
else {
if (((entityType == 0xf0) || (entityType == 0xf2)) ||
((entityType == 0xf1 || (entityType == 0x130)))) goto LAB_006b6f7a;
if (entityType == 0x21) {
if (this->_health <= 1.0) goto LAB_006b70a1;
}
else {
if (entityType == 0x32a) {
offsetY = (this->_posOffset).y;
isAtThreshold = offsetY == -3.0;
isBelowThreshold = offsetY < -3.0;
goto LAB_006b7143;
}
if (entityType == 0x32e) {
*outSplash = 0x99;
outSplash[1] = 0;
return outSplash;
}
if ((entityType == 0x366) || (entityType == 0x367)) {
*outSplash = 0x80;
outSplash[1] = 0;
return outSplash;
}
if (entityType != 0x331) goto LAB_006b7131;
if (this->_variant == 1) goto LAB_006b6f7a;
}
}
if (this->_type == 1) {
bVar2 = IsFlying(this);
if (bVar2 != 0) {
LAB_006b6f7a:
outSplash[1] = 0;
*outSplash = 0x19;
return outSplash;
}
}
else if ((((this->_type == 5) && (this->_variant == 100)) &&
(this[1]._sprite._championColor._tint[2] == 0.0)) &&
(((this->_sprite)._overlayAnimState._animData == (void *)0x0 ||
(GHIDRA_INT((this->_sprite)._overlayAnimState._animFrame) != 0)))) {
outSplash[1] = -0x3f600000;
*outSplash = 0x19;
return outSplash;
}
outSplash[1] = -0x40000000;
*outSplash = 0x19;
return outSplash;
}
// 006b7280
void Entity::AddMagnetized(EntityRef *ref, int duration, uint8_t unused)
{
uint32_t *puVar1;
uint64_t qVar2;
uint8_t bVar3;
char cVar4;
uint32_t uVar5;
Entity *statusEffect;
uint32_t uVar6;
int newCountdown;
int extraout_EDX;
Entity *statusOwner;
uint32_t *puStack_68;
EntityRef *savedRef;
EntityRef sourceRef;
ColorMod magnetColor;
uint32_t *effectParentSlot;
int oldCountdown;
Entity *parent;
savedRef = ref;
bVar3 = IsDamageSourceFriendly(this,ref);
if (bVar3 != 0) {
return;
}
apply_second_hand_duration(this,duration,ref);
bVar3 = DoesEntityShareStatus(this);
statusOwner = this;
if (bVar3 != 0) {
statusEffect = GHIDRA_CAST<Entity *>(this->_parent);
statusOwner = this;
while (parent = statusEffect, parent != GHIDRA_CAST<Entity *>(0x0)) {
statusOwner = parent;
statusEffect = GHIDRA_CAST<Entity *>(parent->_parent);
}
}
if (extraout_EDX == 0) {
return;
}
if ((statusOwner->_flags & 1) != 0) {
return;
}
if (0 < statusOwner->_bossStatusEffectCooldown) {
return;
}
oldCountdown = statusOwner->_magnetizedCountdown;
if (extraout_EDX < 1) {
newCountdown = oldCountdown;
if (oldCountdown < -extraout_EDX) {
newCountdown = -extraout_EDX;
}
}
else {
newCountdown = 300;
if (oldCountdown + extraout_EDX < 300) {
newCountdown = oldCountdown + extraout_EDX;
}
}
statusOwner->_magnetizedCountdown = newCountdown;
magnetColor._tint[0] = 0.6;
magnetColor._tint[1] = 0.6;
magnetColor._tint[2] = 0.6;
magnetColor._tint[3] = 1.0;
magnetColor._colorize[0] = 1.0;
magnetColor._colorize[1] = 1.0;
magnetColor._colorize[2] = 1.0;
magnetColor._colorize[3] = 0.9;
magnetColor._offset[0] = 0.0;
magnetColor._offset[1] = 0.0;
magnetColor._offset[2] = 0.0;
statusOwner->SetColor(&magnetColor,statusOwner->_magnetizedCountdown,0xff,0,1)
;
qVar2 = statusOwner->_flags;
puVar1 = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&statusOwner->_flags) + 4));
*puVar1 = *puVar1 | 0x80000;
*GHIDRA_CAST<int *>(&statusOwner->_flags) = GHIDRA_INT(qVar2);
cVar4 = FUN_006ae7a0();
if (cVar4 != '\0') {
statusOwner->_bossStatusEffectCooldown = 0xf0;
}
CopyStatusEffects(statusOwner);
if (statusOwner->_iceFrozenEffect == 0) {
uVar5 = Random();
statusEffect = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0x39,&statusOwner->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,
uVar5,0);
statusOwner->_iceFrozenEffect = statusEffect;
effectParentSlot = &statusEffect->_parent;
if (statusEffect->_parent != 0) {
puStack_68 = effectParentSlot;
msvc::multiset<unsigned_int>::erase(&puStack_68);
}
*effectParentSlot = statusOwner;
msvc::multiset<unsigned_int>::insert(effectParentSlot);
ref = savedRef;
}
sourceRef._entity = ref->_entity;
if (sourceRef._entity == (void *)0x0) {
sourceRef._type = 0;
LAB_006b74a5:
sourceRef._variant = 0;
sourceRef._spawnerType = 0;
sourceRef._spawnerVariant = 0;
sourceRef._position.x = g_vectorZero.x;
sourceRef._position.y = g_vectorZero.y;
sourceRef._velocity.x = g_vectorZero.x;
sourceRef._velocity.y = g_vectorZero.y;
LAB_006b74e5:
sourceRef._flags = 0;
if (sourceRef._entity != (void *)0x0) goto LAB_006b74eb;
sourceRef._flags = 0;
LAB_006b7504:
uVar5 = 0;
if (sourceRef._entity != (void *)0x0) goto LAB_006b750a;
}
else {
while (*(void **)(GHIDRA_CAST<char *>(sourceRef._entity) + 0x3c8) != (void *)0x0) {
sourceRef._entity = *(void **)(GHIDRA_CAST<char *>(sourceRef._entity) + 0x3c8);
}
sourceRef._type = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x28));
if (sourceRef._entity == (void *)0x0) goto LAB_006b74a5;
sourceRef._variant = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x2c));
sourceRef._position.x = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x33c));
sourceRef._position.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x340));
sourceRef._spawnerType = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x34));
sourceRef._spawnerVariant = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x38));
sourceRef._velocity.x = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x360));
sourceRef._velocity.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x364));
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x168)) & 0x100) == 0) goto LAB_006b74e5;
sourceRef._flags = 1;
LAB_006b74eb:
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x168)) & 0x20000000) == 0) goto LAB_006b7504;
uVar5 = 2;
LAB_006b750a:
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x16c)) & 0x400000) != 0) {
uVar6 = 4;
goto LAB_006b7525;
}
}
uVar6 = 0;
LAB_006b7525:
sourceRef._flags = uVar6 | uVar5 | sourceRef._flags;
(GHIDRA_CAST<EntityRef *>((&this->_entityRef3)))->EntityRef::operator_(&sourceRef);
return;
}
// 006b7560
void Entity::AddBaited(EntityRef *ref, int duration, uint8_t unused)
{
uint8_t bVar1;
char cVar2;
uint32_t uVar3;
int newCountdown;
int extraout_EDX;
uint32_t uVar4;
Entity *statusTarget;
uint8_t auStack_64 [4];
EntityRef sourceRef;
uint32_t local_38;
uint32_t uStack_34;
uint32_t uStack_30;
uint32_t uStack_2c;
uint32_t local_28;
uint32_t uStack_24;
uint32_t uStack_20;
uint32_t uStack_1c;
uint32_t local_18;
uint32_t local_14;
uint32_t local_10;
uint32_t local_c;
int baitedCountdown;
uint32_t *flagsHigh;
Entity *nextParent;
uint64_t oldFlags;
Entity *parent;
local_c = __security_cookie ^ GHIDRA_UINT(auStack_64);
bVar1 = IsDamageSourceFriendly(this,ref);
if (bVar1 != 0) {
return;
}
apply_second_hand_duration(this,duration,ref);
bVar1 = DoesEntityShareStatus(this);
statusTarget = this;
if (bVar1 != 0) {
nextParent = GHIDRA_CAST<Entity *>(this->_parent);
while (parent = nextParent, parent != GHIDRA_CAST<Entity *>(0x0)) {
statusTarget = parent;
nextParent = GHIDRA_CAST<Entity *>(parent->_parent);
}
}
if (extraout_EDX == 0) {
return;
}
if ((statusTarget->_flags & 1) != 0) {
return;
}
if (0 < statusTarget->_bossStatusEffectCooldown) {
return;
}
baitedCountdown = statusTarget->_baitedCountdown;
if (extraout_EDX < 1) {
newCountdown = baitedCountdown;
if (baitedCountdown < -extraout_EDX) {
newCountdown = -extraout_EDX;
}
}
else {
newCountdown = 300;
if (baitedCountdown + extraout_EDX < 300) {
newCountdown = baitedCountdown + extraout_EDX;
}
}
statusTarget->_baitedCountdown = newCountdown;
local_38 = 0x3f333333;
uStack_34 = 0x3e0f5c29;
uStack_30 = 0x3dcccccd;
uStack_2c = 0x3f800000;
local_18 = 0x3e99999a;
local_28 = 0;
uStack_24 = 0;
uStack_20 = 0;
uStack_1c = 0;
local_14 = 0;
local_10 = 0;
statusTarget->SetColor(&local_38,statusTarget->_baitedCountdown,0xff,0,1);
oldFlags = statusTarget->_flags;
flagsHigh = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&statusTarget->_flags) + 4));
*flagsHigh = *flagsHigh | 0x100000;
*GHIDRA_CAST<int *>(&statusTarget->_flags) = GHIDRA_INT(oldFlags);
cVar2 = FUN_006ae7a0();
if (cVar2 != '\0') {
statusTarget->_bossStatusEffectCooldown = 0xf0;
}
CopyStatusEffects(statusTarget);
sourceRef._entity = ref->_entity;
if (sourceRef._entity == (void *)0x0) {
sourceRef._type = 0;
LAB_006b7715:
sourceRef._variant = 0;
sourceRef._spawnerType = 0;
sourceRef._spawnerVariant = 0;
sourceRef._position.x = g_vectorZero.x;
sourceRef._position.y = g_vectorZero.y;
sourceRef._velocity.x = g_vectorZero.x;
sourceRef._velocity.y = g_vectorZero.y;
LAB_006b7755:
sourceRef._flags = 0;
if (sourceRef._entity != (void *)0x0) goto LAB_006b775b;
sourceRef._flags = 0;
LAB_006b7774:
uVar4 = 0;
if (sourceRef._entity != (void *)0x0) goto LAB_006b777a;
}
else {
while (*(void **)(GHIDRA_CAST<char *>(sourceRef._entity) + 0x3c8) != (void *)0x0) {
sourceRef._entity = *(void **)(GHIDRA_CAST<char *>(sourceRef._entity) + 0x3c8);
}
sourceRef._type = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x28));
if (sourceRef._entity == (void *)0x0) goto LAB_006b7715;
sourceRef._variant = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x2c));
sourceRef._position.x = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x33c));
sourceRef._position.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x340));
sourceRef._spawnerType = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x34));
sourceRef._spawnerVariant = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x38));
sourceRef._velocity.x = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x360));
sourceRef._velocity.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x364));
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x168)) & 0x100) == 0) goto LAB_006b7755;
sourceRef._flags = 1;
LAB_006b775b:
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x168)) & 0x20000000) == 0) goto LAB_006b7774;
uVar4 = 2;
LAB_006b777a:
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x16c)) & 0x400000) != 0) {
uVar3 = 4;
goto LAB_006b7795;
}
}
uVar3 = 0;
LAB_006b7795:
sourceRef._flags = uVar3 | uVar4 | sourceRef._flags;
(GHIDRA_CAST<EntityRef *>((&this->_entityRef4)))->EntityRef::operator_(&sourceRef);
return;
}
// 006b77d0
void Entity::AddWeakness(EntityRef *ref, int duration)
{
uint8_t bVar1;
int newCountdown;
int extraout_EDX;
ColorMod weaknessColor;
Entity *ancestor;
uint32_t *flagsHigh;
Entity *nextParent;
int oldCountdown;
uint64_t oldFlags;
bVar1 = IsDamageSourceFriendly(this,ref);
if (bVar1 == 0) {
apply_second_hand_duration(this,-3,ref);
bVar1 = DoesEntityShareStatus(this);
if (bVar1 != 0) {
nextParent = GHIDRA_CAST<Entity *>(this->_parent);
while (ancestor = nextParent, ancestor != GHIDRA_CAST<Entity *>(0x0)) {
this = ancestor;
nextParent = GHIDRA_CAST<Entity *>(ancestor->_parent);
}
}
if (extraout_EDX != 0) {
oldCountdown = this->_weaknessCountdown;
if (extraout_EDX < 1) {
newCountdown = oldCountdown;
if (oldCountdown < -extraout_EDX) {
newCountdown = -extraout_EDX;
}
}
else {
newCountdown = 300;
if (oldCountdown + extraout_EDX < 300) {
newCountdown = oldCountdown + extraout_EDX;
}
}
this->_weaknessCountdown = newCountdown;
weaknessColor._tint[0] = 1.0;
weaknessColor._tint[1] = 1.0;
weaknessColor._tint[2] = 1.0;
weaknessColor._tint[3] = 1.0;
weaknessColor._colorize[0] = 1.3;
weaknessColor._colorize[1] = 0.9;
weaknessColor._colorize[2] = 1.5;
weaknessColor._colorize[3] = 0.6;
weaknessColor._offset[0] = 0.0;
weaknessColor._offset[1] = 0.0;
weaknessColor._offset[2] = 0.0;
this->SetColor(&weaknessColor,this->_weaknessCountdown,0xff,0,1);
oldFlags = this->_flags;
flagsHigh = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
*flagsHigh = *flagsHigh | 0x400000;
*GHIDRA_CAST<int *>(&this->_flags) = GHIDRA_INT(oldFlags);
CopyStatusEffects(this);
}
}
return;
}
// 006b78d0
void Entity::AddBrimstoneMark(EntityRef *ref, int duration)
{
uint32_t *puVar1;
uint64_t qVar2;
uint8_t bVar3;
int newCountdown;
int extraout_EDX;
uint32_t markColor;
uint32_t uStack_30;
uint32_t uStack_2c;
uint32_t uStack_28;
uint32_t local_24;
uint32_t uStack_20;
uint32_t uStack_1c;
uint32_t uStack_18;
uint32_t local_14;
uint32_t local_10;
uint32_t local_c;
uint32_t local_8;
Entity *ancestor;
int currentCountdown;
Entity *nextParent;
local_8 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
bVar3 = IsDamageSourceFriendly(this,ref);
if (bVar3 == 0) {
apply_second_hand_duration(this,duration,ref);
bVar3 = DoesEntityShareStatus(this);
if (bVar3 != 0) {
nextParent = GHIDRA_CAST<Entity *>(this->_parent);
while (ancestor = nextParent, ancestor != GHIDRA_CAST<Entity *>(0x0)) {
this = ancestor;
nextParent = GHIDRA_CAST<Entity *>(ancestor->_parent);
}
}
if (extraout_EDX != 0) {
currentCountdown = this->_brimstoneMarkCountdown;
if (extraout_EDX < 1) {
newCountdown = currentCountdown;
if (currentCountdown < -extraout_EDX) {
newCountdown = -extraout_EDX;
}
}
else {
newCountdown = 300;
if (currentCountdown + extraout_EDX < 300) {
newCountdown = currentCountdown + extraout_EDX;
}
}
this->_brimstoneMarkCountdown = newCountdown;
markColor = 0x3f800000;
uStack_30 = 0x3f800000;
uStack_2c = 0x3f800000;
uStack_28 = 0x3f800000;
local_24 = 0x3f800000;
uStack_20 = 0;
uStack_1c = 0;
uStack_18 = 0x3e4ccccd;
local_14 = 0;
local_10 = 0;
local_c = 0;
this->SetColor(&markColor,this->_brimstoneMarkCountdown,0xff,0,1);
qVar2 = this->_flags;
puVar1 = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
*puVar1 = *puVar1 | 0x1000000;
*GHIDRA_CAST<int *>(&this->_flags) = GHIDRA_INT(qVar2);
CopyStatusEffects(this);
}
}
return;
}
// 006b79d0
void Entity::AddIce(EntityRef *ref, int duration)
{
uint32_t *puVar1;
uint64_t qVar2;
uint8_t bVar3;
char cVar4;
int newIceCountdown;
int extraout_EDX;
Entity *ancestor;
Entity *nextParent;
int oldIceCountdown;
bVar3 = IsDamageSourceFriendly(this,ref);
if ((bVar3 == 0) && (cVar4 = this->IsBoss(), cVar4 == '\0')) {
apply_second_hand_duration(this,duration,ref);
bVar3 = DoesEntityShareStatus(this);
if (bVar3 != 0) {
nextParent = GHIDRA_CAST<Entity *>(this->_parent);
while (ancestor = nextParent, ancestor != GHIDRA_CAST<Entity *>(0x0)) {
this = ancestor;
nextParent = GHIDRA_CAST<Entity *>(ancestor->_parent);
}
}
oldIceCountdown = this->_iceCountdown;
if (extraout_EDX < 1) {
newIceCountdown = oldIceCountdown;
if (oldIceCountdown < -extraout_EDX) {
newIceCountdown = -extraout_EDX;
}
}
else {
newIceCountdown = 300;
if (oldIceCountdown + extraout_EDX < 300) {
newIceCountdown = oldIceCountdown + extraout_EDX;
}
}
this->_iceCountdown = newIceCountdown;
qVar2 = this->_flags;
puVar1 = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
*puVar1 = *puVar1 | 0x40000;
*GHIDRA_CAST<int *>(&this->_flags) = GHIDRA_INT(qVar2);
CopyStatusEffects(this);
}
return;
}
// 006b7be0
Entity_NPC * Entity::GiveMinecart(Vector *position, Vector *velocity)
{
uint32_t *puVar1;
Vector *pos;
uint32_t seed;
Entity_NPC *minecart;
Vector *minecartVelocity;
float velocityY;
seed = Random();
pos = position;
minecart = GHIDRA_CAST<Entity_NPC *>((GHIDRA_CAST<Game *>((g_game)))->Game)::Spawn(0x3c5,0,position,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,seed);
minecartVelocity = velocity;
(minecart->_v2).x = 1.0;
(GHIDRA_CAST<Entity_NPC *>((minecart)))->Entity_NPC::SetMinecartPosVel(pos,velocity);
minecart->Update();
velocityY = minecartVelocity->y;
puVar1 = &this->_minecart;
(minecart->_targetPosition).x = minecartVelocity->x;
(minecart->_targetPosition).y = velocityY;
if (GHIDRA_CAST<Entity_NPC *>(*puVar1) != minecart) {
if (GHIDRA_CAST<Entity_NPC *>(*puVar1) != GHIDRA_CAST<Entity_NPC *>(0x0)) {
position = GHIDRA_CAST<Vector *>(puVar1);
msvc::multiset<unsigned_int>::erase(&position);
}
*puVar1 = minecart;
msvc::multiset<unsigned_int>::insert(puVar1);
}
puVar1 = &minecart->_child;
if (minecart->_child != 0) {
position = GHIDRA_CAST<Vector *>(puVar1);
msvc::multiset<unsigned_int>::erase(&position);
}
*puVar1 = this;
if (this != GHIDRA_CAST<Entity *>(0x0)) {
msvc::multiset<unsigned_int>::insert(puVar1);
}
return minecart;
}
// 006b9740
uint8_t Entity::IsPlayerInRadius(Vector *position, float radius, int unused1, int unused2)
{
int *playerSlot;
void *playerListEnd;
Game *game;
PlayerManager *playerManager;
uint64_t *allocatedBytes;
uint32_t uVar1;
float dx;
float dy;
float radiusSq;
uint8_t nearbyEntities [12];
uint32_t uStack_20;
float queryRadius;
float savedRadiusSq;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
int nearbyEntity;
uint64_t prevAllocatedBytes;
local_8 = 0xffffffff;
puStack_c = &LAB_00afa5b0;
local_10 = ExceptionList;
ExceptionList = &local_10;
if (((this->_flags & 0x20000000) == 0) && (0.0 < radius)) {
uVar1 = 0;
playerManager = &g_game->_playerManager;
radiusSq = radius * radius;
game = g_game;
queryRadius = radius;
savedRadiusSq = radiusSq;
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >>
2 != 0) {
do {
playerListEnd = (playerManager->_playerList)._end;
if (GHIDRA_INT(playerListEnd) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("(GHIDRA_CAST<PlayerManager *>(()))->PlayerManager::GetPlayer() : There are no players! \n"));
playerListEnd = (playerManager->_playerList)._end;
game = g_game;
radiusSq = savedRadiusSq;
}
playerSlot = (playerManager->_playerList)._begin;
if (uVar1 < GHIDRA_UINT((GHIDRA_INT(playerListEnd) - GHIDRA_INT(playerSlot) >> 2))) {
playerSlot = playerSlot + uVar1;
}
dy = position->y - *GHIDRA_CAST<float *>((*playerSlot + 0x340));
dx = position->x - *GHIDRA_CAST<float *>((*playerSlot + 0x33c));
if (dy * dy + dx * dx < radiusSq) {
ExceptionList = local_10;
return 1;
}
playerManager = &game->_playerManager;
uVar1 = uVar1 + 1;
} while (uVar1 < GHIDRA_UINT((GHIDRA_INT((game->_playerManager)._playerList._end) -
GHIDRA_INT((playerManager->_playerList)._begin) >> 2)));
}
EntityList::QueryRadius
(GHIDRA_CAST<EntityList *>((GHIDRA_INT(game->_room) + 0x1218)),GHIDRA_CAST<EntityList_EL *>(nearbyEntities),position,
queryRadius,1);
uVar1 = 0;
if (uStack_20 != 0) {
do {
nearbyEntity = *GHIDRA_CAST<int *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(nearbyEntities)) + 0x4))) + uVar1 * 4));
if (((nearbyEntity != 0) && (*GHIDRA_CAST<int *>((nearbyEntity + 0x28)) == 3)) &&
(*GHIDRA_CAST<int *>((nearbyEntity + 0x2c)) == 0x3e)) {
if (nearbyEntities[0] == '\0') {
local_8 = 0;
tracked_alloc(1,(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)nearbyEntities)) + 0x4))),0);
}
ExceptionList = local_10;
return 1;
}
uVar1 = uVar1 + 1;
} while (uVar1 < uStack_20);
}
if (nearbyEntities[0] == '\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 *>(&((void *)nearbyEntities)) + 0x4))) != (void *)0x0) {
uVar1 = *GHIDRA_CAST<uint32_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(nearbyEntities)) + 0x4))) + -4));
prevAllocatedBytes = *allocatedBytes;
*GHIDRA_CAST<uint32_t *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar1;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevAllocatedBytes) < uVar1));
free((void *)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(nearbyEntities)) + 0x4))) + -4));
}
}
}
ExceptionList = local_10;
return 0;
}
// 006d7d60
uint8_t Entity::IsHostileTo(Entity *other)
{
uint8_t isHostile;
uint64_t flags;
int otherType;
flags = this->_flags;
if ((flags & 0x100) == 0) {
if ((flags & 0x20000000) == 0) {
isHostile = 1;
goto LAB_006d7da5;
}
}
else if ((flags & 0x20000000) == 0) {
return 1;
}
isHostile = 0;
LAB_006d7da5:
otherType = other->_type;
if ((((otherType == 1) || (otherType == 4)) ||
((otherType == 3 && ((other->_flags & 0x100) == 0)))) || ((other->_flags & 0x20000000) != 0))
{
return isHostile;
}
return isHostile ^ 1;
}
// 006d8990
uint8_t Entity::is_valid_target()
{
int iVar1;
Entity_NPC *pEVar2;
uint8_t bVar3;
int entityType;
Entity_NPC *ancestor;
Entity_NPC *extraout_EDX;
Entity_NPC *rootEntity;
bool isExcludedType;
iVar1 = *GHIDRA_CAST<int *>(&g_game->_deathmatchManager);
if ((iVar1 < 2) || (this->_type != 1)) {
entityType = this->_type;
if (0x3dd < entityType - 10U) {
return 0;
}
if (entityType == 0x21) {
return 0;
}
if (entityType == 0x11) {
return 0;
}
if (entityType == 0x124) {
return 0;
}
if (entityType == 0x375) {
isExcludedType = this->_variant == 10;
}
else {
if (entityType == 0x3c0) {
return 0;
}
if (entityType == 0x3c5) {
return 0;
}
isExcludedType = entityType == 0xf5;
}
if (isExcludedType) {
return 0;
}
}
else {
entityType = 1;
}
if (this->_dead != 0) {
return 0;
}
if (entityType == 0xde) {
LAB_006d8ad0:
rootEntity = (GHIDRA_CAST<Entity_NPC *>((GHIDRA_CAST<Entity_NPC *>(this))))->Entity_NPC::ParentNPC();
}
else {
if (entityType == 0x119) {
ancestor = (GHIDRA_CAST<Entity_NPC *>((GHIDRA_CAST<Entity_NPC *>(this))))->Entity_NPC::ParentNPC();
if (ancestor == GHIDRA_CAST<Entity_NPC *>(0x0)) goto LAB_006d8add;
goto LAB_006d8ad0;
}
if (entityType == 0x364) {
rootEntity = GHIDRA_CAST<Entity_NPC *>(this->_parent);
ancestor = GHIDRA_CAST<Entity_NPC *>(this);
while (pEVar2 = rootEntity, pEVar2 != GHIDRA_CAST<Entity_NPC *>(0x0)) {
ancestor = pEVar2;
rootEntity = GHIDRA_CAST<Entity_NPC *>(pEVar2->_parent);
}
if (((iVar1 < 2) || (ancestor->_type != 1)) && (0x3dd < ancestor->_type - 10U)) {
ancestor = GHIDRA_CAST<Entity_NPC *>(0x0);
}
rootEntity = GHIDRA_CAST<Entity_NPC *>(this);
if (ancestor != GHIDRA_CAST<Entity_NPC *>(0x0)) {
rootEntity = ancestor;
}
}
else {
bVar3 = DoesEntityShareStatus(this);
rootEntity = extraout_EDX;
if (bVar3 != 0) {
ancestor = GHIDRA_CAST<Entity_NPC *>(this->_parent);
rootEntity = extraout_EDX;
while (pEVar2 = ancestor, pEVar2 != GHIDRA_CAST<Entity_NPC *>(0x0)) {
rootEntity = pEVar2;
ancestor = GHIDRA_CAST<Entity_NPC *>(pEVar2->_parent);
}
}
if ((rootEntity == GHIDRA_CAST<Entity_NPC *>(0x0)) ||
(((iVar1 < 2 || (rootEntity->_type != 1)) && (0x3dd < rootEntity->_type - 10U)))) {
rootEntity = GHIDRA_CAST<Entity_NPC *>(0x0);
}
}
}
if (rootEntity != GHIDRA_CAST<Entity_NPC *>(this)) {
return 0;
}
LAB_006d8add:
if (((this->_dead == 0) && (this[3]._bleedDamageAccumulator == -NAN)) &&
(bVar3 = HasEntityFlags(this,0x200000000000), bVar3 == 0)) {
return 1;
}
return 0;
}
// 006ef400
int Entity::SpawnGridIndex()
{
return this->_spawnGridIndex;
}
// 007079c0
void Entity::RemoveWithPoof(Entity *entity, int unusedArg)
{
char isBoss;
uint32_t seed;
Entity *pEVar1;
Vector poofPos;
ColorMod poofColor;
if (entity->_type != 0x3b6) {
seed = Random();
poofPos.x = (entity->_pos).x;
poofPos.y = (entity->_pos).y;
pEVar1 = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0xf,&poofPos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,seed,0);
poofColor._offset[0] = 0.2;
poofColor._tint[0] = 1.0;
poofColor._tint[1] = 0.6;
poofColor._tint[2] = 0.9;
poofColor._tint[3] = 1.0;
poofColor._offset[1] = 0.15;
poofColor._offset[2] = 0.18;
poofColor._colorize[0] = 0.0;
poofColor._colorize[1] = 0.0;
poofColor._colorize[2] = 0.0;
poofColor._colorize[3] = 0.0;
pEVar1->SetColor(&poofColor,0xffffffff,0xff,0,1);
pEVar1->Update();
if (((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (entity->_type == 1)) ||
(entity->_type - 10U < 0x3de)) {
isBoss = entity->IsBoss();
if (isBoss != '\0') {
(GHIDRA_CAST<Room *>((g_game->_room)))->Room::TriggerBossDeath(entity);
}
}
entity->Remove();
}
return;
}
// 0070c000
void Entity::DestroyRockGridAt(Vector *position, GridEntityDesc *desc, Entity *source, int backdropType)
{
int poopVariant;
uint8_t isAnimSet;
ColorMod *Color;
ColorMod *Color_00;
uint32_t uVar1;
EntityRef *source_00;
Entity *pEVar2;
char *name;
uint8_t *anim;
uint32_t extraout_ECX;
Vector *pVVar3;
ANM2 *this;
uint32_t uVar4;
int GridEntityType;
float spreadFactor;
ANM2 sourceSprite;
EntityRef dropSource;
Vector rubblePos;
Vector rubbleVelocity;
Vector *positionLocal;
int rubbleLeft;
int gridTypeCopy;
float local_60;
Entity *local_5c;
float local_58;
int variantCopy;
GridEntityDesc *gridDesc;
float local_4c;
uint32_t local_48;
char isNormalRock;
Color local_40;
uint32_t local_14;
void *local_10;
uint8_t *puStack_c;
float local_8;
local_8 = -NAN;
puStack_c = &LAB_00afc780;
local_10 = ExceptionList;
local_14 = __security_cookie ^ GHIDRA_UINT((&local_40)[1]._colorize);
GridEntityType = desc->_type;
poopVariant = desc->_variant;
positionLocal = position;
gridTypeCopy = GridEntityType;
variantCopy = poopVariant;
gridDesc = desc;
if (GridEntityType == 5) {
ExceptionList = &local_10;
::(GHIDRA_CAST<Color *>((&local_40)))->Color::Color();
Game::BombExplosionEffects(g_game,position,60.0,(BitSet128)ZEXT816(0),Color,source,1.0,1,4,0);
ExceptionList = local_10;
return;
}
if (GridEntityType == 0xc) {
ExceptionList = &local_10;
::(GHIDRA_CAST<Color *>((&local_40)))->Color::Color();
Game::BombExplosionEffects(g_game,position,60.0,(BitSet128)ZEXT816(0),Color_00,source,1.0,1,4,0)
;
spawn_rock_particles();
FUN_0071f4b0(gridDesc->_spawnSeed,extraout_ECX);
ExceptionList = local_10;
return;
}
if ((((GridEntityType == 2) || (GridEntityType == 4)) || (GridEntityType == 6)) ||
(((GridEntityType == 0x16 || (GridEntityType == 0x1a)) || (GridEntityType == 0x1b)))) {
ExceptionList = &local_10;
GridEntity_Rock::PlayBreakSound(GridEntityType,backdropType);
isNormalRock = '\x01';
if (variantCopy == 9000) {
local_48 = 0x10001;
isNormalRock = '\0';
}
else {
if ((GridEntityType == 6) || (local_48 = 1, GridEntityType == 0x1a)) {
local_48 = 2;
}
GridEntity_Rock::RegisterRockDestroyed(GridEntityType);
}
rubbleLeft = 4;
do {
uVar4 = Random();
local_58 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) *
2.3283064e-10 * 360.0 * 0.017453292;
local_4c = sin(local_58);
local_60 = cos(local_58);
local_58 = local_60 * 12.0;
local_5c = GHIDRA_CAST<Entity *>((local_4c * 12.0));
uVar4 = Random();
spreadFactor = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) *
2.3283064e-10;
rubblePos.y = spreadFactor * (float)local_5c + position->y;
rubblePos.x = spreadFactor * local_58 + position->x;
uVar4 = Random();
rubbleVelocity.x = local_60 * 5.0;
rubbleVelocity.y = local_4c * 5.0;
pEVar2 = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,4,&rubblePos,&rubbleVelocity,GHIDRA_CAST<Entity *>(0x0),local_48,uVar4,0);
local_5c = pEVar2;
if (isNormalRock != '\0') {
if (source != GHIDRA_CAST<Entity *>(0x0)) {
ANM2::ANM2(&sourceSprite,&source->_sprite);
Isaac::SwapANM2(&pEVar2->_sprite,&sourceSprite);
local_8 = 0.0;
ANM2::Reset(this);
AnimationState::~AnimationState(&sourceSprite._overlayAnimState);
AnimationState::~AnimationState(&sourceSprite._animState);
(GHIDRA_CAST<msvc::string *>((sourceSprite._animDefaultName._buf)))->msvc::string::_Tidy_deallocate();
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(&sourceSprite))))->msvc::string::_Tidy_deallocate();
local_8 = -NAN;
}
if ((GridEntityType == 6) || (name = "rubble", GridEntityType == 0x1a)) {
name = "rubble_alt";
}
anim = ANM2::GetAnimationData(&pEVar2->_sprite,GHIDRA_CAST<uint8_t *>(name));
if (anim != GHIDRA_CAST<uint8_t *>(0x0)) {
local_60 = *GHIDRA_CAST<float *>((anim + 0x30));
if (local_60 == 0.0) {
local_4c = 0.0;
}
else {
uVar4 = Random();
local_4c = (float)(uVar4 % GHIDRA_UINT(local_60));
}
if (0xf < *GHIDRA_CAST<uint32_t *>((anim + 0x14))) {
anim = *GHIDRA_CAST<uint8_t **>(anim);
}
isAnimSet = ANM2::SetAnimation(&pEVar2->_sprite,anim,1);
if (((isAnimSet != 0) && ((pEVar2->_sprite)._animState._animData != (void *)0x0)) &&
(AnimationState::SetFrameFloat(&(pEVar2->_sprite)._animState,(float)GHIDRA_INT(local_4c)),
(pEVar2->_sprite)._animState._animData != (void *)0x0)) {
(pEVar2->_sprite)._animState._isPlaying = 0;
}
}
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_5c[1])) + 0x40)))) = 1;
GridEntityType = gridTypeCopy;
}
rubbleLeft = rubbleLeft + -1;
position = positionLocal;
} while (rubbleLeft != 0);
if (isNormalRock == '\0') {
ExceptionList = local_10;
return;
}
GridEntity_Rock::SpawnDrops
(positionLocal,GridEntityType,variantCopy,gridDesc->_spawnSeed,1,backdropType,source);
ExceptionList = local_10;
return;
}
if (GridEntityType != 0xe) {
return;
}
if (source == GHIDRA_CAST<Entity *>(0x0)) {
local_40._tint[1] = 0.0;
local_40._tint[2] = 0.0;
local_40._tint[3] = 0.0;
local_40._colorize[0] = 0.0;
local_40._colorize[1] = g_vectorZero.x;
local_40._colorize[2] = g_vectorZero.y;
local_40._colorize[3] = g_vectorZero.x;
local_40._offset[0] = g_vectorZero.y;
LAB_0070c1f2:
uVar4 = 0;
if (source != GHIDRA_CAST<Entity *>(0x0)) goto LAB_0070c1f8;
uVar4 = 0;
LAB_0070c213:
local_48 = 0;
pVVar3 = position;
if (source != GHIDRA_CAST<Entity *>(0x0)) goto LAB_0070c21e;
}
else {
local_40._tint[1] = (float)source->_type;
local_40._colorize[1] = (source->_pos).x;
local_40._colorize[2] = (source->_pos).y;
local_40._tint[2] = (float)source->_variant;
local_40._tint[3] = (float)source->_spawnerType;
local_40._colorize[0] = (float)source->_spawnerVariant;
local_40._colorize[3] = (source->_velocity).x;
local_40._offset[0] = (source->_velocity).y;
if ((source->_flags & 0x100) == 0) goto LAB_0070c1f2;
uVar4 = 1;
LAB_0070c1f8:
if ((source->_flags & 0x20000000) == 0) goto LAB_0070c213;
local_48 = 2;
LAB_0070c21e:
pVVar3 = GHIDRA_CAST<Vector *>((*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&source->_flags) + 4)) & 0x400000));
if (pVVar3 != GHIDRA_CAST<Vector *>(0x0)) {
uVar1 = 4;
goto LAB_0070c239;
}
}
uVar1 = 0;
LAB_0070c239:
local_40._offset[1] = (float)(uVar1 | local_48 | uVar4);
local_40._offset[2] = (float)source;
ExceptionList = &local_10;
spawn_poop_rewards(desc->_spawnSeed,desc->_state,1000,0,pVVar3,local_40._tint + 1,local_14);
GridEntity_Poop::destroy_effects();
GridEntity_Poop::spawn_hit_gibs(position,poopVariant,4);
source_00 = (GHIDRA_CAST<EntityRef *>((&dropSource)))->EntityRef::EntityRef();
GridEntity_Poop::spawn_drops
(position,poopVariant,gridDesc->_spawnSeed,gridDesc->_varData == 1,1,source_00);
ExceptionList = local_10;
return;
}
// 007536f0
int Entity::RenderZOffset()
{
return this->_renderZOffset;
}
// 007e9130
int Entity::GetBossID()
{
if (this->_config == (void *)0x0) {
return 0;
}
return *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this->_config) + 0x30));
}
// 0085dca0
uint8_t Entity::FlipX()
{
return (this->_sprite)._flipX;
}
// 0085dcb0
void Entity::SetSpriteFrame(std_string *animName, int frame)
{
uint8_t isAnimationSet;
if (0xf < animName->_capacity) {
animName = *GHIDRA_CAST<std_string **>(animName->_buf);
}
isAnimationSet = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST<uint8_t *>(animName),1);
if ((isAnimationSet != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) {
AnimationState::SetFrameFloat(&(this->_sprite)._animState,(float)frame);
if ((this->_sprite)._animState._animData != (void *)0x0) {
(this->_sprite)._animState._isPlaying = 0;
}
}
return;
}
// 0085dd00
void Entity::SetSpriteOverlayFrame(std_string *anim, int frame)
{
uint8_t isAnimationSet;
if (0xf < anim->_capacity) {
anim = *GHIDRA_CAST<std_string **>(anim->_buf);
}
isAnimationSet = ANM2::SetOverlayAnimation(&this->_sprite,GHIDRA_CAST<uint8_t *>(anim),1);
if ((isAnimationSet != 0) && ((this->_sprite)._overlayAnimState._animData != (void *)0x0)) {
AnimationState::SetFrameFloat(&(this->_sprite)._overlayAnimState,(float)frame);
}
return;
}
// 0085dd40
Vector * Entity::SizeMulti(Vector *outResult)
{
float sizeMultiY;
sizeMultiY = (this->_sizeMulti).y;
outResult->x = (this->_sizeMulti).x;
outResult->y = sizeMultiY;
return outResult;
}
// 0085e680
uint32_t Entity::IsVulnerableEnemy_lua(void *param_1)
{
uint8_t isVulnerable;
int sourceRef;
int luaType;
Entity *source;
void *sourceLuaRef;
int local_1c;
Entity *local_18;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00b03acd;
local_10 = ExceptionList;
ExceptionList = &local_10;
lua_pushvalue(param_1,2,__security_cookie ^ GHIDRA_INT(register0x00000010) - 4U);
sourceLuaRef = param_1;
sourceRef = luaL_ref(param_1,0xfff0b9d8);
local_8 = 0;
local_1c = sourceRef;
if (sourceRef != -1) {
(GHIDRA_CAST<LuaRef *>((&sourceLuaRef)))->LuaRef::push(param_1);
luaType = lua_type(param_1,0xffffffff);
lua_settop(param_1,0xfffffffe);
if (luaType != 0) {
source = GHIDRA_CAST<Entity *>(luabridge)::LuaRef::cast<Entity_ptr>();
goto LAB_0085e70a;
}
}
source = GHIDRA_CAST<Entity *>(0x0);
LAB_0085e70a:
isVulnerable = IsVulnerableEnemy(local_18,source);
lua_pushboolean(param_1,isVulnerable);
luaL_unref(param_1,0xfff0b9d8,sourceRef);
ExceptionList = local_10;
return 1;
}
// 00866060
void Entity::ReleaseLuaRef(Entity *entity)
{
uint32_t uStack_40;
uint32_t callbackLuaState;
uint32_t callbackId;
int entityType;
uint32_t entityRefState;
uint32_t entityRefId;
uint8_t *local_14;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
puStack_c = &LAB_00b04530;
local_10 = ExceptionList;
uStack_40 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
local_14 = GHIDRA_CAST<uint8_t *>(&uStack_40);
ExceptionList = &local_10;
callbackId = 0x43;
callbackLuaState = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(g_luaEngine) + 0x10));
entityType = entity->_type;
if ((*GHIDRA_CAST<uint8_t *>((*GHIDRA_CAST<int *>(g_luaEngine) + 8)) & 8) != 0) {
local_8 = 0;
lua_callback_run_entity(&callbackLuaState,&entityRefState,entityType,entity);
luaL_unref(entityRefState,0xfff0b9d8,entityRefId);
}
ExceptionList = local_10;
return;
}
// 00871f90
long double Entity::Size(int param_1)
{
return (long double)*GHIDRA_CAST<float *>((param_1 + 0x370));
}
// 008c5cf2
void Entity::KillWithSource()
{
/* WARNING: Could not recover jumptable at 0x008c5cf4. Too many branches */
/* WARNING: Treating indirect jump as call */
this->Kill();
return;
}