Various rstl fixes; continue CScriptMazeNode & CScriptPlatform

Former-commit-id: 7608f27ed2
This commit is contained in:
Luke Street 2022-09-18 13:51:07 -04:00
parent 0d94a5a5f3
commit f6f1040fff
25 changed files with 171 additions and 96 deletions

View File

@ -626,8 +626,8 @@ sub_80044008:
/* 80044028 00040F88 90 03 0F 04 */ stw r0, 0xf04(r3)
/* 8004402C 00040F8C 4E 80 00 20 */ blr
.global "SetCurrentMaze__13CStateManagerFRCQ24rstl24single_ptr<10CMazeState>"
"SetCurrentMaze__13CStateManagerFRCQ24rstl24single_ptr<10CMazeState>":
.global "SetCurrentMaze__13CStateManagerFQ24rstl24single_ptr<10CMazeState>"
"SetCurrentMaze__13CStateManagerFQ24rstl24single_ptr<10CMazeState>":
/* 80044030 00040F90 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 80044034 00040F94 7C 08 02 A6 */ mflr r0
/* 80044038 00040F98 90 01 00 14 */ stw r0, 0x14(r1)

View File

@ -802,7 +802,7 @@ lbl_801F4584:
/* 801F4584 001F14E4 7F A5 EB 78 */ mr r5, r29
/* 801F4588 001F14E8 38 61 00 10 */ addi r3, r1, 0x10
/* 801F458C 001F14EC 3B 18 00 01 */ addi r24, r24, 1
/* 801F4590 001F14F0 4B E8 2B A5 */ bl NextWaypoint__15CScriptWaypointCFR13CStateManager
/* 801F4590 001F14F0 4B E8 2B A5 */ bl NextWaypoint__15CScriptWaypointCFRC13CStateManager
/* 801F4594 001F14F4 A0 01 00 10 */ lhz r0, 0x10(r1)
/* 801F4598 001F14F8 7F A3 EB 78 */ mr r3, r29
/* 801F459C 001F14FC 38 81 00 14 */ addi r4, r1, 0x14
@ -951,7 +951,7 @@ lbl_801F479C:
/* 801F47A8 001F1708 38 61 00 08 */ addi r3, r1, 8
/* 801F47AC 001F170C 38 06 00 01 */ addi r0, r6, 1
/* 801F47B0 001F1710 90 1C 03 90 */ stw r0, 0x390(r28)
/* 801F47B4 001F1714 4B E8 29 81 */ bl NextWaypoint__15CScriptWaypointCFR13CStateManager
/* 801F47B4 001F1714 4B E8 29 81 */ bl NextWaypoint__15CScriptWaypointCFRC13CStateManager
/* 801F47B8 001F1718 A0 01 00 08 */ lhz r0, 8(r1)
/* 801F47BC 001F171C 7F A3 EB 78 */ mr r3, r29
/* 801F47C0 001F1720 38 81 00 0C */ addi r4, r1, 0xc
@ -1746,7 +1746,7 @@ UpdateDest__10CPatternedFR13CStateManager:
/* 801F52FC 001F225C 7F E4 FB 78 */ mr r4, r31
/* 801F5300 001F2260 7F 85 E3 78 */ mr r5, r28
/* 801F5304 001F2264 38 61 00 20 */ addi r3, r1, 0x20
/* 801F5308 001F2268 4B E8 1E 2D */ bl NextWaypoint__15CScriptWaypointCFR13CStateManager
/* 801F5308 001F2268 4B E8 1E 2D */ bl NextWaypoint__15CScriptWaypointCFRC13CStateManager
/* 801F530C 001F226C A0 01 00 20 */ lhz r0, 0x20(r1)
/* 801F5310 001F2270 B0 1B 02 DC */ sth r0, 0x2dc(r27)
/* 801F5314 001F2274 A0 7B 02 DC */ lhz r3, 0x2dc(r27)
@ -1846,7 +1846,7 @@ lbl_801F5480:
/* 801F5488 001F23E8 7F C4 F3 78 */ mr r4, r30
/* 801F548C 001F23EC 7F 85 E3 78 */ mr r5, r28
/* 801F5490 001F23F0 38 61 00 18 */ addi r3, r1, 0x18
/* 801F5494 001F23F4 4B E8 1C A1 */ bl NextWaypoint__15CScriptWaypointCFR13CStateManager
/* 801F5494 001F23F4 4B E8 1C A1 */ bl NextWaypoint__15CScriptWaypointCFRC13CStateManager
/* 801F5498 001F23F8 A0 61 00 18 */ lhz r3, 0x18(r1)
/* 801F549C 001F23FC A0 0D A3 8C */ lhz r0, kInvalidUniqueId@sda21(r13)
/* 801F54A0 001F2400 B0 61 00 28 */ sth r3, 0x28(r1)

View File

@ -4542,7 +4542,7 @@ lbl_802746C0:
lbl_8027470C:
/* 8027470C 0027166C 7F C5 F3 78 */ mr r5, r30
/* 80274710 00271670 38 61 00 08 */ addi r3, r1, 8
/* 80274714 00271674 4B E0 2A 21 */ bl NextWaypoint__15CScriptWaypointCFR13CStateManager
/* 80274714 00271674 4B E0 2A 21 */ bl NextWaypoint__15CScriptWaypointCFRC13CStateManager
/* 80274718 00271678 A0 01 00 08 */ lhz r0, 8(r1)
/* 8027471C 0027167C B0 01 00 14 */ sth r0, 0x14(r1)
lbl_80274720:
@ -7045,7 +7045,7 @@ lbl_80276AC8:
lbl_80276AEC:
/* 80276AEC 00273A4C 7F A5 EB 78 */ mr r5, r29
/* 80276AF0 00273A50 38 61 00 08 */ addi r3, r1, 8
/* 80276AF4 00273A54 4B E0 06 41 */ bl NextWaypoint__15CScriptWaypointCFR13CStateManager
/* 80276AF4 00273A54 4B E0 06 41 */ bl NextWaypoint__15CScriptWaypointCFRC13CStateManager
/* 80276AF8 00273A58 A0 01 00 08 */ lhz r0, 8(r1)
/* 80276AFC 00273A5C B0 01 00 14 */ sth r0, 0x14(r1)
/* 80276B00 00273A60 48 00 00 0C */ b lbl_80276B0C

View File

@ -7980,7 +7980,7 @@ lbl_80258EEC:
/* 80258F4C 00255EAC 7F 44 D3 78 */ mr r4, r26
/* 80258F50 00255EB0 7F C5 F3 78 */ mr r5, r30
/* 80258F54 00255EB4 38 61 00 78 */ addi r3, r1, 0x78
/* 80258F58 00255EB8 4B E1 E1 DD */ bl NextWaypoint__15CScriptWaypointCFR13CStateManager
/* 80258F58 00255EB8 4B E1 E1 DD */ bl NextWaypoint__15CScriptWaypointCFRC13CStateManager
/* 80258F5C 00255EBC A0 01 00 78 */ lhz r0, 0x78(r1)
/* 80258F60 00255EC0 7F C3 F3 78 */ mr r3, r30
/* 80258F64 00255EC4 38 81 00 7C */ addi r4, r1, 0x7c
@ -8029,7 +8029,7 @@ lbl_80258EEC:
/* 80259010 00255F70 D0 A1 01 A4 */ stfs f5, 0x1a4(r1)
/* 80259014 00255F74 D0 C1 01 A8 */ stfs f6, 0x1a8(r1)
/* 80259018 00255F78 D0 1F 0A B8 */ stfs f0, 0xab8(r31)
/* 8025901C 00255F7C 4B E1 E1 19 */ bl NextWaypoint__15CScriptWaypointCFR13CStateManager
/* 8025901C 00255F7C 4B E1 E1 19 */ bl NextWaypoint__15CScriptWaypointCFRC13CStateManager
/* 80259020 00255F80 A0 01 00 70 */ lhz r0, 0x70(r1)
/* 80259024 00255F84 7F C3 F3 78 */ mr r3, r30
/* 80259028 00255F88 38 81 00 74 */ addi r4, r1, 0x74

View File

@ -5141,7 +5141,7 @@ lbl_801DE780:
/* 801DE7B8 001DB718 7F E5 FB 78 */ mr r5, r31
/* 801DE7BC 001DB71C 38 61 00 0C */ addi r3, r1, 0xc
/* 801DE7C0 001DB720 7E 64 9B 78 */ mr r4, r19
/* 801DE7C4 001DB724 4B E9 89 71 */ bl NextWaypoint__15CScriptWaypointCFR13CStateManager
/* 801DE7C4 001DB724 4B E9 89 71 */ bl NextWaypoint__15CScriptWaypointCFRC13CStateManager
/* 801DE7C8 001DB728 A0 01 00 0C */ lhz r0, 0xc(r1)
/* 801DE7CC 001DB72C 7F E3 FB 78 */ mr r3, r31
/* 801DE7D0 001DB730 38 81 00 10 */ addi r4, r1, 0x10

View File

@ -1627,7 +1627,7 @@ MoveToWayPoint__17CWallCrawlerSwarmFRQ217CWallCrawlerSwarm5CBoidR13CStateManager
/* 801E8AB8 001E5A18 40 80 00 80 */ bge lbl_801E8B38
/* 801E8ABC 001E5A1C 7F A5 EB 78 */ mr r5, r29
/* 801E8AC0 001E5A20 38 61 00 0C */ addi r3, r1, 0xc
/* 801E8AC4 001E5A24 4B E8 E6 71 */ bl NextWaypoint__15CScriptWaypointCFR13CStateManager
/* 801E8AC4 001E5A24 4B E8 E6 71 */ bl NextWaypoint__15CScriptWaypointCFRC13CStateManager
/* 801E8AC8 001E5A28 A0 01 00 0C */ lhz r0, 0xc(r1)
/* 801E8ACC 001E5A2C B0 1C 00 3C */ sth r0, 0x3c(r28)
/* 801E8AD0 001E5A30 A0 7C 00 3C */ lhz r3, 0x3c(r28)

View File

@ -345,7 +345,7 @@ GotoNextWaypoint__11CWallWalkerFR13CStateManager:
/* 80268798 002656F8 7F E4 FB 78 */ mr r4, r31
/* 8026879C 002656FC 7F C5 F3 78 */ mr r5, r30
/* 802687A0 00265700 38 61 00 10 */ addi r3, r1, 0x10
/* 802687A4 00265704 4B E0 E9 91 */ bl NextWaypoint__15CScriptWaypointCFR13CStateManager
/* 802687A4 00265704 4B E0 E9 91 */ bl NextWaypoint__15CScriptWaypointCFRC13CStateManager
/* 802687A8 00265708 A0 01 00 10 */ lhz r0, 0x10(r1)
/* 802687AC 0026570C C0 22 BB 04 */ lfs f1, lbl_805AD824@sda21(r2)
/* 802687B0 00265710 B0 1D 02 DC */ sth r0, 0x2dc(r29)

View File

@ -196,7 +196,7 @@ lbl_801EF36C:
/* 801EF3D0 001EC330 7F A5 EB 78 */ mr r5, r29
/* 801EF3D4 001EC334 38 61 00 08 */ addi r3, r1, 8
/* 801EF3D8 001EC338 B0 1F 01 0C */ sth r0, 0x10c(r31)
/* 801EF3DC 001EC33C 4B E8 7D 59 */ bl NextWaypoint__15CScriptWaypointCFR13CStateManager
/* 801EF3DC 001EC33C 4B E8 7D 59 */ bl NextWaypoint__15CScriptWaypointCFRC13CStateManager
/* 801EF3E0 001EC340 A0 01 00 08 */ lhz r0, 8(r1)
/* 801EF3E4 001EC344 B0 1F 01 0E */ sth r0, 0x10e(r31)
/* 801EF3E8 001EC348 48 00 00 20 */ b lbl_801EF408

View File

@ -261,7 +261,7 @@ lbl_80288A7C:
/* 80288ADC 00285A3C 7F C3 F3 78 */ mr r3, r30
/* 80288AE0 00285A40 38 81 00 58 */ addi r4, r1, 0x58
/* 80288AE4 00285A44 90 01 00 5C */ stw r0, 0x5c(r1)
/* 80288AE8 00285A48 4B DB B5 49 */ bl "SetCurrentMaze__13CStateManagerFRCQ24rstl24single_ptr<10CMazeState>"
/* 80288AE8 00285A48 4B DB B5 49 */ bl "SetCurrentMaze__13CStateManagerFQ24rstl24single_ptr<10CMazeState>"
/* 80288AEC 00285A4C 80 61 00 58 */ lwz r3, 0x58(r1)
/* 80288AF0 00285A50 48 08 CE 41 */ bl Free__7CMemoryFPCv
/* 80288AF4 00285A54 80 61 00 5C */ lwz r3, 0x5c(r1)
@ -739,7 +739,7 @@ lbl_802891AC:
/* 802891C0 00286120 7F C3 F3 78 */ mr r3, r30
/* 802891C4 00286124 90 01 00 40 */ stw r0, 0x40(r1)
/* 802891C8 00286128 38 81 00 40 */ addi r4, r1, 0x40
/* 802891CC 0028612C 4B DB AE 65 */ bl "SetCurrentMaze__13CStateManagerFRCQ24rstl24single_ptr<10CMazeState>"
/* 802891CC 0028612C 4B DB AE 65 */ bl "SetCurrentMaze__13CStateManagerFQ24rstl24single_ptr<10CMazeState>"
/* 802891D0 00286130 80 61 00 40 */ lwz r3, 0x40(r1)
/* 802891D4 00286134 48 08 C7 5D */ bl Free__7CMemoryFPCv
lbl_802891D8:

View File

@ -1618,7 +1618,7 @@ lbl_800B1FD0:
/* 800B2044 000AEFA4 80 9D 03 3C */ lwz r4, 0x33c(r29)
/* 800B2048 000AEFA8 38 7D 03 38 */ addi r3, r29, 0x338
/* 800B204C 000AEFAC 38 84 00 01 */ addi r4, r4, 1
/* 800B2050 000AEFB0 48 00 23 B5 */ bl sub_800b4404
/* 800B2050 000AEFB0 48 00 23 B5 */ bl "reserve__Q24rstl43vector<7SRiders,Q24rstl17rmemory_allocator>Fi"
/* 800B2054 000AEFB4 A0 1E 00 00 */ lhz r0, 0(r30)
/* 800B2058 000AEFB8 3B C1 00 38 */ addi r30, r1, 0x38
/* 800B205C 000AEFBC C0 02 8C CC */ lfs f0, lbl_805AA9EC@sda21(r2)
@ -1638,7 +1638,7 @@ lbl_800B1FD0:
/* 800B2094 000AEFF4 41 82 00 08 */ beq lbl_800B209C
/* 800B2098 000AEFF8 54 A4 08 3C */ slwi r4, r5, 1
lbl_800B209C:
/* 800B209C 000AEFFC 48 00 23 69 */ bl sub_800b4404
/* 800B209C 000AEFFC 48 00 23 69 */ bl "reserve__Q24rstl43vector<7SRiders,Q24rstl17rmemory_allocator>Fi"
lbl_800B20A0:
/* 800B20A0 000AF000 80 1D 03 3C */ lwz r0, 0x33c(r29)
/* 800B20A4 000AF004 80 7D 03 44 */ lwz r3, 0x344(r29)
@ -1761,12 +1761,10 @@ AcceptScriptMsg__15CScriptPlatformF20EScriptObjectMessage9TUniqueIdR13CStateMana
/* 800B222C 000AF18C 7C 04 00 2E */ lwzx r0, r4, r0
/* 800B2230 000AF190 7C 09 03 A6 */ mtctr r0
/* 800B2234 000AF194 4E 80 04 20 */ bctr
.global lbl_800B2238
lbl_800B2238:
/* 800B2238 000AF198 7F E4 FB 78 */ mr r4, r31
/* 800B223C 000AF19C 48 00 08 15 */ bl BuildSlaveList__15CScriptPlatformFR13CStateManager
/* 800B2240 000AF1A0 48 00 03 3C */ b lbl_800B257C
.global lbl_800B2244
lbl_800B2244:
/* 800B2244 000AF1A4 A0 1E 00 00 */ lhz r0, 0(r30)
/* 800B2248 000AF1A8 7F 85 E3 78 */ mr r5, r28
@ -1775,13 +1773,11 @@ lbl_800B2244:
/* 800B2254 000AF1B4 B0 01 00 64 */ sth r0, 0x64(r1)
/* 800B2258 000AF1B8 48 00 15 79 */ bl "AddRider__15CScriptPlatformFRQ24rstl43vector<7SRiders,Q24rstl17rmemory_allocator>9TUniqueIdPC13CPhysicsActorR13CStateManager"
/* 800B225C 000AF1BC 48 00 03 20 */ b lbl_800B257C
.global lbl_800B2260
lbl_800B2260:
/* 800B2260 000AF1C0 C0 02 8C AC */ lfs f0, lbl_805AA9CC@sda21(r2)
/* 800B2264 000AF1C4 D0 1C 02 5C */ stfs f0, 0x25c(r28)
/* 800B2268 000AF1C8 48 06 91 11 */ bl Stop__13CPhysicsActorFv
/* 800B226C 000AF1CC 48 00 03 10 */ b lbl_800B257C
.global lbl_800B2270
lbl_800B2270:
/* 800B2270 000AF1D0 A0 1C 02 58 */ lhz r0, 0x258(r28)
/* 800B2274 000AF1D4 7F 84 E3 78 */ mr r4, r28
@ -1908,7 +1904,6 @@ lbl_800B2428:
/* 800B243C 000AF39C C0 03 00 08 */ lfs f0, 8(r3)
/* 800B2440 000AF3A0 D0 1C 02 78 */ stfs f0, 0x278(r28)
/* 800B2444 000AF3A4 48 00 01 38 */ b lbl_800B257C
.global lbl_800B2448
lbl_800B2448:
/* 800B2448 000AF3A8 A0 1C 02 58 */ lhz r0, 0x258(r28)
/* 800B244C 000AF3AC 7F 84 E3 78 */ mr r4, r28
@ -1946,7 +1941,6 @@ lbl_800B249C:
/* 800B24C8 000AF428 C0 03 00 E8 */ lfs f0, 0xe8(r3)
/* 800B24CC 000AF42C D0 1C 02 5C */ stfs f0, 0x25c(r28)
/* 800B24D0 000AF430 48 00 00 AC */ b lbl_800B257C
.global lbl_800B24D4
lbl_800B24D4:
/* 800B24D4 000AF434 88 1C 03 56 */ lbz r0, 0x356(r28)
/* 800B24D8 000AF438 38 60 00 00 */ li r3, 0
@ -1957,7 +1951,6 @@ lbl_800B24D4:
/* 800B24EC 000AF44C C0 1C 02 90 */ lfs f0, 0x290(r28)
/* 800B24F0 000AF450 D0 1C 02 98 */ stfs f0, 0x298(r28)
/* 800B24F4 000AF454 48 00 00 88 */ b lbl_800B257C
.global lbl_800B24F8
lbl_800B24F8:
/* 800B24F8 000AF458 88 1C 00 30 */ lbz r0, 0x30(r28)
/* 800B24FC 000AF45C 54 00 CF FF */ rlwinm. r0, r0, 0x19, 0x1f, 0x1f
@ -1980,7 +1973,6 @@ lbl_800B2524:
/* 800B253C 000AF49C C0 3C 02 68 */ lfs f1, 0x268(r28)
/* 800B2540 000AF4A0 48 14 F4 69 */ bl FadeInHelper__20CScriptColorModulateFR13CStateManager9TUniqueIdf
/* 800B2544 000AF4A4 48 00 00 38 */ b lbl_800B257C
.global lbl_800B2548
lbl_800B2548:
/* 800B2548 000AF4A8 A0 1C 00 08 */ lhz r0, 8(r28)
/* 800B254C 000AF4AC 7F E4 FB 78 */ mr r4, r31
@ -1991,13 +1983,11 @@ lbl_800B2548:
/* 800B2560 000AF4C0 C0 3C 02 6C */ lfs f1, 0x26c(r28)
/* 800B2564 000AF4C4 48 14 F2 15 */ bl FadeOutHelper__20CScriptColorModulateFR13CStateManager9TUniqueIdf
/* 800B2568 000AF4C8 48 00 00 14 */ b lbl_800B257C
.global lbl_800B256C
lbl_800B256C:
/* 800B256C 000AF4CC C0 22 8C D0 */ lfs f1, lbl_805AA9F0@sda21(r2)
/* 800B2570 000AF4D0 7F E4 FB 78 */ mr r4, r31
/* 800B2574 000AF4D4 38 7C 03 18 */ addi r3, r28, 0x318
/* 800B2578 000AF4D8 48 00 10 2D */ bl "DecayRiders__15CScriptPlatformFRQ24rstl43vector<7SRiders,Q24rstl17rmemory_allocator>fR13CStateManager"
.global lbl_800B257C
lbl_800B257C:
/* 800B257C 000AF4DC A0 1E 00 00 */ lhz r0, 0(r30)
/* 800B2580 000AF4E0 7F 83 E3 78 */ mr r3, r28
@ -2360,7 +2350,7 @@ BuildSlaveList__15CScriptPlatformFR13CStateManager:
/* 800B2A64 000AF9C4 7C 7C 1B 78 */ mr r28, r3
/* 800B2A68 000AF9C8 80 83 00 24 */ lwz r4, 0x24(r3)
/* 800B2A6C 000AF9CC 38 7C 03 28 */ addi r3, r28, 0x328
/* 800B2A70 000AF9D0 48 00 19 95 */ bl sub_800b4404
/* 800B2A70 000AF9D0 48 00 19 95 */ bl "reserve__Q24rstl43vector<7SRiders,Q24rstl17rmemory_allocator>Fi"
/* 800B2A74 000AF9D4 83 FC 00 2C */ lwz r31, 0x2c(r28)
/* 800B2A78 000AF9D8 3B C1 00 4C */ addi r30, r1, 0x4c
/* 800B2A7C 000AF9DC 48 00 01 E0 */ b lbl_800B2C5C
@ -2426,7 +2416,7 @@ lbl_800B2A80:
/* 800B2B68 000AFAC8 41 82 00 08 */ beq lbl_800B2B70
/* 800B2B6C 000AFACC 54 A4 08 3C */ slwi r4, r5, 1
lbl_800B2B70:
/* 800B2B70 000AFAD0 48 00 18 95 */ bl sub_800b4404
/* 800B2B70 000AFAD0 48 00 18 95 */ bl "reserve__Q24rstl43vector<7SRiders,Q24rstl17rmemory_allocator>Fi"
lbl_800B2B74:
/* 800B2B74 000AFAD4 80 1C 03 2C */ lwz r0, 0x32c(r28)
/* 800B2B78 000AFAD8 80 7C 03 34 */ lwz r3, 0x334(r28)
@ -3384,7 +3374,7 @@ lbl_800B3938:
/* 800B3938 000B0898 80 9B 00 04 */ lwz r4, 4(r27)
/* 800B393C 000B089C 7F 63 DB 78 */ mr r3, r27
/* 800B3940 000B08A0 38 84 00 01 */ addi r4, r4, 1
/* 800B3944 000B08A4 48 00 0A C1 */ bl sub_800b4404
/* 800B3944 000B08A4 48 00 0A C1 */ bl "reserve__Q24rstl43vector<7SRiders,Q24rstl17rmemory_allocator>Fi"
/* 800B3948 000B08A8 80 1B 00 04 */ lwz r0, 4(r27)
/* 800B394C 000B08AC 80 BB 00 08 */ lwz r5, 8(r27)
/* 800B3950 000B08B0 7C 00 28 00 */ cmpw r0, r5
@ -3395,7 +3385,7 @@ lbl_800B3938:
/* 800B3964 000B08C4 41 82 00 08 */ beq lbl_800B396C
/* 800B3968 000B08C8 54 A4 08 3C */ slwi r4, r5, 1
lbl_800B396C:
/* 800B396C 000B08CC 48 00 0A 99 */ bl sub_800b4404
/* 800B396C 000B08CC 48 00 0A 99 */ bl "reserve__Q24rstl43vector<7SRiders,Q24rstl17rmemory_allocator>Fi"
lbl_800B3970:
/* 800B3970 000B08D0 80 1B 00 04 */ lwz r0, 4(r27)
/* 800B3974 000B08D4 80 7B 00 0C */ lwz r3, 0xc(r27)
@ -3454,7 +3444,7 @@ GetNext__15CScriptPlatformF9TUniqueIdR13CStateManager:
lbl_800B3A30:
/* 800B3A30 000B0990 7F E5 FB 78 */ mr r5, r31
/* 800B3A34 000B0994 38 61 00 0C */ addi r3, r1, 0xc
/* 800B3A38 000B0998 4B FC 36 FD */ bl NextWaypoint__15CScriptWaypointCFR13CStateManager
/* 800B3A38 000B0998 4B FC 36 FD */ bl NextWaypoint__15CScriptWaypointCFRC13CStateManager
/* 800B3A3C 000B099C A0 01 00 0C */ lhz r0, 0xc(r1)
/* 800B3A40 000B09A0 7F E3 FB 78 */ mr r3, r31
/* 800B3A44 000B09A4 38 81 00 08 */ addi r4, r1, 8
@ -4131,8 +4121,8 @@ lbl_800B43CC:
/* 800B43FC 000B135C B0 03 00 02 */ sth r0, 2(r3)
/* 800B4400 000B1360 4E 80 00 20 */ blr
.global sub_800b4404
sub_800b4404:
.global "reserve__Q24rstl43vector<7SRiders,Q24rstl17rmemory_allocator>Fi"
"reserve__Q24rstl43vector<7SRiders,Q24rstl17rmemory_allocator>Fi":
/* 800B4404 000B1364 94 21 FF D0 */ stwu r1, -0x30(r1)
/* 800B4408 000B1368 7C 08 02 A6 */ mflr r0
/* 800B440C 000B136C 90 01 00 34 */ stw r0, 0x34(r1)

View File

@ -126,8 +126,8 @@ lbl_80077120:
/* 8007712C 0007408C 38 21 00 20 */ addi r1, r1, 0x20
/* 80077130 00074090 4E 80 00 20 */ blr
.global NextWaypoint__15CScriptWaypointCFR13CStateManager
NextWaypoint__15CScriptWaypointCFR13CStateManager:
.global NextWaypoint__15CScriptWaypointCFRC13CStateManager
NextWaypoint__15CScriptWaypointCFRC13CStateManager:
/* 80077134 00074094 94 21 FF A0 */ stwu r1, -0x60(r1)
/* 80077138 00074098 7C 08 02 A6 */ mflr r0
/* 8007713C 0007409C 90 01 00 64 */ stw r0, 0x64(r1)

View File

@ -74,6 +74,7 @@ private:
static const CColor sPurpleColor;
static const CColor sOrangeColor;
};
CHECK_SIZEOF(CColor, 0x4)
#ifdef __MWERKS__
#pragma cpp_extensions off

View File

@ -75,7 +75,7 @@ public:
// Translate__12CTransform4fFfff
// Translate__12CTransform4fFRC9CVector3f
// TransposeMultiply__12CTransform4fCFRC9CVector3f
// TransposeRotate__12CTransform4fCFRC9CVector3f
CVector3f TransposeRotate(const CVector3f& in) const;
void SetTranslation(const CVector3f& vec) {
posX = vec.GetX();

View File

@ -87,5 +87,6 @@ private:
rstl::optional_object< TCachedToken< CModel > > x2c_xrayModel;
rstl::optional_object< TCachedToken< CModel > > x3c_infraModel;
};
CHECK_SIZEOF(CModelData, 0x4c)
#endif

View File

@ -55,7 +55,7 @@ public:
CMazeState* CurrentMaze();
const CMazeState* GetCurrentMaze() const;
void SetCurrentMaze(const rstl::single_ptr< CMazeState >& maze);
void SetCurrentMaze(rstl::single_ptr< CMazeState > maze);
CCameraManager* CameraManager() { return x870_cameraManager; }
const CCameraManager* GetCameraManager() const { return x870_cameraManager; }

View File

@ -23,6 +23,10 @@ struct SRiders {
TUniqueId x0_uid;
f32 x4_decayTimer;
CTransform4f x8_transform;
SRiders(TUniqueId uid)
: x0_uid(uid), x4_decayTimer(1.f / 6.f), x8_transform(CTransform4f::Identity()) {}
bool operator==(const SRiders& other) const { return x0_uid == other.x0_uid; }
};
class CScriptPlatform : public CPhysicsActor {
@ -60,6 +64,12 @@ public:
virtual void SplashThink(const CAABox&, const CFluidPlane&, float, CStateManager&) const;
virtual CQuaternion Move(float, CStateManager&);
TUniqueId GetWaypoint(CStateManager& mgr);
TUniqueId GetNext(TUniqueId uid, CStateManager& mgr);
static void AddRider(rstl::vector< SRiders >& riders, TUniqueId riderId,
const CPhysicsActor* ridee, CStateManager& mgr);
private:
TUniqueId x258_currentWaypoint;
TUniqueId x25a_targetWaypoint;

View File

@ -0,0 +1,50 @@
#ifndef _CSCRIPTWAYPOINT_HPP
#define _CSCRIPTWAYPOINT_HPP
#include "types.h"
#include "MetroidPrime/CActor.hpp"
class CScriptWaypoint : public CActor {
public:
CScriptWaypoint(TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
const CTransform4f& xf, bool active, float speed, float pause,
uint patternTranslate, uint patternOrient, uint patternFit, uint behaviour,
uint behaviourOrient, uint behaviourModifiers, uint animation);
// CEntity
~CScriptWaypoint() override;
void Accept(IVisitor& visitor) override;
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override;
// CActor
void AddToRenderer(const CFrustumPlanes&, const CStateManager&) const override;
void Render(const CStateManager&) const override;
// CScriptWaypoint
TUniqueId NextWaypoint(const CStateManager& mgr) const;
void FollowWaypoint(const CStateManager& mgr) const;
f32 GetSpeed() const { return xe8_speed; }
uint GetAnimation() const { return xec_animation; }
f32 GetPause() const { return xf0_pause; }
u8 GetPatternTranslate() const { return xf4_patternTranslate; }
u8 GetPatternOrient() const { return xf5_patternOrient; }
u8 GetPatternFit() const { return xf6_patternFit; }
u8 GetBehaviour() const { return xf7_behaviour; }
u8 GetBehaviourOrient() const { return xf8_behaviourOrient; }
u16 GetBehaviourModifiers() const { return xfa_behaviourModifiers; }
private:
f32 xe8_speed;
uint xec_animation;
f32 xf0_pause;
u8 xf4_patternTranslate;
u8 xf5_patternOrient;
u8 xf6_patternFit;
u8 xf7_behaviour;
u8 xf8_behaviourOrient;
u16 xfa_behaviourModifiers;
};
#endif

View File

@ -98,11 +98,11 @@ private:
};
template < typename T >
const T* TCastToConstPtr(const CEntity* p) {
inline const T* TCastToConstPtr(const CEntity* p) {
return TCastToPtr< T >(const_cast< CEntity* >(p));
}
template < typename T >
const T* TCastToConstPtr(const CEntity& p) {
inline const T* TCastToConstPtr(const CEntity& p) {
return TCastToPtr< T >(const_cast< CEntity* >(&p));
}

View File

@ -16,11 +16,6 @@ inline const T& max_val(const T& a, const T& b) {
template < class Iter, class T >
inline Iter find(Iter first, Iter last, const T& val) {
return find(first, last, val, typename Iter::iterator_category());
}
template < class Iter, class T >
inline Iter find(Iter first, Iter last, const T& val, input_iterator_tag) {
while (first != last && !(*first == val))
++first;
return first;

View File

@ -44,7 +44,7 @@ public:
private:
u8 m_data[sizeof(T)];
bool m_valid;
bool m_valid ATTRIBUTE_ALIGN(4);
void assign(const T& item) {
if (!m_valid) {

View File

@ -14,14 +14,11 @@ struct random_access_iterator_tag : public bidirectional_iterator_tag {};
template < typename T, typename Vec, typename Alloc >
class const_pointer_iterator {
protected:
const T* current;
public:
typedef random_access_iterator_tag iterator_category;
const_pointer_iterator() : current(nullptr) {}
const_pointer_iterator(const T* begin) : current(begin) {}
const_pointer_iterator(const T* begin) : current(const_cast< T* >(begin)) {}
const_pointer_iterator& operator++() {
++current;
return *this;
@ -30,10 +27,8 @@ public:
--current;
return *this;
}
T* get_pointer() const { return const_cast< T* >(current); }
const T& operator*() const { return *get_pointer(); }
const T* operator->() const { return get_pointer(); }
bool CheckValid() const { return current != nullptr; }
const T& operator*() const { return *current; }
const T* operator->() const { return current; }
bool operator==(const const_pointer_iterator& other) { return current == other.current; }
bool operator!=(const const_pointer_iterator& other) { return current != other.current; }
@ -43,6 +38,9 @@ public:
friend const_pointer_iterator operator-(const const_pointer_iterator& x, int v) {
return const_pointer_iterator(x.current - v);
}
protected:
T* current;
};
template < typename T, typename Vec, typename Alloc >
@ -50,34 +48,28 @@ class pointer_iterator : public const_pointer_iterator< T, Vec, Alloc > {
public:
pointer_iterator() : const_pointer_iterator< T, Vec, Alloc >(nullptr) {}
pointer_iterator(T* begin) : const_pointer_iterator< T, Vec, Alloc >(begin) {}
void operator=(const T& other) {
if (this->CheckValid()) {
*get_pointer() = other;
}
}
T* get_pointer() const { return const_cast< T* >(this->current); }
// T* operator*() const { if (CheckValid()) return get_pointer(); else return
// nullptr; }
T* operator->() const { return get_pointer(); }
void operator=(const T& other) { rstl::construct(this->current, other); }
T& operator*() { return *this->current; }
T* operator->() { return this->current; }
void destroy() const {
if (this->CheckValid()) {
rstl::destroy(get_pointer());
if (this->current != nullptr) {
rstl::destroy(this->current);
}
}
pointer_iterator& operator++() {
++current;
++this->current;
return *this;
}
pointer_iterator& operator--() {
--current;
--this->current;
return *this;
}
friend pointer_iterator operator+(const pointer_iterator& x, int v) {
return pointer_iterator(x.get_pointer() + v);
return pointer_iterator(x.current + v);
}
friend pointer_iterator operator-(const pointer_iterator& x, int v) {
return pointer_iterator(x.get_pointer() - v);
return pointer_iterator(x.current - v);
}
};
} // namespace rstl

View File

@ -6,7 +6,7 @@
namespace rstl {
template < typename T >
class single_ptr {
T* x0_ptr;
mutable T* x0_ptr;
public:
single_ptr() : x0_ptr(nullptr) {}
@ -16,6 +16,9 @@ public:
// const T* get() const { return x0_ptr; }
T* operator->() { return x0_ptr; }
const T* operator->() const { return x0_ptr; }
single_ptr(const single_ptr& other) : x0_ptr(other.x0_ptr) {
other.x0_ptr = nullptr;
}
single_ptr& operator=(T* ptr) {
delete x0_ptr;
x0_ptr = ptr;

View File

@ -18,7 +18,13 @@ template < class T, int N >
struct check_sizeof : _n_is_equal< sizeof(T), N > {};
#ifdef __MWERKS__
#ifndef offsetof
typedef unsigned long size_t;
#define offsetof(type, member) ((size_t) & (((type*)0)->member))
#endif
#define CHECK_SIZEOF(cls, size) extern int cls##_check[check_sizeof< cls, size >::value];
#define CHECK_OFFSETOF(cls, member, offset) \
extern int cls##_check_offset##[_n_is_equal< offsetof(cls, member), offset >::value];
#else
#define CHECK_SIZEOF(cls, size)
#endif

View File

@ -272,6 +272,7 @@ void CScriptMazeNode::GenerateObjects(CStateManager& mgr) {
if (conn->x0_state != kSS_MaxReached || conn->x4_msg != kSM_Activate) {
continue;
}
CEntity* ent = mgr.ObjectById(mgr.GetIdForScript(conn->x8_objId));
CScriptEffect* scriptEffect = TCastToPtr< CScriptEffect >(ent);
CScriptActor* scriptActor = TCastToPtr< CScriptActor >(ent);
@ -282,12 +283,13 @@ void CScriptMazeNode::GenerateObjects(CStateManager& mgr) {
if (scriptEffect && x13c_25_hasGate) {
continue;
}
// TUniqueId objUid = GenerateObject(mgr, conn->x8_objId);
TUniqueId objUid = GenerateObject(mgr, conn->x8_objId);
// bool wasGeneratingObject = mgr.IsGeneratingObject();
// mgr.SetIsGeneratingObject(true);
// TUniqueId objUid = mgr.GenerateObject(conn->x8_objId).second;
// mgr.SetIsGeneratingObject(wasGeneratingObject);
bool wasGeneratingObject = mgr.IsGeneratingObject();
mgr.SetIsGeneratingObject(true);
TUniqueId objUid = mgr.GenerateObject(conn->x8_objId).second;
mgr.SetIsGeneratingObject(wasGeneratingObject);
if (CActor* actor = static_cast< CActor* >(mgr.ObjectById(objUid))) {
mgr.SendScriptMsg(actor, GetUniqueId(), kSM_Activate);
if (scriptEffect) {
@ -321,19 +323,6 @@ void CScriptMazeNode::SendScriptMsgs(CStateManager& mgr, EScriptObjectMessage ms
SendScriptMsg(mgr, mgr.ObjectById(xf4_gateEffectId), GetUniqueId(), msg);
}
template < typename Iter, typename T >
static inline Iter contains(Iter it, Iter end, const T& value) {
for (; it != end && *it != value; ++it) {
}
return it;
}
template < typename T >
static inline bool contains(const rstl::vector< T >& vec,
typename rstl::vector< T >::const_iterator end, const T& value) {
return rstl::find< rstl::vector< T >::const_iterator, T >(vec.begin(), end, value) != end;
}
void CScriptMazeNode::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
if (GetActive()) {
switch (msg) {
@ -344,7 +333,7 @@ void CScriptMazeNode::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C
maze->Reset(sMazeSeeds[mgr.GetActiveRandom()->Next() % 300]);
maze->Initialize();
maze->GenerateObstacles();
mgr.SetCurrentMaze(maze.release());
mgr.SetCurrentMaze(maze);
}
break;
}
@ -432,12 +421,8 @@ void CScriptMazeNode::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C
case kSM_SetToZero: {
CMazeState* maze = mgr.CurrentMaze();
if (x13c_24_hasPuddle && maze != nullptr) {
rstl::vector< TUniqueId >::const_iterator pend = x12c_puddleObjectIds.end();
rstl::vector< TUniqueId >::const_iterator pit =
rstl::find< rstl::vector< TUniqueId >::const_iterator, TUniqueId >(
x12c_puddleObjectIds.begin(), pend, uid);
if (pit != pend) {
// if (contains(x12c_puddleObjectIds, x12c_puddleObjectIds.end(), uid)) {
if (rstl::find(x12c_puddleObjectIds.begin(), x12c_puddleObjectIds.end(), uid) !=
x12c_puddleObjectIds.end()) {
rstl::vector< TUniqueId >::const_iterator it = x12c_puddleObjectIds.begin();
for (; it != x12c_puddleObjectIds.end(); ++it) {
if (CEntity* ent = mgr.ObjectById(*it)) {

View File

@ -2,11 +2,14 @@
#include "MetroidPrime/CActorParameters.hpp"
#include "MetroidPrime/CAnimData.hpp"
#include "MetroidPrime/ScriptObjects/CScriptWaypoint.hpp"
#include "Kyoto/Graphics/CGX.hpp"
#include "WorldFormat/CCollidableOBBTreeGroup.hpp"
#include "rstl/algorithm.hpp"
#ifndef TARGET_PC
struct GXData {
u16 cpSRreg;
@ -110,3 +113,42 @@ rstl::optional_object< CAABox > CScriptPlatform::GetTouchBounds() const {
return rstl::optional_object_null();
}
}
TUniqueId CScriptPlatform::GetWaypoint(CStateManager& mgr) {
rstl::vector< SConnection >::const_iterator conn = GetConnectionList().begin();
for (; conn != GetConnectionList().end(); ++conn) {
if (conn->x4_msg == kSM_Follow) {
return mgr.GetIdForScript(conn->x8_objId);
}
}
return kInvalidUniqueId;
}
TUniqueId CScriptPlatform::GetNext(TUniqueId uid, CStateManager& mgr) {
const CScriptWaypoint* nextWp = TCastToConstPtr< CScriptWaypoint >(mgr.GetObjectById(uid));
if (!nextWp) {
return GetWaypoint(mgr);
}
TUniqueId next = nextWp->NextWaypoint(mgr);
if (const CScriptWaypoint* wp = TCastToConstPtr< CScriptWaypoint >(mgr.GetObjectById(next))) {
x25c_currentSpeed = wp->GetSpeed();
}
return next;
}
void CScriptPlatform::AddRider(rstl::vector< SRiders >& riders, TUniqueId riderId,
const CPhysicsActor* ridee, CStateManager& mgr) {
rstl::vector< SRiders >::iterator it = rstl::find(riders.begin(), riders.end(), SRiders(riderId));
if (it == riders.end()) {
SRiders rider(riderId);
if (CPhysicsActor* act = TCastToPtr< CPhysicsActor >(mgr.ObjectById(riderId))) {
CVector3f rideePos = ridee->GetTranslation();
rider.x8_transform.SetTranslation(ridee->GetTransform().TransposeRotate(act->GetTranslation() - rideePos));
mgr.SendScriptMsg(act, ridee->GetUniqueId(), kSM_AddPlatformRider);
}
riders.reserve(riders.size() + 1);
riders.push_back(rider);
} else {
it->x4_decayTimer = 1.f / 6.f;
}
}