CScriptSpecialFunction: More matches

Former-commit-id: fdbd70eea1
This commit is contained in:
Luke Street 2022-10-02 18:27:13 -04:00
parent 5da4fc096b
commit c8f194b18c
7 changed files with 69 additions and 43 deletions

View File

@ -1334,7 +1334,7 @@ lbl_800449E8:
/* 800449F8 00041958 7C 7E 1B 79 */ or. r30, r3, r3 /* 800449F8 00041958 7C 7E 1B 79 */ or. r30, r3, r3
/* 800449FC 0004195C 41 82 00 14 */ beq lbl_80044A10 /* 800449FC 0004195C 41 82 00 14 */ beq lbl_80044A10
/* 80044A00 00041960 7F A4 EB 78 */ mr r4, r29 /* 80044A00 00041960 7F A4 EB 78 */ mr r4, r29
/* 80044A04 00041964 48 10 CE 65 */ bl ShouldSkipCinematic__22CScriptSpecialFunctionFR13CStateManager /* 80044A04 00041964 48 10 CE 65 */ bl ShouldSkipCinematic__22CScriptSpecialFunctionCFR13CStateManager
/* 80044A08 00041968 54 60 06 3F */ clrlwi. r0, r3, 0x18 /* 80044A08 00041968 54 60 06 3F */ clrlwi. r0, r3, 0x18
/* 80044A0C 0004196C 40 82 00 0C */ bne lbl_80044A18 /* 80044A0C 0004196C 40 82 00 0C */ bne lbl_80044A18
lbl_80044A10: lbl_80044A10:

View File

@ -2203,8 +2203,8 @@ lbl_801D54FC:
/* 801D5520 001D2480 38 21 00 10 */ addi r1, r1, 0x10 /* 801D5520 001D2480 38 21 00 10 */ addi r1, r1, 0x10
/* 801D5524 001D2484 4E 80 00 20 */ blr /* 801D5524 001D2484 4E 80 00 20 */ blr
.global "GetCinematicState__14CSystemOptionsFRCQ24rstl19pair<Ui,9TEditorId>" .global "GetCinematicState__14CSystemOptionsCFQ24rstl19pair<Ui,9TEditorId>"
"GetCinematicState__14CSystemOptionsFRCQ24rstl19pair<Ui,9TEditorId>": "GetCinematicState__14CSystemOptionsCFQ24rstl19pair<Ui,9TEditorId>":
/* 801D5528 001D2488 80 03 00 B0 */ lwz r0, 0xb0(r3) /* 801D5528 001D2488 80 03 00 B0 */ lwz r0, 0xb0(r3)
/* 801D552C 001D248C 80 E3 00 B8 */ lwz r7, 0xb8(r3) /* 801D552C 001D248C 80 E3 00 B8 */ lwz r7, 0xb8(r3)
/* 801D5530 001D2490 54 00 18 38 */ slwi r0, r0, 3 /* 801D5530 001D2490 54 00 18 38 */ slwi r0, r0, 3
@ -2422,7 +2422,7 @@ lbl_801D583C:
/* 801D584C 001D27AC 90 01 00 1C */ stw r0, 0x1c(r1) /* 801D584C 001D27AC 90 01 00 1C */ stw r0, 0x1c(r1)
/* 801D5850 001D27B0 93 21 00 20 */ stw r25, 0x20(r1) /* 801D5850 001D27B0 93 21 00 20 */ stw r25, 0x20(r1)
/* 801D5854 001D27B4 90 01 00 24 */ stw r0, 0x24(r1) /* 801D5854 001D27B4 90 01 00 24 */ stw r0, 0x24(r1)
/* 801D5858 001D27B8 4B FF FC D1 */ bl "GetCinematicState__14CSystemOptionsFRCQ24rstl19pair<Ui,9TEditorId>" /* 801D5858 001D27B8 4B FF FC D1 */ bl "GetCinematicState__14CSystemOptionsCFQ24rstl19pair<Ui,9TEditorId>"
/* 801D585C 001D27BC 80 01 00 58 */ lwz r0, 0x58(r1) /* 801D585C 001D27BC 80 01 00 58 */ lwz r0, 0x58(r1)
/* 801D5860 001D27C0 7C 74 1B 78 */ mr r20, r3 /* 801D5860 001D27C0 7C 74 1B 78 */ mr r20, r3
/* 801D5864 001D27C4 80 A1 00 5C */ lwz r5, 0x5c(r1) /* 801D5864 001D27C4 80 A1 00 5C */ lwz r5, 0x5c(r1)
@ -3363,4 +3363,3 @@ lbl_803D1B88:
# ROM: 0x3CEB88 # ROM: 0x3CEB88
.asciz "??(??)" .asciz "??(??)"
.balign 4 .balign 4

View File

@ -2912,8 +2912,8 @@ SkipCinematic__22CScriptSpecialFunctionFR13CStateManager:
/* 80151860 0014E7C0 38 21 00 20 */ addi r1, r1, 0x20 /* 80151860 0014E7C0 38 21 00 20 */ addi r1, r1, 0x20
/* 80151864 0014E7C4 4E 80 00 20 */ blr /* 80151864 0014E7C4 4E 80 00 20 */ blr
.global ShouldSkipCinematic__22CScriptSpecialFunctionFR13CStateManager .global ShouldSkipCinematic__22CScriptSpecialFunctionCFR13CStateManager
ShouldSkipCinematic__22CScriptSpecialFunctionFR13CStateManager: ShouldSkipCinematic__22CScriptSpecialFunctionCFR13CStateManager:
/* 80151868 0014E7C8 94 21 FF E0 */ stwu r1, -0x20(r1) /* 80151868 0014E7C8 94 21 FF E0 */ stwu r1, -0x20(r1)
/* 8015186C 0014E7CC 7C 08 02 A6 */ mflr r0 /* 8015186C 0014E7CC 7C 08 02 A6 */ mflr r0
/* 80151870 0014E7D0 90 01 00 24 */ stw r0, 0x24(r1) /* 80151870 0014E7D0 90 01 00 24 */ stw r0, 0x24(r1)
@ -2927,7 +2927,7 @@ ShouldSkipCinematic__22CScriptSpecialFunctionFR13CStateManager:
/* 80151890 0014E7F0 90 01 00 0C */ stw r0, 0xc(r1) /* 80151890 0014E7F0 90 01 00 0C */ stw r0, 0xc(r1)
/* 80151894 0014E7F4 90 A1 00 10 */ stw r5, 0x10(r1) /* 80151894 0014E7F4 90 A1 00 10 */ stw r5, 0x10(r1)
/* 80151898 0014E7F8 90 01 00 14 */ stw r0, 0x14(r1) /* 80151898 0014E7F8 90 01 00 14 */ stw r0, 0x14(r1)
/* 8015189C 0014E7FC 48 08 3C 8D */ bl "GetCinematicState__14CSystemOptionsFRCQ24rstl19pair<Ui,9TEditorId>" /* 8015189C 0014E7FC 48 08 3C 8D */ bl "GetCinematicState__14CSystemOptionsCFQ24rstl19pair<Ui,9TEditorId>"
/* 801518A0 0014E800 80 01 00 24 */ lwz r0, 0x24(r1) /* 801518A0 0014E800 80 01 00 24 */ lwz r0, 0x24(r1)
/* 801518A4 0014E804 7C 08 03 A6 */ mtlr r0 /* 801518A4 0014E804 7C 08 03 A6 */ mtlr r0
/* 801518A8 0014E808 38 21 00 20 */ addi r1, r1, 0x20 /* 801518A8 0014E808 38 21 00 20 */ addi r1, r1, 0x20
@ -3579,7 +3579,7 @@ lbl_801521C4:
/* 801521C8 0014F128 40 82 00 2C */ bne lbl_801521F4 /* 801521C8 0014F128 40 82 00 2C */ bne lbl_801521F4
/* 801521CC 0014F12C 7F E3 FB 78 */ mr r3, r31 /* 801521CC 0014F12C 7F E3 FB 78 */ mr r3, r31
/* 801521D0 0014F130 7F C4 F3 78 */ mr r4, r30 /* 801521D0 0014F130 7F C4 F3 78 */ mr r4, r30
/* 801521D4 0014F134 4B FF F6 95 */ bl ShouldSkipCinematic__22CScriptSpecialFunctionFR13CStateManager /* 801521D4 0014F134 4B FF F6 95 */ bl ShouldSkipCinematic__22CScriptSpecialFunctionCFR13CStateManager
/* 801521D8 0014F138 54 60 06 3F */ clrlwi. r0, r3, 0x18 /* 801521D8 0014F138 54 60 06 3F */ clrlwi. r0, r3, 0x18
/* 801521DC 0014F13C 41 82 06 C4 */ beq lbl_801528A0 /* 801521DC 0014F13C 41 82 06 C4 */ beq lbl_801528A0
/* 801521E0 0014F140 A0 1F 00 08 */ lhz r0, 8(r31) /* 801521E0 0014F140 A0 1F 00 08 */ lhz r0, 8(r31)

View File

@ -5,8 +5,11 @@
#include "Kyoto/CObjectReference.hpp" #include "Kyoto/CObjectReference.hpp"
#include "Kyoto/CRandom16.hpp" #include "Kyoto/CRandom16.hpp"
#include "Kyoto/Math/CVector2f.hpp"
#include "Kyoto/Math/CVector2i.hpp" #include "Kyoto/Math/CVector2i.hpp"
#include "Kyoto/TOneStatic.hpp"
#include "Kyoto/TToken.hpp" #include "Kyoto/TToken.hpp"
#include "MetroidPrime/CEntityInfo.hpp" #include "MetroidPrime/CEntityInfo.hpp"
#include "MetroidPrime/CObjectList.hpp" #include "MetroidPrime/CObjectList.hpp"
#include "MetroidPrime/TGameTypes.hpp" #include "MetroidPrime/TGameTypes.hpp"
@ -60,13 +63,19 @@ enum EStateManagerTransition {
kSMT_MessageScreen kSMT_MessageScreen
}; };
enum EThermalDrawFlag {
kTD_Hot,
kTD_Cold,
kTD_Bypass,
};
struct SOnScreenTex { struct SOnScreenTex {
CAssetId x0_id; CAssetId x0_id;
CVector2i x4_origin; CVector2i x4_origin;
CVector2i xc_extent; CVector2i xc_extent;
}; };
class CStateManager { class CStateManager : public TOneStatic< CStateManager > {
public: public:
void ResetEscapeSequenceTimer(float); void ResetEscapeSequenceTimer(float);
void SendScriptMsg(TUniqueId uid, TEditorId target, EScriptObjectMessage msg, void SendScriptMsg(TUniqueId uid, TEditorId target, EScriptObjectMessage msg,
@ -136,8 +145,7 @@ public:
const SOnScreenTex& GetPendingScreenTex() const { return xef4_pendingScreenTex; } const SOnScreenTex& GetPendingScreenTex() const { return xef4_pendingScreenTex; }
void SetShouldQuitGame(bool should) { xf94_25_quitGame = should; } void SetShouldQuitGame(bool should) { xf94_25_quitGame = should; }
void SetSkipCinematicSpecialFunction(TUniqueId id) { /*xf38_skipCineSpecialFunc = id;*/ void SetSkipCinematicSpecialFunction(TUniqueId id) { xf38_skipCineSpecialFunc = id; }
}
void SetInSaveUI(bool b) { xf94_28_inSaveUI = b; } void SetInSaveUI(bool b) { xf94_28_inSaveUI = b; }
bool GetInSaveUI() const { return xf94_28_inSaveUI; } bool GetInSaveUI() const { return xf94_28_inSaveUI; }
void SetIsFullThreat(bool v) { xf94_30_fullThreat = v; } void SetIsFullThreat(bool v) { xf94_30_fullThreat = v; }
@ -177,17 +185,36 @@ private:
rstl::vector< CLight > x8e0_dynamicLights; rstl::vector< CLight > x8e0_dynamicLights;
TLockedToken< CTexture > x8f0_shadowTex; TLockedToken< CTexture > x8f0_shadowTex;
CRandom16 x8fc_random;
CRandom16* x900_random; CRandom16* x900_random;
u8 x904_pad[0x5f0]; u8 x904_pad[0x5f0];
SOnScreenTex xef4_pendingScreenTex; SOnScreenTex xef4_pendingScreenTex;
CAssetId xf08_pauseHudMessage;
u8 xf08_pad[0x1C]; f32 xf0c_escapeTimer;
f32 xf10_escapeTotalTime;
f32 xf14_curTimeMod900;
TUniqueId xf18_bossId;
f32 xf1c_totalBossEnergy;
uint xf20_bossStringIdx;
f32 xf24_thermColdScale1; f32 xf24_thermColdScale1;
f32 xf28_thermColdScale2; f32 xf28_thermColdScale2;
u8 pad3[0x68]; CVector2f xf2c_viewportScale;
EThermalDrawFlag xf34_thermalFlag;
TUniqueId xf38_skipCineSpecialFunc;
rstl::list< TUniqueId > xf3c_activeFlickerBats;
rstl::list< TUniqueId > xf54_activeParasites;
TUniqueId xf6c_playerActorHead;
rstl::single_ptr< CMazeState > xf70_currentMaze;
TUniqueId xf74_lastTrigger;
TUniqueId xf76_lastRelay;
f32 xf78_hudMessageTime;
unkptr xf7c_projectedShadow;
uint xf80_hudMessageFrameCount;
CAssetId xf84_;
CAssetId xf88_;
f32 xf8c_;
EStateManagerTransition xf90_deferredTransition; EStateManagerTransition xf90_deferredTransition;
bool xf94_24_readyToRender : 1; bool xf94_24_readyToRender : 1;
bool xf94_25_quitGame : 1; bool xf94_25_quitGame : 1;
@ -197,5 +224,6 @@ private:
bool xf94_29_cinematicPause : 1; bool xf94_29_cinematicPause : 1;
bool xf94_30_fullThreat : 1; bool xf94_30_fullThreat : 1;
}; };
CHECK_SIZEOF(CStateManager, 0xf98)
#endif #endif

View File

@ -16,8 +16,8 @@ public:
void SetHasFusion(bool v); void SetHasFusion(bool v);
bool GetHasFusion() const { return xd0_28_fusionSuitActive; } bool GetHasFusion() const { return xd0_28_fusionSuitActive; }
bool GetCinematicState(CAssetId mlvlId, TEditorId cineId) const; bool GetCinematicState(rstl::pair< CAssetId, TEditorId > cineId) const;
void SetCinematicState(CAssetId mlvlId, TEditorId cineId, bool state); void SetCinematicState(rstl::pair< CAssetId, TEditorId > cineId, bool state);
private: private:
rstl::reserved_vector< u8, 98 > x0_nesState; rstl::reserved_vector< u8, 98 > x0_nesState;

View File

@ -9,11 +9,6 @@ class pair {
public: public:
inline pair() {} inline pair() {}
inline pair(const L& first, const R& second) : first(first), second(second) {} inline pair(const L& first, const R& second) : first(first), second(second) {}
inline pair(const pair& other) : first(other.first), second(other.second) {}
inline void operator=(const pair& other) {
first = other.first;
second = other.second;
}
L first; L first;
R second; R second;

View File

@ -405,8 +405,9 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId
} }
} else if (msg == kSM_Decrement) { } else if (msg == kSM_Decrement) {
mgr.SetSkipCinematicSpecialFunction(kInvalidUniqueId); mgr.SetSkipCinematicSpecialFunction(kInvalidUniqueId);
gpGameState->SystemOptions().SetCinematicState(mgr.GetWorld()->GetWorldAssetId(), gpGameState->SystemOptions().SetCinematicState(
GetEditorId(), true); rstl::pair< CAssetId, TEditorId >(mgr.GetWorld()->GetWorldAssetId(), GetEditorId()),
true);
} }
break; break;
} }
@ -562,14 +563,16 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId
} }
} }
bool CScriptSpecialFunction::ShouldSkipCinematic(CStateManager& stateMgr) const { bool CScriptSpecialFunction::ShouldSkipCinematic(CStateManager& mgr) const {
return gpGameState->SystemOptions().GetCinematicState(stateMgr.GetWorld()->IGetWorldAssetId(), CAssetId mlvlId = mgr.GetWorld()->GetWorldAssetId();
GetEditorId()); TEditorId cineId = GetEditorId();
return gpGameState->SystemOptions().GetCinematicState(
rstl::pair< CAssetId, TEditorId >(mlvlId, cineId));
} }
void CScriptSpecialFunction::SkipCinematic(CStateManager& stateMgr) { void CScriptSpecialFunction::SkipCinematic(CStateManager& mgr) {
SendScriptMsgs(kSS_Zero, stateMgr, kSM_None); SendScriptMsgs(kSS_Zero, mgr, kSM_None);
stateMgr.SetSkipCinematicSpecialFunction(kInvalidUniqueId); mgr.SetSkipCinematicSpecialFunction(kInvalidUniqueId);
} }
void CScriptSpecialFunction::Accept(IVisitor& visitor) { visitor.Visit(*this); } void CScriptSpecialFunction::Accept(IVisitor& visitor) { visitor.Visit(*this); }
@ -578,25 +581,26 @@ void CScriptSpecialFunction::RingScramble(CStateManager& mgr) {
SendScriptMsgs(kSS_Zero, mgr, kSM_None); SendScriptMsgs(kSS_Zero, mgr, kSM_None);
x1a8_ringState = kRS_Scramble; x1a8_ringState = kRS_Scramble;
x1b8_ringReverse = !x1b8_ringReverse; x1b8_ringReverse = !x1b8_ringReverse;
float dir = (x1b8_ringReverse ? 1.f : -1.f); float dir = x1b8_ringReverse ? 1.f : -1.f;
for (rstl::vector< SRingController >::iterator it = x198_ringControllers.begin(); for (int i = 0; i < x198_ringControllers.size(); ++i) {
it != x198_ringControllers.end(); ++it) { x198_ringControllers[i].x4_rotateSpeed =
it->x4_rotateSpeed = dir * mgr.GetActiveRandom()->Range(x100_float2, x104_float3); dir * mgr.GetActiveRandom()->Range(x100_float2, x104_float3);
dir = -dir; dir = -dir;
it->x8_reachedTarget = false; x198_ringControllers[i].x8_reachedTarget = false;
} }
} }
void CScriptSpecialFunction::ThinkSaveStation(float, CStateManager& mgr) { void CScriptSpecialFunction::ThinkSaveStation(float, CStateManager& mgr) {
if (!x1e5_24_doSave || mgr.GetDeferredStateTransition() == kSMT_SaveGame) { if (!x1e5_24_doSave) {
return; return;
} }
if (mgr.GetDeferredStateTransition() != kSMT_SaveGame) {
x1e5_24_doSave = false; x1e5_24_doSave = false;
if (mgr.GetInSaveUI()) { if (mgr.GetInSaveUI()) {
SendScriptMsgs(kSS_MaxReached, mgr, kSM_None); SendScriptMsgs(kSS_MaxReached, mgr, kSM_None);
} else { } else {
SendScriptMsgs(kSS_Zero, mgr, kSM_None); SendScriptMsgs(kSS_Zero, mgr, kSM_None);
}
} }
} }