Match and link CFire, minor fixes

This commit is contained in:
Phillip Stephens 2024-12-23 23:18:15 -08:00
parent 1ec5a25fa6
commit 82901862fa
20 changed files with 198 additions and 82 deletions

View File

@ -158,7 +158,7 @@ MetroidPrime/Tweaks/CTweakGame.cpp:
.text start:0x800371E4 end:0x80037400
.data start:0x803D9CD0 end:0x803D9CE0
MetroidPrime/CGameProjectile.cpp:
MetroidPrime/Weapons/CGameProjectile.cpp:
.text start:0x80037400 end:0x8003A7A4
.rodata start:0x803CCE20 end:0x803CCE38
.data start:0x803D9CE0 end:0x803D9D50

View File

@ -10777,7 +10777,7 @@ __ct__7CPufferF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rs
AcceptScriptMsg__5CFireF20EScriptObjectMessage9TUniqueIdR13CStateManager = .text:0x8025CC24; // type:function size:0x80 scope:global
Think__5CFireFfR13CStateManager = .text:0x8025CCA4; // type:function size:0x24C scope:global
Accept__5CFireFR8IVisitor = .text:0x8025CEF0; // type:function size:0x38 scope:global
Render__5CFireCFRC13CStateManager = .text:0x8025CF28; // type:function size:0xEC scope:global
AddToRenderer__5CFireCFRC14CFrustumPlanesRC13CStateManager = .text:0x8025CF28; // type:function size:0xEC scope:global
GetTouchBounds__5CFireCFv = .text:0x8025D014; // type:function size:0x68 scope:global
Touch__5CFireFR6CActorR13CStateManager = .text:0x8025D07C; // type:function size:0xC4 scope:global
__dt__5CFireFv = .text:0x8025D140; // type:function size:0x9C scope:global
@ -17543,7 +17543,7 @@ lbl_803D51F6 = .rodata:0x803D51F6; // type:object size:0xC data:string
lbl_803D5202 = .rodata:0x803D5202; // type:object size:0xC data:string
lbl_803D520E = .rodata:0x803D520E; // type:object size:0xC data:string
lbl_803D521A = .rodata:0x803D521A; // type:object size:0x16
lbl_803D5230 = .rodata:0x803D5230; // type:object size:0x10
@stringBase0 = .rodata:0x803D5230; // type:object size:0xC scope:local data:string_table
@stringBase0 = .rodata:0x803D5240; // type:object size:0x15 scope:local data:string_table
lbl_803D5258 = .rodata:0x803D5258; // type:object size:0x11 data:string
lbl_803D5269 = .rodata:0x803D5269; // type:object size:0xF
@ -18051,7 +18051,7 @@ lbl_803D9CA8 = .data:0x803D9CA8; // type:object size:0x10
__vt__12CTweakPlayer = .data:0x803D9CB8; // type:object size:0xC scope:weak
__vt__12ITweakObject = .data:0x803D9CC4; // type:object size:0xC scope:weak
__vt__10CTweakGame = .data:0x803D9CD0; // type:object size:0xC scope:global
lbl_803D9CE0 = .data:0x803D9CE0; // type:object size:0x70
__vt__15CGameProjectile = .data:0x803D9CE0; // type:object size:0x70
kVerticalAngleTable = .data:0x803D9D50; // type:object size:0xC scope:global data:float
kHorizontalAngleTable = .data:0x803D9D5C; // type:object size:0xC scope:global
kVerticalVarianceTable = .data:0x803D9D68; // type:object size:0xC scope:global
@ -18543,7 +18543,7 @@ jumptable_803E95A4 = .data:0x803E95A4; // type:object size:0xAC scope:local
skGasJetLocators = .data:0x803E9650; // type:object size:0x38 scope:global data:4byte
skGasLocators = .data:0x803E9688; // type:object size:0x38 scope:global data:4byte
__vt__7CPuffer = .data:0x803E96C0; // type:object size:0x2D0 scope:global
lbl_803E9990 = .data:0x803E9990; // type:object size:0x70
__vt__5CFire = .data:0x803E9990; // type:object size:0x6C
__vt__16CPauseScreenBlur = .data:0x803E9A00; // type:object size:0xC scope:global
lbl_803E9A10 = .data:0x803E9A10; // type:object size:0xC data:4byte
lbl_803E9A1C = .data:0x803E9A1C; // type:object size:0xC data:4byte
@ -20987,8 +20987,8 @@ lbl_805A8378 = .sdata:0x805A8378; // type:object size:0x8
lbl_805A8380 = .sdata:0x805A8380; // type:object size:0x4 data:4byte
lbl_805A8384 = .sdata:0x805A8384; // type:object size:0x4 data:4byte
lbl_805A8388 = .sdata:0x805A8388; // type:object size:0x8 data:4byte
lbl_805A8390 = .sdata:0x805A8390; // type:object size:0x4 data:4byte
lbl_805A8394 = .sdata:0x805A8394; // type:object size:0x4 data:4byte
kSolidMat = .sdata:0x805A8390; // type:object size:0x4 scope:local data:4byte
kProjectileMat = .sdata:0x805A8394; // type:object size:0x4 scope:local data:4byte
@281 = .sdata:0x805A8398; // type:object size:0x4 scope:local data:float
@286 = .sdata:0x805A839C; // type:object size:0x4 scope:local data:float
lbl_805A83A0 = .sdata:0x805A83A0; // type:object size:0x4 data:4byte
@ -25715,11 +25715,11 @@ lbl_805AD708 = .sdata2:0x805AD708; // type:object size:0x4 data:float
lbl_805AD70C = .sdata2:0x805AD70C; // type:object size:0x4 data:float
lbl_805AD710 = .sdata2:0x805AD710; // type:object size:0x4 data:float
lbl_805AD714 = .sdata2:0x805AD714; // type:object size:0x4 data:float
lbl_805AD718 = .sdata2:0x805AD718; // type:object size:0x4 data:float
lbl_805AD71C = .sdata2:0x805AD71C; // type:object size:0x4 data:float
lbl_805AD720 = .sdata2:0x805AD720; // type:object size:0x4 data:float
lbl_805AD724 = .sdata2:0x805AD724; // type:object size:0x4 data:float
lbl_805AD728 = .sdata2:0x805AD728; // type:object size:0x8 align:8 data:double
@429 = .sdata2:0x805AD718; // type:object size:0x4 scope:local data:float
@430 = .sdata2:0x805AD71C; // type:object size:0x4 scope:local data:float
@431 = .sdata2:0x805AD720; // type:object size:0x4 scope:local data:float
@432 = .sdata2:0x805AD724; // type:object size:0x4 scope:local data:float
@434 = .sdata2:0x805AD728; // type:object size:0x8 scope:local align:8 data:double
@395 = .sdata2:0x805AD730; // type:object size:0x4 scope:local data:float
@396 = .sdata2:0x805AD734; // type:object size:0x4 scope:local data:float
@454 = .sdata2:0x805AD738; // type:object size:0x4 scope:local data:float
@ -26838,8 +26838,7 @@ lbl_805AEC80 = .sdata2:0x805AEC80; // type:object size:0x8 align:8 data:double
lbl_805AEC88 = .sdata2:0x805AEC88; // type:object size:0x8 align:8 data:double
@38 = .sdata2:0x805AEC90; // type:object size:0x4 scope:local data:4byte
lbl_805AEC98 = .sdata2:0x805AEC98; // type:object size:0x8 align:8 data:double
@150 = .sdata2:0x805AECA0; // type:object size:0x4 scope:local data:4byte
lbl_805AECA4 = .sdata2:0x805AECA4; // type:object size:0x1 data:byte
@150 = .sdata2:0x805AECA0; // type:object size:0x5 scope:local data:string
lbl_805AECA8 = .sdata2:0x805AECA8; // type:object size:0x8 align:8 data:double
lbl_805AECB0 = .sdata2:0x805AECB0; // type:object size:0x8 align:8 data:double
@136 = .sdata2:0x805AECB8; // type:object size:0x8 scope:local align:8 data:double

View File

@ -154,7 +154,7 @@ MetroidPrime/Tweaks/CTweakGame.cpp:
.text start:0x80037260 end:0x8003747C
.data start:0x803D9EB0 end:0x803D9EC0
MetroidPrime/CGameProjectile.cpp:
MetroidPrime/Weapons/CGameProjectile.cpp:
.text start:0x8003747C end:0x8003A820
.rodata start:0x803CD000 end:0x803CD018
.data start:0x803D9EC0 end:0x803D9F30

View File

@ -10777,7 +10777,7 @@ __ct__7CPufferF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rs
AcceptScriptMsg__5CFireF20EScriptObjectMessage9TUniqueIdR13CStateManager = .text:0x8025CCA0; // type:function size:0x80 scope:global
Think__5CFireFfR13CStateManager = .text:0x8025CD20; // type:function size:0x24C scope:global
Accept__5CFireFR8IVisitor = .text:0x8025CF6C; // type:function size:0x38 scope:global
Render__5CFireCFRC13CStateManager = .text:0x8025CFA4; // type:function size:0xEC scope:global
AddToRenderer__5CFireCFRC14CFrustumPlanesRC13CStateManager = .text:0x8025CFA4; // type:function size:0xEC scope:global
GetTouchBounds__5CFireCFv = .text:0x8025D090; // type:function size:0x68 scope:global
Touch__5CFireFR6CActorR13CStateManager = .text:0x8025D0F8; // type:function size:0xC4 scope:global
__dt__5CFireFv = .text:0x8025D1BC; // type:function size:0x9C scope:global
@ -17581,7 +17581,7 @@ lbl_803D53D6 = .rodata:0x803D53D6; // type:object size:0xC data:string
lbl_803D53E2 = .rodata:0x803D53E2; // type:object size:0xC data:string
lbl_803D53EE = .rodata:0x803D53EE; // type:object size:0xC data:string
lbl_803D53FA = .rodata:0x803D53FA; // type:object size:0x16
lbl_803D5410 = .rodata:0x803D5410; // type:object size:0x10
@stringBase0 = .rodata:0x803D5410; // type:object size:0xC scope:local data:string_table
lbl_803D5420 = .rodata:0x803D5420; // type:object size:0x18
lbl_803D5438 = .rodata:0x803D5438; // type:object size:0x11 data:string
lbl_803D5449 = .rodata:0x803D5449; // type:object size:0xF
@ -18578,7 +18578,7 @@ jumptable_803E9784 = .data:0x803E9784; // type:object size:0xAC scope:local
lbl_803E9830 = .data:0x803E9830; // type:object size:0x38 data:4byte
lbl_803E9868 = .data:0x803E9868; // type:object size:0x38 data:4byte
lbl_803E98A0 = .data:0x803E98A0; // type:object size:0x2D0
lbl_803E9B70 = .data:0x803E9B70; // type:object size:0x70
__vt__5CFire = .data:0x803E9B70; // type:object size:0x6C scope:local
__vt__16CPauseScreenBlur = .data:0x803E9BE0; // type:object size:0x10
lbl_803E9BF0 = .data:0x803E9BF0; // type:object size:0xC data:4byte
lbl_803E9BFC = .data:0x803E9BFC; // type:object size:0xC data:4byte
@ -20891,8 +20891,8 @@ lbl_805A8558 = .sdata:0x805A8558; // type:object size:0x8
lbl_805A8560 = .sdata:0x805A8560; // type:object size:0x4 data:4byte
lbl_805A8564 = .sdata:0x805A8564; // type:object size:0x4 data:4byte
lbl_805A8568 = .sdata:0x805A8568; // type:object size:0x8 data:4byte
lbl_805A8570 = .sdata:0x805A8570; // type:object size:0x4 data:4byte
lbl_805A8574 = .sdata:0x805A8574; // type:object size:0x4 data:4byte
kSolidMat = .sdata:0x805A8570; // type:object size:0x4 scope:local data:4byte
kProjectileMat = .sdata:0x805A8574; // type:object size:0x4 scope:local data:4byte
lbl_805A8578 = .sdata:0x805A8578; // type:object size:0x4 data:float
lbl_805A857C = .sdata:0x805A857C; // type:object size:0x4 data:float
lbl_805A8580 = .sdata:0x805A8580; // type:object size:0x4 data:4byte
@ -25618,11 +25618,11 @@ lbl_805AD8E8 = .sdata2:0x805AD8E8; // type:object size:0x4 data:float
lbl_805AD8EC = .sdata2:0x805AD8EC; // type:object size:0x4 data:float
lbl_805AD8F0 = .sdata2:0x805AD8F0; // type:object size:0x4 data:float
lbl_805AD8F4 = .sdata2:0x805AD8F4; // type:object size:0x4 data:float
lbl_805AD8F8 = .sdata2:0x805AD8F8; // type:object size:0x4 data:float
lbl_805AD8FC = .sdata2:0x805AD8FC; // type:object size:0x4 data:float
lbl_805AD900 = .sdata2:0x805AD900; // type:object size:0x4 data:float
lbl_805AD904 = .sdata2:0x805AD904; // type:object size:0x4 data:float
lbl_805AD908 = .sdata2:0x805AD908; // type:object size:0x8 data:double
@429 = .sdata2:0x805AD8F8; // type:object size:0x4 scope:local data:float
@430 = .sdata2:0x805AD8FC; // type:object size:0x4 scope:local data:float
@431 = .sdata2:0x805AD900; // type:object size:0x4 scope:local data:float
@432 = .sdata2:0x805AD904; // type:object size:0x4 scope:local data:float
@434 = .sdata2:0x805AD908; // type:object size:0x8 scope:local data:double
lbl_805AD910 = .sdata2:0x805AD910; // type:object size:0x4 data:float
lbl_805AD914 = .sdata2:0x805AD914; // type:object size:0x4 data:float
lbl_805AD918 = .sdata2:0x805AD918; // type:object size:0x4 data:float

View File

@ -411,7 +411,7 @@ config.libs = [
Object(MatchingFor("GM8E01_00", "GM8E01_01"), "MetroidPrime/Tweaks/CTweakPlayer.cpp"),
Object(NonMatching, "MetroidPrime/Tweaks/CTweaks.cpp"),
Object(MatchingFor("GM8E01_00", "GM8E01_01"), "MetroidPrime/Tweaks/CTweakGame.cpp"),
Object(NonMatching, "MetroidPrime/CGameProjectile.cpp"),
Object(NonMatching, "MetroidPrime/Weapons/CGameProjectile.cpp"),
Object(NonMatching, "MetroidPrime/Player/CPlayerGun.cpp"),
Object(NonMatching, "MetroidPrime/CStateManager.cpp"),
Object(MatchingFor("GM8E01_00", "GM8E01_01"), "MetroidPrime/CEntity.cpp"),
@ -729,7 +729,7 @@ config.libs = [
Object(NonMatching, "MetroidPrime/Weapons/CElectricBeamProjectile.cpp"),
Object(NonMatching, "MetroidPrime/Enemies/CRidley.cpp"),
Object(NonMatching, "MetroidPrime/Enemies/CPuffer.cpp"),
Object(NonMatching, "MetroidPrime/ScriptObjects/CFire.cpp"),
Object(MatchingFor("GM8E01_00", "GM8E01_01"), "MetroidPrime/ScriptObjects/CFire.cpp"),
Object(MatchingFor("GM8E01_00", "GM8E01_01"), "MetroidPrime/CPauseScreenBlur.cpp"),
Object(NonMatching, "MetroidPrime/Enemies/CTryclops.cpp"),
Object(NonMatching, "MetroidPrime/Weapons/CNewFlameThrower.cpp"),

View File

@ -16,8 +16,8 @@ class CFinalInput {
public:
CFinalInput();
CFinalInput(int channel, float dt, const CControllerGamepadData& data, float leftDif,
float rightDiv);
CFinalInput(const int channel, const float dt, const CControllerGamepadData& data, const float leftDiv,
const float rightDiv);
CFinalInput(int channel, float dt, const COsContext& context);
CFinalInput(const CFinalInput& other)
: x0_dt(other.x0_dt)

View File

@ -35,7 +35,8 @@ public:
};
CAABox(const CVector3f& min, const CVector3f& max);
CAABox(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
CAABox(const float minX, const float minY, const float minZ, const float maxX, const float maxY,
const float maxZ)
: min(minX, minY, minZ), max(maxX, maxY, maxZ) {}
CAABox(CInputStream& in);
// CAABox(const CAABox& other)

View File

@ -74,12 +74,13 @@ public:
virtual void DestroyParticles() override;
virtual void AddModifier(CWarp*) override;
virtual uint Get4CharId() const override;
int GetMaxParticles() const { return x90_MAXP; }
int GetEmitterTime() const;
int GetSystemCount();
int GetCumulativeParticleCount() const { return x260_cumulativeParticles; }
bool IsIndirectTextured() const; // { return x28_loadedGenDesc->x54_x40_TEXR && x28_loadedGenDesc->x58_x44_TIND; }
bool IsIndirectTextured()
const; // { return x28_loadedGenDesc->x54_x40_TEXR && x28_loadedGenDesc->x58_x44_TIND; }
float GetExternalVar(int index) const;
static void Initialize();

View File

@ -25,7 +25,7 @@ const CArchMsgParmUserInput& GetParmUserInput(const CArchitectureMessage& msg);
const CArchMsgParmInt32& GetParmNewGameflowState(const CArchitectureMessage& msg);
CArchitectureMessage CreateControllerStatus(EArchMsgTarget target, const short& chan,
CArchitectureMessage CreateControllerStatus(const EArchMsgTarget target, const short& chan,
const bool& connected);
CArchitectureMessage CreateQuitGameplay(EArchMsgTarget target);

View File

@ -26,28 +26,28 @@ public:
void ResetToDefaults();
void EnsureOptions();
void SetScreenBrightness(int, bool);
float TuneScreenBrightness();
void SetScreenPositionX(int, bool);
void SetScreenPositionY(int, bool);
void SetScreenStretch(int, bool);
void SetSfxVolume(int, bool);
void SetMusicVolume(int, bool);
void SetScreenBrightness(const int, const bool);
const float TuneScreenBrightness();
void SetScreenPositionX(const int, const bool);
void SetScreenPositionY(const int, const bool);
void SetScreenStretch(const int, const bool);
void SetSfxVolume(const int, const bool);
void SetMusicVolume(const int,const bool);
void SetSurroundMode(CAudioSys::ESurroundModes, bool);
float GetHudAlpha() const;
float GetHelmetAlpha() const;
void SetHelmetAlpha(int);
void SetHUDLag(bool);
const float GetHudAlpha() const;
const float GetHelmetAlpha() const;
void SetHelmetAlpha(const int);
void SetHUDLag(const bool);
void SetIsHintSystemEnabled(bool);
void ToggleControls(bool);
void ResetControllerAssets(int);
void SetControls(int);
void ToggleControls(const bool);
void ResetControllerAssets(const int);
void SetControls(const int);
void SetInvertYAxis(bool invert);
bool GetInvertYAxis() const { return x68_25_invertY; }
void SetIsRumbleEnabled(bool rumble);
bool GetIsRumbleEnabled() const { return x68_26_rumble; }
void SetInvertYAxis(const bool invert);
const bool GetInvertYAxis() const { return x68_25_invertY; }
void SetIsRumbleEnabled(const bool rumble);
const bool GetIsRumbleEnabled() const { return x68_26_rumble; }
private:
rstl::reserved_vector< uchar, 64 > x0_;

View File

@ -53,7 +53,7 @@ class CPlayer : public CPhysicsActor, public TOneStatic< CPlayer > {
void SetSteam(float targetAlpha, float alphaInDur, float alphaOutDur, CAssetId txtr,
bool affectsThermal);
void Update(float dt);
float GetAlpha() const { return x20_alpha; }
const float GetAlpha() const { return x20_alpha; }
bool AffectsThermal() const { return x28_affectsThermal; }
};
@ -377,6 +377,7 @@ public:
void Teleport(const CTransform4f& xf, CStateManager& mgr, bool resetBallCam);
void SetSpawnedMorphBallState(EPlayerMorphBallState state, CStateManager& mgr);
const CVisorSteam& GetVisorSteam() const { return x7a0_visorSteam; }
const float GetVisorSteamAlpha() const { return x7a0_visorSteam.GetAlpha(); }
void SetVisorSteam(float targetAlpha, float alphaInDur, float alphaOutDir, CAssetId txtr,
bool affectsThermal);

View File

@ -24,7 +24,7 @@ public:
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override;
// CActor
void Render(const CStateManager&) const override;
void AddToRenderer(const CFrustumPlanes&, const CStateManager&) const override;
rstl::optional_object< CAABox > GetTouchBounds() const override;
void Touch(CActor&, CStateManager&) override;

View File

@ -45,7 +45,6 @@ CHECK_SIZEOF(TEditorId, 0x4)
struct TUniqueId {
ushort value;
TUniqueId(ushort version, ushort id) : value(((version & 0x3F) << 10) | (id & 0x3FF)) {}
ushort Value() const { return value & 0x3FF; }

View File

@ -1,6 +1,7 @@
#ifndef _CGAMEPROJECTILE
#define _CGAMEPROJECTILE
#include "Collision/CRayCastResult.hpp"
#include "types.h"
#include "MetroidPrime/CStateManager.hpp"
@ -13,20 +14,25 @@
#include "rstl/vector.hpp"
class CGenDescription;
class CProjectileTouchResult;
class CProjectileTouchResult {
public:
private:
TUniqueId x0_id;
rstl::optional_object< CRayCastResult > x4_result;
};
class CGameProjectile : public CWeapon {
public:
CGameProjectile(bool active, const TToken< CWeaponDescription >&, const rstl::string& name,
EWeaponType wType, const CTransform4f& xf, EMaterialTypes excludeMat,
const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid, TUniqueId owner,
TUniqueId homingTarget, uint attribs, bool underwater,
const CVector3f& scale,
CGameProjectile(const bool active, const TToken< CWeaponDescription >&, const rstl::string& name,
const EWeaponType wType, const CTransform4f& xf, const EMaterialTypes excludeMat,
const CDamageInfo& dInfo, const TUniqueId uid, const TAreaId aid,
const TUniqueId owner, const TUniqueId homingTarget, const uint attribs,
const bool underwater, const CVector3f& scale,
const rstl::optional_object< TLockedToken< CGenDescription > >& visorParticle,
ushort visorSfx, bool sendCollideMsg);
const ushort visorSfx, bool sendCollideMsg);
// CEntity
~CGameProjectile() override;
~CGameProjectile() override {}
void Accept(IVisitor& visitor) override;
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override;
@ -39,6 +45,7 @@ public:
virtual void ResolveCollisionWithActor(const CRayCastResult& res, CActor& act,
CStateManager& mgr);
CProjectileTouchResult CanCollideWithTrigger(CActor& act, CStateManager& mgr);
const CProjectileWeapon& GetProjectile() const { return x170_projectile; }
const CVector3f& GetPreviousPos() const { return x298_previousPos; }
TUniqueId GetHomingTargetId() const { return x2c0_homingTargetId; }
@ -49,8 +56,12 @@ public:
void DeleteProjectileLight(CStateManager&);
void ApplyDamageToActors(CStateManager& mgr, const CDamageInfo& dInfo);
CRayCastResult RayCollisionCheckWithWorld(TUniqueId& idOut, const CVector3f& start, const CVector3f& end,
float mag, const TEntityList& nearList, CStateManager& mgr);
CRayCastResult RayCollisionCheckWithWorld(TUniqueId& idOut, const CVector3f& start,
const CVector3f& end, float mag,
const TEntityList& nearList, CStateManager& mgr);
static EProjectileAttrib GetBeamAttribType(EWeaponType wType);
CAABox GetProjectileBounds() const;
protected:
rstl::optional_object< TLockedToken< CGenDescription > > x158_visorParticle;

View File

@ -20,11 +20,11 @@ class CParticleSwoosh;
class CProjectileWeapon {
public:
// TODO ctor
CProjectileWeapon(const TToken<CWeaponDescription>& wDesc, const CVector3f& origin, const CTransform4f& orient, const CVector3f& scale, const int);
virtual ~CProjectileWeapon();
virtual void Update(float dt);
virtual void AddToRenderer();
virtual void Render();
virtual void Render() const;
virtual CVector3f GetTranslation() const;
virtual CTransform4f GetTransform() const;

View File

@ -31,9 +31,9 @@ public:
kPA_KeepInCinematic = (1 << 17),
};
CWeapon(TUniqueId uid, TAreaId areaId, bool active, TUniqueId owner, EWeaponType type,
CWeapon(const TUniqueId uid, const TAreaId areaId, const bool active, const TUniqueId owner, const EWeaponType type,
const rstl::string& name, const CTransform4f& xf, const CMaterialFilter& filter,
const CMaterialList& mList, const CDamageInfo& dInfo, int attribs,
const CMaterialList& mList, const CDamageInfo& dInfo, const int attribs,
const CModelData& mData);
// CEntity

View File

@ -41,7 +41,7 @@ const CArchMsgParmInt32& MakeMsg::GetParmNewGameflowState(const CArchitectureMes
return *static_cast< const CArchMsgParmInt32* >(msg.GetParm());
}
CArchitectureMessage MakeMsg::CreateControllerStatus(EArchMsgTarget target, const short& chan,
CArchitectureMessage MakeMsg::CreateControllerStatus(const EArchMsgTarget target, const short& chan,
const bool& connected) {
return CArchitectureMessage(target, kAM_ControllerStatus,
rs_new CArchMsgParmControllerStatus(chan, connected));

View File

@ -27,7 +27,7 @@ void CFaceplateDecoration::Update(float dt, const CStateManager& mgr) {
void CFaceplateDecoration::Draw(const CStateManager& stateMgr) const {
if (x4_tex.valid() && x4_tex->IsLoaded()) {
CTexture* texture = TToken< CTexture >(*x4_tex).GetT();
float alpha = stateMgr.GetPlayer()->GetVisorSteam().GetAlpha();
float alpha = stateMgr.GetPlayer()->GetVisorSteamAlpha();
if (!close_enough(alpha, 0.f)) {
CCameraFilterPass::DrawFilter(CCameraFilterPass::kFT_Blend,
CCameraFilterPass::kFS_FullscreenQuarters,

View File

@ -167,7 +167,7 @@ void CGameOptions::SetScreenBrightness(int value, bool apply) {
}
}
float CGameOptions::TuneScreenBrightness() {
const float CGameOptions::TuneScreenBrightness() {
float f = x48_screenBrightness - 4;
return f / 4.f * 0.375f + 1.f;
}
@ -223,21 +223,21 @@ void CGameOptions::SetSurroundMode(CAudioSys::ESurroundModes mode, bool apply) {
}
}
float CGameOptions::GetHudAlpha() const { return x60_hudAlpha * 0.003921569f; }
const float CGameOptions::GetHudAlpha() const { return x60_hudAlpha * 0.003921569f; }
float CGameOptions::GetHelmetAlpha() const { return x64_helmetAlpha * 0.003921569f; }
const float CGameOptions::GetHelmetAlpha() const { return x64_helmetAlpha * 0.003921569f; }
void CGameOptions::SetHelmetAlpha(int alpha) { x64_helmetAlpha = alpha; }
void CGameOptions::SetHelmetAlpha(const int alpha) { x64_helmetAlpha = alpha; }
void CGameOptions::SetHUDLag(bool flag) { x68_24_hudLag = flag; }
void CGameOptions::SetHUDLag(const bool flag) { x68_24_hudLag = flag; }
void CGameOptions::SetIsHintSystemEnabled(bool flag) { x68_28_hintSystem = flag; }
void CGameOptions::SetInvertYAxis(bool flag) { x68_25_invertY = flag; }
void CGameOptions::SetInvertYAxis(const bool flag) { x68_25_invertY = flag; }
void CGameOptions::SetIsRumbleEnabled(bool flag) { x68_26_rumble = flag; }
void CGameOptions::SetIsRumbleEnabled(const bool flag) { x68_26_rumble = flag; }
void CGameOptions::ToggleControls(bool flag) {
void CGameOptions::ToggleControls(const bool flag) {
x68_27_swapBeamsControls = flag;
if (flag) {
SetControls(1);

View File

@ -1,14 +1,30 @@
#include "MetroidPrime/ScriptObjects/CFire.hpp"
#include "MetroidPrime/CActorParameters.hpp"
static inline CMaterialList MakeMaterialList() { return CMaterialList(kMT_Projectile); }
#include "Kyoto/CToken.hpp"
#include "Kyoto/SObjectTag.hpp"
#include "MetroidPrime/CActorParameters.hpp"
#include "MetroidPrime/CStateManager.hpp"
#include "MetroidPrime/Player/CPlayer.hpp"
#include "MetroidPrime/Player/CPlayerState.hpp"
#include "Collision/CMaterialFilter.hpp"
#include "Collision/CMaterialList.hpp"
#include "Kyoto/Math/CFrustumPlanes.hpp"
#include "MetaRender/CCubeRenderer.hpp"
#include "rstl/optional_object.hpp"
#include <rstl/math.hpp>
static EMaterialTypes kSolidMat = kMT_Solid;
static EMaterialTypes kProjectileMat = kMT_Projectile;
CFire::CFire(const TToken< CGenDescription >& effect, TUniqueId uid, TAreaId area, bool active,
TUniqueId owner, const CTransform4f& xf, const CDamageInfo& dInfo, const CAABox& aabox,
const CVector3f& vec, bool b1, CAssetId visorEffect, bool b2, bool b3, bool b4,
float f1, float f2, float f3, float f4)
: CActor(uid, active, "Fire", CEntityInfo(area, NullConnectionList), xf,
CModelData::CModelDataNull(), MakeMaterialList(), CActorParameters::None(),
CModelData::CModelDataNull(), CMaterialList(kProjectileMat), CActorParameters::None(),
kInvalidUniqueId)
, xe8_(rs_new CElementGen(effect))
, xec_owner(owner)
@ -19,7 +35,7 @@ CFire::CFire(const TToken< CGenDescription >& effect, TUniqueId uid, TAreaId are
, x148_24_(b2)
, x148_25_(b3)
, x148_26_(b4)
, x148_27_(b2 && b3 && b4)
, x148_27_(b4 && b3 && b2)
, x148_28_(false)
, x148_29_(b1)
, x14c_(f2)
@ -32,3 +48,91 @@ CFire::CFire(const TToken< CGenDescription >& effect, TUniqueId uid, TAreaId are
}
CFire::~CFire() {}
void CFire::Touch(CActor& act, CStateManager& mgr) {
if (act.GetUniqueId() == xec_owner) {
return;
}
mgr.ApplyDamage(GetUniqueId(), act.GetUniqueId(), GetUniqueId(), x10c_damageInfo2,
CMaterialFilter::MakeIncludeExclude(CMaterialList(kSolidMat), CMaterialList()),
CVector3f::Zero());
}
rstl::optional_object< CAABox > CFire::GetTouchBounds() const {
if (GetActive()) {
return x128_;
}
return rstl::optional_object_null();
}
void CFire::AddToRenderer(const CFrustumPlanes& frustum, const CStateManager& mgr) const {
bool drawParticles = true;
if (!x148_27_) {
switch (mgr.GetPlayerState()->GetActiveVisor(mgr)) {
case CPlayerState::kPV_Combat:
case CPlayerState::kPV_Scan:
drawParticles = x148_24_;
break;
case CPlayerState::kPV_XRay:
drawParticles = x148_26_;
break;
case CPlayerState::kPV_Thermal:
drawParticles = x148_25_;
break;
}
}
if (drawParticles)
gpRender->AddParticleGen(*xe8_);
CActor::AddToRenderer(frustum, mgr);
}
void CFire::Accept(IVisitor& visitor) { visitor.Visit(*this); }
void CFire::Think(float dt, CStateManager& mgr) {
const float particleCount = static_cast< float >(xe8_->GetParticleCount()) /
static_cast< float >(xe8_->GetMaxParticles());
if (GetActive()) {
xe8_->Update(dt * x144_);
x10c_damageInfo2 =
CDamageInfo(xf0_damageInfo1, (particleCount > 0.5f ? particleCount : 0.f) * dt);
}
bool doFree = false;
if (xe8_->IsSystemDeletable()) {
doFree = true;
}
if (x148_29_) {
if (mgr.GetPlayer()->GetTouchBounds()->DoBoundsOverlap(*GetTouchBounds()) && !doFree &&
particleCount > 0.5f) {
mgr.Player()->SetVisorSteam(particleCount * x14c_, x154_, x158_, x150_, true);
} else {
mgr.Player()->SetVisorSteam(0.f, 1.f, 1.f, kInvalidAssetId, true);
}
}
x15c_ += dt;
if (x15c_ > 45.f)
doFree = true;
if (doFree) {
mgr.DeleteObjectRequest(GetUniqueId());
}
}
void CFire::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
CActor::AcceptScriptMsg(msg, uid, mgr);
switch (msg) {
case kSM_Registered:
xe8_->SetParticleEmission(true);
SetActive(true);
break;
default:
break;
}
}