From 72aa60b96f6fbe65b4c6a4dcba0fd73fedbdbb0d Mon Sep 17 00:00:00 2001 From: Yanis <35189056+Yanis002@users.noreply.github.com> Date: Wed, 1 Apr 2026 02:20:31 +0200 Subject: [PATCH] Decompile overlay 112 (PlayerSceneChange) (#38) * fix scratch upload? * start overlay 112 * comment format thing * build fixes 1 * name cs index * started vfunc_0c and vfunc_10 * added scratch links * config changes * fix build issues * first wave of broken matches * second wave of broken matches * fix build issue * third wave of broken matches * forth wave of broken matches --- config/eur/arm9/overlays/ov000/relocs.txt | 4 +- config/eur/arm9/overlays/ov000/symbols.txt | 6 +- config/eur/arm9/overlays/ov110/symbols.txt | 2 +- config/eur/arm9/overlays/ov112/delinks.txt | 7 + config/eur/arm9/overlays/ov112/relocs.txt | 8 +- config/eur/arm9/overlays/ov112/symbols.txt | 28 +- config/eur/arm9/symbols.txt | 2 +- config/jp/arm9/overlays/ov000/relocs.txt | 4 +- config/jp/arm9/overlays/ov000/symbols.txt | 6 +- config/jp/arm9/overlays/ov110/symbols.txt | 2 +- config/jp/arm9/overlays/ov112/delinks.txt | 7 + config/jp/arm9/overlays/ov112/relocs.txt | 8 +- config/jp/arm9/overlays/ov112/symbols.txt | 28 +- include/Actor/Actor.hpp | 2 +- include/Actor/ActorManager.hpp | 1 + include/FileSelect/FileSelect.hpp | 2 +- include/Player/PlayerGet.hpp | 2 +- include/Player/PlayerSceneChange.hpp | 58 ++ include/System/Random.hpp | 16 - include/Unknown/UnkStruct_027e09a4.hpp | 42 +- include/Unknown/UnkStruct_027e09b8.hpp | 1 + include/Unknown/UnkStruct_027e0cd8.hpp | 3 + include/Unknown/UnkStruct_027e0cdc.hpp | 16 + include/Unknown/UnkStruct_027e0ce8.hpp | 34 +- include/Unknown/UnkStruct_ov000_0208f820.hpp | 81 +- include/nitro/math.h | 85 +- src/000_Second/Actor/Actor.cpp | 10 +- src/019_MainSelect/FileSelectMain.cpp | 2 +- src/019_MainSelect/FileSelectOptions.cpp | 8 +- src/019_MainSelect/FileSelectSubScreen.cpp | 10 +- src/031_Land/Actor/ActorRupee.cpp | 14 +- src/110_PlayerGet/PlayerGet.cpp | 34 +- .../PlayerSceneChange.cpp | 751 ++++++++++++++++++ .../PlayerSceneChange2.cpp | 91 +++ tools/configure.py | 7 + tools/m2ctx.py | 1 + 36 files changed, 1208 insertions(+), 175 deletions(-) create mode 100644 include/Player/PlayerSceneChange.hpp create mode 100644 include/Unknown/UnkStruct_027e0cdc.hpp create mode 100644 src/112_PlayerSceneChange/PlayerSceneChange.cpp create mode 100644 src/112_PlayerSceneChange/PlayerSceneChange2.cpp diff --git a/config/eur/arm9/overlays/ov000/relocs.txt b/config/eur/arm9/overlays/ov000/relocs.txt index aae46642..3289b51c 100644 --- a/config/eur/arm9/overlays/ov000/relocs.txt +++ b/config/eur/arm9/overlays/ov000/relocs.txt @@ -6226,9 +6226,9 @@ from:0x020941cc kind:arm_call to:0x02185aec module:overlay(108) from:0x020941ec kind:arm_call to:0x02184e58 module:overlay(108) from:0x0209420c kind:arm_call to:0x02185ab0 module:overlay(111) from:0x0209422c kind:arm_call to:0x021851f4 module:overlay(111) -from:0x0209424c kind:arm_call to:0x02184a40 module:overlays(103,104,105,106,107,108,109,110,111,112,113) +from:0x0209424c kind:arm_call to:0x02184a40 module:overlay(113) from:0x0209426c kind:arm_call to:0x0218600c module:overlay(112) -from:0x0209428c kind:arm_call to:0x02184a40 module:overlays(103,104,105,106,107,108,109,110,111,112,113) +from:0x0209428c kind:arm_call to:0x02184a40 module:overlay(112) from:0x020942ac kind:arm_call to:0x02184ddc module:overlay(110) from:0x020942d0 kind:arm_call to:0x0208f820 module:overlay(0) from:0x020942e0 kind:load to:0x02178824 module:overlays(91,93,94) diff --git a/config/eur/arm9/overlays/ov000/symbols.txt b/config/eur/arm9/overlays/ov000/symbols.txt index a97d92f7..3d755d6c 100644 --- a/config/eur/arm9/overlays/ov000/symbols.txt +++ b/config/eur/arm9/overlays/ov000/symbols.txt @@ -1671,7 +1671,7 @@ func_ov000_020829e4 kind:function(thumb,size=0x14) addr:0x020829e4 func_ov000_020829f8 kind:function(arm,size=0x10) addr:0x020829f8 func_ov000_02082a08 kind:function(arm,size=0x10) addr:0x02082a08 func_ov000_02082a18 kind:function(arm,size=0x10) addr:0x02082a18 -func_ov000_02082a28 kind:function(arm,size=0x10) addr:0x02082a28 +_ZN18UnkStruct_027e0cdc19func_ov000_02082a28Ei kind:function(arm,size=0x10) addr:0x02082a28 func_ov000_02082a38 kind:function(arm,size=0x10) addr:0x02082a38 func_ov000_02082a48 kind:function(arm,size=0x10) addr:0x02082a48 func_ov000_02082a58 kind:function(arm,size=0x48) addr:0x02082a58 @@ -2095,8 +2095,8 @@ func_ov000_020901f4 kind:function(arm,size=0x55c) addr:0x020901f4 func_ov000_02090750 kind:function(arm,size=0x3c) addr:0x02090750 func_ov000_0209078c kind:function(arm,size=0x30) addr:0x0209078c _ZN24UnkStruct_ov000_0208f8208vfunc_14Ev kind:function(arm,size=0x4) addr:0x020907bc -func_ov000_020907c0 kind:function(arm,size=0x4) addr:0x020907c0 -_ZN24UnkStruct_ov000_0208f8208vfunc_1cEv kind:function(arm,size=0x54) addr:0x020907c4 +_ZN24UnkStruct_ov000_0208f8208vfunc_18Eiii kind:function(arm,size=0x4) addr:0x020907c0 +_ZN24UnkStruct_ov000_0208f8208vfunc_1cEP5Vec3p kind:function(arm,size=0x54) addr:0x020907c4 func_ov000_02090818 kind:function(arm,size=0x38) addr:0x02090818 func_ov000_02090850 kind:function(arm,size=0x90) addr:0x02090850 func_ov000_020908e0 kind:function(arm,size=0x104) addr:0x020908e0 diff --git a/config/eur/arm9/overlays/ov110/symbols.txt b/config/eur/arm9/overlays/ov110/symbols.txt index 8e6c7332..ff316360 100644 --- a/config/eur/arm9/overlays/ov110/symbols.txt +++ b/config/eur/arm9/overlays/ov110/symbols.txt @@ -4,7 +4,7 @@ _ZN9PlayerGetC2Ev kind:function(arm,size=0xa0) addr:0x02184ddc _ZN9PlayerGetD1Ev kind:function(arm,size=0xc4) addr:0x02184e7c _ZN9PlayerGetD0Ev kind:function(arm,size=0xcc) addr:0x02184f40 _ZN9PlayerGet8vfunc_0cEP35UnkStruct_PlayerGet_vfunc_0c_param1 kind:function(arm,size=0x5d8) addr:0x0218500c -_ZN9PlayerGet8vfunc_10Ei kind:function(arm,size=0x6d0) addr:0x021855e4 +_ZN9PlayerGet8vfunc_10Eii kind:function(arm,size=0x6d0) addr:0x021855e4 _ZN9PlayerGet8vfunc_18Eiii kind:function(arm,size=0x7c) addr:0x02185cb4 _ZN22UnkStruct_PlayerGet_ecC1Ev kind:function(arm,size=0xc) addr:0x02185d30 _ZN21UnkStruct_027e0ce0_3419func_ov110_02185d3cEi kind:function(thumb,size=0x66) addr:0x02185d3c diff --git a/config/eur/arm9/overlays/ov112/delinks.txt b/config/eur/arm9/overlays/ov112/delinks.txt index c2c1154b..4f96a8c5 100644 --- a/config/eur/arm9/overlays/ov112/delinks.txt +++ b/config/eur/arm9/overlays/ov112/delinks.txt @@ -3,3 +3,10 @@ .data start:0x02186500 end:0x02186560 kind:data align:32 .bss start:0x02186560 end:0x02186560 kind:bss align:32 +src/112_PlayerSceneChange/PlayerSceneChange.cpp: + .text start:0x02184a40 end:0x0218600c + .data start:0x02186500 end:0x02186528 + +src/112_PlayerSceneChange/PlayerSceneChange2.cpp: + .text start:0x0218600c end:0x021864e0 + .data start:0x02186528 end:0x02186560 diff --git a/config/eur/arm9/overlays/ov112/relocs.txt b/config/eur/arm9/overlays/ov112/relocs.txt index 1697239f..bb46215b 100644 --- a/config/eur/arm9/overlays/ov112/relocs.txt +++ b/config/eur/arm9/overlays/ov112/relocs.txt @@ -1,14 +1,14 @@ from:0x02184a48 kind:arm_call to:0x0208f820 module:overlay(0) -from:0x02184b00 kind:load to:0x02186508 module:overlay(112) +from:0x02184b00 kind:load to:0x02186500 add:8 module:overlay(112) from:0x02184b38 kind:arm_call to:0x0208a164 module:overlay(0) from:0x02184b40 kind:arm_call to:0x0205ca74 module:overlay(0) from:0x02184b48 kind:arm_call to:0x0208f8c4 module:overlay(0) -from:0x02184b54 kind:load to:0x02186508 module:overlay(112) +from:0x02184b54 kind:load to:0x02186500 add:8 module:overlay(112) from:0x02184b90 kind:arm_call to:0x0208a164 module:overlay(0) from:0x02184b98 kind:arm_call to:0x0205ca74 module:overlay(0) from:0x02184ba0 kind:arm_call to:0x0208f8c4 module:overlay(0) from:0x02184ba8 kind:arm_call to:0x02011ff4 module:main -from:0x02184bb4 kind:load to:0x02186508 module:overlay(112) +from:0x02184bb4 kind:load to:0x02186500 add:8 module:overlay(112) from:0x02184be4 kind:arm_call to:0x01fff3b4 module:itcm from:0x02184c10 kind:load to:0x027e0ce4 module:dtcm from:0x02184c70 kind:arm_call to:0x02080658 module:overlay(0) @@ -72,7 +72,7 @@ from:0x02185fa4 kind:arm_call to:0x02082a28 module:overlay(0) from:0x02186000 kind:arm_call to:0x020907c4 module:overlay(0) from:0x02186008 kind:load to:0x027e0cdc module:dtcm from:0x02186014 kind:arm_call to:0x0208f820 module:overlay(0) -from:0x02186048 kind:load to:0x02186530 module:overlay(112) +from:0x02186048 kind:load to:0x02186528 add:8 module:overlay(112) from:0x02186088 kind:arm_call to:0x0208ba10 module:overlay(0) from:0x021860a8 kind:arm_call to:0x0208cf20 module:overlay(0) from:0x021860d0 kind:arm_call to:0x02087ee8 module:overlay(0) diff --git a/config/eur/arm9/overlays/ov112/symbols.txt b/config/eur/arm9/overlays/ov112/symbols.txt index d5efd29a..e49cd2a9 100644 --- a/config/eur/arm9/overlays/ov112/symbols.txt +++ b/config/eur/arm9/overlays/ov112/symbols.txt @@ -1,14 +1,14 @@ -func_ov112_02184a40 kind:function(arm,size=0xc4) addr:0x02184a40 -func_ov112_02184b04 kind:function(arm,size=0x58) addr:0x02184b04 -func_ov112_02184b5c kind:function(arm,size=0x60) addr:0x02184b5c -func_ov112_02184bbc kind:function(arm,size=0x58) addr:0x02184bbc -func_ov112_02184c14 kind:function(arm,size=0xb68) addr:0x02184c14 -func_ov112_0218577c kind:function(arm,size=0x80c) addr:0x0218577c -func_ov112_02185f88 kind:function(arm,size=0x84) addr:0x02185f88 -func_ov112_0218600c kind:function(arm,size=0x40) addr:0x0218600c -func_ov112_0218604c kind:function(arm,size=0x25c) addr:0x0218604c -func_ov112_021862a8 kind:function(arm,size=0x208) addr:0x021862a8 -func_ov112_021864b0 kind:function(arm,size=0x14) addr:0x021864b0 -func_ov112_021864c4 kind:function(arm,size=0x1c) addr:0x021864c4 -data_ov112_02186508 kind:data(any) addr:0x02186508 -data_ov112_02186530 kind:data(any) addr:0x02186530 +_ZN17PlayerSceneChangeC1Ev kind:function(arm,size=0xc4) addr:0x02184a40 +_ZN17PlayerSceneChangeD1Ev kind:function(arm,size=0x58) addr:0x02184b04 +_ZN17PlayerSceneChangeD0Ev kind:function(arm,size=0x60) addr:0x02184b5c +_ZN17PlayerSceneChange19func_ov112_02184bbcEs kind:function(arm,size=0x58) addr:0x02184bbc +_ZN17PlayerSceneChange8vfunc_0cEP35UnkStruct_PlayerGet_vfunc_0c_param1 kind:function(arm,size=0xb68) addr:0x02184c14 +_ZN17PlayerSceneChange8vfunc_10Eii kind:function(arm,size=0x80c) addr:0x0218577c +_ZN17PlayerSceneChange8vfunc_1cEP5Vec3p kind:function(arm,size=0x84) addr:0x02185f88 +_ZN18PlayerSceneChange2C1Ev kind:function(arm,size=0x40) addr:0x0218600c +_ZN18PlayerSceneChange28vfunc_0cEP35UnkStruct_PlayerGet_vfunc_0c_param1 kind:function(arm,size=0x25c) addr:0x0218604c +_ZN18PlayerSceneChange28vfunc_10Eii kind:function(arm,size=0x208) addr:0x021862a8 +_ZN18PlayerSceneChange2D1Ev kind:function(arm,size=0x14) addr:0x021864b0 +_ZN18PlayerSceneChange2D0Ev kind:function(arm,size=0x1c) addr:0x021864c4 +_ZTV17PlayerSceneChange kind:data(any) addr:0x02186500 +_ZTV18PlayerSceneChange2 kind:data(any) addr:0x02186528 diff --git a/config/eur/arm9/symbols.txt b/config/eur/arm9/symbols.txt index 22ab836e..930a0665 100644 --- a/config/eur/arm9/symbols.txt +++ b/config/eur/arm9/symbols.txt @@ -2262,7 +2262,7 @@ data_0203e8c8 kind:data(any) addr:0x0203e8c8 data_0203e90c kind:data(any) addr:0x0203e90c data_0203e958 kind:data(any) addr:0x0203e958 data_0203e95e kind:data(any) addr:0x0203e95e -data_0203e964 kind:data(any) addr:0x0203e964 +gSinCosTable kind:data(any) addr:0x0203e964 data_0203ea64 kind:data(any) addr:0x0203ea64 data_0203ec64 kind:data(any) addr:0x0203ec64 data_0203ee64 kind:data(any) addr:0x0203ee64 diff --git a/config/jp/arm9/overlays/ov000/relocs.txt b/config/jp/arm9/overlays/ov000/relocs.txt index a15f2f9a..18e9d1bc 100644 --- a/config/jp/arm9/overlays/ov000/relocs.txt +++ b/config/jp/arm9/overlays/ov000/relocs.txt @@ -6227,9 +6227,9 @@ from:0x02095980 kind:arm_call to:0x0218766c module:overlay(108) from:0x020959a0 kind:arm_call to:0x021869d8 module:overlay(108) from:0x020959c0 kind:arm_call to:0x02187630 module:overlay(111) from:0x020959e0 kind:arm_call to:0x02186d74 module:overlay(111) -from:0x02095a00 kind:arm_call to:0x021865c0 module:overlays(109,103,104,105,106,107,108,110,111,112,113) +from:0x02095a00 kind:arm_call to:0x021865c0 module:overlay(113) from:0x02095a20 kind:arm_call to:0x02187b8c module:overlay(112) -from:0x02095a40 kind:arm_call to:0x021865c0 module:overlays(109,103,104,105,106,107,108,110,111,112,113) +from:0x02095a40 kind:arm_call to:0x021865c0 module:overlay(112) from:0x02095a60 kind:arm_call to:0x0218695c module:overlay(110) from:0x02095a84 kind:arm_call to:0x02090efc module:overlay(0) from:0x02095a94 kind:load to:0x0217b264 module:overlays(93,94) diff --git a/config/jp/arm9/overlays/ov000/symbols.txt b/config/jp/arm9/overlays/ov000/symbols.txt index b36d3c94..31e5ffcf 100644 --- a/config/jp/arm9/overlays/ov000/symbols.txt +++ b/config/jp/arm9/overlays/ov000/symbols.txt @@ -1669,7 +1669,7 @@ func_ov000_020840a0 kind:function(thumb,size=0x14) addr:0x020840a0 func_ov000_020840b4 kind:function(arm,size=0x10) addr:0x020840b4 func_ov000_020840c4 kind:function(arm,size=0x10) addr:0x020840c4 func_ov000_020840d4 kind:function(arm,size=0x10) addr:0x020840d4 -func_ov000_020840e4 kind:function(arm,size=0x10) addr:0x020840e4 +_ZN18UnkStruct_027e0cdc19func_ov000_02082a28Ei kind:function(arm,size=0x10) addr:0x020840e4 func_ov000_020840f4 kind:function(arm,size=0x10) addr:0x020840f4 func_ov000_02084104 kind:function(arm,size=0x10) addr:0x02084104 func_ov000_02084114 kind:function(arm,size=0x48) addr:0x02084114 @@ -2093,8 +2093,8 @@ func_ov000_020918d0 kind:function(arm,size=0x55c) addr:0x020918d0 func_ov000_02091e2c kind:function(arm,size=0x3c) addr:0x02091e2c func_ov000_02091e68 kind:function(arm,size=0x30) addr:0x02091e68 _ZN24UnkStruct_ov000_0208f8208vfunc_14Ev kind:function(arm,size=0x4) addr:0x02091e98 -func_ov000_02091e9c kind:function(arm,size=0x4) addr:0x02091e9c -_ZN24UnkStruct_ov000_0208f8208vfunc_1cEv kind:function(arm,size=0x54) addr:0x02091ea0 +_ZN24UnkStruct_ov000_0208f8208vfunc_18Eiii kind:function(arm,size=0x4) addr:0x02091e9c +_ZN24UnkStruct_ov000_0208f8208vfunc_1cEP5Vec3p kind:function(arm,size=0x54) addr:0x02091ea0 func_ov000_02091ef4 kind:function(arm,size=0x38) addr:0x02091ef4 func_ov000_02091f2c kind:function(arm,size=0x90) addr:0x02091f2c func_ov000_02091fbc kind:function(arm,size=0x104) addr:0x02091fbc diff --git a/config/jp/arm9/overlays/ov110/symbols.txt b/config/jp/arm9/overlays/ov110/symbols.txt index a4fdb710..3eb2f456 100644 --- a/config/jp/arm9/overlays/ov110/symbols.txt +++ b/config/jp/arm9/overlays/ov110/symbols.txt @@ -5,7 +5,7 @@ _ZN9PlayerGetD1Ev kind:function(arm,size=0xc4) addr:0x021869fc _ZN9PlayerGetD0Ev kind:function(arm,size=0xcc) addr:0x02186ac0 _ZN9PlayerGet19func_ov110_02186b8cEv kind:function(arm,size=0x54) addr:0x02186b8c _ZN9PlayerGet8vfunc_0cEP35UnkStruct_PlayerGet_vfunc_0c_param1 kind:function(arm,size=0x5d8) addr:0x02186be0 -_ZN9PlayerGet8vfunc_10Ei kind:function(arm,size=0x6fc) addr:0x021871b8 +_ZN9PlayerGet8vfunc_10Eii kind:function(arm,size=0x6fc) addr:0x021871b8 _ZN9PlayerGet8vfunc_18Eiii kind:function(arm,size=0x7c) addr:0x021878b4 _ZN22UnkStruct_PlayerGet_ecC1Ev kind:function(arm,size=0xc) addr:0x02187930 _ZN21UnkStruct_027e0ce0_3419func_ov110_02185d3cEi kind:function(thumb,size=0x66) addr:0x0218793c diff --git a/config/jp/arm9/overlays/ov112/delinks.txt b/config/jp/arm9/overlays/ov112/delinks.txt index 705c92db..b7193b7e 100644 --- a/config/jp/arm9/overlays/ov112/delinks.txt +++ b/config/jp/arm9/overlays/ov112/delinks.txt @@ -3,3 +3,10 @@ .data start:0x02188080 end:0x021880e0 kind:data align:32 .bss start:0x021880e0 end:0x021880e0 kind:bss align:32 +src/112_PlayerSceneChange/PlayerSceneChange.cpp: + .text start:0x021865c0 end:0x02187b8c + .data start:0x02188080 end:0x021880a8 + +src/112_PlayerSceneChange/PlayerSceneChange2.cpp: + .text start:0x02187b8c end:0x02188060 + .data start:0x021880a8 end:0x021880e0 diff --git a/config/jp/arm9/overlays/ov112/relocs.txt b/config/jp/arm9/overlays/ov112/relocs.txt index a76f820c..62eac31e 100644 --- a/config/jp/arm9/overlays/ov112/relocs.txt +++ b/config/jp/arm9/overlays/ov112/relocs.txt @@ -1,14 +1,14 @@ from:0x021865c8 kind:arm_call to:0x02090efc module:overlay(0) -from:0x02186680 kind:load to:0x02188088 module:overlay(112) +from:0x02186680 kind:load to:0x02188080 add:8 module:overlay(112) from:0x021866b8 kind:arm_call to:0x0208b838 module:overlay(0) from:0x021866c0 kind:arm_call to:0x0205dffc module:overlay(0) from:0x021866c8 kind:arm_call to:0x02090fa0 module:overlay(0) -from:0x021866d4 kind:load to:0x02188088 module:overlay(112) +from:0x021866d4 kind:load to:0x02188080 add:8 module:overlay(112) from:0x02186710 kind:arm_call to:0x0208b838 module:overlay(0) from:0x02186718 kind:arm_call to:0x0205dffc module:overlay(0) from:0x02186720 kind:arm_call to:0x02090fa0 module:overlay(0) from:0x02186728 kind:arm_call to:0x02011ff4 module:main -from:0x02186734 kind:load to:0x02188088 module:overlay(112) +from:0x02186734 kind:load to:0x02188080 add:8 module:overlay(112) from:0x02186764 kind:arm_call to:0x01fff3b4 module:itcm from:0x02186790 kind:load to:0x027e0ce4 module:dtcm from:0x021867f0 kind:arm_call to:0x02081d10 module:overlay(0) @@ -72,7 +72,7 @@ from:0x02187b24 kind:arm_call to:0x020840e4 module:overlay(0) from:0x02187b80 kind:arm_call to:0x02091ea0 module:overlay(0) from:0x02187b88 kind:load to:0x027e0cdc module:dtcm from:0x02187b94 kind:arm_call to:0x02090efc module:overlay(0) -from:0x02187bc8 kind:load to:0x021880b0 module:overlay(112) +from:0x02187bc8 kind:load to:0x021880a8 add:8 module:overlay(112) from:0x02187c08 kind:arm_call to:0x0208d0e4 module:overlay(0) from:0x02187c28 kind:arm_call to:0x0208e5f8 module:overlay(0) from:0x02187c50 kind:arm_call to:0x020895bc module:overlay(0) diff --git a/config/jp/arm9/overlays/ov112/symbols.txt b/config/jp/arm9/overlays/ov112/symbols.txt index a9542b01..29194b29 100644 --- a/config/jp/arm9/overlays/ov112/symbols.txt +++ b/config/jp/arm9/overlays/ov112/symbols.txt @@ -1,14 +1,14 @@ -func_ov112_021865c0 kind:function(arm,size=0xc4) addr:0x021865c0 -func_ov112_02186684 kind:function(arm,size=0x58) addr:0x02186684 -func_ov112_021866dc kind:function(arm,size=0x60) addr:0x021866dc -func_ov112_0218673c kind:function(arm,size=0x58) addr:0x0218673c -func_ov112_02186794 kind:function(arm,size=0xb68) addr:0x02186794 -func_ov112_021872fc kind:function(arm,size=0x80c) addr:0x021872fc -func_ov112_02187b08 kind:function(arm,size=0x84) addr:0x02187b08 -func_ov112_02187b8c kind:function(arm,size=0x40) addr:0x02187b8c -func_ov112_02187bcc kind:function(arm,size=0x25c) addr:0x02187bcc -func_ov112_02187e28 kind:function(arm,size=0x208) addr:0x02187e28 -func_ov112_02188030 kind:function(arm,size=0x14) addr:0x02188030 -func_ov112_02188044 kind:function(arm,size=0x1c) addr:0x02188044 -data_ov112_02188088 kind:data(any) addr:0x02188088 -data_ov112_021880b0 kind:data(any) addr:0x021880b0 +_ZN17PlayerSceneChangeC1Ev kind:function(arm,size=0xc4) addr:0x021865c0 +_ZN17PlayerSceneChangeD1Ev kind:function(arm,size=0x58) addr:0x02186684 +_ZN17PlayerSceneChangeD0Ev kind:function(arm,size=0x60) addr:0x021866dc +_ZN17PlayerSceneChange19func_ov112_02184bbcEs kind:function(arm,size=0x58) addr:0x0218673c +_ZN17PlayerSceneChange8vfunc_0cEP35UnkStruct_PlayerGet_vfunc_0c_param1 kind:function(arm,size=0xb68) addr:0x02186794 +_ZN17PlayerSceneChange8vfunc_10Eii kind:function(arm,size=0x80c) addr:0x021872fc +_ZN17PlayerSceneChange8vfunc_1cEP5Vec3p kind:function(arm,size=0x84) addr:0x02187b08 +_ZN18PlayerSceneChange2C1Ev kind:function(arm,size=0x40) addr:0x02187b8c +_ZN18PlayerSceneChange28vfunc_0cEP35UnkStruct_PlayerGet_vfunc_0c_param1 kind:function(arm,size=0x25c) addr:0x02187bcc +_ZN18PlayerSceneChange28vfunc_10Eii kind:function(arm,size=0x208) addr:0x02187e28 +_ZN18PlayerSceneChange2D1Ev kind:function(arm,size=0x14) addr:0x02188030 +_ZN18PlayerSceneChange2D0Ev kind:function(arm,size=0x1c) addr:0x02188044 +_ZTV17PlayerSceneChange kind:data(any) addr:0x02188080 +_ZTV18PlayerSceneChange2 kind:data(any) addr:0x021880a8 diff --git a/include/Actor/Actor.hpp b/include/Actor/Actor.hpp index 7cb151c0..2f07e466 100644 --- a/include/Actor/Actor.hpp +++ b/include/Actor/Actor.hpp @@ -81,7 +81,7 @@ public: /* 04 */ Vec3p mPos; /* 10 */ Vec3p mPrevPos; /* 1c */ Vec3p mVel; - /* 28 */ u16 mAngle; + /* 28 */ s16 mAngle; /* 2a */ unk16 mUnk_2a; /* 2c */ unk32 mUnk_2c; // gravity? /* 30 */ Cylinder *mUnk_30; diff --git a/include/Actor/ActorManager.hpp b/include/Actor/ActorManager.hpp index a6e1fdbc..731a6255 100644 --- a/include/Actor/ActorManager.hpp +++ b/include/Actor/ActorManager.hpp @@ -42,6 +42,7 @@ public: ~ActorManager(); ActorUnk_ov000_020a8bb0 *func_01fff3b4(unk32 param1); + Actor **func_01fff350(void *param1, Actor **ppActorTable); void func_ov000_02096e44(int index); diff --git a/include/FileSelect/FileSelect.hpp b/include/FileSelect/FileSelect.hpp index e7a5e410..4c633df8 100644 --- a/include/FileSelect/FileSelect.hpp +++ b/include/FileSelect/FileSelect.hpp @@ -148,7 +148,7 @@ public: /* 10 */ unk32 mUnk_10; /* 14 */ unk32 mUnk_14; /* 18 */ unk32 mUnk_18; - /* 1C */ Vec2s mUnk_1C; + /* 1C */ VEC2S mUnk_1C; /* 20 */ volatile unk32 mUnk_20; }; diff --git a/include/Player/PlayerGet.hpp b/include/Player/PlayerGet.hpp index a420ca5f..6019a36b 100644 --- a/include/Player/PlayerGet.hpp +++ b/include/Player/PlayerGet.hpp @@ -152,7 +152,7 @@ public: /* 04 */ virtual ~PlayerGet() override; /* 0c */ virtual void vfunc_0c(UnkStruct_PlayerGet_vfunc_0c_param1 *param1) override; - /* 10 */ virtual void vfunc_10(unk32 param1) override; + /* 10 */ virtual void vfunc_10(unk32 param1, unk32 param2) override; /* 18 */ virtual void vfunc_18(unk32 param1, unk32 param2, unk32 param3) override; PlayerGet(); diff --git a/include/Player/PlayerSceneChange.hpp b/include/Player/PlayerSceneChange.hpp new file mode 100644 index 00000000..af3b2f67 --- /dev/null +++ b/include/Player/PlayerSceneChange.hpp @@ -0,0 +1,58 @@ +#pragma once + +#include "global.h" +#include "types.h" +#include "versions.h" + +#include "Unknown/UnkStruct_027e09a4.hpp" +#include "Unknown/UnkStruct_ov000_0208f820.hpp" +#include "nitro/math.h" + +class PlayerSceneChange : public UnkStruct_ov000_0208f820 { +public: + /* 00 (base) */ + /* 48 */ unk32 mUnk_48; + /* 4C */ unk32 mUnk_4C; + /* 50 */ unk32 mUnk_50; + /* 54 */ UnkStruct_SceneChange1 mUnk_54; + /* 68 */ unk32 mUnk_68; + /* 6C */ s32 mUnk_6C; + /* 70 */ volatile Vec3p mUnk_70; + /* 7C */ unk32 mUnk_7C; + /* 80 */ volatile Vec3p mUnk_80; + /* 8C */ unk32 mUnk_8C; + /* 90 */ volatile u32 mUnk_90; + /* 94 */ u16 mUnk_94[2]; + /* 98 */ unk32 mUnk_98; + /* 9C */ Vec3p mUnk_9C; + /* A8 */ unk16 mUnk_A8; + /* AA */ unk16 mUnk_AA; + /* AC */ bool mUnk_AC; + /* AD */ bool mUnk_AD; + /* AE */ s16 mUnk_AE; + + PlayerSceneChange(); + + s16 func_ov112_02184bbc(s16 param1); + + /* 04 */ virtual ~PlayerSceneChange() override; + /* 0C */ virtual void vfunc_0c(UnkStruct_PlayerGet_vfunc_0c_param1 *param1) override; + /* 10 */ virtual void vfunc_10(unk32 param1, unk32 param2) override; + /* 1C */ virtual bool vfunc_1c(Vec3p *param1) override; +}; + +class PlayerSceneChange2 : public UnkStruct_ov000_0208f820 { +public: + /* 00 (base) */ + /* 48 */ unk32 mUnk_48; + /* 4C */ unk32 mUnk_4C; + /* 50 */ unk32 mUnk_50; + /* 54 */ Vec3p mUnk_54; + /* 54 */ Vec3p mUnk_60; + + PlayerSceneChange2(); + + /* 04 */ virtual ~PlayerSceneChange2() override; + /* 0C */ virtual void vfunc_0c(UnkStruct_PlayerGet_vfunc_0c_param1 *param1) override; + /* 10 */ virtual void vfunc_10(unk32 param1, unk32 param2) override; +}; diff --git a/include/System/Random.hpp b/include/System/Random.hpp index 6f72fc98..029d66a9 100644 --- a/include/System/Random.hpp +++ b/include/System/Random.hpp @@ -52,22 +52,6 @@ struct Random { return result; } -#ifdef __MWERKS__ - Vec2us &NextPos(u16 xMax, u16 yMax) { - Vec2us pos; - - pos.x = this->Next32(0, xMax); - pos.y = this->Next32(0, yMax); - - return pos; - } -#else - const Vec2us NextPos(u16 xMax, u16 yMax) { - const Vec2us pos = {(u16) this->Next32(0, xMax), (u16) this->Next32(0, yMax)}; - return pos; - } -#endif - void Init(); }; diff --git a/include/Unknown/UnkStruct_027e09a4.hpp b/include/Unknown/UnkStruct_027e09a4.hpp index cb82f3c3..39853176 100644 --- a/include/Unknown/UnkStruct_027e09a4.hpp +++ b/include/Unknown/UnkStruct_027e09a4.hpp @@ -14,7 +14,8 @@ naming scheme: - b_xxx: "B" for "Boss" -> dungeon boss area - f_xxx: "F" for "Field" -> normal gameplay area (also known as a "land" area) */ -enum SceneIndex { +typedef u32 SceneIndex; +enum SceneIndex_ { /* 0 */ SceneIndex_test_trn = 0x00, // /* 1 */ SceneIndex_test_trn2 = 0x01, // /* 2 */ SceneIndex_test_pre = 0x02, // @@ -158,14 +159,14 @@ struct UnkStruct_func_01ffd400 { }; struct UnkStruct_SceneChange1 { - /* 00 */ unk32 nextSceneIndex; + /* 00 */ unk32 mNextSceneIndex; /* 04 */ unk32 mUnk_04; /* 08 */ unk16 mUnk_08; - /* 0A */ unk8 mUnk_0A; - /* 0B */ unk8 mUnk_0B; + /* 0A */ u8 mRoomIndex; + /* 0B */ unk8 mSpawnIndex; /* 0C */ unk8 mUnk_0C; /* 0D */ unk8 mUnk_0D; - /* 0E */ unk8 mUnk_0E; + /* 0E */ unk8 mCutsceneIndex; /* 0F */ unk8 mUnk_0F; /* 10 */ unk8 mUnk_10; /* 11 */ unk8 mUnk_11; @@ -174,14 +175,15 @@ struct UnkStruct_SceneChange1 { /* 14 */ UnkStruct_SceneChange1() { - this->nextSceneIndex = SceneIndex_Max; - this->mUnk_04 = 0; - this->mUnk_08 = 0; - this->mUnk_0A = 0xFF; - this->mUnk_0B = 0; + this->mNextSceneIndex = SceneIndex_Max; + this->mUnk_04 = 0; + this->mUnk_08 = 0; + this->mRoomIndex = 0xFF; // this changes when you enter a house, it's not clear if it has another purpose yet + this->mSpawnIndex = 0; // changing this then saving will change your spawn location after opening the save again + // (not the area) this->mUnk_0C = 0; this->mUnk_0D = 0; - this->mUnk_0E = 0x2B; + this->mCutsceneIndex = 0x2B; // array length of `data_ov000_020af780` this->mUnk_0F = 0; this->mUnk_10 = 0; } @@ -194,8 +196,7 @@ public: /* 78 */ UnkStruct_SceneChange1 mUnk_78; /* 8C */ unk32 mNextSceneIndex; /* 90 */ STRUCT_PAD(0x90, 0xB4); - /* B4 */ unk32 - mSpawnTransitionType; // the behavior of Link when entering a new scene (walk from the entrance, stay still etc) + /* B4 */ unk32 mSpawnTransitionType; // the behavior of Link when entering a new scene }; class UnkStruct_027e09a4 : public SysObject { @@ -208,15 +209,8 @@ public: /* 0E */ unk8 mUnk_0E; /* 0F */ unk8 mUnk_0F; /* 10 */ unk32 *mUnk_10; - /* 14 */ unk32 mSavedSceneIndex; - /* 18 */ unk32 mUnk_18; - /* 1C */ unk8 mUnk_1C; - /* 1D */ unk8 mUnk_1D; - /* 1E */ unk8 mSavedHouseIndex; // this changes when you enter a house, it's not clear if it has another purpose yet - /* 1F */ unk8 mSavedSpawnIndex; // changing this then saving will change your spawn location after opening the save again - // (not the area) - /* 20 */ unk32 mUnk_20; - /* 24 */ STRUCT_PAD(0x24, 0x54); + /* 14 */ UnkStruct_SceneChange1 mUnk_14; + /* 32 */ STRUCT_PAD(0x28, 0x54); /* 54 */ void *mUnk_54; // vtable /* 58 */ UnkStruct_WarpUnk1 *mpWarpUnk1; /* 5C */ unk32 mUnk_5C; @@ -259,6 +253,10 @@ public: void func_ov000_020708d8(unk32 param1); void func_ov000_02070938(unk32 param1); void func_ov000_02070a4c(unk32 param1); + unk32 func_ov000_02070554(); + unk16 *func_ov000_02070538(); + bool func_ov000_02070a9c(UnkStruct_SceneChange1 *param1); + bool func_ov000_02072154(UnkStruct_SceneChange1 *param1, unk32 param2); void func_ov017_020bb994(void *param1); void func_ov017_020bb994(unk32 param1); diff --git a/include/Unknown/UnkStruct_027e09b8.hpp b/include/Unknown/UnkStruct_027e09b8.hpp index ce50d7a7..29843f92 100644 --- a/include/Unknown/UnkStruct_027e09b8.hpp +++ b/include/Unknown/UnkStruct_027e09b8.hpp @@ -13,6 +13,7 @@ public: unk32 func_ov000_020732fc(unk32 param1); unk32 func_ov000_020732dc(unk32 param1); unk32 func_ov000_02073470(void *param1, unk32 param2); + unk32 func_ov000_02073388(void *param1); }; extern UnkStruct_027e09b8 *data_027e09b8; diff --git a/include/Unknown/UnkStruct_027e0cd8.hpp b/include/Unknown/UnkStruct_027e0cd8.hpp index 3864be37..3b2b1fdf 100644 --- a/include/Unknown/UnkStruct_027e0cd8.hpp +++ b/include/Unknown/UnkStruct_027e0cd8.hpp @@ -4,6 +4,8 @@ #include "nitro/math.h" #include "types.h" +#include "Unknown/UnkStruct_027e09a4.hpp" + class UnkStruct_027e0cd8_0c { public: /* 000 (vtable) */ @@ -79,6 +81,7 @@ public: /* 2c */ virtual void vfunc_2c(); unk32 func_ov000_02080a44(); + bool func_ov000_02080658(unk32 param1, UnkStruct_SceneChange1 *param2); }; class UnkStruct_027e0cd8 { diff --git a/include/Unknown/UnkStruct_027e0cdc.hpp b/include/Unknown/UnkStruct_027e0cdc.hpp new file mode 100644 index 00000000..bc69e2b5 --- /dev/null +++ b/include/Unknown/UnkStruct_027e0cdc.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include "global.h" +#include "types.h" + +class UnkStruct_027e0cdc { +public: + /* 00 */ unk32 mUnk_00; + + UnkStruct_027e0cdc(); + ~UnkStruct_027e0cdc(); + + unk32 func_ov000_02082a28(unk32 param1); +}; + +extern UnkStruct_027e0cdc *data_027e0cdc; diff --git a/include/Unknown/UnkStruct_027e0ce8.hpp b/include/Unknown/UnkStruct_027e0ce8.hpp index bbc55582..aa55dded 100644 --- a/include/Unknown/UnkStruct_027e0ce8.hpp +++ b/include/Unknown/UnkStruct_027e0ce8.hpp @@ -8,14 +8,42 @@ public: void func_ov031_02103878(); }; +class UnkStruct_027e0ce8_00 { +public: + /* 00 (vtable) */ + /* 04 */ STRUCT_PAD(0x04, 0x38); + /* 38 */ unk32 mUnk_38; + /* 3C */ STRUCT_PAD(0x3C, 0xCC); + /* CC */ unk32 mUnk_CC; + + /* 00 */ virtual void vfunc_00(); + /* 04 */ virtual void vfunc_04(); + /* 08 */ virtual void vfunc_08(); + /* 0C */ virtual void vfunc_0C(); + /* 10 */ virtual void vfunc_10(); + /* 14 */ virtual void vfunc_14(); + /* 18 */ virtual void vfunc_18(); + /* 1C */ virtual void vfunc_1C(); + /* 20 */ virtual void vfunc_20(); + /* 24 */ virtual void vfunc_24(); + /* 28 */ virtual void vfunc_28(); + /* 2C */ virtual void vfunc_2C(); + /* 30 */ virtual ~UnkStruct_027e0ce8_00(); + /* 38 */ virtual void vfunc_38() = 0; + /* 3C */ virtual void vfunc_3C() = 0; + + void func_ov000_0209d6ac(Vec3p *param1); + void func_ov034_02121d84(); +}; + class UnkStruct_027e0ce8 { public: - /* 00 */ void *mUnk_00; // pointer to polygon list? - /* 04 */ void *mUnk_04; // pointer to the end of that list + /* 00 */ UnkStruct_027e0ce8_00 *mUnk_00; // pointer to polygon list? + /* 04 */ UnkStruct_027e0ce8_00 *mUnk_04; // pointer to the end of that list /* 08 */ UnkStruct_func_01fff520_ret **mUnk_08; UnkStruct_func_01fff520_ret **func_01fff520(UnkStruct_ov000_020b34c4 *param1, void *); - unk32 func_01fff498(UnkStruct_ov000_0208f820_04 param1); + UnkStruct_027e0ce8_00 *func_01fff498(unk32 param1, unk32 param2); }; extern UnkStruct_027e0ce8 *data_027e0ce8; diff --git a/include/Unknown/UnkStruct_ov000_0208f820.hpp b/include/Unknown/UnkStruct_ov000_0208f820.hpp index cf391909..5b5978d4 100644 --- a/include/Unknown/UnkStruct_ov000_0208f820.hpp +++ b/include/Unknown/UnkStruct_ov000_0208f820.hpp @@ -25,6 +25,8 @@ public: class UnkStruct_PlayerGet_64 { public: + /* 00 */ unk32 mUnk_00; + UnkStruct_PlayerGet_64(unk32 *param1, unk32 param2); ~UnkStruct_PlayerGet_64(); @@ -37,15 +39,27 @@ public: /* 38 */ UnkStruct_PlayerGet_64 mUnk_38; /* 3c */ unk32 mUnk_3c; /* 40 */ u16 mUnk_40; + + void func_ov093_0216f76c(Vec3p *param1, unk32 param2); }; class UnkStruct_ov000_0208f820_28 { public: - /* 00 */ unk8 mUnk_00[0x54]; + /* 00 */ STRUCT_PAD(0x00, 0x38); + /* 38 */ UnkStruct_PlayerGet_64 mUnk_38; + /* 3C */ unk32 mUnk_3C; + /* 40 */ u16 mUnk_40; + /* 42 */ STRUCT_PAD(0x42, 0x48); + /* 48 */ unk32 mUnk_48; + /* 48 */ unk32 mUnk_4C; + /* 48 */ unk32 mUnk_50; /* 54 */ ItemManager *pItemManager; - /* 58 */ unk8 mUnk_58[0x98 - 0x58]; + /* 58 */ STRUCT_PAD(0x58, 0x94); + /* 94 */ unk32 mUnk_94; /* 98 */ UnkStruct_ov000_0208f820_28_98 *mUnk_98; + void func_ov000_0208cf20(unk32 param1, unk32 param2); + void func_ov000_0208d12c(); void func_ov058_02152a24(); }; @@ -56,8 +70,18 @@ public: /* 08 */ unk32 mUnk_08; /* 0c */ unk32 mUnk_0c; /* 10 */ unk32 mUnk_10; - /* 14 */ unk8 mUnk_14[0x58 - 0x14]; + /* 14 */ unk16 mUnk_14; + /* 16 */ unk16 mUnk_16; + /* 18 */ STRUCT_PAD(0x18, 0x26); + /* 26 */ unk16 mUnk_26; + /* 28 */ STRUCT_PAD(0x28, 0x58); /* 58 */ unk16 mUnk_58; + /* 5A */ STRUCT_PAD(0x5A, 0x9C); + /* 9C */ unk32 mUnk_9C; + /* A0 */ STRUCT_PAD(0xA0, 0x148); + /* 148 */ u32 mUnk_148; + /* 14C */ unk32 mUnk_14C; + /* 150 */ unk32 mUnk_150; }; class UnkStruct_ov000_0208f820_30_10 { @@ -77,7 +101,9 @@ public: /* 1c */ unk32 mUnk_1c; /* 20 */ unk32 mUnk_20; /* 24 */ unk32 mUnk_24; - /* 28 */ unk8 mUnk_28[0x70 - 0x28]; + /* 28 */ STRUCT_PAD(0x28, 0x68); + /* 68 */ unk32 mUnk_68; + /* 6C */ unk32 mUnk_6C; /* 70 */ u32 mUnk_70; void func_ov000_020921e4(unk32 param1); @@ -85,23 +111,10 @@ public: void func_ov000_02093a04(); }; -class UnkStruct_ov000_0208f820_38 { -public: - /* 00 */ unk32 mUnk_00; - /* 04 */ unk32 mUnk_04; - /* 08 */ unk32 mUnk_08; -}; - -class UnkStruct_ov000_0208f820_3c { -public: - /* 00 */ unk32 mUnk_00; - /* 04 */ unk32 mUnk_04; - /* 08 */ unk32 mUnk_08; -}; - class UnkStruct_ov000_0208f820_40 { public: - /* 00 */ unk16 mUnk_00; + /* 00 */ u16 mUnk_00; + /* 00 */ s16 mUnk_02; }; class UnkStruct_PlayerGet_vfunc_0c_param1 { @@ -110,9 +123,7 @@ public: /* 04 */ unk32 mUnk_04; /* 08 */ unk32 mUnk_08; /* 0c */ unk32 mUnk_0c; - /* 10 */ unk32 mUnk_10; - /* 14 */ unk32 mUnk_14; - /* 18 */ unk32 mUnk_18; + /* 10 */ Vec3p mUnk_10; /* 1c */ ItemId mUnk_1c; }; @@ -121,6 +132,17 @@ public: /* 00 */ unk8 mUnk_00[0x24]; /* 24 */ unk8 mUnk_24; /* 25 */ unk8 mUnk_25; + /* 26 */ STRUCT_PAD(0x26, 0x78); + /* 78 */ void **mUnk_78; + /* 7C */ STRUCT_PAD(0x7C, 0x94); + /* 94 */ unk32 mUnk_94; + /* 98 */ unk32 mUnk_98; + /* 9C */ unk32 mUnk_9C; + /* A0 */ STRUCT_PAD(0xA0, 0xFE); + /* FE */ unk8 mUnk_FE; + /* FF */ unk8 mUnk_FF; + /* 100 */ unk32 mUnk_100; + /* 104 */ u16 mUnk_104; }; class UnkStruct_ov000_0208f820_04 { @@ -141,7 +163,7 @@ public: UnkStruct_ov000_0208f820_04() {} }; -class UnkStruct_ov000_0208f820 : public SysObject { +class UnkStruct_ov000_0208f820 { public: /* 00 (vtable) */ /* 04 */ UnkStruct_ov000_0208f820_04 mUnk_04; @@ -157,20 +179,23 @@ public: /* 2c */ UnkStruct_ov000_0208f820_2c *mUnk_2c; /* 30 */ UnkStruct_ov000_0208f820_30 *mUnk_30; /* 34 */ Vec3p *mUnk_34; - /* 38 */ UnkStruct_ov000_0208f820_38 *mUnk_38; - /* 3c */ UnkStruct_ov000_0208f820_3c *mUnk_3c; + /* 38 */ Vec3p *mUnk_38; + /* 3c */ Vec3p *mUnk_3C; /* 40 */ UnkStruct_ov000_0208f820_40 *mUnk_40; /* 44 */ unk32 *mUnk_44; /* 48 */ /* 00 */ virtual void vfunc_00(); /* 04 */ virtual ~UnkStruct_ov000_0208f820(); - /* 0c */ virtual void vfunc_0c(UnkStruct_PlayerGet_vfunc_0c_param1 *param1); - /* 10 */ virtual void vfunc_10(unk32 param1); + /* 0c */ virtual void vfunc_0c(UnkStruct_PlayerGet_vfunc_0c_param1 *param1) = 0; + /* 10 */ virtual void vfunc_10(unk32 param1, unk32 param2) = 0; /* 14 */ virtual void vfunc_14(); /* 18 */ virtual void vfunc_18(unk32 param1, unk32 param2, unk32 param3); - /* 1c */ virtual void vfunc_1c(); + /* 1c */ virtual bool vfunc_1c(Vec3p *param1); /* 20 */ UnkStruct_ov000_0208f820(); + + bool func_ov000_020914b0(unk32 param1, Vec3p *param2, unk32 param3); + bool func_ov000_02091e68(unk32 param1); }; diff --git a/include/nitro/math.h b/include/nitro/math.h index 28254f53..a3b1caf0 100644 --- a/include/nitro/math.h +++ b/include/nitro/math.h @@ -29,15 +29,26 @@ typedef s16 q4; #define SIN(n) (gSinCosTable[2 * ((n) >> 4)]) #define COS(n) (gSinCosTable[2 * ((n) >> 4) + 1]) +#define SIN2(table, n) ((table)[2 * ((n) >> 4)]) +#define COS2(table, n) ((table)[2 * ((n) >> 4) + 1]) + #ifdef __cplusplus } #endif #ifdef __cplusplus -struct Vec2b { - /* 0 */ u8 x; - /* 1 */ u8 y; - /* 2 */ +union Vec2b { + struct { + /* 0 */ u8 x; + /* 1 */ u8 y; + /* 2 */ + }; + u8 coords[2]; + + void operator=(const Vec2b &from) { + this->x = from.x; + this->y = from.y; + } Vec2b() {} Vec2b(u8 X, u8 Y) { @@ -51,6 +62,11 @@ struct Vec2s { /* 2 */ s16 y; /* 4 */ + void operator=(const Vec2s &from) { + this->x = from.x; + this->y = from.y; + } + Vec2s() {} Vec2s(s16 X, s16 Y) { x = X; @@ -63,6 +79,11 @@ struct Vec2us { /* 2 */ u16 y; /* 4 */ + void operator=(const Vec2us &from) { + this->x = from.x; + this->y = from.y; + } + Vec2us() {} Vec2us(u16 X, u16 Y) { x = X; @@ -70,10 +91,18 @@ struct Vec2us { } }; -struct Vec2p { - /* 0 */ q20 x; - /* 4 */ q20 y; - /* 8 */ +union Vec2p { + struct { + /* 0 */ q20 x; + /* 4 */ q20 y; + /* 8 */ + }; + q20 coords[2]; + + void operator=(const Vec2p &from) { + this->x = from.x; + this->y = from.y; + } Vec2p() {} Vec2p(q20 X, q20 Y) { @@ -82,11 +111,19 @@ struct Vec2p { } }; -struct Vec3p { - /* 0 */ q20 x; - /* 4 */ q20 y; - /* 8 */ q20 z; - /* c */ +union Vec3p { + struct { + q20 x; + q20 y; + q20 z; + }; + q20 coords[3]; + + void operator=(const Vec3p &from) { + this->x = from.x; + this->y = from.y; + this->z = from.z; + } Vec3p() {} Vec3p(q20 X, q20 Y, q20 Z) { @@ -96,12 +133,22 @@ struct Vec3p { } }; -struct Vec4p { - /* 00 */ q20 x; - /* 04 */ q20 y; - /* 08 */ q20 z; - /* 0c */ q20 w; - /* 10 */ +union Vec4p { + struct { + /* 00 */ q20 x; + /* 04 */ q20 y; + /* 08 */ q20 z; + /* 0c */ q20 w; + /* 10 */ + }; + q20 coords[4]; + + void operator=(const Vec4p &from) { + this->x = from.x; + this->y = from.y; + this->z = from.z; + this->w = from.w; + } Vec4p() {} Vec4p(q20 X, q20 Y, q20 Z, q20 W) { diff --git a/src/000_Second/Actor/Actor.cpp b/src/000_Second/Actor/Actor.cpp index 7e31897f..04d80153 100644 --- a/src/000_Second/Actor/Actor.cpp +++ b/src/000_Second/Actor/Actor.cpp @@ -22,8 +22,9 @@ ARM Actor::Actor() { this->mRef.Reset(); this->mType = NULL; Copy256(&data_ov000_020b539c.mUnk_00, &this->mUnk_5c, sizeof(data_ov000_020b539c.mUnk_00)); - this->mPrevPos = this->mPos = this->mUnk_5c.mUnk_00; - this->mAngle = this->mUnk_5c.mUnk_0c; + this->mPos = this->mUnk_5c.mUnk_00; + this->mPrevPos = this->mUnk_5c.mUnk_00; + this->mAngle = this->mUnk_5c.mUnk_0c; SET_FLAGS(this->mFlags, ActorFlag_Alive, ActorFlag_Visible, ActorFlag_Active, ActorFlag_14); this->mUnk_44 = 0xFF; this->mUnk_46 = 0; @@ -146,7 +147,10 @@ ARM bool Actor::vfunc_3c(unk32 param2, Vec3p *param3) { return false; } - this->mVel = *param3; + this->mVel.x = param3->x; + this->mVel.y = param3->y; + this->mVel.z = param3->z; + UNSET_FLAG(this->mFlags, ActorFlag_Grabbed); return true; } diff --git a/src/019_MainSelect/FileSelectMain.cpp b/src/019_MainSelect/FileSelectMain.cpp index 51d28ff9..14de7f5c 100644 --- a/src/019_MainSelect/FileSelectMain.cpp +++ b/src/019_MainSelect/FileSelectMain.cpp @@ -31,7 +31,7 @@ public: UnkStruct_ov019_020d24c0 data_ov019_020d24c0(-0x100, 0, 0x100, 0); UnkStruct_ov019_020d1e4c UnkStruct_ov019_020d1e70::data_ov019_020d1e4c = { - 0x14, 0x14, 0x14, 0x04, 0x03, -0x47, 0x00, 0x0281, -0x47, Vec2s(0x00, 0x00), 0x0281, + 0x14, 0x14, 0x14, 0x04, 0x03, -0x47, 0x00, 0x0281, -0x47, {0x00, 0x00}, 0x0281, }; UnkStruct_ov019_020d1e94 UnkStruct_ov019_020d1e70::data_ov019_020d1e94 = { diff --git a/src/019_MainSelect/FileSelectOptions.cpp b/src/019_MainSelect/FileSelectOptions.cpp index c1c39bb9..c167d109 100644 --- a/src/019_MainSelect/FileSelectOptions.cpp +++ b/src/019_MainSelect/FileSelectOptions.cpp @@ -17,9 +17,9 @@ void func_ov000_020623d8(void *param1, unk32 param2); class UnkStruct_ov019_020d215c { public: - /* 00 */ Vec2s mUnk_00; - /* 04 */ Vec2s mUnk_04; - /* 08 */ Vec2s mUnk_08; + /* 00 */ VEC2S mUnk_00; + /* 04 */ VEC2S mUnk_04; + /* 08 */ VEC2S mUnk_08; /* 0C */ VEC2S mUnk_0C; /* 10 */ VEC2S mUnk_10; /* 14 */ @@ -68,7 +68,7 @@ public: }; UnkStruct_ov019_020d215c UnkStruct_ov019_020d2170::data_ov019_020d215c = { - Vec2s(), Vec2s(), Vec2s(), {-0x47, -0x01}, {0x0281, 0x00}, + {0, 0}, {0, 0}, {0, 0}, {-0x47, -0x01}, {0x0281, 0x00}, }; static const UnkStruct_ov019_020d2170 data_ov019_020d2170; diff --git a/src/019_MainSelect/FileSelectSubScreen.cpp b/src/019_MainSelect/FileSelectSubScreen.cpp index ed1bb2a1..f81a67bc 100644 --- a/src/019_MainSelect/FileSelectSubScreen.cpp +++ b/src/019_MainSelect/FileSelectSubScreen.cpp @@ -172,7 +172,10 @@ ARM FileSelect_UnkClass7::FileSelect_UnkClass7() { u16 value = gRandom.ConditionalNext32(this->mUnk_004.mUnk_000[i].func_ov000_02060c28()); this->mUnk_004.mUnk_000[i].func_ov000_02060bd8(value); - Vec2us pos = pRandom->NextPos(SUBSCREEN_WIDTH, SUBSCREEN_HEIGHT); + Vec2us pos; + pos.x = pRandom->Next32(0, SUBSCREEN_WIDTH); + pos.y = pRandom->Next32(0, SUBSCREEN_HEIGHT); + Vec2us *pVec = &this->mUnk_004.mUnk_E10[i]; *pVec = pos; } @@ -185,7 +188,10 @@ ARM void FileSelect_UnkClass7::vfunc_00() { if (this->mUnk_004.mUnk_000[i].func_ov000_02060af8() != 0) { this->mUnk_004.mUnk_000[i].func_ov000_02060b64(); - Vec2us pos = gRandom.NextPos(SUBSCREEN_WIDTH, SUBSCREEN_HEIGHT); + Vec2us pos; + pos.x = gRandom.Next32(0, SUBSCREEN_WIDTH); + pos.y = gRandom.Next32(0, SUBSCREEN_HEIGHT); + Vec2us *pVec = &this->mUnk_004.mUnk_E10[i]; *pVec = pos; } diff --git a/src/031_Land/Actor/ActorRupee.cpp b/src/031_Land/Actor/ActorRupee.cpp index d61203fc..4ed539c1 100644 --- a/src/031_Land/Actor/ActorRupee.cpp +++ b/src/031_Land/Actor/ActorRupee.cpp @@ -52,10 +52,12 @@ ARM void ActorRupee::func_ov031_020e8d2c(Vec3p *param1, u8 param2, unk32 param3, stack_struct stack; stack.sp2C = 0; stack.func_ov000_020975f8(); - stack.sp14 = param2 & 0xFF; - stack.sp4 = *param1; - stack.sp2C = param4; - stack.sp30 = param3; + stack.sp14 = param2 & 0xFF; + stack.sp4.x = param1->x; + stack.sp4.y = param1->y; + stack.sp4.z = param1->z; + stack.sp2C = param4; + stack.sp30 = param3; this->func_ov000_020973f4(&data_ov000_020b539c, ActorId_Rupee, (Actor_5c *) &stack, 0); } @@ -418,7 +420,9 @@ ARM void ActorRupee::func_ov031_020e95c0() { return; } - this->mPos = temp_r0->mPos; + this->mPos.x = temp_r0->mPos.x; + this->mPos.y = temp_r0->mPos.y; + this->mPos.z = temp_r0->mPos.z; } ARM void ActorRupee::func_ov031_020e9610() { diff --git a/src/110_PlayerGet/PlayerGet.cpp b/src/110_PlayerGet/PlayerGet.cpp index 0c73e204..6b36cfab 100644 --- a/src/110_PlayerGet/PlayerGet.cpp +++ b/src/110_PlayerGet/PlayerGet.cpp @@ -287,8 +287,8 @@ ARM void PlayerGet::vfunc_0c(UnkStruct_PlayerGet_vfunc_0c_param1 *param1) { ItemManager *pItemManager; ItemId itemId; ActorUnk_ov000_020a8bb0 *iVar10; - UnkStruct_ov000_0208f820_38 *pUnk_38; - UnkStruct_ov000_0208f820_3c *pUnk_3c; + Vec3p *pUnk_38; + Vec3p *pUnk_3c; char auStack_108[12]; Vec3p VStack_fc; unk32 uStack_f0[4]; @@ -296,9 +296,9 @@ ARM void PlayerGet::vfunc_0c(UnkStruct_PlayerGet_vfunc_0c_param1 *param1) { switch (param1->mUnk_04) { case 0x39: - *(u32 *) this->mUnk_54.mUnk_00 = param1->mUnk_10; - *(u32 *) this->mUnk_54.mUnk_04 = param1->mUnk_14; - this->mUnk_54.mUnk_08 = param1->mUnk_18; + *(u32 *) this->mUnk_54.mUnk_00 = param1->mUnk_10.x; + *(u32 *) this->mUnk_54.mUnk_04 = param1->mUnk_10.y; + this->mUnk_54.mUnk_08 = param1->mUnk_10.z; pItemManager = this->mUnk_28->pItemManager; itemId = param1->mUnk_1c; @@ -336,14 +336,14 @@ ARM void PlayerGet::vfunc_0c(UnkStruct_PlayerGet_vfunc_0c_param1 *param1) { func_ov000_0208ba10(auStack_108, &this->mUnk_24->mUnk_25, 0); this->mUnk_40->mUnk_00 = 0x8000; - pUnk_38 = this->mUnk_38; - pUnk_38->mUnk_00 = 0; - pUnk_38->mUnk_08 = 0; + pUnk_38 = this->mUnk_38; + pUnk_38->x = 0; + pUnk_38->z = 0; - pUnk_3c = this->mUnk_3c; - pUnk_3c->mUnk_00 = 0; - pUnk_3c->mUnk_04 = 0; - pUnk_3c->mUnk_08 = 0; + pUnk_3c = this->mUnk_3C; + pUnk_3c->x = 0; + pUnk_3c->y = 0; + pUnk_3c->z = 0; if (((*(u16 *) this->mUnk_54.mUnk_00 << 0x10) >> 0x1E) != 1) { return; @@ -497,7 +497,7 @@ ARM void PlayerGet::vfunc_0c(UnkStruct_PlayerGet_vfunc_0c_param1 *param1) { const UnkStruct_ov110_021861ec data_ov110_021861ec = UnkStruct_ov110_021861ec(0x5E3, 0x152D, 0xCD); -ARM void PlayerGet::vfunc_10(unk32 param1) { +ARM void PlayerGet::vfunc_10(unk32 param1, unk32 param2) { unk32 var_r1; UnkStruct_func_01fff520_ret **temp_r0_6; s32 temp_r5; @@ -669,13 +669,7 @@ ARM void PlayerGet::vfunc_10(unk32 param1) { } if (*(u16 *) this->mUnk_54.mUnk_00 == 0x1000) { - UnkStruct_ov000_0208f820_04 structure; - structure.mUnk_00[0] = this->mUnk_54.mUnk_00[0]; - structure.mUnk_00[1] = this->mUnk_54.mUnk_00[1]; - // structure.mUnk_08 = this->mUnk_54.mUnk_08; - // structure.mItemId = this->mUnk_54.mItemId; - - if (data_027e0ce8->func_01fff498(structure) != 0) { + if (data_027e0ce8->func_01fff498(this->mUnk_54.mUnk_00[0], this->mUnk_54.mUnk_00[1]) != 0) { var_r5_2 = '\0'; switch (func_01fff584()) { diff --git a/src/112_PlayerSceneChange/PlayerSceneChange.cpp b/src/112_PlayerSceneChange/PlayerSceneChange.cpp new file mode 100644 index 00000000..8b6242d8 --- /dev/null +++ b/src/112_PlayerSceneChange/PlayerSceneChange.cpp @@ -0,0 +1,751 @@ +#include "Player/PlayerSceneChange.hpp" +#include "Actor/ActorManager.hpp" +#include "Actor/ActorUnk_ov000_020a8bb0.hpp" +#include "Unknown/UnkStruct_027e09b8.hpp" +#include "Unknown/UnkStruct_027e0cd8.hpp" +#include "Unknown/UnkStruct_027e0cdc.hpp" +#include "Unknown/UnkStruct_027e0ce8.hpp" + +#include + +extern "C" void func_ov000_0205ca74(unk32); +extern "C" void func_ov000_0205d65c(void *, Vec3p *, Vec3p *, u32); + +ARM PlayerSceneChange::PlayerSceneChange() { + this->mUnk_68 = this->mUnk_2c->mUnk_14C; + this->mUnk_6C = -1; + + this->mUnk_70.coords = this->mUnk_34->coords; + this->mUnk_7C = 0; + + this->mUnk_80.coords = this->mUnk_34->coords; + this->mUnk_8C = 0; + + this->mUnk_90 = 0; + *((u32 *) this->mUnk_94) = 0; + this->mUnk_98 = -1; + this->mUnk_9C.x = 0; + this->mUnk_9C.y = 0; + this->mUnk_9C.z = 0; + this->mUnk_A8 = 0x8000; + this->mUnk_AA = 0x8000; + this->mUnk_AC = false; + this->mUnk_AD = false; + this->mUnk_AE = 0x8000; +} + +ARM PlayerSceneChange::~PlayerSceneChange() { + UnkStruct_ov000_0208f820_28 *pUnk_28 = this->mUnk_28; + pUnk_28->mUnk_40 &= 0xFFFD; + + if (pUnk_28->mUnk_40 == 0) { + pUnk_28->mUnk_38.~UnkStruct_PlayerGet_64(); + } + + func_ov000_0205ca74(this->mUnk_98); +} + +ARM s16 PlayerSceneChange::func_ov112_02184bbc(s16 param1) { + // fake match? + if ((u32) (*(u16 *) &this->mUnk_90 << 0x10) >> 0x1E == 1) { + ActorUnk_ov000_020a8bb0 *iVar1 = gActorManager->func_01fff3b4(this->mUnk_90); + + if (iVar1 != 0) { + return iVar1->mAngle; + } + } else if (this->mUnk_94[0] == 0x1000) { + return this->mUnk_AE; + } + + return param1; +} + +extern "C" bool func_ov096_02179c14(); +extern "C" void func_ov034_02121de4(void *); +extern "C" unk32 func_01fff584(); +extern q4 data_02040964[]; +extern q4 data_0203e964[]; +extern q4 data_02041964[]; +extern q4 data_0203f964[]; +extern q4 data_0203feb0[]; +extern "C" void func_01ffb714(Vec3p *, Vec3p *, void *); +extern "C" void func_01ff9638(void *, unk32); +extern "C" q20 func_01ffb800(void *); +extern "C" void func_01ff9770(void *); +extern "C" void func_ov000_02072fd0(void *); +extern unk32 data_ov000_020b3000; +extern "C" bool func_ov000_02080998(Vec3p *); +extern "C" void func_01ff930c(UnkStruct_ov000_0208f820_40 *, unk16, unk32); + +// https://decomp.me/scratch/c7PhN +ARM void PlayerSceneChange::vfunc_0c(UnkStruct_PlayerGet_vfunc_0c_param1 *param1) { + q4 *pSinCosTable = gSinCosTable; + + switch (param1->mUnk_04) { + case 0x3C: { + int iVar19 = data_027e0cd8->mUnk_0c->func_ov000_02080658((this->mUnk_2c->mUnk_148 >> 16) & 0x3F, &this->mUnk_54); + if (iVar19 != 0 && this->mUnk_28->mUnk_94 != 0 && func_ov096_02179c14()) { + this->mUnk_54.mUnk_10 = 1; + } + + switch (this->mUnk_68) { + case 0x08: + case 0x09: + case 0x22: + case 0x23: + this->mUnk_6C = 0x0F; + break; + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x21: + case 0x24: + case 0x25: + this->mUnk_6C = 0x0A; + break; + case 0x1C: + this->mUnk_6C = 0x05; + break; + case 0x19: + this->mUnk_6C = 0x00; + break; + default: + this->mUnk_6C = 0x0D; + break; + } + + Vec3p *temp_r8 = this->mUnk_34; + this->mUnk_70.x = temp_r8->x; + this->mUnk_70.y = temp_r8->y; + this->mUnk_70.z = temp_r8->z; + + this->mUnk_A8 = -0x8000; + this->mUnk_AA = -0x8000; + this->mUnk_AC = false; + + switch (this->mUnk_68) { + case 0x08: + this->mUnk_70.x = temp_r8->x + MUL_Q20(data_02040964[0], FLOAT_TO_Q20(2.0f)); + this->mUnk_70.z = temp_r8->z + MUL_Q20(data_02040964[1], FLOAT_TO_Q20(2.0f)); + break; + case 0x09: + this->mUnk_70.x = temp_r8->x + MUL_Q20(data_0203e964[0], FLOAT_TO_Q20(2.0f)); + this->mUnk_70.z = temp_r8->z + MUL_Q20(data_0203e964[1], FLOAT_TO_Q20(2.0f)); + break; + case 0x22: + this->mUnk_70.x = temp_r8->x + MUL_Q20(data_02041964[0], FLOAT_TO_Q20(2.0f)); + this->mUnk_70.z = temp_r8->z + MUL_Q20(data_02041964[1], FLOAT_TO_Q20(2.0f)); + break; + case 0x23: + this->mUnk_70.x = temp_r8->x + MUL_Q20(data_0203f964[0], FLOAT_TO_Q20(2.0f)); + this->mUnk_70.z = temp_r8->z + MUL_Q20(data_0203f964[1], FLOAT_TO_Q20(2.0f)); + break; + default: + if (this->mUnk_2c->mUnk_150 == 0x1000) { + UnkStruct_027e0ce8_00 *temp_r0_4 = data_027e0ce8->func_01fff498(this->mUnk_2c->mUnk_150 >> 0x10, 0); + + if (temp_r0_4 != NULL) { + temp_r0_4->func_ov000_0209d6ac((Vec3p *) &this->mUnk_70); + + if (this->mUnk_68 == 0x19) { + temp_r0_4->func_ov034_02121d84(); + this->mUnk_8C = temp_r0_4->mUnk_38; + } else if (func_01fff584() == 'DRTY') { + *(u32 *) this->mUnk_94 = temp_r0_4->mUnk_38; + + switch (temp_r0_4->mUnk_CC) { + case 1: + this->mUnk_AE = FLOAT_TO_Q20(-5.778f); + break; + case 2: + this->mUnk_AE = FLOAT_TO_Q20(5.7778f); + break; + default: + this->mUnk_AE = FLOAT_TO_Q20(-8.0002f); + break; + } + } + } + } else { + if (((u32) ((u16) this->mUnk_2c->mUnk_150 << 0x10) >> 0x1E) == 1) { + ActorUnk_ov000_020a8bb0 *temp_r0_6 = gActorManager->func_01fff3b4(this->mUnk_2c->mUnk_150); + + if (temp_r0_6 != NULL) { + this->mUnk_70.x = temp_r0_6->mPos.x; + this->mUnk_70.y = temp_r0_6->mPos.y; + this->mUnk_70.z = temp_r0_6->mPos.z; + + if (temp_r0_6->func_01fff458() == 'GTTG') { + this->mUnk_90 = temp_r0_6->mRef.index; + this->mUnk_AA = temp_r0_6->mAngle; + this->mUnk_A8 = temp_r0_6->mAngle; + } + } + } + } + break; + } + + s16 stack; + func_ov000_0205d65c(&stack, this->mUnk_34, (Vec3p *) &this->mUnk_70, this->mUnk_40->mUnk_00); + this->mUnk_40->mUnk_00 = stack; + + switch (this->mUnk_68) { + case 0x11: + case 0x12: + case 0x13: + case 0x14: { + s32 var_r1_2 = this->mUnk_A8 - this->mUnk_40->mUnk_00; + + if (var_r1_2 < 0) { + var_r1_2 = -var_r1_2; + } + + if (var_r1_2 >= 0x1555) { + this->mUnk_AC = true; + } + + unk32 sp78; + unk16 temp_r8_2 = this->mUnk_A8 - 0x8000; + func_01ffb714(this->mUnk_34, (Vec3p *) &this->mUnk_70, &sp78); + func_01ff9638(&sp78, -temp_r8_2); + this->mUnk_9C.x = -sp78; + this->mUnk_9C.y = 0; + this->mUnk_9C.z = 0; + func_01ff9638(&this->mUnk_9C, temp_r8_2); + + q20 temp_r0_11 = func_01ffb800(&this->mUnk_9C); + if (temp_r0_11 > 0x800) { + if ((((temp_r0_11 - 0x800) / 10) + ((temp_r0_11 - 0x800) >> 0x1F)) <= 0) { + this->mUnk_9C.x = 0; + this->mUnk_9C.y = 0; + this->mUnk_9C.z = 0; + } else { + func_01ff9770(&this->mUnk_9C); + Vec3p_Add(this->mUnk_3C, &this->mUnk_9C, this->mUnk_3C); + } + } else { + this->mUnk_9C.x = 0; + this->mUnk_9C.y = 0; + this->mUnk_9C.z = 0; + } + } break; + default: + break; + } + + switch (this->mUnk_68) { + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x1C: + case 0x21: + case 0x25: + case 0x33: + this->mUnk_7C = FLOAT_TO_Q20(1 / 2); + break; + case 0x19: + this->mUnk_7C = FLOAT_TO_Q20(0.3f); + break; + default: + this->mUnk_7C = FLOAT_TO_Q20(0.8f); + break; + } + + if (this->mUnk_28->mUnk_98 != NULL) { + this->mUnk_28->mUnk_98->func_ov093_0216f76c((Vec3p *) &this->mUnk_70, this->mUnk_68); + } + + break; + } + case 0x3D: { + Vec3p *pVec = this->mUnk_38; + pVec->x = 0; + pVec->y = 0; + pVec->z = 0; + break; + } + case 0x3E: { + if (this->mUnk_44 != NULL) { + this->mUnk_28->func_ov000_0208d12c(); + } + + this->mUnk_6C = 0x5F; + + if (this->mUnk_8C != 0x1000) { + return; + } + + UnkStruct_027e0ce8_00 *target = data_027e0ce8->func_01fff498(this->mUnk_8C >> 16, 0); + if (target != NULL && func_01fff584() == 'WPHL') { + func_ov034_02121de4(target); + } + + break; + } + case 0x3F: + if (param1->mUnk_00 != 0x3c) { + this->mUnk_68 = data_027e09a4->func_ov000_02070554(); + } + + SceneIndex eScene = data_027e09a4->mSceneIndex; + if (eScene == SceneIndex_tekiya07) { + this->mUnk_68 = 0x18; + } else { + switch (*data_027e09a4->func_ov000_02070538()) { + case SceneIndex_d_water27: + if (eScene == SceneIndex_b_water) { + this->mUnk_68 = 0x18; + } + break; + case SceneIndex_b_water: + if (eScene == SceneIndex_d_water27) { + this->mUnk_68 = 0x10; + } + break; + default: + break; + } + } + + if ((this->mUnk_24->mUnk_104 & 0x10) || this->mUnk_28->pItemManager->mTearsAmount == 3) { + struct { + unk32 actorId; + void *ptr; + } local_9c; + local_9c.ptr = &data_ov000_020b3000; + local_9c.actorId = ActorId_RPMT; + Actor **ppAVar12 = gActorManager->func_01fff350(&local_9c, gActorManager->mActorTable); + + if (ppAVar12 == gActorManager->mUnk_08) { + struct { + unk8 mUnk_04; + unk8 pad[4]; + unk32 mUnk_00; + unk8 pad2[38]; + unk8 mUnk_05; + unk8 mUnk_06; + } stack; + func_ov000_02072fd0(&stack); + stack.mUnk_00 = -1; + stack.mUnk_04 = 0x6C; + stack.mUnk_05 = 0; + stack.mUnk_06 = 0; + this->mUnk_98 = data_027e09b8->func_ov000_02073388(&stack); + } + } + + this->mUnk_6C = -1; + + Vec3p *pVec = this->mUnk_34; + this->mUnk_70.x = pVec->x; + this->mUnk_70.y = pVec->y; + this->mUnk_70.z = pVec->z; + this->mUnk_80.x = pVec->x; + this->mUnk_80.y = pVec->y; + this->mUnk_80.z = pVec->z; + + switch (this->mUnk_68) { + case 0x15: + case 0x16: + case 0x1C: + pVec = this->mUnk_34; + pVec->x += MUL_Q20(FLOAT_TO_Q20(-1.1003f), SIN2(pSinCosTable, this->mUnk_40->mUnk_00)); + pVec->z += MUL_Q20(FLOAT_TO_Q20(-1.1003f), COS2(pSinCosTable, this->mUnk_40->mUnk_00)); + break; + case 0x08: + case 0x09: + case 0x0A: + case 0x0B: + case 0x0C: + case 0x0D: + case 0x0E: + case 0x17: + case 0x18: + case 0x19: + case 0x1A: + case 0x1B: + case 0x1D: + case 0x1E: + case 0x1F: + case 0x20: + case 0x22: + case 0x23: + pVec = this->mUnk_34; + pVec->x += MUL_Q20(FLOAT_TO_Q20(-1.9001f), SIN2(pSinCosTable, this->mUnk_40->mUnk_00)); + pVec->z += MUL_Q20(FLOAT_TO_Q20(-1.9001f), COS2(pSinCosTable, this->mUnk_40->mUnk_00)); + break; + case 0x0F: + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x21: + case 0x24: + case 0x25: + pVec = this->mUnk_34; + pVec->x += MUL_Q20(FLOAT_TO_Q20(-1.0002f), SIN2(pSinCosTable, this->mUnk_40->mUnk_00)); + pVec->z += MUL_Q20(FLOAT_TO_Q20(-1.0002f), COS2(pSinCosTable, this->mUnk_40->mUnk_00)); + break; + default: + // pVec = this->mUnk_34; + // pVec->x += MUL_Q20(FLOAT_TO_Q20(-1.7001f), SIN2(pSinCosTable, this->mUnk_40->mUnk_00)); + // pVec->z += MUL_Q20(FLOAT_TO_Q20(-1.7001f), COS2(pSinCosTable, this->mUnk_40->mUnk_00)); + break; + } + + switch (this->mUnk_68) { + case 0x15: + case 0x16: + case 0x1C: + case 0x33: + case 0x3B: + if (func_ov000_02080998(this->mUnk_34)) { + break; + } + + case 0x1A: + case 0x1B: + case 0x1D: + case 0x1E: + case 0x1F: + default: + UnkStruct_027e0cd8_0c *ptr = data_027e0cd8->mUnk_0c; + + switch (this->mUnk_68) { + case 0x0F: + case 0x11: + case 0x13: + case 0x24: { + q20 posY = ptr->vfunc_28(this->mUnk_34, 0, 0); + if (this->mUnk_34->y >= posY) { + this->mUnk_34->y = posY; + } + break; + } + default: { + q20 posY = ptr->vfunc_28(this->mUnk_34, 0, 0); + if (this->mUnk_34->y <= posY) { + this->mUnk_34->y = posY; + } + break; + } + } + break; + } + + switch (this->mUnk_68) { + case 0x15: + case 0x16: + case 0x1C: + case 0x33: + case 0x3B: + this->mUnk_7C = FLOAT_TO_Q20(0.5f); + break; + default: + this->mUnk_7C = FLOAT_TO_Q20(0.8f); + break; + } + + break; + } +} + +// https://decomp.me/scratch/gX5Rb +ARM void PlayerSceneChange::vfunc_10(unk32 param1, unk32 param2) { + switch (param1) { + case 0x3C: + if (this->mUnk_68 == 0x19) { + if (this->func_ov000_020914b0(0x3C, (Vec3p *) &this->mUnk_70, this->mUnk_7C)) { + this->mUnk_30->func_ov000_020921e4(0x3D); + } + + Vec3p *temp_r1 = this->mUnk_34; + this->mUnk_80.x = temp_r1->x; + this->mUnk_80.y = temp_r1->y; + this->mUnk_80.z = temp_r1->z; + } else { + if (this->mUnk_6C > 0) { + this->mUnk_6C--; + } else if (this->mUnk_6C == 0 && data_027e09a4->func_ov000_02070a9c(&this->mUnk_54)) { + this->mUnk_6C = -1; + } + + switch (this->mUnk_68) { + case 0x11: + case 0x13: + this->mUnk_AA += 0x200; + break; + case 0x12: + case 0x14: + this->mUnk_AA -= 0x200; + default: + break; + } + + if (this->func_ov000_020914b0(0x3C, (Vec3p *) &this->mUnk_70, this->mUnk_7C)) { + s16 var_r1_2 = this->mUnk_40->mUnk_00; + bool var_r3 = true; + + switch (this->mUnk_68) { + case 0x08: + case 0x0F: + case 0x15: + case 0x17: + case 0x1B: + case 0x1F: + case 0x24: + case 0x33: + var_r1_2 = -0x8000; + break; + case 0x11: + case 0x12: + case 0x13: + case 0x14: + var_r3 = false; + + if (this->mUnk_AC) { + // var_r1_2 = this->mUnk_A8; + this->mUnk_AC = false; + this->mUnk_40->mUnk_00 = this->mUnk_A8; + } + + break; + case 0x09: + case 0x10: + case 0x16: + case 0x18: + case 0x1C: + case 0x20: + case 0x21: + case 0x25: + case 0x3B: + var_r1_2 = 0; + break; + case 0x22: + var_r1_2 = -0x4000; + break; + case 0x23: + var_r1_2 = 0x4000; + break; + default: + break; + } + + if (var_r3) { + var_r1_2 = this->func_ov112_02184bbc(0); + } + + // s16 iVar3 = var_r1_2 >> 4; + // q20 uVar6 = gSinCosTable[iVar3 * 2] * 0x2000; + // q20 uVar5 = gSinCosTable[iVar3 * 2 + 1] * 0x2000; + // q20 iVar2 = (gSinCosTable[iVar3 * 2 + 1] >> 0x13) + (0xfffff7ff < uVar5); + + // this->mUnk_70.x += + // (((uVar6 + 0x800) >> 0xc) | (gSinCosTable[iVar3 * 2] >> 0x13) + (0xfffff7ff < uVar6)) * 0x100000; + // this->mUnk_70.z += (((uVar5 + 0x800) >> 0xc) | iVar2 << 0x14); + + s32 idx = (((s32) var_r1_2) >> 4) << 1; + s32 sin16 = (s16) data_0203feb0[idx]; + s32 cos16 = (s16) data_0203feb0[idx + 1]; + + this->mUnk_70.x += (((sin16 << 13) + 0x800) >> 12); + this->mUnk_70.z += (((cos16 << 13) + 0x800) >> 12); + } + + switch (this->mUnk_68) { + case 0x21: + case 0x25: { + s16 value = this->func_ov112_02184bbc(0); + q4 sin = SIN2(data_0203feb0, value); + q4 cos = COS2(data_0203feb0, value); + + this->mUnk_70.x += MUL_Q20(sin, 0x19A); + this->mUnk_70.z += MUL_Q20(cos, 0x19A); + break; + } + + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + if (this->mUnk_AC && this->mUnk_30->mUnk_70 >= 8) { + this->mUnk_AC = false; + } + + if (!this->mUnk_AC) { + func_01ff930c(this->mUnk_40, this->mUnk_AA, 0x200); + + Vec3p *temp_r2_4 = this->mUnk_34; + this->mUnk_70.x = temp_r2_4->x; + this->mUnk_70.y = temp_r2_4->y; + this->mUnk_70.z = temp_r2_4->z; + + q4 sin = SIN2(data_0203feb0, this->mUnk_40->mUnk_00); + q4 cos = COS2(data_0203feb0, this->mUnk_40->mUnk_00); + this->mUnk_70.x += MUL_Q20(sin, 0x19A); + this->mUnk_70.z += MUL_Q20(cos, 0x19A); + } + break; + default: + break; + } + + switch (this->mUnk_68) { + case 0x11: + case 0x12: + case 0x13: + case 0x14: + if (this->mUnk_30->mUnk_70 < 0x0A) { + Vec3p_Add(this->mUnk_3C, &this->mUnk_9C, this->mUnk_3C); + } + break; + default: + break; + } + } + + switch (this->mUnk_68) { + case 0x08: + case 0x09: + case 0x10: + case 0x12: + case 0x14: + case 0x21: + case 0x25: + this->mUnk_2c->mUnk_9C = this->mUnk_34->y + 0xFFFFFCCD; + break; + default: + this->mUnk_2c->mUnk_9C = this->mUnk_34->y; + break; + } + break; + case 0x3D: { + func_01ff930c(this->mUnk_40, 0, 0xE39); + Vec3p *temp_r2_8 = this->mUnk_34; + + this->mUnk_80.x = temp_r2_8->x; + this->mUnk_80.y = temp_r2_8->y; + this->mUnk_80.z = temp_r2_8->z; + + if (this->mUnk_30->mUnk_70 < 0x14) { + return; + } + + this->mUnk_30->func_ov000_020921e4(0x3E); + break; + } + case 0x3E: + if (this->mUnk_6C > 0) { + this->mUnk_6C--; + + if (this->mUnk_6C < 0x37) { + this->mUnk_28->mUnk_40 |= 0x02; + break; + } + + func_01ff930c(this->mUnk_40, 0, 0xE39); + this->mUnk_38->y = 0x66; + } else if (this->mUnk_6C == 0 && data_027e09a4->func_ov000_02072154(&this->mUnk_54, this->mUnk_68)) { + this->mUnk_6C = -1; + } + + break; + case 0x3F: { + switch (this->mUnk_68) { + case 0x08: + case 0x09: + case 0x10: + case 0x12: + case 0x14: + case 0x21: + case 0x22: + case 0x23: + case 0x25: + break; + default: + this->mUnk_2c->mUnk_9C = this->mUnk_34->y; + break; + } + + bool temp_r5_2 = this->func_ov000_020914b0(0x3F, (Vec3p *) &this->mUnk_70, this->mUnk_7C); + + switch (this->mUnk_68) { + case 0x0F: + case 0x11: + case 0x13: + case 0x24: { + UnkStruct_027e0cd8_0c *temp_r0_13 = data_027e0cd8->mUnk_0c; + q20 temp_r0_14 = temp_r0_13->vfunc_28(this->mUnk_34, 0, 0); + Vec3p *temp_r2_9 = this->mUnk_34; + + if (temp_r2_9->y < temp_r0_14) { + temp_r2_9->y = temp_r0_14; + } + + break; + } + default: + break; + } + + if (this->mUnk_AD) { + UnkStruct_ov000_0208f820_24 *temp_r1_6 = this->mUnk_24; + temp_r1_6->mUnk_104 &= 0xFFFB; + temp_r1_6->mUnk_FE = 3; + this->mUnk_30->func_ov000_020921e4(1); + } else if (temp_r5_2) { + if (!this->func_ov000_02091e68(param2) && data_02049b18.mUnk_06.mTouchControl.mState.touch) { + func_ov000_0205ca74(this->mUnk_98); + this->mUnk_98 = -1; + q4 sin = SIN2(data_0203feb0, this->mUnk_40->mUnk_00); + q4 cos = COS2(data_0203feb0, this->mUnk_40->mUnk_00); + this->mUnk_70.x += MUL_Q20(sin, FLOAT_TO_Q20(2.0f)); + this->mUnk_70.z += MUL_Q20(cos, FLOAT_TO_Q20(2.0f)); + this->mUnk_AD = true; + return; + } else { + this->mUnk_30->func_ov000_020921e4(0); + } + } + + break; + } + default: + break; + } +} + +ARM bool PlayerSceneChange::vfunc_1c(Vec3p *param1) { + if (data_027e0cdc->func_ov000_02082a28(1) == 0) { + switch (this->mUnk_30->mUnk_68) { + case 0x3C: + case 0x3D: + case 0x3E: + case 0x3F: { + Vec3p unk_80; + + unk_80.x = this->mUnk_80.x; + unk_80.y = this->mUnk_80.y; + unk_80.z = this->mUnk_80.z; + + param1->x = unk_80.x; + param1->y = unk_80.y; + param1->z = unk_80.z; + return true; + } + default: + break; + } + } + + return this->UnkStruct_ov000_0208f820::vfunc_1c(param1); +} diff --git a/src/112_PlayerSceneChange/PlayerSceneChange2.cpp b/src/112_PlayerSceneChange/PlayerSceneChange2.cpp new file mode 100644 index 00000000..34270b3b --- /dev/null +++ b/src/112_PlayerSceneChange/PlayerSceneChange2.cpp @@ -0,0 +1,91 @@ +#include "Actor/ActorManager.hpp" +#include "Player/PlayerSceneChange.hpp" +#include "Unknown/UnkStruct_027e0cdc.hpp" + +extern "C" void func_ov000_0208ba10(void *, void *, unk32); +extern "C" void func_ov000_02087ee8(); +extern "C" void func_ov000_0205d65c(void *, Vec3p *, Vec3p *, u32); +extern "C" void func_ov000_0208cac8(UnkStruct_ov000_0208f820_28 *, Vec3p *, unk32); +extern "C" unk32 func_ov000_0208dc98(unk32); +extern "C" void func_ov000_020830a4(unk32, unk32, unk32, unk32, unk32, unk32); +extern "C" unk32 func_ov000_02093718(UnkStruct_ov000_0208f820_30 *); +extern "C" unk32 func_ov000_0209378c(UnkStruct_ov000_0208f820_30 *); +extern "C" void func_ov000_020830d4(unk32, u16, unk32, unk32, unk32); + +ARM PlayerSceneChange2::PlayerSceneChange2() { + this->mUnk_54 = *this->mUnk_34; + this->mUnk_60 = *this->mUnk_34; +} + +// non-matching +ARM void PlayerSceneChange2::vfunc_0c(UnkStruct_PlayerGet_vfunc_0c_param1 *param1) { + s16 auStack_18[12]; + s16 auStack_2c; + + Vec3p *pVVar1 = this->mUnk_38; + pVVar1->x = 0; + pVVar1->y = 0; + pVVar1->z = 0; + + this->mUnk_2c->mUnk_58 = 0; + + func_ov000_0208ba10(auStack_18, &this->mUnk_24->mUnk_94, 0); + + if (this->mUnk_44[0] != 0) { + this->mUnk_28->func_ov000_0208cf20(0x1400, 0); + } + + void **piVar3 = this->mUnk_24->mUnk_78; + + if ((piVar3 != NULL && *piVar3 != NULL) ? 1 : 0) { + func_ov000_02087ee8(); + } + + switch (param1->mUnk_04) { + case 0x40: + case 0x41: + this->mUnk_54.x = this->mUnk_34->x; + this->mUnk_54.y = this->mUnk_34->y; + this->mUnk_54.z = this->mUnk_34->z; + this->mUnk_60 = param1->mUnk_10; + + { + u16 test = this->mUnk_40->mUnk_00; + func_ov000_0205d65c(&auStack_2c, this->mUnk_34, &this->mUnk_60, test); + } + this->mUnk_40->mUnk_00 = auStack_2c; + break; + case 0x42: + case 0x43: + this->mUnk_54.x = this->mUnk_34->x; + this->mUnk_54.y = this->mUnk_34->y; + this->mUnk_54.z = this->mUnk_34->z; + this->mUnk_60 = param1->mUnk_10; + + func_ov000_0205d65c(&auStack_2c, &this->mUnk_60, (Vec3p *) &this->mUnk_54, this->mUnk_40->mUnk_00); + this->mUnk_40->mUnk_00 = auStack_2c; + + func_ov000_0208cac8(this->mUnk_28, &this->mUnk_60, 0); + func_ov000_020830a4(this->mUnk_48, 0, this->mUnk_28->mUnk_48, 1, 1, func_ov000_0208dc98(this->mUnk_28->mUnk_48)); + func_ov000_020830d4(this->mUnk_48, this->mUnk_40->mUnk_00, func_ov000_02093718(this->mUnk_30), + func_ov000_0209378c(this->mUnk_30), 0); + break; + case 0x44: + func_ov000_0208cac8(this->mUnk_28, &this->mUnk_60, 0); + + func_ov000_0205d65c(&auStack_2c, this->mUnk_34, (Vec3p *) &this->mUnk_54, this->mUnk_40->mUnk_00); + this->mUnk_40->mUnk_00 = auStack_2c; + + this->mUnk_2c->mUnk_26 = 0; + break; + case 0x45: + this->mUnk_2c->mUnk_26 = 0; + break; + default: + break; + } +} + +ARM void PlayerSceneChange2::vfunc_10(unk32 param1, unk32 param2) {} + +ARM PlayerSceneChange2::~PlayerSceneChange2() {} diff --git a/tools/configure.py b/tools/configure.py index ced2a772..edd3d4ee 100755 --- a/tools/configure.py +++ b/tools/configure.py @@ -204,6 +204,13 @@ config.libs = [ Object("110_PlayerGet/PlayerGet.cpp"), ] ), + GameLib( + "Overlay 112", + [ + Object("112_PlayerSceneChange/PlayerSceneChange.cpp"), + Object("112_PlayerSceneChange/PlayerSceneChange2.cpp"), + ] + ), LibC( "libc", [ diff --git a/tools/m2ctx.py b/tools/m2ctx.py index 3ae0c237..b5650f11 100755 --- a/tools/m2ctx.py +++ b/tools/m2ctx.py @@ -25,6 +25,7 @@ CXX_FLAGS = [ '-Ilibs/cpp/include', '-Ilibs/runtime/include', f'-DVERSION={args.version}', + '-D__MWERKS__', ] script_dir = Path(os.path.dirname(os.path.realpath(__file__)))