diff --git a/asm/MetroidPrime/CMapWorldInfo.s b/asm/MetroidPrime/CMapWorldInfo.s index 30d24b42..e9f1d0cf 100644 --- a/asm/MetroidPrime/CMapWorldInfo.s +++ b/asm/MetroidPrime/CMapWorldInfo.s @@ -1114,8 +1114,8 @@ lbl_80168B88: /* 80168B94 00165AF4 38 21 00 30 */ addi r1, r1, 0x30 /* 80168B98 00165AF8 4E 80 00 20 */ blr -.global PutTo__13CMapWorldInfoCFR13COutputStreamRC10CSaveWorldi -PutTo__13CMapWorldInfoCFR13COutputStreamRC10CSaveWorldi: +.global PutTo__13CMapWorldInfoCFR13COutputStreamRC18CWorldSaveGameInfoi +PutTo__13CMapWorldInfoCFR13COutputStreamRC18CWorldSaveGameInfoi: /* 80168B9C 00165AFC 94 21 FF 70 */ stwu r1, -0x90(r1) /* 80168BA0 00165B00 7C 08 02 A6 */ mflr r0 /* 80168BA4 00165B04 90 01 00 94 */ stw r0, 0x94(r1) @@ -1370,8 +1370,8 @@ sub_80168e78: /* 80168F3C 00165E9C 38 21 00 40 */ addi r1, r1, 0x40 /* 80168F40 00165EA0 4E 80 00 20 */ blr -.global __ct__13CMapWorldInfoFR16CBitStreamReaderRC10CSaveWorldUi -__ct__13CMapWorldInfoFR16CBitStreamReaderRC10CSaveWorldUi: +.global __ct__13CMapWorldInfoFR16CBitStreamReaderRC18CWorldSaveGameInfoUi +__ct__13CMapWorldInfoFR16CBitStreamReaderRC18CWorldSaveGameInfoUi: /* 80168F44 00165EA4 94 21 FF 80 */ stwu r1, -0x80(r1) /* 80168F48 00165EA8 7C 08 02 A6 */ mflr r0 /* 80168F4C 00165EAC 90 01 00 84 */ stw r0, 0x84(r1) diff --git a/asm/MetroidPrime/CScriptMailbox.s b/asm/MetroidPrime/CScriptMailbox.s index 17d8b7fb..b1fac645 100644 --- a/asm/MetroidPrime/CScriptMailbox.s +++ b/asm/MetroidPrime/CScriptMailbox.s @@ -16,8 +16,8 @@ lbl_805A7329: .section .text, "ax" -.global HasObject__14CScriptMailboxCF9TEditorId -HasObject__14CScriptMailboxCF9TEditorId: +.global HasMsg__14CScriptMailboxCF9TEditorId +HasMsg__14CScriptMailboxCF9TEditorId: /* 800E1A38 000DE998 80 03 00 00 */ lwz r0, 0(r3) /* 800E1A3C 000DE99C 38 C3 00 04 */ addi r6, r3, 4 /* 800E1A40 000DE9A0 54 00 10 3A */ slwi r0, r0, 2 @@ -41,8 +41,8 @@ lbl_800E1A74: /* 800E1A7C 000DE9DC 38 60 00 00 */ li r3, 0 /* 800E1A80 000DE9E0 4E 80 00 20 */ blr -.global RemoveRelay__14CScriptMailboxF9TEditorId -RemoveRelay__14CScriptMailboxF9TEditorId: +.global RemoveMsg__14CScriptMailboxF9TEditorId +RemoveMsg__14CScriptMailboxF9TEditorId: /* 800E1A84 000DE9E4 80 03 00 00 */ lwz r0, 0(r3) /* 800E1A88 000DE9E8 38 E3 00 04 */ addi r7, r3, 4 /* 800E1A8C 000DE9EC 54 00 10 3A */ slwi r0, r0, 2 @@ -83,8 +83,8 @@ lbl_800E1B00: /* 800E1B04 000DEA64 40 82 FF 98 */ bne lbl_800E1A9C /* 800E1B08 000DEA68 4E 80 00 20 */ blr -.global AddRelay__14CScriptMailboxF9TEditorId -AddRelay__14CScriptMailboxF9TEditorId: +.global AddMsg__14CScriptMailboxF9TEditorId +AddMsg__14CScriptMailboxF9TEditorId: /* 800E1B0C 000DEA6C 80 03 00 00 */ lwz r0, 0(r3) /* 800E1B10 000DEA70 38 E3 00 04 */ addi r7, r3, 4 /* 800E1B14 000DEA74 54 00 10 3A */ slwi r0, r0, 2 @@ -140,7 +140,7 @@ lbl_800E1BA0: /* 800E1BC0 000DEB20 38 81 00 18 */ addi r4, r1, 0x18 /* 800E1BC4 000DEB24 90 01 00 20 */ stw r0, 0x20(r1) /* 800E1BC8 000DEB28 90 01 00 18 */ stw r0, 0x18(r1) -/* 800E1BCC 000DEB2C 4B FF FE 6D */ bl HasObject__14CScriptMailboxCF9TEditorId +/* 800E1BCC 000DEB2C 4B FF FE 6D */ bl HasMsg__14CScriptMailboxCF9TEditorId /* 800E1BD0 000DEB30 54 60 06 3F */ clrlwi. r0, r3, 0x18 /* 800E1BD4 000DEB34 41 82 00 3C */ beq lbl_800E1C10 /* 800E1BD8 000DEB38 80 A1 00 24 */ lwz r5, 0x24(r1) @@ -180,7 +180,7 @@ lbl_800E1C38: /* 800E1C54 000DEBB4 38 81 00 10 */ addi r4, r1, 0x10 /* 800E1C58 000DEBB8 90 01 00 1C */ stw r0, 0x1c(r1) /* 800E1C5C 000DEBBC 90 01 00 10 */ stw r0, 0x10(r1) -/* 800E1C60 000DEBC0 4B FF FD D9 */ bl HasObject__14CScriptMailboxCF9TEditorId +/* 800E1C60 000DEBC0 4B FF FD D9 */ bl HasMsg__14CScriptMailboxCF9TEditorId /* 800E1C64 000DEBC4 54 60 06 3F */ clrlwi. r0, r3, 0x18 /* 800E1C68 000DEBC8 41 82 00 24 */ beq lbl_800E1C8C /* 800E1C6C 000DEBCC 88 1D 00 0A */ lbz r0, 0xa(r29) @@ -190,7 +190,7 @@ lbl_800E1C38: /* 800E1C7C 000DEBDC 7F 23 CB 78 */ mr r3, r25 /* 800E1C80 000DEBE0 38 81 00 0C */ addi r4, r1, 0xc /* 800E1C84 000DEBE4 90 01 00 0C */ stw r0, 0xc(r1) -/* 800E1C88 000DEBE8 4B FF FD FD */ bl RemoveRelay__14CScriptMailboxF9TEditorId +/* 800E1C88 000DEBE8 4B FF FD FD */ bl RemoveMsg__14CScriptMailboxF9TEditorId lbl_800E1C8C: /* 800E1C8C 000DEBEC 3B BD 00 0C */ addi r29, r29, 0xc lbl_800E1C90: @@ -207,8 +207,8 @@ lbl_800E1CA8: /* 800E1CB4 000DEC14 38 21 00 50 */ addi r1, r1, 0x50 /* 800E1CB8 000DEC18 4E 80 00 20 */ blr -.global PutTo__14CScriptMailboxCFR13COutputStream -PutTo__14CScriptMailboxCFR13COutputStream: +.global PutTo__14CScriptMailboxCFR13COutputStreamR18CWorldSaveGameInfo +PutTo__14CScriptMailboxCFR13COutputStreamR18CWorldSaveGameInfo: /* 800E1CBC 000DEC1C 94 21 FF B0 */ stwu r1, -0x50(r1) /* 800E1CC0 000DEC20 7C 08 02 A6 */ mflr r0 /* 800E1CC4 000DEC24 90 01 00 54 */ stw r0, 0x54(r1) @@ -254,7 +254,7 @@ lbl_800E1D48: /* 800E1D4C 000DECAC 7F 63 DB 78 */ mr r3, r27 /* 800E1D50 000DECB0 38 81 00 18 */ addi r4, r1, 0x18 /* 800E1D54 000DECB4 90 01 00 18 */ stw r0, 0x18(r1) -/* 800E1D58 000DECB8 48 18 94 81 */ bl GetRelayIndex__10CSaveWorldCFRC9TEditorId +/* 800E1D58 000DECB8 48 18 94 81 */ bl GetRelayIndex__18CWorldSaveGameInfoCFRC9TEditorId /* 800E1D5C 000DECBC 7F DD 19 AE */ stbx r30, r29, r3 /* 800E1D60 000DECC0 3B 9C 00 04 */ addi r28, r28, 4 lbl_800E1D64: @@ -358,8 +358,8 @@ lbl_800E1E9C: /* 800E1EB0 000DEE10 38 21 00 10 */ addi r1, r1, 0x10 /* 800E1EB4 000DEE14 4E 80 00 20 */ blr -.global __ct__14CScriptMailboxFR12CInputStreamRC10CSaveWorld -__ct__14CScriptMailboxFR12CInputStreamRC10CSaveWorld: +.global __ct__14CScriptMailboxFR12CInputStreamRC18CWorldSaveGameInfo +__ct__14CScriptMailboxFR12CInputStreamRC18CWorldSaveGameInfo: /* 800E1EB8 000DEE18 94 21 FF C0 */ stwu r1, -0x40(r1) /* 800E1EBC 000DEE1C 7C 08 02 A6 */ mflr r0 /* 800E1EC0 000DEE20 90 01 00 44 */ stw r0, 0x44(r1) diff --git a/asm/MetroidPrime/Factories/CSaveWorldFactory.s b/asm/MetroidPrime/Factories/CWorldSaveGameInfoFactory.s similarity index 99% rename from asm/MetroidPrime/Factories/CSaveWorldFactory.s rename to asm/MetroidPrime/Factories/CWorldSaveGameInfoFactory.s index aabca854..cee32b1b 100644 --- a/asm/MetroidPrime/Factories/CSaveWorldFactory.s +++ b/asm/MetroidPrime/Factories/CWorldSaveGameInfoFactory.s @@ -19,7 +19,7 @@ FSaveWorldFactory__FRC10SObjectTagR12CInputStreamRC15CVParamTransfer: /* 8026AD90 00267CF0 7C 64 1B 79 */ or. r4, r3, r3 /* 8026AD94 00267CF4 41 82 00 10 */ beq lbl_8026ADA4 /* 8026AD98 00267CF8 7F E4 FB 78 */ mr r4, r31 -/* 8026AD9C 00267CFC 48 00 04 8D */ bl __ct__10CSaveWorldFR12CinputStream +/* 8026AD9C 00267CFC 48 00 04 8D */ bl __ct__18CWorldSaveGameInfoFR12CinputStream /* 8026ADA0 00267D00 7C 64 1B 78 */ mr r4, r3 lbl_8026ADA4: /* 8026ADA4 00267D04 7F C3 F3 78 */ mr r3, r30 @@ -333,8 +333,8 @@ lbl_8026B1BC: /* 8026B1D0 00268130 38 21 00 10 */ addi r1, r1, 0x10 /* 8026B1D4 00268134 4E 80 00 20 */ blr -.global GetRelayIndex__10CSaveWorldCFRC9TEditorId -GetRelayIndex__10CSaveWorldCFRC9TEditorId: +.global GetRelayIndex__18CWorldSaveGameInfoCFRC9TEditorId +GetRelayIndex__18CWorldSaveGameInfoCFRC9TEditorId: /* 8026B1D8 00268138 80 03 00 18 */ lwz r0, 0x18(r3) /* 8026B1DC 0026813C 38 E0 00 00 */ li r7, 0 /* 8026B1E0 00268140 38 C0 00 00 */ li r6, 0 @@ -359,8 +359,8 @@ lbl_8026B220: /* 8026B220 00268180 38 60 FF FF */ li r3, -1 /* 8026B224 00268184 4E 80 00 20 */ blr -.global __ct__10CSaveWorldFR12CinputStream -__ct__10CSaveWorldFR12CinputStream: +.global __ct__18CWorldSaveGameInfoFR12CinputStream +__ct__18CWorldSaveGameInfoFR12CinputStream: /* 8026B228 00268188 94 21 FE D0 */ stwu r1, -0x130(r1) /* 8026B22C 0026818C 7C 08 02 A6 */ mflr r0 /* 8026B230 00268190 90 01 01 34 */ stw r0, 0x134(r1) @@ -1088,4 +1088,3 @@ lbl_803D5418: # ROM: 0x3D2418 .asciz "??(??)" .balign 4 - diff --git a/asm/MetroidPrime/Player/CGameState.s b/asm/MetroidPrime/Player/CGameState.s index ccea3ffc..b0662c9f 100644 --- a/asm/MetroidPrime/Player/CGameState.s +++ b/asm/MetroidPrime/Player/CGameState.s @@ -1287,7 +1287,7 @@ lbl_801D48F0: /* 801D4948 001D18A8 7F C4 F3 78 */ mr r4, r30 /* 801D494C 001D18AC 7E E5 BB 78 */ mr r5, r23 /* 801D4950 001D18B0 38 61 00 3C */ addi r3, r1, 0x3c -/* 801D4954 001D18B4 48 00 04 E5 */ bl __ct__11CWorldStateFR12CInputStreamPCvR10CSaveWorld +/* 801D4954 001D18B4 48 00 04 E5 */ bl __ct__11CWorldStateFR12CInputStreamPCvR18CWorldSaveGameInfo /* 801D4958 001D18B8 38 7D 00 88 */ addi r3, r29, 0x88 /* 801D495C 001D18BC 38 81 00 3C */ addi r4, r1, 0x3c /* 801D4960 001D18C0 4B FF F1 7D */ bl __ct__11CWorldStateFRC11CWorldState @@ -1648,13 +1648,13 @@ PutTo__11CWorldStateFR16CMemoryStreamOut: /* 801D4DE0 001D1D40 7F C4 F3 78 */ mr r4, r30 /* 801D4DE4 001D1D44 7F E5 FB 78 */ mr r5, r31 /* 801D4DE8 001D1D48 80 63 00 00 */ lwz r3, 0(r3) -/* 801D4DEC 001D1D4C 4B F0 CE D1 */ bl PutTo__14CScriptMailboxCFR13COutputStream +/* 801D4DEC 001D1D4C 4B F0 CE D1 */ bl PutTo__14CScriptMailboxCFR13COutputStreamR18CWorldSaveGameInfo /* 801D4DF0 001D1D50 80 7D 00 0C */ lwz r3, 0xc(r29) /* 801D4DF4 001D1D54 7F C4 F3 78 */ mr r4, r30 /* 801D4DF8 001D1D58 80 DD 00 00 */ lwz r6, 0(r29) /* 801D4DFC 001D1D5C 7F E5 FB 78 */ mr r5, r31 /* 801D4E00 001D1D60 80 63 00 00 */ lwz r3, 0(r3) -/* 801D4E04 001D1D64 4B F9 3D 99 */ bl PutTo__13CMapWorldInfoCFR13COutputStreamRC10CSaveWorldi +/* 801D4E04 001D1D64 4B F9 3D 99 */ bl PutTo__13CMapWorldInfoCFR13COutputStreamRC18CWorldSaveGameInfoi /* 801D4E08 001D1D68 80 7D 00 14 */ lwz r3, 0x14(r29) /* 801D4E0C 001D1D6C 7F C4 F3 78 */ mr r4, r30 /* 801D4E10 001D1D70 7F E5 FB 78 */ mr r5, r31 @@ -1668,8 +1668,8 @@ PutTo__11CWorldStateFR16CMemoryStreamOut: /* 801D4E30 001D1D90 38 21 00 20 */ addi r1, r1, 0x20 /* 801D4E34 001D1D94 4E 80 00 20 */ blr -.global __ct__11CWorldStateFR12CInputStreamPCvR10CSaveWorld -__ct__11CWorldStateFR12CInputStreamPCvR10CSaveWorld: +.global __ct__11CWorldStateFR12CInputStreamPCvR18CWorldSaveGameInfo +__ct__11CWorldStateFR12CInputStreamPCvR18CWorldSaveGameInfo: /* 801D4E38 001D1D98 94 21 FF E0 */ stwu r1, -0x20(r1) /* 801D4E3C 001D1D9C 7C 08 02 A6 */ mflr r0 /* 801D4E40 001D1DA0 90 01 00 24 */ stw r0, 0x24(r1) @@ -1742,7 +1742,7 @@ lbl_801D4F04: /* 801D4F40 001D1EA0 41 82 00 14 */ beq lbl_801D4F54 /* 801D4F44 001D1EA4 7F C4 F3 78 */ mr r4, r30 /* 801D4F48 001D1EA8 7F E5 FB 78 */ mr r5, r31 -/* 801D4F4C 001D1EAC 4B F0 CF 6D */ bl __ct__14CScriptMailboxFR12CInputStreamRC10CSaveWorld +/* 801D4F4C 001D1EAC 4B F0 CF 6D */ bl __ct__14CScriptMailboxFR12CInputStreamRC18CWorldSaveGameInfo /* 801D4F50 001D1EB0 7C 7C 1B 78 */ mr r28, r3 lbl_801D4F54: /* 801D4F54 001D1EB4 38 7D 00 08 */ addi r3, r29, 8 @@ -1769,7 +1769,7 @@ lbl_801D4F84: /* 801D4FA4 001D1F04 80 DD 00 00 */ lwz r6, 0(r29) /* 801D4FA8 001D1F08 7F C4 F3 78 */ mr r4, r30 /* 801D4FAC 001D1F0C 7F E5 FB 78 */ mr r5, r31 -/* 801D4FB0 001D1F10 4B F9 3F 95 */ bl __ct__13CMapWorldInfoFR16CBitStreamReaderRC10CSaveWorldUi +/* 801D4FB0 001D1F10 4B F9 3F 95 */ bl __ct__13CMapWorldInfoFR16CBitStreamReaderRC18CWorldSaveGameInfoUi /* 801D4FB4 001D1F14 7C 7C 1B 78 */ mr r28, r3 lbl_801D4FB8: /* 801D4FB8 001D1F18 38 7D 00 0C */ addi r3, r29, 0xc @@ -1795,7 +1795,7 @@ lbl_801D4FE8: /* 801D5004 001D1F64 41 82 00 14 */ beq lbl_801D5018 /* 801D5008 001D1F68 7F C4 F3 78 */ mr r4, r30 /* 801D500C 001D1F6C 7F E5 FB 78 */ mr r5, r31 -/* 801D5010 001D1F70 48 05 F4 11 */ bl __ct__16CWorldLayerStateFR16CBitStreamReaderRC10CSaveWorld +/* 801D5010 001D1F70 48 05 F4 11 */ bl __ct__16CWorldLayerStateFR16CBitStreamReaderRC18CWorldSaveGameInfo /* 801D5014 001D1F74 7C 7C 1B 78 */ mr r28, r3 lbl_801D5018: /* 801D5018 001D1F78 38 7D 00 14 */ addi r3, r29, 0x14 diff --git a/asm/MetroidPrime/Player/CWorldLayerState.s b/asm/MetroidPrime/Player/CWorldLayerState.s index 0e2a9b95..bff06b78 100644 --- a/asm/MetroidPrime/Player/CWorldLayerState.s +++ b/asm/MetroidPrime/Player/CWorldLayerState.s @@ -356,8 +356,8 @@ lbl_80234404: /* 80234418 00231378 38 21 00 40 */ addi r1, r1, 0x40 /* 8023441C 0023137C 4E 80 00 20 */ blr -.global __ct__16CWorldLayerStateFR16CBitStreamReaderRC10CSaveWorld -__ct__16CWorldLayerStateFR16CBitStreamReaderRC10CSaveWorld: +.global __ct__16CWorldLayerStateFR16CBitStreamReaderRC18CWorldSaveGameInfo +__ct__16CWorldLayerStateFR16CBitStreamReaderRC18CWorldSaveGameInfo: /* 80234420 00231380 94 21 FF E0 */ stwu r1, -0x20(r1) /* 80234424 00231384 7C 08 02 A6 */ mflr r0 /* 80234428 00231388 90 01 00 24 */ stw r0, 0x24(r1) diff --git a/asm/MetroidPrime/Player/CSaveWorld.s b/asm/MetroidPrime/Player/CWorldSaveGameInfo.s similarity index 100% rename from asm/MetroidPrime/Player/CSaveWorld.s rename to asm/MetroidPrime/Player/CWorldSaveGameInfo.s diff --git a/asm/MetroidPrime/ScriptObjects/CScriptMemoryRelay.s b/asm/MetroidPrime/ScriptObjects/CScriptMemoryRelay.s index a8ec0ecc..6719e08d 100644 --- a/asm/MetroidPrime/ScriptObjects/CScriptMemoryRelay.s +++ b/asm/MetroidPrime/ScriptObjects/CScriptMemoryRelay.s @@ -59,7 +59,7 @@ lbl_80241968: /* 80241974 0023E8D4 80 7F 08 BC */ lwz r3, 0x8bc(r31) /* 80241978 0023E8D8 90 01 00 14 */ stw r0, 0x14(r1) /* 8024197C 0023E8DC 80 63 00 00 */ lwz r3, 0(r3) -/* 80241980 0023E8E0 4B EA 01 8D */ bl AddRelay__14CScriptMailboxF9TEditorId +/* 80241980 0023E8E0 4B EA 01 8D */ bl AddMsg__14CScriptMailboxF9TEditorId /* 80241984 0023E8E4 88 1E 00 34 */ lbz r0, 0x34(r30) /* 80241988 0023E8E8 54 00 D7 FF */ rlwinm. r0, r0, 0x1a, 0x1f, 0x1f /* 8024198C 0023E8EC 40 82 00 54 */ bne lbl_802419E0 @@ -76,7 +76,7 @@ lbl_802419A8: /* 802419B4 0023E914 80 7F 08 BC */ lwz r3, 0x8bc(r31) /* 802419B8 0023E918 90 01 00 0C */ stw r0, 0xc(r1) /* 802419BC 0023E91C 80 63 00 00 */ lwz r3, 0(r3) -/* 802419C0 0023E920 4B EA 00 C5 */ bl RemoveRelay__14CScriptMailboxF9TEditorId +/* 802419C0 0023E920 4B EA 00 C5 */ bl RemoveMsg__14CScriptMailboxF9TEditorId /* 802419C4 0023E924 48 00 00 1C */ b lbl_802419E0 lbl_802419C8: /* 802419C8 0023E928 A0 05 00 00 */ lhz r0, 0(r5) diff --git a/configure.py b/configure.py index e3a4f6c7..743edc85 100755 --- a/configure.py +++ b/configure.py @@ -346,7 +346,7 @@ LIBS = [ "MetroidPrime/Enemies/CAtomicAlpha", "MetroidPrime/CLogBookScreen", ["MetroidPrime/CGBASupport", True], - "MetroidPrime/Player/CSaveWorld", + "MetroidPrime/Player/CWorldSaveGameInfo", ["MetroidPrime/ScriptObjects/CScriptCameraHintTrigger", True], ["MetroidPrime/Enemies/CAmbientAI", True], ["MetroidPrime/CMemoryCardDriver", False], @@ -365,7 +365,7 @@ LIBS = [ "MetroidPrime/Enemies/CWallWalker", "MetroidPrime/CErrorOutputWindow", "MetroidPrime/CRainSplashGenerator", - "MetroidPrime/Factories/CSaveWorldFactory", + "MetroidPrime/Factories/CWorldSaveGameInfoFactory", "MetroidPrime/CFluidPlaneRender", "MetroidPrime/Enemies/CBurrower", "MetroidPrime/Enemies/CMetroidPrimeExo", diff --git a/include/MetroidPrime/CScriptMailbox.hpp b/include/MetroidPrime/CScriptMailbox.hpp index 73cabf16..52723592 100644 --- a/include/MetroidPrime/CScriptMailbox.hpp +++ b/include/MetroidPrime/CScriptMailbox.hpp @@ -3,10 +3,25 @@ #include "MetroidPrime/TGameTypes.hpp" +#include "rstl/reserved_vector.hpp" + +class CWorldSaveGameInfo; +class CInputStream; +class COutputStream; +class CStateManager; class CScriptMailbox { public: - void AddRelay(TEditorId id); - void RemoveRelay(TEditorId id); + CScriptMailbox(); + CScriptMailbox(CInputStream& in, const CWorldSaveGameInfo& world); + ~CScriptMailbox(); + void PutTo(COutputStream& out, CWorldSaveGameInfo& world) const; + void SendMsgs(const TAreaId& area, CStateManager& mgr); + void AddMsg(TEditorId id); + void RemoveMsg(TEditorId id); + bool HasMsg(TEditorId id) const; + +private: + rstl::reserved_vector< TEditorId, 512 > x0_relays; }; #endif // _CSCRIPTMAILBOX diff --git a/include/MetroidPrime/TGameTypes.hpp b/include/MetroidPrime/TGameTypes.hpp index 8ed8c521..ed22b40d 100644 --- a/include/MetroidPrime/TGameTypes.hpp +++ b/include/MetroidPrime/TGameTypes.hpp @@ -32,14 +32,14 @@ struct TEditorId { TEditorId(uint value) : value(value) {} TEditorId(CInputStream& in); // TODO - uint Value() const { return value; } + uint Value() const { return value & 0x3FFFFFF; } uint Id() const { return value; } uint AreaNum() const { return value; } void PutTo(COutputStream&) const; - bool operator==(const TEditorId& other) const { return value == other.value; } - bool operator!=(const TEditorId& other) const { return value != other.value; } + bool operator==(const TEditorId& other) const { return Value() == other.Value(); } + bool operator!=(const TEditorId& other) const { return Value() != other.Value(); } }; CHECK_SIZEOF(TEditorId, 0x4) diff --git a/include/rstl/reserved_vector.hpp b/include/rstl/reserved_vector.hpp index cb921355..19338482 100644 --- a/include/rstl/reserved_vector.hpp +++ b/include/rstl/reserved_vector.hpp @@ -70,6 +70,7 @@ public: inline const T& back() const { return data()[x0_count - 1]; } inline T& operator[](int idx) { return data()[idx]; } inline const T& operator[](int idx) const { return data()[idx]; } + iterator erase(iterator it) {} }; } // namespace rstl diff --git a/obj_files.mk b/obj_files.mk index f2c52ca0..bd80e8d1 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -311,7 +311,7 @@ METROIDPRIME :=\ $(BUILD_DIR)/asm/MetroidPrime/Enemies/CAtomicAlpha.o\ $(BUILD_DIR)/asm/MetroidPrime/CLogBookScreen.o\ $(BUILD_DIR)/src/MetroidPrime/CGBASupport.o\ - $(BUILD_DIR)/asm/MetroidPrime/Player/CSaveWorld.o\ + $(BUILD_DIR)/asm/MetroidPrime/Player/CWorldSaveGameInfo.o\ $(BUILD_DIR)/src/MetroidPrime/ScriptObjects/CScriptCameraHintTrigger.o\ $(BUILD_DIR)/asm/MetroidPrime/Enemies/CAmbientAI.o\ $(BUILD_DIR)/asm/MetroidPrime/CMemoryCardDriver.o\ @@ -330,7 +330,7 @@ METROIDPRIME :=\ $(BUILD_DIR)/asm/MetroidPrime/Enemies/CWallWalker.o\ $(BUILD_DIR)/asm/MetroidPrime/CErrorOutputWindow.o\ $(BUILD_DIR)/asm/MetroidPrime/CRainSplashGenerator.o\ - $(BUILD_DIR)/asm/MetroidPrime/Factories/CSaveWorldFactory.o\ + $(BUILD_DIR)/asm/MetroidPrime/Factories/CWorldSaveGameInfoFactory.o\ $(BUILD_DIR)/asm/MetroidPrime/CFluidPlaneRender.o\ $(BUILD_DIR)/asm/MetroidPrime/Enemies/CBurrower.o\ $(BUILD_DIR)/asm/MetroidPrime/Enemies/CMetroidPrimeExo.o\ diff --git a/src/MetroidPrime/CScriptMailbox.cpp b/src/MetroidPrime/CScriptMailbox.cpp new file mode 100644 index 00000000..9321753b --- /dev/null +++ b/src/MetroidPrime/CScriptMailbox.cpp @@ -0,0 +1,39 @@ +#include "MetroidPrime/CScriptMailbox.hpp" + +#include "Kyoto/Streams/CInputStream.hpp" + +CScriptMailbox::CScriptMailbox() { CMemory::OffsetFakeStatics(sizeof(*this)); } + +CScriptMailbox::CScriptMailbox(CInputStream& in, const CWorldSaveGameInfo& world) { + CMemory::OffsetFakeStatics(sizeof(*this)); +} + +CScriptMailbox::~CScriptMailbox() { CMemory::OffsetFakeStatics(-sizeof(*this)); } + +void CScriptMailbox::PutTo(COutputStream& out, CWorldSaveGameInfo& world) const {} + +void CScriptMailbox::SendMsgs(const TAreaId& area, CStateManager& mgr) {} + +void CScriptMailbox::AddMsg(TEditorId id) { + rstl::reserved_vector< TEditorId, 512 >::iterator iter = x0_relays.begin(); + for (; iter != x0_relays.end(); ++iter) { + if (*iter == id) { + return; + } + } + + x0_relays.push_back(id); +} + +void CScriptMailbox::RemoveMsg(TEditorId id) {} + +bool CScriptMailbox::HasMsg(TEditorId id) const { + rstl::reserved_vector< TEditorId, 512 >::const_iterator iter = x0_relays.begin(); + for (; iter != x0_relays.end(); ++iter) { + if (*iter == id) { + return true; + } + } + + return false; +} diff --git a/src/MetroidPrime/ScriptObjects/CScriptMemoryRelay.cpp b/src/MetroidPrime/ScriptObjects/CScriptMemoryRelay.cpp index ef17b025..037cef24 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptMemoryRelay.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptMemoryRelay.cpp @@ -19,14 +19,14 @@ void CScriptMemoryRelay::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId obj switch (msg) { case kSM_Activate: - stateMgr.Mailbox()->AddRelay(GetEditorId()); + stateMgr.Mailbox()->AddMsg(GetEditorId()); if (!x34_25_skipSendActive) { SendScriptMsgs(kSS_Active, stateMgr, kSM_None); } break; case kSM_Deactivate: - stateMgr.Mailbox()->RemoveRelay(GetEditorId()); + stateMgr.Mailbox()->RemoveMsg(GetEditorId()); break; default: