FALLTHROUGH Attribute, switch cleanup (#1719)

* add fallthrough

* attributes

* fix warning
This commit is contained in:
engineer124
2024-10-20 11:56:35 +11:00
committed by GitHub
parent eee5762a55
commit 1b7c9ecb88
113 changed files with 407 additions and 208 deletions
+3 -2
View File
@@ -4,6 +4,7 @@
*/
#include "fault.h"
#include "attributes.h"
#include "sys_cfb.h"
#include "loadfragment.h"
@@ -4532,12 +4533,12 @@ void Npc_TrackPoint(Actor* actor, NpcInteractInfo* interactInfo, s16 presetIndex
rotLimits.maxHeadYaw = 0;
rotLimits.maxHeadPitch = 0;
rotLimits.minHeadPitch = 0;
// fallthrough
FALLTHROUGH;
case NPC_TRACKING_HEAD:
rotLimits.maxTorsoYaw = 0;
rotLimits.maxTorsoPitch = 0;
rotLimits.minTorsoPitch = 0;
// fallthrough
FALLTHROUGH;
case NPC_TRACKING_HEAD_AND_TORSO:
rotLimits.rotateYaw = false;
break;
+18 -17
View File
@@ -47,6 +47,7 @@
#include "global.h"
#include "string.h"
#include "attributes.h"
#include "zelda_arena.h"
#include "z64olib.h"
@@ -1873,7 +1874,7 @@ void Camera_CalcDefaultSwing(Camera* camera, VecGeo* arg1, VecGeo* arg2, f32 arg
case 1:
swing->collisionClosePoint =
Camera_BgCheckCorner(&camera->at, &camera->eyeNext, &swing->atEyeColChk, &swing->eyeAtColChk);
// fallthrough
FALLTHROUGH;
case 2:
peekAroundPoint.x = swing->collisionClosePoint.x + (swing->atEyeColChk.norm.x + swing->eyeAtColChk.norm.x);
peekAroundPoint.y = swing->collisionClosePoint.y + (swing->atEyeColChk.norm.y + swing->eyeAtColChk.norm.y);
@@ -1995,13 +1996,13 @@ s32 Camera_Normal1(Camera* camera) {
switch (camera->animState) {
case 20:
Camera_SetUpdateRatesFastYaw(camera);
// fallthrough
FALLTHROUGH;
case 0:
rwData->unk_0C = 1;
if (!(roData->interfaceFlags & NORMAL1_FLAG_3) && (camera->animState != 20)) {
rwData->unk_0C |= 0x1000;
}
// fallthrough
FALLTHROUGH;
case 10:
if (camera->animState == 10) {
rwData->unk_0C = 0;
@@ -2787,7 +2788,7 @@ s32 Camera_Parallel1(Camera* camera) {
if ((roData->interfaceFlags & (PARALLEL1_FLAG_3 | PARALLEL1_FLAG_2 | PARALLEL1_FLAG_1)) == 0) {
Camera_SetUpdateRatesFastYaw(camera);
}
// fallthrough
FALLTHROUGH;
case 0:
case 10:
if ((roData->interfaceFlags & (PARALLEL1_FLAG_3 | PARALLEL1_FLAG_2 | PARALLEL1_FLAG_1)) ==
@@ -3369,7 +3370,7 @@ s32 Camera_Jump3(Camera* camera) {
switch (camera->animState) {
case 0:
rwData->unk_10 = 0x1000;
// fallthrough
FALLTHROUGH;
case 10:
case 20:
rwData->unk_00 = camera->focalActorFloorHeight;
@@ -4641,7 +4642,7 @@ s32 Camera_KeepOn4(Camera* camera) {
sp9C++;
break;
}
// fallthrough
FALLTHROUGH;
case (KEEPON4_FLAG_3 | KEEPON4_FLAG_1):
if (camera->target != 0) {
sp4C = Actor_GetWorld(camera->target);
@@ -4653,7 +4654,7 @@ s32 Camera_KeepOn4(Camera* camera) {
sp9C++;
break;
}
// fallthrough
FALLTHROUGH;
case (KEEPON4_FLAG_3 | KEEPON4_FLAG_2 | KEEPON4_FLAG_1):
spA2 = CAM_DEG_TO_BINANG(roData->unk_08);
spA0 = spA8.yaw;
@@ -5454,7 +5455,7 @@ s32 Camera_Unique0(Camera* camera) {
camera->eye = camera->eyeNext = rwData->unk_1C.point;
Camera_UnsetStateFlag(camera, CAM_STATE_2);
camera->animState++;
// fallthrough
FALLTHROUGH;
case 1:
sp84.r = OLib_Vec3fDist(&sp8C, &camera->eye);
sp84.yaw = rwData->unk_34.y;
@@ -5987,7 +5988,7 @@ s32 Camera_Demo2(Camera* camera) {
if (camera->stateFlags & CAM_STATE_3) {
camera->animState = 4;
}
// fallthrough
FALLTHROUGH;
case 10:
case 20:
// Taken on the 1st and 158th animation frame
@@ -6013,7 +6014,7 @@ s32 Camera_Demo2(Camera* camera) {
(camera->stateFlags & CAM_STATE_3))) {
goto skipeyeUpdate;
}
// fallthrough
FALLTHROUGH;
default:
Camera_SetStateFlag(camera, CAM_STATE_4 | CAM_STATE_2);
Camera_UnsetStateFlag(camera, CAM_STATE_3);
@@ -6196,7 +6197,7 @@ s32 Camera_Demo4(Camera* camera) {
camera->fov = 80.0f;
rwData->unk_10 = (Rand_ZeroOne() - 0.5f) * 40.0f;
// fallthrough
FALLTHROUGH;
case 1:
// Camera fixed on human player as the mask moves from the pocket to the face
// Camera rolls left and right
@@ -6356,7 +6357,7 @@ s32 Camera_Demo5(Camera* camera) {
focalActorFocus.pos.x = focalActorPosRot->pos.x;
focalActorFocus.pos.z = focalActorPosRot->pos.z;
*at = focalActorFocus.pos;
// fallthrough
FALLTHROUGH;
case 1:
// Camera remains still as player moves hands to face
rwData->timer--;
@@ -6823,7 +6824,7 @@ s32 Camera_Special9(Camera* camera) {
} else {
rwData->unk_00 = sp84.rot.y;
}
// fallthrough
FALLTHROUGH;
case 1:
// Camera is fixed in front of the door
doorParams->timer1--;
@@ -6862,7 +6863,7 @@ s32 Camera_Special9(Camera* camera) {
*eye = *eyeNext;
}
}
// fallthrough
FALLTHROUGH;
case 2:
// Camera is behind the door looking at player
spB8 = focalActorPosRot->pos;
@@ -6878,7 +6879,7 @@ s32 Camera_Special9(Camera* camera) {
// Setup for the camera turning around to look in front of player
camera->animState++;
rwData->unk_00 = BINANG_ROT180(rwData->unk_00);
// fallthrough
FALLTHROUGH;
case 3:
// Camera turns around to look in front of player
spB8 = focalActorPosRot->pos;
@@ -6897,10 +6898,10 @@ s32 Camera_Special9(Camera* camera) {
}
camera->animState++;
// fallthrough
FALLTHROUGH;
case 4:
camera->animState++;
// fallthrough
FALLTHROUGH;
case 999:
default:
// Door is closed and is waiting for user input to toggle to a new setting
+3
View File
@@ -967,6 +967,7 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) {
vtx[j + 1].v.ob[1] = elem->p2.y;
vtx[j + 1].v.ob[2] = elem->p2.z;
break;
case 2:
vtx[j].v.ob[0] = elem->p1.x;
vtx[j].v.ob[1] = elem->p1.y;
@@ -975,6 +976,7 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) {
vtx[j + 1].v.ob[1] = func_800B09D0(elem->p2.y, elem->p1.y, ratio);
vtx[j + 1].v.ob[2] = func_800B09D0(elem->p2.z, elem->p1.z, ratio);
break;
case 3:
ratio *= 0.5f;
vtx[j].v.ob[0] = func_800B09D0(elem->p1.x, elem->p2.x, ratio);
@@ -985,6 +987,7 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) {
vtx[j + 1].v.ob[2] = func_800B09D0(elem->p2.z, elem->p1.z, ratio);
ratio *= 2.0f;
break;
case 0:
default:
vtx[j].v.ob[0] = elem->p1.x;
+2 -1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "attributes.h"
#include "overlays/actors/ovl_En_Elforg/z_en_elforg.h"
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "assets/objects/object_gi_hearts/object_gi_hearts.h"
@@ -738,7 +739,7 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) {
}
break;
}
// fallthrough
FALLTHROUGH;
case ITEM00_BOMBS_A:
case ITEM00_ARROWS_10:
case ITEM00_ARROWS_30:
+2 -1
View File
@@ -7,6 +7,7 @@
#include "z64cutscene.h"
#include "string.h"
#include "attributes.h"
#include "global.h"
#include "z64olib.h"
@@ -215,7 +216,7 @@ void CutsceneManager_End(void) {
switch (sCutsceneMgr.startMethod) {
case CS_START_2:
sCutsceneMgr.targetActor->flags &= ~ACTOR_FLAG_100000;
// fallthrough
FALLTHROUGH;
case CS_START_1:
Player_SetCsActionWithHaltedActors(sCutsceneMgr.play, NULL, PLAYER_CSACTION_END);
sCutsceneMgr.startMethod = CS_START_0;
+23 -24
View File
@@ -136,46 +136,46 @@ void Jpeg_ParseMarkers(u8* ptr, JpegContext* jpegCtx) {
// 0xFF indicates the start of a JPEG marker, so look for the next.
if (*ptr++ == 0xFF) {
switch (*ptr++) {
case MARKER_ESCAPE: {
case MARKER_ESCAPE:
// Compressed value 0xFF is stored as 0xFF00 to escape it, so ignore it.
break;
}
case MARKER_SOI: {
case MARKER_SOI:
// Start of Image
break;
}
case MARKER_APP0: {
case MARKER_APP0:
// Application marker for JFIF
ptr += Jpeg_GetUnalignedU16(ptr);
break;
}
case MARKER_APP1: {
case MARKER_APP1:
// Application marker for EXIF
ptr += Jpeg_GetUnalignedU16(ptr);
break;
}
case MARKER_APP2: {
case MARKER_APP2:
ptr += Jpeg_GetUnalignedU16(ptr);
break;
}
case MARKER_DQT: {
case MARKER_DQT:
// Define Quantization Table, stored for later processing
jpegCtx->dqtPtr[jpegCtx->dqtCount++] = ptr + 2;
ptr += Jpeg_GetUnalignedU16(ptr);
break;
}
case MARKER_DHT: {
case MARKER_DHT:
// Define Huffman Table, stored for later processing
jpegCtx->dhtPtr[jpegCtx->dhtCount++] = ptr + 2;
ptr += Jpeg_GetUnalignedU16(ptr);
break;
}
case MARKER_DRI: {
case MARKER_DRI:
// Define Restart Interval
ptr += Jpeg_GetUnalignedU16(ptr);
break;
}
case MARKER_SOF: {
case MARKER_SOF:
// Start of Frame, stores important metadata of the image.
// Only used for extracting the sampling factors (jpegCtx->mode).
@@ -188,22 +188,21 @@ void Jpeg_ParseMarkers(u8* ptr, JpegContext* jpegCtx) {
}
ptr += Jpeg_GetUnalignedU16(ptr);
break;
}
case MARKER_SOS: {
case MARKER_SOS:
// Start of Scan marker, indicates the start of the image data.
ptr += Jpeg_GetUnalignedU16(ptr);
jpegCtx->imageData = ptr;
break;
}
case MARKER_EOI: {
case MARKER_EOI:
// End of Image
exit = true;
break;
}
default: {
default:
ptr += Jpeg_GetUnalignedU16(ptr);
break;
}
}
}
}
+4 -3
View File
@@ -7,6 +7,7 @@
#include "padmgr.h"
#include "sys_cmpdma.h"
#include "segment_symbols.h"
#include "attributes.h"
#include "z64actor.h"
#include "z64horse.h"
@@ -1188,7 +1189,7 @@ void Message_DrawTextDefault(PlayState* play, Gfx** gfxP) {
case 0xA:
msgCtx->textPosY += msgCtx->unk11FFC;
// fallthrough
FALLTHROUGH;
case 0xC:
sp130++;
msgCtx->textPosX = msgCtx->unk11F1A[sp130] + msgCtx->unk11FF8;
@@ -4510,7 +4511,7 @@ void Message_DrawMain(PlayState* play, Gfx** gfxP) {
case MSGMODE_OCARINA_FAIL:
case MSGMODE_SONG_PROMPT_FAIL:
Message_DrawText(play, &gfx);
// fallthrough
FALLTHROUGH;
case MSGMODE_OCARINA_FAIL_NO_TEXT:
msgCtx->stateTimer--;
if (msgCtx->stateTimer == 0) {
@@ -4696,7 +4697,7 @@ void Message_DrawMain(PlayState* play, Gfx** gfxP) {
sOcarinaButtonIndexBufPos++;
}
}
// fallthrough
FALLTHROUGH;
case MSGMODE_SONG_DEMONSTRATION_DONE:
Message_DrawText(play, &gfx);
break;
+2 -1
View File
@@ -1,6 +1,7 @@
#include "global.h"
#include "message_data_fmt_nes.h"
#include "message_data_static.h"
#include "attributes.h"
f32 sNESFontWidths[160] = {
8.0f, 8.0f, 6.0f, 9.0f, 9.0f, 14.0f, 12.0f, 3.0f, 7.0f, 7.0f, 7.0f, 9.0f, 4.0f, 6.0f, 4.0f, 9.0f,
@@ -536,7 +537,7 @@ void Message_DrawTextNES(PlayState* play, Gfx** gfxP, u16 textDrawPos) {
case MESSAGE_NEWLINE:
msgCtx->textPosY += msgCtx->unk11FFC;
// fallthrough
FALLTHROUGH;
case MESSAGE_CARRIAGE_RETURN:
sp130++;
+2 -1
View File
@@ -1,6 +1,7 @@
#include "global.h"
#include "message_data_fmt_staff.h"
#include "message_data_static.h"
#include "attributes.h"
void Message_FindCreditsMessage(PlayState* play, u16 textId) {
MessageContext* msgCtx = &play->msgCtx;
@@ -137,7 +138,7 @@ void Message_DrawTextCredits(PlayState* play, Gfx** gfxP) {
i = j - 1;
msgCtx->textDrawPos = i + 1;
}
// fallthrough
FALLTHROUGH;
case MESSAGE_QUICKTEXT_DISABLE:
break;
+5 -1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "attributes.h"
/**
* Branch forward if the provided weekEventReg flag is set
@@ -291,6 +292,7 @@ s32 MsgEvent_AwaitTextJump(Actor* actor, PlayState* play, u8** script, MsgScript
if (!Message_ShouldAdvance(play)) {
return true;
}
FALLTHROUGH;
case TEXT_STATE_CLOSING:
skip = SCRIPT_PACK_16(cmd->offsetH, cmd->offsetL);
break;
@@ -345,6 +347,7 @@ s32 MsgEvent_AwaitTextEnd(Actor* actor, PlayState* play, u8** script, MsgScriptC
if (!Message_ShouldAdvance(play)) {
break;
}
FALLTHROUGH;
case TEXT_STATE_CLOSING:
*endScript = true;
break;
@@ -614,6 +617,7 @@ s32 MsgEvent_CheckItemAction(Actor* actor, PlayState* play, u8** script, MsgScri
if (!Message_ShouldAdvance(play)) {
return true;
}
FALLTHROUGH;
case TEXT_STATE_PAUSE_MENU:
curItemAction = func_80123810(play);
@@ -975,7 +979,7 @@ s32 MsgEvent_AwaitTextDone(Actor* actor, PlayState* play, u8** script, MsgScript
if (!Message_ShouldAdvance(play)) {
return true;
}
FALLTHROUGH;
case TEXT_STATE_DONE:
if (!Message_ShouldAdvance(play)) {
return true;
+7 -6
View File
@@ -8,6 +8,7 @@
#include "z64snap.h"
#include "z64view.h"
#include "z64voice.h"
#include "attributes.h"
#include "assets/archives/icon_item_static/icon_item_static_yar.h"
#include "assets/interface/parameter_static/parameter_static.h"
@@ -3774,7 +3775,7 @@ void Magic_Update(PlayState* play) {
gSaveContext.magicState = MAGIC_STATE_METER_FLASH_1;
sMagicMeterOutlinePrimRed = sMagicMeterOutlinePrimGreen = sMagicMeterOutlinePrimBlue = 255;
}
// fallthrough (flash border while magic is being consumed)
FALLTHROUGH; // (flash border while magic is being consumed)
case MAGIC_STATE_METER_FLASH_1:
case MAGIC_STATE_METER_FLASH_2:
case MAGIC_STATE_METER_FLASH_3:
@@ -3830,7 +3831,7 @@ void Magic_Update(PlayState* play) {
gSaveContext.save.saveInfo.playerData.magic = 0;
}
gSaveContext.magicState = MAGIC_STATE_CONSUME_GORON_ZORA;
// fallthrough
FALLTHROUGH;
case MAGIC_STATE_CONSUME_GORON_ZORA:
if (!IS_PAUSED(&play->pauseCtx) && (msgCtx->msgMode == MSGMODE_NONE) &&
(play->gameOverCtx.state == GAMEOVER_INACTIVE) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
@@ -5816,7 +5817,7 @@ void Interface_DrawTimers(PlayState* play) {
gSaveContext.timerStopTimes[sTimerId] = SECONDS_TO_TIMER(0);
gSaveContext.timerPausedOsTimes[sTimerId] = 0;
}
// fallthrough
FALLTHROUGH;
case TIMER_STATE_COUNTING:
if ((gSaveContext.timerStates[sTimerId] == TIMER_STATE_COUNTING) &&
(sTimerId == TIMER_ID_MOON_CRASH)) {
@@ -5829,7 +5830,7 @@ void Interface_DrawTimers(PlayState* play) {
D_801BF8F8[sTimerId] = osGetTime();
D_801BF930[sTimerId] = 0;
gSaveContext.timerStates[sTimerId] = TIMER_STATE_ALT_COUNTING;
// fallthrough
FALLTHROUGH;
case TIMER_STATE_ALT_COUNTING:
D_801BF930[sTimerId] = osGetTime() - D_801BF8F8[sTimerId];
break;
@@ -6764,7 +6765,7 @@ void Interface_LoadStory(PlayState* play, s32 osMesgFlag) {
DmaMgr_RequestAsync(&interfaceCtx->dmaRequest, interfaceCtx->storySegment, interfaceCtx->storyAddr,
interfaceCtx->storySize, 0, &interfaceCtx->storyMsgQueue, NULL);
interfaceCtx->storyDmaStatus = STORY_DMA_LOADING;
// fallthrough
FALLTHROUGH;
case STORY_DMA_LOADING:
if (osRecvMesg(&interfaceCtx->storyMsgQueue, NULL, osMesgFlag) == 0) {
interfaceCtx->storyDmaStatus = STORY_DMA_DONE;
@@ -6907,7 +6908,7 @@ void Interface_Update(PlayState* play) {
gSaveContext.nextHudVisibility = HUD_VISIBILITY_NONE;
Interface_UpdateHudAlphas(play, 0);
gSaveContext.nextHudVisibility = HUD_VISIBILITY_IDLE;
// fallthrough
FALLTHROUGH;
default:
break;
}
+3 -1
View File
@@ -20,6 +20,7 @@ u8 sMotionBlurStatus;
#include "idle.h"
#include "regs.h"
#include "sys_cfb.h"
#include "attributes.h"
#include "z64bombers_notebook.h"
#include "z64debug_display.h"
@@ -339,6 +340,7 @@ void Play_SetupTransition(PlayState* this, s32 transitionType) {
default:
fbdemoType = -1;
_dbg_hungup("../z_play.c", 1420);
break;
}
} else {
fbdemoType = -1;
@@ -614,7 +616,7 @@ void Play_UpdateTransition(PlayState* this) {
// non-instance modes break out of this switch
break;
}
// fallthrough
FALLTHROUGH;
case TRANS_MODE_INSTANCE_INIT: {
s32 transWipeSpeed;
s32 transFadeDuration;
+2 -1
View File
@@ -3,6 +3,7 @@
#include "sys_cmpdma.h"
#include "z64bombers_notebook.h"
#include "zelda_arena.h"
#include "attributes.h"
#include "assets/interface/schedule_static/schedule_static.h"
#include "assets/archives/schedule_dma_static/schedule_dma_static_yar.h"
@@ -1117,7 +1118,7 @@ void BombersNotebook_LoadFiles(BombersNotebook* this, s32 flag) {
DmaMgr_RequestAsync(&this->dmaRequest, this->scheduleSegment, this->scheduleSegmentStart,
this->scheduleSegmentSize, 0, &this->loadQueue, NULL);
this->loadState = BOMBERS_NOTEBOOK_LOAD_STATE_STARTED;
// fallthrough
FALLTHROUGH;
case BOMBERS_NOTEBOOK_LOAD_STATE_STARTED:
if (osRecvMesg(&this->loadQueue, NULL, flag) == 0) {
this->loadState = BOMBERS_NOTEBOOK_LOAD_STATE_DONE;
+8
View File
@@ -737,41 +737,49 @@ void Scene_DrawConfigGreatBayTemple(PlayState* play) {
lodFrac = 255;
}
break;
case 1:
if (Flags_GetSwitch(play, 0x37)) {
lodFrac = 68;
}
break;
case 2:
if (Flags_GetSwitch(play, 0x37) && Flags_GetSwitch(play, 0x38)) {
lodFrac = 68;
}
break;
case 3:
if (Flags_GetSwitch(play, 0x37) && Flags_GetSwitch(play, 0x38) && Flags_GetSwitch(play, 0x39)) {
lodFrac = 68;
}
break;
case 4:
if (!(Flags_GetSwitch(play, 0x33))) {
lodFrac = 68;
}
break;
case 5:
if (Flags_GetSwitch(play, 0x34)) {
lodFrac = 68;
}
break;
case 6:
if (Flags_GetSwitch(play, 0x34) && Flags_GetSwitch(play, 0x35)) {
lodFrac = 68;
}
break;
case 7:
if (Flags_GetSwitch(play, 0x34) && Flags_GetSwitch(play, 0x35) && Flags_GetSwitch(play, 0x36)) {
lodFrac = 68;
}
break;
case 8:
if (Flags_GetSwitch(play, 0x3A)) {
lodFrac = 68;
+2 -1
View File
@@ -2,6 +2,7 @@
#include "global.h"
#include "z64olib.h"
#include "attributes.h"
#include "overlays/actors/ovl_En_Kakasi/z_en_kakasi.h"
@@ -52,7 +53,7 @@ s32 Snap_RecordPictographedActors(PlayState* play) {
seen |= PICTO_SEEN_ANYWHERE;
break; //! @bug break is inside conditional, meaning it falls through if it is false
}
// FALLTHROUGH
FALLTHROUGH;
case ACTOR_EN_ZOV:
seen |= PICTO_SEEN_ANYWHERE;
break;
+1
View File
@@ -412,6 +412,7 @@ s32 SubS_TimePathing_Update(Path* path, f32* progress, s32* elapsedTime, s32 way
SubS_TimePathing_ComputeTargetPosXZ(&targetPos->x, &targetPos->z, *progress, SUBS_TIME_PATHING_ORDER,
*waypoint, points, knots);
break;
case SUBS_TIME_PATHING_PROGRESS_STATUS_SHOULD_REACH_END:
endX = points[path->count - 1].x;
endZ = points[path->count - 1].z;