mirror of https://github.com/PrimeDecomp/prime.git
parent
79c62af420
commit
2561d8cd5f
|
@ -278,7 +278,7 @@ LIBS = [
|
|||
"MetroidPrime/PathFinding/CPathFindArea",
|
||||
["MetroidPrime/Weapons/GunController/CGunController", False],
|
||||
["MetroidPrime/Weapons/GunController/CGSFreeLook", False],
|
||||
"MetroidPrime/Weapons/GunController/CGSComboFire",
|
||||
["MetroidPrime/Weapons/GunController/CGSComboFire", True],
|
||||
["MetroidPrime/HUD/CHudBallInterface", False],
|
||||
"MetroidPrime/Tweaks/CTweakGuiColors",
|
||||
"MetroidPrime/ScriptObjects/CFishCloud",
|
||||
|
@ -301,7 +301,7 @@ LIBS = [
|
|||
["MetroidPrime/ScriptObjects/CScriptAiJumpPoint", True],
|
||||
"MetroidPrime/CMessageScreen",
|
||||
"MetroidPrime/Enemies/CFlaahgraTentacle",
|
||||
"MetroidPrime/Weapons/GunController/CGSFidget",
|
||||
["MetroidPrime/Weapons/GunController/CGSFidget", False],
|
||||
["MetroidPrime/BodyState/CABSReaction", True],
|
||||
"MetroidPrime/Weapons/CIceProjectile",
|
||||
"MetroidPrime/Enemies/CFlyingPirate",
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef _CGSCOMBOFIRE
|
||||
#define _CGSCOMBOFIRE
|
||||
|
||||
class CAnimData;
|
||||
class CStateManager;
|
||||
class CGSComboFire {
|
||||
public:
|
||||
CGSComboFire();
|
||||
|
||||
bool IsComboOver() const { return x10_24_over; }
|
||||
int GetLoopState() const { return x4_loopState; }
|
||||
void SetLoopState(int l) { x4_loopState = l; }
|
||||
void SetIdle(bool i) { x10_25_idle = i; }
|
||||
int GetGunId() const { return xc_gunId; }
|
||||
bool Update(CAnimData& data, float dt, CStateManager& mgr);
|
||||
int SetAnim(CAnimData& data, int gunId, int loopState, CStateManager& mgr, float delay);
|
||||
|
||||
private:
|
||||
float x0_delay;
|
||||
int x4_loopState; // In, loop, out
|
||||
int x8_cueAnimId;
|
||||
int xc_gunId;
|
||||
bool x10_24_over : 1;
|
||||
bool x10_25_idle : 1;
|
||||
};
|
||||
|
||||
#endif // _CGSCOMBOFIRE
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef _CGSFIDGET
|
||||
#define _CGSFIDGET
|
||||
|
||||
#include "rstl/vector.hpp"
|
||||
|
||||
class CAnimData;
|
||||
class CStateManager;
|
||||
class CToken;
|
||||
|
||||
class CGSFidget {
|
||||
public:
|
||||
CGSFidget();
|
||||
|
||||
bool Update(CAnimData& data, float dt, CStateManager& mgr);
|
||||
int SetAnim(CAnimData& data, int type, int gunId, int animSet, CStateManager& mgr);
|
||||
void LoadAnimAsync(CAnimData& data, int type, int gunId, int animSet, CStateManager& mgr);
|
||||
void UnLoadAnim();
|
||||
bool IsAnimLoaded() const;
|
||||
|
||||
private:
|
||||
rstl::vector< CToken > x0_anims;
|
||||
int x10_;
|
||||
int x14_gunId;
|
||||
int x18_animSet;
|
||||
};
|
||||
|
||||
#endif // _CGSFIDGET
|
|
@ -243,7 +243,7 @@ METROIDPRIME :=\
|
|||
$(BUILD_DIR)/asm/MetroidPrime/PathFinding/CPathFindArea.o\
|
||||
$(BUILD_DIR)/asm/MetroidPrime/Weapons/GunController/CGunController.o\
|
||||
$(BUILD_DIR)/asm/MetroidPrime/Weapons/GunController/CGSFreeLook.o\
|
||||
$(BUILD_DIR)/asm/MetroidPrime/Weapons/GunController/CGSComboFire.o\
|
||||
$(BUILD_DIR)/src/MetroidPrime/Weapons/GunController/CGSComboFire.o\
|
||||
$(BUILD_DIR)/asm/MetroidPrime/HUD/CHudBallInterface.o\
|
||||
$(BUILD_DIR)/asm/MetroidPrime/Tweaks/CTweakGuiColors.o\
|
||||
$(BUILD_DIR)/asm/MetroidPrime/ScriptObjects/CFishCloud.o\
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
#include "MetroidPrime/Weapons/GunController/CGSComboFire.hpp"
|
||||
|
||||
#include "MetroidPrime/CAnimData.hpp"
|
||||
#include "MetroidPrime/CAnimPlaybackParms.hpp"
|
||||
#include "MetroidPrime/CStateManager.hpp"
|
||||
|
||||
#include "Kyoto/Animation/CPASAnimParmData.hpp"
|
||||
|
||||
CGSComboFire::CGSComboFire()
|
||||
: x0_delay(0.f)
|
||||
, x4_loopState(-1)
|
||||
, x8_cueAnimId(-1)
|
||||
, xc_gunId(-1)
|
||||
, x10_24_over(false)
|
||||
, x10_25_idle(false) {}
|
||||
|
||||
bool CGSComboFire::Update(CAnimData& data, float dt, CStateManager& mgr) {
|
||||
if (x8_cueAnimId != -1) {
|
||||
x0_delay -= dt;
|
||||
if (x0_delay <= 0.f) {
|
||||
data.EnableLooping(x4_loopState == 1);
|
||||
CAnimPlaybackParms aparms(x8_cueAnimId, -1, 1.f, true);
|
||||
data.SetAnimation(aparms, false);
|
||||
x0_delay = 0.f;
|
||||
x8_cueAnimId = -1;
|
||||
}
|
||||
} else if (!data.IsAnimTimeRemaining(0.001f, rstl::string_l("Whole Body"))) {
|
||||
switch (x4_loopState) {
|
||||
case 0:
|
||||
SetAnim(data, xc_gunId, 1, mgr, 0.f);
|
||||
switch (xc_gunId) {
|
||||
case 4:
|
||||
case 0:
|
||||
case 1:
|
||||
x10_24_over = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
x4_loopState = -1;
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int CGSComboFire::SetAnim(CAnimData& data, int gunId, int loopState, CStateManager& mgr,
|
||||
float delay) {
|
||||
int useLoopState = !x10_25_idle ? loopState : 2;
|
||||
x10_25_idle = false;
|
||||
|
||||
const CPASDatabase& pas = data.GetCharacterInfo().GetPASDatabase();
|
||||
|
||||
rstl::pair< float, int > anim =
|
||||
pas.FindBestAnimation(CPASAnimParmData(pas::kAS_Death, CPASAnimParm::FromInt32(gunId),
|
||||
CPASAnimParm::FromEnum(useLoopState)),
|
||||
*mgr.Random(), -1);
|
||||
x10_24_over = false;
|
||||
xc_gunId = gunId;
|
||||
x4_loopState = useLoopState;
|
||||
if (delay != 0.f) {
|
||||
x0_delay = delay;
|
||||
x8_cueAnimId = anim.second;
|
||||
} else {
|
||||
data.EnableLooping(useLoopState == 1);
|
||||
CAnimPlaybackParms aparms(anim.second, -1, 1.f, true);
|
||||
data.SetAnimation(aparms, false);
|
||||
}
|
||||
return anim.second;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
#include "MetroidPrime/Weapons/GunController/CGSFidget.hpp"
|
||||
|
||||
#include "Kyoto/CToken.hpp"
|
||||
|
||||
CGSFidget::CGSFidget() : x10_(-1), x14_gunId(-1), x18_animSet(-1) {}
|
Loading…
Reference in New Issue