Files
isaac-port/generated-src/entity_pickup.cpp
T
shweetandClaude Opus 5.5 3ce74c6e2d Reconstruction layout: generated-src/ (generated) and src/ (curated), CMake, the first takeover: RNG
The decompiled C++ tree moves to generated-src/ (classes.h, C++20); src/ is for code written by hand. A curated function
defines the generated declaration and starts its comment with its address, and source_tree.py stops emitting that body.
src/rng.cpp takes over RNG (SetSeed, the constructor, Next, RandomInt, RandomFloat, Shuffle) with the shift table read
from the exe as a constexpr array; src/log.h names KAGE_LogMessage's levels (1 INFO, 2 NET, 4 WARN, 8 ERROR, 16 ASSERT,
from its prefix jump table). CMakeLists.txt builds src/*.cpp against generated-src/classes.h (clean with -Wall -Wextra).
structs.hpp and headers.py are retired: scripts/merge_fields.py writes the merged field list, classes.h checks the layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 21:10:23 -05:00

5529 lines
224 KiB
C++

#include "classes.h"
// 00431740
int Entity_Pickup::Price()
{
return this->_price;
}
// 005832c0
void Entity_Pickup::GetLootList(Vector *renderOffset)
{
void *pvVar1;
char cVar2;
EntityPtr segment;
uint pointCountRemainder;
int iVar3;
LayerState *layer;
undefined *shader;
int *piVar4;
void *pvVar5;
byte lowerChar;
float *pointCursor;
uint uVar6;
ANM2 *sprite;
float *pointCursor;
char *shaderNameCursor;
bool isPointCountMultipleOf4;
float fVar8;
double dVar9;
undefined1 auStackY_220 [128];
Vector *image;
int *imageRefCount;
float quad;
float quadY0;
float quadX1;
float quadY1;
float quadX2;
float quadY2;
float quadX3;
float quadY3;
Vector cornerC;
Vector cornerB;
Vector cornerA;
float local_f0;
KColor local_dc;
void *uvQuads;
float *uvQuadsEnd;
float *uvQuadsCap;
void *posQuads;
void *posQuadsEnd;
void *posQuadsCap;
float local_b0;
float *uvQuadsCapCache;
void *posQuadsCapCache;
Vector *local_a4;
float halfWidth;
float local_9c;
void *points;
float *pointsEnd;
float *pointsCap;
float local_8c;
Entity_Pickup *pickup;
float *layerFrame;
float local_80;
Vector *texture;
int *local_78;
float local_74;
float *pointsCapCache;
void *local_6c;
float local_68;
void *local_64;
float pixelScale;
EntityPtr local_5c;
void *local_58;
float local_54;
ColorMod spriteColor;
uint local_24;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
float local_14;
byte shaderNameChar;
puStack_20 = GHIDRA_CAST<undefined1 *>((&spriteColor)[1]._offset);
puStack_18 = &LAB_00af53de;
local_1c = ExceptionList;
local_24 = __security_cookie ^ GHIDRA_UINT(((&spriteColor)[1]._colorize + 1));
ExceptionList = &local_1c;
pointCursor = GHIDRA_CAST<float *>(0x0);
local_a4 = renderOffset;
local_64 = (void *)0x0;
points = (void *)0x0;
pointsEnd = GHIDRA_CAST<float *>(0x0);
pointsCapCache = GHIDRA_CAST<float *>(0x0);
pointsCap = GHIDRA_CAST<float *>(0x0);
uvQuads = (void *)0x0;
uvQuadsEnd = GHIDRA_CAST<float *>(0x0);
uvQuadsCapCache = GHIDRA_CAST<float *>(0x0);
uvQuadsCap = GHIDRA_CAST<float *>(0x0);
posQuads = (void *)0x0;
posQuadsEnd = (void *)0x0;
posQuadsCapCache = (void *)0x0;
posQuadsCap = (void *)0x0;
local_14 = 2.8026e-45;
spriteColor._tint[0] = (this->_sprite)._color._tint[0];
spriteColor._tint[1] = (this->_sprite)._color._tint[1];
spriteColor._tint[2] = (this->_sprite)._color._tint[2];
spriteColor._tint[3] = (this->_sprite)._color._tint[3];
spriteColor._offset[2] = (this->_sprite)._color._offset[2];
spriteColor._colorize[0] = (this->_sprite)._color._colorize[0];
spriteColor._colorize[1] = (this->_sprite)._color._colorize[1];
spriteColor._colorize[2] = (this->_sprite)._color._colorize[2];
spriteColor._colorize[3] = (this->_sprite)._color._colorize[3];
(*GHIDRA_CAST<undefined8 *>((GHIDRA_CAST<char *>(&(spriteColor._offset)) + 0x0))) = *GHIDRA_CAST<undefined8 *>((this->_sprite)._color._offset);
local_5c = (EntityPtr)this;
while (((segment = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(local_5c) + 0x3c0)), segment != (EntityPtr)0x0 &&
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(segment) + 0x28)) == 0x38d)) && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(segment) + 0x2c)) == 10))) {
local_5c = segment;
}
local_68 = 0.0;
segment = (EntityPtr)this;
while (((segment = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(segment) + 0x3c0)), segment != (EntityPtr)0x0 &&
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(segment) + 0x28)) == 0x38d)) && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(segment) + 0x2c)) == 10))) {
local_68 = (float)(GHIDRA_INT(local_68) + 1);
}
pickup = this;
pointCursor = (&spriteColor)[1]._offset;
if ((this->_sprite)._animState._animData == (void *)0x0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("AnimationData is NULL\n"));
pointCursor = GHIDRA_CAST<float *>(puStack_20);
}
puStack_20 = GHIDRA_CAST<undefined1 *>(pointCursor);
if (*GHIDRA_CAST<int *>((GHIDRA_INT((pickup->_sprite)._animState._animation) + 0x80)) < 1) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("LayerId out of bounds\n"));
}
pvVar5 = (pickup->_sprite)._animState._animData;
if ((pvVar5 != (void *)0x0) &&
(-1 < *GHIDRA_CAST<int *>((GHIDRA_INT((pickup->_sprite)._animState._animation) + 0x80)))) {
iVar3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar5) + 0x38));
if (iVar3 < 0) {
ExceptionList = local_1c;
return;
}
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar5) + 0x1c)) <= iVar3) {
ExceptionList = local_1c;
return;
}
local_58 = (void *)(iVar3 * 0x10 + *GHIDRA_CAST<int *>((GHIDRA_INT((pickup->_sprite)._animState._animData) + 0x18)))
;
iVar3 = *GHIDRA_CAST<int *>((GHIDRA_INT((pickup->_sprite)._animState._layerFrames) + iVar3 * 4));
if (iVar3 < 0) {
ExceptionList = local_1c;
return;
}
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_58) + 8)) <= iVar3) {
ExceptionList = local_1c;
return;
}
layerFrame = GHIDRA_CAST<float *>((iVar3 * 0x6c + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_58) + 4))));
if (layerFrame == GHIDRA_CAST<float *>(0x0)) {
ExceptionList = local_1c;
return;
}
halfWidth = layerFrame[2] * 0.5 * (pickup->_sprite)._scale.x;
if ((pickup->_subtype == 0) && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(local_5c) + 0xb64)) == 6)) {
fVar8 = (layerFrame[3] - 16.0) * (pickup->_sprite)._scale.y;
}
else {
fVar8 = (pickup->_sprite)._scale.y * layerFrame[3];
}
segment = pickup->_child;
local_8c = (pickup->_posOffset).x + (pickup->_pos).x;
local_5c = (EntityPtr)((pickup->_posOffset).y + (pickup->_pos).y);
local_6c = (void *)(fVar8 / (float)GHIDRA_INT(local_68));
if (((segment != (EntityPtr)0x0) && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(segment) + 0x28)) == 0x38d)) &&
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(segment) + 0x2c)) == 10)) {
do {
local_9c = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(segment) + 0x34c)) + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(segment) + 0x33c));
local_58 = (void *)(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(segment) + 0x350)) + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(segment) + 0x340)));
local_64 = (void *)(local_9c - local_8c);
local_68 = (float)local_58 - (float)local_5c;
fVar8 = sqrtf((float)local_64 * (float)local_64 + local_68 * local_68);
if (0.0 < fVar8) {
local_64 = (void *)((float)local_64 * (1.0 / fVar8));
local_68 = local_68 * (1.0 / fVar8);
}
local_8c = (local_8c - 60.0) * 0.65;
local_5c = (EntityPtr)(((float)local_5c - 140.0) * 0.65);
local_54 = (g_screenHeight - 182.0) * 0.5 + (float)local_5c;
pixelScale = g_displayPixelRatio * g_screenPointScale;
local_74 = ((g_screenWidth - 338.0) * 0.5 + local_8c) * pixelScale + 0.5;
dVar9 = floor((double)local_74);
local_74 = (float)dVar9 / pixelScale;
local_54 = local_54 * pixelScale + 0.5;
dVar9 = floor((double)local_54);
local_54 = (float)dVar9;
local_b0 = -local_68;
fVar8 = layerFrame[6];
if (pointCursor == pointsCapCache) {
std::vector<Vector>::_Emplace_reallocate();
pointsCapCache = pointsCap;
}
else {
*pointCursor = local_74 + halfWidth * fVar8 * local_b0;
pointCursor[1] = local_54 / pixelScale + (float)local_64 * halfWidth * fVar8;
pointsEnd = pointCursor + 2;
}
pointCursor = pointsEnd;
local_74 = (g_screenHeight - 182.0) * 0.5 + (float)local_5c;
pixelScale = g_displayPixelRatio * g_screenPointScale;
local_54 = ((g_screenWidth - 338.0) * 0.5 + local_8c) * pixelScale + 0.5;
dVar9 = floor((double)local_54);
local_5c = (EntityPtr)((float)dVar9 / pixelScale);
local_54 = local_74 * pixelScale + 0.5;
dVar9 = floor((double)local_54);
local_54 = (float)dVar9;
local_80 = -(float)local_64;
fVar8 = layerFrame[6];
if (pointCursor == pointsCapCache) {
std::vector<Vector>::_Emplace_reallocate();
pointsCapCache = pointsCap;
}
else {
*pointCursor = (float)local_5c + local_68 * halfWidth * fVar8;
pointCursor[1] = local_54 / pixelScale + local_80 * halfWidth * fVar8;
pointsEnd = pointCursor + 2;
}
pointCursor = pointsEnd;
local_8c = (local_9c - 60.0) * 0.65;
local_78 = GHIDRA_CAST<int *>((((float)local_58 - 140.0) * 0.65));
local_74 = (g_screenHeight - 182.0) * 0.5 + (float)local_78;
pixelScale = g_displayPixelRatio * g_screenPointScale;
local_54 = ((g_screenWidth - 338.0) * 0.5 + local_8c) * pixelScale + 0.5;
dVar9 = floor((double)local_54);
local_5c = (EntityPtr)((float)dVar9 / pixelScale);
local_54 = local_74 * pixelScale + 0.5;
dVar9 = floor((double)local_54);
local_54 = (float)dVar9;
cornerC.y = local_54 / pixelScale + (float)local_64 * halfWidth * layerFrame[6];
cornerC.x = halfWidth * layerFrame[6] * local_b0 + (float)local_5c;
if (pointCursor == pointsCapCache) {
std::vector<Vector>::_Emplace_reallocate();
pointsCapCache = pointsCap;
}
else {
*pointCursor = cornerC.x;
pointCursor[1] = cornerC.y;
pointsEnd = pointCursor + 2;
}
pointCursor = pointsEnd;
local_b0 = (g_screenHeight - 182.0) * 0.5 + (float)local_78;
pixelScale = g_displayPixelRatio * g_screenPointScale;
local_78 = GHIDRA_CAST<int *>((((g_screenWidth - 338.0) * 0.5 + local_8c) * pixelScale + 0.5));
dVar9 = floor((double)(float)local_78);
local_54 = (float)dVar9 / pixelScale;
local_78 = GHIDRA_CAST<int *>((local_b0 * pixelScale + 0.5));
dVar9 = floor((double)(float)local_78);
local_78 = GHIDRA_CAST<int *>((float)dVar9);
local_f0 = (float)local_78 / pixelScale + local_80 * halfWidth * layerFrame[6];
if (pointCursor == pointsCapCache) {
std::vector<Vector>::_Emplace_reallocate();
pointsCapCache = pointsCap;
}
else {
*pointCursor = local_68 * halfWidth * layerFrame[6] + local_54;
pointCursor[1] = local_f0;
pointsEnd = pointCursor + 2;
}
segment = *GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(segment) + 0x3c0));
local_8c = local_9c;
local_5c = (EntityPtr)local_58;
pointCursor = pointsEnd;
} while (((segment != (EntityPtr)0x0) && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(segment) + 0x28)) == 0x38d)) &&
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(segment) + 0x2c)) == 10));
local_64 = points;
}
pointCursor = GHIDRA_CAST<float *>(0x0);
uVar6 = GHIDRA_INT(pointCursor) - GHIDRA_INT(local_64) >> 3;
if (0 < GHIDRA_INT(uVar6)) {
pointCountRemainder = uVar6 & 0x80000003;
isPointCountMultipleOf4 = pointCountRemainder == 0;
if (GHIDRA_INT(pointCountRemainder) < 0) {
isPointCountMultipleOf4 = (pointCountRemainder - 1 | 0xfffffffc) == 0xffffffff;
}
if (isPointCountMultipleOf4) {
local_80 = layerFrame[1];
pointCursor = GHIDRA_CAST<float *>((GHIDRA_INT(local_64) + 0x1c));
local_58 = (void *)((uVar6 - 1 >> 2) + 1);
do {
local_dc._unk = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_dc._unk)) + 0x1))),1);
if ((pickup->_sprite)._flipX == 0) {
local_dc._red = *layerFrame;
local_dc._blue = local_dc._red + layerFrame[2];
}
else {
local_dc._blue = *layerFrame;
local_dc._red = local_dc._blue + layerFrame[2];
}
local_dc._green = local_80 + (float)local_6c;
if (pointCursor == uvQuadsCapCache) {
local_dc._alpha = local_dc._green;
local_80 = local_dc._green;
std::vector<ColoredQuad>::_Emplace_reallocate();
uvQuadsCapCache = uvQuadsCap;
}
else {
pointCursor[1] = 0.0;
*pointCursor = 0.0;
pointCursor[3] = 0.0;
pointCursor[2] = 0.0;
pointCursor[5] = 0.0;
pointCursor[4] = 0.0;
pointCursor[7] = 0.0;
pointCursor[6] = 0.0;
*pointCursor = local_dc._red;
pointCursor[1] = local_80;
pointCursor[2] = local_dc._blue;
pointCursor[3] = local_80;
pointCursor[4] = local_dc._red;
pointCursor[5] = local_dc._green;
pointCursor[6] = local_dc._blue;
pointCursor[7] = local_dc._green;
pointCursor[8] = (float)local_dc._unk;
uvQuadsEnd = pointCursor + 9;
local_80 = local_dc._green;
}
pointCursor = uvQuadsEnd;
local_dc._unk = 0;
local_dc._red = 1.0;
local_dc._green = 1.0;
local_dc._blue = 1.0;
local_dc._alpha = 1.0;
(GHIDRA_CAST<ColorQuad *>((&quad)))->ColorQuad::ColorQuad(&local_dc);
quadX3 = local_a4->x;
quadY3 = local_a4->y;
quad = quadX3 + pointCursor[-7];
quadY0 = quadY3 + pointCursor[-6];
quadX1 = quadX3 + pointCursor[-5];
quadY1 = quadY3 + pointCursor[-4];
quadX2 = quadX3 + pointCursor[-3];
quadX3 = quadX3 + pointCursor[-1];
quadY2 = quadY3 + pointCursor[-2];
quadY3 = quadY3 + *pointCursor;
if (posQuadsEnd == posQuadsCapCache) {
std::vector<ColorQuad>::_Emplace_reallocate();
posQuadsCapCache = posQuadsCap;
}
else {
render_quad_copy(posQuadsEnd,&quad);
posQuadsEnd = (void *)(GHIDRA_INT(posQuadsEnd) + 0x70);
}
local_dc._blue = (float)g_graphicsManager_blendMode[2];
local_dc._red = (float)g_graphicsManager_blendMode[0];
pointCursor = pointCursor + 8;
local_58 = (void *)(GHIDRA_INT(local_58) + -1);
} while (local_58 != (void *)0x0);
local_80 = (float)g_graphicsManager_blendMode[4];
iVar3 = 1;
if (((byte)g_graphicsManager_flags & 4) == 0) {
iVar3 = 6;
}
g_graphicsManager_blendMode[0] = 0;
sprite = &pickup->_sprite;
g_graphicsManager_blendMode[2] = 7;
local_dc._green = (float)g_graphicsManager_blendMode[1];
local_dc._alpha = (float)g_graphicsManager_blendMode[3];
g_graphicsManager_blendMode[3] = 1;
g_graphicsManager_blendMode[4] = 7;
g_graphicsManager_blendMode[1] = iVar3;
layer = (GHIDRA_CAST<ANM2 *>((sprite)))->ANM2::GetLayer(GHIDRA_CAST<byte *>(0x0));
layer->_wrapSMode = 0;
layer = (GHIDRA_CAST<ANM2 *>((sprite)))->ANM2::GetLayer(GHIDRA_CAST<byte *>(0x0));
layer->_wrapTMode = 0;
layer = (GHIDRA_CAST<ANM2 *>((sprite)))->ANM2::GetLayer(GHIDRA_CAST<byte *>(0x0));
(GHIDRA_CAST<LayerState *>((layer)))->LayerState::GetTexture(&texture);
local_14 = (float)CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),3);
if (texture != GHIDRA_CAST<Vector *>(0x0)) {
shader = &g_shaders;
if ((DAT_00c7911c & 1) == 0) {
shader = g_currentShader;
}
local_f0 = 0.0;
local_9c = (float)((GHIDRA_INT(pointCursor) - GHIDRA_INT(uvQuads)) / 0x24);
g_currentShader = shader;
if (local_9c != 0.0) {
local_58 = uvQuads;
local_6c = posQuads;
do {
piVar4 = local_78;
image = GHIDRA_CAST<Vector *>(0x0);
imageRefCount = GHIDRA_CAST<int *>(0x0);
local_a4 = texture;
if (local_78 != GHIDRA_CAST<int *>(0x0)) {
cVar2 = (**(code **)(*local_78 + 4))();
if (cVar2 != '\0') {
if (((imageRefCount != GHIDRA_CAST<int *>(0x0)) &&
(cVar2 = (**(code **)(*imageRefCount + 0xc))(), cVar2 != '\0')) &&
(g_imageReleaseFn != (void *)0x0)) {
(*g_imageReleaseFn)(auStackY_220 + 0x84);
}
image = local_a4;
imageRefCount = piVar4;
}
}
apply_sprite_shader_params(&spriteColor,1,image,imageRefCount);
pvVar1 = local_58;
pvVar5 = local_6c;
(**(code **)(GHIDRA_CAST<char *>(texture->x) + 0x14))(local_58);
local_6c = (void *)(GHIDRA_INT(pvVar5) + 0x70);
local_58 = (void *)(GHIDRA_INT(pvVar1) + 0x24);
local_9c = (float)(GHIDRA_INT(local_9c) + -1);
} while (local_9c != 0.0);
}
}
fVar8 = 7.54039e-42;
g_graphicsManager_blendMode[0] = GHIDRA_INT(local_dc._red);
shaderNameCursor = "KAGE_ColorTextureShader";
g_graphicsManager_blendMode[1] = GHIDRA_INT(local_dc._green);
g_graphicsManager_blendMode[2] = GHIDRA_INT(local_dc._blue);
g_graphicsManager_blendMode[3] = GHIDRA_INT(local_dc._alpha);
g_graphicsManager_blendMode[4] = GHIDRA_INT(local_80);
shaderNameChar = 0x4b;
do {
shaderNameCursor = shaderNameCursor + 1;
lowerChar = shaderNameChar + 0x20;
if (0x19 < (byte)(shaderNameChar + 0xbf)) {
lowerChar = shaderNameChar;
}
uVar6 = GHIDRA_UINT(lowerChar);
if (lowerChar == 0x5c) {
uVar6 = 0x2f;
}
fVar8 = (float)(GHIDRA_INT(fVar8) * 0x21 + uVar6);
shaderNameChar = *shaderNameCursor;
} while (shaderNameChar != 0);
local_6c = (void *)fVar8;
_Find_lower_bound<>();
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(local_f0) + 0xd)) == '\0') &&
(GHIDRA_UINT(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(local_f0) + 0x10))) <= GHIDRA_UINT(fVar8))) && (local_f0 != DAT_00c379bc))
{
piVar4 = GHIDRA_CAST<int *>(std)::map<unsigned_int_4byte>::operator_index();
pvVar5 = (void *)*piVar4;
if ((pvVar5 != (void *)0x0) && ((*GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(pvVar5) + 4)) & 1) != 0)) {
g_currentShader = pvVar5;
}
}
local_14 = (float)CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_14)) + 0x1))),4);
if (((local_78 != GHIDRA_CAST<int *>(0x0)) && (cVar2 = (**(code **)(*local_78 + 0xc))(), cVar2 != '\0'))
&& (g_imageReleaseFn != (void *)0x0)) {
(*g_imageReleaseFn)();
}
if (posQuads != (void *)0x0) {
uVar6 = ((GHIDRA_INT(posQuadsCapCache) - GHIDRA_INT(posQuads)) / 0x70) * 0x70;
pvVar5 = posQuads;
if (0xfff < uVar6) {
pvVar5 = *(void **)(GHIDRA_CAST<char *>(posQuads) + -4);
uVar6 = uVar6 + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(posQuads) + (-4 - GHIDRA_INT(pvVar5))))) goto LAB_00584103;
}
operator_delete(pvVar5,uVar6);
}
if (uvQuads != (void *)0x0) {
uVar6 = ((GHIDRA_INT(uvQuadsCapCache) - GHIDRA_INT(uvQuads)) / 0x24) * 0x24;
pvVar5 = uvQuads;
if (0xfff < uVar6) {
pvVar5 = *(void **)(GHIDRA_CAST<char *>(uvQuads) + -4);
uVar6 = uVar6 + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(uvQuads) + (-4 - GHIDRA_INT(pvVar5))))) goto LAB_00584103;
}
operator_delete(pvVar5,uVar6);
}
}
}
if (local_64 != (void *)0x0) {
uVar6 = GHIDRA_INT(pointsCapCache) - GHIDRA_INT(local_64) & 0xfffffff8;
pvVar5 = local_64;
if (0xfff < uVar6) {
pvVar5 = *(void **)(GHIDRA_CAST<char *>(local_64) + -4);
uVar6 = uVar6 + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_64) + (-4 - GHIDRA_INT(pvVar5))))) {
LAB_00584103:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar5,uVar6);
}
}
ExceptionList = local_1c;
return;
}
// 005b1930
bool Entity_Pickup::IsShopItem()
{
return this->_price != 0;
}
// 005b1940
int Entity_Pickup::Timeout()
{
return this->_timeout;
}
// 005b1980
int Entity_Pickup::OptionsPickupIndex()
{
return this->_optionsPickupIndex;
}
// 005b19b0
Vector * Entity_Pickup::GetRandomPickupVelocity(Vector *buffer, Vector *position, RNG *rng, uint ePickupVelType)
{
Isaac::GetRandomPickupVelocity(buffer,position,ePickupVelType,rng);
return buffer;
}
// 006e0010
void Entity_Pickup::Constructor()
{
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00afaea1;
local_10 = ExceptionList;
ExceptionList = &local_10;
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::constructor();
local_8 = 0;
*GHIDRA_CAST<undefined ***>(this) = IsaacRepentancePlus::Entity_Pickup::vftable;
(GHIDRA_CAST<ANM2 *>((&this->_priceANM2)))->ANM2::constructor();
(this->_colorMod)._tint[0] = 1.0;
(this->_colorMod)._tint[1] = 1.0;
(this->_colorMod)._tint[2] = 1.0;
(this->_colorMod)._tint[3] = 1.0;
(this->_colorMod)._colorize[0] = 0.0;
(this->_colorMod)._colorize[1] = 0.0;
(this->_colorMod)._colorize[2] = 0.0;
(this->_colorMod)._colorize[3] = 0.0;
(this->_colorMod)._offset[0] = 0.0;
(this->_colorMod)._offset[1] = 0.0;
(this->_colorMod)._offset[2] = 0.0;
this->_unkEntityRef = (EntityPtr)0x0;
this->_pickupGhost = (void *)0x0;
this->_megaChestCollectible[0] = (void *)0x0;
this->_megaChestCollectible[1] = (void *)0x0;
this->_flipSaveState = 0;
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x5cc)))) = 0;
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),6);
(GHIDRA_CAST<ANM2 *>((&this->_altPedestalANM2)))->ANM2::constructor();
ExceptionList = local_10;
return;
}
// 006e1640
byte Entity_Pickup::TryFlip(Entity_Player *unusedPlayer, uint unusedSeed)
{
void *state;
void *extraout_EAX;
EntitySaveState *outSaveState;
uint cycleOffset;
EntitySaveState flippedState [2];
int local_84;
EntitySaveState *stateCopy;
void *local_10;
undefined1 *puStack_c;
int local_8;
int cycleItem;
int *flipState;
undefined4 *flipStateRef;
local_8 = 0xffffffff;
puStack_c = &LAB_00afaf4f;
local_10 = ExceptionList;
flipStateRef = &this->_flipSaveState;
if ((this->_flipSaveState == 0) || (this->_variant != 100)) {
return 0;
}
ExceptionList = &local_10;
(GHIDRA_CAST<EntitySaveState *>((flippedState)))->EntitySaveState::constructor();
local_8 = 0;
CanFlip(g_game->_room,this,outSaveState,0);
(this->_dropRNG)._seed = *GHIDRA_CAST<int *>((*flipStateRef + 0x38));
(this->_dropRNG)._shift1 = 5;
(this->_dropRNG)._shift2 = 9;
(this->_dropRNG)._shift3 = 7;
flipState = GHIDRA_CAST<int *>(*flipStateRef);
this->_initSeed = flipState[0xd];
Morph(this,*flipState,flipState[1],flipState[2],1,1,1);
this->_isTouched = *GHIDRA_CAST<byte *>((*flipStateRef + 0x22));
if (*GHIDRA_CAST<int *>((*flipStateRef + 100)) != 0) {
this->_cycleCollectibleCount = 0;
cycleOffset = 0;
do {
cycleItem = *GHIDRA_CAST<int *>((cycleOffset + *GHIDRA_CAST<int *>((*flipStateRef + 100))));
if (cycleItem == 0) break;
if (GHIDRA_UINT(this->_cycleCollectibleCount) < 8) {
this->_cycleCollectibleList[this->_cycleCollectibleCount] = cycleItem;
this->_cycleCollectibleCount = this->_cycleCollectibleCount + 1;
}
cycleOffset = cycleOffset + 4;
} while (cycleOffset < 0x20);
}
if (local_84 == 0) {
state = (void *)0x0;
}
else {
stateCopy = operator_new(0x78);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
if (stateCopy == GHIDRA_CAST<EntitySaveState *>(0x0)) {
state = (void *)0x0;
}
else {
(GHIDRA_CAST<EntitySaveState *>((stateCopy)))->EntitySaveState::copy(flippedState);
state = extraout_EAX;
}
local_8 = (*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(GHIDRA_UINT(local_8))) + 0x1))) << 8;
}
(GHIDRA_CAST<EntitySaveStateRef *>((flipStateRef)))->EntitySaveStateRef::Set(state);
(GHIDRA_CAST<ANM2 *>((&this->_altPedestalANM2)))->ANM2::Reset();
invoke_pending_callbacks(flippedState);
ExceptionList = local_10;
return 1;
}
// 006e17c0
void Entity_Pickup::UpdateLootPreview()
{
void *ptr;
byte isChest;
uint uVar1;
Entity_Player *player;
Entity_Effect *preview;
int extraout_ECX;
void *loot [5];
Vector local_18;
void *local_10;
undefined1 *puStack_c;
void *local_8;
void **ghostRef;
local_8 = (void *)0xffffffff;
puStack_c = &LAB_00afaf7d;
local_10 = ExceptionList;
uVar1 = __security_cookie ^ GHIDRA_UINT((loot + 10));
ExceptionList = &local_10;
player = PlayerManager::FirstCollectibleOwner
(&g_game->_playerManager,0x299,GHIDRA_CAST<RNG **>(&g_game->_playerManager),1);
if (player != GHIDRA_CAST<Entity_Player *>(0x0)) {
isChest = IsChest(this->_variant);
if ((((isChest != 0) && (this->_subtype != 0)) || ((extraout_ECX == 0x45 && (this->_dead == 0)))
) && (this->_timeout < 1)) {
local_18.x = (this->_pos).x;
local_18.y = (this->_pos).y;
player = (GHIDRA_CAST<Game *>((g_game)))->Game::GetNearestPlayer(&local_18);
GetChestLoot(this,loot,0,player);
local_8 = (void *)0x0;
ghostRef = &this->_pickupGhost;
preview = Entity_Effect::CreateLootPreview(loot,&this->_pos,GHIDRA_CAST<Entity *>(this),*ghostRef);
if (*ghostRef != preview) {
if (*ghostRef != GHIDRA_CAST<Entity_Effect *>(0x0)) {
local_18.y = (float)ghostRef;
std::multiset<unsigned_int>::erase(&local_18.y);
}
*ghostRef = preview;
if (preview != GHIDRA_CAST<Entity_Effect *>(0x0)) {
std::multiset<unsigned_int>::insert(ghostRef);
}
}
std::deque<LootEntry>::clear();
ptr = loot[0];
loot[0] = (void *)0x0;
operator_delete(ptr,8);
ExceptionList = local_10;
return;
}
}
if (this->_pickupGhost != GHIDRA_CAST<int *>(0x0)) {
(**(code **)(*GHIDRA_CAST<int *>(this->_pickupGhost) + 0x28))(uVar1);
}
ExceptionList = local_10;
return;
}
// 006e1a80
void Entity_Pickup::SetAlternatePedestal(int pedestalType)
{
byte isOverlaySet;
Vector *nullFrameOffset;
LayerState *layer;
EntityConfig_Entity *pickupConfig;
int partnerPedestalType;
uint i;
Vector *pedestalOffset;
void **megaChestSlot;
void **local_18;
undefined1 lowerBoundResult [8];
void *foundNode;
void *entityConfig;
Manager *manager;
Entity_Pickup *partnerPickup;
if ((((this->_variant == 100) && (-1 < pedestalType)) && (this->_price == 0)) &&
(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 8)) != 0x10)) {
isOverlaySet = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::SetOverlayAnimation(GHIDRA_CAST<byte *>("Alternates"),1);
if ((isOverlaySet != 0) && ((this->_sprite)._overlayAnimState._animData != (void *)0x0)) {
(GHIDRA_CAST<AnimationState *>((&(this->_sprite)._overlayAnimState)))->AnimationState::SetFrameFloat((float)pedestalType);
}
nullFrameOffset = (GHIDRA_CAST<AnimationState *>((&(this->_sprite)._overlayAnimState)))->AnimationState::GetNullFrameById(0);
pedestalOffset = &g_vectorZero;
if (nullFrameOffset != GHIDRA_CAST<Vector *>(0x0)) {
pedestalOffset = nullFrameOffset;
}
layer = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST<byte *>(0x1));
(layer->_pos).x = pedestalOffset->x;
(layer->_pos).y = pedestalOffset->y;
manager = g_manager;
if (pedestalType == 0xb) {
local_18 = (void **)0x518600;
_Find_lower_bound<>(lowerBoundResult,&local_18);
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(foundNode) + 0xd)) == '\0') &&
(*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(foundNode) + 0x10)) < 0x518601)) &&
(foundNode != (manager->_entityConfig)._entities._head)) {
pickupConfig = GHIDRA_CAST<EntityConfig_Entity *>((GHIDRA_INT(foundNode) + 0x18));
}
else {
pickupConfig = (GHIDRA_CAST<EntityConfig *>((&manager->_entityConfig)))->EntityConfig::GetEntity(5,0,0);
}
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::SetSize(pickupConfig->collisionRadius,
pickupConfig->collisionRadiusMulti,pickupConfig->gridCollisionPoints);
return;
}
if ((pedestalType != 0xe) && (pedestalType != 0x13)) {
entityConfig = this->_config;
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::SetSize(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(entityConfig) + 0x38)),
*GHIDRA_CAST<Vector *>((GHIDRA_CAST<char *>(entityConfig) + 0x3c)),*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(entityConfig) + 0x48)));
return;
}
local_18 = (void **)0x503900;
_Find_lower_bound<>(lowerBoundResult,&local_18);
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(foundNode) + 0xd)) == '\0') && (*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(foundNode) + 0x10)) < 0x503901))
&& (foundNode != (manager->_entityConfig)._entities._head)) {
pickupConfig = GHIDRA_CAST<EntityConfig_Entity *>((GHIDRA_INT(foundNode) + 0x18));
}
else {
pickupConfig = (GHIDRA_CAST<EntityConfig *>((&manager->_entityConfig)))->EntityConfig::GetEntity(5,0,0);
}
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::SetSize(pickupConfig->collisionRadius,pickupConfig->collisionRadiusMulti,
pickupConfig->gridCollisionPoints);
if ((this->_megaChestCollectible[0] == (void *)0x0) &&
(this->_megaChestCollectible[1] == (void *)0x0)) {
i = 0;
local_18 = g_game->_room;
if (local_18[0x499] != (void *)0x0) {
while ((((partnerPickup = *GHIDRA_CAST<Entity_Pickup **>((GHIDRA_INT(local_18[0x497]) + i * 4)),
partnerPickup == this || (partnerPickup->_type != 5)) ||
((partnerPickup->_variant != 100 ||
((((partnerPedestalType = GetAlternatePedestal(partnerPickup),
partnerPedestalType != 0xe &&
(partnerPedestalType = GetAlternatePedestal(partnerPickup),
partnerPedestalType != 0x13)) || ((partnerPickup->_pos).x != (this->_pos).x)) ||
(((partnerPickup->_pos).y != (this->_pos).y ||
(partnerPickup->_megaChestCollectible[0] != (void *)0x0)))))))) ||
(partnerPickup->_megaChestCollectible[1] != (void *)0x0))) {
i = i + 1;
if (local_18[0x499] <= i) {
return;
}
}
megaChestSlot = this->_megaChestCollectible;
if (this->_megaChestCollectible[0] != partnerPickup) {
if (this->_megaChestCollectible[0] != GHIDRA_CAST<Entity_Pickup *>(0x0)) {
local_18 = megaChestSlot;
std::multiset<unsigned_int>::erase(&local_18);
}
*megaChestSlot = partnerPickup;
std::multiset<unsigned_int>::insert(megaChestSlot);
}
megaChestSlot = partnerPickup->_megaChestCollectible + 1;
if (partnerPickup->_megaChestCollectible[1] != this) {
if (partnerPickup->_megaChestCollectible[1] != GHIDRA_CAST<Entity_Pickup *>(0x0)) {
local_18 = megaChestSlot;
std::multiset<unsigned_int>::erase(&local_18);
}
*megaChestSlot = this;
std::multiset<unsigned_int>::insert(megaChestSlot);
}
}
}
}
return;
}
// 006e1d70
int Entity_Pickup::GetAlternatePedestal()
{
void *other;
byte isEqual;
byte *****pppppbVar1;
byte *****animNameHeap;
uint capacity;
uint size;
byte *****animName [4];
uint animNameSize;
uint animNameCapacity;
byte ****local_8;
bool isAlternates;
bool isAnimNameOwned;
local_8 = GHIDRA_CAST<byte ****>((__security_cookie ^ GHIDRA_UINT((animName + 7))));
isAnimNameOwned = false;
if (this->_variant == 100) {
other = (this->_sprite)._overlayAnimState._animData;
if (other == (void *)0x0) {
animName[0] = GHIDRA_CAST<byte *****>(0x0);
animNameCapacity = 0xf;
animNameSize = 0;
}
else {
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>(animName))))->std::string::string(other);
}
capacity = animNameCapacity;
animNameHeap = animName[0];
isAnimNameOwned = true;
pppppbVar1 = GHIDRA_CAST<byte *****>(animName);
if (0xf < animNameCapacity) {
pppppbVar1 = animName[0];
}
isEqual = str_eq(GHIDRA_CAST<byte *>(pppppbVar1),animNameSize,GHIDRA_CAST<byte *>("Alternates"),10);
if (isEqual != 0) {
isAlternates = true;
goto LAB_006e1df5;
}
}
else {
animNameHeap = animName[0];
capacity = animNameCapacity;
}
isAlternates = false;
LAB_006e1df5:
if ((isAnimNameOwned) && (0xf < capacity)) {
size = capacity + 1;
pppppbVar1 = animNameHeap;
if (0xfff < size) {
pppppbVar1 = GHIDRA_CAST<byte *****>(animNameHeap[-1]);
size = capacity + 0x24;
if (GHIDRA_CAST<byte *>(0x1f) < GHIDRA_CAST<byte *>((GHIDRA_INT(animNameHeap) + (-4 - GHIDRA_INT(pppppbVar1))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pppppbVar1,size);
}
if (isAlternates) {
return GHIDRA_INT((this->_sprite)._overlayAnimState._animFrame);
}
return -1;
}
// 006e1e60
void Entity_Pickup::SetForceBlind(byte setBlind)
{
byte isPrevForceBlind;
isPrevForceBlind = this->_isForceBlind;
this->_isForceBlind = setBlind;
if (((this->_variant == 100) && (this->_subtype != 0)) && (isPrevForceBlind != setBlind)) {
UpdateSprite(this,0);
}
return;
}
// 006e21f0
void Entity_Pickup::UpdateSprite(byte isIgnoreBlind)
{
char **ppcVar1;
byte isBlind;
int iVar2;
uint curses;
int extraout_ECX;
char *ptr;
int extraout_ECX_00;
int extraout_ECX_01;
int extraout_ECX_02;
int extraout_ECX_03;
std_string spritesheetPath;
uint local_24;
char **ppcStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
void *trinketConfigs;
ppcStack_20 = GHIDRA_CAST<char **>((GHIDRA_INT(&spritesheetPath) + 0x38));
local_14 = 0xffffffff;
puStack_18 = &LAB_00afb00d;
local_1c = ExceptionList;
local_24 = __security_cookie ^ GHIDRA_INT(&spritesheetPath) + 0x2cU;
ExceptionList = &local_1c;
iVar2 = this->_variant;
if (iVar2 == 0x15e) {
curses = this->_subtype & 0x7fff;
trinketConfigs = (g_manager->_itemConfig)._trinkets._begin;
if (GHIDRA_INT(curses) < GHIDRA_INT((g_manager->_itemConfig)._trinkets._end) - GHIDRA_INT(trinketConfigs) >> 2) {
iVar2 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(trinketConfigs) + curses * 4));
}
else {
iVar2 = 0;
}
ppcStack_20 = GHIDRA_CAST<char **>((GHIDRA_INT(&spritesheetPath) + 0x38));
(GHIDRA_CAST<std::string *>((spritesheetPath._buf)))->std::string::string((void *)(iVar2 + 0x38));
local_14 = 0;
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&spritesheetPath);
(this->_sprite)._bitflags = GHIDRA_UINT(this->_subtype) >> 8 & 0x80;
iVar2 = extraout_ECX;
}
else {
if (iVar2 == 100) {
ppcStack_20 = GHIDRA_CAST<char **>((GHIDRA_INT(&spritesheetPath) + 0x38));
if (((isIgnoreBlind == 0) &&
(ppcStack_20 = GHIDRA_CAST<char **>((GHIDRA_INT(&spritesheetPath) + 0x38)), g_game->_currentDimensionIdx != 2)
) && ((ppcStack_20 = GHIDRA_CAST<char **>((GHIDRA_INT(&spritesheetPath) + 0x38)),
curses = (GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level::GetCurses(), (curses & 0x40) != 0 ||
(this->_isForceBlind != 0)))) {
isBlind = 1;
}
else {
isBlind = 0;
}
load_collectible_gfx(&this->_sprite,1,this->_subtype,this->_initSeed,isBlind);
iVar2 = extraout_ECX_01;
ppcVar1 = ppcStack_20;
goto switchD_006e23e9_caseD_1;
}
if ((iVar2 == 0x17c) && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 8)) == 0x13)) {
ppcStack_20 = GHIDRA_CAST<char **>((GHIDRA_INT(&spritesheetPath) + 0x38));
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(spritesheetPath._buf)) + 0x0))) = std::_Allocate(0x30);
spritesheetPath._size = 0x26;
spritesheetPath._capacity = 0x2f;
builtin_strncpy((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(spritesheetPath._buf))) + 0x0))),"gfx/Items/Pick Ups/IsaacBed_Barren.png",
0x27);
local_14 = 1;
goto LAB_006e23b6;
}
ppcVar1 = GHIDRA_CAST<char **>((GHIDRA_INT(&spritesheetPath) + 0x38));
if (this->_isPayToPlay == 0) goto switchD_006e23e9_caseD_1;
iVar2 = iVar2 + -0x35;
ppcVar1 = GHIDRA_CAST<char **>((GHIDRA_INT(&spritesheetPath) + 0x38));
switch(iVar2) {
case 0:
case 7:
ppcStack_20 = GHIDRA_CAST<char **>((GHIDRA_INT(&spritesheetPath) + 0x38));
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(spritesheetPath._buf)) + 0x0))) = std::_Allocate(0x40);
spritesheetPath._size = 0x31;
spritesheetPath._capacity = 0x3f;
builtin_strncpy((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(spritesheetPath._buf))) + 0x0))),
"gfx/Items/Pick Ups/Pickup_005_Chests_coinslot.png",0x32);
local_14 = 2;
break;
default:
goto switchD_006e23e9_caseD_1;
case 2:
ppcStack_20 = GHIDRA_CAST<char **>((GHIDRA_INT(&spritesheetPath) + 0x38));
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(spritesheetPath._buf)) + 0x0))) = std::_Allocate(0x30);
spritesheetPath._size = 0x2b;
spritesheetPath._capacity = 0x2f;
builtin_strncpy((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(spritesheetPath._buf))) + 0x0))),
"gfx/Items/Pick Ups/dirty_chest_coinslot.png",0x2c);
local_14 = 3;
break;
case 4:
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(spritesheetPath._buf)) + 0x0))) = std::_Allocate(0x30);
spritesheetPath._size = 0x2a;
spritesheetPath._capacity = 0x2f;
builtin_strncpy((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(spritesheetPath._buf))) + 0x0))),
"gfx/Items/Pick Ups/mega_chest_coinslot.png",0x2b);
local_14 = 4;
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&spritesheetPath);
local_14 = 0xffffffff;
iVar2 = extraout_ECX_03;
ppcVar1 = ppcStack_20;
if (spritesheetPath._capacity < 0x10) goto switchD_006e23e9_caseD_1;
curses = spritesheetPath._capacity + 1;
ptr = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(spritesheetPath._buf))) + 0x0)));
if (0xfff < curses) {
ptr = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(spritesheetPath._buf)) + 0x0))) + -4));
iVar2 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(spritesheetPath._buf)) + 0x0))) - GHIDRA_INT(ptr);
goto joined_r0x006e253b;
}
goto LAB_006e22cc;
}
LAB_006e23b6:
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,&spritesheetPath);
iVar2 = extraout_ECX_02;
}
local_14 = 0xffffffff;
ppcVar1 = ppcStack_20;
if (0xf < spritesheetPath._capacity) {
curses = spritesheetPath._capacity + 1;
ptr = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(spritesheetPath._buf))) + 0x0)));
if (0xfff < curses) {
ptr = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(spritesheetPath._buf)) + 0x0))) + -4));
iVar2 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(spritesheetPath._buf)) + 0x0))) - GHIDRA_INT(ptr);
joined_r0x006e253b:
curses = spritesheetPath._capacity + 0x24;
if (0x1f < iVar2 - 4U) {
local_14 = 0xffffffff;
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
LAB_006e22cc:
local_14 = 0xffffffff;
operator_delete(ptr,curses);
iVar2 = extraout_ECX_00;
ppcVar1 = ppcStack_20;
}
switchD_006e23e9_caseD_1:
ppcStack_20 = ppcVar1;
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::LoadGraphics((byte)iVar2);
ExceptionList = local_1c;
return;
}
// 006e2570
void Entity_Pickup::update_price_sprite(int price)
{
byte bVar1;
uint uVar2;
ItemConfig_Item *item;
EntityConfig_Entity *priceConfig;
char *anim;
LayerState *layer;
uint uVar3;
EntityPtr paymentEffect;
int iVar4;
undefined4 belowGrid;
GridEntity_Spikes *spikes;
GridEntity *pGVar5;
void *pvVar6;
int gridWidth;
int iVar7;
bool isUnsummon;
undefined1 local_20 [4];
undefined1 local_1c [4];
void *configNode;
GridEntity *local_14;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
EntityPtr *childSlot;
Manager *manager;
undefined4 *oldGrid;
ANM2 *priceSprite;
Room *room;
local_8 = 0xffffffff;
puStack_c = &LAB_00afb057;
local_10 = ExceptionList;
uVar2 = __security_cookie ^ GHIDRA_UINT((local_1c + 0x18));
ExceptionList = &local_10;
item = (GHIDRA_CAST<ItemConfig *>((&g_manager->_itemConfig)))->ItemConfig::GetCollectible(this->_subtype);
pGVar5 = GHIDRA_CAST<GridEntity *>(this->_price);
if ((((pGVar5 == GHIDRA_CAST<GridEntity *>(0xfffffff6)) && (item != GHIDRA_CAST<ItemConfig_Item *>(0x0))) &&
((item->tags & 0x200000000) != 0)) && (((price != 0 && (price != -6)) && (price != -10)))) {
ExceptionList = local_10;
return;
}
this->_price = price;
local_14 = pGVar5;
if (price == 0) {
if (this->_variant == 100) {
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 8)) == 0x10) {
(this->_posOffset).y = 0.0;
}
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Play(s_Idle,0);
SetAlternatePedestal(this,0);
}
(GHIDRA_CAST<ANM2 *>((&this->_priceANM2)))->ANM2::Reset();
}
else {
(GHIDRA_CAST<AnimationState *>((&(this->_sprite)._overlayAnimState)))->AnimationState::SetAnimationData((void *)0x0);
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 8)) == 0x10) {
(this->_posOffset).y = -20.0;
}
manager = g_manager;
price = 0x509600;
_Find_lower_bound<>(local_20,&price);
if (((*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(configNode) + 0xd)) == '\0') &&
(*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(configNode) + 0x10)) < 0x509601)) &&
(configNode != (manager->_entityConfig)._entities._head)) {
priceConfig = GHIDRA_CAST<EntityConfig_Entity *>((GHIDRA_INT(configNode) + 0x18));
}
else {
priceConfig = (GHIDRA_CAST<EntityConfig *>((&manager->_entityConfig)))->EntityConfig::GetEntity(5,0,0);
}
priceSprite = &this->_priceANM2;
(GHIDRA_CAST<ANM2 *>((priceSprite)))->ANM2::Load(&priceConfig->anm2Path,1);
if ((this->_price < 0) && (this->_price != -1000)) {
anim = "Hearts";
}
else {
iVar4 = this->_price;
iVar7 = Room::GetShopItemPrice
(g_game->_room,this->_variant,this->_subtype,this->_shopItemId,
GHIDRA_CAST<Entity_Player *>(0x0));
if ((iVar4 < iVar7) || (anim = "NumbersWhite", iVar4 == -1000)) {
anim = "NumbersRed";
}
pGVar5 = local_14;
}
(GHIDRA_CAST<ANM2 *>((priceSprite)))->ANM2::SetAnimation(GHIDRA_CAST<byte *>(anim),1);
iVar4 = this->_price;
if (iVar4 < 0) {
if (iVar4 < -8) {
if (iVar4 == -9) {
if ((this->_priceANM2)._animState._animData != (void *)0x0) {
(GHIDRA_CAST<AnimationState *>((&(this->_priceANM2)._animState)))->AnimationState::SetFrameFloat(7.0);
}
}
else if (iVar4 == -1000) {
layer = (GHIDRA_CAST<ANM2 *>((priceSprite)))->ANM2::GetLayer(GHIDRA_CAST<byte *>(0x0));
layer->_visible = 0;
(GHIDRA_CAST<ANM2 *>((priceSprite)))->ANM2::SetLayerFrame(1,0);
(GHIDRA_CAST<ANM2 *>((priceSprite)))->ANM2::SetLayerFrame(2,10);
}
}
else {
switch(iVar4) {
case -8:
if ((this->_priceANM2)._animState._animData != (void *)0x0) {
(GHIDRA_CAST<AnimationState *>((&(this->_priceANM2)._animState)))->AnimationState::SetFrameFloat(6.0);
}
break;
case -7:
if ((this->_priceANM2)._animState._animData != (void *)0x0) {
(GHIDRA_CAST<AnimationState *>((&(this->_priceANM2)._animState)))->AnimationState::SetFrameFloat(5.0);
}
break;
case -6:
if ((this->_priceANM2)._animState._animData != (void *)0x0) {
(GHIDRA_CAST<AnimationState *>((&(this->_priceANM2)._animState)))->AnimationState::SetFrameFloat(4.0);
}
if (pGVar5 == GHIDRA_CAST<GridEntity *>(0xfffffff6)) {
room = g_game->_room;
iVar4 = (GHIDRA_CAST<Room *>((room)))->Room::GetGridIndex(&this->_pos);
uVar3 = room->_gridWidth + iVar4;
if (uVar3 < 0x1c0) {
pvVar6 = room->_gridEntities[uVar3];
}
else {
pvVar6 = (void *)0x0;
}
iVar4 = __RTDynamicCast(pvVar6,0,&IsaacRepentancePlus::GridEntity::RTTI_Type_Descriptor,
&IsaacRepentancePlus::GridEntity_Spikes::RTTI_Type_Descriptor,0)
;
if ((((iVar4 != 0) && (price = uVar3, uVar3 < 0x1c0)) &&
(iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + uVar3 * 4 + 0x24)), iVar4 != 0)) &&
(*GHIDRA_CAST<int *>((iVar4 + 4)) != 1)) {
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(g_game->_room) + uVar3 * 4 + 0x76c)) = 900;
std::set<int>::insert(local_1c,&price);
}
}
break;
case -5:
layer = (GHIDRA_CAST<ANM2 *>((priceSprite)))->ANM2::GetLayer(GHIDRA_CAST<byte *>(0x0));
layer->_visible = 0;
layer = (GHIDRA_CAST<ANM2 *>((priceSprite)))->ANM2::GetLayer(GHIDRA_CAST<byte *>(0x1));
layer->_visible = 0;
layer = (GHIDRA_CAST<ANM2 *>((priceSprite)))->ANM2::GetLayer(GHIDRA_CAST<byte *>(0x2));
childSlot = &this->_child;
layer->_visible = 0;
if (*childSlot == (EntityPtr)0x0) {
uVar3 = Random();
paymentEffect =
(EntityPtr)
(GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0xae,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(this),0,uVar3,0);
if (*GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(paymentEffect) + 0x3bc)) != (EntityPtr)0x0) {
price = GHIDRA_INT((GHIDRA_INT(paymentEffect) + 0x3bc));
std::multiset<unsigned_int>::erase(&price);
}
*GHIDRA_CAST<EntityPtr *>((GHIDRA_CAST<char *>(paymentEffect) + 0x3bc)) = (EntityPtr)this;
std::multiset<unsigned_int>::insert(GHIDRA_CAST<EntityPtr *>((GHIDRA_INT(paymentEffect) + 0x3bc)));
(**(code **)(*GHIDRA_CAST<int *>(paymentEffect) + 0xc))();
if (*childSlot != (EntityPtr)0x0) {
price = GHIDRA_INT(childSlot);
std::multiset<unsigned_int>::erase(&price);
}
*childSlot = paymentEffect;
std::multiset<unsigned_int>::insert(childSlot);
}
break;
case -4:
if ((this->_priceANM2)._animState._animData != (void *)0x0) {
(GHIDRA_CAST<AnimationState *>((&(this->_priceANM2)._animState)))->AnimationState::SetFrameFloat(3.0);
}
break;
case -3:
if ((this->_priceANM2)._animState._animData != (void *)0x0) {
(GHIDRA_CAST<AnimationState *>((&(this->_priceANM2)._animState)))->AnimationState::SetFrameFloat(2.0);
}
break;
case -2:
if ((this->_priceANM2)._animState._animData != (void *)0x0) {
(GHIDRA_CAST<AnimationState *>((&(this->_priceANM2)._animState)))->AnimationState::SetFrameFloat(1.0);
}
break;
case -1:
if ((this->_priceANM2)._animState._animData != (void *)0x0) {
(GHIDRA_CAST<AnimationState *>((&(this->_priceANM2)._animState)))->AnimationState::SetFrameFloat(0.0);
}
}
}
}
else {
if (iVar4 < 10) {
layer = (GHIDRA_CAST<ANM2 *>((priceSprite)))->ANM2::GetLayer(GHIDRA_CAST<byte *>(0x0));
layer->_visible = 0;
}
else {
price = iVar4 / 10;
if (((this->_priceANM2)._animState._animData != (void *)0x0) &&
((0 < *GHIDRA_CAST<int *>((GHIDRA_INT((this->_priceANM2)._animState._animation) + 0x80)) ||
(KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("LayerId out of bounds\n")),
0 < *GHIDRA_CAST<int *>((GHIDRA_INT((this->_priceANM2)._animState._animation) + 0x80)))))) {
pvVar6 = (this->_priceANM2)._animState._animData;
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar6) + 0x38));
if ((pvVar6 == (void *)0x0) || ((iVar4 < 0 || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar6) + 0x1c)) <= iVar4)))) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("id out of bounds\n"));
}
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT((this->_priceANM2)._animState._layerFrames) + iVar4 * 4)) = 0;
(GHIDRA_CAST<AnimationState *>((&(this->_priceANM2)._animState)))->AnimationState::AdvanceLayerPosition(iVar4,(float)price);
}
}
price = this->_price % 10;
if ((this->_priceANM2)._animState._animData != (void *)0x0) {
if ((1 < *GHIDRA_CAST<int *>((GHIDRA_INT((this->_priceANM2)._animState._animation) + 0x80))) ||
(KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("LayerId out of bounds\n")),
1 < *GHIDRA_CAST<int *>((GHIDRA_INT((this->_priceANM2)._animState._animation) + 0x80)))) {
pvVar6 = (this->_priceANM2)._animState._animData;
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar6) + 0x3c));
if ((pvVar6 == (void *)0x0) || ((iVar4 < 0 || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar6) + 0x1c)) <= iVar4)))) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("id out of bounds\n"));
}
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT((this->_priceANM2)._animState._layerFrames) + iVar4 * 4)) = 0;
(GHIDRA_CAST<AnimationState *>((&(this->_priceANM2)._animState)))->AnimationState::AdvanceLayerPosition(iVar4,(float)price);
}
if (((this->_priceANM2)._animState._animData != (void *)0x0) &&
((2 < *GHIDRA_CAST<int *>((GHIDRA_INT((this->_priceANM2)._animState._animation) + 0x80)) ||
(KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("LayerId out of bounds\n")),
2 < *GHIDRA_CAST<int *>((GHIDRA_INT((this->_priceANM2)._animState._animation) + 0x80)))))) {
pvVar6 = (this->_priceANM2)._animState._animData;
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar6) + 0x40));
if ((pvVar6 == (void *)0x0) || ((iVar4 < 0 || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar6) + 0x1c)) <= iVar4)))) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("id out of bounds\n"));
}
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT((this->_priceANM2)._animState._layerFrames) + iVar4 * 4)) = 0;
(GHIDRA_CAST<AnimationState *>((&(this->_priceANM2)._animState)))->AnimationState::AdvanceLayerPosition(iVar4,10.0);
}
}
}
if (this->_variant == 100) {
bVar1 = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST<byte *>("ShopIdle"),1);
if (((bVar1 != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) &&
((GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::SetFrameFloat(0.0),
(this->_sprite)._animState._animData != (void *)0x0)) {
(this->_sprite)._animState._isPlaying = 0;
this->_entityCollisionClass = 1;
pGVar5 = local_14;
goto LAB_006e2c1a;
}
}
else {
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Play(s_Idle,0);
}
this->_entityCollisionClass = 1;
pGVar5 = local_14;
}
LAB_006e2c1a:
if ((this->_price != -5) && (this->_child != (EntityPtr)0x0)) {
(**(code **)(*GHIDRA_CAST<int *>(this->_child) + 0x28))(uVar2);
}
if ((pGVar5 == GHIDRA_CAST<GridEntity *>(0xfffffff6)) && (this->_price == 0)) {
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Play(s_Idle,0);
SetAlternatePedestal(this,0);
uVar2 = Random();
(GHIDRA_CAST<Game *>((g_game)))->Game::SpawnEx(1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar2,0);
manager = g_manager;
price = 0x50;
seed_fart_sound_override(&price);
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(price,1.0,2,0,1.0,0.0);
pvVar6 = g_game->_room;
iVar7 = GHIDRA_INT((((this->_pos).x - 40.0) / 40.0 + 0.5));
iVar4 = GHIDRA_INT((((this->_pos).y - 120.0) / 40.0 + 0.5));
if ((((iVar7 < 0) || (gridWidth = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar6) + 0xc)), gridWidth <= iVar7)) ||
(iVar4 < 0)) || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar6) + 0x10)) <= iVar4)) {
gridWidth = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar6) + 0xc));
iVar7 = -1;
}
else {
iVar7 = iVar4 * gridWidth + iVar7;
}
if (GHIDRA_UINT((iVar7 + gridWidth)) < 0x1c0) {
belowGrid = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar6) + (iVar7 + gridWidth) * 4 + 0x24));
}
else {
belowGrid = 0;
}
spikes = (GridEntity_Spikes *)
__RTDynamicCast(belowGrid,0,&IsaacRepentancePlus::GridEntity::RTTI_Type_Descriptor,
&IsaacRepentancePlus::GridEntity_Spikes::RTTI_Type_Descriptor,0);
if (spikes == GHIDRA_CAST<GridEntity_Spikes *>(0x0)) {
ExceptionList = local_10;
return;
}
isUnsummon = (spikes->_desc)._type == 0x1c;
}
else {
if (this->_price == -10) {
pvVar6 = g_game->_room;
iVar7 = GHIDRA_INT((((this->_pos).x - 40.0) / 40.0 + 0.5));
iVar4 = GHIDRA_INT((((this->_pos).y - 120.0) / 40.0 + 0.5));
if ((((iVar7 < 0) || (gridWidth = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar6) + 0xc)), gridWidth <= iVar7)) ||
(iVar4 < 0)) || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar6) + 0x10)) <= iVar4)) {
gridWidth = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar6) + 0xc));
iVar7 = -1;
}
else {
iVar7 = iVar4 * gridWidth + iVar7;
}
uVar2 = iVar7 + gridWidth;
if (uVar2 < 0x1c0) {
belowGrid = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar6) + uVar2 * 4 + 0x24));
}
else {
belowGrid = 0;
}
iVar4 = __RTDynamicCast(belowGrid,0,&IsaacRepentancePlus::GridEntity::RTTI_Type_Descriptor,
&IsaacRepentancePlus::GridEntity_Spikes::RTTI_Type_Descriptor,0);
if ((iVar4 != 0) && (*GHIDRA_CAST<int *>((iVar4 + 4)) == 0x1c)) {
if (*GHIDRA_CAST<int *>((iVar4 + 0xc)) == 1) {
*GHIDRA_CAST<undefined4 *>((iVar4 + 0xc)) = 0;
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((iVar4 + 0x40)))))->ANM2::Play(GHIDRA_CAST<byte *>("SummonPayment"),0);
ExceptionList = local_10;
return;
}
ExceptionList = local_10;
return;
}
pvVar6 = g_game->_room;
if ((uVar2 < 0x1c0) &&
((oldGrid = *GHIDRA_CAST<undefined4 **>((GHIDRA_CAST<char *>(pvVar6) + uVar2 * 4 + 0x24)), oldGrid != GHIDRA_CAST<undefined4 *>(0x0)
&& (oldGrid[1] != 1)))) {
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar6) + uVar2 * 4 + 0x76c)) = 900;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(pvVar6) + uVar2 * 4 + 0x24)) = 0;
(**(code **)*oldGrid)(1);
}
pvVar6 = g_game->_room;
price = Random();
if ((GHIDRA_INT(uVar2) < 0) || (0x1bf < GHIDRA_INT(uVar2))) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("SpawnGridEntity: Grid index invalid\n"));
}
if (0x1bf < uVar2) {
ExceptionList = local_10;
return;
}
if (900 < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar6) + uVar2 * 4 + 0x76c))) {
ExceptionList = local_10;
return;
}
pGVar5 = operator_new(0x158);
local_8 = 0xd;
local_14 = pGVar5;
if (pGVar5 == GHIDRA_CAST<GridEntity *>(0x0)) {
pGVar5 = GHIDRA_CAST<GridEntity *>(0x0);
}
else {
(GHIDRA_CAST<GridEntity *>((pGVar5)))->GridEntity::GridEntity();
*GHIDRA_CAST<undefined ***>(pGVar5) = IsaacRepentancePlus::GridEntity_Spikes::vftable;
}
local_8 = 0xffffffff;
if (pGVar5 == GHIDRA_CAST<GridEntity *>(0x0)) {
ExceptionList = local_10;
return;
}
(pGVar5->_desc)._type = 0x1c;
pGVar5->_gridIndex = uVar2;
oldGrid = *GHIDRA_CAST<undefined4 **>((GHIDRA_CAST<char *>(pvVar6) + uVar2 * 4 + 0x24));
if (oldGrid != GHIDRA_CAST<undefined4 *>(0x0)) {
(**(code **)*oldGrid)(1);
}
*GHIDRA_CAST<GridEntity **>((GHIDRA_CAST<char *>(pvVar6) + uVar2 * 4 + 0x24)) = pGVar5;
(pGVar5->_desc)._variant = 0;
(pGVar5->_desc)._varData = 0;
(GHIDRA_CAST<GridEntity *>((pGVar5)))->GridEntity::Init(price);
ExceptionList = local_10;
return;
}
room = g_game->_room;
iVar4 = (GHIDRA_CAST<Room *>((room)))->Room::GetGridIndex(&this->_pos);
uVar2 = iVar4 + room->_gridWidth;
if (uVar2 < 0x1c0) {
pvVar6 = room->_gridEntities[uVar2];
}
else {
pvVar6 = (void *)0x0;
}
spikes = (GridEntity_Spikes *)
__RTDynamicCast(pvVar6,0,&IsaacRepentancePlus::GridEntity::RTTI_Type_Descriptor,
&IsaacRepentancePlus::GridEntity_Spikes::RTTI_Type_Descriptor,0);
if (spikes == GHIDRA_CAST<GridEntity_Spikes *>(0x0)) {
ExceptionList = local_10;
return;
}
if ((spikes->_desc)._type != 0x1c) {
ExceptionList = local_10;
return;
}
isUnsummon = (spikes->_desc)._state == 0;
}
if (isUnsummon) {
(GHIDRA_CAST<GridEntity_Spikes *>((spikes)))->GridEntity_Spikes::unsummon(0);
}
ExceptionList = local_10;
return;
}
// 006e3020
void Entity_Pickup::AppearFast()
{
byte *animName;
uint nameCompare;
int frame;
char *appearNameCursor;
bool isNameLess;
byte nameChar;
if ((((this->_variant == 0x14) && (this->_subtype == 1)) &&
((this->_sprite)._animState._animData != (void *)0x0)) &&
((this->_sprite)._animState._isPlaying != 0)) {
animName = (this->_sprite)._animState._animData;
if (0xf < *GHIDRA_CAST<uint *>((animName + 0x14))) {
animName = *GHIDRA_CAST<byte **>(animName);
}
appearNameCursor = "Appear";
do {
nameChar = *animName;
isNameLess = nameChar < (byte)*appearNameCursor;
if (nameChar != *appearNameCursor) {
LAB_006e3070:
nameCompare = -GHIDRA_UINT(isNameLess) | 1;
goto LAB_006e3075;
}
if (nameChar == 0) break;
nameChar = animName[1];
isNameLess = nameChar < (byte)appearNameCursor[1];
if (nameChar != appearNameCursor[1]) goto LAB_006e3070;
animName = animName + 2;
appearNameCursor = appearNameCursor + 2;
} while (nameChar != 0);
nameCompare = 0;
LAB_006e3075:
if (nameCompare == 0) {
frame = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::GetFrame();
if (frame == 0) {
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Play(GHIDRA_CAST<byte *>("AppearFast"),0);
}
}
}
return;
}
// 006e38d0
void Entity_Pickup::Interpolate()
{
byte isChest;
float *chosenOffsetY;
Entity *this_00;
float maxOffsetY;
float bobOffsetY;
isChest = IsChest(this->_variant);
if (isChest != 0) {
maxOffsetY = 0.0;
bobOffsetY = (float)this_00[1]._entityRef4._flags * this_00->_speedMultiplier * 0.5 +
this_00[1]._entityRef4._velocity.y;
chosenOffsetY = &bobOffsetY;
if (0.0 <= bobOffsetY) {
chosenOffsetY = &maxOffsetY;
}
(this_00->_posOffset).y = *chosenOffsetY;
}
(GHIDRA_CAST<Entity *>((this_00)))->Entity::Interpolate();
return;
}
// 006e3940
void Entity_Pickup::Update()
{
uint *puVar1;
ANM2 other;
Vector pos;
void **ppvVar2;
byte bVar3;
char cVar4;
int iVar5;
uint uVar6;
Entity *pEVar7;
Entity_Player *player;
std_string *animName;
byte *pbVar8;
Vector *freePos;
Vector *pVVar9;
RNG *explosionSprite;
uint jitterFrame;
EntityPtr EVar10;
void *pvVar11;
char *pcVar12;
int extraout_ECX;
PlayerManager *playerManager;
int *piVar13;
undefined1 *puVar14;
int extraout_EDX;
code *extraout_EDX_00;
byte *expectedAnimChar;
code *extraout_EDX_01;
Game *game;
Room *ptr;
Entity *eligibleCapEnd;
bool bVar15;
float fVar16;
float fVar17;
float fVar18;
float fVar19;
Room *pRVar20;
undefined8 uVar21;
double dVar22;
ANM2 aAStackY_8d5c [128];
undefined1 in_stack_fffffdb8 [244];
float in_stack_fffffeac;
float in_stack_fffffeb0;
EntityPtr in_stack_fffffeb4;
Vector *in_stack_fffffeb8;
Vector *in_stack_fffffebc;
undefined4 in_stack_fffffec0;
PlayerManager *in_stack_fffffec4;
int iVar23;
ColorMod lerpedColor;
Entity_Pickup *local_f8;
Vector local_f4;
byte isDead;
RNG local_e8;
int *renderTarget;
Room *local_d0;
Entity *local_cc;
Vector local_c8;
byte local_bd;
undefined1 local_bc [32];
int animNameSize;
undefined1 *animNameCapacity;
Color tmpColor;
undefined1 local_68 [24];
float local_50;
undefined1 local_4c [12];
Entity *local_40;
undefined1 local_34 [12];
float local_28;
uint local_24;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
undefined4 local_14;
ANM2 *explosionSprite;
qword flags;
undefined4 flagsHigh;
Manager *manager;
ColorMod *spriteColor;
code *virtualFn;
puStack_20 = local_34 + 0x30;
local_14 = 0xffffffff;
puStack_18 = &LAB_00afb109;
local_1c = ExceptionList;
local_24 = __security_cookie ^ GHIDRA_UINT((local_34 + 0x24));
ppvVar2 = &local_1c;
if (0 < this->_dropDelay) {
if (this->_entityCollisionClass == 0) {
this->_dropDelay = this->_dropDelay + -1;
return;
}
ExceptionList = &local_1c;
this->_dropDelay = 0;
ppvVar2 = ExceptionList;
}
ExceptionList = ppvVar2;
fVar17 = *GHIDRA_CAST<float *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x6e4))));
local_f8 = this;
if ((fVar17 < 0.0) ||
(puVar14 = local_34 + 0x30,
*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x6e8)))) <= 0.0 && *GHIDRA_CAST<float *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x6e8)))) != 0.0)) {
iVar5 = 4;
fVar19 = *GHIDRA_CAST<float *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x6e8))));
if (fVar17 < -50.0) {
iVar5 = 0;
}
this->_entityCollisionClass = iVar5;
iVar5 = 6;
if (fVar17 < -50.0) {
iVar5 = 3;
}
this->_entityGridCollisionClass = iVar5;
*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x6e8)))) = this->_speedMultiplier * 1.2 + fVar19;
*GHIDRA_CAST<float *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x6e4)))) = this->_speedMultiplier * fVar19 + fVar17;
puVar14 = local_34 + 0x30;
if (this->_collidesWithGrid != 0) {
bVar3 = IsChest(this->_variant);
puVar14 = puStack_20;
if ((bVar3 != 0) && (this->_subtype != 0)) {
in_stack_fffffec4 = GHIDRA_CAST<PlayerManager *>(0x6e3a57);
bVar3 = TryOpenChest(this,GHIDRA_CAST<Entity_Player *>(0x0));
puVar14 = puStack_20;
if ((bVar3 != 0) &&
((iVar5 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 8)), iVar5 == 0xb || (iVar5 == 0x11)))) {
(GHIDRA_CAST<Ambush *>((&g_game->_ambush)))->Ambush::StartChallenge();
puVar14 = puStack_20;
}
}
}
puStack_20 = puVar14;
puVar14 = puStack_20;
if (0.0 <= *GHIDRA_CAST<float *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x6e4))))) {
flags = this->_flags;
puVar1 = GHIDRA_CAST<uint *>((GHIDRA_INT(&this->_flags) + 4));
*puVar1 = *puVar1 & 0xfbffffff;
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x6e4)))) = 0;
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x6e8)))) = 0;
*GHIDRA_CAST<int *>(&this->_flags) = GHIDRA_INT(flags);
this->_entityCollisionClass = 4;
this->_entityGridCollisionClass = 5;
bVar3 = IsChest(this->_variant);
puVar14 = puStack_20;
if ((bVar3 != 0) && (this->_subtype != 0)) {
in_stack_fffffec4 = GHIDRA_CAST<PlayerManager *>(0x6e3af2);
bVar3 = TryOpenChest(this,GHIDRA_CAST<Entity_Player *>(0x0));
puVar14 = puStack_20;
if ((bVar3 != 0) &&
((iVar5 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 8)), iVar5 == 0xb || (iVar5 == 0x11)))) {
(GHIDRA_CAST<Ambush *>((&g_game->_ambush)))->Ambush::StartChallenge();
puVar14 = puStack_20;
}
}
}
}
puStack_20 = puVar14;
iVar5 = this->_variant;
iVar23 = 0x6e3b2b;
bVar3 = IsChest(iVar5);
if (((bVar3 != 0) &&
(EVar10 = this->_parent, (this->_posOffset).y = *GHIDRA_CAST<float *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((this)) + 0x6e4)))),
EVar10 != (EntityPtr)0x0)) && ((this->_flags & 0x200000000000000) != 0)) {
fVar17 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this->_parent) + 0x340));
fVar19 = (this->_pos).y;
(this->_velocity).x = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this->_parent) + 0x33c)) - (this->_pos).x;
(this->_velocity).y = fVar17 - fVar19;
iVar5 = this->_variant;
}
if (iVar5 == 100) {
if ((this->_flags & 4) != 0) {
uVar6 = Random();
pVVar9 = &this->_pos;
in_stack_fffffec4 = GHIDRA_CAST<PlayerManager *>(0x0);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(in_stack_fffffec0)) + 0x0))) = 0;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(in_stack_fffffec0)) + 0x1))) = 0;
(*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(&(in_stack_fffffec0)) + 0x2))) = 0;
in_stack_fffffebc = &g_vectorZero;
in_stack_fffffeb4 = (EntityPtr)0xf;
in_stack_fffffeb0 = 1.4013e-42;
in_stack_fffffeac = 1.0123364e-38;
in_stack_fffffeb8 = pVVar9;
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0xf,pVVar9,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar6);
pEVar7->Update();
flagsHigh = *GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&this->_flags) + 4));
*GHIDRA_CAST<uint *>(&this->_flags) = GHIDRA_UINT(this->_flags) & 0xfffffffb;
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&this->_flags) + 4)) = flagsHigh;
iVar23 = 0x6e3bf1;
iVar5 = PlayerManager::GetGFuelCount();
if (1 < iVar5) {
uVar6 = Random();
in_stack_fffffeac = 1.0123468e-38;
local_cc = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0xf,pVVar9,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar6);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_4c)) + 0x8))) = 0.0;
explosionSprite = &local_cc->_sprite;
local_40 = GHIDRA_CAST<Entity *>(0xf);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_68)) + 0x14))) = 0.0;
local_d0 = GHIDRA_CAST<Room *>(explosionSprite);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_68)) + 0x14))) = std::_Allocate(0x30);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_4c)) + 0x8))) = &DAT_00000027;
local_40 = GHIDRA_CAST<Entity *>(&DAT_0000002f);
builtin_strncpy((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(local_68))) + 0x14))),"gfx/promo/gfuel/effects/explosion4.anm2",0x28);
local_14 = 0;
(GHIDRA_CAST<ANM2 *>((explosionSprite)))->ANM2::Load(GHIDRA_CAST<std_string *>((local_68 + 0x14)),1);
local_14 = 0xffffffff;
if (GHIDRA_CAST<Entity *>(&DAT_0000000f) < local_40) {
piVar13 = GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((local_40)) + 0x1))));
pcVar12 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<char *>(local_68))) + 0x14)));
if (GHIDRA_CAST<undefined1 *>(0xfff) < piVar13) {
pcVar12 = *GHIDRA_CAST<char **>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_68)) + 0x14))) + -4));
piVar13 = &local_40->_collisionIndex;
if (GHIDRA_CAST<char *>(0x1f) < GHIDRA_CAST<char *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_68)) + 0x14))) + (-4 - GHIDRA_INT(pcVar12))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pcVar12,GHIDRA_UINT(piVar13));
}
uVar6 = Random();
manager = g_manager;
local_e8._shift3 = 0x33d;
local_c8.y = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) *
2.3283064e-10 * 0.2 + 0.9;
seed_fart_sound_override(&local_e8._shift3);
in_stack_fffffebc = GHIDRA_CAST<Vector *>(0x2);
in_stack_fffffeb8 = GHIDRA_CAST<Vector *>(0x3f800000);
in_stack_fffffeb0 = 1.0123948e-38;
in_stack_fffffeb4 = (EntityPtr)local_e8._shift3;
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(local_e8._shift3,1.0,2,0,local_c8.y,0.0);
(GHIDRA_CAST<Game *>((g_game)))->Game::ShakeScreen(10);
uVar6 = Random();
pEVar7 = local_cc;
(local_cc->_sprite)._flipX = ((byte)uVar6 ^ 0xff) & 1;
in_stack_fffffec4 = GHIDRA_CAST<PlayerManager *>(&(local_cc->_sprite)._animDefaultName);
if (0xf < (local_cc->_sprite)._animDefaultName._capacity) {
in_stack_fffffec4 = *GHIDRA_CAST<PlayerManager **>((GHIDRA_CAST<std_string *>(in_stack_fffffec4))->_buf);
}
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(in_stack_fffffec0)) + 0x0))) = 0xab;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(in_stack_fffffec0)) + 0x1))) = 0x3d;
(*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(&(in_stack_fffffec0)) + 0x2))) = 0x6e;
bVar3 = (GHIDRA_CAST<ANM2 *>((&local_cc->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST<byte *>(in_stack_fffffec4),1);
pRVar20 = local_d0;
if (bVar3 != 0) {
(GHIDRA_CAST<AnimationState *>((GHIDRA_CAST<AnimationState *>((local_d0->_gridEntities + 3)))))->AnimationState::Rewind();
*GHIDRA_CAST<undefined1 *>((pRVar20->_gridEntities + 8)) = 1;
pEVar7 = local_cc;
}
iVar23 = 0x6e3dce;
pEVar7->Update();
}
}
if (((this->_visible == 0) && (this->_entityCollisionClass != 0)) &&
(this->_invisibleFrames = this->_invisibleFrames + 1, 3 < this->_invisibleFrames)) {
this->_visible = 1;
}
if ((this->_flipSaveState == 0) || (this->_variant != 100)) {
LAB_006e3e26:
bVar3 = 0;
}
else {
iVar23 = 1;
in_stack_fffffec4 = &g_game->_playerManager;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(in_stack_fffffec0)) + 0x0))) = 199;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(in_stack_fffffec0)) + 0x1))) = 2;
(*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(&(in_stack_fffffec0)) + 0x2))) = 0;
in_stack_fffffebc = GHIDRA_CAST<Vector *>(0x6e3e1e);
player = PlayerManager::FirstCollectibleOwner
(in_stack_fffffec4,0x2c7,GHIDRA_CAST<RNG **>(in_stack_fffffec4),1);
if (player == GHIDRA_CAST<Entity_Player *>(0x0)) goto LAB_006e3e26;
bVar3 = 1;
}
if (bVar3 != (this->_altPedestalANM2)._loaded) {
if (bVar3 == 0) {
(GHIDRA_CAST<ANM2 *>((&this->_altPedestalANM2)))->ANM2::Reset();
}
else {
(GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((GHIDRA_INT(register0x00000010) + -0x248)))))->ANM2::ANM2(&this->_sprite);
other._championColor._offset[0] = in_stack_fffffeac;
other._filename._buf[0] = in_stack_fffffdb8[0];
other._filename._buf[1] = in_stack_fffffdb8[1];
other._filename._buf[2] = in_stack_fffffdb8[2];
other._filename._buf[3] = in_stack_fffffdb8[3];
other._filename._buf[4] = in_stack_fffffdb8[4];
other._filename._buf[5] = in_stack_fffffdb8[5];
other._filename._buf[6] = in_stack_fffffdb8[6];
other._filename._buf[7] = in_stack_fffffdb8[7];
other._filename._buf[8] = in_stack_fffffdb8[8];
other._filename._buf[9] = in_stack_fffffdb8[9];
other._filename._buf[10] = in_stack_fffffdb8[10];
other._filename._buf[0xb] = in_stack_fffffdb8[0xb];
other._filename._buf[0xc] = in_stack_fffffdb8[0xc];
other._filename._buf[0xd] = in_stack_fffffdb8[0xd];
other._filename._buf[0xe] = in_stack_fffffdb8[0xe];
other._filename._buf[0xf] = in_stack_fffffdb8[0xf];
other._filename._size = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_fffffdb8)) + 0x10)));
other._filename._capacity = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_fffffdb8)) + 0x14)));
other._animDefaultName._buf[0] = in_stack_fffffdb8[0x18];
other._animDefaultName._buf[1] = in_stack_fffffdb8[0x19];
other._animDefaultName._buf[2] = in_stack_fffffdb8[0x1a];
other._animDefaultName._buf[3] = in_stack_fffffdb8[0x1b];
other._animDefaultName._buf[4] = in_stack_fffffdb8[0x1c];
other._animDefaultName._buf[5] = in_stack_fffffdb8[0x1d];
other._animDefaultName._buf[6] = in_stack_fffffdb8[0x1e];
other._animDefaultName._buf[7] = in_stack_fffffdb8[0x1f];
other._animDefaultName._buf[8] = in_stack_fffffdb8[0x20];
other._animDefaultName._buf[9] = in_stack_fffffdb8[0x21];
other._animDefaultName._buf[10] = in_stack_fffffdb8[0x22];
other._animDefaultName._buf[0xb] = in_stack_fffffdb8[0x23];
other._animDefaultName._buf[0xc] = in_stack_fffffdb8[0x24];
other._animDefaultName._buf[0xd] = in_stack_fffffdb8[0x25];
other._animDefaultName._buf[0xe] = in_stack_fffffdb8[0x26];
other._animDefaultName._buf[0xf] = in_stack_fffffdb8[0x27];
other._animDefaultName._size = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_fffffdb8)) + 0x28)));
other._animDefaultName._capacity = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_fffffdb8)) + 0x2c)));
other._animState._animation = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)in_stack_fffffdb8)) + 0x30)));
other._animState._animData = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)in_stack_fffffdb8)) + 0x34)));
other._animState._layerFrames = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)in_stack_fffffdb8)) + 0x38)));
other._animState._nullLayerFrames = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)in_stack_fffffdb8)) + 0x3c)));
other._animState._animFrame = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0x40)));
other._animState._isPlaying = in_stack_fffffdb8[0x44];
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(other._animState)) + 0x15))) = (*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(in_stack_fffffdb8)) + 0x45)));
other._animState._currentlyTriggeredEvents = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_fffffdb8)) + 0x48)));
other._animState._previouslyTriggeredEvents = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_fffffdb8)) + 0x4c)));
other._overlayAnimState._animation = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)in_stack_fffffdb8)) + 0x50)));
other._overlayAnimState._animData = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)in_stack_fffffdb8)) + 0x54)));
other._overlayAnimState._layerFrames = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)in_stack_fffffdb8)) + 0x58)));
other._overlayAnimState._nullLayerFrames = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)in_stack_fffffdb8)) + 0x5c)));
other._overlayAnimState._animFrame = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0x60)));
other._overlayAnimState._isPlaying = in_stack_fffffdb8[100];
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(other._overlayAnimState)) + 0x15))) = (*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(in_stack_fffffdb8)) + 0x65)));
other._overlayAnimState._currentlyTriggeredEvents = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_fffffdb8)) + 0x68)));
other._overlayAnimState._previouslyTriggeredEvents = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_fffffdb8)) + 0x6c)));
other._overlayRenderFirst = in_stack_fffffdb8[0x70];
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(other)) + 0x71))) = (*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(in_stack_fffffdb8)) + 0x71)));
other._animData = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)in_stack_fffffdb8)) + 0x74)));
other._animCount = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_fffffdb8)) + 0x78)));
other._layerState = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)in_stack_fffffdb8)) + 0x7c)));
other._layerCount = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_fffffdb8)) + 0x80)));
other._nullLayerNames = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)in_stack_fffffdb8)) + 0x84)));
other._numNullLayers = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_fffffdb8)) + 0x88)));
other._eventNames = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)in_stack_fffffdb8)) + 0x8c)));
other._numEvents = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(in_stack_fffffdb8)) + 0x90)));
other._offset.x = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0x94)));
other._offset.y = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0x98)));
other._scale.x = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0x9c)));
other._scale.y = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xa0)));
other._rotation = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xa4)));
other._color._tint[0] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xa8)));
other._color._tint[1] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xac)));
other._color._tint[2] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xb0)));
other._color._tint[3] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xb4)));
other._color._colorize[0] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xb8)));
other._color._colorize[1] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xbc)));
other._color._colorize[2] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xc0)));
other._color._colorize[3] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xc4)));
other._color._offset[0] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xc8)));
other._color._offset[1] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xcc)));
other._color._offset[2] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xd0)));
other._championColor._tint[0] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xd4)));
other._championColor._tint[1] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xd8)));
other._championColor._tint[2] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xdc)));
other._championColor._tint[3] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xe0)));
other._championColor._colorize[0] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xe4)));
other._championColor._colorize[1] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xe8)));
other._championColor._colorize[2] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xec)));
other._championColor._colorize[3] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)in_stack_fffffdb8)) + 0xf0)));
other._championColor._offset[1] = in_stack_fffffeb0;
other._championColor._offset[2] = (float)in_stack_fffffeb4;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(other)) + 0x100))) = in_stack_fffffeb8;
other._playbackSpeed = (float)in_stack_fffffebc;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(other)) + 0x108))) = (char)in_stack_fffffec0;
other._loaded = SUB41(in_stack_fffffec0,1);
(*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(&(other)) + 0x10a))) = SUB42(in_stack_fffffec0,2);
other._shadowLayerIndex = GHIDRA_INT(in_stack_fffffec4);
other._bitflags = iVar23;
(GHIDRA_CAST<ANM2 *>((&this->_altPedestalANM2)))->ANM2::operator_assign(other);
if ((g_game->_currentDimensionIdx == 2) ||
((uVar6 = (GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level::GetCurses(), (uVar6 & 0x40) == 0 &&
(this->_isForceBlind == 0)))) {
bVar3 = 0;
}
else {
bVar3 = 1;
}
load_collectible_gfx
(&this->_altPedestalANM2,1,*GHIDRA_CAST<int *>((this->_flipSaveState + 8)),
*GHIDRA_CAST<uint *>((this->_flipSaveState + 0x34)),bVar3);
(GHIDRA_CAST<ANM2 *>((&this->_altPedestalANM2)))->ANM2::LoadGraphics(bVar3);
animName = (GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>(&(this->_sprite)._animState))))->ANM2::GetAnimation(GHIDRA_CAST<std_string *>((local_bc + 0x10)));
local_14 = 1;
if (0xf < animName->_capacity) {
animName = *GHIDRA_CAST<std_string **>(animName->_buf);
}
bVar3 = (GHIDRA_CAST<ANM2 *>((&this->_altPedestalANM2)))->ANM2::SetAnimation(GHIDRA_CAST<byte *>(animName),1);
if (bVar3 != 0) {
(GHIDRA_CAST<AnimationState *>((&(this->_altPedestalANM2)._animState)))->AnimationState::Rewind();
(this->_altPedestalANM2)._animState._isPlaying = 1;
}
local_14 = 0xffffffff;
if (&DAT_0000000f < animNameCapacity) {
puVar14 = animNameCapacity + 1;
pvVar11 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)local_bc)) + 0x10)));
if (GHIDRA_CAST<undefined1 *>(0xfff) < puVar14) {
pvVar11 = *(void **)((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_bc)) + 0x10))) + -4);
puVar14 = animNameCapacity + 0x24;
if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_bc)) + 0x10))) + (-4 - GHIDRA_INT(pvVar11))))) {
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pvVar11,GHIDRA_UINT(puVar14));
}
animNameSize = 0;
animNameCapacity = &DAT_0000000f;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_bc)) + 0x10))) = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_bc)) + 0x10))) & 0xffffff00;
}
}
if ((this->_altPedestalANM2)._loaded != 0) {
(GHIDRA_CAST<AnimationState *>((&(this->_altPedestalANM2)._animState)))->AnimationState::Update();
(GHIDRA_CAST<AnimationState *>((&(this->_altPedestalANM2)._overlayAnimState)))->AnimationState::Update();
}
}
if ((this->_price == 0) && (this->_variant == 10)) {
local_cc = GHIDRA_CAST<Entity *>(0x0);
local_d0 = GHIDRA_CAST<Room *>(0x0);
pEVar7 = GHIDRA_CAST<Entity *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_4c)) + 0x4))) = GHIDRA_CAST<Room *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_4c)) + 0x8))) = GHIDRA_CAST<Entity *>(0x0);
local_f4.y = 0.0;
local_40 = GHIDRA_CAST<Entity *>(0x0);
local_14 = 2;
local_e8._shift3 = 0;
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) -
GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) {
eligibleCapEnd = GHIDRA_CAST<Entity *>(0x0);
do {
local_c8.y = (float)(GHIDRA_CAST<Game *>((g_game)))->Game::GetPlayer(local_e8._shift3);
if ((GHIDRA_CAST<Room *>(local_c8.y))->_gridEntities[2] == (void *)0x0) {
local_cc = GHIDRA_CAST<Entity *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((local_cc)) + 0x1))));
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<Room *>(local_c8.y)))) + 0x13c0)))) != 0xe) {
if (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<Room *>(local_c8.y)))) + 0x13c0)))) != 0x21) goto LAB_006e4032;
}
if (pEVar7 == eligibleCapEnd) {
std::vector<unsigned_int>::_Emplace_reallocate();
pEVar7 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<Entity *>(local_4c))) + 0x8)));
eligibleCapEnd = local_40;
}
else {
*GHIDRA_CAST<float *>(pEVar7) = local_c8.y;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_4c)) + 0x8))) = &(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((pEVar7)) + 0x4)));
pEVar7 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<Entity *>(local_4c))) + 0x8)));
}
}
LAB_006e4032:
local_e8._shift3 = local_e8._shift3 + 1;
} while (GHIDRA_UINT(local_e8._shift3) <
GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2)));
this = local_f8;
local_f4.y = (float)eligibleCapEnd;
}
pEVar7 = GHIDRA_CAST<Entity *>((GHIDRA_INT(pEVar7) - (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_4c)) + 0x4))) >> 2));
local_d0 = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(GHIDRA_CAST<Room *>(local_4c))) + 0x4)));
if ((pEVar7 == local_cc) && (this->_subtype != 7)) {
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_34)) + 0x0))) = this->_initSeed;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_34)) + 0x4))) = 3;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_34)) + 0x8))) = 3;
local_28 = 3.64338e-44;
uVar6 = (GHIDRA_CAST<RNG *>((GHIDRA_CAST<RNG *>(local_34))))->RNG::RandomInt(GHIDRA_UINT(pEVar7));
pRVar20 = local_d0;
local_c8.y = (float)local_d0->_gridEntities[uVar6 - 9];
if (GHIDRA_CAST<Room *>(local_c8.y) != GHIDRA_CAST<Room *>(0x0)) {
this->Remove();
switch(this->_subtype) {
case 1:
case 8:
case 9:
case 10:
case 0xc:
iVar5 = 2;
break;
default:
iVar5 = 1;
break;
case 3:
iVar5 = 3;
break;
case 4:
iVar5 = 5;
break;
case 5:
case 6:
case 0xb:
iVar5 = 4;
break;
case 7:
iVar5 = 6;
}
(GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(local_c8.y))))->Entity_Player::AddBlueFlies(iVar5,&this->_pos,GHIDRA_CAST<Entity *>(0x0));
if (pRVar20 == GHIDRA_CAST<Room *>(0x0)) {
ExceptionList = local_1c;
return;
}
uVar6 = GHIDRA_INT(local_f4.y) - GHIDRA_INT(pRVar20) & 0xfffffffc;
ptr = pRVar20;
if (uVar6 < 0x1000) {
LAB_006e4146:
operator_delete(ptr,uVar6);
ExceptionList = local_1c;
return;
}
ptr = *GHIDRA_CAST<Room **>(&pRVar20[-1]._isPickupVisionInvalid);
uVar6 = uVar6 + 0x23;
if (GHIDRA_UINT((GHIDRA_INT(pRVar20) + (-4 - GHIDRA_INT(ptr)))) < 0x20) goto LAB_006e4146;
goto LAB_006e4192;
}
}
local_14 = 0xffffffff;
if (local_d0 != GHIDRA_CAST<Room *>(0x0)) {
uVar6 = (GHIDRA_INT(local_f4.y) - GHIDRA_INT(local_d0) >> 2) * 4;
pRVar20 = local_d0;
if (0xfff < uVar6) {
pRVar20 = *GHIDRA_CAST<Room **>(&local_d0[-1]._isPickupVisionInvalid);
uVar6 = uVar6 + 0x23;
if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_d0) + (-4 - GHIDRA_INT(pRVar20))))) {
LAB_006e4192:
/* WARNING: Subroutine does not return */
_invalid_parameter_noinfo_noreturn();
}
}
operator_delete(pRVar20,uVar6);
}
}
player = PlayerManager::FirstCollectibleOwner
(&g_game->_playerManager,0x1a8,GHIDRA_CAST<RNG **>(&g_game->_playerManager),1);
if ((player != GHIDRA_CAST<Entity_Player *>(0x0)) && (this->_price == 0)) {
iVar5 = this->_spawnerType;
if (iVar5 == 5) {
bVar15 = this->_spawnerVariant == 0x45;
}
else {
if (iVar5 == 1) goto LAB_006e4283;
bVar15 = iVar5 == 3;
}
if ((!bVar15) &&
((((iVar5 = this->_variant, iVar5 == 0x1e || (iVar5 == 0x28)) || (iVar5 == 0x14)) ||
((iVar5 == 0x5a || (iVar5 == 300)))))) {
uVar6 = 5;
if (iVar5 == 0x14) {
uVar6 = 10;
}
uVar6 = (GHIDRA_CAST<RNG *>((&this->_dropRNG)))->RNG::RandomInt(uVar6);
if (uVar6 == 0) {
this->Remove();
uVar6 = (GHIDRA_CAST<RNG *>((&this->_dropRNG)))->RNG::Next();
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(5,0x45,&this->_pos,&this->_velocity,GHIDRA_CAST<Entity *>(0x0),0,uVar6);
pEVar7[1]._sprite._color._offset[2] = (float)this->_optionsPickupIndex;
ExceptionList = local_1c;
return;
}
this->_spawnerType = 5;
this->_spawnerVariant = 0x45;
}
}
LAB_006e4283:
if (this->_variant == 0x28) {
iVar5 = this->_subtype;
if (iVar5 == 3) {
uVar6 = Random();
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(4,3,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar6);
goto LAB_006e42ba;
}
if (iVar5 == 5) {
uVar6 = Random();
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(4,4,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar6);
this->Remove();
ExceptionList = local_1c;
return;
}
if (iVar5 == 6) {
uVar6 = Random();
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(4,0x12,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar6);
this->Remove();
ExceptionList = local_1c;
return;
}
if (((this->_spawnerType == 4) &&
(((iVar5 = this->_spawnerVariant, iVar5 == 3 || (iVar5 == 4)) || (iVar5 == 0x12)))) &&
(((this->_sprite)._animState._animData != (void *)0x0 &&
((this->_sprite)._animState._isPlaying != 0)))) {
pbVar8 = (this->_sprite)._animState._animData;
if (0xf < *GHIDRA_CAST<uint *>((pbVar8 + 0x14))) {
pbVar8 = *GHIDRA_CAST<byte **>(pbVar8);
}
pcVar12 = "Appear";
do {
bVar3 = *pbVar8;
bVar15 = bVar3 < (byte)*pcVar12;
if (bVar3 != *pcVar12) {
LAB_006e4390:
uVar6 = -GHIDRA_UINT(bVar15) | 1;
goto LAB_006e4395;
}
if (bVar3 == 0) break;
bVar3 = pbVar8[1];
bVar15 = bVar3 < (byte)pcVar12[1];
if (bVar3 != pcVar12[1]) goto LAB_006e4390;
pbVar8 = pbVar8 + 2;
pcVar12 = pcVar12 + 2;
} while (bVar3 != 0);
uVar6 = 0;
LAB_006e4395:
if (uVar6 == 0) {
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Play(s_Idle,0);
this->_entityCollisionClass = 4;
}
}
}
pVVar9 = &this->_targetPosition;
if (((this->_targetPosition).x == g_vectorZero.x) && ((this->_targetPosition).y == g_vectorZero.y)
) {
pVVar9->x = (this->_pos).x;
(this->_targetPosition).y = (this->_pos).y;
if (this->_variant == 100) {
local_c8.y = (float)g_game->_room;
iVar5 = (GHIDRA_CAST<Room *>((GHIDRA_CAST<Room *>(local_c8.y))))->Room::GetGridIndex(&this->_pos);
if (((-1 < iVar5) && ((GHIDRA_CAST<EntityRef *>((GHIDRA_CAST<EntityRef *>(local_bc))))->EntityRef::EntityRef(), extraout_EDX < 0x1c0)) &&
(((void **)(GHIDRA_INT(local_c8.y) + 0x24))[extraout_EDX] != GHIDRA_CAST<int *>(0x0))) {
(**(code **)(*GHIDRA_CAST<int *>(((void **)(GHIDRA_INT(local_c8.y) + 0x24))[extraout_EDX]) + 0x14))();
}
}
}
if (this->_gridRepositionState == 2) {
pVVar9->x = (this->_pos).x;
(this->_targetPosition).y = (this->_pos).y;
this->_gridRepositionState = 0;
}
iVar5 = this->_variant;
if (iVar5 == 100) {
pvVar11 = this->_megaChestCollectible[0];
if (pvVar11 != (void *)0x0) {
pVVar9->x = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar11) + 0x334));
(this->_targetPosition).y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar11) + 0x338));
pvVar11 = this->_megaChestCollectible[0];
fVar17 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar11) + 0x364));
(this->_velocity).x = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar11) + 0x360));
(this->_velocity).y = fVar17;
fVar17 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar11) + 0x340));
(this->_pos).x = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(pvVar11) + 0x33c));
(this->_pos).y = fVar17;
goto LAB_006e45ad;
}
LAB_006e4506:
local_c8.y = (float)g_game->_room;
if (((GHIDRA_CAST<Room *>(local_c8.y))->_roomType != 0x10) && (g_game->_frameCount - this->_spawnFrame < 6))
{
local_e8._shift2 = GHIDRA_INT(pVVar9->x);
local_e8._shift3 = GHIDRA_INT((this->_targetPosition).y);
iVar5 = (GHIDRA_CAST<Room *>((GHIDRA_CAST<Room *>(local_c8.y))))->Room::GetGridCollisionAtPos(*pVVar9);
if (iVar5 != 0) {
freePos = Room::FindFreePickupSpawnPosition
(GHIDRA_CAST<Room *>(local_c8.y),GHIDRA_CAST<Vector *>((local_4c + 8)),pVVar9,40.0,1,0,0);
pVVar9->x = freePos->x;
(this->_targetPosition).y = freePos->y;
}
}
fVar17 = (this->_targetPosition).y;
fVar19 = (this->_pos).y;
(this->_velocity).x = pVVar9->x - (this->_pos).x;
(this->_velocity).y = fVar17 - fVar19;
}
else {
if ((this->_price != 0) || (iVar5 == 0x17c)) goto LAB_006e4506;
if (iVar5 == 0x14) {
if (this->_subtype == 6) goto LAB_006e4506;
}
else if ((iVar5 == 0x186) || (iVar5 == 0x39)) goto LAB_006e4506;
}
LAB_006e45ad:
if (this->_gridRepositionState == 1) {
local_c8.y = (float)&this->_pos;
player = (GHIDRA_CAST<Game *>((g_game)))->Game::GetNearestPlayer(GHIDRA_CAST<Vector *>(local_c8.y));
iVar5 = 0;
fVar17 = (player->_pos).x;
fVar19 = (player->_pos).y;
local_d0 = g_game->_room;
do {
if (local_d0->_doors[iVar5] != (void *)0x0) {
local_e8._shift3 = *GHIDRA_CAST<int *>((GHIDRA_INT(local_d0->_doors[iVar5]) + 0x24));
local_cc = GHIDRA_CAST<Entity *>(local_d0->_gridWidth);
fVar16 = ((float)(local_e8._shift3 / GHIDRA_INT(local_cc)) * 40.0 + 120.0) - fVar19;
fVar18 = ((float)(local_e8._shift3 % GHIDRA_INT(local_cc)) * 40.0 + 40.0) - fVar17;
if (fVar16 * fVar16 + fVar18 * fVar18 < 4900.0) {
if (-1 < iVar5) {
local_f4.y = *GHIDRA_CAST<float *>(local_c8.y) - fVar17;
local_d0 = GHIDRA_CAST<Room *>(((float)*(void **)(GHIDRA_CAST<char *>(local_c8.y) + 4) - fVar19));
fVar17 = sqrtf(local_f4.y * local_f4.y + (float)local_d0 * (float)local_d0);
if (0.0 < fVar17) {
local_f4.y = local_f4.y * (3.0 / fVar17);
local_d0 = GHIDRA_CAST<Room *>(((float)local_d0 * (3.0 / fVar17)));
}
pRVar20 = GHIDRA_CAST<Room *>((*GHIDRA_CAST<float *>(local_c8.y) -
((float)(local_e8._shift3 % GHIDRA_INT(local_cc)) * 40.0 + 40.0)));
local_e8._shift3 =
GHIDRA_INT(((float)*(void **)(GHIDRA_CAST<char *>(local_c8.y) + 4) -
((float)(local_e8._shift3 / GHIDRA_INT(local_cc)) * 40.0 + 120.0)));
local_c8.y = (float)pRVar20;
fVar17 = sqrtf((float)local_e8._shift3 * (float)local_e8._shift3 +
(float)pRVar20 * (float)pRVar20);
if (fVar17 <= 0.0) {
EVar10 = (EntityPtr)local_e8._shift3;
pRVar20 = GHIDRA_CAST<Room *>(local_c8.y);
}
else {
EVar10 = (EntityPtr)((5.0 / fVar17) * (float)local_e8._shift3);
pRVar20 = GHIDRA_CAST<Room *>((local_c8.y * (5.0 / fVar17)));
}
(this->_velocity).x = local_f4.y + (float)pRVar20 + (this->_velocity).x;
(this->_velocity).y = (float)local_d0 + (float)EVar10 + (this->_velocity).y;
}
break;
}
}
iVar5 = iVar5 + 1;
} while (iVar5 < 8);
this->_gridRepositionState = 2;
}
if (this->_variant == 0x17c) {
this->_renderZOffset = -3000;
}
else if ((((this->_variant == 10) && (this->_subtype == 9)) && (this->_price == 0)) &&
(this->_dead == 0)) {
player = (GHIDRA_CAST<Game *>((g_game)))->Game::GetNearestPlayer(&this->_pos);
fVar17 = (player->_velocity).x;
fVar19 = (player->_velocity).y;
local_d0 = GHIDRA_CAST<Room *>(((fVar17 + fVar17 + (player->_pos).x) - (this->_pos).x));
local_f4.y = (fVar19 + fVar19 + (player->_pos).y) - (this->_pos).y;
EntityList::QueryRadius
(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST<EntityList_EL *>(local_34),&this->_pos,
50.0,1);
fVar17 = 0.0;
local_14 = 3;
if (local_28 != 0.0) {
do {
iVar5 = *GHIDRA_CAST<int *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_34)) + 0x4))) + GHIDRA_INT(fVar17) * 4));
if (*GHIDRA_CAST<int *>((iVar5 + 0x28)) == 3) {
if (*GHIDRA_CAST<int *>((iVar5 + 0x2c)) != 0x40) {
if (*GHIDRA_CAST<int *>((iVar5 + 0x2c)) != 0x66) goto LAB_006e4978;
}
pRVar20 = GHIDRA_CAST<Room *>(((*GHIDRA_CAST<float *>((iVar5 + 0x360)) + *GHIDRA_CAST<float *>((iVar5 + 0x360)) +
*GHIDRA_CAST<float *>((iVar5 + 0x33c))) - (this->_pos).x));
pEVar7 = (Entity *)
((*GHIDRA_CAST<float *>((iVar5 + 0x364)) + *GHIDRA_CAST<float *>((iVar5 + 0x364)) +
*GHIDRA_CAST<float *>((iVar5 + 0x340))) - (this->_pos).y);
if ((float)pEVar7 * (float)pEVar7 + (float)pRVar20 * (float)pRVar20 <
(float)local_d0 * (float)local_d0 + local_f4.y * local_f4.y) {
local_f4.y = (float)pEVar7;
local_d0 = pRVar20;
}
}
LAB_006e4978:
fVar17 = (float)(GHIDRA_INT(fVar17) + 1);
} while (GHIDRA_UINT(fVar17) < GHIDRA_UINT(local_28));
}
local_c8.y = (float)local_d0 * (float)local_d0 + local_f4.y * local_f4.y;
if (2500.0 <= local_c8.y) {
fVar17 = (this->_velocity).y;
fVar19 = (this->_velocity).x;
if (((fVar19 * fVar19 + fVar17 * fVar17 <= 4.0) &&
(pvVar11 = (this->_sprite)._animState._animData, pvVar11 != (void *)0x0)) &&
(*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(pvVar11) + 0x34)) != '\0')) {
pcVar12 = GHIDRA_CAST<char *>(s_Idle);
goto LAB_006e4bf6;
}
}
else {
local_e8._shift1 = 5;
local_e8._shift2 = 9;
local_e8._seed = this->_initSeed * ((g_game->_frameCount - this->_spawnFrame) / 10);
if (local_e8._seed == 0) {
local_e8._seed = 1;
}
local_e8._shift3 = 7;
(GHIDRA_CAST<RNG *>((&local_e8)))->RNG::Next();
local_e8._shift3 =
GHIDRA_INT(((float)((double)local_e8._seed + __uint_to_double_fixup[-(local_e8._seed >> 0x1f)])
* 2.3283062e-10 * 180.0 - 90.0));
local_cc = GHIDRA_CAST<Entity *>(((local_c8.y * 3.0) / 2500.0));
fVar17 = sqrtf(local_c8.y);
if (fVar17 <= 0.0) {
local_c8.y = (float)local_d0;
local_cc = GHIDRA_CAST<Entity *>(local_f4.y);
}
else {
local_c8.y = ((float)local_cc / fVar17) * (float)local_d0;
local_cc = GHIDRA_CAST<Entity *>((((float)local_cc / fVar17) * local_f4.y));
}
local_e8._shift3 = GHIDRA_INT(((float)local_e8._shift3 * 0.017453292));
local_d0 = GHIDRA_CAST<Room *>(cos((float)local_e8._shift3));
fVar19 = sin((float)local_e8._shift3);
fVar17 = this->_friction;
if (fVar17 != 0.0) {
fVar16 = this->_speedMultiplier;
(this->_velocity).y =
(fVar16 * -(fVar19 * local_c8.y + (float)local_d0 * (float)local_cc)) / fVar17 +
(this->_velocity).y;
(this->_velocity).x =
(fVar16 * -((float)local_d0 * local_c8.y - fVar19 * (float)local_cc)) / fVar17 +
(this->_velocity).x;
}
if (this->_entityCollisionClass != 0) {
pcVar12 = "IdlePanic";
LAB_006e4bf6:
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Play(GHIDRA_CAST<byte *>(pcVar12),0);
}
}
local_14 = 0xffffffff;
if (local_34[0] == '\0') {
local_14 = 4;
tracked_alloc(1,(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)local_34)) + 0x4))),0);
local_14 = 0xffffffff;
}
}
if (((this->_variant == 100) && (this->_subtype == 0x226)) &&
((this->_isTouched != 0 &&
((*GHIDRA_CAST<char *>(g_game->_room) != '\0' &&
(g_game->_frameCount - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0x11f0)) == 4)))))) {
uVar6 = Random();
local_c8.x = (this->_pos).x + 0.0;
local_c8.y = (this->_pos).y + 10.0;
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0xf,&local_c8,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar6);
(GHIDRA_CAST<Color *>((&tmpColor)))->Color::Color();
(*extraout_EDX_00)();
this->_timeout = 4;
this->_entityCollisionClass = 0;
}
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::Update();
bVar3 = IsChest(this->_variant);
if (bVar3 == 0) {
if ((extraout_ECX == 0x154) || (extraout_ECX == 0x172)) {
(this->_velocity).x = (this->_velocity).x * 0.6;
(this->_velocity).y = (this->_velocity).y * 0.6;
fVar17 = (this->_targetPosition).x;
fVar19 = (this->_pos).x;
fVar16 = (this->_targetPosition).y - (this->_pos).y;
(this->_sizeMulti).x = 2.0;
(this->_sizeMulti).y = 1.0;
(this->_velocity).x = fVar17 - fVar19;
goto LAB_006e4deb;
}
}
else if ((this->_flags & 0x400000000000000) == 0) {
(this->_velocity).x = (this->_velocity).x * 0.8;
fVar16 = (this->_velocity).y * 0.8;
LAB_006e4deb:
(this->_velocity).y = fVar16;
}
if (this->_variant == 100) {
this->_mass = 8.0;
this->_friction = this->_friction * 0.8;
update_cycle_collectible(this,0);
}
else if ((this->_flags & 0x400000000000000) == 0) {
this->_friction = this->_friction * 0.965;
}
update_magnet_attraction(this);
if ((this->_isAutoUpdatePrice != 0) && (this->_price != 0)) {
local_c8.x = (this->_pos).x;
local_c8.y = (this->_pos).y;
player = Game::GetNearestPlayerEx(&local_c8,1,0,0);
(GHIDRA_CAST<Room *>((g_game->_room)))->Room::GetShopItemPrice(this->_variant,this->_subtype,this->_shopItemId,player);
iVar5 = _Room::ResolveHeartSubType();
if (this->_price != iVar5) {
update_price_sprite(this,iVar5);
}
}
local_bd = IsChest(this->_variant);
game = g_game;
uVar6 = *GHIDRA_CAST<uint *>((GHIDRA_INT(&this->_flags) + 4));
flags = this->_flags;
isDead = this->_dead;
if ((uVar6 & 0x100) == 0) {
if ((isDead == 0) ||
(((this->_sprite)._animState._animData != (void *)0x0 &&
((this->_sprite)._animState._isPlaying != 0)))) {
if ((this->_sprite)._animState._animData != (void *)0x0) {
if ((this->_sprite)._animState._isPlaying == 0) {
pbVar8 = (this->_sprite)._animState._animData;
if (0xf < *GHIDRA_CAST<uint *>((pbVar8 + 0x14))) {
pbVar8 = *GHIDRA_CAST<byte **>(pbVar8);
}
pcVar12 = "Appear";
do {
bVar3 = *pbVar8;
bVar15 = bVar3 < (byte)*pcVar12;
if (bVar3 != *pcVar12) {
LAB_006e52d2:
uVar6 = -GHIDRA_UINT(bVar15) | 1;
goto LAB_006e52d7;
}
if (bVar3 == 0) break;
bVar3 = pbVar8[1];
bVar15 = bVar3 < (byte)pcVar12[1];
if (bVar3 != pcVar12[1]) goto LAB_006e52d2;
pbVar8 = pbVar8 + 2;
pcVar12 = pcVar12 + 2;
} while (bVar3 != 0);
uVar6 = 0;
LAB_006e52d7:
if (uVar6 != 0) {
if ((this->_sprite)._animState._isPlaying != 0) goto LAB_006e5393;
uVar21 = _string_holder_c_str();
do {
expectedAnimChar = GHIDRA_CAST<byte *>(((ulonglong)uVar21 >> 0x20));
pbVar8 = GHIDRA_CAST<byte *>(uVar21);
bVar3 = *pbVar8;
bVar15 = bVar3 < *expectedAnimChar;
if (bVar3 != *expectedAnimChar) {
LAB_006e5320:
uVar6 = -GHIDRA_UINT(bVar15) | 1;
goto LAB_006e5325;
}
if (bVar3 == 0) break;
bVar3 = pbVar8[1];
bVar15 = bVar3 < expectedAnimChar[1];
if (bVar3 != expectedAnimChar[1]) goto LAB_006e5320;
uVar21 = CONCAT44(expectedAnimChar + 2,pbVar8 + 2);
} while (bVar3 != 0);
uVar6 = 0;
LAB_006e5325:
if (uVar6 != 0) {
uVar21 = _string_holder_c_str();
do {
expectedAnimChar = GHIDRA_CAST<byte *>(((ulonglong)uVar21 >> 0x20));
pbVar8 = GHIDRA_CAST<byte *>(uVar21);
bVar3 = *pbVar8;
bVar15 = bVar3 < *expectedAnimChar;
if (bVar3 != *expectedAnimChar) {
LAB_006e5356:
uVar6 = -GHIDRA_UINT(bVar15) | 1;
goto LAB_006e535b;
}
if (bVar3 == 0) break;
bVar3 = pbVar8[1];
bVar15 = bVar3 < expectedAnimChar[1];
if (bVar3 != expectedAnimChar[1]) goto LAB_006e5356;
uVar21 = CONCAT44(expectedAnimChar + 2,pbVar8 + 2);
} while (bVar3 != 0);
uVar6 = 0;
LAB_006e535b:
if (uVar6 != 0) goto LAB_006e5393;
}
}
if ((local_bd == 0) || (this->_subtype != 0)) {
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Play(s_Idle,0);
goto LAB_006e53e7;
}
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Play(GHIDRA_CAST<byte *>("Opened"),0);
}
else {
LAB_006e5393:
bVar3 = (GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::IsEventTriggered(GHIDRA_CAST<byte *>("DropSound"));
if (((bVar3 != 0) && (PlayDropSound(this), local_bd == 0)) &&
((bVar3 = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::IsPlaying(GHIDRA_CAST<byte *>("Appear")), bVar3 != 0 ||
((bVar3 = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::IsPlaying(GHIDRA_CAST<byte *>("AppearFast")), bVar3 != 0 ||
(bVar3 = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::IsPlaying(GHIDRA_CAST<byte *>("Reappear")), bVar3 != 0)))))) {
LAB_006e53e7:
this->_entityCollisionClass = 4;
if (this->_variant == 0x29) {
this->_entityGridCollisionClass = 5;
}
}
}
}
}
else {
this->Remove();
}
}
else if (isDead == 0) {
iVar5 = g_game->_frameCount - this->_spawnFrame;
if (this->_variant == 100) {
if (iVar5 == 3) {
piVar13 = &(this->_sprite)._bitflags;
*piVar13 = *piVar13 | 2;
}
else if (iVar5 == 4) {
uVar6 = (GHIDRA_CAST<RNG *>((&this->_dropRNG)))->RNG::Next();
iVar5 = ItemPool::CreateGlitchedCollectible(&game->_proceduralItemManager,uVar6,0);
this->_subtype = iVar5;
UpdateSprite(this,1);
uVar6 = this->_subtype;
if (g_game == GHIDRA_CAST<Game *>(0x0)) {
if (-1 < GHIDRA_INT(uVar6)) goto LAB_006e4fc5;
}
else {
if (GHIDRA_INT(uVar6) < 0) {
if ((GHIDRA_INT(uVar6) < 0) &&
(pvVar11 = (g_game->_proceduralItemManager)._proceduralItems._begin,
GHIDRA_INT(~uVar6) <
GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar11) >> 2)) {
iVar5 = **GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(pvVar11) + ~uVar6 * 4));
}
else {
iVar5 = 0;
}
}
else {
LAB_006e4fc5:
pvVar11 = (g_manager->_itemConfig)._collectibles._begin;
if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar11) >> 2 <= GHIDRA_INT(uVar6))
goto LAB_006e5401;
iVar5 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar11) + uVar6 * 4));
}
if (iVar5 != 0) {
this->_charge = *GHIDRA_CAST<int *>((iVar5 + 0x74));
if (-1 < *GHIDRA_CAST<int *>((iVar5 + 200))) {
this->_charge = *GHIDRA_CAST<int *>((iVar5 + 200));
}
}
}
}
else if (4 < iVar5) goto LAB_006e5014;
}
else if (iVar5 < 6) {
if (iVar5 == 5) {
iVar5 = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::GetFrame();
if (((this->_sprite)._animState._animData != (void *)0x0) &&
((GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::SetFrameFloat((float)(iVar5 + 2)),
(this->_sprite)._animState._animData != (void *)0x0)) {
(this->_sprite)._animState._isPlaying = 0;
}
}
}
else if ((iVar5 < 10) || ((iVar5 < 0xf && (uVar6 = Random(), (uVar6 & 7) != 0)))) {
if ((GHIDRA_UINT((this->_sprite)._bitflags) >> 1 & 1) == 0) {
uVar6 = Random();
if (uVar6 % 6 == 0) {
piVar13 = &(this->_sprite)._bitflags;
*piVar13 = *piVar13 | 2;
}
else {
uVar6 = Random();
if ((uVar6 & 7) == 0) {
uVar6 = Random();
iVar5 = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::GetFrame();
jitterFrame = iVar5 + -2 + uVar6 % 5;
uVar6 = 6;
if (6 < jitterFrame) {
uVar6 = jitterFrame;
}
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::SetFrame_1(uVar6);
}
}
}
else {
uVar6 = Random();
if ((uVar6 & 1) == 0) {
piVar13 = &(this->_sprite)._bitflags;
*piVar13 = *piVar13 & 0xfffffffd;
}
}
}
else {
piVar13 = &(this->_sprite)._bitflags;
*piVar13 = *piVar13 & 0xfffffffd;
flags = this->_flags;
puVar1 = GHIDRA_CAST<uint *>((GHIDRA_INT(&this->_flags) + 4));
*puVar1 = *puVar1 & 0xfffffeff;
*GHIDRA_CAST<int *>(&this->_flags) = GHIDRA_INT(flags);
animName = (GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>(&(this->_sprite)._animState))))->ANM2::GetAnimation(GHIDRA_CAST<std_string *>((local_bc + 0x10)));
local_14 = 5;
if (0xf < animName->_capacity) {
animName = *GHIDRA_CAST<std_string **>(animName->_buf);
}
bVar3 = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST<byte *>(animName),1);
if (bVar3 != 0) {
(GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::Rewind();
(this->_sprite)._animState._isPlaying = 1;
}
local_14 = 0xffffffff;
(GHIDRA_CAST<std::string *>((local_bc + 0x10)))->std::string::_Tidy_deallocate();
pVVar9 = MusicManager::RandomVector(GHIDRA_CAST<Vector *>((local_4c + 8)));
local_c8.y = pVVar9->x * 8.0;
local_e8._shift3 = GHIDRA_INT((pVVar9->y * 8.0));
(GHIDRA_CAST<RNG *>((GHIDRA_CAST<RNG *>(local_4c))))->RNG::game_constructor(this->_initSeed,3);
uVar6 = (GHIDRA_CAST<RNG *>((explosionSprite)))->RNG::Next();
local_f4.x = local_c8.y + (this->_pos).x;
local_f4.y = (float)local_e8._shift3 + (this->_pos).y;
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(this->_type,this->_variant,&local_f4,&g_vectorZero,
GHIDRA_CAST<Entity *>(this->_spawnerEntity),this->_subtype,uVar6);
pEVar7->Update();
(this->_pos).x = (this->_pos).x - local_c8.y;
(this->_pos).y = (this->_pos).y - (float)local_e8._shift3;
}
}
else {
LAB_006e5014:
piVar13 = &(this->_sprite)._bitflags;
*piVar13 = *piVar13 & 0xfffffffd;
*GHIDRA_CAST<int *>(&this->_flags) = GHIDRA_INT(flags);
*GHIDRA_CAST<uint *>((GHIDRA_INT(&this->_flags) + 4)) = uVar6 & 0xfffffeff;
}
LAB_006e5401:
if ((this->_variant == 0x3a) && (this->_subtype != 0)) {
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_4c)) + 0x4))) = *GHIDRA_CAST<undefined4 *>(&this->_flags);
flags = this->_flags;
if (((flags & 0x200000000000000) == 0) ||
(((flags & 0x400000000000000) != 0 || (this->_child != (EntityPtr)0x0)))) {
if ((this->_collisionCooldown < 1) &&
((this->_entityCollisionClass != 0 && ((flags & 0x600000000000000) == 0)))) {
pVVar9 = &this->_pos;
player = (GHIDRA_CAST<Game *>((g_game)))->Game::GetNearestPlayer(pVVar9);
fVar17 = pVVar9->x - (player->_pos).x;
fVar19 = (this->_pos).y - (player->_pos).y;
if (fVar19 * fVar19 + fVar17 * fVar17 < 10000.0) {
uVar6 = (GHIDRA_CAST<RNG *>((&this->_dropRNG)))->RNG::Next();
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(0x330,0,pVVar9,&g_vectorZero,GHIDRA_CAST<Entity *>(this),0,uVar6);
pEVar7->_renderDepthOffset = 6.0;
flags = this->_flags;
puVar1 = GHIDRA_CAST<uint *>((GHIDRA_INT(&this->_flags) + 4));
*puVar1 = *puVar1 | 0x2000000;
*GHIDRA_CAST<int *>(&this->_flags) = GHIDRA_INT(flags);
flagsHigh = *GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&pEVar7->_flags) + 4));
iVar5 = *GHIDRA_CAST<int *>(pEVar7);
*GHIDRA_CAST<uint *>(&pEVar7->_flags) = GHIDRA_UINT(pEVar7->_flags) & 0xfffffffb;
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&pEVar7->_flags) + 4)) = flagsHigh;
(**(code **)(iVar5 + 0xc))();
(GHIDRA_CAST<Color *>((&tmpColor)))->Color::Color(1.0,1.0,1.0,0.0);
(*extraout_EDX_01)();
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::SetChild(pEVar7);
}
}
}
else {
this->_visible = 1;
bVar3 = TryOpenChest(this,GHIDRA_CAST<Entity_Player *>(0x0));
if (bVar3 != 0) {
RemoveOtherOptions();
iVar5 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 8));
if ((iVar5 == 0xb) || (iVar5 == 0x11)) {
(GHIDRA_CAST<Ambush *>((&g_game->_ambush)))->Ambush::StartChallenge();
}
}
}
}
if ((this->_variant == 10) && (this->_subtype == 0xc)) {
if ((this->_sprite)._animState._animData == (void *)0x0) {
local_bd = 0;
LAB_006e55e8:
fVar17 = (this->_velocity).y;
fVar19 = (this->_velocity).x;
fVar17 = sqrtf(fVar19 * fVar19 + fVar17 * fVar17);
if (3.0 < fVar17) {
uVar6 = Random();
if (uVar6 % 3 == 0) goto LAB_006e562c;
}
}
else {
local_bd = (GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::IsEventTriggered(GHIDRA_CAST<byte *>("DropSound"));
if (local_bd == 0) goto LAB_006e55e8;
LAB_006e562c:
uVar6 = Random();
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,7,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar6);
uVar6 = Random();
virtualFn = *(code **)(*GHIDRA_CAST<int *>(pEVar7) + 0x3c);
fVar19 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) *
2.3283064e-10 * 0.4 + 0.2;
fVar17 = fVar19 * g_vectorOne.x;
(pEVar7->_sprite)._scale.y = fVar19 * g_vectorOne.y;
(pEVar7->_sprite)._scale.x = fVar17;
(GHIDRA_CAST<Color *>((&tmpColor)))->Color::Reset();
tmpColor._tint[0] = (float)0x3f333333;
tmpColor._tint[1] = (float)0x3f666666;
tmpColor._tint[2] = (float)0x3f266666;
tmpColor._tint[3] = 1.0;
(*virtualFn)();
pEVar7->Update();
if (local_bd == 0) {
this = local_f8;
}
else {
uVar6 = Random();
this = local_f8;
for (iVar5 = uVar6 % 3 + 1; iVar5 != 0; iVar5 = iVar5 + -1) {
uVar6 = Random();
fVar17 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) *
2.3283064e-10;
local_d0 = GHIDRA_CAST<Room *>((fVar17 + fVar17 + 1.0));
uVar6 = Random();
fVar17 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) *
2.3283064e-10 * 3.14;
local_c8.y = fVar17 + fVar17;
local_cc = GHIDRA_CAST<Entity *>(sin(local_c8.y));
uVar6 = Random();
local_e8._shift3 =
GHIDRA_INT(((float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) *
2.3283064e-10 * 0.5 * this->_size));
fVar17 = cos(local_c8.y);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_4c)) + 0x8))) = fVar17 * (float)local_e8._shift3 + (this->_pos).x;
local_40 = GHIDRA_CAST<Entity *>(((float)local_cc * (float)local_e8._shift3 + (this->_pos).y));
uVar6 = Random();
fVar17 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) *
2.3283064e-10 * 3.14;
local_c8.y = fVar17 + fVar17;
local_e8._shift3 = GHIDRA_INT(sin(local_c8.y));
fVar17 = cos(local_c8.y);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_34)) + 0x8))) = fVar17 * (float)local_d0;
local_28 = (float)local_d0 * (float)local_e8._shift3 * 0.5;
uVar6 = Random();
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x3f,GHIDRA_CAST<Vector *>((local_4c + 8)),GHIDRA_CAST<Vector *>((local_34 + 8)),
GHIDRA_CAST<Entity *>(0x0),0,uVar6);
}
}
}
}
if ((((this->_variant == 0x39) && (this->_subtype != 0)) &&
((this->_sprite)._animState._animData != (void *)0x0)) &&
(bVar3 = (GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::IsEventTriggered(s_Open), bVar3 != 0)) {
if (this->_subtype == 1) {
EVar10 = this->_target;
if ((EVar10 == (EntityPtr)0x0) || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar10) + 0x28)) != 1)) {
EVar10 = (EntityPtr)0x0;
}
bVar3 = TryOpenChest(this,GHIDRA_CAST<Entity_Player *>(EVar10));
if (bVar3 != 0) {
RemoveOtherOptions();
iVar5 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 8));
if ((iVar5 == 0xb) || (iVar5 == 0x11)) {
(GHIDRA_CAST<Ambush *>((&g_game->_ambush)))->Ambush::StartChallenge();
}
}
}
else {
this->_subtype = this->_subtype + -1;
}
}
if ((((this->_variant == 100) && (g_game->_currentDimensionIdx == 2)) &&
(this->_optionsPickupIndex == 1)) &&
((0 < g_game->_deathCertificateExitTimer && (this->_timeout < 1)))) {
uVar6 = Random();
local_28 = (this->_pos).y + 10.0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_34)) + 0x8))) = (this->_pos).x + 0.0;
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0xf,GHIDRA_CAST<Vector *>((local_34 + 8)),&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar6);
this->_timeout = 4;
}
if ((0 < this->_timeout) && (iVar5 = this->_timeout + -1, this->_timeout = iVar5, iVar5 == 0)) {
this->Remove();
}
if (0 < this->_wait) {
this->_wait = this->_wait + -1;
}
if (((0 < this->_chestReCloseTimer) &&
(iVar5 = this->_chestReCloseTimer + -1, this->_chestReCloseTimer = iVar5, iVar5 == 0)) &&
(this->_variant == 0x35)) {
this->_subtype = 1;
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Play(GHIDRA_CAST<byte *>("Close"),0);
manager = g_manager;
local_c8.y = 2.94273e-44;
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_c8.y));
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_c8.y),1.0,2,0,1.0,0.0);
this->_wait = 0x1e;
UpdateLootPreview(this);
}
pRVar20 = g_game->_room;
if (pRVar20->_roomType == 0x10) {
local_c8.x = (this->_pos).x + 0.0;
local_c8.y = (this->_sizeMulti).y * this->_size + 0.5 + (this->_pos).y;
pos.y = local_c8.y;
pos.x = local_c8.x;
iVar5 = (GHIDRA_CAST<Room *>((pRVar20)))->Room::GetGridCollisionAtPos(pos);
if (iVar5 != 4) {
piVar13 = *GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(pRVar20->_descriptor) + 0x10));
if (((piVar13 == GHIDRA_CAST<int *>(0x0)) || (piVar13[2] != 0x10)) || (*piVar13 != 0x23)) {
(this->_velocity).y = (this->_velocity).y + 0.9;
}
else {
(this->_velocity).y = (this->_velocity).y + 0.4;
this->_friction = this->_friction * 0.95;
}
}
piVar13 = *GHIDRA_CAST<int **>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 4)) + 0x10));
if (((piVar13 != GHIDRA_CAST<int *>(0x0)) && (piVar13[2] == 0x10)) &&
((*piVar13 == 0x23 &&
(((2 < g_game->_frameCount - this->_spawnFrame && (0.0 < (this->_velocity).y)) &&
(*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(g_game->_room) + 0x20)) - 30.0 < (this->_pos).y)))))) {
this->Remove();
uVar6 = Random();
pEVar7 = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0x10,&this->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0x42,uVar6);
pEVar7->Update();
}
}
bVar3 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0xb);
if ((bVar3 != 0) &&
(((iVar5 = this->_variant, iVar5 == 10 || (iVar5 == 0x1e)) ||
((((iVar5 == 0x28 || ((iVar5 == 0x14 || (iVar5 == 0x46)))) || (iVar5 == 0x5a)) ||
(((iVar5 == 300 || (iVar5 == 0x15e)) || (bVar3 = IsChest(iVar5), bVar3 != 0)))))))) {
(this->_velocity).x = g_vectorZero.x;
(this->_velocity).y = g_vectorZero.y;
player = Game::GetNearestPlayerEx(&this->_pos,1,0,0);
if (player != GHIDRA_CAST<Entity_Player *>(0x0)) {
fVar17 = this->_friction;
fVar19 = (player->_lastVelocity).x;
fVar16 = (player->_lastVelocity).y;
if (fVar17 != 0.0) {
fVar18 = this->_speedMultiplier;
(this->_velocity).y = (fVar18 * (fVar16 + fVar16)) / fVar17 + (this->_velocity).y;
(this->_velocity).x = (fVar18 * (fVar19 + fVar19)) / fVar17 + (this->_velocity).x;
}
}
}
game = g_game;
bVar3 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(5);
if ((bVar3 != 0) || (bVar3 = (GHIDRA_CAST<Game *>((game)))->Game::IsInTimedSet(6), bVar3 != 0)) {
game = g_game;
if (g_game->_frameCount - this->_spawnFrame < 2) {
local_cc = GHIDRA_CAST<Entity *>((((this->_pos).y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5));
local_c8.y = g_displayPixelRatio * g_screenPointScale;
local_e8._shift3 =
GHIDRA_INT(((((this->_pos).x - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * local_c8.y + 0.5
));
dVar22 = floor((double)(float)local_e8._shift3);
local_d0 = GHIDRA_CAST<Room *>(((float)dVar22 / local_c8.y));
local_e8._shift3 = GHIDRA_INT((local_c8.y * (float)local_cc + 0.5));
dVar22 = floor((double)(float)local_e8._shift3);
local_c8.y = (float)dVar22 / local_c8.y;
pvVar11 = game->_room;
local_cc = *GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(pvVar11) + 0x11fc));
local_e8._shift3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar11) + 0x1200));
(GHIDRA_CAST<shared_ptr *>((&local_f4)))->shared_ptr::assign((void *)(GHIDRA_INT(pvVar11) + 0x1bc8));
local_14 = 6;
virtualFn = *(code **)(*GHIDRA_CAST<int *>(local_f4.x) + 0x2c);
__ftoui3();
__ftoui3();
(*virtualFn)();
local_14 = 7;
if (((GHIDRA_CAST<Entity *>(local_f4.y) != GHIDRA_CAST<Entity *>(0x0)) &&
(cVar4 = (**(code **)(*GHIDRA_CAST<int *>(local_f4.y) + 0xc))(), cVar4 != '\0')) &&
(g_renderTargetReleaseFn != (void *)0x0)) {
(*g_renderTargetReleaseFn)();
}
this = local_f8;
local_14 = 0xffffffff;
(local_f8->_colorMod)._tint[3] = 1.0;
(local_f8->_colorMod)._tint[0] = 0.0;
(local_f8->_colorMod)._tint[1] = 0.0;
(local_f8->_colorMod)._tint[2] = 0.0;
(local_f8->_colorMod)._tint[3] = 0.7;
(local_f8->_colorMod)._offset[0] = local_50 * 0.9;
(local_f8->_colorMod)._offset[1] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)local_4c)) + 0x0))) * 0.9;
(local_f8->_colorMod)._offset[2] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)local_4c)) + 0x4))) * 0.9;
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&local_f8->_sprite))))->Sprite::SetColor(&local_f8->_colorMod);
}
game = g_game;
if (GHIDRA_UINT((g_game->_frameCount + this->_index)) % 0x1e < 2) {
local_cc = GHIDRA_CAST<Entity *>((((this->_pos).y - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5));
local_c8.y = g_displayPixelRatio * g_screenPointScale;
local_e8._shift3 =
GHIDRA_INT((local_c8.y * (((this->_pos).x - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) + 0.5
));
dVar22 = floor((double)(float)local_e8._shift3);
local_f8 = GHIDRA_CAST<Entity_Pickup *>(((float)dVar22 / local_c8.y));
local_e8._shift3 = GHIDRA_INT((local_c8.y * (float)local_cc + 0.5));
dVar22 = floor((double)(float)local_e8._shift3);
local_c8.y = (float)dVar22 / local_c8.y;
pvVar11 = game->_room;
local_cc = *GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(pvVar11) + 0x11fc));
local_e8._shift3 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar11) + 0x1200));
(GHIDRA_CAST<shared_ptr *>((&renderTarget)))->shared_ptr::assign((void *)(GHIDRA_INT(pvVar11) + 0x1bc8));
local_14 = 8;
(**(code **)(*renderTarget + 0x2c))();
local_14 = 9;
if (((local_d0 != GHIDRA_CAST<Room *>(0x0)) &&
(cVar4 = (**(code **)(GHIDRA_INT(*GHIDRA_CAST<float *>(local_d0)) + 0xc))(), cVar4 != '\0')) &&
(g_renderTargetReleaseFn != (void *)0x0)) {
(*g_renderTargetReleaseFn)();
}
local_14 = 0xffffffff;
fVar17 = (this->_colorMod)._tint[3];
(this->_colorMod)._tint[3] = (0.7 - fVar17) * 0.3 + fVar17;
fVar17 = (this->_colorMod)._offset[2];
fVar19 = (this->_colorMod)._offset[0];
fVar16 = (this->_colorMod)._offset[1];
(this->_colorMod)._offset[2] = ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)local_4c)) + 0x4))) * 0.9 - fVar17) * 0.5 + fVar17;
(this->_colorMod)._offset[1] = ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((float)local_4c)) + 0x0))) * 0.9 - fVar16) * 0.5 + fVar16;
(this->_colorMod)._offset[0] = (local_50 * 0.9 - fVar19) * 0.5 + fVar19;
}
tmpColor._tint[0] = (this->_sprite)._color._tint[0];
tmpColor._tint[1] = (this->_sprite)._color._tint[1];
tmpColor._tint[2] = (this->_sprite)._color._tint[2];
tmpColor._tint[3] = (this->_sprite)._color._tint[3];
tmpColor._offset[2] = (this->_sprite)._color._offset[2];
spriteColor = &(this->_sprite)._color;
tmpColor._colorize[0] = (this->_sprite)._color._colorize[0];
tmpColor._colorize[1] = (this->_sprite)._color._colorize[1];
tmpColor._colorize[2] = (this->_sprite)._color._colorize[2];
tmpColor._colorize[3] = (this->_sprite)._color._colorize[3];
(*GHIDRA_CAST<undefined8 *>((GHIDRA_CAST<char *>(&(tmpColor._offset)) + 0x0))) = *GHIDRA_CAST<undefined8 *>((this->_sprite)._color._offset);
Color::Lerp(&lerpedColor,GHIDRA_CAST<ColorMod *>(&tmpColor),&this->_colorMod,0.1);
if (spriteColor != &lerpedColor) {
spriteColor->_tint[0] = 0.01;
(this->_sprite)._color._tint[1] = 0.01;
(this->_sprite)._color._tint[2] = 0.01;
(this->_sprite)._color._tint[3] = 1.0;
(this->_sprite)._color._colorize[0] = lerpedColor._colorize[0];
(this->_sprite)._color._colorize[1] = lerpedColor._colorize[1];
(this->_sprite)._color._colorize[2] = lerpedColor._colorize[2];
(this->_sprite)._color._colorize[3] = lerpedColor._colorize[3];
*GHIDRA_CAST<undefined8 *>((this->_sprite)._color._offset) = (*GHIDRA_CAST<undefined8 *>((GHIDRA_CAST<char *>(&(lerpedColor._offset)) + 0x0)));
(this->_sprite)._color._offset[2] = lerpedColor._offset[2];
}
}
game = g_game;
uVar6 = this->_timeout;
if ((GHIDRA_INT(uVar6) < 1) || (this->_variant == 100)) {
bVar3 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsInTimedSet(0x48);
if (bVar3 != 0) {
iVar5 = this->_spawnFrame;
uVar6 = game->_frameCount - iVar5;
if (0x96 < GHIDRA_INT(uVar6)) {
uVar6 = uVar6 & 0x80000001;
if (GHIDRA_INT(uVar6) < 0) {
uVar6 = (uVar6 - 1 | 0xfffffffe) + 1;
}
if (uVar6 == 1) {
(GHIDRA_CAST<Color *>((&tmpColor)))->Color::Reset();
tmpColor._offset[0] = 0.0;
tmpColor._offset[1] = 0.0;
tmpColor._tint[0] = 0.0;
tmpColor._tint[1] = 0.0;
tmpColor._tint[2] = 0.0;
tmpColor._tint[3] = 0.0;
tmpColor._offset[2] = 0.0;
this->SetColor();
iVar5 = this->_spawnFrame;
}
}
if (0xd2 < g_game->_frameCount - iVar5) {
LAB_006e42ba:
this->Remove();
ExceptionList = local_1c;
return;
}
}
}
else if (GHIDRA_INT(uVar6) < 0x1e) {
uVar6 = uVar6 & 0x80000001;
if (GHIDRA_INT(uVar6) < 0) {
uVar6 = (uVar6 - 1 | 0xfffffffe) + 1;
}
if (uVar6 == 1) {
(GHIDRA_CAST<Color *>((GHIDRA_CAST<Color *>(local_68))))->Color::Reset();
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_4c)) + 0x4))) = GHIDRA_CAST<Room *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_4c)) + 0x8))) = GHIDRA_CAST<Entity *>(0x0);
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_68)) + 0x0))) = 0.0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_68)) + 0x4))) = 0.0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_68)) + 0x8))) = 0.0;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_68)) + 0xc))) = 0.0;
local_40 = GHIDRA_CAST<Entity *>(0x0);
this->SetColor();
}
}
if ((this->_variant == 0x14) && (this->_subtype == 6)) {
animName = (GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>(&(this->_sprite)._animState))))->ANM2::GetAnimation(GHIDRA_CAST<std_string *>((local_bc + 0x10)));
puVar1 = &animName->_size;
if (0xf < animName->_capacity) {
animName = *GHIDRA_CAST<std_string **>(animName->_buf);
}
local_bd = str_eq(GHIDRA_CAST<byte *>(animName),*puVar1,GHIDRA_CAST<byte *>("Touched"),7);
(GHIDRA_CAST<std::string *>((local_bc + 0x10)))->std::string::_Tidy_deallocate();
if (local_bd != 0) {
if ((this->_sprite)._animState._animData != (void *)0x0) {
bVar3 = (GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::IsEventTriggered(GHIDRA_CAST<byte *>("DropSound"));
manager = g_manager;
if (bVar3 != 0) {
local_c8.y = 3.237e-43;
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_c8.y));
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_c8.y),0.5,2,0,1.0,0.0);
}
}
if (((this->_sprite)._animState._animData == (void *)0x0) ||
((this->_sprite)._animState._isPlaying == 0)) {
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Play(s_Idle,0);
}
}
}
if (0 < this->_collisionCooldown) {
if (((this->_sprite)._animState._animData == (void *)0x0) ||
((this->_sprite)._animState._isPlaying == 0)) {
LAB_006e6519:
this->_collisionCooldown = this->_collisionCooldown + -1;
}
else {
pbVar8 = (this->_sprite)._animState._animData;
if (0xf < *GHIDRA_CAST<uint *>((pbVar8 + 0x14))) {
pbVar8 = *GHIDRA_CAST<byte **>(pbVar8);
}
pcVar12 = "Appear";
do {
bVar3 = *pbVar8;
bVar15 = bVar3 < (byte)*pcVar12;
if (bVar3 != *pcVar12) {
LAB_006e64d7:
uVar6 = -GHIDRA_UINT(bVar15) | 1;
goto LAB_006e64dc;
}
if (bVar3 == 0) break;
bVar3 = pbVar8[1];
bVar15 = bVar3 < (byte)pcVar12[1];
if (bVar3 != pcVar12[1]) goto LAB_006e64d7;
pbVar8 = pbVar8 + 2;
pcVar12 = pcVar12 + 2;
} while (bVar3 != 0);
uVar6 = 0;
LAB_006e64dc:
if (uVar6 != 0) {
pbVar8 = (this->_sprite)._animState._animData;
if (0xf < *GHIDRA_CAST<uint *>((pbVar8 + 0x14))) {
pbVar8 = *GHIDRA_CAST<byte **>(pbVar8);
}
pcVar12 = "AppearFast";
do {
bVar3 = *pbVar8;
bVar15 = bVar3 < (byte)*pcVar12;
if (bVar3 != *pcVar12) {
LAB_006e6510:
uVar6 = -GHIDRA_UINT(bVar15) | 1;
goto LAB_006e6515;
}
if (bVar3 == 0) break;
bVar3 = pbVar8[1];
bVar15 = bVar3 < (byte)pcVar12[1];
if (bVar3 != pcVar12[1]) goto LAB_006e6510;
pbVar8 = pbVar8 + 2;
pcVar12 = pcVar12 + 2;
} while (bVar3 != 0);
uVar6 = 0;
LAB_006e6515:
if (uVar6 != 0) goto LAB_006e6519;
}
}
}
if (this->_variant == 0x154) {
local_e8._shift3 = *GHIDRA_CAST<int *>(&this->_target);
if (((EntityPtr)local_e8._shift3 == (EntityPtr)0x0) || (*GHIDRA_CAST<int *>((local_e8._shift3 + 0x28)) != 1))
{
local_e8._shift3 = GHIDRA_INT((GHIDRA_CAST<Game *>((g_game)))->Game)::GetPlayer(0);
}
if (this->_state == 1) {
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Play(s_Open,0);
uVar6 = 0;
playerManager = &g_game->_playerManager;
game = g_game;
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin)
>> 2 != 0) {
do {
player = (GHIDRA_CAST<PlayerManager *>((playerManager)))->PlayerManager::GetPlayer(uVar6);
game = g_game;
uVar6 = uVar6 + 1;
playerManager = &g_game->_playerManager;
(player->_velocity).x = g_vectorZero.x;
(player->_velocity).y = g_vectorZero.y;
player->_isControlsEnabled = 0;
} while (uVar6 < GHIDRA_UINT((GHIDRA_INT((game->_playerManager)._playerList._end) -
GHIDRA_INT((playerManager->_playerList)._begin) >> 2)));
}
flags = this->_flags;
puVar1 = GHIDRA_CAST<uint *>((GHIDRA_INT(&this->_flags) + 4));
*puVar1 = *puVar1 | 0x1000;
this->_state = this->_state + 1;
*GHIDRA_CAST<int *>(&this->_flags) = GHIDRA_INT(flags);
this->_entityCollisionClass = 0;
*GHIDRA_CAST<float *>((local_e8._shift3 + 0x1b1c)) = g_vectorZero.x;
*GHIDRA_CAST<float *>((local_e8._shift3 + 0x1b20)) = g_vectorZero.y;
(GHIDRA_CAST<Game *>((game)))->Game::StartStageTransition(0,4,GHIDRA_CAST<Entity_Player *>(local_e8._shift3));
iVar5 = get_stage_ending_id(0);
if ((((iVar5 != 3) && (iVar5 != 4)) && (iVar5 != 5)) && ((iVar5 != 9 && (iVar5 != 0xc)))) {
SoundEffects::PlayWithFartOverride(0x433,1.0,2,0,1.0);
}
}
else if (this->_state == 2) {
iVar5 = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::GetFrame();
if ((iVar5 == 6) &&
(((iVar5 = get_stage_ending_id(0), iVar5 == 3 || (iVar5 == 4)) ||
((iVar5 == 5 || ((iVar5 == 9 || (iVar5 == 0xc)))))))) {
(GHIDRA_CAST<Game *>((g_game)))->Game::End(iVar5);
ExceptionList = local_1c;
return;
}
if (((this->_sprite)._animState._animData == (void *)0x0) ||
((this->_sprite)._animState._isPlaying == 0)) {
this->_state = this->_state + 1;
manager = g_manager;
local_c8.y = 1.47417e-42;
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_c8.y));
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_c8.y),1.0,2,0,1.0,0.0);
iVar5 = local_e8._shift3;
(GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(local_e8._shift3))))->Entity_Player::PlayExtraAnimation(GHIDRA_CAST<byte *>("Trapdoor"));
fVar17 = (this->_pos).y;
*GHIDRA_CAST<float *>((iVar5 + 0x1b1c)) = (this->_pos).x + 0.0;
*GHIDRA_CAST<float *>((iVar5 + 0x1b20)) = fVar17 + 20.0;
}
}
}
if (this->_variant != 0x172) goto LAB_006e686a;
EVar10 = this->_target;
if ((EVar10 == (EntityPtr)0x0) || (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar10) + 0x28)) != 1)) {
this->_state = 0;
goto LAB_006e686a;
}
if (this->_state == 1) {
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar10) + 0x188)) = 0;
*GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(EVar10) + 0x410)) = 0;
(GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(EVar10))))->Entity_Player::AnimatePickup(&this->_sprite,1,GHIDRA_CAST<byte *>("Pickup"));
this->_state = this->_state + 1;
this->_visible = 0;
goto LAB_006e686a;
}
if (this->_state != 2) goto LAB_006e686a;
if (*GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(EVar10) + 0x139a)) == 0) {
LAB_006e67da:
bVar3 = (GHIDRA_CAST<Entity_Player *>((GHIDRA_CAST<Entity_Player *>(EVar10))))->Entity_Player::IsHoldingItem();
if (bVar3 != 0) goto LAB_006e686a;
}
else {
if (*(void **)(GHIDRA_CAST<char *>(EVar10) + 0x450) == (void *)0x0) {
local_c8.y = 0.0;
}
else {
local_c8.y = *GHIDRA_CAST<float *>((GHIDRA_INT(*(void **)(GHIDRA_CAST<char *>(EVar10) + 0x450)) + 0x30));
}
puVar14 = GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<ANM2 *>((GHIDRA_CAST<ANM2 *>((GHIDRA_INT(EVar10) + 0x41c)))))->ANM2)::GetFrame();
if (puVar14 != &(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(((GHIDRA_CAST<Room *>((GHIDRA_INT(local_c8.y) + -0x7898))))) + 0x7897)))) goto LAB_006e67da;
}
game = g_game;
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(EVar10) + 0x188)) = 4;
if ((((game->_dailyChallenge)._id == 0) || (iVar5 = get_stage_ending_id(1), iVar5 == 0xff)) ||
(iVar5 == 0)) {
(GHIDRA_CAST<Game *>((g_game)))->Game::FinishChallenge();
}
else {
(GHIDRA_CAST<Game *>((g_game)))->Game::End(iVar5);
}
LAB_006e686a:
if ((((this->_variant == 0x36) && (this->_subtype != 0)) &&
((this->_collisionCooldown < 1 &&
((this->_entityCollisionClass != 0 &&
(bVar3 = (GHIDRA_CAST<PlayerManager *>((&g_game->_playerManager)))->PlayerManager::AnyoneHasTrinket(0x97), bVar3 == 0)))))) &&
(player = (GHIDRA_CAST<Game *>((g_game)))->Game::GetNearestPlayer(&this->_pos),
fVar19 = (this->_pos).x - (player->_pos).x, fVar17 = (this->_pos).y - (player->_pos).y,
fVar17 * fVar17 + fVar19 * fVar19 < 2500.0)) {
Morph(this,this->_type,0x34,this->_subtype,0,0,0);
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::Play(GHIDRA_CAST<byte *>("Appear"),0);
if ((this->_sprite)._animState._animData != (void *)0x0) {
(GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::SetFrameFloat(14.0);
}
this->_entityCollisionClass = 4;
SoundEffects::PlayWithFartOverride(0xcd,1.0,2,0,1.0);
}
FUN_00862fe0();
ExceptionList = local_1c;
return;
}
// 006e69b0
void Entity_Pickup::Render(Vector *offset)
{
Vector *position;
code *pcVar1;
uint uVar2;
LayerState *layer;
double dVar3;
undefined *puVar4;
Vector scratchPos;
float worldY;
float screenX;
float local_14;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
float offsetX;
local_8 = 0xffffffff;
puStack_c = &LAB_00afb151;
local_10 = ExceptionList;
uVar2 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
if (((this->_exists != 0) && (this->_visible != 0)) && (this->_dropDelay < 1)) {
if (this->_variant == 100) {
if (this->_megaChestCollectible[0] != (void *)0x0) {
return;
}
worldY = (this->_pos).y + (this->_posOffset).y;
scratchPos.y = (g_screenHeight - 182.0) * 0.5;
local_14 = g_displayPixelRatio * g_screenPointScale;
screenX = ((((this->_posOffset).x + (this->_pos).x) - 60.0) * 0.65 +
(g_screenWidth - 338.0) * 0.5) * local_14 + 0.5;
ExceptionList = &local_10;
dVar3 = floor((double)screenX);
screenX = (float)dVar3 / local_14;
scratchPos.y = ((worldY - 140.0) * 0.65 + scratchPos.y) * local_14 + 0.5;
dVar3 = floor((double)scratchPos.y);
position = &this->_renderPosition;
offsetX = offset->x;
(this->_renderPosition).y = (float)dVar3 / local_14 + offset->y;
position->x = screenX + offsetX;
scratchPos.y = 0.0;
local_14 = 0.0;
if (((this->_altPedestalANM2)._loaded != 0) && (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(g_game->_room) + 0x12bc)) != 5)) {
if ((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(ThreadLocalStoragePointer) + 0xc)) < DAT_00c80e40) &&
(_Init_thread_header(), DAT_00c80e40 == -1)) {
_DAT_00c5d010 = 0x300000004;
DAT_00c5d018 = 0x1b;
puVar4 = &DAT_00b15710;
_atexit(GHIDRA_CAST<_func_4879 *>(&DAT_00b15710));
local_8 = 0xffffffff;
_Init_thread_footer(&DAT_00c80e40,puVar4,uVar2);
}
if ((DAT_00c5d00c == 0) &&
(KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("RNG Seed is zero!\n")), DAT_00c5d00c == 0)) {
pcVar1 = (code *)swi(3);
(*pcVar1)();
return;
}
uVar2 = DAT_00c5d00c >> ((byte)_DAT_00c5d010 & 0x1f) ^ DAT_00c5d00c;
uVar2 = uVar2 << ((byte)((ulonglong)_DAT_00c5d010 >> 0x20) & 0x1f) ^ uVar2;
DAT_00c5d00c = uVar2 >> ((byte)DAT_00c5d018 & 0x1f) ^ uVar2;
(this->_altPedestalANM2)._color._tint[3] =
(float)((double)GHIDRA_INT(DAT_00c5d00c) +
__uint_to_double_fixup[-(GHIDRA_INT(DAT_00c5d00c) >> 0x1f)]) * 2.3283062e-10 * 0.15 +
0.05;
if (this->_subtype != 0) {
scratchPos.y = -2.6;
}
scratchPos.x = scratchPos.y + position->x;
scratchPos.y = scratchPos.y + (this->_renderPosition).y;
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_altPedestalANM2))))->Sprite::RenderLayer(1,&scratchPos,&g_vectorZero,
&g_vectorZero);
local_14 = 2.6;
}
layer = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST<byte *>(0x1));
layer->_visible = 0;
AnimationState::Render
(&(this->_sprite)._overlayAnimState,position,&g_vectorZero,&g_vectorZero);
AnimationState::Render(&(this->_sprite)._animState,position,&g_vectorZero,&g_vectorZero);
layer = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST<byte *>(0x1));
layer->_visible = 1;
if (this->_megaChestCollectible[1] == (void *)0x0) {
scratchPos.x = local_14 + position->x;
scratchPos.y = local_14 + (this->_renderPosition).y;
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::RenderLayer(1,&scratchPos,&g_vectorZero,&g_vectorZero);
}
else {
scratchPos.x = (this->_sprite)._scale.x * -16.0 * 0.65 + position->x;
scratchPos.y = (this->_sprite)._scale.y * 0.0 * 0.65 + (this->_renderPosition).y;
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>(&this->_sprite))))->Sprite::RenderLayer(1,&scratchPos,&g_vectorZero,&g_vectorZero);
scratchPos.x = (this->_sprite)._scale.x * 16.0 * 0.65 + position->x;
scratchPos.y = (this->_sprite)._scale.y * 0.0 * 0.65 + (this->_renderPosition).y;
(GHIDRA_CAST<Sprite *>((GHIDRA_CAST<Sprite *>((GHIDRA_INT(this->_megaChestCollectible[1]) + 0x48)))))->Sprite::RenderLayer(1,&scratchPos,
&g_vectorZero,&g_vectorZero);
}
}
else {
ExceptionList = &local_10;
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::Render(offset);
}
if ((this->_priceANM2)._loaded != 0) {
(GHIDRA_CAST<ANM2 *>((&this->_priceANM2)))->ANM2::Render(&this->_renderPosition,&g_vectorZero,&g_vectorZero);
}
FUN_008630c0(this,offset);
}
ExceptionList = local_10;
return;
}
// 006e6e40
byte Entity_Pickup::TryOpenChest(Entity_Player *player)
{
code *pcVar1;
Vector *pVVar2;
Vector targetPos;
Vector targetPos_00;
undefined1 *puVar3;
byte bVar4;
uint uVar5;
Entity *spawned;
int lootContainer;
Entity_Pickup *pEVar6;
Entity_Player *pEVar7;
int extraout_ECX;
float fVar8;
float nudgeX;
int iVar9;
Vector lootSpawnPos;
Vector lootVelocity;
Vector randomVelocity;
Vector spiderTarget;
Vector playerChestMidpoint;
RNG dropRng;
int *loot [3];
uint lootFirst;
int lootCount;
float local_80;
void *local_7c;
uint lootIndex;
Vector *chestPos;
float local_70;
Room *local_6c;
Entity_Player *openingPlayer;
Vector *local_64;
char isPickupSpawned;
float local_5c;
Entity_Pickup *chest;
byte isPayToPlay;
undefined4 flashColor;
undefined4 uStack_4c;
undefined4 uStack_48;
undefined4 uStack_44;
undefined4 local_40;
undefined4 uStack_3c;
undefined4 uStack_38;
undefined4 uStack_34;
undefined4 local_30;
undefined4 uStack_2c;
undefined4 local_28;
uint local_24;
undefined1 *puStack_20;
void *local_1c;
undefined1 *puStack_18;
int *local_14;
Game *game;
int *lootProxy;
Manager *manager;
ColorMod *poofColor;
puStack_20 = GHIDRA_CAST<undefined1 *>((GHIDRA_INT(register0x00000010) + -4));
local_14 = GHIDRA_CAST<int *>(0xffffffff);
puStack_18 = &LAB_00afb180;
local_1c = ExceptionList;
local_24 = __security_cookie ^ GHIDRA_UINT((loot + 0x21));
ExceptionList = &local_1c;
openingPlayer = player;
chest = this;
puVar3 = GHIDRA_CAST<undefined1 *>((GHIDRA_INT(register0x00000010) + -4));
if (player == GHIDRA_CAST<Entity_Player *>(0x0)) {
openingPlayer = Game::GetNearestPlayerEx(&this->_pos,1,0,0);
puVar3 = puStack_20;
if (openingPlayer == GHIDRA_CAST<Entity_Player *>(0x0)) {
openingPlayer = (GHIDRA_CAST<Game *>((g_game)))->Game::GetPlayer(0);
puVar3 = puStack_20;
}
}
puStack_20 = puVar3;
if (this->_subtype == 0) {
bVar4 = 0;
}
else {
bVar4 = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::SetAnimation(s_Open,1);
if (bVar4 != 0) {
(GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::Rewind();
(this->_sprite)._animState._isPlaying = 1;
}
manager = g_manager;
local_5c = 3.08286e-44;
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_5c));
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_5c),1.0,2,0,1.0,0.0);
manager = g_manager;
iVar9 = this->_variant;
if (((iVar9 == 0x3c) || (iVar9 == 0x35)) || (iVar9 == 0x37)) {
local_5c = 2.18603e-43;
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_5c));
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_5c),1.0,2,0,1.0,0.0);
(GHIDRA_CAST<PersistentGameData *>((&g_manager->_persistentGameData)))->PersistentGameData::IncreaseEventCounter(0xc6,1);
}
uVar5 = Random();
pVVar2 = &this->_pos;
chestPos = pVVar2;
spawned = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0xf,pVVar2,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),2,uVar5);
fVar8 = (this->_sprite)._scale.x;
local_30 = 0;
uStack_2c = 0;
local_28 = 0;
poofColor = &(spawned->_sprite)._color;
(spawned->_posOffset).y = fVar8 * -10.0;
(spawned->_posOffset).x = fVar8 * 0.0;
fVar8 = (this->_sprite)._scale.y;
(spawned->_sprite)._scale.x = (this->_sprite)._scale.x * 0.8;
(spawned->_sprite)._scale.y = fVar8 * 0.8;
if (poofColor != GHIDRA_CAST<ColorMod *>(&flashColor)) {
(spawned->_sprite)._color._colorize[0] = 0.0;
(spawned->_sprite)._color._colorize[1] = 0.0;
(spawned->_sprite)._color._colorize[2] = 0.0;
(spawned->_sprite)._color._colorize[3] = 0.0;
(spawned->_sprite)._color._offset[0] = 0.0;
(spawned->_sprite)._color._offset[1] = 0.0;
poofColor->_tint[0] = 1.0;
(spawned->_sprite)._color._tint[1] = 1.0;
(spawned->_sprite)._color._tint[2] = 1.0;
(spawned->_sprite)._color._tint[3] = 0.3;
(spawned->_sprite)._color._offset[2] = 0.0;
}
spawned->_renderDepthOffset = 4.0;
isPickupSpawned = '\0';
local_5c = (float)this->_variant;
isPayToPlay = this->_isPayToPlay;
GetChestLoot(this,loot,1,openingPlayer);
lootProxy = loot[0];
local_14 = GHIDRA_CAST<int *>(0x0);
chest->_subtype = 0;
game = g_game;
if ((chest->_variant == 0x35) && (lootCount == 0)) {
chest->_chestReCloseTimer = 0;
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(game->_room) + 0x7894)) = 1;
if (1 < *GHIDRA_CAST<int *>(&game->_deathmatchManager)) {
uVar5 = Random();
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0xf,pVVar2,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar5);
manager = g_manager;
local_5c = 3.71344e-43;
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_5c));
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_5c),0.7,2,0,1.0,0.0);
chest->Remove();
}
}
else {
dropRng._seed = (chest->_dropRNG)._seed;
dropRng._shift1 = 2;
dropRng._shift2 = 7;
dropRng._shift3 = 9;
local_70 = 0.0;
pEVar6 = chest;
uVar5 = lootFirst;
while( true ) {
pEVar7 = openingPlayer;
lootIndex = uVar5;
if (uVar5 == lootFirst + lootCount) break;
if (lootProxy == GHIDRA_CAST<int *>(0x0)) {
iVar9 = 0;
}
else {
iVar9 = *lootProxy;
}
if (**GHIDRA_CAST<int **>((*GHIDRA_CAST<int *>((iVar9 + 4)) + (*GHIDRA_CAST<int *>((iVar9 + 8)) - 1U & uVar5) * 4)) == 5) {
if (lootProxy == GHIDRA_CAST<int *>(0x0)) {
iVar9 = 0;
}
else {
iVar9 = *lootProxy;
}
if (*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar9 + 4)) + (*GHIDRA_CAST<int *>((iVar9 + 8)) - 1U & uVar5) * 4)) + 4))
!= 100) goto LAB_006e746d;
if (local_5c == 5.46506e-43) {
if (lootProxy == GHIDRA_CAST<int *>(0x0)) {
iVar9 = 0;
}
else {
iVar9 = *lootProxy;
}
if (*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar9 + 4)) + (*GHIDRA_CAST<int *>((iVar9 + 8)) - 1U & uVar5) * 4)) + 8))
== 0x244) {
(GHIDRA_CAST<PersistentGameData *>((&g_manager->_persistentGameData)))->PersistentGameData::TryUnlock(0x19f);
pEVar6 = chest;
}
}
if (pEVar6->_variant == 100) {
if (lootProxy == GHIDRA_CAST<int *>(0x0)) {
iVar9 = 0;
}
else {
iVar9 = *lootProxy;
}
local_64 = *(Vector **)
(*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar9 + 4)) + (*GHIDRA_CAST<int *>((iVar9 + 8)) - 1U & uVar5) * 4)) +
0xc);
if (lootProxy == GHIDRA_CAST<int *>(0x0)) {
iVar9 = 0;
}
else {
iVar9 = *lootProxy;
}
local_6c = *GHIDRA_CAST<Room **>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar9 + 4)) +
(*GHIDRA_CAST<int *>((iVar9 + 8)) - 1U & uVar5) * 4)) + 8));
if (lootProxy == GHIDRA_CAST<int *>(0x0)) {
iVar9 = 0;
}
else {
iVar9 = *lootProxy;
}
if (lootProxy == GHIDRA_CAST<int *>(0x0)) {
lootContainer = 0;
}
else {
lootContainer = *lootProxy;
}
pEVar6 = (Entity_Pickup *)
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(**GHIDRA_CAST<uint **>((*GHIDRA_CAST<int *>((lootContainer + 4)) +
(*GHIDRA_CAST<int *>((lootContainer + 8)) - 1U & uVar5) * 4)),
*GHIDRA_CAST<uint *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar9 + 4)) +
(*GHIDRA_CAST<int *>((iVar9 + 8)) - 1U & uVar5) * 4)) + 4)),
chestPos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),GHIDRA_UINT(local_6c),GHIDRA_UINT(local_64))
;
}
else {
if (lootProxy == GHIDRA_CAST<int *>(0x0)) {
iVar9 = 0;
}
else {
iVar9 = *lootProxy;
}
if (lootProxy == GHIDRA_CAST<int *>(0x0)) {
lootContainer = 0;
}
else {
lootContainer = *lootProxy;
}
Morph(pEVar6,5,*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((lootContainer + 4)) +
(*GHIDRA_CAST<int *>((lootContainer + 8)) - 1U & uVar5) * 4)) + 4)),
*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar9 + 4)) + (*GHIDRA_CAST<int *>((iVar9 + 8)) - 1U & uVar5) * 4)) +
8)),0,0,0);
pEVar6 = chest;
}
if (((local_5c == 5.04467e-43) && (g_game->_difficulty != 2)) &&
((g_game->_difficulty != 3 &&
((g_game->_stage == 0xb && (g_game->_startingRoomIdx == g_game->_currentRoomIdx))))))
{
MakeShopItem(pEVar6,-2);
uVar5 = Random();
spawned = (GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0xf,&pEVar6->_pos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar5)
;
flashColor = 0x3f800000;
uStack_4c = 0x3f800000;
uStack_48 = 0x3f800000;
uStack_44 = 0x3f800000;
local_30 = 0;
local_40 = 0x40000000;
uStack_3c = 0x3ecccccd;
uStack_38 = 0x3ecccccd;
uStack_34 = 0x3f800000;
uStack_2c = 0;
local_28 = 0;
spawned->SetColor(&flashColor,0xffffffff,0xff,0,1);
}
if (pEVar6->_variant == 100) {
(pEVar6->_targetPosition).x = chestPos->x;
(pEVar6->_targetPosition).y = chestPos->y;
if (GHIDRA_INT(local_5c) < 0x169) {
if (local_5c == 5.04467e-43) {
iVar9 = 5;
}
else {
switch(local_5c) {
case 7.00649e-44:
iVar9 = 10;
break;
case 7.14662e-44:
iVar9 = 6;
break;
case 7.28675e-44:
case 7.56701e-44:
iVar9 = 7;
break;
case 7.42688e-44:
iVar9 = 8;
if (isPayToPlay != 0) {
iVar9 = 0x11;
}
break;
case 7.70714e-44:
iVar9 = 0xc;
if (isPayToPlay != 0) {
iVar9 = 0x12;
}
break;
case 7.84727e-44:
iVar9 = 0xd;
break;
case 7.9874e-44:
iVar9 = 0xe;
if (isPayToPlay != 0) {
iVar9 = 0x13;
}
break;
default:
goto switchD_006e73d9_caseD_3a;
case 8.40779e-44:
iVar9 = 4;
if (isPayToPlay != 0) {
iVar9 = 0x10;
}
}
}
}
else {
if (local_5c != 5.46506e-43) goto switchD_006e73d9_caseD_3a;
iVar9 = 0xb;
}
SetAlternatePedestal(pEVar6,iVar9);
}
switchD_006e73d9_caseD_3a:
isPickupSpawned = '\x01';
LAB_006e7459:
pEVar6 = chest;
uVar5 = lootIndex;
LAB_006e7467:
uVar5 = uVar5 + 1;
}
else {
LAB_006e746d:
if (lootProxy == GHIDRA_CAST<int *>(0x0)) {
iVar9 = 0;
}
else {
iVar9 = *lootProxy;
}
if (**GHIDRA_CAST<int **>((*GHIDRA_CAST<int *>((iVar9 + 4)) + (*GHIDRA_CAST<int *>((iVar9 + 8)) - 1U & uVar5) * 4)) == 0) {
if (lootProxy == GHIDRA_CAST<int *>(0x0)) {
iVar9 = 0;
}
else {
iVar9 = *lootProxy;
}
if (*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar9 + 4)) + (*GHIDRA_CAST<int *>((iVar9 + 8)) - 1U & uVar5) * 4)) + 4))
!= 1) goto LAB_006e74e4;
(GHIDRA_CAST<Level *>((GHIDRA_CAST<Level *>(g_game))))->Level::InitializeDevilAngelRoom(0,0);
game = g_game;
g_game->_leaveDoor = -1;
Game::StartRoomTransition(game,-1,-1,3,openingPlayer,-1);
uVar5 = uVar5 + 1;
pEVar6 = chest;
}
else {
LAB_006e74e4:
if (lootProxy == GHIDRA_CAST<int *>(0x0)) {
iVar9 = 0;
}
else {
iVar9 = *lootProxy;
}
if (**GHIDRA_CAST<int **>((*GHIDRA_CAST<int *>((iVar9 + 4)) + (*GHIDRA_CAST<int *>((iVar9 + 8)) - 1U & uVar5) * 4)) == 0x55) {
local_64 = &pEVar6->_pos;
if (uVar5 == lootFirst) {
local_6c = g_game->_room;
pEVar7 = *GHIDRA_CAST<Entity_Player **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((openingPlayer)) + 0x1450))));
if ((*GHIDRA_CAST<Entity_Player **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((openingPlayer)) + 0x1450)))) == GHIDRA_CAST<Entity_Player *>(0x0)) &&
(pEVar7 = *GHIDRA_CAST<Entity_Player **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((openingPlayer)) + 0x144c)))),
*GHIDRA_CAST<Entity_Player **>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((openingPlayer)) + 0x144c)))) == GHIDRA_CAST<Entity_Player *>(0x0))) {
if (openingPlayer->_darkArtsLastSnare == GHIDRA_CAST<Entity *>(0x0)) {
pEVar7 = openingPlayer;
}
else {
pEVar7 = (Entity_Player *)
(GHIDRA_CAST<Entity *>((openingPlayer->_darkArtsLastSnare)))->Entity::GetLastParent();
}
}
playerChestMidpoint.x = ((pEVar7->_pos).x + local_64->x) * 0.5;
playerChestMidpoint.y = ((pEVar7->_pos).y + local_64->y) * 0.5;
Room::FindFreePickupSpawnPosition
(local_6c,&spiderTarget,&playerChestMidpoint,70.0,0,0,0);
targetPos.y = spiderTarget.y;
targetPos.x = spiderTarget.x;
Entity_NPC::ThrowSpider(&chest->_pos,GHIDRA_CAST<Entity *>(chest),targetPos,0,-30.0);
uVar5 = uVar5 + 1;
pEVar6 = chest;
}
else {
targetPos_00.y = g_vectorZero.y;
targetPos_00.x = g_vectorZero.x;
Entity_NPC::ThrowSpider(local_64,GHIDRA_CAST<Entity *>(pEVar6),targetPos_00,0,-30.0);
uVar5 = uVar5 + 1;
pEVar6 = chest;
}
}
else {
if (lootProxy == GHIDRA_CAST<int *>(0x0)) {
iVar9 = 0;
}
else {
iVar9 = *lootProxy;
}
if (**GHIDRA_CAST<int **>((*GHIDRA_CAST<int *>((iVar9 + 4)) + (*GHIDRA_CAST<int *>((iVar9 + 8)) - 1U & uVar5) * 4)) == 3) {
if (lootProxy == GHIDRA_CAST<int *>(0x0)) {
iVar9 = 0;
}
else {
iVar9 = *lootProxy;
}
if (*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar9 + 4)) + (*GHIDRA_CAST<int *>((iVar9 + 8)) - 1U & uVar5) * 4))
+ 4)) == 0x2b) {
(GHIDRA_CAST<Entity_Player *>((openingPlayer)))->Entity_Player::AddBlueFlies(1,chestPos,GHIDRA_CAST<Entity *>(0x0));
uVar5 = uVar5 + 1;
pEVar6 = chest;
}
else {
if (lootProxy == GHIDRA_CAST<int *>(0x0)) {
iVar9 = 0;
}
else {
iVar9 = *lootProxy;
}
if (*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>((iVar9 + 4)) + (*GHIDRA_CAST<int *>((iVar9 + 8)) - 1U & uVar5) * 4
)) + 4)) != 0x49) goto LAB_006e7467;
openingPlayer->_numBlueSpiders = openingPlayer->_numBlueSpiders + 1;
spawn_blue_spider(chestPos,GHIDRA_CAST<Entity *>(openingPlayer),&g_vectorZero);
uVar5 = uVar5 + 1;
pEVar6 = chest;
}
}
else {
local_6c = GHIDRA_CAST<Room *>(0x3f800000);
if ((pEVar6->_variant == 0x39) &&
(local_6c = GHIDRA_CAST<Room *>(((float)GHIDRA_INT(local_70) * 0.05 + 0.4)), 1.0 <= (float)local_6c))
{
local_6c = GHIDRA_CAST<Room *>(0x3f800000);
}
if (lootProxy == GHIDRA_CAST<int *>(0x0)) {
iVar9 = 0;
}
else {
iVar9 = *lootProxy;
}
local_7c = *(void **)(*GHIDRA_CAST<int *>((iVar9 + 4)) + (*GHIDRA_CAST<int *>((iVar9 + 8)) - 1U & uVar5) * 4);
Isaac::GetRandomPickupVelocity(&randomVelocity,&pEVar6->_pos,0,&dropRng);
lootVelocity.x = randomVelocity.x * (float)local_6c;
lootVelocity.y = randomVelocity.y * (float)local_6c;
if (dropRng._seed == 0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("RNG Seed is zero!\n"));
pcVar1 = (code *)swi(3);
bVar4 = (*pcVar1)();
return bVar4;
}
dropRng._seed =
GHIDRA_UINT(dropRng._seed) >> ((byte)dropRng._shift1 & 0x1f) ^ dropRng._seed;
dropRng._seed = dropRng._seed << ((byte)dropRng._shift2 & 0x1f) ^ dropRng._seed;
dropRng._seed =
GHIDRA_UINT(dropRng._seed) >> ((byte)dropRng._shift3 & 0x1f) ^ dropRng._seed;
local_64 = GHIDRA_CAST<Vector *>(0xe);
if (dropRng._seed == 0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("RNG Seed is zero!\n"));
pcVar1 = (code *)swi(3);
bVar4 = (*pcVar1)();
return bVar4;
}
uVar5 = GHIDRA_UINT(dropRng._seed) >> 3 ^ dropRng._seed;
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;
local_64 = GHIDRA_CAST<Vector *>((fVar8 + fVar8));
lootSpawnPos.x = cos((float)local_64);
pVVar2 = chestPos;
lootSpawnPos.x = lootSpawnPos.x + chestPos->x;
lootSpawnPos.y = sin((float)local_64);
lootSpawnPos.y = lootSpawnPos.y + pVVar2->y;
spawned = (GHIDRA_CAST<EntitySpawner *>((local_7c)))->EntitySpawner::Spawn(&lootSpawnPos,&lootVelocity,GHIDRA_CAST<Entity *>(0x0));
if ((spawned->_type == 5) && (chest->_variant == 0x39)) {
spawned[1]._sprite._championColor._offset[2] = (float)(GHIDRA_INT(local_70) / 2);
}
spawned->Update();
local_70 = (float)(GHIDRA_INT(local_70) + 1);
if (((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) && (spawned->_type == 1)) ||
(spawned->_type - 10U < 0x3de)) {
local_7c = (void *)chestPos->x;
local_80 = chestPos->y;
local_6c = GHIDRA_CAST<Room *>(((float)local_7c - (openingPlayer->_pos).x));
local_64 = GHIDRA_CAST<Vector *>((local_80 - (openingPlayer->_pos).y));
fVar8 = sqrtf((float)local_64 * (float)local_64 +
(float)local_6c * (float)local_6c);
if (fVar8 <= 0.0) {
nudgeX = (float)local_6c;
pVVar2 = local_64;
}
else {
nudgeX = (float)local_6c * (20.0 / fVar8);
pVVar2 = GHIDRA_CAST<Vector *>(((float)local_64 * (20.0 / fVar8)));
}
(spawned->_pos).x = (float)local_7c + nudgeX;
(spawned->_pos).y = local_80 + (float)pVVar2;
goto switchD_006e73d9_caseD_3a;
}
if ((spawned->_type != 5) || (bVar4 = IsChest(spawned->_variant), bVar4 == 0))
goto LAB_006e7459;
fVar8 = (chest->_sprite)._scale.y;
(spawned->_sprite)._scale.x = (chest->_sprite)._scale.x * 0.8;
(spawned->_sprite)._scale.y = fVar8 * 0.8;
uVar5 = lootIndex + 1;
pEVar6 = chest;
}
}
}
}
}
pVVar2 = &pEVar6->_pos;
if (isPickupSpawned != '\0') {
local_70 = (pEVar6->_pos).y - (openingPlayer->_pos).y;
local_5c = pVVar2->x - (openingPlayer->_pos).x;
local_80 = local_70 * local_70 + local_5c * local_5c;
if (local_80 < 1600.0) {
local_7c = (void *)(openingPlayer->_velocity).x;
local_64 = GHIDRA_CAST<Vector *>((openingPlayer->_velocity).y);
fVar8 = sqrtf(local_80);
if (0.0 < fVar8) {
local_70 = (1.0 / fVar8) * local_70;
local_5c = (1.0 / fVar8) * local_5c;
}
fVar8 = sqrtf(local_80);
fVar8 = (40.0 - fVar8) * 0.4;
(pEVar7->_velocity).x = ((float)local_7c - fVar8 * local_5c) * 0.5;
(pEVar7->_velocity).y = ((float)local_64 - fVar8 * local_70) * 0.5;
pEVar6 = chest;
}
pEVar6->_wait = 0x14;
}
if (pEVar6->_variant == 0x35) {
pEVar6->_chestReCloseTimer = 0x3c;
}
if (((1 < *GHIDRA_CAST<int *>(&g_game->_deathmatchManager)) &&
(bVar4 = IsChest(pEVar6->_variant), bVar4 != 0)) && (extraout_ECX != 0x35)) {
uVar5 = Random();
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0xf,pVVar2,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar5);
manager = g_manager;
local_64 = GHIDRA_CAST<Vector *>(0x109);
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_64));
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_64),0.7,2,0,1.0,0.0);
chest->Remove();
}
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(g_game->_room) + 0x7894)) = 1;
}
std::deque<LootEntry>::clear();
lootProxy = loot[0];
loot[0] = GHIDRA_CAST<int *>(0x0);
operator_delete(lootProxy,8);
bVar4 = 1;
}
ExceptionList = local_1c;
return bVar4;
}
// 006e7be0
void Entity_Pickup::PlayDropSound()
{
int iVar1;
byte isChest;
int extraout_ECX;
int extraout_EDX;
int soundId;
Manager *manager;
iVar1 = this->_variant;
if (iVar1 == 10) {
if (this->_subtype == 7) {
soundId = 0x1d2;
}
else if (this->_subtype == 0xb) {
soundId = 0x1d3;
}
else {
soundId = 0x44;
}
}
else if (iVar1 == 0x14) {
iVar1 = this->_subtype;
if (((iVar1 == 1) || (iVar1 == 5)) || (iVar1 == 4)) {
soundId = 0xe9;
}
else if ((iVar1 == 2) || (iVar1 == 6)) {
soundId = 0xe7;
}
else {
if ((iVar1 != 3) && (iVar1 != 7)) {
return;
}
soundId = 0xc6;
}
}
else if (iVar1 == 0x1e) {
soundId = 0x3b;
}
else {
if (iVar1 == 0x28) {
if (this->_subtype != 4) {
soundId = 0x28;
goto LAB_006e7d6b;
}
}
else {
if (iVar1 != 0x46) {
if (iVar1 == 0x45) {
soundId = 0x26;
}
else {
soundId = GHIDRA_INT(this);
isChest = IsChest(iVar1);
if (isChest == 0) {
if (extraout_ECX == 300) {
soundId = 0xf9;
}
else if (extraout_ECX == 0x15e) {
if (*GHIDRA_CAST<int *>((extraout_EDX + 0x30)) == 0x7a) {
soundId = 0x386;
}
else {
soundId = 0xf9;
}
}
else if (extraout_ECX == 0x6e) {
soundId = 0x1cf;
}
else if (extraout_ECX == 0x29) {
soundId = 0x28;
}
else {
if (extraout_ECX != 0x2a) {
return;
}
soundId = 0x102;
}
}
else {
soundId = 0x15;
}
}
goto LAB_006e7d6b;
}
if ((this->_subtype & 0x7ffU) != 0xe) {
soundId = 0x26;
goto LAB_006e7d6b;
}
}
soundId = 0x1d2;
}
LAB_006e7d6b:
manager = g_manager;
seed_fart_sound_override(&soundId);
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(soundId,1.0,2,0,1.0,0.0);
return;
}
// 006e7dc0
void Entity_Pickup::PlayPickupSound()
{
byte bVar1;
ItemConfig_Card *cardConfig;
uint uVar2;
int *proceduralItem;
Manager *manager;
bool bVar3;
float fVar4;
int iVar5;
RNG pitchRng;
float local_8;
Game *game;
manager = g_manager;
iVar5 = this->_variant;
if (iVar5 == 10) {
iVar5 = this->_subtype;
if (iVar5 == 4) {
local_8 = 3.72745e-43;
}
else if ((iVar5 == 3) || (iVar5 == 8)) {
local_8 = 7.56701e-44;
}
else if (iVar5 == 6) {
local_8 = 6.55808e-43;
}
else if (iVar5 == 7) {
local_8 = 6.51604e-43;
}
else if (iVar5 == 0xb) {
local_8 = 6.45999e-43;
}
else if (iVar5 == 0xc) {
local_8 = 6.96445e-43;
}
else {
if (iVar5 == 10) {
return;
}
local_8 = 2.5924e-43;
}
LAB_006e8329:
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_8));
iVar5 = 2;
LAB_006e8344:
fVar4 = 1.0;
LAB_006e834c:
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_8),fVar4,iVar5,0,1.0,0.0);
return;
}
if (iVar5 == 0x14) {
iVar5 = this->_subtype;
if (((iVar5 == 1) || (iVar5 == 4)) || (iVar5 == 7)) {
local_8 = 3.27904e-43;
}
else if ((iVar5 == 2) || (iVar5 == 6)) {
local_8 = 3.25101e-43;
}
else if (iVar5 == 3) {
local_8 = 2.78858e-43;
}
else {
if (iVar5 != 5) {
return;
}
local_8 = 2.8026e-43;
}
goto LAB_006e8329;
}
if (iVar5 == 0x1e) {
iVar5 = this->_subtype;
if (((iVar5 == 1) || (iVar5 == 3)) || (iVar5 == 4)) {
local_8 = 8.12753e-44;
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_8));
iVar5 = 2;
fVar4 = 0.85;
goto LAB_006e834c;
}
if (iVar5 != 2) {
return;
}
local_8 = 2.85865e-43;
goto LAB_006e8329;
}
if (iVar5 == 0x28) {
if (this->_subtype == 4) {
local_8 = 6.5861e-43;
}
else {
local_8 = 2.81661e-43;
}
goto LAB_006e8329;
}
if (((iVar5 == 0x46) || (iVar5 == 0x15e)) || (iVar5 == 0x45)) {
LAB_006e8319:
local_8 = 3.53127e-43;
manager = g_manager;
goto LAB_006e8329;
}
if (iVar5 == 300) {
cardConfig = (GHIDRA_CAST<ItemConfig *>((&g_manager->_itemConfig)))->ItemConfig::GetCard(this->_subtype);
if ((cardConfig == GHIDRA_CAST<ItemConfig_Card *>(0x0)) ||
((((iVar5 = cardConfig->pickupSubtype, iVar5 != 3 && (iVar5 != 4)) &&
(((iVar5 != 6 && ((iVar5 != 7 && (iVar5 != 0xd)))) && (iVar5 != 0xf)))) &&
(cardConfig->cardType != 2)))) {
local_8 = 1.12104e-44;
}
else {
local_8 = 3.53127e-43;
}
goto LAB_006e8329;
}
if (iVar5 != 100) {
if (iVar5 != 0x29) {
if (iVar5 == 0x2a) {
uVar2 = Random();
SoundEffects::PlayWithFartOverride
(0x1ca,1.0,2,0,
(float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) *
2.3283064e-10 * 0.3 + 0.9);
return;
}
return;
}
local_8 = 2.81661e-43;
goto LAB_006e8329;
}
bVar1 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::HasEntityFlags(0x40000);
if (bVar1 != 0) goto LAB_006e8319;
uVar2 = this->_subtype;
if (((GHIDRA_INT(uVar2) < 0) && (iVar5 = FUN_009e0180(uVar2), iVar5 != 0)) &&
(*GHIDRA_CAST<int *>((iVar5 + 0xc)) != 0)) {
pitchRng._seed = *GHIDRA_CAST<int *>((iVar5 + 8));
pitchRng._shift1 = 1;
pitchRng._shift2 = 5;
pitchRng._shift3 = 0x10;
fVar4 = (GHIDRA_CAST<RNG *>((&pitchRng)))->RNG::RandomFloat();
local_8 = fVar4 * 1.4 + 0.2;
SoundEffects::PlayWithFartOverride(*GHIDRA_CAST<int *>((iVar5 + 0xc)),1.0,2,0,local_8);
return;
}
game = g_game;
if ((uVar2 != 0xffffffff) ||
(bVar1 = (GHIDRA_CAST<Seeds *>((&g_game->_seedEffects)))->Seeds::HasSeedEffect(0x4f), bVar1 == 0)) {
manager = g_manager;
if (uVar2 < 0x48) {
if ((uVar2 != 0x47) && (uVar2 != 0xb)) {
bVar3 = uVar2 == 0xc;
LAB_006e81cf:
if (!bVar3) {
iVar5 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(game->_room) + 8));
if ((iVar5 == 5) || (iVar5 == 6)) {
local_8 = 1.80768e-43;
}
else if ((iVar5 == 4) || (iVar5 == 0xc)) {
local_8 = 1.79366e-43;
}
else if (iVar5 == 2) {
local_8 = 1.82169e-43;
}
else {
if (((iVar5 == 0xe) || (iVar5 == 0x16)) ||
((*GHIDRA_CAST<uint *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(game->_room) + 4)) + 0x44)) >> 0xb & 1) != 0)) {
local_8 = 4.4281e-43;
goto LAB_006e8329;
}
local_8 = 3.22299e-44;
}
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_8));
iVar5 = 2;
fVar4 = 0.5;
goto LAB_006e834c;
}
}
local_8 = 1.4013e-45;
}
else {
if (uVar2 != 0x5c) {
bVar3 = uVar2 == 0x271;
goto LAB_006e81cf;
}
local_8 = 2.36819e-43;
}
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_8));
iVar5 = 0x1e;
goto LAB_006e8344;
}
iVar5 = PlayerManager::GetGFuelCount();
manager = g_manager;
switch(iVar5) {
case 0:
case 1:
local_8 = 3.75548e-43;
goto LAB_006e8131;
case 2:
case 3:
goto switchD_006e808c_caseD_2;
case 4:
case 5:
local_8 = 1.84971e-43;
break;
default:
local_8 = 1.84971e-43;
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_8));
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_8),1.0,2,0,1.0,0.0);
local_8 = 8.46384e-43;
}
manager = g_manager;
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_8));
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_8),1.0,2,0,1.0,0.0);
switchD_006e808c_caseD_2:
local_8 = 8.43582e-43;
LAB_006e8131:
manager = g_manager;
seed_fart_sound_override(GHIDRA_CAST<int *>(&local_8));
(GHIDRA_CAST<SoundEffects *>((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_8),1.0,2,0,1.0,0.0);
uVar2 = Random();
proceduralItem = GHIDRA_CAST<int *>(FUN_009e0180(this->_subtype));
SimpleString::operator=
(GHIDRA_CAST<SimpleString *>((*proceduralItem + 0x20)),
(&PTR_s_GAMER_SPEED_UP__00b67e58)[uVar2 % 0x32]);
return;
}
// 006e8380
int Entity_Pickup::GetCoinValue()
{
if ((this->_variant == 0x14) && (this->_subtype - 1U < 7)) {
return *GHIDRA_CAST<int *>((&DAT_00b67e34 + this->_subtype * 4));
}
return 0;
}
// 006e83a0
undefined4 Entity_Pickup::can_player_buy(Entity_Player *param_2)
{
byte isInstantDeathCurse;
char isDamageTaken;
int iVar1;
int iVar2;
EntityRef *damageSource;
Entity_Player *this_00;
int extraout_EDX;
code *extraout_EDX_00;
bool isInstantDeathCurse;
bool bVar4;
EntityRef damageSourceRef;
undefined *redHeartCost;
undefined *soulHeartCost;
if (param_2->_isCoopGhost != 0) {
return 0;
}
iVar2 = this->_price;
if (iVar2 < 1) {
if (iVar2 == -10) {
return 0;
}
}
else {
iVar1 = FUN_0041b770(0x209);
if (iVar1 + param_2->_numCoins < iVar2) {
return 0;
}
}
iVar1 = (GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::GetHealthType();
if (iVar1 == 2) {
return 1;
}
isInstantDeathCurse = (GHIDRA_CAST<Entity_Player *>((this_00)))->Entity_Player::HasInstantDeathCurse();
if (isInstantDeathCurse != 0) {
return 1;
}
if (iVar2 + 9U < 9) {
redHeartCost = ReferenceCount<IsaacRepentancePlus::EntitySaveState>::vftable[iVar2 * -2 + 4];
soulHeartCost = ReferenceCount<IsaacRepentancePlus::EntitySaveState>::vftable[iVar2 * -2 + 5];
if ((redHeartCost != GHIDRA_CAST<undefined *>(0x0)) || (soulHeartCost != GHIDRA_CAST<undefined *>(0x0))) {
if ((GHIDRA_INT(soulHeartCost) < 1) || (redHeartCost != GHIDRA_CAST<undefined *>(0x0))) {
if (GHIDRA_INT(redHeartCost) < 1) {
return 1;
}
if (0 < GHIDRA_INT(soulHeartCost)) {
iVar2 = (GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::GetEffectiveMaxHearts();
if (iVar2 < 2) {
return 0;
}
return 1;
}
if (soulHeartCost != GHIDRA_CAST<undefined *>(0x0)) {
return 1;
}
iVar2 = (GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::GetEffectiveMaxHearts();
bVar4 = false;
isInstantDeathCurse = iVar2 == 0;
}
else {
iVar2 = (GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::GetHealthType();
if (iVar2 == 2) {
return 1;
}
iVar1 = param_2->_soulHearts;
bVar4 = SBORROW4(iVar1,extraout_EDX);
iVar2 = iVar1 - extraout_EDX;
isInstantDeathCurse = iVar1 == extraout_EDX;
}
if (isInstantDeathCurse || bVar4 != iVar2 < 0) {
return 0;
}
return 1;
}
}
if (iVar2 == -5) {
damageSource = (GHIDRA_CAST<EntityRef *>((&damageSourceRef)))->EntityRef::EntityRef();
isDamageTaken = (*extraout_EDX_00)(0x40000000,0x10002080,0,damageSource,0x1e);
if (isDamageTaken == '\0') {
return 0;
}
}
return 1;
}
// 006e84d0
void Entity_Pickup::CollectTrinket(Entity_Player *param_2, uint param_3)
{
byte bVar1;
uint uVar2;
int maxHeartsTaken;
Entity_Pickup *otherPickup;
Entity_Player *restockOwner;
Entity_Player *room;
void *rngEnd;
int iVar3;
uint uVar4;
int iVar5;
EntityRef damageSource;
EntityList_EL entities;
Vector poofPos;
float local_20;
float local_1c;
Entity_Pickup *savedThis;
char isStage11Normal;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
bool isFreeDeal;
bool isRemoveOtherDeals;
Entity_Pickup *pickup;
void *rngBegin;
Room *room;
local_8 = 0xffffffff;
puStack_c = &LAB_00afb1c5;
local_10 = ExceptionList;
uVar2 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
ExceptionList = &local_10;
savedThis = this;
if ((param_3 == 0) && (param_3 = this->_price, param_3 == 0)) goto LAB_006e89de;
(GHIDRA_CAST<ANM2 *>((&this->_priceANM2)))->ANM2::Reset();
if (0 < GHIDRA_INT(param_3)) {
EntityList::QuerySublist(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),&entities,3,0xce,0x209,0,0)
;
uVar4 = 0;
local_8 = 0;
if (param_3 != 0) {
do {
if (GHIDRA_UINT(entities._size) <= uVar4) break;
damageSource._type = 0;
damageSource._variant = 0;
damageSource._spawnerType = 0;
damageSource._position.y = g_vectorZero.y;
damageSource._velocity.y = g_vectorZero.y;
damageSource._spawnerVariant = 0;
damageSource._position.x = g_vectorZero.x;
damageSource._velocity.x = g_vectorZero.x;
damageSource._flags = 0;
damageSource._entity = (void *)0x0;
(**(code **)(**GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(entities._data) + uVar4 * 4)) + 0x24))(&damageSource,uVar2);
uVar4 = uVar4 + 1;
} while (uVar4 < param_3);
}
entities._size = param_3 - entities._size;
param_3 = 0;
if (0 < entities._size) {
param_3 = entities._size;
}
if ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(entities)) + 0x0))) == '\0') {
local_8 = 1;
tracked_alloc(1,entities._data,0);
}
local_8 = 0xffffffff;
(GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::AddCoins(-param_3);
FUN_007d8630(param_3);
Player_stats_add(&g_game->_onlinePlayerStats,0xd,param_2,(float)GHIDRA_INT(param_3));
goto LAB_006e89de;
}
iVar5 = (GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::GetHealthType();
if ((iVar5 == 2) || (bVar1 = (GHIDRA_CAST<Entity_Player *>((room)))->Entity_Player::HasInstantDeathCurse(), bVar1 != 0)) {
isFreeDeal = true;
}
else {
isFreeDeal = false;
}
isRemoveOtherDeals = false;
switch(param_3) {
case 0xfffffff7:
if (isFreeDeal) {
isRemoveOtherDeals = true;
}
else {
(GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::AddMaxHearts(-2,0);
LAB_006e873c:
(GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::AddSoulHearts(-2,0);
}
break;
case 0xfffffff8:
if (isFreeDeal) {
isRemoveOtherDeals = true;
}
else {
LAB_006e8700:
(GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::AddSoulHearts(-4,0);
}
break;
case 0xfffffff9:
if (!isFreeDeal) goto LAB_006e873c;
isRemoveOtherDeals = true;
break;
case 0xfffffffa:
local_1c = 1.0;
iVar5 = (GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::GetTrinketMultiplier(0xad);
if (iVar5 == 2) {
local_1c = 0.9;
}
else if (iVar5 == 3) {
local_1c = 0.8;
}
rngEnd = (param_2->_trinketRNGs)._end;
if (GHIDRA_INT(rngEnd) - GHIDRA_INT((param_2->_trinketRNGs)._begin) >> 4 < 0xae) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("Trinket ID out of bounds!\n"));
rngEnd = (param_2->_trinketRNGs)._end;
}
rngBegin = (param_2->_trinketRNGs)._begin;
uVar2 = (GHIDRA_INT(rngEnd) - GHIDRA_INT(rngBegin) >> 4) - 1;
if (0xad < uVar2) {
uVar2 = 0xad;
}
local_20 = (GHIDRA_CAST<RNG *>((GHIDRA_CAST<RNG *>((uVar2 * 0x10 + GHIDRA_INT(rngBegin))))))->RNG::RandomFloat();
isRemoveOtherDeals = isFreeDeal;
if (local_20 <= local_1c) {
(GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::TryRemoveTrinket(0xad);
}
break;
case 0xfffffffb:
isRemoveOtherDeals = false;
if (isFreeDeal) {
isRemoveOtherDeals = true;
}
break;
case 0xfffffffc:
if (!isFreeDeal) {
(GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::AddMaxHearts(-2,0);
goto LAB_006e8700;
}
isRemoveOtherDeals = true;
break;
case 0xfffffffd:
if (isFreeDeal) {
isRemoveOtherDeals = true;
}
else {
iVar3 = (param_2->_soulHearts + 1) / 2;
iVar5 = 3;
if (iVar3 < 3) {
iVar5 = iVar3;
}
maxHeartsTaken = 0;
if (0 < 3 - iVar3) {
maxHeartsTaken = 3 - iVar3;
}
(GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::AddMaxHearts(maxHeartsTaken * -2,0);
(GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::AddSoulHearts(iVar5 * -2,0);
}
break;
case 0xfffffffe:
if (isFreeDeal) {
isRemoveOtherDeals = true;
}
else {
(GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::AddMaxHearts(-4,0);
}
break;
case 0xffffffff:
if (isFreeDeal) {
isRemoveOtherDeals = true;
}
else {
(GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::AddMaxHearts(-2,0);
}
}
damageSource._position.y = g_vectorZero.y;
damageSource._velocity.y = g_vectorZero.y;
damageSource._position.x = g_vectorZero.x;
damageSource._velocity.x = g_vectorZero.x;
damageSource._type = 0;
damageSource._variant = 0;
damageSource._spawnerType = 0;
damageSource._spawnerVariant = 0;
damageSource._flags = 0;
damageSource._entity = (void *)0x0;
(GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::set_last_damage(0x400,&damageSource);
if (isRemoveOtherDeals) {
if (((g_game->_difficulty == 2) || (g_game->_difficulty == 3)) ||
(isStage11Normal = '\x01', g_game->_stage != 0xb)) {
isStage11Normal = '\0';
}
local_1c = (float)g_game->_startingRoomIdx;
local_20 = (float)g_game->_currentRoomIdx;
EntityList::QuerySublist(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),&entities,5,-1,-1,0,0);
pickup = savedThis;
uVar2 = 0;
local_8 = 2;
if (entities._size != 0) {
do {
otherPickup = (Entity_Pickup *)
__RTDynamicCast(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(entities._data) + uVar2 * 4)),0,
&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor,
&IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor,0);
if (((otherPickup != GHIDRA_CAST<Entity_Pickup *>(0x0)) && (otherPickup != pickup)) &&
(((otherPickup->_variant == 100 &&
((otherPickup->_subtype != 0 && (otherPickup->_price < 0)))) ||
((isStage11Normal != '\0' &&
((local_1c == local_20 && (otherPickup->_variant == 0x168)))))))) {
uVar4 = Random();
poofPos.x = (otherPickup->_pos).x + 0.0;
poofPos.y = (otherPickup->_pos).y + 10.0;
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0xf,&poofPos,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar4);
otherPickup->_timeout = 4;
}
uVar2 = uVar2 + 1;
} while (uVar2 < GHIDRA_UINT(entities._size));
}
local_8 = 0xffffffff;
if ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(entities)) + 0x0))) == '\0') {
local_8 = 3;
tracked_alloc(1,entities._data,0);
local_8 = 0xffffffff;
}
}
bVar1 = (GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::CanPickupItem();
if ((bVar1 != 0) && (bVar1 = (GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::IsHoldingItem(), bVar1 == 0)) {
(GHIDRA_CAST<Entity_Player *>((param_2)))->Entity_Player::try_trigger_astral_projection();
}
LAB_006e89de:
pickup = savedThis;
if ((((savedThis->_variant != 100) && (param_3 != 0)) &&
((restockOwner = PlayerManager::FirstCollectibleOwner
(&g_game->_playerManager,0x178,GHIDRA_CAST<RNG **>(&g_game->_playerManager),1),
restockOwner != GHIDRA_CAST<Entity_Player *>(0x0) ||
((g_game->_difficulty == 2 || (g_game->_difficulty == 3)))))) &&
(room = g_game->_room, room->_roomType == 2)) {
iVar5 = GHIDRA_INT((((pickup->_pos).x - 40.0) / 40.0 + 0.5));
iVar3 = GHIDRA_INT((((pickup->_pos).y - 120.0) / 40.0 + 0.5));
if ((((iVar5 < 0) || (room->_gridWidth <= iVar5)) || (iVar3 < 0)) ||
(room->_gridHeight <= iVar3)) {
iVar5 = -1;
}
else {
iVar5 = room->_gridWidth * iVar3 + iVar5;
}
(GHIDRA_CAST<Room *>((room)))->Room::TriggerRestock(iVar5,pickup->_shopItemId);
}
ExceptionList = local_10;
return;
}
// 006ed580
byte Entity_Pickup::empty_pedestal()
{
byte isAnimSet;
LayerState *shadowLayer;
if (this->_variant == 100) {
if (this->_subtype != 0) {
this->_subtype = 0;
if (this->_price == 0) {
isAnimSet = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST<byte *>("Empty"),1);
if ((isAnimSet != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) {
(GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::SetFrameFloat(0.0);
if ((this->_sprite)._animState._animData != (void *)0x0) {
(this->_sprite)._animState._isPlaying = 0;
}
}
}
else {
if ((this->_flipSaveState == 0) || ((this->_altPedestalANM2)._loaded == 0)) {
this->Remove();
return 1;
}
update_price_sprite(this,0);
SetAlternatePedestal(this,0);
(GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::SetFrame(GHIDRA_CAST<std_string *>("Empty"),0);
isAnimSet = (GHIDRA_CAST<ANM2 *>((&this->_altPedestalANM2)))->ANM2::SetAnimation(s_Idle,1);
if (isAnimSet != 0) {
(GHIDRA_CAST<AnimationState *>((&(this->_altPedestalANM2)._animState)))->AnimationState::Rewind();
(this->_altPedestalANM2)._animState._isPlaying = 1;
}
}
shadowLayer = (GHIDRA_CAST<ANM2 *>((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST<byte *>("itemshadow"));
if (shadowLayer != GHIDRA_CAST<LayerState *>(0x0)) {
shadowLayer->_visible = 0;
}
return 1;
}
}
else if (this->_variant == 0x6e) {
this->Remove();
return 1;
}
return 0;
}
// 006ed690
void Entity_Pickup::update_magnet_attraction()
{
byte bVar1;
byte isCanCollect;
Entity_Player *pEVar2;
int iVar3;
int iVar4;
int *playerSlot;
int extraout_ECX;
undefined4 *playerEntry;
uint uVar5;
PlayerManager *playerManager;
bool bVar6;
bool bVar7;
bool bVar8;
float fVar9;
float fVar10;
float fVar11;
Entity_Player *closestPlayer;
float closestDistSq;
uint playerIndex;
Game *game;
void *listEnd;
if (this->_variant == 0x29) {
return;
}
pEVar2 = PlayerManager::FirstCollectibleOwner
(&g_game->_playerManager,0x35,GHIDRA_CAST<RNG **>(&g_game->_playerManager),1);
if (((pEVar2 == GHIDRA_CAST<Entity_Player *>(0x0)) &&
(bVar1 = (GHIDRA_CAST<PlayerManager *>((&g_game->_playerManager)))->PlayerManager::AnyoneHasTrinket(0x44), bVar1 == 0)) &&
(bVar1 = (GHIDRA_CAST<PlayerManager *>((&g_game->_playerManager)))->PlayerManager::AnyoneHasTrinket(6), bVar1 == 0)) {
if (this->_entityGridCollisionClass == 3) {
this->_entityGridCollisionClass = 5;
}
}
else {
(GHIDRA_CAST<PlayerManager *>((&g_game->_playerManager)))->PlayerManager::GetTrinketMultiplier(0x44);
if ((((this->_price == 0) || (iVar3 = this->_variant, iVar3 == 0x1e)) ||
((iVar3 == 0x28 || ((iVar3 == 0x14 || (iVar3 == 10)))))) || (iVar3 == 0x5a)) {
playerManager = &g_game->_playerManager;
closestDistSq = 1e+09;
closestPlayer = GHIDRA_CAST<Entity_Player *>(0x0);
playerIndex = 0;
if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin)
>> 2 != 0) {
LAB_006ed780:
listEnd = (playerManager->_playerList)._end;
playerEntry = (playerManager->_playerList)._begin;
if (GHIDRA_INT(listEnd) - GHIDRA_INT(playerEntry) >> 2 == 0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("(GHIDRA_CAST<PlayerManager *>(()))->PlayerManager::GetPlayer() : There are no players! \n"));
listEnd = (playerManager->_playerList)._end;
playerEntry = (playerManager->_playerList)._begin;
}
if (playerIndex < GHIDRA_UINT((GHIDRA_INT(listEnd) - GHIDRA_INT(playerEntry) >> 2))) {
playerEntry = playerEntry + playerIndex;
}
pEVar2 = GHIDRA_CAST<Entity_Player *>(*playerEntry);
bVar1 = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::HasCollectible(0x35,0);
if ((bVar1 == 0) && (iVar3 = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::GetTrinketMultiplier(6), iVar3 < 2)) {
bVar6 = false;
}
else {
bVar6 = true;
}
bVar1 = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::HasCollectible(0x35,0);
if ((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((pEVar2)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((pEVar2)) + 0x2ef8)))) != 6)) {
iVar3 = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::GetTrinketMultiplier(6);
bVar7 = false;
bVar8 = iVar3 == 0;
LAB_006ed81f:
bVar8 = !bVar8 && bVar7 == iVar3 < 0;
}
else {
if ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((pEVar2)) + 0x2ef0))) == '\0') {
iVar4 = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::GetTrinketMultiplier(6);
bVar7 = SBORROW4(iVar4,1);
iVar3 = iVar4 + -1;
bVar8 = iVar4 == 1;
goto LAB_006ed81f;
}
bVar8 = true;
}
if (pEVar2->_variant == 0) {
if (bVar6) {
LAB_006ed878:
if (this->_price == 0) {
uVar5 = this->_variant;
if (uVar5 < 0x15f) {
if (uVar5 == 0x15e) {
LAB_006ed91d:
iVar4 = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::GetTrinketMultiplier(0x44);
bVar8 = SBORROW4(iVar4,1);
iVar3 = iVar4 + -1;
bVar6 = iVar4 == 1;
code_r0x006ed929:
isCanCollect = !bVar6 && bVar8 == iVar3 < 0;
goto LAB_006ed92c;
}
switch(uVar5) {
case 10:
goto code_r0x006ed8b3;
default:
break;
case 0x14:
case 0x1e:
case 0x28:
goto LAB_006ed930;
case 0x32:
case 0x34:
case 0x35:
case 0x36:
case 0x37:
case 0x38:
case 0x39:
case 0x3a:
case 0x3c:
iVar4 = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::GetTrinketMultiplier(0x44);
bVar8 = SBORROW4(iVar4,2);
iVar3 = iVar4 + -2;
bVar6 = iVar4 == 2;
goto code_r0x006ed929;
case 0x45:
goto LAB_006ed91d;
case 0x5a:
isCanCollect = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::NeedsCharge(0);
goto LAB_006ed92c;
}
}
}
}
else {
if ((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((pEVar2)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((pEVar2)) + 0x2ef8)))) != 0x44)) {
iVar3 = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::GetTrinketMultiplier(0x44);
bVar7 = false;
bVar6 = iVar3 == 0;
}
else {
if ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((pEVar2)) + 0x2ef0))) != '\0') goto LAB_006ed878;
iVar4 = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::GetTrinketMultiplier(0x44);
bVar7 = SBORROW4(iVar4,1);
iVar3 = iVar4 + -1;
bVar6 = iVar4 == 1;
}
if ((!bVar6 && bVar7 == iVar3 < 0) || ((bVar8 && (this->_variant == 0x14))))
goto LAB_006ed878;
}
goto LAB_006ed989;
}
goto LAB_006eda62;
}
}
}
LAB_006edb53:
if ((this->_price == 0) && (this->_variant == 0x14)) {
uVar5 = 1;
playerManager = &g_game->_playerManager;
if (1 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
GHIDRA_INT((playerManager->_playerList)._begin) >> 2))) {
do {
listEnd = (playerManager->_playerList)._end;
if (GHIDRA_INT(listEnd) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("(GHIDRA_CAST<PlayerManager *>(()))->PlayerManager::GetPlayer() : There are no players! \n"));
listEnd = (playerManager->_playerList)._end;
}
game = g_game;
playerSlot = (playerManager->_playerList)._begin;
if (uVar5 < GHIDRA_UINT((GHIDRA_INT(listEnd) - GHIDRA_INT(playerSlot) >> 2))) {
playerSlot = playerSlot + uVar5;
}
if (*GHIDRA_CAST<int *>((*playerSlot + 0x1aec)) == 0x12) {
listEnd = (g_game->_playerManager)._playerList._end;
playerSlot = (g_game->_playerManager)._playerList._begin;
if (GHIDRA_INT(listEnd) - GHIDRA_INT(playerSlot) >> 2 == 0) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("(GHIDRA_CAST<PlayerManager *>(()))->PlayerManager::GetPlayer() : There are no players! \n"));
listEnd = (game->_playerManager)._playerList._end;
playerSlot = (game->_playerManager)._playerList._begin;
}
if (uVar5 < GHIDRA_UINT((GHIDRA_INT(listEnd) - GHIDRA_INT(playerSlot) >> 2))) {
playerSlot = playerSlot + uVar5;
}
fVar10 = *GHIDRA_CAST<float *>((*playerSlot + 0x33c)) - (this->_pos).x;
fVar11 = *GHIDRA_CAST<float *>((*playerSlot + 0x340)) - (this->_pos).y;
fVar9 = sqrtf(fVar10 * fVar10 + fVar11 * fVar11);
if (0.0 < fVar9) {
fVar11 = (1.0 / fVar9) * fVar11;
fVar10 = (1.0 / fVar9) * fVar10;
}
this->_entityGridCollisionClass = 3;
(this->_velocity).x = (fVar10 * 0.5 + (this->_velocity).x) * 0.8;
(this->_velocity).y = (fVar11 * 0.5 + (this->_velocity).y) * 0.8;
}
uVar5 = uVar5 + 1;
playerManager = &g_game->_playerManager;
} while (uVar5 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
GHIDRA_INT((playerManager->_playerList)._begin) >> 2)));
}
}
return;
code_r0x006ed8b3:
switch(this->_subtype) {
case 1:
case 2:
case 5:
case 9:
isCanCollect = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::CanPickRedHearts();
break;
case 3:
case 8:
LAB_006ed8d7:
isCanCollect = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::CanPickSoulHearts();
break;
default:
goto LAB_006ed930;
case 6:
isCanCollect = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::CanPickBlackHearts();
break;
case 7:
isCanCollect = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::CanPickGoldenHearts();
break;
case 10:
isCanCollect = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::CanPickRedHearts();
if (isCanCollect == 0) goto LAB_006ed8d7;
goto LAB_006ed930;
case 0xb:
isCanCollect = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::CanPickBoneHearts();
break;
case 0xc:
isCanCollect = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::CanPickRottenHearts();
}
LAB_006ed92c:
if (isCanCollect == 0) {
LAB_006ed989:
if ((((pEVar2->_variant == 0) && (bVar1 != 0)) && (bVar1 = IsChest(this->_variant), bVar1 != 0))
&& (this->_subtype != 0)) {
if (((extraout_ECX != 0x32) && (extraout_ECX != 0x38)) &&
((extraout_ECX != 0x168 && ((extraout_ECX != 0x34 && (extraout_ECX != 0x36)))))) {
if ((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((pEVar2)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((pEVar2)) + 0x2ef8)))) != 0x13)) {
iVar3 = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::GetTrinketMultiplier(0x13);
bVar8 = false;
bVar6 = iVar3 == 0;
LAB_006eda04:
if (bVar6 || bVar8 != iVar3 < 0) goto LAB_006eda62;
}
else if ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((pEVar2)) + 0x2ef0))) == '\0') {
iVar4 = (GHIDRA_CAST<Entity_Player *>((pEVar2)))->Entity_Player::GetTrinketMultiplier(0x13);
bVar8 = SBORROW4(iVar4,1);
iVar3 = iVar4 + -1;
bVar6 = iVar4 == 1;
goto LAB_006eda04;
}
iVar3 = this->_variant;
if (((iVar3 != 0x3c) && (iVar3 != 0x35)) && (iVar3 != 0x37)) goto LAB_006eda62;
}
fVar10 = (this->_pos).x - (pEVar2->_pos).x;
fVar9 = (this->_pos).y - (pEVar2->_pos).y;
if (fVar9 * fVar9 + fVar10 * fVar10 < 6400.0) {
TryOpenChest(this,pEVar2);
}
}
}
else {
LAB_006ed930:
fVar9 = (this->_pos).x - (pEVar2->_pos).x;
fVar10 = (this->_pos).y - (pEVar2->_pos).y;
fVar9 = fVar10 * fVar10 + fVar9 * fVar9;
if (fVar9 < closestDistSq) {
closestPlayer = pEVar2;
closestDistSq = fVar9;
}
}
LAB_006eda62:
playerManager = &g_game->_playerManager;
playerIndex = playerIndex + 1;
if (GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
GHIDRA_INT((playerManager->_playerList)._begin) >> 2)) <= playerIndex) goto code_r0x006eda8d;
goto LAB_006ed780;
code_r0x006eda8d:
if (closestPlayer != GHIDRA_CAST<Entity_Player *>(0x0)) {
fVar10 = (closestPlayer->_pos).x - (this->_pos).x;
fVar11 = (closestPlayer->_pos).y - (this->_pos).y;
fVar9 = sqrtf(fVar10 * fVar10 + fVar11 * fVar11);
if (0.0 < fVar9) {
fVar11 = (1.0 / fVar9) * fVar11;
fVar10 = (1.0 / fVar9) * fVar10;
}
(this->_velocity).x = (fVar10 * 0.5 + (this->_velocity).x) * 0.8;
(this->_velocity).y = (fVar11 * 0.5 + (this->_velocity).y) * 0.8;
this->_entityGridCollisionClass = 3;
}
goto LAB_006edb53;
}
// 006edfa0
void Entity_Pickup::update_cycle_collectible(byte isForce)
{
byte bVar1;
int frequency;
double dVar2;
int animFrame;
int rotatedState [4];
int iStack_34;
int local_30;
int iStack_2c;
int iStack_28;
int iStack_24;
uint local_14;
void *animData;
uint cycleCount;
local_14 = __security_cookie ^ GHIDRA_UINT(&animFrame);
cycleCount = this->_cycleCollectibleCount;
if (cycleCount == 0) {
return;
}
frequency = (-GHIDRA_UINT((cycleCount < 4)) & 0x18) + 6;
if (7 < cycleCount) {
frequency = 1;
}
if (this->_subtype == 0) {
this->_cycleCollectibleCount = 0;
return;
}
if ((isForce == 0) &&
(((g_game->_frameCount - this->_spawnFrame < 1 ||
(bVar1 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::IsFrame(frequency,0), bVar1 == 0)) &&
(bVar1 = (GHIDRA_CAST<Game *>((g_game)))->Game::IsPaused(), bVar1 == 0)))) {
return;
}
memcpy(rotatedState + 1,this->_cycleCollectibleList + 1,cycleCount * 4 - 4);
animData = (this->_sprite)._animState._animData;
rotatedState[cycleCount] = this->_subtype;
rotatedState[0] = this->_wait;
if (animData == (void *)0x0) {
animFrame = -1;
}
else {
dVar2 = floor((double)(this->_sprite)._animState._animFrame);
animFrame = GHIDRA_INT(dVar2);
}
Morph(this,this->_type,this->_variant,this->_cycleCollectibleList[0],1,1,1);
if ((this->_sprite)._animState._animData != (void *)0x0) {
(GHIDRA_CAST<AnimationState *>((&(this->_sprite)._animState)))->AnimationState::SetFrameFloat((float)animFrame);
}
this->_wait = rotatedState[0];
this->_cycleCollectibleList[0] = rotatedState[1];
this->_cycleCollectibleList[1] = rotatedState[2];
this->_cycleCollectibleList[2] = rotatedState[3];
this->_cycleCollectibleList[3] = iStack_34;
this->_cycleCollectibleCount = cycleCount;
this->_cycleCollectibleList[4] = local_30;
this->_cycleCollectibleList[5] = iStack_2c;
this->_cycleCollectibleList[6] = iStack_28;
this->_cycleCollectibleList[7] = iStack_24;
return;
}
// 006ee110
void Entity_Pickup::Remove()
{
if (this->_pickupGhost != GHIDRA_CAST<int *>(0x0)) {
(**(code **)(*GHIDRA_CAST<int *>(this->_pickupGhost) + 0x28))();
}
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::Remove();
return;
}
// 006ee130
void Entity_Pickup::ClearReferences()
{
Entity_Pickup *eraseKey;
void **ghostRef;
ghostRef = &this->_pickupGhost;
eraseKey = this;
if (this->_pickupGhost != GHIDRA_CAST<int *>(0x0)) {
(**(code **)(*GHIDRA_CAST<int *>(this->_pickupGhost) + 0x28))();
}
if (this->_unkEntityRef != (EntityPtr)0x0) {
eraseKey = GHIDRA_CAST<Entity_Pickup *>(&this->_unkEntityRef);
std::multiset<unsigned_int>::erase(&eraseKey);
this->_unkEntityRef = (EntityPtr)0x0;
}
if (*ghostRef != (void *)0x0) {
eraseKey = GHIDRA_CAST<Entity_Pickup *>(ghostRef);
std::multiset<unsigned_int>::erase(&eraseKey);
*ghostRef = (void *)0x0;
}
if (this->_megaChestCollectible[0] != (void *)0x0) {
eraseKey = GHIDRA_CAST<Entity_Pickup *>(this->_megaChestCollectible);
std::multiset<unsigned_int>::erase(&eraseKey);
this->_megaChestCollectible[0] = (void *)0x0;
}
if (this->_megaChestCollectible[1] != (void *)0x0) {
eraseKey = GHIDRA_CAST<Entity_Pickup *>((this->_megaChestCollectible + 1));
std::multiset<unsigned_int>::erase(&eraseKey);
*GHIDRA_CAST<undefined4 *>((this->_megaChestCollectible + 1)) = 0;
}
(GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(this))))->Entity::ClearReferences();
return;
}
// 006ee200
byte Entity_Pickup::CanReroll()
{
int subType;
int variant;
byte bVar1;
if (this->_dead == 0) {
subType = this->_subtype;
variant = this->_variant;
bVar1 = CanRerollVariant(variant,subType);
if (bVar1 != 0) {
bVar1 = IsChest(variant);
if ((bVar1 == 0) || (subType != 0)) {
return 1;
}
}
}
return 0;
}
// 006ee240
byte Entity_Pickup::CanRerollVariant(int variant, int subType)
{
byte isSeedEffectActive;
char isChallengeOrDaily;
ChallengeParam *challengeParams;
Game *this;
Game *this_00;
Game *this_01;
bool isBlocked;
Game *game;
game = g_game;
if (((((variant != 0x17c) && (variant != 0x172)) && (variant != 0x154)) &&
((variant != 0x29 && (variant != 0x186)))) && ((variant != 100 || (subType != 0x29c)))) {
isSeedEffectActive = (GHIDRA_CAST<Seeds *>((&g_game->_seedEffects)))->Seeds::HasSeedEffect(0x4f);
if (variant != 100) {
return 1;
}
if ((isSeedEffectActive != 0) && (subType == -1)) {
return 0;
}
if (subType == 0x272) {
isChallengeOrDaily = (GHIDRA_CAST<Game *>((game)))->Game::IsChallengeOrDaily();
if (isChallengeOrDaily == '\0') {
return 1;
}
challengeParams = this->Game::GetChallengeParams();
isBlocked = challengeParams->_pathType == 2;
}
else if (subType == 0x273) {
isChallengeOrDaily = (GHIDRA_CAST<Game *>((game)))->Game::IsChallengeOrDaily();
if (isChallengeOrDaily == '\0') {
return 1;
}
challengeParams = (GHIDRA_CAST<Game *>((this_00)))->Game::GetChallengeParams();
isBlocked = challengeParams->_pathType == 2;
}
else {
if ((subType != 0x147) && (subType != 0x148)) {
return 1;
}
isChallengeOrDaily = (GHIDRA_CAST<Game *>((game)))->Game::IsChallengeOrDaily();
if (isChallengeOrDaily == '\0') {
return 1;
}
challengeParams = (GHIDRA_CAST<Game *>((this_01)))->Game::GetChallengeParams();
if (challengeParams->_pathType == 3) {
return 0;
}
isBlocked = challengeParams->_endStage == 0xc;
}
if (!isBlocked) {
return 1;
}
}
return 0;
}
// 006ee340
byte Entity_Pickup::IsChest(int variant)
{
if (((((variant == 0x32) || (variant == 0x3c)) || (variant == 0x168)) ||
((((variant == 0x33 || (variant == 0x35)) ||
((variant == 0x34 || ((variant == 0x36 || (variant == 0x186)))))) || (variant == 0x37)))) ||
(((variant == 0x38 || (variant == 0x39)) || (variant == 0x3a)))) {
return 1;
}
return 0;
}
// 006ee390
byte Entity_Pickup::CanBePickedUp(byte ignorePrice)
{
int variant;
variant = this->_variant;
if ((((((((variant == 10) || (variant == 0x14)) || (variant == 0x5a)) ||
((variant == 0x28 || (variant == 0x1e)))) ||
((variant == 0x46 || ((variant == 300 || (variant == 0x15e)))))) || (variant == 0x45)) ||
((variant == 0x29 || (variant == 0x2a)))) && ((ignorePrice != 0 || (this->_price == 0)))) {
return 1;
}
return 0;
}
// 006ee3f0
byte Entity_Pickup::CanJeraDuplicate()
{
int variant;
byte bVar1;
if ((((this->_dead == 0) && (variant = this->_variant, variant != 100)) && (variant != 0x15e)) &&
((variant != 300 || (this->_subtype != 0x21)))) {
bVar1 = CanReroll(this);
if (bVar1 != 0) {
bVar1 = IsChest(variant);
if ((bVar1 == 0) || (this->_subtype != 0)) {
return 1;
}
}
}
return 0;
}
// 006ee750
void Entity_Pickup::RemoveOtherOptions()
{
int *piVar1;
qword qVar2;
uint uVar3;
uint uVar4;
void *listData;
Entity_Pickup *in_ECX;
qword *heapCounter;
uint i;
EntityList_EL collectibles;
undefined1 local_28 [12];
float local_1c;
Vector local_18;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
Entity_Pickup *other;
Game *game;
game = g_game;
local_8 = 0xffffffff;
puStack_c = &LAB_00afb275;
local_10 = ExceptionList;
uVar3 = __security_cookie ^ GHIDRA_UINT((local_28 + 0x24));
ExceptionList = &local_10;
if (in_ECX->_optionsPickupIndex != 0) {
if ((((in_ECX->_optionsPickupIndex == 1) && (in_ECX->_variant == 100)) &&
(g_game->_currentDimensionIdx == 2)) && (g_game->_deathCertificateExitTimer < 1)) {
g_game->_deathCertificateExitTimer = 0x5a;
}
EntityList::QuerySublist
(GHIDRA_CAST<EntityList *>((GHIDRA_INT(game->_room) + 0x1218)),GHIDRA_CAST<EntityList_EL *>(local_28),5,-1,-1,0,0);
i = 0;
local_8 = 0;
if (local_1c != 0.0) {
listData = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)local_28)) + 0x4)));
do {
other = *GHIDRA_CAST<Entity_Pickup **>((GHIDRA_CAST<char *>(listData) + i * 4));
if ((other != GHIDRA_CAST<Entity_Pickup *>(0x0)) && (other->_type == 5)) {
if (((other->_optionsPickupIndex == in_ECX->_optionsPickupIndex) && (other != in_ECX)) &&
((other->_variant != 100 || (other->_subtype != 0)))) {
uVar4 = Random();
local_18.x = (other->_pos).x + 0.0;
local_18.y = (other->_pos).y + 10.0;
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0xf,&local_18,&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar4);
if (other->_variant == 100) {
other->_timeout = 4;
}
else {
other->Remove(uVar3);
}
}
listData = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)local_28)) + 0x4)));
}
i = i + 1;
} while (i < GHIDRA_UINT(local_1c));
}
local_8 = 0xffffffff;
in_ECX->_optionsPickupIndex = 0;
if (local_28[0] == '\0') {
if (g_mainHeap == (void *)0x0) {
heapCounter = &g_allocatedBytesNoHeap;
}
else {
heapCounter = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
if ((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&((void *)local_28)) + 0x4))) != (void *)0x0) {
uVar3 = *GHIDRA_CAST<uint *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_28)) + 0x4))) + -4));
qVar2 = *heapCounter;
*GHIDRA_CAST<uint *>(heapCounter) = GHIDRA_UINT(*heapCounter) - uVar3;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(heapCounter) + 4)) =
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(heapCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < uVar3));
free(GHIDRA_CAST<uint *>(((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_28)) + 0x4))) + -4)));
}
}
}
local_8 = 0xffffffff;
if (((in_ECX->_variant == 100) && (g_game->_currentRoomIdx == -0xc)) &&
((in_ECX->_flags & 0x40000) != 0)) {
local_18.y = (float)g_game->_room;
EntityList::QuerySublist(GHIDRA_CAST<EntityList *>((GHIDRA_INT(local_18.y) + 0x1218)),&collectibles,5,100,-1,0,0);
local_8 = 2;
uVar4 = 0;
uVar3 = collectibles._size;
if (collectibles._size != 0) {
do {
piVar1 = *GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(collectibles._data) + uVar4 * 4));
if (((piVar1 != GHIDRA_CAST<int *>(0x0)) && (piVar1[10] == 5)) && ((piVar1[0x5a] & 0x40000U) != 0)) {
uVar3 = Random();
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_28)) + 0x8))) = (float)piVar1[0xcf] + 0.0;
local_1c = (float)piVar1[0xd0] + 10.0;
(GHIDRA_CAST<Game *>((g_game)))->Game::Spawn(1000,0xf,GHIDRA_CAST<Vector *>((local_28 + 8)),&g_vectorZero,GHIDRA_CAST<Entity *>(0x0),0,uVar3);
(**(code **)(*piVar1 + 0x28))();
uVar3 = collectibles._size;
}
uVar4 = uVar4 + 1;
} while (uVar4 < uVar3);
}
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(local_18.y) + 0x7764)) = 10;
if ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(collectibles)) + 0x0))) == '\0') {
if (g_mainHeap == (void *)0x0) {
heapCounter = &g_allocatedBytesNoHeap;
}
else {
heapCounter = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
if (collectibles._data != (void *)0x0) {
uVar3 = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(collectibles._data) + -4));
qVar2 = *heapCounter;
*GHIDRA_CAST<uint *>(heapCounter) = GHIDRA_UINT(*heapCounter) - uVar3;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(heapCounter) + 4)) =
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(heapCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < uVar3));
free((void *)(GHIDRA_INT(collectibles._data) + -4));
}
}
}
ExceptionList = local_10;
return;
}
// 006eea30
void Entity_Pickup::MakeShopItem(int shopId)
{
int price;
Game *game;
game = g_game;
if (this->_price == 0) {
this->_shopItemId = shopId;
price = Room::GetShopItemPrice
(game->_room,this->_variant,this->_subtype,shopId,GHIDRA_CAST<Entity_Player *>(0x0));
this->_price = price;
price = _Room::ResolveHeartSubType(0xffffffff,price,0);
this->_price = price;
update_price_sprite(this,price);
}
return;
}
// 006eed30
int Entity_Pickup::AssignOptionsIndex()
{
qword *heapAllocatedBytes;
uint uVar1;
int maxIndex;
EntityList_EL local_20;
void *local_10;
undefined1 *puStack_c;
undefined4 uStack_8;
qword oldAllocatedBytes;
Entity_Pickup *pickup;
uStack_8 = 0xffffffff;
puStack_c = &LAB_00af3860;
local_10 = ExceptionList;
ExceptionList = &local_10;
maxIndex = 2;
EntityList::QuerySublist(GHIDRA_CAST<EntityList *>((GHIDRA_INT(g_game->_room) + 0x1218)),&local_20,5,-1,-1,0,0);
uVar1 = 0;
if (local_20._size != 0) {
do {
pickup = *GHIDRA_CAST<Entity_Pickup **>((GHIDRA_CAST<char *>(local_20._data) + uVar1 * 4));
if ((((pickup != GHIDRA_CAST<Entity_Pickup *>(0x0)) && (pickup->_type == 5)) && (pickup != this)) &&
(maxIndex < pickup->_optionsPickupIndex)) {
maxIndex = pickup->_optionsPickupIndex;
}
uVar1 = uVar1 + 1;
} while (uVar1 < GHIDRA_UINT(local_20._size));
}
this->_optionsPickupIndex = maxIndex + 1;
if ((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_20)) + 0x0))) == '\0') {
if (g_mainHeap == (void *)0x0) {
heapAllocatedBytes = &g_allocatedBytesNoHeap;
}
else {
heapAllocatedBytes = GHIDRA_CAST<qword *>((GHIDRA_INT(g_mainHeap) + 0x30));
}
if (local_20._data != (void *)0x0) {
uVar1 = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(local_20._data) + -4));
oldAllocatedBytes = *heapAllocatedBytes;
*GHIDRA_CAST<uint *>(heapAllocatedBytes) = GHIDRA_UINT(*heapAllocatedBytes) - uVar1;
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(heapAllocatedBytes) + 4)) =
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(heapAllocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocatedBytes) < uVar1));
free((void *)(GHIDRA_INT(local_20._data) + -4));
}
}
ExceptionList = local_10;
return maxIndex + 1;
}
// 007e9390
int Entity_Pickup::Charge()
{
return this->_charge;
}
// 007e93a0
byte Entity_Pickup::AutoUpdatePrice()
{
return this->_isAutoUpdatePrice;
}
// 007e93b0
byte Entity_Pickup::Touched()
{
return this->_isTouched;
}
// 007e93c0
int Entity_Pickup::ShopItemId()
{
return this->_shopItemId;
}
// 007ef420
void Entity_Pickup::RestoreState(Room *room, Entity_Pickup *entity, void *saveState)
{
undefined4 uVar1;
void *pvVar2;
byte bVar3;
Vector *vecResult;
int iVar4;
uint uVar5;
EntityPtr player;
uint uVar6;
EntityPtr *spawnerSlot;
float fVar7;
float fVar8;
byte bVar9;
byte bVar10;
Vector local_18;
Vector local_10;
void *gameRoom;
double uintFixup;
if (((entity->_pos).x == g_vectorZero.x) && ((entity->_pos).y == g_vectorZero.y)) {
bVar10 = 0;
bVar9 = 0;
bVar3 = 1;
fVar8 = 40.0;
vecResult = (GHIDRA_CAST<Room *>((room)))->Room::GetRandomPosition(&local_10,0.0);
vecResult = Room::FindFreePickupSpawnPosition(room,&local_18,vecResult,fVar8,bVar3,bVar9,bVar10)
;
(entity->_pos).x = vecResult->x;
(entity->_pos).y = vecResult->y;
}
(entity->_dropRNG)._seed = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0x38));
(entity->_dropRNG)._shift1 = 4;
(entity->_dropRNG)._shift2 = 3;
(entity->_dropRNG)._shift3 = 0x11;
iVar4 = entity->_type;
entity->_spawnGridIndex = GHIDRA_INT(*GHIDRA_CAST<short *>((GHIDRA_CAST<char *>(saveState) + 0x20)));
entity->_scoreMultiplier = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(saveState) + 0x58));
if (iVar4 == 5) {
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 8)) != 0) {
entity->_charge = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0x10));
}
update_price_sprite(entity,*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0x14)));
entity->_isAutoUpdatePrice = *GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(saveState) + 0x60));
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0x18));
if (iVar4 < -1) {
iVar4 = -2;
}
else if (6 < iVar4) {
iVar4 = 7;
}
entity->_shopItemId = iVar4;
entity->_isTouched = *GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(saveState) + 0x22));
iVar4 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0x24));
entity->_coopDuplicateIndex = iVar4;
if ((iVar4 != 0) && (iVar4 != -1)) {
entity->_cycleCollectibleCount = 0;
}
bVar3 = entity->_isForceBlind;
entity->_optionsPickupIndex = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0x30));
entity->_spawnerType = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0x3c));
entity->_spawnerVariant = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0x40));
entity->_timeout = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0x1c));
fVar8 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(saveState) + 0x54)) * g_vectorOne.x;
(entity->_sprite)._scale.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(saveState) + 0x54)) * g_vectorOne.y;
(entity->_sprite)._scale.x = fVar8;
bVar9 = *GHIDRA_CAST<byte *>((GHIDRA_CAST<char *>(saveState) + 0x23));
entity->_isForceBlind = bVar9;
if (((entity->_variant == 100) && (entity->_subtype != 0)) && (bVar3 != bVar9)) {
UpdateSprite(entity,0);
}
SetAlternatePedestal(entity,*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0xc)));
entity->_varData = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0x5c));
entity->_itemPoolType = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0x50));
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 100)) != 0) {
entity->_cycleCollectibleCount = 0;
uVar6 = 0;
do {
iVar4 = *GHIDRA_CAST<int *>((uVar6 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 100))));
if (iVar4 == 0) break;
if (GHIDRA_UINT(entity->_cycleCollectibleCount) < 8) {
entity->_cycleCollectibleList[entity->_cycleCollectibleCount] = iVar4;
entity->_cycleCollectibleCount = entity->_cycleCollectibleCount + 1;
}
uVar6 = uVar6 + 4;
} while (uVar6 < 0x20);
}
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0x6c)) != 0) {
(GHIDRA_CAST<SharedPtr *>((&entity->_flipSaveState)))->SharedPtr::assign(GHIDRA_CAST<int *>((GHIDRA_INT(saveState) + 0x6c)));
(GHIDRA_CAST<ANM2 *>((&entity->_altPedestalANM2)))->ANM2::Reset();
}
UpdateLootPreview(entity);
if (((g_game->_currentRoomIdx == -0xc) && (g_game->_isStartingFromState != 0)) &&
((entity->_variant == 100 && (-1 < entity->_spawnGridIndex)))) {
uVar1 = *GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&entity->_flags) + 4));
*GHIDRA_CAST<uint *>(&entity->_flags) = GHIDRA_UINT(entity->_flags) | 0x40000;
*GHIDRA_CAST<undefined4 *>((GHIDRA_INT(&entity->_flags) + 4)) = uVar1;
*GHIDRA_CAST<undefined4 *>(&(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>((room)) + 0x7764)))) = 0xffffffff;
return;
}
}
else {
if (iVar4 == 6) {
iVar4 = entity->_variant;
(entity->_priceANM2)._filename._size = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(saveState) + 0xc));
if (iVar4 == 10) {
(entity->_priceANM2)._filename._capacity = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(saveState) + 0x10));
}
(GHIDRA_CAST<Entity_Slot *>((GHIDRA_CAST<Entity_Slot *>(entity))))->Entity_Slot::SetPrizeType(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0x30)));
return;
}
if (iVar4 == 1000) {
iVar4 = entity->_variant;
if (((iVar4 == 0x15) || (iVar4 == 0x21)) ||
((iVar4 == 0x3f ||
((((iVar4 == 0x40 || (iVar4 == 0x41)) || (iVar4 == 0x45)) || (iVar4 == 0x9e)))))) {
gameRoom = g_game->_room;
local_10.x = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(gameRoom) + 0x14));
fVar8 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(gameRoom) + 0x18));
local_18.x = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(gameRoom) + 0x1c));
fVar7 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(gameRoom) + 0x20));
uVar6 = Random();
uintFixup = __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)];
uVar5 = Random();
(entity->_pos).x =
(float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) *
2.3283064e-10 * (local_18.x - local_10.x) + local_10.x;
(entity->_pos).y =
(float)((double)GHIDRA_INT(uVar6) + uintFixup) * 2.3283064e-10 * (fVar7 - fVar8) + fVar8;
return;
}
if (iVar4 == 0x44) {
entity->Update();
return;
}
if (iVar4 != 0x74) {
if (iVar4 != 0x78) {
return;
}
(entity->_priceANM2)._filename._size = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(saveState) + 0x18));
(entity->_priceANM2)._filename._capacity = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(saveState) + 0x10));
}
(entity->_priceANM2)._animState._animFrame = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(saveState) + 0xc));
return;
}
if ((iVar4 == 0x21) || (iVar4 == 0x124)) {
entity->_health =
(float)((double)*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0xc)) +
__uint_to_double_fixup[-(*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0xc)) >> 0x1f)]);
}
else if (iVar4 == 4) {
gameRoom = *(void **)(GHIDRA_CAST<char *>(saveState) + 0x18);
pvVar2 = *(void **)(GHIDRA_CAST<char *>(saveState) + 0x1c);
uVar6 = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(saveState) + 0x14));
(entity->_priceANM2)._animDefaultName._size = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(saveState) + 0x10));
(entity->_priceANM2)._animDefaultName._capacity = uVar6;
(entity->_priceANM2)._animState._animation = gameRoom;
(entity->_priceANM2)._animState._animData = pvVar2;
*GHIDRA_CAST<undefined1 *>((GHIDRA_INT(&(entity->_priceANM2)._overlayAnimState._animation) + 3)) = 1;
*GHIDRA_CAST<undefined1 *>(&(entity->_priceANM2)._animState._layerFrames) =
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(saveState) + 0x23));
*GHIDRA_CAST<undefined4 *>(((entity->_priceANM2)._filename._buf + 8)) =
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(saveState) + 0x50));
(entity->_priceANM2)._animState._nullLayerFrames = *(void **)(GHIDRA_CAST<char *>(saveState) + 0x54);
fVar8 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(saveState) + 0x54)) * g_vectorOne.x;
(entity->_sprite)._scale.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(saveState) + 0x54)) * g_vectorOne.y;
(entity->_sprite)._scale.x = fVar8;
entity->_spawnerType = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0x3c));
*GHIDRA_CAST<undefined4 *>(((entity->_priceANM2)._animDefaultName._buf + 0xc)) =
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(saveState) + 0xc));
if (-1 < *GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(saveState) + 0x60))) {
uVar6 = GHIDRA_UINT(*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(saveState) + 0x60)));
if (GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) -
GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2)) <= uVar6) {
uVar6 = 0;
}
player = (EntityPtr)(GHIDRA_CAST<Game *>((g_game)))->Game::GetPlayer(uVar6);
spawnerSlot = &entity->_spawnerEntity;
if (entity->_spawnerEntity != (EntityPtr)0x0) {
local_10.x = (float)spawnerSlot;
std::multiset<unsigned_int>::erase(&local_10);
}
*spawnerSlot = player;
if (player != (EntityPtr)0x0) {
std::multiset<unsigned_int>::insert(spawnerSlot);
return;
}
}
}
else {
bVar3 = (GHIDRA_CAST<Entity *>((GHIDRA_CAST<Entity *>(entity))))->Entity::IsEnemy();
if (((bVar3 != 0) && (iVar4 != 0x11)) && (iVar4 != 0x38b)) {
entity->_health = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(saveState) + 0x50));
if (-1 < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0x18))) {
Entity_NPC::MakeChampion
(GHIDRA_CAST<Entity_NPC *>(entity),*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(saveState) + 0x34)),
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(saveState) + 0x18)),0);
}
bVar3 = (GHIDRA_CAST<Vector *>((GHIDRA_CAST<Vector *>((GHIDRA_INT(saveState) + 0x28)))))->Vector::operator_eq(&g_vectorZero);
if (bVar3 != 0) {
bVar10 = 0;
bVar9 = 0;
bVar3 = 1;
fVar8 = 80.0;
vecResult = Room::GetCenterPos(&local_18);
Room::FindFreePickupSpawnPosition(room,&local_10,vecResult,fVar8,bVar3,bVar9,bVar10);
vecResult = MusicManager::RandomVector(&local_18);
uVar6 = Random();
fVar7 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) *
2.3283064e-10;
fVar8 = vecResult->x;
(entity->_pos).y = fVar7 * vecResult->y * 20.0 + local_10.y;
(entity->_pos).x = fVar7 * fVar8 * 20.0 + local_10.x;
return;
}
}
}
}
return;
}
// 0085e440
int Entity_Pickup::Wait()
{
return this->_wait;
}