Match and link CScriptControllerAction

This commit is contained in:
Phillip Stephens 2022-12-08 14:05:14 -08:00
parent 182d400484
commit d977d443ee
5 changed files with 86 additions and 18 deletions

View File

@ -8482,7 +8482,7 @@ lbl_800CCC24:
/* 800CCC7C 000C9BDC 93 A1 00 08 */ stw r29, 8(r1)
/* 800CCC80 000C9BE0 38 81 00 14 */ addi r4, r1, 0x14
/* 800CCC84 000C9BE4 38 A1 00 18 */ addi r5, r1, 0x18
/* 800CCC88 000C9BE8 48 10 C2 55 */ bl "__ct__23CScriptControllerActionF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfobQ213ControlMapper9ECommandsbUib"
/* 800CCC88 000C9BE8 48 10 C2 55 */ bl "__ct__23CScriptControllerActionF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfobQ223CScriptControllerAction9ECommandsbUib"
/* 800CCC8C 000C9BEC 7C 78 1B 78 */ mr r24, r3
lbl_800CCC90:
/* 800CCC90 000C9BF0 38 61 00 18 */ addi r3, r1, 0x18

View File

@ -45,8 +45,8 @@ lbl_801D8D38:
/* 801D8D4C 001D5CAC 38 21 00 10 */ addi r1, r1, 0x10
/* 801D8D50 001D5CB0 4E 80 00 20 */ blr
.global nullsub_51
nullsub_51:
.global GetCommand__23CScriptControllerActionFQ223CScriptControllerAction9ECommands
GetCommand__23CScriptControllerActionFQ223CScriptControllerAction9ECommands:
/* 801D8D54 001D5CB4 4E 80 00 20 */ blr
.global Think__23CScriptControllerActionFfR13CStateManager
@ -82,7 +82,7 @@ lbl_801D8DB4:
/* 801D8DC0 001D5D20 48 00 00 40 */ b lbl_801D8E00
lbl_801D8DC4:
/* 801D8DC4 001D5D24 80 7D 00 34 */ lwz r3, 0x34(r29)
/* 801D8DC8 001D5D28 4B FF FF 8D */ bl nullsub_51
/* 801D8DC8 001D5D28 4B FF FF 8D */ bl GetCommand__23CScriptControllerActionFQ223CScriptControllerAction9ECommands
/* 801D8DCC 001D5D2C 38 9E 0B 54 */ addi r4, r30, 0xb54
/* 801D8DD0 001D5D30 4B E3 3A A5 */ bl GetDigitalInput__13ControlMapperFQ213ControlMapper9ECommandsRC11CFinalInput
/* 801D8DD4 001D5D34 54 60 06 3F */ clrlwi. r0, r3, 0x18
@ -159,8 +159,8 @@ Accept__23CScriptControllerActionFR8IVisitor:
/* 801D8ED4 001D5E34 38 21 00 10 */ addi r1, r1, 0x10
/* 801D8ED8 001D5E38 4E 80 00 20 */ blr
.global "__ct__23CScriptControllerActionF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfobQ213ControlMapper9ECommandsbUib"
"__ct__23CScriptControllerActionF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfobQ213ControlMapper9ECommandsbUib":
.global "__ct__23CScriptControllerActionF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfobQ223CScriptControllerAction9ECommandsbUib"
"__ct__23CScriptControllerActionF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfobQ223CScriptControllerAction9ECommandsbUib":
/* 801D8EDC 001D5E3C 94 21 FF D0 */ stwu r1, -0x30(r1)
/* 801D8EE0 001D5E40 7C 08 02 A6 */ mflr r0
/* 801D8EE4 001D5E44 90 01 00 34 */ stw r0, 0x34(r1)

View File

@ -266,7 +266,7 @@ LIBS = [
["MetroidPrime/ScriptObjects/CScriptWorldTeleporter", False],
["MetroidPrime/ScriptObjects/CScriptVisorGoo", False],
"MetroidPrime/Enemies/CJellyZap",
["MetroidPrime/ScriptObjects/CScriptControllerAction", False],
["MetroidPrime/ScriptObjects/CScriptControllerAction", True],
["MetroidPrime/Weapons/GunController/CGunMotion", False],
["MetroidPrime/ScriptObjects/CScriptSwitch", True],
["MetroidPrime/BodyState/CABSIdle", True],

View File

@ -6,19 +6,88 @@
#include "MetroidPrime/CControlMapper.hpp"
class CScriptControllerAction : public CEntity {
ControlMapper::ECommands x34_command;
enum ECommands {
kC_Forward,
kC_Backward,
kC_TurnLeft,
kC_TurnRight,
kC_StrafeLeft,
kC_StrafeRight,
kC_LookLeft,
kC_LookRight,
kC_LookUp,
kC_LookDown,
kC_JumpOrBoost = 10,
kC_FireOrBomb = 11,
kC_MissileOrPowerBomb = 12,
kC_Morph,
kC_AimUp,
kC_AimDown,
kC_CycleBeamUp,
kC_CycleBeamDown,
kC_CycleItem,
kC_PowerBeam,
kC_IceBeam,
kC_WaveBeam,
kC_PlasmaBeam,
kC_ToggleHolster = 23,
kC_OrbitClose,
kC_OrbitFar,
kC_OrbitObject,
kC_OrbitSelect,
kC_OrbitConfirm,
kC_OrbitLeft,
kC_OrbitRight,
kC_OrbitUp,
kC_OrbitDown,
kC_LookHold1,
kC_LookHold2,
kC_LookZoomIn,
kC_LookZoomOut,
kC_AimHold,
kC_MapCircleUp,
kC_MapCircleDown,
kC_MapCircleLeft,
kC_MapCircleRight,
kC_MapMoveForward,
kC_MapMoveBack,
kC_MapMoveLeft,
kC_MapMoveRight,
kC_MapZoomIn,
kC_MapZoomOut,
kC_SpiderBall,
kC_ChaseCamera,
kC_XrayVisor = 50,
kC_ThermoVisor = 51,
kC_EnviroVisor = 52,
kC_NoVisor = 53,
kC_VisorMenu,
kC_VisorUp,
kC_VisorDown,
kC_ShowCrosshairs,
kC_UseShield = 0x3B,
kC_ScanItem = 0x3C,
kC_PreviousPauseScreen = 0x41,
kC_NextPauseScreen = 0x42,
kC_UNKNOWN,
kC_None,
kC_MAX
};
ECommands x34_command;
uint x38_mapScreenSubaction;
bool x3c_24_mapScreenResponse : 1;
uchar x3c_24_mapScreenResponse : 1;
bool x3c_25_deactivateOnClose : 1;
bool x3c_26_pressed : 1;
public:
CScriptControllerAction(TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
bool active, ControlMapper::ECommands command, bool b1, uint w1, bool b2);
~CScriptControllerAction();
bool active, ECommands command, bool b1, uint w1, bool b2);
void Accept(IVisitor& visitor) override;
void Think(float, CStateManager&) override;
static ControlMapper::ECommands GetCommand(ECommands cmd);
};
#endif // _CSCRIPTCONTROLLERACTION

View File

@ -2,11 +2,9 @@
#include "MetroidPrime/CStateManager.hpp"
extern "C" ControlMapper::ECommands nullsub_51(float, ControlMapper::ECommands);
CScriptControllerAction::CScriptControllerAction(TUniqueId uid, const rstl::string& name,
const CEntityInfo& info, bool active,
ControlMapper::ECommands command,
ECommands command,
bool mapScreenResponse, uint w1,
bool deactivateOnClose)
: CEntity(uid, info, active, name)
@ -33,7 +31,7 @@ void CScriptControllerAction::Think(float dt, CStateManager& stateMgr) {
break;
}
} else {
if (ControlMapper::GetDigitalInput(nullsub_51(dt, x34_command), stateMgr.GetFinalInput())) {
if (ControlMapper::GetDigitalInput(GetCommand(x34_command), stateMgr.GetFinalInput())) {
x3c_26_pressed = true;
} else {
x3c_26_pressed = false;
@ -53,6 +51,7 @@ void CScriptControllerAction::Think(float dt, CStateManager& stateMgr) {
}
}
extern "C" ControlMapper::ECommands nullsub_51(float, ControlMapper::ECommands c) { return c; }
CScriptControllerAction::~CScriptControllerAction() {}
ControlMapper::ECommands
CScriptControllerAction::GetCommand(CScriptControllerAction::ECommands c) {
return (ControlMapper::ECommands)(c);
}