#include "classes.h" // 00a0d9c0 void Weapon_TechX::Fire(Vector *direction, uint8_t isShooting, uint8_t isInterpolated) { Vector shotDirection; bool bVar1; bool bVar2; uint8_t bVar3; uint8_t isAxisAligned; int ownerPlayer; Vector *pVVar4; Entity_Laser *laser; uint32_t rngResult; Entity_Player *pEVar5; int extraout_ECX; int unusedArg; Entity_Player *player; int extraout_ECX_00; int extraout_ECX_01; uint32_t randomLasersLeft; float fVar6; float fVar7; float cosAngle; float fVar8; float fVar9; float fVar10; float fVar11; float releaseCharge; Vector local_70; Vector aimDirection; Vector local_60; Vector scratchVec; float fStack_50; float fStack_4c; Vector VStack_48; uint32_t local_40; float fStack_3c; float fStack_38; float fStack_34; float fStack_30; int iStack_2c; float fStack_28; uint32_t uStack_24; uint32_t uStack_20; int ownerEntity; Weapon::Fire(this,direction,isShooting,isInterpolated); if (isInterpolated != 0) { return; } pEVar5 = *GHIDRA_CAST((GHIDRA_CAST(this) + 4)); if (pEVar5 == GHIDRA_CAST(0x0)) { LAB_00a0da10: player = GHIDRA_CAST(0x0); if (pEVar5 != GHIDRA_CAST(0x0)) { if (pEVar5->_type == 1) goto LAB_00a0da2f; if (pEVar5->_type == 3) goto LAB_00a0da23; } LAB_00a0da39: fVar6 = 1.0; } else if (pEVar5->_type == 1) { fVar6 = pEVar5->_shotspeed; player = pEVar5; } else { if (pEVar5->_type != 3) goto LAB_00a0da10; player = *GHIDRA_CAST(&pEVar5->_isControlsEnabled); LAB_00a0da23: pEVar5 = *GHIDRA_CAST(&pEVar5->_isControlsEnabled); if (pEVar5 == GHIDRA_CAST(0x0)) goto LAB_00a0da39; LAB_00a0da2f: fVar6 = pEVar5->_shotspeed; } if (player == GHIDRA_CAST(0x0)) { LAB_00a0da62: bVar1 = false; } else { bVar3 = Entity_Player::HasCollectible(player,0x18a,0); bVar1 = true; if (bVar3 == 0) goto LAB_00a0da62; } if (((*GHIDRA_CAST((GHIDRA_CAST(this) + 0x34)) >> 7 & 1) != 0) || (bVar2 = false, *GHIDRA_CAST((GHIDRA_CAST(this) + 0x10)) <= 0.0)) { bVar2 = true; } ownerEntity = *GHIDRA_CAST((GHIDRA_CAST(this) + 4)); releaseCharge = -1000.0; if (ownerEntity == 0) { LAB_00a0dae1: fVar11 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x28)); fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x2c)); } else { if (*GHIDRA_CAST((ownerEntity + 0x28)) == 1) { ownerPlayer = ownerEntity; } else if ((*GHIDRA_CAST((ownerEntity + 0x28)) != 3) || (ownerPlayer = *GHIDRA_CAST((ownerEntity + 0x410)), ownerPlayer == 0)) goto LAB_00a0dae1; ownerPlayer = *GHIDRA_CAST((ownerPlayer + 0x140c)); if ((ownerPlayer == 0) || (!bVar1)) goto LAB_00a0dae1; fVar11 = *GHIDRA_CAST((ownerPlayer + 0x33c)); fVar8 = *GHIDRA_CAST((ownerPlayer + 0x340)); } if ((fVar11 == g_vectorZero.x) && (fVar8 == g_vectorZero.y)) { bVar1 = false; } else { bVar1 = true; } local_60.x = fVar11; local_60.y = fVar8; if (isShooting != 0) { if (bVar2) { releaseCharge = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x10)) * 3.0; } else if (bVar1) { pVVar4 = Weapon::get_owner_position(this,&scratchVec); fVar8 = fVar8 - pVVar4->y; fVar11 = fVar11 - pVVar4->x; fVar11 = sqrtf(fVar8 * fVar8 + fVar11 * fVar11); releaseCharge = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x10)); fVar11 = (fVar11 - 50.0) / 250.0; if (fVar11 <= 0.0) { fVar11 = 0.0; } if (1.0 <= fVar11) { fVar11 = 1.0; } releaseCharge = (releaseCharge * 3.0 - releaseCharge) * fVar11 + releaseCharge; } } if ((((ownerEntity != 0) && (*GHIDRA_CAST((ownerEntity + 0x28)) == 1)) && (0 < *GHIDRA_CAST((ownerEntity + 0x18f8)))) && (releaseCharge = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x10)), releaseCharge < 1.0)) { releaseCharge = 1.0; } bVar3 = isShooting; if ((-1000.0 < releaseCharge) && (releaseCharge <= *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)))) { bVar3 = 0; } aimDirection.x = direction->x; aimDirection.y = direction->y; if (isShooting == 0) { aimDirection.x = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x20)); aimDirection.y = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x24)); } isAxisAligned = Weapon::IsAxisAligned(this); if (isAxisAligned == 0) { fVar11 = sqrtf(aimDirection.x * aimDirection.x + aimDirection.y * aimDirection.y); ownerEntity = extraout_ECX_00; if (0.0 < fVar11) { aimDirection.x = (1.0 / fVar11) * aimDirection.x; aimDirection.y = aimDirection.y * (1.0 / fVar11); } } else { pVVar4 = Vector::ToCardinal(&scratchVec,&aimDirection); aimDirection.x = pVVar4->x; aimDirection.y = pVVar4->y; ownerEntity = extraout_ECX; } fVar9 = 1.0; fVar11 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x10)); fVar8 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)); if (bVar3 == 0) { if (fVar11 < 1.0) { fVar9 = 1.0; } else { fVar9 = fVar11; } if ((fVar9 <= fVar8) || ((-1000.0 < releaseCharge && (releaseCharge <= fVar8)))) { *GHIDRA_CAST((GHIDRA_CAST(this) + 0xc)) = fVar11; ownerPlayer = 7 - GHIDRA_INT((fVar11 * -0.45)); ownerEntity = 0xb; if (0xb < ownerPlayer) { ownerEntity = ownerPlayer; } Weapon::SetBlinkTime(this,ownerEntity,ownerPlayer); Weapon::TriggerTearEffects(this,&aimDirection,1); Weapon::get_owner_position(this,&local_60); fVar8 = aimDirection.x * 10.0; fVar9 = aimDirection.y * 10.0; pVVar4 = Weapon::get_tear_movement_inheritance(this,&scratchVec,&aimDirection); fVar10 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x10)) + 1.0; fVar8 = fVar8 + pVVar4->x; fVar11 = *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)) + 1.0; fVar9 = fVar9 + pVVar4->y; if (fVar10 * 3.0 <= fVar11) { fVar11 = fVar10 * 3.0; } fVar10 = (fVar11 - fVar10) / (fVar10 + fVar10); fVar11 = fVar10 * 45.0 + 15.0; Weapon::GetMultiShotParams(this,&local_40,unusedArg); fVar10 = fVar10 * 0.75 + 0.25; if ((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_24)) + 0x1))) != '\0') { local_70.x = -fVar8 * fVar6; local_70.y = -fVar9 * fVar6; laser = Weapon::fire_tech_x_laser(this,&local_60,&local_70,fVar11,fVar10); (**(code **)(*GHIDRA_CAST(laser) + 0xc))(); } if ((*GHIDRA_CAST((GHIDRA_CAST(&(uStack_24)) + 0x2))) != '\0') { local_70.x = fVar8 * fVar6; local_70.y = fVar6 * -fVar9; laser = Weapon::fire_tech_x_laser(this,&local_60,&local_70,fVar11,fVar10); (**(code **)(*GHIDRA_CAST(laser) + 0xc))(); local_70.x = -fVar8 * fVar6; local_70.y = fVar9 * fVar6; laser = Weapon::fire_tech_x_laser(this,&local_60,&local_70,fVar11,fVar10); (**(code **)(*GHIDRA_CAST(laser) + 0xc))(); } for (randomLasersLeft = uStack_20 & 0xffff; randomLasersLeft != 0; randomLasersLeft = randomLasersLeft - 1) { rngResult = Random(); local_70.x = (float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 0.5 + 0.5; rngResult = Random(); fVar7 = ((float)((double)GHIDRA_INT(rngResult) + __uint_to_double_fixup[-(GHIDRA_INT(rngResult) >> 0x1f)]) * 2.3283064e-10 * 50.0 - 25.0) * 0.017453292; cosAngle = cos(fVar7); fVar7 = sin(fVar7); scratchVec.x = (fVar8 * cosAngle - fVar9 * fVar7) * fVar6; scratchVec.y = (fVar9 * cosAngle + fVar8 * fVar7) * fVar6; laser = Weapon::fire_tech_x_laser (this,&local_60,&scratchVec,local_70.x * fVar11,local_70.x * fVar10); (**(code **)(*GHIDRA_CAST(laser) + 0xc))(); } ownerEntity = 0; if (0 < (short)local_40) { local_70.x = fVar8; local_70.y = fVar9; do { shotDirection.y = local_70.y; shotDirection.x = local_70.x; Entity_Player::GetMultiShotPositionVelocity (&fStack_50,ownerEntity,9,shotDirection,fVar6,(short)local_40,fStack_3c, fStack_38,fStack_34,fStack_30,iStack_2c,fStack_28,(uint8_t)uStack_24, (short)uStack_20); scratchVec.x = local_60.x + fStack_50; scratchVec.y = fStack_4c + local_60.y; laser = Weapon::fire_tech_x_laser(this,&scratchVec,&VStack_48,fVar11,fVar10); (**(code **)(*GHIDRA_CAST(laser) + 0xc))(); ownerEntity = ownerEntity + 1; } while (ownerEntity < (short)local_40); } pEVar5 = *GHIDRA_CAST((GHIDRA_CAST(this) + 4)); if ((((pEVar5 == GHIDRA_CAST(0x0)) || (player = pEVar5, pEVar5->_type != 1)) && (player = GHIDRA_CAST(0x0), pEVar5 != GHIDRA_CAST(0x0))) && (pEVar5->_type == 3)) { pEVar5->_chargeBarSprites[5]._numEvents = 0; } else if (player != GHIDRA_CAST(0x0)) { Entity_Player::stop_costume_item_anims(player); *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)) = 0; goto LAB_00a0e1fe; } } *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)) = 0; } else { if (fVar11 * 3.0 <= fVar8) { Weapon::UpdateHeadChargeAnimation(this,0x18b,1,direction,-1.0); ownerEntity = extraout_ECX_01; } else { if (*GHIDRA_CAST((GHIDRA_CAST(this) + 4)) != 0) { fVar9 = *GHIDRA_CAST((*GHIDRA_CAST((GHIDRA_CAST(this) + 4)) + 0x39c)); } *GHIDRA_CAST((GHIDRA_CAST(this) + 0x14)) = fVar8 + fVar9; } Weapon::SetBlinkTime(this,1,ownerEntity); } LAB_00a0e1fe: if (isShooting != 0) { bVar3 = Weapon::IsAxisAligned(this); if (bVar3 != 0) { fVar6 = direction->y; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x20)) = direction->x; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x24)) = fVar6; return; } pVVar4 = Weapon::get_aim_direction(this,&local_60,direction); *GHIDRA_CAST((GHIDRA_CAST(this) + 0x20)) = pVVar4->x; *GHIDRA_CAST((GHIDRA_CAST(this) + 0x24)) = pVVar4->y; } return; } // 00a0e260 float Weapon_TechX::GetMaxCharge() { return *GHIDRA_CAST((GHIDRA_CAST(this) + 0x10)) * 3.0; }