From 42e933819f4eb985b2f74deb96f4bfd0cc81338d Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Mon, 10 Jun 2024 08:35:27 -0500 Subject: [PATCH] Decompile rest of m434dll --- config/GMPE01_00/rels/m434Dll/symbols.txt | 110 +-- configure.py | 2 +- include/REL/m434Dll.h | 13 + src/REL/m434Dll/fish.c | 816 ++++++++++++++++++++++ src/REL/m434Dll/main.c | 2 +- src/REL/m434Dll/player.c | 676 ++++++++++++++++++ src/REL/modeseldll/modesel.c | 4 +- 7 files changed, 1564 insertions(+), 59 deletions(-) create mode 100644 src/REL/m434Dll/fish.c create mode 100644 src/REL/m434Dll/player.c diff --git a/config/GMPE01_00/rels/m434Dll/symbols.txt b/config/GMPE01_00/rels/m434Dll/symbols.txt index 8ac4caf6..8ffa0589 100644 --- a/config/GMPE01_00/rels/m434Dll/symbols.txt +++ b/config/GMPE01_00/rels/m434Dll/symbols.txt @@ -214,61 +214,61 @@ lbl_1_rodata_2B8 = .rodata:0x000002B8; // type:object size:0x4 scope:local data: lbl_1_rodata_2C0 = .rodata:0x000002C0; // type:object size:0x8 scope:local data:double lbl_1_rodata_2C8 = .rodata:0x000002C8; // type:object size:0x4 scope:local data:float lbl_1_rodata_2CC = .rodata:0x000002CC; // type:object size:0x4 scope:local data:float -lbl_1_rodata_2D0 = .rodata:0x000002D0; // type:object size:0x4 data:float -lbl_1_rodata_2D4 = .rodata:0x000002D4; // type:object size:0x4 data:float -lbl_1_rodata_2D8 = .rodata:0x000002D8; // type:object size:0x4 data:float -lbl_1_rodata_2DC = .rodata:0x000002DC; // type:object size:0x4 data:float -lbl_1_rodata_2E0 = .rodata:0x000002E0; // type:object size:0x8 data:double -lbl_1_rodata_2E8 = .rodata:0x000002E8; // type:object size:0x8 data:double -lbl_1_rodata_2F0 = .rodata:0x000002F0; // type:object size:0x4 data:float -lbl_1_rodata_2F4 = .rodata:0x000002F4; // type:object size:0x4 data:float -lbl_1_rodata_2F8 = .rodata:0x000002F8; // type:object size:0x8 data:double -lbl_1_rodata_300 = .rodata:0x00000300; // type:object size:0x4 data:float -lbl_1_rodata_304 = .rodata:0x00000304; // type:object size:0x4 data:float -lbl_1_rodata_308 = .rodata:0x00000308; // type:object size:0x4 data:float -lbl_1_rodata_30C = .rodata:0x0000030C; // type:object size:0x4 data:float -lbl_1_rodata_310 = .rodata:0x00000310; // type:object size:0x4 data:float -lbl_1_rodata_314 = .rodata:0x00000314; // type:object size:0x4 data:float -lbl_1_rodata_318 = .rodata:0x00000318; // type:object size:0x4 data:float -lbl_1_rodata_31C = .rodata:0x0000031C; // type:object size:0x4 data:float -lbl_1_rodata_320 = .rodata:0x00000320; // type:object size:0x4 data:float -lbl_1_rodata_324 = .rodata:0x00000324; // type:object size:0x4 data:float -lbl_1_rodata_328 = .rodata:0x00000328; // type:object size:0x4 data:float -lbl_1_rodata_32C = .rodata:0x0000032C; // type:object size:0x4 data:float -lbl_1_rodata_330 = .rodata:0x00000330; // type:object size:0x4 data:float -lbl_1_rodata_334 = .rodata:0x00000334; // type:object size:0x4 data:float -lbl_1_rodata_338 = .rodata:0x00000338; // type:object size:0x4 data:float -lbl_1_rodata_33C = .rodata:0x0000033C; // type:object size:0x4 data:float -lbl_1_rodata_340 = .rodata:0x00000340; // type:object size:0x4 data:float -lbl_1_rodata_344 = .rodata:0x00000344; // type:object size:0x4 data:float -lbl_1_rodata_348 = .rodata:0x00000348; // type:object size:0x4 data:float -lbl_1_rodata_34C = .rodata:0x0000034C; // type:object size:0x4 data:float -lbl_1_rodata_350 = .rodata:0x00000350; // type:object size:0x8 data:double -lbl_1_rodata_358 = .rodata:0x00000358; // type:object size:0x4 data:float -lbl_1_rodata_35C = .rodata:0x0000035C; // type:object size:0x4 data:float -lbl_1_rodata_360 = .rodata:0x00000360; // type:object size:0x4 data:float -lbl_1_rodata_364 = .rodata:0x00000364; // type:object size:0x4 data:float -lbl_1_rodata_368 = .rodata:0x00000368; // type:object size:0x4 data:float -lbl_1_rodata_36C = .rodata:0x0000036C; // type:object size:0x4 data:float -lbl_1_rodata_370 = .rodata:0x00000370; // type:object size:0x4 data:float -lbl_1_rodata_374 = .rodata:0x00000374; // type:object size:0x4 data:float -lbl_1_rodata_378 = .rodata:0x00000378; // type:object size:0x4 data:float -lbl_1_rodata_37C = .rodata:0x0000037C; // type:object size:0x48 -lbl_1_rodata_3C4 = .rodata:0x000003C4; // type:object size:0x48 -lbl_1_rodata_40C = .rodata:0x0000040C; // type:object size:0x4 data:float -lbl_1_rodata_410 = .rodata:0x00000410; // type:object size:0x4 data:float -lbl_1_rodata_414 = .rodata:0x00000414; // type:object size:0x4 data:float -lbl_1_rodata_418 = .rodata:0x00000418; // type:object size:0x4 data:float -lbl_1_rodata_41C = .rodata:0x0000041C; // type:object size:0x4 data:float -lbl_1_rodata_420 = .rodata:0x00000420; // type:object size:0x8 data:double -lbl_1_rodata_428 = .rodata:0x00000428; // type:object size:0x4 data:float -lbl_1_rodata_42C = .rodata:0x0000042C; // type:object size:0x4 data:float -lbl_1_rodata_430 = .rodata:0x00000430; // type:object size:0x4 data:float -lbl_1_rodata_434 = .rodata:0x00000434; // type:object size:0x4 data:float -lbl_1_rodata_438 = .rodata:0x00000438; // type:object size:0x4 data:float -lbl_1_rodata_43C = .rodata:0x0000043C; // type:object size:0x4 data:4byte -lbl_1_rodata_440 = .rodata:0x00000440; // type:object size:0x48 -lbl_1_rodata_488 = .rodata:0x00000488; // type:object size:0x48 +lbl_1_rodata_2D0 = .rodata:0x000002D0; // type:object size:0x4 scope:local data:float +lbl_1_rodata_2D4 = .rodata:0x000002D4; // type:object size:0x4 scope:local data:float +lbl_1_rodata_2D8 = .rodata:0x000002D8; // type:object size:0x4 scope:local data:float +lbl_1_rodata_2DC = .rodata:0x000002DC; // type:object size:0x4 scope:local data:float +lbl_1_rodata_2E0 = .rodata:0x000002E0; // type:object size:0x8 scope:local data:double +lbl_1_rodata_2E8 = .rodata:0x000002E8; // type:object size:0x8 scope:local data:double +lbl_1_rodata_2F0 = .rodata:0x000002F0; // type:object size:0x4 scope:local data:float +lbl_1_rodata_2F4 = .rodata:0x000002F4; // type:object size:0x4 scope:local data:float +lbl_1_rodata_2F8 = .rodata:0x000002F8; // type:object size:0x8 scope:local data:double +lbl_1_rodata_300 = .rodata:0x00000300; // type:object size:0x4 scope:local data:float +lbl_1_rodata_304 = .rodata:0x00000304; // type:object size:0x4 scope:local data:float +lbl_1_rodata_308 = .rodata:0x00000308; // type:object size:0x4 scope:local data:float +lbl_1_rodata_30C = .rodata:0x0000030C; // type:object size:0x4 scope:local data:float +lbl_1_rodata_310 = .rodata:0x00000310; // type:object size:0x4 scope:local data:float +lbl_1_rodata_314 = .rodata:0x00000314; // type:object size:0x4 scope:local data:float +lbl_1_rodata_318 = .rodata:0x00000318; // type:object size:0x4 scope:local data:float +lbl_1_rodata_31C = .rodata:0x0000031C; // type:object size:0x4 scope:local data:float +lbl_1_rodata_320 = .rodata:0x00000320; // type:object size:0x4 scope:local data:float +lbl_1_rodata_324 = .rodata:0x00000324; // type:object size:0x4 scope:local data:float +lbl_1_rodata_328 = .rodata:0x00000328; // type:object size:0x4 scope:local data:float +lbl_1_rodata_32C = .rodata:0x0000032C; // type:object size:0x4 scope:local data:float +lbl_1_rodata_330 = .rodata:0x00000330; // type:object size:0x4 scope:local data:float +lbl_1_rodata_334 = .rodata:0x00000334; // type:object size:0x4 scope:local data:float +lbl_1_rodata_338 = .rodata:0x00000338; // type:object size:0x4 scope:local data:float +lbl_1_rodata_33C = .rodata:0x0000033C; // type:object size:0x4 scope:local data:float +lbl_1_rodata_340 = .rodata:0x00000340; // type:object size:0x4 scope:local data:float +lbl_1_rodata_344 = .rodata:0x00000344; // type:object size:0x4 scope:local data:float +lbl_1_rodata_348 = .rodata:0x00000348; // type:object size:0x4 scope:local data:float +lbl_1_rodata_34C = .rodata:0x0000034C; // type:object size:0x4 scope:local data:float +lbl_1_rodata_350 = .rodata:0x00000350; // type:object size:0x8 scope:local data:double +lbl_1_rodata_358 = .rodata:0x00000358; // type:object size:0x4 scope:local data:float +lbl_1_rodata_35C = .rodata:0x0000035C; // type:object size:0x4 scope:local data:float +lbl_1_rodata_360 = .rodata:0x00000360; // type:object size:0x4 scope:local data:float +lbl_1_rodata_364 = .rodata:0x00000364; // type:object size:0x4 scope:local data:float +lbl_1_rodata_368 = .rodata:0x00000368; // type:object size:0x4 scope:local data:float +lbl_1_rodata_36C = .rodata:0x0000036C; // type:object size:0x4 scope:local data:float +lbl_1_rodata_370 = .rodata:0x00000370; // type:object size:0x4 scope:local data:float +lbl_1_rodata_374 = .rodata:0x00000374; // type:object size:0x4 scope:local data:float +lbl_1_rodata_378 = .rodata:0x00000378; // type:object size:0x4 scope:local data:float +lbl_1_rodata_37C = .rodata:0x0000037C; // type:object size:0x48 scope:local +lbl_1_rodata_3C4 = .rodata:0x000003C4; // type:object size:0x48 scope:local +lbl_1_rodata_40C = .rodata:0x0000040C; // type:object size:0x4 scope:local data:float +lbl_1_rodata_410 = .rodata:0x00000410; // type:object size:0x4 scope:local data:float +lbl_1_rodata_414 = .rodata:0x00000414; // type:object size:0x4 scope:local data:float +lbl_1_rodata_418 = .rodata:0x00000418; // type:object size:0x4 scope:local data:float +lbl_1_rodata_41C = .rodata:0x0000041C; // type:object size:0x4 scope:local data:float +lbl_1_rodata_420 = .rodata:0x00000420; // type:object size:0x8 scope:local data:double +lbl_1_rodata_428 = .rodata:0x00000428; // type:object size:0x4 scope:local data:float +lbl_1_rodata_42C = .rodata:0x0000042C; // type:object size:0x4 scope:local data:float +lbl_1_rodata_430 = .rodata:0x00000430; // type:object size:0x4 scope:local data:float +lbl_1_rodata_434 = .rodata:0x00000434; // type:object size:0x4 scope:local data:float +lbl_1_rodata_438 = .rodata:0x00000438; // type:object size:0x4 scope:local data:float +lbl_1_rodata_43C = .rodata:0x0000043C; // type:object size:0x4 scope:local data:4byte +lbl_1_rodata_440 = .rodata:0x00000440; // type:object size:0x48 scope:local +lbl_1_rodata_488 = .rodata:0x00000488; // type:object size:0x48 scope:local lbl_1_data_0 = .data:0x00000000; // type:object size:0xC data:float lbl_1_data_C = .data:0x0000000C; // type:object size:0xC data:float lbl_1_data_18 = .data:0x00000018; // type:object size:0xC data:float diff --git a/configure.py b/configure.py index e82a3049..525fce57 100644 --- a/configure.py +++ b/configure.py @@ -1097,7 +1097,7 @@ config.libs = [ Object(Matching, "REL/m434Dll/main.c"), Object(Matching, "REL/m434Dll/map.c"), Object(NonMatching, "REL/m434Dll/player.c"), - Object(NonMatching, "REL/m434Dll/fish.c"), + Object(Matching, "REL/m434Dll/fish.c"), }, ), Rel( diff --git a/include/REL/m434Dll.h b/include/REL/m434Dll.h index 5ea5f4ea..d83bd084 100644 --- a/include/REL/m434Dll.h +++ b/include/REL/m434Dll.h @@ -9,6 +9,8 @@ s32 fn_1_1CB8(void); s32 fn_1_1D54(void); void fn_1_1D64(s32 arg0); s32 fn_1_1D74(s32 arg0); +s32 fn_1_1D8C(void); +void fn_1_1D9C(void); void fn_1_1DB0(Process *objman); void fn_1_1E44(void); @@ -16,8 +18,19 @@ void fn_1_43AC(Vec *arg0); void fn_1_47EC(Vec *arg0); void fn_1_4854(Process *objman); void fn_1_4964(void); +float fn_1_6690(float arg0, float arg1, float arg2); +float fn_1_67AC(float arg0, float arg1); void fn_1_6860(Process *objman); void fn_1_6A84(void); +s32 fn_1_8884(Vec *arg0, float arg1, float arg2, float arg3, float arg4, float arg5, s32 arg6, s32 arg7); +void fn_1_8AEC(s16 arg0, Vec *arg1); +void fn_1_8B58(s16 arg0); + +void fn_1_8C14(s32 arg0, Vec *arg1, float arg2); +s32 fn_1_8D78(Vec *arg0); +s32 fn_1_8E2C(s32 arg0, Vec *arg1); +s32 fn_1_8F3C(s32 arg0); +s32 fn_1_8FA0(Vec *arg0); #endif diff --git a/src/REL/m434Dll/fish.c b/src/REL/m434Dll/fish.c new file mode 100644 index 00000000..12c5df8c --- /dev/null +++ b/src/REL/m434Dll/fish.c @@ -0,0 +1,816 @@ +#include "game/object.h" +#include "game/objsub.h" +#include "game/hsfman.h" +#include "game/hsfmotion.h" +#include "game/audio.h" +#include "game/wipe.h" + +#include "game/minigame_seq.h" +#include "game/gamework_data.h" +#include "REL/m434Dll.h" +#include "math.h" +#include "ext_math.h" + +typedef struct bss_7480_struct { + s32 unk0; + s32 unk4; + s32 unk8; + float unkC; + float unk10; + Vec unk14; +} Bss7480Struct; + +omObjData *lbl_1_bss_7880; +Bss7480Struct lbl_1_bss_7480[32]; +float lbl_1_bss_6480[1024]; +u8 lbl_1_bss_6080[1024]; +u16 lbl_1_bss_5880[1024]; + +s32 lbl_1_data_2C0[] = { 0x410005, 0x410006 }; + +void fn_1_6A88(omObjData *object); + +void fn_1_6860(Process *objman) +{ + float temp_f31; + Vec spC; + s32 temp_r31; + s32 temp_r30; + s32 temp_r29; + omObjData *temp_r28; + for(temp_r31=0; temp_r31<32; temp_r31++) { + lbl_1_bss_7480[temp_r31].unk4 = lbl_1_bss_7480[temp_r31].unk0 = 0; + lbl_1_bss_7480[temp_r31].unkC = lbl_1_bss_7480[temp_r31].unk10 = 0; + lbl_1_bss_7480[temp_r31].unk8 = -1; + } + spC.y = 0; + spC.z = -650; + for(temp_r31=0; temp_r31<32; temp_r31++) { + temp_r30 = temp_r31*32; + spC.x = -650.0f; + for(temp_r29=0; temp_r29<32; temp_r29++, temp_r30++) { + lbl_1_bss_6480[temp_r30] = 0; + lbl_1_bss_6080[temp_r30] = 0; + lbl_1_bss_5880[temp_r30] = 0; + temp_f31 = VECMag(&spC); + if(temp_f31 < 522.0f) { + lbl_1_bss_6080[temp_r30] = 1; + } + spC.x += (1300.0f/32.0f); + } + spC.z += (1300.0f/32.0f); + } + temp_r28 = lbl_1_bss_7880 = omAddObjEx(objman, 30, 1, 0, -1, fn_1_6A88); + temp_r28->work[0] = 0; +} + +void fn_1_6A84(void) +{ + +} + +typedef struct work_6A88 { + s16 unk0; + s16 unk2; + s16 unk4; + s16 unk6; + s16 unk8; + s16 unkA; + s16 unkC; + s16 unkE; + s32 unk10; + s32 unk14; + s32 unk18; + Vec unk1C; + Vec unk28; + Vec unk34; + Vec unk40; + float unk4C; +} Work6A88; + +void fn_1_6D7C(ModelData *model, Mtx mtx); +void fn_1_6DB8(omObjData *object); + +s32 fn_1_8254(s32 arg0, Vec *arg1); + +void fn_1_6A88(omObjData *object) +{ + float temp_f31; + float temp_f30; + s16 sp8[2]; + Work6A88 *temp_r31; + s32 temp_r30; + s32 temp_r28; + Work6A88 *temp_r27; + temp_r27 = HuMemDirectMallocNum(HEAP_SYSTEM, 20*sizeof(Work6A88), MEMORY_DEFAULT_NUM); + object->data = temp_r27; + memset(temp_r27, 0, 20*sizeof(Work6A88)); + for(temp_r30=0; temp_r30<2; temp_r30++) { + sp8[temp_r30] = Hu3DModelCreateFile(lbl_1_data_2C0[temp_r30]); + } + temp_r31 = temp_r27; + for(temp_r30=0; temp_r30<20; temp_r30++, temp_r31++) { + temp_r28 = 0; + if(temp_r30 >= 15) { + temp_r28++; + } + temp_r31->unk0 = temp_r28+1; + temp_r31->unk2 = Hu3DModelLink(sp8[temp_r28]); + Hu3DModelCameraSet(temp_r31->unk2, 4); + Hu3DModelLayerSet(temp_r31->unk2, 4); + temp_f31 = frandmod(360); + temp_f30 = frandmod(464); + temp_r31->unk4C = temp_f31; + temp_r31->unk1C.x = temp_f30*sind(temp_f31); + temp_r31->unk1C.y = -50.0f; + temp_r31->unk1C.z = temp_f30*cosd(temp_f31); + temp_r31->unk34.z = frandmod(360); + temp_r31->unk40.y = 1.0f; + temp_r31->unk40.z = 0; + temp_r31->unk10 = 1; + temp_r31->unk14 = 0; + temp_r31->unkE = -1; + temp_r31->unkC = 0; + temp_r31->unk18 = fn_1_8254(-1, &temp_r31->unk1C); + temp_r31->unkA = 20; + } + for(temp_r30=0; temp_r30<2; temp_r30++) { + if(sp8[temp_r30] > 0) { + Hu3DModelKill(sp8[temp_r30]); + } + + + } + object->work[1] = 140; + object->model[0] = Hu3DHookFuncCreate(fn_1_6D7C); + Hu3DModelCameraSet(object->model[0], 8); + Hu3DModelLayerSet(object->model[0], 7); + object->func = fn_1_6DB8; +} + +void fn_1_6DBC(omObjData *object); + +void fn_1_6D7C(ModelData *model, Mtx mtx) +{ + if(!omPauseChk()) { + fn_1_6DBC(lbl_1_bss_7880); + } +} + + +void fn_1_6DB8(omObjData *object) +{ + +} + +void fn_1_7DF0(void); +s32 fn_1_84D0(Work6A88 *arg0); +void fn_1_85C4(Work6A88 *arg0, Vec *arg1); + +void fn_1_6DBC(omObjData *object) +{ + Vec sp8; + float temp_f31; + float temp_f30; + Work6A88 *temp_r31; + s32 temp_r30; + s32 temp_r29; + s32 temp_r27; + s32 temp_r26; + s32 temp_r25; + s32 temp_r24; + Work6A88 *temp_r23; + temp_r23 = object->data; + fn_1_7DF0(); + if(object->work[1]) { + object->work[1]--; + return; + } + temp_r26 = 0; + temp_r31 = temp_r23; + for(temp_r27=0; temp_r27<20; temp_r27++, temp_r31++) { + temp_r30 = 0; + temp_r24 = 0; + switch(temp_r31->unk4) { + case 0: + if(temp_r31->unkC == 0) { + temp_r24 = fn_1_84D0(temp_r31); + if(temp_r24) { + temp_r30 = 1; + temp_r31->unkC = 60; + } + } else { + temp_r31->unkC--; + } + if(temp_r31->unkC == 0 && temp_r31->unk40.y > temp_r31->unk40.z) { + temp_r30 = 1; + } else { + VECSubtract(&temp_r31->unk28, &temp_r31->unk1C, &sp8); + temp_f31 = VECMag(&sp8); + if(temp_f31 < 50.0f) { + temp_r30 = 1; + } + } + if(temp_r30) { + if(temp_r31->unkC == 0) { + temp_f31 = frandmod(1000); + temp_f30 = frandmod(1000); + if(temp_f31 > temp_f30) { + temp_f30 = temp_f31; + } + temp_f30 = 0.53f*temp_f30; + temp_f31 = temp_r31->unk4C+((0.06f*frandmod(1000))-30); + temp_r31->unk4C = temp_f31; + temp_r31->unk28.x = temp_f30*sind(temp_f31); + temp_r31->unk28.z = temp_f30*cosd(temp_f31); + } else { + fn_1_85C4(temp_r31, &temp_r31->unk28); + } + temp_r31->unk28.y = temp_r31->unk1C.y; + temp_r31->unk40.y = 0; + temp_r31->unk40.z = frandmod(200)+100.0f; + temp_r31->unk34.y = 200; + if(temp_r31->unkC) { + temp_r31->unk34.y *= 2.0f; + } + } + VECSubtract(&temp_r31->unk28, &temp_r31->unk1C, &sp8); + temp_r31->unk40.x = atan2d(sp8.x, sp8.z); + if(temp_r31->unkC != 0) { + temp_r31->unk34.z = fn_1_6690(temp_r31->unk34.z, temp_r31->unk40.x, 0.15f); + temp_r31->unk4C = atan2d(temp_r31->unk28.x, temp_r31->unk28.z); + } else { + temp_r31->unk34.z = fn_1_6690(temp_r31->unk34.z, temp_r31->unk40.x, 0.07f); + } + if(temp_r31->unkC != 0) { + temp_r31->unk34.y += (300.0f-temp_r31->unk34.y)*0.02f; + } else { + temp_r31->unk34.y += (75.0f-temp_r31->unk34.y)*0.02f; + } + temp_r31->unk34.x += (temp_r31->unk34.y-temp_r31->unk34.x)*0.2f; + temp_r31->unk1C.x += sind(temp_r31->unk34.z)*((1.0f/60.0f)*temp_r31->unk34.x); + temp_r31->unk1C.z += cosd(temp_r31->unk34.z)*((1.0f/60.0f)*temp_r31->unk34.x); + temp_r31->unk40.y += (1.0f/60.0f)*temp_r31->unk34.x; + temp_r31->unk18 = fn_1_8254(temp_r31->unk18, &temp_r31->unk1C); + Hu3DModelPosSetV(temp_r31->unk2, &temp_r31->unk1C); + Hu3DModelRotSet(temp_r31->unk2, 0, temp_r31->unk34.z, 0); + break; + + case 1: + temp_r31->unk34.z += 3.0000002f; + Hu3DModelPosSetV(temp_r31->unk2, &temp_r31->unk1C); + Hu3DModelRotSet(temp_r31->unk2, 0, temp_r31->unk34.z, 0); + if(fn_1_1D54() == 4) { + Hu3DModelAttrSet(temp_r31->unk2, 1); + } + break; + + case 2: + if(temp_r31->unk14) { + if(temp_r31->unk8 == 0) { + sp8.x = (0.1f*frandmod(1000)+500.0f)-50.0f; + sp8.y = temp_r31->unk1C.y; + sp8.z = (0.1f*frandmod(1000)+500.0f)-50.0f; + if(temp_r31->unk1C.x < 0.0f) { + sp8.x = -sp8.x; + } + VECSubtract(&sp8, &temp_r31->unk1C, &sp8); + temp_r31->unk40.x = temp_r31->unk34.z = atan2d(sp8.x, sp8.z); + temp_r31->unk28.x = (1.0f/60.0f)*sp8.x; + temp_r31->unk28.y = 6.666667f; + temp_r31->unk28.z = (1.0f/60.0f)*sp8.z; + temp_r31->unk8++; + HuAudFXPlay(1734); + } + temp_r29 = 0; + if(temp_r31->unk1C.y <= -15.000001f) { + temp_r29 = 1; + } + temp_r31->unk28.y += -0.27222225f; + VECAdd(&temp_r31->unk1C, &temp_r31->unk28, &temp_r31->unk1C); + if(!temp_r29 && temp_r31->unk1C.y <= -15.000001f) { + fn_1_43AC(&temp_r31->unk1C); + if(temp_r31->unkE >= 0) { + omVibrate(temp_r31->unkE, 12, 6, 6); + temp_r31->unkE = -1; + } + HuAudFXPlay(1741); + } + sp8 = temp_r31->unk28; + sp8.y = 0; + temp_f31 = VECMag(&sp8); + temp_f31 = atan2d(temp_r31->unk28.y, temp_f31); + Hu3DModelPosSetV(temp_r31->unk2, &temp_r31->unk1C); + Hu3DModelRotSet(temp_r31->unk2, -temp_f31, temp_r31->unk34.z, 0); + if(temp_r31->unk1C.y <= -50.0) { + temp_r31->unk14 = 0; + temp_r31->unk40.z = 0; + temp_r31->unk40.y = 1; + temp_r31->unk4++; + } + } + + break; + + case 3: + if(temp_r31->unk40.y > temp_r31->unk40.z) { + temp_r30 = 1; + } + VECSubtract(&temp_r31->unk28, &temp_r31->unk1C, &sp8); + temp_f31 = VECMag(&sp8); + if(temp_f31 < 30.000002f) { + temp_r30 = 1; + } + if(temp_r30) { + temp_f31 = frandmod(360); + temp_f30 = (0.08f*frandmod(1000))+20; + temp_r31->unk28.x = temp_f30*sind(temp_f31); + temp_r31->unk28.z = temp_f30*cosd(temp_f31); + temp_r31->unk28.y = -50; + temp_r31->unk1C.y = temp_r31->unk28.y; + temp_r31->unk28.x += 480.00003f; + temp_r31->unk28.z += 480.00003f; + if(temp_r31->unk1C.x < 0.0f) { + temp_r31->unk28.x *= -1.0f; + } + temp_r31->unk40.y = 0; + temp_r31->unk40.z = frandmod(100)+100.0f; + temp_r31->unk34.y = 100; + if(frandmod(100) < 5) { + temp_r31->unk4++; + temp_r31->unk8 = 0; + HuAudFXPlay(1740); + } + } + VECSubtract(&temp_r31->unk28, &temp_r31->unk1C, &sp8); + temp_r31->unk40.x = atan2d(sp8.x, sp8.z); + temp_r31->unk34.z = fn_1_6690(temp_r31->unk34.z, temp_r31->unk40.x, 0.07f); + temp_r31->unk34.y += (50.0f-temp_r31->unk34.y)*0.02f; + temp_r31->unk34.x += (temp_r31->unk34.y-temp_r31->unk34.x)*0.2f; + temp_r31->unk1C.x += sind(temp_r31->unk34.z)*((1.0f/60.0f)*temp_r31->unk34.x); + temp_r31->unk1C.z += cosd(temp_r31->unk34.z)*((1.0f/60.0f)*temp_r31->unk34.x); + temp_r31->unk40.y += (1.0f/60.0f)*temp_r31->unk34.x; + Hu3DModelPosSetV(temp_r31->unk2, &temp_r31->unk1C); + Hu3DModelRotSet(temp_r31->unk2, 0, temp_r31->unk34.z, 0); + + break; + + case 4: + if(temp_r31->unk8 == 0) { + sp8.x = (0.1f*frandmod(1000)+480.00003f)-50.0f; + sp8.y = temp_r31->unk1C.y; + sp8.z = (0.1f*frandmod(1000)+480.00003f)-50.0f; + if(temp_r31->unk1C.x < 0) { + sp8.x = -sp8.x; + } + VECSubtract(&sp8, &temp_r31->unk1C, &sp8); + temp_r31->unk40.x = temp_r31->unk34.z = atan2d(sp8.x, sp8.z); + temp_r31->unk28.x = (1.0f/60.0f)*sp8.x; + temp_r31->unk28.y = 6.666667f; + temp_r31->unk28.z = (1.0f/60.0f)*sp8.z; + temp_r31->unk8++; + } + temp_r29 = temp_r25 = 0; + if(temp_r31->unk1C.y <= -15.000001f) { + temp_r29 = 1; + } + temp_r31->unk28.y += -0.27222225f; + VECAdd(&temp_r31->unk1C, &temp_r31->unk28, &temp_r31->unk1C); + if(temp_r31->unk1C.y <= -15.000001f) { + temp_r25 = 1; + } + if(temp_r29 != temp_r25) { + fn_1_43AC(&temp_r31->unk1C); + if(temp_r31->unk28.y < 0.0f) { + HuAudFXPlay(1741); + } + } + sp8 = temp_r31->unk28; + sp8.y = 0; + temp_f31 = VECMag(&sp8); + temp_f31 = atan2d(temp_r31->unk28.y*0.3f, temp_f31); + Hu3DModelPosSetV(temp_r31->unk2, &temp_r31->unk1C); + Hu3DModelRotSet(temp_r31->unk2, -temp_f31, temp_r31->unk34.z, 0); + if(temp_r31->unk1C.y <= -50.0) { + temp_r31->unk40.z = 0; + temp_r31->unk40.y = 1; + temp_r31->unk4--; + } + break; + } + if(temp_r31->unk4 < 2) { + temp_r26++; + } + } + if(temp_r26 == 0) { + fn_1_1D9C(); + } +} + +void fn_1_7DF0(void) +{ + Vec sp14; + Vec sp8; + float temp_f31; + float temp_f30; + + Bss7480Struct *temp_r31; + s32 temp_r30; + s32 temp_r29; + s32 temp_r28; + s32 temp_r27; + s32 temp_r26; + s32 temp_r25; + s32 temp_r24; + + temp_r31 = lbl_1_bss_7480; + temp_r31 = lbl_1_bss_7480; + for(temp_r30=0; temp_r30<32; temp_r30++, temp_r31++) { + if(temp_r31->unk0 == 0) { + continue; + } + temp_r31->unk0--; + if(temp_r31->unk4) { + temp_r31->unk4--; + temp_r31->unkC += (temp_r31->unk10-temp_r31->unkC)*0.2f; + } else { + if(temp_r31->unk0 < 100.0f) { + temp_r31->unkC *= 0.98f; + } + } + } + for(temp_r30=0; temp_r30<1024; temp_r30++) { + lbl_1_bss_6480[temp_r30] = 0; + } + temp_r31 = lbl_1_bss_7480; + for(temp_r30=0; temp_r30<32; temp_r30++, temp_r31++) { + if(temp_r31->unk0 == 0) { + continue; + } + temp_r28 = (16.0f/650.0f)*(650.0f+(temp_r31->unk14.x-temp_r31->unkC)); + temp_r25 = 1.0f+(temp_r28+((16.0f/650.0f)*(2.0f*temp_r31->unkC))); + temp_r29 = (16.0f/650.0f)*(650.0f+(temp_r31->unk14.z-temp_r31->unkC)); + temp_r24 = 1.0f+(temp_r29+((16.0f/650.0f)*(2.0f*temp_r31->unkC))); + if(temp_r28 < 0) { + temp_r28 = 0; + } + if(temp_r25 > 32) { + temp_r25 = 32; + } + if(temp_r29 < 0) { + temp_r29 = 0; + } + if(temp_r24 > 32) { + temp_r24 = 32; + } + temp_f30 = 1.0f/temp_r31->unkC; + sp14.y = 0; + sp14.z = ((1300.0f/32.0f)*temp_r29)-650.0f; + while(temp_r29unk14, &sp14, &sp8); + temp_f31 = 1.0f-(temp_f30*VECMag(&sp8)); + if(temp_f31 > 0.0f) { + lbl_1_bss_6480[temp_r26] += temp_f31; + } + sp14.x += (1300.0f/32.0f); + } + sp14.z += (1300.0f/32.0f); + temp_r29++; + } + } + +} + +void fn_1_83C8(s32 arg0); + +s32 fn_1_8254(s32 arg0, Vec *arg1) +{ + s32 temp_r31; + s32 temp_r30; + s32 temp_r29; + s32 temp_r28; + s32 temp_r27; + s32 sp8[9][2] = { + -1,-1, + 0,-1, + 1,-1, + -1,0, + 0,0, + 1,0, + -1,1, + 0,1, + 1,1 + }; + fn_1_83C8(arg0); + arg0 = -1; + temp_r29 = (16.0f/650.0f)*(650.0f+arg1->x); + temp_r30 = (16.0f/650.0f)*(650.0f+arg1->z); + if(temp_r29 >= 0 && temp_r29 < 32 && temp_r30 >= 0 && temp_r30 < 32) { + arg0 = temp_r29+(32*temp_r30); + for(temp_r31=0; temp_r31<9; temp_r31++) { + temp_r28 = temp_r29+sp8[temp_r31][0]; + temp_r27 = temp_r30+sp8[temp_r31][1]; + if(temp_r28 >= 0 && temp_r28 < 32 && temp_r27 >= 0 && temp_r27 < 32) { + lbl_1_bss_5880[temp_r28+(32*temp_r27)]++; + } + } + } + return arg0; +} + +void fn_1_83C8(s32 arg0) +{ + s32 temp_r31; + s32 temp_r30; + s32 temp_r29; + s32 temp_r28; + s32 temp_r27; + s32 sp8[9][2] = { + -1,-1, + 0,-1, + 1,-1, + -1,0, + 0,0, + 1,0, + -1,1, + 0,1, + 1,1 + }; + if(arg0 < 0 || arg0 >= 1024) { + return; + } + temp_r28 = arg0%32; + temp_r27 = (arg0-temp_r28)/32; + for(temp_r31=0; temp_r31<9; temp_r31++) { + temp_r30 = temp_r28+sp8[temp_r31][0]; + temp_r29 = temp_r27+sp8[temp_r31][1]; + if(temp_r30 >= 0 && temp_r30 < 32 && temp_r29 >= 0 && temp_r29 < 32) { + lbl_1_bss_5880[temp_r30+(32*temp_r29)]--; + } + } +} + +s32 fn_1_84D0(Work6A88 *arg0) +{ + float temp_f31; + Vec spC; + Bss7480Struct *temp_r31; + s32 temp_r30; + s32 temp_r29; + s32 temp_r28; + temp_r31 = lbl_1_bss_7480; + temp_r28 = 0; + temp_r31 = lbl_1_bss_7480; + for(temp_r29=0; temp_r29<32; temp_r29++, temp_r31++) { + if(temp_r31->unk0 == 0) { + continue; + } + VECSubtract(&temp_r31->unk14, &arg0->unk1C, &spC); + temp_f31 = 1.0f-(VECMag(&spC)/temp_r31->unkC); + if(temp_f31 < 0.3f) { + continue; + } + temp_r30 = 1; + if(temp_r31->unk4) { + temp_r30++; + } + if(temp_r28 < temp_r30) { + temp_r28 = temp_r30; + } + } + return temp_r28; +} + +void fn_1_85C4(Work6A88 *arg0, Vec *arg1) +{ + Vec sp24; + Vec sp18; + Vec spC; + float temp_f31; + float temp_f30; + s32 temp_r31; + s32 temp_r30; + s32 temp_r29; + sp18.x = sp18.y = sp18.z = 0; + temp_f30 = 5000; + sp24.y = 0; + sp24.z = -650; + for(temp_r30=0; temp_r30<32; temp_r30++) { + temp_r31 = 32*temp_r30; + sp24.x = -650; + for(temp_r29=0; temp_r29<32; temp_r29++, temp_r31++) { + if(lbl_1_bss_6480[temp_r31] < 0.15f && lbl_1_bss_6080[temp_r31]) { + VECSubtract(&arg0->unk1C, &sp24, &spC); + temp_f31 = VECMag(&spC); + if(temp_f31 > 81.25f) { + temp_f31 += 162.5f*lbl_1_bss_5880[temp_r31]; + if(temp_f31 < temp_f30) { + temp_f30 = temp_f31; + sp18 = sp24; + } + } + } + sp24.x += (1300.0f/32.0f); + } + sp24.z += (1300.0f/32.0f); + } + sp18.x += ((1300.0f/32000.0f)*frandmod(1000))-(1300.0f/64.0f); + sp18.z += ((1300.0f/32000.0f)*frandmod(1000))-(1300.0f/64.0f); + *arg1 = sp18; +} + +s32 fn_1_8884(Vec *arg0, float arg1, float arg2, float arg3, float arg4, float arg5, s32 arg6, s32 arg7) +{ + float temp_f31; + float temp_f30; + Vec sp24; + Work6A88 *temp_r31; + s32 temp_r30; + s32 temp_r28; + Work6A88 *temp_r23; + temp_r23 = lbl_1_bss_7880->data; + temp_r30 = -1; + temp_r31 = temp_r23; + for(temp_r28=0; temp_r28<20; temp_r28++, temp_r31++) { + if(temp_r31->unk10 == 0) { + continue; + } + VECSubtract(&temp_r31->unk1C, arg0, &sp24); + temp_f30 = VECMag(&sp24); + if(temp_f30 < arg1 || temp_f30 > arg2) { + continue; + } + temp_f31 = atan2d(sp24.x, sp24.z); + temp_f31 = fn_1_67AC(arg3, temp_f31); + if(temp_f31 < arg4 || temp_f31 > arg5) { + continue; + } + temp_r30++; + if(arg6) { + temp_r31->unk14 = 1; + temp_r31->unk10 = 0; + temp_r31->unk4 = 1; + fn_1_83C8(temp_r31->unk18); + temp_r31->unk18 = -1; + temp_r31->unkE = arg7; + HuAudFXPlay(1733); + temp_r30 = temp_r28; + break; + } + + } + if(!arg6) { + temp_r30++; + } + return temp_r30; +} + +void fn_1_8AEC(s16 arg0, Vec *arg1) +{ + Work6A88 *temp_r31; + Work6A88 *temp_r30 = lbl_1_bss_7880->data; + if(arg0 < 0 || arg0 >= 20) { + return; + } + temp_r31 = &temp_r30[arg0]; + temp_r31->unk1C = *arg1; +} + +void fn_1_8B58(s16 arg0) +{ + Work6A88 *temp_r31; + s32 temp_r30; + Work6A88 *temp_r28 = lbl_1_bss_7880->data; + if(arg0 < 0 || arg0 >= 20) { + return; + } + temp_r31 = &temp_r28[arg0]; + temp_r31->unk4 = 2; + temp_r31->unk8 = 0; + if(temp_r31->unk1C.x >= 0.0f) { + temp_r30 = 1; + } else { + temp_r30 = 0; + } + fn_1_1C44(temp_r30, temp_r31->unk0); +} + +void fn_1_8C14(s32 arg0, Vec *arg1, float arg2) +{ + Bss7480Struct *temp_r31; + s32 temp_r30; + temp_r31 = lbl_1_bss_7480; + for(temp_r30=0; temp_r30<32; temp_r30++, temp_r31++) { + if(temp_r31->unk0 && temp_r31->unk8 == arg0) { + temp_r31->unk0 *= 0.8f; + } + } + temp_r31 = lbl_1_bss_7480; + for(temp_r30=0; temp_r30<32; temp_r30++, temp_r31++) { + if(!temp_r31->unk0) { + temp_r31->unk4 = 30; + temp_r31->unk0 = (60.0f*(3.0f*arg2))+150.0f; + temp_r31->unk8 = arg0; + temp_r31->unk14 = *arg1; + temp_r31->unkC = 0; + temp_r31->unk10 = 150.0f+(250.0f*arg2); + break; + } + } +} + +s32 fn_1_8D78(Vec *arg0) +{ + s32 temp_r31; + s32 temp_r30; + s32 temp_r29 = -1; + temp_r31 = (16.0f/650.0f)*(670.3125f+arg0->x); + temp_r30 = (16.0f/650.0f)*(670.3125f+arg0->z); + if(temp_r31 >= 0 && temp_r31 < 32 && temp_r30 >= 0 && temp_r30 < 32) { + temp_r29 = temp_r31+(32*temp_r30); + } + return temp_r29; +} + +s32 fn_1_8E2C(s32 arg0, Vec *arg1) +{ + s32 temp_r31; + s32 temp_r30; + if(arg0 < 0 || arg0 >= 1024) { + arg1->x = arg1->y = arg1->z = 0; + return 0; + } + temp_r31 = arg0%32; + temp_r30 = (arg0-temp_r31)/32; + arg1->x = ((1300.0f/32.0f)*temp_r31)-670.3125f; + arg1->y = 0; + arg1->z = ((1300.0f/32.0f)*temp_r30)-670.3125f; + return 1; +} + +s32 fn_1_8F3C(s32 arg0) +{ + s32 sp8[9][2] = { + -1,-1, + 0,-1, + 1,-1, + -1,0, + 0,0, + 1,0, + -1,1, + 0,1, + 1,1 + }; + if(arg0 < 0 || arg0 >= 1024) { + return 0; + } + return lbl_1_bss_5880[arg0]; +} + +s32 fn_1_8FA0(Vec *arg0) +{ + s32 sp24[9][2] = { + -1,-1, + 0,-1, + 1,-1, + -1,0, + 0,0, + 1,0, + -1,1, + 0,1, + 1,1 + }; + Vec sp18; + Vec spC; + s32 temp_r31; + s32 temp_r30; + s32 temp_r29; + s32 temp_r28; + s32 temp_r27 = -1; + float temp_f31; + float temp_f30 = 5000; + sp18.y = 0; + sp18.z = -650; + for(temp_r31=0; temp_r31<32; temp_r31++) { + temp_r30 = temp_r31*32; + sp18.x = -650; + for(temp_r29=0; temp_r29<32; temp_r29++, temp_r30++) { + temp_r28 = lbl_1_bss_5880[temp_r30]; + if(temp_r28 > 0) { + VECSubtract(arg0, &sp18, &spC); + temp_f31 = VECMag(&spC)+(0.2f*frandmod(1000)); + temp_f31 -= 50.0f*temp_r28; + if(temp_f31 < temp_f30) { + temp_f30 = temp_f31; + temp_r27 = temp_r30; + } + } + sp18.x += (1300.0f/32.0f); + } + sp18.z += (1300.0f/32.0f); + } + return temp_r27; +} \ No newline at end of file diff --git a/src/REL/m434Dll/main.c b/src/REL/m434Dll/main.c index bbd39128..dbffb236 100644 --- a/src/REL/m434Dll/main.c +++ b/src/REL/m434Dll/main.c @@ -610,7 +610,7 @@ s32 fn_1_1D74(s32 arg0) return lbl_1_bss_3A0[arg0]; } -s16 fn_1_1D8C(void) +s32 fn_1_1D8C(void) { return lbl_1_bss_3AA; } diff --git a/src/REL/m434Dll/player.c b/src/REL/m434Dll/player.c new file mode 100644 index 00000000..7d1988e9 --- /dev/null +++ b/src/REL/m434Dll/player.c @@ -0,0 +1,676 @@ +#include "game/object.h" +#include "game/objsub.h" +#include "game/hsfman.h" +#include "game/hsfmotion.h" +#include "game/audio.h" +#include "game/wipe.h" +#include "game/chrman.h" +#include "game/pad.h" + +#include "game/minigame_seq.h" +#include "game/gamework_data.h" +#include "REL/m434Dll.h" +#include "math.h" +#include "ext_math.h" + +typedef struct data_224_struct { + u16 unk0; + u16 unk2; + float unk4; + float unk8; + u32 unkC; +} Data224Struct; + +omObjData *lbl_1_bss_5870[4]; + +char *lbl_1_data_190[8] = { + "dmy-itemhook-r", + "dmy-itemhook-r", + "dmy-itemhook-r", + "dmy-itemhook-r", + "dmy-itemhook-r", + "dmy-itemhook-r", + "dmy-itemhook-r", + "dmy-itemhook-r", +}; + +char *lbl_1_data_1BC[8] = { + "itemhook-r", + "itemhook-r", + "itemhook-r", + "itemhook-r", + "itemhook-r", + "itemhook-r", + "itemhook-r", + "itemhook-r", +}; + +s32 lbl_1_data_1DC[2] = { + 0x410003, + 0x410004 +}; + +Vec lbl_1_data_1E4[2] = { + { -550, 0, 550 }, + { 550, 0, 550 } +}; + +u32 lbl_1_data_1FC[10] = { + 0, + 2, + 23, + 133, + 0x41000E, + 0x410016, + 0x41001E, + 0x410026, + 0x41002E, + 0x410036 +}; + +Data224Struct lbl_1_data_224[9] = { + { 0, 4, 12, 0, 0x40000001 }, + { 1, 6, 6, 0, 0x40000001 }, + { 0, 8, 6, 0, 0 }, + { 0, 5, 6, 0, 0x40000001 }, + { 1, 5, 6, 0, 0x40000001 }, + { 0, 8, 6, 30, 0 }, + { 0, 9, 6, 0, 0 }, + { 2, 0, 12, 0, 0 }, + { 3, 0, 12, 0, 0 }, +}; + +void fn_1_4988(omObjData *object); + +void fn_1_4854(Process *objman) +{ + s16 temp_r31; + omObjData *temp_r30; + s16 temp_r29; + s32 sp8[2] = { 0, 0 }; + omMakeGroupEx(objman, 0, 4); + omGetGroupMemberListEx(objman, 0); + for(temp_r31=0; temp_r31<4; temp_r31++) { + temp_r30 = lbl_1_bss_5870[temp_r31] = omAddObjEx(objman, 40, 2, 10, 0, fn_1_4988); + temp_r30->work[0] = temp_r31; + temp_r29 = fn_1_1D74(temp_r31); + temp_r30->work[1] = (temp_r29*2)+sp8[temp_r29]; + sp8[temp_r29]++; + } +} + +void fn_1_4964(void) +{ + CharModelKill(-1); +} + +typedef struct work_4988 { + s32 unk0; + s32 unk4; + s32 unk8; + s32 unkC; + s32 unk10; + u32 unk14; + u32 unk18; + float unk1C; + float unk20; + s32 unk24; + Vec unk28; + float unk34; + u16 unk38; + s16 unk3A; + s16 unk3C; + s16 unk3E; + float unk40; + float unk44; + float unk48; + float unk4C; + float unk50; + s32 unk54; + s16 unk58[3]; + s32 unk60; + float unk64; + s32 unk68; + u16 unk6C; + s32 unk70; + Vec unk74; + s16 unk80; + float unk84; + Vec unk88; + Vec unk94; +} Work4988; + +void fn_1_4DF4(omObjData *object); +void fn_1_60AC(omObjData *arg0, u32 arg1); + +void fn_1_4988(omObjData *object) +{ + Work4988 *temp_r31; + s16 temp_r29; + s32 temp_r28; + s32 temp_r27; + + float sp1C[4] = { 0.5f, 0.65f, 0.8f, 1.0f }; + s32 spC[4] = { 1, 1, 2, 2 }; + s32 sp8; + object->data = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(Work4988), MEMORY_DEFAULT_NUM); + temp_r31 = object->data; + memset(temp_r31, 0, sizeof(Work4988)); + temp_r27 = object->work[0]; + temp_r28 = GWPlayerCfg[temp_r27].character; + temp_r31->unk8 = temp_r28; + sp8 = temp_r31->unkC = 0; + temp_r31->unk0 = (object->work[1] >> 1) & 0x1; + temp_r31->unk4 = object->work[1] & 0x1; + temp_r31->unk6C = 0; + temp_r31->unk64 = sp1C[GWPlayerCfg[temp_r27].diff & 0x3]; + temp_r31->unk68 = spC[GWPlayerCfg[temp_r27].diff & 0x3]; + object->model[0] = CharModelCreate(temp_r28, 8); + CharModelStepTypeSet(temp_r28, 3); + Hu3DModelCameraSet(object->model[0], 4); + Hu3DModelLayerSet(object->model[0], 4); + object->model[1] = Hu3DModelCreateFile(lbl_1_data_1DC[temp_r31->unk0]); + Hu3DModelCameraSet(object->model[1], 4); + Hu3DModelLayerSet(object->model[1], 4); + Hu3DModelHookSet(object->model[0], lbl_1_data_190[temp_r31->unkC], object->model[1]); + Hu3DModelClusterAttrSet(object->model[1], 0, 0xC0000001); + for(temp_r29=0; temp_r29<10; temp_r29++) { + if(lbl_1_data_1FC[temp_r29] < 0x10000) { + object->motion[temp_r29] = CharModelMotionCreate(temp_r28, lbl_1_data_1FC[temp_r29]); + } else { + object->motion[temp_r29] = Hu3DJointMotionFile(object->model[0], temp_r28+lbl_1_data_1FC[temp_r29]); + } + } + CharModelMotionDataClose(temp_r28); + object->trans.x = temp_r31->unk88.x = ((2.0f*object->work[1])*100.0f)-300.0f; + object->trans.y = temp_r31->unk88.y = -70; + object->trans.z = temp_r31->unk88.z = 0; + temp_r31->unk94.x = temp_r31->unk94.y = temp_r31->unk94.z = 0; + temp_r31->unk40 = temp_r31->unk44 = 0; + temp_r31->unk48 = 0; + temp_r31->unk4C = 0.02f; + temp_r31->unk84 = 55; + temp_r31->unk28 = lbl_1_data_1E4[temp_r31->unk0]; + temp_r31->unk28.y = object->trans.y; + temp_r31->unk34 = 400; + temp_r31->unk54 = 0; + for(temp_r29=0; temp_r29<3; temp_r29++) { + temp_r31->unk58[temp_r29] = -1; + } + temp_r31->unk50 = 0; + temp_r31->unk10 = -1; + temp_r31->unk60 = 0; + fn_1_60AC(object, 0); + temp_r31->unk38 = 0; + object->func = fn_1_4DF4; +} + +void fn_1_4E50(omObjData *object); +void fn_1_5BEC(omObjData *object); + +void fn_1_4DF4(omObjData *object) +{ + Work4988 *temp_r31 = object->data; + fn_1_5BEC(object); + temp_r31->unk3C++; + temp_r31->unk38 = 0; + object->func = fn_1_4E50; +} + +void fn_1_5AB0(omObjData *object); + +void fn_1_5C98(omObjData *object); +void fn_1_64C0(omObjData *object); + +float fn_1_67AC(float arg0, float arg1); + +//Issues with assignment of temp_f30 +//Scratch is at https://decomp.me/scratch/EqCuG +void fn_1_4E50(omObjData *object) +{ + float temp_f31; + float temp_f30; + float temp_f28; + Work4988 *temp_r31 = object->data; + + s32 temp_r29; + s32 temp_r28; + s32 temp_r27 = 0; + Mtx sp2C; + Vec sp20; + char *sp14[3] = { + "f0", + "f1", + "f2" + }; + float spC[2] = { 0.05, 0.02 }; + temp_r31->unk14 = 0; + temp_r31->unk18 = 0; + temp_r31->unk20 = 0; + temp_r31->unk1C = 0; + if(fn_1_1D54() == 2) { + if(GWPlayerCfg[object->work[0]].iscom) { + fn_1_5C98(object); + } else { + temp_r31->unk18 = HuPadBtn[GWPlayerCfg[object->work[0]].pad_idx]; + temp_r31->unk14 = HuPadBtnDown[GWPlayerCfg[object->work[0]].pad_idx]; + temp_f31 = HuPadStkX[GWPlayerCfg[object->work[0]].pad_idx]; + temp_f30 = -HuPadStkY[GWPlayerCfg[object->work[0]].pad_idx]; + + temp_r31->unk20 = atan2d(temp_f31, temp_f30); + temp_r31->unk1C = (1.0f/72.0f)*VECMagPoint(temp_f31, temp_f30, 0); + if(temp_r31->unk1C > 1.0f) { + temp_r31->unk1C = 1.0f; + } + } + } + temp_r31->unk60 = 0; + switch(temp_r31->unk38) { + case 0: + temp_r27 = 1; + if(temp_r31->unk1C > spC[temp_r31->unk24]) { + temp_r31->unk24 = 1; + temp_r31->unk44 = temp_r31->unk20; + temp_r31->unk94.x += 225.0f*(temp_r31->unk1C*sind(temp_r31->unk20))*(1.0f/60.0f); + temp_r31->unk94.z += 225.0f*(temp_r31->unk1C*cosd(temp_r31->unk20))*(1.0f/60.0f); + temp_r31->unk48 = 0.2f; + temp_r31->unk4C = 0; + if(CharModelMotionShiftIDGet(temp_r31->unk8) < 0) { + fn_1_60AC(object, 1); + CharModelMotionSpeedSet(temp_r31->unk8, temp_r31->unk1C); + } + if(temp_r31->unk1C > 0.75f && (temp_r31->unk3A & 0x7) == 0) { + fn_1_8C14(object->work[0], &temp_r31->unk88, temp_r31->unk1C); + if((temp_r31->unk3A & 0xF) == 0) { + fn_1_43AC(&temp_r31->unk88); + } + } + } else { + temp_r31->unk24 = 0; + if(CharModelMotionShiftIDGet(temp_r31->unk8) < 0) { + fn_1_60AC(object, 0); + } + } + if(temp_r31->unk14 & PAD_BUTTON_A) { + temp_r31->unk38 = 1; + temp_r31->unk3C = 0; + } else if(temp_r31->unk14 & PAD_BUTTON_B) { + temp_r31->unk38 = 3; + temp_r31->unk3C = 0; + temp_r31->unk3A = 0; + } else { + temp_r31->unk60 = 1; + } + break; + + case 1: + temp_r31->unk24 = 0; + if(temp_r31->unk3C == 0) { + fn_1_60AC(object, 2); + temp_r31->unk3A = 0; + temp_r31->unk3C++; + } else if(temp_r31->unk3C == 1 && temp_r31->unk3A > 30.0f) { + if(temp_r31->unk54 < 3) { + temp_r28 = fn_1_8884(&temp_r31->unk88, 20, 150, temp_r31->unk40, -30, 30, 1, object->work[0]); + if(temp_r28 >= 0) { + temp_r31->unk58[temp_r31->unk54++] = temp_r28; + omVibrate(object->work[0], 12, 6, 6); + } + } + temp_r31->unk38 = 2; + temp_r31->unk3A = 0; + temp_r31->unk3C = 0; + } + break; + + case 2: + if(temp_r31->unk3C == 0) { + if(!(temp_r31->unk18 & PAD_BUTTON_A)) { + temp_r31->unk24 = 0; + fn_1_60AC(object, 5); + temp_r31->unk3A = 0; + temp_r31->unk3C++; + } else { + temp_f28 = fn_1_67AC(temp_r31->unk40, temp_r31->unk20); + if(temp_f28 > 10.0f) { + temp_f28 = 10.0f; + } else if(temp_f28 < -10.0f) { + temp_f28 = -10.0f; + } + if(temp_r31->unk1C > spC[temp_r31->unk24] && fabs(temp_f28) > 5.0) { + temp_r31->unk24 = 1; + temp_r31->unk44 = temp_r31->unk40+temp_f28; + temp_r31->unk48 = 0.2f; + temp_r31->unk4C = 0; + if(CharModelMotionShiftIDGet(temp_r31->unk8) < 0) { + fn_1_60AC(object, 4); + CharModelMotionSpeedSet(temp_r31->unk8, 0.5f); + } + if(temp_r31->unk54 < 3) { + temp_r28 = fn_1_8884(&temp_r31->unk88, 20, 150, temp_r31->unk40, -15, 15, 1, object->work[0]); + if(temp_r28 >= 0) { + temp_r31->unk58[temp_r31->unk54++] = temp_r28; + omVibrate(object->work[0], 12, 6, 6); + } + } + } else { + temp_r31->unk24 = 0; + if(CharModelMotionShiftIDGet(temp_r31->unk8) < 0) { + fn_1_60AC(object, 3); + } + } + } + } else { + if(temp_r31->unk3A > 30.0f) { + temp_r31->unk38 = 0; + } + } + break; + + case 3: + temp_r31->unk24 = 0; + if(temp_r31->unk3C == 0) { + temp_r31->unk3E = 0; + VECSubtract(&temp_r31->unk28, &temp_r31->unk88, &sp20); + temp_r31->unk44 = atan2d(sp20.x, sp20.z); + temp_f28 = VECMag(&sp20); + if(temp_f28 < temp_r31->unk34) { + temp_r31->unk3E++; + fn_1_60AC(object, 6); + } else { + fn_1_60AC(object, 0); + } + temp_r31->unk3A = 0; + temp_r31->unk3C++; + } + if(temp_r31->unk3E) { + if(temp_r31->unk3A > 36.0f) { + for(temp_r29=0; temp_r29unk54; temp_r29++) { + fn_1_8B58(temp_r31->unk58[temp_r29]); + } + temp_r31->unk54 = 0; + temp_r31->unk3E = 0; + } + } + if(temp_r31->unk3A > 60.0f) { + temp_r31->unk38 = 0; + } + break; + } + VECAdd(&temp_r31->unk88, &temp_r31->unk94, &temp_r31->unk88); + temp_r31->unk94.x = temp_r31->unk94.y = temp_r31->unk94.z = 0; + fn_1_64C0(object); + temp_f28 = 0; + if(temp_r31->unk54) { + temp_f28 = (temp_r31->unk54*10)+10; + } + temp_r31->unk50 += (temp_f28-temp_r31->unk50)*0.3f; + Hu3DData[object->model[1]].unk_A4[0] = temp_r31->unk50; + Hu3DModelObjMtxGet(object->model[0], lbl_1_data_190[temp_r31->unkC], sp2C); + for(temp_r29=0; temp_r29unk54; temp_r29++) { + Hu3DModelObjPosGet(object->model[1], sp14[temp_r29], &sp20); + MTXMultVec(sp2C, &sp20, &sp20); + fn_1_8AEC(temp_r31->unk58[temp_r29], &sp20); + } + fn_1_5BEC(object); + if(fn_1_1D54() == 5 && temp_r27) { + temp_r31->unk38 = 0; + object->func = fn_1_5AB0; + } +} + +s32 fn_1_6248(omObjData *object); + +void fn_1_5AB0(omObjData *object) +{ + Work4988 *temp_r31 = object->data; + s32 sp8[2] = { -1, 1 }; + fn_1_5BEC(object); + switch(temp_r31->unk38) { + case 0: + temp_r31->unk38++; + break; + + case 1: + Hu3DModelHookReset(object->model[0]); + Hu3DModelAttrSet(object->model[1], 1); + if(sp8[temp_r31->unk0] == fn_1_1D8C()) { + fn_1_60AC(object, 7); + } else { + fn_1_60AC(object, 8); + } + temp_r31->unk44 = 0; + temp_r31->unk48 = 0; + temp_r31->unk4C = 0.005f; + temp_r31->unk38++; + break; + + case 2: + if(fn_1_6248(object)) { + temp_r31->unk38++; + } + break; + } +} + +float fn_1_6690(float arg0, float arg1, float arg2); + +void fn_1_5BEC(omObjData *object) +{ + Work4988 *temp_r31 = object->data; + temp_r31->unk3A++; + object->trans.x = temp_r31->unk88.x; + object->trans.y = temp_r31->unk88.y; + object->trans.z = temp_r31->unk88.z; + temp_r31->unk48 += temp_r31->unk4C; + if(temp_r31->unk48 > 0.45f) { + temp_r31->unk48 = 0.45f; + } + temp_r31->unk40 = fn_1_6690(temp_r31->unk40, temp_r31->unk44, temp_r31->unk48); + object->rot.y = temp_r31->unk40; +} + +void fn_1_5C98(omObjData *object) +{ + Vec sp8; + Work4988 *temp_r31 = object->data; + s32 temp_r30; + s32 temp_r29 = 0; + s32 temp_r28; + switch(temp_r31->unk6C) { + case 0: + if(temp_r31->unk60) { + temp_r31->unk70 = fn_1_8FA0(&temp_r31->unk88); + if(temp_r31->unk70 < 0 || temp_r31->unk54 >= temp_r31->unk68 || fn_1_1D44() < 10) { + temp_r29 = 1; + } + if(temp_r31->unk54 && temp_r29) { + temp_r31->unk6C = 3; + temp_r31->unk80 = 0; + } else if(temp_r31->unk70 >= 0) { + temp_r31->unk6C = 1; + temp_r31->unk80 = 0; + fn_1_8E2C(temp_r31->unk70, &temp_r31->unk74); + temp_r31->unk74.y = temp_r31->unk88.y; + } + } + break; + + case 1: + temp_r31->unk1C = 0.73f*temp_r31->unk64; + if(temp_r31->unk54 && fn_1_1D44() < 10) { + temp_r31->unk6C = 0; + } else { + temp_r28 = fn_1_8D78(&temp_r31->unk88); + if(fn_1_8F3C(temp_r28) > 0) { + temp_r31->unk6C = 2; + temp_r31->unk80 = 0; + } else { + VECSubtract(&temp_r31->unk74, &temp_r31->unk88, &sp8); + temp_r31->unk20 = fn_1_6690(temp_r31->unk40, atan2d(sp8.x, sp8.z), temp_r31->unk64*0.25f); + temp_r30 = 0; + if(VECMag(&sp8) < 50.0f) { + temp_r30 = 1; + } + if(temp_r30 && fn_1_8F3C(temp_r31->unk70) > 0) { + temp_r31->unk6C = 2; + temp_r31->unk80 = 0; + } else { + temp_r31->unk80++; + if(temp_r30 || temp_r31->unk80 > 60.0f) { + if(temp_r30 || frandmod(1000) < 10) { + temp_r31->unk70 = fn_1_8FA0(&temp_r31->unk88); + fn_1_8E2C(temp_r31->unk70, &temp_r31->unk74); + temp_r31->unk74.y = temp_r31->unk88.y; + temp_r31->unk80 = 0; + if(temp_r31->unk70 < 0) { + temp_r31->unk6C = 0; + } + } + } + } + } + } + break; + + case 2: + temp_r31->unk80++; + if(temp_r31->unk80 < 120*temp_r31->unk64) { + temp_r31->unk1C = 0.4f; + temp_r31->unk20 = temp_r31->unk40+10.0f; + temp_r31->unk14 = temp_r31->unk18 = PAD_BUTTON_A; + } else { + temp_r31->unk6C = 0; + } + break; + + case 3: + temp_r31->unk1C = 0.75f+(0.25f*temp_r31->unk64); + VECSubtract(&temp_r31->unk28, &temp_r31->unk88, &sp8); + temp_r31->unk20 = fn_1_6690(temp_r31->unk40, atan2d(sp8.x, sp8.z), 0.2f); + if(VECMag(&sp8) < temp_r31->unk34-30.000002f) { + temp_r31->unk14 = temp_r31->unk18 = PAD_BUTTON_B; + temp_r31->unk6C = 0; + } + break; + } +} + +void fn_1_60AC(omObjData *arg0, u32 arg1) +{ + float temp_f31; + Work4988 *temp_r30 = arg0->data; + if(temp_r30->unk10 != arg1 && arg1 < 9) { + temp_f31 = lbl_1_data_224[arg1].unk4; + if(temp_r30->unk10 < 0) { + temp_f31 = 0; + } + temp_r30->unk10 = arg1; + CharModelMotionShiftSet(temp_r30->unk8, arg0->motion[lbl_1_data_224[arg1].unk0], 0, temp_f31, lbl_1_data_224[arg1].unkC); + CharModelMotionSpeedSet(temp_r30->unk8, 1.0f); + if(lbl_1_data_224[arg1].unk2) { + Hu3DMotionOverlaySet(arg0->model[0], arg0->motion[lbl_1_data_224[arg1].unk2]); + Hu3DMotionOverlayTimeSet(arg0->model[0], lbl_1_data_224[arg1].unk8); + Hu3DData[arg0->model[0]].unk_78 = 1.0f; + } else { + Hu3DMotionOverlayReset(arg0->model[0]); + } + } +} + +s32 fn_1_6248(omObjData *object) +{ + Work4988 *temp_r31 = object->data; + s32 temp_r30 = 0; + if(CharModelMotionEndCheck(temp_r31->unk8) && CharModelMotionShiftIDGet(temp_r31->unk8) < 0) { + temp_r30 = 1; + } + return temp_r30; +} + +s32 fn_1_62BC(omObjData *arg0, u32 arg1) +{ + s32 result = 0; + if(fn_1_6248(arg0)) { + fn_1_60AC(arg0, arg1); + result = 1; + } + return result; +} + +s32 fn_1_649C(omObjData *object) +{ + Work4988 *sp8 = object->data; + s32 temp_r31 = 0; + return temp_r31; +} + + +void fn_1_64C0(omObjData *object) +{ + float temp_f31; + Vec sp8; + Work4988 *temp_r31; + Work4988 *temp_r30; + s32 temp_r29; + s32 temp_r28; + s32 temp_r27; + for(temp_r27=0; temp_r27<2; temp_r27++) { + for(temp_r29=0; temp_r29<4; temp_r29++) { + temp_r31 = lbl_1_bss_5870[temp_r29]->data; + for(temp_r28=0; temp_r28<4; temp_r28++) { + if(temp_r29 == temp_r28) { + continue; + } + temp_r30 = lbl_1_bss_5870[temp_r28]->data; + VECSubtract(&temp_r31->unk88, &temp_r30->unk88, &sp8); + temp_f31 = VECMag(&sp8); + if(temp_f31 < temp_r31->unk84+temp_r30->unk84) { + temp_f31 = 0.5f*((temp_r31->unk84+temp_r30->unk84)-temp_f31); + VECNormalize(&sp8, &sp8); + VECScale(&sp8, &sp8, temp_f31); + VECAdd(&temp_r31->unk88, &sp8, &temp_r31->unk88); + VECSubtract(&temp_r30->unk88, &sp8, &temp_r30->unk88); + } + } + sp8 = temp_r31->unk88; + sp8.y = 0; + temp_f31 = VECMag(&sp8); + if(temp_f31 > 510.0f-temp_r31->unk84) { + VECNormalize(&sp8, &sp8); + VECScale(&sp8, &sp8, -(temp_f31-(510.0f-temp_r31->unk84))); + VECAdd(&sp8, &temp_r31->unk88, &temp_r31->unk88); + } + } + } +} + +float fn_1_6690(float arg0, float arg1, float arg2) +{ + float temp_f31; + temp_f31 = fmodf(arg1-arg0, 360.0); + if(temp_f31 < 0.0f) { + temp_f31 += 360.0f; + } + if(temp_f31 > 180.0f) { + temp_f31 -= 360.0f; + } + temp_f31 = fmodf((arg2*temp_f31)+arg0, 360.0); + if(temp_f31 < 0.0f) { + temp_f31 += 360.0f; + } + return temp_f31; +} + +float fn_1_67AC(float arg0, float arg1) +{ + float temp_f31; + temp_f31 = fmodf(arg1-arg0, 360.0); + if(temp_f31 < 0.0f) { + temp_f31 += 360.0f; + } + if(temp_f31 > 180.0f) { + temp_f31 -= 360.0f; + } + return temp_f31; +} \ No newline at end of file diff --git a/src/REL/modeseldll/modesel.c b/src/REL/modeseldll/modesel.c index f1032d6a..115c17e3 100644 --- a/src/REL/modeseldll/modesel.c +++ b/src/REL/modeseldll/modesel.c @@ -116,8 +116,8 @@ s32 fn_1_2490(void) Hu3DModelPosSet(lbl_1_bss_19A[lbl_1_data_80[temp_r31]], 0, -50, 0); } HuWinMesWait(lbl_1_bss_82); - temp_r26 = 0; - lbl_1_bss_80 = temp_r26; + + lbl_1_bss_80 = temp_r26 = 0; espAttrReset(lbl_1_bss_152[10], HUSPR_ATTR_DISPOFF); espBankSet(lbl_1_bss_152[10], 0); for(temp_r31=0; temp_r31<=10; temp_r31++) {