Add CPlayerGun::CPlayerGun

This commit is contained in:
Henrique Gemignani Passos Lima 2022-10-06 11:53:35 +03:00
parent 074cb7ff98
commit 835ea5361f
No known key found for this signature in database
GPG Key ID: E224F951761145F8
5 changed files with 129 additions and 2 deletions

View File

@ -17,6 +17,8 @@ class CAABox;
class CActorLights { class CActorLights {
public: public:
CActorLights(uint areaUpdateFramePeriod, const CVector3f& actorPosBias, int maxDynamicLights, int maxAreaLights,
bool ambientChannelOverflow, bool layer2, bool disableWorldLights, float positionUpdateThreshold);
~CActorLights(); ~CActorLights();
void BuildConstantAmbientLighting(); void BuildConstantAmbientLighting();

View File

@ -15,6 +15,13 @@ private:
CVector3f x8_scale; CVector3f x8_scale;
bool x14_canLoop; bool x14_canLoop;
int x18_defaultAnim; int x18_defaultAnim;
public:
// CAnimRes()
// : x4_charIdx(-1), x14_canLoop(false), x8_scale(????), x18_defaultAnim(-1) {}
CAnimRes(CAssetId ancs, int charIdx, const CVector3f& scale, const int defaultAnim, bool loop)
: x0_ancsId(ancs), x4_charIdx(charIdx), x8_scale(scale), x14_canLoop(loop), x18_defaultAnim(defaultAnim) {}
}; };
CHECK_SIZEOF(CAnimRes, 0x1c) CHECK_SIZEOF(CAnimRes, 0x1c)

View File

@ -17,6 +17,7 @@
class CAABox; class CAABox;
class CActorLights; class CActorLights;
class CAnimData; class CAnimData;
class CAnimRes;
class CFrustumPlanes; class CFrustumPlanes;
class CModel; class CModel;
class CModelFlags; class CModelFlags;
@ -47,7 +48,7 @@ public:
bool HasNormalModel() const { return x1c_normalModel; } bool HasNormalModel() const { return x1c_normalModel; }
CModelData(); CModelData();
// __ct__10CModelDataFRC8CAnimRes CModelData(const CAnimRes&);
// __ct__10CModelDataFRC10CStaticRes // __ct__10CModelDataFRC10CStaticRes
CModelData(const CModelData& other); CModelData(const CModelData& other);
~CModelData(); ~CModelData();

View File

@ -4,8 +4,10 @@
#include "types.h" #include "types.h"
#include "MetroidPrime/CActorLights.hpp" #include "MetroidPrime/CActorLights.hpp"
#include "MetroidPrime/CModelData.hpp"
#include "MetroidPrime/Player/CFidget.hpp" #include "MetroidPrime/Player/CFidget.hpp"
#include "MetroidPrime/Player/CPlayerCameraBob.hpp" #include "MetroidPrime/Player/CPlayerCameraBob.hpp"
#include "MetroidPrime/Player/CPlayerState.hpp"
#include "Kyoto/Audio/CSfxHandle.hpp" #include "Kyoto/Audio/CSfxHandle.hpp"
#include "Kyoto/Math/CAABox.hpp" #include "Kyoto/Math/CAABox.hpp"
@ -16,6 +18,8 @@
#include "rstl/single_ptr.hpp" #include "rstl/single_ptr.hpp"
#include "rstl/vector.hpp" #include "rstl/vector.hpp"
#include "math.h"
enum EChargeState { enum EChargeState {
kCS_Normal, kCS_Normal,
kCS_Charged, kCS_Charged,
@ -33,6 +37,7 @@ class CPlasmaBeam;
class CPhazonBeam; class CPhazonBeam;
class CElementGen; class CElementGen;
class CWorldShadow; class CWorldShadow;
class CGenDescription;
class CPlayerGun { class CPlayerGun {
static float skTractorBeamFactor; static float skTractorBeamFactor;
@ -85,6 +90,8 @@ public:
kIS_Four, kIS_Four,
}; };
CPlayerGun(TUniqueId);
bool IsCharging() const { return x834_24_charging; } bool IsCharging() const { return x834_24_charging; }
float GetChargeBeamFactor() const { return x834_24_charging ? x340_chargeBeamFactor : 0.f; } float GetChargeBeamFactor() const { return x834_24_charging ? x340_chargeBeamFactor : 0.f; }

View File

@ -1 +1,111 @@
#include "MetroidPrime/Player/CPlayerGun.hpp" #include "MetroidPrime/Player/CPlayerGun.hpp"
#include "MetroidPrime/CAnimRes.hpp"
#include "MetroidPrime/Tweaks/CTweakPlayerGun.hpp"
#include "MetroidPrime/Tweaks/CTweakGunRes.hpp"
CPlayerGun::CPlayerGun(TUniqueId uid)
: x0_lights(8, CVector3f::Zero(), 4, 4, false, false, false, 0.1)
, x2ec_lastFireButtonStates(0)
, x2f0_pressedFireButtonStates(0)
, x2f4_fireButtonStates(0)
, x2f8_stateFlags(0x1)
, x2fc_fidgetAnimBits(0)
, x300_remainingMissiles(0)
, x304_(0)
, x308_bombCount(3)
, x30c_rapidFireShots(0)
, x310_currentBeam(CPlayerState::kBI_Power)
, x314_nextBeam(CPlayerState::kBI_Power)
, x318_comboAmmoIdx(0)
, x31c_missileMode(kMM_Inactive)
, x320_currentAuxBeam(CPlayerState::kBI_Power)
, x324_idleState(kIS_Four)
, x328_animSfxPitch(0.f)
, x32c_chargePhase(kCP_NotCharging)
, x330_chargeState(kCS_Normal)
, x334_(0)
, x338_nextState(kNS_StatusQuo)
, x33c_phazonBeamState(kKBS_Inactive)
, x340_chargeBeamFactor(0.f)
, x344_comboXferTimer(0.f)
, x348_chargeCooldownTimer(0.f)
, x34c_shakeX(0.f)
, x350_shakeZ(0.f)
, x35c_bombTime(0.f)
, x360_(0.f)
, x364_gunStrikeCoolTimer(0.f)
, x368_idleWanderDelayTimer(0.f)
, x36c_(1.f)
, x370_gunMotionSpeedMult(1.f)
, x374_(0.f)
, x378_shotSmokeStartTimer(0.f)
, x37c_rapidFireShotsDecayTimer(0.f)
, x380_shotSmokeTimer(0.f)
, x384_gunStrikeDelayTimer(0.f)
, x388_enterFreeLookDelayTimer(0.f)
, x38c_muzzleEffectVisTimer(0.f)
, x390_cooldown(0.f)
, x394_damageTimer(0.f)
, x398_damageAmt(0.f)
, x39c_phazonMorphT(0.f)
, x3a0_missileExitTimer(0.f)
, x3dc_damageLocation(0.f, 0.f, 0.f)
, x3e8_xf(CTransform4f::Identity())
, x418_beamLocalXf(CTransform4f::Identity())
, x448_elbowWorldXf(CTransform4f::Identity())
, x478_assistAimXf(CTransform4f::Identity())
, x4a8_gunWorldXf(CTransform4f::Identity())
, x4d8_gunLocalXf(CTransform4f::Identity())
, x508_elbowLocalXf(CTransform4f::Identity())
, x538_playerId(uid)
, x53a_powerBomb(kInvalidUniqueId)
, x53c_lightId(kInvalidUniqueId)
, x550_camBob(CPlayerCameraBob::kCBT_One, CPlayerCameraBob::GetCameraBobExtent(),
CPlayerCameraBob::GetCameraBobPeriod())
, x658_(1)
, x65c_(0.f)
, x660_(0.f)
, x664_(0.f)
, x678_morph(gpTweakPlayerGun->GetGunTransformTime(), gpTweakPlayerGun->GetHoloHoldTime())
, x6c8_hologramClipCube(CVector3f(-0.29329199f, 0.f, -0.2481945f),
CVector3f(0.29329199f, 1.292392f, 0.2481945f))
, x6e0_rightHandModel(CAnimRes(gpTweakGunRes->xc_rightHand, 0, CVector3f(3.f, 3.f, 3.f), 0, true))
, x72c_currentBeam(nullptr)
, x730_outgoingBeam(nullptr)
, x734_loadingBeam(nullptr)
, x738_nextBeam(nullptr)
, x830_chargeRumbleHandle(-1)
, x832_24_coolingCharge(false)
, x832_25_chargeEffectVisible(false)
, x832_26_comboFiring(false)
, x832_27_chargeAnimStarted(false)
, x832_28_readyForShot(false)
, x832_29_lockedOn(false)
, x832_30_requestReturnToDefault(false)
, x832_31_inRestPose(true)
, x833_24_notFidgeting(true)
, x833_25_(false)
, x833_26_(false)
, x833_27_(false)
, x833_28_phazonBeamActive(false)
, x833_29_pointBlankWorldSurface(false)
, x833_30_canShowAuxMuzzleEffect(true)
, x833_31_inFreeLook(false)
, x834_24_charging(false)
, x834_25_gunMotionFidgeting(false)
, x834_26_animPlaying(false)
, x834_27_underwater(false)
, x834_28_requestImmediateRecharge(false)
, x834_29_frozen(false)
, x834_30_inBigStrike(false)
, x834_31_gunMotionInFidgetBasePosition(false)
, x835_24_canFirePhazon(false)
, x835_25_inPhazonBeam(false)
, x835_26_phazonBeamMorphing(false)
, x835_27_intoPhazonBeam(false)
, x835_28_bombReady(false)
, x835_29_powerBombReady(false)
// , x835_30_inPhazonPool(false)
// , x835_31_actorAttached(false)
{}