diff --git a/include/variables.h b/include/variables.h index 24030fd990..e264a7d9b9 100644 --- a/include/variables.h +++ b/include/variables.h @@ -459,30 +459,6 @@ extern u8 D_801BDBC8; // extern UNK_TYPE1 D_801BE92C; // extern UNK_TYPE1 D_801BE944; // extern actor_init_var_func sInitChainHandlers[11]; -// extern UNK_TYPE2 sHeartsPrimColors; -// extern UNK_TYPE2 D_801BE992; -// extern UNK_TYPE2 D_801BE994; -// extern UNK_TYPE2 sHeartsEnvColors; -// extern UNK_TYPE2 D_801BE9A6; -// extern UNK_TYPE2 D_801BE9A8; -// extern UNK_TYPE2 sHeartsPrimFactors; -// extern UNK_TYPE2 sHeartsEnvFactors; -// extern UNK_TYPE2 sHeartsDDPrimColors; -// extern UNK_TYPE2 D_801BE9E2; -// extern UNK_TYPE2 D_801BE9E4; -// extern UNK_TYPE2 sHeartsDDEnvColors; -// extern UNK_TYPE2 D_801BE9F6; -// extern UNK_TYPE2 D_801BE9F8; -// extern UNK_TYPE2 sHeartsDDPrimFactors; -// extern UNK_TYPE2 D_801BEA0A; -// extern UNK_TYPE2 D_801BEA0C; -// extern UNK_TYPE2 sHeartsDDEnvFactors; -// extern UNK_TYPE2 D_801BEA1E; -// extern UNK_TYPE2 D_801BEA20; -// extern UNK_TYPE1 HeartTextures; -// extern UNK_TYPE1 HeartDDTextures; -//extern LightsPosBindFunc posBindFuncs[3]; -//extern LightsBindFunc dirBindFuncs[3]; // extern UNK_TYPE4 D_801BEAD4; // extern UNK_TYPE4 D_801BEAD8; // extern UNK_TYPE1 D_801BEAE0; diff --git a/src/audio/code_8019AF00.c b/src/audio/code_8019AF00.c index 287149c911..e88135b8dd 100644 --- a/src/audio/code_8019AF00.c +++ b/src/audio/code_8019AF00.c @@ -2543,8 +2543,8 @@ void AudioOcarina_CheckSongsWithoutMusicStaff(void) { if ((u32)sOcarinaAvailableSongFlags & (1 << songIndex)) { // Loops through all possible starting indices? // Loops through the notes of the song? - for (j = 0, k = 0; j < gOcarinaSongButtons[songIndex].numButtons && k == 0 && - sOcarinaWithoutMusicStaffPos >= gOcarinaSongButtons[songIndex].numButtons;) { + for (j = 0, k = 0; (j < gOcarinaSongButtons[songIndex].numButtons) && (k == 0) && + (sOcarinaWithoutMusicStaffPos >= gOcarinaSongButtons[songIndex].numButtons);) { pitch = sCurOcarinaSongWithoutMusicStaff[(sOcarinaWithoutMusicStaffPos - gOcarinaSongButtons[songIndex].numButtons) + @@ -2953,7 +2953,7 @@ void AudioOcarina_SetRecordingSong(u8 isRecordingComplete) { i = sRecordSongPos; pitch = OCARINA_PITCH_NONE; - while (i != 0 && pitch == OCARINA_PITCH_NONE) { + while ((i != 0) && (pitch == OCARINA_PITCH_NONE)) { i--; pitch = recordedSong[i].pitch; } diff --git a/src/audio/lib/effects.c b/src/audio/lib/effects.c index feddf73caf..6ef8added0 100644 --- a/src/audio/lib/effects.c +++ b/src/audio/lib/effects.c @@ -26,7 +26,7 @@ void AudioEffects_SequenceChannelProcessSound(SequenceChannel* channel, s32 reca for (i = 0; i < ARRAY_COUNT(channel->layers); i++) { SequenceLayer* layer = channel->layers[i]; - if (layer != NULL && layer->enabled && layer->note != NULL) { + if ((layer != NULL) && layer->enabled && (layer->note != NULL)) { if (layer->notePropertiesNeedInit) { layer->noteFreqScale = layer->freqScale * chanFreqScale; layer->noteVelocity = layer->velocitySquare2 * channel->appliedVolume; diff --git a/src/audio/lib/heap.c b/src/audio/lib/heap.c index 0a64c0d1b4..1ea26952b6 100644 --- a/src/audio/lib/heap.c +++ b/src/audio/lib/heap.c @@ -1303,8 +1303,8 @@ void AudioHeap_DiscardSampleCacheEntry(SampleCacheEntry* entry) { sampleBankId1 = gAudioCtx.soundFontList[fontId].sampleBankId1; sampleBankId2 = gAudioCtx.soundFontList[fontId].sampleBankId2; if (((sampleBankId1 != 0xFF) && (entry->sampleBankId == sampleBankId1)) || - ((sampleBankId2 != 0xFF) && (entry->sampleBankId == sampleBankId2)) || entry->sampleBankId == 0 || - entry->sampleBankId == 0xFE) { + ((sampleBankId2 != 0xFF) && (entry->sampleBankId == sampleBankId2)) || (entry->sampleBankId == 0) || + (entry->sampleBankId == 0xFE)) { if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, fontId) != NULL) { if (1) {} if (AudioLoad_IsFontLoadComplete(fontId) != 0) { @@ -1369,7 +1369,7 @@ void AudioHeap_DiscardSampleCaches(void) { if ((sampleBankId1 == 0xFF) && (sampleBankId2 == 0xFF)) { continue; } - if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_PERMANENT, fontId) == NULL || + if ((AudioHeap_SearchCaches(FONT_TABLE, CACHE_PERMANENT, fontId) == NULL) || !AudioLoad_IsFontLoadComplete(fontId)) { continue; } @@ -1393,7 +1393,7 @@ typedef struct { } StorageChange; void AudioHeap_ChangeStorage(StorageChange* change, Sample* sample) { - if (sample != NULL && ((sample->medium == change->newMedium) || (D_801FD120 != 1)) && + if ((sample != NULL) && ((sample->medium == change->newMedium) || (D_801FD120 != 1)) && ((sample->medium == MEDIUM_RAM) || (D_801FD120 != 0))) { uintptr_t startAddr = change->oldAddr; uintptr_t endAddr = change->oldAddr + change->size; diff --git a/src/audio/lib/load.c b/src/audio/lib/load.c index 3a4f1c1e0d..7df46952b8 100644 --- a/src/audio/lib/load.c +++ b/src/audio/lib/load.c @@ -138,13 +138,13 @@ void* AudioLoad_DmaSampleData(uintptr_t devAddr, size_t size, s32 arg2, u8* dmaI s32 bufferPos; u32 i; - if (arg2 != 0 || *dmaIndexRef >= gAudioCtx.sampleDmaListSize1) { + if ((arg2 != 0) || (*dmaIndexRef >= gAudioCtx.sampleDmaListSize1)) { for (i = gAudioCtx.sampleDmaListSize1; i < gAudioCtx.sampleDmaCount; i++) { dma = &gAudioCtx.sampleDmas[i]; bufferPos = devAddr - dma->devAddr; - if (0 <= bufferPos && ((u32)bufferPos <= dma->size - size)) { + if ((0 <= bufferPos) && ((u32)bufferPos <= (dma->size - size))) { // We already have a DMA request for this memory range. - if (dma->ttl == 0 && gAudioCtx.sampleDmaReuseQueue2RdPos != gAudioCtx.sampleDmaReuseQueue2WrPos) { + if ((dma->ttl == 0) && (gAudioCtx.sampleDmaReuseQueue2RdPos != gAudioCtx.sampleDmaReuseQueue2WrPos)) { // Move the DMA out of the reuse queue, by swapping it with the // read pos, and then incrementing the read pos. if (dma->reuseIndex != gAudioCtx.sampleDmaReuseQueue2RdPos) { @@ -1905,7 +1905,7 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* fontData } gAudioCtx.numUsedSamples = 0; - if (gAudioCtx.preloadSampleStackTop != 0 && !preloadInProgress) { + if ((gAudioCtx.preloadSampleStackTop != 0) && !preloadInProgress) { topPreload = &gAudioCtx.preloadSampleStack[gAudioCtx.preloadSampleStackTop - 1]; sample = topPreload->sample; nChunks = (sample->size >> 12) + 1; @@ -2160,7 +2160,7 @@ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, SampleBankRelocInfo* } gAudioCtx.numUsedSamples = 0; - if (gAudioCtx.preloadSampleStackTop != 0 && !preloadInProgress) { + if ((gAudioCtx.preloadSampleStackTop != 0) && !preloadInProgress) { topPreload = &gAudioCtx.preloadSampleStack[gAudioCtx.preloadSampleStackTop - 1]; sample = topPreload->sample; nChunks = (sample->size >> 12) + 1; diff --git a/src/audio/lib/playback.c b/src/audio/lib/playback.c index deb6e82b99..678e010895 100644 --- a/src/audio/lib/playback.c +++ b/src/audio/lib/playback.c @@ -597,7 +597,7 @@ s32 AudioPlayback_BuildSyntheticWave(Note* note, SequenceLayer* layer, s32 waveI } freqScale = layer->freqScale; - if (layer->portamento.mode != 0 && 0.0f < layer->portamento.extent) { + if ((layer->portamento.mode != 0) && (0.0f < layer->portamento.extent)) { freqScale *= (layer->portamento.extent + 1.0f); } @@ -906,7 +906,7 @@ Note* AudioPlayback_AllocNoteFromActive(NotePool* pool, SequenceLayer* layer) { aPriority = aNote->playbackState.priority; } - if (rNote == NULL && aNote == NULL) { + if ((rNote == NULL) && (aNote == NULL)) { return NULL; } @@ -928,8 +928,8 @@ Note* AudioPlayback_AllocNote(SequenceLayer* layer) { if (policy & 1) { note = layer->note; - if (note != NULL && note->playbackState.prevParentLayer == layer && - note->playbackState.wantedParentLayer == NO_LAYER) { + if ((note != NULL) && (note->playbackState.prevParentLayer == layer) && + (note->playbackState.wantedParentLayer == NO_LAYER)) { AudioPlayback_NoteReleaseAndTakeOwnership(note, layer); AudioPlayback_AudioListRemove(¬e->listItem); AudioScript_AudioListPushBack(¬e->listItem.pool->releasing, ¬e->listItem); diff --git a/src/boot_O2/__osMalloc.c b/src/boot_O2/__osMalloc.c index 24fa6d39ec..71a5a5ba3c 100644 --- a/src/boot_O2/__osMalloc.c +++ b/src/boot_O2/__osMalloc.c @@ -275,7 +275,7 @@ void __osFree(Arena* arena, void* ptr) { node = (ArenaNode*)((uintptr_t)ptr - sizeof(ArenaNode)); - if (ptr != NULL && node->magic == NODE_MAGIC && !node->isFree) { + if ((ptr != NULL) && (node->magic == NODE_MAGIC) && !node->isFree) { next = node->next; prev = node->prev; node->isFree = true; @@ -297,7 +297,7 @@ void __osFree(Arena* arena, void* ptr) { // Checks if the previous node is contiguous to the current node and if it isn't currently allocated. Then merge // the two nodes into one. - if (prev != NULL && prev->isFree && (uintptr_t)node == (uintptr_t)prev + sizeof(ArenaNode) + prev->size) { + if ((prev != NULL) && prev->isFree && ((uintptr_t)node == (uintptr_t)prev + sizeof(ArenaNode) + prev->size)) { if (next != NULL) { next->prev = prev; } diff --git a/src/boot_O2/system_heap.c b/src/boot_O2/system_heap.c index 66e53dc124..365d945966 100644 --- a/src/boot_O2/system_heap.c +++ b/src/boot_O2/system_heap.c @@ -61,7 +61,7 @@ void* SystemHeap_RunBlockFunc8(void* blk, size_t nBlk, size_t blkSize, BlockFunc blk = SystemHeap_Malloc(nBlk * blkSize); } - if (blk != NULL && blockFunc != NULL) { + if ((blk != NULL) && (blockFunc != NULL)) { uintptr_t pos = blk; for (; pos < (uintptr_t)blk + (nBlk * blkSize); pos += (blkSize & ~0)) { diff --git a/src/code/PreRender.c b/src/code/PreRender.c index 172659cf7d..c9f279e759 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -403,7 +403,7 @@ void PreRender_ApplyAntiAliasingFilter(PreRender* this) { * Applies filters to the framebuffer prerender to make it look smoother */ void PreRender_ApplyFilters(PreRender* this) { - if (this->cvgSave == NULL || this->fbufSave == NULL) { + if ((this->cvgSave == NULL) || (this->fbufSave == NULL)) { this->unk_4D = 0; } else { this->unk_4D = 1; diff --git a/src/code/jpegutils.c b/src/code/jpegutils.c index 904643f46f..fbf6c69c27 100644 --- a/src/code/jpegutils.c +++ b/src/code/jpegutils.c @@ -86,7 +86,7 @@ u32 JpegUtils_ProcessHuffmanTableImpl(u8* data, JpegHuffmanTable* ht, u8* codesL s32 temp; ret = count; - if (count == 0 || (isAc && count > 0x100) || (!isAc && count > 0x10)) { + if ((count == 0) || (isAc && (count > 0x100)) || (!isAc && (count > 0x10))) { return 0; } if (ret != JpegUtils_GetHuffmanCodes(codesLengths, codes)) { @@ -141,7 +141,7 @@ u32 JpegUtils_ProcessHuffmanTableImplOld(u8* dht, JpegHuffmanTableOld* ht, u8* c count2 = count = JpegUtils_ParseHuffmanCodesLengths(dht, codesLengths); - if (count == 0 || (isAc && count > 0x100) || (!isAc && count > 0x10)) { + if ((count == 0) || (isAc && (count > 0x100)) || (!isAc && (count > 0x10))) { return true; } diff --git a/src/code/sched.c b/src/code/sched.c index 9e20168333..c06eb41ba9 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -25,7 +25,7 @@ void Sched_SwapFramebuffer(CfbInfo* cfbInfo) { osViSwapBuffer(cfbInfo->swapBuffer); cfbInfo->updateRate2 = cfbInfo->updateRate; - if (SREG(62) == 0 && cfbInfo->viMode != NULL) { + if ((SREG(62) == 0) && (cfbInfo->viMode != NULL)) { D_80096B20 = one; osViSetMode(cfbInfo->viMode); osViSetSpecialFeatures(cfbInfo->features); @@ -68,7 +68,7 @@ void Sched_HandleAudioCancel(SchedContext* sched) { // AUDIO SP Cancel osSyncPrintf("AUDIO SP キャンセルします\n"); - if (sched->curRSPTask != NULL && sched->curRSPTask->list.t.type == M_AUDTASK) { + if ((sched->curRSPTask != NULL) && (sched->curRSPTask->list.t.type == M_AUDTASK)) { if (!(HW_REG(SP_STATUS_REG, u32) & SP_STATUS_HALT)) { // Attempts to stop AUDIO SP osSyncPrintf("AUDIO SP止めようとします\n"); @@ -130,7 +130,7 @@ void Sched_HandleGfxCancel(SchedContext* sched) { // GRAPH SP Cancel osSyncPrintf("GRAPH SP キャンセルします\n"); - if (sched->curRSPTask != NULL && sched->curRSPTask->list.t.type == M_GFXTASK) { + if ((sched->curRSPTask != NULL) && (sched->curRSPTask->list.t.type == M_GFXTASK)) { if (!(HW_REG(SP_STATUS_REG, u32) & SP_STATUS_HALT)) { // GRAPH SP tries to stop osSyncPrintf("GRAPH SP止めようとします\n"); @@ -227,7 +227,8 @@ s32 Sched_TaskCheckFramebuffers(SchedContext* sched, OSScTask* task) { void* nextFB = osViGetNextFramebuffer(); void* curFB = osViGetCurrentFramebuffer(); - if (task == NULL || sched->pendingSwapBuf1 != NULL || (curFB == TASK_FRAMEBUFFER(task)->fb1 && curFB != nextFB)) { + if ((task == NULL) || (sched->pendingSwapBuf1 != NULL) || + ((curFB == TASK_FRAMEBUFFER(task)->fb1) && (curFB != nextFB))) { return 0; } return 1; @@ -241,7 +242,7 @@ s32 Sched_Schedule(SchedContext* sched, OSScTask** spTask, OSScTask** dpTask, s3 OSScTask* gfxTask = sched->gfxListHead; OSScTask* audioTask = sched->audioListHead; - if ((ret & OS_SC_SP) && sched->audioListHead != NULL) { + if ((ret & OS_SC_SP) && (sched->audioListHead != NULL)) { *spTask = audioTask; ret &= ~OS_SC_SP; sched->audioListHead = sched->audioListHead->next; @@ -249,7 +250,7 @@ s32 Sched_Schedule(SchedContext* sched, OSScTask** spTask, OSScTask** dpTask, s3 sched->audioListTail = NULL; } } else if (gfxTask != NULL) { - if (gfxTask->state & OS_SC_YIELDED || !(gfxTask->flags & OS_SC_NEEDS_RDP)) { + if ((gfxTask->state & OS_SC_YIELDED) || !(gfxTask->flags & OS_SC_NEEDS_RDP)) { if (ret & OS_SC_SP) { *spTask = gfxTask; ret &= ~OS_SC_SP; @@ -259,7 +260,7 @@ s32 Sched_Schedule(SchedContext* sched, OSScTask** spTask, OSScTask** dpTask, s3 } } } else if (ret == (OS_SC_SP | OS_SC_DP)) { - if (TASK_FRAMEBUFFER(gfxTask) == NULL || Sched_TaskCheckFramebuffers(sched, gfxTask)) { + if ((TASK_FRAMEBUFFER(gfxTask) == NULL) || Sched_TaskCheckFramebuffers(sched, gfxTask)) { *spTask = *dpTask = gfxTask; ret &= ~(OS_SC_SP | OS_SC_DP); sched->gfxListHead = sched->gfxListHead->next; @@ -275,7 +276,7 @@ s32 Sched_Schedule(SchedContext* sched, OSScTask** spTask, OSScTask** dpTask, s3 void Sched_TaskUpdateFramebuffer(SchedContext* sched, OSScTask* task) { sched->pendingSwapBuf1 = TASK_FRAMEBUFFER(task); - if (sched->curBuf != NULL && sched->curBuf->updateRate2 > 0) { + if ((sched->curBuf != NULL) && (sched->curBuf->updateRate2 > 0)) { return; } Sched_RetraceUpdateFramebuffer(sched, sched->pendingSwapBuf1); @@ -314,7 +315,7 @@ void Sched_RunTask(SchedContext* sched, OSScTask* spTask, OSScTask* dpTask) { return; } // Write back the data cache to ensure imminent SP DMA does not miss anything - if (spTask->list.t.type != M_AUDTASK && !(spTask->state & OS_SC_YIELDED)) { + if ((spTask->list.t.type != M_AUDTASK) && !(spTask->state & OS_SC_YIELDED)) { osWritebackDCacheAll(); } spTask->state &= ~(OS_SC_YIELD | OS_SC_YIELDED); @@ -327,9 +328,11 @@ void Sched_RunTask(SchedContext* sched, OSScTask* spTask, OSScTask* dpTask) { case M_AUDTASK: sRSPAudioStartTime = time; break; + case M_GFXTASK: sRSPGFXStartTime = time; break; + default: if (1) {} sRSPOtherStartTime = time; @@ -366,7 +369,7 @@ void Sched_HandleEntry(SchedContext* sched) { Sched_QueueTask(sched, msg); } // If there is an audio task pending and an RSP task is running, yield the current task. - if (sched->audioListHead != NULL && sched->curRSPTask != NULL) { + if ((sched->audioListHead != NULL) && (sched->curRSPTask != NULL)) { Sched_Yield(sched); return; } @@ -421,9 +424,11 @@ void Sched_HandleRSPDone(SchedContext* sched) { case M_AUDTASK: gRSPAudioTotalTime += time - sRSPAudioStartTime; break; + case M_GFXTASK: sRSPGFXTotalTime += time - sRSPGFXStartTime; break; + default: if (1) {} sRSPOtherTotalTime += time - sRSPOtherStartTime; @@ -555,15 +560,19 @@ void Sched_ThreadEntry(void* arg) { case RDP_AUDIO_CANCEL_MSG: Sched_HandleAudioCancel(sched); continue; + case RSP_GFX_CANCEL_MSG: Sched_HandleGfxCancel(sched); continue; + case ENTRY_MSG: Sched_HandleEntry(sched); continue; + case RSP_DONE_MSG: Sched_HandleRSPDone(sched); continue; + case RDP_DONE_MSG: Sched_HandleRDPDone(sched); continue; @@ -573,9 +582,11 @@ void Sched_ThreadEntry(void* arg) { case OS_SC_RETRACE_MSG: Sched_HandleRetrace(sched); continue; + case OS_SC_PRE_NMI_MSG: Sched_HandleReset(sched); continue; + case OS_SC_NMI_MSG: Sched_HandleStop(sched); continue; diff --git a/src/code/z_DLF.c b/src/code/z_DLF.c index 020edcf277..aa5c0325d1 100644 --- a/src/code/z_DLF.c +++ b/src/code/z_DLF.c @@ -46,7 +46,7 @@ void Overlay_FreeGameState(GameStateOverlay* overlayEntry) { s32 var_v0; if (overlayEntry->loadedRamAddr != NULL) { - var_v0 = overlayEntry->unk_28 != 0 ? -1 : 0; + var_v0 = (overlayEntry->unk_28 != 0) ? -1 : 0; if (var_v0 == 0) { overlayEntry->unk_14 = (uintptr_t)( (overlayEntry->unk_14 != NULL) diff --git a/src/code/z_actor.c b/src/code/z_actor.c index c7e2c4574d..82ff8ddd92 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -476,6 +476,7 @@ void Actor_DrawZTarget(TargetContext* targetCtx, PlayState* play) { Actor* actor = targetCtx->targetedActor; OPEN_DISPS(play->state.gfxCtx); + if (targetCtx->unk48 != 0) { TargetContextEntry* entry; s16 alpha = 255; @@ -598,10 +599,10 @@ void func_800B5814(TargetContext* targetCtx, Player* player, Actor* actor, GameS targetCtx->unk_94 = sp68; } - if (targetCtx->unk8C != 0) { + if (targetCtx->unk8C != NULL) { sp68 = targetCtx->unk8C; targetCtx->unk8C = NULL; - } else if (actor != 0) { + } else if (actor != NULL) { sp68 = actor; } @@ -640,7 +641,7 @@ void func_800B5814(TargetContext* targetCtx, Player* player, Actor* actor, GameS Target_SetColors(targetCtx, sp68, category, play); } - if (actor != NULL && targetCtx->unk4B == 0) { + if ((actor != NULL) && (targetCtx->unk4B == 0)) { Actor_GetProjectedPos(play, &actor->focus.pos, &projectedPos, &invW); if ((projectedPos.z <= 0.0f) || (fabsf(projectedPos.x * invW) >= 1.0f) || (fabsf(projectedPos.y * invW) >= 1.0f)) { @@ -2028,10 +2029,10 @@ s32 Actor_OfferGetItem(Actor* actor, PlayState* play, GetItemId getItemId, f32 x PLAYER_STATE1_80000 | PLAYER_STATE1_100000 | PLAYER_STATE1_200000)) && (Player_GetExplosiveHeld(player) <= PLAYER_EXPLOSIVE_NONE)) { if ((actor->xzDistToPlayer <= xzRange) && (fabsf(actor->playerHeightRel) <= fabsf(yRange))) { - if ((getItemId == GI_MASK_CIRCUS_LEADER || getItemId == GI_PENDANT_OF_MEMORIES || - getItemId == GI_DEED_LAND || - ((player->heldActor != NULL || actor == player->talkActor) && - (getItemId > GI_NONE && getItemId < GI_MAX))) || + if (((getItemId == GI_MASK_CIRCUS_LEADER) || (getItemId == GI_PENDANT_OF_MEMORIES) || + (getItemId == GI_DEED_LAND) || + (((player->heldActor != NULL) || (actor == player->talkActor)) && + ((getItemId > GI_NONE) && (getItemId < GI_MAX)))) || !(player->stateFlags1 & (PLAYER_STATE1_800 | PLAYER_STATE1_20000000))) { s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y; s32 absYawDiff = ABS_ALT(yawDiff); @@ -2386,12 +2387,12 @@ Actor* Actor_UpdateActor(UpdateActor_Params* params) { } else { if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) { Actor_Kill(actor); - } else if (((params->requiredActorFlag) && !(actor->flags & params->requiredActorFlag)) || - ((((!params->requiredActorFlag) != 0)) && + } else if ((params->requiredActorFlag && !(actor->flags & params->requiredActorFlag)) || + (((!params->requiredActorFlag) != 0) && (!(actor->flags & ACTOR_FLAG_100000) || ((actor->category == ACTORCAT_EXPLOSIVES) && (params->player->stateFlags1 & PLAYER_STATE1_200))) && - params->canFreezeCategory && (actor != params->talkActor) && - ((actor != params->player->heldActor)) && (actor->parent != ¶ms->player->actor))) { + params->canFreezeCategory && (actor != params->talkActor) && (actor != params->player->heldActor) && + (actor->parent != ¶ms->player->actor))) { CollisionCheck_ResetDamage(&actor->colChkInfo); } else { Math_Vec3f_Copy(&actor->prevPos, &actor->world.pos); @@ -3195,7 +3196,7 @@ Actor* Actor_SpawnAsChildAndCutscene(ActorContext* actorCtx, PlayState* play, s1 } overlayEntry = &gActorOverlayTable[index]; - if (overlayEntry->vramStart != 0) { + if (overlayEntry->vramStart != NULL) { overlayEntry->numLoaded++; } diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 7fac2a2b2f..bd23308c38 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -7790,7 +7790,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 forceChange) { break; case CAM_MODE_FOLLOWTARGET: - if (camera->target != NULL && camera->target->id != ACTOR_EN_BOOM) { + if ((camera->target != NULL) && (camera->target->id != ACTOR_EN_BOOM)) { sModeChangeFlags = CAM_CHANGE_MODE_FOLLOW_TARGET; } break; @@ -7807,6 +7807,9 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 forceChange) { case CAM_MODE_HANG: sModeChangeFlags = CAM_CHANGE_MODE_4; break; + + default: + break; } // Process Current Camera Mode diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 8bcd244bd4..b7f07d14d4 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -92,7 +92,8 @@ f32 CollisionCheck_ApplyBumperDefense(f32 damage, ColliderInfo* ac) { * factors such as the ac collider's defense. */ s32 CollisionCheck_GetToucherDamage(Collider* at, ColliderInfo* atInfo, Collider* ac, ColliderInfo* acInfo) { - if (at->actor != NULL && at->actor->id == ACTOR_EN_BOM && ac->actor != NULL && ac->actor->id == ACTOR_PLAYER) { + if ((at->actor != NULL) && (at->actor->id == ACTOR_EN_BOM) && (ac->actor != NULL) && + (ac->actor->id == ACTOR_PLAYER)) { return 8; } return atInfo->toucher.damage; @@ -1153,7 +1154,7 @@ s32 CollisionCheck_SetAT(PlayState* play, CollisionCheckContext* colCtxt, Collid } sATResetFuncs[collider->shape](play, collider); - if (collider->actor != NULL && collider->actor->update == NULL) { + if ((collider->actor != NULL) && (collider->actor->update == NULL)) { return -1; } if (colCtxt->colATCount >= ARRAY_COUNT(colCtxt->colAT)) { @@ -1179,7 +1180,7 @@ s32 CollisionCheck_SetAT_SAC(PlayState* play, CollisionCheckContext* colCtxt, Co } sATResetFuncs[collider->shape](play, collider); - if (collider->actor != NULL && collider->actor->update == NULL) { + if ((collider->actor != NULL) && (collider->actor->update == NULL)) { return -1; } if (colCtxt->sacFlags & SAC_ON) { @@ -1213,7 +1214,7 @@ s32 CollisionCheck_SetAC(PlayState* play, CollisionCheckContext* colCtxt, Collid } sACResetFuncs[collider->shape](play, collider); - if (collider->actor != NULL && collider->actor->update == NULL) { + if ((collider->actor != NULL) && (collider->actor->update == NULL)) { return -1; } if (colCtxt->colACCount >= ARRAY_COUNT(colCtxt->colAC)) { @@ -1239,7 +1240,7 @@ s32 CollisionCheck_SetAC_SAC(PlayState* play, CollisionCheckContext* colCtxt, Co } sACResetFuncs[collider->shape](play, collider); - if (collider->actor != NULL && collider->actor->update == NULL) { + if ((collider->actor != NULL) && (collider->actor->update == NULL)) { return -1; } if (colCtxt->sacFlags & SAC_ON) { @@ -1273,7 +1274,7 @@ s32 CollisionCheck_SetOC(PlayState* play, CollisionCheckContext* colCtxt, Collid } sOCResetFuncs[collider->shape](play, collider); - if (collider->actor != NULL && collider->actor->update == NULL) { + if ((collider->actor != NULL) && (collider->actor->update == NULL)) { return -1; } if (colCtxt->colOCCount >= ARRAY_COUNT(colCtxt->colOC)) { @@ -1299,7 +1300,7 @@ s32 CollisionCheck_SetOC_SAC(PlayState* play, CollisionCheckContext* colCtxt, Co } sOCResetFuncs[collider->shape](play, collider); - if (collider->actor != NULL && collider->actor->update == NULL) { + if ((collider->actor != NULL) && (collider->actor->update == NULL)) { return -1; } if (colCtxt->sacFlags & SAC_ON) { @@ -1523,7 +1524,7 @@ void CollisionCheck_RedBloodUnused(PlayState* play, Collider* collider, Vec3f* v void CollisionCheck_HitSolid(PlayState* play, ColliderInfo* info, Collider* collider, Vec3f* hitPos) { s32 flags = info->toucherFlags & TOUCH_SFX_NONE; - if (flags == TOUCH_SFX_NORMAL && collider->colType != COLTYPE_METAL) { + if ((flags == TOUCH_SFX_NORMAL) && (collider->colType != COLTYPE_METAL)) { EffectSsHitmark_SpawnFixedScale(play, 0, hitPos); if (collider->actor == NULL) { play_sound(NA_SE_IT_SHIELD_BOUND); @@ -1558,7 +1559,7 @@ void CollisionCheck_HitSolid(PlayState* play, ColliderInfo* info, Collider* coll * Plays a hit sound effect for AT colliders attached to Player based on the AC element's elemType. */ s32 CollisionCheck_SwordHitAudio(Collider* at, ColliderInfo* acInfo) { - if (at->actor != NULL && at->actor->category == ACTORCAT_PLAYER) { + if ((at->actor != NULL) && (at->actor->category == ACTORCAT_PLAYER)) { if (acInfo->elemType == ELEMTYPE_UNK0) { Audio_PlaySfxAtPos(&at->actor->projectedPos, NA_SE_IT_SWORD_STRIKE); } else if (acInfo->elemType == ELEMTYPE_UNK1) { @@ -1652,7 +1653,7 @@ s32 CollisionCheck_SetATvsAC(PlayState* play, Collider* at, ColliderInfo* atInfo return 0; } } - if ((ac->acFlags & AC_HARD) && at->actor != NULL && ac->actor != NULL) { + if ((ac->acFlags & AC_HARD) && (at->actor != NULL) && (ac->actor != NULL)) { CollisionCheck_SetBounce(at, ac); } if (!(acInfo->bumperFlags & BUMP_NO_AT_INFO)) { @@ -1683,8 +1684,8 @@ s32 CollisionCheck_SetATvsAC(PlayState* play, Collider* at, ColliderInfo* atInfo acInfo->bumper.hitPos.y = hitPos->y; acInfo->bumper.hitPos.z = hitPos->z; } - if (!(atInfo->toucherFlags & TOUCH_AT_HITMARK) && ac->colType != COLTYPE_METAL && ac->colType != COLTYPE_WOOD && - ac->colType != COLTYPE_HARD) { + if (!(atInfo->toucherFlags & TOUCH_AT_HITMARK) && (ac->colType != COLTYPE_METAL) && (ac->colType != COLTYPE_WOOD) && + (ac->colType != COLTYPE_HARD)) { acInfo->bumperFlags |= BUMP_DRAW_HITMARK; } else { CollisionCheck_HitEffects(play, at, atInfo, ac, acInfo, hitPos); @@ -1719,7 +1720,7 @@ void CollisionCheck_AC_JntSphVsJntSph(PlayState* play, CollisionCheckContext* co f32 overlapSize; f32 centerDist; - if (at->count > 0 && at->elements != NULL && ac->count > 0 && ac->elements != NULL) { + if ((at->count > 0) && (at->elements != NULL) && (ac->count > 0) && (ac->elements != NULL)) { for (atElem = at->elements; atElem < &at->elements[at->count]; atElem++) { if (CollisionCheck_SkipTouch(&atElem->info)) { continue; @@ -1773,7 +1774,7 @@ void CollisionCheck_AC_JntSphVsCyl(PlayState* play, CollisionCheckContext* colCt f32 overlapSize; f32 centerDist; - if (at->count > 0 && at->elements != NULL && ac->dim.radius > 0 && ac->dim.height > 0) { + if ((at->count > 0) && (at->elements != NULL) && (ac->dim.radius > 0) && (ac->dim.height > 0)) { if (CollisionCheck_SkipBump(&ac->info)) { return; } @@ -1822,7 +1823,7 @@ void CollisionCheck_AC_JntSphVsTris(PlayState* play, CollisionCheckContext* colC ColliderTrisElement* acElem; Vec3f hitPos; - if (at->count > 0 && at->elements != NULL && ac->count > 0 && ac->elements != NULL) { + if ((at->count > 0) && (at->elements != NULL) && (ac->count > 0) && (ac->elements != NULL)) { for (atElem = at->elements; atElem < &at->elements[at->count]; atElem++) { if (CollisionCheck_SkipTouch(&atElem->info)) { continue; @@ -1858,7 +1859,7 @@ void CollisionCheck_AC_JntSphVsQuad(PlayState* play, CollisionCheckContext* colC Vec3f hitPos; ColliderJntSphElement* sphElem; - if (at->count > 0 && at->elements != NULL) { + if ((at->count > 0) && (at->elements != NULL)) { if (CollisionCheck_SkipBump(&ac->info)) { return; } @@ -1898,7 +1899,7 @@ void CollisionCheck_AC_JntSphVsSphere(PlayState* play, CollisionCheckContext* co f32 overlapSize; f32 centerDist; - if (at->count > 0 && at->elements != NULL) { + if ((at->count > 0) && (at->elements != NULL)) { if (CollisionCheck_SkipBump(&ac->info)) { return; } @@ -1943,7 +1944,7 @@ void CollisionCheck_AC_CylVsJntSph(PlayState* play, CollisionCheckContext* colCt f32 centerDist; ColliderJntSphElement* sphElem; - if (ac->count > 0 && ac->elements != NULL && at->dim.radius > 0 && at->dim.height > 0) { + if ((ac->count > 0) && (ac->elements != NULL) && (at->dim.radius > 0) && (at->dim.height > 0)) { if (CollisionCheck_SkipTouch(&at->info)) { return; } @@ -1994,7 +1995,7 @@ void CollisionCheck_AC_CylVsCyl(PlayState* play, CollisionCheckContext* colCtxt, f32 overlapSize; f32 centerDist; - if (at->dim.radius > 0 && at->dim.height > 0 && ac->dim.radius > 0 && ac->dim.height > 0) { + if ((at->dim.radius > 0) && (at->dim.height > 0) && (ac->dim.radius > 0) && (ac->dim.height > 0)) { if (CollisionCheck_SkipBump(&ac->info)) { return; } @@ -2046,7 +2047,7 @@ void CollisionCheck_AC_CylVsTris(PlayState* play, CollisionCheckContext* colCtxt ColliderTrisElement* acElem; Vec3f hitPos; - if (at->dim.radius > 0 && at->dim.height > 0 && ac->count > 0 && ac->elements != NULL) { + if ((at->dim.radius > 0) && (at->dim.height > 0) && (ac->count > 0) && (ac->elements != NULL)) { if (CollisionCheck_SkipTouch(&at->info)) { return; } @@ -2079,7 +2080,7 @@ void CollisionCheck_AC_CylVsQuad(PlayState* play, CollisionCheckContext* colCtxt ColliderCylinder* at = (ColliderCylinder*)colAT; ColliderQuad* ac = (ColliderQuad*)colAC; - if (at->dim.height > 0 && at->dim.radius > 0) { + if ((at->dim.height > 0) && (at->dim.radius > 0)) { if (CollisionCheck_SkipTouch(&at->info)) { return; } @@ -2119,7 +2120,7 @@ void CollisionCheck_AC_CylVsSphere(PlayState* play, CollisionCheckContext* colCt f32 overlapSize; f32 centerDist; - if (at->dim.radius > 0 && at->dim.height > 0) { + if ((at->dim.radius > 0) && (at->dim.height > 0)) { if (CollisionCheck_SkipTouch(&at->info)) { return; } @@ -2166,7 +2167,7 @@ void CollisionCheck_AC_TrisVsJntSph(PlayState* play, CollisionCheckContext* colC ColliderTrisElement* atElem; Vec3f hitPos; - if (ac->count > 0 && ac->elements != NULL && at->count > 0 && at->elements != NULL) { + if ((ac->count > 0) && (ac->elements != NULL) && (at->count > 0) && (at->elements != NULL)) { for (acElem = ac->elements; acElem < &ac->elements[ac->count]; acElem++) { if (CollisionCheck_SkipBump(&acElem->info)) { continue; @@ -2204,7 +2205,7 @@ void CollisionCheck_AC_TrisVsCyl(PlayState* play, CollisionCheckContext* colCtxt ColliderCylinder* ac = (ColliderCylinder*)colAC; ColliderTrisElement* atElem; - if (ac->dim.radius > 0 && ac->dim.height > 0 && at->count > 0 && at->elements != NULL) { + if ((ac->dim.radius > 0) && (ac->dim.height > 0) && (at->count > 0) && (at->elements != NULL)) { if (CollisionCheck_SkipBump(&ac->info)) { return; } @@ -2238,7 +2239,7 @@ void CollisionCheck_AC_TrisVsTris(PlayState* play, CollisionCheckContext* colCtx ColliderTris* ac = (ColliderTris*)colAC; ColliderTrisElement* acElem; - if (ac->count > 0 && ac->elements != NULL && at->count > 0 && at->elements != NULL) { + if ((ac->count > 0) && (ac->elements != NULL) && (at->count > 0) && (at->elements != NULL)) { for (acElem = ac->elements; acElem < &ac->elements[ac->count]; acElem++) { if (CollisionCheck_SkipBump(&acElem->info)) { continue; @@ -2273,7 +2274,7 @@ void CollisionCheck_AC_TrisVsQuad(PlayState* play, CollisionCheckContext* colCtx ColliderQuad* ac = (ColliderQuad*)colAC; ColliderTrisElement* atElem; - if (at->count > 0 && at->elements != NULL) { + if ((at->count > 0) && (at->elements != NULL)) { if (CollisionCheck_SkipBump(&ac->info)) { return; } @@ -2312,7 +2313,7 @@ void CollisionCheck_AC_TrisVsSphere(PlayState* play, CollisionCheckContext* colC ColliderSphere* ac = (ColliderSphere*)colAC; Vec3f hitPos; - if (at->count > 0 && at->elements != NULL) { + if ((at->count > 0) && (at->elements != NULL)) { if (CollisionCheck_SkipBump(&ac->info)) { return; } @@ -2344,7 +2345,7 @@ void CollisionCheck_AC_QuadVsJntSph(PlayState* play, CollisionCheckContext* colC ColliderQuad* at = (ColliderQuad*)colAT; ColliderJntSph* ac = (ColliderJntSph*)colAC; - if (ac->count > 0 && ac->elements != NULL) { + if ((ac->count > 0) && (ac->elements != NULL)) { if (CollisionCheck_SkipTouch(&at->info)) { return; } @@ -2385,7 +2386,7 @@ void CollisionCheck_AC_QuadVsCyl(PlayState* play, CollisionCheckContext* colCtxt ColliderQuad* at = (ColliderQuad*)colAT; ColliderCylinder* ac = (ColliderCylinder*)colAC; - if (ac->dim.height > 0 && ac->dim.radius > 0) { + if ((ac->dim.height > 0) && (ac->dim.radius > 0)) { if (CollisionCheck_SkipBump(&ac->info)) { return; } @@ -2431,7 +2432,7 @@ void CollisionCheck_AC_QuadVsTris(PlayState* play, CollisionCheckContext* colCtx ColliderTris* ac = (ColliderTris*)colAC; ColliderTrisElement* acElem; - if (ac->count > 0 && ac->elements != NULL) { + if ((ac->count > 0) && (ac->elements != NULL)) { if (CollisionCheck_SkipTouch(&at->info)) { return; } @@ -2546,7 +2547,7 @@ void CollisionCheck_AC_SphereVsJntSph(PlayState* play, CollisionCheckContext* co f32 overlapSize; f32 centerDist; - if (ac->count > 0 && ac->elements != NULL) { + if ((ac->count > 0) && (ac->elements != NULL)) { if (CollisionCheck_SkipTouch(&at->info)) { return; } @@ -2739,7 +2740,7 @@ void CollisionCheck_SetJntSphHitFX(PlayState* play, CollisionCheckContext* colCt ColliderJntSphElement* element; for (element = jntSph->elements; element < &jntSph->elements[jntSph->count]; element++) { - if ((element->info.bumperFlags & BUMP_DRAW_HITMARK) && element->info.acHitInfo != NULL && + if ((element->info.bumperFlags & BUMP_DRAW_HITMARK) && (element->info.acHitInfo != NULL) && !(element->info.acHitInfo->toucherFlags & TOUCH_DREW_HITMARK)) { Vec3f hitPos; @@ -2758,7 +2759,7 @@ void CollisionCheck_SetJntSphHitFX(PlayState* play, CollisionCheckContext* colCt void CollisionCheck_SetCylHitFX(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider) { ColliderCylinder* cylinder = (ColliderCylinder*)collider; - if ((cylinder->info.bumperFlags & BUMP_DRAW_HITMARK) && cylinder->info.acHitInfo != NULL && + if ((cylinder->info.bumperFlags & BUMP_DRAW_HITMARK) && (cylinder->info.acHitInfo != NULL) && !(cylinder->info.acHitInfo->toucherFlags & TOUCH_DREW_HITMARK)) { Vec3f hitPos; @@ -2777,7 +2778,7 @@ void CollisionCheck_SetTrisHitFX(PlayState* play, CollisionCheckContext* colCtxt ColliderTrisElement* element; for (element = tris->elements; element < &tris->elements[tris->count]; element++) { - if ((element->info.bumperFlags & BUMP_DRAW_HITMARK) && element->info.acHitInfo != NULL && + if ((element->info.bumperFlags & BUMP_DRAW_HITMARK) && (element->info.acHitInfo != NULL) && !(element->info.acHitInfo->toucherFlags & TOUCH_DREW_HITMARK)) { Vec3f hitPos; @@ -2796,7 +2797,7 @@ void CollisionCheck_SetTrisHitFX(PlayState* play, CollisionCheckContext* colCtxt void CollisionCheck_SetQuadHitFX(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider) { ColliderQuad* quad = (ColliderQuad*)collider; - if ((quad->info.bumperFlags & BUMP_DRAW_HITMARK) && quad->info.acHitInfo != NULL && + if ((quad->info.bumperFlags & BUMP_DRAW_HITMARK) && (quad->info.acHitInfo != NULL) && !(quad->info.acHitInfo->toucherFlags & TOUCH_DREW_HITMARK)) { Vec3f hitPos; @@ -2812,7 +2813,7 @@ void CollisionCheck_SetQuadHitFX(PlayState* play, CollisionCheckContext* colCtxt void CollisionCheck_SetSphereHitFX(PlayState* play, CollisionCheckContext* colCtxt, Collider* collider) { ColliderSphere* sphere = (ColliderSphere*)collider; - if ((sphere->info.bumperFlags & BUMP_DRAW_HITMARK) && sphere->info.acHitInfo != NULL && + if ((sphere->info.bumperFlags & BUMP_DRAW_HITMARK) && (sphere->info.acHitInfo != NULL) && !(sphere->info.acHitInfo->toucherFlags & TOUCH_DREW_HITMARK)) { Vec3f hitPos; @@ -2837,8 +2838,8 @@ void CollisionCheck_SetHitEffects(PlayState* play, CollisionCheckContext* colCtx for (col = &colCtxt->colAC[0]; col < &colCtxt->colAC[colCtxt->colACCount]; col++) { Collider* colAC = *col; - if (colAC != NULL && (colAC->acFlags & AC_ON)) { - if (colAC->actor != NULL && colAC->actor->update == NULL) { + if ((colAC != NULL) && (colAC->acFlags & AC_ON)) { + if ((colAC->actor != NULL) && (colAC->actor->update == NULL)) { continue; } sColChkApplyFuncs[colAC->shape](play, colCtxt, colAC); @@ -2868,12 +2869,12 @@ void CollisionCheck_AC(PlayState* play, CollisionCheckContext* colCtxt, Collider for (col = &colCtxt->colAC[0]; col < &colCtxt->colAC[colCtxt->colACCount]; col++) { Collider* colAC = *col; - if (colAC != NULL && (colAC->acFlags & AC_ON)) { - if (colAC->actor != NULL && colAC->actor->update == NULL) { + if ((colAC != NULL) && (colAC->acFlags & AC_ON)) { + if ((colAC->actor != NULL) && (colAC->actor->update == NULL)) { continue; } - if ((colAC->acFlags & colAT->atFlags & AC_TYPE_ALL) && colAT != colAC) { - if (!(colAT->atFlags & AT_SELF) && colAT->actor != NULL && colAC->actor == colAT->actor) { + if ((colAC->acFlags & colAT->atFlags & AC_TYPE_ALL) && (colAT != colAC)) { + if (!(colAT->atFlags & AT_SELF) && (colAT->actor != NULL) && (colAC->actor == colAT->actor)) { continue; } sACVsFuncs[colAT->shape][colAC->shape](play, colCtxt, colAT, colAC); @@ -2891,15 +2892,15 @@ void CollisionCheck_AC(PlayState* play, CollisionCheckContext* colCtxt, Collider void CollisionCheck_AT(PlayState* play, CollisionCheckContext* colCtxt) { Collider** col; - if (colCtxt->colATCount == 0 || colCtxt->colACCount == 0) { + if ((colCtxt->colATCount == 0) || (colCtxt->colACCount == 0)) { return; } for (col = &colCtxt->colAT[0]; col < &colCtxt->colAT[colCtxt->colATCount]; col++) { Collider* colAC = *col; - if (colAC != NULL && (colAC->atFlags & AT_ON)) { - if (colAC->actor != NULL && colAC->actor->update == NULL) { + if ((colAC != NULL) && (colAC->atFlags & AT_ON)) { + if ((colAC->actor != NULL) && (colAC->actor->update == NULL)) { continue; } CollisionCheck_AC(play, colCtxt, colAC); @@ -2958,7 +2959,8 @@ void CollisionCheck_SetOCvsOC(PlayState* play, Collider* left, ColliderInfo* lef right->ocFlags2 |= OC2_HIT_PLAYER; } - if (leftActor == NULL || rightActor == NULL || (left->ocFlags1 & OC1_NO_PUSH) || (right->ocFlags1 & OC1_NO_PUSH)) { + if ((leftActor == NULL) || (rightActor == NULL) || (left->ocFlags1 & OC1_NO_PUSH) || + (right->ocFlags1 & OC1_NO_PUSH)) { return; } @@ -3032,7 +3034,7 @@ void CollisionCheck_OC_JntSphVsJntSph(PlayState* play, CollisionCheckContext* co ColliderJntSphElement* rightElem; f32 overlap; - if (left->count > 0 && left->elements != NULL && right->count > 0 && right->elements != NULL && + if ((left->count > 0) && (left->elements != NULL) && (right->count > 0) && (right->elements != NULL) && (left->base.ocFlags1 & OCELEM_ON) && (right->base.ocFlags1 & OCELEM_ON)) { for (leftElem = left->elements; leftElem < &left->elements[left->count]; leftElem++) { @@ -3067,7 +3069,7 @@ void CollisionCheck_OC_JntSphVsCyl(PlayState* play, CollisionCheckContext* colCt ColliderJntSphElement* leftElem; f32 overlap; - if (left->count > 0 && left->elements != NULL && (left->base.ocFlags1 & OCELEM_ON) && + if ((left->count > 0) && (left->elements != NULL) && (left->base.ocFlags1 & OCELEM_ON) && (right->base.ocFlags1 & OCELEM_ON) && (right->info.ocElemFlags & OCELEM_ON)) { for (leftElem = left->elements; leftElem < &left->elements[left->count]; leftElem++) { @@ -3096,7 +3098,7 @@ void CollisionCheck_OC_JntSphVsSphere(PlayState* play, CollisionCheckContext* co ColliderJntSphElement* leftElem; f32 overlap; - if (left->count > 0 && left->elements != NULL && (left->base.ocFlags1 & OCELEM_ON) && + if ((left->count > 0) && (left->elements != NULL) && (left->base.ocFlags1 & OCELEM_ON) && (right->base.ocFlags1 & OCELEM_ON) && (right->info.ocElemFlags & OCELEM_ON)) { for (leftElem = left->elements; leftElem < &left->elements[left->count]; leftElem++) { @@ -3252,11 +3254,11 @@ void CollisionCheck_OC(PlayState* play, CollisionCheckContext* colCtxt) { ColChkVsFunc vsFunc; for (left = colCtxt->colOC; left < colCtxt->colOC + colCtxt->colOCCount; left++) { - if (*left == NULL || CollisionCheck_SkipOC(*left)) { + if ((*left == NULL) || CollisionCheck_SkipOC(*left)) { continue; } for (right = left + 1; right < colCtxt->colOC + colCtxt->colOCCount; right++) { - if (*right == NULL || CollisionCheck_SkipOC(*right) || CollisionCheck_Incompatible(*left, *right)) { + if ((*right == NULL) || CollisionCheck_SkipOC(*right) || CollisionCheck_Incompatible(*left, *right)) { continue; } vsFunc = sOCVsFuncs[(*left)->shape][(*right)->shape]; @@ -3353,7 +3355,7 @@ void CollisionCheck_ApplyDamage(PlayState* play, CollisionCheckContext* colCtxt, at = info->acHit; atInfo = info->acHitInfo; - if (at != NULL && atInfo != NULL && collider != NULL && info != NULL) { + if ((at != NULL) && (atInfo != NULL) && (collider != NULL) && (info != NULL)) { damage = CollisionCheck_GetDamageAndEffectOnBumper(at, atInfo, collider, info, &effect); if (CollisionCheck_GetToucherDamage(at, atInfo, collider, info) != 0) { @@ -3373,7 +3375,7 @@ void CollisionCheck_ApplyDamage(PlayState* play, CollisionCheckContext* colCtxt, collider->actor->colChkInfo.damageEffect = effect; } if (!(collider->acFlags & AC_HARD) || - ((collider->acFlags & AC_HARD) && atInfo->toucher.dmgFlags == 0x20000000)) { + ((collider->acFlags & AC_HARD) && (atInfo->toucher.dmgFlags == 0x20000000))) { if (collider->actor->colChkInfo.damage < finalDamage) { collider->actor->colChkInfo.damage = finalDamage; } @@ -3388,7 +3390,7 @@ void CollisionCheck_ApplyDamageJntSph(PlayState* play, CollisionCheckContext* co ColliderJntSph* jntSph = (ColliderJntSph*)collider; s32 i; - if (jntSph->count > 0 && jntSph->elements != NULL) { + if ((jntSph->count > 0) && (jntSph->elements != NULL)) { for (i = 0; i < jntSph->count; i++) { CollisionCheck_ApplyDamage(play, colCtxt, &jntSph->base, &jntSph->elements[i].info); } @@ -3965,7 +3967,7 @@ s32 CollisionCheck_CylSideVsLineSeg(f32 radius, f32 height, f32 offset, Vec3f* a if (SQ(actorDotItemXZ) < (4.0f * SQXZ(itemStep) * radSqDiff)) { return 0; } - if (SQ(actorDotItemXZ) - (4.0f * SQXZ(itemStep) * radSqDiff) > zero) { + if ((SQ(actorDotItemXZ) - (4.0f * SQXZ(itemStep) * radSqDiff)) > zero) { intersect1 = intersect2 = 1; } else { intersect1 = 1; @@ -4005,12 +4007,12 @@ s32 CollisionCheck_CylSideVsLineSeg(f32 radius, f32 height, f32 offset, Vec3f* a } if (intersect2 == 0) { - if (frac1 < 0.0f || 1.0f < frac1) { + if ((frac1 < 0.0f) || (1.0f < frac1)) { return 0; } } else { - test1 = (frac1 < 0.0f || 1.0f < frac1); - test2 = (frac2 < 0.0f || 1.0f < frac2); + test1 = (frac1 < 0.0f) || (1.0f < frac1); + test2 = (frac2 < 0.0f) || (1.0f < frac2); if (test1 && test2) { return 0; @@ -4024,14 +4026,14 @@ s32 CollisionCheck_CylSideVsLineSeg(f32 radius, f32 height, f32 offset, Vec3f* a } if ((intersect1 != 0) && - ((frac1 * itemStep.y + actorToItem.y < 0.0f) || (height < frac1 * itemStep.y + actorToItem.y))) { + (((frac1 * itemStep.y + actorToItem.y) < 0.0f) || (height < (frac1 * itemStep.y + actorToItem.y)))) { intersect1 = 0; } if ((intersect2 != 0) && - ((frac2 * itemStep.y + actorToItem.y < 0.0f) || (height < frac2 * itemStep.y + actorToItem.y))) { + (((frac2 * itemStep.y + actorToItem.y) < 0.0f) || (height < (frac2 * itemStep.y + actorToItem.y)))) { intersect2 = 0; } - if (intersect1 == 0 && intersect2 == 0) { + if ((intersect1 == 0) && (intersect2 == 0)) { return 0; } else if ((intersect1 != 0) && (intersect2 != 0)) { out1->x = frac1 * itemStep.x + actorToItem.x + actorPos->x; diff --git a/src/code/z_fireobj.c b/src/code/z_fireobj.c index 5e93e11872..5565bc8767 100644 --- a/src/code/z_fireobj.c +++ b/src/code/z_fireobj.c @@ -142,6 +142,7 @@ void FireObj_Draw(PlayState* play, FireObj* fire) { Vec3s vec; OPEN_DISPS(play->state.gfxCtx); + Gfx_SetupDL25_Xlu(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (fire->timer * -20) % 512U, 32, 128)); diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index c6c1501bae..c9bea16694 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -16,14 +16,14 @@ s16 sBeatingHeartsDDEnv[3]; s16 sHeartsDDPrim[2][3]; s16 sHeartsDDEnv[2][3]; -TexturePtr HeartTextures[] = { +TexturePtr sHeartTextures[] = { gHeartFullTex, gHeartQuarterTex, gHeartQuarterTex, gHeartQuarterTex, gHeartQuarterTex, gHeartQuarterTex, gHeartHalfTex, gHeartHalfTex, gHeartHalfTex, gHeartHalfTex, gHeartHalfTex, gHeartThreeQuarterTex, gHeartThreeQuarterTex, gHeartThreeQuarterTex, gHeartThreeQuarterTex, gHeartThreeQuarterTex, }; -TexturePtr HeartDDTextures[] = { +TexturePtr sHeartDDTextures[] = { gDefenseHeartFullTex, gDefenseHeartQuarterTex, gDefenseHeartQuarterTex, gDefenseHeartQuarterTex, gDefenseHeartQuarterTex, gDefenseHeartQuarterTex, gDefenseHeartHalfTex, gDefenseHeartHalfTex, gDefenseHeartHalfTex, @@ -283,7 +283,7 @@ void LifeMeter_Draw(PlayState* play) { if (i < fullHeartCount) { heartTex = gHeartFullTex; } else if (i == fullHeartCount) { - heartTex = HeartTextures[fractionHeartCount]; + heartTex = sHeartTextures[fractionHeartCount]; } else { heartTex = gHeartEmptyTex; } @@ -323,7 +323,7 @@ void LifeMeter_Draw(PlayState* play) { if (i < fullHeartCount) { heartTex = gDefenseHeartFullTex; } else if (i == fullHeartCount) { - heartTex = HeartDDTextures[fractionHeartCount]; + heartTex = sHeartDDTextures[fractionHeartCount]; } else { heartTex = gDefenseHeartEmptyTex; } diff --git a/src/code/z_lights.c b/src/code/z_lights.c index 534ec6dfcb..e82c3a9b29 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -190,12 +190,12 @@ void Lights_BindDirectional(Lights* lights, LightParams* params, void* unused) { * available in the Lights group. This is at most 7 slots for a new group, but could be less. */ void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* refPos, PlayState* play) { - static LightsPosBindFunc posBindFuncs[] = { + static LightsPosBindFunc sPosBindFuncs[] = { Lights_BindPoint, (LightsPosBindFunc)Lights_BindDirectional, Lights_BindPoint, }; - static LightsBindFunc dirBindFuncs[] = { + static LightsBindFunc sDirBindFuncs[] = { Lights_BindPointWithReference, (LightsBindFunc)Lights_BindDirectional, Lights_BindPointWithReference, @@ -204,12 +204,12 @@ void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* refPos, PlayStat if (listHead != NULL) { if ((refPos == NULL) && (lights->enablePosLights == 1)) { do { - posBindFuncs[listHead->info->type](lights, &listHead->info->params, play); + sPosBindFuncs[listHead->info->type](lights, &listHead->info->params, play); listHead = listHead->next; } while (listHead != NULL); } else { do { - dirBindFuncs[listHead->info->type](lights, &listHead->info->params, refPos); + sDirBindFuncs[listHead->info->type](lights, &listHead->info->params, refPos); listHead = listHead->next; } while (listHead != NULL); } @@ -338,7 +338,7 @@ Lights* Lights_NewAndDraw(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8 lights->l.a.l.col[0] = lights->l.a.l.colc[0] = ambientR; lights->l.a.l.col[1] = lights->l.a.l.colc[1] = ambientG; lights->l.a.l.col[2] = lights->l.a.l.colc[2] = ambientB; - lights->enablePosLights = 0; + lights->enablePosLights = false; lights->numLights = numLights; for (i = 0; i < numLights; i++) { @@ -363,7 +363,7 @@ Lights* Lights_New(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8 ambient lights->l.a.l.col[0] = lights->l.a.l.colc[0] = ambientR; lights->l.a.l.col[1] = lights->l.a.l.colc[1] = ambientG; lights->l.a.l.col[2] = lights->l.a.l.colc[2] = ambientB; - lights->enablePosLights = 0; + lights->enablePosLights = false; lights->numLights = 0; return lights; diff --git a/src/code/z_play.c b/src/code/z_play.c index dd06a461e2..dade44cf6f 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1508,7 +1508,7 @@ void Play_Main(GameState* thisx) { } s32 Play_InCsMode(PlayState* this) { - return (this->csCtx.state != 0) || Player_InCsMode(this); + return (this->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(this); } f32 Play_GetFloorSurfaceImpl(PlayState* this, MtxF* mtx, CollisionPoly** poly, s32* bgId, Vec3f* pos) { diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index f7ccd52308..44b1fd9863 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -257,7 +257,7 @@ void func_80122C20(PlayState* play, struct_80122D44_arg1* arg1) { for (i = 0; i < ARRAY_COUNT(arg1->unk_04); i++, temp_v1++) { // Can't be `temp_v1->alpha != 0` if (temp_v1->alpha) { - phi_a1 = temp_v1->unk_00 == 3 ? (255 / 3) : (255 / 5); + phi_a1 = (temp_v1->unk_00 == 3) ? (255 / 3) : (255 / 5); if (phi_a1 >= temp_v1->alpha) { temp_v1->alpha = 0; } else { @@ -369,13 +369,13 @@ void func_80122F28(Player* player) { s32 func_80122F9C(PlayState* play) { Player* player = GET_PLAYER(play); - return (player->stateFlags2 & PLAYER_STATE2_80000) && player->unk_AE7 == 2; + return (player->stateFlags2 & PLAYER_STATE2_80000) && (player->unk_AE7 == 2); } s32 func_80122FCC(PlayState* play) { Player* player = GET_PLAYER(play); - return (player->stateFlags2 & PLAYER_STATE2_80000) && (player->unk_AE7 == 1 || player->unk_AE7 == 3); + return (player->stateFlags2 & PLAYER_STATE2_80000) && ((player->unk_AE7 == 1) || (player->unk_AE7 == 3)); } void func_8012300C(PlayState* play, s32 arg1) { @@ -1363,12 +1363,12 @@ s32 func_80123F2C(PlayState* play, s32 ammo) { } s32 Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 yRange) { - Player* this = GET_PLAYER(play); + Player* player = GET_PLAYER(play); Vec3f diff; s32 pad; - if ((this->heldItemAction == PLAYER_IA_STICK) && (this->unk_B28 != 0)) { - Math_Vec3f_Diff(&this->meleeWeaponInfo[0].tip, pos, &diff); + if ((player->heldItemAction == PLAYER_IA_STICK) && (player->unk_B28 != 0)) { + Math_Vec3f_Diff(&player->meleeWeaponInfo[0].tip, pos, &diff); return (SQXZ(diff) <= SQ(xzRange)) && (0.0f <= diff.y) && (diff.y <= yRange); } diff --git a/src/code/z_room.c b/src/code/z_room.c index 89cf47935a..9bc6e12ee2 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -99,7 +99,7 @@ void Room_DrawCullable(PlayState* play, Room* room, u32 flags) { gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_MODELVIEW | G_MTX_LOAD); } - if ((room->enablePosLights != 0) || (MREG(93) != 0)) { + if (room->enablePosLights || (MREG(93) != 0)) { gSPSetGeometryMode(POLY_OPA_DISP++, G_LIGHTING_POSITIONAL); gSPSetGeometryMode(POLY_XLU_DISP++, G_LIGHTING_POSITIONAL); } diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c index 09897fbb93..05a3c331ea 100644 --- a/src/code/z_sub_s.c +++ b/src/code/z_sub_s.c @@ -128,7 +128,7 @@ Gfx* SubS_DrawTransformFlex(PlayState* play, void** skeleton, Vec3s* jointTable, newDlist = rootLimb->dList; limbDList = rootLimb->dList; - if (overrideLimbDraw == NULL || !overrideLimbDraw(play, 1, &newDlist, &pos, &rot, actor, &gfx)) { + if ((overrideLimbDraw == NULL) || !overrideLimbDraw(play, 1, &newDlist, &pos, &rot, actor, &gfx)) { Matrix_TranslateRotateZYX(&pos, &rot); Matrix_Push(); @@ -1179,7 +1179,7 @@ Actor* SubS_FindActor(PlayState* play, Actor* actorListStart, u8 actorCategory, actor = play->actorCtx.actorLists[actorCategory].first; } - while (actor != NULL && actorId != actor->id) { + while ((actor != NULL) && (actorId != actor->id)) { actor = actor->next; } @@ -1503,10 +1503,10 @@ Actor* SubS_FindActorCustom(PlayState* play, Actor* actor, Actor* actorListStart actorIter = play->actorCtx.actorLists[actorCategory].first; } - while (actorIter != NULL && - (actorId != actorIter->id || - (actorId == actorIter->id && - (verifyActor == NULL || (verifyActor != NULL && !verifyActor(play, actor, actorIter, verifyData)))))) { + while ((actorIter != NULL) && + ((actorId != actorIter->id) || + ((actorId == actorIter->id) && + ((verifyActor == NULL) || ((verifyActor != NULL) && !verifyActor(play, actor, actorIter, verifyData)))))) { actorIter = actorIter->next; } diff --git a/src/libultra/io/pfsfilestate.c b/src/libultra/io/pfsfilestate.c index a555199fcc..f06c8d9373 100644 --- a/src/libultra/io/pfsfilestate.c +++ b/src/libultra/io/pfsfilestate.c @@ -34,7 +34,7 @@ s32 osPfsFileState(OSPfs* pfs, s32 fileNo, OSPfsState* state) { return ret; } - if (dir.company_code == 0 || dir.game_code == 0) { + if ((dir.company_code == 0) || (dir.game_code == 0)) { return PFS_ERR_INVALID; } diff --git a/src/libultra/os/seteventmesg.c b/src/libultra/os/seteventmesg.c index 8be2ff9e2b..26e837fcf3 100644 --- a/src/libultra/os/seteventmesg.c +++ b/src/libultra/os/seteventmesg.c @@ -16,7 +16,7 @@ void osSetEventMesg(OSEvent e, OSMesgQueue* mq, OSMesg m) { es->message = m; if (e == 14) { - if (__osShutdown != 0 && D_80097F10 == 0) { + if ((__osShutdown != 0) && (D_80097F10 == 0)) { osSendMesg(mq, m, OS_MESG_NOBLOCK); } D_80097F10 = 1; diff --git a/src/libultra/rmon/xldtob.c b/src/libultra/rmon/xldtob.c index e943e51e23..66c058396e 100644 --- a/src/libultra/rmon/xldtob.c +++ b/src/libultra/rmon/xldtob.c @@ -61,7 +61,7 @@ void _Ldtob(_Pft* args, u8 type) { if (args->prec < 0) { args->prec = 6; - } else if (args->prec == 0 && (type == 'g' || type == 'G')) { + } else if ((args->prec == 0) && ((type == 'g') || (type == 'G'))) { args->prec = 1; } err = _Ldunscale(&exp, (_Pft*)args); @@ -101,7 +101,7 @@ void _Ldtob(_Pft* args, u8 type) { gen = 0x13; } *ptr++ = '0'; - while (gen > 0 && 0 < val) { + while ((gen > 0) && (0 < val)) { lo = val; if ((gen -= 8) > 0) { val = (val - lo) * 1.0e8; @@ -124,12 +124,12 @@ void _Ldtob(_Pft* args, u8 type) { --gen, --exp; } - nsig = ((type == 'f') ? exp + 1 : ((type == 'e' || type == 'E') ? 1 : 0)) + args->prec; + nsig = ((type == 'f') ? exp + 1 : (((type == 'e') || (type == 'E')) ? 1 : 0)) + args->prec; if (gen < nsig) { nsig = gen; } if (nsig > 0) { - if (nsig < gen && ptr[nsig] > '4') { + if ((nsig < gen) && (ptr[nsig] > '4')) { drop = '9'; } else { drop = '0'; @@ -178,7 +178,7 @@ void _Genld(_Pft* px, u8 code, u8* p, s16 nsig, s16 xexp) { p = (u8*)"0"; } - if (code == 'f' || ((code == 'g' || code == 'G') && (-4 <= xexp) && (xexp < px->prec))) { /* 'f' format */ + if ((code == 'f') || (((code == 'g') || (code == 'G')) && (-4 <= xexp) && (xexp < px->prec))) { /* 'f' format */ ++xexp; /* change to leading digit count */ if (code != 'f') { /* fixup for 'g' */ if (!(px->flags & FLAGS_HASH) && nsig < px->prec) { @@ -225,8 +225,8 @@ void _Genld(_Pft* px, u8 code, u8* p, s16 nsig, s16 xexp) { px->n1 += nsig; px->nz1 = px->prec - nsig; } - } else { /* 'e' format */ - if (code == 'g' || code == 'G') { /* fixup for 'g' */ + } else { /* 'e' format */ + if ((code == 'g') || (code == 'G')) { /* fixup for 'g' */ if (nsig < px->prec) { px->prec = nsig; } diff --git a/src/libultra/rmon/xlitob.c b/src/libultra/rmon/xlitob.c index f200e01a43..6c53ee0942 100644 --- a/src/libultra/rmon/xlitob.c +++ b/src/libultra/rmon/xlitob.c @@ -27,13 +27,13 @@ void _Litob(_Pft* args, u8 type) { num = -num; } - if (num != 0 || args->prec != 0) { + if ((num != 0) || (args->prec != 0)) { buff[--idx] = numMap[num % base]; } args->v.ll = num / base; - while (args->v.ll > 0 && idx > 0) { + while ((args->v.ll > 0) && (idx > 0)) { quotrem = lldiv(args->v.ll, base); args->v.ll = quotrem.quot; buff[--idx] = numMap[quotrem.rem]; @@ -47,7 +47,7 @@ void _Litob(_Pft* args, u8 type) { args->nz0 = args->prec - args->n1; } - if (args->prec < 0 && (args->flags & (FLAGS_ZERO | FLAGS_MINUS)) == FLAGS_ZERO) { + if ((args->prec < 0) && (args->flags & (FLAGS_ZERO | FLAGS_MINUS)) == FLAGS_ZERO) { idx = args->width - args->n0 - args->nz0 - args->n1; if (idx > 0) { args->nz0 += idx; diff --git a/src/libultra/rmon/xprintf.c b/src/libultra/rmon/xprintf.c index 813520f01e..6caac436f0 100644 --- a/src/libultra/rmon/xprintf.c +++ b/src/libultra/rmon/xprintf.c @@ -42,7 +42,7 @@ int _Printf(PrintCallback pfn, void* arg, const char* fmt, va_list ap) { unsigned char ac[0x20]; s = fmt; - while ((c = *s) != 0 && c != '%') { + while (((c = *s) != 0) && (c != '%')) { s++; } _PROUT((char*)fmt, s - fmt); diff --git a/src/libultra/voice/voicegetstatus.c b/src/libultra/voice/voicegetstatus.c index a3608277fe..3840ec62b9 100644 --- a/src/libultra/voice/voicegetstatus.c +++ b/src/libultra/voice/voicegetstatus.c @@ -37,7 +37,7 @@ s32 __osVoiceGetStatus(OSMesgQueue* mq, s32 port, u8* status) { *status = header.status; if (ret == 0) { - if (header.typeh == 0 && header.typel == 1) { + if ((header.typeh == 0) && (header.typel == 1)) { if (header.status & 4) { ret = CONT_ERR_CONTRFAIL; } diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index e06d513132..c7bff97f26 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -129,7 +129,7 @@ void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) { void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((this->actor.parent == NULL) || (!Player_IsHoldingHookshot(player))) { + if ((this->actor.parent == NULL) || !Player_IsHoldingHookshot(player)) { ArmsHook_DetachHookFromActor(this); Actor_Kill(&this->actor); return; @@ -138,7 +138,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { func_800B8F98(&player->actor, NA_SE_IT_HOOKSHOT_CHAIN - SFX_FLAG); ArmsHook_CheckForCancel(this); - if (this->timer != 0 && (this->collider.base.atFlags & AT_HIT) && + if ((this->timer != 0) && (this->collider.base.atFlags & AT_HIT) && (this->collider.info.atHitInfo->elemType != ELEMTYPE_UNK4)) { Actor* touchedActor = this->collider.base.at; @@ -191,12 +191,10 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { } else { if (this->actor.child != NULL) { velocity = 30.0f; + } else if (grabbed != NULL) { + velocity = 50.0f; } else { - if (grabbed != NULL) { - velocity = 50.0f; - } else { - velocity = 200.0f; - } + velocity = 200.0f; } phi_f16 = bodyDistDiff - velocity; if (bodyDistDiff <= velocity) { @@ -245,7 +243,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { sp60.z = this->unk1EC.z - (this->unk1E0.z - this->unk1EC.z); if (BgCheck_EntityLineTest1(&play->colCtx, &sp60, &this->unk1E0, &posResult, &poly, true, true, true, true, &bgId) && - (func_800B90AC(play, &this->actor, poly, bgId, &posResult) == 0 || + (!func_800B90AC(play, &this->actor, poly, bgId, &posResult) || BgCheck_ProjectileLineTest(&play->colCtx, &sp60, &this->unk1E0, &posResult, &poly, true, true, true, true, &bgId))) { f32 nx = COLPOLY_GET_NORMAL(poly->normal.x); diff --git a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c index 7af684201b..efa7f04c47 100644 --- a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c +++ b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c @@ -249,6 +249,7 @@ void ArrowFire_Draw(Actor* thisx, PlayState* play) { Actor* transform = (arrow->unk_261 & 2) ? &this->actor : &arrow->actor; OPEN_DISPS(play->state.gfxCtx); + Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW); Matrix_RotateYS(transform->shape.rot.y, MTXMODE_APPLY); Matrix_RotateXS(transform->shape.rot.x, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c b/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c index 18e2eb5d0e..0391925aef 100644 --- a/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c @@ -202,24 +202,28 @@ void BgAstrBombwall_Draw(Actor* thixs, PlayState* play) { Gfx* opa; OPEN_DISPS(play->state.gfxCtx); + opa = POLY_OPA_DISP; gSPDisplayList(&opa[0], gSetupDLs[SETUPDL_25]); gSPMatrix(&opa[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSetGeometryMode(&opa[2], G_LIGHTING_POSITIONAL); gSPDisplayList(&opa[3], object_astr_obj_DL_002380); POLY_OPA_DISP = &opa[4]; + CLOSE_DISPS(play->state.gfxCtx); } { Gfx* xlu; OPEN_DISPS(play->state.gfxCtx); + xlu = POLY_XLU_DISP; gSPDisplayList(&xlu[0], gSetupDLs[SETUPDL_25]); gSPMatrix(&xlu[1], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSetGeometryMode(&xlu[2], G_LIGHTING_POSITIONAL); gSPDisplayList(&xlu[3], object_astr_obj_DL_0022E0); POLY_XLU_DISP = &xlu[4]; + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c b/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c index 22998a34eb..d8c39a098c 100644 --- a/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c +++ b/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c @@ -191,11 +191,13 @@ void BgCtowerGear_Draw(Actor* thisx, PlayState* play) { void BgCtowerGear_DrawOrgan(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); + Gfx_SetupDL25_Opa(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gClockTowerOrganDL); Gfx_SetupDL25_Xlu(play->state.gfxCtx); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gClockTowerOrganPipesDL); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c b/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c index 67703f0cd8..be3c9cb478 100644 --- a/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c +++ b/src/overlays/actors/ovl_Bg_F40_Switch/z_bg_f40_switch.c @@ -53,21 +53,20 @@ void BgF40Switch_CheckAll(BgF40Switch* this, PlayState* play) { u32 inCsMode = Player_InCsMode(play); for (actor = play->actorCtx.actorLists[ACTORCAT_SWITCH].first; actor != NULL; actor = actor->next) { - if (actor->id == ACTOR_BG_F40_SWITCH && actor->room == this->dyna.actor.room && actor->update != NULL) { + if ((actor->id == ACTOR_BG_F40_SWITCH) && (actor->room == this->dyna.actor.room) && + (actor->update != NULL)) { actorAsSwitch = (BgF40Switch*)actor; actorAsSwitch->wasPressed = actorAsSwitch->isPressed; isPressed = DynaPolyActor_IsSwitchPressed(&actorAsSwitch->dyna); - if (actorAsSwitch->isPressed && actorAsSwitch->actionFunc == BgF40Switch_IdlePressed) { + if (actorAsSwitch->isPressed && (actorAsSwitch->actionFunc == BgF40Switch_IdlePressed)) { // Switch is fully pressed - if there's nothing keeping it pressed, wait a short time before // reverting to unpressed state. if (isPressed || inCsMode) { actorAsSwitch->switchReleaseDelay = 6; + } else if (actorAsSwitch->switchReleaseDelay > 0) { + actorAsSwitch->switchReleaseDelay--; } else { - if (actorAsSwitch->switchReleaseDelay > 0) { - actorAsSwitch->switchReleaseDelay--; - } else { - actorAsSwitch->isPressed = isPressed; - } + actorAsSwitch->isPressed = isPressed; } } else { // No delay when pressing switch, or releasing from a not-fully-pressed state. @@ -75,9 +74,9 @@ void BgF40Switch_CheckAll(BgF40Switch* this, PlayState* play) { } if (actorAsSwitch->isPressed) { switchFlag = BGF40SWITCH_GET_SWITCHFLAG(&actorAsSwitch->dyna.actor); - if (switchFlag >= 0 && switchFlag < 0x80) { + if ((switchFlag >= 0) && (switchFlag < 0x80)) { pressedSwitchFlags[(switchFlag & ~0x1F) >> 5] |= 1 << (switchFlag & 0x1F); - if (!actorAsSwitch->wasPressed && actorAsSwitch->actionFunc == BgF40Switch_IdleUnpressed && + if (!actorAsSwitch->wasPressed && (actorAsSwitch->actionFunc == BgF40Switch_IdleUnpressed) && !Flags_GetSwitch(play, switchFlag)) { actorAsSwitch->isInitiator = true; } @@ -86,9 +85,10 @@ void BgF40Switch_CheckAll(BgF40Switch* this, PlayState* play) { } } for (actor = play->actorCtx.actorLists[ACTORCAT_SWITCH].first; actor != NULL; actor = actor->next) { - if (actor->id == ACTOR_BG_F40_SWITCH && actor->room == this->dyna.actor.room && actor->update != 0) { + if ((actor->id == ACTOR_BG_F40_SWITCH) && (actor->room == this->dyna.actor.room) && + (actor->update != NULL)) { switchFlag = BGF40SWITCH_GET_SWITCHFLAG(actor); - if (switchFlag >= 0 && switchFlag < 0x80 && Flags_GetSwitch(play, switchFlag) && + if ((switchFlag >= 0) && (switchFlag < 0x80) && Flags_GetSwitch(play, switchFlag) && !(pressedSwitchFlags[(switchFlag & ~0x1F) >> 5] & (1 << (switchFlag & 0x1F)))) { Flags_UnsetSwitch(play, switchFlag); } diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c index 7bddd548f6..942a544ffc 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c @@ -1019,7 +1019,7 @@ void func_80A9D61C(Actor* thisx, PlayState* play) { for (i = 0; i < D_80A9E028.count; i++) { unkStruct1 = &D_80A9E028.unk_0000[i]; - if (unkStruct1->unk_34 != 5 && unkStruct1->unk_34 != 4) { + if ((unkStruct1->unk_34 != 5) && (unkStruct1->unk_34 != 4)) { sp68.x = unkStruct1->unk_14.x + this->dyna.actor.home.pos.x; sp68.y = unkStruct1->unk_14.y + this->unk_16C; sp68.z = unkStruct1->unk_14.z + this->dyna.actor.home.pos.z; diff --git a/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c b/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c index 27e5d2fee9..15a677c299 100644 --- a/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c +++ b/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c @@ -121,7 +121,7 @@ void func_80AC4C34(BgIcefloe* this, PlayState* play) { WaterBox* water; this->timer--; - if (this->timer == 0 || + if ((this->timer == 0) || !WaterBox_GetSurface1_2(play, &play->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z, &this->dyna.actor.home.pos.y, &water)) { func_80AC4CF0(this); diff --git a/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c b/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c index f853fdfc5d..4646b8d45c 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c @@ -151,7 +151,7 @@ void BgIkanaDharma_WaitForHit(BgIkanaDharma* this, PlayState* play) { this->collider.base.acFlags &= ~AC_HIT; } - if (wasHit && sFirstHitBgIkanaDharma == NULL) { + if (wasHit && (sFirstHitBgIkanaDharma == NULL)) { sFirstHitBgIkanaDharma = this2; Flags_SetSwitch(play, BGIKANADHARMA_GET_SWITCHFLAG(&this->dyna.actor)); tempAngle1 = BINANG_ADD(this->dyna.actor.yawTowardsPlayer, 0x8000); @@ -160,8 +160,8 @@ void BgIkanaDharma_WaitForHit(BgIkanaDharma* this, PlayState* play) { this->dyna.actor.speed = 20.0f; Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_DARUMA_VANISH); BgIkanaDharma_SetupStartCutscene(this); - } else if ((this->dyna.actor.flags & ACTOR_FLAG_40) == ACTOR_FLAG_40 && sFirstHitBgIkanaDharma == NULL && - this->dyna.actor.xzDistToPlayer < 420.0f) { + } else if (CHECK_FLAG_ALL(this->dyna.actor.flags, ACTOR_FLAG_40) && (sFirstHitBgIkanaDharma == NULL) && + (this->dyna.actor.xzDistToPlayer < 420.0f)) { tempAngle1 = BINANG_SUB(this->dyna.actor.yawTowardsPlayer, player->actor.shape.rot.y); tempAngle1 = ABS_ALT(tempAngle1); diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index 3129d94116..8f86f7c127 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -259,7 +259,7 @@ void func_809542A0(BgIngate* this, PlayState* play) { } void func_80954340(BgIngate* this, PlayState* play) { - if (!DECR(this->unk16A)) { + if (DECR(this->unk16A) == 0) { if (this->timePath != NULL) { func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_END); this->timePath = &play->setupPathList[this->timePath->unk1]; diff --git a/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.c b/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.c index ffb260bf3c..b5eb3130a3 100644 --- a/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.c +++ b/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.c @@ -64,6 +64,7 @@ void BgOpenSpot_Draw(Actor* thisx, PlayState* play) { BgOpenSpot* this = (BgOpenSpot*)thisx; AnimatedMat_Draw(play, this->texScrolls); + OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Xlu(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c index 721d1de605..ddd012426b 100644 --- a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c +++ b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c @@ -113,7 +113,7 @@ Actor* func_80C1D78C(PlayState* play) { } tempActor = foundActor->next; - if (tempActor == NULL || false) { + if ((tempActor == NULL) || false) { foundActor = NULL; break; } diff --git a/src/overlays/actors/ovl_Dm_An/z_dm_an.c b/src/overlays/actors/ovl_Dm_An/z_dm_an.c index 2d8175bda0..86d57660fa 100644 --- a/src/overlays/actors/ovl_Dm_An/z_dm_an.c +++ b/src/overlays/actors/ovl_Dm_An/z_dm_an.c @@ -160,7 +160,7 @@ Actor* func_80C1C8E8(PlayState* play) { } tempActor = foundActor->next; - if (tempActor == NULL || false) { + if ((tempActor == NULL) || false) { foundActor = NULL; break; } @@ -229,6 +229,9 @@ void func_80C1CAB0(DmAn* this, PlayState* play) { } } break; + + default: + break; } Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } diff --git a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c index aa3a8b0e63..e348d145a3 100644 --- a/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c +++ b/src/overlays/actors/ovl_Dm_Char03/z_dm_char03.c @@ -163,7 +163,7 @@ void DmChar03_Draw(Actor* thisx, PlayState* play) { DmChar03* this = THIS; if (!this->unk_18E) { - if ((Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_136)) && + if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_136) && (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_136)]->id != 1)) { Gfx_SetupDL25_Opa(play->state.gfxCtx); SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, diff --git a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c index 9f8cd237fc..139d80bc3f 100644 --- a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c +++ b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c @@ -160,7 +160,7 @@ Actor* func_80C24838(PlayState* play) { } tempActor = foundActor->next; - if (tempActor == NULL || false) { + if ((tempActor == NULL) || false) { foundActor = NULL; break; } @@ -229,6 +229,9 @@ void func_80C24A00(DmGm* this, PlayState* play) { } } break; + + default: + break; } Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); } diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index e7eba8fa2a..88129eddc9 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -348,7 +348,7 @@ void func_808A1090(DoorShutter* this, PlayState* play) { if (this->unk_166 != 0) { Flags_SetSwitch(play, DOORSHUTTER_GET_7F(&this->slidingDoor.dyna.actor)); if (this->doorType != 5) { - gSaveContext.save.saveInfo.inventory.dungeonKeys[gSaveContext.mapIndex]--; + DUNGEON_KEY_COUNT(gSaveContext.mapIndex) = DUNGEON_KEY_COUNT(gSaveContext.mapIndex) - 1; Actor_PlaySfx(&this->slidingDoor.dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK); } else { Actor_PlaySfx(&this->slidingDoor.dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK_B); diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index 0cf8d76d17..ef73ef2dd6 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -63,6 +63,7 @@ void EffDust_Init(Actor* thisx, PlayState* play) { this->dz = 1.0f; this->scalingFactor = 0.2f; break; + case EFF_DUST_TYPE_1: this->actionFunc = func_80918FE4; this->actor.draw = func_80919768; @@ -71,6 +72,7 @@ void EffDust_Init(Actor* thisx, PlayState* play) { this->dz = 0.8f; this->scalingFactor = 0.5f; break; + case EFF_DUST_TYPE_SPIN_ATTACK_CHARGE: case EFF_DUST_TYPE_3: this->actionFunc = func_80919230; @@ -79,6 +81,7 @@ void EffDust_Init(Actor* thisx, PlayState* play) { this->dx = 0.5f; this->scalingFactor = 15.0f; break; + case EFF_DUST_TYPE_4: this->actionFunc = func_80919230; this->actor.draw = func_809199FC; @@ -86,6 +89,7 @@ void EffDust_Init(Actor* thisx, PlayState* play) { this->dx = 0.5f; this->scalingFactor = 10.0f; break; + case EFF_DUST_TYPE_5: this->actionFunc = func_80919230; this->actor.draw = func_809199FC; @@ -93,6 +97,7 @@ void EffDust_Init(Actor* thisx, PlayState* play) { this->dx = 0.5f; this->scalingFactor = 20.0f; break; + default: SystemArena_Free(this); break; @@ -171,7 +176,7 @@ void func_80919230(EffDust* this, PlayState* play) { s32 i; s32 j; - if (parent == NULL || parent->update == NULL || !(player->stateFlags1 & PLAYER_STATE1_1000)) { + if ((parent == NULL) || (parent->update == NULL) || !(player->stateFlags1 & PLAYER_STATE1_1000)) { if (this->life != 0) { this->life--; } else { @@ -235,6 +240,9 @@ void func_80919230(EffDust* this, PlayState* play) { this->initialPositions[i].z = 4000.0f * Math_CosS(theta); } break; + + default: + break; } this->distanceTraveled[i] = 0.0f; @@ -319,6 +327,7 @@ void func_809199FC(Actor* thisx, PlayState* play2) { Player* player = GET_PLAYER(play); OPEN_DISPS(gfxCtx); + Gfx_SetupDL25_Opa(gfxCtx); gDPPipeSync(POLY_XLU_DISP++); diff --git a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c index 839022d2cb..015e570084 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c @@ -232,8 +232,10 @@ s32 func_80BECFBC(EnAkindonuts* this) { case 3: Inventory_DeleteItem(ITEM_DEED_OCEAN, SLOT(ITEM_DEED_OCEAN)); return GI_RUPEE_HUGE; + + default: + return GI_NONE; } - return GI_NONE; } s32 func_80BED034(EnAkindonuts* this) { @@ -249,8 +251,10 @@ s32 func_80BED034(EnAkindonuts* this) { case 3: return GI_POTION_BLUE; + + default: + return GI_NONE; } - return GI_NONE; } void func_80BED090(PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index e4a83a6d0a..5f0ef2edf3 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -468,6 +468,7 @@ void func_8088ACE0(EnArrow* this, PlayState* play) { if ((this->unk_262 = BgCheck_ProjectileLineTest(&play->colCtx, &this->actor.prevPos, &this->actor.world.pos, &sp9C, &this->actor.wallPoly, true, true, true, true, &spA8))) { + // `func_800B90AC` only returns a boolean, and does not process any code func_800B90AC(play, &this->actor, this->actor.wallPoly, spA8, &sp9C); Math_Vec3f_Copy(&this->actor.world.pos, &sp9C); this->actor.wallBgId = spA8; diff --git a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c index 5eb0d03510..8c2b4eb4bb 100644 --- a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c +++ b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c @@ -68,7 +68,7 @@ void EnAttackNiw_Destroy(Actor* thisx, PlayState* play) { EnAttackNiw* this = THIS; EnNiw* parent = (EnNiw*)this->actor.parent; - if (this->actor.parent != NULL && this->actor.parent->update != NULL) { + if ((this->actor.parent != NULL) && (this->actor.parent->update != NULL)) { if (parent->attackNiwCount > 0) { parent->attackNiwCount--; } @@ -78,11 +78,11 @@ void EnAttackNiw_Destroy(Actor* thisx, PlayState* play) { /** * Summary: instead of using SkelAnime animations AttackNiw modifies head+wings directly to create animations * - * EnNiw has its own version of this function, probably copy paste since AttackNiw only uses two animationState (2/5) + * EnNiw has its own version of this function, probably copy paste since AttackNiw only uses two animIndex (2/5) */ -void EnAttackNiw_AnimateWingHead(EnAttackNiw* this, PlayState* play, s16 animationState) { +void EnAttackNiw_AnimateWingHead(EnAttackNiw* this, PlayState* play, s16 animIndex) { if (this->unkTimer24C == 0) { - if (animationState == 0) { + if (animIndex == 0) { this->targetBodyRotY = 0.0f; } else { this->targetBodyRotY = -10000.0f; @@ -92,7 +92,7 @@ void EnAttackNiw_AnimateWingHead(EnAttackNiw* this, PlayState* play, s16 animati this->unkTimer24C = 3; if ((this->clearRotYToggleTimer % 2) == 0) { this->targetBodyRotY = 0.0f; - if (animationState == 0) { + if (animIndex == 0) { this->unkTimer24C = Rand_ZeroFloat(30.0f); } } @@ -102,7 +102,7 @@ void EnAttackNiw_AnimateWingHead(EnAttackNiw* this, PlayState* play, s16 animati this->unkToggle28A++; this->unkToggle28A &= 1; - switch (animationState) { // only case 2 and 5 are ever called in AttackNiw + switch (animIndex) { // only case 2 and 5 are ever called in AttackNiw case NIW_ANIM_STILL: this->targetLeftWingRotZ = 0.0f; this->targetRightWingRotZ = 0.0f; @@ -156,6 +156,9 @@ void EnAttackNiw_AnimateWingHead(EnAttackNiw* this, PlayState* play, s16 animati this->targetLeftWingRotY = 10000.0f; } break; + + default: + break; } } diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.c b/src/overlays/actors/ovl_En_Az/z_en_az.c index 96a4fed1c2..b6c5df58d6 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.c +++ b/src/overlays/actors/ovl_En_Az/z_en_az.c @@ -1794,13 +1794,16 @@ void EnAz_Draw(Actor* thisx, PlayState* play2) { func_80A98DA4, func_80A98E48, &this->actor); } else { OPEN_DISPS(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sYoungerBrotherEyeTextures[this->unk_37E])); gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sYoungerBrotherBeltTextures[this->unk_380])); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80A98DA4, func_80A98E48, &this->actor); + CLOSE_DISPS(play->state.gfxCtx); } OPEN_DISPS(play->state.gfxCtx); + if ((this->actor.depthInWater >= 28.0f) && (this->actor.speed > 0.5f)) { Matrix_Translate(this->unk_3B4.x, this->unk_3B4.y, this->unk_3B4.z, MTXMODE_NEW); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY); @@ -1855,6 +1858,7 @@ void EnAz_Draw(Actor* thisx, PlayState* play2) { gSPDisplayList(POLY_XLU_DISP++, gBeaverYoungerBrotherTailSplashDL); } } + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c index 2653fb685f..223bb1b249 100644 --- a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c +++ b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c @@ -261,11 +261,14 @@ s32 EnBba01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* if (limbIndex == BBA_LIMB_RIGHT_LOWER_ARM_ROOT) { OPEN_DISPS(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->enHy.headObjIndex].segment); gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->enHy.headObjIndex].segment); gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->enHy.skelLowerObjIndex].segment); + CLOSE_DISPS(play->state.gfxCtx); } + if (limbIndex == BBA_LIMB_RIGHT_LOWER_ARM_ROOT) { Matrix_Translate(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateXS(this->enHy.headRot.y, MTXMODE_APPLY); @@ -297,8 +300,10 @@ void EnBba01_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro if (limbIndex == BBA_LIMB_HEAD) { OPEN_DISPS(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->enHy.skelUpperObjIndex].segment); gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->enHy.skelUpperObjIndex].segment); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 887fb68d5b..713410f236 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -657,6 +657,7 @@ void EnBigokuta_Draw(Actor* thisx, PlayState* play) { Gfx* gfx; OPEN_DISPS(play->state.gfxCtx); + if ((this->actionFunc != EnBigokuta_PlayDeathEffects) || (this->timer != 0)) { Scene_SetRenderModeXlu(play, 0, 1); gfx = POLY_OPA_DISP; diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c index 06bcd3b848..7c82b50b05 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -375,7 +375,6 @@ void EnBigpo_SpawnCutsceneStage4(EnBigpo* this, PlayState* play) { this->actor.shape.rot.y += this->rotVelocity; EnBigpo_RotateSpawnCutsceneFires(this); - if (1) {} for (i = 0; i < ARRAY_COUNT(this->fires); i++) { this->fires[i].pos.y += this->actor.velocity.y; } @@ -861,7 +860,7 @@ void EnBigpo_SelectRandomFireLocations(EnBigpo* this, PlayState* play) { // count the number of possible fires we can find (4 in vanilla) for (enemyPtr = GET_FIRST_ENEMY(play); enemyPtr != NULL; enemyPtr = enemyPtr->next) { - if (enemyPtr->id == ACTOR_EN_BIGPO && enemyPtr->params == ENBIGPO_POSSIBLEFIRE) { + if ((enemyPtr->id == ACTOR_EN_BIGPO) && (enemyPtr->params == ENBIGPO_POSSIBLEFIRE)) { fireCount++; } } @@ -882,7 +881,7 @@ void EnBigpo_SelectRandomFireLocations(EnBigpo* this, PlayState* play) { randomIndex = ((s32)Rand_ZeroFloat(fireCount)) % fireCount; while (enemyPtr != NULL) { - if (enemyPtr->id == ACTOR_EN_BIGPO && enemyPtr->params == ENBIGPO_POSSIBLEFIRE) { + if ((enemyPtr->id == ACTOR_EN_BIGPO) && (enemyPtr->params == ENBIGPO_POSSIBLEFIRE)) { if (randomIndex == 0) { randomFirePo = (EnBigpo*)enemyPtr; randomFirePo->actor.params = ENBIGPO_CHOSENFIRE; @@ -1225,8 +1224,8 @@ s32 EnBigpo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* Gfx** gfx) { EnBigpo* this = THIS; // not fully invisible - if (!(this->mainColor.a != 0 && limbIndex != 7) || - (this->actionFunc == EnBigpo_BurnAwayDeath && this->idleTimer >= 2)) { + if ((this->mainColor.a == 0) || (limbIndex == 7) || + ((this->actionFunc == EnBigpo_BurnAwayDeath) && (this->idleTimer >= 2))) { *dList = NULL; } return false; @@ -1416,6 +1415,7 @@ void EnBigpo_DrawCircleFlames(Actor* thisx, PlayState* play) { s32 i; mtfxPtr = Matrix_GetCurrent(); + OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Xlu(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index a32f2f4106..b65b2c63d1 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -122,6 +122,7 @@ void func_80867C8C(struct_80867BDC_a0* arg0, PlayState* play) { if (temp_s6 > 0) { OPEN_DISPS(play->state.gfxCtx); + Matrix_Push(); for (i = 0; i < temp_s6; i++) { f32 temp_f0 = (f32)i / temp_s6; @@ -150,6 +151,7 @@ void func_80867C8C(struct_80867BDC_a0* arg0, PlayState* play) { } Matrix_Pop(); gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + CLOSE_DISPS(play->state.gfxCtx); } } @@ -694,6 +696,7 @@ void EnBox_Draw(Actor* thisx, PlayState* play) { EnBox* this = THIS; OPEN_DISPS(play->state.gfxCtx); + if (this->unk_1F4.unk_10 != NULL) { this->unk_1F4.unk_10(&this->unk_1F4, play); } @@ -719,5 +722,6 @@ void EnBox_Draw(Actor* thisx, PlayState* play) { POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnBox_PostLimbDraw, &this->dyna.actor, POLY_XLU_DISP); } + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c index 8d841fdd2d..1cda18c275 100644 --- a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c +++ b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c @@ -251,10 +251,12 @@ s32 EnCne01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* if (limbIndex == CNE_LIMB_HEAD) { OPEN_DISPS(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->enHy.headObjIndex].segment); gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->enHy.headObjIndex].segment); *dList = gCneHeadBrownHairDL; gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->enHy.skelLowerObjIndex].segment); + CLOSE_DISPS(play->state.gfxCtx); } if (limbIndex == CNE_LIMB_HEAD) { @@ -289,8 +291,10 @@ void EnCne01_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro if (limbIndex == CNE_LIMB_RIGHT_FOOT) { OPEN_DISPS(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->enHy.skelUpperObjIndex].segment); gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->enHy.skelUpperObjIndex].segment); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index be946b8722..91d243464d 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -478,7 +478,7 @@ void func_80866B20(EnDoor* this, PlayState* play) { Animation_PlayOnceSetSpeed(&this->knobDoor.skelAnime, sAnimations[this->knobDoor.animIndex], (player->stateFlags1 & PLAYER_STATE1_8000000) ? 0.75f : 1.5f); if (this->unk_1A6 != 0) { - gSaveContext.save.saveInfo.inventory.dungeonKeys[gSaveContext.mapIndex]--; + DUNGEON_KEY_COUNT(gSaveContext.mapIndex) = DUNGEON_KEY_COUNT(gSaveContext.mapIndex) - 1; Flags_SetSwitch(play, this->switchFlag); Actor_PlaySfx(&this->knobDoor.dyna.actor, NA_SE_EV_CHAIN_KEY_UNLOCK); } @@ -501,7 +501,7 @@ void func_80866B20(EnDoor* this, PlayState* play) { player->doorDirection = playerPosRelToDoor.z >= 0.0f ? 1.0f : -1.0f; player->doorActor = &this->knobDoor.dyna.actor; if (this->unk_1A6 != 0) { - if (gSaveContext.save.saveInfo.inventory.dungeonKeys[((void)0, gSaveContext.mapIndex)] <= 0) { + if (DUNGEON_KEY_COUNT(gSaveContext.mapIndex) <= 0) { player->doorType = PLAYER_DOORTYPE_TALKING; this->knobDoor.dyna.actor.textId = 0x1802; } else { @@ -658,6 +658,7 @@ void EnDoor_Draw(Actor* thisx, PlayState* play) { if (this->knobDoor.dyna.actor.objBankIndex == this->knobDoor.requiredObjBankIndex) { OPEN_DISPS(play->state.gfxCtx); + if ((this->doorType == ENDOOR_TYPE_7) && (this->switchFlag == 0)) { Gfx_DrawDListOpa(play, gameplay_keep_DL_0221B8); } else { @@ -675,6 +676,7 @@ void EnDoor_Draw(Actor* thisx, PlayState* play) { if (this->unk_1A6) { Actor_DrawDoorLock(play, this->unk_1A6, 0); } + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Drs/z_en_drs.c b/src/overlays/actors/ovl_En_Drs/z_en_drs.c index d5dc8d2509..9fc28c9528 100644 --- a/src/overlays/actors/ovl_En_Drs/z_en_drs.c +++ b/src/overlays/actors/ovl_En_Drs/z_en_drs.c @@ -110,9 +110,11 @@ void EnDrs_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot // after that it will no longer be rendered. if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_87_02) && (limbIndex == WEDDING_DRESS_MANNEQUIN_LIMB_MASK)) { OPEN_DISPS(play->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[temp].segment); gSPDisplayList(POLY_OPA_DISP++, &gMoonMaskDL); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[temp2].segment); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c index 50e9303d7d..06b4308a06 100644 --- a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c +++ b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c @@ -55,7 +55,7 @@ void func_80A61334(EnDyExtra* this, PlayState* play) { this->actor.velocity.y = 0.0f; } - if (this->unk14C == 0 && this->unk14A != 0) { + if ((this->unk14C == 0) && (this->unk14A != 0)) { this->unk14C = 0x32; this->actionFunc = func_80A613C8; } @@ -64,7 +64,7 @@ void func_80A61334(EnDyExtra* this, PlayState* play) { void func_80A613C8(EnDyExtra* this, PlayState* play) { Math_ApproachF(&this->actor.gravity, 0.0f, 0.1f, 0.005f); - if (this->unk14C == 0 || this->unk150 < 0.02f) { + if ((this->unk14C == 0) || (this->unk150 < 0.02f)) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 8ee28ad7da..2bb7b6d0de 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -638,9 +638,9 @@ s32 func_8088DCA4(EnElf* this) { } void func_8088DD34(EnElf* this, PlayState* play) { - Player* refActor = GET_PLAYER(play); + Actor* playerActor = &GET_PLAYER(play)->actor; s32 pad; - Player* player2 = GET_PLAYER(play); + Player* player = GET_PLAYER(play); f32 heightDiff; SkelAnime_Update(&this->skelAnime); @@ -652,7 +652,7 @@ void func_8088DD34(EnElf* this, PlayState* play) { func_8088CBAC(this, play); if (this->fairyFlags & 0x800) { - this->unk_224.y = player2->bodyPartsPos[0].y; + this->unk_224.y = player->bodyPartsPos[0].y; } func_8088D8D0(this, &this->unk_224); @@ -672,17 +672,17 @@ void func_8088DD34(EnElf* this, PlayState* play) { return; } - heightDiff = this->actor.world.pos.y - refActor->actor.world.pos.y; + heightDiff = this->actor.world.pos.y - playerActor->world.pos.y; if ((this->fairyFlags & 0x1000) && (heightDiff > 0.0f) && (heightDiff < 60.0f) && - !func_8088C804(&this->actor.world.pos, &refActor->actor.world.pos, 10.0f)) { + !func_8088C804(&this->actor.world.pos, &playerActor->world.pos, 10.0f)) { Health_ChangeBy(play, 0x80); if (this->fairyFlags & 0x200) { Magic_Add(play, MAGIC_FILL_TO_CAPACITY); } gSaveContext.jinxTimer = 0; this->unk_254 = 50.0f; - this->unk_248 = refActor->actor.shape.rot.y; + this->unk_248 = playerActor->shape.rot.y; this->unk_24C = -0x1000; this->unk_224.y = 30.0f; this->unk_250 = 0.0f; diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c index e19e8d5222..05351cd3fe 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -93,18 +93,18 @@ void EnElforg_Init(Actor* thisx, PlayState* play) { } break; + case STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN: + case STRAY_FAIRY_TYPE_BUBBLE: + case STRAY_FAIRY_TYPE_CHEST: + case STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN: + break; + default: if (Flags_GetSwitch(play, STRAY_FAIRY_FLAG(thisx))) { Actor_Kill(thisx); return; } break; - - case STRAY_FAIRY_TYPE_FAIRY_FOUNTAIN: - case STRAY_FAIRY_TYPE_BUBBLE: - case STRAY_FAIRY_TYPE_CHEST: - case STRAY_FAIRY_TYPE_TURN_IN_TO_FAIRY_FOUNTAIN: - break; } if (Map_IsInDungeonOrBossArea(play)) { @@ -561,7 +561,7 @@ void EnElforg_TrappedByEnemy(EnElforg* this, PlayState* play) { void EnElforg_SetupTrappedByEnemy(EnElforg* this, PlayState* play) { Actor* enemy = EnElforg_GetHoldingEnemy(this, play); - if (enemy != NULL && enemy->update != NULL) { + if ((enemy != NULL) && (enemy->update != NULL)) { this->actionFunc = EnElforg_TrappedByEnemy; this->enemy = enemy; } @@ -587,7 +587,7 @@ void EnElforg_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (this->timer == 0 && this->secondaryTimer > 0) { + if ((this->timer == 0) && (this->secondaryTimer > 0)) { this->secondaryTimer--; } else { this->timer++; diff --git a/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c b/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c index 03eb407868..dd656f903b 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c +++ b/src/overlays/actors/ovl_En_Ending_Hero5/z_en_ending_hero5.c @@ -94,18 +94,25 @@ void EnEndingHero5_Draw(Actor* thisx, PlayState* play) { case 0: gDPSetEnvColor(POLY_OPA_DISP++, 170, 10, 70, 255); break; + case 1: gDPSetEnvColor(POLY_OPA_DISP++, 170, 200, 255, 255); break; + case 2: gDPSetEnvColor(POLY_OPA_DISP++, 0, 230, 70, 255); break; + case 3: gDPSetEnvColor(POLY_OPA_DISP++, 200, 0, 150, 255); break; + case 4: gDPSetEnvColor(POLY_OPA_DISP++, 245, 155, 0, 255); break; + + default: + break; } SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, diff --git a/src/overlays/actors/ovl_En_Fall/z_en_fall.c b/src/overlays/actors/ovl_En_Fall/z_en_fall.c index d21b30b607..8c975dbadb 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.c +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.c @@ -890,6 +890,7 @@ void EnFall_FireRing_Draw(Actor* thisx, PlayState* play) { if (this->fireRingAlpha > 1.0f) { this->fireRingAlpha = 1.0f; } + OPEN_DISPS(play->state.gfxCtx); AnimatedMat_DrawXlu(play, Lib_SegmentedToVirtual(gMoonFireRingTexAnim)); diff --git a/src/overlays/actors/ovl_En_Fg/z_en_fg.c b/src/overlays/actors/ovl_En_Fg/z_en_fg.c index 0f9b7594e6..491d3c4991 100644 --- a/src/overlays/actors/ovl_En_Fg/z_en_fg.c +++ b/src/overlays/actors/ovl_En_Fg/z_en_fg.c @@ -387,11 +387,13 @@ void EnFg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, if ((limbIndex == 7) || (limbIndex == 8)) { OPEN_DISPS(play->state.gfxCtx); + Matrix_Push(); Matrix_ReplaceRotation(&play->billboardMtxF); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); Matrix_Pop(); + CLOSE_DISPS(play->state.gfxCtx); } @@ -468,6 +470,7 @@ void EnFg_DrawDust(PlayState* play, EnFgEffectDust* dustEffect) { s16 firstDone = false; OPEN_DISPS(play->state.gfxCtx); + Gfx_SetupDL25_Xlu(play->state.gfxCtx); for (i = 0; i < 10; i++, dustEffect++) { diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c index 8d3cf44a51..11fa876d4d 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c @@ -615,24 +615,24 @@ void func_80B10868(EnGb2* this, PlayState* play) { } void func_80B10924(EnGb2* this, PlayState* play) { - s32 sp24; + s32 getItemId; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_54_40)) { - sp24 = 5; + getItemId = GI_RUPEE_PURPLE; } else { - sp24 = 12; + getItemId = GI_HEART_PIECE; } if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - if (sp24 == 12) { + if (getItemId == GI_HEART_PIECE) { SET_WEEKEVENTREG(WEEKEVENTREG_54_40); } else { Rupees_ChangeBy(50); } this->actionFunc = func_80B109DC; } else { - Actor_OfferGetItem(&this->actor, play, sp24, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, getItemId, 300.0f, 300.0f); } } diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index 99a2808f5c..6de6c7e750 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -441,6 +441,9 @@ void EnGe1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, gSPDisplayList(POLY_OPA_DISP++, sHairstyleDLs[this->hairstyle]); Matrix_MultVec3f(&sInitialFocusPos, &this->picto.actor.focus.pos); break; + + default: + break; } CLOSE_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Giant/z_en_giant.c b/src/overlays/actors/ovl_En_Giant/z_en_giant.c index cc15fcbced..29f7059a50 100644 --- a/src/overlays/actors/ovl_En_Giant/z_en_giant.c +++ b/src/overlays/actors/ovl_En_Giant/z_en_giant.c @@ -114,6 +114,7 @@ s32 EnGiant_IsImprisoned(EnGiant* this) { return true; } break; + case GIANT_TYPE_MOUNTAIN_TERMINA_FIELD: case GIANT_TYPE_MOUNTAIN_CLOCK_TOWER_SUCCESS: case GIANT_TYPE_MOUNTAIN_GIANTS_CHAMBER_AND_ENDING: @@ -122,6 +123,7 @@ s32 EnGiant_IsImprisoned(EnGiant* this) { return true; } break; + case GIANT_TYPE_OCEAN_TERMINA_FIELD: case GIANT_TYPE_OCEAN_CLOCK_TOWER_SUCCESS: case GIANT_TYPE_OCEAN_GIANTS_CHAMBER_AND_ENDING: @@ -130,6 +132,7 @@ s32 EnGiant_IsImprisoned(EnGiant* this) { return true; } break; + case GIANT_TYPE_CANYON_TERMINA_FIELD: case GIANT_TYPE_CANYON_CLOCK_TOWER_SUCCESS: case GIANT_TYPE_CANYON_GIANTS_CHAMBER_AND_ENDING: @@ -138,6 +141,9 @@ s32 EnGiant_IsImprisoned(EnGiant* this) { return true; } break; + + default: + break; } return false; @@ -229,11 +235,13 @@ void EnGiant_Init(Actor* thisx, PlayState* play) { case 10: this->sfxId = NA_SE_EV_KYOJIN_GRATITUDE2 - SFX_FLAG; break; + case 1: case 2: case 3: this->sfxId = NA_SE_EV_KYOJIN_GRATITUDE1 - SFX_FLAG; break; + default: this->sfxId = NA_SE_EV_KYOJIN_GRATITUDE0 - SFX_FLAG; break; @@ -361,47 +369,56 @@ void EnGiant_PlayAndUpdateAnimation(EnGiant* this) { case GIANT_CUE_ID_LOOKING_UP: EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_LOOK_UP_START); break; + case GIANT_CUE_ID_RAISING_ARMS: EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_RAISED_ARMS_START); break; + case GIANT_CUE_ID_STRUGGLING: EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_STRUGGLE_START); break; + case GIANT_CUE_ID_FALLING_OVER: // Unused EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_FALLING_OVER); break; + case GIANT_CUE_ID_TALKING: EnGiant_ChangeAnim(this, GIANT_ANIM_BIG_CALL_LOOP); break; + case GIANT_CUE_ID_DONE_TALKING: case GIANT_CUE_ID_PLAYER_LEARNED_OATH_TO_ORDER: EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP); break; + case GIANT_CUE_ID_TEACHING_OATH_TO_ORDER: EnGiant_ChangeAnim(this, GIANT_ANIM_SMALL_CALL_LOOP); break; + + default: + break; } SkelAnime_Update(&this->skelAnime); } } void EnGiant_PlaySound(EnGiant* this) { - if (this->actor.draw != NULL && this->alpha > 0) { - if (this->animIndex == GIANT_ANIM_WALKING_LOOP && + if ((this->actor.draw != NULL) && (this->alpha > 0)) { + if ((this->animIndex == GIANT_ANIM_WALKING_LOOP) && (Animation_OnFrame(&this->skelAnime, 40.0f) || Animation_OnFrame(&this->skelAnime, 100.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_KYOJIN_WALK); } - if (this->animIndex == GIANT_ANIM_FALLING_OVER && Animation_OnFrame(&this->skelAnime, 40.0f)) { + if ((this->animIndex == GIANT_ANIM_FALLING_OVER) && Animation_OnFrame(&this->skelAnime, 40.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_KYOJIN_VOICE_FAIL); } - if (this->sfxId != 0xFFFF && - ((this->animIndex == GIANT_ANIM_BIG_CALL_START && this->skelAnime.curFrame >= 18.0f) || - this->animIndex == GIANT_ANIM_BIG_CALL_LOOP)) { + if ((this->sfxId != 0xFFFF) && + (((this->animIndex == GIANT_ANIM_BIG_CALL_START) && (this->skelAnime.curFrame >= 18.0f)) || + (this->animIndex == GIANT_ANIM_BIG_CALL_LOOP))) { func_800B9010(&this->actor, this->sfxId); } - if ((this->animIndex == GIANT_ANIM_SMALL_CALL_START && this->skelAnime.curFrame >= 18.0f) || - this->animIndex == GIANT_ANIM_SMALL_CALL_LOOP) { + if (((this->animIndex == GIANT_ANIM_SMALL_CALL_START) && (this->skelAnime.curFrame >= 18.0f)) || + (this->animIndex == GIANT_ANIM_SMALL_CALL_LOOP)) { func_800B9010(&this->actor, NA_SE_EV_KYOJIN_SIGN - SFX_FLAG); } } diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index 90e449be3c..1859cf83ff 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -234,7 +234,7 @@ s32 EnGirlA_CanBuyArrows(PlayState* play, EnGirlA* this) { } s32 EnGirlA_CanBuyNuts(PlayState* play, EnGirlA* this) { - if (CUR_CAPACITY(UPG_NUTS) != 0 && CUR_CAPACITY(UPG_NUTS) <= AMMO(ITEM_NUT)) { + if ((CUR_CAPACITY(UPG_NUTS) != 0) && (CUR_CAPACITY(UPG_NUTS) <= AMMO(ITEM_NUT))) { return CANBUY_RESULT_NO_ROOM; } if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { @@ -257,7 +257,7 @@ s32 EnGirlA_CanBuyShieldHero(PlayState* play, EnGirlA* this) { } s32 EnGirlA_CanBuyStick(PlayState* play, EnGirlA* this) { - if (CUR_CAPACITY(UPG_STICKS) != 0 && AMMO(ITEM_STICK) >= CUR_CAPACITY(UPG_STICKS)) { + if ((CUR_CAPACITY(UPG_STICKS) != 0) && (AMMO(ITEM_STICK) >= CUR_CAPACITY(UPG_STICKS))) { return CANBUY_RESULT_NO_ROOM; } if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) { @@ -385,18 +385,24 @@ void EnGirlA_BuyBottleItem(PlayState* play, EnGirlA* this) { case SI_POTION_RED_6: Item_Give(play, ITEM_POTION_RED); break; + case SI_POTION_GREEN_1: case SI_POTION_GREEN_2: case SI_POTION_GREEN_3: Item_Give(play, ITEM_POTION_GREEN); break; + case SI_POTION_BLUE: Item_Give(play, ITEM_POTION_BLUE); break; + case SI_FAIRY_1: case SI_FAIRY_2: Item_Give(play, ITEM_FAIRY); break; + + default: + break; } Rupees_ChangeBy(-play->msgCtx.unk1206C); } @@ -411,9 +417,13 @@ void EnGirlA_BuyNuts(PlayState* play, EnGirlA* this) { case 5: Item_Give(play, ITEM_NUTS_5); break; + case 10: Item_Give(play, ITEM_NUTS_10); break; + + default: + break; } Rupees_ChangeBy(-play->msgCtx.unk1206C); } @@ -439,12 +449,17 @@ void EnGirlA_BuyBombBag(PlayState* play, EnGirlA* this) { case 20: Item_Give(play, ITEM_BOMB_BAG_20); break; + case 21: Item_Give(play, ITEM_BOMB_BAG_30); break; + case 22: Item_Give(play, ITEM_BOMB_BAG_40); break; + + default: + break; } Rupees_ChangeBy(-play->msgCtx.unk1206C); } @@ -461,15 +476,21 @@ void EnGirlA_BuyBombs(PlayState* play, EnGirlA* this) { case 5: Item_Give(play, ITEM_BOMBS_5); break; + case 10: Item_Give(play, ITEM_BOMBS_10); break; + case 20: Item_Give(play, ITEM_BOMBS_20); break; + case 30: Item_Give(play, ITEM_BOMBS_30); break; + + default: + break; } Rupees_ChangeBy(-play->msgCtx.unk1206C); } @@ -484,15 +505,21 @@ void EnGirlA_BuySword(PlayState* play, EnGirlA* this) { case 1: Item_Give(play, ITEM_SWORD_KOKIRI); break; + case 2: Item_Give(play, ITEM_SWORD_RAZOR); break; + case 3: Item_Give(play, ITEM_SWORD_GILDED); break; + case 4: Item_Give(play, ITEM_SWORD_GREAT_FAIRY); break; + + default: + break; } Rupees_ChangeBy(-play->msgCtx.unk1206C); } diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.c b/src/overlays/actors/ovl_En_Gk/z_en_gk.c index 28d5c344df..edb079373a 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c @@ -955,22 +955,22 @@ void func_80B52430(EnGk* this, PlayState* play) { } void func_80B5253C(EnGk* this, PlayState* play) { - s32 sp24; + s32 getItemId; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_41_08)) { - sp24 = 0x93; + getItemId = GI_GOLD_DUST_2; } else { - sp24 = 0x6A; + getItemId = GI_GOLD_DUST; } if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - if (sp24 == 0x6A) { + if (getItemId == GI_GOLD_DUST) { SET_WEEKEVENTREG(WEEKEVENTREG_41_08); } this->actionFunc = func_80B525E0; } else { - Actor_OfferGetItem(&this->actor, play, sp24, 300.0f, 300.0f); + Actor_OfferGetItem(&this->actor, play, getItemId, 300.0f, 300.0f); } } diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 30a6709a24..d8004bef8e 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -458,25 +458,25 @@ void func_8099874C(EnGs* this, PlayState* play) { } if (phi_v0 != 0) { - this->unk_20C = -1; + this->getItemId = -1; switch (this->unk_194) { case 1: if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_77_08)) { - this->unk_20C = 6; + this->getItemId = GI_RUPEE_SILVER; SET_WEEKEVENTREG(WEEKEVENTREG_77_08); } break; case 3: if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_77_10)) { - this->unk_20C = 6; + this->getItemId = GI_RUPEE_SILVER; SET_WEEKEVENTREG(WEEKEVENTREG_77_10); } break; case 2: if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_77_20)) { - this->unk_20C = 6; + this->getItemId = GI_RUPEE_SILVER; SET_WEEKEVENTREG(WEEKEVENTREG_77_20); } break; @@ -484,10 +484,10 @@ void func_8099874C(EnGs* this, PlayState* play) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_90_10)) { SET_WEEKEVENTREG(WEEKEVENTREG_90_10); - this->unk_20C = 12; + this->getItemId = GI_HEART_PIECE; } - if (this->unk_20C > 0) { + if (this->getItemId > GI_NONE) { func_809989B4(this, play); } else { func_80997D14(this, play); @@ -502,7 +502,7 @@ void func_8099874C(EnGs* this, PlayState* play) { } void func_809989B4(EnGs* this, PlayState* play) { - Actor_OfferGetItem(&this->actor, play, this->unk_20C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Actor_OfferGetItem(&this->actor, play, this->getItemId, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_809989F4; } @@ -511,7 +511,8 @@ void func_809989F4(EnGs* this, PlayState* play) { this->actor.parent = NULL; func_80997D14(this, play); } else { - Actor_OfferGetItem(&this->actor, play, this->unk_20C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); + Actor_OfferGetItem(&this->actor, play, this->getItemId, this->actor.xzDistToPlayer, + this->actor.playerHeightRel); } } diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.h b/src/overlays/actors/ovl_En_Gs/z_en_gs.h index abb4a5b865..42efabb613 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.h +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.h @@ -47,7 +47,7 @@ typedef struct EnGs { /* 0x200 */ f32 unk_200; /* 0x204 */ s32 unk_204; /* 0x208 */ s32 unk_208; - /* 0x20C */ s32 unk_20C; + /* 0x20C */ s32 getItemId; /* 0x210 */ u16 unk_210; /* 0x212 */ s16 csIdList[2]; /* 0x216 */ s16 unk_216; diff --git a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c index 78a2aa4d1a..bdc4637d14 100644 --- a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c +++ b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c @@ -131,7 +131,7 @@ void func_80BC6E10(EnGuruguru* this) { this->headZRotTarget = 0; this->unk268 = 1; this->actor.textId = textIDs[this->textIdIndex]; - if ((this->textIdIndex == 0 || this->textIdIndex == 1) && CHECK_WEEKEVENTREG(WEEKEVENTREG_77_04)) { + if (((this->textIdIndex == 0) || (this->textIdIndex == 1)) && CHECK_WEEKEVENTREG(WEEKEVENTREG_77_04)) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_88_04)) { this->actor.textId = 0x295F; } else { @@ -175,7 +175,7 @@ void func_80BC701C(EnGuruguru* this, PlayState* play) { Player* player = GET_PLAYER(play); if ((this->unk268 != 0) && - (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_DEKU)) { + ((player->transformation == PLAYER_FORM_HUMAN) || (player->transformation == PLAYER_FORM_DEKU))) { this->headZRotTarget = 5000; } @@ -324,7 +324,7 @@ void EnGuruguru_Update(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); return; } - } else if (this->actor.params == 0 || this->actor.params == 2) { + } else if ((this->actor.params == 0) || (this->actor.params == 2)) { Actor_Kill(&this->actor); return; } @@ -352,10 +352,10 @@ void EnGuruguru_Update(Actor* thisx, PlayState* play) { this->headXRotTarget = 0; if (yaw < 0x2AF8) { this->headXRotTarget = this->actor.yawTowardsPlayer - this->actor.world.rot.y; - if (this->headXRotTarget > 5000) { - this->headXRotTarget = 5000; - } else if (this->headXRotTarget < -5000) { - this->headXRotTarget = -5000; + if (this->headXRotTarget > 0x1388) { + this->headXRotTarget = 0x1388; + } else if (this->headXRotTarget < -0x1388) { + this->headXRotTarget = -0x1388; } } Actor_SetScale(&this->actor, 0.01f); diff --git a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c index 630ae405f2..43a5895d55 100644 --- a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c +++ b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c @@ -156,7 +156,7 @@ void func_80BDB2B8(EnHiddenNuts* this, PlayState* play) { this->unk_20A = 0; } - if (Actor_ProcessTalkRequest(&this->actor, &play->state) != 0) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { func_80BDB580(this); return; } diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 8cff778fd8..71b338121c 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -1033,6 +1033,7 @@ void EnIk_UpdateArmorDraw(EnIk* this, PlayState* play) { sp54 = 0; OPEN_DISPS(play->state.gfxCtx); + gfxOpa = POLY_OPA_DISP; gfxXlu = POLY_XLU_DISP; diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index cbdc2ba195..5031d7e872 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -329,7 +329,7 @@ void func_808F38F8(EnIn* this, PlayState* play) { while (true) { //! @bug: Infinite loop if there is only one ACTOR_EN_IN this->unk4A4 = (EnIn*)SubS_FindActor(play, &this->unk4A4->actor, ACTORCAT_NPC, ACTOR_EN_IN); - if (this->unk4A4 != NULL && this->unk4A4 != this) { + if ((this->unk4A4 != NULL) && (this->unk4A4 != this)) { break; } this->unk4A4 = (EnIn*)this->unk4A4->actor.next; @@ -357,9 +357,13 @@ void func_808F39DC(EnIn* this, PlayState* play) { case WEEKEVENTREG_HORSE_RACE_STATE_2: textId = 0x347A; break; + case WEEKEVENTREG_HORSE_RACE_STATE_3: textId = 0x3476; break; + + default: + break; } SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_END); } else { @@ -367,9 +371,13 @@ void func_808F39DC(EnIn* this, PlayState* play) { case WEEKEVENTREG_HORSE_RACE_STATE_2: textId = 0x349D; break; + case WEEKEVENTREG_HORSE_RACE_STATE_3: textId = 0x3499; break; + + default: + break; } SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_END); } @@ -482,6 +490,7 @@ u16 func_808F3DD4(PlayState* play, EnIn* this, u32 arg2) { textId = 0x345B; } break; + case 1: if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_15_10)) { textId = 0x3463; @@ -489,11 +498,12 @@ u16 func_808F3DD4(PlayState* play, EnIn* this, u32 arg2) { textId = 0x346B; } break; + case 3: if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { textId = 0x3485; - } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA || - gSaveContext.save.playerForm == PLAYER_FORM_GORON) { + } else if ((gSaveContext.save.playerForm == PLAYER_FORM_ZORA) || + (gSaveContext.save.playerForm == PLAYER_FORM_GORON)) { textId = 0x3484; } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_56_04)) { textId = 0x346D; @@ -501,8 +511,10 @@ u16 func_808F3DD4(PlayState* play, EnIn* this, u32 arg2) { textId = 0x3482; } break; + case 4: - if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA || gSaveContext.save.playerForm == PLAYER_FORM_GORON) { + if ((gSaveContext.save.playerForm == PLAYER_FORM_ZORA) || + (gSaveContext.save.playerForm == PLAYER_FORM_GORON)) { textId = 0x348A; } else if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { textId = 0x348B; @@ -512,6 +524,7 @@ u16 func_808F3DD4(PlayState* play, EnIn* this, u32 arg2) { textId = 0x3489; } break; + case 5: if (func_808F33B8()) { textId = 0x34B3; @@ -521,17 +534,22 @@ u16 func_808F3DD4(PlayState* play, EnIn* this, u32 arg2) { textId = 0x3493; } break; + case 7: if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { textId = 0x34A8; - } else if (gSaveContext.save.playerForm == PLAYER_FORM_ZORA || - gSaveContext.save.playerForm == PLAYER_FORM_GORON) { + } else if ((gSaveContext.save.playerForm == PLAYER_FORM_ZORA) || + (gSaveContext.save.playerForm == PLAYER_FORM_GORON)) { textId = 0x34A7; } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_16_04)) { textId = 0x3495; } else { textId = 0x34A5; } + break; + + default: + break; } if (textId == 0) { textId = 1; @@ -540,10 +558,9 @@ u16 func_808F3DD4(PlayState* play, EnIn* this, u32 arg2) { } void func_808F4054(PlayState* play, EnIn* this, s32 arg2, u16 textId) { - s32 unused; + s32 pad; - if (textId == 0x34AE || textId == 0x34B0 || textId == 0x34B2) { - unused = textId; + if ((textId == 0x34AE) || (textId == 0x34B0) || (textId == 0x34B2)) { func_80151BB4(play, 0x11); } switch (arg2) { @@ -554,12 +571,15 @@ void func_808F4054(PlayState* play, EnIn* this, s32 arg2, u16 textId) { func_808F35D8(this, play); } break; + case 2: if (textId == 0x3473) { func_808F35D8(this, play); } break; + case 0: + default: break; } } @@ -599,7 +619,7 @@ s32 func_808F4150(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx) s32 func_808F4270(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx, s32 arg4) { s32 pad; - s32 fee = play->msgCtx.unk1206C != 0xFFFF ? play->msgCtx.unk1206C : 10; + s32 fee = (play->msgCtx.unk1206C != 0xFFFF) ? play->msgCtx.unk1206C : 10; if (msgCtx->choiceIndex == 0) { func_8019F208(); @@ -651,31 +671,38 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { Actor_ContinueText(play, &this->actor, 0x34B0); ret = false; break; + case 0x34A9: func_808F4108(this, play, 0x34AA); SET_WEEKEVENTREG(WEEKEVENTREG_63_40); ret = false; break; + case 0x34AA: func_808F4108(this, play, 0x34AB); ret = false; break; + case 0x34AB: func_808F4108(this, play, 0x34AC); ret = false; break; + case 0x34AC: func_808F4108(this, play, 0x34AD); ret = false; break; + case 0x34AD: Actor_ContinueText(play, &this->actor, 0x34AE); ret = false; break; + case 0x34B1: Actor_ContinueText(play, &this->actor, 0x34B2); ret = false; break; + default: break; } @@ -688,48 +715,62 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { Actor_ContinueText(play, &this->actor, 0x3459); ret = false; break; + case 0x3459: Actor_ContinueText(play, &this->actor, 0x345A); ret = false; break; + case 0x345A: func_80151BB4(play, 0x11); ret = true; break; + case 0x345B: func_80151BB4(play, 0x11); ret = true; break; + case 0x345C: Actor_ContinueText(play, &this->actor, 0x345D); ret = false; break; + case 0x345D: Actor_ContinueText(play, &this->actor, 0x345E); ret = false; break; + case 0x345E: Actor_ContinueText(play, &this->actor, 0x345F); ret = false; break; + case 0x345F: func_80151BB4(play, 0x11); ret = true; break; + case 0x3460: Actor_ContinueText(play, &this->actor, 0x3461); ret = false; break; + case 0x3461: Actor_ContinueText(play, &this->actor, 0x3462); ret = false; break; + case 0x3462: func_80151BB4(play, 0x11); ret = true; break; + + default: + break; } break; + case 1: switch (textId) { case 0x3463: @@ -737,14 +778,17 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { Actor_ContinueText(play, &this->actor, 0x3464); ret = false; break; + case 0x3464: Actor_ContinueText(play, &this->actor, 0x3465); ret = false; break; + case 0x3465: Actor_ContinueText(play, &this->actor, 0x3466); ret = false; break; + case 0x3466: if (msgCtx->choiceIndex == 0) { func_8019F208(); @@ -769,54 +813,65 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { ret = false; } break; + case 0x3467: case 0x3468: case 0x3469: func_80151BB4(play, 0x11); ret = true; break; + case 0x346B: Actor_ContinueText(play, &this->actor, 0x346C); ret = false; break; + case 0x346C: Actor_ContinueText(play, &this->actor, 0x3466); ret = false; break; + case 0x346A: this->actionFunc = func_808F5A94; func_80151BB4(play, 0x11); break; } break; + case 2: switch (textId) { case 0x346E: func_808F4108(this, play, 0x346F); ret = false; break; + case 0x3470: Actor_ContinueText(play, &this->actor, 0x3471); ret = false; break; + case 0x3483: Actor_ContinueText(play, &this->actor, 0x3471); ret = false; break; + case 0x3471: func_808F4150(play, this, arg2, msgCtx); ret = false; break; + case 0x3472: func_808F43E0(this); CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08); func_80151BB4(play, 0x11); ret = true; break; + case 0x3473: CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08); func_80151BB4(play, 0x11); break; + case 0x3475: SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_START); func_800FD750(NA_BGM_HORSE); @@ -825,6 +880,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { play->transitionTrigger = TRANS_TRIGGER_START; SET_WEEKEVENTREG(WEEKEVENTREG_57_01); break; + case 0x3478: if (msgCtx->choiceIndex == 0) { func_808F4150(play, this, arg2, msgCtx); @@ -836,13 +892,18 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { ret = false; } break; + case 0x347B: func_808F4108(this, play, 0x347C); CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08); ret = false; break; + + default: + break; } break; + case 3: switch (textId) { case 0x346D: @@ -851,36 +912,44 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { SET_WEEKEVENTREG(WEEKEVENTREG_56_08); ret = false; break; + case 0x346F: func_808F4108(this, play, 0x3470); ret = false; break; + case 0x3482: func_808F4108(this, play, 0x3483); SET_WEEKEVENTREG(WEEKEVENTREG_56_08); ret = false; break; + case 0x3484: func_80151BB4(play, 0x11); break; + case 0x3485: func_80151BB4(play, 0x11); break; + case 0x3474: func_808F4108(this, play, 0x3475); ret = false; break; + case 0x3476: Actor_ContinueText(play, &this->actor, 0x3477); EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_1); EnIn_ChangeAnim(&this->unk4A4->skelAnime, ENIN_ANIM_7); ret = false; break; + case 0x3477: SET_WEEKEVENTREG(WEEKEVENTREG_56_08); func_808F4108(this, play, 0x3478); ret = false; break; + case 0x347A: EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_1); EnIn_ChangeAnim(&this->unk4A4->skelAnime, ENIN_ANIM_7); @@ -904,33 +973,39 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { ret = false; } break; + case 0x347F: Actor_ContinueText(play, &this->actor, 0x3480); ret = false; break; + case 0x3480: func_808F43E0(this); func_80151BB4(play, 0x11); ret = true; break; + case 0x3479: func_808F43E0(this); func_808F35D8(this, play); func_80151BB4(play, 0x11); ret = true; break; + case 0x347C: this->actionFunc = func_808F3D40; Actor_OfferGetItem(&this->actor, play, GI_MASK_GARO, 500.0f, 100.0f); func_808F35D8(this, play); ret = true; break; + case 0x3481: this->actionFunc = func_808F5A34; func_808F43E0(this); func_80151BB4(play, 0x11); ret = true; break; + case 0x347D: this->actionFunc = func_808F5A34; func_808F43E0(this); @@ -938,8 +1013,12 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { func_80151BB4(play, 0x2F); ret = true; break; + + default: + break; } break; + case 4: switch (textId) { case 0x3486: @@ -947,34 +1026,45 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { SET_WEEKEVENTREG(WEEKEVENTREG_16_01); ret = false; break; + case 0x3487: Actor_ContinueText(play, &this->actor, 0x3488); ret = false; break; + case 0x3488: func_80151BB4(play, 0x11); ret = true; break; + case 0x3489: func_80151BB4(play, 0x11); break; + case 0x348A: func_80151BB4(play, 0x11); break; + case 0x348B: Actor_ContinueText(play, &this->actor, 0x348C); ret = false; break; + case 0x348C: Actor_ContinueText(play, &this->actor, 0x348D); ret = false; break; + case 0x348D: func_80151BB4(play, 0x11); ret = true; break; + + default: + break; } break; + case 5: switch (textId) { case 0x3468: @@ -982,21 +1072,25 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { case 0x3491: func_80151BB4(play, 0x11); break; + case 0x348E: case 0x34B3: Actor_ContinueText(play, &this->actor, 0x348F); SET_WEEKEVENTREG(WEEKEVENTREG_16_02); ret = false; break; + case 0x3493: Actor_ContinueText(play, &this->actor, 0x3494); ret = false; break; + case 0x348F: case 0x3494: Actor_ContinueText(play, &this->actor, 0x3490); ret = false; break; + case 0x3490: if (msgCtx->choiceIndex == 0) { func_8019F208(); @@ -1021,49 +1115,59 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { ret = false; } break; + case 0x3492: this->actionFunc = func_808F5A94; func_80151BB4(play, 0x11); break; } break; + case 7: switch (textId) { case 0x34A8: func_80151BB4(play, 0x11); break; + case 0x34A7: func_80151BB4(play, 0x11); break; + case 0x3495: func_808F4108(this, play, 0x3496); SET_WEEKEVENTREG(WEEKEVENTREG_16_04); SET_WEEKEVENTREG(WEEKEVENTREG_56_08); ret = false; break; + case 0x3497: func_808F4108(this, play, 0x3498); ret = false; break; + case 0x34A4: this->actionFunc = func_808F5A34; func_808F43E0(this); func_80151BB4(play, 0x11); ret = true; break; + case 0x34A5: func_808F4108(this, play, 0x34A6); SET_WEEKEVENTREG(WEEKEVENTREG_56_08); ret = false; break; + case 0x3473: CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08); func_80151BB4(play, 0x11); break; + case 0x3474: Actor_ContinueText(play, &this->actor, 0x3475); ret = false; break; + case 0x3475: SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_START); func_800FD750(NA_BGM_HORSE); @@ -1072,6 +1176,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { play->transitionTrigger = TRANS_TRIGGER_START; SET_WEEKEVENTREG(WEEKEVENTREG_57_01); break; + case 0x349D: EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_1); EnIn_ChangeAnim(&this->unk4A4->skelAnime, ENIN_ANIM_7); @@ -1084,12 +1189,14 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { ret = false; } break; + case 0x349F: this->actionFunc = func_808F3D40; Actor_OfferGetItem(&this->actor, play, GI_MASK_GARO, 500.0f, 100.0f); func_808F35D8(this, play); ret = true; break; + case 0x34A0: this->actionFunc = func_808F5A34; func_80151BB4(play, 0x11); @@ -1097,6 +1204,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { func_808F43E0(this); ret = true; break; + case 0x34A1: func_808F35D8(this, play); if (Inventory_HasEmptyBottle()) { @@ -1108,25 +1216,30 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { ret = false; } break; + case 0x34A2: Actor_ContinueText(play, &this->actor, 0x34A3); ret = false; break; + case 0x34A3: func_808F43E0(this); func_80151BB4(play, 0x11); ret = true; break; + case 0x3499: Actor_ContinueText(play, &this->actor, 0x349A); EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_1); EnIn_ChangeAnim(&this->unk4A4->skelAnime, ENIN_ANIM_7); ret = false; break; + case 0x349A: Actor_ContinueText(play, &this->actor, 0x349B); ret = false; break; + case 0x349B: if (msgCtx->choiceIndex == 0) { func_808F4270(play, this, arg2, msgCtx, 1); @@ -1137,42 +1250,57 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { ret = false; } break; + case 0x349C: func_808F43E0(this); func_808F35D8(this, play); func_80151BB4(play, 0x11); ret = true; break; + + default: + break; } break; + case 6: switch (textId) { case 0x3496: func_808F4108(this, play, 0x3497); ret = false; break; + case 0x3498: case 0x34A6: Actor_ContinueText(play, &this->actor, 0x3471); ret = false; break; + case 0x3471: func_808F4270(play, this, arg2, msgCtx, 0); ret = false; break; + case 0x3472: func_808F43E0(this); CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08); func_80151BB4(play, 0x11); ret = true; break; + case 0x349E: func_808F4108(this, play, 0x349F); CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08); ret = false; break; + + default: + break; } break; + + default: + break; } return ret; } @@ -1186,6 +1314,7 @@ s32 func_808F5674(PlayState* play, EnIn* this, s32 arg2) { func_808F4054(play, this, arg2, this->actor.textId); ret = true; break; + case TEXT_STATE_CHOICE: case TEXT_STATE_5: if (Message_ShouldAdvance(play) && func_808F4414(play, this, arg2)) { @@ -1193,6 +1322,9 @@ s32 func_808F5674(PlayState* play, EnIn* this, s32 arg2) { ret = true; } break; + + default: + break; } return ret; } @@ -1368,10 +1500,10 @@ void EnIn_Init(Actor* thisx, PlayState* play) { this->unk4AC = 0; type = ENIN_GET_TYPE(thisx); this->unk4B0 = GET_WEEKEVENTREG_HORSE_RACE_STATE; - if (type == ENIN_HORSE_RIDER_BLUE_SHIRT || type == ENIN_BLUE_SHIRT) { + if ((type == ENIN_HORSE_RIDER_BLUE_SHIRT) || (type == ENIN_BLUE_SHIRT)) { this->unk4AC |= 8; } - if (type == ENIN_HORSE_RIDER_YELLOW_SHIRT || type == ENIN_HORSE_RIDER_BLUE_SHIRT) { + if ((type == ENIN_HORSE_RIDER_YELLOW_SHIRT) || (type == ENIN_HORSE_RIDER_BLUE_SHIRT)) { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); this->unk488 = 1; Animation_Change(&this->skelAnime, &object_in_Anim_016A60, 1.0f, 0.0f, @@ -1387,7 +1519,7 @@ void EnIn_Init(Actor* thisx, PlayState* play) { this->actor.gravity = -4.0f; this->path = SubS_GetPathByIndex(play, ENIN_GET_PATH(&this->actor), 0x3F); this->unk23D = 0; - if (type == ENIN_YELLOW_SHIRT || type == ENIN_BLUE_SHIRT) { + if ((type == ENIN_YELLOW_SHIRT) || (type == ENIN_BLUE_SHIRT)) { if ((GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_2) || (GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_3)) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08); @@ -1478,15 +1610,15 @@ void func_808F6334(EnIn* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 talkState = Message_GetState(&play->msgCtx); - this->unk4C4 += this->unk4C0 != 0.0f ? 40.0f : -40.0f; + this->unk4C4 += (this->unk4C0 != 0.0f) ? 40.0f : -40.0f; this->unk4C4 = CLAMP(this->unk4C4, 0.0f, 80.0f); Matrix_Translate(this->unk4C4, 0.0f, 0.0f, MTXMODE_APPLY); if ((&this->actor == player->talkActor) && - !((play->msgCtx.currentTextId >= 0xFF) && (play->msgCtx.currentTextId <= 0x200)) && - (talkState == TEXT_STATE_3) && (this->prevTalkState == TEXT_STATE_3)) { + ((play->msgCtx.currentTextId < 0xFF) || (play->msgCtx.currentTextId > 0x200)) && (talkState == TEXT_STATE_3) && + (this->prevTalkState == TEXT_STATE_3)) { if (!(play->state.frames & 1)) { - this->unk4C0 = this->unk4C0 != 0.0f ? 0.0f : 1.0f; + this->unk4C0 = (this->unk4C0 != 0.0f) ? 0.0f : 1.0f; } } else { this->unk4C0 = 0.0f; @@ -1520,16 +1652,17 @@ s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po object_in_DL_013440, }; - if (this->unk23C != 0 && limbIndex != 16) { + if ((this->unk23C != 0) && (limbIndex != 16)) { if (sp50[limbIndex] != NULL) { *dList = sp50[limbIndex]; } } - if (this->unk4AC & 4 && limbIndex == 16) { + if ((this->unk4AC & 4) && (limbIndex == 16)) { *dList = object_in_DL_01C528; } OPEN_DISPS(play->state.gfxCtx); + if (limbIndex == 16) { TexturePtr sp38[] = { object_in_Tex_0035E0, object_in_Tex_004820, object_in_Tex_004C20, object_in_Tex_0043E0 }; @@ -1538,6 +1671,7 @@ s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po } else { AnimatedMat_DrawStep(play, Lib_SegmentedToVirtual(object_in_Matanimheader_001C30), this->unk4AC & 8 ? 1 : 0); } + CLOSE_DISPS(play->state.gfxCtx); if (limbIndex == 16) { @@ -1551,7 +1685,7 @@ s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po Matrix_RotateYS(this->torsoRot.y, MTXMODE_APPLY); Matrix_RotateXS(this->torsoRot.x, MTXMODE_APPLY); } - if (limbIndex == 9 || limbIndex == 10 || limbIndex == 13) { + if ((limbIndex == 9) || (limbIndex == 10) || (limbIndex == 13)) { rot->y += (s16)(Math_SinS(this->unk376[limbIndex]) * 200.0f); rot->z += (s16)(Math_CosS(this->unk39E[limbIndex]) * 200.0f); } @@ -1593,21 +1727,25 @@ void EnIn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, if (this->unk23C == 0) { if (!(this->unk4AC & 8)) { OPEN_DISPS(play->state.gfxCtx); + if (limbIndex == 12) { gSPDisplayList(POLY_OPA_DISP++, object_in_DL_007A70); } if (limbIndex == 15) { gSPDisplayList(POLY_OPA_DISP++, object_in_DL_007C48); } + CLOSE_DISPS(play->state.gfxCtx); } } } if (this->unk4AC & 0x20) { OPEN_DISPS(play->state.gfxCtx); + if (limbIndex == 12) { gSPDisplayList(POLY_OPA_DISP++, object_in_DL_007C48); } + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index ee6e28de29..a1da5941be 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -321,15 +321,15 @@ s32 func_80B85858(EnKaizoku* this, PlayState* play) { for (itemAction = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; itemAction != NULL; itemAction = itemAction->next) { - //! FAKE: - if (1) {} - if (((itemAction->id == ACTOR_ARMS_HOOK) || (itemAction->id == ACTOR_EN_ARROW)) && (player->unk_D57)) { - if (((itemAction->id != ACTOR_ARMS_HOOK) || (this->action != KAIZOKU_ACTION_13)) && - (this->action != KAIZOKU_ACTION_6)) { - func_80B87C7C(this); - } - break; + if (((itemAction->id != ACTOR_ARMS_HOOK) && (itemAction->id != ACTOR_EN_ARROW)) || (player->unk_D57 == 0)) { + continue; } + + if (((itemAction->id != ACTOR_ARMS_HOOK) || (this->action != KAIZOKU_ACTION_13)) && + (this->action != KAIZOKU_ACTION_6)) { + func_80B87C7C(this); + } + break; } if (prevAction != this->action) { @@ -423,8 +423,8 @@ s32 func_80B85A00(EnKaizoku* this, PlayState* play, s16 arg2) { func_80B87900(this); } else { sp2A = player->actor.shape.rot.y - this->picto.actor.shape.rot.y; - if (this->picto.actor.xzDistToPlayer <= 65.0f && !Actor_OtherIsTargeted(play, &this->picto.actor) && - ABS_ALT(sp2A) < 0x5000) { + if ((this->picto.actor.xzDistToPlayer <= 65.0f) && !Actor_OtherIsTargeted(play, &this->picto.actor) && + (ABS_ALT(sp2A) < 0x5000)) { if (this->action != KAIZOKU_ACTION_9) { func_80B87F70(this); return 1; @@ -508,7 +508,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { this->unk_598 = 0; Audio_SetMainBgmVolume(0, 0xA); this->unk_59C++; - + // fallthrough case 1: player->actor.shape.rot.y = player->actor.world.rot.y = Math_Vec3f_Yaw(&player->actor.world.pos, &this->picto.actor.world.pos); @@ -611,7 +611,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { func_800B7298(play, &this->picto.actor, 6); CutsceneManager_Stop(this->csId); this->unk_59C = 0; - this->subCamId = 0; + this->subCamId = SUB_CAM_ID_DONE; this->picto.actor.flags &= ~ACTOR_FLAG_100000; this->picto.actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; this->picto.actor.flags |= ACTOR_FLAG_1; @@ -657,7 +657,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { Math_Vec3f_Copy(&this->subCamAt, &this->unk_5D4); } - if (this->subCamId != 0) { + if (this->subCamId != SUB_CAM_ID_DONE) { this->subCamUp.y = 1.0f; this->subCamUp.z = 0.0f; Play_SetCameraAtEyeUp(play, this->subCamId, &this->subCamAt, &this->subCamEye, &this->subCamUp); @@ -665,7 +665,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { } void func_80B86804(EnKaizoku* this, PlayState* play) { - if (this->subCamId == 0) { + if (this->subCamId == SUB_CAM_ID_DONE) { if (!CutsceneManager_IsNext(this->csId)) { CutsceneManager_Queue(this->csId); return; @@ -725,7 +725,7 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { Message_CloseTextbox(play); func_800B7298(play, &this->picto.actor, 6); CutsceneManager_Stop(this->csId); - this->subCamId = 0; + this->subCamId = SUB_CAM_ID_DONE; play->nextEntrance = play->setupExitList[this->exitIndex]; gSaveContext.nextCutsceneIndex = 0; Scene_SetExitFade(play); @@ -733,11 +733,13 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { this->unk_59C++; this->action = KAIZOKU_ACTION_16; } + break; + default: break; } - if (this->subCamId != 0) { + if (this->subCamId != SUB_CAM_ID_DONE) { this->subCamUp.x = 0.0f; this->subCamUp.y = 1.0f; this->subCamUp.z = 0.0f; @@ -861,7 +863,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { play->envCtx.screenFillColor[3] = 0; play->envCtx.fillScreen = false; this->unk_59C = 0; - this->subCamId = 0; + this->subCamId = SUB_CAM_ID_DONE; func_800B7298(play, &this->picto.actor, 6); CutsceneManager_Stop(this->csId); if (this->switchFlag >= 0) { @@ -871,6 +873,9 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { } } break; + + default: + break; } Math_ApproachF(&this->subCamEye.x, this->unk_5C8.x, 0.5f, this->unk_5E0); Math_ApproachF(&this->subCamEye.y, this->unk_5C8.y, 0.5f, this->unk_5E0); @@ -880,7 +885,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { Math_ApproachF(&this->subCamAt.z, this->unk_5D4.z, 0.5f, this->unk_5E0); Math_ApproachF(&this->unk_5E0, 10.0f, 0.5f, 100.0f); - if (this->subCamId != 0) { + if (this->subCamId != SUB_CAM_ID_DONE) { this->subCamUp.x = 0.0f; this->subCamUp.z = 0.0f; this->subCamUp.y = 1.0f; @@ -990,7 +995,8 @@ void func_80B8760C(EnKaizoku* this, PlayState* play) { this->skelAnime.playSpeed = 1.0f; temp_ft0 = this->skelAnime.curFrame - this->skelAnime.playSpeed; temp_ft1 = this->skelAnime.curFrame + this->skelAnime.playSpeed; - if (this->skelAnime.curFrame != 0.0f && ((temp_ft0 < 0 && temp_ft1 > 0) || (temp_ft0 < 5 && temp_ft1 >= 6))) { + if ((this->skelAnime.curFrame != 0.0f) && + (((temp_ft0 < 0) && (temp_ft1 > 0)) || ((temp_ft0 < 5) && (temp_ft1 >= 6)))) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_GERUDOFT_WALK); } @@ -1007,12 +1013,10 @@ void func_80B8760C(EnKaizoku* this, PlayState* play) { func_80B87E28(this); } } + } else if (this->picto.actor.speed >= 0.0f) { + this->picto.actor.shape.rot.y += 0x4000; } else { - if (this->picto.actor.speed >= 0.0f) { - this->picto.actor.shape.rot.y += 0x4000; - } else { - this->picto.actor.shape.rot.y -= 0x4000; - } + this->picto.actor.shape.rot.y -= 0x4000; } } @@ -1042,8 +1046,8 @@ void func_80B8798C(EnKaizoku* this, PlayState* play) { if (this->lookTimer == 0) { this->unk_2D8 = 0; temp_v0 = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; - if (ABS_ALT(temp_v0) <= 0x4000 && this->picto.actor.xzDistToPlayer < 40.0f && - fabsf(this->picto.actor.playerHeightRel) < 50.0f) { + if ((ABS_ALT(temp_v0) <= 0x4000) && (this->picto.actor.xzDistToPlayer < 40.0f) && + (fabsf(this->picto.actor.playerHeightRel) < 50.0f)) { if (func_800BE184(play, &this->picto.actor, 100.0f, 10000, 0x4000, this->picto.actor.shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { this->bodyCollider.base.acFlags &= ~AC_HARD; @@ -1068,7 +1072,7 @@ void func_80B8798C(EnKaizoku* this, PlayState* play) { this->bodyCollider.base.acFlags &= ~AC_HARD; func_80B88CD8(this); } - } else if (this->unk_2B2 == 0 && + } else if ((this->unk_2B2 == 0) && func_800BE184(play, &this->picto.actor, 100.0f, 10000, 0x4000, this->picto.actor.shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { this->bodyCollider.base.acFlags &= ~AC_HARD; @@ -1314,7 +1318,7 @@ void func_80B88378(EnKaizoku* this, PlayState* play) { } if (!func_80B85A00(this, play, false)) { - if (this->picto.actor.xzDistToPlayer < 210.0f && this->picto.actor.xzDistToPlayer > 150.0f && + if ((this->picto.actor.xzDistToPlayer < 210.0f) && (this->picto.actor.xzDistToPlayer > 150.0f) && Actor_IsFacingPlayer(&this->picto.actor, 0x1388)) { if (Actor_IsTargeted(play, &this->picto.actor)) { if (Rand_ZeroOne() > 0.5f) { @@ -1332,7 +1336,7 @@ void func_80B88378(EnKaizoku* this, PlayState* play) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); } - if ((this->skelAnime.curFrame != 0.0f) && ((sp30 < 0 && sp2C > 0) || (sp30 < 4 && sp2C >= 5))) { + if ((this->skelAnime.curFrame != 0.0f) && (((sp30 < 0) && (sp2C > 0)) || ((sp30 < 4) && (sp2C >= 5)))) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_GERUDOFT_WALK); } } @@ -1414,7 +1418,7 @@ void func_80B88964(EnKaizoku* this, PlayState* play) { } this->unk_2D8 = 0; - if (this->frameCount <= curFrame && this->unk_2D0 < 2) { + if ((this->frameCount <= curFrame) && (this->unk_2D0 < 2)) { if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) { func_80B872A4(this); this->unk_2B2 = Rand_ZeroOne() * 5.0f + 5.0f; @@ -1584,7 +1588,7 @@ void func_80B891B8(EnKaizoku* this) { // EnKaizoku_Stunned void func_80B89280(EnKaizoku* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) { - if (this->unk_2B8 != 0 && this->unk_2B8 < 60) { + if ((this->unk_2B8 != 0) && (this->unk_2B8 < 60)) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; } } @@ -1604,8 +1608,8 @@ void func_80B89280(EnKaizoku* this, PlayState* play) { this->unk_2D8 = 0; func_80B85A00(this, play, true); - if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX || - this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { + if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || + (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, ARRAY_COUNT(this->bodyPartsPos), 2, 0.7f, 0.4f); this->unk_2B8 = 0; @@ -1655,7 +1659,7 @@ void func_80B894C0(EnKaizoku* this, PlayState* play) { } } - if (this->picto.actor.xzDistToPlayer <= 65.0f && ((play->gameplayFrames % 8) != 0)) { + if ((this->picto.actor.xzDistToPlayer <= 65.0f) && ((play->gameplayFrames % 8) != 0)) { this->swordCollider.info.elemType = ELEMTYPE_UNK2; func_80B87F70(this); } else { @@ -1717,7 +1721,7 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) { if (curFrame >= 25.0f) { player = GET_PLAYER(play); - if (this->subCamId == 0) { + if (this->subCamId == SUB_CAM_ID_DONE) { if (!CutsceneManager_IsNext(this->csId)) { CutsceneManager_Queue(this->csId); return; @@ -1743,7 +1747,7 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) { player->actor.shape.rot.y = player->actor.world.rot.y = Math_Vec3f_Yaw(&player->actor.world.pos, &this->picto.actor.world.pos); - if (this->subCamId != 0) { + if (this->subCamId != SUB_CAM_ID_DONE) { this->subCamUp.x = 0.0f; this->subCamUp.y = 1.0f; this->subCamUp.z = 0.0f; @@ -1775,7 +1779,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { if (!(this->swordCollider.base.atFlags & AT_BOUNCED) && (this->swordCollider.base.atFlags & AT_HIT)) { if ((gSaveContext.save.saveInfo.playerData.health <= 0x10) && (this->action != KAIZOKU_ACTION_16)) { this->unk_2D0 = 2; - this->subCamId = 0; + this->subCamId = SUB_CAM_ID_DONE; this->picto.actor.flags |= ACTOR_FLAG_100000; if (!CutsceneManager_IsNext(this->csId)) { @@ -1793,7 +1797,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { if ((gSaveContext.save.saveInfo.playerData.health <= 0x10) && (this->action != KAIZOKU_ACTION_16)) { Health_ChangeBy(play, 0x10); this->unk_2D0 = 2; - this->subCamId = 0; + this->subCamId = SUB_CAM_ID_DONE; this->picto.actor.flags |= ACTOR_FLAG_100000; if (!CutsceneManager_IsNext(this->csId)) { @@ -1833,7 +1837,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { this->unk_2B8 = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_MEDIUM; } - /* fallthrough */ + // fallthrough case KAIZOKU_DMGEFF_1: if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || @@ -1908,6 +1912,9 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { sp64 = 1; } break; + + default: + break; } if (sp64) { @@ -2104,11 +2111,11 @@ void EnKaizoku_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* Matrix_MultVec3f(&sFootOffset, &this->rightFootPos); } - if (limbIndex == KAIZOKU_LIMB_02 || limbIndex == KAIZOKU_LIMB_06 || limbIndex == KAIZOKU_LIMB_07 || - limbIndex == KAIZOKU_LIMB_08 || limbIndex == KAIZOKU_LIMB_0A || limbIndex == KAIZOKU_LIMB_0C || - limbIndex == KAIZOKU_LIMB_0D || limbIndex == KAIZOKU_LIMB_0F || limbIndex == KAIZOKU_LIMB_11 || - limbIndex == KAIZOKU_LIMB_12 || limbIndex == KAIZOKU_LIMB_L_FOOT || limbIndex == KAIZOKU_LIMB_14 || - limbIndex == KAIZOKU_LIMB_15 || limbIndex == KAIZOKU_LIMB_R_FOOT || limbIndex == KAIZOKU_LIMB_17) { + if ((limbIndex == KAIZOKU_LIMB_02) || (limbIndex == KAIZOKU_LIMB_06) || (limbIndex == KAIZOKU_LIMB_07) || + (limbIndex == KAIZOKU_LIMB_08) || (limbIndex == KAIZOKU_LIMB_0A) || (limbIndex == KAIZOKU_LIMB_0C) || + (limbIndex == KAIZOKU_LIMB_0D) || (limbIndex == KAIZOKU_LIMB_0F) || (limbIndex == KAIZOKU_LIMB_11) || + (limbIndex == KAIZOKU_LIMB_12) || (limbIndex == KAIZOKU_LIMB_L_FOOT) || (limbIndex == KAIZOKU_LIMB_14) || + (limbIndex == KAIZOKU_LIMB_15) || (limbIndex == KAIZOKU_LIMB_R_FOOT) || (limbIndex == KAIZOKU_LIMB_17)) { Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsPosIndex]); this->bodyPartsPosIndex++; diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 73de78707a..86d74f69aa 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -157,7 +157,7 @@ void EnKakasi_Init(Actor* thisx, PlayState* play) { this->unkHeight = (this->picto.actor.world.rot.z * 20.0f) + 60.0f; this->picto.actor.world.rot.z = 0; this->picto.actor.targetMode = 0; - if (this->picto.actor.world.rot.x > 0 && this->picto.actor.world.rot.x < 8) { + if ((this->picto.actor.world.rot.x > 0) && (this->picto.actor.world.rot.x < 8)) { this->picto.actor.targetMode = KAKASI_GET_TARGETMODE(thisx); } this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y; @@ -208,12 +208,12 @@ s32 EnKakasi_ValidatePictograph(PlayState* play, Actor* thisx) { } void EnKakasi_CheckAnimationSfx(EnKakasi* this) { - if (this->animIndex == ENKAKASI_ANIM_SIDEWAYS_SHAKING || this->animIndex == ENKAKASI_ANIM_ARMS_CROSSED_STILL) { + if ((this->animIndex == ENKAKASI_ANIM_SIDEWAYS_SHAKING) || (this->animIndex == ENKAKASI_ANIM_ARMS_CROSSED_STILL)) { if (Animation_OnFrame(&this->skelanime, 1.0f) || Animation_OnFrame(&this->skelanime, 8.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EV_KAKASHI_SWING); } } - if (this->animIndex == ENKAKASI_ANIM_HOPPING_REGULAR || this->animIndex == ENKAKASI_ANIM_SLOWROLL) { + if ((this->animIndex == ENKAKASI_ANIM_HOPPING_REGULAR) || (this->animIndex == ENKAKASI_ANIM_SLOWROLL)) { if (Animation_OnFrame(&this->skelanime, 4.0f) || Animation_OnFrame(&this->skelanime, 8.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EV_KAKASHI_SWING); } @@ -225,7 +225,7 @@ void EnKakasi_CheckAnimationSfx(EnKakasi* this) { Actor_PlaySfx(&this->picto.actor, NA_SE_EV_KAKASHI_ROLL); } } - if (this->animIndex == ENKAKASI_ANIM_SPIN_REACH_OFFER || this->animIndex == ENKAKASI_ANIM_TWIRL) { + if ((this->animIndex == ENKAKASI_ANIM_SPIN_REACH_OFFER) || (this->animIndex == ENKAKASI_ANIM_TWIRL)) { if (Animation_OnFrame(&this->skelanime, 1.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EV_KAKASH_LONGI_ROLL); } @@ -274,12 +274,12 @@ void func_8096FAAC(EnKakasi* this, PlayState* play) { * goes off every frame of song teach, but... doing what? */ void func_8096FBB8(EnKakasi* this, PlayState* play) { - if (play->msgCtx.unk12048 == 0 || play->msgCtx.unk12048 == 1 || play->msgCtx.unk12048 == 2 || - play->msgCtx.unk12048 == 3 || play->msgCtx.unk12048 == 4) { + if ((play->msgCtx.unk12048 == 0) || (play->msgCtx.unk12048 == 1) || (play->msgCtx.unk12048 == 2) || + (play->msgCtx.unk12048 == 3) || (play->msgCtx.unk12048 == 4)) { // why not 0 < x < 4? fewer branches this->unk190++; } - if (this->unk190 != 0 && this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { + if ((this->unk190 != 0) && (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING)) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } if (this->unk190 > 8) { @@ -299,8 +299,8 @@ void EnKakasi_InitTimeSkipDialogue(EnKakasi* this) { void EnKakasi_TimeSkipDialogue(EnKakasi* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (gSaveContext.respawnFlag != -4 && gSaveContext.respawnFlag != -8) { - if (gSaveContext.save.time != CLOCK_TIME(6, 0) && gSaveContext.save.time != CLOCK_TIME(18, 0) && + if ((gSaveContext.respawnFlag != -4) && (gSaveContext.respawnFlag != -8)) { + if ((gSaveContext.save.time != CLOCK_TIME(6, 0)) && (gSaveContext.save.time != CLOCK_TIME(18, 0)) && !CHECK_EVENTINF(EVENTINF_17)) { if (this->picto.actor.textId == 0) { @@ -359,7 +359,7 @@ void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); this->skelanime.playSpeed = 2.0f; } - } else if (saveContextDay == 3 && gSaveContext.save.isNight) { + } else if ((saveContextDay == 3) && gSaveContext.save.isNight) { this->skelanime.playSpeed = 1.0f; if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { EnKakasi_ChangeAnim(this, 1); @@ -391,16 +391,16 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 5, 2000, 0); // if first dialogue - if (this->picto.actor.textId != 0x1644 && this->animeFrameCount <= currentAnimeFrame && - this->animIndex == ENKAKASI_ANIM_SLOWROLL) { + if ((this->picto.actor.textId != 0x1644) && (this->animeFrameCount <= currentAnimeFrame) && + (this->animIndex == ENKAKASI_ANIM_SLOWROLL)) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); this->unkCounter1A4 = 0; } // if dialogue: oh sorry come back again - if (this->picto.actor.textId == 0x1651 || this->picto.actor.textId == 0x1659) { - if (this->animeFrameCount <= currentAnimeFrame && this->animIndex != ENKAKASI_ANIM_SPIN_REACH_OFFER) { + if ((this->picto.actor.textId == 0x1651) || (this->picto.actor.textId == 0x1659)) { + if ((this->animeFrameCount <= currentAnimeFrame) && (this->animIndex != ENKAKASI_ANIM_SPIN_REACH_OFFER)) { if (++this->unkCounter1A4 >= 2) { this->unkCounter1A4 = 0; EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); @@ -408,7 +408,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { } } - if (this->unkState1A8 == 2 && this->unkState196 == 2) { + if ((this->unkState1A8 == 2) && (this->unkState196 == 2)) { func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_73); this->unkState1A8 = 0; } @@ -417,7 +417,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { Message_CloseTextbox(play); if (this->talkState == TEXT_STATE_5) { // bad song input - if (this->unkState196 == 2 && this->picto.actor.textId == 0x1647) { + if ((this->unkState196 == 2) && (this->picto.actor.textId == 0x1647)) { func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_END); } @@ -429,7 +429,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } - if (saveContextDay2 == 3 && gSaveContext.save.isNight) { + if ((saveContextDay2 == 3) && gSaveContext.save.isNight) { // text: dangerous outside this->picto.actor.textId = 0x164F; } else if (gSaveContext.save.isNight) { @@ -443,8 +443,8 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { Message_ContinueTextbox(play, this->picto.actor.textId); return; - } else if (this->picto.actor.textId == 0x165D || this->picto.actor.textId == 0x165F || - this->picto.actor.textId == 0x1660 || this->picto.actor.textId == 0x1652) { + } else if ((this->picto.actor.textId == 0x165D) || (this->picto.actor.textId == 0x165F) || + (this->picto.actor.textId == 0x1660) || (this->picto.actor.textId == 0x1652)) { func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_4); if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { CutsceneManager_Stop(CS_ID_GLOBAL_TALK); @@ -462,7 +462,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { } return; - } else if (this->picto.actor.textId == 0x1645 || this->picto.actor.textId == 0x164E) { + } else if ((this->picto.actor.textId == 0x1645) || (this->picto.actor.textId == 0x164E)) { this->picto.actor.textId = 0x1650; // "Shall we dance? No Yes" if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); @@ -517,7 +517,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { this->picto.actor.textId = 0x1658; } else if (this->picto.actor.textId == 0x165C) { this->picto.actor.textId = 0x165E; - } else if (saveContextDay == 3 && gSaveContext.save.isNight) { + } else if ((saveContextDay == 3) && gSaveContext.save.isNight) { this->picto.actor.textId = 0x164F; } else { this->picto.actor.textId = 0x1652; @@ -642,11 +642,12 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { void EnKakasi_PostSongLearnTwirl(EnKakasi* this, PlayState* play) { f32 animeFrame = this->skelanime.curFrame; - if (this->postTeachTimer == 0 && this->animIndex != ENKAKASI_ANIM_TWIRL) { + if ((this->postTeachTimer == 0) && (this->animIndex != ENKAKASI_ANIM_TWIRL)) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_TWIRL); this->skelanime.playSpeed = 2.0f; } - if (this->postTeachTimer == 0 && this->animIndex == ENKAKASI_ANIM_TWIRL && this->animeFrameCount <= animeFrame) { + if ((this->postTeachTimer == 0) && (this->animIndex == ENKAKASI_ANIM_TWIRL) && + (this->animeFrameCount <= animeFrame)) { EnKakasi_SetupPostSongLearnDialogue(this, play); } } @@ -682,16 +683,16 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { this->unk190 = 1; } - if (this->picto.actor.textId == 0x1648 && this->animIndex == ENKAKASI_ANIM_HOPPING_REGULAR && - this->animeFrameCount <= tempAnimFrame) { + if ((this->picto.actor.textId == 0x1648) && (this->animIndex == ENKAKASI_ANIM_HOPPING_REGULAR) && + (this->animeFrameCount <= tempAnimFrame)) { this->unkCounter1A4++; if (this->unkCounter1A4 >= 2) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); } } - if (this->picto.actor.textId == 0x164B && this->animIndex == ENKAKASI_ANIM_ARMS_CROSSED_ROCKING && - this->animeFrameCount <= tempAnimFrame) { + if ((this->picto.actor.textId == 0x164B) && (this->animIndex == ENKAKASI_ANIM_ARMS_CROSSED_ROCKING) && + (this->animeFrameCount <= tempAnimFrame)) { this->unkCounter1A4++; if (this->unkCounter1A4 >= 2) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); @@ -762,7 +763,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_TWIRL); } else { - if (this->picto.actor.textId == 0x164C || this->picto.actor.textId == 0x1661) { + if ((this->picto.actor.textId == 0x164C) || (this->picto.actor.textId == 0x1661)) { EnKakasi_SetupDigAway(this); return; } @@ -797,7 +798,7 @@ void EnKakasi_DancingRemark(EnKakasi* this, PlayState* play) { } else { CutsceneManager_StartWithPlayerCs(this->csIdList[0], &this->picto.actor); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); - if (currentDay == 3 && gSaveContext.save.isNight) { + if ((currentDay == 3) && gSaveContext.save.isNight) { EnKakasi_SetupDigAway(this); } else { Audio_PlaySubBgm(NA_BGM_SARIAS_SONG); @@ -833,15 +834,14 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { Math_Vec3f_Copy(&localVec3f, &this->subCamEyeNext); OLib_Vec3fAdd(&this->picto.actor.home, &localVec3f, &this->subCamEyeNext, OLIB_ADD_OFFSET); - if (1) {} this->subCamAtNext.x = D_80971EEC[this->unk190].x + this->unk22C.x; this->subCamAtNext.y = D_80971EEC[this->unk190].y + this->unk22C.y; this->subCamAtNext.z = D_80971EEC[this->unk190].z + this->unk22C.z; - if (this->unk190 != 6 && this->unk190 != 7) { + if ((this->unk190 != 6) && (this->unk190 != 7)) { Math_Vec3f_Copy(&this->subCamEye, &this->subCamEyeNext); Math_Vec3f_Copy(&this->subCamAt, &this->subCamAtNext); } - if (this->unk190 >= 7 && this->unk190 != 0xE) { + if ((this->unk190 >= 7) && (this->unk190 != 0xE)) { this->picto.actor.shape.rot.y += 0x800; } @@ -853,57 +853,64 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { // twirling this->unk204 = 0x28; this->unk190++; - return; + break; + case 1: // end of twirl, start shaking back and forth - if (this->unk204 == 0 && this->animeFrameCount <= currentFrame) { + if ((this->unk204 == 0) && (this->animeFrameCount <= currentFrame)) { this->unk204 = 0x14; this->unk190++; EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); } - return; + break; + case 2: // camera view on the left if (this->unk204 == 0) { this->unk204 = 0x14; this->unk190++; } - return; + break; + case 3: // camera view on the right if (this->unk204 == 0) { this->unk204 = 0x14; this->unk190++; } - return; + break; + case 4: // camera view close up front if (this->unk204 == 0) { this->unk204 = 0x14; this->unk190++; } - return; + break; + case 5: // camera view zoomed out front if (this->unk204 == 0) { this->unk204 = 0xF; this->unk190++; } - return; + break; + case 6: // zoom in and sweep down in from case 5 if (this->unk204 == 0) { this->unk204 = 0xF; this->unk190++; } - return; + break; + case 7: // zoom in close from case 6 if (this->unk204 == 0) { this->unk204 = 0xA; this->unk190++; } - return; + break; case 8: case 9: @@ -921,7 +928,8 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { this->unk204 = 0x14; } } - return; + break; + case 14: // goes off once for some camera changes, // otherwise it's the end when camera is back to normal and Player is confused @@ -933,10 +941,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B), &player->unk_3C0, player->unk_3CC); func_80169EFC(&play->state); - //! FAKE - if (1) {} - - if (gSaveContext.save.time > CLOCK_TIME(18, 0) || gSaveContext.save.time < CLOCK_TIME(6, 0)) { + if ((gSaveContext.save.time > CLOCK_TIME(18, 0)) || (gSaveContext.save.time < CLOCK_TIME(6, 0))) { gSaveContext.save.time = CLOCK_TIME(6, 0); gSaveContext.respawnFlag = -4; SET_EVENTINF(EVENTINF_27); @@ -948,6 +953,10 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { this->unk190 = 0; this->actionFunc = EnKakasi_DoNothing; } + break; + + default: + break; } } @@ -1031,8 +1040,8 @@ void EnKakasi_SetupIdleUnderground(EnKakasi* this) { } void EnKakasi_IdleUnderground(EnKakasi* this, PlayState* play) { - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_08) && this->picto.actor.xzDistToPlayer < this->songSummonDist && - (BREG(1) != 0 || play->msgCtx.ocarinaMode == 0xD)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_79_08) && (this->picto.actor.xzDistToPlayer < this->songSummonDist) && + ((BREG(1) != 0) || (play->msgCtx.ocarinaMode == 0xD))) { this->picto.actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; play->msgCtx.ocarinaMode = 4; this->actionFunc = EnKakasi_SetupRiseOutOfGround; @@ -1119,7 +1128,7 @@ void EnKakasi_Update(Actor* thisx, PlayState* play) { DECR(this->unk204); if (this->unkState196 != 5) { - if (this->unk1BC.x != 0.0f || this->unk1BC.z != 0.0f) { + if ((this->unk1BC.x != 0.0f) || (this->unk1BC.z != 0.0f)) { Math_Vec3f_Copy(&this->picto.actor.focus.pos, &this->unk1BC); this->picto.actor.focus.pos.y += 10.0f; if (this->subCamId == SUB_CAM_ID_DONE) { diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c index ea7faef574..fbb8346e5f 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c @@ -159,7 +159,7 @@ void func_80B2654C(EnKendoJs* this, PlayState* play) { s32 phi_v0; s32 sp30; - if (Actor_ProcessTalkRequest(&this->actor, &play->state) != 0) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (CURRENT_DAY != 0) { sp30 = CURRENT_DAY - 1; } else { diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c index dd26ba1728..e80807b088 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c @@ -72,7 +72,7 @@ void EnKgy_Init(Actor* thisx, PlayState* play) { this->actionFunc = func_80B419B0; this->actor.textId = 0xC4E; this->unk_29C |= 1; - this->unk_2EA = 3; + this->getItemId = GI_RUPEE_10; } else { EnKgy_ChangeAnim(this, 4, ANIMMODE_LOOP, 0); this->actionFunc = func_80B42714; @@ -420,12 +420,12 @@ void func_80B4163C(EnKgy* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->unk_2D2 == 6) { - if (this->unk_2EA > 0) { + if (this->getItemId > GI_NONE) { EnKgy_ChangeAnim(this, 6, ANIMMODE_ONCE, 0.0f); - this->unk_2EA--; + this->getItemId--; } else { EnKgy_ChangeAnim(this, 9, ANIMMODE_ONCE, -5.0f); - this->unk_2EA = (s32)Rand_ZeroFloat(3.0f) + 2; + this->getItemId = (s32)Rand_ZeroFloat(GI_RUPEE_PURPLE - GI_RUPEE_BLUE) + GI_RUPEE_BLUE; } } else { EnKgy_ChangeAnim(this, 6, ANIMMODE_ONCE, -5.0f); @@ -598,7 +598,7 @@ void func_80B41D64(EnKgy* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_10000; func_800B8500(&this->actor, play, 1000.0f, 1000.0f, PLAYER_IA_MINUS1); } else { - Actor_OfferGetItem(&this->actor, play, this->unk_2EA, 2000.0f, 1000.0f); + Actor_OfferGetItem(&this->actor, play, this->getItemId, 2000.0f, 1000.0f); } func_80B40EE8(this, play); } @@ -790,16 +790,16 @@ void func_80B41E18(EnKgy* this, PlayState* play) { case 0xC50: if (func_80B40D8C(play)) { - this->unk_2EA = 57; + this->getItemId = GI_SWORD_GILDED; this->actor.textId = 0xC53; } else { - this->unk_2EA = 56; + this->getItemId = GI_SWORD_RAZOR; this->actor.textId = 0xC51; } Message_CloseTextbox(play); this->actionFunc = func_80B41D64; func_80B413C8(this); - Actor_OfferGetItem(&this->actor, play, this->unk_2EA, 2000.0f, 1000.0f); + Actor_OfferGetItem(&this->actor, play, this->getItemId, 2000.0f, 1000.0f); break; case 0xC51: diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h index 8207678fd2..94f2aabd56 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.h @@ -31,7 +31,7 @@ typedef struct EnKgy { /* 0x2E4 */ s16 unk_2E4; /* 0x2E6 */ s16 unk_2E6; /* 0x2E8 */ s16 unk_2E8; - /* 0x2EA */ s16 unk_2EA; + /* 0x2EA */ s16 getItemId; /* 0x2EC */ LightInfo lightInfo; /* 0x2FC */ LightNode* lightNode; /* 0x300 */ s16 unk_300; diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c index 7fb2a13a32..44bb67443b 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -252,7 +252,7 @@ void EnMa4_RunInCircles(EnMa4* this, PlayState* play) { s32 pad; s16 sp2E; - if (sAnimIndex != 9 && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + if ((sAnimIndex != 9) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { if (sAnimIndex == 3) { if (D_80AC0250 < 3) { D_80AC0250++; @@ -268,7 +268,7 @@ void EnMa4_RunInCircles(EnMa4* this, PlayState* play) { } } - if (sAnimIndex == 13 && Animation_OnFrame(&this->skelAnime, 37.0f)) { + if ((sAnimIndex == 13) && Animation_OnFrame(&this->skelAnime, 37.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_ROMANI_BOW_FLICK); } @@ -291,7 +291,7 @@ void EnMa4_RunInCircles(EnMa4* this, PlayState* play) { } } - if (this->pathIndex < this->pathPointsCount - 1) { + if (this->pathIndex < (this->pathPointsCount - 1)) { this->pathIndex++; } else { this->pathIndex = 0; @@ -345,7 +345,7 @@ void EnMa4_Wait(EnMa4* this, PlayState* play) { } } - if (Actor_ProcessTalkRequest(&this->actor, &play->state) != 0) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { EnMa4_StartDialogue(this, play); EnMa4_SetupDialogueHandler(this); } else if (this->type != MA4_TYPE_ALIENS_WON || ABS_ALT(yaw) < 0x4000) { @@ -483,6 +483,9 @@ void EnMa4_HandlePlayerChoice(EnMa4* this, PlayState* play) { func_80151BB4(play, 5); } break; + + default: + break; } } } @@ -614,6 +617,9 @@ void EnMa4_ChooseNextDialogue(EnMa4* this, PlayState* play) { this->textId = 0x3359; } break; + + default: + break; } } } @@ -629,9 +635,6 @@ void EnMa4_SetupDialogueHandler(EnMa4* this) { void EnMa4_DialogueHandler(EnMa4* this, PlayState* play) { switch (Message_GetState(&play->msgCtx)) { - default: - break; - case TEXT_STATE_CHOICE: // Player answered a question EnMa4_HandlePlayerChoice(this, play); break; @@ -652,6 +655,9 @@ void EnMa4_DialogueHandler(EnMa4* this, PlayState* play) { case TEXT_STATE_CLOSING: case TEXT_STATE_3: break; + + default: + break; } if (this->type != MA4_TYPE_ALIENS_WON) { @@ -818,12 +824,15 @@ void EnMa4_EponasSongCs(EnMa4* this, PlayState* play) { this->hasBow = false; EnMa4_ChangeAnim(this, 4); break; + + default: + break; } } } Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); - if (sCueId == 2 && this->animTimer == 0 && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + if ((sCueId == 2) && (this->animTimer == 0) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { EnMa4_ChangeAnim(this, 7); } } else { @@ -845,7 +854,7 @@ void EnMa4_EndEponasSongCs(EnMa4* this, PlayState* play) { Player* player = GET_PLAYER(play); this->actor.flags |= ACTOR_FLAG_10000; - if (Actor_ProcessTalkRequest(&this->actor, &play->state) != 0) { + if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { player->stateFlags1 &= ~PLAYER_STATE1_20; Message_StartTextbox(play, 0x334C, &this->actor); this->textId = 0x334C; @@ -1054,7 +1063,9 @@ void EnMa4_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, } else if (limbIndex == ROMANI_LIMB_LEFT_HAND) { if (this->hasBow == true) { OPEN_DISPS(play->state.gfxCtx); + gSPDisplayList(POLY_OPA_DISP++, gRomaniBowDL); + CLOSE_DISPS(play->state.gfxCtx); } } @@ -1064,6 +1075,7 @@ void EnMa4_Draw(Actor* thisx, PlayState* play) { EnMa4* this = THIS; OPEN_DISPS(play->state.gfxCtx); + if (this->type == MA4_TYPE_ALIENS_WON) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gRomaniWoodenBoxDL); diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c index 89ee4aada8..00281d6e42 100644 --- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c +++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c @@ -153,7 +153,7 @@ void EnMaYto_Init(Actor* thisx, PlayState* play) { this->unk320 = 0; this->eyeTexIndex = 0; - if (CURRENT_DAY == 1 || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + if ((CURRENT_DAY == 1) || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { EnMaYto_SetFaceExpression(this, 0, 1); } else { EnMaYto_SetFaceExpression(this, 5, 2); @@ -186,13 +186,13 @@ void EnMaYto_Init(Actor* thisx, PlayState* play) { s32 EnMaYto_CheckValidSpawn(EnMaYto* this, PlayState* play) { switch (this->type) { case MA_YTO_TYPE_DEFAULT: - if (CURRENT_DAY == 3 && !CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + if ((CURRENT_DAY == 3) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { return false; } break; case MA_YTO_TYPE_DINNER: - if (CURRENT_DAY != 1 && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + if ((CURRENT_DAY != 1) && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { return false; } break; @@ -205,7 +205,7 @@ s32 EnMaYto_CheckValidSpawn(EnMaYto* this, PlayState* play) { } else if (((this->actor.params & 0x0F00) >> 8) == 0) { return false; } - if (gSaveContext.save.time >= CLOCK_TIME(20, 0) && CURRENT_DAY == 3) { + if ((gSaveContext.save.time >= CLOCK_TIME(20, 0)) && (CURRENT_DAY == 3)) { return false; } break; @@ -218,6 +218,7 @@ s32 EnMaYto_CheckValidSpawn(EnMaYto* this, PlayState* play) { break; case MA_YTO_TYPE_4: + default: break; } @@ -304,8 +305,8 @@ s32 EnMaYto_SearchRomani(EnMaYto* this, PlayState* play) { EnMaYts* romani = (EnMaYts*)npcActor; s16 romaniType = EN_MA_YTS_GET_TYPE(&romani->actor); - if ((this->type == MA_YTO_TYPE_DINNER && romaniType == MA_YTS_TYPE_SITTING) || - (this->type == MA_YTO_TYPE_BARN && romaniType == MA_YTS_TYPE_BARN)) { + if (((this->type == MA_YTO_TYPE_DINNER) && (romaniType == MA_YTS_TYPE_SITTING)) || + ((this->type == MA_YTO_TYPE_BARN) && (romaniType == MA_YTS_TYPE_BARN))) { this->actor.child = &romani->actor; romani->actor.parent = &this->actor; return true; @@ -394,8 +395,8 @@ void EnMaYto_DefaultWait(EnMaYto* this, PlayState* play) { s16 direction; direction = rotY - this->actor.yawTowardsPlayer; - if (Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 5, 0x3000, 0x100) == 0 && - this->animIndex == 1) { + if (!Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 5, 0x3000, 0x100) && + (this->animIndex == 1)) { this->animIndex = 11; EnMaYto_ChangeAnim(this, 11); } @@ -439,7 +440,7 @@ void EnMaYto_DefaultDialogueHandler(EnMaYto* this, PlayState* play) { } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x3000, 0x100); - if (this->textId == 0x3395 && this->skelAnime.animation == &gCremiaSpreadArmsStartAnim && + if ((this->textId == 0x3395) && (this->skelAnime.animation == &gCremiaSpreadArmsStartAnim) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { EnMaYto_ChangeAnim(this, 4); } @@ -490,12 +491,15 @@ void EnMaYto_DefaultChooseNextDialogue(EnMaYto* this, PlayState* play) { this->textId = 0x3396; func_80151BB4(play, 6); break; + + default: + break; } } } void EnMaYto_SetupDinnerWait(EnMaYto* this) { - if (CURRENT_DAY == 1 || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + if ((CURRENT_DAY == 1) || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { func_80B90E50(this, 0); this->unk31E = 0; } else { @@ -516,7 +520,7 @@ void EnMaYto_DinnerWait(EnMaYto* this, PlayState* play) { } else { Actor* child = this->actor.child; - if (child != NULL && Actor_ProcessTalkRequest(child, &play->state)) { + if ((child != NULL) && Actor_ProcessTalkRequest(child, &play->state)) { Actor_ChangeFocus(&this->actor, play, &this->actor); EnMaYto_DinnerStartDialogue(this, play); EnMaYto_SetupDinnerDialogueHandler(this); @@ -524,7 +528,7 @@ void EnMaYto_DinnerWait(EnMaYto* this, PlayState* play) { func_800B8614(&this->actor, play, 120.0f); child = this->actor.child; - if (child != NULL && CURRENT_DAY != 2) { + if ((child != NULL) && (CURRENT_DAY != 2)) { s16 childDirection = child->shape.rot.y - child->yawTowardsPlayer; if (ABS_ALT(childDirection) < 0x4000) { @@ -536,7 +540,7 @@ void EnMaYto_DinnerWait(EnMaYto* this, PlayState* play) { } void EnMaYto_SetupDinnerDialogueHandler(EnMaYto* this) { - if (CURRENT_DAY == 1 || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + if ((CURRENT_DAY == 1) || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { func_80B90E50(this, 1); } else { func_80B90E50(this, 2); @@ -682,12 +686,15 @@ void EnMaYto_DinnerChooseNextDialogue(EnMaYto* this, PlayState* play) { this->textId = 0x33A8; func_80151BB4(play, 6); break; + + default: + break; } } } void EnMaYto_SetupBarnWait(EnMaYto* this) { - if (CURRENT_DAY == 1 || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + if ((CURRENT_DAY == 1) || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { EnMaYto_ChangeAnim(this, 13); func_80B90E50(this, 0); this->unk31E = 0; @@ -711,11 +718,11 @@ void EnMaYto_BarnWait(EnMaYto* this, PlayState* play) { } else { Actor* child = this->actor.child; - if (child != NULL && Actor_ProcessTalkRequest(child, &play->state)) { + if ((child != NULL) && Actor_ProcessTalkRequest(child, &play->state)) { Actor_ChangeFocus(&this->actor, play, &this->actor); EnMaYto_BarnStartDialogue(this, play); EnMaYto_SetupBarnDialogueHandler(this); - } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01) || ABS_ALT(direction) < 0x2000) { + } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01) || (ABS_ALT(direction) < 0x2000)) { func_800B8614(&this->actor, play, 100.0f); child = this->actor.child; @@ -727,7 +734,7 @@ void EnMaYto_BarnWait(EnMaYto* this, PlayState* play) { } void EnMaYto_SetupBarnDialogueHandler(EnMaYto* this) { - if (CURRENT_DAY == 1 || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + if ((CURRENT_DAY == 1) || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { func_80B90E50(this, 1); } else { func_80B90E50(this, 2); @@ -948,6 +955,9 @@ void EnMaYto_AfterMilkRunChooseNextDialogue(EnMaYto* this, PlayState* play) { EnMaYto_SetupPostMilkRunGiveReward(this); EnMaYto_PostMilkRunGiveReward(this, play); break; + + default: + break; } } } @@ -1047,12 +1057,15 @@ void EnMaYto_WarmFuzzyFeelingCs(EnMaYto* this, PlayState* play) { case 3: EnMaYto_ChangeAnim(this, 22); break; + + default: + break; } } } Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); - if (sCueId == 2 && this->skelAnime.animation == &gCremiaHugStartAnim && + if ((sCueId == 2) && (this->skelAnime.animation == &gCremiaHugStartAnim) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { EnMaYto_ChangeAnim(this, 20); } @@ -1066,14 +1079,14 @@ void EnMaYto_SetupPostMilkRunWaitDialogueEnd(EnMaYto* this) { } void EnMaYto_PostMilkRunWaitDialogueEnd(EnMaYto* this, PlayState* play) { - if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE || Message_GetState(&play->msgCtx) == TEXT_STATE_5) { - if (Message_ShouldAdvance(play) && Message_GetState(&play->msgCtx) == TEXT_STATE_5) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) || (Message_GetState(&play->msgCtx) == TEXT_STATE_5)) { + if (Message_ShouldAdvance(play) && (Message_GetState(&play->msgCtx) == TEXT_STATE_5)) { func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT); Message_CloseTextbox(play); } } - if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE && play->msgCtx.unk120B1 == 0) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) && (play->msgCtx.unk120B1 == 0)) { EnMaYto_SetupPostMilkRunEnd(this); } } @@ -1096,7 +1109,7 @@ void EnMaYto_PostMilkRunEnd(EnMaYto* this, PlayState* play) { void EnMaYto_DefaultStartDialogue(EnMaYto* this, PlayState* play) { if (CURRENT_DAY == 1) { - if (Player_GetMask(play) != PLAYER_MASK_NONE && gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { + if ((Player_GetMask(play) != PLAYER_MASK_NONE) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { switch (Player_GetMask(play)) { case PLAYER_MASK_ROMANI: Message_StartTextbox(play, 0x235D, &this->actor); @@ -1155,7 +1168,7 @@ void EnMaYto_DefaultStartDialogue(EnMaYto* this, PlayState* play) { void EnMaYto_DinnerStartDialogue(EnMaYto* this, PlayState* play) { switch (CURRENT_DAY) { case 1: - if (Player_GetMask(play) != PLAYER_MASK_NONE && gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { + if ((Player_GetMask(play) != PLAYER_MASK_NONE) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { switch (Player_GetMask(play)) { case PLAYER_MASK_ROMANI: Message_StartTextbox(play, 0x235D, &this->actor); @@ -1217,6 +1230,9 @@ void EnMaYto_DinnerStartDialogue(EnMaYto* this, PlayState* play) { this->textId = 0x33A7; } break; + + default: + break; } } @@ -1324,7 +1340,7 @@ void EnMaYto_UpdateEyes(EnMaYto* this) { void func_80B90E50(EnMaYto* this, s16 arg1) { EnMaYts* romani = (EnMaYts*)this->actor.child; - if (romani != NULL && romani->actor.id == ACTOR_EN_MA_YTS) { + if ((romani != NULL) && (romani->actor.id == ACTOR_EN_MA_YTS)) { romani->unk_32C = arg1; } } @@ -1344,7 +1360,7 @@ void EnMaYto_SetFaceExpression(EnMaYto* this, s16 overrideEyeTexIndex, s16 mouth } void EnMaYto_InitFaceExpression(EnMaYto* this) { - if (CURRENT_DAY == 1 || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + if ((CURRENT_DAY == 1) || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { EnMaYto_SetFaceExpression(this, 0, 1); EnMaYto_SetRomaniFaceExpression(this, 0, 0); } else { @@ -1372,27 +1388,33 @@ s32 EnMaYto_HasSpokenToPlayerToday(void) { return true; } break; + + default: + break; } return false; } s32 EnMaYto_HasSpokenToPlayer(void) { - // Please note no case here has a `break`. switch (CURRENT_DAY) { case 3: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_10)) { return true; } - + // fallthrough case 2: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_08)) { return true; } - + // fallthrough case 1: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_13_04)) { return true; } + break; + + default: + break; } return false; } @@ -1410,6 +1432,9 @@ void EnMaYto_SetTalkedFlag(void) { case 3: SET_WEEKEVENTREG(WEEKEVENTREG_13_10); break; + + default: + break; } } @@ -1458,7 +1483,8 @@ void EnMaYto_Draw(Actor* thisx, PlayState* play) { s32 pad; OPEN_DISPS(play->state.gfxCtx); - if (this->type == MA_YTO_TYPE_BARN && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + + if ((this->type == MA_YTO_TYPE_BARN) && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gCremiaWoodenBoxDL); } diff --git a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c index 8eacc79626..163f89fcda 100644 --- a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c +++ b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c @@ -123,7 +123,7 @@ void func_80B8D12C(EnMaYts* this, PlayState* play) { Player* player = GET_PLAYER(play); s16 trackingMode = (this->unk_32C == 2) ? NPC_TRACKING_NONE : NPC_TRACKING_PLAYER_AUTO_TURN; - if (this->unk_32C == 0 || this->actor.parent == NULL) { + if ((this->unk_32C == 0) || (this->actor.parent == NULL)) { this->interactInfo.trackPos = player->actor.world.pos; this->interactInfo.trackPos.y -= -10.0f; } else { @@ -144,7 +144,7 @@ void EnMaYts_InitAnimation(EnMaYts* this, PlayState* play) { case MA_YTS_TYPE_SITTING: this->actor.targetMode = 6; // Day 1 or "Winning" the alien invasion - if (CURRENT_DAY == 1 || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + if ((CURRENT_DAY == 1) || CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { EnMaYts_ChangeAnim(this, 14); } else { EnMaYts_ChangeAnim(this, 18); @@ -188,6 +188,9 @@ s32 EnMaYts_CheckValidSpawn(EnMaYts* this, PlayState* play) { return false; } break; + + default: + break; } break; @@ -195,7 +198,7 @@ s32 EnMaYts_CheckValidSpawn(EnMaYts* this, PlayState* play) { // Failing the alien invasion if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { return false; - } else if (gSaveContext.save.time >= CLOCK_TIME(20, 0) && CURRENT_DAY == 3) { + } else if ((gSaveContext.save.time >= CLOCK_TIME(20, 0)) && (CURRENT_DAY == 3)) { return false; } break; @@ -209,6 +212,9 @@ s32 EnMaYts_CheckValidSpawn(EnMaYts* this, PlayState* play) { case MA_YTS_TYPE_ENDCREDITS: break; + + default: + break; } return true; @@ -266,7 +272,7 @@ void EnMaYts_Init(Actor* thisx, PlayState* play) { this->mouthTexIndex = 0; this->unk_32C = 2; EnMaYts_SetupEndCreditsHandler(this); - } else if (CURRENT_DAY == 2 && gSaveContext.save.isNight == 1 && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { + } else if ((CURRENT_DAY == 2) && (gSaveContext.save.isNight == 1) && CHECK_WEEKEVENTREG(WEEKEVENTREG_22_01)) { EnMaYts_SetupStartDialogue(this); } else { EnMaYts_SetupDoNothing(this); @@ -406,6 +412,9 @@ void EnMaYts_EndCreditsHandler(EnMaYts* this, PlayState* play) { this->hasBow = true; EnMaYts_ChangeAnim(this, 20); break; + + default: + break; } } } @@ -526,7 +535,9 @@ void EnMaYts_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro } else if (limbIndex == ROMANI_LIMB_LEFT_HAND) { if (this->hasBow == true) { OPEN_DISPS(play->state.gfxCtx); + gSPDisplayList(POLY_OPA_DISP++, gRomaniBowDL); + CLOSE_DISPS(play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c index e7941a4d5f..315bc1ffd9 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -608,9 +608,11 @@ void EnMinifrog_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* if ((limbIndex == 7) || (limbIndex == 8)) { OPEN_DISPS(play->state.gfxCtx); + Matrix_ReplaceRotation(&play->billboardMtxF); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Muto/z_en_muto.c b/src/overlays/actors/ovl_En_Muto/z_en_muto.c index 441c27cdc6..6eceb89d61 100644 --- a/src/overlays/actors/ovl_En_Muto/z_en_muto.c +++ b/src/overlays/actors/ovl_En_Muto/z_en_muto.c @@ -74,7 +74,7 @@ void EnMuto_Init(Actor* thisx, PlayState* play) { this->textIdIndex = 3; } - if (gSaveContext.save.day != 3 || !gSaveContext.save.isNight) { + if ((gSaveContext.save.day != 3) || !gSaveContext.save.isNight) { Actor_Kill(&this->actor); } } else { @@ -113,7 +113,7 @@ void EnMuto_SetHeadRotation(EnMuto* this) { s32 yawRotToTarget = ABS_ALT(BINANG_SUB(this->yawTowardsTarget, this->actor.world.rot.y)); this->headRotTarget.y = 0; - if (this->actor.xzDistToPlayer < 200.0f && yawRotToTarget < 0x4E20) { + if ((this->actor.xzDistToPlayer < 200.0f) && (yawRotToTarget < 0x4E20)) { this->headRotTarget.y = BINANG_SUB(this->yawTowardsTarget, this->actor.world.rot.y); if (this->headRotTarget.y > 0x2710) { this->headRotTarget.y = 0x2710; @@ -146,7 +146,7 @@ void EnMuto_Idle(EnMuto* this, PlayState* play) { if (1) {} // Needed to match - if (!this->isInMayorsRoom && Player_GetMask(play) == PLAYER_MASK_KAFEIS_MASK) { + if (!this->isInMayorsRoom && (Player_GetMask(play) == PLAYER_MASK_KAFEIS_MASK)) { this->actor.textId = 0x2363; } @@ -229,8 +229,8 @@ void EnMuto_InDialogue(EnMuto* this, PlayState* play) { } } - if (play->msgCtx.currentTextId == 0x2AC6 || play->msgCtx.currentTextId == 0x2AC7 || - play->msgCtx.currentTextId == 0x2AC8) { + if ((play->msgCtx.currentTextId == 0x2AC6) || (play->msgCtx.currentTextId == 0x2AC7) || + (play->msgCtx.currentTextId == 0x2AC8)) { this->skelAnime.playSpeed = 0.0f; this->yawTowardsTarget = this->actor.yawTowardsPlayer; this->skelAnime.curFrame = 30.0f; @@ -254,7 +254,7 @@ void EnMuto_Update(Actor* thisx, PlayState* play2) { EnMuto_SetHeadRotation(this); } - if (this->isInMayorsRoom && gSaveContext.save.day == 3 && gSaveContext.save.isNight) { + if (this->isInMayorsRoom && (gSaveContext.save.day == 3) && gSaveContext.save.isNight) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 9f364c2c6a..03cdad42ce 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -188,6 +188,7 @@ void EnNiw_AnimateWingHead(EnNiw* this, PlayState* play, s16 animationState) { this->targetLimbRots[2] = 0.0f; // both wingRotZ this->targetLimbRots[1] = 0.0f; break; + case NIW_ANIM_HEAD_PECKING: this->unkTimer24E = 3; this->targetLimbRots[2] = 7000.0f * tempOne; // both wingRotZ @@ -235,6 +236,9 @@ void EnNiw_AnimateWingHead(EnNiw* this, PlayState* play, s16 animationState) { this->targetLimbRots[7] = 10000.0f; } break; + + default: + break; } } @@ -271,7 +275,7 @@ void EnNiw_SpawnAttackNiw(EnNiw* this, PlayState* play) { Vec3f newNiwPos; Actor* attackNiw; - if (this->attackNiwSpawnTimer == 0 && this->attackNiwCount < 7) { + if ((this->attackNiwSpawnTimer == 0) && (this->attackNiwCount < 7)) { xView = play->view.at.x - play->view.eye.x; yView = play->view.at.y - play->view.eye.y; zView = play->view.at.z - play->view.eye.z; @@ -312,7 +316,7 @@ void EnNiw_UpdateRunning(EnNiw* this, PlayState* play, s32 isStormCucco) { runningDirection = -runningAngles[isStormCucco]; } - if (isStormCucco == true && (this->runAwayTimer == 0 || (this->actor.bgCheckFlags & BGCHECKFLAG_WALL))) { + if ((isStormCucco == true) && ((this->runAwayTimer == 0) || (this->actor.bgCheckFlags & BGCHECKFLAG_WALL))) { this->runAwayTimer = 150; if (this->yawTimer == 0) { this->yawTimer = 70; @@ -367,7 +371,7 @@ void EnNiw_Idle(EnNiw* this, PlayState* play) { Math_ApproachF(&this->targetLimbRots[9], sHeadRotations[this->headRotationToggle], 0.5f, 4000.0f); // head rot } - if (this->unkIdleTimer2 == 0 && this->unkIdleTimer == 0) { + if ((this->unkIdleTimer2 == 0) && (this->unkIdleTimer == 0)) { this->unk298++; if (this->unk298 > 7) { this->unkIdleTimer2 = Rand_ZeroFloat(30.0f); @@ -469,14 +473,14 @@ void EnNiw_Held(EnNiw* this, PlayState* play) { void EnNiw_Thrown(EnNiw* this, PlayState* play) { if (this->unk2EC == 0) { - if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->unk2EC = 1; - this->hoppingTimer = 80; // hop timer - this->actor.speed = 0.0f; - this->actor.velocity.y = 4.0f; - } else { - return; // wait until back on floor + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + // wait until back on floor + return; } + this->unk2EC = 1; + this->hoppingTimer = 80; + this->actor.speed = 0.0f; + this->actor.velocity.y = 4.0f; } else { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->sfxTimer1 = 0; @@ -683,10 +687,10 @@ void EnNiw_LandBeforeIdle(EnNiw* this, PlayState* play) { } void EnNiw_CheckRage(EnNiw* this, PlayState* play) { - if (!this->isStormActive && this->iframeTimer == 0 && this->niwType == NIW_TYPE_REGULAR) { + if (!this->isStormActive && (this->iframeTimer == 0) && (this->niwType == NIW_TYPE_REGULAR)) { // is this used? this is before we even know if we've been hit - if (this->niwState != NIW_STATE_RUNNING && this->unk2BC.x != 90000.0f) { + if ((this->niwState != NIW_STATE_RUNNING) && (this->unk2BC.x != 90000.0f)) { this->iframeTimer = 10; this->sfxTimer1 = 30; this->unk29E = 1; @@ -703,7 +707,7 @@ void EnNiw_CheckRage(EnNiw* this, PlayState* play) { this->actor.colChkInfo.health--; } - if (!sCuccoStormActive && this->actor.colChkInfo.health == 0) { + if (!sCuccoStormActive && (this->actor.colChkInfo.health == 0)) { this->runAwayTimer = 100; // main cucco will run away after storm starts sCuccoStormActive = true; this->unk298 = 0; @@ -774,7 +778,7 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { pos.z = randPlusMinusPoint5Scaled(10.0f) + this->actor.world.pos.z; featherScale = Rand_ZeroFloat(6.0f) + 6.0f; - if (this->unk29E == 2 && this->unk308 != 0) { + if ((this->unk29E == 2) && (this->unk308 != 0)) { pos.y += 10.0f; } @@ -817,7 +821,7 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); // if cucco is off the map - if (this->actor.floorHeight <= BGCHECK_Y_MIN || this->actor.floorHeight >= BGCHECK_Y_MAX) { + if ((this->actor.floorHeight <= BGCHECK_Y_MIN) || (this->actor.floorHeight >= BGCHECK_Y_MAX)) { Vec3f viewAtToEye; // Direction vector for the direction the camera is facing @@ -881,12 +885,12 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { return; } - if (this->isStormActive && (this->actor.xyzDistToPlayerSq < SQ(dist)) && player->invincibilityTimer == 0) { + if (this->isStormActive && (this->actor.xyzDistToPlayerSq < SQ(dist)) && (player->invincibilityTimer == 0)) { func_800B8D50(play, &this->actor, 2.0f, this->actor.world.rot.y, 0.0f, 0x10); } EnNiw_CheckRage(this, play); - if (this->flutterSfxTimer == 0 && this->niwState == NIW_STATE_HELD) { + if ((this->flutterSfxTimer == 0) && (this->niwState == NIW_STATE_HELD)) { this->flutterSfxTimer = 7; Actor_PlaySfx(&this->actor, NA_SE_EN_CHICKEN_FLUTTER); } @@ -901,13 +905,13 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { } } - if (!this->isStormActive && this->niwType == NIW_TYPE_REGULAR) { + if (!this->isStormActive && (this->niwType == NIW_TYPE_REGULAR)) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (play) {} - if (this->niwState != NIW_STATE_HELD && this->niwState != NIW_STATE_FALLING) { + if ((this->niwState != NIW_STATE_HELD) && (this->niwState != NIW_STATE_FALLING)) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } diff --git a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c index afd6eea3e0..ac1e9749a4 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -164,7 +164,7 @@ s32 EnNwc_IsFound(EnNwc* this, PlayState* play) { return false; } - if ((player->stateFlags3 & PLAYER_STATE3_20000000) && this->actor.xzDistToPlayer < 100.0f) { + if ((player->stateFlags3 & PLAYER_STATE3_20000000) && (this->actor.xzDistToPlayer < 100.0f)) { return true; } @@ -178,26 +178,34 @@ void EnNwc_ChangeState(EnNwc* this, s16 newState) { this->stateTimer = 10; this->actionFunc = EnNwc_CheckForBreman; break; + case NWC_STATE_TURNING: this->stateTimer = Rand_ZeroFloat(20.0f) + 15.0f; this->actionFunc = EnNwc_Turn; - this->fallingRotY = (s16)(s32)randPlusMinusPoint5Scaled(65536.0f); + this->fallingRotY = (s16)(s32)randPlusMinusPoint5Scaled(0x10000); break; + case NWC_STATE_HOPPING_FORWARD: this->stateTimer = Rand_ZeroFloat(20.0f) + 15.0f; this->actionFunc = EnNwc_HopForward; break; + case NWC_STATE_FOLLOWING: this->actionFunc = EnNwc_Follow; this->transformTimer = 0; this->randomRot = (s16)(s32)randPlusMinusPoint5Scaled(10000.0f); break; + case NWC_STATE_RUNNING: - this->actor.world.rot.y = this->actor.home.rot.z * 0x3000 & 0xFFFF; // Fake Match?: & 0xFFFF + //! FAKE: & 0xFFFF + this->actor.world.rot.y = this->actor.home.rot.z * 0x3000 & 0xFFFF; this->actor.shape.rot.y = this->actor.world.rot.y; this->stateTimer = Rand_ZeroFloat(40.0f) + 120.0f; this->actionFunc = EnNwc_RunAway; break; + + default: + break; } this->state = newState; @@ -289,7 +297,7 @@ void EnNwc_Follow(EnNwc* this, PlayState* play) { Math_SmoothStepToS(&this->upperBodyRotY, targetUpperBodyRot, 2, 0x1B58, 0x3E8); } else { // NOT grown up - if ((this->stateTimer & 3) == 3 && this->stateTimer & 20) { + if (((this->stateTimer & 3) == 3) && ((this->stateTimer & 0x14) != 0)) { this->actor.velocity.y = 2.0f; // hop up and down } if ((this->stateTimer & 0x1B) == 24) { @@ -473,7 +481,7 @@ void EnNwc_Update(Actor* thisx, PlayState* play) { this->blinkTimer = Rand_S16Offset(0x3C, 0x3C); } - if (this->blinkTimer == 1 || this->blinkTimer == 3) { + if ((this->blinkTimer == 1) || (this->blinkTimer == 3)) { this->blinkState = true; } else { this->blinkState = false; @@ -508,7 +516,7 @@ s32 EnNwc_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p if (limbIndex == NIW_LIMB_UPPER_BODY) { rot->y += this->upperBodyRotY; } - if (limbIndex == NIW_LIMB_RIGHT_WING_ROOT || limbIndex == NIW_LIMB_LEFT_WING_ROOT) { + if ((limbIndex == NIW_LIMB_RIGHT_WING_ROOT) || (limbIndex == NIW_LIMB_LEFT_WING_ROOT)) { rot->y += this->footRotY; rot->z += this->footRotZ; } diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index 045da7fa1c..d4996d74fa 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -901,6 +901,7 @@ void EnPeehat_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* Matrix_MultVecX(-400.0f, vec2); OPEN_DISPS(play->state.gfxCtx); + gfx = POLY_OPA_DISP; Matrix_Translate(-1000.0f, 0.0f, 0.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 56d0f53266..a1ea971999 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -242,9 +242,9 @@ void EnPoSisters_MatchPlayerXZ(EnPoSisters* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 dist; - if (this->megCloneId == POE_SISTERS_MEG_REAL || this->actionFunc != EnPoSisters_DamageFlinch) { - if ((player->meleeWeaponState == PLAYER_MELEE_WEAPON_STATE_0 || - player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H) && + if ((this->megCloneId == POE_SISTERS_MEG_REAL) || (this->actionFunc != EnPoSisters_DamageFlinch)) { + if (((player->meleeWeaponState == PLAYER_MELEE_WEAPON_STATE_0) || + (player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H)) && ((player->actor.world.pos.y - player->actor.floorHeight) < 1.0f)) { Math_StepToF(&this->megDistToPlayer, 110.0f, 3.0f); } else { @@ -277,7 +277,8 @@ void EnPoSisters_MatchPlayerY(EnPoSisters* this, PlayState* play) { this->actor.world.pos.y += (2.0f + (0.5f * Rand_ZeroOne())) * Math_SinS(this->floatingBobbingTimer * 0x800); // fully opaque - if (this->color.a == 255 && this->actionFunc != EnPoSisters_SpinAttack && this->actionFunc != EnPoSisters_SpinUp) { + if ((this->color.a == 255) && (this->actionFunc != EnPoSisters_SpinAttack) && + (this->actionFunc != EnPoSisters_SpinUp)) { if (this->actionFunc == EnPoSisters_Flee) { func_800B9010(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG); } else { @@ -579,7 +580,7 @@ void EnPoSisters_Flee(EnPoSisters* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y; this->poSisterFlags |= POE_SISTERS_FLAG_UPDATE_SHAPE_ROT; EnPoSisters_SetupSpinToInvis(this); - } else if (this->fleeTimer == 0 && this->actor.xzDistToPlayer > 480.0f) { + } else if ((this->fleeTimer == 0) && (this->actor.xzDistToPlayer > 480.0f)) { this->actor.world.rot.y = this->actor.shape.rot.y; EnPoSisters_SetupAimlessIdleFlying(this); } @@ -818,7 +819,7 @@ void EnPoSisters_MegSurroundPlayer(EnPoSisters* this, PlayState* play) { DECR(this->megSurroundTimer); - if (this->megClonesRemaining > 0 && this->megSurroundTimer >= 16) { + if ((this->megClonesRemaining > 0) && (this->megSurroundTimer >= 16)) { SkelAnime_Update(&this->skelAnime); if (this->megCloneId == POE_SISTERS_MEG_REAL) { if (ABS_ALT(16 - this->floatingBobbingTimer) < 14) { @@ -1092,7 +1093,7 @@ s32 EnPoSisters_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Ve }; EnPoSisters* this = THIS; - if (limbIndex == POE_SISTERS_LIMB_ROOT && (this->poSisterFlags & POE_SISTERS_FLAG_REAL_MEG_ROTATION)) { + if ((limbIndex == POE_SISTERS_LIMB_ROOT) && (this->poSisterFlags & POE_SISTERS_FLAG_REAL_MEG_ROTATION)) { if (this->megSurroundTimer >= 284) { rot->x += (this->megSurroundTimer - 284) * 0x1000; } else { @@ -1153,8 +1154,8 @@ void EnPoSisters_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s Matrix_MultVecX(3000.0f, &this->limbPos[7]); } - if (this->actionFunc == EnPoSisters_DeathStage1 && this->deathTimer >= 8 && - limbIndex == POE_SISTERS_LIMB_MAIN_BODY) { + if ((this->actionFunc == EnPoSisters_DeathStage1) && (this->deathTimer >= 8) && + (limbIndex == POE_SISTERS_LIMB_MAIN_BODY)) { gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfx)++, gPoeSistersBurnBodyDL); } diff --git a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c index d95337728a..fcc01b1ec5 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c @@ -153,14 +153,12 @@ s32 EnRuppecrow_ReachedPointClockwise(EnRuppecrow* this, Path* path, s32 pointIn if (currentPoint == 0) { diffX = points[1].x - points[0].x; diffZ = points[1].z - points[0].z; + } else if (currentPoint == (pathCount - 1)) { + diffX = points[pathCount - 1].x - points[pathCount - 2].x; + diffZ = points[pathCount - 1].z - points[pathCount - 2].z; } else { - if (currentPoint == (pathCount - 1)) { - diffX = points[pathCount - 1].x - points[pathCount - 2].x; - diffZ = points[pathCount - 1].z - points[pathCount - 2].z; - } else { - diffX = points[currentPoint + 1].x - points[currentPoint - 1].x; - diffZ = points[currentPoint + 1].z - points[currentPoint - 1].z; - } + diffX = points[currentPoint + 1].x - points[currentPoint - 1].x; + diffZ = points[currentPoint + 1].z - points[currentPoint - 1].z; } func_8017B7F8(&point, RAD_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d); @@ -188,14 +186,12 @@ s32 EnRuppecrow_ReachedPointCounterClockwise(EnRuppecrow* this, Path* path, s32 if (currentPoint == 0) { diffX = points[0].x - points[1].x; diffZ = points[0].z - points[1].z; + } else if (currentPoint == (pathCount - 1)) { + diffX = points[pathCount - 2].x - points[pathCount - 1].x; + diffZ = points[pathCount - 2].z - points[pathCount - 1].z; } else { - if (currentPoint == (pathCount - 1)) { - diffX = points[pathCount - 2].x - points[pathCount - 1].x; - diffZ = points[pathCount - 2].z - points[pathCount - 1].z; - } else { - diffX = points[currentPoint - 1].x - points[currentPoint + 1].x; - diffZ = points[currentPoint - 1].z - points[currentPoint + 1].z; - } + diffX = points[currentPoint - 1].x - points[currentPoint + 1].x; + diffZ = points[currentPoint - 1].z - points[currentPoint + 1].z; } func_8017B7F8(&point, RAD_TO_BINANG(func_80086B30(diffX, diffZ)), &px, &pz, &d); @@ -236,19 +232,23 @@ s32 EnRuppecrow_CanSpawnBlueRupees(PlayState* play) { switch (player->transformation) { case PLAYER_FORM_DEKU: return false; + case PLAYER_FORM_GORON: return true; + case PLAYER_FORM_ZORA: return false; + case PLAYER_FORM_HUMAN: if (player->stateFlags1 & PLAYER_STATE1_800000) { return true; } else { return false; } - } - return false; + default: + return false; + } } void EnRuppecrow_UpdateRupees(EnRuppecrow* this) { @@ -257,7 +257,7 @@ void EnRuppecrow_UpdateRupees(EnRuppecrow* this) { for (rupeeIndex = 0; rupeeIndex < ENRUPPECROW_RUPEE_COUNT; rupeeIndex++) { rupee = this->rupees[rupeeIndex]; - if (rupee != NULL && rupee->unk152 == 0) { + if ((rupee != NULL) && (rupee->unk152 == 0)) { Actor_Kill(&rupee->actor); } } @@ -375,16 +375,19 @@ s32 EnRuppecrow_CheckPlayedMatchingSong(PlayState* play) { return true; } break; + case PLAYER_FORM_GORON: if (play->msgCtx.lastPlayedSong == OCARINA_SONG_GORON_LULLABY) { return true; } break; + case PLAYER_FORM_ZORA: if (play->msgCtx.lastPlayedSong == OCARINA_SONG_NEW_WAVE) { return true; } break; + case PLAYER_FORM_HUMAN: if (play->msgCtx.lastPlayedSong == OCARINA_SONG_SONATA) { return true; @@ -394,6 +397,9 @@ s32 EnRuppecrow_CheckPlayedMatchingSong(PlayState* play) { return true; } break; + + default: + break; } } @@ -407,6 +413,7 @@ void EnRuppecrow_UpdateSpeed(EnRuppecrow* this, PlayState* play) { case PLAYER_FORM_DEKU: this->speedModifier = 7.0f; break; + case PLAYER_FORM_GORON: if (player->stateFlags3 & PLAYER_STATE3_1000) { // Goron Link is curled this->speedModifier = 19.0f; @@ -414,9 +421,11 @@ void EnRuppecrow_UpdateSpeed(EnRuppecrow* this, PlayState* play) { this->speedModifier = 7.0f; } break; + case PLAYER_FORM_ZORA: this->speedModifier = 7.0f; break; + case PLAYER_FORM_HUMAN: if (player->stateFlags1 & PLAYER_STATE1_800000) { this->speedModifier = 16.0f; @@ -424,6 +433,9 @@ void EnRuppecrow_UpdateSpeed(EnRuppecrow* this, PlayState* play) { this->speedModifier = 7.0f; } break; + + default: + break; } this->skelAnime.playSpeed = this->speedModifier / 6.0f; diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c index 8d8991fba3..bde4559868 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -176,7 +176,7 @@ void EnSob1_SetupAction(EnSob1* this, EnSob1ActionFunc action) { s32 EnSob1_TestItemSelected(PlayState* play) { MessageContext* msgCtx = &play->msgCtx; - if (msgCtx->unk12020 == 0x10 || msgCtx->unk12020 == 0x11) { + if ((msgCtx->unk12020 == 0x10) || (msgCtx->unk12020 == 0x11)) { return CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A); } return CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || @@ -188,7 +188,7 @@ u16 EnSob1_GetTalkOption(EnSob1* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->shopType == BOMB_SHOP) { - if (gSaveContext.save.day == 1 && gSaveContext.save.time >= CLOCK_TIME(6, 00)) { + if ((gSaveContext.save.day == 1) && (gSaveContext.save.time >= CLOCK_TIME(6, 00))) { return 0x648; } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08)) { return 0x649; @@ -199,10 +199,13 @@ u16 EnSob1_GetTalkOption(EnSob1* this, PlayState* play) { switch (player->transformation) { case PLAYER_FORM_DEKU: return 0x12D8; + case PLAYER_FORM_GORON: return 0x12D9; + case PLAYER_FORM_ZORA: return 0x12DA; + default: return 0x12D7; } @@ -405,6 +408,7 @@ void EnSob1_Init(Actor* thisx, PlayState* play) { case ZORA_SHOP: this->shopType = ZORA_SHOP; break; + case GORON_SHOP: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) { this->shopType = GORON_SHOP_SPRING; @@ -412,9 +416,11 @@ void EnSob1_Init(Actor* thisx, PlayState* play) { this->shopType = GORON_SHOP; } break; + case BOMB_SHOP: this->shopType = BOMB_SHOP; break; + default: Actor_Kill(&this->actor); return; @@ -579,10 +585,10 @@ void EnSob1_UpdateJoystickInputState(PlayState* play, EnSob1* this) { s8 stickY = CONTROLLER1(&play->state)->rel.stick_y; if (this->stickAccumX == 0) { - if (stickX > 30 || stickX < -30) { + if ((stickX > 30) || (stickX < -30)) { this->stickAccumX = stickX; } - } else if (stickX <= 30 && stickX >= -30) { + } else if ((stickX <= 30) && (stickX >= -30)) { this->stickAccumX = 0; } else if ((this->stickAccumX * stickX) < 0) { // Stick has swapped directions this->stickAccumX = stickX; @@ -595,10 +601,10 @@ void EnSob1_UpdateJoystickInputState(PlayState* play, EnSob1* this) { } } if (this->stickAccumY == 0) { - if (stickY > 30 || stickY < -30) { + if ((stickY > 30) || (stickY < -30)) { this->stickAccumY = stickY; } - } else if (stickY <= 30 && stickY >= -30) { + } else if ((stickY <= 30) && (stickY >= -30)) { this->stickAccumY = 0; } else if ((this->stickAccumY * stickY) < 0) { // Stick has swapped directions this->stickAccumY = stickY; @@ -646,6 +652,7 @@ s32 EnSob1_FacingShopkeeperDialogResult(EnSob1* this, PlayState* play) { func_8019F208(); EnSob1_TalkToShopkeeper(play, this); return true; + case 1: func_8019F230(); if (this->shopType == BOMB_SHOP) { @@ -986,6 +993,7 @@ void EnSob1_HandleCanBuyItem(PlayState* play, EnSob1* this) { this->shopItemSelectedTween = 0.0f; item->boughtFunc(play, item); break; + case CANBUY_RESULT_SUCCESS_2: func_8019F208(); item->buyFunc(play, item); @@ -1002,38 +1010,49 @@ void EnSob1_HandleCanBuyItem(PlayState* play, EnSob1* this) { this->shopItemSelectedTween = 0.0f; item->boughtFunc(play, item); break; + case CANBUY_RESULT_NO_ROOM: play_sound(NA_SE_SY_ERROR); EnSob1_SetupCannotBuy(play, this, sNoRoomTextIds[this->shopType]); break; + case CANBUY_RESULT_NEED_EMPTY_BOTTLE: play_sound(NA_SE_SY_ERROR); EnSob1_SetupCannotBuy(play, this, sNeedEmptyBottleTextIds[this->shopType]); break; + case CANBUY_RESULT_NEED_RUPEES: play_sound(NA_SE_SY_ERROR); EnSob1_SetupCannotBuy(play, this, sNeedRupeesTextIds[this->shopType]); break; + case CANBUY_RESULT_CANNOT_GET_NOW: play_sound(NA_SE_SY_ERROR); EnSob1_SetupCannotBuy(play, this, sCannotGetNowTextIds[this->shopType]); break; + case CANBUY_RESULT_CANNOT_GET_NOW_2: play_sound(NA_SE_SY_ERROR); EnSob1_SetupCannotBuy(play, this, sCannotGetNow2TextIds[this->shopType]); break; + case CANBUY_RESULT_NO_ROOM_2: play_sound(NA_SE_SY_ERROR); EnSob1_SetupCannotBuy(play, this, sNoRoom2TextIds[this->shopType]); break; + case CANBUY_RESULT_ALREADY_HAVE: play_sound(NA_SE_SY_ERROR); EnSob1_SetupCannotBuy(play, this, 0x658); break; + case CANBUY_RESULT_HAVE_BETTER: play_sound(NA_SE_SY_ERROR); EnSob1_SetupCannotBuy(play, this, 0x659); break; + + default: + break; } } @@ -1047,6 +1066,7 @@ void EnSob1_SelectItem(EnSob1* this, PlayState* play) { case 0: EnSob1_HandleCanBuyItem(play, this); break; + case 1: func_8019F230(); this->actionFunc = this->prevActionFunc; @@ -1179,11 +1199,11 @@ void EnSob1_UpdateItemSelectedProperty(EnSob1* this) { for (i = 0; i < ARRAY_COUNT(this->items); i++, items++) { item = *items; if (item != NULL) { - if (this->actionFunc != EnSob1_SelectItem && this->actionFunc != EnSob1_CannotBuy && - this->drawCursor == 0) { + if ((this->actionFunc != EnSob1_SelectItem) && (this->actionFunc != EnSob1_CannotBuy) && + (this->drawCursor == 0)) { item->isSelected = false; } else { - item->isSelected = this->cursorIndex == i ? true : false; + item->isSelected = (this->cursorIndex == i) ? true : false; } } } @@ -1330,10 +1350,10 @@ void EnSob1_ChangeObject(EnSob1* this, PlayState* play) { s32 EnSob1_AreObjectsLoaded(EnSob1* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->mainObjIndex)) { - if (this->unusedObjIndex >= 0 && !Object_IsLoaded(&play->objectCtx, this->unusedObjIndex)) { + if ((this->unusedObjIndex >= 0) && !Object_IsLoaded(&play->objectCtx, this->unusedObjIndex)) { return false; } - if (this->shopkeeperAnimObjIndex >= 0 && !Object_IsLoaded(&play->objectCtx, this->shopkeeperAnimObjIndex)) { + if ((this->shopkeeperAnimObjIndex >= 0) && !Object_IsLoaded(&play->objectCtx, this->shopkeeperAnimObjIndex)) { return false; } return true; diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index e8b67451c7..f4cc458cb1 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -546,7 +546,7 @@ void func_808A650C(EnSt* this) { } s32 func_808A6580(EnSt* this, PlayState* play) { - Player* sp3C = GET_PLAYER(play); + Player* player = GET_PLAYER(play); s32 ret = false; s32 i; @@ -666,7 +666,7 @@ s32 func_808A6580(EnSt* this, PlayState* play) { if ((this->unk_316 == 0) && (this->unk_314 == 0) && (this->unk_312 == 0) && !(this->collider1.base.atFlags & AT_BOUNCED) && (this->actor.colChkInfo.health != 0)) { play->damagePlayer(play, -8); - Actor_PlaySfx(&sp3C->actor, NA_SE_PL_BODY_HIT); + Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); func_800B8D98(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); this->unk_316 = 10; this->unk_18C |= 1; diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index 877a400d5f..74258058f7 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -267,6 +267,7 @@ void func_80BAA9B4(EnSuttari* this) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); } break; + default: if ((this->animIndex != 1) && (curFrame == frameCount)) { this->animIndex = 1; @@ -281,23 +282,31 @@ void func_80BAAA94(EnSuttari* this) { this->animIndex = 1; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); break; + case 0x29E9: this->enFsn->flags |= ENFSN_ANGRY; break; + case 0x29EA: this->enFsn->flags |= ENFSN_CALM_DOWN; break; + case 0x29EB: this->enFsn->flags |= ENFSN_OFFER_FINAL_PRICE; break; + case 0x29EC: this->animIndex = 7; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); break; + case 0x29ED: this->animIndex = 1; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); break; + + default: + break; } } @@ -309,52 +318,64 @@ void func_80BAAB78(EnSuttari* this, PlayState* play) { this->csIdIndex = 0; this->textId = 0x29E5; break; + case 0x29E5: CutsceneManager_Stop(this->csIdList[this->csIdIndex]); this->csIdIndex = 1; this->textId = 0x29E6; break; + case 0x29E6: CutsceneManager_Stop(this->csIdList[this->csIdIndex]); this->csIdIndex = 0; this->textId = 0x29E7; break; + case 0x29E7: CutsceneManager_Stop(this->csIdList[this->csIdIndex]); this->csIdIndex = 1; this->textId = 0x29E8; break; + case 0x29E8: CutsceneManager_Stop(this->csIdList[this->csIdIndex]); this->csIdIndex = 0; this->textId = 0x29E9; break; + case 0x29E9: CutsceneManager_Stop(this->csIdList[this->csIdIndex]); this->csIdIndex = 1; this->textId = 0x29EA; break; + case 0x29EA: CutsceneManager_Stop(this->csIdList[this->csIdIndex]); this->csIdIndex = 0; this->textId = 0x29EB; break; + case 0x29EB: CutsceneManager_Stop(this->csIdList[this->csIdIndex]); this->csIdIndex = 1; this->textId = 0x29EC; break; + case 0x29EC: CutsceneManager_Stop(this->csIdList[this->csIdIndex]); this->csIdIndex = 0; this->textId = 0x29ED; break; + case 0x29ED: CutsceneManager_Stop(this->csIdList[this->csIdIndex]); this->flags1 |= 0x400; this->csIdIndex = 1; this->textId = 0x29EE; break; + + default: + break; } if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { CutsceneManager_Stop(CS_ID_GLOBAL_TALK); @@ -372,9 +393,11 @@ void func_80BAAB78(EnSuttari* this, PlayState* play) { this->textId = 0x1450; } break; + case 0x1450: this->textId = 0x1451; break; + case 0x1451: if (this->flags1 & 0x800) { this->flags1 &= ~0x800; @@ -385,6 +408,7 @@ void func_80BAAB78(EnSuttari* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_81_01); } break; + case 0x1453: this->flags1 |= 0x400; SET_WEEKEVENTREG(WEEKEVENTREG_81_01); @@ -392,25 +416,34 @@ void func_80BAAB78(EnSuttari* this, PlayState* play) { this->flags2 |= 1; this->textId = 0x1454; break; + case 0x1455: this->textId = 0x1456; break; + case 0x1456: this->textId = 0x1457; break; + case 0x1457: this->textId = 0x1458; break; + case 0x1458: this->textId = 0x1459; break; + case 0x1459: this->textId = 0x145A; break; + case 0x145A: this->flags1 |= 0x400; this->textId = 0x145B; break; + + default: + break; } } Message_StartTextbox(play, this->textId, &this->actor); @@ -688,7 +721,7 @@ s32 func_80BABC48(EnSuttari* this, PlayState* play, ScheduleOutput* scheduleOutp if (this->timePath == NULL) { return 0; } - if ((this->unk428 != 0 && this->unk428 < 0xC) && (this->timePathTimeSpeed >= 0)) { + if ((this->unk428 != 0) && (this->unk428 < 0xC) && (this->timePathTimeSpeed >= 0)) { phi_a0 = sp26; } else { phi_a0 = scheduleOutput->time0; @@ -717,8 +750,8 @@ s32 func_80BABDD8(EnSuttari* this, PlayState* play, ScheduleOutput* scheduleOutp Vec3s* sp28; s32 sp24; - if (this->unk428 == 10 || this->unk428 == 11 || this->unk428 == 2) { - return 0; + if ((this->unk428 == 10) || (this->unk428 == 11) || (this->unk428 == 2)) { + return false; } sp48 = (EnDoor*)SubS_FindNearestActor(&this->actor, play, ACTORCAT_DOOR, ACTOR_EN_DOOR); sp24 = D_80BAE8F8[scheduleOutput->result]; @@ -726,21 +759,21 @@ s32 func_80BABDD8(EnSuttari* this, PlayState* play, ScheduleOutput* scheduleOutp this->timePath = SubS_GetAdditionalPath(play, sp47, sp24); } if ((sp48 == NULL) || (this->timePath == NULL)) { - return 0; + return false; } sp28 = Lib_SegmentedToVirtual(this->timePath->points); Math_Vec3s_ToVec3f(&sp38, &sp28[0]); Math_Vec3s_ToVec3f(&sp2C, &sp28[1]); this->unk434 = sp44 - scheduleOutput->time0; this->unk436 = scheduleOutput->time1 - scheduleOutput->time0; - if (scheduleOutput->result != 10 && scheduleOutput->result != 11) { + if ((scheduleOutput->result != 10) && (scheduleOutput->result != 11)) { sp48->unk_1A7 = 0x4B; } Math_Vec3f_Copy(&this->unk438, &sp38); Math_Vec3f_Copy(&this->unk444, &sp2C); this->actor.world.rot.y = Math_Vec3f_Yaw(&sp38, &sp2C); this->actor.world.pos = sp38; - return 1; + return true; } s32 func_80BABF64(EnSuttari* this, PlayState* play, ScheduleOutput* scheduleOutput) { @@ -753,6 +786,7 @@ s32 func_80BABF64(EnSuttari* this, PlayState* play, ScheduleOutput* scheduleOutp case 12: ret = func_80BABC48(this, play, scheduleOutput); break; + case 11: case 10: case 9: @@ -761,15 +795,17 @@ s32 func_80BABF64(EnSuttari* this, PlayState* play, ScheduleOutput* scheduleOutp case 6: ret = func_80BABDD8(this, play, scheduleOutput); break; + case 5: case 4: case 3: case 2: case 1: - ret = 1; + ret = true; break; + default: - ret = 0; + ret = false; break; } return ret; @@ -853,6 +889,7 @@ void func_80BAC2FC(EnSuttari* this, PlayState* play) { this->flags1 |= 0x80; func_80BABFD4(this, play); break; + case 15: if ((this->animIndex == 1) && (curFrame == frameCount)) { this->animIndex = 2; @@ -873,15 +910,18 @@ void func_80BAC2FC(EnSuttari* this, PlayState* play) { } func_80BABFD4(this, play); break; + case 6: case 8: this->flags1 |= 0x80; func_80BAC220(this, play); break; + case 10: this->flags1 |= 0x80; func_80BAC220(this, play); break; + case 9: case 11: this->flags1 |= 0x80; @@ -893,19 +933,23 @@ void func_80BAC2FC(EnSuttari* this, PlayState* play) { } func_80BAC220(this, play); break; + case 7: this->flags1 |= 0x20; this->flags1 |= 0x80; func_80BAC220(this, play); break; + case 14: this->flags1 |= 0x20; this->flags1 |= 0x80; func_80BABFD4(this, play); break; + case 1: Actor_Kill(&this->actor); break; + case 2: if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_81_04)) { this->flags1 |= 0x80; @@ -916,9 +960,10 @@ void func_80BAC2FC(EnSuttari* this, PlayState* play) { this->actionFunc = func_80BADA08; } break; + case 4: if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08)) { - if (this->animIndex == 2 || this->animIndex == 1) { + if ((this->animIndex == 2) || (this->animIndex == 1)) { this->animIndex = 5; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); } @@ -935,6 +980,9 @@ void func_80BAC2FC(EnSuttari* this, PlayState* play) { this->actionFunc = func_80BAD2B4; } break; + + default: + break; } Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 4, 0x1554); } @@ -947,7 +995,7 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_1; if (play->sceneId == SCENE_IKANA) { this->flags1 |= 1; - if (gSaveContext.save.day == 1 || gSaveContext.save.day == 2) { + if ((gSaveContext.save.day == 1) || (gSaveContext.save.day == 2)) { this->animIndex = 2; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->flags1 |= 0x80; @@ -962,7 +1010,7 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { return; } } else if (play->sceneId == SCENE_BACKTOWN) { - if (gSaveContext.save.time >= CLOCK_TIME(0, 20) && gSaveContext.save.time < CLOCK_TIME(6, 00)) { + if ((gSaveContext.save.time >= CLOCK_TIME(0, 20)) && (gSaveContext.save.time < CLOCK_TIME(6, 00))) { Actor_Kill(&this->actor); } @@ -1011,14 +1059,14 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { void func_80BACA14(EnSuttari* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (this->animIndex == 1 || this->animIndex == 8) { + if ((this->animIndex == 1) || (this->animIndex == 8)) { this->animIndex = 2; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); } func_80BABA90(this, 0, 0); func_80BAB434(this); - if (player->transformation == PLAYER_FORM_GORON || player->transformation == PLAYER_FORM_ZORA) { - if (this->actor.playerHeightRel < 60.0f && this->actor.xzDistToPlayer < 500.0f) { + if ((player->transformation == PLAYER_FORM_GORON) || (player->transformation == PLAYER_FORM_ZORA)) { + if ((this->actor.playerHeightRel < 60.0f) && (this->actor.xzDistToPlayer < 500.0f)) { this->unk3F2 = this->headRot.y; this->actionFunc = func_80BACBB0; } @@ -1041,7 +1089,7 @@ void func_80BACBB0(EnSuttari* this, PlayState* play) { s16 target; this->unk3F2 = this->headRot.y; - if (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_DEKU) { + if ((player->transformation == PLAYER_FORM_HUMAN) || (player->transformation == PLAYER_FORM_DEKU)) { this->actionFunc = func_80BACA14; } if ((this->actor.playerHeightRel < 60.0f) && (this->actor.xzDistToPlayer < 500.0f)) { @@ -1071,7 +1119,7 @@ void func_80BACD2C(EnSuttari* this, PlayState* play) { Player* player = GET_PLAYER(play); this->unk3F2 = this->headRot.y; - if (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_DEKU) { + if ((player->transformation == PLAYER_FORM_HUMAN) || (player->transformation == PLAYER_FORM_DEKU)) { this->actionFunc = func_80BACA14; } if ((this->actor.playerHeightRel < 60.0f) && (this->actor.xzDistToPlayer < 500.0f)) { @@ -1372,10 +1420,14 @@ void func_80BADA9C(EnSuttari* this, PlayState* play) { this->flags1 |= 0x800; func_80BAAB78(this, play); break; + case 1: func_8019F230(); func_80BAAB78(this, play); break; + + default: + break; } } if (!(this->flags1 & 4)) { @@ -1486,11 +1538,11 @@ void EnSuttari_Update(Actor* thisx, PlayState* play) { EnSuttari_AdvanceTime(); } if (this->unk428 != 0) { - if (this->animIndex == 2 || this->animIndex == 6) { + if ((this->animIndex == 2) || (this->animIndex == 6)) { if (Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 16.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_PAMERA_WALK); } - } else if (this->animIndex == 0 || this->animIndex == 5) { + } else if ((this->animIndex == 0) || (this->animIndex == 5)) { if (Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 17.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_PAMERA_WALK); } @@ -1514,7 +1566,7 @@ s32 EnSuttari_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 Matrix_RotateXS(-this->torsoRot.y, MTXMODE_APPLY); Matrix_RotateZS(-this->torsoRot.x, MTXMODE_APPLY); } - if (limbIndex == 8 || limbIndex == 9 || limbIndex == 0xC) { + if ((limbIndex == 8) || (limbIndex == 9) || (limbIndex == 0xC)) { rot->y += (s16)(Math_SinS(this->unk2FA[limbIndex]) * 200.0f); rot->z += (s16)(Math_CosS(this->unk31A[limbIndex]) * 200.0f); } diff --git a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c index d64053b5af..ee3b9af588 100644 --- a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c +++ b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c @@ -268,7 +268,7 @@ void EnTalkGibud_Init(Actor* thisx, PlayState* play) { this->switchFlag = -1; } - if (this->switchFlag != -1 && Flags_GetSwitch(play, this->switchFlag)) { + if ((this->switchFlag != -1) && Flags_GetSwitch(play, this->switchFlag)) { Actor_Kill(&this->actor); } @@ -291,7 +291,7 @@ void EnTalkGibud_SetupIdle(EnTalkGibud* this) { * Gibdo will attack the player if they get too close. */ void EnTalkGibud_Idle(EnTalkGibud* this, PlayState* play) { - if (this->actor.xzDistToPlayer <= 150.0f && func_800B715C(play)) { + if ((this->actor.xzDistToPlayer <= 150.0f) && func_800B715C(play)) { EnTalkGibud_SetupAttemptPlayerFreeze(this); } @@ -345,7 +345,8 @@ void EnTalkGibud_WalkToPlayer(EnTalkGibud* this, PlayState* play) { if (EnTalkGibud_PlayerInRangeWithCorrectState(this, play) && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { if ((this->grabWaitTimer == 0) && (this->actor.xzDistToPlayer <= 45.0f)) { player->actor.freezeTimer = 0; - if (gSaveContext.save.playerForm == PLAYER_FORM_GORON || gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { + if ((gSaveContext.save.playerForm == PLAYER_FORM_GORON) || + (gSaveContext.save.playerForm == PLAYER_FORM_DEKU)) { // If the Gibdo/Redead tries to grab Goron or Deku Link, it will fail to // do so. It will appear to take damage and shake its head side-to-side. EnTalkGibud_SetupGrabFail(this); @@ -442,6 +443,9 @@ void EnTalkGibud_Grab(EnTalkGibud* this, PlayState* play) { Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 1.0f, 400.0f, 0.0f); } break; + + default: + break; } } @@ -512,7 +516,7 @@ void EnTalkGibud_WalkToHome(EnTalkGibud* this, PlayState* play) { this->actor.world.rot = this->actor.shape.rot; } if (EnTalkGibud_PlayerInRangeWithCorrectState(this, play)) { - if (gSaveContext.save.playerForm != PLAYER_FORM_GORON && gSaveContext.save.playerForm != PLAYER_FORM_DEKU && + if ((gSaveContext.save.playerForm != PLAYER_FORM_GORON) && (gSaveContext.save.playerForm != PLAYER_FORM_DEKU) && Actor_IsFacingPlayer(&this->actor, 0x38E3)) { EnTalkGibud_SetupWalkToPlayer(this); } @@ -676,6 +680,9 @@ void EnTalkGibud_GetTextIdForRequestedItem(EnTalkGibud* this, PlayState* play) { Message_StartTextbox(play, 0x1395, &this->actor); this->textId = 0x1395; break; + + default: + break; } } @@ -700,6 +707,9 @@ void EnTalkGibud_GetNextTextBoxId(EnTalkGibud* this, PlayState* play) { Message_StartTextbox(play, 0xFF, &this->actor); this->textId = 0xFF; break; + + default: + break; } } } @@ -1063,8 +1073,8 @@ void EnTalkGibud_UpdateDamage(EnTalkGibud* this, PlayState* play) { break; case EN_TALK_GIBUD_DMGEFF_ZORA_MAGIC: - if (this->actionFunc != EnTalkGibud_Grab && - (this->actionFunc != EnTalkGibud_Stunned || this->stunTimer == 0)) { + if ((this->actionFunc != EnTalkGibud_Grab) && + ((this->actionFunc != EnTalkGibud_Stunned) || (this->stunTimer == 0))) { this->drawDmgEffAlpha = 1.0f; this->drawDmgEffTimer = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_SMALL; @@ -1073,10 +1083,13 @@ void EnTalkGibud_UpdateDamage(EnTalkGibud* this, PlayState* play) { break; case EN_TALK_GIBUD_DMGEFF_STUN: - if ((this->actionFunc != EnTalkGibud_Stunned) || this->stunTimer == 0) { + if ((this->actionFunc != EnTalkGibud_Stunned) || (this->stunTimer == 0)) { EnTalkGibud_SetupStunned(this); } break; + + default: + break; } } } @@ -1114,7 +1127,7 @@ void EnTalkGibud_MoveGrabbedPlayerAwayFromWall(EnTalkGibud* this, PlayState* pla Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 20.0f, 35.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); - if (this->actionFunc == EnTalkGibud_Grab && this->grabState == EN_TALK_GIBUD_GRAB_START && + if ((this->actionFunc == EnTalkGibud_Grab) && (this->grabState == EN_TALK_GIBUD_GRAB_START) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { targetPos = player->actor.world.pos; targetPos.x += 10.0f * Math_SinS(this->actor.wallYaw); diff --git a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c index 483edd145f..b86b9c714a 100644 --- a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c +++ b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c @@ -180,10 +180,10 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) { Player* player = GET_PLAYER(play); this->skelAnime.curFrame = 4.0f; - if ((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && player->actor.shape.feetPos[0].y >= 438.0f) { + if ((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (player->actor.shape.feetPos[0].y >= 438.0f)) { // Player is standing on the central platform, so stop chasing them this->isNonHostile = true; - } else if (this->isNonHostile && this->workTimer[WORK_TIMER_WAIT] == 0 && !(this->timer & 0x1F)) { + } else if (this->isNonHostile && (this->workTimer[WORK_TIMER_WAIT] == 0) && !(this->timer & 0x1F)) { xDistance = this->targetPos.x - player->actor.world.pos.x; zDistance = this->targetPos.z - player->actor.world.pos.z; if (sqrtf(SQ(xDistance) + SQ(zDistance)) < 500.0f) { @@ -204,20 +204,21 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) { Math_Vec3f_Copy(&this->targetPos, &player->actor.world.pos); if (!(this->timer & 0xF)) { - if (Rand_ZeroOne() < 0.5f && this->actor.xzDistToPlayer <= 200.0f) { + if ((Rand_ZeroOne() < 0.5f) && (this->actor.xzDistToPlayer <= 200.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_PIRANHA_ATTACK); } } // If the player gets eaten by Gyorg, or if the attack timer ran out, // stop chasing the player for a little bit. - if (this->workTimer[WORK_TIMER_ATTACK] == 0 || (player->stateFlags2 & PLAYER_STATE2_80)) { + if ((this->workTimer[WORK_TIMER_ATTACK] == 0) || (player->stateFlags2 & PLAYER_STATE2_80)) { this->workTimer[WORK_TIMER_WAIT] = 150; this->isNonHostile = true; } break; + case true: - if (sGyorg->unk_324 != 0 && !(this->timer & 0x7)) { + if ((sGyorg->unk_324 != 0) && !(this->timer & 0x7)) { this->nextRotationAngle = 0x4E20; this->actor.speed = 6.0f; } else { @@ -242,7 +243,7 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) { } if (this->workTimer[WORK_TIMER_OUT_OF_WATER] == 0) { - if (this->workTimer[WORK_TIMER_PICK_NEW_DEVIATION] == 0 && this->actor.speed > 1.0f) { + if ((this->workTimer[WORK_TIMER_PICK_NEW_DEVIATION] == 0) && (this->actor.speed > 1.0f)) { this->workTimer[WORK_TIMER_PICK_NEW_DEVIATION] = Rand_ZeroFloat(20.0f); this->deviation.x = randPlusMinusPoint5Scaled(100.0f); this->deviation.y = randPlusMinusPoint5Scaled(50.0f + extraScaleY); @@ -286,6 +287,7 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) { this->isBeached = true; } break; + case true: this->nextRotationAngle = 0x3A98; this->actor.gravity = -1.5f; @@ -423,7 +425,7 @@ void EnTanron3_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->atCollider.base); CollisionCheck_SetAC(play, &play->colChkCtx, &this->acCollider.base); - if ((s8)sGyorg->actor.colChkInfo.health <= 0 && this->actionFunc != EnTanron3_Die) { + if (((s8)sGyorg->actor.colChkInfo.health <= 0) && (this->actionFunc != EnTanron3_Die)) { EnTanron3_SetupDie(this, play); this->workTimer[WORK_TIMER_DIE] = 0; } diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index 7de1342188..3987f9d12e 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -1164,7 +1164,9 @@ void EnTest3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dL func_80128640(play, &this->player, *dList1); if (this->player.stateFlags3 & PLAYER_STATE3_20000000) { OPEN_DISPS(play->state.gfxCtx); + gSPDisplayList(POLY_OPA_DISP++, object_test3_DL_00EDD0); + CLOSE_DISPS(play->state.gfxCtx); } } @@ -1200,7 +1202,9 @@ void EnTest3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dL (this->player.skelAnime.curFrame >= 12.0f))) { if (func_80127438(play, &this->player, this->player.currentMask)) { OPEN_DISPS(play->state.gfxCtx); + gSPDisplayList(POLY_OPA_DISP++, object_mask_ki_tan_DL_0004A0); + CLOSE_DISPS(play->state.gfxCtx); } } @@ -1219,7 +1223,9 @@ void EnTest3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dL D_80A41D60 = true; } else { OPEN_DISPS(play->state.gfxCtx); + gSPDisplayList(POLY_OPA_DISP++, object_test3_DL_00CB60); + CLOSE_DISPS(play->state.gfxCtx); } } else { diff --git a/src/overlays/actors/ovl_En_Test5/z_en_test5.c b/src/overlays/actors/ovl_En_Test5/z_en_test5.c index a041a1aaff..f7a9b431b3 100644 --- a/src/overlays/actors/ovl_En_Test5/z_en_test5.c +++ b/src/overlays/actors/ovl_En_Test5/z_en_test5.c @@ -66,13 +66,13 @@ void EnTest5_HandleBottleAction(EnTest5* this, PlayState* play) { player = GET_PLAYER(play); - if (player->interactRangeActor == NULL || player->getItemId != GI_MAX) { + if ((player->interactRangeActor == NULL) || (player->getItemId != GI_MAX)) { Math_Vec3f_DistXYZAndStoreDiff(&this->minPos, &player->actor.world.pos, &playerPosRelativeToWater); // Make sure that the player is within the bounds of the water and deep enough to grab some - if (playerPosRelativeToWater.x >= 0.0f && playerPosRelativeToWater.x <= this->xLength && - playerPosRelativeToWater.z >= 0.0f && playerPosRelativeToWater.z <= this->zLength && - fabsf(playerPosRelativeToWater.y) < 100.0f && player->actor.depthInWater > 12.0f) { + if ((playerPosRelativeToWater.x >= 0.0f) && (playerPosRelativeToWater.x <= this->xLength) && + (playerPosRelativeToWater.z >= 0.0f) && (playerPosRelativeToWater.z <= this->zLength) && + (fabsf(playerPosRelativeToWater.y) < 100.0f) && (player->actor.depthInWater > 12.0f)) { Actor_OfferGetItem(&this->actor, play, GI_MAX, this->actor.xzDistToPlayer, fabsf(this->actor.playerHeightRel)); } @@ -89,10 +89,10 @@ void EnTest5_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); // If it's the hot spring variant, generate steam clouds - if (ENTEST5_IS_HOT_SPRING(&this->actor) && (play->state.frames % 4) == 0) { - steamPos.x = (Rand_ZeroOne() * this->xLength) + this->minPos.x; + if (ENTEST5_IS_HOT_SPRING(&this->actor) && ((play->state.frames % 4) == 0)) { + steamPos.x = this->minPos.x + (Rand_ZeroOne() * this->xLength); steamPos.y = this->minPos.y + 100.0f; - steamPos.z = (Rand_ZeroOne() * this->zLength) + this->minPos.z; + steamPos.z = this->minPos.z + (Rand_ZeroOne() * this->zLength); if ((BgCheck_EntityRaycastFloor2(play, &play->colCtx, &poly, &steamPos) + 10.0f) < this->minPos.y) { Vec3f steamVel; @@ -102,8 +102,7 @@ void EnTest5_Update(Actor* thisx, PlayState* play2) { steamVel.x = 0.0f; steamVel.z = 0.0f; - EffectSsIceSmoke_Spawn(play, &steamPos, &steamVel, &gZeroVec3f, - (s16)((-200) - (s32)(Rand_ZeroOne() * 50.0f))); + EffectSsIceSmoke_Spawn(play, &steamPos, &steamVel, &gZeroVec3f, -200 - (s32)(Rand_ZeroOne() * 50.0f)); } } } diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index b56112421f..846d728dc5 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -1194,6 +1194,7 @@ void func_80A9369C(Actor* thisx, PlayState* play2) { s32 pad; if (this) {} + OPEN_DISPS(play->state.gfxCtx); this->unk_148 = POLY_OPA_DISP; 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 fb5f72c767..01ec414e5b 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -1366,6 +1366,7 @@ void EnTk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, gSPDisplayList(POLY_OPA_DISP++, object_tk_DL_00B530); CLOSE_DISPS(play->state.gfxCtx); + break; } } diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index c6681b4be0..204fa8714d 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -160,7 +160,8 @@ void EnTorch2_Draw(Actor* thisx, PlayState* play2) { Gfx* gfx = sShellDLists[this->actor.params]; OPEN_DISPS(play->state.gfxCtx); - if (this->alpha == 0xFF) { + + if (this->alpha == 255) { Scene_SetRenderModeXlu(play, 0, 0x01); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); Gfx_DrawDListOpa(play, gfx); @@ -169,5 +170,6 @@ void EnTorch2_Draw(Actor* thisx, PlayState* play2) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, this->alpha); Gfx_DrawDListXlu(play, gfx); } + CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/src/overlays/actors/ovl_En_Toto/z_en_toto.c index 6eff18d295..7de3b50c29 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -205,10 +205,10 @@ void EnToto_Destroy(Actor* thisx, PlayState* play) { } void func_80BA383C(EnToto* this, PlayState* play) { - if (SkelAnime_Update(&this->skelAnime) && this->actionFuncIndex == 1 && - this->skelAnime.animation != &object_zm_Anim_000C80) { - if (play->msgCtx.currentTextId != 0x2A98 && play->msgCtx.currentTextId != 0x2A99) { - if (this->unk2B4 & 1 || Rand_ZeroOne() > 0.5f) { + if (SkelAnime_Update(&this->skelAnime) && (this->actionFuncIndex == 1) && + (this->skelAnime.animation != &object_zm_Anim_000C80)) { + if ((play->msgCtx.currentTextId != 0x2A98) && (play->msgCtx.currentTextId != 0x2A99)) { + if ((this->unk2B4 & 1) || (Rand_ZeroOne() > 0.5f)) { this->unk2B4 = (this->unk2B4 + 1) & 3; } } @@ -251,9 +251,8 @@ void func_80BA39C8(EnToto* this, PlayState* play) { return; } - //! TODO: Neither 0xED02 nor 0xED01 match CLOCK_TIME macro if (((play->sceneId == SCENE_MILK_BAR) && - !((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time < 0xED02))) || + !((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time <= (CLOCK_TIME(22, 13) + 7)))) || ((play->sceneId != SCENE_MILK_BAR) && func_80BA397C(this, 0x2000))) { if (this->unk2B6 != 0) { this->text = D_80BA5044; @@ -327,7 +326,7 @@ void func_80BA3DBC(EnToto* this, PlayState* play) { if (!func_80BA4C44(this, play)) { return; } - if (this->text->unk1 != 0 && ENTOTO_WEEK_EVENT_FLAGS) { + if ((this->text->unk1 != 0) && ENTOTO_WEEK_EVENT_FLAGS) { this->unk2B7 = 1; return; } @@ -428,7 +427,7 @@ s32 func_80BA415C(EnToto* this, PlayState* play) { } else { func_8019F208(); } - return (play->msgCtx.choiceIndex != 0 ? 0 : this->text->unk1) + 1; // Possible msg MACRO + return ((play->msgCtx.choiceIndex != 0) ? 0 : this->text->unk1) + 1; } return 0; } @@ -584,7 +583,7 @@ s32 func_80BA47E0(EnToto* this, PlayState* play) { this->unk2B3 += 8; } for (i = 0; i < ARRAY_COUNT(D_80BA50DC); i++) { - if (gSaveContext.save.playerForm != (i + 1) && (D_80BA5128[i] & this->unk2B3)) { + if ((gSaveContext.save.playerForm != (i + 1)) && (D_80BA5128[i] & this->unk2B3)) { Math_Vec3s_ToVec3f(&spawnPos, &D_80BA50DC[i].unk6); Actor_Spawn(&play->actorCtx, play, ACTOR_PLAYER, spawnPos.x, spawnPos.y, spawnPos.z, i + 2, 0, 0, diff --git a/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.c b/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.c index 02955f0d0a..ac6ae3152b 100644 --- a/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.c +++ b/src/overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.c @@ -121,6 +121,7 @@ void EnWizBrock_Draw(Actor* thisx, PlayState* play) { if (this->platformType != EN_WIZ_BROCK_PLATFORM_TYPE_INACTIVE) { OPEN_DISPS(play->state.gfxCtx); + AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gWizrobePlatformCenterTexAnim)); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 255, 255); diff --git a/src/overlays/actors/ovl_En_Yb/z_en_yb.c b/src/overlays/actors/ovl_En_Yb/z_en_yb.c index 4bf82f55a8..1dbe5d2e86 100644 --- a/src/overlays/actors/ovl_En_Yb/z_en_yb.c +++ b/src/overlays/actors/ovl_En_Yb/z_en_yb.c @@ -170,7 +170,7 @@ void EnYb_ActorShadowFunc(Actor* thisx, Lights* mapper, PlayState* play) { } void EnYb_ChangeAnim(PlayState* play, EnYb* this, s16 animIndex, u8 animMode, f32 morphFrames) { - if (animIndex >= 0 && animIndex < 3) { + if ((animIndex >= 0) && (animIndex < 3)) { if ((animIndex != this->animIndex) || (animMode != ANIMMODE_LOOP)) { if (animIndex > 0) { if (animMode == ANIMMODE_LOOP) { @@ -198,7 +198,7 @@ void EnYb_ChangeAnim(PlayState* play, EnYb* this, s16 animIndex, u8 animMode, f3 } s32 EnYb_CanTalk(EnYb* this, PlayState* play) { - if (this->actor.xzDistToPlayer < 100.0f && Player_IsFacingActor(&this->actor, 0x3000, play) && + if ((this->actor.xzDistToPlayer < 100.0f) && Player_IsFacingActor(&this->actor, 0x3000, play) && Actor_IsFacingPlayer(&this->actor, 0x3000)) { return true; } else { @@ -296,6 +296,7 @@ void EnYb_Talk(EnYb* this, PlayState* play) { this->actionFunc = EnYb_Disappear; SET_WEEKEVENTREG(WEEKEVENTREG_82_04); break; + case 0x147C: // Spread my dance across the world if (Player_GetMask(play) == PLAYER_MASK_KAMARO) { Message_CloseTextbox(play); @@ -311,6 +312,7 @@ void EnYb_Talk(EnYb* this, PlayState* play) { EnYb_ReceiveMask(this, play); } break; + default: Message_CloseTextbox(play); this->actionFunc = EnYb_Idle; @@ -353,9 +355,9 @@ void EnYb_Idle(EnYb* this, PlayState* play) { Player* player = GET_PLAYER(play); EnYb_UpdateAnimation(this, play); - if (this->actor.xzDistToPlayer < 180.0f && fabsf(this->actor.playerHeightRel) < 50.0f && - play->msgCtx.ocarinaMode == 3 && play->msgCtx.lastPlayedSong == OCARINA_SONG_HEALING && - gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { + if ((this->actor.xzDistToPlayer < 180.0f) && (fabsf(this->actor.playerHeightRel) < 50.0f) && + (play->msgCtx.ocarinaMode == 3) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_HEALING) && + (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) { this->actionFunc = EnYb_TeachingDance; this->teachingCutsceneTimer = 200; EnYb_ChangeCutscene(this, 0); @@ -377,8 +379,8 @@ void EnYb_Idle(EnYb* this, PlayState* play) { if (!(player->stateFlags2 & PLAYER_STATE2_8000000)) { this->playerOcarinaOut &= ~1; } - } else if ((player->stateFlags2 & PLAYER_STATE2_8000000) && this->actor.xzDistToPlayer < 180.0f && - fabsf(this->actor.playerHeightRel) < 50.0f) { + } else if ((player->stateFlags2 & PLAYER_STATE2_8000000) && (this->actor.xzDistToPlayer < 180.0f) && + (fabsf(this->actor.playerHeightRel) < 50.0f)) { this->playerOcarinaOut |= 1; Actor_PlaySfx(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); } @@ -466,8 +468,6 @@ void EnYb_Draw(Actor* thisx, PlayState* play) { } gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); - if (1) {} - POLY_XLU_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnYb_PostLimbDrawXlu, &this->actor, POLY_XLU_DISP); diff --git a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c index bc1d543cc4..f41b8057c4 100644 --- a/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c +++ b/src/overlays/actors/ovl_Obj_Armos/z_obj_armos.c @@ -95,20 +95,20 @@ s32 func_809A4F00(ObjArmos* this, s32 arg1) { } if (temp_v0 == OBJARMOS_ROT_7_4) { - return arg1 == 0 || arg1 == 1; + return (arg1 == 0) || (arg1 == 1); } if (temp_v0 == OBJARMOS_ROT_7_5) { - return arg1 == 2 || arg1 == 3; + return (arg1 == 2) || (arg1 == 3); } if (temp_v0 == OBJARMOS_ROT_7_6) { if (this->unk_26E != 0) { - return arg1 == 0 || arg1 == 1; + return (arg1 == 0) || (arg1 == 1); } if (this->unk_270 != 0) { - return arg1 == 2 || arg1 == 3; + return (arg1 == 2) || (arg1 == 3); } return true; @@ -141,22 +141,22 @@ s32 func_809A500C(ObjArmos* this, s32 arg1) { if (temp_v0 == OBJARMOS_ROT_7_4) { temp = D_809A5BB0[arg1] + this->unk_26E; - return temp <= temp_v1 && -temp_v1 <= temp; + return (temp <= temp_v1) && (-temp_v1 <= temp); } if (temp_v0 == OBJARMOS_ROT_7_5) { temp2 = D_809A5BB8[arg1] + this->unk_270; - return temp2 <= temp_v1 && -temp_v1 <= temp2; + return (temp2 <= temp_v1) && (-temp_v1 <= temp2); } if (temp_v0 == OBJARMOS_ROT_7_6) { if ((arg1 == 0) || (arg1 == 1)) { temp = D_809A5BB0[arg1] + this->unk_26E; - return temp <= temp_v1 && -temp_v1 <= temp; + return (temp <= temp_v1) && (-temp_v1 <= temp); } temp2 = D_809A5BB8[arg1] + this->unk_270; - return temp2 <= temp_v1 && -temp_v1 <= temp2; + return (temp2 <= temp_v1) && (-temp_v1 <= temp2); } return false; diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c index 660d9016df..c2270f15b8 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c @@ -418,6 +418,7 @@ void ObjChan_DrawPot(Actor* thisx, PlayState* play) { void ObjChan_DrawFire(ObjChan* this, PlayState* play) { u32 sp4C; Gfx* dl; + OPEN_DISPS(play->state.gfxCtx); sp4C = play->gameplayFrames; diff --git a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c index 22a448e543..c7fbab2d66 100644 --- a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c +++ b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c @@ -284,6 +284,9 @@ void ObjEtcetera_Setup(ObjEtcetera* this, PlayState* play) { this->jointTable, this->morphTable, GOLD_DEKU_FLOWER_LIMB_MAX); this->collider.dim.height = 20; break; + + default: + break; } type = DEKU_FLOWER_TYPE(&this->dyna.actor); @@ -310,6 +313,9 @@ void ObjEtcetera_Setup(ObjEtcetera* this, PlayState* play) { this->dyna.actor.focus.pos.y = this->dyna.actor.home.pos.y + 10.0f; this->dyna.actor.targetMode = 3; break; + + default: + break; } } } @@ -321,7 +327,7 @@ void ObjEtcetera_Update(Actor* thisx, PlayState* play) { if (floorBgId == BGCHECK_SCENE) { floorPoly = this->dyna.actor.floorPoly; - if (floorPoly != NULL && this->burrowFlag & 1) { + if ((floorPoly != NULL) && (this->burrowFlag & 1)) { func_800FAAB4(play, SurfaceType_GetLightSettingIndex(&play->colCtx, floorPoly, floorBgId)); } } diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c index 95c43a4bf6..f63201966d 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -73,7 +73,8 @@ typedef enum { } ObjMureChildState; s32 func_808D78D0(ObjMure* this, PlayState* play) { - if (this->type == OBJMURE_TYPE_FISH || this->type == OBJMURE_TYPE_BUGS || this->type == OBJMURE_TYPE_BUTTERFLY) { + if ((this->type == OBJMURE_TYPE_FISH) || (this->type == OBJMURE_TYPE_BUGS) || + (this->type == OBJMURE_TYPE_BUTTERFLY)) { Actor_ProcessInitChain(&this->actor, sInitChain); } else { return false; @@ -135,6 +136,7 @@ void ObjMure_SpawnActors0(Actor* thisx, PlayState* play) { switch (this->childrenStates[i]) { case OBJMURE_CHILD_STATE_DEAD: break; + case OBJMURE_CHILD_STATE_2: ObjMure_GetSpawnPos(&pos, &this->actor.world.pos, this->ptn, i); this->children[i] = Actor_SpawnAsChildAndCutscene( @@ -148,6 +150,7 @@ void ObjMure_SpawnActors0(Actor* thisx, PlayState* play) { this->children[i]->room = this->actor.room; } break; + default: ObjMure_GetSpawnPos(&pos, &this->actor.world.pos, this->ptn, i); this->children[i] = Actor_SpawnAsChildAndCutscene( @@ -190,9 +193,13 @@ void ObjMure_SpawnActors(ObjMure* this, PlayState* play) { case 0: ObjMure_SpawnActors0(&this->actor, play); break; + case 1: ObjMure_SpawnActors1(this, play); break; + + default: + break; } } @@ -205,12 +212,14 @@ void ObjMure_KillActorsImpl(ObjMure* this, PlayState* play) { case OBJMURE_CHILD_STATE_DEAD: this->children[i] = NULL; break; + case OBJMURE_CHILD_STATE_2: if (this->children[i] != NULL) { Actor_Kill(this->children[i]); this->children[i] = NULL; } break; + default: if (this->children[i] != NULL) { if (Actor_HasParent(this->children[i], play)) { @@ -244,7 +253,7 @@ void ObjMure_CheckChildren(ObjMure* this, PlayState* play) { this->childrenStates[i] = OBJMURE_CHILD_STATE_DEAD; this->children[i] = NULL; } - } else if (this->childrenStates[i] == OBJMURE_CHILD_STATE_2 && this->children[i]->update == NULL) { + } else if ((this->childrenStates[i] == OBJMURE_CHILD_STATE_2) && (this->children[i]->update == NULL)) { this->childrenStates[i] = OBJMURE_CHILD_STATE_DEAD; this->children[i] = NULL; } @@ -367,7 +376,7 @@ void ObjMure_GroupBehavior1(ObjMure* this, PlayState* play) { maxChildren = ObjMure_GetMaxChildSpawns(this); for (i = 0; i < maxChildren; i++) { if (this->children[i] != NULL) { - if (this->children[i]->child != NULL && this->children[i]->child->update == NULL) { + if ((this->children[i]->child != NULL) && (this->children[i]->child->update == NULL)) { this->children[i]->child = NULL; } } @@ -380,7 +389,7 @@ static ObjMureActionFunc sTypeGroupBehaviorFunc[] = { void ObjMure_ActiveState(ObjMure* this, PlayState* play) { ObjMure_CheckChildren(this, play); - if (sZClip[this->type] + 40.0f <= fabsf(this->actor.projectedPos.z)) { + if ((sZClip[this->type] + 40.0f) <= fabsf(this->actor.projectedPos.z)) { this->actionFunc = ObjMure_CulledState; this->actor.flags &= ~ACTOR_FLAG_10; ObjMure_KillActors(this, play); diff --git a/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c b/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c index e06dbc30b6..29a673eae0 100644 --- a/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c +++ b/src/overlays/actors/ovl_Obj_Pzlblock/z_obj_pzlblock.c @@ -114,20 +114,20 @@ s32 func_809A34E0(ObjPzlblock* this, s32 arg1) { } if (temp_v0 == 4) { - return arg1 == 0 || arg1 == 1; + return (arg1 == 0) || (arg1 == 1); } if (temp_v0 == 5) { - return arg1 == 2 || arg1 == 3; + return (arg1 == 2) || (arg1 == 3); } if (temp_v0 == 6) { if (this->unk_176 != 0) { - return arg1 == 0 || arg1 == 1; + return (arg1 == 0) || (arg1 == 1); } if (this->unk_178 != 0) { - return arg1 == 2 || arg1 == 3; + return (arg1 == 2) || (arg1 == 3); } return true; } diff --git a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c index 690823bf87..61fa2376f2 100644 --- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c +++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c @@ -124,7 +124,7 @@ void ObjTokeidai_ExteriorGear_Init(ObjTokeidai* this, PlayState* play) { if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0)) || ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0))) { ObjTokeidai_SetupTowerOpening(this); - } else if ((CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) { + } else if (((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) || (CURRENT_DAY >= 4)) { this->actionFunc = ObjTokeidai_ExteriorGear_OpenedIdle; this->actor.world.pos.y += this->actor.scale.y * 1900.0f; this->actor.shape.yOffset = 1500.0f; @@ -141,7 +141,7 @@ void ObjTokeidai_TowerClock_Init(ObjTokeidai* this, PlayState* play) { if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0)) || ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0))) { ObjTokeidai_SetupTowerOpening(this); - } else if ((CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) { + } else if (((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) || (CURRENT_DAY >= 4)) { this->actor.world.pos.y += (this->actor.scale.y * 5191.0f) - 50.0f; this->actor.world.pos.x += Math_SinS(this->actor.world.rot.y) * this->actor.scale.z * 1791.0f; this->actor.world.pos.z += -Math_CosS(this->actor.world.rot.y) * this->actor.scale.z * 1791.0f; @@ -178,8 +178,8 @@ void ObjTokeidai_Counterweight_Init(ObjTokeidai* this, PlayState* play) { if (this->actor.child == NULL) { type = OBJ_TOKEIDAI_TYPE(&this->actor); - if (type == OBJ_TOKEIDAI_TYPE_COUNTERWEIGHT_CLOCK_TOWN || - type == OBJ_TOKEIDAI_TYPE_COUNTERWEIGHT_TERMINA_FIELD) { + if ((type == OBJ_TOKEIDAI_TYPE_COUNTERWEIGHT_CLOCK_TOWN) || + (type == OBJ_TOKEIDAI_TYPE_COUNTERWEIGHT_TERMINA_FIELD)) { this->actor.child = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HANABI, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); } @@ -192,7 +192,7 @@ void ObjTokeidai_Counterweight_Init(ObjTokeidai* this, PlayState* play) { this->actor.child->home.rot.x = 0x12C; } } - } else if ((CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) { + } else if (((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) || (CURRENT_DAY >= 4)) { this->spotlightIntensity = 0; this->actor.world.pos.y += this->actor.scale.y * -2160.0f; this->actor.world.pos.x += Math_SinS(this->actor.world.rot.y) * this->actor.scale.z * 5400.0f; @@ -274,6 +274,9 @@ void ObjTokeidai_Init(Actor* thisx, PlayState* play) { this->xluDList = gClockTowerEmptyDL; this->actionFunc = ObjTokeidai_StaircaseToRooftop_Idle; break; + + default: + break; } } @@ -284,7 +287,7 @@ void ObjTokeidai_RotateOnMinuteChange(ObjTokeidai* this, s32 playSfx) { s32 currentClockMinute = GET_CURRENT_CLOCK_MINUTE(this); if (currentClockMinute != this->clockMinute) { - if (this->minuteRingOrExteriorGearRotationTimer == 8 && playSfx) { + if ((this->minuteRingOrExteriorGearRotationTimer == 8) && playSfx) { Actor_PlaySfx(&this->actor, NA_SE_EV_CLOCK_TOWER_SECOND_HAND); } @@ -306,8 +309,8 @@ void ObjTokeidai_RotateOnMinuteChange(ObjTokeidai* this, s32 playSfx) { this->minuteRingOrExteriorGearRotationTimer++; - if ((currentClockMinute == 15 && this->minuteRingOrExteriorGearRotation < 0) || - (currentClockMinute != 15 && + if (((currentClockMinute == 15) && (this->minuteRingOrExteriorGearRotation < 0)) || + ((currentClockMinute != 15) && this->minuteRingOrExteriorGearRotation > GET_MINUTE_RING_OR_EXTERIOR_GEAR_ROTATION(currentClockMinute))) { this->minuteRingOrExteriorGearRotation = GET_MINUTE_RING_OR_EXTERIOR_GEAR_ROTATION(currentClockMinute); this->clockMinute = currentClockMinute; @@ -318,7 +321,7 @@ void ObjTokeidai_RotateOnMinuteChange(ObjTokeidai* this, s32 playSfx) { } void ObjTokeidai_ExteriorGear_Collapse(ObjTokeidai* this, PlayState* play) { - if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || this->actor.world.pos.y < 0.0f) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.world.pos.y < 0.0f)) { this->actionFunc = ObjTokeidai_DoNothing; } else { this->actor.shape.rot.x += 0x50; @@ -513,6 +516,9 @@ void ObjTokeidai_TowerOpening_DropCounterweight(ObjTokeidai* this, PlayState* pl case 2: Actor_PlaySfx(&this->actor, NA_SE_EV_CLOCK_TOWER_BOUND_2); break; + + default: + break; } this->boundCount++; @@ -609,7 +615,7 @@ void ObjTokeidai_DoNothing(ObjTokeidai* this, PlayState* play) { } void ObjTokeidai_StaircaseToRooftop_Idle(ObjTokeidai* this, PlayState* play) { - if ((((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) || CURRENT_DAY >= 4) || + if ((((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) || (CURRENT_DAY >= 4)) || CHECK_WEEKEVENTREG(WEEKEVENTREG_08_40)) { this->actor.draw = ObjTokeidai_Draw; } else { @@ -621,7 +627,7 @@ s32 ObjTokeidai_IsPostFirstCycleFinalHours(ObjTokeidai* this, PlayState* play) { if (gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] == ITEM_NONE) { return false; } - if (CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) { + if ((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) { ObjTokeidai_SetupTowerOpening(this); return true; } @@ -650,8 +656,8 @@ void ObjTokeidai_RotateOnHourChange(ObjTokeidai* this, PlayState* play) { this->clockFaceRotationTimer++; - if ((currentClockHour == 12 && this->clockFaceRotation < 0) || - (currentClockHour != 12 && this->clockFaceRotation > GET_CLOCK_FACE_ROTATION(currentClockHour))) { + if (((currentClockHour == 12) && (this->clockFaceRotation < 0)) || + ((currentClockHour != 12) && (this->clockFaceRotation > GET_CLOCK_FACE_ROTATION(currentClockHour)))) { this->clockFaceRotation = GET_CLOCK_FACE_ROTATION(currentClockHour); this->clockHour = currentClockHour; this->clockFaceRotationalVelocity = 0; @@ -682,7 +688,7 @@ void ObjTokeidai_RotateOnHourChange(ObjTokeidai* this, PlayState* play) { } void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, PlayState* play) { - if (CURRENT_DAY == 3 && this->clockHour < 6 && gSaveContext.save.time < CLOCK_TIME(6, 0)) { + if ((CURRENT_DAY == 3) && (this->clockHour < 6) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) { this->actor.draw = ObjTokeidai_Clock_Draw; ObjTokeidai_SetupTowerOpening(this); SET_WEEKEVENTREG(WEEKEVENTREG_08_40); @@ -695,8 +701,8 @@ void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, PlayState* play) { this->actor.draw = ObjTokeidai_Clock_Draw; } else { if (!(play->actorCtx.flags & ACTORCTX_FLAG_1) && - OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_TERMINA_FIELD && - CutsceneManager_GetCurrentCsId() == CS_ID_NONE) { + (OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_TERMINA_FIELD) && + (CutsceneManager_GetCurrentCsId() == CS_ID_NONE)) { this->actor.draw = NULL; } this->clockTime = gSaveContext.save.time; @@ -706,7 +712,7 @@ void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, PlayState* play) { } } - if (CURRENT_DAY != 3 || gSaveContext.save.time >= CLOCK_TIME(6, 0)) { + if ((CURRENT_DAY != 3) || (gSaveContext.save.time >= CLOCK_TIME(6, 0))) { ObjTokeidai_RotateOnMinuteChange(this, true); } ObjTokeidai_RotateOnHourChange(this, play); @@ -750,8 +756,8 @@ void ObjTokeidai_Counterweight_Idle(ObjTokeidai* this, PlayState* play) { if (this->actor.child == NULL) { type = OBJ_TOKEIDAI_TYPE(&this->actor); - if (type == OBJ_TOKEIDAI_TYPE_COUNTERWEIGHT_CLOCK_TOWN || - type == OBJ_TOKEIDAI_TYPE_COUNTERWEIGHT_TERMINA_FIELD) { + if ((type == OBJ_TOKEIDAI_TYPE_COUNTERWEIGHT_CLOCK_TOWN) || + (type == OBJ_TOKEIDAI_TYPE_COUNTERWEIGHT_TERMINA_FIELD)) { this->actor.child = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HANABI, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); } 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 32945a2a42..c4f884694d 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -304,7 +304,7 @@ s32 func_80B781DC(ObjUm* this, EnHorse* bandit1, EnHorse* bandit2, PlayState* pl if (bandit1->unk_550 == D_80B7C164[i].unk_00) { if (bandit2->unk_550 != D_80B7C164[i].unk_04) { if (D_80B7C164[i].unk_00 != 3) { - if (D_80B7C164[i].unk_04 != 3 || + if ((D_80B7C164[i].unk_04 != 3) || ((mask = Player_GetMask(play)), PLAYER_MASK_CIRCUS_LEADER != mask)) { phi_s3 = D_80B7C164[i].unk_04; phi_s4 = D_80B7C164[i].unk_08; @@ -455,13 +455,13 @@ s32 func_80B78764(ObjUm* this, PlayState* play, EnHorse* bandit1, EnHorse* bandi } if (this->potsLife[1] != 1) { - if ((potIndex == -1) || (potIndex == 0 && Rand_ZeroOne() < 0.3f)) { + if ((potIndex == -1) || ((potIndex == 0) && (Rand_ZeroOne() < 0.3f))) { potIndex = 1; } } if (this->potsLife[2] != 1) { - if ((potIndex == -1) || (potIndex != -1 && Rand_ZeroOne() < 0.3f)) { + if ((potIndex == -1) || ((potIndex != -1) && (Rand_ZeroOne() < 0.3f))) { potIndex = 2; } } @@ -497,8 +497,6 @@ s32 func_80B78764(ObjUm* this, PlayState* play, EnHorse* bandit1, EnHorse* bandi phi_v1_5 = Math_Vec3f_Yaw(&bandit1->actor.prevPos, &bandit1->actor.world.pos); } - if (1) {} - phi_v1_5 -= bandit1->actor.shape.rot.y; if (phi_v1_5 > 0x190) { bandit1->actor.shape.rot.y += 0x190; @@ -879,6 +877,9 @@ s32 func_80B795A0(PlayState* play, ObjUm* this, s32 arg2) { Actor_ContinueText(play, &this->dyna.actor, 0x33BC); phi_v1 = false; break; + + default: + break; } return phi_v1; @@ -900,6 +901,9 @@ s32 func_80B79734(PlayState* play, ObjUm* this, s32 arg2) { ret = true; } break; + + default: + break; } return ret; } @@ -1031,7 +1035,7 @@ typedef enum ObjUmPathState { /* 1 */ OBJUM_PATH_STATE_1, /* 2 */ OBJUM_PATH_STATE_FINISH, /* 3 */ OBJUM_PATH_STATE_3, - /* 4 */ OBJUM_PATH_STATE_4, + /* 4 */ OBJUM_PATH_STATE_4 } ObjUmPathState; ObjUmPathState ObjUm_UpdatePath(ObjUm* this, PlayState* play) { @@ -1096,8 +1100,6 @@ ObjUmPathState ObjUm_UpdatePath(ObjUm* this, PlayState* play) { this->dyna.actor.world.rot.y = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, &sp50); Horse_RotateToPoint(&this->donkey->actor, &sp50, 0x190); - if (1) {} - yawDiff = this->donkey->actor.shape.rot.y - this->dyna.actor.shape.rot.y; if (fabsf(yawDiff) < 2730.0f) { if (fabsf(yawDiff) < 100.0f) { @@ -1336,7 +1338,7 @@ void func_80B7A614(ObjUm* this, PlayState* play) { this->flags |= OBJ_UM_FLAG_PLAYING_MINIGAME; ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_GALLOP); - if (ObjUm_UpdatePath(this, play) == OBJUM_PATH_STATE_3 && this->unk_4DC == 0) { + if ((ObjUm_UpdatePath(this, play) == OBJUM_PATH_STATE_3) && (this->unk_4DC == 0)) { this->unk_4DC = 1; } else if (this->unk_4DC > 0) { if (this->unk_4DC == 1) { @@ -1471,7 +1473,7 @@ void func_80B7A860(ObjUm* this, PlayState* play) { case 0x33BF: this->unk_4D8++; - if ((fabsf(this->skelAnime.morphWeight) < 0.008f) && this->unk_4D8 >= 6) { + if ((fabsf(this->skelAnime.morphWeight) < 0.008f) && (this->unk_4D8 >= 6)) { this->unk_4CC = 0; this->mouthTexIndex = 0; } else { @@ -1632,9 +1634,9 @@ void ObjUm_DefaultAnim(ObjUm* this, PlayState* play) { } typedef struct { - /* 0x00 */ AnimationHeader* anim; - /* 0x04 */ s32 doesMove; // `true` if the animation is intended to be used while the actor is moving -} struct_80B7C25C; // size = 0x08 + /* 0x0 */ AnimationHeader* anim; + /* 0x4 */ s32 doesMove; // `true` if the animation is intended to be used while the actor is moving +} struct_80B7C25C; // size = 0x8 struct_80B7C25C sUmAnims[] = { { &gUmTrotAnim, true }, // OBJ_UM_ANIM_TROT @@ -1701,7 +1703,7 @@ void ObjUm_ChangeAnim(ObjUm* this, PlayState* play, ObjUmAnimation animIndex) { } } - if (this->wheelRot / 0x199A != this->unk_420) { + if ((this->wheelRot / 0x199A) != this->unk_420) { this->unk_420 = this->wheelRot / 0x199A; //! FAKE if (sUmAnims[0].doesMove) {} @@ -1768,18 +1770,23 @@ void ObjUm_Update(Actor* thisx, PlayState* play) { case 1: this->eyeTexIndex = 3; break; + case 2: this->eyeTexIndex = 4; break; + case 3: this->eyeTexIndex = 5; break; + case 4: this->eyeTexIndex = 2; break; + case 5: this->eyeTexIndex = 0; break; + default: this->unk_4CC = 0; this->eyeTexIndex = 0; @@ -1913,6 +1920,7 @@ void ObjUm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, sp80.x = 0; sp80.z = 0; sp88.x = 6800.0f; + OPEN_DISPS(gfxCtx); for (i = 0; i < ARRAY_COUNT(this->potsLife); i++) { 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 1c05a0981b..2661b9cc55 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -517,6 +517,7 @@ void func_808DD3C8(Actor* thisx, PlayState* play2) { } OPEN_DISPS(play->state.gfxCtx); + spB4 = false; if (this->actor.params == 3) { diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 87db12b1ef..5da69099e4 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -11212,7 +11212,7 @@ void func_808442D8(PlayState* play, Player* this) { if (var_fa0 > 0.0f) { func_800B0EB0(play, &this->meleeWeaponInfo[0].tip, &D_8085D364, &D_8085D370, &D_8085D37C, &D_8085D380, (var_fa0 * 200.0f), 0, 8); - if (((play->roomCtx.curRoom.enablePosLights != 0)) || (MREG(93) != 0)) { + if (play->roomCtx.curRoom.enablePosLights || (MREG(93) != 0)) { temp_fv1 = (Rand_ZeroOne() * 30.0f) + 225.0f; Lights_PointSetColorAndRadius(&this->lightInfo, temp_fv1, temp_fv1 * 0.7f, 0, var_fa0 * 300.0f); } @@ -11581,7 +11581,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { Math_StepToF(&this->unk_B10[0], var_v0, D_8085D3FC[var_v0]); } func_80832888(this, play); - if (play->roomCtx.curRoom.enablePosLights != 0) { + if (play->roomCtx.curRoom.enablePosLights) { Lights_PointSetColorAndRadius(&this->lightInfo, 255, 255, 255, 60); } else { this->lightInfo.params.point.radius = -1; @@ -15553,7 +15553,7 @@ void func_8084FD7C(PlayState* play, Player* this, Actor* actor) { } s32 func_8084FE48(Player* this) { - return this->targetedActor == NULL && !func_8082FC24(this); + return (this->targetedActor == NULL) && !func_8082FC24(this); } PlayerAnimationHeader* D_8085D688[] = { diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 26cfb7a592..daa6aff8f0 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -988,10 +988,10 @@ 0x801BE9F4:("sHeartsDDEnvColors","s16","[3][3]",0x12), 0x801BEA08:("sHeartsDDPrimFactors","s16","[3][3]",0x12), 0x801BEA1C:("sHeartsDDEnvFactors","s16","[3][3]",0x12), - 0x801BEA30:("HeartTextures","UNK_TYPE1","",0x1), - 0x801BEA70:("HeartDDTextures","UNK_TYPE1","",0x1), - 0x801BEAB0:("posBindFuncs","LightsPosBindFunc","[3]",0xc), - 0x801BEABC:("dirBindFuncs","LightsBindFunc","[3]",0xc), + 0x801BEA30:("sHeartTextures","UNK_TYPE1","",0x1), + 0x801BEA70:("sHeartDDTextures","UNK_TYPE1","",0x1), + 0x801BEAB0:("sPosBindFuncs","LightsPosBindFunc","[3]",0xc), + 0x801BEABC:("sDirBindFuncs","LightsBindFunc","[3]",0xc), 0x801BEAD4:("D_801BEAD4","UNK_TYPE4","",0x4), 0x801BEAD8:("D_801BEAD8","UNK_TYPE4","",0x4), 0x801BEAE0:("D_801BEAE0","UNK_TYPE1","",0x1),