1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-05-12 03:53:47 +00:00

Cleanup clang-format off (#1195)

* Run formatter

* Remove useless `// clang-format off`

* Improve manual formatting inside `clang-format off` blocks

* Remove `// clang-format off` where used only for code style formatting

* Remove some `// clang-format off` with a for loop "trick"

* Reduce the size of `clang-format off` blocks

* Remove one `clang-format off` by moving assignment to inside line

* Revert "Remove some `// clang-format off` with a for loop "trick""

This reverts commit 30c344b800.

* Put some `// clang-format on` back on the same level as `off`
This commit is contained in:
Dragorn421 2022-04-29 21:06:08 +02:00 committed by GitHub
parent 0d7670f059
commit 4a6bfcdd21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 90 additions and 85 deletions

View file

@ -1166,7 +1166,6 @@ OcarinaSongInfo gOcarinaSongNotes[OCARINA_SONG_MAX] = {
// Lost Woods Memory Game // Lost Woods Memory Game
{ 0, { 0, 0, 0, 0, 0, 0, 0, 0 } }, { 0, { 0, 0, 0, 0, 0, 0, 0, 0 } },
}; };
// clang-format on
/** /**
* BSS * BSS

View file

@ -62,9 +62,7 @@ u32 Rand_Next_Variable(u32* rndNum) {
f32 Rand_ZeroOne_Variable(u32* rndNum) { f32 Rand_ZeroOne_Variable(u32* rndNum) {
u32 next = (*rndNum * 1664525) + 1013904223; u32 next = (*rndNum * 1664525) + 1013904223;
// clang-format off sRandFloat = ((*rndNum = next) >> 9) | 0x3F800000;
*rndNum = next; sRandFloat = (next >> 9) | 0x3F800000;
// clang-format on
return *((f32*)&sRandFloat) - 1.0f; return *((f32*)&sRandFloat) - 1.0f;
} }
@ -75,8 +73,7 @@ f32 Rand_ZeroOne_Variable(u32* rndNum) {
f32 Rand_Centered_Variable(u32* rndNum) { f32 Rand_Centered_Variable(u32* rndNum) {
u32 next = (*rndNum * 1664525) + 1013904223; u32 next = (*rndNum * 1664525) + 1013904223;
// clang-format off *rndNum = next;
*rndNum = next; sRandFloat = (next >> 9) | 0x3F800000; sRandFloat = (next >> 9) | 0x3F800000;
// clang-format on
return *((f32*)&sRandFloat) - 1.5f; return *((f32*)&sRandFloat) - 1.5f;
} }

View file

@ -10,7 +10,6 @@ FaultClient sGraphFaultClient;
CfbInfo sGraphCfbInfos[3]; CfbInfo sGraphCfbInfos[3];
FaultClient sGraphUcodeFaultClient; FaultClient sGraphUcodeFaultClient;
// clang-format off
UCodeInfo D_8012D230[3] = { UCodeInfo D_8012D230[3] = {
{ UCODE_F3DZEX, D_80155F50 }, { UCODE_F3DZEX, D_80155F50 },
{ UCODE_UNK, NULL }, { UCODE_UNK, NULL },
@ -22,7 +21,6 @@ UCodeInfo D_8012D248[3] = {
{ UCODE_UNK, NULL }, { UCODE_UNK, NULL },
{ UCODE_S2DEX, D_80113070 }, { UCODE_S2DEX, D_80113070 },
}; };
// clang-format on
void Graph_FaultClient(void) { void Graph_FaultClient(void) {
void* nextFb = osViGetNextFramebuffer(); void* nextFb = osViGetNextFramebuffer();

View file

@ -224,7 +224,8 @@ void UCodeDisas_ParseRenderMode(UCodeDisas* this, u32 mode) {
// clang-format off // clang-format off
if (this->enableLog == 0) {} else { osSyncPrintf("\nGBL_c1(%s, %s, %s, %s)|", if (this->enableLog == 0) {} else { osSyncPrintf("\nGBL_c1(%s, %s, %s, %s)|",
D_8012DDDC[0][a >> 12 & 3], D_8012DDDC[1][a >> 8 & 3], D_8012DDDC[2][a >> 4 & 3], D_8012DDDC[3][a >> 0 & 3]); } D_8012DDDC[0][a >> 12 & 3], D_8012DDDC[1][a >> 8 & 3], D_8012DDDC[2][a >> 4 & 3], D_8012DDDC[3][a >> 0 & 3]);
}
// clang-format on // clang-format on
if (this->enableLog) { if (this->enableLog) {

View file

@ -139,9 +139,9 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) {
EnAObj_SetupBlockRot(this, thisx->params); EnAObj_SetupBlockRot(this, thisx->params);
break; break;
case A_OBJ_UNKNOWN_6: case A_OBJ_UNKNOWN_6:
// clang-format off this->focusYoffset = 10.0f;
thisx->flags |= ACTOR_FLAG_0; this->dyna.bgId = 5; this->focusYoffset = 10.0f; thisx->flags |= ACTOR_FLAG_0;
// clang-format on this->dyna.bgId = 5;
thisx->gravity = -2.0f; thisx->gravity = -2.0f;
EnAObj_SetupWaitTalk(this, thisx->params); EnAObj_SetupWaitTalk(this, thisx->params);
break; break;
@ -153,9 +153,8 @@ void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) {
case A_OBJ_SIGNPOST_OBLONG: case A_OBJ_SIGNPOST_OBLONG:
case A_OBJ_SIGNPOST_ARROW: case A_OBJ_SIGNPOST_ARROW:
thisx->textId = (this->textId & 0xFF) | 0x300; thisx->textId = (this->textId & 0xFF) | 0x300;
// clang-format off thisx->targetArrowOffset = 500.0f;
thisx->flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; thisx->targetArrowOffset = 500.0f; thisx->flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3;
// clang-format on
this->focusYoffset = 45.0f; this->focusYoffset = 45.0f;
EnAObj_SetupWaitTalk(this, thisx->params); EnAObj_SetupWaitTalk(this, thisx->params);
Collider_InitCylinder(globalCtx, &this->collider); Collider_InitCylinder(globalCtx, &this->collider);

View file

@ -924,14 +924,14 @@ s16 func_8001F404(s16 dropId) {
} }
// This is convoluted but it seems like it must be a single condition to match // This is convoluted but it seems like it must be a single condition to match
// clang-format off if (((dropId == ITEM00_BOMBS_A || dropId == ITEM00_BOMBS_SPECIAL || dropId == ITEM00_BOMBS_B) &&
if (((dropId == ITEM00_BOMBS_A || dropId == ITEM00_BOMBS_SPECIAL || dropId == ITEM00_BOMBS_B) && INV_CONTENT(ITEM_BOMB) == ITEM_NONE) || INV_CONTENT(ITEM_BOMB) == ITEM_NONE) ||
((dropId == ITEM00_ARROWS_SMALL || dropId == ITEM00_ARROWS_MEDIUM || dropId == ITEM00_ARROWS_LARGE) && INV_CONTENT(ITEM_BOW) == ITEM_NONE) || ((dropId == ITEM00_ARROWS_SMALL || dropId == ITEM00_ARROWS_MEDIUM || dropId == ITEM00_ARROWS_LARGE) &&
INV_CONTENT(ITEM_BOW) == ITEM_NONE) ||
((dropId == ITEM00_MAGIC_LARGE || dropId == ITEM00_MAGIC_SMALL) && gSaveContext.magicLevel == 0) || ((dropId == ITEM00_MAGIC_LARGE || dropId == ITEM00_MAGIC_SMALL) && gSaveContext.magicLevel == 0) ||
((dropId == ITEM00_SEEDS) && INV_CONTENT(ITEM_SLINGSHOT) == ITEM_NONE)) { ((dropId == ITEM00_SEEDS) && INV_CONTENT(ITEM_SLINGSHOT) == ITEM_NONE)) {
return -1; return -1;
} }
// clang-format on
if (dropId == ITEM00_HEART && gSaveContext.healthCapacity == gSaveContext.health) { if (dropId == ITEM00_HEART && gSaveContext.healthCapacity == gSaveContext.health) {
return ITEM00_RUPEE_GREEN; return ITEM00_RUPEE_GREEN;

View file

@ -410,9 +410,13 @@ void Minimap_Draw(GlobalContext* globalCtx) {
osSyncPrintf("Game_play_demo_mode_check=%d\n", Gameplay_InCsMode(globalCtx)); osSyncPrintf("Game_play_demo_mode_check=%d\n", Gameplay_InCsMode(globalCtx));
// clang-format off // clang-format off
if (!R_MINIMAP_DISABLED) { Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_UP, &gSfxDefaultPos, 4, if (!R_MINIMAP_DISABLED) { Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_UP, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
else { Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_DOWN, &gSfxDefaultPos, 4, &gSfxDefaultReverb);
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } else {
Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_DOWN, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultReverb);
}
// clang-format on // clang-format on
R_MINIMAP_DISABLED ^= 1; R_MINIMAP_DISABLED ^= 1;
} }
@ -492,9 +496,13 @@ void Minimap_Draw(GlobalContext* globalCtx) {
if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_L) && !Gameplay_InCsMode(globalCtx)) { if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_L) && !Gameplay_InCsMode(globalCtx)) {
// clang-format off // clang-format off
if (!R_MINIMAP_DISABLED) { Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_UP, &gSfxDefaultPos, 4, if (!R_MINIMAP_DISABLED) { Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_UP, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
else { Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_DOWN, &gSfxDefaultPos, 4, &gSfxDefaultReverb);
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } else {
Audio_PlaySoundGeneral(NA_SE_SY_CAMERA_ZOOM_DOWN, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultReverb);
}
// clang-format on // clang-format on
R_MINIMAP_DISABLED ^= 1; R_MINIMAP_DISABLED ^= 1;
} }

View file

@ -743,7 +743,11 @@ u16 Message_DrawItemIcon(GlobalContext* globalCtx, u16 itemId, Gfx** p, u16 i) {
MessageContext* msgCtx = &globalCtx->msgCtx; MessageContext* msgCtx = &globalCtx->msgCtx;
// clang-format off // clang-format off
if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Audio_PlaySoundGeneral(0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Audio_PlaySoundGeneral(0, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale,
&gSfxDefaultReverb);
}
// clang-format on // clang-format on
gDPPipeSync(gfx++); gDPPipeSync(gfx++);
@ -993,7 +997,11 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) {
break; break;
case MESSAGE_BACKGROUND: case MESSAGE_BACKGROUND:
// clang-format off // clang-format off
if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Audio_PlaySoundGeneral(0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { Audio_PlaySoundGeneral(0, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale,
&gSfxDefaultReverb);
}
// clang-format on // clang-format on
gDPPipeSync(gfx++); gDPPipeSync(gfx++);
gDPSetCombineMode(gfx++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetCombineMode(gfx++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);

View file

@ -1080,14 +1080,12 @@ void Interface_SetSceneRestrictions(GlobalContext* globalCtx) {
s16 i; s16 i;
u8 currentScene; u8 currentScene;
// clang-format off interfaceCtx->restrictions.hGauge = interfaceCtx->restrictions.bButton = interfaceCtx->restrictions.aButton =
interfaceCtx->restrictions.hGauge = interfaceCtx->restrictions.bButton = interfaceCtx->restrictions.bottles = interfaceCtx->restrictions.tradeItems =
interfaceCtx->restrictions.aButton = interfaceCtx->restrictions.bottles = interfaceCtx->restrictions.hookshot = interfaceCtx->restrictions.ocarina =
interfaceCtx->restrictions.tradeItems = interfaceCtx->restrictions.hookshot = interfaceCtx->restrictions.warpSongs = interfaceCtx->restrictions.sunsSong =
interfaceCtx->restrictions.ocarina = interfaceCtx->restrictions.warpSongs = interfaceCtx->restrictions.farores = interfaceCtx->restrictions.dinsNayrus =
interfaceCtx->restrictions.sunsSong = interfaceCtx->restrictions.farores = interfaceCtx->restrictions.all = 0;
interfaceCtx->restrictions.dinsNayrus = interfaceCtx->restrictions.all = 0;
// clang-format on
i = 0; i = 0;
@ -2108,7 +2106,9 @@ void Interface_SetNaviCall(GlobalContext* globalCtx, u16 naviCallState) {
(globalCtx->csCtx.state == CS_STATE_IDLE)) { (globalCtx->csCtx.state == CS_STATE_IDLE)) {
// clang-format off // clang-format off
if (naviCallState == 0x1E) { Audio_PlaySoundGeneral(NA_SE_VO_NAVY_CALL, &gSfxDefaultPos, 4, if (naviCallState == 0x1E) { Audio_PlaySoundGeneral(NA_SE_VO_NAVY_CALL, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultReverb);
}
// clang-format on // clang-format on
if (naviCallState == 0x1D) { if (naviCallState == 0x1D) {
@ -2155,7 +2155,8 @@ s32 Health_ChangeBy(GlobalContext* globalCtx, s16 healthChange) {
// clang-format off // clang-format off
if (healthChange > 0) { Audio_PlaySoundGeneral(NA_SE_SY_HP_RECOVER, &gSfxDefaultPos, 4, if (healthChange > 0) { Audio_PlaySoundGeneral(NA_SE_SY_HP_RECOVER, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultReverb);
} else if (gSaveContext.doubleDefense && (healthChange < 0)) { } else if (gSaveContext.doubleDefense && (healthChange < 0)) {
healthChange >>= 1; healthChange >>= 1;
osSyncPrintf("ハート減少半分!!=%d\n", healthChange); // "Heart decrease halved!!%d" osSyncPrintf("ハート減少半分!!=%d\n", healthChange); // "Heart decrease halved!!%d"
@ -2914,26 +2915,19 @@ void Interface_InitVertices(GlobalContext* globalCtx) {
interfaceCtx->actionVtx = Graph_Alloc(globalCtx->state.gfxCtx, 8 * sizeof(Vtx)); interfaceCtx->actionVtx = Graph_Alloc(globalCtx->state.gfxCtx, 8 * sizeof(Vtx));
// clang-format off interfaceCtx->actionVtx[0].v.ob[0] = interfaceCtx->actionVtx[2].v.ob[0] = -14;
interfaceCtx->actionVtx[0].v.ob[0] = interfaceCtx->actionVtx[1].v.ob[0] = interfaceCtx->actionVtx[3].v.ob[0] = interfaceCtx->actionVtx[0].v.ob[0] + 28;
interfaceCtx->actionVtx[2].v.ob[0] = -14;
interfaceCtx->actionVtx[1].v.ob[0] =
interfaceCtx->actionVtx[3].v.ob[0] = interfaceCtx->actionVtx[0].v.ob[0] + 28;
interfaceCtx->actionVtx[0].v.ob[1] = interfaceCtx->actionVtx[0].v.ob[1] = interfaceCtx->actionVtx[1].v.ob[1] = 14;
interfaceCtx->actionVtx[1].v.ob[1] = 14; interfaceCtx->actionVtx[2].v.ob[1] = interfaceCtx->actionVtx[3].v.ob[1] = interfaceCtx->actionVtx[0].v.ob[1] - 28;
interfaceCtx->actionVtx[2].v.ob[1] =
interfaceCtx->actionVtx[3].v.ob[1] = interfaceCtx->actionVtx[0].v.ob[1] - 28;
interfaceCtx->actionVtx[4].v.ob[0] = interfaceCtx->actionVtx[4].v.ob[0] = interfaceCtx->actionVtx[6].v.ob[0] = -(XREG(21) / 2);
interfaceCtx->actionVtx[6].v.ob[0] = -(XREG(21) / 2); interfaceCtx->actionVtx[5].v.ob[0] = interfaceCtx->actionVtx[7].v.ob[0] =
interfaceCtx->actionVtx[5].v.ob[0] = interfaceCtx->actionVtx[4].v.ob[0] + XREG(21);
interfaceCtx->actionVtx[7].v.ob[0] = interfaceCtx->actionVtx[4].v.ob[0] + XREG(21);
interfaceCtx->actionVtx[4].v.ob[1] = interfaceCtx->actionVtx[4].v.ob[1] = interfaceCtx->actionVtx[5].v.ob[1] = XREG(28) / 2;
interfaceCtx->actionVtx[5].v.ob[1] = XREG(28) / 2; interfaceCtx->actionVtx[6].v.ob[1] = interfaceCtx->actionVtx[7].v.ob[1] =
interfaceCtx->actionVtx[6].v.ob[1] = interfaceCtx->actionVtx[4].v.ob[1] - XREG(28);
interfaceCtx->actionVtx[7].v.ob[1] = interfaceCtx->actionVtx[4].v.ob[1] - XREG(28);
for (i = 0; i < 8; i += 4) { for (i = 0; i < 8; i += 4) {
interfaceCtx->actionVtx[i].v.ob[2] = interfaceCtx->actionVtx[i + 1].v.ob[2] = interfaceCtx->actionVtx[i].v.ob[2] = interfaceCtx->actionVtx[i + 1].v.ob[2] =
@ -2986,8 +2980,8 @@ void Interface_InitVertices(GlobalContext* globalCtx) {
interfaceCtx->beatingHeartVtx[0].v.cn[2] = interfaceCtx->beatingHeartVtx[1].v.cn[2] = interfaceCtx->beatingHeartVtx[0].v.cn[2] = interfaceCtx->beatingHeartVtx[1].v.cn[2] =
interfaceCtx->beatingHeartVtx[2].v.cn[2] = interfaceCtx->beatingHeartVtx[3].v.cn[2] = interfaceCtx->beatingHeartVtx[2].v.cn[2] = interfaceCtx->beatingHeartVtx[3].v.cn[2] =
interfaceCtx->beatingHeartVtx[0].v.cn[3] = interfaceCtx->beatingHeartVtx[1].v.cn[3] = interfaceCtx->beatingHeartVtx[0].v.cn[3] = interfaceCtx->beatingHeartVtx[1].v.cn[3] =
interfaceCtx->beatingHeartVtx[2].v.cn[3] = interfaceCtx->beatingHeartVtx[3].v.cn[3] = 255; interfaceCtx->beatingHeartVtx[2].v.cn[3] = interfaceCtx->beatingHeartVtx[3].v.cn[3] =
// clang-format on 255;
} }
void func_8008A8B8(GlobalContext* globalCtx, s32 topY, s32 bottomY, s32 leftX, s32 rightX) { void func_8008A8B8(GlobalContext* globalCtx, s32 topY, s32 bottomY, s32 leftX, s32 rightX) {

View file

@ -288,7 +288,8 @@ void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx2) {
this->primXluColor[1] = 255; this->primXluColor[1] = 255;
this->primXluColor[2] = 255; this->primXluColor[2] = 255;
// clang-format off // clang-format off
this->envXluColor[0] = 200; this->envXluColor[1] = 50; this->envXluColor[2] = 255; // Sameline prevents reordering // Sameline prevents reordering
this->envXluColor[0] = 200; this->envXluColor[1] = 50; this->envXluColor[2] = 255;
// clang-format on // clang-format on
break; break;