mirror of
https://github.com/PrimeDecomp/echoes.git
synced 2026-07-12 18:18:57 -07:00
Add CPlayerGun::Charging
This commit is contained in:
@@ -84,6 +84,10 @@ MetroidPrime/Player/CGameOptions.cpp:
|
||||
MetroidPrime/CDamageInfo.cpp:
|
||||
.text start:0x80189FD4 end:0x8018A188
|
||||
|
||||
MetroidPrime/Player/CPlayerGun.cpp:
|
||||
.text start:0x801C6DF8 end:0x801C8CE8
|
||||
.sdata2 start:0x8041D11C end:0x8041D124
|
||||
|
||||
MetroidPrime/Weapons/CPowerBeam.cpp:
|
||||
.text start:0x801D4FC8 end:0x801D5C70
|
||||
.data start:0x803B72B0 end:0x803B7310
|
||||
|
||||
@@ -7404,7 +7404,7 @@ fn_801C80F4 = .text:0x801C80F4; // type:function size:0xD4
|
||||
fn_801C81C8 = .text:0x801C81C8; // type:function size:0x4 align:4
|
||||
fn_801C81CC = .text:0x801C81CC; // type:function size:0x418 align:4
|
||||
fn_801C85E4 = .text:0x801C85E4; // type:function size:0x13C align:4
|
||||
fn_801C8720 = .text:0x801C8720; // type:function size:0x184 align:4
|
||||
Charging__10CPlayerGunFR13CStateManageri = .text:0x801C8720; // type:function size:0x184 align:4
|
||||
fn_801C88A4 = .text:0x801C88A4; // type:function size:0x9C align:4
|
||||
fn_801C8940 = .text:0x801C8940; // type:function size:0x218 align:4
|
||||
fn_801C8B58 = .text:0x801C8B58; // type:function size:0x4 align:4
|
||||
@@ -7424,7 +7424,7 @@ fn_801C903C = .text:0x801C903C; // type:function size:0x48 align:4
|
||||
fn_801C9084 = .text:0x801C9084; // type:function size:0x8 align:4
|
||||
fn_801C908C = .text:0x801C908C; // type:function size:0x18C align:4
|
||||
fn_801C9218 = .text:0x801C9218; // type:function size:0xD0 align:4
|
||||
fn_801C92E8 = .text:0x801C92E8; // type:function size:0x12C
|
||||
IsOutOfAmmoToShoot__10CPlayerGunCFR13CStateManager = .text:0x801C92E8; // type:function size:0x12C
|
||||
fn_801C9414 = .text:0x801C9414; // type:function size:0x14 align:4
|
||||
fn_801C9428 = .text:0x801C9428; // type:function size:0x10 align:4
|
||||
fn_801C9438 = .text:0x801C9438; // type:function size:0x88 align:4
|
||||
@@ -7455,8 +7455,8 @@ fn_801CAA24 = .text:0x801CAA24; // type:function size:0x13C align:4
|
||||
fn_801CAB60 = .text:0x801CAB60; // type:function size:0x208 align:4
|
||||
fn_801CAD68 = .text:0x801CAD68; // type:function size:0x120
|
||||
fn_801CAE88 = .text:0x801CAE88; // type:function size:0x184 align:4
|
||||
fn_801CB00C = .text:0x801CB00C; // type:function size:0x13C
|
||||
fn_801CB148 = .text:0x801CB148; // type:function size:0x1F8
|
||||
StopChargeSound__10CPlayerGunFR13CStateManagerb = .text:0x801CB00C; // type:function size:0x13C
|
||||
ResetCharge__10CPlayerGunFR13CStateManagerb = .text:0x801CB148; // type:function size:0x1F8
|
||||
fn_801CB340 = .text:0x801CB340; // type:function size:0x4 align:4
|
||||
fn_801CB344 = .text:0x801CB344; // type:function size:0xB0
|
||||
fn_801CB3F4 = .text:0x801CB3F4; // type:function size:0x5B8
|
||||
@@ -7466,7 +7466,7 @@ fn_801CBC10 = .text:0x801CBC10; // type:function size:0x48
|
||||
fn_801CBC58 = .text:0x801CBC58; // type:function size:0x7C
|
||||
fn_801CBCD4 = .text:0x801CBCD4; // type:function size:0x68
|
||||
fn_801CBD3C = .text:0x801CBD3C; // type:function size:0x310 align:4
|
||||
fn_801CC04C = .text:0x801CC04C; // type:function size:0x154
|
||||
PlayAnim__10CPlayerGunFR13CStateManagerii = .text:0x801CC04C; // type:function size:0x154
|
||||
fn_801CC1A0 = .text:0x801CC1A0; // type:function size:0x4F8 align:4
|
||||
fn_801CC698 = .text:0x801CC698; // type:function size:0x618 align:4
|
||||
fn_801CCCB0 = .text:0x801CCCB0; // type:function size:0x16C
|
||||
@@ -7475,7 +7475,7 @@ fn_801CCEF4 = .text:0x801CCEF4; // type:function size:0x1B8 align:4
|
||||
fn_801CD0AC = .text:0x801CD0AC; // type:function size:0x38C
|
||||
fn_801CD438 = .text:0x801CD438; // type:function size:0x124
|
||||
fn_801CD55C = .text:0x801CD55C; // type:function size:0x4BC
|
||||
fn_801CDA18 = .text:0x801CDA18; // type:function size:0x288
|
||||
EnableChargeFx__10CPlayerGunFR13CStateManagerb = .text:0x801CDA18; // type:function size:0x288
|
||||
fn_801CDCA0 = .text:0x801CDCA0; // type:function size:0x88 align:4
|
||||
fn_801CDD28 = .text:0x801CDD28; // type:function size:0xF8 align:4
|
||||
fn_801CDE20 = .text:0x801CDE20; // type:function size:0x4 align:4
|
||||
@@ -7700,7 +7700,7 @@ fn_801DD6CC = .text:0x801DD6CC; // type:function size:0x30
|
||||
fn_801DD6FC = .text:0x801DD6FC; // type:function size:0x18 align:4
|
||||
fn_801DD714 = .text:0x801DD714; // type:function size:0x10 align:4
|
||||
fn_801DD724 = .text:0x801DD724; // type:function size:0x34
|
||||
fn_801DD758 = .text:0x801DD758; // type:function size:0x34
|
||||
GetPlayer__10CPlayerGunCFR13CStateManager = .text:0x801DD758; // type:function size:0x34
|
||||
fn_801DD78C = .text:0x801DD78C; // type:function size:0x320
|
||||
fn_801DDAAC = .text:0x801DDAAC; // type:function size:0x310 align:4
|
||||
fn_801DDDBC = .text:0x801DDDBC; // type:function size:0x58
|
||||
@@ -20398,7 +20398,7 @@ lbl_804192B4 = .sbss:0x804192B4; // type:object size:0x4 data:4byte
|
||||
lbl_804192B8 = .sbss:0x804192B8; // type:object size:0x4 data:4byte
|
||||
lbl_804192BC = .sbss:0x804192BC; // type:object size:0x4 data:4byte
|
||||
lbl_804192C0 = .sbss:0x804192C0; // type:object size:0x4 align:4 data:float
|
||||
lbl_804192C4 = .sbss:0x804192C4; // type:object size:0x4 align:4 data:float
|
||||
kFactorMultiplierForBeamCombo = .sbss:0x804192C4; // type:object size:0x4 align:4 data:float
|
||||
lbl_804192C8 = .sbss:0x804192C8; // type:object size:0x4 align:4 data:float
|
||||
lbl_804192CC = .sbss:0x804192CC; // type:object size:0x4 data:4byte
|
||||
lbl_804192D0 = .sbss:0x804192D0; // type:object size:0x8 data:4byte
|
||||
|
||||
@@ -329,6 +329,7 @@ config.libs = [
|
||||
Object(NonMatching, "MetroidPrime/CStateManager.cpp"),
|
||||
Object(NonMatching, "MetroidPrime/CEntity.cpp"),
|
||||
Object(NonMatching, "MetroidPrime/Player/CPlayerState.cpp"),
|
||||
Object(NonMatching, "MetroidPrime/Player/CPlayerGun.cpp"),
|
||||
Object(NonMatching, "MetroidPrime/ScriptObjects/CScriptPickup.cpp"),
|
||||
Object(Matching, "MetroidPrime/HUD/CHUDMemoParms.cpp"),
|
||||
Object(NonMatching, "MetroidPrime/ScriptObjects/CScriptHUDMemo.cpp"),
|
||||
|
||||
@@ -169,9 +169,9 @@ private:
|
||||
int x3d8_unk; // 0x3d8
|
||||
TUniqueId m_orbitNextTargetId; // 0x3dc
|
||||
float x3e0_unk; // 0x3e0
|
||||
rstl::vector< TUniqueId > m_nearbyOrbitObjects; // 0x3e4
|
||||
rstl::vector< TUniqueId > m_onScreenOrbitObjects; // 0x468
|
||||
rstl::vector< TUniqueId > m_offScreenOrbitObjects; // 0x4ec
|
||||
rstl::reserved_vector< TUniqueId, 64 > m_nearbyOrbitObjects; // 0x3e4
|
||||
rstl::reserved_vector< TUniqueId, 64 > m_onScreenOrbitObjects; // 0x468
|
||||
rstl::reserved_vector< TUniqueId, 64 > m_offScreenOrbitObjects; // 0x4ec
|
||||
bool m_orbitLockEstablished; // 0x570
|
||||
float m_orbitPreventionTimer; // 0x574
|
||||
bool m_sidewaysDashing; // 0x578
|
||||
@@ -233,11 +233,11 @@ private:
|
||||
short xeca_unk; // 0xeca
|
||||
CColor xecc_unk; // 0xecc
|
||||
int xed0_unk; // 0xed0
|
||||
UnkStructA* xed4_unk; // 0xed4
|
||||
UnkStructA* xed4_unk; // 0xed4
|
||||
void* xed8_unk; // 0xed8
|
||||
UnkStructB xedc_unk; // 0xedc
|
||||
int xf6c_unk; // 0xf6c
|
||||
UnkStructC* xf70_unk; // 0xf70
|
||||
UnkStructC* xf70_unk; // 0xf70
|
||||
TReservedAverage< float, 20 > m_moveSpeedAvg; // 0xf74
|
||||
float m_moveSpeed; // 0xfc8
|
||||
float m_flatMoveSpeed; // 0xfcc
|
||||
@@ -249,7 +249,9 @@ private:
|
||||
char m_pad_5[0x18]; // 0x12fc
|
||||
CPlayerState* m_playerState; // 0x1314
|
||||
CCameraManager* m_cameraManager; // 0x1318
|
||||
char m_pad_6[0x1A8]; // 0x1320
|
||||
};
|
||||
CHECK_SIZEOF(CPlayer, 0x14c8)
|
||||
// size: 0x14c8
|
||||
|
||||
#endif // _CPLAYER
|
||||
|
||||
@@ -3,13 +3,54 @@
|
||||
|
||||
#include "MetroidPrime//TGameTypes.hpp"
|
||||
|
||||
class CStateManager;
|
||||
class CPlayer;
|
||||
|
||||
enum EChargeState {
|
||||
kCS_Normal,
|
||||
kCS_Charged,
|
||||
};
|
||||
|
||||
class CPlayerGun {
|
||||
public:
|
||||
enum EChargePhase {
|
||||
kCP_NotCharging,
|
||||
kCP_Phase_1,
|
||||
kCP_Phase_2,
|
||||
kCP_Phase_3,
|
||||
kCP_AnimAndSfx,
|
||||
kCP_Phase_5,
|
||||
};
|
||||
|
||||
CPlayerGun(TUniqueId, int);
|
||||
~CPlayerGun();
|
||||
|
||||
CPlayer* GetPlayer(CStateManager& mgr) const;
|
||||
|
||||
void PlayAnim(CStateManager&, int animType, int loop);
|
||||
|
||||
bool IsOutOfAmmoToShoot(CStateManager&) const;
|
||||
void ResetCharge(CStateManager&, bool);
|
||||
void StopChargeSound(CStateManager&, bool);
|
||||
void EnableChargeFx(CStateManager&, bool);
|
||||
|
||||
|
||||
void Charging(CStateManager&, int);
|
||||
|
||||
private:
|
||||
char m_pad[0x814];
|
||||
char m_pad0[0x3a4]; // 0x000
|
||||
EChargeState m_chargeState; // 0x3a4
|
||||
char m_pad1[0x2EC]; // 0x3a8
|
||||
EChargePhase m_chargePhase; // 0x694
|
||||
char m_pad2[0xD8]; // 0x698
|
||||
int m_0x770;
|
||||
char m_pad3[0x9C]; // 0x774
|
||||
uint m_0x810_b0 : 1;
|
||||
uint m_0x810_b1 : 1;
|
||||
uint m_0x810_b2 : 1;
|
||||
uint m_0x810_b3 : 1;
|
||||
uint m_0x810_b4 : 1;
|
||||
uint m_0x810_b5 : 1;
|
||||
};
|
||||
CHECK_SIZEOF(CPlayerGun, 0x814)
|
||||
|
||||
|
||||
@@ -296,6 +296,7 @@ public:
|
||||
|
||||
void fn_80084B6C();
|
||||
void fn_80084928(const UnknownPlayerStateStruct&);
|
||||
float GetChargeBeamFactor() const { return chargeBeamFactor; }
|
||||
void IncrementChargeBeamFactor(float);
|
||||
void DecrementAmmoAndDisplayAlertIfOut(const CStateManager&, EItemType, int quantity);
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
#include "MetroidPrime/Player/CPlayer.hpp"
|
||||
#include "MetroidPrime/Player/CPlayerGun.hpp"
|
||||
#include "MetroidPrime/Player/CPlayerState.hpp"
|
||||
|
||||
static const float kFactorMultiplierForBeamCombo = 1.0f / CPlayerState::GetMissileComboChargeFactor();
|
||||
|
||||
void CPlayerGun::Charging(CStateManager& mgr, int param) {
|
||||
switch (param) {
|
||||
case 0:
|
||||
PlayAnim(mgr, 1, 0);
|
||||
StopChargeSound(mgr, true);
|
||||
break;
|
||||
|
||||
case 1: {
|
||||
CPlayerState* playerState = GetPlayer(mgr)->GetPlayerState();
|
||||
float factor = IsOutOfAmmoToShoot(mgr) ? 0.5f : 1.f;
|
||||
switch (m_chargePhase) {
|
||||
case kCP_Phase_2:
|
||||
if (playerState->GetChargeBeamFactor() >= kFactorMultiplierForBeamCombo * factor) {
|
||||
m_0x810_b5 = true;
|
||||
m_chargePhase = kCP_Phase_3;
|
||||
m_chargeState = kCS_Charged;
|
||||
EnableChargeFx(mgr, true);
|
||||
PlayAnim(mgr, 2, 1);
|
||||
}
|
||||
break;
|
||||
case kCP_Phase_3:
|
||||
if (playerState->GetChargeBeamFactor() >= factor) {
|
||||
m_chargePhase = kCP_AnimAndSfx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
if (m_0x810_b3) {
|
||||
ResetCharge(mgr, false);
|
||||
if (m_0x770 == 0) {
|
||||
PlayAnim(mgr, 0, 0);
|
||||
} else {
|
||||
m_0x810_b2 = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user