#include "classes.h" // 00a031b0 void Weapon_Deathmatch::Fire(Vector *direction, uint8_t isShooting, uint8_t isInterpolated) { uint8_t bVar1; Vector *pVVar2; uint32_t rngResult; Vector *position; Entity_Bomb *bomb; int iVar3; uint32_t scaleRoll; int unused; int unused_00; long double maxCharge; float fVar4; float fVar5; float fVar6; float maxCharge; uint8_t auVar8 [12]; float fVar9; uint8_t *charge; int ownerPlayer; Vector bombVelocity; Vector VStack_18; Vector VStack_10; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x10)) = 0x41a00000; Weapon::Fire(this,direction,isShooting,isInterpolated); if (isInterpolated != 0) { return; } ownerPlayer = *GHIDRA_CAST((GHIDRA_CAST(this) + 4)); if (ownerPlayer != 0) { if (*GHIDRA_CAST((ownerPlayer + 0x28)) == 1) goto LAB_00a03209; if (*GHIDRA_CAST((ownerPlayer + 0x28)) == 3) { ownerPlayer = *GHIDRA_CAST((ownerPlayer + 0x410)); goto LAB_00a03209; } } ownerPlayer = 0; LAB_00a03209: fVar9 = 0.001; if (0.001 <= *GHIDRA_CAST((GHIDRA_CAST(this) + 0x10))) { fVar9 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x10)); } maxCharge = (long double)this->GetMaxCharge(); VStack_10.x = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x20)); VStack_10.y = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x24)); fVar4 = (float)maxCharge; bVar1 = Weapon::IsAxisAligned(this); fVar5 = 1.0; if (bVar1 == 0) { pVVar2 = Weapon::get_aim_direction(this,&VStack_18,&VStack_10); maxCharge = pVVar2->x; fVar6 = pVVar2->y; fVar5 = sqrtf(maxCharge * maxCharge + fVar6 * fVar6); if (0.0 < fVar5) { maxCharge = pVVar2->x * (1.0 / fVar5); fVar6 = pVVar2->y * (1.0 / fVar5); } fVar5 = 1.0; VStack_10.x = maxCharge; } else { pVVar2 = Vector::ToCardinal(&VStack_18,&VStack_10); fVar6 = pVVar2->y; VStack_10.x = pVVar2->x; } maxCharge = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)); VStack_10.y = fVar6; if (isShooting == 0) { auVar8 = ZEXT812(0x3a83126f); if ((*GHIDRA_CAST((GHIDRA_CAST(&(auVar8)) + 0x0))) <= fVar9) { (*GHIDRA_CAST((GHIDRA_CAST(&(auVar8)) + 0x4))) = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar8)) + 0x4))); (*GHIDRA_CAST((GHIDRA_CAST(&(auVar8)) + 0x0))) = fVar9; } fVar9 = (*GHIDRA_CAST((GHIDRA_CAST(&(auVar8)) + 0x0))); if (fVar9 <= maxCharge) { Weapon::UpdateHeadChargeAnimation(this,0xe5,2,&VStack_10,-1.0); if (fVar4 <= *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14))) { fVar4 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)); } if (fVar9 <= fVar4) { fVar4 = fVar9; } unused = 7 - GHIDRA_INT((fVar4 * -0.45)); iVar3 = 0xb; if (0xb < unused) { iVar3 = unused; } Weapon::SetBlinkTime(this,iVar3,unused); pVVar2 = Weapon::get_tear_movement_inheritance(this,&VStack_18,&VStack_10); bombVelocity.x = pVVar2->x; fVar9 = pVVar2->y; VStack_18.x = fVar9; FUN_009f3c40(); rngResult = Random(); fVar4 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 3.14; fVar4 = fVar4 + fVar4; rngResult = Random(); fVar5 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10; rngResult = Random(); fVar6 = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 0.6 + 0.4; maxCharge = cos(fVar4); bombVelocity.x = (maxCharge * fVar5 * 3.5 + (VStack_10.x * 10.0 + bombVelocity.x) * fVar9) * fVar6 ; fVar4 = sin(fVar4); pVVar2 = &bombVelocity; bombVelocity.y = (fVar4 * fVar5 * 3.5 + (VStack_10.y * 10.0 + VStack_18.x) * fVar9) * fVar6; position = Weapon::get_owner_position(this,&VStack_10); bomb = Weapon::fire_bomb(this,position,pVVar2); if (ownerPlayer != 0) { bomb->_fallAcceleration = 0.8; rngResult = Random(); bomb->_fallSpeed = -1.0 - (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 8.0; rngResult = Random(); iVar3 = bomb->_explosionCountdown1 - rngResult % 0xf; if (iVar3 < 0xf) { iVar3 = 0xf; } bomb->_explosionCountdown1 = iVar3; *GHIDRA_CAST(&(*GHIDRA_CAST((GHIDRA_CAST((bomb)) + 0x414)))) = iVar3; } rngResult = Random(); scaleRoll = Random(); bomb->_loadCostumes = 1; bomb->_explosionDamage = 25.0; fVar9 = (float)((double)GHIDRA_INT(scaleRoll) + __uint_to_double_fixup[-(GHIDRA_INT(scaleRoll) >> 0x1f)]) * 2.3283064e-10 * 0.15 + ((float)(rngResult & 1) + 0.0) * 0.2 + 0.4; bomb->_radiusMultiplier = fVar9 * bomb->_radiusMultiplier; bomb->_scale = fVar9 * bomb->_scale; } *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)) = 0; bVar1 = Weapon::IsItemAnimFinished(this,0xe5); if (bVar1 != 0) { FUN_009f4fc0(); return; } } else { if (fVar4 <= maxCharge) { charge = &DAT_bf800000; iVar3 = 1; } else { if (*GHIDRA_CAST((GHIDRA_CAST(this) + 4)) != 0) { fVar5 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 4)) + 0x39c)); } iVar3 = 0; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)) = fVar5 + maxCharge; charge = GHIDRA_CAST((((fVar5 + maxCharge) / fVar4) * 18.0)); } Weapon::UpdateHeadChargeAnimation(this,0xe5,iVar3,direction,(float)charge); Weapon::SetBlinkTime(this,1,unused_00); *GHIDRA_CAST((GHIDRA_CAST(this) + 0x20)) = direction->x; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x24)) = direction->y; } return; } // 00a036b0 float Weapon_Deathmatch::GetMaxCharge() { float maxCharge; maxCharge = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x10)); if (maxCharge < 0.001) { maxCharge = 0.001; } return maxCharge; }