summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/battle_pyramid_bag.c90
-rw-r--r--src/battle_records.c21
-rw-r--r--src/berry_blender.c79
-rw-r--r--src/berry_tag_screen.c40
-rw-r--r--src/credits.c10
-rw-r--r--src/daycare.c11
-rw-r--r--src/decoration.c71
-rw-r--r--src/egg_hatch.c18
-rw-r--r--src/event_object_movement.c204
-rw-r--r--src/field_effect.c24
-rw-r--r--src/field_region_map.c23
-rw-r--r--src/field_specials.c4
-rw-r--r--src/fieldmap.c4
-rwxr-xr-xsrc/item_menu.c223
-rwxr-xr-xsrc/item_use.c2
-rw-r--r--src/main_menu.c126
-rw-r--r--src/menu.c18
-rw-r--r--src/mystery_event_menu.c20
-rw-r--r--src/naming_screen.c53
-rw-r--r--src/new_game.c2
-rw-r--r--src/option_menu.c20
-rw-r--r--src/overworld.c272
-rw-r--r--src/player_pc.c116
-rw-r--r--src/pokeblock.c121
-rw-r--r--src/pokemon_summary_screen.c393
-rw-r--r--src/rom_8011DC0.c4
-rw-r--r--src/safari_zone.c4
-rw-r--r--src/scrcmd.c22
-rw-r--r--src/secret_base.c6
-rw-r--r--src/wallclock.c103
30 files changed, 1599 insertions, 505 deletions
diff --git a/src/battle_pyramid_bag.c b/src/battle_pyramid_bag.c
index 8a5ce7a99..6629e6a0a 100644
--- a/src/battle_pyramid_bag.c
+++ b/src/battle_pyramid_bag.c
@@ -193,20 +193,92 @@ static const u8 sColorTable[][3] =
static const struct WindowTemplate gUnknown_0861F328[] =
{
- {0x00, 0x0e, 0x02, 0x0f, 0x10, 0x0f, 0x001e},
- {0x00, 0x00, 0x0d, 0x0e, 0x06, 0x0f, 0x010e},
- {0x01, 0x02, 0x0f, 0x1b, 0x04, 0x0f, 0x0162},
- {0x01, 0x18, 0x11, 0x05, 0x02, 0x0f, 0x01ce},
+ {
+ .priority = 0,
+ .tilemapLeft = 14,
+ .tilemapTop = 2,
+ .width = 15,
+ .height = 16,
+ .paletteNum = 15,
+ .baseBlock = 30
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 0,
+ .tilemapTop = 13,
+ .width = 14,
+ .height = 6,
+ .paletteNum = 15,
+ .baseBlock = 270
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 2,
+ .tilemapTop = 15,
+ .width = 27,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 354
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 24,
+ .tilemapTop = 17,
+ .width = 5,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 462
+ },
DUMMY_WIN_TEMPLATE,
};
static const struct WindowTemplate gUnknown_0861F350[] =
{
- {0x01, 0x16, 0x11, 0x07, 0x02, 0x0f, 0x01d8},
- {0x01, 0x16, 0x0f, 0x07, 0x04, 0x0f, 0x01d8},
- {0x01, 0x0f, 0x0f, 0x0e, 0x04, 0x0f, 0x01d8},
- {0x01, 0x0f, 0x0d, 0x0e, 0x06, 0x0f, 0x01d8},
- {0x01, 0x18, 0x0f, 0x05, 0x04, 0x0f, 0x01d8},
+ {
+ .priority = 1,
+ .tilemapLeft = 22,
+ .tilemapTop = 17,
+ .width = 7,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 472
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 22,
+ .tilemapTop = 15,
+ .width = 7,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 472
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 15,
+ .tilemapTop = 15,
+ .width = 14,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 472
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 15,
+ .tilemapTop = 13,
+ .width = 14,
+ .height = 6,
+ .paletteNum = 15,
+ .baseBlock = 472
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 24,
+ .tilemapTop = 15,
+ .width = 5,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 472
+ },
};
extern const struct CompressedSpriteSheet gUnknown_0861F3CC;
diff --git a/src/battle_records.c b/src/battle_records.c
index 1680f3cc4..fc9826e5b 100644
--- a/src/battle_records.c
+++ b/src/battle_records.c
@@ -64,11 +64,28 @@ static const struct BgTemplate sTrainerHillRecordsBgTemplates[] =
static const struct WindowTemplate sTrainerHillRecordsWindowTemplates[] =
{
- {0x0, 0x2, 0x1, 0x1A, 0x12, 0xF, 0x14},
+ {
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 1,
+ .width = 26,
+ .height = 18,
+ .paletteNum = 15,
+ .baseBlock = 20
+ },
DUMMY_WIN_TEMPLATE
};
-static const struct WindowTemplate sLinkBattleRecordsWindow = {0x0, 0x2, 0x1, 0x1A, 0x11, 0xF, 0x1};
+static const struct WindowTemplate sLinkBattleRecordsWindow =
+{
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 1,
+ .width = 26,
+ .height = 17,
+ .paletteNum = 15,
+ .baseBlock = 1
+};
static const u8 sText_DashesNoPlayer[] = _("-------");
static const u8 sText_DashesNoScore[] = _("----");
diff --git a/src/berry_blender.c b/src/berry_blender.c
index 02df933f2..96c3a933d 100644
--- a/src/berry_blender.c
+++ b/src/berry_blender.c
@@ -322,18 +322,72 @@ static const struct BgTemplate sBerryBlenderBgTemplates[3] =
static const struct WindowTemplate sBerryBlender_WindowTemplates[] =
{
- {0, 1, 6, 7, 2, 0xE, 0x28},
- {0, 0x16, 6, 7, 2, 0xE, 0x36},
- {0, 1, 0xC, 7, 2, 0xE, 0x44},
- {0, 0x16, 0xC, 7, 2, 0xE, 0x52},
- {0, 2, 0xF, 0x1B, 4, 0xE, 0x60},
- {0, 5, 3, 0x15, 0xE, 0xE, 0x60},
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 6,
+ .width = 7,
+ .height = 2,
+ .paletteNum = 14,
+ .baseBlock = 0x28,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 22,
+ .tilemapTop = 6,
+ .width = 7,
+ .height = 2,
+ .paletteNum = 14,
+ .baseBlock = 0x36,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 12,
+ .width = 7,
+ .height = 2,
+ .paletteNum = 14,
+ .baseBlock = 0x44,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 22,
+ .tilemapTop = 12,
+ .width = 7,
+ .height = 2,
+ .paletteNum = 14,
+ .baseBlock = 0x52,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 15,
+ .width = 27,
+ .height = 4,
+ .paletteNum = 14,
+ .baseBlock = 0x60,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 5,
+ .tilemapTop = 3,
+ .width = 21,
+ .height = 14,
+ .paletteNum = 14,
+ .baseBlock = 0x60,
+ },
DUMMY_WIN_TEMPLATE
};
static const struct WindowTemplate sBlender_YesNoWindowTemplate =
{
- 0, 0x15, 9, 5, 4, 0xE, 0xCC
+ .priority = 0,
+ .tilemapLeft = 21,
+ .tilemapTop = 9,
+ .width = 5,
+ .height = 4,
+ .paletteNum = 14,
+ .baseBlock = 0xCC
};
static const s8 sUnknown_083399C0[][2] =
@@ -790,7 +844,16 @@ static const u8 sUnknown_08339CD2[] =
0x05, 0x03, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x02
};
-static const struct WindowTemplate sBlenderRecordWindowTemplate = {0, 6, 4, 0x12, 0xB, 0xF, 8};
+static const struct WindowTemplate sBlenderRecordWindowTemplate =
+{
+ .priority = 0,
+ .tilemapLeft = 6,
+ .tilemapTop = 4,
+ .width = 18,
+ .height = 11,
+ .paletteNum = 15,
+ .baseBlock = 8
+};
// code
diff --git a/src/berry_tag_screen.c b/src/berry_tag_screen.c
index fb4bf6817..0c13e7085 100644
--- a/src/berry_tag_screen.c
+++ b/src/berry_tag_screen.c
@@ -101,10 +101,42 @@ static const u8 sTextColors[2][3] =
static const struct WindowTemplate sWindowTemplates[] =
{
- {0x01, 0x0b, 0x04, 0x08, 0x02, 0x0f, 0x0045}, // WIN_BERRY_NAME
- {0x01, 0x0b, 0x07, 0x12, 0x04, 0x0f, 0x0055}, // WIN_SIZE_FIRM
- {0x01, 0x04, 0x0e, 0x19, 0x04, 0x0f, 0x009d}, // WIN_DESC
- {0x00, 0x02, 0x00, 0x08, 0x02, 0x0f, 0x0101}, // WIN_BERRY_TAG
+ { // WIN_BERRY_NAME
+ .priority = 1,
+ .tilemapLeft = 11,
+ .tilemapTop = 4,
+ .width = 8,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 69,
+ },
+ { // WIN_SIZE_FIRM
+ .priority = 1,
+ .tilemapLeft = 11,
+ .tilemapTop = 7,
+ .width = 18,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 85,
+ },
+ { // WIN_DESC
+ .priority = 1,
+ .tilemapLeft = 4,
+ .tilemapTop = 14,
+ .width = 25,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 157,
+ },
+ { // WIN_BERRY_TAG
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 0,
+ .width = 8,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 257,
+ },
DUMMY_WIN_TEMPLATE
};
diff --git a/src/credits.c b/src/credits.c
index c054958ce..cbf77f1b3 100644
--- a/src/credits.c
+++ b/src/credits.c
@@ -948,7 +948,15 @@ static const struct BgTemplate gUnknown_085E6F68[] =
};
static const struct WindowTemplate gUnknown_085E6F6C[] =
{
- { 0x00, 0x00, 0x09, 0x1E, 0x0C, 0x08, 0x0001 },
+ {
+ .priority = 0,
+ .tilemapLeft = 0,
+ .tilemapTop = 9,
+ .width = 30,
+ .height = 12,
+ .paletteNum = 8,
+ .baseBlock = 1
+ },
DUMMY_WIN_TEMPLATE,
};
static const u8 gUnknown_085E6F7C[][2] =
diff --git a/src/daycare.c b/src/daycare.c
index 7599d70ab..934cdea43 100644
--- a/src/daycare.c
+++ b/src/daycare.c
@@ -61,7 +61,16 @@ EWRAM_DATA static u16 sHatchedEggMotherMoves[4] = {0};
#include "data/pokemon/egg_moves.h"
-static const struct WindowTemplate sDaycareLevelMenuWindowTemplate = {0, 0xF, 1, 0xE, 6, 0xF, 8};
+static const struct WindowTemplate sDaycareLevelMenuWindowTemplate =
+{
+ .priority = 0,
+ .tilemapLeft = 15,
+ .tilemapTop = 1,
+ .width = 14,
+ .height = 6,
+ .paletteNum = 15,
+ .baseBlock = 8
+};
static const struct ListMenuItem sLevelMenuItems[] =
{
diff --git a/src/decoration.c b/src/decoration.c
index b21d51278..e1def6d38 100644
--- a/src/decoration.c
+++ b/src/decoration.c
@@ -214,22 +214,67 @@ void (*const SecretBasePC_SelectedDecorActions[][2])(u8 taskId) = {
}
};
-const struct WindowTemplate gUnknown_085A6B90[4] = {
- { 0, 1, 1, 18, 8, 15, 0x0001 },
- { 0, 1, 1, 13, 18, 13, 0x0091 },
- { 0, 17, 1, 12, 2, 15, 0x017b },
- { 0, 16, 13, 13, 6, 15, 0x0193 }
+const struct WindowTemplate gUnknown_085A6B90[4] =
+{
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 1,
+ .width = 18,
+ .height = 8,
+ .paletteNum = 15,
+ .baseBlock = 0x0001
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 1,
+ .width = 13,
+ .height = 18,
+ .paletteNum = 13,
+ .baseBlock = 0x0091
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 17,
+ .tilemapTop = 1,
+ .width = 12,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x017b
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 16,
+ .tilemapTop = 13,
+ .width = 13,
+ .height = 6,
+ .paletteNum = 15,
+ .baseBlock = 0x0193
+ }
};
const u16 gUnknown_085A6BB0[] = INCBIN_U16("graphics/decorations/unk_85a6bb0.gbapal");
-const struct ListMenuTemplate gUnknown_085A6BD0 = {
- NULL,
- sub_8127480,
- sub_81274A0,
- 0, 0,
- 0, 0, 8, 0,
- 9, 2, 1, 3, FALSE, 0, FALSE, 7
+const struct ListMenuTemplate gUnknown_085A6BD0 =
+{
+ .items = NULL,
+ .moveCursorFunc = sub_8127480,
+ .itemPrintFunc = sub_81274A0,
+ .totalItems = 0,
+ .maxShowed = 0,
+ .windowId = 0,
+ .header_X = 0,
+ .item_X = 8,
+ .cursor_X = 0,
+ .upText_Y = 9,
+ .cursorPal = 2,
+ .fillValue = 1,
+ .cursorShadowPal = 3,
+ .lettersSpacing = FALSE,
+ .itemVerticalPadding = 0,
+ .scrollMultiple = FALSE,
+ .fontId = 7
};
#include "data/decoration/icon.h"
@@ -1087,7 +1132,7 @@ void sub_8127B04(u8 taskId)
{
DrawWholeMapView();
Overworld_SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, gTasks[taskId].data[3], gTasks[taskId].data[4]);
- warp_in();
+ WarpIntoMap();
}
u16 sub_8127B54(u8 decor, u8 a1)
diff --git a/src/egg_hatch.c b/src/egg_hatch.c
index 1c626cc86..25af28da4 100644
--- a/src/egg_hatch.c
+++ b/src/egg_hatch.c
@@ -253,13 +253,27 @@ static const struct BgTemplate sBgTemplates_EggHatch[2] =
static const struct WindowTemplate sWinTemplates_EggHatch[2] =
{
- {0, 2, 0xF, 0x1A, 4, 0, 0x40},
+ {
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 15,
+ .width = 26,
+ .height = 4,
+ .paletteNum = 0,
+ .baseBlock = 64
+ },
DUMMY_WIN_TEMPLATE
};
static const struct WindowTemplate sYesNoWinTemplate =
{
- 0, 0x15, 9, 5, 4, 0xF, 0x1A8
+ .priority = 0,
+ .tilemapLeft = 21,
+ .tilemapTop = 9,
+ .width = 5,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 424
};
static const s16 sEggShardVelocities[][2] =
diff --git a/src/event_object_movement.c b/src/event_object_movement.c
index 5fdceb4c3..9a1e711c3 100644
--- a/src/event_object_movement.c
+++ b/src/event_object_movement.c
@@ -26,9 +26,9 @@
// this file was known as evobjmv.c in Game Freak's original source
-extern u8 gUnknown_020375B4;
-extern u16 gUnknown_020375B6;
-extern struct LockedAnimEventObjects *gLockedAnimEventObjects;
+EWRAM_DATA u8 sCurrentReflectionType = 0;
+EWRAM_DATA u16 sCurrentSpecialObjectPaletteTag = 0;
+EWRAM_DATA struct LockedAnimEventObjects *gLockedAnimEventObjects = {0};
static void MoveCoordsInDirection(u32, s16 *, s16 *, s16, s16);
static bool8 EventObjectExecSingleMovementAction(struct EventObject *, struct Sprite *);
@@ -102,7 +102,7 @@ static struct EventObjectTemplate *FindEventObjectTemplateByLocalId(u8 localId,
static void ClearEventObjectMovement(struct EventObject *, struct Sprite *);
static void EventObjectSetSingleMovement(struct EventObject *, struct Sprite *, u8);
-const u8 gUnknown_084975C4[] = {1, 1, 6, 7, 8, 9, 6, 7, 8, 9, 11, 11, 0, 0, 0, 0};
+const u8 gReflectionEffectPaletteMap[] = {1, 1, 6, 7, 8, 9, 6, 7, 8, 9, 11, 11, 0, 0, 0, 0};
const struct SpriteTemplate gCameraSpriteTemplate = {0, 0xFFFF, &gDummyOamData, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, ObjectCB_CameraObject};
@@ -376,7 +376,7 @@ const u8 gInitialMovementTypeFacingDirections[] = {
#include "data/field_event_obj/event_object_subsprites.h"
#include "data/field_event_obj/event_object_graphics_info.h"
-const struct SpritePalette gUnknown_0850BBC8[] = {
+const struct SpritePalette sEventObjectSpritePalettes[] = {
{gEventObjectPalette0, 0x1103},
{gEventObjectPalette1, 0x1104},
{gEventObjectPalette2, 0x1105},
@@ -415,7 +415,7 @@ const struct SpritePalette gUnknown_0850BBC8[] = {
{NULL, 0x0000},
};
-const u16 Unknown_0850BCE8[] = {
+const u16 gPlayerReflectionPaletteTags[] = {
0x1101,
0x1101,
0x1101,
@@ -429,115 +429,115 @@ const u16 Unknown_0850BCF0[] = {
0x1111,
};
-const u16 Unknown_0850BCF8[] = {
+const u16 gPlayerUnderwaterReflectionPaletteTags[] = {
0x1115,
0x1115,
0x1115,
0x1115,
};
-const struct PairedPalettes gUnknown_0850BD00[] = {
- {0x1100, Unknown_0850BCE8},
+const struct PairedPalettes gPlayerReflectionPaletteSets[] = {
+ {0x1100, gPlayerReflectionPaletteTags},
{0x1110, Unknown_0850BCF0},
- {0x1115, Unknown_0850BCF8},
+ {0x1115, gPlayerUnderwaterReflectionPaletteTags},
{0x11FF, NULL},
};
-const u16 Unknown_0850BD20[] = {
+const u16 gQuintyPlumpReflectionPaletteTags[] = {
0x110C,
0x110C,
0x110C,
0x110C,
};
-const u16 Unknown_0850BD28[] = {
+const u16 gTruckReflectionPaletteTags[] = {
0x110D,
0x110D,
0x110D,
0x110D,
};
-const u16 Unknown_0850BD30[] = {
+const u16 gVigorothMoverReflectionPaletteTags[] = {
0x110E,
0x110E,
0x110E,
0x110E,
};
-const u16 Unknown_0850BD38[] = {
+const u16 gMovingBoxReflectionPaletteTags[] = {
0x1112,
0x1112,
0x1112,
0x1112,
};
-const u16 Unknown_0850BD40[] = {
+const u16 gCableCarReflectionPaletteTags[] = {
0x1113,
0x1113,
0x1113,
0x1113,
};
-const u16 Unknown_0850BD48[] = {
+const u16 gSSTidalReflectionPaletteTags[] = {
0x1114,
0x1114,
0x1114,
0x1114,
};
-const u16 Unknown_0850BD50[] = {
+const u16 gSubmarineShadowReflectionPaletteTags[] = {
0x111B,
0x111B,
0x111B,
0x111B,
};
-const u16 Unknown_0850BD58[] = {
+const u16 Unknown_0850BD58[] = { // Kyogre2?
0x1117,
0x1117,
0x1117,
0x1117,
};
-const u16 Unknown_0850BD60[] = {
+const u16 Unknown_0850BD60[] = { // Groudon2?
0x1119,
0x1119,
0x1119,
0x1119,
};
-const u16 Unknown_0850BD68[] = {
+const u16 Unknown_0850BD68[] = { // Invisible Keckleon?
0x1109,
0x1109,
0x1109,
0x1109,
};
-const u16 Unknown_0850BD70[] = {
+const u16 gRedLeafReflectionPaletteTags[] = {
0x111D,
0x111D,
0x111D,
0x111D,
};
-const struct PairedPalettes gUnknown_0850BD78[] = {
- {4352, Unknown_0850BCE8},
+const struct PairedPalettes gSpecialObjectReflectionPaletteSets[] = {
+ {4352, gPlayerReflectionPaletteTags},
{4368, Unknown_0850BCF0},
- {4363, Unknown_0850BD20},
- {4365, Unknown_0850BD28},
- {4366, Unknown_0850BD30},
- {4370, Unknown_0850BD38},
- {4371, Unknown_0850BD40},
- {4372, Unknown_0850BD48},
+ {4363, gQuintyPlumpReflectionPaletteTags},
+ {4365, gTruckReflectionPaletteTags},
+ {4366, gVigorothMoverReflectionPaletteTags},
+ {4370, gMovingBoxReflectionPaletteTags},
+ {4371, gCableCarReflectionPaletteTags},
+ {4372, gSSTidalReflectionPaletteTags},
{4374, Unknown_0850BD58},
{4376, Unknown_0850BD60},
{4357, Unknown_0850BD68},
- {4379, Unknown_0850BD50},
- {4381, Unknown_0850BD70},
+ {4379, gSubmarineShadowReflectionPaletteTags},
+ {4381, gRedLeafReflectionPaletteTags},
{4607, NULL},
};
-const u16 gUnknown_0850BDE8[] = {
+const u16 gObjectPaletteTags0[] = {
0x1100,
0x1101,
0x1103,
@@ -550,7 +550,7 @@ const u16 gUnknown_0850BDE8[] = {
0x110A,
};
-const u16 gUnknown_0850BDFC[] = {
+const u16 gObjectPaletteTags1[] = {
0x1100,
0x1101,
0x1103,
@@ -563,7 +563,7 @@ const u16 gUnknown_0850BDFC[] = {
0x110A,
};
-const u16 gUnknown_0850BE10[] = {
+const u16 gObjectPaletteTags2[] = {
0x1100,
0x1101,
0x1103,
@@ -576,7 +576,7 @@ const u16 gUnknown_0850BE10[] = {
0x110A,
};
-const u16 gUnknown_0850BE24[] = {
+const u16 gObjectPaletteTags3[] = {
0x1100,
0x1101,
0x1103,
@@ -590,11 +590,11 @@ const u16 gUnknown_0850BE24[] = {
};
-const u16 *const gUnknown_0850BE38[] = {
- gUnknown_0850BDE8,
- gUnknown_0850BDFC,
- gUnknown_0850BE10,
- gUnknown_0850BE24,
+const u16 *const gObjectPaletteTagSets[] = {
+ gObjectPaletteTags0,
+ gObjectPaletteTags1,
+ gObjectPaletteTags2,
+ gObjectPaletteTags3,
};
#include "data/field_event_obj/berry_tree_graphics_tables.h"
@@ -798,7 +798,7 @@ bool8 (*const gDirectionBlockedMetatileFuncs[])(u8) = {
MetatileBehavior_IsWestBlocked
};
-const struct Coords16 gDirectionToVectors[] = {
+static const struct Coords16 sDirectionToVectors[] = {
{ 0, 0},
{ 0, 1},
{ 0, -1},
@@ -1461,11 +1461,11 @@ static u8 TrySetupEventObjectSprite(struct EventObjectTemplate *eventObjectTempl
paletteSlot = graphicsInfo->paletteSlot;
if (paletteSlot == 0)
{
- npc_load_two_palettes__no_record(graphicsInfo->paletteTag1, 0);
+ LoadPlayerObjectReflectionPalette(graphicsInfo->paletteTag1, 0);
}
else if (paletteSlot == 10)
{
- npc_load_two_palettes__and_record(graphicsInfo->paletteTag1, 10);
+ LoadSpecialObjectReflectionPalette(graphicsInfo->paletteTag1, 10);
}
else if (paletteSlot >= 16)
{
@@ -1653,7 +1653,7 @@ u8 sprite_new(u8 graphicsId, u8 a1, s16 x, s16 y, u8 z, u8 direction)
sprite->data[1] = z;
if (graphicsInfo->paletteSlot == 10)
{
- npc_load_two_palettes__and_record(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot);
+ LoadSpecialObjectReflectionPalette(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot);
}
else if (graphicsInfo->paletteSlot >= 16)
{
@@ -1806,11 +1806,11 @@ static void sub_808E1B8(u8 eventObjectId, s16 x, s16 y)
paletteSlot = graphicsInfo->paletteSlot;
if (paletteSlot == 0)
{
- npc_load_two_palettes__no_record(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot);
+ LoadPlayerObjectReflectionPalette(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot);
}
else if (paletteSlot == 10)
{
- npc_load_two_palettes__and_record(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot);
+ LoadSpecialObjectReflectionPalette(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot);
}
else if (paletteSlot >= 16)
{
@@ -1882,11 +1882,11 @@ void EventObjectSetGraphicsId(struct EventObject *eventObject, u8 graphicsId)
paletteSlot = graphicsInfo->paletteSlot;
if (paletteSlot == 0)
{
- pal_patch_for_npc(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot);
+ PatchObjectPalette(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot);
}
else if (paletteSlot == 10)
{
- npc_load_two_palettes__and_record(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot);
+ LoadSpecialObjectReflectionPalette(graphicsInfo->paletteTag1, graphicsInfo->paletteSlot);
}
else if (paletteSlot >= 16)
{
@@ -1980,14 +1980,14 @@ const struct EventObjectGraphicsInfo *GetEventObjectGraphicsInfo(u8 graphicsId)
{
graphicsId = VarGetEventObjectGraphicsId(graphicsId - SPRITE_VAR);
}
- if (graphicsId == 0x45)
+ if (graphicsId == EVENT_OBJ_GFX_BARD)
{
bard = GetCurrentMauvilleOldMan();
return gMauvilleOldManGraphicsInfoPointers[bard];
}
if (graphicsId >= NUM_OBJECT_GRAPHICS_INFO)
{
- graphicsId = 0x05; // LittleBoy1
+ graphicsId = EVENT_OBJ_GFX_LITTLE_BOY_1;
}
return gEventObjectGraphicsInfoPointers[graphicsId];
}
@@ -2071,7 +2071,7 @@ void sub_808E82C(u8 localId, u8 mapNum, u8 mapGroup, s16 x, s16 y)
}
}
-void gpu_pal_allocator_reset__manage_upper_four(void)
+void FreeAndReserveObjectSpritePalettes(void)
{
FreeAllSpritePalettes();
gReservedSpritePaletteCount = 12;
@@ -2084,7 +2084,7 @@ static void sub_808E894(u16 paletteTag)
paletteSlot = FindEventObjectPaletteIndexByTag(paletteTag);
if (paletteSlot != 0x11ff) // always true
{
- sub_808E8F4(&gUnknown_0850BBC8[paletteSlot]);
+ sub_808E8F4(&sEventObjectSpritePalettes[paletteSlot]);
}
}
@@ -2107,19 +2107,19 @@ static u8 sub_808E8F4(const struct SpritePalette *spritePalette)
return LoadSpritePalette(spritePalette);
}
-void pal_patch_for_npc(u16 paletteTag, u8 paletteSlot)
+void PatchObjectPalette(u16 paletteTag, u8 paletteSlot)
{
u16 paletteIdx;
paletteIdx = FindEventObjectPaletteIndexByTag(paletteTag);
- LoadPalette(gUnknown_0850BBC8[paletteIdx].data, 16 * paletteSlot + 256, 0x20);
+ LoadPalette(sEventObjectSpritePalettes[paletteIdx].data, 16 * paletteSlot + 256, 0x20);
}
-void pal_patch_for_npc_range(const u16 *paletteTags, u8 minSlot, u8 maxSlot)
+void PatchObjectPaletteRange(const u16 *paletteTags, u8 minSlot, u8 maxSlot)
{
while (minSlot < maxSlot)
{
- pal_patch_for_npc(*paletteTags, minSlot);
+ PatchObjectPalette(*paletteTags, minSlot);
paletteTags++;
minSlot++;
}
@@ -2129,9 +2129,9 @@ static u8 FindEventObjectPaletteIndexByTag(u16 tag)
{
u8 i;
- for (i = 0; gUnknown_0850BBC8[i].tag != 0x11ff; i++)
+ for (i = 0; sEventObjectSpritePalettes[i].tag != 0x11ff; i++)
{
- if (gUnknown_0850BBC8[i].tag == tag)
+ if (sEventObjectSpritePalettes[i].tag == tag)
{
return i;
}
@@ -2139,32 +2139,32 @@ static u8 FindEventObjectPaletteIndexByTag(u16 tag)
return 0xff;
}
-void npc_load_two_palettes__no_record(u16 tag, u8 slot)
+void LoadPlayerObjectReflectionPalette(u16 tag, u8 slot)
{
u8 i;
- pal_patch_for_npc(tag, slot);
- for (i = 0; gUnknown_0850BD00[i].tag != 0x11ff; i++)
+ PatchObjectPalette(tag, slot);
+ for (i = 0; gPlayerReflectionPaletteSets[i].tag != 0x11ff; i++)
{
- if (gUnknown_0850BD00[i].tag == tag)
+ if (gPlayerReflectionPaletteSets[i].tag == tag)
{
- pal_patch_for_npc(gUnknown_0850BD00[i].data[gUnknown_020375B4], gUnknown_084975C4[slot]);
+ PatchObjectPalette(gPlayerReflectionPaletteSets[i].data[sCurrentReflectionType], gReflectionEffectPaletteMap[slot]);
return;
}
}
}
-void npc_load_two_palettes__and_record(u16 tag, u8 slot)
+void LoadSpecialObjectReflectionPalette(u16 tag, u8 slot)
{
u8 i;
- gUnknown_020375B6 = tag;
- pal_patch_for_npc(tag, slot);
- for (i = 0; gUnknown_0850BD78[i].tag != 0x11ff; i++)
+ sCurrentSpecialObjectPaletteTag = tag;
+ PatchObjectPalette(tag, slot);
+ for (i = 0; gSpecialObjectReflectionPaletteSets[i].tag != 0x11ff; i++)
{
- if (gUnknown_0850BD78[i].tag == tag)
+ if (gSpecialObjectReflectionPaletteSets[i].tag == tag)
{
- pal_patch_for_npc(gUnknown_0850BD78[i].data[gUnknown_020375B4], gUnknown_084975C4[slot]);
+ PatchObjectPalette(gSpecialObjectReflectionPaletteSets[i].data[sCurrentReflectionType], gReflectionEffectPaletteMap[slot]);
return;
}
}
@@ -2172,7 +2172,7 @@ void npc_load_two_palettes__and_record(u16 tag, u8 slot)
static void sub_808EAB0(u16 tag, u8 slot)
{
- pal_patch_for_npc(tag, slot);
+ PatchObjectPalette(tag, slot);
}
void unref_sub_808EAC4(struct EventObject *eventObject, s16 x, s16 y)
@@ -2191,7 +2191,7 @@ void ShiftEventObjectCoords(struct EventObject *eventObject, s16 x, s16 y)
eventObject->currentCoords.y = y;
}
-/*static*/ void npc_coords_set(struct EventObject *eventObject, s16 x, s16 y)
+/*static*/ void SetEventObjectCoords(struct EventObject *eventObject, s16 x, s16 y)
{
eventObject->previousCoords.x = x;
eventObject->previousCoords.y = y;
@@ -2206,7 +2206,7 @@ void sub_808EB08(struct EventObject *eventObject, s16 x, s16 y)
sprite = &gSprites[eventObject->spriteId];
graphicsInfo = GetEventObjectGraphicsInfo(eventObject->graphicsId);
- npc_coords_set(eventObject, x, y);
+ SetEventObjectCoords(eventObject, x, y);
sub_8093038(eventObject->currentCoords.x, eventObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y);
sprite->centerToCornerVecX = -(graphicsInfo->width >> 1);
sprite->centerToCornerVecY = -(graphicsInfo->height >> 1);
@@ -2414,7 +2414,7 @@ u8 CopySprite(struct Sprite *sprite, s16 x, s16 y, u8 subpriority)
return i;
}
-u8 obj_unfreeze(struct Sprite *sprite, s16 x, s16 y, u8 subpriority)
+u8 CreateCopySpriteAt(struct Sprite *sprite, s16 x, s16 y, u8 subpriority)
{
s16 i;
@@ -2610,35 +2610,35 @@ void sub_808F28C(u8 localId, u8 mapNum, u8 mapGroup, u8 decorCat)
}
}
-void npc_paltag_set_load(u8 palSlot)
+void InitEventObjectPalettes(u8 palSlot)
{
- gpu_pal_allocator_reset__manage_upper_four();
- gUnknown_020375B6 = 0x11ff;
- gUnknown_020375B4 = palSlot;
+ FreeAndReserveObjectSpritePalettes();
+ sCurrentSpecialObjectPaletteTag = 0x11ff;
+ sCurrentReflectionType = palSlot;
if (palSlot == 1)
{
- pal_patch_for_npc_range(gUnknown_0850BE38[gUnknown_020375B4], 0, 6);
+ PatchObjectPaletteRange(gObjectPaletteTagSets[sCurrentReflectionType], 0, 6);
gReservedSpritePaletteCount = 8;
}
else
{
- pal_patch_for_npc_range(gUnknown_0850BE38[gUnknown_020375B4], 0, 10);
+ PatchObjectPaletteRange(gObjectPaletteTagSets[sCurrentReflectionType], 0, 10);
}
}
-u16 npc_paltag_by_palslot(u8 palSlot)
+u16 GetObjectPaletteTag(u8 palSlot)
{
u8 i;
if (palSlot < 10)
{
- return gUnknown_0850BE38[gUnknown_020375B4][palSlot];
+ return gObjectPaletteTagSets[sCurrentReflectionType][palSlot];
}
- for (i = 0; gUnknown_0850BD78[i].tag != 0x11ff; i++)
+ for (i = 0; gSpecialObjectReflectionPaletteSets[i].tag != 0x11ff; i++)
{
- if (gUnknown_0850BD78[i].tag == gUnknown_020375B6)
+ if (gSpecialObjectReflectionPaletteSets[i].tag == sCurrentSpecialObjectPaletteTag)
{
- return gUnknown_0850BD78[i].data[gUnknown_020375B4];
+ return gSpecialObjectReflectionPaletteSets[i].data[sCurrentReflectionType];
}
}
return 0x11ff;
@@ -4957,14 +4957,14 @@ void sub_8092EF0(u8 localId, u8 mapNum, u8 mapGroup)
void MoveCoords(u8 direction, s16 *x, s16 *y)
{
- *x += gDirectionToVectors[direction].x;
- *y += gDirectionToVectors[direction].y;
+ *x += sDirectionToVectors[direction].x;
+ *y += sDirectionToVectors[direction].y;
}
void sub_8092F60(u8 direction, s16 *x, s16 *y)
{
- *x += gDirectionToVectors[direction].x << 4;
- *y += gDirectionToVectors[direction].y << 4;
+ *x += sDirectionToVectors[direction].x << 4;
+ *y += sDirectionToVectors[direction].y << 4;
}
static void MoveCoordsInDirection(u32 dir, s16 *x, s16 *y, s16 deltaX, s16 deltaY)
@@ -4972,13 +4972,13 @@ static void MoveCoordsInDirection(u32 dir, s16 *x, s16 *y, s16 deltaX, s16 delta
u8 direction = dir;
s16 dx2 = (u16)deltaX;
s16 dy2 = (u16)deltaY;
- if (gDirectionToVectors[direction].x > 0)
+ if (sDirectionToVectors[direction].x > 0)
*x += dx2;
- if (gDirectionToVectors[direction].x < 0)
+ if (sDirectionToVectors[direction].x < 0)
*x -= dx2;
- if (gDirectionToVectors[direction].y > 0)
+ if (sDirectionToVectors[direction].y > 0)
*y += dy2;
- if (gDirectionToVectors[direction].y < 0)
+ if (sDirectionToVectors[direction].y < 0)
*y -= dy2;
}
@@ -8389,32 +8389,32 @@ void UnfreezeEventObjects(void)
void Step1(struct Sprite *sprite, u8 dir)
{
- sprite->pos1.x += gDirectionToVectors[dir].x;
- sprite->pos1.y += gDirectionToVectors[dir].y;
+ sprite->pos1.x += sDirectionToVectors[dir].x;
+ sprite->pos1.y += sDirectionToVectors[dir].y;
}
void Step2(struct Sprite *sprite, u8 dir)
{
- sprite->pos1.x += 2 * (u16) gDirectionToVectors[dir].x;
- sprite->pos1.y += 2 * (u16) gDirectionToVectors[dir].y;
+ sprite->pos1.x += 2 * (u16) sDirectionToVectors[dir].x;
+ sprite->pos1.y += 2 * (u16) sDirectionToVectors[dir].y;
}
void Step3(struct Sprite *sprite, u8 dir)
{
- sprite->pos1.x += 2 * (u16) gDirectionToVectors[dir].x + (u16) gDirectionToVectors[dir].x;
- sprite->pos1.y += 2 * (u16) gDirectionToVectors[dir].y + (u16) gDirectionToVectors[dir].y;
+ sprite->pos1.x += 2 * (u16) sDirectionToVectors[dir].x + (u16) sDirectionToVectors[dir].x;
+ sprite->pos1.y += 2 * (u16) sDirectionToVectors[dir].y + (u16) sDirectionToVectors[dir].y;
}
void Step4(struct Sprite *sprite, u8 dir)
{
- sprite->pos1.x += 4 * (u16) gDirectionToVectors[dir].x;
- sprite->pos1.y += 4 * (u16) gDirectionToVectors[dir].y;
+ sprite->pos1.x += 4 * (u16) sDirectionToVectors[dir].x;
+ sprite->pos1.y += 4 * (u16) sDirectionToVectors[dir].y;
}
void Step8(struct Sprite *sprite, u8 dir)
{
- sprite->pos1.x += 8 * (u16) gDirectionToVectors[dir].x;
- sprite->pos1.y += 8 * (u16) gDirectionToVectors[dir].y;
+ sprite->pos1.x += 8 * (u16) sDirectionToVectors[dir].x;
+ sprite->pos1.y += 8 * (u16) sDirectionToVectors[dir].y;
}
void oamt_npc_ministep_reset(struct Sprite *sprite, u8 a2, u8 a3)
diff --git a/src/field_effect.c b/src/field_effect.c
index 13de58aa4..ecda8578b 100644
--- a/src/field_effect.c
+++ b/src/field_effect.c
@@ -1170,7 +1170,7 @@ void task00_8084310(u8 taskId)
if (!FieldEffectActiveListContains(FLDEFF_USE_FLY))
{
Overworld_ResetStateAfterFly();
- warp_in();
+ WarpIntoMap();
SetMainCallback2(CB2_LoadMap);
gFieldCallback = mapldr_08084390;
DestroyTask(taskId);
@@ -1355,7 +1355,7 @@ void sub_80B6FB8(struct Task *);
void sub_80B7004(struct Task *);
void sub_80B7050(void);
void sub_80B7060(void);
-bool8 sub_80859A0(void);
+bool8 BGMusicStopped(void);
void sub_80B70B4(void);
void sub_80E1570(void);
void sub_80B70DC(u8);
@@ -1476,10 +1476,10 @@ void sub_80B7050(void)
void sub_80B7060(void)
{
- if (!gPaletteFade.active && sub_80859A0() == TRUE)
+ if (!gPaletteFade.active && BGMusicStopped() == TRUE)
{
sub_80E1570();
- warp_in();
+ WarpIntoMap();
gFieldCallback = sub_80B70B4;
SetMainCallback2(CB2_LoadMap);
DestroyTask(FindTaskIdByFunc(sub_80B6E88));
@@ -1838,9 +1838,9 @@ bool8 sub_80B77F8(struct Task *task, struct EventObject *eventObject, struct Spr
bool8 sub_80B7814(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite)
{
- if (!gPaletteFade.active && sub_80859A0() == TRUE)
+ if (!gPaletteFade.active && BGMusicStopped() == TRUE)
{
- warp_in();
+ WarpIntoMap();
gFieldCallback = mapldr_080851BC;
SetMainCallback2(CB2_LoadMap);
DestroyTask(FindTaskIdByFunc(sub_80B75F0));
@@ -2004,9 +2004,9 @@ void mapldr_080859D4(void);
bool8 sub_80B7BF4(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite)
{
- if (!gPaletteFade.active && sub_80859A0() == TRUE)
+ if (!gPaletteFade.active && BGMusicStopped() == TRUE)
{
- warp_in();
+ WarpIntoMap();
gFieldCallback = sub_80B6B68;
SetMainCallback2(CB2_LoadMap);
DestroyTask(FindTaskIdByFunc(sub_80B7A8C));
@@ -2063,11 +2063,11 @@ void sub_80B7D34(struct Task *task)
eventObject = &gEventObjects[gPlayerAvatar.eventObjectId];
if (!EventObjectIsMovementOverridden(eventObject) || EventObjectClearHeldMovementIfFinished(eventObject))
{
- if (task->data[14] == 0 && !gPaletteFade.active && sub_80859A0() == TRUE)
+ if (task->data[14] == 0 && !gPaletteFade.active && BGMusicStopped() == TRUE)
{
SetEventObjectDirection(eventObject, task->data[15]);
sub_8084E14();
- warp_in();
+ WarpIntoMap();
gFieldCallback = mapldr_080859D4;
SetMainCallback2(CB2_LoadMap);
DestroyTask(FindTaskIdByFunc(sub_80B7CE4));
@@ -2234,10 +2234,10 @@ static void TeleportFieldEffectTask4(struct Task *task)
task->data[5] = TRUE;
}
- if (sub_80859A0() == TRUE)
+ if (BGMusicStopped() == TRUE)
{
Overworld_SetWarpDestToLastHealLoc();
- warp_in();
+ WarpIntoMap();
SetMainCallback2(CB2_LoadMap);
gFieldCallback = mapldr_08085D88;
DestroyTask(FindTaskIdByFunc(ExecuteTeleportFieldEffectTask));
diff --git a/src/field_region_map.c b/src/field_region_map.c
index f56548068..d77bde01b 100644
--- a/src/field_region_map.c
+++ b/src/field_region_map.c
@@ -55,9 +55,26 @@ static const struct BgTemplate gUnknown_085E5068[] = {
}
};
-static const struct WindowTemplate gUnknown_085E5070[] = {
- { 0, 17, 17, 12, 2, 15, 0x0001 },
- { 0, 22, 1, 7, 2, 15, 0x0019 },
+static const struct WindowTemplate gUnknown_085E5070[] =
+{
+ {
+ .priority = 0,
+ .tilemapLeft = 17,
+ .tilemapTop = 17,
+ .width = 12,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 1
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 22,
+ .tilemapTop = 1,
+ .width = 7,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 25
+ },
DUMMY_WIN_TEMPLATE
};
diff --git a/src/field_specials.c b/src/field_specials.c
index 84852e6b5..14f99b426 100644
--- a/src/field_specials.c
+++ b/src/field_specials.c
@@ -269,7 +269,7 @@ u16 GetRecordedCyclingRoadResults(void) {
}
void UpdateCyclingRoadState(void) {
- if (gUnknown_020322DC.mapNum == MAP_NUM(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE) && gUnknown_020322DC.mapGroup == MAP_GROUP(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE))
+ if (gLastUsedWarp.mapNum == MAP_NUM(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE) && gLastUsedWarp.mapGroup == MAP_GROUP(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE))
{
return;
}
@@ -2094,7 +2094,7 @@ bool32 warp0_in_pokecenter(void)
static const u16 gUnknown_085B2C2A[] = { 0x0202, 0x0301, 0x0405, 0x0504, 0x0604, 0x0700, 0x0804, 0x090b, 0x0a05, 0x0b05, 0x0c02, 0x0d06, 0x0e03, 0x0f02, 0x100c, 0x100a, 0x1a35, 0x193c, 0xffff };
int i;
- u16 map = (gUnknown_020322DC.mapGroup << 8) + gUnknown_020322DC.mapNum;
+ u16 map = (gLastUsedWarp.mapGroup << 8) + gLastUsedWarp.mapNum;
for (i = 0; gUnknown_085B2C2A[i] != 0xFFFF; i++)
{
diff --git a/src/fieldmap.c b/src/fieldmap.c
index 8d1988686..019db9d0d 100644
--- a/src/fieldmap.c
+++ b/src/fieldmap.c
@@ -712,8 +712,8 @@ int GetPostCameraMoveMapBorderId(int x, int y)
int CanCameraMoveInDirection(int direction)
{
int x, y;
- x = gSaveBlock1Ptr->pos.x + 7 + gUnknown_08339D64[direction].x;
- y = gSaveBlock1Ptr->pos.y + 7 + gUnknown_08339D64[direction].y;
+ x = gSaveBlock1Ptr->pos.x + 7 + gDirectionToVectors[direction].x;
+ y = gSaveBlock1Ptr->pos.y + 7 + gDirectionToVectors[direction].y;
if (GetMapBorderIdAt(x, y) == -1)
{
return 0;
diff --git a/src/item_menu.c b/src/item_menu.c
index f58c2b8b3..196ba9474 100755
--- a/src/item_menu.c
+++ b/src/item_menu.c
@@ -149,14 +149,57 @@ void sub_81AD6FC(u8 taskId);
// .rodata
-const struct BgTemplate gUnknown_08613F90[3] = {
- {0, 0, 31, 0, 0, 1, 0},
- {1, 0, 30, 0, 0, 0, 0},
- {2, 3, 29, 0, 0, 2, 0}
+const struct BgTemplate gUnknown_08613F90[3] =
+{
+ {
+ .bg = 0,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 31,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 1,
+ .baseTile = 0,
+ },
+ {
+ .bg = 1,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 30,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 0,
+ .baseTile = 0,
+ },
+ {
+ .bg = 2,
+ .charBaseIndex = 3,
+ .mapBaseIndex = 29,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 2,
+ .baseTile = 0,
+ },
};
-const struct ListMenuTemplate gUnknown_08613F9C = {
- NULL, bag_menu_change_item_callback, sub_81AB520, 0, 0, 0, 0, 8, 0, 1, 1, 0, 3, 0, 0, 0, 7, 0
+const struct ListMenuTemplate gUnknown_08613F9C =
+{
+ .items = NULL,
+ .moveCursorFunc = bag_menu_change_item_callback,
+ .itemPrintFunc = sub_81AB520,
+ .totalItems = 0,
+ .maxShowed = 0,
+ .windowId = 0,
+ .header_X = 0,
+ .item_X = 8,
+ .cursor_X = 0,
+ .upText_Y = 1,
+ .cursorPal = 1,
+ .fillValue = 0,
+ .cursorShadowPal = 3,
+ .lettersSpacing = 0,
+ .itemVerticalPadding = 0,
+ .scrollMultiple = 0,
+ .fontId = 7,
+ .cursorKind = 0
};
const struct MenuAction gUnknown_08613FB4[] = {
@@ -221,27 +264,157 @@ const u8 gUnknown_08614164[][3] = {
{0, 14, 10}
};
-const struct WindowTemplate gUnknown_08614174[] = {
- {0, 14, 2, 15, 16, 1, 0x27},
- {0, 0, 13, 14, 6, 1, 0x117},
- {0, 4, 1, 8, 2, 1, 0x1A1},
- {0, 1, 13, 5, 6, 12, 0x16B},
- {0, 7, 13, 4, 6, 12, 0x189},
- {1, 2, 15, 27, 4, 15, 0x1B1},
- {0xFF, 0, 0, 0, 0, 0, 0}
+const struct WindowTemplate gUnknown_08614174[] =
+{
+ {
+ .priority = 0,
+ .tilemapLeft = 14,
+ .tilemapTop = 2,
+ .width = 15,
+ .height = 16,
+ .paletteNum = 1,
+ .baseBlock = 0x27,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 0,
+ .tilemapTop = 13,
+ .width = 14,
+ .height = 6,
+ .paletteNum = 1,
+ .baseBlock = 0x117,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 4,
+ .tilemapTop = 1,
+ .width = 8,
+ .height = 2,
+ .paletteNum = 1,
+ .baseBlock = 0x1A1,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 13,
+ .width = 5,
+ .height = 6,
+ .paletteNum = 12,
+ .baseBlock = 0x16B,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 7,
+ .tilemapTop = 13,
+ .width = 4,
+ .height = 6,
+ .paletteNum = 12,
+ .baseBlock = 0x189,
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 2,
+ .tilemapTop = 15,
+ .width = 27,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 0x1B1,
+ },
+ DUMMY_WIN_TEMPLATE,
};
-const struct WindowTemplate gUnknown_086141AC[] = {
- {1, 22, 17, 7, 2, 15, 0x21D},
- {1, 22, 15, 7, 4, 15, 0x21D},
- {1, 15, 15, 14, 4, 15, 0x21D},
- {1, 15, 13, 14, 6, 15, 0x21D},
- {1, 2, 15, 27, 4, 15, 0x1B1},
- {1, 24, 15, 5, 4, 15, 0x21D},
- {1, 21, 9, 5, 4, 15, 0x21D},
- {1, 24, 17, 5, 2, 15, 0x21D},
- {1, 18, 11, 10, 2, 15, 0x245},
- {1, 1, 1, 10, 2, 15, 0x231}
+const struct WindowTemplate gUnknown_086141AC[] =
+{
+ {
+ .priority = 1,
+ .tilemapLeft = 22,
+ .tilemapTop = 17,
+ .width = 7,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x21D,
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 22,
+ .tilemapTop = 15,
+ .width = 7,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 0x21D,
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 15,
+ .tilemapTop = 15,
+ .width = 14,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 0x21D,
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 15,
+ .tilemapTop = 13,
+ .width = 14,
+ .height = 6,
+ .paletteNum = 15,
+ .baseBlock = 0x21D,
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 2,
+ .tilemapTop = 15,
+ .width = 27,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 0x1B1,
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 24,
+ .tilemapTop = 15,
+ .width = 5,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 0x21D,
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 21,
+ .tilemapTop = 9,
+ .width = 5,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 0x21D,
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 24,
+ .tilemapTop = 17,
+ .width = 5,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x21D,
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 18,
+ .tilemapTop = 11,
+ .width = 10,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x245,
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 1,
+ .tilemapTop = 1,
+ .width = 10,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x231,
+ },
};
// .text
diff --git a/src/item_use.c b/src/item_use.c
index bf7c2a386..ea8206502 100755
--- a/src/item_use.c
+++ b/src/item_use.c
@@ -878,7 +878,7 @@ void ItemUseOutOfBattle_BlackWhiteFlute(u8 taskId)
void task08_080A1C44(u8 taskId)
{
- player_avatar_init_params_reset();
+ ResetInitialPlayerAvatarState();
sub_80B7CC8();
DestroyTask(taskId);
}
diff --git a/src/main_menu.c b/src/main_menu.c
index e28faf986..3d8d5acc2 100644
--- a/src/main_menu.c
+++ b/src/main_menu.c
@@ -131,29 +131,121 @@ const u8 gUnknown_082FEEF0[] = INCBIN_U8("graphics/birch_speech/map.bin.lz");
const u16 gUnknown_082FF018[] = INCBIN_U16("graphics/birch_speech/bg2.gbapal");
const u16 gUnknown_082FF028[] = {0, 0, 0, 0, 0, 0, 0, 0};
-const struct WindowTemplate sWindowTemplates_NoSavedGame[] = {
- {0, 2, 1, 26, 2, 15, 1},
- {0, 2, 5, 26, 2, 15, 0x35}
+const struct WindowTemplate sWindowTemplates_NoSavedGame[] =
+{
+ {
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 1,
+ .width = 26,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 1
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 5,
+ .width = 26,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x35
+ }
};
-const struct WindowTemplate sWindowTemplates_HasSavedGame[] = {
- {0, 2, 1, 26, 6, 15, 1},
- {0, 2, 9, 26, 2, 15, 0x9D},
- {0, 2, 13, 26, 2, 15, 0xD1},
- {0, 2, 17, 26, 2, 15, 0x105},
- {0, 2, 21, 26, 2, 15, 0x139}
+const struct WindowTemplate sWindowTemplates_HasSavedGame[] =
+{
+ {
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 1,
+ .width = 26,
+ .height = 6,
+ .paletteNum = 15,
+ .baseBlock = 1
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 9,
+ .width = 26,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x9D
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 13,
+ .width = 26,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0xD1
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 17,
+ .width = 26,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x105
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 21,
+ .width = 26,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x139
+ }
};
-const struct WindowTemplate sWindowTemplate_ErrorWindow[] = {
- {0, 2, 15, 26, 4, 15, 0x16D},
- {0xFF, 0, 0, 0, 0, 0, 0}
+const struct WindowTemplate sWindowTemplate_ErrorWindow[] =
+{
+ {
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 15,
+ .width = 26,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 0x16D
+ },
+ DUMMY_WIN_TEMPLATE
};
-const struct WindowTemplate gUnknown_082FF080[] = {
- {0, 2, 15, 27, 4, 15, 1},
- {0, 3, 5, 6, 4, 15, 0x6D},
- {0, 3, 2, 9, 10, 15, 0x85},
- {0xFF, 0, 0, 0, 0, 0, 0}
+const struct WindowTemplate gUnknown_082FF080[] =
+{
+ {
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 15,
+ .width = 27,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 1
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 3,
+ .tilemapTop = 5,
+ .width = 6,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 0x6D
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 3,
+ .tilemapTop = 2,
+ .width = 9,
+ .height = 10,
+ .paletteNum = 15,
+ .baseBlock = 0x85
+ },
+ DUMMY_WIN_TEMPLATE
};
const u16 gMainMenuBgPal[] = INCBIN_U16("graphics/misc/main_menu_bg.gbapal");
diff --git a/src/menu.c b/src/menu.c
index 8a4b4fce5..3acb44985 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -65,13 +65,27 @@ static const u8 gUnknown_0860F094[] = { 8, 4, 1 };
static const struct WindowTemplate gUnknown_0860F098[] =
{
- { 0x00, 0x02, 0x0F, 0x1B, 0x04, 0x0F, 0x194 },
+ {
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 15,
+ .width = 27,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 0x194
+ },
DUMMY_WIN_TEMPLATE
};
static const struct WindowTemplate gUnknown_0860F0A8 =
{
- 0x00, 0x15, 0x09, 0x05, 0x04, 0x0F, 0x125
+ .priority = 0,
+ .tilemapLeft = 21,
+ .tilemapTop = 9,
+ .width = 5,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 0x125
};
const u16 gUnknown_0860F0B0[] = INCBIN_U16("graphics/interface/860F0B0.gbapal");
diff --git a/src/mystery_event_menu.c b/src/mystery_event_menu.c
index 68f31584b..7f031c704 100644
--- a/src/mystery_event_menu.c
+++ b/src/mystery_event_menu.c
@@ -42,8 +42,24 @@ static const struct BgTemplate sBgTemplates[] =
static const struct WindowTemplate sWindowTemplates[] =
{
- {0, 4, 15, 22, 4, 14, 20},
- {0, 7, 6, 16, 4, 14, 0x6C},
+ {
+ .priority = 0,
+ .tilemapLeft = 4,
+ .tilemapTop = 15,
+ .width = 22,
+ .height = 4,
+ .paletteNum = 14,
+ .baseBlock = 20
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 7,
+ .tilemapTop = 6,
+ .width = 16,
+ .height = 4,
+ .paletteNum = 14,
+ .baseBlock = 0x6C
+ },
DUMMY_WIN_TEMPLATE
};
diff --git a/src/naming_screen.c b/src/naming_screen.c
index f99d23bc3..42525380b 100644
--- a/src/naming_screen.c
+++ b/src/naming_screen.c
@@ -113,12 +113,53 @@ static const struct BgTemplate gUnknown_0858BE00[] =
}
};
-static const struct WindowTemplate gUnknown_0858BE10[] = {
- { 0x01, 0x03, 0x0A, 0x13, 0x08, 0x0A, 0x030 },
- { 0x02, 0x03, 0x0A, 0x13, 0x08, 0x0A, 0x0C8 },
- { 0x03, 0x08, 0x06, 0x11, 0x02, 0x0A, 0x030 },
- { 0x03, 0x08, 0x04, 0x11, 0x02, 0x0A, 0x052 },
- { 0x00, 0x00, 0x00, 0x1E, 0x02, 0x0B, 0x074 },
+static const struct WindowTemplate gUnknown_0858BE10[] =
+{
+ {
+ .priority = 1,
+ .tilemapLeft = 3,
+ .tilemapTop = 10,
+ .width = 19,
+ .height = 8,
+ .paletteNum = 10,
+ .baseBlock = 0x030
+ },
+ {
+ .priority = 2,
+ .tilemapLeft = 3,
+ .tilemapTop = 10,
+ .width = 19,
+ .height = 8,
+ .paletteNum = 10,
+ .baseBlock = 0x0C8
+ },
+ {
+ .priority = 3,
+ .tilemapLeft = 8,
+ .tilemapTop = 6,
+ .width = 17,
+ .height = 2,
+ .paletteNum = 10,
+ .baseBlock = 0x030
+ },
+ {
+ .priority = 3,
+ .tilemapLeft = 8,
+ .tilemapTop = 4,
+ .width = 17,
+ .height = 2,
+ .paletteNum = 10,
+ .baseBlock = 0x052
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 0,
+ .tilemapTop = 0,
+ .width = 30,
+ .height = 2,
+ .paletteNum = 11,
+ .baseBlock = 0x074
+ },
DUMMY_WIN_TEMPLATE
};
diff --git a/src/new_game.c b/src/new_game.c
index da5e91229..36c028ce8 100644
--- a/src/new_game.c
+++ b/src/new_game.c
@@ -133,7 +133,7 @@ static void ClearFrontierRecord(void)
static void WarpToTruck(void)
{
Overworld_SetWarpDestination(25, 40, -1, -1, -1); // inside of truck
- warp_in();
+ WarpIntoMap();
}
void Sav2_ClearSetDefault(void)
diff --git a/src/option_menu.c b/src/option_menu.c
index fc0c0c24e..d48a1e448 100644
--- a/src/option_menu.c
+++ b/src/option_menu.c
@@ -91,8 +91,24 @@ static const u8 *const sOptionMenuItemsNames[MENUITEM_COUNT] =
static const struct WindowTemplate sOptionMenuWinTemplates[] =
{
- {1, 2, 1, 0x1A, 2, 1, 2},
- {0, 2, 5, 0x1A, 0xE, 1, 0x36},
+ {
+ .priority = 1,
+ .tilemapLeft = 2,
+ .tilemapTop = 1,
+ .width = 26,
+ .height = 2,
+ .paletteNum = 1,
+ .baseBlock = 2
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 5,
+ .width = 26,
+ .height = 14,
+ .paletteNum = 1,
+ .baseBlock = 0x36
+ },
DUMMY_WIN_TEMPLATE
};
diff --git a/src/overworld.c b/src/overworld.c
index 1cf830cf7..683679218 100644
--- a/src/overworld.c
+++ b/src/overworld.c
@@ -1,8 +1,8 @@
#include "global.h"
#include "overworld.h"
-#include "main.h"
#include "battle_setup.h"
#include "berry.h"
+#include "bg.h"
// #include "cable_club.h"
#include "clock.h"
#include "event_data.h"
@@ -20,15 +20,18 @@
#include "field_weather.h"
#include "fieldmap.h"
// #include "fldeff_flash.h"
+#include "gpu_regs.h"
#include "heal_location.h"
#include "link.h"
+#include "link_rfu.h"
#include "load_save.h"
#include "main.h"
+#include "malloc.h"
#include "m4a.h"
-#include "constants/maps.h"
#include "map_name_popup.h"
#include "menu.h"
#include "metatile_behavior.h"
+#include "money.h"
#include "new_game.h"
#include "palette.h"
#include "play_time.h"
@@ -37,12 +40,11 @@
// #include "rotating_gate.h"
#include "safari_zone.h"
#include "save.h"
+#include "save_location.h"
#include "script.h"
// #include "script_pokemon_80C4.h"
#include "secret_base.h"
-#include "constants/songs.h"
#include "sound.h"
-#include "constants/species.h"
#include "start_menu.h"
#include "task.h"
// #include "tileset_anim.h"
@@ -50,14 +52,11 @@
#include "tv.h"
#include "scanline_effect.h"
#include "wild_encounter.h"
-#include "bg.h"
-#include "money.h"
-#include "save_location.h"
#include "constants/abilities.h"
-#include "malloc.h"
-#include "gpu_regs.h"
-#include "link_rfu.h"
#include "constants/map_types.h"
+#include "constants/maps.h"
+#include "constants/songs.h"
+#include "constants/species.h"
// event scripts
extern const u8 EventScript_WhiteOut[];
@@ -159,7 +158,6 @@ extern void sub_80AAFA4(void);
extern void ShowStartMenu(void);
extern void sub_80AEE84(void);
extern void mapldr_default(void);
-extern void npc_paltag_set_load(u8);
extern void sub_8088B3C(u16, u16);
extern bool32 sub_800F0B8(void);
extern bool32 sub_8009F3C(void);
@@ -185,7 +183,7 @@ static bool32 sub_8086638(u8 *state);
static bool32 load_map_stuff(u8 *state, u32);
static bool32 map_loading_iteration_2_link(u8 *state);
static void mli4_mapscripts_and_other(void);
-static void map_loading_lcd_reset(void);
+static void InitOverworldGraphicsRegisters(void);
static u8 sub_8087858(u8);
static u16 sub_80871C0(u32 a1);
static void sub_80867C8(void);
@@ -246,9 +244,9 @@ static void c1_link_related_func_set(u16 (*func)(u32));
static void SetFieldVBlankCallback(void);
static void FieldClearVBlankHBlankCallbacks(void);
static void sub_8085810(void);
-static u8 sub_808532C(struct UnkPlayerStruct *playerStruct, u16 a2, u8 a3);
-static u8 sub_808538C(struct UnkPlayerStruct *playerStruct, u8 a2, u16 a3, u8 a4);
-static u16 cur_mapdata_block_role_at_screen_center_acc_to_sav1(void);
+static u8 GetAdjustedInitialTransitionFlags(struct InitialPlayerAvatarState *playerStruct, u16 a2, u8 a3);
+static u8 GetAdjustedInitialDirection(struct InitialPlayerAvatarState *playerStruct, u8 a2, u16 a3, u8 a4);
+static u16 GetCenterScreenMetatileBehavior(void);
// IWRAM bss vars
IWRAM_DATA static void *sUnknown_03000E0C;
@@ -260,12 +258,12 @@ IWRAM_DATA static u32 sUnusedVar;
// EWRAM vars
EWRAM_DATA static u8 sUnknown_020322D8 = 0;
-EWRAM_DATA struct WarpData gUnknown_020322DC = {0};
+EWRAM_DATA struct WarpData gLastUsedWarp = {0};
EWRAM_DATA static struct WarpData sWarpDestination = {0}; // new warp position
-EWRAM_DATA static struct WarpData sUnknown_020322EC = {0};
-EWRAM_DATA static struct WarpData sUnknown_020322F4 = {0};
+EWRAM_DATA static struct WarpData gFixedDiveWarp = {0};
+EWRAM_DATA static struct WarpData gFixedHoleWarp = {0};
EWRAM_DATA static u16 sLastMapSectionId = 0;
-EWRAM_DATA static struct UnkPlayerStruct sUnknown_02032300 = {0};
+EWRAM_DATA static struct InitialPlayerAvatarState gInitialPlayerAvatarState = {0};
EWRAM_DATA static u16 sAmbientCrySpecies = 0;
EWRAM_DATA static bool8 sIsAmbientCryWaterMon = FALSE;
EWRAM_DATA struct LinkPlayerEventObject gLinkPlayerEventObjects[4] = {0};
@@ -292,17 +290,17 @@ static const u8 sUnusedData[] =
0x2C, 0x00, 0x00, 0x00,
};
-const struct UCoords32 gUnknown_08339D64[] =
-{
- { 0, 0},
- { 0, 1},
- { 0, -1},
- {-1, 0},
- { 1, 0},
- {-1, 1},
- { 1, 1},
- {-1, -1},
- { 1, -1},
+const struct UCoords32 gDirectionToVectors[] =
+{
+ { 0, 0}, // DIR_NONE
+ { 0, 1}, // DIR_SOUTH
+ { 0, -1}, // DIR_NORTH
+ {-1, 0}, // DIR_WEST
+ { 1, 0}, // DIR_EAST
+ {-1, 1}, // DIR_SOUTHWEST
+ { 1, 1}, // DIR_SOUTHEAST
+ {-1, -1}, // DIR_NORTHWEST
+ { 1, -1}, // DIR_NORTHEAST
};
static const struct BgTemplate gUnknown_08339DAC[] =
@@ -345,7 +343,7 @@ static const struct BgTemplate gUnknown_08339DAC[] =
}
};
-static const struct ScanlineEffectParams gUnknown_08339DBC =
+static const struct ScanlineEffectParams sFlashEffectParams =
{
(void *)REG_ADDR_WIN0H,
((DMA_ENABLE | DMA_START_HBLANK | DMA_REPEAT | DMA_DEST_RELOAD) << 16) | 1,
@@ -400,12 +398,12 @@ void DoWhiteOut(void)
HealPlayerParty();
Overworld_ResetStateAfterWhiteOut();
Overworld_SetWarpDestToLastHealLoc();
- warp_in();
+ WarpIntoMap();
}
void Overworld_ResetStateAfterFly(void)
{
- player_avatar_init_params_reset();
+ ResetInitialPlayerAvatarState();
FlagClear(FLAG_SYS_CYCLING_ROAD);
FlagClear(FLAG_SYS_CRUISE_MODE);
FlagClear(FLAG_SYS_SAFARI_MODE);
@@ -415,7 +413,7 @@ void Overworld_ResetStateAfterFly(void)
void Overworld_ResetStateAfterTeleport(void)
{
- player_avatar_init_params_reset();
+ ResetInitialPlayerAvatarState();
FlagClear(FLAG_SYS_CYCLING_ROAD);
FlagClear(FLAG_SYS_CRUISE_MODE);
FlagClear(FLAG_SYS_SAFARI_MODE);
@@ -426,7 +424,7 @@ void Overworld_ResetStateAfterTeleport(void)
void Overworld_ResetStateAfterDigEscRope(void)
{
- player_avatar_init_params_reset();
+ ResetInitialPlayerAvatarState();
FlagClear(FLAG_SYS_CYCLING_ROAD);
FlagClear(FLAG_SYS_CRUISE_MODE);
FlagClear(FLAG_SYS_SAFARI_MODE);
@@ -436,7 +434,7 @@ void Overworld_ResetStateAfterDigEscRope(void)
static void Overworld_ResetStateAfterWhiteOut(void)
{
- player_avatar_init_params_reset();
+ ResetInitialPlayerAvatarState();
FlagClear(FLAG_SYS_CYCLING_ROAD);
FlagClear(FLAG_SYS_CRUISE_MODE);
FlagClear(FLAG_SYS_SAFARI_MODE);
@@ -575,16 +573,16 @@ const struct MapLayout *GetMapLayout(void)
void ApplyCurrentWarp(void)
{
- gUnknown_020322DC = gSaveBlock1Ptr->location;
+ gLastUsedWarp = gSaveBlock1Ptr->location;
gSaveBlock1Ptr->location = sWarpDestination;
- sUnknown_020322EC = sDummyWarpData;
- sUnknown_020322F4 = sDummyWarpData;
+ gFixedDiveWarp = sDummyWarpData;
+ gFixedHoleWarp = sDummyWarpData;
}
void set_warp2_warp3_to_neg_1(void)
{
- sUnknown_020322EC = sDummyWarpData;
- sUnknown_020322F4 = sDummyWarpData;
+ gFixedDiveWarp = sDummyWarpData;
+ gFixedHoleWarp = sDummyWarpData;
}
void SetWarpData(struct WarpData *warp, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
@@ -596,7 +594,7 @@ void SetWarpData(struct WarpData *warp, s8 mapGroup, s8 mapNum, s8 warpId, s8 x,
warp->y = y;
}
-bool32 warp_data_is_not_neg_1(struct WarpData *warp)
+bool32 IsDummyWarp(struct WarpData *warp)
{
if (warp->mapGroup != -1)
return FALSE;
@@ -617,12 +615,12 @@ struct MapHeader const *const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u
return gMapGroups[mapGroup][mapNum];
}
-struct MapHeader const *const warp1_get_mapheader(void)
+struct MapHeader const *const GetDestinationWarpMapHeader(void)
{
return Overworld_GetMapHeaderByGroupAndId(sWarpDestination.mapGroup, sWarpDestination.mapNum);
}
-void set_current_map_header_from_sav1_save_old_name(void)
+void LoadCurrentMapData(void)
{
sLastMapSectionId = gMapHeader.regionMapSectionId;
gMapHeader = *Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum);
@@ -636,7 +634,7 @@ void LoadSaveblockMapHeader(void)
gMapHeader.mapLayout = GetMapLayout();
}
-void update_camera_pos_from_warpid(void)
+void SetPlayerCoordsFromWarp(void)
{
if (gSaveBlock1Ptr->location.warpId >= 0 && gSaveBlock1Ptr->location.warpId < gMapHeader.events->warpCount)
{
@@ -655,11 +653,11 @@ void update_camera_pos_from_warpid(void)
}
}
-void warp_in(void)
+void WarpIntoMap(void)
{
ApplyCurrentWarp();
- set_current_map_header_from_sav1_save_old_name();
- update_camera_pos_from_warpid();
+ LoadCurrentMapData();
+ SetPlayerCoordsFromWarp();
}
void Overworld_SetWarpDestination(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
@@ -726,27 +724,27 @@ void sub_8084E14(void)
sWarpDestination = gSaveBlock1Ptr->warp4;
}
-void sub_8084E2C(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
+void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
{
- SetWarpData(&sUnknown_020322EC, mapGroup, mapNum, warpId, x, y);
+ SetWarpData(&gFixedDiveWarp, mapGroup, mapNum, warpId, x, y);
}
-void warp1_set_to_warp2(void)
+void SetFixedDiveWarpAsDestination(void)
{
- sWarpDestination = sUnknown_020322EC;
+ sWarpDestination = gFixedDiveWarp;
}
-void sub_8084E80(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
+void SetFixedHoleWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
{
- SetWarpData(&sUnknown_020322F4, mapGroup, mapNum, warpId, x, y);
+ SetWarpData(&gFixedHoleWarp, mapGroup, mapNum, warpId, x, y);
}
-void sub_8084EBC(s16 x, s16 y)
+void SetFixedHoleWarpAsDestination(s16 x, s16 y)
{
- if (warp_data_is_not_neg_1(&sUnknown_020322F4) == TRUE)
- sWarpDestination = gUnknown_020322DC;
+ if (IsDummyWarp(&gFixedHoleWarp) == TRUE)
+ sWarpDestination = gLastUsedWarp;
else
- Overworld_SetWarpDestination(sUnknown_020322F4.mapGroup, sUnknown_020322F4.mapNum, -1, x, y);
+ Overworld_SetWarpDestination(gFixedHoleWarp.mapGroup, gFixedHoleWarp.mapNum, -1, x, y);
}
void warp1_set_to_sav1w(void)
@@ -787,7 +785,7 @@ const struct MapConnection *GetMapConnection(u8 dir)
return NULL;
}
-bool8 sub_8084FF8(u8 dir, u16 x, u16 y)
+bool8 SetDiveWarp(u8 dir, u16 x, u16 y)
{
const struct MapConnection *connection = GetMapConnection(dir);
@@ -798,21 +796,21 @@ bool8 sub_8084FF8(u8 dir, u16 x, u16 y)
else
{
mapheader_run_script_with_tag_x6();
- if (warp_data_is_not_neg_1(&sUnknown_020322EC))
+ if (IsDummyWarp(&gFixedDiveWarp))
return FALSE;
- warp1_set_to_warp2();
+ SetFixedDiveWarpAsDestination();
}
return TRUE;
}
-bool8 sub_8085058(u16 x, u16 y)
+bool8 SetDiveWarpEmerge(u16 x, u16 y)
{
- return sub_8084FF8(CONNECTION_EMERGE, x, y);
+ return SetDiveWarp(CONNECTION_EMERGE, x, y);
}
-bool8 sub_8085078(u16 x, u16 y)
+bool8 SetDiveWarpDive(u16 x, u16 y)
{
- return sub_8084FF8(CONNECTION_DIVE, x, y);
+ return SetDiveWarp(CONNECTION_DIVE, x, y);
}
void mliX_load_map(u8 mapGroup, u8 mapNum)
@@ -824,7 +822,7 @@ void mliX_load_map(u8 mapGroup, u8 mapNum)
sub_8085810();
ApplyCurrentWarp();
- set_current_map_header_from_sav1_save_old_name();
+ LoadCurrentMapData();
LoadEventObjTemplatesFromHeader();
TrySetMapSaveWarpStatus();
ClearTempFieldEventData();
@@ -860,7 +858,7 @@ static void mli0_load_map(u32 a1)
bool8 v2;
bool8 indoors;
- set_current_map_header_from_sav1_save_old_name();
+ LoadCurrentMapData();
if (!(sUnknown_020322D8 & 1))
{
if (gMapHeader.mapLayoutId == 0x169)
@@ -905,84 +903,84 @@ static void mli0_load_map(u32 a1)
}
}
-void player_avatar_init_params_reset(void)
+void ResetInitialPlayerAvatarState(void)
{
- sUnknown_02032300.player_field_1 = 1;
- sUnknown_02032300.player_field_0 = 1;
+ gInitialPlayerAvatarState.direction = 1;
+ gInitialPlayerAvatarState.transitionFlags = 1;
}
-void walkrun_find_lowest_active_bit_in_bitfield(void)
+void StoreInitialPlayerAvatarState(void)
{
- sUnknown_02032300.player_field_1 = GetPlayerFacingDirection();
+ gInitialPlayerAvatarState.direction = GetPlayerFacingDirection();
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE))
- sUnknown_02032300.player_field_0 = 2;
+ gInitialPlayerAvatarState.transitionFlags = 2;
else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE))
- sUnknown_02032300.player_field_0 = 4;
+ gInitialPlayerAvatarState.transitionFlags = 4;
else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
- sUnknown_02032300.player_field_0 = 8;
+ gInitialPlayerAvatarState.transitionFlags = 8;
else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_4))
- sUnknown_02032300.player_field_0 = 16;
+ gInitialPlayerAvatarState.transitionFlags = 16;
else
- sUnknown_02032300.player_field_0 = 1;
+ gInitialPlayerAvatarState.transitionFlags = 1;
}
-static struct UnkPlayerStruct *sub_80852D4(void)
+static struct InitialPlayerAvatarState *GetInitialPlayerAvatarState(void)
{
- struct UnkPlayerStruct playerStruct;
+ struct InitialPlayerAvatarState playerStruct;
u8 mapType = Overworld_GetMapTypeOfSaveblockLocation();
- u16 v2 = cur_mapdata_block_role_at_screen_center_acc_to_sav1();
- u8 v4 = sub_808532C(&sUnknown_02032300, v2, mapType);
- playerStruct.player_field_0 = v4;
- playerStruct.player_field_1 = sub_808538C(&sUnknown_02032300, v4, v2, mapType);
- sUnknown_02032300 = playerStruct;
- return &sUnknown_02032300;
+ u16 metatileBehavior = GetCenterScreenMetatileBehavior();
+ u8 transitionFlags = GetAdjustedInitialTransitionFlags(&gInitialPlayerAvatarState, metatileBehavior, mapType);
+ playerStruct.transitionFlags = transitionFlags;
+ playerStruct.direction = GetAdjustedInitialDirection(&gInitialPlayerAvatarState, transitionFlags, metatileBehavior, mapType);
+ gInitialPlayerAvatarState = playerStruct;
+ return &gInitialPlayerAvatarState;
}
-static u8 sub_808532C(struct UnkPlayerStruct *playerStruct, u16 a2, u8 a3)
+static u8 GetAdjustedInitialTransitionFlags(struct InitialPlayerAvatarState *playerStruct, u16 metatileBehavior, u8 mapType)
{
- if (a3 != 8 && FlagGet(FLAG_SYS_CRUISE_MODE))
+ if (mapType != MAP_TYPE_INDOOR && FlagGet(FLAG_SYS_CRUISE_MODE))
return 1;
- else if (a3 == 5)
+ else if (mapType == MAP_TYPE_UNDERWATER)
return 16;
- else if (MetatileBehavior_IsSurfableWaterOrUnderwater(a2) == 1)
+ else if (MetatileBehavior_IsSurfableWaterOrUnderwater(metatileBehavior) == TRUE)
return 8;
else if (Overworld_IsBikingAllowed() != TRUE)
return 1;
- else if (playerStruct->player_field_0 == 2)
+ else if (playerStruct->transitionFlags == 2)
return 2;
- else if (playerStruct->player_field_0 != 4)
+ else if (playerStruct->transitionFlags != 4)
return 1;
else
return 4;
}
-static u8 sub_808538C(struct UnkPlayerStruct *playerStruct, u8 a2, u16 a3, u8 a4)
+static u8 GetAdjustedInitialDirection(struct InitialPlayerAvatarState *playerStruct, u8 transitionFlags, u16 metatileBehavior, u8 mapType)
{
- if (FlagGet(FLAG_SYS_CRUISE_MODE) && a4 == 6)
+ if (FlagGet(FLAG_SYS_CRUISE_MODE) && mapType == MAP_TYPE_6)
return 4;
- else if (MetatileBehavior_IsDeepSouthWarp(a3) == TRUE)
+ else if (MetatileBehavior_IsDeepSouthWarp(metatileBehavior) == TRUE)
return 2;
- else if (MetatileBehavior_IsNonAnimDoor(a3) == TRUE || MetatileBehavior_IsDoor(a3) == TRUE)
+ else if (MetatileBehavior_IsNonAnimDoor(metatileBehavior) == TRUE || MetatileBehavior_IsDoor(metatileBehavior) == TRUE)
return 1;
- else if (MetatileBehavior_IsSouthArrowWarp(a3) == TRUE)
+ else if (MetatileBehavior_IsSouthArrowWarp(metatileBehavior) == TRUE)
return 2;
- else if (MetatileBehavior_IsNorthArrowWarp(a3) == TRUE)
+ else if (MetatileBehavior_IsNorthArrowWarp(metatileBehavior) == TRUE)
return 1;
- else if (MetatileBehavior_IsWestArrowWarp(a3) == TRUE)
+ else if (MetatileBehavior_IsWestArrowWarp(metatileBehavior) == TRUE)
return 4;
- else if (MetatileBehavior_IsEastArrowWarp(a3) == TRUE)
+ else if (MetatileBehavior_IsEastArrowWarp(metatileBehavior) == TRUE)
return 3;
- else if ((playerStruct->player_field_0 == 16 && a2 == 8)
- || (playerStruct->player_field_0 == 8 && a2 == 16))
- return playerStruct->player_field_1;
- else if (MetatileBehavior_IsLadder(a3) == TRUE)
- return playerStruct->player_field_1;
+ else if ((playerStruct->transitionFlags == 16 && transitionFlags == 8)
+ || (playerStruct->transitionFlags == 8 && transitionFlags == 16))
+ return playerStruct->direction;
+ else if (MetatileBehavior_IsLadder(metatileBehavior) == TRUE)
+ return playerStruct->direction;
else
return 1;
}
-static u16 cur_mapdata_block_role_at_screen_center_acc_to_sav1(void)
+static u16 GetCenterScreenMetatileBehavior(void)
{
return MapGridGetMetatileBehaviorAt(gSaveBlock1Ptr->pos.x + 7, gSaveBlock1Ptr->pos.y + 7);
}
@@ -1232,7 +1230,7 @@ void Overworld_ChangeMusicTo(u16 newMusic)
u8 GetMapMusicFadeoutSpeed(void)
{
- const struct MapHeader *mapHeader = warp1_get_mapheader();
+ const struct MapHeader *mapHeader = GetDestinationWarpMapHeader();
if (Overworld_MapTypeIsIndoors(mapHeader->mapType) == TRUE)
return 2;
else
@@ -1258,7 +1256,7 @@ void music_something(void)
}
}
-bool8 sub_80859A0(void)
+bool8 BGMusicStopped(void)
{
return IsNotWaitingForBGMStop();
}
@@ -1361,7 +1359,7 @@ u8 Overworld_GetMapTypeOfSaveblockLocation(void)
u8 get_map_light_from_warp0(void)
{
- return GetMapTypeByWarpData(&gUnknown_020322DC);
+ return GetMapTypeByWarpData(&gLastUsedWarp);
}
bool8 is_map_type_1_2_3_5_or_6(u8 mapType)
@@ -1550,7 +1548,7 @@ void CB2_NewGame(void)
StopMapMusic();
ResetSafariZoneFlag_();
NewGameInitData();
- player_avatar_init_params_reset();
+ ResetInitialPlayerAvatarState();
PlayTimeCounter_Start();
ScriptContext1_Init();
ScriptContext2_Disable();
@@ -1572,7 +1570,7 @@ void CB2_WhiteOut(void)
StopMapMusic();
ResetSafariZoneFlag_();
DoWhiteOut();
- player_avatar_init_params_reset();
+ ResetInitialPlayerAvatarState();
ScriptContext1_Init();
ScriptContext2_Disable();
gFieldCallback = sub_80AF3C8;
@@ -1755,7 +1753,7 @@ void CB2_ContinueSavedGame(void)
{
ClearSecretBase2Field_9();
warp1_set_to_sav1w();
- warp_in();
+ WarpIntoMap();
sub_80EDB44();
SetMainCallback2(CB2_LoadMap);
}
@@ -1806,19 +1804,19 @@ static void VBlankCB_Field(void)
TransferTilesetAnimsBuffer();
}
-static void sub_80863B0(void)
+static void InitCurrentFlashLevelScanlineEffect(void)
{
- u8 val;
+ u8 flashLevel;
if (sub_81A9E6C())
{
door_upload_tiles();
- ScanlineEffect_SetParams(gUnknown_08339DBC);
+ ScanlineEffect_SetParams(sFlashEffectParams);
}
- else if ((val = Overworld_GetFlashLevel()))
+ else if ((flashLevel = Overworld_GetFlashLevel()))
{
- sub_80B00E8(val);
- ScanlineEffect_SetParams(gUnknown_08339DBC);
+ sub_80B00E8(flashLevel);
+ ScanlineEffect_SetParams(sFlashEffectParams);
}
}
@@ -1850,8 +1848,8 @@ static bool32 map_loading_iteration_3(u8 *state)
(*state)++;
break;
case 4:
- sub_80863B0();
- map_loading_lcd_reset();
+ InitCurrentFlashLevelScanlineEffect();
+ InitOverworldGraphicsRegisters();
sub_8197200();
(*state)++;
break;
@@ -1925,8 +1923,8 @@ static bool32 load_map_stuff(u8 *state, u32 a2)
(*state)++;
break;
case 4:
- sub_80863B0();
- map_loading_lcd_reset();
+ InitCurrentFlashLevelScanlineEffect();
+ InitOverworldGraphicsRegisters();
sub_8197200();
(*state)++;
break;
@@ -2022,8 +2020,8 @@ static bool32 map_loading_iteration_2_link(u8 *state)
(*state)++;
break;
case 3:
- sub_80863B0();
- map_loading_lcd_reset();
+ InitCurrentFlashLevelScanlineEffect();
+ InitOverworldGraphicsRegisters();
sub_8197200();
(*state)++;
break;
@@ -2102,13 +2100,13 @@ static void sub_80867D8(void)
static void sub_8086860(void)
{
- sub_80863B0();
- map_loading_lcd_reset();
+ InitCurrentFlashLevelScanlineEffect();
+ InitOverworldGraphicsRegisters();
sub_8197200();
mapdata_load_assets_to_gpu_and_full_redraw();
}
-static void map_loading_lcd_reset(void)
+static void InitOverworldGraphicsRegisters(void)
{
clear_scheduled_bg_copies_to_vram();
reset_temp_tile_data_buffers();
@@ -2153,9 +2151,9 @@ static void sub_8086988(u32 a1)
ResetCameraUpdateInfo();
InstallCameraPanAheadCallback();
if (!a1)
- npc_paltag_set_load(0);
+ InitEventObjectPalettes(0);
else
- npc_paltag_set_load(1);
+ InitEventObjectPalettes(1);
FieldEffectActiveListClear();
sub_80AAFA4();
@@ -2178,16 +2176,16 @@ static void sub_80869DC(void)
static void mli4_mapscripts_and_other(void)
{
s16 x, y;
- struct UnkPlayerStruct *player;
+ struct InitialPlayerAvatarState *player;
gUnknown_03005DEC = 0;
gUnknown_03005DE8 = 0;
sub_808D438();
sav1_camera_get_focus_coords(&x, &y);
- player = sub_80852D4();
- InitPlayerAvatar(x, y, player->player_field_1, gSaveBlock2Ptr->playerGender);
- SetPlayerAvatarTransitionFlags(player->player_field_0);
- player_avatar_init_params_reset();
+ player = GetInitialPlayerAvatarState();
+ InitPlayerAvatar(x, y, player->direction, gSaveBlock2Ptr->playerGender);
+ SetPlayerAvatarTransitionFlags(player->transitionFlags);
+ ResetInitialPlayerAvatarState();
TrySpawnEventObjects(0, 0);
mapheader_run_first_tag4_script_list_match();
}
@@ -2732,8 +2730,8 @@ static const u8 *sub_80873B4(struct UnkStruct_8054FF8 *a1)
return 0;
unkStruct = a1->sub;
- unkStruct.x += gUnknown_08339D64[a1->d].x;
- unkStruct.y += gUnknown_08339D64[a1->d].y;
+ unkStruct.x += gDirectionToVectors[a1->d].x;
+ unkStruct.y += gDirectionToVectors[a1->d].y;
unkStruct.height = 0;
linkPlayerId = GetLinkPlayerIdAt(unkStruct.x, unkStruct.y);
@@ -3166,12 +3164,12 @@ static void SpriteCB_LinkPlayer(struct Sprite *sprite)
SetObjectSubpriorityByZCoord(eventObj->previousElevation, sprite, 1);
sprite->oam.priority = ZCoordToPriority(eventObj->previousElevation);
- if (!linkPlayerEventObj->mode)
+ if (!linkPlayerEventObj->mode)
StartSpriteAnim(sprite, GetFaceDirectionAnimNum(eventObj->range.as_byte));
else
StartSpriteAnimIfDifferent(sprite, GetMoveDirectionAnimNum(eventObj->range.as_byte));
- UpdateEventObjectSpriteVisibility(sprite, 0);
+ UpdateEventObjectSpriteVisibility(sprite, 0);
if (eventObj->triggerGroundEffectsOnMove)
{
sprite->invisible = ((sprite->data[7] & 4) >> 2);
diff --git a/src/player_pc.c b/src/player_pc.c
index ef00e2e06..7ac8e78d5 100644
--- a/src/player_pc.c
+++ b/src/player_pc.c
@@ -184,9 +184,33 @@ const struct MenuAction gMailboxMailOptions[] =
static const struct WindowTemplate gUnknown_085DFF24[3] =
{
- {0x00, 0x01, 0x01, 0x09, 0x06, 0x0F, 0x0001},
- {0x00, 0x01, 0x01, 0x09, 0x08, 0x0F, 0x0001},
- {0x00, 0x01, 0x01, 0x0A, 0x08, 0x0F, 0x0001}
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 1,
+ .width = 9,
+ .height = 6,
+ .paletteNum = 15,
+ .baseBlock = 1
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 1,
+ .width = 9,
+ .height = 8,
+ .paletteNum = 15,
+ .baseBlock = 1
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 1,
+ .width = 10,
+ .height = 8,
+ .paletteNum = 15,
+ .baseBlock = 1
+ }
};
static const struct YesNoFuncTable ResumeFromWithdrawYesNoFuncList = // ResumeFromWithdrawYesNoFuncList
@@ -195,27 +219,85 @@ static const struct YesNoFuncTable ResumeFromWithdrawYesNoFuncList = // ResumeFr
ItemStorage_ResumeInputFromNoToss
};
-static const struct ListMenuTemplate gUnknown_085DFF44 = {
- NULL,
- ItemStorage_MoveCursor,
- fish4_goto_x5_or_x6,
- 0, 0,
- 0, 0, 8, 0,
- 9, 2, 1, 3, FALSE, 0, FALSE, 7
+static const struct ListMenuTemplate gUnknown_085DFF44 =
+{
+ .items = NULL,
+ .moveCursorFunc = ItemStorage_MoveCursor,
+ .itemPrintFunc = fish4_goto_x5_or_x6,
+ .totalItems = 0,
+ .maxShowed = 0,
+ .windowId = 0,
+ .header_X = 0,
+ .item_X = 8,
+ .cursor_X = 0,
+ .upText_Y = 9,
+ .cursorPal = 2,
+ .fillValue = 1,
+ .cursorShadowPal = 3,
+ .lettersSpacing = FALSE,
+ .itemVerticalPadding = 0,
+ .scrollMultiple = FALSE,
+ .fontId = 7
};
static const struct WindowTemplate gUnknown_085DFF5C[5] =
{
- {0x00, 0x10, 0x01, 0x0D, 0x12, 0x0F, 0x0001},
- {0x00, 0x01, 0x0D, 0x0D, 0x06, 0x0F, 0x00EB},
- {0x00, 0x01, 0x08, 0x03, 0x03, 0x0F, 0x0153},
- {0x00, 0x01, 0x01, 0x0D, 0x02, 0x0F, 0x0139},
- {0x00, 0x08, 0x09, 0x06, 0x02, 0x0F, 0x015C}
+ {
+ .priority = 0,
+ .tilemapLeft = 16,
+ .tilemapTop = 1,
+ .width = 13,
+ .height = 18,
+ .paletteNum = 15,
+ .baseBlock = 0x0001
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 13,
+ .width = 13,
+ .height = 6,
+ .paletteNum = 15,
+ .baseBlock = 0x00EB
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 8,
+ .width = 3,
+ .height = 3,
+ .paletteNum = 15,
+ .baseBlock = 0x0153
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 1,
+ .width = 13,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x0139
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 8,
+ .tilemapTop = 9,
+ .width = 6,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x015C
+ }
};
static const struct WindowTemplate gUnknown_085DFF84 =
{
- 0x00, 0x09, 0x07, 0x05, 0x04, 0x0F, 0x0168
+ .priority = 0,
+ .tilemapLeft = 9,
+ .tilemapTop = 7,
+ .width = 5,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 0x0168
};
static const u8 gUnknown_085DFF8C[] = {0x01, 0x03, 0x02, 0x00};
@@ -476,7 +558,7 @@ static void ItemStorage_WithdrawToss_Helper(u8 taskId, bool8 toss)
playerPCItemPageInfo.scrollIndicatorId = 0xFF;
ItemStorage_SetItemAndMailCount(taskId);
sub_816BC14();
- gpu_pal_allocator_reset__manage_upper_four();
+ FreeAndReserveObjectSpritePalettes();
LoadListMenuArrowsGfx();
sub_8122344(gUnknown_0203BCC4->spriteIds, 7);
sub_8197434(0,0);
diff --git a/src/pokeblock.c b/src/pokeblock.c
index e615693b9..0fa2cde04 100644
--- a/src/pokeblock.c
+++ b/src/pokeblock.c
@@ -294,21 +294,118 @@ static const struct Pokeblock sFavoritePokeblocksTable[] =
static const struct WindowTemplate sWindowTemplatesForPokeblockMenu[] =
{
- {0, 2, 1, 9, 2, 0xF, 0x1E},
- {0, 0xF, 1, 0xE, 0x12, 0xF, 0x30},
- {0, 2, 0xD, 5, 2, 0xF, 0x12C},
- {0, 2, 0xF, 5, 2, 0xF, 0x136},
- {0, 2, 0x11, 5, 2, 0xF, 0x140},
- {0, 8, 0xD, 5, 2, 0xF, 0x14A},
- {0, 8, 0xF, 5, 2, 0xF, 0x154},
- {0, 0xB, 0x11, 2, 2, 0xF, 0x15E},
- {1, 7, 5, 6, 6, 0xF, 0x162},
- {1, 7, 7, 6, 4, 0xF, 0x186},
- {1, 2, 0xF, 0x1B, 4, 0xF, 0x19E},
+ {
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 1,
+ .width = 9,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x1E
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 15,
+ .tilemapTop = 1,
+ .width = 14,
+ .height = 18,
+ .paletteNum = 15,
+ .baseBlock = 0x30
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 13,
+ .width = 5,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x12C
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 15,
+ .width = 5,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x136
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 2,
+ .tilemapTop = 17,
+ .width = 5,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x140
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 8,
+ .tilemapTop = 13,
+ .width = 5,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x14A
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 8,
+ .tilemapTop = 15,
+ .width = 5,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x154
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 11,
+ .tilemapTop = 17,
+ .width = 2,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x15E
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 7,
+ .tilemapTop = 5,
+ .width = 6,
+ .height = 6,
+ .paletteNum = 15,
+ .baseBlock = 0x162
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 7,
+ .tilemapTop = 7,
+ .width = 6,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 0x186
+ },
+ {
+ .priority = 1,
+ .tilemapLeft = 2,
+ .tilemapTop = 15,
+ .width = 27,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 0x19E
+ },
DUMMY_WIN_TEMPLATE
};
-static const struct WindowTemplate sTossPkblockWindowTemplate = {1, 0x15, 9, 5, 4, 0xF, 0x20A};
+static const struct WindowTemplate sTossPkblockWindowTemplate =
+{
+ .priority = 1,
+ .tilemapLeft = 21,
+ .tilemapTop = 9,
+ .width = 5,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 0x20A
+};
static const struct ListMenuTemplate sPokeblockListMenuTemplate =
{
diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c
index 9648747e7..6b51c6e07 100644
--- a/src/pokemon_summary_screen.c
+++ b/src/pokemon_summary_screen.c
@@ -172,7 +172,7 @@ static void sub_81C2074(u16 a, s16 b);
static void sub_81C20F0(u8 taskId);
static void sub_81C2194(u16 *a, u16 b, u8 c);
static void sub_81C2228(struct Pokemon* mon);
-static void sub_81C22CC(struct Pokemon* mon);
+static void DrawExperienceProgressBar(struct Pokemon* mon);
static void sub_81C240C(u16 a);
static void sub_81C2524(void);
static void sub_81C2554(void);
@@ -313,48 +313,304 @@ static const struct UnkStruct_61CC04 gUnknown_0861CC10 =
static const s8 gUnknown_0861CC1C[] = {0, 2, 3, 1, 4, 5};
static const struct WindowTemplate gUnknown_0861CC24[] =
{
- { 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x0001 },
- { 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x0017 },
- { 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x002d },
- { 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x0043 },
- { 0x00, 0x16, 0x00, 0x08, 0x02, 0x07, 0x0059 },
- { 0x00, 0x16, 0x00, 0x08, 0x02, 0x07, 0x0069 },
- { 0x00, 0x16, 0x00, 0x08, 0x02, 0x07, 0x0079 },
- { 0x00, 0x0b, 0x04, 0x00, 0x02, 0x06, 0x0089 },
- { 0x00, 0x0b, 0x04, 0x12, 0x02, 0x06, 0x0089 },
- { 0x00, 0x0b, 0x06, 0x12, 0x02, 0x06, 0x00ad },
- { 0x00, 0x0a, 0x07, 0x06, 0x06, 0x06, 0x00d1 },
- { 0x00, 0x16, 0x07, 0x05, 0x06, 0x06, 0x00f5 },
- { 0x00, 0x0a, 0x0e, 0x0b, 0x04, 0x06, 0x0113 },
- { 0x00, 0x00, 0x12, 0x06, 0x02, 0x06, 0x013f },
- { 0x00, 0x01, 0x0f, 0x09, 0x04, 0x06, 0x014b },
- { 0x00, 0x01, 0x0f, 0x05, 0x04, 0x06, 0x016f },
- { 0x00, 0x16, 0x04, 0x00, 0x02, 0x06, 0x0183 },
- { 0x00, 0x01, 0x02, 0x04, 0x02, 0x07, 0x0183 },
- { 0x00, 0x01, 0x0c, 0x09, 0x02, 0x06, 0x018b },
- { 0x00, 0x01, 0x0e, 0x09, 0x04, 0x06, 0x019d },
+ {
+ .priority = 0,
+ .tilemapLeft = 0,
+ .tilemapTop = 0,
+ .width = 11,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 1,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 0,
+ .tilemapTop = 0,
+ .width = 11,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 23,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 0,
+ .tilemapTop = 0,
+ .width = 11,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 45,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 0,
+ .tilemapTop = 0,
+ .width = 11,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 67,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 22,
+ .tilemapTop = 0,
+ .width = 8,
+ .height = 2,
+ .paletteNum = 7,
+ .baseBlock = 89,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 22,
+ .tilemapTop = 0,
+ .width = 8,
+ .height = 2,
+ .paletteNum = 7,
+ .baseBlock = 105,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 22,
+ .tilemapTop = 0,
+ .width = 8,
+ .height = 2,
+ .paletteNum = 7,
+ .baseBlock = 121,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 11,
+ .tilemapTop = 4,
+ .width = 0,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 137,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 11,
+ .tilemapTop = 4,
+ .width = 18,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 137,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 11,
+ .tilemapTop = 6,
+ .width = 18,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 173,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 10,
+ .tilemapTop = 7,
+ .width = 6,
+ .height = 6,
+ .paletteNum = 6,
+ .baseBlock = 209,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 22,
+ .tilemapTop = 7,
+ .width = 5,
+ .height = 6,
+ .paletteNum = 6,
+ .baseBlock = 245,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 10,
+ .tilemapTop = 14,
+ .width = 11,
+ .height = 4,
+ .paletteNum = 6,
+ .baseBlock = 275,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 0,
+ .tilemapTop = 18,
+ .width = 6,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 319,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 15,
+ .width = 9,
+ .height = 4,
+ .paletteNum = 6,
+ .baseBlock = 331,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 15,
+ .width = 5,
+ .height = 4,
+ .paletteNum = 6,
+ .baseBlock = 367,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 22,
+ .tilemapTop = 4,
+ .width = 0,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 387,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 2,
+ .width = 4,
+ .height = 2,
+ .paletteNum = 7,
+ .baseBlock = 387,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 12,
+ .width = 9,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 395,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 14,
+ .width = 9,
+ .height = 4,
+ .paletteNum = 6,
+ .baseBlock = 413,
+ },
DUMMY_WIN_TEMPLATE
};
static const struct WindowTemplate gUnknown_0861CCCC[] =
{
- { 0x00, 0x0b, 0x04, 0x0b, 0x02, 0x06, 0x01c1 },
- { 0x00, 0x16, 0x04, 0x07, 0x02, 0x06, 0x01d7 },
- { 0x00, 0x0b, 0x09, 0x12, 0x04, 0x06, 0x01e5 },
- { 0x00, 0x0b, 0x0e, 0x12, 0x06, 0x06, 0x022d },
+ {
+ .priority = 0,
+ .tilemapLeft = 11,
+ .tilemapTop = 4,
+ .width = 11,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 449,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 22,
+ .tilemapTop = 4,
+ .width = 7,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 471,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 11,
+ .tilemapTop = 9,
+ .width = 18,
+ .height = 4,
+ .paletteNum = 6,
+ .baseBlock = 485,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 11,
+ .tilemapTop = 14,
+ .width = 18,
+ .height = 6,
+ .paletteNum = 6,
+ .baseBlock = 557,
+ },
};
static const struct WindowTemplate gUnknown_0861CCEC[] =
{
- { 0x00, 0x0a, 0x04, 0x0a, 0x02, 0x06, 0x01c1 },
- { 0x00, 0x14, 0x04, 0x0a, 0x02, 0x06, 0x01d5 },
- { 0x00, 0x10, 0x07, 0x06, 0x06, 0x06, 0x01e9 },
- { 0x00, 0x1b, 0x07, 0x03, 0x06, 0x06, 0x020d },
- { 0x00, 0x18, 0x0e, 0x06, 0x04, 0x06, 0x021f },
+ {
+ .priority = 0,
+ .tilemapLeft = 10,
+ .tilemapTop = 4,
+ .width = 10,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 449,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 20,
+ .tilemapTop = 4,
+ .width = 10,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 469,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 16,
+ .tilemapTop = 7,
+ .width = 6,
+ .height = 6,
+ .paletteNum = 6,
+ .baseBlock = 489,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 27,
+ .tilemapTop = 7,
+ .width = 3,
+ .height = 6,
+ .paletteNum = 6,
+ .baseBlock = 525,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 24,
+ .tilemapTop = 14,
+ .width = 6,
+ .height = 4,
+ .paletteNum = 6,
+ .baseBlock = 543,
+ },
};
static const struct WindowTemplate gUnknown_0861CD14[] =
{
- { 0x00, 0x0f, 0x04, 0x09, 0x0a, 0x06, 0x01c1 },
- { 0x00, 0x18, 0x04, 0x06, 0x0a, 0x08, 0x021b },
- { 0x00, 0x0a, 0x0f, 0x14, 0x04, 0x06, 0x0257 },
+ {
+ .priority = 0,
+ .tilemapLeft = 15,
+ .tilemapTop = 4,
+ .width = 9,
+ .height = 10,
+ .paletteNum = 6,
+ .baseBlock = 449,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 24,
+ .tilemapTop = 4,
+ .width = 6,
+ .height = 10,
+ .paletteNum = 8,
+ .baseBlock = 539,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 10,
+ .tilemapTop = 15,
+ .width = 20,
+ .height = 4,
+ .paletteNum = 6,
+ .baseBlock = 599,
+ },
};
static const u8 sTextColors_861CD2C[][3] =
{
@@ -661,7 +917,7 @@ static const struct SpriteTemplate gUnknown_0861D084 =
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
-static const struct OamData gOamData_861D09C =
+static const struct OamData sOamData_StatusCondition =
{
.y = 0,
.affineMode = 0,
@@ -677,42 +933,42 @@ static const struct OamData gOamData_861D09C =
.paletteNum = 0,
.affineParam = 0,
};
-static const union AnimCmd gSpriteAnim_861D0A4[] = {
+static const union AnimCmd sSpriteAnim_StatusPoison[] = {
ANIMCMD_FRAME(0, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D0AC[] = {
+static const union AnimCmd sSpriteAnim_StatusParalyzed[] = {
ANIMCMD_FRAME(4, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D0B4[] = {
+static const union AnimCmd sSpriteAnim_StatusSleep[] = {
ANIMCMD_FRAME(8, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D0BC[] = {
+static const union AnimCmd sSpriteAnim_StatusFrozen[] = {
ANIMCMD_FRAME(12, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D0C4[] = {
+static const union AnimCmd sSpriteAnim_StatusBurn[] = {
ANIMCMD_FRAME(16, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D0CC[] = {
+static const union AnimCmd sSpriteAnim_StatusPokerus[] = {
ANIMCMD_FRAME(20, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D0D4[] = {
+static const union AnimCmd sSpriteAnim_StatusFaint[] = {
ANIMCMD_FRAME(24, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd *const gSpriteAnimTable_861D0DC[] = {
- gSpriteAnim_861D0A4,
- gSpriteAnim_861D0AC,
- gSpriteAnim_861D0B4,
- gSpriteAnim_861D0BC,
- gSpriteAnim_861D0C4,
- gSpriteAnim_861D0CC,
- gSpriteAnim_861D0D4,
+static const union AnimCmd *const sSpriteAnimTable_StatusCondition[] = {
+ sSpriteAnim_StatusPoison,
+ sSpriteAnim_StatusParalyzed,
+ sSpriteAnim_StatusSleep,
+ sSpriteAnim_StatusFrozen,
+ sSpriteAnim_StatusBurn,
+ sSpriteAnim_StatusPokerus,
+ sSpriteAnim_StatusFaint,
};
static const struct CompressedSpriteSheet gUnknown_0861D0F8 =
{
@@ -725,12 +981,12 @@ static const struct CompressedSpritePalette gUnknown_0861D100 =
.data = gStatusPal_Icons,
.tag = 30001
};
-static const struct SpriteTemplate gUnknown_0861D108 =
+static const struct SpriteTemplate sSpriteTemplate_StatusCondition =
{
.tileTag = 30001,
.paletteTag = 30001,
- .oam = &gOamData_861D09C,
- .anims = gSpriteAnimTable_861D0DC,
+ .oam = &sOamData_StatusCondition,
+ .anims = sSpriteAnimTable_StatusCondition,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
@@ -1521,7 +1777,7 @@ static void sub_81C0D44(u8 taskId)
static void sub_81C0E24(void)
{
if (pssData->currPageIndex == 1)
- sub_81C22CC(&pssData->currentMon);
+ DrawExperienceProgressBar(&pssData->currentMon);
}
static void sub_81C0E48(u8 taskId)
@@ -2270,37 +2526,40 @@ static void sub_81C228C(bool8 isMonShiny)
schedule_bg_copy_tilemap_to_vram(3);
}
-static void sub_81C22CC(struct Pokemon *unused)
+static void DrawExperienceProgressBar(struct Pokemon *unused)
{
- s64 r6r7;
+ s64 numExpProgressBarTicks;
struct PokeSummary *summary = &pssData->summary;
u16 *r9;
u8 i;
if (summary->level < MAX_MON_LEVEL)
{
- u32 r1 = gExperienceTables[gBaseStats[summary->species].growthRate][summary->level + 1] - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level];
- u32 r4 = summary->exp - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level];
+ u32 expBetweenLevels = gExperienceTables[gBaseStats[summary->species].growthRate][summary->level + 1] - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level];
+ u32 expSinceLastLevel = summary->exp - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level];
- r6r7 = r4 * 64 / r1;
- if (r6r7 == 0 && r4 != 0)
- r6r7 = 1;
+ // Calculate the number of 1-pixel "ticks" to illuminate in the experience progress bar.
+ // There are 8 tiles that make up the bar, and each tile has 8 "ticks". Hence, the numerator
+ // is multiplied by 64.
+ numExpProgressBarTicks = expSinceLastLevel * 64 / expBetweenLevels;
+ if (numExpProgressBarTicks == 0 && expSinceLastLevel != 0)
+ numExpProgressBarTicks = 1;
}
else
{
- r6r7 = 0;
+ numExpProgressBarTicks = 0;
}
r9 = &pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][1][0x255];
for (i = 0; i < 8; i++)
{
- if (r6r7 > 7)
+ if (numExpProgressBarTicks > 7)
r9[i] = 0x206A;
else
- r9[i] = 0x2062 + (r6r7 % 8);
- r6r7 -= 8;
- if (r6r7 < 0)
- r6r7 = 0;
+ r9[i] = 0x2062 + (numExpProgressBarTicks % 8);
+ numExpProgressBarTicks -= 8;
+ if (numExpProgressBarTicks < 0)
+ numExpProgressBarTicks = 0;
}
if (GetBgTilemapBuffer(1) == pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][0])
@@ -3735,7 +3994,7 @@ static void CreateSetStatusSprite(void)
if (*spriteId == 0xFF)
{
- *spriteId = CreateSprite(&gUnknown_0861D108, 64, 152, 0);
+ *spriteId = CreateSprite(&sSpriteTemplate_StatusCondition, 64, 152, 0);
}
anim = sub_81B205C(&pssData->currentMon);
diff --git a/src/rom_8011DC0.c b/src/rom_8011DC0.c
index b2bd2eb78..56c31f89f 100644
--- a/src/rom_8011DC0.c
+++ b/src/rom_8011DC0.c
@@ -1637,7 +1637,7 @@ void sub_8014290(u16 arg0, u16 x, u16 y)
VarSet(VAR_0x4087, arg0);
Overworld_SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x, y);
saved_warp2_set_2(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x, y);
- warp_in();
+ WarpIntoMap();
}
void sub_8014304(s8 mapGroup, s8 mapNum, s32 x, s32 y, u16 arg4)
@@ -1648,7 +1648,7 @@ void sub_8014304(s8 mapGroup, s8 mapNum, s32 x, s32 y, u16 arg4)
gUnknown_03005DB4 = GetMultiplayerId();
sub_809D2BC();
Overworld_SetWarpDestination(mapGroup, mapNum, -1, x, y);
- warp_in();
+ WarpIntoMap();
}
void sub_8014384(void)
diff --git a/src/safari_zone.c b/src/safari_zone.c
index 01d72fa13..427a5ceb8 100644
--- a/src/safari_zone.c
+++ b/src/safari_zone.c
@@ -35,7 +35,7 @@ extern void CB2_ReturnToFieldContinueScriptPlayMapMusic(void);
extern void CB2_LoadMap(void);
extern void sub_80AF6F0(void);
extern void ScriptContext1_Stop(void);
-extern void warp_in(void);
+extern void WarpIntoMap(void);
extern void GetXYCoordsOneStepInFrontOfPlayer(s16* x, s16* y);
extern void PlayerGetDestCoords(s16* x, s16* y);
@@ -117,7 +117,7 @@ void CB2_EndSafariBattle(void)
else if (gBattleOutcome == B_OUTCOME_NO_SAFARI_BALLS)
{
ScriptContext2_RunNewScript(EventScript_2A4B4C);
- warp_in();
+ WarpIntoMap();
gFieldCallback = sub_80AF6F0;
SetMainCallback2(CB2_LoadMap);
}
diff --git a/src/scrcmd.c b/src/scrcmd.c
index 01d04704a..31a4ed35a 100644
--- a/src/scrcmd.c
+++ b/src/scrcmd.c
@@ -750,7 +750,7 @@ bool8 ScrCmd_warp(struct ScriptContext *ctx)
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sub_80AF734();
- player_avatar_init_params_reset();
+ ResetInitialPlayerAvatarState();
return TRUE;
}
@@ -764,7 +764,7 @@ bool8 ScrCmd_warpsilent(struct ScriptContext *ctx)
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sp13E_warp_to_last_warp();
- player_avatar_init_params_reset();
+ ResetInitialPlayerAvatarState();
return TRUE;
}
@@ -778,7 +778,7 @@ bool8 ScrCmd_warpdoor(struct ScriptContext *ctx)
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sub_80AF7D0();
- player_avatar_init_params_reset();
+ ResetInitialPlayerAvatarState();
return TRUE;
}
@@ -791,11 +791,11 @@ bool8 ScrCmd_warphole(struct ScriptContext *ctx)
PlayerGetDestCoords(&x, &y);
if (mapGroup == 0xFF && mapNum == 0xFF)
- sub_8084EBC(x - 7, y - 7);
+ SetFixedHoleWarpAsDestination(x - 7, y - 7);
else
Overworld_SetWarpDestination(mapGroup, mapNum, -1, x - 7, y - 7);
sp13F_fall_to_last_warp();
- player_avatar_init_params_reset();
+ ResetInitialPlayerAvatarState();
return TRUE;
}
@@ -809,7 +809,7 @@ bool8 ScrCmd_warpteleport(struct ScriptContext *ctx)
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sub_80AF848();
- player_avatar_init_params_reset();
+ ResetInitialPlayerAvatarState();
return TRUE;
}
@@ -823,7 +823,7 @@ bool8 ScrCmd_warpD7(struct ScriptContext *ctx)
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sub_80AF87C();
- player_avatar_init_params_reset();
+ ResetInitialPlayerAvatarState();
return TRUE;
}
@@ -859,7 +859,7 @@ bool8 ScrCmd_setdivewarp(struct ScriptContext *ctx)
u16 x = VarGet(ScriptReadHalfword(ctx));
u16 y = VarGet(ScriptReadHalfword(ctx));
- sub_8084E2C(mapGroup, mapNum, warpId, x, y);
+ SetFixedDiveWarp(mapGroup, mapNum, warpId, x, y);
return FALSE;
}
@@ -871,7 +871,7 @@ bool8 ScrCmd_setholewarp(struct ScriptContext *ctx)
u16 x = VarGet(ScriptReadHalfword(ctx));
u16 y = VarGet(ScriptReadHalfword(ctx));
- sub_8084E80(mapGroup, mapNum, warpId, x, y);
+ SetFixedHoleWarp(mapGroup, mapNum, warpId, x, y);
return FALSE;
}
@@ -2240,7 +2240,7 @@ bool8 ScrCmd_warpD1(struct ScriptContext *ctx)
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sub_808D074(GetPlayerFacingDirection());
sub_80B0244();
- player_avatar_init_params_reset();
+ ResetInitialPlayerAvatarState();
return TRUE;
}
@@ -2293,6 +2293,6 @@ bool8 ScrCmd_warpE0(struct ScriptContext *ctx)
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
sub_80AF79C();
- player_avatar_init_params_reset();
+ ResetInitialPlayerAvatarState();
return TRUE;
}
diff --git a/src/secret_base.c b/src/secret_base.c
index d357261fe..7fae50a81 100644
--- a/src/secret_base.c
+++ b/src/secret_base.c
@@ -388,7 +388,7 @@ void sub_80E8FD0(u8 taskId)
gSaveBlock1Ptr->secretBases[secretBaseRecordId].sbr_field_10 ++;
}
sub_80E8F9C();
- warp_in();
+ WarpIntoMap();
gFieldCallback = sub_80AF168;
SetMainCallback2(CB2_LoadMap);
DestroyTask(taskId);
@@ -446,7 +446,7 @@ void sub_80E916C(u8 taskId)
{
idx = sCurSecretBaseId / 10 * 4;
Overworld_SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, gUnknown_0858CFE8[idx + 2], gUnknown_0858CFE8[idx + 3]);
- warp_in();
+ WarpIntoMap();
gFieldCallback = sub_80E9108;
SetMainCallback2(CB2_LoadMap);
DestroyTask(taskId);
@@ -644,7 +644,7 @@ void sub_80E96A4(u8 taskId)
break;
case 2:
copy_saved_warp2_bank_and_enter_x_to_warp1(0x7e);
- warp_in();
+ WarpIntoMap();
gFieldCallback = mapldr_default;
SetMainCallback2(CB2_LoadMap);
ScriptContext2_Disable();
diff --git a/src/wallclock.c b/src/wallclock.c
index 5be20d5c9..f3feab1d4 100644
--- a/src/wallclock.c
+++ b/src/wallclock.c
@@ -59,13 +59,38 @@ static void SpriteCB_PMIndicator(struct Sprite *sprite);
static const u8 sUnknown_085B1F58[] = INCBIN_U8("graphics/wallclock/graphics_85b1f58.4bpp.lz");
static const u16 sUnknown_085B21D4[] = INCBIN_U16("graphics/wallclock/palette_85b21d4.gbapal");
-static const struct WindowTemplate gUnknown_085B21DC[] = {
- { 0x00, 0x03, 0x11, 0x18, 0x02, 0x0e, 0x200 },
- { 0x02, 0x18, 0x10, 0x06, 0x02, 0x0c, 0x230 },
+
+static const struct WindowTemplate gUnknown_085B21DC[] =
+{
+ {
+ .priority = 0,
+ .tilemapLeft = 3,
+ .tilemapTop = 17,
+ .width = 24,
+ .height = 2,
+ .paletteNum = 14,
+ .baseBlock = 512
+ },
+ {
+ .priority = 2,
+ .tilemapLeft = 24,
+ .tilemapTop = 16,
+ .width = 6,
+ .height = 2,
+ .paletteNum = 12,
+ .baseBlock = 560
+ },
DUMMY_WIN_TEMPLATE
};
-static const struct WindowTemplate gUnknown_085B21F4 = {
- 0x00, 0x18, 0x09, 0x05, 0x04, 0x0e, 0x23c
+static const struct WindowTemplate gUnknown_085B21F4 =
+{
+ .priority = 0,
+ .tilemapLeft = 24,
+ .tilemapTop = 9,
+ .width = 5,
+ .height = 4,
+ .paletteNum = 14,
+ .baseBlock = 572
};
static const struct BgTemplate gUnknown_085B21FC[] = {
{
@@ -115,23 +140,25 @@ static const union AnimCmd *const gUnknown_085B2248[] = {
static const union AnimCmd *const gUnknown_085B224C[] = {
Unknown_085B2240
};
-static const struct SpriteTemplate gUnknown_085B2250 = {
- TAG_GFX_WALL_CLOCK_HAND,
- TAG_PAL_WALL_CLOCK_HAND,
- &Unknown_085B2230,
- gUnknown_085B2248,
- NULL,
- gDummySpriteAffineAnimTable,
- SpriteCB_MinuteHand
+static const struct SpriteTemplate gUnknown_085B2250 =
+{
+ .tileTag = TAG_GFX_WALL_CLOCK_HAND,
+ .paletteTag = TAG_PAL_WALL_CLOCK_HAND,
+ .oam = &Unknown_085B2230,
+ .anims = gUnknown_085B2248,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCB_MinuteHand
};
-static const struct SpriteTemplate gUnknown_085B2268 = {
- TAG_GFX_WALL_CLOCK_HAND,
- TAG_PAL_WALL_CLOCK_HAND,
- &Unknown_085B2230,
- gUnknown_085B224C,
- NULL,
- gDummySpriteAffineAnimTable,
- SpriteCB_HourHand
+static const struct SpriteTemplate gUnknown_085B2268 =
+{
+ .tileTag = TAG_GFX_WALL_CLOCK_HAND,
+ .paletteTag = TAG_PAL_WALL_CLOCK_HAND,
+ .oam = &Unknown_085B2230,
+ .anims = gUnknown_085B224C,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCB_HourHand
};
static const struct OamData Unknown_085B2280 = {
.y = 0xa0,
@@ -152,23 +179,25 @@ static const union AnimCmd *const gUnknown_085B2298[] = {
static const union AnimCmd *const gUnknown_085B229C[] = {
Unknown_085B2290
};
-static const struct SpriteTemplate gUnknown_085B22A0 = {
- TAG_GFX_WALL_CLOCK_HAND,
- TAG_PAL_WALL_CLOCK_HAND,
- &Unknown_085B2280,
- gUnknown_085B2298,
- NULL,
- gDummySpriteAffineAnimTable,
- SpriteCB_AMIndicator
+static const struct SpriteTemplate gUnknown_085B22A0 =
+{
+ .tileTag = TAG_GFX_WALL_CLOCK_HAND,
+ .paletteTag = TAG_PAL_WALL_CLOCK_HAND,
+ .oam = &Unknown_085B2280,
+ .anims = gUnknown_085B2298,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCB_AMIndicator
};
-static const struct SpriteTemplate gUnknown_085B22B8 = {
- TAG_GFX_WALL_CLOCK_HAND,
- TAG_PAL_WALL_CLOCK_HAND,
- &Unknown_085B2280,
- gUnknown_085B229C,
- NULL,
- gDummySpriteAffineAnimTable,
- SpriteCB_PMIndicator
+static const struct SpriteTemplate gUnknown_085B22B8 =
+{
+ .tileTag = TAG_GFX_WALL_CLOCK_HAND,
+ .paletteTag = TAG_PAL_WALL_CLOCK_HAND,
+ .oam = &Unknown_085B2280,
+ .anims = gUnknown_085B229C,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCB_PMIndicator
};
static const s8 sClockHandCoords[][2] = {
{ 0x00, -0x18},