diff --git a/src/audio/lib/load.c b/src/audio/lib/load.c index d4a3b9d8131..7b36af6a394 100644 --- a/src/audio/lib/load.c +++ b/src/audio/lib/load.c @@ -442,6 +442,7 @@ s32 AudioLoad_SyncLoadSample(Sample* sample, s32 fontId) { sample->sampleAddr = sampleAddr; } } + //! @bug Missing return, but the return value is never used so it's fine. } s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) { @@ -458,7 +459,7 @@ s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) { if (instrument->normalRangeHi != 0x7F) { return AudioLoad_SyncLoadSample(instrument->highPitchTunedSample.sample, fontId); } - // TODO: is this missing return UB? + //! @bug Missing return, but the return value is never used so it's fine. } else if (instId == 0x7F) { Drum* drum = AudioPlayback_GetDrum(fontId, drumId); @@ -468,7 +469,7 @@ s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) { AudioLoad_SyncLoadSample(drum->tunedSample.sample, fontId); return 0; } - // TODO: is this missing return UB? + //! @bug Missing return, but the return value is never used so it's fine. } void AudioLoad_AsyncLoad(s32 tableType, s32 id, s32 nChunks, s32 retData, OSMesgQueue* retQueue) { @@ -561,10 +562,10 @@ s32 AudioLoad_SyncInitSeqPlayer(s32 playerIndex, s32 seqId, s32 arg2) { gAudioCtx.seqPlayers[playerIndex].skipTicks = 0; AudioLoad_SyncInitSeqPlayerInternal(playerIndex, seqId, arg2); - // Intentionally missing return. Returning the result of the above function - // call matches but is UB because it too is missing a return, and using the - // result of a non-void function that has failed to return a value is UB. - // The callers of this function do not use the return value, so it's fine. + //! @bug missing return. Returning the result of the above function + //! call matches but is UB because it too is missing a return, and using the + //! result of a non-void function that has failed to return a value is UB. + //! The callers of this function do not use the return value, so it's fine. } s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIndex, s32 seqId, s32 skipTicks) { @@ -574,7 +575,7 @@ s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIndex, s32 seqId, s32 skipTic gAudioCtx.seqPlayers[playerIndex].skipTicks = skipTicks; AudioLoad_SyncInitSeqPlayerInternal(playerIndex, seqId, 0); - // Missing return, see above. + //! @bug Missing return, see comment in AudioLoad_SyncInitSeqPlayer above. } s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIndex, s32 seqId, s32 arg2) { diff --git a/src/audio/voice_internal.c b/src/audio/voice_internal.c index 3bef9b2f7db..22a77ede917 100644 --- a/src/audio/voice_internal.c +++ b/src/audio/voice_internal.c @@ -143,7 +143,7 @@ void func_801A53E8(u16 distance, u16 answerNum, u16 warning, u16 voiceLevel, u16 } // Unused -s32 func_801A541C(s32 analog, s32 digital) { +void func_801A541C(s32 analog, s32 digital) { s32 errorCode; OSMesgQueue* serialEventQueue; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 7171a661b22..4c6ac58e5d8 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -2161,7 +2161,7 @@ void Interface_UpdateButtonsPart2(PlayState* play) { (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_MASK_GIANT)) && (GET_CUR_FORM_BTN_ITEM(i) != ITEM_PICTOGRAPH_BOX)) { - if ((gSaveContext.buttonStatus[i] == BTN_ENABLED)) { + if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { restoreHudVisibility = true; gSaveContext.buttonStatus[i] = BTN_DISABLED; } @@ -2176,7 +2176,7 @@ void Interface_UpdateButtonsPart2(PlayState* play) { (GET_CUR_FORM_BTN_ITEM(i) <= ITEM_MASK_GIANT)) && (GET_CUR_FORM_BTN_ITEM(i) != ITEM_PICTOGRAPH_BOX)) { - if ((gSaveContext.buttonStatus[i] == BTN_DISABLED)) { + if (gSaveContext.buttonStatus[i] == BTN_DISABLED) { restoreHudVisibility = true; gSaveContext.buttonStatus[i] = BTN_ENABLED; } diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.c b/src/overlays/actors/ovl_En_Test7/z_en_test7.c index f3b81587dcf..a18a5f8986a 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -233,20 +233,20 @@ void EnTest7_UpdateFeatherType2(PlayState* play, OwlWarpFeather* feather) { } void EnTest7_UpdateFeathers(PlayState* play, OwlWarpFeather* feathers, EnTest7* this, s32 arg3, s32 arg4) { - s32 pad[4]; - OwlWarpFeather* feather; - s16 phi_s1; + s32 pad; s32 i; f32 temp_f28; - Vec3f sp8C; f32 temp_f0; f32 temp_f22; f32 temp_f24; f32 temp_f26; f32 temp_f2; + Vec3f sp8C; + OwlWarpFeather* feather; + s16 phi_s1; - for (i = 0, feather = feathers; i < (OWL_WARP_NUM_FEATHERS * sizeof(OwlWarpFeather)); - i += sizeof(OwlWarpFeather), feather++) { + for (i = 0; i < OWL_WARP_NUM_FEATHERS; i++) { + feather = &feathers[i]; if (feather->type == OWL_WARP_FEATHER_TYPE_DISABLED) { continue; @@ -306,12 +306,8 @@ void EnTest7_UpdateFeathers(PlayState* play, OwlWarpFeather* feathers, EnTest7* } void EnTest7_DrawFeathers(PlayState* play2, OwlWarpFeather* feathers) { - s32 pad[3]; PlayState* play = play2; - Mtx* mtx; - OwlWarpFeather* feather; s32 i; - MtxF sp6C; OPEN_DISPS(play->state.gfxCtx); @@ -322,8 +318,11 @@ void EnTest7_DrawFeathers(PlayState* play2, OwlWarpFeather* feathers) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x80, 255, 255, 255, 255); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); - for (i = 0, feather = feathers; i < (OWL_WARP_NUM_FEATHERS * sizeof(OwlWarpFeather)); - i += sizeof(OwlWarpFeather), feather++) { + for (i = 0; i < OWL_WARP_NUM_FEATHERS; i++) { + Mtx* mtx; + MtxF sp6C; + OwlWarpFeather* feather = &feathers[i]; + if (feather->type == OWL_WARP_FEATHER_TYPE_DISABLED) { continue; } diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c index 75bf7083d16..7b1aec62323 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -1876,10 +1876,10 @@ void ObjUm_SpawnFragments(PlayState* play, Vec3f* potPos) { } } -void ObjUm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { +void ObjUm_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + PlayState* play = play2; ObjUm* this = (ObjUm*)thisx; - GraphicsContext* gfxCtx = play->state.gfxCtx; - Mtx* mtx; + GraphicsContext* gfxCtx = play2->state.gfxCtx; Gfx* spFC[] = { NULL, gUmBrokenMinigamePotDL, gUmMinigamePotDL, gUmMinigamePotDL, gUmMinigamePotDL, object_um_DL_0067C0 }; @@ -1905,15 +1905,11 @@ void ObjUm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, } if (limbIndex == UM_LIMB_WAGON_CART_BED) { - Vec3f* potPos; + Mtx* mtx; Vec3f sp88; Vec3s sp80; s32 i; f32 sp70[] = { 2000.0f, 0.0f, -2000.0f }; - s32 pad; - - //! FAKE: - if (i) {} sp80.x = 0; sp80.z = 0; @@ -1934,9 +1930,8 @@ void ObjUm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Matrix_Push(); Matrix_TranslateRotateZYX(&sp88, &sp80); mtx = Matrix_Finalize(gfxCtx); - potPos = &this->potPos[i]; Matrix_MultVec3f(&spC0, &calcPotPos); - SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &calcPotPos, potPos, &spB0); + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &calcPotPos, &this->potPos[i], &spB0); if (this->wasPotHit[i]) { this->wasPotHit[i] = false; @@ -1953,9 +1948,6 @@ void ObjUm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, return; } - //! FAKE: - if (play) {} - gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (spFC[this->potsLife[i]] != NULL) { diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c index 5f99e096c3b..6b0d42c593a 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c @@ -770,7 +770,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play) { // Find the region that player is currently in // Loop over region (n) and regionIndex (j) while (true) { - if ((gSceneIdsPerRegion[n][j] == 0xFFFF)) { + if (gSceneIdsPerRegion[n][j] == 0xFFFF) { n++; j = 0; if (n == REGION_MAX) {