From af7c7a006433a7c5c321ffc8a4195064bfbf3951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Balatoni?= <40299962+dbalatoni13@users.noreply.github.com> Date: Wed, 16 Apr 2025 06:04:54 +0200 Subject: [PATCH] Fix includes, hsfload, mess, update aurora (#584) * Fix REL includes till mgmodedll * hsfload fixes * update aurora, fixups * Minor tweaks * update aurora * Mess byteswapping and comment out 3D render code --- CMakeLists.txt | 2 +- extern/aurora | 2 +- include/REL/m407dll.h | 4 + include/REL/m410Dll.h | 5 + include/REL/m415Dll.h | 6 ++ include/REL/m424Dll.h | 8 +- include/REL/m434Dll.h | 3 + include/REL/m440Dll.h | 1 + include/REL/m446Dll.h | 1 + include/game/hsfdraw.h | 2 +- include/game/hsfformat.h | 3 +- include/game/hsfman.h | 3 + include/port/byteswap.h | 32 +++++- src/REL/E3setupDLL/main.c | 4 + src/REL/E3setupDLL/mgselect.c | 7 ++ src/REL/m402Dll/main.c | 5 + src/REL/m406Dll/main.c | 1 + src/REL/m406Dll/player.c | 5 + src/REL/m407dll/map.c | 4 - src/REL/m407dll/player.c | 8 +- src/REL/m407dll/score.c | 14 +-- src/REL/m407dll/whomp.c | 14 +-- src/REL/m407dll/whomp_score.c | 14 +-- src/REL/m408Dll/camera.c | 33 +++---- src/REL/m408Dll/main.c | 181 ++++++++++++++++------------------ src/REL/m408Dll/object.c | 22 ++--- src/REL/m408Dll/stage.c | 31 +++--- src/REL/m409Dll/cursor.c | 2 +- src/REL/m409Dll/player.c | 7 +- src/REL/m410Dll/main.c | 5 +- src/REL/m410Dll/player.c | 4 +- src/REL/m411Dll/main.c | 5 +- src/REL/m412Dll/main.c | 1 - src/REL/m414Dll/main.c | 4 + src/REL/m415Dll/main.c | 1 - src/REL/m415Dll/map.c | 5 +- src/REL/m416Dll/main.c | 2 +- src/REL/m416Dll/map.c | 4 - src/REL/m417Dll/main.c | 7 +- src/REL/m417Dll/player.c | 6 +- src/REL/m417Dll/water.c | 18 +--- src/REL/m418Dll/main.c | 60 ++++------- src/REL/m419Dll/main.c | 5 +- src/REL/m420dll/camera.c | 3 - src/REL/m420dll/main.c | 3 +- src/REL/m420dll/map.c | 4 + src/REL/m420dll/player.c | 42 +------- src/REL/m421Dll/main.c | 2 - src/REL/m422Dll/main.c | 5 +- src/REL/m423Dll/main.c | 8 +- src/REL/m424Dll/ball.c | 4 +- src/REL/m424Dll/claw.c | 13 ++- src/REL/m424Dll/map.c | 4 +- src/REL/m425Dll/main.c | 18 +--- src/REL/m425Dll/thwomp.c | 8 -- src/REL/m426Dll/main.c | 8 +- src/REL/m427Dll/main.c | 6 +- src/REL/m427Dll/map.c | 20 +--- src/REL/m427Dll/player.c | 33 +------ src/REL/m428Dll/main.c | 3 - src/REL/m428Dll/map.c | 13 --- src/REL/m428Dll/player.c | 6 -- src/REL/m429Dll/main.c | 34 ++++--- src/REL/m430Dll/main.c | 9 -- src/REL/m430Dll/player.c | 34 ++----- src/REL/m430Dll/water.c | 11 --- src/REL/m431Dll/main.c | 2 + src/REL/m431Dll/object.c | 7 +- src/REL/m432Dll/main.c | 40 +------- src/REL/m433Dll/main.c | 4 - src/REL/m433Dll/map.c | 8 -- src/REL/m433Dll/player.c | 7 -- src/REL/m434Dll/fish.c | 8 +- src/REL/m434Dll/map.c | 5 - src/REL/m434Dll/player.c | 13 ++- src/REL/m435Dll/main.c | 7 ++ src/REL/m436Dll/main.c | 6 ++ src/REL/m437Dll/main.c | 6 +- src/REL/m438Dll/fire.c | 35 +++---- src/REL/m438Dll/main.c | 34 +------ src/REL/m438Dll/map.c | 11 ++- src/REL/m439Dll/main.c | 7 ++ src/REL/m440Dll/main.c | 8 +- src/REL/m440Dll/object.c | 34 +------ src/REL/m441Dll/main.c | 7 +- src/REL/m442Dll/main.c | 35 +------ src/REL/m443Dll/main.c | 3 - src/REL/m443Dll/player.c | 10 +- src/REL/m444dll/main.c | 2 +- src/REL/m444dll/pinball.c | 8 +- src/REL/m444dll/shadow.c | 2 - src/REL/m445Dll/main.c | 2 +- src/REL/m446Dll/camera.c | 1 - src/REL/m446Dll/card.c | 8 +- src/REL/m446Dll/cursor.c | 2 +- src/REL/m446Dll/deck.c | 4 +- src/REL/m446Dll/main.c | 7 +- src/REL/m446Dll/player.c | 6 +- src/REL/m446Dll/stage.c | 2 +- src/REL/m446Dll/table.c | 3 +- src/REL/m447dll/main.c | 9 ++ src/REL/m447dll/player.c | 1 + src/REL/m448Dll/main.c | 4 +- src/REL/m449Dll/main.c | 12 --- src/REL/m450Dll/main.c | 41 +------- src/REL/m451Dll/m451.c | 4 + src/REL/m453Dll/main.c | 18 ---- src/REL/m453Dll/map.c | 8 +- src/REL/m453Dll/score.c | 10 -- src/REL/m455Dll/main.c | 1 + src/REL/m455Dll/stage.c | 6 -- src/REL/m456Dll/stage.c | 11 +-- src/REL/m458Dll/main.c | 2 - src/REL/m459dll/main.c | 7 -- src/REL/m460Dll/main.c | 2 - src/REL/m460Dll/map.c | 1 - src/REL/m460Dll/score.c | 3 - src/REL/m463Dll/main.c | 2 + src/REL/messDll/main.c | 1 - src/REL/mgmodedll/battle.c | 7 +- src/REL/mgmodedll/free_play.c | 1 - src/REL/w03Dll/condor.c | 2 +- src/dolphin/mtx/mtx.c | 4 +- src/game/ClusterExec.c | 6 +- src/game/EnvelopeExec.c | 8 +- src/game/armem.c | 42 ++++++-- src/game/data.c | 9 +- src/game/hsfdraw.c | 14 ++- src/game/hsfload.c | 68 ++++++++++--- src/game/hsfman.c | 12 +-- src/game/messdata.c | 54 ++++++++-- src/game/sprput.c | 7 +- src/game/window.c | 17 ++-- src/port/audio.c | 2 +- src/port/byteswap.cpp | 86 ++++++++++++++-- 135 files changed, 742 insertions(+), 926 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 166e7fee..51bc4561 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,7 +150,7 @@ endif () add_library(dol SHARED ${DOLPHIN_FILES} ${GAME_FILES} ${PORT_FILES}) target_compile_definitions(dol PRIVATE TARGET_PC NON_MATCHING TARGET_DOL VERSION=${VERSION} MUSY_VERSION_MAJOR=1 MUSY_VERSION_MINOR=5 MUSY_VERSION_PATCH=4) target_include_directories(dol PRIVATE include build/GMPE01_00/include) -target_link_libraries(dol PRIVATE aurora::core aurora::gx aurora::vi musyx) +target_link_libraries(dol PRIVATE aurora::core aurora::gx aurora::si aurora::vi aurora::pad musyx) if (MSVC) if (CMAKE_SIZEOF_VOID_P EQUAL 8) enable_language(ASM_MASM) diff --git a/extern/aurora b/extern/aurora index a18cdf3b..357ecba0 160000 --- a/extern/aurora +++ b/extern/aurora @@ -1 +1 @@ -Subproject commit a18cdf3b599b482c850096994cef09ba3920851b +Subproject commit 357ecba0ae00246332447823fddd83b8da89357f diff --git a/include/REL/m407dll.h b/include/REL/m407dll.h index 525a406d..9c05763a 100644 --- a/include/REL/m407dll.h +++ b/include/REL/m407dll.h @@ -18,6 +18,9 @@ void fn_1_334(void); void fn_1_388(u8, s32); void fn_1_3C4(u8); void fn_1_404(void); +#ifndef __MWERKS__ +s32 fn_1_4C0(u8 arg0); +#endif s32 fn_1_508(u8); s32 fn_1_53C(u8); void fn_1_568(s16, s16, s16); @@ -37,6 +40,7 @@ void fn_1_2564(void); void fn_1_25C0(void); s32 fn_1_2880(void); #ifndef __MWERKS__ +void fn_1_2770(u8 arg0); s16 fn_1_28B8(u8 arg0); s16 fn_1_28D4(void); #endif diff --git a/include/REL/m410Dll.h b/include/REL/m410Dll.h index ff6a02e1..1a5672b9 100644 --- a/include/REL/m410Dll.h +++ b/include/REL/m410Dll.h @@ -205,6 +205,10 @@ void fn_1_28AC(s32 arg0); s32 fn_1_28DC(void); float fn_1_2FD4(float arg8, float arg9, float argA); float fn_1_30F0(float arg8, float arg9); +void fn_1_31A4(Process *process); +void fn_1_31F8(void); +void fn_1_33A8(Process *objman); +void fn_1_3484(void); s32 fn_1_76B8(Vec arg0, Vec arg1, u16 arg2); void fn_1_77E8(void *arg0); void fn_1_77F8(u16 arg0, Vec *arg1); @@ -213,5 +217,6 @@ void fn_1_7888(u16 arg0, u16 arg1, Vec *arg2); s32 fn_1_79F8(s16 arg0, char *arg1, Mtx arg2); void fn_1_7AC4(HsfObject *arg0, Mtx arg1, char *arg2, Mtx arg3); void fn_1_7E30(Process *objman); +void fn_1_806C(void); #endif diff --git a/include/REL/m415Dll.h b/include/REL/m415Dll.h index c54ce288..00ebc506 100644 --- a/include/REL/m415Dll.h +++ b/include/REL/m415Dll.h @@ -257,6 +257,7 @@ float fn_1_7520(float, float *, float *, float *, s32); void fn_1_7674(float *, Vec *, Vec *, s32); void fn_1_7A54(float, Vec *, float *, Vec *, Vec *, s32); // map.c +void fn_1_8780(s16 arg0, s16 arg1); void fn_1_95C0(ModelData *, Mtx); AnimData **fn_1_9734(s16); void fn_1_9DC8(unkSubStruct2 *); @@ -266,11 +267,16 @@ s16 fn_1_A94C(u32, s16, s16); void fn_1_ACF4(s16, s16, s16, s16, s16, s16); void fn_1_AF48(s16); u8 fn_1_AFC8(s16, u8, s32, s16, s16); +u8 fn_1_B038(s16 arg0, u8 arg1, s32 arg2); s32 fn_1_B0B8(s16, u8, s16); +void fn_1_B634(void); void fn_1_B864(s16, float, float, float); +void fn_1_B8D0(s16 arg0, s16 arg1, f32 arg8, f32 arg9, f32 argA); void fn_1_BB4C(s16, float, float, float); void fn_1_BC9C(s16, float, float, float); void fn_1_BD08(s16, s16, float, float, float); +void fn_1_BE30(s16 arg0, s16 arg1, s32 arg2); +void fn_1_C110(s16 arg0, s16 arg1, u8 arg2, u8 arg3, u8 arg4, u8 arg5); void fn_1_C264(s16, u8); void fn_1_C2D0(s16, s16, u8); void fn_1_C410(s16, s16, u8, u8); diff --git a/include/REL/m424Dll.h b/include/REL/m424Dll.h index ac79d774..02fd6de9 100644 --- a/include/REL/m424Dll.h +++ b/include/REL/m424Dll.h @@ -1,4 +1,5 @@ -#include "dolphin.h" +#ifndef M424DLL_H +#define M424DLL_H #include "game/object.h" @@ -31,6 +32,7 @@ extern M424DllBallStruct2 lbl_1_bss_60[9]; extern u8 lbl_1_bss_58; extern s16 lbl_1_bss_24[4]; +s32 fn_1_FE0(void); float fn_1_1358(float, float); float fn_1_1470(float, float, float); omObjData *fn_1_1AB8(Process *); @@ -42,9 +44,13 @@ void fn_1_2720(Process *); void fn_1_2880(void); Vec *fn_1_8A00(u8); s32 fn_1_8A2C(void); +s32 fn_1_907C(Vec *arg0, Vec *arg1); omObjData *fn_1_93F0(Process *); void fn_1_94A4(void); s32 fn_1_B804(void); s32 fn_1_B888(void); s32 fn_1_B8AC(void); s32 fn_1_B924(void); +void fn_1_C2E0(s32 arg0); + +#endif \ No newline at end of file diff --git a/include/REL/m434Dll.h b/include/REL/m434Dll.h index d83bd084..20130d9f 100644 --- a/include/REL/m434Dll.h +++ b/include/REL/m434Dll.h @@ -6,6 +6,9 @@ void fn_1_1C44(s32 arg0, s32 arg1); s32 fn_1_1C88(s32 arg0); s32 fn_1_1CB8(void); +#ifndef __MWERKS__ +s16 fn_1_1D44(void); +#endif s32 fn_1_1D54(void); void fn_1_1D64(s32 arg0); s32 fn_1_1D74(s32 arg0); diff --git a/include/REL/m440Dll.h b/include/REL/m440Dll.h index 85c35f28..3b853962 100644 --- a/include/REL/m440Dll.h +++ b/include/REL/m440Dll.h @@ -241,6 +241,7 @@ typedef struct _unkObjStruct { float unk68; float unk6C; float unk70; + char unk74[0x4]; } unkObjStruct; #if VERSION_NTSC diff --git a/include/REL/m446Dll.h b/include/REL/m446Dll.h index bdbdadb2..f15f662b 100644 --- a/include/REL/m446Dll.h +++ b/include/REL/m446Dll.h @@ -235,6 +235,7 @@ void fn_1_34A0(unkStruct5 *, unkStruct4 **, s32, s32); s32 m446DeckPushCard(unkStruct5 *, unkStruct4 *, s32); s32 m446DeckPopCard(unkStruct2 **, unkStruct4 **); void fn_1_38B0(unkStruct2 **); +// void fn_1_38E0(u32 arg0); // TODO s32 fn_1_38F0(void); // table.c s32 fn_1_3924(void); diff --git a/include/game/hsfdraw.h b/include/game/hsfdraw.h index 068e5b3c..aca5f1d4 100755 --- a/include/game/hsfdraw.h +++ b/include/game/hsfdraw.h @@ -70,7 +70,7 @@ void Hu3DModelObjMtxGet(s16 arg0, char *arg1, Mtx arg2); void PGObjCall(ModelData *arg0, HsfObject *arg1); void PGObjCalc(ModelData *arg0, HsfObject *arg1); void PGObjReplica(ModelData *arg0, HsfObject *arg1); -HsfObject *Hu3DObjDuplicate(HsfData *arg0, u32 arg1); +HsfObject *Hu3DObjDuplicate(HsfData *arg0, uintptr_t arg1); void Hu3DModelObjDrawInit(void); void Hu3DModelObjDraw(s16 arg0, char *arg1, Mtx arg2); diff --git a/include/game/hsfformat.h b/include/game/hsfformat.h index b1ed6b36..68b317cd 100644 --- a/include/game/hsfformat.h +++ b/include/game/hsfformat.h @@ -277,7 +277,8 @@ typedef struct hsf_object_data { HsfCluster **cluster; u32 cenvCnt; HsfCenv *cenv; - void *file[2]; + HsfVector3f *vtxtop; + HsfVector3f *normtop; } HsfObjectData; typedef struct hsf_camera { diff --git a/include/game/hsfman.h b/include/game/hsfman.h index a8723cc5..6fb6d133 100644 --- a/include/game/hsfman.h +++ b/include/game/hsfman.h @@ -284,6 +284,9 @@ void Hu3DLLightStaticSet(s16, s16, s32); s32 Hu3DModelLightInfoSet(s16, s16); s16 Hu3DLightSet(ModelData *, Mtx *, Mtx *, float); void lightSet(LightData *arg0, s16 arg1, Mtx *arg2, Mtx *arg3, float arg8); +#ifndef __MWERKS__ +void Hu3DReflectMapSet(AnimData* arg0); +#endif void Hu3DReflectNoSet(s16 arg0); void Hu3DFogSet(float, float, u8, u8, u8); void Hu3DFogClear(void); diff --git a/include/port/byteswap.h b/include/port/byteswap.h index 40f9efee..bbdec9a1 100644 --- a/include/port/byteswap.h +++ b/include/port/byteswap.h @@ -156,6 +156,22 @@ typedef struct HsfShape32b { u32 vertex; } HsfShape32b; +typedef struct HsfCenvDual32b { + u32 target1; + u32 target2; + u32 weightCnt; + u32 weight; +} HsfCenvDual32b; + +typedef struct HsfCenvMulti32b { + u32 weightCnt; + u16 pos; + u16 posCnt; + u16 normal; + u16 normalCnt; + u32 weight; +} HsfCenvMulti32b; + typedef struct HsfCenv32b { u32 name; u32 singleData; @@ -200,7 +216,8 @@ typedef struct HsfObjectData32b { u32 cluster; u32 cenvCnt; u32 cenv; - u32 file[2]; + u32 vtxtop; + u32 normtop; } HsfObjectData32b; typedef struct HsfObject32b { @@ -265,6 +282,12 @@ typedef struct HsfFace32b { Vec nbt; } HsfFace32b; +typedef struct HsfMatrix32b { + u32 base_idx; + u32 count; + u32 data; +} HsfMatrix32b; + void byteswap_u16(u16 *src); void byteswap_s16(s16 *src); void byteswap_u32(u32 *src); @@ -285,7 +308,7 @@ void byteswap_hsfattribute(HsfAttribute32b *src, HsfAttribute *dest); void byteswap_hsfmaterial(HsfMaterial32b *src, HsfMaterial *dest); void byteswap_hsfscene(HsfScene *src); void byteswap_hsfbuffer(HsfBuffer32b *src, HsfBuffer *dest); -void byteswap_hsfmatrix(HsfMatrix *src); +void byteswap_hsfmatrix(HsfMatrix32b *src, HsfMatrix *dest); void byteswap_hsfpalette(HsfPalette32b *src, HsfPalette *dest); void byteswap_hsfpart(HsfPart32b *src, HsfPart *dest); void byteswap_hsfbitmap(HsfBitmap32b *src, HsfBitmap *dest); @@ -304,7 +327,6 @@ void byteswap_hsfattribute(HsfAttribute32b *src, HsfAttribute *dest); void byteswap_hsfmaterial(HsfMaterial32b *src, HsfMaterial *dest); void byteswap_hsfscene(HsfScene *src); void byteswap_hsfbuffer(HsfBuffer32b *src, HsfBuffer *dest); -void byteswap_hsfmatrix(HsfMatrix *src); void byteswap_hsfpalette(HsfPalette32b *src, HsfPalette *dest); void byteswap_hsfpart(HsfPart32b *src, HsfPart *dest); void byteswap_hsfbitmap(HsfBitmap32b *src, HsfBitmap *dest); @@ -312,6 +334,10 @@ void byteswap_hsfmapattr(HsfMapAttr32b *src, HsfMapAttr *dest); void byteswap_hsfskeleton(HsfSkeleton32b *src, HsfSkeleton *dest); void byteswap_hsfshape(HsfShape32b *src, HsfShape *dest); void byteswap_hsfcenv_single(HsfCenvSingle *src); +void byteswap_hsfcenv_dual_weight(HsfCenvDualWeight *src); +void byteswap_hsfcenv_dual(HsfCenvDual32b *src, HsfCenvDual *dest); +void byteswap_hsfcenv_multi_weight(HsfCenvMultiWeight *src); +void byteswap_hsfcenv_multi(HsfCenvMulti32b *src, HsfCenvMulti *dest); void byteswap_hsfcenv(HsfCenv32b *src, HsfCenv *dest); void byteswap_hsfobject(HsfObject32b *src, HsfObject *dest); void byteswap_hsfbitmapkey(HsfBitmapKey32b *src, HsfBitmapKey *dest); diff --git a/src/REL/E3setupDLL/main.c b/src/REL/E3setupDLL/main.c index c035cd01..8ad28587 100644 --- a/src/REL/E3setupDLL/main.c +++ b/src/REL/E3setupDLL/main.c @@ -14,6 +14,10 @@ #include "REL/E3SetupDLL.h" +#ifndef __MWERKS__ +void HuSysVWaitSet(s16 vcount); +#endif + static struct { s16 playerCnt; s16 rumble; diff --git a/src/REL/E3setupDLL/mgselect.c b/src/REL/E3setupDLL/mgselect.c index 3c8bb026..9cedbc78 100644 --- a/src/REL/E3setupDLL/mgselect.c +++ b/src/REL/E3setupDLL/mgselect.c @@ -1,4 +1,7 @@ #include "ext_math.h" +#include "game/audio.h" +#include "game/frand.h" +#include "game/gamework.h" #include "game/gamework_data.h" #include "game/hsfman.h" #include "game/init.h" @@ -9,6 +12,10 @@ #include "REL/E3SetupDLL.h" +#ifndef __MWERKS__ +void HuSysVWaitSet(s16 vcount); +#endif + static s16 mgDefault; static omObjData *mgInterfaceObj; static omObjData *mgSelectObj; diff --git a/src/REL/m402Dll/main.c b/src/REL/m402Dll/main.c index 7248188e..8deaf8dc 100755 --- a/src/REL/m402Dll/main.c +++ b/src/REL/m402Dll/main.c @@ -24,6 +24,11 @@ #include "ext_math.h" #include "version.h" +#ifndef __MWERKS__ +#include "game/audio.h" +void HuSysVWaitSet(s16 vcount); +#endif + #undef ABS #define ABS(x) ((0 > (x)) ? -(x) : (x)) diff --git a/src/REL/m406Dll/main.c b/src/REL/m406Dll/main.c index 8642d951..fc6607e5 100644 --- a/src/REL/m406Dll/main.c +++ b/src/REL/m406Dll/main.c @@ -4,6 +4,7 @@ #include "game/gamework_data.h" #include "game/hsfdraw.h" #include "game/minigame_seq.h" +#include "game/objsub.h" #include "game/wipe.h" #include "REL/m406Dll.h" diff --git a/src/REL/m406Dll/player.c b/src/REL/m406Dll/player.c index 9685aac0..ce4f573d 100644 --- a/src/REL/m406Dll/player.c +++ b/src/REL/m406Dll/player.c @@ -12,6 +12,11 @@ #include "REL/m406Dll.h" +#ifndef __MWERKS__ +#include "game/frand.h" +#include "game/hsfex.h" +#endif + typedef struct UnkM406PlayerStruct { /* 0x00 */ float unk_00; /* 0x04 */ float unk_04; diff --git a/src/REL/m407dll/map.c b/src/REL/m407dll/map.c index 4675aa80..fb37b159 100644 --- a/src/REL/m407dll/map.c +++ b/src/REL/m407dll/map.c @@ -64,10 +64,6 @@ void fn_1_15D8(void) void fn_1_162C(omObjData *arg0) { - s32 var_r30; - s32 var_r30_2; - s32 var_r30_3; - s32 var_r30_4; s32 i; arg0->func = fn_1_1A8C; diff --git a/src/REL/m407dll/player.c b/src/REL/m407dll/player.c index 4e649770..d5b9da02 100644 --- a/src/REL/m407dll/player.c +++ b/src/REL/m407dll/player.c @@ -257,7 +257,6 @@ void fn_1_404(void) { omObjData *temp_r31; unkDominationData *unkData; - s32 temp_r0; u8 i; for (i = 0; i < 4; i++) { @@ -330,7 +329,6 @@ void fn_1_628(omObjData *arg0, s32 arg1) void fn_1_64C(omObjData *arg0) { u32 temp_r29; - unkDominationData *temp_r27; unkDominationData *temp_r31; u32 i; @@ -526,10 +524,7 @@ void fn_1_1074(omObjData *arg0) void fn_1_11CC(omObjData *arg0) { - unkDominationData *temp_r31; - s16 temp; - - temp_r31 = arg0->data; + unkDominationData *temp_r31 = arg0->data; if (temp_r31->unk_20 == 0) { CharModelVoiceEnableSet(temp_r31->unk_01, arg0->motion[3], 0); CharModelMotionShiftSet(temp_r31->unk_01, arg0->motion[3], 0.0f, 10.0f, HU3D_MOTATTR_NONE); @@ -543,6 +538,7 @@ void fn_1_11CC(omObjData *arg0) temp_r31->unk_24 += 0.3f; if (!(temp_r31->unk_14 > 300.0f)) { + s16 temp; temp_r31->unk_14 = 300.0f; CharModelVoiceEnableSet(temp_r31->unk_01, arg0->motion[4], 0); CharModelMotionShiftSet(temp_r31->unk_01, arg0->motion[4], 0.0f, 10.0f, HU3D_MOTATTR_NONE); diff --git a/src/REL/m407dll/score.c b/src/REL/m407dll/score.c index 4895ebd8..a289daf2 100644 --- a/src/REL/m407dll/score.c +++ b/src/REL/m407dll/score.c @@ -127,12 +127,9 @@ void fn_1_5FE4(omObjData *arg0) void fn_1_61A0(void) { - s32 i; - unkDominationData6 *temp_r31; - - temp_r31 = lbl_1_bss_3988->data; - + unkDominationData6 *temp_r31 = lbl_1_bss_3988->data; if (temp_r31->unk_04 == 0) { + s32 i; for (i = 0; i < ARRAY_COUNT(temp_r31->unk_0C); i++) { espDispOff(temp_r31->unk_0C[i]); } @@ -142,12 +139,9 @@ void fn_1_61A0(void) void fn_1_6218(void) { - s16 i; - unkDominationData6 *temp_r31; - - temp_r31 = lbl_1_bss_3988->data; - + unkDominationData6 *temp_r31 = lbl_1_bss_3988->data; if (temp_r31->unk_04 == 0) { + s16 i; for (i = 0; i < ARRAY_COUNT(temp_r31->unk_0C); i++) { espDispOn(temp_r31->unk_0C[i]); } diff --git a/src/REL/m407dll/whomp.c b/src/REL/m407dll/whomp.c index a46bd72a..1c13f3b1 100644 --- a/src/REL/m407dll/whomp.c +++ b/src/REL/m407dll/whomp.c @@ -155,7 +155,11 @@ void fn_1_26CC(u8 arg0) } } +#ifdef __MWERKS__ void fn_1_2770(u8 arg0, s16 arg2) +#else +void fn_1_2770(u8 arg0) +#endif { omObjData *temp_r30; unkDominationData7 *temp_r31; @@ -199,15 +203,13 @@ void fn_1_290C(omObjData *arg0, s32 arg1) void fn_1_2930(omObjData *arg0) { - unkDominationData7 *temp_r28; omObjData *temp_r29; u32 i; - unkDominationData7 *temp_r31; - - temp_r31 = arg0->data; + unkDominationData7 *temp_r31 = arg0->data; lbl_1_data_258[temp_r31->unk_24](arg0); if ((temp_r31->unk_08.z > (Center.z - 2000.0f)) && (temp_r31->unk_08.z < (2000.0f + Center.z)) && (temp_r31->unk_04 == 0)) { for (i = 0; i < 8; i++) { + unkDominationData7 *temp_r28; temp_r29 = lbl_1_bss_2DB0[(temp_r31->unk_00 % 80) + (i * 80)]; temp_r29->model[0] = -1; temp_r28 = temp_r29->data; @@ -472,9 +474,7 @@ void fn_1_36D0(omObjData *arg0) void fn_1_37B0(omObjData *arg0) { - unkDominationData7 *temp_r31; - - temp_r31 = arg0->data; + unkDominationData7 *temp_r31 = arg0->data; if (temp_r31->unk_2C == 0) { temp_r31->unk_14.x = 0.0f; temp_r31->unk_08.y = 0.0f; diff --git a/src/REL/m407dll/whomp_score.c b/src/REL/m407dll/whomp_score.c index 1d985246..6ce497bb 100644 --- a/src/REL/m407dll/whomp_score.c +++ b/src/REL/m407dll/whomp_score.c @@ -1,4 +1,5 @@ #include "game/esprite.h" +#include "game/hsfex.h" #include "game/gamework_data.h" #include "game/object.h" #include "game/process.h" @@ -16,7 +17,6 @@ typedef struct unkDominationData3 { } unkDominationData3; // sizeof 0x24 // function signatures -void Hu3D3Dto2D(Vec *arg0, s16 arg1, Vec *arg2); void fn_1_3D28(omObjData *arg0, s32 arg1); void fn_1_3E34(omObjData *); void fn_1_3F7C(omObjData *arg0); @@ -58,17 +58,14 @@ void fn_1_3B68(void) void fn_1_3BB8(s16 arg0, f32 arg8, f32 arg9) { - omObjData *obj; - Vec sp14; - unkDominationData3 *temp_r31; u32 i; - s16 temp; for (i = 0; i < ARRAY_COUNT(lbl_1_bss_37C8); i++) { - obj = lbl_1_bss_37C8[i]; - temp_r31 = obj->data; + omObjData *obj = lbl_1_bss_37C8[i]; + unkDominationData3 *temp_r31 = obj->data; if (temp_r31->unk_04 == 0) { - temp = arg0; + Vec sp14; + s16 temp = arg0; espBankSet(temp_r31->unk_18[1], (temp / 100)); temp = (temp - ((temp / 100) * 100)); espBankSet(temp_r31->unk_18[2], (temp / 10)); @@ -95,7 +92,6 @@ void fn_1_3D28(omObjData *arg0, s32 arg1) void fn_1_3D4C(omObjData *arg0) { - s32 temp_r5; unkDominationData3 *temp_r31; temp_r31 = arg0->data; diff --git a/src/REL/m408Dll/camera.c b/src/REL/m408Dll/camera.c index 370848c4..857d4d27 100644 --- a/src/REL/m408Dll/camera.c +++ b/src/REL/m408Dll/camera.c @@ -1,24 +1,22 @@ +#include "game/audio.h" #include "game/chrman.h" -#include "game/minigame_seq.h" #include "game/object.h" #include "game/objsub.h" -#include "game/pad.h" #include "game/wipe.h" - #include "game/hsfanim.h" -#include "game/hsfdraw.h" #include "game/hsfman.h" #include "game/hsfmotion.h" #include "game/sprite.h" -#include "game/audio.h" -#include "game/gamework_data.h" - #include "REL/m408Dll.h" #include "ext_math.h" #include "math.h" +#ifndef __MWERKS__ +#include "game/frand.h" +#endif + omObjData *lbl_1_bss_110; u32 lbl_1_bss_10C; Vec lbl_1_bss_100; @@ -266,7 +264,6 @@ void fn_1_A4E8(s32 arg0, Vec *arg1, u32 arg2); void fn_1_99C8(omObjData *object) { float temp_f31; - float temp_f30; Vec sp2C; Vec sp20; @@ -282,7 +279,7 @@ void fn_1_99C8(omObjData *object) switch (object->work[0]) { case 0: if (object->work[1] < 120.0f) { - temp_f30 = (1.0f / 60.0f) * (1.5f * (120.0f - object->work[1])); + float temp_f30 = (1.0f / 60.0f) * (1.5f * (120.0f - object->work[1])); if (temp_f30 > 1.0f) { temp_f30 = 1.0f; } @@ -469,13 +466,11 @@ void fn_1_A37C(ModelData *model, ParticleData *particle, Mtx matrix) void fn_1_A4E8(s32 arg0, Vec *arg1, u32 arg2) { - float temp_f31; - HsfanimStruct01 *temp_r31; - ParticleData *temp_r30; - s32 temp_r29; - temp_r30 = Hu3DData[arg0].unk_120; + ParticleData *temp_r30 = Hu3DData[arg0].unk_120; if (temp_r30->unk_00) { - temp_r31 = temp_r30->unk_48; + float temp_f31; + s32 temp_r29; + HsfanimStruct01 *temp_r31 = temp_r30->unk_48; for (temp_r29 = 0; temp_r29 < temp_r30->unk_30; temp_r29++, temp_r31++) { if (temp_r31->unk00 != 0) { continue; @@ -514,7 +509,6 @@ void fn_1_A894(ModelData *model, ParticleData *particle, Mtx matrix) { 600, 1, 0.6, 0.9, 0.3, 0 }, { 13, 1, 1, 1, 0.5, 0 }, }; - Vec sp8; if (particle->unk_00 == 0) { particle->unk_00++; temp_r31 = particle->unk_48; @@ -549,6 +543,7 @@ void fn_1_A894(ModelData *model, ParticleData *particle, Mtx matrix) else { temp_r31 = particle->unk_48; for (temp_r29 = 0; temp_r29 < particle->unk_30; temp_r29++, temp_r31++) { + Vec sp8; if (temp_r31->unk00 == 0) { continue; } @@ -598,9 +593,6 @@ void fn_1_AFF4(ModelData *model, ParticleData *particle, Mtx matrix) float temp_f30; HsfanimStruct01 *temp_r30; s32 temp_r29; - Vec sp20; - Vec sp14; - Vec sp8; if (particle->unk_00 == 0) { particle->unk_00++; temp_f31 = -70; @@ -635,6 +627,9 @@ void fn_1_AFF4(ModelData *model, ParticleData *particle, Mtx matrix) } } else { + Vec sp20; + Vec sp14; + Vec sp8; sp20.x = sind(CRot.y) * cosd(CRot.x); sp20.y = -sind(CRot.x); sp20.z = cosd(CRot.y) * cosd(CRot.x); diff --git a/src/REL/m408Dll/main.c b/src/REL/m408Dll/main.c index fa04e61a..790b23f7 100644 --- a/src/REL/m408Dll/main.c +++ b/src/REL/m408Dll/main.c @@ -1,18 +1,17 @@ +#include "game/audio.h" #include "game/chrman.h" +#include "game/hsfanim.h" +#include "game/hsfdraw.h" +#include "game/hsfman.h" +#include "game/hsfmotion.h" +#include "game/gamework_data.h" #include "game/minigame_seq.h" #include "game/object.h" #include "game/objsub.h" #include "game/pad.h" #include "game/wipe.h" - -#include "game/hsfanim.h" -#include "game/hsfdraw.h" -#include "game/hsfman.h" -#include "game/hsfmotion.h" #include "game/sprite.h" -#include "game/audio.h" -#include "game/gamework_data.h" #include "REL/m408Dll.h" @@ -20,6 +19,7 @@ #include "math.h" #ifndef __MWERKS__ +#include "game/frand.h" #include "game/esprite.h" #endif @@ -384,12 +384,12 @@ void fn_1_12A0(omObjData *object) void fn_1_148C(omObjData *object) { - Vec sp30; - Vec sp24; - Vec sp18; - Vec spC; - float temp_f29; if (!WipeStatGet()) { + Vec sp30; + Vec sp24; + Vec sp18; + Vec spC; + float temp_f29; lbl_1_bss_54 = 0; sp30.x = 0; sp30.y = 50; @@ -515,17 +515,14 @@ void fn_1_1E54(omObjData *object) s32 fn_1_1EBC(omObjData *object) { - float temp_f31; - float temp_f22; - float temp_f21; - Vec sp3C; - Vec sp30; - Vec sp24; - Work2FAC *temp_r31 = object->data; - temp_f31 = (temp_r31->unk1C.x * temp_r31->unk1C.x) + ((10.0f / 7.0f) * ((10.0f / 7.0f) * temp_r31->unk1C.z * temp_r31->unk1C.z)); + float temp_f31 = (temp_r31->unk1C.x * temp_r31->unk1C.x) + ((10.0f / 7.0f) * ((10.0f / 7.0f) * temp_r31->unk1C.z * temp_r31->unk1C.z)); if (temp_f31 > 6400) { - temp_f22 = 80.0f / sqrtf(temp_f31); + Vec sp3C; + Vec sp30; + Vec sp24; + float temp_f21; + float temp_f22 = 80.0f / sqrtf(temp_f31); sp3C.x = temp_r31->unk1C.x * temp_f22; sp3C.z = temp_r31->unk1C.z * temp_f22; temp_r31->unk34.x = sp3C.x - temp_r31->unk1C.x; @@ -551,9 +548,7 @@ s32 fn_1_1EBC(omObjData *object) temp_r31->unk28.z += (sp30.z * 20.0f) + (sp30.z * 2.0f * temp_f22); return 1; } - else { - return 0; - } + return 0; } void fn_1_26E4(omObjData *object); @@ -747,12 +742,9 @@ void fn_1_2FAC(omObjData *object) } } -void fn_1_38D0(omObjData *arg0, s8 *arg1, s8 *arg2) +void fn_1_38D0(omObjData *object, s8 *arg1, s8 *arg2) { float temp_f31; - float temp_f30; - float temp_f29; - Work2FAC *temp_r31; Work2FAC *temp_r30; s8 temp_r29; s32 temp_r28; @@ -761,79 +753,79 @@ void fn_1_38D0(omObjData *arg0, s8 *arg1, s8 *arg2) Vec spC; s8 sp8[4]; - temp_r31 = arg0->data; - *arg1 = temp_r31->unk7C[0]; - *arg2 = temp_r31->unk7C[1]; - sp18.x = temp_r31->unk1C.x; - sp18.y = temp_r31->unk1C.y; - sp18.z = temp_r31->unk1C.z; + Work2FAC *work = object->data; + *arg1 = work->unk7C[0]; + *arg2 = work->unk7C[1]; + sp18.x = work->unk1C.x; + sp18.y = work->unk1C.y; + sp18.z = work->unk1C.z; temp_r25 = fn_1_162CC(&sp18, &spC); temp_r29 = 0; sp8[0] = -1; for (temp_r28 = 0; temp_r28 < 4; temp_r28++) { - if (temp_r28 != temp_r31->unk0) { + if (temp_r28 != work->unk0) { temp_r30 = fn_1_68A8(temp_r28); if ((temp_r30->unk4 & 0x12) == 0) { sp8[temp_r29++] = temp_r28; } } } - switch (temp_r31->unk8E) { + switch (work->unk8E) { case 0: if (temp_r29 > 0 || temp_r25) { if (temp_r29 > 0) { - temp_r31->unk8C = sp8[frandmod(temp_r29)]; + work->unk8C = sp8[frandmod(temp_r29)]; } - temp_r31->unk74 = frandmod(180) + 120.0f; - temp_r31->unk78 = 0; - temp_r31->unk8E = 1; + work->unk74 = frandmod(180) + 120.0f; + work->unk78 = 0; + work->unk8E = 1; } else { - temp_r31->unk78 = 0; - temp_r31->unk8E = 2; + work->unk78 = 0; + work->unk8E = 2; } break; case 1: - if ((temp_r31->unk78 & 0x3) == 0) { + if ((work->unk78 & 0x3) == 0) { if (temp_r25) { - temp_f31 = atan2d(spC.x - temp_r31->unk1C.x, spC.z - temp_r31->unk1C.z); + temp_f31 = atan2d(spC.x - work->unk1C.x, spC.z - work->unk1C.z); } else { - temp_r30 = fn_1_68A8(temp_r31->unk8C); - temp_f31 = atan2d(temp_r30->unk1C.x - temp_r31->unk1C.x, temp_r30->unk1C.z - temp_r31->unk1C.z); + temp_r30 = fn_1_68A8(work->unk8C); + temp_f31 = atan2d(temp_r30->unk1C.x - work->unk1C.x, temp_r30->unk1C.z - work->unk1C.z); } - temp_r31->unk84[1] = fn_1_883C(temp_r31->unk84[0], temp_f31, (0.3f * temp_r31->unk90) + 0.15f); + work->unk84[1] = fn_1_883C(work->unk84[0], temp_f31, (0.3f * work->unk90) + 0.15f); } - temp_r31->unk78++; - temp_r31->unk84[0] = fn_1_883C(temp_r31->unk84[0], temp_r31->unk84[1], 0.2f); - temp_r31->unk7C[0] = sind(temp_r31->unk84[0]) * 80.0; - temp_r31->unk7C[1] = -cosd(temp_r31->unk84[0]) * 80.0; - *arg1 = temp_r31->unk7C[0]; - *arg2 = temp_r31->unk7C[1]; - temp_r31->unk74--; + work->unk78++; + work->unk84[0] = fn_1_883C(work->unk84[0], work->unk84[1], 0.2f); + work->unk7C[0] = sind(work->unk84[0]) * 80.0; + work->unk7C[1] = -cosd(work->unk84[0]) * 80.0; + *arg1 = work->unk7C[0]; + *arg2 = work->unk7C[1]; + work->unk74--; if (temp_r25 == 0 && (temp_r30->unk4 & 0x12)) { - temp_r31->unk74 = 0; + work->unk74 = 0; } - if (temp_r31->unk74 == 0) { - temp_r31->unk8E = 0; + if (work->unk74 == 0) { + work->unk8E = 0; } break; case 2: - if ((temp_r31->unk78 & 0xF) == 0) { - temp_f30 = (0.04f * frandmod(1000)) - 20.0f; - temp_f29 = (0.04f * frandmod(1000)) - 20.0f; - temp_r31->unk84[1] = temp_f31 = atan2d(temp_f30 - temp_r31->unk1C.x, temp_f29 - temp_r31->unk1C.z); + if ((work->unk78 & 0xF) == 0) { + float temp_f30 = (0.04f * frandmod(1000)) - 20.0f; + float temp_f29 = (0.04f * frandmod(1000)) - 20.0f; + work->unk84[1] = temp_f31 = atan2d(temp_f30 - work->unk1C.x, temp_f29 - work->unk1C.z); } - temp_r31->unk78++; - temp_r31->unk84[0] = fn_1_883C(temp_r31->unk84[0], temp_r31->unk84[1], 0.2f); - temp_r31->unk7C[0] = sind(temp_r31->unk84[0]) * 80.0; - temp_r31->unk7C[1] = -cosd(temp_r31->unk84[0]) * 80.0; - *arg1 = temp_r31->unk7C[0]; - *arg2 = temp_r31->unk7C[1]; + work->unk78++; + work->unk84[0] = fn_1_883C(work->unk84[0], work->unk84[1], 0.2f); + work->unk7C[0] = sind(work->unk84[0]) * 80.0; + work->unk7C[1] = -cosd(work->unk84[0]) * 80.0; + *arg1 = work->unk7C[0]; + *arg2 = work->unk7C[1]; if (temp_r29 > 0 || temp_r25) { - temp_r31->unk8E = 0; + work->unk8E = 0; } break; } @@ -942,12 +934,10 @@ void fn_1_3E80(omObjData *object) void fn_1_4A58(omObjData *object) { - Work2FAC *temp_r31; s32 temp_r28; s32 temp_r26; - s32 sp8; - temp_r31 = object->data; - sp8 = temp_r31->unk0; + Work2FAC *temp_r31 = object->data; + s32 sp8 = temp_r31->unk0; temp_r31->unk4 |= 2; temp_r31->unk1C.y = lbl_1_bss_54; fn_1_1EBC(object); @@ -1006,38 +996,36 @@ void fn_1_54E4(omObjData *object); void fn_1_5098(omObjData *object) { - Work2FAC *temp_r29; - s32 temp_r27; - - temp_r29 = object->data; + Work2FAC *work = object->data; object->trans.x = lbl_1_data_144[object->work[0]].x; object->trans.z = lbl_1_data_144[object->work[0]].z; if (object->work[1] == 0) { - if (lbl_1_bss_3C < temp_r29->unk8) { - lbl_1_bss_3C = temp_r29->unk8; + if (lbl_1_bss_3C < work->unk8) { + lbl_1_bss_3C = work->unk8; } } - else if (object->work[1] == 10 && lbl_1_bss_3C == temp_r29->unk8) { + else if (object->work[1] == 10 && lbl_1_bss_3C == work->unk8) { + s32 temp_r27; for (temp_r27 = 0; lbl_1_bss_28[temp_r27] >= 0; temp_r27++) ; - lbl_1_bss_28[temp_r27] = temp_r29->unk2; + lbl_1_bss_28[temp_r27] = work->unk2; } object->work[1]++; - temp_r29->unk1C.y = lbl_1_bss_54; - temp_r29->unk58.y = 0; - temp_r29->unk58.x = 0; + work->unk1C.y = lbl_1_bss_54; + work->unk58.y = 0; + work->unk58.x = 0; object->rot.x = object->rot.y = object->rot.z = 0; - object->trans.y = temp_r29->unk1C.y; - temp_r29->unk1C.x = object->trans.x; - temp_r29->unk1C.z = object->trans.z; - temp_r29->unk1C.y += lbl_1_data_A0[temp_r29->unk2]; + object->trans.y = work->unk1C.y; + work->unk1C.x = object->trans.x; + work->unk1C.z = object->trans.z; + work->unk1C.y += lbl_1_data_A0[work->unk2]; if (object->trans.y < 0) { object->trans.y = 0; } fn_1_1BE8(object, 1.0f); if (fn_1_6878() == 5) { object->func = fn_1_54E4; - if (temp_r29->unk14) { + if (work->unk14) { lbl_1_bss_C = 1; } } @@ -1069,9 +1057,7 @@ void fn_1_5AA0(omObjData *object); void fn_1_5684(omObjData *object) { - Work2FAC *temp_r31; - s32 temp_r29; - temp_r31 = object->data; + Work2FAC *temp_r31 = object->data; if (fabs(object->trans.x) < 160.0 || fabs(object->trans.z) < 160.0) { temp_r31->unk1C.x += temp_r31->unk28.x * (1.0f / 60.0f); temp_r31->unk1C.z += temp_r31->unk28.z * (1.0f / 60.0f); @@ -1088,6 +1074,7 @@ void fn_1_5684(omObjData *object) omSetTra(object, temp_r31->unk1C.x + temp_r31->unk68.x, temp_r31->unk1C.y + temp_r31->unk68.y, temp_r31->unk1C.z + temp_r31->unk68.z); } if (fn_1_6878() >= 4) { + s32 temp_r29; GWPlayerCoinCollectAdd(object->work[0], temp_r31->unk14); if (lbl_1_bss_48) { Hu3DModelAttrReset(object->model[0], HU3D_ATTR_DISPOFF); @@ -1157,15 +1144,13 @@ void fn_1_5AB4(ModelData *model, ParticleData *particle, Mtx matrix) void fn_1_5DCC(s32 arg0, Vec *arg1, u32 arg2) { - float temp_f31; - float temp_f30; - HsfanimStruct01 *temp_r31; - ParticleData *temp_r29; - s32 temp_r28; - temp_r29 = Hu3DData[arg0].unk_120; + ParticleData *temp_r29 = Hu3DData[arg0].unk_120; if (temp_r29->unk_00 != 0) { - temp_r31 = temp_r29->unk_48; + float temp_f31; + float temp_f30; + HsfanimStruct01 *temp_r31 = temp_r29->unk_48; + s32 temp_r28; for (temp_r28 = 0; temp_r28 < temp_r29->unk_30; temp_r28++, temp_r31++) { if (temp_r31->unk00) { continue; diff --git a/src/REL/m408Dll/object.c b/src/REL/m408Dll/object.c index a7db6c04..d37dc474 100644 --- a/src/REL/m408Dll/object.c +++ b/src/REL/m408Dll/object.c @@ -1,23 +1,19 @@ +#include "game/audio.h" #include "game/object.h" -#include "game/chrman.h" -#include "game/minigame_seq.h" #include "game/objsub.h" -#include "game/pad.h" -#include "game/wipe.h" - #include "game/hsfanim.h" -#include "game/hsfdraw.h" #include "game/hsfman.h" #include "game/hsfmotion.h" #include "game/sprite.h" -#include "game/audio.h" -#include "game/gamework_data.h" - #include "REL/m408Dll.h" #include "ext_math.h" -#include "math.h" + +#ifndef __MWERKS__ +#include "game/frand.h" +#endif +s32 rand8(void); typedef struct struct_data_20C { s32 unk0; @@ -372,10 +368,9 @@ void fn_1_11E3C(StructBssDA4 *arg0, s32 arg1) void fn_1_12354(omObjData *object) { - s32 temp_r31; - u32 temp_r30; - temp_r30 = fn_1_6878(); + u32 temp_r30 = fn_1_6878(); if (temp_r30 == 2) { + s32 temp_r31; for (temp_r31 = 0; temp_r31 < lbl_1_bss_DA0; temp_r31++) ; object->func = fn_1_123C8; @@ -522,7 +517,6 @@ void fn_1_127A0(StructBssDA4 *arg0) void fn_1_12C6C(StructBssDA4 *arg0) { - Work2FAC *temp_r30; float temp_f31; float temp_f30; float temp_f26; diff --git a/src/REL/m408Dll/stage.c b/src/REL/m408Dll/stage.c index dd3ed9a4..a925ada2 100644 --- a/src/REL/m408Dll/stage.c +++ b/src/REL/m408Dll/stage.c @@ -1,23 +1,20 @@ +#include "game/audio.h" #include "game/chrman.h" -#include "game/minigame_seq.h" -#include "game/object.h" -#include "game/objsub.h" -#include "game/pad.h" -#include "game/wipe.h" - #include "game/hsfanim.h" #include "game/hsfdraw.h" #include "game/hsfman.h" #include "game/hsfmotion.h" +#include "game/object.h" +#include "game/objsub.h" #include "game/sprite.h" - -#include "game/audio.h" -#include "game/gamework_data.h" +#include "game/wipe.h" +#include "ext_math.h" #include "REL/m408Dll.h" -#include "ext_math.h" -#include "math.h" +#ifndef __MWERKS__ +#include "game/frand.h" +#endif s32 lbl_1_bss_160[2]; AnimData *lbl_1_bss_14C[5]; @@ -262,18 +259,14 @@ void fn_1_D6F0(omObjData *object); void fn_1_D004(omObjData *object) { float temp_f31; - float temp_f30; float temp_f29; - float temp_f28; - u16 *temp_r30; float *temp_r28; s32 temp_r27; s32 temp_r26; - CameraData *sp8; - temp_r30 = object->data; - sp8 = &Hu3DCamera[0]; - temp_f30 = fn_1_6888(); - temp_f28 = 7000; + u16 *temp_r30 = object->data; + CameraData *sp8 = &Hu3DCamera[0]; + float temp_f30 = fn_1_6888(); + float temp_f28 = 7000; switch (temp_r30[0]) { case 2: Hu3DModelAttrReset(object->model[9], HU3D_ATTR_DISPOFF); diff --git a/src/REL/m409Dll/cursor.c b/src/REL/m409Dll/cursor.c index 84f6f5d6..d8db13eb 100644 --- a/src/REL/m409Dll/cursor.c +++ b/src/REL/m409Dll/cursor.c @@ -767,7 +767,7 @@ s32 fn_1_E2A8(s16 arg0, u8 arg1, u32 arg2, s16 arg3, s16 arg4) temp_r31->unkC = 1.0f; temp_r31->unk10 = 0.0f; if (temp_r31->unk4 == NULL) { - temp_r31->unk4 = HuMemDirectMallocNum(HEAP_SYSTEM, 0x20, MEMORY_DEFAULT_NUM); + temp_r31->unk4 = HuMemDirectMallocNum(HEAP_SYSTEM, 4 * sizeof(HsfVector2f), MEMORY_DEFAULT_NUM); } temp_r31->unk4[0].x = temp_r31->unk0 * temp_r30->unk54; temp_r31->unk4[0].y = temp_r31->unk0 * temp_r30->unk58; diff --git a/src/REL/m409Dll/player.c b/src/REL/m409Dll/player.c index c6645d8b..64f453f1 100644 --- a/src/REL/m409Dll/player.c +++ b/src/REL/m409Dll/player.c @@ -1,14 +1,15 @@ -#include "REL/m409Dll.h" - -#include "ext_math.h" #include "game/audio.h" #include "game/chrman.h" +#include "game/frand.h" #include "game/gamework_data.h" #include "game/hsfmotion.h" +#include "game/objsub.h" #include "game/pad.h" #include "game/sprite.h" #include "ext_math.h" +#include "REL/m409Dll.h" + #ifndef __MWERKS__ #include "game/esprite.h" #endif diff --git a/src/REL/m410Dll/main.c b/src/REL/m410Dll/main.c index 9ded1e40..1ddf2698 100644 --- a/src/REL/m410Dll/main.c +++ b/src/REL/m410Dll/main.c @@ -1,14 +1,15 @@ -#include "ext_math.h" +#include #include "game/gamework_data.h" #include "game/hsfdraw.h" #include "game/hsfman.h" #include "game/minigame_seq.h" #include "game/object.h" +#include "game/objsub.h" #include "game/wipe.h" +#include "ext_math.h" #include "REL/m410Dll.h" -#include Process *lbl_1_bss_28; omObjData *lbl_1_bss_24; diff --git a/src/REL/m410Dll/player.c b/src/REL/m410Dll/player.c index 0d253d0f..470f98e5 100644 --- a/src/REL/m410Dll/player.c +++ b/src/REL/m410Dll/player.c @@ -1,4 +1,4 @@ -#include "ext_math.h" +#include "game/audio.h" #include "game/chrman.h" #include "game/gamework_data.h" #include "game/hsfdraw.h" @@ -8,11 +8,13 @@ #include "game/object.h" #include "game/pad.h" #include "game/sprite.h" +#include "ext_math.h" #include "REL/m410Dll.h" #ifndef __MWERKS__ #include "game/esprite.h" +#include "game/frand.h" #endif omObjData *lbl_1_bss_74; diff --git a/src/REL/m411Dll/main.c b/src/REL/m411Dll/main.c index d33b3e11..3edd0e89 100755 --- a/src/REL/m411Dll/main.c +++ b/src/REL/m411Dll/main.c @@ -16,9 +16,12 @@ #include "game/sprite.h" #include "game/wipe.h" -#include "dolphin.h" #include "ext_math.h" +#ifndef __MWERKS__ +#include "game/hsfex.h" +#endif + typedef struct { /* 0x00 */ s16 unk00; /* 0x02 */ s16 unk02[5]; diff --git a/src/REL/m412Dll/main.c b/src/REL/m412Dll/main.c index 11c400d3..6436c16a 100644 --- a/src/REL/m412Dll/main.c +++ b/src/REL/m412Dll/main.c @@ -11,7 +11,6 @@ #include "game/pad.h" #include "game/sprite.h" #include "game/wipe.h" -#include "math.h" // bss s16 lbl_1_bss_7A0; diff --git a/src/REL/m414Dll/main.c b/src/REL/m414Dll/main.c index 8ca555e6..bcd43d32 100644 --- a/src/REL/m414Dll/main.c +++ b/src/REL/m414Dll/main.c @@ -10,6 +10,10 @@ #include "game/sprite.h" #include "game/wipe.h" +#ifndef __MWERKS__ +#include "game/hsfex.h" +#endif + typedef struct UnkM414Struct { s32 unk00; s32 unk04; diff --git a/src/REL/m415Dll/main.c b/src/REL/m415Dll/main.c index 9d901a01..975aa227 100644 --- a/src/REL/m415Dll/main.c +++ b/src/REL/m415Dll/main.c @@ -14,7 +14,6 @@ #include "game/pad.h" #include "game/sprite.h" #include "game/wipe.h" -#include "math.h" // bss unkStruct5 lbl_1_bss_36C; diff --git a/src/REL/m415Dll/map.c b/src/REL/m415Dll/map.c index 71e10e28..cf1ef352 100644 --- a/src/REL/m415Dll/map.c +++ b/src/REL/m415Dll/map.c @@ -1,3 +1,4 @@ +#include "game/memory.h" #define HUSPR_USE_OLD_DEFS #include "REL/m415Dll.h" @@ -767,7 +768,7 @@ void fn_1_ACF4(s16 arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5) HuSprAnimKill(var_r31->unk0); var_r31->unk8 |= 0xFFFF0000; var_r30 = HuSprAnimMake(arg2, arg3, arg1); - var_r30->bmp->data = HuMemDirectMallocNum(HEAP_SYSTEM, arg3 * (var_r30->bmp->pixSize * arg2), 0x10000000U); + var_r30->bmp->data = HuMemDirectMallocNum(HEAP_SYSTEM, arg3 * (var_r30->bmp->pixSize * arg2), MEMORY_DEFAULT_NUM); var_f31 = arg4 / (f32)var_r30->bmp->sizeX; var_f30 = arg5 / (f32)var_r30->bmp->sizeY; var_r31->unk0 = var_r30; @@ -885,7 +886,7 @@ s32 fn_1_B0B8(s16 arg0, u8 arg1, s16 arg2) return 1; } -void fn_1_B634(s32 arg0) +void fn_1_B634(void) { s32 var_r28; s32 var_r27; diff --git a/src/REL/m416Dll/main.c b/src/REL/m416Dll/main.c index 0364445e..b5ca6c1d 100644 --- a/src/REL/m416Dll/main.c +++ b/src/REL/m416Dll/main.c @@ -3,6 +3,7 @@ #include "game/frand.h" #include "game/gamework_data.h" #include "game/hsfanim.h" +#include "game/hsfdraw.h" #include "game/hsfman.h" #include "game/hsfmotion.h" #include "game/minigame_seq.h" @@ -13,7 +14,6 @@ #include "game/wipe.h" #include "ext_math.h" -#include "math.h" #include "REL/m416Dll.h" diff --git a/src/REL/m416Dll/map.c b/src/REL/m416Dll/map.c index 383cee5e..24f26414 100644 --- a/src/REL/m416Dll/map.c +++ b/src/REL/m416Dll/map.c @@ -5,15 +5,11 @@ #include "game/hsfanim.h" #include "game/hsfman.h" #include "game/hsfmotion.h" -#include "game/minigame_seq.h" #include "game/object.h" #include "game/objsub.h" -#include "game/pad.h" #include "game/sprite.h" -#include "game/wipe.h" #include "ext_math.h" -#include "math.h" #include "REL/m416Dll.h" diff --git a/src/REL/m417Dll/main.c b/src/REL/m417Dll/main.c index db0d47a6..60972bd2 100644 --- a/src/REL/m417Dll/main.c +++ b/src/REL/m417Dll/main.c @@ -1,11 +1,14 @@ #include "ext_math.h" #include "game/audio.h" +#include "game/chrman.h" #include "game/hsfdraw.h" #include "game/minigame_seq.h" +#include "game/objsub.h" #include "game/wipe.h" #include "REL/m417Dll.h" + typedef struct UnkM417Struct { /* 0x00 */ u32 unk_00; /* 0x04 */ u32 unk_04; @@ -109,9 +112,9 @@ void fn_1_4D8(omObjData *object) { UnkM417Struct *var_r31; - object->data = HuMemDirectMallocNum(HEAP_SYSTEM, 0x68, 268435456); + object->data = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(UnkM417Struct), 268435456); var_r31 = object->data; - memset(var_r31, 0, 0x68); + memset(var_r31, 0, sizeof(UnkM417Struct)); var_r31->unk_00 = 0; var_r31->unk_04 = 0; var_r31->unk_0C = 0; diff --git a/src/REL/m417Dll/player.c b/src/REL/m417Dll/player.c index 81f282b0..c371130f 100644 --- a/src/REL/m417Dll/player.c +++ b/src/REL/m417Dll/player.c @@ -4,13 +4,15 @@ #include "game/gamework_data.h" #include "game/hsfdraw.h" #include "game/hsfmotion.h" -#include "game/minigame_seq.h" #include "game/objsub.h" #include "game/pad.h" -#include "game/wipe.h" #include "REL/m417Dll.h" +#ifndef __MWERKS__ +#include "game/frand.h" +#endif + typedef struct UnkM417Struct8 { /* 0x00 */ u16 unk_00; /* 0x04 */ float unk_04; diff --git a/src/REL/m417Dll/water.c b/src/REL/m417Dll/water.c index aa5ba830..c5c33552 100644 --- a/src/REL/m417Dll/water.c +++ b/src/REL/m417Dll/water.c @@ -6,6 +6,10 @@ #include "REL/m417Dll.h" +#ifndef __MWERKS__ +#include "game/frand.h" +#endif + typedef struct UnkM417Struct3 { /* 0x00 */ s16 unk_00; /* 0x02 */ char unk02[4]; @@ -265,12 +269,10 @@ void fn_1_3D54(omObjData *object) { } void fn_1_3D58(omObjData *object) { Vec spC; - float sp8; float var_f31; float var_f29; float var_f28; - float var_f27; s32 var_r31; s32 var_r30; @@ -752,9 +754,6 @@ void fn_1_604C(ModelData *arg0, Mtx arg1) Mtx sp38; GXTexObj sp18; - GXColor *var_r30; - GXColor *var_r29; - GXColor sp14 = { 0xD8, 0xE2, 0xE5, 0x4C }; GXColor sp10 = { 0xE0, 0xD8, 0xF4, 0x40 }; DCStoreRangeNoSync(&sp14, 4); @@ -1004,14 +1003,7 @@ void fn_1_6D64(s32 arg0, u32 arg1, float arg8, float arg9, float argA) void fn_1_7510(float arg8, float arg9, float argA, float argB) { - float var_f31; - float var_f30; - float var_f28; - - s32 var_r31; - s32 var_r30; - - var_f31 = 180.0 + (atan2d(arg8, argA)); + float var_f31 = 180.0 + (atan2d(arg8, argA)); if (var_f31 >= 360.0f) { var_f31 -= 360.0f; } diff --git a/src/REL/m418Dll/main.c b/src/REL/m418Dll/main.c index 361b1c98..cc4c9627 100644 --- a/src/REL/m418Dll/main.c +++ b/src/REL/m418Dll/main.c @@ -1,5 +1,6 @@ #include "ext_math.h" #include "game/chrman.h" +#include "game/hsfdraw.h" #include "game/hsfman.h" #include "game/minigame_seq.h" #include "game/objsub.h" @@ -9,6 +10,12 @@ #include "REL/m418Dll.h" + +#ifndef __MWERKS__ +s32 rand8(void); +#include "game/audio.h" +#endif + // types typedef struct M418DllUnkStruct2 { omObjData *unk0; @@ -432,7 +439,7 @@ void fn_1_E74(omObjData *object) } if (object->work[1] != 0) { const char *sp8[4] = { "doukasen-null_B", "doukasen-null_A", "doukasen-null_X", "doukasen-null_Y" }; - Hu3DModelObjMtxGet(object->model[3], sp8[object->work[0]], sp18); + Hu3DModelObjMtxGet(object->model[3], (char*)sp8[object->work[0]], sp18); Hu3DModelPosSet(object->model[4], sp18[0][3], sp18[1][3], sp18[2][3]); } temp_r27 = &lbl_1_bss_170[object->work[0]]; @@ -494,7 +501,6 @@ s32 fn_1_18FC(omObjData *object, Vec arg1, f32 arg8, f32 arg9) f32 var_f30; f32 var_f27; f32 var_f26; - f32 var_f24; f32 var_f20; var_r28 = 0; @@ -806,7 +812,6 @@ void fn_1_3240(omObjData *object) Vec sp8; M418DllUnkStruct3 *temp_r28; ModelData *temp_r30; - M418DllWorkStruct *var_r29; temp_r30 = &Hu3DData[object->model[11]]; temp_r28 = &lbl_1_bss_26C[object->work[0]]; @@ -858,7 +863,6 @@ void fn_1_3444(omObjData *object, Vec arg1, f32 arg8, f32 arg9) f32 temp_f28; f32 var_f24; f32 var_f23; - f32 var_f22; s32 var_r27; s32 var_r29; @@ -961,17 +965,14 @@ void fn_1_3444(omObjData *object, Vec arg1, f32 arg8, f32 arg9) void fn_1_3EB0(omObjData *object, Vec arg1, f32 arg8, f32 arg9) { - M418DllUnkStruct3 *temp_r30; - s32 sp10; f32 var_f31; f32 var_f30; f32 var_f27; f32 var_f26; - f32 var_f24; f32 var_f20; - sp10 = 0; - temp_r30 = &lbl_1_bss_26C[object->work[0]]; + s32 sp10 = 0; + M418DllUnkStruct3 *temp_r30 = &lbl_1_bss_26C[object->work[0]]; var_f31 = arg1.x - object->trans.x; var_f30 = object->trans.z - arg1.z; var_f26 = 90.0 + atan2d(var_f30, var_f31); @@ -1132,16 +1133,10 @@ void fn_1_4C84(omObjData *object) Mtx sp14; Vec sp8; f32 var_f31; - M418DllUnkStruct3 *temp_r26; - M418DllWorkStruct *var_r27; - M418DllUnkStruct3 *temp_r30; - ModelData *temp_r28; - ModelData *temp_r29; - s32 temp_r0; - u32 temp_r3; - temp_r30 = &lbl_1_bss_26C[object->work[0]]; + M418DllUnkStruct3 *temp_r30 = &lbl_1_bss_26C[object->work[0]]; if (temp_r30->unk8 == 0) { + ModelData *temp_r29; var_f31 = (0.5f * temp_r30->unk3C) + ((CRot.x / 90.0f) * (0.5f * temp_r30->unk3C)); temp_r29 = &Hu3DData[object->model[12]]; if ((temp_r30->unk14 == 7) || (temp_r30->unk14 == 5)) { @@ -1261,11 +1256,9 @@ void fn_1_56AC(s32 arg0) void fn_1_5768(s32 arg0) { s32 var_r31; - M418DllUnkStruct4 *var_r30; - M418DllUnkStruct *var_r26; for (var_r31 = 0; var_r31 < 3; var_r31++) { - var_r30 = &lbl_1_bss_170[var_r31]; + M418DllUnkStruct4 *var_r30 = &lbl_1_bss_170[var_r31]; var_r30->unkC = 0; } @@ -1275,9 +1268,8 @@ void fn_1_5768(s32 arg0) s32 fn_1_57E4(s32 arg0) { M418DllUnkStruct4 *temp_r31; - M418DllUnkStruct *var_r25; - s32 var_r29; s32 var_r30; + s32 var_r29; if (fn_1_B0C8(&lbl_1_bss_50, 0) >= 0x3C) { for (var_r30 = 0; var_r30 < 3; var_r30++) { @@ -1359,7 +1351,6 @@ s32 fn_1_5A6C(s32 arg0) s32 var_r26; omObjData *temp_r25; s32 var_r24; - M418DllUnkStruct *temp_r20; temp_r27 = &lbl_1_bss_3EC; for (var_r31 = 0; var_r31 < 3; var_r31++) { @@ -1651,7 +1642,6 @@ void fn_1_6808(s32 arg0) M418DllUnkStruct6 *var_r30 = &lbl_1_bss_3EC; M418DllUnkStruct3 *var_r29; M418DllUnkStruct4 *var_r28; - M418DllUnkStruct *var_r23; HuAudAUXVolSet(0x40, 0x40); @@ -1678,12 +1668,10 @@ s32 fn_1_6914(s32 arg0) { Vec sp14; M418DllUnkStruct3 *temp_r31; - M418DllUnkStruct3 *temp_r30; s32 var_r29; s32 temp_r27; M418DllUnkStruct6 *var_r26; M418DllUnkStruct4 *var_r25; - M418DllUnkStruct *var_r18; var_r26 = &lbl_1_bss_3EC; @@ -2006,7 +1994,6 @@ s32 fn_1_7B68(s32 arg0) M418DllUnkStruct4 *temp_r28; s32 var_r27; s32 var_r26; - M418DllUnkStruct *temp_r21; var_r26 = -1; temp_r30 = &lbl_1_bss_3EC; @@ -2251,7 +2238,6 @@ void fn_1_8548(void) void fn_1_8668(void) { M418DllUnkStruct sp8; - f32 temp_f1; M418DllUnkStruct *var_r31 = &lbl_1_bss_1F4; @@ -2312,7 +2298,6 @@ s32 fn_1_88B4(s32 arg0) s32 var_r29; M418DllUnkStruct3 *var_r28; M418DllUnkStruct3 *var_r27; - M418DllUnkStruct *var_r23; var_r29 = 5; var_r30 = &lbl_1_bss_3EC; @@ -2426,10 +2411,8 @@ void fn_1_8C84(s32 arg0) s32 var_r30; M418DllUnkStruct6 *temp_r29; M418DllUnkStruct3 *temp_r28; - s32 var_r27; - s32 temp_r0; - var_r27 = 0; + s32 var_r27 = 0; temp_r29 = &lbl_1_bss_3EC; for (var_r30 = 0; var_r30 < 3; var_r30++) { temp_r31 = &lbl_1_bss_26C[temp_r29->unk4[var_r30]]; @@ -2452,17 +2435,12 @@ Vec lbl_1_data_3FC[6] = { { -200.0f, 0.0f, -450.0f }, { 0.0f, 0.0f, -400.0f }, { s32 fn_1_8D70(s32 arg0) { - s32 sp10; - s32 spC; - s32 sp8; M418DllUnkStruct3 *temp_r31; M418DllUnkStruct6 *temp_r30; s32 var_r29; M418DllUnkStruct3 *temp_r28; M418DllUnkStruct3 *temp_r27; omObjData *var_r26; - s32 temp_r3; - void *temp_r4; temp_r30 = &lbl_1_bss_3EC; @@ -2493,9 +2471,7 @@ s32 fn_1_8D70(s32 arg0) if (fn_1_B0C8(&lbl_1_bss_20, 1) != 0) { return fn_1_AF38(&lbl_1_bss_20); } - else { - return 0; - } + return 0; } void fn_1_8F74(s32 arg0) @@ -2669,10 +2645,8 @@ void fn_1_958C(void) M418DllUnkStruct4 *temp_r27; M418DllUnkStruct4 *temp_r26; M418DllUnkStruct3 *temp_r25; - s32 temp_r0; - s32 var_r24; - var_r24 = 0; + s32 var_r24 = 0; temp_r28 = &lbl_1_bss_1E0; for (var_r30 = 1; var_r30 < 4; var_r30++) { fn_1_ABC4(temp_r28->unk0, var_r30, var_r30, 0, 2); diff --git a/src/REL/m419Dll/main.c b/src/REL/m419Dll/main.c index 0dc053ba..11054aac 100755 --- a/src/REL/m419Dll/main.c +++ b/src/REL/m419Dll/main.c @@ -3,6 +3,7 @@ #include "game/data.h" #include "game/frand.h" #include "game/gamework_data.h" +#include "game/hsfex.h" #include "game/hsfman.h" #include "game/hsfmotion.h" #include "game/minigame_seq.h" @@ -13,7 +14,6 @@ #include "game/sprite.h" #include "game/wipe.h" -#include "dolphin.h" #include "ext_math.h" typedef struct { @@ -220,7 +220,7 @@ void fn_1_57C(s16 arg0) temp_r30 = &Hu3DData[lbl_1_bss_5BE]; sp14 = temp_r30->pos; sp14.y += 50.0f; - Hu3D3Dto2D(&sp14, 1, &sp8.x); + Hu3D3Dto2D(&sp14, 1, &sp8); var_r31 = sp8.x - 96.0f; var_r31 &= 0xFFF8; sp8.x = var_r31; @@ -552,7 +552,6 @@ void fn_1_F58(void) float fn_1_1F84(float arg0, float arg1) { float var_f31; - float var_f30; if (arg0 > 600.0f - arg1) { var_f31 = 600.0f + 200.0f * ((800.0f - (arg0 + arg1)) / 200.0f); diff --git a/src/REL/m420dll/camera.c b/src/REL/m420dll/camera.c index c587a69e..571c823a 100644 --- a/src/REL/m420dll/camera.c +++ b/src/REL/m420dll/camera.c @@ -1,12 +1,9 @@ #include "ext_math.h" -#include "game/audio.h" #include "game/flag.h" #include "game/hsfman.h" -#include "game/minigame_seq.h" #include "game/objsub.h" #include "game/pad.h" #include "game/printfunc.h" -#include "game/wipe.h" #include "REL/m420dll.h" diff --git a/src/REL/m420dll/main.c b/src/REL/m420dll/main.c index d6574513..32ccdabf 100644 --- a/src/REL/m420dll/main.c +++ b/src/REL/m420dll/main.c @@ -1,10 +1,9 @@ #include "ext_math.h" #include "game/flag.h" +#include "game/frand.h" #include "game/hsfman.h" #include "game/minigame_seq.h" #include "game/objsub.h" -#include "game/pad.h" -#include "game/printfunc.h" #include "game/wipe.h" #include "REL/m420dll.h" diff --git a/src/REL/m420dll/map.c b/src/REL/m420dll/map.c index 14b48a41..a2bebd31 100644 --- a/src/REL/m420dll/map.c +++ b/src/REL/m420dll/map.c @@ -4,6 +4,10 @@ #include "REL/m420dll.h" +#ifndef __MWERKS__ +#include "game/audio.h" +#endif + typedef struct M420DllUnkMapStruct2 { /* 0x00 */ struct { s8 unk_00_field0 : 1; diff --git a/src/REL/m420dll/player.c b/src/REL/m420dll/player.c index 5bdb79f2..6178a969 100644 --- a/src/REL/m420dll/player.c +++ b/src/REL/m420dll/player.c @@ -3,11 +3,11 @@ #include "game/chrman.h" #include "game/esprite.h" #include "game/hsfdraw.h" +#include "game/hsfex.h" #include "game/hsfman.h" #include "game/hsfmotion.h" #include "game/objsub.h" #include "game/pad.h" -#include "game/wipe.h" #include "REL/m420dll.h" @@ -386,10 +386,6 @@ void fn_1_22CC(M420DllPlayerStruct *arg0) M420DllUnkStruct2 *var_r30; s32 var_r29; s32 var_r28; - s32 var_r26; - s32 var_r23; - s32 var_r21; - s32 var_r18; var_r30 = &lbl_1_data_50[arg0->unk_08]; fn_1_3098(arg0); @@ -469,27 +465,11 @@ void fn_1_22CC(M420DllPlayerStruct *arg0) void fn_1_276C(M420DllPlayerStruct *arg0) { - s32 sp8[4]; - float var_f31; float var_f30; s32 var_r30; - M420DllUnkStruct2 *var_r29; - s32 var_r28; - s32 var_r27; - s32 var_r26; - s32 var_r25; - s32 var_r24; - s32 var_r23; - s32 var_r22; - s32 var_r21; - s32 var_r20; - s32 var_r19; - s32 var_r18; - s32 var_r17; - - var_r29 = &lbl_1_data_50[arg0->unk_08]; + M420DllUnkStruct2 *var_r29 = &lbl_1_data_50[arg0->unk_08]; if (arg0->unk_4C == 1) { HuAudFXPlay(0x5F1); fn_1_669C(1); @@ -628,14 +608,6 @@ void fn_1_2D7C(M420DllPlayerStruct *arg0) void fn_1_2EA8(M420DllPlayerStruct *arg0) { s16 var_r30; - s32 var_r29; - s32 var_r28; - s32 var_r27; - s32 var_r26; - s32 var_r25; - s32 var_r24; - s32 var_r23; - s32 var_r22; fn_1_326C(arg0); CharModelMotionShiftSet(arg0->unk_0A, arg0->unk_AE[3], 0.0f, 1.0f, 0); @@ -1012,22 +984,12 @@ void fn_1_4294(M420DllPlayerStruct *arg0) void fn_1_4574(M420DllPlayerStruct *arg0) { - float var_f31; - M420DllPlayerStruct *var_r31; - s32 var_r29; - s32 var_r28; - CharModelMotionShiftSet(arg0->unk_0A, arg0->unk_AE[1], 0.0f, 4.0f, 0); fn_1_2260(arg0); } void fn_1_476C(M420DllPlayerStruct *arg0) { - float var_f31; - M420DllPlayerStruct *var_r31; - s32 var_r29; - s32 var_r28; - CharModelMotionShiftSet(arg0->unk_0A, arg0->unk_AE[2], 0.0f, 4.0f, 0); fn_1_2260(arg0); } diff --git a/src/REL/m421Dll/main.c b/src/REL/m421Dll/main.c index 8ab50b74..67639fbc 100644 --- a/src/REL/m421Dll/main.c +++ b/src/REL/m421Dll/main.c @@ -834,8 +834,6 @@ s32 fn_1_3FF8(void) void fn_1_4030(Vec *sp8, Vec *var_r31) { Vec sp10; - float var_f30; - float var_f29; VECSubtract(var_r31, sp8, &sp10); Center = *var_r31; diff --git a/src/REL/m422Dll/main.c b/src/REL/m422Dll/main.c index 79b64b3c..6e0bcbdd 100755 --- a/src/REL/m422Dll/main.c +++ b/src/REL/m422Dll/main.c @@ -10,13 +10,16 @@ #include "game/hsfmotion.h" #include "game/minigame_seq.h" #include "game/object.h" +#include "game/objsub.h" #include "game/pad.h" #include "game/sprite.h" #include "game/wipe.h" -#include "dolphin.h" #include "ext_math.h" +#ifndef __MWERKS__ +s32 rand8(void); +#endif typedef struct { /* 0x00 */ s32 unk00; diff --git a/src/REL/m423Dll/main.c b/src/REL/m423Dll/main.c index 73230752..35628e65 100755 --- a/src/REL/m423Dll/main.c +++ b/src/REL/m423Dll/main.c @@ -9,14 +9,19 @@ #include "game/memory.h" #include "game/minigame_seq.h" #include "game/object.h" +#include "game/objsub.h" #include "game/pad.h" #include "game/process.h" #include "game/sprite.h" #include "game/wipe.h" -#include "dolphin.h" #include "ext_math.h" + +#ifndef __MWERKS__ +#include "game/frand.h" +#endif + #define frand7() (frand() & 0x7F) SHARED_SYM extern u32 GlobalCounter; @@ -4508,7 +4513,6 @@ s32 fn_1_F574(Vec arg0, float arg1, s32 arg2) ModelData *var_r28; StructM423_0B *var_r26; StructM423_0A *var_r31; - s32 var_r27; s32 i; var_r29 = lbl_1_bss_9C; diff --git a/src/REL/m424Dll/ball.c b/src/REL/m424Dll/ball.c index c8c3177e..f0a15594 100644 --- a/src/REL/m424Dll/ball.c +++ b/src/REL/m424Dll/ball.c @@ -4,10 +4,12 @@ #include "game/audio.h" #include "game/chrman.h" #include "game/data.h" +#include "game/frand.h" #include "game/gamework_data.h" #include "game/hsfdraw.h" #include "game/hsfman.h" #include "game/hsfmotion.h" +#include "game/memory.h" #include "game/pad.h" #include "game/sprite.h" #include "string.h" @@ -1084,7 +1086,7 @@ void *fn_1_6078(s32 arg0) if (var_r31 == 0x20) { return NULL; } - lbl_1_bss_5BC[var_r31] = HuMemDirectMallocNum(HEAP_SYSTEM, arg0, 0x10000000); + lbl_1_bss_5BC[var_r31] = HuMemDirectMallocNum(HEAP_SYSTEM, arg0, MEMORY_DEFAULT_NUM); return lbl_1_bss_5BC[var_r31]; } diff --git a/src/REL/m424Dll/claw.c b/src/REL/m424Dll/claw.c index 42d11821..07647127 100644 --- a/src/REL/m424Dll/claw.c +++ b/src/REL/m424Dll/claw.c @@ -1,13 +1,20 @@ #include "REL/m424Dll.h" -#include "math.h" #include "ext_math.h" #include "game/audio.h" #include "game/chrman.h" +#include "game/EnvelopeExec.h" #include "game/gamework_data.h" +#include "game/hsfdraw.h" #include "game/hsfman.h" #include "game/hsfmotion.h" +#include "game/memory.h" #include "game/pad.h" +#include "math.h" + +#ifndef __MWERKS__ +#include "game/frand.h" +#endif // STRUCT typedef struct _M424DllClawStruct { @@ -146,8 +153,8 @@ void fn_1_94D0(omObjData *arg0) s32 var_r29; M424DllClawStruct *var_r31; - var_r31 = arg0->data = HuMemDirectMallocNum(HEAP_SYSTEM, 0x1B0, 0x10000000); - memset(var_r31, 0, 0x1B0); + var_r31 = arg0->data = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(M424DllClawStruct), MEMORY_DEFAULT_NUM); + memset(var_r31, 0, sizeof(M424DllClawStruct)); var_r31->unk0 = lbl_1_bss_24[3]; var_r31->unk2 = GWPlayerCfg[var_r31->unk0].character; var_r31->unk4 = GWPlayerCfg[var_r31->unk0].pad_idx; diff --git a/src/REL/m424Dll/map.c b/src/REL/m424Dll/map.c index 4536b396..5cd4eb0d 100644 --- a/src/REL/m424Dll/map.c +++ b/src/REL/m424Dll/map.c @@ -55,8 +55,8 @@ void fn_1_1BB8(omObjData *arg0) { M424DllMapStruct *var_r30; - var_r30 = arg0->data = HuMemDirectMallocNum(HEAP_SYSTEM, 0x54, 0x10000000); - memset(var_r30, 0, 0x54); + var_r30 = arg0->data = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(M424DllMapStruct), MEMORY_DEFAULT_NUM); + memset(var_r30, 0, sizeof(M424DllMapStruct)); var_r30->unk0 = 0.0f; var_r30->unk4 = 0.0f; var_r30->unk38 = -1; diff --git a/src/REL/m425Dll/main.c b/src/REL/m425Dll/main.c index 69e0b96f..234b169b 100644 --- a/src/REL/m425Dll/main.c +++ b/src/REL/m425Dll/main.c @@ -5,7 +5,6 @@ #include "ext_math.h" #include "game/audio.h" #include "game/chrman.h" -#include "game/esprite.h" #include "game/flag.h" #include "game/frand.h" #include "game/gamework_data.h" @@ -18,9 +17,7 @@ #include "game/object.h" #include "game/objsub.h" #include "game/pad.h" -#include "game/printfunc.h" #include "game/sprite.h" -#include "game/window.h" #include "game/wipe.h" #include "math.h" #include "string.h" @@ -342,8 +339,6 @@ void fn_1_8E4(omObjData *object) s32 var_r30; s32 var_r29; s32 var_r28; - s16 var_r26; - s16 var_r25; switch (lbl_1_bss_648) { case 4: @@ -1455,7 +1450,7 @@ void fn_1_5608(GXColor **arg0, s16 arg1, GXColor *arg2) s32 var_r29; s32 var_r28; - var_r31 = *arg0 = HuMemDirectMallocNum(HEAP_SYSTEM, arg1 * (4 * sizeof(GXColor)), 0x10000000); + var_r31 = *arg0 = HuMemDirectMallocNum(HEAP_SYSTEM, arg1 * (4 * sizeof(GXColor)), MEMORY_DEFAULT_NUM); for (var_r29 = 0; var_r29 < arg1; var_r29++) { for (var_r28 = 0; var_r28 < 4; var_r31++, arg2++, var_r28++) { var_r31->r = arg2->r; @@ -1678,18 +1673,7 @@ float fn_1_66BC(float arg8, float arg9, float argA, float argB) void fn_1_6734(float *arg0, float *arg1, float *arg2, float *arg3, float arg8) { float spC[3]; - float sp8; - float var_f31; - float var_f30; float var_f29; - float var_f28; - float var_f27; - float var_f26; - float var_f25; - float var_f24; - float var_f23; - float var_f22; - float var_f21; s32 var_r31; for (var_r31 = 0; var_r31 < 3; var_r31++) { diff --git a/src/REL/m425Dll/thwomp.c b/src/REL/m425Dll/thwomp.c index bb53d11a..8d58f3b1 100644 --- a/src/REL/m425Dll/thwomp.c +++ b/src/REL/m425Dll/thwomp.c @@ -4,9 +4,6 @@ #include "ext_math.h" #include "game/animdata.h" #include "game/audio.h" -#include "game/chrman.h" -#include "game/esprite.h" -#include "game/flag.h" #include "game/frand.h" #include "game/gamework_data.h" #include "game/hsfanim.h" @@ -14,14 +11,9 @@ #include "game/hsfman.h" #include "game/hsfmotion.h" #include "game/memory.h" -#include "game/minigame_seq.h" #include "game/object.h" #include "game/objsub.h" -#include "game/pad.h" -#include "game/printfunc.h" #include "game/sprite.h" -#include "game/window.h" -#include "game/wipe.h" #include "string.h" #include "REL/m425Dll.h" diff --git a/src/REL/m426Dll/main.c b/src/REL/m426Dll/main.c index 2433e3ac..4f331de3 100644 --- a/src/REL/m426Dll/main.c +++ b/src/REL/m426Dll/main.c @@ -13,6 +13,10 @@ #include "string.h" #include "version.h" +#ifndef __MWERKS__ +#include "game/frand.h" +#endif + typedef struct UnkM426Struct { /* 0x00 */ s32 unk_00; /* 0x04 */ omObjData *unk_04[2]; @@ -799,7 +803,6 @@ void fn_1_16F8(omObjData *object) float var_f26; float var_f25; float var_f24; - float var_f23; float var_f22; float var_f21; @@ -1311,8 +1314,6 @@ void fn_1_2F5C(omObjData *object, float *arg1, float *arg2, s32 *arg3) s32 spC[2]; UnkM426Struct *sp8; - float var_f31; - UnkM426Struct2 *var_r31; s32 var_r30; s32 var_r29; @@ -3122,7 +3123,6 @@ void fn_1_88B4(ModelData *arg0, Mtx arg1) { float var_f31; float var_f30; - float var_f28; float var_f27; float var_f26; diff --git a/src/REL/m427Dll/main.c b/src/REL/m427Dll/main.c index 7031739f..a00ca58c 100644 --- a/src/REL/m427Dll/main.c +++ b/src/REL/m427Dll/main.c @@ -2,6 +2,8 @@ #include "ext_math.h" #include "game/audio.h" +#include "game/chrman.h" +#include "game/frand.h" #include "game/gamework.h" #include "game/gamework_data.h" #include "game/hsfformat.h" @@ -541,7 +543,7 @@ void fn_1_1954(void) { s32 var_r31; M427DllStruct2* var_r30; - var_r30 = HuMemDirectMallocNum(HEAP_SYSTEM, 0xA4, 0x10000000); + var_r30 = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(M427DllStruct2), MEMORY_DEFAULT_NUM); lbl_1_bss_40 = var_r30; var_r30->unk9C = 0; var_r30->unkA0 = 0; @@ -736,7 +738,6 @@ void fn_1_21E8(s32 arg0, s32 arg1) { void fn_1_232C(s32 arg0) { M427DllStruct2* temp_r29; - f32 temp_f0; s32 var_r31; temp_r29 = lbl_1_bss_40; @@ -785,7 +786,6 @@ void fn_1_232C(s32 arg0) { void fn_1_2518(s32 arg0) { M427DllStruct2* temp_r29; - f32 temp_f0; s32 var_r31; temp_r29 = lbl_1_bss_40; diff --git a/src/REL/m427Dll/map.c b/src/REL/m427Dll/map.c index 1f39ac50..5506e4d0 100644 --- a/src/REL/m427Dll/map.c +++ b/src/REL/m427Dll/map.c @@ -388,9 +388,9 @@ void fn_1_32F4(Process *arg0) lbl_1_bss_158.unk0 = 0; lbl_1_bss_548 = omAddObjEx(arg0, 0x7F, 0, 0, -1, fn_1_6760); - lbl_1_bss_F0 = HuMemDirectMallocNum(HEAP_SYSTEM, 0x10 * sizeof(M427DllMapStruct), MEMORY_DEFAULT_NUM); + lbl_1_bss_F0 = HuMemDirectMallocNum(HEAP_SYSTEM, 16 * sizeof(M427DllMapStruct), MEMORY_DEFAULT_NUM); - for (var_r31 = 0; var_r31 < 0x10; var_r31++) { + for (var_r31 = 0; var_r31 < 16; var_r31++) { lbl_1_bss_F0[var_r31].unk2 = -1; } temp_r30 = HuSprAnimRead(HuDataReadNum(0x3A0017, MEMORY_DEFAULT_NUM)); @@ -613,8 +613,8 @@ void fn_1_3E58(omObjData *arg0) var_r29->unk48[0] = 0; var_r29->unk4A = 0; var_r29->unk4 = 0; - lbl_1_bss_E4 = HuMemDirectMallocNum(HEAP_SYSTEM, 0x10 * sizeof(M427DllMapStruct5), MEMORY_DEFAULT_NUM); - for (var_r28 = 0; var_r28 < 0x10; var_r28++) { + lbl_1_bss_E4 = HuMemDirectMallocNum(HEAP_SYSTEM, 16 * sizeof(M427DllMapStruct5), MEMORY_DEFAULT_NUM); + for (var_r28 = 0; var_r28 < 16; var_r28++) { lbl_1_bss_E4[var_r28].unk10 = -1.0f; } fn_1_510C(0, 0x32, 0x32); @@ -629,7 +629,6 @@ void fn_1_4218(omObjData *arg0) M427DllMapStruct5 *var_r31; s16 var_r30; M427DllMapStruct4 *var_r29; - s32 temp_r28; var_r29 = &lbl_1_bss_98; var_r31 = &lbl_1_bss_E4[0]; @@ -798,12 +797,6 @@ void fn_1_50A0(ModelData *arg0, Mtx arg1) void fn_1_510C(s32 arg0, s16 arg1, s16 arg2) { - s16 sp12; - s16 sp10; - s16 spE; - s16 spC; - s16 spA; - s16 sp8; M427DllMapStruct4 *var_r31; M427DllMapSubstruct5 *var_r30; s16 var_r29; @@ -895,11 +888,9 @@ void fn_1_558C(M427DllMapStruct4 *arg0) Vec *var_r29; Vec *var_r28; s16 var_r27; - M427DllMapStruct5 *var_r26; Vec2f *var_r25; s16 var_r24; CameraData *var_r23; - s16 var_r22; var_r23 = &Hu3DCamera[0]; if (lbl_1_data_F8 == -1.0f) { @@ -1112,7 +1103,6 @@ void fn_1_6760(omObjData *object) s16 var_r26; M427DllMapSubstruct3Sub *var_r25; M427DllMapStruct3 *var_r24; - u16 var_r23; var_r24 = &lbl_1_bss_158; Hu3DFogSet(3500.0f, 20000.0f, 0, 0, 0); @@ -2058,7 +2048,6 @@ s16 fn_1_A1F4(s32 arg0, s16 arg1, s16 arg2, s16 arg3, float arg8, Vec *arg4, Vec Vec2f *var_r26; void *var_r25; M427DllMapStruct3 *var_r22; - u16 var_r21; s16 var_r19; void *var_r18; @@ -2799,7 +2788,6 @@ M427DllMapSubstruct6 *fn_1_D4FC(s16 arg0, Vec *arg1, Vec *arg2, float arg8, GXCo s16 fn_1_D63C(AnimData *arg0, s16 arg1, float arg8, s16 arg2, s16 arg3) { - float temp_f0; M427DllMapStruct7 *var_r31; s16 var_r30; Vec2f *var_r29; diff --git a/src/REL/m427Dll/player.c b/src/REL/m427Dll/player.c index 77791864..1d28252d 100644 --- a/src/REL/m427Dll/player.c +++ b/src/REL/m427Dll/player.c @@ -6,18 +6,15 @@ #include "ext_math.h" #include "game/audio.h" #include "game/chrman.h" -#include "game/gamework.h" #include "game/gamework_data.h" #include "game/hsfdraw.h" #include "game/hsfformat.h" #include "game/hsfman.h" #include "game/hsfmotion.h" #include "game/memory.h" -#include "game/minigame_seq.h" #include "game/object.h" #include "game/objsub.h" #include "game/pad.h" -#include "game/wipe.h" #include "string.h" #ifndef __MWERKS__ @@ -1460,26 +1457,6 @@ void fn_1_12580(omObjData *var_r24) void fn_1_12B08(void) { Vec sp20; - float sp1C; - float sp18; - float sp14; - float sp10; - float spC; - float sp8; - float var_f31; - float var_f30; - float var_f29; - float var_f28; - float var_f27; - float var_f26; - float var_f25; - float var_f24; - float var_f23; - float var_f22; - float var_f21; - float var_f20; - float var_f19; - float var_f18; M427DllBss590Struct *var_r31; s32 var_r30; M427DllBss57CStruct *var_r29; @@ -1593,10 +1570,10 @@ void fn_1_12B08(void) lbl_1_bss_558 = lbl_1_data_260; lbl_1_bss_554 = lbl_1_data_3BC; lbl_1_bss_550 = lbl_1_bss_584; - var_r29 = HuMemDirectMallocNum(HEAP_SYSTEM, 0x40 * sizeof(M427DllBss57CStruct), MEMORY_DEFAULT_NUM); + var_r29 = HuMemDirectMallocNum(HEAP_SYSTEM, 64 * sizeof(M427DllBss57CStruct), MEMORY_DEFAULT_NUM); lbl_1_bss_57C = var_r29; - memset(lbl_1_bss_57C, 0, 0x40 * sizeof(M427DllBss57CStruct)); - for (var_r30 = 0; var_r30 < 0x40; var_r30++, var_r29++) { + memset(lbl_1_bss_57C, 0, 64 * sizeof(M427DllBss57CStruct)); + for (var_r30 = 0; var_r30 < 64; var_r30++, var_r29++) { var_r29->unk_00 = var_r30; var_r29->unk_04 = -1; var_r29->unk_08 = -1; @@ -1849,9 +1826,6 @@ s32 fn_1_154BC(float arg8, float arg9, float argA) s32 fn_1_155E0(float arg8, float arg9, float argA, float *arg0) { float var_f31; - float var_f30; - double var_f29; - double var_f28; M427DllBss590Struct *var_r31; s32 var_r30; M427DllBss590Struct *var_r29; @@ -2138,7 +2112,6 @@ float fn_1_166AC(float arg8, float arg9, float argA) { float var_f31; float var_f30; - float var_f26; if (arg8 >= 360.0) { arg8 -= 360.0; diff --git a/src/REL/m428Dll/main.c b/src/REL/m428Dll/main.c index f6610719..170625b0 100644 --- a/src/REL/m428Dll/main.c +++ b/src/REL/m428Dll/main.c @@ -4,7 +4,6 @@ #include "game/audio.h" #include "game/chrman.h" #include "game/gamework_data.h" -#include "game/hsfanim.h" #include "game/hsfdraw.h" #include "game/hsfman.h" #include "game/hsfmotion.h" @@ -12,9 +11,7 @@ #include "game/minigame_seq.h" #include "game/object.h" #include "game/objsub.h" -#include "game/pad.h" #include "game/sprite.h" -#include "game/window.h" #include "game/wipe.h" #include "string.h" diff --git a/src/REL/m428Dll/map.c b/src/REL/m428Dll/map.c index 925c04bc..df9739e3 100644 --- a/src/REL/m428Dll/map.c +++ b/src/REL/m428Dll/map.c @@ -1,23 +1,13 @@ #include "dolphin/gx/GXEnum.h" #include "dolphin/gx/GXVert.h" #include "ext_math.h" -#include "game/audio.h" -#include "game/chrman.h" -#include "game/gamework_data.h" #include "game/hsfanim.h" -#include "game/hsfdraw.h" #include "game/hsfformat.h" #include "game/hsfman.h" -#include "game/hsfmotion.h" -#include "game/init.h" #include "game/memory.h" -#include "game/minigame_seq.h" #include "game/object.h" #include "game/objsub.h" -#include "game/pad.h" #include "game/sprite.h" -#include "game/window.h" -#include "game/wipe.h" #include "string.h" #include "REL/m428Dll.h" @@ -565,8 +555,6 @@ void fn_1_5CCC(HsfData *var_r31, HsfObject *var_r23) void fn_1_6280(ModelData *arg1, ParticleData *particle, Mtx matrix) { - s32 sp3C; - s32 sp38; Vec sp8; float var_f31; float var_f30; @@ -1131,7 +1119,6 @@ void fn_1_939C(float *arg0, float (*arg1)[3], float (*arg2)[3], s32 var_r28) float spD4[16]; float sp94[16]; Vec sp8; - s32 var_r31; s32 var_r30; s32 var_r27; diff --git a/src/REL/m428Dll/player.c b/src/REL/m428Dll/player.c index bcef87c9..cff1d27b 100644 --- a/src/REL/m428Dll/player.c +++ b/src/REL/m428Dll/player.c @@ -9,15 +9,11 @@ #include "game/hsfload.h" #include "game/hsfman.h" #include "game/hsfmotion.h" -#include "game/init.h" #include "game/memory.h" -#include "game/minigame_seq.h" #include "game/object.h" #include "game/objsub.h" #include "game/pad.h" #include "game/sprite.h" -#include "game/window.h" -#include "game/wipe.h" #include "string.h" #include "REL/m428Dll.h" @@ -973,8 +969,6 @@ void fn_1_BBD0(omObjData *object) float var_f31; float var_f30; float var_f27; - float var_f26; - float var_f25; float var_f24; float var_f23; float var_f22; diff --git a/src/REL/m429Dll/main.c b/src/REL/m429Dll/main.c index 2ae49cb2..6fb1ab01 100644 --- a/src/REL/m429Dll/main.c +++ b/src/REL/m429Dll/main.c @@ -1,28 +1,33 @@ #include "REL/executor.h" #include "game/chrman.h" #include "game/frand.h" -#include "game/minigame_seq.h" -#include "game/object.h" -#include "game/objsub.h" -#include "game/wipe.h" - -#include "game/gamework_data.h" - -#include "game/mapspace.h" -#include "game/pad.h" -#include "game/printfunc.h" - +#include "game/esprite.h" #include "game/hsfanim.h" #include "game/hsfdraw.h" #include "game/hsfman.h" #include "game/hsfmotion.h" - -#include "game/esprite.h" +#include "game/gamework.h" +#include "game/gamework_data.h" +#include "game/mapspace.h" +#include "game/minigame_seq.h" +#include "game/object.h" +#include "game/objsub.h" +#include "game/pad.h" +#include "game/printfunc.h" #include "game/sprite.h" +#include "game/wipe.h" #include "ext_math.h" #include "version.h" + +#ifndef __MWERKS__ +#include "game/audio.h" +#include "game/hsfex.h" +#endif + +void HuSysVWaitSet(s16 vcount); + #undef ABS #define ABS(x) ((0 > (x)) ? -(x) : (x)) @@ -1501,8 +1506,6 @@ void fn_1_50AC(Work8F68 *arg0, omObjData *arg1) void fn_1_54BC(Work8F68 *arg0, omObjData *arg1) { float temp_f31; - float temp_f30; - float temp_f29; Vec sp14; Vec sp8; omObjData *temp_r29; @@ -1618,7 +1621,6 @@ void fn_1_595C(Work8F68 *arg0, Work8F68 *arg1) s32 fn_1_5CDC(Work8F68 *arg0) { - s32 temp_r30; s32 temp_r29; s32 temp_r28; Work3284 *temp_r27; diff --git a/src/REL/m430Dll/main.c b/src/REL/m430Dll/main.c index d848689f..c52b221d 100644 --- a/src/REL/m430Dll/main.c +++ b/src/REL/m430Dll/main.c @@ -2,20 +2,15 @@ #include "game/audio.h" #include "game/chrman.h" #include "game/flag.h" -#include "game/frand.h" #include "game/gamework_data.h" #include "game/hsfanim.h" #include "game/hsfdraw.h" #include "game/hsfman.h" -#include "game/hsfmotion.h" #include "game/memory.h" #include "game/minigame_seq.h" #include "game/object.h" #include "game/objsub.h" -#include "game/pad.h" -#include "game/printfunc.h" #include "game/sprite.h" -#include "game/window.h" #include "game/wipe.h" #include "string.h" @@ -499,10 +494,6 @@ float fn_1_4130(void) void fn_1_41F0(Vec *arg0, Vec *arg1) { Vec sp10; - float var_f29; - float var_f28; - float var_f27; - float var_f26; sp10.x = arg1->x - arg0->x; sp10.y = arg1->y - arg0->y; diff --git a/src/REL/m430Dll/player.c b/src/REL/m430Dll/player.c index 06e689f2..7010b15b 100644 --- a/src/REL/m430Dll/player.c +++ b/src/REL/m430Dll/player.c @@ -11,14 +11,10 @@ #include "game/hsfman.h" #include "game/hsfmotion.h" #include "game/memory.h" -#include "game/minigame_seq.h" #include "game/object.h" #include "game/objsub.h" #include "game/pad.h" -#include "game/printfunc.h" #include "game/sprite.h" -#include "game/window.h" -#include "game/wipe.h" #include "string.h" #include "REL/m430Dll.h" @@ -785,11 +781,6 @@ void fn_1_D828(omObjData *var_r30) float var_f25; float var_f24; float var_f23; - float var_f22; - float var_f21; - float var_f20; - float var_f19; - float var_f18; M430PlayerWork *var_r31; M430PlayerBss174Struct *var_r29; s32 var_r28; @@ -1262,12 +1253,6 @@ s32 fn_1_F62C(omObjData *object) void fn_1_F6A0(omObjData *object) { Vec sp38; - float sp30; - float sp28; - float sp20; - float sp18; - float sp10; - float sp8; float var_f31; float var_f30; float var_f29; @@ -1275,13 +1260,6 @@ void fn_1_F6A0(omObjData *object) float var_f27; float var_f26; float var_f25; - float var_f24; - float var_f23; - float var_f22; - float var_f21; - float var_f20; - float var_f19; - float var_f18; M430PlayerWork *work; s32 var_r29; s32 var_r28; @@ -1655,9 +1633,9 @@ void fn_1_10B88(void) M430PlayerBss16CStruct *var_r31; s32 var_r30; - var_r31 = lbl_1_bss_16C = HuMemDirectMallocNum(HEAP_SYSTEM, 0x10 * sizeof(M430PlayerBss16CStruct), MEMORY_DEFAULT_NUM); - memset(var_r31, 0, 0x10 * sizeof(M430PlayerBss16CStruct)); - for (var_r30 = 0; var_r30 < 0x10; var_r30++, var_r31++) { + var_r31 = lbl_1_bss_16C = HuMemDirectMallocNum(HEAP_SYSTEM, 16 * sizeof(M430PlayerBss16CStruct), MEMORY_DEFAULT_NUM); + memset(var_r31, 0, 16 * sizeof(M430PlayerBss16CStruct)); + for (var_r30 = 0; var_r30 < 16; var_r30++, var_r31++) { var_r31->unk_00 = var_r30; if (var_r30 == 0) { var_r31->unk_04 = Hu3DModelCreateFile(DATA_MAKE_NUM(DATADIR_M430, 0x23)); @@ -1832,9 +1810,9 @@ void fn_1_113AC(void) M430PlayerBss168Struct *var_r31; s32 var_r30; - var_r31 = lbl_1_bss_168 = HuMemDirectMallocNum(HEAP_SYSTEM, 0x20 * sizeof(M430PlayerBss168Struct), MEMORY_DEFAULT_NUM); - memset(var_r31, 0, 0x20 * sizeof(M430PlayerBss168Struct)); - for (var_r30 = 0; var_r30 < 0x20; var_r31++) { + var_r31 = lbl_1_bss_168 = HuMemDirectMallocNum(HEAP_SYSTEM, 32 * sizeof(M430PlayerBss168Struct), MEMORY_DEFAULT_NUM); + memset(var_r31, 0, 32 * sizeof(M430PlayerBss168Struct)); + for (var_r30 = 0; var_r30 < 32; var_r31++) { var_r31->unk_00 = var_r30; if (var_r30 == 0) { var_r31->unk_04 = Hu3DModelCreateFile(DATA_MAKE_NUM(DATADIR_M430, 0x22)); diff --git a/src/REL/m430Dll/water.c b/src/REL/m430Dll/water.c index 6b802aa2..e3924951 100644 --- a/src/REL/m430Dll/water.c +++ b/src/REL/m430Dll/water.c @@ -4,27 +4,19 @@ #include "ext_math.h" #include "game/audio.h" #include "game/chrman.h" -#include "game/flag.h" #include "game/gamework_data.h" #include "game/hsfanim.h" -#include "game/hsfdraw.h" #include "game/hsfman.h" #include "game/hsfmotion.h" #include "game/memory.h" -#include "game/minigame_seq.h" #include "game/object.h" #include "game/objsub.h" -#include "game/pad.h" -#include "game/printfunc.h" #include "game/sprite.h" -#include "game/window.h" -#include "game/wipe.h" #include "string.h" #include "REL/m430Dll.h" #ifndef __MWERKS__ -#include "game/esprite.h" #include "game/frand.h" void GXSetTevIndWarp(GXTevStageID tev_stage, GXIndTexStageID ind_stage, GXBool signed_offsets, GXBool replace_mode, GXIndTexMtxID matrix_sel); @@ -733,7 +725,6 @@ void fn_1_732C(omObjData *object, M430DllUnkStruct2 *arg1) Vec sp8; float var_f31; float var_f30; - float var_f29; s32 var_r30; s32 var_r29; s32 var_r28; @@ -1509,8 +1500,6 @@ void fn_1_A3A8(ModelData *model, Mtx matrix) Mtx sp18; float var_f31; float var_f30; - u8 *var_r30; - u8 *var_r29; GXColor sp14 = { 0xFF, 0xA5, 0x59, 0xB2 }; GXColor sp10 = { 0x99, 0x72, 0x59, 0xB2 }; diff --git a/src/REL/m431Dll/main.c b/src/REL/m431Dll/main.c index 243604cf..b48e8efa 100644 --- a/src/REL/m431Dll/main.c +++ b/src/REL/m431Dll/main.c @@ -17,6 +17,8 @@ #include "REL/m431Dll.h" #include "version.h" +s32 rand8(void); + typedef struct bss_5C_struct { s16 unk0[6]; s16 unkC[2]; diff --git a/src/REL/m431Dll/object.c b/src/REL/m431Dll/object.c index aaa65ed0..4e86c54f 100644 --- a/src/REL/m431Dll/object.c +++ b/src/REL/m431Dll/object.c @@ -1,20 +1,19 @@ +#include "game/audio.h" #include "game/chrman.h" #include "game/hsfman.h" #include "game/hsfmotion.h" - -#include "game/audio.h" #include "game/gamework_data.h" -#include "game/minigame_seq.h" #include "game/object.h" #include "game/objsub.h" #include "game/pad.h" #include "game/sprite.h" -#include "game/wipe.h" #include "REL/m431Dll.h" #include "ext_math.h" #include "version.h" +s32 rand8(void); + typedef struct bss_struct_62C { u8 unk0; float unk4; diff --git a/src/REL/m432Dll/main.c b/src/REL/m432Dll/main.c index af6c4fe6..15e2894b 100644 --- a/src/REL/m432Dll/main.c +++ b/src/REL/m432Dll/main.c @@ -1,5 +1,4 @@ #include "REL/executor.h" -#include "dolphin/types.h" #include "game/chrman.h" #include "game/frand.h" #include "game/memory.h" @@ -1358,8 +1357,6 @@ void fn_1_5848(UnkM432DllStruct *var_r28, UnkM432DllBss0SubStruct *var_r31) s32 sp20; float var_f31; float var_f30; - float var_f29; - float var_f28; s32 var_r30; s32 var_r27; @@ -2246,8 +2243,6 @@ void fn_1_B234(void) { UnkM432DllStruct *var_r31; s32 var_r30; - u32 var_r29; - u32 var_r28; if (HuPadBtn[0] & 2) { lbl_1_bss_57C = 300 * REFRESH_RATE; @@ -2303,12 +2298,7 @@ void fn_1_B518(omObjData *object) void fn_1_B7E4(omObjData *object) { UnkM432DllStruct2 *var_r30; - UnkBss5D0Struct *var_r29; - UnkBss5D0Struct *var_r28; - UnkBss5D0Struct *var_r27; s16 var_r26; - s16 var_r25; - s16 var_r24; var_r26 = fn_1_AC(0x1000); if (var_r26 < 0) { @@ -2338,7 +2328,7 @@ void fn_1_B974(Vec *arg0, float arg8, float arg9) if (lbl_1_bss_402 < 0xF0) { lbl_1_bss_402++; var_r30 = omAddObjEx(lbl_1_bss_5B4, 0x67, 1, 0, 3, fn_1_B7E4); - var_r30->data = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(UnkM432DllStruct2), 0x10000000); + var_r30->data = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(UnkM432DllStruct2), MEMORY_DEFAULT_NUM); var_r31 = var_r30->data; var_r31->unk_00 = *arg0; var_r31->unk_00.x += 30.0f * arg9; @@ -2483,17 +2473,9 @@ void fn_1_C33C(UnkM432DllStruct *arg0) void fn_1_C724(UnkM432DllStruct *var_r31, omObjData *var_r25, omObjData *var_r24) { - Vec spC; float var_f25; - UnkBss0Struct *var_r30; - UnkM432DllStruct *var_r29; - s32 var_r28; - void *var_r27; - s32 var_r26; - float var_f19; - - var_r30 = &lbl_1_bss_0[var_r31->unk_184 >> 1]; + UnkBss0Struct *var_r30 = &lbl_1_bss_0[var_r31->unk_184 >> 1]; fn_1_BF9C(var_r31); if (fn_1_BF08(var_r31) == 0x7D4) { var_r30->unk_1D4 += 1.0f - (2.0f * (var_r31->unk_14C / REFRESH_RATE)); @@ -3057,11 +3039,7 @@ void fn_1_10CCC(omObjData *object) UnkM432DllStruct *var_r31; s32 var_r29; - s32 var_r28; - s32 var_r27; UnkM432DllBss0SubStruct *var_r26; - s32 var_r24; - s32 var_r23; var_r31 = object->data; var_r26 = lbl_1_bss_0[var_r31->unk_184 >> 1].unk_10[var_r31->unk_184 & 1]; @@ -3265,13 +3243,7 @@ void fn_1_128C8(omObjData *object) s32 var_r31; UnkM432DllStruct *var_r30; UnkM432DllStruct *var_r29; - s32 var_r28; - s32 var_r27; - void *var_r26; - void *var_r25; omObjData *var_r24; - void *var_r23; - void *var_r22; if (lbl_1_bss_41C->work[0] >= 0x3EB) { for (var_r31 = 0; var_r31 < 2; var_r31++) { @@ -3375,8 +3347,6 @@ void fn_1_131A8(omObjData *var_r28) float var_f30; float var_f27; float var_f26; - float var_f22; - float var_f21; UnkBss0Struct *var_r29; s32 var_r26; @@ -3622,7 +3592,6 @@ void fn_1_131A8(omObjData *var_r28) void fn_1_15320(omObjData *object) { - s32 var_r31; object->work[0] = 0x3E8; fn_1_B4C(80.0f, DATA_MAKE_NUM(DATADIR_M432, 0x1E)); fn_1_9EC(); @@ -3633,17 +3602,12 @@ void fn_1_15320(omObjData *object) void ObjectSetup(void) { Vec sp8; - float var_f31; - float var_f30; - float var_f29; - UnkBss0Struct *var_r31; s32 var_r30; float *var_r29; UnkM432DllStruct *var_r28; omObjData *var_r27; s32 var_r26; - s32 var_r24; s32 var_r23; s32 var_r22; s32 var_r21; diff --git a/src/REL/m433Dll/main.c b/src/REL/m433Dll/main.c index 6e36fe20..425e62ab 100644 --- a/src/REL/m433Dll/main.c +++ b/src/REL/m433Dll/main.c @@ -3,15 +3,11 @@ #include "game/chrman.h" #include "game/gamework_data.h" #include "game/hsfanim.h" -#include "game/hsfdraw.h" #include "game/hsfman.h" -#include "game/hsfmotion.h" #include "game/minigame_seq.h" #include "game/object.h" #include "game/objsub.h" -#include "game/pad.h" #include "game/sprite.h" -#include "game/window.h" #include "game/wipe.h" #include "string.h" diff --git a/src/REL/m433Dll/map.c b/src/REL/m433Dll/map.c index 40aab323..162905a1 100644 --- a/src/REL/m433Dll/map.c +++ b/src/REL/m433Dll/map.c @@ -2,23 +2,15 @@ #include "ext_math.h" #include "game/audio.h" #include "game/chrman.h" -#include "game/flag.h" #include "game/frand.h" #include "game/gamework_data.h" #include "game/hsfanim.h" -#include "game/hsfdraw.h" #include "game/hsfman.h" #include "game/hsfmotion.h" #include "game/memory.h" -#include "game/minigame_seq.h" #include "game/object.h" #include "game/objsub.h" -#include "game/pad.h" -#include "game/printfunc.h" #include "game/sprite.h" -#include "game/window.h" -#include "game/wipe.h" -#include "string.h" #include "REL/m433Dll.h" diff --git a/src/REL/m433Dll/player.c b/src/REL/m433Dll/player.c index b6ef317c..afe2dd50 100644 --- a/src/REL/m433Dll/player.c +++ b/src/REL/m433Dll/player.c @@ -3,21 +3,16 @@ #include "ext_math.h" #include "game/audio.h" #include "game/chrman.h" -#include "game/flag.h" #include "game/gamework_data.h" #include "game/hsfanim.h" #include "game/hsfdraw.h" #include "game/hsfman.h" #include "game/hsfmotion.h" #include "game/memory.h" -#include "game/minigame_seq.h" #include "game/object.h" #include "game/objsub.h" #include "game/pad.h" -#include "game/printfunc.h" #include "game/sprite.h" -#include "game/window.h" -#include "game/wipe.h" #include "string.h" #include "REL/m433Dll.h" @@ -3456,9 +3451,7 @@ s32 fn_1_10D24(Vec *sp8) Vec sp18; Vec spC; float var_f31; - float var_f30; M433PlayerWork2 *var_r31; - M433PlayerWork2 *var_r30; var_r31 = lbl_1_bss_7CC->data; fn_1_10D24_inline(&spC); diff --git a/src/REL/m434Dll/fish.c b/src/REL/m434Dll/fish.c index b5940faa..ebd0649c 100644 --- a/src/REL/m434Dll/fish.c +++ b/src/REL/m434Dll/fish.c @@ -3,16 +3,14 @@ #include "game/hsfmotion.h" #include "game/object.h" #include "game/objsub.h" -#include "game/wipe.h" - #include "REL/m434Dll.h" #include "ext_math.h" -#include "game/gamework_data.h" -#include "game/minigame_seq.h" -#include "math.h" #include "version.h" +#ifndef __MWERKS__ +#include "game/frand.h" +#endif typedef struct bss_7480_struct { s32 unk0; diff --git a/src/REL/m434Dll/map.c b/src/REL/m434Dll/map.c index d533a43f..49c27901 100644 --- a/src/REL/m434Dll/map.c +++ b/src/REL/m434Dll/map.c @@ -3,17 +3,12 @@ #include "game/object.h" #include "game/objsub.h" -#include "game/audio.h" #include "game/frand.h" #include "game/hsfmotion.h" #include "game/sprite.h" -#include "game/wipe.h" #include "REL/m434Dll.h" #include "ext_math.h" -#include "game/gamework_data.h" -#include "game/minigame_seq.h" -#include "math.h" #include "version.h" typedef struct bss_2468_data { diff --git a/src/REL/m434Dll/player.c b/src/REL/m434Dll/player.c index 55ae04c8..1bf45c71 100644 --- a/src/REL/m434Dll/player.c +++ b/src/REL/m434Dll/player.c @@ -3,19 +3,18 @@ #include "game/hsfman.h" #include "game/hsfdraw.h" #include "game/hsfmotion.h" +#include "game/gamework_data.h" #include "game/object.h" #include "game/objsub.h" #include "game/pad.h" -#include "game/wipe.h" - - -#include "REL/m434Dll.h" #include "ext_math.h" -#include "game/gamework_data.h" -#include "game/minigame_seq.h" -#include "math.h" #include "version.h" +#include "REL/m434Dll.h" + +#ifndef __MWERKS__ +#include "game/frand.h" +#endif typedef struct data_224_struct { u16 unk0; diff --git a/src/REL/m435Dll/main.c b/src/REL/m435Dll/main.c index 5017ca2d..996a0a69 100755 --- a/src/REL/m435Dll/main.c +++ b/src/REL/m435Dll/main.c @@ -4,6 +4,8 @@ #include "game/esprite.h" #include "game/gamework.h" #include "game/gamework_data.h" +#include "game/hsfdraw.h" +#include "game/hsfex.h" #include "game/hsfman.h" #include "game/hsfmotion.h" #include "game/minigame_seq.h" @@ -17,6 +19,11 @@ #include "ext_math.h" +s32 rand8(void); +#ifndef __MWERKS__ +#include "game/audio.h" +#endif + typedef struct { /* 0x00 */ omObjData* unk00; /* 0x04 */ s32 unk04; diff --git a/src/REL/m436Dll/main.c b/src/REL/m436Dll/main.c index c53181f1..44a7ea82 100755 --- a/src/REL/m436Dll/main.c +++ b/src/REL/m436Dll/main.c @@ -1,6 +1,7 @@ #include "REL/m436Dll.h" #include "game/chrman.h" #include "game/data.h" +#include "game/gamework.h" #include "game/gamework_data.h" #include "game/hsfdraw.h" #include "game/hsfman.h" @@ -16,6 +17,11 @@ #include "ext_math.h" #include "version.h" +s32 rand8(void); +#ifndef __MWERKS__ +#include "game/audio.h" +#endif + typedef struct { /* 0x00 */ omObjData *unk00; /* 0x04 */ s32 unk04; diff --git a/src/REL/m437Dll/main.c b/src/REL/m437Dll/main.c index 56921de4..fa14307a 100755 --- a/src/REL/m437Dll/main.c +++ b/src/REL/m437Dll/main.c @@ -15,11 +15,15 @@ #include "game/window.h" #include "game/wipe.h" -#include "dolphin.h" #include "math.h" #include "string.h" #include "version.h" +s32 rand8(void); +#ifndef __MWERKS__ +#include "game/audio.h" +#endif + typedef struct { /* 0x000 */ omObjData *unk00; /* 0x004 */ s32 unk04; diff --git a/src/REL/m438Dll/fire.c b/src/REL/m438Dll/fire.c index ce18b639..d105fa64 100644 --- a/src/REL/m438Dll/fire.c +++ b/src/REL/m438Dll/fire.c @@ -1,6 +1,7 @@ #include "REL/m438Dll.h" #include "game/hsfdraw.h" +#include "game/memory.h" #define HUSPR_USE_OLD_DEFS #include "game/sprite.h" @@ -25,10 +26,10 @@ void fn_1_E658(s16 arg0, s16 arg1) lbl_1_bss_DE4.unk_34 = Hu3DHookFuncCreate(fn_1_F538); Hu3DModelLayerSet(lbl_1_bss_DE4.unk_34, 6); lbl_1_bss_DE4.unk_30 = arg0; - var_r29 = HuMemDirectMallocNum(HEAP_SYSTEM, arg0 * sizeof(M438UnkStruct2), 0x10000000); + var_r29 = HuMemDirectMallocNum(HEAP_SYSTEM, arg0 * sizeof(M438UnkStruct2), MEMORY_DEFAULT_NUM); lbl_1_bss_DE4.unk_40 = var_r29; lbl_1_bss_DE4.unk_32 = arg1; - var_r30 = HuMemDirectMallocNum(HEAP_SYSTEM, arg1 * sizeof(M438UnkStruct3), 0x10000000); + var_r30 = HuMemDirectMallocNum(HEAP_SYSTEM, arg1 * sizeof(M438UnkStruct3), MEMORY_DEFAULT_NUM); lbl_1_bss_DE4.unk_3C = var_r30; for (var_r31 = 0; var_r31 < arg0; var_r31++, var_r29++) { @@ -335,7 +336,7 @@ void fn_1_F6C8(M438FireStruct **arg0, s16 arg1, f32 arg8, f32 arg9) s32 var_r30; M438FireStruct *var_r31; - var_r31 = *arg0 = HuMemDirectMallocNum(HEAP_SYSTEM, arg1 * sizeof(M438FireStruct), 0x10000000); + var_r31 = *arg0 = HuMemDirectMallocNum(HEAP_SYSTEM, arg1 * sizeof(M438FireStruct), MEMORY_DEFAULT_NUM); for (var_r30 = 0; var_r30 < arg1; var_r31++, var_r30++) { var_r31->unk0.x = (-0.5f * arg8); @@ -359,7 +360,7 @@ void fn_1_F84C(M438FireStruct **arg0, s16 arg1, Vec *arg2) s32 var_r29; s32 var_r28; - var_r31 = (Vec *)*arg0 = HuMemDirectMallocNum(HEAP_SYSTEM, arg1 * sizeof(M438FireStruct), 0x10000000); + var_r31 = (Vec *)*arg0 = HuMemDirectMallocNum(HEAP_SYSTEM, arg1 * sizeof(M438FireStruct), MEMORY_DEFAULT_NUM); for (var_r29 = 0; var_r29 < arg1; var_r29++) { for (var_r28 = 0; var_r28 < 4; var_r31++, arg2++, var_r28++) { @@ -376,7 +377,7 @@ void fn_1_F8EC(M438FireStruct2 **arg0, s16 arg1, GXColor *arg2) s32 var_r29; s32 var_r28; - var_r31 = (GXColor *)*arg0 = HuMemDirectMallocNum(HEAP_SYSTEM, arg1 * sizeof(M438FireStruct2), 0x10000000U); + var_r31 = (GXColor *)*arg0 = HuMemDirectMallocNum(HEAP_SYSTEM, arg1 * sizeof(M438FireStruct2), MEMORY_DEFAULT_NUM); for (var_r29 = 0; var_r29 < arg1; var_r29++) { for (var_r28 = 0; var_r28 < 4; var_r31++, arg2++, var_r28++) { @@ -393,7 +394,7 @@ void fn_1_F994(Vec **arg0, s16 arg1, Vec *arg2) s32 var_r29; Vec *var_r31; - var_r31 = *arg0 = HuMemDirectMallocNum(HEAP_SYSTEM, arg1 * sizeof(Vec), 0x10000000); + var_r31 = *arg0 = HuMemDirectMallocNum(HEAP_SYSTEM, arg1 * sizeof(Vec), MEMORY_DEFAULT_NUM); for (var_r29 = 0; var_r29 < arg1; var_r31++, arg2++, var_r29++) { var_r31->x = arg2->x; @@ -408,7 +409,7 @@ void fn_1_FA20(M438FireStruct3 **arg0, s16 arg1, HsfVector2f *arg2) s32 var_r29; s32 var_r28; - var_r31 = (HsfVector2f *)*arg0 = HuMemDirectMallocNum(HEAP_SYSTEM, arg1 * sizeof(M438FireStruct3), 0x10000000); + var_r31 = (HsfVector2f *)*arg0 = HuMemDirectMallocNum(HEAP_SYSTEM, arg1 * sizeof(M438FireStruct3), MEMORY_DEFAULT_NUM); for (var_r29 = 0; var_r29 < arg1; var_r29++) { for (var_r28 = 0; var_r28 < 4; var_r31++, arg2++, var_r28++) { @@ -595,15 +596,15 @@ s16 fn_1_10258(u8 arg0, u8 arg1) var_r31->unk_30 = NULL; var_r31->unk_02 = arg0; var_r31->unk_04 = arg1; - var_r30 = HuMemDirectMallocNum(HEAP_SYSTEM, arg0 * 0x98, MEMORY_DEFAULT_NUM); + var_r30 = HuMemDirectMallocNum(HEAP_SYSTEM, arg0 * sizeof(M438UnkStruct), MEMORY_DEFAULT_NUM); var_r31->unk_3C = var_r30; - var_r31->unk_34 = HuMemDirectMallocNum(HEAP_SYSTEM, arg1 * 2, MEMORY_DEFAULT_NUM); + var_r31->unk_34 = HuMemDirectMallocNum(HEAP_SYSTEM, arg1 * sizeof(s16), MEMORY_DEFAULT_NUM); var_r31->unk_48 = 0; var_r31->unk_4C = HuMemDirectMallocNum(HEAP_SYSTEM, arg0 << 8, MEMORY_DEFAULT_NUM); - var_r31->unk_50 = HuMemDirectMallocNum(HEAP_SYSTEM, arg0 * 0x30, MEMORY_DEFAULT_NUM); - var_r31->unk_54 = HuMemDirectMallocNum(HEAP_SYSTEM, arg0 * 0x10, MEMORY_DEFAULT_NUM); - var_r31->unk_58 = HuMemDirectMallocNum(HEAP_SYSTEM, arg0 * 0xC, MEMORY_DEFAULT_NUM); - var_r31->unk_5C = HuMemDirectMallocNum(HEAP_SYSTEM, arg1 * (arg0 * 0x30), MEMORY_DEFAULT_NUM); + var_r31->unk_50 = HuMemDirectMallocNum(HEAP_SYSTEM, arg0 * (4 * sizeof(Vec)), MEMORY_DEFAULT_NUM); + var_r31->unk_54 = HuMemDirectMallocNum(HEAP_SYSTEM, arg0 * (4 * sizeof(GXColor)), MEMORY_DEFAULT_NUM); + var_r31->unk_58 = HuMemDirectMallocNum(HEAP_SYSTEM, arg0 * sizeof(Vec), MEMORY_DEFAULT_NUM); + var_r31->unk_5C = HuMemDirectMallocNum(HEAP_SYSTEM, arg1 * (arg0 * sizeof(M438UnkSubStruct)), MEMORY_DEFAULT_NUM); DCFlushRangeNoSync(var_r31->unk_4C, arg0 << 8); var_r31->unk_0C.x = var_r31->unk_0C.y = var_r31->unk_0C.z = 0.0f; var_r31->unk_18.x = var_r31->unk_18.y = var_r31->unk_18.z = 0.0f; @@ -657,7 +658,7 @@ s16 fn_1_10258(u8 arg0, u8 arg1) var_r31->unk_48 += var_r30->unk_3C; } temp_r25 = var_r31->unk_4C; - var_r31->unk_4C = HuMemDirectMallocNum(HEAP_SYSTEM, var_r31->unk_48, 0x10000000); + var_r31->unk_4C = HuMemDirectMallocNum(HEAP_SYSTEM, var_r31->unk_48, MEMORY_DEFAULT_NUM); memcpy(var_r31->unk_4C, temp_r25, var_r31->unk_48); HuMemDirectFree(temp_r25); DCFlushRangeNoSync(var_r31->unk_50, arg0 * 0x30); @@ -749,11 +750,11 @@ s16 fn_1_10910(u32 arg0, s16 arg1, s16 arg2) var_r31->unk_06 = 1; if (((arg0 & 0xFFFF0000) + 0x10000) == 0) { var_r30 = HuSprAnimMake(arg1, arg2, 2); - var_r30->bmp->data = HuMemDirectMallocNum(HEAP_SYSTEM, arg2 * (arg1 * 2), 0x10000000); + var_r30->bmp->data = HuMemDirectMallocNum(HEAP_SYSTEM, arg2 * (arg1 * 2), MEMORY_DEFAULT_NUM); arg1 = arg2 = 0; } else { - var_r30 = HuSprAnimRead(HuDataReadNum(arg0, 0x10000000)); + var_r30 = HuSprAnimRead(HuDataReadNum(arg0, MEMORY_DEFAULT_NUM)); } if ((arg1 == 0) || (arg2 == 0)) { arg1 = var_r30->bmp->sizeX; @@ -798,7 +799,7 @@ void fn_1_10CB8(s16 arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5) HuSprAnimKill(temp_r31->unk_00); temp_r31->unk_08 |= 0xFFFF0000; temp_r30 = HuSprAnimMake(arg2, arg3, arg1); - temp_r30->bmp->data = HuMemDirectMallocNum(HEAP_SYSTEM, arg3 * (temp_r30->bmp->pixSize * arg2), 0x10000000U); + temp_r30->bmp->data = HuMemDirectMallocNum(HEAP_SYSTEM, arg3 * (temp_r30->bmp->pixSize * arg2), MEMORY_DEFAULT_NUM); var_f31 = arg4 / (f32)temp_r30->bmp->sizeX; var_f30 = arg5 / (f32)temp_r30->bmp->sizeY; temp_r31->unk_00 = temp_r30; diff --git a/src/REL/m438Dll/main.c b/src/REL/m438Dll/main.c index 861c653d..18b50662 100644 --- a/src/REL/m438Dll/main.c +++ b/src/REL/m438Dll/main.c @@ -1,6 +1,7 @@ #include "ext_math.h" #include "game/audio.h" #include "game/chrman.h" +#include "game/hsfex.h" #include "game/hsfdraw.h" #include "game/hsfman.h" #include "game/hsfmotion.h" @@ -13,6 +14,10 @@ #include "REL/m438Dll.h" +#ifndef __MWERKS__ +#include "game/frand.h" +#endif + #define BOARD_FABS(value) ((value < 0.0f) ? -(value) : (value)) typedef struct M438MainWork { @@ -1197,7 +1202,6 @@ void fn_1_35C0(omObjData *object) s16 sp0A; s16 sp8; - float var_f31; float var_f30; float var_f29; @@ -1497,7 +1501,6 @@ void fn_1_4984(omObjData *object) Vec sp8; float var_f31; s32 var_r27; - M438MainWork3 *var_r28; M438MainWork3 *var_r30; M438MainWork3 *var_r31; @@ -1592,9 +1595,7 @@ void fn_1_4F50(omObjData *object) float var_f29; float var_f28; float var_f27; - float var_f25; s32 var_r26; - M438MainWork3 *var_r27; s32 var_r28; M438MainWork *var_r29; M438MainWork3 *var_r31; @@ -2601,8 +2602,6 @@ void fn_1_9420(float arg8, float *arg0, float *arg1, float arg2[3][3], float arg float sp48[16]; float sp8[16]; - float var_f29; - s32 var_r30; s32 var_r29; @@ -2672,8 +2671,6 @@ f32 fn_1_9960(Vec *arg0, Vec *arg1, Vec *arg2) { Vec sp44; f32 var_f31; - f32 var_f30; - f32 temp_f29; if (0.0f == ((arg2->z * arg2->z) + ((arg2->x * arg2->x) + (arg2->y * arg2->y)))) { return ((arg0->z - arg1->z) * (arg0->z - arg1->z)) @@ -2686,28 +2683,7 @@ f32 fn_1_9960(Vec *arg0, Vec *arg1, Vec *arg2) f32 fn_1_9C9C(Vec *arg0, Vec *arg1, Vec *arg2, Vec *arg3, Vec *arg4) { - f32 sp44; - f32 sp40; - f32 sp3C; - f32 sp38; - f32 sp34; - f32 sp30; - f32 sp2C; - f32 sp28; - f32 sp24; - Vec sp18; - f32 sp14; - f32 sp10; - f32 spC; - f32 sp8; - f32 temp_f25; - f32 temp_f26; - f32 temp_f28; - f32 var_f24; f32 var_f27; - f64 temp_f31; - f64 temp_f31_2; - f64 temp_f31_3; if (0.0f == ((arg2->z * arg2->z) + ((arg2->x * arg2->x) + (arg2->y * arg2->y)))) { return ((arg0->z - arg1->z) * (arg0->z - arg1->z)) diff --git a/src/REL/m438Dll/map.c b/src/REL/m438Dll/map.c index ea4ba2d0..1ba02bc0 100644 --- a/src/REL/m438Dll/map.c +++ b/src/REL/m438Dll/map.c @@ -1,12 +1,17 @@ #include "REL/m438Dll.h" #include "ext_math.h" +#include "game/audio.h" #include "game/hsfanim.h" #include "game/hsfmotion.h" +#include "game/memory.h" #include "game/sprite.h" #include "game/wipe.h" #include "string.h" +#ifndef __MWERKS__ +#include "game/frand.h" +#endif // STRUCT typedef struct M438MapStruct { @@ -92,7 +97,7 @@ void fn_1_B54C(omObjData *arg0) M438MapStruct *var_r24; M438MapStruct3 *temp_r23; - arg0->data = HuMemDirectMallocNum(HEAP_SYSTEM, 0x108C, 0x10000000); + arg0->data = HuMemDirectMallocNum(HEAP_SYSTEM, 0x108C, MEMORY_DEFAULT_NUM); temp_r23 = arg0->data; memset(temp_r23, 0, 0x108C); arg0->model[0] = Hu3DModelCreateFile(0x450000); @@ -372,7 +377,6 @@ void fn_1_C764(ModelData *model, ParticleData *particle, Mtx matrix) { HsfanimStruct01 *var_r31; s32 var_r29; - u16 temp_r0; var_r31 = particle->unk_48; @@ -399,7 +403,6 @@ void fn_1_C8E8(ModelData *model, ParticleData *particle, Mtx matrix) { HsfanimStruct01 *var_r31; s32 var_r29; - u16 temp_r0; var_r31 = particle->unk_48; @@ -508,7 +511,6 @@ void fn_1_D3FC(ModelData *model, ParticleData *particle, Mtx matrix) { HsfanimStruct01 *var_r31; s32 var_r29; - u16 temp_r0; lbl_1_bss_E2C = 0; var_r31 = particle->unk_48; @@ -581,7 +583,6 @@ s32 fn_1_DA64(f32 arg8) s32 var_r30; M438MapStruct2 *var_r31; float var_f31; - float var_f29; var_r28 = lbl_1_bss_108C[0]->data; var_r29 = 0; diff --git a/src/REL/m439Dll/main.c b/src/REL/m439Dll/main.c index 44c7927b..81595139 100644 --- a/src/REL/m439Dll/main.c +++ b/src/REL/m439Dll/main.c @@ -1,5 +1,6 @@ #include "game/hsfanim.h" #include "game/hsfdraw.h" +#include "game/hsfex.h" #include "game/hsfman.h" #include "game/hsfmotion.h" #include "game/object.h" @@ -23,6 +24,12 @@ #include "REL/m439data.h" #include "version.h" +#ifndef __MWERKS__ +#include "game/ClusterExec.h" +#include "game/EnvelopeExec.h" +#include "game/ShapeExec.h" +#endif + typedef struct camera_params { float zoom; Vec pos; diff --git a/src/REL/m440Dll/main.c b/src/REL/m440Dll/main.c index 31d8a98a..97152388 100644 --- a/src/REL/m440Dll/main.c +++ b/src/REL/m440Dll/main.c @@ -600,7 +600,7 @@ void fn_1_2470(omObjData *arg0) s16 var_r30; unkStruct2 *temp_r27; - arg0->data = HuMemDirectMallocNum(HEAP_SYSTEM, 0x34, MEMORY_DEFAULT_NUM); + arg0->data = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(unkStruct2), MEMORY_DEFAULT_NUM); temp_r27 = arg0->data; arg0->stat |= 0x100; arg0->model[0] = Hu3DModelCreateFile(DATA_MAKE_NUM(DATADIR_M440, 0x08)); @@ -1565,7 +1565,7 @@ void fn_1_6B58(unkStruct6 *arg0, HsfObject *arg1) break; } } - arg0->unk24 = HuMemDirectMallocNum(HEAP_DATA, arg0->unk20 * 0xD0, var_r22->unk_48); + arg0->unk24 = HuMemDirectMallocNum(HEAP_DATA, arg0->unk20 * sizeof(unkStruct8), var_r22->unk_48); var_r31 = arg0->unk24; if (var_r24 != 0) { var_r30 = arg1->data.vertex->count; @@ -2255,14 +2255,14 @@ s16 fn_1_956C(AnimData *arg0, s16 arg1, f32 arg2, s16 arg3, s16 arg4) var_r20 = Hu3DHookFuncCreate(fn_1_9C04); temp_r28 = &Hu3DData[var_r20]; - var_r31 = HuMemDirectMallocNum(HEAP_DATA, 0x68, temp_r28->unk_48); + var_r31 = HuMemDirectMallocNum(HEAP_DATA, sizeof(unkStruct5), temp_r28->unk_48); temp_r28->unk_120 = var_r31; arg0->useNum += 1; var_r31->unk10 = arg0; var_r31->unk0 = arg1; var_r31->unk8 = 0; var_r31->unkC = NULL; - var_r24 = HuMemDirectMallocNum(HEAP_DATA, arg1 * 0x64, temp_r28->unk_48); + var_r24 = HuMemDirectMallocNum(HEAP_DATA, arg1 * sizeof(unkStruct4), temp_r28->unk_48); var_r31->unk18 = var_r24; for (var_r30 = 0; var_r30 < arg1; var_r30++, var_r24++) { diff --git a/src/REL/m440Dll/object.c b/src/REL/m440Dll/object.c index 5eb6cb5c..5de16855 100644 --- a/src/REL/m440Dll/object.c +++ b/src/REL/m440Dll/object.c @@ -1,6 +1,7 @@ #include "REL/m440Dll.h" #include "ext_math.h" +#include "game/audio.h" #include "game/chrman.h" #include "game/flag.h" #include "game/gamework_data.h" @@ -10,10 +11,6 @@ #include "string.h" #include "version.h" -#ifdef __MWERKS__ -#include "game/audio.h" -#endif - // bss omObjData *lbl_1_bss_C0[4]; s16 lbl_1_bss_B8[4]; @@ -56,9 +53,9 @@ void fn_1_AEE4(omObjData *arg0) s16 var_r29; unkObjStruct *temp_r31; - arg0->data = HuMemDirectMallocNum(HEAP_SYSTEM, 0x78, MEMORY_DEFAULT_NUM); + arg0->data = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(unkObjStruct), MEMORY_DEFAULT_NUM); temp_r31 = (unkObjStruct *)arg0->data; - memset(temp_r31, 0, 0x78); + memset(temp_r31, 0, sizeof(unkObjStruct)); arg0->stat |= 0x100; temp_r31->unk4 = arg0->work[0]; temp_r31->unk6 = GWPlayerCfg[temp_r31->unk4].pad_idx; @@ -107,13 +104,9 @@ void fn_1_B180(omObjData *arg0) { s16 var_r29; s16 var_r31; - s32 var_r28; - u32 temp_r0; - u32 temp_r3; - u32 temp_r3_2; unkObjStruct *temp_r30; - var_r28 = GWSystem.player_curr; + s32 var_r28 = GWSystem.player_curr; if (var_r28 < 0) { var_r28 = 0; } @@ -236,9 +229,6 @@ void fn_1_B884(omObjData *arg0, unkObjStruct *arg1) f32 var_f28; f32 var_f31; f32 var_f30; - s16 temp_r0; - s16 temp_r0_2; - s16 temp_r3; s16 var_r30; switch (lbl_1_bss_74) { @@ -372,13 +362,8 @@ void fn_1_C1D4(omObjData *arg0, unkObjStruct *arg1) { s16 sp12[5]; s16 sp8[5]; - f32 var_f28; - f32 var_f29; f32 var_f30; f32 var_f31; - s16 temp_r0; - s16 temp_r0_2; - s16 temp_r3; s16 var_r29; s16 var_r28; s16 var_r30; @@ -490,7 +475,6 @@ void fn_1_C944(omObjData *arg0, unkObjStruct *arg1) f32 var_f29; f32 var_f30; f32 var_f31; - s16 var_r28; s16 var_r30; s16 var_r29; @@ -658,10 +642,8 @@ s16 fn_1_CFAC(unkObjStruct *arg0, u8 arg1) void fn_1_D24C(unkObjStruct *arg0, f32 arg1, f32 arg2) { - f32 var_f28; - f32 var_f29; - f32 var_f30; f32 var_f31; + f32 var_f28; var_f28 = REFRESH_RATE_F / 6.0f; arg0->unk6C = arg1; @@ -1129,14 +1111,8 @@ void fn_1_F168(void) void fn_1_F228(void) { omObjData *temp_r30; - s16 temp_r0; s16 var_r29; - s32 temp_r27; - s32 temp_r27_2; s32 var_r28; - u32 temp_r0_2; - u32 temp_r3; - u32 temp_r3_2; unkObjStruct *temp_r31; for (var_r29 = 0; var_r29 < 4; var_r29++) { diff --git a/src/REL/m441Dll/main.c b/src/REL/m441Dll/main.c index e3d30e63..cda76fda 100644 --- a/src/REL/m441Dll/main.c +++ b/src/REL/m441Dll/main.c @@ -6,6 +6,7 @@ #include "game/objsub.h" #include "game/wipe.h" +#include "game/gamework.h" #include "game/gamework_data.h" #include "game/mapspace.h" @@ -23,12 +24,13 @@ #include "ext_math.h" #include "version.h" - #ifndef __MWERKS__ #include #include #endif +void HuSysVWaitSet(s16 vcount); + #undef ABS #define ABS(x) ((0 > (x)) ? -(x) : (x)) @@ -1780,9 +1782,6 @@ void fn_1_892C(s16 arg0, s16 arg1, Vec *arg2) { omObjData *object; Work713C *work; - float x; - float y; - float z; if (lbl_1_bss_1E >= 400) { OSReport("over!!\n"); return; diff --git a/src/REL/m442Dll/main.c b/src/REL/m442Dll/main.c index 194dcd0d..9f45c7b0 100644 --- a/src/REL/m442Dll/main.c +++ b/src/REL/m442Dll/main.c @@ -16,6 +16,11 @@ #include "REL/m442Dll.h" +#ifndef __MWERKS__ +#include "game/esprite.h" +#include "game/frand.h" +#endif + typedef struct M442StructBss5C { /* 0x00 */ float unk_00; // probably Vec /* 0x04 */ float unk_04; @@ -818,7 +823,6 @@ void fn_1_2254(omObjData *object) float var_f31; float var_f30; - double var_f29; float var_f28; float var_f27; float var_f26; @@ -1465,26 +1469,10 @@ void fn_1_485C(ModelData *model, Mtx mtx) Vec sp10; float var_f31; - float var_f30; - float var_f29; - float var_f28; - float var_f27; - float var_f26; - float var_f25; - float var_f24; - float var_f23; - float var_f22; - float var_f21; - float var_f20; - float var_f19; M442StructBss5C *var_r31; s32 var_r30; CameraData *var_r29; - u16 var_r28; - u16 var_r27; - u16 var_r26; - u16 var_r25; var_r29 = Hu3DCamera; C_MTXOrtho(sp100, 0.0f, 480.0f, 0.0f, 640.0f, 0.0f, 100.0f); @@ -1667,15 +1655,6 @@ s32 fn_1_59C0(Vec *arg0) void fn_1_5A48(ModelData *arg0, Mtx arg1) { - float var_f31; - float var_f30; - float var_f29; - float var_f28; - float var_f27; - float var_f26; - float var_f25; - float var_f24; - M442StructBssC9F8 *var_r31; s32 var_r30; @@ -1729,8 +1708,6 @@ GXColor lbl_1_data_218 = { 0xFF, 0xFF, 0xFF, 0x80 }; void fn_1_5EDC(ModelData *model, float (*mtx)[4]) { - float sp38; - float sp28; Mtx spC; M442MainWork *var_r31; @@ -2141,8 +2118,6 @@ void fn_1_7EBC(ModelData *model, ParticleData *particle, Mtx matrix) { s32 sp14; float sp10; - float spC; - float sp8; float var_f31; diff --git a/src/REL/m443Dll/main.c b/src/REL/m443Dll/main.c index acf8f914..f0ab0aa4 100644 --- a/src/REL/m443Dll/main.c +++ b/src/REL/m443Dll/main.c @@ -809,9 +809,6 @@ void fn_1_3770(omObjData *arg0) s32 var_r26; u32 var_r25; s32 var_r24; - s32 var_r23; - u32 var_r22; - u32 var_r21; var_r28 = arg0->data; { diff --git a/src/REL/m443Dll/player.c b/src/REL/m443Dll/player.c index 9ed45b12..2ee3729e 100644 --- a/src/REL/m443Dll/player.c +++ b/src/REL/m443Dll/player.c @@ -10,6 +10,7 @@ #ifndef __MWERKS__ #include "game/esprite.h" +#include "game/frand.h" #endif #include "REL/m443Dll.h" @@ -212,7 +213,6 @@ void fn_1_5680(omObjData *object) { f32 spC[4] = { 0.25f, 0.5f, 0.75f, 1.0f }; s32 sp8; - f32 temp_f0; s32 temp_r27; s32 temp_r3; s32 var_r29; @@ -220,7 +220,7 @@ void fn_1_5680(omObjData *object) M443DllWorkStruct *temp_r31; HsfanimStruct01 *var_r28; - object->data = HuMemDirectMallocNum(HEAP_SYSTEM, 0x134, MEMORY_DEFAULT_NUM); + object->data = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(M443DllWorkStruct), MEMORY_DEFAULT_NUM); temp_r31 = object->data; memset(temp_r31, 0, 0x134); object->stat |= 0x100; @@ -403,7 +403,6 @@ void fn_1_6458(omObjData *object) f32 var_f31; s32 var_r29; M443DllWorkStruct *temp_r31; - void *temp_r4; temp_r31 = object->data; var_r29 = 0; @@ -444,7 +443,6 @@ void fn_1_6458(omObjData *object) void fn_1_6674(omObjData *object) { M443DllWorkStruct *temp_r31; - void *temp_r4; temp_r31 = object->data; temp_r31->unk10 = 0; @@ -567,9 +565,6 @@ void fn_1_6B90(omObjData *object) { 3, 2, 1, 0 }, }; f32 sp18[4] = { 0.0f, -700.0f, 600.0f, 1200.0f }; - s32 sp14; - s32 sp10; - s32 spC; s32 sp8[4] = { 2, 4, 8, 16 }; f32 var_f31; s32 var_r28; @@ -978,7 +973,6 @@ void fn_1_8508(omObjData *object) s32 var_r30; M443DllWorkStruct *temp_r28; M443DllUnkStruct *temp_r31; - f32 *temp_r4; temp_r28 = object->data; temp_r31 = &temp_r28->unk108s; diff --git a/src/REL/m444dll/main.c b/src/REL/m444dll/main.c index 27ef0821..52ede40d 100644 --- a/src/REL/m444dll/main.c +++ b/src/REL/m444dll/main.c @@ -1,3 +1,4 @@ +#include "game/hsfex.h" #include "game/hsfman.h" #include "game/hsfmotion.h" #include "game/object.h" @@ -17,7 +18,6 @@ #include "REL/m444dll.h" #include "ext_math.h" -#include "math.h" typedef struct camera_view_params { Vec rot; diff --git a/src/REL/m444dll/pinball.c b/src/REL/m444dll/pinball.c index a455a9f4..e4ad2e19 100644 --- a/src/REL/m444dll/pinball.c +++ b/src/REL/m444dll/pinball.c @@ -10,19 +10,17 @@ #include "game/audio.h" #include "game/chrman.h" -#include "game/esprite.h" #include "game/window.h" -#include "game/wipe.h" -#include "game/board/ui.h" -#include "game/gamework.h" #include "game/gamework_data.h" #include "REL/m444dll.h" #include "ext_math.h" #include "version.h" -#include "math.h" +#ifndef __MWERKS__ +#include "game/frand.h" +#endif s16 lbl_1_bss_198F0[5][2]; Vec lbl_1_bss_D8F0[4096]; diff --git a/src/REL/m444dll/shadow.c b/src/REL/m444dll/shadow.c index 3f3062cf..604c5e85 100644 --- a/src/REL/m444dll/shadow.c +++ b/src/REL/m444dll/shadow.c @@ -1,8 +1,6 @@ #include "game/hsfman.h" #include "game/object.h" -#include "game/window.h" - #include "ext_math.h" void fn_1_D9F4(s16); diff --git a/src/REL/m445Dll/main.c b/src/REL/m445Dll/main.c index 831d1e69..b1251344 100755 --- a/src/REL/m445Dll/main.c +++ b/src/REL/m445Dll/main.c @@ -2,6 +2,7 @@ #include "game/audio.h" #include "game/chrman.h" #include "game/data.h" +#include "game/frand.h" #include "game/gamework_data.h" #include "game/hsfanim.h" #include "game/hsfman.h" @@ -16,7 +17,6 @@ #include "game/window.h" #include "game/wipe.h" -#include "dolphin.h" #include "ext_math.h" typedef struct { diff --git a/src/REL/m446Dll/camera.c b/src/REL/m446Dll/camera.c index 8a49a82f..2b353e3a 100644 --- a/src/REL/m446Dll/camera.c +++ b/src/REL/m446Dll/camera.c @@ -1,6 +1,5 @@ #include "REL/m446Dll.h" -#include "math.h" #include "ext_math.h" #include "game/hsfman.h" #include "game/printfunc.h" diff --git a/src/REL/m446Dll/card.c b/src/REL/m446Dll/card.c index fa45170f..0f187b20 100644 --- a/src/REL/m446Dll/card.c +++ b/src/REL/m446Dll/card.c @@ -15,7 +15,7 @@ unkStruct2 *fn_1_1C64(s32 arg0) { unkStruct2 *temp_r3; - temp_r3 = HuMemDirectMallocNum(HEAP_SYSTEM, 0xC, MEMORY_DEFAULT_NUM); + temp_r3 = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(unkStruct2), MEMORY_DEFAULT_NUM); if (!temp_r3) { return NULL; } @@ -86,7 +86,7 @@ unkStruct3 *fn_1_1DF4(void *arg0) { unkStruct3 *temp_r3; - temp_r3 = HuMemDirectMallocNum(HEAP_SYSTEM, 0xC, MEMORY_DEFAULT_NUM); + temp_r3 = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(unkStruct3), MEMORY_DEFAULT_NUM); if (!temp_r3) { return NULL; } @@ -211,9 +211,7 @@ void fn_1_207C(void) void fn_1_20D4(void) { - m446Func1 *temp_r4; f32 temp_f31; - s32 temp_r5; unkStruct4 *temp_r31; unkStruct3 *var_r30; @@ -275,7 +273,7 @@ unkStruct4 *m446CardCreate(s32 arg0) unkStruct4 *temp_r31; unkStruct3 *temp_r30; - temp_r31 = HuMemDirectMallocNum(HEAP_SYSTEM, 0x98, MEMORY_DEFAULT_NUM); + temp_r31 = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(unkStruct4), MEMORY_DEFAULT_NUM); if (!temp_r31) { OSReport("[!] m446CardCreate ERROR...\n"); return NULL; diff --git a/src/REL/m446Dll/cursor.c b/src/REL/m446Dll/cursor.c index c57da258..0fee3a5f 100644 --- a/src/REL/m446Dll/cursor.c +++ b/src/REL/m446Dll/cursor.c @@ -70,7 +70,7 @@ unkStruct7 *m446CursorCreate(s32 arg0) unkStruct7 *var_r31; unkStruct3 *var_r29; - var_r31 = HuMemDirectMallocNum(HEAP_SYSTEM, 0x54, MEMORY_DEFAULT_NUM); + var_r31 = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(unkStruct7), MEMORY_DEFAULT_NUM); if (!var_r31) { return NULL; } diff --git a/src/REL/m446Dll/deck.c b/src/REL/m446Dll/deck.c index 83e541ee..cf3ce64d 100644 --- a/src/REL/m446Dll/deck.c +++ b/src/REL/m446Dll/deck.c @@ -1,6 +1,6 @@ #include "REL/m446Dll.h" -#include "math.h" +#include "game/audio.h" #include "ext_math.h" // bss @@ -18,7 +18,7 @@ unkStruct5* fn_1_3064(void) { s32 var_r30; unkStruct5* temp_r3; - temp_r3 = HuMemDirectMallocNum(HEAP_SYSTEM, 0x10, MEMORY_DEFAULT_NUM); + temp_r3 = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(unkStruct5), MEMORY_DEFAULT_NUM); if (!temp_r3) { return NULL; } diff --git a/src/REL/m446Dll/main.c b/src/REL/m446Dll/main.c index c094ea9d..91e62596 100644 --- a/src/REL/m446Dll/main.c +++ b/src/REL/m446Dll/main.c @@ -6,6 +6,7 @@ #include "game/gamework_data.h" #include "game/hsfman.h" #include "game/minigame_seq.h" +#include "game/objsub.h" #include "game/window.h" #include "game/wipe.h" @@ -93,7 +94,7 @@ unkStruct *m446FlowCreate(void) s32 var_r30; unkStruct *temp_r3; - temp_r3 = HuMemDirectMallocNum(HEAP_SYSTEM, 0x9C, MEMORY_DEFAULT_NUM); + temp_r3 = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(unkStruct), MEMORY_DEFAULT_NUM); if (temp_r3 == 0) { OSReport("[!] m446FlowCreate() ERROR...\n"); return NULL; @@ -287,9 +288,6 @@ void fn_1_53C(unkStruct *arg0) void fn_1_958(unkStruct *arg0) { - s32 temp_r3; - s32 temp_r3_2; - s32 temp_r3_3; s32 var_r30; switch (arg0->unk10) { @@ -680,7 +678,6 @@ void fn_1_19D4(void) { s16 temp_r3; s16 var_r30; - s32 temp_r0; s32 var_r29; u32 temp_r27; diff --git a/src/REL/m446Dll/player.c b/src/REL/m446Dll/player.c index ecf62fa9..57d002a4 100644 --- a/src/REL/m446Dll/player.c +++ b/src/REL/m446Dll/player.c @@ -1,5 +1,6 @@ #include "REL/m446Dll.h" +#include "game/audio.h" #include "game/chrman.h" #include "game/gamework_data.h" #include "game/hsfman.h" @@ -166,7 +167,7 @@ unkStruct8 *m446PlayerCreate(s32 arg0, unkStruct6 *arg1) s32 var_r30; unkStruct8 *var_r31; - var_r31 = HuMemDirectMallocNum(HEAP_SYSTEM, 0xCC, MEMORY_DEFAULT_NUM); + var_r31 = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(unkStruct8), MEMORY_DEFAULT_NUM); if (!var_r31) { return NULL; } @@ -338,7 +339,6 @@ s32 m446PlayerAppendCard(unkStruct8 *arg0, unkStruct4 *arg1, s32 arg2) { Vec sp18; Vec spC; - s32 temp_r0_2; s32 temp_r28; s32 temp_r27; s32 var_r29; @@ -859,7 +859,7 @@ void fn_1_64BC(unkStruct8 *arg0, s32 arg1, s32 arg2) } } -static inline unkStruct8UnkC8(unkStruct8 *arg0) +static inline s32 unkStruct8UnkC8(unkStruct8 *arg0) { if (arg0->unkC8 == 0) { return 0; diff --git a/src/REL/m446Dll/stage.c b/src/REL/m446Dll/stage.c index 19f9d91f..5248117e 100644 --- a/src/REL/m446Dll/stage.c +++ b/src/REL/m446Dll/stage.c @@ -101,7 +101,7 @@ unkStruct9 *m446StageCreate(void) unkStruct3 *temp_ret; unkStruct9 *var_r31; - var_r31 = HuMemDirectMallocNum(HEAP_SYSTEM, 0x30, MEMORY_DEFAULT_NUM); + var_r31 = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(unkStruct9), MEMORY_DEFAULT_NUM); if (!var_r31) { return NULL; } diff --git a/src/REL/m446Dll/table.c b/src/REL/m446Dll/table.c index ea79e3b9..e972842c 100644 --- a/src/REL/m446Dll/table.c +++ b/src/REL/m446Dll/table.c @@ -1,4 +1,5 @@ #include "REL/m446Dll.h" +#include "game/audio.h" #include "game/hsfman.h" #include "game/pad.h" @@ -46,7 +47,7 @@ unkStruct6 *fn_1_39D0(void) unkStruct3 *var_r29; unkStruct6 *var_r31; - var_r31 = HuMemDirectMallocNum(HEAP_SYSTEM, 0x70, MEMORY_DEFAULT_NUM); + var_r31 = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(unkStruct6), MEMORY_DEFAULT_NUM); if (!var_r31) { return NULL; } diff --git a/src/REL/m447dll/main.c b/src/REL/m447dll/main.c index eeb86fd4..dbba1ee1 100755 --- a/src/REL/m447dll/main.c +++ b/src/REL/m447dll/main.c @@ -13,6 +13,10 @@ #include "math.h" +#ifndef __MWERKS__ +#include "game/audio.h" +#endif + typedef struct { /* 0x00 */ s16 unk00; /* 0x02 */ char unk02[2]; @@ -463,7 +467,12 @@ void fn_1_1068(UnkM447Struct_00* arg0) { /* fallthrough */ case 1: // Bug: HuAudSeqFadeOut takes two arguments. +#ifdef TARGET_PC + // TODO PC + HuAudSeqFadeOut(arg0->unk70, 100); +#else HuAudSeqFadeOut(arg0->unk70); +#endif arg0->unk30 = MGSeqCreate(3, 1); arg0->unk1C = 2; /* fallthrough */ diff --git a/src/REL/m447dll/player.c b/src/REL/m447dll/player.c index a4744d53..d74c3a1c 100755 --- a/src/REL/m447dll/player.c +++ b/src/REL/m447dll/player.c @@ -4,6 +4,7 @@ #include "game/data.h" #include "game/esprite.h" #include "game/gamework_data.h" +#include "game/hsfex.h" #include "game/hsfman.h" #include "game/hsfmotion.h" #include "game/memory.h" diff --git a/src/REL/m448Dll/main.c b/src/REL/m448Dll/main.c index 3965c81c..0e7c6322 100755 --- a/src/REL/m448Dll/main.c +++ b/src/REL/m448Dll/main.c @@ -3,7 +3,6 @@ #include "game/chrman.h" #include "game/data.h" #include "game/esprite.h" -#include "game/flag.h" #include "game/gamework_data.h" #include "game/hsfanim.h" #include "game/hsfman.h" @@ -18,10 +17,11 @@ #include "game/window.h" #include "game/wipe.h" -#include "dolphin.h" #include "ext_math.h" #include "version.h" +s32 rand8(void); + typedef struct { /* 0x00 */ s32 unk00; /* 0x04 */ s32 unk04; diff --git a/src/REL/m449Dll/main.c b/src/REL/m449Dll/main.c index 4fe9b0c7..6a18dd8c 100644 --- a/src/REL/m449Dll/main.c +++ b/src/REL/m449Dll/main.c @@ -5,7 +5,6 @@ #include "game/audio.h" #include "game/chrman.h" #include "game/esprite.h" -#include "game/flag.h" #include "game/frand.h" #include "game/gamework_data.h" #include "game/hsfdraw.h" @@ -16,7 +15,6 @@ #include "game/object.h" #include "game/objsub.h" #include "game/pad.h" -#include "game/printfunc.h" #include "game/sprite.h" #include "game/window.h" #include "game/wipe.h" @@ -1317,15 +1315,7 @@ float lbl_1_data_294 = -30.0f; void fn_1_6850(omObjData *object) { M449DllWork *sp20[2]; - s32 sp1C; - s32 sp18; - s32 sp14; - s32 sp10; - s32 spC; - s32 sp8; float var_f31; - float var_f30; - float var_f29; s32 var_r31; s32 var_r30; @@ -1450,8 +1440,6 @@ void fn_1_71A8(void) s16 var_r31; s32 var_r30; s16 var_r29; - s32 var_r28; - s32 var_r27; u32 var_r26; var_r29 = 0; diff --git a/src/REL/m450Dll/main.c b/src/REL/m450Dll/main.c index ba4a5901..8f537152 100644 --- a/src/REL/m450Dll/main.c +++ b/src/REL/m450Dll/main.c @@ -1707,7 +1707,7 @@ s16 fn_1_5ED8(AnimData *arg0, Vec *arg1, float *arg2, s16 arg3, float arg8, s16 var_r31->unk_00 = 0; var_r31->unk_66 = arg3; var_r31->unk_6B = 0; - var_r31->unk_10 = HuMemDirectMallocNum(HEAP_DATA, arg3 * 0x40, var_r28->unk_48); + var_r31->unk_10 = HuMemDirectMallocNum(HEAP_DATA, arg3 * sizeof(UnkM450Struct2), var_r28->unk_48); for (var_r24 = var_r31->unk_10, var_r30 = 0; var_r30 < arg3; var_r30++, var_r24++) { var_r24->unk_3E = -1; var_r24->unk_3C = -1; @@ -1889,12 +1889,7 @@ void fn_1_6798(s16 arg0, s16 arg1, Vec *arg2, float arg8, float arg9, float argA s16 fn_1_69F8(Vec *arg0, float *arg1, s16 arg2) { - s16 var_r31; - void *var_r30; - ModelData *var_r29; - ModelData *var_r28; - - var_r31 = fn_1_5ED8(lbl_1_bss_14, arg0, arg1, arg2, 80.0f, 0x40, 0x40); + s16 var_r31 = fn_1_5ED8(lbl_1_bss_14, arg0, arg1, arg2, 80.0f, 0x40, 0x40); fn_1_6638(var_r31, fn_1_5148); fn_1_6670(var_r31, 1); Hu3DModelLayerSet(var_r31, 5); @@ -2295,8 +2290,6 @@ void fn_1_8120(void) float var_f29; s32 var_r31; - s32 var_r30; - s32 var_r29; float sp10[2] = { 0.0f, 0.0f }; s32 sp24[22] = { @@ -2358,12 +2351,6 @@ void fn_1_8120(void) void fn_1_8500(void) { - float sp28; - float sp20; - float sp18; - float sp10; - float sp8; - s32 var_r31; float sp30[2] = { 0.0f, 0.0f }; @@ -2407,8 +2394,6 @@ void fn_1_8500(void) void fn_1_8BDC(void) { - s32 var_r31; - lbl_1_bss_4 = 2; lbl_1_bss_0 = -1; fn_1_E1A8(1, 0xD, 8.0f, 0x40000001, -1, 0.0f); @@ -2841,7 +2826,6 @@ void fn_1_AD58(omObjData *object) float spC8; UnkM450Struct3 *var_r31; - Vec2f *var_r25; s32 var_r20; var_r20 = 0; @@ -3482,7 +3466,6 @@ void fn_1_E478(UnkM450Struct3 *arg0, omObjData *arg1) void fn_1_E604(UnkM450Struct3 *arg0, omObjData *arg1) { Vec spC; - float sp8; arg0->unk_D4 = ((UnkM450Struct5 *)lbl_1_bss_138->data)->unk_00.unk_6C; if (((arg0->unk_154 & 0x10) != 0) && ((arg0->unk_154 & 0x20) == 0)) { @@ -3538,10 +3521,6 @@ HsfanimStruct00 lbl_1_data_1504; void fn_1_EB6C(UnkM450Struct3 *arg0, omObjData *arg1) { - s32 var_r29; - s16 var_r28; - u32 var_r27; - fn_1_1D18(arg1->model[4], "g007i03-itemhook_M", &arg0->unk_00.unk_6C); Hu3DModelHookObjReset(arg1->model[4], "g007i03-itemhook_M"); Hu3DModelAttrSet(arg1->model[4], HU3D_ATTR_DISPOFF); @@ -4517,9 +4496,6 @@ void fn_1_12A1C(omObjData *object) void fn_1_12B80(omObjData *object) { - s32 var_r30; - s16 var_r29; - object->work[0] = frandmod(3 * REFRESH_RATE); omSetTra(object, 0.0f, 0.0f, 0.0f); omSetRot(object, 0.0f, 0.0f, 0.0f); @@ -4712,7 +4688,6 @@ void fn_1_13BC4(s32 arg0) { s32 var_r31; UnkData1380Struct *var_r30; - s16 var_r29; nMap = 0; lbl_1_bss_118 = arg0; @@ -5625,12 +5600,7 @@ void fn_1_17BBC(omObjData *object) void fn_1_18424(s32 arg0, Vec *arg1) { - UnkBss358Struct *var_r27; - UnkBss358Struct *var_r28; - UnkBss358Struct *var_r29; omObjData *var_r31; - s16 var_r24; - s16 var_r25; s16 var_r26; UnkM450Struct4 *var_r30; @@ -5905,12 +5875,9 @@ s32 fn_1_1964C(Vec *arg0, Vec *arg1) s32 fn_1_19798(void) { - float sp8; float var_f31; float var_f30; - float var_f29; float var_f28; - float var_f27; UnkM450Struct5 *var_r31 = lbl_1_bss_138->data; UnkM450Struct3 *var_r30 = lbl_1_bss_134->data; @@ -6415,8 +6382,6 @@ s32 fn_1_1C39C(UnkM450Struct5 *arg0) void fn_1_1C434(UnkM450Struct5 *arg0, omObjData *arg1) { - s32 var_r30; - arg0->unk_118++; lbl_1_bss_1A4->work[0] += 1; lbl_1_bss_128 = 0.0f; @@ -6754,8 +6719,6 @@ void fn_1_1E150(omObjData *var_r29) void fn_1_200BC(UnkM450Struct5 *arg0, omObjData *object) { - s32 var_r31; - arg0->unk_118++; arg0->unk_FC &= ~0x802; arg0->unk_FC &= ~0x70; diff --git a/src/REL/m451Dll/m451.c b/src/REL/m451Dll/m451.c index 4f55107a..29601f11 100644 --- a/src/REL/m451Dll/m451.c +++ b/src/REL/m451Dll/m451.c @@ -17,6 +17,10 @@ #include "game/gamework_data.h" +#ifndef __MWERKS__ +#include "game/hsfex.h" +#endif + typedef struct bss_348_data { s16 unk0[5]; s16 unkA; diff --git a/src/REL/m453Dll/main.c b/src/REL/m453Dll/main.c index 9db313c7..e49eecfa 100644 --- a/src/REL/m453Dll/main.c +++ b/src/REL/m453Dll/main.c @@ -1315,7 +1315,6 @@ void fn_1_3F38(ModelData *model, ParticleData *particle, Mtx matrix) float var_f31; float var_f30; float var_f29; - float var_f28; HsfanimStruct01 *var_r31; s32 var_r29; @@ -1464,18 +1463,8 @@ float fn_1_4B34(float arg8, float arg9, float argA, float argB) void fn_1_4BAC(float *arg0, float *arg1, float *arg2, float *arg3, float arg8) { float spC[3]; - float sp8; - float var_f31; float var_f30; - float var_f28; float var_f29; - float var_f27; - float var_f26; - float var_f25; - float var_f24; - float var_f23; - float var_f22; - float var_f21; s32 var_r31; @@ -1615,13 +1604,6 @@ void fn_1_5670(float arg8, float *arg0, float *arg1, float (*arg2)[3], float (*a float sp48[16]; float sp8[16]; - float var_f31; - float var_f30; - float var_f29; - float var_f28; - float var_f27; - - s32 var_r31; s32 var_r30; s32 var_r29; diff --git a/src/REL/m453Dll/map.c b/src/REL/m453Dll/map.c index 6771a755..97cbe2ab 100644 --- a/src/REL/m453Dll/map.c +++ b/src/REL/m453Dll/map.c @@ -3,16 +3,12 @@ #include "game/chrman.h" #include "game/flag.h" #include "game/frand.h" -#include "game/gamework.h" #include "game/hsfanim.h" #include "game/hsfdraw.h" #include "game/hsfman.h" #include "game/hsfmotion.h" -#include "game/minigame_seq.h" -#include "game/objsub.h" -#include "game/pad.h" +#include "game/memory.h" #include "game/sprite.h" -#include "game/wipe.h" #include "math.h" #include "string.h" @@ -464,7 +460,7 @@ void fn_1_6C74(omObjData *object) s32 var_r31; M453MapUnkStruct *var_r29; - var_r29 = HuMemDirectMallocNum(HEAP_SYSTEM, 0x54, 0x10000000); + var_r29 = HuMemDirectMallocNum(HEAP_SYSTEM, sizeof(M453MapUnkStruct), MEMORY_DEFAULT_NUM); object->data = var_r29; memset(object->data, 0, 0x54); for (var_r31 = 0; var_r31 < 0xC; var_r31++) { diff --git a/src/REL/m453Dll/score.c b/src/REL/m453Dll/score.c index a588ca07..8f0decb6 100644 --- a/src/REL/m453Dll/score.c +++ b/src/REL/m453Dll/score.c @@ -1,19 +1,9 @@ -#include "ext_math.h" -#include "game/audio.h" -#include "game/chrman.h" #include "game/esprite.h" #include "game/flag.h" -#include "game/frand.h" -#include "game/gamework.h" -#include "game/hsfanim.h" -#include "game/hsfman.h" #include "game/memory.h" -#include "game/minigame_seq.h" #include "game/object.h" #include "game/objsub.h" -#include "game/pad.h" #include "game/sprite.h" -#include "game/wipe.h" #include "REL/m453Dll.h" diff --git a/src/REL/m455Dll/main.c b/src/REL/m455Dll/main.c index 2f2d7bf6..ce3adb79 100644 --- a/src/REL/m455Dll/main.c +++ b/src/REL/m455Dll/main.c @@ -19,6 +19,7 @@ #ifndef __MWERKS__ #include "game/esprite.h" +#include "game/hsfex.h" #endif typedef struct camera_view_params { diff --git a/src/REL/m455Dll/stage.c b/src/REL/m455Dll/stage.c index c320e330..84c86b8f 100644 --- a/src/REL/m455Dll/stage.c +++ b/src/REL/m455Dll/stage.c @@ -5,14 +5,8 @@ #include "game/hsfanim.h" #include "game/hsfmotion.h" -#include "game/pad.h" -#include "game/wipe.h" #include "game/frand.h" -#include "game/audio.h" -#include "game/minigame_seq.h" -#include "game/gamework_data.h" -#include "game/chrman.h" #include "game/sprite.h" #include "REL/m455Dll.h" diff --git a/src/REL/m456Dll/stage.c b/src/REL/m456Dll/stage.c index 0929ca33..dd812635 100644 --- a/src/REL/m456Dll/stage.c +++ b/src/REL/m456Dll/stage.c @@ -1,23 +1,14 @@ #include "game/hsfanim.h" #include "game/hsfdraw.h" +#include "game/hsfmotion.h" #include "game/hsfman.h" #include "game/object.h" #include "game/objsub.h" - -#include "game/hsfmotion.h" -#include "game/pad.h" - -#include "game/audio.h" -#include "game/chrman.h" -#include "game/gamework_data.h" -#include "game/minigame_seq.h" #include "game/sprite.h" -#include "game/wipe.h" #include "REL/m456Dll.h" #include "ext_math.h" -#include "math.h" #include "version.h" #if !VERSION_PAL diff --git a/src/REL/m458Dll/main.c b/src/REL/m458Dll/main.c index 3b261cd0..9e037ee3 100644 --- a/src/REL/m458Dll/main.c +++ b/src/REL/m458Dll/main.c @@ -17,8 +17,6 @@ #include "game/wipe.h" #include "string.h" -#include "game/frand.h" - extern s32 rand8(void); typedef struct UnkCameraStruct { diff --git a/src/REL/m459dll/main.c b/src/REL/m459dll/main.c index c8c96218..b8764c6a 100644 --- a/src/REL/m459dll/main.c +++ b/src/REL/m459dll/main.c @@ -12,9 +12,7 @@ #include "game/printfunc.h" #include "game/wipe.h" -// #ifndef __MWERKS__ #include "game/frand.h" -// #endif typedef struct M459DllBss18Struct { /* 0x00 */ s32 unk_00; @@ -526,7 +524,6 @@ void fn_1_73C(void) void fn_1_E78(void) { - float sp8; float var_f31; M459DllBss61CStruct *var_r31; @@ -1154,10 +1151,6 @@ loop_1: void fn_1_338C(M459DllBssCCStruct *arg0, float arg8) { - float spC; - float var_f31; - float var_f30; - float var_f29; s16 var_r30; var_r30 = 0; diff --git a/src/REL/m460Dll/main.c b/src/REL/m460Dll/main.c index 52ca989b..2cc504ee 100644 --- a/src/REL/m460Dll/main.c +++ b/src/REL/m460Dll/main.c @@ -945,8 +945,6 @@ u32 fn_1_4370(void) void fn_1_4388(Vec *sp8, Vec *var_r31) { Vec sp10; - float var_f30; - float var_f29; VECSubtract(var_r31, sp8, &sp10); Center = *var_r31; diff --git a/src/REL/m460Dll/map.c b/src/REL/m460Dll/map.c index 3ce6f725..6e7f2622 100644 --- a/src/REL/m460Dll/map.c +++ b/src/REL/m460Dll/map.c @@ -10,7 +10,6 @@ #include "game/hsfmotion.h" #include "game/memory.h" #include "game/object.h" -#include "game/pad.h" #include "game/sprite.h" #include "string.h" diff --git a/src/REL/m460Dll/score.c b/src/REL/m460Dll/score.c index 357c2d8c..d1a62652 100644 --- a/src/REL/m460Dll/score.c +++ b/src/REL/m460Dll/score.c @@ -77,9 +77,6 @@ void fn_1_8F38(void) void fn_1_8FAC(s32 arg0) { - s32 sp8; - s32 var_r3; - switch (arg0) { case 0: fn_1_9020(1); diff --git a/src/REL/m463Dll/main.c b/src/REL/m463Dll/main.c index 159940f0..7f873677 100755 --- a/src/REL/m463Dll/main.c +++ b/src/REL/m463Dll/main.c @@ -20,6 +20,8 @@ #include "ext_math.h" +extern s32 rand8(void); + typedef struct { /* 0x00 */ s32 unk00; /* 0x04 */ s32 unk04; diff --git a/src/REL/messDll/main.c b/src/REL/messDll/main.c index f7b32576..1d91e94c 100755 --- a/src/REL/messDll/main.c +++ b/src/REL/messDll/main.c @@ -7,7 +7,6 @@ #include "game/window.h" #include "game/wipe.h" -#include "dolphin.h" #include "ext_math.h" extern s32 sprintf(char *, const char *, s32); diff --git a/src/REL/mgmodedll/battle.c b/src/REL/mgmodedll/battle.c index c5088576..9c2538d9 100644 --- a/src/REL/mgmodedll/battle.c +++ b/src/REL/mgmodedll/battle.c @@ -1,16 +1,17 @@ #include "REL/mgmodedll.h" -#include "game/gamework.h" #include "game/audio.h" #include "game/chrman.h" -#include "game/esprite.h" #include "game/gamework_data.h" #include "game/minigame_seq.h" -#include "game/saveload.h" #include "game/wipe.h" #include "ext_math.h" +#ifndef __MWERKS__ +#include "game/frand.h" +#endif + s16 lbl_1_bss_3A4; s32 lbl_1_bss_3A0; s16 lbl_1_bss_396[4]; diff --git a/src/REL/mgmodedll/free_play.c b/src/REL/mgmodedll/free_play.c index 58ffe85e..ab29a7d8 100644 --- a/src/REL/mgmodedll/free_play.c +++ b/src/REL/mgmodedll/free_play.c @@ -4,7 +4,6 @@ #include "game/audio.h" #include "game/esprite.h" #include "game/gamework_data.h" -#include "game/saveload.h" #include "game/wipe.h" #include "ext_math.h" diff --git a/src/REL/w03Dll/condor.c b/src/REL/w03Dll/condor.c index c42f53b3..630569bb 100644 --- a/src/REL/w03Dll/condor.c +++ b/src/REL/w03Dll/condor.c @@ -660,7 +660,7 @@ void fn_1_48EC(s32 arg0) temp_r31->unkbit_04 = 0; temp_r31->unk_02 = -1; temp_r31->unkbit_01 = arg0; - temp_r31->unk_08 = HuMemDirectMallocNum(HEAP_SYSTEM, 0xA00, MEMORY_DEFAULT_NUM); + temp_r31->unk_08 = HuMemDirectMallocNum(HEAP_SYSTEM, 80 * sizeof(w03StructUnk3), MEMORY_DEFAULT_NUM); Hu3DModelObjPosGet(BoardModelIDGet(lbl_1_bss_C[2]), "coin", &spC); temp_r31->model = BoardModelCreate(DATA_MAKE_NUM(DATADIR_W03, 0x07), NULL, 0); BoardModelVisibilitySet(temp_r31->model, 0); diff --git a/src/dolphin/mtx/mtx.c b/src/dolphin/mtx/mtx.c index ab196f4e..6b71edb5 100644 --- a/src/dolphin/mtx/mtx.c +++ b/src/dolphin/mtx/mtx.c @@ -1322,8 +1322,8 @@ void C_MTXLightOrtho(Mtx m, f32 t, f32 b, f32 l, f32 r, f32 scaleS, f32 scaleT, void C_MTXReorder(const Mtx src, ROMtx dest) { u32 i, j; - for (i = 0; i < 3; j++) { - for (int j = 0; j < 4; j++) { + for (i = 0; i < 3; i++) { + for (j = 0; j < 4; j++) { dest[j][i] = src[i][j]; } } diff --git a/src/game/ClusterExec.c b/src/game/ClusterExec.c index af0b6981..7acb081c 100644 --- a/src/game/ClusterExec.c +++ b/src/game/ClusterExec.c @@ -127,9 +127,9 @@ void ClusterProc(ModelData *arg0) Vertextop = temp_r31->data.vertex->data; if (temp_r31->data.cenvCnt) { for (k = 0; k < temp_r31->data.vertex->count; k++) { - Vertextop[k].x = ((Vec *)temp_r31->data.file[0])[k].x; - Vertextop[k].y = ((Vec *)temp_r31->data.file[0])[k].y; - Vertextop[k].z = ((Vec *)temp_r31->data.file[0])[k].z; + Vertextop[k].x = ((Vec *)temp_r31->data.vtxtop)[k].x; + Vertextop[k].y = ((Vec *)temp_r31->data.vtxtop)[k].y; + Vertextop[k].z = ((Vec *)temp_r31->data.vtxtop)[k].z; } } SetClusterMain(var_r29); diff --git a/src/game/EnvelopeExec.c b/src/game/EnvelopeExec.c index 83da92b1..2a890986 100644 --- a/src/game/EnvelopeExec.c +++ b/src/game/EnvelopeExec.c @@ -36,7 +36,7 @@ void InitEnvelope(HsfData *arg0) { var_r31 = arg0->object; for (Meshcnt = i = 0; i < arg0->objectCnt; i++, var_r31++) { if (var_r31->type == 2) { - if (var_r31->data.file[0]) { + if (var_r31->data.vtxtop) { spC = var_r31->data.vertex; sp8 = var_r31->data.normal; Meshcnt++; @@ -173,17 +173,17 @@ static void SetEnvelopMain(HsfData *arg0) { if (var_r31->data.unk120[0] != 0) { Vertextop = temp_r30->data; } else { - Vertextop = var_r31->data.file[0]; + Vertextop = (Vec*)var_r31->data.vtxtop; } vtxenv = temp_r30->data; - normtop = var_r31->data.file[1]; + normtop = (Vec*)var_r31->data.normtop; normenv = temp_r28->data; var_r25 = var_r31->data.cenv; for (j = 0; j < var_r31->data.cenvCnt; j++, var_r25++) { SetEnvelop(var_r25); } sp10 = temp_r30->data; - spC = var_r31->data.file[0]; + spC = var_r31->data.vtxtop; sp8 = temp_r30->data; DCStoreRangeNoSync(normenv, temp_r28->count * sizeof(Vec)); DCStoreRangeNoSync(vtxenv, temp_r30->count * sizeof(Vec)); diff --git a/src/game/armem.c b/src/game/armem.c index 26b359f6..248b5c2b 100644 --- a/src/game/armem.c +++ b/src/game/armem.c @@ -1,6 +1,8 @@ #include "game/armem.h" #include "game/data.h" +#include + typedef struct armem_block { /* 0x00 */ u8 flag; /* 0x02 */ u16 dir; @@ -327,6 +329,12 @@ void HuARDirFree(u32 dir) { } } +#ifdef TARGET_PC +#define DIR_DATA (dir_data_pc) +#else +#define DIR_DATA (dir_data) +#endif + void *HuAR_ARAMtoMRAMFileRead(u32 dir, u32 num, HeapID heap) { s32 *dir_data; void *dst; @@ -335,6 +343,10 @@ void *HuAR_ARAMtoMRAMFileRead(u32 dir, u32 num, HeapID heap) { s32 count; s32 size; u32 amemptr; +#ifdef TARGET_PC + s32 dir_data_pc[2]; + s32 i; +#endif if ((amemptr = HuARDirCheck(dir)) == 0) { OSReport("Error: data none on ARAM %0x\n", dir); @@ -342,19 +354,25 @@ void *HuAR_ARAMtoMRAMFileRead(u32 dir, u32 num, HeapID heap) { return 0; } DCInvalidateRange(&preLoadBuf, sizeof(preLoadBuf)); - amem_src = amemptr + (u32)((u32)(((u16)dir + 1) * 4) & 0xFFFFFFFE0); + amem_src = amemptr + (u32)((((dir & 0xFFFF) + 1) * 4) & 0xFFFFFFFE0); arqCnt++; - ARQPostRequest(&ARQueBuf[arqIdx].req, 0x1234, 1, 0, amem_src, (u32) &preLoadBuf, sizeof(preLoadBuf), ArqCallBackAMFileRead); + ARQPostRequest(&ARQueBuf[arqIdx].req, 0x1234, 1, 0, amem_src, (uintptr_t) &preLoadBuf, sizeof(preLoadBuf), ArqCallBackAMFileRead); arqIdx++; arqIdx &= 0xF; while (HuARDMACheck()); dir_data = &preLoadBuf[(dir + 1) & 7]; - count = dir_data[0]; +#ifdef TARGET_PC + for (i = 0; i < 2; i++) { + dir_data_pc[i] = dir_data[i]; + byteswap_s32(&dir_data_pc[i]); + } +#endif + count = DIR_DATA[0]; amem_src = amemptr + (u32)(count & 0xFFFFFFFE0); - if (dir_data[1] - count < 0) { + if (DIR_DATA[1] - count < 0) { size = (HuARSizeGet(amemptr) - count + 0x3F) & 0xFFFFFFFE0; } else { - size = (dir_data[1] - count + 0x3F) & 0xFFFFFFFE0; + size = (DIR_DATA[1] - count + 0x3F) & 0xFFFFFFFE0; } dvd_data = HuMemDirectMalloc(HEAP_DVD, size); if (!dvd_data) { @@ -363,20 +381,28 @@ void *HuAR_ARAMtoMRAMFileRead(u32 dir, u32 num, HeapID heap) { DCFlushRangeNoSync(dvd_data, size); arqCnt++; PPCSync(); - ARQPostRequest(&ARQueBuf[arqIdx].req, 0x1234, 1, 0, amem_src, (u32) dvd_data, (u32) size, ArqCallBackAMFileRead); + ARQPostRequest(&ARQueBuf[arqIdx].req, 0x1234, 1, 0, amem_src, (uintptr_t) dvd_data, (u32) size, ArqCallBackAMFileRead); arqIdx++; arqIdx &= 0xF; while (HuARDMACheck()); dir_data = (s32*) ((u8*) dvd_data + (count & 0x1F)); - dst = HuMemDirectMallocNum(heap, (dir_data[0] + 1) & ~1, num); +#ifdef TARGET_PC + for (i = 0; i < 2; i++) { + dir_data_pc[i] = dir_data[i]; + byteswap_s32(&dir_data_pc[i]); + } +#endif + dst = HuMemDirectMallocNum(heap, (DIR_DATA[0] + 1) & ~1, num); if (!dst) { return 0; } - HuDecodeData(&dir_data[2], dst, dir_data[0], dir_data[1]); + HuDecodeData(&dir_data[2], dst, DIR_DATA[0], DIR_DATA[1]); HuMemDirectFree(dvd_data); return dst; } +#undef DIR_DATA + static void ArqCallBackAMFileRead(u32 pointerToARQRequest) { arqCnt--; (void)pointerToARQRequest; // required to match (return?) diff --git a/src/game/data.c b/src/game/data.c index 5fb4dca3..5376eab5 100644 --- a/src/game/data.c +++ b/src/game/data.c @@ -286,10 +286,11 @@ BOOL HuDataGetAsyncStat(s32 status) static void GetFileInfo(DataReadStat *read_stat, s32 file_num) { - u32 *temp_ptr; - temp_ptr = (u32 *)PTR_OFFSET(read_stat->dir, (file_num * 4))+1; + u32 *temp_ptr = (u32 *)PTR_OFFSET(read_stat->dir, (file_num * 4))+1; #ifdef TARGET_PC - byteswap_u32(temp_ptr); + u32 ofs = *temp_ptr; + byteswap_u32(&ofs); + temp_ptr = &ofs; #endif read_stat->file = PTR_OFFSET(read_stat->dir, *temp_ptr); temp_ptr = read_stat->file; @@ -336,7 +337,7 @@ void *HuDataReadNum(s32 data_num, s32 num) } read_stat = &ReadDataStat[status]; GetFileInfo(read_stat, data_num & 0xFFFF); - buf = HuMemDirectMallocNum(0, DATA_EFF_SIZE(read_stat->raw_len), num); + buf = HuMemDirectMallocNum(HEAP_SYSTEM, DATA_EFF_SIZE(read_stat->raw_len), num); if(buf) { HuDecodeData(read_stat->file, buf, read_stat->raw_len, read_stat->comp_type); } diff --git a/src/game/hsfdraw.c b/src/game/hsfdraw.c index 6aca1642..c225d85d 100755 --- a/src/game/hsfdraw.c +++ b/src/game/hsfdraw.c @@ -189,6 +189,10 @@ static void objCall(ModelData *arg0, HsfObject *arg1) static void objMesh(ModelData *arg0, HsfObject *arg1) { +#ifdef TARGET_PC + // TODO PC + return; +#endif HsfDrawObject *temp_r29; HsfConstData *temp_r25; HsfTransform *var_r30; @@ -2510,9 +2514,12 @@ void MakeDisplayList(s16 arg0, uintptr_t arg1) var_r30 = &Hu3DData[arg0]; curModelID = arg0; mallocNo = arg1; +#ifdef __MWERKS__ + // TODO PC faceNumBuf = HuMemDirectMallocNum(HEAP_DATA, 0x800 * sizeof(u16), mallocNo); MDObjCall(temp_r31, temp_r31->root); HuMemDirectFree(faceNumBuf); +#endif if (var_r30->attr & HU3D_ATTR_SHADOW) { Hu3DShadowCamBit++; } @@ -3347,14 +3354,13 @@ void PGObjReplica(ModelData *arg0, HsfObject *arg1) } } -HsfObject *Hu3DObjDuplicate(HsfData *arg0, u32 arg1) +HsfObject *Hu3DObjDuplicate(HsfData *arg0, uintptr_t arg1) { HsfObject *temp_r27; HsfObject *var_r30; HsfObject *var_r31; s16 i; s16 j; - var_r31 = HuMemDirectMallocNum(HEAP_DATA, arg0->objectCnt * sizeof(HsfObject), arg1); temp_r27 = var_r31; var_r30 = arg0->object; @@ -3362,7 +3368,7 @@ HsfObject *Hu3DObjDuplicate(HsfData *arg0, u32 arg1) for (i = 0; i < arg0->objectCnt; i++, var_r31++, var_r30++) { if (var_r31->type != 8 && var_r31->type != 7) { if (var_r31->data.parent) { - var_r31->data.parent = (HsfObject *)((u8 *)temp_r27 + ((u32)var_r30->data.parent - (u32)arg0->object)); + var_r31->data.parent = (HsfObject *)((u8 *)temp_r27 + ((uintptr_t)var_r30->data.parent - (uintptr_t)arg0->object)); } var_r31->data.children = HuMemDirectMallocNum(HEAP_DATA, var_r30->data.childrenCount * 4, arg1); if (var_r30->constData) { @@ -3370,7 +3376,7 @@ HsfObject *Hu3DObjDuplicate(HsfData *arg0, u32 arg1) memcpy(var_r31->constData, var_r30->constData, sizeof(HsfConstData)); } for (j = 0; j < var_r30->data.childrenCount; j++) { - var_r31->data.children[j] = (HsfObject *)((u8 *)temp_r27 + ((u32)var_r30->data.children[j] - (u32)arg0->object)); + var_r31->data.children[j] = (HsfObject *)((u8 *)temp_r27 + ((uintptr_t)var_r30->data.children[j] - (uintptr_t)arg0->object)); } } } diff --git a/src/game/hsfload.c b/src/game/hsfload.c index 0a4882fd..4d830854 100644 --- a/src/game/hsfload.c +++ b/src/game/hsfload.c @@ -1,6 +1,8 @@ #include "game/hsfload.h" -#include "string.h" +#include "game/EnvelopeExec.h" #include "ctype.h" +#include "string.h" + #ifdef TARGET_PC #include "game/memory.h" @@ -89,7 +91,9 @@ HsfData *LoadHSF(void *data) NormalLoad(); STLoad(); FaceLoad(); +#if __MWERKS__ ObjectLoad(); +#endif CenvLoad(); SkeletonLoad(); PartLoad(); @@ -98,6 +102,10 @@ HsfData *LoadHSF(void *data) MapAttrLoad(); MotionLoad(); MatrixLoad(); +#if TARGET_PC + // to properly set pointers + ObjectLoad(); +#endif hsf = SetHsfModel(); InitEnvelope(hsf); objtop = NULL; @@ -448,7 +456,7 @@ static void NormalLoad(void) Model.normal = new_normal; Model.normalCnt = head.normal.count; #ifdef TARGET_PC - VertexDataTop = data = (void *)&file_normal_real[head.normal.count]; + NormalDataTop = data = (void *)&file_normal_real[head.normal.count]; #else file_normal = (HsfBuffer *)((u32)fileptr+head.normal.ofs); NormalDataTop = data = (void *)&file_normal[head.normal.count]; @@ -460,8 +468,8 @@ static void NormalLoad(void) new_normal->data = (void *)((uintptr_t)data+(uintptr_t)temp_data); #ifdef TARGET_PC if (cenv_count != 0) { - for (i = 0; i < new_normal->count; i++) { - HsfVector3f *normalData = &((HsfVector3f *)new_normal->data)[i]; + for (j = 0; j < new_normal->count; j++) { + HsfVector3f *normalData = &((HsfVector3f *)new_normal->data)[j]; byteswap_hsfvec3f(normalData); } } @@ -647,8 +655,16 @@ static void DispObject(HsfObject *parent, HsfObject *object) } else { new_object->data.attribute = NULL; } - new_object->data.file[0] = (void *)((uintptr_t)fileptr + (uintptr_t)data->file[0]); - new_object->data.file[1] = (void *)((uintptr_t)fileptr + (uintptr_t)data->file[1]); + new_object->data.vtxtop = (void *)((uintptr_t)fileptr + (uintptr_t)data->vtxtop); + new_object->data.normtop = (void *)((uintptr_t)fileptr + (uintptr_t)data->normtop); +#ifdef TARGET_PC + for (i = 0; i < new_object->data.vertex->count; i++) { + byteswap_hsfvec3f(&new_object->data.vtxtop[i]); + } + for (i = 0; i < new_object->data.normal->count; i++) { + byteswap_hsfvec3f(&new_object->data.normtop[i]); + } +#endif new_object->data.base.pos.x = data->base.pos.x; new_object->data.base.pos.y = data->base.pos.y; new_object->data.base.pos.z = data->base.pos.z; @@ -906,46 +922,70 @@ static void CenvLoad(void) Model.cenv = cenv_file; for(i=0; idata = (Mtx *)((u32)fileptr+head.matrix.ofs+sizeof(HsfMatrix)); @@ -1883,12 +1923,16 @@ void KillHSF(HsfData *data) HuMemDirectFree(data->palette); HuMemDirectFree(data->st); HuMemDirectFree(data->vertex); + for (i = 0; i < data->cenvCnt; i++) { + HsfCenv *cenv = &data->cenv[i]; + HuMemDirectFree(cenv->dualData); + HuMemDirectFree(cenv->multiData); + } HuMemDirectFree(data->cenv); HuMemDirectFree(data->cluster); HuMemDirectFree(data->part); HuMemDirectFree(data->shape); HuMemDirectFree(data->mapAttr); HuMemDirectFree(data->symbol); - // TODO PC free embedded data } #endif diff --git a/src/game/hsfman.c b/src/game/hsfman.c index c4a4d3c5..7d640d35 100644 --- a/src/game/hsfman.c +++ b/src/game/hsfman.c @@ -416,12 +416,6 @@ s16 Hu3DModelLink(s16 arg0) { ModelData* var_r31; s16 var_r28; s16 i; - s32 temp_r0; - s32 temp_r3; - s32 temp_r5; - s32 var_ctr; - HsfData* var_r4; - HsfData* var_r5; temp_r30 = &Hu3DData[arg0]; var_r31 = Hu3DData; @@ -434,11 +428,11 @@ s16 Hu3DModelLink(s16 arg0) { return -1; } var_r31->unk_C8 = temp_r30->hsfData; - var_r31->hsfData = HuMemDirectMallocNum(HEAP_DATA, 0x80, var_r31->unk_4C); - var_r31->unk_4C = (u32)var_r31->hsfData; + var_r31->hsfData = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfData), var_r31->unk_4C); + var_r31->unk_4C = (uintptr_t)var_r31->hsfData; *var_r31->hsfData = *temp_r30->hsfData; temp_r3_2 = Hu3DObjDuplicate(var_r31->hsfData, var_r31->unk_4C); - var_r31->hsfData->root = (HsfObject*)((u32)temp_r3_2 + ((u32)var_r31->hsfData->root - (u32)var_r31->hsfData->object)); + var_r31->hsfData->root = (HsfObject*)((uintptr_t)temp_r3_2 + ((uintptr_t)var_r31->hsfData->root - (uintptr_t)var_r31->hsfData->object)); var_r31->hsfData->object = temp_r3_2; var_r31->unk_48 = temp_r30->unk_48; var_r31->attr = temp_r30->attr; diff --git a/src/game/messdata.c b/src/game/messdata.c index b2d2c25a..b106d259 100644 --- a/src/game/messdata.c +++ b/src/game/messdata.c @@ -1,5 +1,7 @@ #include "dolphin.h" +#include + static void *MessData_MesDataGet(void *messdata, u32 id) { s32 i; @@ -7,22 +9,50 @@ static void *MessData_MesDataGet(void *messdata, u32 id) u16 *banks; u16 bank; s32 *data; +#ifdef TARGET_PC + s32 ofs; + u16 bank_pc; +#endif bank = id >> 16; data = messdata; max_bank = *data; +#ifdef TARGET_PC + byteswap_s32(&max_bank); +#endif data++; +#ifdef TARGET_PC + ofs = *data; + byteswap_s32(&ofs); + banks = (u16 *)(((u8 *)messdata) + ofs); +#else banks = (u16 *)(((u8 *)messdata)+(*data)); - for(i=max_bank; i != 0; i--, banks += 2) { +#endif + for(i = max_bank; i != 0; i--, banks += 2) { +#ifdef TARGET_PC + bank_pc = *banks; + byteswap_u16(&bank_pc); + if(bank_pc == bank) { + break; + } +#else if(*banks == bank) { break; } +#endif } - if(i == 0) { + if (i == 0) { return NULL; - } else { - data += banks[1]; - return (((u8 *)messdata)+(*data)); } +#ifdef TARGET_PC + bank_pc = banks[1]; + byteswap_u16(&bank_pc); + ofs = data[bank_pc]; + byteswap_s32(&ofs); + return (((u8 *)messdata) + ofs); +#else + data += banks[1]; + return (((u8 *)messdata) + (*data)); +#endif } static void *_MessData_MesPtrGet(void *messbank, u32 id) @@ -30,16 +60,28 @@ static void *_MessData_MesPtrGet(void *messbank, u32 id) u16 index; s32 max_index; s32 *data; - +#ifdef TARGET_PC + s32 ofs; +#endif + index = id & 0xFFFF; data = messbank; max_index = *data; +#if TARGET_PC + byteswap_s32(&max_index); +#endif data++; if(max_index <= index) { return NULL; } else { data = data+index; +#ifdef TARGET_PC + ofs = *data; + byteswap_s32(&ofs); + return (((u8 *)messbank)+(ofs)); +#else return (((u8 *)messbank)+(*data)); +#endif } } diff --git a/src/game/sprput.c b/src/game/sprput.c index 8fb011d4..0bd57167 100644 --- a/src/game/sprput.c +++ b/src/game/sprput.c @@ -202,12 +202,18 @@ void HuSprTexLoad(AnimData *anim, short bmp, short slot, GXTexWrapMode wrap_s, G case ANIM_BMP_C8: GXInitTlutObj(&tlut_obj, bmp_ptr->palData, GX_TL_RGB5A3, bmp_ptr->palNum); GXLoadTlut(&tlut_obj, slot); +#ifdef TARGET_PC + GXDestroyTlutObj(&tlut_obj); +#endif GXInitTexObjCI(&tex_obj,bmp_ptr->data, sizeX, sizeY, GX_TF_C8, wrap_s, wrap_t, GX_FALSE, slot); break; case ANIM_BMP_C4: GXInitTlutObj(&tlut_obj, bmp_ptr->palData, GX_TL_RGB5A3, bmp_ptr->palNum); GXLoadTlut(&tlut_obj, slot); +#ifdef TARGET_PC + GXDestroyTlutObj(&tlut_obj); +#endif GXInitTexObjCI(&tex_obj,bmp_ptr->data, sizeX, sizeY, GX_TF_C4, wrap_s, wrap_t, GX_FALSE, slot); break; @@ -242,7 +248,6 @@ void HuSprTexLoad(AnimData *anim, short bmp, short slot, GXTexWrapMode wrap_s, G GXLoadTexObj(&tex_obj, slot); #ifdef TARGET_PC GXDestroyTexObj(&tex_obj); - GXDestroyTlutObj(&tlut_obj); #endif } diff --git a/src/game/window.c b/src/game/window.c index 5d5cd0b0..8e8bacc0 100644 --- a/src/game/window.c +++ b/src/game/window.c @@ -402,8 +402,8 @@ static void MesDispFunc(HuSprite *sprite) GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); - GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_RGBA6, 0); - GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_RGBA6, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGB, GX_RGBA8, 0); GXSetCullMode(GX_CULL_NONE); GXSetNumTexGens(1); @@ -453,16 +453,16 @@ static void MesDispFunc(HuSprite *sprite) } GXPosition3f32(char_x + 1.0f, char_y, 0.0f); GXColor4u8(window->mess_pal[color][0], window->mess_pal[color][1], window->mess_pal[color][2], alpha); - GXPosition2f32(uv_minx, uv_miny); + GXTexCoord2f32(uv_minx, uv_miny); GXPosition3f32(char_x + char_w, char_y, 0.0f); GXColor4u8(window->mess_pal[color][0], window->mess_pal[color][1], window->mess_pal[color][2], alpha); - GXPosition2f32(uv_maxx, uv_miny); + GXTexCoord2f32(uv_maxx, uv_miny); GXPosition3f32(char_x + char_w, char_y + 24.0f, 0.0f); GXColor4u8(window->mess_pal[color][0], window->mess_pal[color][1], window->mess_pal[color][2], alpha); - GXPosition2f32(uv_maxx, uv_maxy); + GXTexCoord2f32(uv_maxx, uv_maxy); GXPosition3f32(char_x + 1.0f, char_y + 24.0f, 0.0f); GXColor4u8(window->mess_pal[color][0], window->mess_pal[color][1], window->mess_pal[color][2], alpha); - GXPosition2f32(uv_minx, uv_maxy); + GXTexCoord2f32(uv_minx, uv_maxy); } GXEnd(); mesCharCnt++; @@ -1845,8 +1845,6 @@ s16 HuWinKeyWaitNumGet(u32 mess) { s16 wait_num; u8 *mess_data; -#ifdef __MWERKS__ - // TODO PC if (mess > 0x80000000) { mess_data = (u8 *)mess; @@ -1859,7 +1857,6 @@ s16 HuWinKeyWaitNumGet(u32 mess) wait_num++; } } -#endif return wait_num; } @@ -1901,7 +1898,7 @@ static void HuWinExCreatePortrait(s16 window, s16 portrait, float x, float y) WindowData *window_ptr; void *data; - data = HuAR_ARAMtoMRAMFileRead(winPortraitTbl[portrait], MEMORY_DEFAULT_NUM, 2); + data = HuAR_ARAMtoMRAMFileRead(winPortraitTbl[portrait], MEMORY_DEFAULT_NUM, HEAP_DATA); anim = HuSprAnimRead(data); window_ptr = &winData[window]; sprite = HuSprCreate(anim, window_ptr->prio - 1, 0); diff --git a/src/port/audio.c b/src/port/audio.c index 4b3e5085..0e5423df 100644 --- a/src/port/audio.c +++ b/src/port/audio.c @@ -259,7 +259,7 @@ s32 HuAudFXVolSet(int seNo, s16 vol) } s32 HuAudSeqPlay(s16 musId) { - s32 channel; + s32 channel = 0; if (musicOffF != 0 || omSysExitReq != 0) { return 0; diff --git a/src/port/byteswap.cpp b/src/port/byteswap.cpp index 64b61dbe..81e8b2c7 100644 --- a/src/port/byteswap.cpp +++ b/src/port/byteswap.cpp @@ -421,15 +421,18 @@ template void bswap(B &base, HsfBuffer32b &obj, HsfBuffer &dest) dest.data = reinterpret_cast(static_cast(obj.data)); } -template void bswap(B &base, HsfMatrix &obj) +template void bswap(B &base, HsfMatrix32b &obj, HsfMatrix &dest) { bswap(base, obj.base_idx); bswap(base, obj.count); - obj.data = reinterpret_cast(reinterpret_cast(&obj) + 0xC); // hardcoded for 64 bit support + dest.base_idx = obj.base_idx; + dest.count = obj.count; + + dest.data = reinterpret_cast(&obj + 1); for (s32 i = 0; i < obj.count; i++) { for (s32 j = 0; j < 3; j++) { - bswap_flat(base, obj.data[i][j], 4); + bswap_flat(base, dest.data[i][j], 4); } } } @@ -532,6 +535,48 @@ template void bswap(B &base, HsfCenvSingle &obj) bswap(base, obj.normalCnt); } +template void bswap(B &base, HsfCenvDualWeight &obj) +{ + bswap(base, obj.weight); + bswap(base, obj.pos); + bswap(base, obj.posCnt); + bswap(base, obj.normal); + bswap(base, obj.normalCnt); +} + +template void bswap(B &base, HsfCenvDual32b &obj, HsfCenvDual &dest) +{ + bswap(base, obj.target1); + bswap(base, obj.target2); + bswap(base, obj.weightCnt); + bswap(base, obj.weight); + + dest.target1 = obj.target1; + dest.target2 = obj.target2; + dest.weightCnt = obj.weightCnt; + dest.weight = reinterpret_cast(static_cast(obj.weight)); +} + +template void bswap(B &base, HsfCenvMultiWeight &obj) +{ + bswap(base, obj.target); + bswap(base, obj.value); +} + +template void bswap(B &base, HsfCenvMulti32b &obj, HsfCenvMulti &dest) +{ + bswap(base, obj.weightCnt); + bswap(base, obj.pos); + bswap(base, obj.posCnt); + bswap(base, obj.normal); + bswap(base, obj.normalCnt); + + dest.weightCnt = obj.weightCnt; + dest.pos = obj.pos; + dest.posCnt = obj.posCnt; + dest.weight = reinterpret_cast(static_cast(obj.weight)); +} + template void bswap(B &base, HsfCenv32b &obj, HsfCenv &dest) { bswap(base, obj.name); @@ -575,7 +620,8 @@ template void bswap(B &base, HsfObjectData32b &obj, HsfObjectData & bswap(base, obj.cluster); bswap(base, obj.cenvCnt); bswap(base, obj.cenv); - bswap_flat(base, obj.file, sizeof(obj.file) / sizeof(u32)); + bswap(base, obj.vtxtop); + bswap(base, obj.normtop); dest.parent = reinterpret_cast(static_cast(obj.parent)); dest.childrenCount = obj.childrenCount; @@ -598,8 +644,8 @@ template void bswap(B &base, HsfObjectData32b &obj, HsfObjectData & dest.cluster = reinterpret_cast(static_cast(obj.cluster)); dest.cenvCnt = obj.cenvCnt; dest.cenv = reinterpret_cast(static_cast(obj.cenv)); - dest.file[0] = reinterpret_cast(static_cast(obj.file[0])); - dest.file[1] = reinterpret_cast(static_cast(obj.file[1])); + dest.vtxtop = reinterpret_cast(static_cast(obj.vtxtop)); + dest.normtop = reinterpret_cast(static_cast(obj.normtop)); switch (type) { case HSF_OBJ_MESH: @@ -829,9 +875,9 @@ void byteswap_hsfbuffer(HsfBuffer32b *src, HsfBuffer *dest) sVisitedPtrs.clear(); } -void byteswap_hsfmatrix(HsfMatrix *src) +void byteswap_hsfmatrix(HsfMatrix32b *src, HsfMatrix *dest) { - bswap(*src, *src); + bswap(*src, *src, *dest); sVisitedPtrs.clear(); } @@ -877,6 +923,30 @@ void byteswap_hsfcenv_single(HsfCenvSingle *src) sVisitedPtrs.clear(); } +void byteswap_hsfcenv_dual_weight(HsfCenvDualWeight *src) +{ + bswap(*src, *src); + sVisitedPtrs.clear(); +} + +void byteswap_hsfcenv_dual(HsfCenvDual32b *src, HsfCenvDual *dest) +{ + bswap(*src, *src, *dest); + sVisitedPtrs.clear(); +} + +void byteswap_hsfcenv_multi_weight(HsfCenvMultiWeight *src) +{ + bswap(*src, *src); + sVisitedPtrs.clear(); +} + +void byteswap_hsfcenv_multi(HsfCenvMulti32b *src, HsfCenvMulti *dest) +{ + bswap(*src, *src, *dest); + sVisitedPtrs.clear(); +} + void byteswap_hsfcenv(HsfCenv32b *src, HsfCenv *dest) { bswap(*src, *src, *dest);