From 4b08a511c3f587cf9f8d659984b50dad4cc49fc4 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sun, 7 Aug 2022 22:40:15 -0400 Subject: [PATCH 1/6] Cleanup from https://github.com/pret/pokefirered/pull/532 --- gflib/text.c | 6 +- gflib/window.c | 16 ++-- include/battle_main.h | 6 +- include/battle_util.h | 1 - include/constants/battle.h | 5 ++ src/battle_arena.c | 6 +- src/battle_controller_player.c | 14 ++-- src/battle_dome.c | 104 ++++++++++++------------- src/battle_gfx_sfx_util.c | 4 +- src/battle_main.c | 127 +++++++++++++++---------------- src/battle_message.c | 10 +-- src/battle_util.c | 51 +++++++------ src/fldeff_cut.c | 2 +- src/librfu_rfu.c | 76 +++++++++--------- src/librfu_stwi.c | 4 +- src/map_name_popup.c | 2 +- src/mauville_old_man.c | 4 +- src/pokemon.c | 4 +- src/pokemon_summary_screen.c | 6 +- src/rom_header_gf.c | 4 +- src/scrcmd.c | 2 +- src/trader.c | 2 +- tools/jsonproc/inja.hpp | 4 +- tools/jsonproc/nlohmann/json.hpp | 30 ++++---- 24 files changed, 247 insertions(+), 243 deletions(-) diff --git a/gflib/text.c b/gflib/text.c index c7efdccce..9d7e14efa 100644 --- a/gflib/text.c +++ b/gflib/text.c @@ -301,7 +301,7 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, voi sTempTextPrinter.textSpeed = 0; // Render all text (up to limit) at once - for (j = 0; j < 0x400; ++j) + for (j = 0; j < 0x400; j++) { if (RenderFont(&sTempTextPrinter) == RENDER_FINISH) break; @@ -322,7 +322,7 @@ void RunTextPrinters(void) if (!gDisableTextPrinters) { - for (i = 0; i < NUM_TEXT_PRINTERS; ++i) + for (i = 0; i < NUM_TEXT_PRINTERS; i++) { if (sTextPrinters[i].active) { @@ -1318,7 +1318,7 @@ static u32 (*GetFontWidthFunc(u8 fontId))(u16, bool32) { u32 i; - for (i = 0; i < ARRAY_COUNT(sGlyphWidthFuncs); ++i) + for (i = 0; i < ARRAY_COUNT(sGlyphWidthFuncs); i++) { if (fontId == sGlyphWidthFuncs[i].fontId) return sGlyphWidthFuncs[i].func; diff --git a/gflib/window.c b/gflib/window.c index ff9e8a6e0..27faac384 100644 --- a/gflib/window.c +++ b/gflib/window.c @@ -38,7 +38,7 @@ bool16 InitWindows(const struct WindowTemplate *templates) u8 *allocatedTilemapBuffer; int allocatedBaseBlock; - for (i = 0; i < NUM_BACKGROUNDS; ++i) + for (i = 0; i < NUM_BACKGROUNDS; i++) { bgTilemapBuffer = GetBgTilemapBuffer(i); if (bgTilemapBuffer != NULL) @@ -47,7 +47,7 @@ bool16 InitWindows(const struct WindowTemplate *templates) gWindowBgTilemapBuffers[i] = bgTilemapBuffer; } - for (i = 0; i < WINDOWS_MAX; ++i) + for (i = 0; i < WINDOWS_MAX; i++) { gWindows[i].window = sDummyWindowTemplate; gWindows[i].tileData = NULL; @@ -76,7 +76,7 @@ bool16 InitWindows(const struct WindowTemplate *templates) return FALSE; } - for (j = 0; j < attrib; ++j) + for (j = 0; j < attrib; j++) allocatedTilemapBuffer[j] = 0; gWindowBgTilemapBuffers[bgLayer] = allocatedTilemapBuffer; @@ -151,7 +151,7 @@ u16 AddWindow(const struct WindowTemplate *template) if (allocatedTilemapBuffer == NULL) return WINDOW_NONE; - for (i = 0; i < attrib; ++i) + for (i = 0; i < attrib; i++) allocatedTilemapBuffer[i] = 0; gWindowBgTilemapBuffers[bgLayer] = allocatedTilemapBuffer; @@ -249,7 +249,7 @@ void FreeAllWindowBuffers(void) { int i; - for (i = 0; i < NUM_BACKGROUNDS; ++i) + for (i = 0; i < NUM_BACKGROUNDS; i++) { if (gWindowBgTilemapBuffers[i] != NULL && gWindowBgTilemapBuffers[i] != DummyWindowBgTilemap) { @@ -258,7 +258,7 @@ void FreeAllWindowBuffers(void) } } - for (i = 0; i < WINDOWS_MAX; ++i) + for (i = 0; i < WINDOWS_MAX; i++) { if (gWindows[i].tileData != NULL) { @@ -342,7 +342,7 @@ void PutWindowRectTilemapOverridePalette(u8 windowId, u8 x, u8 y, u8 width, u8 h u16 currentRow = windowLocal.window.baseBlock + (y * windowLocal.window.width) + x + GetBgAttribute(windowLocal.window.bg, BG_ATTR_BASETILE); int i; - for (i = 0; i < height; ++i) + for (i = 0; i < height; i++) { WriteSequenceToBgTilemapBuffer( windowLocal.window.bg, @@ -379,7 +379,7 @@ void PutWindowRectTilemap(u8 windowId, u8 x, u8 y, u8 width, u8 height) u16 currentRow = windowLocal.window.baseBlock + (y * windowLocal.window.width) + x + GetBgAttribute(windowLocal.window.bg, BG_ATTR_BASETILE); int i; - for (i = 0; i < height; ++i) + for (i = 0; i < height; i++) { WriteSequenceToBgTilemapBuffer( windowLocal.window.bg, diff --git a/include/battle_main.h b/include/battle_main.h index 96efe9ded..e3e0cb7ea 100644 --- a/include/battle_main.h +++ b/include/battle_main.h @@ -50,11 +50,11 @@ void SpriteCB_VsLetterInit(struct Sprite *sprite); void CB2_InitEndLinkBattle(void); u32 GetBattleBgTemplateData(u8 arrayId, u8 caseId); u32 GetBattleWindowTemplatePixelWidth(u32 setId, u32 tableId); -void SpriteCb_WildMon(struct Sprite *sprite); +void SpriteCB_WildMon(struct Sprite *sprite); void SpriteCallbackDummy_2(struct Sprite *sprite); void SpriteCB_FaintOpponentMon(struct Sprite *sprite); -void SpriteCb_ShowAsMoveTarget(struct Sprite *sprite); -void SpriteCb_HideAsMoveTarget(struct Sprite *sprite); +void SpriteCB_ShowAsMoveTarget(struct Sprite *sprite); +void SpriteCB_HideAsMoveTarget(struct Sprite *sprite); void SpriteCB_OpponentMonFromBall(struct Sprite *sprite); void SpriteCB_BattleSpriteStartSlideLeft(struct Sprite *sprite); void SpriteCB_FaintSlideAnim(struct Sprite *sprite); diff --git a/include/battle_util.h b/include/battle_util.h index 8428be8d9..c7de9aae8 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -64,7 +64,6 @@ u8 GetBattlerForBattleScript(u8 caseId); void PressurePPLose(u8 target, u8 attacker, u16 move); void PressurePPLoseOnUsingPerishSong(u8 attacker); void PressurePPLoseOnUsingImprison(u8 attacker); -void MarkAllBattlersForControllerExec(void); // unused void MarkBattlerForControllerExec(u8 battlerId); void MarkBattlerReceivedLinkData(u8 battlerId); void CancelMultiTurnMoves(u8 battlerId); diff --git a/include/constants/battle.h b/include/constants/battle.h index 2c35c5657..41bdb7a88 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -316,6 +316,11 @@ #define FLEE_ITEM 1 #define FLEE_ABILITY 2 +// Return value for IsRunningFromBattleImpossible. +#define BATTLE_RUN_SUCCESS 0 +#define BATTLE_RUN_FORBIDDEN 1 +#define BATTLE_RUN_FAILURE 2 + #define B_WIN_TYPE_NORMAL 0 #define B_WIN_TYPE_ARENA 1 diff --git a/src/battle_arena.c b/src/battle_arena.c index 92b7c66a3..36f728601 100644 --- a/src/battle_arena.c +++ b/src/battle_arena.c @@ -35,7 +35,7 @@ static void SaveArenaChallenge(void); static void SetArenaPrize(void); static void GiveArenaPrize(void); static void BufferArenaOpponentName(void); -static void SpriteCb_JudgmentIcon(struct Sprite *sprite); +static void SpriteCB_JudgmentIcon(struct Sprite *sprite); static void ShowJudgmentSprite(u8 x, u8 y, u8 category, u8 battler); static const s8 sMindRatings[] = @@ -456,7 +456,7 @@ static const struct SpriteTemplate sSpriteTemplate_JudgmentIcon = .anims = sJudgementIconAnimCmds, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = SpriteCb_JudgmentIcon, + .callback = SpriteCB_JudgmentIcon, }; static const struct CompressedSpriteSheet sBattleArenaJudgementSymbolsSpriteSheet[] = @@ -679,7 +679,7 @@ static void ShowJudgmentSprite(u8 x, u8 y, u8 category, u8 battler) StartSpriteAnim(&gSprites[pointsPlayer], animNum); } -static void SpriteCb_JudgmentIcon(struct Sprite *sprite) +static void SpriteCB_JudgmentIcon(struct Sprite *sprite) { if (gBattleCommunication[0] > 8) DestroySprite(sprite); diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 272e0120c..cf74fefbe 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -364,7 +364,7 @@ static void HandleInputChooseTarget(void) if (JOY_NEW(A_BUTTON)) { PlaySE(SE_SELECT); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_HideAsMoveTarget; BtlController_EmitTwoReturnValues(BUFFER_B, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8)); EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX); PlayerBufferExecCompleted(); @@ -372,7 +372,7 @@ static void HandleInputChooseTarget(void) else if (JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59) { PlaySE(SE_SELECT); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_HideAsMoveTarget; gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove; DoBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX, 7, 1); DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1); @@ -381,7 +381,7 @@ static void HandleInputChooseTarget(void) else if (JOY_NEW(DPAD_LEFT | DPAD_UP)) { PlaySE(SE_SELECT); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_HideAsMoveTarget; do { @@ -422,12 +422,12 @@ static void HandleInputChooseTarget(void) if (gAbsentBattlerFlags & gBitTable[gMultiUsePlayerCursor]) i = 0; } while (i == 0); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_ShowAsMoveTarget; } else if (JOY_NEW(DPAD_RIGHT | DPAD_DOWN)) { PlaySE(SE_SELECT); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_HideAsMoveTarget; do { @@ -464,7 +464,7 @@ static void HandleInputChooseTarget(void) if (gAbsentBattlerFlags & gBitTable[gMultiUsePlayerCursor]) i = 0; } while (i == 0); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_ShowAsMoveTarget; } } @@ -537,7 +537,7 @@ static void HandleInputChooseMove(void) else gMultiUsePlayerCursor = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); - gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget; + gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_ShowAsMoveTarget; } } else if (JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59) diff --git a/src/battle_dome.c b/src/battle_dome.c index e82470d9a..45aed3ca8 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -108,8 +108,8 @@ static u8 UpdateTourneyTreeCursor(u8); static void DecideRoundWinners(u8); static u8 GetOpposingNPCTournamentIdByRound(u8, u8); static void DrawTourneyAdvancementLine(u8, u8); -static void SpriteCb_HorizontalScrollArrow(struct Sprite *); -static void SpriteCb_VerticalScrollArrow(struct Sprite *); +static void SpriteCB_HorizontalScrollArrow(struct Sprite *); +static void SpriteCB_VerticalScrollArrow(struct Sprite *); static void InitDomeChallenge(void); static void GetDomeData(void); static void SetDomeData(void); @@ -1089,7 +1089,7 @@ static const struct SpriteTemplate sHorizontalScrollArrowSpriteTemplate = .anims = sSpriteAnimTable_HorizontalScrollArrow, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = SpriteCb_HorizontalScrollArrow + .callback = SpriteCB_HorizontalScrollArrow }; static const struct SpriteTemplate sVerticalScrollArrowSpriteTemplate = @@ -1100,7 +1100,7 @@ static const struct SpriteTemplate sVerticalScrollArrowSpriteTemplate = .anims = sSpriteAnimTable_VerticalScrollArrow, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = SpriteCb_VerticalScrollArrow + .callback = SpriteCB_VerticalScrollArrow }; // Organized by seed starting position, i.e. seed 0 battles seed 8 first @@ -3115,7 +3115,7 @@ static void Task_ShowTourneyInfoCard(u8 taskId) // Note: Card scrolling up means the current card goes down and another one appears from top. // The same is true for scrolling left. // That means that the sprite needs to move with the moving card in the opposite scrolling direction. -static void SpriteCb_TrainerIconCardScrollUp(struct Sprite *sprite) +static void SpriteCB_TrainerIconCardScrollUp(struct Sprite *sprite) { sprite->y += 4; if (sprite->data[0] != 0) @@ -3135,7 +3135,7 @@ static void SpriteCb_TrainerIconCardScrollUp(struct Sprite *sprite) } } -static void SpriteCb_TrainerIconCardScrollDown(struct Sprite *sprite) +static void SpriteCB_TrainerIconCardScrollDown(struct Sprite *sprite) { sprite->y -= 4; if (sprite->data[0] != 0) @@ -3155,7 +3155,7 @@ static void SpriteCb_TrainerIconCardScrollDown(struct Sprite *sprite) } } -static void SpriteCb_TrainerIconCardScrollLeft(struct Sprite *sprite) +static void SpriteCB_TrainerIconCardScrollLeft(struct Sprite *sprite) { sprite->x += 4; if (sprite->data[0] != 0) @@ -3175,7 +3175,7 @@ static void SpriteCb_TrainerIconCardScrollLeft(struct Sprite *sprite) } } -static void SpriteCb_TrainerIconCardScrollRight(struct Sprite *sprite) +static void SpriteCB_TrainerIconCardScrollRight(struct Sprite *sprite) { sprite->x -= 4; if (sprite->data[0] != 0) @@ -3197,13 +3197,13 @@ static void SpriteCb_TrainerIconCardScrollRight(struct Sprite *sprite) #define sMonIconStill data[3] -static void SpriteCb_MonIcon(struct Sprite *sprite) +static void SpriteCB_MonIconDomeInfo(struct Sprite *sprite) { if (!sprite->sMonIconStill) UpdateMonIconFrame(sprite); } -static void SpriteCb_MonIconCardScrollUp(struct Sprite *sprite) +static void SpriteCB_MonIconCardScrollUp(struct Sprite *sprite) { if (!sprite->sMonIconStill) UpdateMonIconFrame(sprite); @@ -3213,7 +3213,7 @@ static void SpriteCb_MonIconCardScrollUp(struct Sprite *sprite) if (sprite->y >= -16) sprite->invisible = FALSE; if (++sprite->data[1] == 40) - sprite->callback = SpriteCb_MonIcon; + sprite->callback = SpriteCB_MonIconDomeInfo; } else { @@ -3225,7 +3225,7 @@ static void SpriteCb_MonIconCardScrollUp(struct Sprite *sprite) } } -static void SpriteCb_MonIconCardScrollDown(struct Sprite *sprite) +static void SpriteCB_MonIconCardScrollDown(struct Sprite *sprite) { if (!sprite->sMonIconStill) UpdateMonIconFrame(sprite); @@ -3235,7 +3235,7 @@ static void SpriteCb_MonIconCardScrollDown(struct Sprite *sprite) if (sprite->y <= 176) sprite->invisible = FALSE; if (++sprite->data[1] == 40) - sprite->callback = SpriteCb_MonIcon; + sprite->callback = SpriteCB_MonIconDomeInfo; } else { @@ -3247,7 +3247,7 @@ static void SpriteCb_MonIconCardScrollDown(struct Sprite *sprite) } } -static void SpriteCb_MonIconCardScrollLeft(struct Sprite *sprite) +static void SpriteCB_MonIconCardScrollLeft(struct Sprite *sprite) { if (!sprite->sMonIconStill) UpdateMonIconFrame(sprite); @@ -3257,7 +3257,7 @@ static void SpriteCb_MonIconCardScrollLeft(struct Sprite *sprite) if (sprite->x >= -16) sprite->invisible = FALSE; if (++sprite->data[1] == 64) - sprite->callback = SpriteCb_MonIcon; + sprite->callback = SpriteCB_MonIconDomeInfo; } else { @@ -3269,7 +3269,7 @@ static void SpriteCb_MonIconCardScrollLeft(struct Sprite *sprite) } } -static void SpriteCb_MonIconCardScrollRight(struct Sprite *sprite) +static void SpriteCB_MonIconCardScrollRight(struct Sprite *sprite) { if (!sprite->sMonIconStill) UpdateMonIconFrame(sprite); @@ -3279,7 +3279,7 @@ static void SpriteCb_MonIconCardScrollRight(struct Sprite *sprite) if (sprite->x <= DISPLAY_WIDTH + 16) sprite->invisible = FALSE; if (++sprite->data[1] == 64) - sprite->callback = SpriteCb_MonIcon; + sprite->callback = SpriteCB_MonIconDomeInfo; } else { @@ -3291,7 +3291,7 @@ static void SpriteCb_MonIconCardScrollRight(struct Sprite *sprite) } } -static void SpriteCb_HorizontalScrollArrow(struct Sprite *sprite) +static void SpriteCB_HorizontalScrollArrow(struct Sprite *sprite) { int taskId1 = sprite->data[0]; int arrId = gTasks[gTasks[taskId1].data[4]].data[1]; @@ -3360,7 +3360,7 @@ static void SpriteCb_HorizontalScrollArrow(struct Sprite *sprite) } } -static void SpriteCb_VerticalScrollArrow(struct Sprite *sprite) +static void SpriteCB_VerticalScrollArrow(struct Sprite *sprite) { int taskId1 = sprite->data[0]; @@ -3526,7 +3526,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollUp; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_TrainerIconCardScrollUp; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3537,7 +3537,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollUp; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_MonIconCardScrollUp; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3550,7 +3550,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollUp; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_TrainerIconCardScrollUp; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3561,7 +3561,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollUp; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_MonIconCardScrollUp; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3642,7 +3642,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollDown; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_TrainerIconCardScrollDown; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3653,7 +3653,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollDown; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_MonIconCardScrollDown; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3666,7 +3666,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollDown; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_TrainerIconCardScrollDown; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3677,7 +3677,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollDown; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_MonIconCardScrollDown; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3725,7 +3725,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollLeft; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_TrainerIconCardScrollLeft; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3736,7 +3736,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollLeft; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_MonIconCardScrollLeft; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3749,7 +3749,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollLeft; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_TrainerIconCardScrollLeft; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3760,7 +3760,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollLeft; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_MonIconCardScrollLeft; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3808,7 +3808,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollLeft; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_TrainerIconCardScrollLeft; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3819,7 +3819,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollLeft; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_MonIconCardScrollLeft; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3832,7 +3832,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollLeft; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_TrainerIconCardScrollLeft; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3843,7 +3843,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollLeft; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_MonIconCardScrollLeft; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3889,7 +3889,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollRight; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_TrainerIconCardScrollRight; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3900,7 +3900,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollRight; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_MonIconCardScrollRight; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3913,7 +3913,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollRight; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_TrainerIconCardScrollRight; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3924,7 +3924,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollRight; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_MonIconCardScrollRight; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3972,7 +3972,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollRight; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_TrainerIconCardScrollRight; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3983,7 +3983,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollRight; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_MonIconCardScrollRight; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot ^ 1; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -3996,7 +3996,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_TrainerIconCardScrollRight; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_TrainerIconCardScrollRight; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -4007,7 +4007,7 @@ static void Task_HandleInfoCardInput(u8 taskId) { if (sInfoCard->spriteIds[i] != SPRITE_NONE) { - gSprites[sInfoCard->spriteIds[i]].callback = SpriteCb_MonIconCardScrollRight; + gSprites[sInfoCard->spriteIds[i]].callback = SpriteCB_MonIconCardScrollRight; gSprites[sInfoCard->spriteIds[i]].data[0] = gTasks[taskId].tUsingAlternateSlot; gSprites[sInfoCard->spriteIds[i]].data[1] = 0; gSprites[sInfoCard->spriteIds[i]].data[2] = i; @@ -4297,7 +4297,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId) if (trainerId == TRAINER_PLAYER) { sInfoCard->spriteIds[2 + i + arrId] = CreateMonIcon(DOME_MONS[trainerTourneyId][i], - SpriteCb_MonIcon, + SpriteCB_MonIconDomeInfo, x | sInfoTrainerMonX[i], y + sInfoTrainerMonY[i], 0, 0, TRUE); @@ -4306,7 +4306,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId) else if (trainerId == TRAINER_FRONTIER_BRAIN) { sInfoCard->spriteIds[2 + i + arrId] = CreateMonIcon(DOME_MONS[trainerTourneyId][i], - SpriteCb_MonIcon, + SpriteCB_MonIconDomeInfo, x | sInfoTrainerMonX[i], y + sInfoTrainerMonY[i], 0, 0, TRUE); @@ -4315,7 +4315,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId) else { sInfoCard->spriteIds[2 + i + arrId] = CreateMonIcon(gFacilityTrainerMons[DOME_MONS[trainerTourneyId][i]].species, - SpriteCb_MonIcon, + SpriteCB_MonIconDomeInfo, x | sInfoTrainerMonX[i], y + sInfoTrainerMonY[i], 0, 0, TRUE); @@ -4786,7 +4786,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo) if (trainerIds[0] == TRAINER_PLAYER) { sInfoCard->spriteIds[2 + i + arrId] = CreateMonIcon(DOME_MONS[tournamentIds[0]][i], - SpriteCb_MonIcon, + SpriteCB_MonIconDomeInfo, x | sLeftTrainerMonX[i], y + sLeftTrainerMonY[i], 0, 0, TRUE); @@ -4795,7 +4795,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo) else if (trainerIds[0] == TRAINER_FRONTIER_BRAIN) { sInfoCard->spriteIds[2 + i + arrId] = CreateMonIcon(DOME_MONS[tournamentIds[0]][i], - SpriteCb_MonIcon, + SpriteCB_MonIconDomeInfo, x | sLeftTrainerMonX[i], y + sLeftTrainerMonY[i], 0, 0, TRUE); @@ -4804,7 +4804,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo) else { sInfoCard->spriteIds[2 + i + arrId] = CreateMonIcon(gFacilityTrainerMons[DOME_MONS[tournamentIds[0]][i]].species, - SpriteCb_MonIcon, + SpriteCB_MonIconDomeInfo, x | sLeftTrainerMonX[i], y + sLeftTrainerMonY[i], 0, 0, TRUE); @@ -4826,7 +4826,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo) if (trainerIds[1] == TRAINER_PLAYER) { sInfoCard->spriteIds[5 + i + arrId] = CreateMonIcon(DOME_MONS[tournamentIds[1]][i], - SpriteCb_MonIcon, + SpriteCB_MonIconDomeInfo, x | sRightTrainerMonX[i], y + sRightTrainerMonY[i], 0, 0, TRUE); @@ -4835,7 +4835,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo) else if (trainerIds[1] == TRAINER_FRONTIER_BRAIN) { sInfoCard->spriteIds[5 + i + arrId] = CreateMonIcon(DOME_MONS[tournamentIds[1]][i], - SpriteCb_MonIcon, + SpriteCB_MonIconDomeInfo, x | sRightTrainerMonX[i], y + sRightTrainerMonY[i], 0, 0, TRUE); @@ -4844,7 +4844,7 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo) else { sInfoCard->spriteIds[5 + i + arrId] = CreateMonIcon(gFacilityTrainerMons[DOME_MONS[tournamentIds[1]][i]].species, - SpriteCb_MonIcon, + SpriteCB_MonIconDomeInfo, x | sRightTrainerMonX[i], y + sRightTrainerMonY[i], 0, 0, TRUE); diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index ca6be9d4e..1cb3d65bc 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -27,8 +27,8 @@ #include "constants/battle_palace.h" extern const u8 gBattlePalaceNatureToMoveTarget[]; -extern const u8 * const gBattleAnims_General[]; -extern const u8 * const gBattleAnims_Special[]; +extern const u8 *const gBattleAnims_General[]; +extern const u8 *const gBattleAnims_Special[]; extern const struct CompressedSpriteSheet gSpriteSheet_EnemyShadow; extern const struct SpriteTemplate gSpriteTemplate_EnemyShadow; diff --git a/src/battle_main.c b/src/battle_main.c index 6a4244b1a..d80542f7b 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -78,12 +78,12 @@ static void EndLinkBattleInSteps(void); static void CB2_InitAskRecordBattle(void); static void CB2_AskRecordBattle(void); static void AskRecordBattle(void); -static void SpriteCb_MoveWildMonToRight(struct Sprite *sprite); -static void SpriteCb_WildMonShowHealthbox(struct Sprite *sprite); -static void SpriteCb_WildMonAnimate(struct Sprite *sprite); +static void SpriteCB_MoveWildMonToRight(struct Sprite *sprite); +static void SpriteCB_WildMonShowHealthbox(struct Sprite *sprite); +static void SpriteCB_WildMonAnimate(struct Sprite *sprite); static void SpriteCB_Flicker(struct Sprite *sprite); static void SpriteCB_AnimFaintOpponent(struct Sprite *sprite); -static void SpriteCb_BlinkVisible(struct Sprite *sprite); +static void SpriteCB_BlinkVisible(struct Sprite *sprite); static void SpriteCB_Idle(struct Sprite *sprite); static void SpriteCB_BattleSpriteSlideLeft(struct Sprite *sprite); static void TurnValuesCleanUp(bool8 var0); @@ -557,7 +557,7 @@ const u8 gStatusConditionString_IceJpn[] = _("こおり$$$$"); const u8 gStatusConditionString_ConfusionJpn[] = _("こんらん$$$"); const u8 gStatusConditionString_LoveJpn[] = _("メロメロ$$$"); -const u8 * const gStatusConditionStringsTable[][2] = +const u8 *const gStatusConditionStringsTable[][2] = { {gStatusConditionString_PoisonJpn, gText_Poison}, {gStatusConditionString_SleepJpn, gText_Sleep}, @@ -816,8 +816,8 @@ static void SetAllPlayersBerryData(void) gEnigmaBerries[2].itemEffect[i] = 0; } - gEnigmaBerries[0].holdEffect = 0; - gEnigmaBerries[2].holdEffect = 0; + gEnigmaBerries[0].holdEffect = HOLD_EFFECT_NONE; + gEnigmaBerries[2].holdEffect = HOLD_EFFECT_NONE; gEnigmaBerries[0].holdEffectParam = 0; gEnigmaBerries[2].holdEffectParam = 0; } @@ -2650,38 +2650,38 @@ u32 GetBattleWindowTemplatePixelWidth(u32 windowsType, u32 tableId) #define sBattler data[0] #define sSpeciesId data[2] -void SpriteCb_WildMon(struct Sprite *sprite) +void SpriteCB_WildMon(struct Sprite *sprite) { - sprite->callback = SpriteCb_MoveWildMonToRight; + sprite->callback = SpriteCB_MoveWildMonToRight; StartSpriteAnimIfDifferent(sprite, 0); BeginNormalPaletteFade(0x20000, 0, 10, 10, RGB(8, 8, 8)); } -static void SpriteCb_MoveWildMonToRight(struct Sprite *sprite) +static void SpriteCB_MoveWildMonToRight(struct Sprite *sprite) { if ((gIntroSlideFlags & 1) == 0) { sprite->x2 += 2; if (sprite->x2 == 0) { - sprite->callback = SpriteCb_WildMonShowHealthbox; + sprite->callback = SpriteCB_WildMonShowHealthbox; } } } -static void SpriteCb_WildMonShowHealthbox(struct Sprite *sprite) +static void SpriteCB_WildMonShowHealthbox(struct Sprite *sprite) { if (sprite->animEnded) { StartHealthboxSlideIn(sprite->sBattler); SetHealthboxSpriteVisible(gHealthboxSpriteIds[sprite->sBattler]); - sprite->callback = SpriteCb_WildMonAnimate; + sprite->callback = SpriteCB_WildMonAnimate; StartSpriteAnimIfDifferent(sprite, 0); BeginNormalPaletteFade(0x20000, 0, 10, 0, RGB(8, 8, 8)); } } -static void SpriteCb_WildMonAnimate(struct Sprite *sprite) +static void SpriteCB_WildMonAnimate(struct Sprite *sprite) { if (!gPaletteFade.active) { @@ -2798,14 +2798,14 @@ static void SpriteCB_AnimFaintOpponent(struct Sprite *sprite) } // Used when selecting a move, which can hit multiple targets, in double battles. -void SpriteCb_ShowAsMoveTarget(struct Sprite *sprite) +void SpriteCB_ShowAsMoveTarget(struct Sprite *sprite) { sprite->data[3] = 8; sprite->data[4] = sprite->invisible; - sprite->callback = SpriteCb_BlinkVisible; + sprite->callback = SpriteCB_BlinkVisible; } -static void SpriteCb_BlinkVisible(struct Sprite *sprite) +static void SpriteCB_BlinkVisible(struct Sprite *sprite) { if (--sprite->data[3] == 0) { @@ -2814,7 +2814,7 @@ static void SpriteCb_BlinkVisible(struct Sprite *sprite) } } -void SpriteCb_HideAsMoveTarget(struct Sprite *sprite) +void SpriteCB_HideAsMoveTarget(struct Sprite *sprite) { sprite->invisible = sprite->data[4]; sprite->data[4] = FALSE; @@ -3038,13 +3038,13 @@ static void BattleStartClearSetData(void) gDisableStructs[i].isFirstTurn = 2; sUnusedBattlersArray[i] = 0; - gLastMoves[i] = 0; - gLastLandedMoves[i] = 0; + gLastMoves[i] = MOVE_NONE; + gLastLandedMoves[i] = MOVE_NONE; gLastHitByType[i] = 0; - gLastResultingMoves[i] = 0; + gLastResultingMoves[i] = MOVE_NONE; gLastHitBy[i] = 0xFF; - gLockedMoves[i] = 0; - gLastPrintedMoves[i] = 0; + gLockedMoves[i] = MOVE_NONE; + gLastPrintedMoves[i] = MOVE_NONE; gBattleResources->flags->flags[i] = 0; gPalaceSelectionBattleScripts[i] = 0; } @@ -3105,10 +3105,10 @@ static void BattleStartClearSetData(void) for (i = 0; i < 8; i++) { - *((u8 *)gBattleStruct->lastTakenMove + i) = 0; - *((u8 *)gBattleStruct->usedHeldItems + i) = 0; - *((u8 *)gBattleStruct->choicedMove + i) = 0; - *((u8 *)gBattleStruct->changedItems + i) = 0; + *((u8 *)gBattleStruct->lastTakenMove + i) = MOVE_NONE; + *((u8 *)gBattleStruct->usedHeldItems + i) = ITEM_NONE; + *((u8 *)gBattleStruct->choicedMove + i) = MOVE_NONE; + *((u8 *)gBattleStruct->changedItems + i) = ITEM_NONE; *(i + 0 * 8 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 0) = 0; *(i + 1 * 8 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 0) = 0; *(i + 2 * 8 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 0) = 0; @@ -3205,15 +3205,15 @@ void SwitchInClearSetData(void) gMoveResultFlags = 0; gDisableStructs[gActiveBattler].isFirstTurn = 2; gDisableStructs[gActiveBattler].truantSwitchInHack = disableStructCopy.truantSwitchInHack; - gLastMoves[gActiveBattler] = 0; - gLastLandedMoves[gActiveBattler] = 0; + gLastMoves[gActiveBattler] = MOVE_NONE; + gLastLandedMoves[gActiveBattler] = MOVE_NONE; gLastHitByType[gActiveBattler] = 0; - gLastResultingMoves[gActiveBattler] = 0; - gLastPrintedMoves[gActiveBattler] = 0; + gLastResultingMoves[gActiveBattler] = MOVE_NONE; + gLastPrintedMoves[gActiveBattler] = MOVE_NONE; gLastHitBy[gActiveBattler] = 0xFF; - *(gBattleStruct->lastTakenMove + gActiveBattler * 2 + 0) = 0; - *(gBattleStruct->lastTakenMove + gActiveBattler * 2 + 1) = 0; + *(gBattleStruct->lastTakenMove + gActiveBattler * 2 + 0) = MOVE_NONE; + *(gBattleStruct->lastTakenMove + gActiveBattler * 2 + 1) = MOVE_NONE; *(0 * 2 + gActiveBattler * 8 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 0) = 0; *(0 * 2 + gActiveBattler * 8 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 1) = 0; *(1 * 2 + gActiveBattler * 8 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 0) = 0; @@ -3229,18 +3229,18 @@ void SwitchInClearSetData(void) { if (i != gActiveBattler && GetBattlerSide(i) != GetBattlerSide(gActiveBattler)) { - *(gBattleStruct->lastTakenMove + i * 2 + 0) = 0; - *(gBattleStruct->lastTakenMove + i * 2 + 1) = 0; + *(gBattleStruct->lastTakenMove + i * 2 + 0) = MOVE_NONE; + *(gBattleStruct->lastTakenMove + i * 2 + 1) = MOVE_NONE; } *(i * 8 + gActiveBattler * 2 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 0) = 0; *(i * 8 + gActiveBattler * 2 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 1) = 0; } - *(u8 *)((u8 *)(&gBattleStruct->choicedMove[gActiveBattler]) + 0) = 0; - *(u8 *)((u8 *)(&gBattleStruct->choicedMove[gActiveBattler]) + 1) = 0; + *(u8 *)((u8 *)(&gBattleStruct->choicedMove[gActiveBattler]) + 0) = MOVE_NONE; + *(u8 *)((u8 *)(&gBattleStruct->choicedMove[gActiveBattler]) + 1) = MOVE_NONE; gBattleResources->flags->flags[gActiveBattler] = 0; - gCurrentMove = 0; + gCurrentMove = MOVE_NONE; gBattleStruct->arenaTurnCounter = 0xFF; ClearBattlerMoveHistory(gActiveBattler); @@ -3297,18 +3297,18 @@ void FaintClearSetData(void) gDisableStructs[gActiveBattler].isFirstTurn = 2; - gLastMoves[gActiveBattler] = 0; - gLastLandedMoves[gActiveBattler] = 0; + gLastMoves[gActiveBattler] = MOVE_NONE; + gLastLandedMoves[gActiveBattler] = MOVE_NONE; gLastHitByType[gActiveBattler] = 0; - gLastResultingMoves[gActiveBattler] = 0; - gLastPrintedMoves[gActiveBattler] = 0; + gLastResultingMoves[gActiveBattler] = MOVE_NONE; + gLastPrintedMoves[gActiveBattler] = MOVE_NONE; gLastHitBy[gActiveBattler] = 0xFF; - *(u8 *)((u8 *)(&gBattleStruct->choicedMove[gActiveBattler]) + 0) = 0; - *(u8 *)((u8 *)(&gBattleStruct->choicedMove[gActiveBattler]) + 1) = 0; + *(u8 *)((u8 *)(&gBattleStruct->choicedMove[gActiveBattler]) + 0) = MOVE_NONE; + *(u8 *)((u8 *)(&gBattleStruct->choicedMove[gActiveBattler]) + 1) = MOVE_NONE; - *(gBattleStruct->lastTakenMove + gActiveBattler * 2 + 0) = 0; - *(gBattleStruct->lastTakenMove + gActiveBattler * 2 + 1) = 0; + *(gBattleStruct->lastTakenMove + gActiveBattler * 2 + 0) = MOVE_NONE; + *(gBattleStruct->lastTakenMove + gActiveBattler * 2 + 1) = MOVE_NONE; *(0 * 2 + gActiveBattler * 8 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 0) = 0; *(0 * 2 + gActiveBattler * 8 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 1) = 0; *(1 * 2 + gActiveBattler * 8 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 0) = 0; @@ -3324,8 +3324,8 @@ void FaintClearSetData(void) { if (i != gActiveBattler && GetBattlerSide(i) != GetBattlerSide(gActiveBattler)) { - *(gBattleStruct->lastTakenMove + i * 2 + 0) = 0; - *(gBattleStruct->lastTakenMove + i * 2 + 1) = 0; + *(gBattleStruct->lastTakenMove + i * 2 + 0) = MOVE_NONE; + *(gBattleStruct->lastTakenMove + i * 2 + 1) = MOVE_NONE; } *(i * 8 + gActiveBattler * 2 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 0) = 0; *(i * 8 + gActiveBattler * 2 + (u8 *)(gBattleStruct->lastTakenMoveFrom) + 1) = 0; @@ -3371,8 +3371,8 @@ static void BattleIntroPrepareBackgroundSlide(void) BtlController_EmitIntroSlide(BUFFER_A, gBattleTerrain); MarkBattlerForControllerExec(gActiveBattler); gBattleMainFunc = BattleIntroDrawTrainersOrMonsSprites; - gBattleCommunication[0] = 0; - gBattleCommunication[1] = 0; + gBattleCommunication[MULTIUSE_STATE] = 0; + gBattleCommunication[SPRITES_INIT_STATE1] = 0; } } @@ -3387,7 +3387,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void) for (gActiveBattler = 0; gActiveBattler < gBattlersCount; gActiveBattler++) { if ((gBattleTypeFlags & BATTLE_TYPE_SAFARI) - && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) { ptr = (u8 *)&gBattleMons[gActiveBattler]; for (i = 0; i < sizeof(struct BattlePokemon); i++) @@ -3545,7 +3545,6 @@ static void BattleIntroDrawPartySummaryScreens(void) gBattleMainFunc = BattleIntroPrintWildMonAttacked; } - } static void BattleIntroPrintTrainerWantsToBattle(void) @@ -3839,7 +3838,7 @@ static void TryDoEventsBeforeFirstTurn(void) gBattleStruct->switchInAbilitiesCounter++; - if (effect) + if (effect != 0) return; } if (AbilityBattleEffects(ABILITYEFFECT_INTIMIDATE1, 0, 0, 0, 0) != 0) @@ -3854,7 +3853,7 @@ static void TryDoEventsBeforeFirstTurn(void) gBattleStruct->switchInItemsCounter++; - if (effect) + if (effect != 0) return; } for (i = 0; i < MAX_BATTLERS_COUNT; i++) @@ -3997,11 +3996,11 @@ u8 IsRunningFromBattleImpossible(void) gPotentialItemEffectBattler = gActiveBattler; if (holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN) - return 0; + return BATTLE_RUN_SUCCESS; if (gBattleTypeFlags & BATTLE_TYPE_LINK) - return 0; + return BATTLE_RUN_SUCCESS; if (gBattleMons[gActiveBattler].ability == ABILITY_RUN_AWAY) - return 0; + return BATTLE_RUN_SUCCESS; side = GetBattlerSide(gActiveBattler); @@ -4013,7 +4012,7 @@ u8 IsRunningFromBattleImpossible(void) gBattleScripting.battler = i; gLastUsedAbility = gBattleMons[i].ability; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PREVENTS_ESCAPE; - return 2; + return BATTLE_RUN_FAILURE; } if (side != GetBattlerSide(i) && gBattleMons[gActiveBattler].ability != ABILITY_LEVITATE @@ -4023,7 +4022,7 @@ u8 IsRunningFromBattleImpossible(void) gBattleScripting.battler = i; gLastUsedAbility = gBattleMons[i].ability; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PREVENTS_ESCAPE; - return 2; + return BATTLE_RUN_FAILURE; } } i = AbilityBattleEffects(ABILITYEFFECT_CHECK_FIELD_EXCEPT_BATTLER, gActiveBattler, ABILITY_MAGNET_PULL, 0, 0); @@ -4032,20 +4031,20 @@ u8 IsRunningFromBattleImpossible(void) gBattleScripting.battler = i - 1; gLastUsedAbility = gBattleMons[i - 1].ability; gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_PREVENTS_ESCAPE; - return 2; + return BATTLE_RUN_FAILURE; } if ((gBattleMons[gActiveBattler].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED)) || (gStatuses3[gActiveBattler] & STATUS3_ROOTED)) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_CANT_ESCAPE; - return 1; + return BATTLE_RUN_FORBIDDEN; } if (gBattleTypeFlags & BATTLE_TYPE_FIRST_BATTLE) { gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DONT_LEAVE_BIRCH; - return 1; + return BATTLE_RUN_FORBIDDEN; } - return 0; + return BATTLE_RUN_SUCCESS; } void SwitchPartyOrder(u8 battler) @@ -4301,7 +4300,7 @@ static void HandleTurnActionSelectionState(void) BattleScriptExecute(BattleScript_PrintCantRunFromTrainer); gBattleCommunication[gActiveBattler] = STATE_BEFORE_ACTION_CHOSEN; } - else if (IsRunningFromBattleImpossible() + else if (IsRunningFromBattleImpossible() != BATTLE_RUN_SUCCESS && gBattleBufferB[gActiveBattler][1] == B_ACTION_RUN) { gSelectionBattleScripts[gActiveBattler] = BattleScript_PrintCantEscapeFromBattle; diff --git a/src/battle_message.c b/src/battle_message.c index 677bb2fe3..9e274926d 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -431,7 +431,7 @@ static const u8 sText_SpDef2[] = _("SP. DEF"); static const u8 sText_Accuracy[] = _("accuracy"); static const u8 sText_Evasiveness[] = _("evasiveness"); -const u8 * const gStatNamesTable[NUM_BATTLE_STATS] = +const u8 *const gStatNamesTable[NUM_BATTLE_STATS] = { [STAT_HP] = sText_HP2, [STAT_ATK] = sText_Attack2, @@ -449,7 +449,7 @@ static const u8 sText_PokeblockWasTooSweet[] = _("was too sweet!"); static const u8 sText_PokeblockWasTooBitter[] = _("was too bitter!"); static const u8 sText_PokeblockWasTooSour[] = _("was too sour!"); -const u8 * const gPokeblockWasTooXStringTable[FLAVOR_COUNT] = +const u8 *const gPokeblockWasTooXStringTable[FLAVOR_COUNT] = { [FLAVOR_SPICY] = sText_PokeblockWasTooSpicy, [FLAVOR_DRY] = sText_PokeblockWasTooDry, @@ -514,7 +514,7 @@ static const u8 sText_Trainer2WinText[]; static const u8 sText_TwoInGameTrainersDefeated[]; static const u8 sText_Trainer2LoseText[]; -const u8 * const gBattleStringsTable[BATTLESTRINGS_COUNT - BATTLESTRINGS_TABLE_START] = +const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT - BATTLESTRINGS_TABLE_START] = { [STRINGID_TRAINER1LOSETEXT - BATTLESTRINGS_TABLE_START] = sText_Trainer1LoseText, [STRINGID_PKMNGAINEDEXP - BATTLESTRINGS_TABLE_START] = sText_PkmnGainedEXP, @@ -1293,7 +1293,7 @@ static const u8 sText_SpAtk[] = _("SP. ATK"); static const u8 sText_SpDef[] = _("SP. DEF"); // Unused -static const u8 * const sStatNamesTable2[] = +static const u8 *const sStatNamesTable2[] = { sText_HP, sText_SpAtk, sText_Attack, sText_SpDef, sText_Defense, sText_Speed @@ -1405,7 +1405,7 @@ static const u8 sText_LostToOpponentByReferee[] = _("{B_PLAYER_MON1_NAME} lost t static const u8 sText_TiedOpponentByReferee[] = _("{B_PLAYER_MON1_NAME} tied the opponent\n{B_OPPONENT_MON1_NAME} in a REFEREE's decision!"); static const u8 sText_RefCommenceBattle[] = _("REFEREE: {B_PLAYER_MON1_NAME} VS {B_OPPONENT_MON1_NAME}!\nCommence battling!"); -const u8 * const gRefereeStringsTable[] = +const u8 *const gRefereeStringsTable[] = { [B_MSG_REF_NOTHING_IS_DECIDED] = sText_RefIfNothingIsDecided, [B_MSG_REF_THATS_IT] = sText_RefThatsIt, diff --git a/src/battle_util.c b/src/battle_util.c index e75d3f01d..498db4162 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -471,7 +471,7 @@ bool8 TryRunFromBattle(u8 battler) gBattleStruct->runTries++; } - if (effect) + if (effect != 0) { gCurrentTurnActionNumber = gBattlersCount; gBattleOutcome = B_OUTCOME_RAN; @@ -823,7 +823,8 @@ void PressurePPLoseOnUsingPerishSong(u8 attacker) } } -void MarkAllBattlersForControllerExec(void) // unused +// Unused +static void MarkAllBattlersForControllerExec(void) { int i; @@ -1220,7 +1221,7 @@ u8 DoFieldEndTurnEffects(void) } } gBattleStruct->turnSideTracker++; - if (effect) + if (effect != 0) break; } if (!effect) @@ -1246,7 +1247,7 @@ u8 DoFieldEndTurnEffects(void) } } gBattleStruct->turnSideTracker++; - if (effect) + if (effect != 0) break; } if (!effect) @@ -1270,7 +1271,7 @@ u8 DoFieldEndTurnEffects(void) effect++; } gBattleStruct->turnSideTracker++; - if (effect) + if (effect != 0) break; } if (!effect) @@ -1294,7 +1295,7 @@ u8 DoFieldEndTurnEffects(void) } } gBattleStruct->turnSideTracker++; - if (effect) + if (effect != 0) break; } if (!effect) @@ -1316,7 +1317,7 @@ u8 DoFieldEndTurnEffects(void) effect++; } gBattleStruct->turnSideTracker++; - if (effect) + if (effect != 0) break; } if (!effect) @@ -1687,12 +1688,12 @@ u8 DoBattlerEndTurnEffects(void) } if (i == MAX_MON_MOVES) // pokemon does not have the disabled move anymore { - gDisableStructs[gActiveBattler].disabledMove = 0; + gDisableStructs[gActiveBattler].disabledMove = MOVE_NONE; gDisableStructs[gActiveBattler].disableTimer = 0; } else if (--gDisableStructs[gActiveBattler].disableTimer == 0) // disable ends { - gDisableStructs[gActiveBattler].disabledMove = 0; + gDisableStructs[gActiveBattler].disabledMove = MOVE_NONE; BattleScriptExecute(BattleScript_DisabledNoMore); effect++; } @@ -1704,13 +1705,13 @@ u8 DoBattlerEndTurnEffects(void) { if (gBattleMons[gActiveBattler].moves[gDisableStructs[gActiveBattler].encoredMovePos] != gDisableStructs[gActiveBattler].encoredMove) // pokemon does not have the encored move anymore { - gDisableStructs[gActiveBattler].encoredMove = 0; + gDisableStructs[gActiveBattler].encoredMove = MOVE_NONE; gDisableStructs[gActiveBattler].encoreTimer = 0; } else if (--gDisableStructs[gActiveBattler].encoreTimer == 0 || gBattleMons[gActiveBattler].pp[gDisableStructs[gActiveBattler].encoredMovePos] == 0) { - gDisableStructs[gActiveBattler].encoredMove = 0; + gDisableStructs[gActiveBattler].encoredMove = MOVE_NONE; gDisableStructs[gActiveBattler].encoreTimer = 0; BattleScriptExecute(BattleScript_EncoredNoMore); effect++; @@ -2103,7 +2104,7 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleStruct->atkCancellerTracker++; break; case CANCELLER_DISABLED: // disabled move - if (gDisableStructs[gBattlerAttacker].disabledMove == gCurrentMove && gDisableStructs[gBattlerAttacker].disabledMove != 0) + if (gDisableStructs[gBattlerAttacker].disabledMove == gCurrentMove && gDisableStructs[gBattlerAttacker].disabledMove != MOVE_NONE) { gProtectStructs[gBattlerAttacker].usedDisabledMove = 1; gBattleScripting.battler = gBattlerAttacker; @@ -2172,7 +2173,7 @@ u8 AtkCanceller_UnableToUseMove(void) if ((gBattleMons[gBattlerAttacker].status1 & STATUS1_PARALYSIS) && (Random() % 4) == 0) { gProtectStructs[gBattlerAttacker].prlzImmobility = 1; - // This is removed in Emerald for some reason + // This is removed in FRLG and Emerald for some reason //CancelMultiTurnMoves(gBattlerAttacker); gBattlescriptCurrInstr = BattleScript_MoveUsedIsParalyzed; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; @@ -2210,7 +2211,7 @@ u8 AtkCanceller_UnableToUseMove(void) } else { - // This is removed in Emerald for some reason + // This is removed in FRLG and Emerald for some reason //gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_MULTIPLETURNS; if (gTakenDmg[gBattlerAttacker]) { @@ -2506,7 +2507,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA break; } } - if (effect) + if (effect != 0) { gBattleCommunication[MULTISTRING_CHOOSER] = GetCurrentWeather(); BattleScriptPushCursorAndCallback(BattleScript_OverworldWeatherStarts); @@ -2548,7 +2549,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA break; case ABILITY_FORECAST: effect = CastformDataTypeChange(battler); - if (effect) + if (effect != 0) { BattleScriptPushCursorAndCallback(BattleScript_CastformChange); gBattleScripting.battler = battler; @@ -2569,7 +2570,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA for (target1 = 0; target1 < gBattlersCount; target1++) { effect = CastformDataTypeChange(target1); - if (effect) + if (effect != 0) { BattleScriptPushCursorAndCallback(BattleScript_CastformChange); gBattleScripting.battler = target1; @@ -2909,7 +2910,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA } break; } - if (effect) + if (effect != 0) { switch (effect) { @@ -2940,7 +2941,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA if (gBattleMons[battler].ability == ABILITY_FORECAST) { effect = CastformDataTypeChange(battler); - if (effect) + if (effect != 0) { BattleScriptPushCursorAndCallback(BattleScript_CastformChange); gBattleScripting.battler = battler; @@ -3040,7 +3041,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA effect++; } } - if (effect) + if (effect != 0) { BattleScriptPushCursorAndCallback(BattleScript_TraceActivates); gStatuses3[i] &= ~STATUS3_TRACE; @@ -3300,7 +3301,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) effect = ITEM_STATS_CHANGE; } } - if (effect) + if (effect != 0) { gBattleScripting.battler = battlerId; gPotentialItemEffectBattler = battlerId; @@ -3371,7 +3372,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) effect = ITEM_STATS_CHANGE; } } - if (effect) + if (effect != 0) { gBattleScripting.battler = battlerId; gPotentialItemEffectBattler = battlerId; @@ -3583,7 +3584,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; } - if (effect) + if (effect != 0) { gBattleScripting.battler = battlerId; gPotentialItemEffectBattler = battlerId; @@ -3727,7 +3728,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) effect = ITEM_STATS_CHANGE; } } - if (effect) + if (effect != 0) { gBattleScripting.battler = battlerId; gPotentialItemEffectBattler = battlerId; @@ -3737,7 +3738,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } break; } - if (effect) + if (effect != 0) { gBattleScripting.battler = battlerId; gPotentialItemEffectBattler = battlerId; diff --git a/src/fldeff_cut.c b/src/fldeff_cut.c index 0641c6519..6cccec8ba 100644 --- a/src/fldeff_cut.c +++ b/src/fldeff_cut.c @@ -226,7 +226,7 @@ bool8 SetUpFieldMove_Cut(void) y = gPlayerFacingPosition.y + sHyperCutStruct[i].y; tileCuttable = TRUE; - for (j = 0; j < 2; ++j) + for (j = 0; j < 2; j++) { if (sHyperCutStruct[i].unk2[j] == 0) break; // one line required to match -g if (cutTiles[(u8)(sHyperCutStruct[i].unk2[j] - 1)] == FALSE) diff --git a/src/librfu_rfu.c b/src/librfu_rfu.c index 9a5db6d9d..2e1d7e069 100644 --- a/src/librfu_rfu.c +++ b/src/librfu_rfu.c @@ -164,7 +164,7 @@ u16 rfu_initializeAPI(u32 *APIBuffer, u16 buffByteSize, IntrFunc *sioIntrTable_p gRfuFixed = (void *)APIBuffer + 0xdc; // + sizeof(*gRfuStatic) gRfuSlotStatusNI[0] = (void *)APIBuffer + 0x1bc; // + sizeof(*gRfuFixed) gRfuSlotStatusUNI[0] = (void *)APIBuffer + 0x37c; // + sizeof(*gRfuSlotStatusNI[0]) * RFU_CHILD_MAX - for (i = 1; i < RFU_CHILD_MAX; ++i) + for (i = 1; i < RFU_CHILD_MAX; i++) { gRfuSlotStatusNI[i] = &gRfuSlotStatusNI[i - 1][1]; gRfuSlotStatusUNI[i] = &gRfuSlotStatusUNI[i - 1][1]; @@ -173,7 +173,7 @@ u16 rfu_initializeAPI(u32 *APIBuffer, u16 buffByteSize, IntrFunc *sioIntrTable_p gRfuFixed->STWIBuffer = (struct RfuIntrStruct *)&gRfuSlotStatusUNI[3][1]; STWI_init_all((struct RfuIntrStruct *)&gRfuSlotStatusUNI[3][1], sioIntrTable_p, copyInterruptToRam); rfu_STC_clearAPIVariables(); - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) { gRfuSlotStatusNI[i]->recvBuffer = NULL; gRfuSlotStatusNI[i]->recvBufferSize = 0; @@ -214,7 +214,7 @@ static void rfu_STC_clearAPIVariables(void) gRfuLinkStatus->parentChild = MODE_NEUTRAL; rfu_clearAllSlot(); gRfuStatic->SCStartFlag = 0; - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) gRfuStatic->cidBak[i] = 0; REG_IME = IMEBackup; } @@ -294,7 +294,7 @@ static void rfu_CB_defaultCallback(u8 reqCommand, u16 reqResult) if (gRfuStatic->flags & 8) gRfuFixed->reqCallback(reqCommand, reqResult); bmSlotFlags = gRfuLinkStatus->connSlotFlag | gRfuLinkStatus->linkLossSlotFlag; - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) if ((bmSlotFlags >> i) & 1) rfu_STC_removeLinkData(i, 1); gRfuLinkStatus->parentChild = MODE_NEUTRAL; @@ -351,7 +351,7 @@ u16 rfu_MBOOT_CHILD_inheritanceLinkStatus(void) // The size of struct RfuLinkStatus is 180 checksum = 0; - for (i = 0; i < 180/2; ++i) + for (i = 0; i < 180/2; i++) checksum += *mb_buff_iwram_p++; if (checksum != *(u16 *)0x30000FA) return 1; @@ -455,11 +455,11 @@ void rfu_REQ_configGameData(u8 mbootFlag, u16 serialNo, const u8 *gname, const u packet[1] = serialNo >> 8; if (mbootFlag != 0) packet[1] = (serialNo >> 8) | 0x80; - for (i = 2; i < 15; ++i) + for (i = 2; i < 15; i++) packet[i] = *gname++; check_sum = 0; unameBackup = uname; - for (i = 0; i < 8; ++i) + for (i = 0; i < 8; i++) { check_sum += *unameBackup++; check_sum += *gnameBackup++; @@ -493,10 +493,10 @@ static void rfu_CB_configGameData(u8 reqCommand, u16 reqResult) { gRfuLinkStatus->my.mbootFlag = 0; } - for (i = 0; i < RFU_GAME_NAME_LENGTH; ++i) + for (i = 0; i < RFU_GAME_NAME_LENGTH; i++) gRfuLinkStatus->my.gname[i] = *gname_uname_p++; ++gname_uname_p; - for (i = 0; i < PLAYER_NAME_LENGTH + 1; ++i) + for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++) gRfuLinkStatus->my.uname[i] = *gname_uname_p++; } rfu_STC_REQ_callback(reqCommand, reqResult); @@ -546,7 +546,7 @@ static void rfu_STC_clearLinkStatus(u8 parentChild) CpuFill16(0, gRfuLinkStatus->partner, sizeof(gRfuLinkStatus->partner)); gRfuLinkStatus->findParentCount = 0; } - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) gRfuLinkStatus->strength[i] = 0; gRfuLinkStatus->connCount = 0; gRfuLinkStatus->connSlotFlag = 0; @@ -609,7 +609,7 @@ static void rfu_STC_readChildList(void) if (STWI_poll_CommandEnd() == 0) { data_p = &gRfuFixed->STWIBuffer->rxPacketAlloc.rfuPacket8.data[4]; - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) true_slots[i] = *data_p++; } gRfuFixed->STWIBuffer->rxPacketAlloc.rfuPacket32.data[0] = stwiParam; @@ -696,7 +696,7 @@ static void rfu_STC_readParentCandidateList(void) numSlots = packet_p[1]; packet_p += 4; gRfuLinkStatus->findParentCount = 0; - for (i = 0; i < RFU_CHILD_MAX && numSlots != 0; ++i) + for (i = 0; i < RFU_CHILD_MAX && numSlots != 0; i++) { numSlots -= 7; uname_p = packet_p + 6; @@ -704,7 +704,7 @@ static void rfu_STC_readParentCandidateList(void) check_sum = ~*packet_p; ++packet_p; my_check_sum = 0; - for (j = 0; j < 8; ++j) + for (j = 0; j < 8; j++) { my_check_sum += *packet_p++; my_check_sum += *uname_p++; @@ -723,10 +723,10 @@ static void rfu_STC_readParentCandidateList(void) else target->mbootFlag = 0; packet_p += 2; - for (j = 0; j < RFU_GAME_NAME_LENGTH; ++j) + for (j = 0; j < RFU_GAME_NAME_LENGTH; j++) target->gname[j] = *packet_p++; ++packet_p; - for (j = 0; j < PLAYER_NAME_LENGTH + 1; ++j) + for (j = 0; j < PLAYER_NAME_LENGTH + 1; j++) target->uname[j] = *packet_p++; ++gRfuLinkStatus->findParentCount; } @@ -737,7 +737,7 @@ void rfu_REQ_startConnectParent(u16 pid) { u16 result = 0; u8 i; - for (i = 0; i < RFU_CHILD_MAX && gRfuLinkStatus->partner[i].id != pid; ++i) + for (i = 0; i < RFU_CHILD_MAX && gRfuLinkStatus->partner[i].id != pid; i++) ; if (i == RFU_CHILD_MAX) result = ERR_PID_NOT_FOUND; @@ -782,7 +782,7 @@ static void rfu_CB_pollConnectParent(u8 reqCommand, u16 reqResult) ++gRfuLinkStatus->connCount; gRfuLinkStatus->parentChild = MODE_CHILD; gRfuStatic->flags |= 0x80; - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) { if (gRfuLinkStatus->partner[i].id == gRfuStatic->tryPid) { @@ -868,7 +868,7 @@ u16 rfu_syncVBlank(void) { gRfuStatic->flags &= 0xFB; bmSlotFlag = gRfuLinkStatus->connSlotFlag | gRfuLinkStatus->linkLossSlotFlag; - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) if ((bmSlotFlag >> i) & 1) rfu_STC_removeLinkData(i, 1); gRfuLinkStatus->parentChild = MODE_NEUTRAL; @@ -921,7 +921,7 @@ u16 rfu_REQBN_watchLink(u16 reqCommandId, u8 *bmLinkLossSlot, u8 *linkLossReason newLinkLossFlag ^= gRfuLinkStatus->connSlotFlag; *bmLinkLossSlot = newLinkLossFlag & gRfuLinkStatus->connSlotFlag; *linkLossReason = REASON_LINK_LOSS; - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) { if ((*bmLinkLossSlot >> i) & 1) { @@ -941,7 +941,7 @@ u16 rfu_REQBN_watchLink(u16 reqCommandId, u8 *bmLinkLossSlot, u8 *linkLossReason if (reqResult == 0) { packet_p = &gRfuFixed->STWIBuffer->rxPacketAlloc.rfuPacket8.data[4]; - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) gRfuLinkStatus->strength[i] = *packet_p++; to_req_disconnect = 0; i = 0; @@ -951,7 +951,7 @@ u16 rfu_REQBN_watchLink(u16 reqCommandId, u8 *bmLinkLossSlot, u8 *linkLossReason rfu_STC_REQ_callback(ID_LINK_STATUS_REQ, reqResult); return reqResult; } - for (; i < RFU_CHILD_MAX; ++i) + for (; i < RFU_CHILD_MAX; i++) { #if LIBRFU_VERSION >= 1026 if (gRfuStatic->lsFixedCount[i] != 0) @@ -1128,7 +1128,7 @@ static void rfu_CB_disconnect(u8 reqCommand, u16 reqResult) gRfuFixed->STWIBuffer->rxPacketAlloc.rfuPacket8.data[8] = gRfuStatic->recoveryBmSlot; if (reqResult == 0) { - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) { bm_slot_flag = 1 << i; if (bm_slot_flag & gRfuStatic->recoveryBmSlot) @@ -1153,7 +1153,7 @@ void rfu_REQ_CHILD_startConnectRecovery(u8 bmRecoverySlot) u8 i; gRfuStatic->recoveryBmSlot = bmRecoverySlot; - for (i = 0; i < RFU_CHILD_MAX && !((bmRecoverySlot >> i) & 1); ++i) + for (i = 0; i < RFU_CHILD_MAX && !((bmRecoverySlot >> i) & 1); i++) ; STWI_set_Callback_M(rfu_STC_REQ_callback); // if i == 4, gRfuLinkStatus->partner[i].id becomes gRfuLinkStatus->my.id @@ -1174,7 +1174,7 @@ static void rfu_CB_CHILD_pollConnectRecovery(u8 reqCommand, u16 reqResult) if (reqResult == 0 && gRfuFixed->STWIBuffer->rxPacketAlloc.rfuPacket8.data[4] == 0 && gRfuStatic->recoveryBmSlot) { gRfuLinkStatus->parentChild = MODE_CHILD; - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) { bm_slot_flag = 1 << i; rfuLinkStatus = gRfuLinkStatus; // ??? @@ -1256,7 +1256,7 @@ void rfu_clearAllSlot(void) u16 IMEBackup = REG_IME; REG_IME = 0; - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) { CpuFill16(0, gRfuSlotStatusNI[i], 2 * sizeof(struct NIComm)); CpuFill16(0, gRfuSlotStatusUNI[i], sizeof(struct UNISend) + sizeof(struct UNIRecv)); @@ -1324,7 +1324,7 @@ u16 rfu_clearSlot(u8 connTypeFlag, u8 slotStatusIndex) if (NI_comm->state & SLOT_BUSY_FLAG) { rfu_STC_releaseFrame(slotStatusIndex, send_recv, NI_comm); - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) if ((NI_comm->bmSlotOrg >> i) & 1) NI_comm->failCounter = 0; } @@ -1450,7 +1450,7 @@ static u16 rfu_STC_setSendData_org(u8 ni_or_uni, u8 bmSendSlot, u8 subFrameSize, slotStatus_NI->send.src = src; slotStatus_NI->send.ack = 0; slotStatus_NI->send.phase = 0; - for (i = 0; i < WINDOW_COUNT; ++i) + for (i = 0; i < WINDOW_COUNT; i++) { slotStatus_NI->send.recvAckFlag[i] = 0; slotStatus_NI->send.n[i] = 1; @@ -1503,7 +1503,7 @@ u16 rfu_changeSendTarget(u8 connType, u8 slotStatusIndex, u8 bmNewTgtSlot) { imeBak = REG_IME; REG_IME = 0; - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) { if ((connType >> i) & 1) gRfuSlotStatusNI[i]->send.failCounter = 0; @@ -1536,7 +1536,7 @@ u16 rfu_changeSendTarget(u8 connType, u8 slotStatusIndex, u8 bmNewTgtSlot) if (gRfuSlotStatusUNI[slotStatusIndex]->send.state != SLOT_STATE_SEND_UNI) return ERR_SLOT_NOT_SENDING; - for (bmSlot = 0, i = 0; i < RFU_CHILD_MAX; ++i) + for (bmSlot = 0, i = 0; i < RFU_CHILD_MAX; i++) if (i != slotStatusIndex) bmSlot |= gRfuSlotStatusUNI[i]->send.bmSlot; if (bmNewTgtSlot & bmSlot) @@ -1695,7 +1695,7 @@ static void rfu_CB_sendData(UNUSED u8 reqCommand, u16 reqResult) if (reqResult == 0) { - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) { if (gRfuSlotStatusUNI[i]->send.dataReadyFlag) gRfuSlotStatusUNI[i]->send.dataReadyFlag = 0; @@ -1739,7 +1739,7 @@ static void rfu_constructSendLLFrame(void) gRfuLinkStatus->LLFReadyFlag = 0; pakcketSize = 0; llf_p = (u8 *)&gRfuFixed->LLFBuffer[1]; - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) { currSize = 0; if (gRfuSlotStatusNI[i]->send.state & SLOT_BUSY_FLAG) @@ -1815,7 +1815,7 @@ static u16 rfu_STC_NI_constructLLSF(u8 bm_slot_id, u8 **dest_pp, struct NIComm * if (gRfuLinkStatus->parentChild == MODE_PARENT) frame |= NI_comm->bmSlot << 18; frame8_p = (u8 *)&frame; - for (i = 0; i < llsf->frameSize; ++i) + for (i = 0; i < llsf->frameSize; i++) *(*dest_pp)++ = *frame8_p++; if (size != 0) { @@ -1853,7 +1853,7 @@ static u16 rfu_STC_UNI_constructLLSF(u8 bm_slot_id, u8 **dest_p) if (gRfuLinkStatus->parentChild == MODE_PARENT) frame |= UNI_send->bmSlot << 18; frame8_p = (u8 *)&frame; - for (i = 0; i < llsf->frameSize; ++i) + for (i = 0; i < llsf->frameSize; i++) *(*dest_p)++ = *frame8_p++; src_p = UNI_send->src; gRfuFixed->fastCopyPtr(&src_p, dest_p, UNI_send->payloadSize); @@ -1888,7 +1888,7 @@ static void rfu_CB_recvData(u8 reqCommand, u16 reqResult) rfu_STC_PARENT_analyzeRecvPacket(); else rfu_STC_CHILD_analyzeRecvPacket(); - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) { slotStatusNI = gRfuSlotStatusNI[i]; if (slotStatusNI->recv.state == SLOT_STATE_RECV_LAST && !((gRfuStatic->NIEndRecvFlag >> i) & 1)) @@ -1972,7 +1972,7 @@ static u16 rfu_STC_analyzeLLSF(u8 slot_id, const u8 *src, u16 last_frame) if (last_frame < llsf_p->frameSize) return last_frame; frames = 0; - for (i = 0; i < llsf_p->frameSize; ++i) + for (i = 0; i < llsf_p->frameSize; i++) frames |= *src++ << 8 * i; llsf_NI.recvFirst = (frames >> llsf_p->recvFirstShift) & llsf_p->recvFirstMask; llsf_NI.connSlotFlag = (frames >> llsf_p->connSlotFlagShift) & llsf_p->connSlotFlagMask; @@ -1998,7 +1998,7 @@ static u16 rfu_STC_analyzeLLSF(u8 slot_id, const u8 *src, u16 last_frame) } else { - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) if (((gRfuSlotStatusNI[i]->send.bmSlot >> slot_id) & 1) && ((gRfuLinkStatus->sendSlotNIFlag >> slot_id) & 1)) break; @@ -2013,7 +2013,7 @@ static u16 rfu_STC_analyzeLLSF(u8 slot_id, const u8 *src, u16 last_frame) if (conSlots) { - for (i = 0; i < RFU_CHILD_MAX; ++i) + for (i = 0; i < RFU_CHILD_MAX; i++) { if ((conSlots >> i) & 1) { @@ -2104,7 +2104,7 @@ static void rfu_STC_NI_receive_Sender(u8 NI_slot, u8 bm_flag, const struct RfuLo NI_comm->phase = 0; if (NI_comm->state == SLOT_STATE_SEND_START) { - for (i = 0; i < WINDOW_COUNT; ++i) + for (i = 0; i < WINDOW_COUNT; i++) { NI_comm->n[i] = 1; NI_comm->now_p[i] = NI_comm->src + NI_comm->payloadSize * i; diff --git a/src/librfu_stwi.c b/src/librfu_stwi.c index b515f338e..b765f00fb 100644 --- a/src/librfu_stwi.c +++ b/src/librfu_stwi.c @@ -208,13 +208,13 @@ void STWI_send_GameConfigREQ(const u8 *serial_gname, const u8 *uname) *(u16 *)packetBytes = *(u16 *)serial_gname; packetBytes += sizeof(u16); serial_gname += sizeof(u16); - for (i = 0; i < 14; ++i) + for (i = 0; i < 14; i++) { *packetBytes = *serial_gname; ++packetBytes; ++serial_gname; } - for (i = 0; i < 8; ++i) + for (i = 0; i < 8; i++) { *packetBytes = *uname; ++packetBytes; diff --git a/src/map_name_popup.c b/src/map_name_popup.c index 41054d16d..866072a2c 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -186,7 +186,7 @@ static const u8 sText_PyramidFloor6[] = _("PYRAMID FLOOR 6"); static const u8 sText_PyramidFloor7[] = _("PYRAMID FLOOR 7"); static const u8 sText_Pyramid[] = _("PYRAMID"); -static const u8 * const sBattlePyramid_MapHeaderStrings[FRONTIER_STAGES_PER_CHALLENGE + 1] = +static const u8 *const sBattlePyramid_MapHeaderStrings[FRONTIER_STAGES_PER_CHALLENGE + 1] = { sText_PyramidFloor1, sText_PyramidFloor2, diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 241aed00c..9ae387cff 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -46,7 +46,7 @@ static const u16 sDefaultBardSongLyrics[BARD_SONG_LENGTH] = { EC_WORD_DANCE }; -static const u8 * const sGiddyAdjectives[] = { +static const u8 *const sGiddyAdjectives[] = { GiddyText_SoPretty, GiddyText_SoDarling, GiddyText_SoRelaxed, @@ -60,7 +60,7 @@ static const u8 * const sGiddyAdjectives[] = { // Non-random lines Giddy can say. Not all are strictly // questions, but most are, and the player will receive // a Yes/No prompt afterwards regardless. -static const u8 * const sGiddyQuestions[GIDDY_MAX_QUESTIONS] = { +static const u8 *const sGiddyQuestions[GIDDY_MAX_QUESTIONS] = { GiddyText_ISoWantToGoOnAVacation, GiddyText_IBoughtCrayonsWith120Colors, GiddyText_WouldntItBeNiceIfWeCouldFloat, diff --git a/src/pokemon.c b/src/pokemon.c index d9976b6a2..8786405c8 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1945,7 +1945,7 @@ const struct SpriteTemplate gBattlerSpriteTemplates[MAX_BATTLERS_COUNT] = .anims = NULL, .images = gBattlerPicTable_OpponentLeft, .affineAnims = gAffineAnims_BattleSpriteOpponentSide, - .callback = SpriteCb_WildMon, + .callback = SpriteCB_WildMon, }, [B_POSITION_PLAYER_RIGHT] = { .tileTag = TAG_NONE, @@ -1963,7 +1963,7 @@ const struct SpriteTemplate gBattlerSpriteTemplates[MAX_BATTLERS_COUNT] = .anims = NULL, .images = gBattlerPicTable_OpponentRight, .affineAnims = gAffineAnims_BattleSpriteOpponentSide, - .callback = SpriteCb_WildMon + .callback = SpriteCB_WildMon }, }; diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index bdbca31d0..aa55e42c7 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -305,7 +305,7 @@ static void RemoveAndCreateMonMarkingsSprite(struct Pokemon *); static void CreateCaughtBallSprite(struct Pokemon *); static void CreateSetStatusSprite(void); static void CreateMoveSelectorSprites(u8); -static void SpriteCb_MoveSelector(struct Sprite *); +static void SpriteCB_MoveSelector(struct Sprite *); static void DestroyMoveSelectorSprites(u8); static void SetMainMoveSelectorColor(u8); static void KeepMoveSelectorVisible(u8); @@ -4082,14 +4082,14 @@ static void CreateMoveSelectorSprites(u8 idArrayStart) else StartSpriteAnim(&gSprites[spriteIds[i]], 6); // middle - gSprites[spriteIds[i]].callback = SpriteCb_MoveSelector; + gSprites[spriteIds[i]].callback = SpriteCB_MoveSelector; gSprites[spriteIds[i]].data[0] = idArrayStart; gSprites[spriteIds[i]].data[1] = 0; } } } -static void SpriteCb_MoveSelector(struct Sprite *sprite) +static void SpriteCB_MoveSelector(struct Sprite *sprite) { if (sprite->animNum > 3 && sprite->animNum < 7) { diff --git a/src/rom_header_gf.c b/src/rom_header_gf.c index 2723e1200..62eaed8cd 100644 --- a/src/rom_header_gf.c +++ b/src/rom_header_gf.c @@ -15,7 +15,7 @@ struct GFRomHeader const struct CompressedSpriteSheet * monBackPics; const struct CompressedSpritePalette * monNormalPalettes; const struct CompressedSpritePalette * monShinyPalettes; - const u8 * const * monIcons; + const u8 *const * monIcons; const u8 * monIconPaletteIds; const struct SpritePalette * monIconPalettes; const u8 (* monSpeciesNames)[]; @@ -62,7 +62,7 @@ struct GFRomHeader u32 unk18; const struct BaseStats * baseStats; const u8 (* abilityNames)[]; - const u8 * const * abilityDescriptions; + const u8 *const * abilityDescriptions; const struct Item * items; const struct BattleMove * moves; const struct CompressedSpriteSheet * ballGfx; diff --git a/src/scrcmd.c b/src/scrcmd.c index fe5cf95d7..53a5d4a29 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -84,7 +84,7 @@ static const u8 sScriptConditionTable[6][3] = 1, 0, 1, // != }; -static u8 * const sScriptStringVars[] = +static u8 *const sScriptStringVars[] = { gStringVar1, gStringVar2, diff --git a/src/trader.c b/src/trader.c index 040ee695b..3de2a4846 100644 --- a/src/trader.c +++ b/src/trader.c @@ -15,7 +15,7 @@ #include "task.h" #include "script_menu.h" -static const u8 * const sDefaultTraderNames[NUM_TRADER_ITEMS] = +static const u8 *const sDefaultTraderNames[NUM_TRADER_ITEMS] = { gText_Tristan, gText_Philip, diff --git a/tools/jsonproc/inja.hpp b/tools/jsonproc/inja.hpp index d5bf5bcba..56e4027f8 100755 --- a/tools/jsonproc/inja.hpp +++ b/tools/jsonproc/inja.hpp @@ -2811,7 +2811,7 @@ class Renderer { if ((bc.flags & Bytecode::Flag::ValueMask) != Bytecode::Flag::ValuePop) { popArgs -= 1; } - for (unsigned int i = 0; i < popArgs; ++i) { + for (unsigned int i = 0; i < popArgs; i++) { m_stack.pop_back(); } } @@ -2925,7 +2925,7 @@ class Renderer { void render_to(std::ostream& os, const Template& tmpl, const json& data) { m_data = &data; - for (size_t i = 0; i < tmpl.bytecodes.size(); ++i) { + for (size_t i = 0; i < tmpl.bytecodes.size(); i++) { const auto& bc = tmpl.bytecodes[i]; switch (bc.op) { diff --git a/tools/jsonproc/nlohmann/json.hpp b/tools/jsonproc/nlohmann/json.hpp index 5003a4fa2..15ab684dd 100755 --- a/tools/jsonproc/nlohmann/json.hpp +++ b/tools/jsonproc/nlohmann/json.hpp @@ -1438,7 +1438,7 @@ auto from_json_array_impl(const BasicJsonType& j, std::array& arr, priority_tag<2> /*unused*/) -> decltype(j.template get(), void()) { - for (std::size_t i = 0; i < N; ++i) + for (std::size_t i = 0; i < N; i++) { arr[i] = j.at(i).template get(); } @@ -4301,7 +4301,7 @@ class binary_reader if (len != std::size_t(-1)) { - for (std::size_t i = 0; i < len; ++i) + for (std::size_t i = 0; i < len; i++) { if (JSON_UNLIKELY(not parse_cbor_internal())) { @@ -4338,7 +4338,7 @@ class binary_reader string_t key; if (len != std::size_t(-1)) { - for (std::size_t i = 0; i < len; ++i) + for (std::size_t i = 0; i < len; i++) { get(); if (JSON_UNLIKELY(not get_cbor_string(key) or not sax->key(key))) @@ -4832,7 +4832,7 @@ class binary_reader return false; } - for (std::size_t i = 0; i < len; ++i) + for (std::size_t i = 0; i < len; i++) { if (JSON_UNLIKELY(not parse_msgpack_internal())) { @@ -4855,7 +4855,7 @@ class binary_reader } string_t key; - for (std::size_t i = 0; i < len; ++i) + for (std::size_t i = 0; i < len; i++) { get(); if (JSON_UNLIKELY(not get_msgpack_string(key) or not sax->key(key))) @@ -5190,7 +5190,7 @@ class binary_reader { if (size_and_type.second != 'N') { - for (std::size_t i = 0; i < size_and_type.first; ++i) + for (std::size_t i = 0; i < size_and_type.first; i++) { if (JSON_UNLIKELY(not get_ubjson_value(size_and_type.second))) { @@ -5201,7 +5201,7 @@ class binary_reader } else { - for (std::size_t i = 0; i < size_and_type.first; ++i) + for (std::size_t i = 0; i < size_and_type.first; i++) { if (JSON_UNLIKELY(not parse_ubjson_internal())) { @@ -5251,7 +5251,7 @@ class binary_reader if (size_and_type.second != 0) { - for (std::size_t i = 0; i < size_and_type.first; ++i) + for (std::size_t i = 0; i < size_and_type.first; i++) { if (JSON_UNLIKELY(not get_ubjson_string(key) or not sax->key(key))) { @@ -5266,7 +5266,7 @@ class binary_reader } else { - for (std::size_t i = 0; i < size_and_type.first; ++i) + for (std::size_t i = 0; i < size_and_type.first; i++) { if (JSON_UNLIKELY(not get_ubjson_string(key) or not sax->key(key))) { @@ -5356,7 +5356,7 @@ class binary_reader { // step 1: read input into array with system's byte order std::array vec; - for (std::size_t i = 0; i < sizeof(NumberType); ++i) + for (std::size_t i = 0; i < sizeof(NumberType); i++) { get(); if (JSON_UNLIKELY(not unexpect_eof(format, "number"))) @@ -6705,7 +6705,7 @@ scan_number_done: token_type return_type) { assert(current == literal_text[0]); - for (std::size_t i = 1; i < length; ++i) + for (std::size_t i = 1; i < length; i++) { if (JSON_UNLIKELY(get() != literal_text[i])) { @@ -9235,7 +9235,7 @@ class json_pointer else { // iterate array and use index as reference string - for (std::size_t i = 0; i < value.m_value.array->size(); ++i) + for (std::size_t i = 0; i < value.m_value.array->size(); i++) { flatten(reference_string + "/" + std::to_string(i), value.m_value.array->operator[](i), result); @@ -12183,7 +12183,7 @@ class serializer // first n-1 elements for (auto i = val.m_value.array->cbegin(); - i != val.m_value.array->cend() - 1; ++i) + i != val.m_value.array->cend() - 1; i++) { o->write_characters(indent_string.c_str(), new_indent); dump(*i, true, ensure_ascii, indent_step, new_indent); @@ -12205,7 +12205,7 @@ class serializer // first n-1 elements for (auto i = val.m_value.array->cbegin(); - i != val.m_value.array->cend() - 1; ++i) + i != val.m_value.array->cend() - 1; i++) { dump(*i, false, ensure_ascii, indent_step, current_indent); o->write_character(','); @@ -12302,7 +12302,7 @@ class serializer std::size_t bytes_after_last_accept = 0; std::size_t undumped_chars = 0; - for (std::size_t i = 0; i < s.size(); ++i) + for (std::size_t i = 0; i < s.size(); i++) { const auto byte = static_cast(s[i]); From 44b26cc8aa1203e6a6824f21cf4d43335d1fe6a0 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Mon, 15 Aug 2022 18:27:37 -0400 Subject: [PATCH 2/6] From pokefirered --- src/battle_main.c | 3 +-- src/battle_util.c | 52 +++++++++++++++++++++++------------------------ 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/battle_main.c b/src/battle_main.c index d80542f7b..0b1561ddf 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -772,8 +772,7 @@ static void SetPlayerBerryDataInBattleStruct(void) static void SetAllPlayersBerryData(void) { - s32 i; - s32 j; + s32 i, j; if (!(gBattleTypeFlags & BATTLE_TYPE_LINK)) { diff --git a/src/battle_util.c b/src/battle_util.c index 498db4162..4ba9376a5 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1109,8 +1109,7 @@ u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check) #define ALL_MOVES_MASK ((1 << MAX_MON_MOVES) - 1) bool8 AreAllMovesUnusable(void) { - u8 unusable; - unusable = CheckMoveLimitations(gActiveBattler, 0, MOVE_LIMITATIONS_ALL); + u8 unusable = CheckMoveLimitations(gActiveBattler, 0, MOVE_LIMITATIONS_ALL); if (unusable == ALL_MOVES_MASK) // All moves are unusable. { @@ -1261,8 +1260,7 @@ u8 DoFieldEndTurnEffects(void) { side = gBattleStruct->turnSideTracker; gActiveBattler = gBattlerAttacker = gSideTimers[side].mistBattlerId; - if (gSideTimers[side].mistTimer != 0 - && --gSideTimers[side].mistTimer == 0) + if (gSideTimers[side].mistTimer != 0 && --gSideTimers[side].mistTimer == 0) { gSideStatuses[side] &= ~SIDE_STATUS_MIST; BattleScriptExecute(BattleScript_SideStatusWoreOff); @@ -2262,8 +2260,8 @@ u8 AtkCanceller_UnableToUseMove(void) bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2) { + u8 playerId, flankId; struct Pokemon *party; - u8 id1, id2; s32 i; if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) @@ -2276,15 +2274,15 @@ bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2) else party = gEnemyParty; - id1 = ((battler & BIT_FLANK) / 2); - for (i = id1 * MULTI_PARTY_SIZE; i < id1 * MULTI_PARTY_SIZE + MULTI_PARTY_SIZE; i++) + playerId = ((battler & BIT_FLANK) / 2); + for (i = playerId * MULTI_PARTY_SIZE; i < playerId * MULTI_PARTY_SIZE + MULTI_PARTY_SIZE; i++) { if (GetMonData(&party[i], MON_DATA_HP) != 0 && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG) break; } - return (i == id1 * MULTI_PARTY_SIZE + MULTI_PARTY_SIZE); + return (i == playerId * MULTI_PARTY_SIZE + MULTI_PARTY_SIZE); } else if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { @@ -2293,76 +2291,76 @@ bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2) if (GetBattlerSide(battler) == B_SIDE_PLAYER) { party = gPlayerParty; - id2 = GetBattlerMultiplayerId(battler); - id1 = GetLinkTrainerFlankId(id2); + flankId = GetBattlerMultiplayerId(battler); + playerId = GetLinkTrainerFlankId(flankId); } else { party = gEnemyParty; if (battler == 1) - id1 = 0; + playerId = 0; else - id1 = 1; + playerId = 1; } } else { - id2 = GetBattlerMultiplayerId(battler); + flankId = GetBattlerMultiplayerId(battler); if (GetBattlerSide(battler) == B_SIDE_PLAYER) party = gPlayerParty; else party = gEnemyParty; - id1 = GetLinkTrainerFlankId(id2); + playerId = GetLinkTrainerFlankId(flankId); } - for (i = id1 * MULTI_PARTY_SIZE; i < id1 * MULTI_PARTY_SIZE + MULTI_PARTY_SIZE; i++) + for (i = playerId * MULTI_PARTY_SIZE; i < playerId * MULTI_PARTY_SIZE + MULTI_PARTY_SIZE; i++) { if (GetMonData(&party[i], MON_DATA_HP) != 0 && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG) break; } - return (i == id1 * MULTI_PARTY_SIZE + MULTI_PARTY_SIZE); + return (i == playerId * MULTI_PARTY_SIZE + MULTI_PARTY_SIZE); } else if ((gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) && GetBattlerSide(battler) == B_SIDE_OPPONENT) { party = gEnemyParty; if (battler == 1) - id1 = 0; + playerId = 0; else - id1 = MULTI_PARTY_SIZE; + playerId = MULTI_PARTY_SIZE; - for (i = id1; i < id1 + MULTI_PARTY_SIZE; i++) + for (i = playerId; i < playerId + MULTI_PARTY_SIZE; i++) { if (GetMonData(&party[i], MON_DATA_HP) != 0 && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG) break; } - return (i == id1 + 3); + return (i == playerId + 3); } else { if (GetBattlerSide(battler) == B_SIDE_OPPONENT) { - id2 = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); - id1 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); + flankId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); + playerId = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT); party = gEnemyParty; } else { - id2 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); - id1 = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); + flankId = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); + playerId = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT); party = gPlayerParty; } if (partyIdBattlerOn1 == PARTY_SIZE) - partyIdBattlerOn1 = gBattlerPartyIndexes[id2]; + partyIdBattlerOn1 = gBattlerPartyIndexes[flankId]; if (partyIdBattlerOn2 == PARTY_SIZE) - partyIdBattlerOn2 = gBattlerPartyIndexes[id1]; + partyIdBattlerOn2 = gBattlerPartyIndexes[playerId]; for (i = 0; i < PARTY_SIZE; i++) { @@ -2370,7 +2368,7 @@ bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2) && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_NONE && GetMonData(&party[i], MON_DATA_SPECIES2) != SPECIES_EGG && i != partyIdBattlerOn1 && i != partyIdBattlerOn2 - && i != *(gBattleStruct->monToSwitchIntoId + id2) && i != id1[gBattleStruct->monToSwitchIntoId]) + && i != *(gBattleStruct->monToSwitchIntoId + flankId) && i != playerId[gBattleStruct->monToSwitchIntoId]) break; } return (i == PARTY_SIZE); From 7b0c8ec97245b9eebdf354acae4fd00ea408a8a9 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Mon, 15 Aug 2022 20:41:12 -0400 Subject: [PATCH 3/6] Revert style changes --- gflib/text.c | 6 +-- gflib/window.c | 16 +++---- src/battle_gfx_sfx_util.c | 4 +- src/battle_main.c | 2 +- src/battle_message.c | 10 ++--- src/battle_util.c | 10 ++--- src/fldeff_cut.c | 2 +- src/librfu_rfu.c | 76 ++++++++++++++++---------------- src/librfu_stwi.c | 4 +- src/map_name_popup.c | 2 +- src/mauville_old_man.c | 4 +- src/rom_header_gf.c | 4 +- src/scrcmd.c | 2 +- src/trader.c | 2 +- tools/jsonproc/inja.hpp | 4 +- tools/jsonproc/nlohmann/json.hpp | 30 ++++++------- 16 files changed, 89 insertions(+), 89 deletions(-) diff --git a/gflib/text.c b/gflib/text.c index 9d7e14efa..c7efdccce 100644 --- a/gflib/text.c +++ b/gflib/text.c @@ -301,7 +301,7 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, voi sTempTextPrinter.textSpeed = 0; // Render all text (up to limit) at once - for (j = 0; j < 0x400; j++) + for (j = 0; j < 0x400; ++j) { if (RenderFont(&sTempTextPrinter) == RENDER_FINISH) break; @@ -322,7 +322,7 @@ void RunTextPrinters(void) if (!gDisableTextPrinters) { - for (i = 0; i < NUM_TEXT_PRINTERS; i++) + for (i = 0; i < NUM_TEXT_PRINTERS; ++i) { if (sTextPrinters[i].active) { @@ -1318,7 +1318,7 @@ static u32 (*GetFontWidthFunc(u8 fontId))(u16, bool32) { u32 i; - for (i = 0; i < ARRAY_COUNT(sGlyphWidthFuncs); i++) + for (i = 0; i < ARRAY_COUNT(sGlyphWidthFuncs); ++i) { if (fontId == sGlyphWidthFuncs[i].fontId) return sGlyphWidthFuncs[i].func; diff --git a/gflib/window.c b/gflib/window.c index 27faac384..ff9e8a6e0 100644 --- a/gflib/window.c +++ b/gflib/window.c @@ -38,7 +38,7 @@ bool16 InitWindows(const struct WindowTemplate *templates) u8 *allocatedTilemapBuffer; int allocatedBaseBlock; - for (i = 0; i < NUM_BACKGROUNDS; i++) + for (i = 0; i < NUM_BACKGROUNDS; ++i) { bgTilemapBuffer = GetBgTilemapBuffer(i); if (bgTilemapBuffer != NULL) @@ -47,7 +47,7 @@ bool16 InitWindows(const struct WindowTemplate *templates) gWindowBgTilemapBuffers[i] = bgTilemapBuffer; } - for (i = 0; i < WINDOWS_MAX; i++) + for (i = 0; i < WINDOWS_MAX; ++i) { gWindows[i].window = sDummyWindowTemplate; gWindows[i].tileData = NULL; @@ -76,7 +76,7 @@ bool16 InitWindows(const struct WindowTemplate *templates) return FALSE; } - for (j = 0; j < attrib; j++) + for (j = 0; j < attrib; ++j) allocatedTilemapBuffer[j] = 0; gWindowBgTilemapBuffers[bgLayer] = allocatedTilemapBuffer; @@ -151,7 +151,7 @@ u16 AddWindow(const struct WindowTemplate *template) if (allocatedTilemapBuffer == NULL) return WINDOW_NONE; - for (i = 0; i < attrib; i++) + for (i = 0; i < attrib; ++i) allocatedTilemapBuffer[i] = 0; gWindowBgTilemapBuffers[bgLayer] = allocatedTilemapBuffer; @@ -249,7 +249,7 @@ void FreeAllWindowBuffers(void) { int i; - for (i = 0; i < NUM_BACKGROUNDS; i++) + for (i = 0; i < NUM_BACKGROUNDS; ++i) { if (gWindowBgTilemapBuffers[i] != NULL && gWindowBgTilemapBuffers[i] != DummyWindowBgTilemap) { @@ -258,7 +258,7 @@ void FreeAllWindowBuffers(void) } } - for (i = 0; i < WINDOWS_MAX; i++) + for (i = 0; i < WINDOWS_MAX; ++i) { if (gWindows[i].tileData != NULL) { @@ -342,7 +342,7 @@ void PutWindowRectTilemapOverridePalette(u8 windowId, u8 x, u8 y, u8 width, u8 h u16 currentRow = windowLocal.window.baseBlock + (y * windowLocal.window.width) + x + GetBgAttribute(windowLocal.window.bg, BG_ATTR_BASETILE); int i; - for (i = 0; i < height; i++) + for (i = 0; i < height; ++i) { WriteSequenceToBgTilemapBuffer( windowLocal.window.bg, @@ -379,7 +379,7 @@ void PutWindowRectTilemap(u8 windowId, u8 x, u8 y, u8 width, u8 height) u16 currentRow = windowLocal.window.baseBlock + (y * windowLocal.window.width) + x + GetBgAttribute(windowLocal.window.bg, BG_ATTR_BASETILE); int i; - for (i = 0; i < height; i++) + for (i = 0; i < height; ++i) { WriteSequenceToBgTilemapBuffer( windowLocal.window.bg, diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index 1cb3d65bc..ca6be9d4e 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -27,8 +27,8 @@ #include "constants/battle_palace.h" extern const u8 gBattlePalaceNatureToMoveTarget[]; -extern const u8 *const gBattleAnims_General[]; -extern const u8 *const gBattleAnims_Special[]; +extern const u8 * const gBattleAnims_General[]; +extern const u8 * const gBattleAnims_Special[]; extern const struct CompressedSpriteSheet gSpriteSheet_EnemyShadow; extern const struct SpriteTemplate gSpriteTemplate_EnemyShadow; diff --git a/src/battle_main.c b/src/battle_main.c index 0b1561ddf..b748fb5b1 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -557,7 +557,7 @@ const u8 gStatusConditionString_IceJpn[] = _("こおり$$$$"); const u8 gStatusConditionString_ConfusionJpn[] = _("こんらん$$$"); const u8 gStatusConditionString_LoveJpn[] = _("メロメロ$$$"); -const u8 *const gStatusConditionStringsTable[][2] = +const u8 * const gStatusConditionStringsTable[][2] = { {gStatusConditionString_PoisonJpn, gText_Poison}, {gStatusConditionString_SleepJpn, gText_Sleep}, diff --git a/src/battle_message.c b/src/battle_message.c index 9e274926d..677bb2fe3 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -431,7 +431,7 @@ static const u8 sText_SpDef2[] = _("SP. DEF"); static const u8 sText_Accuracy[] = _("accuracy"); static const u8 sText_Evasiveness[] = _("evasiveness"); -const u8 *const gStatNamesTable[NUM_BATTLE_STATS] = +const u8 * const gStatNamesTable[NUM_BATTLE_STATS] = { [STAT_HP] = sText_HP2, [STAT_ATK] = sText_Attack2, @@ -449,7 +449,7 @@ static const u8 sText_PokeblockWasTooSweet[] = _("was too sweet!"); static const u8 sText_PokeblockWasTooBitter[] = _("was too bitter!"); static const u8 sText_PokeblockWasTooSour[] = _("was too sour!"); -const u8 *const gPokeblockWasTooXStringTable[FLAVOR_COUNT] = +const u8 * const gPokeblockWasTooXStringTable[FLAVOR_COUNT] = { [FLAVOR_SPICY] = sText_PokeblockWasTooSpicy, [FLAVOR_DRY] = sText_PokeblockWasTooDry, @@ -514,7 +514,7 @@ static const u8 sText_Trainer2WinText[]; static const u8 sText_TwoInGameTrainersDefeated[]; static const u8 sText_Trainer2LoseText[]; -const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT - BATTLESTRINGS_TABLE_START] = +const u8 * const gBattleStringsTable[BATTLESTRINGS_COUNT - BATTLESTRINGS_TABLE_START] = { [STRINGID_TRAINER1LOSETEXT - BATTLESTRINGS_TABLE_START] = sText_Trainer1LoseText, [STRINGID_PKMNGAINEDEXP - BATTLESTRINGS_TABLE_START] = sText_PkmnGainedEXP, @@ -1293,7 +1293,7 @@ static const u8 sText_SpAtk[] = _("SP. ATK"); static const u8 sText_SpDef[] = _("SP. DEF"); // Unused -static const u8 *const sStatNamesTable2[] = +static const u8 * const sStatNamesTable2[] = { sText_HP, sText_SpAtk, sText_Attack, sText_SpDef, sText_Defense, sText_Speed @@ -1405,7 +1405,7 @@ static const u8 sText_LostToOpponentByReferee[] = _("{B_PLAYER_MON1_NAME} lost t static const u8 sText_TiedOpponentByReferee[] = _("{B_PLAYER_MON1_NAME} tied the opponent\n{B_OPPONENT_MON1_NAME} in a REFEREE's decision!"); static const u8 sText_RefCommenceBattle[] = _("REFEREE: {B_PLAYER_MON1_NAME} VS {B_OPPONENT_MON1_NAME}!\nCommence battling!"); -const u8 *const gRefereeStringsTable[] = +const u8 * const gRefereeStringsTable[] = { [B_MSG_REF_NOTHING_IS_DECIDED] = sText_RefIfNothingIsDecided, [B_MSG_REF_THATS_IT] = sText_RefThatsIt, diff --git a/src/battle_util.c b/src/battle_util.c index 4ba9376a5..fd63494dd 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1223,7 +1223,7 @@ u8 DoFieldEndTurnEffects(void) if (effect != 0) break; } - if (!effect) + if (effect == 0) { gBattleStruct->turnCountersTracker++; gBattleStruct->turnSideTracker = 0; @@ -1249,7 +1249,7 @@ u8 DoFieldEndTurnEffects(void) if (effect != 0) break; } - if (!effect) + if (effect == 0) { gBattleStruct->turnCountersTracker++; gBattleStruct->turnSideTracker = 0; @@ -1272,7 +1272,7 @@ u8 DoFieldEndTurnEffects(void) if (effect != 0) break; } - if (!effect) + if (effect == 0) { gBattleStruct->turnCountersTracker++; gBattleStruct->turnSideTracker = 0; @@ -1296,7 +1296,7 @@ u8 DoFieldEndTurnEffects(void) if (effect != 0) break; } - if (!effect) + if (effect == 0) { gBattleStruct->turnCountersTracker++; gBattleStruct->turnSideTracker = 0; @@ -1318,7 +1318,7 @@ u8 DoFieldEndTurnEffects(void) if (effect != 0) break; } - if (!effect) + if (effect == 0) { gBattleStruct->turnCountersTracker++; } diff --git a/src/fldeff_cut.c b/src/fldeff_cut.c index 6cccec8ba..0641c6519 100644 --- a/src/fldeff_cut.c +++ b/src/fldeff_cut.c @@ -226,7 +226,7 @@ bool8 SetUpFieldMove_Cut(void) y = gPlayerFacingPosition.y + sHyperCutStruct[i].y; tileCuttable = TRUE; - for (j = 0; j < 2; j++) + for (j = 0; j < 2; ++j) { if (sHyperCutStruct[i].unk2[j] == 0) break; // one line required to match -g if (cutTiles[(u8)(sHyperCutStruct[i].unk2[j] - 1)] == FALSE) diff --git a/src/librfu_rfu.c b/src/librfu_rfu.c index 2e1d7e069..9a5db6d9d 100644 --- a/src/librfu_rfu.c +++ b/src/librfu_rfu.c @@ -164,7 +164,7 @@ u16 rfu_initializeAPI(u32 *APIBuffer, u16 buffByteSize, IntrFunc *sioIntrTable_p gRfuFixed = (void *)APIBuffer + 0xdc; // + sizeof(*gRfuStatic) gRfuSlotStatusNI[0] = (void *)APIBuffer + 0x1bc; // + sizeof(*gRfuFixed) gRfuSlotStatusUNI[0] = (void *)APIBuffer + 0x37c; // + sizeof(*gRfuSlotStatusNI[0]) * RFU_CHILD_MAX - for (i = 1; i < RFU_CHILD_MAX; i++) + for (i = 1; i < RFU_CHILD_MAX; ++i) { gRfuSlotStatusNI[i] = &gRfuSlotStatusNI[i - 1][1]; gRfuSlotStatusUNI[i] = &gRfuSlotStatusUNI[i - 1][1]; @@ -173,7 +173,7 @@ u16 rfu_initializeAPI(u32 *APIBuffer, u16 buffByteSize, IntrFunc *sioIntrTable_p gRfuFixed->STWIBuffer = (struct RfuIntrStruct *)&gRfuSlotStatusUNI[3][1]; STWI_init_all((struct RfuIntrStruct *)&gRfuSlotStatusUNI[3][1], sioIntrTable_p, copyInterruptToRam); rfu_STC_clearAPIVariables(); - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) { gRfuSlotStatusNI[i]->recvBuffer = NULL; gRfuSlotStatusNI[i]->recvBufferSize = 0; @@ -214,7 +214,7 @@ static void rfu_STC_clearAPIVariables(void) gRfuLinkStatus->parentChild = MODE_NEUTRAL; rfu_clearAllSlot(); gRfuStatic->SCStartFlag = 0; - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) gRfuStatic->cidBak[i] = 0; REG_IME = IMEBackup; } @@ -294,7 +294,7 @@ static void rfu_CB_defaultCallback(u8 reqCommand, u16 reqResult) if (gRfuStatic->flags & 8) gRfuFixed->reqCallback(reqCommand, reqResult); bmSlotFlags = gRfuLinkStatus->connSlotFlag | gRfuLinkStatus->linkLossSlotFlag; - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) if ((bmSlotFlags >> i) & 1) rfu_STC_removeLinkData(i, 1); gRfuLinkStatus->parentChild = MODE_NEUTRAL; @@ -351,7 +351,7 @@ u16 rfu_MBOOT_CHILD_inheritanceLinkStatus(void) // The size of struct RfuLinkStatus is 180 checksum = 0; - for (i = 0; i < 180/2; i++) + for (i = 0; i < 180/2; ++i) checksum += *mb_buff_iwram_p++; if (checksum != *(u16 *)0x30000FA) return 1; @@ -455,11 +455,11 @@ void rfu_REQ_configGameData(u8 mbootFlag, u16 serialNo, const u8 *gname, const u packet[1] = serialNo >> 8; if (mbootFlag != 0) packet[1] = (serialNo >> 8) | 0x80; - for (i = 2; i < 15; i++) + for (i = 2; i < 15; ++i) packet[i] = *gname++; check_sum = 0; unameBackup = uname; - for (i = 0; i < 8; i++) + for (i = 0; i < 8; ++i) { check_sum += *unameBackup++; check_sum += *gnameBackup++; @@ -493,10 +493,10 @@ static void rfu_CB_configGameData(u8 reqCommand, u16 reqResult) { gRfuLinkStatus->my.mbootFlag = 0; } - for (i = 0; i < RFU_GAME_NAME_LENGTH; i++) + for (i = 0; i < RFU_GAME_NAME_LENGTH; ++i) gRfuLinkStatus->my.gname[i] = *gname_uname_p++; ++gname_uname_p; - for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++) + for (i = 0; i < PLAYER_NAME_LENGTH + 1; ++i) gRfuLinkStatus->my.uname[i] = *gname_uname_p++; } rfu_STC_REQ_callback(reqCommand, reqResult); @@ -546,7 +546,7 @@ static void rfu_STC_clearLinkStatus(u8 parentChild) CpuFill16(0, gRfuLinkStatus->partner, sizeof(gRfuLinkStatus->partner)); gRfuLinkStatus->findParentCount = 0; } - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) gRfuLinkStatus->strength[i] = 0; gRfuLinkStatus->connCount = 0; gRfuLinkStatus->connSlotFlag = 0; @@ -609,7 +609,7 @@ static void rfu_STC_readChildList(void) if (STWI_poll_CommandEnd() == 0) { data_p = &gRfuFixed->STWIBuffer->rxPacketAlloc.rfuPacket8.data[4]; - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) true_slots[i] = *data_p++; } gRfuFixed->STWIBuffer->rxPacketAlloc.rfuPacket32.data[0] = stwiParam; @@ -696,7 +696,7 @@ static void rfu_STC_readParentCandidateList(void) numSlots = packet_p[1]; packet_p += 4; gRfuLinkStatus->findParentCount = 0; - for (i = 0; i < RFU_CHILD_MAX && numSlots != 0; i++) + for (i = 0; i < RFU_CHILD_MAX && numSlots != 0; ++i) { numSlots -= 7; uname_p = packet_p + 6; @@ -704,7 +704,7 @@ static void rfu_STC_readParentCandidateList(void) check_sum = ~*packet_p; ++packet_p; my_check_sum = 0; - for (j = 0; j < 8; j++) + for (j = 0; j < 8; ++j) { my_check_sum += *packet_p++; my_check_sum += *uname_p++; @@ -723,10 +723,10 @@ static void rfu_STC_readParentCandidateList(void) else target->mbootFlag = 0; packet_p += 2; - for (j = 0; j < RFU_GAME_NAME_LENGTH; j++) + for (j = 0; j < RFU_GAME_NAME_LENGTH; ++j) target->gname[j] = *packet_p++; ++packet_p; - for (j = 0; j < PLAYER_NAME_LENGTH + 1; j++) + for (j = 0; j < PLAYER_NAME_LENGTH + 1; ++j) target->uname[j] = *packet_p++; ++gRfuLinkStatus->findParentCount; } @@ -737,7 +737,7 @@ void rfu_REQ_startConnectParent(u16 pid) { u16 result = 0; u8 i; - for (i = 0; i < RFU_CHILD_MAX && gRfuLinkStatus->partner[i].id != pid; i++) + for (i = 0; i < RFU_CHILD_MAX && gRfuLinkStatus->partner[i].id != pid; ++i) ; if (i == RFU_CHILD_MAX) result = ERR_PID_NOT_FOUND; @@ -782,7 +782,7 @@ static void rfu_CB_pollConnectParent(u8 reqCommand, u16 reqResult) ++gRfuLinkStatus->connCount; gRfuLinkStatus->parentChild = MODE_CHILD; gRfuStatic->flags |= 0x80; - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) { if (gRfuLinkStatus->partner[i].id == gRfuStatic->tryPid) { @@ -868,7 +868,7 @@ u16 rfu_syncVBlank(void) { gRfuStatic->flags &= 0xFB; bmSlotFlag = gRfuLinkStatus->connSlotFlag | gRfuLinkStatus->linkLossSlotFlag; - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) if ((bmSlotFlag >> i) & 1) rfu_STC_removeLinkData(i, 1); gRfuLinkStatus->parentChild = MODE_NEUTRAL; @@ -921,7 +921,7 @@ u16 rfu_REQBN_watchLink(u16 reqCommandId, u8 *bmLinkLossSlot, u8 *linkLossReason newLinkLossFlag ^= gRfuLinkStatus->connSlotFlag; *bmLinkLossSlot = newLinkLossFlag & gRfuLinkStatus->connSlotFlag; *linkLossReason = REASON_LINK_LOSS; - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) { if ((*bmLinkLossSlot >> i) & 1) { @@ -941,7 +941,7 @@ u16 rfu_REQBN_watchLink(u16 reqCommandId, u8 *bmLinkLossSlot, u8 *linkLossReason if (reqResult == 0) { packet_p = &gRfuFixed->STWIBuffer->rxPacketAlloc.rfuPacket8.data[4]; - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) gRfuLinkStatus->strength[i] = *packet_p++; to_req_disconnect = 0; i = 0; @@ -951,7 +951,7 @@ u16 rfu_REQBN_watchLink(u16 reqCommandId, u8 *bmLinkLossSlot, u8 *linkLossReason rfu_STC_REQ_callback(ID_LINK_STATUS_REQ, reqResult); return reqResult; } - for (; i < RFU_CHILD_MAX; i++) + for (; i < RFU_CHILD_MAX; ++i) { #if LIBRFU_VERSION >= 1026 if (gRfuStatic->lsFixedCount[i] != 0) @@ -1128,7 +1128,7 @@ static void rfu_CB_disconnect(u8 reqCommand, u16 reqResult) gRfuFixed->STWIBuffer->rxPacketAlloc.rfuPacket8.data[8] = gRfuStatic->recoveryBmSlot; if (reqResult == 0) { - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) { bm_slot_flag = 1 << i; if (bm_slot_flag & gRfuStatic->recoveryBmSlot) @@ -1153,7 +1153,7 @@ void rfu_REQ_CHILD_startConnectRecovery(u8 bmRecoverySlot) u8 i; gRfuStatic->recoveryBmSlot = bmRecoverySlot; - for (i = 0; i < RFU_CHILD_MAX && !((bmRecoverySlot >> i) & 1); i++) + for (i = 0; i < RFU_CHILD_MAX && !((bmRecoverySlot >> i) & 1); ++i) ; STWI_set_Callback_M(rfu_STC_REQ_callback); // if i == 4, gRfuLinkStatus->partner[i].id becomes gRfuLinkStatus->my.id @@ -1174,7 +1174,7 @@ static void rfu_CB_CHILD_pollConnectRecovery(u8 reqCommand, u16 reqResult) if (reqResult == 0 && gRfuFixed->STWIBuffer->rxPacketAlloc.rfuPacket8.data[4] == 0 && gRfuStatic->recoveryBmSlot) { gRfuLinkStatus->parentChild = MODE_CHILD; - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) { bm_slot_flag = 1 << i; rfuLinkStatus = gRfuLinkStatus; // ??? @@ -1256,7 +1256,7 @@ void rfu_clearAllSlot(void) u16 IMEBackup = REG_IME; REG_IME = 0; - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) { CpuFill16(0, gRfuSlotStatusNI[i], 2 * sizeof(struct NIComm)); CpuFill16(0, gRfuSlotStatusUNI[i], sizeof(struct UNISend) + sizeof(struct UNIRecv)); @@ -1324,7 +1324,7 @@ u16 rfu_clearSlot(u8 connTypeFlag, u8 slotStatusIndex) if (NI_comm->state & SLOT_BUSY_FLAG) { rfu_STC_releaseFrame(slotStatusIndex, send_recv, NI_comm); - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) if ((NI_comm->bmSlotOrg >> i) & 1) NI_comm->failCounter = 0; } @@ -1450,7 +1450,7 @@ static u16 rfu_STC_setSendData_org(u8 ni_or_uni, u8 bmSendSlot, u8 subFrameSize, slotStatus_NI->send.src = src; slotStatus_NI->send.ack = 0; slotStatus_NI->send.phase = 0; - for (i = 0; i < WINDOW_COUNT; i++) + for (i = 0; i < WINDOW_COUNT; ++i) { slotStatus_NI->send.recvAckFlag[i] = 0; slotStatus_NI->send.n[i] = 1; @@ -1503,7 +1503,7 @@ u16 rfu_changeSendTarget(u8 connType, u8 slotStatusIndex, u8 bmNewTgtSlot) { imeBak = REG_IME; REG_IME = 0; - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) { if ((connType >> i) & 1) gRfuSlotStatusNI[i]->send.failCounter = 0; @@ -1536,7 +1536,7 @@ u16 rfu_changeSendTarget(u8 connType, u8 slotStatusIndex, u8 bmNewTgtSlot) if (gRfuSlotStatusUNI[slotStatusIndex]->send.state != SLOT_STATE_SEND_UNI) return ERR_SLOT_NOT_SENDING; - for (bmSlot = 0, i = 0; i < RFU_CHILD_MAX; i++) + for (bmSlot = 0, i = 0; i < RFU_CHILD_MAX; ++i) if (i != slotStatusIndex) bmSlot |= gRfuSlotStatusUNI[i]->send.bmSlot; if (bmNewTgtSlot & bmSlot) @@ -1695,7 +1695,7 @@ static void rfu_CB_sendData(UNUSED u8 reqCommand, u16 reqResult) if (reqResult == 0) { - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) { if (gRfuSlotStatusUNI[i]->send.dataReadyFlag) gRfuSlotStatusUNI[i]->send.dataReadyFlag = 0; @@ -1739,7 +1739,7 @@ static void rfu_constructSendLLFrame(void) gRfuLinkStatus->LLFReadyFlag = 0; pakcketSize = 0; llf_p = (u8 *)&gRfuFixed->LLFBuffer[1]; - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) { currSize = 0; if (gRfuSlotStatusNI[i]->send.state & SLOT_BUSY_FLAG) @@ -1815,7 +1815,7 @@ static u16 rfu_STC_NI_constructLLSF(u8 bm_slot_id, u8 **dest_pp, struct NIComm * if (gRfuLinkStatus->parentChild == MODE_PARENT) frame |= NI_comm->bmSlot << 18; frame8_p = (u8 *)&frame; - for (i = 0; i < llsf->frameSize; i++) + for (i = 0; i < llsf->frameSize; ++i) *(*dest_pp)++ = *frame8_p++; if (size != 0) { @@ -1853,7 +1853,7 @@ static u16 rfu_STC_UNI_constructLLSF(u8 bm_slot_id, u8 **dest_p) if (gRfuLinkStatus->parentChild == MODE_PARENT) frame |= UNI_send->bmSlot << 18; frame8_p = (u8 *)&frame; - for (i = 0; i < llsf->frameSize; i++) + for (i = 0; i < llsf->frameSize; ++i) *(*dest_p)++ = *frame8_p++; src_p = UNI_send->src; gRfuFixed->fastCopyPtr(&src_p, dest_p, UNI_send->payloadSize); @@ -1888,7 +1888,7 @@ static void rfu_CB_recvData(u8 reqCommand, u16 reqResult) rfu_STC_PARENT_analyzeRecvPacket(); else rfu_STC_CHILD_analyzeRecvPacket(); - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) { slotStatusNI = gRfuSlotStatusNI[i]; if (slotStatusNI->recv.state == SLOT_STATE_RECV_LAST && !((gRfuStatic->NIEndRecvFlag >> i) & 1)) @@ -1972,7 +1972,7 @@ static u16 rfu_STC_analyzeLLSF(u8 slot_id, const u8 *src, u16 last_frame) if (last_frame < llsf_p->frameSize) return last_frame; frames = 0; - for (i = 0; i < llsf_p->frameSize; i++) + for (i = 0; i < llsf_p->frameSize; ++i) frames |= *src++ << 8 * i; llsf_NI.recvFirst = (frames >> llsf_p->recvFirstShift) & llsf_p->recvFirstMask; llsf_NI.connSlotFlag = (frames >> llsf_p->connSlotFlagShift) & llsf_p->connSlotFlagMask; @@ -1998,7 +1998,7 @@ static u16 rfu_STC_analyzeLLSF(u8 slot_id, const u8 *src, u16 last_frame) } else { - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) if (((gRfuSlotStatusNI[i]->send.bmSlot >> slot_id) & 1) && ((gRfuLinkStatus->sendSlotNIFlag >> slot_id) & 1)) break; @@ -2013,7 +2013,7 @@ static u16 rfu_STC_analyzeLLSF(u8 slot_id, const u8 *src, u16 last_frame) if (conSlots) { - for (i = 0; i < RFU_CHILD_MAX; i++) + for (i = 0; i < RFU_CHILD_MAX; ++i) { if ((conSlots >> i) & 1) { @@ -2104,7 +2104,7 @@ static void rfu_STC_NI_receive_Sender(u8 NI_slot, u8 bm_flag, const struct RfuLo NI_comm->phase = 0; if (NI_comm->state == SLOT_STATE_SEND_START) { - for (i = 0; i < WINDOW_COUNT; i++) + for (i = 0; i < WINDOW_COUNT; ++i) { NI_comm->n[i] = 1; NI_comm->now_p[i] = NI_comm->src + NI_comm->payloadSize * i; diff --git a/src/librfu_stwi.c b/src/librfu_stwi.c index b765f00fb..b515f338e 100644 --- a/src/librfu_stwi.c +++ b/src/librfu_stwi.c @@ -208,13 +208,13 @@ void STWI_send_GameConfigREQ(const u8 *serial_gname, const u8 *uname) *(u16 *)packetBytes = *(u16 *)serial_gname; packetBytes += sizeof(u16); serial_gname += sizeof(u16); - for (i = 0; i < 14; i++) + for (i = 0; i < 14; ++i) { *packetBytes = *serial_gname; ++packetBytes; ++serial_gname; } - for (i = 0; i < 8; i++) + for (i = 0; i < 8; ++i) { *packetBytes = *uname; ++packetBytes; diff --git a/src/map_name_popup.c b/src/map_name_popup.c index 866072a2c..41054d16d 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -186,7 +186,7 @@ static const u8 sText_PyramidFloor6[] = _("PYRAMID FLOOR 6"); static const u8 sText_PyramidFloor7[] = _("PYRAMID FLOOR 7"); static const u8 sText_Pyramid[] = _("PYRAMID"); -static const u8 *const sBattlePyramid_MapHeaderStrings[FRONTIER_STAGES_PER_CHALLENGE + 1] = +static const u8 * const sBattlePyramid_MapHeaderStrings[FRONTIER_STAGES_PER_CHALLENGE + 1] = { sText_PyramidFloor1, sText_PyramidFloor2, diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 9ae387cff..241aed00c 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -46,7 +46,7 @@ static const u16 sDefaultBardSongLyrics[BARD_SONG_LENGTH] = { EC_WORD_DANCE }; -static const u8 *const sGiddyAdjectives[] = { +static const u8 * const sGiddyAdjectives[] = { GiddyText_SoPretty, GiddyText_SoDarling, GiddyText_SoRelaxed, @@ -60,7 +60,7 @@ static const u8 *const sGiddyAdjectives[] = { // Non-random lines Giddy can say. Not all are strictly // questions, but most are, and the player will receive // a Yes/No prompt afterwards regardless. -static const u8 *const sGiddyQuestions[GIDDY_MAX_QUESTIONS] = { +static const u8 * const sGiddyQuestions[GIDDY_MAX_QUESTIONS] = { GiddyText_ISoWantToGoOnAVacation, GiddyText_IBoughtCrayonsWith120Colors, GiddyText_WouldntItBeNiceIfWeCouldFloat, diff --git a/src/rom_header_gf.c b/src/rom_header_gf.c index 62eaed8cd..2723e1200 100644 --- a/src/rom_header_gf.c +++ b/src/rom_header_gf.c @@ -15,7 +15,7 @@ struct GFRomHeader const struct CompressedSpriteSheet * monBackPics; const struct CompressedSpritePalette * monNormalPalettes; const struct CompressedSpritePalette * monShinyPalettes; - const u8 *const * monIcons; + const u8 * const * monIcons; const u8 * monIconPaletteIds; const struct SpritePalette * monIconPalettes; const u8 (* monSpeciesNames)[]; @@ -62,7 +62,7 @@ struct GFRomHeader u32 unk18; const struct BaseStats * baseStats; const u8 (* abilityNames)[]; - const u8 *const * abilityDescriptions; + const u8 * const * abilityDescriptions; const struct Item * items; const struct BattleMove * moves; const struct CompressedSpriteSheet * ballGfx; diff --git a/src/scrcmd.c b/src/scrcmd.c index 53a5d4a29..fe5cf95d7 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -84,7 +84,7 @@ static const u8 sScriptConditionTable[6][3] = 1, 0, 1, // != }; -static u8 *const sScriptStringVars[] = +static u8 * const sScriptStringVars[] = { gStringVar1, gStringVar2, diff --git a/src/trader.c b/src/trader.c index 3de2a4846..040ee695b 100644 --- a/src/trader.c +++ b/src/trader.c @@ -15,7 +15,7 @@ #include "task.h" #include "script_menu.h" -static const u8 *const sDefaultTraderNames[NUM_TRADER_ITEMS] = +static const u8 * const sDefaultTraderNames[NUM_TRADER_ITEMS] = { gText_Tristan, gText_Philip, diff --git a/tools/jsonproc/inja.hpp b/tools/jsonproc/inja.hpp index 56e4027f8..d5bf5bcba 100755 --- a/tools/jsonproc/inja.hpp +++ b/tools/jsonproc/inja.hpp @@ -2811,7 +2811,7 @@ class Renderer { if ((bc.flags & Bytecode::Flag::ValueMask) != Bytecode::Flag::ValuePop) { popArgs -= 1; } - for (unsigned int i = 0; i < popArgs; i++) { + for (unsigned int i = 0; i < popArgs; ++i) { m_stack.pop_back(); } } @@ -2925,7 +2925,7 @@ class Renderer { void render_to(std::ostream& os, const Template& tmpl, const json& data) { m_data = &data; - for (size_t i = 0; i < tmpl.bytecodes.size(); i++) { + for (size_t i = 0; i < tmpl.bytecodes.size(); ++i) { const auto& bc = tmpl.bytecodes[i]; switch (bc.op) { diff --git a/tools/jsonproc/nlohmann/json.hpp b/tools/jsonproc/nlohmann/json.hpp index 15ab684dd..5003a4fa2 100755 --- a/tools/jsonproc/nlohmann/json.hpp +++ b/tools/jsonproc/nlohmann/json.hpp @@ -1438,7 +1438,7 @@ auto from_json_array_impl(const BasicJsonType& j, std::array& arr, priority_tag<2> /*unused*/) -> decltype(j.template get(), void()) { - for (std::size_t i = 0; i < N; i++) + for (std::size_t i = 0; i < N; ++i) { arr[i] = j.at(i).template get(); } @@ -4301,7 +4301,7 @@ class binary_reader if (len != std::size_t(-1)) { - for (std::size_t i = 0; i < len; i++) + for (std::size_t i = 0; i < len; ++i) { if (JSON_UNLIKELY(not parse_cbor_internal())) { @@ -4338,7 +4338,7 @@ class binary_reader string_t key; if (len != std::size_t(-1)) { - for (std::size_t i = 0; i < len; i++) + for (std::size_t i = 0; i < len; ++i) { get(); if (JSON_UNLIKELY(not get_cbor_string(key) or not sax->key(key))) @@ -4832,7 +4832,7 @@ class binary_reader return false; } - for (std::size_t i = 0; i < len; i++) + for (std::size_t i = 0; i < len; ++i) { if (JSON_UNLIKELY(not parse_msgpack_internal())) { @@ -4855,7 +4855,7 @@ class binary_reader } string_t key; - for (std::size_t i = 0; i < len; i++) + for (std::size_t i = 0; i < len; ++i) { get(); if (JSON_UNLIKELY(not get_msgpack_string(key) or not sax->key(key))) @@ -5190,7 +5190,7 @@ class binary_reader { if (size_and_type.second != 'N') { - for (std::size_t i = 0; i < size_and_type.first; i++) + for (std::size_t i = 0; i < size_and_type.first; ++i) { if (JSON_UNLIKELY(not get_ubjson_value(size_and_type.second))) { @@ -5201,7 +5201,7 @@ class binary_reader } else { - for (std::size_t i = 0; i < size_and_type.first; i++) + for (std::size_t i = 0; i < size_and_type.first; ++i) { if (JSON_UNLIKELY(not parse_ubjson_internal())) { @@ -5251,7 +5251,7 @@ class binary_reader if (size_and_type.second != 0) { - for (std::size_t i = 0; i < size_and_type.first; i++) + for (std::size_t i = 0; i < size_and_type.first; ++i) { if (JSON_UNLIKELY(not get_ubjson_string(key) or not sax->key(key))) { @@ -5266,7 +5266,7 @@ class binary_reader } else { - for (std::size_t i = 0; i < size_and_type.first; i++) + for (std::size_t i = 0; i < size_and_type.first; ++i) { if (JSON_UNLIKELY(not get_ubjson_string(key) or not sax->key(key))) { @@ -5356,7 +5356,7 @@ class binary_reader { // step 1: read input into array with system's byte order std::array vec; - for (std::size_t i = 0; i < sizeof(NumberType); i++) + for (std::size_t i = 0; i < sizeof(NumberType); ++i) { get(); if (JSON_UNLIKELY(not unexpect_eof(format, "number"))) @@ -6705,7 +6705,7 @@ scan_number_done: token_type return_type) { assert(current == literal_text[0]); - for (std::size_t i = 1; i < length; i++) + for (std::size_t i = 1; i < length; ++i) { if (JSON_UNLIKELY(get() != literal_text[i])) { @@ -9235,7 +9235,7 @@ class json_pointer else { // iterate array and use index as reference string - for (std::size_t i = 0; i < value.m_value.array->size(); i++) + for (std::size_t i = 0; i < value.m_value.array->size(); ++i) { flatten(reference_string + "/" + std::to_string(i), value.m_value.array->operator[](i), result); @@ -12183,7 +12183,7 @@ class serializer // first n-1 elements for (auto i = val.m_value.array->cbegin(); - i != val.m_value.array->cend() - 1; i++) + i != val.m_value.array->cend() - 1; ++i) { o->write_characters(indent_string.c_str(), new_indent); dump(*i, true, ensure_ascii, indent_step, new_indent); @@ -12205,7 +12205,7 @@ class serializer // first n-1 elements for (auto i = val.m_value.array->cbegin(); - i != val.m_value.array->cend() - 1; i++) + i != val.m_value.array->cend() - 1; ++i) { dump(*i, false, ensure_ascii, indent_step, current_indent); o->write_character(','); @@ -12302,7 +12302,7 @@ class serializer std::size_t bytes_after_last_accept = 0; std::size_t undumped_chars = 0; - for (std::size_t i = 0; i < s.size(); i++) + for (std::size_t i = 0; i < s.size(); ++i) { const auto byte = static_cast(s[i]); From e43f65cc692e415148b1be4df33a86f37dcea74e Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Mon, 15 Aug 2022 21:06:26 -0400 Subject: [PATCH 4/6] using BATTLE_RUN constants in BattleScript_EffectTeleport --- data/battle_scripts_1.s | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 880957859..3adc07132 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -1927,8 +1927,8 @@ BattleScript_EffectTeleport:: ppreduce jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_ButItFailed getifcantrunfrombattle BS_ATTACKER - jumpifbyte CMP_EQUAL, gBattleCommunication, 1, BattleScript_ButItFailed - jumpifbyte CMP_EQUAL, gBattleCommunication, 2, BattleScript_PrintAbilityMadeIneffective + jumpifbyte CMP_EQUAL, gBattleCommunication, BATTLE_RUN_FORBIDDEN, BattleScript_ButItFailed + jumpifbyte CMP_EQUAL, gBattleCommunication, BATTLE_RUN_FAILURE, BattleScript_PrintAbilityMadeIneffective attackanimation waitanimation printstring STRINGID_PKMNFLEDFROMBATTLE From 5e593a62fbfb631068772d1589d556c8a998142e Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Fri, 19 Aug 2022 04:07:25 +0100 Subject: [PATCH 5/6] Ignore num_tiles if it would truncate non-transparent tiles (#1729) --- graphics/battle_transitions/rayquaza.png | Bin 2308 -> 2074 bytes graphics/battle_transitions/regis.png | Bin 231 -> 256 bytes graphics/picture_frame/lobby.png | Bin 666 -> 719 bytes graphics_file_rules.mk | 222 +++++++++++------------ tools/gbagfx/gfx.c | 32 +++- tools/gbagfx/gfx.h | 8 +- tools/gbagfx/main.c | 9 +- tools/gbagfx/options.h | 2 + 8 files changed, 154 insertions(+), 119 deletions(-) diff --git a/graphics/battle_transitions/rayquaza.png b/graphics/battle_transitions/rayquaza.png index 5c3a914749b5f85021200c247847848369b313e9..00df7d741515db4ec8447efa05ff6ea1d47782ad 100644 GIT binary patch delta 2072 zcmV+z2i}2c=0wK~#9!?VK@k-8K-0i3@13 zRU)PEj4qIw=m0LFK221oirRE}r6=9MO94JH0XsI}mIvru zaK~|C=Yl1@&?wVCbuMszT}>)rQ_nor7b8Hm;C?J{6nJ71aO48Iy4q=&uuB4*7VL&T z#TxMS1mL(}hkv>h)xy_P0BV6dsCW0H*T-ugfL&ng?~EgcTKIYbKrPViw_{3Qj)38M z0GJyHpkJz?2Q|Sw7GEpC4;Y}Hii_KAOB!4sy8m0k;Tn=L14*aDM@w3+`P2zI8MKVBKcqXg{|A z&@>;{YiQe@8I?mHDN}$SCn7DNy9FAs_5l?FoKM_j-yRK6bvwWxFEn77Q0=t?ur9!W zbqDBMKmdG-0MQ&pC@PF^b3w7&f1n>u+1;Cfp$_3bXp>ACa;psL8P##zr34Xlr0m10g^`VvE#|sib zcY%@M#|u&uxbe<1zCW*^c%h2^ z8Ug^+?;-#>=5 z24Jl#wlD?Y$u{Mk#~jWNKL1Nd@z zIX?dE%mdtn0IwZDdx<2R83{eWb-@VeXMeT<@Gp|^w~;Uanjl~#v=IqO!0U~PFcuJy zpbK_$NeFPf83}Dff(5(}0d$yng8@?sNq`PCZ_Gri9)I!6`1sTBQ8&f_I@HzuRM$QJ z;$nRK=_vw09RYNN4p48mdKy9!PK^W$Xd-VOz{v>sj3oSJB+LQ21xH=~*#klnW`6;C z$zuTl3G)Cg0-%jZpa3+YjYz196)RS(Sg~ToiWMtXjBa3TarNm{R{iJ?3+gW*!0e68 z`k4d~x+yaNl1wExAgd7~OIS`h!4yE1AQ!O@2oMY5v@(JVAV?4u6Chdq0{{f`0epbu zO5_3rcbq%}fMmX{1yBG5@O%JePJes~k?9FU=f_{6@E2KZ0Dqy$Ug|#nYMsB~U~hT& zn=baYFK^>1xLaSr-Fyq~_Fr%l5Q3Wm5!@t9YIKp(KpAO;0${(Q&lgZSp}61)wBQN! zf#eDRt_uZA0#p@Cf^GmuLf-)3Hej&?{bYs&82(!(!9I4O1QhUdB}~=}ynl|UDsJtn zVh-lRNT`YxD^{#nv0`7Du@1vj!d3-XwwjZe#a_KEJPm_gnMmPC$OU+dPD#n=h|IOV44pZs?o9`;3r=2u7|Xb2e+V**%=+cEpVDm z&FGAK4dL!O=ouZ9M}J}^WHNs9`~b1jnUZ>PR%ZSpl+mdY`4Cb@r;28DNV6+1J<3ne zvQxzDBsD)x&Q8?xKNYY)R`5TU@ITn_KN;~qTBR~N#fp7B1_wC6Rsdf;fH|1~u>Pio z0JPnbiyj~Ofm&Y%qXS)kDn!xi3$$9#A($P4yWkfYgudul(|;rn=zkGIdTul>B(F}u zZj{|^GkH|&2l;xn9HIn>cO#GmfDHDmpzc~j1qD$;yc|(NyckVFsuW2=S0KLKA^?&n z^C`#nlj~{1S?`%5^UL)ak@IbsdBkiRW(&-<;ShkdljaJ{dU;Obd@O~B1rSDBx{+f3 zut>Vd;{ym=+kdp1C@Uf;fCBhG0KB363|?pUl=k?uGC#1eL)+s=XZ8Yvzrx6bNvWF!FF|Abui>p9jOjMWm~n~J)+C{bHzW};sclI+E-MO6a=*QAGo!S-il$<* znKDQzwu|ICq+FIn8#&0xC{eDJOUkzA{Qmhp=lSFFJpVoCIiGW$ESiX(rip>?_=U=~ z1VH)k-3~iEV{$%ZRfny%pfx^-$Wh=ks*KKchXzS$i^$V?CAC~#6faTbn)rC-JKr*U zcS(;b0kIIYA;fUSs<>1A{D+G0(>d%T8KhjcIQiZKi^VBh`wg~%CGR4GBRZD4E_4dR zZ@8R9Wsep--MRRYWE_j!gmP^mh8>?vZ(t)XalU!K&6|lpV*jocypGUUe=IR2+hfKl z%#@X4oTSDW&64b>-$q86#f3J>TJlH)Wgir7P`WRVR0B-;j_NC`h23m$TK3}SUUbiQ z7XeJhQh%mt29x8n7sL}ltNoTw686i$!TZET3RHpZ4=TGNJ?GZYt;PQhEQ?P8<5m+} z%hf?am!giWg`um<)gc?CF73(Gr*23l*1dK_gr9W~aPEF>NDRp<0^iKSF%JLm&420Z(bf#0?QNsByyJr|AM z){rFw_%ng`5d|?%z-K#rESomz_g$6d0pbbF*KP#7V^uiQIIYWsq>QbyNj9_EzXSeO zxmXnZetP0p!lF7Dl%E8j6w`DKH4${ohZ@g2OHvDJ~R#d#sD>O#GrhkJz=8) zDo`y(ys@nJJ2$8av8LUOuePaB5i5!FdKWpd^e_S{v>WHn(-(NvnZVbh_d}r9v`5`o zvia9bu<`xGHZU1?HMGP}=G?AVsY6ljQl(37PQ-#Mp=)vOtQC`1yb9svkBz^2XM5Zj zEkE1<_F=POk?pYC1^iN1$=}(_<*_Of8_FjOZ57b1ih(&z_&{!1iR+vhuMvtmRPq?gY?bssj37ozpE2kg{2A(mymx{kn*t;+Fcl2`@`$Wg?l z=4>|Dha|?I= zgjk`wO(?v7RC0nkU5Eb+>Wqpt%KH7M19sxSTAVGFS-}@)t~U253<997WY@A(YnFfd zpe{)Ja6N)R0s*9B70KZ^uhYqViU91?~6Al4W@AqCc24JBgs2c^!z>dM{U(_H^kkH0ZTy73~K!SLfNvif22= z9`8YWqj&aSUkGZ>QsSsbC}Gs+Bj7TJ#M2qM>=s-w>?Bw%DZrcr40#sCP#NOYQNPFQ zNMfgz^0+>)Qc*h%Ua$pB&Ig_*68L|VZw7&18EfE(+c&ru2KWx(;7##$<-3;6=VN6D zp$67o6!)E3)_`Wx?|t&hI(L4J)iYj%|%Op_iqvJ&S1j20bv>$R0G?bh<>FdUApM{U)7!{V)^Z2R07WW^>uzIn>8j3 ziQNbS64OFXv;a+Aq}O^hz833gBKV~SRf-3S979t~w;7)iXxHucIxQmzT#aHG%8(DA z;wRBNwH#!Mw2wdjC4wV!Q7-$YlilIV^{pGs({8_bQN+>guE2Z}GFnGO__^hBg$Dgv z!Zn?;biz(|SeJfCJrF?v`x{qbyUhf#d_q zBtx%fwh|=codec~!Dh%=*z_h*+TUbgF-!<{3%`(5%hBKNOb9dx(!{NIwpQt-8x?)O zT%T4;HH=2L;&c0?EtpVaWwXo8zRI%q$L?;N3H@2g z6Br+@TlZWg28#fL$AKlD)uM+M%1*c}bgr~$Pe_9Vj+GCe$5kokSEWF=lSolxWILqP z2&o#J2wWeUS5y)#CWSDr`RCr6pn5sae}QqWu{`gi3wl%zB{?p2wHtgQDzL)ip1mfu z$6-Tq1`g%;Ho61_L{*6#1E1t+r|%c&z;i>F0Vauo7Be6mYj&$jr$9NowFX$fso@J+ z1a5644>8{=JVZF7B*o_JwPVoFv-|EjAWiH2rH=-nqwoOqbDS4qc*|M5@aXy>B`nA&CC zrAx=s-B7bbe@M5b?olyNoz!|4)(WF(O=j*ZaW4b9$KCJm8N!sD7oRu@C1$ECMwh71 XK88E{zfJ4-Z}05h>E>|TjwkpR*N^R3 diff --git a/graphics/battle_transitions/regis.png b/graphics/battle_transitions/regis.png index a0831073746388464d2a66d223c6d51f3a4d5d78..4926b165b75f73f915aeadab416d23942e95a6ee 100644 GIT binary patch delta 239 zcmVi}0Ey;Ma)r p04Ea8M4rmH7kD%AZshGOVh5LV7pxn662kxh002ovPDHLkV1mF9YF_{V delta 214 zcmV;{04e`~0_Opc8Gir(0026Xu z@7p*HO#g-X-#9%F9uuh`aXNV>5i}0$NE#K~zY`#n!!Un@|)7aPkJd zws5B^ikD6q5JTm3=#m$p(p|h|Y3DBOE0}on0_|j3mC}P04}YBst^5Lh1|Fc26LobY z=s6b-A$(k6Q>lN19TE8X+~aV9VPHflvvS<*4FXW9o@;QP%OY3vsK`x*xSqN?2tqn{ z^sdNN0hphPSaT@i;pM)n03hNDMs|@B@PUgOS@RpN|Jrjs0$eW$3CJsW%>{lh1H1wP z{5+xOf?C7pV1KLD@KXagW0jW#e93v^zoKXjc zRUq#Igjp9FfjhX3380^Az|8j*08vE1i+C5;fZuX@rv>mu0r=7geDx)?1Fn|=xC9Nb zYzLk;u^EtBz{>%u08WzzU@xaaTLI)1Y+HbIzZ`0sIDc~$5JAue+%JW#1^gU{T7cck zUbOuoonzBzo7fi#ovQ1hkFyCZIOfcd%M;O~3LBHn5IufP{h5KWa+}Fsi|MFyWdR2<0@s zkkf7e-ha+3u7KNz$8Krw3M}nP@YtGm2Kb%kK^>3{fJ8vnf%7H+=Rxt!Gl1()0ryV8 zJwUonvv4yPbPR%yz{4iy?sEl`H~VDsut_=r|1RR0VVsB_fawTfI(-0XI`aPleV1^8 zms2B;2OKHQ9sqtm0#5xIuxo77q0Q#Ut%HF}Q#%SFolAaTJYos-xqX&k5imS{3F9%A o;5^RvBLMsdJ?H_5O1fV67o5VyG1l973IG5A07*qoM6N<$f{wX8>;M1& delta 653 zcmV;80&@M&1)2qr8Gir(0022}z+(Ua0%1u+K~zYI#n!!Un@|)7aFF7)N-XsOcm}_K z)k3EZj>KuC%JS60;?cpc&@7qTC7YKkl^4j;p|Lt351G0+iaOQEzIlVV=Uh0~gfD>^ z`bS`yz|ZHNgcBQkjLc-7O_02R3o7|*>AgXRze49`X6sxeNPpm~yIt3zYd7C?ZZr^o z(OJzv$H&_}RRMs_6>K7%3~}zoo#W3z^$`F8?Bk#Y_`ak2AHL>*G~ARr;DI`@%>!u{z)8AL z3Y@{YMF71i0Dp7OQvldD0e`H%RRCU##aS(Y2L<4v6!_=~s0IQ*0dNU5z@!>@*~D@{ z)B=7APzCU4mH<7mkhK*+TEUp$GHWN87ROPw0{8(b1pN|K9mFbkw(C7t+TrH zbjpGJP$i&htd{|WvEGOAlxupE-Y|rb6#g+nE^*EtUIx22H@j7 z<_frdc8?8hbKd`5s*L8HU~gH?f1{J0}zK&#$gvg#G&}VK-VQaYFMy diff --git a/graphics_file_rules.mk b/graphics_file_rules.mk index 42b1e6d74..3335179d1 100644 --- a/graphics_file_rules.mk +++ b/graphics_file_rules.mk @@ -64,31 +64,31 @@ $(CASTFORMGFXDIR)/shiny.gbapal: $(CASTFORMGFXDIR)/shiny_normal_form.gbapal \ ### Tilesets ### $(TILESETGFXDIR)/secondary/petalburg/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 159 + $(GFX) $< $@ -num_tiles 159 -Wnum_tiles $(TILESETGFXDIR)/secondary/rustboro/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 498 + $(GFX) $< $@ -num_tiles 498 -Wnum_tiles $(TILESETGFXDIR)/secondary/dewford/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 503 + $(GFX) $< $@ -num_tiles 503 -Wnum_tiles $(TILESETGFXDIR)/secondary/slateport/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 504 + $(GFX) $< $@ -num_tiles 504 -Wnum_tiles $(TILESETGFXDIR)/secondary/mauville/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 503 + $(GFX) $< $@ -num_tiles 503 -Wnum_tiles $(TILESETGFXDIR)/secondary/lavaridge/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 450 + $(GFX) $< $@ -num_tiles 450 -Wnum_tiles $(TILESETGFXDIR)/secondary/fortree/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 493 + $(GFX) $< $@ -num_tiles 493 -Wnum_tiles $(TILESETGFXDIR)/secondary/pacifidlog/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 504 + $(GFX) $< $@ -num_tiles 504 -Wnum_tiles $(TILESETGFXDIR)/secondary/sootopolis/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 328 + $(GFX) $< $@ -num_tiles 328 -Wnum_tiles SOOTOPOLISANIMDIR := $(TILESETGFXDIR)/secondary/sootopolis/anim @@ -125,169 +125,169 @@ $(SOOTOPOLISANIMDIR)/stormy_water/7.4bpp: $(SOOTOPOLISANIMDIR)/stormy_water/7_ky @cat $^ >$@ $(TILESETGFXDIR)/secondary/battle_frontier_outside_west/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 508 + $(GFX) $< $@ -num_tiles 508 -Wnum_tiles $(TILESETGFXDIR)/secondary/battle_frontier_outside_east/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 508 + $(GFX) $< $@ -num_tiles 508 -Wnum_tiles $(TILESETGFXDIR)/primary/building/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 502 + $(GFX) $< $@ -num_tiles 502 -Wnum_tiles $(TILESETGFXDIR)/secondary/shop/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 502 + $(GFX) $< $@ -num_tiles 502 -Wnum_tiles $(TILESETGFXDIR)/secondary/pokemon_center/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 478 + $(GFX) $< $@ -num_tiles 478 -Wnum_tiles $(TILESETGFXDIR)/secondary/cave/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 425 + $(GFX) $< $@ -num_tiles 425 -Wnum_tiles $(TILESETGFXDIR)/secondary/pokemon_school/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 278 + $(GFX) $< $@ -num_tiles 278 -Wnum_tiles $(TILESETGFXDIR)/secondary/pokemon_fan_club/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 319 + $(GFX) $< $@ -num_tiles 319 -Wnum_tiles $(TILESETGFXDIR)/secondary/unused_1/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 17 + $(GFX) $< $@ -num_tiles 17 -Wnum_tiles $(TILESETGFXDIR)/secondary/meteor_falls/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 460 + $(GFX) $< $@ -num_tiles 460 -Wnum_tiles $(TILESETGFXDIR)/secondary/oceanic_museum/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 319 + $(GFX) $< $@ -num_tiles 319 -Wnum_tiles $(TILESETGFXDIR)/secondary/cable_club/unknown_tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 120 + $(GFX) $< $@ -num_tiles 120 -Wnum_tiles $(TILESETGFXDIR)/secondary/seashore_house/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 312 + $(GFX) $< $@ -num_tiles 312 -Wnum_tiles $(TILESETGFXDIR)/secondary/pretty_petal_flower_shop/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 345 + $(GFX) $< $@ -num_tiles 345 -Wnum_tiles $(TILESETGFXDIR)/secondary/pokemon_day_care/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 355 + $(GFX) $< $@ -num_tiles 355 -Wnum_tiles $(TILESETGFXDIR)/secondary/secret_base/brown_cave/unused_tiles.4bpp: $(TILESETGFXDIR)/secondary/secret_base/brown_cave/tiles.png - $(GFX) $< $@ -num_tiles 82 + $(GFX) $< $@ -num_tiles 82 -Wnum_tiles $(TILESETGFXDIR)/secondary/secret_base/tree/unused_tiles.4bpp: $(TILESETGFXDIR)/secondary/secret_base/tree/tiles.png - $(GFX) $< $@ -num_tiles 82 + $(GFX) $< $@ -num_tiles 82 -Wnum_tiles $(TILESETGFXDIR)/secondary/secret_base/shrub/unused_tiles.4bpp: $(TILESETGFXDIR)/secondary/secret_base/shrub/tiles.png - $(GFX) $< $@ -num_tiles 82 + $(GFX) $< $@ -num_tiles 82 -Wnum_tiles $(TILESETGFXDIR)/secondary/secret_base/blue_cave/unused_tiles.4bpp: $(TILESETGFXDIR)/secondary/secret_base/blue_cave/tiles.png - $(GFX) $< $@ -num_tiles 82 + $(GFX) $< $@ -num_tiles 82 -Wnum_tiles $(TILESETGFXDIR)/secondary/secret_base/yellow_cave/unused_tiles.4bpp: $(TILESETGFXDIR)/secondary/secret_base/yellow_cave/tiles.png - $(GFX) $< $@ -num_tiles 82 + $(GFX) $< $@ -num_tiles 82 -Wnum_tiles $(TILESETGFXDIR)/secondary/secret_base/red_cave/unused_tiles.4bpp: $(TILESETGFXDIR)/secondary/secret_base/red_cave/tiles.png - $(GFX) $< $@ -num_tiles 82 + $(GFX) $< $@ -num_tiles 82 -Wnum_tiles $(TILESETGFXDIR)/secondary/secret_base/brown_cave/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 83 + $(GFX) $< $@ -num_tiles 83 -Wnum_tiles $(TILESETGFXDIR)/secondary/secret_base/tree/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 83 + $(GFX) $< $@ -num_tiles 83 -Wnum_tiles $(TILESETGFXDIR)/secondary/secret_base/shrub/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 83 + $(GFX) $< $@ -num_tiles 83 -Wnum_tiles $(TILESETGFXDIR)/secondary/secret_base/blue_cave/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 83 + $(GFX) $< $@ -num_tiles 83 -Wnum_tiles $(TILESETGFXDIR)/secondary/secret_base/yellow_cave/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 83 + $(GFX) $< $@ -num_tiles 83 -Wnum_tiles $(TILESETGFXDIR)/secondary/secret_base/red_cave/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 83 + $(GFX) $< $@ -num_tiles 83 -Wnum_tiles $(TILESETGFXDIR)/secondary/inside_of_truck/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 62 + $(GFX) $< $@ -num_tiles 62 -Wnum_tiles $(TILESETGFXDIR)/secondary/contest/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 430 + $(GFX) $< $@ -num_tiles 430 -Wnum_tiles $(TILESETGFXDIR)/secondary/lilycove_museum/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 431 + $(GFX) $< $@ -num_tiles 431 -Wnum_tiles $(TILESETGFXDIR)/secondary/lab/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 500 + $(GFX) $< $@ -num_tiles 500 -Wnum_tiles $(TILESETGFXDIR)/secondary/underwater/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 500 + $(GFX) $< $@ -num_tiles 500 -Wnum_tiles $(TILESETGFXDIR)/secondary/generic_building/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 509 + $(GFX) $< $@ -num_tiles 509 -Wnum_tiles $(TILESETGFXDIR)/secondary/mauville_game_corner/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 469 + $(GFX) $< $@ -num_tiles 469 -Wnum_tiles $(TILESETGFXDIR)/secondary/unused_2/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 150 + $(GFX) $< $@ -num_tiles 150 -Wnum_tiles $(TILESETGFXDIR)/secondary/rustboro_gym/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 60 + $(GFX) $< $@ -num_tiles 60 -Wnum_tiles $(TILESETGFXDIR)/secondary/dewford_gym/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 61 + $(GFX) $< $@ -num_tiles 61 -Wnum_tiles $(TILESETGFXDIR)/secondary/lavaridge_gym/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 54 + $(GFX) $< $@ -num_tiles 54 -Wnum_tiles $(TILESETGFXDIR)/secondary/petalburg_gym/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 148 + $(GFX) $< $@ -num_tiles 148 -Wnum_tiles $(TILESETGFXDIR)/secondary/fortree_gym/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 61 + $(GFX) $< $@ -num_tiles 61 -Wnum_tiles $(TILESETGFXDIR)/secondary/mossdeep_gym/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 82 + $(GFX) $< $@ -num_tiles 82 -Wnum_tiles $(TILESETGFXDIR)/secondary/sootopolis_gym/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 484 + $(GFX) $< $@ -num_tiles 484 -Wnum_tiles $(TILESETGFXDIR)/secondary/trick_house_puzzle/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 294 + $(GFX) $< $@ -num_tiles 294 -Wnum_tiles $(TILESETGFXDIR)/secondary/inside_ship/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 342 + $(GFX) $< $@ -num_tiles 342 -Wnum_tiles $(TILESETGFXDIR)/secondary/elite_four/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 505 + $(GFX) $< $@ -num_tiles 505 -Wnum_tiles $(TILESETGFXDIR)/secondary/battle_frontier/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 310 + $(GFX) $< $@ -num_tiles 310 -Wnum_tiles $(TILESETGFXDIR)/secondary/battle_factory/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 424 + $(GFX) $< $@ -num_tiles 424 -Wnum_tiles $(TILESETGFXDIR)/secondary/battle_pike/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 382 + $(GFX) $< $@ -num_tiles 382 -Wnum_tiles $(TILESETGFXDIR)/secondary/mirage_tower/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 420 + $(GFX) $< $@ -num_tiles 420 -Wnum_tiles $(TILESETGFXDIR)/secondary/mossdeep_game_corner/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 95 + $(GFX) $< $@ -num_tiles 95 -Wnum_tiles $(TILESETGFXDIR)/secondary/island_harbor/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 503 + $(GFX) $< $@ -num_tiles 503 -Wnum_tiles $(TILESETGFXDIR)/secondary/trainer_hill/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 374 + $(GFX) $< $@ -num_tiles 374 -Wnum_tiles $(TILESETGFXDIR)/secondary/navel_rock/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 420 + $(GFX) $< $@ -num_tiles 420 -Wnum_tiles $(TILESETGFXDIR)/secondary/battle_frontier_ranking_hall/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 136 + $(GFX) $< $@ -num_tiles 136 -Wnum_tiles $(TILESETGFXDIR)/secondary/mystery_events_house/tiles.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 509 + $(GFX) $< $@ -num_tiles 509 -Wnum_tiles @@ -335,13 +335,13 @@ graphics/title_screen/pokemon_logo.gbapal: %.gbapal: %.pal $(GFX) $< $@ -num_colors 224 graphics/pokemon_jump/bg.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 63 + $(GFX) $< $@ -num_tiles 63 -Wnum_tiles graphics/pokenav/region_map.8bpp: %.8bpp: %.png - $(GFX) $< $@ -num_tiles 233 + $(GFX) $< $@ -num_tiles 233 -Wnum_tiles $(MISCGFXDIR)/japanese_hof.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 29 + $(GFX) $< $@ -num_tiles 29 -Wnum_tiles $(BATINTGFXDIR)/textbox.gbapal: $(BATINTGFXDIR)/textbox_0.gbapal \ $(BATINTGFXDIR)/textbox_1.gbapal @@ -385,10 +385,10 @@ $(UNUSEDGFXDIR)/redyellowgreen_frame.bin: $(UNUSEDGFXDIR)/red_frame.bin \ @cat $^ >$@ $(UNUSEDGFXDIR)/color_frames.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 353 + $(GFX) $< $@ -num_tiles 353 -Wnum_tiles $(BATINTGFXDIR)/unused_window2bar.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 5 + $(GFX) $< $@ -num_tiles 5 -Wnum_tiles $(JPCONTESTGFXDIR)/composite_1.4bpp: $(JPCONTESTGFXDIR)/frame_1.4bpp \ $(JPCONTESTGFXDIR)/floor.4bpp \ @@ -404,7 +404,7 @@ $(JPCONTESTGFXDIR)/composite_2.4bpp: $(JPCONTESTGFXDIR)/interface.4bpp \ @cat $^ >$@ $(JPCONTESTGFXDIR)/voltage.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 36 + $(GFX) $< $@ -num_tiles 36 -Wnum_tiles $(BTLANMSPRGFXDIR)/ice_crystals.4bpp: $(BTLANMSPRGFXDIR)/ice_crystals_0.4bpp \ $(BTLANMSPRGFXDIR)/ice_crystals_1.4bpp \ @@ -426,13 +426,13 @@ $(BTLANMSPRGFXDIR)/spark.4bpp: $(BTLANMSPRGFXDIR)/spark_0.4bpp \ @cat $^ >$@ $(MASKSGFXDIR)/unused_level_up.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 14 + $(GFX) $< $@ -num_tiles 14 -Wnum_tiles $(BATTRANSGFXDIR)/vs_frame.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 16 + $(GFX) $< $@ -num_tiles 16 -Wnum_tiles graphics/party_menu/bg.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 62 + $(GFX) $< $@ -num_tiles 62 -Wnum_tiles $(TYPESGFXDIR)/move_types.4bpp: $(types:%=$(TYPESGFXDIR)/%.4bpp) $(contest_types:%=$(TYPESGFXDIR)/contest_%.4bpp) @cat $^ >$@ @@ -443,29 +443,29 @@ $(TYPESGFXDIR)/move_types.gbapal: $(TYPESGFXDIR)/move_types_1.gbapal \ @cat $^ >$@ graphics/bag/menu.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 53 + $(GFX) $< $@ -num_tiles 53 -Wnum_tiles $(RAYQUAZAGFXDIR)/scene_2/rayquaza.8bpp: %.8bpp: %.png - $(GFX) $< $@ -num_tiles 227 + $(GFX) $< $@ -num_tiles 227 -Wnum_tiles $(RAYQUAZAGFXDIR)/scene_2/bg.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 313 + $(GFX) $< $@ -num_tiles 313 -Wnum_tiles $(RAYQUAZAGFXDIR)/scene_3/rayquaza.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 124 + $(GFX) $< $@ -num_tiles 124 -Wnum_tiles $(RAYQUAZAGFXDIR)/scene_3/rayquaza_tail_fix.4bpp: $(RAYQUAZAGFXDIR)/scene_3/rayquaza_tail.4bpp cp $< $@ head -c 12 /dev/zero >> $@ $(RAYQUAZAGFXDIR)/scene_4/streaks.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 19 + $(GFX) $< $@ -num_tiles 19 -Wnum_tiles $(RAYQUAZAGFXDIR)/scene_4/rayquaza.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 155 + $(GFX) $< $@ -num_tiles 155 -Wnum_tiles graphics/picture_frame/lobby.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 86 + $(GFX) $< $@ -num_tiles 86 -Wnum_tiles $(ROULETTEGFXDIR)/roulette_tilt.4bpp: $(ROULETTEGFXDIR)/shroomish.4bpp \ $(ROULETTEGFXDIR)/tailow.4bpp @@ -478,10 +478,10 @@ $(ROULETTEGFXDIR)/wheel_icons.4bpp: $(ROULETTEGFXDIR)/wynaut.4bpp \ @cat $^ >$@ $(BATTRANSGFXDIR)/regis.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 53 + $(GFX) $< $@ -num_tiles 53 -Wnum_tiles $(BATTRANSGFXDIR)/rayquaza.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 938 + $(GFX) $< $@ -num_tiles 938 -Wnum_tiles $(BATTRANSGFXDIR)/frontier_square_1.4bpp: $(BATTRANSGFXDIR)/frontier_squares_blanktiles.4bpp \ $(BATTRANSGFXDIR)/frontier_squares_1.4bpp @@ -504,20 +504,20 @@ $(SLOTMACHINEGFXDIR)/reel_time_gfx.4bpp: $(SLOTMACHINEGFXDIR)/reel_time_pikachu. @cat $^ >$@ graphics/birch_speech/unused_beauty.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 822 + $(GFX) $< $@ -num_tiles 822 -Wnum_tiles ### Pokémon Storage System ### $(WALLPAPERGFXDIR)/forest/frame.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 55 + $(GFX) $< $@ -num_tiles 55 -Wnum_tiles $(WALLPAPERGFXDIR)/forest/tiles.4bpp: $(WALLPAPERGFXDIR)/forest/frame.4bpp $(WALLPAPERGFXDIR)/forest/bg.4bpp @cat $^ >$@ $(WALLPAPERGFXDIR)/city/frame.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 52 + $(GFX) $< $@ -num_tiles 52 -Wnum_tiles $(WALLPAPERGFXDIR)/city/tiles.4bpp: $(WALLPAPERGFXDIR)/city/frame.4bpp $(WALLPAPERGFXDIR)/city/bg.4bpp @cat $^ >$@ @@ -526,97 +526,97 @@ $(WALLPAPERGFXDIR)/desert/tiles.4bpp: $(WALLPAPERGFXDIR)/desert/frame.4bpp $(WAL @cat $^ >$@ $(WALLPAPERGFXDIR)/savanna/frame.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 45 + $(GFX) $< $@ -num_tiles 45 -Wnum_tiles $(WALLPAPERGFXDIR)/savanna/bg.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 23 + $(GFX) $< $@ -num_tiles 23 -Wnum_tiles $(WALLPAPERGFXDIR)/savanna/tiles.4bpp: $(WALLPAPERGFXDIR)/savanna/frame.4bpp $(WALLPAPERGFXDIR)/savanna/bg.4bpp @cat $^ >$@ $(WALLPAPERGFXDIR)/crag/frame.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 49 + $(GFX) $< $@ -num_tiles 49 -Wnum_tiles $(WALLPAPERGFXDIR)/crag/tiles.4bpp: $(WALLPAPERGFXDIR)/crag/frame.4bpp $(WALLPAPERGFXDIR)/crag/bg.4bpp @cat $^ >$@ $(WALLPAPERGFXDIR)/volcano/frame.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 56 + $(GFX) $< $@ -num_tiles 56 -Wnum_tiles $(WALLPAPERGFXDIR)/volcano/tiles.4bpp: $(WALLPAPERGFXDIR)/volcano/frame.4bpp $(WALLPAPERGFXDIR)/volcano/bg.4bpp @cat $^ >$@ $(WALLPAPERGFXDIR)/snow/frame.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 57 + $(GFX) $< $@ -num_tiles 57 -Wnum_tiles $(WALLPAPERGFXDIR)/snow/tiles.4bpp: $(WALLPAPERGFXDIR)/snow/frame.4bpp $(WALLPAPERGFXDIR)/snow/bg.4bpp @cat $^ >$@ $(WALLPAPERGFXDIR)/cave/frame.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 55 + $(GFX) $< $@ -num_tiles 55 -Wnum_tiles $(WALLPAPERGFXDIR)/cave/tiles.4bpp: $(WALLPAPERGFXDIR)/cave/frame.4bpp $(WALLPAPERGFXDIR)/cave/bg.4bpp @cat $^ >$@ $(WALLPAPERGFXDIR)/beach/frame.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 46 + $(GFX) $< $@ -num_tiles 46 -Wnum_tiles $(WALLPAPERGFXDIR)/beach/bg.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 23 + $(GFX) $< $@ -num_tiles 23 -Wnum_tiles $(WALLPAPERGFXDIR)/beach/tiles.4bpp: $(WALLPAPERGFXDIR)/beach/frame.4bpp $(WALLPAPERGFXDIR)/beach/bg.4bpp @cat $^ >$@ $(WALLPAPERGFXDIR)/seafloor/frame.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 54 + $(GFX) $< $@ -num_tiles 54 -Wnum_tiles $(WALLPAPERGFXDIR)/seafloor/tiles.4bpp: $(WALLPAPERGFXDIR)/seafloor/frame.4bpp $(WALLPAPERGFXDIR)/seafloor/bg.4bpp @cat $^ >$@ $(WALLPAPERGFXDIR)/river/frame.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 51 + $(GFX) $< $@ -num_tiles 51 -Wnum_tiles $(WALLPAPERGFXDIR)/river/bg.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 11 + $(GFX) $< $@ -num_tiles 11 -Wnum_tiles $(WALLPAPERGFXDIR)/river/tiles.4bpp: $(WALLPAPERGFXDIR)/river/frame.4bpp $(WALLPAPERGFXDIR)/river/bg.4bpp @cat $^ >$@ $(WALLPAPERGFXDIR)/sky/frame.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 45 + $(GFX) $< $@ -num_tiles 45 -Wnum_tiles $(WALLPAPERGFXDIR)/sky/tiles.4bpp: $(WALLPAPERGFXDIR)/sky/frame.4bpp $(WALLPAPERGFXDIR)/sky/bg.4bpp @cat $^ >$@ $(WALLPAPERGFXDIR)/polkadot/frame.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 54 + $(GFX) $< $@ -num_tiles 54 -Wnum_tiles $(WALLPAPERGFXDIR)/polkadot/tiles.4bpp: $(WALLPAPERGFXDIR)/polkadot/frame.4bpp $(WALLPAPERGFXDIR)/polkadot/bg.4bpp @cat $^ >$@ $(WALLPAPERGFXDIR)/pokecenter/frame.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 35 + $(GFX) $< $@ -num_tiles 35 -Wnum_tiles $(WALLPAPERGFXDIR)/pokecenter/tiles.4bpp: $(WALLPAPERGFXDIR)/pokecenter/frame.4bpp $(WALLPAPERGFXDIR)/pokecenter/bg.4bpp @cat $^ >$@ $(WALLPAPERGFXDIR)/machine/frame.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 33 + $(GFX) $< $@ -num_tiles 33 -Wnum_tiles $(WALLPAPERGFXDIR)/machine/tiles.4bpp: $(WALLPAPERGFXDIR)/machine/frame.4bpp $(WALLPAPERGFXDIR)/machine/bg.4bpp @cat $^ >$@ $(WALLPAPERGFXDIR)/plain/frame.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 18 + $(GFX) $< $@ -num_tiles 18 -Wnum_tiles $(WALLPAPERGFXDIR)/plain/tiles.4bpp: $(WALLPAPERGFXDIR)/plain/frame.4bpp $(WALLPAPERGFXDIR)/plain/bg.4bpp @cat $^ >$@ $(WALLPAPERGFXDIR)/friends_frame1.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 57 + $(GFX) $< $@ -num_tiles 57 -Wnum_tiles $(WALLPAPERGFXDIR)/friends_frame2.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 57 + $(GFX) $< $@ -num_tiles 57 -Wnum_tiles $(WALLPAPERGFXDIR)/zigzagoon/tiles.4bpp: $(WALLPAPERGFXDIR)/friends_frame1.4bpp $(WALLPAPERGFXDIR)/zigzagoon/bg.4bpp @cat $^ >$@ @@ -667,13 +667,13 @@ $(WALLPAPERGFXDIR)/whiscash/tiles.4bpp: $(WALLPAPERGFXDIR)/friends_frame2.4bpp $ @cat $^ >$@ $(OBJEVENTGFXDIR)/pics/effects/unknown_4F6D38/0.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 11 + $(GFX) $< $@ -num_tiles 11 -Wnum_tiles $(INTERFACEGFXDIR)/selector_outline.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 8 + $(GFX) $< $@ -num_tiles 8 -Wnum_tiles $(BATTRANSGFXDIR)/frontier_logo_center.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 43 + $(GFX) $< $@ -num_tiles 43 -Wnum_tiles @@ -695,19 +695,19 @@ $(PKNAVOPTIONSGFXDIR)/options.4bpp: $(PKNAVOPTIONSGFXDIR)/hoenn_map.4bpp \ @cat $^ >$@ $(PKNAVGFXDIR)/header.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 53 + $(GFX) $< $@ -num_tiles 53 -Wnum_tiles $(PKNAVGFXDIR)/device_outline.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 53 + $(GFX) $< $@ -num_tiles 53 -Wnum_tiles $(PKNAVGFXDIR)/match_call/ui.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 13 + $(GFX) $< $@ -num_tiles 13 -Wnum_tiles $(POKEDEXGFXDIR)/region_map.8bpp: %.8bpp: %.png - $(GFX) $< $@ -num_tiles 232 + $(GFX) $< $@ -num_tiles 232 -Wnum_tiles $(POKEDEXGFXDIR)/region_map_affine.8bpp: %.8bpp: %.png - $(GFX) $< $@ -num_tiles 233 + $(GFX) $< $@ -num_tiles 233 -Wnum_tiles $(STARTERGFXDIR)/birch_help.4bpp: $(STARTERGFXDIR)/birch_bag.4bpp $(STARTERGFXDIR)/birch_grass.4bpp @cat $^ >$@ diff --git a/tools/gbagfx/gfx.c b/tools/gbagfx/gfx.c index 4e85953fd..832e9bb39 100644 --- a/tools/gbagfx/gfx.c +++ b/tools/gbagfx/gfx.c @@ -397,7 +397,7 @@ void ReadImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int free(buffer); } -void WriteImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors) +void WriteImage(char *path, enum NumTilesMode numTilesMode, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors) { int tileSize = bitDepth * 8; @@ -424,7 +424,8 @@ void WriteImage(char *path, int numTiles, int bitDepth, int metatileWidth, int m FATAL_ERROR("The specified number of tiles (%d) is greater than the maximum possible value (%d).\n", numTiles, maxNumTiles); int bufferSize = numTiles * tileSize; - unsigned char *buffer = malloc(bufferSize); + int maxBufferSize = maxNumTiles * tileSize; + unsigned char *buffer = malloc(maxBufferSize); if (buffer == NULL) FATAL_ERROR("Failed to allocate memory for pixels.\n"); @@ -433,17 +434,36 @@ void WriteImage(char *path, int numTiles, int bitDepth, int metatileWidth, int m switch (bitDepth) { case 1: - ConvertToTiles1Bpp(image->pixels, buffer, numTiles, metatilesWide, metatileWidth, metatileHeight, invertColors); + ConvertToTiles1Bpp(image->pixels, buffer, maxNumTiles, metatilesWide, metatileWidth, metatileHeight, invertColors); break; case 4: - ConvertToTiles4Bpp(image->pixels, buffer, numTiles, metatilesWide, metatileWidth, metatileHeight, invertColors); + ConvertToTiles4Bpp(image->pixels, buffer, maxNumTiles, metatilesWide, metatileWidth, metatileHeight, invertColors); break; case 8: - ConvertToTiles8Bpp(image->pixels, buffer, numTiles, metatilesWide, metatileWidth, metatileHeight, invertColors); + ConvertToTiles8Bpp(image->pixels, buffer, maxNumTiles, metatilesWide, metatileWidth, metatileHeight, invertColors); break; } - WriteWholeFile(path, buffer, bufferSize); + bool zeroPadded = true; + for (int i = bufferSize; i < maxBufferSize && zeroPadded; i++) { + if (buffer[i] != 0) + { + switch (numTilesMode) + { + case NUM_TILES_IGNORE: + break; + case NUM_TILES_WARN: + fprintf(stderr, "Ignoring -num_tiles %d because tile %d contains non-transparent pixels.\n", numTiles, 1 + i / tileSize); + zeroPadded = false; + break; + case NUM_TILES_ERROR: + FATAL_ERROR("Tile %d contains non-transparent pixels.\n", 1 + i / tileSize); + break; + } + } + } + + WriteWholeFile(path, buffer, zeroPadded ? bufferSize : maxBufferSize); free(buffer); } diff --git a/tools/gbagfx/gfx.h b/tools/gbagfx/gfx.h index edb9e62c4..f1dbfcf4f 100644 --- a/tools/gbagfx/gfx.h +++ b/tools/gbagfx/gfx.h @@ -44,8 +44,14 @@ struct Image { bool isAffine; }; +enum NumTilesMode { + NUM_TILES_IGNORE, + NUM_TILES_WARN, + NUM_TILES_ERROR, +}; + void ReadImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors); -void WriteImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors); +void WriteImage(char *path, enum NumTilesMode numTilesMode, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors); void FreeImage(struct Image *image); void ReadGbaPalette(char *path, struct Palette *palette); void WriteGbaPalette(char *path, struct Palette *palette); diff --git a/tools/gbagfx/main.c b/tools/gbagfx/main.c index cf3031696..5d4faacab 100644 --- a/tools/gbagfx/main.c +++ b/tools/gbagfx/main.c @@ -77,7 +77,7 @@ void ConvertPngToGba(char *inputPath, char *outputPath, struct PngToGbaOptions * ReadPng(inputPath, &image); - WriteImage(outputPath, options->numTiles, options->bitDepth, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette); + WriteImage(outputPath, options->numTilesMode, options->numTiles, options->bitDepth, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette); FreeImage(&image); } @@ -179,6 +179,7 @@ void HandlePngToGbaCommand(char *inputPath, char *outputPath, int argc, char **a char *outputFileExtension = GetFileExtensionAfterDot(outputPath); int bitDepth = outputFileExtension[0] - '0'; struct PngToGbaOptions options; + options.numTilesMode = NUM_TILES_IGNORE; options.numTiles = 0; options.bitDepth = bitDepth; options.metatileWidth = 1; @@ -203,6 +204,12 @@ void HandlePngToGbaCommand(char *inputPath, char *outputPath, int argc, char **a if (options.numTiles < 1) FATAL_ERROR("Number of tiles must be positive.\n"); } + else if (strcmp(option, "-Wnum_tiles") == 0) { + options.numTilesMode = NUM_TILES_WARN; + } + else if (strcmp(option, "-Werror=num_tiles") == 0) { + options.numTilesMode = NUM_TILES_ERROR; + } else if (strcmp(option, "-mwidth") == 0) { if (i + 1 >= argc) diff --git a/tools/gbagfx/options.h b/tools/gbagfx/options.h index 3b038f572..250b72345 100644 --- a/tools/gbagfx/options.h +++ b/tools/gbagfx/options.h @@ -4,6 +4,7 @@ #define OPTIONS_H #include +#include "gfx.h" struct GbaToPngOptions { char *paletteFilePath; @@ -18,6 +19,7 @@ struct GbaToPngOptions { struct PngToGbaOptions { int numTiles; + enum NumTilesMode numTilesMode; int bitDepth; int metatileWidth; int metatileHeight; From cce99189080cea6b8745aca84cfd75d0858c0822 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 18 Aug 2022 23:13:27 -0400 Subject: [PATCH 6/6] Add Wnum_tiles to additional num_tiles rules --- graphics_file_rules.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/graphics_file_rules.mk b/graphics_file_rules.mk index 3335179d1..742f7d1b8 100644 --- a/graphics_file_rules.mk +++ b/graphics_file_rules.mk @@ -713,10 +713,10 @@ $(STARTERGFXDIR)/birch_help.4bpp: $(STARTERGFXDIR)/birch_bag.4bpp $(STARTERGFXDI @cat $^ >$@ $(NAMINGGFXDIR)/cursor.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 5 + $(GFX) $< $@ -num_tiles 5 -Wnum_tiles $(NAMINGGFXDIR)/cursor_squished.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 5 + $(GFX) $< $@ -num_tiles 5 -Wnum_tiles $(NAMINGGFXDIR)/cursor_filled.4bpp: %.4bpp: %.png - $(GFX) $< $@ -num_tiles 5 + $(GFX) $< $@ -num_tiles 5 -Wnum_tiles