Lots of stuff

This commit is contained in:
Luke Street 2022-10-03 20:00:46 -04:00
parent 0acb1e0e40
commit 39b5f3c01e
47 changed files with 701 additions and 312 deletions

View File

@ -2140,10 +2140,10 @@ lbl_80026C0C:
/* 80026C4C 00023BAC 80 81 00 38 */ lwz r4, 0x38(r1)
/* 80026C50 00023BB0 80 63 00 00 */ lwz r3, 0(r3)
/* 80026C54 00023BB4 83 24 00 00 */ lwz r25, 0(r4)
/* 80026C58 00023BB8 48 06 A8 55 */ bl GetTotalPickupCount__12CPlayerStateFv
/* 80026C58 00023BB8 48 06 A8 55 */ bl GetTotalPickupCount__12CPlayerStateCFv
/* 80026C5C 00023BBC 7C 7A 1B 78 */ mr r26, r3
/* 80026C60 00023BC0 7F 23 CB 78 */ mr r3, r25
/* 80026C64 00023BC4 48 06 A5 D1 */ bl CalculateItemCollectionRate__12CPlayerStateFv
/* 80026C64 00023BC4 48 06 A5 D1 */ bl CalculateItemCollectionRate__12CPlayerStateCFv
/* 80026C68 00023BC8 1C 03 00 64 */ mulli r0, r3, 0x64
/* 80026C6C 00023BCC 38 61 00 34 */ addi r3, r1, 0x34
/* 80026C70 00023BD0 7F 00 D3 D6 */ divw r24, r0, r26

View File

@ -860,7 +860,7 @@ CollidedWith__12CAtomicAlphaFRC9TUniqueIdRC18CCollisionInfoListR13CStateManager:
/* 802454A8 00242408 B0 01 00 08 */ sth r0, 8(r1)
/* 802454AC 0024240C 80 63 00 00 */ lwz r3, 0(r3)
/* 802454B0 00242410 38 63 01 88 */ addi r3, r3, 0x188
/* 802454B4 00242414 4B F7 B6 85 */ bl AddSource__19CStaticInterferenceF9TUniqueId
/* 802454B4 00242414 4B F7 B6 85 */ bl AddSource__19CStaticInterferenceF9TUniqueIdff
/* 802454B8 00242418 C0 02 B8 44 */ lfs f0, lbl_805AD564@sda21(r2)
/* 802454BC 0024241C 38 7C 06 E0 */ addi r3, r28, 0x6e0
/* 802454C0 00242420 38 80 00 00 */ li r4, 0

View File

@ -537,7 +537,7 @@ lbl_80250ECC:
/* 80250F04 0024DE64 B0 01 00 10 */ sth r0, 0x10(r1)
/* 80250F08 0024DE68 80 63 00 00 */ lwz r3, 0(r3)
/* 80250F0C 0024DE6C 38 63 01 88 */ addi r3, r3, 0x188
/* 80250F10 0024DE70 4B F6 FC 29 */ bl AddSource__19CStaticInterferenceF9TUniqueId
/* 80250F10 0024DE70 4B F6 FC 29 */ bl AddSource__19CStaticInterferenceF9TUniqueIdff
lbl_80250F14:
/* 80250F14 0024DE74 7F C3 F3 78 */ mr r3, r30
/* 80250F18 0024DE78 FC 20 F8 90 */ fmr f1, f31

View File

@ -6191,7 +6191,7 @@ lbl_80164000:
/* 801640EC 0016104C B0 01 00 0C */ sth r0, 0xc(r1)
/* 801640F0 00161050 80 63 00 00 */ lwz r3, 0(r3)
/* 801640F4 00161054 38 63 01 88 */ addi r3, r3, 0x188
/* 801640F8 00161058 48 05 CA 41 */ bl AddSource__19CStaticInterferenceF9TUniqueId
/* 801640F8 00161058 48 05 CA 41 */ bl AddSource__19CStaticInterferenceF9TUniqueIdff
/* 801640FC 0016105C C0 22 9F 80 */ lfs f1, lbl_805ABCA0@sda21(r2)
/* 80164100 00161060 7E C5 B3 78 */ mr r5, r22
/* 80164104 00161064 C0 02 9F 68 */ lfs f0, lbl_805ABC88@sda21(r2)
@ -7073,7 +7073,7 @@ lbl_80164D84:
/* 80164D9C 00161CFC B0 01 00 20 */ sth r0, 0x20(r1)
/* 80164DA0 00161D00 80 63 00 00 */ lwz r3, 0(r3)
/* 80164DA4 00161D04 38 63 01 88 */ addi r3, r3, 0x188
/* 80164DA8 00161D08 48 05 BD 91 */ bl AddSource__19CStaticInterferenceF9TUniqueId
/* 80164DA8 00161D08 48 05 BD 91 */ bl AddSource__19CStaticInterferenceF9TUniqueIdff
lbl_80164DAC:
/* 80164DAC 00161D0C 88 1E 08 34 */ lbz r0, 0x834(r30)
/* 80164DB0 00161D10 54 00 EF FF */ rlwinm. r0, r0, 0x1d, 0x1f, 0x1f
@ -7114,7 +7114,7 @@ lbl_80164E1C:
/* 80164E34 00161D94 B0 01 00 10 */ sth r0, 0x10(r1)
/* 80164E38 00161D98 80 63 00 00 */ lwz r3, 0(r3)
/* 80164E3C 00161D9C 38 63 01 88 */ addi r3, r3, 0x188
/* 80164E40 00161DA0 48 05 BC F9 */ bl AddSource__19CStaticInterferenceF9TUniqueId
/* 80164E40 00161DA0 48 05 BC F9 */ bl AddSource__19CStaticInterferenceF9TUniqueIdff
lbl_80164E44:
/* 80164E44 00161DA4 88 1E 08 34 */ lbz r0, 0x834(r30)
/* 80164E48 00161DA8 54 00 EF FF */ rlwinm. r0, r0, 0x1d, 0x1f, 0x1f

View File

@ -749,8 +749,8 @@ lbl_801D7FA0:
/* 801D8038 001D4F98 EC 24 08 BA */ fmadds f1, f4, f2, f1
/* 801D803C 001D4F9C FC 01 00 40 */ fcmpo cr0, f1, f0
/* 801D8040 001D4FA0 40 81 00 34 */ ble lbl_801D8074
/* 801D8044 001D4FA4 C0 42 80 F8 */ lfs f2, lbl_805A9E18@sda21(r2)
/* 801D8048 001D4FA8 C0 62 80 FC */ lfs f3, lbl_805A9E1C@sda21(r2)
/* 801D8044 001D4FA4 C0 42 80 F8 */ lfs f2, skDefaultHudFadeOutSpeed__7CPlayer@sda21(r2)
/* 801D8048 001D4FA8 C0 62 80 FC */ lfs f3, skDefaultHudFadeInSpeed__7CPlayer@sda21(r2)
/* 801D804C 001D4FAC 4B E3 B0 21 */ bl SetHudDisable__7CPlayerFfff
/* 801D8050 001D4FB0 80 7F 08 4C */ lwz r3, 0x84c(r31)
/* 801D8054 001D4FB4 7F E6 FB 78 */ mr r6, r31
@ -771,7 +771,7 @@ lbl_801D8074:
/* 801D808C 001D4FEC B0 01 00 08 */ sth r0, 8(r1)
/* 801D8090 001D4FF0 80 63 00 00 */ lwz r3, 0(r3)
/* 801D8094 001D4FF4 38 63 01 88 */ addi r3, r3, 0x188
/* 801D8098 001D4FF8 4B FE 8A A1 */ bl AddSource__19CStaticInterferenceF9TUniqueId
/* 801D8098 001D4FF8 4B FE 8A A1 */ bl AddSource__19CStaticInterferenceF9TUniqueIdff
lbl_801D809C:
/* 801D809C 001D4FFC C0 1E 05 AC */ lfs f0, 0x5ac(r30)
/* 801D80A0 001D5000 D0 1E 03 40 */ stfs f0, 0x340(r30)
@ -1019,7 +1019,7 @@ lbl_801D835C:
/* 801D8404 001D5364 B0 01 00 10 */ sth r0, 0x10(r1)
/* 801D8408 001D5368 80 63 00 00 */ lwz r3, 0(r3)
/* 801D840C 001D536C 38 63 01 88 */ addi r3, r3, 0x188
/* 801D8410 001D5370 4B FE 87 29 */ bl AddSource__19CStaticInterferenceF9TUniqueId
/* 801D8410 001D5370 4B FE 87 29 */ bl AddSource__19CStaticInterferenceF9TUniqueIdff
/* 801D8414 001D5374 48 00 00 7C */ b lbl_801D8490
lbl_801D8418:
/* 801D8418 001D5378 3C 60 80 3E */ lis r3, lbl_803DAA68@ha

View File

@ -2660,14 +2660,14 @@ lbl_8016C09C:
/* 8016C0E8 00169048 B0 01 00 08 */ sth r0, 8(r1)
/* 8016C0EC 0016904C 80 63 00 00 */ lwz r3, 0(r3)
/* 8016C0F0 00169050 38 63 01 88 */ addi r3, r3, 0x188
/* 8016C0F4 00169054 48 05 4A 45 */ bl AddSource__19CStaticInterferenceF9TUniqueId
/* 8016C0F4 00169054 48 05 4A 45 */ bl AddSource__19CStaticInterferenceF9TUniqueIdff
/* 8016C0F8 00169058 80 7E 08 4C */ lwz r3, 0x84c(r30)
/* 8016C0FC 0016905C C0 22 A0 B0 */ lfs f1, lbl_805ABDD0@sda21(r2)
/* 8016C100 00169060 C0 03 07 40 */ lfs f0, 0x740(r3)
/* 8016C104 00169064 FC 00 08 40 */ fcmpo cr0, f0, f1
/* 8016C108 00169068 40 80 00 10 */ bge lbl_8016C118
/* 8016C10C 0016906C C0 42 80 F8 */ lfs f2, lbl_805A9E18@sda21(r2)
/* 8016C110 00169070 C0 62 80 FC */ lfs f3, lbl_805A9E1C@sda21(r2)
/* 8016C10C 0016906C C0 42 80 F8 */ lfs f2, skDefaultHudFadeOutSpeed__7CPlayer@sda21(r2)
/* 8016C110 00169070 C0 62 80 FC */ lfs f3, skDefaultHudFadeInSpeed__7CPlayer@sda21(r2)
/* 8016C114 00169074 4B EA 6F 59 */ bl SetHudDisable__7CPlayerFfff
lbl_8016C118:
/* 8016C118 00169078 88 1D 04 02 */ lbz r0, 0x402(r29)

View File

@ -2214,15 +2214,15 @@ sub_801c2698:
/* 801C2818 001BF778 80 63 00 00 */ lwz r3, 0(r3)
/* 801C281C 001BF77C EC 21 00 32 */ fmuls f1, f1, f0
/* 801C2820 001BF780 38 63 01 88 */ addi r3, r3, 0x188
/* 801C2824 001BF784 4B FF E3 15 */ bl AddSource__19CStaticInterferenceF9TUniqueId
/* 801C2824 001BF784 4B FF E3 15 */ bl AddSource__19CStaticInterferenceF9TUniqueIdff
/* 801C2828 001BF788 80 7E 08 4C */ lwz r3, 0x84c(r30)
/* 801C282C 001BF78C C0 22 AA F0 */ lfs f1, lbl_805AC810@sda21(r2)
/* 801C2830 001BF790 C0 03 07 40 */ lfs f0, 0x740(r3)
/* 801C2834 001BF794 FC 00 08 40 */ fcmpo cr0, f0, f1
/* 801C2838 001BF798 40 80 00 14 */ bge lbl_801C284C
/* 801C283C 001BF79C C0 42 80 F8 */ lfs f2, lbl_805A9E18@sda21(r2)
/* 801C283C 001BF79C C0 42 80 F8 */ lfs f2, skDefaultHudFadeOutSpeed__7CPlayer@sda21(r2)
/* 801C2840 001BF7A0 7F E3 FB 78 */ mr r3, r31
/* 801C2844 001BF7A4 C0 62 80 FC */ lfs f3, lbl_805A9E1C@sda21(r2)
/* 801C2844 001BF7A4 C0 62 80 FC */ lfs f3, skDefaultHudFadeInSpeed__7CPlayer@sda21(r2)
/* 801C2848 001BF7A8 4B E5 08 25 */ bl SetHudDisable__7CPlayerFfff
lbl_801C284C:
/* 801C284C 001BF7AC C0 1D 07 A0 */ lfs f0, 0x7a0(r29)

View File

@ -873,10 +873,10 @@ lbl_801D4280:
/* 801D435C 001D12BC 48 00 00 20 */ b lbl_801D437C
lbl_801D4360:
/* 801D4360 001D12C0 38 61 00 60 */ addi r3, r1, 0x60
/* 801D4364 001D12C4 4B EB D1 49 */ bl GetTotalPickupCount__12CPlayerStateFv
/* 801D4364 001D12C4 4B EB D1 49 */ bl GetTotalPickupCount__12CPlayerStateCFv
/* 801D4368 001D12C8 7C 7E 1B 78 */ mr r30, r3
/* 801D436C 001D12CC 38 61 00 60 */ addi r3, r1, 0x60
/* 801D4370 001D12D0 4B EB CE C5 */ bl CalculateItemCollectionRate__12CPlayerStateFv
/* 801D4370 001D12D0 4B EB CE C5 */ bl CalculateItemCollectionRate__12CPlayerStateCFv
/* 801D4374 001D12D4 1C 03 00 64 */ mulli r0, r3, 0x64
/* 801D4378 001D12D8 7C 00 F3 D6 */ divw r0, r0, r30
lbl_801D437C:

View File

@ -440,13 +440,13 @@ lbl_805A9E14:
# ROM: 0x3F66B4
.4byte lbl_803CC4F8
.global lbl_805A9E18
lbl_805A9E18:
.global skDefaultHudFadeOutSpeed__7CPlayer
skDefaultHudFadeOutSpeed__7CPlayer:
# ROM: 0x3F66B8
.float 0.5
.global lbl_805A9E1C
lbl_805A9E1C:
.global skDefaultHudFadeInSpeed__7CPlayer
skDefaultHudFadeInSpeed__7CPlayer:
# ROM: 0x3F66BC
.float 2.5
@ -8555,7 +8555,7 @@ lbl_80016C58:
/* 80016CAC 00013C0C B0 01 00 18 */ sth r0, 0x18(r1)
/* 80016CB0 00013C10 80 63 00 00 */ lwz r3, 0(r3)
/* 80016CB4 00013C14 38 63 01 88 */ addi r3, r3, 0x188
/* 80016CB8 00013C18 48 1A 9E 81 */ bl AddSource__19CStaticInterferenceF9TUniqueId
/* 80016CB8 00013C18 48 1A 9E 81 */ bl AddSource__19CStaticInterferenceF9TUniqueIdff
/* 80016CBC 00013C1C 48 00 00 68 */ b lbl_80016D24
.global lbl_80016CC0
lbl_80016CC0:

View File

@ -137,8 +137,8 @@ GetMissileCostForAltAttack__12CPlayerStateCFv:
/* 8009122C 0008E18C 7C 63 00 2E */ lwzx r3, r3, r0
/* 80091230 0008E190 4E 80 00 20 */ blr
.global CalculateItemCollectionRate__12CPlayerStateFv
CalculateItemCollectionRate__12CPlayerStateFv:
.global CalculateItemCollectionRate__12CPlayerStateCFv
CalculateItemCollectionRate__12CPlayerStateCFv:
/* 80091234 0008E194 94 21 FF E0 */ stwu r1, -0x20(r1)
/* 80091238 0008E198 7C 08 02 A6 */ mflr r0
/* 8009123C 0008E19C 38 80 00 07 */ li r4, 7
@ -299,8 +299,8 @@ lbl_8009126C:
/* 800914A4 0008E404 38 21 00 20 */ addi r1, r1, 0x20
/* 800914A8 0008E408 4E 80 00 20 */ blr
.global GetTotalPickupCount__12CPlayerStateFv
GetTotalPickupCount__12CPlayerStateFv:
.global GetTotalPickupCount__12CPlayerStateCFv
GetTotalPickupCount__12CPlayerStateCFv:
/* 800914AC 0008E40C 38 60 00 63 */ li r3, 0x63
/* 800914B0 0008E410 4E 80 00 20 */ blr

View File

@ -292,8 +292,8 @@ lbl_801C0B0C:
/* 801C0B30 001BDA90 38 21 00 10 */ addi r1, r1, 0x10
/* 801C0B34 001BDA94 4E 80 00 20 */ blr
.global AddSource__19CStaticInterferenceF9TUniqueId
AddSource__19CStaticInterferenceF9TUniqueId:
.global AddSource__19CStaticInterferenceF9TUniqueIdff
AddSource__19CStaticInterferenceF9TUniqueIdff:
/* 801C0B38 001BDA98 94 21 FF C0 */ stwu r1, -0x40(r1)
/* 801C0B3C 001BDA9C 7C 08 02 A6 */ mflr r0
/* 801C0B40 001BDAA0 90 01 00 44 */ stw r0, 0x44(r1)
@ -487,4 +487,3 @@ lbl_803D1A78:
# ROM: 0x3CEA78
.asciz "??(??)"
.balign 4

View File

@ -463,7 +463,7 @@ lbl_8029F5E8:
/* 8029F62C 0029C58C C0 3D 05 B8 */ lfs f1, 0x5b8(r29)
/* 8029F630 0029C590 C0 5D 05 BC */ lfs f2, 0x5bc(r29)
/* 8029F634 0029C594 38 63 01 88 */ addi r3, r3, 0x188
/* 8029F638 0029C598 4B F2 15 01 */ bl AddSource__19CStaticInterferenceF9TUniqueId
/* 8029F638 0029C598 4B F2 15 01 */ bl AddSource__19CStaticInterferenceF9TUniqueIdff
/* 8029F63C 0029C59C 48 00 01 68 */ b lbl_8029F7A4
lbl_8029F640:
/* 8029F640 0029C5A0 38 00 00 00 */ li r0, 0

View File

@ -175,8 +175,8 @@ Touch__14CScriptEMPulseFR6CActorR13CStateManager:
/* 8018ED7C 0018BCDC FC 1F 00 40 */ fcmpo cr0, f31, f0
/* 8018ED80 0018BCE0 40 81 00 3C */ ble lbl_8018EDBC
/* 8018ED84 0018BCE4 FC 20 F8 90 */ fmr f1, f31
/* 8018ED88 0018BCE8 C0 42 80 F8 */ lfs f2, lbl_805A9E18@sda21(r2)
/* 8018ED8C 0018BCEC C0 62 80 FC */ lfs f3, lbl_805A9E1C@sda21(r2)
/* 8018ED88 0018BCE8 C0 42 80 F8 */ lfs f2, skDefaultHudFadeOutSpeed__7CPlayer@sda21(r2)
/* 8018ED8C 0018BCEC C0 62 80 FC */ lfs f3, skDefaultHudFadeInSpeed__7CPlayer@sda21(r2)
/* 8018ED90 0018BCF0 7F E3 FB 78 */ mr r3, r31
/* 8018ED94 0018BCF4 4B E8 42 D9 */ bl SetHudDisable__7CPlayerFfff
/* 8018ED98 0018BCF8 80 BE 08 4C */ lwz r5, 0x84c(r30)
@ -198,7 +198,7 @@ lbl_8018EDBC:
/* 8018EDD4 0018BD34 B0 01 00 08 */ sth r0, 8(r1)
/* 8018EDD8 0018BD38 80 63 00 00 */ lwz r3, 0(r3)
/* 8018EDDC 0018BD3C 38 63 01 88 */ addi r3, r3, 0x188
/* 8018EDE0 0018BD40 48 03 1D 59 */ bl AddSource__19CStaticInterferenceF9TUniqueId
/* 8018EDE0 0018BD40 48 03 1D 59 */ bl AddSource__19CStaticInterferenceF9TUniqueIdff
lbl_8018EDE4:
/* 8018EDE4 0018BD44 E3 E1 00 68 */ psq_l f31, 104(r1), 0, qr0
/* 8018EDE8 0018BD48 CB E1 00 60 */ lfd f31, 0x60(r1)
@ -458,7 +458,7 @@ lbl_8018F0F4:
/* 8018F17C 0018C0DC C0 3D 01 00 */ lfs f1, 0x100(r29)
/* 8018F180 0018C0E0 C0 5D 00 F8 */ lfs f2, 0xf8(r29)
/* 8018F184 0018C0E4 38 63 01 88 */ addi r3, r3, 0x188
/* 8018F188 0018C0E8 48 03 19 B1 */ bl AddSource__19CStaticInterferenceF9TUniqueId
/* 8018F188 0018C0E8 48 03 19 B1 */ bl AddSource__19CStaticInterferenceF9TUniqueIdff
lbl_8018F18C:
/* 8018F18C 0018C0EC 80 01 00 74 */ lwz r0, 0x74(r1)
/* 8018F190 0018C0F0 83 E1 00 6C */ lwz r31, 0x6c(r1)

View File

@ -385,10 +385,10 @@ lbl_800C291C:
/* 800C297C 000BF8DC 80 7E 08 B8 */ lwz r3, 0x8b8(r30)
/* 800C2980 000BF8E0 83 43 00 00 */ lwz r26, 0(r3)
/* 800C2984 000BF8E4 7F 43 D3 78 */ mr r3, r26
/* 800C2988 000BF8E8 4B FC EB 25 */ bl GetTotalPickupCount__12CPlayerStateFv
/* 800C2988 000BF8E8 4B FC EB 25 */ bl GetTotalPickupCount__12CPlayerStateCFv
/* 800C298C 000BF8EC 7C 7B 1B 78 */ mr r27, r3
/* 800C2990 000BF8F0 7F 43 D3 78 */ mr r3, r26
/* 800C2994 000BF8F4 4B FC E8 A1 */ bl CalculateItemCollectionRate__12CPlayerStateFv
/* 800C2994 000BF8F4 4B FC E8 A1 */ bl CalculateItemCollectionRate__12CPlayerStateCFv
/* 800C2998 000BF8F8 7C 03 D8 00 */ cmpw r3, r27
/* 800C299C 000BF8FC 40 82 00 60 */ bne lbl_800C29FC
/* 800C29A0 000BF900 80 8D A0 80 */ lwz r4, gpGameState@sda21(r13)

View File

@ -292,8 +292,8 @@ GetTouchBounds__22CScriptSpecialFunctionCFv:
/* 8014F32C 0014C28C D0 03 00 14 */ stfs f0, 0x14(r3)
/* 8014F330 0014C290 4E 80 00 20 */ blr
.global GetSpecialEnding__22CScriptSpecialFunctionCFv
GetSpecialEnding__22CScriptSpecialFunctionCFv:
.global GetSpecialEnding__22CScriptSpecialFunctionCFRC13CStateManager
GetSpecialEnding__22CScriptSpecialFunctionCFRC13CStateManager:
/* 8014F334 0014C294 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 8014F338 0014C298 7C 08 02 A6 */ mflr r0
/* 8014F33C 0014C29C 90 01 00 14 */ stw r0, 0x14(r1)
@ -302,10 +302,10 @@ GetSpecialEnding__22CScriptSpecialFunctionCFv:
/* 8014F348 0014C2A8 80 64 08 B8 */ lwz r3, 0x8b8(r4)
/* 8014F34C 0014C2AC 83 C3 00 00 */ lwz r30, 0(r3)
/* 8014F350 0014C2B0 7F C3 F3 78 */ mr r3, r30
/* 8014F354 0014C2B4 4B F4 21 59 */ bl GetTotalPickupCount__12CPlayerStateFv
/* 8014F354 0014C2B4 4B F4 21 59 */ bl GetTotalPickupCount__12CPlayerStateCFv
/* 8014F358 0014C2B8 7C 7F 1B 78 */ mr r31, r3
/* 8014F35C 0014C2BC 7F C3 F3 78 */ mr r3, r30
/* 8014F360 0014C2C0 4B F4 1E D5 */ bl CalculateItemCollectionRate__12CPlayerStateFv
/* 8014F360 0014C2C0 4B F4 1E D5 */ bl CalculateItemCollectionRate__12CPlayerStateCFv
/* 8014F364 0014C2C4 1C 03 00 64 */ mulli r0, r3, 0x64
/* 8014F368 0014C2C8 7C 00 FB D6 */ divw r0, r0, r31
/* 8014F36C 0014C2CC 2C 00 00 4B */ cmpwi r0, 0x4b
@ -833,8 +833,8 @@ lbl_8014FA90:
/* 8014FAE8 0014CA48 7C 04 00 00 */ cmpw r4, r0
/* 8014FAEC 0014CA4C 40 82 00 5C */ bne lbl_8014FB48
/* 8014FAF0 0014CA50 C0 3E 01 00 */ lfs f1, 0x100(r30)
/* 8014FAF4 0014CA54 C0 42 80 F8 */ lfs f2, lbl_805A9E18@sda21(r2)
/* 8014FAF8 0014CA58 C0 62 80 FC */ lfs f3, lbl_805A9E1C@sda21(r2)
/* 8014FAF4 0014CA54 C0 42 80 F8 */ lfs f2, skDefaultHudFadeOutSpeed__7CPlayer@sda21(r2)
/* 8014FAF8 0014CA58 C0 62 80 FC */ lfs f3, skDefaultHudFadeInSpeed__7CPlayer@sda21(r2)
/* 8014FAFC 0014CA5C 4B EC 35 71 */ bl SetHudDisable__7CPlayerFfff
/* 8014FB00 0014CA60 C0 22 9D B4 */ lfs f1, lbl_805ABAD4@sda21(r2)
/* 8014FB04 0014CA64 38 61 00 28 */ addi r3, r1, 0x28
@ -900,7 +900,7 @@ lbl_8014FBD4:
/* 8014FBE8 0014CB48 B0 01 00 18 */ sth r0, 0x18(r1)
/* 8014FBEC 0014CB4C 80 63 00 00 */ lwz r3, 0(r3)
/* 8014FBF0 0014CB50 38 63 01 88 */ addi r3, r3, 0x188
/* 8014FBF4 0014CB54 48 07 0F 45 */ bl AddSource__19CStaticInterferenceF9TUniqueId
/* 8014FBF4 0014CB54 48 07 0F 45 */ bl AddSource__19CStaticInterferenceF9TUniqueIdff
lbl_8014FBF8:
/* 8014FBF8 0014CB58 57 60 06 3F */ clrlwi. r0, r27, 0x18
/* 8014FBFC 0014CB5C 41 82 00 38 */ beq lbl_8014FC34
@ -1386,7 +1386,7 @@ ThinkSpinnerController__22CScriptSpecialFunctionFfR13CStateManagerQ222CScriptSpe
/* 801502F0 0014D250 38 78 00 EC */ addi r3, r24, 0xec
/* 801502F4 0014D254 38 81 00 98 */ addi r4, r1, 0x98
/* 801502F8 0014D258 38 A0 00 00 */ li r5, 0
/* 801502FC 0014D25C 48 00 0A 9D */ bl sub_80150d98
/* 801502FC 0014D25C 48 00 0A 9D */ bl "string_find__4rstlFRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>i"
/* 80150300 0014D260 20 83 FF FF */ subfic r4, r3, -1
/* 80150304 0014D264 38 03 00 01 */ addi r0, r3, 1
/* 80150308 0014D268 7C 80 03 78 */ or r0, r4, r0
@ -1401,7 +1401,7 @@ ThinkSpinnerController__22CScriptSpecialFunctionFfR13CStateManagerQ222CScriptSpe
/* 8015032C 0014D28C 38 78 00 EC */ addi r3, r24, 0xec
/* 80150330 0014D290 38 81 00 88 */ addi r4, r1, 0x88
/* 80150334 0014D294 38 A0 00 00 */ li r5, 0
/* 80150338 0014D298 48 00 0A 61 */ bl sub_80150d98
/* 80150338 0014D298 48 00 0A 61 */ bl "string_find__4rstlFRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>i"
/* 8015033C 0014D29C 20 83 FF FF */ subfic r4, r3, -1
/* 80150340 0014D2A0 38 03 00 01 */ addi r0, r3, 1
/* 80150344 0014D2A4 7C 80 03 78 */ or r0, r4, r0
@ -1902,14 +1902,14 @@ lbl_80150A50:
/* 80150A5C 0014D9BC 38 A1 00 0C */ addi r5, r1, 0xc
/* 80150A60 0014D9C0 90 01 00 08 */ stw r0, 8(r1)
/* 80150A64 0014D9C4 90 01 00 0C */ stw r0, 0xc(r1)
/* 80150A68 0014D9C8 48 00 00 15 */ bl sub_80150a7c
/* 80150A68 0014D9C8 48 00 00 15 */ bl "insert__Q24rstl36vector<f,Q24rstl17rmemory_allocator>FQ24rstl92pointer_iterator<f,Q24rstl36vector<f,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>RCf"
/* 80150A6C 0014D9CC 80 01 00 24 */ lwz r0, 0x24(r1)
/* 80150A70 0014D9D0 7C 08 03 A6 */ mtlr r0
/* 80150A74 0014D9D4 38 21 00 20 */ addi r1, r1, 0x20
/* 80150A78 0014D9D8 4E 80 00 20 */ blr
.global sub_80150a7c
sub_80150a7c:
.global "insert__Q24rstl36vector<f,Q24rstl17rmemory_allocator>FQ24rstl92pointer_iterator<f,Q24rstl36vector<f,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>RCf"
"insert__Q24rstl36vector<f,Q24rstl17rmemory_allocator>FQ24rstl92pointer_iterator<f,Q24rstl36vector<f,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>RCf":
/* 80150A7C 0014D9DC 94 21 FF D0 */ stwu r1, -0x30(r1)
/* 80150A80 0014D9E0 7C 08 02 A6 */ mflr r0
/* 80150A84 0014D9E4 90 01 00 34 */ stw r0, 0x34(r1)
@ -1933,7 +1933,7 @@ sub_80150a7c:
/* 80150ACC 0014DA2C 38 81 00 08 */ addi r4, r1, 8
/* 80150AD0 0014DA30 90 01 00 10 */ stw r0, 0x10(r1)
/* 80150AD4 0014DA34 90 E1 00 08 */ stw r7, 8(r1)
/* 80150AD8 0014DA38 48 00 00 31 */ bl sub_80150b08
/* 80150AD8 0014DA38 48 00 00 31 */ bl "insert_into<Q24rstl26const_counting_iterator<f>>__Q24rstl36vector<f,Q24rstl17rmemory_allocator>FQ24rstl92pointer_iterator<f,Q24rstl36vector<f,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>iQ24rstl26const_counting_iterator<f>"
/* 80150ADC 0014DA3C 80 7E 00 0C */ lwz r3, 0xc(r30)
/* 80150AE0 0014DA40 57 E0 10 3A */ slwi r0, r31, 2
/* 80150AE4 0014DA44 7C 63 02 14 */ add r3, r3, r0
@ -1946,8 +1946,8 @@ sub_80150a7c:
/* 80150B00 0014DA60 38 21 00 30 */ addi r1, r1, 0x30
/* 80150B04 0014DA64 4E 80 00 20 */ blr
.global sub_80150b08
sub_80150b08:
.global "insert_into<Q24rstl26const_counting_iterator<f>>__Q24rstl36vector<f,Q24rstl17rmemory_allocator>FQ24rstl92pointer_iterator<f,Q24rstl36vector<f,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>iQ24rstl26const_counting_iterator<f>"
"insert_into<Q24rstl26const_counting_iterator<f>>__Q24rstl36vector<f,Q24rstl17rmemory_allocator>FQ24rstl92pointer_iterator<f,Q24rstl36vector<f,Q24rstl17rmemory_allocator>,Q24rstl17rmemory_allocator>iQ24rstl26const_counting_iterator<f>":
/* 80150B08 0014DA68 94 21 FF D0 */ stwu r1, -0x30(r1)
/* 80150B0C 0014DA6C 7C 08 02 A6 */ mflr r0
/* 80150B10 0014DA70 90 01 00 34 */ stw r0, 0x34(r1)
@ -2143,8 +2143,8 @@ lbl_80150D84:
/* 80150D90 0014DCF0 38 21 00 10 */ addi r1, r1, 0x10
/* 80150D94 0014DCF4 4E 80 00 20 */ blr
.global sub_80150d98
sub_80150d98:
.global "string_find__4rstlFRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>i"
"string_find__4rstlFRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>i":
/* 80150D98 0014DCF8 94 21 FF A0 */ stwu r1, -0x60(r1)
/* 80150D9C 0014DCFC 7C 08 02 A6 */ mflr r0
/* 80150DA0 0014DD00 2C 05 FF FF */ cmpwi r5, -1
@ -3543,7 +3543,7 @@ lbl_8015214C:
/* 80152150 0014F0B0 40 82 07 50 */ bne lbl_801528A0
/* 80152154 0014F0B4 7F E3 FB 78 */ mr r3, r31
/* 80152158 0014F0B8 7F C4 F3 78 */ mr r4, r30
/* 8015215C 0014F0BC 4B FF D1 D9 */ bl GetSpecialEnding__22CScriptSpecialFunctionCFv
/* 8015215C 0014F0BC 4B FF D1 D9 */ bl GetSpecialEnding__22CScriptSpecialFunctionCFRC13CStateManager
/* 80152160 0014F0C0 2C 03 00 01 */ cmpwi r3, 1
/* 80152164 0014F0C4 41 82 00 30 */ beq lbl_80152194
/* 80152168 0014F0C8 40 80 00 10 */ bge lbl_80152178
@ -4042,7 +4042,7 @@ lbl_80152860:
/* 80152864 0014F7C4 40 82 00 3C */ bne lbl_801528A0
/* 80152868 0014F7C8 7F E3 FB 78 */ mr r3, r31
/* 8015286C 0014F7CC 7F C4 F3 78 */ mr r4, r30
/* 80152870 0014F7D0 4B FF CA C5 */ bl GetSpecialEnding__22CScriptSpecialFunctionCFv
/* 80152870 0014F7D0 4B FF CA C5 */ bl GetSpecialEnding__22CScriptSpecialFunctionCFRC13CStateManager
/* 80152874 0014F7D4 C0 1F 00 FC */ lfs f0, 0xfc(r31)
/* 80152878 0014F7D8 FC 00 00 1E */ fctiwz f0, f0
/* 8015287C 0014F7DC D8 01 01 68 */ stfd f0, 0x168(r1)

View File

@ -2039,8 +2039,8 @@ lbl_80178778:
/* 801787A0 00175700 48 17 15 D5 */ bl SfxStart__11CSfxManagerFUsssbsbi
/* 801787A4 00175704 80 7E 08 4C */ lwz r3, 0x84c(r30)
/* 801787A8 00175708 C0 22 A2 1C */ lfs f1, lbl_805ABF3C@sda21(r2)
/* 801787AC 0017570C C0 42 80 F8 */ lfs f2, lbl_805A9E18@sda21(r2)
/* 801787B0 00175710 C0 62 80 FC */ lfs f3, lbl_805A9E1C@sda21(r2)
/* 801787AC 0017570C C0 42 80 F8 */ lfs f2, skDefaultHudFadeOutSpeed__7CPlayer@sda21(r2)
/* 801787B0 00175710 C0 62 80 FC */ lfs f3, skDefaultHudFadeInSpeed__7CPlayer@sda21(r2)
/* 801787B4 00175714 4B E9 A8 B9 */ bl SetHudDisable__7CPlayerFfff
/* 801787B8 00175718 80 7E 08 4C */ lwz r3, 0x84c(r30)
/* 801787BC 0017571C 7F C6 F3 78 */ mr r6, r30
@ -2060,7 +2060,7 @@ lbl_80178778:
/* 801787F4 00175754 B0 01 00 20 */ sth r0, 0x20(r1)
/* 801787F8 00175758 80 63 00 00 */ lwz r3, 0(r3)
/* 801787FC 0017575C 38 63 01 88 */ addi r3, r3, 0x188
/* 80178800 00175760 48 04 83 39 */ bl AddSource__19CStaticInterferenceF9TUniqueId
/* 80178800 00175760 48 04 83 39 */ bl AddSource__19CStaticInterferenceF9TUniqueIdff
/* 80178804 00175764 48 00 00 70 */ b lbl_80178874
lbl_80178808:
/* 80178808 00175768 88 1D 05 40 */ lbz r0, 0x540(r29)

View File

@ -1106,6 +1106,11 @@ LIBS = [
},
]
# Create & link static libraries
# Currently broken due to deadstripping
ENABLE_STATIC_LIBS = False
# On Windows, we need this to use && in commands
ALLOW_CHAIN = "cmd /c " if os.name == "nt" else ""
out = io.StringIO()
@ -1170,9 +1175,10 @@ n.newline()
n.rule(name="as", command="$devkitppc/bin/powerpc-eabi-as $asflags -o $out $in -MD $out.d",
description="AS $out", depfile="$out.d", deps="gcc")
n.newline()
n.rule(name="ar", command="$devkitppc/bin/powerpc-eabi-ar crs $out $in",
description="AR $out")
n.newline()
if ENABLE_STATIC_LIBS:
n.rule(name="ar", command="$devkitppc/bin/powerpc-eabi-ar crs $out $in",
description="AR $out")
n.newline()
n.rule(name="link", command="$wine tools/mwcc_compiler/$mwcc_version/mwldeppc.exe $ldflags -o $out @$out.rsp",
description="LINK $out", rspfile="$out.rsp", rspfile_content="$in")
n.newline()
@ -1212,23 +1218,23 @@ for lib in LIBS:
inputs.append(f"$builddir/src/{object}.o")
else:
inputs.append(f"$builddir/asm/{object}.o")
if "lib" in lib:
if ENABLE_STATIC_LIBS and "lib" in lib:
lib_name = lib["lib"]
n.build(f"$builddir/{lib_name}.a", "ar", inputs)
n.build(f"$builddir/lib/{lib_name}.a", "ar", inputs)
n.newline()
n.comment("main.elf")
inputs = []
for lib in LIBS:
# if "lib" in lib:
# lib_name = lib["lib"]
# inputs.append(f"$builddir/{lib_name}.a")
# else:
for object in lib["objects"]:
if object in COMPLETE_OBJECTS:
inputs.append(f"$builddir/src/{object}.o")
else:
inputs.append(f"$builddir/asm/{object}.o")
if ENABLE_STATIC_LIBS and "lib" in lib:
lib_name = lib["lib"]
inputs.append(f"$builddir/lib/{lib_name}.a")
else:
for object in lib["objects"]:
if object in COMPLETE_OBJECTS:
inputs.append(f"$builddir/src/{object}.o")
else:
inputs.append(f"$builddir/asm/{object}.o")
if args.map:
n.build("$builddir/main.elf", "link", inputs,
implicit_outputs="$builddir/MetroidPrime.MAP")

View File

@ -18,6 +18,12 @@ public:
CMaterialFilter(const CMaterialList& include, const CMaterialList& exclude, EFilterType type)
: include(include), exclude(exclude), type(type) {}
static CMaterialFilter MakeInclude(const CMaterialList& include) {
return CMaterialFilter(include, CMaterialList(), kFT_Include);
}
static CMaterialFilter MakeExclude(const CMaterialList& exclude) {
return CMaterialFilter(CMaterialList(), exclude, kFT_Exclude);
}
static CMaterialFilter MakeIncludeExclude(const CMaterialList& include,
const CMaterialList& exclude) {
return CMaterialFilter(include, exclude, kFT_IncludeExclude);

View File

@ -12,7 +12,13 @@ public:
TAverage() {}
TAverage(int capacity, const T& value);
void AddValue(const T& value);
rstl::optional_object< T > GetAverage() const;
rstl::optional_object< T > GetAverage() const {
if (empty()) {
return rstl::optional_object_null();
} else {
return GetAverageValue(data(), size());
}
}
};
template < typename T >
@ -22,11 +28,14 @@ TAverage< T >::TAverage(int capacity, const T& value) {
template < typename T >
void TAverage< T >::AddValue(const T& value) {
push_back(value);
for (int i = size() - 1; i > 0; --i) {
operator[](i) = operator[](i - 1);
if (size() == capacity()) {
// TODO ?
x4_count -= 1;
}
operator[](0) = value;
insert(begin(), value);
}
template < typename T >
T GetAverageValue(const T* ptr, int count); // TODO
#endif

View File

@ -3,6 +3,8 @@
#include "types.h"
#include "Kyoto/TAverage.hpp"
#include "rstl/optional_object.hpp"
#include "rstl/reserved_vector.hpp"

View File

@ -11,8 +11,13 @@
#include "Kyoto/Math/CAABox.hpp"
#include "Kyoto/Math/CTransform4f.hpp"
#include "Kyoto/Math/CVector2f.hpp"
#include "Kyoto/Math/CVector3f.hpp"
#include "Kyoto/TToken.hpp"
#include "rstl/pair.hpp"
class CSkinnedModel;
class CCubeRenderer {
public:
virtual ~CCubeRenderer();
@ -71,7 +76,8 @@ public:
virtual void DrawModelFlat();
virtual void SetWireframeFlags();
virtual void SetWorldFog();
virtual void RenderFogVolume(const CColor&, const CAABox&, const TLockedToken<CModel>*, const CSkinnedModel*);
virtual void RenderFogVolume(const CColor&, const CAABox&, const TLockedToken< CModel >*,
const CSkinnedModel*);
virtual void SetThermal();
virtual void SetThermalColdScale();
virtual void DoThermalBlendCold();

View File

@ -12,6 +12,8 @@
#include "MetroidPrime/CEntityInfo.hpp"
#include "MetroidPrime/CObjectList.hpp"
#include "MetroidPrime/Cameras/CCameraBlurPass.hpp"
#include "MetroidPrime/Cameras/CCameraFilterPass.hpp"
#include "MetroidPrime/TGameTypes.hpp"
#include "rstl/auto_ptr.hpp"
@ -81,6 +83,19 @@ public:
typedef rstl::map< TEditorId, TUniqueId > TIdList;
typedef rstl::pair< TIdList::const_iterator, TIdList::const_iterator > TIdListResult;
enum ECameraFilterStage {
kCFS_Zero,
kCFS_One,
kCFS_Two,
kCFS_Three,
kCFS_Four,
kCFS_Five,
kCFS_Six,
kCFS_Seven,
kCFS_Eight,
kCFS_Max,
};
void ResetEscapeSequenceTimer(float);
void SendScriptMsg(TUniqueId uid, TEditorId target, EScriptObjectMessage msg,
EScriptObjectState state);
@ -91,6 +106,8 @@ public:
void FreeScriptObject(TUniqueId uid);
rstl::pair< TEditorId, TUniqueId > GenerateObject(const TEditorId& eid);
void BuildNearList(TEntityList& nearList, const CAABox&, const CMaterialFilter&,
const CActor*) const;
bool RayCollideWorld(const CVector3f& start, const CVector3f& end, const TEntityList& nearList,
const CMaterialFilter& filter, const CActor* damagee) const;
CRayCastResult RayWorldIntersection(TUniqueId& idOut, const CVector3f& pos, const CVector3f& dir,
@ -126,6 +143,13 @@ public:
CObjectList& GetObjectListById(EGameObjectList id) { return *x808_objectLists[id]; }
CCameraFilterPass& CameraFilterPass(ECameraFilterStage stage) {
return xb84_camFilterPasses[size_t(stage)];
}
const CCameraFilterPass& GetCameraFilterPass(ECameraFilterStage stage) const {
return xb84_camFilterPasses[size_t(stage)];
}
f32 GetThermalColdScale1() const { return xf24_thermColdScale1; }
f32 GetThermalColdScale2() const { return xf28_thermColdScale2; }
@ -169,7 +193,8 @@ private:
CWeaponMgr* x878_weaponMgr;
CFluidPlaneManager* x87c_fluidPlaneManager;
CEnvFxManager* x880_envFxManager;
rstl::auto_ptr< CActorModelParticles > x884_actorModelParticles;
rstl::single_ptr< CActorModelParticles > x884_actorModelParticles;
uint x888_;
CRumbleManager* x88c_rumbleManager;
// TODO
// rstl::multimap< TEditorId, TUniqueId > x890_scriptIdMap;
@ -193,8 +218,12 @@ private:
CRandom16 x8fc_random;
CRandom16* x900_random;
u8 x904_pad[0x5f0];
u8 x904_pad[0x280];
rstl::reserved_vector< CCameraFilterPass, kCFS_Max > xb84_camFilterPasses;
rstl::reserved_vector< CCameraBlurPass, kCFS_Max > xd14_camBlurPasses;
int xeec_hintIdx;
uint xef0_hintPeriods;
SOnScreenTex xef4_pendingScreenTex;
CAssetId xf08_pauseHudMessage;
f32 xf0c_escapeTimer;

View File

@ -0,0 +1,42 @@
#ifndef _CCAMERABLURPASS_HPP
#define _CCAMERABLURPASS_HPP
#include "types.h"
#include "MetroidPrime/TGameTypes.hpp"
#include "Kyoto/Graphics/CColor.hpp"
#include "Kyoto/TToken.hpp"
#include "rstl/auto_ptr.hpp"
#include "rstl/optional_object.hpp"
class CTexture;
class CCameraBlurPass {
public:
enum EBlurType {
kBT_NoBlur,
kBT_LoBlur,
kBT_HiBlur,
kBT_XRay,
};
static void DrawWideScreen(const CColor& color, const CTexture* tex, f32 v);
private:
rstl::optional_object< TLockedToken< CTexture > > x0_paletteTex;
EBlurType x10_curType;
EBlurType x14_endType;
float x18_endValue;
float x1c_curValue;
float x20_startValue;
float x24_totalTime;
float x28_remainingTime;
bool x2c_usePersistent;
bool x2d_noPersistentCopy;
uint x30_persistentBuf;
};
CHECK_SIZEOF(CCameraBlurPass, 0x34)
#endif

View File

@ -3,13 +3,59 @@
#include "types.h"
#include "Kyoto/Graphics/CColor.hpp"
#include "MetroidPrime/TGameTypes.hpp"
#include "CTexture.hpp"
#include "Kyoto/Graphics/CColor.hpp"
#include "Kyoto/TToken.hpp"
#include "rstl/auto_ptr.hpp"
class CTexture;
class CCameraFilterPass {
public:
enum EFilterType {
kFT_Passthru,
kFT_Multiply,
kFT_Invert,
kFT_Add,
kFT_Subtract,
kFT_Blend,
kFT_Widescreen,
kFT_SceneAdd,
kFT_NoColor,
kFT_InvDstMultiply,
};
enum EFilterShape {
kFS_Fullscreen,
kFS_FullscreenHalvesLeftRight,
kFS_FullscreenHalvesTopBottom,
kFS_FullscreenQuarters,
kFS_CinemaBars,
kFS_ScanLinesEven,
kFS_ScanLinesOdd,
kFS_RandomStatic,
kFS_CookieCutterDepthRandomStatic
};
void SetFilter(EFilterType type, EFilterShape shape, float time, const CColor& color,
CAssetId txtr);
void DisableFilter(float time);
static void DrawWideScreen(const CColor& color, const CTexture* tex, f32 v);
private:
EFilterType x0_curType;
EFilterType x4_nextType;
EFilterShape x8_shape;
float xc_duration;
float x10_remTime;
CColor x14_prevColor;
CColor x18_curColor;
CColor x1c_nextColor;
CAssetId x20_nextTxtr;
rstl::auto_ptr< TLockedToken< CTexture > > x24_texObj;
};
CHECK_SIZEOF(CCameraFilterPass, 0x2c)
#endif

View File

@ -153,10 +153,17 @@ public:
EPlayerOrbitState GetOrbitState() const { return x304_orbitState; }
const CVector3f& GetMovementDirection() const { return x50c_moveDir; }
EPlayerMorphBallState GetMorphballTransitionState() const { return x2f8_morphBallState; }
void SetHudDisable(float staticTimer, float outSpeed, float inSpeed);
static float skDefaultHudFadeOutSpeed;
static float skDefaultHudFadeInSpeed;
void SetHudDisable(float staticTimer, float outSpeed = skDefaultHudFadeOutSpeed,
float inSpeed = skDefaultHudFadeInSpeed);
void IncrementPhazon();
void DecrementPhazon();
// GetMovementDirection2D__7CPlayerCFv ??
void AddOrbitDisableSource(CStateManager& mgr, TUniqueId addId);
void RemoveOrbitDisableSource(TUniqueId uid);
private:
struct CVisorSteam {

View File

@ -92,11 +92,11 @@ public:
explicit CPlayerState(CInputStream& stream);
void PutTo(COutputStream& stream);
u32 GetMissileCostForAltAttack() const;
int GetMissileCostForAltAttack() const;
float GetComboFireAmmoPeriod() const;
static float GetMissileComboChargeFactor();
u32 CalculateItemCollectionRate() const;
u32 GetTotalPickupCount() const;
int CalculateItemCollectionRate() const;
int GetTotalPickupCount() const;
void SetIsFusionEnabled(bool v);
bool GetIsFusionEnabled() const;
@ -111,7 +111,7 @@ public:
EPlayerVisor GetActiveVisor(const CStateManager& mgr) const;
void UpdateStaticInterference(CStateManager& stateMgr, const float& dt);
void IncreaseScanTime(u32 time, float val);
void IncreaseScanTime(uint time, float val);
void SetScanTime(CAssetId res, float time);
float GetScanTime(CAssetId time) const;
bool GetIsVisorTransitioning() const;
@ -124,9 +124,9 @@ public:
void DisableItem(EItemType type);
void EnableItem(EItemType type);
bool HasPowerUp(EItemType type) const;
u32 GetPowerUp(EItemType type);
u32 GetItemCapacity(EItemType type) const;
u32 GetItemAmount(EItemType type) const;
uint GetPowerUp(EItemType type);
uint GetItemCapacity(EItemType type) const;
uint GetItemAmount(EItemType type) const;
void DecrPickUp(EItemType type, int amount);
void IncrPickUp(EItemType type, int amount);
void ResetAndIncrPickUp(EItemType type, int amount);
@ -140,7 +140,8 @@ public:
static uint GetBitCount(uint);
CStaticInterference& GetStaticInterference() { return x188_staticIntf; }
CStaticInterference& StaticInterference() { return x188_staticIntf; }
const CStaticInterference& GetStaticInterference() const { return x188_staticIntf; }
const rstl::vector< rstl::pair< CAssetId, float > >& GetScanTimes() const {
return x170_scanTimes;
@ -162,7 +163,7 @@ private:
bool x0_24_alive : 1;
bool x0_25_firingComboBeam : 1;
bool x0_26_fusion : 1;
u32 x4_enabledItems;
uint x4_enabledItems;
EBeamId x8_currentBeam;
CHealthInfo xc_health;
EPlayerVisor x14_currentVisor;
@ -171,7 +172,7 @@ private:
EPlayerSuit x20_currentSuit;
rstl::reserved_vector< CPowerUp, 41 > x24_powerups;
rstl::vector< rstl::pair< CAssetId, float > > x170_scanTimes;
rstl::pair< u32, u32 > x180_scanCompletionRate;
rstl::pair< uint, uint > x180_scanCompletionRate;
CStaticInterference x188_staticIntf;
};

View File

@ -14,7 +14,12 @@ struct CStaticInterferenceSource {
class CStaticInterference {
public:
CStaticInterference(int);
CStaticInterference(int sourceCount);
void AddSource(TUniqueId id, float magnitude, float duration);
void RemoveSource(TUniqueId id);
void Update(CStateManager&, float dt);
float GetTotalInterference() const;
private:
rstl::vector< CStaticInterferenceSource > sources;

View File

@ -67,7 +67,12 @@ public:
float x4_rotateSpeed;
bool x8_reachedTarget;
CVector3f xc_;
SRingController(TUniqueId uid, float rotateSpeed, bool reachedTarget);
SRingController(TUniqueId uid, float rotateSpeed, bool reachedTarget)
: x0_id(uid)
, x4_rotateSpeed(rotateSpeed)
, x8_reachedTarget(reachedTarget)
, xc_(CVector3f::Zero()) {}
};
private:
@ -87,7 +92,7 @@ private:
u16 x172_sfx2;
u16 x174_sfx3;
CSfxHandle x178_sfxHandle;
u32 x17c_;
uint x17c_;
float x180_;
TAverage< f32 > x184_;
float x194_;
@ -142,7 +147,7 @@ public:
bool ShouldSkipCinematic(CStateManager& stateMgr) const;
void DeleteEmitter(CSfxHandle& handle);
u32 GetSpecialEnding(const CStateManager&) const;
int GetSpecialEnding(const CStateManager&) const;
void AddOrUpdateEmitter(float pitch, CSfxHandle& handle, u16 id, const CVector3f& pos, uchar vol);
};

View File

@ -0,0 +1,51 @@
#ifndef _CENERGYPROJECTILE_HPP
#define _CENERGYPROJECTILE_HPP
#include "types.h"
#include "MetroidPrime/Cameras/CCameraShakeData.hpp"
#include "MetroidPrime/Weapons/CGameProjectile.hpp"
#include "Kyoto/Audio/CSfxHandle.hpp"
#include "Kyoto/Math/CVector3f.hpp"
class CEnergyProjectile : public CGameProjectile {
public:
// TODO ctor
// CEntity
~CEnergyProjectile() override;
void Accept(IVisitor& visitor) override;
void Think(f32 dt, CStateManager& mgr) 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;
void Touch(CActor&, CStateManager&) override;
// CGameProjectile
void ResolveCollisionWithActor(const CRayCastResult& res, CActor& act,
CStateManager& mgr) override;
// CEnergyProjectile
virtual bool Explode(const CVector3f& pos, const CVector3f& normal,
EWeaponCollisionResponseTypes type, CStateManager& mgr,
const CDamageVulnerability& dVuln, TUniqueId hitActor);
void Set3d0_26(bool v) { x3d0_26_ = v; }
private:
CSfxHandle x2e8_sfx;
CVector3f x2ec_dir;
float x2f8_mag;
CCameraShakeData x2fc_camShake;
bool x3d0_24_dead : 1;
bool x3d0_25_ : 1;
bool x3d0_26_ : 1;
bool x3d0_27_camShakeDirty : 1;
float x3d4_curTime;
};
CHECK_SIZEOF(CEnergyProjectile, 0x3d8);
#endif

View File

@ -0,0 +1,62 @@
#ifndef _CGAMEPROJECTILE_HPP
#define _CGAMEPROJECTILE_HPP
#include "types.h"
#include "MetroidPrime/Weapons/CProjectileWeapon.hpp"
#include "MetroidPrime/Weapons/CWeapon.hpp"
#include "Kyoto/TToken.hpp"
#include "rstl/optional_object.hpp"
#include "rstl/vector.hpp"
class CGenDescription;
class CProjectileTouchResult;
class CGameProjectile : public CWeapon {
public:
// TODO ctor
// CEntity
~CGameProjectile() override;
void Accept(IVisitor& visitor) override;
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override;
// CActor
void Render(const CStateManager&) const override;
rstl::optional_object< CAABox > GetTouchBounds() const override;
void FluidFXThink(EFluidState, CScriptWater&, CStateManager&) override;
// CGameProjectile
virtual void ResolveCollisionWithActor(const CRayCastResult& res, CActor& act,
CStateManager& mgr);
TUniqueId GetHomingTargetId() const { return x2c0_homingTargetId; }
private:
rstl::optional_object< TLockedToken< CGenDescription > > x158_visorParticle;
u16 x168_visorSfx;
CProjectileWeapon x170_projectile;
CVector3f x298_previousPos;
float x2a4_projExtent;
float x2a8_homingDt;
double x2b0_targetHomingTime;
double x2b8_curHomingTime;
TUniqueId x2c0_homingTargetId;
TUniqueId x2c2_lastResolvedObj;
TUniqueId x2c4_hitProjectileOwner;
TUniqueId x2c6_pendingDamagee;
TUniqueId x2c8_projectileLight;
CAssetId x2cc_wpscId;
rstl::vector< CProjectileTouchResult > x2d0_touchResults;
float x2e0_minHomingDist;
bool x2e4_24_active : 1;
bool x2e4_25_startedUnderwater : 1;
bool x2e4_26_waterUpdate : 1;
bool x2e4_27_inWater : 1;
bool x2e4_28_sendProjectileCollideMsg : 1;
};
CHECK_SIZEOF(CGameProjectile, 0x2e8)
#endif

View File

@ -0,0 +1,71 @@
#ifndef _CPROJECTILEWEAPON_HPP
#define _CPROJECTILEWEAPON_HPP
#include "types.h"
#include "Kyoto/CRandom16.hpp"
#include "Kyoto/Graphics/CColor.hpp"
#include "Kyoto/Math/CTransform4f.hpp"
#include "Kyoto/Math/CVector3f.hpp"
#include "Kyoto/TToken.hpp"
#include "rstl/optional_object.hpp"
#include "rstl/single_ptr.hpp"
class CWeaponDescription;
class CElementGen;
class CModel;
class CParticleSwoosh;
class CProjectileWeapon {
public:
// TODO ctor
virtual ~CProjectileWeapon();
virtual void Update(float dt);
virtual void AddToRenderer();
virtual void Render();
virtual CVector3f GetTranslation() const;
virtual CTransform4f GetTransform() const;
private:
TLockedToken< CWeaponDescription > x4_weaponDesc;
CRandom16 x10_random;
CTransform4f x14_localToWorldXf;
CTransform4f x44_localXf;
CVector3f x74_worldOffset;
CVector3f x80_localOffset;
CVector3f x8c_projOffset;
CVector3f x98_scale;
CVector3f xa4_localOffset2;
CVector3f xb0_velocity;
CVector3f xbc_gravity;
CColor xc8_ambientLightColor;
double xd0_curTime;
double xd8_remainderTime;
float xe0_maxTurnRate;
int xe4_flags;
int xe8_lifetime;
int xec_childSystemUpdateRate;
int xf0_;
int xf4_curFrame;
int xf8_lastParticleFrame;
rstl::single_ptr< CElementGen > xfc_APSMGen;
rstl::single_ptr< CElementGen > x100_APS2Gen;
rstl::single_ptr< CElementGen > x104_;
rstl::optional_object< TLockedToken< CModel > > x108_model;
rstl::single_ptr< CParticleSwoosh > x118_swoosh1;
rstl::single_ptr< CParticleSwoosh > x11c_swoosh2;
rstl::single_ptr< CParticleSwoosh > x120_swoosh3;
bool x124_24_active : 1;
bool x124_25_APSO : 1;
bool x124_26_AP11 : 1;
bool x124_27_AP21 : 1;
bool x124_28_AS11 : 1;
bool x124_29_AS12 : 1;
bool x124_30_AS13 : 1;
bool x124_31_VMD2 : 1;
};
CHECK_SIZEOF(CProjectileWeapon, 0x128)
#endif

View File

@ -0,0 +1,39 @@
#ifndef _CWEAPON_HPP
#define _CWEAPON_HPP
#include "types.h"
#include "MetroidPrime/CActor.hpp"
#include "MetroidPrime/CDamageInfo.hpp"
#include "MetroidPrime/Weapons/WeaponTypes.hpp"
class CWeapon : public CActor {
public:
// TODO
// CEntity
~CWeapon() override;
void Think(f32 dt, CStateManager& mgr) override;
// CActor
void Render(const CStateManager&) const override;
EWeaponCollisionResponseTypes GetCollisionResponseType(const CVector3f&, const CVector3f&,
const CWeaponMode&,
int /*EProjectileAttrib?*/) const override;
void FluidFXThink(EFluidState, CScriptWater&, CStateManager&) override;
private:
EProjectileAttrib xe8_projectileAttribs;
TUniqueId xec_ownerId;
EWeaponType xf0_weaponType;
CMaterialFilter xf8_filter;
CDamageInfo x110_origDamageInfo;
CDamageInfo x12c_curDamageInfo;
float x148_curTime;
float x14c_damageFalloffSpeed;
float x150_damageDuration;
float x154_interferenceDuration;
};
CHECK_SIZEOF(CWeapon, 0x158)
#endif

View File

@ -4,11 +4,30 @@
#include "rstl/pointer_iterator.hpp"
namespace rstl {
template < class Iter, class T >
inline Iter find(Iter first, Iter last, const T& val) {
template < class It, class T >
inline It find(It first, It last, const T& val) {
while (first != last && !(*first == val))
++first;
return first;
}
template < typename T >
inline void swap(T& a, T& b) {
T tmp(a);
a = b;
b = tmp;
}
template < typename I1, typename I2 >
inline void iter_swap(I1 a, I2 b) {
swap(*a, *b);
}
template < class It, class Cmp >
void __sort3(It a, It b, It c, Cmp comp); // TODO
template < typename It, class Cmp >
inline void sort(It first, It last, Cmp cmp); // TODO
} // namespace rstl
#endif // _RSTL_ALGORITHM_HPP

View File

@ -13,71 +13,36 @@ template < typename T >
inline void destroy(T* in) {
in->~T();
}
// template < typename T >
// inline void destroy(const T* in) {}
template < typename Iter >
inline void destroy(Iter begin, Iter end) {
Iter current = begin;
while (current != end) {
current.destroy();
++current;
}
}
template < typename S >
inline void destroy(S* begin, S* end) {
S* current = begin;
while (current != end) {
destroy(current);
++current;
template < typename It >
inline void destroy(It begin, It end) {
It cur = begin;
for (; cur != end; ++cur) {
destroy(&*cur);
}
}
template < typename Iter, typename T >
inline void uninitialized_copy(Iter begin, Iter end, T* out) {
Iter current = begin;
while (current != end) {
construct(out, *current);
current.destroy();
++out;
++current;
template < typename It, typename T >
inline void uninitialized_copy(It begin, It end, T* out) {
It cur = begin;
for (; cur != end; ++out, ++cur) {
construct(out, *cur);
}
}
template < typename S, typename D >
inline void uninitialized_copy(D* out, S* begin, S* end) {
while (begin != end) {
construct(out, *begin);
++out;
++begin;
inline void uninitialized_copy_n(S src, int n, D dest) {
D cur = dest;
for (int i = 0; i < n; ++cur, ++i, ++src) {
construct(&*cur, *src);
}
// rstl::destroy(begin, end);
}
// FIXME this is a hack around regalloc
// need to figure out the proper types/positions for all of these funcs
template < typename S, typename D >
inline void uninitialized_copy_2(S* begin, D* out, S* end) {
while (begin != end) {
construct(out, *begin);
++out;
++begin;
}
}
template < typename S, typename D >
// inline void uninitialized_copy_n(S* src, int count, D* dest) {
inline void uninitialized_copy_n(D* dest, S* src, int count) {
for (int i = 0; i < count; ++dest, ++i, ++src) {
construct(dest, *src);
}
// destroy(src, src + count); ??
}
template < typename D, typename S >
inline void uninitialized_fill_n(D dest, int count, const S& value) {
for (int i = 0; i < count; ++dest, ++i) {
construct(dest, value);
inline void uninitialized_fill_n(D dest, int n, const S& value) {
D cur = dest;
for (; n > 0; --n, ++cur) {
construct(&*cur, value);
}
}
} // namespace rstl

View File

@ -14,7 +14,7 @@ public:
node* cur = x4_start;
while (cur != x8_end) {
cur->get_value()->~T();
Alloc::deallocate(cur->get_value());
x0_allocator.deallocate(cur->get_value());
cur = cur->get_next();
}
}

View File

@ -2,6 +2,7 @@
#define _RSTL_POINTER_ITERATOR_HPP
#include "types.h"
#include "stddef.h"
#include "rstl/construct.hpp"
@ -15,6 +16,7 @@ struct random_access_iterator_tag : public bidirectional_iterator_tag {};
template < typename T, typename Vec, typename Alloc >
class const_pointer_iterator {
public:
typedef ptrdiff_t difference_type;
typedef random_access_iterator_tag iterator_category;
typedef T* value_type;
@ -24,12 +26,12 @@ public:
++this->current;
return *this;
}
const_pointer_iterator& operator++(int) { return const_pointer_iterator(this->current++); }
const_pointer_iterator operator++(int) { return const_pointer_iterator(this->current++); }
const_pointer_iterator& operator--() {
--this->current;
return *this;
}
const_pointer_iterator& operator--(int) { return const_pointer_iterator(this->current--); }
const_pointer_iterator operator--(int) { return const_pointer_iterator(this->current--); }
const_pointer_iterator& operator+=(int v) {
this->current += v;
return *this;
@ -46,7 +48,10 @@ public:
const_pointer_iterator it = *this;
return it -= v;
}
int operator-(const const_pointer_iterator& other) const { return this->current - other.current; }
difference_type operator-(const const_pointer_iterator& other) const {
return this->current - other.current;
}
const T* get_pointer() const { return current; }
const T& operator*() const { return *current; }
const T* operator->() const { return current; }
bool operator==(const const_pointer_iterator& other) { return current == other.current; }
@ -69,13 +74,18 @@ protected:
template < typename T, typename Vec, typename Alloc >
class pointer_iterator : public const_pointer_iterator< T, Vec, Alloc > {
typedef const_pointer_iterator< T, Vec, Alloc > base;
public:
typedef base::difference_type difference_type;
typedef base::iterator_category iterator_category;
typedef base::value_type value_type;
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) { rstl::construct(this->current, other); }
T& operator*() { return *this->current; }
T* operator->() { return this->current; }
void destroy() const { rstl::destroy(this->current); }
T& operator*() const { return *this->current; }
T* operator->() const { return this->current; }
pointer_iterator& operator++() {
++this->current;
return *this;
@ -102,7 +112,29 @@ public:
pointer_iterator it = *this;
return it -= v;
}
// HACK: non-const operator- is required to match vector::insert
difference_type operator-(const pointer_iterator& other) {
return this->current - other.current;
}
};
template < typename T >
struct const_counting_iterator {
const T* ptr;
int count;
const_counting_iterator(const T* ptr, int count) : ptr(ptr), count(count) {}
};
template < typename It >
inline typename It::difference_type __distance(It first, It last, random_access_iterator_tag) {
return last - first;
}
template < typename It >
inline typename It::difference_type distance(It first, It last) {
return __distance(first, last, It::iterator_category());
}
} // namespace rstl
#endif

View File

@ -22,23 +22,21 @@ public:
inline const_iterator end() const { return const_iterator(data() + x0_count); }
reserved_vector() : x0_count(0) {}
// reserved_vector(const T& value) : x0_count(N) { rstl::uninitialized_fill_n(data(), N, value); }
reserved_vector(const reserved_vector& other) {
x0_count = other.size();
// rstl::uninitialized_copy_n(other.data(), size(), data());
rstl::uninitialized_copy_n(data(), other.data(), size());
reserved_vector(const T& value) : x0_count(N) { uninitialized_fill_n(data(), N, value); }
reserved_vector(const reserved_vector& other) : x0_count(other.x0_count) {
uninitialized_copy_n(other.data(), x0_count, data());
}
reserved_vector& operator=(const reserved_vector& other) {
if (this != &other) {
clear();
rstl::uninitialized_copy_2(other.data(), data(), other.data() + other.size());
uninitialized_copy(data(), other.data() + other.size(), other.data());
x0_count = other.x0_count;
}
return *this;
}
void clear() {
for (int i = 0; i < x0_count; ++i) {
rstl::destroy(&data()[i]);
destroy(&data()[i]);
}
x0_count = 0;
}

View File

@ -8,8 +8,23 @@
namespace rstl {
struct rmemory_allocator {
template < typename T >
static void allocate(T*& out, int sz) {
out = reinterpret_cast< T* >(new u8[sz]);
static void allocate(T*& out, int count) {
int size = count * sizeof(T);
if (size == 0) {
out = nullptr;
} else {
out = reinterpret_cast< T* >(new u8[size]);
}
}
// TODO: this fixes a regswap in vector::reserve
template < typename T >
static T* allocate2(int count) {
int size = count * sizeof(T);
if (size == 0) {
return nullptr;
} else {
return reinterpret_cast< T* >(new u8[size]);
}
}
template < typename T >
static void deallocate(T* ptr) {

View File

@ -25,6 +25,7 @@ namespace rstl {
template < typename T, typename Alloc = rmemory_allocator >
class vector {
protected:
Alloc x0_allocator;
int x4_count;
int x8_capacity;
@ -41,36 +42,27 @@ public:
inline vector() : x4_count(0), x8_capacity(0), xc_items(NULL) {}
inline vector(int count) : x4_count(0), x8_capacity(0), xc_items(0) { reserve(count); }
vector(int count, const T& v) : x4_count(count), x8_capacity(count) {
if (x4_count * sizeof(T) == 0) {
xc_items = NULL;
} else {
x0_allocator.allocate(xc_items, x4_count * sizeof(T));
}
x0_allocator.allocate(xc_items, x4_count);
uninitialized_fill_n(xc_items, count, v);
}
vector(const vector& other) {
x4_count = other.x4_count;
x8_capacity = other.x8_capacity;
vector(const vector& other) : x4_count(other.x4_count), x8_capacity(other.x8_capacity) {
if (other.x4_count == 0 && other.x8_capacity == 0) {
xc_items = NULL;
xc_items = nullptr;
} else {
int sz = x8_capacity * sizeof(T);
if (sz == 0) {
xc_items = NULL;
} else {
x0_allocator.allocate(xc_items, sz);
}
// rstl::uninitialized_copy_n(other.data(), x4_count, data());
rstl::uninitialized_copy_n(data(), other.data(), x4_count);
x0_allocator.allocate(xc_items, x8_capacity);
uninitialized_copy_n(other.xc_items, x4_count, xc_items);
}
}
~vector() {
rstl::destroy(begin(), end());
destroy(begin(), end());
x0_allocator.deallocate(xc_items);
}
void reserve(int size);
void resize(int size, const T& in);
iterator insert(iterator it, const T& value); // TODO
template < typename from_iterator >
iterator insert(iterator it, from_iterator begin, from_iterator end);
iterator erase(iterator it);
void push_back(const T& in) {
@ -93,14 +85,14 @@ public:
xc_items = nullptr;
} else {
reserve(other.size());
rstl::uninitialized_copy(data(), other.data(), other.data() + other.size());
uninitialized_copy(data(), other.data(), other.data() + other.size());
x4_count = other.x4_count;
}
return *this;
}
void clear() {
rstl::destroy(begin(), end());
destroy(begin(), end());
x4_count = 0;
}
@ -117,6 +109,10 @@ public:
inline const T& back() const { return at(x4_count - 1); }
inline T& operator[](int idx) { return xc_items[idx]; }
inline const T& operator[](int idx) const { return xc_items[idx]; }
protected:
template < typename In >
void insert_into(iterator it, int count, In in);
};
template < typename T, typename Alloc >
@ -133,21 +129,24 @@ void vector< T, Alloc >::resize(int size, const T& in) {
}
template < typename T, typename Alloc >
void vector< T, Alloc >::reserve(int size) {
if (size <= x8_capacity)
void vector< T, Alloc >::reserve(int newSize) {
if (newSize <= x8_capacity) {
return;
int sz = size * sizeof(T);
T* newData;
if (sz == 0) {
newData = nullptr;
} else {
x0_allocator.allocate(newData, sz);
}
rstl::uninitialized_copy(begin(), end(), newData);
rstl::destroy(xc_items, xc_items + x4_count);
T* newData = x0_allocator.allocate2< T >(newSize);
uninitialized_copy(begin(), end(), newData);
destroy(xc_items, xc_items + x4_count);
x0_allocator.deallocate(xc_items);
xc_items = newData;
x8_capacity = size;
x8_capacity = newSize;
}
template < typename T, typename Alloc >
typename vector< T, Alloc >::iterator vector< T, Alloc >::insert(iterator it, const T& value) {
iterator::difference_type diff = it - begin(); // distance(begin(), it);
const_counting_iterator< T > in(&value, 0);
insert_into(it, 1, in);
return begin() + diff;
}
typedef vector< void > unk_vector;

View File

@ -36,31 +36,4 @@ SECTIONS
FORCEFILES
{
__init_cpp_exceptions.o
uart_console_io.o
mslsupp.o
CBallFilter.o
CABSIdle.o
CMetaAnimPlay.o
CMetaTransSnap.o
CAnimTreeAnimReaderContainer.o
CAnimTreeContinuousPhaseBlend.o
CAnimTreeSingleChild.o
CTimeScaleFunctions.o
CDvdRequest.o
CColorInstruction.o
CColorOverrideInstruction.o
CFontInstruction.o
CLineExtraSpaceInstruction.o
CLineSpacingInstruction.o
CPopStateInstruction.o
CPushStateInstruction.o
CRemoveColorOverrideInstruction.o
CWordInstruction.o
CBlockInstruction.o
CloseEnough.o
CParticleGen.o
CWarp.o
CImageInstruction.o
RumbleFxTable.o
CGuiWidgetDrawParms.o
}

View File

@ -8,6 +8,7 @@ extern "C" {
#define offsetof(type, member) ((size_t) & (((type*)0)->member))
typedef __typeof__(sizeof(0)) size_t;
typedef __typeof__((char*)0 - (char*)0) ptrdiff_t;
#ifndef NULL
#define NULL 0L

View File

@ -560,7 +560,7 @@ KYOTO_1 :=\
$(BUILD_DIR)/asm/Kyoto/Streams/CZipSupport.o\
$(BUILD_DIR)/asm/Kyoto/CSimplePool.o\
$(BUILD_DIR)/asm/Kyoto/CToken.o\
$(BUILD_DIR)/asm/Kyoto/IObj.o
$(BUILD_DIR)/asm/Kyoto/IObj.o\
ZLIB_FILES :=\
$(BUILD_DIR)/src/Kyoto/zlib/adler32.o\
@ -629,17 +629,17 @@ KYOTO_2 :=\
$(BUILD_DIR)/asm/Kyoto/CFrameDelayedKiller.o\
AI_FILES :=\
$(BUILD_DIR)/asm/Dolphin/ai.o
$(BUILD_DIR)/asm/Dolphin/ai.o\
AR_FILES :=\
$(BUILD_DIR)/asm/Dolphin/ar/ar.o\
$(BUILD_DIR)/asm/Dolphin/ar/arq.o
BASE_FILES :=\
$(BUILD_DIR)/src/Dolphin/PPCArch.o
$(BUILD_DIR)/src/Dolphin/PPCArch.o\
DB_FILES :=\
$(BUILD_DIR)/asm/Dolphin/db.o
$(BUILD_DIR)/asm/Dolphin/db.o\
DSP_FILES :=\
$(BUILD_DIR)/asm/Dolphin/dsp/dsp.o\
@ -671,18 +671,17 @@ GX_FILES :=\
$(BUILD_DIR)/asm/Dolphin/gx/GXStubs.o\
$(BUILD_DIR)/asm/Dolphin/gx/GXDisplayList.o\
$(BUILD_DIR)/asm/Dolphin/gx/GXTransform.o\
$(BUILD_DIR)/asm/Dolphin/gx/GXPerf.o
$(BUILD_DIR)/asm/Dolphin/gx/GXPerf.o\
MTX_FILES :=\
$(BUILD_DIR)/asm/Dolphin/mtx/mtx.o\
$(BUILD_DIR)/asm/Dolphin/mtx/mtx44vec.o\
$(BUILD_DIR)/asm/Dolphin/mtx/mtx44.o\
$(BUILD_DIR)/asm/Dolphin/mtx/vec.o\
$(BUILD_DIR)/asm/Dolphin/mtx/psmtx.o
$(BUILD_DIR)/asm/Dolphin/mtx/psmtx.o\
# TODO: Move __ppc_eabi_init_text into the same source files as __ppc_eabi_init
OS_FILES :=\
$(BUILD_DIR)/src/Dolphin/os/__start.o\
$(BUILD_DIR)/src/Dolphin/os/__start.ep.o\
$(BUILD_DIR)/asm/Dolphin/os/OS.o\
$(BUILD_DIR)/asm/Dolphin/os/OSAlarm.o\
$(BUILD_DIR)/asm/Dolphin/os/OSArena.o\
@ -703,7 +702,7 @@ OS_FILES :=\
$(BUILD_DIR)/asm/Dolphin/os/OSSync.o\
$(BUILD_DIR)/asm/Dolphin/os/OSThread.o\
$(BUILD_DIR)/asm/Dolphin/os/OSTime.o\
$(BUILD_DIR)/src/Dolphin/os/__ppc_eabi_init.o\
$(BUILD_DIR)/src/Dolphin/os/__ppc_eabi_init.ep.o\
PAD_FILES :=\
$(BUILD_DIR)/asm/Dolphin/pad/PadClamp.o\
@ -810,7 +809,7 @@ MUSYX_FILES :=\
$(BUILD_DIR)/src/musyx/reverb_fx.o\
$(BUILD_DIR)/asm/musyx/reverb.o\
$(BUILD_DIR)/src/musyx/delay_fx.o\
$(BUILD_DIR)/asm/musyx/chorus_fx.o
$(BUILD_DIR)/asm/musyx/chorus_fx.o\
DTK_FILES :=\
$(BUILD_DIR)/asm/Dolphin/dtk.o
@ -850,4 +849,4 @@ GBA_FILES :=\
$(BUILD_DIR)/asm/Dolphin/GBA/GBARead.o\
$(BUILD_DIR)/asm/Dolphin/GBA/GBAWrite.o\
$(BUILD_DIR)/asm/Dolphin/GBA/GBAXfer.o\
$(BUILD_DIR)/asm/Dolphin/GBA/GBAKey.o
$(BUILD_DIR)/asm/Dolphin/GBA/GBAKey.o\

View File

@ -99,7 +99,7 @@ CTri CAABox::GetTri(EBoxFaceId face, int windOffset) const {
verts[3] = CVector3f(min.GetX(), min.GetY(), max.GetZ());
break;
case kF_ZMin:
verts[0] = min;
verts[0] = CVector3f(min.GetX(), min.GetY(), min.GetZ());
verts[1] = CVector3f(max.GetX(), min.GetY(), min.GetZ());
verts[2] = CVector3f(max.GetX(), max.GetY(), min.GetZ());
verts[3] = CVector3f(min.GetX(), max.GetY(), min.GetZ());
@ -228,13 +228,7 @@ f32 CAABox::GetVolume() const {
return delta.GetX() * delta.GetY() * delta.GetZ();
}
CVector3f CAABox::GetCenterPoint() const {
CVector3f result = min + max;
result.SetX(result.GetX() * 0.5f);
result.SetY(result.GetY() * 0.5f);
result.SetZ(result.GetZ() * 0.5f);
return result;
}
CVector3f CAABox::GetCenterPoint() const { return (min + max) * 0.5f; }
CVector3f CAABox::GetPoint(int point) const {
const CVector3f* vecs[2] = {&min, &max};
@ -260,9 +254,12 @@ f32 CAABox::DistanceBetween(const CAABox& a, const CAABox& b) {
bool zi = b.GetMinPoint().GetZ() < a.GetMaxPoint().GetZ() && maxZ < minZ;
int intersects = 0;
if (xi) intersects |= 1;
if (yi) intersects |= 2;
if (zi) intersects |= 4;
if (xi)
intersects |= 1;
if (yi)
intersects |= 2;
if (zi)
intersects |= 4;
if (b.GetMinPoint().GetX() > a.GetMaxPoint().GetX()) {
minX = b.GetMinPoint().GetX();

View File

@ -326,7 +326,7 @@ void CActor::Render(const CStateManager& mgr) const {
if (GetModelData() && !NullModel()) {
bool renderPrePostParticles = GetRenderParticleDatabaseInside() && HasAnimation();
if (renderPrePostParticles) {
x64_modelData->GetAnimationData()->GetParticleDB().RenderSystemsToBeDrawnFirst();
GetAnimationData()->GetParticleDB().RenderSystemsToBeDrawnFirst();
}
if (xe7_27_enableRender) {
@ -337,8 +337,7 @@ void CActor::Render(const CStateManager& mgr) const {
RenderInternal(mgr);
} else {
const f32 timeSince = CGraphics::GetSecondsMod900() - xbc_time;
const f32 tpTime = CMath::FastFmod(timeSince, 900.f);
CTimeProvider tp(tpTime);
CTimeProvider tp(CMath::FastFmod(timeSince, 900.f));
RenderInternal(mgr);
}
if (xe5_31_pointGeneratorParticles) {
@ -348,7 +347,7 @@ void CActor::Render(const CStateManager& mgr) const {
}
if (renderPrePostParticles) {
x64_modelData->GetAnimationData()->GetParticleDB().RenderSystemsToBeDrawnLast();
GetAnimationData()->GetParticleDB().RenderSystemsToBeDrawnLast();
}
}
DrawTouchBounds();

View File

@ -366,10 +366,10 @@ bool CPlayerState::GetIsFusionEnabled() const { return x0_26_fusion; }
void CPlayerState::SetIsFusionEnabled(bool val) { x0_26_fusion = val; }
u32 CPlayerState::GetTotalPickupCount() const { return 99; }
int CPlayerState::GetTotalPickupCount() const { return 99; }
u32 CPlayerState::CalculateItemCollectionRate() const {
u32 total = GetItemCapacity(kIT_PowerBombs);
int CPlayerState::CalculateItemCollectionRate() const {
int total = GetItemCapacity(kIT_PowerBombs);
if (total >= 4)
total -= 3;
@ -407,7 +407,7 @@ u32 CPlayerState::CalculateItemCollectionRate() const {
return total + GetItemCapacity(kIT_Wavebuster);
}
u32 CPlayerState::GetMissileCostForAltAttack() const {
int CPlayerState::GetMissileCostForAltAttack() const {
return kMissileCosts[size_t(x8_currentBeam)];
}

View File

@ -264,6 +264,13 @@ void CScriptMazeNode::Accept(IVisitor& visitor) { visitor.Visit(*this); }
// return objUid;
// }
// struct GenerateObjectGuard {
// GenerateObjectGuard(CStateManager& mgr) : mgr(mgr), wasGenerating(mgr.IsGeneratingObject()) {}
// ~GenerateObjectGuard() { mgr.SetIsGeneratingObject(wasGenerating); }
// CStateManager& mgr;
// bool wasGenerating;
// };
// TODO non-matching
// https://decomp.me/scratch/IvHBz
void CScriptMazeNode::GenerateObjects(CStateManager& mgr) {
@ -285,6 +292,7 @@ void CScriptMazeNode::GenerateObjects(CStateManager& mgr) {
}
// TUniqueId objUid = GenerateObject(mgr, conn->x8_objId);
// TUniqueId objUid = kInvalidUniqueId;
bool wasGeneratingObject = mgr.IsGeneratingObject();
mgr.SetIsGeneratingObject(true);
TUniqueId objUid = mgr.GenerateObject(conn->x8_objId).second;

View File

@ -12,6 +12,7 @@
#include "MetroidPrime/Player/CPlayerState.hpp"
#include "MetroidPrime/ScriptObjects/CScriptPlatform.hpp"
#include "MetroidPrime/TCastTo.hpp"
#include "MetroidPrime/Weapons/CEnergyProjectile.hpp"
#include "MetaRender/CCubeRenderer.hpp"
@ -35,12 +36,11 @@ static int string_find(const string& haystack, const string& needle, int) {
return 0;
}
template < class RandomAccessIterator, class Compare >
void sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp) {
template < class It, class Cmp >
void sort(It first, It last, Cmp cmp) {
// TODO: proper implementation
comp(*first, *last);
cmp(*first, *last);
}
} // namespace rstl
CScriptSpecialFunction::CScriptSpecialFunction(
@ -979,41 +979,43 @@ void CScriptSpecialFunction::Render(CStateManager& mgr) {
}
void CScriptSpecialFunction::ThinkChaffTarget(float dt, CStateManager& mgr) {
/*
const zeus::CAABox box(5.f - GetTranslation(), 5.f + GetTranslation());
EntityList nearList;
mgr.BuildNearList(nearList, box, CMaterialFilter::MakeInclude({kMT_Projectile}), nullptr);
auto& filter = mgr.GetCameraFilterPass(7);
TEntityList nearList;
const CVector3f offset(5.f, 5.f, 5.f);
const CAABox box(GetTranslation() - offset, GetTranslation() + offset);
mgr.BuildNearList(nearList, box, CMaterialFilter::MakeInclude(kMT_Projectile), nullptr);
for (const auto& uid : nearList) {
if (const TCastToPtr<CEnergyProjectile> proj = mgr.ObjectById(uid)) {
for (int i = 0; i < nearList.size(); ++i) {
if (CEnergyProjectile* proj = TCastToPtr< CEnergyProjectile >(mgr.ObjectById(nearList[i]))) {
if (proj->GetHomingTargetId() == GetUniqueId()) {
proj->Set3d0_26(true);
if (mgr.GetPlayer().GetAreaIdAlways() == GetAreaIdAlways()) {
mgr.GetPlayer().SetHudDisable(x100_float2, 0.5f, 2.5f);
filter.SetFilter(EFilterType::Blend, EFilterShape::Fullscreen, 0.f, zeus::skWhite,
CAssetId()); filter.DisableFilter(0.1f);
if (mgr.GetPlayer()->GetAreaIdAlways() == GetAreaIdAlways()) {
mgr.Player()->SetHudDisable(x100_float2);
x194_ = xfc_float1;
CCameraFilterPass& filter = mgr.CameraFilterPass(CStateManager::kCFS_Seven);
filter.SetFilter(CCameraFilterPass::kFT_Blend, CCameraFilterPass::kFS_Fullscreen, 0.f,
CColor(1.f, 1.f, 1.f), kInvalidAssetId);
filter.DisableFilter(0.1f);
}
}
}
}
x194_ = zeus::max(0.f, x194_ - dt);
if (x194_ != 0.f && mgr.GetPlayer()->GetAreaIdAlways() == GetAreaIdAlways()) {
float intfMag = x104_float3 * (0.5f + ((0.5f + x194_) / xfc_float1));
bool addedInterference = false;
x194_ = CMath::Max(0.f, x194_ - dt);
if (x194_ && mgr.GetPlayer()->GetAreaIdAlways() == GetAreaIdAlways()) {
addedInterference = true;
float intfMag = x104_float3 * (0.5f + ((0.5f * x194_) / xfc_float1));
if (x194_ < 1.f) {
intfMag *= x194_;
}
mgr.GetPlayerState()->GetStaticInterference().AddSource(GetUniqueId(), intfMag, .5f);
if (mgr.GetPlayerState()->GetCurrentVisor() != kPV_Scan) {
mgr.GetPlayer()->AddOrbitDisableSource(mgr, GetUniqueId());
} else {
mgr.GetPlayer()->RemoveOrbitDisableSource(GetUniqueId());
}
mgr.PlayerState()->StaticInterference().AddSource(GetUniqueId(), intfMag, 0.5f);
}
if (addedInterference && mgr.GetPlayerState()->GetCurrentVisor() != CPlayerState::kPV_Thermal) {
mgr.Player()->AddOrbitDisableSource(mgr, GetUniqueId());
} else {
mgr.Player()->RemoveOrbitDisableSource(GetUniqueId());
}
*/
}
void CScriptSpecialFunction::ThinkRainSimulator(float, CStateManager& mgr) {
@ -1095,25 +1097,6 @@ void CScriptSpecialFunction::ThinkPlayerInArea(float dt, CStateManager& mgr) {
}
}
void CScriptSpecialFunction::DeleteEmitter(CSfxHandle& handle) {
if (handle) {
CSfxManager::RemoveEmitter(handle);
handle.Clear();
}
}
u32 CScriptSpecialFunction::GetSpecialEnding(const CStateManager& mgr) const {
const u32 rate = (mgr.GetPlayerState()->CalculateItemCollectionRate() * 100) /
mgr.GetPlayerState()->GetTotalPickupCount();
if (rate < 75) {
return 0;
}
if (rate < 100) {
return 1;
}
return 2;
}
void CScriptSpecialFunction::AddOrUpdateEmitter(float pitch, CSfxHandle& handle, u16 id,
const CVector3f& pos, uchar vol) {
if (!handle) {
@ -1125,9 +1108,24 @@ void CScriptSpecialFunction::AddOrUpdateEmitter(float pitch, CSfxHandle& handle,
}
}
CScriptSpecialFunction::SRingController::SRingController(TUniqueId uid, float rotateSpeed,
bool reachedTarget)
: x0_id(uid)
, x4_rotateSpeed(rotateSpeed)
, x8_reachedTarget(reachedTarget)
, xc_(CVector3f::Zero()) {}
void CScriptSpecialFunction::DeleteEmitter(CSfxHandle& handle) {
if (handle) {
CSfxManager::RemoveEmitter(handle);
handle.Clear();
}
}
int CScriptSpecialFunction::GetSpecialEnding(const CStateManager& mgr) const {
const int rate = (mgr.GetPlayerState()->CalculateItemCollectionRate() * 100) /
mgr.GetPlayerState()->GetTotalPickupCount();
int result;
if (rate < 75) {
result = 0;
} else {
result = 2;
if (rate < 100) {
result = 1;
}
}
return result;
}