diff options
| author | engineer124 <47598039+engineer124@users.noreply.github.com> | 2023-02-26 15:48:42 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-26 21:48:42 +0100 |
| commit | 35887e25eedecac6d018ce066f27cc583bc8ecb6 (patch) | |
| tree | 93e95d94fc008e169b7760406f0efee7817dd6c9 /src/code | |
| parent | d4a6b21d4662abbc831b76b6d2e29a9bccb15a2a (diff) | |
Minor Misc Cleanup 2 (#1422)
* misc cleanup
* more cleanup
* more cleanup
* PR Suggestions
* cleanup cond
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/audio_heap.c | 4 | ||||
| -rw-r--r-- | src/code/audio_load.c | 10 | ||||
| -rw-r--r-- | src/code/audio_synthesis.c | 2 | ||||
| -rw-r--r-- | src/code/code_800AD920.c | 2 | ||||
| -rw-r--r-- | src/code/code_800E4FE0.c | 14 | ||||
| -rw-r--r-- | src/code/code_800F7260.c | 6 | ||||
| -rw-r--r-- | src/code/z_bgcheck.c | 12 | ||||
| -rw-r--r-- | src/code/z_collision_check.c | 4 | ||||
| -rw-r--r-- | src/code/z_effect.c | 6 | ||||
| -rw-r--r-- | src/code/z_message_PAL.c | 83 | ||||
| -rw-r--r-- | src/code/z_play.c | 2 | ||||
| -rw-r--r-- | src/code/z_player_lib.c | 2 |
12 files changed, 79 insertions, 68 deletions
diff --git a/src/code/audio_heap.c b/src/code/audio_heap.c index fd61dc984..4b586c8c5 100644 --- a/src/code/audio_heap.c +++ b/src/code/audio_heap.c @@ -1172,7 +1172,7 @@ SampleCacheEntry* AudioHeap_AllocTemporarySampleCacheEntry(u32 size) { index = -1; for (i = 0; i < gAudioCtx.preloadSampleStackTop; i++) { preload = &gAudioCtx.preloadSampleStack[i]; - if (preload->isFree == false) { + if (!preload->isFree) { startRamAddr = preload->ramAddr; endRamAddr = preload->ramAddr + preload->sample->size - 1; @@ -1408,7 +1408,7 @@ void AudioHeap_ApplySampleBankCacheInternal(s32 apply, s32 sampleBankId) { } fakematch = &change.oldAddr; - if ((apply != false) && (apply == true)) { + if (apply && (apply == true)) { u32 temp = change.newAddr; change.newAddr = *fakematch; // = change.oldAddr diff --git a/src/code/audio_load.c b/src/code/audio_load.c index b32b47963..f30527d97 100644 --- a/src/code/audio_load.c +++ b/src/code/audio_load.c @@ -192,8 +192,8 @@ void* AudioLoad_DmaSampleData(u32 devAddr, u32 size, s32 arg2, u8* dmaIndexRef, dma->ttl = 3; dma->devAddr = dmaDevAddr; dma->sizeUnused = transfer; - AudioLoad_Dma(&gAudioCtx.currAudioFrameDmaIoMsgBuf[gAudioCtx.curAudioFrameDmaCount++], OS_MESG_PRI_NORMAL, OS_READ, - dmaDevAddr, dma->ramAddr, transfer, &gAudioCtx.currAudioFrameDmaQueue, medium, "SUPERDMA"); + AudioLoad_Dma(&gAudioCtx.curAudioFrameDmaIoMsgBuf[gAudioCtx.curAudioFrameDmaCount++], OS_MESG_PRI_NORMAL, OS_READ, + dmaDevAddr, dma->ramAddr, transfer, &gAudioCtx.curAudioFrameDmaQueue, medium, "SUPERDMA"); *dmaIndexRef = dmaIndex; return (devAddr - dmaDevAddr) + dma->ramAddr; } @@ -1166,8 +1166,8 @@ void AudioLoad_Init(void* heap, u32 heapSize) { gAudioCtx.rspTask[0].task.t.data_size = 0; gAudioCtx.rspTask[1].task.t.data_size = 0; osCreateMesgQueue(&gAudioCtx.syncDmaQueue, &gAudioCtx.syncDmaMesg, 1); - osCreateMesgQueue(&gAudioCtx.currAudioFrameDmaQueue, gAudioCtx.currAudioFrameDmaMsgBuf, - ARRAY_COUNT(gAudioCtx.currAudioFrameDmaMsgBuf)); + osCreateMesgQueue(&gAudioCtx.curAudioFrameDmaQueue, gAudioCtx.curAudioFrameDmaMsgBuf, + ARRAY_COUNT(gAudioCtx.curAudioFrameDmaMsgBuf)); osCreateMesgQueue(&gAudioCtx.externalLoadQueue, gAudioCtx.externalLoadMsgBuf, ARRAY_COUNT(gAudioCtx.externalLoadMsgBuf)); osCreateMesgQueue(&gAudioCtx.preloadSampleQueue, gAudioCtx.preloadSampleMsgBuf, @@ -1824,7 +1824,7 @@ s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) { preloadIndex >>= 24; preload = &gAudioCtx.preloadSampleStack[preloadIndex]; - if (preload->isFree == false) { + if (!preload->isFree) { sample = preload->sample; key = (u32)sample->sampleAddr + sample->size + sample->medium; if (key == preload->endAndMediumKey) { diff --git a/src/code/audio_synthesis.c b/src/code/audio_synthesis.c index ca7467f91..51b2c2e5a 100644 --- a/src/code/audio_synthesis.c +++ b/src/code/audio_synthesis.c @@ -1326,7 +1326,7 @@ Acmd* AudioSynth_ApplyHaasEffect(Acmd* cmd, NoteSubEu* noteSubEu, NoteSynthesisS aDMEMMove(cmd++, DMEM_TEMP, DMEM_HAAS_TEMP + haasEffectDelaySize, size); } - if (haasEffectDelaySize) { // != 0 + if ((u32)haasEffectDelaySize != 0) { // Save excessive samples for next iteration aSaveBuffer(cmd++, DMEM_HAAS_TEMP + size, synthState->synthesisBuffers->haasEffectDelayState, ALIGN16(haasEffectDelaySize)); diff --git a/src/code/code_800AD920.c b/src/code/code_800AD920.c index 3bc30b1c5..94479e164 100644 --- a/src/code/code_800AD920.c +++ b/src/code/code_800AD920.c @@ -27,7 +27,7 @@ void func_800AD950(struct_80166500* this) { void func_800AD958(struct_80166500* this, Gfx** gfxp) { Gfx* gfx = *gfxp; u16* tex = D_0E000000; - s32 fmt = this->useRgba == false ? G_IM_FMT_IA : G_IM_FMT_RGBA; + s32 fmt = !this->useRgba ? G_IM_FMT_IA : G_IM_FMT_RGBA; s32 y; s32 height = 6; diff --git a/src/code/code_800E4FE0.c b/src/code/code_800E4FE0.c index 7b575d025..53cd7d246 100644 --- a/src/code/code_800E4FE0.c +++ b/src/code/code_800E4FE0.c @@ -46,7 +46,7 @@ AudioTask* func_800E5000(void) { s32 pad; s32 j; s32 sp5C; - s16* currAiBuffer; + s16* curAiBuffer; OSTask_t* task; s32 index; u32 sp4C; @@ -88,21 +88,21 @@ AudioTask* func_800E5000(void) { sp5C = gAudioCtx.curAudioFrameDmaCount; for (i = 0; i < gAudioCtx.curAudioFrameDmaCount; i++) { - if (osRecvMesg(&gAudioCtx.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK) == 0) { + if (osRecvMesg(&gAudioCtx.curAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK) == 0) { sp5C--; } } if (sp5C != 0) { for (i = 0; i < sp5C; i++) { - osRecvMesg(&gAudioCtx.currAudioFrameDmaQueue, NULL, OS_MESG_BLOCK); + osRecvMesg(&gAudioCtx.curAudioFrameDmaQueue, NULL, OS_MESG_BLOCK); } } - sp48 = MQ_GET_COUNT(&gAudioCtx.currAudioFrameDmaQueue); + sp48 = MQ_GET_COUNT(&gAudioCtx.curAudioFrameDmaQueue); if (sp48 != 0) { for (i = 0; i < sp48; i++) { - osRecvMesg(&gAudioCtx.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK); + osRecvMesg(&gAudioCtx.curAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK); } } @@ -133,7 +133,7 @@ AudioTask* func_800E5000(void) { gAudioCtx.curAbiCmdBuf = gAudioCtx.abiCmdBufs[gAudioCtx.rspTaskIndex]; index = gAudioCtx.curAiBufIndex; - currAiBuffer = gAudioCtx.aiBuffers[index]; + curAiBuffer = gAudioCtx.aiBuffers[index]; gAudioCtx.aiBufLengths[index] = (s16)((((gAudioCtx.audioBufferParameters.samplesPerFrameTarget - samplesRemainingInAi) + @@ -162,7 +162,7 @@ AudioTask* func_800E5000(void) { } gAudioCtx.curAbiCmdBuf = - AudioSynth_Update(gAudioCtx.curAbiCmdBuf, &abiCmdCnt, currAiBuffer, gAudioCtx.aiBufLengths[index]); + AudioSynth_Update(gAudioCtx.curAbiCmdBuf, &abiCmdCnt, curAiBuffer, gAudioCtx.aiBufLengths[index]); // Update audioRandom to the next random number gAudioCtx.audioRandom = (gAudioCtx.audioRandom + gAudioCtx.totalTaskCount) * osGetCount(); diff --git a/src/code/code_800F7260.c b/src/code/code_800F7260.c index f316798a5..4fa6b50a9 100644 --- a/src/code/code_800F7260.c +++ b/src/code/code_800F7260.c @@ -140,7 +140,7 @@ void Audio_RemoveMatchingSfxRequests(u8 aspect, SfxBankEntry* cmp) { break; } if (remove) { - req->sfxId = 0; + req->sfxId = NA_SE_NONE; } } } @@ -158,9 +158,11 @@ void Audio_ProcessSfxRequest(void) { req = &sSfxRequests[gSfxRequestReadIndex]; evictIndex = 0x80; - if (req->sfxId == 0) { + + if (req->sfxId == NA_SE_NONE) { return; } + bankId = SFX_BANK(req->sfxId); if ((1 << bankId) & D_801333F0) { AudioDebug_ScrPrt("SE", req->sfxId); diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 089747457..f3575870e 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1610,7 +1610,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader customNodeListMax = sceneSubdivisionList[i].nodeListMax; } } - if (useCustomSubdivisions == false) { + if (!useCustomSubdivisions) { colCtx->subdivAmount.x = 16; colCtx->subdivAmount.y = 4; colCtx->subdivAmount.z = 16; @@ -2296,7 +2296,7 @@ s32 BgCheck_CheckLineImpl(CollisionContext* colCtx, u16 xpFlags1, u16 xpFlags2, sectorMin.z += colCtx->subdivLength.z; sectorMax.z += colCtx->subdivLength.z; } - } else if (BgCheck_PosInStaticBoundingBox(colCtx, posA) == false) { + } else if (!BgCheck_PosInStaticBoundingBox(colCtx, posA)) { return false; } else { result = @@ -2722,7 +2722,7 @@ s32 DynaPoly_SetBgActor(PlayState* play, DynaCollisionContext* dyna, Actor* acto } } - if (foundSlot == false) { + if (!foundSlot) { osSyncPrintf(VT_FGCOL(RED)); osSyncPrintf("DynaPolyInfo_setActor():ダイナミックポリゴン 空きインデックスはありません\n"); osSyncPrintf(VT_RST); @@ -2788,7 +2788,7 @@ void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgI osSyncPrintf(VT_FGCOL(GREEN)); osSyncPrintf("DynaPolyInfo_delReserve():index %d\n", bgId); osSyncPrintf(VT_RST); - if (DynaPoly_IsBgIdBgActor(bgId) == false) { + if (!DynaPoly_IsBgIdBgActor(bgId)) { if (bgId == -1) { osSyncPrintf(VT_FGCOL(GREEN)); @@ -3178,8 +3178,8 @@ f32 BgCheck_RaycastDownDyna(DynaRaycastDown* dynaRaycastDown) { if (dynaRaycastDown->actor == dynaRaycastDown->colCtx->dyna.bgActors[i].actor || dynaRaycastDown->pos->y < dynaRaycastDown->colCtx->dyna.bgActors[i].minY || - Math3D_XZInSphere(&dynaRaycastDown->colCtx->dyna.bgActors[i].boundingSphere, dynaRaycastDown->pos->x, - dynaRaycastDown->pos->z) == false) { + !Math3D_XZInSphere(&dynaRaycastDown->colCtx->dyna.bgActors[i].boundingSphere, dynaRaycastDown->pos->x, + dynaRaycastDown->pos->z)) { continue; } diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 7c4d4259a..e4d758f15 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -3537,7 +3537,7 @@ s32 CollisionCheck_CylSideVsLineSeg(f32 radius, f32 height, f32 offset, Vec3f* a return 0; } - if (intersect2 == false) { + if (!intersect2) { if (frac1 < 0.0f || 1.0f < frac1) { return 0; } @@ -3564,7 +3564,7 @@ s32 CollisionCheck_CylSideVsLineSeg(f32 radius, f32 height, f32 offset, Vec3f* a ((frac2 * itemStep.y + actorToItem.y < 0.0f) || (height < frac2 * itemStep.y + actorToItem.y))) { intersect2 = false; } - if (intersect1 == false && intersect2 == false) { + if (!intersect1 && !intersect2) { return 0; } else if ((intersect1 == true) && (intersect2 == true)) { out1->x = frac1 * itemStep.x + actorToItem.x + actorPos->x; diff --git a/src/code/z_effect.c b/src/code/z_effect.c index a72fbc494..dd5436bc2 100644 --- a/src/code/z_effect.c +++ b/src/code/z_effect.c @@ -109,7 +109,7 @@ void Effect_Add(PlayState* play, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* switch (type) { case EFFECT_SPARK: for (i = 0; i < SPARK_COUNT; i++) { - if (sEffectContext.sparks[i].status.active == false) { + if (!sEffectContext.sparks[i].status.active) { slotFound = true; *pIndex = i; effect = &sEffectContext.sparks[i].effect; @@ -121,7 +121,7 @@ void Effect_Add(PlayState* play, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* case EFFECT_BLURE1: case EFFECT_BLURE2: for (i = 0; i < BLURE_COUNT; i++) { - if (sEffectContext.blures[i].status.active == false) { + if (!sEffectContext.blures[i].status.active) { slotFound = true; *pIndex = i + SPARK_COUNT; effect = &sEffectContext.blures[i].effect; @@ -132,7 +132,7 @@ void Effect_Add(PlayState* play, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* break; case EFFECT_SHIELD_PARTICLE: for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) { - if (sEffectContext.shieldParticles[i].status.active == false) { + if (!sEffectContext.shieldParticles[i].status.active) { slotFound = true; *pIndex = i + SPARK_COUNT + BLURE_COUNT; effect = &sEffectContext.shieldParticles[i].effect; diff --git a/src/code/z_message_PAL.c b/src/code/z_message_PAL.c index b0805ba3b..b076757bd 100644 --- a/src/code/z_message_PAL.c +++ b/src/code/z_message_PAL.c @@ -183,7 +183,7 @@ void Message_CloseTextbox(PlayState* play) { msgCtx->stateTimer = 2; msgCtx->msgMode = MSGMODE_TEXT_CLOSING; msgCtx->textboxEndType = TEXTBOX_ENDTYPE_DEFAULT; - Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, + Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } @@ -743,10 +743,9 @@ u16 Message_DrawItemIcon(PlayState* play, u16 itemId, Gfx** p, u16 i) { MessageContext* msgCtx = &play->msgCtx; // clang-format off - if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4, - &gSfxDefaultFreqAndVolScale, - &gSfxDefaultFreqAndVolScale, - &gSfxDefaultReverb); + if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { \ + Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultReverb); } // clang-format on @@ -860,7 +859,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { play->msgCtx.textPosX = R_TEXT_INIT_XPOS; - if (sTextIsCredits == false) { + if (!sTextIsCredits) { msgCtx->textPosY = R_TEXT_INIT_YPOS; } else { msgCtx->textPosY = YREG(1); @@ -898,7 +897,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { case MESSAGE_BOX_BREAK: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { if (!sTextboxSkipped) { - Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); msgCtx->msgMode = MSGMODE_TEXT_AWAIT_NEXT; Font_LoadMessageBoxIcon(font, TEXTBOX_ICON_TRIANGLE); @@ -916,7 +915,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { case MESSAGE_TEXTID: msgCtx->textboxEndType = TEXTBOX_ENDTYPE_HAS_NEXT; if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { - Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); msgCtx->msgMode = MSGMODE_TEXT_DONE; Font_LoadMessageBoxIcon(font, TEXTBOX_ICON_TRIANGLE); @@ -948,6 +947,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { if (character) {} } + FALLTHROUGH; case MESSAGE_QUICKTEXT_DISABLE: break; case MESSAGE_AWAIT_BUTTON_PRESS: @@ -996,10 +996,9 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { break; case MESSAGE_BACKGROUND: // clang-format off - if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4, - &gSfxDefaultFreqAndVolScale, - &gSfxDefaultFreqAndVolScale, - &gSfxDefaultReverb); + if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { \ + Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } // clang-format on gDPPipeSync(gfx++); @@ -1113,7 +1112,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { return; case MESSAGE_PERSISTENT: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { - Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); msgCtx->msgMode = MSGMODE_TEXT_DONE; msgCtx->textboxEndType = TEXTBOX_ENDTYPE_PERSISTENT; @@ -1133,7 +1132,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { default: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING && i + 1 == msgCtx->textDrawPos && msgCtx->textDelayTimer == msgCtx->textDelay) { - Audio_PlaySfxGeneral(0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + Audio_PlaySfxGeneral(NA_SE_NONE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } Message_DrawTextChar(play, &font->charTexBuf[charTexIdx], &gfx); @@ -1755,7 +1754,7 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) { s32 textId; s16 j; s16 i; - s16 noStop; + s16 noStopDoAction; s32 k; osSyncPrintf(VT_FGCOL(GREEN)); @@ -1781,7 +1780,7 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) { // "Ocarina Number" osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ オカリナ番号=%d(%d) ☆☆☆☆☆\n" VT_RST, ocarinaActionId, 2); - noStop = false; + noStopDoAction = false; if (ocarinaActionId >= 0x893) { Message_OpenText(play, ocarinaActionId); // You played the [song name] textId = ocarinaActionId + 0x86E; @@ -1805,7 +1804,7 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) { } } else { msgCtx->ocarinaAction = ocarinaActionId; - noStop = true; + noStopDoAction = true; if (ocarinaActionId >= OCARINA_ACTION_PLAYBACK_MINUET) { osSyncPrintf("222222222\n"); Message_OpenText(play, 0x86D); // Play using [A] and [C]. @@ -1835,11 +1834,11 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) { msgCtx->msgMode = MSGMODE_TEXT_CONTINUING; } msgCtx->textboxColorAlphaCurrent = msgCtx->textboxColorAlphaTarget; - if (noStop == false) { + if (!noStopDoAction) { Interface_LoadActionLabelB(play, DO_ACTION_STOP); - noStop = gSaveContext.hudVisibilityMode; + noStopDoAction = gSaveContext.hudVisibilityMode; Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_B_ALT); - gSaveContext.hudVisibilityMode = noStop; + gSaveContext.hudVisibilityMode = noStopDoAction; } // "Music Performance Start" osSyncPrintf("演奏開始\n"); @@ -2091,7 +2090,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { msgCtx->stateTimer = 20; msgCtx->msgMode = MSGMODE_SONG_DEMONSTRATION_SELECT_INSTRUMENT; } else { - AudioOcarina_Start((1 << (msgCtx->ocarinaAction + 0x11)) + 0x8000); + AudioOcarina_Start((1 << (msgCtx->ocarinaAction - OCARINA_ACTION_PLAYBACK_MINUET)) + 0x8000); // "Performance Check" osSyncPrintf("演奏チェック=%d\n", msgCtx->ocarinaAction - OCARINA_ACTION_PLAYBACK_MINUET); msgCtx->msgMode = MSGMODE_SONG_PLAYBACK; @@ -2470,9 +2469,9 @@ void Message_DrawMain(PlayState* play, Gfx** p) { case MSGMODE_SONG_PLAYED_ACT: msgCtx->stateTimer--; if (msgCtx->stateTimer == 0) { - if (msgCtx->lastPlayedSong < OCARINA_SONG_SARIAS && - (msgCtx->ocarinaAction < OCARINA_ACTION_PLAYBACK_MINUET || - msgCtx->ocarinaAction >= OCARINA_ACTION_PLAYBACK_SARIA)) { + if ((msgCtx->lastPlayedSong <= OCARINA_SONG_PRELUDE) && + !(msgCtx->ocarinaAction >= OCARINA_ACTION_PLAYBACK_MINUET && + msgCtx->ocarinaAction <= OCARINA_ACTION_PLAYBACK_PRELUDE)) { if (msgCtx->disableWarpSongs || interfaceCtx->restrictions.warpSongs == 3) { Message_StartTextbox(play, 0x88C, NULL); // "You can't warp here!" play->msgCtx.ocarinaMode = OCARINA_MODE_04; @@ -2500,7 +2499,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { osSyncPrintf(VT_FGCOL(YELLOW)); osSyncPrintf("Ocarina_PC_Wind=%d(%d) ☆☆☆ ", OCARINA_ACTION_CHECK_MINUET, msgCtx->ocarinaAction - OCARINA_ACTION_CHECK_MINUET); - if (msgCtx->lastPlayedSong + OCARINA_ACTION_CHECK_MINUET == msgCtx->ocarinaAction) { + if (msgCtx->lastPlayedSong == (msgCtx->ocarinaAction - OCARINA_ACTION_CHECK_MINUET)) { play->msgCtx.ocarinaMode = OCARINA_MODE_03; } else { play->msgCtx.ocarinaMode = msgCtx->lastPlayedSong - 1; @@ -2509,7 +2508,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { osSyncPrintf(VT_FGCOL(GREEN)); osSyncPrintf("Ocarina_C_Wind=%d(%d) ☆☆☆ ", OCARINA_ACTION_PLAYBACK_MINUET, msgCtx->ocarinaAction - OCARINA_ACTION_PLAYBACK_MINUET); - if (msgCtx->lastPlayedSong + OCARINA_ACTION_PLAYBACK_MINUET == msgCtx->ocarinaAction) { + if (msgCtx->lastPlayedSong == (msgCtx->ocarinaAction - OCARINA_ACTION_PLAYBACK_MINUET)) { play->msgCtx.ocarinaMode = OCARINA_MODE_03; } else { play->msgCtx.ocarinaMode = OCARINA_MODE_04; @@ -2535,7 +2534,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { if (sOcarinaButtonIndexBufPos != 0 && msgCtx->ocarinaStaff->pos == 1) { sOcarinaButtonIndexBufPos = 0; } - if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) { + if (((u32)msgCtx->ocarinaStaff->pos != 0) && + (sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) { msgCtx->lastOcarinaButtonIndex = sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->buttonIndex; sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_BTN_INVALID; @@ -2548,7 +2548,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { break; case MSGMODE_SONG_PLAYBACK: msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff(); - if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) { + if (((u32)msgCtx->ocarinaStaff->pos != 0) && + (sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) { sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->buttonIndex; sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_BTN_INVALID; sOcarinaButtonIndexBufPos++; @@ -2595,7 +2596,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { case MSGMODE_SCARECROW_LONG_RECORDING_ONGOING: msgCtx->ocarinaStaff = AudioOcarina_GetRecordingStaff(); osSyncPrintf("\nonpu_pt=%d, locate=%d", sOcarinaButtonIndexBufPos, msgCtx->ocarinaStaff->pos); - if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) { + if (((u32)msgCtx->ocarinaStaff->pos != 0) && + (sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) { if (sOcarinaButtonIndexBufLen >= 8) { for (buttonIndexPos = sOcarinaButtonIndexBufLen - 8, i = 0; i < 8; i++, buttonIndexPos++) { sOcarinaButtonIndexBuf[buttonIndexPos] = sOcarinaButtonIndexBuf[buttonIndexPos + 1]; @@ -2646,7 +2648,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { case MSGMODE_SCARECROW_LONG_PLAYBACK: case MSGMODE_SCARECROW_SPAWN_PLAYBACK: msgCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff(); - if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) { + if (((u32)msgCtx->ocarinaStaff->pos != 0) && + (sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) { if (sOcarinaButtonIndexBufLen >= 8) { for (buttonIndexPos = sOcarinaButtonIndexBufLen - 8, i = 0; i < 8; i++, buttonIndexPos++) { sOcarinaButtonIndexBuf[buttonIndexPos] = sOcarinaButtonIndexBuf[buttonIndexPos + 1]; @@ -2681,7 +2684,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { break; case MSGMODE_SCARECROW_SPAWN_RECORDING_ONGOING: msgCtx->ocarinaStaff = AudioOcarina_GetRecordingStaff(); - if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) { + if (((u32)msgCtx->ocarinaStaff->pos != 0) && + (sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) { msgCtx->lastOcarinaButtonIndex = sOcarinaButtonIndexBuf[sOcarinaButtonIndexBufPos] = msgCtx->ocarinaStaff->buttonIndex; sOcarinaButtonIndexBufPos++; @@ -2738,7 +2742,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { Audio_PlaySfxGeneral(NA_SE_SY_METRONOME_LV - SFX_FLAG, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); msgCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff(); - if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) { + if (((u32)msgCtx->ocarinaStaff->pos != 0) && + (sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) { sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->buttonIndex; sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_BTN_INVALID; sOcarinaButtonIndexBufPos++; @@ -2761,7 +2766,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { case MSGMODE_MEMORY_GAME_LEFT_SKULLKID_WAIT: case MSGMODE_MEMORY_GAME_RIGHT_SKULLKID_WAIT: msgCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff(); - if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) { + if (((u32)msgCtx->ocarinaStaff->pos != 0) && + (sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) { sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->buttonIndex; sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_BTN_INVALID; sOcarinaButtonIndexBufPos++; @@ -2771,7 +2777,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { Audio_PlaySfxGeneral(NA_SE_SY_METRONOME_LV - SFX_FLAG, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff(); - if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) { + if (((u32)msgCtx->ocarinaStaff->pos != 0) && + (sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) { sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->buttonIndex; sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_BTN_INVALID; sOcarinaButtonIndexBufPos++; @@ -2796,7 +2803,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { break; case MSGMODE_MEMORY_GAME_ROUND_SUCCESS: msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff(); - if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) { + if (((u32)msgCtx->ocarinaStaff->pos != 0) && + (sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) { sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->buttonIndex; sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_BTN_INVALID; sOcarinaButtonIndexBufPos++; @@ -2835,7 +2843,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { break; case MSGMODE_FROGS_PLAYING: msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff(); - if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) { + if (((u32)msgCtx->ocarinaStaff->pos != 0) && + (sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1)) { msgCtx->lastOcarinaButtonIndex = msgCtx->ocarinaStaff->buttonIndex; msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0; Message_ResetOcarinaNoteState(); @@ -3318,7 +3327,7 @@ void Message_Update(PlayState* play) { // Later, if the ocarina has not been played and another textbox is closed, this handling // for Saria's song will be carried out. player->naviTextId = -0xE0; - player->naviActor->flags |= 0x10000; + player->naviActor->flags |= ACTOR_FLAG_16; } if (msgCtx->ocarinaAction == OCARINA_ACTION_FREE_PLAY_DONE && (play->msgCtx.ocarinaMode == OCARINA_MODE_01 || play->msgCtx.ocarinaMode == OCARINA_MODE_0B)) { diff --git a/src/code/z_play.c b/src/code/z_play.c index 825dad33b..4eeaa8111 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -514,7 +514,7 @@ void Play_Update(PlayState* this) { } } - if (this->transitionMode) { // != TRANS_MODE_OFF + if ((u32)this->transitionMode != TRANS_MODE_OFF) { switch (this->transitionMode) { case TRANS_MODE_SETUP: if (this->transitionTrigger != TRANS_TRIGGER_END) { diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 624e94d39..5f799970a 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -1322,7 +1322,7 @@ void func_80090A28(Player* this, Vec3f* vecs) { D_8012608C.x = D_80126080.x; if (this->unk_845 >= 3) { - this->unk_845 += 1; + this->unk_845++; D_8012608C.x *= 1.0f + ((9 - this->unk_845) * 0.1f); } |
