summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/ereader_screen.c8
-rw-r--r--src/field_player_avatar.c105
-rw-r--r--src/field_specials.c3
-rw-r--r--src/naming_screen.c6
-rw-r--r--src/pokedex.c2
-rw-r--r--src/pokemon.c9
-rw-r--r--src/pokemon_storage_system.c135
7 files changed, 129 insertions, 139 deletions
diff --git a/src/ereader_screen.c b/src/ereader_screen.c
index f98a0247d..a22b85bab 100755
--- a/src/ereader_screen.c
+++ b/src/ereader_screen.c
@@ -41,8 +41,8 @@ static void Task_EReader(u8);
struct EReaderData gEReaderData;
-extern const u8 gEReaderLinkData_Start[];
-extern const u8 gEReaderLinkData_End[];
+extern const u8 gMultiBootProgram_EReader_Start[];
+extern const u8 gMultiBootProgram_EReader_End[];
static void EReader_Load(struct EReaderData *eReader, int size, u32 *data)
{
@@ -397,8 +397,8 @@ static void Task_EReader(u8 taskId)
break;
case ER_STATE_CONNECTING:
AddTextPrinterToWindow1(gJPText_Connecting);
- // XXX: This (u32*) cast is discarding the const qualifier from gEReaderLinkData_Start
- EReader_Load(&gEReaderData, gEReaderLinkData_End - gEReaderLinkData_Start, (u32*)gEReaderLinkData_Start);
+ // XXX: This (u32*) cast is discarding the const qualifier from gMultiBootProgram_EReader_Start
+ EReader_Load(&gEReaderData, gMultiBootProgram_EReader_End - gMultiBootProgram_EReader_Start, (u32*)gMultiBootProgram_EReader_Start);
data->state = ER_STATE_TRANSFER;
break;
case ER_STATE_TRANSFER:
diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c
index 3c0276a27..fce23ee8e 100644
--- a/src/field_player_avatar.c
+++ b/src/field_player_avatar.c
@@ -30,6 +30,9 @@
#include "constants/songs.h"
#include "constants/trainer_types.h"
+#define NUM_FORCED_MOVEMENTS 18
+#define NUM_ACRO_BIKE_COLLISIONS 5
+
static EWRAM_DATA u8 sSpinStartFacingDir = 0;
EWRAM_DATA struct ObjectEvent gObjectEvents[OBJECT_EVENTS_COUNT] = {};
EWRAM_DATA struct PlayerAvatar gPlayerAvatar = {};
@@ -139,9 +142,7 @@ static void AlignFishingAnimationFrames(void);
static u8 TrySpinPlayerForWarp(struct ObjectEvent *object, s16 *a1);
-// .rodata
-
-static bool8 (*const sForcedMovementTestFuncs[])(u8) =
+static bool8 (*const sForcedMovementTestFuncs[NUM_FORCED_MOVEMENTS])(u8) =
{
MetatileBehavior_IsTrickHouseSlipperyFloor,
MetatileBehavior_IsIce_2,
@@ -163,7 +164,8 @@ static bool8 (*const sForcedMovementTestFuncs[])(u8) =
MetatileBehavior_IsMuddySlope,
};
-static bool8 (*const sForcedMovementFuncs[])(void) =
+// + 1 for ForcedMovement_None, which is excluded above
+static bool8 (*const sForcedMovementFuncs[NUM_FORCED_MOVEMENTS + 1])(void) =
{
ForcedMovement_None,
ForcedMovement_Slip,
@@ -188,12 +190,12 @@ static bool8 (*const sForcedMovementFuncs[])(void) =
static void (*const sPlayerNotOnBikeFuncs[])(u8, u16) =
{
- PlayerNotOnBikeNotMoving,
- PlayerNotOnBikeTurningInPlace,
- PlayerNotOnBikeMoving,
+ [NOT_MOVING] = PlayerNotOnBikeNotMoving,
+ [TURN_DIRECTION] = PlayerNotOnBikeTurningInPlace,
+ [MOVING] = PlayerNotOnBikeMoving,
};
-static bool8 (*const sAcroBikeTrickMetatiles[])(u8) =
+static bool8 (*const sAcroBikeTrickMetatiles[NUM_ACRO_BIKE_COLLISIONS])(u8) =
{
MetatileBehavior_IsBumpySlope,
MetatileBehavior_IsIsolatedVerticalRail,
@@ -202,7 +204,7 @@ static bool8 (*const sAcroBikeTrickMetatiles[])(u8) =
MetatileBehavior_IsHorizontalRail,
};
-static const u8 sAcroBikeTrickCollisionTypes[] = {
+static const u8 sAcroBikeTrickCollisionTypes[NUM_ACRO_BIKE_COLLISIONS] = {
COLLISION_WHEELIE_HOP,
COLLISION_ISOLATED_VERTICAL_RAIL,
COLLISION_ISOLATED_HORIZONTAL_RAIL,
@@ -232,33 +234,41 @@ static bool8 (*const sArrowWarpMetatileBehaviorChecks[])(u8) =
static const u8 sRivalAvatarGfxIds[][2] =
{
- {OBJ_EVENT_GFX_RIVAL_BRENDAN_NORMAL, OBJ_EVENT_GFX_RIVAL_MAY_NORMAL},
- {OBJ_EVENT_GFX_RIVAL_BRENDAN_MACH_BIKE, OBJ_EVENT_GFX_RIVAL_MAY_MACH_BIKE},
- {OBJ_EVENT_GFX_RIVAL_BRENDAN_ACRO_BIKE, OBJ_EVENT_GFX_RIVAL_MAY_ACRO_BIKE},
- {OBJ_EVENT_GFX_RIVAL_BRENDAN_SURFING, OBJ_EVENT_GFX_RIVAL_MAY_SURFING},
- {OBJ_EVENT_GFX_BRENDAN_UNDERWATER, OBJ_EVENT_GFX_MAY_UNDERWATER},
- {OBJ_EVENT_GFX_RIVAL_BRENDAN_FIELD_MOVE, OBJ_EVENT_GFX_RIVAL_MAY_FIELD_MOVE},
- {OBJ_EVENT_GFX_BRENDAN_FISHING, OBJ_EVENT_GFX_MAY_FISHING},
- {OBJ_EVENT_GFX_BRENDAN_WATERING, OBJ_EVENT_GFX_MAY_WATERING}
+ [PLAYER_AVATAR_STATE_NORMAL] = {OBJ_EVENT_GFX_RIVAL_BRENDAN_NORMAL, OBJ_EVENT_GFX_RIVAL_MAY_NORMAL},
+ [PLAYER_AVATAR_STATE_MACH_BIKE] = {OBJ_EVENT_GFX_RIVAL_BRENDAN_MACH_BIKE, OBJ_EVENT_GFX_RIVAL_MAY_MACH_BIKE},
+ [PLAYER_AVATAR_STATE_ACRO_BIKE] = {OBJ_EVENT_GFX_RIVAL_BRENDAN_ACRO_BIKE, OBJ_EVENT_GFX_RIVAL_MAY_ACRO_BIKE},
+ [PLAYER_AVATAR_STATE_SURFING] = {OBJ_EVENT_GFX_RIVAL_BRENDAN_SURFING, OBJ_EVENT_GFX_RIVAL_MAY_SURFING},
+ [PLAYER_AVATAR_STATE_UNDERWATER] = {OBJ_EVENT_GFX_BRENDAN_UNDERWATER, OBJ_EVENT_GFX_MAY_UNDERWATER},
+ [PLAYER_AVATAR_STATE_FIELD_MOVE] = {OBJ_EVENT_GFX_RIVAL_BRENDAN_FIELD_MOVE, OBJ_EVENT_GFX_RIVAL_MAY_FIELD_MOVE},
+ [PLAYER_AVATAR_STATE_FISHING] = {OBJ_EVENT_GFX_BRENDAN_FISHING, OBJ_EVENT_GFX_MAY_FISHING},
+ [PLAYER_AVATAR_STATE_WATERING] = {OBJ_EVENT_GFX_BRENDAN_WATERING, OBJ_EVENT_GFX_MAY_WATERING}
};
static const u8 sPlayerAvatarGfxIds[][2] =
{
- {OBJ_EVENT_GFX_BRENDAN_NORMAL, OBJ_EVENT_GFX_MAY_NORMAL},
- {OBJ_EVENT_GFX_BRENDAN_MACH_BIKE, OBJ_EVENT_GFX_MAY_MACH_BIKE},
- {OBJ_EVENT_GFX_BRENDAN_ACRO_BIKE, OBJ_EVENT_GFX_MAY_ACRO_BIKE},
- {OBJ_EVENT_GFX_BRENDAN_SURFING, OBJ_EVENT_GFX_MAY_SURFING},
- {OBJ_EVENT_GFX_BRENDAN_UNDERWATER, OBJ_EVENT_GFX_MAY_UNDERWATER},
- {OBJ_EVENT_GFX_BRENDAN_FIELD_MOVE, OBJ_EVENT_GFX_MAY_FIELD_MOVE},
- {OBJ_EVENT_GFX_BRENDAN_FISHING, OBJ_EVENT_GFX_MAY_FISHING},
- {OBJ_EVENT_GFX_BRENDAN_WATERING, OBJ_EVENT_GFX_MAY_WATERING},
+ [PLAYER_AVATAR_STATE_NORMAL] = {OBJ_EVENT_GFX_BRENDAN_NORMAL, OBJ_EVENT_GFX_MAY_NORMAL},
+ [PLAYER_AVATAR_STATE_MACH_BIKE] = {OBJ_EVENT_GFX_BRENDAN_MACH_BIKE, OBJ_EVENT_GFX_MAY_MACH_BIKE},
+ [PLAYER_AVATAR_STATE_ACRO_BIKE] = {OBJ_EVENT_GFX_BRENDAN_ACRO_BIKE, OBJ_EVENT_GFX_MAY_ACRO_BIKE},
+ [PLAYER_AVATAR_STATE_SURFING] = {OBJ_EVENT_GFX_BRENDAN_SURFING, OBJ_EVENT_GFX_MAY_SURFING},
+ [PLAYER_AVATAR_STATE_UNDERWATER] = {OBJ_EVENT_GFX_BRENDAN_UNDERWATER, OBJ_EVENT_GFX_MAY_UNDERWATER},
+ [PLAYER_AVATAR_STATE_FIELD_MOVE] = {OBJ_EVENT_GFX_BRENDAN_FIELD_MOVE, OBJ_EVENT_GFX_MAY_FIELD_MOVE},
+ [PLAYER_AVATAR_STATE_FISHING] = {OBJ_EVENT_GFX_BRENDAN_FISHING, OBJ_EVENT_GFX_MAY_FISHING},
+ [PLAYER_AVATAR_STATE_WATERING] = {OBJ_EVENT_GFX_BRENDAN_WATERING, OBJ_EVENT_GFX_MAY_WATERING},
};
-static const u8 sFRLGAvatarGfxIds[] = {OBJ_EVENT_GFX_RED, OBJ_EVENT_GFX_LEAF};
+static const u8 sFRLGAvatarGfxIds[GENDER_COUNT] =
+{
+ [MALE] = OBJ_EVENT_GFX_RED,
+ [FEMALE] = OBJ_EVENT_GFX_LEAF
+};
-static const u8 sRSAvatarGfxIds[] = {OBJ_EVENT_GFX_LINK_RS_BRENDAN, OBJ_EVENT_GFX_LINK_RS_MAY};
+static const u8 sRSAvatarGfxIds[GENDER_COUNT] =
+{
+ [MALE] = OBJ_EVENT_GFX_LINK_RS_BRENDAN,
+ [FEMALE] = OBJ_EVENT_GFX_LINK_RS_MAY
+};
-static const u8 sPlayerAvatarGfxToStateFlag[2][5][2] =
+static const u8 sPlayerAvatarGfxToStateFlag[GENDER_COUNT][5][2] =
{
[MALE] =
{
@@ -306,8 +316,6 @@ static bool8 (*const sPlayerAvatarSecretBaseMatSpin[])(struct Task *, struct Obj
PlayerAvatar_SecretBaseMatSpinStep3,
};
-// .text
-
void MovementType_Player(struct Sprite *sprite)
{
UpdateObjectEventCurrentMovement(&gObjectEvents[sprite->data[0]], sprite, ObjectEventCB2_NoMovement2);
@@ -406,7 +414,7 @@ static u8 GetForcedMovementByMetatileBehavior(void)
{
u8 metatileBehavior = gObjectEvents[gPlayerAvatar.objectEventId].currentMetatileBehavior;
- for (i = 0; i < 18; i++)
+ for (i = 0; i < NUM_FORCED_MOVEMENTS; i++)
{
if (sForcedMovementTestFuncs[i](metatileBehavior))
return i + 1;
@@ -429,7 +437,7 @@ static bool8 ForcedMovement_None(void)
return FALSE;
}
-static u8 DoForcedMovement(u8 direction, void (*b)(u8))
+static bool8 DoForcedMovement(u8 direction, void (*moveFunc)(u8))
{
struct PlayerAvatar *playerAvatar = &gPlayerAvatar;
u8 collision = CheckForPlayerAvatarCollision(direction);
@@ -440,7 +448,7 @@ static u8 DoForcedMovement(u8 direction, void (*b)(u8))
ForcedMovement_None();
if (collision < COLLISION_STOP_SURFING)
{
- return 0;
+ return FALSE;
}
else
{
@@ -448,23 +456,23 @@ static u8 DoForcedMovement(u8 direction, void (*b)(u8))
PlayerJumpLedge(direction);
playerAvatar->flags |= PLAYER_AVATAR_FLAG_FORCED_MOVE;
playerAvatar->runningState = MOVING;
- return 1;
+ return TRUE;
}
}
else
{
playerAvatar->runningState = MOVING;
- b(direction);
- return 1;
+ moveFunc(direction);
+ return TRUE;
}
}
-static u8 DoForcedMovementInCurrentDirection(void (*a)(u8))
+static bool8 DoForcedMovementInCurrentDirection(void (*moveFunc)(u8))
{
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
playerObjEvent->disableAnim = TRUE;
- return DoForcedMovement(playerObjEvent->movementDirection, a);
+ return DoForcedMovement(playerObjEvent->movementDirection, moveFunc);
}
static bool8 ForcedMovement_Slip(void)
@@ -512,13 +520,13 @@ static bool8 ForcedMovement_PushedEastByCurrent(void)
return DoForcedMovement(DIR_EAST, PlayerRideWaterCurrent);
}
-static u8 ForcedMovement_Slide(u8 direction, void (*b)(u8))
+static bool8 ForcedMovement_Slide(u8 direction, void (*moveFunc)(u8))
{
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
playerObjEvent->disableAnim = TRUE;
playerObjEvent->facingDirectionLocked = TRUE;
- return DoForcedMovement(direction, b);
+ return DoForcedMovement(direction, moveFunc);
}
static bool8 ForcedMovement_SlideSouth(void)
@@ -577,20 +585,11 @@ static void MovePlayerNotOnBike(u8 direction, u16 heldKeys)
static u8 CheckMovementInputNotOnBike(u8 direction)
{
if (direction == DIR_NONE)
- {
- gPlayerAvatar.runningState = NOT_MOVING;
- return 0;
- }
+ return gPlayerAvatar.runningState = NOT_MOVING;
else if (direction != GetPlayerMovementDirection() && gPlayerAvatar.runningState != MOVING)
- {
- gPlayerAvatar.runningState = TURN_DIRECTION;
- return 1;
- }
+ return gPlayerAvatar.runningState = TURN_DIRECTION;
else
- {
- gPlayerAvatar.runningState = MOVING;
- return 2;
- }
+ return gPlayerAvatar.runningState = MOVING;
}
static void PlayerNotOnBikeNotMoving(u8 direction, u16 heldKeys)
@@ -755,7 +754,7 @@ static void CheckAcroBikeCollision(s16 x, s16 y, u8 metatileBehavior, u8 *collis
{
u8 i;
- for (i = 0; i < ARRAY_COUNT(sAcroBikeTrickMetatiles); i++)
+ for (i = 0; i < NUM_ACRO_BIKE_COLLISIONS; i++)
{
if (sAcroBikeTrickMetatiles[i](metatileBehavior))
{
diff --git a/src/field_specials.c b/src/field_specials.c
index d97a17a7d..0a7236913 100644
--- a/src/field_specials.c
+++ b/src/field_specials.c
@@ -932,9 +932,8 @@ u16 GetWeekCount(void)
{
u16 weekCount = gLocalTime.days / 7;
if (weekCount > 9999)
- {
weekCount = 9999;
- }
+
return weekCount;
}
diff --git a/src/naming_screen.c b/src/naming_screen.c
index 5aef44f14..0019a51b1 100644
--- a/src/naming_screen.c
+++ b/src/naming_screen.c
@@ -1408,10 +1408,10 @@ static void NamingScreen_CreatePlayerIcon(void)
u8 rivalGfxId;
u8 spriteId;
- rivalGfxId = GetRivalAvatarGraphicsIdByStateIdAndGender(0, sNamingScreen->monSpecies);
+ rivalGfxId = GetRivalAvatarGraphicsIdByStateIdAndGender(PLAYER_AVATAR_STATE_NORMAL, sNamingScreen->monSpecies);
spriteId = CreateObjectGraphicsSprite(rivalGfxId, SpriteCallbackDummy, 56, 37, 0);
gSprites[spriteId].oam.priority = 3;
- StartSpriteAnim(&gSprites[spriteId], 4);
+ StartSpriteAnim(&gSprites[spriteId], ANIM_STD_GO_SOUTH);
}
static void NamingScreen_CreatePCIcon(void)
@@ -1438,7 +1438,7 @@ static void NamingScreen_CreateWaldaDadIcon(void)
spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_MAN_1, SpriteCallbackDummy, 56, 37, 0);
gSprites[spriteId].oam.priority = 3;
- StartSpriteAnim(&gSprites[spriteId], 4);
+ StartSpriteAnim(&gSprites[spriteId], ANIM_STD_GO_SOUTH);
}
//--------------------------------------------------
diff --git a/src/pokedex.c b/src/pokedex.c
index b41937302..206782e59 100644
--- a/src/pokedex.c
+++ b/src/pokedex.c
@@ -1512,7 +1512,7 @@ void ResetPokedex(void)
gSaveBlock2Ptr->pokedex.spindaPersonality = 0;
gSaveBlock2Ptr->pokedex.unknown3 = 0;
DisableNationalPokedex();
- for (i = 0; i < DEX_FLAGS_NO; i++)
+ for (i = 0; i < NUM_DEX_FLAG_BYTES; i++)
{
gSaveBlock2Ptr->pokedex.owned[i] = 0;
gSaveBlock2Ptr->pokedex.seen[i] = 0;
diff --git a/src/pokemon.c b/src/pokemon.c
index 939c2429d..9476dbb2e 100644
--- a/src/pokemon.c
+++ b/src/pokemon.c
@@ -88,11 +88,14 @@ static const struct CombinedMove sCombinedMoves[2] =
{0xFFFF, 0xFFFF, 0xFFFF}
};
+// NOTE: The order of the elements in the 3 arrays below is irrelevant.
+// To reorder the pokedex, see the values in include/constants/pokedex.h.
+
#define SPECIES_TO_HOENN(name) [SPECIES_##name - 1] = HOENN_DEX_##name
#define SPECIES_TO_NATIONAL(name) [SPECIES_##name - 1] = NATIONAL_DEX_##name
#define HOENN_TO_NATIONAL(name) [HOENN_DEX_##name - 1] = NATIONAL_DEX_##name
- // Assigns all species to the Hoenn Dex Index (Summary No. for Hoenn Dex)
+// Assigns all species to the Hoenn Dex Index (Summary No. for Hoenn Dex)
static const u16 sSpeciesToHoennPokedexNum[NUM_SPECIES - 1] =
{
SPECIES_TO_HOENN(BULBASAUR),
@@ -508,7 +511,7 @@ static const u16 sSpeciesToHoennPokedexNum[NUM_SPECIES - 1] =
SPECIES_TO_HOENN(CHIMECHO),
};
- // Assigns all species to the National Dex Index (Summary No. for National Dex)
+// Assigns all species to the National Dex Index (Summary No. for National Dex)
static const u16 sSpeciesToNationalPokedexNum[NUM_SPECIES - 1] =
{
SPECIES_TO_NATIONAL(BULBASAUR),
@@ -924,7 +927,7 @@ static const u16 sSpeciesToNationalPokedexNum[NUM_SPECIES - 1] =
SPECIES_TO_NATIONAL(CHIMECHO),
};
- // Assigns all Hoenn Dex Indexes to a National Dex Index
+// Assigns all Hoenn Dex Indexes to a National Dex Index
static const u16 sHoennToNationalOrder[NUM_SPECIES - 1] =
{
HOENN_TO_NATIONAL(TREECKO),
diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c
index 755cc7de0..8bf12c2bd 100644
--- a/src/pokemon_storage_system.c
+++ b/src/pokemon_storage_system.c
@@ -331,6 +331,13 @@ enum {
TILEMAPID_COUNT
};
+// Window IDs for sWindowTemplates
+enum {
+ WIN_DISPLAY_INFO,
+ WIN_MESSAGE,
+ WIN_ITEM_DESC,
+};
+
struct Wallpaper
{
const u32 *tiles;
@@ -939,49 +946,31 @@ static const union AffineAnimCmd *const sAffineAnims_ChooseBoxMenu[] =
static const u8 sChooseBoxMenu_TextColors[] = {TEXT_COLOR_RED, TEXT_DYNAMIC_COLOR_6, TEXT_DYNAMIC_COLOR_5};
static const u8 sText_OutOf30[] = _("/30");
-static const u16 sChooseBoxMenu_Pal[] = INCBIN_U16("graphics/pokemon_storage/box_selection_popup.gbapal");
-static const u8 sChooseBoxMenuCenter_Gfx[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_center.4bpp");
-static const u8 sChooseBoxMenuSides_Gfx[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_sides.4bpp");
-static const u32 sScrollingBg_Gfx[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.4bpp.lz");
-static const u32 sScrollingBg_Tilemap[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.bin.lz");
-static const u16 sDisplayMenu_Pal[] = INCBIN_U16("graphics/pokemon_storage/display_menu.gbapal"); // Unused
-static const u32 sDisplayMenu_Tilemap[] = INCBIN_U32("graphics/pokemon_storage/display_menu.bin.lz");
-
-static const u16 sPkmnData_Tilemap[] =
-{
- 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x0108, 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, 0x0117, 0x0118,
- 0x2101, 0x2102, 0x2103, 0x2104, 0x2105, 0x2106, 0x2107, 0x2108, 0x2111, 0x2112, 0x2113, 0x2114, 0x2115, 0x2116, 0x2117, 0x2118,
-};
-
+static const u16 sChooseBoxMenu_Pal[] = INCBIN_U16("graphics/pokemon_storage/box_selection_popup.gbapal");
+static const u8 sChooseBoxMenuCenter_Gfx[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_center.4bpp");
+static const u8 sChooseBoxMenuSides_Gfx[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_sides.4bpp");
+static const u32 sScrollingBg_Gfx[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.4bpp.lz");
+static const u32 sScrollingBg_Tilemap[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.bin.lz");
+static const u16 sDisplayMenu_Pal[] = INCBIN_U16("graphics/pokemon_storage/display_menu.gbapal"); // Unused
+static const u32 sDisplayMenu_Tilemap[] = INCBIN_U32("graphics/pokemon_storage/display_menu.bin.lz");
+static const u16 sPkmnData_Tilemap[] = INCBIN_U16("graphics/pokemon_storage/pkmn_data.bin");
// sInterface_Pal - parts of the display frame, "PkmnData"'s normal color, Close Box
-static const u16 sInterface_Pal[] = INCBIN_U16("graphics/pokemon_storage/interface.gbapal");
-static const u16 sPkmnDataGray_Pal[] = INCBIN_U16("graphics/pokemon_storage/pkmn_data_gray.gbapal");
-static const u16 sBg_Pal[] = INCBIN_U16("graphics/pokemon_storage/bg.gbapal");
-static const u16 sBgMoveItems_Pal[] = INCBIN_U16("graphics/pokemon_storage/bg_move_items.gbapal");
-
-static const u16 sCloseBoxButton_Tilemap[] =
-{
- 0x014c, 0x014d, 0x014e, 0x014f, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x015c, 0x015d, 0x015e, 0x015f, 0x0180, 0x0181, 0x0182,
- 0x0183, 0x0184, 0x0175, 0x0176, 0x0177, 0x0178, 0x0179, 0x017a, 0x017b, 0x017c, 0x017d, 0x0185, 0x0186, 0x0187, 0x0188, 0x0189,
- 0x018a, 0x018b, 0x018c, 0x018d
-};
-static const u16 sPartySlotFilled_Tilemap[] =
-{
- 0x1140, 0x1141, 0x1141, 0x1142, 0x1150, 0x1151, 0x1151, 0x1152, 0x1160, 0x1161, 0x1161, 0x1162,
-};
-static const u16 sPartySlotEmpty_Tilemap[] =
-{
- 0x1143, 0x1144, 0x1144, 0x1145, 0x1153, 0x1154, 0x1154, 0x1155, 0x1163, 0x1164, 0x1164, 0x1165,
-};
-
-static const u16 sWaveform_Pal[] = INCBIN_U16("graphics/pokemon_storage/waveform.gbapal");
-static const u32 sWaveform_Gfx[] = INCBIN_U32("graphics/pokemon_storage/waveform.4bpp");
-static const u16 sUnused_Pal[] = INCBIN_U16("graphics/pokemon_storage/unused.gbapal");
-static const u16 sUnknown_Pal[] = INCBIN_U16("graphics/pokemon_storage/unknown.gbapal");
+static const u16 sInterface_Pal[] = INCBIN_U16("graphics/pokemon_storage/interface.gbapal");
+static const u16 sPkmnDataGray_Pal[] = INCBIN_U16("graphics/pokemon_storage/pkmn_data_gray.gbapal");
+static const u16 sBg_Pal[] = INCBIN_U16("graphics/pokemon_storage/bg.gbapal");
+static const u16 sBgMoveItems_Pal[] = INCBIN_U16("graphics/pokemon_storage/bg_move_items.gbapal");
+static const u16 sCloseBoxButton_Tilemap[] = INCBIN_U16("graphics/pokemon_storage/close_box_button.bin");
+static const u16 sPartySlotFilled_Tilemap[] = INCBIN_U16("graphics/pokemon_storage/party_slot_filled.bin");
+static const u16 sPartySlotEmpty_Tilemap[] = INCBIN_U16("graphics/pokemon_storage/party_slot_empty.bin");
+static const u16 sWaveform_Pal[] = INCBIN_U16("graphics/pokemon_storage/waveform.gbapal");
+static const u32 sWaveform_Gfx[] = INCBIN_U32("graphics/pokemon_storage/waveform.4bpp");
+static const u16 sUnused_Pal[] = INCBIN_U16("graphics/pokemon_storage/unused.gbapal");
+static const u16 sTextWindows_Pal[] = INCBIN_U16("graphics/pokemon_storage/text_windows.gbapal");
static const struct WindowTemplate sWindowTemplates[] =
{
- {
+ // The panel below the currently displayed Pokémon
+ [WIN_DISPLAY_INFO] = {
.bg = 1,
.tilemapLeft = 0,
.tilemapTop = 11,
@@ -990,7 +979,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 3,
.baseBlock = 0xC0,
},
- {
+ [WIN_MESSAGE] = {
.bg = 0,
.tilemapLeft = 11,
.tilemapTop = 17,
@@ -999,7 +988,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x14,
},
- {
+ [WIN_ITEM_DESC] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 13,
@@ -1349,7 +1338,7 @@ void DrawTextWindowAndBufferTiles(const u8 *string, void *dst, u8 zero1, u8 zero
windowId = AddWindow(&winTemplate);
FillWindowPixelBuffer(windowId, PIXEL_FILL(zero2));
tileData1 = (u8*) GetWindowAttribute(windowId, WINDOW_TILE_DATA);
- tileData2 = (winTemplate.width * 32) + tileData1;
+ tileData2 = (winTemplate.width * TILE_SIZE_4BPP) + tileData1;
if (!zero1)
txtColor[0] = TEXT_COLOR_TRANSPARENT;
@@ -1385,7 +1374,7 @@ void DrawTextWindowAndBufferTiles(const u8 *string, void *dst, u8 zero1, u8 zero
// Unused
static void UnusedDrawTextWindow(const u8 *string, void *dst, u16 offset, u8 bgColor, u8 fgColor, u8 shadowColor)
{
- u32 tileSize;
+ u32 tilesSize;
u8 windowId;
u8 txtColor[3];
u8 *tileData1, *tileData2;
@@ -1393,17 +1382,17 @@ static void UnusedDrawTextWindow(const u8 *string, void *dst, u16 offset, u8 bgC
winTemplate.width = StringLength_Multibyte(string);
winTemplate.height = 2;
- tileSize = winTemplate.width * 32;
+ tilesSize = winTemplate.width * TILE_SIZE_4BPP;
windowId = AddWindow(&winTemplate);
FillWindowPixelBuffer(windowId, PIXEL_FILL(bgColor));
tileData1 = (u8*) GetWindowAttribute(windowId, WINDOW_TILE_DATA);
- tileData2 = (winTemplate.width * 32) + tileData1;
+ tileData2 = (winTemplate.width * TILE_SIZE_4BPP) + tileData1;
txtColor[0] = bgColor;
txtColor[1] = fgColor;
txtColor[2] = shadowColor;
AddTextPrinterParameterized4(windowId, FONT_NORMAL, 0, 2, 0, 0, txtColor, TEXT_SKIP_DRAW, string);
- CpuCopy16(tileData1, dst, tileSize);
- CpuCopy16(tileData2, dst + offset, tileSize);
+ CpuCopy16(tileData1, dst, tilesSize);
+ CpuCopy16(tileData2, dst + offset, tilesSize);
RemoveWindow(windowId);
}
@@ -2136,10 +2125,10 @@ static void Task_InitPokeStorage(u8 taskId)
}
break;
case 2:
- PutWindowTilemap(0);
- ClearWindowTilemap(1);
+ PutWindowTilemap(WIN_DISPLAY_INFO);
+ ClearWindowTilemap(WIN_MESSAGE);
CpuFill32(0, (void *)VRAM, 0x200);
- LoadUserWindowBorderGfx(1, 0xB, 0xE0);
+ LoadUserWindowBorderGfx(WIN_MESSAGE, 0xB, 0xE0);
break;
case 3:
ResetAllBgCoords();
@@ -3862,7 +3851,7 @@ static void InitPalettesAndSprites(void)
{
LoadPalette(sInterface_Pal, 0, sizeof(sInterface_Pal));
LoadPalette(sPkmnDataGray_Pal, 0x20, sizeof(sPkmnDataGray_Pal));
- LoadPalette(sUnknown_Pal, 0xF0, sizeof(sUnknown_Pal));
+ LoadPalette(sTextWindows_Pal, 0xF0, sizeof(sTextWindows_Pal));
if (sStorage->boxOption != OPTION_MOVE_ITEMS)
LoadPalette(sBg_Pal, 0x30, sizeof(sBg_Pal));
else
@@ -3970,7 +3959,7 @@ static void CreateDisplayMonSprite(void)
sStorage->displayMonSprite = &gSprites[spriteId];
sStorage->displayMonPalOffset = palSlot * 16 + 0x100;
- sStorage->displayMonTilePtr = (void*) OBJ_VRAM0 + tileStart * 32;
+ sStorage->displayMonTilePtr = (void*) OBJ_VRAM0 + tileStart * TILE_SIZE_4BPP;
} while (0);
if (sStorage->displayMonSprite == NULL)
@@ -4001,23 +3990,23 @@ static void LoadDisplayMonGfx(u16 species, u32 pid)
static void PrintDisplayMonInfo(void)
{
- FillWindowPixelBuffer(0, PIXEL_FILL(1));
+ FillWindowPixelBuffer(WIN_DISPLAY_INFO, PIXEL_FILL(1));
if (sStorage->boxOption != OPTION_MOVE_ITEMS)
{
- AddTextPrinterParameterized(0, FONT_NORMAL, sStorage->displayMonNameText, 6, 0, TEXT_SKIP_DRAW, NULL);
- AddTextPrinterParameterized(0, FONT_SHORT, sStorage->displayMonSpeciesName, 6, 15, TEXT_SKIP_DRAW, NULL);
- AddTextPrinterParameterized(0, FONT_SHORT, sStorage->displayMonGenderLvlText, 10, 29, TEXT_SKIP_DRAW, NULL);
- AddTextPrinterParameterized(0, FONT_SMALL, sStorage->displayMonItemName, 6, 43, TEXT_SKIP_DRAW, NULL);
+ AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_NORMAL, sStorage->displayMonNameText, 6, 0, TEXT_SKIP_DRAW, NULL);
+ AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SHORT, sStorage->displayMonSpeciesName, 6, 15, TEXT_SKIP_DRAW, NULL);
+ AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SHORT, sStorage->displayMonGenderLvlText, 10, 29, TEXT_SKIP_DRAW, NULL);
+ AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SMALL, sStorage->displayMonItemName, 6, 43, TEXT_SKIP_DRAW, NULL);
}
else
{
- AddTextPrinterParameterized(0, FONT_SMALL, sStorage->displayMonItemName, 6, 0, TEXT_SKIP_DRAW, NULL);
- AddTextPrinterParameterized(0, FONT_NORMAL, sStorage->displayMonNameText, 6, 13, TEXT_SKIP_DRAW, NULL);
- AddTextPrinterParameterized(0, FONT_SHORT, sStorage->displayMonSpeciesName, 6, 28, TEXT_SKIP_DRAW, NULL);
- AddTextPrinterParameterized(0, FONT_SHORT, sStorage->displayMonGenderLvlText, 10, 42, TEXT_SKIP_DRAW, NULL);
+ AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SMALL, sStorage->displayMonItemName, 6, 0, TEXT_SKIP_DRAW, NULL);
+ AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_NORMAL, sStorage->displayMonNameText, 6, 13, TEXT_SKIP_DRAW, NULL);
+ AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SHORT, sStorage->displayMonSpeciesName, 6, 28, TEXT_SKIP_DRAW, NULL);
+ AddTextPrinterParameterized(WIN_DISPLAY_INFO, FONT_SHORT, sStorage->displayMonGenderLvlText, 10, 42, TEXT_SKIP_DRAW, NULL);
}
- CopyWindowToVram(0, COPYWIN_GFX);
+ CopyWindowToVram(WIN_DISPLAY_INFO, COPYWIN_GFX);
if (sStorage->displayMonSpecies != SPECIES_NONE)
{
UpdateMonMarkingTiles(sStorage->displayMonMarkings, sStorage->markingComboTilesPtr);
@@ -4278,7 +4267,7 @@ static void UpdateBoxToSendMons(void)
static void InitPokeStorageBg0(void)
{
SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(29));
- LoadUserWindowBorderGfx(1, 2, 208);
+ LoadUserWindowBorderGfx(WIN_MESSAGE, 2, 208);
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17);
CopyBgTilemapBufferToVram(0);
}
@@ -4317,11 +4306,11 @@ static void PrintMessage(u8 id)
}
DynamicPlaceholderTextUtil_ExpandPlaceholders(sStorage->messageText, sMessages[id].text);
- FillWindowPixelBuffer(1, PIXEL_FILL(1));
- AddTextPrinterParameterized(1, FONT_NORMAL, sStorage->messageText, 0, 1, TEXT_SKIP_DRAW, NULL);
- DrawTextBorderOuter(1, 2, 14);
- PutWindowTilemap(1);
- CopyWindowToVram(1, COPYWIN_GFX);
+ FillWindowPixelBuffer(WIN_MESSAGE, PIXEL_FILL(1));
+ AddTextPrinterParameterized(WIN_MESSAGE, FONT_NORMAL, sStorage->messageText, 0, 1, TEXT_SKIP_DRAW, NULL);
+ DrawTextBorderOuter(WIN_MESSAGE, 2, 14);
+ PutWindowTilemap(WIN_MESSAGE);
+ CopyWindowToVram(WIN_MESSAGE, COPYWIN_GFX);
ScheduleBgCopyTilemapToVram(0);
}
@@ -4333,7 +4322,7 @@ static void ShowYesNoWindow(s8 cursorPos)
static void ClearBottomWindow(void)
{
- ClearStdWindowAndFrameToTransparent(1, FALSE);
+ ClearStdWindowAndFrameToTransparent(WIN_MESSAGE, FALSE);
ScheduleBgCopyTilemapToVram(0);
}
@@ -5130,7 +5119,7 @@ static u16 TryLoadMonIconTiles(u16 species)
sStorage->iconSpeciesList[i] = species;
sStorage->numIconsPerSpecies[i]++;
offset = 16 * i;
- CpuCopy32(GetMonIconTiles(species, TRUE), (void*)(OBJ_VRAM0) + offset * 32, 0x200);
+ CpuCopy32(GetMonIconTiles(species, TRUE), (void*)(OBJ_VRAM0) + offset * TILE_SIZE_4BPP, 0x200);
return offset;
}
@@ -8755,7 +8744,7 @@ static void CreateItemIconSprites(void)
{
spriteSheet.tag = GFXTAG_ITEM_ICON_0 + i;
LoadCompressedSpriteSheet(&spriteSheet);
- sStorage->itemIcons[i].tiles = GetSpriteTileStartByTag(spriteSheet.tag) * 32 + (void*)(OBJ_VRAM0);
+ sStorage->itemIcons[i].tiles = GetSpriteTileStartByTag(spriteSheet.tag) * TILE_SIZE_4BPP + (void*)(OBJ_VRAM0);
sStorage->itemIcons[i].palIndex = AllocSpritePalette(PALTAG_ITEM_ICON_0 + i);
sStorage->itemIcons[i].palIndex *= 16;
sStorage->itemIcons[i].palIndex += 0x100;
@@ -9201,8 +9190,8 @@ static void PrintItemDescription(void)
else
description = ItemId_GetDescription(sStorage->displayMonItemId);
- FillWindowPixelBuffer(2, PIXEL_FILL(1));
- AddTextPrinterParameterized5(2, FONT_NORMAL, description, 4, 0, 0, NULL, 0, 1);
+ FillWindowPixelBuffer(WIN_ITEM_DESC, PIXEL_FILL(1));
+ AddTextPrinterParameterized5(WIN_ITEM_DESC, FONT_NORMAL, description, 4, 0, 0, NULL, 0, 1);
}
static void InitItemInfoWindow(void)