summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2021-07-08 00:24:56 -0400
committerGitHub <noreply@github.com>2021-07-08 00:24:56 -0400
commit32fe4127555632d00223c07f9f0c1d69eac8c6b8 (patch)
tree2743f21f76db6deb6eaf99fa942565125a5d237e /src
parentfced9e507da70096668967346e09c27302ca54e9 (diff)
parentd2701b51ab08a3d099c378f6b1a8113a7bc45690 (diff)
Merge pull request #1475 from GriffinRichards/doc-minor
Label remaining symbols in a few files
Diffstat (limited to 'src')
-rw-r--r--src/battle_ai_script_commands.c29
-rw-r--r--src/hall_of_fame.c23
-rwxr-xr-xsrc/pokenav_region_map.c4
-rw-r--r--src/region_map.c18
-rw-r--r--src/tv.c99
5 files changed, 98 insertions, 75 deletions
diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c
index b72875036..bb615e497 100644
--- a/src/battle_ai_script_commands.c
+++ b/src/battle_ai_script_commands.c
@@ -263,7 +263,10 @@ static const BattleAICmdFunc sBattleAICmdTable[] =
Cmd_if_holds_item, // 0x62
};
-static const u16 sDiscouragedPowerfulMoveEffects[] =
+// For the purposes of determining the most powerful move in a moveset, these
+// moves are treated the same as having a power of 0 or 1
+#define IGNORED_MOVES_END 0xFFFF
+static const u16 sIgnoredPowerfulMoveEffects[] =
{
EFFECT_EXPLOSION,
EFFECT_DREAM_EATER,
@@ -277,7 +280,7 @@ static const u16 sDiscouragedPowerfulMoveEffects[] =
EFFECT_SUPERPOWER,
EFFECT_ERUPTION,
EFFECT_OVERHEAT,
- 0xFFFF
+ IGNORED_MOVES_END
};
// code
@@ -1177,14 +1180,14 @@ static void Cmd_get_how_powerful_move_is(void)
s32 i, checkedMove;
s32 moveDmgs[MAX_MON_MOVES];
- for (i = 0; sDiscouragedPowerfulMoveEffects[i] != 0xFFFF; i++)
+ for (i = 0; sIgnoredPowerfulMoveEffects[i] != IGNORED_MOVES_END; i++)
{
- if (gBattleMoves[AI_THINKING_STRUCT->moveConsidered].effect == sDiscouragedPowerfulMoveEffects[i])
+ if (gBattleMoves[AI_THINKING_STRUCT->moveConsidered].effect == sIgnoredPowerfulMoveEffects[i])
break;
}
if (gBattleMoves[AI_THINKING_STRUCT->moveConsidered].power > 1
- && sDiscouragedPowerfulMoveEffects[i] == 0xFFFF)
+ && sIgnoredPowerfulMoveEffects[i] == IGNORED_MOVES_END)
{
gDynamicBasePower = 0;
*(&gBattleStruct->dynamicMoveType) = 0;
@@ -1192,16 +1195,18 @@ static void Cmd_get_how_powerful_move_is(void)
gMoveResultFlags = 0;
gCritMultiplier = 1;
+ // Considered move has power and is not in sIgnoredPowerfulMoveEffects
+ // Check all other moves and calculate their power
for (checkedMove = 0; checkedMove < MAX_MON_MOVES; checkedMove++)
{
- for (i = 0; sDiscouragedPowerfulMoveEffects[i] != 0xFFFF; i++)
+ for (i = 0; sIgnoredPowerfulMoveEffects[i] != IGNORED_MOVES_END; i++)
{
- if (gBattleMoves[gBattleMons[sBattler_AI].moves[checkedMove]].effect == sDiscouragedPowerfulMoveEffects[i])
+ if (gBattleMoves[gBattleMons[sBattler_AI].moves[checkedMove]].effect == sIgnoredPowerfulMoveEffects[i])
break;
}
if (gBattleMons[sBattler_AI].moves[checkedMove] != MOVE_NONE
- && sDiscouragedPowerfulMoveEffects[i] == 0xFFFF
+ && sIgnoredPowerfulMoveEffects[i] == IGNORED_MOVES_END
&& gBattleMoves[gBattleMons[sBattler_AI].moves[checkedMove]].power > 1)
{
gCurrentMove = gBattleMons[sBattler_AI].moves[checkedMove];
@@ -1217,6 +1222,7 @@ static void Cmd_get_how_powerful_move_is(void)
}
}
+ // Is the considered move the most powerful move available?
for (checkedMove = 0; checkedMove < MAX_MON_MOVES; checkedMove++)
{
if (moveDmgs[checkedMove] > moveDmgs[AI_THINKING_STRUCT->movesetIndex])
@@ -1224,13 +1230,14 @@ static void Cmd_get_how_powerful_move_is(void)
}
if (checkedMove == MAX_MON_MOVES)
- AI_THINKING_STRUCT->funcResult = MOVE_MOST_POWERFUL; // Is the most powerful.
+ AI_THINKING_STRUCT->funcResult = MOVE_MOST_POWERFUL;
else
- AI_THINKING_STRUCT->funcResult = MOVE_NOT_MOST_POWERFUL; // Not the most powerful.
+ AI_THINKING_STRUCT->funcResult = MOVE_NOT_MOST_POWERFUL;
}
else
{
- AI_THINKING_STRUCT->funcResult = MOVE_POWER_DISCOURAGED; // Highly discouraged in terms of power.
+ // Move has a power of 0/1, or is in the group sIgnoredPowerfulMoveEffects
+ AI_THINKING_STRUCT->funcResult = MOVE_POWER_OTHER;
}
gAIScriptPtr++;
diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c
index 3eb8d3f0a..5746260f3 100644
--- a/src/hall_of_fame.c
+++ b/src/hall_of_fame.c
@@ -66,13 +66,12 @@ static EWRAM_DATA struct HofGfx *sHofGfxPtr = NULL;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
-// this file's functions
static void ClearVramOamPltt_LoadHofPal(void);
static void LoadHofGfx(void);
static void InitHofBgs(void);
static bool8 CreateHofConfettiSprite(void);
static void StartCredits(void);
-static bool8 sub_8175024(void);
+static bool8 LoadHofBgs(void);
static void Task_Hof_InitMonData(u8 taskId);
static void Task_Hof_InitTeamSaveData(u8 taskId);
static void Task_Hof_SetMonDisplayTask(u8 taskId);
@@ -104,7 +103,6 @@ static void HallOfFame_PrintPlayerInfo(u8 unused1, u8 unused2);
static void Task_DoDomeConfetti(u8 taskId);
static void SpriteCB_HofConfetti(struct Sprite* sprite);
-// const rom data
static const struct BgTemplate sHof_BgTemplates[] =
{
{
@@ -136,12 +134,19 @@ static const struct BgTemplate sHof_BgTemplates[] =
},
};
-static const struct WindowTemplate sHof_WindowTemplate = {0, 2, 2, 0xE, 6, 0xE, 1};
+static const struct WindowTemplate sHof_WindowTemplate = {
+ .bg = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 2,
+ .width = 14,
+ .height = 6,
+ .paletteNum = 14,
+ .baseBlock = 1
+};
static const u8 sMonInfoTextColors[4] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY};
static const u8 sPlayerInfoTextColors[4] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY};
-
-static const u8 sUnused_085E538C[] = {4, 5, 0, 0};
+static const u8 sUnusedTextColors[4] = {TEXT_COLOR_RED, TEXT_COLOR_LIGHT_RED, TEXT_COLOR_TRANSPARENT};
static const struct CompressedSpriteSheet sSpriteSheet_Confetti[] =
{
@@ -383,7 +388,7 @@ static bool8 InitHallOfFameScreen(void)
gMain.state++;
break;
case 3:
- if (!sub_8175024())
+ if (!LoadHofBgs())
{
SetVBlankCallback(VBlankCB_HallOfFame);
BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK);
@@ -819,7 +824,7 @@ void CB2_DoHallOfFamePC(void)
gMain.state++;
break;
case 3:
- if (!sub_8175024())
+ if (!LoadHofBgs())
{
struct HallofFameTeam *fameTeam = (struct HallofFameTeam*)(gDecompressionBuffer);
fameTeam->mon[0] = sDummyFameMon;
@@ -1301,7 +1306,7 @@ static void InitHofBgs(void)
ChangeBgY(3, 0, 0);
}
-static bool8 sub_8175024(void)
+static bool8 LoadHofBgs(void)
{
switch (sHofGfxPtr->state)
{
diff --git a/src/pokenav_region_map.c b/src/pokenav_region_map.c
index 2dd2e4408..3d53bc98a 100755
--- a/src/pokenav_region_map.c
+++ b/src/pokenav_region_map.c
@@ -327,7 +327,9 @@ static u32 LoopedTask_OpenRegionMap(s32 taskState)
}
else
{
- sub_8123030(RGB_BLACK, 6);
+ // Dim the region map when zoom is disabled
+ // (when the player is off the map)
+ BlendRegionMap(RGB_BLACK, 6);
}
return LT_INC_AND_PAUSE;
case 2:
diff --git a/src/region_map.c b/src/region_map.c
index 27e035199..335323421 100644
--- a/src/region_map.c
+++ b/src/region_map.c
@@ -71,7 +71,7 @@ static EWRAM_DATA struct {
bool8 choseFlyLocation;
} *sFlyMap = NULL;
-static bool32 gUnknown_03001180;
+static bool32 sDrawFlyDestTextWindow;
// Static ROM declarations
@@ -621,7 +621,7 @@ bool8 LoadRegionMapGfx(void)
return TRUE;
}
-void sub_8123030(u16 color, u32 coeff)
+void BlendRegionMap(u16 color, u32 coeff)
{
BlendPalettes(0x380, coeff, color);
CpuCopy16(gPlttBufferFaded + 0x70, gPlttBufferUnfaded + 0x70, 0x60);
@@ -1696,7 +1696,7 @@ void CB2_OpenFlyMap(void)
CreateRegionMapPlayerIcon(1, 1);
sFlyMap->mapSecId = sFlyMap->regionMap.mapSecId;
StringFill(sFlyMap->nameBuffer, CHAR_SPACE, MAP_NAME_LENGTH);
- gUnknown_03001180 = TRUE;
+ sDrawFlyDestTextWindow = TRUE;
DrawFlyDestTextWindow();
gMain.state++;
break;
@@ -1782,30 +1782,32 @@ static void DrawFlyDestTextWindow(void)
name = sMultiNameFlyDestinations[i].name[sFlyMap->regionMap.posWithinMapSec];
AddTextPrinterParameterized(1, 1, name, GetStringRightAlignXOffset(1, name, 96), 17, 0, NULL);
ScheduleBgCopyTilemapToVram(0);
- gUnknown_03001180 = TRUE;
+ sDrawFlyDestTextWindow = TRUE;
}
break;
}
}
if (!namePrinted)
{
- if (gUnknown_03001180 == TRUE)
+ if (sDrawFlyDestTextWindow == TRUE)
{
ClearStdWindowAndFrameToTransparent(1, FALSE);
DrawStdFrameWithCustomTileAndPalette(0, FALSE, 101, 13);
}
else
{
+ // Window is already drawn, just empty it
FillWindowPixelBuffer(0, PIXEL_FILL(1));
}
AddTextPrinterParameterized(0, 1, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL);
ScheduleBgCopyTilemapToVram(0);
- gUnknown_03001180 = FALSE;
+ sDrawFlyDestTextWindow = FALSE;
}
}
else
{
- if (gUnknown_03001180 == TRUE)
+ // Selection is on MAPSECTYPE_NONE, draw empty fly destination text window
+ if (sDrawFlyDestTextWindow == TRUE)
{
ClearStdWindowAndFrameToTransparent(1, FALSE);
DrawStdFrameWithCustomTileAndPalette(0, FALSE, 101, 13);
@@ -1813,7 +1815,7 @@ static void DrawFlyDestTextWindow(void)
FillWindowPixelBuffer(0, PIXEL_FILL(1));
CopyWindowToVram(0, 2);
ScheduleBgCopyTilemapToVram(0);
- gUnknown_03001180 = FALSE;
+ sDrawFlyDestTextWindow = FALSE;
}
}
diff --git a/src/tv.c b/src/tv.c
index 50adde3f4..b7b490aa3 100644
--- a/src/tv.c
+++ b/src/tv.c
@@ -335,19 +335,19 @@ static const u8 *const sTVPokemonTodaySuccessfulTextGroup[] = {
};
static const u8 *const sTVTodaysSmartShopperTextGroup[] = {
- gTVTodaysSmartShopperText00,
- gTVTodaysSmartShopperText01,
- gTVTodaysSmartShopperText02,
- gTVTodaysSmartShopperText03,
- gTVTodaysSmartShopperText04,
- gTVTodaysSmartShopperText05,
- gTVTodaysSmartShopperText06,
- gTVTodaysSmartShopperText07,
- gTVTodaysSmartShopperText08,
- gTVTodaysSmartShopperText09,
- gTVTodaysSmartShopperText10,
- gTVTodaysSmartShopperText11,
- gTVTodaysSmartShopperText12
+ [SMARTSHOPPER_STATE_INTRO] = SmartShopper_Text_Intro,
+ [SMARTSHOPPER_STATE_CLERK_NORMAL] = SmartShopper_Text_ClerkNormal,
+ [SMARTSHOPPER_STATE_RAND_COMMENT_1] = SmartShopper_Text_RandomComment1,
+ [SMARTSHOPPER_STATE_RAND_COMMENT_2] = SmartShopper_Text_RandomComment2,
+ [SMARTSHOPPER_STATE_RAND_COMMENT_3] = SmartShopper_Text_RandomComment3,
+ [SMARTSHOPPER_STATE_RAND_COMMENT_4] = SmartShopper_Text_RandomComment4,
+ [SMARTSHOPPER_STATE_SECOND_ITEM] = SmartShopper_Text_SecondItem,
+ [SMARTSHOPPER_STATE_THIRD_ITEM] = SmartShopper_Text_ThirdItem,
+ [SMARTSHOPPER_STATE_DURING_SALE] = SmartShopper_Text_DuringSale,
+ [SMARTSHOPPER_STATE_OUTRO_NORMAL] = SmartShopper_Text_OutroNormal,
+ [SMARTSHOPPER_STATE_IS_VIP] = SmartShopper_Text_IsVIP,
+ [SMARTSHOPPER_STATE_CLERK_MAX] = SmartShopper_Text_ClerkMax,
+ [SMARTSHOPPER_STATE_OUTRO_MAX] = SmartShopper_Text_OutroMax
};
static const u8 *const sTVBravoTrainerTextGroup[] = {
@@ -2785,7 +2785,7 @@ size_t CountDigits(int value)
return 1;
}
-static void sub_80EF40C(u8 varIdx, TVShow *show)
+static void SmartShopper_BufferPurchaseTotal(u8 varIdx, TVShow *show)
{
u8 i;
int price;
@@ -4460,78 +4460,85 @@ static void DoTVShowTodaysSmartShopper(void)
state = sTVShowState;
switch(state)
{
- case 0:
+ case SMARTSHOPPER_STATE_INTRO:
TVShowConvertInternationalString(gStringVar1, show->smartshopperShow.playerName, show->smartshopperShow.language);
GetMapName(gStringVar2, show->smartshopperShow.shopLocation, 0);
if (show->smartshopperShow.itemAmounts[0] >= 255)
- sTVShowState = 11;
+ sTVShowState = SMARTSHOPPER_STATE_CLERK_MAX;
else
- sTVShowState = 1;
+ sTVShowState = SMARTSHOPPER_STATE_CLERK_NORMAL;
break;
- case 1:
+ case SMARTSHOPPER_STATE_CLERK_NORMAL:
TVShowConvertInternationalString(gStringVar1, show->smartshopperShow.playerName, show->smartshopperShow.language);
StringCopy(gStringVar2, ItemId_GetName(show->smartshopperShow.itemIds[0]));
ConvertIntToDecimalString(2, show->smartshopperShow.itemAmounts[0]);
- sTVShowState += 1 + (Random() % 4);
+ // Pick a random comment (SMARTSHOPPER_STATE_RAND_COMMENT_#)
+ sTVShowState += SMARTSHOPPER_STATE_CLERK_NORMAL + (Random() % (SMARTSHOPPER_STATE_RAND_COMMENT_4 - SMARTSHOPPER_STATE_RAND_COMMENT_1 + 1));
break;
- case 2:
- case 4:
- case 5:
+ case SMARTSHOPPER_STATE_RAND_COMMENT_1:
+ case SMARTSHOPPER_STATE_RAND_COMMENT_3:
+ case SMARTSHOPPER_STATE_RAND_COMMENT_4:
if (show->smartshopperShow.itemIds[1] != ITEM_NONE)
- sTVShowState = 6;
+ sTVShowState = SMARTSHOPPER_STATE_SECOND_ITEM;
else
- sTVShowState = 10;
+ sTVShowState = SMARTSHOPPER_STATE_IS_VIP;
break;
- case 3:
+ case SMARTSHOPPER_STATE_RAND_COMMENT_2:
ConvertIntToDecimalString(2, show->smartshopperShow.itemAmounts[0] + 1);
if (show->smartshopperShow.itemIds[1] != ITEM_NONE)
- sTVShowState = 6;
+ sTVShowState = SMARTSHOPPER_STATE_SECOND_ITEM;
else
- sTVShowState = 10;
+ sTVShowState = SMARTSHOPPER_STATE_IS_VIP;
break;
- case 6:
+ case SMARTSHOPPER_STATE_SECOND_ITEM:
+ // Clerk describes 2nd type of item player purchased
StringCopy(gStringVar2, ItemId_GetName(show->smartshopperShow.itemIds[1]));
ConvertIntToDecimalString(2, show->smartshopperShow.itemAmounts[1]);
if (show->smartshopperShow.itemIds[2] != ITEM_NONE)
- sTVShowState = 7;
+ sTVShowState = SMARTSHOPPER_STATE_THIRD_ITEM;
else if (show->smartshopperShow.priceReduced == TRUE)
- sTVShowState = 8;
+ sTVShowState = SMARTSHOPPER_STATE_DURING_SALE;
else
- sTVShowState = 9;
+ sTVShowState = SMARTSHOPPER_STATE_OUTRO_NORMAL;
break;
- case 7:
+ case SMARTSHOPPER_STATE_THIRD_ITEM:
+ // Clerk describes 3rd type of item player purchased
StringCopy(gStringVar2, ItemId_GetName(show->smartshopperShow.itemIds[2]));
ConvertIntToDecimalString(2, show->smartshopperShow.itemAmounts[2]);
if (show->smartshopperShow.priceReduced == TRUE)
- sTVShowState = 8;
+ sTVShowState = SMARTSHOPPER_STATE_DURING_SALE;
else
- sTVShowState = 9;
+ sTVShowState = SMARTSHOPPER_STATE_OUTRO_NORMAL;
break;
- case 8:
+ case SMARTSHOPPER_STATE_DURING_SALE:
if (show->smartshopperShow.itemAmounts[0] >= 255)
- sTVShowState = 12;
+ sTVShowState = SMARTSHOPPER_STATE_OUTRO_MAX;
else
- sTVShowState = 9;
+ sTVShowState = SMARTSHOPPER_STATE_OUTRO_NORMAL;
break;
- case 9:
- sub_80EF40C(1, show);
+ case SMARTSHOPPER_STATE_OUTRO_NORMAL:
+ SmartShopper_BufferPurchaseTotal(1, show);
TVShowDone();
break;
- case 10:
+ case SMARTSHOPPER_STATE_IS_VIP:
+ // Clerk says customer is a VIP
+ // Said if player only purchased one type of item
if (show->smartshopperShow.priceReduced == TRUE)
- sTVShowState = 8;
+ sTVShowState = SMARTSHOPPER_STATE_DURING_SALE;
else
- sTVShowState = 9;
+ sTVShowState = SMARTSHOPPER_STATE_OUTRO_NORMAL;
break;
- case 11:
+ case SMARTSHOPPER_STATE_CLERK_MAX:
+ // Clerk's comments if player purchased maximum number of 1st item
TVShowConvertInternationalString(gStringVar1, show->smartshopperShow.playerName, show->smartshopperShow.language);
StringCopy(gStringVar2, ItemId_GetName(show->smartshopperShow.itemIds[0]));
if (show->smartshopperShow.priceReduced == TRUE)
- sTVShowState = 8;
+ sTVShowState = SMARTSHOPPER_STATE_DURING_SALE;
else
- sTVShowState = 12;
+ sTVShowState = SMARTSHOPPER_STATE_OUTRO_MAX;
break;
- case 12:
+ case SMARTSHOPPER_STATE_OUTRO_MAX:
+ // Outro comments if player purchased maximum number of 1st item
TVShowConvertInternationalString(gStringVar1, show->smartshopperShow.playerName, show->smartshopperShow.language);
TVShowDone();
break;