Match and link CScriptBeam

This commit is contained in:
Henrique Gemignani Passos Lima
2022-11-01 01:46:20 +02:00
parent f1d4bb10f0
commit b19380ffb4
14 changed files with 251 additions and 20 deletions

View File

@@ -0,0 +1,26 @@
#ifndef _CSCRIPTBEAM
#define _CSCRIPTBEAM
#include "MetroidPrime/CActor.hpp"
#include "MetroidPrime/CDamageInfo.hpp"
#include "MetroidPrime/Weapons/CBeamInfo.hpp"
class CWeaponDescription;
class CScriptBeam : public CActor {
TLockedToken< CWeaponDescription > xe8_weaponDescription;
CBeamInfo xf4_beamInfo;
CDamageInfo x138_damageInfo;
TUniqueId x154_projectileId;
public:
CScriptBeam(TUniqueId, const rstl::string&, const CEntityInfo&, const CTransform4f&, bool,
const TToken< CWeaponDescription >&, const CBeamInfo&, const CDamageInfo&);
~CScriptBeam();
void Accept(IVisitor& visitor) override;
void Think(float, CStateManager&) override;
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) override;
};
#endif // _CSCRIPTBEAM

View File

@@ -0,0 +1,37 @@
#ifndef _CBEAMINFO
#define _CBEAMINFO
#include "MetroidPrime/TGameTypes.hpp"
#include "Kyoto/SObjectTag.hpp"
#include "Kyoto/Graphics/CColor.hpp"
class CBeamInfo {
private:
uint x0_;
/*
* 0x1: motion blur
* 0x2: pulse effect
* 0x4: one shot
* 0x8: phazon damage
*/
int x4_beamAttributes;
CAssetId x8_contactFxId;
CAssetId xc_pulseFxId;
CAssetId x10_textureId;
CAssetId x14_glowTextureId;
int x18_length;
float x1c_radius;
float x20_expansionSpeed;
float x24_lifeTime;
float x28_pulseSpeed;
float x2c_shutdownTime;
float x30_contactFxScale;
float x34_pulseFxScale;
float x38_travelSpeed;
CColor x3c_innerColor;
CColor x40_outerColor;
};
#endif // _CBEAMINFO

View File

@@ -0,0 +1,98 @@
#ifndef _CPLASMAPROJECTILE
#define _CPLASMAPROJECTILE
#include "MetroidPrime/Weapons/CBeamProjectile.hpp"
class CElectricDescription;
class CPlasmaProjectile : public CBeamProjectile {
public:
enum EExpansionState { kES_Inactive, kES_Attack, kES_Sustain, kES_Release, kES_Done };
struct PlayerEffectResources {
int count;
CAssetId data[8];
PlayerEffectResources(CAssetId a = kInvalidAssetId, CAssetId b = kInvalidAssetId,
CAssetId c = kInvalidAssetId, CAssetId d = kInvalidAssetId,
CAssetId e = kInvalidAssetId, CAssetId f = kInvalidAssetId,
CAssetId g = kInvalidAssetId, CAssetId h = kInvalidAssetId)
: count(8)
{
data[0] = a;
data[1] = b;
data[2] = c;
data[3] = d;
data[4] = e;
data[5] = f;
data[6] = g;
data[7] = h;
}
};
CPlasmaProjectile(const TToken< CWeaponDescription >& wDesc, const rstl::string& name,
EWeaponType wType, const CBeamInfo& bInfo, const CTransform4f& xf,
EMaterialTypes matType, const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid,
TUniqueId owner,
const PlayerEffectResources& res, bool growingBeam, EProjectileAttrib attribs);
void Accept(IVisitor& visitor) override;
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) override;
void ResetBeam(CStateManager& mgr, bool fullReset) override;
void UpdateFx(const CTransform4f& xf, float dt, CStateManager& mgr) override;
void Fire(const CTransform4f& xf, CStateManager& mgr, bool b) override;
void Touch(CActor& other, CStateManager& mgr) override;
bool CanRenderUnsorted(const CStateManager& mgr) const override;
void AddToRenderer(const CFrustumPlanes& frustum, CStateManager& mgr) override;
void Render(CStateManager& mgr) override;
CColor GetInnerColor() const { return x490_innerColor; }
CColor GetOuterColor() const { return x494_outerColor; }
bool IsFiring() const { return x548_26_firing; }
private:
rstl::vector< TUniqueId > x468_lights;
int x478_beamAttributes;
float x47c_lifeTime;
float x480_pulseSpeed;
float x484_shutdownTime;
float x488_expansionSpeed;
float x48c_;
CColor x490_innerColor;
CColor x494_outerColor;
CDamageInfo x498_phazonDamage;
EExpansionState x4b4_expansionState;
float x4b8_beamWidth;
float x4bc_lifeTimer;
float x4c0_expansionT;
float x4c4_expansion;
float x4c8_beamAngle;
float x4cc_energyPulseStartY;
float x4d0_shutdownTimer;
float x4d4_contactPulseTimer;
float x4d8_energyPulseTimer;
float x4dc_playerEffectPulseTimer;
float x4e0_playerDamageDuration;
float x4e4_playerDamageTimer;
TLockedToken< CTexture > x4e8_texture;
TLockedToken< CTexture > x4f4_glowTexture;
TCachedToken< CGenDescription > x500_contactFxDesc;
TCachedToken< CGenDescription > x50c_pulseFxDesc;
rstl::single_ptr< CElementGen > x518_contactGen;
rstl::single_ptr< CElementGen > x51c_pulseGen;
rstl::single_ptr< CElementGen > x520_weaponGen;
CAssetId x524_freezeSteamTxtr;
CAssetId x528_freezeIceTxtr;
rstl::optional_object< TToken< CElectricDescription > > x52c_visorElectric;
rstl::optional_object< TToken< CGenDescription > > x538_visorParticle;
u16 x544_freezeSfx;
u16 x546_electricSfx;
bool x548_24_ : 1;
bool x548_25_enableEnergyPulse : 1;
bool x548_26_firing : 1;
bool x548_27_texturesLoaded : 1;
bool x548_28_drawOwnerFirst : 1;
bool x548_29_activePlayerPhazon : 1;
};
#endif // _CPLASMAPROJECTILE