From b28ad659e31cd53f89e63617f8320d5b8deb4009 Mon Sep 17 00:00:00 2001 From: Roman971 <32455037+Roman971@users.noreply.github.com> Date: Sun, 5 Jun 2022 18:48:44 +0200 Subject: [PATCH] More minor isolated fixes (#1258) * Fix reversed array access in z_boss_dodongo.c * Remove useless return in z_en_encount2.c * Remove some redundant externs or declarations * Move some undefs to be performed as early as possible * AudioOcarina_ResetStaffs -> AudioOcarina_ResetStaves The plural appears to be staves for the music term * Remove some uses of UNK_PTR * Use NULL for pointers set to 0 in z_game_dlftbls.c * Remove useless !! in z_en_tk.c * Revert "AudioOcarina_ResetStaffs -> AudioOcarina_ResetStaves" This reverts commit 1b7fe624083558a89328740abab607771cefdd72. * Remove more redundant externs from PR suggestion --- include/variables.h | 2 -- include/z64.h | 6 +++--- include/z64scene.h | 9 ++++----- src/code/code_800EC960.c | 6 ------ src/code/z_game_dlftbls.c | 4 ++-- src/code/z_skelanime.c | 2 -- src/libultra/io/visetevent.c | 2 -- src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c | 2 +- src/overlays/actors/ovl_En_Encount2/z_en_encount2.c | 1 - src/overlays/actors/ovl_En_Horse/z_en_horse.c | 4 ---- src/overlays/actors/ovl_En_Hy/z_en_hy.c | 2 +- src/overlays/actors/ovl_En_Skj/z_en_skj.c | 1 - src/overlays/actors/ovl_En_Tk/z_en_tk.c | 2 +- src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c | 2 -- 14 files changed, 12 insertions(+), 33 deletions(-) diff --git a/include/variables.h b/include/variables.h index 083426294b..21a97a9293 100644 --- a/include/variables.h +++ b/include/variables.h @@ -202,8 +202,6 @@ extern volatile OSTime gRDPTotalTime; extern ActiveSound gActiveSounds[7][MAX_CHANNELS_PER_BANK]; // total size = 0xA8 extern u8 gSoundBankMuted[]; -extern u8 D_801333F0; -extern u8 gAudioSfxSwapOff; extern u16 gAudioSfxSwapSource[10]; extern u16 gAudioSfxSwapTarget[10]; extern u8 gAudioSfxSwapMode[10]; diff --git a/include/z64.h b/include/z64.h index b2248ea247..67b2b19f84 100644 --- a/include/z64.h +++ b/include/z64.h @@ -1453,11 +1453,11 @@ typedef struct { /* 0x08 */ u32 vromEnd; // if applicable /* 0x0C */ void* vramStart; // if applicable /* 0x10 */ void* vramEnd; // if applicable - /* 0x14 */ UNK_PTR unk_14; + /* 0x14 */ void* unk_14; /* 0x18 */ void* init; // initializes and executes the given context /* 0x1C */ void* destroy; // deconstructs the context, and sets the next context to load - /* 0x20 */ UNK_PTR unk_20; - /* 0x24 */ UNK_PTR unk_24; + /* 0x20 */ void* unk_20; + /* 0x24 */ void* unk_24; /* 0x28 */ UNK_TYPE4 unk_28; /* 0x2C */ u32 instanceSize; } GameStateOverlay; // size = 0x30 diff --git a/include/z64scene.h b/include/z64scene.h index c64897338a..98691db6cd 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -309,13 +309,12 @@ typedef enum { /* 0x6E */ SCENE_ID_MAX } SceneID; +#undef DEFINE_SCENE + // this define exists to preserve shiftability for an unused scene that is // listed in the entrance table #define SCENE_UNUSED_6E SCENE_ID_MAX -#undef DEFINE_SCENE - - // Entrance Index Enum #define DEFINE_ENTRANCE(enum, _1, _2, _3, _4, _5, _6) enum, @@ -324,6 +323,8 @@ typedef enum { /* 0x614 */ ENTR_MAX } EntranceIndex; +#undef DEFINE_ENTRANCE + #define ENTR_LOAD_OPENING -1 typedef enum { @@ -336,8 +337,6 @@ typedef enum { /* 0x7FFF */ ENTR_RETURN_GROTTO // Grottos and normal Fairy Fountain } ReturnEntranceIndex; -#undef DEFINE_ENTRANCE - typedef enum { /* 0 */ SDC_DEFAULT, /* 1 */ SDC_SPOT00, diff --git a/src/code/code_800EC960.c b/src/code/code_800EC960.c index 72bdd600db..9ed6dbbb4f 100644 --- a/src/code/code_800EC960.c +++ b/src/code/code_800EC960.c @@ -2297,12 +2297,6 @@ f32 D_80131C8C = 0.0f; // =========== Audio Debugging =========== -extern u16 gAudioSfxSwapSource[]; -extern u16 gAudioSfxSwapTarget[]; -extern u8 gAudioSfxSwapMode[]; -extern u8 gAudioSfxSwapOff; -extern u8 D_801333F0; - u32 sDebugPadHold; u32 sDebugPadBtnLast; u32 sDebugPadPress; diff --git a/src/code/z_game_dlftbls.c b/src/code/z_game_dlftbls.c index 278cb5620b..354967e286 100644 --- a/src/code/z_game_dlftbls.c +++ b/src/code/z_game_dlftbls.c @@ -3,10 +3,10 @@ #define GAMESTATE_OVERLAY(name, init, destroy, size) \ { \ NULL, (u32)_ovl_##name##SegmentRomStart, (u32)_ovl_##name##SegmentRomEnd, _ovl_##name##SegmentStart, \ - _ovl_##name##SegmentEnd, 0, init, destroy, 0, 0, 0, size \ + _ovl_##name##SegmentEnd, NULL, init, destroy, NULL, NULL, 0, size \ } #define GAMESTATE_OVERLAY_INTERNAL(init, destroy, size) \ - { NULL, 0, 0, NULL, NULL, 0, init, destroy, 0, 0, 0, size } + { NULL, 0, 0, NULL, NULL, NULL, init, destroy, NULL, NULL, 0, size } GameStateOverlay gGameStateOverlayTable[] = { GAMESTATE_OVERLAY_INTERNAL(TitleSetup_Init, TitleSetup_Destroy, sizeof(GameState)), diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 7ced702785..ffc294d0d5 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -9,8 +9,6 @@ s32 SkelAnime_LoopFull(SkelAnime* skelAnime); s32 SkelAnime_Once(SkelAnime* skelAnime); s32 SkelAnime_LoopPartial(SkelAnime* skelAnime); -void SkelAnime_CopyFrameTable(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src); - static u32 sDisableAnimQueueFlags = 0; static u32 sAnimQueueFlags; diff --git a/src/libultra/io/visetevent.c b/src/libultra/io/visetevent.c index 0239c1f7c4..89e482cf84 100644 --- a/src/libultra/io/visetevent.c +++ b/src/libultra/io/visetevent.c @@ -1,7 +1,5 @@ #include "global.h" -extern OSViContext* __osViNext; - void osViSetEvent(OSMesgQueue* mq, OSMesg msg, u32 retraceCount) { register u32 prevInt = __osDisableInt(); diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index b7116e64c5..9bc1ae44b1 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -55,7 +55,7 @@ static InitChainEntry sInitChain[] = { }; void func_808C1190(s16* arg0, u8* arg1, s16 arg2) { - if (arg2[arg1] != 0) { + if (arg1[arg2] != 0) { arg0[arg2 / 2] = 0; } } diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index c558374d61..db3acc1c4d 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -111,7 +111,6 @@ void EnEncount2_Wait(EnEncount2* this, PlayState* play) { } break; } - return; } void EnEncount2_SpawnRocks(EnEncount2* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index f1f82abeb0..a2fceb1013 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -3106,10 +3106,6 @@ void EnHorse_BgCheckSlowMoving(EnHorse* this, PlayState* play) { } } -void EnHorse_HighJumpInit(EnHorse* this, PlayState* play); -void EnHorse_Stub2(EnHorse* this); -void EnHorse_Stub1(EnHorse* this); - void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { s32 pad; s32 pad2; diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index 2722d147ba..196c9c96ac 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -1095,7 +1095,7 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po s32 pad; Vec3s sp48; u8 i; - UNK_PTR ptr; + void* ptr; if (1) {} diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index d26cba52f1..3ba2a3efea 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -56,7 +56,6 @@ void EnSkj_GiveOcarinaGameReward(EnSkj* this, PlayState* play); void EnSkj_FinishOcarinaGameRound(EnSkj* this, PlayState* play); void EnSkj_WaitForNextRound(EnSkj* this, PlayState* play); void EnSkj_WaitForOfferResponse(EnSkj* this, PlayState* play); -void EnSkj_SetupWaitForOcarina(EnSkj* this, PlayState* play); void EnSkj_CleanupOcarinaGame(EnSkj* this, PlayState* play); void EnSkj_Fade(EnSkj* this, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index a3b939d4a9..3581e263ef 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -491,7 +491,7 @@ void EnTk_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - if (gSaveContext.dayTime <= CLOCK_TIME(18, 0) || gSaveContext.dayTime >= CLOCK_TIME(21, 0) || !!LINK_IS_ADULT || + if (gSaveContext.dayTime <= CLOCK_TIME(18, 0) || gSaveContext.dayTime >= CLOCK_TIME(21, 0) || LINK_IS_ADULT || play->sceneNum != SCENE_SPOT02) { Actor_Kill(&this->actor); return; diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index 685cfaca75..991b14a024 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -33,8 +33,6 @@ void ObjectKankyo_DrawLightning(ObjectKankyo* this, PlayState* play); void ObjectKankyo_DrawSunGraveSpark(ObjectKankyo* this, PlayState* play); void ObjectKankyo_DrawBeams(ObjectKankyo* this, PlayState* play); -extern Mtx D_01000000; - static void* sEffLightningTextures[] = { gEffLightning1Tex, gEffLightning2Tex, gEffLightning3Tex, gEffLightning4Tex, gEffLightning5Tex, gEffLightning6Tex, gEffLightning7Tex, gEffLightning8Tex,