The decompiled C++ tree moves to generated-src/ (classes.h, C++20); src/ is for code written by hand. A curated function defines the generated declaration and starts its comment with its address, and source_tree.py stops emitting that body. src/rng.cpp takes over RNG (SetSeed, the constructor, Next, RandomInt, RandomFloat, Shuffle) with the shift table read from the exe as a constexpr array; src/log.h names KAGE_LogMessage's levels (1 INFO, 2 NET, 4 WARN, 8 ERROR, 16 ASSERT, from its prefix jump table). CMakeLists.txt builds src/*.cpp against generated-src/classes.h (clean with -Wall -Wextra). structs.hpp and headers.py are retired: scripts/merge_fields.py writes the merged field list, classes.h checks the layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9057 lines
324 KiB
C++
9057 lines
324 KiB
C++
#include "classes.h"
|
|
|
|
// 00417220
|
|
byte 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
|
|
float10 Entity::SpriteRotation()
|
|
{
|
|
return (float10)(this->_sprite)._rotation;
|
|
}
|
|
|
|
// 00417360
|
|
float Entity::MaxHitPoints()
|
|
{
|
|
return this->_maxHitPoints;
|
|
}
|
|
|
|
// 00417370
|
|
float10 Entity::HitPoints()
|
|
{
|
|
return (float10)this->_health;
|
|
}
|
|
|
|
// 00417380
|
|
int Entity::EntityCollisionClass()
|
|
{
|
|
return this->_entityCollisionClass;
|
|
}
|
|
|
|
// 004173b0
|
|
byte Entity::is_player()
|
|
{
|
|
return this->_type == 1;
|
|
}
|
|
|
|
// 004173c0
|
|
bool Entity::is_bomb()
|
|
{
|
|
return this->_type == 4;
|
|
}
|
|
|
|
// 004173e0
|
|
void Entity::AddEntityFlags(ulonglong flags)
|
|
{
|
|
uint *flagsHigh;
|
|
|
|
*GHIDRA_CAST<uint *>(&this->_flags) = GHIDRA_UINT(this->_flags) | GHIDRA_UINT(flags);
|
|
flagsHigh = GHIDRA_CAST<uint *>((GHIDRA_INT(&this->_flags) + 4));
|
|
*flagsHigh = *flagsHigh | (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(flags)) + 0x4)));
|
|
return;
|
|
}
|
|
|
|
// 00417400
|
|
void Entity::ClearEntityFlags(ulonglong flags)
|
|
{
|
|
uint *flagsHigh;
|
|
|
|
*GHIDRA_CAST<uint *>(&this->_flags) = GHIDRA_UINT(this->_flags) & ~GHIDRA_UINT(flags);
|
|
flagsHigh = GHIDRA_CAST<uint *>((GHIDRA_INT(&this->_flags) + 4));
|
|
*flagsHigh = *flagsHigh & ~(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(flags)) + 0x4)));
|
|
return;
|
|
}
|
|
|
|
// 00417420
|
|
qword Entity::GetEntityFlags()
|
|
{
|
|
return this->_flags;
|
|
}
|
|
|
|
// 00417430
|
|
byte Entity::HasEntityFlags(ulonglong flags)
|
|
{
|
|
if ((GHIDRA_UINT(flags) & GHIDRA_UINT(this->_flags)) == 0 &&
|
|
(*GHIDRA_CAST<uint *>((GHIDRA_INT(&this->_flags) + 4)) & (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(flags)) + 0x4)))) == 0) {
|
|
return 0;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
// 00417460
|
|
byte Entity::Exists()
|
|
{
|
|
return this->_exists;
|
|
}
|
|
|
|
// 00417470
|
|
byte Entity::IsDead()
|
|
{
|
|
return this->_dead;
|
|
}
|
|
|
|
// 00417480
|
|
byte Entity::Visible()
|
|
{
|
|
return this->_visible;
|
|
}
|
|
|
|
// 004174a0
|
|
EntityPtr 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
|
|
byte Entity::IsFamiliar()
|
|
{
|
|
return this->_type == 3;
|
|
}
|
|
|
|
// 0042a260
|
|
EntityPtr 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, byte 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, byte 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
|
|
float10 Entity::Mass()
|
|
{
|
|
return (float10)this->_mass;
|
|
}
|
|
|
|
// 00431530
|
|
byte Entity::IsTear()
|
|
{
|
|
return this->_type == 2;
|
|
}
|
|
|
|
// 00431540
|
|
byte Entity::IsProjectile()
|
|
{
|
|
return this->_type == 9;
|
|
}
|
|
|
|
// 00431550
|
|
bool Entity::is_pickup()
|
|
{
|
|
return this->_type == 5;
|
|
}
|
|
|
|
// 00431560
|
|
EntityPtr Entity::Child()
|
|
{
|
|
return this->_child;
|
|
}
|
|
|
|
// 00435ce0
|
|
void Entity::get_friction()
|
|
{
|
|
return;
|
|
}
|
|
|
|
// 00435d10
|
|
float10 Entity::DepthOffset()
|
|
{
|
|
return (float10)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(byte isVisible)
|
|
{
|
|
if ((isVisible == 0) || ((this->_flags & 0x20000000) != 0)) {
|
|
*GHIDRA_CAST<undefined1 *>(&this[3]._damageEvents._end) = 0;
|
|
return;
|
|
}
|
|
*GHIDRA_CAST<undefined1 *>(&this[3]._damageEvents._end) = 1;
|
|
return;
|
|
}
|
|
|
|
// 00440eb0
|
|
int Entity::GridCollisionClass()
|
|
{
|
|
return this->_entityGridCollisionClass;
|
|
}
|
|
|
|
// 00444c60
|
|
void Entity::Die()
|
|
{
|
|
this->_dead = 1;
|
|
return;
|
|
}
|
|
|
|
// 004567b0
|
|
byte 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
|
|
EntityPtr 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
|
|
float10 Entity::CollisionDamage()
|
|
{
|
|
return (float10)this->_collisionDamage;
|
|
}
|
|
|
|
// 005b1580
|
|
byte 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
|
|
undefined1 Entity::IsBoss()
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
// 005ccc10
|
|
undefined1 Entity::TryThrow()
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
// 005cd460
|
|
void Entity::AddFlagsLow(uint 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, EntityPtr param_4)
|
|
{
|
|
uint seed;
|
|
Entity *effect;
|
|
undefined4 *in_EDX;
|
|
float parentX;
|
|
float parentY;
|
|
undefined1 local_3c [2];
|
|
undefined1 auStack_3a [2];
|
|
undefined4 effectColor;
|
|
undefined4 uStack_34;
|
|
undefined4 uStack_30;
|
|
undefined4 uStack_2c;
|
|
undefined4 local_28;
|
|
undefined4 uStack_24;
|
|
undefined4 uStack_20;
|
|
undefined4 uStack_1c;
|
|
undefined4 local_18;
|
|
undefined4 local_14;
|
|
undefined4 local_10;
|
|
uint 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<undefined1 *>((GHIDRA_CAST<char *>(&(effect[1])) + 0x40)))) = param_3;
|
|
if (param_4 != (EntityPtr)0x0) {
|
|
if (effect->_parent != (EntityPtr)0x0) {
|
|
std::multiset<unsigned_int>::erase(local_3c + -0x14);
|
|
}
|
|
effect->_parent = param_4;
|
|
std::multiset<unsigned_int>::insert(&effect->_parent);
|
|
parentY = (effect->_pos).x;
|
|
parentX = (effect->_pos).y;
|
|
parentX = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(param_4) + 0x33c));
|
|
parentY = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(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)
|
|
{
|
|
byte *pbVar1;
|
|
EntityPtr spawner;
|
|
int iVar2;
|
|
Vector targetPos;
|
|
uint seed;
|
|
Entity *pEVar3;
|
|
Entity_NPC *pEVar4;
|
|
float fVar5;
|
|
uint variant;
|
|
Vector local_20;
|
|
Vector local_18;
|
|
Vector local_10;
|
|
undefined4 flagsHigh;
|
|
float *shotOffsetY;
|
|
|
|
if ((((this->_flags & 0x100) != 0) &&
|
|
(spawner = *GHIDRA_CAST<EntityPtr *>((*GHIDRA_CAST<int *>((this + 1)) + 0x3c8)), spawner != (EntityPtr)0x0)) &&
|
|
(((local_20.x = (float)(GHIDRA_INT(spawner) + 0x28), 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;
|
|
pEVar3 = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(9,0,&local_20,&local_18,GHIDRA_CAST<Entity *>(spawner),0,seed,0);
|
|
iVar2 = *GHIDRA_CAST<int *>(pEVar3);
|
|
pEVar3[1]._damageEvents._begin = shot[1]._damageEvents._begin;
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(pEVar3[1])) + 0x4)))) = *GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(shot[1])) + 0x4))));
|
|
*GHIDRA_CAST<undefined4 *>((pEVar3 + 1)) = *GHIDRA_CAST<undefined4 *>((shot + 1));
|
|
pEVar3[1]._damageEvents._capacity = shot[1]._damageEvents._capacity;
|
|
(**(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;
|
|
pEVar3 = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(0x12,0,&local_10,&local_20,GHIDRA_CAST<Entity *>(spawner),0,seed,0);
|
|
flagsHigh = *GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&pEVar3->_flags) + 4));
|
|
fVar5 = pEVar3->_maxHitPoints + pEVar3->_maxHitPoints;
|
|
*GHIDRA_CAST<uint *>(&pEVar3->_flags) = GHIDRA_UINT(pEVar3->_flags) & 0xfffffffb;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&pEVar3->_flags) + 4)) = flagsHigh;
|
|
pEVar3->_maxHitPoints = fVar5;
|
|
pEVar3->_health = fVar5;
|
|
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;
|
|
std::multiset<unsigned_int>::erase(&local_18);
|
|
}
|
|
*GHIDRA_CAST<Entity **>(pbVar1) = pEVar3;
|
|
std::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;
|
|
pEVar4 = Entity_NPC::ThrowSpider
|
|
(&local_20,GHIDRA_CAST<Entity *>(spawner),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;
|
|
pEVar4 = (Entity_NPC *)
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(0x55,0,&local_18,&local_10,GHIDRA_CAST<Entity *>(spawner),0,seed,0);
|
|
}
|
|
flagsHigh = *GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&pEVar4->_flags) + 4));
|
|
fVar5 = pEVar4->_maxHitPoints + pEVar4->_maxHitPoints;
|
|
*GHIDRA_CAST<uint *>(&pEVar4->_flags) = GHIDRA_UINT(pEVar4->_flags) & 0xfffffffb;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&pEVar4->_flags) + 4)) = flagsHigh;
|
|
pEVar4->_maxHitPoints = fVar5;
|
|
pEVar4->_health = fVar5;
|
|
shot->Remove();
|
|
return;
|
|
}
|
|
}
|
|
else if (iVar2 == 7) {
|
|
local_18.x = (float)&shot->_spawnerEntity;
|
|
pEVar3 = this;
|
|
if (shot->_spawnerEntity != (EntityPtr)0x0) {
|
|
std::multiset<unsigned_int>::erase(&local_18);
|
|
pEVar3 = GHIDRA_CAST<Entity *>(local_18.x);
|
|
}
|
|
local_18.x = (float)pEVar3;
|
|
shot->_spawnerEntity = spawner;
|
|
std::multiset<unsigned_int>::insert(&shot->_spawnerEntity);
|
|
shot->_spawnerType = *GHIDRA_CAST<int *>(local_20.x);
|
|
shot->_spawnerVariant = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(spawner) + 0x2c));
|
|
}
|
|
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;
|
|
pEVar3 = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,variant,&local_18,&local_10,GHIDRA_CAST<Entity *>(spawner),0,seed,0);
|
|
iVar2 = *GHIDRA_CAST<int *>(pEVar3);
|
|
(pEVar3->_sprite)._scale.x = (shot->_sprite)._scale.x;
|
|
(pEVar3->_sprite)._scale.y = (shot->_sprite)._scale.y;
|
|
(**(code **)(iVar2 + 0xc))();
|
|
shot->Remove();
|
|
return;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 00665a80
|
|
undefined1 Entity::CollidesWithGrid()
|
|
{
|
|
int in_ECX;
|
|
|
|
return *GHIDRA_CAST<undefined1 *>((in_ECX + 400));
|
|
}
|
|
|
|
// 0067a720
|
|
void Entity::GetRootParent()
|
|
{
|
|
EntityPtr nextSpawner;
|
|
EntityPtr spawner;
|
|
|
|
nextSpawner = this->_spawnerEntity;
|
|
while (spawner = nextSpawner, spawner != (EntityPtr)0x0) {
|
|
this = GHIDRA_CAST<Entity *>(spawner);
|
|
nextSpawner = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(spawner) + 0x3c8));
|
|
}
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x28)) == 1) {
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006a8290
|
|
void Entity::constructor()
|
|
{
|
|
void *referrerHead;
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 local_8;
|
|
|
|
puStack_c = &LAB_00afa397;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
*GHIDRA_CAST<undefined ***>(this) = IsaacRepentancePlus::Entity::vftable;
|
|
(this->_damageEvents)._begin = (void *)0x0;
|
|
(this->_damageEvents)._end = (void *)0x0;
|
|
(this->_damageEvents)._capacity = (void *)0x0;
|
|
local_8 = 0;
|
|
this->_type = 0;
|
|
this->_spawnerType = 0;
|
|
this->_spawnerVariant = 0;
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x3c)))) = 0;
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x40)))) = 0xffffffff;
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x44)))) = 0xffffffff;
|
|
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::constructor();
|
|
(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<undefined1 *>((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 = (EntityPtr)0x0;
|
|
(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 = (EntityPtr)0x0;
|
|
this->_child = (EntityPtr)0x0;
|
|
this->_target = (EntityPtr)0x0;
|
|
this->_spawnerEntity = (EntityPtr)0x0;
|
|
(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<undefined2 *>((GHIDRA_CAST<char *>(referrerHead) + 0xc)) = 0x101;
|
|
(this->_entityPtrReferrers)._head = referrerHead;
|
|
this->_minecart = (EntityPtr)0x0;
|
|
this->_hitEffect = (EntityPtr)0x0;
|
|
(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;
|
|
undefined4 *ptr;
|
|
uint uVar1;
|
|
EntityPtr *erasedRef;
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 local_8;
|
|
EntityPtr *entityRef;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00afa3c0;
|
|
local_10 = ExceptionList;
|
|
uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
|
|
ExceptionList = &local_10;
|
|
*GHIDRA_CAST<undefined ***>(this) = IsaacRepentancePlus::Entity::vftable;
|
|
if (this->_exists != 0) {
|
|
Remove(this);
|
|
}
|
|
ptr = this->_luaBridgeRef;
|
|
if (ptr != GHIDRA_CAST<undefined4 *>(0x0)) {
|
|
luaL_unref(*ptr,0xfff0b9d8,ptr[1],uVar1);
|
|
operator_delete(ptr,8);
|
|
this->_luaBridgeRef = (void *)0x0;
|
|
}
|
|
entityRef = &this->_hitEffect;
|
|
if (*entityRef != (EntityPtr)0x0) {
|
|
erasedRef = entityRef;
|
|
std::multiset<unsigned_int>::erase(&erasedRef);
|
|
*entityRef = (EntityPtr)0x0;
|
|
}
|
|
entityRef = &this->_minecart;
|
|
if (*entityRef != (EntityPtr)0x0) {
|
|
erasedRef = entityRef;
|
|
std::multiset<unsigned_int>::erase(&erasedRef);
|
|
*entityRef = (EntityPtr)0x0;
|
|
}
|
|
referrers = &this->_entityPtrReferrers;
|
|
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
|
|
(referrers,(fuzzer_allocator<std::_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();
|
|
std::vector<Vector>::_Tidy();
|
|
local_8 = 2;
|
|
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Reset();
|
|
(GHIDRA_CAST<AnimationState *>((&(this->_sprite)._overlayAnimState)))->AnimationState::~AnimationState();
|
|
(GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::~AnimationState();
|
|
(GHIDRA_CAST<std::string *>(((this->_sprite)._animDefaultName._buf)))->std::string::_Tidy_deallocate();
|
|
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(&this->_sprite))))->std::string::_Tidy_deallocate();
|
|
FUN_0041c7d0();
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 006a8990
|
|
Entity * Entity::GetLastParent()
|
|
{
|
|
EntityPtr nextParent;
|
|
EntityPtr parent;
|
|
|
|
nextParent = this->_parent;
|
|
while (parent = nextParent, parent != (EntityPtr)0x0) {
|
|
this = GHIDRA_CAST<Entity *>(parent);
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(parent) + 0x3bc));
|
|
}
|
|
return this;
|
|
}
|
|
|
|
// 006a89b0
|
|
Entity * Entity::GetLastChild()
|
|
{
|
|
EntityPtr child;
|
|
EntityPtr nextChild;
|
|
|
|
nextChild = this->_child;
|
|
while (child = nextChild, child != (EntityPtr)0x0) {
|
|
this = GHIDRA_CAST<Entity *>(child);
|
|
nextChild = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(child) + 0x3c0));
|
|
}
|
|
return this;
|
|
}
|
|
|
|
// 006a89d0
|
|
Entity * Entity::GetLastSpawner()
|
|
{
|
|
EntityPtr nextSpawner;
|
|
EntityPtr spawner;
|
|
|
|
nextSpawner = this->_spawnerEntity;
|
|
while (spawner = nextSpawner, spawner != (EntityPtr)0x0) {
|
|
this = GHIDRA_CAST<Entity *>(spawner);
|
|
nextSpawner = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(spawner) + 0x3c8));
|
|
}
|
|
return this;
|
|
}
|
|
|
|
// 006a89f0
|
|
Entity * Entity::GetStatusEffectTarget()
|
|
{
|
|
byte isSharingStatus;
|
|
EntityPtr extraout_EDX;
|
|
EntityPtr target;
|
|
EntityPtr next;
|
|
EntityPtr parent;
|
|
|
|
isSharingStatus = DoesEntityShareStatus(this);
|
|
target = extraout_EDX;
|
|
if (isSharingStatus != 0) {
|
|
next = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(extraout_EDX) + 0x3bc));
|
|
target = extraout_EDX;
|
|
while (parent = next, parent != (EntityPtr)0x0) {
|
|
target = parent;
|
|
next = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(parent) + 0x3bc));
|
|
}
|
|
}
|
|
return GHIDRA_CAST<Entity *>(target);
|
|
}
|
|
|
|
// 006a8a20
|
|
void Entity::CopyStatusEffects()
|
|
{
|
|
byte isSharingStatus;
|
|
char isBoss;
|
|
EntityPtr child;
|
|
uint flagsHigh;
|
|
|
|
isSharingStatus = DoesEntityShareStatus(this);
|
|
if (isSharingStatus != 0) {
|
|
for (child = this->_child; child != (EntityPtr)0x0; child = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(child) + 0x3c0)))
|
|
{
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(child) + 0x218)) = this->_freezeCountdown;
|
|
flagsHigh = *GHIDRA_CAST<uint *>((GHIDRA_INT(&this->_flags) + 4));
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(child) + 0x168)) =
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(child) + 0x168)) & 0xdeffe01f | GHIDRA_UINT(this->_flags) & 0x21001fe0;
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(child) + 0x16c)) =
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(child) + 0x16c)) & 0xfea27fff | flagsHigh & 0x15d8000;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(child) + 0x21c)) = this->_poisonCountdown;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(child) + 0x220)) = this->_slowingCountdown;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(child) + 0x224)) = this->_charmedCountdown;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(child) + 0x228)) = this->_confusionCountdown;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(child) + 0x22c)) = this->_midasFreezeCountdown;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(child) + 0x230)) = this->_fearCountdown;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(child) + 0x234)) = this->_burnCountdown;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(child) + 0x2e8)) = this->_bleedingCountdown;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(child) + 0x23c)) = this->_shrinkCountdown;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(child) + 800)) = this->_poisonTickDamage;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(child) + 0x324)) = this->_burnTickDamage;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(child) + 0x2f0)) = this->_magnetizedCountdown;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(child) + 0x2f4)) = this->_baitedCountdown;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(child) + 0x2f8)) = this->_knockbackCountdown;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(child) + 0x308)) = (this->_knockbackDirection).x;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(child) + 0x30c)) = (this->_knockbackDirection).y;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(child) + 0x300)) = this->_iceCountdown;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(child) + 0x2fc)) = this->_weaknessCountdown;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(child) + 0x304)) = this->_brimstoneMarkCountdown;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(child) + 0x3b4)) = this->_shrinkStatus1;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(child) + 0x3b8)) = this->_shrinkStatus2;
|
|
isBoss = this->IsBoss();
|
|
if (((isBoss != '\0') || ((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager) && (this->_type == 1)))) &&
|
|
((isBoss = (**(code **)(*GHIDRA_CAST<int *>(child) + 0x4c))(), isBoss != '\0' ||
|
|
((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager) && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(child) + 0x28)) == 1)))))) {
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(child) + 0x238)) = this->_bossStatusEffectCooldown;
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006a8c00
|
|
byte Entity::HasCommonParentWithEntity(Entity *other)
|
|
{
|
|
EntityPtr EVar1;
|
|
EntityPtr EVar2;
|
|
Entity *otherRoot;
|
|
EntityPtr nextAncestor;
|
|
EntityPtr ancestor;
|
|
|
|
if ((other != GHIDRA_CAST<Entity *>(0x0)) && (other->_type == 0xde)) {
|
|
return 0;
|
|
}
|
|
otherRoot = GHIDRA_CAST<Entity *>(0x0);
|
|
if (other != GHIDRA_CAST<Entity *>(0x0)) {
|
|
nextAncestor = other->_parent;
|
|
otherRoot = other;
|
|
while (ancestor = nextAncestor, ancestor != (EntityPtr)0x0) {
|
|
otherRoot = GHIDRA_CAST<Entity *>(ancestor);
|
|
nextAncestor = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(ancestor) + 0x3bc));
|
|
}
|
|
}
|
|
EVar2 = this->_parent;
|
|
while (EVar1 = EVar2, EVar1 != (EntityPtr)0x0) {
|
|
this = GHIDRA_CAST<Entity *>(EVar1);
|
|
EVar2 = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar1) + 0x3bc));
|
|
}
|
|
return otherRoot == this;
|
|
}
|
|
|
|
// 006a8c60
|
|
byte Entity::is_same_segmented_body(Entity *other)
|
|
{
|
|
EntityPtr ancestor;
|
|
EntityPtr 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 = other->_parent;
|
|
while (ancestor = nextParent, ancestor != (EntityPtr)0x0) {
|
|
other = GHIDRA_CAST<Entity *>(ancestor);
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(ancestor) + 0x3bc));
|
|
}
|
|
nextParent = this->_parent;
|
|
while (ancestor = nextParent, ancestor != (EntityPtr)0x0) {
|
|
this = GHIDRA_CAST<Entity *>(ancestor);
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(ancestor) + 0x3bc));
|
|
}
|
|
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 = other->_parent;
|
|
while (ancestor = nextParent, ancestor != (EntityPtr)0x0) {
|
|
other = GHIDRA_CAST<Entity *>(ancestor);
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(ancestor) + 0x3bc));
|
|
}
|
|
nextParent = this->_parent;
|
|
while (ancestor = nextParent, ancestor != (EntityPtr)0x0) {
|
|
this = GHIDRA_CAST<Entity *>(ancestor);
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(ancestor) + 0x3bc));
|
|
}
|
|
if (other == this) {
|
|
return 1;
|
|
}
|
|
}
|
|
switchD_006a8c86_caseD_14:
|
|
return 0;
|
|
}
|
|
|
|
// 006a8db0
|
|
byte 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
|
|
byte Entity::IsValidTarget(Entity *target)
|
|
{
|
|
byte 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
|
|
byte 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
|
|
byte 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
|
|
byte Entity::IsDescendantOf(Entity *ancestor)
|
|
{
|
|
Entity *pEVar1;
|
|
void *pvVar2;
|
|
undefined1 *visitedFlag;
|
|
byte isDescendant;
|
|
undefined1 findResult [8];
|
|
void *foundNode;
|
|
void *visitedSet;
|
|
undefined4 visitedCount;
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 local_8;
|
|
EntityPtr 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<undefined2 *>((GHIDRA_CAST<char *>(visitedSet) + 0xc)) = 0x101;
|
|
local_8 = 0;
|
|
current = this->_parent;
|
|
while (ancestor = GHIDRA_CAST<Entity *>(current), current != (EntityPtr)0x0) {
|
|
if (current == (EntityPtr)pEVar1) goto LAB_006a9133;
|
|
_Find_lower_bound<>(findResult,&ancestor);
|
|
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(foundNode) + 0xd)) == '\0') &&
|
|
(GHIDRA_UINT(*GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(foundNode) + 0x10))) <= GHIDRA_UINT(current))) && (foundNode != visitedSet)
|
|
) break;
|
|
visitedFlag = GHIDRA_CAST<undefined1 *>(_Entity)::GetAncestorField(&ancestor);
|
|
*visitedFlag = 1;
|
|
current = ancestor->_parent;
|
|
}
|
|
pvVar2 = visitedSet;
|
|
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
|
|
(&visitedSet,(fuzzer_allocator<std::_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 = this->_spawnerEntity;
|
|
visitedCount = 0;
|
|
while (ancestor = GHIDRA_CAST<Entity *>(current), current != (EntityPtr)0x0) {
|
|
if (current == (EntityPtr)pEVar1) goto LAB_006a9133;
|
|
_Find_lower_bound<>(findResult,&ancestor);
|
|
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(foundNode) + 0xd)) == '\0') &&
|
|
(GHIDRA_UINT(*GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(foundNode) + 0x10))) <= GHIDRA_UINT(current))) && (foundNode != visitedSet)
|
|
) break;
|
|
visitedFlag = GHIDRA_CAST<undefined1 *>(_Entity)::GetAncestorField(&ancestor);
|
|
*visitedFlag = 1;
|
|
current = ancestor->_spawnerEntity;
|
|
}
|
|
isDescendant = 0;
|
|
LAB_006a90ff:
|
|
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
|
|
(&visitedSet,(fuzzer_allocator<std::_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;
|
|
undefined1 *visitedFlag;
|
|
EntityPtr ancestor;
|
|
undefined1 findResult [8];
|
|
void *foundNode;
|
|
void *visited;
|
|
undefined4 visitedSize;
|
|
EntityPtr current;
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 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<undefined2 *>((GHIDRA_CAST<char *>(visited) + 0xc)) = 0x101;
|
|
local_8 = 0;
|
|
current = (EntityPtr)this;
|
|
if (this != GHIDRA_CAST<Entity *>(0x0)) {
|
|
do {
|
|
ancestor = current;
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(current) + 0x28)) == 1) goto LAB_006a926c;
|
|
_Find_lower_bound<>(findResult,¤t);
|
|
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(foundNode) + 0xd)) == '\0') &&
|
|
(GHIDRA_UINT(*GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(foundNode) + 0x10))) <= GHIDRA_UINT(ancestor))) && (foundNode != visited)
|
|
) break;
|
|
visitedFlag = GHIDRA_CAST<undefined1 *>(_Entity)::GetAncestorField(¤t);
|
|
*visitedFlag = 1;
|
|
current = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(current) + 0x3bc));
|
|
} while (current != (EntityPtr)0x0);
|
|
}
|
|
visitedHead = visited;
|
|
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
|
|
(&visited,(fuzzer_allocator<std::_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 = (EntityPtr)this;
|
|
if (this != GHIDRA_CAST<Entity *>(0x0)) {
|
|
do {
|
|
ancestor = current;
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(current) + 0x28)) == 1) goto LAB_006a926c;
|
|
_Find_lower_bound<>(findResult,¤t);
|
|
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(foundNode) + 0xd)) == '\0') &&
|
|
(GHIDRA_UINT(*GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(foundNode) + 0x10))) <= GHIDRA_UINT(ancestor))) && (foundNode != visited)
|
|
) break;
|
|
visitedFlag = GHIDRA_CAST<undefined1 *>(_Entity)::GetAncestorField(¤t);
|
|
*visitedFlag = 1;
|
|
current = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(current) + 0x3c8));
|
|
} while (current != (EntityPtr)0x0);
|
|
}
|
|
ancestor = (EntityPtr)0x0;
|
|
LAB_006a926c:
|
|
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
|
|
(&visited,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)&visited,
|
|
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(visited) + 4));
|
|
operator_delete(visited,0x18);
|
|
ExceptionList = local_10;
|
|
return GHIDRA_CAST<Entity *>(ancestor);
|
|
}
|
|
|
|
// 006a92a0
|
|
void Entity::SetParent(Entity *parent)
|
|
{
|
|
Entity *local_8;
|
|
EntityPtr *parentRef;
|
|
|
|
parentRef = &this->_parent;
|
|
local_8 = this;
|
|
if (*parentRef != (EntityPtr)0x0) {
|
|
local_8 = GHIDRA_CAST<Entity *>(parentRef);
|
|
std::multiset<unsigned_int>::erase(&local_8);
|
|
}
|
|
*parentRef = (EntityPtr)parent;
|
|
if (parent != GHIDRA_CAST<Entity *>(0x0)) {
|
|
std::multiset<unsigned_int>::insert(parentRef);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006a92e0
|
|
void Entity::SetChild(Entity *child)
|
|
{
|
|
Entity *local_8;
|
|
EntityPtr *childRef;
|
|
|
|
childRef = &this->_child;
|
|
local_8 = this;
|
|
if (*childRef != (EntityPtr)0x0) {
|
|
local_8 = GHIDRA_CAST<Entity *>(childRef);
|
|
std::multiset<unsigned_int>::erase(&local_8);
|
|
}
|
|
*childRef = (EntityPtr)child;
|
|
if (child != GHIDRA_CAST<Entity *>(0x0)) {
|
|
std::multiset<unsigned_int>::insert(childRef);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006a9320
|
|
void Entity::SetTarget(Entity *target)
|
|
{
|
|
Entity *local_8;
|
|
EntityPtr *targetPtr;
|
|
|
|
targetPtr = &this->_target;
|
|
local_8 = this;
|
|
if (*targetPtr != (EntityPtr)0x0) {
|
|
local_8 = GHIDRA_CAST<Entity *>(targetPtr);
|
|
std::multiset<unsigned_int>::erase(&local_8);
|
|
}
|
|
*targetPtr = (EntityPtr)target;
|
|
if (target != GHIDRA_CAST<Entity *>(0x0)) {
|
|
std::multiset<unsigned_int>::insert(targetPtr);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006a9360
|
|
void Entity::SetSpawnerEntity(Entity *spawner)
|
|
{
|
|
Entity *local_8;
|
|
EntityPtr *spawnerPtr;
|
|
|
|
spawnerPtr = &this->_spawnerEntity;
|
|
local_8 = this;
|
|
if (*spawnerPtr != (EntityPtr)0x0) {
|
|
local_8 = GHIDRA_CAST<Entity *>(spawnerPtr);
|
|
std::multiset<unsigned_int>::erase(&local_8);
|
|
}
|
|
*spawnerPtr = (EntityPtr)spawner;
|
|
if (spawner != GHIDRA_CAST<Entity *>(0x0)) {
|
|
std::multiset<unsigned_int>::insert(spawnerPtr);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006a93a0
|
|
void Entity::Init(int type, int variant, int subType, uint initSeed)
|
|
{
|
|
float fVar1;
|
|
uint noScoreFlag;
|
|
undefined4 defaultColor [8];
|
|
undefined4 local_10;
|
|
undefined4 uStack_c;
|
|
undefined4 local_8;
|
|
float baseFriction;
|
|
void *damageEventsBegin;
|
|
Game *game;
|
|
undefined4 *luaRef;
|
|
EntityPtr *minecartRef;
|
|
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 = (this->_damageEvents)._begin;
|
|
minecartRef = &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 = (EntityPtr)0x0;
|
|
this->_bossStatusEffectCooldown = 0;
|
|
*GHIDRA_CAST<undefined4 *>(&this->_flags) = 0;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&this->_flags) + 4)) = 0;
|
|
(this->_damageEvents)._end = damageEventsBegin;
|
|
this->_pendingDamage = 0.0;
|
|
*GHIDRA_CAST<undefined4 *>(&this->_pendingDamageFlags) = 0;
|
|
*GHIDRA_CAST<undefined4 *>((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 = (EntityPtr)0x0;
|
|
this->_child = (EntityPtr)0x0;
|
|
this->_target = (EntityPtr)0x0;
|
|
if (*minecartRef != (EntityPtr)0x0) {
|
|
type = GHIDRA_INT(minecartRef);
|
|
std::multiset<unsigned_int>::erase(&type);
|
|
*minecartRef = (EntityPtr)0x0;
|
|
}
|
|
if (this->_hitEffect != (EntityPtr)0x0) {
|
|
type = GHIDRA_INT(&this->_hitEffect);
|
|
std::multiset<unsigned_int>::erase(&type);
|
|
this->_hitEffect = (EntityPtr)0x0;
|
|
}
|
|
(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<undefined4 *>(0x0)) {
|
|
luaL_unref(*luaRef,0xfff0b9d8,luaRef[1]);
|
|
operator_delete(luaRef,8);
|
|
this->_luaBridgeRef = (void *)0x0;
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006a98b0
|
|
void Entity::LoadEntityConfig()
|
|
{
|
|
void *pvVar1;
|
|
byte isMatch;
|
|
EntityConfig *entityConfig;
|
|
EntityConfig_Entity *pEVar2;
|
|
byte *gridCollisionText;
|
|
int entityType;
|
|
int variant;
|
|
byte *gridCollisionString;
|
|
float stageClamped;
|
|
float maxHp;
|
|
uint gridCollisionCapacity;
|
|
uint gridCollisionLength;
|
|
float stageHp;
|
|
|
|
entityConfig = &g_manager->_entityConfig;
|
|
variant = this->_variant;
|
|
entityType = this->_type;
|
|
pEVar2 = (GHIDRA_CAST<EntityConfig *>((entityConfig)))->EntityConfig::GetEntity(entityType,variant,this->_subtype);
|
|
if (pEVar2 != GHIDRA_CAST<EntityConfig_Entity *>(0x0)) {
|
|
(GHIDRA_CAST<EntityConfig *>((entityConfig)))->EntityConfig::PreloadResources(pEVar2);
|
|
variant = this->_variant;
|
|
entityType = this->_type;
|
|
}
|
|
pEVar2 = (GHIDRA_CAST<EntityConfig *>((&g_manager->_entityConfig)))->EntityConfig::GetEntity(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<byte *>("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<uint *>((GHIDRA_CAST<char *>(pvVar1) + 200));
|
|
gridCollisionString = GHIDRA_CAST<byte *>((GHIDRA_INT(pvVar1) + 0xb4));
|
|
gridCollisionLength = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(pvVar1) + 0xc4));
|
|
gridCollisionText = gridCollisionString;
|
|
if (0xf < gridCollisionCapacity) {
|
|
gridCollisionText = *GHIDRA_CAST<byte **>(gridCollisionString);
|
|
}
|
|
isMatch = str_eq(gridCollisionText,gridCollisionLength,GHIDRA_CAST<byte *>(&DAT_00b671d0),4);
|
|
if (isMatch != 0) {
|
|
this->_entityGridCollisionClass = 0;
|
|
return;
|
|
}
|
|
gridCollisionText = gridCollisionString;
|
|
if (0xf < gridCollisionCapacity) {
|
|
gridCollisionText = *GHIDRA_CAST<byte **>(gridCollisionString);
|
|
}
|
|
isMatch = str_eq(gridCollisionText,gridCollisionLength,GHIDRA_CAST<byte *>("walls"),5);
|
|
if (isMatch != 0) {
|
|
this->_entityGridCollisionClass = 3;
|
|
return;
|
|
}
|
|
gridCollisionText = gridCollisionString;
|
|
if (0xf < gridCollisionCapacity) {
|
|
gridCollisionText = *GHIDRA_CAST<byte **>(gridCollisionString);
|
|
}
|
|
isMatch = str_eq(gridCollisionText,gridCollisionLength,GHIDRA_CAST<byte *>("ground"),6);
|
|
if (isMatch != 0) {
|
|
this->_entityGridCollisionClass = 5;
|
|
return;
|
|
}
|
|
if (0xf < gridCollisionCapacity) {
|
|
gridCollisionString = *GHIDRA_CAST<byte **>(gridCollisionString);
|
|
}
|
|
isMatch = str_eq(gridCollisionString,gridCollisionLength,GHIDRA_CAST<byte *>("nopits"),6);
|
|
if (isMatch == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("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(byte isSimulated)
|
|
{
|
|
void *pvVar1;
|
|
byte bVar2;
|
|
char isDestroyed;
|
|
int iVar3;
|
|
GridEntity *gridEntity;
|
|
uint uVar4;
|
|
int neighborRow;
|
|
GridEntity *pit;
|
|
uint uVar5;
|
|
int iVar6;
|
|
uint uVar7;
|
|
undefined1 *signY;
|
|
undefined1 *sign;
|
|
float fVar8;
|
|
float fVar9;
|
|
float fVar10;
|
|
float fVar11;
|
|
float fVar12;
|
|
float fVar13;
|
|
byte isNoPush;
|
|
float local_70;
|
|
float local_6c;
|
|
int gridCollisionClass;
|
|
GridEntity *cellGridEntity;
|
|
uint pointIndex;
|
|
uint local_48;
|
|
float local_44;
|
|
float normalY;
|
|
Vector local_38;
|
|
undefined4 hitSourceType;
|
|
undefined4 hitSourceVariant;
|
|
int hitSpawnerType;
|
|
int hitSpawnerVariant;
|
|
float hitPosX;
|
|
float hitPosY;
|
|
float hitVelX;
|
|
float hitVelY;
|
|
uint hitFlags;
|
|
Entity *hitSourceEntity;
|
|
Vector *clampPos;
|
|
void *collisionPointsEnd;
|
|
Room *curRoom;
|
|
bool isWallCollision;
|
|
Vector *pos;
|
|
Room *room;
|
|
|
|
if (isSimulated == 0) {
|
|
this->_collidesWithGrid = 0;
|
|
}
|
|
if (this->_minecart != (EntityPtr)0x0) {
|
|
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<undefined1 *>(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<undefined1 *>(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<undefined1 *>(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<undefined1 *>(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<uint *>((*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 ((gridEntity->_desc)._type == 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) || ((cellGridEntity->_desc)._type != 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<undefined1 *>(0x0);
|
|
if (0.0 <= fVar11) {
|
|
signY = GHIDRA_CAST<undefined1 *>(0x3f800000);
|
|
}
|
|
else {
|
|
signY = &DAT_bf800000;
|
|
}
|
|
}
|
|
else {
|
|
signY = GHIDRA_CAST<undefined1 *>(0x0);
|
|
if (0.0 <= fVar10) {
|
|
sign = GHIDRA_CAST<undefined1 *>(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
|
|
byte Entity::is_grid_collision_at(Vector *position)
|
|
{
|
|
uint gridCollision;
|
|
int gridY;
|
|
uint pointCount;
|
|
int iVar1;
|
|
void *pvVar2;
|
|
uint 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(byte isSimulated)
|
|
{
|
|
Room *gridEntity;
|
|
byte bVar1;
|
|
char isCollided;
|
|
Entity_Player *player;
|
|
uint uVar2;
|
|
GridEntity *newRock;
|
|
uint uVar3;
|
|
uint 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;
|
|
uint 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;
|
|
uint 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;
|
|
uint 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;
|
|
uint local_68;
|
|
Entity *local_64;
|
|
Vector *posRef;
|
|
Vector local_5c;
|
|
Vector local_54;
|
|
Vector pointPos;
|
|
int pointIndex;
|
|
float freeDepth;
|
|
float blockedDepth;
|
|
uint isCharmed;
|
|
float normalY;
|
|
float normalX;
|
|
void *prevExceptionList;
|
|
undefined1 *puStack_18;
|
|
undefined4 ehState;
|
|
void *collisionPoints;
|
|
Game *game;
|
|
undefined4 *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<byte *>("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 != (EntityPtr)0x0) {
|
|
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<char *>(game->_room->_descriptor) + 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 = (gridEntity->_desc)._type;
|
|
if (((iVar5 == 3) || ((iVar5 == 0x18 || (iVar5 == 0xb)))) && (uVar2 != 0)) {
|
|
uVar2 = (gridEntity->_desc)._spawnSeed;
|
|
if (iVar6 < 0x1c0) {
|
|
oldGridEntity = gridEntity->_gridEntities[iVar6];
|
|
if ((oldGridEntity != GHIDRA_CAST<undefined4 *>(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<undefined ***>(newRock) = IsaacRepentancePlus::GridEntity_Rock::vftable;
|
|
*GHIDRA_CAST<undefined4 *>((newRock + 1)) = 0;
|
|
newRock[1]._desc._spawnCount = 0;
|
|
newRock[1]._desc._spawnSeed = 0xf;
|
|
*GHIDRA_CAST<undefined1 *>((newRock + 1)) = 0;
|
|
newRock[1]._desc._varData = 0;
|
|
newRock[1]._spawnFrame = 0;
|
|
newRock[1]._rng._seed = 0xf;
|
|
*GHIDRA_CAST<undefined1 *>(&newRock[1]._desc._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)) {
|
|
(newRock->_desc)._type = 2;
|
|
newRock->_gridIndex = iVar6;
|
|
if (gridEntity->_gridEntities[iVar6] != GHIDRA_CAST<undefined4 *>(0x0)) {
|
|
(*(code *)**GHIDRA_CAST<undefined4 **>(gridEntity->_gridEntities[iVar6]))(1);
|
|
}
|
|
gridEntity->_gridEntities[iVar6] = newRock;
|
|
(newRock->_desc)._variant = 0;
|
|
(newRock->_desc)._varData = 0;
|
|
(GHIDRA_CAST<GridEntity *>((newRock)))->GridEntity::Init(uVar2);
|
|
}
|
|
}
|
|
piVar7 = gridEntity->_gridEntities[iVar6];
|
|
}
|
|
else {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("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 (((gridEntity->_desc)._type != 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) && ((gridEntity->_desc)._type == 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 ((gridEntity->_desc)._type == 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) {
|
|
std::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) {
|
|
std::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
|
|
byte Entity::IsEnemy()
|
|
{
|
|
if ((*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2) || (this->_type != 1)) {
|
|
return this->_type - 10U < 0x3de;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
// 006ac560
|
|
byte Entity::IsVulnerableEnemy(Entity *source)
|
|
{
|
|
byte bVar1;
|
|
Entity *lastSpawner;
|
|
byte 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
|
|
byte 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<undefined8 *>((this->_sprite)._color._offset) = *GHIDRA_CAST<undefined8 *>((this->_color)._offset);
|
|
(this->_sprite)._color._offset[2] = (this->_color)._offset[2];
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006ac710
|
|
byte Entity::IsFrame(int frequency, int offset)
|
|
{
|
|
byte 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)
|
|
{
|
|
byte 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)
|
|
{
|
|
byte isDescendant;
|
|
qword *allocatedBytes;
|
|
int count;
|
|
undefined4 *entitySlot;
|
|
EntityList_EL local_24;
|
|
Entity *self;
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 local_8;
|
|
uint allocSize;
|
|
qword oldAllocated;
|
|
undefined4 *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)),&local_24,type,variant,-1,0,0);
|
|
local_8 = 0;
|
|
variant = local_24._size;
|
|
if (local_24._size != 0) {
|
|
entitySlot = local_24._data;
|
|
do {
|
|
isDescendant = IsDescendantOf(GHIDRA_CAST<Entity *>(*entitySlot),self);
|
|
if ((isDescendant != 0) && (count = count + 1, outEntities != (void *)0x0)) {
|
|
outEnd = *GHIDRA_CAST<undefined4 **>((GHIDRA_CAST<char *>(outEntities) + 4));
|
|
if (outEnd == *GHIDRA_CAST<undefined4 **>((GHIDRA_CAST<char *>(outEntities) + 8))) {
|
|
std::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 ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_24)) + 0x0))) == '\0') {
|
|
if (g_mainHeap == (void *)0x0) {
|
|
allocatedBytes = &g_allocatedBytesNoHeap;
|
|
}
|
|
else {
|
|
allocatedBytes = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
|
|
}
|
|
if (local_24._data != GHIDRA_CAST<undefined4 *>(0x0)) {
|
|
allocSize = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(local_24._data) + -4));
|
|
oldAllocated = *allocatedBytes;
|
|
*GHIDRA_CAST<uint *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - allocSize;
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocated) < allocSize));
|
|
free(GHIDRA_CAST<uint *>((GHIDRA_INT(local_24._data) + -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;
|
|
byte isItemHeld;
|
|
Entity_Player *killerPlayer;
|
|
ColorMod *Color;
|
|
Color explosionColor;
|
|
uint 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()
|
|
{
|
|
undefined4 *luaBridgeRef;
|
|
|
|
this->_exists = 0;
|
|
if (this->_dead == 0) {
|
|
this->_dead = 1;
|
|
}
|
|
ReleaseLuaRef(this);
|
|
luaBridgeRef = this->_luaBridgeRef;
|
|
if (luaBridgeRef != GHIDRA_CAST<undefined4 *>(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;
|
|
EntityPtr *ptrSlot;
|
|
|
|
local_8 = this;
|
|
if (this->_parent != (EntityPtr)0x0) {
|
|
local_8 = GHIDRA_CAST<Entity *>(&this->_parent);
|
|
std::multiset<unsigned_int>::erase(&local_8);
|
|
}
|
|
this->_parent = (EntityPtr)0x0;
|
|
if (this->_child != (EntityPtr)0x0) {
|
|
local_8 = GHIDRA_CAST<Entity *>(&this->_child);
|
|
std::multiset<unsigned_int>::erase(&local_8);
|
|
}
|
|
this->_child = (EntityPtr)0x0;
|
|
if (this->_target != (EntityPtr)0x0) {
|
|
local_8 = GHIDRA_CAST<Entity *>(&this->_target);
|
|
std::multiset<unsigned_int>::erase(&local_8);
|
|
}
|
|
this->_target = (EntityPtr)0x0;
|
|
if (this->_spawnerEntity != (EntityPtr)0x0) {
|
|
local_8 = GHIDRA_CAST<Entity *>(&this->_spawnerEntity);
|
|
std::multiset<unsigned_int>::erase(&local_8);
|
|
}
|
|
this->_spawnerEntity = (EntityPtr)0x0;
|
|
ptrSlot = &this->_minecart;
|
|
if (*ptrSlot != (EntityPtr)0x0) {
|
|
local_8 = GHIDRA_CAST<Entity *>(ptrSlot);
|
|
std::multiset<unsigned_int>::erase(&local_8);
|
|
*ptrSlot = (EntityPtr)0x0;
|
|
}
|
|
if (this->_hitEffect != (EntityPtr)0x0) {
|
|
local_8 = GHIDRA_CAST<Entity *>(&this->_hitEffect);
|
|
std::multiset<unsigned_int>::erase(&local_8);
|
|
this->_hitEffect = (EntityPtr)0x0;
|
|
}
|
|
ptrSlot = &this->_iceFrozenEffect;
|
|
if (this->_iceFrozenEffect != (EntityPtr)0x0) {
|
|
(**(code **)(*GHIDRA_CAST<int *>(this->_iceFrozenEffect) + 0x28))();
|
|
}
|
|
if (*ptrSlot != (EntityPtr)0x0) {
|
|
local_8 = GHIDRA_CAST<Entity *>(ptrSlot);
|
|
std::multiset<unsigned_int>::erase(&local_8);
|
|
}
|
|
*ptrSlot = (EntityPtr)0x0;
|
|
referrers = &this->_entityPtrReferrers;
|
|
referrersHead = referrers->_head;
|
|
local_8 = *GHIDRA_CAST<Entity **>(referrersHead);
|
|
if (local_8 != referrersHead) {
|
|
do {
|
|
*GHIDRA_CAST<undefined4 *>((local_8->_damageEvents)._capacity) = 0;
|
|
std::
|
|
_Tree_unchecked_const_iterator<std::_Tree_val<std::_Tree_simple_types<unsigned_int>_>,std::_Iterator_base0>
|
|
::operator++((_Tree_unchecked_const_iterator<std::_Tree_val<std::_Tree_simple_types<unsigned_int>_>,std::_Iterator_base0>
|
|
*)&local_8);
|
|
referrersHead = referrers->_head;
|
|
} while (local_8 != referrersHead);
|
|
}
|
|
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
|
|
(referrers,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)referrers,
|
|
*(_Tree_node<unsigned_int,void*> **)&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((referrersHead)) + 0x4))));
|
|
*GHIDRA_CAST<Entity **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((referrersHead)) + 0x4)))) = referrersHead;
|
|
*GHIDRA_CAST<Entity **>(referrersHead) = referrersHead;
|
|
(referrersHead->_damageEvents)._begin = referrersHead;
|
|
(this->_entityPtrReferrers)._size = 0;
|
|
if (this->_valid != 0) {
|
|
(this->_colorParams)._end = (this->_colorParams)._begin;
|
|
(this->_damageEvents)._end = (this->_damageEvents)._begin;
|
|
(this->_collisionPoints)._end = (this->_collisionPoints)._begin;
|
|
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Reset();
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006acd10
|
|
byte Entity::IsDamageSourceFriendly(EntityRef *source)
|
|
{
|
|
int iVar1;
|
|
bool bVar2;
|
|
byte isDescendant;
|
|
void *charmer;
|
|
int deathmatchMode;
|
|
qword 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
|
|
byte Entity::TakeDamage(float damage, ulonglong damageFlags, EntityRef *source, int damageCountdown)
|
|
{
|
|
float fVar1;
|
|
byte bVar2;
|
|
char cVar3;
|
|
EntityPtr EVar4;
|
|
EntityPtr EVar5;
|
|
float *overlayNull;
|
|
Entity_Player *player;
|
|
LuaEngine *this_00;
|
|
int iVar6;
|
|
uint uVar7;
|
|
EntityPtr *local_44;
|
|
float damageInfo [2];
|
|
uint damageFlagsLow;
|
|
uint damageFlagsHigh;
|
|
EntityRef damageSource;
|
|
EntityPtr *entityRefSlot;
|
|
Manager *manager;
|
|
uint *pendingFlagsHigh;
|
|
float posOffsetY;
|
|
|
|
if (this->_type == 1) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("Entity TakeDamage should not be called for Entity Player!"));
|
|
}
|
|
uVar7 = 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) {
|
|
EVar4 = this->_parent;
|
|
EVar5 = EVar4;
|
|
joined_r0x006acf5a:
|
|
if (EVar5 != (EntityPtr)0x0) goto LAB_006acf96;
|
|
}
|
|
}
|
|
else {
|
|
iVar6 = this->_type;
|
|
if (iVar6 == 0x325) goto LAB_006ad14f;
|
|
if (iVar6 == 0x340) {
|
|
if ((((this->_variant == 1) && (EVar4 = this->_spawnerEntity, EVar4 != (EntityPtr)0x0)) &&
|
|
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar4) + 0x28)) == 0x389)) &&
|
|
((fVar1 = this[2]._preInterpolatePos.x, fVar1 == 2.24208e-44 || (fVar1 == 7.00649e-45))))
|
|
goto LAB_006acf96;
|
|
}
|
|
else {
|
|
if (iVar6 == 0x3b6) goto LAB_006acf1f;
|
|
if (((iVar6 == 0x379) && (EVar4 = this->_parent, EVar4 != (EntityPtr)0x0)) &&
|
|
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar4) + 0x28)) == 0x399)) {
|
|
if (*GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(EVar4) + 0x3c0)) != this) goto LAB_006acf96;
|
|
EVar5 = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar4) + 0x188));
|
|
goto joined_r0x006acf5a;
|
|
}
|
|
}
|
|
}
|
|
local_44 = GHIDRA_CAST<EntityPtr *>(CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_44)) + 0x1))),1));
|
|
if ((this->_flags & 0x20000000) == 0) {
|
|
local_44 = GHIDRA_CAST<EntityPtr *>(((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(local_44))) + 0x1))) << 8));
|
|
}
|
|
EVar4 = (EntityPtr)find_nearest_enemy(&this->_pos,GHIDRA_CAST<float *>(&local_44),(byte)local_44);
|
|
if (EVar4 == (EntityPtr)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)))) {
|
|
iVar6 = 0;
|
|
do {
|
|
EVar5 = (EntityPtr)(GHIDRA_CAST<Game *>((g_game)))->Game::GetPlayer(uVar7);
|
|
EVar4 = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar5) + 0x1e68));
|
|
if ((((EVar4 == (EntityPtr)0x0) || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar4) + 0x161c)) == -1)) ||
|
|
((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar5) + 0x161c)) <= *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar4) + 0x161c)) || (EVar5 == EVar4))))
|
|
&& (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar5) + 0x3bc)) == 0)) {
|
|
iVar6 = iVar6 + 1;
|
|
}
|
|
uVar7 = uVar7 + 1;
|
|
} while (uVar7 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2)));
|
|
if (1 < iVar6) {
|
|
damage = damage * 0.8;
|
|
}
|
|
}
|
|
this_00 = GHIDRA_CAST<LuaEngine *>((*GHIDRA_CAST<uint *>((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<undefined4 *>((GHIDRA_CAST<char *>(&(damageFlags)) + 0x4)));
|
|
damageFlagsLow = GHIDRA_UINT(damageFlags);
|
|
(GHIDRA_CAST<EntityRef *>((&damageSource)))->EntityRef::operator_(source);
|
|
FUN_006b7db0(damageInfo);
|
|
fVar1 = this->_pendingDamage;
|
|
*GHIDRA_CAST<uint *>(&this->_pendingDamageFlags) = GHIDRA_UINT(this->_pendingDamageFlags) | GHIDRA_UINT(damageFlags);
|
|
pendingFlagsHigh = GHIDRA_CAST<uint *>((GHIDRA_INT(&this->_pendingDamageFlags) + 4));
|
|
*pendingFlagsHigh = *pendingFlagsHigh | (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(damageFlags)) + 0x4)));
|
|
this->_pendingDamage = damage + fVar1;
|
|
if (source->_entity == GHIDRA_CAST<Entity *>(0x0)) {
|
|
player = GHIDRA_CAST<Entity_Player *>(0x0);
|
|
}
|
|
else {
|
|
player = GHIDRA_CAST<Entity_Player *>(GetPlayerAncestor(source->_entity));
|
|
}
|
|
if ((((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (this->_type == 1)) ||
|
|
(this->_type - 10U < 0x3de)) && (player != GHIDRA_CAST<Entity_Player *>(0x0))) {
|
|
Player_stats_add(&g_game->_onlinePlayerStats,0xf,player,damage);
|
|
iVar6 = __ftoui3();
|
|
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((player)) + 0x16b8)))) = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((player)) + 0x16b8)))) + iVar6;
|
|
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((player)) + 0x16bc)))) = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((player)) + 0x16bc)))) + iVar6;
|
|
}
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
LAB_006acf96:
|
|
manager = g_manager;
|
|
local_44 = GHIDRA_CAST<EntityPtr *>(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 (this->_hitEffect != (EntityPtr)0x0) {
|
|
(**(code **)(*GHIDRA_CAST<int *>(this->_hitEffect) + 0x28))();
|
|
}
|
|
uVar7 = Random();
|
|
EVar5 = (EntityPtr)
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0xa0,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(EVar4),0,uVar7,0);
|
|
if (*GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar5) + 0x3bc)) != (EntityPtr)0x0) {
|
|
local_44 = GHIDRA_CAST<EntityPtr *>((GHIDRA_INT(EVar5) + 0x3bc));
|
|
std::multiset<unsigned_int>::erase(&local_44);
|
|
}
|
|
*GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar5) + 0x3bc)) = EVar4;
|
|
if (EVar4 != (EntityPtr)0x0) {
|
|
std::multiset<unsigned_int>::insert(GHIDRA_CAST<EntityPtr *>((GHIDRA_INT(EVar5) + 0x3bc)));
|
|
}
|
|
entityRefSlot = GHIDRA_CAST<EntityPtr *>((GHIDRA_INT(EVar5) + 0x3c4));
|
|
if (*GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar5) + 0x3c4)) != (EntityPtr)0x0) {
|
|
local_44 = entityRefSlot;
|
|
std::multiset<unsigned_int>::erase(&local_44);
|
|
}
|
|
*entityRefSlot = (EntityPtr)this;
|
|
std::multiset<unsigned_int>::insert(entityRefSlot);
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar5) + 0x468)) = 0;
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar5) + 0x46c)) = 0xc1c00000;
|
|
if (((this->_sprite)._animState._animData != (void *)0x0) &&
|
|
(overlayNull = AnimationState::GetNullFrame
|
|
(&(this->_sprite)._animState,GHIDRA_CAST<byte *>("OverlayEffect")),
|
|
overlayNull != GHIDRA_CAST<float *>(0x0))) {
|
|
fVar1 = overlayNull[1];
|
|
posOffsetY = (this->_posOffset).y;
|
|
(GHIDRA_CAST<Vector *>((GHIDRA_INT(EVar5) + 0x34c)))->x = ((*overlayNull - 0.0) * 0.5) / 0.65 + (this->_posOffset).x
|
|
;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar5) + 0x350)) = ((fVar1 - 4.0) * 0.5) / 0.65 + posOffsetY;
|
|
}
|
|
(**(code **)(*GHIDRA_CAST<int *>(EVar5) + 0xc))();
|
|
entityRefSlot = &this->_hitEffect;
|
|
if (this->_hitEffect == EVar5) {
|
|
return 0;
|
|
}
|
|
if (this->_hitEffect != (EntityPtr)0x0) {
|
|
local_44 = entityRefSlot;
|
|
std::multiset<unsigned_int>::erase(&local_44);
|
|
}
|
|
*entityRefSlot = EVar5;
|
|
std::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)
|
|
{
|
|
byte isSecondHand;
|
|
int secondHandMultiplier;
|
|
Entity *rootSpawner;
|
|
EntityPtr spawner;
|
|
|
|
if (((this->_type != 1) || (1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager))) &&
|
|
(rootSpawner = source->_entity, rootSpawner != GHIDRA_CAST<Entity *>(0x0))) {
|
|
for (spawner = rootSpawner->_spawnerEntity; spawner != (EntityPtr)0x0;
|
|
spawner = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(spawner) + 0x3c8))) {
|
|
rootSpawner = GHIDRA_CAST<Entity *>(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, byte ignoreBossStatusCooldown)
|
|
{
|
|
byte bVar1;
|
|
char cVar2;
|
|
int newCountdown;
|
|
int extraout_EDX;
|
|
undefined1 auStack_3c [4];
|
|
undefined4 freezeColor;
|
|
undefined4 uStack_34;
|
|
undefined4 uStack_30;
|
|
undefined4 uStack_2c;
|
|
undefined4 local_28;
|
|
undefined4 uStack_24;
|
|
undefined4 uStack_20;
|
|
undefined4 uStack_1c;
|
|
undefined4 local_18;
|
|
undefined4 local_14;
|
|
undefined4 local_10;
|
|
uint local_c;
|
|
EntityPtr ancestor;
|
|
int currentCountdown;
|
|
uint flagsLow;
|
|
EntityPtr 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 = this->_parent;
|
|
while (ancestor = nextParent, ancestor != (EntityPtr)0x0) {
|
|
this = GHIDRA_CAST<Entity *>(ancestor);
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(ancestor) + 0x3bc));
|
|
}
|
|
}
|
|
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<undefined4 *>((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&this->_flags) + 4));
|
|
local_28 = 0;
|
|
uStack_24 = 0;
|
|
uStack_20 = 0;
|
|
uStack_1c = 0;
|
|
*GHIDRA_CAST<uint *>(&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, byte ignoreBossStatusCooldown)
|
|
{
|
|
byte bVar1;
|
|
char cVar2;
|
|
int newCountdown;
|
|
int extraout_EDX;
|
|
ColorMod poisonColor;
|
|
uint flags;
|
|
EntityPtr nextParent;
|
|
int oldCountdown;
|
|
EntityPtr 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 = this->_parent;
|
|
while (parent = nextParent, parent != (EntityPtr)0x0) {
|
|
this = GHIDRA_CAST<Entity *>(parent);
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(parent) + 0x3bc));
|
|
}
|
|
}
|
|
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<undefined4 *>((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&this->_flags) + 4));
|
|
*GHIDRA_CAST<uint *>(&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, byte ignoreBossStatusCooldown)
|
|
{
|
|
byte bVar1;
|
|
char isBoss;
|
|
int extraout_EDX;
|
|
undefined4 flagsHigh;
|
|
uint flagsLow;
|
|
EntityPtr nextParent;
|
|
EntityPtr parent;
|
|
int vtable;
|
|
|
|
bVar1 = IsDamageSourceFriendly(this,ref);
|
|
if (bVar1 == 0) {
|
|
apply_second_hand_duration(this,duration,ref);
|
|
bVar1 = DoesEntityShareStatus(this);
|
|
if (bVar1 != 0) {
|
|
nextParent = this->_parent;
|
|
while (parent = nextParent, parent != (EntityPtr)0x0) {
|
|
this = GHIDRA_CAST<Entity *>(parent);
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(parent) + 0x3bc));
|
|
}
|
|
}
|
|
if (extraout_EDX < 1) {
|
|
if (extraout_EDX < 0) {
|
|
flagsLow = GHIDRA_UINT(this->_flags);
|
|
flagsHigh = *GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&this->_flags) + 4));
|
|
if ((flagsLow & 1) == 0) {
|
|
this->_slowingCountdown = 2;
|
|
*GHIDRA_CAST<uint *>(&this->_flags) = flagsLow | 0x80;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&this->_flags) + 4)) = flagsHigh;
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
flagsLow = GHIDRA_UINT(this->_flags);
|
|
flagsHigh = *GHIDRA_CAST<undefined4 *>((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<uint *>(&this->_flags) = flagsLow | 0x80;
|
|
*GHIDRA_CAST<undefined4 *>((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, byte ignoreBossStatusCooldown, byte addEnemyKillScore)
|
|
{
|
|
int iVar1;
|
|
byte bVar2;
|
|
char cVar3;
|
|
uint uVar4;
|
|
Entity_NPC *npc;
|
|
int unusedArg;
|
|
int extraout_ECX;
|
|
int extraout_EDX;
|
|
undefined4 *extraout_EDX_00;
|
|
undefined4 *entityIt;
|
|
void *sourceEntity;
|
|
int iVar5;
|
|
Game *game;
|
|
uint uVar6;
|
|
Entity *statusOwner;
|
|
float sourcePosX;
|
|
float sourcePosY;
|
|
float sourceVelX;
|
|
float sourceVelY;
|
|
undefined1 auStack_54 [7];
|
|
char isAlreadyCharmed;
|
|
uint uStack_4c;
|
|
int sourceSpawnerVariant;
|
|
EntityRef *local_44;
|
|
Entity *local_40;
|
|
uint uStack_3c;
|
|
undefined4 charmColor;
|
|
undefined4 uStack_34;
|
|
undefined4 uStack_30;
|
|
undefined4 uStack_2c;
|
|
undefined4 local_28;
|
|
undefined4 uStack_24;
|
|
undefined4 uStack_20;
|
|
undefined4 uStack_1c;
|
|
undefined4 local_18;
|
|
undefined4 local_14;
|
|
undefined4 local_10;
|
|
uint local_c;
|
|
undefined4 flagsHigh;
|
|
EntityPtr nextParent;
|
|
EntityPtr parentIt;
|
|
Entity *roomEntity;
|
|
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 = this->_parent;
|
|
statusOwner = this;
|
|
while (parentIt = nextParent, parentIt != (EntityPtr)0x0) {
|
|
statusOwner = GHIDRA_CAST<Entity *>(parentIt);
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(parentIt) + 0x3bc));
|
|
}
|
|
}
|
|
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<undefined4 *>((GHIDRA_INT(&statusOwner->_flags) + 4));
|
|
*GHIDRA_CAST<uint *>(&statusOwner->_flags) = GHIDRA_UINT(statusOwner->_flags) | 0x20000100;
|
|
*GHIDRA_CAST<undefined4 *>((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 ((g_game->_seedEffects)._isCustomRun == 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)) &&
|
|
(((g_manager->_state != 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<undefined4 **>((GHIDRA_CAST<char *>(game->_room) + 0x125c));
|
|
do {
|
|
roomEntity = GHIDRA_CAST<Entity *>(*entityIt);
|
|
if ((((1 < iVar1) && (roomEntity->_type == 1)) || (roomEntity->_type - 10U < 0x3de))
|
|
&& ((roomEntity->_flags & 0x20000000) != 0)) {
|
|
bVar2 = DoesEntityShareStatus(roomEntity);
|
|
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) {
|
|
(GHIDRA_CAST<PersistentGameData *>((&g_manager->_persistentGameData)))->PersistentGameData::TryUnlock(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<undefined4 *>((GHIDRA_INT(&statusOwner->_flags) + 4)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&statusOwner->_flags) + 4));
|
|
local_28 = 0;
|
|
uStack_24 = 0;
|
|
uStack_20 = 0;
|
|
uStack_1c = 0;
|
|
*GHIDRA_CAST<uint *>(&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<uint *>((GHIDRA_CAST<char *>(sourceEntity) + 0x168)) & 0x100) == 0) goto LAB_006adc50;
|
|
uVar6 = 1;
|
|
LAB_006adc56:
|
|
if ((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(sourceEntity) + 0x168)) & 0x20000000) == 0) goto LAB_006adc72;
|
|
uStack_3c = 2;
|
|
LAB_006adc7e:
|
|
if ((*GHIDRA_CAST<uint *>((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, byte ignoreBossStatusCooldown)
|
|
{
|
|
byte bVar1;
|
|
char cVar2;
|
|
int adjustedDuration;
|
|
uint confusedFlagBefore;
|
|
Entity_NPC *npc;
|
|
int cappedCountdown;
|
|
uint flagsLow;
|
|
int newCountdown;
|
|
ColorMod confusionColor;
|
|
EntityPtr ancestor;
|
|
undefined4 flagsHigh;
|
|
EntityPtr 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 = this->_parent;
|
|
while (ancestor = nextParent, ancestor != (EntityPtr)0x0) {
|
|
this = GHIDRA_CAST<Entity *>(ancestor);
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(ancestor) + 0x3bc));
|
|
}
|
|
}
|
|
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<undefined4 *>((GHIDRA_INT(&this->_flags) + 4));
|
|
*GHIDRA_CAST<uint *>(&this->_flags) = flagsLow | 0x200;
|
|
*GHIDRA_CAST<undefined4 *>((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, byte ignoreBossStatusCooldown)
|
|
{
|
|
byte bVar1;
|
|
char cVar2;
|
|
int freezeDuration;
|
|
ColorMod midasColor;
|
|
EntityPtr ancestor;
|
|
undefined4 flagsHigh;
|
|
EntityPtr nextParent;
|
|
|
|
bVar1 = IsDamageSourceFriendly(this,ref);
|
|
if (bVar1 == 0) {
|
|
freezeDuration = apply_second_hand_duration(this,duration,ref);
|
|
bVar1 = DoesEntityShareStatus(this);
|
|
if (bVar1 != 0) {
|
|
nextParent = this->_parent;
|
|
while (ancestor = nextParent, ancestor != (EntityPtr)0x0) {
|
|
this = GHIDRA_CAST<Entity *>(ancestor);
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(ancestor) + 0x3bc));
|
|
}
|
|
}
|
|
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<undefined4 *>((GHIDRA_INT(&this->_flags) + 4));
|
|
*GHIDRA_CAST<uint *>(&this->_flags) = GHIDRA_UINT(this->_flags) | 0x420;
|
|
*GHIDRA_CAST<undefined4 *>((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, byte ignoreBossStatusCooldown)
|
|
{
|
|
byte bVar1;
|
|
char isBoss;
|
|
int iVar2;
|
|
undefined4 extraout_EAX;
|
|
Entity_NPC *npc;
|
|
int newFearCountdown;
|
|
undefined1 auStack_44 [7];
|
|
byte isHadFearFlags;
|
|
EntityRef *sourceRef;
|
|
Color fearColor;
|
|
uint local_c;
|
|
Game *game;
|
|
EntityPtr nextParent;
|
|
int oldFearCountdown;
|
|
EntityPtr 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 = this->_parent;
|
|
while (parent = nextParent, parent != (EntityPtr)0x0) {
|
|
this = GHIDRA_CAST<Entity *>(parent);
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(parent) + 0x3bc));
|
|
}
|
|
}
|
|
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<uint *>(&this->_flags) = GHIDRA_UINT(this->_flags) | 0x800;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST<undefined4 *>((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, byte ignoreBossStatusCooldown)
|
|
{
|
|
byte bVar1;
|
|
char cVar2;
|
|
int newBurnCountdown;
|
|
int extraout_EDX;
|
|
float burnDamage;
|
|
int burnCountdown;
|
|
uint entityFlags;
|
|
EntityPtr nextParent;
|
|
EntityPtr parent;
|
|
void *sourceEntity;
|
|
void *spawner;
|
|
|
|
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) && (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:
|
|
bVar1 = DoesEntityShareStatus(this);
|
|
if (bVar1 != 0) {
|
|
nextParent = this->_parent;
|
|
while (parent = nextParent, parent != (EntityPtr)0x0) {
|
|
this = GHIDRA_CAST<Entity *>(parent);
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(parent) + 0x3bc));
|
|
}
|
|
}
|
|
if (((extraout_EDX != 0) && (entityFlags = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x168)), (entityFlags & 1) == 0))
|
|
&& ((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x238)) < 1 || (ignoreBossStatusCooldown != 0)))) {
|
|
burnCountdown = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x234));
|
|
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;
|
|
}
|
|
}
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x234)) = newBurnCountdown;
|
|
if ((entityFlags & 0x1000) == 0) {
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x2e4)) = 0;
|
|
}
|
|
burnDamage = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x324));
|
|
if (burnDamage <= damage) {
|
|
burnDamage = damage;
|
|
}
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x324)) = burnDamage;
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x168)) = entityFlags | 0x1000;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x16c)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x16c));
|
|
if ((ignoreBossStatusCooldown == 0) && (cVar2 = FUN_006ae7a0(), cVar2 != '\0')) {
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x238)) = 0xf0;
|
|
}
|
|
CopyStatusEffects(this);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006ae420
|
|
void Entity::AddBleeding(EntityRef *ref, int duration, byte unused)
|
|
{
|
|
byte bVar1;
|
|
char cVar2;
|
|
uint refFlagReflected;
|
|
int newCountdown;
|
|
int extraout_EDX;
|
|
Entity *statusOwner;
|
|
uint local_38;
|
|
EntityRef sourceRef;
|
|
EntityPtr ancestor;
|
|
uint *flagsHigh;
|
|
EntityPtr 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 = this->_parent;
|
|
statusOwner = this;
|
|
while (ancestor = nextParent, ancestor != (EntityPtr)0x0) {
|
|
statusOwner = GHIDRA_CAST<Entity *>(ancestor);
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(ancestor) + 0x3bc));
|
|
}
|
|
}
|
|
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<uint *>((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<uint *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x168)) & 0x100) == 0) goto LAB_006ae59a;
|
|
sourceRef._flags = 1;
|
|
LAB_006ae5a0:
|
|
if ((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x168)) & 0x20000000) == 0) goto LAB_006ae5bc;
|
|
local_38 = 2;
|
|
LAB_006ae5c8:
|
|
if ((*GHIDRA_CAST<uint *>((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()
|
|
{
|
|
uint *flagsHigh;
|
|
qword oldFlags;
|
|
|
|
(this->_colorParams)._end = (this->_colorParams)._begin;
|
|
*GHIDRA_CAST<uint *>(&this->_flags) = GHIDRA_UINT(this->_flags) & 0xdeffe01f;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST<undefined4 *>((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<uint *>((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;
|
|
EntityPtr *pEVar2;
|
|
code *pcVar3;
|
|
longlong lVar4;
|
|
longlong lVar5;
|
|
BitSet128 flags;
|
|
byte bVar6;
|
|
char cVar7;
|
|
Vector *velocityDir;
|
|
int iVar8;
|
|
ColorMod *color;
|
|
ColorMod *from;
|
|
EntityRef *sourceRef;
|
|
EntityPtr EVar9;
|
|
int *piVar10;
|
|
Entity *tmpEntity;
|
|
uint uVar11;
|
|
uint uVar12;
|
|
EntityPtr **ppEVar13;
|
|
uint uVar14;
|
|
int iVar15;
|
|
undefined4 *hitFlashColor;
|
|
int unusedArg;
|
|
void *pvVar16;
|
|
code *extraout_EDX;
|
|
float *pfVar17;
|
|
void *nextColorParam;
|
|
uint flagsLo;
|
|
PlayerManager *playerManager;
|
|
bool bVar18;
|
|
float fVar19;
|
|
float newVelocityX;
|
|
EntityPtr EVar20;
|
|
float fVar21;
|
|
undefined1 *pushStrength;
|
|
float fVar22;
|
|
ulonglong uVar23;
|
|
double dVar24;
|
|
undefined1 auStack_328 [8];
|
|
ItemPool *local_320;
|
|
byte local_319;
|
|
float *local_318;
|
|
float *local_314;
|
|
float *local_310;
|
|
float *pfStack_30c;
|
|
EntityPtr local_308;
|
|
float *local_304;
|
|
uint uStack_300;
|
|
Entity *pEStack_2fc;
|
|
Game *pGStack_2f8;
|
|
float *pfStack_2f4;
|
|
EntityPtr *apEStack_2f0 [2];
|
|
Entity *self;
|
|
Vector *local_2e4;
|
|
EntityPtr *apEStack_2e0 [2];
|
|
Vector VStack_2d8;
|
|
uint uStack_2d0;
|
|
Vector local_2c8;
|
|
uint spawnVariant;
|
|
void *pvStack_2bc;
|
|
float *pfStack_2b8;
|
|
int hitSoundId;
|
|
uint newTearFlagsLo;
|
|
undefined8 uStack_2ac;
|
|
uint 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;
|
|
EntityPtr *targetSlot;
|
|
int triggerKeyType;
|
|
int triggerKeyVariant;
|
|
int anyVariantKey [2];
|
|
Vector particleVelocity;
|
|
undefined1 auStack_250 [4];
|
|
undefined1 auStack_24c [8];
|
|
float fStack_244;
|
|
Color blendedColor;
|
|
Vector normalizedVelocity;
|
|
KColor debugTextColor;
|
|
undefined1 local_1f8 [60];
|
|
EntityRef burnSourceRef;
|
|
EntityRef bleedSourceRef;
|
|
ColorMod lerpedColor;
|
|
Color defaultColor;
|
|
RNG cardRng;
|
|
undefined4 hitColor;
|
|
undefined4 uStack_ec;
|
|
undefined4 uStack_e8;
|
|
undefined4 uStack_e4;
|
|
undefined4 uStack_e0;
|
|
undefined4 uStack_dc;
|
|
undefined4 uStack_d8;
|
|
undefined4 uStack_d4;
|
|
undefined4 uStack_d0;
|
|
undefined4 uStack_cc;
|
|
undefined4 uStack_c8;
|
|
undefined4 hushBeastHitColor;
|
|
undefined4 uStack_c0;
|
|
undefined4 uStack_bc;
|
|
undefined4 uStack_b8;
|
|
undefined4 uStack_b4;
|
|
undefined4 uStack_b0;
|
|
undefined4 uStack_ac;
|
|
undefined4 uStack_a8;
|
|
undefined4 uStack_a4;
|
|
undefined4 uStack_a0;
|
|
undefined4 uStack_9c;
|
|
undefined4 poisonColor;
|
|
undefined4 uStack_94;
|
|
undefined4 uStack_90;
|
|
undefined4 uStack_8c;
|
|
undefined4 uStack_88;
|
|
undefined4 uStack_84;
|
|
undefined4 uStack_80;
|
|
undefined4 uStack_7c;
|
|
undefined4 uStack_78;
|
|
undefined4 uStack_74;
|
|
undefined4 uStack_70;
|
|
undefined4 burnColor;
|
|
undefined4 uStack_68;
|
|
undefined4 uStack_64;
|
|
undefined4 uStack_60;
|
|
undefined4 uStack_5c;
|
|
undefined4 uStack_58;
|
|
undefined4 uStack_54;
|
|
undefined4 uStack_50;
|
|
undefined4 uStack_4c;
|
|
undefined4 uStack_48;
|
|
undefined4 uStack_44;
|
|
ColorMod bleedFlashColor;
|
|
uint local_14;
|
|
void *colorParamsEnd;
|
|
uint *flagsHiPtr;
|
|
Game *game;
|
|
Manager *manager;
|
|
qword oldFlags;
|
|
std_set *spawnTriggerTargets;
|
|
|
|
local_14 = __security_cookie ^ GHIDRA_UINT(auStack_328);
|
|
local_320 = *GHIDRA_CAST<ItemPool **>(&this->_flags);
|
|
uVar14 = *GHIDRA_CAST<uint *>((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)) &&
|
|
((uVar14 & 1) == 0)) {
|
|
local_310 = GHIDRA_CAST<float *>((this->_sprite)._playbackSpeed);
|
|
(this->_sprite)._playbackSpeed = (float)local_310 * this->_speedMultiplier;
|
|
if ((this->_sprite)._loaded != 0) {
|
|
(GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::Update();
|
|
(GHIDRA_CAST<AnimationState *>((&(this->_sprite)._overlayAnimState)))->AnimationState::Update();
|
|
local_320 = *GHIDRA_CAST<ItemPool **>(&this->_flags);
|
|
uVar14 = *GHIDRA_CAST<uint *>((GHIDRA_INT(&this->_flags) + 4));
|
|
}
|
|
(this->_sprite)._playbackSpeed = (float)local_310;
|
|
}
|
|
}
|
|
if ((uVar14 & 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));
|
|
fVar19 = (this->_knockbackDirection).x;
|
|
fVar21 = (this->_knockbackDirection).y;
|
|
fVar19 = sqrtf(fVar19 * fVar19 + fVar21 * fVar21);
|
|
if (((float)local_310 < fVar19) ||
|
|
(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);
|
|
fVar19 = (this->_knockbackDirection).y;
|
|
fVar19 = sqrtf((float)local_310 * (float)local_310 + fVar19 * fVar19);
|
|
if (2.0 <= fVar19) {
|
|
this->_friction = this->_baseFriction * 0.95;
|
|
if ((uVar14 & 0x20000) == 0) {
|
|
(this->_knockbackDirection).x = (float)local_310 * 0.95;
|
|
local_308 = (EntityPtr)((this->_knockbackDirection).y * 0.95);
|
|
(this->_knockbackDirection).y = (float)local_308;
|
|
bVar6 = this->_collidesWithGrid;
|
|
local_2c8.x = *GHIDRA_CAST<float *>(&this->_flags);
|
|
uVar14 = *GHIDRA_CAST<uint *>((GHIDRA_INT(&this->_flags) + 4));
|
|
}
|
|
else {
|
|
local_308 = (EntityPtr)(this->_knockbackDirection).y;
|
|
local_2c8.x = (float)local_320;
|
|
bVar6 = local_319;
|
|
}
|
|
if (bVar6 != 0) {
|
|
if ((uVar14 & 0x10000) != 0) {
|
|
velocityDir = (GHIDRA_CAST<Vector *>((&this->_velocity)))->Vector::Normalized(&normalizedVelocity);
|
|
fVar19 = (this->_knockbackDirection).x;
|
|
fVar21 = sqrtf((float)local_308 * (float)local_308 + fVar19 * fVar19);
|
|
fVar19 = velocityDir->y;
|
|
(this->_knockbackDirection).x = fVar21 * velocityDir->x * 0.8;
|
|
(this->_knockbackDirection).y = fVar21 * fVar19 * 0.8;
|
|
iVar8 = _get_index_plus_one_if_kind_4_5();
|
|
fVar19 = (float)(iVar8 + -1) + (float)(iVar8 + -1) + 10.0;
|
|
sourceRef = (GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>(local_1f8))))->EntityRef::EntityRef();
|
|
(*extraout_EDX)(fVar19,0,0,sourceRef,0x1e);
|
|
oldFlags = this->_flags;
|
|
flagsHiPtr = GHIDRA_CAST<uint *>((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<uint *>((GHIDRA_INT(&this->_flags) + 4)) = uVar14 & 0xfffe7fff;
|
|
this->_knockbackCountdown = 0;
|
|
}
|
|
LAB_006aeb95:
|
|
fVar19 = this->_speedMultiplier;
|
|
fVar22 = 1.0;
|
|
fVar21 = this->_friction;
|
|
if (fVar19 != 1.0) {
|
|
fVar21 = fVar21 / ((fVar21 + fVar19) - fVar21 * fVar19);
|
|
}
|
|
local_2e4 = &this->_pos;
|
|
newVelocityX = fVar21 * (this->_velocity).x;
|
|
fVar21 = fVar21 * (this->_velocity).y;
|
|
(this->_velocity).x = newVelocityX;
|
|
(this->_velocity).y = fVar21;
|
|
fVar19 = this->_speedMultiplier;
|
|
(this->_pos).y = fVar19 * fVar21 + (this->_pos).y;
|
|
local_2e4->x = fVar19 * newVelocityX + local_2e4->x;
|
|
local_318 = *GHIDRA_CAST<float **>(&this->_flags);
|
|
pfVar17 = *GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4));
|
|
this->_friction = this->_baseFriction;
|
|
if ((GHIDRA_UINT(local_318) & 0x4000) == 0) {
|
|
pvVar16 = (this->_colorParams)._begin;
|
|
bVar18 = false;
|
|
if (pvVar16 != (this->_colorParams)._end) {
|
|
do {
|
|
iVar8 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar16) + 0x34)) + -1;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar16) + 0x34)) = iVar8;
|
|
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(pvVar16) + 0x38)) != '\0') {
|
|
bVar18 = true;
|
|
}
|
|
nextColorParam = (void *)(GHIDRA_INT(pvVar16) + 0x3c);
|
|
if (iVar8 == 0) {
|
|
FUN_004b6ec0(pvVar16);
|
|
bVar18 = true;
|
|
ppvVar1 = &(this->_colorParams)._end;
|
|
*ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + -0x3c);
|
|
nextColorParam = pvVar16;
|
|
}
|
|
colorParamsEnd = (this->_colorParams)._end;
|
|
pvVar16 = nextColorParam;
|
|
} while (nextColorParam != colorParamsEnd);
|
|
if (bVar18) {
|
|
pvVar16 = (this->_colorParams)._begin;
|
|
iVar15 = GHIDRA_INT(colorParamsEnd) - GHIDRA_INT(pvVar16);
|
|
iVar8 = iVar15 >> 0x1f;
|
|
iVar15 = iVar15 / 0x3c + iVar8;
|
|
if (iVar15 == iVar8) {
|
|
this->ResetColor();
|
|
}
|
|
else {
|
|
color = GHIDRA_CAST<ColorMod *>((GHIDRA_INT(pvVar16) + 0x40));
|
|
if (GHIDRA_UINT((iVar15 - iVar8)) < 2) {
|
|
color = &this->_color;
|
|
}
|
|
blendedColor._tint[0] = (GHIDRA_CAST<ColorMod *>((GHIDRA_INT(pvVar16) + 4)))->_tint[0];
|
|
blendedColor._tint[1] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar16) + 8));
|
|
blendedColor._tint[2] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar16) + 0xc));
|
|
blendedColor._tint[3] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar16) + 0x10));
|
|
blendedColor._offset[2] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar16) + 0x2c));
|
|
blendedColor._colorize[0] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar16) + 0x14));
|
|
blendedColor._colorize[1] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar16) + 0x18));
|
|
blendedColor._colorize[2] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar16) + 0x1c));
|
|
blendedColor._colorize[3] = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar16) + 0x20));
|
|
(*GHIDRA_CAST<undefined8 *>((GHIDRA_CAST<char *>(&(blendedColor._offset)) + 0x0))) = *GHIDRA_CAST<undefined8 *>((GHIDRA_CAST<char *>(pvVar16) + 0x24));
|
|
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(pvVar16) + 0x38)) != '\0') {
|
|
color = ::Color::Lerp(&lerpedColor,GHIDRA_CAST<ColorMod *>((GHIDRA_INT(pvVar16) + 4)),color,
|
|
fVar22 - (float)*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar16) + 0x34)) /
|
|
(float)*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar16) + 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<uint *>(&this->_flags);
|
|
local_318 = *GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4));
|
|
pfVar17 = local_318;
|
|
if (((flagsLo & 1) == 0) &&
|
|
(((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager) && (this->_type == 1)) ||
|
|
(this->_type - 10U < 0x3de)))) {
|
|
bVar6 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0x11);
|
|
if ((bVar6 != 0) || (bVar6 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0x15), bVar6 != 0)) {
|
|
flagsLo = flagsLo | 0x100;
|
|
this->_charmedCountdown = 2;
|
|
*GHIDRA_CAST<uint *>(&this->_flags) = flagsLo;
|
|
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = local_318;
|
|
}
|
|
local_310 = GHIDRA_CAST<float *>(flagsLo);
|
|
local_304 = local_318;
|
|
bVar6 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0x12);
|
|
if (bVar6 != 0) {
|
|
flagsLo = flagsLo | 0x200;
|
|
this->_confusionCountdown = 2;
|
|
local_318 = local_304;
|
|
*GHIDRA_CAST<uint *>(&this->_flags) = flagsLo;
|
|
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = local_304;
|
|
}
|
|
local_310 = GHIDRA_CAST<float *>(flagsLo);
|
|
local_304 = local_318;
|
|
bVar6 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0x13);
|
|
if ((bVar6 == 0) && (bVar6 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0x15), bVar6 == 0)) {
|
|
bVar6 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0x14);
|
|
pfVar17 = local_318;
|
|
if ((bVar6 == 0) || (((g_game->_frameCount - this->_spawnFrame) / 0x3c & 1U) != 0))
|
|
goto LAB_006aeed2;
|
|
}
|
|
flagsLo = GHIDRA_UINT(local_310) | 0x800;
|
|
this->_fearCountdown = 2;
|
|
*GHIDRA_CAST<uint *>(&this->_flags) = flagsLo;
|
|
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = local_304;
|
|
pfVar17 = 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) &&
|
|
(iVar8 = this->_freezeCountdown + -1, this->_freezeCountdown = iVar8, iVar8 < 1)) {
|
|
flagsLo = flagsLo & 0xffffffdf;
|
|
*GHIDRA_CAST<uint *>(&this->_flags) = flagsLo;
|
|
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar17;
|
|
}
|
|
if ((0 < this->_poisonCountdown) &&
|
|
(iVar8 = this->_poisonCountdown + -1, this->_poisonCountdown = iVar8, iVar8 < 1)) {
|
|
flagsLo = flagsLo & 0xffffffbf;
|
|
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar17;
|
|
*GHIDRA_CAST<uint *>(&this->_flags) = flagsLo;
|
|
this->_poisonTickDamage = 2.0;
|
|
}
|
|
if ((0 < this->_slowingCountdown) &&
|
|
(iVar8 = this->_slowingCountdown + -1, this->_slowingCountdown = iVar8, iVar8 < 1)) {
|
|
flagsLo = flagsLo & 0xffffff7f;
|
|
*GHIDRA_CAST<uint *>(&this->_flags) = flagsLo;
|
|
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar17;
|
|
}
|
|
local_314 = pfVar17;
|
|
if ((0 < this->_charmedCountdown) &&
|
|
(iVar8 = this->_charmedCountdown + -1, this->_charmedCountdown = iVar8, iVar8 < 1)) {
|
|
EVar20 = this->_target;
|
|
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar17;
|
|
flagsLo = flagsLo & 0xfffffeff;
|
|
*GHIDRA_CAST<uint *>(&this->_flags) = flagsLo;
|
|
if (EVar20 != (EntityPtr)0x0) {
|
|
local_320 = GHIDRA_CAST<ItemPool *>(pfVar17);
|
|
targetSlot = &this->_target;
|
|
std::multiset<unsigned_int>::erase(&targetSlot);
|
|
flagsLo = *GHIDRA_CAST<uint *>(&this->_flags);
|
|
pfVar17 = *GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4));
|
|
this->_target = (EntityPtr)0x0;
|
|
}
|
|
}
|
|
if ((0 < this->_confusionCountdown) &&
|
|
(iVar8 = this->_confusionCountdown + -1, this->_confusionCountdown = iVar8, iVar8 < 1)) {
|
|
flagsLo = flagsLo & 0xfffffdff;
|
|
*GHIDRA_CAST<uint *>(&this->_flags) = flagsLo;
|
|
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar17;
|
|
}
|
|
if ((0 < this->_fearCountdown) &&
|
|
(iVar8 = this->_fearCountdown + -1, this->_fearCountdown = iVar8, iVar8 < 1)) {
|
|
flagsLo = flagsLo & 0xfffff7ff;
|
|
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar17;
|
|
*GHIDRA_CAST<uint *>(&this->_flags) = flagsLo;
|
|
}
|
|
fVar19 = this->_shrinkStatus1;
|
|
if (this->_shrinkStatus2 != fVar19) {
|
|
this->_shrinkStatus1 = (this->_shrinkStatus2 - fVar19) * 5.0 * 0.033333335 + fVar19;
|
|
}
|
|
local_320 = GHIDRA_CAST<ItemPool *>(pfVar17);
|
|
if ((0 < this->_shrinkCountdown) &&
|
|
(iVar8 = this->_shrinkCountdown + -1, this->_shrinkCountdown = iVar8, iVar8 < 1)) {
|
|
FUN_006b5f40();
|
|
flagsLo = *GHIDRA_CAST<uint *>(&this->_flags);
|
|
pfVar17 = *GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4));
|
|
}
|
|
if (0 < this->_burnCountdown) {
|
|
iVar8 = this->_burnCountdown + -1;
|
|
this->_burnCountdown = iVar8;
|
|
if (iVar8 < 1) {
|
|
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar17;
|
|
*GHIDRA_CAST<uint *>(&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<uint *>(&this->_flags);
|
|
pfVar17 = *GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4));
|
|
}
|
|
if ((this->_midasFreezeCountdown < 1) ||
|
|
(iVar8 = this->_midasFreezeCountdown + -1, this->_midasFreezeCountdown = iVar8, 0 < iVar8)) {
|
|
pfStack_30c = GHIDRA_CAST<float *>(flagsLo);
|
|
}
|
|
else {
|
|
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar17;
|
|
*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) {
|
|
iVar8 = this->_bleedingCountdown + -1;
|
|
this->_bleedingCountdown = iVar8;
|
|
if (iVar8 < 1) {
|
|
*GHIDRA_CAST<float **>(&this->_flags) = pfStack_30c;
|
|
*GHIDRA_CAST<uint *>((GHIDRA_INT(&this->_flags) + 4)) = GHIDRA_UINT(pfVar17) & 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);
|
|
}
|
|
fVar19 = (this->_pos).y - (this->_prevPosition).y;
|
|
fVar21 = (this->_pos).x - (this->_prevPosition).x;
|
|
fVar19 = sqrtf(fVar19 * fVar19 + fVar21 * fVar21);
|
|
fVar19 = (fVar19 * 0.02) / this->_speedMultiplier;
|
|
if (fVar19 <= 0.0) {
|
|
fVar19 = 0.0;
|
|
}
|
|
if (1.0 <= fVar19) {
|
|
fVar19 = 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,fVar19);
|
|
this->SetColor(color,1,0xff,0,1);
|
|
pfStack_30c = *GHIDRA_CAST<float **>(&this->_flags);
|
|
pfVar17 = *GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4));
|
|
}
|
|
if ((0 < this->_magnetizedCountdown) &&
|
|
(iVar8 = this->_magnetizedCountdown + -1, this->_magnetizedCountdown = iVar8, iVar8 < 1)) {
|
|
pfVar17 = GHIDRA_CAST<float *>((GHIDRA_UINT(pfVar17) & 0xfff7ffff));
|
|
*GHIDRA_CAST<float **>(&this->_flags) = pfStack_30c;
|
|
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar17;
|
|
}
|
|
local_320 = GHIDRA_CAST<ItemPool *>(pfStack_30c);
|
|
if ((0 < this->_baitedCountdown) &&
|
|
(iVar8 = this->_baitedCountdown + -1, this->_baitedCountdown = iVar8, iVar8 < 1)) {
|
|
pfVar17 = GHIDRA_CAST<float *>((GHIDRA_UINT(pfVar17) & 0xffefffff));
|
|
*GHIDRA_CAST<float **>(&this->_flags) = pfStack_30c;
|
|
game = g_game;
|
|
fVar19 = 0.0;
|
|
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar17;
|
|
local_304 = game->_room;
|
|
if (local_304[0x499] != 0.0) {
|
|
do {
|
|
iVar8 = *GHIDRA_CAST<int *>((GHIDRA_INT(local_304[0x497]) + GHIDRA_INT(fVar19) * 4));
|
|
if (((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (*GHIDRA_CAST<int *>((iVar8 + 0x28)) == 1)) ||
|
|
(*GHIDRA_CAST<int *>((iVar8 + 0x28)) - 10U < 0x3de)) {
|
|
local_310 = GHIDRA_CAST<float *>((iVar8 + 0x3c4));
|
|
if ((*GHIDRA_CAST<Entity **>((iVar8 + 0x3c4)) == this) &&
|
|
((*GHIDRA_CAST<uint *>((iVar8 + 0x168)) & 0x20000100) == 0)) {
|
|
if (*GHIDRA_CAST<Entity **>((iVar8 + 0x3c4)) != GHIDRA_CAST<Entity *>(0x0)) {
|
|
pvStack_2bc = (void *)(iVar8 + 0x3c4);
|
|
std::multiset<unsigned_int>::erase(&pvStack_2bc);
|
|
}
|
|
*local_310 = 0.0;
|
|
}
|
|
}
|
|
fVar19 = (float)(GHIDRA_INT(fVar19) + 1);
|
|
} while (GHIDRA_UINT(fVar19) < GHIDRA_UINT(local_304[0x499]));
|
|
local_320 = *GHIDRA_CAST<ItemPool **>(&this->_flags);
|
|
pfVar17 = *GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4));
|
|
}
|
|
}
|
|
if ((0 < this->_weaknessCountdown) &&
|
|
(iVar8 = this->_weaknessCountdown + -1, this->_weaknessCountdown = iVar8, iVar8 < 1)) {
|
|
pfVar17 = GHIDRA_CAST<float *>((GHIDRA_UINT(pfVar17) & 0xffbfffff));
|
|
*GHIDRA_CAST<ItemPool **>(&this->_flags) = local_320;
|
|
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar17;
|
|
}
|
|
local_2c8.x = (float)local_320;
|
|
if ((this->_iceFrozenEffect != (EntityPtr)0x0) && ((GHIDRA_UINT(pfVar17) & 0x80000) == 0)) {
|
|
(**(code **)(*GHIDRA_CAST<int *>(this->_iceFrozenEffect) + 0x28))();
|
|
local_320 = *GHIDRA_CAST<ItemPool **>(&this->_flags);
|
|
pfVar17 = *GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4));
|
|
}
|
|
if ((0 < this->_knockbackCountdown) &&
|
|
(iVar8 = this->_knockbackCountdown + -1, this->_knockbackCountdown = iVar8, iVar8 < 1)) {
|
|
pfVar17 = GHIDRA_CAST<float *>((GHIDRA_UINT(pfVar17) & 0xfffe7fff));
|
|
*GHIDRA_CAST<ItemPool **>(&this->_flags) = local_320;
|
|
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar17;
|
|
}
|
|
if ((0 < this->_iceCountdown) &&
|
|
(iVar8 = this->_iceCountdown + -1, this->_iceCountdown = iVar8, iVar8 < 1)) {
|
|
pfVar17 = GHIDRA_CAST<float *>((GHIDRA_UINT(pfVar17) & 0xfffbffff));
|
|
*GHIDRA_CAST<ItemPool **>(&this->_flags) = local_320;
|
|
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar17;
|
|
}
|
|
if ((0 < this->_brimstoneMarkCountdown) &&
|
|
(iVar8 = this->_brimstoneMarkCountdown + -1, this->_brimstoneMarkCountdown = iVar8, iVar8 < 1
|
|
)) {
|
|
pfVar17 = GHIDRA_CAST<float *>((GHIDRA_UINT(pfVar17) & 0xfeffffff));
|
|
*GHIDRA_CAST<ItemPool **>(&this->_flags) = local_320;
|
|
*GHIDRA_CAST<float **>((GHIDRA_INT(&this->_flags) + 4)) = pfVar17;
|
|
}
|
|
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) {
|
|
pfVar17 = (this->_damageEvents)._begin;
|
|
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 (pfVar17 != (this->_damageEvents)._end) {
|
|
local_320 = GHIDRA_CAST<ItemPool *>((pfVar17 + 0xb));
|
|
do {
|
|
if (0.0 < *pfVar17) {
|
|
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;
|
|
}
|
|
fVar19 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x380)) - *pfVar17;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x380)) = fVar19;
|
|
if ((0.0 < fVar19) || ((GHIDRA_UINT(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(local_320) + -0x24))) & 1) != 0)) {
|
|
if ((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x168)) & 0x2000000) == 0) {
|
|
if (fVar19 < 0.0) {
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x380)) = 0;
|
|
}
|
|
if ((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x28)) == 0x197) || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x28)) == 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;
|
|
iVar8 = (GHIDRA_INT((*pfVar17 + 0.5)) + 2) / 3;
|
|
iVar15 = 6;
|
|
if (iVar8 < 6) {
|
|
iVar15 = iVar8;
|
|
}
|
|
if (iVar15 < 1) {
|
|
iVar15 = 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;
|
|
iVar8 = (GHIDRA_INT((*pfVar17 + 0.5)) + 2) / 3;
|
|
iVar15 = 6;
|
|
if (iVar8 < 6) {
|
|
iVar15 = iVar8;
|
|
}
|
|
if (iVar15 < 1) {
|
|
iVar15 = 1;
|
|
}
|
|
hitFlashColor = &hitColor;
|
|
}
|
|
this->SetColor(hitFlashColor,iVar15,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;
|
|
}
|
|
}
|
|
pfVar17 = pfVar17 + 0xe;
|
|
local_320 = GHIDRA_CAST<ItemPool *>((GHIDRA_INT(local_320) + 0x38));
|
|
} while (pfVar17 != *GHIDRA_CAST<float **>((GHIDRA_CAST<char *>(this) + 0xc)));
|
|
if (local_319 != 0) {
|
|
this->Kill(&fatalDamage);
|
|
}
|
|
}
|
|
}
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0xc)) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 8));
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x14)) = 0;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x18)) = 0;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x1c)) = 0;
|
|
local_318 = *GHIDRA_CAST<float **>((GHIDRA_CAST<char *>(this) + 0x168));
|
|
pfVar17 = *GHIDRA_CAST<float **>((GHIDRA_CAST<char *>(this) + 0x16c));
|
|
}
|
|
if ((GHIDRA_UINT(local_318) & 0x4000) == 0) {
|
|
if (((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x28)) == 1)) ||
|
|
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x28)) - 10U < 0x3de)) {
|
|
local_308 = (EntityPtr)0x14;
|
|
if (((GHIDRA_UINT(local_318) & 0x40) != 0) &&
|
|
(iVar8 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x2e0)), *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x2e0)) = iVar8 + 1,
|
|
iVar8 % 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();
|
|
this->TakeDamage(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 800)),0x8000,0,sourceRef);
|
|
local_318 = *GHIDRA_CAST<float **>((GHIDRA_CAST<char *>(this) + 0x168));
|
|
pfVar17 = *GHIDRA_CAST<float **>((GHIDRA_CAST<char *>(this) + 0x16c));
|
|
}
|
|
VStack_2d8.x = (float)local_318;
|
|
if ((GHIDRA_UINT(local_318) & 0x1000) != 0) {
|
|
iVar8 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x2e4));
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x2e4)) = iVar8 + 1;
|
|
if (iVar8 % 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();
|
|
this->TakeDamage(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x324)),0x8000,0,sourceRef);
|
|
VStack_2d8.x = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x168));
|
|
pfVar17 = *GHIDRA_CAST<float **>((GHIDRA_CAST<char *>(this) + 0x16c));
|
|
}
|
|
}
|
|
if (((GHIDRA_UINT(pfVar17) & 4) != 0) &&
|
|
(bVar6 = IsDescendantOf(this,*GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(this) + 0x28c))), bVar6 == 0)) {
|
|
fVar19 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x340)) - *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x390));
|
|
fVar21 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x33c)) - *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x38c));
|
|
fVar19 = sqrtf(fVar19 * fVar19 + fVar21 * fVar21);
|
|
game = g_game;
|
|
local_310 = GHIDRA_CAST<float *>((fVar19 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x39c)) * 0.02 +
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x2ec))));
|
|
*GHIDRA_CAST<float **>((GHIDRA_CAST<char *>(this) + 0x2ec)) = local_310;
|
|
iVar8 = game->_stageType;
|
|
if ((iVar8 == 4) || (iVar8 == 5)) {
|
|
iVar8 = g_game->_stage + 1;
|
|
}
|
|
else {
|
|
iVar8 = game->_stage;
|
|
}
|
|
local_304 = GHIDRA_CAST<float *>(((float)iVar8 * 0.3 + 2.8));
|
|
pfStack_2f4 = local_310;
|
|
dVar24 = floor((double)(float)local_310);
|
|
local_308 = (EntityPtr)(float)dVar24;
|
|
if (*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2) {
|
|
pfVar17 = local_304;
|
|
}
|
|
else {
|
|
pfVar17 = GHIDRA_CAST<float *>(0x3f800000);
|
|
}
|
|
EVar20 = local_308;
|
|
if (10.0 <= (float)local_308) {
|
|
EVar20 = (EntityPtr)0x41200000;
|
|
}
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x2ec)) = (float)pfStack_2f4 - (float)local_308;
|
|
fVar19 = (float)EVar20 * (float)pfVar17;
|
|
if (0.0 < fVar19) {
|
|
sourceRef = (GHIDRA_CAST<EntityRef *>((&bleedSourceRef)))->EntityRef::EntityRef();
|
|
this->TakeDamage(fVar19,0,0,sourceRef,0x1e);
|
|
local_310 = GHIDRA_CAST<float *>(0x0);
|
|
if (0.0 < (float)local_308) {
|
|
do {
|
|
VStack_2d8.x = ((*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x38c)) - *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x33c))) *
|
|
(float)local_310) / (float)local_308 + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x33c));
|
|
VStack_2d8.y = ((*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x390)) - *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x340))) *
|
|
(float)local_310) / (float)local_308 + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x340));
|
|
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<uint *>(&pfStack_2f4));
|
|
if (*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2) {
|
|
LAB_006b0194:
|
|
local_320 = GHIDRA_CAST<ItemPool *>(local_318);
|
|
}
|
|
else {
|
|
pfStack_30c = (g_game->_deathmatchManager)._type;
|
|
uVar14 = Random();
|
|
pfVar17 = local_318;
|
|
uStack_2ac = 0x900000005;
|
|
pEStack_2fc = GHIDRA_CAST<Entity *>(&DAT_00000007);
|
|
uStack_2a4 = 7;
|
|
uStack_300 = uVar14;
|
|
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) ||
|
|
(cVar7 = (**(code **)(GHIDRA_INT(*pfStack_30c) + 0x24))(local_318),
|
|
cVar7 != '\0'))) {
|
|
if (uStack_300 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("RNG Seed is zero!\n"));
|
|
pcVar3 = (code *)swi(3);
|
|
(*pcVar3)();
|
|
return;
|
|
}
|
|
uStack_300 = uStack_300 >> ((byte)uStack_2ac & 0x1f) ^ uStack_300;
|
|
uStack_300 = uStack_300 << ((byte)((ulonglong)uStack_2ac >> 0x20) & 0x1f) ^
|
|
uStack_300;
|
|
uVar14 = uStack_300 >> ((byte)pEStack_2fc & 0x1f) ^ uStack_300;
|
|
uStack_300 = uVar14;
|
|
iVar8 = ItemPool::GetCardEx(uVar14,0x19,10,10,1);
|
|
cardRng._shift1 = 5;
|
|
cardRng._shift2 = 9;
|
|
cardRng._shift3 = 7;
|
|
cardRng._seed = uVar14;
|
|
local_318 = GHIDRA_CAST<float *>(lua_callback_run_get_card(&cardRng,iVar8,1,1,0));
|
|
}
|
|
}
|
|
else {
|
|
if (spawnVariant == 0x46) {
|
|
uStack_2d0 = GHIDRA_UINT(local_318) >> 0xb;
|
|
do {
|
|
if (local_318 != GHIDRA_CAST<float *>(0x0)) {
|
|
pcVar3 = *(code **)(GHIDRA_INT(*pfStack_30c) + 0x28);
|
|
local_320 = GHIDRA_CAST<ItemPool *>(local_318);
|
|
iVar8 = ItemPool::GetPillEffect
|
|
(&g_game->_itemPool,GHIDRA_UINT(local_318),GHIDRA_CAST<Entity_Player *>(0x0)
|
|
);
|
|
cVar7 = (*pcVar3)(iVar8);
|
|
if (cVar7 == '\0') goto LAB_006b019c;
|
|
uVar14 = uStack_300;
|
|
}
|
|
local_320 = &g_game->_itemPool;
|
|
if (uVar14 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("RNG Seed is zero!\n"));
|
|
pcVar3 = (code *)swi(3);
|
|
(*pcVar3)();
|
|
return;
|
|
}
|
|
uVar14 = uVar14 >> ((byte)uStack_2ac & 0x1f) ^ uVar14;
|
|
uVar14 = uVar14 << ((byte)((ulonglong)uStack_2ac >> 0x20) & 0x1f) ^ uVar14;
|
|
uVar14 = uVar14 >> ((byte)pEStack_2fc & 0x1f) ^ uVar14;
|
|
uStack_300 = uVar14;
|
|
uVar11 = ItemPool::GetPill(uVar14);
|
|
local_318 = GHIDRA_CAST<float *>((uVar11 | (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:
|
|
bVar18 = false;
|
|
}
|
|
else {
|
|
pfStack_2b8 = local_318;
|
|
std::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(pfVar17))) &&
|
|
(fStack_244 != pfStack_30c[8])) goto LAB_006affca;
|
|
bVar18 = true;
|
|
}
|
|
if ((pfVar17 == GHIDRA_CAST<float *>(0x0)) || (bVar18)) {
|
|
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) ||
|
|
(cVar7 = (**(code **)(GHIDRA_INT(*pfStack_30c) + 0x2c))(local_318), cVar7 != '\0')
|
|
)) {
|
|
local_318 = GHIDRA_CAST<float *>((GHIDRA_CAST<ItemPool *>((&g_game->_itemPool)))->ItemPool)::GetTrinket(0);
|
|
}
|
|
}
|
|
}
|
|
LAB_006b019c:
|
|
pEStack_2fc = (GHIDRA_CAST<EntityFactory *>((pGStack_2f8->_entityFactory)))->EntityFactory::Create(GHIDRA_UINT(local_314),0);
|
|
lVar4 = CONCAT44(pGStack_2f8,pfStack_2f4);
|
|
if (pEStack_2fc == GHIDRA_CAST<Entity *>(0x0)) {
|
|
tmpEntity = GHIDRA_CAST<Entity *>(0x0);
|
|
}
|
|
else {
|
|
uVar23 = GetTimeNs();
|
|
tmpEntity = pEStack_2fc;
|
|
uVar11 = GHIDRA_UINT((uVar23 >> 0x20));
|
|
lVar4 = (uVar23 & 0xffffffff) * 0x431bde82;
|
|
apEStack_2f0[0] = GHIDRA_CAST<EntityPtr *>(((ulonglong)lVar4 >> 0x20));
|
|
uVar23 = (ulonglong)uVar11 * 0xd7b634db +
|
|
((uVar23 & 0xffffffff) * 0xd7b634db >> 0x20);
|
|
uVar12 = GHIDRA_UINT((uVar23 >> 0x20));
|
|
lVar4 = lVar4 + (uVar23 & 0xffffffff);
|
|
uStack_2d0 = GHIDRA_UINT(lVar4);
|
|
uVar14 = GHIDRA_UINT(((ulonglong)lVar4 >> 0x20));
|
|
lVar4 = (ulonglong)uVar11 * 0x431bde82 +
|
|
(ulonglong)CONCAT14(CARRY4(uVar12,uVar14),uVar12 + uVar14);
|
|
uVar14 = GHIDRA_UINT(((ulonglong)lVar4 >> 0x20));
|
|
uStack_300 = GHIDRA_UINT(lVar4) >> 0x12 | uVar14 * 0x4000;
|
|
pfStack_30c = GHIDRA_CAST<float *>((uVar14 >> 0x12));
|
|
pEVar2 = &pEStack_2fc->_spawnerEntity;
|
|
pEStack_2fc->_spawnerType = 0;
|
|
pEStack_2fc->_spawnerVariant = 0;
|
|
if (*pEVar2 != (EntityPtr)0x0) {
|
|
apEStack_2e0[0] = pEVar2;
|
|
std::multiset<unsigned_int>::erase(apEStack_2e0);
|
|
}
|
|
iVar8 = *GHIDRA_CAST<int *>(tmpEntity);
|
|
*pEVar2 = (EntityPtr)0x0;
|
|
(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 **)(iVar8 + 4))(local_314,spawnVariant,local_320,pfStack_2f4);
|
|
pvVar16 = pGStack_2f8->_room;
|
|
iVar8 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar16) + 0x1214));
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar16) + 0x1214)) = iVar8 + 1;
|
|
tmpEntity->_index = iVar8;
|
|
(GHIDRA_CAST<EntityList *>((GHIDRA_CAST<EntityList *>((GHIDRA_INT(pvVar16) + 0x1218)))))->EntityList::AddEntity(tmpEntity);
|
|
bVar6 = Game::ShouldEraseEnemy(tmpEntity);
|
|
if (bVar6 != 0) {
|
|
RemoveWithPoof(tmpEntity,unusedArg);
|
|
}
|
|
if ((tmpEntity->_exists != 0) &&
|
|
((pGStack_2f8->_proceduralItemManager)._proceduralItems._begin !=
|
|
(pGStack_2f8->_proceduralItemManager)._proceduralItems._end)) {
|
|
triggerKeyVariant = tmpEntity->_variant;
|
|
iVar8 = tmpEntity->_type;
|
|
spawnTriggerTargets = &(pGStack_2f8->_proceduralItemManager)._spawnTriggerTargets;
|
|
triggerKeyType = iVar8;
|
|
std::map<unsigned_long_long>::find(&local_304,&triggerKeyType);
|
|
if (local_304 == spawnTriggerTargets->_head) {
|
|
anyVariantKey[1] = 0xffffffff;
|
|
anyVariantKey[0] = iVar8;
|
|
piVar10 = GHIDRA_CAST<int *>(std)::map<unsigned_long_long>::find(auStack_250,anyVariantKey);
|
|
local_304 = GHIDRA_CAST<float *>(*piVar10);
|
|
if (local_304 == spawnTriggerTargets->_head) goto LAB_006b0415;
|
|
}
|
|
uVar14 = 0;
|
|
playerManager = &g_game->_playerManager;
|
|
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((playerManager->_playerList)._begin) >> 2 != 0) {
|
|
do {
|
|
pvVar16 = (playerManager->_playerList)._end;
|
|
if (GHIDRA_INT(pvVar16) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) {
|
|
KAGE_LogMessage(0x10,(byte *)
|
|
"(GHIDRA_CAST<PlayerManager *>(()))->PlayerManager::GetPlayer() : There are no players! \n"
|
|
);
|
|
pvVar16 = (playerManager->_playerList)._end;
|
|
}
|
|
piVar10 = (playerManager->_playerList)._begin;
|
|
if (uVar14 < GHIDRA_UINT((GHIDRA_INT(pvVar16) - GHIDRA_INT(piVar10) >> 2))) {
|
|
piVar10 = piVar10 + uVar14;
|
|
}
|
|
trigger_set_dispatch
|
|
((void *)(*piVar10 + 0x1fc8),6,pEStack_2fc,&VStack_2d8,&g_vectorZero
|
|
);
|
|
uVar14 = uVar14 + 1;
|
|
playerManager = &g_game->_playerManager;
|
|
} while (uVar14 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((playerManager->_playerList)._begin) >> 2)));
|
|
}
|
|
}
|
|
LAB_006b0415:
|
|
uVar23 = GetTimeNs();
|
|
uVar14 = GHIDRA_UINT((uVar23 >> 0x20));
|
|
lVar5 = (uVar23 & 0xffffffff) * 0x431bde82;
|
|
uStack_2d0 = GHIDRA_UINT(((ulonglong)lVar5 >> 0x20));
|
|
lVar4 = (ulonglong)uVar14 * 0x431bde82;
|
|
uVar23 = (ulonglong)uVar14 * 0xd7b634db +
|
|
((uVar23 & 0xffffffff) * 0xd7b634db >> 0x20);
|
|
uVar11 = GHIDRA_UINT((uVar23 >> 0x20));
|
|
lVar5 = lVar5 + (uVar23 & 0xffffffff);
|
|
apEStack_2f0[0] = GHIDRA_CAST<EntityPtr *>(lVar5);
|
|
uVar14 = GHIDRA_UINT(((ulonglong)lVar5 >> 0x20));
|
|
lVar5 = lVar4 + (ulonglong)CONCAT14(CARRY4(uVar11,uVar14),uVar11 + uVar14);
|
|
uVar12 = GHIDRA_UINT(((ulonglong)lVar5 >> 0x20));
|
|
uVar14 = GHIDRA_UINT(lVar5) >> 0x12 | uVar12 * 0x4000;
|
|
uVar11 = uVar14 - uStack_300;
|
|
bVar18 = CARRY4(GHIDRA_UINT(g_entitySpawnTimeMs),uVar11);
|
|
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(g_entitySpawnTimeMs)) + 0x0))) = GHIDRA_UINT(g_entitySpawnTimeMs) + uVar11;
|
|
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(g_entitySpawnTimeMs)) + 0x4))) =
|
|
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(g_entitySpawnTimeMs)) + 0x4))) +
|
|
(((uVar12 >> 0x12) - GHIDRA_INT(pfStack_30c)) - GHIDRA_UINT((uVar14 < uStack_300))) +
|
|
GHIDRA_UINT(bVar18);
|
|
tmpEntity = pEStack_2fc;
|
|
this = self;
|
|
}
|
|
pGStack_2f8 = GHIDRA_CAST<Game *>(((ulonglong)lVar4 >> 0x20));
|
|
pfStack_2f4 = GHIDRA_CAST<float *>(lVar4);
|
|
uVar14 = GetHitListIndex(this);
|
|
sorted_vector_insert_unique(&tmpEntity[1]._sprite._overlayAnimState,uVar14);
|
|
uVar14 = Random();
|
|
iVar8 = *GHIDRA_CAST<int *>(tmpEntity);
|
|
fVar21 = (float)((double)GHIDRA_INT(uVar14) + __uint_to_double_fixup[-(GHIDRA_INT(uVar14) >> 0x1f)])
|
|
* 2.3283064e-10 * 0.5 + 0.2;
|
|
fVar19 = fVar21 * g_vectorOne.x;
|
|
(tmpEntity->_sprite)._scale.y = fVar21 * g_vectorOne.y;
|
|
(tmpEntity->_sprite)._scale.x = fVar19;
|
|
(**(code **)(iVar8 + 0xc))();
|
|
uVar14 = Random();
|
|
tmpEntity = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,7,&VStack_2d8,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,
|
|
uVar14,0);
|
|
tmpEntity->Update();
|
|
uVar14 = Random();
|
|
uVar11 = Random();
|
|
uVar12 = Random();
|
|
fVar19 = (float)((double)GHIDRA_INT(uVar12) + __uint_to_double_fixup[-(GHIDRA_INT(uVar12) >> 0x1f)])
|
|
* 2.3283064e-10 * 3.14;
|
|
apEStack_2f0[0] = GHIDRA_CAST<EntityPtr *>((fVar19 + fVar19));
|
|
particleVelocity.x = cos((float)apEStack_2f0[0]);
|
|
particleVelocity.x = particleVelocity.x * 5.0;
|
|
fVar19 = sin((float)apEStack_2f0[0]);
|
|
particleVelocity.y = fVar19 * 0.5 * 5.0;
|
|
uVar12 = Random();
|
|
fVar19 = (float)((double)GHIDRA_INT(uVar12) + __uint_to_double_fixup[-(GHIDRA_INT(uVar12) >> 0x1f)])
|
|
* 2.3283064e-10 * 3.14;
|
|
apEStack_2f0[0] = GHIDRA_CAST<EntityPtr *>((fVar19 + fVar19));
|
|
fVar19 = cos((float)apEStack_2f0[0]);
|
|
local_2c8.x = fVar19 * 0.5 * self->_size + local_2e4->x;
|
|
fVar19 = sin((float)apEStack_2f0[0]);
|
|
this = self;
|
|
local_2c8.y = fVar19 * 0.5 * self->_size + local_2e4->y;
|
|
tmpEntity = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,5,&local_2c8,&particleVelocity,self,uVar11 % 3,
|
|
uVar14,0);
|
|
tmpEntity->Update();
|
|
local_310 = GHIDRA_CAST<float *>(((float)local_310 + 1.0));
|
|
} while ((float)local_310 < (float)local_308);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
fVar19 = 1.0;
|
|
if ((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this) + 0x173)) == '\0') && ((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x16c)) & 0x80000) != 0)) {
|
|
bVar6 = DoesEntityShareStatus(this);
|
|
if ((bVar6 != 0) &&
|
|
(EVar20 = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(this) + 0x3bc)),
|
|
*GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(this) + 0x3bc)) != (EntityPtr)0x0)) {
|
|
do {
|
|
EVar9 = EVar20;
|
|
EVar20 = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar9) + 0x3bc));
|
|
} while (EVar20 != (EntityPtr)0x0);
|
|
if (EVar9 != (EntityPtr)this) goto LAB_006b0a5d;
|
|
}
|
|
local_304 = GHIDRA_CAST<float *>(0x0);
|
|
pvStack_2bc = g_game->_room;
|
|
pGStack_2f8 = GHIDRA_CAST<Game *>(fVar19);
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvStack_2bc) + 0x1264)) != 0) {
|
|
do {
|
|
EVar20 = *GHIDRA_CAST<EntityPtr *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvStack_2bc) + 0x125c)) + GHIDRA_INT(local_304) * 4));
|
|
local_308 = EVar20;
|
|
bVar6 = DoesEntityShareStatus(GHIDRA_CAST<Entity *>(EVar20));
|
|
if (bVar6 != 0) {
|
|
EVar9 = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar20) + 0x3bc));
|
|
local_308 = EVar20;
|
|
if (*GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar20) + 0x3bc)) != (EntityPtr)0x0) {
|
|
do {
|
|
local_308 = EVar9;
|
|
EVar9 = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(local_308) + 0x3bc));
|
|
} while (*GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(local_308) + 0x3bc)) != (EntityPtr)0x0);
|
|
this = self;
|
|
}
|
|
}
|
|
EVar9 = (EntityPtr)GetStatusEffectTarget(this);
|
|
if ((((EVar9 != local_308) &&
|
|
((*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2 ||
|
|
(bVar6 = IsDescendantOf(GHIDRA_CAST<Entity *>(EVar20),*GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(this) + 0x2b4))),
|
|
bVar6 == 0)))) &&
|
|
((bVar6 = IsVulnerableEnemy(GHIDRA_CAST<Entity *>(EVar20),GHIDRA_CAST<Entity *>(0x0)), bVar6 != 0 ||
|
|
((((iVar8 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar20) + 0x28)), iVar8 == 9 || (iVar8 == 2)) || (iVar8 == 4)
|
|
) || (((iVar8 == 5 && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar20) + 0x534)) == 0)) &&
|
|
((bVar6 = Entity_Pickup::IsChest(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar20) + 0x2c))), bVar6 == 0 ||
|
|
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar20) + 0x30)) != 0)))))))))) && (EVar20 != (EntityPtr)this))
|
|
{
|
|
if (((*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x33c)) != *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x33c))) ||
|
|
(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x340)) != *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x340)))) &&
|
|
(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x36c)) != 0.0)) {
|
|
local_308 = (EntityPtr)
|
|
(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x33c)) - *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x33c)));
|
|
pEStack_2fc = (Entity *)
|
|
(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x340)) - *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x340)));
|
|
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));
|
|
fVar19 = sqrtf((float)local_2e4);
|
|
tmpEntity = self;
|
|
if (0.0 < fVar19) {
|
|
local_308 = (EntityPtr)((float)local_308 * (1.0 / fVar19));
|
|
pEStack_2fc = GHIDRA_CAST<Entity *>(((float)pEStack_2fc * (1.0 / fVar19)));
|
|
}
|
|
pushStrength = &DAT_42000000;
|
|
iVar8 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar20) + 0x28));
|
|
if ((((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (iVar8 == 1)) ||
|
|
(iVar8 - 10U < 0x3de)) || ((iVar8 == 2 || (iVar8 == 4)))) {
|
|
pushStrength = GHIDRA_CAST<undefined1 *>(0x42a00000);
|
|
}
|
|
if ((((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (iVar8 == 1)) ||
|
|
((iVar8 - 10U < 0x3de || (iVar8 == 4)))) &&
|
|
((float)local_310 <
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x370)) + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x370)) + 16.0)) {
|
|
pGStack_2f8 = GHIDRA_CAST<Game *>(((float)pGStack_2f8 * 0.8));
|
|
}
|
|
if (8.0 <= (float)local_310) {
|
|
fVar19 = 1.0 / (float)local_310;
|
|
}
|
|
else {
|
|
fVar19 = (float)local_310 * 0.015625;
|
|
}
|
|
if (iVar8 == 9) {
|
|
apEStack_2f0[0] = GHIDRA_CAST<EntityPtr *>(0x3f000000);
|
|
fVar21 = (float)(g_game->_frameCount - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar20) + 0x328))) / 30.0;
|
|
if (1.0 <= fVar21) {
|
|
fVar21 = 1.0;
|
|
}
|
|
fVar21 = fVar21 * fVar19;
|
|
pfVar17 = GHIDRA_CAST<float *>((((float)pushStrength * fVar21) /
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x36c))));
|
|
apEStack_2e0[0] = GHIDRA_CAST<EntityPtr *>((1.0 - (fVar21 + fVar21)));
|
|
ppEVar13 = apEStack_2e0;
|
|
if ((float)apEStack_2e0[0] <= 0.5) {
|
|
ppEVar13 = apEStack_2f0;
|
|
}
|
|
pEVar2 = *ppEVar13;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x364)) = (float)pEVar2 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x364));
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x360)) = (float)pEVar2 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x360));
|
|
if ((0.3 < fVar21) &&
|
|
(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x418)) <= 0.0 &&
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x418)) != 0.0)) {
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(EVar20) + 0x418)) = 0;
|
|
}
|
|
if ((((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(EVar20) + 0x173)) == '\0') &&
|
|
((float)local_2e4 <
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x370)) * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x370)))) &&
|
|
(0xf < g_game->_frameCount - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar20) + 0x328)))) &&
|
|
(-50.0 < *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x410)))) {
|
|
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(EVar20) + 0x173)) = 1;
|
|
}
|
|
}
|
|
else {
|
|
local_314 = GHIDRA_CAST<float *>((((float)pushStrength * fVar19) /
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x36c))));
|
|
if (iVar8 == 2) {
|
|
apEStack_2f0[0] = GHIDRA_CAST<EntityPtr *>(0x3f000000);
|
|
apEStack_2e0[0] = GHIDRA_CAST<EntityPtr *>((1.0 - (fVar19 + fVar19)));
|
|
ppEVar13 = apEStack_2e0;
|
|
if ((float)apEStack_2e0[0] <= 0.5) {
|
|
ppEVar13 = apEStack_2f0;
|
|
}
|
|
fVar19 = (float)*ppEVar13 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x364));
|
|
fVar21 = (float)*ppEVar13 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x360));
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x364)) = fVar19;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x360)) = fVar21;
|
|
local_320 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<ItemPool *>(g_tearFlagOrbit._l))) + 0x4)));
|
|
apEStack_2e0[0] =
|
|
GHIDRA_CAST<EntityPtr *>((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar20) + 0x430)) & GHIDRA_UINT(g_tearFlagOrbit._h)));
|
|
apEStack_2f0[0] =
|
|
(EntityPtr *)
|
|
(*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar20) + 0x434)) & (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(g_tearFlagOrbit._h))) + 0x4))));
|
|
pfStack_2b8 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(g_tearFlagOrbit._h)) + 0x4)));
|
|
uStack_2d0 = GHIDRA_UINT(g_tearFlagOrbit._l);
|
|
this = tmpEntity;
|
|
if ((((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar20) + 0x428)) & GHIDRA_UINT(g_tearFlagOrbit._l)) != 0 ||
|
|
(*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar20) + 0x42c)) & (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(g_tearFlagOrbit._l))) + 0x4)))) != 0) ||
|
|
(apEStack_2e0[0] != GHIDRA_CAST<EntityPtr *>(0x0) || apEStack_2f0[0] != GHIDRA_CAST<EntityPtr *>(0x0))
|
|
) && (fVar19 * fVar19 + fVar21 * fVar21 < 1.0)) {
|
|
newTearFlagsLo = ~GHIDRA_UINT(g_tearFlagOrbit._l) & *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar20) + 0x428));
|
|
local_320 = (ItemPool *)
|
|
(~(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(g_tearFlagOrbit._l))) + 0x4))) & *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar20) + 0x42c)))
|
|
;
|
|
uVar14 = ~GHIDRA_UINT(g_tearFlagOrbit._h) & *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar20) + 0x430));
|
|
uStack_2ac = CONCAT44(uVar14,local_320);
|
|
uStack_2a4 = ~(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(g_tearFlagOrbit._h))) + 0x4))) & *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(EVar20) + 0x434));
|
|
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(flags._l)) + 0x4))) = GHIDRA_CAST<float *>(local_320);
|
|
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(flags._l)) + 0x0))) = newTearFlagsLo;
|
|
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(flags._h)) + 0x0))) = uVar14;
|
|
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(flags._h)) + 0x4))) = uStack_2a4;
|
|
(GHIDRA_CAST<Entity_Tear *>((GHIDRA_CAST<Entity_Tear *>(EVar20))))->Entity_Tear::SetTearFlags(flags);
|
|
}
|
|
}
|
|
pfVar17 = local_314;
|
|
}
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x360)) =
|
|
(float)local_308 * (float)pfVar17 + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x360));
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x364)) =
|
|
(float)pEStack_2fc * (float)pfVar17 + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(EVar20) + 0x364));
|
|
}
|
|
}
|
|
}
|
|
local_304 = GHIDRA_CAST<float *>((GHIDRA_INT(local_304) + 1));
|
|
} while (local_304 < *GHIDRA_CAST<float **>((GHIDRA_CAST<char *>(pvStack_2bc) + 0x1264)));
|
|
}
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x364)) = (float)pGStack_2f8 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x364));
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x360)) = (float)pGStack_2f8 * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x360));
|
|
}
|
|
}
|
|
LAB_006b0a5d:
|
|
if ((((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x168)) & 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<int *>((GHIDRA_CAST<char *>(this) + 0x188)) != 0 &&
|
|
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x184)) == 5)) || ((GHIDRA_UINT(local_2c8.x) & 0x80) != 0)))) &&
|
|
(fVar19 = sqrtf(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x360)) * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x360)) +
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x364)) * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x364))), 0.01 < fVar19)
|
|
))) {
|
|
iVar8 = 1;
|
|
if (1 < GHIDRA_INT((20.0 / fVar19))) {
|
|
iVar8 = GHIDRA_INT((20.0 / fVar19));
|
|
}
|
|
iVar8 = GetIntervalTicks(this,(float)iVar8,0.0);
|
|
if (iVar8 != 0) {
|
|
uVar14 = Random();
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0x85,GHIDRA_CAST<Vector *>((GHIDRA_INT(this) + 0x33c)),&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,
|
|
uVar14,0);
|
|
}
|
|
}
|
|
if (10000.0 <= ABS(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x33c))) + ABS(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x340)))) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("Invalid entity position detected: %.2f, %.2f (%d.%d.%d)\n"));
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006b0eb0
|
|
void Entity::Interpolate()
|
|
{
|
|
Vector *position;
|
|
float velocityY;
|
|
Vector clampedPos;
|
|
uint flagsLow;
|
|
Game *game;
|
|
float speedMultiplier;
|
|
int type;
|
|
float velocityX;
|
|
float velocityY;
|
|
|
|
flagsLow = GHIDRA_UINT(this->_flags);
|
|
if ((flagsLow & 2) != 0) {
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&this->_flags) + 4));
|
|
*GHIDRA_CAST<uint *>(&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
|
|
byte 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;
|
|
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Render(&this->_renderPosition,&g_vectorZero,&g_vectorZero);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006b1260
|
|
void Entity::PostRender()
|
|
{
|
|
void *pvVar1;
|
|
KColor *fromColor;
|
|
KColor *fromColor_00;
|
|
int unused;
|
|
uint 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;
|
|
undefined1 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<byte *>("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
|
|
byte Entity::RenderShadowLayer(Vector *offset)
|
|
{
|
|
byte *layerName;
|
|
float fVar1;
|
|
float fVar2;
|
|
float fVar3;
|
|
LayerState *shadowLayer;
|
|
float *extraout_EAX;
|
|
double dVar4;
|
|
Vector renderPos;
|
|
float local_c4;
|
|
undefined8 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;
|
|
undefined4 local_6c [26];
|
|
ColorMod *spriteColor;
|
|
|
|
local_c0 = CONCAT44((*GHIDRA_CAST<undefined4 *>((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<byte *>((this->_sprite)._shadowLayerIndex);
|
|
if (layerName == GHIDRA_CAST<byte *>(0xffffffff)) {
|
|
return 0;
|
|
}
|
|
shadowLayer = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::GetLayer(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<undefined8 *>((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<undefined8 *>((this->_sprite)._color._offset) = *GHIDRA_CAST<undefined8 *>((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<undefined8 *>((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;
|
|
byte 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;
|
|
byte 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 [10];
|
|
Capsule selfCapsule [11];
|
|
|
|
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
|
|
byte Entity::push_apart_circle(Entity *other)
|
|
{
|
|
byte bVar1;
|
|
Vector *relVelocityDir;
|
|
Vector *deltaDir;
|
|
uint 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
|
|
byte Entity::ForceCollide(Entity *boom, Entity *collider, byte low)
|
|
{
|
|
byte bVar1;
|
|
byte 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, byte isFadeout, byte isShare)
|
|
{
|
|
float fVar1;
|
|
float fVar2;
|
|
float fVar3;
|
|
byte isStatusShared;
|
|
undefined4 extraout_EDX;
|
|
int *insertPos;
|
|
undefined3 in_stack_00000011;
|
|
undefined3 in_stack_00000015;
|
|
undefined1 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;
|
|
undefined4 uStack_28;
|
|
float local_24;
|
|
float local_20;
|
|
int local_1c;
|
|
undefined4 local_18;
|
|
byte local_14;
|
|
byte local_13;
|
|
uint local_c;
|
|
undefined8 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<undefined8 *>((this->_color)._offset) = *GHIDRA_CAST<undefined8 *>(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<undefined8 *>(color->_offset);
|
|
local_20 = (float)duration;
|
|
local_1c = duration;
|
|
insertPos = (this->_colorParams)._begin;
|
|
(*GHIDRA_CAST<undefined2 *>((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 = (undefined4)((ulonglong)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<undefined8 *>((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<byte *>((paramsEnd + 0xe)) = isFadeout;
|
|
paramsEnd[0xc] = duration;
|
|
paramsEnd[0xd] = duration;
|
|
*GHIDRA_CAST<byte *>((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 = (undefined4)*GHIDRA_CAST<undefined8 *>(color->_offset);
|
|
local_24 = (float)((ulonglong)*GHIDRA_CAST<undefined8 *>(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<undefined8 *>((this->_sprite)._color._offset) = *GHIDRA_CAST<undefined8 *>((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)) && (this->_child != (EntityPtr)0x0)) {
|
|
(**(code **)(*GHIDRA_CAST<int *>(this->_child) + 0x3c))(color,duration,priority,_isFadeout,_isShare);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006b45c0
|
|
void Entity::BloodExplode()
|
|
{
|
|
void *pvVar1;
|
|
ANM2 *pAVar2;
|
|
char cVar3;
|
|
byte bVar4;
|
|
uint uVar5;
|
|
Entity *pEVar6;
|
|
LayerState *layer;
|
|
uint rngValue;
|
|
int iVar7;
|
|
Manager *manager;
|
|
int *unaff_EDI;
|
|
float fVar8;
|
|
float fVar9;
|
|
int timeout;
|
|
undefined1 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;
|
|
uint 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<uint *>((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<uint *>((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<uint *>((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<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((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) {
|
|
(GHIDRA_CAST<AnimationState *>((&(pEVar6->_sprite)._animState)))->AnimationState::SetFrameFloat(1.0);
|
|
}
|
|
uVar5 = g_graphicsManager_flags;
|
|
layer = (GHIDRA_CAST<ANM2 *>((&pEStack_90->_sprite)))->ANM2::GetLayer(GHIDRA_CAST<byte *>(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<uint *>((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<uint *>((GHIDRA_CAST<char *>(this->_config) + 0x60));
|
|
}
|
|
else {
|
|
uVar5 = *GHIDRA_CAST<uint *>((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<uint *>((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) {
|
|
timeout = 6;
|
|
goto LAB_006b4d65;
|
|
}
|
|
}
|
|
else {
|
|
gibSpeed = 4.0;
|
|
timeout = 0x18;
|
|
LAB_006b4d65:
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::ShakeScreen(timeout);
|
|
}
|
|
pvVar1 = (this->_damageEvents)._begin;
|
|
if (pvVar1 != (this->_damageEvents)._end) {
|
|
pEStack_8c = GHIDRA_CAST<Entity *>(((this->_pos).y - *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + 0x24))));
|
|
fStack_88 = (this->_pos).x - *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + 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<byte *>((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<uint *>((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<uint *>((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
|
|
byte Entity::IsActiveEnemy(byte 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, byte ignoreBossStatusCooldown, byte unk)
|
|
{
|
|
byte bVar1;
|
|
char cVar2;
|
|
Entity_NPC *npc;
|
|
int newCountdown;
|
|
int extraout_EDX;
|
|
Entity *statusOwner;
|
|
EntityPtr ancestor;
|
|
undefined4 flagsHigh;
|
|
uint flagsLow;
|
|
EntityPtr nextParent;
|
|
int oldCountdown;
|
|
qword 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 = this->_parent;
|
|
statusOwner = this;
|
|
while (ancestor = nextParent, ancestor != (EntityPtr)0x0) {
|
|
statusOwner = GHIDRA_CAST<Entity *>(ancestor);
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(ancestor) + 0x3bc));
|
|
}
|
|
}
|
|
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<undefined4 *>((GHIDRA_INT(&statusOwner->_flags) + 4));
|
|
*GHIDRA_CAST<uint *>(&statusOwner->_flags) = flagsLow | 0x1000000;
|
|
*GHIDRA_CAST<undefined4 *>((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;
|
|
undefined4 *luaRef;
|
|
undefined4 uVar1;
|
|
int refId;
|
|
|
|
luaRef = this->_luaBridgeRef;
|
|
if (luaRef == GHIDRA_CAST<undefined4 *>(0x0)) {
|
|
luaRef = operator_new(8);
|
|
if (luaRef == GHIDRA_CAST<undefined4 *>(0x0)) {
|
|
luaRef = GHIDRA_CAST<undefined4 *>(0x0);
|
|
}
|
|
else {
|
|
uVar1 = *GHIDRA_CAST<undefined4 *>((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<undefined4 *>((GHIDRA_CAST<char *>(outRef) + 4)) = 0xffffffff;
|
|
return outRef;
|
|
}
|
|
(GHIDRA_CAST<LuaRef *>((luaRef)))->LuaRef::push(luaState);
|
|
uVar1 = luaL_ref(*luaRef,0xfff0b9d8);
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(outRef) + 4)) = uVar1;
|
|
return outRef;
|
|
}
|
|
|
|
// 006b5f10
|
|
void * Entity::GetDebugShape(byte isUnknown)
|
|
{
|
|
void *debugShape;
|
|
|
|
debugShape = (GHIDRA_CAST<DebugRenderer *>((&g_game->_debugRenderer)))->DebugRenderer::Get(this->_index,isUnknown);
|
|
return debugShape;
|
|
}
|
|
|
|
// 006b62b0
|
|
uint 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 != (EntityPtr)0x0) {
|
|
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)
|
|
{
|
|
uint rngResult;
|
|
Entity *firstPoof;
|
|
Entity *secondPoof;
|
|
int *unaff_EDI;
|
|
float fVar1;
|
|
Entity_Effect *pEVar2;
|
|
float fVar3;
|
|
undefined1 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<byte *>((unaff_EDI + 0x52)) = ~(byte)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 = ~(byte)rngResult & 1;
|
|
secondPoof->Update();
|
|
if (pEVar2->_child != (EntityPtr)0x0) {
|
|
std::multiset<unsigned_int>::erase(auStack_12 + -0x22);
|
|
}
|
|
pEVar2->_child = (EntityPtr)secondPoof;
|
|
std::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)
|
|
{
|
|
uint rngResult;
|
|
Entity *poof;
|
|
Entity *childPoof;
|
|
int *unaff_EDI;
|
|
float fVar1;
|
|
Entity_Effect *pEVar2;
|
|
float fVar3;
|
|
undefined1 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<byte *>((unaff_EDI + 0x52)) = ~(byte)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 = ~(byte)rngResult & 1;
|
|
childPoof->Update();
|
|
if (pEVar2->_child != (EntityPtr)0x0) {
|
|
std::multiset<unsigned_int>::erase(auStack_12 + -0x22);
|
|
}
|
|
pEVar2->_child = (EntityPtr)childPoof;
|
|
std::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, byte *nullLayerName)
|
|
{
|
|
float *nullFrame;
|
|
float fVar1;
|
|
float cosRotation;
|
|
float fVar2;
|
|
Vector offset;
|
|
|
|
if ((this->_sprite)._animState._animData != (void *)0x0) {
|
|
nullFrame = (GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::GetNullFrame(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, byte *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 = (GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::GetNullFrame(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;
|
|
byte 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, byte unused)
|
|
{
|
|
uint *puVar1;
|
|
qword qVar2;
|
|
byte bVar3;
|
|
char cVar4;
|
|
uint uVar5;
|
|
EntityPtr statusEffect;
|
|
uint uVar6;
|
|
int newCountdown;
|
|
int extraout_EDX;
|
|
Entity *statusOwner;
|
|
EntityPtr *pEStack_68;
|
|
EntityRef *savedRef;
|
|
EntityRef sourceRef;
|
|
ColorMod magnetColor;
|
|
EntityPtr *effectParentSlot;
|
|
int oldCountdown;
|
|
EntityPtr 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 = this->_parent;
|
|
statusOwner = this;
|
|
while (parent = statusEffect, parent != (EntityPtr)0x0) {
|
|
statusOwner = GHIDRA_CAST<Entity *>(parent);
|
|
statusEffect = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(parent) + 0x3bc));
|
|
}
|
|
}
|
|
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<uint *>((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 == (EntityPtr)0x0) {
|
|
uVar5 = Random();
|
|
statusEffect = (EntityPtr)
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0x39,&statusOwner->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,
|
|
uVar5,0);
|
|
statusOwner->_iceFrozenEffect = statusEffect;
|
|
effectParentSlot = GHIDRA_CAST<EntityPtr *>((GHIDRA_INT(statusEffect) + 0x3bc));
|
|
if (*GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(statusEffect) + 0x3bc)) != (EntityPtr)0x0) {
|
|
pEStack_68 = effectParentSlot;
|
|
std::multiset<unsigned_int>::erase(&pEStack_68);
|
|
}
|
|
*effectParentSlot = (EntityPtr)statusOwner;
|
|
std::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<uint *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x168)) & 0x100) == 0) goto LAB_006b74e5;
|
|
sourceRef._flags = 1;
|
|
LAB_006b74eb:
|
|
if ((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x168)) & 0x20000000) == 0) goto LAB_006b7504;
|
|
uVar5 = 2;
|
|
LAB_006b750a:
|
|
if ((*GHIDRA_CAST<uint *>((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, byte unused)
|
|
{
|
|
byte bVar1;
|
|
char cVar2;
|
|
uint uVar3;
|
|
int newCountdown;
|
|
int extraout_EDX;
|
|
uint uVar4;
|
|
EntityPtr statusTarget;
|
|
undefined1 auStack_64 [4];
|
|
EntityRef sourceRef;
|
|
undefined4 local_38;
|
|
undefined4 uStack_34;
|
|
undefined4 uStack_30;
|
|
undefined4 uStack_2c;
|
|
undefined4 local_28;
|
|
undefined4 uStack_24;
|
|
undefined4 uStack_20;
|
|
undefined4 uStack_1c;
|
|
undefined4 local_18;
|
|
undefined4 local_14;
|
|
undefined4 local_10;
|
|
uint local_c;
|
|
int baitedCountdown;
|
|
uint *flagsHigh;
|
|
EntityPtr nextParent;
|
|
qword oldFlags;
|
|
EntityPtr 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 = (EntityPtr)this;
|
|
if (bVar1 != 0) {
|
|
nextParent = this->_parent;
|
|
while (parent = nextParent, parent != (EntityPtr)0x0) {
|
|
statusTarget = parent;
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(parent) + 0x3bc));
|
|
}
|
|
}
|
|
if (extraout_EDX == 0) {
|
|
return;
|
|
}
|
|
if (((GHIDRA_CAST<Entity *>(statusTarget))->_flags & 1) != 0) {
|
|
return;
|
|
}
|
|
if (0 < (GHIDRA_CAST<Entity *>(statusTarget))->_bossStatusEffectCooldown) {
|
|
return;
|
|
}
|
|
baitedCountdown = (GHIDRA_CAST<Entity *>(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;
|
|
}
|
|
}
|
|
(GHIDRA_CAST<Entity *>(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;
|
|
(**(code **)(*GHIDRA_CAST<int *>(statusTarget) + 0x3c))
|
|
(&local_38,(GHIDRA_CAST<Entity *>(statusTarget))->_baitedCountdown,0xff,0,1);
|
|
oldFlags = (GHIDRA_CAST<Entity *>(statusTarget))->_flags;
|
|
flagsHigh = GHIDRA_CAST<uint *>((GHIDRA_INT(&(GHIDRA_CAST<Entity *>(statusTarget))->_flags) + 4));
|
|
*flagsHigh = *flagsHigh | 0x100000;
|
|
*GHIDRA_CAST<int *>(&(GHIDRA_CAST<Entity *>(statusTarget))->_flags) = GHIDRA_INT(oldFlags);
|
|
cVar2 = FUN_006ae7a0();
|
|
if (cVar2 != '\0') {
|
|
(GHIDRA_CAST<Entity *>(statusTarget))->_bossStatusEffectCooldown = 0xf0;
|
|
}
|
|
CopyStatusEffects(GHIDRA_CAST<Entity *>(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<uint *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x168)) & 0x100) == 0) goto LAB_006b7755;
|
|
sourceRef._flags = 1;
|
|
LAB_006b775b:
|
|
if ((*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(sourceRef._entity) + 0x168)) & 0x20000000) == 0) goto LAB_006b7774;
|
|
uVar4 = 2;
|
|
LAB_006b777a:
|
|
if ((*GHIDRA_CAST<uint *>((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)
|
|
{
|
|
byte bVar1;
|
|
int newCountdown;
|
|
int extraout_EDX;
|
|
ColorMod weaknessColor;
|
|
EntityPtr ancestor;
|
|
uint *flagsHigh;
|
|
EntityPtr nextParent;
|
|
int oldCountdown;
|
|
qword oldFlags;
|
|
|
|
bVar1 = IsDamageSourceFriendly(this,ref);
|
|
if (bVar1 == 0) {
|
|
apply_second_hand_duration(this,-3,ref);
|
|
bVar1 = DoesEntityShareStatus(this);
|
|
if (bVar1 != 0) {
|
|
nextParent = this->_parent;
|
|
while (ancestor = nextParent, ancestor != (EntityPtr)0x0) {
|
|
this = GHIDRA_CAST<Entity *>(ancestor);
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(ancestor) + 0x3bc));
|
|
}
|
|
}
|
|
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<uint *>((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)
|
|
{
|
|
byte bVar1;
|
|
int newCountdown;
|
|
int extraout_EDX;
|
|
undefined4 markColor;
|
|
undefined4 uStack_30;
|
|
undefined4 uStack_2c;
|
|
undefined4 uStack_28;
|
|
undefined4 local_24;
|
|
undefined4 uStack_20;
|
|
undefined4 uStack_1c;
|
|
undefined4 uStack_18;
|
|
undefined4 local_14;
|
|
undefined4 local_10;
|
|
undefined4 local_c;
|
|
undefined4 local_8;
|
|
EntityPtr ancestor;
|
|
int currentCountdown;
|
|
EntityPtr nextParent;
|
|
|
|
local_8 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
|
|
bVar1 = IsDamageSourceFriendly(this,ref);
|
|
if (bVar1 == 0) {
|
|
apply_second_hand_duration(this,duration,ref);
|
|
bVar1 = DoesEntityShareStatus(this);
|
|
if (bVar1 != 0) {
|
|
nextParent = this->_parent;
|
|
while (ancestor = nextParent, ancestor != (EntityPtr)0x0) {
|
|
this = GHIDRA_CAST<Entity *>(ancestor);
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(ancestor) + 0x3bc));
|
|
}
|
|
}
|
|
if (extraout_EDX != 0) {
|
|
currentCountdown = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x304));
|
|
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;
|
|
}
|
|
}
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x304)) = 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,*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x304)),0xff,0,1);
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x16c)) = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x16c)) | 0x1000000;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x168)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x168));
|
|
CopyStatusEffects(this);
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006b79d0
|
|
void Entity::AddIce(EntityRef *ref, int duration)
|
|
{
|
|
byte bVar1;
|
|
char cVar2;
|
|
int newIceCountdown;
|
|
int extraout_EDX;
|
|
EntityPtr ancestor;
|
|
EntityPtr nextParent;
|
|
int oldIceCountdown;
|
|
|
|
bVar1 = IsDamageSourceFriendly(this,ref);
|
|
if ((bVar1 == 0) && (cVar2 = this->IsBoss(), cVar2 == '\0')) {
|
|
apply_second_hand_duration(this,duration,ref);
|
|
bVar1 = DoesEntityShareStatus(this);
|
|
if (bVar1 != 0) {
|
|
nextParent = this->_parent;
|
|
while (ancestor = nextParent, ancestor != (EntityPtr)0x0) {
|
|
this = GHIDRA_CAST<Entity *>(ancestor);
|
|
nextParent = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(ancestor) + 0x3bc));
|
|
}
|
|
}
|
|
oldIceCountdown = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x300));
|
|
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;
|
|
}
|
|
}
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x300)) = newIceCountdown;
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x16c)) = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x16c)) | 0x40000;
|
|
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x168)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x168));
|
|
CopyStatusEffects(this);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006b7be0
|
|
Entity_NPC * Entity::GiveMinecart(Vector *position, Vector *velocity)
|
|
{
|
|
Vector *pos;
|
|
uint seed;
|
|
Entity_NPC *minecart;
|
|
EntityPtr *entityRef;
|
|
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;
|
|
entityRef = &this->_minecart;
|
|
(minecart->_targetPosition).x = minecartVelocity->x;
|
|
(minecart->_targetPosition).y = velocityY;
|
|
if (*GHIDRA_CAST<Entity_NPC **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((entityRef)) + 0x0)))) != minecart) {
|
|
if (*GHIDRA_CAST<Entity_NPC **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((entityRef)) + 0x0)))) != GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
|
position = GHIDRA_CAST<Vector *>(entityRef);
|
|
std::multiset<unsigned_int>::erase(&position);
|
|
}
|
|
*GHIDRA_CAST<Entity_NPC **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((entityRef)) + 0x0)))) = minecart;
|
|
std::multiset<unsigned_int>::insert(entityRef);
|
|
}
|
|
entityRef = &minecart->_child;
|
|
if (minecart->_child != (EntityPtr)0x0) {
|
|
position = GHIDRA_CAST<Vector *>(entityRef);
|
|
std::multiset<unsigned_int>::erase(&position);
|
|
}
|
|
*GHIDRA_CAST<Entity **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((entityRef)) + 0x0)))) = this;
|
|
if (this != GHIDRA_CAST<Entity *>(0x0)) {
|
|
std::multiset<unsigned_int>::insert(entityRef);
|
|
}
|
|
return minecart;
|
|
}
|
|
|
|
// 006b9740
|
|
byte Entity::IsPlayerInRadius(Vector *position, float radius, int unused1, int unused2)
|
|
{
|
|
int *playerSlot;
|
|
void *playerListEnd;
|
|
Game *game;
|
|
PlayerManager *playerManager;
|
|
qword *allocatedBytes;
|
|
uint uVar1;
|
|
float dx;
|
|
float dy;
|
|
float radiusSq;
|
|
EntityList_EL nearbyEntities;
|
|
float queryRadius;
|
|
float savedRadiusSq;
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 local_8;
|
|
int nearbyEntity;
|
|
qword 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<byte *>("(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)),&nearbyEntities,position,queryRadius,1);
|
|
uVar1 = 0;
|
|
if (nearbyEntities._size != 0) {
|
|
do {
|
|
nearbyEntity = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(nearbyEntities._data) + uVar1 * 4));
|
|
if (((nearbyEntity != 0) && (*GHIDRA_CAST<int *>((nearbyEntity + 0x28)) == 3)) &&
|
|
(*GHIDRA_CAST<int *>((nearbyEntity + 0x2c)) == 0x3e)) {
|
|
if ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(nearbyEntities)) + 0x0))) == '\0') {
|
|
local_8 = 0;
|
|
tracked_alloc(1,nearbyEntities._data,0);
|
|
}
|
|
ExceptionList = local_10;
|
|
return 1;
|
|
}
|
|
uVar1 = uVar1 + 1;
|
|
} while (uVar1 < GHIDRA_UINT(nearbyEntities._size));
|
|
}
|
|
if ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(nearbyEntities)) + 0x0))) == '\0') {
|
|
if (g_mainHeap == (void *)0x0) {
|
|
allocatedBytes = &g_allocatedBytesNoHeap;
|
|
}
|
|
else {
|
|
allocatedBytes = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
|
|
}
|
|
if (nearbyEntities._data != (void *)0x0) {
|
|
uVar1 = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(nearbyEntities._data) + -4));
|
|
prevAllocatedBytes = *allocatedBytes;
|
|
*GHIDRA_CAST<uint *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar1;
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
|
|
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevAllocatedBytes) < uVar1));
|
|
free((void *)(GHIDRA_INT(nearbyEntities._data) + -4));
|
|
}
|
|
}
|
|
}
|
|
ExceptionList = local_10;
|
|
return 0;
|
|
}
|
|
|
|
// 006d7d60
|
|
byte Entity::IsHostileTo(Entity *other)
|
|
{
|
|
byte isHostile;
|
|
qword 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
|
|
byte Entity::is_valid_target()
|
|
{
|
|
int iVar1;
|
|
EntityPtr EVar2;
|
|
byte bVar3;
|
|
Entity_NPC *parentNpc;
|
|
int entityType;
|
|
EntityPtr ancestor;
|
|
Entity_NPC *extraout_EDX;
|
|
EntityPtr 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 = (EntityPtr)(GHIDRA_CAST<Entity_NPC *>((GHIDRA_CAST<Entity_NPC *>(this))))->Entity_NPC::ParentNPC();
|
|
}
|
|
else {
|
|
if (entityType == 0x119) {
|
|
parentNpc = (GHIDRA_CAST<Entity_NPC *>((GHIDRA_CAST<Entity_NPC *>(this))))->Entity_NPC::ParentNPC();
|
|
if (parentNpc == GHIDRA_CAST<Entity_NPC *>(0x0)) goto LAB_006d8add;
|
|
goto LAB_006d8ad0;
|
|
}
|
|
if (entityType == 0x364) {
|
|
rootEntity = this->_parent;
|
|
ancestor = (EntityPtr)this;
|
|
while (EVar2 = rootEntity, EVar2 != (EntityPtr)0x0) {
|
|
ancestor = EVar2;
|
|
rootEntity = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar2) + 0x3bc));
|
|
}
|
|
if (((iVar1 < 2) || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(ancestor) + 0x28)) != 1)) &&
|
|
(0x3dd < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(ancestor) + 0x28)) - 10U)) {
|
|
ancestor = (EntityPtr)0x0;
|
|
}
|
|
rootEntity = (EntityPtr)this;
|
|
if (ancestor != (EntityPtr)0x0) {
|
|
rootEntity = ancestor;
|
|
}
|
|
}
|
|
else {
|
|
bVar3 = DoesEntityShareStatus(this);
|
|
rootEntity = (EntityPtr)extraout_EDX;
|
|
if (bVar3 != 0) {
|
|
ancestor = this->_parent;
|
|
rootEntity = (EntityPtr)extraout_EDX;
|
|
while (EVar2 = ancestor, EVar2 != (EntityPtr)0x0) {
|
|
rootEntity = EVar2;
|
|
ancestor = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(EVar2) + 0x3bc));
|
|
}
|
|
}
|
|
if ((rootEntity == (EntityPtr)0x0) ||
|
|
(((iVar1 < 2 || ((GHIDRA_CAST<Entity_NPC *>(rootEntity))->_type != 1)) &&
|
|
(0x3dd < (GHIDRA_CAST<Entity_NPC *>(rootEntity))->_type - 10U)))) {
|
|
rootEntity = (EntityPtr)GHIDRA_CAST<Entity_NPC *>(0x0);
|
|
}
|
|
}
|
|
}
|
|
if (rootEntity != (EntityPtr)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;
|
|
uint 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;
|
|
byte isAnimSet;
|
|
ColorMod *Color;
|
|
ColorMod *Color_00;
|
|
uint uVar1;
|
|
EntityRef *source_00;
|
|
Entity *pEVar2;
|
|
char *name;
|
|
byte *anim;
|
|
undefined4 extraout_ECX;
|
|
Vector *pVVar3;
|
|
ANM2 *this;
|
|
uint 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;
|
|
uint local_48;
|
|
char isNormalRock;
|
|
Color local_40;
|
|
uint local_14;
|
|
void *local_10;
|
|
undefined1 *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)) {
|
|
(GHIDRA_CAST<ANM2 *>((&sourceSprite)))->ANM2::ANM2(&source->_sprite);
|
|
Isaac::SwapANM2(&pEVar2->_sprite,&sourceSprite);
|
|
local_8 = 0.0;
|
|
this->ANM2::Reset();
|
|
(GHIDRA_CAST<AnimationState *>((&sourceSprite._overlayAnimState)))->AnimationState::~AnimationState();
|
|
(GHIDRA_CAST<AnimationState *>((&sourceSprite._animState)))->AnimationState::~AnimationState();
|
|
(GHIDRA_CAST<std::string *>((sourceSprite._animDefaultName._buf)))->std::string::_Tidy_deallocate();
|
|
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(&sourceSprite))))->std::string::_Tidy_deallocate();
|
|
local_8 = -NAN;
|
|
}
|
|
if ((GridEntityType == 6) || (name = "rubble", GridEntityType == 0x1a)) {
|
|
name = "rubble_alt";
|
|
}
|
|
anim = (GHIDRA_CAST<ANM2 *>((&pEVar2->_sprite)))->ANM2::GetAnimationData(GHIDRA_CAST<byte *>(name));
|
|
if (anim != GHIDRA_CAST<byte *>(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<uint *>((anim + 0x14))) {
|
|
anim = *GHIDRA_CAST<byte **>(anim);
|
|
}
|
|
isAnimSet = (GHIDRA_CAST<ANM2 *>((&pEVar2->_sprite)))->ANM2::SetAnimation(anim,1);
|
|
if (((isAnimSet != 0) && ((pEVar2->_sprite)._animState._animData != (void *)0x0)) &&
|
|
((GHIDRA_CAST<AnimationState *>((&(pEVar2->_sprite)._animState)))->AnimationState::SetFrameFloat((float)GHIDRA_INT(local_4c)),
|
|
(pEVar2->_sprite)._animState._animData != (void *)0x0)) {
|
|
(pEVar2->_sprite)._animState._isPlaying = 0;
|
|
}
|
|
}
|
|
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((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<uint *>((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
|
|
byte Entity::FlipX()
|
|
{
|
|
return (this->_sprite)._flipX;
|
|
}
|
|
|
|
// 0085dcb0
|
|
void Entity::SetSpriteFrame(std_string *animName, int frame)
|
|
{
|
|
byte isAnimationSet;
|
|
|
|
if (0xf < animName->_capacity) {
|
|
animName = *GHIDRA_CAST<std_string **>(animName->_buf);
|
|
}
|
|
isAnimationSet = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST<byte *>(animName),1);
|
|
if ((isAnimationSet != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) {
|
|
(GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::SetFrameFloat((float)frame);
|
|
if ((this->_sprite)._animState._animData != (void *)0x0) {
|
|
(this->_sprite)._animState._isPlaying = 0;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 0085dd00
|
|
void Entity::SetSpriteOverlayFrame(std_string *anim, int frame)
|
|
{
|
|
byte isAnimationSet;
|
|
|
|
if (0xf < anim->_capacity) {
|
|
anim = *GHIDRA_CAST<std_string **>(anim->_buf);
|
|
}
|
|
isAnimationSet = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::SetOverlayAnimation(GHIDRA_CAST<byte *>(anim),1);
|
|
if ((isAnimationSet != 0) && ((this->_sprite)._overlayAnimState._animData != (void *)0x0)) {
|
|
(GHIDRA_CAST<AnimationState *>((&(this->_sprite)._overlayAnimState)))->AnimationState::SetFrameFloat((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
|
|
undefined4 Entity::IsVulnerableEnemy_lua(void *param_1)
|
|
{
|
|
byte isVulnerable;
|
|
int sourceRef;
|
|
int luaType;
|
|
Entity *source;
|
|
void *sourceLuaRef;
|
|
int local_1c;
|
|
Entity *local_18;
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 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)
|
|
{
|
|
uint uStack_40;
|
|
undefined4 callbackLuaState;
|
|
undefined4 callbackId;
|
|
int entityType;
|
|
undefined4 entityRefState;
|
|
undefined4 entityRefId;
|
|
undefined1 *local_14;
|
|
void *local_10;
|
|
undefined1 *puStack_c;
|
|
undefined4 local_8;
|
|
|
|
puStack_c = &LAB_00b04530;
|
|
local_10 = ExceptionList;
|
|
uStack_40 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
|
|
local_14 = GHIDRA_CAST<undefined1 *>(&uStack_40);
|
|
ExceptionList = &local_10;
|
|
callbackId = 0x43;
|
|
callbackLuaState = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(g_luaEngine) + 0x10));
|
|
entityType = entity->_type;
|
|
if ((*GHIDRA_CAST<byte *>((*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
|
|
float10 Entity::Size(int param_1)
|
|
{
|
|
return (float10)*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;
|
|
}
|