1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-29 03:34:07 +00:00

Add comments and macros to prevent match issues with formatting

This commit is contained in:
Roman971 2020-03-18 22:18:25 +01:00
parent 0704beba8d
commit 251aea64ab
9 changed files with 33 additions and 20 deletions

View file

@ -35,4 +35,8 @@
#define CAPACITY(upg, value) gUpgradeCapacities[upg][value] #define CAPACITY(upg, value) gUpgradeCapacities[upg][value]
#define CUR_CAPACITY(upg) CAPACITY(upg, CUR_UPG_VALUE(upg)) #define CUR_CAPACITY(upg) CAPACITY(upg, CUR_UPG_VALUE(upg))
#define SET_NEXT_GAMESTATE(curState, newInit, newStruct) \
(curState)->init = newInit; \
(curState)->size = sizeof(newStruct);
#endif #endif

View file

@ -21,7 +21,7 @@
#define VT_ESC "\x1b" #define VT_ESC "\x1b"
#define VT_CSI "[" #define VT_CSI "["
#define VT_CUP(x, y) VT_ESC VT_CSI #y ";" #x "H" #define VT_CUP(x, y) VT_ESC VT_CSI y ";" x "H"
#define VT_ED(n) VT_ESC VT_CSI #n "J" #define VT_ED(n) VT_ESC VT_CSI #n "J"
#define VT_SGR(n) VT_ESC VT_CSI n "m" #define VT_SGR(n) VT_ESC VT_CSI n "m"

View file

@ -175,7 +175,7 @@ void FaultDrawer_SetCharPad(s8 padW, s8 padH)
void FaultDrawer_SetCursor(s32 x, s32 y) void FaultDrawer_SetCursor(s32 x, s32 y)
{ {
if (sFaultDrawerStruct.osSyncPrintfEnabled) if (sFaultDrawerStruct.osSyncPrintfEnabled)
osSyncPrintf(VT_CUP(%d, %d), (y - sFaultDrawerStruct.yStart) / (sFaultDrawerStruct.charH + sFaultDrawerStruct.charHPad), (x - sFaultDrawerStruct.xStart) / (sFaultDrawerStruct.charW + sFaultDrawerStruct.charWPad)); osSyncPrintf(VT_CUP("%d", "%d"), (y - sFaultDrawerStruct.yStart) / (sFaultDrawerStruct.charH + sFaultDrawerStruct.charHPad), (x - sFaultDrawerStruct.xStart) / (sFaultDrawerStruct.charW + sFaultDrawerStruct.charWPad));
sFaultDrawerStruct.cursorX = x; sFaultDrawerStruct.cursorX = x;
sFaultDrawerStruct.cursorY = y; sFaultDrawerStruct.cursorY = y;
} }

View file

@ -6,7 +6,7 @@ void TitleSetup_InitImpl(GameState* gameState)
osSyncPrintf("ゼルダ共通データ初期化\n"); osSyncPrintf("ゼルダ共通データ初期化\n");
SaveContext_Init(); SaveContext_Init();
gameState->running = false; gameState->running = false;
gameState->init = Title_Init; gameState->size = sizeof(TitleContext); SET_NEXT_GAMESTATE(gameState, Title_Init, TitleContext);
} }
void TitleSetup_Destroy(GameState* gameState) void TitleSetup_Destroy(GameState* gameState)

View file

@ -2434,9 +2434,14 @@ void Interface_SetNaviCall(GlobalContext* globalCtx, u16 naviCallState)
!interfaceCtx->naviCalling && !interfaceCtx->naviCalling &&
(globalCtx->csCtx.state == 0)) (globalCtx->csCtx.state == 0))
{ {
// Whitespace matters for codegen here // clang-format off
if (naviCallState == 0x1E) Audio_PlaySoundGeneral(NA_SE_VO_NAVY_CALL, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); // NOLINTNEXTLINE
if (naviCallState == 0x1D) func_800F4524(&D_801333D4, NA_SE_VO_NA_HELLO_2, 32); if (naviCallState == 0x1E) Audio_PlaySoundGeneral(NA_SE_VO_NAVY_CALL, &D_801333D4, 4,
&D_801333E0, &D_801333E0, &D_801333E8);
// clang-format on
if (naviCallState == 0x1D)
func_800F4524(&D_801333D4, NA_SE_VO_NA_HELLO_2, 32);
interfaceCtx->naviCalling = 1; interfaceCtx->naviCalling = 1;
sCUpInvisible = 0; sCUpInvisible = 0;
@ -2478,14 +2483,16 @@ s32 Health_ChangeBy(GlobalContext* globalCtx, s16 healthChange)
// Translates to: " Fluctuation=%d (now=%d, max=%d) " // Translates to: " Fluctuation=%d (now=%d, max=%d) "
osSyncPrintf(" 増減=%d (now=%d, max=%d) ", healthChange, gSaveContext.health, gSaveContext.health_capacity); osSyncPrintf(" 増減=%d (now=%d, max=%d) ", healthChange, gSaveContext.health, gSaveContext.health_capacity);
// Whitespace matters for codegen here // clang-format off
if (healthChange > 0) Audio_PlaySoundGeneral(NA_SE_SY_HP_RECOVER, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); // NOLINTNEXTLINE
else if ((gSaveContext.double_defense != 0) && (healthChange < 0)) if (healthChange > 0) Audio_PlaySoundGeneral(NA_SE_SY_HP_RECOVER, &D_801333D4, 4,
{ &D_801333E0, &D_801333E0, &D_801333E8);
else if ((gSaveContext.double_defense != 0) && (healthChange < 0)) {
healthChange >>= 1; healthChange >>= 1;
// Translates to: "Heart decrease halved!!%d" // Translates to: "Heart decrease halved!!%d"
osSyncPrintf("ハート減少半分!!=%d\n", healthChange); osSyncPrintf("ハート減少半分!!=%d\n", healthChange);
} }
// clang-format on
gSaveContext.health += healthChange; gSaveContext.health += healthChange;
@ -3582,9 +3589,10 @@ void func_8008A994(InterfaceContext* interfaceCtx)
{ {
s32 sp18[4]; s32 sp18[4];
// Whitespace matters for codegen here // clang-format off
sp18[1] = 240; sp18[3] = 320; sp18[1] = SCREEN_HEIGHT; sp18[3] = SCREEN_WIDTH;
sp18[0] = 0; sp18[2] = 0; sp18[0] = 0; sp18[2] = 0;
// clang-format on
func_800AA4FC(&interfaceCtx->view, sp18); func_800AA4FC(&interfaceCtx->view, sp18);
func_800AB2C4(&interfaceCtx->view); func_800AB2C4(&interfaceCtx->view);

View file

@ -6,7 +6,7 @@ void Sample_Calc(SampleContext* this)
{ {
if (!~(this->state.input[0].padPressed | ~START_BUTTON)) if (!~(this->state.input[0].padPressed | ~START_BUTTON))
{ {
this->state.init = func_800BCA64; this->state.size = sizeof(GlobalContext); SET_NEXT_GAMESTATE(&this->state, func_800BCA64, GlobalContext);
this->state.running = false; this->state.running = false;
} }
} }
@ -73,9 +73,10 @@ void Sample_SetupView(SampleContext* this)
gfxCtx = this->state.gfxCtx; gfxCtx = this->state.gfxCtx;
func_800AA278(view, gfxCtx); func_800AA278(view, gfxCtx);
// clang-format off
v0[1] = SCREEN_HEIGHT; v0[3] = SCREEN_WIDTH; v0[1] = SCREEN_HEIGHT; v0[3] = SCREEN_WIDTH;
v0[0] = 0; v0[0] = 0; v0[2] = 0;
v0[2] = 0; // clang-format on
func_800AA4FC(view, &v0); func_800AA4FC(view, &v0);
func_800AA460(view, 60, 10, 12800); func_800AA460(view, 60, 10, 12800);

View file

@ -110,11 +110,8 @@ void func_8097C930(DemoGo* this)
s16* something = &this->unk_192; s16* something = &this->unk_192;
s16* other = &this->unk_190; s16* other = &this->unk_190;
s32 pad[3]; s32 pad[3];
s16 phi_v0;
if (*something == 0) { phi_v0 = 0; } else { *something -= 1; phi_v0 = *something;} if (DECR(*something) == 0)
if (phi_v0 == 0)
{ {
*something = Math_Rand_S16Offset(0x3C, 0x3C); *something = Math_Rand_S16Offset(0x3C, 0x3C);
} }

View file

@ -849,7 +849,10 @@ static void EnWallmas_DrawXlu(EnWallmas *this, GlobalContext *globalCtx)
return; return;
} }
// clang-format off
gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfx, globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1386); gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfx, globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1386);
// clang-format on
func_80094044(globalCtx->state.gfxCtx); func_80094044(globalCtx->state.gfxCtx);
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 0x00, 0x00, 0x00, 0xFF); gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 0x00, 0x00, 0x00, 0xFF);

View file

@ -15,7 +15,7 @@ static void Opening_SetNextGameState(OpeningContext* this)
func_800A82C8(); func_800A82C8();
gSaveContext.cutscene_index = 0xFFF3; gSaveContext.cutscene_index = 0xFFF3;
gSaveContext.scene_setup_index = 7; gSaveContext.scene_setup_index = 7;
this->state.init = func_800BCA64; this->state.size = sizeof(GlobalContext); SET_NEXT_GAMESTATE(&this->state, func_800BCA64, GlobalContext);
} }
static void func_80803C5C(OpeningContext* this) static void func_80803C5C(OpeningContext* this)