From 6b2f54d2c1f16f9ea8c392a4b18f16d17ca7635a Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Sun, 15 Sep 2024 09:56:19 -0500 Subject: [PATCH] Finish mentdll/main.c --- config/GMPE01_00/rels/mentDll/splits.txt | 3 +- config/GMPE01_00/rels/mentDll/symbols.txt | 3 +- configure.py | 2 +- include/game/window.h | 2 - src/REL/mentDll/common.c | 216 +++++++++++++++++----- src/REL/mentDll/main.c | 2 +- 6 files changed, 177 insertions(+), 51 deletions(-) diff --git a/config/GMPE01_00/rels/mentDll/splits.txt b/config/GMPE01_00/rels/mentDll/splits.txt index a1376ff8..77b37cde 100644 --- a/config/GMPE01_00/rels/mentDll/splits.txt +++ b/config/GMPE01_00/rels/mentDll/splits.txt @@ -10,9 +10,10 @@ REL/mentDll/common.c: .text start:0x00000000 end:0x0000658C .rodata start:0x00000000 end:0x000000E8 .data start:0x00000000 end:0x000000D8 + .bss start:0x00000000 end:0x00000008 REL/mentDll/main.c: .text start:0x0000658C end:0x00023A38 .rodata start:0x000000E8 end:0x00000528 .data start:0x000000D8 end:0x000006D0 - .bss start:0x00000000 end:0x000036C4 + .bss start:0x00000008 end:0x000036C4 diff --git a/config/GMPE01_00/rels/mentDll/symbols.txt b/config/GMPE01_00/rels/mentDll/symbols.txt index cf268b30..bd1aad57 100644 --- a/config/GMPE01_00/rels/mentDll/symbols.txt +++ b/config/GMPE01_00/rels/mentDll/symbols.txt @@ -419,7 +419,8 @@ lbl_1_data_5BC = .data:0x000005BC; // type:object size:0x20 lbl_1_data_5DC = .data:0x000005DC; // type:object size:0x64 data:float lbl_1_data_640 = .data:0x00000640; // type:object size:0x50 data:4byte lbl_1_data_690 = .data:0x00000690; // type:object size:0x40 data:4byte -lbl_1_bss_0 = .bss:0x00000000; // type:object size:0x14 data:4byte +lbl_1_bss_0 = .bss:0x00000000; // type:object size:0x4 data:4byte +lbl_1_bss_8 = .bss:0x00000008; // type:object size:0xC data:4byte lbl_1_bss_14 = .bss:0x00000014; // type:object size:0x10 data:4byte lbl_1_bss_24 = .bss:0x00000024; // type:object size:0x40 data:4byte lbl_1_bss_64 = .bss:0x00000064; // type:object size:0x44 data:float diff --git a/configure.py b/configure.py index 1371ef6a..b71c3445 100644 --- a/configure.py +++ b/configure.py @@ -1256,7 +1256,7 @@ config.libs = [ Rel( "mentDll", objects={ - Object(NonMatching, "REL/mentDll/common.c"), + Object(Matching, "REL/mentDll/common.c"), Object(Matching, "REL/mentDll/main.c"), }, ), diff --git a/include/game/window.h b/include/game/window.h index 85be8616..a2ff8eb1 100644 --- a/include/game/window.h +++ b/include/game/window.h @@ -109,9 +109,7 @@ s16 HuWinChoiceGet(s16 window, s16 start_choice); s16 HuWinChoiceNumGet(s16 window); void HuWinChoiceDisable(s16 window, s16 choice); s16 HuWinChoiceNowGet(s16 window); -#ifndef HUWIN_USE_OLD_DEFS void HuWinMesWait(s16 window); -#endif s16 HuWinAnimSet(s16 window, AnimData *anim, s16 bank, float x, float y); s16 HuWinSprSet(s16 window, s16 sprite, float x, float y); void HuWinSprPosSet(s16 window, s16 index, float x, float y); diff --git a/src/REL/mentDll/common.c b/src/REL/mentDll/common.c index d98adb7c..63a3a0ef 100644 --- a/src/REL/mentDll/common.c +++ b/src/REL/mentDll/common.c @@ -11,6 +11,10 @@ #include "REL/mentDll.h" #include "game/printfunc.h" #include "game/hsfmotion.h" +#include "game/sprite.h" + +#include "rel_sqrt_consts.h" + Process* lbl_1_bss_0; //TODO: unknown type @@ -96,7 +100,7 @@ f32 fn_1_234(f32 arg8, f32 arg9, f32 argA) { } //fn_1_254 -f32 CosineEaseInOut(f32 arg8, f32 arg9, f32 argA, f32 argB) { +f32 fn_1_254(f32 arg8, f32 arg9, f32 argA, f32 argB) { if (argA >= argB) { return arg9; } @@ -104,7 +108,7 @@ f32 CosineEaseInOut(f32 arg8, f32 arg9, f32 argA, f32 argB) { } //fn_1_32C -f32 SinusoidalInterpolation(f32 arg8, f32 arg9, f32 argA, f32 argB) { +f32 fn_1_32C(f32 arg8, f32 arg9, f32 argA, f32 argB) { if (argA >= argB) { return arg9; } @@ -306,7 +310,7 @@ void fn_1_164C(s32 arg0, f32 arg8, f32 arg9) { void fn_1_16AC(s32 arg0) { HuWinMesSet(arg0, 0x250004); HuPrcVSleep(); - fn_1_6F4(arg0, 0, 0.5f, 0.5f); + fn_1_6F4(arg0, 0.5f, 0.5f, 0); HuWinExCleanup(arg0); } @@ -644,27 +648,27 @@ void fn_1_33EC(MentDllUnkBss64Struct* arg0, MentDllUnkBss64Struct* arg1, f32 arg } void fn_1_3858(MentDllUnkBss64Struct* arg0, MentDllUnkBss64Struct* arg1, f32 arg8, f32 arg9) { - arg1->prevCenter.x = SinusoidalInterpolation(arg0->prevCenter.x, arg1->center.x, arg8, arg9); - arg1->prevCenter.y = SinusoidalInterpolation(arg0->prevCenter.y, arg1->center.y, arg8, arg9); - arg1->prevCenter.z = SinusoidalInterpolation(arg0->prevCenter.z, arg1->center.z, arg8, arg9); + arg1->prevCenter.x = fn_1_32C(arg0->prevCenter.x, arg1->center.x, arg8, arg9); + arg1->prevCenter.y = fn_1_32C(arg0->prevCenter.y, arg1->center.y, arg8, arg9); + arg1->prevCenter.z = fn_1_32C(arg0->prevCenter.z, arg1->center.z, arg8, arg9); - arg1->prevRot.x = SinusoidalInterpolation(arg0->prevRot.x, arg1->rot.x, arg8, arg9); - arg1->prevRot.y = SinusoidalInterpolation(arg0->prevRot.y, arg1->rot.y, arg8, arg9); - arg1->prevRot.z = SinusoidalInterpolation(arg0->prevRot.z, arg1->rot.z, arg8, arg9); + arg1->prevRot.x = fn_1_32C(arg0->prevRot.x, arg1->rot.x, arg8, arg9); + arg1->prevRot.y = fn_1_32C(arg0->prevRot.y, arg1->rot.y, arg8, arg9); + arg1->prevRot.z = fn_1_32C(arg0->prevRot.z, arg1->rot.z, arg8, arg9); - arg1->prevZoom = SinusoidalInterpolation(arg0->prevZoom, arg1->zoom, arg8, arg9); + arg1->prevZoom = fn_1_32C(arg0->prevZoom, arg1->zoom, arg8, arg9); } void fn_1_3CAC(MentDllUnkBss64Struct* arg0, MentDllUnkBss64Struct* arg1, f32 arg8, f32 arg9) { - arg1->prevCenter.x = SinusoidalInterpolation(arg0->prevCenter.x, arg1->center.x, arg8, arg9); - arg1->prevCenter.y = SinusoidalInterpolation(arg0->prevCenter.y, arg1->center.y, arg8, arg9); - arg1->prevCenter.z = SinusoidalInterpolation(arg0->prevCenter.z, arg1->center.z, arg8, arg9); + arg1->prevCenter.x = fn_1_32C(arg0->prevCenter.x, arg1->center.x, arg8, arg9); + arg1->prevCenter.y = fn_1_32C(arg0->prevCenter.y, arg1->center.y, arg8, arg9); + arg1->prevCenter.z = fn_1_32C(arg0->prevCenter.z, arg1->center.z, arg8, arg9); - arg1->prevRot.x = SinusoidalInterpolation(arg0->prevRot.x, arg1->rot.x, arg8, arg9); - arg1->prevRot.y = SinusoidalInterpolation(arg0->prevRot.y, arg1->rot.y, arg8, arg9); - arg1->prevRot.z = SinusoidalInterpolation(arg0->prevRot.z, arg1->rot.z, arg8, arg9); + arg1->prevRot.x = fn_1_32C(arg0->prevRot.x, arg1->rot.x, arg8, arg9); + arg1->prevRot.y = fn_1_32C(arg0->prevRot.y, arg1->rot.y, arg8, arg9); + arg1->prevRot.z = fn_1_32C(arg0->prevRot.z, arg1->rot.z, arg8, arg9); - arg1->prevZoom = SinusoidalInterpolation(arg0->prevZoom, arg1->zoom, arg8, arg9); + arg1->prevZoom = fn_1_32C(arg0->prevZoom, arg1->zoom, arg8, arg9); arg0->center.x = arg1->prevCenter.x; arg0->center.y = arg1->prevCenter.y; @@ -678,15 +682,15 @@ void fn_1_3CAC(MentDllUnkBss64Struct* arg0, MentDllUnkBss64Struct* arg1, f32 arg } void fn_1_4138(MentDllUnkBss64Struct* arg0, MentDllUnkBss64Struct* arg1, f32 arg8, f32 arg9, f32 argA) { - arg1->prevCenter.x = SinusoidalInterpolation(arg0->prevCenter.x, arg1->center.x, arg8, arg9); - arg1->prevCenter.y = SinusoidalInterpolation(arg0->prevCenter.y, arg1->center.y, arg8, arg9); - arg1->prevCenter.z = SinusoidalInterpolation(arg0->prevCenter.z, arg1->center.z, arg8, arg9); + arg1->prevCenter.x = fn_1_32C(arg0->prevCenter.x, arg1->center.x, arg8, arg9); + arg1->prevCenter.y = fn_1_32C(arg0->prevCenter.y, arg1->center.y, arg8, arg9); + arg1->prevCenter.z = fn_1_32C(arg0->prevCenter.z, arg1->center.z, arg8, arg9); - arg1->prevRot.x = SinusoidalInterpolation(arg0->prevRot.x, arg1->rot.x, arg8, arg9); - arg1->prevRot.y = SinusoidalInterpolation(arg0->prevRot.y, arg1->rot.y, arg8, arg9); - arg1->prevRot.z = SinusoidalInterpolation(arg0->prevRot.z, arg1->rot.z, arg8, arg9); + arg1->prevRot.x = fn_1_32C(arg0->prevRot.x, arg1->rot.x, arg8, arg9); + arg1->prevRot.y = fn_1_32C(arg0->prevRot.y, arg1->rot.y, arg8, arg9); + arg1->prevRot.z = fn_1_32C(arg0->prevRot.z, arg1->rot.z, arg8, arg9); - arg1->prevZoom = SinusoidalInterpolation(arg0->prevZoom, arg1->zoom, arg8, arg9); + arg1->prevZoom = fn_1_32C(arg0->prevZoom, arg1->zoom, arg8, arg9); arg0->center.x = SmoothInterpolate(arg0->center.x, arg1->prevCenter.x, argA); arg0->center.y = SmoothInterpolate(arg0->center.y, arg1->prevCenter.y, argA); @@ -700,27 +704,27 @@ void fn_1_4138(MentDllUnkBss64Struct* arg0, MentDllUnkBss64Struct* arg1, f32 arg } void fn_1_4790(MentDllUnkBss64Struct* arg0, MentDllUnkBss64Struct* arg1, f32 arg8, f32 arg9) { - arg1->prevCenter.x = CosineEaseInOut(arg0->prevCenter.x, arg1->center.x, arg8, arg9); - arg1->prevCenter.y = CosineEaseInOut(arg0->prevCenter.y, arg1->center.y, arg8, arg9); - arg1->prevCenter.z = CosineEaseInOut(arg0->prevCenter.z, arg1->center.z, arg8, arg9); + arg1->prevCenter.x = fn_1_254(arg0->prevCenter.x, arg1->center.x, arg8, arg9); + arg1->prevCenter.y = fn_1_254(arg0->prevCenter.y, arg1->center.y, arg8, arg9); + arg1->prevCenter.z = fn_1_254(arg0->prevCenter.z, arg1->center.z, arg8, arg9); - arg1->prevRot.x = CosineEaseInOut(arg0->prevRot.x, arg1->rot.x, arg8, arg9); - arg1->prevRot.y = CosineEaseInOut(arg0->prevRot.y, arg1->rot.y, arg8, arg9); - arg1->prevRot.z = CosineEaseInOut(arg0->prevRot.z, arg1->rot.z, arg8, arg9); + arg1->prevRot.x = fn_1_254(arg0->prevRot.x, arg1->rot.x, arg8, arg9); + arg1->prevRot.y = fn_1_254(arg0->prevRot.y, arg1->rot.y, arg8, arg9); + arg1->prevRot.z = fn_1_254(arg0->prevRot.z, arg1->rot.z, arg8, arg9); - arg1->prevZoom = CosineEaseInOut(arg0->prevZoom, arg1->zoom, arg8, arg9); + arg1->prevZoom = fn_1_254(arg0->prevZoom, arg1->zoom, arg8, arg9); } void fn_1_4C54(MentDllUnkBss64Struct* arg0, MentDllUnkBss64Struct* arg1, f32 arg8, f32 arg9) { - arg1->prevCenter.x = CosineEaseInOut(arg0->prevCenter.x, arg1->center.x, arg8, arg9); - arg1->prevCenter.y = CosineEaseInOut(arg0->prevCenter.y, arg1->center.y, arg8, arg9); - arg1->prevCenter.z = CosineEaseInOut(arg0->prevCenter.z, arg1->center.z, arg8, arg9); + arg1->prevCenter.x = fn_1_254(arg0->prevCenter.x, arg1->center.x, arg8, arg9); + arg1->prevCenter.y = fn_1_254(arg0->prevCenter.y, arg1->center.y, arg8, arg9); + arg1->prevCenter.z = fn_1_254(arg0->prevCenter.z, arg1->center.z, arg8, arg9); - arg1->prevRot.x = CosineEaseInOut(arg0->prevRot.x, arg1->rot.x, arg8, arg9); - arg1->prevRot.y = CosineEaseInOut(arg0->prevRot.y, arg1->rot.y, arg8, arg9); - arg1->prevRot.z = CosineEaseInOut(arg0->prevRot.z, arg1->rot.z, arg8, arg9); + arg1->prevRot.x = fn_1_254(arg0->prevRot.x, arg1->rot.x, arg8, arg9); + arg1->prevRot.y = fn_1_254(arg0->prevRot.y, arg1->rot.y, arg8, arg9); + arg1->prevRot.z = fn_1_254(arg0->prevRot.z, arg1->rot.z, arg8, arg9); - arg1->prevZoom = CosineEaseInOut(arg0->prevZoom, arg1->zoom, arg8, arg9); + arg1->prevZoom = fn_1_254(arg0->prevZoom, arg1->zoom, arg8, arg9); arg0->center.x = arg1->prevCenter.x; arg0->center.y = arg1->prevCenter.y; @@ -734,15 +738,15 @@ void fn_1_4C54(MentDllUnkBss64Struct* arg0, MentDllUnkBss64Struct* arg1, f32 arg } void fn_1_5150(MentDllUnkBss64Struct* arg0, MentDllUnkBss64Struct* arg1, f32 arg8, f32 arg9, f32 argA) { - arg1->prevCenter.x = CosineEaseInOut(arg0->prevCenter.x, arg1->center.x, arg8, arg9); - arg1->prevCenter.y = CosineEaseInOut(arg0->prevCenter.y, arg1->center.y, arg8, arg9); - arg1->prevCenter.z = CosineEaseInOut(arg0->prevCenter.z, arg1->center.z, arg8, arg9); + arg1->prevCenter.x = fn_1_254(arg0->prevCenter.x, arg1->center.x, arg8, arg9); + arg1->prevCenter.y = fn_1_254(arg0->prevCenter.y, arg1->center.y, arg8, arg9); + arg1->prevCenter.z = fn_1_254(arg0->prevCenter.z, arg1->center.z, arg8, arg9); - arg1->prevRot.x = CosineEaseInOut(arg0->prevRot.x, arg1->rot.x, arg8, arg9); - arg1->prevRot.y = CosineEaseInOut(arg0->prevRot.y, arg1->rot.y, arg8, arg9); - arg1->prevRot.z = CosineEaseInOut(arg0->prevRot.z, arg1->rot.z, arg8, arg9); + arg1->prevRot.x = fn_1_254(arg0->prevRot.x, arg1->rot.x, arg8, arg9); + arg1->prevRot.y = fn_1_254(arg0->prevRot.y, arg1->rot.y, arg8, arg9); + arg1->prevRot.z = fn_1_254(arg0->prevRot.z, arg1->rot.z, arg8, arg9); - arg1->prevZoom = CosineEaseInOut(arg0->prevZoom, arg1->zoom, arg8, arg9); + arg1->prevZoom = fn_1_254(arg0->prevZoom, arg1->zoom, arg8, arg9); arg0->center.x = SmoothInterpolate(arg0->center.x, arg1->prevCenter.x, argA); arg0->center.y = SmoothInterpolate(arg0->center.y, arg1->prevCenter.y, argA); @@ -819,4 +823,126 @@ void fn_1_5CDC(omObjData* arg0, s32 arg1, s32 arg2) { do { HuPrcVSleep(); } while (Hu3DMotionEndCheck(arg0->model[arg1]) == 0); +} + +void fn_1_5D38(omObjData *arg0, s32 arg1, Vec arg2, float arg8, float arg9, float argA, s32 arg3, s32 arg4) +{ + s32 temp_r29 = 0; + s32 temp_r28 = 0; + + Vec sp4C; + Vec sp40; + Vec sp34; + Vec sp28; + Vec sp1C; + Vec sp10; + sp40.x = Hu3DData[arg0->model[arg1]].pos.x; + sp40.y = Hu3DData[arg0->model[arg1]].pos.y; + sp40.z = Hu3DData[arg0->model[arg1]].pos.z; + sp34.x = arg2.x; + sp34.y = arg2.y; + sp34.z = arg2.z; + sp1C.x = Hu3DData[arg0->model[arg1]].rot.x; + sp1C.y = Hu3DData[arg0->model[arg1]].rot.y; + sp1C.z = Hu3DData[arg0->model[arg1]].rot.z; + sp10.x = 0; + sp10.y = arg8; + sp10.z = 0; + if(sp34.x-sp40.x >= 0.0f) { + temp_r29 = 1; + } else { + temp_r29 = 0; + } + if(sp34.z-sp40.z >= 0.0f) { + temp_r28 = 1; + } else { + temp_r28 = 0; + } + while(arg3) { + fn_1_4D8(); + sp28.y = -(atan2d(sp34.z-sp40.z, sp34.x-sp40.x)-90); + if(sp28.y < 0.0f) { + sp28.y += 360.0f; + } else if(sp28.y >= 360.0f) { + sp28.y -= 360.0f; + } + if(arg4) { + if(sp28.y >= 180.0f) { + if(sp1C.y-sp28.y >= 180.0f) { + sp1C.y -= 360.0f; + } + if(sp1C.y-sp28.y < -180.0f) { + sp1C.y += 360.0f; + } + } else { + if(sp1C.y-sp28.y > 180.0f) { + sp1C.y -= 360.0f; + } + if(sp1C.y-sp28.y <= -180.0f) { + sp1C.y += 360.0f; + } + } + } + sp4C.x = sp40.x = sp40.x+(arg9*sind(sp28.y)); + sp4C.z = sp40.z = sp40.z+(arg9*cosd(sp28.y)); + if(temp_r29 == 1) { + if(sp40.x >= sp34.x) { + sp4C.x = sp40.x = sp34.x; + temp_r29 = 2; + } + } else if(temp_r29 == 0) { + if(sp40.x <= sp34.x) { + sp4C.x = sp40.x = sp34.x; + temp_r29 = 2; + } + } + if(temp_r28 == 1) { + if(sp40.z >= sp34.z) { + sp4C.z = sp40.z = sp34.z; + temp_r28 = 2; + } + } else if(temp_r28 == 0) { + if(sp40.z <= sp34.z) { + sp4C.z = sp40.z = sp34.z; + temp_r28 = 2; + } + } + if(arg4) { + sp1C.y = fn_1_234(sp1C.y, sp28.y, argA); + } + Hu3DModelPosSet(arg0->model[arg1], sp4C.x, sp40.y, sp4C.z); + Hu3DModelRotSet(arg0->model[arg1], sp1C.x, sp1C.y, sp1C.z); + if(temp_r29 == 2 && temp_r28 == 2) { + break; + } + } + sp1C.y = Hu3DData[arg0->model[arg1]].rot.y; + if(arg4) { + s32 temp_r27; + for(temp_r27=0; temp_r27<=argA; temp_r27++) { + fn_1_4D8(); + if(sp10.y >= 180.0f) { + if(sp1C.y-sp10.y >= 180.0f) { + sp1C.y -= 360.0f; + } + if(sp1C.y-sp10.y < -180.0f) { + sp1C.y += 360.0f; + } + } else { + if(sp1C.y-sp10.y > 180.0f) { + sp1C.y -= 360.0f; + } + if(sp1C.y-sp10.y <= -180.0f) { + sp1C.y += 360.0f; + } + } + sp10.z = fn_1_20C(sp1C.y, sp10.y, temp_r27, argA); + Hu3DModelRotSet(arg0->model[arg1], sp1C.x, sp10.z, sp1C.z); + } + } +} + +void fn_1_6534(s32 grpId, s32 memberNo, float posX, float posY) +{ + HuSprPosSet(grpId, memberNo, posX, posY+0.5f); } \ No newline at end of file diff --git a/src/REL/mentDll/main.c b/src/REL/mentDll/main.c index b415f268..2fe946cc 100644 --- a/src/REL/mentDll/main.c +++ b/src/REL/mentDll/main.c @@ -186,7 +186,7 @@ s32 lbl_1_bss_A8[8]; MentDllUnkBss64Struct lbl_1_bss_64; s32 lbl_1_bss_24[16]; s32 lbl_1_bss_14[4]; -s32 lbl_1_bss_0[5]; +s32 lbl_1_bss_8[3]; void fn_1_658C(Process *arg0) {