Misc Fixes (#1778)

* kaleido_map double parens

* ObjUm PostLimbDraw fake match

* z_parameter double parens

* voice_internal func_801A541C return type

* audio load missing return comments

* EnTest7_DrawFeathers

* EnTest7_UpdateFeathers

* format
This commit is contained in:
Derek Hensley 2024-12-25 16:19:36 -08:00 committed by GitHub
parent cb6a10208c
commit 602053c349
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 28 additions and 36 deletions

View File

@ -442,6 +442,7 @@ s32 AudioLoad_SyncLoadSample(Sample* sample, s32 fontId) {
sample->sampleAddr = sampleAddr; 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) { 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) { if (instrument->normalRangeHi != 0x7F) {
return AudioLoad_SyncLoadSample(instrument->highPitchTunedSample.sample, fontId); 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) { } else if (instId == 0x7F) {
Drum* drum = AudioPlayback_GetDrum(fontId, drumId); 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); AudioLoad_SyncLoadSample(drum->tunedSample.sample, fontId);
return 0; 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) { 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; gAudioCtx.seqPlayers[playerIndex].skipTicks = 0;
AudioLoad_SyncInitSeqPlayerInternal(playerIndex, seqId, arg2); AudioLoad_SyncInitSeqPlayerInternal(playerIndex, seqId, arg2);
// Intentionally missing return. Returning the result of the above function //! @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 //! 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. //! 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. //! The callers of this function do not use the return value, so it's fine.
} }
s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIndex, s32 seqId, s32 skipTicks) { 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; gAudioCtx.seqPlayers[playerIndex].skipTicks = skipTicks;
AudioLoad_SyncInitSeqPlayerInternal(playerIndex, seqId, 0); 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) { s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIndex, s32 seqId, s32 arg2) {

View File

@ -143,7 +143,7 @@ void func_801A53E8(u16 distance, u16 answerNum, u16 warning, u16 voiceLevel, u16
} }
// Unused // Unused
s32 func_801A541C(s32 analog, s32 digital) { void func_801A541C(s32 analog, s32 digital) {
s32 errorCode; s32 errorCode;
OSMesgQueue* serialEventQueue; OSMesgQueue* serialEventQueue;

View File

@ -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_MASK_GIANT)) &&
(GET_CUR_FORM_BTN_ITEM(i) != ITEM_PICTOGRAPH_BOX)) { (GET_CUR_FORM_BTN_ITEM(i) != ITEM_PICTOGRAPH_BOX)) {
if ((gSaveContext.buttonStatus[i] == BTN_ENABLED)) { if (gSaveContext.buttonStatus[i] == BTN_ENABLED) {
restoreHudVisibility = true; restoreHudVisibility = true;
gSaveContext.buttonStatus[i] = BTN_DISABLED; 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_MASK_GIANT)) &&
(GET_CUR_FORM_BTN_ITEM(i) != ITEM_PICTOGRAPH_BOX)) { (GET_CUR_FORM_BTN_ITEM(i) != ITEM_PICTOGRAPH_BOX)) {
if ((gSaveContext.buttonStatus[i] == BTN_DISABLED)) { if (gSaveContext.buttonStatus[i] == BTN_DISABLED) {
restoreHudVisibility = true; restoreHudVisibility = true;
gSaveContext.buttonStatus[i] = BTN_ENABLED; gSaveContext.buttonStatus[i] = BTN_ENABLED;
} }

View File

@ -233,20 +233,20 @@ void EnTest7_UpdateFeatherType2(PlayState* play, OwlWarpFeather* feather) {
} }
void EnTest7_UpdateFeathers(PlayState* play, OwlWarpFeather* feathers, EnTest7* this, s32 arg3, s32 arg4) { void EnTest7_UpdateFeathers(PlayState* play, OwlWarpFeather* feathers, EnTest7* this, s32 arg3, s32 arg4) {
s32 pad[4]; s32 pad;
OwlWarpFeather* feather;
s16 phi_s1;
s32 i; s32 i;
f32 temp_f28; f32 temp_f28;
Vec3f sp8C;
f32 temp_f0; f32 temp_f0;
f32 temp_f22; f32 temp_f22;
f32 temp_f24; f32 temp_f24;
f32 temp_f26; f32 temp_f26;
f32 temp_f2; f32 temp_f2;
Vec3f sp8C;
OwlWarpFeather* feather;
s16 phi_s1;
for (i = 0, feather = feathers; i < (OWL_WARP_NUM_FEATHERS * sizeof(OwlWarpFeather)); for (i = 0; i < OWL_WARP_NUM_FEATHERS; i++) {
i += sizeof(OwlWarpFeather), feather++) { feather = &feathers[i];
if (feather->type == OWL_WARP_FEATHER_TYPE_DISABLED) { if (feather->type == OWL_WARP_FEATHER_TYPE_DISABLED) {
continue; continue;
@ -306,12 +306,8 @@ void EnTest7_UpdateFeathers(PlayState* play, OwlWarpFeather* feathers, EnTest7*
} }
void EnTest7_DrawFeathers(PlayState* play2, OwlWarpFeather* feathers) { void EnTest7_DrawFeathers(PlayState* play2, OwlWarpFeather* feathers) {
s32 pad[3];
PlayState* play = play2; PlayState* play = play2;
Mtx* mtx;
OwlWarpFeather* feather;
s32 i; s32 i;
MtxF sp6C;
OPEN_DISPS(play->state.gfxCtx); 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); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x80, 255, 255, 255, 255);
gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255);
for (i = 0, feather = feathers; i < (OWL_WARP_NUM_FEATHERS * sizeof(OwlWarpFeather)); for (i = 0; i < OWL_WARP_NUM_FEATHERS; i++) {
i += sizeof(OwlWarpFeather), feather++) { Mtx* mtx;
MtxF sp6C;
OwlWarpFeather* feather = &feathers[i];
if (feather->type == OWL_WARP_FEATHER_TYPE_DISABLED) { if (feather->type == OWL_WARP_FEATHER_TYPE_DISABLED) {
continue; continue;
} }

View File

@ -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; ObjUm* this = (ObjUm*)thisx;
GraphicsContext* gfxCtx = play->state.gfxCtx; GraphicsContext* gfxCtx = play2->state.gfxCtx;
Mtx* mtx;
Gfx* spFC[] = { Gfx* spFC[] = {
NULL, gUmBrokenMinigamePotDL, gUmMinigamePotDL, gUmMinigamePotDL, gUmMinigamePotDL, object_um_DL_0067C0 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) { if (limbIndex == UM_LIMB_WAGON_CART_BED) {
Vec3f* potPos; Mtx* mtx;
Vec3f sp88; Vec3f sp88;
Vec3s sp80; Vec3s sp80;
s32 i; s32 i;
f32 sp70[] = { 2000.0f, 0.0f, -2000.0f }; f32 sp70[] = { 2000.0f, 0.0f, -2000.0f };
s32 pad;
//! FAKE:
if (i) {}
sp80.x = 0; sp80.x = 0;
sp80.z = 0; sp80.z = 0;
@ -1934,9 +1930,8 @@ void ObjUm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
Matrix_Push(); Matrix_Push();
Matrix_TranslateRotateZYX(&sp88, &sp80); Matrix_TranslateRotateZYX(&sp88, &sp80);
mtx = Matrix_Finalize(gfxCtx); mtx = Matrix_Finalize(gfxCtx);
potPos = &this->potPos[i];
Matrix_MultVec3f(&spC0, &calcPotPos); Matrix_MultVec3f(&spC0, &calcPotPos);
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &calcPotPos, potPos, &spB0); SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &calcPotPos, &this->potPos[i], &spB0);
if (this->wasPotHit[i]) { if (this->wasPotHit[i]) {
this->wasPotHit[i] = false; this->wasPotHit[i] = false;
@ -1953,9 +1948,6 @@ void ObjUm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
return; return;
} }
//! FAKE:
if (play) {}
gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (spFC[this->potsLife[i]] != NULL) { if (spFC[this->potsLife[i]] != NULL) {

View File

@ -770,7 +770,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play) {
// Find the region that player is currently in // Find the region that player is currently in
// Loop over region (n) and regionIndex (j) // Loop over region (n) and regionIndex (j)
while (true) { while (true) {
if ((gSceneIdsPerRegion[n][j] == 0xFFFF)) { if (gSceneIdsPerRegion[n][j] == 0xFFFF) {
n++; n++;
j = 0; j = 0;
if (n == REGION_MAX) { if (n == REGION_MAX) {