#include "classes.h" // 00a0e270 void Weapon_UmbilicalWhip::Fire(Vector *direction, uint8_t isShooting, uint8_t isInterpolated) { uint8_t isAxisAligned; Vector *vecResult; uint32_t seed; int *whip; int *extraout_ECX; int *unused; Entity *whipEntity; float fVar1; float ownerY; Entity_Player *local_2c; Vector VStack_28; Vector VStack_20; Vector aimDirection; Vector scratchVec; uint32_t flagsHigh; Manager *manager; int owner; Weapon::Fire(this,direction,isShooting,isInterpolated); local_2c = *GHIDRA_CAST((GHIDRA_CAST(this) + 4)); if (local_2c == GHIDRA_CAST(0x0)) { LAB_00a0e2c3: local_2c = GHIDRA_CAST(0x0); } else { if (local_2c->_type != 1) { if (local_2c->_type != 3) goto LAB_00a0e2c3; local_2c = *GHIDRA_CAST(&local_2c->_isControlsEnabled); if (local_2c == GHIDRA_CAST(0x0)) goto LAB_00a0e2cb; } Entity_Player::HasCollectible(local_2c,0x18a,0); } LAB_00a0e2cb: whip = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x44)); owner = 0; if (whip != GHIDRA_CAST(0x0)) { owner = (*GHIDRA_CAST((GHIDRA_CAST(whip) + 0x171)) != '\0') + 1; } *GHIDRA_CAST((GHIDRA_CAST(this) + 0x1c)) = owner; if ((isShooting != 0) && (*GHIDRA_CAST((GHIDRA_CAST(this) + 0xc)) <= 0.0 && *GHIDRA_CAST((GHIDRA_CAST(this) + 0xc)) != 0.0)) { if (isInterpolated != 0) { return; } unused = whip; if ((whip != GHIDRA_CAST(0x0)) && (whip[0x362] == 1)) { (**(code **)(*whip + 0x28))(); whip = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x44)); unused = extraout_ECX; } if (whip == GHIDRA_CAST(0x0)) { fVar1 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x10)); *GHIDRA_CAST((GHIDRA_CAST(this) + 0xc)) = fVar1 + fVar1; Weapon::SetBlinkTime(this,7 - GHIDRA_INT((fVar1 * -0.45)),GHIDRA_INT(unused)); aimDirection.x = direction->x; aimDirection.y = direction->y; isAxisAligned = Weapon::IsAxisAligned(this); if (isAxisAligned == 0) { (GHIDRA_CAST((&aimDirection)))->Vector::Normalize(); } else { vecResult = Vector::ToCardinal(&VStack_20,&aimDirection); aimDirection.x = vecResult->x; aimDirection.y = vecResult->y; } VStack_28.x = aimDirection.x * 10.0; VStack_20.x = aimDirection.y * 10.0; vecResult = Weapon::get_tear_movement_inheritance(this,&scratchVec,&aimDirection); VStack_28.x = vecResult->x * 0.4 + VStack_28.x; VStack_28.y = vecResult->y * 0.4 + VStack_20.x; vecResult = (GHIDRA_CAST((&VStack_28)))->Vector::Normalized(&scratchVec); aimDirection.x = vecResult->x; aimDirection.y = vecResult->y; seed = Random(); vecResult = Weapon::get_owner_position(this,&scratchVec); VStack_28.x = (float)Game::SpawnEx(g_game,3,0xf0,vecResult,&g_vectorZero,GHIDRA_CAST(local_2c),0, seed,0); whipEntity = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x44)); whip = GHIDRA_CAST((GHIDRA_INT(this) + 0x44)); if (whipEntity != GHIDRA_CAST(VStack_28.x)) { if (whipEntity != GHIDRA_CAST(0x0)) { VStack_20.x = (float)whip; msvc::multiset::erase(&VStack_20); } *whip = GHIDRA_INT(VStack_28.x); whipEntity = GHIDRA_CAST(0x0); if (GHIDRA_CAST(VStack_28.x) != GHIDRA_CAST(0x0)) { msvc::multiset::insert(whip); whipEntity = GHIDRA_CAST(*whip); } } flagsHigh = *GHIDRA_CAST((GHIDRA_INT(&whipEntity->_flags) + 4)); *GHIDRA_CAST(&whipEntity->_flags) = GHIDRA_UINT(whipEntity->_flags) & 0xfffffffb; *GHIDRA_CAST((GHIDRA_INT(&whipEntity->_flags) + 4)) = flagsHigh; vecResult = (GHIDRA_CAST((&aimDirection)))->Vector::Normalized(&scratchVec); fVar1 = vecResult->y; owner = *whip; *GHIDRA_CAST((owner + 0x334)) = vecResult->x; *GHIDRA_CAST((owner + 0x338)) = fVar1; (**(code **)(*GHIDRA_CAST(*whip) + 0xc))(); manager = g_manager; local_2c = GHIDRA_CAST(0x1ee); seed_fart_sound_override(GHIDRA_CAST(&local_2c)); (GHIDRA_CAST((&manager->_sfxManager)))->SoundEffects::Play(GHIDRA_INT(local_2c),1.0,2,0,1.0,0.0); Weapon::TriggerTearEffects(this,&aimDirection,1); whip = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x44)); } } if (whip == GHIDRA_CAST(0x0)) { *GHIDRA_CAST((GHIDRA_CAST(this) + 0x3c)) = g_vectorZero.x; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x40)) = g_vectorZero.y; } else { owner = *GHIDRA_CAST((GHIDRA_CAST(this) + 4)); if (owner == 0) { fVar1 = g_vectorZero.x; ownerY = g_vectorZero.y; } else { fVar1 = *GHIDRA_CAST((owner + 0x33c)); ownerY = *GHIDRA_CAST((owner + 0x340)); } local_2c = GHIDRA_CAST(((float)whip[0xcf] - fVar1)); VStack_28.x = (float)whip[0xd0] - ownerY; fVar1 = sqrtf((float)local_2c * (float)local_2c + VStack_28.x * VStack_28.x); if (fVar1 <= 0.0) { *GHIDRA_CAST((GHIDRA_CAST(this) + 0x3c)) = local_2c; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x40)) = VStack_28.x; } else { *GHIDRA_CAST((GHIDRA_CAST(this) + 0x3c)) = (float)local_2c * (1.0 / fVar1); *GHIDRA_CAST((GHIDRA_CAST(this) + 0x40)) = VStack_28.x * (1.0 / fVar1); } } if ((isShooting == 0) && (*GHIDRA_CAST((GHIDRA_CAST(this) + 0x44)) != 0)) { *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x44)) + 0xd88)) = 1; } return; }