This commit is contained in:
GriffinR
2022-06-03 15:43:21 -04:00
128 changed files with 1530 additions and 1525 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
static const char AgbLibFlashVersion[] = "FLASH1M_V103";
const struct FlashSetupInfo * const sSetupInfos[] =
static const struct FlashSetupInfo * const sSetupInfos[] =
{
&MX29L010,
&LE26FV10N1TS,
+2 -2
View File
@@ -15,7 +15,7 @@ static void AnimOverheatFlame_Step(struct Sprite *);
static void AnimTask_DragonDanceWaver_Step(u8);
static void UpdateDragonDanceScanlineEffect(struct Task *);
EWRAM_DATA static u16 gUnusedOverheatData[7] = {0};
EWRAM_DATA static u16 sUnusedOverheatData[7] = {0};
static const union AnimCmd sAnim_OutrageOverheatFire_0[] =
{
@@ -426,7 +426,7 @@ static void AnimOverheatFlame(struct Sprite *sprite)
sprite->data[3] = gBattleAnimArgs[3];
sprite->callback = AnimOverheatFlame_Step;
for (i = 0; i < 7; i++)
gUnusedOverheatData[i] = sprite->data[i];
sUnusedOverheatData[i] = sprite->data[i];
}
static void AnimOverheatFlame_Step(struct Sprite *sprite)
+2 -2
View File
@@ -653,9 +653,9 @@ static void AnimTask_SpiteTargetShadow_Step1(u8 taskId)
startLine = 0;
if (position == 1)
task->data[10] = ScanlineEffect_InitWave(startLine, startLine + 64, 2, 6, 0, SCANLINE_EFFECT_REG_BG1HOFS, 1);
task->data[10] = ScanlineEffect_InitWave(startLine, startLine + 64, 2, 6, 0, SCANLINE_EFFECT_REG_BG1HOFS, TRUE);
else
task->data[10] = ScanlineEffect_InitWave(startLine, startLine + 64, 2, 6, 0, SCANLINE_EFFECT_REG_BG2HOFS, 1);
task->data[10] = ScanlineEffect_InitWave(startLine, startLine + 64, 2, 6, 0, SCANLINE_EFFECT_REG_BG2HOFS, TRUE);
task->data[15]++;
break;
+3 -3
View File
@@ -248,7 +248,7 @@ static const struct SubspriteTable sFrozenIceCubeSubspriteTable[] =
{ARRAY_COUNT(sFrozenIceCubeSubsprites), sFrozenIceCubeSubsprites},
};
static const struct SpriteTemplate gFrozenIceCubeSpriteTemplate =
static const struct SpriteTemplate sFrozenIceCubeSpriteTemplate =
{
.tileTag = ANIM_TAG_ICE_CUBE,
.paletteTag = ANIM_TAG_ICE_CUBE,
@@ -389,7 +389,7 @@ void AnimTask_FrozenIceCube(u8 taskId)
x -= 6;
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
spriteId = CreateSprite(&gFrozenIceCubeSpriteTemplate, x, y, 4);
spriteId = CreateSprite(&sFrozenIceCubeSpriteTemplate, x, y, 4);
if (GetSpriteTileStartByTag(ANIM_TAG_ICE_CUBE) == 0xFFFF)
gSprites[spriteId].invisible = TRUE;
SetSubspriteTables(&gSprites[spriteId], sFrozenIceCubeSubspriteTable);
@@ -549,7 +549,7 @@ void LaunchStatusAnimation(u8 battlerId, u8 statusAnimId)
gBattleAnimAttacker = battlerId;
gBattleAnimTarget = battlerId;
LaunchBattleAnimation(gBattleAnims_StatusConditions, statusAnimId, 0);
LaunchBattleAnimation(gBattleAnims_StatusConditions, statusAnimId, FALSE);
taskId = CreateTask(Task_DoStatusAnimation, 10);
gTasks[taskId].data[0] = battlerId;
}
+1 -2
View File
@@ -594,8 +594,7 @@ static void StatsChangeAnimation_Step3(u8 taskId)
if (gTasks[taskId].data[6] == 1)
gSprites[gTasks[taskId].data[7]].oam.priority++;
Free(sAnimStatsChangeData);
sAnimStatsChangeData = NULL;
FREE_AND_SET_NULL(sAnimStatsChangeData);
DestroyAnimVisualTask(taskId);
break;
}
+4 -4
View File
@@ -159,7 +159,7 @@ const struct BgTemplate gBattleBgTemplates[] =
},
};
static const struct WindowTemplate gStandardBattleWindowTemplates[] =
static const struct WindowTemplate sStandardBattleWindowTemplates[] =
{
[B_WIN_MSG] = {
.bg = 0,
@@ -380,7 +380,7 @@ static const struct WindowTemplate gStandardBattleWindowTemplates[] =
DUMMY_WIN_TEMPLATE
};
static const struct WindowTemplate gBattleArenaWindowTemplates[] =
static const struct WindowTemplate sBattleArenaWindowTemplates[] =
{
[B_WIN_MSG] = {
.bg = 0,
@@ -594,8 +594,8 @@ static const struct WindowTemplate gBattleArenaWindowTemplates[] =
const struct WindowTemplate * const gBattleWindowTemplates[] =
{
[B_WIN_TYPE_NORMAL] = gStandardBattleWindowTemplates,
[B_WIN_TYPE_ARENA] = gBattleArenaWindowTemplates,
[B_WIN_TYPE_NORMAL] = sStandardBattleWindowTemplates,
[B_WIN_TYPE_ARENA] = sBattleArenaWindowTemplates,
};
static const struct BattleBackground sBattleTerrainTable[] =
+1 -2
View File
@@ -1131,8 +1131,7 @@ static void CB2_InitSelectScreen(void)
switch (gMain.state)
{
case 0:
if (sFactorySelectMons != NULL)
FREE_AND_SET_NULL(sFactorySelectMons);
TRY_FREE_AND_SET_NULL(sFactorySelectMons);
SetHBlankCallback(NULL);
SetVBlankCallback(NULL);
CpuFill32(0, (void *)VRAM, VRAM_SIZE);
+3 -3
View File
@@ -590,7 +590,7 @@ void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
if (species == SPECIES_CASTFORM)
{
paletteOffset = 0x100 + battlerId * 16;
LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[CASTFORM_NORMAL]);
LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette);
LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerId]], paletteOffset, 0x20);
}
@@ -653,7 +653,7 @@ void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
if (species == SPECIES_CASTFORM)
{
paletteOffset = 0x100 + battlerId * 16;
LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[CASTFORM_NORMAL]);
LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette);
LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerId]], paletteOffset, 0x20);
}
@@ -973,7 +973,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 castform)
if (targetSpecies == SPECIES_CASTFORM)
{
gSprites[gBattlerSpriteIds[battlerAtk]].anims = gMonFrontAnimsPtrTable[targetSpecies];
LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette[CASTFORM_NORMAL]);
LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette);
LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerDef]], paletteOffset, 32);
}
+3 -6
View File
@@ -1498,8 +1498,7 @@ static void CB2_PreInitMultiBattle(void)
gBattleTypeFlags = *savedBattleTypeFlags;
gMain.savedCallback = *savedCallback;
SetMainCallback2(CB2_InitBattleInternal);
Free(sMultiPartnerPartyBuffer);
sMultiPartnerPartyBuffer = NULL;
FREE_AND_SET_NULL(sMultiPartnerPartyBuffer);
}
}
else if (gReceivedRemoteLinkPlayers == 0)
@@ -1507,8 +1506,7 @@ static void CB2_PreInitMultiBattle(void)
gBattleTypeFlags = *savedBattleTypeFlags;
gMain.savedCallback = *savedCallback;
SetMainCallback2(CB2_InitBattleInternal);
Free(sMultiPartnerPartyBuffer);
sMultiPartnerPartyBuffer = NULL;
FREE_AND_SET_NULL(sMultiPartnerPartyBuffer);
}
break;
}
@@ -1544,8 +1542,7 @@ static void CB2_PreInitIngamePlayerPartnerBattle(void)
gBattleTypeFlags = *savedBattleTypeFlags;
gMain.savedCallback = *savedCallback;
SetMainCallback2(CB2_InitBattleInternal);
Free(sMultiPartnerPartyBuffer);
sMultiPartnerPartyBuffer = NULL;
FREE_AND_SET_NULL(sMultiPartnerPartyBuffer);
}
break;
}
+2 -2
View File
@@ -687,7 +687,7 @@ struct
{
u32 facilityClass;
const u8 *const *strings;
} const sPartnerTrainerTextTables[] =
} static const sPartnerTrainerTextTables[] =
{
{FACILITY_CLASS_LASS, sPartnerTextsLass},
{FACILITY_CLASS_YOUNGSTER, sPartnerTextsYoungster},
@@ -769,7 +769,7 @@ struct
u8 nature;
u8 evs[NUM_STATS];
u16 moves[MAX_MON_MOVES];
} const sStevenMons[MULTI_PARTY_SIZE] =
} static const sStevenMons[MULTI_PARTY_SIZE] =
{
{
.species = SPECIES_METANG,
+1 -1
View File
@@ -1190,7 +1190,7 @@ u8 DoFieldEndTurnEffects(void)
s32 j;
for (j = i + 1; j < gBattlersCount; j++)
{
if (GetWhoStrikesFirst(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], 0))
if (GetWhoStrikesFirst(gBattlerByTurnOrder[i], gBattlerByTurnOrder[j], FALSE))
SwapTurnOrder(i, j);
}
}
+2 -2
View File
@@ -1188,9 +1188,9 @@ static void SetBerrySpriteData(struct Sprite* sprite, s16 x, s16 y, s16 bounceSp
#undef sXSpeed
#undef sYDownSpeed
static void CreateBerrySprite(u16 a0, u8 playerId)
static void CreateBerrySprite(u16 itemId, u8 playerId)
{
u8 spriteId = CreateSpinningBerrySprite(a0 + FIRST_BERRY_INDEX - 10, 0, 80, playerId & 1);
u8 spriteId = CreateSpinningBerrySprite(ITEM_TO_BERRY(itemId) - 1, 0, 80, playerId & 1);
SetBerrySpriteData(&gSprites[spriteId],
sBerrySpriteData[playerId][0],
sBerrySpriteData[playerId][1],
+3 -3
View File
@@ -2254,7 +2254,7 @@ static u32 Cmd_PrintMessage(struct BerryCrushGame *game, u8 *args)
switch (game->cmdState)
{
case 0:
DrawDialogueFrame(0, 0);
DrawDialogueFrame(0, FALSE);
if (args[1] & F_MSG_EXPAND)
{
StringExpandPlaceholders(gStringVar4, sMessages[args[0]]);
@@ -3241,7 +3241,7 @@ static u32 Cmd_SaveGame(struct BerryCrushGame *game, u8 *args)
case 2:
if (!IsLinkTaskFinished())
return 0;
DrawDialogueFrame(0, 0);
DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized2(0, FONT_NORMAL, gText_SavingDontTurnOffPower, 0, 0, 2, 1, 3);
CopyWindowToVram(0, COPYWIN_FULL);
CreateTask(Task_LinkFullSave, 0);
@@ -3389,7 +3389,7 @@ static u32 Cmd_StopGame(struct BerryCrushGame *game, u8 *args)
switch (game->cmdState)
{
case 0:
DrawDialogueFrame(0, 0);
DrawDialogueFrame(0, FALSE);
if (game->playAgainState == PLAY_AGAIN_NO_BERRIES)
AddTextPrinterParameterized2(0, FONT_NORMAL, sMessages[MSG_NO_BERRIES], game->textSpeed, 0, 2, 1, 3);
else
+1 -1
View File
@@ -8,7 +8,7 @@
#include "international_string_util.h"
#include "constants/coins.h"
EWRAM_DATA u8 sCoinsWindowId = 0;
static EWRAM_DATA u8 sCoinsWindowId = 0;
void PrintCoinsString(u32 coinAmount)
{
+13 -13
View File
@@ -352,7 +352,7 @@ EWRAM_DATA u16 gSpecialVar_ContestRank = 0;
EWRAM_DATA u8 gNumLinkContestPlayers = 0;
EWRAM_DATA u8 gHighestRibbonRank = 0;
EWRAM_DATA struct ContestResources *gContestResources = NULL;
EWRAM_DATA u8 sContestBgCopyFlags = 0;
static EWRAM_DATA u8 sContestBgCopyFlags = 0;
EWRAM_DATA struct ContestWinner gCurContestWinner = {0};
EWRAM_DATA bool8 gCurContestWinnerIsForArtist = 0;
EWRAM_DATA u8 gCurContestWinnerSaveIdx = 0;
@@ -625,7 +625,7 @@ static const struct SpriteTemplate sSpriteTemplate_ApplauseMeter =
.callback = SpriteCallbackDummy
};
const struct OamData sOam_Judge =
static const struct OamData sOam_Judge =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
@@ -639,7 +639,7 @@ const struct OamData sOam_Judge =
.paletteNum = 2,
};
const struct SpriteTemplate sSpriteTemplate_Judge =
static const struct SpriteTemplate sSpriteTemplate_Judge =
{
.tileTag = TAG_JUDGE,
.paletteTag = TAG_JUDGE,
@@ -650,7 +650,7 @@ const struct SpriteTemplate sSpriteTemplate_Judge =
.callback = SpriteCallbackDummy
};
const struct CompressedSpriteSheet sSpriteSheet_Judge =
static const struct CompressedSpriteSheet sSpriteSheet_Judge =
{
.data = gContestJudgeGfx,
.size = 0x800,
@@ -664,13 +664,13 @@ static const struct CompressedSpriteSheet sSpriteSheet_JudgeSymbols =
.tag = TAG_JUDGE_SYMBOLS_GFX
};
const struct CompressedSpritePalette sSpritePalette_JudgeSymbols =
static const struct CompressedSpritePalette sSpritePalette_JudgeSymbols =
{
.data = gContestJudgeSymbolsPal,
.tag = TAG_CONTEST_SYMBOLS_PAL
};
const struct SpriteTemplate sSpriteTemplate_JudgeSpeechBubble =
static const struct SpriteTemplate sSpriteTemplate_JudgeSpeechBubble =
{
.tileTag = TAG_JUDGE_SYMBOLS_GFX,
.paletteTag = TAG_CONTEST_SYMBOLS_PAL,
@@ -876,7 +876,7 @@ static const struct SpritePalette sSpritePalettes_ContestantsTurnBlinkEffect[CON
}
};
const struct OamData sOam_ContestantsTurnBlinkEffect =
static const struct OamData sOam_ContestantsTurnBlinkEffect =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_DOUBLE,
@@ -891,13 +891,13 @@ const struct OamData sOam_ContestantsTurnBlinkEffect =
.affineParam = 0,
};
const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_0[] =
static const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_0[] =
{
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
AFFINEANIMCMD_END
};
const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_1[] =
static const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_1[] =
{
AFFINEANIMCMD_FRAME(3, 3, 0, 15),
AFFINEANIMCMD_FRAME(-3, -3, 0, 15),
@@ -906,13 +906,13 @@ const union AffineAnimCmd sAffineAnim_ContestantsTurnBlinkEffect_1[] =
AFFINEANIMCMD_END
};
const union AffineAnimCmd *const sAffineAnims_ContestantsTurnBlinkEffect[] =
static const union AffineAnimCmd *const sAffineAnims_ContestantsTurnBlinkEffect[] =
{
sAffineAnim_ContestantsTurnBlinkEffect_0,
sAffineAnim_ContestantsTurnBlinkEffect_1
};
const struct SpriteTemplate sSpriteTemplates_ContestantsTurnBlinkEffect[CONTESTANT_COUNT] =
static const struct SpriteTemplate sSpriteTemplates_ContestantsTurnBlinkEffect[CONTESTANT_COUNT] =
{
{
.tileTag = TAG_BLINK_EFFECT_CONTESTANT0,
@@ -952,7 +952,7 @@ const struct SpriteTemplate sSpriteTemplates_ContestantsTurnBlinkEffect[CONTESTA
}
};
static const s8 gContestExcitementTable[CONTEST_CATEGORIES_COUNT][CONTEST_CATEGORIES_COUNT] =
static const s8 sContestExcitementTable[CONTEST_CATEGORIES_COUNT][CONTEST_CATEGORIES_COUNT] =
{
[CONTEST_CATEGORY_COOL] = {
[CONTEST_CATEGORY_COOL] = +1,
@@ -4744,7 +4744,7 @@ static void UpdateApplauseMeter(void)
s8 Contest_GetMoveExcitement(u16 move)
{
return gContestExcitementTable[gSpecialVar_ContestCategory][gContestMoves[move].contestCategory];
return sContestExcitementTable[gSpecialVar_ContestCategory][gContestMoves[move].contestCategory];
}
static u8 StartApplauseOverflowAnimation(void)
+27 -19
View File
@@ -77,7 +77,10 @@ enum {
#define TAG_CONFETTI 3017
#define TAG_WIRELESS_INDICATOR_WINDOW 22222
#define MAX_BAR_LENGTH 87
// Length of the score bar on the results screen
#define NUM_BAR_SEGMENTS 11
#define BAR_SEGMENT_LENGTH 8 // Each segment of the results bar is a single tile, so 8 pixels long
#define MAX_BAR_LENGTH (NUM_BAR_SEGMENTS * BAR_SEGMENT_LENGTH)
// Starting x/y for the sliding results screen text box
#define TEXT_BOX_X (DISPLAY_WIDTH + 32)
@@ -96,7 +99,7 @@ struct ContestResultsInternal
u8 winnerMonSpriteId;
bool8 destroyConfetti;
bool8 pointsFlashing;
s16 unkC[CONTESTANT_COUNT];
s16 barLength[CONTESTANT_COUNT];
u8 numBarsUpdating;
};
@@ -1748,7 +1751,7 @@ static void CalculateContestantsResultData(void)
if ((*sContestResults->monResults)[i].lostPoints)
barLengthRound2 *= -1;
if (barLengthPreliminary + barLengthRound2 == MAX_BAR_LENGTH + 1)
if (barLengthPreliminary + barLengthRound2 == MAX_BAR_LENGTH)
{
if (barLengthRound2 > 0)
(*sContestResults->monResults)[i].barLengthRound2--;
@@ -1841,47 +1844,52 @@ static void Task_UpdateContestResultBar(u8 taskId)
s16 target = gTasks[taskId].tTarget;
s16 decreasing = gTasks[taskId].tDecreasing;
// Has the results bar reached the limit?
if (decreasing)
{
if (sContestResults->data->unkC[monId] <= 0)
if (sContestResults->data->barLength[monId] <= 0)
minMaxReached = TRUE;
}
else
{
if (sContestResults->data->unkC[monId] > MAX_BAR_LENGTH)
if (sContestResults->data->barLength[monId] >= MAX_BAR_LENGTH)
minMaxReached = TRUE;
}
if (sContestResults->data->unkC[monId] == target)
if (sContestResults->data->barLength[monId] == target)
targetReached = TRUE;
if (!targetReached)
{
// Target length has not been reached, update bar length
if (minMaxReached)
sContestResults->data->unkC[monId] = target;
sContestResults->data->barLength[monId] = target;
else if (decreasing)
sContestResults->data->unkC[monId] = sContestResults->data->unkC[monId] - 1;
sContestResults->data->barLength[monId]--;
else
sContestResults->data->unkC[monId] = sContestResults->data->unkC[monId] + 1;
sContestResults->data->barLength[monId]++;
}
// Update the tiles of the results bar if it's still changing
if (!minMaxReached && !targetReached)
{
u8 var0;
u8 tileOffset;
u16 tileNum;
for (i = 0; i < 11; i++)
for (i = 0; i < NUM_BAR_SEGMENTS; i++)
{
if (sContestResults->data->unkC[monId] >= (i + 1) * 8)
var0 = 8;
else if (sContestResults->data->unkC[monId] >= i * 8)
var0 = sContestResults->data->unkC[monId] % 8;
if (sContestResults->data->barLength[monId] >= (i + 1) * BAR_SEGMENT_LENGTH)
tileOffset = 8; // Bar segment is full
else if (sContestResults->data->barLength[monId] >= i * BAR_SEGMENT_LENGTH)
tileOffset = sContestResults->data->barLength[monId] % 8; // Bar segment is between full and empty
else
var0 = 0;
tileOffset = 0; // Bar segment is empty
if (var0 < 4)
tileNum = 0x504C + var0;
// The first 4 bar segment tiles are not adjacent in the tileset to the
// remaining bar segment tiles; choose the base tile number accordingly.
if (tileOffset < 4)
tileNum = 0x504C + tileOffset;
else
tileNum = 0x5057 + var0;
tileNum = 0x5057 + tileOffset;
FillBgTilemapBufferRect_Palette0(2, tileNum, i + 7, monId * 3 + 6, 1, 1);
}
@@ -1272,7 +1272,7 @@ static const union AnimCmd *const sAnimTable_RayquazaSpotlightEffect[] = {
sAnim_RayquazaSpotlightEffect,
};
const struct SpriteFrameImage sPicTable_RayquazaSpotlightEffect[] = {
static const struct SpriteFrameImage sPicTable_RayquazaSpotlightEffect[] = {
overworld_frame(gObjectEventPic_Rayquaza, 4, 4, 0),
};
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -174,10 +174,10 @@ static const struct SpriteTemplate sSpriteTemplate_MenuText =
.callback = SpriteCallbackDummy,
};
static const u16 TradeScreenTextPalette[] = INCBIN_U16("graphics/trade/text.gbapal");
static const struct SpritePalette gSpritePalette_TradeScreenText =
static const u16 sTradeScreenTextPalette[] = INCBIN_U16("graphics/trade/text.gbapal");
static const struct SpritePalette sSpritePalette_TradeScreenText =
{
.data = TradeScreenTextPalette,
.data = sTradeScreenTextPalette,
.tag = PALTAG_MENU_TEXT
};
+15 -15
View File
@@ -1,4 +1,4 @@
static const union AnimCmd gAnimCmd_Brendan_1[] =
static const union AnimCmd sAnimCmd_Brendan_1[] =
{
ANIMCMD_FRAME(0, 24),
ANIMCMD_FRAME(1, 9),
@@ -8,7 +8,7 @@ static const union AnimCmd gAnimCmd_Brendan_1[] =
ANIMCMD_END,
};
static const union AnimCmd gAnimCmd_May_Steven_1[] =
static const union AnimCmd sAnimCmd_May_Steven_1[] =
{
ANIMCMD_FRAME(0, 24),
ANIMCMD_FRAME(1, 9),
@@ -18,7 +18,7 @@ static const union AnimCmd gAnimCmd_May_Steven_1[] =
ANIMCMD_END,
};
static const union AnimCmd gAnimCmd_Wally_1[] =
static const union AnimCmd sAnimCmd_Wally_1[] =
{
ANIMCMD_FRAME(0, 24),
ANIMCMD_FRAME(1, 9),
@@ -28,7 +28,7 @@ static const union AnimCmd gAnimCmd_Wally_1[] =
ANIMCMD_END,
};
static const union AnimCmd gAnimCmd_Red_1[] =
static const union AnimCmd sAnimCmd_Red_1[] =
{
ANIMCMD_FRAME(1, 20),
ANIMCMD_FRAME(2, 6),
@@ -38,7 +38,7 @@ static const union AnimCmd gAnimCmd_Red_1[] =
ANIMCMD_END,
};
static const union AnimCmd gAnimCmd_Leaf_1[] =
static const union AnimCmd sAnimCmd_Leaf_1[] =
{
ANIMCMD_FRAME(1, 20),
ANIMCMD_FRAME(2, 6),
@@ -48,7 +48,7 @@ static const union AnimCmd gAnimCmd_Leaf_1[] =
ANIMCMD_END,
};
static const union AnimCmd gAnimCmd_RubySapphireBrendan_1[] =
static const union AnimCmd sAnimCmd_RubySapphireBrendan_1[] =
{
ANIMCMD_FRAME(0, 24),
ANIMCMD_FRAME(1, 9),
@@ -58,7 +58,7 @@ static const union AnimCmd gAnimCmd_RubySapphireBrendan_1[] =
ANIMCMD_END,
};
static const union AnimCmd gAnimCmd_RubySapphireMay_1[] =
static const union AnimCmd sAnimCmd_RubySapphireMay_1[] =
{
ANIMCMD_FRAME(0, 24),
ANIMCMD_FRAME(1, 9),
@@ -71,49 +71,49 @@ static const union AnimCmd gAnimCmd_RubySapphireMay_1[] =
static const union AnimCmd *const sBackAnims_Brendan[] =
{
sAnim_GeneralFrame3,
gAnimCmd_Brendan_1,
sAnimCmd_Brendan_1,
};
static const union AnimCmd *const sBackAnims_May[] =
{
sAnim_GeneralFrame3,
gAnimCmd_May_Steven_1,
sAnimCmd_May_Steven_1,
};
static const union AnimCmd *const sBackAnims_Red[] =
{
sAnim_GeneralFrame0,
gAnimCmd_Red_1,
sAnimCmd_Red_1,
};
static const union AnimCmd *const sBackAnims_Leaf[] =
{
sAnim_GeneralFrame0,
gAnimCmd_Leaf_1,
sAnimCmd_Leaf_1,
};
static const union AnimCmd *const sBackAnims_RubySapphireBrendan[] =
{
sAnim_GeneralFrame3,
gAnimCmd_RubySapphireBrendan_1,
sAnimCmd_RubySapphireBrendan_1,
};
static const union AnimCmd *const sBackAnims_RubySapphireMay[] =
{
sAnim_GeneralFrame3,
gAnimCmd_RubySapphireMay_1,
sAnimCmd_RubySapphireMay_1,
};
static const union AnimCmd *const sBackAnims_Wally[] =
{
sAnim_GeneralFrame3,
gAnimCmd_Wally_1,
sAnimCmd_Wally_1,
};
static const union AnimCmd *const sBackAnims_Steven[] =
{
sAnim_GeneralFrame3,
gAnimCmd_May_Steven_1,
sAnimCmd_May_Steven_1,
};
const union AnimCmd *const *const gTrainerBackAnimsPtrTable[] =
+2 -2
View File
@@ -826,7 +826,7 @@ static void ReturnToActionsMenuFromCategories(u8 taskId)
{
RemoveDecorationWindow(WINDOW_DECORATION_CATEGORIES);
AddDecorationActionsWindow();
DrawDialogueFrame(0, 0);
DrawDialogueFrame(0, FALSE);
PrintCurMainMenuDescription();
gTasks[taskId].func = HandleDecorationActionsMenuInput;
}
@@ -2664,7 +2664,7 @@ static void FieldCB_StopPuttingAwayDecorations(void)
u8 taskId;
FadeInFromBlack();
DrawDialogueFrame(0, 1);
DrawDialogueFrame(0, TRUE);
InitDecorationActionsWindow();
taskId = CreateTask(Task_ReinitializeDecorationMenuHandler, 8);
gTasks[taskId].tState = 0;
+1 -1
View File
@@ -4546,7 +4546,7 @@ struct
{
u8 id;
void (*func)(void);
} const sGfxFuncs[] =
} static const sGfxFuncs[] =
{
{GFXFUNC_LOAD, LoadGfx}, // Element not used, LoadGfx is passed directly to SetGfxFunc
{GFXFUNC_SHOW_NAMES, ShowNames},
+3 -6
View File
@@ -1672,8 +1672,7 @@ static bool8 InitEasyChatScreenStruct(u8 type, u16 *words, u8 displayedPersonTyp
static void FreeEasyChatScreenStruct(void)
{
if (sEasyChatScreen != NULL)
FREE_AND_SET_NULL(sEasyChatScreen);
TRY_FREE_AND_SET_NULL(sEasyChatScreen);
}
// Returns the function ID of the action to take as a result of player's input.
@@ -3075,8 +3074,7 @@ static bool8 LoadEasyChatScreen(void)
static void FreeEasyChatScreenControl(void)
{
if (sScreenControl)
FREE_AND_SET_NULL(sScreenControl);
TRY_FREE_AND_SET_NULL(sScreenControl);
}
static void StartEasyChatFunction(u16 funcId)
@@ -5573,8 +5571,7 @@ static bool8 InitEasyChatScreenWordData(void)
static void FreeEasyChatScreenWordData(void)
{
if (sWordData)
FREE_AND_SET_NULL(sWordData);
TRY_FREE_AND_SET_NULL(sWordData);
}
static void SetUnlockedEasyChatGroups(void)
+2
View File
@@ -15,6 +15,8 @@
#include "constants/items.h"
#include "constants/trainer_hill.h"
STATIC_ASSERT(sizeof(struct TrainerHillChallenge) <= SECTOR_DATA_SIZE, TrainerHillChallengeFreeSpace);
struct SendRecvMgr
{
bool8 isParent;
+3 -3
View File
@@ -30,7 +30,7 @@ EWRAM_DATA u16 gSpecialVar_Facing = 0;
EWRAM_DATA u16 gSpecialVar_MonBoxId = 0;
EWRAM_DATA u16 gSpecialVar_MonBoxPos = 0;
EWRAM_DATA u16 gSpecialVar_Unused_0x8014 = 0;
EWRAM_DATA static u8 gSpecialFlags[SPECIAL_FLAGS_SIZE] = {0};
EWRAM_DATA static u8 sSpecialFlags[SPECIAL_FLAGS_SIZE] = {0};
extern u16 *const gSpecialVars[];
@@ -38,7 +38,7 @@ void InitEventData(void)
{
memset(gSaveBlock1Ptr->flags, 0, sizeof(gSaveBlock1Ptr->flags));
memset(gSaveBlock1Ptr->vars, 0, sizeof(gSaveBlock1Ptr->vars));
memset(gSpecialFlags, 0, sizeof(gSpecialFlags));
memset(sSpecialFlags, 0, sizeof(sSpecialFlags));
}
void ClearTempFieldEventData(void)
@@ -205,7 +205,7 @@ u8 *GetFlagPointer(u16 id)
else if (id < SPECIAL_FLAGS_START)
return &gSaveBlock1Ptr->flags[id / 8];
else
return &gSpecialFlags[(id - SPECIAL_FLAGS_START) / 8];
return &sSpecialFlags[(id - SPECIAL_FLAGS_START) / 8];
}
u8 FlagSet(u16 id)
+5 -5
View File
@@ -8251,11 +8251,11 @@ static const SpriteStepFunc *const sNpcStepFuncTables[] = {
};
static const s16 sStepTimes[] = {
[MOVE_SPEED_NORMAL] = 16,
[MOVE_SPEED_FAST_1] = 8,
[MOVE_SPEED_FAST_2] = 6,
[MOVE_SPEED_FASTER] = 4,
[MOVE_SPEED_FASTEST] = 2,
[MOVE_SPEED_NORMAL] = ARRAY_COUNT(sStep1Funcs),
[MOVE_SPEED_FAST_1] = ARRAY_COUNT(sStep2Funcs),
[MOVE_SPEED_FAST_2] = ARRAY_COUNT(sStep3Funcs),
[MOVE_SPEED_FASTER] = ARRAY_COUNT(sStep4Funcs),
[MOVE_SPEED_FASTEST] = ARRAY_COUNT(sStep8Funcs),
};
static bool8 NpcTakeStep(struct Sprite *sprite)
+2 -4
View File
@@ -816,8 +816,7 @@ static void Task_EvolutionScene(u8 taskId)
DestroyTask(taskId);
FreeMonSpritesGfx();
Free(sEvoStructPtr);
sEvoStructPtr = NULL;
FREE_AND_SET_NULL(sEvoStructPtr);
FreeAllWindowBuffers();
SetMainCallback2(gCB2_AfterEvolution);
}
@@ -1223,8 +1222,7 @@ static void Task_TradeEvolutionScene(u8 taskId)
if (!IsTextPrinterActive(0))
{
DestroyTask(taskId);
Free(sEvoStructPtr);
sEvoStructPtr = NULL;
FREE_AND_SET_NULL(sEvoStructPtr);
gTextFlags.useAlternateDownArrow = 0;
SetMainCallback2(gCB2_AfterEvolution);
}
+2 -2
View File
@@ -212,13 +212,13 @@ void CurrentMapDrawMetatileAt(int x, int y)
}
}
void DrawDoorMetatileAt(int x, int y, u16 *arr)
void DrawDoorMetatileAt(int x, int y, u16 *tiles)
{
int offset = MapPosToBgTilemapOffset(&sFieldCameraOffset, x, y);
if (offset >= 0)
{
DrawMetatile(METATILE_LAYER_TYPE_COVERED, arr, offset);
DrawMetatile(METATILE_LAYER_TYPE_COVERED, tiles, offset);
sFieldCameraOffset.copyBGToVRAM = TRUE;
}
}
+52 -31
View File
@@ -18,7 +18,7 @@ struct DoorGraphics
u8 sound;
u8 size;
const void *tiles;
const void *palette;
const void *palettes;
};
struct DoorAnimFrame
@@ -74,7 +74,7 @@ static const u8 sDoorAnimTiles_PokemonLeague[] = INCBIN_U8("graphics/door_anims/
static const u16 sDoorNullPalette20[16] = {};
static const u8 sDoorAnimTiles_Pacifidlog[] = INCBIN_U8("graphics/door_anims/pacifidlog.4bpp");
static const u16 sDoorNullPalette21[16] = {};
static const u8 sDoorAnimTiles_BattleTowerCorridor[] = INCBIN_U8("graphics/door_anims/battle_tower_corridor.4bpp");
static const u8 sDoorAnimTiles_PetalburgGym[] = INCBIN_U8("graphics/door_anims/petalburg_gym.4bpp");
static const u16 sDoorNullPalette22[16] = {};
static const u8 sDoorAnimTiles_CyclingRoad[] = INCBIN_U8("graphics/door_anims/cycling_road.4bpp");
static const u16 sDoorNullPalette23[16] = {};
@@ -98,7 +98,7 @@ static const u8 sDoorAnimTiles_BattleTowerOld[] = INCBIN_U8("graphics/door_anims
static const u16 sDoorNullPalette32[16] = {};
static const u8 sDoorAnimTiles_BattleTowerElevator[] = INCBIN_U8("graphics/door_anims/battle_tower_elevator.4bpp");
static const u16 sDoorNullPalette33[16] = {};
static const u8 sDoorAnimTiles_34[] = INCBIN_U8("graphics/door_anims/unknown.4bpp");
static const u8 sDoorAnimTiles_UnusedBattleFrontier[] = INCBIN_U8("graphics/door_anims/unused_battle_frontier.4bpp");
static const u16 sDoorNullPalette34[16] = {};
static const u8 sDoorAnimTiles_BattleDome[] = INCBIN_U8("graphics/door_anims/battle_dome.4bpp");
static const u16 sDoorNullPalette35[16] = {};
@@ -190,7 +190,7 @@ static const u8 sDoorAnimPalettes_Mauville[] = {7, 7, 7, 7, 7, 7, 7, 7};
static const u8 sDoorAnimPalettes_Verdanturf[] = {6, 6, 5, 5, 5, 5, 5, 5};
static const u8 sDoorAnimPalettes_LilycoveWooden[] = {5, 5, 5, 5, 5, 5, 5, 5};
static const u8 sDoorAnimPalettes_Contest[] = {1, 1, 1, 1, 1, 1, 1, 1};
static const u8 sDoorAnimPalettes_BattleTowerCorridor[] = {6, 6, 6, 6, 6, 6, 6, 6};
static const u8 sDoorAnimPalettes_PetalburgGym[] = {6, 6, 6, 6, 6, 6, 6, 6};
static const u8 sDoorAnimPalettes_CyclingRoad[] = {7, 7, 7, 7, 7, 7, 7, 7};
static const u8 sDoorAnimPalettes_LilycoveDeptStore[] = {5, 5, 5, 5, 5, 5, 5, 5};
static const u8 sDoorAnimPalettes_SafariZone[] = {9, 9, 9, 9, 9, 9, 9, 9};
@@ -202,7 +202,7 @@ static const u8 sDoorAnimPalettes_AbandonedShipRoom[] = {7, 7, 7, 7, 7, 7, 7, 7}
static const u8 sDoorAnimPalettes_LilycoveDeptStoreElevator[] = {6, 6, 7, 7, 7, 7, 7, 7};
static const u8 sDoorAnimPalettes_BattleTowerOld[] = {9, 9, 9, 9, 9, 9, 9, 9};
static const u8 sDoorAnimPalettes_BattleTowerElevator[] = {7, 7, 7, 7, 7, 7, 7, 7};
static const u8 sDoorAnimPalettes_34[] = {9, 9, 9, 9, 9, 9, 9, 9};
static const u8 sDoorAnimPalettes_UnusedBattleFrontier[] = {9, 9, 9, 9, 9, 9, 9, 9};
static const u8 sDoorAnimPalettes_BattleDome[] = {1, 1, 1, 1, 1, 1, 1, 1};
static const u8 sDoorAnimPalettes_BattleFactory[] = {9, 9, 9, 9, 9, 9, 9, 9};
static const u8 sDoorAnimPalettes_BattleTower[] = {0, 0, 0, 0, 0, 0, 0, 0};
@@ -244,7 +244,7 @@ static const struct DoorGraphics sDoorAnimGraphicsTable[] =
{METATILE_Sootopolis_Door, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_Sootopolis, sDoorAnimPalettes_Sootopolis},
{METATILE_EverGrande_Door_PokemonLeague, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_PokemonLeague, sDoorAnimPalettes_PokemonLeague},
{METATILE_Pacifidlog_Door, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_Pacifidlog, sDoorAnimPalettes_Pacifidlog},
{METATILE_BattleFrontier_Door_Corridor, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_BattleTowerCorridor, sDoorAnimPalettes_BattleTowerCorridor},
{METATILE_PetalburgGym_Door, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_PetalburgGym, sDoorAnimPalettes_PetalburgGym},
{METATILE_Mauville_Door_CyclingRoad, DOOR_SOUND_NORMAL, 1, sDoorAnimTiles_CyclingRoad, sDoorAnimPalettes_CyclingRoad},
{METATILE_Lilycove_Door_DeptStore, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_LilycoveDeptStore, sDoorAnimPalettes_LilycoveDeptStore},
{METATILE_Lilycove_Door_SafariZone, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_SafariZone, sDoorAnimPalettes_SafariZone},
@@ -256,7 +256,9 @@ static const struct DoorGraphics sDoorAnimGraphicsTable[] =
{METATILE_Shop_Door_Elevator, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_LilycoveDeptStoreElevator, sDoorAnimPalettes_LilycoveDeptStoreElevator},
{METATILE_Dewford_Door_BattleTower, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleTowerOld, sDoorAnimPalettes_BattleTowerOld},
{METATILE_BattleFrontier_Door_Elevator, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleTowerElevator, sDoorAnimPalettes_BattleTowerElevator},
{0x3B0, /* TODO: Missing metatile ID */ DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_34, sDoorAnimPalettes_34},
// The metatile for this door doesn't seem to correspond to a door in any Emerald tileset. Given the surrounding door animations, it was likely cut from the Battle Frontier.
// From the palettes array we know it uses palette 9, and the door's shadow looks correct using either the Battle Tent or Battle Frontier Outside's 9th palette.
{0x3B0, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_UnusedBattleFrontier, sDoorAnimPalettes_UnusedBattleFrontier},
{METATILE_BattleFrontierOutsideWest_Door_BattleDome, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleDome, sDoorAnimPalettes_BattleDome},
{METATILE_BattleFrontierOutsideWest_Door_BattleFactory, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleFactory, sDoorAnimPalettes_BattleFactory},
{METATILE_BattleFrontierOutsideEast_Door_BattleTower, DOOR_SOUND_SLIDING, 1, sDoorAnimTiles_BattleTower, sDoorAnimPalettes_BattleTower},
@@ -278,52 +280,71 @@ static const struct DoorGraphics sDoorAnimGraphicsTable[] =
{},
};
// NOTE: The tiles of a door's animation must be copied to VRAM because they are not already part of any given tileset.
// This means that if there are any pre-existing tiles in this copied region that are visible when the door
// animation is played they will be overwritten.
#define DOOR_TILE_START_SIZE1 (NUM_TILES_TOTAL - 8)
#define DOOR_TILE_START_SIZE2 (NUM_TILES_TOTAL - 16)
static void CopyDoorTilesToVram(const struct DoorGraphics *gfx, const struct DoorAnimFrame *frame)
{
if (gfx->size == 2)
CpuFastSet(gfx->tiles + frame->offset, (void *)(VRAM + 0x7E00), 0x80);
CpuFastCopy(gfx->tiles + frame->offset, (void *)(VRAM + TILE_OFFSET_4BPP(DOOR_TILE_START_SIZE2)), 16 * TILE_SIZE_4BPP);
else
CpuFastSet(gfx->tiles + frame->offset, (void *)(VRAM + 0x7F00), 0x40);
CpuFastCopy(gfx->tiles + frame->offset, (void *)(VRAM + TILE_OFFSET_4BPP(DOOR_TILE_START_SIZE1)), 8 * TILE_SIZE_4BPP);
}
static void door_build_blockdef(u16 *a, u16 b, const u8 *c)
static void BuildDoorTiles(u16 *tiles, u16 tileNum, const u8 *paletteNums)
{
int i;
u16 unk;
u16 tile;
// Only the first 4 tiles of each metatile (bottom layer) actually use the door tiles
for (i = 0; i < 4; i++)
{
unk = *(c++) << 12;
a[i] = unk | (b + i);
tile = *(paletteNums++) << 12;
tiles[i] = tile | (tileNum + i);
}
// The remaining layers are left as tile 0 (with the same palette)
for (; i < 8; i++)
{
unk = *(c++) << 12;
a[i] = unk;
tile = *(paletteNums++) << 12;
tiles[i] = tile;
}
}
static void DrawCurrentDoorAnimFrame(const struct DoorGraphics *gfx, u32 x, u32 y, const u8 *pal)
static void DrawCurrentDoorAnimFrame(const struct DoorGraphics *gfx, u32 x, u32 y, const u8 *paletteNums)
{
u16 arr[24];
u16 tiles[24];
if (gfx->size == 2)
{
door_build_blockdef(&arr[8], 0x3F0, pal);
DrawDoorMetatileAt(x, y - 1, &arr[8]);
door_build_blockdef(&arr[8], 0x3F4, pal + 4);
DrawDoorMetatileAt(x, y, &arr[8]);
door_build_blockdef(&arr[8], 0x3F8, pal);
DrawDoorMetatileAt(x + 1, y - 1, &arr[8]);
door_build_blockdef(&arr[8], 0x3FC, pal + 4);
DrawDoorMetatileAt(x + 1, y, &arr[8]);
// Top left metatile
BuildDoorTiles(&tiles[8], DOOR_TILE_START_SIZE2 + 0, &paletteNums[0]);
DrawDoorMetatileAt(x, y - 1, &tiles[8]);
// Bottom left metatile
BuildDoorTiles(&tiles[8], DOOR_TILE_START_SIZE2 + 4, &paletteNums[4]);
DrawDoorMetatileAt(x, y, &tiles[8]);
// Top right metatile
BuildDoorTiles(&tiles[8], DOOR_TILE_START_SIZE2 + 8, &paletteNums[0]);
DrawDoorMetatileAt(x + 1, y - 1, &tiles[8]);
// Bottom right metatile
BuildDoorTiles(&tiles[8], DOOR_TILE_START_SIZE2 + 12, &paletteNums[4]);
DrawDoorMetatileAt(x + 1, y, &tiles[8]);
}
else
{
door_build_blockdef(&arr[0], 0x3F8, pal);
DrawDoorMetatileAt(x, y - 1, &arr[0]);
door_build_blockdef(&arr[0], 0x3FC, pal + 4);
DrawDoorMetatileAt(x, y, &arr[0]);
// Top metatile
BuildDoorTiles(&tiles[0], DOOR_TILE_START_SIZE1 + 0, &paletteNums[0]);
DrawDoorMetatileAt(x, y - 1, &tiles[0]);
// Bottom metatile
BuildDoorTiles(&tiles[0], DOOR_TILE_START_SIZE1 + 4, &paletteNums[4]);
DrawDoorMetatileAt(x, y, &tiles[0]);
}
}
@@ -350,9 +371,9 @@ static void DrawDoor(const struct DoorGraphics *gfx, const struct DoorAnimFrame
else
{
CopyDoorTilesToVram(gfx, frame);
DrawCurrentDoorAnimFrame(gfx, x, y, gfx->palette);
DrawCurrentDoorAnimFrame(gfx, x, y, gfx->palettes);
if (ShouldUseMultiCorridorDoor())
DrawCurrentDoorAnimFrame(gfx, gSpecialVar_0x8004 + MAP_OFFSET, gSpecialVar_0x8005 + MAP_OFFSET, gfx->palette);
DrawCurrentDoorAnimFrame(gfx, gSpecialVar_0x8004 + MAP_OFFSET, gSpecialVar_0x8005 + MAP_OFFSET, gfx->palettes);
}
}
+23 -23
View File
@@ -481,13 +481,13 @@ static const struct Subsprite sSubsprites_HofMonitorBig[] =
static const struct SubspriteTable sSubspriteTable_HofMonitorBig = subsprite_table(sSubsprites_HofMonitorBig);
const union AnimCmd sAnim_Static[] =
static const union AnimCmd sAnim_Static[] =
{
ANIMCMD_FRAME(.imageValue = 0, .duration = 1),
ANIMCMD_JUMP(0)
};
const union AnimCmd sAnim_Flicker[] =
static const union AnimCmd sAnim_Flicker[] =
{
ANIMCMD_FRAME(.imageValue = 0, .duration = 16),
ANIMCMD_FRAME(.imageValue = 1, .duration = 16),
@@ -501,7 +501,7 @@ const union AnimCmd sAnim_Flicker[] =
};
// Flicker on and off, for the Pokéballs / monitors during the PokéCenter heal effect
const union AnimCmd *const sAnims_Flicker[] =
static const union AnimCmd *const sAnims_Flicker[] =
{
sAnim_Static,
sAnim_Flicker
@@ -556,7 +556,7 @@ static const struct SpriteTemplate sSpriteTemplate_HofMonitorSmall =
.callback = SpriteCB_HallOfFameMonitor
};
void (*const sPokecenterHealEffectFuncs[])(struct Task *) =
static void (*const sPokecenterHealEffectFuncs[])(struct Task *) =
{
PokecenterHealEffect_Init,
PokecenterHealEffect_WaitForBallPlacement,
@@ -564,7 +564,7 @@ void (*const sPokecenterHealEffectFuncs[])(struct Task *) =
PokecenterHealEffect_WaitForSoundAndEnd
};
void (*const sHallOfFameRecordEffectFuncs[])(struct Task *) =
static void (*const sHallOfFameRecordEffectFuncs[])(struct Task *) =
{
HallOfFameRecordEffect_Init,
HallOfFameRecordEffect_WaitForBallPlacement,
@@ -572,7 +572,7 @@ void (*const sHallOfFameRecordEffectFuncs[])(struct Task *) =
HallOfFameRecordEffect_WaitForSoundAndEnd
};
void (*const sPokeballGlowEffectFuncs[])(struct Sprite *) =
static void (*const sPokeballGlowEffectFuncs[])(struct Sprite *) =
{
PokeballGlowEffect_PlaceBalls,
PokeballGlowEffect_TryPlaySe,
@@ -598,7 +598,7 @@ static const u8 sPokeballGlowReds[] = {16, 12, 8, 0};
static const u8 sPokeballGlowGreens[] = {16, 12, 8, 0};
static const u8 sPokeballGlowBlues[] = { 0, 0, 0, 0};
bool8 (*const sFallWarpFieldEffectFuncs[])(struct Task *) =
static bool8 (*const sFallWarpFieldEffectFuncs[])(struct Task *) =
{
FallWarpEffect_Init,
FallWarpEffect_WaitWeather,
@@ -609,7 +609,7 @@ bool8 (*const sFallWarpFieldEffectFuncs[])(struct Task *) =
FallWarpEffect_End,
};
bool8 (*const sEscalatorWarpOutFieldEffectFuncs[])(struct Task *) =
static bool8 (*const sEscalatorWarpOutFieldEffectFuncs[])(struct Task *) =
{
EscalatorWarpOut_Init,
EscalatorWarpOut_WaitForPlayer,
@@ -619,7 +619,7 @@ bool8 (*const sEscalatorWarpOutFieldEffectFuncs[])(struct Task *) =
EscalatorWarpOut_Down_End,
};
bool8 (*const sEscalatorWarpInFieldEffectFuncs[])(struct Task *) =
static bool8 (*const sEscalatorWarpInFieldEffectFuncs[])(struct Task *) =
{
EscalatorWarpIn_Init,
EscalatorWarpIn_Down_Init,
@@ -630,7 +630,7 @@ bool8 (*const sEscalatorWarpInFieldEffectFuncs[])(struct Task *) =
EscalatorWarpIn_End,
};
bool8 (*const sWaterfallFieldEffectFuncs[])(struct Task *, struct ObjectEvent *) =
static bool8 (*const sWaterfallFieldEffectFuncs[])(struct Task *, struct ObjectEvent *) =
{
WaterfallFieldEffect_Init,
WaterfallFieldEffect_ShowMon,
@@ -639,14 +639,14 @@ bool8 (*const sWaterfallFieldEffectFuncs[])(struct Task *, struct ObjectEvent *)
WaterfallFieldEffect_ContinueRideOrEnd,
};
bool8 (*const sDiveFieldEffectFuncs[])(struct Task *) =
static bool8 (*const sDiveFieldEffectFuncs[])(struct Task *) =
{
DiveFieldEffect_Init,
DiveFieldEffect_ShowMon,
DiveFieldEffect_TryWarp,
};
bool8 (*const sLavaridgeGymB1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) =
static bool8 (*const sLavaridgeGymB1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) =
{
LavaridgeGymB1FWarpEffect_Init,
LavaridgeGymB1FWarpEffect_CameraShake,
@@ -656,7 +656,7 @@ bool8 (*const sLavaridgeGymB1FWarpEffectFuncs[])(struct Task *, struct ObjectEve
LavaridgeGymB1FWarpEffect_Warp,
};
bool8 (*const sLavaridgeGymB1FWarpExitEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) =
static bool8 (*const sLavaridgeGymB1FWarpExitEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) =
{
LavaridgeGymB1FWarpExitEffect_Init,
LavaridgeGymB1FWarpExitEffect_StartPopOut,
@@ -664,7 +664,7 @@ bool8 (*const sLavaridgeGymB1FWarpExitEffectFuncs[])(struct Task *, struct Objec
LavaridgeGymB1FWarpExitEffect_End,
};
bool8 (*const sLavaridgeGym1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) =
static bool8 (*const sLavaridgeGym1FWarpEffectFuncs[])(struct Task *, struct ObjectEvent *, struct Sprite *) =
{
LavaridgeGym1FWarpEffect_Init,
LavaridgeGym1FWarpEffect_AshPuff,
@@ -673,7 +673,7 @@ bool8 (*const sLavaridgeGym1FWarpEffectFuncs[])(struct Task *, struct ObjectEven
LavaridgeGym1FWarpEffect_Warp,
};
void (*const sEscapeRopeWarpOutEffectFuncs[])(struct Task *) =
static void (*const sEscapeRopeWarpOutEffectFuncs[])(struct Task *) =
{
EscapeRopeWarpOutEffect_Init,
EscapeRopeWarpOutEffect_Spin,
@@ -2277,7 +2277,7 @@ static void EscapeRopeWarpOutEffect_Spin(struct Task *task)
}
}
void (*const sEscapeRopeWarpInEffectFuncs[])(struct Task *) = {
static void (*const sEscapeRopeWarpInEffectFuncs[])(struct Task *) = {
EscapeRopeWarpInEffect_Init,
EscapeRopeWarpInEffect_Spin
};
@@ -2448,7 +2448,7 @@ static void FieldCallback_TeleportWarpIn(void)
CreateTask(Task_TeleportWarpIn, 0);
}
void (*const sTeleportWarpInFieldEffectFuncs[])(struct Task *) = {
static void (*const sTeleportWarpInFieldEffectFuncs[])(struct Task *) = {
TeleportWarpInFieldEffect_Init,
TeleportWarpInFieldEffect_SpinEnter,
TeleportWarpInFieldEffect_SpinGround
@@ -2582,7 +2582,7 @@ bool8 FldEff_FieldMoveShowMonInit(void)
return FALSE;
}
void (*const sFieldMoveShowMonOutdoorsEffectFuncs[])(struct Task *) = {
static void (*const sFieldMoveShowMonOutdoorsEffectFuncs[])(struct Task *) = {
FieldMoveShowMonOutdoorsEffect_Init,
FieldMoveShowMonOutdoorsEffect_LoadGfx,
FieldMoveShowMonOutdoorsEffect_CreateBanner,
@@ -2750,7 +2750,7 @@ static void LoadFieldMoveOutdoorStreaksTilemap(u16 offs)
#define tBgOffset data[4]
#define tMonSpriteId data[15]
void (*const sFieldMoveShowMonIndoorsEffectFuncs[])(struct Task *) = {
static void (*const sFieldMoveShowMonIndoorsEffectFuncs[])(struct Task *) = {
FieldMoveShowMonIndoorsEffect_Init,
FieldMoveShowMonIndoorsEffect_LoadGfx,
FieldMoveShowMonIndoorsEffect_SlideBannerOn,
@@ -2978,7 +2978,7 @@ u8 FldEff_UseSurf(void)
return FALSE;
}
void (*const sSurfFieldEffectFuncs[])(struct Task *) = {
static void (*const sSurfFieldEffectFuncs[])(struct Task *) = {
SurfFieldEffect_Init,
SurfFieldEffect_FieldMovePose,
SurfFieldEffect_ShowMon,
@@ -3154,7 +3154,7 @@ u8 FldEff_UseFly(void)
return 0;
}
void (*const sFlyOutFieldEffectFuncs[])(struct Task *) = {
static void (*const sFlyOutFieldEffectFuncs[])(struct Task *) = {
FlyOutFieldEffect_FieldMovePose,
FlyOutFieldEffect_ShowMon,
FlyOutFieldEffect_BirdLeaveBall,
@@ -3444,7 +3444,7 @@ u8 FldEff_FlyIn(void)
return 0;
}
void (*const sFlyInFieldEffectFuncs[])(struct Task *) = {
static void (*const sFlyInFieldEffectFuncs[])(struct Task *) = {
FlyInFieldEffect_BirdSwoopDown,
FlyInFieldEffect_FlyInWithBird,
FlyInFieldEffect_JumpOffBird,
@@ -3675,7 +3675,7 @@ static void StartEndingDeoxysRockCameraShake(u8 taskId)
#undef tEndDelay
#undef tEnding
void (*const sDestroyDeoxysRockEffectFuncs[])(s16*, u8) = {
static void (*const sDestroyDeoxysRockEffectFuncs[])(s16*, u8) = {
DestroyDeoxysRockEffect_CameraShake,
DestroyDeoxysRockEffect_RockFragments,
DestroyDeoxysRockEffect_WaitAndEnd,
+1 -1
View File
@@ -33,7 +33,7 @@ static void Task_DrawFieldMessage(u8 taskId)
task->tState++;
break;
case 1:
DrawDialogueFrame(0, 1);
DrawDialogueFrame(0, TRUE);
task->tState++;
break;
case 2:
+1 -4
View File
@@ -192,10 +192,7 @@ static void FieldUpdateRegionMap(void)
{
FreeRegionMapIconResources();
SetMainCallback2(sFieldRegionMapHandler->callback);
if (sFieldRegionMapHandler != NULL)
{
FREE_AND_SET_NULL(sFieldRegionMapHandler);
}
TRY_FREE_AND_SET_NULL(sFieldRegionMapHandler);
FreeAllWindowBuffers();
}
break;
+1 -1
View File
@@ -53,7 +53,7 @@ static void Task_EnableScriptAfterMusicFade(u8 taskId);
static const u16 sFlashLevelToRadius[] = { 200, 72, 64, 56, 48, 40, 32, 24, 0 };
const s32 gMaxFlashLevel = ARRAY_COUNT(sFlashLevelToRadius) - 1;
const struct ScanlineEffectParams sFlashEffectParams =
static const struct ScanlineEffectParams sFlashEffectParams =
{
&REG_WIN0H,
((DMA_ENABLE | DMA_START_HBLANK | DMA_REPEAT | DMA_DEST_RELOAD) << 16) | 1,
+1 -1
View File
@@ -170,7 +170,7 @@ static void Task_Truck3(u8 taskId)
{
cameraXpan = sTruckCamera_HorizontalTable[tMoveStep];
cameraYpan = 0;
SetCameraPanning(cameraXpan, 0);
SetCameraPanning(cameraXpan, cameraYpan);
SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX1_X_OFFSET - cameraXpan, BOX1_Y_OFFSET + cameraYpan);
SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX2_X_OFFSET - cameraXpan, BOX2_Y_OFFSET + cameraYpan);
SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX3_X_OFFSET - cameraXpan, BOX3_Y_OFFSET + cameraYpan);
+1 -1
View File
@@ -72,7 +72,7 @@ static const u8 *sPaletteGammaTypes;
// The drought weather effect uses a precalculated color lookup table. Presumably this
// is because the underlying color shift calculation is slow.
const u16 sDroughtWeatherColors[][0x1000] = {
static const u16 sDroughtWeatherColors[][0x1000] = {
INCBIN_U16("graphics/weather/drought/colors_0.bin"),
INCBIN_U16("graphics/weather/drought/colors_1.bin"),
INCBIN_U16("graphics/weather/drought/colors_2.bin"),
+15 -15
View File
@@ -14,8 +14,8 @@
#include "trig.h"
#include "gpu_regs.h"
EWRAM_DATA static u8 gCurrentAbnormalWeather = 0;
EWRAM_DATA static u16 gUnusedWeatherRelated = 0;
EWRAM_DATA static u8 sCurrentAbnormalWeather = 0;
EWRAM_DATA static u16 sUnusedWeatherRelated = 0;
const u16 gCloudsWeatherPalette[] = INCBIN_U16("graphics/weather/cloud.gbapal");
const u16 gSandstormWeatherPalette[] = INCBIN_U16("graphics/weather/sandstorm.gbapal");
@@ -1813,7 +1813,7 @@ static void UpdateFogDiagonalMovement(void)
gWeatherPtr->fogDPosY = gSpriteCoordOffsetY + gWeatherPtr->fogDYOffset;
}
static const struct SpriteSheet gFogDiagonalSpriteSheet =
static const struct SpriteSheet sFogDiagonalSpriteSheet =
{
.data = gWeatherFogDiagonalTiles,
.size = sizeof(gWeatherFogDiagonalTiles),
@@ -1868,7 +1868,7 @@ static void CreateFogDiagonalSprites(void)
if (!gWeatherPtr->fogDSpritesCreated)
{
fogDiagonalSpriteSheet = gFogDiagonalSpriteSheet;
fogDiagonalSpriteSheet = sFogDiagonalSpriteSheet;
LoadSpriteSheet(&fogDiagonalSpriteSheet);
for (i = 0; i < NUM_FOG_DIAGONAL_SPRITES; i++)
{
@@ -2427,8 +2427,8 @@ static void UpdateBubbleSprite(struct Sprite *sprite)
// Unused function.
static void UnusedSetCurrentAbnormalWeather(u32 weather, u32 unknown)
{
gCurrentAbnormalWeather = weather;
gUnusedWeatherRelated = unknown;
sCurrentAbnormalWeather = weather;
sUnusedWeatherRelated = unknown;
}
#define tState data[0]
@@ -2446,7 +2446,7 @@ static void Task_DoAbnormalWeather(u8 taskId)
if (tDelay-- <= 0)
{
SetNextWeather(tWeatherA);
gCurrentAbnormalWeather = tWeatherA;
sCurrentAbnormalWeather = tWeatherA;
tDelay = 600;
tState++;
}
@@ -2455,7 +2455,7 @@ static void Task_DoAbnormalWeather(u8 taskId)
if (tDelay-- <= 0)
{
SetNextWeather(tWeatherB);
gCurrentAbnormalWeather = tWeatherB;
sCurrentAbnormalWeather = tWeatherB;
tDelay = 600;
tState = 0;
}
@@ -2469,13 +2469,13 @@ static void CreateAbnormalWeatherTask(void)
s16 *data = gTasks[taskId].data;
tDelay = 600;
if (gCurrentAbnormalWeather == WEATHER_DOWNPOUR)
if (sCurrentAbnormalWeather == WEATHER_DOWNPOUR)
{
// Currently Downpour, next will be Drought
tWeatherA = WEATHER_DROUGHT;
tWeatherB = WEATHER_DOWNPOUR;
}
else if (gCurrentAbnormalWeather == WEATHER_DROUGHT)
else if (sCurrentAbnormalWeather == WEATHER_DROUGHT)
{
// Currently Drought, next will be Downpour
tWeatherA = WEATHER_DOWNPOUR;
@@ -2484,7 +2484,7 @@ static void CreateAbnormalWeatherTask(void)
else
{
// Default to starting with Downpour
gCurrentAbnormalWeather = WEATHER_DOWNPOUR;
sCurrentAbnormalWeather = WEATHER_DOWNPOUR;
tWeatherA = WEATHER_DROUGHT;
tWeatherB = WEATHER_DOWNPOUR;
}
@@ -2537,13 +2537,13 @@ void DoCurrentWeather(void)
{
if (!FuncIsActiveTask(Task_DoAbnormalWeather))
CreateAbnormalWeatherTask();
weather = gCurrentAbnormalWeather;
weather = sCurrentAbnormalWeather;
}
else
{
if (FuncIsActiveTask(Task_DoAbnormalWeather))
DestroyTask(FindTaskIdByFunc(Task_DoAbnormalWeather));
gCurrentAbnormalWeather = WEATHER_DOWNPOUR;
sCurrentAbnormalWeather = WEATHER_DOWNPOUR;
}
SetNextWeather(weather);
}
@@ -2556,13 +2556,13 @@ void ResumePausedWeather(void)
{
if (!FuncIsActiveTask(Task_DoAbnormalWeather))
CreateAbnormalWeatherTask();
weather = gCurrentAbnormalWeather;
weather = sCurrentAbnormalWeather;
}
else
{
if (FuncIsActiveTask(Task_DoAbnormalWeather))
DestroyTask(FindTaskIdByFunc(Task_DoAbnormalWeather));
gCurrentAbnormalWeather = WEATHER_DOWNPOUR;
sCurrentAbnormalWeather = WEATHER_DOWNPOUR;
}
SetCurrentAndNextWeather(weather);
}
+21 -21
View File
@@ -25,10 +25,10 @@ struct ConnectionFlags
u8 east:1;
};
EWRAM_DATA static u16 gBackupMapData[MAX_MAP_DATA_SIZE] = {0};
EWRAM_DATA static u16 sBackupMapData[MAX_MAP_DATA_SIZE] = {0};
EWRAM_DATA struct MapHeader gMapHeader = {0};
EWRAM_DATA struct Camera gCamera = {0};
EWRAM_DATA static struct ConnectionFlags gMapConnectionFlags = {0};
EWRAM_DATA static struct ConnectionFlags sMapConnectionFlags = {0};
EWRAM_DATA static u32 sFiller = 0; // without this, the next file won't align properly
struct BackupMapLayout gBackupMapLayout;
@@ -87,14 +87,14 @@ void InitMapFromSavedGame(void)
void InitBattlePyramidMap(bool8 setPlayerPosition)
{
CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, gBackupMapData, sizeof(gBackupMapData));
GenerateBattlePyramidFloorLayout(gBackupMapData, setPlayerPosition);
CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData));
GenerateBattlePyramidFloorLayout(sBackupMapData, setPlayerPosition);
}
void InitTrainerHillMap(void)
{
CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, gBackupMapData, sizeof(gBackupMapData));
GenerateTrainerHillFloorLayout(gBackupMapData);
CpuFastFill(MAPGRID_UNDEFINED << 16 | MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData));
GenerateTrainerHillFloorLayout(sBackupMapData);
}
static void InitMapLayoutData(struct MapHeader *mapHeader)
@@ -103,8 +103,8 @@ static void InitMapLayoutData(struct MapHeader *mapHeader)
int width;
int height;
mapLayout = mapHeader->mapLayout;
CpuFastFill16(MAPGRID_UNDEFINED, gBackupMapData, sizeof(gBackupMapData));
gBackupMapLayout.map = gBackupMapData;
CpuFastFill16(MAPGRID_UNDEFINED, sBackupMapData, sizeof(sBackupMapData));
gBackupMapLayout.map = sBackupMapData;
width = mapLayout->width + MAP_OFFSET_W;
gBackupMapLayout.width = width;
height = mapLayout->height + MAP_OFFSET_H;
@@ -140,7 +140,7 @@ static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader)
{
count = mapHeader->connections->count;
connection = mapHeader->connections->connections;
gMapConnectionFlags = sDummyConnectionFlags;
sMapConnectionFlags = sDummyConnectionFlags;
for (i = 0; i < count; i++, connection++)
{
struct MapHeader const *cMap = GetMapHeaderFromConnection(connection);
@@ -149,19 +149,19 @@ static void InitBackupMapLayoutConnections(struct MapHeader *mapHeader)
{
case CONNECTION_SOUTH:
FillSouthConnection(mapHeader, cMap, offset);
gMapConnectionFlags.south = TRUE;
sMapConnectionFlags.south = TRUE;
break;
case CONNECTION_NORTH:
FillNorthConnection(mapHeader, cMap, offset);
gMapConnectionFlags.north = TRUE;
sMapConnectionFlags.north = TRUE;
break;
case CONNECTION_WEST:
FillWestConnection(mapHeader, cMap, offset);
gMapConnectionFlags.west = TRUE;
sMapConnectionFlags.west = TRUE;
break;
case CONNECTION_EAST:
FillEastConnection(mapHeader, cMap, offset);
gMapConnectionFlags.east = TRUE;
sMapConnectionFlags.east = TRUE;
break;
}
}
@@ -436,7 +436,7 @@ void SaveMapView(void)
for (i = y; i < y + MAP_OFFSET_H; i++)
{
for (j = x; j < x + MAP_OFFSET_W; j++)
*mapView++ = gBackupMapData[width * i + j];
*mapView++ = sBackupMapData[width * i + j];
}
}
@@ -491,8 +491,8 @@ static void LoadSavedMapView(void)
for (j = x; j < x + MAP_OFFSET_W; j++)
{
if (!SkipCopyingMetatileFromSavedMap(&gBackupMapData[j + width * i], width, yMode))
gBackupMapData[j + width * i] = *mapView;
if (!SkipCopyingMetatileFromSavedMap(&sBackupMapData[j + width * i], width, yMode))
sBackupMapData[j + width * i] = *mapView;
mapView++;
}
}
@@ -554,7 +554,7 @@ static void MoveMapViewToBackup(u8 direction)
desti = width * (y + y0);
srci = (y + r8) * MAP_OFFSET_W + r9;
src = &mapView[srci + i];
dest = &gBackupMapData[x0 + desti + j];
dest = &sBackupMapData[x0 + desti + j];
*dest = *src;
i++;
j++;
@@ -570,28 +570,28 @@ int GetMapBorderIdAt(int x, int y)
if (x >= (gBackupMapLayout.width - (MAP_OFFSET + 1)))
{
if (!gMapConnectionFlags.east)
if (!sMapConnectionFlags.east)
return CONNECTION_INVALID;
return CONNECTION_EAST;
}
else if (x < MAP_OFFSET)
{
if (!gMapConnectionFlags.west)
if (!sMapConnectionFlags.west)
return CONNECTION_INVALID;
return CONNECTION_WEST;
}
else if (y >= (gBackupMapLayout.height - MAP_OFFSET))
{
if (!gMapConnectionFlags.south)
if (!sMapConnectionFlags.south)
return CONNECTION_INVALID;
return CONNECTION_SOUTH;
}
else if (y < MAP_OFFSET)
{
if (!gMapConnectionFlags.north)
if (!sMapConnectionFlags.north)
return CONNECTION_INVALID;
return CONNECTION_NORTH;
+11 -15
View File
@@ -52,6 +52,8 @@ struct HallofFameTeam
struct HallofFameMon mon[PARTY_SIZE];
};
STATIC_ASSERT(sizeof(struct HallofFameTeam) * HALL_OF_FAME_MAX_TEAMS <= SECTOR_DATA_SIZE * NUM_HOF_SECTORS, HallOfFameFreeSpace);
struct HofGfx
{
u16 state;
@@ -512,7 +514,7 @@ static void Task_Hof_InitTeamSaveData(u8 taskId)
}
*lastSavedTeam = *sHofMonPtr;
DrawDialogueFrame(0, 0);
DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized2(0, FONT_NORMAL, gText_SavingDontTurnOffPower, 0, NULL, 2, 1, 3);
CopyWindowToVram(0, COPYWIN_FULL);
gTasks[taskId].func = Task_Hof_TrySaveData;
@@ -527,10 +529,8 @@ static void Task_Hof_TrySaveData(u8 taskId)
UnsetBgTilemapBuffer(3);
FreeAllWindowBuffers();
if (sHofGfxPtr != NULL)
FREE_AND_SET_NULL(sHofGfxPtr);
if (sHofMonPtr != NULL)
FREE_AND_SET_NULL(sHofMonPtr);
TRY_FREE_AND_SET_NULL(sHofGfxPtr);
TRY_FREE_AND_SET_NULL(sHofMonPtr);
DestroyTask(taskId);
}
@@ -722,7 +722,7 @@ static void Task_Hof_WaitAndPrintPlayerInfo(u8 taskId)
{
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20);
HallOfFame_PrintPlayerInfo(1, 2);
DrawDialogueFrame(0, 0);
DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized2(0, FONT_NORMAL, gText_LeagueChamp, 0, NULL, 2, 1, 3);
CopyWindowToVram(0, COPYWIN_FULL);
gTasks[taskId].func = Task_Hof_ExitOnKeyPressed;
@@ -771,10 +771,8 @@ static void Task_Hof_HandleExit(u8 taskId)
ResetBgsAndClearDma3BusyFlags(0);
DestroyTask(taskId);
if (sHofGfxPtr != NULL)
FREE_AND_SET_NULL(sHofGfxPtr);
if (sHofMonPtr != NULL)
FREE_AND_SET_NULL(sHofMonPtr);
TRY_FREE_AND_SET_NULL(sHofGfxPtr);
TRY_FREE_AND_SET_NULL(sHofMonPtr);
StartCredits();
}
@@ -1079,10 +1077,8 @@ static void Task_HofPC_HandleExit(u8 taskId)
ResetBgsAndClearDma3BusyFlags(0);
DestroyTask(taskId);
if (sHofGfxPtr != NULL)
FREE_AND_SET_NULL(sHofGfxPtr);
if (sHofMonPtr != NULL)
FREE_AND_SET_NULL(sHofMonPtr);
TRY_FREE_AND_SET_NULL(sHofGfxPtr);
TRY_FREE_AND_SET_NULL(sHofMonPtr);
ReturnFromHallOfFamePC();
}
@@ -1091,7 +1087,7 @@ static void Task_HofPC_HandleExit(u8 taskId)
static void Task_HofPC_PrintDataIsCorrupted(u8 taskId)
{
HofPCTopBar_Print(gText_AButtonExit, 8, TRUE);
DrawDialogueFrame(0, 0);
DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized2(0, FONT_NORMAL, gText_HOFCorrupted, 0, NULL, 2, 1, 3);
CopyWindowToVram(0, COPYWIN_FULL);
gTasks[taskId].func = Task_HofPC_ExitOnButtonPress;
+2 -2
View File
@@ -1848,7 +1848,7 @@ static void Task_Scene3_StartGroudon(u8 taskId)
{
gTasks[taskId].tState = 0;
gTasks[taskId].func = Task_Scene3_Groudon;
ScanlineEffect_InitWave(0, 160, 4, 4, 1, SCANLINE_EFFECT_REG_BG1HOFS, 0);
ScanlineEffect_InitWave(0, 160, 4, 4, 1, SCANLINE_EFFECT_REG_BG1HOFS, FALSE);
}
#define tScreenX data[1]
@@ -2058,7 +2058,7 @@ static void Task_Scene3_LoadKyogre(u8 taskId)
gTasks[taskId].tDelay = 16;
gTasks[taskId].tZoom = 256;
PanFadeAndZoomScreen(gTasks[taskId].tScreenX, gTasks[taskId].tScreenY, gTasks[taskId].tZoom, 0);
ScanlineEffect_InitWave(0, 0xA0, 4, 4, 1, SCANLINE_EFFECT_REG_BG1VOFS, 0);
ScanlineEffect_InitWave(0, 0xA0, 4, 4, 1, SCANLINE_EFFECT_REG_BG1VOFS, FALSE);
}
static void Task_Scene3_Kyogre(u8 taskId)
+1 -1
View File
@@ -1344,7 +1344,7 @@ static void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, bool16 skipEraseLis
DrawPocketIndicatorSquare(newPocket, TRUE);
FillBgTilemapBufferRect_Palette0(2, 11, 14, 2, 15, 16);
ScheduleBgCopyTilemapToVram(2);
SetBagVisualPocketId(newPocket, 1);
SetBagVisualPocketId(newPocket, TRUE);
RemoveBagSprite(ITEMMENUSPRITE_BALL);
AddSwitchPocketRotatingBallSprite(deltaBagPocketId);
SetTaskFuncWithFollowupFunc(taskId, Task_SwitchBagPocket, gTasks[taskId].func);
+8 -8
View File
@@ -35,8 +35,8 @@ static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite);
// static const rom data
static const u16 sRotatingBall_Pal[] = INCBIN_U16("graphics/bag/rotating_ball.gbapal");
static const u8 sRotatingBall_Gfx[] = INCBIN_U8("graphics/bag/rotating_ball.4bpp");
static const u8 gCherryUnused[] = INCBIN_U8("graphics/unused/cherry.4bpp");
static const u16 gCherryUnused_Pal[] = INCBIN_U16("graphics/unused/cherry.gbapal");
static const u8 sCherryUnused[] = INCBIN_U8("graphics/unused/cherry.4bpp");
static const u16 sCherryUnused_Pal[] = INCBIN_U16("graphics/unused/cherry.gbapal");
static const struct OamData sBagOamData =
{
@@ -269,7 +269,7 @@ static const struct SpriteFrameImage sBerryPicSpriteImageTable[] =
{&gDecompressionBuffer[0], 0x800},
};
static const struct SpriteTemplate gBerryPicSpriteTemplate =
static const struct SpriteTemplate sBerryPicSpriteTemplate =
{
.tileTag = TAG_NONE,
.paletteTag = TAG_BERRY_PIC_PAL,
@@ -308,7 +308,7 @@ static const union AffineAnimCmd *const sBerryPicRotatingAnimCmds[] =
sSpriteAffineAnim_BerryPicRotation2
};
static const struct SpriteTemplate gBerryPicRotatingSpriteTemplate =
static const struct SpriteTemplate sBerryPicRotatingSpriteTemplate =
{
.tileTag = TAG_NONE,
.paletteTag = TAG_BERRY_PIC_PAL,
@@ -404,7 +404,7 @@ static const union AnimCmd *const sBerryCheckCircleSpriteAnimTable[] =
sSpriteAnim_BerryCheckCircle
};
static const struct SpriteTemplate gBerryCheckCircleSpriteTemplate =
static const struct SpriteTemplate sBerryCheckCircleSpriteTemplate =
{
.tileTag = TAG_BERRY_CHECK_CIRCLE_GFX,
.paletteTag = TAG_BERRY_CHECK_CIRCLE_GFX,
@@ -609,7 +609,7 @@ static void LoadBerryGfx(u8 berryId)
u8 CreateBerryTagSprite(u8 id, s16 x, s16 y)
{
LoadBerryGfx(id);
return CreateSprite(&gBerryPicSpriteTemplate, x, y, 0);
return CreateSprite(&sBerryPicSpriteTemplate, x, y, 0);
}
void FreeBerryTagSpritePalette(void)
@@ -624,7 +624,7 @@ u8 CreateSpinningBerrySprite(u8 berryId, u8 x, u8 y, bool8 startAffine)
FreeSpritePaletteByTag(TAG_BERRY_PIC_PAL);
LoadBerryGfx(berryId);
spriteId = CreateSprite(&gBerryPicRotatingSpriteTemplate, x, y, 0);
spriteId = CreateSprite(&sBerryPicRotatingSpriteTemplate, x, y, 0);
if (startAffine == TRUE)
StartSpriteAffineAnim(&gSprites[spriteId], 1);
@@ -633,5 +633,5 @@ u8 CreateSpinningBerrySprite(u8 berryId, u8 x, u8 y, bool8 startAffine)
u8 CreateBerryFlavorCircleSprite(s16 x)
{
return CreateSprite(&gBerryCheckCircleSpriteTemplate, x, 116, 0);
return CreateSprite(&sBerryCheckCircleSpriteTemplate, x, 116, 0);
}
+8 -8
View File
@@ -336,7 +336,7 @@ static const struct Landmark *const Landmarks_MtChimney_2[] =
NULL,
};
static const struct LandmarkList gLandmarkLists[] =
static const struct LandmarkList sLandmarkLists[] =
{
{MAPSEC_ROUTE_103, 2, Landmarks_Route103_2},
{MAPSEC_ROUTE_104, 0, Landmarks_Route104_0},
@@ -420,21 +420,21 @@ static const struct Landmark *const *GetLandmarks(u8 mapSection, u8 id)
{
u16 i = 0;
for (; gLandmarkLists[i].mapSection != MAPSEC_NONE; i++)
for (; sLandmarkLists[i].mapSection != MAPSEC_NONE; i++)
{
if (gLandmarkLists[i].mapSection > mapSection)
if (sLandmarkLists[i].mapSection > mapSection)
return NULL;
if (gLandmarkLists[i].mapSection == mapSection)
if (sLandmarkLists[i].mapSection == mapSection)
break;
}
if (gLandmarkLists[i].mapSection == MAPSEC_NONE)
if (sLandmarkLists[i].mapSection == MAPSEC_NONE)
return NULL;
for (; gLandmarkLists[i].mapSection == mapSection; i++)
for (; sLandmarkLists[i].mapSection == mapSection; i++)
{
if (gLandmarkLists[i].id == id)
return gLandmarkLists[i].landmarks;
if (sLandmarkLists[i].id == id)
return sLandmarkLists[i].landmarks;
}
return NULL;
+4 -4
View File
@@ -680,7 +680,7 @@ SoundMainRAM_Unk2:
ldr r1, [r4, o_SoundChannel_wav]
add r2, r2, r1
add r2, r2, 0x10
ldr r5, =gDecodingBuffer
ldr r5, =sDecodingBuffer
ldr r6, =gDeltaEncodingTable
mov r7, 0x40
ldrb lr, [r2], 1
@@ -701,7 +701,7 @@ _081DD57C:
subs r7, r7, 2
bgt _081DD568
_081DD594:
ldr r5, =gDecodingBuffer
ldr r5, =sDecodingBuffer
and r0, r3, 0x3F
ldrsb r1, [r5, r0]
pop {r0,r2,r5-r7,pc}
@@ -1911,6 +1911,6 @@ _081DDD90:
.align 2, 0 @ Don't pad with nop.
.bss
gDecodingBuffer: @ Used as a buffer for audio decoded from compressed DPCM
sDecodingBuffer: @ Used as a buffer for audio decoded from compressed DPCM
.space 0x40
.size gDecodingBuffer, .-gDecodingBuffer
.size sDecodingBuffer, .-sDecodingBuffer
+3 -3
View File
@@ -69,7 +69,7 @@ u8 gLinkVSyncDisabled;
u32 IntrMain_Buffer[0x200];
s8 gPcmDmaCounter;
static EWRAM_DATA u16 gTrainerId = 0;
static EWRAM_DATA u16 sTrainerId = 0;
//EWRAM_DATA void (**gFlashTimerIntrFunc)(void) = NULL;
@@ -201,12 +201,12 @@ void SeedRngAndSetTrainerId(void)
u16 val = REG_TM1CNT_L;
SeedRng(val);
REG_TM1CNT_H = 0;
gTrainerId = val;
sTrainerId = val;
}
u16 GetGeneratedTrainerIdLower(void)
{
return gTrainerId;
return sTrainerId;
}
void EnableVCountIntrAtLine150(void)
+8 -8
View File
@@ -371,7 +371,7 @@ static const struct WindowTemplate sWindowTemplates_MainMenu[] =
DUMMY_WIN_TEMPLATE
};
static const struct WindowTemplate gNewGameBirchSpeechTextWindows[] =
static const struct WindowTemplate sNewGameBirchSpeechTextWindows[] =
{
{
.bg = 0,
@@ -457,7 +457,7 @@ static const struct MenuAction sMenuActions_Gender[] = {
{gText_BirchGirl, NULL}
};
static const u8 *const gMalePresetNames[] = {
static const u8 *const sMalePresetNames[] = {
gText_DefaultNameStu,
gText_DefaultNameMilton,
gText_DefaultNameTom,
@@ -480,7 +480,7 @@ static const u8 *const gMalePresetNames[] = {
gText_DefaultNameQuincy
};
static const u8 *const gFemalePresetNames[] = {
static const u8 *const sFemalePresetNames[] = {
gText_DefaultNameKimmy,
gText_DefaultNameTiara,
gText_DefaultNameBella,
@@ -1325,7 +1325,7 @@ static void Task_NewGameBirchSpeech_WaitForSpriteFadeInWelcome(u8 taskId)
}
else
{
InitWindows(gNewGameBirchSpeechTextWindows);
InitWindows(sNewGameBirchSpeechTextWindows);
LoadMainMenuWindowFrameTiles(0, 0xF3);
LoadMessageBoxGfx(0, 0xFC, 0xF0);
NewGameBirchSpeech_ShowDialogueWindow(0, 1);
@@ -1851,7 +1851,7 @@ static void CB2_NewGameBirchSpeech_ReturnFromNamingScreen(void)
REG_IME = savedIme;
SetVBlankCallback(VBlankCB_MainMenu);
SetMainCallback2(CB2_MainMenu);
InitWindows(gNewGameBirchSpeechTextWindows);
InitWindows(sNewGameBirchSpeechTextWindows);
LoadMainMenuWindowFrameTiles(0, 0xF3);
LoadMessageBoxGfx(0, 0xFC, 0xF0);
PutWindowTilemap(0);
@@ -2087,7 +2087,7 @@ static void NewGameBirchSpeech_StartFadePlatformOut(u8 taskId, u8 delay)
static void NewGameBirchSpeech_ShowGenderMenu(void)
{
DrawMainMenuWindowBorder(&gNewGameBirchSpeechTextWindows[1], 0xF3);
DrawMainMenuWindowBorder(&sNewGameBirchSpeechTextWindows[1], 0xF3);
FillWindowPixelBuffer(1, PIXEL_FILL(1));
PrintMenuTable(1, ARRAY_COUNT(sMenuActions_Gender), sMenuActions_Gender);
InitMenuInUpperLeftCornerNormal(1, ARRAY_COUNT(sMenuActions_Gender), 0);
@@ -2106,9 +2106,9 @@ static void NewGameBirchSpeech_SetDefaultPlayerName(u8 nameId)
u8 i;
if (gSaveBlock2Ptr->playerGender == MALE)
name = gMalePresetNames[nameId];
name = sMalePresetNames[nameId];
else
name = gFemalePresetNames[nameId];
name = sFemalePresetNames[nameId];
for (i = 0; i < PLAYER_NAME_LENGTH; i++)
gSaveBlock2Ptr->playerName[i] = name[i];
gSaveBlock2Ptr->playerName[PLAYER_NAME_LENGTH] = EOS;
+19 -19
View File
@@ -176,25 +176,25 @@ static const u8 sRegionMapSectionId_To_PopUpThemeIdMapping[] =
[MAPSEC_TRAINER_HILL - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_MARBLE
};
static const u8 gText_PyramidFloor1[] = _("PYRAMID FLOOR 1");
static const u8 gText_PyramidFloor2[] = _("PYRAMID FLOOR 2");
static const u8 gText_PyramidFloor3[] = _("PYRAMID FLOOR 3");
static const u8 gText_PyramidFloor4[] = _("PYRAMID FLOOR 4");
static const u8 gText_PyramidFloor5[] = _("PYRAMID FLOOR 5");
static const u8 gText_PyramidFloor6[] = _("PYRAMID FLOOR 6");
static const u8 gText_PyramidFloor7[] = _("PYRAMID FLOOR 7");
static const u8 gText_Pyramid[] = _("PYRAMID");
static const u8 sText_PyramidFloor1[] = _("PYRAMID FLOOR 1");
static const u8 sText_PyramidFloor2[] = _("PYRAMID FLOOR 2");
static const u8 sText_PyramidFloor3[] = _("PYRAMID FLOOR 3");
static const u8 sText_PyramidFloor4[] = _("PYRAMID FLOOR 4");
static const u8 sText_PyramidFloor5[] = _("PYRAMID FLOOR 5");
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 gBattlePyramid_MapHeaderStrings[] =
static const u8 * const sBattlePyramid_MapHeaderStrings[] =
{
gText_PyramidFloor1,
gText_PyramidFloor2,
gText_PyramidFloor3,
gText_PyramidFloor4,
gText_PyramidFloor5,
gText_PyramidFloor6,
gText_PyramidFloor7,
gText_Pyramid,
sText_PyramidFloor1,
sText_PyramidFloor2,
sText_PyramidFloor3,
sText_PyramidFloor4,
sText_PyramidFloor5,
sText_PyramidFloor6,
sText_PyramidFloor7,
sText_Pyramid,
};
// Unused
@@ -309,12 +309,12 @@ static void ShowMapNamePopUpWindow(void)
if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_TOP)
{
withoutPrefixPtr = &(mapDisplayHeader[3]);
mapDisplayHeaderSource = gBattlePyramid_MapHeaderStrings[7];
mapDisplayHeaderSource = sBattlePyramid_MapHeaderStrings[7];
}
else
{
withoutPrefixPtr = &(mapDisplayHeader[3]);
mapDisplayHeaderSource = gBattlePyramid_MapHeaderStrings[gSaveBlock2Ptr->frontier.curChallengeBattleNum];
mapDisplayHeaderSource = sBattlePyramid_MapHeaderStrings[gSaveBlock2Ptr->frontier.curChallengeBattleNum];
}
StringCopy(withoutPrefixPtr, mapDisplayHeaderSource);
}
+1 -1
View File
@@ -445,7 +445,7 @@ static void DisableTextPrinters(struct TextPrinterTemplate * printer, u16 render
static void DrawSongTextWindow(const u8 * str)
{
DrawDialogueFrame(0, 0);
DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized(0, FONT_NORMAL, str, 0, 1, 1, DisableTextPrinters);
gDisableTextPrinters = TRUE;
CopyWindowToVram(0, COPYWIN_FULL);
+1 -2
View File
@@ -44,8 +44,7 @@ u32 MysteryGiftClient_Run(u16 * endVal)
{
*endVal = sClient->param;
MysteryGiftClient_Free(sClient);
Free(sClient);
sClient = NULL;
FREE_AND_SET_NULL(sClient);
}
return result;
}
+1 -2
View File
@@ -44,8 +44,7 @@ u32 MysterGiftServer_Run(u16 * endVal)
{
*endVal = sServer->param;
MysteryGiftServer_Free(sServer);
Free(sServer);
sServer = NULL;
FREE_AND_SET_NULL(sServer);
}
return result;
}
+2 -4
View File
@@ -207,8 +207,7 @@ void WonderCard_Destroy(void)
if (sWonderCardData != NULL)
{
*sWonderCardData = (struct WonderCardData){};
Free(sWonderCardData);
sWonderCardData = NULL;
FREE_AND_SET_NULL(sWonderCardData);
}
}
@@ -660,8 +659,7 @@ void WonderNews_Destroy(void)
if (sWonderNewsData != NULL)
{
*sWonderNewsData = (struct WonderNewsData){};
Free(sWonderNewsData);
sWonderNewsData = NULL;
FREE_AND_SET_NULL(sWonderNewsData);
}
}
+7 -7
View File
@@ -318,7 +318,7 @@ static u8 MovementEventModeCB_Normal(struct LinkPlayerObjectEvent *, struct Obje
static u8 MovementEventModeCB_Ignored(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8);
static u8 MovementEventModeCB_Scripted(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8);
static u8 (*const gLinkPlayerMovementModes[])(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8) =
static u8 (*const sLinkPlayerMovementModes[])(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8) =
{
[MOVEMENT_MODE_FREE] = MovementEventModeCB_Normal,
[MOVEMENT_MODE_FROZEN] = MovementEventModeCB_Ignored,
@@ -330,7 +330,7 @@ static u8 FacingHandler_DpadMovement(struct LinkPlayerObjectEvent *, struct Obje
static u8 FacingHandler_ForcedFacingChange(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8);
// These handlers return TRUE if the movement was scripted and successful, and FALSE otherwise.
static bool8 (*const gLinkPlayerFacingHandlers[])(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8) =
static bool8 (*const sLinkPlayerFacingHandlers[])(struct LinkPlayerObjectEvent *, struct ObjectEvent *, u8) =
{
FacingHandler_DoNothing,
FacingHandler_DpadMovement,
@@ -349,7 +349,7 @@ static void MovementStatusHandler_EnterFreeMode(struct LinkPlayerObjectEvent *,
static void MovementStatusHandler_TryAdvanceScript(struct LinkPlayerObjectEvent *, struct ObjectEvent *);
// These handlers are run after an attempted movement.
static void (*const gMovementStatusHandler[])(struct LinkPlayerObjectEvent *, struct ObjectEvent *) =
static void (*const sMovementStatusHandler[])(struct LinkPlayerObjectEvent *, struct ObjectEvent *) =
{
// FALSE:
MovementStatusHandler_EnterFreeMode,
@@ -3048,9 +3048,9 @@ static void SetPlayerFacingDirection(u8 linkPlayerId, u8 facing)
{
// This is a hack to split this code onto two separate lines, without declaring a local variable.
// C++ style inline variables would be nice here.
#define TEMP gLinkPlayerMovementModes[linkPlayerObjEvent->movementMode](linkPlayerObjEvent, objEvent, facing)
#define TEMP sLinkPlayerMovementModes[linkPlayerObjEvent->movementMode](linkPlayerObjEvent, objEvent, facing)
gMovementStatusHandler[TEMP](linkPlayerObjEvent, objEvent);
sMovementStatusHandler[TEMP](linkPlayerObjEvent, objEvent);
// Clean up the hack.
#undef TEMP
@@ -3061,7 +3061,7 @@ static void SetPlayerFacingDirection(u8 linkPlayerId, u8 facing)
static u8 MovementEventModeCB_Normal(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent, u8 dir)
{
return gLinkPlayerFacingHandlers[dir](linkPlayerObjEvent, objEvent, dir);
return sLinkPlayerFacingHandlers[dir](linkPlayerObjEvent, objEvent, dir);
}
static u8 MovementEventModeCB_Ignored(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent, u8 dir)
@@ -3072,7 +3072,7 @@ static u8 MovementEventModeCB_Ignored(struct LinkPlayerObjectEvent *linkPlayerOb
// Identical to MovementEventModeCB_Normal
static u8 MovementEventModeCB_Scripted(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent, u8 dir)
{
return gLinkPlayerFacingHandlers[dir](linkPlayerObjEvent, objEvent, dir);
return sLinkPlayerFacingHandlers[dir](linkPlayerObjEvent, objEvent, dir);
}
static bool8 FacingHandler_DoNothing(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent, u8 dir)
+3 -3
View File
@@ -60,13 +60,13 @@ static void Task_BlendPalettesGradually(u8 taskId);
// unaligned word reads are issued in BlendPalette otherwise
ALIGNED(4) EWRAM_DATA u16 gPlttBufferUnfaded[PLTT_BUFFER_SIZE] = {0};
ALIGNED(4) EWRAM_DATA u16 gPlttBufferFaded[PLTT_BUFFER_SIZE] = {0};
EWRAM_DATA struct PaletteStruct sPaletteStructs[NUM_PALETTE_STRUCTS] = {0};
static EWRAM_DATA struct PaletteStruct sPaletteStructs[NUM_PALETTE_STRUCTS] = {0};
EWRAM_DATA struct PaletteFadeControl gPaletteFade = {0};
static EWRAM_DATA u32 sFiller = 0;
static EWRAM_DATA u32 sPlttBufferTransferPending = 0;
EWRAM_DATA u8 gPaletteDecompressionBuffer[PLTT_DECOMP_BUFFER_SIZE] = {0};
static const struct PaletteStructTemplate gDummyPaletteStructTemplate = {
static const struct PaletteStructTemplate sDummyPaletteStructTemplate = {
.id = 0xFFFF,
.state = 1
};
@@ -352,7 +352,7 @@ void PaletteStruct_ResetById(u16 id)
static void PaletteStruct_Reset(u8 paletteNum)
{
sPaletteStructs[paletteNum].template = &gDummyPaletteStructTemplate;
sPaletteStructs[paletteNum].template = &sDummyPaletteStructTemplate;
sPaletteStructs[paletteNum].active = FALSE;
sPaletteStructs[paletteNum].baseDestOffset = 0;
sPaletteStructs[paletteNum].destOffset = 0;
+1 -1
View File
@@ -4969,7 +4969,7 @@ static void Task_TryLearnNewMoves(u8 taskId)
{
u16 learnMove;
if (WaitFanfare(0) && ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON))))
if (WaitFanfare(FALSE) && ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON))))
{
RemoveLevelUpStatsWindow();
learnMove = MonTryLearningNewMove(&gPlayerParty[gPartyMenu.slotId], TRUE);
+3 -3
View File
@@ -518,7 +518,7 @@ static void InitItemStorageMenu(u8 taskId, u8 var)
static void ItemStorageMenuPrint(const u8 *textPtr)
{
DrawDialogueFrame(0, 0);
DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized(0, FONT_NORMAL, textPtr, 0, 1, 0, 0);
}
@@ -572,7 +572,7 @@ void CB2_PlayerPCExitBagMenu(void)
static void ItemStorage_ReshowAfterBagMenu(void)
{
LoadMessageBoxAndBorderGfx();
DrawDialogueFrame(0, 1);
DrawDialogueFrame(0, TRUE);
InitItemStorageMenu(CreateTask(ItemStorage_HandleReturnToProcessInput, 0), 1);
FadeInFromBlack();
}
@@ -1241,7 +1241,7 @@ static void ItemStorage_ReturnToMenuSelect(u8 taskId)
s16 *data = gTasks[taskId].data;
if (!IsDma3ManagerBusyWithBgCopy())
{
DrawDialogueFrame(0, 0);
DrawDialogueFrame(0, FALSE);
// Select Withdraw/Toss by default depending on which was just exited
if (!tInTossMenu)
+2 -2
View File
@@ -840,7 +840,7 @@ static const u8 sText_No000[] = _("{NO}000");
static const u8 sCaughtBall_Gfx[] = INCBIN_U8("graphics/pokedex/caught_ball.4bpp");
static const u8 sText_TenDashes[] = _("----------");
ALIGNED(4) static const u8 gExpandedPlaceholder_PokedexDescription[] = _("");
ALIGNED(4) static const u8 sExpandedPlaceholder_PokedexDescription[] = _("");
#include "data/pokemon/pokedex_text.h"
#include "data/pokemon/pokedex_entries.h"
@@ -4138,7 +4138,7 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry)
if (owned)
description = gPokedexEntries[num].description;
else
description = gExpandedPlaceholder_PokedexDescription;
description = sExpandedPlaceholder_PokedexDescription;
PrintInfoScreenText(description, GetStringCenterAlignXOffset(FONT_NORMAL, description, 0xF0), 0x5F);
}
+11 -11
View File
@@ -6587,12 +6587,12 @@ void SetWildMonHeldItem(void)
u16 rnd = Random() % 100;
u16 species = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, 0);
u16 chanceNoItem = 45;
u16 chanceCommon = 95;
u16 chanceNotRare = 95;
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG, 0)
&& GetMonAbility(&gPlayerParty[0]) == ABILITY_COMPOUND_EYES)
{
chanceNoItem = 20;
chanceCommon = 80;
chanceNotRare = 80;
}
if (gMapHeader.mapLayoutId == LAYOUT_ALTERING_CAVE)
{
@@ -6600,7 +6600,7 @@ void SetWildMonHeldItem(void)
if (alteringCaveId != 0)
{
// In active Altering Cave, use special item list
if (rnd < chanceCommon)
if (rnd < chanceNotRare)
return;
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &sAlteringCaveWildMonHeldItems[alteringCaveId].item);
}
@@ -6609,27 +6609,27 @@ void SetWildMonHeldItem(void)
// In inactive Altering Cave, use normal items
if (rnd < chanceNoItem)
return;
if (rnd < chanceCommon)
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item1);
if (rnd < chanceNotRare)
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemCommon);
else
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item2);
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemRare);
}
}
else
{
if (gBaseStats[species].item1 == gBaseStats[species].item2 && gBaseStats[species].item1 != ITEM_NONE)
if (gBaseStats[species].itemCommon == gBaseStats[species].itemRare && gBaseStats[species].itemCommon != ITEM_NONE)
{
// Both held items are the same, 100% chance to hold item
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item1);
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemCommon);
}
else
{
if (rnd < chanceNoItem)
return;
if (rnd < chanceCommon)
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item1);
if (rnd < chanceNotRare)
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemCommon);
else
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item2);
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].itemRare);
}
}
}
+3 -4
View File
@@ -1040,7 +1040,7 @@ static const struct BgTemplate sBgTemplates[] =
},
};
static const struct SpritePalette gWaveformSpritePalette =
static const struct SpritePalette sWaveformSpritePalette =
{
sWaveform_Pal, PALTAG_MISC_2
};
@@ -3844,7 +3844,7 @@ static bool8 InitPokeStorageWindows(void)
static void LoadWaveformSpritePalette(void)
{
LoadSpritePalette(&gWaveformSpritePalette);
LoadSpritePalette(&sWaveformSpritePalette);
}
static void InitPalettesAndSprites(void)
@@ -5417,8 +5417,7 @@ static bool32 WaitForWallpaperGfxLoad(void)
if (IsDma3ManagerBusyWithBgCopy())
return FALSE;
if (sStorage->wallpaperTiles != NULL)
FREE_AND_SET_NULL(sStorage->wallpaperTiles);
TRY_FREE_AND_SET_NULL(sStorage->wallpaperTiles);
return TRUE;
}
+34 -34
View File
@@ -2314,69 +2314,69 @@ u8 GetMoveSlotToReplace(void)
static void DrawPagination(void) // Updates the pagination dots at the top of the summary screen
{
u16 *alloced = Alloc(32);
u16 *tilemap = Alloc(8 * PSS_PAGE_COUNT);
u8 i;
for (i = 0; i < 4; i++)
for (i = 0; i < PSS_PAGE_COUNT; i++)
{
u8 j = i * 2;
if (i < sMonSummaryScreen->minPageIndex)
{
alloced[j + 0] = 0x40;
alloced[j + 1] = 0x40;
alloced[j + 8] = 0x50;
alloced[j + 9] = 0x50;
tilemap[j + 0] = 0x40;
tilemap[j + 1] = 0x40;
tilemap[j + 2 * PSS_PAGE_COUNT] = 0x50;
tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x50;
}
else if (i > sMonSummaryScreen->maxPageIndex)
{
alloced[j + 0] = 0x4A;
alloced[j + 1] = 0x4A;
alloced[j + 8] = 0x5A;
alloced[j + 9] = 0x5A;
tilemap[j + 0] = 0x4A;
tilemap[j + 1] = 0x4A;
tilemap[j + 2 * PSS_PAGE_COUNT] = 0x5A;
tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x5A;
}
else if (i < sMonSummaryScreen->currPageIndex)
{
alloced[j + 0] = 0x46;
alloced[j + 1] = 0x47;
alloced[j + 8] = 0x56;
alloced[j + 9] = 0x57;
tilemap[j + 0] = 0x46;
tilemap[j + 1] = 0x47;
tilemap[j + 2 * PSS_PAGE_COUNT] = 0x56;
tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x57;
}
else if (i == sMonSummaryScreen->currPageIndex)
{
if (i != sMonSummaryScreen->maxPageIndex)
{
alloced[j + 0] = 0x41;
alloced[j + 1] = 0x42;
alloced[j + 8] = 0x51;
alloced[j + 9] = 0x52;
tilemap[j + 0] = 0x41;
tilemap[j + 1] = 0x42;
tilemap[j + 2 * PSS_PAGE_COUNT] = 0x51;
tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x52;
}
else
{
alloced[j + 0] = 0x4B;
alloced[j + 1] = 0x4C;
alloced[j + 8] = 0x5B;
alloced[j + 9] = 0x5C;
tilemap[j + 0] = 0x4B;
tilemap[j + 1] = 0x4C;
tilemap[j + 2 * PSS_PAGE_COUNT] = 0x5B;
tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x5C;
}
}
else if (i != sMonSummaryScreen->maxPageIndex)
{
alloced[j + 0] = 0x43;
alloced[j + 1] = 0x44;
alloced[j + 8] = 0x53;
alloced[j + 9] = 0x54;
tilemap[j + 0] = 0x43;
tilemap[j + 1] = 0x44;
tilemap[j + 2 * PSS_PAGE_COUNT] = 0x53;
tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x54;
}
else
{
alloced[j + 0] = 0x48;
alloced[j + 1] = 0x49;
alloced[j + 8] = 0x58;
alloced[j + 9] = 0x59;
tilemap[j + 0] = 0x48;
tilemap[j + 1] = 0x49;
tilemap[j + 2 * PSS_PAGE_COUNT] = 0x58;
tilemap[j + 2 * PSS_PAGE_COUNT + 1] = 0x59;
}
}
CopyToBgTilemapBufferRect_ChangePalette(3, alloced, 11, 0, 8, 2, 16);
CopyToBgTilemapBufferRect_ChangePalette(3, tilemap, 11, 0, PSS_PAGE_COUNT * 2, 2, 16);
ScheduleBgCopyTilemapToVram(3);
Free(alloced);
Free(tilemap);
}
static void ChangeTilemap(const struct TilemapCtrl *unkStruct, u16 *dest, u8 c, bool8 d)
@@ -2439,7 +2439,7 @@ static void Task_ShowPowerAccWindow(u8 taskId)
{
if (data[0] < 0)
{
if (sMonSummaryScreen->currPageIndex == 2)
if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES)
PutWindowTilemap(PSS_LABEL_WINDOW_MOVES_POWER_ACC);
}
else
@@ -2492,7 +2492,7 @@ static void Task_ShowAppealJamWindow(u8 taskId)
{
if (data[0] < 0)
{
if (sMonSummaryScreen->currPageIndex == 3 && FuncIsActiveTask(PssScrollRight) == 0)
if (sMonSummaryScreen->currPageIndex == PSS_PAGE_CONTEST_MOVES && FuncIsActiveTask(PssScrollRight) == 0)
PutWindowTilemap(PSS_LABEL_WINDOW_MOVES_APPEAL_JAM);
DrawContestMoveHearts(data[2]);
}
+1 -2
View File
@@ -557,8 +557,7 @@ void *GetSubstructPtr(u32 index)
void FreePokenavSubstruct(u32 index)
{
if (gPokenavResources->substructPtrs[index] != NULL)
FREE_AND_SET_NULL(gPokenavResources->substructPtrs[index]);
TRY_FREE_AND_SET_NULL(gPokenavResources->substructPtrs[index]);
}
u32 GetPokenavMode(void)
+5 -5
View File
@@ -105,7 +105,7 @@ static const u8 sHelpBarTextColors[3] =
TEXT_COLOR_RED, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY
};
static const struct CompressedSpriteSheet gSpinningPokenavSpriteSheet[] =
static const struct CompressedSpriteSheet sSpinningPokenavSpriteSheet[] =
{
{
.data = sSpinningPokenav_Gfx,
@@ -114,7 +114,7 @@ static const struct CompressedSpriteSheet gSpinningPokenavSpriteSheet[] =
}
};
static const struct SpritePalette gSpinningNavgearPalettes[] =
static const struct SpritePalette sSpinningNavgearPalettes[] =
{
{
.data = sSpinningPokenav_Pal,
@@ -583,10 +583,10 @@ static void InitPokenavMainMenuResources(void)
u8 spriteId;
struct Pokenav_MainMenu *menu = GetSubstructPtr(POKENAV_SUBSTRUCT_MAIN_MENU);
for (i = 0; i < ARRAY_COUNT(gSpinningPokenavSpriteSheet); i++)
LoadCompressedSpriteSheet(&gSpinningPokenavSpriteSheet[i]);
for (i = 0; i < ARRAY_COUNT(sSpinningPokenavSpriteSheet); i++)
LoadCompressedSpriteSheet(&sSpinningPokenavSpriteSheet[i]);
Pokenav_AllocAndLoadPalettes(gSpinningNavgearPalettes);
Pokenav_AllocAndLoadPalettes(sSpinningNavgearPalettes);
menu->palettes = ~1 & ~(0x10000 << IndexOfSpritePaletteTag(0));
spriteId = CreateSprite(&sSpinningPokenavSpriteTemplate, 220, 12, 0);
menu->spinningPokenav = &gSprites[spriteId];
+1 -1
View File
@@ -324,7 +324,7 @@ static const match_call_text_data_t sWallyTextScripts[] = {
{ NULL, 0xFFFF, 0xFFFF }
};
const struct MatchCallLocationOverride sWallyLocationData[] = {
static const struct MatchCallLocationOverride sWallyLocationData[] = {
{ FLAG_HIDE_MAUVILLE_CITY_WALLY, MAPSEC_VERDANTURF_TOWN },
{ FLAG_GROUDON_AWAKENED_MAGMA_HIDEOUT, MAPSEC_NONE },
{ FLAG_HIDE_VICTORY_ROAD_ENTRANCE_WALLY, MAPSEC_VICTORY_ROAD },
+1 -1
View File
@@ -146,7 +146,7 @@ static const struct WindowTemplate sMapSecInfoWindowTemplate =
#include "data/region_map/city_map_entries.h"
const struct OamData sCityZoomTextSprite_OamData =
static const struct OamData sCityZoomTextSprite_OamData =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
+1 -1
View File
@@ -285,7 +285,7 @@ static void ReceiveExchangePacket(u32 multiplayerId)
static void PrintTextOnRecordMixing(const u8 *src)
{
DrawDialogueFrame(0, 0);
DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized(0, FONT_NORMAL, src, 0, 1, 0, NULL);
CopyWindowToVram(0, COPYWIN_FULL);
}
+2
View File
@@ -67,6 +67,8 @@ struct RecordedBattleSave
u32 checksum;
};
STATIC_ASSERT(sizeof(struct RecordedBattleSave) <= SECTOR_DATA_SIZE, RecordedBattleSaveFreeSpace);
EWRAM_DATA u32 gRecordedBattleRngSeed = 0;
EWRAM_DATA u32 gBattlePalaceMoveSelectionRngValue = 0;
EWRAM_DATA static u8 sBattleRecords[MAX_BATTLERS_COUNT][BATTLER_RECORD_SIZE] = {0};
+299 -303
View File
File diff suppressed because it is too large Load Diff
+34 -36
View File
@@ -612,12 +612,10 @@ static const u8 sRotatingGate_ArmLayout[][4 * 2] =
},
};
// ewram
static EWRAM_DATA u8 gRotatingGate_GateSpriteIds[ROTATING_GATE_PUZZLE_MAX] = {0};
static EWRAM_DATA const struct RotatingGatePuzzle *gRotatingGate_PuzzleConfig = NULL;
static EWRAM_DATA u8 gRotatingGate_PuzzleCount = 0;
static EWRAM_DATA u8 sRotatingGate_GateSpriteIds[ROTATING_GATE_PUZZLE_MAX] = {0};
static EWRAM_DATA const struct RotatingGatePuzzle *sRotatingGate_PuzzleConfig = NULL;
static EWRAM_DATA u8 sRotatingGate_PuzzleCount = 0;
// text
static s32 GetCurrentMapRotatingGatePuzzleType(void)
{
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(FORTREE_CITY_GYM) &&
@@ -640,9 +638,9 @@ static void RotatingGate_ResetAllGateOrientations(void)
s32 i;
u8 *ptr = (u8 *)GetVarPointer(VAR_TEMP_0);
for (i = 0; i < gRotatingGate_PuzzleCount; i++)
for (i = 0; i < sRotatingGate_PuzzleCount; i++)
{
ptr[i] = gRotatingGate_PuzzleConfig[i].orientation;
ptr[i] = sRotatingGate_PuzzleConfig[i].orientation;
}
}
@@ -683,12 +681,12 @@ static void RotatingGate_LoadPuzzleConfig(void)
switch (puzzleType)
{
case PUZZLE_FORTREE_CITY_GYM:
gRotatingGate_PuzzleConfig = sRotatingGate_FortreePuzzleConfig;
gRotatingGate_PuzzleCount = ARRAY_COUNT(sRotatingGate_FortreePuzzleConfig);
sRotatingGate_PuzzleConfig = sRotatingGate_FortreePuzzleConfig;
sRotatingGate_PuzzleCount = ARRAY_COUNT(sRotatingGate_FortreePuzzleConfig);
break;
case PUZZLE_ROUTE110_TRICK_HOUSE_PUZZLE6:
gRotatingGate_PuzzleConfig = sRotatingGate_TrickHousePuzzleConfig;
gRotatingGate_PuzzleCount = ARRAY_COUNT(sRotatingGate_TrickHousePuzzleConfig);
sRotatingGate_PuzzleConfig = sRotatingGate_TrickHousePuzzleConfig;
sRotatingGate_PuzzleCount = ARRAY_COUNT(sRotatingGate_TrickHousePuzzleConfig);
break;
case PUZZLE_NONE:
default:
@@ -696,7 +694,7 @@ static void RotatingGate_LoadPuzzleConfig(void)
}
for (i = 0; i < ROTATING_GATE_PUZZLE_MAX - 1; i++)
gRotatingGate_GateSpriteIds[i] = MAX_SPRITES;
sRotatingGate_GateSpriteIds[i] = MAX_SPRITES;
}
static void RotatingGate_CreateGatesWithinViewport(s16 deltaX, s16 deltaY)
@@ -710,15 +708,15 @@ static void RotatingGate_CreateGatesWithinViewport(s16 deltaX, s16 deltaY)
s16 y = gSaveBlock1Ptr->pos.y - 2;
s16 y2 = gSaveBlock1Ptr->pos.y + MAP_OFFSET_H;
for (i = 0; i < gRotatingGate_PuzzleCount; i++)
for (i = 0; i < sRotatingGate_PuzzleCount; i++)
{
s16 x3 = gRotatingGate_PuzzleConfig[i].x + MAP_OFFSET;
s16 y3 = gRotatingGate_PuzzleConfig[i].y + MAP_OFFSET;
s16 x3 = sRotatingGate_PuzzleConfig[i].x + MAP_OFFSET;
s16 y3 = sRotatingGate_PuzzleConfig[i].y + MAP_OFFSET;
if (y <= y3 && y2 >= y3 && x <= x3 && x2 >= x3 &&
gRotatingGate_GateSpriteIds[i] == MAX_SPRITES)
sRotatingGate_GateSpriteIds[i] == MAX_SPRITES)
{
gRotatingGate_GateSpriteIds[i] = RotatingGate_CreateGate(i, deltaX, deltaY);
sRotatingGate_GateSpriteIds[i] = RotatingGate_CreateGate(i, deltaX, deltaY);
}
}
}
@@ -730,7 +728,7 @@ static u8 RotatingGate_CreateGate(u8 gateId, s16 deltaX, s16 deltaY)
u8 spriteId;
s16 x, y;
const struct RotatingGatePuzzle *gate = &gRotatingGate_PuzzleConfig[gateId];
const struct RotatingGatePuzzle *gate = &sRotatingGate_PuzzleConfig[gateId];
if (gate->shape == GATE_SHAPE_L1 || gate->shape == GATE_SHAPE_T1)
template = sSpriteTemplate_RotatingGateRegular;
@@ -827,20 +825,20 @@ static void RotatingGate_DestroyGatesOutsideViewport(void)
s16 y = gSaveBlock1Ptr->pos.y - 2;
s16 y2 = gSaveBlock1Ptr->pos.y + MAP_OFFSET_H;
for (i = 0; i < gRotatingGate_PuzzleCount; i++)
for (i = 0; i < sRotatingGate_PuzzleCount; i++)
{
s16 xGate = gRotatingGate_PuzzleConfig[i].x + MAP_OFFSET;
s16 yGate = gRotatingGate_PuzzleConfig[i].y + MAP_OFFSET;
s16 xGate = sRotatingGate_PuzzleConfig[i].x + MAP_OFFSET;
s16 yGate = sRotatingGate_PuzzleConfig[i].y + MAP_OFFSET;
if (gRotatingGate_GateSpriteIds[i] == MAX_SPRITES)
if (sRotatingGate_GateSpriteIds[i] == MAX_SPRITES)
continue;
if (xGate < x || xGate > x2 || yGate < y || yGate > y2)
{
struct Sprite *sprite = &gSprites[gRotatingGate_GateSpriteIds[i]];
struct Sprite *sprite = &gSprites[sRotatingGate_GateSpriteIds[i]];
FreeSpriteOamMatrix(sprite);
DestroySprite(sprite);
gRotatingGate_GateSpriteIds[i] = MAX_SPRITES;
sRotatingGate_GateSpriteIds[i] = MAX_SPRITES;
}
}
}
@@ -862,9 +860,9 @@ static s32 RotatingGate_CanRotate(u8 gateId, s32 rotationDirection)
orientation = RotatingGate_GetGateOrientation(gateId);
shape = gRotatingGate_PuzzleConfig[gateId].shape;
x = gRotatingGate_PuzzleConfig[gateId].x + MAP_OFFSET;
y = gRotatingGate_PuzzleConfig[gateId].y + MAP_OFFSET;
shape = sRotatingGate_PuzzleConfig[gateId].shape;
x = sRotatingGate_PuzzleConfig[gateId].x + MAP_OFFSET;
y = sRotatingGate_PuzzleConfig[gateId].y + MAP_OFFSET;
// Loop through the gate's "arms" clockwise (north, south, east, west)
for (i = GATE_ARM_NORTH; i <= GATE_ARM_WEST; i++)
@@ -891,15 +889,15 @@ static s32 RotatingGate_HasArm(u8 gateId, u8 armInfo)
s32 isLongArm = armInfo % 2;
s8 armOrientation = (arm - RotatingGate_GetGateOrientation(gateId) + 4) % 4;
s32 shape = gRotatingGate_PuzzleConfig[gateId].shape;
s32 shape = sRotatingGate_PuzzleConfig[gateId].shape;
return sRotatingGate_ArmLayout[shape][armOrientation * 2 + isLongArm];
}
static void RotatingGate_TriggerRotationAnimation(u8 gateId, s32 rotationDirection)
{
if (gRotatingGate_GateSpriteIds[gateId] != MAX_SPRITES)
if (sRotatingGate_GateSpriteIds[gateId] != MAX_SPRITES)
{
struct Sprite *sprite = &gSprites[gRotatingGate_GateSpriteIds[gateId]];
struct Sprite *sprite = &gSprites[sRotatingGate_GateSpriteIds[gateId]];
sprite->data[1] = rotationDirection;
sprite->data[2] = RotatingGate_GetGateOrientation(gateId);
}
@@ -957,10 +955,10 @@ bool8 CheckForRotatingGatePuzzleCollision(u8 direction, s16 x, s16 y)
if (!GetCurrentMapRotatingGatePuzzleType())
return FALSE;
for (i = 0; i < gRotatingGate_PuzzleCount; i++)
for (i = 0; i < sRotatingGate_PuzzleCount; i++)
{
s16 gateX = gRotatingGate_PuzzleConfig[i].x + MAP_OFFSET;
s16 gateY = gRotatingGate_PuzzleConfig[i].y + MAP_OFFSET;
s16 gateX = sRotatingGate_PuzzleConfig[i].x + MAP_OFFSET;
s16 gateY = sRotatingGate_PuzzleConfig[i].y + MAP_OFFSET;
if (gateX - 2 <= x && x <= gateX + 1 && gateY - 2 <= y && y <= gateY + 1)
{
@@ -995,10 +993,10 @@ bool8 CheckForRotatingGatePuzzleCollisionWithoutAnimation(u8 direction, s16 x, s
if (!GetCurrentMapRotatingGatePuzzleType())
return FALSE;
for (i = 0; i < gRotatingGate_PuzzleCount; i++)
for (i = 0; i < sRotatingGate_PuzzleCount; i++)
{
s16 gateX = gRotatingGate_PuzzleConfig[i].x + MAP_OFFSET;
s16 gateY = gRotatingGate_PuzzleConfig[i].y + MAP_OFFSET;
s16 gateX = sRotatingGate_PuzzleConfig[i].x + MAP_OFFSET;
s16 gateY = sRotatingGate_PuzzleConfig[i].y + MAP_OFFSET;
if (gateX - 2 <= x && x <= gateX + 1 && gateY - 2 <= y && y <= gateY + 1)
{
+1 -2
View File
@@ -98,8 +98,7 @@ void FreeRotatingTilePuzzle(void)
{
u8 id;
if (sRotatingTilePuzzle != NULL)
FREE_AND_SET_NULL(sRotatingTilePuzzle);
TRY_FREE_AND_SET_NULL(sRotatingTilePuzzle);
id = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0);
ObjectEventClearHeldMovementIfFinished(&gObjectEvents[id]);
+6
View File
@@ -73,6 +73,12 @@ struct
SAVEBLOCK_CHUNK(struct PokemonStorage, 8), // SECTOR_ID_PKMN_STORAGE_END
};
// These will produce an error if a save struct is larger than the space
// alloted for it in the flash.
STATIC_ASSERT(sizeof(struct SaveBlock2) <= SECTOR_DATA_SIZE, SaveBlock2FreeSpace);
STATIC_ASSERT(sizeof(struct SaveBlock1) <= SECTOR_DATA_SIZE * (SECTOR_ID_SAVEBLOCK1_END - SECTOR_ID_SAVEBLOCK1_START + 1), SaveBlock1FreeSpace);
STATIC_ASSERT(sizeof(struct PokemonStorage) <= SECTOR_DATA_SIZE * (SECTOR_ID_PKMN_STORAGE_END - SECTOR_ID_PKMN_STORAGE_START + 1), PokemonStorageFreeSpace);
u16 gLastWrittenSector;
u32 gLastSaveCounter;
u16 gLastKnownGoodSector;
+3 -6
View File
@@ -6,7 +6,6 @@
#include "constants/event_objects.h"
#include "constants/event_object_movement.h"
// static functions
static void ScriptMovement_StartMoveObjects(u8 priority);
static u8 GetMoveObjectsTaskId(void);
static bool8 ScriptMovement_TryAddNewMovement(u8 taskId, u8 objEventId, const u8 *movementScript);
@@ -17,10 +16,8 @@ static void ScriptMovement_UnfreezeActiveObjects(u8 taskId);
static void ScriptMovement_MoveObjects(u8 taskId);
static void ScriptMovement_TakeStep(u8 taskId, u8 moveScrId, u8 objEventId, const u8 *movementScript);
// EWRAM_DATA
static EWRAM_DATA const u8 *gMovementScripts[OBJECT_EVENTS_COUNT] = {0};
static EWRAM_DATA const u8 *sMovementScripts[OBJECT_EVENTS_COUNT] = {0};
// text
bool8 ScriptMovement_StartObjectMovementScript(u8 localId, u8 mapNum, u8 mapGroup, const u8 *movementScript)
{
u8 objEventId;
@@ -167,12 +164,12 @@ static bool8 IsMovementScriptFinished(u8 taskId, u8 moveScrId)
static void SetMovementScript(u8 moveScrId, const u8 *movementScript)
{
gMovementScripts[moveScrId] = movementScript;
sMovementScripts[moveScrId] = movementScript;
}
static const u8 *GetMovementScript(u8 moveScrId)
{
return gMovementScripts[moveScrId];
return sMovementScripts[moveScrId];
}
static void ScriptMovement_AddNewMovement(u8 taskId, u8 moveScrId, u8 objEventId, const u8 *movementScript)
+1
View File
@@ -4,6 +4,7 @@
#include "gba/gba.h"
#include "siirtc.h"
#include "config.h"
#define STATUS_INTFE 0x02 // frequency interrupt enable
#define STATUS_INTME 0x08 // per-minute interrupt enable
+12 -20
View File
@@ -1390,7 +1390,7 @@ static bool8 SlotTask_HandleBetInput(struct Task *task)
// SLOTTASK_MSG_NEED_3_COINS
static bool8 SlotTask_PrintMsg_Need3Coins(struct Task *task)
{
DrawDialogueFrame(0, 0);
DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized(0, FONT_NORMAL, gText_YouDontHaveThreeCoins, 0, 1, 0, 0);
CopyWindowToVram(0, COPYWIN_FULL);
sSlotMachine->state = SLOTTASK_WAIT_MSG_NEED_3_COINS;
@@ -1655,7 +1655,7 @@ static bool8 SlotTask_NoMatches(struct Task *task)
// SLOTTASK_ASK_QUIT
static bool8 SlotTask_AskQuit(struct Task *task)
{
DrawDialogueFrame(0, 0);
DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized(0, FONT_NORMAL, gText_QuitTheGame, 0, 1, 0, 0);
CopyWindowToVram(0, COPYWIN_FULL);
CreateYesNoMenuParameterized(0x15, 7, 0x214, 0x180, 0xE, 0xF);
@@ -1687,7 +1687,7 @@ static bool8 SlotTask_HandleQuitInput(struct Task *task)
// SLOTTASK_MSG_MAX_COINS
static bool8 SlotTask_PrintMsg_MaxCoins(struct Task *task)
{
DrawDialogueFrame(0, 0);
DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized(0, FONT_NORMAL, gText_YouveGot9999Coins, 0, 1, 0, 0);
CopyWindowToVram(0, COPYWIN_FULL);
sSlotMachine->state = SLOTTASK_WAIT_MSG_MAX_COINS;
@@ -1708,7 +1708,7 @@ static bool8 SlotTask_WaitMsg_MaxCoins(struct Task *task)
// SLOTTASK_MSG_NO_MORE_COINS
static bool8 SlotTask_PrintMsg_NoMoreCoins(struct Task *task)
{
DrawDialogueFrame(0, 0);
DrawDialogueFrame(0, FALSE);
AddTextPrinterParameterized(0, FONT_NORMAL, gText_YouveRunOutOfCoins, 0, 1, 0, 0);
CopyWindowToVram(0, COPYWIN_FULL);
sSlotMachine->state = SLOTTASK_WAIT_MSG_NO_MORE_COINS;
@@ -1756,14 +1756,10 @@ static bool8 SlotTask_FreeDataStructures(struct Task *task)
FREE_AND_SET_NULL(sImageTable_DigitalDisplay_Number);
FREE_AND_SET_NULL(sImageTable_DigitalDisplay_Pokeball);
FREE_AND_SET_NULL(sImageTable_DigitalDisplay_DPad);
if (sImageTable_ReelTimePikachu != NULL)
FREE_AND_SET_NULL(sImageTable_ReelTimePikachu);
if (sImageTable_ReelTimeMachineAntennae != NULL)
FREE_AND_SET_NULL(sImageTable_ReelTimeMachineAntennae);
if (sImageTable_ReelTimeMachine != NULL)
FREE_AND_SET_NULL(sImageTable_ReelTimeMachine);
if (sImageTable_BrokenReelTimeMachine != NULL)
FREE_AND_SET_NULL(sImageTable_BrokenReelTimeMachine);
TRY_FREE_AND_SET_NULL(sImageTable_ReelTimePikachu);
TRY_FREE_AND_SET_NULL(sImageTable_ReelTimeMachineAntennae);
TRY_FREE_AND_SET_NULL(sImageTable_ReelTimeMachine);
TRY_FREE_AND_SET_NULL(sImageTable_BrokenReelTimeMachine);
FREE_AND_SET_NULL(sMenuGfx);
FREE_AND_SET_NULL(sSelectedPikaPowerTile);
FREE_AND_SET_NULL(sReelOverlay_Tilemap);
@@ -4184,8 +4180,7 @@ static void CreateReelTimePikachuSprite(void)
static void DestroyReelTimePikachuSprite(void)
{
DestroySprite(&gSprites[sSlotMachine->reelTimePikachuSpriteId]);
if (sImageTable_ReelTimePikachu != NULL)
FREE_AND_SET_NULL(sImageTable_ReelTimePikachu);
TRY_FREE_AND_SET_NULL(sImageTable_ReelTimePikachu);
}
static void SpriteCB_ReelTimePikachu(struct Sprite *sprite)
@@ -4314,10 +4309,8 @@ static void DestroyReelTimeMachineSprites(void)
for (i = 0; i < ARRAY_COUNT(sSlotMachine->reelTimeMachineSpriteIds); i++)
DestroySprite(&gSprites[sSlotMachine->reelTimeMachineSpriteIds[i]]);
if (sImageTable_ReelTimeMachineAntennae != NULL)
FREE_AND_SET_NULL(sImageTable_ReelTimeMachineAntennae);
if (sImageTable_ReelTimeMachine != NULL)
FREE_AND_SET_NULL(sImageTable_ReelTimeMachine);
TRY_FREE_AND_SET_NULL(sImageTable_ReelTimeMachineAntennae);
TRY_FREE_AND_SET_NULL(sImageTable_ReelTimeMachine);
for (i = 0; i < ARRAY_COUNT(sSlotMachine->reelTimeNumberSpriteIds); i++)
DestroySprite(&gSprites[sSlotMachine->reelTimeNumberSpriteIds[i]]);
@@ -4334,8 +4327,7 @@ static void DestroyReelTimeShadowSprites(void)
static void DestroyBrokenReelTimeMachineSprite(void)
{
DestroySprite(&gSprites[sSlotMachine->reelTimeBrokenMachineSpriteId]);
if (sImageTable_BrokenReelTimeMachine != NULL)
FREE_AND_SET_NULL(sImageTable_BrokenReelTimeMachine);
TRY_FREE_AND_SET_NULL(sImageTable_BrokenReelTimeMachine);
}
#define sDelayTimer data[0]
+3 -3
View File
@@ -537,7 +537,7 @@ const u16 *const gTilesetAnims_BattlePyramid_StatueShadow[] = {
gTilesetAnims_BattlePyramid_StatueShadow_Frame2
};
static const u16 *const gTilesetAnims_BattleDomeFloorLightPals[] = {
static const u16 *const sTilesetAnims_BattleDomeFloorLightPals[] = {
gTilesetAnims_BattleDomePals0_0,
gTilesetAnims_BattleDomePals0_1,
gTilesetAnims_BattleDomePals0_2,
@@ -1167,7 +1167,7 @@ static void QueueAnimTiles_BattlePyramid_StatueShadow(u16 timer)
static void BlendAnimPalette_BattleDome_FloorLights(u16 timer)
{
CpuCopy16(gTilesetAnims_BattleDomeFloorLightPals[timer % ARRAY_COUNT(gTilesetAnims_BattleDomeFloorLightPals)], &gPlttBufferUnfaded[0x80], 32);
CpuCopy16(sTilesetAnims_BattleDomeFloorLightPals[timer % ARRAY_COUNT(sTilesetAnims_BattleDomeFloorLightPals)], &gPlttBufferUnfaded[0x80], 32);
BlendPalette(0x80, 16, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF);
if ((u8)FindTaskIdByFunc(Task_BattleTransition_Intro) != TASK_NONE)
{
@@ -1178,7 +1178,7 @@ static void BlendAnimPalette_BattleDome_FloorLights(u16 timer)
static void BlendAnimPalette_BattleDome_FloorLightsNoBlend(u16 timer)
{
CpuCopy16(gTilesetAnims_BattleDomeFloorLightPals[timer % ARRAY_COUNT(gTilesetAnims_BattleDomeFloorLightPals)], &gPlttBufferUnfaded[0x80], 32);
CpuCopy16(sTilesetAnims_BattleDomeFloorLightPals[timer % ARRAY_COUNT(sTilesetAnims_BattleDomeFloorLightPals)], &gPlttBufferUnfaded[0x80], 32);
if ((u8)FindTaskIdByFunc(Task_BattleTransition_Intro) == TASK_NONE)
{
BlendPalette(0x80, 16, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF);
+1 -1
View File
@@ -2195,7 +2195,7 @@ static bool8 LoadTradeMenuSpriteSheetsAndPalettes(void)
sTradeMenuData->timer++;
break;
case GFXTAG_MENU_TEXT_COUNT:
LoadSpritePalette(&gSpritePalette_TradeScreenText);
LoadSpritePalette(&sSpritePalette_TradeScreenText);
sTradeMenuData->timer++;
break;
case GFXTAG_MENU_TEXT_COUNT + 1:
+1 -1
View File
@@ -723,7 +723,7 @@ static const u8 *const sTVInSearchOfTrainersTextGroup[] = {
// Secret Base Secrets TV Show states for actions that can be taken in a secret base
// The flags that determine whether or not the action was taken are commented
const u8 sTVSecretBaseSecretsActions[NUM_SECRET_BASE_FLAGS] =
static const u8 sTVSecretBaseSecretsActions[NUM_SECRET_BASE_FLAGS] =
{
SBSECRETS_STATE_USED_CHAIR, // SECRET_BASE_USED_CHAIR
SBSECRETS_STATE_USED_BALLOON, // SECRET_BASE_USED_BALLOON
+1 -2
View File
@@ -2160,8 +2160,7 @@ static bool32 IsDisplaySubtask0Active(void)
static void FreeDisplay(void)
{
FreeSprites();
if (sDisplay)
FREE_AND_SET_NULL(sDisplay);
TRY_FREE_AND_SET_NULL(sDisplay);
FreeAllWindowBuffers();
gScanlineEffect.state = 3;