#include "classes.h" // 00431be0 void Entity_Familiar::ai_umbilical_baby(byte isInterpolated) { Entity_Familiar *sprite = this; byte *animName; undefined4 *puVar1; byte bVar2; char isDamaged; undefined4 *puVar3; undefined4 *listHead; Entity *bloodEffect; Weapon *newWeapon; float *extraout_EAX; int iVar4; Vector *pVVar5; LayerState *layer; LayerState *copyLayer; float *pfVar6; float **ppfVar7; void *pvVar8; Capsule *capsule; int *piVar9; BitSet128 *maskedFlags; float *ropePointCount; EntityPtr cordSegment; Entity *unused; uint uVar10; uint uVar11; std_vector *psVar12; Entity_Projectile *pEVar13; float fVar14; Entity_Familiar *baby; float fVar15; float fVar16; undefined1 auVar17 [12]; float fVar18; float fVar19; double dVar20; undefined3 in_stack_00000005; Capsule gridCapsule [10]; Vector bombPush; Vector bombOffset; EntityRef local_20c; Vector tearPushDir; Vector reflectDir; Vector bombPushDir; EntityList_EL capsuleHits; float ropeForce; Vector projectileOffset; Vector pickupPos; Vector tearPos; Vector projectilePos; Vector bombPos; float babyPosX; Vector aimDirection; undefined1 local_184 [8]; undefined4 local_17c; undefined1 local_178 [8]; undefined4 local_170; float midVelX; Vector local_168; float midPosX; Vector local_15c; Vector local_154; float local_14c; Vector local_148; undefined1 shieldedMask [4]; undefined1 local_13c [8]; float local_134; Vector local_12c; Vector local_124; Vector local_11c; float *local_114; float tearFlags0; float tearFlags1; Vector VStack_108; float *local_fc; Vector *local_f8; Vector local_f4; undefined4 *local_ec; Entity_Familiar *local_e8; int *local_e4; std_vector *local_e0; float local_dc; Vector *local_d8; Vector *local_d4; float local_d0; float *local_cc; ANM2 *local_c8; Vector *local_c4; Entity_Projectile *local_c0; byte local_b9; TearParams tearHitParams; Capsule cordCapsule [4]; std_string anm2Path; uint stackCookie; undefined1 *puStack_20; void *savedExceptionList; undefined1 *puStack_18; int ehState; Manager *manager; Entity_Player *player; float *prevPoint; ANM2 *sprite; code *vfn; puStack_20 = GHIDRA_CAST((cordCapsule + 0x13)); ehState = -1; puStack_18 = &LAB_00af2166; savedExceptionList = ExceptionList; stackCookie = __security_cookie ^ GHIDRA_UINT((cordCapsule + 0x10)); if (*GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x173)) != '\0') { return; } ExceptionList = &savedExceptionList; local_e8 = sprite; puVar3 = (undefined4 *) __RTDynamicCast(sprite->_extraData,0, &IsaacRepentancePlus::Entity_Familiar::ExtraData::RTTI_Type_Descriptor, &IsaacRepentancePlus::UmbilicalBabyData::RTTI_Type_Descriptor,0, stackCookie); local_ec = puVar3; if (puVar3 == GHIDRA_CAST(0x0)) { puVar3 = operator_new(0x158); local_12c.y = (float)puVar3; if (puVar3 == GHIDRA_CAST(0x0)) { puVar3 = GHIDRA_CAST(0x0); local_ec = GHIDRA_CAST(0x0); } else { ehState = 1; puVar1 = puVar3 + 1; *puVar3 = IsaacRepentancePlus::UmbilicalBabyData::vftable; *puVar1 = 0; puVar3[2] = 0; puVar3[3] = 0; puVar3[4] = 0; puVar3[5] = 0; local_ec = puVar3; listHead = operator_new(8); listHead[1] = 0; *puVar1 = listHead; *listHead = puVar1; ehState = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(ehState)) + 0x1))),2); (GHIDRA_CAST((GHIDRA_CAST((puVar3 + 6)))))->ANM2::constructor(); puVar3[0x4c] = 0; puVar3[0x4d] = 0; puVar3[0x4e] = 0; puVar3[0x4f] = 0; puVar3[0x53] = 0; puVar3[0x52] = 0; sprite = local_e8; } ehState = -1; set_extra_data(&sprite->_extraData,puVar3); (GHIDRA_CAST((anm2Path._buf)))->std::string::string(&sprite->_sprite); ehState = 3; (GHIDRA_CAST((GHIDRA_CAST((puVar3 + 6)))))->ANM2::Load(&anm2Path,1); ehState = -1; if (0xf < anm2Path._capacity) { uVar10 = anm2Path._capacity + 1; pvVar8 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)anm2Path._buf)) + 0x0))); if (0xfff < uVar10) { pvVar8 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) + -4); uVar10 = anm2Path._capacity + 0x24; if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(anm2Path._buf)) + 0x0))) + (-4 - GHIDRA_INT(pvVar8))))) { /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(pvVar8,uVar10); } bVar2 = (GHIDRA_CAST((GHIDRA_CAST((puVar3 + 6)))))->ANM2::SetAnimation(&DAT_00b1d20c,1); if (((bVar2 != 0) && (puVar3[0x13] != 0)) && ((GHIDRA_CAST((GHIDRA_CAST((puVar3 + 0x12)))))->AnimationState::SetFrameFloat(0.0), puVar3[0x13] != 0)) { *GHIDRA_CAST((puVar3 + 0x17)) = 0; } Entity_Player::GetTearHitParams(sprite->_player,&tearHitParams,10,1.0,1,GHIDRA_CAST(sprite->_player)); sprite->_collisionDamage = tearHitParams._tearDamage; *GHIDRA_CAST((puVar3 + 0x50)) = 0; puVar3[0x4c] = (undefined4)tearHitParams._flags._l; puVar3[0x4d] = (*GHIDRA_CAST((GHIDRA_CAST(&(tearHitParams._flags._l)) + 0x4))); puVar3[0x4e] = (undefined4)tearHitParams._flags._h; puVar3[0x4f] = (*GHIDRA_CAST((GHIDRA_CAST(&(tearHitParams._flags._h)) + 0x4))); std::deque<120byte>::resize(); puVar3[0x51] = 0x40a00000; puVar3[0x52] = g_vectorZero.x; puVar3[0x53] = g_vectorZero.y; } if (sprite->_updateTime <= 3.0 && sprite->_updateTime != 3.0) { LAB_00434e1f: sprite->_visible = 0; fVar15 = *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x340)); (sprite->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x33c)); (sprite->_pos).y = fVar15; ExceptionList = savedExceptionList; return; } if (sprite->_visible == 0) { if (isInterpolated != 0) goto LAB_00434e1f; uVar10 = Random(); local_154.x = (sprite->_targetPosition).x * 6.0; local_154.y = (sprite->_targetPosition).y * 6.0; bloodEffect = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,2,&sprite->_pos,&local_154,GHIDRA_CAST(0x0),2,uVar10); iVar4 = *GHIDRA_CAST(bloodEffect); (bloodEffect->_posOffset).x = 0.0; (bloodEffect->_posOffset).y = -15.0; (**(code **)(iVar4 + 0xc))(); sprite->_visible = 1; local_dc = *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x13e0)); LAB_00431f23: pvVar8 = sprite->_weapon; if (local_dc == 0.0) { if (pvVar8 != (void *)0x0) { Isaac::DestoryWeapon(&sprite->_weapon); } } else if ((pvVar8 == (void *)0x0) || (*GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x30)) != *GHIDRA_CAST((GHIDRA_CAST(local_dc) + 0x30)))) { Isaac::DestoryWeapon(&sprite->_weapon); newWeapon = Isaac::CreateWeapon(*GHIDRA_CAST((GHIDRA_CAST(local_dc) + 0x30)),GHIDRA_CAST(sprite)); sprite->_weapon = newWeapon; } } else { sprite->_visible = 1; local_dc = *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x13e0)); if (isInterpolated == 0) goto LAB_00431f23; } player = sprite->_player; local_f8 = GHIDRA_CAST(player->_fireDirection); aimDirection.x = (player->_aimDirection).x; aimDirection.y = (player->_aimDirection).y; local_cc = GHIDRA_CAST(CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_cc)) + 0x1))),local_f8 != GHIDRA_CAST(0xffffffff))); local_d0 = (player->_pos).x; local_d8 = GHIDRA_CAST((player->_pos).y); local_e0 = GHIDRA_CAST(aimDirection.x); local_d4 = local_f8; VStack_108.y = aimDirection.y; (GHIDRA_CAST((player)))->Entity_Player::GetBodyMoveDirection(&local_f4); local_d0 = local_d0 + *extraout_EAX * 6.0; local_d8 = GHIDRA_CAST(((float)local_d8 + extraout_EAX[1] + extraout_EAX[1])); bVar2 = CanPlayerFire(sprite); if ((bVar2 != 0) && (sprite->_state != 2)) { local_c0 = GHIDRA_CAST(0x0); local_12c.y = 0.0; local_c8 = GHIDRA_CAST(0x0); local_12c.x = 0.0; PickEnemyTarget(sprite,800.0,-GHIDRA_UINT((sprite->_target != (EntityPtr)0x0)) & 8,0x13,&g_vectorZero,15.0) ; if ((local_dc != 0.0) && (sprite->_weapon != (void *)0x0)) { TryAimAtMarkedTarget(sprite,&aimDirection,GHIDRA_CAST(&local_d4),&local_12c); local_c8 = GHIDRA_CAST(local_12c.x); local_c0 = GHIDRA_CAST(local_12c.y); if ((local_12c.x == g_vectorZero.x) && (local_12c.y == g_vectorZero.y)) { local_c8 = GHIDRA_CAST((sprite->_pos).x); local_c0 = GHIDRA_CAST((sprite->_pos).y); } } if (sprite->_counter < 1) { local_c4 = local_d4; if ((local_d4 == GHIDRA_CAST(0xffffffff)) && ((sprite->_headFrameDelay < 1 || (local_c4 = GHIDRA_CAST(sprite->_shootDirection), local_c4 == GHIDRA_CAST(0xffffffff))))) { local_c4 = GHIDRA_CAST(0x3); } if ((sprite->_weapon == GHIDRA_CAST(0x0)) || (iVar4 = (**(code **)(*GHIDRA_CAST(sprite->_weapon) + 0x24))(), iVar4 == 0)) { pVVar5 = local_c4; } else { local_11c.x = *GHIDRA_CAST((iVar4 + 0x33c)) - (sprite->_pos).x; local_11c.y = *GHIDRA_CAST((iVar4 + 0x340)) - (sprite->_pos).y; pVVar5 = GHIDRA_CAST(vector_to_direction(&local_11c)); } sprite->_shootDirection = GHIDRA_INT(pVVar5); fVar15 = atan2f(aimDirection.y,aimDirection.x); puVar3[0x54] = fVar15 * 57.295776; } if ((local_dc != 0.0) && (pvVar8 = sprite->_weapon, pvVar8 != (void *)0x0)) { *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x28)) = local_c8; *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x2c)) = local_c0; *GHIDRA_CAST((GHIDRA_CAST(sprite->_weapon) + 0x10)) = *GHIDRA_CAST((GHIDRA_CAST(local_dc) + 0x10)); *GHIDRA_CAST((GHIDRA_CAST(sprite->_weapon) + 0x34)) = *GHIDRA_CAST((GHIDRA_CAST(local_dc) + 0x34)); (**(code **)(*GHIDRA_CAST(sprite->_weapon) + 8))(); (**(code **)(*GHIDRA_CAST(sprite->_weapon) + 0xc))(&aimDirection,local_cc,_isInterpolated); } if (sprite->_fireCooldown == 0) { if (sprite->_headFrameDelay < 9) { PlayFloatAnim(sprite,sprite->_shootDirection); } else { PlayShootAnim(sprite,sprite->_shootDirection); } } if (isInterpolated == 0) { if (0 < sprite->_counter) { sprite->_counter = sprite->_counter + -1; } if (0 < sprite->_headFrameDelay) { sprite->_headFrameDelay = sprite->_headFrameDelay + -1; } if (0 < sprite->_fireCooldown) { sprite->_fireCooldown = sprite->_fireCooldown + -1; } } } local_cc = GHIDRA_CAST(((float)puVar3[0x55] * 0.017453292)); local_d4 = GHIDRA_CAST(sin((float)local_cc)); local_fc = GHIDRA_CAST(cos((float)local_cc)); fVar15 = atan2f((float)local_d4,(float)local_fc); fVar15 = fVar15 * 57.295776; if (360.0 < ABS(fVar15)) { fVar15 = fmodf(fVar15,360.0); } if (fVar15 <= 180.0) { if (fVar15 < -180.0) { fVar15 = fVar15 + 360.0; } } else { fVar15 = fVar15 - 360.0; } local_cc = GHIDRA_CAST((fVar15 / 45.0 + 0.5)); dVar20 = floor((double)(float)local_cc); local_cc = GHIDRA_CAST((GHIDRA_INT(dVar20) + 8U & 0x80000007)); if (GHIDRA_INT(local_cc) < 0) { local_cc = GHIDRA_CAST(((GHIDRA_UINT((GHIDRA_INT(local_cc) + -1)) | 0xfffffff8) + 1)); } animName = (&PTR_s_BodySide_00b1d240)[GHIDRA_INT(local_cc)]; local_c8 = &sprite->_sprite; (sprite->_sprite)._overlayRenderFirst = local_cc != GHIDRA_CAST(&DAT_00000006); (GHIDRA_CAST((local_c8)))->ANM2::PlayOverlay(animName,0); if (((local_cc == GHIDRA_CAST(0x0)) || (local_cc == GHIDRA_CAST(0x1))) || (local_cc == GHIDRA_CAST(&DAT_00000007))) { local_b9 = 1; } else { local_b9 = 0; } local_b9 = (sprite->_sprite)._flipX ^ local_b9; layer = (GHIDRA_CAST((&sprite->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x1)); layer->_flipX = local_b9; local_114 = (GHIDRA_CAST((&(sprite->_sprite)._overlayAnimState)))->AnimationState::GetNullFrameById(0); if (local_114 != GHIDRA_CAST(0x0)) { local_cc = GHIDRA_CAST((*local_114 + 0.0 + (float)local_fc * 6.0)); local_fc = GHIDRA_CAST(((local_114[1] - 8.0) + (float)local_d4 * 6.0)); layer = (GHIDRA_CAST((&sprite->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); (layer->_pos).x = (float)local_cc; (layer->_pos).y = (float)local_fc; if ((sprite->_sprite)._flipX != 0) { layer = (GHIDRA_CAST((local_c8)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); local_cc = GHIDRA_CAST((GHIDRA_UINT((layer->_pos).x) ^ 0x80000000)); layer = (GHIDRA_CAST((local_c8)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); (layer->_pos).x = (float)local_cc; } sprite = local_c8; layer = (GHIDRA_CAST((local_c8)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); local_c0 = GHIDRA_CAST(0x0); (layer->_size).x = local_114[4]; (layer->_size).y = local_114[5]; do { layer = (GHIDRA_CAST((sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); copyLayer = (GHIDRA_CAST((sprite)))->ANM2::GetLayer(*GHIDRA_CAST((GHIDRA_CAST(local_c0) + 0xb1d238))); (copyLayer->_pos).x = (layer->_pos).x; (copyLayer->_pos).y = (layer->_pos).y; layer = (GHIDRA_CAST((sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); copyLayer = (GHIDRA_CAST((sprite)))->ANM2::GetLayer(*GHIDRA_CAST((GHIDRA_CAST(local_c0) + 0xb1d238))); (copyLayer->_size).x = (layer->_size).x; (copyLayer->_size).y = (layer->_size).y; local_c0 = GHIDRA_CAST((GHIDRA_INT(local_c0) + 4)); } while (local_c0 < &DAT_00000008); sprite = local_e8; puVar3 = local_ec; } if (sprite->_updateTime <= 10.0) { local_d4 = &sprite->_targetPosition; fVar15 = atan2f((sprite->_targetPosition).y,(sprite->_targetPosition).x); puVar3[0x55] = fVar15 * 57.295776; if (isInterpolated == 0) { local_dc = sprite->_speedMultiplier + sprite->_updateTime; pvVar8 = sprite->_player; local_c0 = GHIDRA_CAST(((local_dc - 3.0) / 6.0)); if (1.0 <= (float)local_c0) { if ((float)local_c0 == 1.0) { fVar15 = 1.2; } else { VStack_108.y = (float)local_c0 - 1.0; fVar15 = sin(VStack_108.y * 10.0); fVar15 = (fVar15 * 0.02) / ((float)local_c0 * (float)local_c0 * VStack_108.y) + 1.0; } } else { fVar15 = cos((float)local_c0 * 3.1415927); fVar15 = (1.0 - fVar15) * 0.6; } local_cc = GHIDRA_CAST((fVar15 * 180.0 * local_d4->y + *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x340)))); local_e0 = GHIDRA_CAST((fVar15 * 180.0 * local_d4->x + *GHIDRA_CAST((GHIDRA_CAST(pvVar8) + 0x33c)))); if (local_d4->x <= 0.0) { VStack_108.y = 90.0; } else { VStack_108.y = -90.0; } VStack_108.y = VStack_108.y * 0.017453292; local_c8 = GHIDRA_CAST(cos(VStack_108.y)); fVar15 = sin(VStack_108.y); VStack_108.y = (float)local_c8 * local_d4->x; local_c8 = GHIDRA_CAST(((float)local_c8 * local_d4->y + fVar15 * local_d4->x)); VStack_108.y = VStack_108.y - fVar15 * local_d4->y; if ((float)local_c0 == 0.0) { fVar15 = 1.0; } else { local_c0 = GHIDRA_CAST(((float)local_c0 * 10.0)); fVar15 = sin((float)local_c0); fVar15 = fVar15 / (float)local_c0; } fVar14 = (local_e8->_pos).y; (local_e8->_velocity).x = ((float)local_e0 + fVar15 * 20.0 * VStack_108.y) - (local_e8->_pos).x; (local_e8->_velocity).y = ((float)local_cc + fVar15 * 20.0 * (float)local_c8) - fVar14; sprite = local_e8; } else { local_dc = sprite->_speedMultiplier * 0.5 + sprite->_updateTime; } local_e0 = (std_vector *) ((sprite->_targetPosition).x * 233.99998 + *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x33c))); local_cc = GHIDRA_CAST(((sprite->_targetPosition).y * 233.99998 + *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x340)))); local_c8 = GHIDRA_CAST(&local_11c); if (isInterpolated == 0) { local_11c.y = sprite->_speedMultiplier * (sprite->_velocity).y + (sprite->_pos).y; local_11c.x = sprite->_speedMultiplier * (sprite->_velocity).x + (sprite->_pos).x; } else { local_11c.y = sprite->_speedMultiplier * (sprite->_velocity).y * 0.5 + (sprite->_pos).y; local_11c.x = sprite->_speedMultiplier * (sprite->_velocity).x * 0.5 + (sprite->_pos).x; } uVar11 = 1; ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & puVar3[4]) * 4)); *ropePointCount = local_d0; ropePointCount[1] = (float)local_d8; ropePointCount[2] = -13.0; uVar10 = puVar3[5]; if (1 < uVar10) { do { dVar20 = (double)GHIDRA_INT(uVar11); iVar4 = GHIDRA_INT(uVar11) >> 0x1f; local_f4.y = (float)puVar3[4]; uVar10 = GHIDRA_INT(local_f4.y) + uVar11; uVar11 = uVar11 + 1; ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & uVar10) * 4)); local_c8 = GHIDRA_CAST(((float)(dVar20 + __uint_to_double_fixup[-iVar4]) / (float)((double)(puVar3[5] + -1) + __uint_to_double_fixup[-(puVar3[5] + -1 >> 0x1f)]))); fVar15 = 1.0 - (float)local_c8; VStack_108.y = (fVar15 * -13.0 + (float)local_c8 * -15.0) * fVar15; *ropePointCount = (local_11c.x * (float)local_c8 + local_d0 * fVar15) * (float)local_c8 + ((float)local_e0 * (float)local_c8 + local_d0 * fVar15) * fVar15; ropePointCount[2] = VStack_108.y + (fVar15 * -13.0 + (float)local_c8 * -20.0) * (float)local_c8; ropePointCount[1] = (local_11c.y * (float)local_c8 + (float)local_d8 * fVar15) * (float)local_c8 + ((float)local_cc * (float)local_c8 + (float)local_d8 * fVar15) * fVar15; uVar10 = puVar3[5]; } while (uVar11 < uVar10); sprite = local_e8; } local_d8 = GHIDRA_CAST(0x1); if (1 < uVar10) { uVar10 = puVar3[5]; do { ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & puVar3[4] + GHIDRA_INT(local_d8)) * 4)); local_f4.y = (float)puVar3[4]; pfVar6 = *(float **) (puVar3[2] + (GHIDRA_INT(local_f4.y) + (GHIDRA_INT(local_d8) - 1U) & puVar3[3] - 1) * 4); VStack_108.y = *ropePointCount - *pfVar6; local_e0 = GHIDRA_CAST((ropePointCount[1] - pfVar6[1])); if ((VStack_108.y != g_vectorZero.x) || ((float)local_e0 != g_vectorZero.y)) { local_d0 = cos(1.5707964); fVar15 = sin(1.5707964); local_c0 = GHIDRA_CAST((local_d0 * VStack_108.y - fVar15 * (float)local_e0)); local_d0 = local_d0 * (float)local_e0 + fVar15 * VStack_108.y; fVar15 = sqrtf((float)local_c0 * (float)local_c0 + local_d0 * local_d0); if (0.0 < fVar15) { local_d0 = local_d0 * (1.0 / fVar15); local_c0 = GHIDRA_CAST(((float)local_c0 * (1.0 / fVar15))); } VStack_108.y = 15.0 - local_dc; local_e0 = GHIDRA_CAST(0x0); ropePointCount = &VStack_108.y; if ((local_dc - 6.0) * VStack_108.y * 0.5 <= 0.0) { ropePointCount = GHIDRA_CAST(&local_e0); } local_e0 = GHIDRA_CAST(0x0); pfVar6 = &VStack_108.y; if (VStack_108.y <= 0.0) { pfVar6 = GHIDRA_CAST(&local_e0); } fVar15 = ((float)((double)GHIDRA_INT((uVar10 - GHIDRA_INT(local_d8))) + __uint_to_double_fixup[-(GHIDRA_INT((uVar10 - GHIDRA_INT(local_d8))) >> 0x1f)]) * (*ropePointCount + (float)*ropePointCount)) / (float)((double)GHIDRA_INT(uVar10) + __uint_to_double_fixup[-(GHIDRA_INT(uVar10) >> 0x1f)]); local_c0 = GHIDRA_CAST(((float)local_c0 * fVar15)); local_d0 = local_d0 * fVar15; fVar15 = (float)((double)GHIDRA_INT(local_d8) + __uint_to_double_fixup[-(GHIDRA_INT(local_d8) >> 0x1f)]) * (float)*pfVar6 * 0.4; fVar15 = sin(((fVar15 + fVar15) * 3.1415927) / (float)((double)GHIDRA_INT(uVar10) + __uint_to_double_fixup[-(GHIDRA_INT(uVar10) >> 0x1f)]) ); local_f4.y = (float)puVar3[4]; ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & GHIDRA_INT(local_f4.y) + GHIDRA_INT(local_d8)) * 4)); ropePointCount[1] = fVar15 * local_d0 + ropePointCount[1]; *ropePointCount = fVar15 * (float)local_c0 + *ropePointCount; ropePointCount[2] = ropePointCount[2] + 0.0; uVar10 = puVar3[5]; } local_d8 = GHIDRA_CAST((GHIDRA_INT(local_d8) + 1)); } while (local_d8 < uVar10); sprite = local_e8; } if (sprite->_updateTime <= 4.0) { ExceptionList = savedExceptionList; return; } player = sprite->_player; local_d8 = &sprite->_pos; local_154.x = (player->_pos).x; local_154.y = (player->_pos).y; babyPosX = local_d8->x; local_12c.y = (sprite->_pos).y; local_c8 = GHIDRA_CAST((sprite->_collisionDamage * 3.0)); local_d0 = 16.0; local_124.x = babyPosX; local_124.y = local_12c.y; local_114 = GHIDRA_CAST(local_154.x); local_fc = GHIDRA_CAST(local_154.y); if (((player->_playerType == 0x20) && (bVar2 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0x26b,0), bVar2 != 0)) && (cordSegment = sprite->_child, cordSegment != (EntityPtr)0x0)) { local_d0 = 1.0; do { if (30.0 <= local_d0) break; cordSegment = *GHIDRA_CAST((GHIDRA_CAST(cordSegment) + 0x3c0)); VStack_108.y = local_d0 + 1.0; local_e0 = GHIDRA_CAST(0x41f00000); local_c8 = GHIDRA_CAST(((float)local_c8 + 3.0)); ropePointCount = &VStack_108.y; if (30.0 <= VStack_108.y) { ropePointCount = GHIDRA_CAST(&local_e0); } local_d0 = *ropePointCount; } while (cordSegment != (EntityPtr)0x0); local_d0 = local_d0 + 16.0; } bVar2 = (GHIDRA_CAST((sprite->_player)))->Entity_Player::HasCollectible(0xf7,0); if (bVar2 != 0) { local_d0 = local_d0 * 1.5; } (GHIDRA_CAST((cordCapsule)))->Capsule::constructor2(&local_154,&local_124,local_d0); if ((GHIDRA_UINT(g_game->_debugFlags) >> 5 & 1) != 0) { pvVar8 = (GHIDRA_CAST((&g_game->_debugRenderer)))->DebugRenderer::Get(sprite->_index,1); (GHIDRA_CAST((GHIDRA_CAST(&local_20c))))->Capsule::constructor2(&local_154,&local_124,local_d0); push_shape_points(pvVar8,capsule); } local_c0 = g_game->_room; local_d0 = 18.0; local_124.y = 0.0; local_124.x = 0.0; VStack_108.x = 0.0; VStack_108.y = 0.0; (GHIDRA_CAST((cordCapsule)))->Capsule::get_bounding_box(&local_124,&VStack_108); baby = local_e8; fVar15 = (float)GHIDRA_INT(((local_124.x - 40.0) / 40.0 + 0.5)); local_dc = 0.0; if (0 < GHIDRA_INT(fVar15)) { local_dc = fVar15; } piVar9 = GHIDRA_CAST(GHIDRA_INT(((local_124.y - 120.0) / 40.0 + 0.5))); local_f8 = GHIDRA_CAST(GHIDRA_CAST(0x0)); if (0 < GHIDRA_INT(piVar9)) { local_f8 = GHIDRA_CAST(piVar9); } local_e0 = GHIDRA_CAST((GHIDRA_INT((local_c0->_damageEvents)._end) + -1)); psVar12 = GHIDRA_CAST(GHIDRA_INT(((VStack_108.x - 40.0) / 40.0 + 0.5))); if (GHIDRA_INT(psVar12) < GHIDRA_INT(local_e0)) { local_e0 = psVar12; } fVar15 = (float)(GHIDRA_INT((local_c0->_damageEvents)._capacity) + -1); fVar14 = (float)GHIDRA_INT(((VStack_108.y - 120.0) / 40.0 + 0.5)); if (GHIDRA_INT(fVar14) < GHIDRA_INT(fVar15)) { fVar15 = fVar14; } VStack_108.y = fVar15; pEVar13 = local_c0; if (GHIDRA_INT(local_dc) <= GHIDRA_INT(local_e0)) { do { local_e4 = GHIDRA_CAST(local_f8); fVar14 = local_dc; pVVar5 = local_f8; if (GHIDRA_INT(local_f8) <= GHIDRA_INT(fVar15)) { do { if ((((GHIDRA_INT(fVar14) < 0) || (pvVar8 = (pEVar13->_damageEvents)._end, GHIDRA_INT(pvVar8) <= GHIDRA_INT(fVar14))) || (GHIDRA_INT(pVVar5) < 0)) || ((GHIDRA_INT((pEVar13->_damageEvents)._capacity) <= GHIDRA_INT(pVVar5) || (iVar4 = GHIDRA_INT(pvVar8) * GHIDRA_INT(pVVar5) + GHIDRA_INT(fVar14), iVar4 < 0)))) { local_c4 = GHIDRA_CAST(0x0); } else { local_c4 = *GHIDRA_CAST((GHIDRA_INT((&(pEVar13->_sprite)._filename + -2)) + 0xc + iVar4 * 4)); } if (local_c4 != GHIDRA_CAST(0x0)) { iVar4 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); local_124.x = (float)(GHIDRA_INT(local_c4[4].y) % iVar4) * 40.0 + 40.0; local_124.y = (float)(GHIDRA_INT(local_c4[4].y) / iVar4) * 40.0 + 120.0; local_e4 = GHIDRA_CAST(pVVar5); (GHIDRA_CAST((gridCapsule)))->Capsule::constructor(&local_124,&g_vectorOne,0.0,20.0); bVar2 = Capsule::Collide(gridCapsule,cordCapsule,GHIDRA_CAST(0x0)); if (bVar2 != 0) { vfn = *(code **)(GHIDRA_CAST(local_c4->x) + 0x10); (GHIDRA_CAST((&local_20c)))->EntityRef::constructor(GHIDRA_CAST(baby)); (*vfn)(1); pVVar5 = GHIDRA_CAST(local_e4); } fVar14 = local_dc; pEVar13 = local_c0; } pVVar5 = GHIDRA_CAST((GHIDRA_INT(pVVar5) + 1)); fVar15 = VStack_108.y; local_e4 = GHIDRA_CAST(pVVar5); } while (GHIDRA_INT(pVVar5) <= GHIDRA_INT(VStack_108.y)); } local_dc = (float)(GHIDRA_INT(fVar14) + 1); } while (GHIDRA_INT(local_dc) <= GHIDRA_INT(local_e0)); } local_124.y = (float)(local_ec + 0x4c); maskedFlags = BitSet128::operator_and (GHIDRA_CAST(shieldedMask),GHIDRA_CAST(local_124.y),&g_tearFlagShielded) ; if ((GHIDRA_INT(maskedFlags->_l) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_l) + 4)) != 0) || (uVar10 = 0x1c, GHIDRA_INT(maskedFlags->_h) != 0 || *GHIDRA_CAST((GHIDRA_INT(&maskedFlags->_h) + 4)) != 0)) { uVar10 = 0x1e; } local_cc = GHIDRA_CAST(0x49742400); local_11c.y = 0.0; local_11c.x = 0.0; local_b9 = '\0'; EntityList::query_player_capsule_hits (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&capsuleHits,cordCapsule,uVar10); ehState = 4; local_c4 = GHIDRA_CAST(0x0); if (capsuleHits._size != 0) { do { pEVar13 = *GHIDRA_CAST((GHIDRA_CAST(capsuleHits._data) + GHIDRA_INT(local_c4) * 4)); local_c0 = pEVar13; if ((pEVar13->_size == 0.0) || (pEVar13->_entityCollisionClass == 0)) goto LAB_004345ff; cordSegment = local_e8->_child; if (cordSegment != (EntityPtr)0x0) { do { g_forceCollideDepth = g_forceCollideDepth + 1; entity_collision_classes_match(GHIDRA_CAST(cordSegment),GHIDRA_CAST(pEVar13)); g_forceCollideDepth = g_forceCollideDepth + -1; cordSegment = *GHIDRA_CAST((GHIDRA_CAST(cordSegment) + 0x3c0)); } while (cordSegment != (EntityPtr)0x0); } baby = local_e8; local_f8 = GHIDRA_CAST(&pEVar13->_type); if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (*GHIDRA_CAST(local_f8) != 1)) { iVar4 = *GHIDRA_CAST(local_f8); if (iVar4 - 10U < 0x3de) goto LAB_004344ed; LAB_00434a9f: if (iVar4 == 4) { if (((pEVar13->_parent == (EntityPtr)local_e8->_player) && ((char)pEVar13->_wiggleFrameOffset != '\0')) && (ropePointCount = &(pEVar13->_posOffset).y, !(0.0 < *ropePointCount || *ropePointCount == 0.0))) goto LAB_00434c47; psVar12 = &local_e8->_hitList; local_e0 = psVar12; local_e4 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEVar13))))->Entity)::GetHitListIndex(); puVar1 = (baby->_hitList)._end; puVar3 = psVar12->_begin; VStack_108.y = (float)puVar1; uVar10 = GHIDRA_INT(puVar1) - GHIDRA_INT(puVar3) >> 2; if (0 < GHIDRA_INT(uVar10)) { do { uVar11 = uVar10 >> 1; if (GHIDRA_CAST(puVar3[uVar11]) < local_e4) { puVar3 = puVar3 + uVar11 + 1; uVar11 = uVar10 + (-1 - uVar11); } uVar10 = uVar11; } while (0 < GHIDRA_INT(uVar11)); pEVar13 = local_c0; } if ((puVar3 == puVar1) || (GHIDRA_CAST(*puVar3) != local_e4)) { FUN_00431620(); bombPos.x = (pEVar13->_pos).x; bombPos.y = (pEVar13->_pos).y; pVVar5 = (GHIDRA_CAST((&bombPos)))->Vector::__sub(&bombOffset,&local_154); (GHIDRA_CAST((pVVar5)))->Vector::Normalized(&bombPushDir); bVar2 = 0; pVVar5 = (GHIDRA_CAST((&bombPushDir)))->Vector::__mul(&bombPush,&local_d0); (GHIDRA_CAST((GHIDRA_CAST(pEVar13))))->Entity::AddVelocity_divided(pVVar5,bVar2); } } else if (iVar4 == 9) { if (local_e8->_player != (void *)0x0) { if (pEVar13->_dead != 0) goto LAB_00434c47; if (-50.0 < pEVar13->_height) { projectilePos.x = (pEVar13->_pos).x; projectilePos.y = (pEVar13->_pos).y; pVVar5 = (GHIDRA_CAST((&projectilePos)))->Vector::__sub(&projectileOffset,&local_154); (GHIDRA_CAST((pVVar5)))->Vector::Normalized(&reflectDir); pVVar5 = (GHIDRA_CAST((&reflectDir)))->Vector::__mul(GHIDRA_CAST((local_184 + 4)),&local_d0); (GHIDRA_CAST((pEVar13)))->Entity_Projectile::Reflect(unused,pVVar5); } } } else { LAB_00434c47: if (((EntityPtr)local_e8->_player == (EntityPtr)0x0) || (iVar4 != 2)) { if (((iVar4 == 5) && (((pEVar13->_variant != 100 && (pEVar13[1]._sprite._animData == (void *)0x0)) && (pEVar13->_dead == 0)))) && (((pEVar13->_entityCollisionClass != 0 && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar13))))->Entity::HasEntityFlags(0x4000000), bVar2 == 0)) && (bVar2 = EntityList::HitListContains (GHIDRA_CAST(&baby->_hitList),GHIDRA_CAST(pEVar13)), bVar2 == 0)) )) { FUN_00431620(); pickupPos.x = (pEVar13->_pos).x; pickupPos.y = (pEVar13->_pos).y; pVVar5 = (GHIDRA_CAST((&pickupPos)))->Vector::__sub(&local_148,local_d8); (GHIDRA_CAST((pVVar5)))->Vector::Normalized(&local_f4); bVar2 = 0; pVVar5 = (GHIDRA_CAST((&local_f4)))->Vector::__mul(GHIDRA_CAST((local_13c + 4)),&local_d0); (GHIDRA_CAST((GHIDRA_CAST(pEVar13))))->Entity::AddVelocity_divided(pVVar5,bVar2); } } else if (pEVar13->_parent == (EntityPtr)local_e8->_player) { tearFlags0 = pEVar13->_curvingStrength; tearFlags1 = pEVar13->_acceleration; VStack_108.x = pEVar13->_orbitDistance; VStack_108.y = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar13)) + 0x434)))); maskedFlags = BitSet128::operator_and (GHIDRA_CAST((GHIDRA_INT(&anm2Path) + 8)),GHIDRA_CAST(&tearFlags0), &g_tearFlagLudovico); bVar2 = (GHIDRA_CAST((maskedFlags)))->BitSet128::IsNonZero(); if ((bVar2 != 0) && (bVar2 = EntityList::HitListContains (GHIDRA_CAST(&baby->_hitList),GHIDRA_CAST(pEVar13)), bVar2 == 0)) { FUN_00431620(); tearPos.x = (pEVar13->_pos).x; tearPos.y = (pEVar13->_pos).y; pVVar5 = (GHIDRA_CAST((&tearPos)))->Vector::__sub(GHIDRA_CAST((local_178 + 4)),local_d8); (GHIDRA_CAST((pVVar5)))->Vector::Normalized(&tearPushDir); pVVar5 = (GHIDRA_CAST((&tearPushDir)))->Vector::__mul(&local_15c,&local_d0); VStack_108.y = 1.25; pVVar5 = (GHIDRA_CAST((pVVar5)))->Vector::__mul(&local_168,&VStack_108.y); (pEVar13->_velocity).x = pVVar5->x; (pEVar13->_velocity).y = pVVar5->y; } } } } else { iVar4 = 1; LAB_004344ed: if ((pEVar13->_flags & 0x20000000) != 0) goto LAB_00434a9f; local_e4 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(pEVar13))))->Entity)::GetHitListIndex(); local_e0 = (baby->_hitList)._end; puVar3 = (baby->_hitList)._begin; uVar10 = GHIDRA_INT(local_e0) - GHIDRA_INT(puVar3) >> 2; if (0 < GHIDRA_INT(uVar10)) { do { uVar11 = uVar10 >> 1; puVar1 = puVar3 + uVar11; if (GHIDRA_CAST(*puVar1) < local_e4) { puVar3 = puVar1 + 1; uVar11 = uVar10 + (-1 - uVar11); puVar1 = puVar3; } VStack_108.y = (float)puVar1; uVar10 = uVar11; } while (0 < GHIDRA_INT(uVar11)); baby = local_e8; pEVar13 = local_c0; } if ((GHIDRA_CAST(puVar3) == local_e0) || (GHIDRA_CAST(*puVar3) != local_e4)) { iVar4 = *GHIDRA_CAST(local_f8); if ((iVar4 != 0xf5) && (iVar4 != 0x124)) { uVar10 = (GHIDRA_CAST((GHIDRA_CAST(pEVar13))))->Entity::GetHitListIndex(); sorted_vector_insert_unique(&baby->_hitList,uVar10); iVar4 = pEVar13->_type; } if (iVar4 == 0x21) { if (pEVar13->_variant == 0xb) { LAB_00434715: if (pEVar13->_dead == 0) { local_e4 = GHIDRA_CAST(((pEVar13->_pos).x - (float)local_114)); local_f8 = GHIDRA_CAST(((pEVar13->_pos).y - (float)local_fc)); fVar15 = sqrtf((float)local_e4 * (float)local_e4 + (float)local_f8 * (float)local_f8); piVar9 = local_e4; pVVar5 = local_f8; if (0.0 < fVar15) { pVVar5 = GHIDRA_CAST(((float)local_f8 * (1.0 / fVar15))); piVar9 = GHIDRA_CAST(((float)local_e4 * (1.0 / fVar15))); } if ((pEVar13->_flags & 0x4000000) == 0) { fVar14 = 900.0 / (pEVar13->_mass + 50.0); fVar15 = pEVar13->_friction; if (fVar15 != 0.0) { fVar16 = pEVar13->_speedMultiplier; (pEVar13->_velocity).x = (fVar14 * (float)piVar9 * fVar16) / fVar15 + (pEVar13->_velocity).x; (pEVar13->_velocity).y = (fVar14 * (float)pVVar5 * fVar16) / fVar15 + (pEVar13->_velocity).y; } } VStack_108.x = 0.0; VStack_108.y = 0.0; bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar13))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); if ((bVar2 == 0) || (((bVar2 = (GHIDRA_CAST((baby->_player)))->Entity_Player::HasPlayerForm(0), bVar2 == 0 && ((bVar2 = (GHIDRA_CAST((baby->_player)))->Entity_Player::HasCollectible(0x97,0), bVar2 == 0 || (uVar10 = Random(), uVar10 % 6 != 0)))) || (0x1d < *GHIDRA_CAST((GHIDRA_CAST(baby->_player) + 0x136c)))))) { local_c0 = GHIDRA_CAST(VStack_108.y); local_dc = VStack_108.x; } else { local_dc = 2.29589e-41; local_c0 = GHIDRA_CAST(0x0); } bVar2 = (GHIDRA_CAST((GHIDRA_CAST(baby))))->Entity::HasEntityFlags(0x400000000); if (bVar2 != 0) { local_dc = (float)(GHIDRA_UINT(local_dc) | 0x20000000); } vfn = *(code **)(*GHIDRA_CAST(pEVar13) + 0x20); (GHIDRA_CAST((&local_20c)))->EntityRef::constructor(local_e8->_player); isDamaged = (*vfn)(local_c8,local_dc,local_c0,&local_20c); if (isDamaged == '\0') { LAB_004349aa: pVVar5 = local_d8; } else { bVar2 = (GHIDRA_CAST((GHIDRA_CAST(pEVar13))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); manager = g_manager; if (bVar2 == 0) goto LAB_004349aa; local_e4 = GHIDRA_CAST(0x4d); seed_fart_sound_override(GHIDRA_CAST(&local_e4)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_e4),1.0,10,0,1.5,0.0); pVVar5 = local_d8; Entity_Tear::ApplyTearFlagEffects (GHIDRA_CAST(pEVar13),local_d8,*GHIDRA_CAST(local_124.y), GHIDRA_CAST(local_e8),(float)local_c8); } if ((pEVar13->_pendingDamage < pEVar13->_health) && (*GHIDRA_CAST((local_ec + 0x50)) == '\0')) { *GHIDRA_CAST((local_ec + 0x50)) = 1; } fVar16 = babyPosX - (float)local_114; fVar18 = local_12c.y - (float)local_fc; fVar14 = ((pEVar13->_pos).y - (float)local_fc) * fVar18 + ((pEVar13->_pos).x - (float)local_114) * fVar16; fVar15 = fVar18 * fVar18 + fVar16 * fVar16; fVar16 = (fVar16 * fVar14) / fVar15 + (float)local_114; fVar18 = (fVar18 * fVar14) / fVar15 + (float)local_fc; fVar15 = pVVar5->x - fVar16; fVar14 = pVVar5->y - fVar18; ropePointCount = GHIDRA_CAST((fVar14 * fVar14 + fVar15 * fVar15)); if ((float)ropePointCount < (float)local_cc) { local_11c.x = fVar16; local_11c.y = fVar18; local_cc = ropePointCount; } local_b9 = '\x01'; } } else { vfn = *(code **)(*GHIDRA_CAST(pEVar13) + 0x20); (GHIDRA_CAST((&local_20c)))->EntityRef::constructor(GHIDRA_CAST(local_e8->_parent)); (*vfn)(0x447a0000,0,0,&local_20c); } } else if (iVar4 == 0x3c3) { piVar9 = baby->_player; g_forceCollideDepth = g_forceCollideDepth + 1; (**(code **)(*piVar9 + 0x5c))(pEVar13); pEVar13->HandleCollision(piVar9,0); g_forceCollideDepth = g_forceCollideDepth + -1; } else if (iVar4 != 0x11) goto LAB_00434715; } } LAB_004345ff: local_c4 = GHIDRA_CAST((GHIDRA_INT(local_c4) + 1)); } while (local_c4 < GHIDRA_UINT(capsuleHits._size)); if ((local_b9 != '\0') && (*GHIDRA_CAST((GHIDRA_CAST(local_ec) + 0x141)) == '\0')) { *GHIDRA_CAST((GHIDRA_CAST(local_ec) + 0x141)) = 1; play_sound_with_fart_seed(0x1ef,1.0,2,0,1.0); bVar2 = (GHIDRA_CAST((&local_11c)))->Vector::operator_ne(&g_vectorZero); if (bVar2 != 0) { uVar10 = Random(); local_12c.y = 6.0; pVVar5 = (GHIDRA_CAST((local_d4)))->Vector::__mul(GHIDRA_CAST((local_13c + 4)),&local_12c.y); bloodEffect = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,2,&local_11c,pVVar5,GHIDRA_CAST(0x0),2,uVar10); iVar4 = *GHIDRA_CAST(bloodEffect); (bloodEffect->_posOffset).x = 0.0; (bloodEffect->_posOffset).y = -15.0; (**(code **)(iVar4 + 0xc))(); } } } (GHIDRA_CAST((&capsuleHits)))->EntityList_Query::~EntityList_Query(); ExceptionList = savedExceptionList; return; } if (((0 < sprite->_state) && (sprite->_headFrameDelay < 1)) && (20.0 < sprite->_updateTime)) { if (sprite->_state == 1) { fVar15 = (sprite->_pos).y; fVar14 = *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x340)); puVar3[0x52] = (sprite->_pos).x - *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x33c)); puVar3[0x53] = fVar15 - fVar14; } local_cc = GHIDRA_CAST((sprite->_speedMultiplier * 10.0)); fVar15 = atan2f((float)puVar3[0x53],(float)puVar3[0x52]); fVar15 = approach_angle((float)puVar3[0x55],fVar15 * 57.295776,(float)local_cc); puVar3[0x55] = fVar15; sprite->_state = 2; if (isInterpolated == 0) { local_c8 = GHIDRA_CAST(((float)puVar3[0x51] - sprite->_speedMultiplier)); puVar3[0x51] = local_c8; } else { local_c8 = GHIDRA_CAST(((float)puVar3[0x51] - sprite->_speedMultiplier * 0.5)); } local_fc = GHIDRA_CAST((((float)local_c8 - 0.0) / 5.0)); if ((float)local_fc <= 0.0) { local_fc = GHIDRA_CAST(0x0); } if (1.0 <= (float)local_fc) { local_fc = GHIDRA_CAST(0x3f800000); } fVar15 = (float)local_fc + 0.0; fVar15 = (1.0 - fVar15) * fVar15 + fVar15; local_e4 = GHIDRA_CAST((fVar15 * (float)puVar3[0x53] + *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x340)))); local_114 = GHIDRA_CAST((fVar15 * (GHIDRA_CAST((puVar3 + 0x52)))->x + *GHIDRA_CAST((GHIDRA_CAST(sprite->_player) + 0x33c)))); pVVar5 = (GHIDRA_CAST((GHIDRA_CAST((puVar3 + 0x52)))))->Vector::Normalized(&local_f4); local_cc = GHIDRA_CAST(cos(1.5707964)); fVar16 = sin(1.5707964); baby = local_e8; fVar15 = pVVar5->x; fVar14 = pVVar5->y; fVar19 = 1.0; ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & puVar3[4]) * 4)); ropePointCount[2] = -13.0; fVar18 = fVar14 * (float)local_cc; local_cc = GHIDRA_CAST((fVar15 * (float)local_cc - fVar14 * fVar16)); *ropePointCount = local_d0; local_ec = GHIDRA_CAST((fVar18 + fVar15 * fVar16)); ropePointCount[1] = (float)local_d8; local_c0 = (Entity_Projectile *) Math::timescale_factor(1.0 - (float)local_fc * 0.8,local_e8->_speedMultiplier); local_d4 = GHIDRA_CAST(0x1); if (1 < GHIDRA_UINT(puVar3[5])) { local_fc = GHIDRA_CAST(((5.0 - (float)local_c8) * 4.0)); local_dc = fVar19 - (float)local_c0; do { local_d8 = (Vector *) ((float)((double)GHIDRA_INT(local_d4) + __uint_to_double_fixup[-(GHIDRA_INT(local_d4) >> 0x1f)] ) / (float)((double)(puVar3[5] + -1) + __uint_to_double_fixup[-(puVar3[5] + -1 >> 0x1f)])); local_c4 = GHIDRA_CAST((fVar19 - (float)local_d8)); local_f8 = (Vector *) ((float)local_114 * (float)local_d8 + *GHIDRA_CAST((GHIDRA_CAST(baby->_player) + 0x33c)) * (float)local_c4); local_d0 = (float)local_e4 * (float)local_d8 + *GHIDRA_CAST((GHIDRA_CAST(baby->_player) + 0x340)) * (float)local_c4; fVar15 = sin(((float)local_d8 * (float)local_c8 + (float)local_d8 * (float)local_c8) * 3.1415927); ropePointCount = &local_d4->x; local_d4 = GHIDRA_CAST((GHIDRA_INT(&local_d4->x) + 1)); ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & GHIDRA_INT(ropePointCount) + puVar3[4]) * 4)); fVar19 = 1.0; *ropePointCount = (fVar15 * (float)local_cc * (float)local_fc + (float)local_f8) * (float)local_c0 + local_dc * *ropePointCount; ropePointCount[1] = (fVar15 * (float)local_ec * (float)local_fc + local_d0) * (float)local_c0 + local_dc * ropePointCount[1]; ropePointCount[2] = ((float)local_d8 * -20.0 - (float)local_c4 * 15.0) * (float)local_c0 + local_dc * ropePointCount[2]; } while (local_d4 < GHIDRA_CAST(puVar3[5])); } (baby->_velocity).x = g_vectorZero.x; (baby->_velocity).y = g_vectorZero.y; ropePointCount = GHIDRA_CAST(UmbilicalBabyData)::last_point(); (baby->_pos).x = *ropePointCount; (baby->_pos).y = ropePointCount[1]; if (!(0.0 < (float)puVar3[0x51] || (float)puVar3[0x51] == 0.0)) { baby->Remove(); ExceptionList = savedExceptionList; return; } ExceptionList = savedExceptionList; return; } iVar4 = puVar3[5]; local_c4 = GHIDRA_CAST(sprite->_speedMultiplier); local_c8 = GHIDRA_CAST(0x0); local_ec = (undefined4 *) (90.0 / (float)((double)iVar4 + __uint_to_double_fixup[-(iVar4 >> 0x1f)])); ropePointCount = GHIDRA_CAST(0x0); if (iVar4 != 0) { do { ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[4] + GHIDRA_INT(local_c8) & puVar3[3] - 1) * 4)); local_13c = *(undefined1 (*) [8])(ropePointCount + 3); local_134 = ropePointCount[5]; ropePointCount[6] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_13c)) + 0x0))); ropePointCount[7] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_13c)) + 0x4))); ropePointCount[8] = local_134; iVar4 = puVar3[4]; if (local_c8 < GHIDRA_CAST((puVar3[5] - 1))) { local_d4 = *GHIDRA_CAST((puVar3[2] + (iVar4 + 1 + GHIDRA_INT(local_c8) & puVar3[3] - 1) * 4)); iVar4 = puVar3[4]; } else { local_d4 = &DAT_00c79c58; } if (local_c8 == GHIDRA_CAST(0x0)) { pVVar5 = &DAT_00c79c58; } else { pVVar5 = *GHIDRA_CAST((puVar3[2] + (iVar4 + -1 + GHIDRA_INT(local_c8) & puVar3[3] - 1) * 4)); } pfVar6 = umbilical_rope_force (&local_14c,ropePointCount,ropePointCount + 3,&pVVar5->x,&local_d4->x, (float)local_ec); local_c8 = GHIDRA_CAST((GHIDRA_INT(local_c8) + 1)); ropePointCount[0x12] = *pfVar6; ropePointCount[0x13] = pfVar6[1]; ropePointCount[0x14] = pfVar6[2]; ropePointCount = GHIDRA_CAST(puVar3[5]); } while (local_c8 < ropePointCount); } local_c0 = GHIDRA_CAST(0x0); uVar10 = 0; if (ropePointCount != GHIDRA_CAST(0x0)) { do { ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[4] + GHIDRA_INT(local_c0) & puVar3[3] - 1) * 4)); ropePointCount[9] = (float)local_c4 * ropePointCount[0x12] * 0.5 + ropePointCount[3]; ropePointCount[10] = (float)local_c4 * ropePointCount[0x13] * 0.5 + ropePointCount[4]; ropePointCount[0xb] = (float)local_c4 * ropePointCount[0x14] * 0.5 + ropePointCount[5]; if (local_c0 < puVar3[5] - 1) { pfVar6 = *GHIDRA_CAST((puVar3[2] + (GHIDRA_INT(local_c0) + 1U + puVar3[4] & puVar3[3] - 1) * 4)); iVar4 = *GHIDRA_CAST((puVar3[2] + (puVar3[4] + GHIDRA_INT(local_c0) + 1U & puVar3[3] - 1) * 4)); local_d4 = GHIDRA_CAST(local_13c); (*GHIDRA_CAST((GHIDRA_CAST(&(local_13c)) + 0x4))) = (float)local_c4 * *GHIDRA_CAST((iVar4 + 0x1c)) * 0.5 + pfVar6[1]; (*GHIDRA_CAST((GHIDRA_CAST(&(local_13c)) + 0x0))) = (float)local_c4 * *GHIDRA_CAST((iVar4 + 0x18)) * 0.5 + *pfVar6; local_134 = (float)local_c4 * *GHIDRA_CAST((iVar4 + 0x20)) * 0.5 + pfVar6[2]; } else { local_d4 = GHIDRA_CAST(local_178); (*GHIDRA_CAST((GHIDRA_CAST(&(local_178)) + 0x0))) = DAT_00c79c58.x; (*GHIDRA_CAST((GHIDRA_CAST(&(local_178)) + 0x4))) = DAT_00c79c58.y; local_170 = DAT_00c79c60; } if (local_c0 == GHIDRA_CAST(0x0)) { (*GHIDRA_CAST((GHIDRA_CAST(&(local_184)) + 0x0))) = DAT_00c79c58.x; (*GHIDRA_CAST((GHIDRA_CAST(&(local_184)) + 0x4))) = DAT_00c79c58.y; pfVar6 = GHIDRA_CAST(local_184); local_17c = DAT_00c79c60; } else { uVar10 = GHIDRA_INT(local_c0) + puVar3[4] + -1; prevPoint = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & uVar10) * 4)); iVar4 = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & uVar10) * 4)); local_148.x = (float)local_c4 * *GHIDRA_CAST((iVar4 + 0x1c)) * 0.5 + prevPoint[1]; local_14c = (float)local_c4 * *GHIDRA_CAST((iVar4 + 0x18)) * 0.5 + *prevPoint; pfVar6 = &local_14c; local_148.y = (float)local_c4 * *GHIDRA_CAST((iVar4 + 0x20)) * 0.5 + prevPoint[2]; } local_168.x = (float)local_c4 * ropePointCount[0x13] * 0.5 + ropePointCount[4]; midVelX = (float)local_c4 * ropePointCount[0x12] * 0.5 + ropePointCount[3]; local_168.y = (float)local_c4 * ropePointCount[0x14] * 0.5 + ropePointCount[5]; midPosX = (float)local_c4 * ropePointCount[6] * 0.5 + *ropePointCount; local_15c.x = (float)local_c4 * ropePointCount[7] * 0.5 + ropePointCount[1]; local_15c.y = (float)local_c4 * ropePointCount[8] * 0.5 + ropePointCount[2]; local_cc = ropePointCount; pfVar6 = umbilical_rope_force (&ropeForce,&midPosX,&midVelX,pfVar6,&local_d4->x,(float)local_ec); local_c0 = GHIDRA_CAST((GHIDRA_INT(local_c0) + 1)); ropePointCount[0x15] = *pfVar6; ropePointCount[0x16] = pfVar6[1]; ropePointCount[0x17] = pfVar6[2]; uVar10 = puVar3[5]; } while (local_c0 < uVar10); } local_c0 = GHIDRA_CAST(0x0); uVar11 = 0; if (uVar10 != 0) { do { pVVar5 = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & puVar3[4] + GHIDRA_INT(local_c0)) * 4)); fVar15 = pVVar5[0xb].y; fVar14 = pVVar5[2].y; pVVar5[6].x = (float)local_c4 * pVVar5[10].y * 0.5 + pVVar5[1].y; pVVar5[6].y = (float)local_c4 * pVVar5[0xb].x * 0.5 + pVVar5[2].x; pVVar5[7].x = (float)local_c4 * fVar15 * 0.5 + fVar14; if (local_c0 < puVar3[5] - 1) { ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & puVar3[4] + GHIDRA_INT(local_c0) + 1U) * 4)); iVar4 = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & GHIDRA_INT(local_c0) + 1U + puVar3[4]) * 4)); local_c8 = GHIDRA_CAST(local_13c); (*GHIDRA_CAST((GHIDRA_CAST(&(local_13c)) + 0x4))) = (float)local_c4 * *GHIDRA_CAST((iVar4 + 0x28)) * 0.5 + ropePointCount[1]; (*GHIDRA_CAST((GHIDRA_CAST(&(local_13c)) + 0x0))) = (float)local_c4 * *GHIDRA_CAST((iVar4 + 0x24)) * 0.5 + *ropePointCount; local_134 = (float)local_c4 * *GHIDRA_CAST((iVar4 + 0x2c)) * 0.5 + ropePointCount[2]; } else { local_c8 = GHIDRA_CAST(local_178); (*GHIDRA_CAST((GHIDRA_CAST(&(local_178)) + 0x0))) = DAT_00c79c58.x; (*GHIDRA_CAST((GHIDRA_CAST(&(local_178)) + 0x4))) = DAT_00c79c58.y; local_170 = DAT_00c79c60; } if (local_c0 == GHIDRA_CAST(0x0)) { (*GHIDRA_CAST((GHIDRA_CAST(&(local_184)) + 0x0))) = DAT_00c79c58.x; (*GHIDRA_CAST((GHIDRA_CAST(&(local_184)) + 0x4))) = DAT_00c79c58.y; ropePointCount = GHIDRA_CAST(local_184); local_17c = DAT_00c79c60; } else { uVar10 = GHIDRA_INT(local_c0) + puVar3[4] + -1; pfVar6 = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & uVar10) * 4)); iVar4 = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & uVar10) * 4)); local_148.x = (float)local_c4 * *GHIDRA_CAST((iVar4 + 0x28)) * 0.5 + pfVar6[1]; local_14c = (float)local_c4 * *GHIDRA_CAST((iVar4 + 0x24)) * 0.5 + *pfVar6; ropePointCount = &local_14c; local_148.y = (float)local_c4 * *GHIDRA_CAST((iVar4 + 0x2c)) * 0.5 + pfVar6[2]; } local_168.x = (float)local_c4 * pVVar5[0xb].x * 0.5 + pVVar5[2].x; midVelX = (float)local_c4 * pVVar5[10].y * 0.5 + pVVar5[1].y; local_168.y = (float)local_c4 * pVVar5[0xb].y * 0.5 + pVVar5[2].y; midPosX = (float)local_c4 * pVVar5[4].y * 0.5 + pVVar5->x; local_15c.x = (float)local_c4 * pVVar5[5].x * 0.5 + pVVar5->y; local_15c.y = (float)local_c4 * pVVar5[5].y * 0.5 + pVVar5[1].x; local_d4 = pVVar5; ropePointCount = umbilical_rope_force (&ropeForce,&midPosX,&midVelX,ropePointCount,GHIDRA_CAST(local_c8),(float)local_ec) ; local_c0 = GHIDRA_CAST((GHIDRA_INT(local_c0) + 1)); pVVar5[0xc].x = *ropePointCount; pVVar5[0xc].y = ropePointCount[1]; pVVar5[0xd].x = ropePointCount[2]; uVar11 = puVar3[5]; } while (local_c0 < uVar11); } local_c0 = GHIDRA_CAST(0x0); uVar10 = 0; if (uVar11 != 0) { do { pVVar5 = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & puVar3[4] + GHIDRA_INT(local_c0)) * 4)); fVar15 = pVVar5[0xd].x; fVar14 = pVVar5[2].x; fVar16 = pVVar5[2].y; pVVar5[7].y = (float)local_c4 * pVVar5[0xc].x + pVVar5[1].y; pVVar5[8].x = (float)local_c4 * pVVar5[0xc].y + fVar14; pVVar5[8].y = (float)local_c4 * fVar15 + fVar16; if (local_c0 < puVar3[5] - 1) { ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & puVar3[4] + GHIDRA_INT(local_c0) + 1U) * 4)); iVar4 = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & GHIDRA_INT(local_c0) + 1U + puVar3[4]) * 4)); local_c8 = GHIDRA_CAST(local_13c); (*GHIDRA_CAST((GHIDRA_CAST(&(local_13c)) + 0x4))) = (float)local_c4 * *GHIDRA_CAST((iVar4 + 0x34)) + ropePointCount[1]; (*GHIDRA_CAST((GHIDRA_CAST(&(local_13c)) + 0x0))) = (float)local_c4 * *GHIDRA_CAST((iVar4 + 0x30)) + *ropePointCount; local_134 = (float)local_c4 * *GHIDRA_CAST((iVar4 + 0x38)) + ropePointCount[2]; } else { local_c8 = GHIDRA_CAST(local_178); (*GHIDRA_CAST((GHIDRA_CAST(&(local_178)) + 0x0))) = DAT_00c79c58.x; (*GHIDRA_CAST((GHIDRA_CAST(&(local_178)) + 0x4))) = DAT_00c79c58.y; local_170 = DAT_00c79c60; } if (local_c0 == GHIDRA_CAST(0x0)) { (*GHIDRA_CAST((GHIDRA_CAST(&(local_184)) + 0x0))) = DAT_00c79c58.x; (*GHIDRA_CAST((GHIDRA_CAST(&(local_184)) + 0x4))) = DAT_00c79c58.y; ropePointCount = GHIDRA_CAST(local_184); local_17c = DAT_00c79c60; } else { uVar10 = GHIDRA_INT(local_c0) + puVar3[4] + -1; pfVar6 = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & uVar10) * 4)); iVar4 = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & uVar10) * 4)); local_148.x = (float)local_c4 * *GHIDRA_CAST((iVar4 + 0x34)) + pfVar6[1]; local_14c = (float)local_c4 * *GHIDRA_CAST((iVar4 + 0x30)) + *pfVar6; ropePointCount = &local_14c; local_148.y = (float)local_c4 * *GHIDRA_CAST((iVar4 + 0x38)) + pfVar6[2]; } local_168.x = (float)local_c4 * pVVar5[0xc].y + pVVar5[2].x; midVelX = (float)local_c4 * pVVar5[0xc].x + pVVar5[1].y; local_168.y = (float)local_c4 * pVVar5[0xd].x + pVVar5[2].y; midPosX = (float)local_c4 * pVVar5[6].x + pVVar5->x; local_15c.x = (float)local_c4 * pVVar5[6].y + pVVar5->y; local_15c.y = (float)local_c4 * pVVar5[7].x + pVVar5[1].x; local_d4 = pVVar5; ropePointCount = umbilical_rope_force (&ropeForce,&midPosX,&midVelX,ropePointCount,GHIDRA_CAST(local_c8),(float)local_ec) ; local_c0 = GHIDRA_CAST((GHIDRA_INT(local_c0) + 1)); pVVar5[0xd].y = *ropePointCount; pVVar5[0xe].x = ropePointCount[1]; pVVar5[0xe].y = ropePointCount[2]; uVar10 = puVar3[5]; } while (local_c0 < uVar10); } baby = local_e8; uVar11 = 0; if (uVar10 != 0) { local_c4 = GHIDRA_CAST(((float)local_c4 / 6.0)); do { uVar10 = puVar3[4] + uVar11; uVar11 = uVar11 + 1; ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & uVar10) * 4)); *ropePointCount = (float)local_c4 * (ropePointCount[9] + ropePointCount[9] + ropePointCount[6] + ropePointCount[0xc] + ropePointCount[0xc] + ropePointCount[0xf]) + *ropePointCount; ropePointCount[1] = (float)local_c4 * (ropePointCount[10] + ropePointCount[10] + ropePointCount[7] + ropePointCount[0xd] + ropePointCount[0xd] + ropePointCount[0x10]) + ropePointCount[1]; ropePointCount[2] = (ropePointCount[0xb] + ropePointCount[0xb] + ropePointCount[8] + ropePointCount[0xe] + ropePointCount[0xe] + ropePointCount[0x11]) * (float)local_c4 + ropePointCount[2]; ropePointCount[3] = (float)local_c4 * (ropePointCount[0x15] + ropePointCount[0x15] + ropePointCount[0x12] + ropePointCount[0x18] + ropePointCount[0x18] + ropePointCount[0x1b]) + ropePointCount[3]; ropePointCount[4] = (float)local_c4 * (ropePointCount[0x16] + ropePointCount[0x16] + ropePointCount[0x13] + ropePointCount[0x19] + ropePointCount[0x19] + ropePointCount[0x1c]) + ropePointCount[4]; ropePointCount[5] = (ropePointCount[0x17] + ropePointCount[0x17] + ropePointCount[0x14] + ropePointCount[0x1a] + ropePointCount[0x1a] + ropePointCount[0x1d]) * (float)local_c4 + ropePointCount[5]; } while (uVar11 < GHIDRA_UINT(puVar3[5])); } ropePointCount = *GHIDRA_CAST((puVar3[2] + (puVar3[3] - 1 & puVar3[4]) * 4)); *ropePointCount = local_d0; ropePointCount[1] = (float)local_d8; ropePointCount[2] = -13.0; iVar4 = *GHIDRA_CAST((puVar3[2] + (puVar3[4] & puVar3[3] - 1) * 4)); *GHIDRA_CAST((iVar4 + 0xc)) = 0; *GHIDRA_CAST((iVar4 + 0x10)) = 0; *GHIDRA_CAST((iVar4 + 0x14)) = 0; if (isInterpolated == 0) { local_e4 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_e8->_player) + 0x340)) - (local_e8->_pos).y)); local_114 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_e8->_player) + 0x33c)) - (local_e8->_pos).x)); fVar16 = sqrtf((float)local_114 * (float)local_114 + (float)local_e4 * (float)local_e4); fVar14 = VStack_108.y; fVar15 = baby->_speedMultiplier; local_fc = GHIDRA_CAST(0x0); local_cc = GHIDRA_CAST(((fVar16 - 160.0) * (1.0 / fVar16))); auVar17 = ZEXT812(0x3f59999a); ppfVar7 = &local_cc; if ((float)local_cc <= 0.0) { ppfVar7 = &local_fc; } ropePointCount = *ppfVar7; if (fVar15 != 1.0) { fVar16 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar17)) + 0x0))); (*GHIDRA_CAST((GHIDRA_CAST(&(auVar17)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar17)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(auVar17)) + 0x0))) = fVar16 / ((fVar15 + fVar16) - fVar15 * fVar16); } fVar16 = fVar15 * (float)ropePointCount * (float)local_114 * 0.2 + (*GHIDRA_CAST((GHIDRA_CAST(&(auVar17)) + 0x0))) * (baby->_velocity).x; (baby->_velocity).x = fVar16; (baby->_velocity).y = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar17)) + 0x0))) * (baby->_velocity).y + fVar15 * (float)ropePointCount * (float)local_e4 * 0.2; if (local_f8 == GHIDRA_CAST(0xffffffff)) { if (baby->_isNotCountedAsFollower != 0) goto LAB_00433767; baby->_state = 1; fVar15 = baby->_speedMultiplier; fVar16 = fVar15 * fVar16; } else { fVar15 = baby->_speedMultiplier; (baby->_velocity).x = ((float)local_e0 + (float)local_e0) * fVar15 + fVar16; (baby->_velocity).y = (VStack_108.y + VStack_108.y) * fVar15 + (baby->_velocity).y; VStack_108.y = baby->_speedMultiplier * 10.0; fVar15 = atan2f(fVar14,(float)local_e0); fVar15 = approach_angle((float)puVar3[0x55],fVar15 * 57.295776,VStack_108.y); puVar3[0x55] = fVar15; fVar15 = baby->_speedMultiplier; fVar16 = fVar15 * (baby->_velocity).x; } fVar15 = fVar15 * (baby->_velocity).y; } else { LAB_00433767: fVar15 = baby->_speedMultiplier * (baby->_velocity).y; fVar16 = baby->_speedMultiplier * (baby->_velocity).x; if (isInterpolated != 0) { fVar14 = 0.5; goto LAB_004336d9; } } fVar14 = 1.0; LAB_004336d9: fVar16 = fVar14 * fVar16 + (baby->_pos).x; fVar15 = fVar14 * fVar15 + (baby->_pos).y; ropePointCount = GHIDRA_CAST(UmbilicalBabyData)::last_point(); *ropePointCount = fVar16; ropePointCount[1] = fVar15; ropePointCount[2] = 0.0; iVar4 = UmbilicalBabyData::last_point(); *GHIDRA_CAST((iVar4 + 8)) = 0xc1a00000; iVar4 = UmbilicalBabyData::last_point(); *GHIDRA_CAST((iVar4 + 0xc)) = 0; *GHIDRA_CAST((iVar4 + 0x10)) = 0; *GHIDRA_CAST((iVar4 + 0x14)) = 0; ExceptionList = savedExceptionList; return; } // 004357e0 void Entity_Familiar::set_extra_data(void *extraDataPtr, void *extraData) { char isLastRef; uint stackCookie; ReferenceCountBase *extraDataRef; void *local_10; undefined1 *puStack_c; undefined4 local_8; local_8 = 0xffffffff; puStack_c = &LAB_00af0d44; local_10 = ExceptionList; stackCookie = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; ExceptionList = &local_10; extraDataRef = operator_new(0x18); local_8 = 0; if (extraDataRef == GHIDRA_CAST(0x0)) { extraDataRef = GHIDRA_CAST(0x0); } else { (GHIDRA_CAST((extraDataRef)))->ReferenceCountBase::ReferenceCountBase(); *GHIDRA_CAST(extraDataRef) = ReferenceCount::vftable; *(void **)(extraDataRef + 0x14) = extraData; } local_8 = 0xffffffff; if (*GHIDRA_CAST((GHIDRA_CAST(extraDataPtr) + 4)) != GHIDRA_CAST(0x0)) { isLastRef = (**(code **)(**GHIDRA_CAST((GHIDRA_CAST(extraDataPtr) + 4)) + 0xc))(stackCookie); if ((isLastRef != '\0') && (DAT_00c7e818 != (code *)0x0)) { (*DAT_00c7e818)(extraDataPtr); } } *GHIDRA_CAST((GHIDRA_CAST(extraDataPtr) + 4)) = extraDataRef; *(void **)extraDataPtr = extraData; ExceptionList = local_10; return; } // 004361f0 void * Entity_Familiar::Player() { return this->_player; } // 00436330 void Entity_Familiar::WispInit() { EntityPtr *node; code *pcVar1; EntityPtr EVar2; EntityPtr EVar3; EntityPtr EVar4; byte bVar5; Vector *randomDir; void *pvVar6; LayerState *layer; int *effectEntry; KColor *rgbColor; byte rngShift2; byte rngShift3; int collectibleId; ANM2 *extraout_ECX; ANM2 *this_00; ColorMod *layerColor; Game *game; uint uVar7; uint wispSubtype; float fVar8; float fVar9; float fVar10; float fVar11; undefined4 local_a4; undefined4 local_a0; undefined4 local_9c; undefined4 local_98; float local_94; KColor local_90; Vector local_7c; EntityPtr i; undefined8 local_6c; int *wispsByAge; uint wispsByAgeSize; float *local_58; EntityPtr *local_54; ColorMod wispColor; void *local_1c; undefined1 *puStack_18; undefined4 local_14; uint *playerFlagWord; local_14 = 0xffffffff; puStack_18 = &LAB_00af219d; local_1c = ExceptionList; ExceptionList = &local_1c; local_58 = GHIDRA_CAST(this->_subtype); if (this->_variant == 0xed) { bVar5 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x248,0); if (bVar5 == 0) { this->_wispCollectibleType = 0x2c8; local_58 = GHIDRA_CAST(0x2c8); } else { this->_wispCollectibleType = 0x10012; local_58 = GHIDRA_CAST(0x10012); } } if ((this->_variant == 0xce) && ((local_58 == GHIDRA_CAST(0x203) || (local_58 == GHIDRA_CAST(0x1ea))))) { this->_wispCollectibleType = GHIDRA_INT(local_58); local_58 = GHIDRA_CAST(GetRandomWisp(&this->_dropRNG)); this->_subtype = GHIDRA_INT(local_58); } wispSubtype = GHIDRA_UINT(local_58); if (local_58 < 0x1e5) { if (local_58 == GHIDRA_CAST(0x1e4)) goto switchD_00436422_caseD_6f; if (0x121 < local_58) { switch(local_58) { case GHIDRA_CAST(0x126): case GHIDRA_CAST(0x152): case GHIDRA_CAST(0x1a5): goto switchD_00436422_caseD_6f; case GHIDRA_CAST(0x1ab): this->_entityCollisionClass = 0; this->_entityGridCollisionClass = 3; this->_isInvicible = 1; this->_isNotCountedAsFollower = 1; randomDir = MusicManager::RandomVector(&local_7c); (this->_velocity).x = randomDir->x; (this->_velocity).y = randomDir->y; } goto switchD_00436422_caseD_67; } if (local_58 == GHIDRA_CAST(0x121)) { switchD_00436422_caseD_6f: this->_isNotCountedAsFollower = 1; goto switchD_004364c6_caseD_1e8; } switch(local_58) { case GHIDRA_CAST(0x66): if (this->_coins == 0) { uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(6); this->_coins = uVar7 + 1; } break; case GHIDRA_CAST(0x6f): case GHIDRA_CAST(0xa4): goto switchD_00436422_caseD_6f; case GHIDRA_CAST(0x11a): goto switchD_00436422_caseD_11a; } goto switchD_00436422_caseD_67; } switch(local_58) { case GHIDRA_CAST(0x1e7): this->_entityCollisionClass = 0; this->_isInvicible = 1; if (this->_target != (EntityPtr)0x0) { local_54 = &this->_target; std::multiset::erase(&local_54); } this->_target = (EntityPtr)0x0; break; default: goto switchD_004364c6_caseD_1e8; case GHIDRA_CAST(0x1f8): case GHIDRA_CAST(0x25c): case GHIDRA_CAST(0x2c1): case GHIDRA_CAST(0x2c5): case GHIDRA_CAST(0x2d2): case GHIDRA_CAST(0x2d9): goto switchD_00436422_caseD_6f; case GHIDRA_CAST(0x22d): playerFlagWord = GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1574)); *playerFlagWord = *playerFlagWord | 0x400; *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1518)) = 1; break; case GHIDRA_CAST(0x261): this->_isInvicible = 1; break; case GHIDRA_CAST(0x27b): (this->_pos).y = (this->_pos).y + 1.0; switchD_00436422_caseD_11a: (this->_targetPosition).x = (this->_pos).x; (this->_targetPosition).y = (this->_pos).y; this->_isNotCountedAsFollower = 1; wispsByAge = GHIDRA_CAST(0x0); wispsByAgeSize = 0; wispsByAge = operator_new(0x18); *wispsByAge = GHIDRA_INT(wispsByAge); wispsByAge[1] = GHIDRA_INT(wispsByAge); wispsByAge[2] = GHIDRA_INT(wispsByAge); *GHIDRA_CAST((wispsByAge + 3)) = 0x101; local_14 = 0; i = (EntityPtr)0x0; local_54 = g_game->_room; game = g_game; if (local_54[0x499] != (EntityPtr)0x0) { do { fVar8 = *GHIDRA_CAST((GHIDRA_INT(local_54[0x497]) + GHIDRA_INT(i) * 4)); if ((((fVar8 != 0.0) && (*GHIDRA_CAST((GHIDRA_CAST(fVar8) + 0x28)) == 3)) && (*GHIDRA_CAST((GHIDRA_CAST(fVar8) + 0x2c)) == 0xce)) && ((*(void **)(GHIDRA_CAST(fVar8) + 0x410) == this->_player && (*GHIDRA_CAST((GHIDRA_CAST(fVar8) + 0x30)) == wispSubtype)))) { local_7c.x = (float)(*GHIDRA_CAST((GHIDRA_CAST(fVar8) + 0x328)) - game->_frameCount); local_7c.y = fVar8; FUN_0043ed20(GHIDRA_INT(&local_6c) + 4,&local_7c); game = g_game; } i = (EntityPtr)(GHIDRA_INT(i) + 1); } while (GHIDRA_UINT(i) < GHIDRA_UINT(local_54[0x499])); } if (5 < wispsByAgeSize) { do { local_a4 = 0; local_a0 = 0; local_9c = 0; local_98 = 0; local_94 = g_vectorZero.x; local_90._red = g_vectorZero.y; local_90._green = g_vectorZero.x; local_90._blue = g_vectorZero.y; local_90._alpha = 0.0; local_90._unk = 0; (**(code **)(**GHIDRA_CAST((*wispsByAge + 0x14)) + 0x24))(&local_a4); node = GHIDRA_CAST(*wispsByAge); local_54 = node; std:: _Tree_unchecked_const_iterator_>,std::_Iterator_base0> ::operator++((_Tree_unchecked_const_iterator_>,std::_Iterator_base0> *)&local_54); pvVar6 = std_tree_extract(&wispsByAge,node); operator_delete(pvVar6,0x18); } while (5 < wispsByAgeSize); wispSubtype = GHIDRA_UINT(local_58); } local_14 = 0xffffffff; FID_conflict__Erase_tree_>_> (&wispsByAge,(fuzzer_allocator_> *)&wispsByAge, (_Tree_node *)wispsByAge[1]); operator_delete(wispsByAge,0x18); switchD_004364c6_caseD_1e8: if (wispSubtype == 0x2c8) { uVar7 = this->_subtype; if (uVar7 < 0xf7) { if (uVar7 == 0xf6) { (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::ApplyBlueMapEffect(); } else { if (uVar7 == 0x15) goto LAB_00436776; if (uVar7 == 0x36) { (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::ApplyMapEffect(); } } } else if (uVar7 == 0x14d) { (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::ApplyMapEffect(); (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::ApplyBlueMapEffect(); LAB_00436776: (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::ApplyCompassEffect(1); } } } switchD_00436422_caseD_67: if (this->_variant == 0xed) { collectibleId = this->_wispCollectibleType; } else if (this->_variant == 0xce) { collectibleId = this->_subtype; } else { collectibleId = 0x248; } local_58 = ItemConfig::get_wisp_config(collectibleId); fVar8 = *local_58; this->_maxHitPoints = fVar8; this->_health = fVar8; fVar8 = local_58[0x61]; if (fVar8 != 0.0) { (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,GHIDRA_CAST((local_58 + 0x5d))); } this_00 = &this->_sprite; if (local_58[0x5b] == 0.0) { if (fVar8 == 0.0) goto LAB_0043680d; } else { (GHIDRA_CAST((GHIDRA_CAST(this_00))))->Sprite::ReplaceSpritesheet(1,GHIDRA_CAST((local_58 + 0x57))); this_00 = extraout_ECX; } (GHIDRA_CAST((&this->_sprite)))->ANM2::LoadGraphics((byte)this_00); LAB_0043680d: local_54 = GHIDRA_CAST((local_58 + 0x36)); layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); if (&layer->_color != GHIDRA_CAST(local_54)) { EVar2 = local_54[1]; EVar3 = local_54[2]; EVar4 = local_54[3]; (layer->_color)._tint[0] = (float)*local_54; *GHIDRA_CAST(((layer->_color)._tint + 1)) = EVar2; *GHIDRA_CAST(((layer->_color)._tint + 2)) = EVar3; *GHIDRA_CAST(((layer->_color)._tint + 3)) = EVar4; EVar2 = local_54[5]; EVar3 = local_54[6]; EVar4 = local_54[7]; (layer->_color)._colorize[0] = (float)local_54[4]; *GHIDRA_CAST(((layer->_color)._colorize + 1)) = EVar2; *GHIDRA_CAST(((layer->_color)._colorize + 2)) = EVar3; *GHIDRA_CAST(((layer->_color)._colorize + 3)) = EVar4; *GHIDRA_CAST((layer->_color)._offset) = *GHIDRA_CAST((local_54 + 8)); *GHIDRA_CAST(((layer->_color)._offset + 2)) = local_54[10]; } local_54 = GHIDRA_CAST((local_58 + 0x2b)); layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x1)); if (&layer->_color != GHIDRA_CAST(local_54)) { EVar2 = local_54[1]; EVar3 = local_54[2]; EVar4 = local_54[3]; (layer->_color)._tint[0] = (float)*local_54; *GHIDRA_CAST(((layer->_color)._tint + 1)) = EVar2; *GHIDRA_CAST(((layer->_color)._tint + 2)) = EVar3; *GHIDRA_CAST(((layer->_color)._tint + 3)) = EVar4; EVar2 = local_54[5]; EVar3 = local_54[6]; EVar4 = local_54[7]; (layer->_color)._colorize[0] = (float)local_54[4]; *GHIDRA_CAST(((layer->_color)._colorize + 1)) = EVar2; *GHIDRA_CAST(((layer->_color)._colorize + 2)) = EVar3; *GHIDRA_CAST(((layer->_color)._colorize + 3)) = EVar4; *GHIDRA_CAST((layer->_color)._offset) = *GHIDRA_CAST((local_54 + 8)); *GHIDRA_CAST(((layer->_color)._offset + 2)) = local_54[10]; } if (wispSubtype == 0x2bf) { pvVar6 = this->_player; if (*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x1519)) == '\0') { for (effectEntry = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x150c)); effectEntry != *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x1510)); effectEntry = effectEntry + 4) { if ((*GHIDRA_CAST(*effectEntry) == 0) && ((GHIDRA_CAST(*effectEntry))[1] == 100)) { this->_coins = 1; wispColor._offset[0] = -2.0078433; wispColor._offset[1] = -2.0078433; wispColor._offset[2] = -2.0078433; layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); if (&layer->_color != &wispColor) { (layer->_color)._tint[0] = (float)0x40323232; (layer->_color)._tint[1] = (float)0x40323232; (layer->_color)._tint[2] = (float)0x40323232; (layer->_color)._tint[3] = 1.0; (layer->_color)._colorize[0] = 0.0; (layer->_color)._colorize[1] = 0.0; (layer->_color)._colorize[2] = 0.0; (layer->_color)._colorize[3] = 0.0; *GHIDRA_CAST((layer->_color)._offset) = CONCAT44(wispColor._offset[1],wispColor._offset[0]); (layer->_color)._offset[2] = wispColor._offset[2]; } wispColor._offset[0] = 0.0; wispColor._offset[1] = 0.0; wispColor._offset[2] = 0.0; layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x1)); layerColor = &layer->_color; if (layerColor != &wispColor) { fVar8 = 0.078431375; fVar9 = 0.078431375; fVar10 = 0.078431375; fVar11 = 1.0; goto LAB_00436ceb; } break; } } } } else if (wispSubtype == 0x7b) { uVar7 = this->_initSeed; local_6c = 0xb00000009; local_58 = GHIDRA_CAST(&DAT_00000013); if (uVar7 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar7 = uVar7 >> 9 ^ uVar7; uVar7 = uVar7 << 0xb ^ uVar7; uVar7 = uVar7 >> 0x13 ^ uVar7; local_54 = (EntityPtr *) ((float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283062e-10); if (uVar7 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar7 = uVar7 >> 9 ^ uVar7; uVar7 = uVar7 << 0xb ^ uVar7; uVar7 = uVar7 >> 0x13 ^ uVar7; local_54 = (EntityPtr *) ((((float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283062e-10 + (float)local_54) - 1.0) * 0.2 + 0.8); if (uVar7 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar7 = uVar7 >> 9 ^ uVar7; uVar7 = uVar7 << 0xb ^ uVar7; uVar7 = uVar7 >> 0x13 ^ uVar7; hsv_to_rgb(&local_90, (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283062e-10 * 360.0,(float)local_54,0.8,1.0); wispColor._tint[0] = local_90._red * 2.0; wispColor._offset[0] = 0.0; wispColor._offset[1] = 0.0; wispColor._tint[1] = local_90._green * 2.0; wispColor._offset[2] = 0.0; wispColor._tint[3] = 1.0; wispColor._tint[2] = local_90._blue * 2.0; layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); if (&layer->_color != &wispColor) { (layer->_color)._tint[0] = wispColor._tint[0]; (layer->_color)._tint[1] = wispColor._tint[1]; (layer->_color)._tint[2] = wispColor._tint[2]; (layer->_color)._tint[3] = wispColor._tint[3]; (layer->_color)._colorize[0] = 0.0; (layer->_color)._colorize[1] = 0.0; (layer->_color)._colorize[2] = 0.0; (layer->_color)._colorize[3] = 0.0; *GHIDRA_CAST((layer->_color)._offset) = CONCAT44(wispColor._offset[1],wispColor._offset[0]); (layer->_color)._offset[2] = wispColor._offset[2]; } if (uVar7 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } bVar5 = (byte)local_6c; uVar7 = uVar7 >> (bVar5 & 0x1f) ^ uVar7; rngShift2 = (byte)((ulonglong)local_6c >> 0x20); uVar7 = uVar7 << (rngShift2 & 0x1f) ^ uVar7; rngShift3 = (byte)local_58; uVar7 = uVar7 >> (rngShift3 & 0x1f) ^ uVar7; local_54 = (EntityPtr *) ((float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283062e-10); if (uVar7 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar7 = uVar7 >> (bVar5 & 0x1f) ^ uVar7; uVar7 = uVar7 << (rngShift2 & 0x1f) ^ uVar7; uVar7 = uVar7 >> (rngShift3 & 0x1f) ^ uVar7; local_54 = (EntityPtr *) ((((float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283062e-10 + (float)local_54) - 1.0) * 0.2 + 0.8); if (uVar7 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar7 = uVar7 >> (bVar5 & 0x1f) ^ uVar7; uVar7 = uVar7 << (rngShift2 & 0x1f) ^ uVar7; uVar7 = uVar7 >> (rngShift3 & 0x1f) ^ uVar7; rgbColor = hsv_to_rgb(&local_90, (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)] ) * 2.3283062e-10 * 360.0,(float)local_54,0.8,1.0); wispColor._offset[0] = 0.0; wispColor._offset[1] = 0.0; wispColor._offset[2] = 0.0; wispColor._tint[3] = 1.0; wispColor._tint[0] = rgbColor->_red * 2.0; wispColor._tint[1] = rgbColor->_green * 2.0; wispColor._tint[2] = rgbColor->_blue * 2.0; layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x1)); layerColor = &layer->_color; if (layerColor != &wispColor) { fVar8 = wispColor._tint[0]; fVar9 = wispColor._tint[1]; fVar10 = wispColor._tint[2]; fVar11 = wispColor._tint[3]; LAB_00436ceb: layerColor->_tint[0] = fVar8; layerColor->_tint[1] = fVar9; layerColor->_tint[2] = fVar10; layerColor->_tint[3] = fVar11; layerColor->_colorize[0] = 0.0; layerColor->_colorize[1] = 0.0; layerColor->_colorize[2] = 0.0; layerColor->_colorize[3] = 0.0; *GHIDRA_CAST(layerColor->_offset) = CONCAT44(wispColor._offset[1],wispColor._offset[0]); layerColor->_offset[2] = wispColor._offset[2]; } } if (this->_variant == 0xed) { (GHIDRA_CAST((this->_player)))->Entity_Player::RecomputeWispCollectibles(this); } (GHIDRA_CAST((g_game)))->Game::UpdateVisibility(); ExceptionList = local_1c; return; } // 00436fd0 undefined4 Entity_Familiar::wisp_kill() { float fVar1; void *pvVar2; code *pcVar3; Vector velocity; Vector targetPos; Entity *pEVar4; ANM2 *pAVar5; byte bVar6; uint uVar7; Vector *pVVar8; ColorMod *Color; ColorMod *color; EntityPtr EVar9; Entity_Laser *laser; Entity_Tear *tear; ColorMod *color_00; Entity_Player *pEVar10; undefined4 uVar11; EntityRef *ref; Entity *spawned; LayerState *layer; uint uVar12; Manager *manager; Entity_Familiar *pEVar13; float fVar14; float fVar15; Entity_Familiar *pEVar16; int iVar17; byte bVar18; byte isOnlyRunes; Color layer0Color; Color layer1Color; Vector VStack_94; void *wispConfig; Vector VStack_88; undefined1 auStack_80 [12]; Entity_Player *apEStack_74 [2]; Vector VStack_6c; undefined4 uStack_64; undefined1 auStack_60 [8]; float fStack_58; float fStack_54; float fStack_50; float fStack_4c; float fStack_48; float fStack_44; float fStack_40; float fStack_3c; float fStack_38; undefined1 auStack_34 [12]; undefined1 *queryCount; uint local_24; undefined1 *puStack_20; void *local_1c; undefined1 *puStack_18; undefined4 uStack_14; RNG *dropRng; uint *itemListEnd; int *queriedEnemy; Room *room; ColorMod *spawnedColor; puStack_20 = auStack_34 + 0x30; uStack_14 = 0xffffffff; puStack_18 = &LAB_00af21fd; local_1c = ExceptionList; uVar7 = __security_cookie ^ GHIDRA_UINT((auStack_34 + 0x24)); ExceptionList = &local_1c; if (this->_variant == 0xed) { iVar17 = this->_wispCollectibleType; } else if (this->_variant == 0xce) { iVar17 = this->_subtype; } else { iVar17 = 0x248; } uStack_64 = this; local_24 = uVar7; wispConfig = ItemConfig::get_wisp_config(iVar17); pEVar10 = GHIDRA_CAST(this->_subtype); apEStack_74[0] = pEVar10; if (GHIDRA_CAST(0x11f) < pEVar10) { if (pEVar10 < GHIDRA_CAST(0x222)) { if (pEVar10 == GHIDRA_CAST(0x221)) { apEStack_74[0] = GHIDRA_CAST(Random()); VStack_88.y = (float)this->_player; VStack_94.y = (float)Room::FindFreePickupSpawnPosition (g_game->_room,GHIDRA_CAST((auStack_34 + 8)),&this->_pos,0.0,0,0 ,0); uVar7 = (this->_dropRNG)._seed; if (uVar7 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); uVar7 = (this->_dropRNG)._seed; if (uVar7 == 0) { pcVar3 = (code *)swi(3); uVar11 = (*pcVar3)(); return uVar11; } } uVar7 = uVar7 >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ uVar7; uVar7 = uVar7 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar7; uVar12 = 0xe3; uVar7 = uVar7 >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ uVar7; (this->_dropRNG)._seed = uVar7; if (uVar7 == (uVar7 / 3) * 3) { uVar12 = 0x115; } spawned = (GHIDRA_CAST((g_game)))->Game::Spawn(uVar12,0,GHIDRA_CAST(VStack_94.y),&g_vectorZero, GHIDRA_CAST(VStack_88.y),0,GHIDRA_UINT(apEStack_74[0])); if ((spawned == GHIDRA_CAST(0x0)) || (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2 || (spawned->_type != 1)) && (0x3dd < spawned->_type - 10U)))) { spawned = GHIDRA_CAST(0x0); } bVar18 = 0; bVar6 = 0; iVar17 = -1; ref = (GHIDRA_CAST((GHIDRA_CAST((auStack_60 + 4)))))->EntityRef::EntityRef(); (GHIDRA_CAST((spawned)))->Entity::AddCharmed(ref,iVar17,bVar6,bVar18); spawned->Update(); (GHIDRA_CAST((spawned)))->Entity::SetVisibleFlag(0); fVar14 = spawned->_maxHitPoints + spawned->_maxHitPoints; VStack_6c.y = 3.71344e-43; spawned->_maxHitPoints = fVar14; spawned->_health = fVar14; manager = g_manager; seed_fart_sound_override(GHIDRA_CAST(&VStack_6c.y)); pEVar13 = GHIDRA_CAST(VStack_6c.y); goto code_r0x00437295; } switch(pEVar10) { case GHIDRA_CAST(0x120): apEStack_74[0] = this->_player; room = g_game->_room; pVVar8 = MusicManager::RandomVector(GHIDRA_CAST((auStack_34 + 8))); uVar7 = Random(); fVar14 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283064e-10 * 80.0 + 40.0; VStack_88.y = fVar14 * pVVar8->y + (uStack_64->_pos).y; VStack_88.x = fVar14 * pVVar8->x + (uStack_64->_pos).x; pVVar8 = Room::FindFreePickupSpawnPosition(room,&VStack_94,&VStack_88,40.0,0,0,0); this = uStack_64; (GHIDRA_CAST((apEStack_74[0])))->Entity_Player::ThrowBlueSpider(&uStack_64->_pos,pVVar8); break; case GHIDRA_CAST(0x122): apEStack_74[0] = GHIDRA_CAST((GHIDRA_CAST((&this->_dropRNG)))->RNG)::RandomFloat(); if ((float)apEStack_74[0] < 0.25) { KAGE_LogMessage(1,GHIDRA_CAST("Spawn heart!")); uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); pVVar8 = Room::FindFreePickupSpawnPosition (g_game->_room,GHIDRA_CAST((auStack_34 + 8)),&this->_pos,0.0,0,0,0); spawned = (GHIDRA_CAST((g_game)))->Game::Spawn(5,10,pVVar8,&g_vectorZero,GHIDRA_CAST(this),2,uVar7); spawned[1]._sprite._championColor._colorize[2] = 2.8026e-44; } break; case GHIDRA_CAST(0x125): EVar9 = (EntityPtr)FUN_00436260(); VStack_88.y = (float)EVar9; iVar17 = _get_index_plus_one_if_kind_4_5(); VStack_6c.y = 0.0; apEStack_74[0] = (Entity_Player *) ((float)(iVar17 + -1) * *GHIDRA_CAST((GHIDRA_CAST(EVar9) + 8)) + *GHIDRA_CAST((GHIDRA_CAST(EVar9) + 4))); do { laser = Entity_Laser::ShootAngle (1,&this->_pos,(float)GHIDRA_INT(VStack_6c.y) * 90.0,0x14,&this->_posOffset, GHIDRA_CAST(this),0); laser->_disableFollowParent = 1; (**(code **)(*GHIDRA_CAST(laser) + 0x40)) ((float)apEStack_74[0] * *GHIDRA_CAST((GHIDRA_CAST(VStack_88.y) + 0x18))); laser->_scale = 0.5; (GHIDRA_CAST((laser)))->Entity_Laser::ResetSpriteScale(); laser->Update(); VStack_6c.y = (float)(GHIDRA_INT(VStack_6c.y) + 1); } while (GHIDRA_INT(VStack_6c.y) < 4); break; case GHIDRA_CAST(0x127): uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(10); if (uVar7 == 0) { uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); fVar14 = 0.0; LAB_0043785e: pVVar8 = Room::FindFreePickupSpawnPosition (g_game->_room,GHIDRA_CAST((auStack_34 + 8)),&this->_pos,fVar14,0,0,0); (GHIDRA_CAST((g_game)))->Game::Spawn(5,0x14,pVVar8,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); } break; case GHIDRA_CAST(0x15c): EntityList::QuerySublist (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(auStack_80),3,-1,-1,1 ,0); uVar7 = 0; uStack_14 = 2; if (apEStack_74[0] != GHIDRA_CAST(0x0)) { do { if (*(void **)(*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(auStack_80)) + 0x4))) + uVar7 * 4)) + 0x410) == this->_player) { farting_baby_fart(); } uVar7 = uVar7 + 1; } while (uVar7 < apEStack_74[0]); } uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); pVVar8 = Room::FindFreePickupSpawnPosition (g_game->_room,GHIDRA_CAST((auStack_34 + 8)),&this->_pos,0.0,0,0,0); (GHIDRA_CAST((g_game)))->Game::Spawn(5,0x46,pVVar8,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); uStack_14 = 0xffffffff; (GHIDRA_CAST((auStack_80)))->EntityList_Query::~EntityList_Query(); break; case GHIDRA_CAST(0x15d): uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(2); if (uVar7 == 0) { uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); fVar14 = 40.0; goto LAB_0043785e; } break; case GHIDRA_CAST(0x15f): ::(GHIDRA_CAST((GHIDRA_CAST(auStack_60))))->Color::Color(); pVVar8 = &this->_pos; (GHIDRA_CAST((g_game)))->Game::Fart(pVVar8,160.0,this->_player,0.5,0,color_00); Game::ButterBeanFart(g_game,pVVar8,200.0,this->_player,0,0); EntityList::QueryRadius (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(auStack_34),pVVar8, 180.0,8); uVar7 = 0; uStack_14 = 0; if (queryCount != GHIDRA_CAST(0x0)) { do { apEStack_74[0] = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x4))) + uVar7 * 4)); bVar6 = (GHIDRA_CAST((GHIDRA_CAST(apEStack_74[0]))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); if (bVar6 != 0) { (GHIDRA_CAST((GHIDRA_CAST((auStack_60 + 4)))))->EntityRef::constructor(this->_player); (GHIDRA_CAST((GHIDRA_CAST(apEStack_74[0]))))->Entity::AddFreeze(GHIDRA_CAST((auStack_60 + 4)),-0x32,0); } uVar7 = uVar7 + 1; } while (uVar7 < queryCount); } uStack_14 = 0xffffffff; (GHIDRA_CAST((auStack_34)))->EntityList_Query::~EntityList_Query(); break; case GHIDRA_CAST(0x160): if (DAT_00c7e83c == '\0') { DAT_00c7e83c = 1; EntityList::QuerySublist (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(auStack_34),3,0xce, 0x160,0,0); uStack_14 = 1; VStack_6c.y = 0.0; if (queryCount != GHIDRA_CAST(0x0)) { uVar11 = (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x4))); do { queriedEnemy = *GHIDRA_CAST((uVar11 + GHIDRA_INT(VStack_6c.y) * 4)); if (*GHIDRA_CAST((GHIDRA_CAST(queriedEnemy) + 0x173)) == '\0') { (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_60)) + 0x4))) = 0.0; fStack_58 = 0.0; fStack_48 = g_vectorZero.y; fStack_40 = g_vectorZero.y; fStack_54 = 0.0; fStack_50 = 0.0; fStack_4c = g_vectorZero.x; fStack_44 = g_vectorZero.x; fStack_3c = 0.0; fStack_38 = 0.0; (**(code **)(*queriedEnemy + 0x24))(auStack_60 + 4); } VStack_6c.y = (float)&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(VStack_6c.y)))) + 0x1))); } while (GHIDRA_UINT(VStack_6c.y) < queryCount); this = uStack_64; } DAT_00c7e83c = '\0'; uStack_14 = 0xffffffff; (GHIDRA_CAST((auStack_34)))->EntityList_Query::~EntityList_Query(); } break; case GHIDRA_CAST(0x17f): Entity_Player::UseActiveItem(this->_player,GHIDRA_CAST((GHIDRA_INT(&uStack_64) + 2)),0x17f,9,-1,0); uVar7 = Random(); uStack_64 = GHIDRA_CAST(0x0); VStack_88.y = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283064e-10 * 360.0 - 180.0; do { pEVar10 = this->_player; VStack_6c.y = pEVar10->_shotspeed * 10.0; apEStack_74[0] = GHIDRA_CAST((((float)uStack_64 + VStack_88.y) * 0.017453292)); VStack_94.x = cos((float)apEStack_74[0]); VStack_94.x = VStack_94.x * VStack_6c.y; fVar14 = sin((float)apEStack_74[0]); VStack_94.y = fVar14 * VStack_6c.y; velocity.y = VStack_94.y; velocity.x = VStack_94.x; tear = Entity_Player::FireTear(pEVar10,&this->_pos,velocity,6,GHIDRA_CAST(0x0),1.0); fVar14 = (this->_pos).x; (tear->_targetPosition).y = (this->_pos).y; uStack_64 = GHIDRA_CAST(((float)uStack_64 + 60.0)); (tear->_targetPosition).x = fVar14; } while ((float)uStack_64 < 360.0); break; case GHIDRA_CAST(0x18c): if (this->_parent != (EntityPtr)0x0) { iVar17 = *GHIDRA_CAST((GHIDRA_CAST(this->_parent) + 0x30)); FUN_0074a280(iVar17,*GHIDRA_CAST((g_game->_ventricleRazorPortals + iVar17 * 0xc + 4)),0); } break; case GHIDRA_CAST(0x1a5): Game::CharmFart(&this->_pos,80.0,GHIDRA_CAST(this)); break; case GHIDRA_CAST(0x1b5): Entity_Player::UseActiveItem(this->_player,GHIDRA_CAST((GHIDRA_INT(&uStack_64) + 2)),0x1b5,9,-1,0); pEVar10 = GHIDRA_CAST(this->_subtype); goto code_r0x00437e10; case GHIDRA_CAST(0x1de): (GHIDRA_CAST((g_game->_room)))->Room::SetPauseTimer(0x5a); break; case GHIDRA_CAST(0x1df): uVar7 = Random(); if ((uVar7 & 3) == 0) { uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); pVVar8 = Room::FindFreePickupSpawnPosition (g_game->_room,GHIDRA_CAST((auStack_34 + 8)),&this->_pos,0.0,0,0,0); (GHIDRA_CAST((g_game)))->Game::Spawn(5,0x15e,pVVar8,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); } break; case GHIDRA_CAST(0x1e3): uVar7 = Random(); pVVar8 = Room::FindFreePickupSpawnPosition (g_game->_room,GHIDRA_CAST((auStack_34 + 8)),&this->_pos,0.0,0,0,0); (GHIDRA_CAST((g_game)))->Game::Spawn(4,0x12,pVVar8,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); break; case GHIDRA_CAST(0x1e4): uVar7 = Random(); spawned = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0x3d,&this->_pos,&g_vectorZero,this->_player,0,uVar7); VStack_88.y = (float)this->_player; if (spawned->_parent != (EntityPtr)0x0) { apEStack_74[0] = GHIDRA_CAST(&spawned->_parent); std::multiset::erase(apEStack_74); } spawned->_parent = (EntityPtr)VStack_88.y; if ((EntityPtr)VStack_88.y != (EntityPtr)0x0) { std::multiset::insert(&spawned->_parent); } *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(spawned[1])) + 0x44)))) = this->_size; pEVar4 = spawned + 1; (pEVar4->_sprite)._filename._buf[0] = '\0'; (pEVar4->_sprite)._filename._buf[1] = '\0'; (pEVar4->_sprite)._filename._buf[2] = -0x4c; (pEVar4->_sprite)._filename._buf[3] = 'B'; pAVar5 = &spawned[1]._sprite; (pAVar5->_filename)._buf[4] = '\n'; (pAVar5->_filename)._buf[5] = '\0'; (pAVar5->_filename)._buf[6] = '\0'; (pAVar5->_filename)._buf[7] = '\0'; pAVar5 = &spawned[1]._sprite; (pAVar5->_filename)._buf[8] = '\n'; (pAVar5->_filename)._buf[9] = '\0'; (pAVar5->_filename)._buf[10] = '\0'; (pAVar5->_filename)._buf[0xb] = '\0'; case GHIDRA_CAST(0x126): Game::ButterBeanFart(g_game,&this->_pos,80.0,this->_player,1,1); break; case GHIDRA_CAST(0x1e5): if (DAT_00c7e83d == '\0') { DAT_00c7e83d = 1; uVar12 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(2); if (uVar12 == 0) { EntityList::QuerySublist (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(auStack_34),3, 0xce,-1,0,0); uVar7 = 0; uStack_14 = 3; if (queryCount != GHIDRA_CAST(0x0)) { do { if (*GHIDRA_CAST((*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x4))) + uVar7 * 4)) + 0x173)) == '\0') { pEVar10 = this->_player; (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_80)) + 0x8))) = (pEVar10->_pos).x; apEStack_74[0] = GHIDRA_CAST((pEVar10->_pos).y); Entity_Player::AddWisp (pEVar10,*GHIDRA_CAST((*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x4))) + uVar7 * 4)) + 0x30)), GHIDRA_CAST((auStack_80 + 8)),0,0); } uVar7 = uVar7 + 1; } while (uVar7 < queryCount); } } else { EntityList::QuerySublist (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(auStack_34),3, 0xce,-1,0,0); uStack_14 = 4; if (queryCount != GHIDRA_CAST(0x0)) { uVar12 = 0; do { (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_60)) + 0x4))) = 0.0; fStack_58 = 0.0; fStack_54 = 0.0; fStack_48 = g_vectorZero.y; fStack_40 = g_vectorZero.y; fStack_50 = 0.0; fStack_4c = g_vectorZero.x; fStack_44 = g_vectorZero.x; fStack_3c = 0.0; fStack_38 = 0.0; (**(code **)(**GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x4))) + uVar12 * 4)) + 0x24)) (auStack_60 + 4,uVar7); uVar12 = uVar12 + 1; } while (uVar12 < queryCount); this = uStack_64; } } uStack_14 = 0xffffffff; (GHIDRA_CAST((auStack_34)))->EntityList_Query::~EntityList_Query(); DAT_00c7e83d = '\0'; } break; case GHIDRA_CAST(0x20b): uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); pVVar8 = Room::FindFreePickupSpawnPosition (g_game->_room,GHIDRA_CAST((auStack_34 + 8)),&this->_pos,0.0,0,0,0); (GHIDRA_CAST((g_game)))->Game::Spawn(5,0,pVVar8,&g_vectorZero,GHIDRA_CAST(this),4,uVar7); } } else { switch(pEVar10) { case GHIDRA_CAST(0x10006): case GHIDRA_CAST(0x10007): case GHIDRA_CAST(0x10008): case GHIDRA_CAST(0x10009): code_r0x00437e10: FUN_0043d7f0(&(*GHIDRA_CAST((GHIDRA_CAST(&(pEVar10[-1])) + 0x2eff)))); this->_health = this->_maxHitPoints; ExceptionList = local_1c; return 0; } } goto LAB_004372a0; } if (pEVar10 == GHIDRA_CAST(0x11f)) { (GHIDRA_CAST((this->_player)))->Entity_Player::trigger_cracked_orb(&this->_pos); goto LAB_004372a0; } switch(pEVar10) { case GHIDRA_CAST(0x23): Entity_Player::UseActiveItem(this->_player,GHIDRA_CAST((GHIDRA_INT(&uStack_64) + 2)),0x23,9,-1,0); break; case GHIDRA_CAST(0x25): case GHIDRA_CAST(0x41): dropRng = &this->_dropRNG; VStack_94.y = (float)(GHIDRA_CAST((dropRng)))->RNG::Next(); VStack_88.y = (float)this->_player; uVar7 = (GHIDRA_CAST((dropRng)))->RNG::Next(); pVVar8 = RandomVector(GHIDRA_CAST((auStack_34 + 8)),uVar7); fVar14 = (GHIDRA_CAST((dropRng)))->RNG::RandomFloat(); this = uStack_64; VStack_6c.x = fVar14 * 2.0 + 2.0; VStack_6c.y = VStack_6c.x * pVVar8->y; VStack_6c.x = VStack_6c.x * pVVar8->x; uVar7 = 0; if (apEStack_74[0] == GHIDRA_CAST(0x41)) { uVar7 = 3; } spawned = (GHIDRA_CAST((g_game)))->Game::Spawn(4,uVar7,&uStack_64->_pos,&VStack_6c,GHIDRA_CAST(VStack_88.y),0, GHIDRA_UINT(VStack_94.y)); (GHIDRA_CAST((this->_player)))->Entity_Player::GetBombFlags(GHIDRA_CAST(auStack_80),0); if (this->_subtype == 0x25) { (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_80)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_80)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_80)) + 0x8))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_80)) + 0x8))) | GHIDRA_UINT(g_tearFlagHoming._h); (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_80)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_80)) + 0x0))) | GHIDRA_UINT(g_tearFlagHoming._l); apEStack_74[0] = GHIDRA_CAST((GHIDRA_UINT(apEStack_74[0]) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._h)) + 0x4))))); } spawned[1]._sprite._filename._buf[0xb] = '\x01'; spawned[1]._type = (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_80)) + 0x0))); spawned[1]._variant = (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_80)) + 0x4))); spawned[1]._subtype = (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_80)) + 0x8))); spawned[1]._spawnerType = GHIDRA_INT(apEStack_74[0]); if (this->_subtype == 0x25) { spawned[1]._collisionIndex = 0x3f266666; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(spawned[1])) + 0x3c)))) = 0x3f400000; uVar7 = Random(); (spawned->_posOffset).x = 0.0; (spawned->_posOffset).y = -3.0; spawned[1]._damageEvents._end = (void *)(-3.0 - (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283064e-10 * 5.0); } uVar11 = *GHIDRA_CAST((GHIDRA_INT(&spawned->_flags) + 4)); *GHIDRA_CAST(&spawned->_flags) = GHIDRA_UINT(spawned->_flags) | 0x4000000; *GHIDRA_CAST((GHIDRA_INT(&spawned->_flags) + 4)) = uVar11; spawned->Update(); break; case GHIDRA_CAST(0x28): pvVar2 = this->_player; uStack_64 = GHIDRA_CAST(((this->_pos).x - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x33c)))); VStack_6c.y = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x340)); fVar14 = sqrtf((float)uStack_64 * (float)uStack_64 + VStack_6c.y * VStack_6c.y); if (70.0 <= fVar14) { pEVar16 = uStack_64; pEVar13 = GHIDRA_CAST(VStack_6c.y); } else { pEVar16 = GHIDRA_CAST(((float)uStack_64 * (70.0 / fVar14))); pEVar13 = GHIDRA_CAST((VStack_6c.y * (70.0 / fVar14))); } ::(GHIDRA_CAST((GHIDRA_CAST(auStack_60))))->Color::Color(); VStack_88.x = (float)pEVar16 + *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x33c)); VStack_88.y = (float)pEVar13 + *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x340)); Game::BombExplosionEffects (g_game,&VStack_88,30.0,(BitSet128)ZEXT816(0),Color,GHIDRA_CAST(this),0.75,1,4,0); break; case GHIDRA_CAST(0x42): pvVar2 = (g_manager->_itemConfig)._collectibles._begin; if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar2) & 0xfffffffcU)) < 0x109) { (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x0))) = 0; } else { (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x108)); } queryCount = GHIDRA_CAST(0x0); (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x4))) = 0; (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x8))) = 0x5a; (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x7310)))))->TemporaryEffects::AddEffect(auStack_34,1,1); manager = g_manager; fVar14 = (GHIDRA_CAST((g_game->_room)))->Room::time_scale_update(); (manager->_musicManager)._targetPitch = fVar14; break; case GHIDRA_CAST(0x4e): TemporaryEffects::AddCollectibleEffect (GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1508)),0x20e,1,1); uVar7 = Random(); spawned = (GHIDRA_CAST((g_game)))->Game::Spawn(3,0x7a,&this->_pos,&g_vectorZero,this->_player,0,uVar7); if ((spawned == GHIDRA_CAST(0x0)) || (spawned->_type != 3)) { spawned = GHIDRA_CAST(0x0); } spawned->Update(); (GHIDRA_CAST((this->_player)))->Entity_Player::EvaluateItems(); manager = g_manager; uStack_64 = GHIDRA_CAST(0x109); seed_fart_sound_override(&uStack_64); pEVar13 = uStack_64; code_r0x00437295: (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(pEVar13),1.0,2,0,1.0,0.0); break; case GHIDRA_CAST(0x55): uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); iVar17 = ItemPool::GetCardEx(uVar7,0x19,0,10,1); isOnlyRunes = 0; bVar18 = 0; bVar6 = 1; goto LAB_004372ff; case GHIDRA_CAST(0x66): uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); pVVar8 = Room::FindFreePickupSpawnPosition (g_game->_room,GHIDRA_CAST((auStack_34 + 8)),&this->_pos,40.0,0,0,0); (GHIDRA_CAST((g_game)))->Game::Spawn(5,0x46,pVVar8,&g_vectorZero,GHIDRA_CAST(this),0,uVar7); if (this->_coins == 6) { targetPos.y = g_vectorZero.y; targetPos.x = g_vectorZero.x; Entity_NPC::ThrowSpider(&this->_pos,GHIDRA_CAST(0x0),targetPos,0,-30.0); } break; case GHIDRA_CAST(0x6f): ::(GHIDRA_CAST((GHIDRA_CAST(auStack_60))))->Color::Color(); (GHIDRA_CAST((g_game)))->Game::Fart(&this->_pos,85.0,GHIDRA_CAST(this),1.0,0,color); Game::ButterBeanFart(g_game,&this->_pos,120.0,this->_player,0,0); break; case GHIDRA_CAST(0x91): spawned = (GHIDRA_CAST((this->_player)))->Entity_Player::AddBlueFlies(1,&this->_pos,GHIDRA_CAST(0x0)); if (spawned != GHIDRA_CAST(0x0)) { iVar17 = __RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0); *GHIDRA_CAST((iVar17 + 0xd88)) = 0xf; pVVar8 = MusicManager::RandomVector(GHIDRA_CAST((auStack_34 + 8))); uVar7 = Random(); fVar15 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283064e-10; fVar14 = pVVar8->y; fVar1 = pVVar8->x; *GHIDRA_CAST((iVar17 + 0x188)) = 0; *GHIDRA_CAST((iVar17 + 0x364)) = fVar15 * fVar14 * 5.0; *GHIDRA_CAST((iVar17 + 0x360)) = fVar15 * fVar1 * 5.0; this = uStack_64; } break; case GHIDRA_CAST(0x107): uVar7 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); iVar17 = ItemPool::GetCardEx(uVar7,0,1,0,1); isOnlyRunes = 1; bVar18 = 1; bVar6 = 0; LAB_004372ff: queryCount = &DAT_00000007; (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x4))) = 5; (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x8))) = 9; (*GHIDRA_CAST((GHIDRA_CAST(&(auStack_34)) + 0x0))) = uVar7; uVar7 = lua_callback_run_get_card(GHIDRA_CAST(auStack_34),iVar17,bVar6,bVar18,isOnlyRunes); uVar12 = (GHIDRA_CAST((&uStack_64->_dropRNG)))->RNG::Next(); pVVar8 = Room::FindFreePickupSpawnPosition (g_game->_room,GHIDRA_CAST((auStack_34 + 8)),&uStack_64->_pos,40.0,0,0,0); this = uStack_64; (GHIDRA_CAST((g_game)))->Game::Spawn(5,300,pVVar8,&g_vectorZero,GHIDRA_CAST(uStack_64),uVar7,uVar12); } LAB_004372a0: pEVar10 = GHIDRA_CAST(this->_wispCollectibleType); if ((pEVar10 == GHIDRA_CAST(0x1ea)) || (pEVar10 == GHIDRA_CAST(0x203))) { pvVar2 = this->_player; itemListEnd = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1de0)); apEStack_74[0] = pEVar10; if (itemListEnd == *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1de4))) { std::vector::_Emplace_reallocate(itemListEnd,apEStack_74); } else { *itemListEnd = GHIDRA_UINT(pEVar10); *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1de0)) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x1de0)) + 4; } } uVar7 = Random(); spawned = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7); (spawned->_posOffset).x = 0.0; spawnedColor = &(spawned->_sprite)._color; (spawned->_posOffset).y = -6.0; if (0.0 < *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x110)) || *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x110)) == 0.0) { if (spawnedColor != GHIDRA_CAST((GHIDRA_INT(wispConfig) + 0x104))) { fVar14 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x108)); fVar1 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x10c)); fVar15 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x110)); spawnedColor->_tint[0] = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x104)); (spawned->_sprite)._color._tint[1] = fVar14; (spawned->_sprite)._color._tint[2] = fVar1; (spawned->_sprite)._color._tint[3] = fVar15; fVar14 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x118)); fVar1 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x11c)); fVar15 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x120)); (spawned->_sprite)._color._colorize[0] = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x114)); (spawned->_sprite)._color._colorize[1] = fVar14; (spawned->_sprite)._color._colorize[2] = fVar1; (spawned->_sprite)._color._colorize[3] = fVar15; *GHIDRA_CAST((spawned->_sprite)._color._offset) = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x124)); layer1Color._offset[2] = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 300)); goto LAB_00438335; } } else { ::(GHIDRA_CAST((&layer1Color)))->Color::Color(); layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x1)); layer1Color._colorize[0] = (layer->_color)._tint[0]; layer1Color._colorize[1] = (layer->_color)._tint[1]; layer1Color._colorize[2] = (layer->_color)._tint[2]; layer1Color._colorize[3] = (layer->_color)._tint[3]; if (spawnedColor != GHIDRA_CAST(&layer1Color)) { spawnedColor->_tint[0] = layer1Color._tint[0]; (spawned->_sprite)._color._tint[1] = layer1Color._tint[1]; (spawned->_sprite)._color._tint[2] = layer1Color._tint[2]; (spawned->_sprite)._color._tint[3] = layer1Color._tint[3]; (spawned->_sprite)._color._colorize[0] = layer1Color._colorize[0]; (spawned->_sprite)._color._colorize[1] = layer1Color._colorize[1]; (spawned->_sprite)._color._colorize[2] = layer1Color._colorize[2]; (spawned->_sprite)._color._colorize[3] = layer1Color._colorize[3]; *GHIDRA_CAST((spawned->_sprite)._color._offset) = (*GHIDRA_CAST((GHIDRA_CAST(&(layer1Color._offset)) + 0x0))); LAB_00438335: (spawned->_sprite)._color._offset[2] = layer1Color._offset[2]; } } uVar7 = Random(); spawned = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0xc,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar7); (spawned->_posOffset).x = 0.0; spawnedColor = &(spawned->_sprite)._color; (spawned->_posOffset).y = -6.0; if (0.0 < *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x13c)) || *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x13c)) == 0.0) { if (spawnedColor == GHIDRA_CAST((GHIDRA_INT(wispConfig) + 0x130))) goto LAB_0043842f; fVar14 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x134)); fVar1 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x138)); fVar15 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x13c)); spawnedColor->_tint[0] = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x130)); (spawned->_sprite)._color._tint[1] = fVar14; (spawned->_sprite)._color._tint[2] = fVar1; (spawned->_sprite)._color._tint[3] = fVar15; fVar14 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x144)); fVar1 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x148)); fVar15 = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x14c)); (spawned->_sprite)._color._colorize[0] = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x140)); (spawned->_sprite)._color._colorize[1] = fVar14; (spawned->_sprite)._color._colorize[2] = fVar1; (spawned->_sprite)._color._colorize[3] = fVar15; *GHIDRA_CAST((spawned->_sprite)._color._offset) = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x150)); layer0Color._offset[2] = *GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x158)); } else { ::(GHIDRA_CAST((&layer0Color)))->Color::Color(); layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); layer0Color._colorize[0] = (layer->_color)._tint[0]; layer0Color._colorize[1] = (layer->_color)._tint[1]; layer0Color._colorize[2] = (layer->_color)._tint[2]; layer0Color._colorize[3] = (layer->_color)._tint[3]; if (spawnedColor == GHIDRA_CAST(&layer0Color)) goto LAB_0043842f; spawnedColor->_tint[0] = layer0Color._tint[0]; (spawned->_sprite)._color._tint[1] = layer0Color._tint[1]; (spawned->_sprite)._color._tint[2] = layer0Color._tint[2]; (spawned->_sprite)._color._tint[3] = layer0Color._tint[3]; (spawned->_sprite)._color._colorize[0] = layer0Color._colorize[0]; (spawned->_sprite)._color._colorize[1] = layer0Color._colorize[1]; (spawned->_sprite)._color._colorize[2] = layer0Color._colorize[2]; (spawned->_sprite)._color._colorize[3] = layer0Color._colorize[3]; *GHIDRA_CAST((spawned->_sprite)._color._offset) = (*GHIDRA_CAST((GHIDRA_CAST(&(layer0Color._offset)) + 0x0))); } (spawned->_sprite)._color._offset[2] = layer0Color._offset[2]; LAB_0043842f: manager = g_manager; wispConfig = (void *)0x105; seed_fart_sound_override(GHIDRA_CAST(&wispConfig)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(wispConfig),1.0,2,0,1.0,0.0); ExceptionList = local_1c; return 1; } // 004386f0 Entity_Tear * Entity_Familiar::fire_wisp_projectile(Vector velocity) { Entity_Familiar *dropRng = this; code *pcVar1; BitSet128 flags; BitSet128 flags_00; ANM2 *pAVar2; byte bVar3; void *pvVar4; Vector *vecResult; Entity_Laser *laser; int iVar5; Entity_Tear *shot; uint uVar6; Entity *laser; int *effect; EntityPtr blueFly; BitSet128 *spectralFlags; LayerState *layer; uint rngResult; float *tearStats; float10 depthOffset; float fVar8; float fVar9; float fVar10; EntityPtr *pEVar11; Entity_Familiar *pEVar12; undefined4 uVar13; TypeDescriptor *pTVar14; TypeDescriptor *pTVar15; undefined4 rngResult; RNG local_e0; Vector local_d0; float fallingAccel; Entity_Familiar *local_c4; float tearScale; float tearDamage; Vector local_b8; void *local_b0; float local_ac; EntityPtr *local_a8; uint local_a4; EntityPtr *local_a0; EntityPtr *local_9c; BitSet128 local_98; float local_84; uint local_80; float local_7c; Vector scratchVec; Entity *local_70; Color tearColor; ColorMod tmpColor; float local_14; RNG *dropRng; local_14 = (float)(__security_cookie ^ GHIDRA_UINT(((&tmpColor)[1]._tint + 1))); if (dropRng->_variant == 0xed) { iVar5 = dropRng->_wispCollectibleType; } else if (dropRng->_variant == 0xce) { iVar5 = dropRng->_subtype; } else { iVar5 = 0x248; } local_c4 = dropRng; pvVar4 = ItemConfig::get_wisp_config(iVar5); iVar5 = dropRng->_subtype; local_b0 = pvVar4; if (iVar5 == 0x10004) { fire_robo_baby_laser(dropRng,&velocity); return GHIDRA_CAST(0x0); } if (iVar5 == 0x1000d) { local_84 = velocity.y; scratchVec.y = velocity.y; local_9c = GHIDRA_CAST(velocity.x); scratchVec.x = velocity.x; fVar8 = sqrtf(velocity.y * velocity.y + velocity.x * velocity.x); if (0.0 < fVar8) { local_9c = GHIDRA_CAST(((1.0 / fVar8) * (float)local_9c)); local_84 = local_84 * (1.0 / fVar8); scratchVec.x = (float)local_9c; scratchVec.y = local_84; } bVar3 = 0; vecResult = Vector::ToCardinal(&local_b8,&scratchVec); laser = FireBrimstone(dropRng,vecResult,bVar3); iVar5 = *GHIDRA_CAST(laser); (laser->_posOffset).x = (float)local_9c * 7.0; (laser->_posOffset).y = local_84 * 5.0 - 18.0; LAB_00438842: (**(code **)(iVar5 + 0xc))(); dropRng->_headFrameDelay = 0x1e; if (ABS(local_84) < ABS((float)local_9c)) { iVar5 = 2; if ((float)local_9c < 0.0) { iVar5 = 0; } PlayShootAnim(dropRng,iVar5); return GHIDRA_CAST(0x0); } PlayShootAnim(dropRng,GHIDRA_UINT((0.0 <= local_84)) * 2 + 1); return GHIDRA_CAST(0x0); } if (iVar5 == 0x10011) { local_84 = velocity.y; scratchVec.y = velocity.y; local_9c = GHIDRA_CAST(velocity.x); scratchVec.x = velocity.x; fVar8 = sqrtf(velocity.y * velocity.y + velocity.x * velocity.x); if (0.0 < fVar8) { local_9c = GHIDRA_CAST(((1.0 / fVar8) * (float)local_9c)); local_84 = local_84 * (1.0 / fVar8); scratchVec.x = (float)local_9c; scratchVec.y = local_84; } bVar3 = 0; vecResult = Vector::ToCardinal(&local_b8,&scratchVec); laser = FireBrimstone(dropRng,vecResult,bVar3); (**(code **)(*GHIDRA_CAST(laser) + 0x40)) (*GHIDRA_CAST((GHIDRA_CAST(local_b0) + 4)) * *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((dropRng)) + 0xf34))))); (laser->_posOffset).x = (float)local_9c * 7.0; (laser->_posOffset).y = local_84 * 5.0 - 18.0; iVar5 = *GHIDRA_CAST(laser); goto LAB_00438842; } if (iVar5 == 0x1000f) { if (dropRng->_player->_numBlueFlies < 5) { (GHIDRA_CAST((dropRng->_player)))->Entity_Player::AddBlueFlies(1,&dropRng->_pos,GHIDRA_CAST(0x0)); return GHIDRA_CAST(0x0); } return GHIDRA_CAST(0x0); } if (iVar5 == 0x22c) { (GHIDRA_CAST((&velocity)))->Vector::Normalized(&scratchVec); bVar3 = 1; vecResult = Vector::ToCardinal(&local_b8,&scratchVec); shot = GHIDRA_CAST(FireBrimstone(dropRng,vecResult,bVar3)); pAVar2 = &shot->_tearHaloANM2; (pAVar2->_animDefaultName)._buf[0xc] = '\0'; (pAVar2->_animDefaultName)._buf[0xd] = '\0'; (pAVar2->_animDefaultName)._buf[0xe] = '4'; (pAVar2->_animDefaultName)._buf[0xf] = 'C'; (shot->_posOffset).x = scratchVec.x * 7.0; (shot->_posOffset).y = scratchVec.y * 5.0 - 18.0; pcVar1 = *(code **)(*GHIDRA_CAST(shot) + 0x40); fVar8 = apply_tear_modifiers(local_c4); (*pcVar1)(fVar8 * 3.5); pEVar12 = local_c4; apply_baby_bender(local_c4,shot); (GHIDRA_CAST((GHIDRA_CAST(pEVar12))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(shot)); shot->Update(); depthOffset = (float10)copysignf(0x40a00000,shot->_renderDepthOffset); shot->_renderDepthOffset = (float)depthOffset; pEVar12->_headFrameDelay = 0x1e; iVar5 = vector_to_direction(&scratchVec); PlayShootAnim(pEVar12,iVar5); return GHIDRA_CAST(0x0); } if (iVar5 == 0x121) { Vector::ToCardinal(&scratchVec,&velocity); uVar6 = Random(); rngResult = 0; pTVar15 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; local_b8.x = scratchVec.x * 5.0 + velocity.x; pTVar14 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; uVar13 = 0; local_b8.y = scratchVec.y * 5.0 + velocity.y; laser = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0x34,&dropRng->_pos,&local_b8,GHIDRA_CAST(dropRng),0,uVar6); effect = GHIDRA_CAST(__RTDynamicCast(laser,uVar13,pTVar14,pTVar15,rngResult)); (**(code **)(*effect + 0x40))(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((dropRng)) + 0xf34)))) * 10.0); effect[0x11e] = 0x3f000000; effect[0x117] = 0x96; effect[0x118] = 0x96; (**(code **)(*effect + 0xc))(); return GHIDRA_CAST(0x0); } local_a8 = GHIDRA_CAST(0x0); if (iVar5 == 0x280) { uVar6 = Random(); if (uVar6 % 7 == 0) { Vector::ToCardinal(&scratchVec,&velocity); uVar6 = Random(); rngResult = 0; pTVar15 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; local_b8.x = scratchVec.x * 5.0 + velocity.x; pTVar14 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; uVar13 = 0; local_b8.y = scratchVec.y * 5.0 + velocity.y; laser = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,10,&dropRng->_pos,&local_b8,GHIDRA_CAST(dropRng),0,uVar6); effect = GHIDRA_CAST(__RTDynamicCast(laser,uVar13,pTVar14,pTVar15,rngResult)); (**(code **)(*effect + 0x40))(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((dropRng)) + 0xf34)))) * 10.0); effect[0x11e] = 0x3f000000; effect[0x117] = 0x5a; effect[0x118] = 0x5a; (**(code **)(*effect + 0xc))(); return GHIDRA_CAST(0x0); } } else if (iVar5 == 0x242) { dropRng->_coins = dropRng->_coins + 1; if ((dropRng->_coins & 1) == 0) { uVar6 = Random(); laser = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0x2e,&dropRng->_pos,&g_vectorZero,GHIDRA_CAST(dropRng),0,uVar6); iVar5 = *GHIDRA_CAST(laser); pAVar2 = &laser[1]._sprite; (pAVar2->_filename)._buf[4] = 'Z'; (pAVar2->_filename)._buf[5] = '\0'; (pAVar2->_filename)._buf[6] = '\0'; (pAVar2->_filename)._buf[7] = '\0'; pAVar2 = &laser[1]._sprite; (pAVar2->_filename)._buf[8] = 'Z'; (pAVar2->_filename)._buf[9] = '\0'; (pAVar2->_filename)._buf[10] = '\0'; (pAVar2->_filename)._buf[0xb] = '\0'; (**(code **)(iVar5 + 0x40))(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((dropRng)) + 0xf34)))) * 7.0); laser->Update(); tmpColor._tint[0] = 1.0; tmpColor._tint[1] = 1.0; tmpColor._tint[2] = 1.0; tmpColor._tint[3] = 1.0; tmpColor._offset[0] = 0.0; tmpColor._colorize[0] = 6.0714; tmpColor._colorize[1] = 5.7857; tmpColor._colorize[2] = 0.0; tmpColor._colorize[3] = 1.0; tmpColor._offset[1] = 0.0; tmpColor._offset[2] = 0.0; (GHIDRA_CAST((GHIDRA_CAST(&laser->_sprite))))->Sprite::SetColor(&tmpColor); pvVar4 = local_b0; } } else if (iVar5 == 0x27f) { uVar6 = Random(); if (uVar6 % 10 != 0) { return GHIDRA_CAST(0x0); } pEVar11 = &dropRng->_linkedEntity; if (dropRng->_linkedEntity != (EntityPtr)0x0) { return GHIDRA_CAST(0x0); } blueFly = (EntityPtr)(GHIDRA_CAST((dropRng->_player)))->Entity_Player::AddBlueFlies(1,&dropRng->_pos,GHIDRA_CAST(0x0)); if (blueFly == (EntityPtr)0x0) { return GHIDRA_CAST(0x0); } if (*pEVar11 != (EntityPtr)0x0) { local_a0 = pEVar11; std::multiset::erase(&local_a0); } *pEVar11 = blueFly; std::multiset::insert(pEVar11); return GHIDRA_CAST(0x0); } local_ac = 0.8; bVar3 = (GHIDRA_CAST((dropRng->_player)))->Entity_Player::HasCollectible(0xf7,0); if (bVar3 == 0) { local_84 = 1.0; } else { local_84 = 2.0; } bVar3 = (GHIDRA_CAST((dropRng->_player)))->Entity_Player::HasCollectible(0xf7,0); if (bVar3 != 0) { local_ac = 1.0; } fallingAccel = 0.0; (GHIDRA_CAST((&tearColor)))->Color::Color(); iVar5 = _get_index_plus_one_if_kind_4_5(); local_a0 = (EntityPtr *) ((float)(iVar5 + -1) * *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 8)) + *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 4))); uVar6 = Random(); tearStats = GHIDRA_CAST((GHIDRA_INT(pvVar4) + 0x60)); if (*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xa8)) <= (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283064e-10) { tearStats = GHIDRA_CAST((GHIDRA_INT(pvVar4) + 0x18)); } tearDamage = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((dropRng)) + 0xf30)))) * *tearStats * *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((dropRng)) + 0xf34)))) * (float)local_a0; fVar8 = sqrtf(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((dropRng)) + 0xf30))))); fVar8 = fVar8 * tearStats[1] * local_ac; tearScale = fVar8; spectralFlags = BitSet128::operator_or (GHIDRA_CAST(&local_e0),&g_tearFlagSpectral,GHIDRA_CAST((tearStats + 0xe))); local_a4 = GHIDRA_UINT(spectralFlags->_l); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&spectralFlags->_l) + 4)); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(spectralFlags->_h); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&spectralFlags->_h) + 4)); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4; local_80 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))); local_7c = (float)GHIDRA_UINT(local_98._h); local_70 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(local_98._h))) + 0x4))); (GHIDRA_CAST((&tearColor)))->Color::operator_assign(GHIDRA_CAST((tearStats + 3))); local_a0 = GHIDRA_CAST(tearStats[2]); velocity.x = velocity.x * *GHIDRA_CAST((GHIDRA_CAST(local_b0) + 0xc)); velocity.y = velocity.y * *GHIDRA_CAST((GHIDRA_CAST(local_b0) + 0xc)); uVar6 = dropRng->_subtype; local_b0 = (void *)velocity.x; local_ac = velocity.y; local_9c = local_a0; if (uVar6 < 0x9f) { if (uVar6 == 0x9e) { scratchVec.x = velocity.x; local_d0.y = sqrtf(velocity.y * velocity.y + velocity.x * velocity.x); local_b0 = (void *)((float)local_b0 / local_d0.y); local_70 = GHIDRA_CAST(0x0); local_b8.y = (float)g_game->_room; local_80 = 0; local_ac = local_ac / local_d0.y; local_7c = 0.0; if (*GHIDRA_CAST((GHIDRA_CAST(local_b8.y) + 0x1264)) != 0) { do { laser = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_b8.y) + 0x125c)) + local_80 * 4)); fVar8 = (laser->_pos).y - (dropRng->_pos).y; fVar10 = (laser->_pos).x - (dropRng->_pos).x; scratchVec.y = sqrtf(fVar8 * fVar8 + fVar10 * fVar10); bVar3 = (GHIDRA_CAST((laser)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); if (((bVar3 != 0) && ((laser->_flags & 0x20000000) == 0)) && (laser->_dead == 0)) { local_a0 = GHIDRA_CAST(((laser->_pos).x - (dropRng->_pos).x)); local_c4 = GHIDRA_CAST(((laser->_pos).y - (dropRng->_pos).y)); fVar8 = sqrtf((float)local_a0 * (float)local_a0 + (float)local_c4 * (float)local_c4); pEVar12 = local_c4; pEVar11 = local_a0; if (0.0 < fVar8) { pEVar12 = GHIDRA_CAST(((float)local_c4 * (1.0 / fVar8))); pEVar11 = GHIDRA_CAST(((float)local_a0 * (1.0 / fVar8))); } fVar8 = (float)local_b0 * (float)pEVar11 + local_ac * (float)pEVar12; if (0.8 <= fVar8) { fVar10 = 800.0 - scratchVec.y; if (fVar10 <= 0.0) { fVar10 = 0.0; } fVar9 = 400.0 - laser->_health; if (fVar9 <= 0.0) { fVar9 = 0.0; } fVar9 = fVar8 * 2000.0 + 0.0 + fVar10 + fVar9; if (local_7c < fVar9) { local_7c = fVar9; local_70 = laser; } } } laser = local_70; local_80 = local_80 + 1; } while (local_80 < *GHIDRA_CAST((GHIDRA_CAST(local_b8.y) + 0x1264))); if (local_70 != GHIDRA_CAST(0x0)) { fVar8 = (dropRng->_pos).y - (local_70->_pos).y; fVar10 = (dropRng->_pos).x - (local_70->_pos).x; fVar8 = sqrtf(fVar8 * fVar8 + fVar10 * fVar10); scratchVec.y = (fVar8 * (laser->_velocity).y * 0.05 + (laser->_pos).y) - (dropRng->_pos).y; scratchVec.x = (fVar8 * (laser->_velocity).x * 0.05 + (laser->_pos).x) - (dropRng->_pos).x; vecResult = (GHIDRA_CAST((&scratchVec)))->Vector::Resized(&local_b8,local_d0.y); velocity.x = vecResult->x; velocity.y = vecResult->y; } } goto switchD_00438fa0_caseD_27; } switch(uVar6) { case 0x26: uVar6 = Random(); local_a0 = (EntityPtr *) (((float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283064e-10 * 40.0 - 20.0) * 0.017453292); local_ac = cos((float)local_a0); fVar8 = sin((float)local_a0); fVar10 = fVar8 * velocity.x; velocity.x = local_ac * velocity.x - fVar8 * velocity.y; velocity.y = local_ac * velocity.y + fVar10; break; case 0x28: uVar6 = Random(); local_a8 = (EntityPtr *) ((float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283064e-10 + 1.0 + 0.0); break; case 0x2a: fallingAccel = 0.6; uVar6 = Random(); local_a8 = (EntityPtr *) (0.0 - ((float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283064e-10 + 5.0)); break; case 0x2f: if (((*GHIDRA_CAST((GHIDRA_CAST(dropRng->_player) + 0x1600)) == 0x2f) && (iVar5 = *GHIDRA_CAST((GHIDRA_CAST(dropRng->_player) + 0x13dc)), iVar5 != 0)) && ((*GHIDRA_CAST((iVar5 + 0x30)) == 6 && ((iVar5 = *GHIDRA_CAST((iVar5 + 0x44)), iVar5 != 0 && (0xf < g_game->_frameCount - *GHIDRA_CAST((iVar5 + 0x328)))))))) { local_ac = *GHIDRA_CAST((iVar5 + 0x340)); local_a0 = *GHIDRA_CAST((iVar5 + 0x33c)); vecResult = MusicManager::RandomVector(&scratchVec); uVar6 = Random(); local_c4 = GHIDRA_CAST((dropRng->_pos).x); fVar8 = (dropRng->_pos).y; fallingAccel = 1.2; fVar10 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283064e-10; scratchVec.y = fVar10 * vecResult->y * 120.0 + local_ac; local_b8.y = fVar10 * vecResult->x * 120.0 + (float)local_a0; velocity.y = (scratchVec.y - fVar8) / 20.0; velocity.x = (local_b8.y - (float)local_c4) / 20.0; fVar10 = velocity.y * velocity.y + velocity.x * velocity.x; local_d0.y = velocity.y; local_b0 = (void *)velocity.y; local_ac = fVar8; local_a8 = GHIDRA_CAST(velocity.x); local_a0 = GHIDRA_CAST(velocity.x); if (225.0 < fVar10) { fVar8 = sqrtf(fVar10); local_a8 = local_a0; local_b0 = (void *)local_d0.y; if (0.0 < fVar8) { local_b0 = (void *)((15.0 / fVar8) * local_d0.y); local_a8 = GHIDRA_CAST(((15.0 / fVar8) * (float)local_a0)); } } (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagExplosive._l); tearDamage = tearDamage * 4.0 + 8.0; (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagExplosive._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagExplosive._h); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagExplosive._h)) + 0x4))); tearScale = tearScale * 1.5; velocity.x = (float)local_a8; velocity.y = (float)local_b0; local_70 = (Entity *) sqrtf((local_ac - scratchVec.y) * (local_ac - scratchVec.y) + ((float)local_c4 - local_b8.y) * ((float)local_c4 - local_b8.y)); fVar8 = sqrtf((float)local_b0 * (float)local_b0 + (float)local_a8 * (float)local_a8); local_70 = GHIDRA_CAST(((float)local_70 / fVar8)); fVar8 = pow(0.9,(float)local_70); fVar8 = (fVar8 - 1.0) * -9.491221; if (fVar8 <= 0.01) { fVar8 = 0.01; } local_a8 = GHIDRA_CAST(((18.0 - ((float)local_70 - fVar8) * 13.0) / fVar8)); } break; case 0x38: local_a8 = GHIDRA_CAST(0x3f19999a); break; case 0x4d: switchD_00438fa0_caseD_4d: layer = (GHIDRA_CAST((&dropRng->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x1)); scratchVec.y = (layer->_color)._tint[0] * 0.5; layer = (GHIDRA_CAST((&dropRng->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x1)); local_b8.y = (layer->_color)._tint[1] * 0.5; layer = (GHIDRA_CAST((&dropRng->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x1)); tmpColor._offset[2] = (layer->_color)._tint[2] * 0.5; tmpColor._colorize[0] = 0.0; tmpColor._colorize[1] = 0.0; tmpColor._colorize[2] = 0.0; tmpColor._colorize[3] = 0.0; tmpColor._tint[3] = 1.0; tmpColor._tint[0] = scratchVec.y * 1.25; tmpColor._tint[1] = local_b8.y * 1.25; tmpColor._tint[2] = tmpColor._offset[2] * 1.25; tmpColor._offset[0] = scratchVec.y * 0.25; tmpColor._offset[1] = local_b8.y * 0.25; tmpColor._offset[2] = tmpColor._offset[2] * 0.25; (GHIDRA_CAST((&tearColor)))->Color::operator_assign(&tmpColor); break; case 0x66: layer = (GHIDRA_CAST((&dropRng->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x1)); scratchVec.y = (layer->_color)._tint[0] * 0.5; layer = (GHIDRA_CAST((&dropRng->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x1)); local_b8.y = (layer->_color)._tint[1] * 0.5; layer = (GHIDRA_CAST((&dropRng->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x1)); tmpColor._offset[2] = (layer->_color)._tint[2] * 0.5; tmpColor._colorize[0] = 0.0; tmpColor._colorize[1] = 0.0; tmpColor._colorize[2] = 0.0; tmpColor._colorize[3] = 0.0; tmpColor._tint[3] = 1.0; tmpColor._tint[0] = scratchVec.y * 1.25; tmpColor._tint[1] = local_b8.y * 1.25; tmpColor._tint[2] = tmpColor._offset[2] * 1.25; tmpColor._offset[0] = scratchVec.y * 0.25; tmpColor._offset[1] = local_b8.y * 0.25; tmpColor._offset[2] = tmpColor._offset[2] * 0.25; (GHIDRA_CAST((&tearColor)))->Color::operator_assign(&tmpColor); uVar6 = Random(); if ((float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283064e-10 < 0.15) { switch(dropRng->_coins) { case 1: (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagPoison._l); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPoison._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagPoison._h); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPoison._h)) + 0x4))); break; case 2: (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagFreeze._l); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFreeze._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagFreeze._h); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFreeze._h)) + 0x4))); break; case 3: (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagConfusion._l); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagConfusion._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagConfusion._h); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagConfusion._h)) + 0x4))); break; case 4: (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagBurn._l); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBurn._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagBurn._h); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBurn._h)) + 0x4))); break; case 5: dropRng = &dropRng->_dropRNG; local_b8.y = (float)(GHIDRA_CAST((dropRng)))->RNG::Next(); uVar6 = (GHIDRA_CAST((dropRng)))->RNG::Next(); vecResult = RandomVector(&local_d0,uVar6); fVar8 = (GHIDRA_CAST((dropRng)))->RNG::RandomFloat(); dropRng = local_c4; scratchVec.x = fVar8 * 2.0 + 2.0; scratchVec.y = scratchVec.x * vecResult->y; scratchVec.x = scratchVec.x * vecResult->x; laser = (GHIDRA_CAST((g_game)))->Game::Spawn(4,3,&local_c4->_pos,&scratchVec,GHIDRA_CAST(0x0),0, GHIDRA_UINT(local_b8.y)); laser->Update(); } } break; case 0x7b: local_e0._seed = dropRng->_initSeed; local_e0._shift3 = 9; local_e0._shift1 = 2; local_e0._shift2 = 0x15; familiar_wisp_pick_tear_color(&local_e0,GHIDRA_CAST(&local_a0),&local_98); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = GHIDRA_UINT(local_98._l) | GHIDRA_UINT(g_tearFlagSpectral._l); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_98._h) | GHIDRA_UINT(g_tearFlagSpectral._h); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._h)) + 0x4))); scratchVec.y = (GHIDRA_CAST((&local_e0)))->RNG::RandomFloat(); tearDamage = (scratchVec.y * 0.4 + 0.8) * tearDamage; fVar8 = (GHIDRA_CAST((&local_e0)))->RNG::RandomFloat(); fallingAccel = 0.0; local_d0.y = fVar8 * 0.4 - 0.2; layer = (GHIDRA_CAST((&dropRng->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x1)); scratchVec.y = (layer->_color)._tint[0] * 0.5; layer = (GHIDRA_CAST((&dropRng->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x1)); local_b8.y = (layer->_color)._tint[1] * 0.5; layer = (GHIDRA_CAST((&dropRng->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x1)); tmpColor._offset[2] = (layer->_color)._tint[2] * 0.5; tmpColor._colorize[0] = 0.0; tmpColor._colorize[1] = 0.0; tmpColor._colorize[2] = 0.0; tmpColor._colorize[3] = 0.0; tmpColor._tint[3] = 1.0; tmpColor._tint[0] = scratchVec.y * 1.25; tmpColor._tint[1] = local_b8.y * 1.25; tmpColor._tint[2] = tmpColor._offset[2] * 1.25; tmpColor._offset[0] = scratchVec.y * 0.25; tmpColor._offset[1] = local_b8.y * 0.25; tmpColor._offset[2] = tmpColor._offset[2] * 0.25; (GHIDRA_CAST((&tearColor)))->Color::operator_assign(&tmpColor); fVar8 = (GHIDRA_CAST((&local_e0)))->RNG::RandomFloat(); local_9c = local_a0; scratchVec.y = fVar8 * 0.6 + 0.7; velocity.y = scratchVec.y * velocity.y; velocity.x = scratchVec.y * velocity.x; local_a8 = GHIDRA_CAST(local_d0.y); } goto switchD_00438fa0_caseD_27; } if (0x204 < uVar6) { if (uVar6 == 0x246) { pvVar4 = dropRng->_player; iVar5 = TemporaryEffects::GetCollectibleEffectNum (GHIDRA_CAST((GHIDRA_INT(pvVar4) + 0x1508)),0x246); scratchVec.y = (float)iVar5 * 0.75; iVar5 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar4) + 0x1508)))))->TemporaryEffects::GetNullEffectNum(0x47); local_84 = (float)iVar5 * 0.3 + scratchVec.y + local_84; fVar8 = sqrtf(local_84); tearScale = fVar8 * 0.23 + local_84 * 0.01 + 0.55; goto switchD_00438fa0_caseD_27; } if (uVar6 == 0x263) { tearDamage = (float)dropRng->_keys * 0.5 * tearDamage; tearScale = ((float)dropRng->_keys * 0.1 + 1.0) * fVar8; goto switchD_00438fa0_caseD_27; } if (uVar6 != 0x1000e) goto switchD_00438fa0_caseD_27; LAB_00439c27: vecResult = MusicManager::RandomVector(&scratchVec); uVar6 = Random(); fVar8 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283064e-10; fVar10 = fVar8 * vecResult->y; fVar8 = fVar8 * vecResult->x; velocity.y = fVar10 + fVar10 + velocity.y; velocity.x = fVar8 + fVar8 + velocity.x; uVar6 = Random(); fallingAccel = 0.5; fVar8 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283064e-10 * 0.5 + 0.25; velocity.y = fVar8 * velocity.y; velocity.x = fVar8 * velocity.x; uVar6 = Random(); rngResult = Random(); tearScale = ((float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 0.05 + ((float)(uVar6 & 1) + 0.0) * 0.4 + 0.9) * tearScale; uVar6 = Random(); local_a8 = (EntityPtr *) (0.0 - ((float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283064e-10 * 15.0 + 5.0)); goto switchD_00438fa0_caseD_27; } if (uVar6 == 0x204) { dropRng->_coins = dropRng->_coins + 1; goto switchD_00438fa0_caseD_27; } switch(uVar6) { case 0x12a: goto switchD_00438fa0_caseD_4d; default: goto switchD_00438fa0_caseD_27; case 0x144: break; case 0x145: local_9c = GHIDRA_CAST(0x1); goto LAB_00439c27; case 0x196: local_e0._seed = (dropRng->_dropRNG)._seed; local_e0._shift1 = 2; local_e0._shift2 = 7; local_e0._shift3 = 7; scratchVec.y = (GHIDRA_CAST((&local_e0)))->RNG::RandomFloat(); tearDamage = (scratchVec.y * 2.0 - 1.0) + tearDamage; goto switchD_00438fa0_caseD_27; } uVar6 = Random(); switch(uVar6 % 9) { case 1: (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagBurn._l); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBurn._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagBurn._h); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBurn._h)) + 0x4))); local_9c = GHIDRA_CAST(0x5); break; case 2: (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagCharm._l); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCharm._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagCharm._h); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCharm._h)) + 0x4))); tearColor._tint[0] = 1.0; tearColor._tint[1] = 0.0; tearColor._tint[2] = 1.0; tearColor._tint[3] = 1.0; tearColor._offset[0] = 0.19607845; tearColor._offset[1] = 0.0; tearColor._offset[2] = 0.0; break; case 3: (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagConfusion._l); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagConfusion._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagConfusion._h); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagConfusion._h)) + 0x4))); tearColor._tint[0] = 0.5; tearColor._tint[1] = 0.5; tearColor._tint[2] = 0.5; tearColor._tint[3] = 1.0; break; case 4: (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagFear._l); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFear._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagFear._h); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFear._h)) + 0x4))); tearColor._tint[0] = 1.0; tearColor._tint[1] = 1.0; tearColor._tint[2] = 0.455; tearColor._tint[3] = 1.0; tearColor._offset[0] = 0.169; tearColor._offset[1] = 0.145; tearColor._offset[2] = 0.0; break; case 5: tearColor._tint[0] = 1.25; tearColor._tint[1] = 0.05; tearColor._tint[2] = 0.15; (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFreeze._h)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagFreeze._l); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFreeze._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagFreeze._h); goto LAB_00439f99; case 6: tearColor._tint[0] = 0.4; tearColor._tint[1] = 0.97; tearColor._tint[2] = 0.5; (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPoison._h)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = GHIDRA_UINT(g_tearFlagPoison._l); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPoison._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(g_tearFlagPoison._h); LAB_00439f99: (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(local_98._h); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(local_98._l); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))); tearColor._tint[3] = 1.0; tearColor._offset[0] = 0.0; tearColor._offset[1] = 0.0; tearColor._offset[2] = 0.0; break; case 7: (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagSlow._l); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSlow._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagSlow._h); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSlow._h)) + 0x4))); tearColor._tint[0] = 2.0; tearColor._tint[1] = 2.0; tearColor._tint[2] = 2.0; tearColor._tint[3] = 1.0; tearColor._offset[0] = 0.19607845; tearColor._offset[1] = 0.19607845; tearColor._offset[2] = 0.19607845; break; case 8: (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x0))) = local_a4 | GHIDRA_UINT(g_tearFlagShrink._l); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))) = local_80 | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShrink._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x0))) = GHIDRA_UINT(local_7c) | GHIDRA_UINT(g_tearFlagShrink._h); (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))) = GHIDRA_UINT(local_70) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShrink._h)) + 0x4))); tearColor._colorize[0] = 0.3; tearColor._colorize[1] = 0.4; tearColor._colorize[2] = 1.0; tearColor._colorize[3] = 1.5; } switchD_00438fa0_caseD_27: local_70 = GHIDRA_CAST(g_vectorZero.x); local_7c = g_vectorZero.y; if (dropRng->_subtype == 0x15b) { vecResult = (GHIDRA_CAST((&velocity)))->Vector::Normalized(&local_b8); scratchVec.y = cos(1.5707964); fVar8 = sin(1.5707964); local_70 = GHIDRA_CAST(((vecResult->x * scratchVec.y - vecResult->y * fVar8) * 5.0)); local_7c = (vecResult->y * scratchVec.y + vecResult->x * fVar8) * 5.0; uVar6 = Random(); scratchVec.x = (float)local_70 + (dropRng->_pos).x; scratchVec.y = local_7c + (dropRng->_pos).y; shot = (Entity_Tear *) (GHIDRA_CAST((g_game)))->Game::Spawn(2,GHIDRA_UINT(local_9c),&scratchVec,&velocity,GHIDRA_CAST(dropRng),0,uVar6); uVar6 = Random(); shot->_fallingSpeed = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283064e-10 * 0.2 + (float)local_a8; shot->_fallingAccel = fallingAccel; shot->SetCollisionDamage(tearDamage * local_84); (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = GHIDRA_UINT(local_98._l); (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = GHIDRA_UINT(local_98._h); (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))); (GHIDRA_CAST((shot)))->Entity_Tear::SetTearFlags(flags); (GHIDRA_CAST((shot)))->Entity_Tear::SetScale(tearScale); (GHIDRA_CAST((GHIDRA_CAST(shot))))->Entity::SetParent(GHIDRA_CAST(dropRng)); shot->SetColor(&tearColor,0xffffffff,0xff,0,1); uVar6 = Random(); local_70 = GHIDRA_CAST(-(float)local_70); local_7c = -local_7c; shot->_tearIdx = uVar6 & 1; bVar3 = (GHIDRA_CAST((dropRng->_player)))->Entity_Player::HasTrinket(0x7f,0); if (bVar3 != 0) { TryFireTear(dropRng,shot); } } uVar6 = Random(); scratchVec.x = (float)local_70 + (dropRng->_pos).x; scratchVec.y = local_7c + (dropRng->_pos).y; shot = (Entity_Tear *) (GHIDRA_CAST((g_game)))->Game::Spawn(2,GHIDRA_UINT(local_9c),&scratchVec,&velocity,GHIDRA_CAST(dropRng),0,uVar6); uVar6 = Random(); shot->_fallingSpeed = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283064e-10 * 0.2 + (float)local_a8; shot->_fallingAccel = fallingAccel; shot->SetCollisionDamage(tearDamage * local_84); (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._l)) + 0x0))) = GHIDRA_UINT(local_98._l); (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x0))) = GHIDRA_UINT(local_98._h); (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_98._h)) + 0x4))); (GHIDRA_CAST((shot)))->Entity_Tear::SetTearFlags(flags_00); (GHIDRA_CAST((shot)))->Entity_Tear::SetScale(tearScale); (GHIDRA_CAST((GHIDRA_CAST(shot))))->Entity::SetParent(GHIDRA_CAST(dropRng)); shot->SetColor(&tearColor,0xffffffff,0xff,0,1); uVar6 = Random(); shot->_tearIdx = uVar6 & 1; bVar3 = (GHIDRA_CAST((dropRng->_player)))->Entity_Player::HasTrinket(0x7f,0); if (bVar3 != 0) { TryFireTear(dropRng,shot); } return shot; } // 0043a5e0 undefined4 Entity_Familiar::wisp_take_damage(float *param_2, uint *param_3, int *param_4) { byte bVar1; char cVar2; EntityPtr fearTarget; uint uVar3; uint uVar4; Entity_Effect *spawnedEffect; EntityRef *pEVar5; int unusedArg; bool bVar6; Entity_Familiar *local_3c; EntityPtr local_38; EntityRef selfRef; Manager *manager; EntityPtr *parentSlot; void *room; int sourceType; int wispItem; local_3c = this; bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasInvincibility(0,GHIDRA_CAST(0x0)); if (bVar1 != 0) { return 0; } sourceType = *param_4; if (((sourceType == 1) || (sourceType == 3)) && ((*param_3 & 0x1000000) != 0)) { return 0; } if (this->_variant != 0xce) { return 1; } wispItem = this->_subtype; if (wispItem < 0xa1) { if (wispItem == 0xa0) { if (0x3dd < sourceType - 10U) { return 1; } uVar4 = Random(); spawnedEffect = (Entity_Effect *) (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,0x13,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar4,0); local_38 = (EntityPtr)this->_player; parentSlot = &spawnedEffect->_parent; local_3c = GHIDRA_CAST(spawnedEffect); if (spawnedEffect->_parent != (EntityPtr)0x0) { local_3c = GHIDRA_CAST(parentSlot); std::multiset::erase(&local_3c); } *parentSlot = local_38; if (local_38 != (EntityPtr)0x0) { std::multiset::insert(parentSlot); } spawnedEffect->SetCollisionDamage(0x41400000); local_3c = GHIDRA_CAST((GHIDRA_UINT(g_vectorOne.x) ^ 0x80000000)); local_38 = (EntityPtr)-g_vectorOne.y; (GHIDRA_CAST((GHIDRA_CAST(spawnedEffect))))->Entity::SetSize(80.0, (Vector)(CONCAT44(g_vectorOne.y,g_vectorOne.x) ^ 0x8000000080000000),-1); spawnedEffect->_subtype = 1; return 1; } switch(wispItem) { case 0x28: if ((*param_3 & 4) != 0) { return 0; } if ((GHIDRA_CAST(param_4[9]) != GHIDRA_CAST(0x0)) && (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(param_4[9]))))->Entity::IsEnemy(), bVar1 != 0)) { *param_2 = *param_2 * 3.0; } break; case 0x3a: if (sourceType < 10) { return 0; } bVar6 = sourceType == 1000; goto LAB_0043a7f7; case 0x5d: if (((this->_target == (EntityPtr)0x0) && ((sourceType < 10 || (sourceType == 1000)))) && (GHIDRA_CAST(param_4[9]) != GHIDRA_CAST(0x0))) { fearTarget = (EntityPtr)(GHIDRA_CAST((GHIDRA_CAST(param_4[9]))))->Entity::GetLastSpawner(); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(fearTarget))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); if (bVar1 != 0) { selfRef._type = this->_type; selfRef._spawnerType = this->_spawnerType; selfRef._position.x = (this->_pos).x; selfRef._position.y = (this->_pos).y; selfRef._spawnerVariant = this->_spawnerVariant; selfRef._variant = this->_variant; selfRef._velocity.x = (this->_velocity).x; selfRef._velocity.y = (this->_velocity).y; if ((this->_flags & 0x20000000) == 0) { uVar4 = 0; } else { uVar4 = 2; } local_3c = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_INT(&this->_flags) + 4)) & 0x400000)); if (local_3c == GHIDRA_CAST(0x0)) { uVar3 = 0; } else { uVar3 = 4; } selfRef._flags = uVar3 | uVar4 | GHIDRA_UINT(((this->_flags & 0x100) != 0)); selfRef._entity = this; (GHIDRA_CAST((GHIDRA_CAST(fearTarget))))->Entity::AddFear(&selfRef,2,0); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(fearTarget))))->Entity::HasEntityFlags(0x800); if (bVar1 != 0) { if (this->_target != (EntityPtr)0x0) { local_3c = GHIDRA_CAST(&this->_target); std::multiset::erase(&local_3c); } this->_target = fearTarget; if (fearTarget != (EntityPtr)0x0) { std::multiset::insert(&this->_target); } this->_counter = 0x96; return 1; } } } break; case 0x7f: goto switchD_0043a658_caseD_7f; } } else { if (wispItem == 0x27e) { if (GHIDRA_CAST(param_4[9]) == GHIDRA_CAST(0x0)) { return 0; } bVar1 = (GHIDRA_CAST((GHIDRA_CAST(param_4[9]))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); if (bVar1 == 0) { return 0; } cVar2 = (**(code **)(*GHIDRA_CAST(param_4[9]) + 0x4c))(); if ((cVar2 != '\0') && (*GHIDRA_CAST((param_4[9] + 0x14)) < *GHIDRA_CAST((param_4[9] + 0x380)))) { return 0; } bVar6 = false; Game::AddErasedEnemy(GHIDRA_CAST(param_4[9])); uVar4 = 0; room = g_game->_room; if (*GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264)) != 0) { do { local_38 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + 0x125c)) + uVar4 * 4)); bVar1 = Game::ShouldEraseEnemy(GHIDRA_CAST(local_38)); if (bVar1 != 0) { Entity::RemoveWithPoof(GHIDRA_CAST(local_38),unusedArg); bVar6 = true; } this = local_3c; manager = g_manager; uVar4 = uVar4 + 1; } while (uVar4 < *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264))); if (bVar6) { local_3c = GHIDRA_CAST(0xed); seed_fart_sound_override(GHIDRA_CAST(&local_3c)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_3c),1.0,2,0,1.0,0.0); } } pEVar5 = (GHIDRA_CAST((&selfRef)))->EntityRef::EntityRef(); this->Kill(pEVar5); return 0; } if (wispItem != 0x28a) { if (wispItem == 0x2be) { return 0; } return 1; } bVar6 = this->_state == 1; LAB_0043a7f7: if (bVar6) { switchD_0043a658_caseD_7f: return 0; } } return 1; } // 0043aa90 void Entity_Familiar::ai_wisp() { void *pvVar1; Entity_Player *player; GridEntity_Door *pickup; code *pcVar2; ANM2 *pAVar3; char cVar4; byte bVar5; uint uVar6; int *piVar7; Entity *pEVar8; LayerState *layer; Entity_Laser *laser; ColorMod *Color; undefined4 extraout_EAX; ColorMod *extraout_EAX_00; ColorMod *extraout_EAX_01; int cooldown; float *extraout_EAX_02; float *extraout_EAX_03; Vector *orbitDistance; Entity_Effect *splat; EntityRef *killSource; Entity_Tear *tear; char *anim; byte *anim_00; Vector *vec; ColorMod *color; code *extraout_EDX; code *extraout_EDX_00; code *extraout_EDX_01; uint pickupIndex; EntityPtr EVar9; int iVar10; bool bVar11; float fVar12; float fVar13; Room *pRVar14; Entity *pEVar15; float fVar16; Entity_Familiar *source; EntityRef parentDeadKillSource; EntityRef timeoutKillSource; EntityRef pickupCollideKillSource; EntityRef chestOpenKillSource; EntityRef lockUnlockKillSource; EntityRef doorUnlockKillSource; EntityRef noParentKillSource; EntityRef nullEffectKillSource; EntityRef gridDamageSource; KColor secondaryHueColor; EntityRef targetDamageSource; EntityRef fearSource; Color fadeColor; Vector toEnemyDir; Vector layerOrbitDistance; Vector cardinalVelocity; Vector toParentDir; Vector lemonadeSplatOffset; Vector spawnOrbitPos; Vector lemonSplatOffset; Vector leadTargetDir; Vector ponyOrbitPos; Vector chaseVelocity; Vector returnVelocity; RNG rng; undefined8 uStack_2f0; Vector whitePonyFireDirection; KColor primaryHueColor; EntityList_EL nearbyPickups; EntityList_EL nuggetTargets [2]; Vector spawnParentPos; Vector toParent; Vector rotatedVelocity; Vector tearVelocity; Vector tearPos; EntityList_EL nearbyEnemies; Vector leadTargetDelta; Vector toTarget; Vector toPlayer; Vector toEnemy; Vector enemyPos; Vector ponyFireDirection; Vector explosionPos; Vector laserOffset; Vector clampedOrbitPos; undefined1 texture [4]; int *textureRefBlock; Vector orbitPos; Vector parentPos; Vector aimDirection; int updateSteps; Vector laserDirection; Vector shotDirection; Entity *local_1e0; EntityPtr *local_1dc; float local_1d8; Entity *local_1d4; float local_1d0; float local_1cc; EntityPtr local_1c8; float local_1c4; Entity *local_1c0; Entity *local_1bc; char isFiring; Room *local_1b4; Color targetTintColor; Color pillPrimaryColor; Color pillSecondaryColor; Color rainbowPrimaryColor; Color explosionColor; Color rainbowSecondaryColor; ColorMod splatColor; ColorMod lemonSplatColor; ColorMod lemonadeSplatColor; RNG seedRng; uint stackCookie; void *prevExceptionList; undefined1 *puStack_c; float ehState; Game *game; Manager *manager; Entity_Pickup *pickup; ColorMod *pillLayerColor; undefined4 swapValue; EntityPtr *targetSlot; ehState = -NAN; puStack_c = &LAB_00af2261; prevExceptionList = ExceptionList; uVar6 = __security_cookie ^ GHIDRA_UINT((&lemonadeSplatColor)[1]._offset); ExceptionList = &prevExceptionList; if (this->_variant == 0xed) { iVar10 = this->_wispCollectibleType; } else if (this->_variant == 0xce) { iVar10 = this->_subtype; } else { iVar10 = 0x248; } local_1b4 = GHIDRA_CAST(this); stackCookie = uVar6; local_1c8 = (EntityPtr)ItemConfig::get_wisp_config(iVar10); isFiring = *GHIDRA_CAST(&(GHIDRA_CAST((GHIDRA_INT(local_1c8) + 0x10)))->y); updateSteps = GHIDRA_INT(this->_updateTime) - GHIDRA_INT(this->_prevUpdateTime); if ((this->_variant == 0xce) && (this->_subtype == 0x28a)) { EVar9 = this->_target; if ((EVar9 == (EntityPtr)0x0) || (((*GHIDRA_CAST((GHIDRA_CAST(EVar9) + 0x28)) != 3 || (*GHIDRA_CAST((GHIDRA_CAST(EVar9) + 0xd88)) != 6)) || (*GHIDRA_CAST((GHIDRA_CAST(EVar9) + 0xd4c)) < 1)))) { if (this->_state == 1) { this->_state = 0; this->_fireCooldown = 0; this->_entityGridCollisionClass = 0; layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); piVar7 = (GHIDRA_CAST((layer)))->LayerState::GetTexture(texture); ehState = 0.0; anim_00 = s_Idle2; if (*GHIDRA_CAST((*piVar7 + 0x10)) < 0x81) { anim_00 = s_Idle; } (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(anim_00,0); ehState = 1.4013e-45; if (((textureRefBlock != GHIDRA_CAST(0x0)) && (cVar4 = (**(code **)(*textureRefBlock + 0xc))(uVar6), cVar4 != '\0')) && (g_imageReleaseFn != (void *)0x0)) { (*g_imageReleaseFn)(texture); } ehState = -NAN; } goto LAB_0043ac23; } bVar11 = false; if (this->_state == 0) { this->_state = 1; this->_fireCooldown = 0; this->_entityGridCollisionClass = 3; goto LAB_0043ac23; } } else { LAB_0043ac23: bVar11 = this->_state == 0; } local_1e0 = GHIDRA_CAST(0x3f800000); if (bVar11) { if (this->_orbitLayer < 0) { fVar12 = (this->_formationOffset).x; if ((fVar12 != g_vectorZero.x) || ((this->_formationOffset).y != g_vectorZero.y)) { (this->_pos).x = fVar12; (this->_pos).y = (this->_formationOffset).y; (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; } } else { pEVar8 = get_orbit_parent(this); local_1bc = GHIDRA_CAST((pEVar8->_pos).x); local_1cc = (pEVar8->_velocity).y; local_1d0 = (pEVar8->_pos).y; local_1c4 = (pEVar8->_velocity).x; if (((this->_subtype == 0x2c5) || (this->_subtype == 0x25c)) && ((pEVar15 = GHIDRA_CAST((this->_targetPosition).x), (float)pEVar15 != g_vectorZero.x || ((this->_targetPosition).y != g_vectorZero.y)))) { local_1d0 = (this->_targetPosition).y; local_1c4 = g_vectorZero.x; local_1cc = g_vectorZero.y; local_1bc = pEVar15; } if ((pEVar8->_type == 3) && (pEVar8->_variant == 0xf0)) { local_1c4 = local_1c4 * 0.5; local_1cc = local_1cc * 0.5; } parentPos.x = (float)local_1bc; parentPos.y = local_1d0; GetOrbitPosition(this,&orbitPos,&parentPos); if (this->_subtype == 0x25c) { Room::GetClampedPositionImpl(g_game->_room,&clampedOrbitPos,&orbitPos,0.0,0.0,0.0,0.0); local_1d4 = GHIDRA_CAST(clampedOrbitPos.x); local_1d8 = clampedOrbitPos.y; } else { local_1d8 = orbitPos.y; local_1d4 = GHIDRA_CAST(orbitPos.x); } local_1d0 = local_1d0 - (this->_pos).y; local_1bc = GHIDRA_CAST(((float)local_1bc - (this->_pos).x)); local_1c0 = GHIDRA_CAST(sqrtf(local_1d0 * local_1d0 + (float)local_1bc * (float)local_1bc)); local_1d0 = local_1d0 * 0.01; local_1bc = GHIDRA_CAST(((float)local_1bc * 0.01)); fVar12 = sqrtf(local_1d0 * local_1d0 + (float)local_1bc * (float)local_1bc); if ((8.0 < fVar12) && (0.0 < fVar12)) { local_1bc = GHIDRA_CAST(((float)local_1bc * (8.0 / fVar12))); local_1d0 = local_1d0 * (8.0 / fVar12); } fVar12 = (this->_orbitDistance).y; orbitDistance = &this->_orbitDistance; if ((this->_orbitDistance).x <= fVar12 && fVar12 != (this->_orbitDistance).x) { orbitDistance = GHIDRA_CAST(&(this->_orbitDistance).y); } pEVar15 = GHIDRA_CAST(((((float)local_1c0 - (orbitDistance->x + 10.0)) - 0.0) / 160.0)); if ((float)pEVar15 <= 0.0) { pEVar15 = GHIDRA_CAST(0x0); } if ((float)local_1e0 <= (float)pEVar15) { pEVar15 = local_1e0; } fVar12 = (float)local_1e0 - ((float)pEVar15 + 0.0); local_1c0 = GHIDRA_CAST(((float)local_1e0 - fVar12 * fVar12)); fVar12 = ((float)local_1e0 - (float)local_1c0) + ((float)local_1e0 - (float)local_1c0); local_1c4 = (local_1c4 * fVar12) / pEVar8->_friction; local_1cc = (local_1cc * fVar12) / pEVar8->_friction; local_1d4 = GHIDRA_CAST((((float)local_1d4 - ((this->_pos).x + local_1c4)) * 0.5)); local_1d8 = (local_1d8 - ((this->_pos).y + local_1cc)) * 0.5; fVar12 = sqrtf((float)local_1d4 * (float)local_1d4 + local_1d8 * local_1d8); if ((fVar12 <= 5.0) || ((this->_flags & 0x20000000000) != 0)) { pEVar8 = local_1d4; fVar12 = local_1d8; } else { pEVar8 = local_1d4; fVar16 = local_1d8; if (0.0 < fVar12) { fVar16 = local_1d8 * ((float)local_1e0 / fVar12); pEVar8 = GHIDRA_CAST(((float)local_1d4 * ((float)local_1e0 / fVar12))); } pEVar8 = GHIDRA_CAST(((float)pEVar8 * 4.0)); fVar12 = fVar16 * 4.0; } fVar16 = (fVar12 + local_1cc) / this->_friction; fVar12 = ((float)pEVar8 + local_1c4) / this->_friction; (this->_velocity).y = ((local_1d0 + (this->_velocity).y) - fVar16) * (float)local_1c0 + fVar16 ; (this->_velocity).x = (((float)local_1bc + (this->_velocity).x) - fVar12) * (float)local_1c0 + fVar12; } } local_1c4 = (this->_health / this->_maxHitPoints) * 0.4 + 0.6; if (this->_variant == 0xce) { if (this->_subtype == 0x242) { local_1c4 = local_1c4 * 1.5; } else if (this->_subtype == 0x263) { local_1c4 = ((float)this->_keys * 0.05 + (float)local_1e0) * local_1c4; } } local_1cc = sqrtf(local_1c4); local_1c0 = GHIDRA_CAST((local_1cc * g_vectorOne.x)); local_1cc = local_1cc * g_vectorOne.y; layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); (layer->_size).x = (float)local_1c0; (layer->_size).y = local_1cc; local_1c0 = GHIDRA_CAST((local_1c4 * g_vectorOne.x)); local_1c4 = local_1c4 * g_vectorOne.y; layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x1)); (layer->_size).x = (float)local_1c0; (layer->_size).y = local_1c4; player = this->_player; local_1d8 = g_vectorZero.x; local_1bc = GHIDRA_CAST((player->_meleeDamage + player->_meleeDamage)); local_1d4 = GHIDRA_CAST(g_vectorZero.y); local_1cc = 0.0; local_1c4 = 0.0; this->_collisionDamage = (float)local_1bc; local_1d0 = (float)GHIDRA_INT((GHIDRA_CAST((GHIDRA_INT(local_1c8) + 0x10)))->x); if (this->_variant != 0xce) goto LAB_0043cdfe; uVar6 = this->_subtype; if (uVar6 < 299) { if (uVar6 == 0x12a) { bVar5 = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x12a); if ((bVar5 != 0) || (bVar5 = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x4d), bVar5 != 0)) { fVar12 = -5.0; goto code_r0x0043bfeb; } fVar12 = 0.0; LAB_0043bfef: this->_collisionDamage = fVar12; bVar5 = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x4d); if ((bVar5 == 0) && (bVar5 = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::HasCollectibleEffect(0x12a), bVar5 == 0)) { local_1c0 = GHIDRA_CAST(0x3e99999a); local_1bc = GHIDRA_CAST(0x3f333333); local_1b4 = GHIDRA_CAST((((float)(GHIDRA_UINT(((g_game->_frameCount - this->_spawnFrame) + this->_initSeed)) % 0x3c) + 0.0) / 60.0)); } else { local_1c0 = local_1e0; local_1bc = local_1e0; local_1b4 = GHIDRA_CAST((((float)(GHIDRA_UINT(((g_game->_frameCount - this->_spawnFrame) + this->_initSeed)) % 0x1e) + 0.0) / 30.0)); } hsv_to_rgb(&primaryHueColor,(float)local_1b4 * 360.0,(float)local_1c0,(float)local_1bc,1.0); ::(GHIDRA_CAST((&rainbowPrimaryColor)))->Color::Color(); layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); if (&layer->_color != GHIDRA_CAST(extraout_EAX_02)) { fVar12 = extraout_EAX_02[1]; fVar16 = extraout_EAX_02[2]; fVar13 = extraout_EAX_02[3]; (layer->_color)._tint[0] = *extraout_EAX_02; (layer->_color)._tint[1] = fVar12; (layer->_color)._tint[2] = fVar16; (layer->_color)._tint[3] = fVar13; fVar12 = extraout_EAX_02[5]; fVar16 = extraout_EAX_02[6]; fVar13 = extraout_EAX_02[7]; (layer->_color)._colorize[0] = extraout_EAX_02[4]; (layer->_color)._colorize[1] = fVar12; (layer->_color)._colorize[2] = fVar16; (layer->_color)._colorize[3] = fVar13; *GHIDRA_CAST((layer->_color)._offset) = *GHIDRA_CAST((extraout_EAX_02 + 8)); (layer->_color)._offset[2] = extraout_EAX_02[10]; } fVar12 = (float)local_1b4 + 0.2; if ((float)local_1e0 < fVar12) { fVar12 = fVar12 - (float)local_1e0; } hsv_to_rgb(&secondaryHueColor,fVar12 * 360.0,(float)local_1c0,(float)local_1bc,1.0); ::(GHIDRA_CAST((&rainbowSecondaryColor)))->Color::Color(); layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x1)); if (&layer->_color != GHIDRA_CAST(extraout_EAX_03)) { fVar12 = extraout_EAX_03[1]; fVar16 = extraout_EAX_03[2]; fVar13 = extraout_EAX_03[3]; (layer->_color)._tint[0] = *extraout_EAX_03; (layer->_color)._tint[1] = fVar12; (layer->_color)._tint[2] = fVar16; (layer->_color)._tint[3] = fVar13; fVar12 = extraout_EAX_03[5]; fVar16 = extraout_EAX_03[6]; fVar13 = extraout_EAX_03[7]; (layer->_color)._colorize[0] = extraout_EAX_03[4]; (layer->_color)._colorize[1] = fVar12; (layer->_color)._colorize[2] = fVar16; (layer->_color)._colorize[3] = fVar13; *GHIDRA_CAST((layer->_color)._offset) = *GHIDRA_CAST((extraout_EAX_03 + 8)); (layer->_color)._offset[2] = extraout_EAX_03[10]; } } else { switch(uVar6) { case 0x28: local_1c8 = (EntityPtr) (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::GetCollectibleEffect(0x28); if ((player->_dead == 0) && (local_1c8 != (EntityPtr)0x0)) { pvVar1 = (g_manager->_itemConfig)._collectibles._begin; if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar1) >> 2 < 0x29) { iVar10 = 0; } else { iVar10 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0xa0)); } if ((GHIDRA_CAST((GHIDRA_INT(local_1c8) + 8)))->_head == (void *)(*GHIDRA_CAST((iVar10 + 0x78)) + -1)) { local_1b4 = GHIDRA_CAST(((this->_pos).x - (player->_pos).x)); local_1bc = GHIDRA_CAST(((this->_pos).y - (player->_pos).y)); fVar12 = sqrtf((float)local_1b4 * (float)local_1b4 + (float)local_1bc * (float)local_1bc ); if (70.0 <= fVar12) { pRVar14 = local_1b4; pEVar8 = local_1bc; } else { pRVar14 = GHIDRA_CAST(((float)local_1b4 * (70.0 / fVar12))); pEVar8 = GHIDRA_CAST(((float)local_1bc * (70.0 / fVar12))); } ::(GHIDRA_CAST((&explosionColor)))->Color::Color(); explosionPos.x = (float)pRVar14 + (player->_pos).x; explosionPos.y = (float)pEVar8 + (player->_pos).y; Game::BombExplosionEffects (g_game,&explosionPos,30.0,(BitSet128)ZEXT816(0),Color,GHIDRA_CAST(this),0.75,1,4 ,0); } } break; case 0x2c: LAB_0043c942: switch(*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf24))))) { case 0: iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf28)))); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf28)))) = iVar10 + -1; if (iVar10 < 0) { *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf24)))) = 1; } break; case 1: isFiring = '\0'; this->_collisionDamage = 0.0; if (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf2c)))) <= 0.0) { *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf24)))) = 3; uVar6 = Random(); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf28)))) = uVar6 % 0x1e + 0x1e; } else { *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf2c)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf2c)))) - 0.1; } break; case 2: if ((float)local_1e0 <= *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf2c))))) { *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf24)))) = 0; uVar6 = Random(); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf28)))) = uVar6 % 0x1e + 0x3c; } else { *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf2c)))) = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf2c)))) + 0.1; } break; case 3: iVar10 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf28)))); isFiring = '\0'; this->_visible = 0; this->_collisionDamage = 0.0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf28)))) = iVar10 + -1; if (iVar10 < 0) { this->_visible = 1; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf24)))) = 2; } } ::(GHIDRA_CAST((&fadeColor)))->Color::operator_assign(&(this->_sprite)._color); fadeColor._tint[3] = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf2c)))); (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(color); break; case 0x2f: if (((player->_itemState == 0x2f) && (pvVar1 = player->_weapons[0], pvVar1 != (void *)0x0)) && ((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x30)) == 6 && ((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x44)) != 0 && (0xf < g_game->_frameCount - *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x44)) + 0x328)))))))) { if (0 < this->_fireCooldown) { this->_fireCooldown = this->_fireCooldown + -1; } local_1d8 = 0.0; local_1d4 = local_1e0; } break; case 0x31: if (((player->_itemState == 0x31) && (player->_itemStateCooldown == 0x1e)) && (this->_counter < 1)) { laserDirection.x = (player->_aimDirection).x; laserDirection.y = (player->_aimDirection).y; if ((laserDirection.x == g_vectorZero.x) && (laserDirection.y == g_vectorZero.y)) { laserDirection.x = (this->_targetPosition).x; laserDirection.y = (this->_targetPosition).y; } (GHIDRA_CAST((&laserDirection)))->Vector::Normalize(); bVar5 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0xf7,0); if (bVar5 == 0) { local_1e0 = GHIDRA_CAST(0x40000000); } orbitDistance = &laserOffset; bVar5 = 0; iVar10 = 0xf; laserOffset.x = 0.0; laserOffset.y = -18.0; source = this; fVar12 = atan2f(laserDirection.y,laserDirection.x); laser = Entity_Laser::ShootAngle (3,&this->_pos,fVar12 * 57.295776,iVar10,orbitDistance,GHIDRA_CAST(source), bVar5); laser->SetCollisionDamage((float)local_1e0 * 3.5); laser->_scale = (float)local_1e0 * 0.15 + 0.35; (GHIDRA_CAST((laser)))->Entity_Laser::ResetSpriteScale(); if (laserDirection.y <= -0.5) { fVar12 = -50.0; } else { fVar12 = 3000.0; } laser->_renderDepthOffset = fVar12; laser->Update(); this->_counter = 8; } break; case 0x38: bVar5 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(4,0); if (bVar5 != 0) { uVar6 = Random(); if (uVar6 % 6 == 0) { uVar6 = Random(); pEVar8 = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0x2e,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar6); fVar16 = g_vectorOne.x * 0.65; fVar12 = g_vectorOne.y * 0.65; pAVar3 = &pEVar8[1]._sprite; (pAVar3->_filename)._buf[4] = 'Z'; (pAVar3->_filename)._buf[5] = '\0'; (pAVar3->_filename)._buf[6] = '\0'; (pAVar3->_filename)._buf[7] = '\0'; (pEVar8->_sprite)._scale.x = fVar16; pAVar3 = &pEVar8[1]._sprite; (pAVar3->_filename)._buf[8] = 'Z'; (pAVar3->_filename)._buf[9] = '\0'; (pAVar3->_filename)._buf[10] = '\0'; (pAVar3->_filename)._buf[0xb] = '\0'; (pEVar8->_sprite)._scale.y = fVar12; pEVar8->SetCollisionDamage(0x40e00000); pEVar8->Update(); splatColor._tint[0] = 1.0; splatColor._tint[1] = 1.0; splatColor._tint[2] = 1.0; splatColor._tint[3] = 1.0; splatColor._offset[0] = 0.0; splatColor._colorize[0] = 6.0714; splatColor._colorize[1] = 5.7857; splatColor._colorize[2] = 0.0; splatColor._colorize[3] = 1.0; splatColor._offset[1] = 0.0; splatColor._offset[2] = 0.0; (GHIDRA_CAST((GHIDRA_CAST(&pEVar8->_sprite))))->Sprite::SetColor(&splatColor); } uVar6 = Random(); if (uVar6 % 6 == 0) { uVar6 = Random(); splat = Entity_NPC::MakeSplat (GHIDRA_CAST(this), (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283064e-10 * 0.5 + 0.2); orbitDistance = MusicManager::RandomVector(&lemonSplatOffset); lemonSplatColor._offset[0] = 0.7843138; lemonSplatColor._offset[1] = 0.7843138; lemonSplatColor._offset[2] = 0.0; fVar12 = orbitDistance->y; iVar10 = *GHIDRA_CAST(splat); fVar16 = (this->_pos).y; (splat->_pos).x = orbitDistance->x + orbitDistance->x + (this->_pos).x + 0.0; lemonSplatColor._colorize[0] = 0.0; lemonSplatColor._colorize[1] = 0.0; lemonSplatColor._colorize[2] = 0.0; lemonSplatColor._colorize[3] = 0.0; (splat->_pos).y = fVar12 + fVar12 + fVar16 + 8.0; lemonSplatColor._tint[0] = 0.0; lemonSplatColor._tint[1] = 0.0; lemonSplatColor._tint[2] = 0.0; lemonSplatColor._tint[3] = 0.7; (**(code **)(iVar10 + 0x3c))(&lemonSplatColor,0xffffffff,0xff,0,1); } } break; case 0x4d: fVar12 = 8.0; code_r0x0043bfeb: fVar12 = (float)local_1bc + fVar12; goto LAB_0043bfef; case 0x5d: targetSlot = &this->_target; local_1c8 = (EntityPtr)targetSlot; if (this->_target != (EntityPtr)0x0) { if ((this->_counter < 1) || (*GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x173)) != '\0')) { std::multiset::erase(&local_1c8); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((targetSlot)) + 0x0)))) = 0; } else { ::(GHIDRA_CAST((&targetTintColor)))->Color::Color(); (*extraout_EDX)(extraout_EAX,2,0,0,1); pEVar8 = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((targetSlot)) + 0x0)))); (GHIDRA_CAST((&fearSource)))->EntityRef::constructor(GHIDRA_CAST(this)); (GHIDRA_CAST((pEVar8)))->Entity::AddFear(&fearSource,-2,0); uVar6 = Random(); if ((uVar6 & 3) == 0) { pcVar2 = *(code **)(*GHIDRA_CAST(*GHIDRA_CAST(local_1c8)) + 0x20); (GHIDRA_CAST((&targetDamageSource)))->EntityRef::constructor(GHIDRA_CAST(local_1b4)); (*pcVar2)(0,0x4000000,0,&targetDamageSource,0x1e); this = GHIDRA_CAST(local_1b4); } } } break; case 0x66: if (g_game->_frameCount == this->_spawnFrame) { if ((0 < this->_coins) && (GHIDRA_UINT(this->_coins) < 7)) { local_1c0 = GHIDRA_CAST((GHIDRA_CAST((&g_game->_seedEffects)))->Seeds)::GetStartSeed(); if (local_1c0 != pERam00c7e838) { uRam00c7e820 = 0; uRam00c7e824 = 1; uRam00c7e828 = 2; uRam00c7e82c = 3; local_1c8 = (EntityPtr)&DAT_0000000f; uRam00c7e830 = 4; uRam00c7e834 = 5; uStack_2f0 = 0x900000002; local_1bc = GHIDRA_CAST(0x0); pEVar8 = local_1c0; do { if (pEVar8 == GHIDRA_CAST(0x0)) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar2 = (code *)swi(3); (*pcVar2)(); return; } uVar6 = GHIDRA_UINT(pEVar8) >> 2 ^ GHIDRA_UINT(pEVar8); uVar6 = uVar6 << 9 ^ uVar6; pEVar8 = GHIDRA_CAST((uVar6 >> 0xf ^ uVar6)); if (6U - GHIDRA_INT(local_1bc) == 0) { uVar6 = 0; } else { uVar6 = GHIDRA_UINT(pEVar8) % (6U - GHIDRA_INT(local_1bc)); } swapValue = *GHIDRA_CAST((GHIDRA_INT(local_1bc) * 4 + 0xc7e820)); iVar10 = GHIDRA_INT((&(local_1bc->_sprite)._filename + -3)) + uVar6; *GHIDRA_CAST((GHIDRA_INT(local_1bc) * 4 + 0xc7e820)) = *GHIDRA_CAST((iVar10 * 4 + 0xc7e820)); local_1bc = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_1bc)) + 0x1)))); *GHIDRA_CAST((iVar10 * 4 + 0xc7e820)) = swapValue; } while (local_1bc < &DAT_00000005); this = GHIDRA_CAST(local_1b4); pERam00c7e838 = local_1c0; } FUN_00a0f720(*GHIDRA_CAST(((GHIDRA_CAST(this))->_gridPaths[0x184] * 4 + 0xc7e81c)) * 0x14 + 0xc33a98); ::(GHIDRA_CAST((&pillPrimaryColor)))->Color::Color(); pillLayerColor = extraout_EAX_00; layer = (GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 9)))))->ANM2::GetLayer(GHIDRA_CAST(0x0)); ::(GHIDRA_CAST((GHIDRA_CAST(&layer->_color))))->Color::operator_assign(pillLayerColor); ::(GHIDRA_CAST((&pillSecondaryColor)))->Color::Color(); pillLayerColor = extraout_EAX_01; layer = (GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 9)))))->ANM2::GetLayer(GHIDRA_CAST(0x1)); ::(GHIDRA_CAST((GHIDRA_CAST(&layer->_color))))->Color::operator_assign(pillLayerColor); } } break; case 0x7b: seedRng._seed = this->_initSeed; seedRng._shift1 = 1; seedRng._shift2 = 0xb; seedRng._shift3 = 0x10; uVar6 = (GHIDRA_CAST((&seedRng)))->RNG::RandomInt(0xe); local_1d0 = (float)(uVar6 + 0x10); break; case 0x82: iVar10 = player->_fireDirection; Isaac::GetAxisAlignedUnitVectorFromDir(&ponyFireDirection,iVar10); cooldown = this->_fireCooldown; if (0 < cooldown) { cooldown = cooldown + -1; this->_fireCooldown = cooldown; } if (((-1 < cooldown) && (this->_isInvicible != 0)) && (orbitDistance = GetOrbitPosition(this,&ponyOrbitPos,GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x33c))), fVar12 = (this->_pos).x - orbitDistance->x, fVar16 = (this->_pos).y - orbitDistance->y, fVar16 * fVar16 + fVar12 * fVar12 < 50.0)) { this->_isInvicible = 0; PlayFloatAnim(this,-1); } game = g_game; cooldown = this->_fireCooldown; if (cooldown < 0) { if (((this->_collidesWithGrid != 0) || (cooldown < -1)) || (bVar5 = (GHIDRA_CAST((g_game->_room)))->Room::IsPositionInRoom(&this->_pos,-100.0), bVar5 == 0)) { this->_entityGridCollisionClass = 0; pRVar14 = game->_room; iVar10 = (GHIDRA_CAST((pRVar14)))->Room::GetGridIndex(GHIDRA_CAST((local_1b4->_gridEntities + 0xc6))); (GHIDRA_CAST((&gridDamageSource)))->EntityRef::constructor(local_1b4->_gridEntities[0xfb]); (GHIDRA_CAST((pRVar14)))->Room::DamageGridWithSource(iVar10,1,&gridDamageSource); (GHIDRA_CAST((local_1b4->_gridEntities + 0xcf)))->x = (GHIDRA_CAST((local_1b4->_gridEntities + 0xcf)))->x * 0.5; local_1b4->_gridEntities[0xd0] = (void *)((float)local_1b4->_gridEntities[0xd0] * 0.5); local_1b4->_gridPaths[0x178] = local_1b4->_gridPaths[0x178] + -1; this = GHIDRA_CAST(local_1b4); if (local_1b4->_gridPaths[0x178] < -10) { local_1b4->_gridPaths[0x178] = 0x3c; local_1b4->_gridPaths[0x187] = 0; } } } else { (this->_sprite)._flipX = ponyFireDirection.x < 0.0; if ((iVar10 != -1) && (cooldown < 1)) { this->_state = 1; this->_isInvicible = 1; this->_fireCooldown = -1; this->_entityGridCollisionClass = 4; (this->_velocity).x = ponyFireDirection.x * 10.0; (this->_velocity).y = ponyFireDirection.y * 10.0; PlayShootAnim(this,-1); } } iVar10 = 1; if (*GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 0xe3)) != 0) { (GHIDRA_CAST(this))->_gridEntities[0xd9] = (void *)((float)(GHIDRA_CAST(this))->_gridEntities[0xd9] * 0.2); } goto LAB_0043ce03; case 0xaf: local_1b4 = g_game->_room; local_1bc = GHIDRA_CAST((GHIDRA_CAST((local_1b4)))->Room)::GetGridIndex(&this->_pos); if ((-1 < GHIDRA_INT(local_1bc)) && (GHIDRA_INT(local_1bc) < 0x1c0)) { local_1c8 = (EntityPtr)(GHIDRA_CAST((local_1b4)))->Room::GetGridCollision(GHIDRA_INT(local_1bc)); pickup = local_1b4->_gridEntities[GHIDRA_INT(local_1bc)]; if (pickup != GHIDRA_CAST(0x0)) { iVar10 = (pickup->_desc)._type; if (iVar10 == 0x10) { if ((((local_1c8 == (EntityPtr)&DAT_00000004) && (bVar5 = (GHIDRA_CAST((pickup)))->GridEntity_Door::IsLocked(), bVar5 != 0)) && ((local_1b4->_gridEntities[GHIDRA_INT(local_1bc)]->_doorFlags & 1) == 0)) && (bVar5 = GridEntity_Door::TryUnlock (local_1b4->_gridEntities[GHIDRA_INT(local_1bc)],player,1), bVar5 != 0) ) { killSource = &doorUnlockKillSource; goto LAB_0043bc25; } } else if ((iVar10 == 0xb) && ((pickup->_desc)._state == 0)) { (GHIDRA_CAST((GHIDRA_CAST(pickup))))->GridEntity_Lock::try_unlock(player,1); killSource = &lockUnlockKillSource; LAB_0043bc25: killSource = (GHIDRA_CAST((killSource)))->EntityRef::EntityRef(); (*extraout_EDX_00)(killSource); } } } if (this->_dead == 0) { bVar5 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(2,0); if (bVar5 != 0) { EntityList::QueryRadius(&local_1b4->_entityList,&nearbyPickups,&this->_pos,24.0,0x10); ehState = 2.8026e-45; pickupIndex = 0; uVar6 = nearbyPickups._size; if (nearbyPickups._size == 0) { LAB_0043bd3e: ehState = -NAN; (GHIDRA_CAST((&nearbyPickups)))->EntityList_Query::~EntityList_Query(); } else { do { pickup = *GHIDRA_CAST((GHIDRA_CAST(nearbyPickups._data) + pickupIndex * 4)); if (pickup != GHIDRA_CAST(0x0)) { if (pickup->_type == 5) { iVar10 = pickup->_variant; if (((iVar10 == 0x3c) || (iVar10 == 0x35)) || (iVar10 == 0x37)) { bVar5 = (GHIDRA_CAST((pickup)))->Entity_Pickup::TryOpenChest(this->_player); if (bVar5 != 0) { killSource = &chestOpenKillSource; goto LAB_0043bd2f; } uVar6 = nearbyPickups._size; } } else if (((pickup->_type == 6) && (pickup->_variant == 7)) && ((pvVar1 = (pickup->_sprite)._animState._animData, pvVar1 == (void *)0x0 || ((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x34)) != '\0' || ((pickup->_sprite)._animState._isPlaying == 0)))))) { Entity::ForceCollide(this->_player,GHIDRA_CAST(pickup),1); killSource = &pickupCollideKillSource; LAB_0043bd2f: killSource = (GHIDRA_CAST((killSource)))->EntityRef::EntityRef(); (*extraout_EDX_01)(killSource); goto LAB_0043bd3e; } } pickupIndex = pickupIndex + 1; } while (pickupIndex < uVar6); ehState = -NAN; (GHIDRA_CAST((&nearbyPickups)))->EntityList_Query::~EntityList_Query(); } } } break; case 0xb5: Isaac::GetAxisAlignedUnitVectorFromDir(&whitePonyFireDirection,player->_fireDirection); (this->_sprite)._flipX = whitePonyFireDirection.x < 0.0; break; case 0x11a: LAB_0043cc72: this->_collisionDamage = (float)local_1bc * 0.5; } } goto LAB_0043cdfe; } if (0x242 < uVar6) { if (uVar6 < 0x2d3) { if (uVar6 == 0x2d2) { EVar9 = this->_parent; if (EVar9 == (EntityPtr)0x0) { killSource = (GHIDRA_CAST((&noParentKillSource)))->EntityRef::EntityRef(); this->Kill(killSource); } else { toParent.x = *GHIDRA_CAST((GHIDRA_CAST(EVar9) + 0x33c)) - (this->_pos).x; toParent.y = *GHIDRA_CAST((GHIDRA_CAST(EVar9) + 0x340)) - (this->_pos).y; orbitDistance = (GHIDRA_CAST((&toParent)))->Vector::Normalized(&toParentDir); local_1d8 = orbitDistance->x; local_1d4 = GHIDRA_CAST(orbitDistance->y); } } else { switch(uVar6) { case 0x263: this->_collisionDamage = (float)this->_keys * 0.15 * (float)local_1bc; break; case 0x27b: goto LAB_0043cc72; case 0x2be: this->_mass = 0.1; this->_collisionDamage = (float)local_1bc * 0.25; break; case 0x2bf: bVar5 = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::HasNullEffect(100); if (((bVar5 != 0) && (this->_coins == 0)) || ((bVar5 = (GHIDRA_CAST((&player->_temporaryeffects)))->TemporaryEffects::HasNullEffect(100), bVar5 == 0 && (this->_coins == 1)))) { killSource = (GHIDRA_CAST((&nullEffectKillSource)))->EntityRef::EntityRef(); this->Kill(killSource); } } } } else { if (uVar6 != 0x2d8) { if (uVar6 == 0x1000e) { uVar6 = Random(); iVar10 = (uVar6 & 3) + 5; } else { if (uVar6 != 0x10010) goto LAB_0043cdfe; iVar10 = 4; local_1cc = 90.0; if ((this->_coins & 1U) == 0) { local_1c4 = 45.0; } if ((float)this->_fireCooldown == local_1d0) { this->_coins = this->_coins + 1; } } goto LAB_0043ce03; } this->_isInvicible = g_game->_frameCount - this->_spawnFrame < 0x3c; } goto LAB_0043cdfe; } if (uVar6 == 0x242) { bVar5 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(4,0); if (bVar5 != 0) { uVar6 = Random(); if (uVar6 % 6 == 0) { uVar6 = Random(); splat = Entity_NPC::MakeSplat (GHIDRA_CAST(this), (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283064e-10 * 0.5 + 0.2); orbitDistance = MusicManager::RandomVector(&lemonadeSplatOffset); lemonadeSplatColor._offset[0] = 0.7843138; lemonadeSplatColor._offset[1] = 0.7843138; lemonadeSplatColor._offset[2] = 0.0; fVar12 = orbitDistance->y; iVar10 = *GHIDRA_CAST(splat); fVar16 = (this->_pos).y; (splat->_pos).x = orbitDistance->x + orbitDistance->x + (this->_pos).x + 0.0; lemonadeSplatColor._colorize[0] = 0.0; lemonadeSplatColor._colorize[1] = 0.0; lemonadeSplatColor._colorize[2] = 0.0; lemonadeSplatColor._colorize[3] = 0.0; (splat->_pos).y = fVar12 + fVar12 + fVar16 + 8.0; lemonadeSplatColor._tint[0] = 0.0; lemonadeSplatColor._tint[1] = 0.0; lemonadeSplatColor._tint[2] = 0.0; lemonadeSplatColor._tint[3] = 0.7; (**(code **)(iVar10 + 0x3c))(&lemonadeSplatColor,0xffffffff,0xff,0,1); } } goto LAB_0043cdfe; } switch(uVar6) { case 0x143: if (0x5a < g_game->_frameCount - this->_spawnFrame) { killSource = (GHIDRA_CAST((&timeoutKillSource)))->EntityRef::EntityRef(); this->Kill(killSource); } break; case 0x145: uVar6 = Random(); iVar10 = (uVar6 & 1) + 2; goto LAB_0043ce03; case 0x18c: EVar9 = this->_parent; if (g_game->_frameCount == this->_spawnFrame) { if (EVar9 != (EntityPtr)0x0) { spawnParentPos.x = *GHIDRA_CAST((GHIDRA_CAST(EVar9) + 0x33c)); spawnParentPos.y = *GHIDRA_CAST((GHIDRA_CAST(EVar9) + 0x340)); orbitDistance = GetOrbitPosition(this,&spawnOrbitPos,&spawnParentPos); (this->_pos).x = orbitDistance->x; (this->_pos).y = orbitDistance->y; } } else if (EVar9 == (EntityPtr)0x0) { this->Remove(); } else if (*GHIDRA_CAST((GHIDRA_CAST(EVar9) + 0x173)) != '\0') { killSource = (GHIDRA_CAST((&parentDeadKillSource)))->EntityRef::EntityRef(); this->Kill(killSource); } break; case 0x196: (GHIDRA_CAST((&rng)))->RNG::game_constructor((this->_dropRNG)._seed,0xd); uVar6 = (GHIDRA_CAST((&rng)))->RNG::RandomInt(5); local_1d0 = (float)(GHIDRA_INT(local_1d0) + -2 + uVar6); break; case 0x1a3: goto LAB_0043c942; case 0x1ab: FamiliarHelper::wisp_mine_crafter_update(this); break; case 0x1b9: ai_mega_blast_wisp(this); break; case 0x1e7: EVar9 = this->_target; local_1c8 = (EntityPtr)(*GHIDRA_CAST((GHIDRA_CAST(local_1c8) + 0x18c)) + 7); isFiring = '\0'; if (EVar9 == (EntityPtr)0x0) { if (this->_orbitLayer < 0) { this->_friction = 0.9; orbitDistance = GetOrbitDistance(&layerOrbitDistance,GHIDRA_INT(local_1c8)); local_1b4 = GHIDRA_CAST((this->_pos).x); local_1bc = GHIDRA_CAST((this->_pos).y); fVar12 = (float)local_1b4 - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); fVar16 = (float)local_1bc - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); fVar12 = sqrtf(fVar12 * fVar12 + fVar16 * fVar16); if (orbitDistance->x <= fVar12) { bVar5 = 0; toPlayer.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) - (float)local_1b4; toPlayer.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) - (float)local_1bc; orbitDistance = (GHIDRA_CAST((&toPlayer)))->Vector::Resized(&returnVelocity,0.5); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddVelocity_divided(orbitDistance,bVar5); } else { AddToOrbit(this,GHIDRA_INT(local_1c8)); } } else { this->_friction = 1.0; } EntityList::QueryRadius (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&nearbyEnemies,&this->_pos,100.0,8); uVar6 = 0; ehState = 5.60519e-45; if (nearbyEnemies._size == 0) { LAB_0043c7c6: ehState = -NAN; (GHIDRA_CAST((&nearbyEnemies)))->EntityList_Query::~EntityList_Query(); } else { do { bVar5 = Entity::IsVulnerableEnemy (*GHIDRA_CAST((GHIDRA_CAST(nearbyEnemies._data) + uVar6 * 4)),GHIDRA_CAST(0x0)); if (bVar5 != 0) { local_1c8 = *GHIDRA_CAST((GHIDRA_CAST(nearbyEnemies._data) + uVar6 * 4)); targetSlot = &this->_target; if (this->_target != (EntityPtr)0x0) { local_1bc = GHIDRA_CAST(targetSlot); std::multiset::erase(&local_1bc); } *targetSlot = local_1c8; if (local_1c8 != (EntityPtr)0x0) { std::multiset::insert(targetSlot); } RemoveFromOrbit(this); goto LAB_0043c7c6; } uVar6 = uVar6 + 1; } while (uVar6 < GHIDRA_UINT(nearbyEnemies._size)); ehState = -NAN; (GHIDRA_CAST((&nearbyEnemies)))->EntityList_Query::~EntityList_Query(); } } else { this->_friction = 0.8; toTarget.y = *GHIDRA_CAST((GHIDRA_CAST(EVar9) + 0x340)) - (this->_pos).y; toTarget.x = *GHIDRA_CAST((GHIDRA_CAST(EVar9) + 0x33c)) - (this->_pos).x; local_1c8 = (EntityPtr)(toTarget.y * toTarget.y + toTarget.x * toTarget.x); if (10000.0 < (float)local_1c8) { bVar5 = 0; orbitDistance = (GHIDRA_CAST((&toTarget)))->Vector::Resized(&chaseVelocity,1.0); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddVelocity_divided(orbitDistance,bVar5); EVar9 = this->_target; } fVar12 = sqrtf((float)local_1c8); leadTargetDelta.y = (fVar12 * 0.02 * *GHIDRA_CAST((GHIDRA_CAST(EVar9) + 0x364)) + *GHIDRA_CAST((GHIDRA_CAST(EVar9) + 0x340))) - (this->_pos).y; leadTargetDelta.x = (fVar12 * 0.02 * *GHIDRA_CAST((GHIDRA_CAST(EVar9) + 0x360)) + *GHIDRA_CAST((GHIDRA_CAST(EVar9) + 0x33c))) - (this->_pos).x; orbitDistance = (GHIDRA_CAST((&leadTargetDelta)))->Vector::Normalized(&leadTargetDir); local_1d8 = orbitDistance->x; local_1d4 = GHIDRA_CAST(orbitDistance->y); if (this->_fireCooldown < 1) { isFiring = '\x01'; } else { this->_fireCooldown = this->_fireCooldown + -1; } bVar5 = (GHIDRA_CAST((GHIDRA_CAST(EVar9))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); if (bVar5 == 0) { if (this->_target != (EntityPtr)0x0) { local_1dc = &this->_target; std::multiset::erase(&local_1dc); } this->_target = (EntityPtr)0x0; } } break; case 0x1f8: isFiring = '\0'; if (0 < this->_fireCooldown) { this->_fireCooldown = this->_fireCooldown + -1; } local_1c8 = (EntityPtr)&this->_pos; aimDirection.x = g_vectorZero.x; aimDirection.y = g_vectorZero.y; EntityList::QueryRadius (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),nuggetTargets,GHIDRA_CAST(local_1c8),150.0,8 ); ehState = 4.2039e-45; local_1c0 = GHIDRA_CAST(0x0); if (GHIDRA_CAST(nuggetTargets[0]._size) != GHIDRA_CAST(0x0)) { pEVar8 = GHIDRA_CAST(0x0); do { pEVar15 = *GHIDRA_CAST((GHIDRA_INT(nuggetTargets[0]._data) + GHIDRA_INT(local_1c0) * 4)); bVar5 = (GHIDRA_CAST((pEVar15)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); if ((bVar5 != 0) && ((pEVar15->_flags & 0x20000010) == 0)) { enemyPos.y = (pEVar15->_pos).y; enemyPos.x = (pEVar15->_pos).x; bVar5 = (GHIDRA_CAST((g_game->_room)))->Room::CheckLine(GHIDRA_CAST(local_1c8),&enemyPos,3,900,0,0, GHIDRA_CAST(0x0)); if (bVar5 != 0) { pEVar8 = pEVar15; } } this = GHIDRA_CAST(local_1b4); local_1c0 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_1c0)) + 0x1)))); } while (local_1c0 < GHIDRA_UINT(nuggetTargets[0]._size)); local_1c0 = pEVar8; if (pEVar8 != GHIDRA_CAST(0x0)) { toEnemy.x = (pEVar8->_pos).x - (GHIDRA_CAST((local_1b4->_gridEntities + 0xc6)))->x; toEnemy.y = (pEVar8->_pos).y - (float)local_1b4->_gridEntities[199]; orbitDistance = (GHIDRA_CAST((&toEnemy)))->Vector::Normalized(&toEnemyDir); aimDirection.x = orbitDistance->x; aimDirection.y = orbitDistance->y; } } bVar5 = (GHIDRA_CAST((&aimDirection)))->Vector::operator_ne(&g_vectorZero); if ((bVar5 == 0) || ((float)GHIDRA_INT(local_1d0) <= 0.0)) { if ((-1 < (GHIDRA_CAST(this))->_gridPaths[0x179]) && (iVar10 = (GHIDRA_CAST(this))->_gridPaths[0x179] + -1, (GHIDRA_CAST(this))->_gridPaths[0x179] = iVar10, iVar10 < 0)) { PlayFloatAnim(this,3); } ehState = -NAN; (GHIDRA_CAST((nuggetTargets)))->EntityList_Query::~EntityList_Query(); } else { iVar10 = vector_to_direction(vec); if ((GHIDRA_CAST(this))->_gridPaths[0x178] < 1) { FireProjectile(this,&aimDirection,0); (GHIDRA_CAST(this))->_gridPaths[0x178] = GHIDRA_INT(local_1d0); (GHIDRA_CAST(this))->_gridPaths[0x179] = 0xc; PlayShootAnim(this,iVar10); (GHIDRA_CAST(this))->_gridPaths[0x179] = (GHIDRA_CAST(this))->_gridPaths[0x179] + -1; ehState = -NAN; (GHIDRA_CAST((nuggetTargets)))->EntityList_Query::~EntityList_Query(); } else if ((GHIDRA_CAST(this))->_gridPaths[0x179] < 9) { PlayFloatAnim(this,iVar10); (GHIDRA_CAST(this))->_gridPaths[0x179] = 8; ehState = -NAN; (GHIDRA_CAST((nuggetTargets)))->EntityList_Query::~EntityList_Query(); } else { PlayShootAnim(this,iVar10); (GHIDRA_CAST(this))->_gridPaths[0x179] = (GHIDRA_CAST(this))->_gridPaths[0x179] + -1; ehState = -NAN; (GHIDRA_CAST((nuggetTargets)))->EntityList_Query::~EntityList_Query(); } } break; case 0x204: local_1c4 = (float)this->_coins * 45.0 + 0.0; break; case 0x209: iVar10 = 3; local_1cc = 15.0; local_1c4 = -15.0; goto LAB_0043ce03; case 0x20f: ai_mr_me_wisp(this); } LAB_0043cdfe: iVar10 = 1; LAB_0043ce03: bVar5 = (GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities[0xfb])))->Entity_Player::HasCollectible(0xf7,0); if (bVar5 != 0) { (GHIDRA_CAST(this))->_gridEntities[0xd9] = (void *)((float)(GHIDRA_CAST(this))->_gridEntities[0xd9] + (float)(GHIDRA_CAST(this))->_gridEntities[0xd9]); } if (0 < (GHIDRA_CAST(this))->_gridPaths[399]) { (GHIDRA_CAST(this))->_gridPaths[399] = (GHIDRA_CAST(this))->_gridPaths[399] + -1; } if ((GHIDRA_CAST(this))->_gridPaths[0x187] != 0) { if ((GHIDRA_CAST(this))->_gridPaths[0x187] != 1) { ExceptionList = prevExceptionList; return; } if ((GHIDRA_CAST(this))->_gridEntities[2] != (void *)0xce) { ExceptionList = prevExceptionList; return; } if ((GHIDRA_CAST(this))->_gridEntities[3] != (void *)0x28a) { ExceptionList = prevExceptionList; return; } local_1dc = GHIDRA_CAST(cos(0.7853982)); fVar16 = sin(0.7853982); fVar12 = (GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 0xcf)))->x; rotatedVelocity.x = fVar12 * (float)local_1dc - (float)(GHIDRA_CAST(this))->_gridEntities[0xd0] * fVar16; rotatedVelocity.y = fVar12 * fVar16 + (float)(GHIDRA_CAST(this))->_gridEntities[0xd0] * (float)local_1dc; orbitDistance = Vector::ToCardinal(&cardinalVelocity,&rotatedVelocity); local_1cc = cos(-0.7853982); fVar13 = sin(-0.7853982); fVar12 = orbitDistance->y; fVar16 = orbitDistance->x; local_1c4 = local_1cc * orbitDistance->x - fVar13 * orbitDistance->y; (GHIDRA_CAST(this))->_gridEntities[0xd2] = (void *)0x3f7ae148; local_1cc = local_1cc * fVar12 + fVar13 * fVar16; if (0 < updateSteps) { do { (GHIDRA_CAST(this))->_gridPaths[0x178] = (GHIDRA_CAST(this))->_gridPaths[0x178] + 1; manager = g_manager; uVar6 = (GHIDRA_CAST(this))->_gridPaths[0x178] & 0x80000003; bVar11 = uVar6 == 0; if (GHIDRA_INT(uVar6) < 0) { bVar11 = (uVar6 - 1 | 0xfffffffc) == 0xffffffff; } if (bVar11) { local_1c0 = GHIDRA_CAST(0xb9); seed_fart_sound_override(GHIDRA_CAST(&local_1c0)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_1c0),1.0,2,0,1.0,0.0); uVar6 = Random(); fVar12 = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283064e-10 * 0.2 + 0.9; local_1c0 = GHIDRA_CAST((-local_1c4 * 5.0 * fVar12)); local_1b4 = GHIDRA_CAST((-local_1cc * 5.0 * fVar12)); uVar6 = Random(); local_1dc = (EntityPtr *) (((float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283064e-10 * 60.0 - 30.0) * 0.017453292); local_1c8 = (EntityPtr)cos((float)local_1dc); fVar12 = sin((float)local_1dc); tearPos.x = (GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 0xc6)))->x; tearPos.y = (float)(GHIDRA_CAST(this))->_gridEntities[199]; tearVelocity.x = (float)local_1c8 * (float)local_1c0 - fVar12 * (float)local_1b4; tearVelocity.y = (float)local_1c8 * (float)local_1b4 + fVar12 * (float)local_1c0; uVar6 = Random(); local_1dc = (EntityPtr *) ((float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283064e-10); uVar6 = Random(); tear = (Entity_Tear *) (GHIDRA_CAST((g_game)))->Game::Spawn(2,1,&tearPos,&tearVelocity,GHIDRA_CAST(this),0,uVar6); tear->_fallingAccel = tear->_fallingAccel - 0.05; uVar6 = Random(); fVar12 = (float)(&DAT_00b64e34)[uVar6 & 1]; if (fVar12 <= 0.01) { fVar12 = 0.01; } tear->_baseScale = fVar12; tear->_fScale = fVar12; (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::SetHeight(tear->_height - 10.0); tear->SetCollisionDamage((float)local_1dc + 3.0); } updateSteps = updateSteps + -1; } while (updateSteps != 0); updateSteps = 0; } anim = "SpecialDown"; if (0.0 < local_1cc) { anim = "SpecialUp"; } (GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 9)))))->ANM2::Play(GHIDRA_CAST(anim),0); pvVar1 = (GHIDRA_CAST(this))->_gridEntities[0xde]; (GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 0xcf)))->x = local_1c4 * 0.4 * (float)pvVar1 + (GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 0xcf)))->x; (GHIDRA_CAST(this))->_gridEntities[0xd0] = (void *)(local_1cc * 0.4 * (float)pvVar1 + (float)(GHIDRA_CAST(this))->_gridEntities[0xd0]); ExceptionList = prevExceptionList; return; } if (isFiring == '\0') { ExceptionList = prevExceptionList; return; } if (0 < (GHIDRA_CAST(this))->_gridPaths[0x178]) { (GHIDRA_CAST(this))->_gridPaths[0x178] = (GHIDRA_CAST(this))->_gridPaths[0x178] + -1; } local_1b4 = *GHIDRA_CAST((GHIDRA_INT((GHIDRA_CAST(this))->_gridEntities[0xfb]) + 0x162c)); if ((((local_1b4 == GHIDRA_CAST(0xffffffff)) && (local_1d8 == g_vectorZero.x)) && ((float)local_1d4 == g_vectorZero.y)) || ((float)GHIDRA_INT(local_1d0) <= 0.0)) { if ((GHIDRA_CAST(this))->_gridPaths[0x179] < 0) { ExceptionList = prevExceptionList; return; } iVar10 = (GHIDRA_CAST(this))->_gridPaths[0x179] + -1; (GHIDRA_CAST(this))->_gridPaths[0x179] = iVar10; if (iVar10 < 0) { PlayFloatAnim(this,3); ExceptionList = prevExceptionList; return; } ExceptionList = prevExceptionList; return; } Isaac::GetAxisAlignedUnitVectorFromDir(&shotDirection,GHIDRA_INT(local_1b4)); TryAimAtMarkedTarget(this,&shotDirection,GHIDRA_CAST(&local_1b4),GHIDRA_CAST(0x0)); if ((local_1d8 == g_vectorZero.x) && ((float)local_1d4 == g_vectorZero.y)) { local_1d4 = GHIDRA_CAST(shotDirection.y); local_1d8 = shotDirection.x; } local_1c4 = local_1c4 * 0.017453292; local_1dc = GHIDRA_CAST(cos(local_1c4)); fVar12 = sin(local_1c4); shotDirection.x = (float)local_1dc * local_1d8 - (float)local_1d4 * fVar12; shotDirection.y = local_1d8 * fVar12 + (float)local_1d4 * (float)local_1dc; if ((GHIDRA_CAST(this))->_gridPaths[0x178] < 1) { if (iVar10 != 0) { local_1cc = local_1cc * 0.017453292; local_1dc = GHIDRA_CAST(cos(local_1cc)); local_1c8 = (EntityPtr)sin(local_1cc); do { FireProjectile(this,&shotDirection,0); fVar12 = shotDirection.x * (float)local_1c8; shotDirection.x = shotDirection.x * (float)local_1dc - shotDirection.y * (float)local_1c8; shotDirection.y = shotDirection.y * (float)local_1dc + fVar12; iVar10 = iVar10 + -1; } while (iVar10 != 0); } (GHIDRA_CAST(this))->_gridPaths[0x178] = GHIDRA_INT(local_1d0); (GHIDRA_CAST(this))->_gridPaths[0x179] = 0xc; } else if ((GHIDRA_CAST(this))->_gridPaths[0x179] < 9) { PlayFloatAnim(this,GHIDRA_INT(local_1b4)); (GHIDRA_CAST(this))->_gridPaths[0x179] = 8; goto LAB_0043d0b0; } PlayShootAnim(this,GHIDRA_INT(local_1b4)); (GHIDRA_CAST(this))->_gridPaths[0x179] = (GHIDRA_CAST(this))->_gridPaths[0x179] + -1; LAB_0043d0b0: if ((GHIDRA_CAST(this))->_gridEntities[3] == (void *)0x31) { (GHIDRA_CAST(((GHIDRA_CAST(this))->_gridEntities + 0xc4)))->x = shotDirection.x; (GHIDRA_CAST(this))->_gridEntities[0xc5] = (void *)shotDirection.y; } ExceptionList = prevExceptionList; return; } // 0043db20 void Entity_Familiar::ai_mr_me_wisp() { Vector *pos; int iVar1; byte bVar2; uint uVar3; float fVar4; int iVar5; void *wispConfig; NetplayManager orbitLevel; EntityRef *killSource; Entity_Player *nearestPlayer; Entity *explosion; EntityPtr targetPickup; EntityPtr target; NetplayManager orbitLevelLow; void *pvVar6; float dx; EntityRef doorKillRef; EntityRef killRef; EntityList_EL pickups; float posY; NetplayManager local_1c; float local_18; Entity_Familiar *local_14; void *local_10; undefined1 *puStack_c; undefined4 local_8; GridEntity_Door *door; Game *game; local_8 = 0xffffffff; puStack_c = &LAB_00af22cd; local_10 = ExceptionList; uVar3 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; ExceptionList = &local_10; iVar5 = this->_keys; if (iVar5 == 0) { local_14 = this; bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0xf,this->_index); game = g_game; if (bVar2 == 0) { ExceptionList = local_10; return; } pvVar6 = g_game->_room; if ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 4)) + 0x44)) & 1) == 0) { ExceptionList = local_10; return; } iVar5 = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x764)); if (((((-1 < iVar5) && (iVar5 < 0x1c0)) && (iVar1 = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + iVar5 * 4 + 0x24)), iVar1 != 0)) && ((*GHIDRA_CAST((iVar1 + 4)) == 4 || (*GHIDRA_CAST((iVar1 + 4)) == 0x16)))) && (*GHIDRA_CAST((iVar1 + 0xc)) != 2)) { this->_keys = 1; this->_coins = iVar5; iVar1 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0xc)); (this->_targetPosition).x = (float)(iVar5 % iVar1) * 40.0 + 40.0; (this->_targetPosition).y = (float)(iVar5 / iVar1) * 40.0 + 120.0; } if (this->_keys == 0) { EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)),&pickups,5,0x3c,-1,0,0); local_8 = 0; local_18 = 0.0; if (pickups._size != 0) { uVar3 = pickups._size; pvVar6 = pickups._data; do { target = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + GHIDRA_INT(local_18) * 4)); if (target != (EntityPtr)0x0) { if (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x28)) == 5) { if (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x30)) != 0) { if (this->_target != (EntityPtr)0x0) { local_1c = (NetplayManager)&this->_target; std::multiset::erase(&local_1c); } this->_target = target; std::multiset::insert(&this->_target); this->_keys = 2; fVar4 = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x340)); (this->_targetPosition).x = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x33c)); (this->_targetPosition).y = fVar4; uVar3 = pickups._size; pvVar6 = pickups._data; } } } local_18 = (float)(GHIDRA_INT(local_18) + 1); } while (GHIDRA_UINT(local_18) < uVar3); } local_8 = 0xffffffff; if ((*GHIDRA_CAST((GHIDRA_CAST(&(pickups)) + 0x0))) == '\0') { local_8 = 1; tracked_alloc(1,pickups._data,0); local_8 = 0xffffffff; } } iVar5 = this->_keys; if (iVar5 == 0) { fVar4 = (float)(GHIDRA_INT(g_game->_room) + 0x724); uVar3 = 0; local_18 = fVar4; do { door = *GHIDRA_CAST((GHIDRA_CAST(fVar4) + uVar3 * 4)); if (door != GHIDRA_CAST(0x0)) { if (((door->_doorFlags & 0x50U) == 0) && (((door->_doorFlags & 0x20U) == 0 || ((door->_desc)._variant != 4)))) { iVar5 = (GHIDRA_CAST((door)))->GridEntity_Door::get_secret_exit_kind(); game = g_game; fVar4 = local_18; if ((iVar5 != 4) && ((iVar5 = *GHIDRA_CAST((GHIDRA_CAST(local_18) + uVar3 * 4)), *GHIDRA_CAST((iVar5 + 0xc)) != 2 && ((iVar5 = *GHIDRA_CAST((iVar5 + 0x160)), iVar5 == 7 || (iVar5 == 8)))))) { this->_keys = 3; this->_coins = uVar3; iVar5 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_18) + uVar3 * 4)) + 0x24)); iVar1 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0xc)); (this->_targetPosition).x = (float)(iVar5 % iVar1) * 40.0 + 40.0; (this->_targetPosition).y = (float)(iVar5 / iVar1) * 40.0 + 120.0; } } } uVar3 = uVar3 + 1; } while (uVar3 < 8); iVar5 = this->_keys; if (iVar5 == 0) { fVar4 = (float)(GHIDRA_INT(g_game->_room) + 0x724); uVar3 = 0; local_18 = fVar4; do { door = *GHIDRA_CAST((GHIDRA_CAST(fVar4) + uVar3 * 4)); if (door != GHIDRA_CAST(0x0)) { if ((door->_doorFlags & 0x50U) == 0) { if ((door->_doorFlags & 0x20U) != 0) { if ((door->_desc)._variant == 4) goto LAB_0043df18; } iVar5 = (GHIDRA_CAST((door)))->GridEntity_Door::get_secret_exit_kind(); game = g_game; fVar4 = local_18; if (iVar5 != 4) { iVar5 = *GHIDRA_CAST((GHIDRA_CAST(local_18) + uVar3 * 4)); if (*GHIDRA_CAST((iVar5 + 0xc)) != 2) { if ((*GHIDRA_CAST((iVar5 + 0x160)) != 7) && (*GHIDRA_CAST((iVar5 + 0x160)) != 8)) { this = local_14; if (*GHIDRA_CAST((iVar5 + 0x394)) == g_game->_lastRoomIdx) { local_1c = g_manager->_netplayManager; if (((local_1c != *GHIDRA_CAST((g_manager + 1))) && (1 < GHIDRA_UINT((GHIDRA_INT(*GHIDRA_CAST((g_manager + 1))) - GHIDRA_INT(local_1c) >> 2))) ) && (*GHIDRA_CAST((iVar5 + 0x154)) < 0x1f)) goto LAB_0043df18; } local_14->_keys = 4; local_14->_coins = uVar3; iVar5 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_18) + uVar3 * 4)) + 0x24)); iVar1 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0xc)); (local_14->_targetPosition).x = (float)(iVar5 % iVar1) * 40.0 + 40.0; (local_14->_targetPosition).y = (float)(iVar5 / iVar1) * 40.0 + 120.0; } } } } } LAB_0043df18: uVar3 = uVar3 + 1; } while (uVar3 < 8); iVar5 = this->_keys; } } iVar1 = this->_orbitLayer; if (iVar5 != 0) { if (iVar1 < 0) { ExceptionList = local_10; return; } RecalculateOrbitOffset(this,iVar1,0); this->_orbitLayer = -1; ExceptionList = local_10; return; } if (-1 < iVar1) { this->_friction = 1.0; ExceptionList = local_10; return; } if (this->_variant == 0xed) { iVar5 = this->_wispCollectibleType; } else if (this->_variant == 0xce) { iVar5 = this->_subtype; } else { iVar5 = 0x248; } wispConfig = ItemConfig::get_wisp_config(iVar5); this->_friction = 0.7; pvVar6 = this->_player; local_1c = (NetplayManager)(*GHIDRA_CAST((GHIDRA_CAST(wispConfig) + 0x18c)) + 7); orbitLevelLow = local_1c; if (GHIDRA_INT(local_1c) < 1) { orbitLevelLow = (NetplayManager)0x0; } orbitLevel = (NetplayManager)0xa; if (GHIDRA_INT(orbitLevelLow) < 10) { orbitLevel = orbitLevelLow; } posY = (local_14->_pos).y; local_18 = (local_14->_pos).x; fVar4 = posY - *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x340)); dx = local_18 - *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x33c)); fVar4 = sqrtf(fVar4 * fVar4 + dx * dx); if ((float)(&DAT_00c34130)[GHIDRA_INT(orbitLevel) * 5] <= fVar4) { local_1c = (NetplayManager)(*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x340)) - posY); local_18 = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x33c)) - local_18; fVar4 = sqrtf((float)local_1c * (float)local_1c + local_18 * local_18); if (0.0 < fVar4) { local_1c = (NetplayManager)((2.0 / fVar4) * (float)local_1c); local_18 = (2.0 / fVar4) * local_18; } fVar4 = local_14->_speedMultiplier; (local_14->_velocity).y = (fVar4 * (float)local_1c) / 0.7 + (local_14->_velocity).y; (local_14->_velocity).x = (fVar4 * local_18) / 0.7 + (local_14->_velocity).x; ExceptionList = local_10; return; } AddToOrbit(local_14,GHIDRA_INT(local_1c)); ExceptionList = local_10; return; } target = this->_target; pos = &this->_pos; this->_friction = 0.7; local_18 = (this->_targetPosition).x; fVar4 = (this->_targetPosition).y; if (target != (EntityPtr)0x0) { local_18 = (GHIDRA_CAST((GHIDRA_INT(target) + 0x33c)))->x; fVar4 = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x340)); } local_14 = GHIDRA_CAST((fVar4 - (this->_pos).y)); local_18 = local_18 - pos->x; fVar4 = local_18 * local_18 + (float)local_14 * (float)local_14; if (fVar4 <= 225.0) { if (iVar5 == 2) { if (((target != (EntityPtr)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x28)) == 5)) && ((*GHIDRA_CAST((GHIDRA_CAST(target) + 0x30)) != 0 && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(target))))->Entity_Pickup::TryOpenChest(GHIDRA_CAST(0x0)), bVar2 != 0)))) { LAB_0043e26b: killSource = &killRef; LAB_0043e26e: killSource = (GHIDRA_CAST((killSource)))->EntityRef::EntityRef(); this->Kill(killSource,uVar3); } } else if (iVar5 == 1) { if (((GHIDRA_UINT(this->_coins) < 0x1c0) && (iVar5 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + this->_coins * 4 + 0x24)), iVar5 != 0)) && (*GHIDRA_CAST((iVar5 + 0xc)) != 2)) { nearestPlayer = (GHIDRA_CAST((g_game)))->Game::GetNearestPlayer(pos); fVar4 = (this->_pos).y - (nearestPlayer->_pos).y; dx = pos->x - (nearestPlayer->_pos).x; fVar4 = sqrtf(fVar4 * fVar4 + dx * dx); if (100.0 < fVar4) { (GHIDRA_CAST((g_game)))->Game::BombDamage(pos,40.0,80.0,1,GHIDRA_CAST(this),g_tearFlagsNone,4,0); uVar3 = Random(); explosion = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,1,pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar3); explosion->Update(); killSource = (GHIDRA_CAST((&killRef)))->EntityRef::EntityRef(); this->Kill(killSource); } goto LAB_0043e200; } } else if (iVar5 == 3) { door = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + this->_coins * 4 + 0x724)); if ((door->_desc)._state != 2) { (GHIDRA_CAST((door)))->GridEntity_Door::TryBlowOpen(0,GHIDRA_CAST(0x0)); goto LAB_0043e26b; } } else { if (iVar5 != 4) goto LAB_0043e200; door = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + this->_coins * 4 + 0x724)); if ((door->_desc)._state != 2) { bVar2 = (GHIDRA_CAST((door)))->GridEntity_Door::TryUnlock(this->_player,1); if (bVar2 == 0) { (GHIDRA_CAST((door)))->GridEntity_Door::Open(); } killSource = &doorKillRef; goto LAB_0043e26e; } } this->_keys = 0; iVar5 = 0; LAB_0043e43e: target = this->_target; if (target != (EntityPtr)0x0) { LAB_0043e448: if ((*GHIDRA_CAST((GHIDRA_CAST(target) + 0x172)) == '\0') || (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x173)) != '\0')) goto LAB_0043e460; } } else { fVar4 = sqrtf(fVar4); if (0.0 < fVar4) { local_18 = local_18 * (2.0 / fVar4); local_14 = GHIDRA_CAST(((float)local_14 * (2.0 / fVar4))); } fVar4 = this->_speedMultiplier; (this->_velocity).y = (fVar4 * (float)local_14) / 0.7 + (this->_velocity).y; (this->_velocity).x = (fVar4 * local_18) / 0.7 + (this->_velocity).x; LAB_0043e200: iVar5 = this->_keys; if (iVar5 != 1) { if (iVar5 == 2) { target = this->_target; if (target != (EntityPtr)0x0) { targetPickup = (EntityPtr)0x0; if (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x28)) == 5) { targetPickup = target; } if (*GHIDRA_CAST((GHIDRA_CAST(targetPickup) + 0x30)) == 1) goto LAB_0043e448; } } else if (((iVar5 != 4) && (iVar5 != 3)) || (*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + this->_coins * 4 + 0x724)) + 0xc)) != 2)) goto LAB_0043e43e; LAB_0043e460: this->_keys = 0; goto LAB_0043e46a; } if (((0x1bf < GHIDRA_UINT(this->_coins)) || (iVar1 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + this->_coins * 4 + 0x24)), iVar1 == 0)) || (*GHIDRA_CAST((iVar1 + 0xc)) == 2)) { this->_keys = 0; iVar5 = 0; } } if (iVar5 != 0) { ExceptionList = local_10; return; } LAB_0043e46a: (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; ExceptionList = local_10; return; } // 0043e4a0 void Entity_Familiar::ai_mega_blast_wisp() { EntityPtr EVar1; byte bVar2; Entity_Laser *brimstone; int iVar3; int direction; float fVar4; undefined4 laserDepthOffset; float awayDirY; float awayDirX; Vector local_18; Vector local_10; void *player; player = this->_player; direction = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x162c)); fVar4 = sqrtf(*GHIDRA_CAST((GHIDRA_CAST(player) + 0x1630)) * *GHIDRA_CAST((GHIDRA_CAST(player) + 0x1630)) + *GHIDRA_CAST((GHIDRA_CAST(player) + 0x1634)) * *GHIDRA_CAST((GHIDRA_CAST(player) + 0x1634))); if ((fVar4 < 0.5) && (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1638)) == '\0')) { direction = -1; } Isaac::GetAxisAlignedUnitVectorFromDir(&local_10,this->_lastDirection); bVar2 = TryAimAtMarkedTarget(this,&local_10,&this->_lastDirection,GHIDRA_CAST(0x0)); if (bVar2 != 0) { if (this->_fireCooldown < 0) { direction = -1; } EVar1 = this->_linkedEntity; if ((((EVar1 != (EntityPtr)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x28)) == 7)) && (iVar3 = *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x30)), iVar3 != 1)) && ((iVar3 != 2 && (iVar3 != 3)))) { fVar4 = atan2f(local_10.y,local_10.x); (GHIDRA_CAST((GHIDRA_CAST(this->_linkedEntity))))->Entity_Laser::RotateToAngle(fVar4 * 57.295776,8.0); } } player = this->_player; if (((*GHIDRA_CAST((GHIDRA_CAST(player) + 0x1398)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(player) + 0x139a)) == '\0')) && ((*GHIDRA_CAST(&g_game->_stageTransition) == 0 && ((*GHIDRA_CAST((GHIDRA_CAST(player) + 0x410)) != '\0' && (*GHIDRA_CAST((GHIDRA_CAST(player) + 0x414)) < 1)))))) { if (direction == -1) { if ((this->_fireCooldown < 0) && (((local_10.x != g_vectorZero.x || (local_10.y != g_vectorZero.y)) && (this->_linkedEntity == (EntityPtr)0x0)))) { brimstone = FireBrimstone(this,&local_10,1); _DAT_00c5c554 = local_10.x * 7.0; DAT_00c5c558 = local_10.y * 5.0 - 18.0; iVar3 = *GHIDRA_CAST(brimstone); (brimstone->_posOffset).x = _DAT_00c5c554; (brimstone->_posOffset).y = DAT_00c5c558; (**(code **)(iVar3 + 0xc))(); this->_headFrameDelay = 0x1e; iVar3 = vector_to_direction(&local_10); PlayShootAnim(this,iVar3); } iVar3 = this->_headFrameDelay; this->_fireCooldown = 0x1e; } else { iVar3 = this->_headFrameDelay; if (iVar3 < 9) { this->_fireCooldown = this->_fireCooldown + -1; } this->_lastDirection = direction; } if (iVar3 < 9) { if (direction == -1) { PlayFloatAnim(this,*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1628))); } else { PlayChargeAnim(this,this->_lastDirection); } this->_headFrameDelay = 8; } else { this->_headFrameDelay = iVar3 + -1; } } awayDirY = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); awayDirX = (this->_pos).x - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); local_18.x = awayDirX; local_18.y = awayDirY; fVar4 = sqrtf(awayDirY * awayDirY + awayDirX * awayDirX); if (0.0 < fVar4) { awayDirX = awayDirX * (1.0 / fVar4); awayDirY = awayDirY * (1.0 / fVar4); local_18.x = awayDirX; local_18.y = awayDirY; } if ((0 < *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x18f4))) && (this->_linkedEntity == (EntityPtr)0x0)) { local_10.x = (float)FireBrimstone(this,&local_18,0); awayDirX = local_18.x; _DAT_00c5c554 = local_18.x * 7.0; awayDirY = local_18.y; DAT_00c5c558 = local_18.y * 5.0 - 18.0; (GHIDRA_CAST((GHIDRA_INT(local_10.x) + 0x34c)))->x = _DAT_00c5c554; *GHIDRA_CAST((GHIDRA_CAST(local_10.x) + 0x350)) = DAT_00c5c558; *GHIDRA_CAST((GHIDRA_CAST(local_10.x) + 0x458)) = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x18f4)); (**(code **)(*GHIDRA_CAST(local_10.x) + 0xc))(); if (this->_linkedEntity != (EntityPtr)0x0) { local_18.x = (float)&this->_linkedEntity; std::multiset::erase(&local_18); } this->_linkedEntity = (EntityPtr)local_10.x; std::multiset::insert(&this->_linkedEntity); this->_headFrameDelay = 0x1e; PlayShootAnim(this,direction); } EVar1 = this->_linkedEntity; if (EVar1 != (EntityPtr)0x0) { fVar4 = atan2f(awayDirY,awayDirX); *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x4c0)) = 1; *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x4c4)) = 0; local_18.x = ABS(fVar4 * 57.295776); fVar4 = angle_difference(*GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x41c)),fVar4 * 57.295776); *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x4c8)) = fVar4; if (fVar4 < 0.0) { local_18.x = -local_18.x; } *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x4cc)) = local_18.x; if (-0.5 <= awayDirY) { laserDepthOffset = 0x453b8000; } else { laserDepthOffset = 0xc1200000; } *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x358)) = laserDepthOffset; _DAT_00c5c554 = awayDirX * 7.0; DAT_00c5c558 = awayDirY * 5.0 - 18.0; *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x34c)) = _DAT_00c5c554; *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x350)) = DAT_00c5c558; } return; } // 0043eb10 int Entity_Familiar::GetRandomWisp(RNG *rng) { code *pcVar1; RNG *pRVar2; void *pvVar3; int wispItemId; uint nextSeed; int *wispItemsEnd; uint uVar4; int *wispItemsCapacityEnd; int *taggedItemIt; int taggedItemsEnd; void *wispItems; int *local_24; int *local_20; RNG *local_1c; void *wispItemsBegin; uint itemsLeft; void *local_10; undefined1 *puStack_c; undefined4 local_8; local_8 = 0xffffffff; puStack_c = &LAB_00af2305; local_10 = ExceptionList; ExceptionList = &local_10; local_1c = rng; pvVar3 = (GHIDRA_CAST((&g_manager->_itemConfig)))->ItemConfig::GetTaggedItems(0x4000000); std::vector::copy_constructor(pvVar3); wispItemsEnd = GHIDRA_CAST(0x0); wispItemsBegin = (void *)0x0; wispItemsCapacityEnd = GHIDRA_CAST(0x0); wispItems = (void *)0x0; local_24 = GHIDRA_CAST(0x0); local_20 = GHIDRA_CAST(0x0); local_8 = 1; itemsLeft = taggedItemsEnd - GHIDRA_INT(taggedItemIt) >> 2; if (itemsLeft != 0) { if (0x3fffffff < itemsLeft) { /* WARNING: Subroutine does not return */ std::_Xlen(); } std::vector::_Reallocate(itemsLeft); wispItemsEnd = local_24; wispItemsCapacityEnd = local_20; do { if (0 < *GHIDRA_CAST((*GHIDRA_CAST((*taggedItemIt + 0xcc)) + 400))) { if (wispItemsEnd == wispItemsCapacityEnd) { std::vector::_Emplace_reallocate(wispItemsEnd,taggedItemIt); wispItemsEnd = local_24; wispItemsCapacityEnd = local_20; } else { *wispItemsEnd = *taggedItemIt; local_24 = wispItemsEnd + 1; wispItemsEnd = local_24; } } taggedItemIt = taggedItemIt + 1; itemsLeft = itemsLeft - 1; } while (itemsLeft != 0); wispItemsBegin = wispItems; itemsLeft = 0; } pRVar2 = local_1c; uVar4 = GHIDRA_INT(wispItemsEnd) - GHIDRA_INT(wispItemsBegin) >> 2; wispItems = wispItemsBegin; if (uVar4 == 0) { wispItemId = 0x248; } else { nextSeed = local_1c->_seed; if (nextSeed == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); nextSeed = pRVar2->_seed; if (nextSeed == 0) { pcVar1 = (code *)swi(3); wispItemId = (*pcVar1)(); return wispItemId; } } nextSeed = nextSeed >> ((byte)pRVar2->_shift1 & 0x1f) ^ nextSeed; nextSeed = nextSeed << ((byte)pRVar2->_shift2 & 0x1f) ^ nextSeed; nextSeed = nextSeed >> ((byte)pRVar2->_shift3 & 0x1f) ^ nextSeed; pRVar2->_seed = nextSeed; wispItemId = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(wispItemsBegin) + (nextSeed % uVar4) * 4)) + 4)); } if (wispItemsBegin != (void *)0x0) { uVar4 = GHIDRA_INT(wispItemsCapacityEnd) - GHIDRA_INT(wispItemsBegin) & 0xfffffffc; pvVar3 = wispItemsBegin; if (0xfff < uVar4) { pvVar3 = *(void **)(GHIDRA_CAST(wispItemsBegin) + -4); uVar4 = uVar4 + 0x23; if (0x1f < GHIDRA_UINT((GHIDRA_INT(wispItemsBegin) + (-4 - GHIDRA_INT(pvVar3))))) { /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(pvVar3,uVar4); } FID_conflict__Tidy(&taggedItemIt); ExceptionList = local_10; return wispItemId; } // 00505cf0 int Entity_Familiar::Coins() { return this->_coins; } // 005ae490 void Entity_Familiar::ai_buddy_inbox() { byte bVar1; char cVar2; int backAnimOffset; uint uVar3; byte *pbVar4; byte unused; byte *pbVar5; byte *pbVar6; char *pcVar7; bool isLess; float angle; undefined8 uVar8; Vector VStack_c0; float savedFrame; ProjectileParams projParams; float securityCookie; int headState; EntityPtr parent; securityCookie = (float)(__security_cookie ^ GHIDRA_UINT(&(&projParams)[1].CircleAngle)); switch(this->_subtype) { case 0: backAnimOffset = 0; headState = *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_pathfinder))) + 0x5c4)))); if ((this->_velocity).y < 0.0) { backAnimOffset = 4; } if (headState != 1) { if (headState == 2) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(*GHIDRA_CAST((GHIDRA_INT(&PTR_s_HeadFrontWiggleOpen_00b62994) + backAnimOffset)),0); return; } (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(*GHIDRA_CAST((GHIDRA_INT(&PTR_s_HeadFrontWiggleClosed_00b6299c) + backAnimOffset)),0); return; } VStack_c0.y = *GHIDRA_CAST((GHIDRA_INT(&PTR_s_HeadFrontWiggleTransition_00b6298c) + backAnimOffset)); uVar8 = _string_holder_c_str(); pbVar5 = GHIDRA_CAST(uVar8); do { pbVar6 = GHIDRA_CAST(((ulonglong)uVar8 >> 0x20)); pbVar4 = GHIDRA_CAST(uVar8); bVar1 = *pbVar4; isLess = bVar1 < *pbVar6; if (bVar1 != *pbVar6) { LAB_005ae518: uVar3 = -GHIDRA_UINT(isLess) | 1; goto LAB_005ae51d; } if (bVar1 == 0) break; bVar1 = pbVar4[1]; isLess = bVar1 < pbVar6[1]; if (bVar1 != pbVar6[1]) goto LAB_005ae518; uVar8 = CONCAT44(pbVar6 + 2,pbVar4 + 2); } while (bVar1 != 0); uVar3 = 0; LAB_005ae51d: if (uVar3 == 0) { LAB_005ae551: pcVar7 = "HeadBackWiggleTransition"; do { bVar1 = *pbVar5; isLess = bVar1 < (byte)*pcVar7; if (bVar1 != *pcVar7) { LAB_005ae576: uVar3 = -GHIDRA_UINT(isLess) | 1; goto LAB_005ae57b; } if (bVar1 == 0) break; bVar1 = pbVar5[1]; isLess = bVar1 < (byte)pcVar7[1]; if (bVar1 != pcVar7[1]) goto LAB_005ae576; pbVar5 = pbVar5 + 2; pcVar7 = pcVar7 + 2; } while (bVar1 != 0); uVar3 = 0; LAB_005ae57b: if (uVar3 == 0) goto LAB_005ae57f; (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST(VStack_c0.y),0); } else { pcVar7 = "HeadFrontWiggleTransition"; pbVar4 = pbVar5; do { bVar1 = *pbVar4; isLess = bVar1 < (byte)*pcVar7; if (bVar1 != *pcVar7) { LAB_005ae548: uVar3 = -GHIDRA_UINT(isLess) | 1; goto LAB_005ae54d; } if (bVar1 == 0) break; bVar1 = pbVar4[1]; isLess = bVar1 < (byte)pcVar7[1]; if (bVar1 != pcVar7[1]) goto LAB_005ae548; pbVar4 = pbVar4 + 2; pcVar7 = pcVar7 + 2; } while (bVar1 != 0); uVar3 = 0; LAB_005ae54d: if (uVar3 != 0) goto LAB_005ae551; LAB_005ae57f: if ((this->_sprite)._animState._animData == (void *)0x0) { savedFrame = (float)&DAT_bf800000; } else { savedFrame = (this->_sprite)._animState._animFrame; } (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST(VStack_c0.y),0); if ((this->_sprite)._animState._animData != (void *)0x0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::SetFrameFloat(savedFrame); } } bVar1 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered("Shoot"); if (bVar1 != 0) { (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_NPC::PlaySound(0xe2,1.0,2,0,1.0); (GHIDRA_CAST((&projParams)))->ProjectileParams::ProjectileParams(); cVar2 = FUN_005ae1d0(); if (cVar2 == '\0') { uVar3 = (GHIDRA_CAST((g_game)))->Game::GetStageID(unused); projParams.Variant = (uVar3 != 0x1c) + 3; } VStack_c0.x = 10.0; VStack_c0.y = 0.0; Entity_NPC::FireProjectiles(GHIDRA_CAST(this),&this->_pos,&VStack_c0,6,&projParams); } if (((this->_sprite)._animState._animData == (void *)0x0) || ((this->_sprite)._animState._isPlaying == 0)) { *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((this->_pathfinder))) + 0x5c4)))) = 2; return; } break; case 1: (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("Body1Wiggle"),0); return; case 2: (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("Body2Wiggle"),0); return; case 3: (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("Body3Wiggle"),0); return; case 4: (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("Body4Wiggle"),0); return; case 5: (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("Body5Wiggle"),0); return; case 6: (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("Body6Wiggle"),0); parent = this->_parent; angle = atan2f(((*GHIDRA_CAST((GHIDRA_CAST(parent) + 0x340)) + *GHIDRA_CAST((GHIDRA_CAST(parent) + 0x350))) - (this->_pos).y) - (this->_posOffset).y, ((*GHIDRA_CAST((GHIDRA_CAST(parent) + 0x33c)) + *GHIDRA_CAST((GHIDRA_CAST(parent) + 0x34c))) - (this->_pos).x) - (this->_posOffset).x); angle = normalize_angle_degrees(angle * 57.295776 - (this->_sprite)._rotation); angle = normalize_angle_degrees(angle * 0.3 + (this->_sprite)._rotation); (this->_sprite)._rotation = angle; } return; } // 0060d0e0 int Entity_Familiar::Hearts() { return this->_hearts; } // 0060d100 int Entity_Familiar::Keys() { return this->_keys; } // 0060d180 KColor * Entity_Familiar::GetPlayerSlot(KColor *outColor, Entity_Player *player) { int playerColor; std_string *psVar1; playerColor = 0; psVar1 = &(this->_sprite)._animDefaultName; do { if (*GHIDRA_CAST(psVar1->_buf) == player->_controllerIndex) goto LAB_0060d1a3; playerColor = playerColor + 1; psVar1 = GHIDRA_CAST((psVar1->_buf + 4)); } while (playerColor < 4); playerColor = 5; LAB_0060d1a3: PlayerManager::GetPlayerColorValue(outColor,playerColor); return outColor; } // 0060d200 void Entity_Familiar::Constructor() { undefined4 *slotCursor; void *setHead; int remaining; void *local_10; undefined1 *puStack_c; undefined4 local_8; local_8 = 0xffffffff; puStack_c = &LAB_00af6753; local_10 = ExceptionList; ExceptionList = &local_10; (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::constructor(); local_8 = 0; *GHIDRA_CAST(this) = IsaacRepentancePlus::Entity_Familiar::vftable; remaining = 0x3c; slotCursor = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x418)))); do { slotCursor[1] = 0; *slotCursor = 0; remaining = remaining + -1; slotCursor = slotCursor + 2; } while (remaining != 0); (GHIDRA_CAST((GHIDRA_CAST(&this->_pathfinder))))->PathFinder::Init(GHIDRA_CAST(this)); (this->_orbitDistance).y = 0.0; (this->_orbitDistance).x = 0.0; this->_isSubtype55555 = 0; this->_isHourglassRewound = 0; (this->_formationOffset).y = 0.0; (this->_formationOffset).x = 0.0; (this->_formationTargetOffset).y = 0.0; (this->_formationTargetOffset).x = 0.0; (this->_hitList)._begin = (void *)0x0; (this->_hitList)._end = (void *)0x0; (this->_hitList)._capacity = (void *)0x0; (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 2; (GHIDRA_CAST((&this->_chargeBarSprite)))->ANM2::constructor(); this->_extraData = (void *)0x0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xee4)))) = 0; this->_sirenHelper = (EntityPtr)0x0; local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),5); this->_sirenCharmFrames = 0; (this->_dirtColor)._tint[0] = 1.0; (this->_dirtColor)._tint[1] = 1.0; (this->_dirtColor)._tint[2] = 1.0; (this->_dirtColor)._tint[3] = 1.0; (this->_dirtColor)._colorize[0] = 0.0; (this->_dirtColor)._colorize[1] = 0.0; (this->_dirtColor)._colorize[2] = 0.0; (this->_dirtColor)._colorize[3] = 0.0; (this->_dirtColor)._offset[0] = 0.0; (this->_dirtColor)._offset[1] = 0.0; (this->_dirtColor)._offset[2] = 0.0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf38)))) = 10; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf3c)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf40)))) = 0; setHead = operator_new(0x18); *(void **)setHead = setHead; *(void **)(GHIDRA_CAST(setHead) + 4) = setHead; *(void **)(GHIDRA_CAST(setHead) + 8) = setHead; *GHIDRA_CAST((GHIDRA_CAST(setHead) + 0xc)) = 0x101; *(void **)&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf3c))) = setHead; ExceptionList = local_10; return; } // 0060d8c0 byte Entity_Familiar::CanBeDamagedByEnemy() { int variant; variant = this->_variant; if ((((variant == 0x3e) || (variant == 0x43)) || (variant == 0xd3)) || (variant == 100)) { return 1; } return 0; } // 0060d8e0 byte Entity_Familiar::CanBlockProjectiles() { int iVar1; byte isHasTag; void *pvVar2; bool isBlocker; BitSet128 itemTags; iVar1 = this->_variant; if (iVar1 == 0x23) { return 1; } if (iVar1 == 0x2c) { return 1; } if (iVar1 == 0x2d) { return 1; } if (iVar1 == 0x21) { return 1; } if (iVar1 == 0x41) { return 1; } if (iVar1 == 0x20) { return 1; } if (iVar1 == 0x2a) { return 1; } if (iVar1 == 0x11) { return 1; } if (iVar1 == 0x33) { return 1; } if (iVar1 == 0x4b) { return 1; } if (iVar1 == 0x32) { isBlocker = this->_subtype == 0; } else { if (iVar1 == 0x44) { return 1; } if (iVar1 == 0x43) { return 1; } if (iVar1 == 0x53) { return 1; } if (iVar1 == 0x5f) { return 1; } if (iVar1 == 0x45) { return 1; } if (iVar1 == 0x46) { return 1; } if (iVar1 == 0x67) { return 1; } if (iVar1 == 0x68) { LAB_0060d954: if (this->_fireCooldown < 0) { return 1; } return 0; } if (iVar1 == 0x6b) { isBlocker = this->_subtype == 1; } else { if (iVar1 == 0x79) { return 1; } if (iVar1 == 0x80) { return 1; } if (iVar1 == 0x82) { return 1; } if (iVar1 == 900) { return 1; } if (iVar1 == 0x74) { return 1; } if (iVar1 == 0x75) { return 1; } if (iVar1 == 0xcf) { return 1; } if (iVar1 == 0xe2) { return 1; } if (iVar1 == 0xe4) { return 1; } if (iVar1 == 0xee) { return 1; } if (iVar1 == 0xe0) { return 1; } if (iVar1 == 0xc9) { return 1; } if (iVar1 == 0xd8) { return 1; } if (iVar1 == 0xd9) { return 1; } if (iVar1 == 0xce) { if (this->_subtype == 0x2be) { return 0; } return 1; } if (iVar1 == 0xed) { return 1; } if (iVar1 == 0xe5) { return 1; } if (iVar1 == 0xcc) { return 1; } if (iVar1 == 0xd3) { return 1; } if (iVar1 == 0xe7) { pvVar2 = get_item_config_entry(this); (*GHIDRA_CAST((GHIDRA_CAST(&(itemTags._l)) + 0x4))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0xc)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShielded._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(itemTags._l)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 8)) & GHIDRA_UINT(g_tearFlagShielded._l); (*GHIDRA_CAST((GHIDRA_CAST(&(itemTags._h)) + 0x0))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x10)) & GHIDRA_UINT(g_tearFlagShielded._h); (*GHIDRA_CAST((GHIDRA_CAST(&(itemTags._h)) + 0x4))) = *GHIDRA_CAST((GHIDRA_CAST(pvVar2) + 0x14)) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShielded._h)) + 0x4))); isHasTag = (GHIDRA_CAST((&itemTags)))->BitSet128::IsNonZero(); if (isHasTag == 0) { return 0; } return 1; } if (iVar1 == 0xe8) goto LAB_0060d954; if (iVar1 == 0xea) { return 1; } if (iVar1 == 0xef) { return 1; } if (iVar1 == 100) { return 1; } isBlocker = iVar1 == 0xf3; } } if (isBlocker) { return 1; } return 0; } // 0060dab0 undefined1 Entity_Familiar::CanShutDoors() { if (((this->_variant == 0xf2) && (this->_coins != 0)) && (this->_visible != 0)) { return 1; } return 0; } // 0060dc40 float Entity_Familiar::apply_tear_modifiers() { byte isOwned; int trinketMultiplier; int iVar1; Entity_Player *player; bool bVar2; bool bVar3; float multiplier; uint familiarFlags; void *ownerPlayer; void *twin; familiarFlags = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0xd8)); iVar1 = this->_variant; isOwned = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0); if ((((isOwned == 0) || (this->_variant == 0x2b)) || (this->_variant == 0x49)) && (((isOwned = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf8,0), isOwned == 0 && (isOwned = TemporaryEffects::HasCollectibleEffect (GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1508)),0xf8), isOwned == 0)) || (((familiarFlags & 1) == 0 && (((familiarFlags & 2) == 0 && (iVar1 != 0xe7)))))))) { multiplier = 1.0; } else { multiplier = 2.0; } player = this->_player; if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ef8)))) != 0x59)) { iVar1 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x59); bVar3 = false; bVar2 = iVar1 == 0; LAB_0060dd32: if (bVar2 || bVar3 != iVar1 < 0) goto LAB_0060dd6f; player = this->_player; } else if ((*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ef0))) == '\0') { trinketMultiplier = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x59); bVar3 = SBORROW4(trinketMultiplier,1); iVar1 = trinketMultiplier + -1; bVar2 = trinketMultiplier == 1; goto LAB_0060dd32; } iVar1 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x59); multiplier = (float)iVar1 * 0.25 + multiplier; LAB_0060dd6f: ownerPlayer = this->_player; iVar1 = *GHIDRA_CAST((GHIDRA_CAST(ownerPlayer) + 0x13c0)); if (iVar1 == 0x24) { multiplier = multiplier * 0.75; } if (((*GHIDRA_CAST((GHIDRA_CAST(ownerPlayer) + 0x172)) != '\0') && ((((iVar1 == 0x1d || (iVar1 == 0x26)) && (twin = *(void **)(GHIDRA_CAST(ownerPlayer) + 0x1e68), twin != (void *)0x0)) && ((*GHIDRA_CAST((GHIDRA_CAST(twin) + 0x161c)) != -1 && (*GHIDRA_CAST((GHIDRA_CAST(twin) + 0x161c)) < *GHIDRA_CAST((GHIDRA_CAST(ownerPlayer) + 0x161c)))))))) && (twin != ownerPlayer)) { multiplier = multiplier * 0.25; } return multiplier; } // 0060ddd0 void Entity_Familiar::set_locust_config_index(int param_2) { void *locustEntry; int iVar1; float locustScale; iVar1 = this->_variant; if (iVar1 != 0xe7) { KAGE_LogMessage(0x10,(byte *) "Trying to set locust config index on something that isn\'t a locust\n"); iVar1 = this->_variant; } this->_coins = param_2; if (iVar1 == 0xe7) { iVar1 = this->_subtype; } else { iVar1 = 0x19; param_2 = 0; } locustEntry = ItemConfig::get_wisp_entry(iVar1,param_2); anm2_apply_gfx_overrides (GHIDRA_CAST((GHIDRA_INT(locustEntry) + 0x84)),GHIDRA_CAST((GHIDRA_INT(locustEntry) + 0x9c)), &this->_sprite); this->_size = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x38)) * *GHIDRA_CAST((GHIDRA_CAST(locustEntry) + 0x78)); locustScale = *GHIDRA_CAST((GHIDRA_CAST(locustEntry) + 0x78)); (this->_sprite)._scale.x = locustScale; (this->_sprite)._scale.y = locustScale; return; } // 00610470 void Entity_Familiar::Remove() { void *player; int *playerCounter; int variant; float zeroY; (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Remove(); if (-1 < this->_orbitLayer) { RecalculateOrbitOffset(this,this->_orbitLayer,0); this->_orbitLayer = -1; } RemoveFromFollowers(this); RemoveFromDelayed(this); if (this->_variant == 0x2b) { if (this->_subtype == 0) { playerCounter = GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x136c)); *playerCounter = *playerCounter + -1; } } else if (this->_variant == 0x49) { playerCounter = GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1370)); *playerCounter = *playerCounter + -1; } zeroY = g_vectorZero.y; variant = this->_variant; if (((variant == 0x44) || (variant == 0x4e)) || (variant == 0xf3)) { player = this->_player; *GHIDRA_CAST((GHIDRA_CAST(player) + 0x164c)) = g_vectorZero.x; *GHIDRA_CAST((GHIDRA_CAST(player) + 0x1650)) = zeroY; } ResolveOrbitConflict(this); return; } // 00610540 void Entity_Familiar::Kill(EntityRef *source) { code *pcVar1; longlong lVar2; longlong lVar3; longlong lVar4; ANM2 *pAVar5; char cVar6; byte bVar7; ColorMod *color; uint uVar8; Entity *tmpEntity; Entity *orbitParent; ColorMod *color_00; ColorMod *color_01; int orbitLayerClamped; ColorMod *color_02; int *piVar9; Vector *posPtr; uint uVar10; uint uVar11; LayerState *layer; EntityRef *killSourcePtr; void *pvVar12; int iVar13; int unusedArg; qword *allocatedBytes; Sprite *player; Sprite *this_01; Entity_Familiar *pEVar14; PlayerManager *playerManager; EntityPtr *ptrSlot; bool bVar15; float fVar16; ulonglong uVar17; ulonglong uVar18; EntityRef killSource; Vector freePickupPos; undefined1 itemFindResult [8]; int itemNode; undefined1 anyVariantFind [4]; EntityRef nullKillSource; Vector spawnPos; undefined8 rngShifts; undefined4 rngShift3; int triggerKeyType; undefined4 triggerKeyAnyVariant; int triggerKeyTypeVariant; int triggerKeyVariant; EntityPtr *spawnerPtr; uint collectibleKey; Vector pickupVelocity; char wispMates [4]; int wispMatesData; undefined1 *wispMatesCapacity; Entity_Familiar *wispMatesCount; char itemWispMates [4]; int itemWispMatesData; undefined1 *itemWispMatesCapacity; Entity_Familiar *itemWispMatesCount; Vector local_198; Vector local_190; EntityList_EL itemWispQuery; EntityList_EL wispQuery; Vector pickupPos; uint pickupSeed; int soundId; Vector local_158; Vector local_150; void *local_148; uint pickupType; uint local_140; EntityPtr *local_13c; Game *local_138; Entity *local_134; uint pickupSubtype; EntityPtr local_12c; uint local_128; Entity_Familiar *local_124; undefined8 local_120; Entity_Familiar *local_118; char isUnicornWisp; Color tearPoofColor; Color poofColor; Color particleColor; Color particleColor2; RNG cardRng; ColorMod splatColor; void *local_1c; undefined1 *puStack_18; float local_14; Game *game; Manager *manager; qword oldAllocated; Entity_Familiar *otherFamiliar; Entity_Player *player; void **spiderCount; manager = g_manager; local_14 = -NAN; puStack_18 = &LAB_00af68e1; local_1c = ExceptionList; ExceptionList = &local_1c; local_12c = (EntityPtr)this; if (this->_dead == 0) { iVar13 = this->_variant; if (iVar13 == 0x80) { (GHIDRA_CAST((&particleColor)))->Color::Color(); uVar8 = Random(); Game::SpawnParticles (g_game,&this->_pos,0x23,8, (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * 2.3283064e-10 * 3.0 + 2.0,color,-12.0,0); uVar8 = Random(); manager = g_manager; local_120 = CONCAT44(0xb5,(float)local_120); local_124 = (Entity_Familiar *) ((float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * 2.3283064e-10 * 0.2 + 1.0); seed_fart_sound_override(GHIDRA_CAST((GHIDRA_INT(&local_120) + 4))); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_INT(local_120))) + 0x4))),0.5,2,0,(float)local_124,0.0); } else if ((iVar13 == 0xd8) || (iVar13 == 0xd9)) { soundId = 0x1e; seed_fart_sound_override(&soundId); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(soundId,1.0,2,0,1.0,0.0); splatColor._tint[0] = 0.2; splatColor._tint[1] = 0.2; splatColor._tint[2] = 0.2; splatColor._tint[3] = 1.0; splatColor._offset[0] = 0.0; splatColor._colorize[0] = 1.0; splatColor._colorize[1] = 1.0; splatColor._colorize[2] = 1.0; splatColor._colorize[3] = 1.0; splatColor._offset[1] = 0.0; splatColor._offset[2] = 0.0; uVar8 = Random(); posPtr = &this->_pos; local_198.y = (float)posPtr; tmpEntity = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,2,posPtr,&g_vectorZero,GHIDRA_CAST(0x0),3,uVar8,0); tmpEntity->SetColor(&splatColor,0xffffffff,0xff,0,1); uVar8 = Random(); tmpEntity = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,7,posPtr,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar8,0); tmpEntity->SetColor(&splatColor,0xffffffff,0xff,0,1); tmpEntity->Update(); uVar8 = Random(); for (local_124 = GHIDRA_CAST((uVar8 % 5 + 3)); local_124 != GHIDRA_CAST(0x0); local_124 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_124[-1])) + 0xf47))))) { uVar8 = Random(); fVar16 = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * 2.3283064e-10 * 3.14; local_134 = GHIDRA_CAST((fVar16 + fVar16)); fVar16 = cos((float)local_134); pickupPos.x = fVar16 * 0.5 * *GHIDRA_CAST((GHIDRA_CAST(this) + 0x370)) + (GHIDRA_CAST((GHIDRA_INT(this) + 0x33c)))->x; fVar16 = sin((float)local_134); pickupPos.y = fVar16 * 0.5 * *GHIDRA_CAST((GHIDRA_CAST(this) + 0x370)) + *GHIDRA_CAST((GHIDRA_CAST(this) + 0x340)); uVar8 = Random(); fVar16 = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * 2.3283064e-10 * 3.14; (*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))) = GHIDRA_CAST((fVar16 + fVar16)); uVar8 = Random(); local_120 = CONCAT44((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))), (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * 2.3283064e-10 * 4.0 + 2.0); pickupVelocity.x = cos((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_120)) + 0x4)))); pickupVelocity.x = pickupVelocity.x * (float)local_120; local_150.y = pickupVelocity.x; fVar16 = sin((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_120)) + 0x4)))); pickupVelocity.y = fVar16 * (float)local_120; local_13c = GHIDRA_CAST(pickupVelocity.y); pickupSeed = Random(); local_138 = g_game; pickupSubtype = 0; local_140 = 5; pickupType = 1000; lua_callback_run_pre_entity_spawn (GHIDRA_CAST(&pickupType),GHIDRA_CAST(&local_140),&pickupPos,&pickupVelocity,GHIDRA_CAST(0x0), GHIDRA_CAST(&pickupSubtype),&pickupSeed); uVar8 = local_140; if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { LAB_00611aa8: local_128 = pickupSubtype; } else { local_118 = (g_game->_deathmatchManager)._type; uVar11 = Random(); pEVar14 = local_118; uVar10 = pickupSubtype; rngShifts = 0x900000005; local_120 = CONCAT44(uVar11,7); rngShift3 = 7; if (pickupType != 5) goto LAB_00611aa8; if (uVar8 < 0x12d) { if (uVar8 == 300) { while ((local_128 = pickupSubtype, pickupSubtype == 0 || (cVar6 = local_118->Kill(pickupSubtype), cVar6 != '\0') )) { if (uVar11 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar11 = uVar11 >> ((byte)rngShifts & 0x1f) ^ uVar11; uVar11 = uVar11 << ((byte)((ulonglong)rngShifts >> 0x20) & 0x1f) ^ uVar11; uVar11 = uVar11 >> ((byte)local_120 & 0x1f) ^ uVar11; iVar13 = ItemPool::GetCardEx(uVar11,0x19,10,10,1); cardRng._shift1 = 5; cardRng._shift2 = 9; cardRng._shift3 = 7; cardRng._seed = uVar11; pickupSubtype = lua_callback_run_get_card(&cardRng,iVar13,1,1,0); } } else { if (uVar8 == 0x46) { local_134 = GHIDRA_CAST((pickupSubtype >> 0xb)); do { local_128 = pickupSubtype; if (pickupSubtype != 0) { pcVar1 = *(code **)(*GHIDRA_CAST(local_118) + 0x28); iVar13 = ItemPool::GetPillEffect (&g_game->_itemPool,pickupSubtype,GHIDRA_CAST(0x0)); cVar6 = (*pcVar1)(iVar13); if (cVar6 == '\0') goto LAB_00611ab4; uVar11 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_120))) + 0x4))); } if (uVar11 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar11 = uVar11 >> ((byte)rngShifts & 0x1f) ^ uVar11; uVar11 = uVar11 << ((byte)((ulonglong)rngShifts >> 0x20) & 0x1f) ^ uVar11; uVar11 = uVar11 >> ((byte)local_120 & 0x1f) ^ uVar11; local_120 = CONCAT44(uVar11,(float)local_120); pickupSubtype = ItemPool::GetPill(uVar11); pickupSubtype = pickupSubtype | (GHIDRA_UINT(local_134) & 1) << 0xb; } while( true ); } if (uVar8 != 100) goto LAB_00611aa8; local_128 = pickupSubtype; if (pickupSubtype == 0x19) { LAB_006118d4: bVar15 = false; } else { collectibleKey = pickupSubtype; std::set::find_node(itemFindResult,&collectibleKey); if (((*GHIDRA_CAST((itemNode + 0xd)) == '\0') && (*GHIDRA_CAST((itemNode + 0x10)) <= GHIDRA_INT(uVar10))) && (itemNode != pEVar14->_index)) goto LAB_006118d4; bVar15 = true; } if ((uVar10 == 0) || (bVar15)) { pickupSubtype = (**(code **)(*GHIDRA_CAST(pEVar14) + 0x84))(0); local_128 = pickupSubtype; } } } else { if (uVar8 != 0x15e) goto LAB_00611aa8; while ((local_128 = pickupSubtype, pickupSubtype == 0 || (cVar6 = local_118->guard_check_icall(pickupSubtype), cVar6 != '\0'))) { pickupSubtype = (GHIDRA_CAST((&g_game->_itemPool)))->ItemPool::GetTrinket(0); } } } LAB_00611ab4: local_134 = (GHIDRA_CAST((local_138->_entityFactory)))->EntityFactory::Create(pickupType,0); lVar2 = CONCAT44(local_138,local_158.y); if (local_134 != GHIDRA_CAST(0x0)) { uVar17 = GetTimeNs(); tmpEntity = local_134; lVar2 = (uVar17 & 0xffffffff) * 0x431bde82; local_158.y = (float)((ulonglong)lVar2 >> 0x20); lVar3 = (uVar17 >> 0x20) * 0xd7b634db; local_118 = GHIDRA_CAST(((ulonglong)lVar3 >> 0x20)); uVar18 = lVar3 + ((uVar17 & 0xffffffff) * 0xd7b634db >> 0x20); uVar10 = GHIDRA_UINT((uVar18 >> 0x20)); lVar2 = lVar2 + (uVar18 & 0xffffffff); local_190.x = (float)lVar2; uVar8 = GHIDRA_UINT(((ulonglong)lVar2 >> 0x20)); lVar2 = (uVar17 >> 0x20) * 0x431bde82 + (ulonglong)CONCAT14(CARRY4(uVar10,uVar8),uVar10 + uVar8); local_134->_spawnerType = 0; uVar8 = GHIDRA_UINT(((ulonglong)lVar2 >> 0x20)); local_134->_spawnerVariant = 0; ptrSlot = &local_134->_spawnerEntity; local_120 = CONCAT44(uVar8 >> 0x12,GHIDRA_UINT(lVar2) >> 0x12 | uVar8 * 0x4000); if (*ptrSlot != (EntityPtr)0x0) { spawnerPtr = ptrSlot; std::multiset::erase(&spawnerPtr); } iVar13 = *GHIDRA_CAST(tmpEntity); *ptrSlot = (EntityPtr)0x0; (tmpEntity->_pos).x = pickupPos.x; (tmpEntity->_pos).y = pickupPos.y; (tmpEntity->_velocity).x = local_150.y; (tmpEntity->_velocity).y = (float)local_13c; (**(code **)(iVar13 + 4))(pickupType,local_140,local_128,pickupSeed); game = local_138; pvVar12 = local_138->_room; iVar13 = *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x1214)); *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + 0x1214)) = iVar13 + 1; tmpEntity->_index = iVar13; (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar12) + 0x1218)))))->EntityList::AddEntity(tmpEntity); bVar7 = Game::ShouldEraseEnemy(tmpEntity); if (bVar7 != 0) { Entity::RemoveWithPoof(tmpEntity,unusedArg); } if ((tmpEntity->_exists != 0) && ((game->_proceduralItemManager)._proceduralItems._begin != (game->_proceduralItemManager)._proceduralItems._end)) { triggerKeyTypeVariant = tmpEntity->_type; triggerKeyVariant = tmpEntity->_variant; std::map::find(&local_148,&triggerKeyTypeVariant); if (local_148 == (game->_proceduralItemManager)._spawnTriggerTargets._head) { triggerKeyType = tmpEntity->_type; triggerKeyAnyVariant = 0xffffffff; piVar9 = GHIDRA_CAST(std)::map::find(anyVariantFind,&triggerKeyType); local_148 = (void *)*piVar9; if (local_148 == (game->_proceduralItemManager)._spawnTriggerTargets._head) goto LAB_00611d87; } playerManager = &g_game->_playerManager; local_118 = GHIDRA_CAST(0x0); if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 != 0) { do { pvVar12 = (playerManager->_playerList)._end; if (GHIDRA_INT(pvVar12) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { KAGE_LogMessage(0x10,(byte *) "(GHIDRA_CAST(()))->PlayerManager::GetPlayer() : There are no players! \n"); pvVar12 = (playerManager->_playerList)._end; } piVar9 = (playerManager->_playerList)._begin; if (local_118 < GHIDRA_CAST((GHIDRA_INT(pvVar12) - GHIDRA_INT(piVar9) >> 2))) { piVar9 = piVar9 + GHIDRA_INT(local_118); } trigger_set_dispatch ((void *)(*piVar9 + 0x1fc8),6,tmpEntity,&pickupPos,&pickupVelocity); playerManager = &g_game->_playerManager; local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); } while (local_118 < (undefined1 *) (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2)); } } LAB_00611d87: uVar18 = GetTimeNs(); uVar8 = GHIDRA_UINT((uVar18 >> 0x20)); lVar3 = (uVar18 & 0xffffffff) * 0x431bde82; local_150.y = (float)((ulonglong)lVar3 >> 0x20); lVar4 = (ulonglong)uVar8 * 0xd7b634db; local_13c = GHIDRA_CAST(((ulonglong)lVar4 >> 0x20)); lVar2 = (ulonglong)uVar8 * 0x431bde82; uVar18 = lVar4 + ((uVar18 & 0xffffffff) * 0xd7b634db >> 0x20); uVar10 = GHIDRA_UINT((uVar18 >> 0x20)); lVar3 = lVar3 + (uVar18 & 0xffffffff); local_190.x = (float)lVar3; uVar8 = GHIDRA_UINT(((ulonglong)lVar3 >> 0x20)); lVar3 = lVar2 + (ulonglong)CONCAT14(CARRY4(uVar10,uVar8),uVar10 + uVar8); uVar11 = GHIDRA_UINT(((ulonglong)lVar3 >> 0x20)); uVar8 = GHIDRA_UINT(lVar3) >> 0x12 | uVar11 * 0x4000; uVar10 = uVar8 - GHIDRA_INT((float)local_120); bVar15 = CARRY4(GHIDRA_UINT(g_entitySpawnTimeMs),uVar10); (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x0))) = GHIDRA_UINT(g_entitySpawnTimeMs) + uVar10; (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) + (((uVar11 >> 0x12) - (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_INT(local_120))) + 0x4)))) - GHIDRA_UINT((uVar8 < GHIDRA_UINT((float)local_120)))) + GHIDRA_UINT(bVar15); } tmpEntity = local_134; local_138 = GHIDRA_CAST(((ulonglong)lVar2 >> 0x20)); local_158.y = (float)lVar2; local_134->SetColor(&splatColor,0xffffffff,0xff,0,1); if (&tmpEntity->_splatColor != &splatColor) { (tmpEntity->_splatColor)._tint[0] = splatColor._tint[0]; (tmpEntity->_splatColor)._tint[1] = splatColor._tint[1]; (tmpEntity->_splatColor)._tint[2] = splatColor._tint[2]; (tmpEntity->_splatColor)._tint[3] = splatColor._tint[3]; (tmpEntity->_splatColor)._colorize[0] = splatColor._colorize[0]; (tmpEntity->_splatColor)._colorize[1] = splatColor._colorize[1]; (tmpEntity->_splatColor)._colorize[2] = splatColor._colorize[2]; (tmpEntity->_splatColor)._colorize[3] = splatColor._colorize[3]; *GHIDRA_CAST((tmpEntity->_splatColor)._offset) = CONCAT44(splatColor._offset[1],splatColor._offset[0]); (tmpEntity->_splatColor)._offset[2] = splatColor._offset[2]; } tmpEntity->Update(); this = GHIDRA_CAST(local_12c); } if (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x2c)) == 0xd8) { layer = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(this) + 0x48)))))->ANM2::GetLayer(GHIDRA_CAST(0x0)); (layer->_size).x = g_vectorZero.x; (layer->_size).y = g_vectorZero.y; *GHIDRA_CAST((GHIDRA_CAST(this) + 0xd88)) = 0x1c2; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x188)) = 0; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x15c)) = 0.0; if (-1 < *GHIDRA_CAST((GHIDRA_CAST(this) + 0xd70))) { RecalculateOrbitOffset(this,*GHIDRA_CAST((GHIDRA_CAST(this) + 0xd70)),0); *GHIDRA_CAST((GHIDRA_CAST(this) + 0xd70)) = -1; } local_150.y = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)); local_124 = GHIDRA_CAST(0x2); do { uVar8 = Random(); uVar10 = Random(); fVar16 = (float)((double)GHIDRA_INT(uVar10) + __uint_to_double_fixup[-(GHIDRA_INT(uVar10) >> 0x1f)]) * 2.3283064e-10 * 3.14; local_13c = GHIDRA_CAST((fVar16 + fVar16)); fVar16 = cos((float)local_13c); spawnPos.x = fVar16 * 10.0 + (GHIDRA_CAST((GHIDRA_INT(this) + 0x33c)))->x; fVar16 = sin((float)local_13c); spawnPos.y = fVar16 * 10.0 + *GHIDRA_CAST((GHIDRA_CAST(this) + 0x340)); tmpEntity = (GHIDRA_CAST((g_game)))->Game::SpawnEx(3,0xd9,&spawnPos,&g_vectorZero,GHIDRA_CAST(local_150.y),0, uVar8,0); tmpEntity->Update(); ptrSlot = &tmpEntity->_parent; if (tmpEntity->_parent != (EntityPtr)0x0) { local_13c = ptrSlot; std::multiset::erase(&local_13c); } *ptrSlot = (EntityPtr)this; std::multiset::insert(ptrSlot); local_124 = GHIDRA_CAST((GHIDRA_INT(local_124) + -1)); } while (local_124 != GHIDRA_CAST(0x0)); nullKillSource._type = 0; nullKillSource._variant = 0; nullKillSource._spawnerType = 0; nullKillSource._spawnerVariant = 0; nullKillSource._position.x = g_vectorZero.x; nullKillSource._position.y = g_vectorZero.y; nullKillSource._velocity.x = g_vectorZero.x; nullKillSource._velocity.y = g_vectorZero.y; nullKillSource._flags = 0; nullKillSource._entity = (void *)0x0; (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Kill(&nullKillSource); *GHIDRA_CAST((GHIDRA_CAST(this) + 0x173)) = 0; ExceptionList = local_1c; return; } uVar8 = Random(); fVar16 = local_198.y; iVar13 = (uVar8 & 1) + 2; if ((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x168)) & 0x100) == 0) { do { tmpEntity = *(void **)(GHIDRA_CAST(this) + 0x410); spiderCount = &tmpEntity[4]._config; *spiderCount = (void *)(GHIDRA_INT(*spiderCount) + 1); spawn_blue_spider(GHIDRA_CAST((GHIDRA_INT(this) + 0x33c)),tmpEntity,&g_vectorZero); iVar13 = iVar13 + -1; } while (iVar13 != 0); } else { do { posPtr = Room::FindFreePickupSpawnPosition (g_game->_room,&freePickupPos,GHIDRA_CAST(fVar16),40.0,0,0,0); Entity_NPC::ThrowSpider(GHIDRA_CAST(fVar16),GHIDRA_CAST(0x0),*posPtr,0,-30.0); iVar13 = iVar13 + -1; } while (iVar13 != 0); this = GHIDRA_CAST(local_12c); } } else if (iVar13 == 0xce) { cVar6 = wisp_kill(this,__security_cookie ^ GHIDRA_UINT(((&splatColor)[1]._colorize + 1))); if (cVar6 == '\0') { ExceptionList = local_1c; return; } local_140 = this->_orbitLayer; if (-1 < GHIDRA_INT(local_140)) { if (this->_isSubtype55555 == 0) { if ((this->_type == 3) && (((this->_variant == 0xce && (this->_subtype == 0x4d)) || ((this->_variant == 0xce && (this->_subtype == 0x12a)))))) { isUnicornWisp = '\x01'; } else { isUnicornWisp = '\0'; } EntityList::QuerySublist (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&wispQuery,3,-1,-1,0,0); iVar13 = wispQuery._size; local_14 = 0.0; buffer_init(wispMates,wispQuery._size + 1); local_14 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),1); (*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x0))) = 0.0; pEVar14 = wispMatesCount; if (iVar13 != 0) { local_118 = wispMatesCount; pvVar12 = wispQuery._data; uVar8 = wispQuery._size; do { otherFamiliar = *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + GHIDRA_INT((float)local_120) * 4)); if (otherFamiliar->_exists != 0) { if (otherFamiliar != this) { (*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))) = (Entity_Familiar *) __RTDynamicCast(otherFamiliar,0, &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0 ); if (((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))))->_orbitLayer == local_140) { tmpEntity = get_orbit_parent(this); orbitParent = get_orbit_parent((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4)))); pEVar14 = (*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))); if (orbitParent == tmpEntity) { if (((((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))))->_type == 3) && (((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))))->_variant == 0xce)) && ((((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))))->_subtype == 0x4d || (((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))))->_subtype == 0x12a)))) { isUnicornWisp = '\x01'; } local_124 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); if (wispMatesCapacity < local_124) { KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); } *GHIDRA_CAST((wispMatesData + GHIDRA_INT(local_118) * 4)) = pEVar14; local_118 = local_124; wispMatesCount = local_124; pEVar14 = local_124; } else { pEVar14 = local_118; } } pvVar12 = wispQuery._data; uVar8 = wispQuery._size; } } (*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x0))) = (float)(GHIDRA_INT((float)local_120) + 1); } while (GHIDRA_UINT((float)local_120) < uVar8); } local_12c = (EntityPtr)0x3f800000; if (isUnicornWisp != '\0') { local_12c = (EntityPtr)0x40000000; } bVar7 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x117,0); if (bVar7 != 0) { local_12c = (EntityPtr)0x3eaaaaab; } uVar8 = local_140; if (GHIDRA_INT(local_140) < 1) { uVar8 = 0; } uVar10 = 10; if (GHIDRA_INT(uVar8) < 10) { uVar10 = uVar8; } local_118 = GHIDRA_CAST(0x0); local_120 = CONCAT44((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))),uVar10 * 0x14); if (pEVar14 != GHIDRA_CAST(0x0)) { local_134 = (Entity *) (float)((double)GHIDRA_INT(pEVar14) + __uint_to_double_fixup[-(GHIDRA_INT(pEVar14) >> 0x1f)]); local_138 = GHIDRA_CAST(0x40400000); local_124 = GHIDRA_CAST(0x40c90fdb); do { local_148 = (void *)__RTDynamicCast(*(undefined4 *) (wispMatesData + GHIDRA_INT(local_118) * 4),0, &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor ,&IsaacRepentancePlus::Entity_Familiar:: RTTI_Type_Descriptor,0); *GHIDRA_CAST((GHIDRA_CAST(local_148) + 0xd60)) = ((float)GHIDRA_INT(local_118) * (float)local_124) / (float)local_134; bVar7 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x70,0); if (bVar7 == 0) { fVar16 = *GHIDRA_CAST((&DAT_00c34138 + GHIDRA_INT((float)local_120))); } else { fVar16 = *GHIDRA_CAST((&DAT_00c3413c + GHIDRA_INT((float)local_120))) * *GHIDRA_CAST((&DAT_00c34138 + GHIDRA_INT((float)local_120))); } *GHIDRA_CAST((GHIDRA_CAST(local_148) + 0xd6c)) = fVar16 * (float)local_12c; if (*GHIDRA_CAST((GHIDRA_CAST(local_148) + 0x2c)) == 0x3c) { *GHIDRA_CAST((GHIDRA_CAST(local_148) + 0xd6c)) = fVar16 * (float)local_12c * (float)local_138; } local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); } while (local_118 < pEVar14); } if (wispMates[0] == '\0') { allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); if (g_mainHeap == (void *)0x0) { allocatedBytes = &g_allocatedBytesNoHeap; } if (wispMatesData != 0) { uVar8 = *GHIDRA_CAST((wispMatesData + -4)); oldAllocated = *allocatedBytes; *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar8; *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocated) < uVar8)); free(GHIDRA_CAST((wispMatesData + -4))); } } local_14 = -NAN; if ((*GHIDRA_CAST((GHIDRA_CAST(&(wispQuery)) + 0x0))) == '\0') { allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); if (g_mainHeap == (void *)0x0) { allocatedBytes = &g_allocatedBytesNoHeap; } if (wispQuery._data != (void *)0x0) { uVar8 = *GHIDRA_CAST((GHIDRA_CAST(wispQuery._data) + -4)); oldAllocated = *allocatedBytes; *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar8; *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocated) < uVar8)); free(GHIDRA_CAST((GHIDRA_INT(wispQuery._data) + -4))); } local_14 = -NAN; } } this->_orbitLayer = -1; } } else { posPtr = &this->_pos; if (iVar13 == 0xed) { uVar8 = Random(); tmpEntity = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,0xf,posPtr,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar8,0); (tmpEntity->_posOffset).x = 0.0; (tmpEntity->_posOffset).y = -6.0; local_12c = (EntityPtr)0x3f800000; (GHIDRA_CAST((&poofColor)))->Color::Color(1.4,0.7,1.6,1.0); (GHIDRA_CAST((player)))->Sprite::SetColor(color_00); uVar8 = Random(); tmpEntity = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,0xc,posPtr,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar8,0); (tmpEntity->_posOffset).x = 0.0; (tmpEntity->_posOffset).y = -6.0; (GHIDRA_CAST((&tearPoofColor)))->Color::Color(1.4,0.7,1.6,1.0); (GHIDRA_CAST((this_01)))->Sprite::SetColor(color_01); manager = g_manager; local_128 = 0x105; seed_fart_sound_override(GHIDRA_CAST(&local_128)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(local_128,1.0,2,0,1.0,0.0); local_120 = CONCAT44((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))),this->_orbitLayer); if (-1 < this->_orbitLayer) { if (this->_isSubtype55555 == 0) { if ((this->_type == 3) && (((this->_variant == 0xce && (this->_subtype == 0x4d)) || ((this->_variant == 0xce && (this->_subtype == 0x12a)))))) { isUnicornWisp = '\x01'; } else { isUnicornWisp = '\0'; } EntityList::QuerySublist (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&itemWispQuery,3,-1,-1,0,0); iVar13 = itemWispQuery._size; local_14 = 5.60519e-45; buffer_init(itemWispMates,itemWispQuery._size + 1); uVar8 = 0; local_14 = (float)CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),5); local_120 = local_120 & 0xffffffff; pEVar14 = itemWispMatesCount; if (iVar13 != 0) { local_118 = itemWispMatesCount; pvVar12 = itemWispQuery._data; uVar10 = itemWispQuery._size; do { otherFamiliar = *GHIDRA_CAST((GHIDRA_CAST(pvVar12) + uVar8 * 4)); if (otherFamiliar->_exists != 0) { if (otherFamiliar != this) { local_124 = (Entity_Familiar *) __RTDynamicCast(otherFamiliar,0, &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Familiar:: RTTI_Type_Descriptor,0); if ((float)local_124->_orbitLayer == (float)local_120) { tmpEntity = get_orbit_parent(local_124); orbitParent = get_orbit_parent(this); pEVar14 = local_124; if (tmpEntity == orbitParent) { if (((local_124->_type == 3) && (local_124->_variant == 0xce)) && ((local_124->_subtype == 0x4d || (local_124->_subtype == 0x12a)))) { isUnicornWisp = '\x01'; } local_124 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); if (itemWispMatesCapacity < local_124) { KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); } *GHIDRA_CAST((itemWispMatesData + GHIDRA_INT(local_118) * 4)) = pEVar14; local_118 = local_124; itemWispMatesCount = local_124; pEVar14 = local_124; } else { pEVar14 = local_118; } } pvVar12 = itemWispQuery._data; uVar10 = itemWispQuery._size; } } uVar8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_INT(local_120))) + 0x4))) + 1; local_120 = CONCAT44(uVar8,(float)local_120); } while (uVar8 < uVar10); } if (isUnicornWisp != '\0') { local_12c = (EntityPtr)0x40000000; } bVar7 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x117,0); if (bVar7 != 0) { local_12c = (EntityPtr)0x3eaaaaab; } iVar13 = GHIDRA_INT((float)local_120); if (GHIDRA_INT((float)local_120) < 1) { iVar13 = 0; } orbitLayerClamped = 10; if (iVar13 < 10) { orbitLayerClamped = iVar13; } local_118 = GHIDRA_CAST(0x0); local_120 = CONCAT44((*GHIDRA_CAST((GHIDRA_CAST(&(local_120)) + 0x4))),orbitLayerClamped * 0x14); if (pEVar14 != GHIDRA_CAST(0x0)) { local_124 = (Entity_Familiar *) (float)((double)GHIDRA_INT(pEVar14) + __uint_to_double_fixup[-(GHIDRA_INT(pEVar14) >> 0x1f)]); do { local_134 = (Entity *) __RTDynamicCast(*GHIDRA_CAST((itemWispMatesData + GHIDRA_INT(local_118) * 4)), 0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Familiar:: RTTI_Type_Descriptor,0); local_134[3]._sprite._championColor._colorize[1] = ((float)GHIDRA_INT(local_118) * 6.2831855) / (float)local_124; bVar7 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x70,0); if (bVar7 == 0) { fVar16 = *GHIDRA_CAST((&DAT_00c34138 + GHIDRA_INT((float)local_120))); } else { fVar16 = *GHIDRA_CAST((&DAT_00c3413c + GHIDRA_INT((float)local_120))) * *GHIDRA_CAST((&DAT_00c34138 + GHIDRA_INT((float)local_120))); } local_134[3]._sprite._championColor._offset[0] = fVar16 * (float)local_12c; if (local_134->_variant == 0x3c) { local_134[3]._sprite._championColor._offset[0] = fVar16 * (float)local_12c * 3.0; } local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); } while (local_118 < pEVar14); } if (itemWispMates[0] == '\0') { allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); if (g_mainHeap == (void *)0x0) { allocatedBytes = &g_allocatedBytesNoHeap; } if (itemWispMatesData != 0) { uVar8 = *GHIDRA_CAST((itemWispMatesData + -4)); oldAllocated = *allocatedBytes; *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar8; *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocated) < uVar8)); free(GHIDRA_CAST((itemWispMatesData + -4))); } } local_14 = -NAN; if ((*GHIDRA_CAST((GHIDRA_CAST(&(itemWispQuery)) + 0x0))) == '\0') { allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); if (g_mainHeap == (void *)0x0) { allocatedBytes = &g_allocatedBytesNoHeap; } if (itemWispQuery._data != (void *)0x0) { uVar8 = *GHIDRA_CAST((GHIDRA_CAST(itemWispQuery._data) + -4)); oldAllocated = *allocatedBytes; *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar8; *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocated) < uVar8)); free(GHIDRA_CAST((GHIDRA_INT(itemWispQuery._data) + -4))); } local_14 = -NAN; } } this->_orbitLayer = -1; } (GHIDRA_CAST((&this->_sirenHelper)))->EntityPtr::Set(GHIDRA_CAST(0x0)); } else if (iVar13 == 0xe5) { (GHIDRA_CAST((this->_player)))->Entity_Player::AddBlueFlies(1,posPtr,GHIDRA_CAST(this->_target)); } else if (iVar13 == 0xea) { (GHIDRA_CAST((&particleColor2)))->Color::Color(); uVar8 = Random(); Game::SpawnParticles (g_game,&this->_pos,0x23,8, (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * 2.3283064e-10 * 3.0 + 2.0,color_02,-12.0,0); uVar8 = Random(); SoundEffects::PlayWithFartOverride (0xb5,0.5,2,0, (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * 2.3283064e-10 * 0.2 + 1.0); } else if (iVar13 == 0xc9) { if (this->_subtype != 0xc) { uVar8 = Random(); tmpEntity = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,2,posPtr,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar8,0); piVar9 = GHIDRA_CAST(__RTDynamicCast(tmpEntity,0, &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor, 0)); piVar9[0xd3] = 0; piVar9[0xd4] = -0x3ee00000; (**(code **)(*piVar9 + 0x3c))(&this->_splatColor,0xffffffff,0xff,0,1); (**(code **)(*piVar9 + 0xc))(); } (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::BloodExplode(); switch(this->_subtype) { case 2: case 0x14: (GHIDRA_CAST((this->_player)))->Entity_Player::AddBlueFlies(1,&this->_pos,GHIDRA_CAST(0x0)); break; case 3: uVar8 = Random(); local_120 = CONCAT44((uVar8 & 1) + 2,(float)local_120); do { uVar8 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); uVar10 = Random(); fVar16 = (float)((double)GHIDRA_INT(uVar10) + __uint_to_double_fixup[-(GHIDRA_INT(uVar10) >> 0x1f)]) * 2.3283064e-10 * 3.14; local_124 = GHIDRA_CAST((fVar16 + fVar16)); local_198.x = cos((float)local_124); local_198.x = local_198.x * 5.0; fVar16 = sin((float)local_124); local_198.y = fVar16 * 5.0; (GHIDRA_CAST((g_game)))->Game::SpawnEx(5,0x14,&this->_pos,&local_198,GHIDRA_CAST(this),0,uVar8,0); iVar13 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_INT(local_120))) + 0x4))) + -1; local_120 = CONCAT44(iVar13,(float)local_120); } while (iVar13 != 0); break; case 4: uVar8 = Random(); iVar13 = (uVar8 & 3) + 2; local_120 = CONCAT44(iVar13,(float)local_120); while (iVar13 != 0) { uVar8 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); uVar10 = Random(); fVar16 = (float)((double)GHIDRA_INT(uVar10) + __uint_to_double_fixup[-(GHIDRA_INT(uVar10) >> 0x1f)]) * 2.3283064e-10 * 3.14; local_124 = GHIDRA_CAST((fVar16 + fVar16)); local_150.x = cos((float)local_124); local_150.x = local_150.x * 5.0; fVar16 = sin((float)local_124); local_150.y = fVar16 * 5.0; (GHIDRA_CAST((g_game)))->Game::SpawnEx(5,10,&this->_pos,&local_150,GHIDRA_CAST(this),2,uVar8,0); iVar13 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_INT(local_120))) + 0x4))) + -1; local_120 = CONCAT44(iVar13,(float)local_120); } break; case 0xd: uVar8 = Random(); tmpEntity = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0x34,&this->_pos,&g_vectorZero,this->_player,0,uVar8); tmpEntity->SetCollisionDamage(0x41000000); iVar13 = *GHIDRA_CAST(tmpEntity); pAVar5 = &tmpEntity[1]._sprite; (pAVar5->_filename)._buf[4] = ','; (pAVar5->_filename)._buf[5] = '\x01'; (pAVar5->_filename)._buf[6] = '\0'; (pAVar5->_filename)._buf[7] = '\0'; pAVar5 = &tmpEntity[1]._sprite; (pAVar5->_filename)._buf[8] = ','; (pAVar5->_filename)._buf[9] = '\x01'; (pAVar5->_filename)._buf[10] = '\0'; (pAVar5->_filename)._buf[0xb] = '\0'; (**(code **)(iVar13 + 0xc))(); break; case 0xe: uVar8 = Random(); tmpEntity = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0x8d,&this->_pos,&g_vectorZero,this->_player,0,uVar8); iVar13 = *GHIDRA_CAST(tmpEntity); pAVar5 = &tmpEntity[1]._sprite; (pAVar5->_filename)._buf[4] = '\x0e'; (pAVar5->_filename)._buf[5] = '\x01'; (pAVar5->_filename)._buf[6] = '\0'; (pAVar5->_filename)._buf[7] = '\0'; pAVar5 = &tmpEntity[1]._sprite; (pAVar5->_filename)._buf[8] = '\x0e'; (pAVar5->_filename)._buf[9] = '\x01'; (pAVar5->_filename)._buf[10] = '\0'; (pAVar5->_filename)._buf[0xb] = '\0'; (**(code **)(iVar13 + 0x40))(*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x157c)) * 0.5); tmpEntity->Update(); } } else { uVar8 = Random(); tmpEntity = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,2,posPtr,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar8,0); piVar9 = GHIDRA_CAST(__RTDynamicCast(tmpEntity,0, &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor,0)) ; piVar9[0xd3] = 0; piVar9[0xd4] = -0x3ee00000; (**(code **)(*piVar9 + 0x3c))(&this->_splatColor,0xffffffff,0xff,0,1); (**(code **)(*piVar9 + 0xc))(); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::BloodExplode(); if ((((this->_variant == 0xee) && (this->_player->_playerType == 0x1a)) && (bVar7 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x26b,0), bVar7 != 0)) && (this->_subtype == 0)) { uVar8 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); posPtr = MusicManager::RandomVector(&local_190); uVar10 = Random(); this = GHIDRA_CAST(local_12c); local_158.x = (float)((double)GHIDRA_INT(uVar10) + __uint_to_double_fixup[-(GHIDRA_INT(uVar10) >> 0x1f)] ) * 2.3283064e-10 * 3.0 + 2.0; local_158.y = local_158.x * posPtr->y; local_158.x = local_158.x * posPtr->x; tmpEntity = (GHIDRA_CAST((g_game)))->Game::Spawn(5,10,GHIDRA_CAST((GHIDRA_INT(local_12c) + 0x33c)),&local_158, GHIDRA_CAST(local_12c),2,uVar8); iVar13 = *GHIDRA_CAST(tmpEntity); tmpEntity[1]._sprite._championColor._colorize[1] = 8.40779e-44; (**(code **)(iVar13 + 0xc))(); } } } } killSourcePtr = (GHIDRA_CAST((&killSource)))->EntityRef::EntityRef(); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Kill(killSourcePtr); this->Remove(); iVar13 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x2c)); if (iVar13 == 0xed) { if (*(void **)(GHIDRA_CAST(this) + 0x410) == GHIDRA_CAST(0x0)) { ExceptionList = local_1c; return; } (GHIDRA_CAST((*(void **)(GHIDRA_CAST(this) + 0x410))))->Entity_Player::RecomputeWispCollectibles(GHIDRA_CAST(0x0)); iVar13 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x2c)); } if (((iVar13 == 0xee) && (player = *(void **)(GHIDRA_CAST(this) + 0x410), player != GHIDRA_CAST(0x0))) && (player->_playerType == 0x1a)) { (GHIDRA_CAST((player)))->Entity_Player::UpdateHeartDependentEffects(); } ExceptionList = local_1c; return; } // 006121d0 void Entity_Familiar::ClearReferences() { int variant; void *pvVar1; uint size; int local_14 [3]; EntityPtr *linkedEntityRef; int gridIndex; std_vector *hitList; void *hitListBegin; uint *playerFlags; variant = this->_variant; if (variant == 900) { gridIndex = (this->_pathfinder)._gridIndex; if (-1 < gridIndex) { variant = 900; if ((gridIndex < 0x1c0) && (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + gridIndex * 4 + 0x76c)) < 0x3b7)) { *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + gridIndex * 4 + 0x76c)) = 900; variant = this->_variant; goto LAB_0061221c; } } LAB_00612223: if (variant != 0xed) goto LAB_00612253; } else { LAB_0061221c: if (variant != 0xce) goto LAB_00612223; } if (this->_subtype == 0x22d) { playerFlags = GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1574)); *playerFlags = *playerFlags | 0x400; *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1518)) = 1; variant = this->_variant; } LAB_00612253: if ((variant == 0xf0) && (this->_linkedEntity != (EntityPtr)0x0)) { (**(code **)(*GHIDRA_CAST(this->_linkedEntity) + 0x28))(); } if (this->_linkedEntity != (EntityPtr)0x0) { linkedEntityRef = &this->_linkedEntity; std::multiset::erase(&linkedEntityRef); } this->_linkedEntity = (EntityPtr)0x0; (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearReferences(); hitList = &this->_hitList; if (GHIDRA_CAST(local_14) != hitList) { hitListBegin = hitList->_begin; pvVar1 = (this->_hitList)._capacity; hitList->_begin = (void *)0x0; (this->_hitList)._end = (void *)0x0; (this->_hitList)._capacity = (void *)0x0; if (hitListBegin != (void *)0x0) { size = GHIDRA_INT(pvVar1) - GHIDRA_INT(hitListBegin) & 0xfffffffc; pvVar1 = hitListBegin; if (0xfff < size) { pvVar1 = *(void **)(GHIDRA_CAST(hitListBegin) + -4); size = size + 0x23; if (0x1f < GHIDRA_UINT((GHIDRA_INT(hitListBegin) + (-4 - GHIDRA_INT(pvVar1))))) { /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(pvVar1,size); } } set_extra_data(&this->_extraData,(void *)0x0); if (this->_weapon != GHIDRA_CAST(0x0)) { (**(code **)(*GHIDRA_CAST(this->_weapon) + 0x14))(); if (this->_weapon != GHIDRA_CAST(0x0)) { (*(code *)**GHIDRA_CAST(this->_weapon))(1); } this->_weapon = (void *)0x0; } return; } // 00612330 Entity * Entity_Familiar::get_orbit_parent() { byte isHasItem; EntityPtr orbitParent; EntityList_EL queryResult; void *local_10; undefined1 *puStack_c; undefined4 local_8; Entity *foundEntity; local_8 = 0xffffffff; puStack_c = &LAB_00af6910; local_10 = ExceptionList; ExceptionList = &local_10; if (((this->_variant != 0x2b) && (this->_variant != 0xce)) || (orbitParent = this->_parent, orbitParent == (EntityPtr)0x0)) { isHasItem = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x248,0); if (isHasItem != 0) { isHasItem = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x2d8,0); if (isHasItem != 0) { EntityList::QuerySublist (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&queryResult,3,0xf0,-1,1,0); if (queryResult._size != 0) { foundEntity = *GHIDRA_CAST(queryResult._data); if ((*GHIDRA_CAST((GHIDRA_CAST(&(queryResult)) + 0x0))) == '\0') { local_8 = 0; tracked_alloc(1,queryResult._data,0); } ExceptionList = local_10; return foundEntity; } if ((*GHIDRA_CAST((GHIDRA_CAST(&(queryResult)) + 0x0))) == '\0') { local_8 = 1; tracked_alloc(1,queryResult._data,0); } } } orbitParent = (EntityPtr)this->_player; } ExceptionList = local_10; return GHIDRA_CAST(orbitParent); } // 00612440 int Entity_Familiar::RecalculateOrbitOffset(int layer, byte isAdd) { double dVar1; byte isHasCollectible; uint uVar2; Entity_Familiar *familiar; Entity *otherParent; Entity *ownParent; int iVar3; qword *heapBytes; uint prevCount; uint orbiterCount; uint uVar4; float orbitDistance; EntityList_EL familiarQuery; char orbiterBuffer [4]; int local_30; uint orbiterCapacity; uint orbiterSize; uint local_24; void *familiarData; Entity_Familiar *local_1c; int orbiters; char isUnicornWisp; void *local_10; undefined1 *puStack_c; undefined4 local_8; qword prevBytes; local_8 = 0xffffffff; puStack_c = &LAB_00af6945; local_10 = ExceptionList; uVar2 = __security_cookie ^ GHIDRA_UINT((orbiterBuffer + 0x30)); if ((this->_isSubtype55555 != 0) || (layer < 0)) { return 0; } if (((this->_type == 3) && (this->_variant == 0xce)) && ((this->_subtype == 0x4d || (this->_subtype == 0x12a)))) { isUnicornWisp = '\x01'; } else { isUnicornWisp = '\0'; } ExceptionList = &local_10; local_1c = this; EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&familiarQuery,3,-1,-1,0,0); iVar3 = familiarQuery._size; local_8 = 0; buffer_init(orbiterBuffer,familiarQuery._size + 1); local_8 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x1))),1); local_24 = 0; familiarData = familiarQuery._data; orbiters = local_30; orbiterCount = orbiterSize; if (iVar3 != 0) { uVar4 = familiarQuery._size; prevCount = orbiterSize; do { familiar = *GHIDRA_CAST((GHIDRA_CAST(familiarQuery._data) + local_24 * 4)); orbiterCount = prevCount; if (familiar->_exists != 0) { if (familiar != this) { familiar = (Entity_Familiar *) __RTDynamicCast(familiar,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0, uVar2); if (familiar->_orbitLayer == layer) { otherParent = get_orbit_parent(familiar); ownParent = get_orbit_parent(local_1c); if (otherParent == ownParent) { if (((familiar->_type == 3) && (familiar->_variant == 0xce)) && ((familiar->_subtype == 0x4d || (familiar->_subtype == 0x12a)))) { isUnicornWisp = '\x01'; } orbiterCount = prevCount + 1; if (orbiterCapacity < orbiterCount) { KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); } *GHIDRA_CAST((orbiters + prevCount * 4)) = familiar; orbiterSize = orbiterCount; } } uVar4 = familiarQuery._size; familiarQuery._data = familiarData; this = local_1c; } } local_24 = local_24 + 1; prevCount = orbiterCount; } while (local_24 < uVar4); } local_1c = GHIDRA_CAST(0x3f800000); if (isUnicornWisp != '\0') { local_1c = GHIDRA_CAST(0x40000000); } isHasCollectible = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x117,0); if (isHasCollectible != 0) { local_1c = GHIDRA_CAST(0x3eaaaaab); } if (isAdd != 0) { uVar2 = orbiterCount + 1; if (orbiterCapacity < uVar2) { KAGE_LogMessage(0x10,GHIDRA_CAST("EL: not enough space for push_back\n")); } *GHIDRA_CAST((orbiters + orbiterCount * 4)) = this; orbiterCount = uVar2; orbiterSize = uVar2; } if (layer < 1) { layer = 0; } uVar2 = 10; if (GHIDRA_UINT(layer) < 10) { uVar2 = layer; } uVar4 = 0; iVar3 = uVar2 * 0x14; if (orbiterCount != 0) { dVar1 = __uint_to_double_fixup[-(GHIDRA_INT(orbiterCount) >> 0x1f)]; do { local_24 = __RTDynamicCast(*GHIDRA_CAST((orbiters + uVar4 * 4)),0, &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0); *GHIDRA_CAST((local_24 + 0xd60)) = ((float)GHIDRA_INT(uVar4) * 6.2831855) / (float)((double)GHIDRA_INT(orbiterCount) + dVar1); isHasCollectible = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x70,0); if (isHasCollectible == 0) { orbitDistance = *GHIDRA_CAST((&DAT_00c34138 + iVar3)); } else { orbitDistance = *GHIDRA_CAST((&DAT_00c3413c + iVar3)) * *GHIDRA_CAST((&DAT_00c34138 + iVar3)); } *GHIDRA_CAST((local_24 + 0xd6c)) = orbitDistance * (float)local_1c; if (*GHIDRA_CAST((local_24 + 0x2c)) == 0x3c) { *GHIDRA_CAST((local_24 + 0xd6c)) = orbitDistance * (float)local_1c * 3.0; } uVar4 = uVar4 + 1; } while (uVar4 < orbiterCount); } if (orbiterBuffer[0] == '\0') { heapBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); if (g_mainHeap == (void *)0x0) { heapBytes = &g_allocatedBytesNoHeap; } if (orbiters != 0) { uVar2 = *GHIDRA_CAST((orbiters + -4)); prevBytes = *heapBytes; *GHIDRA_CAST(heapBytes) = GHIDRA_UINT(*heapBytes) - uVar2; *GHIDRA_CAST((GHIDRA_CAST(heapBytes) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(heapBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevBytes) < uVar2)); free((void *)(orbiters + -4)); } } if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiarQuery)) + 0x0))) == '\0') { if (g_mainHeap == (void *)0x0) { heapBytes = &g_allocatedBytesNoHeap; } else { heapBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); } if (familiarData != (void *)0x0) { uVar2 = *GHIDRA_CAST((GHIDRA_CAST(familiarData) + -4)); prevBytes = *heapBytes; *GHIDRA_CAST(heapBytes) = GHIDRA_UINT(*heapBytes) - uVar2; *GHIDRA_CAST((GHIDRA_CAST(heapBytes) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(heapBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevBytes) < uVar2)); free((void *)(GHIDRA_INT(familiarData) + -4)); } } ExceptionList = local_10; return orbiterCount; } // 006127b0 void Entity_Familiar::AddToOrbit(int orbitLayer) { int clampedLayer; int nonNegativeLayer; float orbitDistanceY; if (-1 < this->_orbitLayer) { RecalculateOrbitOffset(this,this->_orbitLayer,0); } this->_orbitLayer = orbitLayer; nonNegativeLayer = orbitLayer; if (orbitLayer < 1) { nonNegativeLayer = 0; } clampedLayer = 10; if (nonNegativeLayer < 10) { clampedLayer = nonNegativeLayer; } orbitDistanceY = (float)(&DAT_00c34134)[clampedLayer * 5]; (this->_orbitDistance).x = (float)(&DAT_00c34130)[clampedLayer * 5]; (this->_orbitDistance).y = orbitDistanceY; RecalculateOrbitOffset(this,orbitLayer,1); return; } // 00612820 void Entity_Familiar::RemoveFromOrbit() { if (-1 < this->_orbitLayer) { RecalculateOrbitOffset(this,this->_orbitLayer,0); this->_orbitLayer = -1; } return; } // 00612850 Vector * Entity_Familiar::GetOrbitDistance(Vector *outDistance, int layer) { int orbitLayer; float orbitDistanceY; if (layer < 1) { layer = 0; } orbitLayer = 10; if (layer < 10) { orbitLayer = layer; } orbitDistanceY = (float)(&DAT_00c34134)[orbitLayer * 5]; outDistance->x = (float)(&DAT_00c34130)[orbitLayer * 5]; outDistance->y = orbitDistanceY; return outDistance; } // 00612890 byte Entity_Familiar::is_detached_from_follow() { int iVar1; bool isDetached; if (this->_isFollower == 0) { return 0; } iVar1 = this->_variant; if (iVar1 == 3) { isDetached = this->_fireCooldown == 0; } else if (iVar1 == 0x3b) { isDetached = this->_fireCooldown == 0; } else if (iVar1 == 0x19) { isDetached = this->_fireCooldown == 0; } else if (iVar1 == 0x5d) { isDetached = this->_fireCooldown == 0; } else { if (iVar1 == 100) { if (this->_subtype == *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf38))))) { return 0; } return 1; } if (iVar1 == 0x68) { isDetached = this->_fireCooldown == 0; } else { if ((iVar1 == 0x7c) || (iVar1 == 0x81)) { if (this->_visible == 0) { return 0; } return 1; } if (iVar1 == 0x82) { if (this->_fireCooldown < 0) { return 0; } return 1; } if (iVar1 == 0xe8) { isDetached = this->_fireCooldown == 0; } else if (iVar1 == 0xdf) { isDetached = this->_fireCooldown == 0; } else { if (iVar1 != 0xf2) { return 1; } if (this->_visible == 0) { return 0; } isDetached = this->_coins == 0; } } } if (isDetached) { return 1; } return 0; } // 00612970 int Entity_Familiar::GetFollowerPriority() { switch(this->_variant) { case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 9: case 10: case 0xb: case 0xc: case 0x19: case 0x3b: case 0x4c: case 0x51: case 0x5c: case 0x5d: case 0x61: case 0x68: case 0x77: case 0x7d: case 0xd1: case 0xdc: case 0xdf: return 1; default: return 0; case 0x33: case 0x4a: case 0x59: case 0xe6: return 2; case 0x3d: case 0x6c: return 3; case 0x50: case 0xeb: return 10; case 100: return 9; case 0x6d: return 9999; case 0xe8: return 5; } } // 00612af0 byte Entity_Familiar::IsLilithBirthrightIncubus() { Entity_Player *this_00; byte isHasBirthright; void *weapon; this_00 = this->_player; weapon = this_00->_weapons[0]; if (weapon == (void *)0x0) { weapon = this_00->_weapons[1]; } if (this_00->_playerType == 0x20) { isHasBirthright = (GHIDRA_CAST((this_00)))->Entity_Player::HasCollectible(0x26b,0); if ((((isHasBirthright != 0) && (weapon != (void *)0x0)) && (*GHIDRA_CAST((GHIDRA_CAST(weapon) + 0x30)) == 0xf)) && ((this->_isFollower != 0 && (this->_isNotCountedAsFollower == 0)))) { return 1; } } return 0; } // 00612b50 Entity * Entity_Familiar::get_incubus_umbilical_whip() { byte isBirthrightIncubus; int weapon; int *umbilicalWhip; Entity *whipEntity; isBirthrightIncubus = IsLilithBirthrightIncubus(this); if (isBirthrightIncubus != 0) { weapon = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13dc)); if (weapon == 0) { weapon = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13e0)); } umbilicalWhip = GHIDRA_CAST(__RTDynamicCast(weapon,0,&IsaacRepentancePlus::Weapon::RTTI_Type_Descriptor, &IsaacRepentancePlus::Weapon_UmbilicalWhip::RTTI_Type_Descriptor,0)); if (((umbilicalWhip != GHIDRA_CAST(0x0)) && (whipEntity = GHIDRA_CAST((**(code **)(*umbilicalWhip + 0x28))()), whipEntity != GHIDRA_CAST(0x0)) ) && (whipEntity->_type == 3)) { return whipEntity; } } return GHIDRA_CAST(0x0); } // 00612bb0 void Entity_Familiar::FollowParent() { code *pcVar1; byte bVar2; char cVar3; uint uVar4; Entity *umbilicalWhip; Entity_Player *player; int iVar5; Vector *facingDir; Entity_Familiar *parentFamiliar; EntityPtr extraout_ECX; Entity_Familiar *parentFamiliar; Entity_Familiar *extraout_ECX_00; EntityPtr this_01; EntityPtr extraout_ECX_01; Entity_Familiar *this_02; Entity_Familiar *extraout_ECX_02; EntityPtr EVar6; Entity_Familiar *this_03; Entity_Familiar *extraout_ECX_03; Entity_Familiar *this_04; int extraout_ECX_04; char extraout_DL; char extraout_DL_00; int iVar7; int extraout_EDX; float extraout_EDX_00; float extraout_EDX_01; float extraout_EDX_02; float extraout_EDX_03; EntityPtr *childSlot; float fVar8; float fVar9; float fVar10; EntityPtr local_48; undefined1 query [12]; float local_38; EntityPtr local_34; float local_30; float local_2c; float local_28; char isOverrideParent; char isLilithBirthright; undefined1 *puStack_20; void *local_1c; undefined1 *puStack_18; undefined4 local_14; EntityPtr chainNext; void *playerRaw; puStack_20 = query + 0x40; local_14 = 0xffffffff; puStack_18 = &LAB_00af697d; local_1c = ExceptionList; uVar4 = __security_cookie ^ GHIDRA_UINT((query + 0x34)); if (this->_isSubtype55555 != 0) { (this->_pos).x = (this->_formationOffset).x; (this->_pos).y = (this->_formationOffset).y; (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; return; } ExceptionList = &local_1c; bVar2 = IsLilithBirthrightIncubus(this); if (bVar2 != 0) { umbilicalWhip = get_incubus_umbilical_whip(this); player = this->_player; local_34 = (EntityPtr)(player->_pos).x; local_38 = (player->_pos).y; if (umbilicalWhip != GHIDRA_CAST(0x0)) { local_30 = (float)this->_initSeed; iVar7 = 0; local_38 = 9.80909e-45; EVar6 = this->_child; if (EVar6 != (EntityPtr)0x0) { do { if (*GHIDRA_CAST((GHIDRA_CAST(EVar6) + 0x28)) == 3) { bVar2 = is_detached_from_follow(GHIDRA_CAST(EVar6)); EVar6 = extraout_ECX; iVar7 = extraout_EDX; if (bVar2 != 0) { iVar7 = extraout_EDX + 1; } } EVar6 = *GHIDRA_CAST((GHIDRA_CAST(EVar6) + 0x3c0)); } while (EVar6 != (EntityPtr)0x0); player = this->_player; } local_2c = (float)iVar7 + 5.0; bVar2 = (GHIDRA_CAST((player)))->Entity_Player::HasCollectible(0xf7,0); if (bVar2 != 0) { local_2c = local_2c * 1.5; } if (local_30 == 0.0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar4 = GHIDRA_UINT(local_30) >> 5 ^ GHIDRA_UINT(local_30); uVar4 = uVar4 << 9 ^ uVar4; local_38 = (float)(uVar4 >> (SUB41(local_38,0) & 0x1f) ^ uVar4); local_34 = (EntityPtr)0xe; if (local_38 == 0.0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar4 = GHIDRA_UINT(local_38) >> 3 ^ GHIDRA_UINT(local_38); uVar4 = uVar4 << 1 ^ uVar4; uVar4 = uVar4 >> 0xe ^ uVar4; local_34 = (EntityPtr)(umbilicalWhip->_size * 0.3); local_38 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283062e-10 * 3.14; local_30 = (float)local_34 + local_2c; local_38 = local_38 + local_38; local_2c = cos(local_38); local_2c = local_2c * local_30; fVar8 = sin(local_38); local_30 = fVar8 * local_30; iVar7 = this->_variant; if (((iVar7 == 0xd5) || (iVar7 == 0xd6)) || (iVar7 == 0xdf)) { local_2c = (float)local_34; local_30 = 0.0; } local_28 = (umbilicalWhip->_pos).x; local_48 = (EntityPtr)(umbilicalWhip->_pos).y; iVar7 = __RTDynamicCast(umbilicalWhip[3]._entityRef3._flags,0, &IsaacRepentancePlus::Entity_Familiar::ExtraData::RTTI_Type_Descriptor ,&IsaacRepentancePlus::UmbilicalBabyData::RTTI_Type_Descriptor,0); if (iVar7 == 0) { local_38 = 0.0; } else { local_38 = *GHIDRA_CAST((iVar7 + 0x154)); } local_38 = local_38 * 0.017453292; local_34 = (EntityPtr)cos(local_38); fVar8 = sin(local_38); fVar9 = (float)local_34 * local_30; local_34 = (EntityPtr)(((float)local_34 * local_2c - fVar8 * local_30) + local_28); local_38 = fVar8 * local_2c + fVar9 + (float)local_48; if ((umbilicalWhip->_type == 3) && (this->_parent == (EntityPtr)0x0)) { childSlot = &umbilicalWhip->_child; if (umbilicalWhip->_child != (EntityPtr)0x0) { local_48 = (EntityPtr)childSlot; std::multiset::erase(&local_48); } *childSlot = (EntityPtr)this; std::multiset::insert(childSlot); } } fVar8 = (this->_pos).y; (this->_velocity).x = (float)local_34 - (this->_pos).x; (this->_velocity).y = local_38 - fVar8; ExceptionList = local_1c; return; } player = this->_player; if (((player != GHIDRA_CAST(0x0)) && (local_48 = player->_spawnerEntity, local_48 != (EntityPtr)0x0)) && ((*GHIDRA_CAST((GHIDRA_CAST(local_48) + 0x28)) == 0x388 && ((*GHIDRA_CAST((GHIDRA_CAST(local_48) + 0x2c)) == 0 && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(player))))->Entity::HasEntityFlags(0x400000), bVar2 != 0)))))) { NpcHelper::siren_familiar_orbit(GHIDRA_CAST(local_48),this); goto LAB_006138df; } bVar2 = (GHIDRA_CAST((player)))->Entity_Player::HasTrinket(0xb3,0); if (bVar2 != 0) { predict_player_movement(this); ExceptionList = local_1c; return; } bVar2 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x6d,0); if (bVar2 != 0) { move_to_parent_offset(this); ExceptionList = local_1c; return; } if (((this->_formationOffset).x != g_vectorZero.x) || ((this->_formationOffset).y != g_vectorZero.y)) { reset_follow_target(this,uVar4); } EVar6 = this->_parent; isOverrideParent = '\0'; if ((g_game->_challenge == 0x1e) && (this->_variant == 0x3e)) { EntityList::QuerySublist (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(query),3,0x43,-1,0,0); if (local_38 != 0.0) { isOverrideParent = '\x01'; EVar6 = *(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(query))) + 0x4))); } (GHIDRA_CAST((query)))->EntityList_Query::~EntityList_Query(); } local_48 = EVar6; if ((this->_player->_playerType == 0xd) && (bVar2 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x26b,0), bVar2 != 0)) { isLilithBirthright = '\x01'; cVar3 = FUN_00612ad0(); if (cVar3 != '\0') { EVar6 = this->_parent; fVar8 = 0.0; local_34 = (EntityPtr)this->_player; iVar7 = 0; local_30 = 0.0; for (; EVar6 != (EntityPtr)0x0; EVar6 = (GHIDRA_CAST(EVar6))->_parent) { if (*GHIDRA_CAST((GHIDRA_CAST(EVar6) + 0x28)) == 3) { if (*GHIDRA_CAST((GHIDRA_CAST(EVar6) + 0x2c)) == 0x6d) { local_34 = EVar6; break; } bVar2 = is_detached_from_follow(GHIDRA_CAST(EVar6)); EVar6 = (EntityPtr)parentFamiliar; fVar8 = extraout_EDX_00; if (bVar2 != 0) { iVar5 = GetFollowerPriority(parentFamiliar); EVar6 = (EntityPtr)extraout_ECX_00; fVar8 = extraout_EDX_01; if ((0 < iVar5) && (extraout_ECX_00->_isNotCountedAsFollower == SUB41(extraout_EDX_01,0))) { iVar7 = iVar7 + 1; } } } } EVar6 = this->_child; if (EVar6 != (EntityPtr)0x0) { do { if (*GHIDRA_CAST((GHIDRA_CAST(EVar6) + 0x28)) == 3) { bVar2 = is_detached_from_follow(GHIDRA_CAST(EVar6)); EVar6 = this_01; fVar8 = extraout_EDX_02; if (bVar2 != 0) { iVar5 = GetFollowerPriority(GHIDRA_CAST(this_01)); EVar6 = extraout_ECX_01; fVar8 = extraout_EDX_03; if ((0 < iVar5) && (*GHIDRA_CAST((GHIDRA_CAST(extraout_ECX_01) + 0xd76)) == '\0')) { fVar8 = (float)(GHIDRA_INT(extraout_EDX_03) + 1); } } } EVar6 = *GHIDRA_CAST((GHIDRA_CAST(EVar6) + 0x3c0)); } while (EVar6 != (EntityPtr)0x0); local_30 = fVar8; } playerRaw = this->_player; local_48 = (EntityPtr)(iVar7 + GHIDRA_INT(fVar8)); iVar7 = GHIDRA_INT(local_48) + 1; local_28 = *GHIDRA_CAST((GHIDRA_CAST(playerRaw) + 0x1630)); local_2c = *GHIDRA_CAST((GHIDRA_CAST(playerRaw) + 0x1634)); if ((local_28 == g_vectorZero.x) && (local_2c == g_vectorZero.y)) { facingDir = Isaac::GetAxisAlignedUnitVectorFromDir (GHIDRA_CAST((query + 8)),*GHIDRA_CAST((GHIDRA_CAST(playerRaw) + 0x1628))); local_28 = facingDir->x; local_2c = facingDir->y; fVar8 = local_30; } if (1 < iVar7) { fVar10 = (float)iVar7 * 5.0 + 15.0; fVar9 = 179.0; if (fVar10 <= 179.0) { fVar9 = fVar10; } if ((GHIDRA_UINT(local_30) & 1) != 0) { fVar9 = -fVar9; } local_30 = ((fVar9 * (float)GHIDRA_INT(((iVar7 - (GHIDRA_INT(fVar8) - (GHIDRA_INT(fVar8) >> 0x1f) & 0xfffffffeU) ) + -1))) / (float)GHIDRA_INT(local_48)) * 0.017453292; local_48 = (EntityPtr)cos(local_30); fVar8 = sin(local_30); fVar9 = fVar8 * local_28; local_28 = (float)local_48 * local_28 - fVar8 * local_2c; local_2c = (float)local_48 * local_2c + fVar9; } local_48 = *GHIDRA_CAST((GHIDRA_CAST(local_34) + 0x33c)); local_38 = *GHIDRA_CAST((GHIDRA_CAST(local_34) + 0x340)); fVar8 = sqrtf(local_28 * local_28 + local_2c * local_2c); if (0.0 < fVar8) { fVar8 = (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x370)) + 20.0) / fVar8; local_2c = fVar8 * local_2c; local_28 = fVar8 * local_28; } fVar8 = (this->_pos).y; (this->_velocity).x = (((float)local_48 + local_28) - (this->_pos).x) * 0.4; (this->_velocity).y = ((local_38 + local_2c) - fVar8) * 0.4; goto LAB_006138df; } } else { isLilithBirthright = '\0'; } bVar2 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x94,0); if ((bVar2 != 0) && (this->_variant != 0x6d)) { local_34 = (EntityPtr)this->_player; iVar7 = 0; EVar6 = this->_parent; local_30 = 0.0; for (; EVar6 != (EntityPtr)0x0; EVar6 = (GHIDRA_CAST(EVar6))->_parent) { if (*GHIDRA_CAST((GHIDRA_CAST(EVar6) + 0x28)) == 3) { if (*GHIDRA_CAST((GHIDRA_CAST(EVar6) + 0x2c)) == 0x6d) { local_34 = EVar6; break; } bVar2 = is_detached_from_follow(GHIDRA_CAST(EVar6)); EVar6 = (EntityPtr)this_02; if (bVar2 != 0) { if (extraout_DL != '\0') { iVar5 = GetFollowerPriority(this_02); EVar6 = (EntityPtr)extraout_ECX_02; if ((0 < iVar5) && (extraout_ECX_02->_isNotCountedAsFollower == 0)) goto LAB_00613385; } local_30 = (float)(GHIDRA_INT(local_30) + 1); } } LAB_00613385: } EVar6 = this->_child; do { if (EVar6 == (EntityPtr)0x0) { local_48 = (EntityPtr)(GHIDRA_INT(local_30) + 1 + iVar7); this->_orbitSpeed = 3.5; iVar5 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetTrinketMultiplier(0x94); fVar8 = this->_orbitSpeed; if (2 < iVar5) { fVar8 = fVar8 * 1.5; this->_orbitSpeed = fVar8; } iVar5 = g_game->_frameCount; (this->_orbitDistance).x = 65.0; (this->_orbitDistance).y = 60.0; local_30 = (((float)iVar7 * 360.0) / (float)GHIDRA_INT(local_48) + (float)iVar5 * fVar8) - this->_orbitAngleOffset; bVar2 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x59,0); if (bVar2 != 0) { (this->_orbitDistance).x = (this->_orbitDistance).x * 0.5; (this->_orbitDistance).y = (this->_orbitDistance).y * 0.5; } local_30 = local_30 * 0.017453292; fVar8 = cos(local_30); EVar6 = local_34; local_34 = (EntityPtr) ((fVar8 * (this->_orbitDistance).x + *GHIDRA_CAST((GHIDRA_CAST(local_34) + 0x33c))) - (this->_pos).x); fVar8 = sin(local_30); local_48 = (EntityPtr) ((fVar8 * (this->_orbitDistance).y + *GHIDRA_CAST((GHIDRA_CAST(EVar6) + 0x340))) - (this->_pos).y); fVar8 = sqrtf((float)local_48 * (float)local_48 + (float)local_34 * (float)local_34); if (fVar8 <= 20.0) { (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; } else { fVar8 = ((fVar8 - 20.0) * 0.1) / fVar8; fVar9 = fVar8 * (float)local_48; fVar8 = fVar8 * (float)local_34; if ((this->_flags & 0x20000000000) != 0) { fVar8 = fVar8 * 5.0; fVar9 = fVar9 * 5.0; } (this->_velocity).x = fVar8; (this->_velocity).y = fVar9; } if (*GHIDRA_CAST((GHIDRA_CAST(EVar6) + 0x28)) == 1) { fVar8 = 1.5; } else { fVar8 = 1.0; } fVar9 = *GHIDRA_CAST((GHIDRA_CAST(EVar6) + 0x360)); (this->_velocity).y = fVar8 * *GHIDRA_CAST((GHIDRA_CAST(EVar6) + 0x364)) + (this->_velocity).y; (this->_velocity).x = fVar8 * fVar9 + (this->_velocity).x; ExceptionList = local_1c; return; } if (*GHIDRA_CAST((GHIDRA_CAST(EVar6) + 0x28)) == 3) { bVar2 = is_detached_from_follow(GHIDRA_CAST(EVar6)); EVar6 = (EntityPtr)this_03; if (bVar2 != 0) { if (extraout_DL_00 != '\0') { iVar5 = GetFollowerPriority(this_03); EVar6 = (EntityPtr)extraout_ECX_03; if ((0 < iVar5) && (extraout_ECX_03->_isNotCountedAsFollower == 0)) goto LAB_006133c6; } iVar7 = iVar7 + 1; } } LAB_006133c6: EVar6 = (GHIDRA_CAST(EVar6))->_child; } while( true ); } (this->_orbitDistance).x = g_vectorZero.x; (this->_orbitDistance).y = g_vectorZero.y; if (isOverrideParent == '\0') { for (; EVar6 != (EntityPtr)0x0; EVar6 = *GHIDRA_CAST((GHIDRA_CAST(EVar6) + 0x3bc))) { parentFamiliar = (Entity_Familiar *) __RTDynamicCast(EVar6,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0); if (parentFamiliar == GHIDRA_CAST(0x0)) goto LAB_0061378a; bVar2 = is_detached_from_follow(parentFamiliar); if ((bVar2 != 0) || (((isLilithBirthright != '\0' && (iVar7 = GetFollowerPriority(this_04), 0 < iVar7)) && (*GHIDRA_CAST((extraout_ECX_04 + 0xd76)) == '\0')))) goto LAB_0061378a; } LAB_00613692: if (this->_variant != 0x6d) { EntityList::QuerySublist (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(query),3,0x6d,-1,1,0); local_14 = 0; local_30 = 0.0; if (local_38 != 0.0) { LAB_006136d5: iVar7 = __RTDynamicCast(*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(query)) + 0x4))) + local_30 * 4)),0, &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0); if (((*GHIDRA_CAST((iVar7 + 0x172)) == '\0') || (*(void **)(iVar7 + 0x410) != this->_player)) || (*GHIDRA_CAST((iVar7 + 0x3bc)) != this->_parent)) goto LAB_00613716; EVar6 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(query)) + 0x4))) + local_30 * 4)); for (chainNext = *GHIDRA_CAST((GHIDRA_INT(*GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(query)) + 0x4))) + local_30 * 4))) + 0x3c0)); ((chainNext != (EntityPtr)0x0 && (*GHIDRA_CAST((GHIDRA_CAST(chainNext) + 0x28)) == 3)) && (*GHIDRA_CAST((GHIDRA_CAST(chainNext) + 0x2c)) == 0x6d)); chainNext = *GHIDRA_CAST((GHIDRA_CAST(chainNext) + 0x3c0))) { EVar6 = chainNext; } } LAB_0061375a: local_14 = 0xffffffff; (GHIDRA_CAST((query)))->EntityList_Query::~EntityList_Query(); if (EVar6 != (EntityPtr)0x0) goto LAB_0061378a; } local_30 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); local_28 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); } else { EVar6 = local_48; if (local_48 == (EntityPtr)0x0) goto LAB_00613692; LAB_0061378a: local_30 = *GHIDRA_CAST((GHIDRA_CAST(EVar6) + 0x33c)); local_28 = *GHIDRA_CAST((GHIDRA_CAST(EVar6) + 0x340)); } local_2c = 20.0; if (this->_variant == 100) { local_2c = 10.0; } bVar2 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x59,0); if (bVar2 != 0) { local_2c = 5.0; } local_38 = (this->_pos).y - local_28; local_34 = (EntityPtr)((this->_pos).x - local_30); fVar8 = sqrtf(local_38 * local_38 + (float)local_34 * (float)local_34); if (fVar8 <= 0.0) { local_48 = local_34; } else { local_38 = (local_2c / fVar8) * local_38; local_48 = (EntityPtr)((local_2c / fVar8) * (float)local_34); } fVar9 = local_30 - (this->_pos).x; local_48 = (EntityPtr)(local_30 + (float)local_48); fVar8 = local_28 - (this->_pos).y; local_38 = local_28 + local_38; fVar8 = sqrtf(fVar8 * fVar8 + fVar9 * fVar9); if (local_2c < fVar8) { fVar9 = (this->_pos).y; fVar8 = ((fVar8 - local_2c) / fVar8) * 0.2; (this->_velocity).x = ((float)local_48 - (this->_pos).x) * fVar8; (this->_velocity).y = (local_38 - fVar9) * fVar8; } LAB_006138df: this->_friction = this->_friction * 0.8; ExceptionList = local_1c; return; LAB_00613716: local_30 = (float)(GHIDRA_INT(local_30) + 1); if (GHIDRA_UINT(local_38) <= GHIDRA_UINT(local_30)) goto LAB_0061375a; goto LAB_006136d5; } // 00613910 void Entity_Familiar::FollowPosition(Vector *position) { float posX; float posY; float targetX; float targetY; if (this->_isSubtype55555 == 0) { targetX = position->x; targetY = position->y; posX = (this->_pos).x; posY = (this->_pos).y; this->_friction = this->_friction * 0.8; (this->_velocity).x = (targetX - posX) * 0.1; (this->_velocity).y = (targetY - posY) * 0.1; return; } (this->_pos).x = (this->_formationOffset).x; (this->_pos).y = (this->_formationOffset).y; (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; return; } // 006139b0 Vector * Entity_Familiar::GetOrbitPosition(Vector *outPosition, Vector *offset) { byte bVar1; Vector *followPos; uint framePhase; LayerState *layer; int clampedLayer; int iVar2; float fVar3; float cosAngle; Vector scratchVec; float layerAngleOffset; if (this->_isSubtype55555 != 0) { fVar3 = (this->_formationOffset).y; outPosition->x = (this->_formationOffset).x; outPosition->y = fVar3; return outPosition; } bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x6d,0); if ((bVar1 != 0) && (this->_variant != 0x2b)) { followPos = UpdateFollowPosition(this,&scratchVec); outPosition->x = followPos->x + offset->x; outPosition->y = followPos->y + offset->y; return outPosition; } if (((this->_formationOffset).x != g_vectorZero.x) || ((this->_formationOffset).y != g_vectorZero.y)) { reset_follow_target(this); } framePhase = g_manager->_framecount & 0x80000001; if (GHIDRA_INT(framePhase) < 0) { framePhase = (framePhase - 1 | 0xfffffffe) + 1; } fVar3 = fmodf(this->_orbitAngleOffset - ((float)GHIDRA_INT(framePhase) * 0.5 + (float)g_game->_frameCount) * this->_orbitSpeed * 3.1415927 * 0.5,6.2831855); iVar2 = this->_variant; if (iVar2 == 0x23) { bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST("Rotation"),1); if (((bVar1 != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) && ((GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::SetFrameFloat(6.0), (this->_sprite)._animState._animData != (void *)0x0)) { (this->_sprite)._animState._isPlaying = 0; } scratchVec.x = (fVar3 * 180.0) / 3.1415927; layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); layer->_rotation = scratchVec.x; iVar2 = this->_variant; } if (iVar2 == 0x7e) { layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); layer->_rotation = (fVar3 * 180.0) / 3.1415927; } iVar2 = this->_orbitLayer; if (iVar2 < 0) { fVar3 = offset->y; outPosition->x = offset->x; outPosition->y = fVar3; return outPosition; } if (iVar2 < 1) { iVar2 = 0; } clampedLayer = 10; if (iVar2 < 10) { clampedLayer = iVar2; } layerAngleOffset = (float)(&DAT_00c34140)[clampedLayer * 5]; cosAngle = cos(fVar3 + layerAngleOffset); outPosition->x = cosAngle * (this->_orbitDistance).x + offset->x; fVar3 = sin(fVar3 + layerAngleOffset); outPosition->y = fVar3 * (this->_orbitDistance).y + offset->y; return outPosition; } // 00613c20 Entity_Laser * Entity_Familiar::fire_robo_baby_laser(Vector *direction) { byte bVar1; Entity_Tear *tear; float fVar2; float offsetY; int timeout; Vector *posOffset; Entity_Familiar *source; Vector laserOffset; Color laserColor; uint local_c; undefined1 auStack_8 [4]; local_c = __security_cookie ^ GHIDRA_UINT((auStack_8 + 4)); if (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x173)) != '\0') { return GHIDRA_CAST(0x0); } fVar2 = direction->x; laserOffset.y = -23.0; laserOffset.x = (fVar2 + fVar2) - direction->y * 9.0; offsetY = -8.0 - (fVar2 + fVar2); if (this->_variant == 0xce) { laserOffset.y = -18.0; laserOffset.x = g_vectorZero.x; offsetY = g_vectorZero.y; } laserOffset.y = laserOffset.y + offsetY; bVar1 = 0; laserOffset.x = laserOffset.x + 0.0; posOffset = &laserOffset; timeout = 3; source = this; fVar2 = atan2f(direction->y,fVar2); tear = (Entity_Tear *) Entity_Laser::ShootAngle (2,&this->_pos,fVar2 * 57.295776,timeout,posOffset,GHIDRA_CAST(source),bVar1); *GHIDRA_CAST((GHIDRA_INT(&(tear->_tearHaloANM2)._overlayAnimState._currentlyTriggeredEvents) + 1)) = 1; *GHIDRA_CAST(&(tear->_tearHaloANM2)._animState._layerFrames) = 1; fVar2 = apply_tear_modifiers(this); tear->SetCollisionDamage(fVar2 * 3.5); if ((direction->y <= -0.5 && direction->y != -0.5) || (direction->x <= -0.5 && direction->x != -0.5)) { fVar2 = -10.0; } else { fVar2 = 3000.0; } tear->_renderDepthOffset = fVar2; (GHIDRA_CAST((&laserColor)))->Color::Color(); if (this->_isLilDelirium != 0) { laserColor._tint[0] = 0.2; laserColor._tint[1] = 1.0; laserColor._tint[2] = 0.0; laserColor._tint[3] = 1.0; laserColor._offset[2] = 0.0; laserColor._colorize[0] = 0.0; laserColor._colorize[1] = 0.0; laserColor._colorize[2] = 0.0; laserColor._colorize[3] = 0.0; laserColor._offset[0] = 1.0; laserColor._offset[1] = 1.0; } if (this->_player != GHIDRA_CAST(0x0)) { bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::IsHologram(); if (bVar1 != 0) { laserColor._tint[3] = 0.25; } } tear->SetColor(&laserColor,0xffffffff,0xff,0,1); tear->Update(); apply_baby_bender(this,tear); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); return GHIDRA_CAST(tear); } // 00613df0 void Entity_Familiar::PlayFloatAnim(int direction) { char cVar1; uint uVar2; LayerState *layer; int *texture; byte *anim; char *anim_00; undefined1 textureRef [4]; int *textureImage; void *local_10; undefined1 *puStack_c; undefined4 local_8; int variant; local_8 = 0xffffffff; puStack_c = &LAB_00af69ad; local_10 = ExceptionList; uVar2 = __security_cookie ^ GHIDRA_UINT((textureRef + 0x18)); variant = this->_variant; if (variant == 0x58) { return; } if (variant == 0xce) { ExceptionList = &local_10; layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); texture = (GHIDRA_CAST((layer)))->LayerState::GetTexture(textureRef); local_8 = 0; anim = s_Idle2; if (*GHIDRA_CAST((*texture + 0x10)) < 0x81) { anim = s_Idle; } (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(anim,0); local_8 = 1; if (textureImage == GHIDRA_CAST(0x0)) { ExceptionList = local_10; return; } cVar1 = (**(code **)(*textureImage + 0xc))(uVar2); if (cVar1 == '\0') { ExceptionList = local_10; return; } if (g_imageReleaseFn == (void *)0x0) { ExceptionList = local_10; return; } (*g_imageReleaseFn)(textureRef); ExceptionList = local_10; return; } if (variant == 0xed) { ExceptionList = &local_10; (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(s_Idle,0); ExceptionList = local_10; return; } if (variant == 0xee) { return; } ExceptionList = &local_10; (this->_sprite)._flipX = 0; if (variant == 0x4c) { anim_00 = "Float"; } else if ((variant == 6) || (variant == 0x35)) { switch(direction) { case 0: anim_00 = "FloatSide2"; break; case 1: switchD_00613f56_caseD_1: anim_00 = "FloatUp"; break; case 2: goto switchD_00613f56_caseD_2; case 3: switchD_00613f56_caseD_3: anim_00 = "FloatDown"; break; default: goto switchD_00613f25_default; } } else if ((variant == 0x6d) && (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x162c)) != -1)) { switch(direction) { case 0: (this->_sprite)._flipX = 1; case 2: anim_00 = "StoppedSide"; break; case 1: anim_00 = "StoppedUp"; break; case 3: anim_00 = "StoppedDown"; break; default: goto switchD_00613f25_default; } } else { switch(direction) { case 0: (this->_sprite)._flipX = 1; break; case 1: goto switchD_00613f56_caseD_1; case 2: break; case 3: goto switchD_00613f56_caseD_3; default: goto switchD_00613f25_default; } switchD_00613f56_caseD_2: anim_00 = "FloatSide"; } (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST(anim_00),0); switchD_00613f25_default: ExceptionList = local_10; return; } // 00613fe0 void Entity_Familiar::AddToDelayed() { uint uVar1; int parentFamiliar; Entity_Familiar *otherFamiliar; void *familiarData; qword *allocatedBytes; uint i; EntityPtr *parentSlot; bool isSameOwner; EntityList_EL familiars; EntityPtr *erasedSlot; void *local_10; undefined1 *puStack_c; undefined4 local_8; Game *game; qword prevAllocatedBytes; EntityPtr tmpEntity; local_8 = 0xffffffff; puStack_c = &LAB_00af69dd; local_10 = ExceptionList; uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; if (this->_isSubtype55555 != 0) { return; } ExceptionList = &local_10; if ((this->_isDelayed != 0) && (tmpEntity = this->_parent, tmpEntity != (EntityPtr)0x0)) { if (*GHIDRA_CAST((GHIDRA_CAST(tmpEntity) + 0x28)) == 3) { parentFamiliar = __RTDynamicCast(tmpEntity,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0,uVar1); if ((parentFamiliar == 0) || (*GHIDRA_CAST((parentFamiliar + 0xd75)) == '\0')) goto LAB_00614095; isSameOwner = this->_player == *(void **)(parentFamiliar + 0x410); } else { if (*GHIDRA_CAST((GHIDRA_CAST(tmpEntity) + 0x28)) != 1) goto LAB_00614095; isSameOwner = tmpEntity == (EntityPtr)this->_player; } if (isSameOwner) { KAGE_LogMessage(1,GHIDRA_CAST("[warn] Tried to add familiar %d to delayed again!\n")); ExceptionList = local_10; return; } } LAB_00614095: game = g_game; this->_isDelayed = 1; EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)),&familiars,3,-1,-1,0,0); i = 0; local_8 = 0; if (familiars._size != 0) { familiarData = familiars._data; do { tmpEntity = *GHIDRA_CAST((GHIDRA_CAST(familiarData) + i * 4)); if (((*GHIDRA_CAST((GHIDRA_CAST(tmpEntity) + 0x28)) == 3) && (*GHIDRA_CAST((GHIDRA_CAST(tmpEntity) + 0x172)) != '\0')) && (*GHIDRA_CAST((GHIDRA_CAST(tmpEntity) + 0x3c0)) == 0)) { otherFamiliar = (Entity_Familiar *) __RTDynamicCast(tmpEntity,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0,uVar1); if (((otherFamiliar != GHIDRA_CAST(0x0)) && (otherFamiliar->_isDelayed != 0)) && ((this->_player == otherFamiliar->_player && (otherFamiliar != this)))) { parentSlot = GHIDRA_CAST((GHIDRA_INT(tmpEntity) + 0x3c0)); if (*GHIDRA_CAST((GHIDRA_CAST(tmpEntity) + 0x3c0)) != 0) { erasedSlot = parentSlot; std::multiset::erase(&erasedSlot); } *parentSlot = (EntityPtr)this; std::multiset::insert(parentSlot); parentSlot = &this->_parent; if (this->_parent != (EntityPtr)0x0) { erasedSlot = parentSlot; std::multiset::erase(&erasedSlot); } *parentSlot = tmpEntity; std::multiset::insert(parentSlot); break; } familiarData = familiars._data; } i = i + 1; } while (i < GHIDRA_UINT(familiars._size)); } if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x0))) == '\0') { if (g_mainHeap == (void *)0x0) { allocatedBytes = &g_allocatedBytesNoHeap; } else { allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); } if (familiars._data != (void *)0x0) { uVar1 = *GHIDRA_CAST((GHIDRA_CAST(familiars._data) + -4)); prevAllocatedBytes = *allocatedBytes; *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar1; *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevAllocatedBytes) < uVar1)); free(GHIDRA_CAST((GHIDRA_INT(familiars._data) + -4))); } } ExceptionList = local_10; return; } // 006141e0 void Entity_Familiar::RemoveFromDelayed() { EntityPtr EVar1; EntityPtr parentChildSlot; EntityPtr local_10; EntityPtr local_c; EntityPtr local_8; EntityPtr *childSlot; EntityPtr *parentSlot; if (this->_isDelayed != 0) { EVar1 = this->_parent; parentSlot = &this->_parent; if (EVar1 != (EntityPtr)0x0) { parentChildSlot = (EntityPtr)(GHIDRA_INT(EVar1) + 0x3c0); local_c = this->_child; if (*GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x3c0)) != 0) { local_8 = parentChildSlot; std::multiset::erase(&local_8); } *GHIDRA_CAST(parentChildSlot) = local_c; if (local_c != (EntityPtr)0x0) { std::multiset::insert(parentChildSlot); } } EVar1 = this->_child; childSlot = &this->_child; if (EVar1 != (EntityPtr)0x0) { local_8 = (EntityPtr)(GHIDRA_INT(EVar1) + 0x3bc); local_10 = *parentSlot; if (*GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x3bc)) != 0) { local_c = local_8; std::multiset::erase(&local_c); } *GHIDRA_CAST(local_8) = local_10; if (local_10 != (EntityPtr)0x0) { std::multiset::insert(local_8); } } if (*parentSlot != (EntityPtr)0x0) { local_10 = (EntityPtr)parentSlot; std::multiset::erase(&local_10); } *parentSlot = (EntityPtr)0x0; if (*childSlot != (EntityPtr)0x0) { local_10 = (EntityPtr)childSlot; std::multiset::erase(&local_10); } *childSlot = (EntityPtr)0x0; } this->_isDelayed = 0; return; } // 006142e0 void Entity_Familiar::PlayChargeAnim(int direction) { byte bVar1; int iVar2; byte *****animNameBuf; uint size; int chargeFrame; float chargeFrameFloat; char *anim; undefined1 auStack_44 [4]; int *fireCooldown; uint chargeNamePos; byte *****local_38; undefined4 uStack_34; undefined4 uStack_30; undefined4 uStack_2c; uint local_28; uint uStack_24; undefined4 uStack_20; undefined4 uStack_1c; undefined4 local_18; int frameMod5; int local_10; uint local_c; void *animData; byte *****animNameBuf; Game *game; local_c = __security_cookie ^ GHIDRA_UINT(auStack_44); fireCooldown = &this->_fireCooldown; (this->_sprite)._flipX = 0; animData = (this->_sprite)._animState._animData; chargeFrameFloat = 1.0 - (float)*fireCooldown / 30.0; if (animData == (void *)0x0) { chargeFrameFloat = chargeFrameFloat * 0.0; local_38 = GHIDRA_CAST(0x0); uStack_24 = 0xf; local_28 = 0; } else { chargeFrameFloat = chargeFrameFloat * (float)*GHIDRA_CAST((GHIDRA_CAST(animData) + 0x30)); (GHIDRA_CAST((GHIDRA_CAST(&local_38))))->std::string::string(animData); } animNameBuf = local_38; chargeFrame = GHIDRA_INT(chargeFrameFloat); animNameBuf = GHIDRA_CAST(&local_38); if (0xf < uStack_24) { animNameBuf = local_38; } chargeNamePos = std::string::find(GHIDRA_CAST(animNameBuf),local_28,0,GHIDRA_CAST("Charge"),6); if (0xf < uStack_24) { size = uStack_24 + 1; animNameBuf = animNameBuf; if (0xfff < size) { animNameBuf = GHIDRA_CAST(animNameBuf[-1]); size = uStack_24 + 0x24; if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(animNameBuf) + (-4 - GHIDRA_INT(animNameBuf))))) { /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(animNameBuf,size); } local_28 = 0; uStack_24 = 0xf; if (chargeNamePos == 0xffffffff) { chargeFrame = 0; } local_38 = GHIDRA_CAST((GHIDRA_UINT(local_38) & 0xffffff00)); switch(direction) { case 0: (this->_sprite)._flipX = 1; case 2: anim = "FloatChargeSide"; break; case 1: anim = "FloatChargeUp"; break; case 3: anim = "FloatChargeDown"; break; default: goto switchD_006143f4_default; } bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST(anim),1); if (((bVar1 != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) && ((GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::SetFrameFloat((float)chargeFrame), (this->_sprite)._animState._animData != (void *)0x0)) { (this->_sprite)._animState._isPlaying = 0; } switchD_006143f4_default: game = g_game; animData = (this->_sprite)._animState._animData; if (animData == (void *)0x0) { iVar2 = 0; } else { iVar2 = *GHIDRA_CAST((GHIDRA_CAST(animData) + 0x30)); } if (((iVar2 <= chargeFrame) && (*fireCooldown < 0)) && (((this->_flags & 0x4000) == 0 && ((bVar1 = (GHIDRA_CAST((g_game)))->Game::IsPaused(), bVar1 == 0 && (frameMod5 = game->_frameCount % 5, frameMod5 == 0)))))) { local_18 = 0x3e48c8ca; local_28 = 0; uStack_24 = 0; uStack_20 = 0; uStack_1c = 0; local_38 = GHIDRA_CAST(0x3f800000); uStack_34 = 0x3f000000; uStack_30 = 0x3f000000; uStack_2c = 0x3f800000; local_10 = frameMod5; this->SetColor(&local_38,2,0,1,1); } return; } // 00614500 void Entity_Familiar::PlayShootAnim(int direction) { char cVar1; byte isAnimSet; uint uVar2; LayerState *layer; int *texture; char *animName; undefined1 textureRef [4]; int *textureImage; void *local_10; undefined1 *puStack_c; undefined4 local_8; int variant; local_8 = 0xffffffff; puStack_c = &LAB_00af69ad; local_10 = ExceptionList; uVar2 = __security_cookie ^ GHIDRA_UINT((textureRef + 0x18)); variant = this->_variant; if (variant == 0xce) { ExceptionList = &local_10; layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); texture = (GHIDRA_CAST((layer)))->LayerState::GetTexture(textureRef); local_8 = 0; animName = "Shoot2"; if (*GHIDRA_CAST((*texture + 0x10)) < 0x81) { animName = "Shoot"; } (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST(animName),0); local_8 = 1; if (textureImage == GHIDRA_CAST(0x0)) { ExceptionList = local_10; return; } cVar1 = (**(code **)(*textureImage + 0xc))(uVar2); if (cVar1 == '\0') { ExceptionList = local_10; return; } if (g_imageReleaseFn == (void *)0x0) { ExceptionList = local_10; return; } (*g_imageReleaseFn)(textureRef); ExceptionList = local_10; return; } if (variant == 0xed) { ExceptionList = &local_10; (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST("Shoot"),0); ExceptionList = local_10; return; } if (variant == 0xee) { return; } ExceptionList = &local_10; (this->_sprite)._flipX = 0; if (variant == 0x4c) { animName = "Shoot"; } else if ((variant == 6) || (variant == 0x35)) { switch(direction) { case 0: animName = "FloatShootSide2"; break; case 1: goto switchD_00614663_caseD_1; case 2: goto switchD_00614663_caseD_2; case 3: goto switchD_00614663_caseD_3; default: goto switchD_00614663_default; } } else { if (variant == 0x58) { isAnimSet = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST("Level3Shoot"),1); if (isAnimSet != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } if (direction == 0) { (this->_sprite)._flipX = 1; ExceptionList = local_10; return; } ExceptionList = local_10; return; } switch(direction) { case 0: (this->_sprite)._flipX = 1; case 2: switchD_00614663_caseD_2: animName = "FloatShootSide"; break; case 1: switchD_00614663_caseD_1: animName = "FloatShootUp"; break; case 3: switchD_00614663_caseD_3: animName = "FloatShootDown"; break; default: goto switchD_00614663_default; } } (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST(animName),0); switchD_00614663_default: ExceptionList = local_10; return; } // 00614b10 void Entity_Familiar::Shoot() { byte bVar1; char isLastRef; uint uVar2; Vector *AimDirection; int iVar3; LayerState *layer; int *texturePtr; EntityPtr EVar4; byte *anim; int iVar5; float sinAngle; Vector local_4c; Vector aimDir; Vector local_3c; undefined1 texture [4]; EntityPtr local_30; float local_2c; int fireDirection; int fireDelay; undefined1 *puStack_20; void *local_1c; undefined1 *puStack_18; undefined4 local_14; char *floatAnim; void *player; puStack_20 = texture + 0x30; local_14 = 0xffffffff; puStack_18 = &LAB_00af6a0d; local_1c = ExceptionList; uVar2 = __security_cookie ^ GHIDRA_UINT((texture + 0x24)); if (this->_player->_dead != 0) { return; } ExceptionList = &local_1c; if (0 < this->_fireCooldown) { this->_fireCooldown = this->_fireCooldown + -1; } bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x8d,0); if ((bVar1 != 0) && (0 < this->_fireCooldown)) { this->_fireCooldown = this->_fireCooldown + -1; } iVar5 = this->_variant; fireDelay = 0x16; if (iVar5 == 0x4a) { fireDelay = 0xb; } if ((iVar5 == 1) || (iVar5 == 8)) { fireDelay = 0x10; } if (iVar5 == 0x51) { fireDelay = 0x2c; } if ((this->_flags & 0x100) != 0) { fireDelay = GHIDRA_INT(((float)fireDelay * 1.4)); } local_2c = -NAN; if (iVar5 == 0xf4) { fireDelay = 0xb; } else if (iVar5 == 0x4a) { local_2c = (float)this->_subtype; } if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (iVar5 == 0x36)) { fireDelay = 0x21; } iVar3 = fireDelay; player = this->_player; fireDirection = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x162c)); if (fireDirection == -1) { if (((-1 < this->_headFrameDelay) && (iVar3 = this->_headFrameDelay + -1, this->_headFrameDelay = iVar3, iVar3 < 0)) && (iVar5 != 0x58)) { if (iVar5 == 0xce) { layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); texturePtr = (GHIDRA_CAST((layer)))->LayerState::GetTexture(texture); local_14 = 0; anim = s_Idle2; if (*GHIDRA_CAST((*texturePtr + 0x10)) < 0x81) { anim = s_Idle; } (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(anim,0); local_14 = 1; if (((local_30 != (EntityPtr)0x0) && (isLastRef = (**(code **)(*GHIDRA_CAST(local_30) + 0xc))(uVar2), isLastRef != '\0')) && (g_imageReleaseFn != (void *)0x0)) { (*g_imageReleaseFn)(texture); ExceptionList = local_1c; return; } } else { if (iVar5 == 0xed) { (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(s_Idle,0); ExceptionList = local_1c; return; } if (iVar5 != 0xee) { (this->_sprite)._flipX = 0; if (iVar5 == 0x4c) { floatAnim = "Float"; } else if (((iVar5 == 6) || (iVar5 == 0x35)) || ((iVar5 != 0x6d || (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x162c)) == -1)))) { floatAnim = "FloatDown"; } else { floatAnim = "StoppedDown"; } (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST(floatAnim),0); } } } ExceptionList = local_1c; return; } local_4c.x = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x33c)) - (this->_pos).x; local_4c.y = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x340)) - (this->_pos).y; if ((iVar5 == 8) || (iVar5 == 0xf4)) { if (ABS(local_4c.x) <= ABS(local_4c.y)) { fireDirection = GHIDRA_UINT((0.0 <= local_4c.y)) * 2 + 1; } else { fireDirection = 2; if (local_4c.x < 0.0) { fireDirection = 0; } } } Isaac::GetAxisAlignedUnitVectorFromDir(&aimDir,fireDirection); bVar1 = TryAimAtMarkedTarget(this,&aimDir,&fireDirection,GHIDRA_CAST(0x0)); (*GHIDRA_CAST((GHIDRA_CAST(&(local_30)) + 0x0))) = bVar1; (this->_sprite)._flipX = fireDirection == 0; if (0 < this->_fireCooldown) goto LAB_00614e92; iVar5 = this->_variant; if (iVar5 == 0x61) { iVar5 = 0; do { local_2c = (float)iVar5 * 90.0 * 0.017453292; local_3c.y = cos(local_2c); sinAngle = sin(local_2c); local_4c.x = aimDir.x * local_3c.y - aimDir.y * sinAngle; local_4c.y = aimDir.y * local_3c.y + aimDir.x * sinAngle; FireProjectile(this,&local_4c,(*GHIDRA_CAST((GHIDRA_CAST(&(local_30)) + 0x0)))); iVar5 = iVar5 + 1; } while (iVar5 < 4); iVar3 = fireDelay; LAB_00614e78: this->_fireCooldown = iVar3; this->_headFrameDelay = 0x12; } else { if ((iVar5 == 6) || (local_2c == 5.60519e-45)) { fire_robo_baby_laser(this,&aimDir); goto LAB_00614e78; } if ((iVar5 != 0x36) && (local_2c != 1.26117e-44)) { if ((iVar5 == 8) || (iVar5 == 0xf4)) { EVar4 = local_30; AimDirection = (GHIDRA_CAST((&local_4c)))->Vector::Normalized(&local_3c); FireProjectile(this,AimDirection,(*GHIDRA_CAST((GHIDRA_CAST(&(EVar4)) + 0x0)))); } else { FireProjectile(this,&aimDir,bVar1); } goto LAB_00614e78; } if (this->_linkedEntity == (EntityPtr)0x0) { PickEnemyTarget(this,200.0,1,0,&g_vectorZero,15.0); local_30 = (EntityPtr) (GHIDRA_CAST((this->_player)))->Entity_Player::AddBlueFlies(1,&this->_pos,GHIDRA_CAST(this->_target)); if (this->_linkedEntity != (EntityPtr)0x0) { local_3c.y = (float)&this->_linkedEntity; std::multiset::erase(&local_3c.y); } this->_linkedEntity = local_30; EVar4 = (EntityPtr)0x0; if (local_30 != (EntityPtr)0x0) { std::multiset::insert(&this->_linkedEntity); EVar4 = this->_linkedEntity; } (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(EVar4)); goto LAB_00614e78; } } mongo_baby_pick_next_mimic(this); LAB_00614e92: if (this->_headFrameDelay < 9) { PlayFloatAnim(this,fireDirection); this->_headFrameDelay = 8; ExceptionList = local_1c; return; } PlayShootAnim(this,fireDirection); this->_headFrameDelay = this->_headFrameDelay + -1; ExceptionList = local_1c; return; } // 00615d80 void Entity_Familiar::ai_blue_fly() { int iVar1; uint rngResult; Entity *orbitParent; Vector *orbitPosition; float fVar2; float fVar3; Vector local_18; Vector local_10; EntityPtr *parentRef; EntityPtr tmpEntity; if (0 < this->_state) { iVar1 = this->_state + -1; this->_state = iVar1; this->_entityCollisionClass = 0; this->_friction = this->_friction * 0.96; if (iVar1 == 0) { this->_entityCollisionClass = 4; return; } return; } local_18.x = 200.0; if (this->_subtype == 1) { local_18.x = 400.0; if ((*GHIDRA_CAST(g_game->_room) == '\0') || (g_game->_frameCount - *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x11f0)) < 0x3c)) { this->_target = (EntityPtr)0x0; iVar1 = 0; goto LAB_00615e6a; } } rngResult = Random(); if ((rngResult % 3 == 0) || (this->_subtype == 1)) { PickEnemyTarget(this,local_18.x,0xd,0,&g_vectorZero,15.0); } iVar1 = 4; LAB_00615e6a: parentRef = &this->_parent; this->_entityCollisionClass = iVar1; tmpEntity = *parentRef; if ((tmpEntity != (EntityPtr)0x0) && ((*GHIDRA_CAST((GHIDRA_CAST(tmpEntity) + 0x173)) != '\0' || (*GHIDRA_CAST((GHIDRA_CAST(tmpEntity) + 0x188)) == 0)))) { local_18.x = (float)parentRef; std::multiset::erase(&local_18); *parentRef = (EntityPtr)0x0; if (-1 < this->_orbitLayer) { RecalculateOrbitOffset(this,this->_orbitLayer,0); this->_orbitLayer = -1; } } tmpEntity = this->_target; if (tmpEntity == (EntityPtr)0x0) { if (this->_orbitLayer == -1) { this->_orbitLayer = 1; fVar2 = DAT_00c34148; (this->_orbitDistance).x = DAT_00c34144; (this->_orbitDistance).y = fVar2; RecalculateOrbitOffset(this,1,1); } orbitParent = get_orbit_parent(this); local_10.x = (orbitParent->_pos).x; local_10.y = (orbitParent->_pos).y; orbitPosition = GetOrbitPosition(this,&local_18,&local_10); fVar2 = orbitPosition->x; (this->_targetPosition).x = fVar2; (this->_targetPosition).y = orbitPosition->y; } else { fVar2 = *GHIDRA_CAST((GHIDRA_CAST(tmpEntity) + 0x33c)); fVar3 = *GHIDRA_CAST((GHIDRA_CAST(tmpEntity) + 0x340)); (this->_targetPosition).x = fVar2; (this->_targetPosition).y = fVar3; if (-1 < this->_orbitLayer) { RecalculateOrbitOffset(this,this->_orbitLayer,0); this->_orbitLayer = -1; fVar2 = (this->_targetPosition).x; } } local_10.x = (this->_targetPosition).y - (this->_pos).y; local_18.x = fVar2 - (this->_pos).x; fVar2 = sqrtf(local_10.x * local_10.x + local_18.x * local_18.x); if (fVar2 < 0.1) { fVar3 = 0.0; } else { fVar3 = fVar2 * 0.15; if (2.0 <= fVar3) { fVar3 = 2.0; } fVar3 = fVar3 / fVar2; } (this->_velocity).x = local_18.x * fVar3 + (this->_velocity).x; (this->_velocity).y = local_10.x * fVar3 + (this->_velocity).y; this->_friction = this->_friction * 0.8; return; } // 00616db0 void Entity_Familiar::ai_walker() { int iVar1; byte bVar2; int *piVar3; undefined4 *puVar4; Entity *bloodSplat; byte *animNameChar; byte *pbVar5; byte *animNameChar; char *animName; EntityPtr EVar7; uint uVar8; bool bVar9; float fVar10; float deltaX; float fVar11; undefined4 uVar12; TypeDescriptor *pTVar13; TypeDescriptor *pTVar14; undefined4 uVar15; EntityList_EL sameVariantList; Vector targetPos; undefined4 targetIndex; EntityPtr local_1c; EntityPtr local_18; bool isChasingTarget; void *local_10; undefined1 *puStack_c; undefined4 local_8; local_8 = 0xffffffff; puStack_c = &LAB_00af6a5d; local_10 = ExceptionList; ExceptionList = &local_10; targetPos.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); targetPos.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); if (this->_variant == 0x38) { EVar7 = this->_parent; if (EVar7 == (EntityPtr)0x0) { EntityList::QuerySublist (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&sameVariantList,this->_type,0x38,-1,0, 0); local_8 = 0; uVar8 = 0; if (sameVariantList._size != 0) { do { EVar7 = *GHIDRA_CAST((GHIDRA_CAST(sameVariantList._data) + uVar8 * 4)); if (((*GHIDRA_CAST((GHIDRA_CAST(EVar7) + 0x172)) != 0) && (*GHIDRA_CAST((GHIDRA_CAST(EVar7) + 0x3bc)) != (EntityPtr)0x0)) && (*GHIDRA_CAST((GHIDRA_CAST(EVar7) + 0x3c0)) == (EntityPtr)0x0)) { local_1c = EVar7; if (this->_parent != (EntityPtr)0x0) { local_18 = (EntityPtr)&this->_parent; std::multiset::erase(&local_18); } this->_parent = local_1c; if (local_1c != (EntityPtr)0x0) { std::multiset::insert(&this->_parent); } local_18 = (EntityPtr)(*GHIDRA_CAST((GHIDRA_CAST(sameVariantList._data) + uVar8 * 4)) + 0x3c0); if (*GHIDRA_CAST(local_18) != (EntityPtr)0x0) { local_1c = local_18; std::multiset::erase(&local_1c); } *GHIDRA_CAST(local_18) = this; std::multiset::insert(local_18); iVar1 = *GHIDRA_CAST((GHIDRA_CAST(sameVariantList._data) + uVar8 * 4)); targetPos.x = *GHIDRA_CAST((iVar1 + 0x33c)); targetPos.y = *GHIDRA_CAST((iVar1 + 0x340)); break; } uVar8 = uVar8 + 1; } while (uVar8 < GHIDRA_UINT(sameVariantList._size)); } if ((this->_parent == (EntityPtr)0x0) && (this->_parent = (EntityPtr)this->_player, (EntityPtr)this->_player != (EntityPtr)0x0)) { std::multiset::insert(&this->_parent); } if ((*GHIDRA_CAST((GHIDRA_CAST(&(sameVariantList)) + 0x0))) == '\0') { local_8 = 1; tracked_alloc(1,sameVariantList._data,0); } } else { targetPos.x = *GHIDRA_CAST((GHIDRA_CAST(EVar7) + 0x33c)); targetPos.y = *GHIDRA_CAST((GHIDRA_CAST(EVar7) + 0x340)); } } local_8 = 0xffffffff; if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (this->_target != (EntityPtr)0x0)) { local_1c = *GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x20)); piVar3 = map_find_value(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf3c))),GHIDRA_UINT(&local_1c)); if (0x1c1 < *piVar3) { targetIndex = *GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x20)); puVar4 = map_find_value(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf3c))),GHIDRA_UINT(&targetIndex)); *puVar4 = 0xfffffc7c; } } PickEnemyTarget(this,this->_collisionDamage * 15.0 + 65.0,8,0,&g_vectorZero,15.0); EVar7 = this->_target; isChasingTarget = false; if (EVar7 == (EntityPtr)0x0) { fVar11 = 6400.0; } else { targetPos.x = *GHIDRA_CAST((GHIDRA_CAST(EVar7) + 0x33c)); fVar11 = 0.0; targetPos.y = *GHIDRA_CAST((GHIDRA_CAST(EVar7) + 0x340)); } fVar10 = targetPos.y - (this->_pos).y; deltaX = targetPos.x - (this->_pos).x; if (fVar11 < fVar10 * fVar10 + deltaX * deltaX) { iVar1 = this->_variant; if ((iVar1 == 0x2f) || (iVar1 == 0x38)) { fVar11 = 2.2; } else { fVar11 = 1.8; } if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (iVar1 == 0x2f)) { fVar11 = 2.0; } PathFinder::FindGridPath(GHIDRA_CAST(&this->_pathfinder),&targetPos,fVar11 * 0.83,0,1); isChasingTarget = this->_target != (EntityPtr)0x0; } if (((this->_variant == 0x2e) || (this->_variant == 0x2f)) && (uVar8 = Random(), (uVar8 & 3) == 0) ) { uVar8 = Random(); uVar15 = 0; pTVar14 = &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor; pTVar13 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; uVar12 = 0; bloodSplat = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,7,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar8); piVar3 = GHIDRA_CAST(__RTDynamicCast(bloodSplat,uVar12,pTVar13,pTVar14,uVar15)); uVar8 = Random(); fVar11 = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * 2.3283064e-10 * 0.3 + 0.1; piVar3[0x39] = GHIDRA_INT(fVar11); piVar3[0x3a] = GHIDRA_INT(fVar11); (**(code **)(*piVar3 + 0xc))(); } local_1c = (EntityPtr)this->_variant; this->_friction = this->_friction * 0.85; fVar11 = (this->_velocity).x; fVar10 = (this->_velocity).y; fVar11 = sqrtf(fVar11 * fVar11 + fVar10 * fVar10); if (fVar11 < 2.0) { if (local_1c == (EntityPtr)0x38) { if ((this->_sprite)._animState._animData == (void *)0x0) { ExceptionList = local_10; return; } (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::SetFrameFloat(0.0); ExceptionList = local_10; return; } pbVar5 = (this->_sprite)._animState._animData; if (pbVar5 != GHIDRA_CAST(0x0)) { animNameChar = pbVar5; if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { animNameChar = *GHIDRA_CAST(pbVar5); } animNameChar = s_Idle; do { bVar2 = *animNameChar; bVar9 = bVar2 < *animNameChar; if (bVar2 != *animNameChar) { LAB_00617225: uVar8 = -GHIDRA_UINT(bVar9) | 1; goto LAB_0061722a; } if (bVar2 == 0) break; bVar2 = animNameChar[1]; bVar9 = bVar2 < animNameChar[1]; if (bVar2 != animNameChar[1]) goto LAB_00617225; animNameChar = animNameChar + 2; animNameChar = animNameChar + 2; } while (bVar2 != 0); uVar8 = 0; LAB_0061722a: if (uVar8 == 0) { if (pbVar5[0x34] == 0) { ExceptionList = local_10; return; } if ((this->_sprite)._animState._isPlaying != 0) { ExceptionList = local_10; return; } } } EVar7 = (EntityPtr)s_Idle; goto LAB_0061748d; } fVar11 = (this->_velocity).y; if (ABS(fVar11) < ABS((this->_velocity).x)) { if (this->_variant == 0x38) { animName = "Attack Hori"; if (isChasingTarget == false) { animName = "Move Hori"; } pbVar5 = (this->_sprite)._animState._animData; if (pbVar5 != GHIDRA_CAST(0x0)) { if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { pbVar5 = *GHIDRA_CAST(pbVar5); } EVar7 = (EntityPtr)animName; do { bVar2 = *pbVar5; bVar9 = bVar2 < *GHIDRA_CAST(EVar7); if (bVar2 != *GHIDRA_CAST(EVar7)) { LAB_006172c4: uVar8 = -GHIDRA_UINT(bVar9) | 1; goto LAB_006172c9; } if (bVar2 == 0) break; bVar2 = pbVar5[1]; bVar9 = bVar2 < *GHIDRA_CAST((GHIDRA_CAST(EVar7) + 1)); if (bVar2 != *GHIDRA_CAST((GHIDRA_CAST(EVar7) + 1))) goto LAB_006172c4; pbVar5 = pbVar5 + 2; EVar7 = (EntityPtr)(GHIDRA_INT(EVar7) + 2); } while (bVar2 != 0); uVar8 = 0; LAB_006172c9: if ((uVar8 == 0) && ((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animData) + 0x34)) == '\0' || ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_00617356; } local_18 = (EntityPtr)animName; } else { pbVar5 = (this->_sprite)._animState._animData; if (pbVar5 != GHIDRA_CAST(0x0)) { if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { pbVar5 = *GHIDRA_CAST(pbVar5); } animName = "WalkHori"; do { bVar2 = *pbVar5; bVar9 = bVar2 < (byte)*animName; if (bVar2 != *animName) { LAB_00617320: uVar8 = -GHIDRA_UINT(bVar9) | 1; goto LAB_00617325; } if (bVar2 == 0) break; bVar2 = pbVar5[1]; bVar9 = bVar2 < (byte)animName[1]; if (bVar2 != animName[1]) goto LAB_00617320; pbVar5 = pbVar5 + 2; animName = animName + 2; } while (bVar2 != 0); uVar8 = 0; LAB_00617325: if ((uVar8 == 0) && ((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animData) + 0x34)) == '\0' || ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_00617356; } animName = "WalkHori"; } bVar2 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST(animName),1); if (bVar2 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } LAB_00617356: (this->_sprite)._flipX = (this->_velocity).x <= 0.0 && (this->_velocity).x != 0.0; ExceptionList = local_10; return; } pbVar5 = (this->_sprite)._animState._animData; if (this->_variant != 0x38) { if (pbVar5 != GHIDRA_CAST(0x0)) { animNameChar = pbVar5; if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { animNameChar = *GHIDRA_CAST(pbVar5); } animName = "WalkVert"; do { bVar2 = *animNameChar; bVar9 = bVar2 < (byte)*animName; if (bVar2 != *animName) { LAB_00617473: uVar8 = -GHIDRA_UINT(bVar9) | 1; goto LAB_00617478; } if (bVar2 == 0) break; bVar2 = animNameChar[1]; bVar9 = bVar2 < (byte)animName[1]; if (bVar2 != animName[1]) goto LAB_00617473; animNameChar = animNameChar + 2; animName = animName + 2; } while (bVar2 != 0); uVar8 = 0; LAB_00617478: if (uVar8 == 0) { if (pbVar5[0x34] == 0) { ExceptionList = local_10; return; } if ((this->_sprite)._animState._isPlaying != 0) { ExceptionList = local_10; return; } } } EVar7 = (EntityPtr)"WalkVert"; goto LAB_0061748d; } if (isChasingTarget == false) { local_18 = (EntityPtr)0xb605fc; if (fVar11 <= 0.0) { local_18 = (EntityPtr)0xb60608; } if (pbVar5 != GHIDRA_CAST(0x0)) { animNameChar = pbVar5; EVar7 = local_18; if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { animNameChar = *GHIDRA_CAST(pbVar5); } do { bVar2 = *animNameChar; bVar9 = bVar2 < *GHIDRA_CAST(EVar7); if (bVar2 != *GHIDRA_CAST(EVar7)) goto LAB_006173d2; if (bVar2 == 0) goto LAB_006173ce; bVar2 = animNameChar[1]; bVar9 = bVar2 < *GHIDRA_CAST((GHIDRA_CAST(EVar7) + 1)); if (bVar2 != *GHIDRA_CAST((GHIDRA_CAST(EVar7) + 1))) goto LAB_006173d2; animNameChar = animNameChar + 2; EVar7 = (EntityPtr)(GHIDRA_INT(EVar7) + 2); } while (bVar2 != 0); uVar8 = 0; goto LAB_006173d7; } } else { local_18 = (EntityPtr)0xb60574; if (fVar11 <= 0.0) { local_18 = (EntityPtr)0xb605b8; } if (pbVar5 != GHIDRA_CAST(0x0)) { animNameChar = pbVar5; EVar7 = local_18; if (0xf < *GHIDRA_CAST((pbVar5 + 0x14))) { animNameChar = *GHIDRA_CAST(pbVar5); } do { bVar2 = *animNameChar; bVar9 = bVar2 < *GHIDRA_CAST(EVar7); if (bVar2 != *GHIDRA_CAST(EVar7)) goto LAB_006173d2; if (bVar2 == 0) break; bVar2 = animNameChar[1]; bVar9 = bVar2 < *GHIDRA_CAST((GHIDRA_CAST(EVar7) + 1)); if (bVar2 != *GHIDRA_CAST((GHIDRA_CAST(EVar7) + 1))) goto LAB_006173d2; animNameChar = animNameChar + 2; EVar7 = (EntityPtr)(GHIDRA_INT(EVar7) + 2); } while (bVar2 != 0); LAB_006173ce: uVar8 = 0; LAB_006173d7: if (uVar8 == 0) { if (pbVar5[0x34] == 0) { ExceptionList = local_10; return; } if ((this->_sprite)._animState._isPlaying != 0) { ExceptionList = local_10; return; } } } } EVar7 = local_18; LAB_0061748d: bVar2 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST(EVar7),1); if (bVar2 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } ExceptionList = local_10; return; LAB_006173d2: uVar8 = -GHIDRA_UINT(bVar9) | 1; goto LAB_006173d7; } // 006174c0 void Entity_Familiar::ai_charger() { void *pvVar1; byte bVar2; char isFiring; Entity *umbilicalWhip; Vector *pVVar3; byte *currentAnimName; uint uVar4; undefined4 uVar5; int iVar6; Entity_Player *player; RNG *collectibleRng; EntityPtr *chargeLevelPtr; Vector *pVVar7; float *collisionPoint; EntityPtr *nonNegativeLevelPtr; float *extraout_ECX; int iVar8; bool bVar9; float fVar10; undefined1 in_XMM0 [16]; float fVar11; EntityPtr EVar12; EntityPtr EVar13; float velocityX; EntityRef sourceRef; EntityList_EL entityList; Vector scratchVec; undefined1 local_40 [12]; EntityPtr local_34; EntityPtr local_30; Vector local_2c; EntityPtr local_24; EntityPtr local_20; Vector local_1c; char isNoOtherCharging; byte isLilithIncubus; void *local_10; undefined1 *puStack_c; undefined4 local_8; char *animName; GridEntity_Door *door; Game *game; Manager *manager; int *queriedEntity; Room *room; RoomDescriptor *roomDesc; ANM2 *sprite; local_8 = 0xffffffff; puStack_c = &LAB_00af6aa9; local_10 = ExceptionList; ExceptionList = &local_10; local_20 = (EntityPtr)this; isLilithIncubus = IsLilithBirthrightIncubus(this); if (this->_subtype != 0) { this->_entityCollisionClass = 0; if (((this->_variant == 0x19) && ((this->_sprite)._animState._animData != (void *)0x0)) && ((this->_sprite)._animState._isPlaying != 0)) { this->_friction = this->_friction * 0.3; if (isLilithIncubus == 0) goto LAB_006189fb; } else { this->_visible = 0; } FollowParent(this); LAB_006189fb: uVar4 = this->_subtype; if (3 < uVar4) { this->_subtype = 0; iVar6 = 0x3c; if (this->_variant != 0x3b) { iVar6 = 0; } this->_fireCooldown = iVar6; (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("Appear"),0); ExceptionList = local_10; return; } if (((this->_variant != 0xe8) && (uVar4 != 0)) && (iVar6 = this->_state, this->_state = iVar6 + 1, 300 < iVar6)) { if (uVar4 == 1) { uVar4 = Random(); (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4); uVar4 = this->_subtype; } this->_subtype = uVar4 + 1; } ExceptionList = local_10; return; } this->_visible = 1; this->_state = 0; local_24 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x162c)); Isaac::GetAxisAlignedUnitVectorFromDir(&local_1c,GHIDRA_INT(local_24)); TryAimAtMarkedTarget(this,&local_1c,GHIDRA_CAST(&local_24),GHIDRA_CAST(0x0)); if (this->_fireCooldown < 0) { if (((isLilithIncubus != 0) && (umbilicalWhip = get_incubus_umbilical_whip(this), umbilicalWhip != GHIDRA_CAST(0x0))) && (fVar10 = umbilicalWhip[3]._sprite._championColor._tint[3], fVar10 != -NAN)) { pVVar3 = Isaac::GetAxisAlignedUnitVectorFromDir(&scratchVec,GHIDRA_INT(fVar10)); (this->_velocity).x = pVVar3->x; (this->_velocity).y = pVVar3->y; } iVar6 = this->_variant; if (iVar6 == 0x82) { animName = "Throw"; } else { if (iVar6 == 0xe8) { local_30 = (EntityPtr)0x0; local_24 = (EntityPtr)0x3; uVar4 = (g_game->_stage + 1) * 100; if (0x4b0 < GHIDRA_INT(uVar4)) { uVar4 = 0x4b0; } local_2c.y = (float)(this->_coins / GHIDRA_INT((uVar4 >> 2))); nonNegativeLevelPtr = &local_30; if (-1 < GHIDRA_INT(local_2c.y)) { nonNegativeLevelPtr = GHIDRA_CAST(&local_2c.y); } chargeLevelPtr = &local_24; if (GHIDRA_INT(*nonNegativeLevelPtr) < 4) { chargeLevelPtr = nonNegativeLevelPtr; } EVar12 = *chargeLevelPtr; (GHIDRA_CAST((&this->_sprite)))->ANM2::Play((&PTR_s_Charge0_00b648f0)[GHIDRA_INT(EVar12)],0); fVar10 = (float)GHIDRA_INT(EVar12); this->SetCollisionDamage(fVar10 + fVar10 + 2.0); EntityList::QueryRadius (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&entityList,&this->_pos,this->_size, 0x10); local_8 = 0; local_30 = (EntityPtr)0x0; if (GHIDRA_CAST(entityList._size) != GHIDRA_CAST(0x0)) { iVar6 = g_forceCollideDepth; do { queriedEntity = *GHIDRA_CAST((GHIDRA_CAST(entityList._data) + GHIDRA_INT(local_30) * 4)); if (((queriedEntity != GHIDRA_CAST(0x0)) && (queriedEntity[10] == 5)) && ((((iVar8 = queriedEntity[0xb], iVar8 == 10 || (((((iVar8 == 0x14 || (iVar8 == 0x5a)) || (iVar8 == 0x28)) || ((iVar8 == 0x1e || (iVar8 == 0x46)))) || (iVar8 == 300)))) || ((((iVar8 == 0x15e || (iVar8 == 0x45)) || (iVar8 == 0x29)) || (iVar8 == 0x2a)))) && (queriedEntity[0x14d] == 0)))) { g_forceCollideDepth = iVar6 + 1; this->HandleCollision(queriedEntity,1); (**(code **)(*queriedEntity + 0x5c))(this,0); iVar6 = g_forceCollideDepth + -1; g_forceCollideDepth = iVar6; } local_30 = (EntityPtr)(GHIDRA_INT(local_30) + 1); } while (GHIDRA_UINT(local_30) < GHIDRA_UINT(entityList._size)); } local_8 = 0xffffffff; if ((*GHIDRA_CAST((GHIDRA_CAST(&(entityList)) + 0x0))) == '\0') { local_8 = 1; tracked_alloc(1,entityList._data,0); local_8 = 0xffffffff; } goto LAB_006177c3; } fVar10 = (this->_velocity).x; fVar11 = (this->_velocity).y; if (ABS(fVar11) < ABS(fVar10)) { if (((iVar6 == 3) || (iVar6 == 0x68)) || ((iVar6 == 0xdf && (this->_fireCooldown == -1)))) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("FloatShootSide"),0); fVar10 = (this->_velocity).x; } (this->_sprite)._flipX = fVar10 < 0.0; goto LAB_006177c3; } if (((iVar6 != 3) && (iVar6 != 0x68)) && ((iVar6 != 0xdf || (this->_fireCooldown != -1)))) goto LAB_006177c3; animName = "FloatShootUp"; if (0.0 <= fVar11) { animName = "FloatShootDown"; } } (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST(animName),0); LAB_006177c3: if (this->_variant == 0x82) { EVar13 = this->_target; EVar12 = (EntityPtr)&this->_target; pVVar3 = &this->_pos; local_30 = EVar12; if (EVar13 == (EntityPtr)0x0) { EntityList::QueryRadius (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_40),pVVar3, this->_size,0x10); EVar13 = local_30; local_8 = 2; local_24 = (EntityPtr)0x0; if (local_34 != (EntityPtr)0x0) { do { EVar12 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x4))) + GHIDRA_INT(local_24) * 4)); local_1c.y = (float)EVar12; if ((((EVar12 != (EntityPtr)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(EVar12) + 0x28)) == 5)) && (((((iVar6 = *GHIDRA_CAST((GHIDRA_CAST(EVar12) + 0x2c)), iVar6 == 10 || (((iVar6 == 0x14 || (iVar6 == 0x5a)) || (iVar6 == 0x28)))) || (((iVar6 == 0x1e || (iVar6 == 0x46)) || (iVar6 == 300)))) || ((iVar6 == 0x15e || (iVar6 == 0x45)))) || ((iVar6 == 0x29 || (iVar6 == 0x2a)))))) && (*GHIDRA_CAST((GHIDRA_CAST(EVar12) + 0x534)) == 0)) { if ((iVar6 == 0x14) && (*GHIDRA_CAST((GHIDRA_CAST(EVar12) + 0x30)) == 6)) { if ((*GHIDRA_CAST((GHIDRA_CAST(EVar12) + 0x7c)) != 0) && (*GHIDRA_CAST((GHIDRA_CAST(EVar12) + 0x8c)) != '\0')) { currentAnimName = *GHIDRA_CAST((GHIDRA_CAST(EVar12) + 0x7c)); if (0xf < *GHIDRA_CAST((currentAnimName + 0x14))) { currentAnimName = *GHIDRA_CAST(currentAnimName); } animName = "Touched"; do { bVar2 = *currentAnimName; bVar9 = bVar2 < (byte)*animName; if (bVar2 != *animName) { LAB_00617920: uVar4 = -GHIDRA_UINT(bVar9) | 1; goto LAB_00617925; } if (bVar2 == 0) break; bVar2 = currentAnimName[1]; bVar9 = bVar2 < (byte)animName[1]; if (bVar2 != animName[1]) goto LAB_00617920; currentAnimName = currentAnimName + 2; animName = animName + 2; } while (bVar2 != 0); uVar4 = 0; LAB_00617925: if (uVar4 == 0) goto LAB_006179e0; } local_2c.y = (float)(GHIDRA_INT(EVar12) + 0x48); currentAnimName = *GHIDRA_CAST((GHIDRA_CAST(EVar12) + 0x7c)); if (currentAnimName == GHIDRA_CAST(0x0)) { LAB_00617990: bVar2 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(EVar12) + 0x48)))))->ANM2::SetAnimation(GHIDRA_CAST("Touched"),1); fVar10 = local_2c.y; if (bVar2 != 0) { (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(local_2c.y) + 0x30)))))->AnimationState::Rewind(); *GHIDRA_CAST((GHIDRA_CAST(fVar10) + 0x44)) = 1; EVar12 = (EntityPtr)local_1c.y; } } else { if (0xf < *GHIDRA_CAST((currentAnimName + 0x14))) { currentAnimName = *GHIDRA_CAST(currentAnimName); } animName = "Touched"; do { bVar2 = *currentAnimName; bVar9 = bVar2 < (byte)*animName; if (bVar2 != *animName) { LAB_00617970: uVar4 = -GHIDRA_UINT(bVar9) | 1; goto LAB_00617975; } if (bVar2 == 0) break; bVar2 = currentAnimName[1]; bVar9 = bVar2 < (byte)animName[1]; if (bVar2 != animName[1]) goto LAB_00617970; currentAnimName = currentAnimName + 2; animName = animName + 2; } while (bVar2 != 0); uVar4 = 0; LAB_00617975: if ((uVar4 != 0) || ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(EVar12) + 0x7c)) + 0x34)) != '\0' && (*GHIDRA_CAST((GHIDRA_CAST(EVar12) + 0x8c)) == '\0')))) goto LAB_00617990; } *GHIDRA_CAST((GHIDRA_CAST(EVar12) + 0x54c)) = 10; } else { if (*GHIDRA_CAST(EVar13) != 0) { local_2c.y = (float)EVar13; std::multiset::erase(&local_2c.y); } *GHIDRA_CAST(EVar13) = EVar12; std::multiset::insert(EVar13); } } LAB_006179e0: local_24 = (EntityPtr)(GHIDRA_INT(local_24) + 1); } while (GHIDRA_UINT(local_24) < GHIDRA_UINT(local_34)); EVar12 = local_30; this = GHIDRA_CAST(local_20); } if (local_40[0] == '\0') { local_8 = 3; tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_40)) + 0x4))),0); } local_8 = 0xffffffff; pVVar3 = GHIDRA_CAST((GHIDRA_INT(this) + 0x33c)); } else { *GHIDRA_CAST((GHIDRA_CAST(EVar13) + 0x33c)) = pVVar3->x; *GHIDRA_CAST((GHIDRA_CAST(EVar13) + 0x340)) = (this->_pos).y; EVar13 = *GHIDRA_CAST(EVar12); *GHIDRA_CAST((GHIDRA_CAST(EVar13) + 0x360)) = (this->_velocity).x; *GHIDRA_CAST((GHIDRA_CAST(EVar13) + 0x364)) = (this->_velocity).y; *GHIDRA_CAST((GHIDRA_INT(*GHIDRA_CAST(EVar12)) + 0x184)) = 0; } if (*GHIDRA_CAST((GHIDRA_CAST(this) + 0xd4c)) == -2) { local_2c.y = *GHIDRA_CAST((GHIDRA_INT(*(void **)(GHIDRA_CAST(this) + 0x410)) + 0x340)) - pVVar3->y; local_30 = (EntityPtr)(*GHIDRA_CAST((GHIDRA_INT(*(void **)(GHIDRA_CAST(this) + 0x410)) + 0x33c)) - pVVar3->x); local_24 = (EntityPtr)(local_2c.y * local_2c.y + (float)local_30 * (float)local_30); if ((float)local_24 < 1600.0) { uVar4 = *GHIDRA_CAST(EVar12); *GHIDRA_CAST((GHIDRA_CAST(this) + 0xd4c)) = 0x1e; if (uVar4 != 0) { uVar5 = 3; if (isLilithIncubus != 0) { uVar5 = 0; } *GHIDRA_CAST((uVar4 + 0x184)) = uVar5; if (*GHIDRA_CAST(EVar12) != 0) { local_20 = EVar12; std::multiset::erase(&local_20); } *GHIDRA_CAST(EVar12) = 0; } iVar6 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::get_velocity_direction(); sprite = GHIDRA_CAST((GHIDRA_INT(this) + 0x48)); if (iVar6 == 3) { (GHIDRA_CAST((sprite)))->ANM2::Play(GHIDRA_CAST("FloatDown"),0); } else if (iVar6 == 1) { (GHIDRA_CAST((sprite)))->ANM2::Play(GHIDRA_CAST("FloatUp"),0); } else { (GHIDRA_CAST((sprite)))->ANM2::Play(GHIDRA_CAST("FloatSide"),0); *GHIDRA_CAST((GHIDRA_CAST(this) + 0x148)) = iVar6 == 0; } } fVar10 = sqrtf((float)local_24); EVar12 = local_30; EVar13 = (EntityPtr)local_2c.y; if (0.0 < fVar10) { EVar12 = (EntityPtr)((float)local_30 * (1.0 / fVar10)); EVar13 = (EntityPtr)(local_2c.y * (1.0 / fVar10)); } (GHIDRA_CAST((GHIDRA_INT(this) + 0x360)))->x = (float)EVar12 * 10.0; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x364)) = (float)EVar13 * 10.0; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x188)) = 4; } else { if ((((*GHIDRA_CAST((GHIDRA_CAST(this) + 400)) != 0) || (bVar2 = (GHIDRA_CAST((g_game->_room)))->Room::IsPositionInRoom(pVVar3,-100.0), bVar2 == 0)) || (*GHIDRA_CAST(EVar12) != 0)) && (bVar2 = IsLilithBirthrightIncubus(this), bVar2 == 0)) { *GHIDRA_CAST((GHIDRA_CAST(this) + 0x184)) = 0; (GHIDRA_CAST((GHIDRA_INT(this) + 0x360)))->x = (GHIDRA_CAST((GHIDRA_INT(this) + 0x360)))->x * 0.5; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x364)) = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x364)) * 0.5; *GHIDRA_CAST((GHIDRA_CAST(this) + 0xd4c)) = -2; } *GHIDRA_CAST((GHIDRA_CAST(this) + 0x188)) = 4; } } else if (this->_variant == 0xdf) { iVar6 = this->_fireCooldown; if (iVar6 == -3) { fVar10 = (this->_sprite)._color._tint[3] - 0.1; if (fVar10 <= 0.0) { fVar10 = 0.0; } (this->_sprite)._color._tint[3] = fVar10; if (fVar10 <= 0.0) { this->Remove(); uVar4 = 0; if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2 != 0) { do { player = (GHIDRA_CAST((g_game)))->Game::GetPlayer(uVar4); if (player->_variant == 0) { player->_cacheFlags = player->_cacheFlags | 0x200; (player->_temporaryeffects)._shouldEvaluateCache = 1; } uVar4 = uVar4 + 1; } while (uVar4 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); } } } else if (iVar6 == -2) { fVar10 = (this->_targetPosition).y; fVar11 = (this->_pos).y; (this->_velocity).x = (this->_targetPosition).x - (this->_pos).x; (this->_velocity).y = fVar10 - fVar11; if (((this->_sprite)._animState._animData == (void *)0x0) || ((this->_sprite)._animState._isPlaying == 0)) { this->_fireCooldown = 0x1e; } } else if (iVar6 == -1) { iVar6 = 0x194; this->_entityCollisionClass = 3; if (isLilithIncubus != 0) { iVar6 = 0x360; } (*GHIDRA_CAST((GHIDRA_CAST(&(local_40)) + 0x8))) = *GHIDRA_CAST((GHIDRA_INT((&(this->_sprite)._filename + -3)) + iVar6)); local_34 = *GHIDRA_CAST(((this->_sprite)._filename._buf + iVar6 + -0x44)); local_30 = local_34; local_24 = (*GHIDRA_CAST((GHIDRA_CAST(&((EntityPtr)local_40)) + 0x8))); if ((isLilithIncubus == 0) && ((this->_collidesWithGrid == 0 || (pVVar3 = (GHIDRA_CAST((GHIDRA_CAST((local_40 + 8)))))->Vector::Normalized(&local_2c), pVVar3->y * (this->_gridCollisionNormal).y + (this->_gridCollisionNormal).x * pVVar3->x <= 0.45)))) { local_30 = (EntityPtr)(this->_velocity).x; local_2c.y = (this->_velocity).y; fVar10 = sqrtf((float)local_30 * (float)local_30 + local_2c.y * local_2c.y); if (17.0 <= fVar10) { ExceptionList = local_10; return; } if (0.0 < fVar10) { (this->_velocity).x = (float)local_30 * (17.0 / fVar10); (this->_velocity).y = local_2c.y * (17.0 / fVar10); ExceptionList = local_10; return; } ExceptionList = local_10; return; } EVar12 = local_20; collisionPoint = (this->_collisionPoints)._begin; local_34 = (EntityPtr)(GHIDRA_INT((this->_collisionPoints)._end) - GHIDRA_INT(collisionPoint) >> 3); local_1c.y = 0.0; if (local_34 != (EntityPtr)0x0) { pVVar7 = &this->_pos; pVVar3 = &this->_pos; local_2c.y = (float)g_game->_room; do { iVar8 = GHIDRA_INT(((((float)local_24 + pVVar3->x + *collisionPoint) - 40.0) / 40.0 + 0.5)); iVar6 = GHIDRA_INT(((((float)local_30 + pVVar7->y + collisionPoint[1]) - 120.0) / 40.0 + 0.5)); if (-1 < iVar8) { if (((((iVar8 < GHIDRA_INT(*(void **)(GHIDRA_CAST(local_2c.y) + 0xc))) && (-1 < iVar6)) && (this = GHIDRA_CAST(local_20), iVar6 < GHIDRA_INT(*(void **)(GHIDRA_CAST(local_2c.y) + 0x10)))) && ((uVar4 = GHIDRA_INT(*(void **)(GHIDRA_CAST(local_2c.y) + 0xc)) * iVar6 + iVar8, uVar4 < 0x1c0 && (door = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(local_2c.y) + 0x24)))[uVar4]), door != GHIDRA_CAST(0x0))))) && ((door->_desc)._type == 0x10)) { this = GHIDRA_CAST(EVar12); if ((((door->_desc)._variant == 3) && (iVar6 = (GHIDRA_CAST((door)))->GridEntity_Door::get_secret_exit_kind(), iVar6 == 4)) && (bVar2 = (GHIDRA_CAST((door)))->GridEntity_Door::TryBlowOpen(0,GHIDRA_CAST(EVar12)), bVar2 != 0)) { *GHIDRA_CAST((GHIDRA_CAST(EVar12) + 0x184)) = 0; *GHIDRA_CAST((GHIDRA_CAST(EVar12) + 0xd4c)) = -3; (GHIDRA_CAST((GHIDRA_INT(EVar12) + 0x360)))->x = (float)local_24; *GHIDRA_CAST((GHIDRA_CAST(EVar12) + 0x364)) = local_30; fVar10 = (GHIDRA_CAST((GHIDRA_INT(EVar12) + 0x360)))->x; fVar11 = (GHIDRA_CAST((GHIDRA_INT(EVar12) + 0x33c)))->x; *GHIDRA_CAST((GHIDRA_CAST(EVar12) + 0x340)) = (float)local_30 * *GHIDRA_CAST((GHIDRA_CAST(EVar12) + 0x39c)) + *GHIDRA_CAST((GHIDRA_CAST(EVar12) + 0x340)); (GHIDRA_CAST((GHIDRA_INT(EVar12) + 0x33c)))->x = *GHIDRA_CAST((GHIDRA_CAST(EVar12) + 0x39c)) * fVar10 + fVar11; bVar2 = (GHIDRA_CAST((*(void **)(GHIDRA_CAST(EVar12) + 0x410))))->Entity_Player::HasCollectible(0x272,0); if (bVar2 == 0) { player = PlayerManager::FirstCollectibleOwner (&g_game->_playerManager,0x272, GHIDRA_CAST(&g_game->_playerManager),0); } else { player = *(void **)(GHIDRA_CAST(EVar12) + 0x410); } if (player != GHIDRA_CAST(0x0)) { (GHIDRA_CAST((player)))->Entity_Player::RemoveCollectible(0x272,0,0,1); } bVar2 = (GHIDRA_CAST((*(void **)(GHIDRA_CAST(EVar12) + 0x410))))->Entity_Player::HasCollectible(0x273,0); if (bVar2 == 0) { player = PlayerManager::FirstCollectibleOwner (&g_game->_playerManager,0x273, GHIDRA_CAST(&g_game->_playerManager),0); } else { player = *(void **)(GHIDRA_CAST(EVar12) + 0x410); } if (player != GHIDRA_CAST(0x0)) { (GHIDRA_CAST((player)))->Entity_Player::RemoveCollectible(0x273,0,0,1); } goto LAB_00618228; } break; } } local_1c.y = (float)(GHIDRA_INT(local_1c.y) + 1); collisionPoint = collisionPoint + 2; } while (GHIDRA_UINT(local_1c.y) < GHIDRA_UINT(local_34)); } bVar2 = IsLilithBirthrightIncubus(this); if (bVar2 == 0) { *GHIDRA_CAST((GHIDRA_CAST(this) + 0x188)) = 0; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x184)) = 0; bVar2 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(this) + 0x19c)))))->Vector::operator_eq(&g_vectorZero); if (bVar2 == 0) { if (ABS((float)local_30) < ABS((float)local_24)) { (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(this) + 0x48)))))->ANM2::Play(GHIDRA_CAST("HitSide"),0); *GHIDRA_CAST((GHIDRA_CAST(this) + 0x148)) = (float)local_24 < 0.0; } else { animName = "HitDown"; if ((float)local_30 < 0.0) { animName = "HitUp"; } (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(this) + 0x48)))))->ANM2::Play(GHIDRA_CAST(animName),0); } manager = g_manager; (GHIDRA_CAST((GHIDRA_INT(this) + 0x334)))->x = (GHIDRA_CAST((GHIDRA_INT(this) + 0x33c)))->x; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x338)) = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x340)); (GHIDRA_CAST((GHIDRA_INT(this) + 0x360)))->x = g_vectorZero.x; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x364)) = g_vectorZero.y; local_30 = (EntityPtr)0xcd; seed_fart_sound_override(GHIDRA_CAST(&local_30)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_30),1.0,2,0,1.0,0.0); *GHIDRA_CAST((GHIDRA_CAST(this) + 0xd4c)) = -2; } else { *GHIDRA_CAST((GHIDRA_CAST(this) + 0xd4c)) = 0x1e; } } } } else { if (((this->_collidesWithGrid != 0) || (this->_fireCooldown < -1)) || (bVar2 = (GHIDRA_CAST((g_game->_room)))->Room::IsPositionInRoom(&this->_pos,-100.0), bVar2 == 0)) { bVar2 = IsLilithBirthrightIncubus(this); game = g_game; if (bVar2 == 0) { this->_entityGridCollisionClass = 0; room = game->_room; iVar6 = (GHIDRA_CAST((room)))->Room::GetGridIndex(GHIDRA_CAST((GHIDRA_INT(local_20) + 0x33c))); (GHIDRA_CAST((&sourceRef)))->EntityRef::constructor(*(void **)(GHIDRA_CAST(local_20) + 0x410)); (GHIDRA_CAST((room)))->Room::DamageGridWithSource(iVar6,1,&sourceRef); (GHIDRA_CAST((GHIDRA_INT(local_20) + 0x360)))->x = (GHIDRA_CAST((GHIDRA_INT(local_20) + 0x360)))->x * 0.5; *GHIDRA_CAST((GHIDRA_CAST(local_20) + 0x364)) = *GHIDRA_CAST((GHIDRA_CAST(local_20) + 0x364)) * 0.5; *GHIDRA_CAST((GHIDRA_CAST(local_20) + 0xd4c)) = *GHIDRA_CAST((GHIDRA_CAST(local_20) + 0xd4c)) - 1; this = GHIDRA_CAST(local_20); if (*GHIDRA_CAST((GHIDRA_CAST(local_20) + 0xd4c)) < -10) { *GHIDRA_CAST((GHIDRA_CAST(local_20) + 0xd4c)) = 0x1e; } } } *GHIDRA_CAST((GHIDRA_CAST(this) + 0x188)) = (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x2c)) == 0x68) + 3; } LAB_00618228: if (isLilithIncubus == 0) { ExceptionList = local_10; return; } FollowParent(this); umbilicalWhip = get_incubus_umbilical_whip(this); if (umbilicalWhip == GHIDRA_CAST(0x0)) { *GHIDRA_CAST((GHIDRA_CAST(this) + 0xd4c)) = 0x1e; ExceptionList = local_10; return; } ExceptionList = local_10; return; } FollowParent(this); iVar6 = this->_variant; if (iVar6 == 0x82) { fVar10 = (this->_velocity).y; fVar11 = (this->_velocity).x; if (4.0 < fVar11 * fVar11 + fVar10 * fVar10) { iVar6 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::get_velocity_direction(); sprite = &this->_sprite; if (iVar6 == 3) { (GHIDRA_CAST((sprite)))->ANM2::Play(GHIDRA_CAST("FloatDown"),0); } else { if (iVar6 != 1) { (GHIDRA_CAST((sprite)))->ANM2::Play(GHIDRA_CAST("FloatSide"),0); bVar9 = iVar6 == 0; goto LAB_006185e8; } (GHIDRA_CAST((sprite)))->ANM2::Play(GHIDRA_CAST("FloatUp"),0); } } } else if (iVar6 == 0xe8) { iVar6 = (g_game->_stage + 1) * 100; if (0x4b0 < iVar6) { iVar6 = 0x4b0; } if ((((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x44)) & 1) == 0) || ((*GHIDRA_CAST((GHIDRA_CAST((g_game)) + 0x188f8))) != '\0')) || ((this->_coins < iVar6 || (fVar10 = (this->_velocity).y, fVar11 = (this->_velocity).x, 400.0 <= fVar11 * fVar11 + fVar10 * fVar10)))) { pvVar1 = (this->_sprite)._animState._animData; if (((pvVar1 == (void *)0x0) || (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x34)) != '\0')) || ((this->_sprite)._animState._isPlaying == 0)) { uVar4 = g_game->_stage * 200; local_34 = (EntityPtr)0x0; local_2c.y = 4.2039e-45; if (0x4b0 < GHIDRA_INT(uVar4)) { uVar4 = 0x4b0; } local_30 = (EntityPtr)(this->_coins / GHIDRA_INT((uVar4 >> 2))); nonNegativeLevelPtr = &local_34; if (-1 < GHIDRA_INT(local_30)) { nonNegativeLevelPtr = &local_30; } chargeLevelPtr = GHIDRA_CAST(&local_2c.y); if (GHIDRA_INT(*nonNegativeLevelPtr) < 4) { chargeLevelPtr = nonNegativeLevelPtr; } (GHIDRA_CAST((&this->_sprite)))->ANM2::Play((&PTR_DAT_00b648e0)[GHIDRA_INT(*chargeLevelPtr)],0); } } else { iVar6 = g_game->_currentRoomIdx; if ((((iVar6 != -0x14) && (iVar6 != -0x12)) && (iVar6 != -0xd)) && (((iVar6 != -4 && (iVar6 != -6)) && (iVar6 != -0x13)))) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(s_Spawn,0); bVar2 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered("Shoot"); if (bVar2 != 0) { Room::FindFreePickupSpawnPosition(g_game->_room,&local_2c,&this->_pos,0.0,0,0,1); manager = g_manager; this->_coins = 0; local_30 = (EntityPtr)0x10c; seed_fart_sound_override(GHIDRA_CAST(&local_30)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_30),1.0,2,0,1.0,0.0); game = g_game; if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < g_invalidRoomDescriptorGuard) && (_Init_thread_header(&g_invalidRoomDescriptorGuard), g_invalidRoomDescriptorGuard == -1 )) { local_8 = 4; (GHIDRA_CAST((&g_roomDescriptorDummy)))->RoomDescriptor::constructor(); _atexit(FUN_00b15b30); local_8 = 0xffffffff; _Init_thread_footer(&g_invalidRoomDescriptorGuard); } roomDesc = &g_roomDescriptorDummy; if (GHIDRA_UINT(game->_currentDimensionIdx) < 3) { roomDesc = game->_roomList + 0x20e; } roomDesc->Flags = roomDesc->Flags | 0x20000; collectibleRng = (GHIDRA_CAST((this->_player)))->Entity_Player::GetCollectibleRNG(0x2a9); uVar4 = (GHIDRA_CAST((collectibleRng)))->RNG::Next(); (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0xa1,&local_2c,&g_vectorZero,GHIDRA_CAST(0x0),0x3d4,uVar4); game = g_game; this->_subtype = 1; (*GHIDRA_CAST((GHIDRA_CAST((game)) + 0x188f8))) = 1; } } } if ((this->_fireCooldown < 1) && (bVar2 = (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_ne(&g_vectorZero), bVar2 != 0)) { local_1c.x = *extraout_ECX; local_1c.y = *GHIDRA_CAST((extraout_ECX + 1)); local_24 = (EntityPtr)0x0; } } else if (((iVar6 == 0xd5) || (iVar6 == 0xd6)) || (iVar6 == 0xdf)) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(s_Idle,0); fVar10 = (this->_velocity).x; FUN_0058e210(); if ((*GHIDRA_CAST((GHIDRA_CAST(&(in_XMM0)) + 0x0))) != 0.0) { bVar9 = fVar10 < 0.0; LAB_006185e8: (this->_sprite)._flipX = bVar9; } } else { bVar2 = (GHIDRA_CAST((&this->_sprite)))->ANM2::IsPlaying(GHIDRA_CAST("Float")); if (bVar2 == 0) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("Float"),0); } } if (0 < this->_fireCooldown) { this->_fireCooldown = this->_fireCooldown + -1; } if (isLilithIncubus != 0) { this->_fireCooldown = 0; } if (((local_24 != (EntityPtr)0xffffffff) && (iVar6 = this->_variant, iVar6 != 0xd5)) && (iVar6 != 0xd6)) { if (iVar6 != 0x82) { (this->_sprite)._flipX = local_24 == (EntityPtr)0x0; } isNoOtherCharging = '\x01'; if (iVar6 == 0x3b) { EntityList::QuerySublist (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&entityList,3,0x3b,-1,1,0); uVar4 = 0; local_8 = 5; if (GHIDRA_CAST(entityList._size) != GHIDRA_CAST(0x0)) { do { iVar6 = __RTDynamicCast(*GHIDRA_CAST((GHIDRA_CAST(entityList._data) + uVar4 * 4)),0, &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0); if (((*GHIDRA_CAST((iVar6 + 0x172)) != '\0') && (*GHIDRA_CAST((iVar6 + 0xd4c)) < 0)) && (*GHIDRA_CAST((iVar6 + 0x30)) == 0)) { isNoOtherCharging = '\0'; break; } uVar4 = uVar4 + 1; } while (uVar4 < GHIDRA_UINT(entityList._size)); } if ((*GHIDRA_CAST((GHIDRA_CAST(&(entityList)) + 0x0))) == '\0') { local_8 = 6; tracked_alloc(1,entityList._data,0); } local_8 = 0xffffffff; } if (this->_variant == 0xe8) { if (((this->_targetPosition).x == g_vectorZero.x) && ((this->_targetPosition).y == g_vectorZero.y)) { isFiring = '\0'; } else { if (0 < this->_fireCooldown) goto LAB_00618988; (this->_targetPosition).x = g_vectorZero.x; (this->_targetPosition).y = g_vectorZero.y; isFiring = '\x01'; } } else { isFiring = isNoOtherCharging; } if ((this->_fireCooldown < 1) && (isFiring != '\0')) { iVar6 = this->_variant; local_30 = (EntityPtr)0x41200000; if (iVar6 == 0x68) { local_30 = (EntityPtr)0x40400000; } else if (iVar6 == 0xdf) { local_30 = (EntityPtr)0x41880000; } this->_fireCooldown = -1; if (isLilithIncubus == 0) { if ((iVar6 == 0x82) || (iVar8 = 4, iVar6 == 0xdf)) { iVar8 = 3; } } else { iVar8 = 0; } this->_entityGridCollisionClass = iVar8; pVVar3 = &this->_velocity; pvVar1 = this->_player; velocityX = local_1c.x * (float)local_30; pVVar3->x = velocityX; (this->_velocity).y = local_1c.y * (float)local_30; fVar10 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x360)); fVar11 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x364)); if ((local_24 == (EntityPtr)0x0) || (local_24 == (EntityPtr)0x2)) { fVar10 = 0.0; } else { fVar11 = 0.0; } if (this->_variant == 0x68) { fVar11 = fVar11 * 0.2; velocityX = fVar10 * 0.2 + fVar10 * 0.2 + velocityX; pVVar3->x = velocityX; } else { fVar11 = fVar11 * 0.6; velocityX = fVar10 * 0.6 + fVar10 * 0.6 + velocityX; pVVar3->x = velocityX; } fVar10 = fVar11 + fVar11 + local_1c.y * (float)local_30; (this->_velocity).y = fVar10; if (fVar10 * fVar10 + velocityX * velocityX < (float)local_30 * (float)local_30) { pVVar7 = (GHIDRA_CAST((pVVar3)))->Vector::Normalized(&scratchVec); fVar10 = pVVar7->y; pVVar3->x = (float)local_30 * pVVar7->x; (this->_velocity).y = (float)local_30 * fVar10; } iVar6 = this->_variant; this->_friction = 1.0; if (iVar6 == 0x82) { if (this->_target != (EntityPtr)0x0) { local_34 = (EntityPtr)&this->_target; std::multiset::erase(&local_34); iVar6 = this->_variant; } this->_target = (EntityPtr)0x0; } manager = g_manager; if (iVar6 == 0x68) { local_30 = (EntityPtr)0x343; seed_fart_sound_override(GHIDRA_CAST(&local_30)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_30),1.0,0x1c2,0,1.0,0.0); iVar6 = this->_variant; } manager = g_manager; if (iVar6 == 3) { local_30 = (EntityPtr)0x351; seed_fart_sound_override(GHIDRA_CAST(&local_30)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_30),1.0,0x1c2,0,1.0,0.0); } } } LAB_00618988: iVar6 = 0; if (this->_variant == 0x82) { iVar6 = 4; } this->_entityCollisionClass = iVar6; ExceptionList = local_10; return; } // 00619270 void Entity_Familiar::ai_auto_shooter() { Vector *pVVar1; qword qVar2; byte bVar3; char isLastRef; int iVar4; Entity_Tear *tear; LayerState *layer; int *texture; qword *allocCounter; byte *anim; float fVar5; Entity *pEVar6; undefined4 uVar7; TypeDescriptor *pTVar8; TypeDescriptor *pTVar9; char *anim_00; undefined4 uVar10; EntityList_EL enemyList; Vector local_24; Vector local_1c; Entity *local_14; void *local_10; undefined1 *puStack_c; undefined4 local_8; uint blockSize; local_8 = 0xffffffff; puStack_c = &LAB_00af6b15; local_10 = ExceptionList; ExceptionList = &local_10; FollowParent(this); iVar4 = apply_forgotten_lullaby(this,10); bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(iVar4,0); if (bVar3 != 0) { local_14 = GHIDRA_CAST(0x0); EntityList::QueryRadius (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&enemyList,&this->_pos,150.0,8); local_8 = 0; local_1c.y = 0.0; if ((float)enemyList._size != 0.0) { do { pEVar6 = *GHIDRA_CAST((GHIDRA_CAST(enemyList._data) + GHIDRA_INT(local_1c.y) * 4)); bVar3 = (GHIDRA_CAST((pEVar6)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); if ((bVar3 != 0) && (((this->_spawnerEntity == (EntityPtr)0x0 || (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this->_spawnerEntity))))->Entity::IsDescendantOf(pEVar6), bVar3 == 0)) && ((pEVar6->_flags & 0x20000010) == 0)))) { local_24.y = (pEVar6->_pos).y; local_24.x = (pEVar6->_pos).x; bVar3 = (GHIDRA_CAST((g_game->_room)))->Room::CheckLine(&this->_pos,&local_24,3,900,0,0,GHIDRA_CAST(0x0)); if (bVar3 != 0) { local_14 = pEVar6; } } local_1c.y = (float)(GHIDRA_INT(local_1c.y) + 1); } while (GHIDRA_UINT(local_1c.y) < GHIDRA_UINT(enemyList._size)); if (local_14 != GHIDRA_CAST(0x0)) { iVar4 = 0; local_1c.y = (local_14->_pos).x - (this->_pos).x; local_14 = GHIDRA_CAST(((local_14->_pos).y - (this->_pos).y)); if (ABS(local_1c.y) <= ABS((float)local_14)) { iVar4 = GHIDRA_UINT((0.0 < (float)local_14)) * 2 + 1; } else if (0.0 < local_1c.y) { iVar4 = 2; } this->_headFrameDelay = 0xc; PlayShootAnim(this,iVar4); local_24.y = (float)Random(); fVar5 = sqrtf(local_1c.y * local_1c.y + (float)local_14 * (float)local_14); pEVar6 = local_14; if (0.0 < fVar5) { local_1c.y = local_1c.y * (1.0 / fVar5); pEVar6 = GHIDRA_CAST(((float)local_14 * (1.0 / fVar5))); } local_1c.x = local_1c.y * 8.0; local_1c.y = (float)pEVar6 * 8.0; uVar10 = 0; pTVar9 = &IsaacRepentancePlus::Entity_Tear::RTTI_Type_Descriptor; pTVar8 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; uVar7 = 0; pEVar6 = (GHIDRA_CAST((g_game)))->Game::Spawn(2,1,&this->_pos,&local_1c,GHIDRA_CAST(this),0,GHIDRA_UINT(local_24.y)); tear = GHIDRA_CAST(__RTDynamicCast(pEVar6,uVar7,pTVar8,pTVar9,uVar10)); tear->_fallingSpeed = 1.2; local_24.y = apply_tear_modifiers(this); fVar5 = apply_tear_modifiers(this); local_1c.y = fVar5 * 0.35 + 0.55; tear->SetCollisionDamage(local_24.y * 3.0); local_24.y = local_1c.y; local_1c.y = 0.01; pVVar1 = &local_24; if (local_24.y <= 0.01) { pVVar1 = &local_1c; } fVar5 = pVVar1->y; tear->_baseScale = fVar5; tear->_fScale = fVar5; (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); TryFireTear(this,tear); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); } } mongo_baby_pick_next_mimic(this); local_8 = 0xffffffff; if ((*GHIDRA_CAST((GHIDRA_CAST(&(enemyList)) + 0x0))) == '\0') { if (g_mainHeap == (void *)0x0) { allocCounter = &g_allocatedBytesNoHeap; } else { allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); } if (enemyList._data != (void *)0x0) { blockSize = *GHIDRA_CAST((GHIDRA_CAST(enemyList._data) + -4)); qVar2 = *allocCounter; *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - blockSize; *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < blockSize)); free((void *)(GHIDRA_INT(enemyList._data) + -4)); } local_8 = 0xffffffff; } } if (0 < this->_headFrameDelay) { this->_headFrameDelay = this->_headFrameDelay + -1; ExceptionList = local_10; return; } iVar4 = this->_variant; if (iVar4 != 0x58) { if (iVar4 == 0xce) { layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); texture = (GHIDRA_CAST((layer)))->LayerState::GetTexture(&local_24); local_8 = 2; anim = s_Idle2; if (*GHIDRA_CAST((*texture + 0x10)) < 0x81) { anim = s_Idle; } (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(anim,0); local_8 = 3; if (((GHIDRA_CAST(local_24.y) != GHIDRA_CAST(0x0)) && (isLastRef = (**(code **)(*GHIDRA_CAST(local_24.y) + 0xc))(), isLastRef != '\0')) && (g_imageReleaseFn != (void *)0x0)) { (*g_imageReleaseFn)(&local_24); ExceptionList = local_10; return; } } else { if (iVar4 == 0xed) { (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(s_Idle,0); ExceptionList = local_10; return; } if (iVar4 != 0xee) { (this->_sprite)._flipX = 0; if (iVar4 == 0x4c) { anim_00 = "Float"; } else if (((iVar4 == 6) || (iVar4 == 0x35)) || ((iVar4 != 0x6d || (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x162c)) == -1)))) { anim_00 = "FloatDown"; } else { anim_00 = "StoppedDown"; } (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST(anim_00),0); } } } ExceptionList = local_10; return; } // 0061a240 void Entity_Familiar::ai_blue_babys_only_friend() { Vector *pVVar1; float fVar2; float fVar3; float fVar4; Vector local_18; Vector local_10; Game *game; float velX; (GHIDRA_CAST((this->_player)))->Entity_Player::GetShootingJoystick(&local_10); fVar2 = local_10.x; if (this->_collidesWithGrid != 0) { (this->_velocity).x = (this->_velocity).x * 0.88; (this->_velocity).y = (this->_velocity).y * 0.88; } fVar4 = 0.0; if (local_10.x == 0.0) { if (local_10.y == 0.0) goto LAB_0061a315; LAB_0061a2e5: if (local_10.x != 0.0) goto LAB_0061a315; fVar4 = (this->_velocity).y; (this->_velocity).x = (this->_velocity).x * 0.5; } else { if (local_10.y != 0.0) goto LAB_0061a2e5; fVar4 = (this->_velocity).x; (this->_velocity).y = (this->_velocity).y * 0.5; } fVar4 = ABS(fVar4); LAB_0061a315: game = g_game; fVar3 = (this->_velocity).y; velX = (this->_velocity).x; local_18.x = 0.0; local_10.x = -(fVar3 * local_10.y + velX * local_10.x) * 0.2; pVVar1 = &local_10; if (local_10.x <= 0.0) { pVVar1 = &local_18; } fVar4 = (fVar4 * 0.3 * 0.1 + pVVar1->x + 3.0) * 0.8; (this->_velocity).y = (fVar4 * local_10.y + fVar3) * 0.775; (this->_velocity).x = (fVar4 * fVar2 + velX) * 0.775; Room::GetClampedPositionImpl(game->_room,&local_18,&this->_pos,0.0,0.0,0.0,0.0); local_10.x = local_18.x - (this->_pos).x; local_18.x = local_18.y - (this->_pos).y; if ((local_10.x != g_vectorZero.x) || (local_18.x != g_vectorZero.y)) { fVar2 = sqrtf(local_18.x * local_18.x + local_10.x * local_10.x); if (0.0 < fVar2) { local_10.x = local_10.x * (1.0 / fVar2); local_18.x = local_18.x * (1.0 / fVar2); } fVar2 = (this->_velocity).x; fVar4 = this->_speedMultiplier; fVar3 = -(local_18.x * (this->_velocity).y + fVar2 * local_10.x); if (fVar3 <= 1.0) { fVar3 = 1.0; } if (10.0 <= fVar3) { fVar3 = 10.0; } (this->_velocity).x = local_10.x * fVar3 * fVar4 + fVar2; (this->_velocity).y = local_18.x * fVar3 * fVar4 + (this->_velocity).y; } return; } // 0061a4e0 void Entity_Familiar::ai_pickup_sack() { void **ppvVar1; code *pcVar2; Vector targetPos; byte bVar3; Entity *pEVar4; byte *curAnimName; uint uVar5; EntityPtr *pEVar6; Entity *shot; int spawnsLeft; int iVar7; uint variantRoll; byte *curAnimNameChar; char *targetAnimNameChar; byte *spawnAnimNameChar; qword *allocatedBytes; RNG *dropRng; int iVar8; bool bVar9; float fVar10; float fVar11; EntityPtr *dirY; Vector dropPos; Vector heartPos; Vector cardPos; Vector pillPos; Vector pickupPos; EntityList_EL familiars; EntityList_EL nearbyPickups; Vector dropMidpoint; Vector heartMidpoint; Vector cardMidpoint; Vector pillMidpoint; Vector spiderMidpoint; Vector pickupMidpoint; Vector local_30; float local_28 [2]; ItemPool *local_20; float local_1c; EntityPtr *local_18; EntityPtr *local_14; void *local_10; undefined1 *puStack_c; float local_8; Game *game; Manager *manager; Entity_Familiar *otherFamiliar; qword prevAllocatedBytes; EntityPtr target; local_8 = -NAN; puStack_c = &LAB_00af6b95; local_10 = ExceptionList; ExceptionList = &local_10; target = this->_target; pEVar6 = &this->_target; if ((target == (EntityPtr)0x0) || (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x173)) != '\0')) { local_18 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); local_14 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); local_1c = 80.0; EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&familiars,3,-1,-1,1,0); local_8 = 0.0; uVar5 = 0; if (familiars._size != 0) { do { otherFamiliar = *GHIDRA_CAST((GHIDRA_CAST(familiars._data) + uVar5 * 4)); if (otherFamiliar->_exists != 0) { iVar8 = otherFamiliar->_variant; if ((((iVar8 == 0x18) || (iVar8 == 0x40)) || (iVar8 == 0x5a)) || ((iVar8 == 0x66 || (iVar8 == 0x58)))) { if (otherFamiliar == this) break; local_18 = GHIDRA_CAST((otherFamiliar->_pos).x); local_14 = GHIDRA_CAST((otherFamiliar->_pos).y); local_1c = 50.0; } else if (otherFamiliar == this) break; } uVar5 = uVar5 + 1; } while (uVar5 < GHIDRA_UINT(familiars._size)); } local_28[0] = (this->_pos).y; local_14 = GHIDRA_CAST(((float)local_14 - local_28[0])); local_18 = GHIDRA_CAST(((float)local_18 - (this->_pos).x)); local_28[0] = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) - local_28[0]; local_30.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) - (this->_pos).x; local_20 = (ItemPool *) sqrtf((float)local_14 * (float)local_14 + (float)local_18 * (float)local_18); fVar11 = sqrtf(local_28[0] * local_28[0] + local_30.y * local_30.y); if (80.0 <= fVar11) { if (local_1c < (float)local_20) { (this->_velocity).x = ((float)local_18 / (float)local_20) * 0.8 + (this->_velocity).x; (this->_velocity).y = ((float)local_14 / (float)local_20) * 0.8 + (this->_velocity).y; } } else if ((((5 < this->_coins) || (2 < this->_hearts)) || (this->_state < this->_keys)) && (((this->_sprite)._animState._animData != (void *)0x0 && ((this->_sprite)._animState._isPlaying != 0)))) { curAnimName = (this->_sprite)._animState._animData; if (0xf < *GHIDRA_CAST((curAnimName + 0x14))) { curAnimName = *GHIDRA_CAST(curAnimName); } targetAnimNameChar = "FloatDown"; do { bVar3 = *curAnimName; bVar9 = bVar3 < (byte)*targetAnimNameChar; if (bVar3 != *targetAnimNameChar) { LAB_0061a861: uVar5 = -GHIDRA_UINT(bVar9) | 1; goto LAB_0061a866; } if (bVar3 == 0) break; bVar3 = curAnimName[1]; bVar9 = bVar3 < (byte)targetAnimNameChar[1]; if (bVar3 != targetAnimNameChar[1]) goto LAB_0061a861; curAnimName = curAnimName + 2; targetAnimNameChar = targetAnimNameChar + 2; } while (bVar3 != 0); uVar5 = 0; LAB_0061a866: if ((uVar5 == 0) && (bVar3 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST("PreSpawn"),1), bVar3 != 0)) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } } local_8 = -NAN; if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x0))) == '\0') { if (g_mainHeap == (void *)0x0) { allocatedBytes = &g_allocatedBytesNoHeap; } else { allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); } if (familiars._data != (void *)0x0) { uVar5 = *GHIDRA_CAST((GHIDRA_CAST(familiars._data) + -4)); prevAllocatedBytes = *allocatedBytes; *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar5; *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevAllocatedBytes) < uVar5)); free(GHIDRA_CAST((GHIDRA_INT(familiars._data) + -4))); } local_8 = -NAN; } LAB_0061a925: this->_friction = this->_friction * 0.8; bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(5,0); if (bVar3 != 0) goto LAB_0061a950; } else { local_18 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(target) + 0x340)) - (this->_pos).y)); local_14 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(target) + 0x33c)) - (this->_pos).x)); fVar11 = (float)local_18 * (float)local_18 + (float)local_14 * (float)local_14; if (100.0 <= fVar11) { fVar11 = sqrtf(fVar11); pEVar6 = local_14; dirY = local_18; if (0.0 < fVar11) { dirY = GHIDRA_CAST(((float)local_18 * (1.0 / fVar11))); pEVar6 = GHIDRA_CAST(((float)local_14 * (1.0 / fVar11))); } (this->_velocity).x = (float)pEVar6 * 1.1 + (this->_velocity).x; (this->_velocity).y = (float)dirY * 1.1 + (this->_velocity).y; goto LAB_0061a925; } (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::collide_with_entity(__security_cookie ^ GHIDRA_UINT((local_28 + 9))); target = *pEVar6; if (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x173)) == 0) { if ((((target != (EntityPtr)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x28)) == 5)) && (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x2c)) == 0x14)) && (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x30)) == 6)) { uVar5 = (GHIDRA_CAST((GHIDRA_CAST(target))))->Entity::GetHitListIndex(); sorted_vector_insert_unique(&this->_hitList,uVar5); if (*pEVar6 != (EntityPtr)0x0) { local_18 = pEVar6; std::multiset::erase(&local_18); } *pEVar6 = (EntityPtr)0x0; } goto LAB_0061a925; } if (target != (EntityPtr)0x0) { local_14 = pEVar6; std::multiset::erase(&local_14); } *pEVar6 = (EntityPtr)0x0; this->_friction = this->_friction * 0.8; LAB_0061a950: if (this->_target == (EntityPtr)0x0) { local_1c = 40000.0; EntityList::QueryRadius (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&nearbyPickups,&this->_pos,200.0,0x10); local_8 = 2.8026e-45; local_14 = GHIDRA_CAST(0x0); if (GHIDRA_CAST(nearbyPickups._size) != GHIDRA_CAST(0x0)) { do { iVar8 = *GHIDRA_CAST((GHIDRA_CAST(nearbyPickups._data) + GHIDRA_INT(local_14) * 4)); if (*GHIDRA_CAST((iVar8 + 0x28)) == 5) { pEVar4 = (Entity *) __RTDynamicCast(iVar8,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Pickup::RTTI_Type_Descriptor,0); iVar8 = this->_variant; if (((((iVar8 == 0x18) || (iVar8 == 0x66)) && (pEVar4->_variant == 0x14)) || (((((iVar8 == 0x40 || (iVar8 == 0x66)) && (pEVar4->_variant == 10)) && ((((iVar7 = pEVar4->_subtype, iVar7 == 1 || (iVar7 == 2)) || (iVar7 == 5)) || (iVar7 == 9)))) || (((iVar8 == 0x5a || (iVar8 == 0x66)) && ((pEVar4->_variant == 0x1e && (pEVar4->_subtype != 2)))))))) && (((pEVar4->_dead == 0 && (pEVar4[1]._sprite._championColor._tint[2] == 0.0)) && (((bVar3 = (GHIDRA_CAST((GHIDRA_CAST(&this->_hitList))))->EntityList::HitListContains(pEVar4), bVar3 == 0 || ((pEVar4->_variant == 0x14 && (pEVar4->_subtype == 2)))) && (fVar11 = (pEVar4->_pos).x - (this->_pos).x, fVar10 = (pEVar4->_pos).y - (this->_pos).y, local_30.y = fVar10 * fVar10 + fVar11 * fVar11, local_30.y < local_1c)))))) { pEVar6 = &this->_target; if (this->_target != (EntityPtr)0x0) { local_20 = GHIDRA_CAST(pEVar6); std::multiset::erase(&local_20); } *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar6)) + 0x0)))) = pEVar4; std::multiset::insert(pEVar6); local_1c = local_30.y; } } local_14 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_14)) + 0x1)))); } while (local_14 < GHIDRA_UINT(nearbyPickups._size)); } local_8 = -NAN; if ((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyPickups)) + 0x0))) == '\0') { if (g_mainHeap == (void *)0x0) { allocatedBytes = &g_allocatedBytesNoHeap; } else { allocatedBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); } if (nearbyPickups._data != (void *)0x0) { uVar5 = *GHIDRA_CAST((GHIDRA_CAST(nearbyPickups._data) + -4)); prevAllocatedBytes = *allocatedBytes; *GHIDRA_CAST(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar5; *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevAllocatedBytes) < uVar5)); free((void *)(GHIDRA_INT(nearbyPickups._data) + -4)); } local_8 = -NAN; } } } if (((this->_sprite)._animState._animData == (void *)0x0) || ((this->_sprite)._animState._isPlaying != 0)) { LAB_0061b7e0: curAnimName = (this->_sprite)._animState._animData; if ((curAnimName != GHIDRA_CAST(0x0)) && ((this->_sprite)._animState._isPlaying == 0)) { curAnimNameChar = curAnimName; if (0xf < *GHIDRA_CAST((curAnimName + 0x14))) { curAnimNameChar = *GHIDRA_CAST(curAnimName); } spawnAnimNameChar = s_Spawn; do { bVar3 = *curAnimNameChar; bVar9 = bVar3 < *spawnAnimNameChar; if (bVar3 != *spawnAnimNameChar) { LAB_0061b827: uVar5 = -GHIDRA_UINT(bVar9) | 1; goto LAB_0061b82c; } if (bVar3 == 0) break; bVar3 = curAnimNameChar[1]; bVar9 = bVar3 < spawnAnimNameChar[1]; if (bVar3 != spawnAnimNameChar[1]) goto LAB_0061b827; curAnimNameChar = curAnimNameChar + 2; spawnAnimNameChar = spawnAnimNameChar + 2; } while (bVar3 != 0); uVar5 = 0; LAB_0061b82c: if (uVar5 == 0) { curAnimNameChar = curAnimName; if (0xf < *GHIDRA_CAST((curAnimName + 0x14))) { curAnimNameChar = *GHIDRA_CAST(curAnimName); } targetAnimNameChar = "FloatDown"; do { bVar3 = *curAnimNameChar; bVar9 = bVar3 < (byte)*targetAnimNameChar; if (bVar3 != *targetAnimNameChar) { LAB_0061b860: uVar5 = -GHIDRA_UINT(bVar9) | 1; goto LAB_0061b865; } if (bVar3 == 0) break; bVar3 = curAnimNameChar[1]; bVar9 = bVar3 < (byte)targetAnimNameChar[1]; if (bVar3 != targetAnimNameChar[1]) goto LAB_0061b860; curAnimNameChar = curAnimNameChar + 2; targetAnimNameChar = targetAnimNameChar + 2; } while (bVar3 != 0); uVar5 = 0; LAB_0061b865: if (((uVar5 != 0) || (curAnimName[0x34] != 0)) && (bVar3 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST("FloatDown"),1), bVar3 != 0)) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } } } ExceptionList = local_10; return; } curAnimName = (this->_sprite)._animState._animData; if (0xf < *GHIDRA_CAST((curAnimName + 0x14))) { curAnimName = *GHIDRA_CAST(curAnimName); } targetAnimNameChar = "PreSpawn"; do { bVar3 = *curAnimName; bVar9 = bVar3 < (byte)*targetAnimNameChar; if (bVar3 != *targetAnimNameChar) { LAB_0061ab77: uVar5 = -GHIDRA_UINT(bVar9) | 1; goto LAB_0061ab7c; } if (bVar3 == 0) break; bVar3 = curAnimName[1]; bVar9 = bVar3 < (byte)targetAnimNameChar[1]; if (bVar3 != targetAnimNameChar[1]) goto LAB_0061ab77; curAnimName = curAnimName + 2; targetAnimNameChar = targetAnimNameChar + 2; } while (bVar3 != 0); uVar5 = 0; LAB_0061ab7c: if (uVar5 != 0) goto LAB_0061b7e0; bVar3 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(s_Spawn,1); if (bVar3 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } local_28[0] = 0.0; iVar8 = this->_variant; if (iVar8 == 0x66) { if (this->_coins < 6) { if (this->_hearts < 3) goto LAB_0061b57f; goto LAB_0061b0d0; } } else if (iVar8 != 0x18) { if (iVar8 != 0x40) { if (iVar8 != 0x5a) { ExceptionList = local_10; return; } LAB_0061b57f: bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0); uVar5 = (this->_dropRNG)._seed; if (bVar3 == 0) { if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); uVar5 = (this->_dropRNG)._seed; if (uVar5 == 0) { pcVar2 = (code *)swi(3); (*pcVar2)(); return; } } uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ uVar5; uVar5 = uVar5 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5; (this->_dropRNG)._seed = uVar5; iVar7 = this->_keys + -4; iVar8 = 0; if (0 < iVar7) { iVar8 = iVar7; } uVar5 = uVar5 & 3; } else { if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); uVar5 = (this->_dropRNG)._seed; if (uVar5 == 0) { pcVar2 = (code *)swi(3); (*pcVar2)(); return; } } uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ uVar5; uVar5 = uVar5 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5; (this->_dropRNG)._seed = uVar5; iVar7 = this->_keys + -3; iVar8 = 0; if (0 < iVar7) { iVar8 = iVar7; } uVar5 = uVar5 % 3; } this->_state = uVar5 + 2; this->_keys = iVar8; iVar8 = (this->_variant == 0x66) + 1; while( true ) { dropMidpoint.x = (this->_pos).x * 0.5 + *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) * 0.5; dropMidpoint.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) * 0.5 + (this->_pos).y * 0.5; Room::FindFreePickupSpawnPosition(g_game->_room,&dropPos,&dropMidpoint,0.0,0,0,0); uVar5 = (this->_dropRNG)._seed; if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); uVar5 = (this->_dropRNG)._seed; if (uVar5 == 0) { pcVar2 = (code *)swi(3); (*pcVar2)(); return; } } uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ uVar5; uVar5 = uVar5 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5; (this->_dropRNG)._seed = uVar5; variantRoll = uVar5; if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); variantRoll = (this->_dropRNG)._seed; } if (variantRoll == 0) break; variantRoll = variantRoll >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ variantRoll; variantRoll = variantRoll << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ variantRoll; variantRoll = variantRoll >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ variantRoll; (this->_dropRNG)._seed = variantRoll; (GHIDRA_CAST((g_game)))->Game::Spawn(5,*GHIDRA_CAST((&DAT_00b62fd0 + (variantRoll % 3) * 4)),&dropPos,&g_vectorZero ,GHIDRA_CAST(0x0),0,uVar5); iVar8 = iVar8 + -1; if (iVar8 == 0) { ExceptionList = local_10; return; } } pcVar2 = (code *)swi(3); (*pcVar2)(); return; } LAB_0061b0d0: this->_hearts = this->_hearts + -3; dropRng = &this->_dropRNG; uVar5 = dropRng->_seed; if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); uVar5 = dropRng->_seed; if (uVar5 == 0) { pcVar2 = (code *)swi(3); (*pcVar2)(); return; } } uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ uVar5; uVar5 = uVar5 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5; dropRng->_seed = uVar5; if ((uVar5 % 10 == 0) && (bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0), bVar3 == 0)) { this->_hearts = this->_hearts + -1; } manager = g_manager; local_28[0] = 1.19531e-42; seed_fart_sound_override(GHIDRA_CAST(local_28)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_28[0]),1.0,2,0,1.0,0.0); uVar5 = dropRng->_seed; if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); uVar5 = dropRng->_seed; if (uVar5 == 0) { pcVar2 = (code *)swi(3); (*pcVar2)(); return; } } uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ uVar5; uVar5 = uVar5 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; local_20 = GHIDRA_CAST((uVar5 >> ((byte)(this->_dropRNG)._shift3 & 0x1f))); uVar5 = GHIDRA_UINT(local_20) ^ uVar5; dropRng->_seed = uVar5; uVar5 = uVar5 % 5; if (uVar5 != 0) { if (uVar5 == 1) { pillMidpoint.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) * 0.5 + (this->_pos).x * 0.5; pillMidpoint.y = (this->_pos).y * 0.5 + *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) * 0.5; Room::FindFreePickupSpawnPosition(g_game->_room,&pillPos,&pillMidpoint,0.0,0,0,0); uVar5 = (GHIDRA_CAST((dropRng)))->RNG::Next(); (GHIDRA_CAST((g_game)))->Game::Spawn(5,0x46,&pillPos,&g_vectorZero,GHIDRA_CAST(this),0,uVar5); ExceptionList = local_10; return; } if (uVar5 == 2) { cardMidpoint.x = (this->_pos).x * 0.5 + *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) * 0.5; cardMidpoint.y = (this->_pos).y * 0.5 + *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) * 0.5; Room::FindFreePickupSpawnPosition(g_game->_room,&cardPos,&cardMidpoint,0.0,0,0,0); uVar5 = (GHIDRA_CAST((dropRng)))->RNG::Next(); (GHIDRA_CAST((g_game)))->Game::Spawn(5,300,&cardPos,&g_vectorZero,GHIDRA_CAST(this),0,uVar5); ExceptionList = local_10; return; } spawnsLeft = (this->_variant == 0x66) + 1; local_20 = GHIDRA_CAST(spawnsLeft); do { heartMidpoint.x = (this->_pos).x * 0.5 + *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) * 0.5; heartMidpoint.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) * 0.5 + (this->_pos).y * 0.5; Room::FindFreePickupSpawnPosition(g_game->_room,&heartPos,&heartMidpoint,0.0,0,0,0); uVar5 = dropRng->_seed; if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); uVar5 = dropRng->_seed; if (uVar5 == 0) { pcVar2 = (code *)swi(3); (*pcVar2)(); return; } } game = g_game; uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ uVar5; uVar5 = uVar5 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5; dropRng->_seed = uVar5; (GHIDRA_CAST((game)))->Game::Spawn(5,10,&heartPos,&g_vectorZero,GHIDRA_CAST(this),6,uVar5); spawnsLeft = spawnsLeft + -1; } while (spawnsLeft != 0); ExceptionList = local_10; return; } spiderMidpoint.x = (this->_pos).x * 0.5 + *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) * 0.5; spiderMidpoint.y = (this->_pos).y * 0.5 + *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) * 0.5; Room::FindFreePickupSpawnPosition(g_game->_room,&local_30,&spiderMidpoint,0.0,0,0,0); uVar5 = dropRng->_seed; if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); uVar5 = dropRng->_seed; if (uVar5 == 0) { pcVar2 = (code *)swi(3); (*pcVar2)(); return; } } uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ uVar5; uVar5 = uVar5 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5; dropRng->_seed = uVar5; if ((uVar5 & 1) == 0) { pEVar4 = this->_player; ppvVar1 = &pEVar4[4]._config; *ppvVar1 = (void *)(GHIDRA_INT(*ppvVar1) + 1); spawn_blue_spider(&local_30,pEVar4,&g_vectorZero); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(shot); ExceptionList = local_10; return; } targetPos.y = local_30.y; targetPos.x = local_30.x; Entity_NPC::ThrowSpider(&this->_pos,GHIDRA_CAST(this),targetPos,0,-30.0); ExceptionList = local_10; return; } bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0); if (bVar3 == 0) { uVar5 = (this->_dropRNG)._seed; if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); uVar5 = (this->_dropRNG)._seed; if (uVar5 == 0) { pcVar2 = (code *)swi(3); (*pcVar2)(); return; } } uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ uVar5; uVar5 = uVar5 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5; (this->_dropRNG)._seed = uVar5; local_18 = GHIDRA_CAST(((uVar5 & 1) + 3)); } else { local_18 = GHIDRA_CAST(0x3); } if ((this->_coins < 10) || (this->_subtype != 0)) { LAB_0061acb1: uVar5 = (this->_dropRNG)._seed; dropRng = &this->_dropRNG; if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); uVar5 = dropRng->_seed; if (uVar5 == 0) { pcVar2 = (code *)swi(3); (*pcVar2)(); return; } } uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ uVar5; uVar5 = uVar5 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5; dropRng->_seed = uVar5; if (uVar5 != (uVar5 / 100) * 100) { if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); uVar5 = dropRng->_seed; if (uVar5 == 0) { pcVar2 = (code *)swi(3); (*pcVar2)(); return; } } uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ uVar5; uVar5 = uVar5 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; pEVar6 = GHIDRA_CAST((uVar5 >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5)); dropRng->_seed = GHIDRA_INT(pEVar6); local_14 = pEVar6; if ((GHIDRA_UINT(pEVar6) & 1) == 0) { if (pEVar6 == GHIDRA_CAST(0x0)) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pEVar6 = GHIDRA_CAST(dropRng->_seed); if (pEVar6 == GHIDRA_CAST(0x0)) { pcVar2 = (code *)swi(3); (*pcVar2)(); return; } } uVar5 = GHIDRA_UINT(pEVar6) >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ GHIDRA_UINT(pEVar6); uVar5 = uVar5 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5; dropRng->_seed = uVar5; local_14 = GHIDRA_CAST((uVar5 % 3)); pEVar6 = local_14; if (local_14 == GHIDRA_CAST(0x0)) { bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x16,0); if ((bVar3 == 0) || (uVar5 = Random(), uVar5 % 5 == 0)) { pEVar6 = local_14; } else { uVar5 = (GHIDRA_CAST((dropRng)))->RNG::RandomInt(2); pEVar6 = GHIDRA_CAST((uVar5 + 1)); } } if (pEVar6 == GHIDRA_CAST(0x0)) { fVar11 = 1.4013e-44; } else if (pEVar6 == GHIDRA_CAST(0x1)) { fVar11 = 4.2039e-44; } else if (pEVar6 == GHIDRA_CAST(0x2)) { fVar11 = 5.60519e-44; } else { fVar11 = 0.0; } } else { if (pEVar6 == GHIDRA_CAST(0x0)) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); local_14 = GHIDRA_CAST(dropRng->_seed); if (local_14 == GHIDRA_CAST(0x0)) { pcVar2 = (code *)swi(3); (*pcVar2)(); return; } } uVar5 = GHIDRA_UINT(local_14) >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ GHIDRA_UINT(local_14); uVar5 = uVar5 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5; dropRng->_seed = uVar5; if (uVar5 == (uVar5 / 3) * 3) { fVar11 = 4.90454e-43; } else { if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); uVar5 = dropRng->_seed; if (uVar5 == 0) { pcVar2 = (code *)swi(3); (*pcVar2)(); return; } } uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ uVar5; uVar5 = uVar5 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5; dropRng->_seed = uVar5; switch(uVar5 & 3) { case 0: fVar11 = 9.80909e-44; break; case 1: fVar11 = 4.2039e-43; break; default: fVar11 = 1.26117e-43; } } } goto LAB_0061af9a; } } else { uVar5 = (this->_dropRNG)._seed; if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); uVar5 = (this->_dropRNG)._seed; if (uVar5 == 0) { pcVar2 = (code *)swi(3); (*pcVar2)(); return; } } uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ uVar5; uVar5 = uVar5 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5; (this->_dropRNG)._seed = uVar5; if (uVar5 != (uVar5 / 3) * 3) goto LAB_0061acb1; } local_20 = &g_game->_itemPool; local_30.y = 1.4013e-43; if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); uVar5 = (this->_dropRNG)._seed; } if (uVar5 == 0) { pcVar2 = (code *)swi(3); (*pcVar2)(); return; } uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ uVar5; uVar5 = uVar5 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5; (this->_dropRNG)._seed = uVar5; local_28[0] = (float)ItemPool::GetCollectible(local_20,10,uVar5,0,0,0); manager = g_manager; local_18 = GHIDRA_CAST(0xa); this->_subtype = 1; local_1c = 3.75548e-43; seed_fart_sound_override(GHIDRA_CAST(&local_1c)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_1c),1.0,2,0,1.0,0.0); fVar11 = local_30.y; LAB_0061af9a: dropRng = &this->_dropRNG; iVar7 = this->_coins - GHIDRA_INT(local_18); iVar8 = 0; if (0 < iVar7) { iVar8 = iVar7; } this->_coins = iVar8; local_1c = (float)((this->_variant == 0x66) + 1); do { pickupMidpoint.x = (this->_pos).x * 0.5 + *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) * 0.5; pickupMidpoint.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) * 0.5 + (this->_pos).y * 0.5; Room::FindFreePickupSpawnPosition(g_game->_room,&pickupPos,&pickupMidpoint,0.0,0,0,0); uVar5 = dropRng->_seed; if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); uVar5 = dropRng->_seed; if (uVar5 == 0) { pcVar2 = (code *)swi(3); (*pcVar2)(); return; } } game = g_game; uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ uVar5; uVar5 = uVar5 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5; dropRng->_seed = uVar5; (GHIDRA_CAST((game)))->Game::Spawn(5,GHIDRA_UINT(fVar11),&pickupPos,&g_vectorZero,GHIDRA_CAST(this),GHIDRA_UINT(local_28[0]),uVar5) ; local_1c = (float)(GHIDRA_INT(local_1c) + -1); } while (local_1c != 0.0); ExceptionList = local_10; return; } // 0061b8c0 void Entity_Familiar::ai_flying_bird() { byte bVar1; int *mapEntry; byte *curAnimName; uint uVar2; char *animName; byte *idleAnimName; bool isLess; float fVar3; float fVar4; float acceleration; float local_44 [2]; float local_3c; float friction; Color color; byte *animData; Manager *manager; EntityPtr target; int variant; acceleration = 1.0; friction = 0.9; if (this->_variant == 0xd2) { PickEnemyTarget(this,360.0,0xd,4,&g_vectorZero,15.0); acceleration = 0.8; friction = 0.8; LAB_0061b99b: if (((this->_variant == 0x3f) && (1 < *GHIDRA_CAST(&g_game->_deathmatchManager))) && (this->_target != (EntityPtr)0x0)) { local_3c = *GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x20)); mapEntry = GHIDRA_CAST(std)::map::try_emplace(local_44,&local_3c); if (599 < *GHIDRA_CAST((*mapEntry + 0x14))) { local_3c = *GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x20)); mapEntry = GHIDRA_CAST(std)::map::try_emplace(local_44,&local_3c); *GHIDRA_CAST((*mapEntry + 0x14)) = 0xfffffc7c; } } } else { target = this->_target; PickEnemyTarget(this,300.0,0xd,0,&g_vectorZero,15.0); manager = g_manager; if ((target != (EntityPtr)0x0) || (this->_target == (EntityPtr)0x0)) goto LAB_0061b99b; if (this->_variant == 0x3f) { local_44[0] = 1.20372e-42; seed_fart_sound_override(GHIDRA_CAST(local_44)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_44[0]),1.0,0x1c2,0,1.0,0.0); goto LAB_0061b99b; } } target = this->_target; if (target == (EntityPtr)0x0) { local_44[0] = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) - (this->_pos).y; local_3c = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) - (this->_pos).x; fVar4 = local_44[0] * local_44[0] + local_3c * local_3c; if (6400.0 < fVar4) { fVar4 = sqrtf(fVar4); if (fVar4 <= 0.0) { fVar4 = local_3c; fVar3 = local_44[0]; } else { fVar3 = local_44[0] * (1.0 / fVar4); fVar4 = (1.0 / fVar4) * local_3c; } goto LAB_0061bb14; } } else { local_44[0] = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x33c)) - (this->_pos).x; local_3c = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x340)) - (this->_pos).y; fVar3 = sqrtf(local_44[0] * local_44[0] + local_3c * local_3c); if (fVar3 <= 0.0) { fVar4 = local_44[0]; fVar3 = local_3c; } else { fVar4 = local_44[0] * (1.0 / fVar3); fVar3 = local_3c * (1.0 / fVar3); } LAB_0061bb14: (this->_velocity).y = fVar3 * acceleration + (this->_velocity).y; (this->_velocity).x = fVar4 * acceleration + (this->_velocity).x; } variant = this->_variant; if ((variant == 0xe) || (variant == 0xd2)) { animData = (this->_sprite)._animState._animData; if (animData != GHIDRA_CAST(0x0)) { curAnimName = animData; if (0xf < *GHIDRA_CAST((animData + 0x14))) { curAnimName = *GHIDRA_CAST(animData); } animName = "Flying"; do { bVar1 = *curAnimName; isLess = bVar1 < (byte)*animName; if (bVar1 != *animName) { LAB_0061bcd3: uVar2 = -GHIDRA_UINT(isLess) | 1; goto LAB_0061bcd8; } if (bVar1 == 0) break; bVar1 = curAnimName[1]; isLess = bVar1 < (byte)animName[1]; if (bVar1 != animName[1]) goto LAB_0061bcd3; curAnimName = curAnimName + 2; animName = animName + 2; } while (bVar1 != 0); uVar2 = 0; LAB_0061bcd8: if ((uVar2 == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_0061bd0b; } animName = "Flying"; } else if (variant == 0xf) { animData = (this->_sprite)._animState._animData; if (animData != GHIDRA_CAST(0x0)) { curAnimName = animData; if (0xf < *GHIDRA_CAST((animData + 0x14))) { curAnimName = *GHIDRA_CAST(animData); } animName = "FlyingTransparent"; do { bVar1 = *curAnimName; isLess = bVar1 < (byte)*animName; if (bVar1 != *animName) { LAB_0061bb92: uVar2 = -GHIDRA_UINT(isLess) | 1; goto LAB_0061bb97; } if (bVar1 == 0) break; bVar1 = curAnimName[1]; isLess = bVar1 < (byte)animName[1]; if (bVar1 != animName[1]) goto LAB_0061bb92; curAnimName = curAnimName + 2; animName = animName + 2; } while (bVar1 != 0); uVar2 = 0; LAB_0061bb97: if ((uVar2 == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_0061bd0b; } animName = "FlyingTransparent"; } else { if (variant != 0x3c) { if (variant == 0x3f) { animName = "FloatChase"; if (this->_target == (EntityPtr)0x0) { animName = "Float"; } (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST(animName),0); (GHIDRA_CAST((&color)))->Color::operator_assign(&(this->_sprite)._color); if (this->_target == (EntityPtr)0x0) { fVar4 = 0.5; } else { fVar4 = 1.0; } color._tint[3] = (fVar4 - color._tint[3]) * 0.15 + color._tint[3]; (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetColor(GHIDRA_CAST(&color)); } goto LAB_0061bd0b; } animData = (this->_sprite)._animState._animData; if (animData != GHIDRA_CAST(0x0)) { curAnimName = animData; if (0xf < *GHIDRA_CAST((animData + 0x14))) { curAnimName = *GHIDRA_CAST(animData); } idleAnimName = s_Idle; do { bVar1 = *curAnimName; isLess = bVar1 < *idleAnimName; if (bVar1 != *idleAnimName) { LAB_0061bbf7: uVar2 = -GHIDRA_UINT(isLess) | 1; goto LAB_0061bbfc; } if (bVar1 == 0) break; bVar1 = curAnimName[1]; isLess = bVar1 < idleAnimName[1]; if (bVar1 != idleAnimName[1]) goto LAB_0061bbf7; curAnimName = curAnimName + 2; idleAnimName = idleAnimName + 2; } while (bVar1 != 0); uVar2 = 0; LAB_0061bbfc: if ((uVar2 == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_0061bd0b; } animName = GHIDRA_CAST(s_Idle); } bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST(animName),1); if (bVar1 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } LAB_0061bd0b: fVar4 = (this->_velocity).x; fVar3 = (this->_velocity).y; (this->_sprite)._flipX = 0.0 < fVar4; (this->_velocity).x = fVar4 * friction; (this->_velocity).y = friction * fVar3; return; } // 0061bd50 void Entity_Familiar::ai_daddy_longlegs() { byte bVar1; byte *pbVar2; uint uVar3; uint rngResult; char *anim; int iVar4; byte *pbVar5; byte *idleName; bool bVar6; float fVar7; float fVar8; float toTargetX; float toTargetY; float fVar9; float chaseDirX; double dVar10; EntityPtr target; if (this->_fireCooldown == 0) { PickEnemyTarget(this,365.0,0xd,0,&g_vectorZero,15.0); target = this->_target; if (target != (EntityPtr)0x0) { toTargetX = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x33c)) - (this->_pos).x; toTargetY = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x340)) - (this->_pos).y; fVar8 = (this->_velocity).x; chaseDirX = (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x360)) * 5.0 - fVar8 * 5.0) + toTargetX; fVar9 = (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x364)) * 5.0 - (this->_velocity).y * 5.0) + toTargetY; fVar7 = sqrtf(chaseDirX * chaseDirX + fVar9 * fVar9); if (0.0 < fVar7) { chaseDirX = chaseDirX * (1.0 / fVar7); fVar9 = fVar9 * (1.0 / fVar7); } (this->_velocity).y = fVar9 + (this->_velocity).y; (this->_velocity).x = fVar8 + chaseDirX; if (((toTargetY * toTargetY + toTargetX * toTargetX < 900.0) && ((this->_sprite)._animState._animData != (void *)0x0)) && ((this->_sprite)._animState._isPlaying != 0)) { pbVar2 = (this->_sprite)._animState._animData; if (0xf < *GHIDRA_CAST((pbVar2 + 0x14))) { pbVar2 = *GHIDRA_CAST(pbVar2); } pbVar5 = s_Idle; do { bVar1 = *pbVar2; bVar6 = bVar1 < *pbVar5; if (bVar1 != *pbVar5) { LAB_0061bee3: uVar3 = -GHIDRA_UINT(bVar6) | 1; goto LAB_0061bee8; } if (bVar1 == 0) break; bVar1 = pbVar2[1]; bVar6 = bVar1 < pbVar5[1]; if (bVar1 != pbVar5[1]) goto LAB_0061bee3; pbVar2 = pbVar2 + 2; pbVar5 = pbVar5 + 2; } while (bVar1 != 0); uVar3 = 0; LAB_0061bee8: if (uVar3 == 0) { rngResult = Random(); anim = "StompArm"; if ((rngResult & 1) == 0) { anim = "StompLeg"; } (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST(anim),(byte)uVar3); uVar3 = Random(); (this->_sprite)._flipX = ~(byte)uVar3 & 1; } } } } if ((this->_target == (EntityPtr)0x0) || (this->_fireCooldown - 1U < 0x62)) { fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) - (this->_pos).y; fVar7 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) - (this->_pos).x; fVar9 = fVar8 * fVar8 + fVar7 * fVar7; if (6400.0 < fVar9) { fVar9 = sqrtf(fVar9); if (0.0 < fVar9) { fVar7 = fVar7 * (1.0 / fVar9); fVar8 = fVar8 * (1.0 / fVar9); } (this->_velocity).x = fVar7 + (this->_velocity).x; (this->_velocity).y = fVar8 + (this->_velocity).y; } } if (((this->_sprite)._animState._animData == (void *)0x0) || ((this->_sprite)._animState._isPlaying == 0)) { pbVar2 = (this->_sprite)._animState._animData; if (pbVar2 != GHIDRA_CAST(0x0)) { pbVar5 = pbVar2; if (0xf < *GHIDRA_CAST((pbVar2 + 0x14))) { pbVar5 = *GHIDRA_CAST(pbVar2); } idleName = s_Idle; do { bVar1 = *pbVar5; bVar6 = bVar1 < *idleName; if (bVar1 != *idleName) { LAB_0061c020: uVar3 = -GHIDRA_UINT(bVar6) | 1; goto LAB_0061c025; } if (bVar1 == 0) break; bVar1 = pbVar5[1]; bVar6 = bVar1 < idleName[1]; if (bVar1 != idleName[1]) goto LAB_0061c020; pbVar5 = pbVar5 + 2; idleName = idleName + 2; } while (bVar1 != 0); uVar3 = 0; LAB_0061c025: if ((uVar3 == 0) && ((pbVar2[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_0061c058; } bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(s_Idle,1); if (bVar1 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } } LAB_0061c058: if (0 < this->_fireCooldown) { this->_fireCooldown = this->_fireCooldown + -1; } if ((this->_sprite)._animState._animData != (void *)0x0) { dVar10 = floor((double)(this->_sprite)._animState._animFrame); if ((9 < GHIDRA_INT(dVar10)) && (GHIDRA_INT(dVar10) < 0x20)) { if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (iVar4 = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetFrame(), iVar4 < 0x11)) { iVar4 = 3; } else { iVar4 = 0; } this->_entityCollisionClass = iVar4; fVar8 = (this->_velocity).x; this->_fireCooldown = 100; (this->_velocity).x = fVar8 * 0.5; (this->_velocity).y = (this->_velocity).y * 0.5; return; } } fVar8 = (this->_velocity).x; this->_entityCollisionClass = 0; (this->_velocity).x = fVar8 * 0.9; (this->_velocity).y = (this->_velocity).y * 0.9; return; } // 0061c150 void Entity_Familiar::ai_orbital_variant_50() { int *damageEntry; Vector *orbitPos; float fVar1; float speedScale; Vector local_18; Vector local_10; EntityPtr target; if (this->_subtype == 1) { PickEnemyTarget(this,200.0,0xd,0,&g_vectorZero,15.0); } if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (this->_target != (EntityPtr)0x0)) { local_18.x = *GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x20)); damageEntry = GHIDRA_CAST(std)::map::try_emplace(&local_10,&local_18); if (599 < *GHIDRA_CAST((*damageEntry + 0x14))) { local_18.x = *GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x20)); damageEntry = GHIDRA_CAST(std)::map::try_emplace(&local_10,&local_18); *GHIDRA_CAST((*damageEntry + 0x14)) = 0xfffffb50; } } target = this->_target; if (target == (EntityPtr)0x0) { if (this->_orbitLayer == -1) { this->_orbitLayer = 1; fVar1 = DAT_00c34148; (this->_orbitDistance).x = DAT_00c34144; (this->_orbitDistance).y = fVar1; RecalculateOrbitOffset(this,1,1); } local_10.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); local_10.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); orbitPos = GetOrbitPosition(this,&local_18,&local_10); local_18.x = orbitPos->x; (this->_targetPosition).x = local_18.x; local_10.x = orbitPos->y; (this->_targetPosition).y = local_10.x; local_10.x = local_10.x - (this->_pos).y; local_18.x = local_18.x - (this->_pos).x; fVar1 = sqrtf(local_10.x * local_10.x + local_18.x * local_18.x); if (fVar1 < 20.0) { (this->_velocity).x = local_18.x * 0.9; (this->_velocity).y = local_10.x * 0.9; } } else { local_10.x = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x33c)); fVar1 = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x340)); (this->_targetPosition).x = local_10.x; (this->_targetPosition).y = fVar1; if (this->_orbitLayer < 0) goto LAB_0061c32f; RecalculateOrbitOffset(this,this->_orbitLayer,0); this->_orbitLayer = -1; } local_10.x = (this->_targetPosition).x; LAB_0061c32f: local_18.x = (this->_targetPosition).y - (this->_pos).y; local_10.x = local_10.x - (this->_pos).x; fVar1 = sqrtf(local_18.x * local_18.x + local_10.x * local_10.x); if (fVar1 < 0.1) { speedScale = 0.0; } else { speedScale = fVar1 * 0.15; if (2.0 <= speedScale) { speedScale = 2.0; } speedScale = speedScale / fVar1; } (this->_velocity).x = local_10.x * speedScale + (this->_velocity).x; (this->_velocity).y = local_18.x * speedScale + (this->_velocity).y; this->_friction = this->_friction * 0.8; return; } // 0061d6b0 void Entity_Familiar::ai_key_full() { uint *puVar1; GridEntity_Door *this_00; int iVar2; qword qVar3; byte bVar4; uint uVar5; LayerState *pLVar6; byte *pbVar7; byte *pbVar8; Entity_Player *keyPieceOwner; char *floatNameChar; bool isLess; float distY; float local_18; float doorTargetY; Vector followTarget; Game *game; Manager *manager; if ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x44)) & 1) != 0) { uVar5 = 0; do { this_00 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + uVar5 * 4 + 0x724)); if ((this_00 != GHIDRA_CAST(0x0)) && ((this_00->_desc)._variant == 5)) { if (this->_isFollower != 0) { RemoveFromFollowers(this); } pbVar8 = (this->_sprite)._animState._animData; if (pbVar8 == GHIDRA_CAST(0x0)) goto LAB_0061d7bc; if (0xf < *GHIDRA_CAST((pbVar8 + 0x14))) { pbVar8 = *GHIDRA_CAST(pbVar8); } pbVar7 = s_Idle; goto LAB_0061d784; } uVar5 = uVar5 + 1; } while (uVar5 < 8); } if (this->_isFollower == 0) { AddToFollowers(this); } pLVar6 = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); pLVar6->_rotation = 0.0; pbVar8 = (this->_sprite)._animState._animData; if (pbVar8 != GHIDRA_CAST(0x0)) { pbVar7 = pbVar8; if (0xf < *GHIDRA_CAST((pbVar8 + 0x14))) { pbVar7 = *GHIDRA_CAST(pbVar8); } floatNameChar = "Float"; do { bVar4 = *pbVar7; isLess = bVar4 < (byte)*floatNameChar; if (bVar4 != *floatNameChar) { LAB_0061d9bd: uVar5 = -GHIDRA_UINT(isLess) | 1; goto LAB_0061d9c2; } if (bVar4 == 0) break; bVar4 = pbVar7[1]; isLess = bVar4 < (byte)floatNameChar[1]; if (bVar4 != floatNameChar[1]) goto LAB_0061d9bd; pbVar7 = pbVar7 + 2; floatNameChar = floatNameChar + 2; } while (bVar4 != 0); uVar5 = 0; LAB_0061d9c2: if ((uVar5 == 0) && ((pbVar8[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_0061d9f5; } bVar4 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST("Float"),1); if (bVar4 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } LAB_0061d9f5: FollowParent(this); return; while( true ) { bVar4 = pbVar8[1]; isLess = bVar4 < pbVar7[1]; if (bVar4 != pbVar7[1]) goto LAB_0061d7a4; pbVar8 = pbVar8 + 2; pbVar7 = pbVar7 + 2; if (bVar4 == 0) break; LAB_0061d784: bVar4 = *pbVar8; isLess = bVar4 < *pbVar7; if (bVar4 != *pbVar7) { LAB_0061d7a4: uVar5 = -GHIDRA_UINT(isLess) | 1; goto LAB_0061d7a9; } if (bVar4 == 0) break; } uVar5 = 0; LAB_0061d7a9: if ((uVar5 != 0) || ((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animData) + 0x34)) != '\0' && ((this->_sprite)._animState._isPlaying == 0)))) { LAB_0061d7bc: bVar4 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(s_Idle,1); if (bVar4 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } } iVar2 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); local_18 = ((float)(this_00->_gridIndex % iVar2) * 40.0 + 40.0) - 13.846154; doorTargetY = ((float)(this_00->_gridIndex / iVar2) * 40.0 + 120.0) - 7.692308; followTarget.x = local_18; followTarget.y = doorTargetY; FollowPosition(this,&followTarget); pLVar6 = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); manager = g_manager; if (pLVar6->_rotation < 90.0) { local_18 = pLVar6->_rotation + 2.0; if (90.0 <= local_18) { local_18 = 90.0; } pLVar6 = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); pLVar6->_rotation = local_18; return; } local_18 = (this->_pos).x - local_18; distY = (this->_pos).y - doorTargetY; if (9.0 <= distY * distY + local_18 * local_18) { return; } local_18 = 2.85865e-43; seed_fart_sound_override(GHIDRA_CAST(&local_18)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_18),1.0,2,0,1.0,0.0); game = g_game; iVar2 = (this_00->_desc)._variant; if (iVar2 != 4) { if (iVar2 == 5) { qVar3 = g_game->_gameStateFlags; puVar1 = GHIDRA_CAST((GHIDRA_INT(&g_game->_gameStateFlags) + 4)); *puVar1 = *puVar1 | 0x20000; *GHIDRA_CAST(&game->_gameStateFlags) = GHIDRA_INT(qVar3); } (this_00->_desc)._variant = 8; (GHIDRA_CAST((this_00)))->GridEntity_Door::UpdateAnimation(); } (GHIDRA_CAST((this_00)))->GridEntity_Door::Open(); this->Remove(); keyPieceOwner = PlayerManager::FirstCollectibleOwner (&g_game->_playerManager,0xee,GHIDRA_CAST(&g_game->_playerManager),0); if (keyPieceOwner != GHIDRA_CAST(0x0)) { (GHIDRA_CAST((keyPieceOwner)))->Entity_Player::RemoveCollectible(0xee,0,0,1); } keyPieceOwner = PlayerManager::FirstCollectibleOwner (&g_game->_playerManager,0xef,GHIDRA_CAST(&g_game->_playerManager),0); if (keyPieceOwner == GHIDRA_CAST(0x0)) { return; } (GHIDRA_CAST((keyPieceOwner)))->Entity_Player::RemoveCollectible(0xef,0,0,1); return; } // 0061da10 void Entity_Familiar::Update() { ColorMod color; BitSet128 flags; byte bVar1; char cVar2; void *pvVar3; int *otherFamiliar; uint uVar4; Entity *tmpEntity; RNG *rng; ColorMod *fartColor; ItemOverlay *itemOverlay; Entity_Effect *effect; KColor *spriteColor; Entity_Laser *techLaser; TearParams *pTVar5; BitSet128 *scratchFlags; uint uVar6; Entity_Bomb *bomb; LayerState *layer; EntityRef *sourceRef; SoundEffects *sfx; Entity_Tear *tear; Entity_Player *listSize; AnimationState *animState; Entity_Familiar *tmpEntity; char *animName; EntityList *entityList; undefined4 *puVar8; TemporaryEffects *playerEffects; int iVar9; Vector *scratchVec2; Vector *scratchVec; Room *room; GridEntity *gridEntity; float *pfVar10; Game *game; EntityPtr followTarget; int *piVar11; undefined1 *nextIndex; code *virtualFn; Entity_Player *sourceRef; bool isEveryFourthState; float10 floatResult; Entity_Familiar *in_XMM0_Da; float fallVelocity; float fVar13; ulonglong projectileFlags; undefined4 in_stack_fffffd0c; undefined4 in_stack_fffffd10; undefined4 in_stack_fffffd14; undefined4 in_stack_fffffd18; undefined4 in_stack_fffffd1c; undefined4 in_stack_fffffd20; EntityList_EL *in_stack_fffffd24; void *in_stack_fffffd28; undefined4 uVar14; undefined4 uVar15; int green; int blue; byte addEnemyKillScore; float fVar16; BitSet128 notLudovicoFlags; BitSet128 bombFlags; BitSet128 flagsWithoutLudovico; BitSet128 sourceTearFlagsCopy; BitSet128 sourceLudovicoBits; BitSet128 sourceTearFlags; BitSet128 local_258; BitSet128 local_248; Vector local_238; Vector local_230; Vector local_228; Vector local_220; Vector local_218; Vector local_210; BitSet128 local_208; Vector local_1f0; Vector local_1e8; Vector local_1e0; Vector local_1d8; Vector local_1d0; Vector local_1c8; Vector local_1c0; BitSet128 local_1b8; undefined1 local_1a4 [16]; Vector local_194; Vector local_18c; Vector local_184; Vector local_17c; Vector local_174; Vector local_16c; EntityList *local_164; Vector local_160; Vector local_158; Vector local_150; Vector local_148; Vector local_140; undefined4 local_134; Vector local_130; Vector local_128; Entity_Familiar *local_120; Entity_Familiar *local_11c; Entity_Player *local_118; Entity_Familiar *self; TearParams local_110; undefined1 local_a8 [12]; byte idleAnimName [12]; BitSet128 local_90; undefined1 local_78 [12]; char *pcStack_6c; undefined1 local_68 [12]; char *local_5c; byte animNameBuf [4]; Color local_54; void *local_24; float *pfStack_20; void *local_1c; undefined1 *puStack_18; float local_14; Entity_Projectile *deflectedShot; BitSet128 *flagsOperand; undefined1 *gridIndexCounts; ANM2 *sprite; pfStack_20 = (&local_54)[1]._offset + 1; local_14 = -NAN; puStack_18 = &LAB_00af6c90; local_1c = ExceptionList; local_24 = (void *)(__security_cookie ^ GHIDRA_UINT(((&local_54)[1]._colorize + 2))); ExceptionList = &local_1c; self = this; pfVar10 = (&local_54)[1]._offset + 1; if (this->_variant != 900) { fVar13 = 1.0; pfVar10 = (&local_54)[1]._offset + 1; if (this->_variant == 0xe7) { in_stack_fffffd28 = this->_extraData; in_stack_fffffd24 = GHIDRA_CAST(0x61da92); __RTDynamicCast(); pvVar3 = get_item_config_entry(this); fVar13 = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x78)); pfVar10 = pfStack_20; if ((fVar13 == 1.0) && (piVar11 = this->_item, piVar11 != GHIDRA_CAST(0x0))) { if ((*piVar11 == 2) && (piVar11[1] == 0xba)) { bVar1 = 3; } else { bVar1 = (byte)piVar11[0x30]; } if (bVar1 < 5) { fVar13 = *GHIDRA_CAST((GHIDRA_INT((&(g_manager->_itemConfig)._wispGfxRoot + 1)) + GHIDRA_UINT(bVar1) * 4)); } else { fVar13 = 1.0; } } } pfStack_20 = pfVar10; in_XMM0_Da = GHIDRA_CAST((fVar13 * g_vectorOne.x)); (this->_sprite)._scale.y = fVar13 * g_vectorOne.y; (this->_sprite)._scale.x = (float)in_XMM0_Da; pfVar10 = pfStack_20; } pfStack_20 = pfVar10; game = g_game; if (g_game->_frameCount - this->_spawnFrame < 2) { iVar9 = this->_variant; if ((((iVar9 == 0x62) || (iVar9 == 99)) || (iVar9 == 0x65)) || ((iVar9 == 0x83 || (iVar9 == 0x6a)))) { in_XMM0_Da = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); fVar13 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); (this->_pos).x = (float)in_XMM0_Da; (this->_pos).y = fVar13; } if (this->_orbitLayer == 0) { in_stack_fffffd24 = GHIDRA_CAST(local_68); piVar11 = GHIDRA_CAST(0x0); local_130.y = 0.0; in_stack_fffffd28 = (void *)0x3; in_stack_fffffd20 = 0x61dbab; EntityList::QuerySublist (GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)),in_stack_fffffd24,3,-1,-1,1,0); local_14 = 0.0; local_118 = GHIDRA_CAST(0x0); if (local_5c != GHIDRA_CAST(0x0)) { do { in_stack_fffffd28 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0x4))) + GHIDRA_INT(local_118) * 4); in_stack_fffffd24 = GHIDRA_CAST(0x61dbd9); otherFamiliar = GHIDRA_CAST(__RTDynamicCast()); if (((otherFamiliar != GHIDRA_CAST(0x0)) && ((void *)otherFamiliar[0x104] == this->_player)) && ((*GHIDRA_CAST((GHIDRA_CAST(otherFamiliar) + 0x172)) != '\0' && (otherFamiliar[0x35c] == 0)))) { local_130.y = (float)(GHIDRA_INT(local_130.y) + 1); if ((piVar11 == GHIDRA_CAST(0x0)) && (otherFamiliar[0xb] == 0x21)) { piVar11 = otherFamiliar; } } local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); } while (local_118 < local_5c); if (3 < GHIDRA_INT(local_130.y)) { if (this->_variant == 0x21) { iVar9 = *GHIDRA_CAST(this); } else { if (piVar11 == GHIDRA_CAST(0x0)) goto LAB_0061dc46; iVar9 = *piVar11; } (**(code **)(iVar9 + 0x28))(); } } LAB_0061dc46: if (this->_exists == 0) { (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); if (local_68[0] == '\0') { local_14 = 1.4013e-45; tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_68)) + 0x4))),0); ExceptionList = local_1c; return; } ExceptionList = local_1c; return; } if (local_68[0] == '\0') { local_14 = 2.8026e-45; tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_68)) + 0x4))),0); } local_14 = -NAN; game = g_game; } } if ((0 < this->_appearTimer) && ((this->_flags & 4) != 0)) { iVar9 = this->_appearTimer + -1; this->_appearTimer = iVar9; if (iVar9 == 3) { uVar4 = Random(); tmpEntity = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4); tmpEntity->Update(); iVar9 = this->_appearTimer; game = g_game; } this->_visible = iVar9 == 0; if (((this->_variant == 0xce) || (this->_variant == 0xed)) && (game->_frameCount == this->_spawnFrame)) { ai_wisp(this); } (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Update(); ExceptionList = local_1c; return; } if (0 < this->_sirenCharmFrames) { this->_sirenCharmFrames = this->_sirenCharmFrames + 1; } if (this->_isLilDelirium != 0) { bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(300,this->_index); if (bVar1 != 0) { delirium_morph(this); } game = g_game; } if (this->_state == 0) { in_XMM0_Da = GHIDRA_CAST(this->_updateTime); if ((float)in_XMM0_Da == 0.0) { ResolveOrbitConflict(this); game = g_game; } } uVar4 = this->_variant; if (900 < uVar4) goto switchD_0061ddf2_caseD_12; if (uVar4 == 900) { bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::IsFinishedImpl(&s_empty); if (bVar1 != 0) { animName = "FlyingIdle"; if (this->_entityGridCollisionClass != 3) { animName = GHIDRA_CAST(s_Idle); } (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST(animName),0); } room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level)::GetCurrentRoom(); bVar1 = (GHIDRA_CAST((room)))->Room::is_type_16(); if (bVar1 == 0) { bVar1 = (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_eq(&g_vectorZero); if (bVar1 != 0) { (GHIDRA_CAST((GHIDRA_CAST(&this->_pathfinder))))->PathFinder::UpdateGridIndex(); (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_assign(&this->_pos); } scratchVec = (GHIDRA_CAST((&this->_targetPosition)))->Vector::__sub(GHIDRA_CAST((local_78 + 8)),&this->_pos); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level)::GetCurrentRoom(); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(&this->_pathfinder))))->PathFinder::GetGridIndex(); (GHIDRA_CAST((room)))->Room::SetGridPath(iVar9,0x3b6); } else { in_XMM0_Da = GHIDRA_CAST((this->_friction * 0.95)); this->_friction = (float)in_XMM0_Da; } (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::GetCurrentRoom(); entityList = GHIDRA_CAST(FUN_00428a60()); EntityList::QueryRadius(entityList,GHIDRA_CAST(local_1a4),&this->_pos,30.0,2); local_14 = 1.82169e-44; sourceRef = GHIDRA_CAST(0x0); local_118 = GHIDRA_CAST(0x0); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_1a4))))->EntityList::Size(); if (iVar9 != 0) { do { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::HasEntityFlags(0x20000000); if (bVar1 == 0) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Position(GHIDRA_CAST((local_78 + 8))); (GHIDRA_CAST((this->_player)))->Entity::Position(GHIDRA_CAST((local_68 + 8))); FUN_00a0ff70(); sourceRef = local_118; local_148.y = (float)in_XMM0_Da; puVar8 = GHIDRA_CAST(std)::vector::operator_index(); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Position(GHIDRA_CAST(&local_1b8._h)); (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_140,scratchVec); local_150.y = (GHIDRA_CAST((&local_140)))->Vector::LengthSquared(); in_XMM0_Da = GHIDRA_CAST(local_148.y); if (local_150.y < local_148.y) { tmpEntity = GHIDRA_CAST(local_148.y); puVar8 = GHIDRA_CAST(std)::vector::operator_index(); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Velocity(GHIDRA_CAST(&local_208._h)); (GHIDRA_CAST((scratchVec)))->Vector::Normalized(&local_16c); (GHIDRA_CAST((&local_140)))->Vector::Normalized(&local_17c); puVar8 = GHIDRA_CAST(std)::vector::operator_index(); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Velocity(&local_1f0); local_160.y = (GHIDRA_CAST((scratchVec)))->Vector::Length(); (GHIDRA_CAST((&local_17c)))->Vector::__mul(&local_130,&local_160.y); FUN_00a10160(); FUN_0060cc20(); local_148.y = (float)tmpEntity / 3.1415927; local_150.y = 0.99; puVar8 = GHIDRA_CAST(std)::min(); local_11c = GHIDRA_CAST(*puVar8); puVar8 = GHIDRA_CAST(std)::vector::operator_index(); tmpEntity = GHIDRA_CAST(*puVar8); puVar8 = GHIDRA_CAST(std)::vector::operator_index(); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Velocity(GHIDRA_CAST(&local_258._h)); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(GHIDRA_CAST(&local_248._h),GHIDRA_CAST(&local_11c)); in_XMM0_Da = GHIDRA_CAST((1.0 - (float)local_11c)); local_128.y = (float)in_XMM0_Da; scratchVec2 = (GHIDRA_CAST((&local_130)))->Vector::__mul(&local_238,&local_128.y); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_230,scratchVec2); (GHIDRA_CAST((tmpEntity)))->Entity::SetVelocity(scratchVec); sourceRef = local_118; this = self; } } sourceRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sourceRef)) + 0x1)))); local_118 = sourceRef; gridIndexCounts = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_1a4))))->EntityList)::Size(); } while (sourceRef < gridIndexCounts); } gridIndexCounts = local_1a4; goto LAB_006241ee; } switch(uVar4) { case 2: switchD_0061ddf2_caseD_2: ai_auto_shooter(this); break; case 3: case 0x19: case 0x3b: case 0x68: case 0x82: case 0xd5: case 0xd6: case 0xdf: case 0xe8: ai_charger(this); break; case 8: case 0xf4: (GHIDRA_CAST(()))->Level::GetCurrentRoom(); FUN_0043eed0(); scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_150); (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_148,&local_140); if (this->_variant == 0xf4) { scratchVec = RandomVector(&local_150,this->_initSeed); (GHIDRA_CAST((GHIDRA_CAST(local_78))))->RNG::game_constructor(this->_initSeed,0x13); local_14 = 4.2039e-45; local_11c = GHIDRA_CAST((GHIDRA_CAST((rng)))->RNG)::RandomFloat(); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_160,GHIDRA_CAST(&local_11c)); local_16c.y = 30.0; scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_128,&local_16c.y); (GHIDRA_CAST((&local_140)))->Vector::operator_add_assign(scratchVec); local_14 = -NAN; guard_check_icall(); } scratchVec = (GHIDRA_CAST((&local_140)))->Vector::__sub(&local_150,&local_148); FollowPosition(this,scratchVec); Shoot(this); break; case 0xd: MoveDiagonally(this,1.0); local_11c = GHIDRA_CAST(0x3f4ccccd); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_mul_assign(GHIDRA_CAST(&local_11c)); Shoot(this); break; case 0xe: case 0xf: case 0x3f: ai_flying_bird(this); break; case 0x10: ai_daddy_longlegs(this); break; case 0x11: case 0xcf: MoveDiagonally(this,1.0); (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("Float"),0); break; case 0x14: case 0x15: case 0x16: case 0x17: case 0x39: case 0x52: case 0x5b: case 0x72: FollowParent(this); bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::IsFinishedImpl(s_Spawn); if (bVar1 != 0) { if (this->_variant != 0x17) goto LAB_00623343; (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("Float"),0); } break; case 0x18: case 0x40: case 0x5a: case 0x66: ai_pickup_sack(this); break; case 0x1c: ai_key_full(this); break; case 0x2a: tmpEntity = GHIDRA_CAST((this->_subtype + 1)); local_11c = tmpEntity; local_128.y = (GHIDRA_CAST((&this->_velocity)))->Vector::LengthSquared(); if (1.0 <= local_128.y) { animName = "Idle%u"; } else { animName = "Float%u"; } sprintf_s(animNameBuf,0x32,GHIDRA_CAST(animName)); (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(animNameBuf,0); scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_140,scratchVec); local_128.y = (GHIDRA_CAST((&local_140)))->Vector::LengthSquared(); if (local_128.y <= 900.0) { local_130.y = (float)((double)GHIDRA_INT(tmpEntity) + __uint_to_double_fixup[-(GHIDRA_INT(tmpEntity) >> 0x1f)]); } else { scratchVec = (GHIDRA_CAST((&local_140)))->Vector::Normalized(&local_158); local_130.y = (float)((double)GHIDRA_INT(local_11c) + __uint_to_double_fixup[-(GHIDRA_INT(local_11c) >> 0x1f)]); local_128.y = local_130.y + local_130.y + 15.0; fVar13 = (GHIDRA_CAST((&local_140)))->Vector::Length(); local_16c.y = local_128.y - fVar13; local_120 = GHIDRA_CAST(0x3fb33333); pfVar10 = GHIDRA_CAST(std)::min(); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_174,pfVar10); local_164 = GHIDRA_CAST(0x3d8f5c29); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_184,GHIDRA_CAST(&local_164)); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_add_assign(scratchVec); } local_128.y = local_130.y * 0.01 + 0.87; (GHIDRA_CAST((&this->_velocity)))->Vector::operator_mul_assign(&local_128.y); game = g_game; this->_mass = local_130.y * 3.0 + 3.0; this->_collisionDamage = local_130.y + local_130.y + 3.0; (GHIDRA_CAST((GHIDRA_CAST(game))))->Level::GetCurrentRoom(); entityList = GHIDRA_CAST(FUN_00428a60()); EntityList::QuerySublist(entityList,GHIDRA_CAST(local_78),3,this->_variant,-1,0,0); local_14 = 8.40779e-45; uVar4 = 0; iVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); if (iVar9 != 0) { do { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); cVar2 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Exists(); if ((cVar2 != '\0') && (piVar11 = GHIDRA_CAST(std)::vector::operator_index(), GHIDRA_CAST(*piVar11) != this )) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Position(&local_158); (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_17c,scratchVec); local_128.y = 0.0; fVar13 = (GHIDRA_CAST((&local_17c)))->Vector::Length(); local_11c = GHIDRA_CAST((20.0 - fVar13)); pfVar10 = GHIDRA_CAST(std)::max(); (GHIDRA_CAST((&local_17c)))->Vector::Resize(*pfVar10 * 0.1); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_add_assign(&local_17c); } uVar4 = uVar4 + 1; uVar6 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); } while (uVar4 < uVar6); } LAB_0061f2a8: gridIndexCounts = local_78; goto LAB_006241ee; case 0x2b: ai_blue_fly(this); break; case 0x2d: case 0x46: scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); scratchVec = GetOrbitPosition(this,&local_174,scratchVec); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_184,&this->_pos); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); Shoot(this); break; case 0x2e: case 0x2f: case 0x38: ai_walker(this); break; case 0x30: FamiliarAI::bobs_brain(this); break; case 0x32: ai_orbital_variant_50(this); break; case 0x33: bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::IsFinishedImpl(&DAT_00b1d3b0); if (bVar1 != 0) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(s_Idle,0); Entity_Player::UseActiveItem(this->_player,GHIDRA_CAST((GHIDRA_INT(&local_134) + 2)),0x23,1,-1,0); itemOverlay = GHIDRA_CAST((GHIDRA_CAST((g_game)))->Game)::GetItemOverlay(); (GHIDRA_CAST((itemOverlay)))->ItemOverlay::Show(1,0,GHIDRA_CAST(0x0)); } goto LAB_0061f886; case 0x34: (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("FloatDown"),0); FollowParent(this); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(4,0); if (bVar1 != 0) { uVar4 = Random(); uVar6 = 0x2c; LAB_0061f94f: (GHIDRA_CAST((g_game)))->Game::Spawn(1000,uVar6,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar4); tmpEntity = GHIDRA_CAST(__RTDynamicCast()); fVar13 = random_float(); pfVar10 = &local_128.y; scratchVec = &local_158; local_128.y = fVar13 * 0.5 + 0.2; LAB_0061dea4: scratchVec = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(scratchVec,pfVar10); (GHIDRA_CAST((tmpEntity)))->Entity::SetSpriteScale(scratchVec); tmpEntity->Update(); } break; case 0x35: FamiliarAI::variant_53(this); break; case 0x37: FollowParent(this); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(3,0); if (bVar1 != 0) { fVar13 = random_float(); local_128.y = fVar13 * 0.5 + 0.2; uVar4 = Random(); (GHIDRA_CAST((g_game)))->Game::Spawn(1000,7,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4); tmpEntity = GHIDRA_CAST(__RTDynamicCast()); scratchVec = (GHIDRA_CAST((&local_158)))->Vector::Vector(local_128.y,local_128.y); (GHIDRA_CAST((tmpEntity)))->Entity::SetSpriteScale(scratchVec); tmpEntity->Update(); } bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(2,0); if ((bVar1 != 0) && (uVar4 = Isaac::Random(5), 1 < uVar4)) { uVar4 = Random(); uVar6 = 0x2e; goto LAB_0061f94f; } break; case 0x3a: this->_entityGridCollisionClass = 3; if (this->_subtype == 0) { layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); local_130.y = (layer->_size).x; if (1.0 <= local_130.y) { this->_entityCollisionClass = 3; } else { local_130.y = local_130.y + 0.05; if (1.0 <= local_130.y) { local_130.y = 1.0; } scratchVec = (GHIDRA_CAST((&g_vectorOne)))->Vector::__mul(&local_158,&local_130.y); layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); (GHIDRA_CAST((&layer->_size)))->Vector::operator_assign(scratchVec); } this->_visible = 1; MoveDiagonally(this,1.0); } else { scratchVec = &g_vectorZero; this->_entityCollisionClass = 0; this->_visible = 0; layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); (GHIDRA_CAST((&layer->_size)))->Vector::operator_assign(scratchVec); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(&g_vectorZero); if ((0 < this->_counter) && (iVar9 = this->_counter + -1, this->_counter = iVar9, iVar9 < 1)) { this->_subtype = 0; if (this->_player != GHIDRA_CAST(0x0)) { scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); (GHIDRA_CAST((&this->_pos)))->Vector::operator_assign(scratchVec); } } } break; case 0x3d: case 0x6c: case 0xe6: FollowParent(this); ai_incubus_shot(); break; case 0x3e: tmpEntity = this->_player; iVar9 = (GHIDRA_CAST(()))->Game::Challenge(); if (iVar9 == 0x1e) { (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::GetCurrentRoom(); entityList = GHIDRA_CAST(FUN_00428a60()); EntityList::QuerySublist(entityList,GHIDRA_CAST(local_78),3,0x43,-1,0,0); local_14 = 1.12104e-44; iVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); if (iVar9 != 0) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); tmpEntity = GHIDRA_CAST(*puVar8); } local_14 = -NAN; (GHIDRA_CAST((local_78)))->EntityList_Query::~EntityList_Query(); } else { iVar9 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetPlayerType(); if ((iVar9 == 0x23) && (iVar9 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetOtherTwin(), iVar9 != 0)) { tmpEntity = GHIDRA_CAST((GHIDRA_CAST((this->_player)))->Entity_Player)::GetOtherTwin(); } } if (this->_state == 0) { (GHIDRA_CAST((tmpEntity)))->Entity::Position(&local_148); bVar1 = (GHIDRA_CAST((tmpEntity)))->Entity::is_player(); if (bVar1 != 0) { scratchVec = GHIDRA_CAST((GHIDRA_CAST((this->_player)))->Entity_Player)::GetAimDirection(); local_128.y = 60.0; scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_158,&local_128.y); (GHIDRA_CAST((&local_148)))->Vector::operator__(scratchVec); } room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level)::GetCurrentRoom(); local_16c.y = (float)&this->_pos; scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_16c.y))))->Vector::__sub(&local_174,&local_148); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Resized(&local_184,40.0); scratchVec = (GHIDRA_CAST((&local_148)))->Vector::__add(&local_18c,scratchVec); (GHIDRA_CAST((room)))->Room::GetClampedPosition(&local_150,scratchVec,6.0); scratchVec = &this->_pos; local_128.y = (GHIDRA_CAST((scratchVec)))->Vector::Distance(&local_148); if (40.0 < local_128.y) { local_128.y = ((local_128.y - 40.0) / local_128.y) * 0.4; scratchVec2 = (GHIDRA_CAST((&local_150)))->Vector::__sub(&local_158,scratchVec); scratchVec2 = (GHIDRA_CAST((scratchVec2)))->Vector::__mul(&local_174,&local_128.y); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec2); local_11c = GHIDRA_CAST((GHIDRA_CAST((&this->_velocity)))->Vector)::Length(); if (15.0 < (float)local_11c) { (GHIDRA_CAST((&this->_velocity)))->Vector::Resize(15.0); } } this->_friction = this->_friction * 0.8; if ((this->_fireCooldown < 1) && (bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::IsFinishedImpl(&s_empty), bVar1 != 0)) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("FloatDown"),0); } local_130.y = (float)(GHIDRA_CAST((this->_player)))->Entity_Player::GetFireDirection(); (GHIDRA_CAST((GHIDRA_CAST(&local_160))))->EntityPtr::clear(); bVar1 = TryAimAtMarkedTarget(this,&local_160,&this->_lastDirection,GHIDRA_CAST(0x0)); if ((bVar1 != 0) && (0x1d < this->_fireCooldown)) { local_130.y = -NAN; } bVar1 = CanPlayerFire(this); if (bVar1 != 0) { iVar9 = this->_fireCooldown; if (GHIDRA_CAST(local_130.y) == GHIDRA_CAST(0xffffffff)) { if (0 < iVar9) { if (iVar9 < 0x1e) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("FloatDown"),0); } else { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("ChargeAttack"),1); this->_fireCooldown = 0; bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0); local_134 = GHIDRA_CAST(CONCAT13(bVar1,(undefined3)local_134)); if (bVar1 == 0) { local_118 = GHIDRA_CAST(0x42f00000); } else { local_118 = GHIDRA_CAST(0x43340000); } Game::ButterBeanFart(g_game,scratchVec,(float)local_118,this->_player,0,0); (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::GetCurrentRoom(); entityList = GHIDRA_CAST(FUN_00428a60()); EntityList::QueryRadius (entityList,GHIDRA_CAST(local_78),scratchVec,(float)local_118,8); local_14 = 1.26117e-44; local_120 = GHIDRA_CAST(0x0); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); if (iVar9 != 0) { do { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); tmpEntity = GHIDRA_CAST(*puVar8); local_11c = tmpEntity; bVar1 = (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); if (bVar1 != 0) { bVar1 = (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::IsDescendantOf(GHIDRA_CAST(this->_spawnerEntity)); if (bVar1 == 0) { floatResult = (float10)(GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::Mass(); local_128.y = (float)floatResult; if (0.0 < local_128.y) { bVar1 = (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::HasEntityFlags(0x4000000); if (bVar1 == 0) { bVar1 = (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::HasEntityFlags(0x20000000); if (bVar1 == 0) { scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::Position(&local_158); (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_140,&this->_pos); local_118 = GHIDRA_CAST((GHIDRA_CAST((&local_140)))->Vector)::Length(); (GHIDRA_CAST((&local_140)))->Vector::__div_assign(GHIDRA_CAST(&local_118)); floatResult = (float10)(GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::Mass(); sourceRef = GHIDRA_CAST((float)floatResult); if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))) != '\0') { local_130.y = (float)sourceRef; FUN_00431260(); } local_130.y = (float)sourceRef; FUN_00417340(); local_118 = (Entity_Player *) ((float)local_118 - ((float)sourceRef + this->_size)); fVar13 = assert_lerp_range(local_130.y + (float)local_118,10.0,120.0, 20.0,1.0,1); FUN_00407140(); local_128.y = 16.0; scratchVec = (GHIDRA_CAST((&local_140)))->Vector::__mul(&local_174,&local_128.y); (GHIDRA_CAST((GHIDRA_CAST((local_a8 + 4)))))->EntityRef::constructor(GHIDRA_CAST(self)); Entity::AddKnockback (GHIDRA_CAST(local_11c),GHIDRA_CAST((local_a8 + 4)),scratchVec, GHIDRA_INT(fVar13),1); this = self; } } } } } nextIndex = &(*GHIDRA_CAST((GHIDRA_CAST((local_120)) + 0x1))); local_120 = GHIDRA_CAST(nextIndex); gridIndexCounts = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList)::Size(); } while (nextIndex < gridIndexCounts); scratchVec = &this->_pos; } SoundEffects::PlayWithFartOverride(0x45,2.0,2,0,1.0); SoundEffects::PlayWithFartOverride(0xb2,1.0,2,0,1.0); uVar4 = Random(); tmpEntity = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,2,scratchVec,&g_vectorZero,GHIDRA_CAST(this), ((*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))) != '\0') + 3,uVar4); tmpEntity->Update(); if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))) != '\0') { local_118 = GHIDRA_CAST(0x3); do { MusicManager::RandomVector(&local_140); uVar4 = Random(); fVar13 = random_float(); local_128.y = fVar13 * 4.0 + 8.0; scratchVec = Vector::operator_mul(&local_158,&local_128.y,&local_140); local_11c = GHIDRA_CAST(0x41200000); scratchVec2 = Vector::operator_mul(&local_174,GHIDRA_CAST(&local_11c),&local_140); scratchVec2 = (GHIDRA_CAST((GHIDRA_CAST(local_16c.y))))->Vector::__add(&local_184,scratchVec2); this = self; tmpEntity = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,2,scratchVec2,scratchVec,GHIDRA_CAST(self),3, uVar4); tmpEntity->Update(); local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_118[-1])) + 0x2eff)))); } while (local_118 != GHIDRA_CAST(0x0)); scratchVec = &this->_pos; local_118 = GHIDRA_CAST(0x0); } uVar4 = Random(); effect = (Entity_Effect *) (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0x2e,scratchVec,&g_vectorZero,GHIDRA_CAST(this),0,uVar4) ; if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))) == '\0') { local_128.y = 1.2; } else { local_128.y = 3.0; } scratchVec = Vector::operator_mul(&local_158,&local_128.y,&g_vectorOne); (GHIDRA_CAST((GHIDRA_CAST(effect))))->Entity::SetSpriteScale(scratchVec); (GHIDRA_CAST((effect)))->Entity_Effect::SetTimeout(0x1c2); effect->Update(); local_118 = GHIDRA_CAST(0x0); do { Vector::FromAngle(&local_140, (float)((double)GHIDRA_INT(local_118) + __uint_to_double_fixup[-(GHIDRA_INT(local_118) >> 0x1f)]) * 360.0 * 0.125); uVar4 = Random(); local_128.y = 12.0; scratchVec = (GHIDRA_CAST((&local_140)))->Vector::__mul(&local_158,&local_128.y); tmpEntity = (GHIDRA_CAST((g_game)))->Game::Spawn(2,1,&this->_pos,scratchVec,GHIDRA_CAST(this),0,uVar4); tmpEntity->SetCollisionDamage(); tmpEntity->Update(); local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); } while (local_118 < &DAT_00000008); if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))) != '\0') { local_118 = GHIDRA_CAST(0xa); do { MusicManager::RandomVector(&local_140); local_128.y = 10.0; (GHIDRA_CAST((&local_140)))->Vector::operator_mul_assign(&local_128.y); fVar13 = random_float(); local_11c = GHIDRA_CAST((fVar13 * 0.2 + 0.7)); (GHIDRA_CAST((&local_140)))->Vector::operator_mul_assign(GHIDRA_CAST(&local_11c)); uVar4 = Random(); tear = (Entity_Tear *) (GHIDRA_CAST((g_game)))->Game::Spawn(2,1,&this->_pos,&local_140,GHIDRA_CAST(this),0,uVar4); (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::set_falling_accel(0.8); random_float(); FUN_00444c70(); iVar9 = Isaac::Random(2); if (iVar9 == 0) { fVar13 = random_float(); (GHIDRA_CAST((tear)))->Entity_Tear::SetScale(fVar13 * 0.05 + 0.9); } else { fVar13 = random_float(); (GHIDRA_CAST((tear)))->Entity_Tear::SetScale(fVar13 * 0.05 + 1.3); } tear->SetCollisionDamage(); tear->Update(); local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_118[-1])) + 0x2eff)))); } while (local_118 != GHIDRA_CAST(0x0)); } local_14 = -NAN; (GHIDRA_CAST((local_78)))->EntityList_Query::~EntityList_Query(); scratchVec = &this->_pos; } this->_fireCooldown = 0; } } else { if ((iVar9 < 1) && (bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::IsFinishedImpl(&s_empty), bVar1 == 0)) { animState = GHIDRA_CAST(Config)::GetPillEffects(); bVar1 = (GHIDRA_CAST((animState)))->AnimationState::IsLoopingAnimation(); if (bVar1 == 0) goto LAB_00620a2e; } local_11c = GHIDRA_CAST((this->_fireCooldown + 1)); local_128.y = 4.2039e-44; piVar11 = GHIDRA_CAST(std)::min(); iVar9 = *piVar11; this->_fireCooldown = iVar9; if (0x12 < iVar9) { bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::IsPlaying(GHIDRA_CAST("FloatDown")); if (bVar1 != 0) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("ChargeStart"),0); goto LAB_00620a2e; } } bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::IsFinishedImpl(&s_empty); if (bVar1 != 0) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("ChargeLoop"),0); } } } LAB_00620a2e: cVar2 = (GHIDRA_CAST((this->_player)))->Entity::IsDead(); if (cVar2 != '\0') { this->_state = 1; this->_visible = 0; this->_shadowSize = 0.0; this->_entityCollisionClass = 0; uVar4 = Random(); (GHIDRA_CAST((g_game)))->Game::Spawn(1000,2,scratchVec,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar4); tmpEntity = GHIDRA_CAST(__RTDynamicCast()); scratchVec = (GHIDRA_CAST((&local_158)))->Vector::Vector(0.0,-10.0); (GHIDRA_CAST((tmpEntity)))->Entity::SetPositionOffset(scratchVec); tmpEntity->SetColor(); tmpEntity->Update(); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::BloodExplode(); } } else { cVar2 = (GHIDRA_CAST((this->_player)))->Entity::IsDead(); if (cVar2 == '\0') { scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); scratchVec2 = (GHIDRA_CAST((&local_174)))->Vector::Vector(0.0,10.0); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_184,scratchVec2); (GHIDRA_CAST((&this->_pos)))->Vector::operator_assign(scratchVec); uVar4 = Random(); tmpEntity = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(self),0,uVar4); tmpEntity->Update(); self->_state = 0; self->_visible = 1; self->_shadowSize = *GHIDRA_CAST((GHIDRA_CAST(self->_config) + 0x24)); self->_entityCollisionClass = 4; goto LAB_00624200; } } break; case 0x42: FamiliarAI::variant_66(this); break; case 0x43: FamiliarAI::punching_bag(this); break; case 0x44: scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); GetOrbitPosition(this,&local_148,scratchVec); scratchVec = (GHIDRA_CAST((&local_148)))->Vector::__sub(&local_158,&this->_pos); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); playerEffects = GHIDRA_CAST((GHIDRA_CAST((this->_player)))->Entity_Player)::GetEffects(); bVar1 = (GHIDRA_CAST((playerEffects)))->TemporaryEffects::HasCollectibleEffect(0x2d9); if (bVar1 == 0) { bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::IsFullSpriteRendering(); this->_entityCollisionClass = 4; this->_visible = bVar1 == 0; scratchVec2 = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); scratchVec = &local_148; goto LAB_0061ef12; } this->_visible = 0; this->_entityCollisionClass = 0; break; case 0x47: case 0x48: ai_walker(this); Shoot(this); break; case 0x49: FamiliarAI::blue_spider(this); break; case 0x4a: if ((this->_subtype == 1) || ((bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x71,0), bVar1 != 0 && (iVar9 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetFireDirection(), iVar9 == -1)))) goto switchD_0061ddf2_caseD_2; case 1: case 4: case 5: case 6: case 7: case 9: case 10: case 0xb: case 0xc: case 0x36: case 0x51: case 0x5c: case 0x61: case 0xd1: case 0xdc: FollowParent(this); Shoot(this); break; case 0x4b: ai_samsons_chains(this); break; case 0x4c: case 0x50: FollowParent(this); update_weapon(this,0); break; case 0x4d: ai_blue_babys_only_friend(this); break; case 0x4e: this->_friction = this->_friction * 0.8; (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(&g_vectorZero); if (this->_state == 0) { this->_state = 1; } scratchVec2 = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); scratchVec = &this->_pos; LAB_0061ef12: scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_174,scratchVec2); local_140.x = scratchVec->x; local_140.y = scratchVec->y; FUN_007792f0(); break; case 0x4f: FamiliarAI::lil_haunt(this,0); break; case 0x53: uVar4 = 2; (GHIDRA_CAST((game)))->Game::GetField26614(); cVar2 = DeathmatchManager::is_active(); if (cVar2 != '\0') { uVar4 = 6; } (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::GetCurrentRoom(); entityList = GHIDRA_CAST(FUN_00428a60()); EntityList::QueryRadius(entityList,GHIDRA_CAST(local_78),&this->_pos,30.0,uVar4); local_14 = 7.00649e-45; sourceRef = GHIDRA_CAST(0x0); local_130.y = 0.0; iVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); if (iVar9 != 0) { do { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::HasEntityFlags(0x20000000); if (bVar1 == 0) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::IsDescendantOf(GHIDRA_CAST(this->_spawnerEntity)); if (bVar1 == 0) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Position(&local_160); (GHIDRA_CAST((this->_player)))->Entity::Position(&local_220); FUN_00a0ff70(); sourceRef = GHIDRA_CAST(local_130.y); local_11c = in_XMM0_Da; puVar8 = GHIDRA_CAST(std)::vector::operator_index(); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Position(&local_218); (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_17c,scratchVec); local_120 = GHIDRA_CAST((GHIDRA_CAST((&local_17c)))->Vector)::LengthSquared(); in_XMM0_Da = local_11c; if ((float)local_120 < (float)local_11c) { tmpEntity = local_11c; puVar8 = GHIDRA_CAST(std)::vector::operator_index(); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Velocity(&local_210); (GHIDRA_CAST((scratchVec)))->Vector::Normalized(&local_150); (GHIDRA_CAST((&local_17c)))->Vector::Normalized(&local_148); local_11c = GHIDRA_CAST(0x41700000); (GHIDRA_CAST((&local_148)))->Vector::__mul(&local_140,GHIDRA_CAST(&local_11c)); FUN_00a10160(); FUN_0060cc20(); local_11c = GHIDRA_CAST(((float)tmpEntity / 3.1415927)); local_16c.y = 0.99; puVar8 = GHIDRA_CAST(std)::min(); local_118 = GHIDRA_CAST(*puVar8); puVar8 = GHIDRA_CAST(std)::vector::operator_index(); tmpEntity = GHIDRA_CAST(*puVar8); puVar8 = GHIDRA_CAST(std)::vector::operator_index(); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Velocity(&local_228); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_1e0,GHIDRA_CAST(&local_118)); local_164 = GHIDRA_CAST((1.0 - (float)local_118)); scratchVec2 = (GHIDRA_CAST((&local_140)))->Vector::__mul(&local_1e8,GHIDRA_CAST(&local_164)); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_1c0,scratchVec2); (GHIDRA_CAST((tmpEntity)))->Entity::SetVelocity(scratchVec); sourceRef = GHIDRA_CAST(local_130.y); if ((float)local_120 < 400.0) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::IsProjectile(); if (bVar1 == 0) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::IsTear(); if (bVar1 == 0) goto LAB_0061ebc3; puVar8 = GHIDRA_CAST(std)::vector::operator_index(); deflectedShot = GHIDRA_CAST(*puVar8); puVar8 = GHIDRA_CAST(std)::vector::operator_index(); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Velocity(&local_18c); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_184,GHIDRA_CAST(&local_118)); local_128.y = 1.0 - (float)local_118; scratchVec2 = (GHIDRA_CAST((&local_140)))->Vector::__mul(&local_174,&local_128.y); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_158,scratchVec2); (GHIDRA_CAST((deflectedShot)))->Entity_Projectile::Deflect(GHIDRA_CAST(self),scratchVec); } else { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); deflectedShot = GHIDRA_CAST(*puVar8); puVar8 = GHIDRA_CAST(std)::vector::operator_index(); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Velocity(&local_1c8); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_1d0,GHIDRA_CAST(&local_118)); local_134 = GHIDRA_CAST((1.0 - (float)local_118)); scratchVec2 = (GHIDRA_CAST((&local_140)))->Vector::__mul(&local_1d8,GHIDRA_CAST(&local_134)); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_194,scratchVec2); (GHIDRA_CAST((deflectedShot)))->Entity_Projectile::Reflect(GHIDRA_CAST(self),scratchVec); } sourceRef = GHIDRA_CAST(local_130.y); } LAB_0061ebc3: in_XMM0_Da = local_120; if ((float)local_120 < 64.0) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Die(); } this = self; } } } sourceRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sourceRef)) + 0x1)))); local_130.y = (float)sourceRef; gridIndexCounts = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList)::Size(); } while (sourceRef < gridIndexCounts); } local_14 = -NAN; (GHIDRA_CAST((local_78)))->EntityList_Query::~EntityList_Query(); case 0x1e: case 0x1f: case 0x20: case 0x21: case 0x23: case 0x2c: case 0x3c: case 0x41: case 0x45: case 0x54: case 0x75: case 0x79: case 0x7e: scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); scratchVec2 = GetOrbitPosition(this,&local_174,scratchVec); scratchVec = &this->_pos; LAB_0061ec34: scratchVec = (GHIDRA_CAST((scratchVec2)))->Vector::__sub(&local_184,scratchVec); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); break; case 0x55: FamiliarAI::lost_fly(this); break; case 0x56: room = GHIDRA_CAST((GHIDRA_CAST(()))->Level)::GetCurrentRoom(); bVar1 = (GHIDRA_CAST((room)))->Room::IsClear(); if (bVar1 != 0) { (GHIDRA_CAST((g_game)))->Game::GetField26614(); cVar2 = DeathmatchManager::is_active(); if (cVar2 == '\0') goto switchD_0061ddf2_caseD_70; } iVar9 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); if ((0 < iVar9) && (((iVar9 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(), iVar9 % 900 == 0 && (iVar9 = Isaac::Random(2), iVar9 == 0)) || (iVar9 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(), iVar9 % 0x708 == 0)))) { if (this->_coins < 2) { uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(3); if (uVar4 == 2) goto LAB_0061e0cf; LAB_0061e0e9: if (uVar4 == 0) { room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level)::GetCurrentRoom(); Room::FindFreePickupSpawnPosition(room,&local_140,&this->_pos,0.0,0,0,0); uVar4 = Random(); (GHIDRA_CAST((g_game)))->Game::Spawn(5,0x5a,&local_140,&g_vectorZero,GHIDRA_CAST(this),0,uVar4); (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(s_Spawn,1); iVar9 = 0x3f3; } else { if (uVar4 != 1) { if (uVar4 == 2) { room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level)::GetCurrentRoom(); local_130.y = (float)(GHIDRA_CAST((room)))->Room::GetEntities(); tmpEntity = GHIDRA_CAST(0x0); local_120 = GHIDRA_CAST(0x0); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->EntityList::Size(); if (iVar9 != 0) { do { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); if (bVar1 != 0) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); tmpEntity = GHIDRA_CAST(*puVar8); (GHIDRA_CAST((GHIDRA_CAST((local_a8 + 4)))))->EntityRef::constructor(GHIDRA_CAST(this)); (GHIDRA_CAST((tmpEntity)))->Entity::AddFreeze(GHIDRA_CAST((local_a8 + 4)),-0x28,0); tmpEntity = local_120; } tmpEntity = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((tmpEntity)) + 0x1)))); local_120 = tmpEntity; gridIndexCounts = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->EntityList)::Size(); } while (tmpEntity < gridIndexCounts); } (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(&DAT_00b63f60,1); SoundEffects::PlayWithFartOverride(0x3f5,1.0,2,0,1.0); } else if (uVar4 != 2) goto LAB_0061e295; goto switchD_0061ddf2_caseD_70; } Entity_Player::AddActiveCharge(this->_player,1,-1,0,0,0); (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(&DAT_00b63f60,1); iVar9 = 0x3f4; } SoundEffects::PlayWithFartOverride(iVar9,1.0,2,0,1.0); } else { uVar4 = 2; LAB_0061e0cf: (GHIDRA_CAST((g_game)))->Game::GetField26614(); cVar2 = DeathmatchManager::is_active(); if (cVar2 == '\0') goto LAB_0061e0e9; } LAB_0061e295: this->_coins = this->_coins + 1; } case 0x70: switchD_0061ddf2_caseD_70: FollowParent(this); bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::IsFinishedImpl(&s_empty); if (bVar1 != 0) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(s_Idle,0); } break; case 0x57: ai_lil_gurdy(this); break; case 0x58: FamiliarAI::bumbo(this); break; case 0x59: uVar4 = 10; (GHIDRA_CAST((game)))->Game::GetField26614(); cVar2 = DeathmatchManager::is_active(); if (cVar2 != '\0') { uVar4 = 0xe; } (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::GetCurrentRoom(); entityList = GHIDRA_CAST(FUN_00428a60()); uVar14 = 0x61e536; EntityList::QueryRadius(entityList,GHIDRA_CAST(local_78),&this->_pos,150.0,uVar4); local_14 = 5.60519e-45; sourceRef = GHIDRA_CAST(0x0); local_118 = GHIDRA_CAST(0x0); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); if (iVar9 != 0) { do { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); uVar15 = 0x61e56c; bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::HasEntityFlags(0x20000000); if (bVar1 == 0) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); if (bVar1 == 0) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Type(); if (iVar9 == 9) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); uVar14 = 0; in_stack_fffffd28 = (void *)*puVar8; in_stack_fffffd24 = GHIDRA_CAST(0x61e61e); local_118 = GHIDRA_CAST(__RTDynamicCast()); if ((local_118 != GHIDRA_CAST(0x0)) && (projectileFlags = (GHIDRA_CAST((GHIDRA_CAST(local_118))))->Entity_Projectile::ProjectileFlags(), (projectileFlags & 0x1000000) == 0)) { scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_118))))->Entity::Velocity(&local_140); local_11c = GHIDRA_CAST(0x3f000000); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_17c,GHIDRA_CAST(&local_11c)); (GHIDRA_CAST((GHIDRA_CAST(local_118))))->Entity::SetVelocity(scratchVec); (GHIDRA_CAST((GHIDRA_CAST(local_118))))->Entity_Projectile::AddProjectileFlags(0x1000000); } } else { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::IsTear(); if (bVar1 != 0) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); uVar14 = 0; in_stack_fffffd28 = (void *)*puVar8; in_stack_fffffd24 = GHIDRA_CAST(0x61e6cb); local_130.y = (float)__RTDynamicCast(); if (GHIDRA_CAST(local_130.y) != GHIDRA_CAST(0x0)) { scratchFlags = GHIDRA_CAST(FUN_00435bc0()); flagsOperand = (GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->Entity_Tear::TearFlags(&local_1b8); scratchFlags = BitSet128::operator_and(&local_208,flagsOperand,scratchFlags); bVar1 = (GHIDRA_CAST((scratchFlags)))->BitSet128::IsZero(); fVar13 = local_130.y; if ((bVar1 != 0) && (bVar1 = Entity::IsDescendantOf (GHIDRA_CAST(local_130.y),GHIDRA_CAST(this->_spawnerEntity)), bVar1 == 0)) { scratchVec = (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity::Velocity(&local_150); local_16c.y = 0.5; scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_160,&local_16c.y); (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity::SetVelocity(scratchVec); scratchFlags = GHIDRA_CAST(FUN_00435bc0()); flagsOperand = (GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->Entity_Tear::TearFlags(&local_258); scratchFlags = BitSet128::operator_or(&local_248,flagsOperand,scratchFlags); uVar14 = (undefined4)scratchFlags->_l; in_stack_fffffd28 = (void *)0x61e7b5; (GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->Entity_Tear::SetTearFlags(*scratchFlags); } goto LAB_0061e7b5; } } } } else { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); tmpEntity = GHIDRA_CAST(*puVar8); fVar13 = 8.990418e-39; (GHIDRA_CAST((GHIDRA_CAST((local_a8 + 4)))))->EntityRef::constructor(GHIDRA_CAST(this)); bVar1 = 0; (GHIDRA_CAST((0x3f800000)))->Color::Color(0x28,0x28,0x28); color._tint[1] = (float)in_stack_fffffd10; color._tint[0] = (float)in_stack_fffffd0c; color._tint[2] = (float)in_stack_fffffd14; color._tint[3] = (float)in_stack_fffffd18; color._colorize[0] = (float)in_stack_fffffd1c; color._colorize[1] = (float)in_stack_fffffd20; color._colorize[2] = (float)in_stack_fffffd24; color._colorize[3] = (float)in_stack_fffffd28; color._offset[0] = (float)uVar14; color._offset[1] = (float)uVar15; color._offset[2] = fVar13; (GHIDRA_CAST((tmpEntity)))->Entity::AddSlowing(GHIDRA_CAST((local_a8 + 4)),2,0.9,color,bVar1); LAB_0061e7b5: sourceRef = local_118; } } sourceRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sourceRef)) + 0x1)))); local_118 = sourceRef; gridIndexCounts = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList)::Size(); } while (sourceRef < gridIndexCounts); } local_14 = -NAN; (GHIDRA_CAST((local_78)))->EntityList_Query::~EntityList_Query(); case 0x1a: case 0x1b: case 0x28: case 0x29: case 0x67: FollowParent(this); break; case 0x5d: FamiliarAI::gb_bug(this); break; case 0x5e: case 0x71: FamiliarAI::spider_mod(this); break; case 0x5f: bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::IsFinishedImpl(&DAT_00b1d3b0); if (bVar1 != 0) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(s_Idle,0); iVar9 = Isaac::Random(3); if (iVar9 == 0) { (GHIDRA_CAST((GHIDRA_CAST(local_a8))))->Color::Color(); (GHIDRA_CAST((g_game)))->Game::Fart(&this->_pos,85.0,GHIDRA_CAST(this),1.0,0,fartColor); Game::ButterBeanFart(g_game,&this->_pos,120.0,this->_player,0,0); } else if (iVar9 == 1) { Game::ButterBeanFart(g_game,&this->_pos,120.0,this->_player,1,0); } else if (iVar9 == 2) { Game::CharmFart(&this->_pos,100.0,GHIDRA_CAST(this)); } } LAB_0061f886: FollowParent(this); if (0 < this->_fireCooldown) { this->_fireCooldown = this->_fireCooldown + -1; } goto LAB_00624200; case 0x60: bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(7,this->_index); if (bVar1 != 0) { (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::GetCurrentRoom(); entityList = GHIDRA_CAST(FUN_00428a60()); EntityList::QueryRadius(entityList,GHIDRA_CAST(local_78),&this->_pos,150.0,8); local_14 = 9.80909e-45; sourceRef = GHIDRA_CAST(0x0); local_118 = GHIDRA_CAST(0x0); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); if (iVar9 != 0) { do { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); if (bVar1 != 0) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsDescendantOf(GHIDRA_CAST(*puVar8)); if (bVar1 == 0) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::HasEntityFlags(0x20000010); if (bVar1 == 0) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); virtualFn = *(code **)(*GHIDRA_CAST(*puVar8) + 0x20); (GHIDRA_CAST((GHIDRA_CAST((local_a8 + 4)))))->EntityRef::constructor(GHIDRA_CAST(self)); (*virtualFn)(); sourceRef = local_118; this = self; } } } sourceRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sourceRef)) + 0x1)))); local_118 = sourceRef; gridIndexCounts = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList)::Size(); } while (sourceRef < gridIndexCounts); } local_14 = -NAN; (GHIDRA_CAST((local_78)))->EntityList_Query::~EntityList_Query(); } uVar4 = 0; iVar9 = (GHIDRA_CAST((g_game)))->Game::GetNumPlayers(); if (iVar9 != 0) { do { local_130.y = (float)(GHIDRA_CAST((g_game)))->Game::GetPlayer(uVar4); (GHIDRA_CAST((g_game)))->Game::GetField26614(); cVar2 = DeathmatchManager::is_active(); if ((cVar2 == '\0') || (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsDescendantOf(GHIDRA_CAST(local_130.y)), bVar1 != 0)) { scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->Entity::Position(&local_158); local_128.y = (GHIDRA_CAST((scratchVec)))->Vector::DistanceSquared(&this->_pos); if (local_128.y < 10000.0) { FUN_0060d0c0(); } } uVar4 = uVar4 + 1; uVar6 = (GHIDRA_CAST((g_game)))->Game::GetNumPlayers(); } while (uVar4 < uVar6); } MoveDiagonally(this,1.0); break; case 0x62: goto switchD_0061ddf2_caseD_62; case 99: ai_lil_monstro(this); goto switchD_0061ddf2_caseD_62; case 100: if (GHIDRA_UINT(this->_subtype) < *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0xf38))))) { FollowParent(this); } else { bVar1 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered(&DAT_00b63f64); if (bVar1 == 0) { tmpEntity = GHIDRA_CAST(&this->_pos); } else { this->_shadowSize = 0.0; SoundEffects::PlayWithFartOverride(0x35,1.0,2,0,1.0); SoundEffects::PlayWithFartOverride(0x33,1.0,2,0,1.0); playerEffects = GHIDRA_CAST((GHIDRA_CAST((this->_player)))->Entity_Player)::GetEffects(); (GHIDRA_CAST((playerEffects)))->TemporaryEffects::AddCollectibleEffect(0x1b4,1,1); uVar4 = Random(); local_11c = GHIDRA_CAST(&this->_pos); tmpEntity = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0xd,GHIDRA_CAST(local_11c),&g_vectorZero,GHIDRA_CAST(this),0, uVar4); virtualFn = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x3c); (GHIDRA_CAST(()))->Color::Color(); (*virtualFn)(); tmpEntity->Update(); uVar4 = Random(); tmpEntity = local_11c; tmpEntity = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0x5a,GHIDRA_CAST(local_11c),&g_vectorZero,GHIDRA_CAST(0x0),0, uVar4); tmpEntity->Update(); this = self; } this->_friction = this->_friction * 0.5; bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::IsFinishedImpl(&s_empty); if (bVar1 != 0) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(s_Idle,0); this->_visible = 0; (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Vector::operator_assign(&g_vectorZero); goto LAB_0061e4de; } } break; case 0x65: MoveDelayed(this,0x14); (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::GetCurrentRoom(); entityList = GHIDRA_CAST(FUN_00428a60()); EntityList::QueryRadius(entityList,GHIDRA_CAST(local_78),&this->_pos,this->_size,4); local_14 = 1.4013e-44; sourceRef = GHIDRA_CAST(0x0); local_118 = GHIDRA_CAST(0x0); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); if (iVar9 != 0) { do { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); cVar2 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::IsDead(); if (cVar2 == '\0') { (GHIDRA_CAST((g_game)))->Game::GetField26614(); cVar2 = DeathmatchManager::is_active(); if (cVar2 != '\0') { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); tmpEntity = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity)::SpawnerEntity(); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsDescendantOf(tmpEntity); if (bVar1 == 0) goto LAB_006213fc; } std::vector::operator_index(); cVar2 = FUN_004d7760(); if (cVar2 == '\0') { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::IsTear(); if (bVar1 != 0) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); tear = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::ToTear(); local_16c.y = (float)tear; iVar9 = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Variant(); if (iVar9 != 9) { iVar9 = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Variant(); if (iVar9 != 0x2d) { iVar9 = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Variant(); if (iVar9 != 0x28) { flagsOperand = &g_tearFlagLudovico; scratchFlags = (GHIDRA_CAST((tear)))->Entity_Tear::TearFlags(GHIDRA_CAST(local_68)); scratchFlags = BitSet128::operator_and(&local_1b8,scratchFlags,flagsOperand); bVar1 = (GHIDRA_CAST((scratchFlags)))->BitSet128::IsNonZero(); if (bVar1 != 0) { FUN_005cd750(); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::GetIntervalTicks((float)in_XMM0_Da,0.0); if (iVar9 == 0) goto LAB_006213f6; } cVar2 = FUN_0060cd60(); if (cVar2 == '\0') { FUN_0060cd70(); iVar9 = FUN_0060cd10(); local_134 = GHIDRA_CAST(CONCAT13(0 < iVar9,(undefined3)local_134)); if (iVar9 < 1) { scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Velocity(&local_158); } else { pfVar10 = GHIDRA_CAST(FUN_0060cd40()); local_140.y = pfVar10[1]; scratchVec = &local_140; local_140.x = *pfVar10; } local_17c.x = scratchVec->x; local_17c.y = scratchVec->y; local_128.y = 1.333; if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))) == '\0') { scratchVec = (GHIDRA_CAST((&local_17c)))->Vector::__mul(&local_184,&local_128.y); (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::SetVelocity(scratchVec); } else { (GHIDRA_CAST((&local_17c)))->Vector::__mul(&local_174,&local_128.y); FUN_0060cd20(); } floatResult = (float10)(GHIDRA_CAST((tear)))->Entity_Tear::Height(); Entity_Projectile::SetHeight (GHIDRA_CAST(tear),(float)(floatResult * (float10)1.5)); scratchVec = (GHIDRA_CAST((&local_17c)))->Vector::Rotated(&local_18c,90.0); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Normalized(&local_194); (GHIDRA_CAST((&local_17c)))->Vector::operator_assign(scratchVec); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Position(&local_1d8); local_11c = GHIDRA_CAST(0x40a00000); scratchVec2 = (GHIDRA_CAST((&local_17c)))->Vector::__mul(&local_1d0,GHIDRA_CAST(&local_11c)); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_1c8,scratchVec2); fVar13 = local_16c.y; (GHIDRA_CAST((GHIDRA_CAST(local_16c.y))))->Entity::SetPosition(scratchVec); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity::Variant(); if (((iVar9 != 0x23) && (iVar9 = (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity::Variant(), iVar9 != 0x25)) && (iVar9 = (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity::Variant(), iVar9 != 0x26)) { (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity_Tear::ChangeVariant(0x15); } tmpEntity = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity)::SpawnerEntity(); tear = (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity_Tear::MakeMultidimensionalCopy(tmpEntity); tmpEntity = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity)::Parent(); (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::SetParent(tmpEntity); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity::Position(&local_1c0); local_130.y = 10.0; scratchVec2 = (GHIDRA_CAST((&local_17c)))->Vector::__mul(&local_1e8,&local_130.y); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_1e0,scratchVec2); (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::SetPosition(scratchVec); tear->Update(); this = self; } } } } LAB_006213f6: sourceRef = local_118; } } else { std::vector::operator_index(); local_128.y = (float)FUN_0060cc90(); cVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_128.y))))->Entity_Knife::IsFlying(); if (cVar2 != '\0') { multidimensional_baby_copy_knife(GHIDRA_CAST(local_128.y),GHIDRA_CAST(this)); } } } LAB_006213fc: sourceRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sourceRef)) + 0x1)))); local_118 = sourceRef; gridIndexCounts = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList)::Size(); } while (sourceRef < gridIndexCounts); } PlayFloatAnim(this,3); gridIndexCounts = local_78; LAB_006241ee: local_14 = -NAN; (GHIDRA_CAST((gridIndexCounts)))->EntityList_Query::~EntityList_Query(); break; case 0x69: FollowParent(this); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(3,0); if ((bVar1 != 0) && (iVar9 = Isaac::Random(5), iVar9 != 0)) { uVar4 = Random(); (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0x36,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar4); tmpEntity = GHIDRA_CAST(__RTDynamicCast()); fVar13 = random_float(); pfVar10 = GHIDRA_CAST(&local_11c); scratchVec = &local_140; local_11c = GHIDRA_CAST((fVar13 * 0.5 + 0.2)); goto LAB_0061dea4; } break; case 0x6a: if (this->_subtype != 0) { if (this->_visible == 0) { LAB_00620f26: (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(&g_vectorZero); followTarget = (EntityPtr)this->_player; if (this->_parent != (EntityPtr)0x0) { followTarget = this->_parent; } scratchVec = (GHIDRA_CAST((GHIDRA_CAST(followTarget))))->Entity::Position(&local_158); (GHIDRA_CAST((&this->_pos)))->Vector::operator_assign(scratchVec); } else { this->_visible = 0; iVar9 = Isaac::Random(2); local_118 = GHIDRA_CAST((iVar9 + 3)); if (0 < GHIDRA_INT(local_118)) { do { uVar4 = Random(); room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level)::GetCurrentRoom(); scratchVec = Room::FindFreePickupSpawnPosition(room,&local_158,&this->_pos,40.0,0,0,0); (GHIDRA_CAST((g_game)))->Game::Spawn(0x17,0,scratchVec,&g_vectorZero,GHIDRA_CAST(this),1,uVar4); tmpEntity = GHIDRA_CAST(__RTDynamicCast()); addEnemyKillScore = 0; bVar1 = 0; iVar9 = -1; sourceRef = (GHIDRA_CAST((GHIDRA_CAST((local_a8 + 4)))))->EntityRef::EntityRef(); (GHIDRA_CAST((tmpEntity)))->Entity::AddCharmed(sourceRef,iVar9,bVar1,addEnemyKillScore); (GHIDRA_CAST((tmpEntity)))->Entity::SetVisibleFlag(0); tmpEntity->Update(); local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_118[-1])) + 0x2eff)))); } while (local_118 != GHIDRA_CAST(0x0)); } if (this->_visible == 0) goto LAB_00620f26; } this->_friction = this->_friction * 0.7; break; } (*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0x4))) = "WalkDown"; (*GHIDRA_CAST((GHIDRA_CAST(&(local_68)) + 0x8))) = &DAT_00b1e020; local_5c = "WalkHori"; (*GHIDRA_CAST((GHIDRA_CAST(&(local_78)) + 0x4))) = "FlyDown"; (*GHIDRA_CAST((GHIDRA_CAST(&(local_78)) + 0x8))) = &DAT_00b1ddc0; pcStack_6c = "FlyHori"; bVar1 = (GHIDRA_CAST((this->_player)))->Entity::IsFlying(); gridIndexCounts = local_78; if (bVar1 == 0) { gridIndexCounts = local_68; } local_130.y = (float)(gridIndexCounts + 4); MoveDelayed(this,0x14); local_120 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(this))))->Entity)::get_velocity_direction(); local_128.y = (GHIDRA_CAST((&this->_velocity)))->Vector::LengthSquared(); if (1.0 <= local_128.y) { sprite = &this->_sprite; if (local_120 == GHIDRA_CAST(0x3)) { (GHIDRA_CAST((sprite)))->ANM2::Play(*GHIDRA_CAST(local_130.y),0); } else if (local_120 == GHIDRA_CAST(0x1)) { (GHIDRA_CAST((sprite)))->ANM2::Play(*GHIDRA_CAST((GHIDRA_CAST(local_130.y) + 4)),0); } else { (GHIDRA_CAST((sprite)))->ANM2::Play((GHIDRA_CAST((GHIDRA_INT(local_130.y) + 8)))->_begin,0); (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::set_flip_x(local_120 == GHIDRA_CAST(0x0)); } } else { local_130.y = *GHIDRA_CAST(local_130.y); bVar1 = (GHIDRA_CAST((this->_player)))->Entity::IsFlying(); if (bVar1 == 0) { (GHIDRA_CAST((&this->_sprite)))->ANM2::SetFrame(GHIDRA_CAST(local_130.y),0); } else { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST(local_130.y),0); } } bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::IsPlaying(&s_empty); if (bVar1 != 0) { fVar13 = (GHIDRA_CAST((&this->_velocity)))->Vector::Length(); local_118 = GHIDRA_CAST((fVar13 * 0.5)); fVar13 = 1.0; if ((float)local_118 < 2.3) { fVar13 = assert_lerp_range((float)local_118,1.0,2.3,0.5,1.0,1); } if (6.0 < (float)local_118) { fVar13 = assert_lerp_range((float)local_118,6.0,10.0,1.0,2.0,1); } set_PlaybackSpeed(&this->_sprite,fVar13); } if (this->_variant == 0x6a) { iVar9 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetPlayerType(); if (iVar9 == 0xc) { spriteColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); blue = 0x24; green = 0x1c; iVar9 = 0xee; } else { spriteColor = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite)::Color(); blue = 0xff; green = 0xff; iVar9 = 0xff; } (GHIDRA_CAST((spriteColor)))->KColor::FromRGBA255(iVar9,green,blue,0xff); } (GHIDRA_CAST((g_game)))->Game::GetField26614(); cVar2 = DeathmatchManager::is_active(); iVar9 = 0x29a; if (cVar2 != '\0') { iVar9 = 100; } if (iVar9 < this->_state) { this->_subtype = 1; } goto LAB_00624200; case 0x6b: if (this->_subtype == 0) { bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::IsFinishedImpl(&s_empty); if (bVar1 != 0) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("Phase2"),0); } MoveDiagonally(this,1.3); iVar9 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetFireDirection(); if (iVar9 != -1) { this->_subtype = 1; (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("RevertToPhase1"),0); this->_fireCooldown = 0x1e; } } else if (this->_subtype == 1) { sprite = &this->_sprite; local_128.y = (float)sprite; bVar1 = (GHIDRA_CAST((sprite)))->ANM2::IsFinishedImpl(&s_empty); if (bVar1 != 0) { (GHIDRA_CAST((sprite)))->ANM2::Play(s_Idle,0); } iVar9 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetFireDirection(); if (iVar9 == -1) { this->_subtype = 0; (GHIDRA_CAST((sprite)))->ANM2::Play(GHIDRA_CAST("Phase2Start"),0); } game = g_game; this->_friction = this->_friction * 0.85; room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(game))))->Level)::GetCurrentRoom(); scratchVec = (GHIDRA_CAST((room)))->Room::GetClampedPosition(&local_158,&this->_pos,this->_size); (GHIDRA_CAST((&this->_pos)))->Vector::operator_assign(scratchVec); iVar9 = this->_fireCooldown; this->_fireCooldown = iVar9 + -1; if (iVar9 < 1) { this->_fireCooldown = 0x1e; iVar9 = 0; do { scratchVec = (GHIDRA_CAST((&local_158)))->Vector::Vector(0.0,1.0); bVar1 = 0; scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Rotated(&local_174,(float)iVar9 * 45.0); FireProjectile(this,scratchVec,bVar1); iVar9 = iVar9 + 1; } while (iVar9 < 8); (GHIDRA_CAST((GHIDRA_CAST(local_128.y))))->ANM2::Play(GHIDRA_CAST("RevertToPhase1"),0); } } break; case 0x6d: iVar9 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetFireDirection(); if (iVar9 == -1) { FollowParent(this); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SetTarget(GHIDRA_CAST(0x0)); } else { bVar1 = IsLilithBirthrightIncubus(this); game = g_game; if (bVar1 == 0) { this->_friction = this->_friction * 0.7; room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(game))))->Level)::GetCurrentRoom(); scratchVec = (GHIDRA_CAST((room)))->Room::GetClampedPosition(&local_158,&this->_pos,0.0); (GHIDRA_CAST((&this->_pos)))->Vector::operator_assign(scratchVec); } else { FollowParent(this); } PickEnemyTarget(this,800.0,8,0x13,&g_vectorZero,15.0); } iVar9 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::get_velocity_direction(); local_128.y = (GHIDRA_CAST((&this->_velocity)))->Vector::LengthSquared(); if (local_128.y < 1.0) { iVar9 = 3; } PlayFloatAnim(this,iVar9); break; case 0x6e: pfVar10 = GHIDRA_CAST((GHIDRA_CAST((this->_player)))->Entity_Player)::GetAimDirection(); local_150.x = *pfVar10; local_150.y = pfVar10[1]; bVar1 = (GHIDRA_CAST((&local_150)))->Vector::operator_eq(&g_vectorZero); if (bVar1 != 0) { iVar9 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetHeadDirection(); scratchVec = Isaac::GetAxisAlignedUnitVectorFromDir(&local_158,iVar9); (GHIDRA_CAST((&local_150)))->Vector::operator_assign(scratchVec); bVar1 = (GHIDRA_CAST((&local_150)))->Vector::operator_eq(&g_vectorZero); if (bVar1 != 0) { scratchVec = (GHIDRA_CAST((&local_158)))->Vector::Vector(0.0,1.0); (GHIDRA_CAST((&local_150)))->Vector::operator_assign(scratchVec); } } local_128.y = (GHIDRA_CAST((&local_150)))->Vector::GetAngleDegrees(); fVar13 = LerpAngleDeg(this->_orbitAngleOffset,local_128.y,0.3); this->_orbitAngleOffset = fVar13; scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); scratchVec2 = Vector::FromAngle(&local_174,this->_orbitAngleOffset); local_128.y = 50.0; scratchVec2 = (GHIDRA_CAST((scratchVec2)))->Vector::__mul(&local_184,&local_128.y); (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_160,scratchVec2); scratchVec = (GHIDRA_CAST((&local_160)))->Vector::__sub(&local_18c,&this->_pos); local_128.y = 0.3; scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_158,&local_128.y); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_add_assign(scratchVec); this->_friction = this->_friction * 0.7; scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_194); (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_140,scratchVec); fVar13 = (GHIDRA_CAST((&local_140)))->Vector::GetAngleDegrees(); local_128.y = fVar13 - 90.0; fVar13 = normalize_angle_degrees(local_128.y); (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetRotation(fVar13); floatResult = (float10)(GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::Rotation(); local_128.y = (float)floatResult; local_134 = GHIDRA_CAST(CONCAT13(1.0 < local_128.y,(undefined3)local_134)); layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); layer->_flipX = (*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))); (GHIDRA_CAST((g_game)))->Game::GetField26614(); cVar2 = DeathmatchManager::is_active(); iVar9 = 3; if (cVar2 != '\0') { iVar9 = 0x3c; } bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(iVar9,0); if (bVar1 != 0) { sourceRef = this->_player; scratchVec = (GHIDRA_CAST((&local_140)))->Vector::Normalized(&local_158); techLaser = Entity_Player::FireTechLaser (sourceRef,&this->_pos,2,scratchVec,0,1,GHIDRA_CAST(this),1.0); scratchVec = (GHIDRA_CAST((&local_174)))->Vector::Vector(0.0,-10.0); (GHIDRA_CAST((GHIDRA_CAST(techLaser))))->Entity::SetPositionOffset(scratchVec); FUN_0044bf90(); virtualFn = *(code **)(*GHIDRA_CAST(techLaser) + 0x40); pTVar5 = Entity_Player::GetTearHitParams(self->_player,&local_110,3,1.0,1,GHIDRA_CAST(self)); local_128.y = pTVar5->_tearDamage * 0.1; apply_tear_modifiers(self); (*virtualFn)(); FUN_0044bfa0(); FUN_00435bc0(); FUN_00456830(); FUN_0060cf00(); set_field_0x37c(); techLaser->Update(); } break; case 0x6f: ai_variant_111(this); break; case 0x73: bVar1 = (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_eq(&g_vectorZero); if (bVar1 != 0) { (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_assign(&this->_pos); } bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::IsFinishedImpl(&s_empty); if (bVar1 != 0) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(s_Fly,0); } bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0x1e,this->_index); if (bVar1 != 0) { (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::GetCurrentRoom(); entityList = GHIDRA_CAST(FUN_00428a60()); EntityList::QueryRadius(entityList,GHIDRA_CAST(local_78),&this->_pos,150.0,8); local_14 = 1.54143e-44; sourceRef = GHIDRA_CAST(0x0); local_130.y = 0.0; local_120 = GHIDRA_CAST(0x471c4000); local_118 = GHIDRA_CAST(0x0); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); if (iVar9 != 0) { do { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(this)); if (bVar1 != 0) { piVar11 = GHIDRA_CAST(std)::vector::operator_index(); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::SpawnerEntity(); sourceRef = local_118; if (*piVar11 != iVar9) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Position(&local_158); local_128.y = (GHIDRA_CAST((scratchVec)))->Vector::DistanceSquared(&this->_pos); if (local_128.y < (float)local_120) { local_120 = GHIDRA_CAST(local_128.y); pfVar10 = GHIDRA_CAST(std)::vector::operator_index(); local_130.y = *pfVar10; } } } sourceRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sourceRef)) + 0x1)))); local_118 = sourceRef; gridIndexCounts = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList)::Size(); fVar13 = local_130.y; } while (sourceRef < gridIndexCounts); if (GHIDRA_CAST(local_130.y) != GHIDRA_CAST(0x0)) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("Attack"),1); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity::Position(&local_158); fVar16 = (this->_pos).x; (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::set_flip_x(scratchVec->x <= fVar16 && fVar16 != scratchVec->x); uVar4 = Random(); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity::Position(&local_158); scratchVec2 = (GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->Entity::Velocity(&local_174); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_184,scratchVec2); scratchVec2 = &self->_pos; scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_18c,scratchVec2); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Resized(&local_194,10.0); this = self; (GHIDRA_CAST((g_game)))->Game::Spawn(2,1,scratchVec2,scratchVec,GHIDRA_CAST(self),0,uVar4); tear = GHIDRA_CAST(__RTDynamicCast()); local_128.y = apply_tear_modifiers(this); fVar13 = apply_tear_modifiers(this); local_11c = GHIDRA_CAST((fVar13 * 0.2 + 0.6)); tear->SetCollisionDamage(); (GHIDRA_CAST((tear)))->Entity_Tear::SetScale((float)local_11c); FUN_00444c70(); TryFireTear(this,tear); tear->Update(); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); } } local_14 = -NAN; (GHIDRA_CAST((local_78)))->EntityList_Query::~EntityList_Query(); } (GHIDRA_CAST((g_game)))->Game::GetField26614(); cVar2 = DeathmatchManager::is_active(); if ((cVar2 != '\0') && (this->_counter = this->_counter + 1, 0x2ed < this->_counter)) { iVar9 = Player(this); if (iVar9 != 0) { sourceRef = GHIDRA_CAST(Player(this)); playerEffects = GHIDRA_CAST((GHIDRA_CAST((sourceRef)))->Entity_Player)::GetEffects(); (GHIDRA_CAST((playerEffects)))->TemporaryEffects::RemoveCollectibleEffect(0x1f8,1); } virtualFn = *(code **)(*GHIDRA_CAST(this) + 0x24); (GHIDRA_CAST((GHIDRA_CAST((local_a8 + 4)))))->EntityRef::EntityRef(); (*virtualFn)(); } scratchVec = (GHIDRA_CAST((&this->_targetPosition)))->Vector::__sub(&local_158,&this->_pos); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); this->_friction = this->_friction * 0.8; break; case 0x74: scratchVec = &this->_pos; local_120 = GHIDRA_CAST(scratchVec); scratchVec2 = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_140,scratchVec2); fVar13 = (GHIDRA_CAST((&local_140)))->Vector::GetAngleDegrees(); local_128.y = fVar13 + 45.0; fVar13 = normalize_angle_degrees(local_128.y); local_134 = GHIDRA_CAST(GHIDRA_INT(((1.0 - (fVar13 + 180.0) / 360.0) * 8.0))); if (0 < this->_fireCooldown) { this->_fireCooldown = this->_fireCooldown + -1; } local_164 = GHIDRA_CAST(apply_forgotten_lullaby(this,0xc)); if (this->_fireCooldown < 1) { local_130.y = 0.0; (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::GetCurrentRoom(); entityList = GHIDRA_CAST(FUN_00428a60()); EntityList::QueryRadius(entityList,GHIDRA_CAST(local_78),scratchVec,200.0,8); local_14 = 1.68156e-44; iVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); if (iVar9 == 0) { LAB_00621e31: entityList = GHIDRA_CAST(&DAT_00000004); } else { uVar4 = 0; do { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); sourceRef = GHIDRA_CAST(*puVar8); local_118 = sourceRef; bVar1 = (GHIDRA_CAST((GHIDRA_CAST(sourceRef))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); if ((bVar1 != 0) && (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(sourceRef))))->Entity::HasEntityFlags(0x20000010), bVar1 == 0)) { room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level)::GetCurrentRoom(); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_118))))->Entity::Position(&local_158); bVar1 = (GHIDRA_CAST((room)))->Room::CheckLine(GHIDRA_CAST(local_120),scratchVec,3,900,0,0,GHIDRA_CAST(0x0)); if (bVar1 != 0) { scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_118))))->Entity::Position(&local_174); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_184,GHIDRA_CAST(local_120)); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Normalized(&local_18c); fVar13 = (GHIDRA_CAST((&local_140)))->Vector::GetAngleDegrees(); scratchVec2 = Vector::FromAngle(&local_194,fVar13 - 45.0); local_128.y = (GHIDRA_CAST((scratchVec)))->Vector::Dot(scratchVec2); if (0.9 < local_128.y) { local_130.y = (float)local_118; } } } fVar13 = local_130.y; uVar4 = uVar4 + 1; uVar6 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); this = self; } while (uVar4 < uVar6); if (GHIDRA_CAST(fVar13) == GHIDRA_CAST(0x0)) goto LAB_00621e31; scratchVec = (GHIDRA_CAST((GHIDRA_CAST(fVar13))))->Entity::Position(&local_158); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_174,&this->_pos); (GHIDRA_CAST((&local_140)))->Vector::operator_assign(scratchVec); uVar4 = Random(); scratchVec = (GHIDRA_CAST((&local_140)))->Vector::Normalized(&local_158); local_128.y = 10.0; scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_174,&local_128.y); (GHIDRA_CAST((g_game)))->Game::Spawn(2,1,&this->_pos,scratchVec,GHIDRA_CAST(this),0,uVar4); tear = GHIDRA_CAST(__RTDynamicCast()); FUN_00444c70(); local_11c = GHIDRA_CAST(apply_tear_modifiers(this)); fVar13 = apply_tear_modifiers(this); local_16c.y = fVar13 * 0.35 + 0.7; tear->SetCollisionDamage(); (GHIDRA_CAST((tear)))->Entity_Tear::SetScale(local_16c.y); TryFireTear(this,tear); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); entityList = local_164; } local_14 = -NAN; this->_fireCooldown = GHIDRA_INT(entityList); (GHIDRA_CAST((local_78)))->EntityList_Query::~EntityList_Query(); scratchVec = &this->_pos; } (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetFrame_1(GHIDRA_INT(local_134)); scratchVec2 = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); scratchVec2 = GetOrbitPosition(this,&local_174,scratchVec2); goto LAB_0061ec34; case 0x76: update_angry_fly(this); break; case 0x77: ai_lil_spewer(this); break; case 0x78: FamiliarAI::sprinkler(this); break; case 0x7a: ai_lil_harbingers(this); break; case 0x7b: if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c7fc58) && (_Init_thread_header(), DAT_00c7fc58 == -1)) { (GHIDRA_CAST(()))->Color::Color(); (GHIDRA_CAST(()))->Color::Color(); (GHIDRA_CAST(()))->Color::Color(); (GHIDRA_CAST(()))->Color::Color(); _Init_thread_footer(); } scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); scratchVec = GetOrbitPosition(this,&local_174,scratchVec); local_128.y = (float)&this->_pos; scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__sub(&local_184,GHIDRA_CAST(local_128.y)); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level)::GetCurrentRoom(); local_164 = (GHIDRA_CAST((room)))->Room::GetEntities(); sourceRef = GHIDRA_CAST(0x0); local_130.y = 0.0; iVar9 = (GHIDRA_CAST((local_164)))->EntityList::Size(); if (iVar9 != 0) { do { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); cVar2 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::IsDead(); if (cVar2 != '\0') goto LAB_006223ba; puVar8 = GHIDRA_CAST(std)::vector::operator_index(); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Type(); if (iVar9 == 2) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Position(&local_158); local_11c = GHIDRA_CAST((GHIDRA_CAST((scratchVec)))->Vector)::DistanceSquared(GHIDRA_CAST(local_128.y)); fVar13 = 625.0; if (625.0 <= (float)local_11c) goto LAB_006223d9; std::vector::operator_index(); local_120 = GHIDRA_CAST(__RTDynamicCast()); cVar2 = FUN_0060cd80(); if (cVar2 == '\0') { (GHIDRA_CAST((g_game)))->Game::GetField26614(); cVar2 = DeathmatchManager::is_active(); if (cVar2 != '\0') { bVar1 = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::IsDescendantOf(GHIDRA_CAST(this->_spawnerEntity)); if (bVar1 == 0) goto LAB_006223ba; } flagsOperand = &g_tearFlagLudovico; scratchFlags = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity_Tear::TearFlags(&sourceTearFlags); scratchFlags = BitSet128::operator_and(&sourceLudovicoBits,scratchFlags,flagsOperand); bVar1 = (GHIDRA_CAST((scratchFlags)))->BitSet128::IsNonZero(); tmpEntity = local_120; local_134 = GHIDRA_CAST(CONCAT13(bVar1,(undefined3)local_134)); if (bVar1 == 0) { local_120->Remove(); } else { FUN_005cd750(); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::GetIntervalTicks(fVar13,0.0); if (iVar9 == 0) goto LAB_006223ba; tmpEntity = local_120; } local_118 = GHIDRA_CAST(0x0); local_11c = GHIDRA_CAST(&DAT_00c7fc60); do { local_16c.y = (float)(GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::InitSeed(); local_160.y = (float)(GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::SubType(); local_150.y = (float)(GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::SpawnerEntity(); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::Velocity(&local_174); scratchVec2 = (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::Position(&local_184); uVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::Variant(); (GHIDRA_CAST((g_game)))->Game::Spawn(2,uVar4,scratchVec2,scratchVec,GHIDRA_CAST(local_150.y), GHIDRA_UINT(local_160.y),GHIDRA_UINT(local_16c.y)); tear = GHIDRA_CAST(__RTDynamicCast()); tmpEntity = local_120; floatResult = (float10)(GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity_Tear::Height(); (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::SetHeight((float)floatResult); (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity_Tear::FallingSpeed(); FUN_00444c70(); floatResult = (float10)(GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity_Tear::FallingAcceleration(); (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::set_falling_accel((float)floatResult); FUN_0060cca0(); FUN_00676bd0(); floatResult = (float10)(GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity_Tear::BaseScale(); (GHIDRA_CAST((tear)))->Entity_Tear::SetScale((float)floatResult); scratchFlags = (GHIDRA_CAST((&g_tearFlagLudovico)))->BitSet128::__bnot(¬LudovicoFlags); flagsOperand = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity_Tear::TearFlags(&sourceTearFlagsCopy); scratchFlags = BitSet128::operator_and (&flagsWithoutLudovico,flagsOperand,scratchFlags); (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(*scratchFlags); FUN_0060cd10(); (GHIDRA_CAST((tear)))->Entity_Tear::SetWaitFrames(); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity_Tear::TearIndex(); (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Effect::set_state(iVar9); virtualFn = *(code **)(*GHIDRA_CAST(tear) + 0x40); floatResult = (float10)(GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::CollisionDamage(); fVar13 = (float)floatResult; local_150.y = fVar13; (*virtualFn)(); tmpEntity = local_120; (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity_Tear::Rotation(); FUN_004aadb0(); FUN_0060ccf0(); (GHIDRA_CAST((tear)))->Entity_Tear::SetKnockbackMultiplier(); FUN_0060cd50(); (GHIDRA_CAST((tear)))->Entity_Tear::SetDeadEyeIntensity(fVar13); FUN_0060cd60(); FUN_0060cd70(); FUN_0060cda0(); FUN_0060cd90(); tmpEntity = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity)::Parent(); (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::SetParent(tmpEntity); tmpEntity = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity)::SpawnerEntity(); (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::SetSpawnerEntity(tmpEntity); local_16c.y = (float)GHIDRA_INT(local_118); if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))) == '\0') { scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Velocity(&local_1c8); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Rotated(&local_1c0,30.0 - local_16c.y * 20.0); } else { scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Velocity(&local_18c); scratchVec2 = Vector::FromAngle(&local_194,local_16c.y * 90.0); local_148.y = 10.0; scratchVec2 = (GHIDRA_CAST((scratchVec2)))->Vector::__mul(&local_1d8,&local_148.y); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_1d0,scratchVec2); } (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::SetVelocity(scratchVec); tmpEntity = local_11c; tear->SetColor(); tear->Update(); local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); local_11c = GHIDRA_CAST(&tmpEntity->_variant); tmpEntity = local_120; } while (GHIDRA_INT(local_11c) < 0xc7fd10); LAB_006223ae: this = self; goto LAB_006223b4; } } else { LAB_006223d9: puVar8 = GHIDRA_CAST(std)::vector::operator_index(); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Type(); if (iVar9 == 4) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Position(&local_1e8); local_150.y = (GHIDRA_CAST((scratchVec)))->Vector::DistanceSquared(&this->_pos); if (625.0 <= local_150.y) goto LAB_00622693; std::vector::operator_index(); tmpEntity = GHIDRA_CAST(__RTDynamicCast()); local_120 = tmpEntity; cVar2 = FUN_0060cdd0(); if ((cVar2 == '\0') && (cVar2 = (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity_Bomb::IsFetus(), cVar2 != '\0')) { tmpEntity->Remove(); local_118 = GHIDRA_CAST(0x0); local_134 = GHIDRA_CAST(&DAT_00c7fc60); do { local_150.y = (float)(GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::InitSeed(); local_160.y = (float)(GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::SubType(); local_11c = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity)::SpawnerEntity(); local_16c.y = (float)(GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::Velocity(&local_1e0); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::Position(&local_228); uVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::Variant(); uVar6 = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::Type(); (GHIDRA_CAST((g_game)))->Game::Spawn(uVar6,uVar4,scratchVec,GHIDRA_CAST(local_16c.y),GHIDRA_CAST(local_11c), GHIDRA_UINT(local_160.y),GHIDRA_UINT(local_150.y)); bomb = GHIDRA_CAST(__RTDynamicCast()); tmpEntity = local_120; (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity_Bomb::IsFetus(); FUN_0060cdb0(); (GHIDRA_CAST((GHIDRA_CAST(bomb))))->Entity::AddEntityFlags(0x4000000); (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::GridCollisionClass(); FUN_0044bfa0(); FUN_0060cde0(); (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity_Bomb::Flags(&bombFlags); FUN_006a6910(); floatResult = (float10)(GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity_Tear::FallingAcceleration(); (GHIDRA_CAST((GHIDRA_CAST(bomb))))->Entity_Projectile::set_falling_accel((float)floatResult); iVar9 = Player(tmpEntity); (GHIDRA_CAST((bomb)))->Entity_Bomb::SetExplosionCountdown(iVar9); (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity_Bomb::RadiusMultiplier(); FUN_00435e70(); local_11c = GHIDRA_CAST((30.0 - (float)GHIDRA_INT(local_118) * 20.0)); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(bomb))))->Entity::Velocity(&local_210); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Rotated(&local_218,(float)local_11c); (GHIDRA_CAST((GHIDRA_CAST(bomb))))->Entity::SetVelocity(scratchVec); FUN_0060cdf0(); FUN_00456820(); FUN_0060ce00(); FUN_0060ce10(); bomb->SetColor(); local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); local_134 = GHIDRA_CAST((GHIDRA_INT(local_134) + 0x2c)); } while (GHIDRA_INT(local_134) < 0xc7fd10); goto LAB_006223ae; } LAB_006223b4: sourceRef = GHIDRA_CAST(local_130.y); } else { LAB_00622693: puVar8 = GHIDRA_CAST(std)::vector::operator_index(); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Type(); if (iVar9 == 7) { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::SubType(); if (iVar9 == 2) { std::vector::operator_index(); tear = GHIDRA_CAST(__RTDynamicCast()); local_134 = tear; cVar2 = FUN_0060cef0(); if (cVar2 == '\0') { floatResult = (float10)(GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Laser::Radius(); local_160.y = (float)(floatResult * (float10)0.5); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Position(&local_220); local_150.y = (GHIDRA_CAST((scratchVec)))->Vector::DistanceSquared(&this->_pos); if (local_150.y <= local_160.y * local_160.y) { local_118 = GHIDRA_CAST(0x0); LAB_00622760: local_150.y = (float)Random(); local_160.y = (float)(GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::SubType(); local_11c = this->_player; scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Velocity(&local_140); scratchVec2 = (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity::Position(GHIDRA_CAST((local_1a4 + 8))); uVar4 = (GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity::Variant(); (GHIDRA_CAST((g_game)))->Game::Spawn(7,uVar4,scratchVec2,scratchVec,GHIDRA_CAST(local_11c), GHIDRA_UINT(local_160.y),GHIDRA_UINT(local_150.y)); tmpEntity = GHIDRA_CAST(__RTDynamicCast()); local_120 = tmpEntity; scratchVec = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity)::PositionOffset(); (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::SetPositionOffset(scratchVec); (GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity_Laser::Radius(); FUN_0060ce80(); this = self; (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::SetSpawnerEntity(self->_player); FUN_00435f70(); scratchFlags = (GHIDRA_CAST((local_134)))->Entity_Tear::TearFlags(&local_90); fVar13 = *GHIDRA_CAST(&scratchFlags->_l); FUN_00456830(); FUN_0060ce70(); (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity_Laser::SetMaxDistance(fVar13); FUN_0060ced0(); (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity_Laser::SetBlackHpDropChance(); virtualFn = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x40); floatResult = (float10)(GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity::CollisionDamage(); local_150.y = (float)floatResult; (*virtualFn)(); floatResult = (float10)(GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity::DepthOffset(); tmpEntity = local_120; set_field_358(local_120,(float)floatResult); (GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity::InitSeed(); FUN_005b15a0(); (GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity::GridCollisionClass(); FUN_0044bfa0(); FUN_0060ce60(); (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity_Laser::SetHomingType(); (GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity::SpawnerType(); FUN_004316b0(); scratchVec = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity)::TargetPosition(); (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::SetTargetPosition(*scratchVec); FUN_0060cee0(); (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity_Laser::SetMultidimensionalTouched(); (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::SetParent(this->_player); FUN_00579760(); (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity_Laser::SetTimeout(); FUN_0060ce30(); (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity_Laser::SetOneHit(); FUN_0060ce50(); FUN_0060ce40(); (GHIDRA_CAST((GHIDRA_CAST(local_134))))->Entity::Visible(); FUN_0044bf90(); if (local_118 == GHIDRA_CAST(0x0)) { scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::Velocity(&local_230); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Rotated(&local_238,-30.0); (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::SetVelocity(scratchVec); virtualFn = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x3c); (GHIDRA_CAST((&local_54)))->Color::Color(); LAB_00622a96: (*virtualFn)(); tmpEntity = local_120; LAB_00622ab7: FUN_005cd5a0(); tmpEntity->Update(); local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); if (3 < GHIDRA_INT(local_118)) goto LAB_00622b6f; tear = local_134; goto LAB_00622760; } if (local_118 == GHIDRA_CAST(0x1)) { scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::Velocity(GHIDRA_CAST(&local_248._h)); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Rotated(GHIDRA_CAST(&local_258._h),-10.0); (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::SetVelocity(scratchVec); LAB_00622a6e: virtualFn = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x3c); (GHIDRA_CAST(()))->Color::Color(); goto LAB_00622a96; } if (local_118 == GHIDRA_CAST(0x2)) { scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::Velocity(&local_1f0); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Rotated(GHIDRA_CAST(&local_208._h),10.0); (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::SetVelocity(scratchVec); goto LAB_00622a6e; } if (local_118 != GHIDRA_CAST(0x3)) goto LAB_00622ab7; scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::Velocity(GHIDRA_CAST(&local_1b8._h)); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Rotated(GHIDRA_CAST((local_68 + 8)),30.0); (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::SetVelocity(scratchVec); virtualFn = *(code **)(*GHIDRA_CAST(tmpEntity) + 0x3c); (GHIDRA_CAST(()))->Color::Color(); (*virtualFn)(); tmpEntity = local_120; FUN_005cd5a0(); tmpEntity->Update(); LAB_00622b6f: (**(code **)(*GHIDRA_CAST(local_134) + 0x28))(); } } goto LAB_006223b4; } } puVar8 = GHIDRA_CAST(std)::vector::operator_index(); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(*puVar8))))->Entity::Type(); if (iVar9 == 8) { std::vector::operator_index(); local_130.y = (float)FUN_0060cc90(); cVar2 = FUN_0060cfd0(); if ((cVar2 == '\0') && (cVar2 = (GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->Entity_Knife::IsFlying(), cVar2 != '\0')) { scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->Entity::Position(GHIDRA_CAST((local_78 + 8))); local_150.y = (GHIDRA_CAST((scratchVec)))->Vector::DistanceSquared(&this->_pos); if (local_150.y <= 625.0) { (GHIDRA_CAST((GHIDRA_CAST(local_130.y))))->Entity_Knife::spawn_child_knife(); } } } } } LAB_006223ba: sourceRef = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((sourceRef)) + 0x1)))); local_130.y = (float)sourceRef; gridIndexCounts = GHIDRA_CAST((GHIDRA_CAST((local_164)))->EntityList)::Size(); } while (sourceRef < gridIndexCounts); } break; case 0x7c: FamiliarAI::mystery_egg(this); break; case 0x7d: FamiliarAI::lil_spewer(this); break; case 0x7f: pfVar10 = GHIDRA_CAST((GHIDRA_CAST((this->_player)))->Entity_Player)::GetAimDirection(); local_160.x = *pfVar10; local_160.y = pfVar10[1]; bVar1 = (GHIDRA_CAST((&local_160)))->Vector::operator_eq(&g_vectorZero); if (bVar1 != 0) { iVar9 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetHeadDirection(); scratchVec = Isaac::GetAxisAlignedUnitVectorFromDir(GHIDRA_CAST((local_78 + 8)),iVar9); (GHIDRA_CAST((&local_160)))->Vector::operator_assign(scratchVec); bVar1 = (GHIDRA_CAST((&local_160)))->Vector::operator_eq(&g_vectorZero); if (bVar1 != 0) { scratchVec = (GHIDRA_CAST((GHIDRA_CAST((local_78 + 8)))))->Vector::Vector(0.0,1.0); (GHIDRA_CAST((&local_160)))->Vector::operator_assign(scratchVec); } } fVar16 = 120.0; iVar9 = (GHIDRA_CAST((g_game)))->Game::GetFrameCount(); fVar13 = sinf_wrapper(((float)iVar9 / 30.0) * 3.1415927); local_150.y = assert_lerp_range(fVar13,-1.0,1.0,20.0,fVar16,1); local_148.y = (GHIDRA_CAST((&local_160)))->Vector::GetAngleDegrees(); fVar13 = LerpAngleDeg(this->_orbitAngleOffset,local_148.y,0.4); this->_orbitAngleOffset = fVar13; scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(GHIDRA_CAST((local_68 + 8))); scratchVec2 = Vector::FromAngle(GHIDRA_CAST((local_78 + 8)),this->_orbitAngleOffset); scratchVec2 = (GHIDRA_CAST((scratchVec2)))->Vector::__mul(GHIDRA_CAST(&local_1b8._h),&local_150.y); (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_140,scratchVec2); scratchVec = (GHIDRA_CAST((&local_140)))->Vector::__sub(GHIDRA_CAST(&local_208._h),&this->_pos); local_148.y = 0.8; scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(GHIDRA_CAST((local_78 + 8)),&local_148.y); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); this->_friction = this->_friction * 0.7; scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_1f0); (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_128,scratchVec); fVar13 = (GHIDRA_CAST((&local_128)))->Vector::GetAngleDegrees(); local_148.y = fVar13 - 90.0; local_148.y = normalize_angle_degrees(local_148.y); layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); layer->_rotation = local_148.y; floatResult = (float10)(GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::Rotation(); local_148.y = (float)floatResult; local_134 = GHIDRA_CAST(CONCAT13(1.0 < local_148.y,(undefined3)local_134)); layer = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::GetLayer(GHIDRA_CAST(0x0)); layer->_flipX = (*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(7,0); if (bVar1 != 0) { room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level)::GetCurrentRoom(); iVar9 = (GHIDRA_CAST((room)))->Room::GetGridIndex(&this->_pos); if (-1 < iVar9) { room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level)::GetCurrentRoom(); sourceRef = (GHIDRA_CAST((GHIDRA_CAST((local_a8 + 4)))))->EntityRef::EntityRef(); (GHIDRA_CAST((room)))->Room::DamageGridWithSource(iVar9,1,sourceRef); } } break; case 0x80: animState = GHIDRA_CAST(Config)::GetPillEffects(); bVar1 = (GHIDRA_CAST((animState)))->AnimationState::IsLoopingAnimation(); if (bVar1 == 0) { (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::MultiplyFriction(); bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::IsFinishedImpl(&s_empty); if (bVar1 != 0) { sprintf_s(idleAnimName,0x20,GHIDRA_CAST("Idle%d")); (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(idleAnimName,0); animState = GHIDRA_CAST(Config)::GetPillEffects(); iVar9 = (GHIDRA_CAST((animState)))->AnimationState::GetAnimationLength(); iVar9 = Isaac::Random(iVar9); (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::SetFrame_1(iVar9); } } else { scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); GetOrbitPosition(this,&local_150,scratchVec); scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Velocity(&local_158); local_128.y = 2.0; (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_148,&local_128.y); scratchVec = (GHIDRA_CAST((&this->_pos)))->Vector::__add(&local_158,&local_148); scratchVec = (GHIDRA_CAST((&local_150)))->Vector::__sub(&local_174,scratchVec); local_128.y = 0.5; (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_140,&local_128.y); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); if (iVar9 < 0x28) { iVar9 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); fVar13 = Math::clamp((float)(iVar9 + -10) / 30.0,0.06,1.0); local_118 = GHIDRA_CAST((1.0 / fVar13 + 4.0)); } else { local_118 = GHIDRA_CAST(0x40a00000); } local_128.y = (GHIDRA_CAST((&local_140)))->Vector::Length(); if ((float)local_118 < local_128.y) { (GHIDRA_CAST((&local_140)))->Vector::Resize((float)local_118 - 1.0); } scratchVec = (GHIDRA_CAST((&local_148)))->Vector::__add(&local_158,&local_140); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__div(&local_174,&this->_friction); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); } break; case 0x81: cVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Visible(); if (cVar2 == '\0') { LAB_0061e4de: (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(&g_vectorZero); } else { bVar1 = (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_eq(&g_vectorZero); if (bVar1 == 0) { scratchVec = (GHIDRA_CAST((&this->_targetPosition)))->Vector::__sub(GHIDRA_CAST((local_78 + 8)),&this->_pos); local_148.y = 0.5; scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(GHIDRA_CAST((local_68 + 8)),&local_148.y); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::IsEventTriggered(s_Spawn); if (bVar1 != 0) { room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level)::GetCurrentRoom(); tmpEntity = GHIDRA_CAST((GHIDRA_CAST((room)))->Room)::GetGridIndex(&this->_pos); local_148.y = (float)tmpEntity; room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level)::GetCurrentRoom(); gridEntity = (GHIDRA_CAST((room)))->Room::GetGridEntity(GHIDRA_UINT(tmpEntity)); if (((gridEntity == GHIDRA_CAST(0x0)) || (iVar9 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetType(), iVar9 == 1)) || (iVar9 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetType(), iVar9 == 10)) { room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level)::GetCurrentRoom(); bVar1 = (GHIDRA_CAST((room)))->Room::is_type_16(); if (bVar1 == 0) { room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level)::GetCurrentRoom(); uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); (GHIDRA_CAST((room)))->Room::SpawnGridEntity(GHIDRA_INT(local_148.y),0xe,6,uVar4,0); Game::ButterBeanFart(g_game,&this->_pos,120.0,this->_player,0,0); } } SoundEffects::PlayWithFartOverride(0x25,1.0,2,0,1.0); } bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::IsFinishedImpl(&s_empty); if (bVar1 != 0) { FUN_0044bf90(); } } else { FollowParent(this); } } break; case 0x83: update_idle_anim_by_size(this); MoveDelayed(this,5); break; case 200: ai_boiled_baby(this); break; case 0xc9: zhl_misfit_006414c0(this); break; case 0xca: ai_shadow_intruder_damocles(this,0); break; case 0xcb: ai_blood_oath(this); break; case 0xcc: FamiliarAI::variant_204(this); break; case 0xce: case 0xed: ai_wisp(this); break; case 0xd0: FollowParent(this); sprite = &this->_sprite; local_148.y = (float)sprite; iVar9 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); if (iVar9 == 0) { LAB_00623343: (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("FloatDown"),0); } else { bVar1 = (GHIDRA_CAST((sprite)))->ANM2::IsPlaying(GHIDRA_CAST("FloatDown")); if ((bVar1 == 0) && (bVar1 = (GHIDRA_CAST((sprite)))->ANM2::IsFinishedImpl(&s_empty), bVar1 == 0)) { bVar1 = (GHIDRA_CAST((sprite)))->ANM2::IsPlaying(s_Spawn); if ((bVar1 != 0) && (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(sprite))))->Sprite::IsEventTriggered("Shoot"), bVar1 != 0) ) { SoundEffects::PlayWithFartOverride(0xb2,1.0,2,0,1.0); iVar9 = Isaac::Random(3); local_16c.y = (float)(iVar9 + 4); fVar13 = apply_tear_modifiers(this); local_11c = GHIDRA_CAST((fVar13 * 3.5)); if (0 < GHIDRA_INT((iVar9 + 4))) { do { MusicManager::RandomVector(&local_140); local_148.y = 10.0; (GHIDRA_CAST((&local_140)))->Vector::operator_mul_assign(&local_148.y); fVar13 = random_float(); local_150.y = fVar13 * 0.2 + 0.7; (GHIDRA_CAST((&local_140)))->Vector::operator_mul_assign(&local_150.y); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x100); if (bVar1 == 0) { FUN_00431270(); (GHIDRA_CAST((GHIDRA_CAST(local_a8))))->Color::Color(); if (this->_isLilDelirium != 0) { (GHIDRA_CAST((GHIDRA_CAST(local_a8))))->Color::SetColorize(2.4,2.4,2.4,1.0); } uVar4 = Random(); tear = (Entity_Tear *) (GHIDRA_CAST((g_game)))->Game::Spawn(2,1,&this->_pos,&local_140,GHIDRA_CAST(this),0,uVar4); (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::set_falling_accel(0.8); random_float(); FUN_00444c70(); (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_78)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_78)) + 0x0))); (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = (*GHIDRA_CAST((GHIDRA_CAST(&(local_78)) + 0x8))); (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = pcStack_6c; (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags); tear->SetColor(); iVar9 = Isaac::Random(2); if (iVar9 == 0) { fVar13 = random_float(); (GHIDRA_CAST((tear)))->Entity_Tear::SetScale((fVar13 * 0.05 + 0.9) * 0.8); } else { fVar13 = random_float(); (GHIDRA_CAST((tear)))->Entity_Tear::SetScale((fVar13 * 0.05 + 1.3) * 0.8); } tear->SetCollisionDamage(); TryFireTear(this,tear); } else { uVar4 = Random(); tear = (Entity_Tear *) (GHIDRA_CAST((g_game)))->Game::Spawn(9,0,&this->_pos,&local_140,GHIDRA_CAST(this),0,uVar4); (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::set_falling_accel(0.8); random_float(); FUN_00444c70(); iVar9 = Isaac::Random(2); if (iVar9 == 0) { random_float(); } else { random_float(); } FUN_004508a0(); } tear->Update(); local_16c.y = (float)&(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST((GHIDRA_INT(local_16c.y) + -0x848))))) + 0x847))); } while (GHIDRA_CAST(local_16c.y) != GHIDRA_CAST(0x0)); local_16c.y = 0.0; } } } else { (GHIDRA_CAST((sprite)))->ANM2::Play(GHIDRA_CAST("FloatDown"),0); iVar9 = apply_forgotten_lullaby(this,4); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(iVar9,0); if (bVar1 != 0) { room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level)::GetCurrentRoom(); iVar9 = (GHIDRA_CAST((room)))->Room::GetAliveEnemiesCount(); if (0 < iVar9) { local_11c = GHIDRA_CAST(0x42a00000); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x100); if (bVar1 != 0) { local_11c = GHIDRA_CAST(0x43340000); } sourceRef = GHIDRA_CAST(0x0); local_130.y = 0.0; (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::GetCurrentRoom(); entityList = GHIDRA_CAST(FUN_00428a60()); EntityList::QueryRadius (entityList,GHIDRA_CAST(local_78),&this->_pos,(float)local_11c,8); local_14 = 1.96182e-44; local_118 = GHIDRA_CAST(0x0); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList::Size(); if (iVar9 != 0) { do { puVar8 = GHIDRA_CAST(std)::vector::operator_index(); tmpEntity = GHIDRA_CAST(*puVar8); if (tmpEntity != GHIDRA_CAST(0x0)) { bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x100); if ((bVar1 == 0) || ((bVar1 = (GHIDRA_CAST((tmpEntity)))->Entity::is_player(), bVar1 == 0 && ((bVar1 = (GHIDRA_CAST((tmpEntity)))->Entity::IsFamiliar(), bVar1 == 0 || (bVar1 = (GHIDRA_CAST((tmpEntity)))->Entity::HasEntityFlags(0x100), bVar1 != 0)))))) { bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x100); if ((bVar1 == 0) && (bVar1 = (GHIDRA_CAST((tmpEntity)))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)), bVar1 != 0)) { local_130.y = (float)(GHIDRA_INT(local_130.y) + 1); } } else { local_130.y = (float)(GHIDRA_INT(local_130.y) + 1); } } sourceRef = GHIDRA_CAST(local_130.y); local_118 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_118)) + 0x1)))); listSize = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(local_78))))->EntityList)::Size(); } while (local_118 < listSize); } iVar9 = 5; if (GHIDRA_INT(sourceRef) < 1) { iVar9 = 0x14; } iVar9 = Isaac::Random(iVar9); if (iVar9 != 0) goto LAB_0061f2a8; (GHIDRA_CAST((GHIDRA_CAST(local_148.y))))->ANM2::Play(s_Spawn,1); gridIndexCounts = local_78; goto LAB_006241ee; } } } } break; case 0xd2: ai_bird_cage(this); break; case 0xd3: FamiliarAI::lost_soul(this); break; case 0xd4: FamiliarAI::lil_dumpy(this); break; case 0xd8: case 0xd9: FamiliarAI::tinytoma(this); break; case 0xda: scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(GHIDRA_CAST((local_78 + 8))); scratchVec = GetOrbitPosition(this,GHIDRA_CAST((local_68 + 8)),scratchVec); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__sub(GHIDRA_CAST(&local_1b8._h),&this->_pos); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); ai_bot_fly(this); break; case 0xdd: FUN_006401d0(); break; case 0xde: ai_stitches(this); break; case 0xe0: FUN_0063e180(); break; case 0xe1: FUN_006403f0(); break; case 0xe2: scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(GHIDRA_CAST((local_78 + 8))); scratchVec = GetOrbitPosition(this,GHIDRA_CAST((local_68 + 8)),scratchVec); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__sub(GHIDRA_CAST(&local_1b8._h),&this->_pos); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x20000000000); if (bVar1 == 0) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(s_Idle,0); local_160.y = (float)(this->_chargeLevel + -1); local_128.y = 0.0; piVar11 = GHIDRA_CAST(std)::max(); } else { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(&DAT_00b602e8,0); local_148.y = (float)(this->_chargeLevel + 1); local_150.y = 7.00649e-45; piVar11 = GHIDRA_CAST(std)::min(); } this->_chargeLevel = *piVar11; local_148.y = 1.0; local_150.y = (float)this->_chargeLevel * 0.2; puVar8 = GHIDRA_CAST(std)::min(); local_11c = GHIDRA_CAST(*puVar8); local_150.y = 0.3; local_148.y = (float)this->_chargeLevel * 0.06; pfVar10 = GHIDRA_CAST(std)::min(); local_16c.y = *pfVar10 + 0.7; sfx = MusicManager::SFXManager(); bVar1 = (GHIDRA_CAST((sfx)))->SFXManager::IsPlaying(0x393); if (bVar1 == 0) { if (0 < this->_chargeLevel) { SoundEffects::PlayWithFartOverride(0x393,(float)local_11c,0,1,local_16c.y); } } else if (this->_chargeLevel < 1) { sfx = MusicManager::SFXManager(); (GHIDRA_CAST((sfx)))->SFXManager::Stop(0x393); } else { sfx = MusicManager::SFXManager(); (GHIDRA_CAST((sfx)))->SFXManager::AdjustVolume(0x393,(float)local_11c); sfx = MusicManager::SFXManager(); (GHIDRA_CAST((sfx)))->SFXManager::AdjustPitch(0x393,local_16c.y); } break; case 0xe4: ai_minisaac(this); break; case 0xe5: scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(GHIDRA_CAST((local_78 + 8))); GetOrbitPosition(this,&local_160,scratchVec); scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Velocity(GHIDRA_CAST((local_68 + 8))); local_148.y = 2.0; (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_150,&local_148.y); scratchVec = (GHIDRA_CAST((&this->_pos)))->Vector::__add(GHIDRA_CAST(&local_1b8._h),&local_150); scratchVec = (GHIDRA_CAST((&local_160)))->Vector::__sub(GHIDRA_CAST((local_78 + 8)),scratchVec); local_148.y = 0.5; (GHIDRA_CAST((scratchVec)))->Vector::__mul(&local_140,&local_148.y); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); if (iVar9 < 0x28) { iVar9 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::FrameCount(); fVar13 = Math::clamp((float)(iVar9 + -10) / 30.0,0.06,1.0); local_11c = GHIDRA_CAST((1.0 / fVar13 + 4.0)); } else { local_11c = GHIDRA_CAST(0x40a00000); } local_148.y = (GHIDRA_CAST((&local_140)))->Vector::Length(); if ((float)local_11c < local_148.y) { (GHIDRA_CAST((&local_140)))->Vector::Resize((float)local_11c - 1.0); } scratchVec = (GHIDRA_CAST((&local_150)))->Vector::__add(GHIDRA_CAST((local_78 + 8)),&local_140); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__div(GHIDRA_CAST((local_68 + 8)),&this->_friction); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); break; case 0xe7: FamiliarAI::apollyons_best_friend(this); break; case 0xe9: FamiliarAI::worm_friend(this); break; case 0xea: animState = GHIDRA_CAST(Config)::GetPillEffects(); bVar1 = (GHIDRA_CAST((animState)))->AnimationState::IsLoopingAnimation(); if (bVar1 != 0) { fVar13 = assert_lerp_range(this->_updateTime,0.0,15.0,1.0,0.8,1); this->_friction = fVar13 * this->_friction; } break; case 0xeb: tmpEntity = this->_player; local_120 = tmpEntity; update_weapon(this,0); pfVar10 = GHIDRA_CAST((GHIDRA_CAST((this->_player)))->Entity_Player)::GetAimDirection(); local_160.x = *pfVar10; local_160.y = pfVar10[1]; if ((((0 < this->_headFrameDelay) || (0 < this->_counter)) && (bVar1 = (GHIDRA_CAST((&local_160)))->Vector::operator_eq(&g_vectorZero), bVar1 != 0)) && (bVar1 = (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_ne(&g_vectorZero), bVar1 != 0)) { (GHIDRA_CAST((&local_160)))->Vector::operator_assign(&this->_targetPosition); } bVar1 = (GHIDRA_CAST((&local_160)))->Vector::operator_eq(&g_vectorZero); if (bVar1 != 0) { scratchVec = (GHIDRA_CAST((GHIDRA_CAST((local_78 + 8)))))->Vector::Vector(0.0,1.0); (GHIDRA_CAST((&local_160)))->Vector::operator_assign(scratchVec); } (GHIDRA_CAST((&this->_targetPosition)))->Vector::operator_assign(&local_160); local_130.y = 0.4; bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x94,0); local_134 = GHIDRA_CAST(CONCAT13(bVar1,(undefined3)local_134)); if (bVar1 != 0) { scratchVec = (GHIDRA_CAST((GHIDRA_CAST((local_78 + 8)))))->Vector::Vector(26.0,26.0); (GHIDRA_CAST((&this->_orbitDistance)))->Vector::operator_assign(scratchVec); game = g_game; this->_orbitSpeed = 3.5; iVar9 = (GHIDRA_CAST((game)))->Game::GetFrameCount(); scratchVec = Vector::FromAngle(GHIDRA_CAST((local_68 + 8)), (float)iVar9 * this->_orbitSpeed - this->_orbitAngleOffset); (GHIDRA_CAST((&local_160)))->Vector::operator_assign(scratchVec); local_130.y = 0.8; } scratchVec = (GHIDRA_CAST((&local_160)))->Vector::Rotated(GHIDRA_CAST((local_78 + 8)),-90.0); local_148.y = 26.0; scratchVec = Vector::operator_mul(GHIDRA_CAST((local_68 + 8)),&local_148.y,scratchVec); (GHIDRA_CAST((&local_160)))->Vector::operator_assign(scratchVec); if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_134)) + 0x3))) == '\0') { room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level)::GetCurrentRoom(); iVar9 = (GHIDRA_CAST((room)))->Room::GetFrameCount(); if (0x1e < iVar9) { local_11c = this; iVar9 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Parent(); if (iVar9 != 0) { do { tmpEntity = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(this))))->Entity)::Parent(); bVar1 = (GHIDRA_CAST((tmpEntity)))->Entity::IsFamiliar(); if (bVar1 == 0) break; this = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(this))))->Entity)::Parent(); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Parent(); } while (iVar9 != 0); local_11c = this; } scratchVec = GHIDRA_CAST(FUN_004172b0()); scratchVec2 = (GHIDRA_CAST((GHIDRA_CAST(local_11c))))->Entity::Velocity(GHIDRA_CAST((local_68 + 8))); local_148.y = 1.0 - local_130.y; scratchVec2 = (GHIDRA_CAST((scratchVec2)))->Vector::__mul(GHIDRA_CAST(&local_1b8._h),&local_148.y); scratchVec2 = (GHIDRA_CAST((scratchVec2)))->Vector::__div(GHIDRA_CAST(&local_208._h),&local_130.y); (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_140,scratchVec2); scratchVec = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::Position(&local_1f0); scratchVec2 = (GHIDRA_CAST((GHIDRA_CAST(local_120))))->Entity::Position(GHIDRA_CAST((local_78 + 8))); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(GHIDRA_CAST((local_68 + 8)),&local_160); local_148.y = (GHIDRA_CAST((&local_140)))->Vector::DistanceSquared(scratchVec); scratchVec = (GHIDRA_CAST((scratchVec2)))->Vector::__sub(GHIDRA_CAST(&local_1b8._h),&local_160); local_150.y = (GHIDRA_CAST((&local_140)))->Vector::DistanceSquared(scratchVec); if (local_150.y < local_148.y) { scratchVec = (GHIDRA_CAST((&local_160)))->Vector::__unm(GHIDRA_CAST((local_78 + 8))); (GHIDRA_CAST((&local_160)))->Vector::operator_assign(scratchVec); } tmpEntity = local_120; this = self; } } if (((this->_parent != (EntityPtr)0x0) && (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this->_parent))))->Entity::IsFamiliar(), bVar1 != 0)) && (iVar9 = (GHIDRA_CAST((GHIDRA_CAST(this->_parent))))->Entity::Parent(), iVar9 != 0)) { tmpEntity = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(this->_parent))))->Entity)::Parent(); } if (this->_subtype == 1) { scratchVec = (GHIDRA_CAST((&local_160)))->Vector::__unm(GHIDRA_CAST((local_78 + 8))); (GHIDRA_CAST((&local_160)))->Vector::operator_assign(scratchVec); } scratchVec = (GHIDRA_CAST((GHIDRA_CAST(tmpEntity))))->Entity::Position(GHIDRA_CAST((local_78 + 8))); (GHIDRA_CAST((scratchVec)))->Vector::__add(&local_128,&local_160); scratchVec = (GHIDRA_CAST((&local_128)))->Vector::__sub(GHIDRA_CAST((local_68 + 8)),&this->_pos); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__mul(GHIDRA_CAST((local_78 + 8)),&local_130.y); (GHIDRA_CAST((&this->_velocity)))->Vector::operator_assign(scratchVec); this->_friction = this->_friction * 0.8; break; case 0xec: FamiliarAI::star_of_bethlehem(this); break; case 0xee: ai_blood_clot(this,0); break; case 0xef: FamiliarAI::cube_baby(this); break; case 0xf0: ai_umbilical_baby(this,0); break; case 0xf1: FamiliarAI::blood_puppy(this); break; case 0xf2: FamiliarAI::vanishing_twin(this); break; case 0xf3: if (this->_state < 1) { fVar13 = (this->_targetPosition).x; if ((0.0 <= fVar13) && (pfVar10 = &(this->_targetPosition).y, 0.0 < *pfVar10 || *pfVar10 == 0.0)) goto LAB_0061fc21; fVar16 = (this->_targetPosition).y; fallVelocity = this->_speedMultiplier * 1.2 + fVar16; fVar13 = this->_speedMultiplier * fVar16 + fVar13; (this->_targetPosition).x = fVar13; (this->_targetPosition).y = fallVelocity; if ((fallVelocity < 0.0) || (iVar9 = 5, fallVelocity < -26.0)) { iVar9 = 3; } this->_entityGridCollisionClass = iVar9; if (0.0 < fVar13) { (this->_targetPosition).x = 0.0; (this->_targetPosition).y = 0.0; (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearEntityFlags(0x400000000000000); iVar9 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetPlayerType(); if ((iVar9 == 0x10) || (iVar9 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetPlayerType(), iVar9 == 0x23)) { play_sound_with_fart_seed(499,1.0,2,0,1.0); play_sound_with_fart_seed(0x1d3,1.0,2,0,1.0); } else { play_sound_with_fart_seed(0x48,1.0,2,0,1.0); uVar4 = Random(); tmpEntity = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,2,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),2,uVar4); tmpEntity->Update(); } } } else { if (this->_state == 1) { (GHIDRA_CAST((&this->_hitList)))->std::vector::clear(0); } (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::ClearEntityFlags(0x400000000000000); uVar4 = this->_state & 0x80000003; isEveryFourthState = uVar4 == 0; if (GHIDRA_INT(uVar4) < 0) { isEveryFourthState = (uVar4 - 1 | 0xfffffffc) == 0xffffffff; } if (isEveryFourthState) { virtualFn = *(code **)(*GHIDRA_CAST(this) + 0x3c); (GHIDRA_CAST(()))->Color::Color(); (*virtualFn)(); } this->_entityGridCollisionClass = 0; (GHIDRA_CAST((this->_player)))->Entity::Position(&local_140); local_128.y = assert_lerp_range((float)this->_state,0.0,15.0,1.0,16.0,1); this->_state = this->_state + 1; scratchVec = (GHIDRA_CAST((&local_140)))->Vector::__sub(&local_158,&this->_pos); bVar1 = 0; scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::Resized(&local_174,local_128.y); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::AddVelocity(scratchVec,bVar1); iVar9 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(2.0,0.0); if (iVar9 != 0) { uVar4 = Random(); local_128.y = 0.5; scratchVec = (GHIDRA_CAST((&this->_velocity)))->Vector::__mul(&local_158,&local_128.y); tmpEntity = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0x6f,&this->_pos,scratchVec,GHIDRA_CAST(this),0,uVar4); scratchVec = (GHIDRA_CAST((&local_174)))->Vector::Vector(0.0,-8.0); scratchVec = (GHIDRA_CAST((&this->_posOffset)))->Vector::__add(&local_184,scratchVec); (GHIDRA_CAST((tmpEntity)))->Entity::SetPositionOffset(scratchVec); set_field_358(tmpEntity,-5.0); tmpEntity->Update(); } LAB_0061fc21: this->_friction = this->_friction * 0.85; } local_128.y = (GHIDRA_CAST((&this->_velocity)))->Vector::LengthSquared(); if ((3.0 < local_128.y) && (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(3,0), bVar1 != 0)) { (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity_NPC::MakeSplat(0.5); } tmpEntity = this->_player; (this->_posOffset).y = (this->_targetPosition).x; scratchVec = (GHIDRA_CAST((tmpEntity)))->Entity::Position(&local_158); scratchVec = (GHIDRA_CAST((&this->_pos)))->Vector::__sub(&local_174,scratchVec); local_140.x = scratchVec->x; local_140.y = scratchVec->y; FUN_007792f0(); bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x400000000000000); if (bVar1 == 0) { if (this->_state < 1) { local_118 = GHIDRA_CAST(0x43c80000); } else { local_118 = GHIDRA_CAST(0x44c80000); } scratchVec = (GHIDRA_CAST((this->_player)))->Entity::Position(&local_158); local_128.y = (GHIDRA_CAST((scratchVec)))->Vector::DistanceSquared(&this->_pos); if (local_128.y <= (float)local_118) { Entity_Player::AnimateCollectible (this->_player,0x2d9,GHIDRA_CAST("HideItem"),GHIDRA_CAST("PlayerPickupSparkle")); play_sound_with_fart_seed(0xf9,1.0,2,0,1.0); playerEffects = GHIDRA_CAST((GHIDRA_CAST((this->_player)))->Entity_Player)::GetEffects(); (GHIDRA_CAST((playerEffects)))->TemporaryEffects::RemoveCollectibleEffect(0x2d9,-1); this->Remove(); } } } switchD_0061ddf2_caseD_12: LAB_00624200: bVar1 = (GHIDRA_CAST((&self->_orbitDistance)))->Vector::operator_ne(&g_vectorZero); if (bVar1 != 0) { bVar1 = (GHIDRA_CAST((GHIDRA_CAST(self))))->Entity::HasEntityFlags(0x20000000000); if (bVar1 != 0) { fVar13 = normalize_angle_degrees(self->_orbitAngleOffset - self->_orbitSpeed * 10.0); self->_orbitAngleOffset = fVar13; cVar2 = FUN_0060d120(); if ((cVar2 != '\0') && (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(self))))->Entity::IsFrame(4,0), bVar1 != 0)) { virtualFn = *(code **)(*GHIDRA_CAST(self) + 0x3c); (GHIDRA_CAST(()))->Color::Color(); (*virtualFn)(); } } tmpEntity = self; if (self->_orbitLayer == 8) { playerEffects = GHIDRA_CAST((GHIDRA_CAST((self->_player)))->Entity_Player)::GetEffects(); bVar1 = (GHIDRA_CAST((playerEffects)))->TemporaryEffects::HasCollectibleEffect(0x4d); if (bVar1 == 0) { playerEffects = GHIDRA_CAST((GHIDRA_CAST((tmpEntity->_player)))->Entity_Player)::GetEffects(); bVar1 = (GHIDRA_CAST((playerEffects)))->TemporaryEffects::HasCollectibleEffect(0x12a); if (bVar1 == 0) goto LAB_0062434e; } fVar13 = normalize_angle_degrees(tmpEntity->_orbitAngleOffset - tmpEntity->_orbitSpeed * 0.5); tmpEntity->_orbitAngleOffset = fVar13; } } LAB_0062434e: FUN_00860f00(); iVar9 = FUN_0060d6a0(); if (iVar9 < 1) { tmpEntity = self; } else { bVar1 = (GHIDRA_CAST((GHIDRA_CAST(self))))->Entity::IsFrame(iVar9,self->_index); tmpEntity = self; if (bVar1 != 0) { if ((self->_variant != 0x18) && (self->_variant != 0x66)) { (GHIDRA_CAST((&self->_hitList)))->std::vector::clear(0); } } } fVar13 = apply_tear_modifiers(tmpEntity); if (1.0 < fVar13) { iVar9 = self->_variant; if (iVar9 == 0xe7) { scratchVec2 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(self))))->Entity)::SpriteScale(); scratchVec = &local_148; local_148.y = 1.1; gridIndexCounts = local_78; } else { if (((iVar9 == 900) || (iVar9 == 0x3e)) || (iVar9 == 0xd3)) goto LAB_0062442e; scratchVec2 = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(self))))->Entity)::SpriteScale(); scratchVec = &local_150; local_150.y = 1.25; gridIndexCounts = local_68; } scratchVec = (GHIDRA_CAST((scratchVec2)))->Vector::__mul(GHIDRA_CAST((gridIndexCounts + 8)),&scratchVec->y); (GHIDRA_CAST((GHIDRA_CAST(self))))->Entity::SetSpriteScale(scratchVec); } LAB_0062442e: room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level)::GetCurrentRoom(); bVar1 = (GHIDRA_CAST((room)))->Room::is_type_16(); if ((bVar1 != 0) && (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(self))))->Entity::IsFlying(), bVar1 == 0)) { room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level)::GetCurrentRoom(); scratchVec = &self->_pos; gridEntity = (GHIDRA_CAST((room)))->Room::GetGridEntityFromPos(scratchVec); if (((gridEntity != GHIDRA_CAST(0x0)) && (iVar9 = (GHIDRA_CAST((gridEntity)))->GridEntity::GetType(), iVar9 == 0x13)) || ((self->_variant == 0x4b || (self->_variant == 900)))) { fVar13 = (self->_velocity).y; if (self->_variant == 900) { (self->_velocity).y = fVar13 + 0.8; } else { scratchVec2 = &self->_velocity; (self->_velocity).y = fVar13 * 0.5; if (scratchVec2->x <= 0.0) { if (scratchVec2->x < 0.0) { local_148.y = (GHIDRA_CAST((scratchVec2)))->Vector::Length(); scratchVec2->x = -local_148.y; } } else { fVar13 = (GHIDRA_CAST((scratchVec2)))->Vector::Length(); scratchVec2->x = fVar13; } game = g_game; (self->_velocity).y = 0.0; room = GHIDRA_CAST((GHIDRA_CAST((GHIDRA_CAST(game))))->Level)::GetCurrentRoom(); scratchVec2 = (GHIDRA_CAST((GHIDRA_CAST((local_78 + 8)))))->Vector::Vector(0.0, (self->_sizeMulti).y * self->_size + 0.5); scratchVec = (GHIDRA_CAST((scratchVec)))->Vector::__add(GHIDRA_CAST((local_68 + 8)),scratchVec2); local_140.x = scratchVec->x; local_140.y = scratchVec->y; iVar9 = (GHIDRA_CAST((room)))->Room::GetGridCollisionAtPos(*scratchVec); if (iVar9 != 4) { bVar1 = 0; scratchVec = (GHIDRA_CAST((GHIDRA_CAST((local_78 + 8)))))->Vector::Vector(0.0,3.5); (GHIDRA_CAST((GHIDRA_CAST(self))))->Entity::AddVelocity_divided(scratchVec,bVar1); } } } } (GHIDRA_CAST((GHIDRA_CAST(self))))->Entity::Update(); (GHIDRA_CAST((&self->_chargeBarSprite)))->ANM2::Update(); if (self->_dead != 0) { self->Remove(); } gridIndexCounts = &(*GHIDRA_CAST((GHIDRA_CAST((self)) + 0xf3c))); if (self->_target != (EntityPtr)0x0) { local_148.y = (float)(GHIDRA_CAST((GHIDRA_CAST(self->_target))))->PathFinder::GetGridIndex(); piVar11 = map_find_value(gridIndexCounts,GHIDRA_UINT(&local_148.y)); *piVar11 = *piVar11 + 1; } FUN_0042c770(); std::iterator_copy(gridIndexCounts,&local_148.y); cVar2 = FUN_0042c710(); while (cVar2 != '\0') { iVar9 = FUN_005cba30(); if (*GHIDRA_CAST((iVar9 + 4)) < 0) { iVar9 = FUN_005cba30(); *GHIDRA_CAST((iVar9 + 4)) = *GHIDRA_CAST((iVar9 + 4)) + 1; } iVar9 = FUN_005cba30(); if (*GHIDRA_CAST((iVar9 + 4)) == 0) { pfVar10 = GHIDRA_CAST(FUN_00651db0()); local_118 = GHIDRA_CAST(*pfVar10); } else { set_iterator_post_increment(&local_118,&local_17c.y,0); } std::iterator_copy(gridIndexCounts,&local_148.y); cVar2 = FUN_0042c710(); } ExceptionList = local_1c; return; switchD_0061ddf2_caseD_62: MoveDelayed(this,0x14); goto switchD_0061ddf2_caseD_12; } // 00624a80 void Entity_Familiar::Interpolate() { float fVar1; byte isEffectActive; float velocityX; float baseFriction; float baseFriction; int orbitLayer; void *player; switch(this->_variant) { case 0x3d: ai_incubus_shot(); break; case 0x50: update_weapon(this,1); break; case 0xca: ai_shadow_intruder_damocles(this,1); break; case 0xee: fVar1 = this->_speedMultiplier; baseFriction = this->_friction; if (fVar1 != 1.0) { baseFriction = baseFriction / ((baseFriction + fVar1) - baseFriction * fVar1); } baseFriction = this->_baseFriction; velocityX = baseFriction * (this->_velocity).x; baseFriction = baseFriction * (this->_velocity).y; (this->_velocity).x = velocityX; (this->_velocity).y = baseFriction; fVar1 = this->_speedMultiplier; this->_friction = baseFriction; (this->_pos).x = fVar1 * velocityX + (this->_pos).x; (this->_pos).y = fVar1 * baseFriction + (this->_pos).y; ai_blood_clot(this,1); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::CollideWithGrid(1); return; case 0xf0: ai_umbilical_baby(this,1); } fVar1 = this->_orbitAngleOffset; orbitLayer = this->_orbitLayer; if (-1 < orbitLayer) { baseFriction = fVar1; if ((this->_flags & 0x20000000000) != 0) { baseFriction = fVar1 - this->_orbitSpeed * 5.0; if (360.0 < ABS(baseFriction)) { baseFriction = fmodf(baseFriction,360.0); } if (baseFriction <= 180.0) { if (baseFriction < -180.0) { baseFriction = baseFriction + 360.0; } } else { baseFriction = baseFriction - 360.0; } this->_orbitAngleOffset = baseFriction; } if (orbitLayer == 8) { player = this->_player; isEffectActive = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(player) + 0x1508)))))->TemporaryEffects::HasCollectibleEffect(0x4d); if ((isEffectActive != 0) || (isEffectActive = TemporaryEffects::HasCollectibleEffect (GHIDRA_CAST((GHIDRA_INT(player) + 0x1508)),0x12a), isEffectActive != 0)) { baseFriction = baseFriction - this->_orbitSpeed * 0.25; if (360.0 < ABS(baseFriction)) { baseFriction = fmodf(baseFriction,360.0); } if (baseFriction <= 180.0) { if (baseFriction < -180.0) { baseFriction = baseFriction + 360.0; } } else { baseFriction = baseFriction - 360.0; } this->_orbitAngleOffset = baseFriction; } } } (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Interpolate(); if (this->_variant == 0xf3) { (this->_posOffset).y = (this->_targetPosition).y * 0.5 * this->_speedMultiplier + (this->_posOffset).y; } this->_orbitAngleOffset = fVar1; return; } // 00624dd0 byte Entity_Familiar::RenderShadowLayer(Vector *offset) { byte bVar1; Entity *umbilicalWhip; bVar1 = IsLilithBirthrightIncubus(this); if (bVar1 != 0) { umbilicalWhip = get_incubus_umbilical_whip(this); if ((umbilicalWhip == GHIDRA_CAST(0x0)) || (umbilicalWhip->_visible == 0)) { return 0; } } bVar1 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::RenderShadowLayer(offset); return bVar1; } // 00624e10 void Entity_Familiar::Render(Vector *offset) { code *pcVar1; float fVar2; byte bVar3; Entity *umbilicalWhip; uint seed; LayerState *layer; void *pvVar4; Game *game; byte *layerId; float *layerColor; int iVar5; float fVar6; float fVar7; double flooredCoord; undefined1 local_194 [44]; ColorMod fadedColor; int iconRenderParams; undefined4 uStack_138; undefined4 uStack_134; undefined4 uStack_130; undefined4 uStack_12c; float savedColorizeR; float savedColorizeG; float savedColorizeB; float savedColorizeA; float savedTintR; float savedTintG; float savedTintB; float savedTintA; float savedOffsetXY [2]; float savedOffsetZ; float opacity; Vector *renderOffset; undefined1 savedPlayerFlag171; float local_f0; float local_ec; Vector iconPosX; float local_e0; char isHologram; int *local_d8; float local_d4; float local_d0; Vector iconScaleX; int savedPlayerColor2; int iStack_c0; int iStack_bc; int iStack_b8; int iStack_b4; int iStack_b0; int iStack_ac; int iStack_a8; undefined8 uStack_a4; int iStack_9c; float savedPlayerColor; float fStack_94; float fStack_90; int iStack_8c; float fStack_88; float fStack_84; float fStack_80; float fStack_7c; float afStack_78 [2]; float fStack_70; int fadedPlayerColor; int iStack_68; int iStack_64; float fStack_60; int iStack_5c; int iStack_58; int iStack_54; int iStack_50; undefined8 uStack_4c; int iStack_44; ColorMod tmpColor; uint stackCookie; void *local_10; undefined1 *puStack_c; float local_8; int *player; Vector *renderPos; ColorMod *spriteColor; local_8 = -NAN; puStack_c = &LAB_00af6cd1; local_10 = ExceptionList; stackCookie = __security_cookie ^ GHIDRA_UINT((&tmpColor)[1]._colorize); ExceptionList = &local_10; renderOffset = offset; bVar3 = IsLilithBirthrightIncubus(this); if (bVar3 != 0) { umbilicalWhip = get_incubus_umbilical_whip(this); if (umbilicalWhip == GHIDRA_CAST(0x0)) { ExceptionList = local_10; return; } if (umbilicalWhip->_visible == 0) { ExceptionList = local_10; return; } } savedTintR = (this->_sprite)._color._tint[0]; savedTintG = (this->_sprite)._color._tint[1]; savedTintB = (this->_sprite)._color._tint[2]; savedTintA = (this->_sprite)._color._tint[3]; savedOffsetXY = *(float (*) [2])(this->_sprite)._color._offset; savedOffsetZ = (this->_sprite)._color._offset[2]; opacity = 1.0; savedColorizeR = (this->_sprite)._color._colorize[0]; savedColorizeG = (this->_sprite)._color._colorize[1]; savedColorizeB = (this->_sprite)._color._colorize[2]; savedColorizeA = (this->_sprite)._color._colorize[3]; if (this->_player == (void *)0x0) { game = g_game; } else { if ((g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) && (bVar3 = NetplayManager::IsIdxLocalPlayer (&g_manager->_netplayManager,*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1618))), bVar3 == 0)) { if ((g_game == GHIDRA_CAST(0x0)) || (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2)) { opacity = (float)(g_manager->_optionsConfig)._onlinePlayerOpacity * 0.09 + 0.1; } else { opacity = 1.0; } } game = g_game; spriteColor = &(this->_sprite)._color; fadedColor._tint[3] = savedTintA * opacity; offset = renderOffset; fadedColor._tint[0] = savedTintR; fadedColor._tint[1] = savedTintG; fadedColor._tint[2] = savedTintB; fadedColor._colorize[0] = savedColorizeR; fadedColor._colorize[1] = savedColorizeG; fadedColor._colorize[2] = savedColorizeB; fadedColor._colorize[3] = savedColorizeA; (*GHIDRA_CAST((GHIDRA_CAST(&(fadedColor._offset)) + 0x0))) = savedOffsetXY; if (spriteColor != &fadedColor) { *(float (*) [2])(this->_sprite)._color._offset = savedOffsetXY; spriteColor->_tint[0] = savedTintR; (this->_sprite)._color._tint[1] = savedTintG; (this->_sprite)._color._tint[2] = savedTintB; (this->_sprite)._color._tint[3] = fadedColor._tint[3]; (this->_sprite)._color._offset[2] = savedOffsetZ; (this->_sprite)._color._colorize[0] = savedColorizeR; (this->_sprite)._color._colorize[1] = savedColorizeG; (this->_sprite)._color._colorize[2] = savedColorizeB; (this->_sprite)._color._colorize[3] = savedColorizeA; } } local_d8 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x12bc)); if (this->_player == GHIDRA_CAST(0x0)) { LAB_00624ff9: isHologram = '\0'; } else { bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::IsHologram(); isHologram = '\x01'; if (bVar3 == 0) goto LAB_00624ff9; } if ((*GHIDRA_CAST((*GHIDRA_CAST(ThreadLocalStoragePointer) + 0xc)) < DAT_00c7fd10) && (_Init_thread_header(), DAT_00c7fd10 == -1)) { _DAT_00c5c97c = 0x300000004; DAT_00c5c984 = 0x1b; _atexit(GHIDRA_CAST<_func_4879 *>(&DAT_00b15590)); local_8 = -NAN; _Init_thread_footer(&DAT_00c7fd10); } if (isHologram != '\0') { if ((DAT_00c5c978 == 0) && (KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")), DAT_00c5c978 == 0)) { pcVar1 = (code *)swi(3); (*pcVar1)(); return; } seed = DAT_00c5c978 >> ((byte)_DAT_00c5c97c & 0x1f) ^ DAT_00c5c978; seed = seed << ((byte)((ulonglong)_DAT_00c5c97c >> 0x20) & 0x1f) ^ seed; tmpColor._offset[0] = 0.0; tmpColor._offset[1] = 0.0; DAT_00c5c978 = seed >> ((byte)DAT_00c5c984 & 0x1f) ^ seed; tmpColor._offset[2] = 0.0; tmpColor._tint[0] = 1.0; tmpColor._tint[1] = 1.0; tmpColor._tint[2] = 1.0; tmpColor._colorize[0] = 0.0; tmpColor._colorize[1] = 0.0; tmpColor._colorize[2] = 0.0; tmpColor._colorize[3] = 0.0; tmpColor._tint[3] = (float)((double)GHIDRA_INT(DAT_00c5c978) + __uint_to_double_fixup[-(GHIDRA_INT(DAT_00c5c978) >> 0x1f)]) * 2.3283062e-10 * 0.15 + 0.05; render_color_stack_push(&tmpColor); } if (this->_variant == 0x4b) { pvVar4 = this->_player; local_f0 = (g_screenHeight - 182.0) * 0.5; local_d4 = (g_screenWidth - 338.0) * 0.5; local_ec = g_displayPixelRatio * g_screenPointScale; local_d0 = ((*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x33c)) - 60.0) * 0.65 + local_d4) * local_ec + 0.5; flooredCoord = floor((double)local_d0); local_d0 = (float)flooredCoord / local_ec; local_e0 = ((*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x340)) - 140.0) * 0.65 + local_f0) * local_ec + 0.5; flooredCoord = floor((double)local_e0); local_e0 = (float)flooredCoord / local_ec; local_d4 = (((this->_pos).x - 60.0) * 0.65 + local_d4) * local_ec + 0.5; flooredCoord = floor((double)local_d4); iconPosX.y = (float)flooredCoord / local_ec; local_d4 = (((this->_pos).y - 140.0) * 0.65 + local_f0) * local_ec + 0.5; flooredCoord = floor((double)local_d4); local_d0 = local_d0 - iconPosX.y; local_e0 = local_e0 - (float)flooredCoord / local_ec; if (local_d8 == GHIDRA_CAST(&DAT_00000005)) { local_e0 = local_e0 * -1.0; } layerId = GHIDRA_CAST(0x1); do { fVar7 = (float)((double)GHIDRA_INT(layerId) + __uint_to_double_fixup[-(GHIDRA_INT(layerId) >> 0x1f)]); fVar6 = 1.0 - fVar7 * 0.125; local_d4 = (this->_sprite)._scale.x; iconPosX.y = (fVar7 * local_d0 * 0.125 + 0.0) / local_d4; local_d4 = ((-5.0 - fVar6 * fVar6 * 7.0) + fVar7 * local_e0 * 0.125) / local_d4; layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(layerId); layerId = layerId + 1; (layer->_pos).x = iconPosX.y; (layer->_pos).y = local_d4; } while (layerId < &DAT_00000009); LAB_0062578c: offset = renderOffset; } else if (this->_variant == 0x4f) { local_f0 = (g_screenHeight - 182.0) * 0.5; iconScaleX.y = (g_screenWidth - 338.0) * 0.5; local_e0 = g_displayPixelRatio * g_screenPointScale; iconPosX.y = ((*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) - 60.0) * 0.65 + iconScaleX.y) * local_e0 + 0.5; flooredCoord = floor((double)iconPosX.y); local_d0 = (float)flooredCoord / local_e0; iconPosX.y = ((*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) - 140.0) * 0.65 + local_f0) * local_e0 + 0.5; flooredCoord = floor((double)iconPosX.y); iconPosX.y = (float)flooredCoord; local_ec = iconPosX.y / local_e0; iconScaleX.y = (((this->_pos).x - 60.0) * 0.65 + iconScaleX.y) * local_e0 + 0.5; flooredCoord = floor((double)iconScaleX.y); iconPosX.y = (float)flooredCoord / local_e0; iconScaleX.y = (((this->_pos).y - 140.0) * 0.65 + local_f0) * local_e0 + 0.5; flooredCoord = floor((double)iconScaleX.y); local_d0 = local_d0 - iconPosX.y; local_ec = local_ec - (float)flooredCoord / local_e0; if (local_d8 == GHIDRA_CAST(&DAT_00000005)) { local_ec = local_ec * -1.0; } layerId = GHIDRA_CAST(0x1); local_d8 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x14f4)) * -1.0)); iconScaleX.y = -16.0 - (float)local_d8; do { fVar7 = (float)((double)GHIDRA_INT(layerId) + __uint_to_double_fixup[-(GHIDRA_INT(layerId) >> 0x1f)]); fVar6 = 1.0 - fVar7 / 9.0; local_d4 = (this->_sprite)._scale.x; iconPosX.y = ((fVar7 * local_d0) / 9.0 + 0.0) / local_d4; local_d4 = (iconScaleX.y * fVar6 * fVar6 + (float)local_d8 + (fVar7 * local_ec) / 9.0) / local_d4; layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(layerId); layerId = layerId + 1; (layer->_pos).x = iconPosX.y; (layer->_pos).y = local_d4; } while (layerId < GHIDRA_CAST(0xa)); goto LAB_0062578c; } switch(this->_variant) { case 0x30: local_d0 = (float)__RTDynamicCast(this->_extraData,0, &IsaacRepentancePlus::Entity_Familiar::ExtraData:: RTTI_Type_Descriptor, &IsaacRepentancePlus::IsaacsBodyData::RTTI_Type_Descriptor); if (local_d0 != 0.0) { local_d8 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); iconScaleX.y = ((((this->_pos).x + (this->_posOffset).x) - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * (float)local_d8 + 0.5; flooredCoord = floor((double)iconScaleX.y); iconPosX.y = (float)flooredCoord / (float)local_d8; iconScaleX.y = ((((this->_posOffset).y + (this->_pos).y) - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * (float)local_d8 + 0.5; flooredCoord = floor((double)iconScaleX.y); iconScaleX.y = (float)flooredCoord; fVar7 = iconScaleX.y / (float)local_d8; local_f0 = 5.60519e-45; local_d8 = GHIDRA_CAST((GHIDRA_INT(local_d0) + 0x568)); fVar6 = offset->y; layerColor = GHIDRA_CAST((GHIDRA_INT(local_d0) + 0x1c0)); (this->_renderPosition).x = iconPosX.y + offset->x; (this->_renderPosition).y = fVar7 + fVar6; do { iVar5 = *local_d8; if (-1 < iVar5) { spriteColor = &(this->_sprite)._color; if (GHIDRA_CAST(layerColor) != spriteColor) { fVar6 = (this->_sprite)._color._tint[1]; fVar7 = (this->_sprite)._color._tint[2]; fVar2 = (this->_sprite)._color._tint[3]; *layerColor = spriteColor->_tint[0]; layerColor[1] = fVar6; layerColor[2] = fVar7; layerColor[3] = fVar2; fVar6 = (this->_sprite)._color._colorize[1]; fVar7 = (this->_sprite)._color._colorize[2]; fVar2 = (this->_sprite)._color._colorize[3]; layerColor[4] = (this->_sprite)._color._colorize[0]; layerColor[5] = fVar6; layerColor[6] = fVar7; layerColor[7] = fVar2; fVar6 = (this->_sprite)._color._offset[1]; layerColor[8] = (this->_sprite)._color._offset[0]; layerColor[9] = fVar6; layerColor[10] = (this->_sprite)._color._offset[2]; iVar5 = *local_d8; } (GHIDRA_CAST((GHIDRA_CAST((layerColor + -0x2a)))))->Sprite::RenderLayer(iVar5,&this->_renderPosition, &g_vectorZero,&g_vectorZero); } local_d8 = local_d8 + 1; layerColor = layerColor + 0x45; local_f0 = (float)(GHIDRA_INT(local_f0) + -1); } while (local_f0 != 0.0); (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(local_d0) + 4)))))->Sprite::RenderLayer(0,&this->_renderPosition,&g_vectorZero, &g_vectorZero); break; } default: (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Render(offset); break; case 0x44: if (this->_visible != 0) { local_d8 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); iconScaleX.y = ((((this->_posOffset).x + (this->_pos).x) - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * (float)local_d8 + 0.5; flooredCoord = floor((double)iconScaleX.y); iconPosX.y = (float)flooredCoord / (float)local_d8; iconScaleX.y = ((((this->_posOffset).y + (this->_pos).y) - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * (float)local_d8 + 0.5; flooredCoord = floor((double)iconScaleX.y); iconScaleX.y = (float)flooredCoord; fVar6 = offset->x; renderPos = &this->_renderPosition; (this->_renderPosition).y = iconScaleX.y / (float)local_d8 + offset->y; renderPos->x = iconPosX.y + fVar6; player = this->_player; savedPlayerColor = (float)player[0x3c]; fStack_94 = (float)player[0x3d]; fStack_90 = (float)player[0x3e]; iStack_8c = player[0x3f]; fStack_88 = (float)player[0x40]; fStack_84 = (float)player[0x41]; fStack_80 = (float)player[0x42]; fStack_7c = (float)player[0x43]; afStack_78 = *(float (*) [2])(player + 0x44); fStack_70 = (float)player[0x46]; tmpColor._tint[3] = opacity; tmpColor._tint[0] = savedPlayerColor; tmpColor._tint[1] = fStack_94; tmpColor._tint[2] = fStack_90; tmpColor._colorize[0] = fStack_88; tmpColor._colorize[1] = fStack_84; tmpColor._colorize[2] = fStack_80; tmpColor._colorize[3] = fStack_7c; (*GHIDRA_CAST((GHIDRA_CAST(&(tmpColor._offset)) + 0x0))) = afStack_78; tmpColor._offset[2] = fStack_70; (**(code **)(*player + 0x3c))(&tmpColor,0xffffffff,0xff,0); (GHIDRA_CAST((this->_player)))->Entity_Player::RenderGlow(renderPos); FUN_0078e130(renderPos); (GHIDRA_CAST((this->_player)))->Entity_Player::RenderHead(renderPos); (**(code **)(*GHIDRA_CAST(this->_player) + 0x3c))(&savedPlayerColor,0xffffffff,0xff,0,1); } break; case 0x4e: case 0xf3: local_d8 = GHIDRA_CAST((g_displayPixelRatio * g_screenPointScale)); iconScaleX.y = ((((this->_posOffset).x + (this->_pos).x) - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5) * (float)local_d8 + 0.5; flooredCoord = floor((double)iconScaleX.y); iconPosX.y = (float)flooredCoord / (float)local_d8; iconScaleX.y = ((((this->_posOffset).y + (this->_pos).y) - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * (float)local_d8 + 0.5; flooredCoord = floor((double)iconScaleX.y); iconScaleX.y = (float)flooredCoord; fVar7 = iconPosX.y + offset->x; fVar6 = offset->y; renderPos = &this->_renderPosition; renderPos->x = fVar7; (this->_renderPosition).y = iconScaleX.y / (float)local_d8 + fVar6; if (this->_variant == 0xf3) { renderPos->x = fVar7 + 0.0; (this->_renderPosition).y = (this->_renderPosition).y + 8.45; } player = this->_player; savedPlayerColor2 = player[0x3c]; iStack_c0 = player[0x3d]; iStack_bc = player[0x3e]; iStack_b8 = player[0x3f]; savedPlayerFlag171 = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x171)); iStack_b4 = player[0x40]; iStack_b0 = player[0x41]; iStack_ac = player[0x42]; iStack_a8 = player[0x43]; uStack_a4 = *GHIDRA_CAST((player + 0x44)); iStack_9c = player[0x46]; fStack_60 = opacity; fadedPlayerColor = savedPlayerColor2; iStack_68 = iStack_c0; iStack_64 = iStack_bc; iStack_5c = iStack_b4; iStack_58 = iStack_b0; iStack_54 = iStack_ac; iStack_50 = iStack_a8; uStack_4c = uStack_a4; iStack_44 = iStack_9c; (**(code **)(*player + 0x3c))(&fadedPlayerColor,0xffffffff,0xff,0); *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x171)) = 1; (GHIDRA_CAST((this->_player)))->Entity_Player::RenderGlow(renderPos); FUN_0078e130(renderPos); (GHIDRA_CAST((this->_player)))->Entity_Player::RenderHead(renderPos); *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x171)) = savedPlayerFlag171; (**(code **)(*GHIDRA_CAST(this->_player) + 0x3c))(&savedPlayerColor2,0xffffffff,0xff,0,1); break; case 0xe7: local_d0 = (float)__RTDynamicCast(this->_extraData,0, &IsaacRepentancePlus::Entity_Familiar::ExtraData:: RTTI_Type_Descriptor, &IsaacRepentancePlus::AbyssLocustData::RTTI_Type_Descriptor); iVar5 = *GHIDRA_CAST((GHIDRA_CAST(local_d0) + 0x24)); if (iVar5 != *GHIDRA_CAST((GHIDRA_CAST(local_d0) + 0x28))) { do { render_abyss_locust_sprite(this,iVar5,renderOffset); iVar5 = iVar5 + 0x114; } while (iVar5 != *GHIDRA_CAST((GHIDRA_CAST(local_d0) + 0x28))); } (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Render(renderOffset); iVar5 = *GHIDRA_CAST((GHIDRA_CAST(local_d0) + 0x30)); if (iVar5 != *GHIDRA_CAST((GHIDRA_CAST(local_d0) + 0x34))) { do { render_abyss_locust_sprite(this,iVar5,renderOffset); iVar5 = iVar5 + 0x114; } while (iVar5 != *GHIDRA_CAST((GHIDRA_CAST(local_d0) + 0x34))); } break; case 0xed: (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::Render(offset); if (((this->_visible != 0) && (pvVar4 = (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::GetLayerFrame(0), pvVar4 != (void *)0x0)) && (*GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x2c)) != '\0')) { uStack_12c = 1; if (((byte)g_graphicsManager_flags & 4) == 0) { uStack_138 = 6; } else { uStack_138 = 1; } iconRenderParams = 0; uStack_134 = 1; uStack_130 = 1; layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); tmpColor._tint[0] = 1.0; tmpColor._tint[1] = 1.0; iconScaleX.x = (layer->_size).x * *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x18)); tmpColor._tint[2] = 1.0; tmpColor._offset[0] = 0.6; tmpColor._offset[1] = 0.4; iconScaleX.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x1c)) * (layer->_size).y; tmpColor._offset[2] = 0.8; tmpColor._tint[3] = opacity; tmpColor._colorize[0] = 0.0; tmpColor._colorize[1] = 0.0; tmpColor._colorize[2] = 0.0; tmpColor._colorize[3] = 0.0; iconPosX.x = (this->_renderPosition).x + *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x10)); iconPosX.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x14)) + (this->_renderPosition).y; GameOver::render_collectible_icon (&g_game->_gameOver,this->_subtype,&iconPosX,&tmpColor,&iconScaleX,&iconRenderParams ); } break; case 0xf0: FUN_00435130(); } FUN_00860fe0(this,renderOffset); render_charge_indicator(this,&this->_renderPosition); if ((isHologram != '\0') && (g_colorStackSize = g_colorStackSize - 1, g_colorStackSize == 0)) { DAT_00c78dbc = 0; } spriteColor = &(this->_sprite)._color; if (spriteColor != GHIDRA_CAST(local_194)) { spriteColor->_tint[0] = savedTintR; (this->_sprite)._color._tint[1] = savedTintG; (this->_sprite)._color._tint[2] = savedTintB; (this->_sprite)._color._tint[3] = savedTintA; (this->_sprite)._color._colorize[0] = savedColorizeR; (this->_sprite)._color._colorize[1] = savedColorizeG; (this->_sprite)._color._colorize[2] = savedColorizeB; (this->_sprite)._color._colorize[3] = savedColorizeA; *(float (*) [2])(this->_sprite)._color._offset = savedOffsetXY; (this->_sprite)._color._offset[2] = savedOffsetZ; } ExceptionList = local_10; return; } // 0062a8f0 byte Entity_Familiar::CanPlayerFire() { void *pvVar1; pvVar1 = this->_player; if ((((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1398)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x139a)) == '\0')) && (*GHIDRA_CAST(&g_game->_stageTransition) == 0)) && ((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x410)) != '\0' && (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x414)) < 1)))) { return 1; } return 0; } // 0062a930 void Entity_Familiar::AddCoins(int count) { int iVar1; code *pcVar2; byte isHasBffs; int coins; uint seed; uint roll; iVar1 = this->_variant; coins = this->_coins + count; this->_coins = coins; if (iVar1 == 0xe8) { if (0 < coins % 100) { do { coins = coins + 99; } while (0 < coins % 100); this->_coins = coins; } (GHIDRA_CAST((this->_player)))->Entity_Player::AddBlueFlies(1,&this->_pos,GHIDRA_CAST(0x0)); return; } if ((((iVar1 != 0xf1) && (iVar1 == 0x58)) && (this->_state == 3)) && (0 < count)) { do { isHasBffs = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0); seed = (this->_dropRNG)._seed; if (isHasBffs == 0) { if (seed == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); seed = (this->_dropRNG)._seed; if (seed == 0) { pcVar2 = (code *)swi(3); (*pcVar2)(); return; } } seed = seed >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ seed; seed = seed << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ seed; seed = seed >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ seed; roll = seed % 5; } else { if (seed == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); seed = (this->_dropRNG)._seed; if (seed == 0) { pcVar2 = (code *)swi(3); (*pcVar2)(); return; } } seed = seed >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ seed; seed = seed << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ seed; seed = seed >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ seed; roll = seed & 3; } (this->_dropRNG)._seed = seed; if (roll == 0) { this->_counter = this->_counter + 1; } count = count + -1; } while (count != 0); } return; } // 0062aaa0 void Entity_Familiar::AddHearts(int param_2) { this->_hearts = this->_hearts + param_2; return; } // 0062aab0 void Entity_Familiar::TriggerRoomClear() { byte bVar1; Entity *shot; Entity_Player *playerEntity; Entity *shot_00; int iVar3; uint uVar4; uint pickupSubType; uint pickupVariant; float dropChance; RNG spawnRng; Vector spiderPos; float local_10; Vector local_c; Manager *manager; Entity *playerEntity; void **spiderCounter; if (this->_exists == 0) { return; } playerEntity = this->_player; if (playerEntity == GHIDRA_CAST(0x0)) { return; } if (playerEntity->_exists == 0) { return; } this->_roomClearCount = this->_roomClearCount + 1; pickupSubType = 0; pickupVariant = 0; local_c.y = 0.0; bVar1 = (GHIDRA_CAST((playerEntity)))->Entity_Player::HasCollectible(0xf7,0); switch(this->_variant) { case 0x14: if (bVar1 == 0) { local_c.y = 0.35; pickupVariant = 0x28; } else { local_c.y = 0.42; pickupVariant = 0x28; } break; case 0x15: if (bVar1 == 0) { local_c.y = 0.5; pickupVariant = 0x14; } else { local_c.y = 0.57; pickupVariant = 0x14; } break; case 0x16: if (bVar1 == 0) { local_c.y = 0.35; pickupVariant = 10; pickupSubType = 2; } else { local_c.y = 0.42; pickupVariant = 10; pickupSubType = 2; } break; case 0x17: if (bVar1 == 0) { local_c.y = 0.125; pickupVariant = 10; pickupSubType = 3; } else { local_c.y = 0.166; pickupVariant = 10; pickupSubType = 3; } break; case 0x34: iVar3 = 2; bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0); if (bVar1 != 0) { iVar3 = 3; } do { Room::FindFreePickupSpawnPosition(g_game->_room,&spiderPos,&this->_pos,0.0,0,0,0); playerEntity = this->_player; spiderCounter = &playerEntity[4]._config; *spiderCounter = (void *)(GHIDRA_INT(*spiderCounter) + 1); spawn_blue_spider(&spiderPos,playerEntity,&g_vectorZero); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(shot); iVar3 = iVar3 + -1; } while (iVar3 != 0); pickupVariant = 0; pickupSubType = 0; break; case 0x39: if (bVar1 == 0) { local_c.y = 0.18; } else { local_c.y = 0.22; } uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(4); switch(uVar4) { case 0: pickupVariant = 10; pickupSubType = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(6); pickupSubType = pickupSubType + 1; break; case 1: pickupVariant = 0x14; pickupSubType = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(4); pickupSubType = pickupSubType + 1; break; case 2: pickupVariant = 0x1e; pickupSubType = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(3); pickupSubType = pickupSubType + 1; break; case 3: pickupVariant = 0x28; pickupSubType = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(2); pickupSubType = pickupSubType + 1; } break; case 0x52: local_10 = 0.8; local_c.y = 0.0; if (bVar1 == 0) { local_10 = 1.0; } dropChance = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomFloat(); local_10 = dropChance * local_10; dropChance = local_10; if (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13c0)) == 0x24) { dropChance = local_10 * 0.75; } if (0.1 <= dropChance) { if (0.35 <= dropChance) break; uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(7); switch(uVar4) { case 0: pickupVariant = 10; dropChance = 1.0; break; case 1: pickupVariant = 0x14; dropChance = 1.0; break; case 2: pickupVariant = 0x1e; dropChance = 1.0; break; case 3: pickupVariant = 0x28; dropChance = 1.0; break; case 4: pickupVariant = 0x5a; dropChance = 1.0; break; case 5: pickupVariant = 300; dropChance = 1.0; break; case 6: pickupVariant = 0x46; default: dropChance = 1.0; } } else { pickupVariant = 0x15e; dropChance = 1.0; } goto LAB_0062acdf; case 0x58: if (this->_state != 1) break; local_10 = 1.12104e-43; uVar4 = 100; if (bVar1 != 0) { uVar4 = 0x50; } uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(uVar4); if (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13c0)) == 0x24) { uVar4 = GHIDRA_INT((uVar4 << 2)) / 3; } dropChance = local_c.y; if (GHIDRA_INT(uVar4) < 0x21) { this->_counter = this->_counter + 1; } goto LAB_0062acdf; case 0x5b: if (bVar1 == 0) { local_c.y = 0.125; pickupVariant = 300; } else { local_c.y = 0.166; pickupVariant = 300; } break; case 0x5e: local_10 = 1.12104e-43; uVar4 = 100; if (bVar1 != 0) { uVar4 = 0x50; } local_c.y = 0.0; uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(uVar4); if (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13c0)) == 0x24) { uVar4 = GHIDRA_INT((uVar4 << 2)) / 3; } if (GHIDRA_INT(uVar4) < 10) { uVar4 = (GHIDRA_CAST((&this->_dropRNG)))->RNG::RandomInt(3); if (uVar4 == 0) { uVar4 = Random(); (GHIDRA_CAST((g_game)))->Game::Spawn(5,0x5a,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4); } else { playerEntity = this->_player; spiderCounter = &playerEntity[4]._config; *spiderCounter = (void *)(GHIDRA_INT(*spiderCounter) + 1); spawn_blue_spider(&this->_pos,playerEntity,&g_vectorZero); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(shot_00); } } break; case 0x70: if (bVar1 == 0) { pickupVariant = 0x46; dropChance = 0.125; } else { pickupVariant = 0x46; dropChance = 0.166; } goto LAB_0062acdf; case 0x72: if (bVar1 == 0) { local_c.y = 0.125; pickupVariant = 0x45; } else { local_c.y = 0.166; pickupVariant = 0x45; } } dropChance = local_c.y; LAB_0062acdf: playerEntity = this->_player; if (playerEntity->_playerType == 0x24) { dropChance = dropChance * 0.75; } uVar4 = this->_roomClearCount & 0x800003ff; if (GHIDRA_INT(uVar4) < 0) { uVar4 = (uVar4 - 1 | 0xfffffc00) + 1; } if ((pickupVariant != 0) && (0.0 < dropChance)) { if (dropChance < 1.0) { if (GHIDRA_INT(((float)GHIDRA_INT((uVar4 + 1)) * dropChance)) <= GHIDRA_INT(((float)GHIDRA_INT(uVar4) * dropChance))) goto LAB_0062ae77; playerEntity = this->_player; } if (((pickupVariant != 10) || (bVar1 = (GHIDRA_CAST((playerEntity)))->Entity_Player::HasTrinket(0x16,0), bVar1 == 0)) || (uVar4 = Random(), uVar4 % 5 == 0)) { if (this->_variant == 0x5b) { pickupSubType = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); pickupSubType = ItemPool::GetCardEx(pickupSubType,0,-1,0,1); } Room::FindFreePickupSpawnPosition(g_game->_room,&local_c,&this->_pos,0.0,0,0,0); spawnRng._seed = (GHIDRA_CAST((&this->_dropRNG)))->RNG::Next(); spawnRng._shift1 = 5; spawnRng._shift2 = 0x11; spawnRng._shift3 = 0xd; uVar4 = (GHIDRA_CAST((&spawnRng)))->RNG::Next(); (GHIDRA_CAST((g_game)))->Game::Spawn(5,pickupVariant,&local_c,&g_vectorZero,GHIDRA_CAST(this),pickupSubType,uVar4); bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(s_Spawn,1); if (bVar1 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } manager = g_manager; if (this->_variant == 0x16) { local_10 = 3.06884e-43; seed_fart_sound_override(GHIDRA_CAST(&local_10)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_10),1.0,2,0,1.0,0.0); } } } LAB_0062ae77: manager = g_manager; iVar3 = this->_variant; if (iVar3 == 0x5d) { if (this->_subtype != 0) { this->_state = 1; return; } } else if (iVar3 == 0xdd) { if (this->_hearts < 6) { local_10 = 6.60012e-43; this->_hearts = this->_hearts + 1; seed_fart_sound_override(GHIDRA_CAST(&local_10)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_10),1.0,2,0,1.0,0.0); paschal_candle_sync_effects(this); return; } } else if (((iVar3 != 0xee) && (iVar3 == 0xce)) && ((this->_dead == 0 && (1 < g_game->_frameCount - this->_spawnFrame)))) { if (this->_wispCollectibleType == 0x1ea) { iVar3 = GetRandomWisp(&this->_dropRNG); FUN_0043d7f0(iVar3); this->_health = this->_maxHitPoints; } else if (this->_wispCollectibleType == 0x203) { this->_health = this->_maxHitPoints; return; } } return; } // 0062b360 void Entity_Familiar::level_start() { void *pvVar1; float fVar2; byte bVar3; byte *pbVar4; uint uVar5; int iVar6; Vector *followPos; byte *pbVar7; int extraout_ECX; bool bVar8; Vector local_18; undefined4 local_10; undefined4 local_c; byte *animData; EntityPtr roomEntity; if (this->_variant != 100) goto LAB_0062b462; this->_subtype = 0; this->_visible = 1; this->_shadowSize = *GHIDRA_CAST((GHIDRA_CAST(this->_config) + 0x24)); animData = (this->_sprite)._animState._animData; if (animData == GHIDRA_CAST(0x0)) { LAB_0062b3e6: bVar3 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(s_Idle,1); if (bVar3 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } } else { pbVar4 = animData; if (0xf < *GHIDRA_CAST((animData + 0x14))) { pbVar4 = *GHIDRA_CAST(animData); } pbVar7 = s_Idle; do { bVar3 = *pbVar4; bVar8 = bVar3 < *pbVar7; if (bVar3 != *pbVar7) { LAB_0062b3d0: uVar5 = -GHIDRA_UINT(bVar8) | 1; goto LAB_0062b3d5; } if (bVar3 == 0) break; bVar3 = pbVar4[1]; bVar8 = bVar3 < pbVar7[1]; if (bVar3 != pbVar7[1]) goto LAB_0062b3d0; pbVar4 = pbVar4 + 2; pbVar7 = pbVar7 + 2; } while (bVar3 != 0); uVar5 = 0; LAB_0062b3d5: if ((uVar5 != 0) || ((animData[0x34] != 0 && ((this->_sprite)._animState._isPlaying == 0)))) goto LAB_0062b3e6; } pvVar1 = (g_manager->_itemConfig)._collectibles._begin; if ((0x6d0 < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar1) & 0xfffffffcU))) && (fVar2 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x6d0)), fVar2 != 0.0)) { local_10 = *GHIDRA_CAST((GHIDRA_CAST(fVar2) + 0x78)); local_18.y = 0.0; local_c = 0; local_18.x = fVar2; (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1508)))))->TemporaryEffects::RemoveEffect(&local_18,1); } LAB_0062b462: iVar6 = this->_variant; if (iVar6 == 0x2a) { this->_subtype = GHIDRA_UINT(this->_subtype) >> 1; } else if ((iVar6 == 0x77) || (iVar6 == 0x18)) { this->_subtype = 0; } else if (iVar6 == 0xcb) { if (g_game->_isStartingFromState == 0) { this->_hearts = 0; iVar6 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetHealthType(); if (GHIDRA_INT((2 - GHIDRA_UINT((iVar6 != 3)))) < *GHIDRA_CAST((extraout_ECX + 0x1344))) { this->_state = 4; fVar2 = *GHIDRA_CAST((extraout_ECX + 0x340)); (this->_pos).x = *GHIDRA_CAST((extraout_ECX + 0x33c)); (this->_pos).y = fVar2; } } FUN_00640050(); } else if (iVar6 == 0xdd) { paschal_candle_sync_effects(this); } else if (iVar6 == 0xd3) { if (g_game->_isStartingFromState == 0) { if (this->_state == 4) { this->_visible = 1; iVar6 = 1; } else { iVar6 = 2; } this->_state = iVar6; fVar2 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); (this->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) + 0.0; (this->_pos).y = fVar2 + 48.0; return; } } else if (iVar6 == 0xce) { if (this->_subtype == 0x2be) { this->Remove(); } else if ((this->_subtype == 0x7f) && (5 < g_game->_frameCount - this->_spawnFrame)) { this->Remove(); } } else if (iVar6 == 0xec) { iVar6 = g_game->_currentRoomIdx; if (iVar6 < 0) { iVar6 = g_game->_startingRoomIdx; } this->_coins = -1; (this->_formationTargetOffset).x = (float)(iVar6 % 0xd); (this->_formationOffset).x = (float)(iVar6 % 0xd); (this->_formationTargetOffset).y = (float)(iVar6 / 0xd); (this->_formationOffset).y = (float)(iVar6 / 0xd); } else if (iVar6 == 0xf0) { this->Remove(); } followPos = GetFollowTargetPosition(this,&local_18,0); (this->_pos).x = followPos->x; (this->_pos).y = followPos->y; iVar6 = this->_variant; if (iVar6 == 0xf1) { uVar5 = 0; pvVar1 = g_game->_room; if (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1254)) == 0) { return; } do { iVar6 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x124c)) + uVar5 * 4)); if ((*GHIDRA_CAST((iVar6 + 0x28)) == 0x322) && (*GHIDRA_CAST((iVar6 + 0x3bc)) == this)) { *GHIDRA_CAST((iVar6 + 0x33c)) = *GHIDRA_CAST((iVar6 + 0x33c)) + 0.0; *GHIDRA_CAST((iVar6 + 0x340)) = *GHIDRA_CAST((iVar6 + 0x340)) + 80.0; roomEntity = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x124c)) + uVar5 * 4)); if (roomEntity == this->_linkedEntity) { fVar2 = *GHIDRA_CAST((GHIDRA_CAST(roomEntity) + 0x340)); (this->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(roomEntity) + 0x33c)); (this->_pos).y = fVar2; } } uVar5 = uVar5 + 1; } while (uVar5 < *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1254))); iVar6 = this->_variant; } if (iVar6 == 0xf2) { this->_state = 0; } return; } // 0062bb70 void Entity_Familiar::room_enter() { code *pcVar1; byte bVar2; char isTargetable; void *pvVar3; Vector *outPosition; Vector *tmpVec; uint uVar4; int iVar5; uint uVar6; bool bVar7; float fVar8; Vector local_60; Vector local_58; Vector local_50; Vector wispOrbitPos; Vector itemWispOrbitPos; Vector enterDirection; Vector randomDirection [3]; undefined8 local_14; EntityPtr child; Game *game; undefined4 playerPosY; int segment; undefined4 *segmentPos; game = g_game; uVar6 = this->_variant; if (900 < uVar6) goto switchD_0062bba7_caseD_4; if (uVar6 == 900) { switchD_0062bba7_caseD_49: (this->_targetPosition).x = g_vectorZero.x; fVar8 = g_vectorZero.y; LAB_0062c604: (this->_targetPosition).y = fVar8; goto switchD_0062bba7_caseD_4; } switch(uVar6) { case 3: case 0x19: case 0x5d: case 0x68: case 0x82: case 0xdf: case 0xe8: this->_fireCooldown = 0xf; break; case 0x11: case 0x2e: case 0x2f: case 0x47: case 0x48: case 0x60: case 0xcf: goto switchD_0062bba7_caseD_11; case 0x32: case 0x3a: this->_subtype = 0; this->_fireCooldown = 0; goto switchD_0062bba7_caseD_11; case 0x33: case 0x5f: case 0xe7: this->_fireCooldown = 0; break; case 0x3b: this->_fireCooldown = 0x3c; break; case 0x42: case 0x43: this->_subtype = 1; (this->_pathfinder)._movementTarget.x = g_vectorZero.x; (this->_pathfinder)._movementTarget.y = g_vectorZero.y; (this->_pathfinder)._moveDirection.x = g_vectorZero.x; (this->_pathfinder)._moveDirection.y = g_vectorZero.y; pvVar3 = game->_room; local_58.x = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x1c)); local_50.x = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x14)); fVar8 = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x20)); local_60.x = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x18)); (this->_targetPosition).x = local_50.x; (this->_targetPosition).y = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x18)); uVar6 = Random(); local_60.x = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283064e-10 * (fVar8 - local_60.x); uVar6 = Random(); (this->_targetPosition).x = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283064e-10 * (local_58.x - local_50.x) + (this->_targetPosition).x; (this->_targetPosition).y = local_60.x + (this->_targetPosition).y; uVar6 = Random(); this->_health = this->_maxHitPoints; this->_counter = uVar6 % 0x3c + 0x46; break; case 0x49: case 0x7a: goto switchD_0062bba7_caseD_49; case 0x53: goto switchD_0062bba7_caseD_53; case 0x55: (this->_targetPosition).x = g_vectorZero.x; fVar8 = g_vectorZero.y; this->_moveDirection = 3; goto LAB_0062c604; case 0x56: if (g_game->_isStartingFromState != 0) break; switchD_0062bba7_caseD_53: this->_coins = 0; break; case 0x5e: case 0x71: this->_subtype = 1; (this->_pathfinder)._movementTarget.x = g_vectorZero.x; (this->_pathfinder)._movementTarget.y = g_vectorZero.y; (this->_pathfinder)._moveDirection.x = g_vectorZero.x; (this->_pathfinder)._moveDirection.y = g_vectorZero.y; tmpVec = (GHIDRA_CAST((game->_room)))->Room::GetRandomPosition(&local_60,0.0); (this->_targetPosition).x = tmpVec->x; (this->_targetPosition).y = tmpVec->y; uVar6 = Random(); this->_counter = uVar6 % 0x3c + 0x46; break; case 0x62: case 99: case 0x65: case 0x6a: case 0x83: this->_moveDelayNum = -1; goto switchD_0062bba7_caseD_11; case 0x6f: (this->_targetPosition).x = g_vectorZero.x; (this->_targetPosition).y = g_vectorZero.y; case 0xd4: this->_state = 0; break; case 0x7c: this->_state = 0; if (this->_visible == 0) { this->_roomClearCount = 0; } this->_visible = 1; (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(s_Idle,0); break; case 0x81: this->_state = 0; (this->_targetPosition).x = g_vectorZero.x; (this->_targetPosition).y = g_vectorZero.y; this->_visible = 1; (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("FloatDown"),0); break; case 0xce: if (this->_subtype == 0x20f) { this->_keys = 0; (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; if (this->_variant == 0xed) { iVar5 = this->_wispCollectibleType; } else if (this->_variant == 0xce) { iVar5 = this->_subtype; } else { iVar5 = 0x248; } pvVar3 = ItemConfig::get_wisp_config(iVar5); if (this->_orbitLayer < 0) { AddToOrbit(this,*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x18c)) + 7); } } else if (this->_subtype == 0x244) { local_14 = 0x1500000001; iVar5 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)); if ((iVar5 == 0) || (uVar6 = *GHIDRA_CAST((iVar5 + 0x5c)), uVar6 == 0)) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar6 = uVar6 >> 1 ^ uVar6; uVar6 = uVar6 << 0x15 ^ uVar6; uVar6 = (uVar6 >> 0x14 ^ uVar6) & 7; if ((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + uVar6 * 4 + 0x724)) == 0) && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::CanSpawnDoorOutline(g_game->_currentRoomIdx,uVar6), bVar2 != 0)) { (GHIDRA_CAST((GHIDRA_CAST(g_game))))->Level::MakeRedRoomDoor(g_game->_currentRoomIdx,uVar6); } } local_50.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); local_50.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); tmpVec = &local_50; outPosition = &wispOrbitPos; goto LAB_0062c09b; case 0xd3: fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); (this->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); (this->_pos).y = fVar8; (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; bVar2 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0); if (bVar2 != 0) { this->_coins = 1; (GHIDRA_CAST((&this->_sprite)))->ANM2::PlayOverlay(GHIDRA_CAST("Mantle"),0); } break; case 0xe0: this->Remove(); break; case 0xe1: fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); (this->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); (this->_pos).y = fVar8; (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(s_Fly,0); this->_state = 3; break; case 0xec: if (this->_visible == 0) { update_star_of_bethlehem_speed(this,0); } break; case 0xed: local_58.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); local_58.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); tmpVec = &local_58; outPosition = &itemWispOrbitPos; LAB_0062c09b: tmpVec = GetOrbitPosition(this,outPosition,tmpVec); (this->_pos).x = tmpVec->x; (this->_pos).y = tmpVec->y; break; case 0xee: this->_damageCountdown = 0x14; break; case 0xef: fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); (this->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); (this->_pos).y = fVar8; if (game->_enterDoor < 0) { tmpVec = MusicManager::RandomVector(randomDirection); } else { uVar6 = game->_enterDoor + 2U & 0x80000003; if (GHIDRA_INT(uVar6) < 0) { uVar6 = (uVar6 - 1 | 0xfffffffc) + 1; } tmpVec = Isaac::GetAxisAlignedUnitVectorFromDir(&enterDirection,uVar6); } fVar8 = tmpVec->x; (this->_pos).y = tmpVec->y * 15.0 + (this->_pos).y; (this->_pos).x = fVar8 * 15.0 + (this->_pos).x; switchD_0062bba7_caseD_11: (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; break; case 0xf0: iVar5 = __RTDynamicCast(this->_extraData,0, &IsaacRepentancePlus::Entity_Familiar::ExtraData::RTTI_Type_Descriptor, &IsaacRepentancePlus::UmbilicalBabyData::RTTI_Type_Descriptor,0); if (iVar5 != 0) { uVar6 = *GHIDRA_CAST((iVar5 + 0x14)); uVar4 = 0; if (uVar6 != 0) { do { local_50.x = (float)((double)GHIDRA_INT((uVar6 - 1)) + __uint_to_double_fixup[-(GHIDRA_INT((uVar6 - 1)) >> 0x1f)]); if (local_50.x == 0.0) { KAGE_LogMessage(0x10,GHIDRA_CAST("Start and End parameters cannot be the same!")); } playerPosY = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); fVar8 = ((float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) - 0.0 ) / (local_50.x - 0.0); if (fVar8 <= 0.0) { fVar8 = 0.0; } if (1.0 <= fVar8) { fVar8 = 1.0; } segmentPos = *(undefined4 **) (*GHIDRA_CAST((iVar5 + 8)) + (*GHIDRA_CAST((iVar5 + 0x10)) + uVar4 & *GHIDRA_CAST((iVar5 + 0xc)) - 1U) * 4); *segmentPos = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); segmentPos[1] = playerPosY; segmentPos[2] = -15.0 - fVar8 * 5.0; uVar6 = *GHIDRA_CAST((iVar5 + 0x10)) + uVar4; uVar4 = uVar4 + 1; segment = *GHIDRA_CAST((*GHIDRA_CAST((iVar5 + 8)) + (uVar6 & *GHIDRA_CAST((iVar5 + 0xc)) - 1U) * 4)); *GHIDRA_CAST((segment + 0xc)) = (undefined4)DAT_00c79c58; *GHIDRA_CAST((segment + 0x10)) = (*GHIDRA_CAST((GHIDRA_CAST(&(DAT_00c79c58)) + 0x4))); *GHIDRA_CAST((segment + 0x14)) = DAT_00c79c60; uVar6 = *GHIDRA_CAST((iVar5 + 0x14)); } while (uVar4 < uVar6); } } break; case 0xf1: uVar6 = 0; pvVar3 = g_game->_room; if (*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x1254)) != 0) { do { child = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x124c)) + uVar6 * 4)); if ((*GHIDRA_CAST((GHIDRA_CAST(child) + 0x28)) == 0x322) && (*GHIDRA_CAST((GHIDRA_CAST(child) + 0x3bc)) == this)) { if (child == this->_linkedEntity) { *GHIDRA_CAST((GHIDRA_CAST(child) + 0x33c)) = (this->_pos).x; fVar8 = (this->_pos).y; } else { uVar4 = Random(); local_50.x = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283064e-10 * 3.14; local_50.x = local_50.x + local_50.x; fVar8 = cos(local_50.x); local_58.x = (this->_pos).y; *GHIDRA_CAST((GHIDRA_CAST(child) + 0x33c)) = fVar8 + (this->_pos).x; fVar8 = sin(local_50.x); fVar8 = fVar8 + local_58.x; } *GHIDRA_CAST((GHIDRA_CAST(child) + 0x340)) = fVar8; iVar5 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x124c)) + uVar6 * 4)); *GHIDRA_CAST((iVar5 + 0x360)) = g_vectorZero.x; *GHIDRA_CAST((iVar5 + 0x364)) = g_vectorZero.y; iVar5 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x124c)) + uVar6 * 4)); if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (*GHIDRA_CAST((iVar5 + 0x28)) == 1)) || (*GHIDRA_CAST((iVar5 + 0x28)) - 10U < 0x3de)) { *GHIDRA_CAST((iVar5 + 0xb64)) = 0x10; (**(code **)(**GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x124c)) + uVar6 * 4)) + 0xc))(); } } uVar6 = uVar6 + 1; } while (uVar6 < *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x1254))); } break; case 0xf2: (this->_targetPosition).x = g_vectorZero.x; (this->_targetPosition).y = g_vectorZero.y; this->_coins = 0; this->_keys = 0; pvVar3 = game->_room; if (((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 8)) == 5) && ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 4)) + 0x44)) & 1) == 0)) && (uVar6 = 0, *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x1264)) != 0)) { do { isTargetable = (**(code **)(**GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x125c)) + uVar6 * 4)) + 0x4c)) (); if (((isTargetable != '\0') && (iVar5 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x125c)) + uVar6 * 4)), (*GHIDRA_CAST((iVar5 + 0x168)) & 0x20000000) == 0 && (*GHIDRA_CAST((iVar5 + 0x16c)) & 0x20) == 0)) && (*GHIDRA_CAST((iVar5 + 0x3bc)) == 0)) { iVar5 = *GHIDRA_CAST((iVar5 + 0x28)); if (iVar5 < 0x197) { if (iVar5 != 0x196) { switch(iVar5) { case 0x2d: case 0x4e: case 0x54: case 0x66: case 0x111: case 0x112: case 0x113: break; default: switchD_0062c43c_caseD_2e: this->_coins = iVar5; this->_keys = *GHIDRA_CAST((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x125c)) + uVar6 * 4)) + 0x2c)); goto switchD_0062bba7_caseD_4; } } } else if (iVar5 < 0x391) { if (((iVar5 != 0x390) && (iVar5 != 0x197)) && (iVar5 != 0x19c)) { bVar7 = iVar5 == 0x362; LAB_0062c46e: if (!bVar7) goto switchD_0062c43c_caseD_2e; } } else if (iVar5 != 0x3b6) { bVar7 = iVar5 == 0x3b7; goto LAB_0062c46e; } } uVar6 = uVar6 + 1; } while (uVar6 < *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x1264))); } } switchD_0062bba7_caseD_4: if (((this->_isNotCountedAsFollower != 0) && (g_game->_isStartingFromState == 0)) && (this->_isHourglassRewound == 0)) { this->Remove(); } this->_isHourglassRewound = 0; return; } // 0062c8d0 void Entity_Familiar::farting_baby_fart() { code *pcVar1; byte bVar2; uint uVar3; byte *curAnimChar; Entity *pEVar4; uint uVar5; byte *cmpAnimChar; void *room; uint uVar6; bool bVar7; uint local_4c; Entity *local_48; Vector local_44; int *enemy; ColorMod local_38; uint local_c; byte *animData; int entityType; Manager *manager; local_c = __security_cookie ^ GHIDRA_UINT(&local_4c); if (this->_variant != 0x70) { if (this->_variant == 0x7d) { uVar6 = this->_state; uVar5 = (this->_dropRNG)._seed; do { if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); uVar5 = (this->_dropRNG)._seed; if (uVar5 == 0) { pcVar1 = (code *)swi(3); (*pcVar1)(); return; } } uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ uVar5; uVar5 = uVar5 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5; (this->_dropRNG)._seed = uVar5; this->_state = uVar5 % 5; } while (uVar5 % 5 == uVar6); FUN_0063b240(); uVar6 = Random(); local_44.x = (this->_velocity).x + (this->_pos).x; local_44.y = (this->_pos).y + (this->_velocity).y; pEVar4 = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,0xf,&local_44,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar6,0); pEVar4->Update(); manager = g_manager; local_4c = 0x84; seed_fart_sound_override(GHIDRA_CAST(&local_4c)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(local_4c,1.0,2,0,1.0,0.0); } return; } uVar6 = 0; room = g_game->_room; local_44.x = (float)room; if (*GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264)) != 0) { do { pEVar4 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + 0x125c)) + uVar6 * 4)); if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (pEVar4->_type != 1)) { entityType = pEVar4->_type; if ((entityType - 10U < 0x3de) && (((entityType != 0x21 && (entityType != 0x11)) && (entityType != 0x124)))) { if (entityType == 0x375) { bVar7 = pEVar4->_variant == 10; } else { if ((entityType == 0x3c0) || (entityType == 0x3c5)) goto LAB_0062cb69; bVar7 = entityType == 0xf5; } if (!bVar7) goto LAB_0062c990; } } else { LAB_0062c990: if ((pEVar4->_dead == 0) && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsDescendantOf(pEVar4), bVar2 == 0)) { local_38._colorize[0] = (this->_pos).x; local_38._colorize[1] = (this->_pos).y; enemy = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + 0x125c)) + uVar6 * 4)); local_38._colorize[2] = (this->_velocity).x; local_48 = *GHIDRA_CAST((*enemy + 0x20)); local_38._colorize[3] = (this->_velocity).y; local_38._tint[0] = (float)this->_type; local_38._tint[1] = (float)this->_variant; local_38._tint[2] = (float)this->_spawnerType; local_38._tint[3] = (float)this->_spawnerVariant; local_4c = GHIDRA_UINT(((this->_flags & 0x100) != 0)); if ((this->_flags & 0x20000000) == 0) { uVar5 = 0; } else { uVar5 = 2; } if ((this->_flags & 0x40000000000000) == 0) { uVar3 = 0; } else { uVar3 = 4; } local_38._offset[0] = (float)(uVar3 | uVar5 | local_4c); local_38._offset[1] = (float)this; (*(code *)local_48)(0x41200000,0,0,&local_38,0x1e); local_38._colorize[0] = (this->_pos).x; local_38._colorize[1] = (this->_pos).y; local_48 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + 0x125c)) + uVar6 * 4)); local_38._tint[0] = (float)this->_type; local_38._tint[1] = (float)this->_variant; local_38._tint[2] = (float)this->_spawnerType; local_38._tint[3] = (float)this->_spawnerVariant; local_38._colorize[2] = (this->_velocity).x; local_38._colorize[3] = (this->_velocity).y; if ((this->_flags & 0x20000000) == 0) { uVar5 = 0; } else { uVar5 = 2; } if ((this->_flags & 0x40000000000000) == 0) { uVar3 = 0; } else { uVar3 = 4; } local_38._offset[0] = (float)(uVar3 | uVar5 | GHIDRA_UINT(((this->_flags & 0x100) != 0))); local_38._offset[1] = (float)this; (GHIDRA_CAST((local_48)))->Entity::AddPoison(GHIDRA_CAST(&local_38),0x96,0.0,0); room = (void *)local_44.x; } } LAB_0062cb69: uVar6 = uVar6 + 1; } while (uVar6 < *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264))); } animData = (this->_sprite)._animState._animData; if (animData != GHIDRA_CAST(0x0)) { curAnimChar = animData; if (0xf < *GHIDRA_CAST((animData + 0x14))) { curAnimChar = *GHIDRA_CAST(animData); } cmpAnimChar = s_Spawn; do { bVar2 = *curAnimChar; bVar7 = bVar2 < *cmpAnimChar; if (bVar2 != *cmpAnimChar) { LAB_0062cbb0: uVar6 = -GHIDRA_UINT(bVar7) | 1; goto LAB_0062cbb5; } if (bVar2 == 0) break; bVar2 = curAnimChar[1]; bVar7 = bVar2 < cmpAnimChar[1]; if (bVar2 != cmpAnimChar[1]) goto LAB_0062cbb0; curAnimChar = curAnimChar + 2; cmpAnimChar = cmpAnimChar + 2; } while (bVar2 != 0); uVar6 = 0; LAB_0062cbb5: if ((uVar6 == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_0062cbe8; } bVar2 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(s_Spawn,1); if (bVar2 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } LAB_0062cbe8: local_38._tint[0] = 1.0; local_38._tint[1] = 1.0; local_38._tint[2] = 1.0; local_38._tint[3] = 1.0; local_38._offset[0] = 0.0; local_38._offset[1] = 0.0; local_38._offset[2] = 0.0; local_38._colorize[0] = 0.0; local_38._colorize[1] = 1.0; local_38._colorize[2] = 0.0; local_38._colorize[3] = 1.0; (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1618)))))->Game::start_poop_cloud_screen_effect(&local_38); local_38._tint[0] = 1.0; local_38._tint[1] = 1.0; local_38._tint[2] = 1.0; local_38._tint[3] = 0.5; local_38._offset[0] = 0.0; local_38._colorize[0] = 0.6; local_38._colorize[1] = 1.0; local_38._colorize[2] = 0.3; local_38._colorize[3] = 1.0; local_38._offset[1] = 0.0; local_38._offset[2] = 0.0; (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::MakeGroundPoof(&this->_pos,&local_38,1.0); return; } // 0062d290 void Entity_Familiar::mongo_baby_pick_next_mimic() { byte isOwned; int iVar1; int tries; int mimicIndex; if (this->_variant == 0x4a) { mimicIndex = this->_subtype; tries = 0; this->_subtype = 0; while( true ) { iVar1 = GHIDRA_INT(((ulonglong)((longlong)(mimicIndex + 1) * -0x2aaaaaab) >> 0x20)); mimicIndex = mimicIndex + 1 + ((iVar1 >> 1) - (iVar1 >> 0x1f)) * 0xc; isOwned = Entity_Player::HasCollectible (this->_player,*GHIDRA_CAST((&DAT_00b648b0 + mimicIndex * 4)),0); if (isOwned != 0) break; tries = tries + 1; if (0xb < tries) { return; } } this->_subtype = mimicIndex; } return; } // 0062d7e0 void Entity_Familiar::RemoveFromFollowers() { EntityPtr EVar1; EntityPtr EVar2; EntityPtr EVar3; EntityPtr local_14; EntityPtr local_10; EntityPtr local_c; EntityPtr leadBaby; EntityPtr *childRef; EntityPtr *parentRef; if (this->_variant == 0xeb) { EVar2 = this->_parent; parentRef = &this->_parent; if (EVar2 != (EntityPtr)0x0) { if (this->_subtype == 0) { EVar2 = this->_child; leadBaby = (EntityPtr)this; if ((EVar2 == (EntityPtr)0x0) || (*GHIDRA_CAST((GHIDRA_CAST(EVar2) + 0x28)) != 3)) { EVar2 = (EntityPtr)0x0; } } else { leadBaby = (EntityPtr)0x0; if (*GHIDRA_CAST((GHIDRA_CAST(EVar2) + 0x28)) == 3) { leadBaby = EVar2; } EVar2 = (EntityPtr)this; } if ((leadBaby == (EntityPtr)0x0) || (EVar2 == (EntityPtr)0x0)) { KAGE_LogMessage(4,GHIDRA_CAST("Attempting to remove unpaired twisted baby!\n")); EVar2 = *parentRef; if ((EVar2 != (EntityPtr)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(EVar2) + 0x28)) == 3)) { local_10 = this->_child; EVar2 = (EntityPtr)(GHIDRA_INT(EVar2) + 0x3c0); if (*GHIDRA_CAST(EVar2) != 0) { local_14 = EVar2; std::multiset::erase(&local_14); } *GHIDRA_CAST(EVar2) = local_10; if (local_10 != (EntityPtr)0x0) { std::multiset::insert(EVar2); } } EVar2 = this->_child; if (EVar2 != (EntityPtr)0x0) { EVar1 = (EntityPtr)(GHIDRA_INT(EVar2) + 0x3bc); local_10 = *parentRef; if (*GHIDRA_CAST((GHIDRA_CAST(EVar2) + 0x3bc)) != 0) { local_14 = EVar1; std::multiset::erase(&local_14); } *GHIDRA_CAST(EVar1) = local_10; if (local_10 != (EntityPtr)0x0) { std::multiset::insert(EVar1); } } if (*parentRef != (EntityPtr)0x0) { local_14 = (EntityPtr)parentRef; std::multiset::erase(&local_14); } *parentRef = (EntityPtr)0x0; } else { EVar1 = (EntityPtr)(GHIDRA_INT(leadBaby) + 0x3bc); EVar3 = *GHIDRA_CAST(EVar1); if ((EVar3 != (EntityPtr)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(EVar3) + 0x28)) == 3)) { local_10 = *GHIDRA_CAST((GHIDRA_CAST(EVar2) + 0x3c0)); EVar3 = (EntityPtr)(GHIDRA_INT(EVar3) + 0x3c0); if (*GHIDRA_CAST(EVar3) != 0) { local_c = EVar3; std::multiset::erase(&local_c); } *GHIDRA_CAST(EVar3) = local_10; if (local_10 != (EntityPtr)0x0) { std::multiset::insert(EVar3); } } EVar3 = *GHIDRA_CAST((GHIDRA_CAST(EVar2) + 0x3c0)); if (EVar3 != (EntityPtr)0x0) { local_c = (EntityPtr)(GHIDRA_INT(EVar3) + 0x3bc); local_14 = *GHIDRA_CAST(EVar1); if (*GHIDRA_CAST((GHIDRA_CAST(EVar3) + 0x3bc)) != 0) { local_10 = local_c; std::multiset::erase(&local_10); } *GHIDRA_CAST(local_c) = local_14; if (local_14 != (EntityPtr)0x0) { std::multiset::insert(local_c); } } if (*GHIDRA_CAST(EVar1) != (EntityPtr)0x0) { local_14 = EVar1; std::multiset::erase(&local_14); } *GHIDRA_CAST(EVar1) = (EntityPtr)0x0; EVar1 = (EntityPtr)(GHIDRA_INT(leadBaby) + 0x3c0); if (*GHIDRA_CAST(EVar1) != (EntityPtr)0x0) { local_14 = EVar1; std::multiset::erase(&local_14); } EVar3 = (EntityPtr)(GHIDRA_INT(EVar2) + 0x3bc); *GHIDRA_CAST(EVar1) = (EntityPtr)0x0; if (*GHIDRA_CAST(EVar3) != (EntityPtr)0x0) { local_14 = EVar3; std::multiset::erase(&local_14); } *GHIDRA_CAST(EVar3) = (EntityPtr)0x0; this = GHIDRA_CAST(EVar2); } EVar2 = (EntityPtr)(GHIDRA_INT(this) + 0x3c0); if (*GHIDRA_CAST(EVar2) != (EntityPtr)0x0) { local_14 = EVar2; std::multiset::erase(&local_14); } *GHIDRA_CAST(EVar2) = (EntityPtr)0x0; return; } } if (this->_isFollower != 0) { EVar2 = this->_parent; parentRef = &this->_parent; if (EVar2 != (EntityPtr)0x0) { EVar1 = (EntityPtr)(GHIDRA_INT(EVar2) + 0x3c0); local_10 = this->_child; if (*GHIDRA_CAST((GHIDRA_CAST(EVar2) + 0x3c0)) != 0) { local_14 = EVar1; std::multiset::erase(&local_14); } *GHIDRA_CAST(EVar1) = local_10; if (local_10 != (EntityPtr)0x0) { std::multiset::insert(EVar1); } } EVar2 = this->_child; childRef = &this->_child; if (EVar2 != (EntityPtr)0x0) { local_10 = (EntityPtr)(GHIDRA_INT(EVar2) + 0x3bc); local_c = *parentRef; if (*GHIDRA_CAST((GHIDRA_CAST(EVar2) + 0x3bc)) != 0) { local_14 = local_10; std::multiset::erase(&local_14); } *GHIDRA_CAST(local_10) = local_c; if (local_c != (EntityPtr)0x0) { std::multiset::insert(local_10); } } if (*parentRef != (EntityPtr)0x0) { local_14 = (EntityPtr)parentRef; std::multiset::erase(&local_14); } *parentRef = (EntityPtr)0x0; if (*childRef != (EntityPtr)0x0) { local_14 = (EntityPtr)childRef; std::multiset::erase(&local_14); } *childRef = (EntityPtr)0x0; } this->_isFollower = 0; return; } // 0062db20 void Entity_Familiar::AddToFollowers() { EntityPtr *pEVar1; byte bVar2; EntityConfig_Entity *entityConfig; byte *curAnimChar; int otherPriority; uint uVar3; std_string *expectedName; int iVar4; EntityPtr childField; EntityPtr EVar5; std_string *anim; bool isLess; EntityList_EL familiars; EntityPtr local_18; EntityPtr local_14; void *local_10; undefined1 *puStack_c; undefined4 local_8; byte *animData; EntityPtr chainEntity; Manager *manager; local_8 = 0xffffffff; puStack_c = &LAB_00af6d75; local_10 = ExceptionList; if (this->_isSubtype55555 != 0) { return; } if (this->_variant != 0xeb) { ExceptionList = &local_10; if ((this->_isFollower != 0) && (chainEntity = this->_parent, chainEntity != (EntityPtr)0x0)) { if (*GHIDRA_CAST((GHIDRA_CAST(chainEntity) + 0x28)) == 3) { iVar4 = __RTDynamicCast(chainEntity,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Familiar::RTTI_Type_Descriptor,0, __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U); if (((iVar4 != 0) && (*GHIDRA_CAST((iVar4 + 0xd74)) != '\0')) && (this->_player == *(void **)(iVar4 + 0x410))) { KAGE_LogMessage(1,GHIDRA_CAST("[warn] Tried to add familiar %d to followers again!\n")); ExceptionList = local_10; return; } } else if ((*GHIDRA_CAST((GHIDRA_CAST(chainEntity) + 0x28)) == 1) && (chainEntity == (EntityPtr)this->_player) ) { KAGE_LogMessage(1,GHIDRA_CAST("[warn] Tried to add familiar %d to followers again!\n")); ExceptionList = local_10; return; } } this->_isFollower = 1; iVar4 = GetFollowerPriority(this); EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&familiars,3,-1,-1,0,0); local_8 = 2; uVar3 = 0; if (familiars._size != 0) { LAB_0062de40: chainEntity = *GHIDRA_CAST((GHIDRA_CAST(familiars._data) + uVar3 * 4)); if (((chainEntity == (EntityPtr)0x0) || ((GHIDRA_CAST(chainEntity))->_type != 3)) || ((chainEntity == (EntityPtr)this || (((GHIDRA_CAST(chainEntity))->_isFollower == 0 || ((GHIDRA_CAST(chainEntity))->_player != this->_player)))))) goto LAB_0062de6b; for (EVar5 = (GHIDRA_CAST(chainEntity))->_parent; (EVar5 != (EntityPtr)0x0 && (*GHIDRA_CAST((GHIDRA_CAST(EVar5) + 0x28)) == 3)); EVar5 = *GHIDRA_CAST((GHIDRA_CAST(EVar5) + 0x3bc))) { chainEntity = EVar5; } otherPriority = GetFollowerPriority(GHIDRA_CAST(chainEntity)); do { if (otherPriority < iVar4) { pEVar1 = &this->_child; if (this->_child != (EntityPtr)0x0) { local_14 = (EntityPtr)pEVar1; std::multiset::erase(&local_14); } *pEVar1 = chainEntity; if (chainEntity != (EntityPtr)0x0) { std::multiset::insert(pEVar1); } pEVar1 = &this->_parent; local_18 = *GHIDRA_CAST((GHIDRA_CAST(chainEntity) + 0x3bc)); EVar5 = (EntityPtr)(GHIDRA_INT(chainEntity) + 0x3bc); if (this->_parent != (EntityPtr)0x0) { local_14 = (EntityPtr)pEVar1; std::multiset::erase(&local_14); } *pEVar1 = local_18; if (local_18 != (EntityPtr)0x0) { std::multiset::insert(pEVar1); chainEntity = *pEVar1; if ((chainEntity != (EntityPtr)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(chainEntity) + 0x28)) == 3)) { childField = (EntityPtr)(GHIDRA_INT(chainEntity) + 0x3c0); if (*GHIDRA_CAST((GHIDRA_CAST(chainEntity) + 0x3c0)) != 0) { local_18 = childField; std::multiset::erase(&local_18); } *GHIDRA_CAST(childField) = this; std::multiset::insert(childField); } } if (*GHIDRA_CAST(EVar5) != 0) { local_18 = EVar5; std::multiset::erase(&local_18); } *GHIDRA_CAST(EVar5) = this; LAB_0062df8a: std::multiset::insert(EVar5); break; } EVar5 = *GHIDRA_CAST((GHIDRA_CAST(chainEntity) + 0x3c0)); if (EVar5 == (EntityPtr)0x0) { LAB_0062dfde: *GHIDRA_CAST((GHIDRA_CAST(chainEntity) + 0x3c0)) = (EntityPtr)this; std::multiset::insert(GHIDRA_CAST((GHIDRA_INT(chainEntity) + 0x3c0))); EVar5 = (EntityPtr)&this->_parent; if (this->_parent != (EntityPtr)0x0) { local_14 = EVar5; std::multiset::erase(&local_14); } *GHIDRA_CAST(EVar5) = chainEntity; goto LAB_0062df8a; } if (*GHIDRA_CAST((GHIDRA_CAST(EVar5) + 0x28)) != 3) { local_14 = (EntityPtr)(GHIDRA_INT(chainEntity) + 0x3c0); std::multiset::erase(&local_14); goto LAB_0062dfde; } otherPriority = GetFollowerPriority(GHIDRA_CAST(EVar5)); chainEntity = EVar5; } while( true ); } LAB_0062df8f: if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x0))) != '\0') { ExceptionList = local_10; return; } local_8 = 3; goto LAB_0062dfa3; } pEVar1 = &this->_parent; if (this->_parent != (EntityPtr)0x0) { return; } ExceptionList = &local_10; *pEVar1 = (EntityPtr)this->_player; if ((EntityPtr)this->_player != (EntityPtr)0x0) { std::multiset::insert(pEVar1); } EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&familiars,3,0xeb,-1,0,0); local_8 = 0; uVar3 = 0; if (familiars._size != 0) { LAB_0062dbc5: chainEntity = *GHIDRA_CAST((GHIDRA_CAST(familiars._data) + uVar3 * 4)); if ((((chainEntity == (EntityPtr)0x0) || (*GHIDRA_CAST((GHIDRA_CAST(chainEntity) + 0x28)) != 3)) || (chainEntity == (EntityPtr)this)) || ((*GHIDRA_CAST((GHIDRA_CAST(chainEntity) + 0x172)) == 0 || (*(void **)(GHIDRA_CAST(chainEntity) + 0x410) != this->_player)))) goto LAB_0062dbf4; for (EVar5 = *GHIDRA_CAST((GHIDRA_CAST(chainEntity) + 0x3c0)); EVar5 != (EntityPtr)0x0; EVar5 = *GHIDRA_CAST((GHIDRA_CAST(EVar5) + 0x3c0))) { chainEntity = EVar5; } if (*GHIDRA_CAST((GHIDRA_CAST(chainEntity) + 0x3c0)) != 0) { local_14 = (EntityPtr)(GHIDRA_INT(chainEntity) + 0x3c0); std::multiset::erase(&local_14); } *GHIDRA_CAST((GHIDRA_CAST(chainEntity) + 0x3c0)) = this; std::multiset::insert(GHIDRA_CAST((GHIDRA_INT(chainEntity) + 0x3c0))); if (*pEVar1 != (EntityPtr)0x0) { local_14 = (EntityPtr)pEVar1; std::multiset::erase(&local_14); } *pEVar1 = chainEntity; std::multiset::insert(pEVar1); iVar4 = 1 - *GHIDRA_CAST((GHIDRA_CAST(chainEntity) + 0x30)); goto LAB_0062dbfb; } LAB_0062dbf9: iVar4 = 0; LAB_0062dbfb: manager = g_manager; if (iVar4 != this->_subtype) { this->_subtype = iVar4; entityConfig = (GHIDRA_CAST((&manager->_entityConfig)))->EntityConfig::GetEntity(this->_type,this->_variant,iVar4) ; this->_config = entityConfig; (GHIDRA_CAST((&this->_sprite)))->ANM2::Load(&entityConfig->anm2Path,1); anim = &(this->_sprite)._animDefaultName; if (0xf < (this->_sprite)._animDefaultName._capacity) { anim = *GHIDRA_CAST(anim->_buf); } animData = (this->_sprite)._animState._animData; if (animData != GHIDRA_CAST(0x0)) { curAnimChar = animData; if (0xf < *GHIDRA_CAST((animData + 0x14))) { curAnimChar = *GHIDRA_CAST(animData); } expectedName = anim; do { bVar2 = *curAnimChar; isLess = bVar2 < (byte)expectedName->_buf[0]; if (bVar2 != expectedName->_buf[0]) { LAB_0062dd02: uVar3 = -GHIDRA_UINT(isLess) | 1; goto LAB_0062dd07; } if (bVar2 == 0) break; bVar2 = curAnimChar[1]; isLess = bVar2 < (byte)expectedName->_buf[1]; if (bVar2 != expectedName->_buf[1]) goto LAB_0062dd02; curAnimChar = curAnimChar + 2; expectedName = GHIDRA_CAST((expectedName->_buf + 2)); } while (bVar2 != 0); uVar3 = 0; LAB_0062dd07: if ((uVar3 == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_0062dd2f; } bVar2 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST(anim),1); if (bVar2 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } } LAB_0062dd2f: if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x0))) != '\0') { ExceptionList = local_10; return; } local_8 = 1; LAB_0062dfa3: tracked_alloc(1,familiars._data,0); ExceptionList = local_10; return; LAB_0062de6b: uVar3 = uVar3 + 1; if (GHIDRA_UINT(familiars._size) <= uVar3) goto LAB_0062df8f; goto LAB_0062de40; LAB_0062dbf4: uVar3 = uVar3 + 1; if (GHIDRA_UINT(familiars._size) <= uVar3) goto LAB_0062dbf9; goto LAB_0062dbc5; } // 0062e020 void Entity_Familiar::set_player(Entity_Player *player) { short sVar1; char isDelayed; byte isFollower; bool isOrbiting; isFollower = this->_isFollower; if (((isFollower == 0) && (-1 < this->_orbitLayer)) && (this->_exists != 0)) { sVar1 = (ushort)this->_isDelayed << 8; isOrbiting = true; RecalculateOrbitOffset(this,this->_orbitLayer,0); LAB_0062e072: if (this->_variant != 0xeb) goto LAB_0062e088; } else { sVar1 = CONCAT11(this->_isDelayed,isFollower); isOrbiting = false; if (isFollower == 0) goto LAB_0062e072; isOrbiting = false; } RemoveFromFollowers(this); LAB_0062e088: isDelayed = (char)((ushort)sVar1 >> 8); if (isDelayed != '\0') { RemoveFromDelayed(this); } this->_player = player; if (isOrbiting) { RecalculateOrbitOffset(this,this->_orbitLayer,1); } if (((char)sVar1 != '\0') || (this->_variant == 0xeb)) { AddToFollowers(this); } if (isDelayed != '\0') { AddToDelayed(this); } return; } // 0062e120 void Entity_Familiar::ai_samsons_chains() { float fVar1; float fVar2; qword qVar3; float *pfVar4; int iVar5; float *pfVar6; int iVar7; qword *allocCounter; uint uVar8; float fVar9; float fVar10; EntityList_EL chainList; float local_40; float local_3c; float local_38; float local_34; float local_30; float local_2c; float toPlayerY; float toPlayerX; undefined1 *puStack_20; void *local_1c; undefined1 *puStack_18; undefined4 uStack_14; Game *game; Entity_Familiar *otherChain; Room *room; puStack_20 = GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -4)); uStack_14 = 0xffffffff; puStack_18 = &LAB_00af3a60; local_1c = ExceptionList; ExceptionList = &local_1c; toPlayerX = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) - (this->_pos).x; toPlayerY = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) - (this->_pos).y; local_3c = toPlayerX * toPlayerX + toPlayerY * toPlayerY; local_40 = sqrtf(local_3c); game = g_game; if (0.01 < local_40) { if (*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 8)) == 0x10) { fVar9 = toPlayerX; if (0.0 < local_40) { fVar9 = (1.0 / local_40) * toPlayerX; } local_30 = (local_40 - 70.0) * 0.1; local_2c = 0.0; local_34 = (local_40 - 100.0) * 1.6; local_38 = 0.0; pfVar6 = &local_30; if (local_30 <= 0.0) { pfVar6 = &local_2c; } pfVar4 = &local_34; if (local_34 <= 0.0) { pfVar4 = &local_38; } (this->_velocity).x = fVar9 * (*pfVar6 + *pfVar4) + (this->_velocity).x; } else { fVar9 = toPlayerY; fVar10 = toPlayerX; if (0.0 < local_40) { fVar9 = (1.0 / local_40) * toPlayerY; fVar10 = (1.0 / local_40) * toPlayerX; } local_38 = (local_40 - 70.0) * 0.1; local_34 = 0.0; local_30 = (local_40 - 100.0) * 1.6; local_2c = 0.0; pfVar6 = &local_38; if (local_38 <= 0.0) { pfVar6 = &local_34; } fVar1 = *pfVar6; pfVar6 = &local_30; if (local_30 <= 0.0) { pfVar6 = &local_2c; } fVar2 = *pfVar6; (this->_velocity).x = fVar10 * (fVar1 + fVar2) + (this->_velocity).x; (this->_velocity).y = fVar9 * (fVar1 + fVar2) + (this->_velocity).y; } } iVar5 = this->_variant; (this->_velocity).x = (this->_velocity).x * 0.8836; (this->_velocity).y = (this->_velocity).y * 0.8836; EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(game->_room) + 0x1218)),&chainList,3,iVar5,-1,0,0); uVar8 = 0; if (chainList._size != 0) { do { otherChain = *GHIDRA_CAST((GHIDRA_CAST(chainList._data) + uVar8 * 4)); if (otherChain != this) { local_2c = (this->_pos).x - (otherChain->_pos).x; local_30 = (this->_pos).y - (otherChain->_pos).y; local_38 = 0.0; fVar9 = sqrtf(local_2c * local_2c + local_30 * local_30); local_34 = 20.0 - fVar9; pfVar6 = &local_38; if (0.0 <= 20.0 - fVar9) { pfVar6 = &local_34; } if (fVar9 <= 0.0) { fVar10 = local_30; fVar9 = local_2c; } else { fVar9 = (*pfVar6 * 0.1) / fVar9; fVar10 = local_30 * fVar9; fVar9 = local_2c * fVar9; } (this->_velocity).x = fVar9 + (this->_velocity).x; (this->_velocity).y = fVar10 + (this->_velocity).y; } uVar8 = uVar8 + 1; } while (uVar8 < GHIDRA_UINT(chainList._size)); } if (14400.0 < local_3c) { if (local_40 <= 0.0) { fVar9 = toPlayerX; local_3c = toPlayerY; } else { fVar9 = toPlayerX * (120.0 / local_40); local_3c = toPlayerY * (120.0 / local_40); } local_40 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) - fVar9; local_3c = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) - local_3c; room = g_game->_room; iVar7 = GHIDRA_INT(((local_40 - 40.0) / 40.0 + 0.5)); iVar5 = GHIDRA_INT(((local_3c - 120.0) / 40.0 + 0.5)); if ((((iVar7 < 0) || (room->_gridWidth <= iVar7)) || (iVar5 < 0)) || (room->_gridHeight <= iVar5)) { iVar7 = -1; } else { iVar7 = iVar5 * room->_gridWidth + iVar7; } uVar8 = (GHIDRA_CAST((room)))->Room::GetGridCollision(iVar7); if (uVar8 == 0) { (this->_pos).x = local_40; (this->_pos).y = local_3c; (this->_velocity).x = g_vectorZero.x; fVar9 = g_vectorZero.y; } else { fVar9 = (this->_velocity).x; local_38 = (this->_velocity).y; local_40 = 5.0; local_3c = sqrtf(fVar9 * fVar9 + local_38 * local_38); pfVar6 = &local_40; if (local_3c <= 5.0) { pfVar6 = &local_3c; } fVar9 = *pfVar6; if (local_3c <= 0.0) goto LAB_0062e5c3; (this->_velocity).x = (fVar9 / local_3c) * (this->_velocity).x; fVar9 = local_38 * (fVar9 / local_3c); } (this->_velocity).y = fVar9; } LAB_0062e5c3: if ((*GHIDRA_CAST((GHIDRA_CAST(&(chainList)) + 0x0))) == '\0') { if (g_mainHeap == (void *)0x0) { allocCounter = &g_allocatedBytesNoHeap; } else { allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); } if (chainList._data != (void *)0x0) { uVar8 = *GHIDRA_CAST((GHIDRA_CAST(chainList._data) + -4)); qVar3 = *allocCounter; *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar8; *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar3) < uVar8)); free(GHIDRA_CAST((GHIDRA_INT(chainList._data) + -4))); } } ExceptionList = local_1c; return; } // 0062e620 void Entity_Familiar::update_weapon(byte isInterpolated) { void *pvVar1; byte isLullaby; Weapon *newWeapon; uint rngResult; int weaponTarget; float shootDirection; undefined3 in_stack_00000005; float local_28; Vector local_24; undefined1 isShooting [4]; Vector aimDirection; Vector markedAim; int *oldWeapon; int playerWeapon; if (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x173)) != '\0') { return; } playerWeapon = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13e0)); if (isInterpolated == 0) { oldWeapon = this->_weapon; if (playerWeapon == 0) { if (oldWeapon != GHIDRA_CAST(0x0)) { Isaac::DestoryWeapon(&this->_weapon); } } else { if (oldWeapon != GHIDRA_CAST(0x0)) { if (oldWeapon[0xc] == *GHIDRA_CAST((playerWeapon + 0x30))) goto LAB_0062e6b0; (**(code **)(*oldWeapon + 0x14))(); if (this->_weapon != GHIDRA_CAST(0x0)) { (*(code *)**GHIDRA_CAST(this->_weapon))(1); } this->_weapon = (void *)0x0; } newWeapon = Isaac::CreateWeapon(*GHIDRA_CAST((playerWeapon + 0x30)),GHIDRA_CAST(this)); this->_weapon = newWeapon; } } LAB_0062e6b0: pvVar1 = this->_player; if ((((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1398)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x139a)) == '\0')) && (*GHIDRA_CAST(&g_game->_stageTransition) == 0)) && ((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x410)) != '\0' && (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x414)) < 1)))) { aimDirection.x = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1630)); local_28 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x162c)); aimDirection.y = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1634)); isShooting[0] = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x162c)) != -1; markedAim.y = 0.0; markedAim.x = 0.0; if ((playerWeapon != 0) && (this->_weapon != (void *)0x0)) { TryAimAtMarkedTarget(this,&aimDirection,GHIDRA_CAST(&local_28),&markedAim); } shootDirection = local_28; if (this->_variant == 0x4c) { rngResult = Random(); local_28 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 3.14; local_28 = local_28 + local_28; local_24.x = cos(local_28); aimDirection.y = sin(local_28); aimDirection.x = local_24.x; if (ABS(local_24.x) <= ABS(aimDirection.y)) { shootDirection = (float)(GHIDRA_UINT((0.0 <= aimDirection.y)) * 2 + 1); local_24.x = shootDirection; } else { shootDirection = 2.8026e-45; if (local_24.x < 0.0) { shootDirection = 0.0; } } } if (this->_counter < 1) { if ((shootDirection == -NAN) && ((this->_headFrameDelay < 1 || (shootDirection = (float)this->_shootDirection, shootDirection == -NAN)))) { shootDirection = 4.2039e-45; } if ((this->_weapon != GHIDRA_CAST(0x0)) && (weaponTarget = (**(code **)(*GHIDRA_CAST(this->_weapon) + 0x24))(), weaponTarget != 0)) { local_24.x = *GHIDRA_CAST((weaponTarget + 0x33c)) - (this->_pos).x; local_24.y = *GHIDRA_CAST((weaponTarget + 0x340)) - (this->_pos).y; shootDirection = (float)vector_to_direction(&local_24); } this->_shootDirection = GHIDRA_INT(shootDirection); } if ((playerWeapon != 0) && (pvVar1 = this->_weapon, pvVar1 != (void *)0x0)) { *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x28)) = markedAim.x; *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x2c)) = markedAim.y; isLullaby = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x8d,0); if (isLullaby == 0) { *GHIDRA_CAST((GHIDRA_CAST(this->_weapon) + 0x10)) = *GHIDRA_CAST((playerWeapon + 0x10)); } else { *GHIDRA_CAST((GHIDRA_CAST(this->_weapon) + 0x10)) = *GHIDRA_CAST((playerWeapon + 0x10)) * 0.5; } *GHIDRA_CAST((GHIDRA_CAST(this->_weapon) + 0x34)) = *GHIDRA_CAST((playerWeapon + 0x34)) | 0x40000000; (**(code **)(*GHIDRA_CAST(this->_weapon) + 8))(_isInterpolated); (**(code **)(*GHIDRA_CAST(this->_weapon) + 0xc))(isShooting,local_24.y,_isInterpolated); } if (isInterpolated == 0) { if (this->_fireCooldown == 0) { if (this->_headFrameDelay < 9) { PlayFloatAnim(this,this->_shootDirection); } else { PlayShootAnim(this,this->_shootDirection); } } if (0 < this->_counter) { this->_counter = this->_counter + -1; } if (0 < this->_headFrameDelay) { this->_headFrameDelay = this->_headFrameDelay + -1; } if (0 < this->_fireCooldown) { this->_fireCooldown = this->_fireCooldown + -1; } isLullaby = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x8d,0); if ((isLullaby != 0) && (0 < this->_fireCooldown)) { this->_fireCooldown = this->_fireCooldown + -1; } } } return; } // 0062ee30 void Entity_Familiar::ai_lil_gurdy() { Vector *coneDir; void *pvVar1; byte bVar2; uint uVar3; Vector *targetDir; undefined1 *puVar4; int chargeFrames; int iVar5; float fVar6; float fVar7; float fVar8; float fVar9; float fVar10; float fVar11; char *anim; EntityRef *source; float local_44; Vector local_40; Vector local_38; EntityRef damageSource; Manager *manager; EntityPtr target; if (this->_state == 0) { pvVar1 = this->_player; this->_entityGridCollisionClass = 3; iVar5 = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x162c)); fVar6 = sqrtf(*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1630)) * *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1630)) + *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1634)) * *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1634))); if ((fVar6 < 0.5) && (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1638)) == '\0')) { iVar5 = -1; } Isaac::GetAxisAlignedUnitVectorFromDir(&local_38,this->_lastDirection); bVar2 = TryAimAtMarkedTarget(this,&local_38,&this->_lastDirection,GHIDRA_CAST(0x0)); if ((bVar2 != 0) && (0x59 < this->_fireCooldown)) { iVar5 = -1; } pvVar1 = this->_player; if ((((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x1398)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x139a)) == '\0')) && (*GHIDRA_CAST(&g_game->_stageTransition) == 0)) && ((*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x410)) != '\0' && (*GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x414)) < 1)))) { chargeFrames = this->_fireCooldown; if (iVar5 == -1) { if (chargeFrames < 1) { if (((this->_sprite)._animState._animData != (void *)0x0) && ((this->_sprite)._animState._isPlaying != 0)) goto LAB_0062f0b9; anim = GHIDRA_CAST(s_Idle); } else { this->_state = 1; iVar5 = 0x5a; if (chargeFrames < 0x5a) { iVar5 = chargeFrames; } this->_entityGridCollisionClass = 6; this->_fireCooldown = iVar5; fVar6 = ((float)iVar5 / 90.0) * 20.0 + 5.0; fVar7 = local_38.x * fVar6 + (this->_velocity).x; (this->_velocity).y = local_38.y * fVar6 + (this->_velocity).y; (this->_velocity).x = fVar7; fVar11 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x360)) * 0.6; fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x364)) * 0.6; fVar11 = fVar11 + fVar11; fVar8 = fVar8 + fVar8; fVar10 = local_38.y * fVar8 + local_38.x * fVar11; fVar6 = local_38.y * fVar10; fVar10 = local_38.x * fVar10; if (local_38.y * fVar6 + local_38.x * fVar10 < 0.0) { fVar8 = fVar8 - fVar6; fVar11 = fVar11 - fVar10; } anim = "Dashing"; (this->_velocity).y = fVar8 + (this->_velocity).y; (this->_velocity).x = fVar7 + fVar11; local_38.x = fVar6; } } else { if (chargeFrames == 0) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("ChargeStart"),0); chargeFrames = this->_fireCooldown; } this->_lastDirection = iVar5; this->_fireCooldown = chargeFrames + 1; if (((this->_sprite)._animState._animData != (void *)0x0) && ((this->_sprite)._animState._isPlaying != 0)) goto LAB_0062f0b9; anim = "Charging"; } (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST(anim),0); } LAB_0062f0b9: if (this->_state == 0) { local_44 = this->_friction * 0.8; this->_friction = local_44; fVar6 = (this->_pos).x; fVar10 = (this->_pos).y; fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); fVar11 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); fVar9 = fVar6 - fVar8; fVar7 = fVar10 - fVar11; if (2500.0 < fVar7 * fVar7 + fVar9 * fVar9) { local_38.x = (fVar8 - fVar6) * 0.05; local_40.x = (fVar11 - fVar10) * 0.05; fVar8 = sqrtf(local_40.x * local_40.x + local_38.x * local_38.x); fVar6 = local_40.x; fVar10 = local_38.x; if ((1.0 < fVar8) && (0.0 < fVar8)) { fVar6 = (1.0 / fVar8) * local_40.x; fVar10 = (1.0 / fVar8) * local_38.x; } if (local_44 != 0.0) { fVar8 = this->_speedMultiplier; (this->_velocity).y = (fVar8 * fVar6) / local_44 + (this->_velocity).y; (this->_velocity).x = (fVar8 * fVar10) / local_44 + (this->_velocity).x; } } } uVar3 = Random(); if (uVar3 % 3 != 0) goto LAB_0062f7c8; fVar6 = 10.0; } else { if (this->_state != 1) goto LAB_0062f7c8; if (this->_collidesWithGrid != 0) { local_38.x = (this->_gridCollisionVelocity).x + (this->_pos).x; local_40.x = (float)g_game->_room; local_44 = (this->_gridCollisionVelocity).y; local_38.y = local_44 + (this->_pos).y; local_38.x = (float)(GHIDRA_CAST((GHIDRA_CAST(local_40.x))))->Room::GetGridIndex(&local_38); if (GHIDRA_INT(local_38.x) < 0) { fVar6 = local_44; } else { damageSource._entity = this->_player; if (damageSource._entity == (void *)0x0) { damageSource._type = 0; damageSource._variant = 0; damageSource._spawnerType = 0; damageSource._spawnerVariant = 0; damageSource._position.x = g_vectorZero.x; damageSource._position.y = g_vectorZero.y; damageSource._velocity.x = g_vectorZero.x; damageSource._velocity.y = g_vectorZero.y; LAB_0062f341: damageSource._flags = 0; if (damageSource._entity != (void *)0x0) goto LAB_0062f347; damageSource._flags = 0; LAB_0062f363: local_44 = 0.0; if (damageSource._entity != (void *)0x0) goto LAB_0062f36f; LAB_0062f388: uVar3 = 0; } else { damageSource._type = *GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x28)); damageSource._variant = *GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x2c)); damageSource._spawnerType = *GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x34)); damageSource._spawnerVariant = *GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x38)); damageSource._position.x = *GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x33c)); damageSource._position.y = *GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x340)); damageSource._velocity.x = *GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x360)); damageSource._velocity.y = *GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x364)); if ((*GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x168)) & 0x100) == 0) goto LAB_0062f341; damageSource._flags = 1; LAB_0062f347: if ((*GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x168)) & 0x20000000) == 0) goto LAB_0062f363; local_44 = 2.8026e-45; LAB_0062f36f: if ((*GHIDRA_CAST((GHIDRA_CAST(damageSource._entity) + 0x16c)) & 0x400000) == 0) goto LAB_0062f388; uVar3 = 4; } fVar6 = (this->_gridCollisionVelocity).y; fVar10 = (this->_gridCollisionVelocity).x; damageSource._flags = uVar3 | GHIDRA_UINT(local_44) | damageSource._flags; source = &damageSource; fVar6 = sqrtf(fVar10 * fVar10 + fVar6 * fVar6); fVar6 = fVar6 / 10.0; if (fVar6 <= 1.0) { fVar6 = 1.0; } if (4.0 <= fVar6) { fVar6 = 4.0; } (GHIDRA_CAST((GHIDRA_CAST(local_40.x))))->Room::DamageGridWithSource(GHIDRA_INT(local_38.x),GHIDRA_INT(fVar6),source); fVar6 = (this->_gridCollisionVelocity).y; } fVar10 = (this->_gridCollisionVelocity).x; if (64.0 < fVar6 * fVar6 + fVar10 * fVar10) { (this->_hitList)._end = (this->_hitList)._begin; fVar6 = (this->_gridCollisionVelocity).y; } fVar10 = (this->_gridCollisionVelocity).x; local_44 = sqrtf(fVar10 * fVar10 + fVar6 * fVar6); local_40.x = (this->_velocity).x; coneDir = &this->_velocity; local_38.x = (this->_velocity).y; fVar6 = sqrtf(local_40.x * local_40.x + local_38.x * local_38.x); if (fVar6 <= 0.0) { fVar10 = local_40.x; fVar6 = local_38.x; } else { fVar10 = local_40.x * (1.0 / fVar6); fVar6 = local_38.x * (1.0 / fVar6); } coneDir->x = fVar10; (this->_velocity).y = fVar6; if ((0.0 < local_44) && (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::HasEntityFlags(0x100), bVar2 == 0)) { PickEnemyTarget(this,800.0,0,0xb,coneDir,15.0); target = this->_target; if (target != (EntityPtr)0x0) { local_38.x = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x33c)) - (this->_pos).x; local_38.y = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x340)) - (this->_pos).y; targetDir = (GHIDRA_CAST((&local_38)))->Vector::Normalized(&local_40); coneDir->x = targetDir->x; (this->_velocity).y = targetDir->y; } } fVar10 = local_44 * (this->_velocity).y; fVar6 = local_44 * coneDir->x; (this->_velocity).y = fVar10; coneDir->x = fVar6; manager = g_manager; fVar6 = -(fVar10 * (this->_gridCollisionNormal).y + fVar6 * (this->_gridCollisionNormal).x); if (fVar6 <= 20.0) { if (4.0 < fVar6) { fVar6 = (fVar6 - 4.0) * 0.125; if (fVar6 <= 0.0) { fVar6 = 0.0; } if (1.0 <= fVar6) { fVar6 = 1.0; } SoundEffects::PlayWithFartOverride(0x48,fVar6 * 0.5 + 0.5,2,0,1.0); } } else { local_38.x = 3.92364e-44; seed_fart_sound_override(GHIDRA_CAST(&local_38)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_38.x),0.8,2,0,1.0,0.0); } } local_40.x = (this->_velocity).x; fVar6 = (this->_velocity).y; local_38.x = sqrtf(local_40.x * local_40.x + fVar6 * fVar6); if (this->_fireCooldown < 1) { local_44 = 0.98; local_40.x = local_38.x * 0.02 + 0.8; puVar4 = GHIDRA_CAST(&local_40); if (0.98 <= local_40.x) { puVar4 = GHIDRA_CAST(&local_44); } this->_friction = *GHIDRA_CAST(puVar4) * this->_friction; } else { iVar5 = this->_fireCooldown + -3; this->_fireCooldown = iVar5; if (0.0 < local_38.x) { fVar6 = (float)iVar5 / 60.0; if (fVar6 <= 0.0) { fVar6 = 0.0; } if (1.0 <= fVar6) { fVar6 = 1.0; } fVar6 = fVar6 * (3.0 / local_38.x) + local_38.x; if (40.0 <= fVar6) { fVar6 = 40.0; } (this->_velocity).x = (fVar6 / local_38.x) * local_40.x; (this->_velocity).y = (fVar6 / local_38.x) * (this->_velocity).y; local_38.x = fVar6; } } if (local_38.x < 1.0) { this->_state = 0; this->_fireCooldown = 0; (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("DashStop"),0); } fVar6 = 10.0 / local_38.x; if (fVar6 <= 2.0) { fVar6 = 2.0; } if (10.0 <= fVar6) { fVar6 = 10.0; } } iVar5 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::GetIntervalTicks(fVar6,0.0); if (iVar5 != 0) { uVar3 = Random(); Entity_NPC::MakeSplat (GHIDRA_CAST(this), (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * 2.3283064e-10 * 0.5 + 0.2); } LAB_0062f7c8: (this->_sprite)._flipX = (this->_velocity).x <= 0.0 && (this->_velocity).x != 0.0; return; } // 00630440 void Entity_Familiar::AddKeys(int param_2) { this->_keys = this->_keys + param_2; return; } // 00630450 void Entity_Familiar::store_backup(void *backup) { int iVar1; undefined4 linkedHealth; *GHIDRA_CAST(backup) = this->_initSeed; *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x2c)) = (this->_dropRNG)._seed; *GHIDRA_CAST((GHIDRA_CAST(backup) + 4)) = this->_variant; *GHIDRA_CAST((GHIDRA_CAST(backup) + 8)) = this->_subtype; *GHIDRA_CAST((GHIDRA_CAST(backup) + 0xc)) = this->_coins; *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x10)) = this->_hearts; *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x14)) = this->_keys; *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x18)) = this->_state; *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x1c)) = this->_roomClearCount; *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x20)) = (this->_formationTargetOffset).x; *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x24)) = (this->_formationTargetOffset).y; *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x28)) = this->_health; *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x30)) = this->_isNotCountedAsFollower; *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x31)) = this->_isSubtype55555; iVar1 = this->_variant; if ((iVar1 == 0xce) || (iVar1 == 0xed)) { *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x1c)) = this->_orbitLayer; iVar1 = this->_variant; } if (iVar1 == 0xf1) { if (this->_linkedEntity == (EntityPtr)0x0) { linkedHealth = 0; } else { linkedHealth = *GHIDRA_CAST((GHIDRA_CAST(this->_linkedEntity) + 0x380)); } *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x28)) = linkedHealth; iVar1 = this->_variant; } if (iVar1 == 0xec) { *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x28)) = this->_orbitSpeed; iVar1 = this->_variant; } if (iVar1 == 0xe7) { iVar1 = __RTDynamicCast(this->_extraData,0, &IsaacRepentancePlus::Entity_Familiar::ExtraData::RTTI_Type_Descriptor, &IsaacRepentancePlus::AbyssLocustData::RTTI_Type_Descriptor,0); *GHIDRA_CAST((GHIDRA_CAST(backup) + 0x1c)) = GHIDRA_UINT(*GHIDRA_CAST((iVar1 + 0x50))); } return; } // 00631050 void Entity_Familiar::MoveDelayed(int numFrames) { float fVar1; byte isDuctTape; undefined4 *historyEntry; float *historySlot; EntityPtr leader; int remaining; int historyIndex; undefined4 leaderY; float posY; if (this->_isSubtype55555 != 0) { (this->_pos).x = (this->_formationOffset).x; (this->_pos).y = (this->_formationOffset).y; (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; return; } isDuctTape = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x6d,0); if (isDuctTape != 0) { move_to_parent_offset(this); return; } if (((this->_formationOffset).x == g_vectorZero.x) && ((this->_formationOffset).y == g_vectorZero.y)) { historyIndex = this->_moveDelayNum; } else { reset_follow_target(this); historyIndex = -1; } leader = (EntityPtr)this->_player; if (this->_parent != (EntityPtr)0x0) { leader = this->_parent; } if (historyIndex == -1) { historyIndex = 0; this->_moveDelayNum = 0; if (3 < numFrames) { remaining = (numFrames - 4U >> 2) + 1; historyIndex = remaining * 4; historyEntry = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((this)) + 0x424)))); do { leaderY = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x340)); historyEntry[-3] = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x33c)); historyEntry[-2] = leaderY; leaderY = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x340)); historyEntry[-1] = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x33c)); *historyEntry = leaderY; leaderY = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x340)); historyEntry[1] = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x33c)); historyEntry[2] = leaderY; leaderY = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x340)); historyEntry[3] = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x33c)); historyEntry[4] = leaderY; remaining = remaining + -1; historyEntry = historyEntry + 8; } while (remaining != 0); } if (historyIndex < numFrames) { remaining = numFrames - historyIndex; historySlot = &(GHIDRA_CAST((&this->_splatColor + 0xc)))[historyIndex + 4].y; do { leaderY = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x340)); *historySlot = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x33c)); historySlot[1] = (float)leaderY; remaining = remaining + -1; historySlot = historySlot + 2; } while (remaining != 0); } } else { historyIndex = (historyIndex + 1) % numFrames; this->_moveDelayNum = historyIndex; fVar1 = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x340)); (GHIDRA_CAST((&this->_splatColor + 0xc)))[historyIndex + 4].y = *GHIDRA_CAST((GHIDRA_CAST(leader) + 0x33c)); (GHIDRA_CAST((&this->_splatColor + 0xc)))[historyIndex + 5].x = fVar1; } historyIndex = (this->_moveDelayNum + 1) % numFrames; if (this->_variant == 0x83) { fVar1 = (GHIDRA_CAST((&this->_splatColor + 0xc)))[historyIndex + 5].x; posY = (this->_pos).y; (this->_velocity).x = ((GHIDRA_CAST((&this->_splatColor + 0xc)))[historyIndex + 4].y - (this->_pos).x) * 0.5; (this->_velocity).y = (fVar1 - posY) * 0.5; } else { fVar1 = (GHIDRA_CAST((&this->_splatColor + 0xc)))[historyIndex + 5].x; (this->_velocity).x = ((GHIDRA_CAST((&this->_splatColor + 0xc)))[historyIndex + 4].y - (this->_pos).x) * 0.1 + (this->_velocity).x; (this->_velocity).y = (fVar1 - (this->_pos).y) * 0.1 + (this->_velocity).y; } this->_friction = this->_friction * 0.7; return; } // 006312f0 void Entity_Familiar::MoveDiagonally(float speed) { Vector *position; byte bVar1; uint rngResult; Entity *spawned; int *effect; float fVar2; float fVar3; float fVar4; Vector local_10; Game *game; bool isFixedAngle; int tls; if ((this->_variant == 0x4c) || (this->_variant == 0x3a)) { isFixedAngle = true; } else { isFixedAngle = false; } if (this->_isSubtype55555 != 0) { (this->_pos).x = (this->_formationOffset).x; (this->_pos).y = (this->_formationOffset).y; (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; return; } fVar2 = (this->_velocity).x; if ((fVar2 == g_vectorZero.x) && ((this->_velocity).y == g_vectorZero.y)) { rngResult = Random(); local_10.x = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 3.14; local_10.x = local_10.x + local_10.x; fVar2 = cos(local_10.x); fVar3 = sin(local_10.x); (this->_velocity).x = fVar2 * 10.0; (this->_velocity).y = fVar3 * 10.0; return; } tls = *GHIDRA_CAST(ThreadLocalStoragePointer); (this->_velocity).x = fVar2 * 0.7; (this->_velocity).y = (this->_velocity).y * 0.7; if ((*GHIDRA_CAST((tls + 0xc)) < DAT_00c7fd14) && (_Init_thread_header(&DAT_00c7fd14), DAT_00c7fd14 == -1)) { DAT_00c7fd18 = sqrtf(2.0); _Init_thread_footer(&DAT_00c7fd14); } local_10.x = 0.7853982; if (!isFixedAngle) { local_10.x = ((float)this->_fireCooldown * 3.1415927) / 180.0 + 0.7853982; } fVar4 = cos(local_10.x); fVar3 = DAT_00c7fd18; fVar2 = (this->_velocity).x; if (fVar2 <= 0.0) { fVar2 = fVar2 - DAT_00c7fd18 * fVar4 * speed; } else { fVar2 = DAT_00c7fd18 * fVar4 * speed + fVar2; } (this->_velocity).x = fVar2; fVar4 = sin(local_10.x); game = g_game; fVar2 = (this->_velocity).y; if (fVar2 <= 0.0) { fVar2 = fVar2 - fVar4 * fVar3 * speed; } else { fVar2 = fVar4 * fVar3 * speed + fVar2; } position = &this->_pos; (this->_velocity).y = fVar2; Room::GetClampedPositionImpl(game->_room,&local_10,position,0.0,0.0,0.0,0.0); if (position->x <= local_10.x) { if (position->x < local_10.x) { (this->_velocity).x = speed * 3.0 + (this->_velocity).x; } } else { (this->_velocity).x = (this->_velocity).x - speed * 3.0; } fVar2 = (this->_pos).y; if (fVar2 <= local_10.y) { if (fVar2 < local_10.y) { (this->_velocity).y = speed * 3.0 + (this->_velocity).y; } } else { (this->_velocity).y = (this->_velocity).y - speed * 3.0; } rngResult = Random(); if (((rngResult & 3) == 0) && ((this->_variant == 0x11 || (this->_variant == 0xcf)))) { rngResult = Random(); spawned = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,7,position,&g_vectorZero,GHIDRA_CAST(0x0),0,rngResult,0); effect = GHIDRA_CAST(__RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor,0)); rngResult = Random(); fVar2 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 0.3 + 0.1; effect[0x39] = GHIDRA_INT(fVar2); effect[0x3a] = GHIDRA_INT(fVar2); (**(code **)(*effect + 0xc))(); } game = g_game; if ((((this->_variant == 0xcf) && ((this->_flags & 0x4000) == 0)) && (bVar1 = (GHIDRA_CAST((g_game)))->Game::IsPaused(), bVar1 == 0)) && (((~(byte)game->_frameCount & 1) != 0 && (rngResult = Random(), 1 < rngResult % 5)))) { rngResult = Random(); spawned = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,0x2e,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,rngResult,0) ; effect = GHIDRA_CAST(__RTDynamicCast(spawned,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor,0)); rngResult = Random(); fVar3 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 0.5 + 0.2; fVar2 = fVar3 * g_vectorOne.x; effect[0x3a] = GHIDRA_INT((fVar3 * g_vectorOne.y)); effect[0x39] = GHIDRA_INT(fVar2); (**(code **)(*effect + 0xc))(); } if (!isFixedAngle) { if (((0.0 < (this->_velocity).x) && ((this->_targetPosition).x <= 0.0)) || ((0.0 < (this->_velocity).y && ((this->_targetPosition).y <= 0.0)))) { rngResult = Random(); this->_fireCooldown = rngResult % 0x1f - 0xf; } (this->_targetPosition).x = (this->_velocity).x; (this->_targetPosition).y = (this->_velocity).y; } return; } // 00631850 void Entity_Familiar::move_to_parent_offset() { Vector *followOffset; float fVar1; float fVar2; float fVar3; Vector followOffsetResult; void *player; if ((*GHIDRA_CAST(g_game->_room) != '\0') && (g_game->_frameCount == *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x11f0)))) { player = this->_player; (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; fVar1 = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x33c)); fVar2 = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x340)); followOffset = UpdateFollowPosition(this,&followOffsetResult); fVar3 = followOffset->y; (this->_pos).x = fVar1 + followOffset->x; (this->_pos).y = fVar2 + fVar3; return; } fVar1 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); fVar2 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); followOffset = UpdateFollowPosition(this,&followOffsetResult); fVar1 = (fVar1 + followOffset->x) - (this->_pos).x; fVar2 = (fVar2 + followOffset->y) - (this->_pos).y; (this->_velocity).x = fVar1; fVar3 = fVar1 * fVar1 + fVar2 * fVar2; (this->_velocity).y = fVar2; if (10000.0 < fVar3) { fVar3 = sqrtf(fVar3); if (0.0 < fVar3) { (this->_velocity).y = (100.0 / fVar3) * fVar2; (this->_velocity).x = (100.0 / fVar3) * fVar1; } } (this->_velocity).x = (this->_velocity).x * 0.8; (this->_velocity).y = (this->_velocity).y * 0.8; return; } // 00631b20 void Entity_Familiar::delirium_morph() { char *pcVar1; size_t _Size; EntityPtr EVar2; uint uVar3; int iVar4; code *pcVar5; qword qVar6; undefined4 uVar7; uint uVar8; LayerState *layer; std_string *extraout_EAX; std_string *path; byte *resolvedPath; Entity *poofEffect; byte extraout_CL; byte extraout_CL_00; byte unk; void *pvVar9; qword *heapCounter; EntityPtr EVar10; char *_Size_00; uint uVar11; float fVar12; EntityPtr *local_70; EntityPtr oldSirenHelper; EntityPtr local_68; Entity_Familiar *local_64; std_string *local_60; EntityPtr local_5c; char *local_58; ANM2 *local_54; EntityPtr local_50; EntityPtr local_4c; byte local_46; byte local_45; void *redirectedPath [3]; undefined8 local_38; uint local_30; std_string sheetPath; void *savedExceptionList; undefined1 *puStack_c; uint ehState; float oldPosY; float oldVelocityX; float oldVelocityY; EntityPtr *refSlot; ehState = 0xffffffff; puStack_c = &LAB_00af6e7d; savedExceptionList = ExceptionList; ExceptionList = &savedExceptionList; local_58 = GHIDRA_CAST(this->_variant); uVar8 = this->_initSeed; (*GHIDRA_CAST((GHIDRA_CAST(&(local_38)) + 0x0))) = '\x05'; (*GHIDRA_CAST((GHIDRA_CAST(&(local_38)) + 0x1))) = '\0'; (*GHIDRA_CAST((GHIDRA_CAST(&(local_38)) + 0x2))) = '\0'; (*GHIDRA_CAST((GHIDRA_CAST(&(local_38)) + 0x3))) = '\0'; (*GHIDRA_CAST((GHIDRA_CAST(&(local_38)) + 0x4))) = 3; local_54 = GHIDRA_CAST(0x15); local_50 = (EntityPtr)0x0; do { local_64 = this; if (local_58 != GHIDRA_CAST(this->_variant)) break; if (uVar8 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar5 = (code *)swi(3); (*pcVar5)(); return; } uVar8 = uVar8 >> 5 ^ uVar8; uVar8 = uVar8 << 3 ^ uVar8; uVar8 = uVar8 >> 0x15 ^ uVar8; local_50 = (EntityPtr)(GHIDRA_INT(local_50) + 1); local_58 = *GHIDRA_CAST((&DAT_00b64820 + (uVar8 % 0x16) * 4)); } while (GHIDRA_UINT(local_50) < 10); local_4c = (EntityPtr)this->_player; fVar12 = (this->_pos).x; local_5c = this->_child; local_50 = this->_parent; iVar4 = this->_spawnerType; oldPosY = (this->_pos).y; local_60 = GHIDRA_CAST(this->_spawnerVariant); oldVelocityX = (this->_velocity).x; local_68 = (EntityPtr)this->_sirenOriginalPlayer; oldVelocityY = (this->_velocity).y; oldSirenHelper = this->_sirenHelper; if (this->_weapon != GHIDRA_CAST(0x0)) { (**(code **)(*GHIDRA_CAST(this->_weapon) + 0x14))(__security_cookie ^ GHIDRA_UINT(&(&sheetPath)[1]._size)); if (this->_weapon != GHIDRA_CAST(0x0)) { (*(code *)**GHIDRA_CAST(this->_weapon))(1); } this->_weapon = (void *)0x0; } if (this->_linkedEntity != (EntityPtr)0x0) { (**(code **)(*GHIDRA_CAST(this->_linkedEntity) + 0x28))(); } local_46 = this->_isFollower; local_45 = this->_isDelayed; RecalculateOrbitOffset(this,this->_orbitLayer,0); RemoveFromFollowers(this); RemoveFromDelayed(this); this->ClearReferences(); if (this->_spawnerEntity != (EntityPtr)0x0) { local_70 = &this->_spawnerEntity; std::multiset::erase(&local_70); } this->_spawnerEntity = local_4c; if (local_4c != (EntityPtr)0x0) { std::multiset::insert(&this->_spawnerEntity); } local_4c = *GHIDRA_CAST((*GHIDRA_CAST(this) + 4)); if (uVar8 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar5 = (code *)swi(3); (*pcVar5)(); return; } uVar8 = uVar8 >> ((byte)local_38 & 0x1f) ^ uVar8; uVar8 = uVar8 << (SUB81(local_38,4) & 0x1f) ^ uVar8; (*(code *)local_4c)(this->_type,local_58,0,uVar8 >> ((byte)local_54 & 0x1f) ^ uVar8); if (((this->_isFollower != 0) && (local_46 != 0)) || ((this->_isDelayed != 0 && (local_45 != 0)))) { RemoveFromFollowers(this); RemoveFromDelayed(this); refSlot = &this->_parent; this->_isFollower = local_46; this->_isDelayed = local_45; if (*refSlot != (EntityPtr)0x0) { local_4c = (EntityPtr)refSlot; std::multiset::erase(&local_4c); } *refSlot = local_50; if (local_50 != (EntityPtr)0x0) { std::multiset::insert(refSlot); EVar10 = (EntityPtr)(GHIDRA_INT(local_50) + 0x3c0); if (*GHIDRA_CAST(EVar10) != (EntityPtr)0x0) { local_4c = EVar10; std::multiset::erase(&local_4c); } *GHIDRA_CAST(EVar10) = this; std::multiset::insert(EVar10); } refSlot = &this->_child; if (this->_child != (EntityPtr)0x0) { local_4c = (EntityPtr)refSlot; std::multiset::erase(&local_4c); } *refSlot = local_5c; if (local_5c != (EntityPtr)0x0) { std::multiset::insert(refSlot); EVar10 = (EntityPtr)(GHIDRA_INT(local_5c) + 0x3bc); if (*GHIDRA_CAST(EVar10) != (EntityPtr)0x0) { local_4c = EVar10; std::multiset::erase(&local_4c); } *GHIDRA_CAST(EVar10) = this; std::multiset::insert(EVar10); } } (this->_pos).x = fVar12; (this->_pos).y = oldPosY; (this->_velocity).x = oldVelocityX; this->_spawnerType = iVar4; this->_spawnerVariant = GHIDRA_INT(local_60); (this->_velocity).y = oldVelocityY; this->_appearTimer = 0; local_45 = '\0'; local_50 = (EntityPtr)0x0; if ((this->_sprite)._layerCount != 0) { local_54 = &this->_sprite; do { layer = (GHIDRA_CAST((local_54)))->ANM2::GetLayer(GHIDRA_CAST(local_50)); if (layer->_layerData == (void *)0x0) { sheetPath._capacity = 0xf; sheetPath._size = 0; sheetPath._buf[0] = '\0'; sheetPath._buf[1] = '\0'; sheetPath._buf[2] = '\0'; sheetPath._buf[3] = '\0'; } else { (GHIDRA_CAST((sheetPath._buf)))->std::string::string((void *)(GHIDRA_INT(layer->_layerData) + 0x20)); } uVar8 = sheetPath._size; ehState = 0; local_5c = (EntityPtr)sheetPath._capacity; if (sheetPath._size < 4) { /* WARNING: Subroutine does not return */ FUN_00499950(); } if (sheetPath._capacity - sheetPath._size < 0x12) { if (0x7fffffff - sheetPath._size < 0x12) { /* WARNING: Subroutine does not return */ std::string::_Xlen(); } uVar11 = sheetPath._size + 0x12 | 0xf; if (uVar11 < 0x80000000) { if (0x7fffffff - (sheetPath._capacity >> 1) < sheetPath._capacity) { uVar11 = 0x7fffffff; } else { uVar3 = sheetPath._capacity + (sheetPath._capacity >> 1); if (uVar11 < uVar3) { uVar11 = uVar3; } } } else { uVar11 = 0x7fffffff; } local_58 = std::_Allocate(uVar11 + 1); uVar7 = (*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))); EVar10 = local_5c; sheetPath._size = uVar8 + 0x12; local_60 = GHIDRA_CAST((uVar8 - 3)); sheetPath._capacity = uVar11; if (GHIDRA_UINT(local_5c) < 0x10) { *GHIDRA_CAST(local_58) = (*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))); local_58[4] = 'f'; local_58[5] = 'a'; local_58[6] = 'm'; local_58[7] = 'i'; local_58[8] = 'l'; local_58[9] = 'i'; local_58[10] = 'a'; local_58[0xb] = 'r'; local_58[0xc] = '/'; local_58[0xd] = 'd'; local_58[0xe] = 'e'; local_58[0xf] = 'l'; local_58[0x10] = 'i'; local_58[0x11] = 'r'; local_58[0x12] = 'i'; local_58[0x13] = 'u'; local_58[0x14] = 'm'; local_58[0x15] = '/'; memcpy(local_58 + 0x16,sheetPath._buf + 4,(size_t)local_60); } else { *GHIDRA_CAST(local_58) = *(*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(sheetPath._buf))) + 0x0))); local_58[4] = 'f'; local_58[5] = 'a'; local_58[6] = 'm'; local_58[7] = 'i'; local_58[8] = 'l'; local_58[9] = 'i'; local_58[10] = 'a'; local_58[0xb] = 'r'; local_58[0xc] = '/'; local_58[0xd] = 'd'; local_58[0xe] = 'e'; local_58[0xf] = 'l'; local_58[0x10] = 'i'; local_58[0x11] = 'r'; local_58[0x12] = 'i'; local_58[0x13] = 'u'; local_58[0x14] = 'm'; local_58[0x15] = '/'; memcpy(local_58 + 0x16,(void *)((*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) + 4),(size_t)local_60); uVar8 = GHIDRA_INT(EVar10) + 1; pvVar9 = (void *)uVar7; if (0xfff < uVar8) { pvVar9 = *(void **)(uVar7 + -4); uVar8 = GHIDRA_INT(EVar10) + 0x24; if (0x1f < (uVar7 - GHIDRA_INT(pvVar9)) - 4U) goto LAB_006321d1; } operator_delete(pvVar9,uVar8); } (*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) = local_58; } else { local_60 = &sheetPath; if (0xf < sheetPath._capacity) { local_60 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(sheetPath._buf))) + 0x0))); } pcVar1 = local_60->_buf + 4; if (("/" < pcVar1) || (local_60->_buf + sheetPath._size < "familiar/delirium/")) { _Size_00 = GHIDRA_CAST(0x12); } else if ("familiar/delirium/" < pcVar1) { _Size_00 = local_60[-0x79802]._buf + 8; } else { _Size_00 = GHIDRA_CAST(0x0); } _Size = sheetPath._size - 3; sheetPath._size = sheetPath._size + 0x12; memmove((void *)(GHIDRA_INT(&local_60->_capacity) + 2),pcVar1,_Size); pcVar1 = local_60->_buf; memcpy(pcVar1 + 4,"familiar/delirium/",(size_t)_Size_00); memcpy(_Size_00 + GHIDRA_INT((pcVar1 + 4)),_Size_00 + 0xb6403e,0x12 - GHIDRA_INT(_Size_00)); } (GHIDRA_CAST((&g_manager->_modManager)))->ModManager::TryRedirectPath(GHIDRA_CAST(redirectedPath),&sheetPath); if (&sheetPath != extraout_EAX) { if (0xf < sheetPath._capacity) { uVar8 = sheetPath._capacity + 1; pvVar9 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)sheetPath._buf)) + 0x0))); if (0xfff < uVar8) { pvVar9 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) + -4); uVar8 = sheetPath._capacity + 0x24; if (0x1f < ((*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) - GHIDRA_INT(pvVar9)) - 4U) goto LAB_006321d1; } operator_delete(pvVar9,uVar8); } (*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) = *GHIDRA_CAST(extraout_EAX->_buf); (*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x4))) = *GHIDRA_CAST((extraout_EAX->_buf + 4)); (*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x8))) = *GHIDRA_CAST((extraout_EAX->_buf + 8)); (*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0xc))) = *GHIDRA_CAST((extraout_EAX->_buf + 0xc)); sheetPath._size = extraout_EAX->_size; sheetPath._capacity = extraout_EAX->_capacity; extraout_EAX->_size = 0; extraout_EAX->_capacity = 0xf; extraout_EAX->_buf[0] = '\0'; } if (0xf < local_30) { uVar8 = local_30 + 1; pvVar9 = redirectedPath[0]; if (0xfff < uVar8) { pvVar9 = *(void **)(GHIDRA_INT(redirectedPath[0]) + -4); uVar8 = local_30 + 0x24; if (0x1f < GHIDRA_UINT((GHIDRA_INT(redirectedPath[0]) + (-4 - GHIDRA_INT(pvVar9))))) goto LAB_006321d1; } operator_delete(pvVar9,uVar8); } path = &sheetPath; if (0xf < sheetPath._capacity) { path = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_CAST(sheetPath._buf))) + 0x0))); } resolvedPath = FileSystem::ResolvePath(GHIDRA_CAST(path)); local_46 = resolvedPath != GHIDRA_CAST(0x0); if (resolvedPath != GHIDRA_CAST(0x0)) { if (g_mainHeap == (void *)0x0) { heapCounter = &g_allocatedBytesNoHeap; } else { heapCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); } uVar8 = *GHIDRA_CAST((resolvedPath + -4)); qVar6 = *heapCounter; *GHIDRA_CAST(heapCounter) = GHIDRA_UINT(*heapCounter) - uVar8; *GHIDRA_CAST((GHIDRA_CAST(heapCounter) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(heapCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar6) < uVar8)); free(resolvedPath + -4); ehState = ehState & 0xffffff00; } EVar10 = local_50; unk = 0; if (local_46 != 0) { (GHIDRA_CAST((GHIDRA_CAST(local_54))))->Sprite::ReplaceSpritesheet(GHIDRA_INT(local_50),&sheetPath); local_45 = '\x01'; unk = extraout_CL; } ehState = 0xffffffff; if (0xf < sheetPath._capacity) { uVar8 = sheetPath._capacity + 1; pvVar9 = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)sheetPath._buf)) + 0x0))); if (0xfff < uVar8) { pvVar9 = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) + -4); uVar8 = sheetPath._capacity + 0x24; if (0x1f < ((*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) - GHIDRA_INT(pvVar9)) - 4U) { LAB_006321d1: /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(pvVar9,uVar8); unk = extraout_CL_00; } this = local_64; local_50 = (EntityPtr)(GHIDRA_INT(EVar10) + 1); } while (GHIDRA_UINT(local_50) < GHIDRA_CAST((local_64->_sprite)._layerCount)); if (local_45 != '\0') { (GHIDRA_CAST((&local_64->_sprite)))->ANM2::LoadGraphics(unk); } } uVar8 = Random(); poofEffect = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar8); fVar12 = g_vectorOne.y * 0.5; iVar4 = *GHIDRA_CAST(poofEffect); (poofEffect->_sprite)._scale.x = g_vectorOne.x * 0.5; (poofEffect->_sprite)._scale.y = fVar12; (**(code **)(iVar4 + 0xc))(); EVar10 = this->_sirenHelper; refSlot = &this->_sirenHelper; if (EVar10 != oldSirenHelper) { if (EVar10 != (EntityPtr)0x0) { local_64 = GHIDRA_CAST(refSlot); std::multiset::erase(&local_64); } *refSlot = oldSirenHelper; EVar10 = (EntityPtr)0x0; if (oldSirenHelper != (EntityPtr)0x0) { std::multiset::insert(refSlot); EVar10 = *refSlot; } } this->_sirenOriginalPlayer = (void *)local_68; if (EVar10 != (EntityPtr)0x0) { EVar2 = (EntityPtr)(GHIDRA_INT(EVar10) + 0x3c4); if (*GHIDRA_CAST((GHIDRA_CAST(EVar10) + 0x3c4)) != 0) { local_68 = EVar2; std::multiset::erase(&local_68); } *GHIDRA_CAST(EVar2) = this; std::multiset::insert(EVar2); } this->_isLilDelirium = 1; ExceptionList = savedExceptionList; return; } // 006322f0 void Entity_Familiar::init_lil_harbinger_sprite() { byte *pbVar1; byte bVar2; uint uVar3; uint uVar4; byte *pbVar5; uint extraout_ECX; void *ptr; uint extraout_ECX_00; char *wantedAnimName; uint layerId; bool isLess; std_string sheetPath; uint local_14; void *local_10; undefined1 *puStack_c; undefined4 local_8; local_8 = 0xffffffff; puStack_c = &LAB_00af6ebd; local_10 = ExceptionList; local_14 = __security_cookie ^ GHIDRA_INT(&sheetPath) + 0x28U; ExceptionList = &local_10; uVar3 = this->_subtype; if (4 < uVar3) { KAGE_LogMessage(0x10,GHIDRA_CAST("[err] Wrong Harbinger subtype %u!\n")); uVar3 = this->_subtype; } uVar3 = -GHIDRA_UINT((uVar3 != 0)) & uVar3; uVar4 = 4; if (uVar3 < 4) { uVar4 = uVar3; } layerId = 0; this->_subtype = uVar4; if ((this->_sprite)._layerCount != 0) { do { sheetPath._size = 0; sheetPath._capacity = 0xf; uVar4 = -GHIDRA_UINT((this->_subtype != 0)) & this->_subtype; (*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) = (void *)0x0; uVar3 = 4; if (uVar4 < 4) { uVar3 = uVar4; } pbVar1 = (&PTR_s_gfx_familiar_familiar_122_miniwa_00b64890)[uVar3]; pbVar5 = pbVar1; do { bVar2 = *pbVar5; pbVar5 = pbVar5 + 1; } while (bVar2 != 0); (GHIDRA_CAST((sheetPath._buf)))->std::string::assign(pbVar1,GHIDRA_INT(pbVar5) - GHIDRA_INT((pbVar1 + 1))); local_8 = 0; (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(layerId,&sheetPath); local_8 = 0xffffffff; uVar3 = extraout_ECX; if (0xf < sheetPath._capacity) { uVar3 = sheetPath._capacity + 1; ptr = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)sheetPath._buf)) + 0x0))); if (0xfff < uVar3) { ptr = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) + -4); uVar3 = sheetPath._capacity + 0x24; if (0x1f < GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(&(sheetPath._buf)) + 0x0))) + (-4 - GHIDRA_INT(ptr))))) { /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(ptr,uVar3); uVar3 = extraout_ECX_00; } layerId = layerId + 1; } while (layerId < GHIDRA_UINT((this->_sprite)._layerCount)); } (GHIDRA_CAST((&this->_sprite)))->ANM2::LoadGraphics((byte)uVar3); pbVar1 = (this->_sprite)._animState._animData; if (pbVar1 != GHIDRA_CAST(0x0)) { pbVar5 = pbVar1; if (0xf < *GHIDRA_CAST((pbVar1 + 0x14))) { pbVar5 = *GHIDRA_CAST(pbVar1); } wantedAnimName = "FloatDown"; do { bVar2 = *pbVar5; isLess = bVar2 < (byte)*wantedAnimName; if (bVar2 != *wantedAnimName) { LAB_00632450: uVar3 = -GHIDRA_UINT(isLess) | 1; goto LAB_00632455; } if (bVar2 == 0) break; bVar2 = pbVar5[1]; isLess = bVar2 < (byte)wantedAnimName[1]; if (bVar2 != wantedAnimName[1]) goto LAB_00632450; pbVar5 = pbVar5 + 2; wantedAnimName = wantedAnimName + 2; } while (bVar2 != 0); uVar3 = 0; LAB_00632455: if ((uVar3 == 0) && ((pbVar1[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_00632488; } bVar2 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST("FloatDown"),1); if (bVar2 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } LAB_00632488: uVar4 = -GHIDRA_UINT((this->_subtype != 0)) & this->_subtype; uVar3 = 4; if (uVar4 < 4) { uVar3 = uVar4; } this->_collisionDamage = *GHIDRA_CAST((&DAT_00b64878 + uVar3 * 4)); ExceptionList = local_10; return; } // 006324d0 void Entity_Familiar::render_charge_indicator(Vector *renderPos) { byte bVar1; int iVar2; EntityPtr rootSpawner; int iVar3; float10 weaponCharge; float chargePercent; char *anim; Vector local_10; void *chargeAnimData; if ((g_manager->_optionsConfig)._enableChargeBars == 0) { return; } iVar2 = this->_variant; iVar3 = 0; if (iVar2 == 0x50) { if (this->_weapon != GHIDRA_CAST(0x0)) { weaponCharge = (float10)(**(code **)(*GHIDRA_CAST(this->_weapon) + 0x1c))(); local_10.x = (float)weaponCharge; if (0.0 < local_10.x) { chargePercent = local_10.x * 100.0; goto LAB_006326d0; } } LAB_0063263a: if ((this->_chargeBarSprite)._animState._animData != (void *)0x0) { anim = "Disappear"; LAB_00632650: (GHIDRA_CAST((&this->_chargeBarSprite)))->ANM2::Play(GHIDRA_CAST(anim),0); goto LAB_00632655; } } else { if (((iVar2 != 0x3d) && (iVar2 != 0x6c)) && (iVar2 != 0xe6)) { if (iVar2 == 0x57) { if (this->_state == 0) { chargePercent = (float)this->_fireCooldown / 90.0; goto LAB_006326b8; } } else { if (iVar2 == 0x7d) { iVar2 = this->_fireCooldown; if (iVar2 < 0) { chargePercent = 0.0; } else { iVar3 = apply_forgotten_lullaby(this,0x1e); chargePercent = (1.0 - (float)iVar2 / (float)iVar3) * 100.0; if (chargePercent <= 0.0) { chargePercent = 0.0; } } goto LAB_006326c8; } if (iVar2 == 0x3e) { chargePercent = (float)this->_fireCooldown / 30.0; goto LAB_006326b8; } } goto LAB_0063263a; } iVar2 = this->_fireCooldown; iVar3 = apply_forgotten_lullaby(this,0x1e); local_10.x = 1.0 - (float)(iVar2 + 1) / (float)iVar3; iVar2 = apply_forgotten_lullaby(this,0x1e); if (this->_fireCooldown == iVar2) { iVar3 = 0; goto LAB_0063263a; } chargePercent = local_10.x; LAB_006326b8: chargePercent = chargePercent * 100.0; if (chargePercent <= 0.0) { chargePercent = 0.0; } LAB_006326c8: if (100.0 <= chargePercent) { chargePercent = 100.0; } LAB_006326d0: iVar3 = GHIDRA_INT(chargePercent); if (iVar3 == 0) goto LAB_0063263a; if (iVar3 == 100) { chargeAnimData = (this->_chargeBarSprite)._animState._animData; if (chargeAnimData != (void *)0x0) { if (*GHIDRA_CAST((GHIDRA_CAST(chargeAnimData) + 0x34)) == '\0') { if ((this->_chargeBarSprite)._animState._isPlaying == 0) goto LAB_0063270c; goto LAB_00632723; } goto LAB_00632655; } LAB_0063270c: (GHIDRA_CAST((&this->_chargeBarSprite)))->ANM2::Play(GHIDRA_CAST("StartCharged"),0); if ((this->_chargeBarSprite)._animState._animData != (void *)0x0) { LAB_00632723: if ((this->_chargeBarSprite)._animState._isPlaying != 0) goto LAB_00632655; } anim = "Charged"; goto LAB_00632650; } bVar1 = (GHIDRA_CAST((&this->_chargeBarSprite)))->ANM2::SetAnimation(GHIDRA_CAST("Charging"),1); if (((bVar1 != 0) && ((this->_chargeBarSprite)._animState._animData != (void *)0x0)) && ((GHIDRA_CAST((&(this->_chargeBarSprite)._animState)))->AnimationState::SetFrameFloat((float)iVar3), (this->_chargeBarSprite)._animState._animData != (void *)0x0)) { (this->_chargeBarSprite)._animState._isPlaying = 0; } LAB_00632655: if (((this->_chargeBarSprite)._animState._animData != (void *)0x0) && ((this->_chargeBarSprite)._animState._isPlaying != 0)) goto LAB_00632689; } if (iVar3 < 1) { return; } if (g_game->_frameCount - this->_spawnFrame < 7) { return; } LAB_00632689: rootSpawner = this->_spawnerEntity; if (rootSpawner != (EntityPtr)0x0) { for (; *GHIDRA_CAST((GHIDRA_CAST(rootSpawner) + 0x3c8)) != (EntityPtr)0x0; rootSpawner = *GHIDRA_CAST((GHIDRA_CAST(rootSpawner) + 0x3c8))) { } } iVar2 = __RTDynamicCast(rootSpawner,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Player::RTTI_Type_Descriptor,0); if (((iVar2 == 0) || (g_manager->_netplayManager == *GHIDRA_CAST((g_manager + 1)))) || (bVar1 = NetplayManager::IsIdxLocalPlayer (&g_manager->_netplayManager,*GHIDRA_CAST((iVar2 + 0x1618))), bVar1 != 0)) { local_10.x = renderPos->x + 12.0; local_10.y = renderPos->y - 35.0; (GHIDRA_CAST((&this->_chargeBarSprite)))->ANM2::Render(&local_10,&g_vectorZero,&g_vectorZero); } return; } // 00632820 void Entity_Familiar::ai_lil_monstro() { EntityPtr EVar1; code *pcVar2; Entity_Player *tear; qword qVar3; byte bVar4; int frequency; byte *curAnimName; Entity *spawned; Entity_Tear *tear; TearParams *pTVar5; char *attackAnimName; byte *flyAnimName; qword *allocCounter; uint uVar6; bool isLess; float dirLength; float fVar7; float dirX; undefined4 uVar8; TypeDescriptor *pTVar9; TypeDescriptor *pTVar10; undefined4 uVar11; EntityList_EL nearbyEnemies; Entity_Familiar *self; Vector local_90; Vector local_88; float local_80; TearParams tearHitParams; uint local_14; void *local_10; undefined1 *puStack_c; float local_8; byte *animData; void *curAnimData; EntityPtr *targetRef; local_8 = -NAN; puStack_c = &LAB_00af6f00; local_10 = ExceptionList; local_14 = __security_cookie ^ GHIDRA_UINT(((&tearHitParams)[1]._tearColor._colorize + 3)); ExceptionList = &local_10; self = this; frequency = apply_forgotten_lullaby(this,0x1e); bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(frequency,0); if (bVar4 != 0) { local_90.y = 0.0; EntityList::QueryRadius (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&nearbyEnemies,&this->_pos,150.0,8); uVar6 = 0; local_8 = 0.0; if (nearbyEnemies._size != 0) { do { EVar1 = *GHIDRA_CAST((GHIDRA_CAST(nearbyEnemies._data) + uVar6 * 4)); bVar4 = (GHIDRA_CAST((GHIDRA_CAST(EVar1))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); if (((bVar4 != 0) && (bVar4 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsDescendantOf(GHIDRA_CAST(EVar1)), bVar4 == 0)) && ((*GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x168)) & 0x20000010) == 0)) { local_88.y = *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x340)); local_88.x = (GHIDRA_CAST((GHIDRA_INT(EVar1) + 0x33c)))->x; bVar4 = (GHIDRA_CAST((g_game->_room)))->Room::CheckLine(&this->_pos,&local_88,3,0,0,0,GHIDRA_CAST(0x0)); if (bVar4 != 0) { local_90.y = (float)EVar1; } } uVar6 = uVar6 + 1; } while (uVar6 < GHIDRA_UINT(nearbyEnemies._size)); if ((EntityPtr)local_90.y != (EntityPtr)0x0) { local_88.y = (GHIDRA_CAST((GHIDRA_INT(local_90.y) + 0x33c)))->x - (this->_pos).x; local_80 = *GHIDRA_CAST((GHIDRA_CAST(local_90.y) + 0x340)) - (this->_pos).y; this->_headFrameDelay = 0xc; animData = (this->_sprite)._animState._animData; if (animData == GHIDRA_CAST(0x0)) { LAB_006329dd: bVar4 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST("Attack"),1); if (bVar4 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } } else { curAnimName = animData; if (0xf < *GHIDRA_CAST((animData + 0x14))) { curAnimName = *GHIDRA_CAST(animData); } attackAnimName = "Attack"; do { bVar4 = *curAnimName; isLess = bVar4 < (byte)*attackAnimName; if (bVar4 != *attackAnimName) { LAB_006329c7: uVar6 = -GHIDRA_UINT(isLess) | 1; goto LAB_006329cc; } if (bVar4 == 0) break; bVar4 = curAnimName[1]; isLess = bVar4 < (byte)attackAnimName[1]; if (bVar4 != attackAnimName[1]) goto LAB_006329c7; curAnimName = curAnimName + 2; attackAnimName = attackAnimName + 2; } while (bVar4 != 0); uVar6 = 0; LAB_006329cc: if ((uVar6 != 0) || ((animData[0x34] != 0 && ((this->_sprite)._animState._isPlaying == 0)))) goto LAB_006329dd; } (this->_sprite)._flipX = local_88.y < 0.0; dirLength = sqrtf(local_80 * local_80 + local_88.y * local_88.y); fVar7 = local_80; dirX = local_88.y; if (0.0 < dirLength) { fVar7 = local_80 * (1.0 / dirLength); dirX = local_88.y * (1.0 / dirLength); } targetRef = &this->_target; (this->_targetPosition).x = dirX * 8.0; (this->_targetPosition).y = fVar7 * 8.0; if (*targetRef != (EntityPtr)0x0) { local_88.y = (float)targetRef; std::multiset::erase(&local_88.y); } *targetRef = (EntityPtr)local_90.y; std::multiset::insert(targetRef); } } local_8 = -NAN; if ((*GHIDRA_CAST((GHIDRA_CAST(&(nearbyEnemies)) + 0x0))) == '\0') { if (g_mainHeap == (void *)0x0) { allocCounter = &g_allocatedBytesNoHeap; } else { allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); } if (nearbyEnemies._data != (void *)0x0) { uVar6 = *GHIDRA_CAST((GHIDRA_CAST(nearbyEnemies._data) + -4)); qVar3 = *allocCounter; *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar6; *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar3) < uVar6)); free((void *)(GHIDRA_INT(nearbyEnemies._data) + -4)); } local_8 = -NAN; } } if (this->_headFrameDelay < 1) { if (((this->_sprite)._animState._animData == (void *)0x0) || ((this->_sprite)._animState._isPlaying == 0)) { animData = (this->_sprite)._animState._animData; if (animData != GHIDRA_CAST(0x0)) { curAnimName = animData; if (0xf < *GHIDRA_CAST((animData + 0x14))) { curAnimName = *GHIDRA_CAST(animData); } flyAnimName = s_Fly; do { bVar4 = *curAnimName; isLess = bVar4 < *flyAnimName; if (bVar4 != *flyAnimName) { LAB_00632b48: uVar6 = -GHIDRA_UINT(isLess) | 1; goto LAB_00632b4d; } if (bVar4 == 0) break; bVar4 = curAnimName[1]; isLess = bVar4 < flyAnimName[1]; if (bVar4 != flyAnimName[1]) goto LAB_00632b48; curAnimName = curAnimName + 2; flyAnimName = flyAnimName + 2; } while (bVar4 != 0); uVar6 = 0; LAB_00632b4d: if ((uVar6 == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_00632b80; } bVar4 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(s_Fly,1); if (bVar4 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } } } else { this->_headFrameDelay = this->_headFrameDelay + -1; } LAB_00632b80: if (((this->_sprite)._animState._animData != (void *)0x0) && (bVar4 = (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::IsEventTriggered(GHIDRA_CAST("Shoot")), bVar4 != 0)) { local_90.x = (this->_targetPosition).x; EVar1 = this->_target; local_90.y = (this->_targetPosition).y; if (EVar1 != (EntityPtr)0x0) { local_88.y = *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x33c)) - (this->_pos).x; local_80 = *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x340)) - (this->_pos).y; dirLength = sqrtf(local_88.y * local_88.y + local_80 * local_80); targetRef = GHIDRA_CAST(local_88.y); fVar7 = local_80; if (0.0 < dirLength) { targetRef = GHIDRA_CAST((local_88.y * (1.0 / dirLength))); fVar7 = local_80 * (1.0 / dirLength); } local_90.x = (float)targetRef * 10.0; local_90.y = fVar7 * 10.0; } uVar6 = Random(); uVar11 = 0; pTVar10 = &IsaacRepentancePlus::Entity_Tear::RTTI_Type_Descriptor; pTVar9 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; uVar8 = 0; spawned = (GHIDRA_CAST((g_game)))->Game::Spawn(2,0,&this->_pos,&local_90,GHIDRA_CAST(this),0,uVar6); tear = GHIDRA_CAST(__RTDynamicCast(spawned,uVar8,pTVar9,pTVar10,uVar11)); tear->_fallingSpeed = 1.2; local_88.y = apply_tear_modifiers(this); fVar7 = apply_tear_modifiers(this); local_80 = fVar7 * 0.2 + 0.7; pcVar2 = *(code **)(*GHIDRA_CAST(tear) + 0x40); tear = self->_player; uVar6 = Random(); pTVar5 = Entity_Player::GetTearHitParams (tear,&tearHitParams,1,1.0,(uVar6 & 1) * 2 + -1,GHIDRA_CAST(0x0)); (*pcVar2)(local_88.y * pTVar5->_tearDamage); fVar7 = local_80; if (local_80 <= 0.01) { fVar7 = 0.01; } tear->_baseScale = fVar7; tear->_fScale = fVar7; (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); this = self; TryFireTear(self,tear); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); } curAnimData = (this->_sprite)._animState._animData; if ((curAnimData != (void *)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(curAnimData) + 0x34)) != '\0')) { (this->_sprite)._flipX = (this->_velocity).x <= 0.0 && (this->_velocity).x != 0.0; } ExceptionList = local_10; return; } // 00632d90 void Entity_Familiar::ai_variant_111() { int iVar1; Entity_Familiar *pEVar2; byte isBreakableRock; RoomDescriptor *doorTargetRoom; uint rngResult; int iVar3; Vector *randomPos; float *pfVar4; int extraout_ECX; int extraout_EDX; void *freePtr; float *pfVar5; Game *game; float *candidatesEnd; uint rngResult; float fVar7; float fVar8; float *local_2c; Vector scratchVec; Entity_Familiar *local_1c; void *local_18; float *local_14; void *local_10; undefined1 *puStack_c; undefined4 local_8; Manager *manager; GridEntity *rockGrid; local_8 = 0xffffffff; puStack_c = &LAB_00af5d8d; local_10 = ExceptionList; ExceptionList = &local_10; if ((((this->_targetPosition).x != g_vectorZero.x) || ((this->_targetPosition).y != g_vectorZero.y)) || (1 < this->_state)) goto LAB_00633192; candidatesEnd = GHIDRA_CAST(0x0); local_2c = GHIDRA_CAST(0x0); local_8 = 0; local_18 = (void *)0x0; pfVar4 = GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x724)); game = g_game; local_1c = this; local_14 = pfVar4; do { iVar3 = *GHIDRA_CAST((GHIDRA_CAST(pfVar4) + GHIDRA_INT(local_18) * 4)); if (iVar3 != 0) { if (*GHIDRA_CAST((iVar3 + 0xc)) != 2) { if (*GHIDRA_CAST((iVar3 + 0x160)) == 7) { LAB_00632e6b: doorTargetRoom = (GHIDRA_CAST((GHIDRA_CAST(game))))->Level::GetRoomByIdx(*GHIDRA_CAST((iVar3 + 0x394)),-1); game = g_game; pfVar4 = local_14; if (doorTargetRoom->VisitedCount != 0) goto LAB_00632f15; iVar3 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_14) + GHIDRA_INT(local_18) * 4)) + 0x24)); iVar1 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)); scratchVec.x = (float)(iVar3 % iVar1) * 40.0 + 40.0; scratchVec.y = (float)(iVar3 / iVar1) * 40.0 + 120.0; if (candidatesEnd == GHIDRA_CAST(0x0)) { std::vector::_Emplace_reallocate(0,&scratchVec); game = g_game; candidatesEnd = local_2c; } else { *candidatesEnd = scratchVec.x; candidatesEnd[1] = scratchVec.y; local_2c = candidatesEnd + 2; candidatesEnd = local_2c; } } else if (*GHIDRA_CAST((iVar3 + 0x160)) == 8) goto LAB_00632e6b; pfVar4 = local_14; } } LAB_00632f15: this = local_1c; pfVar5 = GHIDRA_CAST(0x0); fVar7 = 40.0; fVar8 = 120.0; local_18 = (void *)(GHIDRA_INT(local_18) + 1); } while (local_18 < 8); local_14 = pfVar5; if (((((game->_levelStateFlags & 0x2000U) == 0) && (iVar3 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x768)), -1 < iVar3)) && ((iVar3 < 0x1c0 && ((rockGrid = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + iVar3 * 4 + 0x24)), rockGrid != GHIDRA_CAST(0x0) && (isBreakableRock = (GHIDRA_CAST((rockGrid)))->GridEntity::IsBreakableRock(), isBreakableRock != 0)))))) && (*GHIDRA_CAST((extraout_ECX + 0xc)) != 2)) { iVar3 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0xc)); scratchVec.x = (float)(extraout_EDX % iVar3) * fVar7 + fVar7; scratchVec.y = (float)(extraout_EDX / iVar3) * fVar7 + fVar8; if (candidatesEnd == local_14) { std::vector::_Emplace_reallocate(candidatesEnd,&scratchVec); local_14 = GHIDRA_CAST(0x0); game = g_game; candidatesEnd = local_2c; } else { *candidatesEnd = scratchVec.x; candidatesEnd[1] = scratchVec.y; local_2c = candidatesEnd + 2; candidatesEnd = local_2c; } } iVar3 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0x764)); if (-1 < iVar3) { if (iVar3 < 0x1c0) { iVar1 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + iVar3 * 4 + 0x24)); if (iVar1 != 0) { if (*GHIDRA_CAST((iVar1 + 4)) != 4) { if (*GHIDRA_CAST((iVar1 + 4)) != 0x16) goto LAB_0063308e; } if (*GHIDRA_CAST((iVar1 + 0xc)) != 2) { iVar1 = *GHIDRA_CAST((GHIDRA_CAST(game->_room) + 0xc)); scratchVec.x = (float)(iVar3 % iVar1) * 40.0 + 40.0; scratchVec.y = (float)(iVar3 / iVar1) * 40.0 + 120.0; this = local_1c; if (candidatesEnd == local_14) { std::vector::_Emplace_reallocate(candidatesEnd,&scratchVec); local_14 = GHIDRA_CAST(0x0); game = g_game; candidatesEnd = local_2c; } else { *candidatesEnd = scratchVec.x; candidatesEnd[1] = scratchVec.y; candidatesEnd = candidatesEnd + 2; } } } } } LAB_0063308e: manager = g_manager; rngResult = GHIDRA_INT(candidatesEnd) >> 3; local_18 = (void *)0x0; if (rngResult == 0) { this->_state = 2; randomPos = (GHIDRA_CAST((game->_room)))->Room::GetRandomPosition(&scratchVec,0.0); (this->_targetPosition).x = randomPos->x; (this->_targetPosition).y = randomPos->y; } else { local_1c = GHIDRA_CAST(0x392); seed_fart_sound_override(GHIDRA_CAST(&local_1c)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_1c),1.0,2,0,1.0,0.0); rngResult = Random(); pfVar4 = GHIDRA_CAST((GHIDRA_INT(local_18) + (rngResult % rngResult) * 8)); (this->_targetPosition).x = *pfVar4; (this->_targetPosition).y = pfVar4[1]; this->_state = GHIDRA_UINT((rngResult == 1)); } this->_fireCooldown = 0x96; local_8 = 0xffffffff; if (local_18 != (void *)0x0) { rngResult = GHIDRA_INT(local_14) - GHIDRA_INT(local_18) & 0xfffffff8; freePtr = local_18; if (0xfff < rngResult) { freePtr = *(void **)(GHIDRA_CAST(local_18) + -4); rngResult = rngResult + 0x23; if (0x1f < GHIDRA_UINT((GHIDRA_INT(local_18) + (-4 - GHIDRA_INT(freePtr))))) { /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(freePtr,rngResult); } LAB_00633192: if (this->_state == 2) { local_18 = (void *)(this->_velocity).x; fVar7 = (this->_velocity).y; local_14 = GHIDRA_CAST(((this->_targetPosition).x - (this->_pos).x)); if (1.0 <= (float)local_18 * (float)local_18 + fVar7 * fVar7) { local_1c = GHIDRA_CAST(((this->_targetPosition).y - (this->_pos).y)); rngResult = Random(); local_18 = (void *)((float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)] ) * 2.3283064e-10 * 0.2 + 0.1); scratchVec.y = atan2f((float)local_1c,(float)local_14); scratchVec.y = scratchVec.y * 57.295776; fVar7 = atan2f((this->_velocity).y,(this->_velocity).x); fVar7 = LerpAngleDeg(fVar7 * 57.295776,scratchVec.y,(float)local_18); local_18 = (void *)(fVar7 * 0.017453292); scratchVec.y = 0.5; local_1c = (Entity_Familiar *) sqrtf((float)local_1c * (float)local_1c + (float)local_14 * (float)local_14); pfVar4 = &scratchVec.y; if ((float)local_1c <= 0.5) { pfVar4 = GHIDRA_CAST(&local_1c); } fVar7 = cos((float)local_18); (this->_velocity).x = fVar7 * (float)*pfVar4 + (this->_velocity).x; fVar7 = sin((float)local_18); (this->_velocity).y = fVar7 * (float)*pfVar4 + (this->_velocity).y; } else { local_1c = GHIDRA_CAST(((this->_targetPosition).y - (this->_pos).y)); fVar7 = sqrtf((float)local_14 * (float)local_14 + (float)local_1c * (float)local_1c); if (fVar7 <= 0.0) { pEVar2 = local_1c; pfVar4 = local_14; } else { pEVar2 = GHIDRA_CAST(((0.5 / fVar7) * (float)local_1c)); pfVar4 = GHIDRA_CAST(((float)local_14 * (0.5 / fVar7))); } (this->_velocity).y = (float)pEVar2 + (this->_velocity).y; (this->_velocity).x = (float)local_18 + (float)pfVar4; } this->_friction = this->_friction * 0.8; if ((0 < this->_fireCooldown) && (iVar3 = this->_fireCooldown + -1, this->_fireCooldown = iVar3, iVar3 == 0)) { randomPos = (GHIDRA_CAST((g_game->_room)))->Room::GetRandomPosition(&scratchVec,0.0); (this->_targetPosition).x = randomPos->x; (this->_targetPosition).y = randomPos->y; rngResult = Random(); this->_fireCooldown = (rngResult % 3 + 1) * 0x1e; ExceptionList = local_10; return; } } else { local_1c = GHIDRA_CAST(((this->_targetPosition).x - (this->_pos).x)); local_18 = (void *)((this->_targetPosition).y - (this->_pos).y); fVar7 = (float)local_18 * (float)local_18 + (float)local_1c * (float)local_1c; if ((1.0 < fVar7) && (fVar7 = sqrtf(fVar7), 0.0 < fVar7)) { local_18 = (void *)((float)local_18 * (1.0 / fVar7)); local_1c = GHIDRA_CAST(((1.0 / fVar7) * (float)local_1c)); } (this->_velocity).x = (float)local_1c + (this->_velocity).x; fVar7 = this->_friction; (this->_velocity).y = (float)local_18 + (this->_velocity).y; this->_friction = fVar7 * 0.8; if ((0 < this->_fireCooldown) && (iVar3 = this->_fireCooldown + -1, this->_fireCooldown = iVar3, iVar3 == 0)) { (this->_targetPosition).x = g_vectorZero.x; (this->_targetPosition).y = g_vectorZero.y; } } ExceptionList = local_10; return; } // 00633500 void Entity_Familiar::update_angry_fly() { qword qVar1; byte bVar2; char cVar3; EntityPtr EVar4; uint rngResult; undefined4 *puVar5; int iVar6; qword *allocCounter; EntityPtr *targetSlot; uint uVar7; void *ptr; bool isExcluded; float fVar8; EntityList_EL entityList; EntityPtr *local_24; Entity_Familiar *local_20; EntityPtr newTarget; void *room; undefined4 *local_14; void *local_10; undefined1 *puStack_c; undefined4 local_8; void *candidatesData; int entityType; Entity_Familiar *otherFly; local_8 = 0xffffffff; puStack_c = &LAB_00af6f45; local_10 = ExceptionList; ExceptionList = &local_10; EVar4 = this->_target; targetSlot = &this->_target; local_24 = targetSlot; local_20 = this; if (EVar4 != (EntityPtr)0x0) { if (EVar4 == (EntityPtr)this->_player) { bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0x1e,this->_index); if (bVar2 != 0) goto LAB_0063357f; EVar4 = *targetSlot; } bVar2 = (GHIDRA_CAST((GHIDRA_CAST(EVar4))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)); if ((bVar2 != 0) || (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0x96,this->_index), bVar2 == 0)) goto LAB_00633702; } LAB_0063357f: newTarget = (EntityPtr)this->_player; entityList._data = (void *)0x0; entityList._capacity = 0; entityList._size = 0; room = g_game->_room; local_8 = 0; std::vector::_Reallocate(0x20); uVar7 = 0; puVar5 = GHIDRA_CAST(entityList._capacity); if (*GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264)) != 0) { do { iVar6 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + 0x125c)) + uVar7 * 4)); local_14 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + 0x125c)) + uVar7 * 4)); if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (*GHIDRA_CAST((iVar6 + 0x28)) != 1)) { entityType = *GHIDRA_CAST((iVar6 + 0x28)); if ((entityType - 10U < 0x3de) && (((entityType != 0x21 && (entityType != 0x11)) && (entityType != 0x124)))) { if (entityType == 0x375) { isExcluded = *GHIDRA_CAST((iVar6 + 0x2c)) == 10; } else { if ((entityType == 0x3c0) || (entityType == 0x3c5)) goto LAB_00633662; isExcluded = entityType == 0xf5; } if (!isExcluded) goto LAB_0063363b; } } else { LAB_0063363b: if (*GHIDRA_CAST((iVar6 + 0x173)) == '\0') { if (puVar5 == GHIDRA_CAST(entityList._size)) { std::vector::_Emplace_reallocate(puVar5,local_14); puVar5 = GHIDRA_CAST(entityList._capacity); } else { *puVar5 = *local_14; entityList._capacity = GHIDRA_INT((puVar5 + 1)); puVar5 = GHIDRA_CAST(entityList._capacity); } } } LAB_00633662: uVar7 = uVar7 + 1; } while (uVar7 < *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264))); } candidatesData = entityList._data; uVar7 = GHIDRA_INT(puVar5) - GHIDRA_INT(entityList._data) >> 2; if (uVar7 != 0) { rngResult = Random(); newTarget = *GHIDRA_CAST((GHIDRA_CAST(candidatesData) + (rngResult % uVar7) * 4)); } targetSlot = local_24; if (*local_24 != (EntityPtr)0x0) { std::multiset::erase(&local_24); } *targetSlot = newTarget; if (newTarget != (EntityPtr)0x0) { std::multiset::insert(targetSlot); } local_8 = 0xffffffff; if (candidatesData != (void *)0x0) { uVar7 = (entityList._size - GHIDRA_INT(candidatesData) >> 2) * 4; ptr = candidatesData; if (0xfff < uVar7) { ptr = *(void **)(GHIDRA_CAST(candidatesData) + -4); uVar7 = uVar7 + 0x23; if (0x1f < GHIDRA_UINT((GHIDRA_INT(candidatesData) + (-4 - GHIDRA_INT(ptr))))) { /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(ptr,uVar7); } this = local_20; LAB_00633702: if (*targetSlot == (EntityPtr)0x0) { KAGE_LogMessage(0x10,GHIDRA_CAST("[err] Angry Fly - Got a null target!\n")); } EntityList::QuerySublist (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&entityList,this->_type,this->_variant,-1,1 ,0); local_8 = 1; puVar5 = GHIDRA_CAST(0x0); local_14 = GHIDRA_CAST(0x0); iVar6 = 1; if (GHIDRA_CAST(entityList._size) != GHIDRA_CAST(0x0)) { do { otherFly = *GHIDRA_CAST((GHIDRA_CAST(entityList._data) + GHIDRA_INT(puVar5) * 4)); if (otherFly == this) { local_14 = puVar5; } else if (otherFly->_target == *targetSlot) { iVar6 = iVar6 + 1; } puVar5 = GHIDRA_CAST((GHIDRA_INT(puVar5) + 1)); } while (puVar5 < GHIDRA_UINT(entityList._size)); } fVar8 = ((float)GHIDRA_INT(local_14) * 360.0) / (float)iVar6; if (360.0 < ABS(fVar8)) { fVar8 = fmodf(fVar8,360.0); } if (fVar8 <= 180.0) { if (fVar8 < -180.0) { fVar8 = fVar8 + 360.0; } } else { fVar8 = fVar8 - 360.0; } local_20 = GHIDRA_CAST(0x42820000); local_14 = GHIDRA_CAST(fVar8); cVar3 = (**(code **)(*GHIDRA_CAST(*targetSlot) + 0x4c))(); if ((cVar3 != '\0') && (iVar6 = g_game->_frameCount % 0x96, iVar6 < 0x1e)) { fVar8 = ABS((float)iVar6 / 30.0 - 0.5); local_20 = GHIDRA_CAST(((fVar8 + fVar8) * 65.0)); } EVar4 = *targetSlot; local_24 = GHIDRA_CAST((((float)g_game->_frameCount * 3.6 + (float)local_14) * 0.017453292)); local_14 = GHIDRA_CAST(sin((float)local_24)); fVar8 = cos((float)local_24); local_14 = (undefined4 *) ((((float)local_14 * (float)local_20 + *GHIDRA_CAST((GHIDRA_CAST(EVar4) + 0x340))) - (this->_pos).y ) * 0.22); local_24 = (EntityPtr *) (((fVar8 * (float)local_20 + *GHIDRA_CAST((GHIDRA_CAST(EVar4) + 0x33c))) - (this->_pos).x) * 0.22); (this->_velocity).y = (float)local_14; (this->_velocity).x = (float)local_24; fVar8 = (float)local_14 * (float)local_14 + (float)local_24 * (float)local_24; if ((100.0 < fVar8) && (fVar8 = sqrtf(fVar8), 0.0 < fVar8)) { (this->_velocity).x = (float)local_24 * (10.0 / fVar8); (this->_velocity).y = (float)local_14 * (10.0 / fVar8); } if ((*GHIDRA_CAST((GHIDRA_CAST(&(entityList)) + 0x0))) == '\0') { if (g_mainHeap == (void *)0x0) { allocCounter = &g_allocatedBytesNoHeap; } else { allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); } if (entityList._data != (void *)0x0) { uVar7 = *GHIDRA_CAST((GHIDRA_CAST(entityList._data) + -4)); qVar1 = *allocCounter; *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar7; *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar1) < uVar7)); free(GHIDRA_CAST((GHIDRA_INT(entityList._data) + -4))); } } ExceptionList = local_10; return; } // 00634000 byte Entity_Familiar::TryFireTear(Entity_Tear *tear) { BitSet128 flags; int lullabyMultiplier; int iVar1; bool bVar2; bool bVar3; float fVar4; bool isFiring; float tearHeight; float fallingSpeed; float tearRange; BitSet128 tearFlags; ColorMod tearColor; Game *game; Entity_Player *player; player = this->_player; if ((*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ef8)))) == 0) || (*GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ef8)))) != 0x7f)) { iVar1 = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x7f); bVar3 = false; bVar2 = iVar1 == 0; } else { if ((*GHIDRA_CAST((GHIDRA_CAST((player)) + 0x2ef0))) != '\0') { isFiring = true; goto LAB_00634064; } lullabyMultiplier = (GHIDRA_CAST((player)))->Entity_Player::GetTrinketMultiplier(0x7f); bVar3 = SBORROW4(lullabyMultiplier,1); iVar1 = lullabyMultiplier + -1; bVar2 = lullabyMultiplier == 1; } bVar3 = bVar3 == iVar1 < 0; isFiring = !bVar2 && bVar3; if (bVar2 || !bVar3) { return isFiring; } LAB_00634064: (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x0))) = (undefined4)(tear->_tearFlags)._l; (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._l) + 4)); (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x0))) = (undefined4)(tear->_tearFlags)._h; (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._h) + 4)); tearColor._offset[2] = (tear->_sprite)._color._offset[2]; tearColor._tint[0] = (tear->_sprite)._color._tint[0]; tearColor._tint[1] = (tear->_sprite)._color._tint[1]; tearColor._tint[2] = (tear->_sprite)._color._tint[2]; tearColor._tint[3] = (tear->_sprite)._color._tint[3]; tearColor._colorize[0] = (tear->_sprite)._color._colorize[0]; tearColor._colorize[1] = (tear->_sprite)._color._colorize[1]; tearColor._colorize[2] = (tear->_sprite)._color._colorize[2]; tearColor._colorize[3] = (tear->_sprite)._color._colorize[3]; (*GHIDRA_CAST((GHIDRA_CAST(&(tearColor._offset)) + 0x0))) = *GHIDRA_CAST((tear->_sprite)._color._offset); tearHeight = tear->_height; fallingSpeed = tear->_fallingSpeed; tearRange = tear->_tearRange; apply_baby_bender_tear_params(this,&tearFlags,&tearColor,&tearHeight,&fallingSpeed,&tearRange,0); (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = (undefined4)tearFlags._l; (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = (undefined4)tearFlags._h; (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x4))); (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags); tear->SetColor(&tearColor,0xffffffff,0xff,0,1); tear->_height = tearHeight; fVar4 = (GHIDRA_CAST((tear)))->Entity_Tear::get_height_offset_y(tearHeight); game = g_game; (tear->_posOffset).y = fVar4; if ((*GHIDRA_CAST((GHIDRA_CAST(game->_room) + 8)) == 0x10) && ((tear->_posOffset).y = -18.0, -5.1 < tearHeight)) { tear->_height = -5.1; } tear->_fallingSpeed = fallingSpeed; tear->_tearRange = tearRange; return isFiring; } // 006341a0 byte Entity_Familiar::apply_baby_bender(Entity_Tear *tear) { byte isHasBabyBender; BitSet128 tearFlags; undefined1 unusedHeight [4]; undefined1 unusedFallingSpeed [4]; undefined1 unusedRange [4]; ColorMod tearColor; int tearVtable; isHasBabyBender = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(0x7f,0); if (isHasBabyBender != 0) { (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x0))) = (undefined4)(tear->_tearFlags)._l; (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._l) + 4)); (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x0))) = (undefined4)(tear->_tearFlags)._h; (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x4))) = *GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._h) + 4)); tearColor._offset[2] = (tear->_sprite)._color._offset[2]; tearColor._tint[0] = (tear->_sprite)._color._tint[0]; tearColor._tint[1] = (tear->_sprite)._color._tint[1]; tearColor._tint[2] = (tear->_sprite)._color._tint[2]; tearColor._tint[3] = (tear->_sprite)._color._tint[3]; tearColor._colorize[0] = (tear->_sprite)._color._colorize[0]; tearColor._colorize[1] = (tear->_sprite)._color._colorize[1]; tearColor._colorize[2] = (tear->_sprite)._color._colorize[2]; tearColor._colorize[3] = (tear->_sprite)._color._colorize[3]; (*GHIDRA_CAST((GHIDRA_CAST(&(tearColor._offset)) + 0x0))) = *GHIDRA_CAST((tear->_sprite)._color._offset); apply_baby_bender_tear_params (this,&tearFlags,&tearColor,unusedHeight,unusedFallingSpeed,unusedRange,1); tearVtable = *GHIDRA_CAST(tear); *GHIDRA_CAST(&(tear->_tearFlags)._l) = (undefined4)tearFlags._l; *GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._l) + 4)) = (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._l)) + 0x4))); *GHIDRA_CAST(&(tear->_tearFlags)._h) = (undefined4)tearFlags._h; *GHIDRA_CAST((GHIDRA_INT(&(tear->_tearFlags)._h) + 4)) = (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlags._h)) + 0x4))); (**(code **)(tearVtable + 0x3c))(&tearColor,0xffffffff,0xff,0,1); } return isHasBabyBender; } // 00634260 Vector * Entity_Familiar::UpdateFollowPosition(Vector *outOffset) { float fVar1; qword qVar2; char cVar3; uint uVar4; undefined4 *puVar5; void *pvVar6; Entity_Familiar *otherFamiliar; qword *allocCounter; uint listIndex; float fVar7; undefined1 *sideSign; float fVar8; undefined4 *puVar9; float fVar10; EntityList_EL familiars; int priority [2]; undefined4 *prioritySetHead; int prioritySetSize; undefined4 *local_28; float local_24; undefined1 *puStack_20; void *local_1c; undefined1 *puStack_18; int local_14; byte formationMode; int listEntity; puStack_20 = GHIDRA_CAST((priority + 0xd)); local_14 = 0xffffffff; puStack_18 = &LAB_00af6f85; local_1c = ExceptionList; uVar4 = __security_cookie ^ GHIDRA_UINT((priority + 10)); ExceptionList = &local_1c; cVar3 = FUN_00634920(uVar4); if (cVar3 == '\0') { pvVar6 = this->_player; if (*GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x1ef0)) != GHIDRA_UINT(this->_formationMode)) { (this->_formationTargetOffset).x = g_vectorZero.x; (this->_formationTargetOffset).y = g_vectorZero.y; } if (((this->_formationTargetOffset).x == g_vectorZero.x) && ((this->_formationTargetOffset).y == g_vectorZero.y)) { this->_formationMode = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + 0x1ef0)); prioritySetHead = GHIDRA_CAST(0x0); prioritySetSize = 0; puVar5 = operator_new(0x18); *puVar5 = puVar5; puVar5[1] = puVar5; puVar5[2] = puVar5; *GHIDRA_CAST((puVar5 + 3)) = 0x101; local_14 = 0; local_24 = 0.0; prioritySetHead = puVar5; if (this->_formationMode != 0) { EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&familiars,3,-1,-1,0,0) ; listIndex = 0; local_14 = CONCAT31((*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x1))),1); if (familiars._size != 0) { pvVar6 = familiars._data; do { listEntity = *GHIDRA_CAST((GHIDRA_CAST(pvVar6) + listIndex * 4)); if ((*GHIDRA_CAST((listEntity + 0x173)) == '\0') && (*GHIDRA_CAST((listEntity + 0x172)) != '\0')) { cVar3 = FUN_00634920(uVar4); if ((cVar3 == '\0') && (otherFamiliar->_player == this->_player)) { priority[0] = GetFollowerPriority(otherFamiliar); FUN_00652690(&local_28,priority); } pvVar6 = familiars._data; } listIndex = listIndex + 1; } while (listIndex < GHIDRA_UINT(familiars._size)); } puVar5 = prioritySetHead; local_28 = GHIDRA_CAST(*prioritySetHead); while ((local_28 != puVar5 && (GHIDRA_CAST(local_28[5]) != this))) { std:: _Tree_unchecked_const_iterator_>,std::_Iterator_base0> ::operator++((_Tree_unchecked_const_iterator_>,std::_Iterator_base0> *)&local_28); local_24 = (float)(GHIDRA_INT(local_24) + 1); } if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x0))) == '\0') { if (g_mainHeap == (void *)0x0) { allocCounter = &g_allocatedBytesNoHeap; } else { allocCounter = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); } if (familiars._data != (void *)0x0) { uVar4 = *GHIDRA_CAST((GHIDRA_CAST(familiars._data) + -4)); qVar2 = *allocCounter; *GHIDRA_CAST(allocCounter) = GHIDRA_UINT(*allocCounter) - uVar4; *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(allocCounter) + 4)) - GHIDRA_UINT((GHIDRA_UINT(qVar2) < uVar4)); free(GHIDRA_CAST((GHIDRA_INT(familiars._data) + -4))); puVar5 = prioritySetHead; } } } formationMode = this->_formationMode; if (formationMode == 1) { if ((GHIDRA_UINT(local_24) & 1) == 0) { sideSign = GHIDRA_CAST(0x3f800000); } else { sideSign = &DAT_bf800000; } (this->_formationTargetOffset).y = 0.0; (this->_formationTargetOffset).x = (float)(GHIDRA_INT(local_24) / 2 + 1) * 32.0 * (float)sideSign; } else if (formationMode == 2) { (this->_formationTargetOffset).x = 0.0; (this->_formationTargetOffset).y = (float)&DAT_42000000; fVar7 = local_24; if (prioritySetSize != 2) { fVar7 = (float)(GHIDRA_INT(local_24) - 1); } if (-1 < GHIDRA_INT(fVar7)) { if ((GHIDRA_UINT(fVar7) & 1) == 0) { sideSign = &DAT_bf800000; } else { sideSign = GHIDRA_CAST(0x3f800000); } fVar7 = (float)(GHIDRA_INT(fVar7) / 2 + 1) * 24.0 * (float)sideSign + 0.0; (this->_formationTargetOffset).x = fVar7; (this->_formationTargetOffset).y = (this->_formationTargetOffset).y - ABS(fVar7); } } else if (formationMode == 3) { local_28 = (undefined4 *) ((360.0 / (float)((double)prioritySetSize + __uint_to_double_fixup[-(prioritySetSize >> 0x1f)])) * (float)GHIDRA_INT(local_24) * 0.017453292); local_24 = cos((float)local_28); fVar7 = sin((float)local_28); (this->_formationTargetOffset).x = local_24 * 0.0 - fVar7 * 54.0; (this->_formationTargetOffset).y = fVar7 * 0.0 + local_24 * 54.0; } else { fVar10 = (this->_pos).x - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); fVar7 = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); (this->_formationTargetOffset).x = fVar10; (this->_formationTargetOffset).y = fVar7; (this->_formationOffset).x = fVar10; (this->_formationOffset).y = fVar7; } FID_conflict__Erase_tree_>_> (&prioritySetHead, (fuzzer_allocator_> *)&prioritySetHead, (_Tree_node *)puVar5[1]); operator_delete(prioritySetHead,0x18); } fVar7 = (this->_formationOffset).x; fVar10 = (this->_formationTargetOffset).x; if ((fVar7 != fVar10) || ((this->_formationOffset).y != (this->_formationTargetOffset).y)) { fVar8 = (this->_formationOffset).y; fVar1 = (this->_formationTargetOffset).y; (this->_formationOffset).x = (fVar10 - fVar7) * 0.1 + fVar7; (this->_formationOffset).y = (fVar1 - fVar8) * 0.1 + fVar8; } fVar8 = 0.0; local_24 = 0.0; fVar7 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1630)); fVar10 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1634)); if (this->_formationMode != 0) { if (0.1 < fVar7 * fVar7 + fVar10 * fVar10) { fVar7 = atan2f(fVar10,fVar7); fVar8 = fVar7 * 57.295776 - 90.0; } local_24 = fVar8; } puVar5 = GHIDRA_CAST(this->_formationAngle); puVar9 = puVar5; if ((float)puVar5 < 0.0) { puVar9 = GHIDRA_CAST((GHIDRA_UINT(puVar5) ^ 0x80000000)); } if (360.0 < (float)puVar9) { puVar5 = GHIDRA_CAST(fmodf((float)puVar5,360.0)); } if ((float)puVar5 <= 180.0) { if ((float)puVar5 < -180.0) { puVar5 = GHIDRA_CAST(((float)puVar5 + 360.0)); } } else { puVar5 = GHIDRA_CAST(((float)puVar5 - 360.0)); } fVar7 = local_24; if (local_24 < 0.0) { fVar7 = -local_24; } fVar10 = local_24; local_28 = puVar5; if (360.0 < fVar7) { fVar10 = fmodf(local_24,360.0); } if (fVar10 <= 180.0) { if (fVar10 < -180.0) { fVar10 = fVar10 + 360.0; } } else { fVar10 = fVar10 - 360.0; } fVar7 = fVar10 - (float)local_28; if (fVar7 < 0.0) { fVar7 = -fVar7; } puVar5 = local_28; if (180.0 < fVar7) { if (fVar10 <= (float)local_28) { fVar10 = fVar10 + 360.0; } else { puVar5 = GHIDRA_CAST(((float)local_28 + 360.0)); } } fVar10 = (fVar10 - (float)puVar5) * 0.1 + (float)puVar5; fVar7 = fVar10; if (fVar10 < 0.0) { fVar7 = -fVar10; } if (360.0 < fVar7) { fVar10 = fmodf(fVar10,360.0); } if (fVar10 <= 180.0) { if (fVar10 < -180.0) { fVar10 = fVar10 + 360.0; } } else { fVar10 = fVar10 - 360.0; } this->_formationAngle = fVar10; local_24 = fVar10 * 0.017453292; local_28 = GHIDRA_CAST(cos(local_24)); fVar8 = sin(local_24); fVar7 = (this->_formationOffset).x; fVar10 = (this->_formationOffset).y; outOffset->x = (float)local_28 * fVar7 - fVar8 * fVar10; outOffset->y = (float)local_28 * fVar10 + fVar8 * fVar7; } else { outOffset->x = g_vectorZero.x; outOffset->y = g_vectorZero.y; } ExceptionList = local_1c; return outOffset; } // 006348d0 void Entity_Familiar::reset_follow_target() { (this->_formationTargetOffset).x = g_vectorZero.x; (this->_formationTargetOffset).y = g_vectorZero.y; (this->_formationOffset).x = (this->_formationTargetOffset).x; (this->_formationOffset).y = (this->_formationTargetOffset).y; this->_formationAngle = 0.0; this->_formationMode = 0xff; return; } // 00634a40 void Entity_Familiar::ResolveOrbitConflict() { char cVar1; uint uVar2; int extraout_ECX; uint familiarIndex; uint extraout_EDX; EntityList_EL familiars; void *local_10; undefined1 *puStack_c; undefined4 local_8; local_8 = 0xffffffff; puStack_c = &LAB_00af3860; local_10 = ExceptionList; uVar2 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; ExceptionList = &local_10; if (this->_formationMode != 0) { cVar1 = FUN_00634920(uVar2); if (cVar1 == '\0') { EntityList::QuerySublist(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&familiars,3,-1,-1,0,0); familiarIndex = 0; if (familiars._size != 0) { do { if (*GHIDRA_CAST((GHIDRA_CAST(familiars._data) + familiarIndex * 4)) != this) { cVar1 = FUN_00634920(uVar2); familiarIndex = extraout_EDX; if ((cVar1 == '\0') && (*(void **)(extraout_ECX + 0x410) == this->_player)) { *GHIDRA_CAST((extraout_ECX + 0xda4)) = 0xff; } } familiarIndex = familiarIndex + 1; } while (familiarIndex < GHIDRA_UINT(familiars._size)); } if ((*GHIDRA_CAST((GHIDRA_CAST(&(familiars)) + 0x0))) == '\0') { local_8 = 0; tracked_alloc(1,familiars._data,0); } } } ExceptionList = local_10; return; } // 00634b10 void Entity_Familiar::ai_lil_spewer() { code *pcVar1; BitSet128 flags; byte bVar2; int iVar3; Entity *spawned; Entity_Tear *tear; byte rngShift2; byte rngShift3; void *pvVar4; void *extraout_ECX; uint babyIdx; uint uVar5; uint uVar6; float fVar7; EntityPtr *pEVar8; float fVar9; undefined4 uVar10; TypeDescriptor *pTVar11; TypeDescriptor *pTVar12; undefined4 uVar13; BitSet128 tearFlagsLo; float tearModifier; float baseDamage; float baseFallingSpeed; Vector fireDir; Vector local_68; EntityPtr *local_60; Vector local_5c; RNG rng; std_string *local_44; uint local_40; std_vector *local_3c; byte isAimingAtMarked; float tearColor; float local_30; float local_2c; undefined4 local_28; undefined4 local_24; undefined4 uStack_20; undefined4 uStack_1c; undefined4 uStack_18; undefined4 local_14; undefined4 local_10; undefined4 local_c; undefined4 local_8; void *babiesBegin; local_8 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U; if (this->_subtype == 0) { uVar6 = this->_initSeed ^ g_game->_dungeonPlacementSeed; local_3c = &(g_manager->_entityConfig)._babies; rng._shift1 = 1; rng._shift2 = 0x15; local_44 = GHIDRA_CAST(&DAT_00000014); local_40 = 0; do { uVar5 = (GHIDRA_INT((g_manager->_entityConfig)._babies._end) - GHIDRA_INT(local_3c->_begin)) / 0x38; if (uVar6 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar6 = uVar6 >> 1 ^ uVar6; uVar6 = uVar6 << 0x15 ^ uVar6; uVar6 = uVar6 >> 0x14 ^ uVar6; babyIdx = 0; if (uVar5 != 0) { babyIdx = uVar6 % uVar5; } babiesBegin = local_3c->_begin; local_5c.y = (float)(GHIDRA_INT(babiesBegin) + babyIdx * 0x38); uVar5 = *GHIDRA_CAST((GHIDRA_CAST(local_5c.y) + 0x34)); pvVar4 = (void *)local_5c.y; if ((GHIDRA_INT(uVar5) < 0) || ((uVar5 < 0x282 && (((uVar5 == 0 || ((g_manager->_persistentGameData)._achievements[uVar5] != 0)) || (((g_manager->_state == 2 && (g_game != GHIDRA_CAST(0x0))) && (((g_game->_dailyChallenge)._id != 0 || (g_game->_isDebug != 0)))))))))) goto LAB_00634ca6; local_40 = local_40 + 1; } while (local_40 < 10); local_40 = (GHIDRA_INT((g_manager->_entityConfig)._babies._end) - GHIDRA_INT(babiesBegin)) / 0x38 - 0x47; if (uVar6 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar6 = uVar6 >> 1 ^ uVar6; uVar6 = uVar6 << 0x15 ^ uVar6; uVar5 = 0; if (local_40 != 0) { uVar5 = (uVar6 >> 0x14 ^ uVar6) % local_40; } pvVar4 = (void *)(GHIDRA_INT(babiesBegin) + (uVar5 + 0x47) * 0x38); LAB_00634ca6: uVar6 = 0; if ((this->_sprite)._layerCount != 0) { local_44 = GHIDRA_CAST((GHIDRA_INT(pvVar4) + 0x1c)); do { (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(uVar6,local_44); uVar6 = uVar6 + 1; pvVar4 = extraout_ECX; } while (uVar6 < GHIDRA_UINT((this->_sprite)._layerCount)); } (GHIDRA_CAST((&this->_sprite)))->ANM2::LoadGraphics((byte)pvVar4); this->_subtype = 1; } rng._seed = this->_initSeed ^ g_game->_dungeonPlacementSeed; rng._shift1 = 1; rng._shift2 = 0x1b; rng._shift3 = 0x1b; if (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x173)) != '\0') { return; } iVar3 = this->_fireCooldown; if (0 < iVar3) { iVar3 = iVar3 + -1; this->_fireCooldown = iVar3; } uVar6 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x162c)); local_40 = uVar6; if (uVar6 == 0xffffffff) { if ((((-1 < this->_headFrameDelay) && (iVar3 = this->_headFrameDelay + -1, this->_headFrameDelay = iVar3, iVar3 < 0)) && (bVar2 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(&DAT_00b1cddc,1), bVar2 != 0)) && (((this->_sprite)._animState._animData != (void *)0x0 && ((GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::SetFrameFloat(0.0), (this->_sprite)._animState._animData != (void *)0x0)))) { (this->_sprite)._animState._isPlaying = 0; } } else { if (iVar3 < 1) { fVar7 = apply_tear_modifiers(this); local_44 = GHIDRA_CAST(0x0); local_60 = GHIDRA_CAST(((fVar7 * 0.25 + 0.75) * 0.8)); tearFlagsLo._l = 0; tearFlagsLo._h = 0; familiar_wisp_pick_tear_color(&rng,GHIDRA_CAST(&local_44),&tearFlagsLo); tearModifier = apply_tear_modifiers(this); if (rng._seed == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } bVar2 = (byte)rng._shift1; uVar5 = GHIDRA_UINT(rng._seed) >> (bVar2 & 0x1f) ^ rng._seed; rngShift2 = (byte)rng._shift2; uVar5 = uVar5 << (rngShift2 & 0x1f) ^ uVar5; rngShift3 = (byte)rng._shift3; uVar5 = uVar5 >> (rngShift3 & 0x1f) ^ uVar5; baseDamage = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * 2.3283062e-10 * 4.0 + 2.0; if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar5 = uVar5 >> (bVar2 & 0x1f) ^ uVar5; uVar5 = uVar5 << (rngShift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> (rngShift3 & 0x1f) ^ uVar5; baseFallingSpeed = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * 2.3283062e-10 * 0.4 - 0.2; if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar5 = uVar5 >> (bVar2 & 0x1f) ^ uVar5; uVar5 = uVar5 << (rngShift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> (rngShift3 & 0x1f) ^ uVar5; local_3c = (std_vector *) ((float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * 2.3283062e-10); if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar5 = uVar5 >> (bVar2 & 0x1f) ^ uVar5; uVar5 = uVar5 << (rngShift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> (rngShift3 & 0x1f) ^ uVar5; local_5c.y = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * 2.3283062e-10; if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar5 = uVar5 >> (bVar2 & 0x1f) ^ uVar5; local_14 = 0; local_10 = 0; uVar5 = uVar5 << (rngShift2 & 0x1f) ^ uVar5; local_c = 0; local_68.y = (float)(uVar5 >> (rngShift3 & 0x1f) ^ uVar5); local_28 = 0x3f800000; local_24 = 0; uStack_20 = 0; uStack_1c = 0; uStack_18 = 0; tearColor = (float)((double)GHIDRA_INT(local_68.y) + __uint_to_double_fixup[-(GHIDRA_INT(local_68.y) >> 0x1f)]) * 2.3283062e-10; local_30 = local_5c.y; local_2c = (float)local_3c; Isaac::GetAxisAlignedUnitVectorFromDir(&fireDir,uVar6); isAimingAtMarked = TryAimAtMarkedTarget(this,&fireDir,GHIDRA_CAST(&local_40),GHIDRA_CAST(0x0)); local_5c.y = fireDir.x * 10.0; local_3c = GHIDRA_CAST((fireDir.y * 10.0)); if (local_68.y == 0.0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar6 = GHIDRA_UINT(local_68.y) >> ((byte)rng._shift1 & 0x1f) ^ GHIDRA_UINT(local_68.y); uVar6 = uVar6 << (rngShift2 & 0x1f) ^ uVar6; uVar6 = uVar6 >> ((byte)rng._shift3 & 0x1f) ^ uVar6; local_68.y = (float)((double)GHIDRA_INT(uVar6) + __uint_to_double_fixup[-(GHIDRA_INT(uVar6) >> 0x1f)]) * 2.3283062e-10 * 0.6 + 0.7; local_68.x = local_5c.y * local_68.y; local_68.y = (float)local_3c * local_68.y; if (isAimingAtMarked == 0) { fVar7 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x360)) * 0.6; fVar9 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x364)) * 0.6; local_68.x = fVar7 + fVar7 + local_68.x; local_68.y = fVar9 + fVar9 + local_68.y; } uVar5 = Random(); uVar13 = 0; pTVar12 = &IsaacRepentancePlus::Entity_Tear::RTTI_Type_Descriptor; local_5c.x = fireDir.x * 10.0 + (this->_pos).x; pTVar11 = &IsaacRepentancePlus::Entity::RTTI_Type_Descriptor; uVar10 = 0; local_5c.y = fireDir.y * 10.0 + (this->_pos).y; spawned = (GHIDRA_CAST((g_game)))->Game::Spawn(2,GHIDRA_UINT(local_44),&local_5c,&local_68,GHIDRA_CAST(this),0,uVar5); tear = GHIDRA_CAST(__RTDynamicCast(spawned,uVar10,pTVar11,pTVar12,uVar13)); uVar5 = Random(); tear->_fallingAccel = 0.0; tear->_fallingSpeed = (float)((double)GHIDRA_INT(uVar5) + __uint_to_double_fixup[-(GHIDRA_INT(uVar5) >> 0x1f)]) * 2.3283064e-10 * 0.2 + baseFallingSpeed; tear->SetCollisionDamage(baseDamage * tearModifier); (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = (undefined4)tearFlagsLo._h; flags._l = tearFlagsLo._l; (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(tearFlagsLo._h)) + 0x4))); (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags); pEVar8 = local_60; if ((float)local_60 <= 0.01) { pEVar8 = GHIDRA_CAST(0x3c23d70a); } tear->_baseScale = (float)pEVar8; tear->_fScale = (float)pEVar8; (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); if (tear->_parent != (EntityPtr)0x0) { local_60 = &tear->_parent; std::multiset::erase(&local_60); } tear->_parent = (EntityPtr)this; std::multiset::insert(&tear->_parent); tear->SetColor(&tearColor,0xffffffff,0xff,0,1); uVar5 = Random(); tear->_tearIdx = uVar5 & 1; TryFireTear(this,tear); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); if (uVar6 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar6 = uVar6 >> ((byte)rng._shift1 & 0x1f) ^ uVar6; uVar6 = uVar6 << ((byte)rng._shift2 & 0x1f) ^ uVar6; iVar3 = apply_forgotten_lullaby(this,(uVar6 >> ((byte)rng._shift3 & 0x1f) ^ uVar6) % 0xc + 10) ; this->_fireCooldown = iVar3; this->_headFrameDelay = 0x12; } else if (this->_headFrameDelay < 9) { bVar2 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation((&PTR_DAT_00b6297c)[uVar6],1); if (((bVar2 != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) && ((GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::SetFrameFloat(0.0), (this->_sprite)._animState._animData != (void *)0x0)) { (this->_sprite)._animState._isPlaying = 0; } this->_headFrameDelay = 8; goto LAB_0063535f; } bVar2 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation((&PTR_DAT_00b6297c)[local_40],1); if (((bVar2 != 0) && ((this->_sprite)._animState._animData != (void *)0x0)) && ((GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::SetFrameFloat(2.0), (this->_sprite)._animState._animData != (void *)0x0)) { (this->_sprite)._animState._isPlaying = 0; } this->_headFrameDelay = this->_headFrameDelay + -1; } LAB_0063535f: FollowParent(this); return; } // 006378c0 void Entity_Familiar::ai_lil_harbingers() { code *pcVar1; float *pfVar2; byte bVar3; uint uVar4; uint uVar5; Entity *pEVar6; Vector *pVVar7; Vector *randomPos; EntityPtr shot; byte *pbVar8; byte *pbVar9; int iVar10; uint subtypeIndex; char *expectedName; EntityPtr *linkedEntitySlot; bool bVar11; float fVar12; float fVar13; uint entityIndex; int entityType; Vector local_64; EntityPtr local_5c; float local_58; uint entityCount; Entity *local_50; int fireDelayBySubtype [5]; float maxSpeedBySubtype [5]; uint local_24; undefined1 *puStack_20; void *local_1c; undefined1 *puStack_18; float fStack_14; Game *game; puStack_20 = GHIDRA_CAST((maxSpeedBySubtype + 0xd)); fStack_14 = -NAN; puStack_18 = &LAB_00af6ff0; local_1c = ExceptionList; uVar4 = __security_cookie ^ GHIDRA_UINT((maxSpeedBySubtype + 10)); ExceptionList = &local_1c; iVar10 = this->_state; local_24 = uVar4; pfVar2 = maxSpeedBySubtype + 0xd; if (300 < iVar10) { uVar5 = (this->_dropRNG)._seed; pfVar2 = maxSpeedBySubtype + 0xd; if (uVar5 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); uVar5 = (this->_dropRNG)._seed; pfVar2 = GHIDRA_CAST(puStack_20); if (uVar5 == 0) { pcVar1 = (code *)swi(3); (*pcVar1)(); return; } } puStack_20 = GHIDRA_CAST(pfVar2); uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift1 & 0x1f) ^ uVar5; uVar5 = uVar5 << ((byte)(this->_dropRNG)._shift2 & 0x1f) ^ uVar5; uVar5 = uVar5 >> ((byte)(this->_dropRNG)._shift3 & 0x1f) ^ uVar5; (this->_dropRNG)._seed = uVar5; this->_subtype = uVar5 % 5; (this->_targetPosition).x = g_vectorZero.x; (this->_targetPosition).y = g_vectorZero.y; init_lil_harbinger_sprite(this,uVar4); uVar4 = Random(); pEVar6 = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar4,0); pEVar6->Update(); this->_state = 0; iVar10 = 0; pfVar2 = GHIDRA_CAST(puStack_20); } puStack_20 = GHIDRA_CAST(pfVar2); local_58 = (this->_targetPosition).x; if ((local_58 == g_vectorZero.x) && ((this->_targetPosition).y == g_vectorZero.y)) { pVVar7 = (GHIDRA_CAST((g_game->_room)))->Room::GetRandomPosition(&local_64,this->_size); (this->_targetPosition).x = pVVar7->x; (this->_targetPosition).y = pVVar7->y; iVar10 = this->_state; local_58 = (this->_targetPosition).x; } this->_state = iVar10 + 1; pVVar7 = &this->_pos; local_50 = GHIDRA_CAST(((this->_targetPosition).y - (this->_pos).y)); local_58 = local_58 - pVVar7->x; fVar12 = sqrtf((float)local_50 * (float)local_50 + local_58 * local_58); if (fVar12 <= 0.0) { fVar13 = local_58; pEVar6 = local_50; } else { fVar13 = (2.0 / fVar12) * local_58; pEVar6 = GHIDRA_CAST(((2.0 / fVar12) * (float)local_50)); } (this->_velocity).x = fVar13 + (this->_velocity).x; (this->_velocity).y = (float)pEVar6 + (this->_velocity).y; iVar10 = this->_subtype; if ((iVar10 == 0) || (iVar10 == 3)) { fVar13 = pVVar7->x - (this->_targetPosition).x; fVar12 = (this->_pos).y - (this->_targetPosition).y; if (fVar12 * fVar12 + fVar13 * fVar13 < 25.0) { (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; } game = g_game; if ((((this->_flags & 0x4000) == 0) && (bVar3 = (GHIDRA_CAST((g_game)))->Game::IsPaused(), bVar3 == 0)) && ((game->_frameCount + this->_index) % 3 == 0)) { local_5c = (EntityPtr)game->_room; local_58 = 0.0; uVar4 = *GHIDRA_CAST((GHIDRA_CAST(local_5c) + 0x1264)); entityIndex = 0; local_50 = GHIDRA_CAST(0x0); entityCount = uVar4; if (uVar4 != 0) { local_64.y = *GHIDRA_CAST(&game->_deathmatchManager); do { pEVar6 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_5c) + 0x125c)) + entityIndex * 4)); if ((GHIDRA_INT(local_64.y) < 2) || (pEVar6->_type != 1)) { entityType = pEVar6->_type; uVar4 = entityCount; if (entityType - 10U < 0x3de) goto LAB_00637d3b; } else { entityType = 1; LAB_00637d3b: if (((pEVar6->_entityCollisionClass != 1) && (pEVar6->_entityCollisionClass != 0)) && ((pEVar6->_isInvicible == 0 && (pEVar6->_dead == 0)))) { bVar3 = (GHIDRA_CAST((pEVar6)))->Entity::HasEntityFlags(0x10); if (((bVar3 == 0) || (entityType == 0x322)) || (entityType == 0x362)) { fVar12 = (pEVar6->_pos).x - (this->_pos).x; fVar13 = (pEVar6->_pos).y - (this->_pos).y; fVar12 = fVar13 * fVar13 + fVar12 * fVar12; if (local_50 == GHIDRA_CAST(0x0)) { local_58 = fVar12; local_50 = pEVar6; } else if (fVar12 < local_58) { local_58 = fVar12; local_50 = pEVar6; } } uVar4 = entityCount; } } entityIndex = entityIndex + 1; } while (entityIndex < uVar4); } if (local_50 == GHIDRA_CAST(0x0)) { fVar13 = (this->_pos).x - (this->_targetPosition).x; fVar12 = (this->_pos).y - (this->_targetPosition).y; if (fVar12 * fVar12 + fVar13 * fVar13 < 25.0) { pVVar7 = (GHIDRA_CAST((GHIDRA_CAST(local_5c))))->Room::GetRandomPosition(&local_64,this->_size); (this->_targetPosition).x = pVVar7->x; (this->_targetPosition).y = pVVar7->y; } } else { fVar12 = (local_50->_pos).y; (this->_targetPosition).x = (local_50->_pos).x; (this->_targetPosition).y = fVar12; } } } else { fVar12 = pVVar7->x - (this->_targetPosition).x; fVar13 = (this->_pos).y - (this->_targetPosition).y; if (fVar13 * fVar13 + fVar12 * fVar12 < 25.0) { randomPos = (GHIDRA_CAST((g_game->_room)))->Room::GetRandomPosition(&local_64,this->_size); (this->_targetPosition).x = randomPos->x; (this->_targetPosition).y = randomPos->y; iVar10 = this->_subtype; } if (iVar10 == 1) { bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0xc,this->_index); if ((bVar3 != 0) && ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x44)) & 1) == 0)) { uVar4 = Random(); pEVar6 = this->_player; uVar5 = 0x35; goto LAB_00637be3; } } else if (((iVar10 == 2) && (bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0xc,this->_index), bVar3 != 0)) && ((*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 4)) + 0x44)) & 1) == 0)) { uVar4 = Random(); pEVar6 = this->_player; uVar5 = 0x2d; LAB_00637be3: pEVar6 = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,uVar5,pVVar7,&g_vectorZero,pEVar6,0,uVar4,0); iVar10 = __RTDynamicCast(pEVar6,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Effect::RTTI_Type_Descriptor,0); *GHIDRA_CAST((iVar10 + 0x45c)) = 0x78; *GHIDRA_CAST((iVar10 + 0x460)) = 0x78; *GHIDRA_CAST((iVar10 + 0x470)) = 1; } } uVar4 = this->_subtype; maxSpeedBySubtype[4] = 2.0; fireDelayBySubtype[4] = 0x3c; maxSpeedBySubtype[0] = 2.5; maxSpeedBySubtype[1] = 2.0; maxSpeedBySubtype[2] = 2.0; maxSpeedBySubtype[3] = 1.5; fireDelayBySubtype[0] = 0x96; fireDelayBySubtype[1] = 0x5a; fireDelayBySubtype[2] = 0x5a; fireDelayBySubtype[3] = 0x5a; if (4 < uVar4) { KAGE_LogMessage(0x10,GHIDRA_CAST("[err] Wrong Harbinger subtype %u!\n")); uVar4 = this->_subtype; } fVar12 = (this->_velocity).x; local_64.y = (this->_velocity).y; fVar12 = sqrtf(fVar12 * fVar12 + local_64.y * local_64.y); subtypeIndex = -GHIDRA_UINT((uVar4 != 0)) & uVar4; uVar5 = 4; if (subtypeIndex < 4) { uVar5 = subtypeIndex; } if (maxSpeedBySubtype[uVar5] <= fVar12 && fVar12 != maxSpeedBySubtype[uVar5]) { uVar5 = 4; if (subtypeIndex < 4) { uVar5 = subtypeIndex; } if (0.0 < fVar12) { fVar13 = maxSpeedBySubtype[uVar5]; (this->_velocity).y = (fVar13 / fVar12) * local_64.y; (this->_velocity).x = (fVar13 / fVar12) * (this->_velocity).x; uVar4 = this->_subtype; } } iVar10 = this->_fireCooldown + 1; this->_fireCooldown = iVar10; uVar4 = -GHIDRA_UINT((uVar4 != 0)) & uVar4; uVar5 = 4; if (uVar4 < 4) { uVar5 = uVar4; } if ((fireDelayBySubtype[uVar5] <= iVar10) && (this->_linkedEntity == (EntityPtr)0x0)) { this->_fireCooldown = 0; uVar4 = Random(); local_5c = (EntityPtr) (GHIDRA_CAST((g_game)))->Game::SpawnEx(3,0x2b,&this->_pos,&g_vectorZero,this->_player, this->_subtype + 1,uVar4,0); if (this->_subtype == 4) { uVar4 = Random(); local_5c = (EntityPtr) (GHIDRA_CAST((g_game)))->Game::SpawnEx(3,0x2b,&this->_pos,&g_vectorZero,this->_player, this->_subtype + 1,uVar4,0); } bVar3 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST("PreSpawn"),1); if (bVar3 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } linkedEntitySlot = &this->_linkedEntity; if (*linkedEntitySlot != (EntityPtr)0x0) { local_64.y = (float)linkedEntitySlot; std::multiset::erase(&local_64.y); } *linkedEntitySlot = local_5c; shot = (EntityPtr)0x0; if (local_5c != (EntityPtr)0x0) { std::multiset::insert(linkedEntitySlot); shot = this->_linkedEntity; } (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(shot)); } if (((this->_sprite)._animState._animData != (void *)0x0) && ((this->_sprite)._animState._isPlaying == 0)) { pbVar8 = (this->_sprite)._animState._animData; if (0xf < *GHIDRA_CAST((pbVar8 + 0x14))) { pbVar8 = *GHIDRA_CAST(pbVar8); } expectedName = "PreSpawn"; do { bVar3 = *pbVar8; bVar11 = bVar3 < (byte)*expectedName; if (bVar3 != *expectedName) { LAB_006380a0: uVar4 = -GHIDRA_UINT(bVar11) | 1; goto LAB_006380a5; } if (bVar3 == 0) break; bVar3 = pbVar8[1]; bVar11 = bVar3 < (byte)expectedName[1]; if (bVar3 != expectedName[1]) goto LAB_006380a0; pbVar8 = pbVar8 + 2; expectedName = expectedName + 2; } while (bVar3 != 0); uVar4 = 0; LAB_006380a5: if (uVar4 == 0) { pbVar8 = (this->_sprite)._animState._animData; if (pbVar8 != GHIDRA_CAST(0x0)) { pbVar9 = pbVar8; if (0xf < *GHIDRA_CAST((pbVar8 + 0x14))) { pbVar9 = *GHIDRA_CAST(pbVar8); } expectedName = "FloatDown"; do { bVar3 = *pbVar9; bVar11 = bVar3 < (byte)*expectedName; if (bVar3 != *expectedName) { LAB_006380e0: uVar4 = -GHIDRA_UINT(bVar11) | 1; goto LAB_006380e5; } if (bVar3 == 0) break; bVar3 = pbVar9[1]; bVar11 = bVar3 < (byte)expectedName[1]; if (bVar3 != expectedName[1]) goto LAB_006380e0; pbVar9 = pbVar9 + 2; expectedName = expectedName + 2; } while (bVar3 != 0); uVar4 = 0; LAB_006380e5: if ((uVar4 == 0) && ((pbVar8[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_0063811c; } bVar3 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST("FloatDown"),1); if (bVar3 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } } } LAB_0063811c: fVar12 = (this->_velocity).x; if (0.0 < ABS(fVar12)) { (this->_sprite)._flipX = fVar12 < 0.0; } ExceptionList = local_1c; return; } // 00638c10 Entity_Laser * Entity_Familiar::FireBrimstone(Vector *AimDirection, byte Unk) { EntityPtr laser; int direction; float fVar1; Vector local_4c; Vector *aimDirection; undefined4 deliriumColor; undefined4 uStack_3c; undefined4 uStack_38; undefined4 uStack_34; undefined4 local_30; undefined4 uStack_2c; undefined4 uStack_28; undefined4 uStack_24; undefined4 local_20; undefined4 local_1c; undefined4 local_18; undefined4 local_14; local_14 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 0x10U; aimDirection = AimDirection; if (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x173)) == '\0') { fVar1 = AimDirection->x; local_4c.x = fVar1 * 10.0; local_4c.y = -19.0 - ABS(fVar1) * 4.0; fVar1 = atan2f(AimDirection->y,fVar1); laser = (EntityPtr) Entity_Laser::ShootAngle(1,&this->_pos,fVar1 * 57.295776,8,&local_4c,GHIDRA_CAST(this),0); fVar1 = apply_tear_modifiers(this); (**(code **)(*GHIDRA_CAST(laser) + 0x40))(fVar1 * 3.0); *(void **)(GHIDRA_CAST(laser) + 0x4e0) = (void *)0x3f000000; (GHIDRA_CAST((GHIDRA_CAST(laser))))->Entity_Laser::ResetSpriteScale(); if (-0.5 < aimDirection->y || aimDirection->y == -0.5) { fVar1 = 3000.0; } else { fVar1 = -10.0; } *GHIDRA_CAST((GHIDRA_CAST(laser) + 0x358)) = fVar1; if (Unk == 0) { if (this->_isLilDelirium != 0) { local_20 = 0x3f800000; local_30 = 0; uStack_2c = 0; uStack_28 = 0; uStack_24 = 0; deliriumColor = 0x3e4ccccd; uStack_3c = 0x3f800000; uStack_38 = 0; uStack_34 = 0x3f800000; local_1c = 0x3f800000; local_18 = 0; (**(code **)(*GHIDRA_CAST(laser) + 0x3c))(&deliriumColor,0xffffffff,0xff,0,1); } apply_baby_bender(this,GHIDRA_CAST(laser)); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(laser)); (**(code **)(*GHIDRA_CAST(laser) + 0xc))(); if (this->_linkedEntity != (EntityPtr)0x0) { local_4c.y = (float)&this->_linkedEntity; std::multiset::erase(&local_4c.y); } this->_linkedEntity = laser; std::multiset::insert(&this->_linkedEntity); this->_headFrameDelay = 0x1e; if (ABS(aimDirection->x) <= ABS(aimDirection->y)) { direction = GHIDRA_UINT((0.0 <= aimDirection->y)) * 2 + 1; } else { direction = 2; if (aimDirection->x < 0.0) { direction = 0; } } PlayShootAnim(this,direction); } } else { laser = (EntityPtr)0x0; } return GHIDRA_CAST(laser); } // 00639000 Entity * Entity_Familiar::ThrowDip(int subType, Vector *position, Entity *spawner) { int *piVar1; uint uVar2; Entity *pEVar3; int playerColor; float *colorSlot; uint uVar4; qword *heapBytes; int *oldestDip; float score; float bestScore; undefined1 local_7c [8]; float local_74; uint dipCount; Entity *savedSpawner; int *local_64; float local_60 [15]; uint local_24; undefined1 *puStack_20; void *local_1c; undefined1 *puStack_18; float local_14; ColorMod *dipColor; float dipListData; undefined4 flagsHigh; bool isUnderCap; Entity *owner; qword prevBytes; puStack_20 = GHIDRA_CAST((local_60 + 0x17)); puStack_18 = &LAB_00af702d; local_1c = ExceptionList; uVar2 = __security_cookie ^ GHIDRA_UINT((local_60 + 0x14)); ExceptionList = &local_1c; savedSpawner = spawner; local_24 = uVar2; while( true ) { local_14 = -NAN; oldestDip = GHIDRA_CAST(0x0); bestScore = 1e+10; local_64 = GHIDRA_CAST(0x0); EntityList::QuerySublist (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST((local_7c + 4)),3,0xc9,-1 ,0,0); dipListData = local_74; local_14 = 0.0; uVar4 = 0; if (dipCount == 0) break; do { piVar1 = *GHIDRA_CAST((GHIDRA_CAST(local_74) + uVar4 * 4)); if ((((piVar1 != GHIDRA_CAST(0x0)) && (piVar1[10] == 3)) && (*GHIDRA_CAST((GHIDRA_CAST(piVar1) + 0x173)) == '\0') ) && (GHIDRA_CAST(piVar1[0x104]) == savedSpawner)) { local_60[0xc] = 10000.0; local_60[0xd] = 10000.0; local_60[0xe] = 10000.0; local_60[0] = 0.0; local_60[1] = 10000.0; local_60[2] = -200.0; local_60[3] = 20000.0; local_60[4] = 20000.0; local_60[5] = 10000.0; local_60[6] = 20000.0; local_60[7] = 0.0; local_60[8] = 0.0; local_60[9] = 0.0; local_60[10] = 0.0; local_60[0xb] = 0.0; if (GHIDRA_UINT(piVar1[0xc]) < 0xf) { score = local_60[piVar1[0xc]]; } else { score = 0.0; } score = score - (float)(g_game->_frameCount - piVar1[0xca]); if (score < bestScore) { oldestDip = piVar1; bestScore = score; } local_64 = GHIDRA_CAST((GHIDRA_INT(local_64) + 1)); } uVar4 = uVar4 + 1; } while (uVar4 < dipCount); isUnderCap = local_64 < GHIDRA_CAST(0x21); local_64 = oldestDip; if (isUnderCap) break; if (oldestDip == GHIDRA_CAST(0x0)) { KAGE_LogMessage(4,(byte *) "Entity_Familiar::ThrowDip: couldn\'t find a candidate for removal, remaining: %d\n" ); goto joined_r0x0063923f; } local_60[5] = 0.0; local_60[10] = g_vectorZero.y; local_60[0xc] = g_vectorZero.y; local_60[6] = 0.0; local_60[7] = 0.0; local_60[8] = 0.0; local_60[9] = g_vectorZero.x; local_60[0xb] = g_vectorZero.x; local_60[0xd] = 0.0; local_60[0xe] = 0.0; (**(code **)(*oldestDip + 0x24))(local_60 + 5,uVar2); local_14 = -NAN; if (local_7c[4] == '\0') { if (g_mainHeap == (void *)0x0) { heapBytes = &g_allocatedBytesNoHeap; } else { heapBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); } if (dipListData != 0.0) { uVar4 = *GHIDRA_CAST((GHIDRA_CAST(dipListData) + -4)); prevBytes = *heapBytes; *GHIDRA_CAST(heapBytes) = GHIDRA_UINT(*heapBytes) - uVar4; *GHIDRA_CAST((GHIDRA_CAST(heapBytes) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(heapBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevBytes) < uVar4)); free((void *)(GHIDRA_INT(dipListData) + -4)); } } } joined_r0x0063923f: if (local_7c[4] == '\0') { local_14 = -NAN; if (g_mainHeap == (void *)0x0) { heapBytes = &g_allocatedBytesNoHeap; } else { heapBytes = GHIDRA_CAST((GHIDRA_INT(g_mainHeap) + 0x30)); } if (dipListData != 0.0) { uVar2 = *GHIDRA_CAST((GHIDRA_CAST(dipListData) + -4)); prevBytes = *heapBytes; *GHIDRA_CAST(heapBytes) = GHIDRA_UINT(*heapBytes) - uVar2; *GHIDRA_CAST((GHIDRA_CAST(heapBytes) + 4)) = *GHIDRA_CAST((GHIDRA_CAST(heapBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(prevBytes) < uVar2)); free((void *)(GHIDRA_INT(dipListData) + -4)); } } local_14 = -NAN; uVar2 = Random(); owner = savedSpawner; pEVar3 = (GHIDRA_CAST((g_game)))->Game::Spawn(3,0xc9,position,&g_vectorZero,savedSpawner, -GHIDRA_UINT((4 < subType - 7U)) & subType,uVar2); flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&pEVar3->_flags) + 4)); *GHIDRA_CAST(&pEVar3->_flags) = GHIDRA_UINT(pEVar3->_flags) & 0xfffffffb; *GHIDRA_CAST((GHIDRA_INT(&pEVar3->_flags) + 4)) = flagsHigh; if (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (owner != GHIDRA_CAST(0x0))) && (owner->_type == 1) ) { playerColor = 0; colorSlot = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&((g_game->_playerManager))) + 0x60)))); do { if (*colorSlot == owner[5]._color._colorize[0]) goto LAB_006392f7; playerColor = playerColor + 1; colorSlot = colorSlot + 1; } while (playerColor < 4); playerColor = 5; LAB_006392f7: PlayerManager::GetPlayerColorValue(GHIDRA_CAST(local_7c),playerColor); dipColor = &(pEVar3->_sprite)._color; if (dipColor != GHIDRA_CAST((local_60 + 4))) { (pEVar3->_sprite)._color._colorize[0] = 0.0; (pEVar3->_sprite)._color._colorize[1] = 0.0; (pEVar3->_sprite)._color._colorize[2] = 0.0; (pEVar3->_sprite)._color._colorize[3] = 0.0; dipColor->_tint[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_7c)) + 0x0))); (pEVar3->_sprite)._color._tint[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)local_7c)) + 0x4))); (pEVar3->_sprite)._color._tint[2] = local_74; (pEVar3->_sprite)._color._tint[3] = 1.0; *GHIDRA_CAST((pEVar3->_sprite)._color._offset) = CONCAT44((*GHIDRA_CAST((GHIDRA_CAST(&((float)local_7c)) + 0x4))) * 0.25,(*GHIDRA_CAST((GHIDRA_CAST(&((float)local_7c)) + 0x0))) * 0.25); (pEVar3->_sprite)._color._offset[2] = local_74 * 0.25; } } ExceptionList = local_1c; return pEVar3; } // 00639750 Entity_Tear * Entity_Familiar::FireProjectile(Vector *AimDirection, byte Unk) { Entity_Player *this_00; BitSet128 flags; BitSet128 flags_00; BitSet128 flags_01; Vector velocity_00; byte bVar1; uint rngResult; int iVar2; ColorMod *other; Vector *pVVar3; uint uVar4; Entity_Tear *tear; float fVar5; int extraout_ECX; float fVar6; uint uVar7; float fVar8; undefined1 extraout_var [12]; float afVar9 [4]; float afVar10 [4]; EntityPtr *pEVar11; float fVar12; float tearDamage; float tearScale; float local_140; float fStack_13c; float local_138; float fStack_134; float local_12c; float local_128; Vector *local_124; float velocityY; float velocityX; float fallingSpeed; Vector velocity; EntityPtr *local_10c; Vector local_108; float local_100; float local_fc; Vector local_f8; Vector local_f0; float local_e8; float local_e4; float local_dc; ColorMod tmpColor; Color tearColor; TearParams hitParams; uint local_14; local_14 = __security_cookie ^ GHIDRA_UINT(&tearDamage); fallingSpeed = 0.0; velocityX = AimDirection->x * 10.0; velocityY = AimDirection->y * 10.0; velocity.x = velocityX; velocity.y = velocityY; if (Unk == 0) { iVar2 = this->_variant; if (iVar2 == 200) { tearScale = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x360)) * 0.6; local_12c = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x364)) * 0.6; tearScale = tearScale + tearScale; local_12c = local_12c + local_12c; local_124 = GHIDRA_CAST(AimDirection->x); local_128 = AimDirection->y; fVar8 = sqrtf((float)local_124 * (float)local_124 + local_128 * local_128); if (0.0 < fVar8) { local_124 = GHIDRA_CAST((AimDirection->x * (1.0 / fVar8))); local_128 = AimDirection->y * (1.0 / fVar8); } local_10c = GHIDRA_CAST(AimDirection->x); local_100 = AimDirection->y; fVar8 = sqrtf((float)local_10c * (float)local_10c + local_100 * local_100); if (fVar8 <= 0.0) { pEVar11 = local_10c; fVar8 = local_100; } else { pEVar11 = GHIDRA_CAST((AimDirection->x * (1.0 / fVar8))); fVar8 = AimDirection->y * (1.0 / fVar8); } fVar8 = fVar8 * local_12c + (float)pEVar11 * tearScale; fVar12 = local_128 * fVar8; fVar8 = (float)local_124 * fVar8; velocity.x = tearScale; velocity.y = local_12c; if (fVar12 * AimDirection->y + fVar8 * AimDirection->x < 0.0) { velocity.x = tearScale - fVar8; velocity.y = local_12c - fVar12; } velocity.x = velocityX + velocity.x; velocity.y = velocityY + velocity.y; } else { if ((iVar2 == 8) || (iVar2 == 0xf4)) { fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x360)) * 0.6; fVar12 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x364)) * 0.6; velocityX = velocityX - (fVar8 + fVar8); velocityY = velocityY - (fVar12 + fVar12); } else { fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x360)) * 0.6; fVar12 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x364)) * 0.6; velocityX = velocityX + fVar8 + fVar8; velocityY = velocityY + fVar12 + fVar12; } velocity.x = velocityX; velocity.y = velocityY; if ((velocityY * velocityY + velocityX * velocityX < 100.0) && (iVar2 != 0x6c)) { pVVar3 = (GHIDRA_CAST((&velocity)))->Vector::Normalized(&local_108); velocity.x = pVVar3->x * 10.0; velocity.y = pVVar3->y * 10.0; } } } velocityY = velocity.y; velocityX = velocity.x; if ((this->_variant == 0xce) || (this->_variant == 0xed)) { velocity_00.y = velocity.y; velocity_00.x = velocity.x; tear = fire_wisp_projectile(this,velocity_00); return tear; } uVar7 = 0; local_12c = 0.0; local_140 = 0.0; fStack_13c = 0.0; local_138 = 0.0; fStack_134 = 0.0; local_124 = GHIDRA_CAST(apply_tear_modifiers(this)); fVar8 = apply_tear_modifiers(this); fVar12 = 0.8; tearDamage = 3.5; local_10c = GHIDRA_CAST(0x0); afVar9[0] = (fVar8 * 0.25 + 0.75) * 0.8; afVar9[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)extraout_var)) + 0x0))); afVar9[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)extraout_var)) + 0x4))); afVar9[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)extraout_var)) + 0x8))); tearScale = afVar9[0]; (GHIDRA_CAST((&tearColor)))->Color::Color(); uVar4 = this->_variant; if (uVar4 == 0x4a) { local_100 = (float)this->_subtype; LAB_00639ad8: local_128 = 0.0; if (local_100 == 1.12104e-44) goto LAB_00639ae3; } else { local_100 = -NAN; if (uVar4 != 0xb) goto LAB_00639ad8; LAB_00639ae3: rngResult = Random(); afVar9 = (float [4])ZEXT416(GHIDRA_UINT(tearScale)); fVar12 = 0.8; uVar4 = this->_variant; local_128 = (float)(rngResult % 10 + 1); } afVar10 = afVar9; if (uVar4 == 0xc) { local_140 = (float)g_tearFlagPiercing._l; fStack_13c = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPiercing._l)) + 0x4))); local_138 = (float)g_tearFlagPiercing._h; fStack_134 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagPiercing._h)) + 0x4))); if (this->_player != GHIDRA_CAST(0x0)) { iVar2 = (GHIDRA_CAST((this->_player)))->Entity_Player::GetTrinketMultiplier(0x36); afVar10 = afVar9; if (1 < iVar2) { tearDamage = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1470)); if (2 < iVar2) { (*GHIDRA_CAST((GHIDRA_CAST(&(afVar10)) + 0x0))) = (double)tearDamage * 1.5; afVar10[2] = 0.0; afVar10[3] = 0.0; tearDamage = (*GHIDRA_CAST((GHIDRA_CAST(&((float)afVar10)) + 0x0))); } } } goto LAB_0063a552; } (*GHIDRA_CAST((GHIDRA_CAST(&(afVar10)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(afVar9)) + 0x4))); if (((uVar4 == 9) || (local_128 == 1.4013e-45)) || (local_100 == 8.40779e-45)) { local_140 = (float)g_tearFlagSpectral._l; fStack_13c = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._l)) + 0x4))); tearColor._tint[0] = _DAT_00babc50; tearColor._tint[1] = _UNK_00babc54; tearColor._tint[2] = _UNK_00babc58; tearColor._tint[3] = _UNK_00babc5c; local_138 = (float)g_tearFlagSpectral._h; fStack_134 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._h)) + 0x4))); afVar10 = _DAT_00babc50; } else { fVar8 = afVar9[0]; if (((uVar4 == 10) || (local_128 == 2.8026e-45)) || (local_100 == 9.80909e-45)) { tearScale = fVar8 * 0.9; uVar7 = 1; local_12c = 1.4013e-45; (*GHIDRA_CAST((GHIDRA_CAST(&(afVar10)) + 0x0))) = ZEXT812(0x40800000); afVar10[3] = 0.0; tearDamage = afVar10[0]; goto LAB_0063a552; } if ((local_128 == 4.2039e-45) || (local_100 == 1.12104e-44)) { uVar7 = 1; afVar10[0] = fVar8 * fVar12; afVar10[1] = (float)afVar9[1]; afVar10[2] = (float)afVar9[2]; afVar10[3] = (float)afVar9[3]; local_12c = 1.4013e-45; fallingSpeed = 1.2; tearDamage = 3.0; tearScale = afVar10[0]; goto LAB_0063a552; } if (((uVar4 == 6) || (local_128 == 5.60519e-45)) || (local_100 == 5.60519e-45)) { afVar10[0] = fVar8 * 1.06; uVar7 = 1; local_12c = 1.4013e-45; tearDamage = 5.0; tearScale = afVar10[0]; goto LAB_0063a552; } if (((uVar4 == 4) || (local_128 == 7.00649e-45)) || (local_100 == 2.8026e-45)) { local_140 = (float)(GHIDRA_UINT(g_tearFlagSlow._l) | GHIDRA_UINT(g_tearFlagGish._l)); fStack_13c = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSlow._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGish._l)) + 0x4)))); local_138 = (float)(GHIDRA_UINT(g_tearFlagSlow._h) | GHIDRA_UINT(g_tearFlagGish._h)); fStack_134 = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSlow._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagGish._h)) + 0x4)))); tearColor._tint[0] = _DAT_00bac560; tearColor._tint[1] = _UNK_00bac564; tearColor._tint[2] = _UNK_00bac568; tearColor._tint[3] = _UNK_00bac56c; tearColor._offset[0] = -0.5882353; tearColor._offset[1] = -0.5882353; tearColor._offset[2] = -0.5882353; afVar10 = _DAT_00bac560; goto LAB_0063a552; } if (((uVar4 == 5) || (local_128 == 8.40779e-45)) || (local_100 == 4.2039e-45)) { uVar7 = 0x15; local_140 = (float)g_tearFlagHoming._l; fStack_13c = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._l)) + 0x4))); fallingSpeed = -3.0; local_12c = 2.94273e-44; local_138 = (float)g_tearFlagHoming._h; fStack_134 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._h)) + 0x4))); goto LAB_0063a54a; } if ((uVar4 == 0xd) || (local_128 == 9.80909e-45)) { local_140 = (float)(GHIDRA_UINT((float)g_tearFlagSpectral._l) | GHIDRA_UINT((float)g_tearFlagHoming._l)); fStack_13c = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(g_tearFlagSpectral._l))) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(g_tearFlagHoming._l))) + 0x4)))); local_138 = (float)(GHIDRA_UINT((float)g_tearFlagSpectral._h) | GHIDRA_UINT((float)g_tearFlagHoming._h)); fStack_134 = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(g_tearFlagSpectral._h))) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(g_tearFlagHoming._h))) + 0x4)))); fallingSpeed = -3.0; tearColor._tint[0] = _DAT_00babc50; tearColor._tint[1] = _UNK_00babc54; tearColor._tint[2] = _UNK_00babc58; tearColor._tint[3] = _UNK_00babc5c; afVar10 = _DAT_00babc50; goto LAB_0063a552; } if (uVar4 == 0x2d) { local_12c = 1.4013e-45; uVar7 = 1; goto LAB_0063a552; } if (((0x45 < uVar4) && (uVar4 < 0x49)) || (local_128 == 1.12104e-44)) { uVar4 = Random(); if ((uVar4 % 10 == 0) || (local_128 == 1.12104e-44)) { local_140 = (float)g_tearFlagCharm._l; fStack_13c = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCharm._l)) + 0x4))); local_138 = (float)g_tearFlagCharm._h; fStack_134 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCharm._h)) + 0x4))); } tearColor._tint[0] = _DAT_00bac6e0; tearColor._tint[1] = _UNK_00bac6e4; tearColor._tint[2] = _UNK_00bac6e8; tearColor._tint[3] = _UNK_00bac6ec; tearColor._offset[0] = 0.19607845; tearColor._offset[1] = 0.0; tearColor._offset[2] = 0.0; afVar10 = _DAT_00bac6e0; if (this->_variant == 0x48) { local_140 = (float)(GHIDRA_UINT(local_140) | GHIDRA_UINT(g_tearFlagHpDrop._l)); fStack_13c = (float)(GHIDRA_UINT(fStack_13c) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHpDrop._l)) + 0x4)))); local_138 = (float)(GHIDRA_UINT(local_138) | GHIDRA_UINT(g_tearFlagHpDrop._h)); fStack_134 = (float)(GHIDRA_UINT(fStack_134) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHpDrop._h)) + 0x4)))); } goto LAB_0063a552; } if (((uVar4 == 7) || (local_100 == 7.00649e-45)) || (local_128 == 1.4013e-44)) { tearColor._tint[0] = _DAT_00babfa0; tearColor._tint[1] = _UNK_00babfa4; tearColor._tint[2] = _UNK_00babfa8; tearColor._tint[3] = _UNK_00babfac; tearDamage = 6.0; afVar10 = _DAT_00babfa0; goto LAB_0063a552; } if (uVar4 == 0x6b) { tearDamage = 6.0; tmpColor._colorize = (float [4])ZEXT816(0); local_12c = 8.40779e-45; tmpColor._tint[0] = _DAT_00bac7b0; tmpColor._tint[1] = _UNK_00bac7b4; tmpColor._tint[2] = _UNK_00bac7b8; tmpColor._tint[3] = _UNK_00bac7bc; tmpColor._offset[0] = 0.0; tmpColor._offset[1] = 0.2; tmpColor._offset[2] = 0.4; afVar10 = _DAT_00bac7b0; (GHIDRA_CAST((&tearColor)))->Color::operator_assign(&tmpColor); uVar7 = 6; goto LAB_0063a552; } if ((uVar4 == 0x61) || (local_100 == 1.4013e-44)) { tearColor._tint[0] = _DAT_00babfa0; tearColor._tint[1] = _UNK_00babfa4; tearColor._tint[2] = _UNK_00babfa8; tearColor._tint[3] = _UNK_00babfac; afVar10 = _DAT_00babfa0; goto LAB_0063a552; } if (((uVar4 == 0x50) || (uVar4 == 0x51)) || (uVar4 == 0x4c)) { this_00 = this->_player; uVar4 = Random(); Entity_Player::GetTearHitParams (this_00,&hitParams,1,(float)local_124,(uVar4 & 1) * 2 + -1,GHIDRA_CAST(0x0)); (GHIDRA_CAST((&tearColor)))->Color::operator_assign(&hitParams._tearColor); local_fc = (float)(~(GHIDRA_UINT(g_tearFlagMulligan._h) | GHIDRA_UINT(g_tearFlagLudovico._h) | GHIDRA_UINT(g_tearFlagHpDrop._h)) & GHIDRA_UINT(hitParams._flags._h)); local_108.x = (float)(~((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagMulligan._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHpDrop._l)) + 0x4)))) & (*GHIDRA_CAST((GHIDRA_CAST(&(hitParams._flags._l)) + 0x4)))); local_f8.x = (float)(~((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagMulligan._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagLudovico._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHpDrop._h)) + 0x4)))) & (*GHIDRA_CAST((GHIDRA_CAST(&(hitParams._flags._h)) + 0x4)))); fVar8 = (float)(~(GHIDRA_UINT(g_tearFlagMulligan._l) | GHIDRA_UINT(g_tearFlagLudovico._l) | GHIDRA_UINT(g_tearFlagHpDrop._l)) & GHIDRA_UINT(hitParams._flags._l)); tearDamage = hitParams._tearDamage; local_140 = fVar8; fStack_13c = local_108.x; local_138 = local_fc; fStack_134 = local_f8.x; bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x95,0); if (bVar1 != 0) { fStack_13c = (float)(GHIDRA_UINT(local_108.x) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagExplosive._l)) + 0x4)))); local_140 = (float)(GHIDRA_UINT(fVar8) | GHIDRA_UINT(g_tearFlagExplosive._l)); local_138 = (float)(GHIDRA_UINT(local_fc) | GHIDRA_UINT(g_tearFlagExplosive._h)); fStack_134 = (float)(GHIDRA_UINT(local_f8.x) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagExplosive._h)) + 0x4)))); } tearScale = hitParams._tearScale; fallingSpeed = -*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1478)); local_10c = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x147c)); afVar10 = (float [4])ZEXT416(local_10c); local_12c = (float)hitParams._tearVariant; uVar7 = hitParams._tearVariant; goto LAB_0063a552; } if ((uVar4 == 0x58) && (this->_state == 2)) { uVar4 = Random(); afVar10 = afVar9; if (uVar4 % 10 == 0) { local_140 = (float)g_tearFlagCoinDrop._l; fStack_13c = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCoinDrop._l)) + 0x4))); local_138 = (float)g_tearFlagCoinDrop._h; fStack_134 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagCoinDrop._h)) + 0x4))); goto LAB_0063a54a; } } iVar2 = this->_variant; if (iVar2 == 0x5c) { fStack_13c = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._l)) + 0x4))); local_140 = (float)g_tearFlagHoming._l; fStack_134 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._h)) + 0x4))); local_138 = (float)g_tearFlagHoming._h; (GHIDRA_CAST((GHIDRA_CAST(&tmpColor))))->Color::Color(); (GHIDRA_CAST((&tearColor)))->Color::operator_assign(other); if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { tearDamage = 10.0; } else { tearDamage = 6.0; } tearScale = 1.1; velocityX = velocityX * 0.75; fallingSpeed = -0.75; velocityY = velocityY * 0.75; afVar10 = (float [4])ZEXT416(GHIDRA_UINT(velocityY)); velocity.x = velocityX; velocity.y = velocityY; goto LAB_0063a552; } if (iVar2 == 0x4c) { tearDamage = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x157c)); goto LAB_0063a552; } if (iVar2 == 0x6c) { local_12c = 1.4013e-45; pVVar3 = MusicManager::RandomVector(&local_108); uVar4 = Random(); fVar8 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283064e-10; fVar12 = fVar8 * pVVar3->y; fVar8 = fVar8 * pVVar3->x; velocityX = fVar8 + fVar8 + velocityX; velocityY = velocityY + fVar12 + fVar12; velocity.x = velocityX; velocity.y = velocityY; uVar4 = Random(); uVar7 = Random(); local_10c = GHIDRA_CAST(0x3f000000); tearScale = tearScale * ((float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283064e-10 * 0.05 + ((float)(uVar4 & 1) + 0.0) * 0.4 + 0.9); uVar4 = Random(); fallingSpeed = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283064e-10 * 15.0 + 5.0; afVar10 = (float [4])ZEXT416(GHIDRA_UINT(fallingSpeed)); fallingSpeed = 0.0 - fallingSpeed; uVar7 = 1; goto LAB_0063a552; } if (iVar2 == 8) { iVar2 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13c0)); if ((iVar2 == 2) || (iVar2 == 0x17)) goto LAB_0063a061; LAB_0063a140: if (local_100 != 1.54143e-44) goto LAB_0063a552; } else { if (iVar2 == 0xf4) { LAB_0063a061: local_12c = 1.4013e-45; tearDamage = 7.5; uVar7 = 1; goto LAB_0063a552; } if (iVar2 == 200) { tmpColor._tint[2] = 1.0; tmpColor._tint[0] = 1.0; tmpColor._tint[1] = 1.0; tmpColor._tint[3] = 1.0; tearDamage = 1.5; tmpColor._colorize[0] = _DAT_00bac850; tmpColor._colorize[1] = _UNK_00bac854; tmpColor._colorize[2] = _UNK_00bac858; tmpColor._colorize[3] = _UNK_00bac85c; tmpColor._offset[0] = 0.4; tmpColor._offset[1] = 0.4; tmpColor._offset[2] = 0.38; afVar10 = _DAT_00bac850; (GHIDRA_CAST((&tearColor)))->Color::operator_assign(&tmpColor); goto LAB_0063a552; } if (iVar2 == 0xe1) { fVar8 = 3.0; tearDamage = 3.0; Random(); FUN_0067af30(); fallingSpeed = 0.0; tearScale = fVar8 * 1.25 * tearScale; (*GHIDRA_CAST((GHIDRA_CAST(&(afVar10)) + 0x0))) = ZEXT812(0xbccccccd); afVar10[3] = 0.0; local_10c = afVar10[0]; goto LAB_0063a552; } if (iVar2 != 0xd1) goto LAB_0063a140; } uVar7 = 0x29; tearScale = tearScale * 1.1; afVar10 = (float [4])ZEXT416(GHIDRA_UINT(tearScale)); local_dc = (float)g_tearFlagIce._l; local_f8.x = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagIce._l)) + 0x4))); local_140 = (float)g_tearFlagIce._l; fStack_13c = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagIce._l)) + 0x4))); local_12c = 5.74532e-44; local_fc = (float)g_tearFlagIce._h; local_108.x = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagIce._h)) + 0x4))); local_138 = (float)g_tearFlagIce._h; fStack_134 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagIce._h)) + 0x4))); uVar4 = Random(); if (uVar4 % 10 != 0) goto LAB_0063a552; local_140 = (float)(GHIDRA_UINT(local_dc) | GHIDRA_UINT(g_tearFlagFreeze._l)); fStack_13c = (float)(GHIDRA_UINT(local_f8.x) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFreeze._l)) + 0x4)))); local_138 = (float)(GHIDRA_UINT(local_fc) | GHIDRA_UINT(g_tearFlagFreeze._h)); fStack_134 = (float)(GHIDRA_UINT(local_108.x) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagFreeze._h)) + 0x4)))); } LAB_0063a54a: LAB_0063a552: if (this->_isLilDelirium != 0) { if (uVar7 == 0) { uVar7 = 1; } tearColor._colorize[0] = _DAT_00bac940; tearColor._colorize[1] = _UNK_00bac944; tearColor._colorize[2] = _UNK_00bac948; tearColor._colorize[3] = _UNK_00bac94c; afVar10 = _DAT_00bac940; local_12c = (float)uVar7; } local_108.x = (float)(GHIDRA_UINT(fStack_134) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBurstsplit._h)) + 0x4)))); if ((((GHIDRA_UINT(local_140) & GHIDRA_UINT(g_tearFlagBurstsplit._l)) != 0 || (GHIDRA_UINT(fStack_13c) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagBurstsplit._l)) + 0x4)))) != 0) || ((GHIDRA_UINT(local_138) & GHIDRA_UINT(g_tearFlagBurstsplit._h)) != 0 || GHIDRA_CAST(local_108.x) != GHIDRA_CAST(0x0))) && (bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xe9,0), bVar1 == 0)) { fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1474)); fallingSpeed = ((fVar8 * 0.75) / *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1464))) * (23.75 / -fVar8); (*GHIDRA_CAST((GHIDRA_CAST(&(afVar10)) + 0x0))) = ZEXT812(0x3fa66666); afVar10[3] = 0.0; local_10c = afVar10[0]; } if (this->_player != GHIDRA_CAST(0x0)) { bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::IsHologram(); if (bVar1 != 0) { afVar10 = (float [4])ZEXT416(GHIDRA_UINT((tearColor._tint[3] * 0.25))); tearColor._tint[3] = tearColor._tint[3] * 0.25; } if ((g_manager->_netplayManager != *GHIDRA_CAST((g_manager + 1))) && (bVar1 = NetplayManager::IsIdxLocalPlayer (&g_manager->_netplayManager,*GHIDRA_CAST((extraout_ECX + 0x1618))), bVar1 == 0 )) { FUN_00925df0(); tearColor._tint[3] = afVar10[0] * tearColor._tint[3]; } } if (((this->_variant == 10) || (local_128 == 1.26117e-44)) || (local_100 == 9.80909e-45)) { local_128 = 2.8026e-45; local_f0.x = velocityX - velocityY * 0.2; local_f0.y = velocityX * 0.2 + velocityY; local_e8 = velocityY * 0.2 + velocityX; local_e4 = velocityY - velocityX * 0.2; tearDamage = tearDamage * (float)local_124; if (tearScale <= 0.01) { tearScale = 0.01; } local_124 = &local_f0; do { pVVar3 = local_124; uVar4 = Random(); tear = (Entity_Tear *) (GHIDRA_CAST((g_game)))->Game::SpawnEx(2,GHIDRA_UINT(local_12c),&this->_pos,pVVar3,GHIDRA_CAST(this),0,uVar4,0); uVar4 = Random(); tear->_fallingSpeed = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283064e-10 * 0.2 + fallingSpeed; tear->_fallingAccel = (float)local_10c; tear->SetCollisionDamage(tearDamage); (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._l)) + 0x4))) = local_140; (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._l)) + 0x0))) = tearScale; (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._h)) + 0x0))) = fStack_13c; (*GHIDRA_CAST((GHIDRA_CAST(&(flags_01._h)) + 0x4))) = local_138; (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags_01); tear->_baseScale = tearDamage; tear->_fScale = tearDamage; (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); tear->SetColor(tmpColor._offset + 2,0xffffffff,0xff,0,1); if (tear->_parent != (EntityPtr)0x0) { local_108.x = (float)&tear->_parent; std::multiset::erase(&local_108); } tear->_parent = (EntityPtr)this; std::multiset::insert(&tear->_parent); uVar4 = Random(); tear->_tearIdx = uVar4 & 1; TryFireTear(this,tear); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); local_124 = local_124 + 1; local_128 = (float)(GHIDRA_INT(local_128) + -1); } while (local_128 != 0.0); return tear; } tearDamage = tearDamage * (float)local_124; if (tearScale <= 0.01) { tearScale = 0.01; } if (this->_variant != 200) { uVar4 = Random(); tear = (Entity_Tear *) (GHIDRA_CAST((g_game)))->Game::SpawnEx(2,uVar7,&this->_pos,&velocity,GHIDRA_CAST(this),0,uVar4,0); uVar4 = Random(); tear->_fallingSpeed = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283064e-10 * 0.2 + fallingSpeed; tear->_fallingAccel = (float)local_10c; tear->SetCollisionDamage(tearDamage); (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._l)) + 0x4))) = local_140; (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._l)) + 0x0))) = tearScale; (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x0))) = fStack_13c; (*GHIDRA_CAST((GHIDRA_CAST(&(flags_00._h)) + 0x4))) = local_138; (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags_00); tear->_baseScale = tearDamage; tear->_fScale = tearDamage; (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); if (tear->_parent != (EntityPtr)0x0) { local_10c = &tear->_parent; std::multiset::erase(&local_10c); } tear->_parent = (EntityPtr)this; std::multiset::insert(&tear->_parent); tear->SetColor(tmpColor._offset + 2,0xffffffff,0xff,0,1); uVar4 = Random(); tear->_tearIdx = uVar4 & 1; TryFireTear(this,tear); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); return tear; } local_124 = GHIDRA_CAST(0x0); do { local_128 = ((float)GHIDRA_INT(local_124) / 3.0) * 10.0 - 5.0; local_108.x = (((float)GHIDRA_INT(local_124) / 3.0) * 180.0 - 90.0) * 0.017453292; local_fc = cos(local_108.x); fVar8 = sin(local_108.x); local_128 = local_128 * 0.017453292; local_f8.x = (AimDirection->x * local_fc - AimDirection->y * fVar8) * 10.0 + (this->_pos).x; local_f8.y = (AimDirection->y * local_fc + AimDirection->x * fVar8) * 10.0 + (this->_pos).y; local_108.x = cos(local_128); fVar8 = sin(local_128); velocity.x = velocityX * local_108.x - velocityY * fVar8; velocity.y = velocityY * local_108.x + velocityX * fVar8; uVar4 = Random(); tear = (Entity_Tear *) (GHIDRA_CAST((g_game)))->Game::SpawnEx(2,GHIDRA_UINT(local_12c),&local_f8,&velocity,GHIDRA_CAST(this),0,uVar4,0); uVar4 = Random(); tear->_fallingSpeed = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283064e-10 * 0.2 + fallingSpeed; tear->_fallingAccel = (float)local_10c; tear->SetCollisionDamage(tearDamage); uVar4 = Random(); if (uVar4 % 10 == 0) { fVar8 = tearScale; fVar12 = local_140; fVar6 = fStack_13c; fVar5 = local_138; } else { fVar8 = (float)(GHIDRA_UINT(tearScale) | GHIDRA_UINT(g_tearFlagSlow._l)); fVar12 = (float)(GHIDRA_UINT(local_140) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSlow._l)) + 0x4)))); fVar6 = (float)(GHIDRA_UINT(fStack_13c) | GHIDRA_UINT(g_tearFlagSlow._h)); fVar5 = (float)(GHIDRA_UINT(local_138) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSlow._h)) + 0x4)))); local_f8.y = fVar8; local_f0.x = fVar12; local_f0.y = fVar6; local_e8 = fVar5; } (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = fVar12; (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = fVar8; (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = fVar6; (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = fVar5; (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags); tear->_baseScale = tearDamage; tear->_fScale = tearDamage; (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); tear->SetColor(tmpColor._offset + 2,0xffffffff,0xff,0,1); if (tear->_parent != (EntityPtr)0x0) { local_108.x = (float)&tear->_parent; std::multiset::erase(&local_108); } tear->_parent = (EntityPtr)this; std::multiset::insert(&tear->_parent); uVar4 = Random(); tear->_tearIdx = uVar4 & 1; TryFireTear(this,tear); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); local_124 = GHIDRA_CAST((GHIDRA_INT(local_124) + 1)); } while (GHIDRA_INT(local_124) < 4); return tear; } // 0063aef0 Entity_Laser * Entity_Familiar::sprinkler_shoot_laser(float angle, float distance) { Entity_Player *this_00; Entity_Laser *pEVar1; uint rngResult; int iVar2; float fVar3; undefined1 auStack_90 [4]; float distanceLocal; float angleRad; float local_84; Vector laserOffset; TearParams tearParams; uint local_c; bool isSpectral; local_c = __security_cookie ^ GHIDRA_UINT(auStack_90); angleRad = angle * 0.017453292; distanceLocal = distance; local_84 = angle; fVar3 = cos(angleRad); laserOffset.x = fVar3 * distanceLocal + 0.0; fVar3 = sin(angleRad); laserOffset.y = fVar3 * distanceLocal - 32.0; pEVar1 = Entity_Laser::ShootAngle(2,&this->_pos,local_84,3,&laserOffset,GHIDRA_CAST(this),0); pEVar1->_oneHit = 1; this_00 = this->_player; rngResult = Random(); Entity_Player::GetTearHitParams(this_00,&tearParams,3,1.0,(rngResult & 1) * 2 + -1,GHIDRA_CAST(0x0)); iVar2 = *GHIDRA_CAST(pEVar1); *GHIDRA_CAST(&(pEVar1->_tearFlags)._l) = (undefined4)tearParams._flags._l; *GHIDRA_CAST((GHIDRA_INT(&(pEVar1->_tearFlags)._l) + 4)) = (*GHIDRA_CAST((GHIDRA_CAST(&(tearParams._flags._l)) + 0x4))); *GHIDRA_CAST(&(pEVar1->_tearFlags)._h) = (undefined4)tearParams._flags._h; *GHIDRA_CAST((GHIDRA_INT(&(pEVar1->_tearFlags)._h) + 4)) = (*GHIDRA_CAST((GHIDRA_CAST(&(tearParams._flags._h)) + 0x4))); (**(code **)(iVar2 + 0x3c))(&tearParams._tearColor,0xffffffff,0xff,0,1); pEVar1->SetCollisionDamage((*GHIDRA_CAST((GHIDRA_CAST(&(tearParams)) + 0x34)))); if (((GHIDRA_UINT(tearParams._tearColor._colorize[2]) & GHIDRA_UINT(g_tearFlagSpectral._l)) == 0 && (GHIDRA_UINT(tearParams._tearColor._colorize[3]) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._l)) + 0x4)))) == 0) && ((GHIDRA_UINT(tearParams._tearColor._offset[0]) & GHIDRA_UINT(g_tearFlagSpectral._h)) == 0 && (GHIDRA_UINT(tearParams._tearColor._offset[1]) & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._h)) + 0x4)))) == 0)) { isSpectral = false; } else { isSpectral = true; } pEVar1->_renderDepthOffset = 3000.0; iVar2 = 3; if (isSpectral) { iVar2 = 6; } pEVar1->_entityGridCollisionClass = iVar2; return pEVar1; } // 0063b340 void Entity_Familiar::update_idle_anim_by_size() { byte bVar1; byte *currentName; uint compareResult; byte *wantedName; uint sizeIdx; bool isLess; float scaledY; float targetSize [2]; byte animName [32]; uint local_c; byte *animData; float baseSize; local_c = __security_cookie ^ GHIDRA_UINT(targetSize); targetSize[0] = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x15c)) * *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0xe4)) * 100.0; if (this->_orbitSpeed == targetSize[0]) { return; } sizeIdx = 0; do { if (targetSize[0] < (float)(&DAT_00b644a0)[sizeIdx] * 1.5) break; sizeIdx = sizeIdx + 1; } while (sizeIdx < 4); FUN_00652a30(animName,0x20,"Idle%d",sizeIdx); animData = (this->_sprite)._animState._animData; if (animData != GHIDRA_CAST(0x0)) { currentName = animData; if (0xf < *GHIDRA_CAST((animData + 0x14))) { currentName = *GHIDRA_CAST(animData); } wantedName = animName; do { bVar1 = *currentName; isLess = bVar1 < *wantedName; if (bVar1 != *wantedName) { LAB_0063b402: compareResult = -GHIDRA_UINT(isLess) | 1; goto LAB_0063b407; } if (bVar1 == 0) break; bVar1 = currentName[1]; isLess = bVar1 < wantedName[1]; if (bVar1 != wantedName[1]) goto LAB_0063b402; currentName = currentName + 2; wantedName = wantedName + 2; } while (bVar1 != 0); compareResult = 0; LAB_0063b407: if ((compareResult == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_0063b43a; } bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(animName,1); if (bVar1 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } LAB_0063b43a: baseSize = (float)(&DAT_00b644a0)[sizeIdx]; scaledY = targetSize[0] * g_vectorOne.y; (this->_sprite)._scale.x = (targetSize[0] * g_vectorOne.x) / baseSize; (this->_sprite)._scale.y = scaledY / baseSize; this->_orbitSpeed = targetSize[0]; this->_size = targetSize[0]; return; } // 0063b8b0 void Entity_Familiar::RemoveFromPlayer(byte UnusedRemoveFamiliar) { uint *_Src; short *psVar1; void **ppvVar2; void *pvVar3; Entity_Player *this_00; byte bVar4; ItemConfig_Item *item; uint uVar5; uint familiarFlagBit; int *piVar6; uint *puVar7; undefined2 newCount; int removedCount; int iVar8; RNG local_38; uint collectibleId; int removeIndex; int removeCount; char isEvaluateNeeded; int local_18 [5]; int currentCount; uint *levelItemsEnd; Manager *manager; local_18[4] = __security_cookie ^ GHIDRA_UINT((local_18 + 5)); this->Remove(); manager = g_manager; item = this->_item; isEvaluateNeeded = '\0'; switch(this->_variant) { case 0x1c: bVar4 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xef,0); iVar8 = (bVar4 != 0) + 0xee; goto LAB_0063b918; case 0x41: pvVar3 = this->_player; bVar4 = (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar3) + 0x1508)))))->TemporaryEffects::HasNullEffect(0x6b); if (bVar4 != 0) { (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar3) + 0x1508)))))->TemporaryEffects::RemoveNullEffect(0x6b,1); goto LAB_0063bcad; } break; case 0x66: local_38._seed = this->_initSeed; local_38._shift1 = 2; local_38._shift2 = 0x15; local_38._shift3 = 9; local_18[1] = 0x90; local_18[2] = 0x116; local_18[3] = 0x184; uVar5 = (GHIDRA_CAST((&local_38)))->RNG::RandomInt(3); iVar8 = local_18[uVar5 + 1]; LAB_0063b918: item = (GHIDRA_CAST((&manager->_itemConfig)))->ItemConfig::GetCollectible(iVar8); isEvaluateNeeded = '\x01'; break; case 0x67: iVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1382)) + -1; newCount = 0; if (0 < iVar8) { newCount = (short)iVar8; } *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1382)) = newCount; goto LAB_0063bcad; case 0x71: iVar8 = this->_player->_playerForms[0xc]; if (iVar8 < 1) { return; } (GHIDRA_CAST((this->_player)))->Entity_Player::IncrementPlayerFormCounter(0xc,-iVar8); return; case 0xf4: (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1508)))))->TemporaryEffects::RemoveNullEffect(0x6b,1); goto LAB_0063bcad; } if (item != GHIDRA_CAST(0x0)) { iVar8 = item->type; if (((iVar8 == 1) || (iVar8 == 3)) || (iVar8 == 4)) { uVar5 = item->id; removeCount = 0; collectibleId = uVar5; bVar4 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x19d,0); if ((bVar4 == 0) && (bVar4 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x19c,0), bVar4 == 0) ) { LAB_0063bb29: if (uVar5 == 10) { pvVar3 = (this->_player->_pillEffectUses)._begin; iVar8 = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x28)); if (iVar8 < 1) { bVar4 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(10,0); if (bVar4 == 0) { iVar8 = 0; } else { iVar8 = 1; removeCount = 1; piVar6 = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x16d4)) + 0x28)); *piVar6 = *piVar6 + 1; } goto LAB_0063bc53; } *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + 0x28)) = iVar8 + -1; } else { LAB_0063bbd4: if (uVar5 != 0x20d) { if (uVar5 == 0x49) { iVar8 = this->_variant + -0x2b; currentCount = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x153c)); removedCount = currentCount; if (iVar8 < currentCount) { removedCount = iVar8; } iVar8 = iVar8 - removedCount; *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x153c)) = currentCount - removedCount; removeCount = iVar8; } else { familiarFlagBit = 0; if (uVar5 != 0xcf) goto LAB_0063bad8; iVar8 = this->_variant + -0x44; currentCount = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1540)); removedCount = currentCount; if (iVar8 < currentCount) { removedCount = iVar8; } iVar8 = iVar8 - removedCount; *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1540)) = currentCount - removedCount; removeCount = iVar8; } goto LAB_0063bc53; } psVar1 = GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1384)); *psVar1 = *psVar1 + -1; } } else { if (GHIDRA_INT(uVar5) < 0x114) { if (uVar5 == 0x113) { familiarFlagBit = 0x10; } else { switch(uVar5) { case 0x62: familiarFlagBit = 0x100; break; default: goto LAB_0063bb29; case 0x70: familiarFlagBit = 0x40; break; case 0x71: familiarFlagBit = 4; break; case 0xb2: familiarFlagBit = 0x80; break; case 0x10e: familiarFlagBit = 1; } } } else { switch(uVar5) { case 0x116: familiarFlagBit = 2; break; default: goto LAB_0063bbd4; case 0x168: familiarFlagBit = 8; break; case 0x16b: familiarFlagBit = 0x200; break; case 0x186: familiarFlagBit = 0x400; break; case 0x1a1: familiarFlagBit = 0x20; } } LAB_0063bad8: iVar8 = 1; removeCount = 1; if (familiarFlagBit != 0) { uVar5 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1938)); if ((familiarFlagBit & uVar5) != 0) { iVar8 = 0; *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x1938)) = uVar5 | familiarFlagBit; removeCount = 0; } } LAB_0063bc53: removeIndex = 0; if (0 < iVar8) { LAB_0063bc60: this_00 = this->_player; if ((this_00->_temporaryeffects)._disabled == 0) { for (piVar6 = (this_00->_temporaryeffects)._effects._begin; piVar6 != (this_00->_temporaryeffects)._effects._end; piVar6 = piVar6 + 4) { if (GHIDRA_CAST(*piVar6) == item) { if ((item->type == 3) && (item->passiveCache == 0)) goto LAB_0063bdc5; puVar7 = (this_00->_levelEffectItems)._begin; levelItemsEnd = (this_00->_levelEffectItems)._end; if (puVar7 != levelItemsEnd) goto LAB_0063bd00; break; } } } LAB_0063bc8b: (GHIDRA_CAST((this_00)))->Entity_Player::RemoveCollectible(collectibleId,0,0,1); goto LAB_0063bc9b; } } } else if (iVar8 == 2) { uVar5 = item->id; bVar4 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasTrinket(uVar5,0); if (bVar4 != 0) { (GHIDRA_CAST((this->_player)))->Entity_Player::TryRemoveTrinket(uVar5); } } } LAB_0063bca7: if (isEvaluateNeeded == '\0') { return; } LAB_0063bcad: puVar7 = GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1574)); *puVar7 = *puVar7 | 0x200; (GHIDRA_CAST((this->_player)))->Entity_Player::EvaluateItems(); return; LAB_0063bd00: _Src = puVar7 + 1; if (*puVar7 != collectibleId) { puVar7 = _Src; if (_Src == levelItemsEnd) goto LAB_0063bc8b; goto LAB_0063bd00; } memmove(puVar7,_Src,GHIDRA_INT(levelItemsEnd) - GHIDRA_INT(_Src)); ppvVar2 = &(this_00->_levelEffectItems)._end; *ppvVar2 = (void *)(GHIDRA_INT(*ppvVar2) + -4); uVar5 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x173c)) + removeIndex * 4)); if (g_game == GHIDRA_CAST(0x0)) { if (GHIDRA_INT(uVar5) < 0) goto LAB_0063bdc5; LAB_0063bd84: pvVar3 = (g_manager->_itemConfig)._collectibles._begin; if (GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar3) >> 2 <= GHIDRA_INT(uVar5)) goto LAB_0063bdc5; iVar8 = *GHIDRA_CAST((GHIDRA_CAST(pvVar3) + uVar5 * 4)); } else { if (-1 < GHIDRA_INT(uVar5)) goto LAB_0063bd84; if ((GHIDRA_INT(uVar5) < 0) && (pvVar3 = (g_game->_proceduralItemManager)._proceduralItems._begin, GHIDRA_INT(~uVar5) < GHIDRA_INT((g_game->_proceduralItemManager)._proceduralItems._end) - GHIDRA_INT(pvVar3) >> 2) ) { iVar8 = **GHIDRA_CAST((GHIDRA_CAST(pvVar3) + ~uVar5 * 4)); } else { iVar8 = 0; } } if (iVar8 != 0) { local_18[2] = *GHIDRA_CAST((iVar8 + 0x78)); local_18[1] = 0; local_18[3] = 0; local_18[0] = iVar8; (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1508)))))->TemporaryEffects::RemoveEffect(local_18,1); } LAB_0063bdc5: (*GHIDRA_CAST((GHIDRA_CAST(&(local_38)) + 0x4))) = (ulonglong)GHIDRA_UINT(item->maxCooldown) << 0x20; local_38._shift3 = 0; local_38._seed = GHIDRA_INT(item); (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1508)))))->TemporaryEffects::RemoveEffect(&local_38,1); LAB_0063bc9b: removeIndex = removeIndex + 1; if (removeCount <= removeIndex) goto LAB_0063bca7; goto LAB_0063bc60; } // 0063c1c0 void Entity_Familiar::ai_minisaac() { float targetY; code *pcVar2; longlong lVar3; longlong lVar4; Vector *position; byte bVar5; char cVar6; int iVar7; char *anim; uint uVar8; Entity *pEVar9; int *piVar10; int unusedArg; void *pvVar11; uint uVar12; uint uVar13; uint uVar14; PlayerManager *playerManager; uint uVar15; bool bVar16; float fVar17; ulonglong timeNs; ulonglong uVar18; uint local_e4; uint spawnSubType; uint finalSubType; float local_d8; uint spawnType; uint local_d0; uint spawnVariant; Game *spawnGame; float local_c4; uint local_c0; int landSound; int landSound2; int deathSound; void *triggerNode; float local_a8; Vector particlePos; undefined4 local_98; EntityPtr *erasedSpawnerSlot; uint subTypeKey; Entity_Familiar *savedFamiliar; Vector particleVelocity; int triggerKeyType; int triggerKeyVariant; int anyVariantKeyType; undefined4 anyVariantKeyVariant; undefined8 rngShifts; undefined4 rngShift3; undefined1 anyVariantFind [4]; undefined1 itemFindResult [8]; int itemNode; RNG cardRng; char *dirAnims [12]; Game *game; Manager *manager; std_set *spawnTriggerTargets; EntityPtr *spawnerSlot; ANM2 *sprite; float targetY; dirAnims[4] = "WalkLeft"; dirAnims[5] = "WalkUp"; dirAnims[6] = "WalkRight"; dirAnims[7] = "WalkDown"; dirAnims[0] = "FlyLeft"; dirAnims[1] = "FlyUp"; dirAnims[2] = "FlyRight"; dirAnims[3] = "FlyDown"; dirAnims[8] = "HeadLeft"; dirAnims[9] = "HeadUp"; dirAnims[10] = "HeadRight"; dirAnims[0xb] = "HeadDown"; if (this->_player != (void *)0x0) { iVar7 = this->_entityGridCollisionClass; if ((((iVar7 == 0) || (iVar7 == 3)) || (iVar7 == 1)) || (bVar16 = false, iVar7 == 2)) { bVar16 = true; } iVar7 = this->_state; savedFamiliar = this; if (iVar7 == 0) { fVar17 = (this->_targetPosition).x; targetY = (this->_targetPosition).y; fVar17 = sqrtf(fVar17 * fVar17 + targetY * targetY); if (fVar17 <= 0.01) { iVar7 = 3; } else { targetY = (this->_targetPosition).x; targetY = (this->_targetPosition).y; if (ABS(targetY) <= ABS(targetY)) { iVar7 = GHIDRA_UINT((0.0 <= targetY)) * 2 + 1; } else { iVar7 = 2; if (targetY < 0.0) { iVar7 = 0; } } } sprite = &this->_sprite; if (bVar16) { (GHIDRA_CAST((sprite)))->ANM2::Play(GHIDRA_CAST(dirAnims[iVar7]),0); if (fVar17 <= 0.5) { fVar17 = 0.5; } if (1.0 <= fVar17) { fVar17 = 1.0; } (this->_sprite)._playbackSpeed = fVar17; fVar17 = -4.0; } else { if (fVar17 <= 0.01) { (GHIDRA_CAST((sprite)))->ANM2::SetFrame(GHIDRA_CAST("WalkDown"),0); } else { (GHIDRA_CAST((sprite)))->ANM2::Play(GHIDRA_CAST(dirAnims[iVar7 + 4]),0); if (fVar17 <= 0.5) { fVar17 = 0.5; } if (1.0 <= fVar17) { fVar17 = 1.0; } (this->_sprite)._playbackSpeed = fVar17; } fVar17 = 0.0; } (this->_posOffset).y = fVar17; local_d0 = GHIDRA_UINT((6 < this->_fireCooldown)); if (this->_shootDirection != -1) { iVar7 = this->_shootDirection; } bVar5 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetOverlayAnimation(GHIDRA_CAST(dirAnims[iVar7 + 8]),1); if ((bVar5 != 0) && ((this->_sprite)._overlayAnimState._animData != (void *)0x0)) { (GHIDRA_CAST((&(this->_sprite)._overlayAnimState)))->AnimationState::SetFrameFloat((float)GHIDRA_INT(local_d0)); } FamiliarHelper::fly_head_pathfind_move(this); minisaac_find_target(); minisaac_fire(this); game = g_game; if ((((this->_flags & 0x4000) == 0) && (bVar5 = (GHIDRA_CAST((g_game)))->Game::IsPaused(), bVar5 == 0)) && ((game->_frameCount % 0xf == 0 && (1.0 < this->_health)))) { this->_health = this->_health - 0.2; } } else if (iVar7 == 1) { if ((this->_sprite)._animState._animData != (void *)0x0) { bVar5 = (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::IsEventTriggered(s_Land); manager = g_manager; if (bVar5 != 0) { (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; landSound = 0x45; seed_fart_sound_override(&landSound); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(landSound,0.8,2,0,1.0,0.0); } if (((this->_sprite)._animState._animData != (void *)0x0) && (bVar5 = (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::WasEventTriggered(s_Land), bVar5 != 0)) { this->_friction = this->_friction * 0.5; } } if (((this->_sprite)._animState._animData == (void *)0x0) || ((this->_sprite)._animState._isPlaying == 0)) { anim = "TransformFlying"; if (!bVar16) { anim = "Transform"; } (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST(anim),0); this->_state = 2; } } else if (iVar7 == 2) { if ((this->_sprite)._animState._animData != (void *)0x0) { bVar5 = (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::IsEventTriggered(s_Land); manager = g_manager; if (bVar5 != 0) { (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; landSound2 = 0x45; seed_fart_sound_override(&landSound2); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(landSound2,0.8,2,0,1.0,0.0); } } this->_friction = this->_friction * 0.5; if (((this->_sprite)._animState._animData == (void *)0x0) || ((this->_sprite)._animState._isPlaying == 0)) { this->_state = 0; this->_entityCollisionClass = 4; } } manager = g_manager; if (this->_dead != 0) { deathSound = 0x37; seed_fart_sound_override(&deathSound); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(deathSound,0.8,2,0,1.8,0.0); uVar8 = Random(); position = &this->_pos; pEVar9 = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,2,position,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar8,0); (GHIDRA_CAST((&pEVar9->_sprite)))->ANM2::Play(GHIDRA_CAST("Poof_Small"),0); uVar8 = Random(); for (local_d0 = (uVar8 & 1) + 1; local_d0 != 0; local_d0 = local_d0 + -1) { uVar8 = Random(); local_d8 = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * 2.3283064e-10 * 3.14; local_d8 = local_d8 + local_d8; fVar17 = cos(local_d8); particlePos.x = fVar17 * this->_size * 0.5 + position->x; fVar17 = sin(local_d8); particlePos.y = fVar17 * this->_size * 0.5 + (this->_pos).y; uVar8 = Random(); fVar17 = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * 2.3283064e-10 * 3.14; fVar17 = fVar17 + fVar17; uVar8 = Random(); targetY = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * 2.3283064e-10 * 3.0 + 1.0; local_c4 = cos(fVar17); local_c4 = local_c4 * targetY; particleVelocity.x = local_c4; local_a8 = sin(fVar17); local_a8 = local_a8 * targetY; particleVelocity.y = local_a8; local_d8 = (float)Random(); spawnGame = g_game; spawnSubType = 0; spawnVariant = 5; spawnType = 1000; lua_callback_run_pre_entity_spawn (GHIDRA_CAST(&spawnType),GHIDRA_CAST(&spawnVariant),&particlePos,&particleVelocity, GHIDRA_CAST(0x0),GHIDRA_CAST(&spawnSubType),GHIDRA_CAST(&local_d8)); uVar8 = spawnVariant; if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { LAB_0063cadf: finalSubType = spawnSubType; } else { piVar10 = (g_game->_deathmatchManager)._type; local_e4 = Random(); uVar12 = spawnSubType; rngShifts = 0x900000005; rngShift3 = 7; if (spawnType != 5) goto LAB_0063cadf; if (uVar8 < 0x12d) { if (uVar8 == 300) { while ((finalSubType = spawnSubType, spawnSubType == 0 || (cVar6 = (**(code **)(*piVar10 + 0x24))(spawnSubType), cVar6 != '\0'))) { if (local_e4 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar2 = (code *)swi(3); (*pcVar2)(); return; } local_e4 = local_e4 >> ((byte)rngShifts & 0x1f) ^ local_e4; local_e4 = local_e4 << ((byte)((ulonglong)rngShifts >> 0x20) & 0x1f) ^ local_e4; local_e4 = local_e4 >> 7 ^ local_e4; iVar7 = ItemPool::GetCardEx(local_e4,0x19,10,10,1); cardRng._shift1 = 5; cardRng._shift2 = 9; cardRng._shift3 = 7; cardRng._seed = local_e4; spawnSubType = lua_callback_run_get_card(&cardRng,iVar7,1,1,0); } } else { if (uVar8 == 0x46) { local_c0 = spawnSubType >> 0xb; do { finalSubType = spawnSubType; if (spawnSubType != 0) { pcVar2 = *(code **)(*piVar10 + 0x28); iVar7 = ItemPool::GetPillEffect (&g_game->_itemPool,spawnSubType,GHIDRA_CAST(0x0)); cVar6 = (*pcVar2)(iVar7); if (cVar6 == '\0') goto LAB_0063cae7; } if (local_e4 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar2 = (code *)swi(3); (*pcVar2)(); return; } local_e4 = local_e4 >> ((byte)rngShifts & 0x1f) ^ local_e4; local_e4 = local_e4 << ((byte)((ulonglong)rngShifts >> 0x20) & 0x1f) ^ local_e4; local_e4 = local_e4 >> 7 ^ local_e4; spawnSubType = ItemPool::GetPill(local_e4); spawnSubType = spawnSubType | (local_c0 & 1) << 0xb; } while( true ); } if (uVar8 != 100) goto LAB_0063cadf; finalSubType = spawnSubType; if (spawnSubType == 0x19) { LAB_0063c921: bVar16 = false; } else { subTypeKey = spawnSubType; std::set::find_node(itemFindResult,&subTypeKey); if (((*GHIDRA_CAST((itemNode + 0xd)) == '\0') && (*GHIDRA_CAST((itemNode + 0x10)) <= GHIDRA_INT(uVar12))) && (itemNode != piVar10[8])) goto LAB_0063c921; bVar16 = true; } if ((uVar12 == 0) || (bVar16)) { spawnSubType = (**(code **)(*piVar10 + 0x84))(0); finalSubType = spawnSubType; } } } else { if (uVar8 != 0x15e) goto LAB_0063cadf; while ((finalSubType = spawnSubType, spawnSubType == 0 || (cVar6 = (**(code **)(*piVar10 + 0x2c))(spawnSubType), cVar6 != '\0'))) { spawnSubType = (GHIDRA_CAST((&g_game->_itemPool)))->ItemPool::GetTrinket(0); } } } LAB_0063cae7: pEVar9 = (GHIDRA_CAST((spawnGame->_entityFactory)))->EntityFactory::Create(spawnType,0); lVar3 = CONCAT44(local_c0,local_98); if (pEVar9 == GHIDRA_CAST(0x0)) { pEVar9 = GHIDRA_CAST(0x0); } else { timeNs = GetTimeNs(); lVar3 = (timeNs & 0xffffffff) * 0x431bde82; local_98 = (undefined4)((ulonglong)lVar3 >> 0x20); uVar18 = (timeNs >> 0x20) * 0xd7b634db + ((timeNs & 0xffffffff) * 0xd7b634db >> 0x20); uVar12 = GHIDRA_UINT((uVar18 >> 0x20)); lVar3 = lVar3 + (uVar18 & 0xffffffff); local_c0 = GHIDRA_UINT(lVar3); uVar8 = GHIDRA_UINT(((ulonglong)lVar3 >> 0x20)); lVar3 = (timeNs >> 0x20) * 0x431bde82 + (ulonglong)CONCAT14(CARRY4(uVar12,uVar8),uVar12 + uVar8); uVar8 = GHIDRA_UINT(((ulonglong)lVar3 >> 0x20)); uVar12 = GHIDRA_UINT(lVar3) >> 0x12 | uVar8 * 0x4000; spawnerSlot = &pEVar9->_spawnerEntity; pEVar9->_spawnerType = 0; pEVar9->_spawnerVariant = 0; if (*spawnerSlot != (EntityPtr)0x0) { erasedSpawnerSlot = spawnerSlot; std::multiset::erase(&erasedSpawnerSlot); } iVar7 = *GHIDRA_CAST(pEVar9); *spawnerSlot = (EntityPtr)0x0; (pEVar9->_pos).x = particlePos.x; (pEVar9->_pos).y = particlePos.y; (pEVar9->_velocity).x = local_c4; (pEVar9->_velocity).y = local_a8; (**(code **)(iVar7 + 4))(spawnType,spawnVariant,finalSubType,local_d8); pvVar11 = spawnGame->_room; iVar7 = *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x1214)); *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x1214)) = iVar7 + 1; pEVar9->_index = iVar7; (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar11) + 0x1218)))))->EntityList::AddEntity(pEVar9); bVar5 = Game::ShouldEraseEnemy(pEVar9); if (bVar5 != 0) { Entity::RemoveWithPoof(pEVar9,unusedArg); } if ((pEVar9->_exists != 0) && ((spawnGame->_proceduralItemManager)._proceduralItems._begin != (spawnGame->_proceduralItemManager)._proceduralItems._end)) { triggerKeyVariant = pEVar9->_variant; iVar7 = pEVar9->_type; spawnTriggerTargets = &(spawnGame->_proceduralItemManager)._spawnTriggerTargets; triggerKeyType = iVar7; std::map::find(&triggerNode,&triggerKeyType); if (triggerNode == spawnTriggerTargets->_head) { anyVariantKeyVariant = 0xffffffff; anyVariantKeyType = iVar7; piVar10 = GHIDRA_CAST(std)::map::find(anyVariantFind,&anyVariantKeyType) ; triggerNode = (void *)*piVar10; if (triggerNode == spawnTriggerTargets->_head) goto LAB_0063cd56; } uVar15 = 0; playerManager = &g_game->_playerManager; if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 != 0) { do { pvVar11 = (playerManager->_playerList)._end; if (GHIDRA_INT(pvVar11) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { KAGE_LogMessage(0x10,(byte *) "(GHIDRA_CAST(()))->PlayerManager::GetPlayer() : There are no players! \n"); pvVar11 = (playerManager->_playerList)._end; } piVar10 = (playerManager->_playerList)._begin; if (uVar15 < GHIDRA_UINT((GHIDRA_INT(pvVar11) - GHIDRA_INT(piVar10) >> 2))) { piVar10 = piVar10 + uVar15; } trigger_set_dispatch ((void *)(*piVar10 + 0x1fc8),6,pEVar9,&particlePos,&particleVelocity); uVar15 = uVar15 + 1; playerManager = &g_game->_playerManager; } while (uVar15 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); } } LAB_0063cd56: uVar18 = GetTimeNs(); local_d8 = (float)(uVar18 >> 0x20); lVar4 = (uVar18 & 0xffffffff) * 0x431bde82; local_c4 = (float)((ulonglong)lVar4 >> 0x20); lVar3 = (ulonglong)GHIDRA_UINT(local_d8) * 0x431bde82; uVar18 = (ulonglong)GHIDRA_UINT(local_d8) * 0xd7b634db + ((uVar18 & 0xffffffff) * 0xd7b634db >> 0x20); uVar13 = GHIDRA_UINT((uVar18 >> 0x20)); lVar4 = lVar4 + (uVar18 & 0xffffffff); local_a8 = (float)lVar4; uVar15 = GHIDRA_UINT(((ulonglong)lVar4 >> 0x20)); lVar4 = lVar3 + (ulonglong)CONCAT14(CARRY4(uVar13,uVar15),uVar13 + uVar15); uVar14 = GHIDRA_UINT(((ulonglong)lVar4 >> 0x20)); uVar15 = GHIDRA_UINT(lVar4) >> 0x12 | uVar14 * 0x4000; uVar13 = uVar15 - uVar12; bVar16 = CARRY4(GHIDRA_UINT(g_entitySpawnTimeMs),uVar13); (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x0))) = GHIDRA_UINT(g_entitySpawnTimeMs) + uVar13; (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) + (((uVar14 >> 0x12) - (uVar8 >> 0x12)) - GHIDRA_UINT((uVar15 < uVar12))) + GHIDRA_UINT(bVar16); } local_c0 = GHIDRA_UINT(((ulonglong)lVar3 >> 0x20)); local_98 = (undefined4)lVar3; pEVar9->Update(); position = &savedFamiliar->_pos; this = savedFamiliar; } } } return; } // 0063ce20 void Entity_Familiar::minisaac_fire() { int iVar1; uint spawnSeed; Entity *knifeEntity; Entity_Knife *this_00; Vector *pVVar2; Entity_Tear *tear; Manager *manager; float fVar3; float Volume; float Pitch; Vector local_34; Vector local_2c; float local_24; Vector local_20; Vector shootDir; Vector normalizedDir; EntityPtr *parentRef; if ((-1 < this->_shootDirection) && (this->_fireCooldown < 1)) { Isaac::GetAxisAlignedUnitVectorFromDir(&shootDir,this->_shootDirection); if (this->_subtype == 99) { iVar1 = _get_index_plus_one_if_kind_4_5(); local_20.x = (float)iVar1 * 0.15 + 1.2; fVar3 = apply_tear_modifiers(this); local_24 = (fVar3 * 0.4 + 0.6) * local_20.x; fVar3 = apply_tear_modifiers(this); local_2c.x = (fVar3 * 0.25 + 0.75) * 0.7; spawnSeed = Random(); local_34.x = (this->_pos).x; local_34.y = (this->_pos).y; knifeEntity = (GHIDRA_CAST((g_game)))->Game::SpawnEx(8,1,&local_34,&g_vectorZero,GHIDRA_CAST(this),4,spawnSeed,0); this_00 = (Entity_Knife *) __RTDynamicCast(knifeEntity,0,&IsaacRepentancePlus::Entity::RTTI_Type_Descriptor, &IsaacRepentancePlus::Entity_Knife::RTTI_Type_Descriptor,0); parentRef = &this_00->_parent; if (this_00->_parent != (EntityPtr)0x0) { local_20.x = (float)parentRef; std::multiset::erase(&local_20); } *parentRef = (EntityPtr)this; std::multiset::insert(parentRef); (this_00->_targetPosition).x = 8.0; (this_00->_targetPosition).y = 0.0; pVVar2 = Vector::ToCardinal(&local_20,&shootDir); fVar3 = atan2f(pVVar2->y,pVVar2->x); (this_00->_posOffset).x = 0.0; (this_00->_posOffset).y = -8.0; this_00->_rotation = fVar3 * 57.295776; this_00->SetCollisionDamage(local_24 + local_24); fVar3 = local_34.y * g_vectorOne.x; (this_00->_sprite)._scale.y = local_34.y * g_vectorOne.y; (this_00->_sprite)._scale.x = fVar3; (GHIDRA_CAST((this_00)))->Entity_Knife::SetAttackAnimation(); this_00->Update(); manager = g_manager; this->_fireCooldown = 0x14; seed_fart_sound_override(GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -0x38))); Pitch = 1.5; Volume = 0.6; fVar3 = 3.53127e-43; } else { local_20.x = (this->_velocity).x * 0.5; local_34.x = (this->_velocity).y * 0.5; local_2c.x = shootDir.y; local_24 = shootDir.x; fVar3 = sqrtf(shootDir.y * shootDir.y + shootDir.x * shootDir.x); if (fVar3 <= 0.0) { fVar3 = local_2c.x; } else { local_24 = shootDir.x * (1.0 / fVar3); fVar3 = local_2c.x * (1.0 / fVar3); } local_24 = local_34.x * fVar3 + local_20.x * local_24; fVar3 = local_20.x; if (local_24 < 0.0) { pVVar2 = (GHIDRA_CAST((&shootDir)))->Vector::Normalized(&normalizedDir); fVar3 = local_20.x - local_24 * pVVar2->x; local_34.x = local_34.x - local_24 * pVVar2->y; } local_2c.x = shootDir.x * 9.0 + fVar3; local_2c.y = shootDir.y * 9.0 + local_34.x; iVar1 = _get_index_plus_one_if_kind_4_5(); local_20.x = (float)iVar1 * 0.15 + 1.2; fVar3 = apply_tear_modifiers(this); local_20.x = (fVar3 * 0.4 + 0.6) * local_20.x; fVar3 = apply_tear_modifiers(this); local_24 = (fVar3 * 0.25 + 0.75) * 0.5; spawnSeed = Random(); tear = (Entity_Tear *) (GHIDRA_CAST((g_game)))->Game::SpawnEx(2,0,&this->_pos,&local_2c,GHIDRA_CAST(this),0,spawnSeed,0); tear->SetCollisionDamage(local_20.x); if (this->_entityGridCollisionClass == 5) { fVar3 = -14.0; } else { fVar3 = -18.0; } (GHIDRA_CAST((GHIDRA_CAST(tear))))->Entity_Projectile::SetHeight(fVar3); fVar3 = local_2c.y * tear->_baseScale; if (fVar3 <= 0.01) { fVar3 = 0.01; } tear->_baseScale = fVar3; tear->_fScale = fVar3; (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); TryFireTear(this,tear); tear->Update(); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); manager = g_manager; this->_fireCooldown = 10; local_24 = 2.14399e-43; seed_fart_sound_override(GHIDRA_CAST(&local_24)); Pitch = 1.0; Volume = 1.0; fVar3 = local_24; } (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(fVar3),Volume,2,0,Pitch,0.0); } if (0 < this->_fireCooldown) { this->_fireCooldown = this->_fireCooldown + -1; } return; } // 0063dd60 void Entity_Familiar::minisaac_find_target() { Entity_Familiar *familiar; byte bVar1; uint frameMod; EntityPtr target; Vector *sideOffset; Entity_Familiar *in_ECX; int candidateType; bool isUpdateFrame; float fVar2; float dx; Vector sideOffsetBuf; Vector candidatePos; EntityPtr *local_28; Entity_Familiar *local_24; EntityPtr local_20; float bestScore; float score; EntityPtr bestTarget; void *local_10; undefined1 *puStack_c; undefined4 uStack_8; Game *game; Entity_NPC *ownerParent; EntityPtr *targetSlot; game = g_game; uStack_8 = 0xffffffff; puStack_c = &LAB_00af7060; local_10 = ExceptionList; ExceptionList = &local_10; if ((in_ECX->_flags & 0x4000) == 0) { local_24 = in_ECX; bVar1 = (GHIDRA_CAST((g_game)))->Game::IsPaused(); if (bVar1 == 0) { frameMod = game->_frameCount + in_ECX->_index & 0x80000003; isUpdateFrame = frameMod == 0; if (GHIDRA_INT(frameMod) < 0) { isUpdateFrame = (frameMod - 1 | 0xfffffffc) == 0xffffffff; } if (isUpdateFrame) { targetSlot = &in_ECX->_target; target = *targetSlot; fVar2 = *GHIDRA_CAST((GHIDRA_CAST(in_ECX->_player) + 0x340)) - (in_ECX->_pos).y; dx = *GHIDRA_CAST((GHIDRA_CAST(in_ECX->_player) + 0x33c)) - (in_ECX->_pos).x; fVar2 = sqrtf(fVar2 * fVar2 + dx * dx); if (800.0 < fVar2) { if (target != (EntityPtr)0x0) { local_20 = (EntityPtr)targetSlot; std::multiset::erase(&local_20); } *targetSlot = (EntityPtr)0x0; ExceptionList = local_10; return; } if ((target != (EntityPtr)0x0) && (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(target))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)), bVar1 != 0)) { ExceptionList = local_10; return; } if ((in_ECX->_flags & 0x100) == 0) { local_20 = (EntityPtr)0x0; bestTarget = (EntityPtr)0x0; bestScore = 0.0; local_28 = g_game->_room; if (local_28[0x499] != (EntityPtr)0x0) { do { target = *GHIDRA_CAST((GHIDRA_INT(local_28[0x497]) + GHIDRA_INT(local_20) * 4)); if ((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x28)) != 1)) { candidateType = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x28)); if (candidateType - 10U < 0x3de) goto LAB_0063dfb5; } else { candidateType = 1; LAB_0063dfb5: if ((((*GHIDRA_CAST((GHIDRA_CAST(target) + 0x188)) != 1) && (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x188)) != 0)) && (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x3b0)) == 0)) && (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x173)) == 0)) { bVar1 = (GHIDRA_CAST((GHIDRA_CAST(target))))->Entity::HasEntityFlags(0x10); familiar = local_24; if ((((bVar1 == 0) || (candidateType == 0x322)) || (candidateType == 0x362)) && ((bVar1 = (GHIDRA_CAST((GHIDRA_CAST(local_24))))->Entity::IsDescendantOf(GHIDRA_CAST(target)), bVar1 == 0 && ((*GHIDRA_CAST((GHIDRA_CAST(target) + 0x168)) & 0x20000010) == 0)))) { candidatePos.y = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x340)); candidatePos.x = (GHIDRA_CAST((GHIDRA_INT(target) + 0x33c)))->x; bVar1 = (GHIDRA_CAST((g_game->_room)))->Room::CheckLine(&familiar->_pos,&candidatePos,3,0,0,0, GHIDRA_CAST(0x0)); if (bVar1 != 0) { score = 0.0; if (target == *targetSlot) { score = 100.0; } fVar2 = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x340)) - (familiar->_pos).y; dx = (GHIDRA_CAST((GHIDRA_INT(target) + 0x33c)))->x - (familiar->_pos).x; fVar2 = sqrtf(fVar2 * fVar2 + dx * dx); fVar2 = 100.0 - fVar2; if (fVar2 <= 0.0) { fVar2 = 0.0; } score = fVar2 + score; if ((bestScore < score) && ((sideOffset = FamiliarHelper::fly_head_pick_side_offset (familiar,&sideOffsetBuf,GHIDRA_CAST(target)), sideOffset->x != g_vectorZero.x || (sideOffset->y != g_vectorZero.y)))) { bestScore = score; bestTarget = target; } } } } } local_20 = (EntityPtr)(GHIDRA_INT(local_20) + 1); } while (GHIDRA_UINT(local_20) < GHIDRA_UINT(local_28[0x499])); } target = bestTarget; if (*targetSlot != (EntityPtr)0x0) { local_28 = targetSlot; std::multiset::erase(&local_28); } *targetSlot = target; if (target == (EntityPtr)0x0) { ExceptionList = local_10; return; } } else { target = *targetSlot; if (((target != (EntityPtr)0x0) && (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x28)) == 1)) && (bVar1 = (GHIDRA_CAST((GHIDRA_CAST(target))))->Entity_Player::HasInvincibility(0,GHIDRA_CAST(0x0)), bVar1 != 0)) { if (*targetSlot != (EntityPtr)0x0) { local_20 = (EntityPtr)targetSlot; std::multiset::erase(&local_20); } *targetSlot = (EntityPtr)0x0; } if ((in_ECX->_flags & 0x4000) != 0) { ExceptionList = local_10; return; } if (*targetSlot != (EntityPtr)0x0) { ExceptionList = local_10; return; } ownerParent = *GHIDRA_CAST((GHIDRA_CAST(in_ECX->_player) + 0x3bc)); if (ownerParent == GHIDRA_CAST(0x0)) { ExceptionList = local_10; return; } bVar1 = (GHIDRA_CAST((GHIDRA_CAST(ownerParent))))->Entity::IsEnemy(); if (bVar1 == 0) { ExceptionList = local_10; return; } target = (EntityPtr)(GHIDRA_CAST((ownerParent)))->Entity_NPC::GetPlayerTarget(); fVar2 = (in_ECX->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(target) + 0x340)); dx = (in_ECX->_pos).x - (GHIDRA_CAST((GHIDRA_INT(target) + 0x33c)))->x; fVar2 = sqrtf(fVar2 * fVar2 + dx * dx); if (300.0 < fVar2) { ExceptionList = local_10; return; } if (*targetSlot != (EntityPtr)0x0) { local_20 = (EntityPtr)targetSlot; std::multiset::erase(&local_20); } *targetSlot = target; } std::multiset::insert(targetSlot); } } } ExceptionList = local_10; return; } // 0063f9f0 void Entity_Familiar::ai_blood_oath() { Entity_Familiar *animState = this; byte bVar1; char isDamaged; uint uVar2; uint subType; Entity *bloodParticle; byte *animName; uint uVar3; int extraout_ECX; byte *stabAnimName; int extraout_EDX; int iVar4; bool bVar5; float fVar6; code *pcStack_74; Vector VStack_70; float fStack_68; Vector VStack_64; Vector pickupVelocity; EntityRef damageSource; Vector local_2c; undefined1 *local_24; char *local_20; Vector local_1c; undefined4 uStack_14; undefined4 uStack_10; uint local_c; AnimationState *animState; Manager *manager; float playerY; float posY; local_c = __security_cookie ^ GHIDRA_UINT(&pcStack_74); local_2c.x = (float)s_Idle; local_1c.x = 0.0; local_1c.y = 0.0; uStack_14 = 10; uStack_10 = 4; iVar4 = 0; local_2c.y = (float)s_Idle2; local_24 = &DAT_00b1d43c; local_20 = "Idle4"; fVar6 = (float)animState->_hearts / 23.0; if (fVar6 <= 0.5) { if (fVar6 <= 0.25) { if (0.0 < fVar6) { iVar4 = 1; } } else { iVar4 = 2; } } else { iVar4 = 3; } switch(animState->_state) { case 0: animState->_state = 3; case 3: (GHIDRA_CAST((&animState->_sprite)))->ANM2::Play(GHIDRA_CAST((&local_2c.x)[iVar4]),0); fVar6 = (&local_1c.x)[iVar4]; if ((fVar6 != 0.0) && (uVar3 = Random(), uVar3 % GHIDRA_UINT(fVar6) == 0)) { uVar3 = Random(); Entity_NPC::MakeSplat (GHIDRA_CAST(animState), (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * 2.3283064e-10 * 0.5 + 0.2); } break; default: goto LAB_0064001c; case 4: (GHIDRA_CAST((&animState->_sprite)))->ANM2::Play(&DAT_00b643e8,0); animState = &(animState->_sprite)._animState; fVar6 = animState->_friction; playerY = *GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x340)); posY = (animState->_pos).y; (animState->_velocity).x = (*GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x33c)) - (animState->_pos).x) / fVar6; (animState->_velocity).y = (playerY - posY) / fVar6; if ((animState->_sprite)._animState._animData == (void *)0x0) { return; } bVar1 = (GHIDRA_CAST((animState)))->AnimationState::IsEventTriggered(&DAT_00b1d3b0); manager = g_manager; if (bVar1 == 0) { if ((animState->_sprite)._animState._animData == (void *)0x0) { return; } bVar1 = (GHIDRA_CAST((animState)))->AnimationState::IsEventTriggered(&DAT_00b602f0); if (bVar1 == 0) { return; } animState->_state = 5; return; } pcStack_74 = (code *)0x4d; seed_fart_sound_override(GHIDRA_CAST(&pcStack_74)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(pcStack_74),1.0,2,0,1.0,0.0); bVar1 = (GHIDRA_CAST((animState->_player)))->Entity_Player::HasInvincibility(0,GHIDRA_CAST(0x0)); if (bVar1 != 0) { return; } iVar4 = (GHIDRA_CAST((animState->_player)))->Entity_Player::GetHealthType(); VStack_70.x = 0.0; if (extraout_EDX < 1) { VStack_70.x = (float)(2 - GHIDRA_UINT((iVar4 != 3))); } fStack_68 = (float)(*GHIDRA_CAST((extraout_ECX + 0x1344)) - GHIDRA_INT(VStack_70.x)); iVar4 = 0; animState->_hearts = 0; if (0 < GHIDRA_INT(fStack_68)) { do { if (*GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x1344)) <= GHIDRA_INT(VStack_70.x)) break; *GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x13bc)) = 0; damageSource._position.x = (animState->_pos).x; damageSource._position.y = (animState->_pos).y; damageSource._velocity.x = (animState->_velocity).x; pcStack_74 = *(code **)(*GHIDRA_CAST(animState->_player) + 0x20); damageSource._type = animState->_type; damageSource._variant = animState->_variant; damageSource._spawnerType = animState->_spawnerType; damageSource._spawnerVariant = animState->_spawnerVariant; damageSource._velocity.y = (animState->_velocity).y; if ((animState->_flags & 0x20000000) == 0) { uVar3 = 0; } else { uVar3 = 2; } if ((animState->_flags & 0x40000000000000) == 0) { uVar2 = 0; } else { uVar2 = 4; } damageSource._flags = uVar2 | uVar3 | GHIDRA_UINT(((animState->_flags & 0x100) != 0)); damageSource._entity = animState; isDamaged = (*pcStack_74)(0x3f800000,0x2042821,0,&damageSource,0x1e); if (isDamaged == '\0') break; animState->_hearts = animState->_hearts + 1; iVar4 = iVar4 + 1; } while (iVar4 < GHIDRA_INT(fStack_68)); } if (0 < animState->_hearts) { VStack_64.x = *GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x33c)); VStack_64.y = *GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x340)); Isaac::GetRandomPickupVelocity(&pickupVelocity,&VStack_64,0,GHIDRA_CAST(0x0)); fStack_68 = pickupVelocity.x + pickupVelocity.x; VStack_64.y = pickupVelocity.y + pickupVelocity.y; VStack_64.x = fStack_68; pickupVelocity.x = VStack_64.y; uVar3 = Random(); VStack_70.x = *GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x33c)); VStack_70.y = *GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x340)); (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,2,&VStack_70,&VStack_64,GHIDRA_CAST(0x0),3,uVar3,0); uVar3 = Random(); uVar2 = Random(); iVar4 = 0; VStack_64.x = (float)(uVar3 % 3 + 8 + uVar2 % 6); if (VStack_64.x != 0.0) { do { uVar2 = Random(); VStack_70.x = ((float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) * 2.3283064e-10 * 20.0 - 10.0) * 0.017453292; pcStack_74 = (code *)cos(VStack_70.x); VStack_70.x = sin(VStack_70.x); uVar2 = Random(); local_1c.y = (float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) * 2.3283064e-10; local_1c.x = (fStack_68 * (float)pcStack_74 - pickupVelocity.x * VStack_70.x) * local_1c.y ; local_1c.y = (fStack_68 * VStack_70.x + pickupVelocity.x * (float)pcStack_74) * local_1c.y ; local_2c.x = local_1c.x + *GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x33c)); local_2c.y = local_1c.y + *GHIDRA_CAST((GHIDRA_CAST(animState->_player) + 0x340)); uVar2 = Random(); subType = 99; if (iVar4 < GHIDRA_INT((uVar3 % 3 + 2))) { subType = 0; } bloodParticle = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,5,&local_2c,&local_1c,GHIDRA_CAST(0x0),subType,uVar2,0); bloodParticle->Update(); iVar4 = iVar4 + 1; } while (iVar4 < GHIDRA_INT(VStack_64.x)); } bVar1 = (GHIDRA_CAST((animState->_player)))->Entity_Player::HasCollectible(0xf7,0); if (bVar1 != 0) { animState->_hearts = animState->_hearts + 4; } } FUN_00640050(); return; case 5: if (((animState->_sprite)._animState._animData != (void *)0x0) && ((animState->_sprite)._animState._isPlaying == 0)) { animName = (animState->_sprite)._animState._animData; if (0xf < *GHIDRA_CAST((animName + 0x14))) { animName = *GHIDRA_CAST(animName); } stabAnimName = &DAT_00b643e8; do { bVar1 = *animName; bVar5 = bVar1 < *stabAnimName; if (bVar1 != *stabAnimName) { LAB_00640002: uVar3 = -GHIDRA_UINT(bVar5) | 1; goto LAB_00640007; } if (bVar1 == 0) break; bVar1 = animName[1]; bVar5 = bVar1 < stabAnimName[1]; if (bVar1 != stabAnimName[1]) goto LAB_00640002; animName = animName + 2; stabAnimName = stabAnimName + 2; } while (bVar1 != 0); uVar3 = 0; LAB_00640007: if (uVar3 == 0) { animState->_state = 3; } } } FollowParent(animState); LAB_0064001c: return; } // 006402f0 void Entity_Familiar::paschal_candle_sync_effects() { Entity_Player *this_00; int i; int candleEffect [5]; void *collectiblesBegin; collectiblesBegin = (g_manager->_itemConfig)._collectibles._begin; this_00 = this->_player; if ((0x8dc < GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(collectiblesBegin) & 0xfffffffcU))) && (candleEffect[0] = *GHIDRA_CAST((GHIDRA_CAST(collectiblesBegin) + 0x8dc)), candleEffect[0] != 0)) { candleEffect[2] = *GHIDRA_CAST((candleEffect[0] + 0x78)); candleEffect[1] = 0; candleEffect[3] = 0; (GHIDRA_CAST((&this_00->_temporaryeffects)))->TemporaryEffects::RemoveEffect(candleEffect,-1); this_00 = this->_player; } collectiblesBegin = (g_manager->_itemConfig)._collectibles._begin; if (GHIDRA_INT((GHIDRA_INT((g_manager->_itemConfig)._collectibles._end) - GHIDRA_INT(collectiblesBegin) & 0xfffffffcU)) < 0x8dd) { candleEffect[0] = 0; } else { candleEffect[0] = *GHIDRA_CAST((GHIDRA_CAST(collectiblesBegin) + 0x8dc)); } i = 1; candleEffect[3] = 0; candleEffect[1] = 1; candleEffect[2] = 0; if (1 < this->_hearts) { do { TemporaryEffects::AddEffect (GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1508)),candleEffect,1,1); i = i + 1; } while (i < this->_hearts); this_00 = this->_player; } (GHIDRA_CAST((this_00)))->Entity_Player::EvaluateItems(); return; } // 00640ca0 void Entity_Familiar::ai_boiled_baby() { int direction; EntityPtr EVar1; byte bVar2; int *piVar3; int iVar4; Vector *pVVar5; uint uVar6; byte *animNameChar; byte *wantedAnimChar; char *shootAnimChar; bool bVar7; float fVar8; float fVar9; float fVar10; float jumpProgress; float *frictionPtr; Vector local_2c; Vector local_24; Vector local_1c; Room *room; Vector local_10; float friction; void *player; room = g_game->_room; player = this->_player; if (*GHIDRA_CAST((GHIDRA_CAST(player) + 0x1519)) == '\0') { for (piVar3 = *GHIDRA_CAST((GHIDRA_CAST(player) + 0x150c)); piVar3 != *GHIDRA_CAST((GHIDRA_CAST(player) + 0x1510)); piVar3 = piVar3 + 4) { if ((*GHIDRA_CAST(*piVar3) == 0) && ((GHIDRA_CAST(*piVar3))[1] == 0x37)) { iVar4 = this->_state; piVar3 = &this->_state; if (iVar4 == 0) { this->_visible = 1; *piVar3 = 1; (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; this->_coins = 0; this->_keys = 1; uVar6 = Random(); this->_hearts = (uVar6 & 3) + 2; iVar4 = *piVar3; } frictionPtr = &this->_friction; *frictionPtr = this->_friction * 0.7; local_24.x = (float)frictionPtr; if (iVar4 == 0) goto LAB_00640d22; if (iVar4 == 1) { if (((this->_sprite)._animState._animData == (void *)0x0) || ((this->_sprite)._animState._isPlaying == 0)) goto LAB_00641131; animNameChar = (this->_sprite)._animState._animData; if (0xf < *GHIDRA_CAST((animNameChar + 0x14))) { animNameChar = *GHIDRA_CAST(animNameChar); } shootAnimChar = "Shoot"; goto LAB_00641000; } if (((iVar4 != 2) || ((GHIDRA_CAST((&this->_sprite)))->ANM2::Play(&DAT_00b1de1c,0), (this->_sprite)._animState._animData == (void *)0x0)) || ((this->_sprite)._animState._isPlaying != 0)) goto LAB_00640d9b; animNameChar = (this->_sprite)._animState._animData; if (0xf < *GHIDRA_CAST((animNameChar + 0x14))) { animNameChar = *GHIDRA_CAST(animNameChar); } wantedAnimChar = &DAT_00b1de1c; goto LAB_00640f80; } } } this->_state = 0; this->_friction = this->_friction * 0.7; LAB_00640d22: frictionPtr = &this->_friction; this->_visible = 0; fVar9 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); (this->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); (this->_pos).y = fVar9; if (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x173)) == '\0') { iVar4 = this->_fireCooldown; if (0 < iVar4) { iVar4 = iVar4 + -1; this->_fireCooldown = iVar4; } direction = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x162c)); if ((direction != -1) && (iVar4 < 1)) { bVar2 = 0; pVVar5 = Isaac::GetAxisAlignedUnitVectorFromDir(&local_10,direction); FireProjectile(this,pVVar5,bVar2); this->_fireCooldown = 0x2d; } } goto LAB_00640d9b; while( true ) { bVar2 = animNameChar[1]; bVar7 = bVar2 < (byte)shootAnimChar[1]; if (bVar2 != shootAnimChar[1]) goto LAB_00641020; animNameChar = animNameChar + 2; shootAnimChar = shootAnimChar + 2; if (bVar2 == 0) break; LAB_00641000: bVar2 = *animNameChar; bVar7 = bVar2 < (byte)*shootAnimChar; if (bVar2 != *shootAnimChar) { LAB_00641020: uVar6 = -GHIDRA_UINT(bVar7) | 1; goto LAB_00641025; } if (bVar2 == 0) break; } uVar6 = 0; LAB_00641025: if (((uVar6 == 0) && ((this->_sprite)._animState._animData != (void *)0x0)) && ((this->_sprite)._animState._isPlaying != 0)) { bVar2 = (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::IsEventTriggered(GHIDRA_CAST("Shoot")); frictionPtr = GHIDRA_CAST(local_24.x); if (bVar2 != 0) { EVar1 = this->_target; if (EVar1 != (EntityPtr)0x0) { fVar9 = *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x33c)); local_10.x = *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x340)); fVar10 = (this->_pos).x - fVar9; fVar8 = (this->_pos).y - local_10.x; fVar8 = sqrtf(fVar8 * fVar8 + fVar10 * fVar10); local_1c.x = (*GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x360)) * fVar8 * 0.075 + fVar9) - (this->_pos).x; local_1c.y = (*GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x364)) * fVar8 * 0.075 + local_10.x) - (this->_pos).y; (GHIDRA_CAST((&local_1c)))->Vector::Normalized(&local_10); FireProjectile(this,&local_10,1); frictionPtr = GHIDRA_CAST(local_24.x); } } } else { LAB_00641131: (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(s_Idle,0); } if ((this->_keys < 1) && (this->_target == (EntityPtr)0x0)) { PickEnemyTarget(this,1000.0,1,9,&g_vectorZero,15.0); } if ((((this->_target == (EntityPtr)0x0) || ((bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this->_target))))->Entity::IsVulnerableEnemy(GHIDRA_CAST(0x0)), bVar2 == 0 && (*GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x28)) != 1)))) || (this->_hearts < 1)) || (fVar9 = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x340)), fVar8 = (this->_pos).x - *GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x33c)), fVar9 = sqrtf(fVar9 * fVar9 + fVar8 * fVar8), 180.0 <= fVar9)) { LAB_0064122e: bVar7 = false; } else { local_10.x = *GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x33c)); local_10.y = *GHIDRA_CAST((GHIDRA_CAST(this->_target) + 0x340)); bVar2 = (GHIDRA_CAST((room)))->Room::CheckLine(&this->_pos,&local_10,3,999,0,0,GHIDRA_CAST(0x0)); if (bVar2 == 0) goto LAB_0064122e; bVar7 = true; } iVar4 = this->_keys; if ((iVar4 < 1) && (bVar7)) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("Shoot"),0); this->_hearts = this->_hearts + -1; this->_keys = 0xf; this->_coins = 0x14; } else if (this->_coins < 1) { PickEnemyTarget(this,1000.0,1,9,&g_vectorZero,15.0); EVar1 = this->_target; if (EVar1 == (EntityPtr)0x0) { fVar9 = 80.0; local_24.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); local_2c.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); } else { fVar9 = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x340)); fVar8 = (this->_pos).x - *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x33c)); fVar9 = sqrtf(fVar9 * fVar9 + fVar8 * fVar8); local_10.x = *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x360)) * fVar9 * 0.08 + *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x33c)); local_1c.x = *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x364)) * fVar9 * 0.08 + *GHIDRA_CAST((GHIDRA_CAST(EVar1) + 0x340)); local_24.x = local_10.x - (this->_pos).x; local_24.y = local_1c.x - (this->_pos).y; pVVar5 = (GHIDRA_CAST((&local_24)))->Vector::Normalized(&local_2c); fVar9 = 10.0; local_24.x = pVVar5->x * 60.0 + local_10.x; local_2c.x = pVVar5->y * 60.0 + local_1c.x; } fVar10 = (this->_pos).x - local_24.x; fVar8 = (this->_pos).y - local_2c.x; local_1c.x = fVar9; local_10.x = local_24.x; local_10.y = local_2c.x; fVar9 = sqrtf(fVar8 * fVar8 + fVar10 * fVar10); if (180.0 < fVar9) { local_24.x = local_24.x - (this->_pos).x; local_24.y = local_2c.x - (this->_pos).y; pVVar5 = (GHIDRA_CAST((&local_24)))->Vector::Normalized(&local_2c); local_10.x = pVVar5->x * 180.0 + (this->_pos).x; local_10.y = pVVar5->y * 180.0 + (this->_pos).y; } pVVar5 = Room::FindFreePickupSpawnPosition(room,&local_1c,&local_10,local_1c.x,1,0,0); (this->_targetPosition).x = pVVar5->x; (this->_targetPosition).y = pVVar5->y; this->_orbitSpeed = 0.0; *piVar3 = 2; } else { if (0 < iVar4) { this->_keys = iVar4 + -1; } this->_coins = this->_coins + -1; } goto LAB_00640d9b; while( true ) { bVar2 = animNameChar[1]; bVar7 = bVar2 < wantedAnimChar[1]; if (bVar2 != wantedAnimChar[1]) goto LAB_00640fa0; animNameChar = animNameChar + 2; wantedAnimChar = wantedAnimChar + 2; if (bVar2 == 0) break; LAB_00640f80: bVar2 = *animNameChar; bVar7 = bVar2 < *wantedAnimChar; if (bVar2 != *wantedAnimChar) { LAB_00640fa0: uVar6 = -GHIDRA_UINT(bVar7) | 1; goto LAB_00640fa5; } if (bVar2 == 0) break; } uVar6 = 0; LAB_00640fa5: if (uVar6 == 0) { *piVar3 = 1; this->_coins = 5; uVar6 = Random(); this->_hearts = (uVar6 & 3) + 2; } LAB_00640d9b: iVar4 = this->_state; if (((iVar4 != 0) && (((this->_targetPosition).x != g_vectorZero.x || ((this->_targetPosition).y != g_vectorZero.y) ))) && ((iVar4 == 1 || (((iVar4 == 2 && ((this->_sprite)._animState._animData != (void *)0x0)) && (bVar2 = (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::WasEventTriggered(s_Jump), bVar2 != 0)))))) { jumpProgress = this->_orbitSpeed + 0.02; this->_orbitSpeed = jumpProgress; fVar9 = (this->_pos).x; fVar8 = (this->_pos).y; fVar10 = (this->_targetPosition).y; friction = *frictionPtr; (this->_velocity).x = ((((this->_targetPosition).x - fVar9) * jumpProgress + fVar9) - fVar9) / *frictionPtr; (this->_velocity).y = (((fVar10 - fVar8) * jumpProgress + fVar8) - fVar8) / friction; if (1.0 <= this->_orbitSpeed) { (this->_targetPosition).x = g_vectorZero.x; (this->_targetPosition).y = g_vectorZero.y; } } return; } // 006414c0 void Entity_Familiar::zhl_misfit_006414c0() { ANM2 *pAVar1; byte bVar2; float *damageEvent; Entity_Player *player; uint uVar3; byte *pbVar4; int oldHallowedCountdown; uint moveRoll; Vector *randomDir; Entity_Effect *splat; Entity *spawnedEffect; byte *pbVar6; byte *expectedNameCh; bool bVar7; float fVar8; float fVar9; EntityPtr *pEVar10; EntityPtr *local_4c; Vector local_48; float local_40; EntityPtr *local_3c; Vector local_38; undefined4 uStack_30; undefined4 uStack_2c; undefined4 uStack_28; undefined4 uStack_24; float fStack_20; float fStack_1c; float fStack_18; float fStack_14; undefined4 uStack_10; undefined4 uStack_c; float *damageEventsEnd; float dipX; float dipY; Game *game; Manager *manager; int oldHallowedCountdown; EntityPtr playerIdx; byte rainbowBlue; local_40 = 1.0; this->_entityGridCollisionClass = 5; this->_entityCollisionClass = 4; if (0.0 < this->_pendingDamage) { this->_pendingDamage = 0.0; damageEventsEnd = (this->_damageEvents)._end; for (damageEvent = (this->_damageEvents)._begin; damageEvent != damageEventsEnd; damageEvent = damageEvent + 0xe) { fVar8 = *damageEvent; if ((GHIDRA_UINT(damageEvent[2]) & 4) != 0) { if (3.5 < fVar8) { fVar8 = 3.5; } *damageEvent = fVar8; } this->_pendingDamage = fVar8 + this->_pendingDamage; } } game = g_game; switch(this->_subtype) { case 1: uVar3 = Random(); if (uVar3 % 3 == 0) { PickEnemyTarget(this,240.0,4,0,&g_vectorZero,15.0); } break; case 3: local_40 = 0.8; break; case 4: if ((((this->_flags & 0x4000) == 0) && (bVar2 = (GHIDRA_CAST((g_game)))->Game::IsPaused(), bVar2 == 0)) && ((~(byte)game->_frameCount & 1) != 0)) { uVar3 = Random(); uVar3 = uVar3 % 6; bVar2 = (&DAT_00b64475)[uVar3 * 3]; rainbowBlue = (&DAT_00b64476)[uVar3 * 3]; (this->_splatColor)._offset[0] = (float)(byte)(&DAT_00b64474)[uVar3 * 3] * 0.003921569; (this->_splatColor)._offset[1] = (float)bVar2 * 0.003921569; (this->_splatColor)._offset[2] = (float)rainbowBlue * 0.003921569; } break; case 6: if ((((this->_flags & 0x4000) == 0) && (bVar2 = (GHIDRA_CAST((g_game)))->Game::IsPaused(), bVar2 == 0)) && (game->_frameCount % 3 == 0)) { local_48.x = 0.0; playerIdx = (EntityPtr)0x0; if (GHIDRA_INT((game->_playerManager)._playerList._end) - GHIDRA_INT((game->_playerManager)._playerList._begin) >> 2 != 0) { do { local_48.x = (float)playerIdx; player = (GHIDRA_CAST((g_game)))->Game::GetPlayer(GHIDRA_UINT(local_48.x)); if (((*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) || (bVar2 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsDescendantOf(GHIDRA_CAST(player)), bVar2 != 0)) && (fVar8 = (this->_pos).y - (player->_pos).y, fVar9 = (this->_pos).x - (player->_pos).x, fVar8 = sqrtf(fVar8 * fVar8 + fVar9 * fVar9), fVar8 < player->_size + 23.33)) { oldHallowedCountdown = player->_hallowedGroundCountdown; oldHallowedCountdown = oldHallowedCountdown + 4; if (4 < oldHallowedCountdown) { oldHallowedCountdown = 4; } player->_hallowedGroundCountdown = oldHallowedCountdown; if (0 < oldHallowedCountdown != 0 < oldHallowedCountdown) { player->_cacheFlags = player->_cacheFlags | 99; (GHIDRA_CAST((player)))->Entity_Player::EvaluateItems(); } } local_48.x = (float)(GHIDRA_INT(local_48.x) + 1); playerIdx = (EntityPtr)local_48.x; } while (GHIDRA_UINT(local_48.x) < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((g_game->_playerManager)._playerList._begin) >> 2))); } } pEVar10 = &this->_child; if (this->_child == (EntityPtr)0x0) { uVar3 = Random(); local_48.x = (float)(GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,0x70,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0, uVar3,0); local_3c = GHIDRA_CAST((GHIDRA_INT(local_48.x) + 0x3bc)); if (*GHIDRA_CAST((GHIDRA_CAST(local_48.x) + 0x3bc)) != (EntityPtr)0x0) { local_4c = local_3c; std::multiset::erase(&local_4c); } *local_3c = (EntityPtr)this; std::multiset::insert(local_3c); fVar8 = (GHIDRA_CAST((GHIDRA_INT(local_48.x) + 0x33c)))->x; fVar9 = *GHIDRA_CAST((GHIDRA_CAST(local_48.x) + 0x340)); dipX = (this->_pos).x; dipY = (this->_pos).y; oldHallowedCountdown = *GHIDRA_CAST(local_48.x); *GHIDRA_CAST((GHIDRA_CAST(local_48.x) + 0x464)) = '\x01'; (GHIDRA_CAST((GHIDRA_INT(local_48.x) + 0xdc)))->x = 0.0; *GHIDRA_CAST((GHIDRA_CAST(local_48.x) + 0x468)) = fVar8 - dipX; *GHIDRA_CAST((GHIDRA_CAST(local_48.x) + 0x46c)) = fVar9 - dipY; *GHIDRA_CAST((GHIDRA_CAST(local_48.x) + 0xe0)) = -8.0; fVar8 = g_vectorOne.y; fVar9 = g_vectorOne.x * 0.33; *GHIDRA_CAST((GHIDRA_CAST(local_48.x) + 0x354)) = 10000; (GHIDRA_CAST((GHIDRA_INT(local_48.x) + 0xe4)))->x = fVar9; *GHIDRA_CAST((GHIDRA_CAST(local_48.x) + 0xe8)) = fVar8 * 0.33; (**(code **)(oldHallowedCountdown + 0xc))(); if (*pEVar10 != (EntityPtr)0x0) { local_3c = pEVar10; std::multiset::erase(&local_3c); } *pEVar10 = (EntityPtr)local_48.x; std::multiset::insert(pEVar10); } } if ((this->_subtype != 1) && (uVar3 = Random(), uVar3 % 10 == 0)) { PickEnemyTarget(this,40.0,4,0,&g_vectorZero,15.0); } if (this->_target == (EntityPtr)0x0) { this->_headFrameDelay = 0; } oldHallowedCountdown = this->_state; if (oldHallowedCountdown == 0) { pbVar4 = (this->_sprite)._animState._animData; if (pbVar4 == GHIDRA_CAST(0x0)) { LAB_00641d0e: bVar2 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(s_Idle,1); if (bVar2 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } } else { pbVar6 = pbVar4; if (0xf < *GHIDRA_CAST((pbVar4 + 0x14))) { pbVar6 = *GHIDRA_CAST(pbVar4); } expectedNameCh = s_Idle; do { bVar2 = *pbVar6; bVar7 = bVar2 < *expectedNameCh; if (bVar2 != *expectedNameCh) { LAB_00641cf0: uVar3 = -GHIDRA_UINT(bVar7) | 1; goto LAB_00641cf5; } if (bVar2 == 0) break; bVar2 = pbVar6[1]; bVar7 = bVar2 < expectedNameCh[1]; if (bVar2 != expectedNameCh[1]) goto LAB_00641cf0; pbVar6 = pbVar6 + 2; expectedNameCh = expectedNameCh + 2; } while (bVar2 != 0); uVar3 = 0; LAB_00641cf5: if ((uVar3 != 0) || ((pbVar4[0x34] != 0 && ((this->_sprite)._animState._isPlaying == 0)))) goto LAB_00641d0e; } uVar3 = 10; if (this->_subtype == 0xc) { uVar3 = 0x14; } else if (this->_subtype == 0xd) { uVar3 = 3; } moveRoll = Random(); if ((moveRoll % uVar3 == 0) && (this->_visible != 0)) { pEVar10 = &this->_target; if ((this->_subtype != 1) && (((*pEVar10 != (EntityPtr)0x0 && (this->_headFrameDelay == 0)) && (uVar3 = Random(), (uVar3 & 3) == 0)))) { if (*pEVar10 != (EntityPtr)0x0) { local_3c = pEVar10; std::multiset::erase(&local_3c); } *pEVar10 = (EntityPtr)0x0; } local_48.x = *GHIDRA_CAST(pEVar10); if ((EntityPtr)local_48.x == (EntityPtr)0x0) { local_48.x = (float)this->_player; } fVar8 = local_48.x; local_38.y = *GHIDRA_CAST((GHIDRA_CAST(local_48.x) + 0x340)); local_38.x = *GHIDRA_CAST((GHIDRA_CAST(local_48.x) + 0x33c)); bVar2 = (GHIDRA_CAST((g_game->_room)))->Room::CheckLine(&this->_pos,&local_38,1,999,0,0,GHIDRA_CAST(0x0)); if (bVar2 == 0) { local_38.x = this->_friction; local_3c = GHIDRA_CAST((this->_velocity).x); local_4c = GHIDRA_CAST((this->_velocity).y); (GHIDRA_CAST((GHIDRA_CAST(&this->_pathfinder))))->PathFinder::Reset(); local_48.y = *GHIDRA_CAST((GHIDRA_CAST(local_48.x) + 0x340)); local_48.x = *GHIDRA_CAST((GHIDRA_CAST(local_48.x) + 0x33c)); PathFinder::FindGridPath(GHIDRA_CAST(&this->_pathfinder),&local_48,1.0,0,1); fVar8 = (this->_velocity).x; fVar9 = (this->_pos).y + (this->_velocity).y; (this->_velocity).x = (float)local_3c; (this->_velocity).y = (float)local_4c; this->_friction = local_38.x; pEVar10 = GHIDRA_CAST((fVar8 + (this->_pos).x)); } else { pEVar10 = *GHIDRA_CAST((GHIDRA_CAST(fVar8) + 0x33c)); fVar9 = *GHIDRA_CAST((GHIDRA_CAST(fVar8) + 0x340)); local_4c = pEVar10; local_48.x = fVar9; if ((void *)fVar8 == this->_player) { randomDir = MusicManager::RandomVector(&local_38); uVar3 = Random(); fVar8 = (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * 2.3283064e-10 * 80.0; fVar9 = local_48.x + fVar8 * randomDir->y; pEVar10 = GHIDRA_CAST(((float)local_4c + fVar8 * randomDir->x)); } else if (this->_subtype == 1) { local_40 = 2.0; } } fVar8 = (this->_pos).x; if ((fVar8 == (float)pEVar10) && ((this->_pos).y == fVar9)) { uVar3 = Random(); local_38.x = (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * 2.3283064e-10 * 3.14; local_38.x = local_38.x + local_38.x; local_48.x = sin(local_38.x); local_4c = GHIDRA_CAST(cos(local_38.x)); } else { local_48.x = fVar9 - (this->_pos).y; local_4c = GHIDRA_CAST(((float)pEVar10 - fVar8)); fVar8 = sqrtf((float)local_4c * (float)local_4c + local_48.x * local_48.x); if (0.0 < fVar8) { local_4c = GHIDRA_CAST(((float)local_4c * (1.0 / fVar8))); local_48.x = local_48.x * (1.0 / fVar8); } } uVar3 = Random(); fVar8 = this->_friction; fVar9 = (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * 2.3283064e-10 * 5.0 + 5.0; (this->_velocity).y = (fVar9 * local_48.x * local_40) / fVar8 + (this->_velocity).y; (this->_velocity).x = (fVar9 * (float)local_4c * local_40) / fVar8 + (this->_velocity).x; this->_state = 1; } fVar8 = this->_friction * 0.8; LAB_006420cf: this->_friction = fVar8; } else { if (oldHallowedCountdown == 1) { pbVar4 = (this->_sprite)._animState._animData; if (pbVar4 == GHIDRA_CAST(0x0)) { LAB_00641c4e: bVar2 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(&DAT_00b1d6fc,1); if (bVar2 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } } else { pbVar6 = pbVar4; if (0xf < *GHIDRA_CAST((pbVar4 + 0x14))) { pbVar6 = *GHIDRA_CAST(pbVar4); } expectedNameCh = &DAT_00b1d6fc; do { bVar2 = *pbVar6; bVar7 = bVar2 < *expectedNameCh; if (bVar2 != *expectedNameCh) { LAB_00641c30: uVar3 = -GHIDRA_UINT(bVar7) | 1; goto LAB_00641c35; } if (bVar2 == 0) break; bVar2 = pbVar6[1]; bVar7 = bVar2 < expectedNameCh[1]; if (bVar2 != expectedNameCh[1]) goto LAB_00641c30; pbVar6 = pbVar6 + 2; expectedNameCh = expectedNameCh + 2; } while (bVar2 != 0); uVar3 = 0; LAB_00641c35: if ((uVar3 != 0) || ((pbVar4[0x34] != 0 && ((this->_sprite)._animState._isPlaying == 0)))) goto LAB_00641c4e; } fVar8 = (this->_velocity).y; fVar9 = (this->_velocity).x; if (fVar9 * fVar9 + fVar8 * fVar8 < 1.0) { this->_state = 0; } fVar8 = this->_friction * 0.95; goto LAB_006420cf; } if (oldHallowedCountdown == 2) { pbVar4 = (this->_sprite)._animState._animData; if (pbVar4 == GHIDRA_CAST(0x0)) { LAB_00641976: bVar2 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(&DAT_00b1d6fc,1); if (bVar2 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } } else { if (0xf < *GHIDRA_CAST((pbVar4 + 0x14))) { pbVar4 = *GHIDRA_CAST(pbVar4); } pbVar6 = &DAT_00b1d6fc; do { bVar2 = *pbVar4; bVar7 = bVar2 < *pbVar6; if (bVar2 != *pbVar6) { LAB_00641956: uVar3 = -GHIDRA_UINT(bVar7) | 1; goto LAB_0064195b; } if (bVar2 == 0) break; bVar2 = pbVar4[1]; bVar7 = bVar2 < pbVar6[1]; if (bVar2 != pbVar6[1]) goto LAB_00641956; pbVar4 = pbVar4 + 2; pbVar6 = pbVar6 + 2; } while (bVar2 != 0); uVar3 = 0; LAB_0064195b: if ((uVar3 != 0) || ((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animData) + 0x34)) != '\0' && ((this->_sprite)._animState._isPlaying == 0)))) goto LAB_00641976; } if (((this->_targetPosition).x == g_vectorZero.x) && ((this->_targetPosition).y == g_vectorZero.y)) { fVar8 = this->_orbitSpeed + 0.7; this->_orbitSpeed = fVar8; fVar9 = fVar8 + (this->_posOffset).y; (this->_posOffset).y = fVar9; if (-26.0 <= fVar9) { this->_entityGridCollisionClass = (fVar9 < -3.0) + 5; } else { this->_entityGridCollisionClass = 3; } } else { this->_entityGridCollisionClass = 3; this->_entityCollisionClass = 0; (this->_velocity).x = (this->_orbitDistance).x; (this->_velocity).y = (this->_orbitDistance).y; fVar8 = this->_orbitSpeed + 0.7; this->_orbitSpeed = fVar8; fVar9 = fVar8 + (this->_posOffset).y; (this->_posOffset).y = fVar9; } if (-fVar8 < fVar9) { if (((this->_targetPosition).x == g_vectorZero.x) && ((this->_targetPosition).y == g_vectorZero.y)) { local_38.x = (this->_pos).x; local_38.y = (this->_pos).y; oldHallowedCountdown = (GHIDRA_CAST((g_game->_room)))->Room::GetGridCollisionAtPos(this->_pos); if (oldHallowedCountdown == 1) { uVar3 = Random(); (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,0xf,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),1,uVar3,0); this->Remove(); return; } if ((this->_target != (EntityPtr)0x0) || (PickEnemyTarget(this,80.0,1,0,&g_vectorZero,15.0), this->_target != (EntityPtr)0x0)) { this->_headFrameDelay = 1; } } manager = g_manager; (this->_posOffset).y = 0.0; this->_orbitSpeed = 0.0; (this->_targetPosition).x = g_vectorZero.x; (this->_targetPosition).y = g_vectorZero.y; this->_state = 0; if (this->_subtype == 0xc) { local_40 = 6.82432e-43; } else { local_40 = 3.61535e-43; } seed_fart_sound_override(GHIDRA_CAST(&local_40)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_40),1.0,2,0,1.0,0.0); } } } uVar3 = Random(); if ((uVar3 % 0x14 == 0) && (this->_subtype != 0xc)) { uVar3 = Random(); splat = Entity_NPC::MakeSplat (GHIDRA_CAST(this), (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * 2.3283064e-10 * 0.5 + 0.2); splat->SetColor(&this->_splatColor,0xffffffff,0xff,0,1); } game = g_game; if (this->_dead == 0) { oldHallowedCountdown = this->_subtype; if (oldHallowedCountdown == 1) { if (g_game->_frameCount - this->_spawnFrame < 0x1c2) { fVar9 = this->_health + 0.03; fVar8 = this->_maxHitPoints; if (fVar9 <= fVar8) { fVar8 = fVar9; } this->_health = fVar8; } else { uStack_30 = 0; uStack_2c = 0; uStack_28 = 0; uStack_24 = 0; fStack_20 = g_vectorZero.x; fStack_1c = g_vectorZero.y; fStack_18 = g_vectorZero.x; fStack_14 = g_vectorZero.y; uStack_10 = 0; uStack_c = 0; this->Kill(&uStack_30); } } else { if (oldHallowedCountdown == 5) { if (((this->_flags & 0x4000) != 0) || (bVar2 = (GHIDRA_CAST((g_game)))->Game::IsPaused(), bVar2 != 0)) goto LAB_0064243e; uVar3 = game->_frameCount + this->_index & 0x80000003; bVar7 = uVar3 == 0; if (GHIDRA_INT(uVar3) < 0) { bVar7 = (uVar3 - 1 | 0xfffffffc) == 0xffffffff; } if ((!bVar7) || (uVar3 = Random(), (uVar3 & 1) != 0)) goto LAB_0064243e; uVar3 = Random(); spawnedEffect = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,0x2d,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar3,0); uVar3 = Random(); fVar8 = (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * 2.3283064e-10 * 0.2 + 0.4; fVar9 = fVar8 * g_vectorOne.y; fVar8 = fVar8 * g_vectorOne.x; pAVar1 = &spawnedEffect[1]._sprite; (pAVar1->_filename)._buf[4] = 'Z'; (pAVar1->_filename)._buf[5] = '\0'; (pAVar1->_filename)._buf[6] = '\0'; (pAVar1->_filename)._buf[7] = '\0'; (spawnedEffect->_sprite)._scale.y = fVar9; pAVar1 = &spawnedEffect[1]._sprite; (pAVar1->_filename)._buf[8] = 'Z'; (pAVar1->_filename)._buf[9] = '\0'; (pAVar1->_filename)._buf[10] = '\0'; (pAVar1->_filename)._buf[0xb] = '\0'; (spawnedEffect->_sprite)._scale.x = fVar8; } else { if (((oldHallowedCountdown != 0xe) || ((this->_flags & 0x4000) != 0)) || (bVar2 = (GHIDRA_CAST((g_game)))->Game::IsPaused(), bVar2 != 0)) goto LAB_0064243e; uVar3 = game->_frameCount + this->_index & 0x80000007; bVar7 = uVar3 == 0; if (GHIDRA_INT(uVar3) < 0) { bVar7 = (uVar3 - 1 | 0xfffffff8) == 0xffffffff; } if ((!bVar7) || (uVar3 = Random(), uVar3 % 3 != 0)) goto LAB_0064243e; uVar3 = Random(); spawnedEffect = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,0x8d,&this->_pos,&g_vectorZero,this->_player,0,uVar3,0); uVar3 = Random(); fVar8 = (float)((double)GHIDRA_INT(uVar3) + __uint_to_double_fixup[-(GHIDRA_INT(uVar3) >> 0x1f)]) * 2.3283064e-10 * 0.2 + 0.5; fVar9 = fVar8 * g_vectorOne.y; fVar8 = fVar8 * g_vectorOne.x; pAVar1 = &spawnedEffect[1]._sprite; (pAVar1->_filename)._buf[4] = '<'; (pAVar1->_filename)._buf[5] = '\0'; (pAVar1->_filename)._buf[6] = '\0'; (pAVar1->_filename)._buf[7] = '\0'; (spawnedEffect->_sprite)._scale.y = fVar9; pAVar1 = &spawnedEffect[1]._sprite; (pAVar1->_filename)._buf[8] = '<'; (pAVar1->_filename)._buf[9] = '\0'; (pAVar1->_filename)._buf[10] = '\0'; (pAVar1->_filename)._buf[0xb] = '\0'; (spawnedEffect->_sprite)._scale.x = fVar8; spawnedEffect->SetCollisionDamage(*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x157c)) * 0.5); } spawnedEffect->Update(); } } LAB_0064243e: if ((0.0 < this->_pendingDamage) && (bVar2 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0), bVar2 != 0)) { this->_pendingDamage = 0.0; damageEventsEnd = (this->_damageEvents)._end; for (damageEvent = (this->_damageEvents)._begin; damageEvent != damageEventsEnd; damageEvent = damageEvent + 0xe) { fVar8 = *damageEvent; *damageEvent = fVar8 * 0.5; this->_pendingDamage = fVar8 * 0.5 + this->_pendingDamage; } } (this->_sprite)._flipX = (this->_velocity).x <= 0.0 && (this->_velocity).x != 0.0; return; } // 006424d0 void Entity_Familiar::ai_bird_cage() { byte bVar1; byte *curAnimName; uint uVar2; Vector *pVVar3; Entity *tmpEntity; char *expectedAnimName; Entity **targetRef; int iVar4; bool isLess; float fVar5; float fVar6; float targetDy; Entity *local_3c; Vector local_38; Vector local_30; float enemyDistance; int deathmatchMode; Entity *local_20; undefined4 *local_1c; float local_18; float awayDirY; void *local_10; undefined1 *puStack_c; undefined4 uStack_8; byte *animData; Manager *manager; EntityPtr *parentRef; EntityPtr target; uStack_8 = 0xffffffff; puStack_c = &LAB_00af7060; local_10 = ExceptionList; ExceptionList = &local_10; switch(this->_state) { case 0: PickEnemyTarget(this,10000.0,0,5,&g_vectorZero,15.0); target = this->_target; if (target != (EntityPtr)0x0) { fVar6 = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x340)); (this->_targetPosition).x = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x33c)); (this->_targetPosition).y = fVar6; bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(&DAT_00b1e0e4,1); if (bVar1 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } this->_state = 1; ExceptionList = local_10; return; } animData = (this->_sprite)._animState._animData; if (animData != GHIDRA_CAST(0x0)) { curAnimName = animData; if (0xf < *GHIDRA_CAST((animData + 0x14))) { curAnimName = *GHIDRA_CAST(animData); } expectedAnimName = "Flying"; do { bVar1 = *curAnimName; isLess = bVar1 < (byte)*expectedAnimName; if (bVar1 != *expectedAnimName) { LAB_006425d0: uVar2 = -GHIDRA_UINT(isLess) | 1; goto LAB_006425d5; } if (bVar1 == 0) break; bVar1 = curAnimName[1]; isLess = bVar1 < (byte)expectedAnimName[1]; if (bVar1 != expectedAnimName[1]) goto LAB_006425d0; curAnimName = curAnimName + 2; expectedAnimName = expectedAnimName + 2; } while (bVar1 != 0); uVar2 = 0; LAB_006425d5: if ((uVar2 == 0) && ((animData[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_00642608; } bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST("Flying"),1); if (bVar1 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } LAB_00642608: this->_state = 3; ExceptionList = local_10; return; case 1: if (((this->_sprite)._animState._animData == (void *)0x0) || ((this->_sprite)._animState._isPlaying == 0)) { animData = (this->_sprite)._animState._animData; if (animData == GHIDRA_CAST(0x0)) { LAB_00642686: bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST("JumpDown"),1); if (bVar1 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } } else { curAnimName = animData; if (0xf < *GHIDRA_CAST((animData + 0x14))) { curAnimName = *GHIDRA_CAST(animData); } expectedAnimName = "JumpDown"; do { bVar1 = *curAnimName; isLess = bVar1 < (byte)*expectedAnimName; if (bVar1 != *expectedAnimName) { LAB_00642670: uVar2 = -GHIDRA_UINT(isLess) | 1; goto LAB_00642675; } if (bVar1 == 0) break; bVar1 = curAnimName[1]; isLess = bVar1 < (byte)expectedAnimName[1]; if (bVar1 != expectedAnimName[1]) goto LAB_00642670; curAnimName = curAnimName + 2; expectedAnimName = expectedAnimName + 2; } while (bVar1 != 0); uVar2 = 0; LAB_00642675: if ((uVar2 != 0) || ((animData[0x34] != 0 && ((this->_sprite)._animState._isPlaying == 0)))) goto LAB_00642686; } this->_state = 2; } target = this->_target; local_20 = GHIDRA_CAST(&this->_target); if (target == (EntityPtr)0x0) goto LAB_00642705; if (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x173)) == '\0') { fVar6 = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x340)); (this->_targetPosition).x = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x33c)); (this->_targetPosition).y = fVar6; goto LAB_00642705; } targetRef = &local_20; break; case 2: pVVar3 = &this->_pos; pVVar3->x = (this->_targetPosition).x; (this->_pos).y = (this->_targetPosition).y; if ((this->_sprite)._animState._animData == (void *)0x0) { LAB_00642bca: if (((this->_sprite)._animState._animData == (void *)0x0) || ((this->_sprite)._animState._isPlaying == 0)) { (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST("Flying"),0); this->_state = 3; } } else { bVar1 = (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::IsEventTriggered(&DAT_00b1d3b0); manager = g_manager; if (bVar1 == 0) goto LAB_00642bca; local_18 = 7.28675e-44; seed_fart_sound_override(GHIDRA_CAST(&local_18)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_18),1.0,2,0,1.0,0.0); (GHIDRA_CAST((g_game)))->Game::BombDamage(pVVar3,45.0,24.0,1,this->_player,(BitSet128)ZEXT816(0),4,0); uVar2 = Random(); local_3c = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,0x48,pVVar3,&g_vectorZero,this->_player,0,uVar2,0); parentRef = &local_3c->_parent; if (local_3c->_parent != (EntityPtr)0x0) { local_20 = GHIDRA_CAST(parentRef); std::multiset::erase(&local_20); } *parentRef = (EntityPtr)this; std::multiset::insert(parentRef); awayDirY = 0.0; local_18 = 0.0; local_20 = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x1264)); if (local_20 != GHIDRA_CAST(0x0)) { deathmatchMode = *GHIDRA_CAST(&g_game->_deathmatchManager); local_1c = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x125c)); do { tmpEntity = GHIDRA_CAST(*local_1c); local_38.y = (tmpEntity->_pos).y - (this->_pos).y; local_30.y = (tmpEntity->_pos).x - (this->_pos).x; enemyDistance = sqrtf(local_30.y * local_30.y + local_38.y * local_38.y); if ((deathmatchMode < 2) || (tmpEntity->_type != 1)) { iVar4 = tmpEntity->_type; if (iVar4 - 10U < 0x3de) goto LAB_006428f9; } else { iVar4 = 1; LAB_006428f9: if ((((((tmpEntity->_entityCollisionClass != 1) && (tmpEntity->_entityCollisionClass != 0)) && (tmpEntity->_isInvicible == 0)) && (tmpEntity->_dead == 0)) && (((bVar1 = (GHIDRA_CAST((tmpEntity)))->Entity::HasEntityFlags(0x10), bVar1 == 0 || (iVar4 == 0x322)) || (iVar4 == 0x362)))) && ((enemyDistance <= 256.0 && (0.0 < enemyDistance)))) { local_18 = local_30.y / enemyDistance + local_18; awayDirY = local_38.y / enemyDistance + awayDirY; } } local_1c = local_1c + 1; local_20 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_20[-1])) + 0x40f)))); } while (local_20 != GHIDRA_CAST(0x0)); local_20 = GHIDRA_CAST(0x0); } fVar5 = awayDirY; fVar6 = local_18; if (awayDirY * awayDirY + local_18 * local_18 < 0.001) { pVVar3 = MusicManager::RandomVector(&local_38); fVar6 = pVVar3->x; fVar5 = pVVar3->y; } local_18 = atan2f(fVar5,fVar6); local_18 = local_18 * 57.295776; iVar4 = *GHIDRA_CAST(local_3c); *GHIDRA_CAST((local_3c[1]._sprite._animDefaultName._buf + 4)) = local_18; (**(code **)(iVar4 + 0xc))(); bVar1 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0); if (bVar1 != 0) { local_20 = GHIDRA_CAST(0x3); do { local_18 = local_18 + 90.0; uVar2 = Random(); tmpEntity = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,0x48,&this->_pos,&g_vectorZero,this->_player,0,uVar2 ,0); parentRef = &tmpEntity->_parent; if (tmpEntity->_parent != (EntityPtr)0x0) { local_3c = GHIDRA_CAST(parentRef); std::multiset::erase(&local_3c); } *parentRef = (EntityPtr)this; std::multiset::insert(parentRef); iVar4 = *GHIDRA_CAST(tmpEntity); *GHIDRA_CAST((tmpEntity[1]._sprite._animDefaultName._buf + 4)) = local_18; (**(code **)(iVar4 + 0xc))(); local_20 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_20[-1])) + 0x40f)))); } while (local_20 != GHIDRA_CAST(0x0)); } iVar4 = 4; do { uVar2 = Random(); local_3c = (Entity *) ((float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) * 2.3283064e-10 * 360.0 * 0.017453292); local_20 = GHIDRA_CAST(cos((float)local_3c)); local_1c = GHIDRA_CAST(sin((float)local_3c)); uVar2 = Random(); fVar6 = (float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]) * 2.3283064e-10; local_30.y = fVar6 * (float)local_1c * 12.0 + (this->_pos).y; local_30.x = fVar6 * (float)local_20 * 12.0 + (this->_pos).x; uVar2 = Random(); local_38.x = (float)local_20 * 5.0; local_38.y = (float)local_1c * 5.0; tmpEntity = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,4,&local_30,&local_38,GHIDRA_CAST(0x0),0,uVar2,0); tmpEntity->Update(); iVar4 = iVar4 + -1; } while (iVar4 != 0); (GHIDRA_CAST((g_game)))->Game::ShakeScreen(0xc); } target = this->_target; local_3c = GHIDRA_CAST(&this->_target); if (target == (EntityPtr)0x0) goto LAB_00642705; if (*GHIDRA_CAST((GHIDRA_CAST(target) + 0x173)) == '\0') { fVar6 = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x340)); fVar5 = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x33c)) - (this->_targetPosition).x; targetDy = fVar6 - (this->_targetPosition).y; if (targetDy * targetDy + fVar5 * fVar5 < 10000.0) { (this->_targetPosition).x = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x33c)); (this->_targetPosition).y = fVar6; } goto LAB_00642705; } targetRef = &local_3c; break; case 3: ai_flying_bird(this,__security_cookie ^ GHIDRA_INT(register0x00000010) - 4U); default: ExceptionList = local_10; return; } std::multiset::erase(targetRef); this->_target = (EntityPtr)0x0; LAB_00642705: (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; ExceptionList = local_10; return; } // 006431d0 void Entity_Familiar::ai_bot_fly() { BitSet128 flags; byte bVar1; byte *pbVar2; uint uVar3; Entity *projectile; Entity_Tear *tear; char *pcVar4; byte *pbVar5; EntityPtr *targetRef; bool isLess; float fVar6; float fVar7; float fVar8; float fVar9; EntityPtr *targetRef; float fVar11; float local_3c; EntityPtr *local_34; Vector local_30; uint uStack_28; EntityPtr *local_14 [4]; EntityPtr target; float *targetPosX; int vtable; pcVar4 = GHIDRA_CAST(this); if (((this->_sprite)._animState._animData != (void *)0x0) && ((this->_sprite)._animState._isPlaying != 0)) { pbVar2 = (this->_sprite)._animState._animData; if (pbVar2 == GHIDRA_CAST(0x0)) { pbVar2 = &s_empty; } else if (0xf < *GHIDRA_CAST((pbVar2 + 0x14))) { pbVar2 = *GHIDRA_CAST(pbVar2); } pcVar4 = "Attack"; do { bVar1 = *pbVar2; isLess = bVar1 < (byte)*pcVar4; if (bVar1 != *pcVar4) { LAB_00643230: uVar3 = -GHIDRA_UINT(isLess) | 1; goto LAB_00643235; } if (bVar1 == 0) break; bVar1 = pbVar2[1]; isLess = bVar1 < (*GHIDRA_CAST((GHIDRA_CAST(((byte)(GHIDRA_CAST(pcVar4)))) + 0x1))); if (bVar1 != (*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(pcVar4)))) + 0x1)))) goto LAB_00643230; pbVar2 = pbVar2 + 2; pcVar4 = &(*GHIDRA_CAST((GHIDRA_CAST(((GHIDRA_CAST(pcVar4)))) + 0x2))); } while (bVar1 != 0); uVar3 = 0; LAB_00643235: if (uVar3 == 0) { target_threatening_projectile(this,128.0,GHIDRA_INT(pcVar4),1); targetRef = &this->_target; if (this->_target != (EntityPtr)0x0) { fVar6 = (this->_pos).x; targetPosX = GHIDRA_CAST((GHIDRA_INT(this->_target) + 0x33c)); (this->_sprite)._flipX = *targetPosX <= fVar6 && fVar6 != *targetPosX; } if ((this->_sprite)._animState._animData == (void *)0x0) { return; } local_14[0] = targetRef; bVar1 = (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::IsEventTriggered(GHIDRA_CAST("Shoot")); if (bVar1 == 0) { return; } if ((1 < *GHIDRA_CAST(&g_game->_deathmatchManager)) && (uVar3 = Random(), uVar3 % 3 != 0)) { return; } target = *targetRef; if (target == (EntityPtr)0x0) { if ((this->_sprite)._flipX == 0) { fVar6 = 15.0; } else { fVar6 = -15.0; } local_30.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x360)) * 0.6; fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x364)) * 0.6; local_30.x = local_30.x + local_30.x; local_34 = GHIDRA_CAST((fVar8 + fVar8)); local_3c = 0.0; fVar8 = sqrtf(fVar6 * fVar6 + 0.0); if (fVar8 <= 0.0) { fVar9 = local_3c; fVar11 = fVar6; } else { fVar9 = (1.0 / fVar8) * 0.0; fVar11 = (1.0 / fVar8) * fVar6; } fVar7 = 0.0; local_3c = fVar6; if (0.0 < fVar8) { fVar7 = (1.0 / fVar8) * 0.0; local_3c = (1.0 / fVar8) * fVar6; } fVar8 = (float)local_34 * fVar7 + local_30.x * local_3c; fVar9 = fVar9 * fVar8; fVar11 = fVar11 * fVar8; targetRef = local_34; if (fVar11 * fVar6 + fVar9 * 0.0 < 0.0) { local_30.x = local_30.x - fVar11; targetRef = GHIDRA_CAST(((float)local_34 - fVar9)); } local_30.y = (float)targetRef + 0.0; fVar6 = local_30.x + fVar6; } else { fVar6 = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(target) + 0x340)); fVar8 = (this->_pos).x - *GHIDRA_CAST((GHIDRA_CAST(target) + 0x33c)); fVar6 = sqrtf(fVar6 * fVar6 + fVar8 * fVar8); target = *targetRef; fVar9 = (fVar6 * 0.05 * *GHIDRA_CAST((GHIDRA_CAST(target) + 0x364)) + *GHIDRA_CAST((GHIDRA_CAST(target) + 0x340))) - (this->_pos).y; fVar6 = (fVar6 * 0.05 * *GHIDRA_CAST((GHIDRA_CAST(target) + 0x360)) + *GHIDRA_CAST((GHIDRA_CAST(target) + 0x33c))) - (this->_pos).x; fVar8 = sqrtf(fVar9 * fVar9 + fVar6 * fVar6); if (fVar8 <= 0.0) { local_30.y = fVar9; } else { fVar6 = fVar6 * (15.0 / fVar8); local_30.y = fVar9 * (15.0 / fVar8); } } local_30.x = fVar6; if ((this->_flags & 0x100) == 0) { uVar3 = Random(); tear = (Entity_Tear *) (GHIDRA_CAST((g_game)))->Game::SpawnEx(2,10,&this->_pos,&local_30,GHIDRA_CAST(this),0,uVar3,0); tear->SetCollisionDamage(0x40400000); local_30.x = (float)((*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShielded._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._l)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._l)) + 0x4)))); uStack_28 = (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagShielded._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagSpectral._h)) + 0x4))) | (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagHoming._h)) + 0x4))); local_34 = (EntityPtr *) (GHIDRA_UINT(g_tearFlagShielded._l) | GHIDRA_UINT(g_tearFlagSpectral._l) | GHIDRA_UINT(g_tearFlagHoming._l)); local_30.y = (float)(GHIDRA_UINT(g_tearFlagShielded._h) | GHIDRA_UINT(g_tearFlagSpectral._h) | GHIDRA_UINT(g_tearFlagHoming._h)); (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x4))) = local_30.x; (*GHIDRA_CAST((GHIDRA_CAST(&(flags._l)) + 0x0))) = local_34; (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x0))) = local_30.y; (*GHIDRA_CAST((GHIDRA_CAST(&(flags._h)) + 0x4))) = uStack_28; (GHIDRA_CAST((tear)))->Entity_Tear::SetTearFlags(flags); tear->_baseScale = 0.8; tear->_fScale = 0.8; (GHIDRA_CAST((tear)))->Entity_Tear::ResetSpriteScale(); tear->_fallingAccel = 0.2; target = this->_target; if (target != (EntityPtr)0x0) { if (tear->_target != (EntityPtr)0x0) { local_34 = &tear->_target; std::multiset::erase(&local_34); } tear->_target = target; std::multiset::insert(&tear->_target); } tear->Update(); (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::convert_shot_for_enemy_owner(GHIDRA_CAST(tear)); targetRef = local_14[0]; } else { uVar3 = Random(); projectile = (GHIDRA_CAST((g_game)))->Game::SpawnEx(9,0,&this->_pos,&local_30,GHIDRA_CAST(this),0,uVar3,0); vtable = *GHIDRA_CAST(projectile); projectile[1]._type = 0x2000; projectile[1]._variant = 0x1000; projectile[1]._damageEvents._begin = (void *)0x3f4ccccd; (**(code **)(vtable + 0xc))(); } target = *targetRef; if (target == (EntityPtr)0x0) { return; } *GHIDRA_CAST((GHIDRA_CAST(target) + 0x168)) = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x168)) | 0x10; *GHIDRA_CAST((GHIDRA_CAST(target) + 0x16c)) = *GHIDRA_CAST((GHIDRA_CAST(target) + 0x16c)); if (*targetRef != (EntityPtr)0x0) { local_14[0] = targetRef; std::multiset::erase(local_14); } *targetRef = (EntityPtr)0x0; return; } } target_threatening_projectile(this,128.0,GHIDRA_INT(pcVar4),0); pbVar2 = (this->_sprite)._animState._animData; if (pbVar2 != GHIDRA_CAST(0x0)) { if (0xf < *GHIDRA_CAST((pbVar2 + 0x14))) { pbVar2 = *GHIDRA_CAST(pbVar2); } pbVar5 = s_Fly; do { bVar1 = *pbVar2; isLess = bVar1 < *pbVar5; if (bVar1 != *pbVar5) { LAB_006436f0: uVar3 = -GHIDRA_UINT(isLess) | 1; goto LAB_006436f5; } if (bVar1 == 0) break; bVar1 = pbVar2[1]; isLess = bVar1 < pbVar5[1]; if (bVar1 != pbVar5[1]) goto LAB_006436f0; pbVar2 = pbVar2 + 2; pbVar5 = pbVar5 + 2; } while (bVar1 != 0); uVar3 = 0; LAB_006436f5: if ((uVar3 == 0) && ((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animData) + 0x34)) == '\0' || ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_00643729; } bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(s_Fly,1); if (bVar1 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } LAB_00643729: if (this->_target != (EntityPtr)0x0) { pbVar2 = (this->_sprite)._animState._animData; if (pbVar2 != GHIDRA_CAST(0x0)) { pbVar5 = pbVar2; if (0xf < *GHIDRA_CAST((pbVar2 + 0x14))) { pbVar5 = *GHIDRA_CAST(pbVar2); } pcVar4 = "Attack"; do { bVar1 = *pbVar5; isLess = bVar1 < (byte)*pcVar4; if (bVar1 != *pcVar4) { LAB_00643768: uVar3 = -GHIDRA_UINT(isLess) | 1; goto LAB_0064376d; } if (bVar1 == 0) break; bVar1 = pbVar5[1]; isLess = bVar1 < (byte)pcVar4[1]; if (bVar1 != pcVar4[1]) goto LAB_00643768; pbVar5 = pbVar5 + 2; pcVar4 = pcVar4 + 2; } while (bVar1 != 0); uVar3 = 0; LAB_0064376d: if (uVar3 == 0) { if (pbVar2[0x34] == 0) { return; } if ((this->_sprite)._animState._isPlaying != 0) { return; } } } bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST("Attack"),1); if (bVar1 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } } return; } // 006437a0 void Entity_Familiar::ai_stitches() { void *pvVar1; ANM2 other; Vector velocity; Entity *player; byte bVar3; Entity *effect; LayerState *layer; byte *curAnimChar; uint uVar4; Game *game; char *wantedAnimChar; bool bVar5; float fVar6; float fVar7; float fVar8; float fVar9; Entity_Familiar *pEVar10; ANM2 aAStackY_8ca0 [128]; undefined1 in_stack_fffffe74 [228]; float in_stack_ffffff58; float in_stack_ffffff5c; float in_stack_ffffff60; Vector *pVVar11; undefined4 uVar12; int iVar13; EntityPtr *local_70; byte isBffs; float fStack_68; Entity *pEStack_64; float local_60; Entity_Familiar *local_5c; Vector local_58; undefined4 uStack_50; undefined4 uStack_4c; code *pcStack_48; float deltaX; float distanceToPlayer; float fStack_3c; ColorMod CStack_38; uint local_c; byte *animData; EntityPtr beamParent; EntityPtr *beamParentSlot; int *entity; Manager *manager; Entity_Player *player; Vector *pos; local_c = __security_cookie ^ GHIDRA_UINT(&local_70); this->_entityGridCollisionClass = 3; local_5c = this; switch(this->_state) { case 0: this->_spawnerType = 1; LAB_0064423d: this->_state = 3; break; case 1: uVar4 = Random(); iVar13 = 0; (*GHIDRA_CAST((GHIDRA_CAST(&(uVar12)) + 0x0))) = 0; (*GHIDRA_CAST((GHIDRA_CAST(&(uVar12)) + 0x1))) = 0; (*GHIDRA_CAST((GHIDRA_CAST(&(uVar12)) + 0x2))) = 0; fVar9 = 0.0; pVVar11 = &g_vectorZero; pos = &this->_pos; fVar8 = 2.10195e-44; fVar6 = 1.4013e-42; fVar7 = 9.203692e-39; effect = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,0xf,pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4,0); (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(register0x00000010) + -0x18c)))))->ANM2::ANM2(&local_5c->_sprite); other._championColor._colorize[0] = in_stack_ffffff58; other._filename._buf[0] = in_stack_fffffe74[0]; other._filename._buf[1] = in_stack_fffffe74[1]; other._filename._buf[2] = in_stack_fffffe74[2]; other._filename._buf[3] = in_stack_fffffe74[3]; other._filename._buf[4] = in_stack_fffffe74[4]; other._filename._buf[5] = in_stack_fffffe74[5]; other._filename._buf[6] = in_stack_fffffe74[6]; other._filename._buf[7] = in_stack_fffffe74[7]; other._filename._buf[8] = in_stack_fffffe74[8]; other._filename._buf[9] = in_stack_fffffe74[9]; other._filename._buf[10] = in_stack_fffffe74[10]; other._filename._buf[0xb] = in_stack_fffffe74[0xb]; other._filename._buf[0xc] = in_stack_fffffe74[0xc]; other._filename._buf[0xd] = in_stack_fffffe74[0xd]; other._filename._buf[0xe] = in_stack_fffffe74[0xe]; other._filename._buf[0xf] = in_stack_fffffe74[0xf]; other._filename._size = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x10))); other._filename._capacity = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x14))); other._animDefaultName._buf[0] = in_stack_fffffe74[0x18]; other._animDefaultName._buf[1] = in_stack_fffffe74[0x19]; other._animDefaultName._buf[2] = in_stack_fffffe74[0x1a]; other._animDefaultName._buf[3] = in_stack_fffffe74[0x1b]; other._animDefaultName._buf[4] = in_stack_fffffe74[0x1c]; other._animDefaultName._buf[5] = in_stack_fffffe74[0x1d]; other._animDefaultName._buf[6] = in_stack_fffffe74[0x1e]; other._animDefaultName._buf[7] = in_stack_fffffe74[0x1f]; other._animDefaultName._buf[8] = in_stack_fffffe74[0x20]; other._animDefaultName._buf[9] = in_stack_fffffe74[0x21]; other._animDefaultName._buf[10] = in_stack_fffffe74[0x22]; other._animDefaultName._buf[0xb] = in_stack_fffffe74[0x23]; other._animDefaultName._buf[0xc] = in_stack_fffffe74[0x24]; other._animDefaultName._buf[0xd] = in_stack_fffffe74[0x25]; other._animDefaultName._buf[0xe] = in_stack_fffffe74[0x26]; other._animDefaultName._buf[0xf] = in_stack_fffffe74[0x27]; other._animDefaultName._size = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x28))); other._animDefaultName._capacity = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x2c))); other._animState._animation = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x30))); other._animState._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x34))); other._animState._layerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x38))); other._animState._nullLayerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x3c))); other._animState._animFrame = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0x40))); other._animState._isPlaying = in_stack_fffffe74[0x44]; (*GHIDRA_CAST((GHIDRA_CAST(&(other._animState)) + 0x15))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x45))); other._animState._currentlyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x48))); other._animState._previouslyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x4c))); other._overlayAnimState._animation = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x50))); other._overlayAnimState._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x54))); other._overlayAnimState._layerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x58))); other._overlayAnimState._nullLayerFrames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x5c))); other._overlayAnimState._animFrame = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0x60))); other._overlayAnimState._isPlaying = in_stack_fffffe74[100]; (*GHIDRA_CAST((GHIDRA_CAST(&(other._overlayAnimState)) + 0x15))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x65))); other._overlayAnimState._currentlyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x68))); other._overlayAnimState._previouslyTriggeredEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x6c))); other._overlayRenderFirst = in_stack_fffffe74[0x70]; (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x71))) = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x71))); other._animData = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x74))); other._animCount = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x78))); other._layerState = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x7c))); other._layerCount = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x80))); other._nullLayerNames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x84))); other._numNullLayers = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x88))); other._eventNames = (*GHIDRA_CAST((GHIDRA_CAST(&((void *)in_stack_fffffe74)) + 0x8c))); other._numEvents = (*GHIDRA_CAST((GHIDRA_CAST(&(in_stack_fffffe74)) + 0x90))); other._offset.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0x94))); other._offset.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0x98))); other._scale.x = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0x9c))); other._scale.y = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xa0))); other._rotation = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xa4))); other._color._tint[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xa8))); other._color._tint[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xac))); other._color._tint[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xb0))); other._color._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xb4))); other._color._colorize[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xb8))); other._color._colorize[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xbc))); other._color._colorize[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xc0))); other._color._colorize[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xc4))); other._color._offset[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xc8))); other._color._offset[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xcc))); other._color._offset[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xd0))); other._championColor._tint[0] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xd4))); other._championColor._tint[1] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xd8))); other._championColor._tint[2] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xdc))); other._championColor._tint[3] = (*GHIDRA_CAST((GHIDRA_CAST(&((float)in_stack_fffffe74)) + 0xe0))); other._championColor._colorize[1] = in_stack_ffffff5c; other._championColor._colorize[2] = in_stack_ffffff60; other._championColor._colorize[3] = fVar7; other._championColor._offset[0] = fVar6; other._championColor._offset[1] = fVar8; other._championColor._offset[2] = (float)pos; (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x100))) = pVVar11; other._playbackSpeed = fVar9; (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x108))) = (char)uVar12; other._loaded = SUB41(uVar12,1); (*GHIDRA_CAST((GHIDRA_CAST(&(other)) + 0x10a))) = SUB42(uVar12,2); other._shadowLayerIndex = uVar4; other._bitflags = iVar13; (GHIDRA_CAST((&effect->_sprite)))->ANM2::operator_assign(other); (GHIDRA_CAST((&effect->_sprite)))->ANM2::Play(GHIDRA_CAST("TeleportUp"),0); effect->Update(); this = local_5c; player = local_5c->_player; pos = &local_5c->_pos; local_70 = GHIDRA_CAST((player->_pos).x); local_60 = (player->_pos).y; Entity_Player::Teleport(player,pos,1,0); manager = g_manager; pos->x = (float)local_70; (this->_pos).y = local_60; pvVar1 = (manager->_itemConfig)._collectibles._begin; if (GHIDRA_INT((GHIDRA_INT((manager->_itemConfig)._collectibles._end) - GHIDRA_INT(pvVar1) & 0xfffffffcU)) < 0x9ed) { local_58.x = 0.0; } else { local_58.x = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x9ec)); } uStack_4c = 0; uStack_50 = 0xc; local_58.y = 1.4013e-45; (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1508)))))->TemporaryEffects::AddEffect(&local_58,0,1); fStack_68 = 30.0; local_70 = GHIDRA_CAST((this->_player->_meleeDamage * 3.0 + 40.0)); isBffs = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0xf7,0); if (isBffs != 0) { fStack_68 = 45.0; } uVar4 = Random(); local_58.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); local_58.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); effect = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,0xf,&local_58,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4,0); effect->Update(); uVar4 = Random(); pVVar11 = pos; effect = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,0xf,pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar4,0); effect->Update(); local_58.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); local_58.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); Game::DamageRadius(&local_58,GHIDRA_CAST(this),4,0,GHIDRA_INT(pVVar11),50.0,g_tearFlagsNone, (float)local_70,fStack_68); fVar7 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x157c)); if (isBffs != 0) { fVar7 = fVar7 + fVar7 + 3.0; } Game::DamageRadius(pos,GHIDRA_CAST(this),4,0,GHIDRA_INT(pVVar11),50.0,g_tearFlagsNone,fVar7,fStack_68); if (isBffs != 0) { fStack_68 = 0.0; do { player = this->_player; pEStack_64 = GHIDRA_CAST((player->_shotspeed * 10.0)); local_70 = (EntityPtr *) ((float)((double)GHIDRA_INT(fStack_68) + __uint_to_double_fixup[-(GHIDRA_INT(fStack_68) >> 0x1f)]) * 360.0 * 0.125 * 0.017453292); fVar7 = cos((float)local_70); local_58.x = fVar7 * (float)pEStack_64; local_58.y = sin((float)local_70); local_58.y = local_58.y * (float)pEStack_64; velocity.y = local_58.y; velocity.x = local_58.x; Entity_Player::FireTear(player,&this->_pos,velocity,0,GHIDRA_CAST(0x0),1.0); fStack_68 = (float)(GHIDRA_INT(fStack_68) + 1); } while (GHIDRA_UINT(fStack_68) < 8); } bVar3 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasCollectible(0x3b,0); if (bVar3 != 0) { fVar7 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x157c)); fStack_3c = fVar7 + fVar7 + 3.0; uVar4 = Random(); pEStack_64 = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,0xa6,&this->_pos,&g_vectorZero,GHIDRA_CAST(this),0,uVar4,0); beamParent = (EntityPtr)this->_player; beamParentSlot = &pEStack_64->_parent; if (pEStack_64->_parent != (EntityPtr)0x0) { local_70 = beamParentSlot; std::multiset::erase(); } *beamParentSlot = beamParent; if (beamParent != (EntityPtr)0x0) { std::multiset::insert(); } effect = pEStack_64; CStack_38._offset[0] = 0.0; CStack_38._colorize[0] = 0.0; CStack_38._colorize[1] = 0.0; CStack_38._colorize[2] = 0.0; CStack_38._colorize[3] = 0.0; CStack_38._offset[1] = 0.0; CStack_38._offset[2] = 0.0; CStack_38._tint[0] = 0.0; CStack_38._tint[1] = 0.0; CStack_38._tint[2] = 0.0; CStack_38._tint[3] = 1.0; (GHIDRA_CAST((GHIDRA_CAST(&pEStack_64->_sprite))))->Sprite::SetColor(&CStack_38); uVar4 = g_graphicsManager_flags; layer = (GHIDRA_CAST((&effect->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); iVar13 = 1; if ((uVar4 & 4) == 0) { iVar13 = 6; } layer->_blendMode[1] = iVar13; layer->_blendMode[0] = 0; layer->_blendMode[2] = 7; layer->_blendMode[3] = 1; layer->_blendMode[4] = 7; fVar7 = g_vectorOne.y; (effect->_sprite)._scale.x = g_vectorOne.x; (effect->_sprite)._scale.y = fVar7; iVar13 = *GHIDRA_CAST(effect); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(effect[1])) + 0x44)))) = 0x3da3d70a; builtin_strncpy(effect[1]._sprite._filename._buf,"\n×£=",4); (**(code **)(iVar13 + 0xc))(); this = local_5c; fVar7 = *GHIDRA_CAST((GHIDRA_CAST(local_5c->_player) + 0x340)); iVar13 = *GHIDRA_CAST(effect); (effect->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(local_5c->_player) + 0x33c)); (effect->_pos).y = fVar7; fVar7 = g_vectorOne.x; fVar6 = g_vectorOne.y * 2.0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(effect[1])) + 0x44)))) = 0x3d23d70a; player = effect + 1; (player->_sprite)._filename._buf[0] = '\n'; (player->_sprite)._filename._buf[1] = -0x29; (player->_sprite)._filename._buf[2] = '#'; (player->_sprite)._filename._buf[3] = '='; (effect->_sprite)._scale.y = fVar6; (effect->_sprite)._scale.x = fVar7 * 2.0; (**(code **)(iVar13 + 0xc))(); fStack_68 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) - (this->_pos).y; local_5c = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) - (this->_pos).x)); distanceToPlayer = sqrtf(fStack_68 * fStack_68 + (float)local_5c * (float)local_5c); if (0.0 < distanceToPlayer) { pEVar10 = GHIDRA_CAST(((float)local_5c / distanceToPlayer)); local_70 = GHIDRA_CAST(0x0); local_58.x = (float)g_game->_room; fVar7 = fStack_68 / distanceToPlayer; game = g_game; fStack_68 = fVar7; local_5c = pEVar10; if (*GHIDRA_CAST((GHIDRA_CAST(local_58.x) + 0x1264)) != 0) { do { entity = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_58.x) + 0x125c)) + GHIDRA_INT(local_70) * 4)); if ((entity[0x62] != 0) && ((((1 < *GHIDRA_CAST(&game->_deathmatchManager) && (entity[10] == 1)) || (entity[10] - 10U < 0x3de)) && ((entity[0x5a] & 0x20000000U) == 0)))) { pEStack_64 = GHIDRA_CAST(((float)entity[0xd0] - (this->_pos).y)); deltaX = (float)entity[0xcf] - (this->_pos).x; pcStack_48 = (code *)(fVar7 * (float)pEStack_64 + (float)pEVar10 * deltaX); local_60 = cos(1.5707964); fVar7 = sin(1.5707964); if ((((fVar7 * (float)local_5c + local_60 * fStack_68) * (float)pEStack_64 + (local_60 * (float)local_5c - fVar7 * fStack_68) * deltaX < (float)entity[0xdc] + 25.0) && (0.0 <= (float)pcStack_48)) && ((float)pcStack_48 <= distanceToPlayer)) { CStack_38._offset[1] = (float)this->_player; pcStack_48 = *(code **)(*entity + 0x20); if ((void *)CStack_38._offset[1] == (void *)0x0) { CStack_38._tint[0] = 0.0; CStack_38._tint[1] = 0.0; CStack_38._tint[2] = 0.0; CStack_38._tint[3] = 0.0; CStack_38._colorize[0] = g_vectorZero.x; CStack_38._colorize[1] = g_vectorZero.y; CStack_38._colorize[2] = g_vectorZero.x; CStack_38._colorize[3] = g_vectorZero.y; LAB_00643fa1: pEStack_64 = GHIDRA_CAST(0x0); if ((void *)CStack_38._offset[1] != (void *)0x0) goto LAB_00643fad; pEStack_64 = GHIDRA_CAST(0x0); LAB_00643fcf: local_60 = 0.0; if ((void *)CStack_38._offset[1] != (void *)0x0) goto LAB_00643fdb; LAB_00643ff4: uVar4 = 0; } else { CStack_38._tint[0] = *GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x28)); CStack_38._tint[1] = *GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x2c)); CStack_38._tint[2] = *GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x34)); CStack_38._tint[3] = *GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x38)); CStack_38._colorize[0] = *GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x33c)); CStack_38._colorize[1] = *GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x340)); CStack_38._colorize[2] = *GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x360)); CStack_38._colorize[3] = *GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x364)); if ((*GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x168)) & 0x100) == 0) goto LAB_00643fa1; pEStack_64 = GHIDRA_CAST(0x1); LAB_00643fad: if ((*GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x168)) & 0x20000000) == 0) goto LAB_00643fcf; local_60 = 2.8026e-45; LAB_00643fdb: if ((*GHIDRA_CAST((GHIDRA_INT(CStack_38._offset[1]) + 0x16c)) & 0x400000) == 0) goto LAB_00643ff4; uVar4 = 4; } CStack_38._offset[0] = (float)(uVar4 | GHIDRA_UINT(local_60) | GHIDRA_UINT(pEStack_64)); (*pcStack_48)(); } game = g_game; pEVar10 = local_5c; fVar7 = fStack_68; } local_70 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((local_70)) + 0x1)))); } while (local_70 < *GHIDRA_CAST((GHIDRA_CAST(local_58.x) + 0x1264))); } } uVar4 = Random(); manager = g_manager; local_70 = GHIDRA_CAST(0x1fa); local_58.x = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283064e-10 * 0.2 + 1.5; seed_fart_sound_override(GHIDRA_CAST(&local_70)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_70),1.0,1,0,local_58.x,0.0); (GHIDRA_CAST((g_game)))->Game::ShakeScreen(6); } iVar13 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13bc)); if (iVar13 < 0x1e) { iVar13 = 0x1e; } *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13bc)) = iVar13; pvVar1 = this->_player; *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x16c)) = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x16c)) | 0x10; *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x168)) = *GHIDRA_CAST((GHIDRA_CAST(pvVar1) + 0x168)); (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; animData = (this->_sprite)._animState._animData; if (animData == GHIDRA_CAST(0x0)) { LAB_0064418e: bVar3 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST("TeleportDown"),1); if (bVar3 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } } else { curAnimChar = animData; if (0xf < *GHIDRA_CAST((animData + 0x14))) { curAnimChar = *GHIDRA_CAST(animData); } wantedAnimChar = "TeleportDown"; do { bVar3 = *curAnimChar; bVar5 = bVar3 < (byte)*wantedAnimChar; if (bVar3 != *wantedAnimChar) { LAB_00644170: uVar4 = -GHIDRA_UINT(bVar5) | 1; goto LAB_00644175; } if (bVar3 == 0) break; bVar3 = curAnimChar[1]; bVar5 = bVar3 < (byte)wantedAnimChar[1]; if (bVar3 != wantedAnimChar[1]) goto LAB_00644170; curAnimChar = curAnimChar + 2; wantedAnimChar = wantedAnimChar + 2; } while (bVar3 != 0); uVar4 = 0; LAB_00644175: if ((uVar4 != 0) || ((animData[0x34] != 0 && ((this->_sprite)._animState._isPlaying == 0)))) goto LAB_0064418e; } this->_state = 2; break; case 2: animData = (this->_sprite)._animState._animData; if (animData == GHIDRA_CAST(0x0)) { LAB_00644210: bVar3 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST("TeleportDown"),1); if (bVar3 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } } else { curAnimChar = animData; if (0xf < *GHIDRA_CAST((animData + 0x14))) { curAnimChar = *GHIDRA_CAST(animData); } wantedAnimChar = "TeleportDown"; do { bVar3 = *curAnimChar; bVar5 = bVar3 < (byte)*wantedAnimChar; if (bVar3 != *wantedAnimChar) { LAB_006441f2: uVar4 = -GHIDRA_UINT(bVar5) | 1; goto LAB_006441f7; } if (bVar3 == 0) break; bVar3 = curAnimChar[1]; bVar5 = bVar3 < (byte)wantedAnimChar[1]; if (bVar3 != wantedAnimChar[1]) goto LAB_006441f2; curAnimChar = curAnimChar + 2; wantedAnimChar = wantedAnimChar + 2; } while (bVar3 != 0); uVar4 = 0; LAB_006441f7: if ((uVar4 != 0) || ((animData[0x34] != 0 && ((this->_sprite)._animState._isPlaying == 0)))) goto LAB_00644210; } if (((this->_sprite)._animState._animData == (void *)0x0) || ((this->_sprite)._animState._isPlaying == 0)) goto LAB_0064423d; break; case 3: (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(s_Idle,0); } (GHIDRA_CAST((this->_player)))->Entity_Player::GetShootingJoystick(&local_58); fVar7 = (this->_velocity).x; if (this->_collidesWithGrid != 0) { fVar7 = fVar7 * 0.88; (this->_velocity).x = fVar7; (this->_velocity).y = (this->_velocity).y * 0.88; } fVar6 = 0.0; if ((local_58.x == 0.0) || (local_58.y != 0.0)) { if ((local_58.y == 0.0) || (local_58.x != 0.0)) goto LAB_00644300; fVar6 = (this->_velocity).y; fVar7 = fVar7 * 0.5; } else { (this->_velocity).y = (this->_velocity).y * 0.5; fVar6 = fVar7; } fVar6 = ABS(fVar6); LAB_00644300: game = g_game; fVar8 = (this->_velocity).y; fVar9 = -(fVar8 * local_58.y + fVar7 * local_58.x) * 0.2; if (fVar9 <= 0.0) { fVar9 = 0.0; } fVar6 = (fVar9 + fVar6 * 0.3 * 0.1 + 3.0) * 0.8; (this->_velocity).y = (fVar6 * local_58.y + fVar8) * 0.775; (this->_velocity).x = (fVar6 * local_58.x + fVar7) * 0.775; Room::GetClampedPositionImpl(game->_room,&local_58,&this->_pos,0.0,0.0,0.0,0.0); local_60 = local_58.x - (this->_pos).x; local_70 = GHIDRA_CAST((local_58.y - (this->_pos).y)); if ((local_60 != g_vectorZero.x) || ((float)local_70 != g_vectorZero.y)) { fVar7 = sqrtf((float)local_70 * (float)local_70 + local_60 * local_60); if (0.0 < fVar7) { local_70 = GHIDRA_CAST(((float)local_70 * (1.0 / fVar7))); local_60 = local_60 * (1.0 / fVar7); } fVar7 = (this->_velocity).x; fVar6 = this->_speedMultiplier; fVar8 = -((float)local_70 * (this->_velocity).y + fVar7 * local_60); if (fVar8 <= 1.0) { fVar8 = 1.0; } if (10.0 <= fVar8) { fVar8 = 10.0; } (this->_velocity).x = local_60 * fVar8 * fVar6 + fVar7; (this->_velocity).y = (float)local_70 * fVar8 * fVar6 + (this->_velocity).y; } return; } // 006444d0 Entity * Entity_Familiar::aim_reflected_projectile() { Entity *tmpEntity; uint rngResult; int enemyType; Game *game; uint enemyIdx; float fVar1; float distance; float velocityYSq; float fVar2; float toEnemyY; float bestScore; float directionY; float directionX; Entity *bestTarget; void *local_10; undefined1 *puStack_c; undefined4 uStack_8; Entity_NPC *ownerNpc; void *room; game = g_game; uStack_8 = 0xffffffff; puStack_c = &LAB_00af70b0; local_10 = ExceptionList; ExceptionList = &local_10; if ((((this->_flags & 0x100) != 0) && (ownerNpc = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x3bc)), ownerNpc != GHIDRA_CAST(0x0))) && (((1 < *GHIDRA_CAST(&g_game->_deathmatchManager) && (ownerNpc->_type == 1)) || (ownerNpc->_type - 10U < 0x3de)))) { tmpEntity = (GHIDRA_CAST((ownerNpc)))->Entity_NPC::GetPlayerTarget(); ExceptionList = local_10; return tmpEntity; } directionY = (this->_velocity).y; directionX = (this->_velocity).x; bestScore = 0.0; velocityYSq = directionY * directionY; bestTarget = GHIDRA_CAST(0x0); fVar1 = sqrtf(directionX * directionX + velocityYSq); if (0.0 < fVar1) { directionX = directionX * (1.0 / fVar1); directionY = directionY * (1.0 / fVar1); } room = game->_room; fVar1 = (this->_velocity).x; enemyIdx = 0; tmpEntity = GHIDRA_CAST(0x0); if (*GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264)) != 0) { do { tmpEntity = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(room) + 0x125c)) + enemyIdx * 4)); if (((((1 < *GHIDRA_CAST(&game->_deathmatchManager)) && (enemyType = 1, tmpEntity->_type == 1)) || (enemyType = tmpEntity->_type, enemyType - 10U < 0x3de)) && ((tmpEntity->_entityCollisionClass != 1 && (tmpEntity->_entityCollisionClass != 0)))) && (((tmpEntity->_isInvicible == 0 && (tmpEntity->_dead == 0)) && ((((tmpEntity->_flags & 0x10) == 0 || (enemyType == 0x322)) || (enemyType == 0x362)))))) { if (fVar1 * fVar1 + velocityYSq <= 1e-05) { rngResult = Random(); fVar2 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)] ) * 2.3283064e-10; game = g_game; } else { fVar2 = (tmpEntity->_pos).x - (this->_pos).x; toEnemyY = (tmpEntity->_pos).y - (this->_pos).y; distance = sqrtf(fVar2 * fVar2 + toEnemyY * toEnemyY); if (0.0 < distance) { fVar2 = fVar2 * (1.0 / distance); toEnemyY = toEnemyY * (1.0 / distance); } fVar2 = directionX * fVar2 + directionY * toEnemyY; } if (bestScore < fVar2) { bestScore = fVar2; bestTarget = tmpEntity; } } enemyIdx = enemyIdx + 1; tmpEntity = bestTarget; } while (enemyIdx < *GHIDRA_CAST((GHIDRA_CAST(room) + 0x1264))); } ExceptionList = local_10; return tmpEntity; } // 00644e80 void Entity_Familiar::ai_shadow_intruder_damocles(byte isInterpolating) { code *pcVar1; longlong lVar2; longlong lVar3; longlong lVar4; byte bVar5; char cVar6; byte *curAnimChar; uint uVar7; uint uVar8; EntityRef *sourceRef; uint rngResult; Entity *spawned; int iVar9; int *piVar10; byte *wantedAnimChar; int unusedArg; void *pvVar11; code *extraout_EDX; uint particleIndex; ANM2 *sprite; PlayerManager *playerManager; bool bVar12; float fVar13; ulonglong timeNs; byte *pbVar14; undefined1 auStack_12c [4]; uint spawnSubType; uint finalSubType; int *piStack_120; Entity_Familiar *pEStack_11c; Entity *pEStack_118; int local_114; int iStack_110; uint spawnType; Entity_Familiar *savedFamiliar; float fStack_104; Game *pGStack_100; Vector particlePos; uint uStack_f0; int soundId; float particleVelX; float fStack_e0; void *triggerNode; uint savedParticleIndex; float burstX; float burstY; EntityPtr *spawnerRefArg; uint uStack_c8; uint directSpawnCount; int particleCount; uint itemKey; Vector particleVelocity; Vector playerPos; Vector slowVelocity; int typeKey; int variantKey; int wildcardKey [3]; undefined8 rngShifts; undefined4 rngShift3; int damageSourceType; int damageSourceVariant; int damageSourceSpawnerType; int damageSourceSpawnerVariant; float damageSourcePosX; float damageSourcePosY; float damageSourceVelX; float damageSourceVelY; uint damageSourceFlags; EntityRef local_58; RNG cardRng; uint local_c; Game *game; Manager *manager; Entity_Familiar *spawnVariant; EntityPtr *spawnerSlot; local_c = __security_cookie ^ GHIDRA_UINT(auStack_12c); fVar13 = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); (this->_pos).x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); (this->_pos).y = fVar13; (this->_velocity).x = g_vectorZero.x; (this->_velocity).y = g_vectorZero.y; if (isInterpolating != 0) { return; } iVar9 = this->_state; savedFamiliar = this; if (iVar9 == 0) { this->_state = 1; this->_fireCooldown = 0; (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(s_Idle,0); return; } if (iVar9 == 1) { if (((this->_sprite)._animState._animData == (void *)0x0) || ((this->_sprite)._animState._isPlaying == 0)) { uVar7 = Random(); fVar13 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283064e-10; if (0.1 <= fVar13) { if (0.5 <= fVar13) { pbVar14 = s_Idle; } else { pbVar14 = s_Idle2; } } else { pbVar14 = &DAT_00b1d43c; } bVar5 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(pbVar14,1); if (bVar5 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } } game = g_game; if ((this->_flags & 0x4000) != 0) { return; } bVar5 = (GHIDRA_CAST((g_game)))->Game::IsPaused(); if (bVar5 != 0) { return; } uVar7 = game->_frameCount & 0x80000003; bVar12 = uVar7 == 0; if (GHIDRA_INT(uVar7) < 0) { bVar12 = (uVar7 - 1 | 0xfffffffc) == 0xffffffff; } if (bVar12) { iVar9 = this->_subtype; if (iVar9 < 1) { return; } uVar7 = Random(); manager = g_manager; if (GHIDRA_INT((uVar7 % 10000)) < iVar9) { local_114 = 0x1fd; seed_fart_sound_override(&local_114); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(local_114,1.0,0,0,1.0,0.0); this->_state = 2; return; } return; } return; } if (iVar9 != 2) { return; } pbVar14 = (this->_sprite)._animState._animData; sprite = &this->_sprite; if (pbVar14 != GHIDRA_CAST(0x0)) { curAnimChar = pbVar14; if (0xf < *GHIDRA_CAST((pbVar14 + 0x14))) { curAnimChar = *GHIDRA_CAST(pbVar14); } wantedAnimChar = &DAT_00b1e7b0; do { bVar5 = *curAnimChar; bVar12 = bVar5 < *wantedAnimChar; if (bVar5 != *wantedAnimChar) { LAB_00644f50: uVar7 = -GHIDRA_UINT(bVar12) | 1; goto LAB_00644f55; } if (bVar5 == 0) break; bVar5 = curAnimChar[1]; bVar12 = bVar5 < wantedAnimChar[1]; if (bVar5 != wantedAnimChar[1]) goto LAB_00644f50; curAnimChar = curAnimChar + 2; wantedAnimChar = wantedAnimChar + 2; } while (bVar5 != 0); uVar7 = 0; LAB_00644f55: if ((uVar7 == 0) && ((pbVar14[0x34] == 0 || ((this->_sprite)._animState._isPlaying != 0)))) goto LAB_00644f81; } bVar5 = (GHIDRA_CAST((sprite)))->ANM2::SetAnimation(&DAT_00b1e7b0,1); if (bVar5 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } LAB_00644f81: if ((this->_sprite)._animState._animData != (void *)0x0) { bVar5 = (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::IsEventTriggered(&DAT_00b1d3b0); manager = g_manager; if (bVar5 != 0) { soundId = 0x4d; seed_fart_sound_override(&soundId); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(soundId,1.0,2,0,1.0,0.0); *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x13bc)) = 0; bVar5 = (GHIDRA_CAST((this->_player)))->Entity_Player::HasInvincibility(0,GHIDRA_CAST(0x0)); if (bVar5 == 0) { damageSourcePosX = (savedFamiliar->_pos).x; damageSourcePosY = (savedFamiliar->_pos).y; damageSourceType = savedFamiliar->_type; damageSourceVelX = (savedFamiliar->_velocity).x; damageSourceVariant = savedFamiliar->_variant; damageSourceSpawnerType = savedFamiliar->_spawnerType; damageSourceSpawnerVariant = savedFamiliar->_spawnerVariant; damageSourceVelY = (savedFamiliar->_velocity).y; if ((savedFamiliar->_flags & 0x20000000) == 0) { uVar7 = 0; } else { uVar7 = 2; } if ((savedFamiliar->_flags & 0x40000000000000) == 0) { uVar8 = 0; } else { uVar8 = 4; } damageSourceFlags = uVar8 | uVar7 | GHIDRA_UINT(((savedFamiliar->_flags & 0x100) != 0)); local_58._type = GHIDRA_INT(savedFamiliar); (**(code **)(*GHIDRA_CAST(this->_player) + 0x20))(0x3f800000,0x2002800,0,&damageSourceType,0x1e); this = pEStack_11c; sourceRef = (GHIDRA_CAST((&local_58)))->EntityRef::EntityRef(); (*extraout_EDX)(sourceRef); uVar7 = Random(); playerPos.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); playerPos.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,2,&playerPos,&g_vectorZero,GHIDRA_CAST(0x0),3,uVar7,0); local_114 = 3; do { uVar7 = Random(); fVar13 = (float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283064e-10 * 3.14; piStack_120 = GHIDRA_CAST((fVar13 + fVar13)); uVar7 = Random(); pEStack_11c = (Entity_Familiar *) ((float)((double)GHIDRA_INT(uVar7) + __uint_to_double_fixup[-(GHIDRA_INT(uVar7) >> 0x1f)]) * 2.3283064e-10 * 15.0 + 6.0); burstX = cos((float)piStack_120); burstX = burstX * (float)pEStack_11c; burstY = sin((float)piStack_120); burstY = burstY * (float)pEStack_11c; uVar8 = Random(); particleIndex = 0; savedParticleIndex = 0; uVar7 = (uVar8 & 1) + 1; directSpawnCount = uVar7; rngResult = Random(); particleCount = (uVar8 & 1) + 5 + rngResult % 6; if (particleCount != 0) { do { uVar8 = Random(); pGStack_100 = GHIDRA_CAST((((float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)]) * 2.3283064e-10 * 10.0 - 5.0) * 0.017453292)); fStack_104 = cos((float)pGStack_100); pGStack_100 = GHIDRA_CAST(sin((float)pGStack_100)); uVar8 = Random(); fStack_e0 = (float)((double)GHIDRA_INT(uVar8) + __uint_to_double_fixup[-(GHIDRA_INT(uVar8) >> 0x1f)] ) * 2.3283064e-10; particleVelX = (burstX * fStack_104 - burstY * (float)pGStack_100) * fStack_e0; fStack_e0 = (burstX * (float)pGStack_100 + burstY * fStack_104) * fStack_e0; particlePos.x = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)) + particleVelX; particlePos.y = *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)) + fStack_e0; particleVelocity.x = particleVelX; particleVelocity.y = fStack_e0; fVar13 = (float)Random(); if (particleIndex < uVar7) { slowVelocity.x = particleVelX * 0.2; slowVelocity.y = fStack_e0 * 0.2; spawned = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,5,&particlePos,&slowVelocity,GHIDRA_CAST(0x0),0, GHIDRA_UINT(fVar13),0); spawned->Update(); savedParticleIndex = particleIndex; } else { pGStack_100 = g_game; spawnSubType = 99; pEStack_11c = GHIDRA_CAST(&DAT_00000005); spawnType = 1000; fStack_104 = fVar13; lua_callback_run_pre_entity_spawn (GHIDRA_CAST(&spawnType),GHIDRA_CAST(&pEStack_11c),&particlePos,&particleVelocity, GHIDRA_CAST(0x0),GHIDRA_CAST(&spawnSubType),GHIDRA_CAST(&fStack_104)); spawnVariant = pEStack_11c; if (*GHIDRA_CAST(&g_game->_deathmatchManager) < 2) { LAB_00645675: finalSubType = spawnSubType; } else { piVar10 = (g_game->_deathmatchManager)._type; piStack_120 = piVar10; uVar8 = Random(); uVar7 = spawnSubType; rngShifts = 0x900000005; pEStack_118 = GHIDRA_CAST(&DAT_00000007); rngShift3 = 7; if (spawnType != 5) goto LAB_00645675; if (spawnVariant < GHIDRA_CAST(0x12d)) { if (spawnVariant == GHIDRA_CAST(0x12c)) { while ((finalSubType = spawnSubType, spawnSubType == 0 || (cVar6 = (**(code **)(*piVar10 + 0x24))(spawnSubType), cVar6 != '\0'))) { if (uVar8 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar8 = uVar8 >> ((byte)rngShifts & 0x1f) ^ uVar8; uVar8 = uVar8 << ((byte)((ulonglong)rngShifts >> 0x20) & 0x1f) ^ uVar8; uVar8 = uVar8 >> ((byte)pEStack_118 & 0x1f) ^ uVar8; iVar9 = ItemPool::GetCardEx(uVar8,0x19,10,10,1); cardRng._shift1 = 5; cardRng._shift2 = 9; cardRng._shift3 = 7; cardRng._seed = uVar8; spawnSubType = lua_callback_run_get_card(&cardRng,iVar9,1,1,0); } } else { if (spawnVariant == GHIDRA_CAST(0x46)) { uStack_f0 = spawnSubType >> 0xb; do { finalSubType = spawnSubType; if (spawnSubType != 0) { pcVar1 = *(code **)(*piVar10 + 0x28); iVar9 = ItemPool::GetPillEffect (&g_game->_itemPool,spawnSubType,GHIDRA_CAST(0x0)) ; cVar6 = (*pcVar1)(iVar9); if (cVar6 == '\0') goto LAB_0064567d; piVar10 = piStack_120; } if (uVar8 == 0) { KAGE_LogMessage(0x10,GHIDRA_CAST("RNG Seed is zero!\n")); pcVar1 = (code *)swi(3); (*pcVar1)(); return; } uVar8 = uVar8 >> ((byte)rngShifts & 0x1f) ^ uVar8; uVar8 = uVar8 << ((byte)((ulonglong)rngShifts >> 0x20) & 0x1f) ^ uVar8; uVar8 = uVar8 >> ((byte)pEStack_118 & 0x1f) ^ uVar8; spawnSubType = ItemPool::GetPill(uVar8); spawnSubType = spawnSubType | (uStack_f0 & 1) << 0xb; } while( true ); } if (spawnVariant != GHIDRA_CAST(0x64)) goto LAB_00645675; finalSubType = spawnSubType; if (spawnSubType == 0x19) { LAB_006454c5: bVar12 = false; } else { itemKey = spawnSubType; std::set::find_node(&local_58._spawnerType,&itemKey); if (((*GHIDRA_CAST((GHIDRA_CAST(local_58._position.x) + 0xd)) == '\0') && (*GHIDRA_CAST((GHIDRA_CAST(local_58._position.x) + 0x10)) <= GHIDRA_INT(uVar7))) && (local_58._position.x != (float)piVar10[8])) goto LAB_006454c5; bVar12 = true; } if ((uVar7 == 0) || (bVar12)) { spawnSubType = (**(code **)(*piVar10 + 0x84))(0); finalSubType = spawnSubType; } } } else { if (spawnVariant != GHIDRA_CAST(0x15e)) goto LAB_00645675; while ((finalSubType = spawnSubType, spawnSubType == 0 || (cVar6 = (**(code **)(*piVar10 + 0x2c))(spawnSubType), cVar6 != '\0'))) { spawnSubType = (GHIDRA_CAST((&g_game->_itemPool)))->ItemPool::GetTrinket(0); } } } LAB_0064567d: pEStack_118 = (GHIDRA_CAST((pGStack_100->_entityFactory)))->EntityFactory::Create(spawnType,0); if (pEStack_118 != GHIDRA_CAST(0x0)) { timeNs = GetTimeNs(); spawned = pEStack_118; uStack_f0 = GHIDRA_UINT((timeNs >> 0x20)); lVar2 = (timeNs & 0xffffffff) * 0x431bde82; iStack_110 = GHIDRA_INT(((ulonglong)lVar2 >> 0x20)); lVar3 = (ulonglong)uStack_f0 * 0xd7b634db + ((timeNs & 0xffffffff) * 0xd7b634db >> 0x20); uVar8 = GHIDRA_UINT(((ulonglong)lVar3 >> 0x20)); uVar7 = iStack_110 + GHIDRA_UINT(CARRY4(GHIDRA_UINT(lVar2),GHIDRA_UINT(lVar3))); lVar2 = (ulonglong)uStack_f0 * 0x431bde82 + (ulonglong)CONCAT14(CARRY4(uVar8,uVar7),uVar8 + uVar7); uStack_c8 = GHIDRA_UINT(((ulonglong)lVar2 >> 0x20)); spawnerSlot = &pEStack_118->_spawnerEntity; piStack_120 = GHIDRA_CAST((GHIDRA_UINT(lVar2) >> 0x12 | uStack_c8 * 0x4000)); uStack_c8 = uStack_c8 >> 0x12; pEStack_118->_spawnerType = 0; pEStack_118->_spawnerVariant = 0; if (*spawnerSlot != (EntityPtr)0x0) { spawnerRefArg = spawnerSlot; std::multiset::erase(&spawnerRefArg); } iVar9 = *GHIDRA_CAST(spawned); *spawnerSlot = (EntityPtr)0x0; (spawned->_pos).x = particlePos.x; (spawned->_pos).y = particlePos.y; (spawned->_velocity).x = particleVelX; (spawned->_velocity).y = fStack_e0; (**(code **)(iVar9 + 4))(spawnType,pEStack_11c,finalSubType,fStack_104); game = pGStack_100; pvVar11 = pGStack_100->_room; iVar9 = *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x1214)); *GHIDRA_CAST((GHIDRA_CAST(pvVar11) + 0x1214)) = iVar9 + 1; spawned->_index = iVar9; (GHIDRA_CAST((GHIDRA_CAST((GHIDRA_INT(pvVar11) + 0x1218)))))->EntityList::AddEntity(spawned); bVar5 = Game::ShouldEraseEnemy(spawned); if (bVar5 != 0) { Entity::RemoveWithPoof(spawned,unusedArg); } if ((spawned->_exists != 0) && ((game->_proceduralItemManager)._proceduralItems._begin != (game->_proceduralItemManager)._proceduralItems._end)) { variantKey = spawned->_variant; iVar9 = spawned->_type; typeKey = iVar9; std::map::find(&triggerNode,&typeKey); if (triggerNode == (game->_proceduralItemManager)._spawnTriggerTargets._head) { wildcardKey[1] = 0xffffffff; wildcardKey[0] = iVar9; piVar10 = GHIDRA_CAST(std)::map::find (&local_58._variant,wildcardKey); triggerNode = (void *)*piVar10; if (triggerNode == (game->_proceduralItemManager)._spawnTriggerTargets._head) goto LAB_006458e9; } uVar7 = 0; playerManager = &g_game->_playerManager; if (GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 != 0) { do { pvVar11 = (playerManager->_playerList)._end; if (GHIDRA_INT(pvVar11) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2 == 0) { KAGE_LogMessage(0x10,(byte *) "(GHIDRA_CAST(()))->PlayerManager::GetPlayer() : There are no players! \n" ); pvVar11 = (playerManager->_playerList)._end; } piVar10 = (playerManager->_playerList)._begin; if (uVar7 < GHIDRA_UINT((GHIDRA_INT(pvVar11) - GHIDRA_INT(piVar10) >> 2))) { piVar10 = piVar10 + uVar7; } trigger_set_dispatch ((void *)(*piVar10 + 0x1fc8),6,spawned,&particlePos, &particleVelocity); uVar7 = uVar7 + 1; playerManager = &g_game->_playerManager; } while (uVar7 < GHIDRA_UINT((GHIDRA_INT((g_game->_playerManager)._playerList._end) - GHIDRA_INT((playerManager->_playerList)._begin) >> 2))); } } LAB_006458e9: timeNs = GetTimeNs(); uVar7 = GHIDRA_UINT((timeNs >> 0x20)); lVar2 = (timeNs & 0xffffffff) * 0x431bde82; uStack_f0 = GHIDRA_UINT(((ulonglong)lVar2 >> 0x20)); lVar3 = (ulonglong)uVar7 * 0x431bde82; iStack_110 = GHIDRA_INT(lVar3); lVar4 = (ulonglong)uVar7 * 0xd7b634db + ((timeNs & 0xffffffff) * 0xd7b634db >> 0x20); pGStack_100 = GHIDRA_CAST((lVar4 + lVar2)); lVar3 = lVar3 + (ulonglong) CONCAT14(CARRY4(GHIDRA_UINT(((ulonglong)lVar4 >> 0x20)), uStack_f0 + CARRY4(GHIDRA_UINT(lVar2),GHIDRA_UINT(lVar4))), GHIDRA_INT(((ulonglong)(lVar4 + lVar2) >> 0x20))); uVar8 = GHIDRA_UINT(((ulonglong)lVar3 >> 0x20)); piVar10 = GHIDRA_CAST((GHIDRA_UINT(lVar3) >> 0x12 | uVar8 * 0x4000)); uVar7 = GHIDRA_INT(piVar10) - GHIDRA_INT(piStack_120); bVar12 = CARRY4(GHIDRA_UINT(g_entitySpawnTimeMs),uVar7); (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x0))) = GHIDRA_UINT(g_entitySpawnTimeMs) + uVar7; (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(g_entitySpawnTimeMs)) + 0x4))) + (((uVar8 >> 0x12) - uStack_c8) - GHIDRA_UINT((piVar10 < piStack_120))) + GHIDRA_UINT(bVar12); } spawned = pEStack_118; pEStack_118->Update(); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(spawned[1])) + 0x4)))) = 0xc1000000; uVar7 = directSpawnCount; this = savedFamiliar; } particleIndex = savedParticleIndex + 1; savedParticleIndex = particleIndex; } while (GHIDRA_INT(particleIndex) < particleCount); } local_114 = local_114 + -1; } while (local_114 != 0); sprite = &this->_sprite; local_114 = 0; } uVar7 = Random(); spawned = (GHIDRA_CAST((g_game)))->Game::SpawnEx(1000,6,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,uVar7,0); Isaac::SwapANM2(&spawned->_sprite,sprite); iVar9 = *GHIDRA_CAST(spawned); *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(spawned[1])) + 0x40)))) = 1; (**(code **)(iVar9 + 0xc))(); (GHIDRA_CAST((this->_player)))->Entity_Player::RemoveCollectible(0x290,0,0,1); this->Remove(); return; } } return; } // 006470c0 void * Entity_Familiar::get_item_config_entry() { void *pvVar1; if (this->_variant == 0xe7) { pvVar1 = ItemConfig::get_wisp_entry(this->_subtype,this->_coins); return pvVar1; } pvVar1 = ItemConfig::get_wisp_entry(0x19,0); return pvVar1; } // 00647170 byte Entity_Familiar::abyss_locust_eat() { uint uVar1; int locustData; undefined4 *appendResult; byte bVar2; byte extraout_CL; byte extraout_CL_00; byte extraout_CL_01; byte *cursor; void *pvVar3; void *spritesheetPath; char acStack_60 [4]; char acStack_5c [4]; char acStack_58 [8]; uint uStack_50; void *gfxRoot [4]; undefined4 local_3c; uint local_38; byte fileName [32]; uint local_14; void *local_10; undefined1 *puStack_c; undefined4 local_8; local_8 = 0xffffffff; puStack_c = &LAB_00af7125; local_10 = ExceptionList; uVar1 = __security_cookie ^ GHIDRA_UINT((fileName + 0x30)); ExceptionList = &local_10; local_14 = uVar1; if (this->_variant != 0xe7) { KAGE_LogMessage(0x10,GHIDRA_CAST("This should only be called on a locust\n")); } locustData = __RTDynamicCast(this->_extraData,0, &IsaacRepentancePlus::Entity_Familiar::ExtraData:: RTTI_Type_Descriptor, &IsaacRepentancePlus::AbyssLocustData::RTTI_Type_Descriptor,0,uVar1); if (*GHIDRA_CAST((locustData + 0x50)) < 0x19) { bVar2 = *GHIDRA_CAST((locustData + 0x50)) + 1; *GHIDRA_CAST((locustData + 0x50)) = bVar2; if (GHIDRA_UINT(bVar2) % 5 == 1) { sprintf(fileName,GHIDRA_CAST("hungry_%d.png")); (GHIDRA_CAST((GHIDRA_CAST(gfxRoot))))->std::string::string(&(g_manager->_itemConfig)._wispGfxRoot); cursor = fileName; local_8 = 0; do { bVar2 = *cursor; cursor = cursor + 1; } while (bVar2 != 0); appendResult = (GHIDRA_CAST((GHIDRA_CAST(gfxRoot))))->std::string::append(fileName,GHIDRA_INT(cursor) - GHIDRA_INT((fileName + 1))) ; spritesheetPath = (void *)*appendResult; acStack_60 = (char [4])appendResult[1]; acStack_5c = (char [4])appendResult[2]; (*GHIDRA_CAST((GHIDRA_CAST(&(acStack_58)) + 0x0))) = appendResult[3]; unique0x0000a400 = *GHIDRA_CAST((appendResult + 4)); appendResult[4] = 0; appendResult[5] = 0xf; *GHIDRA_CAST(appendResult) = 0; (*GHIDRA_CAST((GHIDRA_CAST(&(local_8)) + 0x0))) = 1; (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,GHIDRA_CAST(&spritesheetPath)); local_8 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_8))) + 0x1))) << 8; bVar2 = extraout_CL; if (0xf < uStack_50) { uVar1 = uStack_50 + 1; pvVar3 = spritesheetPath; if (0xfff < uVar1) { pvVar3 = *(void **)(GHIDRA_CAST(spritesheetPath) + -4); uVar1 = uStack_50 + 0x24; if (0x1f < GHIDRA_UINT((GHIDRA_INT(spritesheetPath) + (-4 - GHIDRA_INT(pvVar3))))) goto LAB_006472d2; } operator_delete(pvVar3,uVar1); bVar2 = extraout_CL_00; } local_8 = -1; if (0xf < local_38) { uVar1 = local_38 + 1; pvVar3 = gfxRoot[0]; if (0xfff < uVar1) { pvVar3 = *(void **)(GHIDRA_INT(gfxRoot[0]) + -4); uVar1 = local_38 + 0x24; if (0x1f < GHIDRA_UINT((GHIDRA_INT(gfxRoot[0]) + (-4 - GHIDRA_INT(pvVar3))))) { LAB_006472d2: /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(pvVar3,uVar1); bVar2 = extraout_CL_01; } local_3c = 0; local_38 = 0xf; gfxRoot[0] = (void *)(GHIDRA_UINT(gfxRoot[0]) & 0xffffff00); (GHIDRA_CAST((&this->_sprite)))->ANM2::LoadGraphics(bVar2); } bVar2 = 1; } else { bVar2 = 0; } ExceptionList = local_10; return bVar2; } // 0064a2d0 byte Entity_Familiar::break_grid_ahead() { float fVar1; char cVar2; int gridY; int gridY; void *pvVar4; uint rngValue; float fVar5; Vector *gridPos; int iVar6; uint uVar7; float *tearEffectEntry; uint uVar8; uint tearFlags1; uint tearFlags3; uint rolledEffectMask; uint tearFlags2; uint tearFlags0; Vector local_68; Vector local_60; Vector local_58; uint uStack_50; uint uStack_4c; uint uStack_48; uint uStack_44; int sourceRef; int iStack_34; int iStack_30; int iStack_2c; float fStack_28; float fStack_24; float fStack_20; float fStack_1c; uint uStack_18; Entity_Familiar *pEStack_14; GridEntity *gridEntity; Room *room; fVar1 = (this->_velocity).y; fVar5 = (this->_velocity).x; local_58.x = (float)((10.0 < this->_collisionDamage) + 1); local_60.x = (float)&this->_velocity; iVar6 = GHIDRA_INT((((fVar5 + fVar5 + (this->_pos).x) - 40.0) / 40.0 + 0.5)); if ((((iVar6 < 0) || (gridY = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0xc)), gridY <= iVar6)) || (gridY = GHIDRA_INT((((fVar1 + fVar1 + (this->_pos).y) - 120.0) / 40.0 + 0.5)), gridY < 0)) || ((*GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + 0x10)) <= gridY || (iVar6 = gridY * gridY + iVar6, iVar6 < 0)))) { return 0; } local_68.x = (float)this; gridY = __RTDynamicCast(this->_extraData,0, &IsaacRepentancePlus::Entity_Familiar::ExtraData::RTTI_Type_Descriptor, &IsaacRepentancePlus::AbyssLocustData::RTTI_Type_Descriptor,0); if (gridY != 0) { if (*GHIDRA_CAST((gridY + 0x3c)) == iVar6) { return 0; } *GHIDRA_CAST((gridY + 0x3c)) = iVar6; } if (0x1bf < iVar6) { return 0; } gridEntity = *GHIDRA_CAST((GHIDRA_CAST(g_game->_room) + iVar6 * 4 + 0x24)); if (gridEntity == GHIDRA_CAST(0x0)) { return 0; } if (gridEntity->_collisionClass == 1) { return 0; } if (gridEntity->_collisionClass == 0) { return 0; } pvVar4 = get_item_config_entry(this); uVar7 = 0; rolledEffectMask = 0; tearFlags0 = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 8)); tearFlags1 = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0xc)); tearFlags2 = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x10)); tearFlags3 = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x14)); tearEffectEntry = *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x68)); uStack_50 = tearFlags0; uStack_4c = tearFlags1; uStack_48 = tearFlags2; uStack_44 = tearFlags3; if (tearEffectEntry != *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x6c))) { uVar8 = 1; do { if (((uVar7 & uVar8) == 0) && (0.0 < *tearEffectEntry)) { rngValue = Random(); uVar7 = rolledEffectMask; if ((float)((double)GHIDRA_INT(rngValue) + __uint_to_double_fixup[-(GHIDRA_INT(rngValue) >> 0x1f)]) * 2.3283064e-10 < *tearEffectEntry) { tearFlags0 = tearFlags0 | GHIDRA_UINT(tearEffectEntry[2]); tearFlags1 = tearFlags1 | GHIDRA_UINT(tearEffectEntry[3]); tearFlags2 = tearFlags2 | GHIDRA_UINT(tearEffectEntry[4]); tearFlags3 = tearFlags3 | GHIDRA_UINT(tearEffectEntry[5]); rolledEffectMask = rolledEffectMask | GHIDRA_UINT(tearEffectEntry[7]); uVar7 = rolledEffectMask; } } tearEffectEntry = tearEffectEntry + 0x1a; uVar8 = uVar8 << 1 | GHIDRA_UINT((GHIDRA_INT(uVar8) < 0)); } while (tearEffectEntry != *GHIDRA_CAST((GHIDRA_CAST(pvVar4) + 0x6c))); } cVar2 = gridEntity->CanTakeDamageFromTearEffects(); fVar1 = local_68.x; if (cVar2 != '\0') { if (((tearFlags0 & GHIDRA_UINT(g_tearFlagAcid._l)) == 0 && (tearFlags1 & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagAcid._l)) + 0x4)))) == 0) && ((tearFlags2 & GHIDRA_UINT(g_tearFlagAcid._h)) == 0 && (tearFlags3 & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagAcid._h)) + 0x4)))) == 0)) { if (((tearFlags0 & GHIDRA_UINT(g_tearFlagRock._l)) == 0 && (tearFlags1 & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagRock._l)) + 0x4)))) == 0) && ((tearFlags2 & GHIDRA_UINT(g_tearFlagRock._h)) == 0 && (tearFlags3 & (*GHIDRA_CAST((GHIDRA_CAST(&(g_tearFlagRock._h)) + 0x4)))) == 0 )) goto LAB_0064a73c; } fStack_28 = (GHIDRA_CAST((GHIDRA_INT(local_68.x) + 0x33c)))->x; fStack_24 = (GHIDRA_CAST((GHIDRA_INT(local_68.x) + 0x33c)))->y; fStack_20 = (GHIDRA_CAST((GHIDRA_INT(local_68.x) + 0x360)))->x; sourceRef = *GHIDRA_CAST((GHIDRA_CAST(local_68.x) + 0x28)); iStack_34 = *GHIDRA_CAST((GHIDRA_CAST(local_68.x) + 0x2c)); iStack_30 = *GHIDRA_CAST((GHIDRA_CAST(local_68.x) + 0x34)); iStack_2c = *GHIDRA_CAST((GHIDRA_CAST(local_68.x) + 0x38)); fStack_1c = (GHIDRA_CAST((GHIDRA_INT(local_68.x) + 0x360)))->y; if ((*GHIDRA_CAST((GHIDRA_CAST(local_68.x) + 0x168)) & 0x20000000) == 0) { uVar7 = 0; } else { uVar7 = 2; } fVar5 = (float)(*GHIDRA_CAST((GHIDRA_INT((GHIDRA_INT(local_68.x) + 0x168)) + 4)) & 0x400000); if (fVar5 == 0.0) { uVar8 = 0; } else { uVar8 = 4; } pEStack_14 = GHIDRA_CAST(local_68.x); uStack_18 = uVar8 | uVar7 | GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(local_68.x) + 0x168)) & 0x100) != 0)); local_68.x = fVar5; cVar2 = gridEntity->Destroy(0,&sourceRef); if (cVar2 != '\0') { Vector::ToCardinal(&local_58,GHIDRA_CAST(local_60.x)); if ((local_58.x == g_vectorZero.x) && (local_58.y == g_vectorZero.y)) { return 1; } gridPos = (GHIDRA_CAST((gridEntity)))->GridEntity::Position(&local_68); local_60.x = local_58.x * 40.0 + gridPos->x; local_60.y = local_58.y * 40.0 + gridPos->y; room = g_game->_room; iVar6 = (GHIDRA_CAST((room)))->Room::GetGridIndex(&local_60); if (iVar6 < 0) { return 1; } if (iVar6 < 0x1c0) { (GHIDRA_CAST((room)))->Room::TryMakeBridge(room->_gridEntities[iVar6],gridEntity); return 1; } (GHIDRA_CAST((room)))->Room::TryMakeBridge(GHIDRA_CAST(0x0),gridEntity); return 1; } } LAB_0064a73c: fStack_28 = (GHIDRA_CAST((GHIDRA_INT(fVar1) + 0x33c)))->x; fStack_24 = (GHIDRA_CAST((GHIDRA_INT(fVar1) + 0x33c)))->y; local_68.x = *GHIDRA_CAST((*GHIDRA_CAST(gridEntity) + 0x10)); sourceRef = *GHIDRA_CAST((GHIDRA_CAST(fVar1) + 0x28)); iStack_34 = *GHIDRA_CAST((GHIDRA_CAST(fVar1) + 0x2c)); iStack_30 = *GHIDRA_CAST((GHIDRA_CAST(fVar1) + 0x34)); iStack_2c = *GHIDRA_CAST((GHIDRA_CAST(fVar1) + 0x38)); fStack_20 = (GHIDRA_CAST((GHIDRA_INT(fVar1) + 0x360)))->x; fStack_1c = (GHIDRA_CAST((GHIDRA_INT(fVar1) + 0x360)))->y; if ((*GHIDRA_CAST((GHIDRA_CAST(fVar1) + 0x168)) & 0x20000000) == 0) { uVar7 = 0; } else { uVar7 = 2; } local_60.x = (float)(*GHIDRA_CAST((GHIDRA_INT((GHIDRA_INT(fVar1) + 0x168)) + 4)) & 0x400000); if (local_60.x == 0.0) { uVar8 = 0; } else { uVar8 = 4; } pEStack_14 = GHIDRA_CAST(fVar1); uStack_18 = uVar8 | uVar7 | GHIDRA_UINT(((*GHIDRA_CAST((GHIDRA_CAST(fVar1) + 0x168)) & 0x100) != 0)); (*(code *)local_68.x)(local_58.x,&sourceRef); return 1; } // 0064a830 void Entity_Familiar::load_config_graphics() { byte bVar1; uint uVar2; void *wispEntry; byte *pbVar3; uint animCompare; int iVar4; undefined4 *appendedPath; byte extraout_CL; byte extraout_CL_00; byte extraout_CL_01; int collectibleId; std_string *animNameCursor; void *freeBlock; bool isLess; std_string *defaultAnim; void *sheetPath; char acStack_70 [4]; char acStack_6c [4]; char acStack_68 [8]; uint sheetPathCapacity; void *basePath [4]; undefined4 basePathSize; uint basePathCapacity; byte sheetFileName [32]; uint local_24; undefined1 *puStack_20; void *local_1c; undefined1 *puStack_18; undefined4 local_14; puStack_20 = sheetFileName + 0x40; local_14 = -1; puStack_18 = &LAB_00af7285; local_1c = ExceptionList; uVar2 = __security_cookie ^ GHIDRA_UINT((sheetFileName + 0x34)); ExceptionList = &local_1c; if (this->_variant == 0xe7) { iVar4 = this->_coins; collectibleId = this->_subtype; } else { collectibleId = 0x19; iVar4 = 0; } local_24 = uVar2; wispEntry = ItemConfig::get_wisp_entry(collectibleId,iVar4); if (this->_config == (void *)0x0) goto LAB_0064aa74; (GHIDRA_CAST((&this->_sprite)))->ANM2::Load(GHIDRA_CAST((GHIDRA_INT(this->_config) + 0x74)),1); defaultAnim = &(this->_sprite)._animDefaultName; if (0xf < (this->_sprite)._animDefaultName._capacity) { defaultAnim = *GHIDRA_CAST(defaultAnim->_buf); } pbVar3 = (this->_sprite)._animState._animData; if (pbVar3 == GHIDRA_CAST(0x0)) { LAB_0064a90e: bVar1 = (GHIDRA_CAST((&this->_sprite)))->ANM2::SetAnimation(GHIDRA_CAST(defaultAnim),1); if (bVar1 != 0) { (GHIDRA_CAST((&(this->_sprite)._animState)))->AnimationState::Rewind(); (this->_sprite)._animState._isPlaying = 1; } } else { if (0xf < *GHIDRA_CAST((pbVar3 + 0x14))) { pbVar3 = *GHIDRA_CAST(pbVar3); } animNameCursor = defaultAnim; do { bVar1 = *pbVar3; isLess = bVar1 < (byte)animNameCursor->_buf[0]; if (bVar1 != animNameCursor->_buf[0]) { LAB_0064a8f6: animCompare = -GHIDRA_UINT(isLess) | 1; goto LAB_0064a8fb; } if (bVar1 == 0) break; bVar1 = pbVar3[1]; isLess = bVar1 < (byte)animNameCursor->_buf[1]; if (bVar1 != animNameCursor->_buf[1]) goto LAB_0064a8f6; pbVar3 = pbVar3 + 2; animNameCursor = GHIDRA_CAST((animNameCursor->_buf + 2)); } while (bVar1 != 0); animCompare = 0; LAB_0064a8fb: if ((animCompare != 0) || ((*GHIDRA_CAST((GHIDRA_INT((this->_sprite)._animState._animData) + 0x34)) != '\0' && ((this->_sprite)._animState._isPlaying == 0)))) goto LAB_0064a90e; } iVar4 = __RTDynamicCast(this->_extraData,0, &IsaacRepentancePlus::Entity_Familiar::ExtraData::RTTI_Type_Descriptor, &IsaacRepentancePlus::AbyssLocustData::RTTI_Type_Descriptor,0,uVar2); if (((*GHIDRA_CAST((iVar4 + 0x18)) | *GHIDRA_CAST((GHIDRA_CAST(wispEntry) + 0x18))) & 0x40000) != 0) { sprintf(sheetFileName,GHIDRA_CAST("hungry_%d.png")); (GHIDRA_CAST((GHIDRA_CAST(basePath))))->std::string::string(&(g_manager->_itemConfig)._wispGfxRoot); pbVar3 = sheetFileName; local_14 = 0; do { bVar1 = *pbVar3; pbVar3 = pbVar3 + 1; } while (bVar1 != 0); appendedPath = (GHIDRA_CAST((GHIDRA_CAST(basePath))))->std::string::append(sheetFileName, GHIDRA_INT(pbVar3) - GHIDRA_INT((sheetFileName + 1))); sheetPath = (void *)*appendedPath; acStack_70 = (char [4])appendedPath[1]; acStack_6c = (char [4])appendedPath[2]; (*GHIDRA_CAST((GHIDRA_CAST(&(acStack_68)) + 0x0))) = appendedPath[3]; unique0x0000a400 = *GHIDRA_CAST((appendedPath + 4)); appendedPath[4] = 0; appendedPath[5] = 0xf; *GHIDRA_CAST(appendedPath) = 0; (*GHIDRA_CAST((GHIDRA_CAST(&(local_14)) + 0x0))) = 1; (GHIDRA_CAST((GHIDRA_CAST(&this->_sprite))))->Sprite::ReplaceSpritesheet(0,GHIDRA_CAST(&sheetPath)); local_14 = (*GHIDRA_CAST((GHIDRA_CAST(&(GHIDRA_UINT(local_14))) + 0x1))) << 8; bVar1 = extraout_CL; if (0xf < sheetPathCapacity) { uVar2 = sheetPathCapacity + 1; freeBlock = sheetPath; if (0xfff < uVar2) { freeBlock = *(void **)(GHIDRA_CAST(sheetPath) + -4); uVar2 = sheetPathCapacity + 0x24; if (0x1f < GHIDRA_UINT((GHIDRA_INT(sheetPath) + (-4 - GHIDRA_INT(freeBlock))))) goto LAB_0064aa4a; } operator_delete(freeBlock,uVar2); bVar1 = extraout_CL_00; } local_14 = -1; if (0xf < basePathCapacity) { uVar2 = basePathCapacity + 1; freeBlock = basePath[0]; if (0xfff < uVar2) { freeBlock = *(void **)(GHIDRA_INT(basePath[0]) + -4); uVar2 = basePathCapacity + 0x24; if (0x1f < GHIDRA_UINT((GHIDRA_INT(basePath[0]) + (-4 - GHIDRA_INT(freeBlock))))) { LAB_0064aa4a: /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(freeBlock,uVar2); bVar1 = extraout_CL_01; } basePathSize = 0; basePathCapacity = 0xf; basePath[0] = (void *)(GHIDRA_UINT(basePath[0]) & 0xffffff00); (GHIDRA_CAST((&this->_sprite)))->ANM2::LoadGraphics(bVar1); } LAB_0064aa74: anm2_apply_gfx_overrides (GHIDRA_CAST((GHIDRA_INT(wispEntry) + 0x84)),GHIDRA_CAST((GHIDRA_INT(wispEntry) + 0x9c)), &this->_sprite); ExceptionList = local_1c; return; } // 0064b6c0 void Entity_Familiar::render_abyss_locust_sprite(ANM2 *param_2, float *param_3) { void *wispEntry; int collectibleId; int index; float fVar1; float fVar2; double dVar3; Vector screenPos [8]; if (param_2->_loaded != 0) { fVar1 = (param_2->_color)._tint[3]; if (this->_state == -1) { fVar1 = fVar1 + 0.04; fVar2 = 1.0; if (fVar1 <= 1.0) { fVar2 = fVar1; } } else { fVar1 = fVar1 - 0.04; fVar2 = 0.0; if (0.0 <= fVar1) { fVar2 = fVar1; } if (fVar2 == 0.0) { (GHIDRA_CAST((param_2)))->ANM2::Reset(); return; } } (param_2->_color)._tint[3] = fVar2; if (0.0 < fVar2) { if (this->_variant == 0xe7) { collectibleId = this->_subtype; index = this->_coins; } else { collectibleId = 0x19; index = 0; } wispEntry = ItemConfig::get_wisp_entry(collectibleId,index); fVar2 = *GHIDRA_CAST((GHIDRA_CAST(wispEntry) + 0x78)) * 0.45; fVar1 = (this->_sizeMulti).x; (param_2->_scale).y = fVar2 * (this->_sizeMulti).y; (param_2->_scale).x = fVar2 * fVar1; if (param_2->_loaded != 0) { (GHIDRA_CAST((¶m_2->_animState)))->AnimationState::Update(); (GHIDRA_CAST((¶m_2->_overlayAnimState)))->AnimationState::Update(); } fVar1 = g_displayPixelRatio * g_screenPointScale; dVar3 = floor((double)(((((this->_pos).x + 0.0) - 60.0) * 0.65 + (g_screenWidth - 338.0) * 0.5 ) * fVar1 + 0.5)); screenPos[0].x = (float)dVar3 / fVar1; dVar3 = floor((double)(((((this->_pos).y - 25.0) - 140.0) * 0.65 + (g_screenHeight - 182.0) * 0.5) * fVar1 + 0.5)); screenPos[0].x = screenPos[0].x + *param_3; screenPos[0].y = (float)dVar3 / fVar1 + param_3[1]; (GHIDRA_CAST((param_2)))->ANM2::Render(screenPos,&g_vectorZero,&g_vectorZero); } } return; } // 0064b920 void Entity_Familiar::siren_charm(Entity *siren, Entity_Player *player) { uint seed; EntityPtr sirenHelper; EntityPtr *helperRef; Entity_Familiar *local_c [2]; int *collectibleCount; if (this->_sirenOriginalPlayer == (void *)0x0) { this->_sirenOriginalPlayer = this->_player; } local_c[0] = this; if (this->_player != player) { set_player(this,player); } this->_fireCooldown = 0x2d; if (this->_target != (EntityPtr)0x0) { local_c[0] = GHIDRA_CAST(&this->_target); std::multiset::erase(local_c); } this->_target = (EntityPtr)0x0; seed = Random(); sirenHelper = (EntityPtr) (GHIDRA_CAST((g_game)))->Game::SpawnEx(0x3c6,0,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),0,seed,0); if (*GHIDRA_CAST((GHIDRA_CAST(sirenHelper) + 0x3bc)) != (EntityPtr)0x0) { local_c[0] = GHIDRA_CAST((GHIDRA_INT(sirenHelper) + 0x3bc)); std::multiset::erase(local_c); } *GHIDRA_CAST((GHIDRA_CAST(sirenHelper) + 0x3bc)) = (EntityPtr)siren; if (siren != GHIDRA_CAST(0x0)) { std::multiset::insert(GHIDRA_CAST((GHIDRA_INT(sirenHelper) + 0x3bc))); } if (*GHIDRA_CAST((GHIDRA_CAST(sirenHelper) + 0x3c4)) != (EntityPtr)0x0) { local_c[0] = GHIDRA_CAST((GHIDRA_INT(sirenHelper) + 0x3c4)); std::multiset::erase(local_c); } *GHIDRA_CAST((GHIDRA_CAST(sirenHelper) + 0x3c4)) = (EntityPtr)this; std::multiset::insert(GHIDRA_CAST((GHIDRA_INT(sirenHelper) + 0x3c4))); *GHIDRA_CAST((GHIDRA_CAST(sirenHelper) + 0x168)) = *GHIDRA_CAST((GHIDRA_CAST(sirenHelper) + 0x168)) & 0xfffffffb; *GHIDRA_CAST((GHIDRA_CAST(sirenHelper) + 0x16c)) = *GHIDRA_CAST((GHIDRA_CAST(sirenHelper) + 0x16c)); *GHIDRA_CAST((GHIDRA_CAST(sirenHelper) + 0x380)) = *GHIDRA_CAST((GHIDRA_CAST(sirenHelper) + 900)); (**(code **)(*GHIDRA_CAST(sirenHelper) + 0xc))(); if (this->_variant == 0x41) { collectibleCount = GHIDRA_CAST((GHIDRA_INT((player->_collectibleCounts)._begin) + 0x45c)); *collectibleCount = *collectibleCount + 1; } else if (this->_variant == 0x20) { collectibleCount = GHIDRA_CAST((GHIDRA_INT((player->_collectibleCounts)._begin) + 0x1c0)); *collectibleCount = *collectibleCount + 1; } this->_sirenCharmFrames = 1; helperRef = &this->_sirenHelper; if (*helperRef != sirenHelper) { if (*helperRef != (EntityPtr)0x0) { local_c[0] = GHIDRA_CAST(helperRef); std::multiset::erase(local_c); } *helperRef = sirenHelper; std::multiset::insert(helperRef); } return; } // 0064bab0 void Entity_Familiar::RemoveFromPlayer() { EntityPtr *local_8; int *familiarCounter; void *player; EntityPtr *sirenHelperRef; if (this->_sirenOriginalPlayer != (void *)0x0) { player = this->_player; if (*GHIDRA_CAST((GHIDRA_CAST(player) + 0x170)) == '\0') { if (this->_variant == 0x41) { familiarCounter = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(player) + 0x16c8)) + 0x45c)); *familiarCounter = *familiarCounter + -1; } else if (this->_variant == 0x20) { familiarCounter = GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(player) + 0x16c8)) + 0x1c0)); *familiarCounter = *familiarCounter + -1; } } set_player(this,this->_sirenOriginalPlayer); } sirenHelperRef = &this->_sirenHelper; this->_sirenCharmFrames = 0; this->_sirenOriginalPlayer = (void *)0x0; if (this->_sirenHelper != (EntityPtr)0x0) { (**(code **)(*GHIDRA_CAST(this->_sirenHelper) + 0x28))(); if (*sirenHelperRef != (EntityPtr)0x0) { local_8 = sirenHelperRef; std::multiset::erase(&local_8); *sirenHelperRef = (EntityPtr)0x0; } } if (this->_variant == 0xdc) { this->Remove(); } return; } // 0064ca30 void Entity_Familiar::UpdateDirtColor(byte Immediate) { float fVar1; float fVar2; float fVar3; byte bVar4; LayerState *layer; ColorMod *lerpedColor; byte *****pppppbVar5; byte *****pppppbVar6; uint uVar7; ColorMod *layerColor; uint freeSize; ColorMod lerpResult; ANM2 *sprite; Entity_Familiar *familiar; ColorMod *dirtColor; LayerState *currentLayer; byte *****layerNameBuf; uint local_64; byte *layerIndex; char isDirtLayer; uint cleanupFlags; byte *****layerName [4]; uint layerNameSize; uint layerNameCapacity; byte *****layerNameCopy; KColor local_38; uint local_24; undefined1 *puStack_20; void *local_1c; undefined1 *puStack_18; byte ****local_14; puStack_20 = GHIDRA_CAST((layerName + 0x14)); local_14 = GHIDRA_CAST(0xffffffff); puStack_18 = &LAB_00af739e; local_1c = ExceptionList; local_24 = __security_cookie ^ GHIDRA_UINT((layerName + 0x11)); ExceptionList = &local_1c; local_64 = 0; cleanupFlags = 0; familiar = this; (GHIDRA_CAST((g_game->_room)))->Room::GetFloorColorAt(&local_38,&this->_pos,this->_size); dirtColor = &this->_dirtColor; (this->_dirtColor)._tint[3] = 1.0; dirtColor->_tint[0] = local_38._red * 2.0; (this->_dirtColor)._tint[1] = local_38._green * 2.0; (this->_dirtColor)._tint[2] = local_38._blue * 2.0; layerIndex = GHIDRA_CAST(0x0); if ((this->_sprite)._layerCount == 0) { ExceptionList = local_1c; return; } sprite = &this->_sprite; do { layer = (GHIDRA_CAST((sprite)))->ANM2::GetLayer(layerIndex); cleanupFlags = cleanupFlags | 4; currentLayer = layer; if (layer->_layerData == (void *)0x0) { layerNameCapacity = 0xf; layerNameSize = 0; layerName[0] = GHIDRA_CAST(0x0); } else { (GHIDRA_CAST((GHIDRA_CAST(layerName))))->std::string::string((void *)(GHIDRA_INT(layer->_layerData) + 8)); } local_14 = GHIDRA_CAST(0x0); local_64 = cleanupFlags | 1; pppppbVar6 = GHIDRA_CAST(layerName); if (0xf < layerNameCapacity) { pppppbVar6 = layerName[0]; } layerNameBuf = layerName[0]; cleanupFlags = local_64; bVar4 = str_eq(GHIDRA_CAST(pppppbVar6),layerNameSize,&DAT_00b64428,4); if (bVar4 == 0) { cleanupFlags = cleanupFlags | 8; if (layer->_layerData == (void *)0x0) { layerNameCopy = GHIDRA_CAST(0x0); local_38._unk = 0xf; local_38._alpha = 0.0; } else { (GHIDRA_CAST((GHIDRA_CAST(&layerNameCopy))))->std::string::string((void *)(GHIDRA_INT(layer->_layerData) + 8)); } uVar7 = local_38._unk; pppppbVar6 = layerNameCopy; cleanupFlags = cleanupFlags | 2; pppppbVar5 = GHIDRA_CAST(&layerNameCopy); if (0xf < GHIDRA_UINT(local_38._unk)) { pppppbVar5 = layerNameCopy; } bVar4 = str_eq(GHIDRA_CAST(pppppbVar5),GHIDRA_UINT(local_38._alpha),&DAT_00b1d57c,4); if (bVar4 != 0) goto LAB_0064cbdf; isDirtLayer = '\0'; } else { pppppbVar6 = layerNameCopy; uVar7 = local_38._unk; LAB_0064cbdf: isDirtLayer = '\x01'; } if (((cleanupFlags & 2) != 0) && (cleanupFlags = cleanupFlags & 0xfffffffd, 0xf < uVar7)) { freeSize = uVar7 + 1; pppppbVar5 = pppppbVar6; if (0xfff < freeSize) { pppppbVar5 = GHIDRA_CAST(pppppbVar6[-1]); freeSize = uVar7 + 0x24; if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(pppppbVar6) + (-4 - GHIDRA_INT(pppppbVar5))))) goto LAB_0064ccc7; } operator_delete(pppppbVar5,freeSize); } local_14 = GHIDRA_CAST(0xffffffff); if (((cleanupFlags & 1) != 0) && (cleanupFlags = cleanupFlags & 0xfffffffe, 0xf < layerNameCapacity)) { uVar7 = layerNameCapacity + 1; pppppbVar6 = layerNameBuf; if (0xfff < uVar7) { pppppbVar6 = GHIDRA_CAST(layerNameBuf[-1]); uVar7 = layerNameCapacity + 0x24; if (GHIDRA_CAST(0x1f) < GHIDRA_CAST((GHIDRA_INT(layerNameBuf) + (-4 - GHIDRA_INT(pppppbVar6))))) { LAB_0064ccc7: /* WARNING: Subroutine does not return */ _invalid_parameter_noinfo_noreturn(); } } operator_delete(pppppbVar6,uVar7); } layer = currentLayer; if (isDirtLayer != '\0') { layerColor = ¤tLayer->_color; lerpedColor = Color::Lerp(&lerpResult,layerColor,dirtColor,1.0); if (layerColor != lerpedColor) { fVar1 = lerpedColor->_tint[1]; fVar2 = lerpedColor->_tint[2]; fVar3 = lerpedColor->_tint[3]; layerColor->_tint[0] = lerpedColor->_tint[0]; (layer->_color)._tint[1] = fVar1; (layer->_color)._tint[2] = fVar2; (layer->_color)._tint[3] = fVar3; fVar1 = lerpedColor->_colorize[1]; fVar2 = lerpedColor->_colorize[2]; fVar3 = lerpedColor->_colorize[3]; (layer->_color)._colorize[0] = lerpedColor->_colorize[0]; (layer->_color)._colorize[1] = fVar1; (layer->_color)._colorize[2] = fVar2; (layer->_color)._colorize[3] = fVar3; fVar1 = lerpedColor->_offset[1]; (layer->_color)._offset[0] = lerpedColor->_offset[0]; (layer->_color)._offset[1] = fVar1; (layer->_color)._offset[2] = lerpedColor->_offset[2]; } } layerIndex = layerIndex + 1; if (GHIDRA_CAST((familiar->_sprite)._layerCount) <= layerIndex) { ExceptionList = local_1c; return; } } while( true ); } // 0064d1d0 void Entity_Familiar::update_star_of_bethlehem_speed(byte isForce) { float fVar1; float fVar2; int fromRoomIdx; short starPathLength; short playerPathLength; uint toRoomIdx; short roomDistances [194]; undefined4 stackCookie; stackCookie = __security_cookie ^ GHIDRA_UINT((roomDistances + 0xc4)); if ((isForce == 0) && ((fVar1 = (this->_formationOffset).x, fVar1 != g_vectorZero.x || ((this->_formationOffset).y != g_vectorZero.y)))) { if (g_game->_currentDimensionIdx != 0) { LAB_0064d32e: this->_orbitAngleOffset = 0.25; return; } fVar2 = (this->_formationOffset).y; fromRoomIdx = g_game->_currentRoomIdx; toRoomIdx = star_of_bethlehem_get_target_room(); if (-1 < fromRoomIdx) { starPathLength = Level::compute_room_distances (roomDistances,GHIDRA_INT((fVar2 + 0.5)) * 0xd + GHIDRA_INT((fVar1 + 0.5)),toRoomIdx, GHIDRA_CAST(0x0)); playerPathLength = Level::compute_room_distances(roomDistances,fromRoomIdx,toRoomIdx,GHIDRA_CAST(0x0)); if (starPathLength + 9 < GHIDRA_INT(playerPathLength)) goto LAB_0064d32e; if (starPathLength < playerPathLength) { this->_orbitAngleOffset = 0.5; return; } if (playerPathLength + 9 < GHIDRA_INT(starPathLength)) { this->_orbitAngleOffset = 8.0; return; } if (playerPathLength < starPathLength) { this->_orbitAngleOffset = 4.0; return; } } } this->_orbitAngleOffset = 1.0; return; } // 0064e0c0 void Entity_Familiar::ai_blood_clot(byte isPostMove) { Entity **ppEVar1; char **ppcVar2; byte bVar3; char isRottenHeartsPickable; uint uVar4; uint uVar5; uint rngResult; Entity *pEVar6; Entity **ppEVar7; undefined4 gridCollisionClass; LayerState *layer; Vector *pVVar8; int *piVar9; void *nearbyPlayer; int iVar10; Entity_Player *extraout_ECX; Entity_Player *player; void *nearbyEntity; float fVar11; float fVar12; float fVar13; float fVar14; float distSq; float dx; Entity *pEVar15; undefined3 in_stack_00000005; EntityRef sourceRef; Vector local_8c; float local_84; EntityList_EL local_80; float local_6c; float local_68; EntityPtr selfFamiliar; undefined1 local_60 [12]; float local_54; float local_50; float local_4c; byte isMoving; Entity *local_44; Entity *local_40; Entity *local_3c; Entity *local_38; char *walkAnims [4]; uint local_24; undefined1 *puStack_20; void *local_1c; undefined1 *puStack_18; char *local_14; ColorMod *effectColor; Manager *manager; EntityPtr oldParent; code *takeDamageFn; puStack_20 = GHIDRA_CAST((walkAnims + 0xc)); local_14 = GHIDRA_CAST(0xffffffff); puStack_18 = &LAB_00af741d; local_1c = ExceptionList; uVar4 = __security_cookie ^ GHIDRA_UINT((walkAnims + 9)); iVar10 = this->_state; walkAnims[0] = "WalkLeft"; walkAnims[1] = "WalkUp"; walkAnims[2] = "WalkRight"; walkAnims[3] = "WalkDown"; if (iVar10 == 1) { if (((this->_sprite)._animState._animData != (void *)0x0) && ((this->_sprite)._animState._isPlaying != 0)) { return; } if (isPostMove == 0) { this->_entityCollisionClass = 3; this->_state = 0; return; } return; } ExceptionList = &local_1c; selfFamiliar = (EntityPtr)this; local_24 = uVar4; if (iVar10 < 2) { ppcVar2 = walkAnims + 0xc; if ((iVar10 == -1000) && ((ppcVar2 = walkAnims + 0xc, this->_player == (void *)0x0 || (bVar3 = TemporaryEffects::HasCollectibleEffect (GHIDRA_CAST((GHIDRA_INT(this->_player) + 0x1508)),0x2c9), ppcVar2 = GHIDRA_CAST(puStack_20), bVar3 == 0)))) { puStack_20 = GHIDRA_CAST(ppcVar2); this->_state = 0; ppcVar2 = GHIDRA_CAST(puStack_20); } puStack_20 = GHIDRA_CAST(ppcVar2); player = this->_player; local_40 = GHIDRA_CAST(g_vectorZero.x); iVar10 = player->_entityGridCollisionClass; local_3c = GHIDRA_CAST(g_vectorZero.y); if ((((iVar10 == 0) || (iVar10 == 3)) || (iVar10 == 1)) || (fVar11 = 7.00649e-45, iVar10 == 2)) { fVar11 = 4.2039e-45; } this->_entityGridCollisionClass = GHIDRA_INT(fVar11); local_38 = GHIDRA_CAST(player->_movespeed); local_4c = 1.0; local_50 = fVar11; if ((player->_isControlsEnabled != 0) && (player->_controlsCooldown < 1)) { pVVar8 = (GHIDRA_CAST((player)))->Entity_Player::GetMovementJoystick(GHIDRA_CAST((local_60 + 8))); local_40 = GHIDRA_CAST(pVVar8->x); local_3c = GHIDRA_CAST(pVVar8->y); if (((this->_flags & 0x8000) != 0) && (fVar11 == 7.00649e-45)) { local_3c = GHIDRA_CAST(0x0); } fVar11 = sqrtf((float)local_3c * (float)local_3c + (float)local_40 * (float)local_40); player = extraout_ECX; if ((local_4c < fVar11) && (0.0 < fVar11)) { local_40 = GHIDRA_CAST(((local_4c / fVar11) * (float)local_40)); local_3c = GHIDRA_CAST(((float)local_3c * (local_4c / fVar11))); } } bVar3 = input_is_action_pressed (0xb,GHIDRA_INT(this->_player[5]._color._colorize[0]),this->_player,GHIDRA_INT(player)); if (bVar3 == 0) { pEVar6 = local_3c; } else { local_40 = GHIDRA_CAST(g_vectorZero.x); pEVar6 = GHIDRA_CAST(g_vectorZero.y); } (this->_targetPosition).x = (float)local_40; (this->_targetPosition).y = (float)pEVar6; local_3c = GHIDRA_CAST(0x0); local_44 = GHIDRA_CAST(0x0); if (((float)local_40 != g_vectorZero.x) || ((float)pEVar6 != g_vectorZero.y)) { local_44 = local_40; local_3c = pEVar6; } this->_moveDirection = -1; local_68 = (float)local_38 * 0.25 + 0.75; local_40 = GHIDRA_CAST(((float)local_40 * local_68)); local_68 = local_68 * (float)pEVar6; if (ABS((float)local_40) <= ABS(local_68)) { if (local_68 < 0.0) { this->_moveDirection = 1; goto LAB_0064eea4; } iVar10 = this->_moveDirection; if (0.0 < local_68) { iVar10 = 3; } } else { iVar10 = 0; if (0.0 <= (float)local_40) { iVar10 = 2; } } this->_moveDirection = iVar10; LAB_0064eea4: uVar4 = GHIDRA_UINT(this->_flags); (*GHIDRA_CAST((GHIDRA_CAST(&(local_60)) + 0x8))) = local_44; local_54 = (float)local_3c; if ((((float)local_40 != 0.0) || (local_68 != 0.0)) && (((uVar4 & 0x8000) == 0 || (local_50 != 7.00649e-45)))) { local_80._size = GHIDRA_INT((this->_velocity).y); local_8c.y = (this->_velocity).x; local_6c = local_68 * (float)local_80._size + (float)local_40 * local_8c.y; local_84 = (float)local_40 * local_6c; local_6c = local_6c * local_68; fVar11 = sqrtf(0.8); (this->_velocity).y = ((float)local_80._size - local_6c) * fVar11 + local_6c; (this->_velocity).x = (local_8c.y - local_84) * fVar11 + local_84; uVar4 = GHIDRA_UINT(this->_flags); } local_6c = 0.0; local_80._size = GHIDRA_INT(((local_68 * (this->_velocity).y + (float)local_40 * (this->_velocity).x) * -0.2)); piVar9 = &local_80._size; if ((float)local_80._size <= 0.0) { piVar9 = GHIDRA_CAST(&local_6c); } local_80._size = GHIDRA_INT((((float)*piVar9 / (float)local_38 + 3.0) * 0.4)); fVar11 = sqrtf(0.775); fVar13 = ((float)local_80._size * 0.25 - (float)local_80._size) * 0.0 + (float)local_80._size; fVar12 = local_68 * 0.5 * fVar13 + (this->_velocity).y; (this->_velocity).x = ((float)local_40 * 0.5 * fVar13 + (this->_velocity).x) * fVar11; if (((uVar4 & 0x8000) == 0) || (local_50 != 7.00649e-45)) { fVar12 = fVar12 * fVar11; } else { fVar12 = fVar12 + 0.225; } (this->_velocity).y = fVar12; local_38 = _isPostMove; if (isPostMove == 0) { if (((float)local_44 != g_vectorZero.x) || (isMoving = isPostMove, (float)local_3c != g_vectorZero.y)) { isMoving = 1; } pEVar6 = local_44; pEVar15 = local_3c; fVar11 = g_vectorZero.y; fVar12 = g_vectorZero.x; if (this->_entityGridCollisionClass == 5) { if (((float)local_44 == g_vectorZero.x) && ((float)local_3c == g_vectorZero.y)) { local_40 = GHIDRA_CAST(s_Idle); } else { iVar10 = vector_to_direction(GHIDRA_CAST((local_60 + 8))); local_40 = GHIDRA_CAST(walkAnims[iVar10]); pEVar15 = local_3c; } } else { local_40 = GHIDRA_CAST(0xb1d4d0); } fVar13 = 24.0; uVar5 = -GHIDRA_UINT((this->_subtype != 0)) & this->_subtype; uVar4 = 7; if (uVar5 < 7) { uVar4 = uVar5; } fVar14 = *GHIDRA_CAST((&DAT_00c3423c + uVar4 * 100)); local_3c = *GHIDRA_CAST((&DAT_00c34240 + uVar4 * 100)); if (8 < this->_headFrameDelay) { local_3c = GHIDRA_CAST(((float)local_3c + 24.0)); } local_80._size = GHIDRA_INT(fVar14); bVar3 = CanPlayerFire(this); if (((bVar3 == 0) || (*GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x162c)) == -1)) || (this->_shootDirection == -1)) { if (((float)pEVar6 == fVar12) && ((float)pEVar15 == fVar11)) { fVar11 = 3.0; } else { iVar10 = vector_to_direction(GHIDRA_CAST((local_60 + 8))); fVar13 = 24.0; fVar11 = (float)iVar10; fVar14 = (float)local_80._size; } local_50 = (72.0 - fVar11 * fVar13) + fVar14; } else { local_50 = (72.0 - (float)this->_shootDirection * fVar13) + fVar14; } layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); (layer->_cropOffset).x = local_50; (layer->_cropOffset).y = (float)local_3c; layer = (GHIDRA_CAST((&this->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x1)); (layer->_cropOffset).x = local_50; (layer->_cropOffset).y = (float)local_3c; (GHIDRA_CAST((&this->_sprite)))->ANM2::Play(GHIDRA_CAST(local_40),0); fVar11 = local_4c; if (((isMoving != 0) && (local_80._size = GHIDRA_INT(local_4c), (this->_sprite)._animState._animData != (void *)0x0)) && ((this->_sprite)._animState._isPlaying != 0)) { fVar11 = (this->_velocity).y; fVar12 = (this->_velocity).x; fVar12 = sqrtf(fVar12 * fVar12 + fVar11 * fVar11); if (2.3 <= fVar12) { fVar13 = (float)local_80._size; fVar11 = (float)local_80._size; } else { fVar11 = (fVar12 - local_4c) / 1.3; if (fVar11 <= 0.0) { fVar11 = 0.0; } if (local_4c <= fVar11) { fVar11 = local_4c; } fVar13 = local_4c; fVar11 = fVar11 * 0.5 + 0.5; } if (6.0 < fVar12) { fVar11 = (fVar12 - 6.0) * 0.25; if (fVar11 <= 0.0) { fVar11 = 0.0; } if (fVar13 <= fVar11) { fVar11 = fVar13; } fVar11 = fVar11 + fVar13; } } (this->_sprite)._playbackSpeed = fVar11; pVVar8 = &this->_pos; EntityList::QueryRadius (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_60),pVVar8,8.0, 0x21); fVar11 = 0.0; fVar12 = 0.0; fVar13 = 0.0; local_3c = GHIDRA_CAST(0x0); local_40 = GHIDRA_CAST(0x0); if (local_54 != 0.0) { do { nearbyEntity = *(void **)((*GHIDRA_CAST((GHIDRA_CAST(&(local_60)) + 0x4))) + GHIDRA_INT(fVar11) * 4); if ((nearbyEntity == (void *)0x0) || (nearbyPlayer = nearbyEntity, *GHIDRA_CAST((GHIDRA_CAST(nearbyEntity) + 0x28)) != 1)) { if (nearbyEntity == (void *)0x0) { nearbyPlayer = (void *)0x0; goto LAB_0064f6c1; } nearbyPlayer = (void *)0x0; if (*GHIDRA_CAST((GHIDRA_CAST(nearbyEntity) + 0x28)) != 3) goto LAB_0064f6c1; LAB_0064f36a: if ((nearbyEntity != (void *)0x0) && ((*GHIDRA_CAST((GHIDRA_CAST(nearbyEntity) + 0x2c)) == this->_variant && (*(void **)(GHIDRA_CAST(nearbyEntity) + 0x410) == this->_player)))) { dx = pVVar8->x - *GHIDRA_CAST((GHIDRA_CAST(nearbyEntity) + 0x33c)); fVar14 = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(nearbyEntity) + 0x340)); goto LAB_0064f39d; } } else { LAB_0064f6c1: nearbyEntity = (void *)0x0; if ((nearbyPlayer == (void *)0x0) || (nearbyPlayer != this->_player)) goto LAB_0064f36a; dx = pVVar8->x - *GHIDRA_CAST((GHIDRA_CAST(nearbyPlayer) + 0x33c)); fVar14 = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(nearbyPlayer) + 0x340)); LAB_0064f39d: if ((dx != g_vectorZero.x) || (fVar14 != g_vectorZero.y)) { distSq = fVar14 * fVar14 + dx * dx; fVar13 = fVar13 + (dx * 0.5) / distSq; fVar12 = fVar12 + (fVar14 * 0.5) / distSq; } } fVar11 = (float)(GHIDRA_INT(fVar11) + 1); } while (GHIDRA_UINT(fVar11) < GHIDRA_UINT(local_54)); local_40 = GHIDRA_CAST(fVar13); local_3c = GHIDRA_CAST(fVar12); } fVar11 = sqrtf((float)local_3c * (float)local_3c + (float)local_40 * (float)local_40); pEVar6 = local_3c; pEVar15 = local_40; if ((2.0 < fVar11) && (0.0 < fVar11)) { pEVar6 = GHIDRA_CAST(((float)local_3c * (2.0 / fVar11))); pEVar15 = GHIDRA_CAST(((float)local_40 * (2.0 / fVar11))); } fVar11 = this->_speedMultiplier; (this->_velocity).y = fVar11 * (float)pEVar6 + (this->_velocity).y; (this->_velocity).x = fVar11 * (float)pEVar15 + (this->_velocity).x; if (local_60[0] == '\0') { local_14 = GHIDRA_CAST(0x2); tracked_alloc(1,(*GHIDRA_CAST((GHIDRA_CAST(&((void *)local_60)) + 0x4))),0); local_14 = GHIDRA_CAST(0xffffffff); } } update_weapon(this,(byte)local_38); if ((this->_state + 999U < 999) && (iVar10 = this->_state + 1, this->_state = iVar10, -1 < iVar10)) { this->_state = 2; this->_visible = 0; play_sound_with_fart_seed(0x1e,local_4c,2,0,1.0); uVar4 = Random(); pEVar6 = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,2,&this->_pos,&g_vectorZero,GHIDRA_CAST(0x0),2,uVar4); (**(code **)(*GHIDRA_CAST(pEVar6) + 0x3c)) (GHIDRA_CAST((GHIDRA_INT(selfFamiliar) + 0x1e4)),0xffffffff,0xff,0,1); iVar10 = *GHIDRA_CAST(pEVar6); (pEVar6->_sprite)._offset.x = 0.0; (pEVar6->_sprite)._offset.y = -6.0; pEVar6->_renderDepthOffset = 10.0; (**(code **)(iVar10 + 0xc))(); *GHIDRA_CAST((GHIDRA_CAST(selfFamiliar) + 0x188)) = 0; *GHIDRA_CAST((GHIDRA_CAST(selfFamiliar) + 0x184)) = 0; (*GHIDRA_CAST((GHIDRA_CAST(&(local_60)) + 0x8))) = (this->_pos).x - *GHIDRA_CAST((GHIDRA_INT(*(void **)(GHIDRA_CAST(selfFamiliar) + 0x410)) + 0x33c)); local_54 = (this->_pos).y - *GHIDRA_CAST((GHIDRA_INT(*(void **)(GHIDRA_CAST(selfFamiliar) + 0x410)) + 0x340)); pVVar8 = (GHIDRA_CAST((GHIDRA_CAST((local_60 + 8)))))->Vector::Resized(&local_8c,6.0); uVar4 = Random(); local_80._size = GHIDRA_INT((((float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283064e-10 * 40.0 - 20.0) * 0.017453292)); local_6c = cos((float)local_80._size); fVar13 = sin((float)local_80._size); fVar11 = pVVar8->x; fVar12 = pVVar8->y; (GHIDRA_CAST((GHIDRA_INT(selfFamiliar) + 0x360)))->x = fVar11 * local_6c - fVar12 * fVar13; (GHIDRA_CAST((GHIDRA_INT(selfFamiliar) + 0x360)))->y = fVar12 * local_6c + fVar11 * fVar13; (GHIDRA_CAST((GHIDRA_INT(selfFamiliar) + 0xdac)))->_end = (GHIDRA_CAST((GHIDRA_INT(selfFamiliar) + 0xdac)))->_begin; this = GHIDRA_CAST(selfFamiliar); } if ((char)local_38 == '\0') { uVar4 = this->_subtype; if (uVar4 == 7) { fVar11 = this->_health / DAT_00c344f4; if (fVar11 <= 0.0) { fVar11 = 0.0; } if (local_4c <= fVar11) { fVar11 = local_4c; } fVar12 = fVar11 * 0.39999998 + 0.6; fVar11 = fVar12 * g_vectorOne.x; (this->_sprite)._scale.y = fVar12 * g_vectorOne.y; (this->_sprite)._scale.x = fVar11; } else { bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(0xf,0); if (bVar3 != 0) { if (uVar4 == 0) { uVar5 = 0; } else { uVar5 = uVar4; if (6 < uVar4) { uVar5 = 7; } } fVar11 = this->_health; if ((float)(&DAT_00c34238)[uVar5 * 0x19] <= fVar11 && fVar11 != (float)(&DAT_00c34238)[uVar5 * 0x19]) { fVar11 = fVar11 - 0.2; if (uVar4 == 0) { uVar4 = 0; } else if (6 < uVar4) { uVar4 = 7; } if (fVar11 <= (float)(&DAT_00c34238)[uVar4 * 0x19]) { fVar11 = (float)(&DAT_00c34238)[uVar4 * 0x19]; } this->_health = fVar11; } } nearbyEntity = this->_config; fVar11 = this->_health; fVar12 = *GHIDRA_CAST((GHIDRA_CAST(nearbyEntity) + 0x50)); (this->_sprite)._color._colorize[0] = 1.0; (this->_sprite)._color._colorize[1] = 1.0; (this->_sprite)._color._colorize[2] = 1.0; fVar12 = (fVar11 * fVar11) / (fVar12 * fVar12); if (fVar12 <= 0.0) { fVar12 = 0.0; } if (local_4c <= fVar12) { fVar12 = local_4c; } (this->_sprite)._color._colorize[3] = 0.6 - fVar12 * 1.1; fVar11 = sqrtf(fVar11 / *GHIDRA_CAST((GHIDRA_CAST(nearbyEntity) + 0x50))); if (fVar11 <= 0.0) { fVar11 = 0.0; } if (local_4c <= fVar11) { fVar11 = local_4c; } fVar11 = fVar11 * 0.5 + 0.6; fVar12 = fVar11 * g_vectorOne.x; (this->_sprite)._scale.y = fVar11 * g_vectorOne.y; (this->_sprite)._scale.x = fVar12; } } ExceptionList = local_1c; return; } if (isPostMove != 0) goto LAB_0064ea36; puStack_20 = GHIDRA_CAST((walkAnims + 0xc)); bVar3 = (GHIDRA_CAST((GHIDRA_CAST(this))))->Entity::IsFrame(2,0); if (bVar3 != 0) { uVar5 = Random(); rngResult = Random(); fVar11 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 0.25 + 0.25; local_54 = fVar11 * (this->_velocity).y; (*GHIDRA_CAST((GHIDRA_CAST(&(local_60)) + 0x8))) = fVar11 * (this->_velocity).x; pEVar6 = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0x6f,&this->_pos,GHIDRA_CAST((local_60 + 8)),GHIDRA_CAST(0x0),0,uVar5); pEVar6->SetColor(&this->_splatColor,0xffffffff,0xff,0,1,uVar4); local_44 = GHIDRA_CAST(g_vectorOne.x); local_68 = g_vectorOne.y; uVar4 = Random(); fVar11 = (float)((double)GHIDRA_INT(uVar4) + __uint_to_double_fixup[-(GHIDRA_INT(uVar4) >> 0x1f)]) * 2.3283064e-10 * 0.3 + 0.3; (pEVar6->_sprite)._scale.y = fVar11 * local_68; (pEVar6->_sprite)._scale.x = fVar11 * (float)local_44; fVar11 = (this->_posOffset).y; (pEVar6->_posOffset).x = (this->_posOffset).x + 0.0; (pEVar6->_posOffset).y = fVar11 - 8.0; } EntityList::QueryRadius(GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),&local_80,&this->_pos,20.0,8); local_14 = GHIDRA_CAST(0x0); local_38 = GHIDRA_CAST(0x0); if (GHIDRA_CAST(local_80._size) != GHIDRA_CAST(0x0)) { do { pEVar6 = local_38; bVar3 = Entity::IsVulnerableEnemy (*GHIDRA_CAST((GHIDRA_CAST(local_80._data) + GHIDRA_INT(local_38) * 4)),GHIDRA_CAST(0x0)); if ((bVar3 != 0) && (pEVar15 = *GHIDRA_CAST((GHIDRA_CAST(local_80._data) + GHIDRA_INT(pEVar6) * 4)), (pEVar15->_flags & 0x20000000) == 0)) { local_44 = GHIDRA_CAST((GHIDRA_INT(this) + 0xdac)); bVar3 = (GHIDRA_CAST((GHIDRA_CAST(local_44))))->EntityList::HitListContains(pEVar15); if (bVar3 == 0) { uVar4 = (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(local_80._data) + GHIDRA_INT(pEVar6) * 4)))))->Entity::GetHitListIndex(); sorted_vector_insert_unique(local_44,uVar4); takeDamageFn = *(code **)(**GHIDRA_CAST((GHIDRA_CAST(local_80._data) + GHIDRA_INT(pEVar6) * 4)) + 0x20); (GHIDRA_CAST((&sourceRef)))->EntityRef::constructor(GHIDRA_CAST(selfFamiliar)); (*takeDamageFn)(*GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(selfFamiliar) + 0x410)) + 0x157c)) * 3.0,0,0, &sourceRef,0x1e); pEVar6 = local_38; this = GHIDRA_CAST(selfFamiliar); } } local_38 = GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((pEVar6)) + 0x1)))); } while (local_38 < GHIDRA_UINT(local_80._size)); } iVar10 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0xd88)); *GHIDRA_CAST((GHIDRA_CAST(this) + 0xd88)) = iVar10 + 1; local_68 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)) + 0x33c)); local_50 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)) + 0x340)); local_38 = GHIDRA_CAST((local_68 - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x33c)))); local_3c = GHIDRA_CAST((local_50 - *GHIDRA_CAST((GHIDRA_CAST(this) + 0x340)))); fVar11 = sqrtf((float)local_38 * (float)local_38 + (float)local_3c * (float)local_3c); pEVar6 = local_38; if (0.0 < fVar11) { local_3c = GHIDRA_CAST(((float)local_3c * (1.0 / fVar11))); pEVar6 = GHIDRA_CAST(((float)local_38 * (1.0 / fVar11))); } fVar11 = (float)(iVar10 + -1); local_3c = (Entity *) ((float)local_3c * fVar11 * fVar11 * *GHIDRA_CAST((GHIDRA_CAST(this) + 0x39c)) + *GHIDRA_CAST((GHIDRA_CAST(this) + 0x364))); local_44 = (Entity *) (fVar11 * (float)pEVar6 * fVar11 * *GHIDRA_CAST((GHIDRA_CAST(this) + 0x39c)) + *GHIDRA_CAST((GHIDRA_CAST(this) + 0x360))); *GHIDRA_CAST((GHIDRA_CAST(this) + 0x364)) = local_3c; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x360)) = local_44; fVar11 = sqrtf((float)local_3c * (float)local_3c + (float)local_44 * (float)local_44); pEVar6 = local_3c; if ((20.0 < fVar11) && (0.0 < fVar11)) { pEVar6 = GHIDRA_CAST(((float)local_3c * (20.0 / fVar11))); *GHIDRA_CAST((GHIDRA_CAST(this) + 0x360)) = (float)local_44 * (20.0 / fVar11); *GHIDRA_CAST((GHIDRA_CAST(this) + 0x364)) = pEVar6; } fVar11 = sqrtf(*GHIDRA_CAST((GHIDRA_CAST(this) + 0x360)) * *GHIDRA_CAST((GHIDRA_CAST(this) + 0x360)) + (float)pEVar6 * (float)pEVar6); local_44 = GHIDRA_CAST((fVar11 + 2.0)); fVar12 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x33c)) - local_68; local_38 = GHIDRA_CAST(0x41200000); fVar11 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x340)) - local_50; local_3c = local_44; fVar11 = sqrtf(fVar11 * fVar11 + fVar12 * fVar12); ppEVar1 = GHIDRA_CAST((GHIDRA_INT(this) + 0xd88)); ppEVar7 = &local_44; if ((float)local_3c <= 10.0) { ppEVar7 = &local_38; } if (fVar11 <= (float)*ppEVar7) { local_44 = GHIDRA_CAST(0x59); ppEVar7 = &local_44; if (0x58 < GHIDRA_INT(*ppEVar1)) { ppEVar7 = ppEVar1; } *ppEVar1 = *ppEVar7; manager = g_manager; switch(*GHIDRA_CAST((GHIDRA_CAST(this) + 0x30))) { case 0: bVar3 = (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)))))->Entity_Player::CanPickRedHearts(); manager = g_manager; if (bVar3 == 0) goto switchD_0064e588_default; local_38 = GHIDRA_CAST(0xb9); seed_fart_sound_override(GHIDRA_CAST(&local_38)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_38),1.0,2,0,1.0,0.0); (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)))))->Entity_Player::AddHearts(1,1,0); this->Remove(); break; case 1: bVar3 = (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)))))->Entity_Player::CanPickSoulHearts(); if (bVar3 == 0) goto switchD_0064e588_default; uVar4 = (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)))->_soulHearts; if (((uVar4 & 1) == 0) || (bVar3 = (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)))))->Entity_Player::IsBlackHeart(uVar4), bVar3 != 0)) { EntityList::QuerySublist (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_60),3, *GHIDRA_CAST((GHIDRA_CAST(this) + 0x2c)),-1,0,0); fVar11 = 0.0; if (local_54 != 0.0) { do { iVar10 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_60)) + 0x4))) + GHIDRA_INT(fVar11) * 4)); if (((iVar10 != 0) && (*GHIDRA_CAST((iVar10 + 0x28)) == 3)) && ((*GHIDRA_CAST((iVar10 + 0x410)) == *GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)) && (*GHIDRA_CAST((iVar10 + 0x30)) == 2)))) goto LAB_0064e7f1; fVar11 = (float)(GHIDRA_INT(fVar11) + 1); } while (GHIDRA_UINT(fVar11) < GHIDRA_UINT(local_54)); } (GHIDRA_CAST((local_60)))->EntityList_Query::~EntityList_Query(); } manager = g_manager; local_38 = GHIDRA_CAST(0x36); seed_fart_sound_override(GHIDRA_CAST(&local_38)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_38),1.0,2,0,1.0,0.0); (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)))))->Entity_Player::AddSoulHearts(1,0); this->Remove(); break; case 2: bVar3 = (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)))))->Entity_Player::CanPickBlackHearts(); if (bVar3 == 0) goto switchD_0064e588_default; uVar4 = (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)))->_soulHearts; if (((uVar4 & 1) != 0) && (bVar3 = (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)))))->Entity_Player::IsBlackHeart(uVar4), bVar3 == 0)) { EntityList::QuerySublist (GHIDRA_CAST((GHIDRA_INT(g_game->_room) + 0x1218)),GHIDRA_CAST(local_60),3, *GHIDRA_CAST((GHIDRA_CAST(this) + 0x2c)),-1,0,0); fVar11 = 0.0; if (local_54 != 0.0) { do { iVar10 = *GHIDRA_CAST(((*GHIDRA_CAST((GHIDRA_CAST(&(local_60)) + 0x4))) + GHIDRA_INT(fVar11) * 4)); if ((((iVar10 != 0) && (*GHIDRA_CAST((iVar10 + 0x28)) == 3)) && (*GHIDRA_CAST((iVar10 + 0x410)) == *GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)))) && (*GHIDRA_CAST((iVar10 + 0x30)) == 1)) goto LAB_0064e7f1; fVar11 = (float)(GHIDRA_INT(fVar11) + 1); } while (GHIDRA_UINT(fVar11) < GHIDRA_UINT(local_54)); } (GHIDRA_CAST((local_60)))->EntityList_Query::~EntityList_Query(); } manager = g_manager; local_38 = GHIDRA_CAST(0x1d4); seed_fart_sound_override(GHIDRA_CAST(&local_38)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_38),1.0,2,0,1.0,0.0); (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)))))->Entity_Player::AddBlackHearts(1); this->Remove(); break; case 3: local_38 = GHIDRA_CAST(0x10a); seed_fart_sound_override(GHIDRA_CAST(&local_38)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_38),1.0,2,0,1.0,0.0); (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)))))->Entity_Player::AddEternalHearts(1); this->Remove(); break; case 4: bVar3 = (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)))))->Entity_Player::CanPickGoldenHearts(); manager = g_manager; if (bVar3 == 0) goto switchD_0064e588_default; local_38 = GHIDRA_CAST(0x1d1); seed_fart_sound_override(GHIDRA_CAST(&local_38)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_38),1.0,2,0,1.0,0.0); (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)))))->Entity_Player::AddGoldenHearts(1,0); this->Remove(); break; case 5: bVar3 = (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)))))->Entity_Player::CanPickBoneHearts(); manager = g_manager; if (bVar3 == 0) goto switchD_0064e588_default; local_38 = GHIDRA_CAST(0x1cd); seed_fart_sound_override(GHIDRA_CAST(&local_38)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_38),1.0,2,0,1.0,0.0); (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)))))->Entity_Player::AddBoneHearts(1); this->Remove(); break; case 6: isRottenHeartsPickable = (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)))))->Entity_Player::CanPickRottenHearts(); manager = g_manager; if (isRottenHeartsPickable == '\0') goto switchD_0064e588_default; local_38 = GHIDRA_CAST(0x1f1); seed_fart_sound_override(GHIDRA_CAST(&local_38)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_38),1.0,2,0,1.0,0.0); (GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)))))->Entity_Player::AddRottenHearts(2,0); this->Remove(); break; default: switchD_0064e588_default: if (0x5c < *GHIDRA_CAST((GHIDRA_CAST(this) + 0xd88))) { *GHIDRA_CAST((GHIDRA_CAST(this) + 0xd88)) = -1000; if (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x3c0)) != GHIDRA_CAST(0x0)) { (**(code **)(**GHIDRA_CAST((GHIDRA_CAST(this) + 0x3c0)) + 0x28))(); } *GHIDRA_CAST((GHIDRA_CAST(this) + 0x171)) = 1; iVar10 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x410)) + 0x184)); if ((((iVar10 == 0) || (iVar10 == 3)) || (iVar10 == 1)) || (gridCollisionClass = 5, iVar10 == 2)) { gridCollisionClass = 3; } *GHIDRA_CAST((GHIDRA_CAST(this) + 0x184)) = gridCollisionClass; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x188)) = 3; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x360)) = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x360)) * 0.25; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x364)) = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x364)) * 0.25; } } } if ((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x3c0)) == 0) && (1 < *GHIDRA_CAST((GHIDRA_CAST(this) + 0xd88)))) { uVar4 = Random(); local_38 = (GHIDRA_CAST((g_game)))->Game::Spawn(1000,0xa6,GHIDRA_CAST((GHIDRA_INT(this) + 0x33c)),&g_vectorZero, GHIDRA_CAST(this),0,uVar4); uVar5 = -GHIDRA_UINT((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x30)) != 0)) & *GHIDRA_CAST((GHIDRA_CAST(this) + 0x30)); uVar4 = 7; if (uVar5 < 7) { uVar4 = uVar5; } effectColor = &(local_38->_sprite)._color; iVar10 = uVar4 * 100; if (effectColor != GHIDRA_CAST((&DAT_00c34270 + iVar10))) { fVar11 = *GHIDRA_CAST((iVar10 + 0xc34274)); fVar12 = *GHIDRA_CAST((iVar10 + 0xc34278)); fVar13 = *GHIDRA_CAST((iVar10 + 0xc3427c)); effectColor->_tint[0] = *GHIDRA_CAST((&DAT_00c34270 + iVar10)); (local_38->_sprite)._color._tint[1] = fVar11; (local_38->_sprite)._color._tint[2] = fVar12; (local_38->_sprite)._color._tint[3] = fVar13; fVar11 = *GHIDRA_CAST((iVar10 + 0xc34284)); fVar12 = *GHIDRA_CAST((iVar10 + 0xc34288)); fVar13 = *GHIDRA_CAST((iVar10 + 0xc3428c)); (local_38->_sprite)._color._colorize[0] = *GHIDRA_CAST((&DAT_00c34280 + iVar10)); (local_38->_sprite)._color._colorize[1] = fVar11; (local_38->_sprite)._color._colorize[2] = fVar12; (local_38->_sprite)._color._colorize[3] = fVar13; *GHIDRA_CAST((local_38->_sprite)._color._offset) = *GHIDRA_CAST((&DAT_00c34290 + iVar10)); (local_38->_sprite)._color._offset[2] = *GHIDRA_CAST((&DAT_00c34298 + iVar10)); } fVar11 = g_vectorOne.y * 2.0; (local_38->_sprite)._scale.x = g_vectorOne.x * 2.0; (local_38->_sprite)._scale.y = fVar11; uVar4 = g_graphicsManager_flags; layer = (GHIDRA_CAST((&local_38->_sprite)))->ANM2::GetLayer(GHIDRA_CAST(0x0)); pEVar6 = local_38; iVar10 = 1; if ((uVar4 & 4) == 0) { iVar10 = 6; } layer->_blendMode[0] = 0; layer->_blendMode[1] = iVar10; layer->_blendMode[2] = 7; layer->_blendMode[3] = 1; layer->_blendMode[4] = 7; oldParent = local_38->_parent; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST(&(local_38[1])) + 0x44)))) = 0x3e19999a; pEVar15 = local_38 + 1; (pEVar15->_sprite)._filename._buf[0] = -0x66; (pEVar15->_sprite)._filename._buf[1] = -0x67; (pEVar15->_sprite)._filename._buf[2] = '\x19'; (pEVar15->_sprite)._filename._buf[3] = '>'; if (oldParent != (EntityPtr)0x0) { local_44 = GHIDRA_CAST(&local_38->_parent); std::multiset::erase(&local_44); } pEVar6->_parent = (EntityPtr)this; std::multiset::insert(&pEVar6->_parent); pEVar6->Update(); if (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x3c0)) != 0) { local_44 = GHIDRA_CAST((GHIDRA_INT(this) + 0x3c0)); std::multiset::erase(&local_44); } *GHIDRA_CAST((GHIDRA_CAST(this) + 0x3c0)) = pEVar6; std::multiset::insert(GHIDRA_CAST((GHIDRA_INT(this) + 0x3c0))); } if ((*GHIDRA_CAST((GHIDRA_CAST(&(local_80)) + 0x0))) == '\0') { local_14 = GHIDRA_CAST(0x1); tracked_alloc(1,local_80._data,0); } LAB_0064ea36: if (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x3c0)) == 0) { ExceptionList = local_1c; return; } *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x3c0)) + 0xfc)) = 0x3ecccccd; fVar11 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x34c)); fVar12 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x33c)); iVar10 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x3c0)); *GHIDRA_CAST((iVar10 + 0x340)) = (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x350)) + *GHIDRA_CAST((GHIDRA_CAST(this) + 0x340))) - 8.0 ; *GHIDRA_CAST((iVar10 + 0x33c)) = fVar11 + fVar12 + 0.0; ExceptionList = local_1c; return; LAB_0064e7f1: (GHIDRA_CAST((local_60)))->EntityList_Query::~EntityList_Query(); goto switchD_0064e588_default; } // 00650220 void Entity_Familiar::predict_player_movement() { byte isDropPressed; Vector *movementJoystick; Entity_Player *extraout_ECX; Entity_Player *this_00; undefined4 extraout_ECX_00; EntityPtr chainFamiliar; float fVar1; float distanceSq; float fVar2; float fVar3; float local_20; float local_1c; Vector local_18; Vector joystickBuf; Game *game; EntityPtr nextParent; EntityPtr parent; local_20 = g_vectorZero.x; local_1c = g_vectorZero.y; this_00 = this->_player; local_18.x = this_00->_movespeed; if ((this_00->_isControlsEnabled != 0) && (this_00->_controlsCooldown < 1)) { movementJoystick = (GHIDRA_CAST((this_00)))->Entity_Player::GetMovementJoystick(&joystickBuf); local_1c = movementJoystick->y; local_20 = movementJoystick->x; fVar1 = sqrtf(local_1c * local_1c + local_20 * local_20); this_00 = extraout_ECX; if ((1.0 < fVar1) && (0.0 < fVar1)) { local_1c = (1.0 / fVar1) * movementJoystick->y; local_20 = (1.0 / fVar1) * movementJoystick->x; } } isDropPressed = input_is_action_pressed (0xb,GHIDRA_INT(this->_player[5]._color._colorize[0]),this->_player,GHIDRA_INT(this_00)); if (isDropPressed != 0) { local_20 = g_vectorZero.x; local_1c = g_vectorZero.y; } (GHIDRA_CAST((&this->_pathfinder)))->NPCAI_Pathfinder::SimulatePlayerMovement(&local_20,extraout_ECX_00); nextParent = this->_parent; chainFamiliar = (EntityPtr)this; while ((parent = nextParent, parent != (EntityPtr)0x0 && (*GHIDRA_CAST((GHIDRA_CAST(parent) + 0x28)) == 3))) { chainFamiliar = parent; nextParent = *GHIDRA_CAST((GHIDRA_CAST(parent) + 0x3bc)); } fVar1 = (this->_pos).x; local_20 = 0.0; local_18.x = 0.0; do { if (*GHIDRA_CAST((GHIDRA_CAST(chainFamiliar) + 0x28)) != 3) break; fVar1 = (this->_pos).x; fVar3 = fVar1 - (GHIDRA_CAST((GHIDRA_INT(chainFamiliar) + 0x33c)))->x; fVar2 = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(chainFamiliar) + 0x340)); if ((fVar3 != g_vectorZero.x) || (fVar2 != g_vectorZero.y)) { distanceSq = fVar2 * fVar2 + fVar3 * fVar3; local_18.x = local_18.x + (fVar3 * 0.5) / distanceSq; local_20 = local_20 + (fVar2 * 0.5) / distanceSq; } chainFamiliar = *GHIDRA_CAST((GHIDRA_CAST(chainFamiliar) + 0x3c0)); } while (chainFamiliar != (EntityPtr)0x0); fVar1 = fVar1 - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x33c)); fVar2 = (this->_pos).y - *GHIDRA_CAST((GHIDRA_CAST(this->_player) + 0x340)); if ((fVar1 != g_vectorZero.x) || (fVar2 != g_vectorZero.y)) { fVar3 = fVar1 * fVar1 + fVar2 * fVar2; local_20 = (fVar2 * 0.5) / fVar3 + local_20; local_18.x = local_18.x + (fVar1 * 0.5) / fVar3; } fVar3 = sqrtf(local_20 * local_20 + local_18.x * local_18.x); game = g_game; fVar1 = local_20; fVar2 = local_18.x; if ((2.0 < fVar3) && (0.0 < fVar3)) { fVar1 = local_20 * (2.0 / fVar3); fVar2 = local_18.x * (2.0 / fVar3); } fVar3 = this->_speedMultiplier; (this->_velocity).x = fVar3 * fVar2 + (this->_velocity).x; (this->_velocity).y = fVar3 * fVar1 + (this->_velocity).y; Room::GetClampedPositionImpl(game->_room,&local_18,&this->_pos,0.0,0.0,0.0,0.0); local_20 = local_18.x - (this->_pos).x; local_18.x = local_18.y - (this->_pos).y; if ((local_20 != g_vectorZero.x) || (local_18.x != g_vectorZero.y)) { fVar1 = sqrtf(local_18.x * local_18.x + local_20 * local_20); if (0.0 < fVar1) { local_18.x = local_18.x * (1.0 / fVar1); local_20 = local_20 * (1.0 / fVar1); } fVar1 = (this->_velocity).x; fVar2 = this->_speedMultiplier; fVar3 = -(local_18.x * (this->_velocity).y + fVar1 * local_20); if (fVar3 <= 1.0) { fVar3 = 1.0; } if (16.0 <= fVar3) { fVar3 = 16.0; } (this->_velocity).x = local_20 * fVar3 * fVar2 + fVar1; (this->_velocity).y = local_18.x * fVar3 * fVar2 + (this->_velocity).y; } return; } // 00651890 void Entity_Familiar::guard_check_icall() { if ((this->_variant == 0xd3) && (this->_state == 2)) { this->_state = 0; this->Update(); } this->_isHourglassRewound = 1; return; } // 009615e0 byte Entity_Familiar::multidimensional_baby_copy_knife(Entity_Knife *knife, Entity *unused) { Vector direction; Entity *rootParent; uint rngResult; Entity_Knife *copyKnife; float sideOffset; float sinAngle; uint i; EntityPtr *local_18; float local_14; EntityPtr *local_10; float homingDirY; float knifeY; double uintFixup; if ((((knife->_multidimensionalApplied != 0) || (knife->_visible == 0)) || (knife->_knifeVelocity <= 0.0)) || ((knife->_subtype != 0 && (knife->_subtype != 1)))) { return 0; } knife->_visible = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((knife)) + 0x514)))) = knife->_knifeDistance; knife->_multidimensionalApplied = 1; rootParent = (GHIDRA_CAST((knife)))->Entity_Knife::GetRootParent(); rootParent[1]._spawnerVariant = GHIDRA_INT(((float)rootParent[1]._spawnerVariant + 5.0)); i = 0; do { if (i == 0) { sideOffset = 10.0; } else { sideOffset = -10.0; } rngResult = Random(); copyKnife = (Entity_Knife *) (GHIDRA_CAST((g_game)))->Game::SpawnEx(8,knife->_variant,&knife->_pos,&g_vectorZero,GHIDRA_CAST(knife),0, rngResult,1); if (copyKnife == GHIDRA_CAST(0x0)) break; if (copyKnife->_parent != (EntityPtr)0x0) { local_18 = ©Knife->_parent; std::multiset::erase(&local_18); } copyKnife->_parent = (EntityPtr)knife; std::multiset::insert(©Knife->_parent); (GHIDRA_CAST((copyKnife)))->Entity_Knife::copy_parent_state(knife); if (knife->_subtype == 1) { local_18 = GHIDRA_CAST((knife->_rotation * 0.017453292)); local_14 = cos((float)local_18); sinAngle = sin((float)local_18); knifeY = (knife->_pos).y; (copyKnife->_pos).x = (local_14 * 0.0 - sinAngle * sideOffset) + (knife->_pos).x; (copyKnife->_pos).y = local_14 * sideOffset + sinAngle * 0.0 + knifeY; rngResult = Random(); uintFixup = __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]; local_14 = knife->_rotation * 0.017453292; local_18 = GHIDRA_CAST(cos(local_14)); homingDirY = sin(local_14); local_10 = local_18; direction.y = homingDirY; direction.x = (float)local_18; Entity_Knife::InitHomingPath (copyKnife,direction,GHIDRA_CAST(knife), (float)((double)GHIDRA_INT(rngResult) + uintFixup) * 2.3283064e-10 * 50.0 - 25.0); } else { *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((copyKnife)) + 0x504)))) = knife->_knifeDistance; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((copyKnife)) + 0x50c)))) = 0; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((copyKnife)) + 0x510)))) = sideOffset; } copyKnife->Update(); i = i + 1; } while (i < 2); if (knife->_subtype == 1) { knife->Remove(); } return 1; }