Seven agents took over LuaEngine (the mod API registration deferred), the rest of Manager (LoadConfigs, fonts, render surfaces, Update/Render), MusicManager/SFXManager, MenuManager with the title/save/game menus, Cutscene/NightmareScene/ Backdrop, RoomConfig (src/rooms ported and retired) with ItemPool, and PersistentGameData (the original binary save format) with InfoDisplay. An integration pass moved call sites to the new APIs, declared the taken-over free functions, fixed two data.cpp crashes (an empty children array, null attribute strings), and made the generator keep a header's own name where a prototype names another address. Clean build (0 warnings with -Wall -Wextra). build/isaac runs the game's Lua scripts (without the mod API yet) and stops at reload_resource_paths. 901 functions taken over, boot path 204/615. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12869 lines
524 KiB
C++
12869 lines
524 KiB
C++
#include "classes.h"
|
|
|
|
// 00447770
|
|
Entity_NPC * Entity_NPC::ParentNPC()
|
|
{
|
|
int npcCast;
|
|
Entity_NPC *parent;
|
|
|
|
parent = GHIDRA_CAST<Entity_NPC *>(0x0);
|
|
if (this->_parent != 0) {
|
|
npcCast = __RTDynamicCast(this->_parent,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor,
|
|
&IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0);
|
|
if (npcCast == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("m_Parent invalid downcast\n"));
|
|
}
|
|
parent = GHIDRA_CAST<Entity_NPC *>(this->_parent);
|
|
}
|
|
return parent;
|
|
}
|
|
|
|
// 004567a0
|
|
long double Entity_NPC::Scale()
|
|
{
|
|
return (long double)this->_scale;
|
|
}
|
|
|
|
// 004567e0
|
|
Entity_NPC * Entity_NPC::ChildNPC()
|
|
{
|
|
int castNpc;
|
|
Entity_NPC *child;
|
|
|
|
child = GHIDRA_CAST<Entity_NPC *>(0x0);
|
|
if (this->_child != 0) {
|
|
castNpc = __RTDynamicCast(this->_child,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor,
|
|
&IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0);
|
|
if (castNpc == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("m_Child invalid downcast\n"));
|
|
}
|
|
child = GHIDRA_CAST<Entity_NPC *>(this->_child);
|
|
}
|
|
return child;
|
|
}
|
|
|
|
// 004b92e0
|
|
void Entity_NPC::Hornfel_UpdateAI()
|
|
{
|
|
uint32_t *puVar1;
|
|
char cVar2;
|
|
uint8_t *puVar3;
|
|
uint8_t bVar4;
|
|
short timer;
|
|
uint32_t uVar5;
|
|
LayerState *layer;
|
|
Entity_NPC *newMinecart;
|
|
Entity_Projectile *projectile;
|
|
uint8_t *animName;
|
|
Entity_NPC **ppEVar6;
|
|
int iVar7;
|
|
Entity *tmpEntity;
|
|
Vector *vecPtr;
|
|
uint32_t uVar8;
|
|
char *pcVar9;
|
|
float *pfVar10;
|
|
Entity_NPC **maxPtr;
|
|
int *size;
|
|
Entity_NPC *tmpEntity;
|
|
Room *activeRoom;
|
|
bool bVar12;
|
|
float fVar13;
|
|
float fVar14;
|
|
float dirDot;
|
|
float deltaY;
|
|
float dot;
|
|
Vector randomPos;
|
|
float spreadScore;
|
|
Vector local_148;
|
|
Vector tmpVec;
|
|
float local_138;
|
|
float local_134;
|
|
Entity_NPC *local_130;
|
|
Entity_NPC *local_12c;
|
|
float local_128;
|
|
Vector launchTarget;
|
|
Entity_NPC *local_11c;
|
|
Room *room;
|
|
char isAtRailTarget;
|
|
Vector scratchVec;
|
|
Entity_NPC *local_108;
|
|
float local_104;
|
|
Entity_NPC *local_100;
|
|
Entity_NPC *local_fc;
|
|
ProjectileParams projectileParams;
|
|
uint8_t local_50 [24];
|
|
float fStack_38;
|
|
float fStack_34;
|
|
Entity_NPC *local_30;
|
|
Entity_NPC *local_2c;
|
|
Entity_NPC *local_28;
|
|
uint32_t local_24;
|
|
uint8_t *puStack_20;
|
|
void *local_1c;
|
|
uint8_t *puStack_18;
|
|
uint32_t local_14;
|
|
float absDirY;
|
|
void *animData;
|
|
uint32_t flagsHigh;
|
|
|
|
puStack_20 = local_50 + 0x4c;
|
|
local_14 = 0xffffffff;
|
|
puStack_18 = &LAB_00af349d;
|
|
local_1c = ExceptionList;
|
|
uVar5 = __security_cookie ^ GHIDRA_UINT((local_50 + 0x40));
|
|
ExceptionList = &local_1c;
|
|
local_12c = GHIDRA_CAST<Entity_NPC *>(this->_minecart);
|
|
activeRoom = g_game->_room;
|
|
room = activeRoom;
|
|
local_100 = this;
|
|
local_24 = uVar5;
|
|
puVar3 = local_50 + 0x4c;
|
|
switch(this->_state) {
|
|
case 0:
|
|
puStack_20 = local_50 + 0x4c;
|
|
if (this->_variant == 0) {
|
|
puStack_20 = local_50 + 0x4c;
|
|
QueryNPCsType(&fStack_34,1000,0x98);
|
|
local_14 = 0;
|
|
if (local_28 == GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
|
uVar8 = Random();
|
|
tmpEntity = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x98,&g_vectorZero,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar8);
|
|
tmpEntity->Update(uVar5);
|
|
}
|
|
else {
|
|
tmpEntity = *GHIDRA_CAST<Entity **>(local_30);
|
|
}
|
|
if (this->_parent != 0) {
|
|
local_fc = GHIDRA_CAST<Entity_NPC *>(&this->_parent);
|
|
msvc::multiset<unsigned_int>::erase(&local_fc);
|
|
}
|
|
this->_parent = tmpEntity;
|
|
if (tmpEntity != GHIDRA_CAST<Entity *>(0x0)) {
|
|
msvc::multiset<unsigned_int>::insert(&this->_parent);
|
|
}
|
|
local_14 = 0xffffffff;
|
|
(GHIDRA_CAST<EntityList_Query *>((&fStack_34)))->EntityList_Query::~EntityList_Query();
|
|
}
|
|
flagsHigh = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
|
|
*GHIDRA_CAST<uint32_t *>(&this->_flags) = GHIDRA_UINT(this->_flags) & 0xfffffffb;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = flagsHigh;
|
|
layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST<uint8_t *>(0x3));
|
|
layer->_visible = 0;
|
|
layer = ANM2::GetLayer(&this->_sprite,&DAT_00000004);
|
|
layer->_visible = 0;
|
|
this->_stateFrame = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_projectileCooldown) + 2)) = 0;
|
|
*GHIDRA_CAST<uint8_t *>((GHIDRA_INT(&this->_projectileDelay) + 2)) = 0;
|
|
*GHIDRA_CAST<uint16_t *>(&this->_projectileCooldown) = 0;
|
|
msvc::deque<EntityPtr>::resize(2);
|
|
uVar5 = (this->_entityDeque)._offset;
|
|
*(uint32_t *)
|
|
(*GHIDRA_CAST<int *>((GHIDRA_INT((this->_entityDeque)._map) + ((this->_entityDeque)._mapSize - 1 & uVar5 >> 2) * 4
|
|
)) + (uVar5 & 3) * 4) = 0;
|
|
scratchVec.y = (float)(this->_entityDeque)._offset;
|
|
*(uint32_t *)
|
|
(*GHIDRA_CAST<int *>((GHIDRA_INT((this->_entityDeque)._map) +
|
|
((this->_entityDeque)._mapSize - 1 & GHIDRA_INT(scratchVec.y) + 1U >> 2) * 4)) +
|
|
(GHIDRA_INT(scratchVec.y) + 1U & 3) * 4) = 0;
|
|
if (this->_variant == 1) {
|
|
flagsHigh = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
|
|
*GHIDRA_CAST<uint32_t *>(&this->_flags) = GHIDRA_UINT(this->_flags) | 0x140011;
|
|
this->_state = 0x10;
|
|
this->_isInvicible = 1;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = flagsHigh;
|
|
puVar3 = puStack_20;
|
|
}
|
|
else {
|
|
local_12c = GHIDRA_CAST<Entity_NPC *>(this->_minecart);
|
|
if (local_12c == GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
|
newMinecart = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::GiveMinecart(&g_vectorZero,&g_vectorZero);
|
|
local_2c = GHIDRA_CAST<Entity_NPC *>(0x0);
|
|
local_28 = GHIDRA_CAST<Entity_NPC *>(0xf);
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_50)) + 0x14))) = 0.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_50)) + 0x14))) = msvc::_Allocate(0x30);
|
|
local_2c = GHIDRA_CAST<Entity_NPC *>(0x21);
|
|
local_28 = GHIDRA_CAST<Entity_NPC *>(&DAT_0000002f);
|
|
builtin_strncpy((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(local_50))) + 0x14))),"gfx/965.001_hornfel minecart.anm2",0x22);
|
|
local_14 = 1;
|
|
ANM2::Load(&newMinecart->_sprite,GHIDRA_CAST<std_string *>((local_50 + 0x14)),1);
|
|
local_14 = 0xffffffff;
|
|
if (GHIDRA_CAST<Entity_NPC *>(&DAT_0000000f) < local_28) {
|
|
size = GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((local_28)) + 0x1))));
|
|
pcVar9 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(local_50))) + 0x14)));
|
|
if (GHIDRA_CAST<uint8_t *>(0xfff) < size) {
|
|
pcVar9 = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_50)) + 0x14))) + -4));
|
|
size = &local_28->_collisionIndex;
|
|
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_50)) + 0x14))) + (-4 - GHIDRA_INT(pcVar9))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(pcVar9,GHIDRA_UINT(size));
|
|
}
|
|
local_12c = GHIDRA_CAST<Entity_NPC *>(this->_minecart);
|
|
}
|
|
NpcHelper::hornfel_ride_minecart(this);
|
|
*GHIDRA_CAST<uint16_t *>((GHIDRA_INT(&this->_projectileCooldown) + 1)) = 0x1e1e;
|
|
puVar3 = puStack_20;
|
|
}
|
|
break;
|
|
case 3:
|
|
case 0xe:
|
|
animData = (this->_sprite)._animState._animData;
|
|
if (((animData == (void *)0x0) || ((this->_sprite)._animState._isPlaying == 0)) ||
|
|
(puStack_20 = local_50 + 0x4c, *GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(animData) + 0x34)) != '\0')) {
|
|
puStack_20 = local_50 + 0x4c;
|
|
NpcHelper::hornfel_charge(this);
|
|
}
|
|
(local_12c->_v2).x = 1.2;
|
|
timer = (short)this->_projectileDelay;
|
|
puVar3 = puStack_20;
|
|
if ((0 < timer) && (timer = timer + -1, *GHIDRA_CAST<short *>(&this->_projectileDelay) = timer, timer < 1)) {
|
|
if (this->_state == 0xe) {
|
|
if (*GHIDRA_CAST<char *>((GHIDRA_INT(&this->_projectileDelay) + 3)) != '\0') {
|
|
ANM2::Play(&this->_sprite,GHIDRA_CAST<uint8_t *>("Taunt"),0);
|
|
*GHIDRA_CAST<uint8_t *>((GHIDRA_INT(&this->_projectileCooldown) + 3)) = 0x96;
|
|
puVar3 = puStack_20;
|
|
}
|
|
}
|
|
else {
|
|
NpcHelper::hornfel_attack(this);
|
|
puVar3 = puStack_20;
|
|
}
|
|
}
|
|
break;
|
|
case 4:
|
|
absDirY = (this->_velocity).y;
|
|
fVar13 = (this->_velocity).x;
|
|
this->_friction = this->_friction * 0.8;
|
|
if (ABS(absDirY) < ABS(fVar13)) {
|
|
puStack_20 = local_50 + 0x4c;
|
|
ANM2::Play(&this->_sprite,GHIDRA_CAST<uint8_t *>("RunHori"),0);
|
|
bVar12 = (this->_velocity).x <= 0.0 && (this->_velocity).x != 0.0;
|
|
}
|
|
else {
|
|
animName = (this->_sprite)._animState._animData;
|
|
local_fc = GHIDRA_CAST<Entity_NPC *>(&DAT_00b5fdc8);
|
|
if (0.0 <= absDirY) {
|
|
local_fc = GHIDRA_CAST<Entity_NPC *>(0xb5fdd0);
|
|
}
|
|
if (animName == GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
LAB_004ba3e5:
|
|
puStack_20 = local_50 + 0x4c;
|
|
bVar4 = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST<uint8_t *>(local_fc),1);
|
|
if (bVar4 != 0) {
|
|
AnimationState::Rewind(&(this->_sprite)._animState);
|
|
(this->_sprite)._animState._isPlaying = 1;
|
|
activeRoom = room;
|
|
}
|
|
}
|
|
else {
|
|
if (0xf < *GHIDRA_CAST<uint32_t *>((animName + 0x14))) {
|
|
animName = *GHIDRA_CAST<uint8_t **>(animName);
|
|
}
|
|
newMinecart = local_fc;
|
|
do {
|
|
bVar4 = *animName;
|
|
bVar12 = bVar4 < *GHIDRA_CAST<uint8_t *>(newMinecart);
|
|
if (bVar4 != *GHIDRA_CAST<uint8_t *>(newMinecart)) {
|
|
LAB_004ba3c4:
|
|
uVar5 = -GHIDRA_UINT(bVar12) | 1;
|
|
goto LAB_004ba3c9;
|
|
}
|
|
if (bVar4 == 0) break;
|
|
bVar4 = animName[1];
|
|
bVar12 = bVar4 < (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(((uint8_t)newMinecart)) + 0x1)));
|
|
if (bVar4 != (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((newMinecart)) + 0x1)))) goto LAB_004ba3c4;
|
|
animName = animName + 2;
|
|
newMinecart = GHIDRA_CAST<Entity_NPC *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((newMinecart)) + 0x2))));
|
|
} while (bVar4 != 0);
|
|
uVar5 = 0;
|
|
LAB_004ba3c9:
|
|
if ((uVar5 != 0) ||
|
|
((puStack_20 = local_50 + 0x4c,
|
|
*GHIDRA_CAST<char *>((GHIDRA_INT((this->_sprite)._animState._animData) + 0x34)) != '\0' &&
|
|
(puStack_20 = local_50 + 0x4c, (this->_sprite)._animState._isPlaying == 0))))
|
|
goto LAB_004ba3e5;
|
|
}
|
|
bVar12 = false;
|
|
}
|
|
(this->_sprite)._flipX = bVar12;
|
|
timer = (short)this->_projectileDelay;
|
|
if (0 < timer) {
|
|
*GHIDRA_CAST<short *>(&this->_projectileDelay) =
|
|
timer - ((short)GHIDRA_INT(this->_updateTime) - (short)GHIDRA_INT(this->_prevUpdateTime));
|
|
}
|
|
if (GHIDRA_CAST<Entity_NPC *>(this->_entityRef) == GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
|
local_104 = -NAN;
|
|
}
|
|
else {
|
|
local_104 = (float)NpcHelper::hornfel_next_rail_index(GHIDRA_CAST<Entity_NPC *>(this->_entityRef));
|
|
}
|
|
absDirY = (float)(GHIDRA_CAST<Room *>((activeRoom)))->Room::GetGridIndex(&this->_pos);
|
|
if ((absDirY == local_104) ||
|
|
(bVar4 = (GHIDRA_CAST<Room *>((activeRoom)))->Room::IsPositionInRoom(&this->_pos,0.0), bVar4 == 0)) {
|
|
isAtRailTarget = '\x01';
|
|
}
|
|
else {
|
|
isAtRailTarget = '\0';
|
|
if ((this->_entityRef != 0) && (bVar4 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFrame(10,0), bVar4 != 0)) {
|
|
bVar4 = 0;
|
|
vecPtr = (GHIDRA_CAST<Room *>((room)))->Room::GetGridPosition(&tmpVec,GHIDRA_INT(local_104));
|
|
bVar4 = (GHIDRA_CAST<NPCAI_Pathfinder *>((&this->_pathfinder)))->NPCAI_Pathfinder::HasPathToPos(vecPtr,bVar4);
|
|
puVar1 = &this->_entityRef;
|
|
if (bVar4 == 0) {
|
|
if (*puVar1 != 0) {
|
|
local_100 = GHIDRA_CAST<Entity_NPC *>(puVar1);
|
|
msvc::multiset<unsigned_int>::erase(&local_100);
|
|
}
|
|
*puVar1 = 0;
|
|
}
|
|
}
|
|
}
|
|
local_130 = GHIDRA_CAST<Entity_NPC *>(this->_entityRef);
|
|
if (local_130 == GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
|
if ((short)this->_projectileDelay < 1) {
|
|
local_fc = GHIDRA_CAST<Entity_NPC *>(0x7149f2ca);
|
|
local_11c = g_game->_room;
|
|
local_108 = GHIDRA_CAST<Entity_NPC *>(0x0);
|
|
absDirY = 0.0;
|
|
local_104 = absDirY;
|
|
if (local_11c[1]._brimstoneMarkCountdown != 0) {
|
|
do {
|
|
fVar13 = *GHIDRA_CAST<float *>((local_11c[1]._weaknessCountdown + GHIDRA_INT(local_108) * 4));
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(fVar13) + 0x28)) == 0x3c7) {
|
|
dot = (this->_pos).y - *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(fVar13) + 0x340));
|
|
absDirY = (this->_pos).x - *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(fVar13) + 0x33c));
|
|
local_100 = GHIDRA_CAST<Entity_NPC *>((dot * dot + absDirY * absDirY));
|
|
bVar4 = (GHIDRA_CAST<NPCAI_Pathfinder *>((&this->_pathfinder)))->NPCAI_Pathfinder::HasPathToPos(&this->_pos,0);
|
|
if ((bVar4 == 0) || ((float)local_fc <= (float)local_100)) {
|
|
absDirY = local_104;
|
|
}
|
|
else {
|
|
local_fc = local_100;
|
|
absDirY = fVar13;
|
|
local_104 = fVar13;
|
|
}
|
|
}
|
|
local_108 = GHIDRA_CAST<Entity_NPC *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((local_108)) + 0x1))));
|
|
} while (local_108 < GHIDRA_CAST<uint8_t *>(local_11c[1]._brimstoneMarkCountdown));
|
|
if (absDirY != 0.0) {
|
|
if (this->_entityRef != 0) {
|
|
local_100 = GHIDRA_CAST<Entity_NPC *>(&this->_entityRef);
|
|
msvc::multiset<unsigned_int>::erase(&local_100);
|
|
absDirY = local_104;
|
|
}
|
|
this->_entityRef = absDirY;
|
|
msvc::multiset<unsigned_int>::insert(&this->_entityRef);
|
|
}
|
|
}
|
|
if (GHIDRA_CAST<Entity_NPC *>(this->_entityRef) != GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
|
absDirY = (float)NpcHelper::hornfel_next_rail_index(GHIDRA_CAST<Entity_NPC *>(this->_entityRef));
|
|
local_130 = GHIDRA_CAST<Entity_NPC *>(this->_entityRef);
|
|
goto LAB_004ba6b2;
|
|
}
|
|
}
|
|
LAB_004ba7a3:
|
|
tmpEntity = GetPlayerTarget(this);
|
|
absDirY = (this->_pos).x;
|
|
fVar13 = (tmpEntity->_pos).x;
|
|
deltaY = (this->_pos).y - (tmpEntity->_pos).y;
|
|
fVar14 = absDirY - fVar13;
|
|
dirDot = fVar14 * _DAT_00c5c678 + deltaY * _DAT_00c5c67c;
|
|
dot = 0.0;
|
|
if (0.0 < dirDot) {
|
|
dot = dirDot;
|
|
}
|
|
pfVar10 = &g_vectorZero.x;
|
|
if (0.0 < dirDot) {
|
|
pfVar10 = GHIDRA_CAST<float *>(&DAT_00c5c678);
|
|
}
|
|
dirDot = fVar14 * _DAT_00c5c680 + deltaY * _DAT_00c5c684;
|
|
if (dot < dirDot) {
|
|
pfVar10 = GHIDRA_CAST<float *>(&DAT_00c5c680);
|
|
dot = dirDot;
|
|
}
|
|
dirDot = fVar14 * DAT_00c5c688 + deltaY * DAT_00c5c68c;
|
|
if (dot < dirDot) {
|
|
pfVar10 = &DAT_00c5c688;
|
|
dot = dirDot;
|
|
}
|
|
fVar14 = DAT_00c5c694 * deltaY + fVar14 * DAT_00c5c690;
|
|
if (dot < fVar14) {
|
|
pfVar10 = &DAT_00c5c690;
|
|
dot = fVar14;
|
|
}
|
|
absDirY = atan2f((this->_pos).y - (dot * (GHIDRA_CAST<Vector *>(pfVar10))->y * 0.8 + (tmpEntity->_pos).y),
|
|
absDirY - (dot * (GHIDRA_CAST<Vector *>(pfVar10))->x * 0.8 + fVar13));
|
|
local_11c = GHIDRA_CAST<Entity_NPC *>((absDirY * 57.295776));
|
|
local_100 = GHIDRA_CAST<Entity_NPC *>(((this->_v1).x * 0.017453292));
|
|
local_fc = GHIDRA_CAST<Entity_NPC *>(sin((float)local_100));
|
|
local_100 = GHIDRA_CAST<Entity_NPC *>(cos((float)local_100));
|
|
uVar5 = Random();
|
|
fVar13 = approach_angle((this->_v1).x,(float)local_11c,
|
|
(float)((double)GHIDRA_INT(uVar5) +
|
|
__uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * 2.3283064e-10
|
|
* 3.0 + 0.5);
|
|
bVar4 = this->_collidesWithGrid;
|
|
absDirY = this->_speedMultiplier;
|
|
(this->_v1).x = fVar13;
|
|
(this->_velocity).x = (float)local_100 * 1.2 * absDirY + (this->_velocity).x;
|
|
(this->_velocity).y = (float)local_fc * 1.2 * absDirY + (this->_velocity).y;
|
|
if (bVar4 != 0) {
|
|
absDirY = (this->_gridCollisionNormal).y;
|
|
fVar13 = (this->_gridCollisionNormal).x;
|
|
dot = absDirY * (float)local_fc + fVar13 * (float)local_100;
|
|
absDirY = atan2f((float)local_fc - dot * (absDirY + absDirY),
|
|
(float)local_100 - dot * (fVar13 + fVar13));
|
|
(this->_v1).x = absDirY * 57.295776;
|
|
}
|
|
activeRoom = room;
|
|
}
|
|
else {
|
|
absDirY = local_104;
|
|
LAB_004ba6b2:
|
|
activeRoom = room;
|
|
if (local_130 == GHIDRA_CAST<Entity_NPC *>(0x0)) goto LAB_004ba7a3;
|
|
(GHIDRA_CAST<Room *>((room)))->Room::GetGridPosition(&scratchVec,GHIDRA_INT(absDirY));
|
|
if (isAtRailTarget == '\0') {
|
|
this->_entityGridCollisionClass = 5;
|
|
PathFinder::FindGridPath(GHIDRA_CAST<PathFinder *>(&this->_pathfinder),&scratchVec,1.08,0,1);
|
|
}
|
|
else {
|
|
this->_entityGridCollisionClass = 0;
|
|
vecPtr = NpcHelper::hornfel_get_rail_direction(local_130,&tmpVec);
|
|
absDirY = this->_speedMultiplier;
|
|
fVar13 = vecPtr->y;
|
|
(this->_velocity).x = -vecPtr->x * absDirY + (this->_velocity).x;
|
|
(this->_velocity).y = -fVar13 * absDirY + (this->_velocity).y;
|
|
NpcHelper::hornfel_set_anim(local_130,5);
|
|
iVar7 = (GHIDRA_CAST<Room *>((activeRoom)))->Room::GetGridIndex(&this->_pos);
|
|
if (iVar7 < 0) {
|
|
(GHIDRA_CAST<Room *>((activeRoom)))->Room::TriggerBossDeath(GHIDRA_CAST<Entity *>(this));
|
|
this->Remove();
|
|
}
|
|
}
|
|
}
|
|
bVar4 = (GHIDRA_CAST<Room *>((activeRoom)))->Room::IsPositionInRoom(&this->_pos,0.0);
|
|
if (bVar4 == 0) {
|
|
absDirY = (this->_pos).x;
|
|
fVar13 = (this->_pos).y;
|
|
local_11c = GHIDRA_CAST<Entity_NPC *>(((activeRoom->_topLeftPos).x - absDirY));
|
|
local_100 = GHIDRA_CAST<Entity_NPC *>((absDirY - (activeRoom->_bottomRightPos).x));
|
|
local_fc = GHIDRA_CAST<Entity_NPC *>(((activeRoom->_topLeftPos).y - fVar13));
|
|
local_108 = GHIDRA_CAST<Entity_NPC *>((fVar13 - (activeRoom->_bottomRightPos).y));
|
|
ppEVar6 = &local_100;
|
|
if ((float)local_100 <= (float)local_11c) {
|
|
ppEVar6 = &local_11c;
|
|
}
|
|
maxPtr = &local_fc;
|
|
if ((float)local_fc < (float)*ppEVar6 || (float)local_fc == (float)*ppEVar6) {
|
|
maxPtr = ppEVar6;
|
|
}
|
|
ppEVar6 = &local_108;
|
|
if ((float)local_108 < (float)*maxPtr || (float)local_108 == (float)*maxPtr) {
|
|
ppEVar6 = maxPtr;
|
|
}
|
|
absDirY = ((float)*ppEVar6 - 0.0) / 48.0;
|
|
if (absDirY <= 0.0) {
|
|
absDirY = 0.0;
|
|
}
|
|
if (1.0 <= absDirY) {
|
|
absDirY = 1.0;
|
|
}
|
|
(this->_sprite)._color._tint[3] = 1.0 - absDirY;
|
|
goto LAB_004baae3;
|
|
}
|
|
(this->_sprite)._color._tint[3] = 1.0;
|
|
puVar3 = puStack_20;
|
|
break;
|
|
case 6:
|
|
case 7:
|
|
this->_visible = 0;
|
|
this->_entityCollisionClass = 0;
|
|
puVar3 = local_50 + 0x4c;
|
|
if (this->_child == 0) {
|
|
timer = (short)this->_stateFrame;
|
|
if (timer == 0) {
|
|
puVar3 = local_50 + 0x4c;
|
|
if (*GHIDRA_CAST<short *>((GHIDRA_INT(&this->_stateFrame) + 2)) < 1) {
|
|
puStack_20 = local_50 + 0x4c;
|
|
NpcHelper::hornfel_minecart(this);
|
|
puVar3 = puStack_20;
|
|
}
|
|
}
|
|
else {
|
|
*GHIDRA_CAST<short *>(&this->_stateFrame) = timer + -1;
|
|
puVar3 = local_50 + 0x4c;
|
|
}
|
|
}
|
|
break;
|
|
case 8:
|
|
puStack_20 = local_50 + 0x4c;
|
|
bVar4 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::IsEventTriggered("Sound");
|
|
if (bVar4 != 0) {
|
|
PlaySound(this,0xc9,1.0,2,0,1.0);
|
|
}
|
|
bVar4 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::IsEventTriggered("Shoot");
|
|
if (bVar4 != 0) {
|
|
PlaySound(this,0x19,1.0,2,0,1.0);
|
|
tmpEntity = GetPlayerTarget(this);
|
|
local_fc = GHIDRA_CAST<Entity_NPC *>((tmpEntity->_pos).x);
|
|
local_108 = GHIDRA_CAST<Entity_NPC *>((tmpEntity->_pos).y);
|
|
local_104 = (tmpEntity->_velocity).x;
|
|
local_128 = (tmpEntity->_velocity).y;
|
|
uVar5 = Random();
|
|
absDirY = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) *
|
|
2.3283064e-10 * 0.20000002 + 0.1;
|
|
local_104 = local_104 * absDirY;
|
|
local_128 = local_128 * absDirY;
|
|
absDirY = (this->_pos).y - (tmpEntity->_pos).y;
|
|
fVar13 = (this->_pos).x - (tmpEntity->_pos).x;
|
|
absDirY = sqrtf(absDirY * absDirY + fVar13 * fVar13);
|
|
launchTarget.y = (float)local_108 + absDirY * local_128;
|
|
launchTarget.x = absDirY * local_104 + (float)local_fc;
|
|
vecPtr = Room::FindFreePickupSpawnPosition(room,&scratchVec,&launchTarget,0.0,0,0,0);
|
|
absDirY = (float)(this->_entityDeque)._offset;
|
|
launchTarget.x = vecPtr->x;
|
|
launchTarget.y = vecPtr->y;
|
|
uVar5 = (this->_entityDeque)._mapSize;
|
|
if (*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_entityDeque)._map) +
|
|
((this->_entityDeque)._mapSize - 1 & GHIDRA_UINT(absDirY) >> 2) * 4)) +
|
|
(GHIDRA_UINT(absDirY) & 3) * 4)) == 0) {
|
|
local_fc = GHIDRA_CAST<Entity_NPC *>((GHIDRA_INT(absDirY) + 1U >> 2));
|
|
uVar8 = GHIDRA_INT(absDirY) + 1U & 3;
|
|
scratchVec.y = absDirY;
|
|
if (*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_entityDeque)._map) + (uVar5 - 1 & GHIDRA_UINT(local_fc)) * 4)) +
|
|
uVar8 * 4)) != 0) {
|
|
NpcHelper::hornfel_launch_toward
|
|
(this,*(Entity **)
|
|
(*GHIDRA_CAST<int *>((GHIDRA_INT((this->_entityDeque)._map) +
|
|
((this->_entityDeque)._mapSize - 1 & GHIDRA_UINT(local_fc)) * 4)) +
|
|
uVar8 * 4),&launchTarget);
|
|
scratchVec.y = (float)(this->_entityDeque)._offset;
|
|
uVar5 = GHIDRA_INT(scratchVec.y) + 1;
|
|
goto LAB_004b9d9e;
|
|
}
|
|
}
|
|
else {
|
|
NpcHelper::hornfel_launch_toward
|
|
(this,*(Entity **)
|
|
(*GHIDRA_CAST<int *>((GHIDRA_INT((this->_entityDeque)._map) +
|
|
(uVar5 - 1 & GHIDRA_UINT(absDirY) >> 2) * 4)) + (GHIDRA_UINT(absDirY) & 3) * 4),
|
|
&launchTarget);
|
|
uVar5 = (this->_entityDeque)._offset;
|
|
LAB_004b9d9e:
|
|
iVar7 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_entityDeque)._map) +
|
|
((this->_entityDeque)._mapSize - 1 & uVar5 >> 2) * 4));
|
|
newMinecart = GHIDRA_CAST<Entity_NPC *>((iVar7 + (uVar5 & 3) * 4));
|
|
if (*GHIDRA_CAST<int *>((iVar7 + (uVar5 & 3) * 4)) != 0) {
|
|
local_fc = newMinecart;
|
|
msvc::multiset<unsigned_int>::erase(&local_fc);
|
|
}
|
|
*GHIDRA_CAST<uint32_t *>(newMinecart) = 0;
|
|
}
|
|
pcVar9 = GHIDRA_CAST<char *>((GHIDRA_INT(&this->_projectileDelay) + 2));
|
|
*pcVar9 = *pcVar9 + '\x01';
|
|
}
|
|
puVar3 = puStack_20;
|
|
if ((((((this->_sprite)._animState._animData == (void *)0x0) ||
|
|
((this->_sprite)._animState._isPlaying == 0)) &&
|
|
(this->_state = 3, *GHIDRA_CAST<char *>((GHIDRA_INT(&this->_projectileDelay) + 3)) != '\0')) &&
|
|
((*GHIDRA_CAST<char *>((GHIDRA_INT(&this->_projectileCooldown) + 3)) == '\0' &&
|
|
(uVar5 = Random(), puVar3 = puStack_20, uVar5 % 10 == 0)))) &&
|
|
(0.5 < this->_health / this->_maxHitPoints)) {
|
|
ANM2::Play(&this->_sprite,GHIDRA_CAST<uint8_t *>("Taunt"),0);
|
|
*GHIDRA_CAST<uint8_t *>((GHIDRA_INT(&this->_projectileCooldown) + 3)) = 0x96;
|
|
puVar3 = puStack_20;
|
|
}
|
|
break;
|
|
case 9:
|
|
puStack_20 = local_50 + 0x4c;
|
|
bVar4 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::IsEventTriggered("Shoot");
|
|
puVar3 = puStack_20;
|
|
if (bVar4 != 0) {
|
|
PlaySound(this,0x19,1.0,2,0,1.0);
|
|
local_130 = GHIDRA_CAST<Entity_NPC *>(0x0);
|
|
local_30 = GHIDRA_CAST<Entity_NPC *>(0x0);
|
|
local_2c = GHIDRA_CAST<Entity_NPC *>(0x0);
|
|
local_108 = GHIDRA_CAST<Entity_NPC *>(0x0);
|
|
local_28 = GHIDRA_CAST<Entity_NPC *>(0x0);
|
|
local_14 = 2;
|
|
local_fc = (Entity_NPC *)
|
|
((0x87 < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0x10)) * *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0xc)))
|
|
+ 3);
|
|
do {
|
|
newMinecart = local_2c;
|
|
launchTarget.y = 0.0;
|
|
launchTarget.x = 0.0;
|
|
if (local_130 == local_2c) {
|
|
vecPtr = (GHIDRA_CAST<Room *>((room)))->Room::GetRandomPosition(&randomPos,40.0);
|
|
launchTarget.x = vecPtr->x;
|
|
launchTarget.y = vecPtr->y;
|
|
}
|
|
else {
|
|
local_138 = -1e+30;
|
|
local_134 = 1.12104e-44;
|
|
do {
|
|
tmpEntity = local_130;
|
|
(GHIDRA_CAST<Room *>((room)))->Room::GetRandomPosition(&scratchVec,40.0);
|
|
spreadScore = 0.0;
|
|
do {
|
|
local_104 = scratchVec.y - *GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((tmpEntity)) + 0x4))));
|
|
local_128 = scratchVec.x - *GHIDRA_CAST<float *>(tmpEntity);
|
|
local_11c = GHIDRA_CAST<Entity_NPC *>(sqrtf(local_104 * local_104 + local_128 * local_128));
|
|
local_148.y = ABS(local_104);
|
|
local_148.x = ABS(local_128);
|
|
local_128 = local_148.x;
|
|
local_104 = local_148.y;
|
|
absDirY = sqrtf(local_148.y * local_148.y + local_148.x * local_148.x);
|
|
if (absDirY <= 0.0) {
|
|
fVar13 = local_128;
|
|
absDirY = local_104;
|
|
}
|
|
else {
|
|
local_148.x = local_128 * (1.0 / absDirY);
|
|
local_148.y = local_104 * (1.0 / absDirY);
|
|
fVar13 = local_148.x;
|
|
absDirY = local_148.y;
|
|
}
|
|
vecPtr = GHIDRA_CAST<Vector *>(&local_148.y);
|
|
if (fVar13 <= absDirY) {
|
|
vecPtr = &local_148;
|
|
}
|
|
tmpEntity = GHIDRA_CAST<Entity_NPC *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((tmpEntity)) + 0x8))));
|
|
spreadScore = vecPtr->x * (float)local_11c + spreadScore;
|
|
} while (tmpEntity != newMinecart);
|
|
if (local_138 < spreadScore) {
|
|
launchTarget.x = scratchVec.x;
|
|
launchTarget.y = scratchVec.y;
|
|
local_138 = spreadScore;
|
|
}
|
|
local_134 = (float)(GHIDRA_INT(local_134) + -1);
|
|
} while (local_134 != 0.0);
|
|
local_134 = 0.0;
|
|
this = local_100;
|
|
}
|
|
vecPtr = Room::FindFreePickupSpawnPosition(room,&tmpVec,&launchTarget,64.0,0,0,0);
|
|
launchTarget.x = vecPtr->x;
|
|
local_134 = vecPtr->y;
|
|
launchTarget.y = local_134;
|
|
local_11c = GHIDRA_CAST<Entity_NPC *>(launchTarget.x);
|
|
uVar5 = Random();
|
|
tmpEntity = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(4,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar5);
|
|
NpcHelper::hornfel_launch_toward(this,tmpEntity,&launchTarget);
|
|
tmpEntity->_entityCollisionClass = 1;
|
|
if (local_2c == local_108) {
|
|
msvc::vector<Vector>::_Emplace_reallocate(local_2c,&launchTarget);
|
|
local_108 = local_28;
|
|
local_130 = local_30;
|
|
}
|
|
else {
|
|
*GHIDRA_CAST<Entity_NPC **>(local_2c) = local_11c;
|
|
*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((local_2c)) + 0x4)))) = local_134;
|
|
local_2c = GHIDRA_CAST<Entity_NPC *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((local_2c)) + 0x8))));
|
|
}
|
|
local_fc = GHIDRA_CAST<Entity_NPC *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_fc[-1])) + 0xf5f))));
|
|
} while (local_fc != GHIDRA_CAST<Entity_NPC *>(0x0));
|
|
local_14 = 0xffffffff;
|
|
*GHIDRA_CAST<uint16_t *>((GHIDRA_INT(&this->_stateFrame) + 2)) = 0x7d;
|
|
puVar3 = puStack_20;
|
|
if (local_130 != GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
|
uVar5 = (GHIDRA_INT(local_108) - GHIDRA_INT(local_130) >> 3) * 8;
|
|
newMinecart = local_130;
|
|
if (0xfff < uVar5) {
|
|
newMinecart = *GHIDRA_CAST<Entity_NPC **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_130[-1])) + 0xf5c))));
|
|
uVar5 = uVar5 + 0x23;
|
|
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(local_130) + (-4 - GHIDRA_INT(newMinecart))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(newMinecart,uVar5);
|
|
puVar3 = puStack_20;
|
|
}
|
|
}
|
|
break;
|
|
case 10:
|
|
puStack_20 = local_50 + 0x4c;
|
|
NpcHelper::hornfel_charge(this);
|
|
local_fc = GHIDRA_CAST<Entity_NPC *>(0x41f00000);
|
|
local_108 = GHIDRA_CAST<Entity_NPC *>(((local_12c->_v2).x + 0.08));
|
|
ppEVar6 = &local_fc;
|
|
if ((float)local_108 <= 30.0) {
|
|
ppEVar6 = &local_108;
|
|
}
|
|
(local_12c->_v2).x = (float)*ppEVar6;
|
|
bVar4 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFrame(0xf,this->_index);
|
|
puVar3 = puStack_20;
|
|
if ((bVar4 != 0) &&
|
|
(bVar4 = (GHIDRA_CAST<Room *>((activeRoom)))->Room::IsPositionInRoom(&this->_pos,20.0), puVar3 = puStack_20, bVar4 != 0
|
|
)) {
|
|
vecPtr = MusicManager::RandomVector(&launchTarget);
|
|
uVar5 = Random();
|
|
absDirY = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) *
|
|
2.3283064e-10;
|
|
scratchVec.y = absDirY * vecPtr->y + (this->_pos).y;
|
|
scratchVec.x = absDirY * vecPtr->x + (this->_pos).x;
|
|
Room::FindFreePickupSpawnPosition(room,&local_148,&scratchVec,0.0,0,0,0);
|
|
uVar5 = Random();
|
|
vecPtr = &local_148;
|
|
tmpEntity = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(4,0,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar5);
|
|
NpcHelper::hornfel_launch_toward(this,tmpEntity,vecPtr);
|
|
puVar3 = puStack_20;
|
|
}
|
|
break;
|
|
case 0xb:
|
|
puStack_20 = local_50 + 0x4c;
|
|
ANM2::Play(&this->_sprite,GHIDRA_CAST<uint8_t *>("ChargeFinish"),0);
|
|
bVar4 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::IsEventTriggered("Shoot");
|
|
if (bVar4 != 0) {
|
|
(GHIDRA_CAST<ProjectileParams *>((&projectileParams)))->ProjectileParams::ProjectileParams();
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(projectileParams.BulletFlags)) + 0x4))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(projectileParams.BulletFlags)) + 0x4))) | 8;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_50)) + 0x0))) = 1.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_50)) + 0x4))) = 1.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_50)) + 0x8))) = 1.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_50)) + 0xc))) = 1.0;
|
|
projectileParams.Scale = 2.0;
|
|
local_30 = GHIDRA_CAST<Entity_NPC *>(0x3f800000);
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_50)) + 0x10))) = 0.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_50)) + 0x14))) = GHIDRA_CAST<char *>(0x0);
|
|
fStack_38 = 0.0;
|
|
fStack_34 = 0.0;
|
|
local_2c = GHIDRA_CAST<Entity_NPC *>(0x3e99999a);
|
|
local_28 = GHIDRA_CAST<Entity_NPC *>(0x0);
|
|
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(&projectileParams.Color))))->Color::operator_assign(GHIDRA_CAST<ColorMod *>(local_50));
|
|
tmpEntity = GetPlayerTarget(this);
|
|
local_108 = GHIDRA_CAST<Entity_NPC *>(((tmpEntity->_velocity).y * 0.1));
|
|
local_fc = GHIDRA_CAST<Entity_NPC *>(((tmpEntity->_velocity).x * 0.1));
|
|
fVar13 = (this->_pos).x - (tmpEntity->_pos).x;
|
|
absDirY = (this->_pos).y - (tmpEntity->_pos).y;
|
|
absDirY = sqrtf(absDirY * absDirY + fVar13 * fVar13);
|
|
scratchVec.x = (float)local_fc * absDirY + (tmpEntity->_pos).x;
|
|
scratchVec.y = (float)local_108 * absDirY + (tmpEntity->_pos).y;
|
|
projectile = FireBossProjectiles(this,1,&scratchVec,10.0,&projectileParams);
|
|
projectile->_scale = 2.0;
|
|
projectile->_fallingAccel = projectile->_fallingAccel - 0.6;
|
|
projectile->_fallingSpeed = projectile->_fallingSpeed * 0.7 - 3.0;
|
|
}
|
|
bVar4 = ANM2::WasEventTriggered(&this->_sprite,GHIDRA_CAST<uint8_t *>("Shoot"));
|
|
absDirY = (local_12c->_v2).x;
|
|
puVar3 = puStack_20;
|
|
if (bVar4 == 0) {
|
|
local_138 = absDirY - 0.75;
|
|
local_134 = 0.8;
|
|
pfVar10 = &local_134;
|
|
if (0.8 <= local_138) {
|
|
pfVar10 = &local_138;
|
|
}
|
|
(local_12c->_v2).x = *pfVar10;
|
|
}
|
|
else {
|
|
local_108 = GHIDRA_CAST<Entity_NPC *>((absDirY + 0.1));
|
|
local_fc = GHIDRA_CAST<Entity_NPC *>(0x3f99999a);
|
|
ppEVar6 = &local_fc;
|
|
if ((float)local_108 <= 1.2) {
|
|
ppEVar6 = &local_108;
|
|
}
|
|
(local_12c->_v2).x = (float)*ppEVar6;
|
|
}
|
|
break;
|
|
case 0xc:
|
|
puStack_20 = local_50 + 0x4c;
|
|
ANM2::Play(&this->_sprite,GHIDRA_CAST<uint8_t *>("Detonate"),0);
|
|
bVar4 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::IsEventTriggered("Sound");
|
|
if (bVar4 != 0) {
|
|
PlaySound(this,0xfc,1.0,2,0,1.0);
|
|
}
|
|
bVar4 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::IsEventTriggered("Shoot");
|
|
puVar3 = puStack_20;
|
|
if (bVar4 != 0) {
|
|
PlaySound(this,0x1d5,1.0,2,0,1.0);
|
|
puVar3 = puStack_20;
|
|
}
|
|
break;
|
|
case 0xd:
|
|
this->_friction = this->_friction * 0.6;
|
|
if (((this->_sprite)._animState._animData == (void *)0x0) ||
|
|
(puVar3 = local_50 + 0x4c, (this->_sprite)._animState._isPlaying == 0)) {
|
|
this->_state = 4;
|
|
*GHIDRA_CAST<uint16_t *>(&this->_projectileDelay) = 0x5a;
|
|
puStack_20 = local_50 + 0x4c;
|
|
tmpEntity = GetPlayerTarget(this);
|
|
absDirY = atan2f((this->_pos).y - (tmpEntity->_pos).y,(this->_pos).x - (tmpEntity->_pos).x);
|
|
(this->_v1).x = absDirY * 57.295776;
|
|
puVar3 = puStack_20;
|
|
}
|
|
break;
|
|
case 0x10:
|
|
ANM2::Play(&this->_sprite,GHIDRA_CAST<uint8_t *>("DecoyIdle"),0);
|
|
if (0.0 < this->_pendingDamage) {
|
|
if ((this->_pendingDamageFlags & 4) == 0) {
|
|
pfVar10 = *GHIDRA_CAST<float **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8))));
|
|
if (pfVar10 == *GHIDRA_CAST<float **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc))))) {
|
|
absDirY = this->_health;
|
|
}
|
|
else {
|
|
do {
|
|
if (10.0 < *pfVar10) {
|
|
uVar5 = Random();
|
|
if (uVar5 % 3 == 0) {
|
|
absDirY = 3.0;
|
|
}
|
|
else {
|
|
LAB_004b966e:
|
|
absDirY = 2.0;
|
|
}
|
|
LAB_004b9680:
|
|
absDirY = this->_health - absDirY;
|
|
this->_health = absDirY;
|
|
}
|
|
else {
|
|
if (0.0 < *pfVar10) {
|
|
uVar5 = Random();
|
|
if (uVar5 % 3 == 0) goto LAB_004b966e;
|
|
absDirY = 1.0;
|
|
goto LAB_004b9680;
|
|
}
|
|
absDirY = this->_health;
|
|
}
|
|
pfVar10 = pfVar10 + 0xe;
|
|
} while (pfVar10 != *GHIDRA_CAST<float **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc)))));
|
|
}
|
|
if (1.0 <= absDirY) {
|
|
if (absDirY < 1.5) {
|
|
this->_dead = 1;
|
|
}
|
|
}
|
|
else {
|
|
this->_health = 1.0;
|
|
this->_dead = 1;
|
|
}
|
|
}
|
|
else {
|
|
this->_health = 1.0;
|
|
this->_dead = 1;
|
|
}
|
|
}
|
|
goto LAB_004baae3;
|
|
}
|
|
puStack_20 = puVar3;
|
|
LAB_004baae3:
|
|
timer = *GHIDRA_CAST<short *>((GHIDRA_INT(&this->_stateFrame) + 2));
|
|
if (0 < timer) {
|
|
*GHIDRA_CAST<short *>((GHIDRA_INT(&this->_stateFrame) + 2)) = timer + -1;
|
|
}
|
|
pfVar10 = *GHIDRA_CAST<float **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8))));
|
|
if (pfVar10 != *GHIDRA_CAST<float **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc))))) {
|
|
do {
|
|
tmpVec.y = pfVar10[3];
|
|
if ((((((GHIDRA_UINT(pfVar10[2]) & 4) != 0) && (pfVar10[6] != 1.4013e-45)) &&
|
|
(pfVar10[4] != 1.4013e-45)) ||
|
|
(((GHIDRA_UINT(pfVar10[2]) & 8) != 0 && (pfVar10[4] == (float)this->_type)))) ||
|
|
((pfVar10[4] == 1.4013e-42 && ((pfVar10[5] == 2.05991e-43 && (pfVar10[6] != 1.4013e-45)))))
|
|
) {
|
|
this->_pendingDamage = this->_pendingDamage - *pfVar10;
|
|
*pfVar10 = 0.0;
|
|
}
|
|
pfVar10 = pfVar10 + 0xe;
|
|
} while (pfVar10 != *GHIDRA_CAST<float **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc)))));
|
|
}
|
|
if (this->_pendingDamage <= 0.0 && this->_pendingDamage != 0.0) {
|
|
this->_pendingDamage = 0.0;
|
|
}
|
|
iVar7 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::GetIntervalTicks(3.0,0.0);
|
|
if (iVar7 != 0) {
|
|
cVar2 = (char)this->_projectileCooldown;
|
|
if (cVar2 != '\0') {
|
|
*GHIDRA_CAST<char *>(&this->_projectileCooldown) = cVar2 + -1;
|
|
}
|
|
cVar2 = *GHIDRA_CAST<char *>((GHIDRA_INT(&this->_projectileCooldown) + 1));
|
|
if (cVar2 != '\0') {
|
|
*GHIDRA_CAST<char *>((GHIDRA_INT(&this->_projectileCooldown) + 1)) = cVar2 + -1;
|
|
}
|
|
cVar2 = *GHIDRA_CAST<char *>((GHIDRA_INT(&this->_projectileCooldown) + 2));
|
|
if (cVar2 != '\0') {
|
|
*GHIDRA_CAST<char *>((GHIDRA_INT(&this->_projectileCooldown) + 2)) = cVar2 + -1;
|
|
}
|
|
cVar2 = *GHIDRA_CAST<char *>((GHIDRA_INT(&this->_projectileCooldown) + 3));
|
|
if (cVar2 != '\0') {
|
|
*GHIDRA_CAST<char *>((GHIDRA_INT(&this->_projectileCooldown) + 3)) = cVar2 + -1;
|
|
}
|
|
}
|
|
if (this->_dead != 0) {
|
|
if (this->_variant == 1) {
|
|
uVar5 = Random();
|
|
vecPtr = &this->_pos;
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,1,vecPtr,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar5);
|
|
uVar5 = Random();
|
|
tmpEntity = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x12,vecPtr,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar5);
|
|
tmpEntity->Update();
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::BombDamage(vecPtr,110.0,75.0,0,GHIDRA_CAST<Entity *>(0x0),(BitSet128)ZEXT816(0),0x1004,0);
|
|
iVar7 = 6;
|
|
do {
|
|
uVar5 = Random();
|
|
absDirY = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) *
|
|
2.3283064e-10 * 3.14;
|
|
local_fc = GHIDRA_CAST<Entity_NPC *>((absDirY + absDirY));
|
|
uVar5 = Random();
|
|
local_108 = (Entity_NPC *)
|
|
((float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) *
|
|
2.3283064e-10 * 15.0 + 5.0);
|
|
scratchVec.x = cos((float)local_fc);
|
|
scratchVec.x = scratchVec.x * (float)local_108;
|
|
scratchVec.y = sin((float)local_fc);
|
|
scratchVec.y = scratchVec.y * (float)local_108;
|
|
uVar5 = Random();
|
|
tmpEntity = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(4,3,&this->_pos,&scratchVec,GHIDRA_CAST<Entity *>(this),0,uVar5);
|
|
tmpEntity->_entityCollisionClass = 1;
|
|
iVar7 = iVar7 + -1;
|
|
} while (iVar7 != 0);
|
|
}
|
|
else if ((local_12c != GHIDRA_CAST<Entity_NPC *>(0x0)) && (this->_visible != 0)) {
|
|
uVar5 = Random();
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,1,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar5);
|
|
if (this->_state == 8) {
|
|
uVar5 = (this->_entityDeque)._offset;
|
|
if (*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_entityDeque)._map) +
|
|
((this->_entityDeque)._mapSize - 1 & uVar5 >> 2) * 4)) + (uVar5 & 3) * 4
|
|
)) != 0) {
|
|
vecPtr = MusicManager::RandomVector(&tmpVec);
|
|
uVar8 = Random();
|
|
uVar5 = (this->_entityDeque)._offset;
|
|
absDirY = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) *
|
|
2.3283064e-10 * 10.0;
|
|
scratchVec.y = absDirY * vecPtr->y + (this->_pos).y;
|
|
scratchVec.x = absDirY * vecPtr->x + (this->_pos).x;
|
|
NpcHelper::hornfel_launch_toward
|
|
(this,*(Entity **)
|
|
(*GHIDRA_CAST<int *>((GHIDRA_INT((this->_entityDeque)._map) +
|
|
((this->_entityDeque)._mapSize - 1 & uVar5 >> 2) * 4)) +
|
|
(uVar5 & 3) * 4),&scratchVec);
|
|
uVar5 = (this->_entityDeque)._offset;
|
|
uVar8 = uVar5 & 3;
|
|
iVar7 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_entityDeque)._map) +
|
|
(uVar5 >> 2 & (this->_entityDeque)._mapSize - 1) * 4));
|
|
newMinecart = GHIDRA_CAST<Entity_NPC *>((iVar7 + uVar8 * 4));
|
|
if (*GHIDRA_CAST<int *>((iVar7 + uVar8 * 4)) != 0) {
|
|
local_100 = newMinecart;
|
|
msvc::multiset<unsigned_int>::erase(&local_100);
|
|
}
|
|
*GHIDRA_CAST<uint32_t *>(newMinecart) = 0;
|
|
}
|
|
tmpVec.y = (float)(this->_entityDeque)._offset;
|
|
if (*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_entityDeque)._map) +
|
|
(GHIDRA_INT(tmpVec.y) + 1U >> 2 & (this->_entityDeque)._mapSize - 1) * 4)) +
|
|
(GHIDRA_INT(tmpVec.y) + 1U & 3) * 4)) != 0) {
|
|
vecPtr = MusicManager::RandomVector(&tmpVec);
|
|
uVar8 = Random();
|
|
uVar5 = (this->_entityDeque)._offset + 1;
|
|
absDirY = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) *
|
|
2.3283064e-10 * 10.0;
|
|
scratchVec.y = absDirY * vecPtr->y + (this->_pos).y;
|
|
scratchVec.x = absDirY * vecPtr->x + (this->_pos).x;
|
|
NpcHelper::hornfel_launch_toward
|
|
(this,*(Entity **)
|
|
(*GHIDRA_CAST<int *>((GHIDRA_INT((this->_entityDeque)._map) +
|
|
(uVar5 >> 2 & (this->_entityDeque)._mapSize - 1) * 4)) +
|
|
(uVar5 & 3) * 4),&scratchVec);
|
|
uVar5 = (this->_entityDeque)._offset + 1;
|
|
uVar8 = uVar5 & 3;
|
|
iVar7 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_entityDeque)._map) +
|
|
(uVar5 >> 2 & (this->_entityDeque)._mapSize - 1) * 4));
|
|
newMinecart = GHIDRA_CAST<Entity_NPC *>((iVar7 + uVar8 * 4));
|
|
if (*GHIDRA_CAST<int *>((iVar7 + uVar8 * 4)) != 0) {
|
|
local_100 = newMinecart;
|
|
msvc::multiset<unsigned_int>::erase(&local_100);
|
|
}
|
|
*GHIDRA_CAST<uint32_t *>(newMinecart) = 0;
|
|
}
|
|
}
|
|
NpcHelper::minecart_break(local_12c);
|
|
this->_state = 0xd;
|
|
ANM2::Play(&this->_sprite,&DAT_00b1cdf8,0);
|
|
puVar1 = &this->_entityRef;
|
|
this->_entityGridCollisionClass = 5;
|
|
this->_dead = 0;
|
|
this->_health = 100.0;
|
|
if (*puVar1 != 0) {
|
|
local_100 = GHIDRA_CAST<Entity_NPC *>(puVar1);
|
|
msvc::multiset<unsigned_int>::erase(&local_100);
|
|
}
|
|
*puVar1 = 0;
|
|
this->_collisionDamage = 1.0;
|
|
(this->_sprite)._color._tint[3] = 1.0;
|
|
}
|
|
}
|
|
ExceptionList = local_1c;
|
|
return;
|
|
}
|
|
|
|
// 004bb0e0
|
|
void Entity_NPC::Hornfel_UpdateFrame()
|
|
{
|
|
Entity_NPC *minecart;
|
|
int row;
|
|
int column;
|
|
int gridHeight;
|
|
int gridWidth;
|
|
Entity_NPC *minecart;
|
|
|
|
minecart = GHIDRA_CAST<Entity_NPC *>(this->_minecart);
|
|
if ((this->_state == 10) && (GHIDRA_CAST<Entity_NPC *>(this->_entityRef) != GHIDRA_CAST<Entity_NPC *>(0x0))) {
|
|
NpcHelper::hornfel_set_anim(GHIDRA_CAST<Entity_NPC *>(this->_entityRef),10);
|
|
minecart = *GHIDRA_CAST<Entity_NPC **>((this->_entityRef + 0x3bc));
|
|
if (minecart != GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
|
NpcHelper::hornfel_set_anim(minecart,10);
|
|
}
|
|
}
|
|
if (minecart == GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
|
return;
|
|
}
|
|
if (this->_visible == 0) {
|
|
if (minecart->_state == 0) {
|
|
NpcAI::ENTITY_MINECART(minecart);
|
|
}
|
|
minecart->_state = 3;
|
|
(minecart->_pos).x = (this->_targetPosition).x;
|
|
(minecart->_pos).y = (this->_targetPosition).y;
|
|
(minecart->_velocity).x = g_vectorZero.x;
|
|
(minecart->_velocity).y = g_vectorZero.y;
|
|
return;
|
|
}
|
|
gridWidth = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0xc));
|
|
gridHeight = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0x10));
|
|
column = GHIDRA_INT((((minecart->_pos).x - 40.0) / 40.0 + 0.5));
|
|
row = GHIDRA_INT((((minecart->_pos).y - 120.0) / 40.0 + 0.5));
|
|
if (column < 1) {
|
|
LAB_004bb1a5:
|
|
if (column < 0) goto LAB_004bb1bb;
|
|
LAB_004bb1a9:
|
|
if (gridWidth + -1 < column) goto LAB_004bb1bb;
|
|
}
|
|
else {
|
|
if (gridWidth + -1 <= column) goto LAB_004bb1a9;
|
|
if (0 < row) {
|
|
if (row < gridHeight + -1) {
|
|
return;
|
|
}
|
|
goto LAB_004bb1a5;
|
|
}
|
|
}
|
|
if ((-1 < row) && (row <= gridHeight + -1)) {
|
|
return;
|
|
}
|
|
LAB_004bb1bb:
|
|
NpcHelper::hornfel_ride_minecart(this);
|
|
return;
|
|
}
|
|
|
|
// 004cde30
|
|
void Entity_NPC::update_physics()
|
|
{
|
|
float fVar1;
|
|
int *playerSlot;
|
|
void *pvVar2;
|
|
int iVar3;
|
|
Game *game;
|
|
int iVar4;
|
|
uint32_t uVar5;
|
|
PlayerManager *playerManager;
|
|
float savedFriction;
|
|
float savedPosY;
|
|
float savedVelX;
|
|
float savedVelY;
|
|
|
|
iVar4 = this->_child;
|
|
if (iVar4 == 0) {
|
|
this->_holdCountdown = 0;
|
|
}
|
|
else {
|
|
this->_holdCountdown = *GHIDRA_CAST<int *>((iVar4 + 0x3f0));
|
|
(this->_holdPosition).x = *GHIDRA_CAST<float *>((iVar4 + 0x3f4));
|
|
(this->_holdPosition).y = *GHIDRA_CAST<float *>((iVar4 + 0x3f8));
|
|
if (0 < this->_holdCountdown) goto LAB_004cde91;
|
|
}
|
|
apply_velocity(this,0);
|
|
update_move_direction_anim(this);
|
|
LAB_004cde91:
|
|
iVar4 = this->_child;
|
|
if (iVar4 != 0) {
|
|
*GHIDRA_CAST<float *>((iVar4 + 0x33c)) = (this->_pos).x;
|
|
*GHIDRA_CAST<float *>((iVar4 + 0x340)) = (this->_pos).y;
|
|
iVar4 = this->_child;
|
|
*GHIDRA_CAST<float *>((iVar4 + 0x360)) = (this->_velocity).x;
|
|
*GHIDRA_CAST<float *>((iVar4 + 0x364)) = (this->_velocity).y;
|
|
*GHIDRA_CAST<float *>((this->_child + 0x36c)) = this->_friction;
|
|
}
|
|
if (this->_variant == 10) {
|
|
uVar5 = 0;
|
|
playerManager = &g_game->_playerManager;
|
|
game = g_game;
|
|
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >>
|
|
2 != 0) {
|
|
do {
|
|
pvVar2 = (playerManager->_playerList)._end;
|
|
if (GHIDRA_INT(pvVar2) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("(GHIDRA_CAST<PlayerManager *>(()))->PlayerManager::GetPlayer() : There are no players! \n"));
|
|
pvVar2 = (playerManager->_playerList)._end;
|
|
game = g_game;
|
|
}
|
|
playerSlot = (playerManager->_playerList)._begin;
|
|
if (uVar5 < GHIDRA_UINT((GHIDRA_INT(pvVar2) - GHIDRA_INT(playerSlot) >> 2))) {
|
|
playerSlot = playerSlot + uVar5;
|
|
}
|
|
iVar4 = *playerSlot;
|
|
if (*GHIDRA_CAST<Entity_NPC **>((iVar4 + 0x3d4)) == this) {
|
|
fVar1 = (this->_pos).y;
|
|
*GHIDRA_CAST<float *>((iVar4 + 0x33c)) = *GHIDRA_CAST<float *>((iVar4 + 0x2088)) + (this->_pos).x;
|
|
*GHIDRA_CAST<float *>((iVar4 + 0x340)) = *GHIDRA_CAST<float *>((iVar4 + 0x208c)) + fVar1;
|
|
*GHIDRA_CAST<float *>((iVar4 + 0x360)) = (this->_velocity).x;
|
|
*GHIDRA_CAST<float *>((iVar4 + 0x364)) = (this->_velocity).y;
|
|
*GHIDRA_CAST<float *>((iVar4 + 0x36c)) = this->_friction;
|
|
}
|
|
playerManager = &game->_playerManager;
|
|
uVar5 = uVar5 + 1;
|
|
} while (uVar5 < GHIDRA_UINT((GHIDRA_INT((game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((playerManager->_playerList)._begin) >> 2)));
|
|
}
|
|
pvVar2 = game->_room;
|
|
iVar4 = GHIDRA_INT((((this->_pos).x - 40.0) / 40.0 + 0.5));
|
|
if ((((-1 < iVar4) && (iVar4 < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0xc)))) &&
|
|
(iVar3 = GHIDRA_INT((((this->_pos).y - 120.0) / 40.0 + 0.5)), -1 < iVar3)) &&
|
|
((iVar3 < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0x10)) &&
|
|
(uVar5 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + 0xc)) * iVar3 + iVar4, uVar5 < 0x1c0)))) {
|
|
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + uVar5 * 4 + 0x76c));
|
|
iVar3 = iVar4 % 1000;
|
|
if (iVar3 < 900) {
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar2) + uVar5 * 4 + 0x76c)) = (iVar4 - iVar3) + 900;
|
|
}
|
|
}
|
|
}
|
|
fVar1 = (this->_pos).x;
|
|
savedPosY = (this->_pos).y;
|
|
savedVelX = (this->_velocity).x;
|
|
savedVelY = (this->_velocity).y;
|
|
savedFriction = this->_friction;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::Update();
|
|
(this->_pos).x = fVar1;
|
|
(this->_pos).y = savedPosY;
|
|
(this->_velocity).x = savedVelX;
|
|
(this->_velocity).y = savedVelY;
|
|
this->_friction = savedFriction;
|
|
return;
|
|
}
|
|
|
|
// 004ce120
|
|
void Entity_NPC::apply_velocity(char param_2)
|
|
{
|
|
Vector *pos;
|
|
uint8_t bVar1;
|
|
GridEntity_Door *this_00;
|
|
int gridY;
|
|
uint32_t gridIdx;
|
|
uint32_t railType;
|
|
int gridX;
|
|
RailManager *this_01;
|
|
Game *game;
|
|
float fVar2;
|
|
float fVar3;
|
|
float fVar4;
|
|
Vector railDir;
|
|
Vector railPoint;
|
|
Vector railTangent;
|
|
float local_24;
|
|
float remainingSpeed;
|
|
float local_1c;
|
|
void *local_18;
|
|
float dirY;
|
|
float dirX;
|
|
uint8_t isRailReversed [5];
|
|
void *curRoom;
|
|
|
|
dirY = this->_friction * (this->_velocity).y;
|
|
dirX = this->_friction * (this->_velocity).x;
|
|
local_18 = g_game->_room;
|
|
if (param_2 == '\0') {
|
|
fVar2 = this->_baseFriction;
|
|
(this->_velocity).x = dirX;
|
|
(this->_velocity).y = dirY;
|
|
this->_friction = fVar2;
|
|
}
|
|
fVar2 = sqrtf(dirX * dirX + dirY * dirY);
|
|
if ((this->_variant == 10) && (this->_state == 4)) {
|
|
fVar2 = fVar2 + 0.5;
|
|
}
|
|
fVar4 = 40.0;
|
|
if (fVar2 <= 40.0) {
|
|
fVar4 = fVar2;
|
|
}
|
|
local_1c = fVar4;
|
|
if ((0.0 < DAT_00c7e848) && (local_1c = DAT_00c7e848, fVar4 <= DAT_00c7e848)) {
|
|
local_1c = fVar4;
|
|
}
|
|
if (param_2 != '\0') {
|
|
local_1c = local_1c * 0.5;
|
|
}
|
|
railDir.x = dirX;
|
|
railDir.y = dirY;
|
|
remainingSpeed = local_1c;
|
|
fVar2 = sqrtf(dirX * dirX + dirY * dirY);
|
|
if (0.0 < fVar2) {
|
|
railDir.x = dirX * (1.0 / fVar2);
|
|
railDir.y = dirY * (1.0 / fVar2);
|
|
dirY = railDir.y;
|
|
dirX = railDir.x;
|
|
}
|
|
fVar2 = (this->_pos).x;
|
|
pos = &this->_pos;
|
|
railPoint.y = 0.0;
|
|
railPoint.x = 0.0;
|
|
railTangent.y = 0.0;
|
|
railTangent.x = 0.0;
|
|
gridX = GHIDRA_INT(((fVar2 - 40.0) / 40.0 + 0.5));
|
|
if ((((-1 < gridX) && (gridX < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_18) + 0xc)))) &&
|
|
(gridY = GHIDRA_INT((((this->_pos).y - 120.0) / 40.0 + 0.5)), -1 < gridY)) &&
|
|
(gridY < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_18) + 0x10)))) {
|
|
gridIdx = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_18) + 0xc)) * gridY + gridX;
|
|
if ((gridIdx < 0x1c0) &&
|
|
(bVar1 = *GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(g_game->_room) + gridIdx + 0x746c)), bVar1 != 0xff)) {
|
|
this_01 = GHIDRA_CAST<RailManager *>((GHIDRA_INT(local_18) + 0x7468));
|
|
RailManager::get_closest_rail_point
|
|
(this_01,pos,&railDir,gridIdx,bVar1 & 0xf,&railPoint,&railTangent,&local_24,
|
|
&local_1c,isRailReversed);
|
|
game = g_game;
|
|
pos->x = railPoint.x;
|
|
(this->_pos).y = railPoint.y;
|
|
fVar2 = (railTangent.x * dirX + railTangent.y * dirY) * remainingSpeed;
|
|
remainingSpeed = fVar2;
|
|
if (0.0 < fVar2) {
|
|
do {
|
|
fVar4 = 3.0;
|
|
if (remainingSpeed <= 3.0) {
|
|
fVar4 = remainingSpeed;
|
|
}
|
|
remainingSpeed = remainingSpeed - fVar4;
|
|
fVar3 = dirX * fVar4 + pos->x;
|
|
fVar4 = dirY * fVar4 + (this->_pos).y;
|
|
pos->x = fVar3;
|
|
(this->_pos).y = fVar4;
|
|
gridX = GHIDRA_INT(((fVar3 - 40.0) / 40.0 + 0.5));
|
|
if (gridX < 0) {
|
|
LAB_004ce466:
|
|
gridIdx = 0xffffffff;
|
|
LAB_004ce469:
|
|
railType = 0xffffffff;
|
|
}
|
|
else {
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_18) + 0xc)) <= gridX) goto LAB_004ce466;
|
|
gridY = GHIDRA_INT(((fVar4 - 120.0) / 40.0 + 0.5));
|
|
if ((gridY < 0) || (game = g_game, *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_18) + 0x10)) <= gridY))
|
|
goto LAB_004ce466;
|
|
gridIdx = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_18) + 0xc)) * gridY + gridX;
|
|
if (0x1bf < gridIdx) goto LAB_004ce469;
|
|
bVar1 = *GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(g_game->_room) + gridIdx + 0x746c));
|
|
if (bVar1 == 0xff) {
|
|
railType = 0xffffffff;
|
|
}
|
|
else {
|
|
railType = bVar1 & 0xf;
|
|
}
|
|
}
|
|
if ((GHIDRA_INT(gridIdx) < 1) || (GHIDRA_INT(railType) < 0)) {
|
|
if (param_2 == '\0') {
|
|
this->_i2 = -1;
|
|
}
|
|
pos->x = dirX * remainingSpeed + pos->x;
|
|
(this->_pos).y = dirY * remainingSpeed + (this->_pos).y;
|
|
return;
|
|
}
|
|
if (param_2 == '\0') {
|
|
this->_i2 = gridIdx;
|
|
}
|
|
RailManager::get_closest_rail_point
|
|
(this_01,pos,&railDir,gridIdx,railType,&railPoint,&railTangent,&local_24,
|
|
&local_1c,isRailReversed);
|
|
if (isRailReversed[0] != 0) {
|
|
railTangent.x = railTangent.x * -1.0;
|
|
railTangent.y = railTangent.y * -1.0;
|
|
}
|
|
if ((railTangent.x == g_vectorZero.x) && (railTangent.y == g_vectorZero.y)) {
|
|
if (param_2 == '\0') {
|
|
this->_i2 = -1;
|
|
}
|
|
pos->x = dirX * remainingSpeed + pos->x;
|
|
goto LAB_004ce6ae;
|
|
}
|
|
pos->x = railPoint.x;
|
|
(this->_pos).y = railPoint.y;
|
|
railDir.x = railTangent.x;
|
|
railDir.y = railTangent.y;
|
|
dirY = railTangent.y;
|
|
dirX = railTangent.x;
|
|
if ((this->_variant == 10) && (this->_state == 4)) {
|
|
curRoom = game->_room;
|
|
gridX = GHIDRA_INT((((railTangent.x * 10.0 + pos->x) - 40.0) / 40.0 + 0.5));
|
|
if (((-1 < gridX) &&
|
|
((((gridX < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(curRoom) + 0xc)) &&
|
|
(gridY = GHIDRA_INT((((railTangent.y * 10.0 + railPoint.y) - 120.0) / 40.0 + 0.5)),
|
|
-1 < gridY)) && (gridY < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(curRoom) + 0x10)))) &&
|
|
((gridIdx = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(curRoom) + 0xc)) * gridY + gridX, gridIdx < 0x1c0 &&
|
|
(this_00 = *GHIDRA_CAST<GridEntity_Door **>((GHIDRA_CAST<char *>(curRoom) + gridIdx * 4 + 0x24)),
|
|
this_00 != GHIDRA_CAST<GridEntity_Door *>(0x0))))))) && (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this_00)) + 0x4)))) == 0x10))
|
|
{
|
|
(GHIDRA_CAST<GridEntity_Door *>((this_00)))->GridEntity_Door::Open();
|
|
(GHIDRA_CAST<GridEntity_Door *>((this_00)))->GridEntity_Door::TryBlowOpen(1,GHIDRA_CAST<Entity *>(0x0));
|
|
(GHIDRA_CAST<GridEntity_Door *>((this_00)))->GridEntity_Door::TryBlowOpen(1,GHIDRA_CAST<Entity *>(0x0));
|
|
}
|
|
game = g_game;
|
|
}
|
|
} while (0.0 < remainingSpeed);
|
|
}
|
|
if (param_2 == '\0') {
|
|
(this->_velocity).x = dirX * fVar2;
|
|
(this->_v1).x = dirX * fVar2;
|
|
(this->_velocity).y = dirY * fVar2;
|
|
(this->_v1).y = dirY * fVar2;
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
pos->x = dirX * local_1c + fVar2;
|
|
LAB_004ce6ae:
|
|
(this->_pos).y = dirY * remainingSpeed + (this->_pos).y;
|
|
return;
|
|
}
|
|
|
|
// 004ce6d0
|
|
void Entity_NPC::update_move_direction_anim()
|
|
{
|
|
uint8_t *anim;
|
|
uint8_t bVar1;
|
|
uint8_t *currentAnimChar;
|
|
uint32_t uVar2;
|
|
int directionDelta;
|
|
uint8_t *newAnimChar;
|
|
bool isLess;
|
|
float fVar3;
|
|
uint8_t *animData;
|
|
uint32_t currentDirection;
|
|
|
|
fVar3 = (this->_velocity).x;
|
|
if (((fVar3 != g_vectorZero.x) || ((this->_velocity).y != g_vectorZero.y)) &&
|
|
(this->_state != 0x10)) {
|
|
fVar3 = atan2f((this->_velocity).y,fVar3);
|
|
for (fVar3 = fVar3 * -57.295776; fVar3 < 0.0; fVar3 = fVar3 + 360.0) {
|
|
}
|
|
for (; 360.0 <= fVar3; fVar3 = fVar3 - 360.0) {
|
|
}
|
|
uVar2 = GHIDRA_INT(((fVar3 * 16.0) / 360.0 + 0.5)) & 0x80000007;
|
|
if (GHIDRA_INT(uVar2) < 0) {
|
|
uVar2 = (uVar2 - 1 | 0xfffffff8) + 1;
|
|
}
|
|
currentDirection = this->_i1;
|
|
if (currentDirection != uVar2) {
|
|
if (g_game->_frameCount - this->_spawnFrame < 2) {
|
|
this->_i1 = uVar2;
|
|
}
|
|
else {
|
|
directionDelta = uVar2 - currentDirection;
|
|
if (directionDelta < -4) {
|
|
directionDelta = directionDelta + (-directionDelta - 5U & 0xfffffff8) + 8;
|
|
}
|
|
if (3 < directionDelta) {
|
|
directionDelta = directionDelta + (directionDelta + 4U >> 3) * -8;
|
|
}
|
|
uVar2 = currentDirection + 7;
|
|
if (-1 < directionDelta) {
|
|
uVar2 = currentDirection + 1;
|
|
}
|
|
uVar2 = uVar2 & 0x80000007;
|
|
if (GHIDRA_INT(uVar2) < 0) {
|
|
uVar2 = (uVar2 - 1 | 0xfffffff8) + 1;
|
|
}
|
|
this->_i1 = uVar2;
|
|
}
|
|
}
|
|
}
|
|
anim = (&PTR_s_Move1_00b1ee78)[this->_i1];
|
|
if (this->_state == 0x10) {
|
|
bVar1 = ANM2::SetAnimation(&this->_sprite,anim,1);
|
|
if (((bVar1 != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) &&
|
|
(AnimationState::SetFrameFloat(&(this->_sprite)._animState,0.0),
|
|
(this->_sprite)._animState._animData != (void *)0x0)) {
|
|
(this->_sprite)._animState._isPlaying = 0;
|
|
return;
|
|
}
|
|
}
|
|
else {
|
|
animData = (this->_sprite)._animState._animData;
|
|
if (animData != GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
currentAnimChar = animData;
|
|
if (0xf < *GHIDRA_CAST<uint32_t *>((animData + 0x14))) {
|
|
currentAnimChar = *GHIDRA_CAST<uint8_t **>(animData);
|
|
}
|
|
newAnimChar = anim;
|
|
do {
|
|
bVar1 = *currentAnimChar;
|
|
isLess = bVar1 < *newAnimChar;
|
|
if (bVar1 != *newAnimChar) {
|
|
LAB_004ce860:
|
|
uVar2 = -GHIDRA_UINT(isLess) | 1;
|
|
goto LAB_004ce865;
|
|
}
|
|
if (bVar1 == 0) break;
|
|
bVar1 = currentAnimChar[1];
|
|
isLess = bVar1 < newAnimChar[1];
|
|
if (bVar1 != newAnimChar[1]) goto LAB_004ce860;
|
|
currentAnimChar = currentAnimChar + 2;
|
|
newAnimChar = newAnimChar + 2;
|
|
} while (bVar1 != 0);
|
|
uVar2 = 0;
|
|
LAB_004ce865:
|
|
if (uVar2 == 0) {
|
|
if (animData[0x34] == 0) {
|
|
return;
|
|
}
|
|
if ((this->_sprite)._animState._isPlaying != 0) {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
bVar1 = ANM2::SetAnimation(&this->_sprite,anim,1);
|
|
if (bVar1 != 0) {
|
|
AnimationState::Rewind(&(this->_sprite)._animState);
|
|
(this->_sprite)._animState._isPlaying = 1;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 004cf030
|
|
void Entity_NPC::SetMinecartPosVel(Vector *pos, Vector *vel)
|
|
{
|
|
int gridY;
|
|
int roomWidth;
|
|
int roomWidth;
|
|
|
|
(this->_pos).x = pos->x;
|
|
(this->_pos).y = pos->y;
|
|
roomWidth = GHIDRA_INT(((pos->x - 40.0) / 40.0 + 0.5));
|
|
if ((((roomWidth < 0) || (roomWidth = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0xc)), roomWidth <= roomWidth)) ||
|
|
(gridY = GHIDRA_INT(((pos->y - 120.0) / 40.0 + 0.5)), gridY < 0)) ||
|
|
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0x10)) <= gridY)) {
|
|
roomWidth = -1;
|
|
}
|
|
else {
|
|
roomWidth = roomWidth * gridY + roomWidth;
|
|
}
|
|
this->_i2 = roomWidth;
|
|
(this->_velocity).x = vel->x;
|
|
(this->_velocity).y = vel->y;
|
|
(this->_v1).x = vel->x;
|
|
(this->_v1).y = vel->y;
|
|
this->_spawnGridIndex = roomWidth;
|
|
return;
|
|
}
|
|
|
|
// 004cf120
|
|
void Entity_NPC::MinecartUpdateChild(Entity *child)
|
|
{
|
|
Entity_NPC *newChild;
|
|
int oldRef;
|
|
uint32_t *refSlot;
|
|
Entity_NPC *local_8;
|
|
Entity *newChild;
|
|
|
|
oldRef = this->_child;
|
|
refSlot = &this->_child;
|
|
local_8 = this;
|
|
if (oldRef != 0) {
|
|
if (*GHIDRA_CAST<int *>((oldRef + 0x3d4)) != 0) {
|
|
local_8 = GHIDRA_CAST<Entity_NPC *>((oldRef + 0x3d4));
|
|
msvc::multiset<unsigned_int>::erase(&local_8);
|
|
*GHIDRA_CAST<uint32_t *>((oldRef + 0x3d4)) = 0;
|
|
oldRef = *refSlot;
|
|
}
|
|
if (oldRef != 0) {
|
|
local_8 = GHIDRA_CAST<Entity_NPC *>(refSlot);
|
|
msvc::multiset<unsigned_int>::erase(&local_8);
|
|
}
|
|
}
|
|
newChild = child;
|
|
*refSlot = child;
|
|
if (child != GHIDRA_CAST<Entity *>(0x0)) {
|
|
msvc::multiset<unsigned_int>::insert(refSlot);
|
|
}
|
|
newChild = GHIDRA_CAST<Entity_NPC *>(newChild->_minecart);
|
|
refSlot = &newChild->_minecart;
|
|
if (newChild != this) {
|
|
if (newChild != GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
|
child = GHIDRA_CAST<Entity *>(refSlot);
|
|
msvc::multiset<unsigned_int>::erase(&child);
|
|
}
|
|
*refSlot = this;
|
|
msvc::multiset<unsigned_int>::insert(refSlot);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 004e8fa0
|
|
void Entity_NPC::UpdateCordChain(uint8_t isHalfScale)
|
|
{
|
|
float fVar1;
|
|
float fVar2;
|
|
float fVar3;
|
|
float fVar4;
|
|
float fVar5;
|
|
float fVar6;
|
|
int iVar7;
|
|
int iVar8;
|
|
int iVar9;
|
|
int iVar10;
|
|
int iVar11;
|
|
uint32_t nextPointIdx;
|
|
uint32_t uVar12;
|
|
uint32_t nextPointIdx;
|
|
uint32_t uVar14;
|
|
int iVar15;
|
|
uint32_t uVar16;
|
|
uint32_t uVar17;
|
|
uint32_t uVar18;
|
|
uint32_t uVar19;
|
|
uint32_t uVar20;
|
|
uint32_t uVar21;
|
|
uint32_t uVar22;
|
|
float segmentLength;
|
|
float fVar23;
|
|
float fVar24;
|
|
float segmentLength;
|
|
float fVar26;
|
|
float fVar27;
|
|
float lerpInvT;
|
|
float lerpT;
|
|
float forceY;
|
|
float forceX;
|
|
float forceZ;
|
|
float stepScale;
|
|
uint32_t pointCount;
|
|
uint32_t pointIdx;
|
|
void *pointMap;
|
|
|
|
if (isHalfScale == 0) {
|
|
stepScale = 1.0;
|
|
}
|
|
else {
|
|
stepScale = 0.5;
|
|
}
|
|
if (this->_type == 0x3b6) {
|
|
segmentLength = 16.0;
|
|
}
|
|
else if (this->_type == 0x361) {
|
|
segmentLength = this->_aiFloat;
|
|
}
|
|
else {
|
|
segmentLength = ((this->_v1).x + 1.0) * 10.0;
|
|
}
|
|
pointCount = (this->_vectorDeque1)._size;
|
|
if ((this->_vectorDeque2)._size < pointCount) {
|
|
msvc::deque<int>::resize(pointCount);
|
|
pointCount = (this->_vectorDeque1)._size;
|
|
}
|
|
pointIdx = 0;
|
|
if (pointCount != 0) {
|
|
uVar17 = pointCount;
|
|
do {
|
|
uVar14 = (this->_vectorDeque1)._offset;
|
|
forceX = 0.0;
|
|
forceY = 0.0;
|
|
forceZ = 0.4;
|
|
if (pointIdx != 0) {
|
|
nextPointIdx = (pointIdx - 1) + uVar14;
|
|
uVar17 = pointIdx + 2 + uVar14;
|
|
uVar21 = uVar14 + pointIdx & 1;
|
|
iVar7 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar14 + pointIdx >> 1) * 4));
|
|
uVar12 = uVar14 + (pointIdx - 3);
|
|
nextPointIdx = uVar12 & 1;
|
|
iVar15 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar12 >> 1) * 4));
|
|
fVar24 = *GHIDRA_CAST<float *>((iVar7 + 4 + uVar21 * 8)) - *GHIDRA_CAST<float *>((iVar15 + 4 + nextPointIdx * 8));
|
|
fVar27 = *GHIDRA_CAST<float *>((iVar7 + uVar21 * 8)) - *GHIDRA_CAST<float *>((iVar15 + nextPointIdx * 8));
|
|
uVar21 = uVar17 & 1;
|
|
uVar17 = uVar17 >> 1;
|
|
pointMap = (this->_vectorDeque1)._map;
|
|
uVar18 = nextPointIdx >> 1;
|
|
nextPointIdx = nextPointIdx & 1;
|
|
segmentLength = *GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT(pointMap) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar17) * 4)) + uVar21 * 8))
|
|
- *GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT(pointMap) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar18) * 4)) +
|
|
nextPointIdx * 8));
|
|
fVar23 = sqrtf(fVar24 * fVar24 + fVar27 * fVar27 + segmentLength * segmentLength);
|
|
fVar26 = fVar23 - segmentLength;
|
|
uVar12 = pointIdx + uVar14 + 1;
|
|
uVar22 = uVar12 & 1;
|
|
iVar7 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar12 >> 1) * 4));
|
|
uVar12 = pointIdx + (uVar14 - 2);
|
|
nextPointIdx = uVar12 & 1;
|
|
iVar15 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar12 >> 1) * 4));
|
|
pointMap = (this->_vectorDeque1)._map;
|
|
forceX = (0.0 - (fVar27 / fVar23) * fVar26 * 0.3) -
|
|
(*GHIDRA_CAST<float *>((iVar7 + uVar22 * 8)) - *GHIDRA_CAST<float *>((iVar15 + nextPointIdx * 8))) * 0.3;
|
|
forceY = (0.0 - (fVar24 / fVar23) * fVar26 * 0.3) -
|
|
(*GHIDRA_CAST<float *>((iVar7 + 4 + uVar22 * 8)) - *GHIDRA_CAST<float *>((iVar15 + 4 + nextPointIdx * 8))) * 0.3;
|
|
forceZ = (0.4 - (segmentLength / fVar23) * fVar26 * 0.3) -
|
|
(*GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT(pointMap) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar17) * 4)) + 4 +
|
|
uVar21 * 8)) -
|
|
*GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT(pointMap) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar18) * 4)) + 4 +
|
|
nextPointIdx * 8))) * 0.3;
|
|
uVar17 = pointCount;
|
|
}
|
|
nextPointIdx = pointIdx + 3;
|
|
if (nextPointIdx < uVar17) {
|
|
uVar12 = pointIdx + 5 + uVar14;
|
|
uVar17 = pointIdx + 2 + uVar14;
|
|
uVar18 = uVar14 + pointIdx & 1;
|
|
iVar7 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
(uVar14 + pointIdx >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4));
|
|
nextPointIdx = uVar14 + pointIdx + 3;
|
|
uVar21 = nextPointIdx & 1;
|
|
iVar15 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
(nextPointIdx >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4));
|
|
fVar24 = *GHIDRA_CAST<float *>((iVar7 + uVar18 * 8)) - *GHIDRA_CAST<float *>((iVar15 + uVar21 * 8));
|
|
fVar27 = *GHIDRA_CAST<float *>((iVar7 + 4 + uVar18 * 8)) - *GHIDRA_CAST<float *>((iVar15 + 4 + uVar21 * 8));
|
|
uVar21 = uVar17 & 1;
|
|
uVar17 = uVar17 >> 1;
|
|
pointMap = (this->_vectorDeque1)._map;
|
|
uVar18 = uVar12 >> 1;
|
|
uVar12 = uVar12 & 1;
|
|
segmentLength = *GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT(pointMap) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar17) * 4)) + uVar21 * 8))
|
|
- *GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT(pointMap) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar18) * 4)) +
|
|
uVar12 * 8));
|
|
fVar23 = sqrtf(fVar24 * fVar24 + fVar27 * fVar27 + segmentLength * segmentLength);
|
|
fVar26 = fVar23 - segmentLength;
|
|
nextPointIdx = pointIdx + uVar14 + 1;
|
|
uVar22 = nextPointIdx & 1;
|
|
iVar7 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
((this->_vectorDeque1)._mapSize - 1 & nextPointIdx >> 1) * 4));
|
|
uVar14 = pointIdx + uVar14 + 4;
|
|
nextPointIdx = uVar14 & 1;
|
|
iVar15 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
(uVar14 >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4));
|
|
pointMap = (this->_vectorDeque1)._map;
|
|
forceX = (forceX - (fVar24 / fVar23) * fVar26 * 0.3) -
|
|
(*GHIDRA_CAST<float *>((iVar7 + uVar22 * 8)) - *GHIDRA_CAST<float *>((iVar15 + nextPointIdx * 8))) * 0.3;
|
|
forceY = (forceY - (fVar27 / fVar23) * fVar26 * 0.3) -
|
|
(*GHIDRA_CAST<float *>((iVar7 + 4 + uVar22 * 8)) - *GHIDRA_CAST<float *>((iVar15 + 4 + nextPointIdx * 8))) * 0.3;
|
|
forceZ = (forceZ - (segmentLength / fVar23) * fVar26 * 0.3) -
|
|
(*GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT(pointMap) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar17) * 4)) + 4 +
|
|
uVar21 * 8)) -
|
|
*GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT(pointMap) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar18) * 4)) + 4 +
|
|
uVar12 * 8))) * 0.3;
|
|
}
|
|
uVar14 = (this->_vectorDeque1)._offset;
|
|
uVar17 = uVar14 + pointIdx;
|
|
nextPointIdx = uVar17 & 1;
|
|
iVar7 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
(uVar17 >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4));
|
|
uVar14 = uVar14 + pointIdx + 1;
|
|
uVar12 = uVar14 & 1;
|
|
iVar15 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar14 >> 1) * 4));
|
|
fVar23 = *GHIDRA_CAST<float *>((iVar15 + 4 + uVar12 * 8));
|
|
fVar24 = *GHIDRA_CAST<float *>((iVar7 + 4 + nextPointIdx * 8));
|
|
uVar17 = (this->_vectorDeque2)._offset + pointIdx;
|
|
uVar14 = uVar17 & 1;
|
|
iVar8 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque2)._map) +
|
|
((this->_vectorDeque2)._mapSize - 1 & uVar17 >> 1) * 4));
|
|
*GHIDRA_CAST<float *>((iVar8 + uVar14 * 8)) =
|
|
stepScale * *GHIDRA_CAST<float *>((iVar15 + uVar12 * 8)) + *GHIDRA_CAST<float *>((iVar7 + nextPointIdx * 8));
|
|
*GHIDRA_CAST<float *>((iVar8 + 4 + uVar14 * 8)) = stepScale * fVar23 + fVar24;
|
|
uVar17 = pointIdx + 1 + (this->_vectorDeque1)._offset;
|
|
uVar14 = uVar17 & 1;
|
|
iVar7 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar17 >> 1) * 4));
|
|
fVar23 = *GHIDRA_CAST<float *>((iVar7 + 4 + uVar14 * 8));
|
|
uVar17 = pointIdx + 1 + (this->_vectorDeque2)._offset;
|
|
uVar12 = uVar17 & 1;
|
|
iVar15 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque2)._map) +
|
|
(uVar17 >> 1 & (this->_vectorDeque2)._mapSize - 1) * 4));
|
|
*GHIDRA_CAST<float *>((iVar15 + uVar12 * 8)) = (forceX * stepScale + *GHIDRA_CAST<float *>((iVar7 + uVar14 * 8))) * 0.95
|
|
;
|
|
*GHIDRA_CAST<float *>((iVar15 + 4 + uVar12 * 8)) = (forceY * stepScale + fVar23) * 0.95;
|
|
uVar17 = pointIdx + 2 + (this->_vectorDeque1)._offset;
|
|
uVar12 = uVar17 & 1;
|
|
uVar14 = pointIdx + 2 + (this->_vectorDeque2)._offset;
|
|
uVar17 = uVar17 >> 1;
|
|
*GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque2)._map) +
|
|
((this->_vectorDeque2)._mapSize - 1 & uVar14 >> 1) * 4)) + (uVar14 & 1) * 8))
|
|
= stepScale *
|
|
*GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar17) * 4)) + 4 + uVar12 * 8))
|
|
+ *GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar17) * 4)) + uVar12 * 8));
|
|
uVar17 = pointIdx + 2 + (this->_vectorDeque1)._offset;
|
|
uVar14 = pointIdx + 2 + (this->_vectorDeque2)._offset;
|
|
*GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque2)._map) +
|
|
(uVar14 >> 1 & (this->_vectorDeque2)._mapSize - 1) * 4)) + 4 +
|
|
(uVar14 & 1) * 8)) =
|
|
(forceZ * stepScale +
|
|
*GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
(uVar17 >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)) + 4 +
|
|
(uVar17 & 1) * 8))) * 0.95;
|
|
uVar17 = pointIdx + 2 + (this->_vectorDeque2)._offset;
|
|
uVar14 = uVar17 & 1;
|
|
uVar17 = uVar17 >> 1;
|
|
if (0.0 < *GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque2)._map) +
|
|
((this->_vectorDeque2)._mapSize - 1 & uVar17) * 4)) + uVar14 * 8)))
|
|
{
|
|
*(uint32_t *)
|
|
(*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque2)._map) +
|
|
((this->_vectorDeque2)._mapSize - 1 & uVar17) * 4)) + uVar14 * 8) = 0;
|
|
uVar17 = pointIdx + 2 + (this->_vectorDeque2)._offset;
|
|
*(uint32_t *)
|
|
(*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque2)._map) +
|
|
(uVar17 >> 1 & (this->_vectorDeque2)._mapSize - 1) * 4)) + 4 + (uVar17 & 1) * 8) =
|
|
0;
|
|
uVar17 = pointIdx + 1 + (this->_vectorDeque2)._offset;
|
|
uVar14 = uVar17 & 1;
|
|
iVar7 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque2)._map) +
|
|
(uVar17 >> 1 & (this->_vectorDeque2)._mapSize - 1) * 4));
|
|
*GHIDRA_CAST<float *>((iVar7 + uVar14 * 8)) = *GHIDRA_CAST<float *>((iVar7 + uVar14 * 8)) * 0.85;
|
|
*GHIDRA_CAST<float *>((iVar7 + 4 + uVar14 * 8)) = *GHIDRA_CAST<float *>((iVar7 + 4 + uVar14 * 8)) * 0.85;
|
|
}
|
|
uVar17 = (this->_vectorDeque1)._offset;
|
|
pointCount = (this->_vectorDeque1)._size;
|
|
uVar14 = uVar17 + (pointCount - 3);
|
|
iVar7 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
(uVar17 >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4));
|
|
uVar12 = uVar14 & 1;
|
|
iVar15 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
(uVar14 >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4));
|
|
fVar23 = *GHIDRA_CAST<float *>((iVar15 + 4 + uVar12 * 8)) - *GHIDRA_CAST<float *>((iVar7 + 4 + (uVar17 & 1) * 8));
|
|
fVar24 = *GHIDRA_CAST<float *>((iVar15 + uVar12 * 8)) - *GHIDRA_CAST<float *>((iVar7 + (uVar17 & 1) * 8));
|
|
fVar23 = sqrtf(fVar23 * fVar23 + fVar24 * fVar24);
|
|
fVar23 = (fVar23 - 90.0) / 110.0;
|
|
if (fVar23 <= 0.0) {
|
|
fVar23 = 0.0;
|
|
}
|
|
if (1.0 <= fVar23) {
|
|
fVar23 = 1.0;
|
|
}
|
|
fVar23 = fVar23 + 0.0;
|
|
if (fVar23 <= 0.0) {
|
|
uVar17 = (this->_vectorDeque1)._size;
|
|
}
|
|
else {
|
|
uVar17 = (this->_vectorDeque1)._offset;
|
|
iVar15 = (this->_vectorDeque1)._size / 3 - 1;
|
|
iVar7 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
(uVar17 >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4));
|
|
uVar14 = (this->_vectorDeque1)._size;
|
|
lerpT = ((float)(pointIdx / 3) + 0.0) /
|
|
(float)((double)iVar15 + __uint_to_double_fixup[-(iVar15 >> 0x1f)]);
|
|
lerpInvT = 1.0 - lerpT;
|
|
fVar24 = *GHIDRA_CAST<float *>((iVar7 + 4 + (uVar17 & 1) * 8));
|
|
uVar12 = (uVar14 - 3) + uVar17;
|
|
uVar14 = (uVar17 - 1) + uVar14;
|
|
uVar21 = uVar12 & 1;
|
|
iVar15 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar12 >> 1) * 4));
|
|
segmentLength = *GHIDRA_CAST<float *>((iVar15 + 4 + uVar21 * 8));
|
|
uVar19 = pointIdx + 2 + uVar17;
|
|
uVar18 = uVar17 + pointIdx & 1;
|
|
iVar8 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
(uVar17 + pointIdx >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4));
|
|
nextPointIdx = uVar19 >> 1;
|
|
uVar19 = uVar19 & 1;
|
|
fVar26 = *GHIDRA_CAST<float *>((iVar8 + 4 + uVar18 * 8));
|
|
uVar12 = pointIdx + 1 + uVar17;
|
|
uVar22 = uVar12 & 1;
|
|
iVar9 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar12 >> 1) * 4));
|
|
fVar27 = *GHIDRA_CAST<float *>((iVar9 + 4 + uVar22 * 8));
|
|
uVar12 = (this->_vectorDeque2)._offset;
|
|
uVar20 = pointIdx + 2 + uVar12;
|
|
uVar12 = pointIdx + 1 + uVar12;
|
|
uVar16 = uVar12 >> 1;
|
|
uVar12 = uVar12 & 1;
|
|
iVar10 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque2)._map) +
|
|
((this->_vectorDeque2)._mapSize - 1 & uVar16) * 4));
|
|
fVar1 = *GHIDRA_CAST<float *>((iVar10 + 4 + uVar12 * 8));
|
|
fVar2 = *GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
(uVar14 >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)) +
|
|
(uVar14 & 1) * 8));
|
|
fVar3 = *GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
((this->_vectorDeque1)._mapSize - 1 & uVar17 + 2 >> 1) * 4)) +
|
|
(uVar17 + 2 & 1) * 8));
|
|
fVar4 = *GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
((this->_vectorDeque1)._mapSize - 1 & nextPointIdx) * 4)) + uVar19 * 8));
|
|
fVar5 = *GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
((this->_vectorDeque1)._mapSize - 1 & nextPointIdx) * 4)) + 4 +
|
|
uVar19 * 8));
|
|
fVar6 = *GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque2)._map) +
|
|
((this->_vectorDeque2)._mapSize - 1 & uVar20 >> 1) * 4)) + 4 +
|
|
(uVar20 & 1) * 8));
|
|
iVar11 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque2)._map) +
|
|
((this->_vectorDeque2)._mapSize - 1 & uVar16) * 4));
|
|
*GHIDRA_CAST<float *>((iVar11 + uVar12 * 8)) =
|
|
*GHIDRA_CAST<float *>((iVar10 + uVar12 * 8)) +
|
|
(((lerpInvT * *GHIDRA_CAST<float *>((iVar7 + (uVar17 & 1) * 8)) +
|
|
lerpT * *GHIDRA_CAST<float *>((iVar15 + uVar21 * 8))) - *GHIDRA_CAST<float *>((iVar8 + uVar18 * 8))) * 0.8 -
|
|
*GHIDRA_CAST<float *>((iVar9 + uVar22 * 8)) * 0.8) * fVar23 * stepScale;
|
|
*GHIDRA_CAST<float *>((iVar11 + 4 + uVar12 * 8)) =
|
|
fVar1 + (((lerpInvT * fVar24 + lerpT * segmentLength) - fVar26) * 0.8 - fVar27 * 0.8) * fVar23
|
|
* stepScale;
|
|
uVar17 = pointIdx + 2 + (this->_vectorDeque2)._offset;
|
|
*GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque2)._map) +
|
|
((this->_vectorDeque2)._mapSize - 1 & uVar17 >> 1) * 4)) + 4 +
|
|
(uVar17 & 1) * 8)) =
|
|
(((lerpT * fVar2 + lerpInvT * fVar3) - fVar4) * 0.8 - fVar5 * 0.8) * fVar23 * stepScale
|
|
+ fVar6;
|
|
uVar17 = (this->_vectorDeque1)._size;
|
|
pointCount = uVar17;
|
|
}
|
|
pointIdx = nextPointIdx;
|
|
} while (nextPointIdx < uVar17);
|
|
}
|
|
if (isHalfScale == 0) {
|
|
msvc::deque<Vector>::assign(&this->_vectorDeque2);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 004e9b10
|
|
void Entity_NPC::render_overlay(Vector *offset, uint8_t isShadow)
|
|
{
|
|
void *pvVar1;
|
|
Color *extraout_EAX;
|
|
Color *baseColor;
|
|
float *pfVar2;
|
|
ColorMod *color;
|
|
uint8_t extraout_DL;
|
|
uint8_t isShadowTint;
|
|
uint32_t dequeSlot;
|
|
uint32_t uVar3;
|
|
int layerId;
|
|
uint32_t i;
|
|
int iVar4;
|
|
float fVar5;
|
|
float dx;
|
|
double dVar6;
|
|
uint8_t auStack_134 [16];
|
|
float local_124;
|
|
uint8_t isUseOverlay;
|
|
float totalLength;
|
|
float trailPointX;
|
|
float trailPointY;
|
|
float trailPointLength;
|
|
float local_10c;
|
|
float local_108;
|
|
float cordLength;
|
|
int beamLayerId;
|
|
float local_fc;
|
|
float pointX;
|
|
float baseOffset [2];
|
|
float baseTintR;
|
|
float baseTintG;
|
|
float baseTintB;
|
|
float baseTintA;
|
|
float baseColorizeR;
|
|
float baseColorizeG;
|
|
float baseColorizeB;
|
|
float baseColorizeA;
|
|
Color tmpColor;
|
|
ColorMod headColor;
|
|
ColorMod cordColor;
|
|
uint32_t local_44;
|
|
float *pointsEnd;
|
|
|
|
local_44 = __security_cookie ^ GHIDRA_UINT(auStack_134);
|
|
if ((this->_vectorDeque2)._size != 0) {
|
|
cordLength = 192.0;
|
|
layerId = 2;
|
|
iVar4 = this->_type;
|
|
beamLayerId = 2;
|
|
isUseOverlay = 1;
|
|
if (iVar4 == 0x3b6) {
|
|
if ((this->_sprite)._animState._animData == (void *)0x0) {
|
|
return;
|
|
}
|
|
pvVar1 = AnimationState::GetNullFrame(&(this->_sprite)._animState,GHIDRA_CAST<uint8_t *>("CordPos"));
|
|
if (pvVar1 == (void *)0x0) {
|
|
return;
|
|
}
|
|
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(pvVar1) + 0xc)) == '\0') {
|
|
return;
|
|
}
|
|
cordLength = 76.0;
|
|
}
|
|
else {
|
|
if (iVar4 == 0x361) {
|
|
layerId = 0;
|
|
isUseOverlay = 0;
|
|
}
|
|
else if (iVar4 == 0x343) {
|
|
layerId = 1;
|
|
}
|
|
beamLayerId = layerId;
|
|
}
|
|
if (layerId < (this->_sprite)._layerCount) {
|
|
totalLength = 0.0;
|
|
if (isShadow == 0) {
|
|
(GHIDRA_CAST<Color *>((&tmpColor)))->Color::Color();
|
|
baseColor = extraout_EAX;
|
|
isShadowTint = extraout_DL;
|
|
}
|
|
else {
|
|
tmpColor._colorize[0] = 0.0;
|
|
tmpColor._colorize[1] = 0.0;
|
|
tmpColor._colorize[2] = 0.0;
|
|
tmpColor._colorize[3] = 0.0;
|
|
baseColor = &tmpColor;
|
|
tmpColor._offset[0] = 0.0;
|
|
tmpColor._offset[1] = 0.0;
|
|
tmpColor._offset[2] = 0.0;
|
|
tmpColor._tint[0] = 0.0;
|
|
tmpColor._tint[1] = 0.0;
|
|
tmpColor._tint[2] = 0.0;
|
|
tmpColor._tint[3] = 1.0;
|
|
isShadowTint = isShadow;
|
|
}
|
|
baseTintR = baseColor->_tint[0];
|
|
baseTintG = baseColor->_tint[1];
|
|
baseTintB = baseColor->_tint[2];
|
|
baseTintA = baseColor->_tint[3];
|
|
cordColor._tint[0] = baseTintR;
|
|
cordColor._tint[1] = baseTintG;
|
|
cordColor._tint[2] = baseTintB;
|
|
cordColor._tint[3] = baseTintA;
|
|
baseColorizeR = baseColor->_colorize[0];
|
|
baseColorizeG = baseColor->_colorize[1];
|
|
baseColorizeB = baseColor->_colorize[2];
|
|
baseColorizeA = baseColor->_colorize[3];
|
|
cordColor._colorize[0] = baseColorizeR;
|
|
cordColor._colorize[1] = baseColorizeG;
|
|
cordColor._colorize[2] = baseColorizeB;
|
|
cordColor._colorize[3] = baseColorizeA;
|
|
baseOffset = *(float (*) [2])baseColor->_offset;
|
|
local_fc = baseColor->_offset[2];
|
|
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;
|
|
if (isShadowTint == 0) {
|
|
tmpColor._tint[0] = 0.3;
|
|
tmpColor._tint[1] = 0.3;
|
|
tmpColor._tint[2] = 0.3;
|
|
}
|
|
else {
|
|
tmpColor._tint[0] = 0.0;
|
|
tmpColor._tint[1] = 0.0;
|
|
tmpColor._tint[2] = 0.0;
|
|
}
|
|
tmpColor._tint[3] = 1.0;
|
|
headColor._tint[3] = 1.0;
|
|
headColor._colorize[0] = 0.0;
|
|
headColor._colorize[1] = 0.0;
|
|
headColor._colorize[2] = 0.0;
|
|
headColor._colorize[3] = 0.0;
|
|
headColor._offset[2] = 0.0;
|
|
headColor._offset[0] = 0.0;
|
|
headColor._offset[1] = 0.0;
|
|
iVar4 = *GHIDRA_CAST<int *>(ThreadLocalStoragePointer);
|
|
headColor._tint[0] = tmpColor._tint[0];
|
|
headColor._tint[1] = tmpColor._tint[1];
|
|
headColor._tint[2] = tmpColor._tint[2];
|
|
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(cordColor._offset)) + 0x0))) = baseOffset;
|
|
cordColor._offset[2] = local_fc;
|
|
if ((*GHIDRA_CAST<int *>((iVar4 + 0xc)) < DAT_00c7f758) && (_Init_thread_header(), DAT_00c7f758 == -1)) {
|
|
_atexit(GHIDRA_CAST<_func_4879 *>(&LAB_00b154f0));
|
|
_Init_thread_footer();
|
|
}
|
|
if ((*GHIDRA_CAST<int *>((iVar4 + 0xc)) < DAT_00c7f768) && (_Init_thread_header(), DAT_00c7f768 == -1)) {
|
|
_atexit(GHIDRA_CAST<_func_4879 *>(&LAB_00b15470));
|
|
_Init_thread_footer();
|
|
}
|
|
i = 0;
|
|
DAT_00c7f760 = DAT_00c7f75c;
|
|
g_npcTrailPointsEnd = DAT_00c7f76c;
|
|
if ((this->_vectorDeque2)._size != 0) {
|
|
do {
|
|
pfVar2 = DAT_00c7f760;
|
|
uVar3 = (this->_vectorDeque2)._offset + i;
|
|
dequeSlot = uVar3 & 1;
|
|
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque2)._map) +
|
|
((this->_vectorDeque2)._mapSize - 1 & uVar3 >> 1) * 4));
|
|
trailPointX = *GHIDRA_CAST<float *>((iVar4 + dequeSlot * 8));
|
|
trailPointY = *GHIDRA_CAST<float *>((iVar4 + 4 + dequeSlot * 8));
|
|
local_10c = trailPointY;
|
|
if (isShadow == 0) {
|
|
uVar3 = (this->_vectorDeque2)._offset + 2 + i;
|
|
local_10c = trailPointY +
|
|
*GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque2)._map) +
|
|
((this->_vectorDeque2)._mapSize - 1 & uVar3 >> 1) * 4)) +
|
|
(uVar3 & 1) * 8));
|
|
}
|
|
local_108 = g_displayPixelRatio * g_screenPointScale;
|
|
local_124 = ((g_screenWidth - 338.0) * 0.5 + (trailPointX - 60.0) * 0.65) * local_108 +
|
|
0.5;
|
|
dVar6 = floor((double)local_124);
|
|
pointX = (float)dVar6 / local_108;
|
|
local_124 = ((g_screenHeight - 182.0) * 0.5 + (local_10c - 140.0) * 0.65) * local_108 +
|
|
0.5;
|
|
dVar6 = floor((double)local_124);
|
|
local_124 = (float)dVar6;
|
|
trailPointX = pointX + offset->x;
|
|
trailPointY = local_124 / local_108 + offset->y;
|
|
if (pfVar2 == DAT_00c7f764) {
|
|
msvc::vector<Vector>::_Emplace_reallocate(pfVar2,&trailPointX);
|
|
}
|
|
else {
|
|
*pfVar2 = trailPointX;
|
|
DAT_00c7f760[1] = trailPointY;
|
|
DAT_00c7f760 = DAT_00c7f760 + 2;
|
|
}
|
|
i = i + 3;
|
|
} while (i < (this->_vectorDeque2)._size);
|
|
}
|
|
pvVar1 = g_npcTrailPointsEnd;
|
|
trailPointX = *DAT_00c7f75c;
|
|
trailPointY = DAT_00c7f75c[1];
|
|
trailPointLength = 0.0;
|
|
if (g_npcTrailPointsEnd == DAT_00c7f774) {
|
|
msvc::vector<12byte>::_Emplace_reallocate(g_npcTrailPointsEnd,&trailPointX);
|
|
}
|
|
else {
|
|
*GHIDRA_CAST<uint64_t *>(g_npcTrailPointsEnd) = *GHIDRA_CAST<uint64_t *>(DAT_00c7f75c);
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(pvVar1) + 8)) = 0;
|
|
g_npcTrailPointsEnd = (void *)(GHIDRA_INT(g_npcTrailPointsEnd) + 0xc);
|
|
}
|
|
i = 1;
|
|
if (1 < (GHIDRA_INT(DAT_00c7f760) - GHIDRA_INT(DAT_00c7f75c) >> 3) - 1U) {
|
|
do {
|
|
pvVar1 = g_npcTrailPointsEnd;
|
|
pointX = DAT_00c7f75c[i * 2] * 0.4 + DAT_00c7f75c[i * 2 + -2] * 0.3 +
|
|
DAT_00c7f75c[i * 2 + 2] * 0.3;
|
|
dx = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(g_npcTrailPointsEnd) + -0xc)) - pointX;
|
|
local_124 = DAT_00c7f75c[i * 2 + -1] * 0.3 + DAT_00c7f75c[i * 2 + 1] * 0.4 +
|
|
DAT_00c7f75c[i * 2 + 3] * 0.3;
|
|
fVar5 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(g_npcTrailPointsEnd) + -8)) - local_124;
|
|
fVar5 = sqrtf(fVar5 * fVar5 + dx * dx);
|
|
totalLength = totalLength + fVar5;
|
|
trailPointX = pointX;
|
|
trailPointY = local_124;
|
|
trailPointLength = totalLength;
|
|
if (pvVar1 == DAT_00c7f774) {
|
|
msvc::vector<12byte>::_Emplace_reallocate(pvVar1,&trailPointX);
|
|
}
|
|
else {
|
|
*GHIDRA_CAST<uint64_t *>(pvVar1) = CONCAT44(local_124,pointX);
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + 8)) = totalLength;
|
|
g_npcTrailPointsEnd = (void *)(GHIDRA_INT(g_npcTrailPointsEnd) + 0xc);
|
|
}
|
|
i = i + 1;
|
|
} while (i < (GHIDRA_INT(DAT_00c7f760) - GHIDRA_INT(DAT_00c7f75c) >> 3) - 1U);
|
|
}
|
|
pvVar1 = g_npcTrailPointsEnd;
|
|
pointsEnd = DAT_00c7f760;
|
|
fVar5 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(g_npcTrailPointsEnd) + -8)) - DAT_00c7f760[-1];
|
|
dx = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(g_npcTrailPointsEnd) + -0xc)) - DAT_00c7f760[-2];
|
|
fVar5 = sqrtf(fVar5 * fVar5 + dx * dx);
|
|
pfVar2 = pointsEnd + -2;
|
|
trailPointX = *pfVar2;
|
|
totalLength = fVar5 + totalLength;
|
|
trailPointY = pointsEnd[-1];
|
|
trailPointLength = totalLength;
|
|
if (pvVar1 == DAT_00c7f774) {
|
|
msvc::vector<12byte>::_Emplace_reallocate(pvVar1,&trailPointX);
|
|
}
|
|
else {
|
|
*GHIDRA_CAST<uint64_t *>(pvVar1) = *GHIDRA_CAST<uint64_t *>(pfVar2);
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + 8)) = totalLength;
|
|
g_npcTrailPointsEnd = (void *)(GHIDRA_INT(g_npcTrailPointsEnd) + 0xc);
|
|
}
|
|
local_10c = 1.0;
|
|
local_108 = -NAN;
|
|
fVar5 = cordLength;
|
|
if (this->_type == 0x376) {
|
|
if (0 < this->_projectileDelay) {
|
|
local_108 = (float)(this->_projectileDelay / 2);
|
|
}
|
|
}
|
|
else if (this->_type == 0x361) {
|
|
uVar3 = 0;
|
|
i = *GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_sprite)._animState._animData) + 0x18)) + 8));
|
|
if (i != 0) {
|
|
pfVar2 = GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_sprite)._animState._animData) + 0x18)) + 4
|
|
)) + 0xc));
|
|
do {
|
|
if (totalLength <= *pfVar2) {
|
|
if ((this->_sprite)._animState._animData != (void *)0x0) {
|
|
AnimationState::SetFrameFloat(&(this->_sprite)._animState,(float)GHIDRA_INT(uVar3));
|
|
}
|
|
break;
|
|
}
|
|
uVar3 = uVar3 + 1;
|
|
pfVar2 = pfVar2 + 0x1b;
|
|
} while (uVar3 < i);
|
|
}
|
|
headColor._offset[2] = local_fc;
|
|
headColor._tint[0] = baseTintR;
|
|
headColor._tint[1] = baseTintG;
|
|
headColor._tint[2] = baseTintB;
|
|
headColor._tint[3] = baseTintA;
|
|
headColor._colorize[0] = baseColorizeR;
|
|
headColor._colorize[1] = baseColorizeG;
|
|
headColor._colorize[2] = baseColorizeB;
|
|
headColor._colorize[3] = baseColorizeA;
|
|
headColor._offset[0] = baseOffset[0];
|
|
headColor._offset[1] = baseOffset[1];
|
|
fVar5 = totalLength;
|
|
if (this->_target != 0) {
|
|
local_10c = 0.9;
|
|
fVar5 = totalLength;
|
|
}
|
|
}
|
|
DAT_00c78ef0 = &this->_sprite;
|
|
fVar5 = totalLength / fVar5;
|
|
i = 0;
|
|
DAT_00c78ef4 = beamLayerId;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(DAT_00c78ef8)) + 0x0))) = isUseOverlay;
|
|
g_beamRendererPointsEnd = g_beamRendererPoints;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(DAT_00c78ef8)) + 0x1))) = 1;
|
|
if (1.0 <= fVar5) {
|
|
fVar5 = 1.0;
|
|
}
|
|
iVar4 = GHIDRA_INT(g_npcTrailPointsEnd) - GHIDRA_INT(DAT_00c7f76c) >> 0x1f;
|
|
if ((GHIDRA_INT(g_npcTrailPointsEnd) - GHIDRA_INT(DAT_00c7f76c)) / 0xc + iVar4 != iVar4) {
|
|
local_fc = fVar5 * local_10c;
|
|
iVar4 = 0;
|
|
do {
|
|
color = &headColor;
|
|
if (i != 0) {
|
|
color = &cordColor;
|
|
}
|
|
if ((float)i == local_108) {
|
|
fVar5 = 2.0;
|
|
}
|
|
else {
|
|
fVar5 = 1.0;
|
|
}
|
|
BeamRenderer::Add(GHIDRA_CAST<Vector *>((iVar4 + GHIDRA_INT(DAT_00c7f76c))),color,fVar5,
|
|
local_10c -
|
|
(1.0 - *GHIDRA_CAST<float *>((iVar4 + 8 + GHIDRA_INT(DAT_00c7f76c))) / totalLength) *
|
|
local_fc);
|
|
i = i + 1;
|
|
iVar4 = iVar4 + 0xc;
|
|
} while (i < GHIDRA_UINT(((GHIDRA_INT(g_npcTrailPointsEnd) - GHIDRA_INT(DAT_00c7f76c)) / 0xc)));
|
|
}
|
|
BeamRenderer::End();
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 00548f30
|
|
int Entity_NPC::FindTargetPit(Vector *pos1, Vector *pos2, uint32_t pitIndex)
|
|
{
|
|
uint32_t uVar1;
|
|
int index;
|
|
int iVar2;
|
|
int gridWidth;
|
|
int row;
|
|
float pitX;
|
|
float pos2Distance;
|
|
float fVar3;
|
|
float fVar4;
|
|
float pitY;
|
|
uint32_t bestIndex;
|
|
uint32_t gridIndex;
|
|
float bestScore;
|
|
short *gridPath;
|
|
void **gridEntitySlot;
|
|
float score;
|
|
void *gridEntity;
|
|
Room *room;
|
|
|
|
room = g_game->_room;
|
|
bestIndex = 0xffffffff;
|
|
bestScore = -1e+06;
|
|
gridWidth = room->_gridWidth;
|
|
gridIndex = 0;
|
|
if (gridWidth * room->_gridHeight < 1) {
|
|
return -1;
|
|
}
|
|
gridPath = GHIDRA_CAST<short *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((room)) + 0xe6c))));
|
|
gridEntitySlot = room->_gridEntities;
|
|
do {
|
|
if ((((gridIndex < 0x1c0) && (gridEntity = *gridEntitySlot, gridEntity != (void *)0x0)) &&
|
|
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(gridEntity) + 4)) == 7)) &&
|
|
((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(gridEntity) + 0xc)) == 0 && (*gridPath == 0)))) {
|
|
iVar2 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0xc));
|
|
pitX = (float)(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(gridEntity) + 0x24)) % iVar2) * 40.0 + 40.0;
|
|
pitY = (float)(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(gridEntity) + 0x24)) / iVar2) * 40.0 + 120.0;
|
|
fVar3 = pos2->x - pitX;
|
|
pos2Distance = pos2->y - pitY;
|
|
pos2Distance = sqrtf(pos2Distance * pos2Distance + fVar3 * fVar3);
|
|
fVar3 = pos1->y - pitY;
|
|
fVar4 = pos1->x - pitX;
|
|
score = sqrtf(fVar3 * fVar3 + fVar4 * fVar4);
|
|
score = 2000.0 - score;
|
|
if (-1 < GHIDRA_INT(pitIndex)) {
|
|
if (pos2Distance < 60.0) goto LAB_0054926c;
|
|
score = score - pos2Distance * 3.0;
|
|
if (pitIndex == gridIndex) {
|
|
score = score - 2000.0;
|
|
}
|
|
iVar2 = GHIDRA_INT((((pitX + 40.0) - 40.0) / 40.0 + 0.5));
|
|
row = GHIDRA_INT((((pitY + 0.0) - 120.0) / 40.0 + 0.5));
|
|
if (((iVar2 < 0) || (gridWidth <= iVar2)) || ((row < 0 || (room->_gridHeight <= row)))) {
|
|
gridWidth = room->_gridWidth;
|
|
iVar2 = -1;
|
|
}
|
|
else {
|
|
iVar2 = gridWidth * row + iVar2;
|
|
}
|
|
uVar1 = (GHIDRA_CAST<Room *>((room)))->Room::GetGridCollision(iVar2);
|
|
if (uVar1 == 1) {
|
|
iVar2 = GHIDRA_INT((((pitX - 40.0) - 40.0) / 40.0 + 0.5));
|
|
if ((((iVar2 < 0) || (gridWidth <= iVar2)) || (row < 0)) || (room->_gridHeight <= row)) {
|
|
iVar2 = -1;
|
|
}
|
|
else {
|
|
iVar2 = iVar2 + row * gridWidth;
|
|
}
|
|
uVar1 = (GHIDRA_CAST<Room *>((room)))->Room::GetGridCollision(iVar2);
|
|
if (uVar1 == 1) {
|
|
iVar2 = GHIDRA_INT((((pitX + 0.0) - 40.0) / 40.0 + 0.5));
|
|
row = GHIDRA_INT((((pitY + 40.0) - 120.0) / 40.0 + 0.5));
|
|
if (((iVar2 < 0) || (gridWidth <= iVar2)) || ((row < 0 || (room->_gridHeight <= row))))
|
|
{
|
|
index = -1;
|
|
}
|
|
else {
|
|
index = row * gridWidth + iVar2;
|
|
}
|
|
uVar1 = (GHIDRA_CAST<Room *>((room)))->Room::GetGridCollision(index);
|
|
if (uVar1 == 1) {
|
|
if (((iVar2 < 0) || (gridWidth <= iVar2)) || ((row < 0 || (room->_gridHeight <= row)))
|
|
) {
|
|
iVar2 = -1;
|
|
}
|
|
else {
|
|
iVar2 = iVar2 + row * gridWidth;
|
|
}
|
|
uVar1 = (GHIDRA_CAST<Room *>((room)))->Room::GetGridCollision(iVar2);
|
|
if (uVar1 == 1) {
|
|
score = score + 200.0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
uVar1 = Random();
|
|
score = (float)((double)GHIDRA_INT(uVar1) + __uint_to_double_fixup[-(GHIDRA_INT(uVar1) >> 0x1f)]) *
|
|
2.3283064e-10 * 500.0 + score;
|
|
}
|
|
if (bestScore < score) {
|
|
bestIndex = gridIndex;
|
|
bestScore = score;
|
|
}
|
|
}
|
|
LAB_0054926c:
|
|
gridWidth = room->_gridWidth;
|
|
gridIndex = gridIndex + 1;
|
|
gridEntitySlot = gridEntitySlot + 1;
|
|
gridPath = gridPath + 1;
|
|
if (gridWidth * room->_gridHeight <= GHIDRA_INT(gridIndex)) {
|
|
return bestIndex;
|
|
}
|
|
} while( true );
|
|
}
|
|
|
|
// 0055cef0
|
|
Entity_NPC * Entity_NPC::ThrowStrider(Vector *pos, Entity *spanwer, Vector *targetPos)
|
|
{
|
|
uint32_t seed;
|
|
Entity_NPC *strider;
|
|
int iVar1;
|
|
int iVar2;
|
|
float fVar3;
|
|
float fVar4;
|
|
uint32_t flagsHigh;
|
|
Game *game;
|
|
void *room;
|
|
float striderY;
|
|
float targetY;
|
|
|
|
seed = Random();
|
|
strider = GHIDRA_CAST<Entity_NPC *>((GHIDRA_CAST<Game *>((g_game)))->Game)::SpawnEx(0x32e,0,pos,&g_vectorZero,spanwer,0,seed,0);
|
|
game = g_game;
|
|
flagsHigh = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&strider->_flags) + 4));
|
|
*GHIDRA_CAST<uint32_t *>(&strider->_flags) = GHIDRA_UINT(strider->_flags) & 0xfffffffb;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&strider->_flags) + 4)) = flagsHigh;
|
|
fVar3 = targetPos->x;
|
|
(strider->_targetPosition).x = fVar3;
|
|
targetY = targetPos->y;
|
|
(strider->_targetPosition).y = targetY;
|
|
room = game->_room;
|
|
iVar2 = GHIDRA_INT(((fVar3 - 40.0) / 40.0 + 0.5));
|
|
if ((((-1 < iVar2) && (iVar2 < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(room) + 0xc)))) &&
|
|
(iVar1 = GHIDRA_INT(((targetY - 120.0) / 40.0 + 0.5)), -1 < iVar1)) &&
|
|
(((iVar1 < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(room) + 0x10)) &&
|
|
(iVar2 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(room) + 0xc)) * iVar1 + iVar2, -1 < iVar2)) && (iVar2 < 0x1c0)))) {
|
|
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(room) + iVar2 * 4 + 0x76c));
|
|
if (iVar1 < 0x385) {
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(room) + iVar2 * 4 + 0x76c)) = 900;
|
|
}
|
|
else if (iVar1 - 3000U < 0x385) {
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(room) + iVar2 * 4 + 0x76c)) = 0xf3c;
|
|
}
|
|
}
|
|
(strider->_posOffset).y = -8.0;
|
|
(strider->_v1).x = -8.0;
|
|
fVar3 = (strider->_targetPosition).x;
|
|
targetY = (strider->_targetPosition).y;
|
|
fVar4 = (strider->_pos).x;
|
|
striderY = (strider->_pos).y;
|
|
strider->_state = 6;
|
|
strider->_entityGridCollisionClass = 3;
|
|
fVar4 = (fVar3 - fVar4) * 0.04;
|
|
strider->_entityCollisionClass = 0;
|
|
fVar3 = (targetY - striderY) * 0.04;
|
|
(strider->_v2).x = fVar4;
|
|
(strider->_velocity).x = fVar4;
|
|
(strider->_v2).y = fVar3;
|
|
(strider->_velocity).y = fVar3;
|
|
return strider;
|
|
}
|
|
|
|
// 00565680
|
|
void Entity_NPC::render_v1_layer_frames()
|
|
{
|
|
float fVar1;
|
|
float fVar2;
|
|
LayerState *pLVar3;
|
|
LayerState *layer1;
|
|
uint32_t segment2Index;
|
|
int layerId;
|
|
ANM2 *sprite;
|
|
float fVar4;
|
|
float fVar5;
|
|
float layer2Height;
|
|
float layer1Height;
|
|
void *animData;
|
|
int renderMode;
|
|
float *segment1Y;
|
|
uint32_t segmentIndex;
|
|
|
|
fVar5 = (this->_v1).x;
|
|
renderMode = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0x12bc));
|
|
if (0.0 <= fVar5) {
|
|
animData = (this->_sprite)._animState._animData;
|
|
if (fVar5 <= 4.0) {
|
|
if ((animData == (void *)0x0) ||
|
|
((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_sprite)._animState._animation) + 0x80)) < 1 &&
|
|
(KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("LayerId out of bounds\n")),
|
|
*GHIDRA_CAST<int *>((GHIDRA_INT((this->_sprite)._animState._animation) + 0x80)) < 1)))) goto LAB_005657ec;
|
|
animData = (this->_sprite)._animState._animData;
|
|
layerId = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(animData) + 0x38));
|
|
if ((animData == (void *)0x0) ||
|
|
((layerId < 0 || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(animData) + 0x1c)) <= layerId)))) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("id out of bounds\n"));
|
|
}
|
|
fVar5 = 0.0;
|
|
}
|
|
else {
|
|
if ((animData == (void *)0x0) ||
|
|
((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_sprite)._animState._animation) + 0x80)) < 1 &&
|
|
(KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("LayerId out of bounds\n")),
|
|
*GHIDRA_CAST<int *>((GHIDRA_INT((this->_sprite)._animState._animation) + 0x80)) < 1)))) goto LAB_005657ec;
|
|
animData = (this->_sprite)._animState._animData;
|
|
layerId = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(animData) + 0x38));
|
|
if ((animData == (void *)0x0) ||
|
|
((layerId < 0 || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(animData) + 0x1c)) <= layerId)))) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("id out of bounds\n"));
|
|
}
|
|
fVar5 = 2.0;
|
|
}
|
|
}
|
|
else {
|
|
if (((this->_sprite)._animState._animData == (void *)0x0) ||
|
|
((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_sprite)._animState._animation) + 0x80)) < 1 &&
|
|
(KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("LayerId out of bounds\n")),
|
|
*GHIDRA_CAST<int *>((GHIDRA_INT((this->_sprite)._animState._animation) + 0x80)) < 1)))) goto LAB_005657ec;
|
|
animData = (this->_sprite)._animState._animData;
|
|
layerId = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(animData) + 0x38));
|
|
if ((animData == (void *)0x0) || ((layerId < 0 || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(animData) + 0x1c)) <= layerId))))
|
|
{
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("id out of bounds\n"));
|
|
}
|
|
fVar5 = 1.0;
|
|
}
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT((this->_sprite)._animState._layerFrames) + layerId * 4)) = 0;
|
|
AnimationState::AdvanceLayerPosition(&(this->_sprite)._animState,layerId,fVar5);
|
|
LAB_005657ec:
|
|
fVar5 = (this->_posOffset).y;
|
|
layer2Height = fVar5;
|
|
layer1Height = fVar5;
|
|
if (1 < (this->_vectorDeque1)._size) {
|
|
segmentIndex = (this->_vectorDeque1)._offset + 1;
|
|
fVar4 = *GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
(segmentIndex >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)) + 4 +
|
|
(segmentIndex & 1) * 8));
|
|
fVar1 = (this->_v1).y;
|
|
pLVar3 = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST<uint8_t *>(0x2));
|
|
(pLVar3->_pos).x = 0.0;
|
|
(pLVar3->_pos).y = (fVar4 - fVar1) * 0.65;
|
|
layer1 = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST<uint8_t *>(0x1));
|
|
(layer1->_pos).x = (pLVar3->_pos).x;
|
|
(layer1->_pos).y = (pLVar3->_pos).y;
|
|
segmentIndex = (this->_vectorDeque1)._offset + 1;
|
|
layer1Height = (*GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
(segmentIndex >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4))
|
|
+ 4 + (segmentIndex & 1) * 8)) + (this->_posOffset).y) - (this->_v1).y
|
|
;
|
|
layer2Height = layer1Height;
|
|
if (2 < (this->_vectorDeque1)._size) {
|
|
segmentIndex = (this->_vectorDeque1)._offset + 2;
|
|
fVar4 = *GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
(segmentIndex >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)) + 4 +
|
|
(segmentIndex & 1) * 8));
|
|
fVar1 = (this->_v1).y;
|
|
pLVar3 = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST<uint8_t *>(0x2));
|
|
(pLVar3->_pos).x = 0.0;
|
|
(pLVar3->_pos).y = (fVar4 - fVar1) * 0.65;
|
|
segment2Index = (this->_vectorDeque1)._offset;
|
|
segmentIndex = segment2Index + 1;
|
|
segment2Index = segment2Index + 2;
|
|
fVar4 = *GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
((this->_vectorDeque1)._mapSize - 1 & segment2Index >> 1) * 4)) + 4
|
|
+ (segment2Index & 1) * 8));
|
|
segment1Y = GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
((this->_vectorDeque1)._mapSize - 1 & segmentIndex >> 1) * 4)) +
|
|
4 + (segmentIndex & 1) * 8));
|
|
fVar1 = *segment1Y;
|
|
fVar2 = *segment1Y;
|
|
pLVar3 = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST<uint8_t *>(0x2));
|
|
pLVar3->_flipY = fVar2 <= fVar4 && fVar4 != fVar1;
|
|
segmentIndex = (this->_vectorDeque1)._offset + 2;
|
|
fVar4 = *GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
((this->_vectorDeque1)._mapSize - 1 & segmentIndex >> 1) * 4)) +
|
|
(segmentIndex & 1) * 8));
|
|
pLVar3 = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST<uint8_t *>(0x2));
|
|
pLVar3->_flipX = 0.0 < fVar4;
|
|
segmentIndex = (this->_vectorDeque1)._offset + 2;
|
|
if (*GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
(segmentIndex >> 1 & (this->_vectorDeque1)._mapSize - 1) * 4)) +
|
|
(segmentIndex & 1) * 8)) <= 0.0) {
|
|
fVar4 = 3.0;
|
|
}
|
|
else {
|
|
fVar4 = -3.0;
|
|
}
|
|
pLVar3 = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST<uint8_t *>(0x2));
|
|
(pLVar3->_pos).x = fVar4;
|
|
segmentIndex = (this->_vectorDeque1)._offset + 2;
|
|
layer2Height = (*GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((GHIDRA_INT((this->_vectorDeque1)._map) +
|
|
((this->_vectorDeque1)._mapSize - 1 & segmentIndex >> 1) *
|
|
4)) + 4 + (segmentIndex & 1) * 8)) + (this->_posOffset).y) -
|
|
(this->_v1).y;
|
|
}
|
|
}
|
|
sprite = &this->_sprite;
|
|
pLVar3 = ANM2::GetLayer(sprite,GHIDRA_CAST<uint8_t *>(0x0));
|
|
if (renderMode == 5) {
|
|
fVar5 = (fVar5 - 2.0) / 78.0;
|
|
if (fVar5 <= 0.0) {
|
|
fVar5 = 0.0;
|
|
}
|
|
if (1.0 <= fVar5) {
|
|
fVar5 = 1.0;
|
|
}
|
|
(pLVar3->_color)._tint[3] = 1.0 - fVar5;
|
|
pLVar3 = ANM2::GetLayer(sprite,GHIDRA_CAST<uint8_t *>(0x1));
|
|
fVar5 = (layer1Height - 2.0) / 78.0;
|
|
if (fVar5 <= 0.0) {
|
|
fVar5 = 0.0;
|
|
}
|
|
if (1.0 <= fVar5) {
|
|
fVar5 = 1.0;
|
|
}
|
|
(pLVar3->_color)._tint[3] = 1.0 - fVar5;
|
|
pLVar3 = ANM2::GetLayer(sprite,GHIDRA_CAST<uint8_t *>(0x2));
|
|
fVar5 = (layer2Height - 2.0) / 78.0;
|
|
}
|
|
else {
|
|
fVar5 = (fVar5 - -2.0) / 18.0;
|
|
if (fVar5 <= 0.0) {
|
|
fVar5 = 0.0;
|
|
}
|
|
if (1.0 <= fVar5) {
|
|
fVar5 = 1.0;
|
|
}
|
|
(pLVar3->_color)._tint[3] = 1.0 - fVar5;
|
|
pLVar3 = ANM2::GetLayer(sprite,GHIDRA_CAST<uint8_t *>(0x1));
|
|
fVar5 = (layer1Height - -2.0) / 18.0;
|
|
if (fVar5 <= 0.0) {
|
|
fVar5 = 0.0;
|
|
}
|
|
if (1.0 <= fVar5) {
|
|
fVar5 = 1.0;
|
|
}
|
|
(pLVar3->_color)._tint[3] = 1.0 - fVar5;
|
|
pLVar3 = ANM2::GetLayer(sprite,GHIDRA_CAST<uint8_t *>(0x2));
|
|
fVar5 = (layer2Height - -2.0) / 18.0;
|
|
}
|
|
if (fVar5 <= 0.0) {
|
|
fVar5 = 0.0;
|
|
}
|
|
if (1.0 <= fVar5) {
|
|
fVar5 = 1.0;
|
|
}
|
|
(pLVar3->_color)._tint[3] = 1.0 - fVar5;
|
|
return;
|
|
}
|
|
|
|
// 0059bed0
|
|
void Entity_NPC::RenderSegmentLink(Vector *offset, uint8_t isShadow)
|
|
{
|
|
Color *extraout_EAX;
|
|
Color *baseColor;
|
|
float fVar1;
|
|
float stretch;
|
|
double dVar2;
|
|
uint8_t auStack_f4 [40];
|
|
float local_cc;
|
|
float local_c8;
|
|
float local_c4;
|
|
float local_c0;
|
|
float local_bc;
|
|
Vector beamPoint;
|
|
float local_b0;
|
|
float local_ac;
|
|
float local_a8;
|
|
float local_a4;
|
|
float beamLength;
|
|
ColorMod linkColor;
|
|
Color tmpColor;
|
|
uint32_t local_44;
|
|
int child;
|
|
int childI2;
|
|
|
|
local_44 = __security_cookie ^ GHIDRA_UINT(auStack_f4);
|
|
child = this->_child;
|
|
if ((child != 0) &&
|
|
(((childI2 = *GHIDRA_CAST<int *>((child + 0xbc4)), childI2 != 0 || (this->_i2 != 0)) &&
|
|
(1 < GHIDRA_UINT((this->_sprite)._layerCount))))) {
|
|
if (isShadow == 0) {
|
|
(GHIDRA_CAST<Color *>((&tmpColor)))->Color::Color();
|
|
baseColor = extraout_EAX;
|
|
}
|
|
else {
|
|
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;
|
|
baseColor = &tmpColor;
|
|
tmpColor._offset[1] = 0.0;
|
|
tmpColor._offset[2] = 0.0;
|
|
tmpColor._tint[0] = 0.0;
|
|
tmpColor._tint[1] = 0.0;
|
|
tmpColor._tint[2] = 0.0;
|
|
tmpColor._tint[3] = 1.0;
|
|
}
|
|
linkColor._tint[0] = baseColor->_tint[0];
|
|
linkColor._tint[1] = baseColor->_tint[1];
|
|
linkColor._tint[2] = baseColor->_tint[2];
|
|
linkColor._tint[3] = baseColor->_tint[3];
|
|
linkColor._colorize[0] = baseColor->_colorize[0];
|
|
linkColor._colorize[1] = baseColor->_colorize[1];
|
|
linkColor._colorize[2] = baseColor->_colorize[2];
|
|
linkColor._colorize[3] = baseColor->_colorize[3];
|
|
(*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(linkColor._offset)) + 0x0))) = *GHIDRA_CAST<uint64_t *>(baseColor->_offset);
|
|
local_c0 = g_displayPixelRatio * g_screenPointScale;
|
|
linkColor._offset[2] = baseColor->_offset[2];
|
|
local_c8 = (g_screenWidth - 338.0) * 0.5;
|
|
local_b0 = (g_screenHeight - 182.0) * 0.5;
|
|
local_cc = (((this->_pos).x - 60.0) * 0.65 + local_c8) * local_c0 + 0.5;
|
|
dVar2 = floor((double)local_cc);
|
|
local_c4 = (float)dVar2 / local_c0;
|
|
local_cc = (((this->_pos).y - 140.0) * 0.65 + local_b0) * local_c0 + 0.5;
|
|
dVar2 = floor((double)local_cc);
|
|
local_a8 = (float)dVar2 / local_c0;
|
|
local_bc = offset->x;
|
|
local_cc = local_bc + local_c4;
|
|
local_c4 = offset->y;
|
|
local_c8 = ((*GHIDRA_CAST<float *>((child + 0x33c)) - 60.0) * 0.65 + local_c8) * local_c0 + 0.5;
|
|
dVar2 = floor((double)local_c8);
|
|
local_ac = (float)dVar2 / local_c0;
|
|
local_c8 = ((*GHIDRA_CAST<float *>((child + 0x340)) - 140.0) * 0.65 + local_b0) * local_c0 + 0.5;
|
|
dVar2 = floor((double)local_c8);
|
|
local_c8 = (float)dVar2;
|
|
fVar1 = local_c8 / local_c0;
|
|
local_c0 = (local_c4 + local_a8) - 6.0;
|
|
local_c4 = (local_c4 + fVar1) - 6.0;
|
|
if (this->_i2 == 0) {
|
|
local_c0 = local_c0 - 18.0;
|
|
}
|
|
if (childI2 == 0) {
|
|
local_c4 = local_c4 - 18.0;
|
|
}
|
|
local_bc = (local_bc + local_ac) - local_cc;
|
|
local_c4 = local_c4 - local_c0;
|
|
fVar1 = sqrtf(local_bc * local_bc + local_c4 * local_c4);
|
|
if (0.0 < fVar1) {
|
|
local_c4 = local_c4 * (1.0 / fVar1);
|
|
local_bc = local_bc * (1.0 / fVar1);
|
|
}
|
|
beamLength = fVar1 - 6.0;
|
|
if (6.0 <= beamLength) {
|
|
DAT_00c78ef0 = &this->_sprite;
|
|
g_beamRendererPointsEnd = g_beamRendererPoints;
|
|
stretch = (fVar1 - 20.0) / 70.0;
|
|
DAT_00c78ef4 = 1;
|
|
(*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(&(DAT_00c78ef8)) + 0x0))) = 0x100;
|
|
fVar1 = (beamLength - 6.0) * 0.15;
|
|
local_ac = (beamLength - 6.0) * 0.5 + 6.0;
|
|
local_a4 = 30.0;
|
|
if (fVar1 <= 30.0) {
|
|
local_a4 = fVar1;
|
|
}
|
|
if (stretch <= 0.0) {
|
|
stretch = 0.0;
|
|
}
|
|
local_a8 = local_a4 + 6.0;
|
|
if (1.0 <= stretch) {
|
|
stretch = 1.0;
|
|
}
|
|
local_a4 = beamLength - local_a4;
|
|
local_c8 = 1.0 - stretch * 0.6;
|
|
local_b0 = 1.0 - (1.0 - local_c8) * (1.0 - local_c8);
|
|
beamPoint.x = local_bc * 6.0 + local_cc;
|
|
beamPoint.y = local_c4 * 6.0 + local_c0;
|
|
BeamRenderer::Add(&beamPoint,&linkColor,1.0,0.0);
|
|
beamPoint.x = local_bc * local_a8 + local_cc;
|
|
beamPoint.y = local_c4 * local_a8 + local_c0;
|
|
BeamRenderer::Add(&beamPoint,&linkColor,local_b0,0.33);
|
|
beamPoint.x = local_bc * local_ac + local_cc;
|
|
beamPoint.y = local_c4 * local_ac + local_c0;
|
|
BeamRenderer::Add(&beamPoint,&linkColor,local_c8,0.5);
|
|
beamPoint.x = local_bc * local_a4 + local_cc;
|
|
beamPoint.y = local_c4 * local_a4 + local_c0;
|
|
BeamRenderer::Add(&beamPoint,&linkColor,local_b0,0.66);
|
|
beamPoint.x = local_bc * beamLength + local_cc;
|
|
beamPoint.y = local_c4 * beamLength + local_c0;
|
|
BeamRenderer::Add(&beamPoint,&linkColor,1.0,1.0);
|
|
BeamRenderer::End();
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 0059e390
|
|
void Entity_NPC::CreateBling()
|
|
{
|
|
uint32_t rngResult;
|
|
Entity *spawned;
|
|
Entity_Effect *bling;
|
|
uint32_t rngResult;
|
|
TypeDescriptor *pTVar2;
|
|
TypeDescriptor *pTVar3;
|
|
uint32_t uVar4;
|
|
uint8_t texelColor [12];
|
|
float texelAlpha;
|
|
float offsetX;
|
|
float sampleY;
|
|
float offsetY;
|
|
|
|
rngResult = Random();
|
|
offsetY = ((float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) *
|
|
2.3283064e-10 - 1.0) * 187.5;
|
|
rngResult = Random();
|
|
offsetX = ((float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) *
|
|
2.3283064e-10 - 0.5) * 125.0;
|
|
sampleY = offsetY;
|
|
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::GetTexel(texelColor,offsetX,offsetY,g_vectorZero.x,g_vectorZero.y
|
|
,0x3f666666,0xffffffff);
|
|
if (1.0 <= texelAlpha) {
|
|
rngResult = Random();
|
|
uVar4 = 0;
|
|
pTVar3 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor;
|
|
pTVar2 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor;
|
|
rngResult = 0;
|
|
spawned = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x67,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,rngResult);
|
|
bling = GHIDRA_CAST<Entity_Effect *>(__RTDynamicCast(spawned,rngResult,pTVar2,pTVar3,uVar4));
|
|
(bling->_sprite)._offset.x = offsetX;
|
|
bling->_renderZOffset = 1000;
|
|
(bling->_sprite)._offset.y = offsetY;
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 0059e4c0
|
|
void Entity_NPC::CreateGoldParticles(uint32_t count)
|
|
{
|
|
uint32_t rngResult;
|
|
uint8_t texelColor [12];
|
|
float texelAlpha;
|
|
Vector particlePos;
|
|
float sampleX;
|
|
float sampleY;
|
|
float offsetX;
|
|
float offsetY;
|
|
ColorMod particleColor;
|
|
uint32_t local_c;
|
|
uint8_t auStack_8 [4];
|
|
|
|
local_c = __security_cookie ^ GHIDRA_UINT((auStack_8 + 4));
|
|
for (; count != 0; count = count - 1) {
|
|
rngResult = Random();
|
|
offsetY = ((float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) *
|
|
2.3283064e-10 - 1.0) * 187.5;
|
|
rngResult = Random();
|
|
sampleX = ((float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) *
|
|
2.3283064e-10 - 0.5) * 125.0;
|
|
sampleY = offsetY;
|
|
offsetX = sampleX;
|
|
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::GetTexel(texelColor,sampleX,offsetY,g_vectorZero.x,
|
|
g_vectorZero.y,0x3f666666,0xffffffff);
|
|
if (1.0 <= texelAlpha) {
|
|
particleColor._tint[0] = 1.0;
|
|
particleColor._tint[1] = 1.0;
|
|
particleColor._tint[2] = 1.0;
|
|
particleColor._tint[3] = 1.0;
|
|
particleColor._offset[0] = 0.0;
|
|
particleColor._offset[1] = 0.0;
|
|
particleColor._colorize[0] = 0.0;
|
|
particleColor._colorize[1] = 0.0;
|
|
particleColor._colorize[2] = 0.0;
|
|
particleColor._colorize[3] = 0.0;
|
|
particlePos.x = offsetX + (this->_pos).x;
|
|
particleColor._offset[2] = 0.0;
|
|
particlePos.y = (this->_pos).y;
|
|
Game::SpawnParticles(g_game,&particlePos,0x5f,7,12.0,&particleColor,offsetY,0);
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 0060d140
|
|
void Entity_NPC::set_entity_ptr_f54(Entity *entity)
|
|
{
|
|
uint8_t *entityRef;
|
|
Entity *newEntity;
|
|
|
|
newEntity = entity;
|
|
entityRef = &(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf54)));
|
|
if (*GHIDRA_CAST<Entity **>(entityRef) != entity) {
|
|
if (*GHIDRA_CAST<Entity **>(entityRef) != GHIDRA_CAST<Entity *>(0x0)) {
|
|
entity = GHIDRA_CAST<Entity *>(entityRef);
|
|
msvc::multiset<unsigned_int>::erase(&entity);
|
|
}
|
|
*GHIDRA_CAST<Entity **>(entityRef) = newEntity;
|
|
if (newEntity != GHIDRA_CAST<Entity *>(0x0)) {
|
|
msvc::multiset<unsigned_int>::insert(entityRef);
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006a8230
|
|
int Entity_NPC::GetChampionColorIdx()
|
|
{
|
|
return this->_championColorIdx;
|
|
}
|
|
|
|
// 006a8240
|
|
void Entity_NPC::ResetPathFinderTarget()
|
|
{
|
|
(this->_pathfinder)._movementTarget.x = g_vectorZero.x;
|
|
(this->_pathfinder)._movementTarget.y = g_vectorZero.y;
|
|
(this->_pathfinder)._moveDirection.x = g_vectorZero.x;
|
|
(this->_pathfinder)._moveDirection.y = g_vectorZero.y;
|
|
return;
|
|
}
|
|
|
|
// 006b5e20
|
|
void Entity_NPC::hold_set(int countdown, Vector *position)
|
|
{
|
|
int *longerCountdown;
|
|
|
|
longerCountdown = &countdown;
|
|
if (countdown < this->_holdCountdown) {
|
|
longerCountdown = &this->_holdCountdown;
|
|
}
|
|
this->_holdCountdown = *longerCountdown;
|
|
(this->_holdPosition).x = position->x;
|
|
(this->_holdPosition).y = position->y;
|
|
return;
|
|
}
|
|
|
|
// 006b64d0
|
|
Entity_Effect * Entity_NPC::MakeSplat(float size)
|
|
{
|
|
uint32_t seed;
|
|
Entity *spawned;
|
|
Entity_Effect *splat;
|
|
int vtable;
|
|
|
|
seed = Random();
|
|
spawned = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,7,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(this),0,seed,0);
|
|
splat = (Entity_Effect *)
|
|
__RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor,
|
|
&IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor,0);
|
|
vtable = *GHIDRA_CAST<int *>(splat);
|
|
(splat->_sprite)._scale.x = size;
|
|
(splat->_sprite)._scale.y = size;
|
|
(**(code **)(vtable + 0xc))();
|
|
return splat;
|
|
}
|
|
|
|
// 006b6830
|
|
Entity_Effect * Entity_NPC::MakeBloodCloud(Vector *pos, ColorMod *color)
|
|
{
|
|
uint32_t rngResult;
|
|
Entity_Effect *cloud;
|
|
float in_XMM2_Da;
|
|
int vtable;
|
|
|
|
rngResult = Random();
|
|
cloud = (Entity_Effect *)
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x10,pos,&g_vectorZero,GHIDRA_CAST<Entity *>(this),5,rngResult);
|
|
vtable = *GHIDRA_CAST<int *>(cloud);
|
|
(cloud->_sprite)._scale.x = in_XMM2_Da;
|
|
(cloud->_sprite)._scale.y = in_XMM2_Da;
|
|
(**(code **)(vtable + 0x3c))(color,0xffffffff,0xff,0,1);
|
|
rngResult = Random();
|
|
(cloud->_sprite)._flipX = ~(uint8_t)rngResult & 1;
|
|
rngResult = Random();
|
|
(cloud->_sprite)._flipY = ~(uint8_t)rngResult & 1;
|
|
cloud->Update();
|
|
return cloud;
|
|
}
|
|
|
|
// 006b8450
|
|
uint8_t Entity_NPC::CanShutDoors()
|
|
{
|
|
uint32_t in_EAX;
|
|
|
|
if ((this->_canShutDoors == 0) || (in_EAX = GHIDRA_UINT(this->_flags) & 0x20000000, in_EAX != 0)) {
|
|
return in_EAX & 0xffffff00;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
// 006b8470
|
|
uint8_t Entity_NPC::IsBoss()
|
|
{
|
|
return this->_isBoss;
|
|
}
|
|
|
|
// 006b8480
|
|
uint8_t Entity_NPC::IsChampion()
|
|
{
|
|
return this->_isChampion;
|
|
}
|
|
|
|
// 006b8590
|
|
void Entity_NPC::Constructor()
|
|
{
|
|
int *containerProxy;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
std_deque *deque;
|
|
uint8_t *extraDeque;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00afa52f;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::constructor();
|
|
local_8 = 0;
|
|
*GHIDRA_CAST<uint8_t ***>(this) = IsaacRepentancePlus::Entity_NPC::vftable;
|
|
(GHIDRA_CAST<PathFinder *>((GHIDRA_CAST<PathFinder *>(&this->_pathfinder))))->PathFinder::Init(GHIDRA_CAST<Entity *>(this));
|
|
(this->_killDamageEvents)._begin = (void *)0x0;
|
|
(this->_killDamageEvents)._end = (void *)0x0;
|
|
(this->_killDamageEvents)._capacity = (void *)0x0;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 2;
|
|
deque = &this->_entityDeque;
|
|
(this->_v1).y = 0.0;
|
|
(this->_v1).x = 0.0;
|
|
(this->_v2).y = 0.0;
|
|
(this->_v2).x = 0.0;
|
|
this->_deliriumCycleID = 0;
|
|
this->_deliriumCycleIDHigh = 0;
|
|
deque->_proxy = (void *)0x0;
|
|
(this->_entityDeque)._map = (void *)0x0;
|
|
(this->_entityDeque)._mapSize = 0;
|
|
(this->_entityDeque)._offset = 0;
|
|
(this->_entityDeque)._size = 0;
|
|
containerProxy = operator_new(8);
|
|
containerProxy[1] = 0;
|
|
deque->_proxy = containerProxy;
|
|
*containerProxy = GHIDRA_INT(deque);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 3;
|
|
deque = &this->_vectorDeque1;
|
|
deque->_proxy = (void *)0x0;
|
|
(this->_vectorDeque1)._map = (void *)0x0;
|
|
(this->_vectorDeque1)._mapSize = 0;
|
|
(this->_vectorDeque1)._offset = 0;
|
|
(this->_vectorDeque1)._size = 0;
|
|
containerProxy = operator_new(8);
|
|
containerProxy[1] = 0;
|
|
deque->_proxy = containerProxy;
|
|
*containerProxy = GHIDRA_INT(deque);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 4;
|
|
deque = &this->_vectorDeque2;
|
|
deque->_proxy = (void *)0x0;
|
|
(this->_vectorDeque2)._map = (void *)0x0;
|
|
(this->_vectorDeque2)._mapSize = 0;
|
|
(this->_vectorDeque2)._offset = 0;
|
|
(this->_vectorDeque2)._size = 0;
|
|
containerProxy = operator_new(8);
|
|
containerProxy[1] = 0;
|
|
deque->_proxy = containerProxy;
|
|
*containerProxy = GHIDRA_INT(deque);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 5;
|
|
extraDeque = &(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc48)));
|
|
(this->_confusionTargetPos).y = 0.0;
|
|
(this->_confusionTargetPos).x = 0.0;
|
|
*GHIDRA_CAST<uint32_t *>(extraDeque) = 0;
|
|
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc4c)))) = 0;
|
|
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc50)))) = 0;
|
|
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc54)))) = 0;
|
|
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc58)))) = 0;
|
|
containerProxy = operator_new(8);
|
|
containerProxy[1] = 0;
|
|
*GHIDRA_CAST<int **>(extraDeque) = containerProxy;
|
|
*containerProxy = GHIDRA_INT(extraDeque);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 6;
|
|
(this->_floorColor)._tint[0] = 1.0;
|
|
(this->_floorColor)._tint[1] = 1.0;
|
|
(this->_floorColor)._tint[2] = 1.0;
|
|
(this->_floorColor)._tint[3] = 1.0;
|
|
(this->_floorColor)._colorize[0] = 0.0;
|
|
(this->_floorColor)._colorize[1] = 0.0;
|
|
(this->_floorColor)._colorize[2] = 0.0;
|
|
(this->_floorColor)._colorize[3] = 0.0;
|
|
(this->_floorColor)._offset[0] = 0.0;
|
|
(this->_floorColor)._offset[1] = 0.0;
|
|
(this->_floorColor)._offset[2] = 0.0;
|
|
(this->_dirtColor)._tint[0] = 1.0;
|
|
(this->_dirtColor)._tint[1] = 1.0;
|
|
(this->_dirtColor)._tint[2] = 1.0;
|
|
(this->_dirtColor)._tint[3] = 1.0;
|
|
(this->_dirtColor)._colorize[0] = 0.0;
|
|
(this->_dirtColor)._colorize[1] = 0.0;
|
|
(this->_dirtColor)._colorize[2] = 0.0;
|
|
(this->_dirtColor)._colorize[3] = 0.0;
|
|
(this->_dirtColor)._offset[0] = 0.0;
|
|
(this->_dirtColor)._offset[1] = 0.0;
|
|
(this->_dirtColor)._offset[2] = 0.0;
|
|
ANM2::constructor(&this->_statusEffectSprite);
|
|
local_8 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),7);
|
|
ANM2::constructor(&this->_chargeBarSprite);
|
|
(this->_hitList)._begin = (void *)0x0;
|
|
(this->_hitList)._end = (void *)0x0;
|
|
(this->_hitList)._capacity = (void *)0x0;
|
|
(this->_secondaryHitList)._begin = (void *)0x0;
|
|
(this->_secondaryHitList)._end = (void *)0x0;
|
|
(this->_secondaryHitList)._capacity = (void *)0x0;
|
|
this->_pickupGhostsEntity = (void *)0x0;
|
|
(this->_controllerMovement).y = 0.0;
|
|
(this->_controllerMovement).x = 0.0;
|
|
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf54)))) = 0;
|
|
(this->_forwardVector).y = 0.0;
|
|
(this->_forwardVector).x = 0.0;
|
|
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf58)))) = 0;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf5c))) = 0;
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 006b8b20
|
|
void Entity_NPC::Init(int type, int variant, int subType, uint32_t initSeed)
|
|
{
|
|
float fVar1;
|
|
uint32_t zeroColor [8];
|
|
uint32_t local_14;
|
|
uint32_t uStack_10;
|
|
uint32_t local_c;
|
|
void **eraseRef;
|
|
uint8_t *field4Ref;
|
|
void **pickupGhostRef;
|
|
int *roomBossCount;
|
|
|
|
this->_isChampion = 0;
|
|
pickupGhostRef = &this->_pickupGhostsEntity;
|
|
this->_championColorIdx = -1;
|
|
this->_flickerTimer = 0;
|
|
this->_flickerState = 0;
|
|
this->_flickerAlpha = 1.0;
|
|
this->_championSpeed = 1.0;
|
|
this->_bosscoloridx = -1;
|
|
this->_isUnreachableOnce = 0;
|
|
this->_scale = 1.0;
|
|
this->_shieldStrength = 0.0;
|
|
this->_shieldFrames = 0x78;
|
|
this->_deliriumBossType = 0;
|
|
this->_deliriumBossVariant = 0;
|
|
this->_deliriumTransformationTimer = 0;
|
|
this->_deliriumRemainingAttacks = 0;
|
|
this->_deliriumState = 0;
|
|
this->_deliriumEntity = (void *)0x0;
|
|
this->_isBestiaryEncountered = 0;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf5c))) = 0;
|
|
this->_aiCallFlags = 0;
|
|
this->_controllerID = -1;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf2c))) = 0;
|
|
(this->_controllerMovement).x = g_vectorZero.x;
|
|
(this->_controllerMovement).y = g_vectorZero.y;
|
|
this->_aimTargetEffect = (void *)0x0;
|
|
(this->_forwardVector).x = g_vectorZero.x;
|
|
(this->_forwardVector).y = g_vectorZero.y;
|
|
this->_forcedTarget = 0;
|
|
this->_forcedTargetTimer = 0;
|
|
this->_sirenPlayerEntity = (void *)0x0;
|
|
this->_hitPointsMulti = 1.0;
|
|
this->_scaleMulti = 1.0;
|
|
this->_lastGridIndex = -1;
|
|
if (*pickupGhostRef != GHIDRA_CAST<int *>(0x0)) {
|
|
(**(code **)(*GHIDRA_CAST<int *>(*pickupGhostRef) + 0x28))();
|
|
if (*pickupGhostRef != (void *)0x0) {
|
|
eraseRef = pickupGhostRef;
|
|
msvc::multiset<unsigned_int>::erase(&eraseRef);
|
|
*pickupGhostRef = (void *)0x0;
|
|
}
|
|
}
|
|
field4Ref = &(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf58)));
|
|
if (*GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf58)))) != GHIDRA_CAST<int *>(0x0)) {
|
|
(**(code **)(**GHIDRA_CAST<int **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf58)))) + 0x28))();
|
|
if (*GHIDRA_CAST<int *>(field4Ref) != 0) {
|
|
eraseRef = (void **)field4Ref;
|
|
msvc::multiset<unsigned_int>::erase(&eraseRef);
|
|
*GHIDRA_CAST<uint32_t *>(field4Ref) = 0;
|
|
}
|
|
}
|
|
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf54)))) != 0) {
|
|
eraseRef = (void **)&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf54)));
|
|
msvc::multiset<unsigned_int>::erase(&eraseRef);
|
|
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf54)))) = 0;
|
|
}
|
|
(this->_killDamageEvents)._end = (this->_killDamageEvents)._begin;
|
|
this->_killDamage = 0.0;
|
|
*GHIDRA_CAST<uint32_t *>(&this->_killDamageFlags) = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_killDamageFlags) + 4)) = 0;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::Init(type,variant,subType,initSeed);
|
|
*GHIDRA_CAST<uint32_t *>(&this->_flags) = GHIDRA_UINT(this->_flags) | 4;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
|
|
this->_state = 1;
|
|
this->_savedState = 0;
|
|
this->_aiCallPhase = 0;
|
|
this->_stateFrame = 0;
|
|
this->_aiCounter = 0;
|
|
this->_appearFrames = 0;
|
|
this->_decoyTargetTimer = 0;
|
|
this->_groupIdx = -1;
|
|
(this->_targetPosition).x = g_vectorZero.x;
|
|
(this->_targetPosition).y = g_vectorZero.y;
|
|
(this->_confusionTargetPos).x = g_vectorZero.x;
|
|
(this->_confusionTargetPos).y = g_vectorZero.y;
|
|
this->_aiFloat = 1.0;
|
|
(this->_v1).x = g_vectorZero.x;
|
|
(this->_v1).y = g_vectorZero.y;
|
|
(this->_v2).x = g_vectorZero.x;
|
|
(this->_v2).y = g_vectorZero.y;
|
|
this->_championRegenTimer = 0;
|
|
this->_championRegenCount = 0;
|
|
this->_holdCountdown = 0;
|
|
this->_i1 = 0;
|
|
this->_i2 = 0;
|
|
this->_entityRef = 0;
|
|
this->_projectileCooldown = 0;
|
|
this->_projectileDelay = -1;
|
|
this->_championTimer = 0;
|
|
(this->_holdPosition).x = g_vectorZero.x;
|
|
fVar1 = g_vectorZero.y;
|
|
*GHIDRA_CAST<uint16_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc61)))) = 0;
|
|
local_14 = 0;
|
|
uStack_10 = 0;
|
|
local_c = 0;
|
|
(this->_holdPosition).y = fVar1;
|
|
if (&this->_floorColor != GHIDRA_CAST<ColorMod *>(zeroColor)) {
|
|
(this->_floorColor)._colorize[0] = 0.0;
|
|
(this->_floorColor)._colorize[1] = 0.0;
|
|
(this->_floorColor)._colorize[2] = 0.0;
|
|
(this->_floorColor)._colorize[3] = 0.0;
|
|
(this->_floorColor)._offset[0] = 0.0;
|
|
(this->_floorColor)._offset[1] = 0.0;
|
|
(this->_floorColor)._tint[0] = 0.0;
|
|
(this->_floorColor)._tint[1] = 0.0;
|
|
(this->_floorColor)._tint[2] = 0.0;
|
|
(this->_floorColor)._tint[3] = 0.0;
|
|
(this->_floorColor)._offset[2] = 0.0;
|
|
}
|
|
(this->_hitList)._end = (this->_hitList)._begin;
|
|
(this->_secondaryHitList)._end = (this->_secondaryHitList)._begin;
|
|
(GHIDRA_CAST<PathFinder *>((GHIDRA_CAST<PathFinder *>(&this->_pathfinder))))->PathFinder::Reset();
|
|
if (this->_isBoss != 0) {
|
|
roomBossCount = GHIDRA_CAST<int *>((GHIDRA_INT(g_game->_room) + 0x7224));
|
|
*roomBossCount = *roomBossCount + 1;
|
|
}
|
|
this->_totalDamageTaken = 0.0;
|
|
FUN_00860880(this);
|
|
return;
|
|
}
|
|
|
|
// 006b8f00
|
|
void Entity_NPC::Remove()
|
|
{
|
|
if (((this->_type == 0x362) && (this->_variant == 0)) && (GHIDRA_CAST<int *>(this->_child) != GHIDRA_CAST<int *>(0x0))) {
|
|
(**(code **)(*GHIDRA_CAST<int *>(this->_child) + 0x28))();
|
|
}
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::Remove();
|
|
return;
|
|
}
|
|
|
|
// 006b8f30
|
|
void Entity_NPC::ClearReferences()
|
|
{
|
|
Entity_Familiar *childField;
|
|
uint64_t qVar2;
|
|
Entity_NPC *childNpc;
|
|
int iVar3;
|
|
void *pvVar4;
|
|
uint32_t uVar5;
|
|
uint64_t *allocatedBytes;
|
|
uint32_t *childParentField;
|
|
EntityList_EL familiars;
|
|
Entity_NPC *local_1c;
|
|
uint32_t *local_18;
|
|
uint32_t *local_14;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
void **aimTargetField;
|
|
uint32_t *childField;
|
|
float childHealth;
|
|
float childMaxHp;
|
|
uint32_t flagsHigh;
|
|
Game *game;
|
|
std_vector *hitList;
|
|
void *oldData;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00af341d;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
iVar3 = this->_type;
|
|
if (iVar3 == 0x3c6) {
|
|
childField = GHIDRA_CAST<Entity_Familiar *>(this->_target);
|
|
if (((childField != GHIDRA_CAST<Entity_Familiar *>(0x0)) && (childField->_type == 3)) &&
|
|
((childField->_flags & 0x100) != 0)) {
|
|
(GHIDRA_CAST<Entity_Familiar *>((childField)))->Entity_Familiar::RemoveFromPlayer();
|
|
iVar3 = this->_type;
|
|
goto LAB_006b8f98;
|
|
}
|
|
}
|
|
else {
|
|
LAB_006b8f98:
|
|
if (iVar3 == 0x38b) {
|
|
iVar3 = this->_child;
|
|
childField = &this->_child;
|
|
if (iVar3 != 0) {
|
|
childParentField = GHIDRA_CAST<uint32_t *>((iVar3 + 0x3bc));
|
|
local_18 = GHIDRA_CAST<uint32_t *>(this->_parent);
|
|
if (*GHIDRA_CAST<int *>((iVar3 + 0x3bc)) != 0) {
|
|
local_14 = childParentField;
|
|
msvc::multiset<unsigned_int>::erase(&local_14);
|
|
}
|
|
*childParentField = local_18;
|
|
if (local_18 != GHIDRA_CAST<uint32_t *>(0x0)) {
|
|
msvc::multiset<unsigned_int>::insert(childParentField);
|
|
}
|
|
}
|
|
iVar3 = this->_parent;
|
|
childParentField = &this->_parent;
|
|
if (iVar3 != 0) {
|
|
local_14 = GHIDRA_CAST<uint32_t *>((iVar3 + 0x3c0));
|
|
local_1c = GHIDRA_CAST<Entity_NPC *>(*childField);
|
|
if (*GHIDRA_CAST<int *>((iVar3 + 0x3c0)) != 0) {
|
|
local_18 = local_14;
|
|
msvc::multiset<unsigned_int>::erase(&local_18);
|
|
}
|
|
*local_14 = local_1c;
|
|
if (local_1c != GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
|
msvc::multiset<unsigned_int>::insert(local_14);
|
|
}
|
|
}
|
|
if ((*childParentField == 0) && (childNpc = ChildNPC(this), childNpc != GHIDRA_CAST<Entity_NPC *>(0x0))) {
|
|
local_1c = ChildNPC(this);
|
|
game = g_game;
|
|
childMaxHp = local_1c->_maxHitPoints;
|
|
childHealth = local_1c->_health;
|
|
*GHIDRA_CAST<short *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&((g_game->_hud))) + 0x54ba)))) = (short)GHIDRA_INT(childMaxHp);
|
|
*GHIDRA_CAST<short *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&((game->_hud))) + 0x54b8)))) = (short)GHIDRA_INT(((childMaxHp - childHealth) + 1.0));
|
|
uVar5 = GHIDRA_UINT(local_1c->_flags);
|
|
flagsHigh = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&local_1c->_flags) + 4));
|
|
*GHIDRA_CAST<uint32_t *>(&local_1c->_flags) = uVar5 & 0x7fffffff;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&local_1c->_flags) + 4)) = flagsHigh;
|
|
if (this->_subtype == 0) {
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&local_1c->_flags) + 4)) = flagsHigh;
|
|
*GHIDRA_CAST<uint32_t *>(&local_1c->_flags) = uVar5 & 0x7fefffff;
|
|
}
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(local_1c))))->Entity::SetVisibleFlag(1);
|
|
}
|
|
if (*childParentField != 0) {
|
|
local_1c = GHIDRA_CAST<Entity_NPC *>(childParentField);
|
|
msvc::multiset<unsigned_int>::erase(&local_1c);
|
|
}
|
|
*childParentField = 0;
|
|
if (*childField != 0) {
|
|
local_1c = GHIDRA_CAST<Entity_NPC *>(childField);
|
|
msvc::multiset<unsigned_int>::erase(&local_1c);
|
|
}
|
|
iVar3 = this->_type;
|
|
*childField = 0;
|
|
}
|
|
if ((iVar3 == 0x390) && ((this->_variant == 0 || (this->_variant == 10)))) {
|
|
SFXManager::Stop(&g_manager->_sfxManager,0x280);
|
|
SFXManager::Stop(&g_manager->_sfxManager,0x1b8);
|
|
}
|
|
}
|
|
if (this->_pickupGhostsEntity != (void *)0x0) {
|
|
local_1c = GHIDRA_CAST<Entity_NPC *>(&this->_pickupGhostsEntity);
|
|
msvc::multiset<unsigned_int>::erase(&local_1c);
|
|
this->_pickupGhostsEntity = (void *)0x0;
|
|
}
|
|
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf54)))) != 0) {
|
|
local_1c = GHIDRA_CAST<Entity_NPC *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf54))));
|
|
msvc::multiset<unsigned_int>::erase(&local_1c);
|
|
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf54)))) = 0;
|
|
}
|
|
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf58)))) != 0) {
|
|
local_1c = GHIDRA_CAST<Entity_NPC *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf58))));
|
|
msvc::multiset<unsigned_int>::erase(&local_1c);
|
|
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf58)))) = 0;
|
|
}
|
|
if (this->_entityRef != 0) {
|
|
local_1c = GHIDRA_CAST<Entity_NPC *>(&this->_entityRef);
|
|
msvc::multiset<unsigned_int>::erase(&local_1c);
|
|
}
|
|
this->_entityRef = 0;
|
|
aimTargetField = &this->_aimTargetEffect;
|
|
if (*aimTargetField != GHIDRA_CAST<int *>(0x0)) {
|
|
(**(code **)(*GHIDRA_CAST<int *>(*aimTargetField) + 0x28))();
|
|
}
|
|
if (*aimTargetField != (void *)0x0) {
|
|
local_1c = GHIDRA_CAST<Entity_NPC *>(aimTargetField);
|
|
msvc::multiset<unsigned_int>::erase(&local_1c);
|
|
}
|
|
*aimTargetField = (void *)0x0;
|
|
ClearDequeRefs(this);
|
|
if (this->_forcedTarget != 0) {
|
|
local_1c = GHIDRA_CAST<Entity_NPC *>(&this->_forcedTarget);
|
|
msvc::multiset<unsigned_int>::erase(&local_1c);
|
|
}
|
|
this->_forcedTarget = 0;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::ClearReferences();
|
|
msvc::deque<ptr>::_Tidy();
|
|
msvc::deque<ptr>::_Tidy();
|
|
msvc::deque<ptr>::_Tidy();
|
|
ANM2::Reset(&this->_statusEffectSprite);
|
|
ANM2::Reset(&this->_chargeBarSprite);
|
|
hitList = &this->_hitList;
|
|
if (GHIDRA_CAST<std_vector *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(familiars)) + 0x4)))) != hitList) {
|
|
oldData = hitList->_begin;
|
|
pvVar4 = (this->_hitList)._capacity;
|
|
hitList->_begin = (void *)0x0;
|
|
(this->_hitList)._end = (void *)0x0;
|
|
(this->_hitList)._capacity = (void *)0x0;
|
|
if (oldData != (void *)0x0) {
|
|
uVar5 = GHIDRA_INT(pvVar4) - GHIDRA_INT(oldData) & 0xfffffffc;
|
|
pvVar4 = oldData;
|
|
if (0xfff < uVar5) {
|
|
pvVar4 = *(void **)(GHIDRA_CAST<char *>(oldData) + -4);
|
|
uVar5 = uVar5 + 0x23;
|
|
if (0x1f < GHIDRA_UINT((GHIDRA_INT(oldData) + (-4 - GHIDRA_INT(pvVar4))))) goto LAB_006b93e7;
|
|
}
|
|
operator_delete(pvVar4,uVar5);
|
|
}
|
|
}
|
|
hitList = &this->_secondaryHitList;
|
|
if (GHIDRA_CAST<std_vector *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(familiars)) + 0x4)))) != hitList) {
|
|
oldData = hitList->_begin;
|
|
pvVar4 = (this->_secondaryHitList)._capacity;
|
|
hitList->_begin = (void *)0x0;
|
|
(this->_secondaryHitList)._end = (void *)0x0;
|
|
(this->_secondaryHitList)._capacity = (void *)0x0;
|
|
if (oldData != (void *)0x0) {
|
|
uVar5 = GHIDRA_INT(pvVar4) - GHIDRA_INT(oldData) & 0xfffffffc;
|
|
pvVar4 = oldData;
|
|
if (0xfff < uVar5) {
|
|
pvVar4 = *(void **)(GHIDRA_CAST<char *>(oldData) + -4);
|
|
uVar5 = uVar5 + 0x23;
|
|
if (0x1f < GHIDRA_UINT((GHIDRA_INT(oldData) + (-4 - GHIDRA_INT(pvVar4))))) {
|
|
LAB_006b93e7:
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(pvVar4,uVar5);
|
|
}
|
|
}
|
|
if (this->_sirenPlayerEntity != (void *)0x0) {
|
|
EntityList::QuerySublist(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),&familiars,3,-1,-1,0,0);
|
|
local_8 = 0;
|
|
uVar5 = 0;
|
|
if (familiars._size != 0) {
|
|
do {
|
|
childField = *GHIDRA_CAST<Entity_Familiar **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(familiars)) + 0x4))) + uVar5 * 4));
|
|
if (((childField != GHIDRA_CAST<Entity_Familiar *>(0x0)) && (childField->_type == 3)) &&
|
|
(childField->_player == this->_sirenPlayerEntity)) {
|
|
(GHIDRA_CAST<Entity_Familiar *>((childField)))->Entity_Familiar::RemoveFromPlayer();
|
|
}
|
|
uVar5 = uVar5 + 1;
|
|
} while (uVar5 < GHIDRA_UINT(familiars._size));
|
|
}
|
|
(**(code **)(*GHIDRA_CAST<int *>(this->_sirenPlayerEntity) + 0x44))();
|
|
if (this->_sirenPlayerEntity != GHIDRA_CAST<uint32_t *>(0x0)) {
|
|
(*(code *)**GHIDRA_CAST<uint32_t **>(this->_sirenPlayerEntity))(1);
|
|
this->_sirenPlayerEntity = (void *)0x0;
|
|
}
|
|
local_8 = 0xffffffff;
|
|
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(familiars)) + 0x0))) == '\0') {
|
|
if (g_mainHeap == (void *)0x0) {
|
|
allocatedBytes = &g_allocatedBytesNoHeap;
|
|
}
|
|
else {
|
|
allocatedBytes = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
|
|
}
|
|
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(familiars)) + 0x4))) != 0) {
|
|
uVar5 = *GHIDRA_CAST<uint32_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(familiars)) + 0x4))) + -4));
|
|
qVar2 = *allocatedBytes;
|
|
*GHIDRA_CAST<uint32_t *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar5;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < uVar5));
|
|
free((void *)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(familiars)) + 0x4))) + -4));
|
|
}
|
|
local_8 = 0xffffffff;
|
|
}
|
|
}
|
|
if ((this->_type == 0x387) && (this->_variant == 10)) {
|
|
SFXManager::Stop(&g_manager->_sfxManager,0x1f7);
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 006b9910
|
|
uint8_t Entity_NPC::TryForceTarget(Entity *Target, int Duration)
|
|
{
|
|
float newTargetDy;
|
|
float fVar1;
|
|
float fVar2;
|
|
float newTargetDx;
|
|
Entity_NPC *local_c [2];
|
|
Entity *currentTarget;
|
|
uint32_t *forcedTargetRef;
|
|
|
|
if (this->_forcedTargetTimer < 0) {
|
|
return 0;
|
|
}
|
|
currentTarget = GHIDRA_CAST<Entity *>(this->_forcedTarget);
|
|
forcedTargetRef = &this->_forcedTarget;
|
|
if (currentTarget == GHIDRA_CAST<Entity *>(0x0)) {
|
|
if (Target == GHIDRA_CAST<Entity *>(0x0)) goto LAB_006b99c8;
|
|
}
|
|
else {
|
|
if (currentTarget == Target) goto LAB_006b99c8;
|
|
fVar1 = (this->_pos).x;
|
|
fVar2 = (this->_pos).y;
|
|
newTargetDx = fVar1 - (Target->_pos).x;
|
|
fVar1 = fVar1 - (currentTarget->_pos).x;
|
|
newTargetDy = fVar2 - (Target->_pos).y;
|
|
fVar2 = fVar2 - (currentTarget->_pos).y;
|
|
if (fVar2 * fVar2 + fVar1 * fVar1 <= newTargetDy * newTargetDy + newTargetDx * newTargetDx) {
|
|
return 0;
|
|
}
|
|
}
|
|
local_c[0] = this;
|
|
if (currentTarget != GHIDRA_CAST<Entity *>(0x0)) {
|
|
local_c[0] = GHIDRA_CAST<Entity_NPC *>(forcedTargetRef);
|
|
msvc::multiset<unsigned_int>::erase(local_c);
|
|
}
|
|
*forcedTargetRef = Target;
|
|
if (Target != GHIDRA_CAST<Entity *>(0x0)) {
|
|
msvc::multiset<unsigned_int>::insert(forcedTargetRef);
|
|
}
|
|
LAB_006b99c8:
|
|
this->_forcedTargetTimer = Duration;
|
|
return 1;
|
|
}
|
|
|
|
// 006b99e0
|
|
float Entity_NPC::compute_speed_multiplier()
|
|
{
|
|
uint64_t qVar1;
|
|
char cVar2;
|
|
uint8_t isHasEffect;
|
|
TemporaryEffects *roomTempEffects;
|
|
void *pvVar3;
|
|
uint32_t uVar4;
|
|
float fVar5;
|
|
float local_10;
|
|
Game *game;
|
|
|
|
local_10 = (GHIDRA_CAST<Room *>((g_game->_room)))->Room::GetTimeScale(GHIDRA_CAST<Vector *>(this),GHIDRA_CAST<Entity *>(this));
|
|
game = g_game;
|
|
qVar1 = this->_flags;
|
|
uVar4 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
|
|
if ((qVar1 & 0x20000000) == 0) {
|
|
roomTempEffects = GHIDRA_CAST<TemporaryEffects *>((GHIDRA_INT(g_game->_room) + 0x7310));
|
|
isHasEffect = (GHIDRA_CAST<TemporaryEffects *>((roomTempEffects)))->TemporaryEffects::HasCollectibleEffect(0xe8);
|
|
if ((isHasEffect == 0) &&
|
|
((game->_challenge == 0x16 || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(game->_room) + 0x1210)) != 1)))) {
|
|
pvVar3 = (GHIDRA_CAST<TemporaryEffects *>((roomTempEffects)))->TemporaryEffects::GetCollectibleEffect(0x42);
|
|
uVar4 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
|
|
if (pvVar3 != (void *)0x0) {
|
|
fVar5 = ((float)*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar3) + 8)) - 0.0) / 30.0;
|
|
if (fVar5 <= 0.0) {
|
|
fVar5 = 0.0;
|
|
}
|
|
if (1.0 <= fVar5) {
|
|
fVar5 = 1.0;
|
|
}
|
|
local_10 = (1.0 - fVar5 * 0.5) * local_10;
|
|
}
|
|
}
|
|
else {
|
|
uVar4 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
|
|
local_10 = local_10 * 0.5;
|
|
}
|
|
}
|
|
else if (0 < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0x722c))) {
|
|
local_10 = local_10 * 0.5;
|
|
}
|
|
if (((qVar1 & 0x80) != 0) && (this->_state != 0x12)) {
|
|
local_10 = local_10 * 0.5;
|
|
}
|
|
if ((uVar4 & 0x400000) != 0) {
|
|
local_10 = local_10 * 0.65;
|
|
}
|
|
cVar2 = this->IsBoss();
|
|
if (((cVar2 == '\0') || ((this->_flags & 0x20000000) != 0)) ||
|
|
(isHasEffect = TemporaryEffects::HasCollectibleEffect
|
|
(GHIDRA_CAST<TemporaryEffects *>((GHIDRA_INT(g_game->_room) + 0x7310)),0x2b9),
|
|
isHasEffect == 0)) {
|
|
return local_10;
|
|
}
|
|
return local_10 * 0.75;
|
|
}
|
|
|
|
// 006baf40
|
|
void Entity_NPC::load_graphics(uint8_t param_2)
|
|
{
|
|
uint32_t uVar1;
|
|
std_string **ppsVar2;
|
|
uint8_t isChampionColored;
|
|
std_string *psVar4;
|
|
void **bossColorPath;
|
|
LayerState *layer;
|
|
uint8_t *suffixEnd;
|
|
ANM2 *sprite;
|
|
std_string *psVar5;
|
|
uint8_t *size;
|
|
void *freeBlock;
|
|
ColorMod *championColor;
|
|
uint32_t uVar6;
|
|
char *pcVar7;
|
|
uint32_t uVar8;
|
|
float r;
|
|
float in_XMM2_Da;
|
|
float in_XMM3_Da;
|
|
uint32_t local_118 [8];
|
|
uint32_t local_f8;
|
|
uint32_t uStack_f4;
|
|
uint32_t local_f0;
|
|
Color local_ec;
|
|
Entity_NPC *self;
|
|
Sprite *layerSprite;
|
|
std_string *local_b8;
|
|
uint32_t local_b4;
|
|
uint8_t *layerIndex;
|
|
LayerState *local_ac;
|
|
uint8_t *local_a8;
|
|
uint32_t local_a4;
|
|
char isDirtColorNeeded;
|
|
char isChampionSheetUsed;
|
|
uint8_t local_9d;
|
|
std_string resolvedSheetPath;
|
|
std_string championSuffix;
|
|
std_string sheetOverridePath;
|
|
std_string local_54;
|
|
std_string layerString;
|
|
uint32_t local_24;
|
|
std_string **ppsStack_20;
|
|
void *local_1c;
|
|
uint8_t *puStack_18;
|
|
uint32_t local_14;
|
|
int bossColorPathSize;
|
|
Game *game;
|
|
bool isChampionColored;
|
|
int *spriteBitflags;
|
|
|
|
ppsStack_20 = GHIDRA_CAST<std_string **>((GHIDRA_INT(&layerString) + 0x38));
|
|
local_14 = 0xffffffff;
|
|
puStack_18 = &LAB_00afa79f;
|
|
local_1c = ExceptionList;
|
|
local_24 = __security_cookie ^ GHIDRA_INT(&layerString) + 0x2cU;
|
|
ExceptionList = &local_1c;
|
|
uVar8 = 0;
|
|
local_b4 = 0;
|
|
self = this;
|
|
ppsVar2 = GHIDRA_CAST<std_string **>((GHIDRA_INT(&layerString) + 0x38));
|
|
if (param_2 != 0) {
|
|
if (this->_bosscoloridx < 0) {
|
|
LAB_006bafec:
|
|
psVar4 = GHIDRA_CAST<std_string *>((GHIDRA_INT(this->_config) + 0x74));
|
|
}
|
|
else {
|
|
local_a8 = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(this->_config) + 0x68));
|
|
if ((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this->_config) + 0x6c)) - GHIDRA_INT(local_a8)) / 0x7c <= this->_bosscoloridx)
|
|
goto LAB_006bafec;
|
|
bossColorPathSize = this->_bosscoloridx * 0x7c;
|
|
if (*GHIDRA_CAST<int *>((local_a8 + bossColorPathSize + 0x54)) == 0) goto LAB_006bafec;
|
|
psVar4 = GHIDRA_CAST<std_string *>((local_a8 + bossColorPathSize + 0x44));
|
|
}
|
|
ANM2::Load(&this->_sprite,psVar4,0);
|
|
local_ac = GHIDRA_CAST<LayerState *>(&(g_game->_seedEffects)._seedEffects);
|
|
local_a8 = GHIDRA_CAST<uint8_t *>(0x4f);
|
|
msvc::set<int>::find_node(local_54._buf + 0xc,&local_a8);
|
|
ppsVar2 = ppsStack_20;
|
|
if ((((*GHIDRA_CAST<char *>((local_54._capacity + 0xd)) == '\0') &&
|
|
(*GHIDRA_CAST<int *>((local_54._capacity + 0x10)) < 0x50)) &&
|
|
(GHIDRA_CAST<uint8_t *>(local_54._capacity) != local_ac->_layerData)) &&
|
|
((this->_type == 0x66 && (this->_variant == 1)))) {
|
|
local_54._size = 0;
|
|
local_54._capacity = 0xf;
|
|
local_54._buf[0] = '\0';
|
|
local_54._buf[1] = '\0';
|
|
local_54._buf[2] = '\0';
|
|
local_54._buf[3] = '\0';
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) = msvc::_Allocate(0x40);
|
|
local_54._size = 0x35;
|
|
local_54._capacity = 0x3f;
|
|
builtin_strncpy((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(local_54._buf))) + 0x0))),
|
|
"gfx/promo/gfuel/102.001_g baby (true final boss).anm2",0x36);
|
|
local_14 = 0;
|
|
ANM2::Load(&this->_sprite,&local_54,1);
|
|
local_14 = 0xffffffff;
|
|
if (0xf < local_54._capacity) {
|
|
uVar6 = local_54._capacity + 1;
|
|
pcVar7 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(local_54._buf))) + 0x0)));
|
|
if (0xfff < uVar6) {
|
|
pcVar7 = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + -4));
|
|
uVar6 = local_54._capacity + 0x24;
|
|
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) + (-4 - GHIDRA_INT(pcVar7))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(pcVar7,uVar6);
|
|
}
|
|
local_54._size = 0;
|
|
local_54._capacity = GHIDRA_UINT(&DAT_0000000f);
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) & 0xffffff00;
|
|
ppsVar2 = ppsStack_20;
|
|
}
|
|
}
|
|
ppsStack_20 = ppsVar2;
|
|
game = g_game;
|
|
sheetOverridePath._size = 0;
|
|
sheetOverridePath._capacity = 0xf;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(sheetOverridePath._buf)) + 0x0))) = (void *)0x0;
|
|
local_14 = 1;
|
|
if (this->_bosscoloridx < 0) {
|
|
LAB_006bb1b0:
|
|
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this->_config) + 0xcd)) != '\0') {
|
|
uVar8 = Level::GetStageID();
|
|
(GHIDRA_CAST<msvc::string *>((resolvedSheetPath._buf)))->msvc::string::string(game->_ventricleRazorPortals + uVar8 * 0xc4 + 0x5e4);
|
|
uVar8 = 4;
|
|
sheetOverridePath._buf[0] = resolvedSheetPath._buf[0];
|
|
sheetOverridePath._buf[1] = resolvedSheetPath._buf[1];
|
|
sheetOverridePath._buf[2] = resolvedSheetPath._buf[2];
|
|
sheetOverridePath._buf[3] = resolvedSheetPath._buf[3];
|
|
sheetOverridePath._buf[4] = resolvedSheetPath._buf[4];
|
|
sheetOverridePath._buf[5] = resolvedSheetPath._buf[5];
|
|
sheetOverridePath._buf[6] = resolvedSheetPath._buf[6];
|
|
sheetOverridePath._buf[7] = resolvedSheetPath._buf[7];
|
|
sheetOverridePath._buf[8] = resolvedSheetPath._buf[8];
|
|
sheetOverridePath._buf[9] = resolvedSheetPath._buf[9];
|
|
sheetOverridePath._buf[10] = resolvedSheetPath._buf[10];
|
|
sheetOverridePath._buf[0xb] = resolvedSheetPath._buf[0xb];
|
|
sheetOverridePath._buf[0xc] = resolvedSheetPath._buf[0xc];
|
|
sheetOverridePath._buf[0xd] = resolvedSheetPath._buf[0xd];
|
|
sheetOverridePath._buf[0xe] = resolvedSheetPath._buf[0xe];
|
|
sheetOverridePath._buf[0xf] = resolvedSheetPath._buf[0xf];
|
|
sheetOverridePath._size = resolvedSheetPath._size;
|
|
sheetOverridePath._capacity = resolvedSheetPath._capacity;
|
|
}
|
|
}
|
|
else {
|
|
local_a8 = *GHIDRA_CAST<uint8_t **>((GHIDRA_CAST<char *>(this->_config) + 0x68));
|
|
if ((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this->_config) + 0x6c)) - GHIDRA_INT(local_a8)) / 0x7c <= this->_bosscoloridx)
|
|
goto LAB_006bb1b0;
|
|
bossColorPath = (void **)(local_a8 + this->_bosscoloridx * 0x7c + 0x2c);
|
|
if (&sheetOverridePath != GHIDRA_CAST<std_string *>(bossColorPath)) {
|
|
bossColorPathSize = GHIDRA_INT((bossColorPath + 4));
|
|
if (0xf < bossColorPath[5]) {
|
|
bossColorPath = *bossColorPath;
|
|
}
|
|
(GHIDRA_CAST<msvc::string *>((sheetOverridePath._buf)))->msvc::string::assign(GHIDRA_CAST<uint8_t *>(bossColorPath),*GHIDRA_CAST<uint32_t *>(bossColorPathSize));
|
|
}
|
|
}
|
|
r = 0.0;
|
|
isChampionSheetUsed = '\0';
|
|
isDirtColorNeeded = '\0';
|
|
if ((this->_isChampion == 0) || (0x19 < GHIDRA_UINT(this->_championColorIdx))) {
|
|
local_a8 = GHIDRA_CAST<uint8_t *>(0x0);
|
|
LAB_006bb24b:
|
|
isChampionColored = false;
|
|
}
|
|
else {
|
|
bossColorPathSize = this->_championColorIdx * 0x40;
|
|
local_a8 = &DAT_00c354c0 + bossColorPathSize;
|
|
if (local_a8 == GHIDRA_CAST<uint8_t *>(0x0)) goto LAB_006bb24b;
|
|
if (*GHIDRA_CAST<float *>((&DAT_00c354cc + bossColorPathSize)) <= 0.0) goto LAB_006bb24b;
|
|
isChampionColored = true;
|
|
}
|
|
championSuffix._size = 0;
|
|
pcVar7 = "_champion";
|
|
championSuffix._capacity = 0xf;
|
|
if (!isChampionColored) {
|
|
pcVar7 = GHIDRA_CAST<char *>(&s_empty);
|
|
}
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(championSuffix._buf)) + 0x0))) = (void *)0x0;
|
|
local_ac = GHIDRA_CAST<LayerState *>((pcVar7 + 1));
|
|
suffixEnd = GHIDRA_CAST<uint8_t *>(pcVar7);
|
|
do {
|
|
isChampionColored = *suffixEnd;
|
|
suffixEnd = suffixEnd + 1;
|
|
} while (isChampionColored != 0);
|
|
(GHIDRA_CAST<msvc::string *>((championSuffix._buf)))->msvc::string::assign(GHIDRA_CAST<uint8_t *>(pcVar7),GHIDRA_INT(suffixEnd) - GHIDRA_INT(local_ac));
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
|
|
layerIndex = GHIDRA_CAST<uint8_t *>(0x0);
|
|
if ((this->_sprite)._layerCount == 0) {
|
|
LAB_006bb675:
|
|
championColor = &(this->_sprite)._championColor;
|
|
local_f8 = 0;
|
|
uStack_f4 = 0;
|
|
local_f0 = 0;
|
|
if (championColor != GHIDRA_CAST<ColorMod *>(local_118)) {
|
|
local_ec._offset[2] = 0.0;
|
|
(this->_sprite)._championColor._colorize[0] = 0.0;
|
|
(this->_sprite)._championColor._colorize[1] = 0.0;
|
|
(this->_sprite)._championColor._colorize[2] = 0.0;
|
|
(this->_sprite)._championColor._colorize[3] = 0.0;
|
|
local_ec._offset[0] = 0.0;
|
|
local_ec._offset[1] = 0.0;
|
|
championColor->_tint[0] = 0.0;
|
|
(this->_sprite)._championColor._tint[1] = 0.0;
|
|
(this->_sprite)._championColor._tint[2] = 0.0;
|
|
(this->_sprite)._championColor._tint[3] = 0.0;
|
|
LAB_006bb6be:
|
|
*GHIDRA_CAST<uint64_t *>(championColor->_offset) = (*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(local_ec._offset)) + 0x0)));
|
|
championColor->_offset[2] = local_ec._offset[2];
|
|
}
|
|
}
|
|
else {
|
|
sprite = &this->_sprite;
|
|
layerSprite = GHIDRA_CAST<Sprite *>(sprite);
|
|
do {
|
|
layer = ANM2::GetLayer(sprite,layerIndex);
|
|
local_ac = layer;
|
|
if (layer->_layerData == (void *)0x0) {
|
|
layerString._size = 0;
|
|
layerString._capacity = 0xf;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(layerString._buf)) + 0x0))) = GHIDRA_CAST<std_string *>(0x0);
|
|
}
|
|
else {
|
|
(GHIDRA_CAST<msvc::string *>((layerString._buf)))->msvc::string::string((void *)(GHIDRA_INT(layer->_layerData) + 8));
|
|
}
|
|
local_b4 = uVar8 | 9;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 3;
|
|
psVar4 = &layerString;
|
|
if (0xf < layerString._capacity) {
|
|
psVar4 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(layerString._buf))) + 0x0)));
|
|
}
|
|
local_b8 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(layerString._buf))) + 0x0)));
|
|
local_a4 = local_b4;
|
|
isChampionColored = str_eq(GHIDRA_CAST<uint8_t *>(psVar4),layerString._size,&DAT_00b64428,4);
|
|
if (isChampionColored == 0) {
|
|
if (layer->_layerData == (void *)0x0) {
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_54._buf)) + 0x0))) = GHIDRA_CAST<std_string *>(0x0);
|
|
local_54._capacity = GHIDRA_UINT(&DAT_0000000f);
|
|
local_54._size = 0;
|
|
}
|
|
else {
|
|
(GHIDRA_CAST<msvc::string *>((local_54._buf)))->msvc::string::string((void *)(GHIDRA_INT(layer->_layerData) + 8));
|
|
}
|
|
psVar4 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_54._buf))) + 0x0)));
|
|
local_a4 = uVar8 | 0x1b;
|
|
psVar5 = &local_54;
|
|
if (&DAT_0000000f < local_54._capacity) {
|
|
psVar5 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_54._buf))) + 0x0)));
|
|
}
|
|
isChampionColored = str_eq(GHIDRA_CAST<uint8_t *>(psVar5),local_54._size,&DAT_00b1d57c,4);
|
|
if (isChampionColored != 0) goto LAB_006bb394;
|
|
local_9d = 0;
|
|
}
|
|
else {
|
|
psVar4 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(local_54._buf))) + 0x0)));
|
|
LAB_006bb394:
|
|
local_9d = 1;
|
|
}
|
|
if ((local_a4 & 2) != 0) {
|
|
local_a4 = local_a4 & 0xfffffffd;
|
|
if (&DAT_0000000f < local_54._capacity) {
|
|
size = GHIDRA_CAST<uint8_t *>((local_54._capacity + 1));
|
|
psVar5 = psVar4;
|
|
if (GHIDRA_CAST<uint8_t *>(0xfff) < size) {
|
|
psVar5 = GHIDRA_CAST<std_string *>(psVar4[-1]._capacity);
|
|
size = GHIDRA_CAST<uint8_t *>((local_54._capacity + 0x24));
|
|
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(psVar4) + (-4 - GHIDRA_INT(psVar5))))) goto LAB_006bb75e;
|
|
}
|
|
operator_delete(psVar5,GHIDRA_UINT(size));
|
|
}
|
|
}
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))) = 0;
|
|
if ((local_a4 & 1) != 0) {
|
|
local_a4 = local_a4 & 0xfffffffe;
|
|
if (0xf < layerString._capacity) {
|
|
uVar8 = layerString._capacity + 1;
|
|
psVar4 = local_b8;
|
|
if (0xfff < uVar8) {
|
|
psVar4 = GHIDRA_CAST<std_string *>(local_b8[-1]._capacity);
|
|
uVar8 = layerString._capacity + 0x24;
|
|
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(local_b8) + (-4 - GHIDRA_INT(psVar4))))) goto LAB_006bb75e;
|
|
}
|
|
operator_delete(psVar4,uVar8);
|
|
}
|
|
}
|
|
layer = local_ac;
|
|
if (local_9d != 0) {
|
|
local_ac->_bitflags = local_ac->_bitflags | 1;
|
|
isDirtColorNeeded = '\x01';
|
|
}
|
|
local_a4 = local_a4 | 0x20;
|
|
if (local_ac->_layerData == (void *)0x0) {
|
|
layerString._capacity = 0xf;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(layerString._buf)) + 0x0))) = GHIDRA_CAST<std_string *>(0x0);
|
|
layerString._size = 0;
|
|
}
|
|
else {
|
|
(GHIDRA_CAST<msvc::string *>((layerString._buf)))->msvc::string::string((void *)(GHIDRA_INT(local_ac->_layerData) + 8));
|
|
}
|
|
uVar1 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(layerString._buf)) + 0x0)));
|
|
psVar4 = &layerString;
|
|
if (0xf < layerString._capacity) {
|
|
psVar4 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(layerString._buf))) + 0x0)));
|
|
}
|
|
local_9d = str_eq(GHIDRA_CAST<uint8_t *>(psVar4),layerString._size,GHIDRA_CAST<uint8_t *>("Hole2"),5);
|
|
if (0xf < layerString._capacity) {
|
|
uVar8 = layerString._capacity + 1;
|
|
psVar4 = GHIDRA_CAST<std_string *>(uVar1);
|
|
if (0xfff < uVar8) {
|
|
psVar4 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>((uVar1 + -0x18)))->_capacity);
|
|
uVar8 = layerString._capacity + 0x24;
|
|
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((uVar1 + (-4 - GHIDRA_INT(psVar4))))) goto LAB_006bb75e;
|
|
}
|
|
operator_delete(psVar4,uVar8);
|
|
}
|
|
if (local_9d != 0) {
|
|
layer->_bitflags = layer->_bitflags | 1;
|
|
}
|
|
uVar8 = local_a4 | 0x40;
|
|
local_9d = 0;
|
|
if (layer->_layerData == (void *)0x0) {
|
|
layerString._capacity = 0xf;
|
|
layerString._size = 0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(layerString._buf)) + 0x0))) = GHIDRA_CAST<std_string *>(0x0);
|
|
}
|
|
else {
|
|
(GHIDRA_CAST<msvc::string *>((layerString._buf)))->msvc::string::string((void *)(GHIDRA_INT(layer->_layerData) + 0x20));
|
|
}
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 4;
|
|
anm2_resolve_spritesheet_path
|
|
(&resolvedSheetPath,&layerString,&sheetOverridePath,&championSuffix,&local_9d);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 6;
|
|
if (0xf < layerString._capacity) {
|
|
uVar6 = layerString._capacity + 1;
|
|
psVar4 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(layerString._buf))) + 0x0)));
|
|
if (0xfff < uVar6) {
|
|
psVar4 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(layerString._buf)) + 0x0))) + -0x18)))->_capacity);
|
|
uVar6 = layerString._capacity + 0x24;
|
|
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(layerString._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar4)))))
|
|
goto LAB_006bb75e;
|
|
}
|
|
operator_delete(psVar4,uVar6);
|
|
}
|
|
(GHIDRA_CAST<Sprite *>((layerSprite)))->Sprite::ReplaceSpritesheet(GHIDRA_INT(layerIndex),&resolvedSheetPath);
|
|
if (local_9d == 0) {
|
|
uVar6 = layer->_bitflags & 0xffffffef;
|
|
}
|
|
else {
|
|
isChampionSheetUsed = '\x01';
|
|
uVar6 = layer->_bitflags | 0x10;
|
|
}
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_14)) + 0x0))) = 2;
|
|
layer->_bitflags = uVar6;
|
|
if (0xf < resolvedSheetPath._capacity) {
|
|
uVar6 = resolvedSheetPath._capacity + 1;
|
|
freeBlock = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)resolvedSheetPath._buf)) + 0x0)));
|
|
if (0xfff < uVar6) {
|
|
freeBlock = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(resolvedSheetPath._buf)) + 0x0))) + -4);
|
|
uVar6 = resolvedSheetPath._capacity + 0x24;
|
|
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(resolvedSheetPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock)))))
|
|
goto LAB_006bb75e;
|
|
}
|
|
operator_delete(freeBlock,uVar6);
|
|
}
|
|
this = self;
|
|
layerIndex = layerIndex + 1;
|
|
sprite = &self->_sprite;
|
|
} while (layerIndex < GHIDRA_CAST<uint8_t *>((self->_sprite)._layerCount));
|
|
if ((isChampionSheetUsed == '\0') || (local_a8 == GHIDRA_CAST<uint8_t *>(0x0))) goto LAB_006bb675;
|
|
(GHIDRA_CAST<Color *>((&local_ec)))->Color::Color(r,in_XMM2_Da,in_XMM3_Da,(float)local_a8);
|
|
championColor = &(this->_sprite)._championColor;
|
|
if (championColor != GHIDRA_CAST<ColorMod *>(&local_ec)) {
|
|
championColor->_tint[0] = local_ec._tint[0];
|
|
(this->_sprite)._championColor._tint[1] = local_ec._tint[1];
|
|
(this->_sprite)._championColor._tint[2] = local_ec._tint[2];
|
|
(this->_sprite)._championColor._tint[3] = local_ec._tint[3];
|
|
(this->_sprite)._championColor._colorize[0] = local_ec._colorize[0];
|
|
(this->_sprite)._championColor._colorize[1] = local_ec._colorize[1];
|
|
(this->_sprite)._championColor._colorize[2] = local_ec._colorize[2];
|
|
(this->_sprite)._championColor._colorize[3] = local_ec._colorize[3];
|
|
goto LAB_006bb6be;
|
|
}
|
|
}
|
|
if ((this->_type == 0x3b6) || ((this->_type == 0x3c0 && (this->_variant == 4)))) {
|
|
spriteBitflags = &(this->_sprite)._bitflags;
|
|
*spriteBitflags = *spriteBitflags | 0x20;
|
|
}
|
|
else {
|
|
spriteBitflags = &(this->_sprite)._bitflags;
|
|
*spriteBitflags = *spriteBitflags & 0xffffffdf;
|
|
}
|
|
ANM2::LoadGraphics(&this->_sprite,(uint8_t)championColor);
|
|
if (isDirtColorNeeded != '\0') {
|
|
UpdateDirtColor(this,1);
|
|
}
|
|
if (0xf < championSuffix._capacity) {
|
|
uVar8 = championSuffix._capacity + 1;
|
|
freeBlock = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)championSuffix._buf)) + 0x0)));
|
|
if (0xfff < uVar8) {
|
|
freeBlock = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(championSuffix._buf)) + 0x0))) + -4);
|
|
uVar8 = championSuffix._capacity + 0x24;
|
|
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(championSuffix._buf)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock))))) goto LAB_006bb75e;
|
|
}
|
|
operator_delete(freeBlock,uVar8);
|
|
}
|
|
if (0xf < sheetOverridePath._capacity) {
|
|
uVar8 = sheetOverridePath._capacity + 1;
|
|
freeBlock = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)sheetOverridePath._buf)) + 0x0)));
|
|
if (0xfff < uVar8) {
|
|
freeBlock = *(void **)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(sheetOverridePath._buf)) + 0x0))) + -4);
|
|
uVar8 = sheetOverridePath._capacity + 0x24;
|
|
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(sheetOverridePath._buf)) + 0x0))) + (-4 - GHIDRA_INT(freeBlock))))) {
|
|
LAB_006bb75e:
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(freeBlock,uVar8);
|
|
}
|
|
ExceptionList = local_1c;
|
|
return;
|
|
}
|
|
|
|
// 006bb790
|
|
void Entity_NPC::LoadEntityConfig()
|
|
{
|
|
void *pvVar1;
|
|
Room *playerManager;
|
|
uint8_t hasRoomConfigFlag;
|
|
std_string *anim;
|
|
Entity_Player *championBeltOwner;
|
|
int iVar2;
|
|
uint32_t uVar3;
|
|
PlayerManager *playerManager;
|
|
uint32_t uVar4;
|
|
Game *game;
|
|
RNG rng;
|
|
RNG local_ac;
|
|
float local_9c;
|
|
char local_95;
|
|
float championChance;
|
|
Color bossColor;
|
|
char local_64 [24];
|
|
char local_4c [24];
|
|
char local_34 [24];
|
|
float bossColorScale;
|
|
float bossColorHealthMultiplier;
|
|
uint32_t local_14;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
float maxHitPoints;
|
|
float scaleX;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00afa7e0;
|
|
local_10 = ExceptionList;
|
|
local_14 = __security_cookie ^ GHIDRA_UINT((local_34 + 0x30));
|
|
ExceptionList = &local_10;
|
|
rng._seed = this->_initSeed;
|
|
rng._shift1 = 1;
|
|
rng._shift2 = 5;
|
|
rng._shift3 = 0x10;
|
|
this->_isBoss = 0;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::LoadEntityConfig();
|
|
if (this->_config == (void *)0x0) {
|
|
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("[warn] No entity config for NPC %d.%d\n"));
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
load_graphics(this,1);
|
|
anim = &(this->_sprite)._animDefaultName;
|
|
(this->_sprite)._scale.x = g_vectorOne.x;
|
|
(this->_sprite)._scale.y = g_vectorOne.y;
|
|
if (0xf < (this->_sprite)._animDefaultName._capacity) {
|
|
anim = *GHIDRA_CAST<std_string **>((this->_sprite)._animDefaultName._buf);
|
|
}
|
|
hasRoomConfigFlag = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST<uint8_t *>(anim),1);
|
|
if (((hasRoomConfigFlag != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) &&
|
|
(AnimationState::SetFrameFloat(&(this->_sprite)._animState,0.0),
|
|
(this->_sprite)._animState._animData != (void *)0x0)) {
|
|
(this->_sprite)._animState._isPlaying = 0;
|
|
}
|
|
pvVar1 = this->_config;
|
|
championChance = 0.05;
|
|
this->_canShutDoors = *GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(pvVar1) + 0x58));
|
|
this->_isBoss = *GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(pvVar1) + 0x2c));
|
|
this->_shieldStrength = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar1) + 0xe0));
|
|
playerManager = &g_game->_playerManager;
|
|
this->_shieldFrames = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0xe4));
|
|
championBeltOwner =
|
|
PlayerManager::FirstCollectibleOwner(playerManager,0xd0,GHIDRA_CAST<RNG **>(playerManager),1);
|
|
if (championBeltOwner != GHIDRA_CAST<Entity_Player *>(0x0)) {
|
|
championChance = 0.2;
|
|
}
|
|
if (g_game->_stage == 0xc) {
|
|
championChance = 0.75;
|
|
}
|
|
hasRoomConfigFlag = (GHIDRA_CAST<PlayerManager *>((&g_game->_playerManager)))->PlayerManager::AnyoneHasTrinket(5);
|
|
if (hasRoomConfigFlag != 0) {
|
|
iVar2 = (GHIDRA_CAST<PlayerManager *>((&g_game->_playerManager)))->PlayerManager::GetTrinketMultiplier(5);
|
|
championChance = (float)iVar2 * 3.0 * championChance;
|
|
}
|
|
game = g_game;
|
|
playerManager = g_game->_room;
|
|
local_95 = *GHIDRA_CAST<char *>(playerManager);
|
|
if (local_95 != '\0') {
|
|
championChance = championChance * 0.2;
|
|
}
|
|
local_9c = 1.82169e-44;
|
|
msvc::set<int>::find_node(&local_ac._shift1,&local_9c);
|
|
if (((*GHIDRA_CAST<char *>((local_ac._shift3 + 0xd)) == '\0') && (*GHIDRA_CAST<int *>((local_ac._shift3 + 0x10)) < 0xe)) &&
|
|
((void *)local_ac._shift3 != (game->_seedEffects)._seedEffects)) {
|
|
championChance = 1.0;
|
|
}
|
|
pvVar1 = this->_config;
|
|
if (this->_isBoss == 0) {
|
|
if ((((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(pvVar1) + 0x34)) != '\0') && (this->_isChampion == 0)) &&
|
|
(((local_95 == '\0' &&
|
|
(hasRoomConfigFlag = (GHIDRA_CAST<Room *>((playerManager)))->Room::has_room_config_flag(4), hasRoomConfigFlag == 0)) &&
|
|
((playerManager->_roomType != 5 || (this->_type != 0x379)))))) &&
|
|
((local_9c = (GHIDRA_CAST<RNG *>((&rng)))->RNG::RandomFloat(), local_9c < championChance ||
|
|
((g_game->_challenge == 0x22 ||
|
|
((0 < g_game->_victoryLap && (local_9c = (GHIDRA_CAST<RNG *>((&rng)))->RNG::RandomFloat(), local_9c < 0.25)))))))) {
|
|
this->_isChampion = 1;
|
|
}
|
|
}
|
|
else {
|
|
uVar4 = (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x6c)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar1) + 0x68))) / 0x7c;
|
|
if ((this->_spawnerEntity != 0) && (*GHIDRA_CAST<int *>((this->_spawnerEntity + 0x28)) == 0x19b)) {
|
|
uVar4 = 0;
|
|
}
|
|
if (DAT_00c71670 == '\0') {
|
|
if (((0 < GHIDRA_INT(uVar4)) && (this->_subtype == 0)) &&
|
|
(((g_manager->_persistentGameData)._achievements[3] != 0 ||
|
|
((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((g_manager)) + 0x8)))) == 2 &&
|
|
(((game->_dailyChallenge)._id != 0 || (game->_isDebug != 0)))))))) {
|
|
championChance = 0.1;
|
|
if (((g_manager->_persistentGameData)._achievements[0x21] != 0) ||
|
|
((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((g_manager)) + 0x8)))) == 2 &&
|
|
(((game->_dailyChallenge)._id != 0 || (game->_isDebug != 0)))))) {
|
|
championChance = 0.3;
|
|
}
|
|
if (game->_difficulty == 3) {
|
|
championChance = 0.6;
|
|
}
|
|
hasRoomConfigFlag = (GHIDRA_CAST<PlayerManager *>((&game->_playerManager)))->PlayerManager::AnyoneHasTrinket(5);
|
|
if (hasRoomConfigFlag != 0) {
|
|
iVar2 = (GHIDRA_CAST<PlayerManager *>((&g_game->_playerManager)))->PlayerManager::GetTrinketMultiplier(5);
|
|
championChance = ((float)iVar2 + (float)iVar2) * championChance;
|
|
}
|
|
if ((g_game->_challenge == 0x22) || (0 < g_game->_victoryLap)) {
|
|
championChance = 1.0;
|
|
}
|
|
iVar2 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 4));
|
|
local_ac._seed = 0;
|
|
if (iVar2 != 0) {
|
|
local_ac._seed = *GHIDRA_CAST<int *>((iVar2 + 0x5c));
|
|
}
|
|
local_ac._shift1 = 1;
|
|
local_ac._shift2 = 0xb;
|
|
local_ac._shift3 = 0x10;
|
|
local_9c = (GHIDRA_CAST<RNG *>((&local_ac)))->RNG::RandomFloat();
|
|
if (local_9c < championChance) {
|
|
uVar3 = (GHIDRA_CAST<RNG *>((&local_ac)))->RNG::RandomInt(uVar4);
|
|
this->_subtype = uVar3 + 1;
|
|
}
|
|
game = g_game;
|
|
if (((*GHIDRA_CAST<int *>(this->_config) == 0x2d) && (this->_subtype == 2)) &&
|
|
(g_game->_challenge == 0x1e)) {
|
|
this->_subtype = 0;
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
uVar4 = 0;
|
|
DAT_00c71670 = '\0';
|
|
}
|
|
if ((game->_stageType == 4) || (game->_stageType == 5)) {
|
|
if (*GHIDRA_CAST<int *>(this->_config) == 0x2d) {
|
|
this->_subtype = 3;
|
|
}
|
|
else if (*GHIDRA_CAST<int *>(this->_config) == 0x4e) {
|
|
this->_subtype = 1;
|
|
}
|
|
}
|
|
uVar3 = this->_subtype;
|
|
if ((uVar3 != 0) && (uVar3 <= uVar4)) {
|
|
Color::copy_constructor_ext
|
|
(&bossColor,(void *)(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this->_config) + 0x68)) + uVar3 * 0x7c + -0x7c));
|
|
local_8 = 0;
|
|
iVar2 = this->_subtype + -1;
|
|
this->_bosscoloridx = iVar2;
|
|
if ((iVar2 < 0) || (GHIDRA_INT(uVar4) <= iVar2)) {
|
|
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("Invalid boss color idx: %d\n"));
|
|
this->_bosscoloridx = -1;
|
|
}
|
|
else {
|
|
scaleX = (this->_sprite)._scale.x;
|
|
(this->_sprite)._scale.y = bossColorScale * (this->_sprite)._scale.y;
|
|
maxHitPoints = this->_maxHitPoints;
|
|
(this->_sprite)._scale.x = bossColorScale * scaleX;
|
|
this->_scale = bossColorScale;
|
|
this->_maxHitPoints = bossColorHealthMultiplier * maxHitPoints;
|
|
}
|
|
this->ResetColor();
|
|
load_graphics(this,1);
|
|
ANM2::SetFrame(&this->_sprite,&(this->_sprite)._animDefaultName,0);
|
|
local_8 = 0xffffffff;
|
|
(GHIDRA_CAST<msvc::string *>((local_34)))->msvc::string::_Tidy_deallocate();
|
|
(GHIDRA_CAST<msvc::string *>((local_4c)))->msvc::string::_Tidy_deallocate();
|
|
(GHIDRA_CAST<msvc::string *>((local_64)))->msvc::string::_Tidy_deallocate();
|
|
}
|
|
}
|
|
if (DAT_00c71670 == '\0') {
|
|
if (this->_isChampion != 0) {
|
|
iVar2 = this->_championColorIdx;
|
|
uVar4 = (GHIDRA_CAST<RNG *>((&rng)))->RNG::Next();
|
|
MakeChampion(this,uVar4,iVar2,1);
|
|
}
|
|
}
|
|
else {
|
|
this->_isChampion = 0;
|
|
DAT_00c71670 = '\0';
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 006be760
|
|
void Entity_NPC::KillUnique()
|
|
{
|
|
EntityRef killSource;
|
|
|
|
killSource._type = 0;
|
|
killSource._variant = 0;
|
|
killSource._spawnerType = 0;
|
|
killSource._spawnerVariant = 0;
|
|
killSource._position.x = g_vectorZero.x;
|
|
killSource._position.y = g_vectorZero.y;
|
|
killSource._velocity.x = g_vectorZero.x;
|
|
killSource._velocity.y = g_vectorZero.y;
|
|
killSource._flags = 0;
|
|
killSource._entity = (void *)0x0;
|
|
this->Kill(&killSource);
|
|
this->_state = 0x11;
|
|
this->_stateFrame = 0;
|
|
return;
|
|
}
|
|
|
|
// 006be840
|
|
Entity * Entity_NPC::GetPlayerTarget()
|
|
{
|
|
uint32_t *puVar1;
|
|
int *piVar2;
|
|
uint8_t bVar3;
|
|
uint32_t uVar4;
|
|
uint32_t uVar5;
|
|
Entity_Player *player;
|
|
void *playerListEnd;
|
|
PlayerManager *playerManager;
|
|
Entity *candidatesBegin;
|
|
Entity *ptr;
|
|
uint32_t killSource;
|
|
uint32_t local_70;
|
|
uint32_t local_6c;
|
|
uint32_t local_68;
|
|
float local_64;
|
|
float local_60;
|
|
float local_5c;
|
|
float local_58;
|
|
uint32_t local_54;
|
|
uint32_t local_50;
|
|
RNG pickRng;
|
|
uint8_t sameTypeList [12];
|
|
uint32_t uStack_30;
|
|
Entity *candidates;
|
|
Entity *candidatesEnd;
|
|
Entity *candidatesCapEnd;
|
|
int *local_20;
|
|
int *local_1c;
|
|
Entity *candidatesCap;
|
|
uint32_t playerIndex;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
Entity *newTarget;
|
|
Entity_NPC *sibling;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00afa865;
|
|
local_10 = ExceptionList;
|
|
uVar4 = __security_cookie ^ GHIDRA_UINT((sameTypeList + 0x38));
|
|
if (this->_type != 0x35) {
|
|
ExceptionList = &local_10;
|
|
if ((((this->_flags & 0x100) != 0) && (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(g_game->_room) + 0x72a1)) == '\0')) &&
|
|
((bVar3 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFrame(0xf,this->_index), bVar3 != 0 ||
|
|
(this->_target == 0)))) {
|
|
newTarget = Game::GetNearestEnemy(&this->_pos,GHIDRA_CAST<Entity *>(this),5000.0,(void *)0x0);
|
|
puVar1 = &this->_target;
|
|
if (this->_target != 0) {
|
|
local_20 = puVar1;
|
|
msvc::multiset<unsigned_int>::erase(&local_20);
|
|
}
|
|
*puVar1 = newTarget;
|
|
if (newTarget != GHIDRA_CAST<Entity *>(0x0)) {
|
|
msvc::multiset<unsigned_int>::insert(puVar1);
|
|
}
|
|
}
|
|
puVar1 = &this->_target;
|
|
if (GHIDRA_CAST<Entity *>(this->_target) != GHIDRA_CAST<Entity *>(0x0)) {
|
|
ExceptionList = local_10;
|
|
return GHIDRA_CAST<Entity *>(this->_target);
|
|
}
|
|
if ((this->_type == 0xd5) || (this->_decoyTargetTimer < 0)) {
|
|
bVar3 = 0;
|
|
}
|
|
else {
|
|
bVar3 = 1;
|
|
}
|
|
local_1c = GHIDRA_CAST<int *>(CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_1c)) + 0x1))),1));
|
|
if ((this->_flags & 0x20000000) == 0) {
|
|
local_1c = GHIDRA_CAST<int *>(((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(local_1c))) + 0x1))) << 8));
|
|
}
|
|
newTarget = Game::GetNearestTargetPlayer
|
|
(&this->_pos,GHIDRA_CAST<Entity *>(this),(uint8_t)local_1c,bVar3,(void *)0x0,5000.0);
|
|
if (newTarget == GHIDRA_CAST<Entity *>(0x0)) {
|
|
player = (GHIDRA_CAST<Game *>((g_game)))->Game::GetPlayer(0);
|
|
ExceptionList = local_10;
|
|
return GHIDRA_CAST<Entity *>(player);
|
|
}
|
|
bVar3 = (GHIDRA_CAST<Entity *>((newTarget)))->Entity::IsEnemy();
|
|
if (bVar3 == 0) {
|
|
ExceptionList = local_10;
|
|
return newTarget;
|
|
}
|
|
bVar3 = (GHIDRA_CAST<Entity *>((newTarget)))->Entity::HasEntityFlags(0x10000000000000);
|
|
if (bVar3 == 0) {
|
|
ExceptionList = local_10;
|
|
return newTarget;
|
|
}
|
|
if (*puVar1 != 0) {
|
|
local_20 = puVar1;
|
|
msvc::multiset<unsigned_int>::erase(&local_20);
|
|
}
|
|
*puVar1 = newTarget;
|
|
msvc::multiset<unsigned_int>::insert(puVar1);
|
|
ExceptionList = local_10;
|
|
return newTarget;
|
|
}
|
|
local_1c = &this->_target;
|
|
candidates = GHIDRA_CAST<Entity *>(this->_target);
|
|
if (candidates != GHIDRA_CAST<Entity *>(0x0)) {
|
|
return candidates;
|
|
}
|
|
newTarget = GHIDRA_CAST<Entity *>(0x0);
|
|
candidatesEnd = GHIDRA_CAST<Entity *>(0x0);
|
|
local_8 = 0;
|
|
ExceptionList = &local_10;
|
|
candidatesCapEnd = candidates;
|
|
candidatesCap = candidates;
|
|
EntityList::QuerySublist
|
|
(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST<EntityList_EL *>(sameTypeList),0x35,-1,-1,0,
|
|
0);
|
|
local_8 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),1);
|
|
playerManager = &g_game->_playerManager;
|
|
playerIndex = 0;
|
|
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2
|
|
== 0) {
|
|
candidatesBegin = GHIDRA_CAST<Entity *>(0x0);
|
|
}
|
|
else {
|
|
do {
|
|
playerListEnd = (playerManager->_playerList)._end;
|
|
if (GHIDRA_INT(playerListEnd) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("(GHIDRA_CAST<PlayerManager *>(()))->PlayerManager::GetPlayer() : There are no players! \n"));
|
|
playerListEnd = (playerManager->_playerList)._end;
|
|
}
|
|
local_20 = (playerManager->_playerList)._begin;
|
|
if (playerIndex < GHIDRA_UINT((GHIDRA_INT(playerListEnd) - GHIDRA_INT(local_20) >> 2))) {
|
|
local_20 = local_20 + playerIndex;
|
|
}
|
|
local_20 = GHIDRA_CAST<int *>(*local_20);
|
|
if (this->_controllerID == -1) {
|
|
uVar5 = 0;
|
|
if (uStack_30 != 0) {
|
|
do {
|
|
sibling = *GHIDRA_CAST<Entity_NPC **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(sameTypeList)) + 0x4))) + uVar5 * 4));
|
|
if ((sibling != this) && (GHIDRA_CAST<int *>(sibling->_target) == local_20)) goto LAB_006be971;
|
|
uVar5 = uVar5 + 1;
|
|
} while (uVar5 < uStack_30);
|
|
}
|
|
LAB_006be94c:
|
|
if (newTarget == candidatesCap) {
|
|
msvc::vector<unsigned_int>::_Emplace_reallocate(newTarget,&local_20);
|
|
candidatesCap = candidatesCapEnd;
|
|
newTarget = candidatesEnd;
|
|
}
|
|
else {
|
|
*GHIDRA_CAST<int **>(newTarget) = local_20;
|
|
candidatesEnd = GHIDRA_CAST<Entity *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((newTarget)) + 0x4))));
|
|
newTarget = candidatesEnd;
|
|
}
|
|
}
|
|
else if (local_20[0x586] == this->_controllerID) goto LAB_006be94c;
|
|
LAB_006be971:
|
|
candidatesBegin = candidates;
|
|
playerManager = &g_game->_playerManager;
|
|
playerIndex = playerIndex + 1;
|
|
} while (playerIndex <
|
|
GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((playerManager->_playerList)._begin) >> 2)));
|
|
if (candidates != newTarget) {
|
|
pickRng._seed = this->_initSeed;
|
|
pickRng._shift1 = 2;
|
|
pickRng._shift2 = 7;
|
|
pickRng._shift3 = 7;
|
|
uVar4 = (GHIDRA_CAST<RNG *>((&pickRng)))->RNG::RandomInt(GHIDRA_INT(newTarget) - GHIDRA_INT(candidates) >> 2);
|
|
player = *GHIDRA_CAST<Entity_Player **>((GHIDRA_INT((&(candidatesBegin->_sprite)._filename + -3)) + uVar4 * 4));
|
|
goto LAB_006bea36;
|
|
}
|
|
}
|
|
killSource = 0;
|
|
local_70 = 0;
|
|
local_6c = 0;
|
|
local_68 = 0;
|
|
local_64 = g_vectorZero.x;
|
|
local_60 = g_vectorZero.y;
|
|
local_5c = g_vectorZero.x;
|
|
local_58 = g_vectorZero.y;
|
|
local_54 = 0;
|
|
local_50 = 0;
|
|
this->Kill(&killSource,uVar4);
|
|
player = (GHIDRA_CAST<Game *>((g_game)))->Game::GetPlayer(0);
|
|
LAB_006bea36:
|
|
piVar2 = local_1c;
|
|
if (*local_1c != 0) {
|
|
local_20 = local_1c;
|
|
msvc::multiset<unsigned_int>::erase(&local_20);
|
|
}
|
|
*piVar2 = GHIDRA_INT(player);
|
|
if (player != GHIDRA_CAST<Entity_Player *>(0x0)) {
|
|
msvc::multiset<unsigned_int>::insert(piVar2);
|
|
}
|
|
newTarget = GHIDRA_CAST<Entity *>(*piVar2);
|
|
uVar4 = local_8 >> 8;
|
|
local_8 = local_8 & 0xffffff00;
|
|
if (sameTypeList[0] == '\0') {
|
|
local_8 = CONCAT31((int3)uVar4,2);
|
|
tracked_alloc(1,(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)sameTypeList)) + 0x4))),0);
|
|
}
|
|
if (candidatesBegin == GHIDRA_CAST<Entity *>(0x0)) {
|
|
ExceptionList = local_10;
|
|
return newTarget;
|
|
}
|
|
uVar4 = GHIDRA_INT(candidatesCap) - GHIDRA_INT(candidatesBegin) & 0xfffffffc;
|
|
ptr = candidatesBegin;
|
|
if (0xfff < uVar4) {
|
|
ptr = *GHIDRA_CAST<Entity **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(candidatesBegin[-1])) + 0x40c))));
|
|
uVar4 = uVar4 + 0x23;
|
|
if (0x1f < GHIDRA_UINT((GHIDRA_INT(candidatesBegin) + (-4 - GHIDRA_INT(ptr))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(ptr,uVar4);
|
|
ExceptionList = local_10;
|
|
return newTarget;
|
|
}
|
|
|
|
// 006bec40
|
|
Vector * Entity_NPC::CalcTargetPosition(Vector *outPos, float distanceLimit)
|
|
{
|
|
int iVar1;
|
|
uint8_t bVar2;
|
|
uint32_t rngResult;
|
|
Entity *playerTarget;
|
|
Vector *randomDir;
|
|
Game *game;
|
|
float fVar3;
|
|
float fVar4;
|
|
float fVar5;
|
|
Vector local_20;
|
|
Vector local_18;
|
|
Vector local_10;
|
|
uint64_t flags;
|
|
Room *room;
|
|
|
|
game = g_game;
|
|
local_10.y = *GHIDRA_CAST<float *>((GHIDRA_INT(&this->_flags) + 4));
|
|
flags = this->_flags;
|
|
if ((flags & 0x200) == 0) {
|
|
if ((flags & 0x1000800) != 0) {
|
|
iVar1 = this->_type;
|
|
if (iVar1 == 0x10) {
|
|
if (this->_variant == 2) {
|
|
LAB_006bee6f:
|
|
playerTarget = GetPlayerTarget(this);
|
|
fVar3 = (this->_pos).x;
|
|
local_20.x = (this->_pos).y;
|
|
local_18.x = (playerTarget->_pos).x - fVar3;
|
|
local_10.x = (playerTarget->_pos).y - local_20.x;
|
|
fVar4 = local_18.x;
|
|
if ((distanceLimit != 0.0) &&
|
|
(fVar5 = local_10.x * local_10.x + local_18.x * local_18.x, fVar5 != 0.0)) {
|
|
fVar4 = sqrtf(fVar5);
|
|
if (fVar4 <= 0.0) {
|
|
fVar4 = local_18.x;
|
|
}
|
|
else {
|
|
local_10.x = local_10.x * (distanceLimit / fVar4);
|
|
fVar4 = local_18.x * (distanceLimit / fVar4);
|
|
}
|
|
}
|
|
game = g_game;
|
|
fVar5 = this->_size;
|
|
fVar3 = fVar3 - fVar4;
|
|
local_20.x = local_20.x - local_10.x;
|
|
local_10.x = fVar3;
|
|
local_10.y = local_20.x;
|
|
Room::GetClampedPositionImpl(g_game->_room,&local_18,&local_10,fVar5,fVar5,fVar5,fVar5);
|
|
if ((fVar3 == local_18.x) && (local_20.x == local_18.y)) {
|
|
(this->_confusionTargetPos).x = g_vectorZero.x;
|
|
(this->_confusionTargetPos).y = g_vectorZero.y;
|
|
outPos->x = local_18.x;
|
|
outPos->y = local_18.y;
|
|
return outPos;
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Vector *>((&this->_confusionTargetPos)))->Vector::operator_eq(&g_vectorZero);
|
|
if (bVar2 == 0) {
|
|
rngResult = Random();
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFrame(rngResult % 0xf + 5,0);
|
|
if (bVar2 == 0) {
|
|
fVar3 = (this->_confusionTargetPos).y;
|
|
outPos->x = (this->_confusionTargetPos).x;
|
|
outPos->y = fVar3;
|
|
return outPos;
|
|
}
|
|
game = g_game;
|
|
}
|
|
local_10.x = this->_size;
|
|
room = game->_room;
|
|
randomDir = MusicManager::RandomVector(&local_20);
|
|
rngResult = Random();
|
|
fVar3 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]
|
|
) * 2.3283064e-10 * 100.0;
|
|
local_18.x = (this->_pos).x - fVar3 * randomDir->x;
|
|
local_18.y = (this->_pos).y - fVar3 * randomDir->y;
|
|
Room::GetClampedPositionImpl
|
|
(room,&local_10,&local_18,local_10.x,local_10.x,local_10.x,local_10.x);
|
|
(this->_confusionTargetPos).x = local_10.x;
|
|
(this->_confusionTargetPos).y = local_10.y;
|
|
outPos->x = local_10.x;
|
|
outPos->y = local_10.y;
|
|
return outPos;
|
|
}
|
|
}
|
|
else if ((iVar1 != 0x16) && (iVar1 != 0xcd)) goto LAB_006bee6f;
|
|
}
|
|
playerTarget = GetPlayerTarget(this);
|
|
fVar3 = (playerTarget->_pos).x;
|
|
outPos->y = (playerTarget->_pos).y;
|
|
outPos->x = fVar3;
|
|
return outPos;
|
|
}
|
|
if (((this->_confusionTargetPos).x != g_vectorZero.x) ||
|
|
((this->_confusionTargetPos).y != g_vectorZero.y)) {
|
|
if ((flags & 0x4000) != 0) goto LAB_006bee09;
|
|
bVar2 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsPaused();
|
|
if ((bVar2 != 0) || (game->_frameCount % 0xf != 0)) goto LAB_006bee09;
|
|
}
|
|
local_18.x = this->_size;
|
|
room = game->_room;
|
|
rngResult = Random();
|
|
local_20.x = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) *
|
|
2.3283064e-10 * 3.14;
|
|
local_20.x = local_20.x + local_20.x;
|
|
rngResult = Random();
|
|
local_10.x = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) *
|
|
2.3283064e-10;
|
|
rngResult = Random();
|
|
fVar3 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) *
|
|
2.3283064e-10 * local_10.x * 240.0;
|
|
fVar4 = cos(local_20.x);
|
|
local_10.x = fVar4 * fVar3 + (this->_pos).x;
|
|
fVar4 = sin(local_20.x);
|
|
local_10.y = fVar4 * fVar3 + (this->_pos).y;
|
|
Room::GetClampedPositionImpl(room,&local_18,&local_10,local_18.x,local_18.x,local_18.x,local_18.x)
|
|
;
|
|
(this->_confusionTargetPos).x = local_18.x;
|
|
(this->_confusionTargetPos).y = local_18.y;
|
|
LAB_006bee09:
|
|
fVar3 = (this->_confusionTargetPos).x;
|
|
outPos->y = (this->_confusionTargetPos).y;
|
|
outPos->x = fVar3;
|
|
return outPos;
|
|
}
|
|
|
|
// 006c04b0
|
|
void Entity_NPC::UpdateDirtColor(uint8_t immediate)
|
|
{
|
|
float fVar1;
|
|
float fVar2;
|
|
uint8_t bVar3;
|
|
LayerState *layer;
|
|
ColorMod *lerpedColor;
|
|
uint8_t *****pppppbVar4;
|
|
uint8_t *****pppppbVar5;
|
|
uint32_t uVar6;
|
|
ColorMod *layerColor;
|
|
uint32_t size;
|
|
float fVar7;
|
|
ColorMod lerpResult;
|
|
ANM2 *sprite;
|
|
LayerState *currentLayer;
|
|
uint8_t *****layerNameData;
|
|
uint32_t local_68;
|
|
Entity_NPC *npc;
|
|
uint8_t *layerIndex;
|
|
char isDirtLayer;
|
|
uint32_t stringDestructFlags;
|
|
uint8_t *****layerName [4];
|
|
uint32_t layerNameSize;
|
|
uint32_t layerNameCapacity;
|
|
uint8_t *****layerNameCopy;
|
|
KColor local_38;
|
|
uint32_t local_24;
|
|
uint8_t *puStack_20;
|
|
void *local_1c;
|
|
uint8_t *puStack_18;
|
|
uint8_t ****local_14;
|
|
|
|
puStack_20 = GHIDRA_CAST<uint8_t *>((layerName + 0x14));
|
|
local_14 = GHIDRA_CAST<uint8_t ****>(0xffffffff);
|
|
puStack_18 = &LAB_00afa8ae;
|
|
local_1c = ExceptionList;
|
|
local_24 = __security_cookie ^ GHIDRA_UINT((layerName + 0x11));
|
|
ExceptionList = &local_1c;
|
|
stringDestructFlags = 0;
|
|
local_68 = 0;
|
|
npc = this;
|
|
pppppbVar4 = GHIDRA_CAST<uint8_t *****>((layerName + 0x14));
|
|
if (immediate == 0) {
|
|
bVar3 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFrame(0xf,this->_index);
|
|
pppppbVar4 = GHIDRA_CAST<uint8_t *****>(puStack_20);
|
|
if (bVar3 == 0) goto LAB_006c05af;
|
|
}
|
|
puStack_20 = GHIDRA_CAST<uint8_t *>(pppppbVar4);
|
|
if ((this->_isChampion == 0) || (this->_championColorIdx != 2)) {
|
|
(GHIDRA_CAST<Room *>((g_game->_room)))->Room::GetFloorColorAt(&local_38,&this->_pos,this->_size);
|
|
(this->_dirtColor)._tint[0] = local_38._red * 2.0;
|
|
(this->_dirtColor)._tint[1] = local_38._green * 2.0;
|
|
(this->_dirtColor)._tint[2] = local_38._blue * 2.0;
|
|
}
|
|
else {
|
|
(this->_dirtColor)._tint[0] = 0.0;
|
|
(this->_dirtColor)._tint[1] = 0.9;
|
|
(this->_dirtColor)._tint[2] = 0.0;
|
|
}
|
|
(this->_dirtColor)._tint[3] = 1.0;
|
|
LAB_006c05af:
|
|
layerIndex = GHIDRA_CAST<uint8_t *>(0x0);
|
|
if ((this->_sprite)._layerCount == 0) {
|
|
ExceptionList = local_1c;
|
|
return;
|
|
}
|
|
sprite = &this->_sprite;
|
|
do {
|
|
layer = ANM2::GetLayer(sprite,layerIndex);
|
|
stringDestructFlags = stringDestructFlags | 4;
|
|
currentLayer = layer;
|
|
if (layer->_layerData == (void *)0x0) {
|
|
layerNameCapacity = 0xf;
|
|
layerNameSize = 0;
|
|
layerName[0] = GHIDRA_CAST<uint8_t *****>(0x0);
|
|
}
|
|
else {
|
|
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(layerName))))->msvc::string::string((void *)(GHIDRA_INT(layer->_layerData) + 8));
|
|
}
|
|
local_14 = GHIDRA_CAST<uint8_t ****>(0x0);
|
|
local_68 = stringDestructFlags | 1;
|
|
pppppbVar4 = GHIDRA_CAST<uint8_t *****>(layerName);
|
|
if (0xf < layerNameCapacity) {
|
|
pppppbVar4 = layerName[0];
|
|
}
|
|
layerNameData = layerName[0];
|
|
stringDestructFlags = local_68;
|
|
bVar3 = str_eq(GHIDRA_CAST<uint8_t *>(pppppbVar4),layerNameSize,&DAT_00b64428,4);
|
|
if (bVar3 == 0) {
|
|
stringDestructFlags = stringDestructFlags | 8;
|
|
if (layer->_layerData == (void *)0x0) {
|
|
layerNameCopy = GHIDRA_CAST<uint8_t *****>(0x0);
|
|
local_38._unk = 0xf;
|
|
local_38._alpha = 0.0;
|
|
}
|
|
else {
|
|
(GHIDRA_CAST<msvc::string *>((GHIDRA_CAST<char *>(&layerNameCopy))))->msvc::string::string((void *)(GHIDRA_INT(layer->_layerData) + 8));
|
|
}
|
|
uVar6 = local_38._unk;
|
|
pppppbVar4 = layerNameCopy;
|
|
stringDestructFlags = stringDestructFlags | 2;
|
|
pppppbVar5 = GHIDRA_CAST<uint8_t *****>(&layerNameCopy);
|
|
if (0xf < GHIDRA_UINT(local_38._unk)) {
|
|
pppppbVar5 = layerNameCopy;
|
|
}
|
|
bVar3 = str_eq(GHIDRA_CAST<uint8_t *>(pppppbVar5),GHIDRA_UINT(local_38._alpha),&DAT_00b1d57c,4);
|
|
if (bVar3 != 0) goto LAB_006c06a7;
|
|
isDirtLayer = '\0';
|
|
}
|
|
else {
|
|
pppppbVar4 = layerNameCopy;
|
|
uVar6 = local_38._unk;
|
|
LAB_006c06a7:
|
|
isDirtLayer = '\x01';
|
|
}
|
|
if (((stringDestructFlags & 2) != 0) &&
|
|
(stringDestructFlags = stringDestructFlags & 0xfffffffd, 0xf < uVar6)) {
|
|
size = uVar6 + 1;
|
|
pppppbVar5 = pppppbVar4;
|
|
if (0xfff < size) {
|
|
pppppbVar5 = GHIDRA_CAST<uint8_t *****>(pppppbVar4[-1]);
|
|
size = uVar6 + 0x24;
|
|
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(pppppbVar4) + (-4 - GHIDRA_INT(pppppbVar5))))) goto LAB_006c07af;
|
|
}
|
|
operator_delete(pppppbVar5,size);
|
|
}
|
|
local_14 = GHIDRA_CAST<uint8_t ****>(0xffffffff);
|
|
if (((stringDestructFlags & 1) != 0) &&
|
|
(stringDestructFlags = stringDestructFlags & 0xfffffffe, 0xf < layerNameCapacity)) {
|
|
uVar6 = layerNameCapacity + 1;
|
|
pppppbVar4 = layerNameData;
|
|
if (0xfff < uVar6) {
|
|
pppppbVar4 = GHIDRA_CAST<uint8_t *****>(layerNameData[-1]);
|
|
uVar6 = layerNameCapacity + 0x24;
|
|
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((GHIDRA_INT(layerNameData) + (-4 - GHIDRA_INT(pppppbVar4))))) {
|
|
LAB_006c07af:
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(pppppbVar4,uVar6);
|
|
}
|
|
layer = currentLayer;
|
|
if (isDirtLayer != '\0') {
|
|
if (immediate == 0) {
|
|
fVar7 = 0.1;
|
|
}
|
|
else {
|
|
fVar7 = 1.0;
|
|
}
|
|
layerColor = ¤tLayer->_color;
|
|
lerpedColor = Color::Lerp(&lerpResult,layerColor,&npc->_dirtColor,fVar7);
|
|
if (layerColor != lerpedColor) {
|
|
fVar7 = lerpedColor->_tint[1];
|
|
fVar1 = lerpedColor->_tint[2];
|
|
fVar2 = lerpedColor->_tint[3];
|
|
layerColor->_tint[0] = lerpedColor->_tint[0];
|
|
(layer->_color)._tint[1] = fVar7;
|
|
(layer->_color)._tint[2] = fVar1;
|
|
(layer->_color)._tint[3] = fVar2;
|
|
fVar7 = lerpedColor->_colorize[1];
|
|
fVar1 = lerpedColor->_colorize[2];
|
|
fVar2 = lerpedColor->_colorize[3];
|
|
(layer->_color)._colorize[0] = lerpedColor->_colorize[0];
|
|
(layer->_color)._colorize[1] = fVar7;
|
|
(layer->_color)._colorize[2] = fVar1;
|
|
(layer->_color)._colorize[3] = fVar2;
|
|
fVar7 = lerpedColor->_offset[1];
|
|
(layer->_color)._offset[0] = lerpedColor->_offset[0];
|
|
(layer->_color)._offset[1] = fVar7;
|
|
(layer->_color)._offset[2] = lerpedColor->_offset[2];
|
|
}
|
|
}
|
|
layerIndex = layerIndex + 1;
|
|
if (GHIDRA_CAST<uint8_t *>((npc->_sprite)._layerCount) <= layerIndex) {
|
|
ExceptionList = local_1c;
|
|
return;
|
|
}
|
|
} while( true );
|
|
}
|
|
|
|
// 006c07e0
|
|
uint8_t Entity_NPC::Redirect(int *entityType, int *variant)
|
|
{
|
|
uint8_t isGreedMode;
|
|
int iVar1;
|
|
int redirectedType;
|
|
Game *game;
|
|
uint8_t local_14 [8];
|
|
void *seedEffectNode;
|
|
uint32_t seedEffectId;
|
|
Manager *manager;
|
|
|
|
manager = g_manager;
|
|
game = g_game;
|
|
if (((g_manager->_persistentGameData)._achievements[0x21] == 0) &&
|
|
((((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((g_manager)) + 0x8)))) != 2 || (g_game == GHIDRA_CAST<Game *>(0x0))) ||
|
|
(((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))) &&
|
|
((*entityType == 0x3d && (*variant == 5)))))) {
|
|
*entityType = 0xd;
|
|
*variant = 0;
|
|
}
|
|
if (((manager->_persistentGameData)._achievements[0x15c] != 0) ||
|
|
(((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((manager)) + 0x8)))) == 2 && (game != GHIDRA_CAST<Game *>(0x0))) &&
|
|
(((game->_dailyChallenge)._id != 0 || (game->_isDebug != 0)))))) goto LAB_006c0e23;
|
|
iVar1 = *entityType;
|
|
if (iVar1 == 0x12f) {
|
|
if ((game->_difficulty == 0) || (game->_difficulty == 2)) {
|
|
*entityType = 0x1d;
|
|
*variant = 1;
|
|
return 1;
|
|
}
|
|
*entityType = 0xfa;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
if (iVar1 == 300) {
|
|
*entityType = 0x1b;
|
|
LAB_006c08b1:
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
if (iVar1 == 0x131) {
|
|
*entityType = 0x1d;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
if (iVar1 == 0xe7) goto LAB_006c08b1;
|
|
if (iVar1 == 0x12d) {
|
|
*entityType = 0x20;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
if (iVar1 == 0x12e) {
|
|
if ((game->_difficulty == 0) || (iVar1 = 0x101, game->_difficulty == 2)) {
|
|
iVar1 = 0xd0;
|
|
}
|
|
*entityType = iVar1;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
if (iVar1 == 0x130) {
|
|
if ((game->_difficulty == 0) || (iVar1 = 0xf2, game->_difficulty == 2)) {
|
|
iVar1 = 0xf0;
|
|
}
|
|
*entityType = iVar1;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
if (iVar1 != 0x132) {
|
|
LAB_006c0e23:
|
|
seedEffectId = 0x4f;
|
|
msvc::set<int>::find_node(local_14,&seedEffectId);
|
|
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(seedEffectNode) + 0xd)) != '\0') ||
|
|
(0x4f < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(seedEffectNode) + 0x10)))) ||
|
|
(seedEffectNode == (game->_seedEffects)._seedEffects)) {
|
|
return 0;
|
|
}
|
|
iVar1 = *entityType;
|
|
if (iVar1 != 0x1b) {
|
|
if (iVar1 == 0xcc) {
|
|
*entityType = 0xf7;
|
|
return 0;
|
|
}
|
|
if (iVar1 != 0x35b) {
|
|
if (iVar1 == 0xdd) {
|
|
*entityType = 0x3a;
|
|
return 0;
|
|
}
|
|
return 0;
|
|
}
|
|
*entityType = 0x19;
|
|
}
|
|
*variant = 1;
|
|
return 0;
|
|
}
|
|
isGreedMode = (GHIDRA_CAST<Game *>((game)))->Game::IsGreedMode();
|
|
if (isGreedMode == 0) {
|
|
iVar1 = (GHIDRA_CAST<Room *>((game->_room)))->Room::GetRoomConfigStage();
|
|
switch(iVar1) {
|
|
case 0:
|
|
if ((g_game->_difficulty == 0) || (iVar1 = 0x5e, g_game->_difficulty == 2)) {
|
|
iVar1 = 0x55;
|
|
}
|
|
*entityType = iVar1;
|
|
*variant = 0;
|
|
return 1;
|
|
case 1:
|
|
case 3:
|
|
iVar1 = g_game->_difficulty;
|
|
goto LAB_006c0994;
|
|
case 2:
|
|
if ((g_game->_difficulty == 0) || (redirectedType = 0x5e, g_game->_difficulty == 2)) {
|
|
*entityType = 0x55;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
break;
|
|
case 4:
|
|
if ((g_game->_difficulty == 0) || (redirectedType = 0x17, g_game->_difficulty == 2)) {
|
|
*entityType = 0x15;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
break;
|
|
case 5:
|
|
if ((g_game->_difficulty == 0) || (g_game->_difficulty == 2)) {
|
|
*entityType = 0x1a;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
*entityType = 0x1a;
|
|
*variant = 1;
|
|
return 1;
|
|
case 6:
|
|
if ((g_game->_difficulty == 0) || (g_game->_difficulty == 2)) {
|
|
*entityType = 0x17;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
*entityType = 0x17;
|
|
*variant = 1;
|
|
return 1;
|
|
case 7:
|
|
if ((g_game->_difficulty == 0) || (redirectedType = 0xe3, g_game->_difficulty == 2)) {
|
|
*entityType = 0xd1;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
break;
|
|
case 8:
|
|
if ((g_game->_difficulty == 0) || (g_game->_difficulty == 2)) {
|
|
*entityType = 0xe3;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
*entityType = 0x18;
|
|
*variant = 1;
|
|
return 1;
|
|
case 9:
|
|
if ((g_game->_difficulty == 0) || (redirectedType = 0x115, g_game->_difficulty == 2)) {
|
|
*entityType = 0x18;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
break;
|
|
case 10:
|
|
if ((g_game->_difficulty == 0) || (redirectedType = 0x3a, g_game->_difficulty == 2)) {
|
|
*entityType = 0xf;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
break;
|
|
case 0xb:
|
|
if ((g_game->_difficulty == 0) || (redirectedType = 0x27, g_game->_difficulty == 2)) {
|
|
*entityType = 0x3a;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
break;
|
|
case 0xc:
|
|
if ((g_game->_difficulty == 0) || (g_game->_difficulty == 2)) {
|
|
*entityType = 0x27;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
*entityType = 0x27;
|
|
*variant = 1;
|
|
return 1;
|
|
case 0xd:
|
|
*entityType = 0x129;
|
|
*variant = 0;
|
|
return 1;
|
|
case 0xe:
|
|
if ((g_game->_difficulty == 0) || (redirectedType = 0xfc, g_game->_difficulty == 2)) {
|
|
*entityType = 0x57;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
break;
|
|
case 0xf:
|
|
if ((g_game->_difficulty == 0) || (iVar1 = 0x37, g_game->_difficulty == 2)) {
|
|
iVar1 = 0x1a;
|
|
}
|
|
*entityType = iVar1;
|
|
*variant = 2;
|
|
return 1;
|
|
case 0x10:
|
|
if ((g_game->_difficulty == 0) || (iVar1 = 0x32, g_game->_difficulty == 2)) {
|
|
iVar1 = 0x30;
|
|
}
|
|
*entityType = iVar1;
|
|
*variant = 1;
|
|
return 1;
|
|
case 0x11:
|
|
if ((g_game->_difficulty == 0) || (redirectedType = 0x19a, g_game->_difficulty == 2)) {
|
|
*entityType = 0x10b;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
break;
|
|
default:
|
|
game = g_game;
|
|
goto LAB_006c0e23;
|
|
case 0x1a:
|
|
*entityType = 0x19c;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
}
|
|
else {
|
|
switch(game->_stage) {
|
|
case 1:
|
|
iVar1 = game->_difficulty;
|
|
break;
|
|
case 2:
|
|
if ((game->_difficulty == 0) || (iVar1 = 0x17, game->_difficulty == 2)) {
|
|
iVar1 = 0x15;
|
|
}
|
|
*entityType = iVar1;
|
|
*variant = 0;
|
|
return 1;
|
|
case 3:
|
|
if ((game->_difficulty == 0) || (iVar1 = 0xe3, game->_difficulty == 2)) {
|
|
iVar1 = 0xd1;
|
|
}
|
|
*entityType = iVar1;
|
|
*variant = 0;
|
|
return 1;
|
|
case 4:
|
|
if ((game->_difficulty == 0) || (iVar1 = 0x3a, game->_difficulty == 2)) {
|
|
iVar1 = 0xf;
|
|
}
|
|
*entityType = iVar1;
|
|
*variant = 0;
|
|
return 1;
|
|
case 5:
|
|
if ((game->_difficulty == 0) || (iVar1 = 0xfc, game->_difficulty == 2)) {
|
|
iVar1 = 0x57;
|
|
}
|
|
*entityType = iVar1;
|
|
*variant = 0;
|
|
return 1;
|
|
case 6:
|
|
if ((game->_difficulty == 0) || (game->_difficulty == 2)) {
|
|
*entityType = 0x32;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
*entityType = 0x32;
|
|
*variant = 1;
|
|
return 1;
|
|
default:
|
|
*entityType = 299;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
LAB_006c0994:
|
|
if ((iVar1 == 0) || (redirectedType = 0x11c, iVar1 == 2)) {
|
|
redirectedType = 10;
|
|
}
|
|
}
|
|
*entityType = redirectedType;
|
|
*variant = 0;
|
|
return 1;
|
|
}
|
|
|
|
// 006c0f30
|
|
void Entity_NPC::Morph(int EntityType, int Variant, int SubType, int Championid)
|
|
{
|
|
uint8_t isErased;
|
|
EntityConfig_Entity *config;
|
|
float *health;
|
|
uint32_t extraout_EAX;
|
|
int unusedArg;
|
|
float fVar2;
|
|
Color defaultColor;
|
|
uint32_t local_c;
|
|
float *health;
|
|
|
|
local_c = __security_cookie ^ GHIDRA_UINT(&defaultColor);
|
|
if ((((EntityType == this->_type) && (Variant == this->_variant)) && (SubType == this->_subtype))
|
|
&& ((Championid < 0 || (Championid == this->_championColorIdx)))) {
|
|
return;
|
|
}
|
|
this->_type = EntityType;
|
|
this->_variant = Variant;
|
|
this->_subtype = SubType;
|
|
if (-1 < Championid) {
|
|
this->_championColorIdx = Championid;
|
|
this->_isChampion = 1;
|
|
}
|
|
config = EntityConfig::GetEntity(&g_manager->_entityConfig,EntityType,Variant,SubType);
|
|
if ((config != GHIDRA_CAST<EntityConfig_Entity *>(0x0)) && (config->canBeChampion == 0)) {
|
|
this->_championColorIdx = -1;
|
|
this->_isChampion = 0;
|
|
}
|
|
this->_flickerTimer = 0;
|
|
this->_championRegenTimer = 0;
|
|
this->_flickerState = 0;
|
|
this->_flickerAlpha = 1.0;
|
|
this->_championSpeed = 1.0;
|
|
this->_championTimer = 0;
|
|
this->ResetColor();
|
|
this->_scale = 1.0;
|
|
fVar2 = this->_shrinkStatus1 * g_vectorOne.y;
|
|
(this->_sprite)._scale.x = this->_shrinkStatus1 * g_vectorOne.x;
|
|
(this->_sprite)._scale.y = fVar2;
|
|
this->LoadEntityConfig();
|
|
health = &this->_maxHitPoints;
|
|
fVar2 = this->_hitPointsMulti * *health;
|
|
health = &this->_health;
|
|
this->_totalDamageTaken = 0.0;
|
|
*health = fVar2;
|
|
if (*health <= fVar2 && fVar2 != *health) {
|
|
health = health;
|
|
}
|
|
*health = *health;
|
|
if ((this->_colorParams)._begin != (this->_colorParams)._end) {
|
|
(GHIDRA_CAST<Color *>((&defaultColor)))->Color::Color();
|
|
this->SetColor(extraout_EAX,1,0xfffffc18,0,1);
|
|
}
|
|
(GHIDRA_CAST<PathFinder *>((GHIDRA_CAST<PathFinder *>(&this->_pathfinder))))->PathFinder::Reset();
|
|
PersistentGameData::TryAddBestiaryEncounter
|
|
(&g_manager->_persistentGameData,this->_type,this->_variant);
|
|
this->_isBestiaryEncountered = 1;
|
|
isErased = Game::ShouldEraseEnemy(GHIDRA_CAST<Entity *>(this));
|
|
if (isErased != 0) {
|
|
Entity::RemoveWithPoof(GHIDRA_CAST<Entity *>(this),unusedArg);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006c1100
|
|
void Entity_NPC::ResetColor()
|
|
{
|
|
float fVar1;
|
|
float fVar2;
|
|
float fVar3;
|
|
LayerState *layer;
|
|
float *championColor;
|
|
char isChampionLayer;
|
|
ColorMod *spriteColor;
|
|
uint8_t *layerIdx;
|
|
uint8_t flashColor [44];
|
|
uint32_t local_b4 [11];
|
|
char local_85;
|
|
Color bossColor;
|
|
char local_58 [24];
|
|
char local_40 [24];
|
|
char local_28 [32];
|
|
uint32_t local_8;
|
|
int bossColorIdx;
|
|
int bossColors;
|
|
|
|
local_8 = __security_cookie ^ GHIDRA_UINT((local_28 + 0x24));
|
|
if (this->_isChampion == 0) {
|
|
bossColorIdx = this->_bosscoloridx;
|
|
if (bossColorIdx < 0) {
|
|
spriteColor = &(this->_sprite)._color;
|
|
if (spriteColor != &this->_color) {
|
|
fVar1 = (this->_color)._tint[1];
|
|
fVar2 = (this->_color)._tint[2];
|
|
fVar3 = (this->_color)._tint[3];
|
|
spriteColor->_tint[0] = (this->_color)._tint[0];
|
|
(this->_sprite)._color._tint[1] = fVar1;
|
|
(this->_sprite)._color._tint[2] = fVar2;
|
|
(this->_sprite)._color._tint[3] = fVar3;
|
|
fVar1 = (this->_color)._colorize[1];
|
|
fVar2 = (this->_color)._colorize[2];
|
|
fVar3 = (this->_color)._colorize[3];
|
|
(this->_sprite)._color._colorize[0] = (this->_color)._colorize[0];
|
|
(this->_sprite)._color._colorize[1] = fVar1;
|
|
(this->_sprite)._color._colorize[2] = fVar2;
|
|
(this->_sprite)._color._colorize[3] = fVar3;
|
|
*GHIDRA_CAST<uint64_t *>((this->_sprite)._color._offset) = *GHIDRA_CAST<uint64_t *>((this->_color)._offset);
|
|
(this->_sprite)._color._offset[2] = (this->_color)._offset[2];
|
|
}
|
|
}
|
|
else {
|
|
bossColors = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this->_config) + 0x68));
|
|
if (bossColorIdx < (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this->_config) + 0x6c)) - bossColors) / 0x7c) {
|
|
(GHIDRA_CAST<Color *>((&bossColor)))->Color::copy_constructor_ext((void *)(bossColorIdx * 0x7c + bossColors));
|
|
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST<ColorMod *>(&bossColor));
|
|
(GHIDRA_CAST<msvc::string *>((local_28)))->msvc::string::_Tidy_deallocate();
|
|
(GHIDRA_CAST<msvc::string *>((local_40)))->msvc::string::_Tidy_deallocate();
|
|
(GHIDRA_CAST<msvc::string *>((local_58)))->msvc::string::_Tidy_deallocate();
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
layerIdx = GHIDRA_CAST<uint8_t *>(0x0);
|
|
local_85 = '\0';
|
|
isChampionLayer = '\0';
|
|
if ((this->_sprite)._layerCount != 0) {
|
|
do {
|
|
layer = ANM2::GetLayer(&this->_sprite,layerIdx);
|
|
if ((layer->_bitflags & 0x10) != 0) {
|
|
isChampionLayer = '\x01';
|
|
goto LAB_006c115c;
|
|
}
|
|
layerIdx = layerIdx + 1;
|
|
} while (layerIdx < GHIDRA_CAST<uint8_t *>((this->_sprite)._layerCount));
|
|
isChampionLayer = local_85;
|
|
}
|
|
LAB_006c115c:
|
|
if (GHIDRA_UINT(this->_championColorIdx) < 0x1a) {
|
|
spriteColor = &(this->_sprite)._color;
|
|
if (isChampionLayer == '\0') {
|
|
championColor = GHIDRA_CAST<float *>(_Entity_NPC)::GetColorWithFlash(flashColor);
|
|
}
|
|
else {
|
|
championColor = GHIDRA_CAST<float *>((&DAT_00c354d4 + this->_championColorIdx * 0x40));
|
|
}
|
|
if (spriteColor != GHIDRA_CAST<ColorMod *>(championColor)) {
|
|
fVar1 = championColor[1];
|
|
fVar2 = championColor[2];
|
|
fVar3 = championColor[3];
|
|
spriteColor->_tint[0] = *championColor;
|
|
(this->_sprite)._color._tint[1] = fVar1;
|
|
(this->_sprite)._color._tint[2] = fVar2;
|
|
(this->_sprite)._color._tint[3] = fVar3;
|
|
fVar1 = championColor[5];
|
|
fVar2 = championColor[6];
|
|
fVar3 = championColor[7];
|
|
(this->_sprite)._color._colorize[0] = championColor[4];
|
|
(this->_sprite)._color._colorize[1] = fVar1;
|
|
(this->_sprite)._color._colorize[2] = fVar2;
|
|
(this->_sprite)._color._colorize[3] = fVar3;
|
|
*GHIDRA_CAST<uint64_t *>((this->_sprite)._color._offset) = *GHIDRA_CAST<uint64_t *>((championColor + 8));
|
|
(this->_sprite)._color._offset[2] = championColor[10];
|
|
}
|
|
}
|
|
}
|
|
if (((this->_flags & 0x20000000) != 0) &&
|
|
(((this->_type != 0x17 || (this->_variant != 0)) || (this->_subtype != 1)))) {
|
|
spriteColor = &(this->_sprite)._color;
|
|
if (spriteColor != GHIDRA_CAST<ColorMod *>(local_b4)) {
|
|
spriteColor->_tint[0] = 0.8;
|
|
(this->_sprite)._color._tint[1] = 0.8;
|
|
(this->_sprite)._color._tint[2] = 0.8;
|
|
(this->_sprite)._color._tint[3] = 1.0;
|
|
(this->_sprite)._color._offset[0] = 0.1;
|
|
(this->_sprite)._color._offset[1] = 0.1;
|
|
(this->_sprite)._color._colorize[0] = 1.0;
|
|
(this->_sprite)._color._colorize[1] = 1.0;
|
|
(this->_sprite)._color._colorize[2] = 1.0;
|
|
(this->_sprite)._color._colorize[3] = -0.5;
|
|
(this->_sprite)._color._offset[2] = 0.1;
|
|
}
|
|
}
|
|
fVar3 = fRam00c34218;
|
|
fVar2 = fRam00c34214;
|
|
fVar1 = fRam00c34210;
|
|
if ((this->_type == 0x3c3) &&
|
|
(spriteColor = &(this->_sprite)._color, spriteColor != GHIDRA_CAST<ColorMod *>(&DAT_00c3420c))) {
|
|
spriteColor->_tint[0] = _DAT_00c3420c;
|
|
(this->_sprite)._color._tint[1] = fVar1;
|
|
(this->_sprite)._color._tint[2] = fVar2;
|
|
(this->_sprite)._color._tint[3] = fVar3;
|
|
fVar3 = fRam00c34228;
|
|
fVar2 = fRam00c34224;
|
|
fVar1 = fRam00c34220;
|
|
(this->_sprite)._color._colorize[0] = _DAT_00c3421c;
|
|
(this->_sprite)._color._colorize[1] = fVar1;
|
|
(this->_sprite)._color._colorize[2] = fVar2;
|
|
(this->_sprite)._color._colorize[3] = fVar3;
|
|
*GHIDRA_CAST<uint64_t *>((this->_sprite)._color._offset) = DAT_00c3422c;
|
|
(this->_sprite)._color._offset[2] = DAT_00c34234;
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006c1ac0
|
|
void * Entity_NPC::shopkeeper_get_loot(void *outLoot, uint8_t isShouldAdvance)
|
|
{
|
|
code *pcVar1;
|
|
uint8_t bVar2;
|
|
uint8_t isRemoved;
|
|
void *dequeMap;
|
|
void *block;
|
|
int triesLeft;
|
|
int iVar3;
|
|
uint32_t local_ESI_258;
|
|
RNG *rng;
|
|
int *ptr;
|
|
int *lootList;
|
|
void *lootMap;
|
|
int lootMapSize;
|
|
uint32_t lootOffset;
|
|
int lootCount;
|
|
uint32_t local_38;
|
|
RNG rngCopy;
|
|
uint32_t local_24;
|
|
uint8_t *puStack_20;
|
|
void *local_1c;
|
|
uint8_t *puStack_18;
|
|
uint32_t local_14;
|
|
RNG *dropRng;
|
|
RNG *lootRng;
|
|
int lootSubtype;
|
|
uint32_t lootType;
|
|
uint32_t temp_3f540a64be;
|
|
|
|
puStack_20 = GHIDRA_CAST<uint8_t *>((GHIDRA_INT(register0x00000010) + -4));
|
|
local_14 = 0xffffffff;
|
|
puStack_18 = &LAB_00afa8ed;
|
|
local_1c = ExceptionList;
|
|
local_24 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U;
|
|
ExceptionList = &local_1c;
|
|
lootList = GHIDRA_CAST<int *>(0x0);
|
|
lootMap = (void *)0x0;
|
|
lootMapSize = 0;
|
|
lootOffset = 0;
|
|
lootCount = 0;
|
|
lootList = operator_new(8);
|
|
lootList[1] = 0;
|
|
*lootList = GHIDRA_INT(&lootList);
|
|
local_14 = 0;
|
|
if ((this->_flags & 0x40000000000) != 0) {
|
|
(GHIDRA_CAST<LootList *>((outLoot)))->LootList::LootList(&lootList);
|
|
if (lootCount != 0) {
|
|
do {
|
|
lootCount = lootCount + -1;
|
|
} while (lootCount != 0);
|
|
lootOffset = 0;
|
|
lootCount = 0;
|
|
}
|
|
dequeMap = lootMap;
|
|
iVar3 = lootMapSize;
|
|
if (lootMapSize != 0) {
|
|
do {
|
|
block = *(void **)(GHIDRA_CAST<char *>(dequeMap) + iVar3 * 4 + -4);
|
|
iVar3 = iVar3 + -1;
|
|
if (block != (void *)0x0) {
|
|
operator_delete(block,0x14);
|
|
dequeMap = lootMap;
|
|
}
|
|
} while (iVar3 != 0);
|
|
}
|
|
if (dequeMap != (void *)0x0) {
|
|
local_ESI_258 = lootMapSize * 4;
|
|
block = dequeMap;
|
|
if (0xfff < local_ESI_258) {
|
|
block = *(void **)(GHIDRA_CAST<char *>(dequeMap) + -4);
|
|
local_ESI_258 = local_ESI_258 + 0x23;
|
|
if (0x1f < GHIDRA_UINT((GHIDRA_INT(dequeMap) + (-4 - GHIDRA_INT(block))))) goto LAB_006c2071;
|
|
}
|
|
operator_delete(block,local_ESI_258);
|
|
}
|
|
ptr = lootList;
|
|
goto LAB_006c2087;
|
|
}
|
|
lootRng = &this->_dropRNG;
|
|
rng = &rngCopy;
|
|
if (isShouldAdvance != 0) {
|
|
rng = lootRng;
|
|
}
|
|
rngCopy._seed = (this->_dropRNG)._seed;
|
|
rngCopy._shift1 = (this->_dropRNG)._shift1;
|
|
rngCopy._shift2 = (this->_dropRNG)._shift2;
|
|
rngCopy._shift3 = (this->_dropRNG)._shift3;
|
|
if ((this->_variant == 3) || (this->_variant == 4)) {
|
|
local_38 = rng->_seed;
|
|
if (local_38 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
|
|
local_38 = rng->_seed;
|
|
if (local_38 == 0) {
|
|
pcVar1 = (code *)swi(3);
|
|
dequeMap = (void *)(*pcVar1)();
|
|
return dequeMap;
|
|
}
|
|
}
|
|
local_38 = local_38 >> ((uint8_t)rng->_shift1 & 0x1f) ^ local_38;
|
|
local_38 = local_38 ^ local_38 << ((uint8_t)rng->_shift2 & 0x1f);
|
|
local_38 = local_38 ^ local_38 >> ((uint8_t)rng->_shift3 & 0x1f);
|
|
rng->_seed = local_38;
|
|
if (((local_38 & 0x7f) == 0) && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 8)) != 5)) {
|
|
local_ESI_258 = (GHIDRA_CAST<RNG *>((rng)))->RNG::Next();
|
|
lootSubtype = 0;
|
|
temp_3f540a64be = 0;
|
|
lootType = 0x32;
|
|
goto LAB_006c1ff3;
|
|
}
|
|
if (local_38 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
|
|
local_38 = rng->_seed;
|
|
if (local_38 == 0) {
|
|
pcVar1 = (code *)swi(3);
|
|
dequeMap = (void *)(*pcVar1)();
|
|
return dequeMap;
|
|
}
|
|
}
|
|
local_38 = local_38 >> ((uint8_t)rng->_shift1 & 0x1f) ^ local_38;
|
|
local_38 = local_38 ^ local_38 << ((uint8_t)rng->_shift2 & 0x1f);
|
|
local_38 = local_38 ^ local_38 >> ((uint8_t)rng->_shift3 & 0x1f);
|
|
rng->_seed = local_38;
|
|
if ((local_38 & 0x1f) == 0) {
|
|
iVar3 = 3;
|
|
LAB_006c1ea1:
|
|
lootSubtype = 0;
|
|
triesLeft = iVar3;
|
|
do {
|
|
iVar3 = triesLeft + -1;
|
|
if (triesLeft < 1) {
|
|
if (lootSubtype == 0) goto LAB_006c1ffb;
|
|
LAB_006c1f71:
|
|
if (isShouldAdvance != 0) {
|
|
ItemPool::RemoveTrinket(&g_game->_itemPool,lootSubtype);
|
|
}
|
|
local_ESI_258 = (GHIDRA_CAST<RNG *>((rng)))->RNG::Next();
|
|
temp_3f540a64be = 0x15e;
|
|
goto LAB_006c1ff1;
|
|
}
|
|
if (local_38 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
|
|
local_38 = rng->_seed;
|
|
if (local_38 == 0) {
|
|
pcVar1 = (code *)swi(3);
|
|
dequeMap = (void *)(*pcVar1)();
|
|
return dequeMap;
|
|
}
|
|
}
|
|
local_38 = local_38 >> ((uint8_t)rng->_shift1 & 0x1f) ^ local_38;
|
|
local_38 = local_38 << ((uint8_t)rng->_shift2 & 0x1f) ^ local_38;
|
|
local_38 = local_38 >> ((uint8_t)rng->_shift3 & 0x1f) ^ local_38;
|
|
rng->_seed = local_38;
|
|
switch(local_38 % 6) {
|
|
case 0:
|
|
lootSubtype = 1;
|
|
break;
|
|
case 1:
|
|
lootSubtype = 0x18;
|
|
break;
|
|
case 2:
|
|
lootSubtype = 0x31;
|
|
break;
|
|
case 3:
|
|
lootSubtype = 0x32;
|
|
break;
|
|
case 4:
|
|
lootSubtype = 0x33;
|
|
break;
|
|
case 5:
|
|
lootSubtype = 0x34;
|
|
}
|
|
dequeMap = (g_game->_itemPool)._trinketPoolItems._begin;
|
|
if ((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(dequeMap) + lootSubtype * 8 + 4)) == '\0') ||
|
|
(*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(dequeMap) + lootSubtype * 8 + 5)) == '\0')) goto LAB_006c1ea1;
|
|
if (lootSubtype != 0) goto LAB_006c1f71;
|
|
triesLeft = iVar3;
|
|
} while( true );
|
|
}
|
|
if (local_38 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
|
|
local_38 = rng->_seed;
|
|
if (local_38 == 0) {
|
|
pcVar1 = (code *)swi(3);
|
|
dequeMap = (void *)(*pcVar1)();
|
|
return dequeMap;
|
|
}
|
|
}
|
|
local_ESI_258 = local_38 >> ((uint8_t)rng->_shift1 & 0x1f) ^ local_38;
|
|
local_ESI_258 = local_ESI_258 ^ local_ESI_258 << ((uint8_t)rng->_shift2 & 0x1f);
|
|
local_ESI_258 = local_ESI_258 ^ local_ESI_258 >> ((uint8_t)rng->_shift3 & 0x1f);
|
|
rng->_seed = local_ESI_258;
|
|
if (local_ESI_258 != (local_ESI_258 / 3) * 3) {
|
|
local_ESI_258 = (GHIDRA_CAST<RNG *>((rng)))->RNG::Next();
|
|
lootSubtype = 2;
|
|
LAB_006c1fef:
|
|
temp_3f540a64be = 0x14;
|
|
goto LAB_006c1ff1;
|
|
}
|
|
}
|
|
else {
|
|
local_ESI_258 = rng->_seed;
|
|
if (local_ESI_258 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
|
|
local_ESI_258 = rng->_seed;
|
|
if (local_ESI_258 == 0) {
|
|
pcVar1 = (code *)swi(3);
|
|
dequeMap = (void *)(*pcVar1)();
|
|
return dequeMap;
|
|
}
|
|
}
|
|
local_ESI_258 = local_ESI_258 >> ((uint8_t)rng->_shift1 & 0x1f) ^ local_ESI_258;
|
|
local_ESI_258 = local_ESI_258 ^ local_ESI_258 << ((uint8_t)rng->_shift2 & 0x1f);
|
|
local_ESI_258 = local_ESI_258 ^ local_ESI_258 >> ((uint8_t)rng->_shift3 & 0x1f);
|
|
rng->_seed = local_ESI_258;
|
|
if (local_ESI_258 % 100 == 0) {
|
|
local_38 = CONCAT31((int3)(GHIDRA_UINT(g_game) >> 8),isShouldAdvance) ^ 1;
|
|
bVar2 = ItemPool::RemoveCollectible(&g_game->_itemPool,0x40,1,(uint8_t)local_38);
|
|
if (bVar2 == 0) {
|
|
bVar2 = (uint8_t)local_38;
|
|
goto LAB_006c1cb2;
|
|
}
|
|
local_ESI_258 = (GHIDRA_CAST<RNG *>((rng)))->RNG::Next();
|
|
lootSubtype = 0x40;
|
|
temp_3f540a64be = 100;
|
|
}
|
|
else {
|
|
bVar2 = isShouldAdvance ^ 1;
|
|
LAB_006c1cb2:
|
|
local_38 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_38)) + 0x1))),bVar2);
|
|
local_ESI_258 = (GHIDRA_CAST<RNG *>((rng)))->RNG::RandomInt(100);
|
|
bVar2 = (uint8_t)local_38;
|
|
if ((local_ESI_258 == 0) &&
|
|
(isRemoved = ItemPool::RemoveCollectible(&g_game->_itemPool,0x1ad,1,bVar2), isRemoved != 0)
|
|
) {
|
|
local_ESI_258 = (GHIDRA_CAST<RNG *>((rng)))->RNG::Next();
|
|
lootSubtype = 0x1ad;
|
|
temp_3f540a64be = 100;
|
|
}
|
|
else {
|
|
local_ESI_258 = (GHIDRA_CAST<RNG *>((rng)))->RNG::RandomInt(100);
|
|
if ((local_ESI_258 != 0) ||
|
|
((((g_manager->_persistentGameData)._achievements[0x16c] == 0 &&
|
|
(((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((g_manager)) + 0x8)))) != 2 || (g_game == GHIDRA_CAST<Game *>(0x0))) ||
|
|
(((g_game->_dailyChallenge)._id == 0 && (g_game->_isDebug == 0)))))) ||
|
|
(bVar2 = ItemPool::RemoveCollectible(&g_game->_itemPool,0x209,1,bVar2), bVar2 == 0)))) {
|
|
local_ESI_258 = (GHIDRA_CAST<RNG *>((rng)))->RNG::RandomInt(3);
|
|
if (local_ESI_258 != 1) {
|
|
if (local_ESI_258 == 2) {
|
|
local_ESI_258 = (GHIDRA_CAST<RNG *>((rng)))->RNG::Next();
|
|
msvc::deque<LootEntry>::push_back(5,0x14,0,local_ESI_258,0);
|
|
local_ESI_258 = (GHIDRA_CAST<RNG *>((rng)))->RNG::Next();
|
|
lootSubtype = 0;
|
|
goto LAB_006c1fef;
|
|
}
|
|
goto LAB_006c1ffb;
|
|
}
|
|
lootRng = &this->_dropRNG;
|
|
dropRng = lootRng;
|
|
local_ESI_258 = (GHIDRA_CAST<RNG *>((rng)))->RNG::Next();
|
|
msvc::deque<LootEntry>::push_back(0x55,0,0,local_ESI_258,dropRng);
|
|
local_ESI_258 = (GHIDRA_CAST<RNG *>((rng)))->RNG::Next();
|
|
lootSubtype = 0;
|
|
temp_3f540a64be = 0;
|
|
lootType = 0x55;
|
|
goto LAB_006c1ff3;
|
|
}
|
|
local_ESI_258 = (GHIDRA_CAST<RNG *>((rng)))->RNG::Next();
|
|
lootSubtype = 0x209;
|
|
temp_3f540a64be = 100;
|
|
}
|
|
}
|
|
LAB_006c1ff1:
|
|
lootRng = GHIDRA_CAST<RNG *>(0x0);
|
|
lootType = 5;
|
|
LAB_006c1ff3:
|
|
msvc::deque<LootEntry>::push_back(lootType,temp_3f540a64be,lootSubtype,local_ESI_258,lootRng);
|
|
}
|
|
LAB_006c1ffb:
|
|
(GHIDRA_CAST<LootList *>((outLoot)))->LootList::LootList(&lootList);
|
|
if (lootCount != 0) {
|
|
do {
|
|
lootCount = lootCount + -1;
|
|
} while (lootCount != 0);
|
|
lootOffset = 0;
|
|
lootCount = 0;
|
|
}
|
|
dequeMap = lootMap;
|
|
iVar3 = lootMapSize;
|
|
if (lootMapSize != 0) {
|
|
do {
|
|
block = *(void **)(GHIDRA_CAST<char *>(dequeMap) + iVar3 * 4 + -4);
|
|
iVar3 = iVar3 + -1;
|
|
if (block != (void *)0x0) {
|
|
operator_delete(block,0x14);
|
|
dequeMap = lootMap;
|
|
}
|
|
} while (iVar3 != 0);
|
|
}
|
|
if (dequeMap != (void *)0x0) {
|
|
local_ESI_258 = lootMapSize * 4;
|
|
block = dequeMap;
|
|
if (0xfff < local_ESI_258) {
|
|
block = *(void **)(GHIDRA_CAST<char *>(dequeMap) + -4);
|
|
local_ESI_258 = local_ESI_258 + 0x23;
|
|
if (0x1f < GHIDRA_UINT((GHIDRA_INT(dequeMap) + (-4 - GHIDRA_INT(block))))) {
|
|
LAB_006c2071:
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(block,local_ESI_258);
|
|
}
|
|
ptr = lootList;
|
|
LAB_006c2087:
|
|
lootMapSize = 0;
|
|
lootMap = (void *)0x0;
|
|
lootList = GHIDRA_CAST<int *>(0x0);
|
|
operator_delete(ptr,8);
|
|
ExceptionList = local_1c;
|
|
return outLoot;
|
|
}
|
|
|
|
// 006c2750
|
|
Entity_NPC * Entity_NPC::ThrowSpider(Vector *position, Entity *spawner, Vector targetPos, uint8_t isBig, float yOffset)
|
|
{
|
|
Vector *freePos;
|
|
uint32_t uVar1;
|
|
Entity_NPC *spider;
|
|
uint32_t type;
|
|
Entity *spawned;
|
|
int gridY;
|
|
Game *currentGame;
|
|
int gridX;
|
|
float fVar2;
|
|
float fVar3;
|
|
Vector freePosBuffer;
|
|
Game *game;
|
|
void *room;
|
|
float spiderY;
|
|
|
|
if ((targetPos.x == g_vectorZero.x) && (targetPos.y == g_vectorZero.y)) {
|
|
freePos = Room::FindFreePickupSpawnPosition(g_game->_room,&freePosBuffer,position,100.0,0,0,0);
|
|
targetPos.x = freePos->x;
|
|
targetPos.y = freePos->y;
|
|
}
|
|
game = g_game;
|
|
if (g_game->_challenge == 0x2c) {
|
|
uVar1 = (GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level::GetRoomStageType(g_game->_currentRoomIdx);
|
|
}
|
|
else {
|
|
currentGame = g_game;
|
|
fVar2 = targetPos.x;
|
|
if (g_game->_currentDimensionIdx == 2) goto LAB_006c2838;
|
|
uVar1 = g_game->_stageType;
|
|
}
|
|
currentGame = g_game;
|
|
fVar2 = targetPos.x;
|
|
uVar1 = RoomConfig::GetStageID(game->_stage,uVar1,-1);
|
|
if (((uVar1 == 0x1b) || (uVar1 == 0x1c)) && (0.1 < *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(currentGame->_room) + 0x7240))))
|
|
{
|
|
spider = ThrowStrider(position,spawner,&targetPos);
|
|
return spider;
|
|
}
|
|
LAB_006c2838:
|
|
room = currentGame->_room;
|
|
gridX = GHIDRA_INT(((fVar2 - 40.0) / 40.0 + 0.5));
|
|
gridY = GHIDRA_INT(((targetPos.y - 120.0) / 40.0 + 0.5));
|
|
if ((((-1 < gridX) && (gridX < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(room) + 0xc)))) &&
|
|
((-1 < gridY &&
|
|
((gridY < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(room) + 0x10)) &&
|
|
(uVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(room) + 0xc)) * gridY + gridX, uVar1 < 0x1c0)))))) &&
|
|
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(room) + uVar1 * 4 + 0x76c)) < 0x3b7)) {
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(room) + uVar1 * 4 + 0x76c)) = 900;
|
|
}
|
|
uVar1 = Random();
|
|
type = 0x55;
|
|
if (isBig != 0) {
|
|
type = 0x5e;
|
|
}
|
|
spawned = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(type,0,position,&g_vectorZero,spawner,0,uVar1,0);
|
|
spider = (Entity_NPC *)
|
|
__RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor,
|
|
&IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0);
|
|
spider->_state = 6;
|
|
(spider->_targetPosition).x = targetPos.x;
|
|
(spider->_targetPosition).y = targetPos.y;
|
|
fVar2 = (spider->_targetPosition).x;
|
|
fVar3 = (spider->_pos).x;
|
|
spiderY = (spider->_pos).y;
|
|
(spider->_v2).y = -8.0;
|
|
fVar3 = (fVar2 - fVar3) * 0.04;
|
|
spider->_entityCollisionClass = 0;
|
|
fVar2 = (targetPos.y - spiderY) * 0.04;
|
|
(spider->_velocity).x = fVar3;
|
|
(spider->_v1).x = fVar3;
|
|
(spider->_velocity).y = fVar2;
|
|
(spider->_v1).y = fVar2;
|
|
(spider->_posOffset).y = yOffset;
|
|
return spider;
|
|
}
|
|
|
|
// 006c4ac0
|
|
void Entity_NPC::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;
|
|
if (((this->_type == 0x340) && (this->_variant == 0)) && (this->_dead == 0)) {
|
|
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(g_game->_room) + 0x7768)) = 1;
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006c4b30
|
|
void Entity_NPC::Update()
|
|
{
|
|
code *pcVar1;
|
|
BitSet128 tearFlags;
|
|
uint8_t bVar2;
|
|
char cVar3;
|
|
uint32_t uVar4;
|
|
uint8_t *layerCount;
|
|
SoundEffects *sfx;
|
|
ColorMod *color;
|
|
ColorMod *extraout_EAX;
|
|
LayerState *firstLayer;
|
|
Sprite *pSVar5;
|
|
std_string *psVar6;
|
|
Entity *pEVar7;
|
|
void *pvVar8;
|
|
Entity_Effect *pEVar9;
|
|
Room *pRVar10;
|
|
GridEntity_Poop *poop;
|
|
uint32_t *entitySlot;
|
|
uint8_t *puVar11;
|
|
ColorMod *tmpColor;
|
|
Vector *tmpVec;
|
|
float *clampedValue;
|
|
ColorMod *to;
|
|
uint32_t extraout_EAX_00;
|
|
Sprite *sprite;
|
|
ANM2 *pAVar12;
|
|
ColorMod *to_00;
|
|
uint32_t extraout_EAX_01;
|
|
EntityList *entityList;
|
|
uint32_t extraout_EAX_02;
|
|
ColorMod *to_01;
|
|
Entity_Player *player;
|
|
uint32_t uVar13;
|
|
GridEntity *gridEntity;
|
|
PlayerManager *playerManager;
|
|
RNG *this_00;
|
|
RNG *sfx;
|
|
int *piVar14;
|
|
Vector *tmpVec2;
|
|
undefined3 extraout_var;
|
|
TemporaryEffects *tempEffects;
|
|
uint32_t extraout_EAX_03;
|
|
Color *spriteColor;
|
|
EntityRef *sourceRef;
|
|
PersistentGameData *entityList;
|
|
AnimationState *animState;
|
|
Camera *camera;
|
|
Entity_Projectile *projectile;
|
|
int iVar15;
|
|
int iVar16;
|
|
uint8_t *layer;
|
|
uint8_t *puVar17;
|
|
ANM2 *pAVar18;
|
|
long double fVar19;
|
|
float fVar20;
|
|
float fVar21;
|
|
uint8_t auVar22 [12];
|
|
uint8_t auVar23 [16];
|
|
uint8_t extraout_var_00 [12];
|
|
uint8_t auVar24 [16];
|
|
uint8_t auVar25 [16];
|
|
uint8_t auVar26 [16];
|
|
float fVar27;
|
|
float in_XMM3_Da;
|
|
uint32_t in_stack_fffffc50;
|
|
uint32_t in_stack_fffffc54;
|
|
uint32_t in_stack_fffffc58;
|
|
uint32_t in_stack_fffffc5c;
|
|
Entity_NPC *source;
|
|
uint32_t uVar28;
|
|
TypeDescriptor *pTVar29;
|
|
TypeDescriptor *pTVar30;
|
|
uint8_t damageSource;
|
|
ProjectileParams *pPVar31;
|
|
KColor *src;
|
|
uint32_t uVar32;
|
|
uint32_t uVar33;
|
|
Vector healTargetPos;
|
|
Vector healEffectPos;
|
|
Vector local_364;
|
|
Vector local_35c;
|
|
Vector local_354;
|
|
Vector local_34c;
|
|
Vector local_344;
|
|
Vector local_33c;
|
|
Vector local_334;
|
|
Vector local_32c;
|
|
float randomLength;
|
|
Vector local_320;
|
|
uint8_t local_318 [16];
|
|
Vector local_308;
|
|
Vector local_300;
|
|
Vector local_2f8;
|
|
Vector local_2f0;
|
|
Vector local_2e8;
|
|
Vector local_2e0;
|
|
Entity *local_2d8;
|
|
uint8_t isDeadBefore;
|
|
Vector local_2d0;
|
|
Room *local_2c4;
|
|
Entity *local_2c0;
|
|
Entity_NPC *npc;
|
|
Vector local_2b8;
|
|
Entity *local_2b0;
|
|
Room *local_2ac;
|
|
uint8_t local_2a5;
|
|
Entity_Effect *local_2a4;
|
|
ANM2 *local_2a0;
|
|
Room *local_29c;
|
|
Vector local_298;
|
|
Entity *local_290;
|
|
Entity_Effect *local_28c;
|
|
Room *local_288;
|
|
uint8_t local_281;
|
|
Color local_254;
|
|
ProjectileParams projectileParams;
|
|
Color spriteColorCopy;
|
|
Color local_150;
|
|
Color local_124;
|
|
Color local_f8;
|
|
uint8_t local_cc [44];
|
|
uint8_t local_a0 [60];
|
|
char local_64 [4];
|
|
uint8_t local_60 [8];
|
|
float local_58;
|
|
Vector local_54;
|
|
uint8_t local_4c [20];
|
|
KColor local_38;
|
|
uint32_t local_24;
|
|
uint8_t *puStack_20;
|
|
void *local_1c;
|
|
uint8_t *puStack_18;
|
|
uint32_t local_14;
|
|
void **aimTargetSlot;
|
|
char *deathAnim;
|
|
uint64_t entityFlags;
|
|
uint32_t *flagsHighPtr;
|
|
Game *game;
|
|
bool isMyShadowCharger;
|
|
short regenTimer;
|
|
|
|
puStack_20 = local_4c + 0x48;
|
|
local_14 = 0xffffffff;
|
|
puStack_18 = &LAB_00afaabc;
|
|
local_1c = ExceptionList;
|
|
uVar4 = __security_cookie ^ GHIDRA_UINT((local_4c + 0x3c));
|
|
local_2a4 = GHIDRA_CAST<Entity_Effect *>(0x0);
|
|
local_28c = GHIDRA_CAST<Entity_Effect *>(0x0);
|
|
if (this->_exists == 0) {
|
|
return;
|
|
}
|
|
ExceptionList = &local_1c;
|
|
npc = this;
|
|
local_24 = uVar4;
|
|
fVar20 = compute_speed_multiplier(this);
|
|
this->_speedMultiplier = fVar20;
|
|
UpdateChildEffectPosition(this,0);
|
|
if (this->_controllerID == -1) {
|
|
aimTargetSlot = &this->_aimTargetEffect;
|
|
(this->_controllerMovement).x = g_vectorZero.x;
|
|
(this->_controllerMovement).y = g_vectorZero.y;
|
|
if (*aimTargetSlot != GHIDRA_CAST<int *>(0x0)) {
|
|
(**(code **)(*GHIDRA_CAST<int *>(*aimTargetSlot) + 0x28))(uVar4);
|
|
if (*aimTargetSlot != (void *)0x0) {
|
|
local_288 = GHIDRA_CAST<Room *>(aimTargetSlot);
|
|
msvc::multiset<unsigned_int>::erase(&local_288);
|
|
}
|
|
*aimTargetSlot = (void *)0x0;
|
|
}
|
|
}
|
|
if ((this->_flags & 0x2000000000000) != 0) {
|
|
update_frozen();
|
|
ExceptionList = local_1c;
|
|
return;
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFrame(2,0);
|
|
if ((((bVar2 != 0) && ((this->_flags & 0x20000000) == 0)) &&
|
|
(bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsActiveEnemy(0), bVar2 != 0)) &&
|
|
(bVar2 = TemporaryEffects::HasNullEffect
|
|
(GHIDRA_CAST<TemporaryEffects *>((GHIDRA_INT(g_game->_room) + 0x7310)),0x40), bVar2 != 0)) {
|
|
::(GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>(local_4c))))->EntityRef::constructor(GHIDRA_CAST<Entity *>(0x0));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::AddWeakness(GHIDRA_CAST<EntityRef *>(local_4c),-3);
|
|
}
|
|
iVar16 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf58))));
|
|
if ((iVar16 != 0) && (*GHIDRA_CAST<Entity_NPC **>((iVar16 + 0x3c4)) == this)) {
|
|
*GHIDRA_CAST<float *>((iVar16 + 0x33c)) = (this->_pos).x;
|
|
*GHIDRA_CAST<float *>((iVar16 + 0x340)) = (this->_pos).y;
|
|
iVar16 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf58))));
|
|
*GHIDRA_CAST<float *>((iVar16 + 0x360)) = (this->_velocity).x;
|
|
*GHIDRA_CAST<float *>((iVar16 + 0x364)) = (this->_velocity).y;
|
|
}
|
|
if (((this->_type == 0x17) && (this->_variant == 0)) && (this->_subtype == 1)) {
|
|
isMyShadowCharger = true;
|
|
}
|
|
else {
|
|
isMyShadowCharger = false;
|
|
}
|
|
local_290 = GHIDRA_CAST<Entity *>(0x0);
|
|
if (this->_championColorIdx == 0x16) {
|
|
local_290 = GHIDRA_CAST<Entity *>(0xb6757c);
|
|
LAB_006c4d15:
|
|
iVar16 = 1;
|
|
}
|
|
else {
|
|
iVar16 = 0;
|
|
if (this->_championColorIdx == 0x17) {
|
|
local_290 = GHIDRA_CAST<Entity *>(0xb67584);
|
|
goto LAB_006c4d15;
|
|
}
|
|
}
|
|
entityFlags = this->_flags;
|
|
if (((entityFlags & 0x100) == 0) || (isMyShadowCharger)) {
|
|
if ((this->_flags & 0x100000000000000) != 0) {
|
|
local_290 = GHIDRA_CAST<Entity *>(0xb67638);
|
|
goto LAB_006c4f0d;
|
|
}
|
|
if ((this->_flags & 0x8000000000000) != 0) {
|
|
local_290 = GHIDRA_CAST<Entity *>(0xb67648);
|
|
goto LAB_006c4f0d;
|
|
}
|
|
if ((this->_flags & 0x10000000000000) != 0) {
|
|
local_290 = GHIDRA_CAST<Entity *>(&DAT_00b67654);
|
|
iVar16 = 0;
|
|
goto LAB_006c4f12;
|
|
}
|
|
if ((entityFlags & 0x200) != 0) {
|
|
local_290 = GHIDRA_CAST<Entity *>(0xb67610);
|
|
goto LAB_006c4f0d;
|
|
}
|
|
if ((entityFlags & 0x1000) != 0) {
|
|
local_290 = GHIDRA_CAST<Entity *>(0xb67618);
|
|
iVar16 = 0;
|
|
goto LAB_006c4f12;
|
|
}
|
|
if ((entityFlags & 0x40) != 0) {
|
|
local_290 = GHIDRA_CAST<Entity *>(0xb67620);
|
|
goto LAB_006c4f0d;
|
|
}
|
|
if ((entityFlags & 0x800) != 0) {
|
|
local_290 = GHIDRA_CAST<Entity *>(&DAT_00b67628);
|
|
goto LAB_006c4f0d;
|
|
}
|
|
if ((this->_flags & 0x400000000) != 0) {
|
|
local_290 = GHIDRA_CAST<Entity *>(0xb67690);
|
|
goto LAB_006c4f0d;
|
|
}
|
|
if (((entityFlags & 0x80) != 0) ||
|
|
((((bVar2 = TemporaryEffects::HasCollectibleEffect
|
|
(GHIDRA_CAST<TemporaryEffects *>((GHIDRA_INT(g_game->_room) + 0x7310)),0xe8), bVar2 != 0 ||
|
|
(bVar2 = TemporaryEffects::HasCollectibleEffect
|
|
(GHIDRA_CAST<TemporaryEffects *>((GHIDRA_INT(g_game->_room) + 0x7310)),0x42), bVar2 != 0))
|
|
|| ((g_game->_challenge != 0x16 && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0x1210)) == 1)))) &&
|
|
(((this->_flags & 0x20000001) == 0 || (this->_type == 0xd4)))))) {
|
|
local_290 = GHIDRA_CAST<Entity *>(&DAT_00b6769c);
|
|
goto LAB_006c4f0d;
|
|
}
|
|
if ((this->_flags & 0x40000000000000) != 0) {
|
|
local_290 = GHIDRA_CAST<Entity *>(0xb676a4);
|
|
goto LAB_006c4f0d;
|
|
}
|
|
if (this->_type == 0x3c6) {
|
|
local_290 = GHIDRA_CAST<Entity *>(0xb676b0);
|
|
goto LAB_006c4f0d;
|
|
}
|
|
if (local_290 != GHIDRA_CAST<Entity *>(0x0)) goto LAB_006c4f12;
|
|
if ((this->_statusEffectSprite)._animState._animData != (void *)0x0) {
|
|
(this->_statusEffectSprite)._animState._isPlaying = 0;
|
|
}
|
|
}
|
|
else {
|
|
local_290 = GHIDRA_CAST<Entity *>(0xb67630);
|
|
LAB_006c4f0d:
|
|
iVar16 = 1;
|
|
LAB_006c4f12:
|
|
if ((this->_statusEffectSprite)._loaded == 0) {
|
|
(GHIDRA_CAST<msvc::string *>((local_4c + 0x10)))->msvc::string::string_from_cstr(GHIDRA_CAST<uint8_t *>("gfx/StatusEffects.anm2"));
|
|
local_14 = 0;
|
|
ANM2::Load(&this->_statusEffectSprite,GHIDRA_CAST<std_string *>((local_4c + 0x10)),1);
|
|
local_14 = 0xffffffff;
|
|
(GHIDRA_CAST<msvc::string *>((local_4c + 0x10)))->msvc::string::_Tidy_deallocate();
|
|
}
|
|
bVar2 = ANM2::IsPlaying(&this->_statusEffectSprite,&s_empty);
|
|
if ((bVar2 != 0) && ((this->_statusEffectSprite)._loaded != 0)) {
|
|
AnimationState::Update(&(this->_statusEffectSprite)._animState);
|
|
AnimationState::Update(&(this->_statusEffectSprite)._overlayAnimState);
|
|
}
|
|
ANM2::Play(&this->_statusEffectSprite,GHIDRA_CAST<uint8_t *>(local_290),0);
|
|
(this->_statusEffectSprite)._bitflags = iVar16 << 0x1f;
|
|
}
|
|
iVar16 = this->_pauseTimer;
|
|
if ((iVar16 == 0) && ((this->_flags & 0x200000000000000) == 0)) {
|
|
isDeadBefore = this->_dead;
|
|
}
|
|
else {
|
|
if (((this->_pausePosition).x == g_vectorZero.x) && ((this->_pausePosition).y == g_vectorZero.y)
|
|
) {
|
|
(this->_pausePosition).x = (this->_pos).x;
|
|
(this->_pausePosition).y = (this->_pos).y;
|
|
iVar16 = this->_pauseTimer;
|
|
}
|
|
if ((0 < iVar16) && (this->_pauseTimer = iVar16 + -1, 0 < iVar16 + -1)) {
|
|
(this->_pos).x = (this->_pausePosition).x;
|
|
(this->_pos).y = (this->_pausePosition).y;
|
|
}
|
|
(this->_velocity).x = (this->_velocity).x * 0.6;
|
|
(this->_velocity).y = (this->_velocity).y * 0.6;
|
|
local_281 = this->_dead;
|
|
spawn_damage_numbers(this);
|
|
update_damage_history(this);
|
|
if ((this->_aiCallFlags & 1) != 0) {
|
|
this->_aiCallPhase = 1;
|
|
Entity_NPC_UpdateAI_dispatch(this);
|
|
this->_aiCallPhase = 0;
|
|
}
|
|
uVar4 = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
|
|
local_288 = GHIDRA_CAST<Room *>(this->_health);
|
|
if ((uVar4 & 1) == 0) {
|
|
*GHIDRA_CAST<int *>(&this->_flags) = GHIDRA_INT(this->_flags);
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = uVar4 ^ 1;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::Update();
|
|
*GHIDRA_CAST<int *>(&this->_flags) = GHIDRA_INT(this->_flags);
|
|
flagsHighPtr = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
|
|
*flagsHighPtr = *flagsHighPtr ^ 1;
|
|
}
|
|
else {
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::Update();
|
|
}
|
|
local_288 = GHIDRA_CAST<Room *>(((float)local_288 - this->_health));
|
|
local_2ac = GHIDRA_CAST<Room *>(0x0);
|
|
clampedValue = GHIDRA_CAST<float *>(std)::max<float>();
|
|
isDeadBefore = this->_dead;
|
|
this->_totalDamageTaken = *clampedValue + this->_totalDamageTaken;
|
|
if (local_281 == isDeadBefore) {
|
|
ExceptionList = local_1c;
|
|
return;
|
|
}
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(4);
|
|
iVar16 = this->_state;
|
|
if (bVar2 == 0) {
|
|
if (iVar16 != 1) goto LAB_006c58e9;
|
|
this->_state = this->_savedState;
|
|
}
|
|
else if (iVar16 == 1) {
|
|
iVar16 = this->_appearFrames;
|
|
if (iVar16 == 0) {
|
|
this->_state = 0;
|
|
if (this->_championColorIdx == 6) {
|
|
this->_isInvicible = 1;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::AddEntityFlags(1);
|
|
}
|
|
Entity_NPC_UpdateAI_dispatch(this);
|
|
if ((this->_championColorIdx == 0x11) || (this->_championColorIdx == 0x19)) {
|
|
uVar4 = Random();
|
|
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(0x60,0,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(this),0,uVar4);
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::SetParent(GHIDRA_CAST<Entity *>(this));
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(4);
|
|
if (bVar2 != 0) {
|
|
this->_visible = 0;
|
|
this->_savedState = this->_state;
|
|
this->_state = 1;
|
|
}
|
|
playerManager = GHIDRA_CAST<PlayerManager *>((GHIDRA_CAST<Game *>((g_game)))->Game)::GetPlayerManager();
|
|
bVar2 = (GHIDRA_CAST<PlayerManager *>((playerManager)))->PlayerManager::AnyoneHasTrinket(0x35);
|
|
if ((((bVar2 != 0) && (this->_type != 0x112)) && (this->_type != 0x113)) &&
|
|
(60.0 < this->_health)) {
|
|
iVar15 = 0;
|
|
playerManager = GHIDRA_CAST<PlayerManager *>((GHIDRA_CAST<Game *>((g_game)))->Game)::GetPlayerManager();
|
|
iVar16 = (GHIDRA_CAST<PlayerManager *>((playerManager)))->PlayerManager::GetTrinketMultiplier(0x35);
|
|
if (0 < iVar16) {
|
|
do {
|
|
game = g_game;
|
|
iVar15 = iVar15 + 1;
|
|
this->_health = this->_health * 0.85;
|
|
playerManager = GHIDRA_CAST<PlayerManager *>((GHIDRA_CAST<Game *>((game)))->Game)::GetPlayerManager();
|
|
iVar16 = (GHIDRA_CAST<PlayerManager *>((playerManager)))->PlayerManager::GetTrinketMultiplier(0x35);
|
|
} while (iVar15 < iVar16);
|
|
}
|
|
}
|
|
layer = GHIDRA_CAST<uint8_t *>(0x0);
|
|
iVar16 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::GetLayerCount();
|
|
if (iVar16 != 0) {
|
|
do {
|
|
local_288 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite)::GetLayer(layer);
|
|
psVar6 = GHIDRA_CAST<std_string *>(_get_name_string(local_64));
|
|
local_14 = 1;
|
|
local_2a4 = GHIDRA_CAST<Entity_Effect *>((GHIDRA_UINT(local_28c) | 1));
|
|
local_28c = local_2a4;
|
|
bVar2 = str_eq_cstr(psVar6,&DAT_00b64428);
|
|
if (bVar2 == 0) {
|
|
psVar6 = GHIDRA_CAST<std_string *>(_get_name_string(local_4c + 0x10));
|
|
local_14 = 2;
|
|
local_2a4 = GHIDRA_CAST<Entity_Effect *>((GHIDRA_UINT(local_28c) | 2));
|
|
local_28c = local_2a4;
|
|
bVar2 = str_eq_cstr(psVar6,&DAT_00b1d57c);
|
|
local_281 = 0;
|
|
if (bVar2 != 0) goto LAB_006c5358;
|
|
}
|
|
else {
|
|
LAB_006c5358:
|
|
local_281 = 1;
|
|
}
|
|
if ((GHIDRA_UINT(local_28c) & 2) != 0) {
|
|
local_28c = GHIDRA_CAST<Entity_Effect *>((GHIDRA_UINT(local_28c) & 0xfffffffd));
|
|
(GHIDRA_CAST<msvc::string *>((local_4c + 0x10)))->msvc::string::_Tidy_deallocate();
|
|
}
|
|
local_14 = 0xffffffff;
|
|
if ((GHIDRA_UINT(local_28c) & 1) != 0) {
|
|
local_28c = GHIDRA_CAST<Entity_Effect *>((GHIDRA_UINT(local_28c) & 0xfffffffe));
|
|
(GHIDRA_CAST<msvc::string *>((local_64)))->msvc::string::_Tidy_deallocate();
|
|
}
|
|
if (local_281 != 0) {
|
|
UpdateDirtColor(this,1);
|
|
break;
|
|
}
|
|
layer = layer + 1;
|
|
layerCount = GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite)::GetLayerCount();
|
|
} while (layer < layerCount);
|
|
}
|
|
cVar3 = this->IsBoss();
|
|
if ((cVar3 != '\0') && (iVar16 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::Parent(), iVar16 == 0)) {
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::AddEncounteredBoss(this->_type,this->_variant);
|
|
}
|
|
}
|
|
else if (iVar16 == 1) {
|
|
uVar4 = 2;
|
|
if (this->_size < 13.0) {
|
|
uVar4 = 1;
|
|
}
|
|
if ((18.0 <= this->_size) || (30.0 < this->_shadowSize)) {
|
|
uVar4 = 3;
|
|
}
|
|
uVar13 = Random();
|
|
uVar33 = 0;
|
|
pTVar30 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor;
|
|
pTVar29 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor;
|
|
uVar28 = 0;
|
|
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(this),uVar4,uVar13);
|
|
pRVar10 = GHIDRA_CAST<Room *>(__RTDynamicCast(pEVar7,uVar28,pTVar29,pTVar30,uVar33));
|
|
local_288 = pRVar10;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(pRVar10))))->Entity::SetPositionOffset(&this->_posOffset);
|
|
set_field_358(pRVar10,(this->_posOffset).y + 1.0);
|
|
if ((this->_isChampion != 0) && (GHIDRA_UINT(this->_championColorIdx) < 0x1a)) {
|
|
pcVar1 = *(code **)(*GHIDRA_CAST<int *>(pRVar10) + 0x3c);
|
|
uVar28 = _Entity_NPC::GetColorWithFlash(local_a0);
|
|
(*pcVar1)(uVar28,0xffffffff,0xff,0,1);
|
|
}
|
|
iVar16 = 0x11e;
|
|
cVar3 = FUN_006b8490();
|
|
if (cVar3 != '\0') {
|
|
iVar16 = 0x368;
|
|
}
|
|
sfx = MusicManager::SFXManager();
|
|
SFXManager::Stop(sfx,iVar16);
|
|
PlaySound(this,iVar16,1.0,2,0,1.0);
|
|
iVar16 = this->_type;
|
|
if (iVar16 == 0x191) {
|
|
SoundEffects::PlayWithFartOverride(0x40,1.0,2,0,1.0);
|
|
PlaySound(this,0x1a3,1.0,2,0,1.0);
|
|
}
|
|
else if (iVar16 == 0x193) {
|
|
PlaySound(this,0x1a1,1.0,2,0,1.0);
|
|
}
|
|
else if ((iVar16 == 0x19b) && (this->_variant == 0)) {
|
|
PlaySound(this,0xe,2.0,2,0,1.0);
|
|
}
|
|
}
|
|
else if (iVar16 == 4) {
|
|
if (this->_type != 0x3e) {
|
|
this->_visible = 1;
|
|
}
|
|
pvVar8 = ANM2::GetAnimationData(&this->_sprite,GHIDRA_CAST<uint8_t *>("Appear"));
|
|
if (pvVar8 != (void *)0x0) {
|
|
if (this->_type != 0x10a) {
|
|
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::RemoveOverlay();
|
|
}
|
|
ANM2::Play(&this->_sprite,GHIDRA_CAST<uint8_t *>("Appear"),1);
|
|
}
|
|
}
|
|
else {
|
|
if (iVar16 < 0x14) {
|
|
LAB_006c56aa:
|
|
local_281 = 0;
|
|
}
|
|
else {
|
|
bVar2 = ANM2::IsFinishedImpl(&this->_sprite,GHIDRA_CAST<uint8_t *>("Appear"));
|
|
if ((bVar2 == 0) &&
|
|
(pvVar8 = ANM2::GetAnimationData(&this->_sprite,GHIDRA_CAST<uint8_t *>("Appear")), pvVar8 != (void *)0x0)
|
|
) {
|
|
(GHIDRA_CAST<msvc::string *>((local_64)))->msvc::string::string_from_cstr(GHIDRA_CAST<uint8_t *>("Appear"));
|
|
local_14 = 3;
|
|
local_2a4 = GHIDRA_CAST<Entity_Effect *>(&DAT_00000004);
|
|
pAVar18 = GHIDRA_CAST<ANM2 *>(Config)::GetPillEffects();
|
|
ANM2::GetAnimation(pAVar18,GHIDRA_CAST<std_string *>((local_4c + 0x10)));
|
|
local_28c = GHIDRA_CAST<Entity_Effect *>(0xc);
|
|
cVar3 = FUN_0040c7c0();
|
|
if (cVar3 == '\0') goto LAB_006c56aa;
|
|
}
|
|
local_281 = 1;
|
|
}
|
|
if ((GHIDRA_UINT(local_28c) & 8) != 0) {
|
|
local_28c = GHIDRA_CAST<Entity_Effect *>((GHIDRA_UINT(local_28c) & 0xfffffff7));
|
|
(GHIDRA_CAST<msvc::string *>((local_4c + 0x10)))->msvc::string::_Tidy_deallocate();
|
|
}
|
|
local_14 = 0xffffffff;
|
|
if ((GHIDRA_UINT(local_28c) & 4) != 0) {
|
|
local_28c = GHIDRA_CAST<Entity_Effect *>((GHIDRA_UINT(local_28c) & 0xfffffffb));
|
|
(GHIDRA_CAST<msvc::string *>((local_64)))->msvc::string::_Tidy_deallocate();
|
|
}
|
|
if (local_281 != 0) {
|
|
this->_state = this->_savedState;
|
|
this->_friction = this->_baseFriction;
|
|
}
|
|
}
|
|
iVar16 = this->_type;
|
|
if (iVar16 == 0x391) {
|
|
bVar2 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::IsEventTriggered("Shoot");
|
|
if (bVar2 == 0) {
|
|
iVar16 = this->_type;
|
|
goto LAB_006c5752;
|
|
}
|
|
PlaySound(this,0x1e3,1.0,2,0,1.0);
|
|
}
|
|
else {
|
|
LAB_006c5752:
|
|
if (((iVar16 == 0x390) && (this->_variant == 0x14)) &&
|
|
(bVar2 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::IsEventTriggered("Shoot"), bVar2 != 0)) {
|
|
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(local_a0))))->Color::Color();
|
|
Game::SpawnParticles(g_game,&this->_pos,4,5,6.0,color,100000.0,0x20000);
|
|
}
|
|
else {
|
|
iVar16 = this->_type;
|
|
if (iVar16 == 0x395) {
|
|
bVar2 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::IsEventTriggered(s_Land);
|
|
if (bVar2 != 0) {
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::ShakeScreen(8);
|
|
this->_entityCollisionClass = 4;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::MakeBloodPoofAtPos(&this->_splatColor,1.0);
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&local_2e0)))->Vector::Vector(100.0,60.0);
|
|
in_XMM3_Da = 1.0;
|
|
spawn_rock_particles(&this->_pos,tmpVec);
|
|
play_sound_with_fart_seed(0x30,1.0,2,0,1.0);
|
|
goto LAB_006c58bd;
|
|
}
|
|
iVar16 = this->_type;
|
|
}
|
|
if (iVar16 == 0x194) {
|
|
bVar2 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::IsEventTriggered("HoleOpen");
|
|
if (bVar2 != 0) {
|
|
SoundEffects::PlayWithFartOverride(0x3b3,1.0,2,0,1.0);
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::IsEventTriggered("HoleExit");
|
|
if (bVar2 != 0) {
|
|
SoundEffects::PlayWithFartOverride(0x3b4,1.0,2,0,1.0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
LAB_006c58bd:
|
|
if (this->_state == 1) {
|
|
this->_friction = this->_friction * 0.01;
|
|
}
|
|
this->_appearFrames = this->_appearFrames + 1;
|
|
}
|
|
else {
|
|
LAB_006c58e9:
|
|
if ((iVar16 != 0x12) && (iVar16 != 0x11)) goto LAB_006c68c7;
|
|
fVar20 = this->_friction * 0.01;
|
|
auVar23 = ZEXT416(GHIDRA_UINT(fVar20));
|
|
this->_friction = fVar20;
|
|
if (this->_stateFrame == 0) {
|
|
if (iVar16 == 0x11) {
|
|
iVar16 = this->_type;
|
|
if ((((iVar16 == 0xd9) || (iVar16 == 0xdc)) || (iVar16 == 0xdf)) ||
|
|
(((((iVar16 == 0x105 || (iVar16 == 0x192)) ||
|
|
((iVar16 == 0x366 || ((iVar16 == 0x367 || (iVar16 == 0x392)))))) || (iVar16 == 0x368))
|
|
|| ((iVar16 == 0xed && (this->_variant == 2)))))) {
|
|
pAVar18 = &this->_sprite;
|
|
local_2a0 = pAVar18;
|
|
pvVar8 = ANM2::GetAnimationData(pAVar18,GHIDRA_CAST<uint8_t *>("Flush"));
|
|
if (pvVar8 != (void *)0x0) {
|
|
ANM2::Play(pAVar18,GHIDRA_CAST<uint8_t *>("Flush"),0);
|
|
iVar16 = this->_state;
|
|
this->_renderZOffset = 5000;
|
|
goto LAB_006c59c4;
|
|
}
|
|
this->_state = 0x12;
|
|
goto LAB_006c59d3;
|
|
}
|
|
}
|
|
else {
|
|
LAB_006c59c4:
|
|
local_2a0 = &this->_sprite;
|
|
if (iVar16 == 0x12) {
|
|
LAB_006c59d3:
|
|
pAVar18 = &this->_sprite;
|
|
pvVar8 = ANM2::GetAnimationData(pAVar18,GHIDRA_CAST<uint8_t *>("Death"));
|
|
iVar16 = this->_type;
|
|
if (pvVar8 == (void *)0x0) {
|
|
if (iVar16 == 0x1c) {
|
|
iVar16 = this->_i1;
|
|
if (iVar16 == 0) {
|
|
deathAnim = "DeathHead";
|
|
LAB_006c5b7b:
|
|
ANM2::Play(pAVar18,GHIDRA_CAST<uint8_t *>(deathAnim),0);
|
|
}
|
|
else {
|
|
if (iVar16 == 1) {
|
|
deathAnim = "DeathBody01";
|
|
goto LAB_006c5b7b;
|
|
}
|
|
if (iVar16 == 2) {
|
|
deathAnim = "DeathBody02";
|
|
goto LAB_006c5b7b;
|
|
}
|
|
}
|
|
iVar16 = ANM2::GetFrame(pAVar18);
|
|
if (iVar16 == 3) {
|
|
PlaySound(this,0x74,1.0,2,0,1.0);
|
|
}
|
|
}
|
|
else if ((iVar16 == 0x13) || (iVar16 == 0x396)) {
|
|
deathAnim = "DeathBody01";
|
|
if (this->_parent == 0) {
|
|
deathAnim = "DeathHead";
|
|
}
|
|
ANM2::Play(pAVar18,GHIDRA_CAST<uint8_t *>(deathAnim),0);
|
|
}
|
|
else if (iVar16 == 0x3e) {
|
|
if (this->_parent == 0) {
|
|
ANM2::Play(pAVar18,GHIDRA_CAST<uint8_t *>("DeathHead"),0);
|
|
}
|
|
else if (this->_child == 0) {
|
|
this->Remove();
|
|
}
|
|
else {
|
|
ANM2::Play(pAVar18,GHIDRA_CAST<uint8_t *>("DeathBody01"),0);
|
|
}
|
|
}
|
|
else if (((iVar16 != 0x4a) && (iVar16 != 0x4b)) && (iVar16 != 0x4c)) {
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::BloodExplode();
|
|
trigger_kill_item_effects(this);
|
|
}
|
|
}
|
|
else if (iVar16 == 0x19b) {
|
|
if (this->_variant == 1) {
|
|
local_288 = GHIDRA_CAST<Room *>(ANM2)::GetLayer(pAVar18,&DAT_00b6767c);
|
|
if (local_288 == GHIDRA_CAST<Room *>(0x0)) {
|
|
local_2a0 = pAVar18;
|
|
}
|
|
else {
|
|
animState = GHIDRA_CAST<AnimationState *>(Config)::GetPillEffects();
|
|
iVar16 = _ptr_deref_or_minus1();
|
|
pvVar8 = AnimationState::GetLayerFrame(animState,iVar16);
|
|
if ((pvVar8 != (void *)0x0) && (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(pvVar8) + 0x2c)) != '\0')) {
|
|
ANM2::Play(local_2a0,GHIDRA_CAST<uint8_t *>("HandDeath"),0);
|
|
goto LAB_006c5c3e;
|
|
}
|
|
}
|
|
ANM2::Play(local_2a0,GHIDRA_CAST<uint8_t *>("SmallHoleClose"),0);
|
|
}
|
|
else if (this->_variant == 2) {
|
|
FUN_0044bf90(0);
|
|
}
|
|
else {
|
|
pAVar12 = GHIDRA_CAST<ANM2 *>(Config)::GetPillEffects();
|
|
psVar6 = ANM2::GetAnimation(pAVar12,GHIDRA_CAST<std_string *>((local_4c + 0x10)));
|
|
local_14 = 4;
|
|
local_281 = str_ne(psVar6,GHIDRA_CAST<uint8_t *>("BigHoleClose"));
|
|
local_14 = 0xffffffff;
|
|
(GHIDRA_CAST<msvc::string *>((local_4c + 0x10)))->msvc::string::_Tidy_deallocate();
|
|
if (local_281 != 0) {
|
|
ANM2::Play(pAVar18,GHIDRA_CAST<uint8_t *>("Death"),0);
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
if (iVar16 == 0x195) {
|
|
local_29c = GHIDRA_CAST<Room *>(ANM2)::GetLayer(pAVar18,s_Head);
|
|
if (local_29c != GHIDRA_CAST<Room *>(0x0)) {
|
|
animState = GHIDRA_CAST<AnimationState *>(Config)::GetPillEffects();
|
|
iVar16 = _ptr_deref_or_minus1();
|
|
pvVar8 = AnimationState::GetLayerFrame(animState,iVar16);
|
|
if ((pvVar8 == (void *)0x0) || (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(pvVar8) + 0x2c)) == '\0')) {
|
|
bVar2 = 0;
|
|
}
|
|
else {
|
|
bVar2 = 1;
|
|
}
|
|
*GHIDRA_CAST<uint8_t *>((local_29c->_gridEntities + 0x14)) = bVar2;
|
|
pAVar18 = local_2a0;
|
|
}
|
|
}
|
|
ANM2::Play(pAVar18,GHIDRA_CAST<uint8_t *>("Death"),0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
LAB_006c5c3e:
|
|
iVar16 = this->_type;
|
|
iVar15 = this->_stateFrame + 1;
|
|
this->_stateFrame = iVar15;
|
|
if (iVar16 == 0x66) {
|
|
if ((this->_variant != 2) && (iVar15 == 0x11)) {
|
|
PlaySound(this,0x10a,2.0,2,0,1.0);
|
|
iVar16 = this->_type;
|
|
goto LAB_006c5c89;
|
|
}
|
|
}
|
|
else {
|
|
LAB_006c5c89:
|
|
if (iVar16 == 0x38c) {
|
|
bVar2 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::IsEventTriggered("Shoot");
|
|
if (bVar2 != 0) {
|
|
SoundEffects::PlayWithFartOverride(0x48,1.0,2,0,1.0);
|
|
}
|
|
bVar2 = ANM2::IsFinishedImpl(&this->_sprite,&s_empty);
|
|
if ((bVar2 != 0) && (this->_dead != 0)) {
|
|
(GHIDRA_CAST<ProjectileParams *>((&projectileParams)))->ProjectileParams::ProjectileParams();
|
|
pPVar31 = &projectileParams;
|
|
projectileParams.FallingAccelModifier = projectileParams.FallingAccelModifier - 0.099;
|
|
auVar23 = ZEXT416(GHIDRA_UINT(projectileParams.FallingAccelModifier));
|
|
uVar4 = 9;
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&local_2e0)))->Vector::Vector(6.0,10.0);
|
|
FireProjectiles(this,&this->_pos,tmpVec,uVar4,pPVar31);
|
|
}
|
|
}
|
|
else if (iVar16 == 0x38b) {
|
|
NpcHelper::gideon_update_death(this);
|
|
}
|
|
else if (iVar16 == 900) {
|
|
FUN_0041e470();
|
|
cVar3 = FUN_004073a0();
|
|
if (cVar3 == '\0') {
|
|
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::RemoveOverlay();
|
|
}
|
|
}
|
|
else if (iVar16 == 0x393) {
|
|
bVar2 = ANM2::IsFinishedImpl(&this->_sprite,&s_empty);
|
|
if ((bVar2 != 0) && (this->_dead != 0)) {
|
|
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(local_a0))))->Color::Color();
|
|
damageSource = 0;
|
|
uVar33 = 0;
|
|
uVar28 = 4;
|
|
bVar2 = 1;
|
|
fVar20 = 1.5;
|
|
tmpColor = extraout_EAX;
|
|
source = this;
|
|
FUN_00435bc0(0,0);
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tearFlags._l)) + 0x4))) = in_stack_fffffc54;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tearFlags._l)) + 0x0))) = in_stack_fffffc50;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tearFlags._h)) + 0x0))) = in_stack_fffffc58;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(tearFlags._h)) + 0x4))) = in_stack_fffffc5c;
|
|
Game::BombExplosionEffects
|
|
(g_game,&this->_pos,80.0,tearFlags,tmpColor,GHIDRA_CAST<Entity *>(source),fVar20,bVar2,
|
|
CONCAT44(uVar33,uVar28),damageSource);
|
|
}
|
|
}
|
|
else if (iVar16 == 0x391) {
|
|
bVar2 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::IsEventTriggered("Shoot");
|
|
if ((bVar2 != 0) &&
|
|
(local_2a4 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::GetNullFrame(GHIDRA_CAST<uint8_t *>("BloodGuide")),
|
|
local_2a4 != GHIDRA_CAST<Entity_Effect *>(0x0))) {
|
|
uVar4 = Random();
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,2,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),2,uVar4);
|
|
piVar14 = GHIDRA_CAST<int *>(FUN_004a2920());
|
|
FUN_004563c0(local_2a4);
|
|
(**(code **)(*piVar14 + 0x3c))(&this->_splatColor,0xffffffff,0xff,0,1);
|
|
SoundEffects::PlayWithFartOverride(0x1e,1.0,2,0,1.0);
|
|
animState = GHIDRA_CAST<AnimationState *>(Config)::GetPillEffects();
|
|
iVar16 = AnimationState::GetAnimationLength(animState);
|
|
iVar15 = ANM2::GetFrame(&this->_sprite);
|
|
if (iVar16 + -1 <= iVar15) {
|
|
SoundEffects::PlayWithFartOverride(0x105,1.0,2,0,1.0);
|
|
uVar4 = Random();
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar4);
|
|
FUN_004563c0(local_2a4);
|
|
in_XMM3_Da = 0.0;
|
|
uVar32 = 0;
|
|
uVar33 = 3;
|
|
uVar28 = 3;
|
|
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>(local_60))))->KColor::KColor(1.0,0.6,0.0,1.0);
|
|
pEVar7 = GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(&this->_pos))))->Entity)::AddFear(uVar28,uVar33,uVar32);
|
|
tmpVec = GHIDRA_CAST<Vector *>(FUN_0067f2e0());
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::SetPositionOffset(tmpVec);
|
|
sprite = GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Entity *>((pEVar7)))->Entity)::GetSprite();
|
|
(GHIDRA_CAST<Sprite *>((sprite)))->Sprite::SetFrame_1(1);
|
|
(GHIDRA_CAST<BlendMode *>((&local_38)))->BlendMode::SetMode(2,0);
|
|
sprite = GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Entity *>((pEVar7)))->Entity)::GetSprite();
|
|
src = &local_38;
|
|
firstLayer = (GHIDRA_CAST<Sprite *>((sprite)))->Sprite::GetLayer(GHIDRA_CAST<uint8_t *>(0x0));
|
|
copy_20_bytes(firstLayer->_blendMode,src);
|
|
}
|
|
}
|
|
}
|
|
else if (iVar16 == 0x390) {
|
|
if ((this->_variant == 10) &&
|
|
(bVar2 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::IsEventTriggered("Shoot"), bVar2 != 0)) {
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::ShakeScreen(0x14);
|
|
play_sound_with_fart_seed(0x1d,1.0,2,0,0.5);
|
|
}
|
|
}
|
|
else if ((iVar16 == 0x399) &&
|
|
(bVar2 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::IsEventTriggered("Explosion"), bVar2 != 0))
|
|
{
|
|
uVar4 = Random();
|
|
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x90,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),3,uVar4);
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&local_2e0)))->Vector::Vector(0.0,-20.0);
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::SetPositionOffset(tmpVec);
|
|
sprite = GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Entity *>((pEVar7)))->Entity)::GetSprite();
|
|
fVar20 = random_float();
|
|
(GHIDRA_CAST<Sprite *>((sprite)))->Sprite::SetRotation(fVar20 * 360.0);
|
|
sprite = GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Entity *>((pEVar7)))->Entity)::GetSprite();
|
|
local_288 = GHIDRA_CAST<Room *>(0x3fc00000);
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&g_vectorOne)))->Vector::__mul(&local_2e0,GHIDRA_CAST<float *>(&local_288));
|
|
(GHIDRA_CAST<Sprite *>((sprite)))->Sprite::SetScale(tmpVec);
|
|
pEVar7->SetCollisionDamage(0x42a00000);
|
|
pEVar7->Update();
|
|
fVar20 = random_float();
|
|
this = npc;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(auVar23)) + 0x0))) = fVar20 * 0.2 + 0.9;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(auVar23)) + 0x4))) = extraout_var_00;
|
|
play_sound_with_fart_seed(0x1dd,1.25,2,0,(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(auVar23)) + 0x0))));
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::ShakeScreen(0xe);
|
|
}
|
|
}
|
|
sprite = GHIDRA_CAST<Sprite *>(&this->_sprite);
|
|
local_29c = (GHIDRA_CAST<Sprite *>((sprite)))->Sprite::GetNullFrame(GHIDRA_CAST<uint8_t *>("BloodGuide"));
|
|
if (local_29c != GHIDRA_CAST<Room *>(0x0)) {
|
|
update_blood_guide_gibs(this,GHIDRA_CAST<float *>(local_29c));
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x10000);
|
|
if (((bVar2 == 0) &&
|
|
((iVar16 = PlayerManager::GetGFuelCount(), 2 < iVar16 ||
|
|
((bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsType(0x38c,-1,-1), bVar2 != 0 &&
|
|
((this->_initSeed & 0xfffffU) == 0xdedbb)))))) &&
|
|
(((this->_initSeed & 1) == 0 ||
|
|
(bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsType(0x38c,-1,-1), bVar2 != 0)))) {
|
|
animState = GHIDRA_CAST<AnimationState *>(Config)::GetPillEffects();
|
|
iVar16 = AnimationState::NextEventTrigger(animState,GHIDRA_CAST<uint8_t *>("Explosion"));
|
|
_empty_check_0x34();
|
|
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(auVar23)) + 0x0))) + 10.0 <= (float)iVar16) {
|
|
fVar19 = (long double)(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::PlaybackSpeed();
|
|
local_288 = GHIDRA_CAST<Room *>(((float)fVar19 * this->_speedMultiplier));
|
|
auVar23 = ZEXT416(local_288);
|
|
_empty_check_0x34();
|
|
if ((float)iVar16 < (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(auVar23)) + 0x0))) + (float)local_288 + 10.0) {
|
|
uVar4 = Random();
|
|
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0xb,uVar4);
|
|
pAVar18 = GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<Entity *>((pEVar7)))->Entity)::GetSprite();
|
|
msvc::string::string_from_cstr
|
|
(local_4c + 0x10,GHIDRA_CAST<uint8_t *>("gfx/promo/gfuel/effects/explosion_delayed.anm2"));
|
|
local_14 = 5;
|
|
ANM2::Load(pAVar18,GHIDRA_CAST<std_string *>((local_4c + 0x10)),1);
|
|
local_14 = 0xffffffff;
|
|
(GHIDRA_CAST<msvc::string *>((local_4c + 0x10)))->msvc::string::_Tidy_deallocate();
|
|
sprite = GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Entity *>((pEVar7)))->Entity)::GetSprite();
|
|
pSVar5 = GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Entity *>((pEVar7)))->Entity)::GetSprite();
|
|
psVar6 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<Sprite *>((pSVar5)))->Sprite)::GetDefaultAnimationName();
|
|
(GHIDRA_CAST<Sprite *>((sprite)))->Sprite::Play(psVar6,0);
|
|
sprite = GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Entity *>((pEVar7)))->Entity)::GetSprite();
|
|
iVar16 = Isaac::Random(2);
|
|
(GHIDRA_CAST<Sprite *>((sprite)))->Sprite::set_flip_x(iVar16 == 0);
|
|
sprite = GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Entity *>((pEVar7)))->Entity)::GetSprite();
|
|
local_288 = GHIDRA_CAST<Room *>(0x3fc00000);
|
|
tmpVec = Vector::operator_mul(&local_2e0,GHIDRA_CAST<float *>(&local_288),&g_vectorOne);
|
|
(GHIDRA_CAST<Sprite *>((sprite)))->Sprite::SetScale(tmpVec);
|
|
pEVar7->Update();
|
|
this = npc;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(npc))))->Entity::AddEntityFlags(0x10000);
|
|
}
|
|
}
|
|
sprite = GHIDRA_CAST<Sprite *>(&this->_sprite);
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Sprite *>((sprite)))->Sprite::IsEventTriggered("Explosion");
|
|
if (bVar2 != 0) {
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x10000);
|
|
if (bVar2 == 0) {
|
|
fVar20 = this->_size;
|
|
uVar4 = 2;
|
|
if (fVar20 < 13.0) {
|
|
uVar4 = 1;
|
|
}
|
|
if ((18.0 <= fVar20) || (30.0 < this->_shadowSize)) {
|
|
uVar4 = 3;
|
|
}
|
|
if ((40.0 <= fVar20) || (50.0 < this->_shadowSize)) {
|
|
uVar4 = 4;
|
|
}
|
|
iVar16 = PlayerManager::GetGFuelCount();
|
|
if (iVar16 < 1) {
|
|
uVar13 = Random();
|
|
uVar33 = 0;
|
|
pTVar30 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor;
|
|
pTVar29 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor;
|
|
uVar28 = 0;
|
|
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,2,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),uVar4,uVar13)
|
|
;
|
|
piVar14 = GHIDRA_CAST<int *>(__RTDynamicCast(pEVar7,uVar28,pTVar29,pTVar30,uVar33));
|
|
FUN_004563c0(local_29c);
|
|
(**(code **)(*piVar14 + 0x3c))(&this->_splatColor,0xffffffff,0xff,0,1);
|
|
cVar3 = this->IsBoss();
|
|
if (((cVar3 != '\0') && (cVar3 = FUN_00435880(4), cVar3 != '\0')) &&
|
|
((this->_type != 0x3e || (this->_parent == 0)))) {
|
|
uVar4 = Random();
|
|
uVar33 = 0;
|
|
pTVar30 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor;
|
|
pTVar29 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor;
|
|
uVar28 = 0;
|
|
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x4d,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(this),0,uVar4);
|
|
piVar14 = GHIDRA_CAST<int *>(__RTDynamicCast(pEVar7,uVar28,pTVar29,pTVar30,uVar33));
|
|
(**(code **)(*piVar14 + 0x3c))(&this->_splatColor,0xffffffff,0xff,0,1);
|
|
}
|
|
}
|
|
else {
|
|
spawn_gfuel_explosion();
|
|
cVar3 = this->IsBoss();
|
|
if (((cVar3 != '\0') && (cVar3 = FUN_00435880(4), cVar3 != '\0')) &&
|
|
((this->_type != 0x3e || (this->_parent == 0)))) {
|
|
spawn_gfuel_explosion();
|
|
}
|
|
}
|
|
}
|
|
if (this->_type == 0x4e) {
|
|
(GHIDRA_CAST<ProjectileParams *>((&projectileParams)))->ProjectileParams::ProjectileParams();
|
|
pPVar31 = &projectileParams;
|
|
uVar4 = 9;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(projectileParams)) + 0x4))) = 0x40a00000;
|
|
projectileParams.Scale = 1.5;
|
|
projectileParams.FallingAccelModifier = -0.06;
|
|
projectileParams.FallingSpeedModifier = -2.0;
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&local_2e0)))->Vector::Vector(5.0,14.0);
|
|
FireProjectiles(this,&this->_pos,tmpVec,uVar4,pPVar31);
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsType(0x10d,1,-1);
|
|
if (bVar2 != 0) {
|
|
iVar16 = Isaac::Random(0xc);
|
|
local_2c4 = GHIDRA_CAST<Room *>((iVar16 + 0xc));
|
|
if (0 < GHIDRA_INT(local_2c4)) {
|
|
do {
|
|
tmpVec = MusicManager::RandomVector(&local_2e0);
|
|
fVar20 = random_float();
|
|
local_288 = GHIDRA_CAST<Room *>((fVar20 * 5.0));
|
|
(GHIDRA_CAST<Vector *>((tmpVec)))->Vector::__mul(&local_298,GHIDRA_CAST<float *>(&local_288));
|
|
local_2c0 = GHIDRA_CAST<Entity *>(Random());
|
|
tmpVec = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::Position(&local_2e8);
|
|
tmpVec2 = MusicManager::RandomVector(&local_2d0);
|
|
fVar20 = random_float();
|
|
local_2ac = GHIDRA_CAST<Room *>((fVar20 * 20.0));
|
|
tmpVec2 = (GHIDRA_CAST<Vector *>((tmpVec2)))->Vector::__mul(&local_300,GHIDRA_CAST<float *>(&local_2ac));
|
|
tmpVec = (GHIDRA_CAST<Vector *>((tmpVec)))->Vector::__add(&local_2b8,tmpVec2);
|
|
this = npc;
|
|
uVar33 = 0;
|
|
pTVar30 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor;
|
|
pTVar29 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor;
|
|
uVar28 = 0;
|
|
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x3b,tmpVec,&local_298,GHIDRA_CAST<Entity *>(npc),0,
|
|
GHIDRA_UINT(local_2c0));
|
|
local_2a4 = GHIDRA_CAST<Entity_Effect *>(__RTDynamicCast(pEVar7,uVar28,pTVar29,pTVar30,uVar33));
|
|
local_2b0 = GHIDRA_CAST<Entity *>(0x3f800000);
|
|
tmpVec = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(local_2a4))))->Entity::Position(&local_2f0);
|
|
tmpVec2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::Position(&local_308);
|
|
tmpVec = (GHIDRA_CAST<Vector *>((tmpVec)))->Vector::__sub(&local_320,tmpVec2);
|
|
tmpVec2 = (GHIDRA_CAST<Vector *>((&local_33c)))->Vector::Vector(local_298.y,-local_298.x);
|
|
local_2c0 = GHIDRA_CAST<Entity *>((GHIDRA_CAST<Vector *>((tmpVec)))->Vector)::Dot(tmpVec2);
|
|
pEVar9 = local_2a4;
|
|
if ((float)local_2c0 < 0.0) {
|
|
local_2b0 = GHIDRA_CAST<Entity *>(&DAT_bf800000);
|
|
}
|
|
FUN_004563c0(local_29c);
|
|
fVar20 = random_float();
|
|
(GHIDRA_CAST<Entity_Effect *>((pEVar9)))->Entity_Effect::set_rotation((fVar20 * 10.0 + 2.0) * (float)local_2b0);
|
|
iVar16 = Isaac::Random(0xf);
|
|
(GHIDRA_CAST<Entity_Effect *>((pEVar9)))->Entity_Effect::SetTimeout(iVar16 + 0xf);
|
|
uVar32 = 0;
|
|
uVar33 = 0;
|
|
uVar28 = 0;
|
|
pcVar1 = *(code **)(*GHIDRA_CAST<int *>(pEVar9) + 0x3c);
|
|
fVar20 = random_float();
|
|
in_XMM3_Da = 1.0;
|
|
uVar28 = (GHIDRA_CAST<Color *>((fVar20 * 0.5 + 0.2)))->Color::Color(uVar28,uVar33,uVar32);
|
|
(*pcVar1)(uVar28,0xffffffff,0xff,0,1);
|
|
local_2a4->Update();
|
|
local_2c4 = GHIDRA_CAST<Room *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_2c4[-1])) + 0x7897))));
|
|
} while (local_2c4 != GHIDRA_CAST<Room *>(0x0));
|
|
}
|
|
}
|
|
this->_shadowSize = 0.0;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::BloodExplode();
|
|
sprite = GHIDRA_CAST<Sprite *>(&this->_sprite);
|
|
}
|
|
}
|
|
if (((this->_type == 0x197) &&
|
|
(bVar2 = (GHIDRA_CAST<Sprite *>((sprite)))->Sprite::IsEventTriggered(&DAT_00b6774c), bVar2 != 0)) &&
|
|
(bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x1000000000000000), bVar2 == 0)) {
|
|
uVar4 = Random();
|
|
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,100,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(this),0,uVar4);
|
|
if (pEVar7 != GHIDRA_CAST<Entity *>(0x0)) {
|
|
pEVar7->Update();
|
|
}
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::ShakeScreen(0x1e);
|
|
SoundEffects::PlayWithFartOverride(0x10a,1.0,2,0,1.0);
|
|
}
|
|
bVar2 = ANM2::IsFinishedImpl(GHIDRA_CAST<ANM2 *>(sprite),&s_empty);
|
|
if ((bVar2 != 0) && (this->_exists != 0)) {
|
|
trigger_kill_item_effects(this);
|
|
}
|
|
}
|
|
LAB_006c68c7:
|
|
if (((this->_state == 0x12) || (this->_state == 0x11)) ||
|
|
(((cVar3 = FUN_006c4a90(), cVar3 != '\0' || (this->_state == 1)) && (this->_dead == 0)))) {
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x20);
|
|
if (((bVar2 != 0) || (0 < this->_holdCountdown)) &&
|
|
(this->_friction = this->_friction * 0.01, 0 < this->_holdCountdown)) {
|
|
bVar2 = (GHIDRA_CAST<Vector *>((&this->_holdPosition)))->Vector::operator_ne(&g_vectorZero);
|
|
if (bVar2 != 0) {
|
|
(GHIDRA_CAST<Vector *>((&this->_pos)))->Vector::operator_assign(&this->_holdPosition);
|
|
}
|
|
}
|
|
LAB_006c87a7:
|
|
if (this->_dead == 0) goto LAB_006c87b4;
|
|
}
|
|
else {
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x100);
|
|
if (bVar2 == 0) {
|
|
if (this->_decoyTargetTimer < 0xb5) {
|
|
if (this->_decoyTargetTimer < -0xb4) {
|
|
this->_decoyTargetTimer = 0;
|
|
}
|
|
}
|
|
else {
|
|
this->_decoyTargetTimer = -1;
|
|
}
|
|
pEVar7 = GetPlayerTarget(this);
|
|
iVar16 = (GHIDRA_CAST<Entity *>((pEVar7)))->Entity::Type();
|
|
if ((iVar16 == 3) && (iVar16 = (GHIDRA_CAST<Entity *>((pEVar7)))->Entity::Variant(), iVar16 == 0x43)) {
|
|
this->_decoyTargetTimer = this->_decoyTargetTimer + 1;
|
|
}
|
|
else if (this->_decoyTargetTimer != 0) {
|
|
this->_decoyTargetTimer = this->_decoyTargetTimer + -1;
|
|
}
|
|
}
|
|
if ((this->_dead != 0) && (this->_state == 1)) {
|
|
this->_friction = this->_baseFriction;
|
|
this->_state = this->_savedState;
|
|
this->_visible = 1;
|
|
}
|
|
if (this->_championRegenTimer == 0) {
|
|
Entity_NPC_UpdateAI_dispatch(this);
|
|
}
|
|
local_2d8 = GHIDRA_CAST<Entity *>(&this->_sprite);
|
|
pvVar8 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(local_2d8))))->Sprite::GetNullFrame(GHIDRA_CAST<uint8_t *>("OverlayEffect"));
|
|
if ((pvVar8 == (void *)0x0) || (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(pvVar8) + 0xc)) != '\0')) {
|
|
local_281 = 1;
|
|
}
|
|
else {
|
|
local_281 = 0;
|
|
}
|
|
if ((((this->_championColorIdx == 2) || (this->_championColorIdx == 0x19)) && (local_281 != 0))
|
|
&& ((bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFrame(7,0), bVar2 != 0 &&
|
|
(bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x1000000), bVar2 == 0)))) {
|
|
uVar4 = Random();
|
|
uVar33 = 0;
|
|
pTVar30 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor;
|
|
pTVar29 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor;
|
|
uVar28 = 0;
|
|
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x17,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(this),0,uVar4);
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>(__RTDynamicCast(pEVar7,uVar28,pTVar29,pTVar30,uVar33));
|
|
(GHIDRA_CAST<Entity_Effect *>((pEVar9)))->Entity_Effect::SetTimeout(0x1e);
|
|
pEVar9->Update();
|
|
}
|
|
if (this->_championColorIdx == 0x18) {
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
bVar2 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::is_type_16();
|
|
if ((bVar2 == 0) && (local_281 != 0)) {
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFrame(3,0);
|
|
if (bVar2 != 0) {
|
|
if ((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(ThreadLocalStoragePointer) + 0xc)) < DAT_00c80e10) &&
|
|
(_Init_thread_header(&DAT_00c80e10), DAT_00c80e10 == -1)) {
|
|
local_14 = 6;
|
|
in_XMM3_Da = 0.0;
|
|
(GHIDRA_CAST<Color *>((0x3f800000)))->Color::Color(0,0,0,0,0x3e828f5c,0x3e24dd2f,0x3e0c49ba);
|
|
local_14 = 0xffffffff;
|
|
_Init_thread_footer(&DAT_00c80e10);
|
|
}
|
|
fVar20 = random_float();
|
|
pEVar9 = MakeSplat(this,fVar20 * 0.5 + 0.2);
|
|
pEVar9->SetColor(&DAT_00c80e14,0xffffffff,0xff,0,1);
|
|
}
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
local_2ac = pRVar10;
|
|
local_2c0 = GHIDRA_CAST<Entity *>((GHIDRA_CAST<Room *>((pRVar10)))->Room)::GetGridIndex(&this->_pos);
|
|
if (local_2c0 != GHIDRA_CAST<Entity *>(this->_lastGridIndex)) {
|
|
iVar16 = Isaac::Random(4);
|
|
if ((iVar16 == 0) && (-1 < this->_lastGridIndex)) {
|
|
local_288 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Room *>((pRVar10)))->Room)::GetGridEntity(this->_lastGridIndex);
|
|
uVar4 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetGridCollision(this->_lastGridIndex);
|
|
if (uVar4 == 0) {
|
|
if (local_288 != GHIDRA_CAST<Room *>(0x0)) {
|
|
iVar16 = (GHIDRA_CAST<GridEntity *>((GHIDRA_CAST<GridEntity *>(local_288))))->GridEntity::GetType();
|
|
bVar2 = is_grid_type_floor_special(iVar16);
|
|
if (bVar2 != 0) goto LAB_006c6bee;
|
|
}
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
uVar4 = Random();
|
|
(GHIDRA_CAST<Room *>((pRVar10)))->Room::SpawnGridEntity(this->_lastGridIndex,0xe,0,uVar4,0);
|
|
poop = GHIDRA_CAST<GridEntity_Poop *>((GHIDRA_CAST<Room *>((local_2ac)))->Room)::GetGridEntity(this->_lastGridIndex);
|
|
if ((poop != GHIDRA_CAST<GridEntity_Poop *>(0x0)) &&
|
|
(iVar16 = (GHIDRA_CAST<GridEntity *>((GHIDRA_CAST<GridEntity *>(poop))))->GridEntity::GetType(), iVar16 == 0xe)) {
|
|
(GHIDRA_CAST<GridEntity_Poop *>((poop)))->GridEntity_Poop::ReduceSpawnRate();
|
|
FUN_006b8580(1);
|
|
FUN_006b8310(0);
|
|
}
|
|
}
|
|
}
|
|
LAB_006c6bee:
|
|
this->_lastGridIndex = GHIDRA_INT(local_2c0);
|
|
}
|
|
}
|
|
}
|
|
if (this->_championColorIdx == 6) {
|
|
this->_isInvicible = 0;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::ClearEntityFlags(1);
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
local_2b0 = GHIDRA_CAST<Entity *>((GHIDRA_CAST<Room *>((pRVar10)))->Room)::GetEntities();
|
|
puVar17 = GHIDRA_CAST<uint8_t *>(0x0);
|
|
local_29c = GHIDRA_CAST<Room *>(0x0);
|
|
iVar16 = (GHIDRA_CAST<EntityList *>((GHIDRA_CAST<EntityList *>(local_2b0))))->EntityList::Size();
|
|
if (iVar16 != 0) {
|
|
do {
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(puVar17);
|
|
pEVar7 = GHIDRA_CAST<Entity *>(*entitySlot);
|
|
bVar2 = (GHIDRA_CAST<Entity *>((pEVar7)))->Entity::IsEnemy();
|
|
if (((bVar2 != 0) && (cVar3 = pEVar7->CanShutDoors(), cVar3 != '\0')) &&
|
|
((iVar16 = __RTDynamicCast(pEVar7,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor,
|
|
&IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0),
|
|
*GHIDRA_CAST<char *>((iVar16 + 0xc63)) == '\0' || (*GHIDRA_CAST<int *>((iVar16 + 0xc64)) != 6)))) {
|
|
this->_isInvicible = 1;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::AddEntityFlags(1);
|
|
}
|
|
puVar17 = &(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((local_29c)) + 0x1)));
|
|
local_29c = GHIDRA_CAST<Room *>(puVar17);
|
|
puVar11 = GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<EntityList *>((GHIDRA_CAST<EntityList *>(local_2b0))))->EntityList)::Size();
|
|
} while (puVar17 < puVar11);
|
|
}
|
|
}
|
|
if ((this->_championColorIdx == 9) || (this->_type == 0xfc)) {
|
|
switch(this->_flickerState) {
|
|
case 0:
|
|
iVar16 = this->_flickerTimer;
|
|
this->_flickerTimer = iVar16 + -1;
|
|
if (iVar16 < 0) {
|
|
this->_flickerState = 1;
|
|
}
|
|
break;
|
|
case 1:
|
|
if (this->_flickerAlpha <= 0.0) {
|
|
this->_flickerState = 3;
|
|
LAB_006c6d40:
|
|
iVar16 = Isaac::Random(0x1e);
|
|
this->_flickerTimer = iVar16 + 0x3c;
|
|
}
|
|
else {
|
|
this->_flickerAlpha = this->_flickerAlpha - 0.05;
|
|
}
|
|
break;
|
|
case 2:
|
|
if (1.0 <= this->_flickerAlpha) {
|
|
this->_flickerState = 0;
|
|
goto LAB_006c6d40;
|
|
}
|
|
this->_flickerAlpha = this->_flickerAlpha + 0.05;
|
|
break;
|
|
case 3:
|
|
iVar16 = this->_flickerTimer;
|
|
this->_visible = 0;
|
|
this->_flickerTimer = iVar16 + -1;
|
|
if (iVar16 < 0) {
|
|
this->_visible = 1;
|
|
this->_flickerState = 2;
|
|
}
|
|
}
|
|
tmpColor = GHIDRA_CAST<ColorMod *>((GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite)::Color();
|
|
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(local_a0))))->Color::operator_assign(tmpColor);
|
|
Font::SetLineHeightModifier(GHIDRA_CAST<Font *>(local_a0),this->_flickerAlpha);
|
|
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST<ColorMod *>(local_a0));
|
|
}
|
|
iVar16 = this->_championColorIdx;
|
|
if (iVar16 == 8) {
|
|
this->_entityGridCollisionClass = 3;
|
|
}
|
|
else if ((((iVar16 == 10) || (iVar16 == 0x19)) &&
|
|
(this->_championTimer = this->_championTimer + -1, this->_championTimer < 1)) &&
|
|
((local_281 != 0 &&
|
|
(bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x1000000), bVar2 == 0)))) {
|
|
local_29c = GHIDRA_CAST<Room *>((GHIDRA_CAST<Vector *>((&this->_velocity)))->Vector)::Length();
|
|
local_300.x = g_vectorZero.x;
|
|
local_300.y = g_vectorZero.y;
|
|
if (0.0 < (float)local_29c) {
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&this->_velocity)))->Vector::__div(&local_2e0,GHIDRA_CAST<float *>(&local_29c));
|
|
(GHIDRA_CAST<Vector *>((&local_300)))->Vector::operator_assign(tmpVec);
|
|
iVar16 = Isaac::Random(0x14);
|
|
this->_championTimer = iVar16 + 0x28;
|
|
(GHIDRA_CAST<ProjectileParams *>((&projectileParams)))->ProjectileParams::ProjectileParams();
|
|
pPVar31 = &projectileParams;
|
|
projectileParams.FallingAccelModifier = 0.3;
|
|
uVar4 = 0;
|
|
projectileParams.FallingSpeedModifier = -5.0;
|
|
local_288 = GHIDRA_CAST<Room *>(0x40a00000);
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&local_300)))->Vector::__mul(&local_2e0,GHIDRA_CAST<float *>(&local_288));
|
|
FireProjectiles(this,&this->_pos,tmpVec,uVar4,pPVar31);
|
|
PlaySound(this,0xb2,1.0,2,0,1.0);
|
|
}
|
|
}
|
|
if (((this->_championColorIdx == 0xb) || (this->_championColorIdx == 0x19)) && (local_281 != 0))
|
|
{
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
local_2c4 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Room *>((pRVar10)))->Room)::GetEntities();
|
|
puVar17 = GHIDRA_CAST<uint8_t *>(0x0);
|
|
local_2b0 = GHIDRA_CAST<Entity *>(0x0);
|
|
iVar16 = (GHIDRA_CAST<EntityList *>((GHIDRA_CAST<EntityList *>(local_2c4))))->EntityList::Size();
|
|
if (iVar16 != 0) {
|
|
do {
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(puVar17);
|
|
pEVar7 = GHIDRA_CAST<Entity *>(*entitySlot);
|
|
iVar16 = (GHIDRA_CAST<Entity *>((pEVar7)))->Entity::Type();
|
|
if ((iVar16 == 1) || (iVar16 = (GHIDRA_CAST<Entity *>((pEVar7)))->Entity::Type(), iVar16 == 2)) {
|
|
tmpVec = (GHIDRA_CAST<Entity *>((pEVar7)))->Entity::Position(&local_2e0);
|
|
(GHIDRA_CAST<Vector *>((&this->_pos)))->Vector::__sub(&local_298,tmpVec);
|
|
(GHIDRA_CAST<Vector *>((&local_298)))->Vector::Normalize();
|
|
local_2a4 = GHIDRA_CAST<Entity_Effect *>(0x3f666666);
|
|
iVar16 = (GHIDRA_CAST<Entity *>((pEVar7)))->Entity::Type();
|
|
if (iVar16 == 1) {
|
|
local_2a4 = GHIDRA_CAST<Entity_Effect *>(0x3f4ccccd);
|
|
}
|
|
tmpVec = (GHIDRA_CAST<Entity *>((pEVar7)))->Entity::Position(&local_2e8);
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&this->_pos)))->Vector::__sub(&local_2d0,tmpVec);
|
|
fVar20 = (GHIDRA_CAST<Vector *>((tmpVec)))->Vector::Length();
|
|
local_2ac = GHIDRA_CAST<Room *>(0x0);
|
|
local_288 = GHIDRA_CAST<Room *>((((300.0 - fVar20) * (float)local_2a4) / 300.0));
|
|
msvc::max<float>();
|
|
clampedValue = GHIDRA_CAST<float *>(std)::min<float>();
|
|
(GHIDRA_CAST<Vector *>((&local_298)))->Vector::operator_mul_assign(clampedValue);
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::AddVelocity_divided(&local_298,0);
|
|
}
|
|
puVar17 = &(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((local_2b0)) + 0x1)));
|
|
local_2b0 = GHIDRA_CAST<Entity *>(puVar17);
|
|
puVar11 = GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<EntityList *>((GHIDRA_CAST<EntityList *>(local_2c4))))->EntityList)::Size();
|
|
} while (puVar17 < puVar11);
|
|
}
|
|
}
|
|
iVar16 = this->_championColorIdx;
|
|
if (iVar16 == 0xc) {
|
|
if (this->_dead == 0) {
|
|
if (this->_championRegenTimer != 0) goto LAB_006c7154;
|
|
}
|
|
else if (this->_championRegenTimer == 0) {
|
|
this->_championRegenCount = this->_championRegenCount + 1;
|
|
this->_championRegenTimer = 1;
|
|
this->_dead = 0;
|
|
this->_health = 10.0;
|
|
this->_isInvicible = 0;
|
|
this->_entityCollisionClass = 4;
|
|
if (this->_entityGridCollisionClass == 0) {
|
|
this->_entityGridCollisionClass = 3;
|
|
}
|
|
this->_aiCallFlags = this->_aiCallFlags << 0x10;
|
|
}
|
|
else {
|
|
LAB_006c7154:
|
|
this->_friction = this->_friction * 0.8;
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity)::GetHitPointsLost();
|
|
local_288 = pRVar10;
|
|
if (0 < GHIDRA_INT(pRVar10)) {
|
|
do {
|
|
this->_championRegenTimer = this->_championRegenTimer + 1;
|
|
regenTimer = this->_championRegenTimer;
|
|
if ((regenTimer < 6) || ((0x50 < regenTimer && (regenTimer < 0x56)))) {
|
|
fVar19 = (long double)Scale(this);
|
|
SetScale(this,(float)(fVar19 * (long double)0.5));
|
|
if ((4 < this->_championRegenTimer) &&
|
|
(GHIDRA_INT(this->_championRegenTimer) - GHIDRA_INT(local_288) < 5)) {
|
|
(GHIDRA_CAST<msvc::string *>((local_4c + 0x10)))->msvc::string::string_from_cstr(GHIDRA_CAST<uint8_t *>("gfx/024.000_Globin.anm2"));
|
|
local_14 = 7;
|
|
ANM2::Load(&this->_sprite,GHIDRA_CAST<std_string *>((local_4c + 0x10)),1);
|
|
local_14 = 0xffffffff;
|
|
(GHIDRA_CAST<msvc::string *>((local_4c + 0x10)))->msvc::string::_Tidy_deallocate();
|
|
ANM2::Play(&this->_sprite,GHIDRA_CAST<uint8_t *>("ReGenChamp"),1);
|
|
LAB_006c7308:
|
|
this->ResetColor();
|
|
}
|
|
}
|
|
else if ((regenTimer < 10) || (0x55 < regenTimer)) {
|
|
fVar19 = (long double)Scale(this);
|
|
SetScale(this,(float)(fVar19 * (long double)2.0));
|
|
if (0x59 < this->_championRegenTimer) {
|
|
load_graphics(this,1);
|
|
this->_state = 1;
|
|
this->_championRegenTimer = 0;
|
|
this->_friction = this->_baseFriction;
|
|
this->_aiCallFlags = GHIDRA_UINT(*GHIDRA_CAST<uint16_t *>((GHIDRA_INT(&this->_aiCallFlags) + 2)));
|
|
iVar16 = this->_type;
|
|
if ((((iVar16 == 0x22) || (iVar16 == 0x56)) || (iVar16 == 0x36)) ||
|
|
((iVar16 == 0xf6 || (iVar16 == 0x1d)))) {
|
|
(GHIDRA_CAST<Vector *>((&this->_targetPosition)))->Vector::operator_assign(&g_vectorZero);
|
|
}
|
|
else if (iVar16 == 0x379) {
|
|
(GHIDRA_CAST<Vector *>((&this->_targetPosition)))->Vector::operator_assign(&g_vectorZero);
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::ClearEntityFlags(0x800000011);
|
|
this->_isInvicible = 0;
|
|
(GHIDRA_CAST<PathFinder *>((GHIDRA_CAST<PathFinder *>(&this->_pathfinder))))->PathFinder::Reset();
|
|
goto LAB_006c7308;
|
|
}
|
|
(GHIDRA_CAST<PathFinder *>((GHIDRA_CAST<PathFinder *>(&this->_pathfinder))))->PathFinder::Reset();
|
|
goto LAB_006c7308;
|
|
}
|
|
}
|
|
pRVar10 = GHIDRA_CAST<Room *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(pRVar10[-1])) + 0x7897))));
|
|
} while (pRVar10 != GHIDRA_CAST<Room *>(0x0));
|
|
}
|
|
}
|
|
LAB_006c8133:
|
|
pEVar7 = GHIDRA_CAST<Entity *>(&this->_sprite);
|
|
}
|
|
else {
|
|
if (iVar16 != 0xe) {
|
|
if ((iVar16 == 0xf) || (iVar16 == 0x10)) {
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetFrameCount();
|
|
fVar20 = sinf_wrapper((float)iVar16 * 0.1);
|
|
local_2b0 = GHIDRA_CAST<Entity *>(Math)::clamp(0.0,1.0,fVar20 + 0.5);
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetFrameCount();
|
|
fVar20 = sinf_wrapper((float)iVar16 * 0.3);
|
|
fVar20 = fVar20 + 0.5;
|
|
fVar27 = 1.0;
|
|
fVar21 = Math::clamp(0.0,1.0,fVar20);
|
|
iVar16 = this->_championColorIdx;
|
|
(GHIDRA_CAST<Color *>((&local_f8)))->Color::Color();
|
|
tmpColor = Color::Lerp(GHIDRA_CAST<ColorMod *>(&local_150),GHIDRA_CAST<ColorMod *>((&DAT_00c354d4 + iVar16 * 0x40)),
|
|
to_00,fVar21);
|
|
pEVar7 = GHIDRA_CAST<Entity *>(&this->_sprite);
|
|
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(pEVar7))))->Sprite::SetColor(tmpColor);
|
|
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(local_cc))))->Color::Color(fVar27,fVar20,in_XMM3_Da,
|
|
(float)(&DAT_00c354c0 + this->_championColorIdx * 0x40));
|
|
local_298.y = (GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(local_cc))))->Color::B();
|
|
fVar19 = (long double)Color::G();
|
|
local_2b8.y = (float)fVar19;
|
|
local_2f0.y = (GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(local_cc))))->Color::R();
|
|
(GHIDRA_CAST<Color *>((&local_254)))->Color::Color(local_2f0.y,local_2b8.y,local_298.y,1.0 - (float)local_2b0);
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::SetColor(extraout_EAX_01);
|
|
if ((this->_championColorIdx != 0x10) || (0.4 <= (float)local_2b0)) goto LAB_006c8136;
|
|
local_2b8.y = assert_lerp_range((float)local_2b0,0.2,0.4,1.0,0.0,1);
|
|
(GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level::GetCurrentRoom();
|
|
entityList = GHIDRA_CAST<EntityList *>(FUN_00428a60());
|
|
tmpVec = &this->_pos;
|
|
local_2f0.y = (float)tmpVec;
|
|
EntityList::QueryRadius(entityList,GHIDRA_CAST<EntityList_EL *>(local_318),tmpVec,100.0,4);
|
|
local_14 = 9;
|
|
iVar16 = (GHIDRA_CAST<EntityList *>((GHIDRA_CAST<EntityList *>(local_318))))->EntityList::Size();
|
|
if (iVar16 != 0) {
|
|
uVar4 = 0;
|
|
do {
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(uVar4);
|
|
iVar16 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(*entitySlot))))->Entity::Type();
|
|
if (iVar16 == 2) {
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(uVar4);
|
|
tmpVec2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(*entitySlot))))->Entity::Position(&local_54);
|
|
(GHIDRA_CAST<Vector *>((tmpVec2)))->Vector::__sub(&local_2e8,tmpVec);
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(uVar4);
|
|
pEVar7 = GHIDRA_CAST<Entity *>(*entitySlot);
|
|
fVar20 = (GHIDRA_CAST<Vector *>((&local_2e8)))->Vector::LengthSquared();
|
|
fVar20 = 1.0 - fVar20 / 10000.0;
|
|
local_298.y = fVar20;
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&local_2e8)))->Vector::Resized(&local_2f8,(fVar20 + fVar20) * local_2b8.y);
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::AddVelocity_divided(tmpVec,0);
|
|
tmpVec = GHIDRA_CAST<Vector *>(local_2f0.y);
|
|
}
|
|
uVar4 = uVar4 + 1;
|
|
uVar13 = (GHIDRA_CAST<EntityList *>((GHIDRA_CAST<EntityList *>(local_318))))->EntityList::Size();
|
|
} while (uVar4 < uVar13);
|
|
this = npc;
|
|
}
|
|
local_14 = 0xffffffff;
|
|
(GHIDRA_CAST<EntityList_Query *>((local_318)))->EntityList_Query::~EntityList_Query();
|
|
}
|
|
else if (iVar16 == 0x14) {
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetFrameCount();
|
|
fVar20 = sinf_wrapper((float)iVar16 * 0.1);
|
|
local_288 = GHIDRA_CAST<Room *>(Math)::clamp(0.0,1.0,fVar20 + 0.5);
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetFrameCount();
|
|
fVar20 = sinf_wrapper((float)iVar16 * 0.3);
|
|
fVar20 = fVar20 + 0.5;
|
|
fVar27 = 1.0;
|
|
fVar21 = Math::clamp(0.0,1.0,fVar20);
|
|
iVar16 = this->_championColorIdx;
|
|
(GHIDRA_CAST<Color *>((&local_f8)))->Color::Color();
|
|
tmpColor = Color::Lerp(GHIDRA_CAST<ColorMod *>(local_cc),GHIDRA_CAST<ColorMod *>((&DAT_00c354d4 + iVar16 * 0x40)),to
|
|
,fVar21);
|
|
pEVar7 = GHIDRA_CAST<Entity *>(&this->_sprite);
|
|
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(pEVar7))))->Sprite::SetColor(tmpColor);
|
|
(GHIDRA_CAST<Color *>((&local_150)))->Color::Color(fVar27,fVar20,in_XMM3_Da,
|
|
(float)(&DAT_00c354c0 + this->_championColorIdx * 0x40));
|
|
local_2ac = GHIDRA_CAST<Room *>((GHIDRA_CAST<Color *>((&local_150)))->Color)::B();
|
|
fVar19 = (long double)Color::G();
|
|
local_2c0 = GHIDRA_CAST<Entity *>((float)fVar19);
|
|
local_2d8 = GHIDRA_CAST<Entity *>((GHIDRA_CAST<Color *>((&local_150)))->Color)::R();
|
|
(GHIDRA_CAST<Color *>((&local_f8)))->Color::Color((float)local_2d8,(float)local_2c0,(float)local_2ac,
|
|
1.0 - (float)local_288);
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::SetColor(extraout_EAX_00);
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFrame(0x1e,this->_index);
|
|
if (bVar2 == 0) goto LAB_006c8136;
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
local_290 = GHIDRA_CAST<Entity *>((GHIDRA_CAST<Room *>((pRVar10)))->Room)::GetEntities();
|
|
local_281 = 0;
|
|
pAVar18 = GHIDRA_CAST<ANM2 *>(0x0);
|
|
local_2a0 = GHIDRA_CAST<ANM2 *>(0x0);
|
|
iVar16 = (GHIDRA_CAST<EntityList *>((GHIDRA_CAST<EntityList *>(local_290))))->EntityList::Size();
|
|
if (iVar16 != 0) {
|
|
do {
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(pAVar18);
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(*entitySlot))))->Entity::IsActiveEnemy(0);
|
|
if (bVar2 != 0) {
|
|
piVar14 = GHIDRA_CAST<int *>(std)::vector<int>::operator_index(pAVar18);
|
|
if (GHIDRA_CAST<Entity_NPC *>(*piVar14) != this) {
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(pAVar18);
|
|
pEVar7 = GHIDRA_CAST<Entity *>(*entitySlot);
|
|
local_2a5 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x20000100);
|
|
bVar2 = (GHIDRA_CAST<Entity *>((pEVar7)))->Entity::HasEntityFlags(0x20000000);
|
|
pAVar18 = local_2a0;
|
|
if (bVar2 == local_2a5) {
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(local_2a0);
|
|
iVar16 = __RTDynamicCast(*entitySlot,0,
|
|
&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor,
|
|
&IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,
|
|
0);
|
|
if (*GHIDRA_CAST<int *>((iVar16 + 0xc64)) != 0x14) {
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(pAVar18);
|
|
fVar19 = (long double)(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(*entitySlot))))->Entity::HitPoints();
|
|
local_2ac = GHIDRA_CAST<Room *>((float)fVar19);
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(pAVar18);
|
|
local_288 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(*entitySlot))))->Entity)::MaxHitPoints();
|
|
if ((float)local_2ac < (float)local_288) {
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(pAVar18);
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(*entitySlot))))->Entity::IsType(0x325,-1,-1);
|
|
if (bVar2 == 0) {
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(pAVar18);
|
|
pEVar7 = GHIDRA_CAST<Entity *>(*entitySlot);
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(local_2a0);
|
|
fVar19 = (long double)(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(*entitySlot))))->Entity::HitPoints();
|
|
local_2c0 = GHIDRA_CAST<Entity *>((float)(fVar19 + (long double)20.0));
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(local_2a0);
|
|
local_2d8 = GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(*entitySlot))))->Entity)::MaxHitPoints();
|
|
clampedValue = GHIDRA_CAST<float *>(std)::min<float>();
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::SetField380(*clampedValue);
|
|
uVar4 = Random();
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(local_2a0);
|
|
tmpVec = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(*entitySlot))))->Entity::Position(&healEffectPos);
|
|
uVar33 = 0;
|
|
pTVar30 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor;
|
|
pTVar29 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor;
|
|
uVar28 = 0;
|
|
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x31,tmpVec,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0
|
|
,uVar4);
|
|
__RTDynamicCast(pEVar7,uVar28,pTVar29,pTVar30,uVar33);
|
|
pAVar18 = local_2a0;
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(local_2a0);
|
|
tmpVec = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(*entitySlot))))->Entity::Position(&healTargetPos);
|
|
local_2a4 = GHIDRA_CAST<Entity_Effect *>(&this->_pos);
|
|
(GHIDRA_CAST<Vector *>((tmpVec)))->Vector::__sub(&local_2e8,GHIDRA_CAST<Vector *>(local_2a4));
|
|
local_288 = GHIDRA_CAST<Room *>(0x3dcccccd);
|
|
(GHIDRA_CAST<Vector *>((&local_2e8)))->Vector::__mul(&local_2d0,GHIDRA_CAST<float *>(&local_288));
|
|
local_288 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Vector *>((&local_2d0)))->Vector)::Length();
|
|
if (4.0 < (float)local_288) {
|
|
(GHIDRA_CAST<Vector *>((&local_2d0)))->Vector::Resize(4.0);
|
|
}
|
|
local_2c4 = GHIDRA_CAST<Room *>(0xc);
|
|
local_2ac = GHIDRA_CAST<Room *>(&DAT_00000004);
|
|
fVar20 = (GHIDRA_CAST<Vector *>((&local_2e8)))->Vector::Length();
|
|
pRVar10 = GHIDRA_CAST<Room *>((fVar20 / 20.0));
|
|
local_288 = pRVar10;
|
|
FUN_00407140();
|
|
local_2b0 = GHIDRA_CAST<Entity *>(GHIDRA_INT((float)pRVar10));
|
|
msvc::max<int>();
|
|
piVar14 = GHIDRA_CAST<int *>(std)::min<int>();
|
|
local_2b8.y = (float)*piVar14;
|
|
if (0 < GHIDRA_INT(local_2b8.y)) {
|
|
local_2c4 = GHIDRA_CAST<Room *>(&this->_posOffset);
|
|
local_298.y = (float)GHIDRA_INT(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<Entity_Player *>(local_2b8.y)))) + 0x1))));
|
|
local_2f0.y = (float)GHIDRA_CAST<Vector *>(0x0);
|
|
fVar20 = (float)GHIDRA_INT(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<Entity_Player *>(local_2b8.y)))) + 0x1))));
|
|
do {
|
|
local_2f0.y = (float)(GHIDRA_INT(&(GHIDRA_CAST<Vector *>(local_2f0.y))->x) + 1);
|
|
local_2ac = GHIDRA_CAST<Room *>(((float)GHIDRA_INT(local_2f0.y) / fVar20));
|
|
local_288 = local_2ac;
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(pAVar18);
|
|
tmpVec = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(*entitySlot))))->Entity::Position(&local_344);
|
|
tmpVec = vector_lerp(&local_34c,GHIDRA_CAST<Vector *>(local_2a4),tmpVec,0,
|
|
(float)local_288);
|
|
tmpVec2 = MusicManager::RandomVector(&local_354);
|
|
randomLength = random_float();
|
|
tmpVec2 = (GHIDRA_CAST<Vector *>((tmpVec2)))->Vector::__mul(&local_35c,&randomLength);
|
|
local_33c.y = 15.0;
|
|
tmpVec2 = (GHIDRA_CAST<Vector *>((tmpVec2)))->Vector::__mul(&local_364,&local_33c.y);
|
|
(GHIDRA_CAST<Vector *>((tmpVec)))->Vector::__add(&local_2e0,tmpVec2);
|
|
uVar4 = Random();
|
|
fVar20 = random_float();
|
|
local_320.y = fVar20 * 0.5 + 0.5;
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&local_2d0)))->Vector::__mul(&local_32c,&local_320.y);
|
|
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x6f,&local_2e0,tmpVec,GHIDRA_CAST<Entity *>(0x0),
|
|
0,uVar4);
|
|
pcVar1 = *(code **)(*GHIDRA_CAST<int *>(pEVar7) + 0x3c);
|
|
uVar28 = (GHIDRA_CAST<Color *>((0x3f800000)))->Color::Color(0,0,0,0,0x3e99999a,0,0);
|
|
(*pcVar1)(uVar28,0xffffffff,0xff,0,1);
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&g_vectorOne)))->Vector::__mul(&local_334,GHIDRA_CAST<float *>(&local_2ac));
|
|
fVar20 = random_float();
|
|
local_308.y = fVar20 * 0.3 + 0.3;
|
|
tmpVec = (GHIDRA_CAST<Vector *>((tmpVec)))->Vector::__mul(GHIDRA_CAST<Vector *>((local_318 + 8)),&local_308.y);
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::SetSpriteScale(tmpVec);
|
|
sprite = GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(npc))))->Entity)::GetSprite();
|
|
iVar16 = (GHIDRA_CAST<Sprite *>((sprite)))->Sprite::Scale();
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&local_2f8)))->Vector::Vector(0.0,*GHIDRA_CAST<float *>((iVar16 + 4)) * -16.0)
|
|
;
|
|
tmpVec = (GHIDRA_CAST<Vector *>((GHIDRA_CAST<Vector *>(local_2c4))))->Vector::__add(&local_54,tmpVec);
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::SetPositionOffset(tmpVec);
|
|
pAVar18 = local_2a0;
|
|
fVar20 = local_298.y;
|
|
} while (GHIDRA_INT(local_2f0.y) < GHIDRA_INT(local_2b8.y));
|
|
}
|
|
local_281 = 1;
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(pAVar18);
|
|
pcVar1 = *(code **)(*GHIDRA_CAST<int *>(*entitySlot) + 0x3c);
|
|
uVar28 = (GHIDRA_CAST<Color *>((0x3f800000)))->Color::Color(0,0,0,0,0x3f333333,0,0);
|
|
(*pcVar1)(uVar28,8,0xff,1,1);
|
|
pAVar18 = local_2a0;
|
|
this = npc;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
pAVar18 = GHIDRA_CAST<ANM2 *>(((pAVar18->_filename)._buf + 1));
|
|
local_2a0 = pAVar18;
|
|
pAVar12 = GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<EntityList *>((GHIDRA_CAST<EntityList *>(local_290))))->EntityList)::Size();
|
|
} while (pAVar18 < pAVar12);
|
|
if (local_281 != 0) {
|
|
pcVar1 = *(code **)(*GHIDRA_CAST<int *>(this) + 0x3c);
|
|
uVar28 = (GHIDRA_CAST<Color *>((0x3f800000)))->Color::Color(0,0,0,0,0x3f333333,0,0);
|
|
(*pcVar1)(uVar28,8,0xff,1,1);
|
|
play_sound_with_fart_seed(0x9d,1.0,2,0,1.0);
|
|
}
|
|
}
|
|
}
|
|
else if (iVar16 == 0x16) {
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFrame(0x1e,this->_index);
|
|
if (bVar2 != 0) {
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
local_2a0 = GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<Room *>((pRVar10)))->Room)::GetEntities();
|
|
uVar4 = 0;
|
|
iVar16 = (GHIDRA_CAST<EntityList *>((GHIDRA_CAST<EntityList *>(local_2a0))))->EntityList::Size();
|
|
if (iVar16 != 0) {
|
|
do {
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(uVar4);
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(*entitySlot))))->Entity::IsActiveEnemy(0);
|
|
if (bVar2 != 0) {
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(uVar4);
|
|
cVar3 = (**(code **)(*GHIDRA_CAST<int *>(*entitySlot) + 0x4c))();
|
|
if ((cVar3 == '\0') &&
|
|
(piVar14 = GHIDRA_CAST<int *>(std)::vector<int>::operator_index(uVar4),
|
|
GHIDRA_CAST<Entity_NPC *>(*piVar14) != this)) {
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(std)::vector<int>::operator_index(uVar4);
|
|
piVar14 = GHIDRA_CAST<int *>(__RTDynamicCast(*entitySlot,0,
|
|
&IsaacRepentancePlus::Entity::
|
|
RTTI_Type_Descriptor,
|
|
&IsaacRepentancePlus::Entity_NPC::
|
|
RTTI_Type_Descriptor,0));
|
|
if ((piVar14 != GHIDRA_CAST<int *>(0x0)) && (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(piVar14) + 0xc63)) == '\0')) {
|
|
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(piVar14) + 0xc63)) = 1;
|
|
piVar14[0x319] = 1;
|
|
(**(code **)(*piVar14 + 0x60))();
|
|
}
|
|
}
|
|
}
|
|
uVar4 = uVar4 + 1;
|
|
uVar13 = (GHIDRA_CAST<EntityList *>((GHIDRA_CAST<EntityList *>(local_2a0))))->EntityList::Size();
|
|
} while (uVar4 < uVar13);
|
|
}
|
|
}
|
|
}
|
|
else if ((iVar16 == 0x15) && (0 < this->_championTimer)) {
|
|
this->_championTimer = this->_championTimer + -1;
|
|
}
|
|
goto LAB_006c8133;
|
|
}
|
|
Isaac::GetRenderPosition(&local_298,&this->_pos,1);
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
tmpVec = GHIDRA_CAST<Vector *>((GHIDRA_CAST<Room *>((pRVar10)))->Room)::GetRenderSurfaceTopLeft();
|
|
(GHIDRA_CAST<Vector *>((&local_298)))->Vector::operator__(tmpVec);
|
|
(GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level::GetCurrentRoom();
|
|
FUN_004177e0(&local_2e8);
|
|
local_14 = 8;
|
|
piVar14 = GHIDRA_CAST<int *>(EntityPtr)::Ref();
|
|
pcVar1 = *(code **)(*piVar14 + 0x2c);
|
|
uVar28 = __ftoui3();
|
|
uVar28 = __ftoui3(uVar28);
|
|
(*pcVar1)(local_60,uVar28);
|
|
local_14 = 0xffffffff;
|
|
FUN_0041c710();
|
|
pEVar7 = local_2d8;
|
|
tmpColor = GHIDRA_CAST<ColorMod *>((GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(local_2d8))))->Sprite)::Color();
|
|
(GHIDRA_CAST<Color *>((&spriteColorCopy)))->Color::operator_assign(tmpColor);
|
|
local_288 = GHIDRA_CAST<Room *>((local_58 * 0.9));
|
|
fVar19 = (long double)Color::BO();
|
|
local_2ac = GHIDRA_CAST<Room *>((float)fVar19);
|
|
local_2c0 = GHIDRA_CAST<Entity *>(Math)::lerp((float)local_2ac,(float)local_288,0.3,0);
|
|
local_288 = GHIDRA_CAST<Room *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_60)) + 0x4))) * 0.9));
|
|
local_2ac = GHIDRA_CAST<Room *>((GHIDRA_CAST<Color *>((&spriteColorCopy)))->Color)::GO();
|
|
local_2d8 = GHIDRA_CAST<Entity *>(Math)::lerp((float)local_2ac,(float)local_288,0.3,0);
|
|
local_288 = GHIDRA_CAST<Room *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_60)) + 0x0))) * 0.9));
|
|
fVar19 = (long double)Color::RO();
|
|
local_2ac = GHIDRA_CAST<Room *>((float)fVar19);
|
|
fVar20 = Math::lerp((float)local_2ac,(float)local_288,0.3,0);
|
|
tmpColor = GHIDRA_CAST<ColorMod *>((GHIDRA_CAST<Color *>((0x3f800000)))->Color)::Color(fVar20,local_2d8,local_2c0);
|
|
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(pEVar7))))->Sprite::SetColor(tmpColor);
|
|
this = npc;
|
|
}
|
|
LAB_006c8136:
|
|
if (this->_championColorIdx == 0x19) {
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetFrameCount();
|
|
hsv_to_rgb(&local_38,((float)(iVar16 % 0x5a) * 360.0) / 90.0,1.0,1.0,1.0);
|
|
(GHIDRA_CAST<Color *>((&local_124)))->Color::Color(local_38._red,local_38._green,local_38._blue,1.0);
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::SetColor(extraout_EAX_02);
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x1000000);
|
|
if ((bVar2 != 0) && (this->_shrinkCountdown - 1U < 0x3b)) {
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetFrameCount();
|
|
fVar20 = sinf_wrapper((float)iVar16 * 0.1);
|
|
Math::clamp(0.0,1.0,fVar20 + 0.5);
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetFrameCount();
|
|
fVar20 = sinf_wrapper((float)iVar16 * 0.3);
|
|
fVar20 = Math::clamp(0.0,1.0,fVar20 + 0.5);
|
|
local_298.y = fVar20;
|
|
(GHIDRA_CAST<Color *>((0x3f800000)))->Color::Color(0x3c,0x3c,0x3c);
|
|
fVar20 = local_298.y;
|
|
(GHIDRA_CAST<Color *>((&local_124)))->Color::Color();
|
|
tmpColor = Color::Lerp(GHIDRA_CAST<ColorMod *>(&local_254),GHIDRA_CAST<ColorMod *>(local_a0),to_01,fVar20);
|
|
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(pEVar7))))->Sprite::SetColor(tmpColor);
|
|
}
|
|
(GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level::GetCurrentRoom();
|
|
cVar3 = FUN_006b8440();
|
|
if (cVar3 != '\0') {
|
|
if ((((this->_dead == 0) && (this->_isBoss == 0)) &&
|
|
(bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFlying(), bVar2 == 0)) &&
|
|
(this->_entityGridCollisionClass != 6)) {
|
|
fVar20 = 1.4013e-45;
|
|
}
|
|
else {
|
|
fVar20 = 0.0;
|
|
}
|
|
fVar21 = 0.0;
|
|
if (this->_type != 0x376) {
|
|
fVar21 = fVar20;
|
|
}
|
|
local_298.y = fVar21;
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetFrameCount();
|
|
if (GHIDRA_UINT((iVar16 + this->_index)) % 0x3c == 0) {
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetFrameCount();
|
|
if ((900 < iVar16) && ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_298.y)) + 0x0))) != '\0')) {
|
|
gridEntity = GHIDRA_CAST<GridEntity *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<GridEntity *>((gridEntity)))->GridEntity::GetVariant();
|
|
if (iVar16 == 1) {
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
bVar2 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::IsClear();
|
|
if (bVar2 == 0) {
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::GetPlayerManager();
|
|
cVar3 = FUN_009be9c0();
|
|
if (cVar3 == '\0') {
|
|
pRVar10 = GHIDRA_CAST<Room *>(0x0);
|
|
local_29c = GHIDRA_CAST<Room *>(0x0);
|
|
iVar16 = (GHIDRA_CAST<Game *>((g_game)))->Game::GetNumPlayers();
|
|
if (iVar16 != 0) {
|
|
do {
|
|
player = (GHIDRA_CAST<Game *>((g_game)))->Game::GetPlayer(GHIDRA_UINT(pRVar10));
|
|
local_298.y = (float)player;
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(player))))->Entity::IsFlying();
|
|
if (bVar2 == 0) {
|
|
bVar2 = 1;
|
|
tmpVec = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(local_298.y))))->Entity::Position(&local_54);
|
|
bVar2 = (GHIDRA_CAST<NPCAI_Pathfinder *>((&this->_pathfinder)))->NPCAI_Pathfinder::HasPathToPos(tmpVec,bVar2);
|
|
if (bVar2 != 0) goto LAB_006c8453;
|
|
pRVar10 = local_29c;
|
|
}
|
|
pRVar10 = GHIDRA_CAST<Room *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((pRVar10)) + 0x1))));
|
|
local_29c = pRVar10;
|
|
puVar17 = GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<Game *>((g_game)))->Game)::GetNumPlayers();
|
|
} while (pRVar10 < puVar17);
|
|
}
|
|
if (this->_isUnreachableOnce == 0) {
|
|
this->_isUnreachableOnce = 1;
|
|
}
|
|
else {
|
|
this->_canShutDoors = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
LAB_006c8453:
|
|
if (this->_dead != 0) {
|
|
if (this->_exists != 0) {
|
|
PlayDeathEffects(this);
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x400);
|
|
if (bVar2 != 0) {
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x40000000000);
|
|
if (bVar2 == 0) {
|
|
local_2b8.y = (float)&this->_pos;
|
|
player = Game::GetNearestPlayerEx(GHIDRA_CAST<Vector *>(local_2b8.y),1,0,1);
|
|
if ((player == GHIDRA_CAST<Entity_Player *>(0x0)) ||
|
|
(iVar16 = (GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::GetHealthType(), iVar16 != 3)) {
|
|
iVar16 = Isaac::Random(3);
|
|
local_2a4 = GHIDRA_CAST<Entity_Effect *>((iVar16 + 1));
|
|
}
|
|
else {
|
|
local_2a4 = GHIDRA_CAST<Entity_Effect *>(Isaac)::Random(3);
|
|
}
|
|
if (0 < GHIDRA_INT(local_2a4)) {
|
|
do {
|
|
uVar4 = Random();
|
|
tmpVec = MusicManager::RandomVector(&local_2f8);
|
|
fVar20 = random_float();
|
|
local_298.y = fVar20 * 3.0;
|
|
tmpVec = (GHIDRA_CAST<Vector *>((tmpVec)))->Vector::__mul(GHIDRA_CAST<Vector *>((local_318 + 8)),&local_298.y);
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(5,0x14,GHIDRA_CAST<Vector *>(local_2b8.y),tmpVec,GHIDRA_CAST<Entity *>(0x0),1,uVar4);
|
|
local_2a4 = GHIDRA_CAST<Entity_Effect *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_2a4[-1])) + 0x4bf))));
|
|
} while (local_2a4 != GHIDRA_CAST<Entity_Effect *>(0x0));
|
|
local_2a4 = GHIDRA_CAST<Entity_Effect *>(0x0);
|
|
this = npc;
|
|
}
|
|
}
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x40000);
|
|
if (bVar2 == 0) {
|
|
(GHIDRA_CAST<Entity_Pickup *>((GHIDRA_CAST<Entity_Pickup *>(this))))->Entity_Pickup::Update();
|
|
uVar4 = 0;
|
|
iVar16 = (GHIDRA_CAST<Game *>((g_game)))->Game::GetNumPlayers();
|
|
if (iVar16 != 0) {
|
|
do {
|
|
player = (GHIDRA_CAST<Game *>((g_game)))->Game::GetPlayer(uVar4);
|
|
(GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::trigger_npc_death(GHIDRA_CAST<Entity *>(this));
|
|
uVar4 = uVar4 + 1;
|
|
uVar13 = (GHIDRA_CAST<Game *>((g_game)))->Game::GetNumPlayers();
|
|
} while (uVar4 < uVar13);
|
|
}
|
|
}
|
|
FUN_006d5350();
|
|
if ((this->_isBoss == 0) && (this->_type != 0x1c)) {
|
|
trigger_kill_item_effects(this);
|
|
}
|
|
else {
|
|
this->_state = 0x12;
|
|
this->_stateFrame = 0;
|
|
}
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
bVar2 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::is_type_16();
|
|
if ((bVar2 != 0) && (bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFlying(), bVar2 == 0)) {
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
gridEntity = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetGridEntityFromPos(&this->_pos);
|
|
if ((gridEntity != GHIDRA_CAST<GridEntity *>(0x0)) &&
|
|
(iVar16 = (GHIDRA_CAST<GridEntity *>((gridEntity)))->GridEntity::GetType(), iVar16 == 0x13)) {
|
|
(this->_velocity).y = (this->_velocity).y * 0.5;
|
|
fVar20 = (this->_velocity).x;
|
|
if (fVar20 <= 0.0) {
|
|
if (fVar20 < 0.0) {
|
|
fVar20 = (GHIDRA_CAST<Vector *>((&this->_velocity)))->Vector::Length();
|
|
local_298.y = fVar20;
|
|
(this->_velocity).x = -fVar20;
|
|
}
|
|
}
|
|
else {
|
|
fVar20 = (GHIDRA_CAST<Vector *>((&this->_velocity)))->Vector::Length();
|
|
(this->_velocity).x = fVar20;
|
|
}
|
|
game = g_game;
|
|
(this->_velocity).y = 0.0;
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(game))))->Level)::GetCurrentRoom();
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&local_2f8)))->Vector::Vector(0.0,(this->_sizeMulti).y * this->_size + 0.5);
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&this->_pos)))->Vector::__add(GHIDRA_CAST<Vector *>((local_318 + 8)),tmpVec);
|
|
local_2d0.x = tmpVec->x;
|
|
local_2d0.y = tmpVec->y;
|
|
iVar16 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetGridCollisionAtPos(*tmpVec);
|
|
if (iVar16 != 4) {
|
|
bVar2 = 0;
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&local_334)))->Vector::Vector(0.0,3.5);
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::AddVelocity_divided(tmpVec,bVar2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
goto LAB_006c87a7;
|
|
}
|
|
LAB_006c87b4:
|
|
if ((((this->_state != 0x12) && (this->_state != 0x11)) &&
|
|
(bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFriendly(), bVar2 == 0)) &&
|
|
(bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsVulnerableEnemy(GHIDRA_CAST<Entity *>(0x0)), bVar2 != 0)) {
|
|
local_2d8 = GHIDRA_CAST<Entity *>(0x4e6e6b28);
|
|
puVar17 = GHIDRA_CAST<uint8_t *>(0x0);
|
|
local_2b0 = GHIDRA_CAST<Entity *>(0x45c80000);
|
|
local_2c4 = GHIDRA_CAST<Room *>(0x0);
|
|
local_288 = GHIDRA_CAST<Room *>(0x0);
|
|
local_29c = GHIDRA_CAST<Room *>(0x0);
|
|
local_2ac = GHIDRA_CAST<Room *>(0x0);
|
|
local_2c0 = local_2d8;
|
|
iVar16 = (GHIDRA_CAST<Game *>((g_game)))->Game::GetNumPlayers();
|
|
if (iVar16 != 0) {
|
|
do {
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Game *>((g_game)))->Game)::GetPlayer(GHIDRA_UINT(puVar17));
|
|
FUN_0042a020();
|
|
bVar2 = (GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(pRVar10))))->Entity_Player::HasCollectible(0x14f,0);
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_298.y)) + 0x0))) = bVar2;
|
|
FUN_006da770(&local_2e0,0);
|
|
FUN_006da710(local_298.y);
|
|
guard_check_icall();
|
|
bVar2 = (GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(pRVar10))))->Entity_Player::HasTrinket(0x44,0);
|
|
local_2b8.y = (float)CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_2b8.y)) + 0x1))),bVar2);
|
|
FUN_006da770(&local_2e8,1);
|
|
FUN_006da710(local_2b8.y);
|
|
guard_check_icall();
|
|
bVar2 = (GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(pRVar10))))->Entity_Player::HasCollectible(0x2b8,0);
|
|
local_2f0.y = (float)CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_2f0.y)) + 0x1))),bVar2);
|
|
FUN_006da770(&local_2d0,2);
|
|
FUN_006da710(local_2f0.y);
|
|
guard_check_icall();
|
|
cVar3 = msvc::bitset<8>::any();
|
|
if (cVar3 != '\0') {
|
|
tmpVec = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(pRVar10))))->Entity::Position(&local_32c);
|
|
local_290 = GHIDRA_CAST<Entity *>((GHIDRA_CAST<Vector *>((tmpVec)))->Vector)::DistanceSquared(&this->_pos);
|
|
FUN_006da770(&local_300,0);
|
|
local_28c = GHIDRA_CAST<Entity_Effect *>((GHIDRA_UINT(local_28c) | 0x10));
|
|
cVar3 = FUN_006da6f0();
|
|
if ((cVar3 == '\0') || (local_281 = '\x01', (float)local_2b0 <= (float)local_290)) {
|
|
local_281 = '\0';
|
|
}
|
|
if ((GHIDRA_UINT(local_28c) & 0x10) != 0) {
|
|
local_28c = GHIDRA_CAST<Entity_Effect *>((GHIDRA_UINT(local_28c) & 0xffffffef));
|
|
guard_check_icall();
|
|
}
|
|
if (local_281 != '\0') {
|
|
local_2c4 = pRVar10;
|
|
local_2b0 = local_290;
|
|
}
|
|
FUN_006da770(&local_308,1);
|
|
local_28c = GHIDRA_CAST<Entity_Effect *>((GHIDRA_UINT(local_28c) | 0x20));
|
|
cVar3 = FUN_006da6f0();
|
|
if ((cVar3 == '\0') || (local_281 = '\x01', (float)local_2d8 <= (float)local_290)) {
|
|
local_281 = '\0';
|
|
}
|
|
if ((GHIDRA_UINT(local_28c) & 0x20) != 0) {
|
|
local_28c = GHIDRA_CAST<Entity_Effect *>((GHIDRA_UINT(local_28c) & 0xffffffdf));
|
|
guard_check_icall();
|
|
}
|
|
if (local_281 != '\0') {
|
|
local_2d8 = local_290;
|
|
local_288 = pRVar10;
|
|
}
|
|
FUN_006da770(&local_320,2);
|
|
local_14 = 10;
|
|
local_2a4 = GHIDRA_CAST<Entity_Effect *>((GHIDRA_UINT(local_28c) | 0x40));
|
|
local_28c = local_2a4;
|
|
cVar3 = FUN_006da6f0();
|
|
if ((cVar3 == '\0') ||
|
|
(auVar23 = ZEXT416(local_2c0), (float)local_2c0 <= (float)local_290)) {
|
|
LAB_006c8ae8:
|
|
local_281 = 0;
|
|
}
|
|
else {
|
|
Entity_Player::get_salvation_scale();
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(auVar24)) + 0x4))) = (*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(auVar23)) + 0x4)));
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(auVar24)) + 0x0))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(auVar23)) + 0x0))) * 70.0 + this->_size;
|
|
FUN_006daa90();
|
|
local_281 = 1;
|
|
if ((*GHIDRA_CAST<uint64_t *>((GHIDRA_CAST<char *>(&(auVar24)) + 0x0))) <= (double)(float)local_290) goto LAB_006c8ae8;
|
|
}
|
|
local_14 = 0xffffffff;
|
|
if ((GHIDRA_UINT(local_28c) & 0x40) != 0) {
|
|
local_28c = GHIDRA_CAST<Entity_Effect *>((GHIDRA_UINT(local_28c) & 0xffffffbf));
|
|
guard_check_icall();
|
|
}
|
|
if (local_281 != 0) {
|
|
local_2c0 = local_290;
|
|
local_29c = pRVar10;
|
|
}
|
|
}
|
|
puVar17 = &(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((local_2ac)) + 0x1)));
|
|
local_2ac = GHIDRA_CAST<Room *>(puVar17);
|
|
puVar11 = GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<Game *>((g_game)))->Game)::GetNumPlayers();
|
|
} while (puVar17 < puVar11);
|
|
if ((local_2c4 != GHIDRA_CAST<Room *>(0x0)) && (iVar16 = Isaac::Random(3), iVar16 == 0)) {
|
|
tmpVec = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(local_2c4))))->Entity::Position(&local_32c);
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&this->_pos)))->Vector::__sub(&local_364,tmpVec);
|
|
fVar20 = sqrtf((float)local_2b0);
|
|
local_298.y = 80.0 - fVar20;
|
|
fVar20 = random_float();
|
|
this = npc;
|
|
local_2b8.y = fVar20 * local_298.y * 0.1;
|
|
local_298.y = (GHIDRA_CAST<Vector *>((&npc->_velocity)))->Vector::Length();
|
|
tmpVec = (GHIDRA_CAST<Vector *>((tmpVec)))->Vector::Resized(&local_35c,local_298.y * local_2b8.y * 0.2 + 0.05);
|
|
(GHIDRA_CAST<Vector *>((&this->_velocity)))->Vector::operator_add_assign(tmpVec);
|
|
}
|
|
pRVar10 = local_288;
|
|
if ((local_288 != GHIDRA_CAST<Room *>(0x0)) && (iVar16 = Isaac::Random(3), iVar16 == 0)) {
|
|
tmpVec = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(pRVar10))))->Entity::Position(&local_354);
|
|
tmpVec = (GHIDRA_CAST<Vector *>((tmpVec)))->Vector::__sub(&local_34c,&this->_pos);
|
|
tmpVec = (GHIDRA_CAST<Vector *>((tmpVec)))->Vector::Resized(&local_344,0.5);
|
|
(GHIDRA_CAST<Vector *>((&this->_velocity)))->Vector::operator_add_assign(tmpVec);
|
|
}
|
|
pRVar10 = local_29c;
|
|
if (local_29c != GHIDRA_CAST<Room *>(0x0)) {
|
|
iVar16 = EntityPtr::Ref();
|
|
if (iVar16 == 0) {
|
|
uVar4 = Random();
|
|
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x13,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(pRVar10),3,
|
|
uVar4);
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::SetTarget(GHIDRA_CAST<Entity *>(this));
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::SetParent(GHIDRA_CAST<Entity *>(local_29c));
|
|
pEVar7->SetCollisionDamage(0x40600000);
|
|
pEVar7->Update();
|
|
(GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<EntityPtr *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf58)))))))->EntityPtr::Set(pEVar7);
|
|
}
|
|
iVar16 = EntityPtr::Ref();
|
|
if (iVar16 != 0) {
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>(EntityPtr)::Ref();
|
|
(GHIDRA_CAST<Entity_Effect *>((pEVar9)))->Entity_Effect::set_state(1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetFrameCount();
|
|
if ((iVar16 == 0) && (bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsVulnerableEnemy(GHIDRA_CAST<Entity *>(0x0)), bVar2 != 0)
|
|
) {
|
|
playerManager = GHIDRA_CAST<PlayerManager *>((GHIDRA_CAST<Game *>((g_game)))->Game)::GetPlayerManager();
|
|
local_2b8.y = (float)PlayerManager::FirstCollectibleOwner(playerManager,0x15e,GHIDRA_CAST<RNG **>(0x0),0);
|
|
if (GHIDRA_CAST<Entity_Player *>(local_2b8.y) != GHIDRA_CAST<Entity_Player *>(0x0)) {
|
|
::(GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>(local_4c))))->EntityRef::constructor(GHIDRA_CAST<Entity *>(local_2b8.y));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::AddPoison(GHIDRA_CAST<EntityRef *>(local_4c),-0x28,0.0,0);
|
|
}
|
|
playerManager = GHIDRA_CAST<PlayerManager *>((GHIDRA_CAST<Game *>((g_game)))->Game)::GetPlayerManager();
|
|
player = (GHIDRA_CAST<PlayerManager *>((playerManager)))->PlayerManager::FirstTrinketOwner(0x87);
|
|
if (player != GHIDRA_CAST<Entity_Player *>(0x0)) {
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(auVar25)) + 0x0))) = ZEXT812(0x3e4ccccd);
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(auVar25)) + 0xc))) = 0;
|
|
local_29c = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(auVar25)) + 0x0)));
|
|
iVar16 = (GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::GetTrinketMultiplier(0x87);
|
|
if (iVar16 == 2) {
|
|
auVar22 = ZEXT812(0x3ea8f5c3);
|
|
LAB_006c8df9:
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(auVar25)) + 0xc))) = 0;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(auVar25)) + 0x0))) = auVar22;
|
|
local_29c = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(auVar22)) + 0x0)));
|
|
}
|
|
else if (iVar16 == 3) {
|
|
auVar22 = ZEXT812(0x3f000000);
|
|
goto LAB_006c8df9;
|
|
}
|
|
(GHIDRA_CAST<RNG *>((GHIDRA_CAST<RNG *>((local_60 + 4)))))->RNG::game_constructor(this->_initSeed,5);
|
|
local_14 = 0xb;
|
|
fVar20 = (GHIDRA_CAST<RNG *>((this_00)))->RNG::RandomFloat();
|
|
local_298.y = fVar20;
|
|
FUN_00665c00();
|
|
local_14 = 0xffffffff;
|
|
local_2a5 = local_298.y < (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(auVar25)) + 0x0))) * 0.02 + (float)local_29c;
|
|
guard_check_icall();
|
|
if (local_2a5 != 0) {
|
|
::(GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>(local_4c))))->EntityRef::constructor(GHIDRA_CAST<Entity *>(player));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::AddBurn(GHIDRA_CAST<EntityRef *>(local_4c),-0x5a,0.0,0);
|
|
}
|
|
}
|
|
playerManager = GHIDRA_CAST<PlayerManager *>((GHIDRA_CAST<Game *>((g_game)))->Game)::GetPlayerManager();
|
|
player = (GHIDRA_CAST<PlayerManager *>((playerManager)))->PlayerManager::FirstTrinketOwner(0xbc);
|
|
if (player != GHIDRA_CAST<Entity_Player *>(0x0)) {
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(auVar26)) + 0x0))) = ZEXT812(0x3e4ccccd);
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(auVar26)) + 0xc))) = 0;
|
|
local_29c = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(auVar26)) + 0x0)));
|
|
iVar16 = (GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::GetTrinketMultiplier(0xbc);
|
|
if (iVar16 == 2) {
|
|
auVar22 = ZEXT812(0x3ea8f5c3);
|
|
LAB_006c8edb:
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(auVar26)) + 0xc))) = 0;
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(auVar26)) + 0x0))) = auVar22;
|
|
local_29c = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(auVar22)) + 0x0)));
|
|
}
|
|
else if (iVar16 == 3) {
|
|
auVar22 = ZEXT812(0x3f000000);
|
|
goto LAB_006c8edb;
|
|
}
|
|
(GHIDRA_CAST<RNG *>((GHIDRA_CAST<RNG *>((local_60 + 4)))))->RNG::game_constructor(this->_initSeed,5);
|
|
local_14 = 0xc;
|
|
fVar20 = (GHIDRA_CAST<RNG *>((sfx)))->RNG::RandomFloat();
|
|
local_298.y = fVar20;
|
|
FUN_00665c00();
|
|
local_14 = 0xffffffff;
|
|
local_2a5 = local_298.y < (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(auVar26)) + 0x0))) * 0.02 + (float)local_29c;
|
|
guard_check_icall();
|
|
fVar20 = local_2b8.y;
|
|
if (local_2a5 != 0) {
|
|
::(GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>(local_4c))))->EntityRef::constructor(GHIDRA_CAST<Entity *>(local_2b8.y));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::AddFreeze(GHIDRA_CAST<EntityRef *>(local_4c),-0x5a,0);
|
|
::(GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>((local_a0 + 0x2c)))))->EntityRef::constructor(GHIDRA_CAST<Entity *>(fVar20));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::AddIce(GHIDRA_CAST<EntityRef *>((local_a0 + 0x2c)),-0x5a);
|
|
}
|
|
}
|
|
}
|
|
pEVar7 = GetPlayerTarget(this);
|
|
player = (GHIDRA_CAST<Entity *>((pEVar7)))->Entity::ToPlayer();
|
|
if ((player != GHIDRA_CAST<Entity_Player *>(0x0)) && (bVar2 = (GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::IsInvisible(), bVar2 != 0))
|
|
{
|
|
::(GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>(local_4c))))->EntityRef::constructor(GHIDRA_CAST<Entity *>(this));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::AddConfusion(GHIDRA_CAST<EntityRef *>(local_4c),-2,0);
|
|
}
|
|
playerManager = GHIDRA_CAST<PlayerManager *>((GHIDRA_CAST<Game *>((g_game)))->Game)::GetPlayerManager();
|
|
player = PlayerManager::FirstCollectibleOwner(playerManager,0x202,GHIDRA_CAST<RNG **>(0x0),0);
|
|
if (player != GHIDRA_CAST<Entity_Player *>(0x0)) {
|
|
playerManager = GHIDRA_CAST<PlayerManager *>((GHIDRA_CAST<Game *>((g_game)))->Game)::GetPlayerManager();
|
|
fVar20 = PlayerManager::get_total_luck(playerManager);
|
|
local_2b8.y = 5.32493e-44;
|
|
local_298.y = (float)(0x37 - GHIDRA_INT(fVar20));
|
|
piVar14 = GHIDRA_CAST<int *>(std)::max<int>();
|
|
iVar16 = *piVar14;
|
|
cVar3 = this->IsBoss();
|
|
if (cVar3 == '\0') {
|
|
iVar16 = iVar16 * 2;
|
|
}
|
|
else {
|
|
iVar16 = iVar16 * 3;
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsVulnerableEnemy(GHIDRA_CAST<Entity *>(0x0));
|
|
if (((bVar2 != 0) && (iVar16 = Isaac::Random(iVar16), iVar16 == 0)) && (this->_dead == 0)) {
|
|
pEVar7 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::GetStatusEffectTarget();
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::AddEntityFlags(0x20);
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::CopyStatusEffects();
|
|
}
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsActiveEnemy(0);
|
|
if (((bVar2 != 0) && (bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x20), bVar2 != 0)) &&
|
|
((this->_freezeCountdown < 1 && (bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFrame(0x32,0), bVar2 != 0))))
|
|
{
|
|
pEVar7 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::GetStatusEffectTarget();
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::ClearEntityFlags(0x20);
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::CopyStatusEffects();
|
|
bVar2 = (GHIDRA_CAST<Vector *>((&this->_velocity)))->Vector::operator_ne(&g_vectorZero);
|
|
if (bVar2 != 0) {
|
|
(GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<EntityPtr *>(&local_2d0))))->EntityPtr::clear();
|
|
iVar16 = FUN_0067f030();
|
|
local_2d0.x = (float)((double)iVar16 + __uint_to_double_fixup[-(iVar16 >> 0x1f)]) * 14.0 -
|
|
21.0;
|
|
iVar16 = FUN_0067f030();
|
|
local_2d0.y = (float)((double)iVar16 + __uint_to_double_fixup[-(iVar16 >> 0x1f)]) * 14.0 -
|
|
21.0;
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
tmpVec = &this->_pos;
|
|
tmpVec2 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetClampedPosition(&local_54,tmpVec,0.0);
|
|
local_2a5 = (GHIDRA_CAST<Vector *>((tmpVec2)))->Vector::operator_eq(tmpVec);
|
|
(GHIDRA_CAST<Vector *>((tmpVec)))->Vector::operator_add_assign(&local_2d0);
|
|
if (local_2a5 != 0) {
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
tmpVec2 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetClampedPosition(&local_54,tmpVec,0.0);
|
|
(GHIDRA_CAST<Vector *>((tmpVec)))->Vector::operator_assign(tmpVec2);
|
|
}
|
|
}
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x10);
|
|
if (bVar2 == 0) {
|
|
uVar4 = 0;
|
|
local_29c = GHIDRA_CAST<Room *>(CONCAT31(extraout_var,bVar2));
|
|
pvVar8 = (void *)(GHIDRA_CAST<Game *>((g_game)))->Game::GetPlayerManager();
|
|
iVar16 = (GHIDRA_CAST<msvc::vector *>((pvVar8)))->msvc::vector::size();
|
|
if (iVar16 != 0) {
|
|
do {
|
|
player = (GHIDRA_CAST<Game *>((g_game)))->Game::GetPlayer(uVar4);
|
|
tempEffects = GHIDRA_CAST<TemporaryEffects *>((GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player)::GetEffects();
|
|
bVar2 = (GHIDRA_CAST<TemporaryEffects *>((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x5d);
|
|
local_29c = GHIDRA_CAST<Room *>((GHIDRA_UINT(local_29c) & 0xff));
|
|
if (bVar2 != 0) {
|
|
local_29c = GHIDRA_CAST<Room *>(0x1);
|
|
}
|
|
uVar4 = uVar4 + 1;
|
|
pvVar8 = (void *)(GHIDRA_CAST<Game *>((g_game)))->Game::GetPlayerManager();
|
|
uVar13 = (GHIDRA_CAST<msvc::vector *>((pvVar8)))->msvc::vector::size();
|
|
this = npc;
|
|
} while (uVar4 < uVar13);
|
|
if ((char)local_29c != '\0') {
|
|
pcVar1 = *(code **)(*GHIDRA_CAST<int *>(npc) + 0x3c);
|
|
(GHIDRA_CAST<Color *>((&local_124)))->Color::Color();
|
|
(*pcVar1)(extraout_EAX_03,2,0,0,1);
|
|
::(GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>(local_4c))))->EntityRef::constructor(GHIDRA_CAST<Entity *>(this));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::AddFear(GHIDRA_CAST<EntityRef *>(local_4c),-2,0);
|
|
}
|
|
}
|
|
}
|
|
(GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level::GetCurrentRoom();
|
|
tempEffects = GHIDRA_CAST<TemporaryEffects *>(FUN_004360d0());
|
|
bVar2 = (GHIDRA_CAST<TemporaryEffects *>((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0xe8);
|
|
if (bVar2 == 0) {
|
|
(GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level::GetCurrentRoom();
|
|
tempEffects = GHIDRA_CAST<TemporaryEffects *>(FUN_004360d0());
|
|
bVar2 = (GHIDRA_CAST<TemporaryEffects *>((tempEffects)))->TemporaryEffects::HasCollectibleEffect(0x42);
|
|
if (bVar2 != 0) goto LAB_006c930b;
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
uVar4 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetBrokenWatchState();
|
|
if (uVar4 == 1) goto LAB_006c930b;
|
|
}
|
|
else {
|
|
LAB_006c930b:
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x20000001);
|
|
if ((bVar2 == 0) || (this->_type == 0xd4)) {
|
|
pcVar1 = *(code **)(*GHIDRA_CAST<int *>(this) + 0x3c);
|
|
uVar28 = (GHIDRA_CAST<Color *>((0x3f800000)))->Color::Color(0x28,0x28,0x28);
|
|
(*pcVar1)(uVar28,2,0xfa,0,1);
|
|
}
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x10000000000000);
|
|
if (bVar2 != 0) {
|
|
fVar20 = Math::timescale_factor(0.92,this->_speedMultiplier);
|
|
this->_friction = fVar20 * this->_friction;
|
|
}
|
|
if (this->_isChampion != 0) {
|
|
fVar20 = Math::timescale_factor
|
|
(1.0 - (1.0 - this->_championSpeed) * (1.0 - this->_friction),
|
|
this->_speedMultiplier);
|
|
local_298.y = fVar20;
|
|
(GHIDRA_CAST<Vector *>((&this->_velocity)))->Vector::operator_mul_assign(&local_298.y);
|
|
}
|
|
sprite = GHIDRA_CAST<Sprite *>(&this->_sprite);
|
|
local_298.y = (float)sprite;
|
|
bVar2 = (GHIDRA_CAST<Sprite *>((sprite)))->Sprite::IsEventTriggered("poof02");
|
|
if (bVar2 != 0) {
|
|
pvVar8 = (GHIDRA_CAST<Sprite *>((sprite)))->Sprite::GetNullFrame(GHIDRA_CAST<uint8_t *>("poof02"));
|
|
uVar4 = Random();
|
|
uVar33 = 0;
|
|
pTVar30 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor;
|
|
pTVar29 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor;
|
|
uVar28 = 0;
|
|
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x10,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar4);
|
|
pEVar7 = GHIDRA_CAST<Entity *>(__RTDynamicCast(pEVar7,uVar28,pTVar29,pTVar30,uVar33));
|
|
FUN_004563c0(pvVar8);
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&local_54)))->Vector::Vector(0.3,0.3);
|
|
tmpVec = (GHIDRA_CAST<Vector *>((GHIDRA_CAST<Vector *>((GHIDRA_INT(pvVar8) + 0x10)))))->Vector::Mul(&local_2f8,tmpVec);
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::SetSpriteScale(tmpVec);
|
|
set_field_358(pEVar7,10.0);
|
|
pcVar1 = *(code **)(*GHIDRA_CAST<int *>(pEVar7) + 0x3c);
|
|
uVar28 = (GHIDRA_CAST<Color *>((0x3f000000)))->Color::Color(0,0,0);
|
|
(*pcVar1)(uVar28,0xffffffff,0xff,0,1);
|
|
sprite = GHIDRA_CAST<Sprite *>(local_298.y);
|
|
this = npc;
|
|
}
|
|
spawn_damage_numbers(this);
|
|
update_damage_history(this);
|
|
if ((this->_aiCallFlags & 1) != 0) {
|
|
this->_aiCallPhase = 1;
|
|
Entity_NPC_UpdateAI_dispatch(this);
|
|
this->_aiCallPhase = 0;
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x1000002000000000);
|
|
if (bVar2 != 0) {
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFrame(0xf,0);
|
|
if ((bVar2 != 0) && (1.0 < this->_health)) {
|
|
local_298.y = this->_health - 0.25;
|
|
local_2b8.y = 1.0;
|
|
clampedValue = GHIDRA_CAST<float *>(std)::max<float>();
|
|
this->_health = *clampedValue;
|
|
}
|
|
fVar20 = Math::clamp(0.0,1.0,(this->_health * this->_health) /
|
|
(this->_maxHitPoints * this->_maxHitPoints));
|
|
local_298.y = Math::lerp(0.6,1.0,fVar20,0);
|
|
spriteColor = GHIDRA_CAST<Color *>((GHIDRA_CAST<Sprite *>((sprite)))->Sprite)::Color();
|
|
(GHIDRA_CAST<Color *>((spriteColor)))->Color::SetTint(local_298.y,local_298.y,local_298.y,1.0);
|
|
fVar20 = this->_health / this->_maxHitPoints;
|
|
FUN_00431260();
|
|
fVar20 = Math::clamp(0.0,1.0,fVar20);
|
|
local_298.y = Math::lerp(0.6,1.1,fVar20,0);
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&g_vectorOne)))->Vector::__mul(&local_54,&local_298.y);
|
|
(GHIDRA_CAST<Sprite *>((sprite)))->Sprite::SetScale(tmpVec);
|
|
local_29c = GHIDRA_CAST<Room *>(0x0);
|
|
local_288 = GHIDRA_CAST<Room *>(0x0);
|
|
local_298.x = 0.0;
|
|
local_298.y = 0.0;
|
|
::(GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>(local_4c))))->EntityRef::EntityRef();
|
|
msvc::iterator_copy(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8))),&local_2a4);
|
|
uVar28 = FUN_00456190(&local_2b8.y);
|
|
cVar3 = FUN_0042c710(uVar28);
|
|
if (cVar3 == '\0') {
|
|
local_2a0 = GHIDRA_CAST<ANM2 *>(local_298.y);
|
|
local_290 = GHIDRA_CAST<Entity *>(local_298.x);
|
|
}
|
|
else {
|
|
local_2a0 = GHIDRA_CAST<ANM2 *>(local_298.y);
|
|
local_290 = GHIDRA_CAST<Entity *>(local_298.x);
|
|
do {
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(EntityPtr)::Ref();
|
|
pEVar7 = GHIDRA_CAST<Entity *>(entitySlot[2]);
|
|
if ((GHIDRA_UINT(pEVar7) & 0x282) == 0) {
|
|
if ((GHIDRA_UINT(pEVar7) & 0x286) != 0) {
|
|
local_2a0 = GHIDRA_CAST<ANM2 *>(entitySlot[3]);
|
|
local_29c = GHIDRA_CAST<Room *>(0x40a00000);
|
|
local_290 = pEVar7;
|
|
::(GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>(local_4c))))->EntityRef::operator_(GHIDRA_CAST<EntityRef *>((entitySlot + 4)));
|
|
break;
|
|
}
|
|
if ((float)local_288 < (float)*entitySlot) {
|
|
local_2a0 = GHIDRA_CAST<ANM2 *>(entitySlot[3]);
|
|
local_29c = GHIDRA_CAST<Room *>(0x3f800000);
|
|
local_290 = pEVar7;
|
|
local_288 = GHIDRA_CAST<Room *>(*entitySlot);
|
|
::(GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>(local_4c))))->EntityRef::operator_(GHIDRA_CAST<EntityRef *>((entitySlot + 4)));
|
|
}
|
|
}
|
|
FUN_00456170(&local_298.y,0);
|
|
uVar28 = FUN_00456190(&local_2b8.y);
|
|
cVar3 = FUN_0042c710(uVar28);
|
|
} while (cVar3 != '\0');
|
|
sprite = GHIDRA_CAST<Sprite *>(&this->_sprite);
|
|
}
|
|
FUN_00456400();
|
|
if (0.0 < (float)local_29c) {
|
|
this->TakeDamage(local_29c,local_290,local_2a0,local_4c,0);
|
|
}
|
|
}
|
|
local_298.y = this->_health;
|
|
if (this->_type == 0x3c5) {
|
|
update_physics(this);
|
|
}
|
|
else {
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::Update();
|
|
}
|
|
local_2b8.y = 0.0;
|
|
local_298.y = (float)(local_298.y - this->_health);
|
|
clampedValue = GHIDRA_CAST<float *>(std)::max<float>();
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>((*clampedValue + this->_totalDamageTaken));
|
|
this->_totalDamageTaken = (float)pEVar9;
|
|
if ((this->_aiCallFlags & 8) != 0) {
|
|
this->_aiCallPhase = 4;
|
|
Entity_NPC_UpdateAI_dispatch(this);
|
|
this->_aiCallPhase = 0;
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0xf);
|
|
if (bVar2 != 0) {
|
|
pcVar1 = *(code **)(*GHIDRA_CAST<int *>(this) + 0x3c);
|
|
uVar28 = (GHIDRA_CAST<Color *>((0)))->Color::Color(0,0,0);
|
|
(*pcVar1)(uVar28,0xffffffff,0xff,0,1);
|
|
tmpColor = GHIDRA_CAST<ColorMod *>((GHIDRA_CAST<Color *>((0)))->Color)::Color(0,0,0);
|
|
sprite = GHIDRA_CAST<Sprite *>(&this->_sprite);
|
|
(GHIDRA_CAST<Sprite *>((sprite)))->Sprite::SetColor(tmpColor);
|
|
this->_shadowSize = 0.0;
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(4);
|
|
if ((bVar2 != 0) || (bVar2 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(6), bVar2 != 0)) {
|
|
local_298.y = (float)&this->_pos;
|
|
iVar16 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::FrameCount();
|
|
if (iVar16 < 2) {
|
|
Isaac::GetRenderPosition(&local_2d0,GHIDRA_CAST<Vector *>(local_298.y),1);
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
tmpVec = GHIDRA_CAST<Vector *>((GHIDRA_CAST<Room *>((pRVar10)))->Room)::GetRenderSurfaceTopLeft();
|
|
(GHIDRA_CAST<Vector *>((&local_2d0)))->Vector::operator__(tmpVec);
|
|
(GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level::GetCurrentRoom();
|
|
FUN_004177e0(&local_2e0);
|
|
local_14 = 0xd;
|
|
piVar14 = GHIDRA_CAST<int *>(EntityPtr)::Ref();
|
|
pcVar1 = *(code **)(*piVar14 + 0x2c);
|
|
uVar28 = __ftoui3();
|
|
uVar28 = __ftoui3(uVar28);
|
|
(*pcVar1)(&local_38,uVar28);
|
|
local_14 = 0xffffffff;
|
|
FUN_0041c710();
|
|
this = npc;
|
|
tmpColor = &npc->_floorColor;
|
|
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>(tmpColor))))->KColor::FromRGBA255(0,0,0,0xff);
|
|
Font::SetLineHeightModifier(GHIDRA_CAST<Font *>(tmpColor),0.7);
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>((local_38._red * 0.9));
|
|
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(tmpColor))))->Color::SetOffset((float)pEVar9,local_38._green * 0.9,local_38._blue * 0.9);
|
|
sprite = GHIDRA_CAST<Sprite *>(&this->_sprite);
|
|
(GHIDRA_CAST<Sprite *>((sprite)))->Sprite::SetColor(tmpColor);
|
|
}
|
|
iVar16 = (GHIDRA_CAST<Game *>((g_game)))->Game::GetFrameCount();
|
|
if (GHIDRA_UINT((iVar16 + this->_index)) % 0x1e < 2) {
|
|
Isaac::GetRenderPosition(&local_2d0,&this->_pos,1);
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
tmpVec = GHIDRA_CAST<Vector *>((GHIDRA_CAST<Room *>((pRVar10)))->Room)::GetRenderSurfaceTopLeft();
|
|
(GHIDRA_CAST<Vector *>((&local_2d0)))->Vector::operator__(tmpVec);
|
|
(GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level::GetCurrentRoom();
|
|
FUN_004177e0(&local_2e0);
|
|
local_14 = 0xe;
|
|
piVar14 = GHIDRA_CAST<int *>(EntityPtr)::Ref();
|
|
(**(code **)(*piVar14 + 0x2c))(&local_38,GHIDRA_INT(local_2d0.x),GHIDRA_INT(local_2d0.y));
|
|
local_14 = 0xffffffff;
|
|
FUN_0041c710();
|
|
local_298.y = (GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(&this->_floorColor))))->Color::A();
|
|
fVar20 = Math::lerp(local_298.y,0.7,0.3,0);
|
|
Font::SetLineHeightModifier(GHIDRA_CAST<Font *>(&this->_floorColor),fVar20);
|
|
local_298.y = local_38._blue * 0.9;
|
|
fVar19 = (long double)Color::BO();
|
|
local_2b8.y = (float)fVar19;
|
|
local_2f0.y = Math::lerp(local_2b8.y,local_298.y,0.5,0);
|
|
local_298.y = local_38._green * 0.9;
|
|
local_2b8.y = (GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(&this->_floorColor))))->Color::GO();
|
|
local_308.y = Math::lerp(local_2b8.y,local_298.y,0.5,0);
|
|
local_298.y = local_38._red * 0.9;
|
|
fVar19 = (long double)Color::RO();
|
|
local_2b8.y = (float)fVar19;
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>(Math)::lerp(local_2b8.y,local_298.y,0.5,0);
|
|
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(&this->_floorColor))))->Color::SetOffset((float)pEVar9,local_308.y,local_2f0.y);
|
|
}
|
|
tmpColor = GHIDRA_CAST<ColorMod *>((GHIDRA_CAST<Sprite *>((sprite)))->Sprite)::Color();
|
|
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(local_a0))))->Color::operator_assign(tmpColor);
|
|
Color::Lerp(GHIDRA_CAST<ColorMod *>(local_cc),GHIDRA_CAST<ColorMod *>(local_a0),&this->_floorColor,0.1);
|
|
spriteColor = GHIDRA_CAST<Color *>((GHIDRA_CAST<Sprite *>((sprite)))->Sprite)::Color();
|
|
fVar20 = (GHIDRA_CAST<Color *>((spriteColor)))->Color::A();
|
|
Font::SetLineHeightModifier(GHIDRA_CAST<Font *>(local_cc),fVar20);
|
|
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(local_cc))))->Color::SetTint(0.02,0.02,0.02,1.0);
|
|
(GHIDRA_CAST<Sprite *>((sprite)))->Sprite::SetColor(GHIDRA_CAST<ColorMod *>(local_cc));
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0x19);
|
|
if (((bVar2 != 0) || (bVar2 = (GHIDRA_CAST<Game *>((g_game)))->Game::GetDebugFlag(9), bVar2 != 0)) &&
|
|
(bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsActiveEnemy(0), bVar2 != 0)) {
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>(((this->_maxHitPoints / 30.0) / 30.0));
|
|
local_28c = pEVar9;
|
|
bVar2 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0x19);
|
|
if (bVar2 != 0) {
|
|
this->_isInvicible = 1;
|
|
}
|
|
iVar16 = this->_type;
|
|
if (iVar16 == 0x104) {
|
|
if (this->_variant != 10) goto LAB_006c9e06;
|
|
LAB_006c9da4:
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>(((float)local_28c * 3.0));
|
|
LAB_006c9db4:
|
|
local_28c = pEVar9;
|
|
}
|
|
else {
|
|
if ((((iVar16 == 0x47) || (iVar16 == 0x48)) ||
|
|
((iVar16 == 0x49 || ((iVar16 == 0x4a || (iVar16 == 0x4b)))))) || (iVar16 == 0x4c))
|
|
goto LAB_006c9da4;
|
|
LAB_006c9e06:
|
|
if (iVar16 == 0x51) {
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetBossID();
|
|
if (iVar16 == 0x18) goto LAB_006c9da4;
|
|
iVar16 = this->_type;
|
|
}
|
|
if ((iVar16 != 0x112) && (iVar16 != 0x113)) {
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetBossID();
|
|
if (iVar16 != 0x37) goto LAB_006c9dbc;
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>(((float)local_28c * 4.0));
|
|
goto LAB_006c9db4;
|
|
}
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>(((float)local_28c * 0.33333));
|
|
local_28c = pEVar9;
|
|
if (this->_isInvicible != 0) {
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>(0x0);
|
|
goto LAB_006c9db4;
|
|
}
|
|
}
|
|
LAB_006c9dbc:
|
|
gridEntity = GHIDRA_CAST<GridEntity *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<GridEntity *>((gridEntity)))->GridEntity::GetVariant();
|
|
if (iVar16 == 0x11) {
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>(((float)local_28c + (float)local_28c));
|
|
LAB_006c9ee0:
|
|
local_28c = pEVar9;
|
|
}
|
|
else {
|
|
gridEntity = GHIDRA_CAST<GridEntity *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<GridEntity *>((gridEntity)))->GridEntity::GetVariant();
|
|
if (iVar16 == 6) {
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>(((float)local_28c * 3.0));
|
|
goto LAB_006c9ee0;
|
|
}
|
|
gridEntity = GHIDRA_CAST<GridEntity *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<GridEntity *>((gridEntity)))->GridEntity::GetVariant();
|
|
if (iVar16 != 5) {
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>(((float)local_28c * 6.0));
|
|
goto LAB_006c9ee0;
|
|
}
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Game *>((g_game)))->Game::GetDebugFlag(9);
|
|
if (bVar2 != 0) {
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>(((float)local_28c * 100.0));
|
|
local_28c = pEVar9;
|
|
}
|
|
cVar3 = this->IsBoss();
|
|
if ((cVar3 == '\0') && (bVar2 = (GHIDRA_CAST<Game *>((g_game)))->Game::GetDebugFlag(9), bVar2 == 0)) {
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetAliveBossesCount();
|
|
if (iVar16 < 1) {
|
|
this->_canShutDoors = 0;
|
|
}
|
|
}
|
|
else {
|
|
iVar16 = this->_type;
|
|
if (((iVar16 == 0x4a) || (iVar16 == 0x4b)) || (iVar16 == 0x4c)) {
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>(this->_health);
|
|
if ((0.0 < (float)pEVar9) || (this->_entityCollisionClass == 0)) goto LAB_006ca08e;
|
|
this->_isInvicible = 0;
|
|
this->_health = 1.0;
|
|
this->_dead = 1;
|
|
}
|
|
else {
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>(this->_health);
|
|
if (0.0 < (float)pEVar9) {
|
|
LAB_006ca08e:
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>(((float)pEVar9 - (float)local_28c));
|
|
this->_health = (float)pEVar9;
|
|
}
|
|
else {
|
|
bVar2 = (GHIDRA_CAST<Game *>((g_game)))->Game::GetDebugFlag(9);
|
|
if ((((bVar2 == 0) && (iVar16 = this->_type, iVar16 != 0x24)) &&
|
|
((iVar16 != 0x106 &&
|
|
((((iVar16 != 0x107 && (iVar16 != 0x4e)) && (iVar16 != 0x47)) &&
|
|
((iVar16 != 0x48 && (iVar16 != 0x49)))))))) &&
|
|
((iVar16 != 0x104 || (this->_variant != 10)))) {
|
|
gridEntity = GHIDRA_CAST<GridEntity *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<GridEntity *>((gridEntity)))->GridEntity::GetVariant();
|
|
if (iVar16 != 0x11) {
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetBossID();
|
|
if (iVar16 != 0x37) {
|
|
if (this->_type == 0x51) {
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
iVar16 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetBossID();
|
|
if (iVar16 == 0x18) goto LAB_006ca02b;
|
|
}
|
|
this->_canShutDoors = 0;
|
|
goto LAB_006ca09e;
|
|
}
|
|
}
|
|
}
|
|
LAB_006ca02b:
|
|
this->_isInvicible = 0;
|
|
pcVar1 = *(code **)(*GHIDRA_CAST<int *>(this) + 0x20);
|
|
sourceRef = ::(GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>(local_4c))))->EntityRef::EntityRef();
|
|
(*pcVar1)(0x3f800000,0,0,sourceRef,0x1e);
|
|
this->_dead = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
LAB_006ca09e:
|
|
FUN_006d6650();
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFlying();
|
|
if ((bVar2 == 0) && (this->_visible != 0)) {
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsActiveEnemy(0);
|
|
if (bVar2 != 0) {
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>((GHIDRA_CAST<Vector *>((&this->_velocity)))->Vector)::LengthSquared();
|
|
local_298.y = (float)pEVar9;
|
|
if (1.0 < (float)pEVar9) {
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
cVar3 = (GHIDRA_CAST<Room *>((pRVar10)))->Room::HasWater();
|
|
if (((cVar3 != '\0') && (bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFrame(7,this->_index), bVar2 != 0)
|
|
) && (this->_entityCollisionClass != 0)) {
|
|
uVar4 = Random();
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&this->_pos)))->Vector::__add(&local_54,&this->_velocity);
|
|
uVar33 = 0;
|
|
pTVar30 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor;
|
|
pTVar29 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor;
|
|
uVar28 = 0;
|
|
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,99,tmpVec,&g_vectorZero,GHIDRA_CAST<Entity *>(this),0,uVar4);
|
|
pEVar7 = GHIDRA_CAST<Entity *>(__RTDynamicCast(pEVar7,uVar28,pTVar29,pTVar30,uVar33));
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>((this->_size * 0.05 * this->_scale));
|
|
local_298.y = (float)pEVar9;
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&g_vectorOne)))->Vector::__mul(&local_2f8,&local_298.y);
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::SetSpriteScale(tmpVec);
|
|
set_field_358(pEVar7,-10.0);
|
|
local_298.y = 0.5;
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&this->_velocity)))->Vector::__mul(GHIDRA_CAST<Vector *>((local_318 + 8)),&local_298.y);
|
|
(GHIDRA_CAST<Entity *>((pEVar7)))->Entity::SetVelocity(tmpVec);
|
|
pEVar7->Update();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
tmpVec = &this->_pos;
|
|
local_2b8.y = (float)tmpVec;
|
|
(GHIDRA_CAST<Vector *>((&this->_pausePosition)))->Vector::operator_assign(tmpVec);
|
|
if (this->_isBestiaryEncountered == 0) {
|
|
entityList = GHIDRA_CAST<PersistentGameData *>((GHIDRA_CAST<Room *>((GHIDRA_CAST<Room *>(g_manager))))->Room)::GetTopLeftPos();
|
|
PersistentGameData::TryAddBestiaryEncounter(entityList,this->_type,this->_variant);
|
|
this->_isBestiaryEncountered = 1;
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFrame(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this->_config) + 0xd0)) * 2,this->_index);
|
|
if (bVar2 == 0) {
|
|
if ((this->_type == 0x322) && (this->_state == 8)) {
|
|
animState = GHIDRA_CAST<AnimationState *>(Config)::GetPillEffects();
|
|
bVar2 = AnimationState::IsLoopingAnimation(animState);
|
|
if ((bVar2 != 0) && (bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFrame(3,this->_index), bVar2 != 0))
|
|
goto LAB_006ca297;
|
|
}
|
|
}
|
|
else {
|
|
LAB_006ca297:
|
|
(GHIDRA_CAST<msvc::vector *>((&this->_hitList)))->msvc::vector::clear(0);
|
|
}
|
|
iVar16 = this->_type;
|
|
if (iVar16 == 0x38a) {
|
|
Hornfel_UpdateFrame(this);
|
|
iVar16 = this->_type;
|
|
}
|
|
if (iVar16 == 0x38b) {
|
|
if (this->_state == 1) {
|
|
(GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level::GetCurrentRoom();
|
|
camera = GHIDRA_CAST<Camera *>(FUN_00428a70());
|
|
(GHIDRA_CAST<Camera *>((camera)))->Camera::SetFocusPosition(tmpVec);
|
|
iVar16 = this->_type;
|
|
goto LAB_006ca2e9;
|
|
}
|
|
}
|
|
else {
|
|
LAB_006ca2e9:
|
|
if (((iVar16 == 0x5c) &&
|
|
((GHIDRA_CAST<Vector *>((&this->_targetPosition)))->Vector::operator_assign(&g_vectorZero), this->_variant == 1)) &&
|
|
((GHIDRA_CAST<Entity *>(this->_entityRef) != GHIDRA_CAST<Entity *>(0x0) &&
|
|
(bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this->_entityRef))))->Entity::IsEnemy(), bVar2 != 0)))) {
|
|
pEVar7 = GHIDRA_CAST<Entity *>(this->_entityRef);
|
|
tmpVec = (GHIDRA_CAST<Entity *>((pEVar7)))->Entity::Position(&local_54);
|
|
tmpVec = (GHIDRA_CAST<Vector *>((tmpVec)))->Vector::__sub(&local_2f8,&this->_pos);
|
|
(GHIDRA_CAST<Vector *>((&this->_targetPosition)))->Vector::operator_assign(tmpVec);
|
|
tmpVec = (GHIDRA_CAST<Vector *>((&this->_targetPosition)))->Vector::__unm(GHIDRA_CAST<Vector *>((local_318 + 8)));
|
|
(GHIDRA_CAST<Vector *>((&pEVar7->_targetPosition)))->Vector::operator_assign(tmpVec);
|
|
}
|
|
}
|
|
if (this->_type == 0x19b) {
|
|
bVar2 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::IsEventTriggered(&DAT_00b1d534);
|
|
if (bVar2 != 0) {
|
|
(GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level::GetCurrentRoom();
|
|
FUN_00407470();
|
|
if (0.2 < (float)pEVar9) {
|
|
(GHIDRA_CAST<Vector *>((&local_2e8)))->Vector::Vector(this->_size,this->_size * 0.65);
|
|
iVar16 = Isaac::Random(10);
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>((iVar16 + 0xc));
|
|
local_298.y = (float)pEVar9;
|
|
if (0 < GHIDRA_INT(pEVar9)) {
|
|
do {
|
|
tmpVec = MusicManager::RandomVector(&local_54);
|
|
(GHIDRA_CAST<Vector *>((&local_2e8)))->Vector::Mul(&local_2d0,tmpVec);
|
|
fVar20 = random_float();
|
|
local_298.y = fVar20 * 5.0 + 3.0;
|
|
tmpVec = Vector::operator_mul(&local_2f8,&local_298.y,&local_2d0);
|
|
(GHIDRA_CAST<Vector *>((tmpVec)))->Vector::__div(&local_2e0,&local_2e8.x);
|
|
uVar4 = Random();
|
|
tmpVec = (GHIDRA_CAST<Vector *>((GHIDRA_CAST<Vector *>(local_2b8.y))))->Vector::__add(GHIDRA_CAST<Vector *>((local_318 + 8)),&local_2d0);
|
|
projectile = (Entity_Projectile *)
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,99,tmpVec,&local_2e0,GHIDRA_CAST<Entity *>(0x0),1,uVar4);
|
|
tmpVec = GHIDRA_CAST<Vector *>((GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(projectile))))->Entity)::SpriteScale();
|
|
local_2f0.y = 2.0;
|
|
tmpVec = (GHIDRA_CAST<Vector *>((tmpVec)))->Vector::__mul(&local_334,&local_2f0.y);
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(projectile))))->Entity::SetSpriteScale(tmpVec);
|
|
fVar20 = random_float();
|
|
FUN_00444c70(-4.0 - fVar20 * 8.0);
|
|
(GHIDRA_CAST<Entity_Projectile *>((projectile)))->Entity_Projectile::set_falling_accel(1.5);
|
|
projectile->Update();
|
|
pEVar9 = GHIDRA_CAST<Entity_Effect *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(pEVar9[-1])) + 0x4bf))));
|
|
} while (pEVar9 != GHIDRA_CAST<Entity_Effect *>(0x0));
|
|
this = npc;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (this->_dead != 0) {
|
|
if ((((isDeadBefore == 0) && (cVar3 = this->IsBoss(), cVar3 == '\0')) &&
|
|
(*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this->_config) + 0x2c)) == '\0')) &&
|
|
(bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x4000000000000), bVar2 != 0)) {
|
|
(GHIDRA_CAST<Entity_Pickup *>((GHIDRA_CAST<Entity_Pickup *>(this))))->Entity_Pickup::Update();
|
|
uVar4 = 0;
|
|
iVar16 = (GHIDRA_CAST<Game *>((g_game)))->Game::GetNumPlayers();
|
|
if (iVar16 != 0) {
|
|
do {
|
|
player = (GHIDRA_CAST<Game *>((g_game)))->Game::GetPlayer(uVar4);
|
|
(GHIDRA_CAST<Entity_Player *>((player)))->Entity_Player::trigger_npc_death(GHIDRA_CAST<Entity *>(this));
|
|
uVar4 = uVar4 + 1;
|
|
uVar13 = (GHIDRA_CAST<Game *>((g_game)))->Game::GetNumPlayers();
|
|
} while (uVar4 < uVar13);
|
|
}
|
|
FUN_006d5350();
|
|
FUN_0042c770(&local_2a4);
|
|
pvVar8 = msvc::iterator_copy(&this->_entityPtrReferrers,&local_298.y);
|
|
cVar3 = FUN_0042c710(pvVar8);
|
|
while (cVar3 != '\0') {
|
|
entitySlot = GHIDRA_CAST<uint32_t *>(FUN_005cba30());
|
|
*GHIDRA_CAST<uint32_t *>(*entitySlot) = 0;
|
|
set_iterator_post_increment(&local_2a4,&local_2b8.y,0);
|
|
pvVar8 = msvc::iterator_copy(&this->_entityPtrReferrers,&local_298.y);
|
|
cVar3 = FUN_0042c710(pvVar8);
|
|
}
|
|
msvc::set::clear();
|
|
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::Stop();
|
|
FUN_0040a9c0();
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::RemoveStatusEffects();
|
|
ANM2::Reset(&this->_statusEffectSprite);
|
|
this->SetCollisionDamage(0);
|
|
this->_entityCollisionClass = 4;
|
|
if ((this->_entityGridCollisionClass < 3) || (this->_entityGridCollisionClass == 7)) {
|
|
this->_entityGridCollisionClass = 3;
|
|
}
|
|
pRVar10 = GHIDRA_CAST<Room *>((GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level)::GetCurrentRoom();
|
|
tmpVec = (GHIDRA_CAST<Room *>((pRVar10)))->Room::GetClampedPosition(&local_54,&this->_pos,0.0);
|
|
(GHIDRA_CAST<Vector *>((&this->_pos)))->Vector::operator_assign(tmpVec);
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this->_config) + 0x48)) < 1) {
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::SetSize(this->_size,this->_sizeMulti,8);
|
|
}
|
|
this->_mass = 1000.0;
|
|
this->_dead = 0;
|
|
this->_canShutDoors = 0;
|
|
this->_isBoss = 0;
|
|
this->_isInvicible = 1;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::AddEntityFlags(0x2000000010011);
|
|
this->_health = 10.0;
|
|
this->_maxHitPoints = 10.0;
|
|
if (((this->_type == 0x322) && (GHIDRA_CAST<Entity *>(this->_parent) != GHIDRA_CAST<Entity *>(0x0))) &&
|
|
(bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this->_parent))))->Entity::IsFamiliar(), bVar2 != 0)) {
|
|
FUN_0062e0e0(this);
|
|
}
|
|
this->_spawnerType = 0;
|
|
this->_spawnerVariant = 0;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::SetSpawnerEntity(GHIDRA_CAST<Entity *>(0x0));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::SetParent(GHIDRA_CAST<Entity *>(0x0));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::SetChild(GHIDRA_CAST<Entity *>(0x0));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::SetTarget(GHIDRA_CAST<Entity *>(0x0));
|
|
this->_stateFrame = this->_type;
|
|
this->_type = 0x3c3;
|
|
this->ResetColor();
|
|
pcVar1 = *(code **)(*GHIDRA_CAST<int *>(this) + 0x3c);
|
|
uVar28 = (GHIDRA_CAST<Color *>((0x3f800000)))->Color::Color(0x3f800000,0x3f800000,0x3f800000,0x3f000000,0x3f4ccccd,
|
|
0x3f800000,0x3f99999a);
|
|
(*pcVar1)(uVar28,6,1,1,1);
|
|
}
|
|
if (this->_dead != 0) goto LAB_006ca82b;
|
|
}
|
|
if (this->_state != 0x12) {
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::ClearEntityFlags(0x80000000000000);
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::ClearEntityFlags(0x400000);
|
|
}
|
|
LAB_006ca82b:
|
|
iVar16 = this->_forcedTargetTimer;
|
|
if (iVar16 < 1) {
|
|
if (iVar16 < 0) {
|
|
this->_forcedTargetTimer = iVar16 + 1;
|
|
}
|
|
}
|
|
else {
|
|
this->_forcedTargetTimer = iVar16 + -1;
|
|
if (iVar16 + -1 == 0) {
|
|
cVar3 = this->IsBoss();
|
|
if (cVar3 != '\0') {
|
|
this->_forcedTargetTimer = -0x96;
|
|
}
|
|
(GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<EntityPtr *>(&this->_forcedTarget))))->EntityPtr::SetReference(GHIDRA_CAST<Entity *>(0x0));
|
|
}
|
|
}
|
|
ExceptionList = local_1c;
|
|
return;
|
|
}
|
|
|
|
// 006ca930
|
|
void Entity_NPC::update_frozen()
|
|
{
|
|
BitSet128 flags;
|
|
uint32_t rngResult;
|
|
Entity *effect;
|
|
LayerState *layer;
|
|
Vector *clampedPos;
|
|
Entity_Tear *iceTear;
|
|
int damageEvent;
|
|
float fVar1;
|
|
float particleScale;
|
|
uint8_t auStack_78 [12];
|
|
Vector VStack_6c;
|
|
int shardIdx;
|
|
float angleRad;
|
|
float fStack_5c;
|
|
Vector VStack_58;
|
|
uint32_t uStack_50;
|
|
uint32_t uStack_4c;
|
|
uint32_t uStack_48;
|
|
uint32_t sourceRef;
|
|
uint32_t local_3c;
|
|
uint32_t local_38;
|
|
uint32_t local_34;
|
|
float local_30;
|
|
float local_2c;
|
|
float local_28;
|
|
float local_24;
|
|
uint32_t local_20;
|
|
uint32_t local_1c;
|
|
float fStack_18;
|
|
uint32_t local_14;
|
|
|
|
local_14 = __security_cookie ^ GHIDRA_UINT(auStack_78);
|
|
this->_friction = this->_friction * 0.5;
|
|
damageEvent = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8))));
|
|
if (damageEvent != *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc))))) {
|
|
do {
|
|
if (this->_dead != 0) break;
|
|
if ((*GHIDRA_CAST<uint32_t *>((damageEvent + 8)) & 0x1000004) == 0) {
|
|
fVar1 = this->_health - 1.0;
|
|
this->_health = fVar1;
|
|
if (fVar1 <= 0.0) goto LAB_006ca9aa;
|
|
}
|
|
else {
|
|
LAB_006ca9aa:
|
|
local_30 = g_vectorZero.x;
|
|
local_28 = g_vectorZero.x;
|
|
local_2c = g_vectorZero.y;
|
|
local_24 = g_vectorZero.y;
|
|
sourceRef = 0;
|
|
local_3c = 0;
|
|
local_38 = 0;
|
|
local_34 = 0;
|
|
local_20 = 0;
|
|
local_1c = 0;
|
|
this->Kill(&sourceRef);
|
|
}
|
|
damageEvent = damageEvent + 0x38;
|
|
} while (damageEvent != *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc)))));
|
|
}
|
|
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc)))) = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8))));
|
|
this->_pendingDamage = 0.0;
|
|
*GHIDRA_CAST<uint32_t *>(&this->_pendingDamageFlags) = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_pendingDamageFlags) + 4)) = 0;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::Update();
|
|
if ((this->_flags & 0x800000000000) != 0) {
|
|
rngResult = Random();
|
|
if ((rngResult & 1) == 0) {
|
|
rngResult = Random();
|
|
effect = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0x36,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,rngResult,0)
|
|
;
|
|
rngResult = Random();
|
|
damageEvent = *GHIDRA_CAST<int *>(effect);
|
|
particleScale =
|
|
(float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) *
|
|
2.3283064e-10 * 0.5 + 0.2;
|
|
fVar1 = particleScale * g_vectorOne.x;
|
|
(effect->_sprite)._scale.y = particleScale * g_vectorOne.y;
|
|
(effect->_sprite)._scale.x = fVar1;
|
|
(**(code **)(damageEvent + 0xc))();
|
|
}
|
|
rngResult = Random();
|
|
VStack_6c.x = (this->_velocity).x * 0.14;
|
|
VStack_6c.y = (this->_velocity).y * 0.14;
|
|
effect = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0x3b,&this->_pos,&VStack_6c,GHIDRA_CAST<Entity *>(0x0),0,rngResult,0);
|
|
rngResult = Random();
|
|
*GHIDRA_CAST<float *>((effect[1]._sprite._animDefaultName._buf + 4)) =
|
|
(float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) *
|
|
2.3283064e-10 * 10.0 + 2.0;
|
|
rngResult = Random();
|
|
local_20 = 0x3f4ccccd;
|
|
local_1c = 0x3f666666;
|
|
damageEvent = rngResult % 0xf + 0xf;
|
|
fStack_18 = 1.0;
|
|
*GHIDRA_CAST<int *>((effect[1]._sprite._filename._buf + 4)) = damageEvent;
|
|
*GHIDRA_CAST<int *>((effect[1]._sprite._filename._buf + 8)) = damageEvent;
|
|
(effect->_posOffset).x = (this->_posOffset).x;
|
|
(effect->_posOffset).y = (this->_posOffset).y;
|
|
layer = ANM2::GetLayer(&effect->_sprite,GHIDRA_CAST<uint8_t *>(0x0));
|
|
if (&layer->_color != GHIDRA_CAST<ColorMod *>(&sourceRef)) {
|
|
(layer->_color)._tint[0] = 1.0;
|
|
(layer->_color)._tint[1] = 1.0;
|
|
(layer->_color)._tint[2] = 1.0;
|
|
(layer->_color)._tint[3] = 0.4;
|
|
(layer->_color)._colorize[0] = 0.0;
|
|
(layer->_color)._colorize[1] = 0.0;
|
|
(layer->_color)._colorize[2] = 0.0;
|
|
(layer->_color)._colorize[3] = 0.0;
|
|
*GHIDRA_CAST<uint64_t *>((layer->_color)._offset) = CONCAT44(local_1c,local_20);
|
|
(layer->_color)._offset[2] = fStack_18;
|
|
}
|
|
if (this->_collidesWithGrid != 0) {
|
|
VStack_6c.x = (this->_pos).x - (this->_gridCollisionVelocity).x;
|
|
VStack_6c.y = (this->_pos).y - (this->_gridCollisionVelocity).y;
|
|
clampedPos = Room::GetClampedPositionImpl(g_game->_room,&VStack_58,&VStack_6c,4.0,4.0,4.0,4.0)
|
|
;
|
|
sourceRef = 0;
|
|
local_3c = 0;
|
|
local_38 = 0;
|
|
(this->_pos).x = clampedPos->x;
|
|
(this->_pos).y = clampedPos->y;
|
|
local_30 = g_vectorZero.x;
|
|
local_28 = g_vectorZero.x;
|
|
local_2c = g_vectorZero.y;
|
|
local_24 = g_vectorZero.y;
|
|
local_34 = 0;
|
|
local_20 = 0;
|
|
local_1c = 0;
|
|
this->Kill(&sourceRef);
|
|
}
|
|
}
|
|
if (this->_dead != 0) {
|
|
trigger_kill_item_effects(this);
|
|
fStack_5c = (float)g_game->_stage + 7.0;
|
|
rngResult = Random();
|
|
shardIdx = 0;
|
|
VStack_6c.x = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]
|
|
) * 2.3283064e-10 * 360.0;
|
|
do {
|
|
angleRad = ((float)shardIdx * 36.0 + VStack_6c.x) * 0.017453292;
|
|
VStack_58.x = cos(angleRad);
|
|
VStack_58.x = VStack_58.x * 16.0;
|
|
VStack_58.y = sin(angleRad);
|
|
VStack_58.y = VStack_58.y * 16.0;
|
|
rngResult = Random();
|
|
iceTear = (Entity_Tear *)
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(2,0x29,&this->_pos,&VStack_58,GHIDRA_CAST<Entity *>(0x0),0,rngResult,0);
|
|
iceTear->SetCollisionDamage(fStack_5c);
|
|
uStack_50 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(g_tearFlagIce._l)) + 0x4))) | (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(g_tearFlagSlow._l)) + 0x4)));
|
|
VStack_58.y = (float)(GHIDRA_UINT(g_tearFlagIce._l) | GHIDRA_UINT(g_tearFlagSlow._l));
|
|
uStack_48 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(g_tearFlagIce._h)) + 0x4))) | (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(g_tearFlagSlow._h)) + 0x4)));
|
|
uStack_4c = GHIDRA_UINT(g_tearFlagIce._h) | GHIDRA_UINT(g_tearFlagSlow._h);
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(flags._l)) + 0x4))) = uStack_50;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(flags._l)) + 0x0))) = VStack_58.y;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(flags._h)) + 0x0))) = uStack_4c;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(flags._h)) + 0x4))) = uStack_48;
|
|
(GHIDRA_CAST<Entity_Tear *>((iceTear)))->Entity_Tear::SetTearFlags(flags);
|
|
iceTear->_fallingAccel = 0.2;
|
|
iceTear->_spawnerType = 1;
|
|
iceTear->Update();
|
|
shardIdx = shardIdx + 1;
|
|
} while (shardIdx < 10);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006cb2a0
|
|
void Entity_NPC::fire_projectile_from_params(Entity_Projectile *projectile)
|
|
{
|
|
int championColor;
|
|
|
|
if (this->_isChampion == 0) {
|
|
championColor = -1;
|
|
}
|
|
else {
|
|
championColor = this->_championColorIdx;
|
|
}
|
|
Entity_Projectile::apply_spawn_flags
|
|
(projectile,championColor,this->_scale,this->_flags,GHIDRA_CAST<Entity *>(this));
|
|
return;
|
|
}
|
|
|
|
// 006d0300
|
|
void Entity_NPC::SetBossColorIdx(int bossColorIdx, int unused)
|
|
{
|
|
uint8_t isAnimSet;
|
|
std_string *anim;
|
|
|
|
if (this->_bosscoloridx != bossColorIdx) {
|
|
this->_bosscoloridx = bossColorIdx;
|
|
load_graphics(this,1);
|
|
anim = &(this->_sprite)._animDefaultName;
|
|
if (0xf < (this->_sprite)._animDefaultName._capacity) {
|
|
anim = *GHIDRA_CAST<std_string **>(anim->_buf);
|
|
}
|
|
isAnimSet = ANM2::SetAnimation(&this->_sprite,GHIDRA_CAST<uint8_t *>(anim),1);
|
|
if ((isAnimSet != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) {
|
|
AnimationState::SetFrameFloat(&(this->_sprite)._animState,0.0);
|
|
if ((this->_sprite)._animState._animData != (void *)0x0) {
|
|
(this->_sprite)._animState._isPlaying = 0;
|
|
}
|
|
}
|
|
}
|
|
this->ResetColor();
|
|
return;
|
|
}
|
|
|
|
// 006d03e0
|
|
void Entity_NPC::MakeChampion(uint32_t seed, int championColor, uint8_t isInit)
|
|
{
|
|
code *pcVar1;
|
|
uint32_t extraout_EAX;
|
|
Entity *spawnedChild;
|
|
uint32_t colorArg;
|
|
float *clampedMaxHp;
|
|
int iVar2;
|
|
uint32_t uVar3;
|
|
float scaleX;
|
|
float fVar4;
|
|
float oldMaxHpCopy;
|
|
Entity *local_40;
|
|
Entity *local_3c;
|
|
uint8_t local_38 [24];
|
|
uint8_t local_20 [8];
|
|
float afStack_18 [3];
|
|
uint32_t local_c;
|
|
uint8_t auStack_8 [4];
|
|
float *maxHp;
|
|
float oldMaxHp;
|
|
uint32_t *parentRef;
|
|
|
|
local_c = __security_cookie ^ GHIDRA_UINT((auStack_8 + 4));
|
|
if ((this->_isChampion != 0) && (isInit == 0)) {
|
|
return;
|
|
}
|
|
oldMaxHp = this->_maxHitPoints;
|
|
maxHp = &this->_maxHitPoints;
|
|
afStack_18[0] = 7.00649e-45;
|
|
afStack_18[1] = 4.2039e-45;
|
|
local_3c = GHIDRA_CAST<Entity *>(0x15);
|
|
afStack_18[2] = 2.94273e-44;
|
|
*maxHp = oldMaxHp + oldMaxHp;
|
|
oldMaxHpCopy = oldMaxHp;
|
|
this->ResetColor();
|
|
if (0.0 < this->_collisionDamage) {
|
|
this->_collisionDamage = 2.0;
|
|
}
|
|
this->_isChampion = 1;
|
|
this->_championColorIdx = championColor;
|
|
if (championColor < 0) {
|
|
if (seed == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
|
|
pcVar1 = (code *)swi(3);
|
|
(*pcVar1)();
|
|
return;
|
|
}
|
|
uVar3 = seed >> ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(afStack_18[0])) + 0x0))) & 0x1f) ^ seed;
|
|
uVar3 = uVar3 << ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(afStack_18[1])) + 0x0))) & 0x1f) ^ uVar3;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_20)) + 0x4))) = uVar3 >> ((uint8_t)local_3c & 0x1f) ^ uVar3;
|
|
fVar4 = (float)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((double)GHIDRA_INT(local_20))) + 0x4))) +
|
|
__uint_to_double_fixup[-((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_INT(local_20))) + 0x4))) >> 0x1f)]) * 2.3283062e-10;
|
|
if ((0.01 <= fVar4) || (g_game->_stage < 5)) {
|
|
if ((0.05 <= fVar4) || (g_game->_stage < 5)) {
|
|
if (0.15 <= fVar4) {
|
|
if (0.3 <= fVar4) {
|
|
if ((0.35 <= fVar4) || (g_game->_stage < 5)) {
|
|
if (g_game->_stage < 3) {
|
|
uVar3 = (GHIDRA_CAST<RNG *>((GHIDRA_CAST<RNG *>((local_20 + 4)))))->RNG::RandomInt(6);
|
|
championColor = *GHIDRA_CAST<int *>((&DAT_00b673c4 + uVar3 * 4));
|
|
}
|
|
else {
|
|
uVar3 = (GHIDRA_CAST<RNG *>((GHIDRA_CAST<RNG *>((local_20 + 4)))))->RNG::RandomInt(7);
|
|
championColor = *GHIDRA_CAST<int *>((&DAT_00b673dc + uVar3 * 4));
|
|
}
|
|
}
|
|
else {
|
|
uVar3 = (GHIDRA_CAST<RNG *>((GHIDRA_CAST<RNG *>((local_20 + 4)))))->RNG::RandomInt(4);
|
|
championColor = *GHIDRA_CAST<int *>((&DAT_00b67380 + uVar3 * 4));
|
|
}
|
|
}
|
|
else {
|
|
uVar3 = (GHIDRA_CAST<RNG *>((GHIDRA_CAST<RNG *>((local_20 + 4)))))->RNG::RandomInt(GHIDRA_UINT((2 < g_game->_stage)) * 2 + 4);
|
|
championColor = *GHIDRA_CAST<int *>((&DAT_00b67390 + uVar3 * 4));
|
|
}
|
|
}
|
|
else {
|
|
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_20)) + 0x4))) == 0.0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
|
|
pcVar1 = (code *)swi(3);
|
|
(*pcVar1)();
|
|
return;
|
|
}
|
|
uVar3 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(local_20))) + 0x4))) >> ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(afStack_18[0])) + 0x0))) & 0x1f) ^ (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_20)) + 0x4)));
|
|
uVar3 = uVar3 << ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(afStack_18[1])) + 0x0))) & 0x1f) ^ uVar3;
|
|
championColor =
|
|
*GHIDRA_CAST<int *>((&DAT_00b673a8 + ((uVar3 >> ((uint8_t)local_3c & 0x1f) ^ uVar3) % 3) * 4));
|
|
}
|
|
}
|
|
else {
|
|
uVar3 = (GHIDRA_CAST<RNG *>((GHIDRA_CAST<RNG *>((local_20 + 4)))))->RNG::RandomInt(4);
|
|
championColor = *GHIDRA_CAST<int *>((&DAT_00b673b4 + uVar3 * 4));
|
|
}
|
|
}
|
|
else {
|
|
championColor = 0x19;
|
|
if (fVar4 < 0.005) {
|
|
championColor = 6;
|
|
}
|
|
}
|
|
}
|
|
if ((championColor == 0xc) &&
|
|
((((iVar2 = this->_type, iVar2 == 0xf0 || (iVar2 == 0xf2)) || (iVar2 == 0xf1)) ||
|
|
(iVar2 == 0x130)))) {
|
|
championColor = 0;
|
|
LAB_006d0647:
|
|
fVar4 = 1.15;
|
|
this->_championColorIdx = championColor;
|
|
if (championColor == 0x12) {
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::SetSize(this->_size * 0.5,this->_sizeMulti,
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this->_config) + 0x48)));
|
|
fVar4 = 0.5;
|
|
}
|
|
else if (championColor == 0x13) {
|
|
fVar4 = 1.5;
|
|
}
|
|
}
|
|
else {
|
|
if ((championColor == 6) && (this->_type == 0x379)) {
|
|
championColor = 0x11;
|
|
goto LAB_006d0647;
|
|
}
|
|
if (championColor < 1) {
|
|
championColor = 0;
|
|
}
|
|
if (championColor < 0x19) goto LAB_006d0647;
|
|
fVar4 = 1.15;
|
|
this->_championColorIdx = 0x19;
|
|
}
|
|
this->_scale = fVar4;
|
|
fVar4 = fVar4 * this->_shrinkStatus1;
|
|
scaleX = fVar4 * g_vectorOne.x;
|
|
(this->_sprite)._scale.y = fVar4 * g_vectorOne.y;
|
|
(this->_sprite)._scale.x = scaleX;
|
|
load_graphics(this,0);
|
|
switch(this->_championColorIdx) {
|
|
case 0:
|
|
*maxHp = *maxHp * 1.333;
|
|
break;
|
|
case 1:
|
|
this->_championSpeed = 1.333;
|
|
*maxHp = *maxHp * 0.75;
|
|
break;
|
|
case 7:
|
|
*maxHp = *maxHp * 0.333;
|
|
case 4:
|
|
this->_championSpeed = 0.8;
|
|
break;
|
|
case 8:
|
|
this->_entityGridCollisionClass = 3;
|
|
break;
|
|
case 9:
|
|
uVar3 = Random();
|
|
this->_flickerTimer = uVar3 % 0x1e + 0x3c;
|
|
break;
|
|
case 10:
|
|
uVar3 = Random();
|
|
this->_championTimer = uVar3 % 0x14 + 0x28;
|
|
break;
|
|
case 0xb:
|
|
uVar3 = Random();
|
|
spawnedChild = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x39,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(this),0,uVar3);
|
|
parentRef = &spawnedChild->_parent;
|
|
if (spawnedChild->_parent != 0) {
|
|
local_3c = GHIDRA_CAST<Entity *>(parentRef);
|
|
msvc::multiset<unsigned_int>::erase(&local_3c);
|
|
}
|
|
*parentRef = this;
|
|
msvc::multiset<unsigned_int>::insert(parentRef);
|
|
break;
|
|
case 0x10:
|
|
uVar3 = Random();
|
|
spawnedChild = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x39,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(this),1,uVar3);
|
|
parentRef = &spawnedChild->_parent;
|
|
if (spawnedChild->_parent != 0) {
|
|
local_3c = GHIDRA_CAST<Entity *>(parentRef);
|
|
msvc::multiset<unsigned_int>::erase(&local_3c);
|
|
}
|
|
*parentRef = this;
|
|
msvc::multiset<unsigned_int>::insert(parentRef);
|
|
break;
|
|
case 0x11:
|
|
if (isInit != 0) goto LAB_006d0b75;
|
|
uVar3 = Random();
|
|
local_3c = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(0x60,0,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(this),0,uVar3);
|
|
parentRef = &local_3c->_parent;
|
|
if (local_3c->_parent != 0) {
|
|
local_40 = GHIDRA_CAST<Entity *>(parentRef);
|
|
msvc::multiset<unsigned_int>::erase(&local_40);
|
|
}
|
|
*parentRef = this;
|
|
msvc::multiset<unsigned_int>::insert(parentRef);
|
|
::(GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>((local_38 + 4)))))->EntityRef::constructor(GHIDRA_CAST<Entity *>(this));
|
|
(GHIDRA_CAST<Entity *>((local_3c)))->Entity::AddShrink(GHIDRA_CAST<EntityRef *>((local_38 + 4)),0x96,1,1);
|
|
FUN_006b5de0();
|
|
break;
|
|
case 0x12:
|
|
*maxHp = *maxHp * 0.333;
|
|
this->_championSpeed = this->_championSpeed * 1.333;
|
|
break;
|
|
case 0x13:
|
|
*maxHp = *maxHp * 1.5;
|
|
this->_championSpeed = this->_championSpeed * 0.9;
|
|
case 0x17:
|
|
if (0.0 < this->_collisionDamage) {
|
|
this->_collisionDamage = 4.0;
|
|
}
|
|
goto LAB_006d0b75;
|
|
case 0x14:
|
|
uVar3 = Random();
|
|
local_40 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x39,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(this),2,uVar3);
|
|
parentRef = &local_40->_parent;
|
|
if (local_40->_parent != 0) {
|
|
local_3c = GHIDRA_CAST<Entity *>(parentRef);
|
|
msvc::multiset<unsigned_int>::erase(&local_3c);
|
|
}
|
|
*parentRef = this;
|
|
msvc::multiset<unsigned_int>::insert(parentRef);
|
|
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(local_38))))->Color::Color(1.0,0.2,0.2,1.0);
|
|
local_40->SetColor(extraout_EAX,0xffffffff,0xff,0,1);
|
|
break;
|
|
case 0x16:
|
|
*maxHp = *maxHp * 3.0;
|
|
break;
|
|
case 0x19:
|
|
this->_championSpeed = 1.333;
|
|
*maxHp = *maxHp * 1.5;
|
|
uVar3 = Random();
|
|
this->_championTimer = uVar3 % 0x14 + 0x28;
|
|
uVar3 = Random();
|
|
spawnedChild = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x39,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(this),0,uVar3);
|
|
parentRef = &spawnedChild->_parent;
|
|
if (spawnedChild->_parent != 0) {
|
|
local_40 = GHIDRA_CAST<Entity *>(parentRef);
|
|
msvc::multiset<unsigned_int>::erase(&local_40);
|
|
}
|
|
*parentRef = this;
|
|
msvc::multiset<unsigned_int>::insert(parentRef);
|
|
if (isInit == 0) {
|
|
uVar3 = Random();
|
|
spawnedChild = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(0x60,0,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(this),0,uVar3);
|
|
parentRef = &spawnedChild->_parent;
|
|
if (spawnedChild->_parent != 0) {
|
|
local_40 = GHIDRA_CAST<Entity *>(parentRef);
|
|
msvc::multiset<unsigned_int>::erase(&local_40);
|
|
}
|
|
*parentRef = this;
|
|
msvc::multiset<unsigned_int>::insert(parentRef);
|
|
}
|
|
if (*GHIDRA_CAST<char *>(g_game->_room) == '\0') {
|
|
iVar2 = -1;
|
|
}
|
|
else {
|
|
iVar2 = g_game->_frameCount - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0x11f0));
|
|
}
|
|
hsv_to_rgb(GHIDRA_CAST<KColor *>(local_20),((float)(iVar2 % 0x5a) * 360.0) / 90.0,1.0,1.0,1.0);
|
|
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(local_38))))->Color::Color((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_20)) + 0x0))),(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_20)) + 0x4))),afStack_18[0],1.0);
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(&this->_sprite))))->Entity::SetColor(colorArg);
|
|
}
|
|
LAB_006d0b75:
|
|
if ((this->_type == 0x10) && (this->_variant == 2)) {
|
|
clampedMaxHp = &oldMaxHpCopy;
|
|
if (*maxHp <= oldMaxHp) {
|
|
clampedMaxHp = maxHp;
|
|
}
|
|
*maxHp = *clampedMaxHp;
|
|
}
|
|
if (isInit == 0) {
|
|
this->_health = *maxHp;
|
|
}
|
|
this->ResetColor();
|
|
return;
|
|
}
|
|
|
|
// 006d0c20
|
|
void Entity_NPC::SetRef_bec(Entity *entity)
|
|
{
|
|
Entity_NPC *local_8;
|
|
uint32_t *entityRef;
|
|
|
|
entityRef = &this->_entityRef;
|
|
local_8 = this;
|
|
if (*entityRef != 0) {
|
|
local_8 = GHIDRA_CAST<Entity_NPC *>(entityRef);
|
|
msvc::multiset<unsigned_int>::erase(&local_8);
|
|
}
|
|
*entityRef = entity;
|
|
if (entity != GHIDRA_CAST<Entity *>(0x0)) {
|
|
msvc::multiset<unsigned_int>::insert(entityRef);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006d0c60
|
|
void * Entity_NPC::QueryNPCsType(void *outList, int type, int variant)
|
|
{
|
|
EntityList::QuerySublist(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),outList,type,variant,-1,0,0);
|
|
return outList;
|
|
}
|
|
|
|
// 006d0dd0
|
|
EntityList * Entity_NPC::QueryNPCsGroup(EntityList *outList, int groupIdx)
|
|
{
|
|
int entity;
|
|
int listSize;
|
|
uint32_t entityIndex;
|
|
Game *game;
|
|
void *room;
|
|
void *sourceRoom;
|
|
|
|
game = g_game;
|
|
room = g_game->_room;
|
|
entityIndex = 0;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(room) + 0x1294)) = 0;
|
|
sourceRoom = game->_room;
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sourceRoom) + 0x1264)) != 0) {
|
|
do {
|
|
entity = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(sourceRoom) + 0x125c)) + entityIndex * 4));
|
|
if ((((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (*GHIDRA_CAST<int *>((entity + 0x28)) == 1)) ||
|
|
(*GHIDRA_CAST<int *>((entity + 0x28)) - 10U < 0x3de)) &&
|
|
((entity = __RTDynamicCast(entity,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor,
|
|
&IsaacRepentancePlus::Entity_NPC::RTTI_Type_Descriptor,0),
|
|
entity != 0 && (*GHIDRA_CAST<int *>((entity + 0xc7c)) == groupIdx)))) {
|
|
listSize = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(room) + 0x1294));
|
|
if (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(room) + 0x1290)) < listSize + 1U) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("EL: not enough space for push_back\n"));
|
|
listSize = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(room) + 0x1294));
|
|
}
|
|
*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(room) + 0x128c)) + listSize * 4)) = entity;
|
|
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(room) + 0x1294)) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(room) + 0x1294)) + 1;
|
|
}
|
|
entityIndex = entityIndex + 1;
|
|
} while (entityIndex < *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(sourceRoom) + 0x1264)));
|
|
}
|
|
(GHIDRA_CAST<EntityList *>((GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)))))->EntityList::assign(GHIDRA_CAST<EntityList_EL *>(outList),
|
|
GHIDRA_CAST<EntityList_EL *>((GHIDRA_INT(room) + 0x1288)));
|
|
return outList;
|
|
}
|
|
|
|
// 006d1580
|
|
void * Entity_NPC::fireplace_get_loot(void *outLoot, uint8_t isShouldAdvance)
|
|
{
|
|
int *ptr;
|
|
uint8_t bVar1;
|
|
uint32_t uVar2;
|
|
int iVar3;
|
|
void *lootBlocks;
|
|
void *lootBlocks;
|
|
RNG *rng;
|
|
int *lootList;
|
|
void *lootMap;
|
|
int lootMapSize;
|
|
uint32_t lootOffset;
|
|
int lootCount;
|
|
float dropChance;
|
|
void *local_48;
|
|
RNG rngCopy;
|
|
RNG trinketRng;
|
|
uint32_t local_24;
|
|
uint8_t *puStack_20;
|
|
void *local_1c;
|
|
uint8_t *puStack_18;
|
|
uint32_t local_14;
|
|
uint32_t pickupSubtype;
|
|
uint32_t pickupVariant;
|
|
|
|
puStack_20 = GHIDRA_CAST<uint8_t *>((GHIDRA_INT(register0x00000010) + -4));
|
|
local_14 = 0xffffffff;
|
|
puStack_18 = &LAB_00afab6d;
|
|
local_1c = ExceptionList;
|
|
local_24 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U;
|
|
ExceptionList = &local_1c;
|
|
local_48 = outLoot;
|
|
lootList = GHIDRA_CAST<int *>(0x0);
|
|
lootMap = (void *)0x0;
|
|
lootMapSize = 0;
|
|
lootOffset = 0;
|
|
lootCount = 0;
|
|
lootList = operator_new(8);
|
|
lootList[1] = 0;
|
|
*lootList = GHIDRA_INT(&lootList);
|
|
local_14 = 0;
|
|
if ((((((this->_flags & 0x40000000000) != 0) || (iVar3 = this->_variant, iVar3 == 0xb)) ||
|
|
(iVar3 == 10)) || ((iVar3 == 0xc || (iVar3 == 0xd)))) || (iVar3 == 4)) {
|
|
(GHIDRA_CAST<LootList *>((outLoot)))->LootList::LootList(&lootList);
|
|
if (lootCount != 0) {
|
|
do {
|
|
lootCount = lootCount + -1;
|
|
} while (lootCount != 0);
|
|
lootOffset = 0;
|
|
lootCount = 0;
|
|
}
|
|
lootBlocks = lootMap;
|
|
iVar3 = lootMapSize;
|
|
if (lootMapSize != 0) {
|
|
do {
|
|
lootBlocks = *(void **)(GHIDRA_CAST<char *>(lootBlocks) + iVar3 * 4 + -4);
|
|
iVar3 = iVar3 + -1;
|
|
if (lootBlocks != (void *)0x0) {
|
|
operator_delete(lootBlocks,0x14);
|
|
lootBlocks = lootMap;
|
|
}
|
|
} while (iVar3 != 0);
|
|
}
|
|
if (lootBlocks != (void *)0x0) {
|
|
uVar2 = lootMapSize * 4;
|
|
lootBlocks = lootBlocks;
|
|
if (0xfff < uVar2) {
|
|
lootBlocks = *(void **)(GHIDRA_CAST<char *>(lootBlocks) + -4);
|
|
uVar2 = uVar2 + 0x23;
|
|
if (0x1f < GHIDRA_UINT((GHIDRA_INT(lootBlocks) + (-4 - GHIDRA_INT(lootBlocks))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(lootBlocks,uVar2);
|
|
}
|
|
ptr = lootList;
|
|
lootMapSize = 0;
|
|
lootMap = (void *)0x0;
|
|
lootList = GHIDRA_CAST<int *>(0x0);
|
|
operator_delete(ptr,8);
|
|
ExceptionList = local_1c;
|
|
return outLoot;
|
|
}
|
|
rngCopy._seed = (this->_dropRNG)._seed;
|
|
rngCopy._shift1 = (this->_dropRNG)._shift1;
|
|
rngCopy._shift2 = (this->_dropRNG)._shift2;
|
|
rngCopy._shift3 = (this->_dropRNG)._shift3;
|
|
rng = &rngCopy;
|
|
if (isShouldAdvance != 0) {
|
|
rng = &this->_dropRNG;
|
|
}
|
|
if ((iVar3 == 2) || (iVar3 == 3)) {
|
|
bVar1 = Game::IsHardMode();
|
|
if (bVar1 == 0) {
|
|
dropChance = 0.25;
|
|
}
|
|
else {
|
|
dropChance = 0.1;
|
|
}
|
|
local_48 = (void *)(GHIDRA_CAST<RNG *>((rng)))->RNG::RandomFloat();
|
|
if (dropChance <= (float)local_48) goto LAB_006d17dc;
|
|
bVar1 = (GHIDRA_CAST<PlayerManager *>((&g_game->_playerManager)))->PlayerManager::AnyoneHasTrinket(0x16);
|
|
if (bVar1 != 0) {
|
|
trinketRng._seed = rng->_seed;
|
|
trinketRng._shift1 = 1;
|
|
trinketRng._shift2 = 0xb;
|
|
trinketRng._shift3 = 6;
|
|
uVar2 = (GHIDRA_CAST<RNG *>((&trinketRng)))->RNG::RandomInt(5);
|
|
if (uVar2 != 0) goto LAB_006d17dc;
|
|
}
|
|
iVar3 = (GHIDRA_CAST<PlayerManager *>((&g_game->_playerManager)))->PlayerManager::GetTrinketMultiplier(0x16);
|
|
if (iVar3 < 2) {
|
|
uVar2 = (GHIDRA_CAST<RNG *>((rng)))->RNG::Next();
|
|
pickupSubtype = 3;
|
|
}
|
|
else {
|
|
uVar2 = (GHIDRA_CAST<RNG *>((rng)))->RNG::Next();
|
|
pickupSubtype = 6;
|
|
}
|
|
LAB_006d17d0:
|
|
pickupVariant = 10;
|
|
}
|
|
else {
|
|
bVar1 = Game::IsHardMode();
|
|
if (bVar1 == 0) {
|
|
dropChance = 0.25;
|
|
}
|
|
else {
|
|
dropChance = 0.1;
|
|
}
|
|
local_48 = (void *)(GHIDRA_CAST<RNG *>((rng)))->RNG::RandomFloat();
|
|
if (dropChance <= (float)local_48) goto LAB_006d17dc;
|
|
local_48 = (void *)(GHIDRA_CAST<RNG *>((rng)))->RNG::RandomFloat();
|
|
if ((float)local_48 < 0.25) {
|
|
bVar1 = (GHIDRA_CAST<PlayerManager *>((&g_game->_playerManager)))->PlayerManager::AnyoneHasTrinket(0x16);
|
|
if (bVar1 != 0) {
|
|
trinketRng._seed = rng->_seed;
|
|
trinketRng._shift1 = 1;
|
|
trinketRng._shift2 = 0xb;
|
|
trinketRng._shift3 = 6;
|
|
uVar2 = (GHIDRA_CAST<RNG *>((&trinketRng)))->RNG::RandomInt(5);
|
|
if (uVar2 != 0) goto LAB_006d1719;
|
|
}
|
|
uVar2 = (GHIDRA_CAST<RNG *>((rng)))->RNG::Next();
|
|
pickupSubtype = 0;
|
|
goto LAB_006d17d0;
|
|
}
|
|
LAB_006d1719:
|
|
uVar2 = (GHIDRA_CAST<RNG *>((rng)))->RNG::Next();
|
|
pickupSubtype = 0;
|
|
pickupVariant = 0x14;
|
|
}
|
|
msvc::deque<LootEntry>::push_back(5,pickupVariant,pickupSubtype,uVar2,0);
|
|
LAB_006d17dc:
|
|
(GHIDRA_CAST<LootList *>((outLoot)))->LootList::LootList(&lootList);
|
|
FUN_006b84c0();
|
|
ExceptionList = local_1c;
|
|
return outLoot;
|
|
}
|
|
|
|
// 006d2b50
|
|
void Entity_NPC::Interpolate()
|
|
{
|
|
int iVar1;
|
|
Entity *this_00;
|
|
uint8_t isEnemy;
|
|
int *playerSlot;
|
|
void *playerListEnd;
|
|
PlayerManager *playerManager;
|
|
float fVar2;
|
|
float dy;
|
|
uint32_t i;
|
|
uint32_t flags;
|
|
int type;
|
|
|
|
if (this->_pauseTimer != 0) {
|
|
return;
|
|
}
|
|
if (this->_type == 0x3c5) {
|
|
flags = GHIDRA_UINT(this->_flags);
|
|
if ((flags & 2) == 0) {
|
|
(this->_preInterpolatePos).x = (this->_pos).x;
|
|
(this->_preInterpolatePos).y = (this->_pos).y;
|
|
if (this->_holdCountdown < 1) {
|
|
apply_velocity(this,1);
|
|
update_move_direction_anim(this);
|
|
}
|
|
this->_isInterpolating = 1;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::CollideWithGrid(1);
|
|
iVar1 = this->_child;
|
|
if ((iVar1 != 0) && (*GHIDRA_CAST<uint32_t *>((iVar1 + 0x20)) < GHIDRA_UINT(this->_index))) {
|
|
*GHIDRA_CAST<float *>((iVar1 + 0x33c)) = (this->_pos).x;
|
|
*GHIDRA_CAST<float *>((iVar1 + 0x340)) = (this->_pos).y;
|
|
}
|
|
if (this->_variant == 10) {
|
|
playerManager = &g_game->_playerManager;
|
|
i = 0;
|
|
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((playerManager->_playerList)._begin) >> 2 != 0) {
|
|
do {
|
|
playerListEnd = (playerManager->_playerList)._end;
|
|
if (GHIDRA_INT(playerListEnd) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("(GHIDRA_CAST<PlayerManager *>(()))->PlayerManager::GetPlayer() : There are no players! \n"));
|
|
playerListEnd = (playerManager->_playerList)._end;
|
|
}
|
|
playerSlot = (playerManager->_playerList)._begin;
|
|
if (i < GHIDRA_UINT((GHIDRA_INT(playerListEnd) - GHIDRA_INT(playerSlot) >> 2))) {
|
|
playerSlot = playerSlot + i;
|
|
}
|
|
iVar1 = *playerSlot;
|
|
if (*GHIDRA_CAST<Entity_NPC **>((iVar1 + 0x3d4)) == this) {
|
|
fVar2 = (this->_pos).y;
|
|
*GHIDRA_CAST<float *>((iVar1 + 0x33c)) = *GHIDRA_CAST<float *>((iVar1 + 0x2088)) + (this->_pos).x;
|
|
*GHIDRA_CAST<float *>((iVar1 + 0x340)) = *GHIDRA_CAST<float *>((iVar1 + 0x208c)) + fVar2;
|
|
*GHIDRA_CAST<float *>((iVar1 + 0x360)) = (this->_velocity).x;
|
|
*GHIDRA_CAST<float *>((iVar1 + 0x364)) = (this->_velocity).y;
|
|
*GHIDRA_CAST<float *>((iVar1 + 0x36c)) = this->_friction;
|
|
}
|
|
i = i + 1;
|
|
playerManager = &g_game->_playerManager;
|
|
} while (i < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((playerManager->_playerList)._begin) >> 2)));
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
|
|
*GHIDRA_CAST<uint32_t *>(&this->_flags) = flags & 0xfffffffd;
|
|
}
|
|
}
|
|
else {
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::Interpolate();
|
|
}
|
|
if ((this->_aiCallFlags & 2) != 0) {
|
|
this->_aiCallPhase = 2;
|
|
Entity_NPC_UpdateAI_dispatch(this);
|
|
this->_aiCallPhase = 0;
|
|
}
|
|
UpdateChildEffectPosition(this,1);
|
|
if (((((this->_flags & 0x20) != 0 || (this->_flags & 0x200000000000000) != 0) ||
|
|
(0 < this->_holdCountdown)) || (iVar1 = this->_state, iVar1 == 1)) ||
|
|
((iVar1 == 0x12 || (iVar1 == 0x11)))) goto LAB_006d2dd8;
|
|
type = this->_type;
|
|
if (type == 0x3e) {
|
|
if (this->_variant != 3) {
|
|
LAB_006d2d6c:
|
|
if (type == 0x33e) {
|
|
if (this->_variant != 10) goto LAB_006d2dd8;
|
|
goto LAB_006d2d79;
|
|
}
|
|
LAB_006d2d90:
|
|
if ((((type != 0x371) && (type != 0x32f)) && ((type != 0x33f || (this->_variant != 0x14)))) ||
|
|
(iVar1 != 6)) goto LAB_006d2dd8;
|
|
}
|
|
fVar2 = (this->_v1).x;
|
|
}
|
|
else {
|
|
if (type != 0x393) goto LAB_006d2d6c;
|
|
if (this->_variant != 1) goto LAB_006d2d90;
|
|
LAB_006d2d79:
|
|
fVar2 = (this->_v1).y;
|
|
}
|
|
(this->_posOffset).y = fVar2 * this->_speedMultiplier * 0.5 + (this->_posOffset).y;
|
|
LAB_006d2dd8:
|
|
if ((((this->_type == 0x5c) && (this->_variant == 1)) &&
|
|
(this_00 = GHIDRA_CAST<Entity *>(this->_entityRef), this_00 != GHIDRA_CAST<Entity *>(0x0))) &&
|
|
(isEnemy = (GHIDRA_CAST<Entity *>((this_00)))->Entity::IsEnemy(), isEnemy != 0)) {
|
|
fVar2 = (this_00->_pos).x - (this->_pos).x;
|
|
dy = (this_00->_pos).y - (this->_pos).y;
|
|
(this->_targetPosition).x = fVar2;
|
|
(this->_targetPosition).y = dy;
|
|
(this_00->_targetPosition).x = -fVar2;
|
|
(this_00->_targetPosition).y = -dy;
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006d2e50
|
|
void Entity_NPC::Render(Vector *offset)
|
|
{
|
|
int *piVar1;
|
|
int *piVar2;
|
|
uint8_t bVar3;
|
|
uint32_t uVar4;
|
|
uint32_t curses;
|
|
LayerState *layer;
|
|
float *pfVar5;
|
|
int iVar6;
|
|
Entity_Player *player;
|
|
Entity_NPC *statusTarget;
|
|
void *pvVar7;
|
|
uint8_t *extraout_ECX;
|
|
uint8_t *laterAnimState;
|
|
uint8_t *extraout_ECX_00;
|
|
uint8_t *extraout_ECX_01;
|
|
uint8_t *extraout_ECX_02;
|
|
uint8_t *extraout_ECX_03;
|
|
uint8_t *extraout_ECX_04;
|
|
AnimationState *laterAnimState;
|
|
uint8_t *extraout_ECX_05;
|
|
uint8_t *extraout_ECX_06;
|
|
uint8_t *extraout_ECX_07;
|
|
uint32_t extraout_ECX_08;
|
|
uint32_t extraout_ECX_09;
|
|
uint32_t extraout_ECX_10;
|
|
uint32_t extraout_ECX_11;
|
|
uint32_t extraout_ECX_12;
|
|
uint32_t extraout_ECX_13;
|
|
uint32_t extraout_ECX_14;
|
|
uint32_t extraout_ECX_15;
|
|
uint32_t extraout_ECX_16;
|
|
uint32_t extraout_ECX_17;
|
|
uint32_t uVar8;
|
|
uint32_t extraout_ECX_18;
|
|
int *node;
|
|
float fVar9;
|
|
float fVar10;
|
|
double dVar11;
|
|
ColorMod trailColor;
|
|
ColorMod local_ec;
|
|
Vector *renderOffset;
|
|
float trailX;
|
|
float screenScale;
|
|
int renderMode;
|
|
Vector renderPos;
|
|
float local_a8;
|
|
float refOffsetX;
|
|
float local_a0;
|
|
float *local_9c;
|
|
float local_98;
|
|
float fStack_94;
|
|
Entity_Player *local_90;
|
|
Entity_NPC *minecart;
|
|
float local_88;
|
|
Vector local_84;
|
|
float local_7c;
|
|
Vector baseOffset;
|
|
float local_70;
|
|
float alphaMult;
|
|
float local_68;
|
|
char isHidden;
|
|
void *configName;
|
|
KColor local_5c;
|
|
Color local_48;
|
|
uint8_t debugText [4];
|
|
Entity_NPC *local_18;
|
|
uint32_t stackCookie;
|
|
void *savedExceptionList;
|
|
uint8_t *puStack_c;
|
|
uint32_t ehState;
|
|
Game *game;
|
|
char isNil;
|
|
Manager *manager;
|
|
char *room;
|
|
ColorMod *spriteColor;
|
|
|
|
ehState = 0xffffffff;
|
|
puStack_c = &LAB_00afac0b;
|
|
savedExceptionList = ExceptionList;
|
|
uVar4 = __security_cookie ^ GHIDRA_UINT((debugText + 0x18));
|
|
laterAnimState = GHIDRA_CAST<uint8_t *>(this->_type);
|
|
renderOffset = offset;
|
|
baseOffset.x = offset->x;
|
|
fVar9 = offset->y;
|
|
if (((laterAnimState == GHIDRA_CAST<uint8_t *>(0x3c5)) && (this->_variant == 0)) && (this->_child != 0)) {
|
|
return;
|
|
}
|
|
statusTarget = GHIDRA_CAST<Entity_NPC *>(this->_minecart);
|
|
renderPos.y = 0.0;
|
|
renderPos.x = 0.0;
|
|
ExceptionList = &savedExceptionList;
|
|
baseOffset.y = fVar9;
|
|
local_18 = this;
|
|
stackCookie = uVar4;
|
|
if ((laterAnimState == GHIDRA_CAST<uint8_t *>(0x3c5)) && (this->_variant == 10)) {
|
|
alphaMult = 1.0;
|
|
renderMode = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0x12bc));
|
|
minecart = this;
|
|
LAB_006d301b:
|
|
isHidden = '\0';
|
|
}
|
|
else {
|
|
isHidden = '\0';
|
|
alphaMult = 1.0;
|
|
renderMode = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0x12bc));
|
|
minecart = statusTarget;
|
|
if (laterAnimState == GHIDRA_CAST<uint8_t *>(0x327)) {
|
|
if (((g_game->_currentDimensionIdx == 1) &&
|
|
((g_game->_stageType == 4 || (g_game->_stageType == 5)))) &&
|
|
((g_game->_stage == 2 ||
|
|
((g_game->_stage == 1 && (curses = (GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level::GetCurses(), (curses & 2) != 0)))
|
|
))) {
|
|
laterAnimState = GHIDRA_CAST<uint8_t *>(0x1);
|
|
}
|
|
else {
|
|
laterAnimState = GHIDRA_CAST<uint8_t *>(0x0);
|
|
}
|
|
minecart = statusTarget;
|
|
if (GHIDRA_CAST<uint8_t *>(GHIDRA_UINT((renderMode != 5))) != laterAnimState) {
|
|
fVar10 = 0.0;
|
|
alphaMult = 0.0;
|
|
if ((*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(g_game->_room) + 0x7240)) <= 0.0) ||
|
|
((g_manager->_optionsConfig)._enableWaterSurface == 0)) {
|
|
fVar10 = 0.2;
|
|
alphaMult = 0.2;
|
|
}
|
|
fVar9 = g_game->_lightningIntensity;
|
|
if (0.0 < fVar9) {
|
|
fVar9 = fVar9 + fVar10;
|
|
if (fVar9 <= fVar10) {
|
|
fVar9 = fVar10;
|
|
}
|
|
fVar10 = fVar9;
|
|
if (1.0 <= fVar9) {
|
|
fVar10 = 1.0;
|
|
}
|
|
alphaMult = fVar10;
|
|
}
|
|
isHidden = '\x01';
|
|
if (fVar10 != 0.0) goto LAB_006d301b;
|
|
}
|
|
}
|
|
}
|
|
statusTarget = minecart;
|
|
if (this->_type == 0x371) {
|
|
NpcHelper::needle_render(this);
|
|
LAB_006d3040:
|
|
layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST<uint8_t *>(0x0));
|
|
isHidden = layer->_visible == 0;
|
|
laterAnimState = extraout_ECX;
|
|
}
|
|
else if (this->_type == 0x32f) {
|
|
render_v1_layer_frames(this,uVar4);
|
|
goto LAB_006d3040;
|
|
}
|
|
if ((((this->_type == 0x32a) && (fVar9 = (this->_posOffset).y, -3.0 < fVar9)) &&
|
|
(laterAnimState = GHIDRA_CAST<uint8_t *>((*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) & 0x2000000)),
|
|
laterAnimState == GHIDRA_CAST<uint8_t *>(0x0))) && (renderMode == 3)) {
|
|
alphaMult = 0.0;
|
|
}
|
|
if ((statusTarget != GHIDRA_CAST<Entity_NPC *>(0x0)) && (this->_visible != 0)) {
|
|
if ((statusTarget->_sprite)._animState._animData != (void *)0x0) {
|
|
pfVar5 = AnimationState::GetNullFrameById(&(statusTarget->_sprite)._animState,0);
|
|
if (pfVar5 == GHIDRA_CAST<float *>(0x0)) {
|
|
laterAnimState = extraout_ECX_00;
|
|
statusTarget = minecart;
|
|
}
|
|
else {
|
|
local_a8 = g_displayPixelRatio * g_screenPointScale;
|
|
local_9c = GHIDRA_CAST<float *>(((g_screenHeight - 182.0) * 0.5));
|
|
local_7c = (((this->_pos).x - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * local_a8 + 0.5
|
|
;
|
|
dVar11 = floor((double)local_7c);
|
|
local_98 = (float)dVar11;
|
|
local_7c = (((this->_pos).y - 140.0) * 0.65 + (float)local_9c) * local_a8 + 0.5;
|
|
dVar11 = floor((double)local_7c);
|
|
statusTarget = minecart;
|
|
local_7c = (float)dVar11;
|
|
renderPos.x = local_98 / local_a8 + renderOffset->x;
|
|
renderPos.y = local_7c / local_a8 + renderOffset->y;
|
|
baseOffset.x = baseOffset.x + *pfVar5;
|
|
fVar9 = baseOffset.y + pfVar5[1];
|
|
baseOffset.y = fVar9;
|
|
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&minecart->_sprite))))->Sprite::RenderLayer(0,&renderPos,&g_vectorZero,&g_vectorZero);
|
|
laterAnimState = extraout_ECX_01;
|
|
}
|
|
}
|
|
alphaMult = alphaMult * (statusTarget->_sprite)._color._tint[3];
|
|
}
|
|
iVar6 = this->_spawnerEntity;
|
|
if (((iVar6 != 0) && (*GHIDRA_CAST<int *>((iVar6 + 0x28)) == 1)) &&
|
|
(laterAnimState = GHIDRA_CAST<uint8_t *>(&g_manager->_netplayManager),
|
|
*GHIDRA_CAST<int *>(laterAnimState) != *GHIDRA_CAST<int *>((g_manager + 1)))) {
|
|
bVar3 = (GHIDRA_CAST<NetplayManager *>((GHIDRA_CAST<NetplayManager *>(laterAnimState))))->NetplayManager::IsIdxLocalPlayer(*GHIDRA_CAST<uint32_t *>((iVar6 + 0x1618)));
|
|
laterAnimState = extraout_ECX_02;
|
|
if (bVar3 == 0) {
|
|
FUN_00925df0();
|
|
alphaMult = alphaMult * fVar9;
|
|
laterAnimState = extraout_ECX_03;
|
|
}
|
|
}
|
|
game = g_game;
|
|
local_9c = GHIDRA_CAST<float *>((this->_sprite)._scale.x);
|
|
local_68 = (this->_sprite)._color._tint[3];
|
|
local_7c = (this->_sprite)._scale.y;
|
|
if (0.0 < alphaMult) {
|
|
(this->_sprite)._color._tint[3] = local_68 * alphaMult;
|
|
if (this->_championColorIdx == 0x15) {
|
|
room = game->_room;
|
|
if (*room == '\0') {
|
|
iVar6 = -1;
|
|
}
|
|
else {
|
|
iVar6 = game->_frameCount - *GHIDRA_CAST<int *>((room + 0x11f0));
|
|
}
|
|
fVar9 = sin((float)iVar6 * 0.2);
|
|
if (fVar9 <= 0.0) {
|
|
fVar9 = 0.0;
|
|
}
|
|
if (1.0 <= fVar9) {
|
|
fVar9 = 1.0;
|
|
}
|
|
fVar9 = fVar9 * 0.15 + 1.0;
|
|
(this->_sprite)._scale.x = (float)local_9c * fVar9;
|
|
(this->_sprite)._scale.y = local_7c * fVar9;
|
|
laterAnimState = extraout_ECX_04;
|
|
}
|
|
iVar6 = this->_type;
|
|
if ((iVar6 == 0x111) && (this->_state == 9)) {
|
|
if (this->_exists == 0) {
|
|
ExceptionList = savedExceptionList;
|
|
return;
|
|
}
|
|
if (this->_visible == 0) {
|
|
ExceptionList = savedExceptionList;
|
|
return;
|
|
}
|
|
local_a0 = (this->_velocity).x * 5.0 * -0.14285715;
|
|
local_70 = (this->_velocity).y * 5.0 * -0.14285715;
|
|
fVar9 = (this->_pos).y;
|
|
fVar10 = (this->_pos).x;
|
|
trailX = fVar10;
|
|
local_98 = fVar9;
|
|
(GHIDRA_CAST<Color *>((&local_48)))->Color::operator_assign(&(this->_sprite)._color);
|
|
local_a8 = 8.40779e-45;
|
|
spriteColor = &(this->_sprite)._color;
|
|
do {
|
|
screenScale = g_displayPixelRatio * g_screenPointScale;
|
|
local_90 = (Entity_Player *)
|
|
(((fVar9 + (this->_posOffset).y) - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5
|
|
);
|
|
local_88 = (((fVar10 + (this->_posOffset).x) - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5)
|
|
* screenScale + 0.5;
|
|
dVar11 = floor((double)local_88);
|
|
local_88 = (float)dVar11 / screenScale;
|
|
local_90 = GHIDRA_CAST<Entity_Player *>(((float)local_90 * screenScale + 0.5));
|
|
dVar11 = floor((double)(float)local_90);
|
|
local_90 = GHIDRA_CAST<Entity_Player *>((float)dVar11);
|
|
trailColor._offset[0] = 0.0;
|
|
trailColor._offset[1] = 0.0;
|
|
trailColor._offset[2] = 0.0;
|
|
local_84.x = baseOffset.x + local_88;
|
|
fVar9 = ((float)GHIDRA_INT(local_a8) * 0.9) / 7.0 + 0.1;
|
|
local_84.y = baseOffset.y + (float)local_90 / screenScale;
|
|
trailColor._tint[2] = fVar9 * local_48._tint[2];
|
|
trailColor._tint[3] = fVar9 * local_48._tint[3] * 0.5;
|
|
trailColor._tint[0] = fVar9 * local_48._tint[0];
|
|
trailColor._tint[1] = fVar9 * local_48._tint[1];
|
|
if (spriteColor != &trailColor) {
|
|
(this->_sprite)._color._colorize[0] = 0.0;
|
|
(this->_sprite)._color._colorize[1] = 0.0;
|
|
(this->_sprite)._color._colorize[2] = 0.0;
|
|
(this->_sprite)._color._colorize[3] = 0.0;
|
|
spriteColor->_tint[0] = trailColor._tint[0];
|
|
(this->_sprite)._color._tint[1] = trailColor._tint[1];
|
|
(this->_sprite)._color._tint[2] = trailColor._tint[2];
|
|
(this->_sprite)._color._tint[3] = trailColor._tint[3];
|
|
(this->_sprite)._color._offset[0] = 0.0;
|
|
(this->_sprite)._color._offset[1] = 0.0;
|
|
(this->_sprite)._color._offset[2] = 0.0;
|
|
}
|
|
if ((this->_sprite)._loaded != 0) {
|
|
if ((this->_sprite)._overlayRenderFirst == 0) {
|
|
AnimationState::Render
|
|
(&(this->_sprite)._animState,&local_84,&g_vectorZero,&g_vectorZero);
|
|
laterAnimState = &(this->_sprite)._overlayAnimState;
|
|
}
|
|
else {
|
|
AnimationState::Render
|
|
(&(this->_sprite)._overlayAnimState,&local_84,&g_vectorZero,&g_vectorZero);
|
|
laterAnimState = &(this->_sprite)._animState;
|
|
}
|
|
AnimationState::Render(laterAnimState,&local_84,&g_vectorZero,&g_vectorZero);
|
|
}
|
|
local_a8 = (float)(GHIDRA_INT(local_a8) + -1);
|
|
fVar10 = local_a0 + trailX;
|
|
fVar9 = local_70 + local_98;
|
|
trailX = fVar10;
|
|
local_98 = fVar9;
|
|
} while (-1 < GHIDRA_INT(local_a8));
|
|
local_ec._tint[3] = local_48._tint[3] * 0.2;
|
|
local_ec._colorize[0] = 0.0;
|
|
local_ec._colorize[1] = 0.0;
|
|
local_ec._colorize[2] = 0.0;
|
|
local_ec._colorize[3] = 0.0;
|
|
local_ec._offset[0] = 0.0;
|
|
local_ec._tint[0] = local_48._tint[0];
|
|
local_ec._offset[1] = 0.0;
|
|
local_ec._offset[2] = 0.0;
|
|
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::SetColor(&local_ec);
|
|
local_a0 = (this->_pos).y + (this->_posOffset).y;
|
|
local_90 = GHIDRA_CAST<Entity_Player *>(((g_screenHeight - 182.0) * 0.5));
|
|
local_98 = g_displayPixelRatio * g_screenPointScale;
|
|
local_70 = ((((this->_pos).x + (this->_posOffset).x) - 60.0) * 0.65 +
|
|
(g_screenWidth - 338.0) * 0.5) * local_98 + 0.5;
|
|
dVar11 = floor((double)local_70);
|
|
local_88 = (float)dVar11;
|
|
local_70 = ((local_a0 - 140.0) * 0.65 + (float)local_90) * local_98 + 0.5;
|
|
dVar11 = floor((double)local_70);
|
|
local_70 = (float)dVar11;
|
|
local_84.x = baseOffset.x + local_88 / local_98;
|
|
local_84.y = baseOffset.y + local_70 / local_98;
|
|
ANM2::Render(&this->_sprite,&local_84,&g_vectorZero,&g_vectorZero);
|
|
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST<ColorMod *>(&local_48));
|
|
iVar6 = this->_type;
|
|
laterAnimState = extraout_ECX_05;
|
|
}
|
|
if ((((iVar6 == 0x13) && (this->_variant == 3)) &&
|
|
(laterAnimState = GHIDRA_CAST<uint8_t *>(this->_child), GHIDRA_CAST<uint32_t *>(laterAnimState) != GHIDRA_CAST<uint32_t *>(0x0))) &&
|
|
(fVar9 = (this->_pos).y,
|
|
*GHIDRA_CAST<float *>((laterAnimState + 0x340)) <= fVar9 && fVar9 != *GHIDRA_CAST<float *>((laterAnimState + 0x340)))) {
|
|
RenderSegmentLink(this,&baseOffset,0);
|
|
iVar6 = this->_type;
|
|
laterAnimState = extraout_ECX_06;
|
|
}
|
|
if ((iVar6 == 0x3b6) && (this->_variant == 0)) {
|
|
render_overlay(this,&baseOffset,0);
|
|
iVar6 = this->_type;
|
|
laterAnimState = extraout_ECX_07;
|
|
}
|
|
if (iVar6 == 0x37d) {
|
|
if (((this->_targetPosition).x != g_vectorZero.x) ||
|
|
((this->_targetPosition).y != g_vectorZero.y)) {
|
|
fVar9 = (this->_pos).y;
|
|
iVar6 = 0x37d;
|
|
pfVar5 = &(this->_targetPosition).y;
|
|
if (*pfVar5 <= fVar9 && fVar9 != *pfVar5) {
|
|
NpcHelper::ball_and_chain_render_chain(&baseOffset,laterAnimState);
|
|
iVar6 = this->_type;
|
|
}
|
|
goto LAB_006d3907;
|
|
}
|
|
LAB_006d3c6e:
|
|
LAB_006d3c74:
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::Render(&baseOffset);
|
|
uVar8 = extraout_ECX_17;
|
|
}
|
|
else {
|
|
LAB_006d3907:
|
|
if (((iVar6 == 0xf5) && (this->_entityRef != 0)) && (this->_visible != 0)) {
|
|
*GHIDRA_CAST<uint8_t *>((this->_entityRef + 0x171)) = 1;
|
|
node = GHIDRA_CAST<int *>(this->_entityRef);
|
|
refOffsetX = baseOffset.x +
|
|
((((this->_posOffset).x + (this->_pos).x) - (float)node[0xcf]) -
|
|
(float)node[0xd3]) * 0.65;
|
|
local_a0 = baseOffset.y +
|
|
((((this->_pos).y + (this->_posOffset).y) - (float)node[0xd0]) -
|
|
(float)node[0xd4]) * 0.65;
|
|
(**(code **)(*node + 0x14))();
|
|
*GHIDRA_CAST<uint8_t *>((this->_entityRef + 0x171)) = 0;
|
|
iVar6 = this->_type;
|
|
}
|
|
switch(iVar6) {
|
|
case 0x343:
|
|
FUN_005579b0();
|
|
uVar8 = extraout_ECX_14;
|
|
break;
|
|
default:
|
|
goto LAB_006d3c6e;
|
|
case 0x361:
|
|
FUN_004e07a0();
|
|
uVar8 = extraout_ECX_13;
|
|
break;
|
|
case 0x38a:
|
|
(GHIDRA_CAST<Entity_Pickup *>((GHIDRA_CAST<Entity_Pickup *>(this))))->Entity_Pickup::Render(&baseOffset);
|
|
uVar8 = extraout_ECX_08;
|
|
break;
|
|
case 0x38d:
|
|
if (this->_variant == 10) {
|
|
FUN_00589de0();
|
|
uVar8 = extraout_ECX_09;
|
|
break;
|
|
}
|
|
goto LAB_006d3c74;
|
|
case 0x390:
|
|
NpcHelper::mother_render(this,&baseOffset);
|
|
uVar8 = extraout_ECX_10;
|
|
break;
|
|
case 0x398:
|
|
NpcHelper::horny_boys_render(this,&baseOffset);
|
|
uVar8 = extraout_ECX_11;
|
|
break;
|
|
case 0x399:
|
|
NpcHelper::clutch_render(this,&baseOffset);
|
|
uVar8 = extraout_ECX_12;
|
|
break;
|
|
case 0x3b7:
|
|
FUN_00598260();
|
|
uVar8 = extraout_ECX_15;
|
|
break;
|
|
case 0x3c5:
|
|
if (this->_variant != 10) goto LAB_006d3c6e;
|
|
local_84.x = 0.0;
|
|
local_84.y = 0.0;
|
|
local_84.x = (float)operator_new(0x18);
|
|
*GHIDRA_CAST<float *>(local_84.x) = local_84.x;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(local_84.x) + 4)) = local_84.x;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(local_84.x) + 8)) = local_84.x;
|
|
*GHIDRA_CAST<uint16_t *>((GHIDRA_CAST<char *>(local_84.x) + 0xc)) = 0x101;
|
|
ehState = 0;
|
|
uVar4 = 0;
|
|
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) {
|
|
do {
|
|
player = (GHIDRA_CAST<Game *>((g_game)))->Game::GetPlayer(uVar4);
|
|
if (GHIDRA_CAST<Entity_NPC *>(player->_minecart) == this) {
|
|
fStack_94 = (player->_minecartOffset).y;
|
|
local_90 = player;
|
|
FUN_006dac00(&local_70,&fStack_94);
|
|
}
|
|
uVar4 = uVar4 + 1;
|
|
} while (uVar4 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2)));
|
|
}
|
|
node = *GHIDRA_CAST<int **>(local_84.x);
|
|
if (node != GHIDRA_CAST<int *>(local_84.x)) {
|
|
do {
|
|
piVar1 = GHIDRA_CAST<int *>(node[5]);
|
|
fVar9 = (local_18->_pos).x;
|
|
local_70 = (float)piVar1[0xcf];
|
|
local_a0 = (float)piVar1[0xd0];
|
|
piVar1[0xd0] = GHIDRA_INT(((float)piVar1[0x823] + (local_18->_pos).y));
|
|
piVar1[0xcf] = GHIDRA_INT(((float)piVar1[0x822] + fVar9));
|
|
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(piVar1) + 0x171)) = 1;
|
|
fStack_94 = baseOffset.x + (float)piVar1[0x822] * 0.65;
|
|
local_90 = GHIDRA_CAST<Entity_Player *>((baseOffset.y + (float)piVar1[0x823] * 0.65));
|
|
(**(code **)(*piVar1 + 0x14))();
|
|
piVar1[0xcf] = GHIDRA_INT(local_70);
|
|
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(piVar1) + 0x171)) = 0;
|
|
piVar1[0xd0] = GHIDRA_INT(local_a0);
|
|
piVar1 = GHIDRA_CAST<int *>(node[2]);
|
|
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(piVar1) + 0xd)) == '\0') {
|
|
isNil = *GHIDRA_CAST<char *>((*piVar1 + 0xd));
|
|
node = piVar1;
|
|
piVar1 = GHIDRA_CAST<int *>(*piVar1);
|
|
while (isNil == '\0') {
|
|
isNil = *GHIDRA_CAST<char *>((*piVar1 + 0xd));
|
|
node = piVar1;
|
|
piVar1 = GHIDRA_CAST<int *>(*piVar1);
|
|
}
|
|
}
|
|
else {
|
|
isNil = *GHIDRA_CAST<char *>((node[1] + 0xd));
|
|
piVar2 = GHIDRA_CAST<int *>(node[1]);
|
|
piVar1 = node;
|
|
while ((node = piVar2, isNil == '\0' && (piVar1 == GHIDRA_CAST<int *>(node[2])))) {
|
|
isNil = *GHIDRA_CAST<char *>((node[1] + 0xd));
|
|
piVar2 = GHIDRA_CAST<int *>(node[1]);
|
|
piVar1 = node;
|
|
}
|
|
}
|
|
} while (node != GHIDRA_CAST<int *>(local_84.x));
|
|
this = local_18;
|
|
}
|
|
ehState = 0xffffffff;
|
|
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<msvc::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
|
|
(&local_84,(fuzzer_allocator<msvc::_Tree_node<unsigned_int,void*>_> *)&local_84,
|
|
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(local_84.x) + 4));
|
|
operator_delete((void *)local_84.x,0x18);
|
|
uVar8 = extraout_ECX_16;
|
|
}
|
|
}
|
|
iVar6 = this->_type;
|
|
if (iVar6 == 0x376) {
|
|
render_overlay(this,&baseOffset,0);
|
|
iVar6 = this->_type;
|
|
uVar8 = extraout_ECX_18;
|
|
}
|
|
if (iVar6 == 0x37d) {
|
|
if (((this->_targetPosition).x == g_vectorZero.x) &&
|
|
((this->_targetPosition).y == g_vectorZero.y)) goto LAB_006d3d39;
|
|
iVar6 = 0x37d;
|
|
if ((this->_pos).y <= (this->_targetPosition).y) {
|
|
NpcHelper::ball_and_chain_render_chain(&baseOffset,uVar8);
|
|
iVar6 = this->_type;
|
|
}
|
|
}
|
|
if (iVar6 == 0x13) {
|
|
if (((this->_variant != 3) || (this->_child == 0)) ||
|
|
(*GHIDRA_CAST<float *>((this->_child + 0x340)) < (this->_pos).y)) goto LAB_006d3d39;
|
|
RenderSegmentLink(this,&baseOffset,0);
|
|
iVar6 = this->_type;
|
|
}
|
|
if (iVar6 == 0x38e) {
|
|
NpcHelper::chimera_render_child(this,&baseOffset);
|
|
}
|
|
}
|
|
LAB_006d3d39:
|
|
if ((this->_visible == 0) || (alphaMult <= 0.0)) {
|
|
local_a0 = (this->_posOffset).y + (this->_pos).y;
|
|
local_90 = GHIDRA_CAST<Entity_Player *>(((g_screenHeight - 182.0) * 0.5));
|
|
local_18 = GHIDRA_CAST<Entity_NPC *>((g_displayPixelRatio * g_screenPointScale));
|
|
local_70 = ((((this->_pos).x + (this->_posOffset).x) - 60.0) * 0.65 +
|
|
(g_screenWidth - 338.0) * 0.5) * (float)local_18 + 0.5;
|
|
dVar11 = floor((double)local_70);
|
|
local_88 = (float)dVar11;
|
|
local_70 = ((local_a0 - 140.0) * 0.65 + (float)local_90) * (float)local_18 + 0.5;
|
|
dVar11 = floor((double)local_70);
|
|
local_70 = (float)dVar11;
|
|
(this->_renderPosition).x = baseOffset.x + local_88 / (float)local_18;
|
|
(this->_renderPosition).y = baseOffset.y + local_70 / (float)local_18;
|
|
}
|
|
if (((this->_type == 0x19b) || (this->_type == 0x330)) &&
|
|
((this->_entityRef != 0 &&
|
|
((((this->_sprite)._animState._animData != (void *)0x0 &&
|
|
(pfVar5 = AnimationState::GetNullFrame(&(this->_sprite)._animState,&DAT_00b67800),
|
|
pfVar5 != GHIDRA_CAST<float *>(0x0))) && (*GHIDRA_CAST<char *>((pfVar5 + 3)) != '\0')))))) {
|
|
iVar6 = this->_entityRef;
|
|
fVar9 = 0.0;
|
|
local_70 = *GHIDRA_CAST<float *>((iVar6 + 0xdc));
|
|
local_90 = *GHIDRA_CAST<Entity_Player **>((iVar6 + 0xe4));
|
|
local_88 = *GHIDRA_CAST<float *>((iVar6 + 0xe8));
|
|
local_a0 = *GHIDRA_CAST<float *>((iVar6 + 0xe0));
|
|
if (*GHIDRA_CAST<int *>((iVar6 + 0x28)) == 5) {
|
|
fVar9 = 6.5;
|
|
}
|
|
fVar10 = *pfVar5;
|
|
*GHIDRA_CAST<float *>((iVar6 + 0xe0)) = fVar9 + pfVar5[1];
|
|
*GHIDRA_CAST<float *>((iVar6 + 0xdc)) = fVar10 + 0.0;
|
|
iVar6 = this->_entityRef;
|
|
fVar9 = pfVar5[5];
|
|
*GHIDRA_CAST<float *>((iVar6 + 0xe4)) = (float)local_90 * pfVar5[4];
|
|
*GHIDRA_CAST<float *>((iVar6 + 0xe8)) = local_88 * fVar9;
|
|
ANM2::Render(GHIDRA_CAST<ANM2 *>((this->_entityRef + 0x48)),&this->_renderPosition,&g_vectorZero,
|
|
&g_vectorZero);
|
|
iVar6 = this->_entityRef;
|
|
*GHIDRA_CAST<float *>((iVar6 + 0xdc)) = local_70;
|
|
*GHIDRA_CAST<float *>((iVar6 + 0xe0)) = local_a0;
|
|
iVar6 = this->_entityRef;
|
|
*GHIDRA_CAST<Entity_Player **>((iVar6 + 0xe4)) = local_90;
|
|
*GHIDRA_CAST<float *>((iVar6 + 0xe8)) = local_88;
|
|
}
|
|
if (0.0 < alphaMult) {
|
|
if (this->_championColorIdx == 0x15) {
|
|
(this->_sprite)._scale.x = (float)local_9c;
|
|
(this->_sprite)._scale.y = local_7c;
|
|
}
|
|
(this->_sprite)._color._tint[3] = local_68;
|
|
}
|
|
FUN_00860ba0(this,&baseOffset);
|
|
if (((renderMode != 1) && (renderMode != 3)) || (isHidden != '\0')) goto LAB_006d44a0;
|
|
if (this->_type == 0x3c4) {
|
|
sprintf(GHIDRA_CAST<uint8_t *>((local_48._tint + 3)),&DAT_00b67750);
|
|
local_ec._colorize[0] = 1.4013e-45;
|
|
local_ec._colorize[1] = 9.18341e-41;
|
|
local_ec._colorize[2] = 0.0;
|
|
local_ec._colorize[3] = 1.0;
|
|
local_ec._offset[0] = -NAN;
|
|
local_ec._offset[1] = 0.0;
|
|
local_ec._offset[2] = 0.0;
|
|
ehState = 1;
|
|
local_5c._unk = 0;
|
|
local_5c._red = 1.0;
|
|
local_5c._green = 1.0;
|
|
local_5c._blue = 1.0;
|
|
local_5c._alpha = 1.0;
|
|
Font::DrawString(&g_manager->_font6_PFTempestaSevenCondensed,GHIDRA_CAST<uint8_t *>((local_48._tint + 3)),
|
|
&local_5c,local_ec._colorize,(this->_renderPosition).x,
|
|
(this->_renderPosition).y - 28.0);
|
|
ehState = 0xffffffff;
|
|
}
|
|
if ((((this->_statusEffectSprite)._loaded != 0) &&
|
|
((this->_statusEffectSprite)._animState._animData != (void *)0x0)) &&
|
|
((this->_statusEffectSprite)._animState._isPlaying != 0)) {
|
|
local_68 = (float)(GHIDRA_UINT((this->_statusEffectSprite)._bitflags) >> 0x1f);
|
|
iVar6 = AnimationData::find_null_index(GHIDRA_CAST<AnimationData *>(&this->_sprite),GHIDRA_CAST<uint8_t *>("OverlayEffect"));
|
|
if (iVar6 < 0) {
|
|
if (this->_config == GHIDRA_CAST<EntityConfig_Entity *>(0x0)) {
|
|
KAGE_LogMessage(1,GHIDRA_CAST<uint8_t *>("[warn] No OverlayEffect Null found for Entity (%d)\n"));
|
|
}
|
|
else {
|
|
EntityConfig_Entity::GetName(this->_config,GHIDRA_CAST<std_string *>(&configName),0x14);
|
|
ehState = 2;
|
|
KAGE_LogMessage(1,(uint8_t *)
|
|
"[warn] No OverlayEffect Null found for Entity %s with sprite %s\n");
|
|
ehState = 0xffffffff;
|
|
if (0xf < GHIDRA_UINT(local_5c._unk)) {
|
|
uVar4 = local_5c._unk + 1;
|
|
pvVar7 = configName;
|
|
if (0xfff < uVar4) {
|
|
pvVar7 = *(void **)(GHIDRA_CAST<char *>(configName) + -4);
|
|
uVar4 = local_5c._unk + 0x24;
|
|
if (0x1f < GHIDRA_UINT((GHIDRA_INT(configName) + (-4 - GHIDRA_INT(pvVar7))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(pvVar7,uVar4);
|
|
}
|
|
local_5c._alpha = 0.0;
|
|
local_5c._unk = 0xf;
|
|
configName = (void *)(GHIDRA_UINT(configName) & 0xffffff00);
|
|
}
|
|
}
|
|
else {
|
|
local_9c = ANM2::GetLayerFrame(&this->_sprite,iVar6);
|
|
if (((local_9c != GHIDRA_CAST<float *>(0x0)) && (*GHIDRA_CAST<char *>((local_9c + 3)) != '\0')) &&
|
|
(((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_68)) + 0x0))) == '\0' ||
|
|
((this->_parent == 0 ||
|
|
(bVar3 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::is_same_segmented_body(GHIDRA_CAST<Entity *>(0x0)), bVar3 == 0)))))) {
|
|
(this->_statusEffectSprite)._scale.x = local_9c[4];
|
|
(this->_statusEffectSprite)._scale.y = local_9c[5];
|
|
local_7c = g_displayPixelRatio * g_screenPointScale;
|
|
local_70 = (((this->_pos).y + (this->_posOffset).y) - 140.0) * 0.65 +
|
|
(g_screenHeight - 182.0) * 0.5;
|
|
local_68 = ((((this->_pos).x + (this->_posOffset).x) - 60.0) * 0.65 +
|
|
(g_screenWidth - 338.0) * 0.5) * local_7c + 0.5;
|
|
dVar11 = floor((double)local_68);
|
|
local_a0 = (float)dVar11 / local_7c;
|
|
local_68 = local_70 * local_7c + 0.5;
|
|
dVar11 = floor((double)local_68);
|
|
local_68 = (float)dVar11;
|
|
local_84.x = baseOffset.x + local_a0 + *local_9c;
|
|
local_84.y = baseOffset.y + local_68 / local_7c + local_9c[1];
|
|
ANM2::Render(&this->_statusEffectSprite,&local_84,&g_vectorZero,&g_vectorZero);
|
|
}
|
|
}
|
|
}
|
|
player = PlayerManager::FirstCollectibleOwner
|
|
(&g_game->_playerManager,0x193,GHIDRA_CAST<RNG **>(&g_game->_playerManager),1);
|
|
if (((((((player == GHIDRA_CAST<Entity_Player *>(0x0)) || (this->_visible == 0)) ||
|
|
(bVar3 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsActiveEnemy(0), bVar3 == 0)) ||
|
|
((bVar3 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x10), bVar3 != 0 ||
|
|
((this->_sprite)._color._tint[3] <= 0.0)))) ||
|
|
(g_game->_frameCount - this->_spawnFrame < 2)) ||
|
|
((this->_health <= 0.0 ||
|
|
(statusTarget = GHIDRA_CAST<Entity_NPC *>((GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity)::GetStatusEffectTarget(),
|
|
statusTarget != this)))) ||
|
|
(bVar3 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x800000000), bVar3 != 0)) {
|
|
if (this->_controllerID == 0xffffffff) goto LAB_006d44a0;
|
|
if (g_manager->_netplayManager != *GHIDRA_CAST<int *>((g_manager + 1))) {
|
|
bVar3 = NetplayManager::IsIdxLocalPlayer
|
|
(GHIDRA_CAST<NetplayManager *>(&g_manager->_netplayManager),this->_controllerID);
|
|
goto LAB_006d445e;
|
|
}
|
|
}
|
|
else {
|
|
pvVar7 = (GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::GetNullFrame(GHIDRA_CAST<uint8_t *>("OverlayEffect"));
|
|
if (pvVar7 == (void *)0x0) goto LAB_006d44a0;
|
|
bVar3 = *GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(pvVar7) + 0xc));
|
|
LAB_006d445e:
|
|
if (bVar3 == 0) goto LAB_006d44a0;
|
|
}
|
|
local_84.x = (this->_renderPosition).x + 0.0;
|
|
local_84.y = (this->_renderPosition).y + 10.0;
|
|
render_debug(&local_84,this);
|
|
LAB_006d44a0:
|
|
if (((minecart != GHIDRA_CAST<Entity_NPC *>(0x0)) && (this->_visible != 0)) &&
|
|
((GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&minecart->_sprite))))->Sprite::RenderLayer(1,&renderPos,&g_vectorZero,&g_vectorZero),
|
|
this->_type == 0x38a)) {
|
|
NpcHelper::hornfel_render_minecart(this,GHIDRA_CAST<ANM2 *>((this->_minecart + 0x48)),&renderPos);
|
|
}
|
|
if ((((this->_controllerID != 0xffffffff) &&
|
|
((g_manager->_netplayManager == *GHIDRA_CAST<int *>((g_manager + 1)) ||
|
|
(bVar3 = NetplayManager::IsIdxLocalPlayer
|
|
(GHIDRA_CAST<NetplayManager *>(&g_manager->_netplayManager),this->_controllerID),
|
|
bVar3 != 0)))) && ((this->_chargeBarSprite)._loaded != 0)) &&
|
|
(0.0 < (this->_chargeBarSprite)._color._tint[3])) {
|
|
fVar9 = (this->_sprite)._scale.y;
|
|
renderPos.y = (this->_renderPosition).y - fVar9 * 35.0;
|
|
renderPos.x = fVar9 * 12.0 + (this->_renderPosition).x;
|
|
ANM2::Render(&this->_chargeBarSprite,&renderPos,&g_vectorZero,&g_vectorZero);
|
|
}
|
|
if (((this->_flags & 0x1000002000000000) != 0) && ((GHIDRA_UINT(g_game->_debugFlags) >> 6 & 1) != 0)) {
|
|
sprintf(debugText,GHIDRA_CAST<uint8_t *>("%.02f"));
|
|
manager = g_manager;
|
|
local_ec._colorize[0] = 5.60519e-45;
|
|
local_ec._colorize[1] = 9.18341e-41;
|
|
local_ec._colorize[2] = 0.0;
|
|
local_ec._colorize[3] = 1.0;
|
|
local_ec._offset[0] = -NAN;
|
|
local_ec._offset[1] = 0.0;
|
|
local_ec._offset[2] = 0.0;
|
|
ehState = 3;
|
|
local_7c = g_displayPixelRatio * g_screenPointScale;
|
|
local_5c._unk = 0;
|
|
local_5c._red = 1.0;
|
|
local_5c._green = 0.0;
|
|
local_5c._blue = 1.0;
|
|
local_5c._alpha = 0.5;
|
|
local_68 = ((g_screenWidth - 338.0) * 0.5 + ((this->_pos).x - 60.0) * 0.65) * local_7c + 0.5;
|
|
dVar11 = floor((double)local_68);
|
|
local_70 = (float)dVar11 / local_7c;
|
|
local_68 = (((this->_pos).y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * local_7c + 0.5;
|
|
dVar11 = floor((double)local_68);
|
|
local_68 = (float)dVar11;
|
|
renderPos.x = local_70 + renderOffset->x;
|
|
renderPos.y = local_68 / local_7c + renderOffset->y;
|
|
Font::DrawStringScaled
|
|
(&manager->_font2_TeamMeatEx12,debugText,&renderPos,&local_5c,local_ec._colorize);
|
|
}
|
|
ExceptionList = savedExceptionList;
|
|
return;
|
|
}
|
|
|
|
// 006d4840
|
|
uint8_t Entity_NPC::RenderShadowLayer(Vector *offset)
|
|
{
|
|
uint8_t bVar1;
|
|
|
|
if (this->_type == 0x376) {
|
|
render_overlay(this,offset,1);
|
|
bVar1 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::RenderShadowLayer(offset);
|
|
return bVar1;
|
|
}
|
|
if ((this->_type == 0x13) && (this->_variant == 3)) {
|
|
RenderSegmentLink(this,offset,1);
|
|
}
|
|
bVar1 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::RenderShadowLayer(offset);
|
|
return bVar1;
|
|
}
|
|
|
|
// 006d4a00
|
|
uint8_t Entity_NPC::CanBeDamagedFromVelocity(Vector velocity)
|
|
{
|
|
uint32_t uVar1;
|
|
int iVar2;
|
|
int cmpResult;
|
|
uint32_t uVar3;
|
|
uint8_t *cmpName;
|
|
bool bVar4;
|
|
std_string *psVar5;
|
|
Vector facingDir;
|
|
uint8_t isDamageable;
|
|
std_string animName;
|
|
uint32_t local_14;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
void *animData;
|
|
uint32_t animNameBuf;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00af32ed;
|
|
local_10 = ExceptionList;
|
|
local_14 = __security_cookie ^ GHIDRA_INT(&animName) + 0x28U;
|
|
iVar2 = this->_type;
|
|
if (iVar2 != 0x29) {
|
|
if (iVar2 == 0x61) {
|
|
ExceptionList = &local_10;
|
|
iVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::get_velocity_direction();
|
|
goto LAB_006d4d66;
|
|
}
|
|
if ((iVar2 != 0xfe) && (iVar2 != 0x11b)) {
|
|
if (iVar2 == 0x387) {
|
|
if (this->_variant != 1) {
|
|
return 1;
|
|
}
|
|
if ((velocity.x == g_vectorZero.x) && (velocity.y == g_vectorZero.y)) {
|
|
return 1;
|
|
}
|
|
ExceptionList = &local_10;
|
|
iVar2 = vector_to_direction(&velocity);
|
|
if (iVar2 == this->_i1) {
|
|
ExceptionList = local_10;
|
|
return 1;
|
|
}
|
|
ExceptionList = local_10;
|
|
return 0;
|
|
}
|
|
if (iVar2 != 0x17) {
|
|
return 1;
|
|
}
|
|
if (this->_variant != 3) {
|
|
return 1;
|
|
}
|
|
ExceptionList = &local_10;
|
|
ANM2::GetAnimation(GHIDRA_CAST<ANM2 *>(&(this->_sprite)._animState),&animName);
|
|
local_8 = 0;
|
|
iVar2 = FUN_006da7d0(animName._size - 2,2,&DAT_00b1cde4);
|
|
if (iVar2 == 0) {
|
|
iVar2 = 1;
|
|
}
|
|
else {
|
|
iVar2 = FUN_006da7d0(animName._size - 4,4,&DAT_00b1cddc);
|
|
if (iVar2 == 0) {
|
|
iVar2 = 3;
|
|
}
|
|
else {
|
|
iVar2 = 2;
|
|
if ((this->_sprite)._flipX != 0) {
|
|
iVar2 = 0;
|
|
}
|
|
}
|
|
}
|
|
Isaac::GetAxisAlignedUnitVectorFromDir(&facingDir,iVar2);
|
|
animNameBuf = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(animName._buf)) + 0x0)));
|
|
uVar3 = 6;
|
|
if (animName._size < 6) {
|
|
uVar3 = animName._size;
|
|
}
|
|
psVar5 = &animName;
|
|
if (0xf < animName._capacity) {
|
|
psVar5 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(animName._buf))) + 0x0)));
|
|
}
|
|
cmpResult = string_compare(GHIDRA_CAST<uint8_t *>(psVar5),uVar3,GHIDRA_CAST<uint8_t *>("Attack"),6);
|
|
if (cmpResult == 0) {
|
|
facingDir.x = 0.70710677;
|
|
psVar5 = GHIDRA_CAST<std_string *>(0x3f3504f3);
|
|
if (iVar2 == 1) {
|
|
psVar5 = GHIDRA_CAST<std_string *>(0xbf3504f3);
|
|
}
|
|
if ((this->_sprite)._flipX != 0) {
|
|
facingDir.x = -0.70710677;
|
|
}
|
|
}
|
|
else {
|
|
psVar5 = GHIDRA_CAST<std_string *>(facingDir.y);
|
|
}
|
|
isDamageable = 0.0 <= (float)psVar5 * velocity.y + facingDir.x * velocity.x;
|
|
if (0xf < animName._capacity) {
|
|
uVar3 = animName._capacity + 1;
|
|
psVar5 = GHIDRA_CAST<std_string *>(animNameBuf);
|
|
if (0xfff < uVar3) {
|
|
psVar5 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>((animNameBuf + -0x18)))->_capacity);
|
|
uVar3 = animName._capacity + 0x24;
|
|
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>((animNameBuf + (-4 - GHIDRA_INT(psVar5))))) goto LAB_006d4d56;
|
|
}
|
|
operator_delete(psVar5,uVar3);
|
|
}
|
|
ExceptionList = local_10;
|
|
return isDamageable;
|
|
}
|
|
}
|
|
animData = (this->_sprite)._animState._animData;
|
|
if (animData == (void *)0x0) {
|
|
animName._capacity = 0xf;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(animName._buf)) + 0x0))) = GHIDRA_CAST<std_string *>(0x0);
|
|
animName._size = 0;
|
|
ExceptionList = &local_10;
|
|
}
|
|
else {
|
|
ExceptionList = &local_10;
|
|
(GHIDRA_CAST<msvc::string *>((animName._buf)))->msvc::string::string(animData);
|
|
}
|
|
psVar5 = &animName;
|
|
if (0xf < animName._capacity) {
|
|
psVar5 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(animName._buf))) + 0x0)));
|
|
}
|
|
cmpName = GHIDRA_CAST<uint8_t *>(&DAT_00b1cde4);
|
|
uVar3 = animName._size;
|
|
if (2 < animName._size) {
|
|
uVar3 = 2;
|
|
}
|
|
while (uVar1 = uVar3 - 4, 3 < uVar3) {
|
|
if (*GHIDRA_CAST<std_string **>(psVar5->_buf) != *GHIDRA_CAST<std_string **>(cmpName)) goto LAB_006d4c56;
|
|
psVar5 = GHIDRA_CAST<std_string *>((psVar5->_buf + 4));
|
|
cmpName = cmpName + 4;
|
|
uVar3 = uVar1;
|
|
}
|
|
if (uVar1 == 0xfffffffc) {
|
|
LAB_006d4c8a:
|
|
uVar3 = 0;
|
|
}
|
|
else {
|
|
LAB_006d4c56:
|
|
bVar4 = (uint8_t)psVar5->_buf[0] < *cmpName;
|
|
if ((psVar5->_buf[0] == *cmpName) &&
|
|
((uVar1 == 0xfffffffd ||
|
|
((bVar4 = (uint8_t)psVar5->_buf[1] < cmpName[1], psVar5->_buf[1] == cmpName[1] &&
|
|
((uVar1 == 0xfffffffe ||
|
|
((bVar4 = (uint8_t)psVar5->_buf[2] < cmpName[2], psVar5->_buf[2] == cmpName[2] &&
|
|
((uVar1 == 0xffffffff ||
|
|
(bVar4 = (uint8_t)psVar5->_buf[3] < cmpName[3], psVar5->_buf[3] == cmpName[3]))))))))))))
|
|
goto LAB_006d4c8a;
|
|
uVar3 = -GHIDRA_UINT(bVar4) | 1;
|
|
}
|
|
if (((uVar3 == 0) && (1 < animName._size)) && (animName._size < 3)) {
|
|
iVar2 = 1;
|
|
}
|
|
else {
|
|
psVar5 = &animName;
|
|
if (0xf < animName._capacity) {
|
|
psVar5 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(animName._buf))) + 0x0)));
|
|
}
|
|
cmpName = &DAT_00b60d94;
|
|
uVar3 = animName._size;
|
|
if (4 < animName._size) {
|
|
uVar3 = 4;
|
|
}
|
|
while (uVar1 = uVar3 - 4, 3 < uVar3) {
|
|
if (*GHIDRA_CAST<std_string **>(psVar5->_buf) != *GHIDRA_CAST<std_string **>(cmpName)) goto LAB_006d4cd6;
|
|
psVar5 = GHIDRA_CAST<std_string *>((psVar5->_buf + 4));
|
|
cmpName = cmpName + 4;
|
|
uVar3 = uVar1;
|
|
}
|
|
if (uVar1 == 0xfffffffc) {
|
|
LAB_006d4d0a:
|
|
uVar3 = 0;
|
|
}
|
|
else {
|
|
LAB_006d4cd6:
|
|
bVar4 = (uint8_t)psVar5->_buf[0] < *cmpName;
|
|
if ((psVar5->_buf[0] == *cmpName) &&
|
|
((uVar1 == 0xfffffffd ||
|
|
((bVar4 = (uint8_t)psVar5->_buf[1] < cmpName[1], psVar5->_buf[1] == cmpName[1] &&
|
|
((uVar1 == 0xfffffffe ||
|
|
((bVar4 = (uint8_t)psVar5->_buf[2] < cmpName[2], psVar5->_buf[2] == cmpName[2] &&
|
|
((uVar1 == 0xffffffff ||
|
|
(bVar4 = (uint8_t)psVar5->_buf[3] < cmpName[3], psVar5->_buf[3] == cmpName[3]))))))))))))
|
|
goto LAB_006d4d0a;
|
|
uVar3 = -GHIDRA_UINT(bVar4) | 1;
|
|
}
|
|
if (((uVar3 == 0) && (3 < animName._size)) && (animName._size < 5)) {
|
|
iVar2 = 0;
|
|
if ((this->_sprite)._flipX == 0) {
|
|
iVar2 = 2;
|
|
}
|
|
}
|
|
else {
|
|
iVar2 = 3;
|
|
}
|
|
}
|
|
if (0xf < animName._capacity) {
|
|
uVar3 = animName._capacity + 1;
|
|
psVar5 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<std_string *>(animName._buf))) + 0x0)));
|
|
facingDir.y = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)animName._buf)) + 0x0)));
|
|
if (0xfff < uVar3) {
|
|
psVar5 = GHIDRA_CAST<std_string *>((GHIDRA_CAST<std_string *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(animName._buf)) + 0x0))) + -0x18)))->_capacity);
|
|
uVar3 = animName._capacity + 0x24;
|
|
if (GHIDRA_CAST<uint8_t *>(0x1f) < GHIDRA_CAST<uint8_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(animName._buf)) + 0x0))) + (-4 - GHIDRA_INT(psVar5))))) {
|
|
LAB_006d4d56:
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(psVar5,uVar3);
|
|
}
|
|
LAB_006d4d66:
|
|
if ((((0.0 <= velocity.x) || (iVar2 != 2)) &&
|
|
(((velocity.x <= 0.0 || (iVar2 != 0)) && ((velocity.y <= 0.0 || (iVar2 != 1)))))) &&
|
|
((0.0 <= velocity.y || (iVar2 != 3)))) {
|
|
ExceptionList = local_10;
|
|
return 1;
|
|
}
|
|
ExceptionList = local_10;
|
|
return 0;
|
|
}
|
|
|
|
// 006d4db0
|
|
uint8_t Entity_NPC::CanReroll()
|
|
{
|
|
char cVar1;
|
|
|
|
if (((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this->_config) + 0xd8)) & 0x10) == 0) &&
|
|
(((this->_type != 0x104 || (this->_variant != 10)) || (this->_parent == 0)))) {
|
|
cVar1 = this->IsBoss();
|
|
if ((cVar1 == '\0') && (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this->_config) + 0x2c)) == '\0')) {
|
|
return 1;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
// 006d4e00
|
|
void Entity_NPC::PlayDeathEffects()
|
|
{
|
|
int iVar1;
|
|
void *layerFrame;
|
|
int *bloodEffect;
|
|
uint32_t seed;
|
|
Entity *effect;
|
|
uint32_t uVar2;
|
|
float fVar3;
|
|
Vector splatOffset;
|
|
Vector local_10;
|
|
Manager *manager;
|
|
|
|
iVar1 = PlayerManager::GetGFuelCount();
|
|
if (0 < iVar1) {
|
|
spawn_gfuel_explosion();
|
|
return;
|
|
}
|
|
splatOffset.x = g_vectorZero.x;
|
|
splatOffset.y = g_vectorZero.y;
|
|
if (((this->_sprite)._animState._animData != (void *)0x0) &&
|
|
(((this->_type != 0x38d || (this->_variant != 10)) &&
|
|
(layerFrame = AnimationState::GetLayerFrame(&(this->_sprite)._animState,0),
|
|
layerFrame != (void *)0x0)))) {
|
|
splatOffset.x =
|
|
(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(layerFrame) + 8)) * 0.5 - *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(layerFrame) + 0x20))) +
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(layerFrame) + 0x10));
|
|
splatOffset.y =
|
|
(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(layerFrame) + 0xc)) * 0.5 - *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(layerFrame) + 0x24))) +
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(layerFrame) + 0x14));
|
|
}
|
|
manager = g_manager;
|
|
if ((this->_flags & 0x10000) != 0) {
|
|
return;
|
|
}
|
|
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this->_config) + 0x60)) >> 5 & 1) != 0) {
|
|
local_10.x = 3.32108e-43;
|
|
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_10));
|
|
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_10.x),0.9,2,0,1.0,0.0);
|
|
uVar2 = 0x2b;
|
|
goto LAB_006d51b2;
|
|
}
|
|
iVar1 = this->_type;
|
|
if (iVar1 < 0x11a) {
|
|
if (iVar1 != 0x119) {
|
|
switch(iVar1) {
|
|
case 0xd:
|
|
case 0xe:
|
|
case 0x12:
|
|
case 0xd6:
|
|
case 0xde:
|
|
case 0xf9:
|
|
case 0x100:
|
|
break;
|
|
default:
|
|
goto LAB_006d4f7c;
|
|
case 0x55:
|
|
case 0x5e:
|
|
case 0xd7:
|
|
case 0xfa:
|
|
code_r0x006d519f:
|
|
uVar2 = 0x26;
|
|
goto LAB_006d51b2;
|
|
}
|
|
}
|
|
LAB_006d51a6:
|
|
uVar2 = 3;
|
|
}
|
|
else {
|
|
if (0x346 < iVar1) {
|
|
switch(iVar1) {
|
|
case 0x355:
|
|
uVar2 = 0x83;
|
|
goto LAB_006d51b2;
|
|
default:
|
|
goto LAB_006d4f7c;
|
|
case 0x364:
|
|
goto LAB_006d51a6;
|
|
case 0x365:
|
|
case 0x374:
|
|
goto code_r0x006d519f;
|
|
}
|
|
}
|
|
if (iVar1 == 0x346) goto LAB_006d51a6;
|
|
if (iVar1 < 0x32b) {
|
|
if (iVar1 != 0x32a) {
|
|
if ((iVar1 != 0x128) && (iVar1 != 0x328)) goto LAB_006d4f7c;
|
|
goto LAB_006d51a6;
|
|
}
|
|
uVar2 = 0x82;
|
|
}
|
|
else {
|
|
if (iVar1 != 0x332) {
|
|
LAB_006d4f7c:
|
|
fVar3 = this->_size;
|
|
uVar2 = 2;
|
|
if (fVar3 < 13.0) {
|
|
uVar2 = 1;
|
|
}
|
|
if ((18.0 <= fVar3) || (30.0 < this->_shadowSize)) {
|
|
uVar2 = 3;
|
|
}
|
|
if ((40.0 <= fVar3) || (50.0 < this->_shadowSize)) {
|
|
uVar2 = 4;
|
|
}
|
|
seed = Random();
|
|
effect = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,2,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),uVar2,seed,0);
|
|
bloodEffect = GHIDRA_CAST<int *>(__RTDynamicCast(effect,0,&IsaacRepentancePlus::Entity::
|
|
RTTI_Type_Descriptor,
|
|
&IsaacRepentancePlus::Entity_Effect::
|
|
RTTI_Type_Descriptor,0));
|
|
bloodEffect[0x37] = GHIDRA_INT(splatOffset.x);
|
|
bloodEffect[0x38] = GHIDRA_INT(splatOffset.y);
|
|
(**(code **)(*bloodEffect + 0x3c))(&this->_splatColor,0xffffffff,0xff,0,1);
|
|
bloodEffect[0xd6] = 0x41200000;
|
|
goto LAB_006d505b;
|
|
}
|
|
uVar2 = 0x91;
|
|
}
|
|
}
|
|
LAB_006d51b2:
|
|
seed = Random();
|
|
local_10.x = splatOffset.x + (this->_pos).x;
|
|
local_10.y = splatOffset.y + (this->_pos).y;
|
|
effect = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,uVar2,&local_10,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,seed,0);
|
|
effect->SetColor(&this->_splatColor,0xffffffff,0xff,0,1);
|
|
LAB_006d505b:
|
|
if (this->_type == 0x372) {
|
|
uVar2 = Random();
|
|
effect = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0x12,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar2,0);
|
|
iVar1 = *GHIDRA_CAST<int *>(effect);
|
|
(effect->_sprite)._color._colorize[0] = 5.0;
|
|
(effect->_sprite)._color._colorize[1] = 5.0;
|
|
(effect->_sprite)._color._colorize[2] = 5.0;
|
|
(effect->_sprite)._color._colorize[3] = 1.0;
|
|
(**(code **)(iVar1 + 0xc))();
|
|
uVar2 = Random();
|
|
effect = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0x10,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(this),1,uVar2,0);
|
|
fVar3 = g_vectorOne.y * 0.6;
|
|
(effect->_sprite)._scale.x = g_vectorOne.x * 0.6;
|
|
(effect->_sprite)._scale.y = fVar3;
|
|
uVar2 = Random();
|
|
(effect->_sprite)._flipX = ~(uint8_t)uVar2 & 1;
|
|
effect->Update();
|
|
PlaySound(this,0xcf,1.0,2,0,1.0);
|
|
PlaySound(this,0x50,0.8,2,0,1.0);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006d5400
|
|
void Entity_NPC::trigger_kill_item_effects()
|
|
{
|
|
Vector *pos;
|
|
code *pcVar1;
|
|
ColorMod color;
|
|
uint8_t bVar2;
|
|
uint32_t uVar3;
|
|
Entity_Player *itemOwner;
|
|
Entity_Laser *mawOfVoid;
|
|
EntityConfig_Entity *entityConfig;
|
|
ColorMod *color_00;
|
|
int *playerIt;
|
|
uint8_t unused;
|
|
uint8_t unused_00;
|
|
int iVar4;
|
|
ActiveItemDesc *activeSlot;
|
|
void *pvVar5;
|
|
uint64_t *allocCounter;
|
|
int iVar6;
|
|
PlayerManager *playerManager;
|
|
float damage;
|
|
Color aCStackY_1960 [128];
|
|
uint32_t in_stack_fffffcdc;
|
|
uint32_t in_stack_fffffce0;
|
|
Vector *in_stack_fffffce4;
|
|
Vector *in_stack_fffffce8;
|
|
EntityRef baitSource;
|
|
EntityRef iceSource;
|
|
EntityRef magnetizeSource;
|
|
EntityRef burnSource;
|
|
EntityRef confusionSource;
|
|
EntityRef charmSource;
|
|
EntityRef fearSource;
|
|
EntityRef shrinkSource;
|
|
EntityRef freezeSource;
|
|
EntityRef midasSource;
|
|
EntityRef poisonSource;
|
|
EntityRef slowSource;
|
|
EntityRef brimstoneMarkSource;
|
|
Vector freeTilePos;
|
|
uint64_t local_e0;
|
|
uint32_t local_d8;
|
|
EntityRef damageSource;
|
|
uint8_t nearbyEnemies [12];
|
|
float fStack_a0;
|
|
EntityList_EL contagionEnemies;
|
|
int local_8c [3];
|
|
uint32_t local_80;
|
|
void **eraseKey;
|
|
float slowingAmount;
|
|
Entity_Player *local_74;
|
|
float local_70;
|
|
Color poofColor;
|
|
ColorMod fartColor;
|
|
uint32_t stackCookie;
|
|
void *prevExceptionList;
|
|
uint8_t *puStack_c;
|
|
float ehState;
|
|
int enemyIdx;
|
|
void **aimTargetSlot;
|
|
uint32_t flagsHigh;
|
|
Game *game;
|
|
Entity_NPC *nearbyEnemy;
|
|
uint64_t prevAllocBytes;
|
|
|
|
ehState = -NAN;
|
|
puStack_c = &LAB_00afac5b;
|
|
prevExceptionList = ExceptionList;
|
|
stackCookie = __security_cookie ^ GHIDRA_UINT((&fartColor)[1]._colorize);
|
|
ExceptionList = &prevExceptionList;
|
|
if (this->_isBoss == 0) {
|
|
if (this->_isChampion != 0) {
|
|
NpcHelper::ChampionDrop(this);
|
|
}
|
|
}
|
|
else {
|
|
(GHIDRA_CAST<Room *>((g_game->_room)))->Room::TriggerBossDeath(GHIDRA_CAST<Entity *>(this));
|
|
}
|
|
if ((this->_type == 0x38f) && (this->_variant == 1)) {
|
|
rotgut_death_spawn_effects(this);
|
|
}
|
|
if ((this->_flags & 0x400000) != 0) {
|
|
if ((this->_killDamageFlags & 4) == 0) {
|
|
uVar3 = Random();
|
|
iVar6 = uVar3 % 3 + 1;
|
|
}
|
|
else {
|
|
uVar3 = Random();
|
|
iVar6 = uVar3 % 5 + 2;
|
|
}
|
|
if (iVar6 != 0) {
|
|
do {
|
|
itemOwner = (GHIDRA_CAST<Game *>((g_game)))->Game::GetNearestPlayer(&this->_pos);
|
|
itemOwner->_numBlueSpiders = itemOwner->_numBlueSpiders + 1;
|
|
spawn_blue_spider(&this->_pos,GHIDRA_CAST<Entity *>(itemOwner),&g_vectorZero);
|
|
iVar6 = iVar6 + -1;
|
|
} while (iVar6 != 0);
|
|
}
|
|
}
|
|
local_70 = 0.0;
|
|
if ((this->_flags & 0x40000000000) == 0) {
|
|
if ((this->_flags & 0x800000) != 0) {
|
|
uVar3 = (this->_dropRNG)._seed;
|
|
if (uVar3 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
|
|
uVar3 = (this->_dropRNG)._seed;
|
|
if (uVar3 == 0) {
|
|
pcVar1 = (code *)swi(3);
|
|
(*pcVar1)();
|
|
return;
|
|
}
|
|
}
|
|
uVar3 = uVar3 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar3;
|
|
uVar3 = uVar3 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar3;
|
|
uVar3 = uVar3 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar3;
|
|
(this->_dropRNG)._seed = uVar3;
|
|
if (uVar3 == (uVar3 / 5) * 5) {
|
|
uVar3 = Random();
|
|
game = g_game;
|
|
in_stack_fffffce8 = (GHIDRA_CAST<Room *>((g_game->_room)))->Room::FindFreeTilePosition(&freeTilePos,&this->_pos,0.0);
|
|
in_stack_fffffce4 = GHIDRA_CAST<Vector *>(0xa);
|
|
in_stack_fffffce0 = 5;
|
|
in_stack_fffffcdc = 0x6d55be;
|
|
(GHIDRA_CAST<Game *>((game)))->Game::Spawn(5,10,in_stack_fffffce8,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),6,uVar3);
|
|
}
|
|
}
|
|
game = g_game;
|
|
uVar3 = (this->_dropRNG)._seed;
|
|
if (uVar3 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
|
|
uVar3 = (this->_dropRNG)._seed;
|
|
if (uVar3 == 0) {
|
|
pcVar1 = (code *)swi(3);
|
|
(*pcVar1)();
|
|
return;
|
|
}
|
|
}
|
|
uVar3 = uVar3 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar3;
|
|
uVar3 = uVar3 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar3;
|
|
uVar3 = uVar3 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar3;
|
|
(this->_dropRNG)._seed = uVar3;
|
|
itemOwner = (GHIDRA_CAST<PlayerManager *>((&game->_playerManager)))->PlayerManager::RandomCollectibleOwner(0x1b2,uVar3,GHIDRA_CAST<RNG **>(0x0))
|
|
;
|
|
if ((itemOwner != GHIDRA_CAST<Entity_Player *>(0x0)) &&
|
|
((this->_flags & 0x10000020) != 0 || (this->_flags & 0x2000000000000) != 0)) {
|
|
iVar4 = itemOwner->_jarFlies + 1;
|
|
iVar6 = 0x14;
|
|
if (iVar4 < 0x14) {
|
|
iVar6 = iVar4;
|
|
}
|
|
itemOwner->_jarFlies = iVar6;
|
|
game = g_game;
|
|
if ((g_game->_hud)._hudRefreshType != 2) {
|
|
(g_game->_hud)._hudRefreshType = 1;
|
|
(game->_hud)._hudRefreshCountdown = 2;
|
|
}
|
|
}
|
|
}
|
|
if (this->_type == 0x197) {
|
|
flagsHigh = *GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4));
|
|
*GHIDRA_CAST<uint32_t *>(&this->_flags) = GHIDRA_UINT(this->_flags) | 8;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&this->_flags) + 4)) = flagsHigh;
|
|
}
|
|
else {
|
|
this->Remove();
|
|
}
|
|
itemOwner = PlayerManager::FirstCollectibleOwner
|
|
(&g_game->_playerManager,0x1d2,GHIDRA_CAST<RNG **>(&g_game->_playerManager),0);
|
|
if ((itemOwner != GHIDRA_CAST<Entity_Player *>(0x0)) &&
|
|
(((this->_flags & 0x200000000) != 0 || (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(g_game->_room) + 0x72a0)) == '\0')))) {
|
|
pos = &this->_pos;
|
|
fartColor._tint[0] = 1.0;
|
|
fartColor._tint[1] = 1.0;
|
|
fartColor._tint[2] = 1.0;
|
|
fartColor._tint[3] = 1.0;
|
|
in_stack_fffffce8 = GHIDRA_CAST<Vector *>(0x42aa0000);
|
|
fartColor._offset[0] = 0.0;
|
|
fartColor._colorize[0] = 0.0;
|
|
fartColor._colorize[1] = 0.0;
|
|
fartColor._colorize[2] = 0.0;
|
|
fartColor._colorize[3] = 0.0;
|
|
fartColor._offset[1] = 0.0;
|
|
fartColor._offset[2] = 0.0;
|
|
in_stack_fffffce0 = 0x6d573a;
|
|
in_stack_fffffce4 = pos;
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::Fart(pos,85.0,GHIDRA_CAST<Entity *>(itemOwner),1.0,1,&fartColor);
|
|
EntityList::QueryRadius
|
|
(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),&contagionEnemies,pos,85.0,8);
|
|
uVar3 = 0;
|
|
ehState = 0.0;
|
|
if (contagionEnemies._size != 0) {
|
|
do {
|
|
nearbyEnemy = *GHIDRA_CAST<Entity_NPC **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contagionEnemies)) + 0x4))) + uVar3 * 4));
|
|
if ((nearbyEnemy != this) &&
|
|
(bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(nearbyEnemy))))->Entity::IsVulnerableEnemy(GHIDRA_CAST<Entity *>(0x0)), bVar2 != 0)) {
|
|
iVar6 = *GHIDRA_CAST<int *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contagionEnemies)) + 0x4))) + uVar3 * 4));
|
|
*GHIDRA_CAST<uint32_t *>((iVar6 + 0x16c)) = *GHIDRA_CAST<uint32_t *>((iVar6 + 0x16c)) | 2;
|
|
*GHIDRA_CAST<uint32_t *>((iVar6 + 0x168)) = *GHIDRA_CAST<uint32_t *>((iVar6 + 0x168));
|
|
}
|
|
uVar3 = uVar3 + 1;
|
|
} while (uVar3 < GHIDRA_UINT(contagionEnemies._size));
|
|
}
|
|
ehState = -NAN;
|
|
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(contagionEnemies)) + 0x0))) == '\0') {
|
|
if (g_mainHeap == (void *)0x0) {
|
|
allocCounter = &g_allocatedBytesNoHeap;
|
|
}
|
|
else {
|
|
allocCounter = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
|
|
}
|
|
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contagionEnemies)) + 0x4))) != 0) {
|
|
uVar3 = *GHIDRA_CAST<uint32_t *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contagionEnemies)) + 0x4))) + -4));
|
|
prevAllocBytes = *allocCounter;
|
|
*GHIDRA_CAST<uint32_t *>(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar3;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) =
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevAllocBytes) < uVar3));
|
|
free((void *)((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(contagionEnemies)) + 0x4))) + -4));
|
|
}
|
|
ehState = -NAN;
|
|
}
|
|
}
|
|
local_74 = PlayerManager::FirstCollectibleOwner
|
|
(&g_game->_playerManager,0x198,GHIDRA_CAST<RNG **>(&g_game->_playerManager),0);
|
|
if (local_74 != GHIDRA_CAST<Entity_Player *>(0x0)) {
|
|
uVar3 = this->_initSeed;
|
|
local_e0 = 0x70000000b;
|
|
local_d8 = 0xc;
|
|
if (uVar3 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
|
|
pcVar1 = (code *)swi(3);
|
|
(*pcVar1)();
|
|
return;
|
|
}
|
|
uVar3 = uVar3 >> 0xb ^ uVar3;
|
|
uVar3 = uVar3 << 7 ^ uVar3;
|
|
uVar3 = uVar3 >> 0xc ^ uVar3;
|
|
for (playerIt = (g_game->_playerManager)._playerList._begin;
|
|
playerIt != (g_game->_playerManager)._playerList._end; playerIt = playerIt + 1) {
|
|
iVar6 = *playerIt;
|
|
if ((*GHIDRA_CAST<int *>((iVar6 + 0x2c)) == 0) && (*GHIDRA_CAST<char *>((iVar6 + 0x20a9)) == '\0')) {
|
|
local_70 = local_70 + *GHIDRA_CAST<float *>((iVar6 + 0x156c));
|
|
}
|
|
}
|
|
if ((float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * 2.3283062e-10
|
|
< local_70 * 0.025 + 0.25) {
|
|
mawOfVoid = (GHIDRA_CAST<Entity_Player *>((local_74)))->Entity_Player::SpawnMawOfVoid(0x3c);
|
|
iVar6 = *GHIDRA_CAST<int *>(mawOfVoid);
|
|
(mawOfVoid->_pos).x = (this->_pos).x;
|
|
(mawOfVoid->_pos).y = (this->_pos).y;
|
|
mawOfVoid->_disableFollowParent = 1;
|
|
(**(code **)(iVar6 + 0xc))();
|
|
}
|
|
}
|
|
if (((((this->_flags & 0x20000000) != 0) && (g_game->_challenge == 0x21)) &&
|
|
(itemOwner = PlayerManager::FirstCollectibleOwner
|
|
(&g_game->_playerManager,0x17e,GHIDRA_CAST<RNG **>(&g_game->_playerManager),1),
|
|
itemOwner != GHIDRA_CAST<Entity_Player *>(0x0))) &&
|
|
(((this->_spawnerType == 1 || (this->_spawnerType == 3)) &&
|
|
((itemOwner = GHIDRA_CAST<Entity_Player *>(this->_spawnerEntity), itemOwner != GHIDRA_CAST<Entity_Player *>(0x0) &&
|
|
(itemOwner->_type == 1)))))) {
|
|
uVar3 = 0;
|
|
activeSlot = itemOwner->_activeDesc;
|
|
do {
|
|
if (activeSlot->_item == 0x17e) {
|
|
if (-1 < GHIDRA_INT(uVar3)) {
|
|
(GHIDRA_CAST<Entity_Player *>((itemOwner)))->Entity_Player::FullCharge(uVar3,0,0);
|
|
}
|
|
break;
|
|
}
|
|
uVar3 = uVar3 + 1;
|
|
activeSlot = activeSlot + 1;
|
|
} while (uVar3 < 4);
|
|
}
|
|
game = g_game;
|
|
if ((this->_flags & 0x800000000000000) != 0) {
|
|
uVar3 = (this->_dropRNG)._seed;
|
|
if (uVar3 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
|
|
uVar3 = (this->_dropRNG)._seed;
|
|
if (uVar3 == 0) {
|
|
pcVar1 = (code *)swi(3);
|
|
(*pcVar1)();
|
|
return;
|
|
}
|
|
}
|
|
uVar3 = uVar3 >> ((uint8_t)(this->_dropRNG)._shift1 & 0x1f) ^ uVar3;
|
|
uVar3 = uVar3 << ((uint8_t)(this->_dropRNG)._shift2 & 0x1f) ^ uVar3;
|
|
uVar3 = uVar3 >> ((uint8_t)(this->_dropRNG)._shift3 & 0x1f) ^ uVar3;
|
|
(this->_dropRNG)._seed = uVar3;
|
|
itemOwner = (GHIDRA_CAST<PlayerManager *>((&game->_playerManager)))->PlayerManager::RandomCollectibleOwner(0x248,uVar3,GHIDRA_CAST<RNG **>(0x0))
|
|
;
|
|
if (((itemOwner != GHIDRA_CAST<Entity_Player *>(0x0)) && (itemOwner->_type == 1)) &&
|
|
(entityConfig = EntityConfig::GetEntity
|
|
(&g_manager->_entityConfig,this->_type,this->_variant,0),
|
|
entityConfig != GHIDRA_CAST<EntityConfig_Entity *>(0x0))) {
|
|
uVar3 = entityConfig->tags;
|
|
local_80 = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((entityConfig)) + 0xdc))));
|
|
if ((uVar3 & 0x80) == 0) {
|
|
if ((uVar3 & 0x40) == 0) {
|
|
if ((uVar3 & 0x100) == 0) {
|
|
iVar6 = 0x1000a;
|
|
}
|
|
else {
|
|
iVar6 = 0x1000d;
|
|
}
|
|
}
|
|
else {
|
|
iVar6 = 0x1000b;
|
|
}
|
|
}
|
|
else {
|
|
iVar6 = 0x1000c;
|
|
}
|
|
in_stack_fffffce8 = GHIDRA_CAST<Vector *>(0x6d5aab);
|
|
Entity_Player::AddWisp(itemOwner,iVar6,&this->_pos,0,0);
|
|
}
|
|
}
|
|
*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(g_game->_room) + 0x72a0)) = 1;
|
|
if (this->_type == 0x3c3) {
|
|
this->_type = this->_stateFrame;
|
|
Room::record_killed_npc();
|
|
this->_type = 0x3c3;
|
|
}
|
|
else {
|
|
Room::record_killed_npc();
|
|
}
|
|
if (this->_entityRef != 0) {
|
|
local_74 = GHIDRA_CAST<Entity_Player *>(&this->_entityRef);
|
|
msvc::multiset<unsigned_int>::erase();
|
|
}
|
|
this->_entityRef = 0;
|
|
aimTargetSlot = &this->_aimTargetEffect;
|
|
if (*aimTargetSlot != (void *)0x0) {
|
|
eraseKey = aimTargetSlot;
|
|
msvc::multiset<unsigned_int>::erase();
|
|
}
|
|
*aimTargetSlot = (void *)0x0;
|
|
local_8c[2] = GHIDRA_INT(this->_flags);
|
|
if (((this->_flags & 0x100000000000000) != 0) && ((this->_flags & 0x80000000000000) != 0)) {
|
|
EntityList::QueryRadius
|
|
(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST<EntityList_EL *>(nearbyEnemies),
|
|
&this->_pos,120.0,8);
|
|
ehState = 2.8026e-45;
|
|
local_70 = 0.0;
|
|
if (fStack_a0 != 0.0) {
|
|
do {
|
|
enemyIdx = GHIDRA_INT(local_70);
|
|
nearbyEnemy = *GHIDRA_CAST<Entity_NPC **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(nearbyEnemies)) + 0x4))) + GHIDRA_INT(local_70) * 4));
|
|
if ((nearbyEnemy != this) &&
|
|
(bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(nearbyEnemy))))->Entity::IsVulnerableEnemy(GHIDRA_CAST<Entity *>(0x0)), bVar2 != 0)) {
|
|
::(GHIDRA_CAST<EntityRef *>((&brimstoneMarkSource)))->EntityRef::constructor(GHIDRA_CAST<Entity *>(0x0));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(nearbyEnemy))))->Entity::AddBrimstoneMark(&brimstoneMarkSource,0x96);
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x80);
|
|
if (bVar2 != 0) {
|
|
slowingAmount = this->_slowingAmount;
|
|
::(GHIDRA_CAST<EntityRef *>((&slowSource)))->EntityRef::constructor(GHIDRA_CAST<Entity *>(0x0));
|
|
bVar2 = 0;
|
|
(GHIDRA_CAST<Color *>((aCStackY_1960 + 0x81)))->Color::Reset();
|
|
color._tint[2] = 1.3;
|
|
color._tint[0] = 1.0;
|
|
color._tint[1] = 1.0;
|
|
color._tint[3] = 1.0;
|
|
color._colorize[0] = (float)in_stack_fffffcdc;
|
|
color._colorize[1] = (float)in_stack_fffffce0;
|
|
color._colorize[2] = (float)in_stack_fffffce4;
|
|
color._colorize[3] = (float)in_stack_fffffce8;
|
|
color._offset[0] = 0.15686275;
|
|
color._offset[1] = 0.15686275;
|
|
color._offset[2] = 0.15686275;
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(nearbyEnemy))))->Entity::AddSlowing(&slowSource,0x5a,slowingAmount,color,bVar2);
|
|
enemyIdx = GHIDRA_INT(local_70);
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x40);
|
|
if (bVar2 != 0) {
|
|
damage = this->_poisonTickDamage;
|
|
::(GHIDRA_CAST<EntityRef *>((&poisonSource)))->EntityRef::constructor(GHIDRA_CAST<Entity *>(0x0));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(nearbyEnemy))))->Entity::AddPoison(&poisonSource,0x5a,damage,0);
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x400);
|
|
if (bVar2 == 0) {
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x20);
|
|
if (bVar2 != 0) {
|
|
::(GHIDRA_CAST<EntityRef *>((&freezeSource)))->EntityRef::constructor(GHIDRA_CAST<Entity *>(0x0));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(nearbyEnemy))))->Entity::AddFreeze(&freezeSource,0x5a,0);
|
|
}
|
|
}
|
|
else {
|
|
::(GHIDRA_CAST<EntityRef *>((&midasSource)))->EntityRef::constructor(GHIDRA_CAST<Entity *>(0x0));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(nearbyEnemy))))->Entity::AddMidasFreeze(&midasSource,0x5a,0);
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x1000000);
|
|
if (bVar2 == 0) {
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x800);
|
|
if (bVar2 != 0) {
|
|
::(GHIDRA_CAST<EntityRef *>((&fearSource)))->EntityRef::constructor(GHIDRA_CAST<Entity *>(0x0));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(nearbyEnemy))))->Entity::AddFear(&fearSource,0x5a,0);
|
|
}
|
|
}
|
|
else {
|
|
::(GHIDRA_CAST<EntityRef *>((&shrinkSource)))->EntityRef::constructor(GHIDRA_CAST<Entity *>(0x0));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(nearbyEnemy))))->Entity::AddShrink(&shrinkSource,0x5a,0,0);
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x100);
|
|
if (bVar2 != 0) {
|
|
::(GHIDRA_CAST<EntityRef *>((&charmSource)))->EntityRef::constructor(GHIDRA_CAST<Entity *>(0x0));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(nearbyEnemy))))->Entity::AddCharmed(&charmSource,0x5a,0,0);
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x200);
|
|
if (bVar2 != 0) {
|
|
::(GHIDRA_CAST<EntityRef *>((&confusionSource)))->EntityRef::constructor(GHIDRA_CAST<Entity *>(0x0));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(nearbyEnemy))))->Entity::AddConfusion(&confusionSource,0x5a,0);
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x1000);
|
|
if (bVar2 != 0) {
|
|
::(GHIDRA_CAST<EntityRef *>((&burnSource)))->EntityRef::constructor(GHIDRA_CAST<Entity *>(0x0));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(nearbyEnemy))))->Entity::AddBurn(&burnSource,0x5a,0.0,0);
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x8000000000000);
|
|
if (bVar2 != 0) {
|
|
::(GHIDRA_CAST<EntityRef *>((&magnetizeSource)))->EntityRef::constructor(GHIDRA_CAST<Entity *>(0x0));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(nearbyEnemy))))->Entity::AddMagnetized(&magnetizeSource,0x5a,unused);
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x4000000000000);
|
|
if (bVar2 != 0) {
|
|
::(GHIDRA_CAST<EntityRef *>((&iceSource)))->EntityRef::constructor(GHIDRA_CAST<Entity *>(0x0));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(nearbyEnemy))))->Entity::AddIce(&iceSource,0x5a);
|
|
}
|
|
bVar2 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x10000000000000);
|
|
if (bVar2 != 0) {
|
|
::(GHIDRA_CAST<EntityRef *>((&baitSource)))->EntityRef::constructor(GHIDRA_CAST<Entity *>(0x0));
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(nearbyEnemy))))->Entity::AddBaited(&baitSource,0x5a,unused_00);
|
|
}
|
|
damageSource._position.x = g_vectorZero.x;
|
|
damageSource._velocity.x = g_vectorZero.x;
|
|
damageSource._type = 0;
|
|
damageSource._position.y = g_vectorZero.y;
|
|
damageSource._velocity.y = g_vectorZero.y;
|
|
damageSource._variant = 0;
|
|
damageSource._spawnerType = 0;
|
|
damageSource._spawnerVariant = 0;
|
|
damageSource._flags = 0;
|
|
damageSource._entity = (void *)0x0;
|
|
in_stack_fffffce8 = GHIDRA_CAST<Vector *>(0x41200000);
|
|
in_stack_fffffce4 = GHIDRA_CAST<Vector *>(0x6d5f2e);
|
|
(**(code **)(**GHIDRA_CAST<int **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(nearbyEnemies)) + 0x4))) + enemyIdx * 4)) + 0x20))();
|
|
enemyIdx = GHIDRA_INT(local_70);
|
|
}
|
|
local_70 = (float)(enemyIdx + 1);
|
|
} while (GHIDRA_UINT(local_70) < GHIDRA_UINT(fStack_a0));
|
|
}
|
|
(GHIDRA_CAST<Color *>((&poofColor)))->Color::Color();
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::MakeBloodPoof(&this->_pos,color_00,1.0);
|
|
uVar3 = 0;
|
|
playerManager = &g_game->_playerManager;
|
|
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >>
|
|
2 != 0) {
|
|
do {
|
|
pvVar5 = (playerManager->_playerList)._end;
|
|
if (GHIDRA_INT(pvVar5) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("(GHIDRA_CAST<PlayerManager *>(()))->PlayerManager::GetPlayer() : There are no players! \n"));
|
|
pvVar5 = (playerManager->_playerList)._end;
|
|
}
|
|
playerIt = (playerManager->_playerList)._begin;
|
|
if (uVar3 < GHIDRA_UINT((GHIDRA_INT(pvVar5) - GHIDRA_INT(playerIt) >> 2))) {
|
|
playerIt = playerIt + uVar3;
|
|
}
|
|
iVar6 = *playerIt;
|
|
iVar4 = *GHIDRA_CAST<int *>((iVar6 + 0x13dc));
|
|
if (((iVar4 != 0) || (iVar4 = *GHIDRA_CAST<int *>((iVar6 + 0x13e0)), iVar4 != 0)) &&
|
|
(*GHIDRA_CAST<int *>((iVar4 + 0x30)) == 2)) {
|
|
(GHIDRA_CAST<TemporaryEffects *>((GHIDRA_CAST<TemporaryEffects *>((iVar6 + 0x1508)))))->TemporaryEffects::RemoveNullEffect(0x7f,-1);
|
|
pvVar5 = (g_manager->_itemConfig)._nullItems._begin;
|
|
if ((0x7f < GHIDRA_INT((g_manager->_itemConfig)._nullItems._end) - GHIDRA_INT(pvVar5) >> 2) &&
|
|
(iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar5) + 0x1fc)), iVar4 != 0)) {
|
|
local_8c[2] = *GHIDRA_CAST<uint32_t *>((iVar4 + 0x78));
|
|
local_8c[1] = 0;
|
|
local_80 = 0;
|
|
local_8c[0] = iVar4;
|
|
(GHIDRA_CAST<TemporaryEffects *>((GHIDRA_CAST<TemporaryEffects *>((iVar6 + 0x1508)))))->TemporaryEffects::AddEffect(local_8c,1,1);
|
|
}
|
|
}
|
|
uVar3 = uVar3 + 1;
|
|
playerManager = &g_game->_playerManager;
|
|
} while (uVar3 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
|
|
GHIDRA_INT((playerManager->_playerList)._begin) >> 2)));
|
|
}
|
|
ehState = -NAN;
|
|
if (nearbyEnemies[0] == '\0') {
|
|
ehState = 4.2039e-45;
|
|
tracked_alloc(1,(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)nearbyEnemies)) + 0x4))),0);
|
|
ehState = -NAN;
|
|
}
|
|
}
|
|
FUN_00860c90();
|
|
ExceptionList = prevExceptionList;
|
|
return;
|
|
}
|
|
|
|
// 006d6610
|
|
void Entity_NPC::SetScale(float scale)
|
|
{
|
|
float scaleX;
|
|
float spriteScale;
|
|
|
|
this->_scale = scale;
|
|
spriteScale = scale * this->_shrinkStatus1;
|
|
scaleX = spriteScale * g_vectorOne.x;
|
|
(this->_sprite)._scale.y = spriteScale * g_vectorOne.y;
|
|
(this->_sprite)._scale.x = scaleX;
|
|
return;
|
|
}
|
|
|
|
// 006d6ba0
|
|
void Entity_NPC::PlaySound(int id, float volume, int framedelay, uint8_t loop, float pitch)
|
|
{
|
|
undefined3 in_stack_00000011;
|
|
Manager *manager;
|
|
|
|
manager = g_manager;
|
|
if (this->_championColorIdx == 0x12) {
|
|
pitch = pitch + 0.5;
|
|
}
|
|
else if (this->_championColorIdx == 0x13) {
|
|
pitch = pitch * 0.5;
|
|
}
|
|
seed_fart_sound_override(&id);
|
|
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(id,volume,framedelay,(uint8_t)_loop,pitch,0.0);
|
|
return;
|
|
}
|
|
|
|
// 006d6c20
|
|
int Entity_NPC::GetAliveEnemyCount()
|
|
{
|
|
int iVar1;
|
|
uint32_t entityIdx;
|
|
int aliveCount;
|
|
bool isExcluded;
|
|
uint32_t entityCount;
|
|
int entityType;
|
|
|
|
if ((this->_flags & 0x20000000) == 0) {
|
|
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0x12c4)) + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0x12c0));
|
|
aliveCount = 0;
|
|
if (0 < iVar1) {
|
|
aliveCount = iVar1;
|
|
}
|
|
return aliveCount;
|
|
}
|
|
aliveCount = 0;
|
|
entityIdx = 0;
|
|
entityCount = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(g_game->_room) + 0x1264));
|
|
if (entityCount != 0) {
|
|
do {
|
|
iVar1 = *GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0x125c)) + entityIdx * 4));
|
|
if ((*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2) || (*GHIDRA_CAST<int *>((iVar1 + 0x28)) != 1)) {
|
|
entityType = *GHIDRA_CAST<int *>((iVar1 + 0x28));
|
|
if ((entityType - 10U < 0x3de) &&
|
|
(((entityType != 0x21 && (entityType != 0x11)) && (entityType != 0x124)))) {
|
|
if (entityType == 0x375) {
|
|
isExcluded = *GHIDRA_CAST<int *>((iVar1 + 0x2c)) == 10;
|
|
}
|
|
else {
|
|
if ((entityType == 0x3c0) || (entityType == 0x3c5)) goto LAB_006d6cda;
|
|
isExcluded = entityType == 0xf5;
|
|
}
|
|
if (!isExcluded) goto LAB_006d6cc0;
|
|
}
|
|
}
|
|
else {
|
|
LAB_006d6cc0:
|
|
if ((*GHIDRA_CAST<char *>((iVar1 + 0x173)) == '\0') && ((*GHIDRA_CAST<uint32_t *>((iVar1 + 0x168)) & 0x20000000) != 0)) {
|
|
aliveCount = aliveCount + 1;
|
|
}
|
|
}
|
|
LAB_006d6cda:
|
|
entityIdx = entityIdx + 1;
|
|
} while (entityIdx < entityCount);
|
|
}
|
|
return aliveCount;
|
|
}
|
|
|
|
// 006d6d20
|
|
uint32_t Entity_NPC::on_player_damaged()
|
|
{
|
|
uint32_t uVar1;
|
|
|
|
uVar1 = this->_type;
|
|
if ((uVar1 == 0x24) || (uVar1 == 0x54)) {
|
|
(this->_v1).x = 1.0;
|
|
}
|
|
else if (((uVar1 == 0x3b7) && (uVar1 = this->_variant - 0x66, uVar1 < 3)) && (this->_state == 3))
|
|
{
|
|
this->_state = 8;
|
|
uVar1 = Random();
|
|
this->_stateFrame = uVar1 % 0xf + 2;
|
|
return uVar1 / 0xf;
|
|
}
|
|
return uVar1;
|
|
}
|
|
|
|
// 006d6d80
|
|
void Entity_NPC::room_enter()
|
|
{
|
|
Vector *position;
|
|
int iVar1;
|
|
code *pcVar2;
|
|
uint8_t isBirthright;
|
|
RoomDescriptor *roomDesc;
|
|
int roomDx;
|
|
uint32_t doorSlot;
|
|
uint32_t extraout_EAX;
|
|
code *extraout_EDX;
|
|
int iVar3;
|
|
bool isFollowingShadow;
|
|
Color color;
|
|
uint64_t local_14;
|
|
float local_8;
|
|
Entity_Player *jacob;
|
|
|
|
local_8 = (float)(__security_cookie ^ GHIDRA_UINT(((&color)[1]._colorize + 1)));
|
|
if (this->_type == 0x362) {
|
|
isFollowingShadow = this->_variant == 0;
|
|
}
|
|
else {
|
|
isFollowingShadow = this->_type == 0x363;
|
|
}
|
|
if ((isFollowingShadow) && (1 < g_game->_frameCount - this->_spawnFrame)) {
|
|
roomDesc = (GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level::GetRoomByIdx(g_game->_lastRoomIdx,
|
|
g_game->_lastRoomDimensionIdx);
|
|
iVar3 = roomDesc->GridIndex;
|
|
roomDesc = (GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level::GetRoomByIdx(g_game->_currentRoomIdx,
|
|
g_game->_currentDimensionIdx);
|
|
iVar1 = roomDesc->GridIndex;
|
|
if ((iVar3 < 0) || (iVar1 < 0)) {
|
|
doorSlot = g_game->_enterDoor;
|
|
if (GHIDRA_INT(doorSlot) < 0) {
|
|
roomDesc = (GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level::GetRoomByIdx(g_game->_currentRoomIdx,
|
|
g_game->_currentDimensionIdx);
|
|
local_14 = 0xb00000001;
|
|
doorSlot = roomDesc->DecorationSeed;
|
|
if (doorSlot == 0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
|
|
pcVar2 = (code *)swi(3);
|
|
(*pcVar2)();
|
|
return;
|
|
}
|
|
doorSlot = doorSlot >> 1 ^ doorSlot;
|
|
doorSlot = doorSlot << 0xb ^ doorSlot;
|
|
doorSlot = (doorSlot >> 0x10 ^ doorSlot) & 3;
|
|
}
|
|
iVar3 = 0;
|
|
roomDx = 0;
|
|
doorSlot = doorSlot & 0x80000003;
|
|
if (GHIDRA_INT(doorSlot) < 0) {
|
|
doorSlot = (doorSlot - 1 | 0xfffffffc) + 1;
|
|
}
|
|
switch(doorSlot) {
|
|
case 0:
|
|
roomDx = -1;
|
|
break;
|
|
case 1:
|
|
iVar3 = -1;
|
|
break;
|
|
case 2:
|
|
roomDx = 1;
|
|
break;
|
|
case 3:
|
|
iVar3 = 1;
|
|
}
|
|
}
|
|
else {
|
|
roomDx = ((iVar1 / 0xd - iVar3 / 0xd) * 0xd - iVar1) + iVar3;
|
|
iVar3 = iVar3 / 0xd - iVar1 / 0xd;
|
|
}
|
|
iVar1 = this->_type;
|
|
position = &this->_pos;
|
|
position->x = (float)roomDx * 520.0 + position->x;
|
|
(this->_pos).y = (float)iVar3 * 280.0 + (this->_pos).y;
|
|
if (((((iVar1 == 0x362) && (this->_variant == 0)) && (this->_subtype == 1)) &&
|
|
((this->_parent != 0 && (*GHIDRA_CAST<int *>((this->_parent + 0x28)) == 0x362)))) &&
|
|
(((jacob = GHIDRA_CAST<Entity_Player *>(this->_spawnerEntity), jacob != GHIDRA_CAST<Entity_Player *>(0x0) &&
|
|
(jacob->_type == 1)) &&
|
|
(((jacob->_playerType == 0x25 || (jacob->_playerType == 0x27)) &&
|
|
(isBirthright = (GHIDRA_CAST<Entity_Player *>((jacob)))->Entity_Player::HasCollectible(0x26b,0), isBirthright == 0)))))) {
|
|
this->Remove();
|
|
doorSlot = Random();
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0xf,position,&g_vectorZero,GHIDRA_CAST<Entity *>(this),0,doorSlot);
|
|
(GHIDRA_CAST<Color *>((&color)))->Color::Color();
|
|
(*extraout_EDX)(extraout_EAX,0xffffffff,0xff,0,1);
|
|
}
|
|
}
|
|
if ((this->_flags & 0x1000002000000000) != 0) {
|
|
this->_damageCountdown = 0x14;
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006d7010
|
|
void Entity_NPC::spawn_damage_numbers()
|
|
{
|
|
uint8_t isActiveEnemy;
|
|
Entity_Player *spiderModOwner;
|
|
Entity_NPC *statusTarget;
|
|
uint32_t seed;
|
|
uint32_t rngResult;
|
|
Entity *damageNumber;
|
|
float *damageEvent;
|
|
float maxHitPoints;
|
|
double dVar2;
|
|
Vector local_50;
|
|
Vector spawnPos;
|
|
float maxHitPoints;
|
|
|
|
if (this->_type != 0x3c4) {
|
|
spiderModOwner =
|
|
PlayerManager::FirstCollectibleOwner
|
|
(&g_game->_playerManager,0x193,GHIDRA_CAST<RNG **>(&g_game->_playerManager),1);
|
|
if (spiderModOwner == GHIDRA_CAST<Entity_Player *>(0x0)) {
|
|
return;
|
|
}
|
|
isActiveEnemy = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsActiveEnemy(0);
|
|
if (isActiveEnemy == 0) {
|
|
return;
|
|
}
|
|
}
|
|
if ((((this->_visible != 0) && (maxHitPoints = 0.0, 0.0 < (this->_sprite)._color._tint[3])) &&
|
|
(0.0 < this->_health)) &&
|
|
(((statusTarget = GHIDRA_CAST<Entity_NPC *>((GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity)::GetStatusEffectTarget(),
|
|
statusTarget == this && (this->_isInvicible == 0)) &&
|
|
(damageEvent = *GHIDRA_CAST<float **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8)))), damageEvent != *GHIDRA_CAST<float **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc)))))))) {
|
|
do {
|
|
if (maxHitPoints < *damageEvent) {
|
|
seed = Random();
|
|
local_50.x = 0.0;
|
|
rngResult = Random();
|
|
maxHitPoints = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)])
|
|
* 2.3283064e-10;
|
|
local_50.y = -3.0 - (maxHitPoints + maxHitPoints);
|
|
spawnPos.x = (this->_pos).x - 0.0;
|
|
spawnPos.y = (this->_pos).y - 20.0;
|
|
damageNumber = (GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(0x2329,1,&spawnPos,&local_50,GHIDRA_CAST<Entity *>(0x0),0,seed,0);
|
|
dVar2 = floor((double)(*damageEvent * 10.0 + 0.5));
|
|
maxHitPoints = 9999.0;
|
|
if ((float)dVar2 / 10.0 <= 9999.0) {
|
|
maxHitPoints = (float)dVar2 / 10.0;
|
|
}
|
|
if (maxHitPoints <= 0.0) {
|
|
maxHitPoints = 0.1;
|
|
}
|
|
maxHitPoints = this->_maxHitPoints;
|
|
(damageNumber->_targetPosition).x = maxHitPoints;
|
|
(damageNumber->_targetPosition).y = maxHitPoints;
|
|
if (damageNumber->_parent != 0) {
|
|
msvc::multiset<unsigned_int>::erase();
|
|
}
|
|
damageNumber->_parent = this;
|
|
msvc::multiset<unsigned_int>::insert();
|
|
damageNumber->Update();
|
|
maxHitPoints = 0.0;
|
|
}
|
|
damageEvent = damageEvent + 0xe;
|
|
} while (damageEvent != *GHIDRA_CAST<float **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc)))));
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006d7230
|
|
void Entity_NPC::update_damage_history()
|
|
{
|
|
uint8_t isSharingStatus;
|
|
uint32_t ringIdx;
|
|
void *pvVar2;
|
|
int iVar3;
|
|
int eventsBytes;
|
|
int iVar4;
|
|
uint32_t historyIdx;
|
|
float *damageEvent;
|
|
float fVar5;
|
|
float damageMult;
|
|
float fVar6;
|
|
Entity_NPC *statusOwner;
|
|
uint32_t local_20;
|
|
float frameDamage;
|
|
uint32_t local_14 [4];
|
|
Entity_NPC *ancestor;
|
|
Entity_NPC *nextParent;
|
|
uint32_t ringIdx;
|
|
|
|
isSharingStatus = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::DoesEntityShareStatus();
|
|
statusOwner = this;
|
|
if (isSharingStatus != 0) {
|
|
nextParent = GHIDRA_CAST<Entity_NPC *>(this->_parent);
|
|
statusOwner = this;
|
|
while (ancestor = nextParent, ancestor != GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
|
statusOwner = ancestor;
|
|
nextParent = GHIDRA_CAST<Entity_NPC *>(ancestor->_parent);
|
|
}
|
|
}
|
|
if ((statusOwner == GHIDRA_CAST<Entity_NPC *>(0x0)) ||
|
|
(((*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2 || (statusOwner->_type != 1)) &&
|
|
(0x3dd < statusOwner->_type - 10U)))) {
|
|
statusOwner = this;
|
|
}
|
|
fVar5 = 0.0;
|
|
if (0.0 < statusOwner->_shieldStrength) {
|
|
damageEvent = *GHIDRA_CAST<float **>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8))));
|
|
frameDamage = 0.0;
|
|
iVar3 = (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc)))) - GHIDRA_INT(damageEvent)) / 0x38;
|
|
if (iVar3 != 0) {
|
|
do {
|
|
if ((GHIDRA_UINT(damageEvent[2]) & 0x2000) == 0) {
|
|
fVar5 = fVar5 + *damageEvent;
|
|
}
|
|
damageEvent = damageEvent + 0xe;
|
|
iVar3 = iVar3 + -1;
|
|
} while (iVar3 != 0);
|
|
frameDamage = fVar5;
|
|
}
|
|
if (GHIDRA_UINT(statusOwner->_shieldFrames) <= *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc58))))) {
|
|
msvc::deque<4byte>::erase
|
|
(local_14,*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc48)))),0,
|
|
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc54)))),*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc48)))),0,
|
|
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc54)))) + 1);
|
|
}
|
|
local_20 = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc58))));
|
|
ringIdx = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc54))));
|
|
if (((local_20 + ringIdx & 3) == 0) && (*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc50)))) <= local_20 + 4 >> 2))
|
|
{
|
|
msvc::deque<4byte>::_Growmap(local_20);
|
|
local_20 = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc58))));
|
|
ringIdx = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc54))));
|
|
}
|
|
ringIdx = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc50)))) * 4 - 1U & ringIdx;
|
|
local_14[0] = local_20 + ringIdx;
|
|
*GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc54)))) = ringIdx;
|
|
ringIdx = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc50)))) - 1U & local_14[0] >> 2;
|
|
iVar3 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc4c))));
|
|
if (*GHIDRA_CAST<int *>((iVar3 + ringIdx * 4)) == 0) {
|
|
pvVar2 = operator_new(0x10);
|
|
*(void **)(*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc4c)))) + ringIdx * 4) = pvVar2;
|
|
iVar3 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc4c))));
|
|
}
|
|
fVar5 = 0.0;
|
|
*GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((iVar3 + ringIdx * 4)) + (local_14[0] & 3) * 4)) = frameDamage;
|
|
*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc58)))) = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc58)))) + 1;
|
|
ringIdx = *GHIDRA_CAST<uint32_t *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc58))));
|
|
if (ringIdx != 0) {
|
|
iVar3 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc54))));
|
|
historyIdx = 0;
|
|
do {
|
|
ringIdx = iVar3 + historyIdx;
|
|
historyIdx = historyIdx + 1;
|
|
fVar5 = fVar5 + *GHIDRA_CAST<float *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc4c)))) +
|
|
(ringIdx >> 2 & *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc50)))) - 1U) *
|
|
4)) + (ringIdx & 3) * 4));
|
|
iVar3 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((statusOwner)) + 0xc54))));
|
|
} while (historyIdx < ringIdx);
|
|
}
|
|
fVar6 = this->_maxHitPoints / statusOwner->_shieldStrength;
|
|
damageMult = 1.0;
|
|
fVar5 = (fVar5 / (float)((double)GHIDRA_INT(ringIdx) + __uint_to_double_fixup[-(GHIDRA_INT(ringIdx) >> 0x1f)])) *
|
|
30.0;
|
|
if (fVar6 < fVar5) {
|
|
fVar6 = fVar6 / fVar5;
|
|
damageMult = 0.09 - fVar6 * 0.18;
|
|
if (damageMult <= 0.0) {
|
|
damageMult = 0.0;
|
|
}
|
|
damageMult = damageMult + fVar6;
|
|
}
|
|
this->_pendingDamage = 0.0;
|
|
iVar3 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8))));
|
|
local_20 = 0;
|
|
eventsBytes = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc)))) - iVar3;
|
|
iVar4 = eventsBytes >> 0x1f;
|
|
if (eventsBytes / 0x38 + iVar4 != iVar4) {
|
|
iVar4 = 0;
|
|
do {
|
|
fVar5 = *GHIDRA_CAST<float *>((iVar4 + iVar3));
|
|
if ((*GHIDRA_CAST<uint32_t *>((iVar4 + 8 + iVar3)) & 0x40002000) == 0) {
|
|
fVar5 = fVar5 * damageMult;
|
|
*GHIDRA_CAST<float *>((iVar4 + iVar3)) = fVar5;
|
|
}
|
|
local_20 = local_20 + 1;
|
|
iVar4 = iVar4 + 0x38;
|
|
this->_pendingDamage = fVar5 + this->_pendingDamage;
|
|
iVar3 = *GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0x8))));
|
|
} while (local_20 < GHIDRA_UINT(((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xc)))) - iVar3) / 0x38)));
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006d7520
|
|
void Entity_NPC::update_blood_guide_gibs(float *nullFrame)
|
|
{
|
|
Entity_NPC *bloodEffect = this;
|
|
void **ppvVar1;
|
|
uint8_t bVar2;
|
|
int iVar3;
|
|
Vector *randomDir;
|
|
uint32_t rngResult;
|
|
Entity *spawned;
|
|
Entity_Effect *bloodEffect;
|
|
AnimationState *animState;
|
|
float fVar4;
|
|
float fVar5;
|
|
double pitchRandom;
|
|
float fVar6;
|
|
float randomFraction;
|
|
uint32_t uVar7;
|
|
int framedelay;
|
|
TypeDescriptor *pTVar8;
|
|
TypeDescriptor *pTVar9;
|
|
uint32_t uVar10;
|
|
Vector local_30;
|
|
Vector gibPos;
|
|
int *local_20;
|
|
uint8_t *local_1c;
|
|
uint8_t *local_18;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
float nullPosX;
|
|
float nullPosY;
|
|
float nullScaleX;
|
|
void *room;
|
|
code *setColorFn;
|
|
int *tmpEntity;
|
|
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00afac9d;
|
|
local_10 = ExceptionList;
|
|
ppvVar1 = &local_10;
|
|
if (nullFrame == GHIDRA_CAST<float *>(0x0)) {
|
|
if ((bloodEffect->_sprite)._animState._animData == (void *)0x0) {
|
|
return;
|
|
}
|
|
ExceptionList = &local_10;
|
|
nullFrame = AnimationState::GetNullFrame(&(bloodEffect->_sprite)._animState,GHIDRA_CAST<uint8_t *>("BloodGuide"));
|
|
ppvVar1 = ExceptionList;
|
|
if (nullFrame == GHIDRA_CAST<float *>(0x0)) {
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
}
|
|
ExceptionList = ppvVar1;
|
|
animState = &(bloodEffect->_sprite)._animState;
|
|
if ((bloodEffect->_sprite)._animState._animData == (void *)0x0) goto LAB_006d7c3e;
|
|
bVar2 = AnimationState::WasEventTriggered(animState,GHIDRA_CAST<uint8_t *>("BloodStart"));
|
|
if ((bVar2 != 0) &&
|
|
(((bloodEffect->_sprite)._animState._animData == (void *)0x0 ||
|
|
((bVar2 = AnimationState::WasEventTriggered(animState,GHIDRA_CAST<uint8_t *>("BloodStop")), bVar2 == 0 &&
|
|
(((bloodEffect->_sprite)._animState._animData == (void *)0x0 ||
|
|
(bVar2 = AnimationState::WasEventTriggered(animState,GHIDRA_CAST<uint8_t *>("Explosion")), bVar2 == 0)))))))
|
|
) {
|
|
if (((bloodEffect->_type == 0x390) && (bloodEffect->_variant == 10)) ||
|
|
((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(bloodEffect->_config) + 0x60)) >> 0xd & 1) != 0)) {
|
|
iVar3 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(bloodEffect))))->Entity::GetIntervalTicks(3.0,0.0);
|
|
if (iVar3 != 0) {
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::ShakeScreen(5);
|
|
}
|
|
iVar3 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(bloodEffect))))->Entity::GetIntervalTicks(10.0,0.0);
|
|
if (iVar3 != 0) {
|
|
randomDir = MusicManager::RandomVector(&local_30);
|
|
rngResult = Random();
|
|
local_20 = GHIDRA_CAST<int *>(0x47);
|
|
fVar6 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)])
|
|
* 2.3283064e-10;
|
|
local_30.y = (fVar6 * randomDir->y * nullFrame[5] * 4.0 + nullFrame[1]) / 0.65;
|
|
local_30.x = (fVar6 * randomDir->x * nullFrame[4] * 4.0 + *nullFrame) / 0.65;
|
|
local_1c = GHIDRA_CAST<uint8_t *>(local_30.x);
|
|
local_18 = GHIDRA_CAST<uint8_t *>(local_30.y);
|
|
rngResult = Random();
|
|
gibPos.x = (float)local_1c + (bloodEffect->_pos).x;
|
|
gibPos.y = (float)local_18 + (bloodEffect->_pos).y;
|
|
spawn_gibs(&gibPos,(rngResult & 3) + 6,60.0,GHIDRA_CAST<uint32_t *>(&local_20),GHIDRA_CAST<Entity *>(bloodEffect),
|
|
&bloodEffect->_splatColor,&g_vectorZero,1.0);
|
|
rngResult = Random();
|
|
spawn_blood_explosion
|
|
((rngResult & 1) + 3,&bloodEffect->_pos,&local_30,&bloodEffect->_splatColor,&g_vectorZero);
|
|
fVar6 = 1.0;
|
|
bVar2 = 0;
|
|
framedelay = 2;
|
|
rngResult = Random();
|
|
pitchRandom = (double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)];
|
|
iVar3 = 0x8d;
|
|
LAB_006d7a90:
|
|
PlaySound(bloodEffect,iVar3,(float)pitchRandom * 2.3283064e-10 * 0.2 + 0.5,framedelay,bVar2,fVar6);
|
|
}
|
|
}
|
|
else {
|
|
rngResult = Random();
|
|
if ((rngResult & 1) == 0) {
|
|
iVar3 = PlayerManager::GetGFuelCount();
|
|
if (iVar3 < 1) {
|
|
rngResult = Random();
|
|
uVar10 = 0;
|
|
pTVar9 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor;
|
|
pTVar8 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor;
|
|
uVar7 = 0;
|
|
spawned = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x11,&bloodEffect->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(bloodEffect),0,
|
|
rngResult);
|
|
local_20 = GHIDRA_CAST<int *>(__RTDynamicCast(spawned,uVar7,pTVar8,pTVar9,uVar10));
|
|
randomDir = MusicManager::RandomVector(&local_30);
|
|
rngResult = Random();
|
|
tmpEntity = local_20;
|
|
randomFraction =
|
|
(float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) *
|
|
2.3283064e-10;
|
|
fVar6 = randomDir->y;
|
|
fVar4 = randomDir->x;
|
|
fVar5 = nullFrame[5];
|
|
nullScaleX = nullFrame[4];
|
|
nullPosY = nullFrame[1];
|
|
nullPosX = *nullFrame;
|
|
local_20[0xd6] = 0x42480000;
|
|
local_20[0x38] = GHIDRA_INT((randomFraction * fVar6 * fVar5 * 4.0 + nullPosY));
|
|
local_20[0x37] = GHIDRA_INT((randomFraction * fVar4 * nullScaleX * 4.0 + nullPosX));
|
|
rngResult = Random();
|
|
tmpEntity[0x3b] = GHIDRA_INT((((float)(rngResult & 3) + 0.0) * 90.0));
|
|
rngResult = Random();
|
|
local_18 = &DAT_bf800000;
|
|
local_1c = local_18;
|
|
if ((rngResult & 1) == 0) {
|
|
local_1c = GHIDRA_CAST<uint8_t *>(0x3f800000);
|
|
}
|
|
rngResult = Random();
|
|
if ((rngResult & 1) == 0) {
|
|
local_18 = GHIDRA_CAST<uint8_t *>(0x3f800000);
|
|
}
|
|
rngResult = Random();
|
|
setColorFn = *(code **)(*tmpEntity + 0x3c);
|
|
fVar6 = 1.0 - (float)((double)GHIDRA_INT(rngResult) +
|
|
__uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 *
|
|
0.4;
|
|
tmpEntity[0x3a] = GHIDRA_INT((fVar6 * (float)local_1c));
|
|
tmpEntity[0x39] = GHIDRA_INT((fVar6 * (float)local_18));
|
|
(*setColorFn)(&bloodEffect->_splatColor,0xffffffff,0xff,0,1);
|
|
fVar6 = 1.0;
|
|
bVar2 = 0;
|
|
framedelay = 2;
|
|
rngResult = Random();
|
|
pitchRandom = (double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)];
|
|
iVar3 = 0x48;
|
|
goto LAB_006d7a90;
|
|
}
|
|
local_20 = GHIDRA_CAST<int *>(spawn_gfuel_explosion());
|
|
randomDir = MusicManager::RandomVector(&local_30);
|
|
rngResult = Random();
|
|
tmpEntity = local_20;
|
|
randomFraction =
|
|
(float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) *
|
|
2.3283064e-10;
|
|
fVar6 = randomDir->y;
|
|
fVar4 = randomDir->x;
|
|
fVar5 = nullFrame[5];
|
|
nullScaleX = nullFrame[4];
|
|
nullPosY = nullFrame[1];
|
|
nullPosX = *nullFrame;
|
|
local_20[0xd6] = 0x42480000;
|
|
local_20[0x38] = GHIDRA_INT((randomFraction * fVar6 * fVar5 * 4.0 + nullPosY));
|
|
local_20[0x37] = GHIDRA_INT((randomFraction * fVar4 * nullScaleX * 4.0 + nullPosX));
|
|
rngResult = Random();
|
|
if ((rngResult & 1) == 0) {
|
|
local_18 = GHIDRA_CAST<uint8_t *>(0x3f800000);
|
|
}
|
|
else {
|
|
local_18 = &DAT_bf800000;
|
|
}
|
|
rngResult = Random();
|
|
fVar6 = 1.0 - (float)((double)GHIDRA_INT(rngResult) +
|
|
__uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 *
|
|
0.4;
|
|
tmpEntity[0x3a] = GHIDRA_INT(fVar6);
|
|
tmpEntity[0x39] = GHIDRA_INT((fVar6 * (float)local_18));
|
|
}
|
|
}
|
|
}
|
|
if ((((bloodEffect->_sprite)._animState._animData != (void *)0x0) &&
|
|
(bVar2 = AnimationState::IsEventTriggered(&(bloodEffect->_sprite)._animState,GHIDRA_CAST<uint8_t *>("BloodStart")),
|
|
bVar2 != 0)) && (bloodEffect->_type == 0x54)) {
|
|
local_1c = GHIDRA_CAST<uint8_t *>(0x4);
|
|
do {
|
|
rngResult = Random();
|
|
uVar10 = 0;
|
|
pTVar9 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor;
|
|
pTVar8 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor;
|
|
uVar7 = 0;
|
|
spawned = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x2a,&bloodEffect->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(bloodEffect),0,rngResult);
|
|
bloodEffect = GHIDRA_CAST<Entity_Effect *>(__RTDynamicCast(spawned,uVar7,pTVar8,pTVar9,uVar10));
|
|
(GHIDRA_CAST<Entity_Effect *>((bloodEffect)))->Entity_Effect::FollowParent(GHIDRA_CAST<Entity *>(bloodEffect));
|
|
rngResult = Random();
|
|
fVar6 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) *
|
|
2.3283064e-10 * 3.14;
|
|
fVar6 = fVar6 + fVar6;
|
|
local_18 = GHIDRA_CAST<uint8_t *>(sin(fVar6));
|
|
rngResult = Random();
|
|
local_20 = GHIDRA_CAST<int *>(((float)((double)GHIDRA_INT(rngResult) +
|
|
__uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10));
|
|
fVar5 = cos(fVar6);
|
|
fVar6 = nullFrame[5];
|
|
fVar4 = nullFrame[1];
|
|
(bloodEffect->_sprite)._offset.x = fVar5 * (float)local_20 * nullFrame[4] * 3.8 + *nullFrame;
|
|
(bloodEffect->_sprite)._offset.y = (float)local_20 * (float)local_18 * fVar6 * 3.8 + fVar4;
|
|
rngResult = Random();
|
|
if ((rngResult & 1) == 0) {
|
|
fVar6 = 50.0;
|
|
}
|
|
else {
|
|
fVar6 = -50.0;
|
|
}
|
|
bloodEffect->_renderDepthOffset = fVar6;
|
|
bloodEffect->_timeout = -1;
|
|
bloodEffect->_lifespan = -1;
|
|
rngResult = Random();
|
|
if ((rngResult & 1) == 0) {
|
|
(bloodEffect->_sprite)._flipX = 1;
|
|
}
|
|
bloodEffect->SetColor(&bloodEffect->_splatColor,0xffffffff,0xff,0,1);
|
|
local_1c = local_1c + -1;
|
|
} while (local_1c != GHIDRA_CAST<uint8_t *>(0x0));
|
|
}
|
|
LAB_006d7c3e:
|
|
animState = &(bloodEffect->_sprite)._animState;
|
|
if (((bloodEffect->_sprite)._animState._animData != (void *)0x0) &&
|
|
((bVar2 = AnimationState::IsEventTriggered(animState,GHIDRA_CAST<uint8_t *>("BloodStop")), bVar2 != 0 ||
|
|
(((bloodEffect->_sprite)._animState._animData != (void *)0x0 &&
|
|
(bVar2 = AnimationState::IsEventTriggered(animState,GHIDRA_CAST<uint8_t *>("Explosion")), bVar2 != 0)))))) {
|
|
room = g_game->_room;
|
|
iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(room) + 0x125c));
|
|
local_30.x = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(room) + 0x1260));
|
|
fVar6 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(room) + 0x1264));
|
|
fVar4 = 0.0;
|
|
local_8 = 0;
|
|
local_30.y = fVar6;
|
|
if (fVar6 != 0.0) {
|
|
do {
|
|
tmpEntity = *GHIDRA_CAST<int **>((iVar3 + GHIDRA_INT(fVar4) * 4));
|
|
if (((tmpEntity != GHIDRA_CAST<int *>(0x0)) && (tmpEntity[10] == 1000)) &&
|
|
((tmpEntity[0xb] == 0x2a && (GHIDRA_CAST<Entity_NPC *>(tmpEntity[0xef]) == bloodEffect)))) {
|
|
(**(code **)(*tmpEntity + 0x28))();
|
|
}
|
|
fVar4 = (float)(GHIDRA_INT(fVar4) + 1);
|
|
} while (GHIDRA_UINT(fVar4) < GHIDRA_UINT(fVar6));
|
|
}
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 006d81c0
|
|
void Entity_NPC::ClearDequeRefs()
|
|
{
|
|
int iVar1;
|
|
uint32_t index;
|
|
int *local_8;
|
|
int *entityRef;
|
|
int *proxy;
|
|
|
|
proxy = (this->_entityDeque)._proxy;
|
|
for (index = (this->_entityDeque)._offset;
|
|
index != (this->_entityDeque)._offset + (this->_entityDeque)._size; index = index + 1) {
|
|
if (proxy == GHIDRA_CAST<int *>(0x0)) {
|
|
iVar1 = 0;
|
|
}
|
|
else {
|
|
iVar1 = *proxy;
|
|
}
|
|
entityRef = GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar1 + 4)) + (index >> 2 & *GHIDRA_CAST<int *>((iVar1 + 8)) - 1U) * 4))
|
|
+ (index & 3) * 4));
|
|
if (*entityRef != 0) {
|
|
local_8 = entityRef;
|
|
msvc::multiset<unsigned_int>::erase(&local_8);
|
|
}
|
|
*entityRef = 0;
|
|
}
|
|
msvc::deque<ptr>::_Tidy();
|
|
return;
|
|
}
|
|
|
|
// 006d8260
|
|
uint8_t Entity_NPC::IsControllerActionPressed(int action)
|
|
{
|
|
uint8_t isPressed;
|
|
|
|
if (this->_controllerID != -1) {
|
|
isPressed = input_is_action_pressed(action,this->_controllerID,GHIDRA_CAST<Entity *>(this),GHIDRA_INT(this));
|
|
if (isPressed != 0) {
|
|
return 1;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
// 006d8290
|
|
uint8_t Entity_NPC::IsControllerActionTriggered(int buttonAction)
|
|
{
|
|
uint8_t isTriggered;
|
|
|
|
if (this->_controllerID != -1) {
|
|
isTriggered = input_is_action_triggered
|
|
(g_manager,buttonAction,this->_controllerID,GHIDRA_CAST<Entity *>(this),0);
|
|
if (isTriggered != 0) {
|
|
return 1;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
// 006d82d0
|
|
Vector * Entity_NPC::GetControllerInput(Vector *outInput, float deadzone)
|
|
{
|
|
int controllerIndex;
|
|
Vector *cardinalDir;
|
|
uint32_t curses;
|
|
int unused;
|
|
int unused_00;
|
|
int unused_01;
|
|
int unused_02;
|
|
int unused_03;
|
|
int unused_04;
|
|
void *seedEffectsHead;
|
|
float fVar1;
|
|
float fVar2;
|
|
float inputX;
|
|
float inputY;
|
|
Vector local_28;
|
|
float savedDeadzone;
|
|
Vector rawInput;
|
|
uint8_t seedFindResult [8];
|
|
void *seedNode;
|
|
Game *game;
|
|
|
|
controllerIndex = this->_controllerID;
|
|
if (controllerIndex != -1) {
|
|
savedDeadzone = deadzone;
|
|
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf2c))) == '\0') {
|
|
fVar1 = InputManager::GetActionValue(0,controllerIndex,GHIDRA_CAST<Entity *>(this),GHIDRA_INT(this));
|
|
inputX = InputManager::GetActionValue(1,this->_controllerID,GHIDRA_CAST<Entity *>(this),unused_02);
|
|
inputX = inputX + (0.0 - fVar1);
|
|
rawInput.x = inputX;
|
|
fVar1 = InputManager::GetActionValue(2,this->_controllerID,GHIDRA_CAST<Entity *>(this),unused_03);
|
|
inputY = InputManager::GetActionValue(3,this->_controllerID,GHIDRA_CAST<Entity *>(this),unused_04);
|
|
inputY = inputY + (0.0 - fVar1);
|
|
}
|
|
else {
|
|
fVar1 = InputManager::GetActionValue(4,controllerIndex,GHIDRA_CAST<Entity *>(this),GHIDRA_INT(this));
|
|
inputX = InputManager::GetActionValue(5,this->_controllerID,GHIDRA_CAST<Entity *>(this),unused);
|
|
inputX = inputX + (0.0 - fVar1);
|
|
rawInput.x = inputX;
|
|
fVar1 = InputManager::GetActionValue(6,this->_controllerID,GHIDRA_CAST<Entity *>(this),unused_00);
|
|
inputY = InputManager::GetActionValue(7,this->_controllerID,GHIDRA_CAST<Entity *>(this),unused_01);
|
|
inputY = inputY + (0.0 - fVar1);
|
|
}
|
|
game = g_game;
|
|
local_28.x = 1.68156e-44;
|
|
fVar1 = inputY;
|
|
rawInput.y = inputY;
|
|
msvc::set<int>::find_node(seedFindResult,&local_28);
|
|
if ((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(seedNode) + 0xd)) == '\0') && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(seedNode) + 0x10)) < 0xd)) {
|
|
seedEffectsHead = (game->_seedEffects)._seedEffects;
|
|
if (seedNode != seedEffectsHead) {
|
|
inputX = inputX * -1.0;
|
|
fVar1 = fVar1 * -1.0;
|
|
inputY = fVar1;
|
|
rawInput.x = inputX;
|
|
rawInput.y = fVar1;
|
|
}
|
|
}
|
|
else {
|
|
seedEffectsHead = (game->_seedEffects)._seedEffects;
|
|
}
|
|
local_28.x = 1.06499e-43;
|
|
fVar2 = inputX;
|
|
msvc::set<int>::find_node(seedFindResult,&local_28);
|
|
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(seedNode) + 0xd)) == '\0') {
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(seedNode) + 0x10)) < 0x4d) {
|
|
if (seedNode != seedEffectsHead) {
|
|
cardinalDir = Vector::ToCardinal(&local_28,&rawInput);
|
|
fVar2 = sqrtf(fVar1 * fVar1 + fVar2 * fVar2);
|
|
fVar1 = fVar2 * cardinalDir->y;
|
|
fVar2 = fVar2 * cardinalDir->x;
|
|
inputX = fVar2;
|
|
inputY = fVar1;
|
|
}
|
|
}
|
|
}
|
|
fVar1 = sqrtf(fVar1 * fVar1 + fVar2 * fVar2);
|
|
if ((savedDeadzone <= 0.0) || (savedDeadzone <= fVar1)) {
|
|
if (1.0 < fVar1) {
|
|
inputX = inputX / fVar1;
|
|
inputY = inputY / fVar1;
|
|
}
|
|
if (((game->_currentDimensionIdx == 1) && ((game->_stageType == 4 || (game->_stageType == 5)))
|
|
) && ((game->_stage == 2 ||
|
|
((game->_stage == 1 && (curses = (GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(game))))->Level::GetCurses(), (curses & 2) != 0)
|
|
))))) {
|
|
inputX = inputX * -1.0;
|
|
}
|
|
outInput->x = inputX;
|
|
outInput->y = inputY;
|
|
return outInput;
|
|
}
|
|
}
|
|
fVar1 = g_vectorZero.y;
|
|
outInput->x = g_vectorZero.x;
|
|
outInput->y = fVar1;
|
|
return outInput;
|
|
}
|
|
|
|
// 006d85a0
|
|
Vector * Entity_NPC::GetControllerMovementInput(Vector *outInput, float deadzone)
|
|
{
|
|
uint8_t bVar1;
|
|
Vector *pVVar2;
|
|
uint32_t curses;
|
|
int unused;
|
|
int unused_00;
|
|
int unused_01;
|
|
int unused_02;
|
|
int unused_03;
|
|
int unused_04;
|
|
int unused_05;
|
|
Game *game;
|
|
float fVar3;
|
|
float fVar4;
|
|
uint8_t local_38 [8];
|
|
void *seedNode;
|
|
uint8_t local_2c [4];
|
|
Vector local_28;
|
|
Vector rawInput;
|
|
float minMagnitude;
|
|
uint32_t seedKey;
|
|
float local_10;
|
|
float inputX;
|
|
|
|
game = g_game;
|
|
if (this->_controllerID == -1) goto LAB_006d8891;
|
|
local_10 = 1.03696e-43;
|
|
minMagnitude = deadzone;
|
|
msvc::set<int>::find_node(local_2c,&local_10);
|
|
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(local_28.y) + 0xd)) == '\0') && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_28.y) + 0x10)) < 0x4b)) &&
|
|
((void *)local_28.y != (game->_seedEffects)._seedEffects)) {
|
|
pVVar2 = GetControllerInput(this,&local_28,0.0);
|
|
rawInput.x = pVVar2->x;
|
|
fVar4 = pVVar2->y;
|
|
game = g_game;
|
|
LAB_006d8761:
|
|
rawInput.y = fVar4;
|
|
local_10 = fVar4;
|
|
inputX = rawInput.x;
|
|
}
|
|
else {
|
|
bVar1 = (GHIDRA_CAST<Game *>((game)))->Game::IsInTimedSet(0x4b);
|
|
if (bVar1 != 0) {
|
|
pVVar2 = GetControllerInput(this,&local_28,0.0);
|
|
rawInput.x = pVVar2->x * -1.0;
|
|
fVar4 = pVVar2->y * -1.0;
|
|
game = g_game;
|
|
goto LAB_006d8761;
|
|
}
|
|
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((this)) + 0xf2c))) == '\0') {
|
|
local_10 = InputManager::GetActionValue(4,this->_controllerID,GHIDRA_CAST<Entity *>(this),unused);
|
|
local_10 = 0.0 - local_10;
|
|
rawInput.x = InputManager::GetActionValue(5,this->_controllerID,GHIDRA_CAST<Entity *>(this),unused_03);
|
|
rawInput.x = rawInput.x + local_10;
|
|
inputX = rawInput.x;
|
|
local_10 = InputManager::GetActionValue(6,this->_controllerID,GHIDRA_CAST<Entity *>(this),unused_04);
|
|
local_10 = 0.0 - local_10;
|
|
fVar4 = InputManager::GetActionValue(7,this->_controllerID,GHIDRA_CAST<Entity *>(this),unused_05);
|
|
fVar4 = fVar4 + local_10;
|
|
}
|
|
else {
|
|
local_10 = InputManager::GetActionValue(0,this->_controllerID,GHIDRA_CAST<Entity *>(this),unused);
|
|
local_10 = 0.0 - local_10;
|
|
rawInput.x = InputManager::GetActionValue(1,this->_controllerID,GHIDRA_CAST<Entity *>(this),unused_00);
|
|
rawInput.x = rawInput.x + local_10;
|
|
inputX = rawInput.x;
|
|
local_10 = InputManager::GetActionValue(2,this->_controllerID,GHIDRA_CAST<Entity *>(this),unused_01);
|
|
local_10 = 0.0 - local_10;
|
|
fVar4 = InputManager::GetActionValue(3,this->_controllerID,GHIDRA_CAST<Entity *>(this),unused_02);
|
|
fVar4 = fVar4 + local_10;
|
|
}
|
|
game = g_game;
|
|
rawInput.y = fVar4;
|
|
local_10 = fVar4;
|
|
bVar1 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0xc);
|
|
if (bVar1 != 0) {
|
|
rawInput.x = inputX * -1.0;
|
|
fVar4 = fVar4 * -1.0;
|
|
goto LAB_006d8761;
|
|
}
|
|
}
|
|
seedKey = 0x4c;
|
|
fVar3 = inputX;
|
|
msvc::set<int>::find_node(local_38,&seedKey);
|
|
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(seedNode) + 0xd)) == '\0') {
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(seedNode) + 0x10)) < 0x4d) {
|
|
if (seedNode != (game->_seedEffects)._seedEffects) {
|
|
pVVar2 = Vector::ToCardinal(&local_28,&rawInput);
|
|
fVar3 = sqrtf(fVar4 * fVar4 + fVar3 * fVar3);
|
|
fVar4 = fVar3 * pVVar2->y;
|
|
fVar3 = fVar3 * pVVar2->x;
|
|
local_10 = fVar4;
|
|
inputX = fVar3;
|
|
}
|
|
}
|
|
}
|
|
fVar4 = sqrtf(fVar4 * fVar4 + fVar3 * fVar3);
|
|
if ((minMagnitude <= 0.0) || (minMagnitude <= fVar4)) {
|
|
if (1.0 < fVar4) {
|
|
inputX = inputX / fVar4;
|
|
local_10 = local_10 / fVar4;
|
|
}
|
|
if (((game->_currentDimensionIdx == 1) && ((game->_stageType == 4 || (game->_stageType == 5))))
|
|
&& ((game->_stage == 2 ||
|
|
((game->_stage == 1 && (curses = (GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(game))))->Level::GetCurses(), (curses & 2) != 0))))))
|
|
{
|
|
inputX = inputX * -1.0;
|
|
}
|
|
outInput->x = inputX;
|
|
outInput->y = local_10;
|
|
return outInput;
|
|
}
|
|
LAB_006d8891:
|
|
fVar4 = g_vectorZero.y;
|
|
outInput->x = g_vectorZero.x;
|
|
outInput->y = fVar4;
|
|
return outInput;
|
|
}
|
|
|
|
// 006d88b0
|
|
void Entity_NPC::TransferControl(Entity_NPC *target)
|
|
{
|
|
void *playersBegin;
|
|
uint32_t *controlledNpcRef;
|
|
uint32_t *eraseRef;
|
|
Entity_Player *player;
|
|
Entity_NPC *newController;
|
|
|
|
newController = target;
|
|
if (target != this) {
|
|
if (this->_controllerID != -1) {
|
|
target = GHIDRA_CAST<Entity_NPC *>(0x0);
|
|
playersBegin = (g_game->_playerManager)._extraPlayers._begin;
|
|
if (GHIDRA_INT((g_game->_playerManager)._extraPlayers._end) - GHIDRA_INT(playersBegin) >> 2 != 0) {
|
|
do {
|
|
player = *GHIDRA_CAST<Entity_Player **>((GHIDRA_CAST<char *>(playersBegin) + GHIDRA_INT(target) * 4));
|
|
if (player->_controllerIndex == this->_controllerID) {
|
|
controlledNpcRef = &player->_target;
|
|
if (GHIDRA_CAST<Entity_NPC *>(player->_target) == this) {
|
|
if (GHIDRA_CAST<Entity_NPC *>(player->_target) != GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
|
eraseRef = controlledNpcRef;
|
|
msvc::multiset<unsigned_int>::erase(&eraseRef);
|
|
}
|
|
*controlledNpcRef = newController;
|
|
if (newController != GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
|
msvc::multiset<unsigned_int>::insert(controlledNpcRef);
|
|
}
|
|
}
|
|
}
|
|
target = GHIDRA_CAST<Entity_NPC *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((target)) + 0x1))));
|
|
playersBegin = (g_game->_playerManager)._extraPlayers._begin;
|
|
} while (target < (uint8_t *)
|
|
(GHIDRA_INT((g_game->_playerManager)._extraPlayers._end) - GHIDRA_INT(playersBegin) >> 2
|
|
));
|
|
}
|
|
}
|
|
if (newController != GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
|
newController->_controllerID = this->_controllerID;
|
|
}
|
|
this->_controllerID = -1;
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006d8b20
|
|
void Entity_NPC::SpawnControlTarget(int inputMode, float rotation)
|
|
{
|
|
int iVar1;
|
|
ANM2 *pAVar2;
|
|
Vector *pVVar3;
|
|
uint32_t seed;
|
|
Entity *targetEffect;
|
|
int *aimTarget;
|
|
Vector local_40;
|
|
uint32_t local_38 [8];
|
|
uint32_t local_18;
|
|
uint32_t uStack_14;
|
|
uint32_t local_10;
|
|
uint32_t local_c;
|
|
uint8_t auStack_8 [4];
|
|
void **aimTargetSlot;
|
|
ColorMod *targetColor;
|
|
|
|
local_c = __security_cookie ^ GHIDRA_UINT((auStack_8 + 4));
|
|
aimTarget = this->_aimTargetEffect;
|
|
aimTargetSlot = &this->_aimTargetEffect;
|
|
if (aimTarget != GHIDRA_CAST<int *>(0x0)) {
|
|
if (aimTarget[10] == 1000) goto LAB_006d8cba;
|
|
(**(code **)(*aimTarget + 0x28))();
|
|
if (*aimTargetSlot != (void *)0x0) {
|
|
local_40.y = (float)aimTargetSlot;
|
|
msvc::multiset<unsigned_int>::erase(&local_40.y);
|
|
}
|
|
*aimTargetSlot = (void *)0x0;
|
|
}
|
|
if (inputMode == 0) {
|
|
pVVar3 = GetControllerMovementInput(this,&local_40,0.0);
|
|
if ((pVVar3->x == g_vectorZero.x) && (pVVar3->y == g_vectorZero.y)) {
|
|
return;
|
|
}
|
|
}
|
|
else if (((inputMode == 1) &&
|
|
(pVVar3 = GetControllerInput(this,&local_40,0.0), pVVar3->x == g_vectorZero.x)) &&
|
|
(pVVar3->y == g_vectorZero.y)) {
|
|
return;
|
|
}
|
|
seed = Random();
|
|
targetEffect = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x1e,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(this),0,seed);
|
|
iVar1 = *GHIDRA_CAST<int *>(targetEffect);
|
|
pAVar2 = &targetEffect[1]._sprite;
|
|
(pAVar2->_filename)._buf[4] = '\0';
|
|
(pAVar2->_filename)._buf[5] = '\0';
|
|
(pAVar2->_filename)._buf[6] = '\0';
|
|
(pAVar2->_filename)._buf[7] = '\0';
|
|
pAVar2 = &targetEffect[1]._sprite;
|
|
(pAVar2->_filename)._buf[8] = '\0';
|
|
(pAVar2->_filename)._buf[9] = '\0';
|
|
(pAVar2->_filename)._buf[10] = '\0';
|
|
(pAVar2->_filename)._buf[0xb] = '\0';
|
|
(**(code **)(iVar1 + 0xc))();
|
|
targetColor = &(targetEffect->_sprite)._color;
|
|
local_18 = 0;
|
|
uStack_14 = 0;
|
|
local_10 = 0;
|
|
if (targetColor != GHIDRA_CAST<ColorMod *>(local_38)) {
|
|
(targetEffect->_sprite)._color._colorize[0] = 0.0;
|
|
(targetEffect->_sprite)._color._colorize[1] = 0.0;
|
|
(targetEffect->_sprite)._color._colorize[2] = 0.0;
|
|
(targetEffect->_sprite)._color._colorize[3] = 0.0;
|
|
(targetEffect->_sprite)._color._offset[0] = 0.0;
|
|
(targetEffect->_sprite)._color._offset[1] = 0.0;
|
|
targetColor->_tint[0] = 0.60784316;
|
|
(targetEffect->_sprite)._color._tint[1] = 0.0;
|
|
(targetEffect->_sprite)._color._tint[2] = 0.0;
|
|
(targetEffect->_sprite)._color._tint[3] = 1.0;
|
|
(targetEffect->_sprite)._color._offset[2] = 0.0;
|
|
}
|
|
if (*aimTargetSlot != (void *)0x0) {
|
|
local_40.y = (float)aimTargetSlot;
|
|
msvc::multiset<unsigned_int>::erase(&local_40.y);
|
|
}
|
|
*aimTargetSlot = targetEffect;
|
|
msvc::multiset<unsigned_int>::insert(aimTargetSlot);
|
|
aimTarget = this->_aimTargetEffect;
|
|
LAB_006d8cba:
|
|
aimTarget[0x11d] = GHIDRA_INT(rotation);
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_INT(*aimTargetSlot) + 0x424)) = 2;
|
|
*GHIDRA_CAST<int *>((GHIDRA_INT(*aimTargetSlot) + 0x428)) = inputMode;
|
|
return;
|
|
}
|
|
|
|
// 006d8cf0
|
|
void Entity_NPC::ClearChild()
|
|
{
|
|
Entity_NPC *local_8;
|
|
void **childRef;
|
|
|
|
childRef = &this->_aimTargetEffect;
|
|
if (*childRef != GHIDRA_CAST<int *>(0x0)) {
|
|
local_8 = this;
|
|
(**(code **)(*GHIDRA_CAST<int *>(*childRef) + 0x28))();
|
|
if (*childRef != (void *)0x0) {
|
|
local_8 = GHIDRA_CAST<Entity_NPC *>(childRef);
|
|
msvc::multiset<unsigned_int>::erase(&local_8);
|
|
}
|
|
*childRef = (void *)0x0;
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006d8d30
|
|
Vector * Entity_NPC::GetAimTargetPosition(Vector *outPosition)
|
|
{
|
|
float targetX;
|
|
float targetY;
|
|
void *aimTarget;
|
|
|
|
aimTarget = this->_aimTargetEffect;
|
|
if (aimTarget == (void *)0x0) {
|
|
targetX = (this->_pos).x;
|
|
targetY = (this->_pos).y;
|
|
}
|
|
else {
|
|
targetX = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(aimTarget) + 0x33c));
|
|
targetY = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(aimTarget) + 0x340));
|
|
}
|
|
outPosition->x = targetX;
|
|
outPosition->y = targetY;
|
|
return outPosition;
|
|
}
|
|
|
|
// 006d8d80
|
|
uint8_t Entity_NPC::is_controller_input_idle()
|
|
{
|
|
int iVar1;
|
|
Vector *pVVar2;
|
|
Vector movementInput;
|
|
Vector controllerInput;
|
|
void *aimTarget;
|
|
|
|
aimTarget = this->_aimTargetEffect;
|
|
if (aimTarget != (void *)0x0) {
|
|
if ((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(aimTarget) + 0x28)) == 1000) &&
|
|
(iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(aimTarget) + 0x428)), iVar1 != 0)) {
|
|
if (iVar1 != 1) {
|
|
if (iVar1 == 2) {
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
pVVar2 = GetControllerInput(this,&controllerInput,0.1);
|
|
}
|
|
else {
|
|
pVVar2 = GetControllerMovementInput(this,&movementInput,0.1);
|
|
}
|
|
if ((pVVar2->x == g_vectorZero.x) && (pVVar2->y == g_vectorZero.y)) {
|
|
return 1;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
// 006d8e40
|
|
void Entity_NPC::UpdateChargeBar(float start, float end, float value, uint8_t isHideWhenFull)
|
|
{
|
|
uint8_t *puVar1;
|
|
uint8_t bVar2;
|
|
LayerState *barLayer;
|
|
int chargeFrame;
|
|
char *ptr;
|
|
uint32_t size;
|
|
float chargeFraction;
|
|
std_string anm2Path;
|
|
uint32_t local_24;
|
|
uint8_t *puStack_20;
|
|
void *local_1c;
|
|
uint8_t *puStack_18;
|
|
uint32_t local_14;
|
|
|
|
puStack_20 = GHIDRA_CAST<uint8_t *>((GHIDRA_INT(register0x00000010) + -4));
|
|
local_14 = 0xffffffff;
|
|
puStack_18 = &LAB_00af85cd;
|
|
local_1c = ExceptionList;
|
|
local_24 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U;
|
|
bVar2 = (this->_chargeBarSprite)._loaded;
|
|
if (this->_controllerID == -1) {
|
|
if (bVar2 == 0) {
|
|
return;
|
|
}
|
|
}
|
|
else {
|
|
ExceptionList = &local_1c;
|
|
puVar1 = GHIDRA_CAST<uint8_t *>((GHIDRA_INT(register0x00000010) + -4));
|
|
if (bVar2 == 0) {
|
|
anm2Path._size = 0;
|
|
anm2Path._capacity = 0xf;
|
|
anm2Path._buf[0] = '\0';
|
|
anm2Path._buf[1] = '\0';
|
|
anm2Path._buf[2] = '\0';
|
|
anm2Path._buf[3] = '\0';
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) = msvc::_Allocate(0x20);
|
|
anm2Path._size = 0x12;
|
|
anm2Path._capacity = 0x1f;
|
|
builtin_strncpy((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(anm2Path._buf))) + 0x0))),"gfx/chargebar.anm2",0x13);
|
|
local_14 = 0;
|
|
ANM2::Load(&this->_chargeBarSprite,&anm2Path,1);
|
|
local_14 = 0xffffffff;
|
|
if (0xf < anm2Path._capacity) {
|
|
size = anm2Path._capacity + 1;
|
|
ptr = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(anm2Path._buf))) + 0x0)));
|
|
if (0xfff < size) {
|
|
ptr = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) + -4));
|
|
size = anm2Path._capacity + 0x24;
|
|
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) + (-4 - GHIDRA_INT(ptr))))) {
|
|
/* WARNING: Subroutine does not return */
|
|
_invalid_parameter_noinfo_noreturn();
|
|
}
|
|
}
|
|
operator_delete(ptr,size);
|
|
}
|
|
anm2Path._size = 0;
|
|
anm2Path._capacity = 0xf;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(anm2Path._buf)) + 0x0))) & 0xffffff00;
|
|
puVar1 = puStack_20;
|
|
}
|
|
puStack_20 = puVar1;
|
|
barLayer = ANM2::GetLayer(&this->_chargeBarSprite,GHIDRA_CAST<uint8_t *>(0x2));
|
|
barLayer->_visible = 0;
|
|
if (start == end) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("Start and End parameters cannot be the same!"));
|
|
}
|
|
chargeFraction = (value - start) / (end - start);
|
|
if (chargeFraction <= 0.0) {
|
|
chargeFraction = 0.0;
|
|
}
|
|
if (1.0 <= chargeFraction) {
|
|
chargeFraction = 1.0;
|
|
}
|
|
chargeFrame = GHIDRA_INT((chargeFraction * 100.0 + 0.0));
|
|
if ((isHideWhenFull == 0) || (chargeFrame < 100)) {
|
|
bVar2 = ANM2::SetAnimation(&this->_chargeBarSprite,GHIDRA_CAST<uint8_t *>("Charging"),1);
|
|
if ((bVar2 != 0) &&
|
|
(((this->_chargeBarSprite)._animState._animData != (void *)0x0 &&
|
|
(AnimationState::SetFrameFloat(&(this->_chargeBarSprite)._animState,(float)chargeFrame),
|
|
(this->_chargeBarSprite)._animState._animData != (void *)0x0)))) {
|
|
(this->_chargeBarSprite)._animState._isPlaying = 0;
|
|
}
|
|
(this->_chargeBarSprite)._color._tint[3] = 1.0;
|
|
ExceptionList = local_1c;
|
|
return;
|
|
}
|
|
}
|
|
(this->_chargeBarSprite)._color._tint[3] = 0.0;
|
|
ExceptionList = local_1c;
|
|
return;
|
|
}
|
|
|
|
// 006d9050
|
|
void Entity_NPC::UpdateControllerMovement(uint8_t isForceUpdate)
|
|
{
|
|
Vector movementInput;
|
|
|
|
if (this->_controllerID == -1) {
|
|
(this->_controllerMovement).x = g_vectorZero.x;
|
|
(this->_controllerMovement).y = g_vectorZero.y;
|
|
return;
|
|
}
|
|
GetControllerMovementInput(this,&movementInput,0.1);
|
|
if (((isForceUpdate != 0) || (movementInput.x != g_vectorZero.x)) ||
|
|
(movementInput.y != g_vectorZero.y)) {
|
|
(this->_controllerMovement).x = movementInput.x;
|
|
(this->_controllerMovement).y = movementInput.y;
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006d90e0
|
|
void Entity_NPC::UpdateChildEffectPosition(uint8_t isPredictMovement)
|
|
{
|
|
Vector *input;
|
|
float fVar1;
|
|
float fVar2;
|
|
Vector local_18;
|
|
Vector local_10;
|
|
void *aimTarget;
|
|
|
|
if (this->_controllerID == -1) {
|
|
return;
|
|
}
|
|
aimTarget = this->_aimTargetEffect;
|
|
if (aimTarget == (void *)0x0) {
|
|
return;
|
|
}
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(aimTarget) + 0x28)) == 1000) {
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(aimTarget) + 0x428)) == 2) {
|
|
if (isPredictMovement == 0) {
|
|
fVar1 = (this->_prevPosition).x;
|
|
fVar2 = (this->_prevPosition).y;
|
|
}
|
|
else {
|
|
fVar2 = (this->_prevVelocity).y * 0.5 * this->_speedMultiplier + (this->_prevPosition).y;
|
|
fVar1 = (this->_prevVelocity).x * 0.5 * this->_speedMultiplier + (this->_prevPosition).x;
|
|
}
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(aimTarget) + 0x33c)) = fVar1;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(aimTarget) + 0x340)) = fVar2;
|
|
aimTarget = this->_aimTargetEffect;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(aimTarget) + 0x360)) = g_vectorZero.x;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(aimTarget) + 0x364)) = g_vectorZero.y;
|
|
return;
|
|
}
|
|
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(aimTarget) + 0x428)) != 0) {
|
|
input = GetControllerInput(this,&local_10,0.0);
|
|
goto LAB_006d91de;
|
|
}
|
|
}
|
|
input = GetControllerMovementInput(this,&local_18,0.0);
|
|
LAB_006d91de:
|
|
fVar1 = input->y;
|
|
if ((input->x != g_vectorZero.x) || (fVar1 != g_vectorZero.y)) {
|
|
aimTarget = this->_aimTargetEffect;
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(aimTarget) + 0x360)) = input->x * 8.0 + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(aimTarget) + 0x360));
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(aimTarget) + 0x364)) = fVar1 * 8.0 + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(aimTarget) + 0x364));
|
|
}
|
|
aimTarget = this->_aimTargetEffect;
|
|
if ((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(aimTarget) + 0x28)) == 1000) && (0.0 < *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(aimTarget) + 0x474)))) {
|
|
fVar1 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(aimTarget) + 0x474)) - 40.0;
|
|
local_18.x = (this->_pos).x - *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(aimTarget) + 0x33c));
|
|
if (fVar1 <= 0.0) {
|
|
fVar1 = 0.0;
|
|
}
|
|
local_10.x = (this->_pos).y - *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(aimTarget) + 0x340));
|
|
fVar2 = sqrtf(local_10.x * local_10.x + local_18.x * local_18.x);
|
|
if (fVar1 < fVar2) {
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(aimTarget) + 0x360)) =
|
|
(local_18.x / fVar2) * (fVar2 - fVar1) * 0.1 + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(aimTarget) + 0x360));
|
|
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(aimTarget) + 0x364)) =
|
|
(local_10.x / fVar2) * (fVar2 - fVar1) * 0.1 + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(aimTarget) + 0x364));
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 006d97e0
|
|
uint8_t Entity_NPC::split(float damage, EntityRef *source, uint8_t isPlaySound)
|
|
{
|
|
int iVar1;
|
|
code *pcVar2;
|
|
uint8_t bVar3;
|
|
char cVar4;
|
|
uint32_t uVar5;
|
|
EntityRef *killSourceRef;
|
|
Entity_NPC *half;
|
|
uint8_t *animNameCh;
|
|
void *listData;
|
|
LayerState *layer;
|
|
uint8_t unk;
|
|
uint8_t *expectedNameCh;
|
|
Entity_NPC *momPart;
|
|
uint32_t rngState;
|
|
int iVar6;
|
|
uint32_t *parentLinkSlot;
|
|
bool bVar7;
|
|
bool isUnsplittable;
|
|
float fVar8;
|
|
float fVar9;
|
|
uint8_t *sideSign;
|
|
EntityRef dieSourceRef;
|
|
EntityRef dieSourceRef2;
|
|
uint64_t rngShifts2;
|
|
uint8_t hornfelDoors [12];
|
|
int iStack_9c;
|
|
uint8_t momParts [12];
|
|
EntityRef *pEStack_8c;
|
|
uint8_t geminiBabies [8];
|
|
int iStack_80;
|
|
EntityRef *pEStack_7c;
|
|
uint64_t rngShifts;
|
|
int rngShiftC;
|
|
uint8_t peeps [12];
|
|
EntityRef *pEStack_5c;
|
|
int halves [2];
|
|
uint32_t *eraseMomPartParent;
|
|
int *eraseBabyParent;
|
|
uint32_t *erasePeepParent;
|
|
int *eraseHalfParent;
|
|
uint8_t umbilicalCords [8];
|
|
int iStack_38;
|
|
EntityRef *pEStack_34;
|
|
Vector spawnPos;
|
|
int *local_28;
|
|
uint32_t *local_24;
|
|
float local_20;
|
|
int halfIndex;
|
|
uint32_t cleanupFlags;
|
|
int local_14;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t local_8;
|
|
uint8_t *curAnimData;
|
|
uint32_t *flagsHigh;
|
|
Game *game;
|
|
uint64_t halfFlags;
|
|
Manager *manager;
|
|
int *umbilicalCord;
|
|
|
|
manager = g_manager;
|
|
local_8 = 0xffffffff;
|
|
puStack_c = &LAB_00afad00;
|
|
local_10 = ExceptionList;
|
|
uVar5 = __security_cookie ^ GHIDRA_UINT((umbilicalCords + 0x3c));
|
|
eraseHalfParent = GHIDRA_CAST<int *>(0x0);
|
|
cleanupFlags = 0;
|
|
if ((this->_dead != 0) || (this->_exists == 0)) {
|
|
return 0;
|
|
}
|
|
ExceptionList = &local_10;
|
|
local_20 = damage;
|
|
if (isPlaySound != 0) {
|
|
local_14 = 0x4d;
|
|
seed_fart_sound_override(&local_14);
|
|
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(local_14,1.0,2,0,1.0,0.0);
|
|
}
|
|
iVar6 = this->_type;
|
|
if ((((((iVar6 == 0xdf) || (iVar6 == 0xdc)) || (iVar6 == 0x39)) ||
|
|
((iVar6 == 0x50 || (iVar6 == 0x5e)))) ||
|
|
((((iVar6 == 0x47 || ((iVar6 == 0x48 || (iVar6 == 0x49)))) || (iVar6 == 0x4a)) ||
|
|
(((iVar6 == 0x4b || (iVar6 == 0x4c)) || (iVar6 == 0x33)))))) ||
|
|
(this->_championColorIdx == 0xf)) {
|
|
bVar7 = true;
|
|
}
|
|
else {
|
|
bVar7 = false;
|
|
}
|
|
if (iVar6 == 0x2d) {
|
|
if (this->_variant != 10) goto LAB_006d98e5;
|
|
LAB_006d9a09:
|
|
isUnsplittable = false;
|
|
}
|
|
else {
|
|
if (((((iVar6 != 0x4e) && (iVar6 != 0x54)) &&
|
|
((iVar6 != 0x112 && ((iVar6 != 0x113 && (iVar6 != 0x66)))))) && (iVar6 != 0x111)) &&
|
|
((iVar6 != 0x10a && (iVar6 != 0x65)))) {
|
|
if (iVar6 == 0x387) {
|
|
if (this->_variant != 0) {
|
|
isUnsplittable = this->_variant == 1;
|
|
goto LAB_006d9a03;
|
|
}
|
|
}
|
|
else if ((((iVar6 != 0x3e) && (iVar6 != 0x38f)) && (iVar6 != 0x390)) &&
|
|
(((iVar6 != 0x197 && (iVar6 != 0x196)) && (iVar6 != 0x3b6)))) {
|
|
isUnsplittable = iVar6 == 0x3b7;
|
|
LAB_006d9a03:
|
|
if (!isUnsplittable) goto LAB_006d9a09;
|
|
}
|
|
}
|
|
LAB_006d98e5:
|
|
isUnsplittable = true;
|
|
}
|
|
fVar9 = 0.5;
|
|
fVar8 = local_20;
|
|
if ((0.5 < this->_scale || this->_scale == 0.5) && (!isUnsplittable)) {
|
|
if ((iVar6 == 0x51) && ((this->_variant == 0 && (this->_spawnerType != 0x51)))) {
|
|
fVar8 = this->_maxHitPoints * 0.4;
|
|
if (this->_health <= fVar8) {
|
|
fVar8 = this->_health;
|
|
}
|
|
this->_health = fVar8;
|
|
goto LAB_006d9a4d;
|
|
}
|
|
bVar3 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::is_same_segmented_body(GHIDRA_CAST<Entity *>(0x0));
|
|
if (bVar3 == 0) {
|
|
if (iVar6 == 0x387) {
|
|
iVar1 = this->_variant;
|
|
joined_r0x006d9a82:
|
|
if (iVar1 == 10) goto LAB_006d9a2b;
|
|
}
|
|
else if (iVar6 == 0x38d) {
|
|
iVar1 = this->_variant;
|
|
goto joined_r0x006d9a82;
|
|
}
|
|
if (!bVar7) {
|
|
if ((iVar6 == 0x41) && (this->_variant == 1)) {
|
|
cVar4 = this->IsBoss();
|
|
if (cVar4 == '\0') {
|
|
killSourceRef = ::(GHIDRA_CAST<EntityRef *>((&dieSourceRef)))->EntityRef::EntityRef();
|
|
this->Kill(killSourceRef);
|
|
goto LAB_006d9a4d;
|
|
}
|
|
fVar9 = 0.5;
|
|
}
|
|
iVar6 = 0x14;
|
|
local_20 = (float)this->_initSeed;
|
|
rngShifts = 0x500000003;
|
|
local_14 = 0x14;
|
|
rngShiftC = 0x14;
|
|
halves[0] = 0;
|
|
halves[1] = 0;
|
|
halfIndex = 0;
|
|
do {
|
|
iVar1 = this->_type;
|
|
local_28 = GHIDRA_CAST<int *>((this->_size * fVar9));
|
|
spawnPos.y = 0.0;
|
|
spawnPos.x = 0.0;
|
|
if (iVar1 == 0x104) {
|
|
if (this->_variant != 0) goto LAB_006d9b71;
|
|
LAB_006d9b3e:
|
|
if (halfIndex == 0) {
|
|
sideSign = &DAT_bf800000;
|
|
}
|
|
else {
|
|
sideSign = GHIDRA_CAST<uint8_t *>(0x3f800000);
|
|
}
|
|
spawnPos.y = (float)local_28 * 0.0;
|
|
spawnPos.x = (float)local_28 * (float)sideSign;
|
|
}
|
|
else {
|
|
if ((((iVar1 == 0x24) || (iVar1 == 0x106)) || (iVar1 == 0x107)) ||
|
|
((iVar1 == 0x45 && (this->_variant == 0)))) goto LAB_006d9b3e;
|
|
LAB_006d9b71:
|
|
if (local_20 == 0.0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
|
|
pcVar2 = (code *)swi(3);
|
|
bVar3 = (*pcVar2)();
|
|
return bVar3;
|
|
}
|
|
uVar5 = GHIDRA_UINT(local_20) >> ((uint8_t)rngShifts & 0x1f) ^ GHIDRA_UINT(local_20);
|
|
rngShifts2 = 0x100000003;
|
|
uVar5 = uVar5 << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ uVar5;
|
|
local_20 = (float)(uVar5 >> ((uint8_t)iVar6 & 0x1f) ^ uVar5);
|
|
if (local_20 == 0.0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
|
|
pcVar2 = (code *)swi(3);
|
|
bVar3 = (*pcVar2)();
|
|
return bVar3;
|
|
}
|
|
uVar5 = GHIDRA_UINT(local_20) >> 3 ^ GHIDRA_UINT(local_20);
|
|
uVar5 = uVar5 << 1 ^ uVar5;
|
|
uVar5 = uVar5 >> 0xe ^ uVar5;
|
|
fVar8 = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) *
|
|
2.3283062e-10 * 3.14;
|
|
source = GHIDRA_CAST<EntityRef *>((fVar8 + fVar8));
|
|
local_24 = GHIDRA_CAST<uint32_t *>(sin((float)source));
|
|
spawnPos.x = cos((float)source);
|
|
spawnPos.x = spawnPos.x * (float)local_28;
|
|
spawnPos.y = (float)local_24 * (float)local_28;
|
|
}
|
|
spawnPos.y = spawnPos.y + (this->_pos).y;
|
|
spawnPos.x = spawnPos.x + (this->_pos).x;
|
|
source = GHIDRA_CAST<EntityRef *>(this->_type);
|
|
uVar5 = this->_variant;
|
|
if (source == GHIDRA_CAST<EntityRef *>(0x45)) {
|
|
if (uVar5 == 0) {
|
|
uVar5 = 1;
|
|
}
|
|
}
|
|
else if (source == GHIDRA_CAST<EntityRef *>(0x398)) {
|
|
uVar5 = 0;
|
|
source = GHIDRA_CAST<EntityRef *>(0x38a);
|
|
if (halfIndex != 0) {
|
|
source = GHIDRA_CAST<EntityRef *>(0x45);
|
|
}
|
|
}
|
|
if (local_20 == 0.0) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("RNG Seed is zero!\n"));
|
|
pcVar2 = (code *)swi(3);
|
|
bVar3 = (*pcVar2)();
|
|
return bVar3;
|
|
}
|
|
rngState = GHIDRA_UINT(local_20) >> ((uint8_t)rngShifts & 0x1f) ^ GHIDRA_UINT(local_20);
|
|
rngState = rngState << ((uint8_t)((uint64_t)rngShifts >> 0x20) & 0x1f) ^ rngState;
|
|
local_20 = (float)(rngState >> ((uint8_t)local_14 & 0x1f) ^ rngState);
|
|
half = (Entity_NPC *)
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(GHIDRA_UINT(source),uVar5,&spawnPos,&g_vectorZero,GHIDRA_CAST<Entity *>(this),
|
|
this->_subtype,GHIDRA_UINT(local_20));
|
|
if (this->_isChampion != 0) {
|
|
Morph(half,GHIDRA_INT(source),uVar5,this->_subtype,this->_championColorIdx);
|
|
}
|
|
half->_scoreMultiplier = this->_scoreMultiplier * 0.5;
|
|
if (half->_type == 0x322) {
|
|
parentLinkSlot = &half->_parent;
|
|
local_24 = GHIDRA_CAST<uint32_t *>(this->_parent);
|
|
if (half->_parent != 0) {
|
|
source = GHIDRA_CAST<EntityRef *>(parentLinkSlot);
|
|
msvc::multiset<unsigned_int>::erase(&source);
|
|
}
|
|
*parentLinkSlot = local_24;
|
|
if (local_24 != GHIDRA_CAST<uint32_t *>(0x0)) {
|
|
msvc::multiset<unsigned_int>::insert(parentLinkSlot);
|
|
}
|
|
if ((halfIndex == 0) && (iVar6 = this->_parent, *GHIDRA_CAST<int *>((iVar6 + 0x28)) == 3)) {
|
|
parentLinkSlot = GHIDRA_CAST<uint32_t *>((iVar6 + 0xdc0));
|
|
if (*GHIDRA_CAST<int *>((iVar6 + 0xdc0)) != 0) {
|
|
local_24 = parentLinkSlot;
|
|
msvc::multiset<unsigned_int>::erase(&local_24);
|
|
}
|
|
*parentLinkSlot = half;
|
|
msvc::multiset<unsigned_int>::insert(parentLinkSlot);
|
|
}
|
|
EntityList::AddPersistentEntity
|
|
(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST<Entity *>(half));
|
|
}
|
|
if (this->_type == 0x45) {
|
|
if (this->_variant != 0) goto LAB_006d9ded;
|
|
(half->_sprite)._flipX = halfIndex != 0;
|
|
}
|
|
else if (this->_type != 0x398) {
|
|
LAB_006d9ded:
|
|
fVar9 = this->_scale * 0.66;
|
|
half->_scale = fVar9;
|
|
fVar9 = fVar9 * half->_shrinkStatus1;
|
|
fVar8 = fVar9 * g_vectorOne.x;
|
|
(half->_sprite)._scale.y = fVar9 * g_vectorOne.y;
|
|
(half->_sprite)._scale.x = fVar8;
|
|
half->_scaleMulti = this->_scaleMulti * 0.66;
|
|
}
|
|
if (half->_type == 0x38a) {
|
|
EntityList::QuerySublist
|
|
(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST<EntityList_EL *>(hornfelDoors),
|
|
0x3c7,-1,-1,0,0);
|
|
cleanupFlags = cleanupFlags | 3;
|
|
if (iStack_9c != 0) goto LAB_006d9e96;
|
|
source = GHIDRA_CAST<EntityRef *>(CONCAT13(1,(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(source)) + 0x0)))));
|
|
}
|
|
else {
|
|
LAB_006d9e96:
|
|
source = GHIDRA_CAST<EntityRef *>((GHIDRA_UINT(source) & 0xffffff));
|
|
}
|
|
if (((cleanupFlags & 1) != 0) &&
|
|
(cleanupFlags = cleanupFlags & 0xfffffffe, hornfelDoors[0] == '\0')) {
|
|
local_8 = 0;
|
|
tracked_alloc(1,(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)hornfelDoors)) + 0x4))),0);
|
|
local_8 = 0xffffffff;
|
|
}
|
|
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(source)) + 0x3))) != '\0') {
|
|
if (GHIDRA_CAST<int *>(half->_minecart) != GHIDRA_CAST<int *>(0x0)) {
|
|
(**(code **)(*GHIDRA_CAST<int *>(half->_minecart) + 0x28))();
|
|
}
|
|
half->_state = 0xd;
|
|
curAnimData = (half->_sprite)._animState._animData;
|
|
if (curAnimData == GHIDRA_CAST<uint8_t *>(0x0)) {
|
|
LAB_006d9f46:
|
|
bVar3 = ANM2::SetAnimation(&half->_sprite,&DAT_00b1cdf8,1);
|
|
if (bVar3 != 0) {
|
|
AnimationState::Rewind(&(half->_sprite)._animState);
|
|
(half->_sprite)._animState._isPlaying = 1;
|
|
}
|
|
}
|
|
else {
|
|
animNameCh = curAnimData;
|
|
if (0xf < *GHIDRA_CAST<uint32_t *>((curAnimData + 0x14))) {
|
|
animNameCh = *GHIDRA_CAST<uint8_t **>(curAnimData);
|
|
}
|
|
expectedNameCh = &DAT_00b1cdf8;
|
|
do {
|
|
bVar3 = *animNameCh;
|
|
bVar7 = bVar3 < *expectedNameCh;
|
|
if (bVar3 != *expectedNameCh) {
|
|
LAB_006d9f28:
|
|
uVar5 = -GHIDRA_UINT(bVar7) | 1;
|
|
goto LAB_006d9f2d;
|
|
}
|
|
if (bVar3 == 0) break;
|
|
bVar3 = animNameCh[1];
|
|
bVar7 = bVar3 < expectedNameCh[1];
|
|
if (bVar3 != expectedNameCh[1]) goto LAB_006d9f28;
|
|
animNameCh = animNameCh + 2;
|
|
expectedNameCh = expectedNameCh + 2;
|
|
} while (bVar3 != 0);
|
|
uVar5 = 0;
|
|
LAB_006d9f2d:
|
|
if ((uVar5 != 0) ||
|
|
((curAnimData[0x34] != 0 && ((half->_sprite)._animState._isPlaying == 0))))
|
|
goto LAB_006d9f46;
|
|
}
|
|
half->_entityGridCollisionClass = 5;
|
|
}
|
|
half->_maxHitPoints = this->_maxHitPoints * 0.4;
|
|
half->_health = this->_health * 0.4;
|
|
half->_hitPointsMulti = this->_hitPointsMulti * 0.4;
|
|
game = g_game;
|
|
iVar6 = this->_type;
|
|
if (iVar6 == 0x104) {
|
|
if (this->_variant == 0) {
|
|
half->_state = 3;
|
|
half->_entityCollisionClass = 4;
|
|
(half->_targetPosition).x = 0.3;
|
|
(half->_targetPosition).y = 0.0;
|
|
}
|
|
else {
|
|
if (this->_variant != 10) goto LAB_006da2c0;
|
|
source = GHIDRA_CAST<EntityRef *>(this->_parent);
|
|
if (source != GHIDRA_CAST<EntityRef *>(0x0)) {
|
|
parentLinkSlot = &half->_parent;
|
|
if (half->_parent != 0) {
|
|
local_28 = parentLinkSlot;
|
|
msvc::multiset<unsigned_int>::erase(&local_28);
|
|
}
|
|
*parentLinkSlot = source;
|
|
msvc::multiset<unsigned_int>::insert(parentLinkSlot);
|
|
if (halfIndex != 0) {
|
|
*GHIDRA_CAST<int *>((*parentLinkSlot + 0xbc0)) = *GHIDRA_CAST<int *>((*parentLinkSlot + 0xbc0)) + 1;
|
|
}
|
|
half->_spawnFrame = this->_spawnFrame;
|
|
half->_state = this->_state;
|
|
local_14 = rngShiftC;
|
|
}
|
|
}
|
|
goto LAB_006da4a7;
|
|
}
|
|
if (iVar6 == 0x44) {
|
|
half->_i1 = this->_i1;
|
|
layer = ANM2::GetLayer(&this->_sprite,GHIDRA_CAST<uint8_t *>(0x0));
|
|
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&half->_sprite))))->Sprite::ReplaceSpritesheet(0,&layer->_spriteSheetPath);
|
|
ANM2::LoadGraphics(&half->_sprite,unk);
|
|
EntityList::QuerySublist
|
|
(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST<EntityList_EL *>(peeps),0x44,-1,-1
|
|
,0,0);
|
|
cleanupFlags = cleanupFlags | 4;
|
|
local_8 = 1;
|
|
source = GHIDRA_CAST<EntityRef *>(0x0);
|
|
if (pEStack_5c != GHIDRA_CAST<EntityRef *>(0x0)) {
|
|
listData = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)peeps)) + 0x4)));
|
|
do {
|
|
iVar6 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(listData) + GHIDRA_INT(source) * 4));
|
|
if (9 < *GHIDRA_CAST<uint32_t *>((iVar6 + 0x2c))) {
|
|
parentLinkSlot = GHIDRA_CAST<uint32_t *>((iVar6 + 0x3bc));
|
|
if (*GHIDRA_CAST<Entity_NPC **>((iVar6 + 0x3bc)) == this) {
|
|
if (*GHIDRA_CAST<Entity_NPC **>((iVar6 + 0x3bc)) != GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
|
erasePeepParent = parentLinkSlot;
|
|
msvc::multiset<unsigned_int>::erase(&erasePeepParent);
|
|
}
|
|
*parentLinkSlot = half;
|
|
msvc::multiset<unsigned_int>::insert(parentLinkSlot);
|
|
}
|
|
listData = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)peeps)) + 0x4)));
|
|
}
|
|
source = GHIDRA_CAST<EntityRef *>((GHIDRA_INT(&source->_type) + 1));
|
|
} while (source < pEStack_5c);
|
|
}
|
|
local_8 = 0xffffffff;
|
|
if (peeps[0] != '\0') goto LAB_006da4a7;
|
|
local_8 = 2;
|
|
listData = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)peeps)) + 0x4)));
|
|
LAB_006da145:
|
|
tracked_alloc(1,listData,0);
|
|
local_8 = 0xffffffff;
|
|
}
|
|
else if (iVar6 == 0x4f) {
|
|
if (((this->_variant == 0) || (this->_variant == 2)) || (this->_variant == 1)) {
|
|
half->_state = 4;
|
|
EntityList::QuerySublist
|
|
(GHIDRA_CAST<EntityList *>((GHIDRA_INT(game->_room) + 0x1218)),GHIDRA_CAST<EntityList_EL *>(umbilicalCords),
|
|
0x4f,0x14,-1,0,0);
|
|
cleanupFlags = cleanupFlags | 8;
|
|
killSourceRef = GHIDRA_CAST<EntityRef *>(0x0);
|
|
local_8 = 3;
|
|
if (pEStack_34 != GHIDRA_CAST<EntityRef *>(0x0)) {
|
|
listData = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)umbilicalCords)) + 0x4)));
|
|
do {
|
|
umbilicalCord = *GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(listData) + GHIDRA_INT(killSourceRef) * 4));
|
|
if (GHIDRA_CAST<Entity_NPC *>(umbilicalCord[0xef]) == this) {
|
|
(**(code **)(*umbilicalCord + 0x28))();
|
|
listData = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)umbilicalCords)) + 0x4)));
|
|
}
|
|
killSourceRef = GHIDRA_CAST<EntityRef *>((GHIDRA_INT(&killSourceRef->_type) + 1));
|
|
} while (killSourceRef < pEStack_34);
|
|
}
|
|
if ((this->_type == 0x4f) && (this->_variant == 2)) {
|
|
EntityList::QuerySublist
|
|
(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST<EntityList_EL *>(geminiBabies)
|
|
,0x4f,0xc,-1,0,0);
|
|
listData = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)geminiBabies)) + 0x4)));
|
|
cleanupFlags = cleanupFlags | 0x10;
|
|
iStack_38 = iStack_80;
|
|
umbilicalCords[0] = '\x01';
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(umbilicalCords)) + 0x4))) = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(geminiBabies)) + 0x4)));
|
|
pEStack_34 = pEStack_7c;
|
|
if (geminiBabies[0] == '\0') {
|
|
(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 4;
|
|
tracked_alloc(1,(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)geminiBabies)) + 0x4))),0);
|
|
local_8 = CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),3);
|
|
}
|
|
source = GHIDRA_CAST<EntityRef *>(0x0);
|
|
if (pEStack_7c != GHIDRA_CAST<EntityRef *>(0x0)) {
|
|
do {
|
|
umbilicalCord = GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(listData) + GHIDRA_INT(source) * 4)) + 0x3bc));
|
|
if (GHIDRA_CAST<Entity_NPC *>(*umbilicalCord) == this) {
|
|
if (GHIDRA_CAST<Entity_NPC *>(*umbilicalCord) != GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
|
eraseBabyParent = umbilicalCord;
|
|
msvc::multiset<unsigned_int>::erase(&eraseBabyParent);
|
|
}
|
|
*umbilicalCord = GHIDRA_INT(half);
|
|
msvc::multiset<unsigned_int>::insert(umbilicalCord);
|
|
}
|
|
source = GHIDRA_CAST<EntityRef *>((GHIDRA_INT(&source->_type) + 1));
|
|
listData = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)umbilicalCords)) + 0x4)));
|
|
} while (source < pEStack_7c);
|
|
goto LAB_006da29e;
|
|
}
|
|
}
|
|
else {
|
|
LAB_006da29e:
|
|
listData = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)umbilicalCords)) + 0x4)));
|
|
}
|
|
local_8 = 0xffffffff;
|
|
if (umbilicalCords[0] == '\0') {
|
|
local_8 = 5;
|
|
goto LAB_006da145;
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
LAB_006da2c0:
|
|
if (iVar6 == 0x61) {
|
|
half->_state = 9;
|
|
}
|
|
else if (iVar6 == 0x41) {
|
|
if (this->_variant == 1) {
|
|
half->_spawnerType = 0;
|
|
half->_spawnerVariant = 0;
|
|
}
|
|
}
|
|
else if (iVar6 == 0x40) {
|
|
if (this->_i1 != 0) {
|
|
half->_i1 = 1;
|
|
layer = ANM2::GetLayer(&half->_sprite,GHIDRA_CAST<uint8_t *>(0x1));
|
|
layer->_visible = 0;
|
|
}
|
|
}
|
|
else if (iVar6 == 0x3f) {
|
|
if (this->_state == 9) {
|
|
half->_state = 9;
|
|
}
|
|
}
|
|
else if (iVar6 == 900) {
|
|
half->_state = this->_state;
|
|
half->_entityGridCollisionClass = 3;
|
|
(half->_sprite)._overlayRenderFirst = 1;
|
|
}
|
|
else if (iVar6 == 0x2d) {
|
|
if (halfIndex == 0) {
|
|
EntityList::QuerySublist
|
|
(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST<EntityList_EL *>(momParts),
|
|
0x2d,-1,-1,0,0);
|
|
local_8 = 6;
|
|
source = GHIDRA_CAST<EntityRef *>(0x0);
|
|
if (pEStack_8c != GHIDRA_CAST<EntityRef *>(0x0)) {
|
|
do {
|
|
momPart = *GHIDRA_CAST<Entity_NPC **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(momParts)) + 0x4))) + GHIDRA_INT(source) * 4));
|
|
if ((momPart == GHIDRA_CAST<Entity_NPC *>(0x0)) ||
|
|
(((*GHIDRA_CAST<int *>(&g_game->_deathmatchManager) < 2 || (momPart->_type != 1)) &&
|
|
(0x3dd < momPart->_type - 10U)))) {
|
|
momPart = GHIDRA_CAST<Entity_NPC *>(0x0);
|
|
}
|
|
if (momPart != this) {
|
|
parentLinkSlot = &momPart->_parent;
|
|
if (GHIDRA_CAST<Entity_NPC *>(momPart->_parent) == this) {
|
|
momPart->_health = momPart->_maxHitPoints;
|
|
if (GHIDRA_CAST<Entity_NPC *>(momPart->_parent) != GHIDRA_CAST<Entity_NPC *>(0x0)) {
|
|
eraseMomPartParent = parentLinkSlot;
|
|
msvc::multiset<unsigned_int>::erase(&eraseMomPartParent);
|
|
}
|
|
*parentLinkSlot = half;
|
|
msvc::multiset<unsigned_int>::insert(parentLinkSlot);
|
|
}
|
|
}
|
|
source = GHIDRA_CAST<EntityRef *>((GHIDRA_INT(&source->_type) + 1));
|
|
} while (source < pEStack_8c);
|
|
}
|
|
local_8 = 0xffffffff;
|
|
if (momParts[0] == '\0') {
|
|
local_8 = 7;
|
|
listData = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((void *)momParts)) + 0x4)));
|
|
goto LAB_006da145;
|
|
}
|
|
}
|
|
else {
|
|
parentLinkSlot = &half->_parent;
|
|
if (half->_parent != 0) {
|
|
eraseHalfParent = parentLinkSlot;
|
|
msvc::multiset<unsigned_int>::erase(&eraseHalfParent);
|
|
}
|
|
*parentLinkSlot = halves[0];
|
|
if (halves[0] != 0) {
|
|
msvc::multiset<unsigned_int>::insert(parentLinkSlot);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
LAB_006da4a7:
|
|
iVar6 = local_14;
|
|
halves[halfIndex] = GHIDRA_INT(half);
|
|
half->_spawnGridIndex = this->_spawnGridIndex;
|
|
if ((this->_flags & 0x8000000000) != 0) {
|
|
halfFlags = half->_flags;
|
|
flagsHigh = GHIDRA_CAST<uint32_t *>((GHIDRA_INT(&half->_flags) + 4));
|
|
*flagsHigh = *flagsHigh | 0x80;
|
|
*GHIDRA_CAST<int *>(&half->_flags) = GHIDRA_INT(halfFlags);
|
|
}
|
|
halfIndex = halfIndex + 1;
|
|
if (1 < halfIndex) goto LAB_006da4fe;
|
|
fVar9 = 0.5;
|
|
} while( true );
|
|
}
|
|
killSourceRef = ::(GHIDRA_CAST<EntityRef *>((&dieSourceRef2)))->EntityRef::EntityRef();
|
|
this->Kill(killSourceRef);
|
|
goto LAB_006d9a4d;
|
|
}
|
|
LAB_006d9a2b:
|
|
fVar8 = this->_health + this->_health;
|
|
}
|
|
this->TakeDamage(fVar8,0,0,source,0x1e,uVar5);
|
|
LAB_006d9a4d:
|
|
if (isPlaySound != 0) {
|
|
(GHIDRA_CAST<Game *>((g_game)))->Game::ShakeScreen(0xf);
|
|
}
|
|
ExceptionList = local_10;
|
|
return 1;
|
|
LAB_006da4fe:
|
|
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::BloodExplode();
|
|
this->Remove();
|
|
goto LAB_006d9a4d;
|
|
}
|
|
|
|
// 006da530
|
|
void Entity_NPC::UpdatePickupGhosts()
|
|
{
|
|
uint32_t uVar1;
|
|
Entity_Player *guppysEyeOwner;
|
|
Entity_Effect *lootPreview;
|
|
void *lootProxy;
|
|
void *shopkeeperLoot [4];
|
|
int shopkeeperLootCount;
|
|
void *fireplaceLoot [4];
|
|
int fireplaceLootCount;
|
|
void **local_14;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
void *local_8;
|
|
void **ghostEntitySlot;
|
|
bool isGhostShown;
|
|
|
|
local_8 = (void *)0xffffffff;
|
|
puStack_c = &LAB_00afad35;
|
|
local_10 = ExceptionList;
|
|
uVar1 = __security_cookie ^ GHIDRA_UINT((fireplaceLoot + 9));
|
|
ExceptionList = &local_10;
|
|
isGhostShown = false;
|
|
guppysEyeOwner =
|
|
PlayerManager::FirstCollectibleOwner
|
|
(&g_game->_playerManager,0x299,GHIDRA_CAST<RNG **>(&g_game->_playerManager),1);
|
|
if (guppysEyeOwner != GHIDRA_CAST<Entity_Player *>(0x0)) {
|
|
if (this->_type == 0x21) {
|
|
if (this->_health <= 1.0) goto LAB_006da6c5;
|
|
fireplace_get_loot(this,fireplaceLoot,0);
|
|
local_8 = (void *)0x0;
|
|
if (fireplaceLootCount != 0) {
|
|
ghostEntitySlot = &this->_pickupGhostsEntity;
|
|
lootPreview = Entity_Effect::CreateLootPreview
|
|
(fireplaceLoot,&this->_pos,GHIDRA_CAST<Entity *>(this),this->_pickupGhostsEntity)
|
|
;
|
|
if (*ghostEntitySlot != lootPreview) {
|
|
if (*ghostEntitySlot != GHIDRA_CAST<Entity_Effect *>(0x0)) {
|
|
local_14 = ghostEntitySlot;
|
|
msvc::multiset<unsigned_int>::erase(&local_14);
|
|
}
|
|
*ghostEntitySlot = lootPreview;
|
|
if (lootPreview != GHIDRA_CAST<Entity_Effect *>(0x0)) {
|
|
msvc::multiset<unsigned_int>::insert(ghostEntitySlot);
|
|
}
|
|
}
|
|
isGhostShown = true;
|
|
}
|
|
local_8 = (void *)0xffffffff;
|
|
msvc::deque<LootEntry>::clear(uVar1);
|
|
lootProxy = fireplaceLoot[0];
|
|
fireplaceLoot[0] = (void *)0x0;
|
|
}
|
|
else {
|
|
if ((this->_type != 0x11) || (this->_dead != 0)) goto LAB_006da6c5;
|
|
shopkeeper_get_loot(this,shopkeeperLoot,0);
|
|
local_8 = (void *)0x1;
|
|
if (shopkeeperLootCount != 0) {
|
|
ghostEntitySlot = &this->_pickupGhostsEntity;
|
|
lootPreview = Entity_Effect::CreateLootPreview
|
|
(shopkeeperLoot,&this->_pos,GHIDRA_CAST<Entity *>(this),this->_pickupGhostsEntity
|
|
);
|
|
if (*ghostEntitySlot != lootPreview) {
|
|
if (*ghostEntitySlot != GHIDRA_CAST<Entity_Effect *>(0x0)) {
|
|
local_14 = ghostEntitySlot;
|
|
msvc::multiset<unsigned_int>::erase(&local_14);
|
|
}
|
|
*ghostEntitySlot = lootPreview;
|
|
if (lootPreview != GHIDRA_CAST<Entity_Effect *>(0x0)) {
|
|
msvc::multiset<unsigned_int>::insert(ghostEntitySlot);
|
|
}
|
|
}
|
|
isGhostShown = true;
|
|
}
|
|
local_8 = (void *)0xffffffff;
|
|
msvc::deque<LootEntry>::clear(uVar1);
|
|
lootProxy = shopkeeperLoot[0];
|
|
shopkeeperLoot[0] = (void *)0x0;
|
|
}
|
|
operator_delete(lootProxy,8);
|
|
if (isGhostShown) {
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
}
|
|
LAB_006da6c5:
|
|
if (this->_pickupGhostsEntity != GHIDRA_CAST<int *>(0x0)) {
|
|
(**(code **)(*GHIDRA_CAST<int *>(this->_pickupGhostsEntity) + 0x28))();
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|
|
|
|
// 007e92b0
|
|
int Entity_NPC::GetBossColorIdx()
|
|
{
|
|
return this->_bosscoloridx;
|
|
}
|
|
|
|
// 0096ce90
|
|
void Entity_NPC::SetAimAngle(float angle)
|
|
{
|
|
float prevAngle;
|
|
|
|
prevAngle = (this->_pathfinder)._movementTarget.y;
|
|
(this->_pathfinder)._movementTarget.x = angle;
|
|
(this->_pathfinder)._movementTarget.y = angle;
|
|
(this->_pathfinder)._moveDirection.x = prevAngle;
|
|
(this->_sprite)._rotation = angle - 90.0;
|
|
return;
|
|
}
|
|
|
|
// 009a8b90
|
|
void Entity_NPC::render_debug(float *param_1, int param_2)
|
|
{
|
|
int stageNum;
|
|
uint32_t extraout_EAX;
|
|
uint32_t extraout_EAX_00;
|
|
int in_ECX;
|
|
KColor *color;
|
|
KColor *color_00;
|
|
KColor *color_01;
|
|
float fVar1;
|
|
double dVar2;
|
|
float fVar3;
|
|
float fVar4;
|
|
uint8_t auStack_ee [2];
|
|
uint8_t local_ec [8];
|
|
uint32_t local_e4;
|
|
Vector local_e0;
|
|
uint8_t *local_d8;
|
|
int local_d4;
|
|
float local_d0;
|
|
float local_cc;
|
|
uint8_t *local_c8;
|
|
uint8_t local_c4 [16];
|
|
uint8_t local_b4;
|
|
uint8_t local_b0 [8];
|
|
float hpStageRatio;
|
|
float maxHitPoints;
|
|
KColor local_a0;
|
|
uint8_t auStack_84 [12];
|
|
uint8_t local_78 [116];
|
|
code *renderQuadFn;
|
|
|
|
g_graphicsManager_blendMode[1] = 1;
|
|
g_graphicsManager_blendMode[0] = 0;
|
|
g_graphicsManager_blendMode[2] = 7;
|
|
if (((uint8_t)g_graphicsManager_flags & 4) == 0) {
|
|
g_graphicsManager_blendMode[1] = 6;
|
|
}
|
|
g_graphicsManager_blendMode[3] = 1;
|
|
g_graphicsManager_blendMode[4] = 7;
|
|
local_d8 = *GHIDRA_CAST<uint8_t **>((param_2 + 0x380));
|
|
maxHitPoints = *GHIDRA_CAST<float *>((param_2 + 900));
|
|
if ((g_game->_stageType == 4) || (g_game->_stageType == 5)) {
|
|
stageNum = g_game->_stage + 1;
|
|
}
|
|
else {
|
|
stageNum = g_game->_stage;
|
|
}
|
|
hpStageRatio = maxHitPoints / ((float)stageNum + (float)stageNum + 6.0);
|
|
dVar2 = (double)hpStageRatio;
|
|
libm_sse2_log10_precise();
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_ec)) + 0x0))) = ((float)dVar2 + 1.0) * 24.0 + 0.5;
|
|
dVar2 = floor((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((double)(float)local_ec)) + 0x0))));
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_ec)) + 0x0))) = (BADTYPE)dVar2;
|
|
fVar3 = (*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_ec)) + 0x0)));
|
|
if ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_ec)) + 0x0))) <= 8.0) {
|
|
fVar3 = 8.0;
|
|
}
|
|
if (48.0 <= fVar3) {
|
|
fVar3 = 48.0;
|
|
}
|
|
renderQuadFn = *(code **)(**GHIDRA_CAST<int **>((in_ECX + 0x5488)) + 0x14);
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_b0)) + 0x4))) = fVar3;
|
|
(GHIDRA_CAST<KColor *>((&local_a0)))->KColor::SetFromARGB(0xffffffff);
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_ec)) + 0x0))) = -fVar3 * 0.5;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_ec)) + 0x4))) = 4.0;
|
|
local_e4 = 0x41000000;
|
|
local_e0.x = ((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&((float)local_ec)) + 0x0))) - 4.0) + *param_1;
|
|
local_e0.y = param_1[1] - 4.0;
|
|
render_quad_set_rect(local_78,&local_e0,GHIDRA_CAST<Vector *>((local_ec + 4)),color);
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_c4)) + 0x0))) = 0.0;
|
|
local_c8 = GHIDRA_CAST<uint8_t *>(0x0);
|
|
local_d4 = 0;
|
|
local_d0 = 0.0;
|
|
local_cc = 4.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_c4)) + 0x4))) = 8.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_c4)) + 0x8))) = 4.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_c4)) + 0xc))) = 8.0;
|
|
local_b4 = 1;
|
|
(*renderQuadFn)();
|
|
renderQuadFn = *(code **)(**GHIDRA_CAST<int **>(((*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_c4)) + 0x8))) + 0x5488)) + 0x14);
|
|
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>((local_b0 + 4)))))->KColor::SetFromARGB(0xffffffff);
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_ec)) + 0x0))) = 4.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_ec)) + 0x4))) = 8.0;
|
|
render_quad_set_rect(auStack_84,GHIDRA_CAST<Vector *>((auStack_ee + -6)),GHIDRA_CAST<Vector *>(local_ec),color_00);
|
|
local_d0 = 28.0;
|
|
local_d4 = 0;
|
|
local_e0.x = 28.0;
|
|
local_e0.y = 0.0;
|
|
local_d8 = &DAT_42000000;
|
|
local_cc = 8.0;
|
|
local_c8 = &DAT_42000000;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_c4)) + 0x0))) = 8.0;
|
|
local_c4[4] = 1;
|
|
(*renderQuadFn)(&local_e0);
|
|
renderQuadFn = *(code **)(**GHIDRA_CAST<int **>((local_c8 + 0x5488)) + 0x14);
|
|
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>((local_c4 + 0xc)))))->KColor::SetFromARGB(0xffffffff);
|
|
fVar3 = param_1[1] - 4.0;
|
|
render_quad_set_rect
|
|
(&local_a0._unk,GHIDRA_CAST<Vector *>((auStack_ee + -0x12)),GHIDRA_CAST<Vector *>((auStack_ee + -10)),color_01);
|
|
local_e0.y = 4.0;
|
|
local_e0.x = 0.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_ec)) + 0x0))) = 4.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_ec)) + 0x4))) = 0.0;
|
|
local_e4 = 0x41e00000;
|
|
local_d8 = GHIDRA_CAST<uint8_t *>(0x41000000);
|
|
local_d4 = 0x41e00000;
|
|
local_d0 = 8.0;
|
|
local_cc = (float)CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_cc)) + 0x1))),1);
|
|
(*renderQuadFn)(local_ec,extraout_EAX,g_drawRectUnset);
|
|
fVar3 = fVar3 / (float)local_c8;
|
|
fVar4 = (local_cc - 1.0) / 5.0;
|
|
if (fVar4 <= 0.0) {
|
|
fVar4 = 0.0;
|
|
}
|
|
if (1.0 <= fVar4) {
|
|
fVar4 = 1.0;
|
|
}
|
|
fVar1 = (fVar3 - 0.2) / 0.8;
|
|
if (fVar1 <= 0.0) {
|
|
fVar1 = 0.0;
|
|
}
|
|
if (1.0 <= fVar1) {
|
|
fVar1 = 1.0;
|
|
}
|
|
fVar1 = ((fVar4 * 80.0 + 120.0) - 0.0) * fVar1 + 0.0;
|
|
fVar4 = (ABS(fVar1 - 120.0) - 0.0) / 120.0;
|
|
if (fVar4 <= 0.0) {
|
|
fVar4 = 0.0;
|
|
}
|
|
if (1.0 <= fVar4) {
|
|
fVar4 = 1.0;
|
|
}
|
|
hsv_to_rgb(GHIDRA_CAST<KColor *>(local_b0),fVar1,0.9 - fVar4 * 0.099999964,1.0,1.0);
|
|
renderQuadFn = *(code **)(**GHIDRA_CAST<int **>((local_d4 + 0x5488)) + 0x14);
|
|
(GHIDRA_CAST<KColor *>((GHIDRA_CAST<KColor *>(local_c4))))->KColor::SetFromARGB(0xffffffff);
|
|
local_cc = fVar3 * local_d0;
|
|
ceil((double)local_cc);
|
|
render_quad_set_rect
|
|
(&local_a0._green,GHIDRA_CAST<Vector *>((auStack_ee + -0x1e)),GHIDRA_CAST<Vector *>((auStack_ee + -0x16)),
|
|
GHIDRA_CAST<KColor *>(local_c4));
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_ec)) + 0x4))) = 4.0;
|
|
local_e0.x = fVar3 * 24.0 + 4.0;
|
|
(*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(&(local_ec)) + 0x0))) = 8.0;
|
|
local_e4 = 0x41800000;
|
|
local_e0.y = 16.0;
|
|
local_d8 = GHIDRA_CAST<uint8_t *>(CONCAT31((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(&(local_d8)) + 0x1))),1));
|
|
(*renderQuadFn)(auStack_ee + -10,extraout_EAX_00,local_b0);
|
|
return;
|
|
}
|