summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/apprentice.c7
-rw-r--r--src/battle_ai_switch_items.c2
-rw-r--r--src/battle_anim.c14
-rw-r--r--src/battle_anim_80A5C6C.c46
-rw-r--r--src/battle_anim_80A9C70.c2
-rw-r--r--src/battle_anim_80D51AC.c6
-rw-r--r--src/battle_anim_sound_tasks.c6
-rw-r--r--src/battle_anim_utility_funcs.c1050
-rw-r--r--src/battle_arena.c4
-rw-r--r--src/battle_bg.c27
-rw-r--r--src/battle_controller_link_opponent.c10
-rw-r--r--src/battle_controller_link_partner.c10
-rw-r--r--src/battle_controller_opponent.c10
-rw-r--r--src/battle_controller_player.c16
-rw-r--r--src/battle_controller_player_partner.c10
-rw-r--r--src/battle_controller_recorded_opponent.c10
-rw-r--r--src/battle_controller_recorded_player.c10
-rw-r--r--src/battle_controller_safari.c3
-rw-r--r--src/battle_controller_wally.c8
-rw-r--r--src/battle_dome.c36
-rw-r--r--src/battle_factory.c2
-rw-r--r--src/battle_factory_screen.c4
-rw-r--r--src/battle_interface.c102
-rw-r--r--src/battle_main.c43
-rw-r--r--src/battle_message.c55
-rw-r--r--src/battle_palace.c1
-rw-r--r--src/battle_pyramid.c1298
-rw-r--r--src/battle_script_commands.c128
-rw-r--r--src/battle_setup.c14
-rw-r--r--src/battle_tent.c5
-rw-r--r--src/battle_tower.c5
-rw-r--r--src/battle_transition.c4
-rw-r--r--src/battle_util.c6
-rw-r--r--src/berry.c6
-rw-r--r--src/berry_blender.c10
-rw-r--r--src/bg.c1195
-rw-r--r--src/bug.c317
-rw-r--r--src/cable_club.c12
-rw-r--r--src/clear_save_data_screen.c148
-rw-r--r--src/contest.c20
-rw-r--r--src/contest_ai.c2
-rw-r--r--src/contest_painting.c8
-rw-r--r--src/data/pokemon/pokedex_entries.h3873
-rw-r--r--src/data/pokemon/pokedex_text.h2321
-rw-r--r--src/data/pokemon_graphics/back_pic_coordinates.h700
-rw-r--r--src/data/pokemon_graphics/footprint_table.h416
-rw-r--r--src/data/pokemon_graphics/front_pic_coordinates.h716
-rw-r--r--src/dewford_trend.c3
-rw-r--r--src/dragon.c269
-rw-r--r--src/easy_chat.c1
-rw-r--r--src/effects_1.c4
-rw-r--r--src/egg_hatch.c6
-rw-r--r--src/event_object_movement.c2
-rw-r--r--src/evolution_scene.c9
-rw-r--r--src/field_effect.c312
-rwxr-xr-xsrc/field_effect_helpers.c297
-rw-r--r--src/field_player_avatar.c2
-rw-r--r--src/field_specials.c22
-rw-r--r--src/fight.c681
-rw-r--r--src/fldeff_strength.c1
-rw-r--r--src/fossil_specials.c803
-rw-r--r--src/frontier_util.c1034
-rw-r--r--src/graphics.c30
-rw-r--r--src/ground.c655
-rw-r--r--src/hall_of_fame.c37
-rw-r--r--src/item.c2
-rw-r--r--src/load_save.c9
-rw-r--r--src/lottery_corner.c22
-rw-r--r--src/map_name_popup.c234
-rw-r--r--src/mossdeep_gym.c313
-rw-r--r--src/multiboot.c2
-rw-r--r--src/mystery_event_script.c1
-rw-r--r--src/new_game.c5
-rw-r--r--src/overworld.c28
-rw-r--r--src/poison.c154
-rw-r--r--src/pokeball.c4
-rw-r--r--src/pokedex.c509
-rw-r--r--src/pokemon.c3
-rw-r--r--src/pokemon_size_record.c8
-rw-r--r--src/post_battle_event_funcs.c2
-rw-r--r--src/recorded_battle.c2
-rw-r--r--src/reshow_battle_screen.c9
-rw-r--r--src/rock.c615
-rw-r--r--src/rom_8011DC0.c6
-rw-r--r--src/save.c123
-rw-r--r--src/save_failed_screen.c149
-rw-r--r--src/save_location.c19
-rw-r--r--src/scanline_effect.c10
-rw-r--r--src/scrcmd.c23
-rwxr-xr-xsrc/script_pokemon_util_80F87D8.c707
-rw-r--r--src/start_menu.c12
-rw-r--r--src/string_util.c8
-rw-r--r--src/strings.c467
-rw-r--r--src/text.c1059
-rw-r--r--src/title_screen.c3
-rw-r--r--src/trainer_see.c3
-rw-r--r--src/wild_encounter.c4
97 files changed, 16296 insertions, 5085 deletions
diff --git a/src/apprentice.c b/src/apprentice.c
index fa4e08385..499f85094 100644
--- a/src/apprentice.c
+++ b/src/apprentice.c
@@ -340,9 +340,10 @@ extern const u8 gText_082B7185[];
extern const u8 gText_082B71C1[];
extern const u8 gText_082B71F9[];
-extern struct Unk030062ECStruct *gUnknown_030062EC;
-extern struct Unk030062F0Struct *gUnknown_030062F0;
-extern void (*gUnknown_030062F4)(void);
+// IWRAM common
+struct Unk030062ECStruct *gUnknown_030062EC;
+struct Unk030062F0Struct *gUnknown_030062F0;
+void (*gUnknown_030062F4)(void);
// This file's functions.
static u16 sub_819FF98(u8 arg0);
diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c
index 71d0e8381..ad25b483c 100644
--- a/src/battle_ai_switch_items.c
+++ b/src/battle_ai_switch_items.c
@@ -310,7 +310,7 @@ static bool8 AreStatsRaised(void)
u8 buffedStatsValue = 0;
s32 i;
- for (i = 0; i < BATTLE_STATS_NO; i++)
+ for (i = 0; i < NUM_BATTLE_STATS; i++)
{
if (gBattleMons[gActiveBattler].statStages[i] > 6)
buffedStatsValue += gBattleMons[gActiveBattler].statStages[i] - 6;
diff --git a/src/battle_anim.c b/src/battle_anim.c
index 5c34d6a43..e8720fcfb 100644
--- a/src/battle_anim.c
+++ b/src/battle_anim.c
@@ -20,14 +20,6 @@
#define ANIM_SPRITE_INDEX_COUNT 8
-extern u16 gBattle_WIN0H;
-extern u16 gBattle_WIN0V;
-extern u16 gBattle_WIN1H;
-extern u16 gBattle_WIN1V;
-extern u16 gBattle_BG1_X;
-extern u16 gBattle_BG1_Y;
-extern u16 gBattle_BG2_X;
-extern u16 gBattle_BG2_Y;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern struct MusicPlayerInfo gMPlayInfo_SE1;
extern struct MusicPlayerInfo gMPlayInfo_SE2;
@@ -1502,7 +1494,7 @@ void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMo
else
{
for (i = 0; i < 4; i++)
- gAnimBattlerSpecies[i] = gContestResources->field_18->unk0;
+ gAnimBattlerSpecies[i] = gContestResources->field_18->species;
}
if (!isMoveAnim)
@@ -1959,7 +1951,7 @@ void sub_80A438C(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible)
battlerSpriteId = gBattlerSpriteIds[battlerId];
gBattle_BG1_X = -(gSprites[battlerSpriteId].pos1.x + gSprites[battlerSpriteId].pos2.x) + 0x20;
- if (IsContest() && IsSpeciesNotUnown(gContestResources->field_18->unk0))
+ if (IsContest() && IsSpeciesNotUnown(gContestResources->field_18->species))
gBattle_BG1_X--;
gBattle_BG1_Y = -(gSprites[battlerSpriteId].pos1.y + gSprites[battlerSpriteId].pos2.y) + 0x20;
@@ -2017,7 +2009,7 @@ static void sub_80A46A0(void)
struct UnknownAnimStruct2 unknownStruct;
u16 *ptr;
- if (IsSpeciesNotUnown(gContestResources->field_18->unk0))
+ if (IsSpeciesNotUnown(gContestResources->field_18->species))
{
sub_80A6B30(&unknownStruct);
ptr = unknownStruct.unk4;
diff --git a/src/battle_anim_80A5C6C.c b/src/battle_anim_80A5C6C.c
index d213e4831..2ac6cca90 100644
--- a/src/battle_anim_80A5C6C.c
+++ b/src/battle_anim_80A5C6C.c
@@ -36,9 +36,7 @@ extern const union AffineAnimCmd *gUnknown_082FF6C0[];
// This file's functions.
void sub_80A64EC(struct Sprite *sprite);
void sub_80A653C(struct Sprite *sprite);
-void InitAnimLinearTranslation(struct Sprite *sprite);
void sub_80A6FB4(struct Sprite *sprite);
-void sub_80A6F98(struct Sprite *sprite);
void sub_80A7144(struct Sprite *sprite);
void sub_80A791C(struct Sprite *sprite);
void sub_80A8DFC(struct Sprite *sprite);
@@ -50,8 +48,6 @@ void sub_80A7AFC(u8 taskId);
void sub_80A8CAC(u8 taskId);
void AnimTask_BlendMonInAndOutStep(u8 taskId);
bool8 sub_80A7238(void);
-void sub_80A8048(s16 *bottom, s16 *top, const void *ptr);
-void *sub_80A8050(s16 bottom, s16 top);
u8 sub_80A82E4(u8 battlerId);
void sub_80A8D78(struct Task *task, u8 taskId);
@@ -159,7 +155,7 @@ u8 GetBattlerSpriteCoord(u8 battlerId, u8 attributeId)
if (shared19348.unk4_0)
species = shared19348.unk2;
else
- species = shared19348.unk0;
+ species = shared19348.species;
}
else
{
@@ -324,7 +320,7 @@ u8 GetBattlerSpriteCoord2(u8 battlerId, u8 attributeId)
if (shared19348.unk4_0)
species = shared19348.unk2;
else
- species = shared19348.unk0;
+ species = shared19348.species;
}
else
{
@@ -532,7 +528,7 @@ void sub_80A6450(struct Sprite *sprite)
// Simply waits until the sprite's data[0] hits zero.
// This is used to let sprite anims or affine anims to run for a designated
// duration.
-void sub_80A64B0(struct Sprite *sprite)
+void WaitAnimForDuration(struct Sprite *sprite)
{
if (sprite->data[0] > 0)
sprite->data[0]--;
@@ -745,7 +741,7 @@ void sub_80A6864(struct Sprite *sprite, s16 a2)
}
}
-void sub_80A68D4(struct Sprite *sprite)
+void InitAnimArcTranslation(struct Sprite *sprite)
{
sprite->data[1] = sprite->pos1.x;
sprite->data[3] = sprite->pos1.y;
@@ -791,7 +787,7 @@ void sub_80A6980(struct Sprite *sprite, bool8 a2)
sprite->pos1.y += gBattleAnimArgs[1];
}
-void sub_80A69CC(struct Sprite *sprite, u8 a2)
+void InitAnimSpritePos(struct Sprite *sprite, u8 a2)
{
if (!a2)
{
@@ -940,18 +936,18 @@ void sub_80A6BFC(struct UnknownAnimStruct2 *unk)
}
}
-void sub_80A6C68(u32 arg0)
+void sub_80A6C68(u32 bgId)
{
struct UnknownAnimStruct2 unkStruct;
- sub_80A6B90(&unkStruct, arg0);
+ sub_80A6B90(&unkStruct, bgId);
CpuFill32(0, unkStruct.bgTiles, 0x2000);
LoadBgTiles(unkStruct.bgId, unkStruct.bgTiles, 0x2000, unkStruct.tilesOffset);
FillBgTilemapBufferRect(unkStruct.bgId, 0, 0, 0, 0x20, 0x40, 0x11);
CopyBgTilemapBufferToVram(unkStruct.bgId);
}
-void sub_80A6CC0(u32 bgId, void *src, u32 tilesOffset)
+void sub_80A6CC0(u32 bgId, const void *src, u32 tilesOffset)
{
CpuFill32(0, gUnknown_0202305C, 0x2000);
LZDecompressWram(src, gUnknown_0202305C);
@@ -1004,12 +1000,12 @@ void sub_80A6DEC(struct Sprite *sprite)
{
sprite->data[1] = sprite->pos1.x;
sprite->data[3] = sprite->pos1.y;
- sub_80A6E14(sprite);
+ InitSpriteDataForLinearTranslation(sprite);
sprite->callback = sub_80A65A8;
sprite->callback(sprite);
}
-void sub_80A6E14(struct Sprite *sprite)
+void InitSpriteDataForLinearTranslation(struct Sprite *sprite)
{
s16 x = (sprite->data[2] - sprite->data[1]) << 8;
s16 y = (sprite->data[4] - sprite->data[3]) << 8;
@@ -1047,7 +1043,7 @@ void InitAnimLinearTranslation(struct Sprite *sprite)
sprite->data[3] = 0;
}
-void sub_80A6EEC(struct Sprite *sprite)
+void StartAnimLinearTranslation(struct Sprite *sprite)
{
sprite->data[1] = sprite->pos1.x;
sprite->data[3] = sprite->pos1.y;
@@ -1476,7 +1472,7 @@ void sub_80A77C8(struct Sprite *sprite)
else
var = FALSE;
if (!gBattleAnimArgs[2])
- sub_80A69CC(sprite, var);
+ InitAnimSpritePos(sprite, var);
else
sub_80A6980(sprite, var);
sprite->data[0]++;
@@ -1511,27 +1507,27 @@ void TranslateAnimSpriteToTargetMonLocation(struct Sprite *sprite)
else
attributeId = BATTLER_COORD_Y;
- sub_80A69CC(sprite, v1);
+ InitAnimSpritePos(sprite, v1);
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
sprite->data[0] = gBattleAnimArgs[4];
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[2];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, attributeId) + gBattleAnimArgs[3];
- sprite->callback = sub_80A6EEC;
+ sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
void sub_80A78AC(struct Sprite *sprite)
{
- sub_80A69CC(sprite, 1);
+ InitAnimSpritePos(sprite, 1);
if (GetBattlerSide(gBattleAnimAttacker))
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
sprite->data[0] = gBattleAnimArgs[4];
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[2];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[3];
sprite->data[5] = gBattleAnimArgs[5];
- sub_80A68D4(sprite);
+ InitAnimArcTranslation(sprite);
sprite->callback = sub_80A791C;
}
@@ -1558,7 +1554,7 @@ void sub_80A7938(struct Sprite *sprite)
}
if (!gBattleAnimArgs[5])
{
- sub_80A69CC(sprite, r4);
+ InitAnimSpritePos(sprite, r4);
battlerId = gBattleAnimAttacker;
}
else
@@ -1572,7 +1568,7 @@ void sub_80A7938(struct Sprite *sprite)
sprite->data[0] = gBattleAnimArgs[4];
sprite->data[2] = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) + gBattleAnimArgs[2];
sprite->data[4] = GetBattlerSpriteCoord(battlerId, attributeId) + gBattleAnimArgs[3];
- sprite->callback = sub_80A6EEC;
+ sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
@@ -1854,7 +1850,7 @@ u16 sub_80A7F18(u8 spriteId)
{
if (IsContest())
{
- species = shared19348.unk0;
+ species = shared19348.species;
return gMonBackPicCoords[species].y_offset;
}
else
@@ -2112,7 +2108,7 @@ s16 sub_80A861C(u8 battlerId, u8 a2)
}
else
{
- species = shared19348.unk0;
+ species = shared19348.species;
personality = shared19348.unk8;
}
if (species == SPECIES_UNOWN)
@@ -2454,6 +2450,6 @@ void sub_80A8EE4(struct Sprite *sprite)
sprite->pos1.x += x;
sprite->pos1.y = gBattleAnimArgs[5] - 80;
}
- sprite->callback = sub_80A6EEC;
+ sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
diff --git a/src/battle_anim_80A9C70.c b/src/battle_anim_80A9C70.c
index 5401247b8..f1245a032 100644
--- a/src/battle_anim_80A9C70.c
+++ b/src/battle_anim_80A9C70.c
@@ -17,8 +17,6 @@ extern const u8 *const gBattleAnims_StatusConditions[];
extern const struct OamData gUnknown_08524904;
extern const struct OamData gUnknown_08524A3C;
-extern void sub_8116EB4(u8 taskId);
-
// This file's functions.
static void sub_80A9DB4(u8 taskId);
static void sub_80A9FD0(u8 taskId);
diff --git a/src/battle_anim_80D51AC.c b/src/battle_anim_80D51AC.c
index 1864a1a7a..25e07dc3a 100644
--- a/src/battle_anim_80D51AC.c
+++ b/src/battle_anim_80D51AC.c
@@ -442,7 +442,7 @@ void SlideMonToOriginalPos(struct Sprite *sprite)
sprite->data[2] = gSprites[monSpriteId].pos1.x;
sprite->data[3] = gSprites[monSpriteId].pos1.y + gSprites[monSpriteId].pos2.y;
sprite->data[4] = gSprites[monSpriteId].pos1.y;
- sub_80A6E14(sprite);
+ InitSpriteDataForLinearTranslation(sprite);
sprite->data[3] = 0;
sprite->data[4] = 0;
sprite->data[5] = gSprites[monSpriteId].pos2.x;
@@ -520,7 +520,7 @@ void SlideMonToOffset(struct Sprite *sprite)
sprite->data[2] = gSprites[monSpriteId].pos1.x + gBattleAnimArgs[1];
sprite->data[3] = gSprites[monSpriteId].pos1.y;
sprite->data[4] = gSprites[monSpriteId].pos1.y + gBattleAnimArgs[2];
- sub_80A6E14(sprite);
+ InitSpriteDataForLinearTranslation(sprite);
sprite->data[3] = 0;
sprite->data[4] = 0;
sprite->data[5] = monSpriteId;
@@ -556,7 +556,7 @@ void sub_80D5B48(struct Sprite *sprite)
sprite->data[2] = sprite->data[1] + gBattleAnimArgs[1];
sprite->data[3] = gSprites[spriteId].pos1.y + gSprites[spriteId].pos2.y;
sprite->data[4] = sprite->data[3] + gBattleAnimArgs[2];
- sub_80A6E14(sprite);
+ InitSpriteDataForLinearTranslation(sprite);
sprite->data[3] = gSprites[spriteId].pos2.x << 8;
sprite->data[4] = gSprites[spriteId].pos2.y << 8;
sprite->data[5] = spriteId;
diff --git a/src/battle_anim_sound_tasks.c b/src/battle_anim_sound_tasks.c
index b49a6d03f..07fb604b8 100644
--- a/src/battle_anim_sound_tasks.c
+++ b/src/battle_anim_sound_tasks.c
@@ -131,7 +131,7 @@ void sub_8158D8C(u8 taskId)
if (IsContest())
{
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
- species = gContestResources->field_18->unk0;
+ species = gContestResources->field_18->species;
else
DestroyAnimVisualTask(taskId); // UB: function should return upon destroying task.
}
@@ -177,7 +177,7 @@ void sub_8158E9C(u8 taskId)
if (IsContest())
{
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
- species = gContestResources->field_18->unk0;
+ species = gContestResources->field_18->species;
else
DestroyAnimVisualTask(taskId); // UB: function should return upon destroying task.
}
@@ -281,7 +281,7 @@ void sub_81590B8(u8 taskId)
pan = BattleAnimAdjustPanning(SOUND_PAN_ATTACKER);
if (IsContest())
- species = gContestResources->field_18->unk0;
+ species = gContestResources->field_18->species;
else
species = gAnimBattlerSpecies[gBattleAnimAttacker];
diff --git a/src/battle_anim_utility_funcs.c b/src/battle_anim_utility_funcs.c
index d9c574e73..11cf46ab5 100644
--- a/src/battle_anim_utility_funcs.c
+++ b/src/battle_anim_utility_funcs.c
@@ -1,6 +1,42 @@
#include "global.h"
#include "battle_anim.h"
+#include "contest.h"
+#include "gpu_regs.h"
+#include "graphics.h"
+#include "malloc.h"
+#include "palette.h"
+#include "sound.h"
+#include "sprite.h"
+#include "task.h"
+#include "util.h"
#include "constants/rgb.h"
+#include "constants/songs.h"
+
+struct AnimStatsChangeData
+{
+ u8 battler1;
+ u8 battler2;
+ u8 higherPriority;
+ s16 data[8];
+ u16 species;
+};
+
+static EWRAM_DATA struct AnimStatsChangeData *sAnimStatsChangeData = {0};
+
+static void StartBlendAnimSpriteColor(u8, u32);
+static void AnimTask_BlendSpriteColor_Step2(u8);
+static void sub_81169A0(u8);
+static void sub_81169F8(u8);
+static void sub_8116AD0(struct Sprite*);
+static void sub_8116D64(u8);
+static void sub_8116F04(u8);
+static void sub_81170EC(u8);
+static void sub_81172EC(u8);
+static void sub_8117500(u8);
+static void sub_81175C4(u32, u16);
+static void sub_81176D8(u8);
+static void sub_8117A60(u8);
+static void sub_8117FD0(u8);
const u16 gUnknown_08597418 = RGB(31, 31, 31);
@@ -8,3 +44,1017 @@ const u16 gUnknown_08597418 = RGB(31, 31, 31);
// possibly some register offsets
const u8 gUnknown_0859741A[] = {0x08, 0x0a, 0x0c, 0x0e};
const u8 gUnknown_0859741E[] = {0x08, 0x0a, 0x0c, 0x0e};
+
+void sub_8116620(u8 taskId)
+{
+ u32 selectedPalettes = sub_811583C(gBattleAnimArgs[0]);
+ selectedPalettes |= sub_80A76C4((gBattleAnimArgs[0] >> 7) & 1,
+ (gBattleAnimArgs[0] >> 8) & 1,
+ (gBattleAnimArgs[0] >> 9) & 1,
+ (gBattleAnimArgs[0] >> 10) & 1);
+ StartBlendAnimSpriteColor(taskId, selectedPalettes);
+}
+
+void sub_8116664(u8 taskId)
+{
+ u8 battler;
+ u32 selectedPalettes;
+ u8 animBattlers[2];
+
+ animBattlers[1] = 0xFF;
+ selectedPalettes = sub_811583C(1);
+ switch (gBattleAnimArgs[0])
+ {
+ case 2:
+ selectedPalettes = 0;
+ // fall through
+ case 0:
+ animBattlers[0] = gBattleAnimAttacker;
+ break;
+ case 3:
+ selectedPalettes = 0;
+ // fall through
+ case 1:
+ animBattlers[0] = gBattleAnimTarget;
+ break;
+ case 4:
+ animBattlers[0] = gBattleAnimAttacker;
+ animBattlers[1] = gBattleAnimTarget;
+ break;
+ case 5:
+ animBattlers[0] = 0xFF;
+ break;
+ case 6:
+ selectedPalettes = 0;
+ animBattlers[0] = BATTLE_PARTNER(gBattleAnimAttacker);
+ break;
+ case 7:
+ selectedPalettes = 0;
+ animBattlers[0] = BATTLE_PARTNER(gBattleAnimTarget);
+ break;
+ }
+
+ for (battler = 0; battler < MAX_BATTLERS_COUNT; battler++)
+ {
+ if (battler != animBattlers[0] && battler != animBattlers[1] && IsBattlerSpriteVisible(battler))
+ selectedPalettes |= 0x10000 << sub_80A77AC(battler);
+ }
+
+ StartBlendAnimSpriteColor(taskId, selectedPalettes);
+}
+
+void AnimTask_SetCamouflageBlend(u8 taskId)
+{
+ u32 selectedPalettes = sub_811583C(gBattleAnimArgs[0]);
+ switch (gBattleTerrain)
+ {
+ case BATTLE_TERRAIN_GRASS:
+ gBattleAnimArgs[4] = RGB(12, 24, 2);
+ break;
+ case BATTLE_TERRAIN_LONG_GRASS:
+ gBattleAnimArgs[4] = RGB(0, 15, 2);
+ break;
+ case BATTLE_TERRAIN_SAND:
+ gBattleAnimArgs[4] = RGB(30, 24, 11);
+ break;
+ case BATTLE_TERRAIN_UNDERWATER:
+ gBattleAnimArgs[4] = RGB(0, 0, 18);
+ break;
+ case BATTLE_TERRAIN_WATER:
+ gBattleAnimArgs[4] = RGB(11, 22, 31);
+ break;
+ case BATTLE_TERRAIN_POND:
+ gBattleAnimArgs[4] = RGB(11, 22, 31);
+ break;
+ case BATTLE_TERRAIN_MOUNTAIN:
+ gBattleAnimArgs[4] = RGB(22, 16, 10);
+ break;
+ case BATTLE_TERRAIN_CAVE:
+ gBattleAnimArgs[4] = RGB(14, 9, 3);
+ break;
+ case BATTLE_TERRAIN_BUILDING:
+ gBattleAnimArgs[4] = RGB(31, 31, 31);
+ break;
+ case BATTLE_TERRAIN_PLAIN:
+ gBattleAnimArgs[4] = RGB(31, 31, 31);
+ break;
+ }
+
+ StartBlendAnimSpriteColor(taskId, selectedPalettes);
+}
+
+void AnimTask_BlendParticle(u8 taskId)
+{
+ u8 paletteIndex = IndexOfSpritePaletteTag(gBattleAnimArgs[0]);
+ u32 selectedPalettes = 1 << (paletteIndex + 16);
+ StartBlendAnimSpriteColor(taskId, selectedPalettes);
+}
+
+void StartBlendAnimSpriteColor(u8 taskId, u32 selectedPalettes)
+{
+ gTasks[taskId].data[0] = selectedPalettes;
+ gTasks[taskId].data[1] = selectedPalettes >> 16;
+ gTasks[taskId].data[2] = gBattleAnimArgs[1];
+ gTasks[taskId].data[3] = gBattleAnimArgs[2];
+ gTasks[taskId].data[4] = gBattleAnimArgs[3];
+ gTasks[taskId].data[5] = gBattleAnimArgs[4];
+ gTasks[taskId].data[10] = gBattleAnimArgs[2];
+ gTasks[taskId].func = AnimTask_BlendSpriteColor_Step2;
+ gTasks[taskId].func(taskId);
+}
+
+static void AnimTask_BlendSpriteColor_Step2(u8 taskId)
+{
+ u32 selectedPalettes;
+ u16 singlePaletteMask = 0;
+
+ if (gTasks[taskId].data[9] == gTasks[taskId].data[2])
+ {
+ gTasks[taskId].data[9] = 0;
+ selectedPalettes = gTasks[taskId].data[0] | (gTasks[taskId].data[1] << 16);
+ while (selectedPalettes != 0)
+ {
+ if (selectedPalettes & 1)
+ BlendPalette(singlePaletteMask, 16, gTasks[taskId].data[10], gTasks[taskId].data[5]);
+ singlePaletteMask += 0x10;
+ selectedPalettes >>= 1;
+ }
+
+ if (gTasks[taskId].data[10] < gTasks[taskId].data[4])
+ gTasks[taskId].data[10]++;
+ else if (gTasks[taskId].data[10] > gTasks[taskId].data[4])
+ gTasks[taskId].data[10]--;
+ else
+ DestroyAnimVisualTask(taskId);
+ }
+ else
+ {
+ gTasks[taskId].data[9]++;
+ }
+}
+
+void sub_8116960(u8 taskId)
+{
+ BeginHardwarePaletteFade(
+ gBattleAnimArgs[0],
+ gBattleAnimArgs[1],
+ gBattleAnimArgs[2],
+ gBattleAnimArgs[3],
+ gBattleAnimArgs[4]);
+
+ gTasks[taskId].func = sub_81169A0;
+}
+
+static void sub_81169A0(u8 taskId)
+{
+ if (!gPaletteFade.active)
+ DestroyAnimVisualTask(taskId);
+}
+
+void sub_81169C0(u8 taskId)
+{
+ struct Task *task = &gTasks[taskId];
+
+ task->data[0] = gBattleAnimArgs[0];
+ task->data[1] = 0;
+ task->data[2] = gBattleAnimArgs[1];
+ task->data[3] = gBattleAnimArgs[2];
+ task->data[4] = gBattleAnimArgs[3];
+ task->data[5] = 0;
+ task->func = sub_81169F8;
+}
+
+static void sub_81169F8(u8 taskId)
+{
+ struct Task *task = &gTasks[taskId];
+
+ if (task->data[4])
+ {
+ if (task->data[1])
+ {
+ task->data[1]--;
+ }
+ else
+ {
+ task->data[6] = duplicate_obj_of_side_rel2move_in_transparent_mode(task->data[0]);
+ if (task->data[6] >= 0)
+ {
+ gSprites[task->data[6]].oam.priority = task->data[0] ? 1 : 2;
+ gSprites[task->data[6]].data[0] = task->data[3];
+ gSprites[task->data[6]].data[1] = taskId;
+ gSprites[task->data[6]].data[2] = 5;
+ gSprites[task->data[6]].callback = sub_8116AD0;
+ task->data[5]++;
+ }
+
+ task->data[4]--;
+ task->data[1] = task->data[2];
+ }
+ }
+ else if (task->data[5] == 0)
+ {
+ DestroyAnimVisualTask(taskId);
+ }
+}
+
+static void sub_8116AD0(struct Sprite *sprite)
+{
+ if (sprite->data[0])
+ {
+ sprite->data[0]--;
+ }
+ else
+ {
+ gTasks[sprite->data[1]].data[sprite->data[2]]--;
+ obj_delete_but_dont_free_vram(sprite);
+ }
+}
+
+void sub_8116B14(u8 taskId)
+{
+ u16 species;
+ int spriteId, newSpriteId;
+ u16 var0;
+ u16 bg1Cnt;
+ struct UnknownAnimStruct2 unknownStruct;
+
+ var0 = 0;
+ gBattle_WIN0H = 0;
+ gBattle_WIN0V = 0;
+ SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR
+ | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
+ SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR
+ | WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR);
+ SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJWIN_ON);
+ SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND);
+ SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(8, 12));
+ bg1Cnt = GetGpuReg(REG_OFFSET_BG1CNT);
+ ((struct BgCnt *)&bg1Cnt)->priority = 0;
+ ((struct BgCnt *)&bg1Cnt)->screenSize = 0;
+ SetGpuReg(REG_OFFSET_BG1CNT, bg1Cnt);
+
+ if (!IsContest())
+ {
+ ((struct BgCnt *)&bg1Cnt)->charBaseBlock = 1;
+ SetGpuReg(REG_OFFSET_BG1CNT, bg1Cnt);
+ }
+
+ if (IsDoubleBattle() && !IsContest())
+ {
+ if (GetBattlerPosition(gBattleAnimAttacker) == B_POSITION_OPPONENT_RIGHT
+ || GetBattlerPosition(gBattleAnimAttacker) == B_POSITION_PLAYER_LEFT)
+ {
+ if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker)) == TRUE)
+ {
+ gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]].oam.priority -= 1;
+ ((struct BgCnt *)&bg1Cnt)->priority = 1;
+ SetGpuReg(REG_OFFSET_BG1CNT, bg1Cnt);
+ var0 = 1;
+ }
+ }
+ }
+
+ if (IsContest())
+ {
+ species = gContestResources->field_18->species;
+ }
+ else
+ {
+ if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
+ species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_SPECIES);
+ else
+ species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_SPECIES);
+ }
+
+ spriteId = GetAnimBattlerSpriteId(0);
+ newSpriteId = sub_80A89C8(gBattleAnimAttacker, spriteId, species);
+ sub_80A6B30(&unknownStruct);
+ sub_80A6D60(&unknownStruct, gUnknown_08C20684, 0);
+ sub_80A6CC0(unknownStruct.bgId, gUnknown_08C20668, unknownStruct.tilesOffset);
+ LoadPalette(&gUnknown_08597418, unknownStruct.unk8 * 16 + 1, 2);
+
+ gBattle_BG1_X = -gSprites[spriteId].pos1.x + 32;
+ gBattle_BG1_Y = -gSprites[spriteId].pos1.y + 32;
+ gTasks[taskId].data[0] = newSpriteId;
+ gTasks[taskId].data[6] = var0;
+ gTasks[taskId].func = sub_8116D64;
+}
+
+static void sub_8116D64(u8 taskId)
+{
+ struct UnknownAnimStruct2 unknownStruct;
+ struct Sprite *sprite;
+ u16 bg1Cnt;
+
+ gTasks[taskId].data[10] += 4;
+ gBattle_BG1_Y -= 4;
+ if (gTasks[taskId].data[10] == 64)
+ {
+ gTasks[taskId].data[10] = 0;
+ gBattle_BG1_Y += 64;
+ if (++gTasks[taskId].data[11] == 4)
+ {
+ sub_80A477C(0);
+ gBattle_WIN0H = 0;
+ gBattle_WIN0V = 0;
+ SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR
+ | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
+ SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR
+ | WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR);
+ if (!IsContest())
+ {
+ bg1Cnt = GetGpuReg(REG_OFFSET_BG1CNT);
+ ((struct BgCnt *)&bg1Cnt)->charBaseBlock = 0;
+ SetGpuReg(REG_OFFSET_BG1CNT, bg1Cnt);
+ }
+
+ SetGpuReg(REG_OFFSET_DISPCNT, GetGpuReg(REG_OFFSET_DISPCNT) ^ DISPCNT_OBJWIN_ON);
+ SetGpuReg(REG_OFFSET_BLDCNT, 0);
+ SetGpuReg(REG_OFFSET_BLDALPHA, 0);
+ sprite = &gSprites[GetAnimBattlerSpriteId(0)]; // unused
+ sprite = &gSprites[gTasks[taskId].data[0]];
+ DestroySprite(sprite);
+
+ sub_80A6B30(&unknownStruct);
+ sub_80A6C68(unknownStruct.bgId);
+ if (gTasks[taskId].data[6] == 1)
+ gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]].oam.priority++;
+
+ gBattle_BG1_Y = 0;
+ DestroyAnimVisualTask(taskId);
+ }
+ }
+}
+
+void sub_8116EB4(u8 taskId)
+{
+ u8 i;
+
+ sAnimStatsChangeData = AllocZeroed(sizeof(struct AnimStatsChangeData));
+ for (i = 0; i < 8; i++)
+ sAnimStatsChangeData->data[i] = gBattleAnimArgs[i];
+
+ gTasks[taskId].func = sub_8116F04;
+}
+
+static void sub_8116F04(u8 taskId)
+{
+ if (sAnimStatsChangeData->data[2] == 0)
+ sAnimStatsChangeData->battler1 = gBattleAnimAttacker;
+ else
+ sAnimStatsChangeData->battler1 = gBattleAnimTarget;
+
+ sAnimStatsChangeData->battler2 = BATTLE_PARTNER(sAnimStatsChangeData->battler1);
+ if (IsContest() || (sAnimStatsChangeData->data[3] && !IsBattlerSpriteVisible(sAnimStatsChangeData->battler2)))
+ sAnimStatsChangeData->data[3] = 0;
+
+ gBattle_WIN0H = 0;
+ gBattle_WIN0V = 0;
+ SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR
+ | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
+ SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR
+ | WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR);
+ SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJWIN_ON);
+ SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND);
+ SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
+ SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 0);
+ SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 0);
+ if (!IsContest())
+ SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1);
+
+ if (IsDoubleBattle() && sAnimStatsChangeData->data[3] == 0)
+ {
+ if (GetBattlerPosition(sAnimStatsChangeData->battler1) == B_POSITION_OPPONENT_RIGHT
+ || GetBattlerPosition(sAnimStatsChangeData->battler1) == B_POSITION_PLAYER_LEFT)
+ {
+ if (IsBattlerSpriteVisible(sAnimStatsChangeData->battler2) == TRUE)
+ {
+ gSprites[gBattlerSpriteIds[sAnimStatsChangeData->battler2]].oam.priority -= 1;
+ SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
+ sAnimStatsChangeData->higherPriority = 1;
+ }
+ }
+ }
+
+ if (IsContest())
+ {
+ sAnimStatsChangeData->species = gContestResources->field_18->species;
+ }
+ else
+ {
+ if (GetBattlerSide(sAnimStatsChangeData->battler1) != B_SIDE_PLAYER)
+ sAnimStatsChangeData->species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[sAnimStatsChangeData->battler1]], MON_DATA_SPECIES);
+ else
+ sAnimStatsChangeData->species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[sAnimStatsChangeData->battler1]], MON_DATA_SPECIES);
+ }
+
+ gTasks[taskId].func = sub_81170EC;
+}
+
+static void sub_81170EC(u8 taskId)
+{
+ struct UnknownAnimStruct2 unknownStruct;
+ u8 spriteId, spriteId2;
+ u8 battlerSpriteId;
+
+ spriteId2 = 0;
+ battlerSpriteId = gBattlerSpriteIds[sAnimStatsChangeData->battler1];
+ spriteId = sub_80A89C8(sAnimStatsChangeData->battler1, battlerSpriteId, sAnimStatsChangeData->species);
+ if (sAnimStatsChangeData->data[3])
+ {
+ battlerSpriteId = gBattlerSpriteIds[sAnimStatsChangeData->battler2];
+ spriteId2 = sub_80A89C8(sAnimStatsChangeData->battler2, battlerSpriteId, sAnimStatsChangeData->species);
+ }
+
+ sub_80A6B30(&unknownStruct);
+ if (sAnimStatsChangeData->data[0] == 0)
+ sub_80A6D60(&unknownStruct, gBattleStatMask1_Tilemap, 0);
+ else
+ sub_80A6D60(&unknownStruct, gBattleStatMask2_Tilemap, 0);
+
+ sub_80A6CC0(unknownStruct.bgId, gBattleStatMask_Gfx, unknownStruct.tilesOffset);
+ switch (sAnimStatsChangeData->data[1])
+ {
+ case 0:
+ LoadCompressedPalette(gBattleStatMask2_Pal, unknownStruct.unk8 << 4, 32);
+ break;
+ case 1:
+ LoadCompressedPalette(gBattleStatMask1_Pal, unknownStruct.unk8 << 4, 32);
+ break;
+ case 2:
+ LoadCompressedPalette(gBattleStatMask3_Pal, unknownStruct.unk8 << 4, 32);
+ break;
+ case 3:
+ LoadCompressedPalette(gBattleStatMask4_Pal, unknownStruct.unk8 << 4, 32);
+ break;
+ case 4:
+ LoadCompressedPalette(gBattleStatMask6_Pal, unknownStruct.unk8 << 4, 32);
+ break;
+ case 5:
+ LoadCompressedPalette(gBattleStatMask7_Pal, unknownStruct.unk8 << 4, 32);
+ break;
+ case 6:
+ LoadCompressedPalette(gBattleStatMask8_Pal, unknownStruct.unk8 << 4, 32);
+ break;
+ default:
+ LoadCompressedPalette(gBattleStatMask5_Pal, unknownStruct.unk8 << 4, 32);
+ break;
+ }
+
+ gBattle_BG1_X = 0;
+ gBattle_BG1_Y = 0;
+
+ if (sAnimStatsChangeData->data[0] == 1)
+ {
+ gBattle_BG1_X = 64;
+ gTasks[taskId].data[1] = -3;
+ }
+ else
+ {
+ gTasks[taskId].data[1] = 3;
+ }
+
+ if (sAnimStatsChangeData->data[4] == 0)
+ {
+ gTasks[taskId].data[4] = 10;
+ gTasks[taskId].data[5] = 20;
+ }
+ else
+ {
+ gTasks[taskId].data[4] = 13;
+ gTasks[taskId].data[5] = 30;
+ }
+
+ gTasks[taskId].data[0] = spriteId;
+ gTasks[taskId].data[2] = sAnimStatsChangeData->data[3];
+ gTasks[taskId].data[3] = spriteId2;
+ gTasks[taskId].data[6] = sAnimStatsChangeData->higherPriority;
+ gTasks[taskId].data[7] = gBattlerSpriteIds[sAnimStatsChangeData->battler2];
+ gTasks[taskId].func = sub_81172EC;
+
+ if (sAnimStatsChangeData->data[0] == 0)
+ PlaySE12WithPanning(SE_W287, BattleAnimAdjustPanning2(-64));
+ else
+ PlaySE12WithPanning(SE_W287B, BattleAnimAdjustPanning2(-64));
+}
+
+static void sub_81172EC(u8 taskId)
+{
+ gBattle_BG1_Y += gTasks[taskId].data[1];
+
+ switch (gTasks[taskId].data[15])
+ {
+ case 0:
+ if (gTasks[taskId].data[11]++ > 0)
+ {
+ gTasks[taskId].data[11] = 0;
+ gTasks[taskId].data[12]++;
+ SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[12], 16 - gTasks[taskId].data[12]));
+ if (gTasks[taskId].data[12] == gTasks[taskId].data[4])
+ gTasks[taskId].data[15]++;
+ }
+ break;
+ case 1:
+ if (++gTasks[taskId].data[10] == gTasks[taskId].data[5])
+ gTasks[taskId].data[15]++;
+ break;
+ case 2:
+ if (gTasks[taskId].data[11]++ > 0)
+ {
+ gTasks[taskId].data[11] = 0;
+ gTasks[taskId].data[12]--;
+ SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[12], 16 - gTasks[taskId].data[12]));
+ if (gTasks[taskId].data[12] == 0)
+ {
+ sub_80A477C(0);
+ gTasks[taskId].data[15]++;;
+ }
+ }
+ break;
+ case 3:
+ gBattle_WIN0H = 0;
+ gBattle_WIN0V = 0;
+ SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR
+ | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
+ SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR
+ | WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR);
+
+ if (!IsContest())
+ SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0);
+
+ SetGpuReg(REG_OFFSET_DISPCNT, GetGpuReg(REG_OFFSET_DISPCNT) ^ DISPCNT_OBJWIN_ON);
+ SetGpuReg(REG_OFFSET_BLDCNT, 0);
+ SetGpuReg(REG_OFFSET_BLDALPHA, 0);
+ DestroySprite(&gSprites[gTasks[taskId].data[0]]);
+ if (gTasks[taskId].data[2])
+ DestroySprite(&gSprites[gTasks[taskId].data[3]]);
+
+ if (gTasks[taskId].data[6] == 1)
+ gSprites[gTasks[taskId].data[7]].oam.priority++;
+
+ Free(sAnimStatsChangeData);
+ sAnimStatsChangeData = NULL;
+ DestroyAnimVisualTask(taskId);
+ break;
+ }
+}
+
+void sub_8117494(u8 taskId)
+{
+ u32 selectedPalettes = sub_80A76C4(1, 1, 1, 1);
+ sub_81175C4(selectedPalettes, 0);
+ gTasks[taskId].data[14] = selectedPalettes >> 16;
+
+ selectedPalettes = sub_80A75AC(1, 0, 0, 0, 0, 0, 0) & 0xFFFF;
+ sub_81175C4(selectedPalettes, 0xFFFF);
+ gTasks[taskId].data[15] = selectedPalettes;
+
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].data[1] = 0;
+ gTasks[taskId].func = sub_8117500;
+}
+
+static void sub_8117500(u8 taskId)
+{
+ u16 i;
+ struct Task *task = &gTasks[taskId];
+
+ switch (task->data[0])
+ {
+ case 0:
+ if (++task->data[1] > 6)
+ {
+ task->data[1] = 0;
+ task->data[2] = 16;
+ task->data[0]++;
+ }
+ break;
+ case 1:
+ if (++task->data[1] > 1)
+ {
+ task->data[1] = 0;
+ task->data[2]--;
+
+ for (i = 0; i < 16; i++)
+ {
+ if ((task->data[15] >> i) & 1)
+ {
+ u16 paletteOffset = i * 16;
+ BlendPalette(paletteOffset, 16, task->data[2], 0xFFFF);
+ }
+
+ if ((task->data[14] >> i) & 1)
+ {
+ u16 paletteOffset = i * 16 + 0x100;
+ BlendPalette(paletteOffset, 16, task->data[2], 0);
+ }
+ }
+
+ if (task->data[2] == 0)
+ task->data[0]++;
+ }
+ break;
+ case 2:
+ DestroyAnimVisualTask(taskId);
+ break;
+ }
+}
+
+static void sub_81175C4(u32 selectedPalettes, u16 color)
+{
+ u16 i;
+
+ for (i = 0; i < 32; i++)
+ {
+ if (selectedPalettes & 1)
+ {
+ u16 curOffset = i * 16;
+ u16 paletteOffset = curOffset;
+ while (curOffset < paletteOffset + 16)
+ {
+ gPlttBufferFaded[curOffset] = color;
+ curOffset++;
+ }
+ }
+
+ selectedPalettes >>= 1;
+ }
+}
+
+void sub_8117610(u8 taskId)
+{
+ u32 battler;
+ int j;
+ u32 selectedPalettes = 0;
+
+ for (battler = 0; battler < MAX_BATTLERS_COUNT; battler++)
+ {
+ if (gBattleAnimAttacker != battler)
+ selectedPalettes |= 1 << (battler + 16);
+ }
+
+ for (j = 5; j != 0; j--)
+ gBattleAnimArgs[j] = gBattleAnimArgs[j - 1];
+
+ StartBlendAnimSpriteColor(taskId, selectedPalettes);
+}
+
+void sub_8117660(u8 taskId)
+{
+ u8 newTaskId;
+
+ sub_80A6DAC(0);
+ newTaskId = CreateTask(sub_81176D8, 5);
+ if (gBattleAnimArgs[2] && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
+ {
+ gBattleAnimArgs[0] = -gBattleAnimArgs[0];
+ gBattleAnimArgs[1] = -gBattleAnimArgs[1];
+ }
+
+ gTasks[newTaskId].data[1] = gBattleAnimArgs[0];
+ gTasks[newTaskId].data[2] = gBattleAnimArgs[1];
+ gTasks[newTaskId].data[3] = gBattleAnimArgs[3];
+ gTasks[newTaskId].data[0]++;
+ DestroyAnimVisualTask(taskId);
+}
+
+static void sub_81176D8(u8 taskId)
+{
+ gTasks[taskId].data[10] += gTasks[taskId].data[1];
+ gTasks[taskId].data[11] += gTasks[taskId].data[2];
+ gBattle_BG3_X += gTasks[taskId].data[10] >> 8;
+ gBattle_BG3_Y += gTasks[taskId].data[11] >> 8;
+ gTasks[taskId].data[10] &= 0xFF;
+ gTasks[taskId].data[11] &= 0xFF;
+
+ if (gBattleAnimArgs[7] == gTasks[taskId].data[3])
+ {
+ gBattle_BG3_X = 0;
+ gBattle_BG3_Y = 0;
+ sub_80A6DAC(1);
+ DestroyTask(taskId);
+ }
+}
+
+void AnimTask_GetAttackerSide(u8 taskId)
+{
+ gBattleAnimArgs[7] = GetBattlerSide(gBattleAnimAttacker);
+ DestroyAnimVisualTask(taskId);
+}
+
+void AnimTask_GetTargetSide(u8 taskId)
+{
+ gBattleAnimArgs[7] = GetBattlerSide(gBattleAnimTarget);
+ DestroyAnimVisualTask(taskId);
+}
+
+void AnimTask_GetTargetIsAttackerPartner(u8 taskId)
+{
+ gBattleAnimArgs[7] = BATTLE_PARTNER(gBattleAnimAttacker) == gBattleAnimTarget;
+ DestroyAnimVisualTask(taskId);
+}
+
+void sub_81177E4(u8 taskId)
+{
+ u16 battler;
+
+ for (battler = 0; battler < MAX_BATTLERS_COUNT; battler++)
+ {
+ if (battler != gBattleAnimAttacker && IsBattlerSpriteVisible(battler))
+ gSprites[gBattlerSpriteIds[battler]].invisible = gBattleAnimArgs[0];
+ }
+
+ DestroyAnimVisualTask(taskId);
+}
+
+void sub_8117854(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, u8 arg6, u8 arg7, const u8 *arg8, const u8 *arg9, const u16 *palette)
+{
+ u16 species;
+ u8 spriteId, spriteId2;
+ u16 bg1Cnt;
+ struct UnknownAnimStruct2 unknownStruct;
+ u8 battler2;
+
+ spriteId2 = 0;
+ battler2 = BATTLE_PARTNER(battler1);
+
+ if (IsContest() || (arg4 && !IsBattlerSpriteVisible(battler2)))
+ arg4 = 0;
+
+ gBattle_WIN0H = 0;
+ gBattle_WIN0V = 0;
+ SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR
+ | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
+ SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR
+ | WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR);
+ SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJWIN_ON);
+ SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND);
+ SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
+ bg1Cnt = GetGpuReg(REG_OFFSET_BG1CNT);
+ ((vBgCnt *)&bg1Cnt)->priority = 0;
+ ((vBgCnt *)&bg1Cnt)->screenSize = 0;
+ ((vBgCnt *)&bg1Cnt)->areaOverflowMode = 1;
+ if (!IsContest())
+ {
+ ((vBgCnt *)&bg1Cnt)->charBaseBlock = 1;
+ }
+
+ SetGpuReg(REG_OFFSET_BG1CNT, bg1Cnt);
+
+ if (IsContest())
+ {
+ species = gContestResources->field_18->species;
+ }
+ else
+ {
+ if (GetBattlerSide(battler1) != B_SIDE_PLAYER)
+ species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler1]], MON_DATA_SPECIES);
+ else
+ species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler1]], MON_DATA_SPECIES);
+ }
+
+ spriteId = sub_80A89C8(battler1, gBattlerSpriteIds[battler1], species);
+ if (arg4)
+ spriteId2 = sub_80A89C8(battler2, gBattlerSpriteIds[battler2], species);
+
+ sub_80A6B30(&unknownStruct);
+ sub_80A6D60(&unknownStruct, arg9, 0);
+ sub_80A6CC0(unknownStruct.bgId, arg8, unknownStruct.tilesOffset);
+ LoadCompressedPalette(palette, unknownStruct.unk8 << 4, 32);
+
+ gBattle_BG1_X = 0;
+ gBattle_BG1_Y = 0;
+ gTasks[taskId].data[1] = arg2;
+ gTasks[taskId].data[4] = arg5;
+ gTasks[taskId].data[5] = arg7;
+ gTasks[taskId].data[6] = arg6;
+ gTasks[taskId].data[0] = spriteId;
+ gTasks[taskId].data[2] = arg4;
+ gTasks[taskId].data[3] = spriteId2;
+ gTasks[taskId].func = sub_8117A60;
+}
+
+static void sub_8117A60(u8 taskId)
+{
+ gTasks[taskId].data[13] += gTasks[taskId].data[1] < 0 ? -gTasks[taskId].data[1] : gTasks[taskId].data[1];
+ if (gTasks[taskId].data[1] < 0)
+ gBattle_BG1_Y -= gTasks[taskId].data[13] >> 8;
+ else
+ gBattle_BG1_Y += gTasks[taskId].data[13] >> 8;
+
+ gTasks[taskId].data[13] &= 0xFF;
+ switch (gTasks[taskId].data[15])
+ {
+ case 0:
+ if (gTasks[taskId].data[11]++ >= gTasks[taskId].data[6])
+ {
+ gTasks[taskId].data[11] = 0;
+ gTasks[taskId].data[12]++;
+ SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[12], 16 - gTasks[taskId].data[12]));
+ if (gTasks[taskId].data[12] == gTasks[taskId].data[4])
+ gTasks[taskId].data[15]++;
+ }
+ break;
+ case 1:
+ if (++gTasks[taskId].data[10] == gTasks[taskId].data[5])
+ gTasks[taskId].data[15]++;
+ break;
+ case 2:
+ if (gTasks[taskId].data[11]++ >= gTasks[taskId].data[6])
+ {
+ gTasks[taskId].data[11] = 0;
+ gTasks[taskId].data[12]--;
+ SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[12], 16 - gTasks[taskId].data[12]));
+ if (gTasks[taskId].data[12] == 0)
+ {
+ sub_80A477C(0);
+ gBattle_WIN0H = 0;
+ gBattle_WIN0V = 0;
+ SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR
+ | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
+ SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR
+ | WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR);
+ if (!IsContest())
+ {
+ u16 bg1Cnt = GetGpuReg(REG_OFFSET_BG1CNT);
+ ((vBgCnt *)&bg1Cnt)->charBaseBlock = 0;
+ SetGpuReg(REG_OFFSET_BG1CNT, bg1Cnt);
+ }
+
+ SetGpuReg(REG_OFFSET_DISPCNT, GetGpuReg(REG_OFFSET_DISPCNT) ^ DISPCNT_OBJWIN_ON);
+ SetGpuReg(REG_OFFSET_BLDCNT, 0);
+ SetGpuReg(REG_OFFSET_BLDALPHA, 0);
+ DestroySprite(&gSprites[gTasks[taskId].data[0]]);
+ if (gTasks[taskId].data[2])
+ DestroySprite(&gSprites[gTasks[taskId].data[3]]);
+
+ DestroyAnimVisualTask(taskId);
+ }
+ }
+ break;
+ }
+}
+
+void AnimTask_GetBattleTerrain(u8 taskId)
+{
+ gBattleAnimArgs[0] = gBattleTerrain;
+ DestroyAnimVisualTask(taskId);
+}
+
+void sub_8117C44(u8 taskId)
+{
+ gMonSpritesGfxPtr->field_17C = AllocZeroed(0x2000);
+ DestroyAnimVisualTask(taskId);
+}
+
+void sub_8117C70(u8 taskId)
+{
+ Free(gMonSpritesGfxPtr->field_17C);
+ gMonSpritesGfxPtr->field_17C = NULL;
+ DestroyAnimVisualTask(taskId);
+}
+
+void sub_8117CA0(u8 taskId)
+{
+ u32 selectedPalettes;
+ int paletteIndex = 0;
+
+ if (gBattleAnimArgs[0] == 0)
+ {
+ selectedPalettes = sub_80A75AC(1, 0, 0, 0, 0, 0, 0);
+ while ((selectedPalettes & 1) == 0)
+ {
+ selectedPalettes >>= 1;
+ paletteIndex++;
+ }
+ }
+ else if (gBattleAnimArgs[0] == 1)
+ {
+ paletteIndex = gBattleAnimAttacker + 16;
+ }
+ else if (gBattleAnimArgs[0] == 2)
+ {
+ paletteIndex = gBattleAnimTarget + 16;
+ }
+
+ memcpy(&gMonSpritesGfxPtr->field_17C[gBattleAnimArgs[1] * 16], &gPlttBufferUnfaded[paletteIndex * 16], 32);
+ DestroyAnimVisualTask(taskId);
+}
+
+void sub_8117D3C(u8 taskId)
+{
+ u32 selectedPalettes;
+ int paletteIndex = 0;
+
+ if (gBattleAnimArgs[0] == 0)
+ {
+ selectedPalettes = sub_80A75AC(1, 0, 0, 0, 0, 0, 0);
+ while ((selectedPalettes & 1) == 0)
+ {
+ selectedPalettes >>= 1;
+ paletteIndex++;
+ }
+ }
+ else if (gBattleAnimArgs[0] == 1)
+ {
+ paletteIndex = gBattleAnimAttacker + 16;
+ }
+ else if (gBattleAnimArgs[0] == 2)
+ {
+ paletteIndex = gBattleAnimTarget + 16;
+ }
+
+ memcpy(&gPlttBufferUnfaded[paletteIndex * 16], &gMonSpritesGfxPtr->field_17C[gBattleAnimArgs[1] * 16], 32);
+ DestroyAnimVisualTask(taskId);
+}
+
+void sub_8117DD8(u8 taskId)
+{
+ u32 selectedPalettes;
+ int paletteIndex = 0;
+
+ if (gBattleAnimArgs[0] == 0)
+ {
+ selectedPalettes = sub_80A75AC(1, 0, 0, 0, 0, 0, 0);
+ while ((selectedPalettes & 1) == 0)
+ {
+ selectedPalettes >>= 1;
+ paletteIndex++;
+ }
+ }
+ else if (gBattleAnimArgs[0] == 1)
+ {
+ paletteIndex = gBattleAnimAttacker + 16;
+ }
+ else if (gBattleAnimArgs[0] == 2)
+ {
+ paletteIndex = gBattleAnimTarget + 16;
+ }
+
+ memcpy(&gPlttBufferUnfaded[paletteIndex * 16], &gPlttBufferFaded[paletteIndex * 16], 32);
+ DestroyAnimVisualTask(taskId);
+}
+
+void AnimTask_IsContest(u8 taskId)
+{
+ if (IsContest())
+ gBattleAnimArgs[7] = 1;
+ else
+ gBattleAnimArgs[7] = 0;
+
+ DestroyAnimVisualTask(taskId);
+}
+
+void sub_8117E94(u8 taskId)
+{
+ gBattleAnimAttacker = gBattlerTarget;
+ gBattleAnimTarget = gEffectBattler;
+ DestroyAnimVisualTask(taskId);
+}
+
+void AnimTask_IsTargetSameSide(u8 taskId)
+{
+ if (GetBattlerSide(gBattleAnimAttacker) == GetBattlerSide(gBattleAnimTarget))
+ gBattleAnimArgs[7] = 1;
+ else
+ gBattleAnimArgs[7] = 0;
+
+ DestroyAnimVisualTask(taskId);
+}
+
+void sub_8117F10(u8 taskId)
+{
+ gBattleAnimTarget = gBattlerTarget;
+ DestroyAnimVisualTask(taskId);
+}
+
+void sub_8117F30(u8 taskId)
+{
+ gBattleAnimAttacker = gBattlerAttacker;
+ gBattleAnimTarget = gEffectBattler;
+ DestroyAnimVisualTask(taskId);
+}
+
+void sub_8117F60(u8 taskId)
+{
+ if (IsContest())
+ {
+ DestroyAnimVisualTask(taskId);
+ }
+ else
+ {
+ gTasks[taskId].data[0] = gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].invisible;
+ gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].invisible = 1;
+ gTasks[taskId].func = sub_8117FD0;
+ gAnimVisualTaskCount--;
+ }
+}
+
+static void sub_8117FD0(u8 taskId)
+{
+ if (gBattleAnimArgs[7] == 0x1000)
+ {
+ gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].invisible = (u8)gTasks[taskId].data[0] & 1;
+ DestroyTask(taskId);
+ }
+}
diff --git a/src/battle_arena.c b/src/battle_arena.c
index 4b47dcaf1..cd2c976da 100644
--- a/src/battle_arena.c
+++ b/src/battle_arena.c
@@ -15,6 +15,7 @@
#include "palette.h"
#include "random.h"
#include "sound.h"
+#include "string_util.h"
#include "text.h"
#include "util.h"
#include "constants/songs.h"
@@ -22,9 +23,6 @@
#include "constants/battle_frontier.h"
#include "constants/moves.h"
-extern u16 gBattle_WIN0H;
-extern u16 gBattle_WIN0V;
-
extern const u32 gUnknown_08D854E8[];
extern const u16 gUnknown_08D855E8[];
diff --git a/src/battle_bg.c b/src/battle_bg.c
index bbe50cc70..bb66a41fd 100644
--- a/src/battle_bg.c
+++ b/src/battle_bg.c
@@ -31,11 +31,6 @@ struct BattleBackground
const void *palette;
};
-extern u16 gBattle_BG1_X;
-extern u16 gBattle_BG1_Y;
-extern u16 gBattle_BG2_X;
-extern u16 gBattle_BG2_Y;
-
extern u8 GetCurrentMapBattleScene(void);
// .rodata
@@ -162,9 +157,9 @@ const struct BgTemplate gBattleBgTemplates[] =
},
};
-static const struct WindowTemplate gUnknown_0831AA18[] =
+static const struct WindowTemplate gStandardBattleWindowTemplates[] =
{
- {
+ { // 0 Standard battle message
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 15,
@@ -173,7 +168,7 @@ static const struct WindowTemplate gUnknown_0831AA18[] =
.paletteNum = 0,
.baseBlock = 0x0090,
},
- {
+ { // 1 "What will (pokemon) do?"
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 35,
@@ -182,7 +177,7 @@ static const struct WindowTemplate gUnknown_0831AA18[] =
.paletteNum = 0,
.baseBlock = 0x01c0,
},
- {
+ { // 2 "Fight/Pokemon/Bag/Run"
.bg = 0,
.tilemapLeft = 17,
.tilemapTop = 35,
@@ -191,7 +186,7 @@ static const struct WindowTemplate gUnknown_0831AA18[] =
.paletteNum = 5,
.baseBlock = 0x0190,
},
- {
+ { // 3 Top left move
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 55,
@@ -200,7 +195,7 @@ static const struct WindowTemplate gUnknown_0831AA18[] =
.paletteNum = 5,
.baseBlock = 0x0300,
},
- {
+ { // 4 Top right move
.bg = 0,
.tilemapLeft = 11,
.tilemapTop = 55,
@@ -209,7 +204,7 @@ static const struct WindowTemplate gUnknown_0831AA18[] =
.paletteNum = 5,
.baseBlock = 0x0310,
},
- {
+ { // 5 Bottom left move
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 57,
@@ -218,7 +213,7 @@ static const struct WindowTemplate gUnknown_0831AA18[] =
.paletteNum = 5,
.baseBlock = 0x0320,
},
- {
+ { // 6 Bottom right move
.bg = 0,
.tilemapLeft = 11,
.tilemapTop = 57,
@@ -383,7 +378,7 @@ static const struct WindowTemplate gUnknown_0831AA18[] =
DUMMY_WIN_TEMPLATE
};
-static const struct WindowTemplate gUnknown_0831AAE0[] =
+static const struct WindowTemplate gBattleArenaWindowTemplates[] =
{
{
.bg = 0,
@@ -597,8 +592,8 @@ static const struct WindowTemplate gUnknown_0831AAE0[] =
const struct WindowTemplate * const gBattleWindowTemplates[] =
{
- gUnknown_0831AA18,
- gUnknown_0831AAE0,
+ gStandardBattleWindowTemplates,
+ gBattleArenaWindowTemplates,
};
static const struct BattleBackground gBattleTerrainTable[] =
diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c
index 2b6a356dd..0cec046e4 100644
--- a/src/battle_controller_link_opponent.c
+++ b/src/battle_controller_link_opponent.c
@@ -26,8 +26,6 @@
#include "constants/songs.h"
#include "constants/trainers.h"
-extern u16 gBattle_BG0_X;
-extern u16 gBattle_BG0_Y;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern struct UnusedControllerStruct gUnknown_02022D0C;
@@ -558,7 +556,7 @@ static void LinkOpponentHandleGetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
size += CopyLinkOpponentMonData(i, monData + size);
@@ -892,7 +890,7 @@ static void LinkOpponentHandleSetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
SetLinkOpponentMonData(i);
@@ -1346,7 +1344,7 @@ static void LinkOpponentHandleTrainerSlideBack(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 280;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y;
- gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC;
+ gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy);
gBattlerControllerFuncs[gActiveBattler] = sub_8064470;
}
@@ -1708,7 +1706,7 @@ static void LinkOpponentHandleIntroTrainerBallThrow(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 280;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y;
- gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC;
+ gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_80676FC);
diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c
index 203883c27..04a3784da 100644
--- a/src/battle_controller_link_partner.c
+++ b/src/battle_controller_link_partner.c
@@ -26,8 +26,6 @@
#include "constants/songs.h"
#include "constants/trainers.h"
-extern u16 gBattle_BG0_X;
-extern u16 gBattle_BG0_Y;
extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
@@ -444,7 +442,7 @@ static void LinkPartnerHandleGetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
size += CopyLinkPartnerMonData(i, monData + size);
@@ -778,7 +776,7 @@ static void LinkPartnerHandleSetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
SetLinkPartnerMonData(i);
@@ -1168,7 +1166,7 @@ static void LinkPartnerHandleTrainerSlideBack(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y;
- gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC;
+ gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy);
gBattlerControllerFuncs[gActiveBattler] = sub_814AF54;
}
@@ -1534,7 +1532,7 @@ static void LinkPartnerHandleIntroTrainerBallThrow(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y;
- gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC;
+ gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler;
StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_805CC00);
diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c
index 54726229d..403cc5eed 100644
--- a/src/battle_controller_opponent.c
+++ b/src/battle_controller_opponent.c
@@ -33,8 +33,6 @@
#include "constants/songs.h"
#include "constants/trainers.h"
-extern u16 gBattle_BG0_X;
-extern u16 gBattle_BG0_Y;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern struct UnusedControllerStruct gUnknown_02022D0C;
@@ -541,7 +539,7 @@ static void OpponentHandleGetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
size += GetOpponentMonData(i, monData + size);
@@ -884,7 +882,7 @@ static void OpponentHandleSetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
SetOpponentMonData(i);
@@ -1383,7 +1381,7 @@ static void OpponentHandleTrainerSlideBack(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 280;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y;
- gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC;
+ gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy);
gBattlerControllerFuncs[gActiveBattler] = sub_805F240;
}
@@ -1857,7 +1855,7 @@ static void OpponentHandleIntroTrainerBallThrow(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 280;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y;
- gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC;
+ gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_806280C);
diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c
index ad5ae2059..49629198c 100644
--- a/src/battle_controller_player.c
+++ b/src/battle_controller_player.c
@@ -37,8 +37,6 @@
extern u8 gUnknown_0203CEE8;
extern u8 gUnknown_0203CEE9;
extern u8 gUnknown_0203CF00[];
-extern u16 gBattle_BG0_X;
-extern u16 gBattle_BG0_Y;
extern struct UnusedControllerStruct gUnknown_02022D0C;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
@@ -116,7 +114,7 @@ static void MoveSelectionDisplayPpNumber(void);
static void MoveSelectionDisplayPpString(void);
static void MoveSelectionDisplayMoveType(void);
static void MoveSelectionDisplayMoveNames(void);
-static void HandleMoveSwitchting(void);
+static void HandleMoveSwitching(void);
static void sub_8058FC0(void);
static void WaitForMonSelection(void);
static void CompleteWhenChoseItem(void);
@@ -619,7 +617,7 @@ static void HandleInputChooseMove(void)
MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27);
BattlePutTextOnWindow(gText_BattleSwitchWhich, 0xB);
- gBattlerControllerFuncs[gActiveBattler] = HandleMoveSwitchting;
+ gBattlerControllerFuncs[gActiveBattler] = HandleMoveSwitching;
}
}
}
@@ -674,7 +672,7 @@ u32 sub_8057FBC(void) // unused
return var;
}
-static void HandleMoveSwitchting(void)
+static void HandleMoveSwitching(void)
{
u8 perMovePPBonuses[4];
struct ChooseMoveStruct moveStruct;
@@ -1589,7 +1587,7 @@ static void PlayerHandleGetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
size += CopyPlayerMonData(i, monData + size);
@@ -1932,7 +1930,7 @@ static void PlayerHandleSetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
SetPlayerMonData(i);
@@ -2387,7 +2385,7 @@ static void PlayerHandleTrainerSlideBack(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y;
- gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC;
+ gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy);
StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1);
gBattlerControllerFuncs[gActiveBattler] = sub_80588B4;
@@ -2932,7 +2930,7 @@ static void PlayerHandleIntroTrainerBallThrow(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y;
- gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC;
+ gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler;
StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_805CC00);
diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c
index 3572c1c69..bd892c922 100644
--- a/src/battle_controller_player_partner.c
+++ b/src/battle_controller_player_partner.c
@@ -26,8 +26,6 @@
#include "constants/songs.h"
#include "constants/trainers.h"
-extern u16 gBattle_BG0_X;
-extern u16 gBattle_BG0_Y;
extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
@@ -632,7 +630,7 @@ static void PlayerPartnerHandleGetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
size += CopyPlayerPartnerMonData(i, monData + size);
@@ -966,7 +964,7 @@ static void PlayerPartnerHandleSetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
SetPlayerPartnerMonData(i);
@@ -1363,7 +1361,7 @@ static void PlayerPartnerHandleTrainerSlideBack(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y;
- gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC;
+ gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy);
gBattlerControllerFuncs[gActiveBattler] = sub_81BAE98;
}
@@ -1787,7 +1785,7 @@ static void PlayerPartnerHandleIntroTrainerBallThrow(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y;
- gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC;
+ gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler;
StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_805CC00);
diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c
index 72667649f..b54e61255 100644
--- a/src/battle_controller_recorded_opponent.c
+++ b/src/battle_controller_recorded_opponent.c
@@ -28,8 +28,6 @@
#include "constants/songs.h"
#include "constants/trainers.h"
-extern u16 gBattle_BG0_X;
-extern u16 gBattle_BG0_Y;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern struct UnusedControllerStruct gUnknown_02022D0C;
extern u8 gUnknown_0203C7B4;
@@ -542,7 +540,7 @@ static void RecordedOpponentHandleGetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
size += CopyRecordedOpponentMonData(i, monData + size);
@@ -876,7 +874,7 @@ static void RecordedOpponentHandleSetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
SetRecordedOpponentMonData(i);
@@ -1277,7 +1275,7 @@ static void RecordedOpponentHandleTrainerSlideBack(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 280;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y;
- gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC;
+ gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy);
gBattlerControllerFuncs[gActiveBattler] = sub_81865C8;
}
@@ -1651,7 +1649,7 @@ static void RecordedOpponentHandleIntroTrainerBallThrow(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 280;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y;
- gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC;
+ gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_818962C);
diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c
index b74d55cc8..17b115caa 100644
--- a/src/battle_controller_recorded_player.c
+++ b/src/battle_controller_recorded_player.c
@@ -25,8 +25,6 @@
#include "constants/battle_anim.h"
#include "constants/songs.h"
-extern u16 gBattle_BG0_X;
-extern u16 gBattle_BG0_Y;
extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT];
extern u8 gUnknown_0203C7B4;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
@@ -527,7 +525,7 @@ static void RecordedPlayerHandleGetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
size += CopyRecordedPlayerMonData(i, monData + size);
@@ -861,7 +859,7 @@ static void RecordedPlayerHandleSetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
SetRecordedPlayerMonData(i);
@@ -1278,7 +1276,7 @@ static void RecordedPlayerHandleTrainerSlideBack(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y;
- gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC;
+ gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy);
gBattlerControllerFuncs[gActiveBattler] = sub_81899F0;
}
@@ -1673,7 +1671,7 @@ static void RecordedPlayerHandleIntroTrainerBallThrow(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y;
- gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC;
+ gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler;
StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_805CC00);
diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c
index a7ea04515..3f1542edb 100644
--- a/src/battle_controller_safari.c
+++ b/src/battle_controller_safari.c
@@ -23,9 +23,6 @@
#include "constants/battle_anim.h"
#include "constants/songs.h"
-extern u16 gBattle_BG0_X;
-extern u16 gBattle_BG0_Y;
-
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern void sub_81358F4(void);
diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c
index f7e9831a7..1a3a2d53d 100644
--- a/src/battle_controller_wally.c
+++ b/src/battle_controller_wally.c
@@ -31,8 +31,6 @@
#include "constants/songs.h"
#include "constants/trainers.h"
-extern u16 gBattle_BG0_X;
-extern u16 gBattle_BG0_Y;
extern s32 gUnknown_0203CD70;
extern struct UnusedControllerStruct gUnknown_02022D0C;
@@ -442,7 +440,7 @@ static void WallyHandleGetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
size += CopyWallyMonData(i, monData + size);
@@ -776,7 +774,7 @@ static void WallyHandleSetMonData(void)
else
{
monToCheck = gBattleBufferA[gActiveBattler][2];
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (monToCheck & 1)
SetWallyMonData(i);
@@ -1437,7 +1435,7 @@ static void WallyHandleIntroTrainerBallThrow(void)
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.y;
- gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_80A6EEC;
+ gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler;
StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], sub_805CC00);
diff --git a/src/battle_dome.c b/src/battle_dome.c
index 2a77da180..152a11ae8 100644
--- a/src/battle_dome.c
+++ b/src/battle_dome.c
@@ -63,17 +63,9 @@ extern u8 GetFrontierBrainMonNature(u8);
extern void sub_81A4C30(void);
extern u8 sub_81A3610(void);
extern u16 GetFrontierBrainMonSpecies(u8);
-extern void ReducePlayerPartyToThree(void);
-
-extern u8 gUnknown_0203CEF8[];
-extern u16 gBattle_BG0_X;
-extern u16 gBattle_BG0_Y;
-extern u16 gBattle_BG1_X;
-extern u16 gBattle_BG1_Y;
-extern u16 gBattle_BG2_X;
-extern u16 gBattle_BG2_Y;
-extern u16 gBattle_BG3_X;
-extern u16 gBattle_BG3_Y;
+extern void ReducePlayerPartyToSelectedMons(void);
+
+extern u8 gSelectedOrderFromParty[];
extern const u16 gBattleFrontierHeldItems[];
extern const struct FacilityMon gBattleFrontierMons[];
@@ -2473,8 +2465,8 @@ static void sub_818EA84(void)
break;
case 8:
sub_81B8558();
- gUnknown_0203CEF8[0] = gSaveBlock2Ptr->frontier.field_CB0;
- gUnknown_0203CEF8[1] = gSaveBlock2Ptr->frontier.field_CB0 >> 8;
+ gSelectedOrderFromParty[0] = gSaveBlock2Ptr->frontier.field_CB0;
+ gSelectedOrderFromParty[1] = gSaveBlock2Ptr->frontier.field_CB0 >> 8;
break;
case 9:
gSpecialVar_Result = (gSaveBlock2Ptr->frontier.field_D0A * 2) - 3 + gSaveBlock2Ptr->frontier.field_D0B;
@@ -2543,7 +2535,7 @@ static void sub_818ED28(void)
}
break;
case 8:
- gSaveBlock2Ptr->frontier.field_CB0 = T1_READ_16(gUnknown_0203CEF8);
+ gSaveBlock2Ptr->frontier.field_CB0 = T1_READ_16(gSelectedOrderFromParty);
break;
}
}
@@ -2756,17 +2748,17 @@ static void CalcDomeMonStats(u16 species, s32 level, s32 ivs, u8 evBits, u8 natu
s32 i, count;
u8 bits;
u16 resultingEvs;
- s32 evs[6];
+ s32 evs[NUM_STATS];
count = 0, bits = evBits;
- for (i = 0; i < 6; bits >>= 1, i++)
+ for (i = 0; i < NUM_STATS; bits >>= 1, i++)
{
if (bits & 1)
count++;
}
resultingEvs = MAX_TOTAL_EVS / count;
- for (i = 0; i < 6; bits <<= 1, i++)
+ for (i = 0; i < NUM_STATS; bits <<= 1, i++)
{
evs[i] = 0;
if (evBits & bits)
@@ -4953,7 +4945,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
for (i = 0; i < 3; i++)
{
s32 evBits = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]].evSpread;
- for (k = 0, j = 0; j < 6; j++)
+ for (k = 0, j = 0; j < NUM_STATS; j++)
{
allocatedArray[j] = 0;
if (evBits & 1)
@@ -4962,7 +4954,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
}
k = MAX_TOTAL_EVS / k;
evBits = gFacilityTrainerMons[gSaveBlock2Ptr->frontier.domeMonIds[trainerTournamentId][i]].evSpread;
- for (j = 0; j < 6; j++)
+ for (j = 0; j < NUM_STATS; j++)
{
if (evBits & 1)
allocatedArray[j] = k;
@@ -6078,7 +6070,7 @@ static void sub_8194D68(void)
for (i = 0; i < 2; i++)
{
- s32 playerMonId = gSaveBlock2Ptr->frontier.selectedPartyMons[gUnknown_0203CEF8[i] - 1] - 1;
+ s32 playerMonId = gSaveBlock2Ptr->frontier.selectedPartyMons[gSelectedOrderFromParty[i] - 1] - 1;
s32 count;
for (moveSlot = 0; moveSlot < 4; moveSlot++)
@@ -6104,7 +6096,7 @@ static void sub_8194E44(void)
for (i = 0; i < 2; i++)
{
- s32 playerMonId = gSaveBlock2Ptr->frontier.selectedPartyMons[gUnknown_0203CEF8[i] - 1] - 1;
+ s32 playerMonId = gSaveBlock2Ptr->frontier.selectedPartyMons[gSelectedOrderFromParty[i] - 1] - 1;
u16 item = GetMonData(&gSaveBlock1Ptr->playerParty[playerMonId], MON_DATA_HELD_ITEM, NULL);
SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &item);
}
@@ -6112,7 +6104,7 @@ static void sub_8194E44(void)
static void sub_8194EB4(void)
{
- ReducePlayerPartyToThree();
+ ReducePlayerPartyToSelectedMons();
}
static void sub_8194EC0(void)
diff --git a/src/battle_factory.c b/src/battle_factory.c
index 37abf6add..1d7fbafc9 100644
--- a/src/battle_factory.c
+++ b/src/battle_factory.c
@@ -13,8 +13,6 @@
#include "constants/trainers.h"
#include "constants/moves.h"
-extern u16 gUnknown_03006298[];
-
extern const struct FacilityMon gBattleFrontierMons[];
extern const struct FacilityMon gSlateportBattleTentMons[];
extern const struct BattleFrontierTrainer gBattleFrontierTrainers[];
diff --git a/src/battle_factory_screen.c b/src/battle_factory_screen.c
index 255cf5aa1..42a9b579c 100644
--- a/src/battle_factory_screen.c
+++ b/src/battle_factory_screen.c
@@ -131,7 +131,6 @@ struct FactorySwapMonsStruct
bool8 unk30;
};
-extern u8 (*gUnknown_030062E8)(void);
extern u8 gUnknown_0203CF20;
extern const u16 gBattleFrontierHeldItems[];
@@ -237,6 +236,9 @@ static IWRAM_DATA struct FactorySelectMonsStruct *sFactorySelectScreen;
static IWRAM_DATA void (*sSwap_CurrentTableFunc)(u8 taskId);
static IWRAM_DATA struct FactorySwapMonsStruct *sFactorySwapScreen;
+// IWRAM common
+u8 (*gUnknown_030062E8)(void);
+
// Const rom data.
static const u16 gUnknown_0860F13C[] = INCBIN_U16("graphics/unknown/unknown_60F13C.gbapal");
static const u16 gUnknown_0860F15C[] = INCBIN_U16("graphics/unknown/unknown_60F15C.gbapal");
diff --git a/src/battle_interface.c b/src/battle_interface.c
index ec8a06094..c7eb11293 100644
--- a/src/battle_interface.c
+++ b/src/battle_interface.c
@@ -168,15 +168,15 @@ extern const u8 gText_DynColor1Female[];
// this file's functions
static const u8 *GetHealthboxElementGfxPtr(u8 elementId);
-static u8* AddTextPrinterAndCreateWindowOnHealthbox(const u8 *str, u32 x, u32 y, u32 arg3, u32 *windowId);
+static u8* AddTextPrinterAndCreateWindowOnHealthbox(const u8 *str, u32 x, u32 y, u32 bgColor, u32 *windowId);
static void RemoveWindowOnHealthbox(u32 windowId);
static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent);
static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId);
-static void TextIntoHealthboxObject(void *dest, u8 *windowTileData, s32 arg2);
-static void SafariTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 arg2);
-static void HpTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 arg2);
+static void TextIntoHealthboxObject(void *dest, u8 *windowTileData, s32 windowWidth);
+static void SafariTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 windowWidth);
+static void HpTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 windowWidth);
static void FillHealthboxObject(void *dest, u32 arg1, u32 arg2);
static void sub_8073E08(u8 taskId);
@@ -965,7 +965,7 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId)
healthBarSpritePtr->subspriteMode = 2;
healthBarSpritePtr->oam.priority = 1;
- CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_1), (void*)(OBJ_VRAM0 + healthBarSpritePtr->oam.tileNum * 32), 64);
+ CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_1), (void*)(OBJ_VRAM0 + healthBarSpritePtr->oam.tileNum * TILE_SIZE_4BPP), 64);
gSprites[healthboxLeftSpriteId].hMain_HealthBarSpriteId = healthbarSpriteId;
gSprites[healthboxLeftSpriteId].hMain_Battler = battlerId;
@@ -1154,7 +1154,7 @@ static void UpdateLvlInHealthbox(u8 healthboxSpriteId, u8 lvl)
xPos += var1;
windowTileData = AddTextPrinterAndCreateWindowOnHealthbox(text, xPos, 3, 2, &windowId);
- spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * 32;
+ spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * TILE_SIZE_4BPP;
if (GetBattlerSide(gSprites[healthboxSpriteId].hMain_Battler) == B_SIDE_PLAYER)
{
@@ -1182,7 +1182,7 @@ void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent)
if (GetBattlerSide(gSprites[healthboxSpriteId].hMain_Battler) == B_SIDE_PLAYER && !IsDoubleBattle())
{
- spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * 32;
+ spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * TILE_SIZE_4BPP;
if (maxOrCurrent != HP_CURRENT) // singles, max
{
ConvertIntToDecimalStringN(text, value, STR_CONV_MODE_RIGHT_ALIGN, 3);
@@ -1243,7 +1243,7 @@ void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent)
for (i = 0; i < 3; i++)
{
CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[i * 64 + 32],
- (void*)((OBJ_VRAM0) + 32 * (gSprites[healthboxSpriteId].oam.tileNum + var + i)),
+ (void*)((OBJ_VRAM0) + TILE_SIZE_4BPP * (gSprites[healthboxSpriteId].oam.tileNum + var + i)),
0x20);
}
}
@@ -1261,7 +1261,7 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8
{
if (gBattleSpritesDataPtr->battlerData[gSprites[healthboxSpriteId].data[6]].hpNumbersNoBars) // don't print text if only bars are visible
{
- spriteTileNum = gSprites[gSprites[healthboxSpriteId].data[5]].oam.tileNum * 32;
+ spriteTileNum = gSprites[gSprites[healthboxSpriteId].data[5]].oam.tileNum * TILE_SIZE_4BPP;
objVram = (void*)(OBJ_VRAM0) + spriteTileNum;
if (maxOrCurrent != HP_CURRENT) // doubles, max hp
@@ -1271,7 +1271,7 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8
HpTextIntoHealthboxObject((void*)(OBJ_VRAM0) + spriteTileNum + 0xC0, windowTileData, 2);
RemoveWindowOnHealthbox(windowId);
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_116),
- (void*)(OBJ_VRAM0 + 0x680) + (gSprites[healthboxSpriteId].oam.tileNum * 32),
+ (void*)(OBJ_VRAM0 + 0x680) + (gSprites[healthboxSpriteId].oam.tileNum * TILE_SIZE_4BPP),
0x20);
}
else
@@ -1328,16 +1328,16 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8
if (maxOrCurrent == HP_CURRENT)
{
CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[224],
- (void*)((OBJ_VRAM0) + ((gSprites[r7].oam.tileNum + 4) * 32)),
+ (void*)((OBJ_VRAM0) + ((gSprites[r7].oam.tileNum + 4) * TILE_SIZE_4BPP)),
0x20);
- CpuFill32(0, (void*)((OBJ_VRAM0) + (gSprites[r7].oam.tileNum * 32)), 0x20);
+ CpuFill32(0, (void*)((OBJ_VRAM0) + (gSprites[r7].oam.tileNum * TILE_SIZE_4BPP)), 0x20);
}
else
{
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) // Impossible to reach part, because the battlerId is from the opponent's side.
{
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_116),
- (void*)(OBJ_VRAM0) + ((gSprites[healthboxSpriteId].oam.tileNum + 52) * 32),
+ (void*)(OBJ_VRAM0) + ((gSprites[healthboxSpriteId].oam.tileNum + 52) * TILE_SIZE_4BPP),
0x20);
}
}
@@ -1349,7 +1349,7 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8
static void PrintSafariMonInfo(u8 healthboxSpriteId, struct Pokemon *mon)
{
u8 text[20];
- s32 j, var2;
+ s32 j, spriteTileNum;
u8 *barFontGfx;
u8 i, var, nature, healthBarSpriteId;
@@ -1376,12 +1376,12 @@ static void PrintSafariMonInfo(u8 healthboxSpriteId, struct Pokemon *mon)
for (j = 1; j < var + 1; j++)
{
- var2 = (gSprites[healthboxSpriteId].oam.tileNum + (j - (j / 8 * 8)) + (j / 8 * 64)) * 32;
- CpuCopy32(barFontGfx, (void*)(OBJ_VRAM0) + (var2), 0x20);
+ spriteTileNum = (gSprites[healthboxSpriteId].oam.tileNum + (j - (j / 8 * 8)) + (j / 8 * 64)) * TILE_SIZE_4BPP;
+ CpuCopy32(barFontGfx, (void*)(OBJ_VRAM0) + (spriteTileNum), 0x20);
barFontGfx += 0x20;
- var2 = (8 + gSprites[healthboxSpriteId].oam.tileNum + (j - (j / 8 * 8)) + (j / 8 * 64)) * 32;
- CpuCopy32(barFontGfx, (void*)(OBJ_VRAM0) + (var2), 0x20);
+ spriteTileNum = (8 + gSprites[healthboxSpriteId].oam.tileNum + (j - (j / 8 * 8)) + (j / 8 * 64)) * TILE_SIZE_4BPP;
+ CpuCopy32(barFontGfx, (void*)(OBJ_VRAM0) + (spriteTileNum), 0x20);
barFontGfx += 0x20;
}
@@ -1398,13 +1398,13 @@ static void PrintSafariMonInfo(u8 healthboxSpriteId, struct Pokemon *mon)
if (j <= 1)
{
CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[0x40 * j + 0x20],
- (void*)(OBJ_VRAM0) + (gSprites[healthBarSpriteId].oam.tileNum + 2 + j) * 32,
+ (void*)(OBJ_VRAM0) + (gSprites[healthBarSpriteId].oam.tileNum + 2 + j) * TILE_SIZE_4BPP,
32);
}
else
{
CpuCopy32(&gMonSpritesGfxPtr->barFontGfx[0x40 * j + 0x20],
- (void*)(OBJ_VRAM0 + 0xC0) + (j + gSprites[healthBarSpriteId].oam.tileNum) * 32,
+ (void*)(OBJ_VRAM0 + 0xC0) + (j + gSprites[healthBarSpriteId].oam.tileNum) * TILE_SIZE_4BPP,
32);
}
}
@@ -1436,7 +1436,7 @@ void SwapHpBarsWithHpText(void)
{
healthBarSpriteId = gSprites[gHealthboxSpriteIds[i]].hMain_HealthBarSpriteId;
- CpuFill32(0, (void*)(OBJ_VRAM0 + gSprites[healthBarSpriteId].oam.tileNum * 32), 0x100);
+ CpuFill32(0, (void*)(OBJ_VRAM0 + gSprites[healthBarSpriteId].oam.tileNum * TILE_SIZE_4BPP), 0x100);
UpdateHpTextInHealthboxInDoubles(gHealthboxSpriteIds[i], GetMonData(&gPlayerParty[gBattlerPartyIndexes[i]], MON_DATA_HP), HP_CURRENT);
UpdateHpTextInHealthboxInDoubles(gHealthboxSpriteIds[i], GetMonData(&gPlayerParty[gBattlerPartyIndexes[i]], MON_DATA_MAX_HP), HP_MAX);
}
@@ -1444,7 +1444,7 @@ void SwapHpBarsWithHpText(void)
{
UpdateStatusIconInHealthbox(gHealthboxSpriteIds[i]);
UpdateHealthboxAttribute(gHealthboxSpriteIds[i], &gPlayerParty[gBattlerPartyIndexes[i]], HEALTHBOX_HEALTH_BAR);
- CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_117), (void*)(OBJ_VRAM0 + 0x680 + gSprites[gHealthboxSpriteIds[i]].oam.tileNum * 32), 32);
+ CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_117), (void*)(OBJ_VRAM0 + 0x680 + gSprites[gHealthboxSpriteIds[i]].oam.tileNum * TILE_SIZE_4BPP), 32);
}
}
else
@@ -1970,7 +1970,7 @@ static void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon)
break;
}
- spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * 32;
+ spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * TILE_SIZE_4BPP;
if (GetBattlerSide(gSprites[healthboxSpriteId].data[6]) == B_SIDE_PLAYER)
{
@@ -2008,9 +2008,9 @@ static void TryAddPokeballIconToHealthbox(u8 healthboxSpriteId, bool8 noStatus)
healthBarSpriteId = gSprites[healthboxSpriteId].hMain_HealthBarSpriteId;
if (noStatus)
- CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_70), (void*)(OBJ_VRAM0 + (gSprites[healthBarSpriteId].oam.tileNum + 8) * 32), 32);
+ CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_70), (void*)(OBJ_VRAM0 + (gSprites[healthBarSpriteId].oam.tileNum + 8) * TILE_SIZE_4BPP), 32);
else
- CpuFill32(0, (void*)(OBJ_VRAM0 + (gSprites[healthBarSpriteId].oam.tileNum + 8) * 32), 32);
+ CpuFill32(0, (void*)(OBJ_VRAM0 + (gSprites[healthBarSpriteId].oam.tileNum + 8) * TILE_SIZE_4BPP), 32);
}
static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
@@ -2068,10 +2068,10 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
statusGfxPtr = GetHealthboxElementGfxPtr(HEALTHBOX_GFX_39);
for (i = 0; i < 3; i++)
- CpuCopy32(statusGfxPtr, (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder + i) * 32), 32);
+ CpuCopy32(statusGfxPtr, (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder + i) * TILE_SIZE_4BPP), 32);
if (!gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars)
- CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_1), (void *)(OBJ_VRAM0 + gSprites[healthBarSpriteId].oam.tileNum * 32), 64);
+ CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_1), (void *)(OBJ_VRAM0 + gSprites[healthBarSpriteId].oam.tileNum * TILE_SIZE_4BPP), 64);
TryAddPokeballIconToHealthbox(healthboxSpriteId, TRUE);
return;
@@ -2082,13 +2082,13 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
FillPalette(sStatusIconColors[statusPalId], pltAdder + 0x100, 2);
CpuCopy16(gPlttBufferUnfaded + 0x100 + pltAdder, (void*)(OBJ_PLTT + pltAdder * 2), 2);
- CpuCopy32(statusGfxPtr, (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder) * 32), 96);
+ CpuCopy32(statusGfxPtr, (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder) * TILE_SIZE_4BPP), 96);
if (IsDoubleBattle() == TRUE || GetBattlerSide(battlerId) == B_SIDE_OPPONENT)
{
if (!gBattleSpritesDataPtr->battlerData[battlerId].hpNumbersNoBars)
{
- CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_0), (void*)(OBJ_VRAM0 + gSprites[healthBarSpriteId].oam.tileNum * 32), 32);
- CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_65), (void*)(OBJ_VRAM0 + (gSprites[healthBarSpriteId].oam.tileNum + 1) * 32), 32);
+ CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_0), (void*)(OBJ_VRAM0 + gSprites[healthBarSpriteId].oam.tileNum * TILE_SIZE_4BPP), 32);
+ CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_65), (void*)(OBJ_VRAM0 + (gSprites[healthBarSpriteId].oam.tileNum + 1) * TILE_SIZE_4BPP), 32);
}
}
TryAddPokeballIconToHealthbox(healthboxSpriteId, FALSE);
@@ -2160,7 +2160,7 @@ static void UpdateSafariBallsTextOnHealthbox(u8 healthboxSpriteId)
u8 *windowTileData;
windowTileData = AddTextPrinterAndCreateWindowOnHealthbox(gText_SafariBalls, 0, 3, 2, &windowId);
- spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * 32;
+ spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * TILE_SIZE_4BPP;
TextIntoHealthboxObject((void*)(OBJ_VRAM0 + 0x40) + spriteTileNum, windowTileData, 6);
TextIntoHealthboxObject((void*)(OBJ_VRAM0 + 0x800) + spriteTileNum, windowTileData + 0xC0, 2);
RemoveWindowOnHealthbox(windowId);
@@ -2177,7 +2177,7 @@ static void UpdateLeftNoOfBallsTextOnHealthbox(u8 healthboxSpriteId)
ConvertIntToDecimalStringN(txtPtr, gNumSafariBalls, STR_CONV_MODE_LEFT_ALIGN, 2);
windowTileData = AddTextPrinterAndCreateWindowOnHealthbox(text, GetStringRightAlignXOffset(0, text, 0x2F), 3, 2, &windowId);
- spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * 32;
+ spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * TILE_SIZE_4BPP;
SafariTextIntoHealthboxObject((void*)(OBJ_VRAM0 + 0x2C0) + spriteTileNum, windowTileData, 2);
SafariTextIntoHealthboxObject((void*)(OBJ_VRAM0 + 0xA00) + spriteTileNum, windowTileData + 0x40, 4);
RemoveWindowOnHealthbox(windowId);
@@ -2323,10 +2323,10 @@ static void MoveBattleBarGraphically(u8 battlerId, u8 whichBar)
u8 healthbarSpriteId = gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].hMain_HealthBarSpriteId;
if (i < 2)
CpuCopy32(GetHealthboxElementGfxPtr(barElementId) + array[i] * 32,
- (void*)(OBJ_VRAM0 + (gSprites[healthbarSpriteId].oam.tileNum + 2 + i) * 32), 32);
+ (void*)(OBJ_VRAM0 + (gSprites[healthbarSpriteId].oam.tileNum + 2 + i) * TILE_SIZE_4BPP), 32);
else
CpuCopy32(GetHealthboxElementGfxPtr(barElementId) + array[i] * 32,
- (void*)(OBJ_VRAM0 + 64 + (i + gSprites[healthbarSpriteId].oam.tileNum) * 32), 32);
+ (void*)(OBJ_VRAM0 + 64 + (i + gSprites[healthbarSpriteId].oam.tileNum) * TILE_SIZE_4BPP), 32);
}
break;
case EXP_BAR:
@@ -2345,10 +2345,10 @@ static void MoveBattleBarGraphically(u8 battlerId, u8 whichBar)
{
if (i < 4)
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_12) + array[i] * 32,
- (void*)(OBJ_VRAM0 + (gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].oam.tileNum + 0x24 + i) * 32), 32);
+ (void*)(OBJ_VRAM0 + (gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].oam.tileNum + 0x24 + i) * TILE_SIZE_4BPP), 32);
else
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_12) + array[i] * 32,
- (void*)(OBJ_VRAM0 + 0xB80 + (i + gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].oam.tileNum) * 32), 32);
+ (void*)(OBJ_VRAM0 + 0xB80 + (i + gSprites[gBattleSpritesDataPtr->battleBars[battlerId].healthboxSpriteId].oam.tileNum) * TILE_SIZE_4BPP), 32);
}
break;
}
@@ -2571,16 +2571,16 @@ u8 GetHPBarLevel(s16 hp, s16 maxhp)
return result;
}
-static u8* AddTextPrinterAndCreateWindowOnHealthbox(const u8 *str, u32 x, u32 y, u32 arg3, u32 *windowId)
+static u8* AddTextPrinterAndCreateWindowOnHealthbox(const u8 *str, u32 x, u32 y, u32 bgColor, u32 *windowId)
{
u16 winId;
u8 color[3];
struct WindowTemplate winTemplate = sHealthboxWindowTemplate;
winId = AddWindow(&winTemplate);
- FillWindowPixelBuffer(winId, (arg3 << 4) | (arg3));
+ FillWindowPixelBuffer(winId, (bgColor << 4) | (bgColor));
- color[0] = arg3;
+ color[0] = bgColor;
color[1] = 1;
color[2] = 3;
@@ -2597,31 +2597,31 @@ static void RemoveWindowOnHealthbox(u32 windowId)
static void FillHealthboxObject(void *dest, u32 arg1, u32 arg2)
{
- CpuFill32(0x11111111 * arg1, dest, arg2 * 32);
+ CpuFill32(0x11111111 * arg1, dest, arg2 * TILE_SIZE_4BPP);
}
-static void HpTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 arg2)
+static void HpTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 windowWidth)
{
- CpuCopy32(windowTileData + 256, dest, arg2 * 32);
+ CpuCopy32(windowTileData + 256, dest, windowWidth * TILE_SIZE_4BPP);
}
-static void TextIntoHealthboxObject(void *dest, u8 *windowTileData, s32 arg2)
+static void TextIntoHealthboxObject(void *dest, u8 *windowTileData, s32 windowWidth)
{
- CpuCopy32(windowTileData + 256, dest + 256, arg2 * 32);
-
- if (arg2 > 0)
+ CpuCopy32(windowTileData + 256, dest + 256, windowWidth * TILE_SIZE_4BPP);
+// + 256 as that prevents the top 4 blank rows of sHealthboxWindowTemplate from being copied
+ if (windowWidth > 0)
{
do
{
CpuCopy32(windowTileData + 20, dest + 20, 12);
dest += 32, windowTileData += 32;
- arg2--;
- } while (arg2 != 0);
+ windowWidth--;
+ } while (windowWidth != 0);
}
}
-static void SafariTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 arg2)
+static void SafariTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 windowWidth)
{
- CpuCopy32(windowTileData, dest, arg2 * 32);
- CpuCopy32(windowTileData + 256, dest + 256, arg2 * 32);
+ CpuCopy32(windowTileData, dest, windowWidth * TILE_SIZE_4BPP);
+ CpuCopy32(windowTileData + 256, dest + 256, windowWidth * TILE_SIZE_4BPP);
}
diff --git a/src/battle_main.c b/src/battle_main.c
index f6c01aee2..8bdd2220b 100644
--- a/src/battle_main.c
+++ b/src/battle_main.c
@@ -5,6 +5,7 @@
#include "battle_controllers.h"
#include "battle_interface.h"
#include "battle_message.h"
+#include "battle_pyramid.h"
#include "battle_scripts.h"
#include "battle_setup.h"
#include "battle_tower.h"
@@ -68,18 +69,6 @@ struct UnknownPokemonStruct4
/*0x1D*/ u8 language;
};
-extern u16 gBattle_BG0_X;
-extern u16 gBattle_BG0_Y;
-extern u16 gBattle_BG1_X;
-extern u16 gBattle_BG1_Y;
-extern u16 gBattle_BG2_X;
-extern u16 gBattle_BG2_Y;
-extern u16 gBattle_BG3_X;
-extern u16 gBattle_BG3_Y;
-extern u16 gBattle_WIN0H;
-extern u16 gBattle_WIN0V;
-extern u16 gBattle_WIN1H;
-extern u16 gBattle_WIN1V;
extern struct MusicPlayerInfo gMPlayInfo_SE1;
extern struct MusicPlayerInfo gMPlayInfo_SE2;
extern u8 gUnknown_0203CF00[];
@@ -109,10 +98,8 @@ extern const u8 gText_Love[];
// functions
extern void sub_81B9150(void);
extern void sub_80B3AF8(u8 taskId); // cable club
-extern u8 sub_81A9E28(void); // battle frontier 2
extern void sub_81B8FB0(u8, u8); // party menu
extern u8 pokemon_order_func(u8); // party menu
-extern bool8 InBattlePyramid(void);
// this file's functions
static void CB2_InitBattleInternal(void);
@@ -179,13 +166,25 @@ static void HandleAction_WatchesCarefully(void);
static void HandleAction_SafariZoneBallThrow(void);
static void HandleAction_ThrowPokeblock(void);
static void HandleAction_GoNear(void);
-static void HandleAction_SafriZoneRun(void);
+static void HandleAction_SafariZoneRun(void);
static void HandleAction_WallyBallThrow(void);
static void HandleAction_Action11(void);
static void HandleAction_NothingIsFainted(void);
static void HandleAction_ActionFinished(void);
// EWRAM vars
+EWRAM_DATA u16 gBattle_BG0_X = 0;
+EWRAM_DATA u16 gBattle_BG0_Y = 0;
+EWRAM_DATA u16 gBattle_BG1_X = 0;
+EWRAM_DATA u16 gBattle_BG1_Y = 0;
+EWRAM_DATA u16 gBattle_BG2_X = 0;
+EWRAM_DATA u16 gBattle_BG2_Y = 0;
+EWRAM_DATA u16 gBattle_BG3_X = 0;
+EWRAM_DATA u16 gBattle_BG3_Y = 0;
+EWRAM_DATA u16 gBattle_WIN0H = 0;
+EWRAM_DATA u16 gBattle_WIN0V = 0;
+EWRAM_DATA u16 gBattle_WIN1H = 0;
+EWRAM_DATA u16 gBattle_WIN1V = 0;
EWRAM_DATA u8 gDisplayedStringBattle[300] = {0};
EWRAM_DATA u8 gBattleTextBuff1[TEXT_BUFF_ARRAY_COUNT] = {0};
EWRAM_DATA u8 gBattleTextBuff2[TEXT_BUFF_ARRAY_COUNT] = {0};
@@ -516,7 +515,7 @@ static void (* const sTurnActionsFuncsTable[])(void) =
HandleAction_SafariZoneBallThrow, // B_ACTION_SAFARI_BALL
HandleAction_ThrowPokeblock, // B_ACTION_SAFARI_POKEBLOCK
HandleAction_GoNear, // B_ACTION_SAFARI_GO_NEAR
- HandleAction_SafriZoneRun, // B_ACTION_SAFARI_RUN
+ HandleAction_SafariZoneRun, // B_ACTION_SAFARI_RUN
HandleAction_WallyBallThrow, // B_ACTION_WALLY_THROW
HandleAction_RunBattleScript, // B_ACTION_EXEC_SCRIPT
HandleAction_Action11, // not sure about this one
@@ -3095,7 +3094,7 @@ void SwitchInClearSetData(void)
if (gBattleMoves[gCurrentMove].effect != EFFECT_BATON_PASS)
{
- for (i = 0; i < BATTLE_STATS_NO; i++)
+ for (i = 0; i < NUM_BATTLE_STATS; i++)
gBattleMons[gActiveBattler].statStages[i] = 6;
for (i = 0; i < gBattlersCount; i++)
{
@@ -3204,7 +3203,7 @@ void FaintClearSetData(void)
s32 i;
u8 *ptr;
- for (i = 0; i < BATTLE_STATS_NO; i++)
+ for (i = 0; i < NUM_BATTLE_STATS; i++)
gBattleMons[gActiveBattler].statStages[i] = 6;
gBattleMons[gActiveBattler].status2 = 0;
@@ -3358,7 +3357,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].altAbility);
hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)];
*hpOnSwitchout = gBattleMons[gActiveBattler].hp;
- for (i = 0; i < BATTLE_STATS_NO; i++)
+ for (i = 0; i < NUM_BATTLE_STATS; i++)
gBattleMons[gActiveBattler].statStages[i] = 6;
gBattleMons[gActiveBattler].status2 = 0;
}
@@ -5604,7 +5603,7 @@ bool8 TryRunFromBattle(u8 battler)
if (InBattlePyramid())
{
gBattleStruct->runTries++;
- pyramidMultiplier = sub_81A9E28();
+ pyramidMultiplier = GetPyramidRunMultiplier();
speedVar = (gBattleMons[battler].speed * pyramidMultiplier) / (gBattleMons[BATTLE_OPPOSITE(battler)].speed) + (gBattleStruct->runTries * 30);
if (speedVar > (Random() & 0xFF))
{
@@ -5630,7 +5629,7 @@ bool8 TryRunFromBattle(u8 battler)
{
if (InBattlePyramid())
{
- pyramidMultiplier = sub_81A9E28();
+ pyramidMultiplier = GetPyramidRunMultiplier();
speedVar = (gBattleMons[battler].speed * pyramidMultiplier) / (gBattleMons[BATTLE_OPPOSITE(battler)].speed) + (gBattleStruct->runTries * 30);
if (speedVar > (Random() & 0xFF))
effect++;
@@ -5784,7 +5783,7 @@ static void HandleAction_GoNear(void)
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
}
-static void HandleAction_SafriZoneRun(void)
+static void HandleAction_SafariZoneRun(void)
{
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
PlaySE(SE_NIGERU);
diff --git a/src/battle_message.c b/src/battle_message.c
index 44ea5d7d7..47c4cbe1d 100644
--- a/src/battle_message.c
+++ b/src/battle_message.c
@@ -1,25 +1,25 @@
#include "global.h"
#include "battle.h"
+#include "battle_controllers.h"
#include "battle_message.h"
-#include "constants/battle_string_ids.h"
-#include "constants/moves.h"
-#include "text.h"
-#include "string_util.h"
-#include "constants/items.h"
-#include "constants/trainers.h"
+#include "battle_setup.h"
+#include "battle_tower.h"
+#include "data2.h"
#include "event_data.h"
-#include "link.h"
+#include "frontier_util.h"
+#include "international_string_util.h"
#include "item.h"
-#include "window.h"
-#include "palette.h"
-#include "battle_controllers.h"
-#include "battle_setup.h"
+#include "link.h"
#include "menu.h"
+#include "palette.h"
#include "recorded_battle.h"
-#include "international_string_util.h"
-#include "frontier_util.h"
-#include "battle_tower.h"
-#include "data2.h"
+#include "string_util.h"
+#include "text.h"
+#include "window.h"
+#include "constants/battle_string_ids.h"
+#include "constants/items.h"
+#include "constants/moves.h"
+#include "constants/trainers.h"
struct BattleWindowText
{
@@ -1367,7 +1367,8 @@ static const u8 sDummyWeirdStatusString[] = {EOS, EOS, EOS, EOS, EOS, EOS, EOS,
static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
{
- { // 0
+// The corresponding WindowTemplate is gStandardBattleWindowTemplates[] within src/battle_bg.c
+ { // 0 Standard battle message
.fillValue = 0xFF,
.fontId = 1,
.x = 0,
@@ -1379,7 +1380,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.bgColor = 15,
.shadowColor = 6,
},
- { // 1
+ { // 1 "What will (pokemon) do?"
.fillValue = 0xFF,
.fontId = 1,
.x = 1,
@@ -1391,7 +1392,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.bgColor = 15,
.shadowColor = 6,
},
- { // 2
+ { // 2 "Fight/Pokemon/Bag/Run"
.fillValue = 0xEE,
.fontId = 1,
.x = 0,
@@ -1403,7 +1404,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.bgColor = 14,
.shadowColor = 15,
},
- { // 3
+ { // 3 Top left move
.fillValue = 0xEE,
.fontId = 7,
.x = 0,
@@ -1415,7 +1416,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.bgColor = 14,
.shadowColor = 15,
},
- { // 4
+ { // 4 Top right move
.fillValue = 0xEE,
.fontId = 7,
.x = 0,
@@ -1427,7 +1428,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.bgColor = 14,
.shadowColor = 15,
},
- { // 5
+ { // 5 Bottom left move
.fillValue = 0xEE,
.fontId = 7,
.x = 0,
@@ -1439,7 +1440,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.bgColor = 14,
.shadowColor = 15,
},
- { // 6
+ { // 6 Bottom right move
.fillValue = 0xEE,
.fontId = 7,
.x = 0,
@@ -1451,7 +1452,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.bgColor = 14,
.shadowColor = 15,
},
- { // 7
+ { // 7 "PP"
.fillValue = 0xEE,
.fontId = 7,
.x = 0,
@@ -1475,7 +1476,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.bgColor = 14,
.shadowColor = 15,
},
- { // 9
+ { // 9 PP remaining
.fillValue = 0xEE,
.fontId = 1,
.x = 2,
@@ -1487,7 +1488,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.bgColor = 14,
.shadowColor = 11,
},
- { // 10
+ { // 10 "type"
.fillValue = 0xEE,
.fontId = 7,
.x = 0,
@@ -1499,7 +1500,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.bgColor = 14,
.shadowColor = 15,
},
- { // 11
+ { // 11 "switch which?"
.fillValue = 0xEE,
.fontId = 7,
.x = 0,
@@ -1511,7 +1512,7 @@ static const struct BattleWindowText sTextOnWindowsInfo_Normal[] =
.bgColor = 14,
.shadowColor = 15,
},
- { // 12
+ { // 12 "gText_BattleYesNoChoice"
.fillValue = 0xEE,
.fontId = 1,
.x = 0,
diff --git a/src/battle_palace.c b/src/battle_palace.c
index d435f7e15..4033712b6 100644
--- a/src/battle_palace.c
+++ b/src/battle_palace.c
@@ -6,6 +6,7 @@
#include "battle_tower.h"
#include "frontier_util.h"
#include "item.h"
+#include "string_util.h"
#include "constants/items.h"
// This file's functions.
diff --git a/src/battle_pyramid.c b/src/battle_pyramid.c
new file mode 100644
index 000000000..4bbc74dee
--- /dev/null
+++ b/src/battle_pyramid.c
@@ -0,0 +1,1298 @@
+#include "global.h"
+#include "battle_pyramid.h"
+#include "battle_pyramid_bag.h"
+#include "event_data.h"
+#include "battle.h"
+#include "battle_setup.h"
+#include "battle_tower.h"
+#include "save.h"
+#include "fieldmap.h"
+#include "palette.h"
+#include "field_message_box.h"
+#include "random.h"
+#include "item.h"
+#include "util.h"
+#include "sound.h"
+#include "task.h"
+#include "start_menu.h"
+#include "string_util.h"
+#include "trainer_see.h"
+#include "main.h"
+#include "load_save.h"
+#include "script.h"
+#include "malloc.h"
+#include "overworld.h"
+#include "constants/battle_frontier.h"
+#include "constants/event_objects.h"
+#include "constants/event_object_movement_constants.h"
+#include "constants/items.h"
+#include "constants/maps.h"
+#include "constants/moves.h"
+
+extern u8 gSelectedOrderFromParty[3];
+extern void door_upload_tiles(void);
+
+extern const struct MapLayout *const gMapLayouts[];
+
+#define TOTAL_ROUNDS 20
+#define PICKUP_ITEMS_PER_ROUND 10
+
+struct Struct_08613650
+{
+ u8 unk0;
+ u8 unk1;
+ u8 unk2;
+ u8 unk3;
+ u8 runMultiplier;
+ u8 unk5[8];
+};
+
+struct PyramidWildMon
+{
+ u16 species;
+ u8 lvl;
+ u8 abilityBit;
+ u16 moves[4];
+};
+
+struct ClassMusic
+{
+ u8 class;
+ u8 music;
+};
+
+extern const u16 gBattleFrontierHeldItems[];
+extern const struct FacilityMon gBattleFrontierMons[];
+extern const struct BattleFrontierTrainer gBattleFrontierTrainers[];
+
+extern const u8 BattleFrontier_BattlePyramidEmptySquare_EventScript_252C88[];
+extern const u8 BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F[];
+extern const u8 BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A[];
+
+// This file's functions.
+static void sub_81A8E9C(void);
+static void sub_81A8F38(void);
+static void sub_81A9048(void);
+static void sub_81A9134(void);
+static void sub_81A917C(void);
+static void sub_81A91FC(void);
+static void sub_81A9254(void);
+static void sub_81A9290(void);
+static void sub_81A93C8(void);
+static void sub_81A9414(void);
+static void sub_81A9424(void);
+static void sub_81A9618(void);
+static void sub_81A966C(void);
+static void sub_81A9684(void);
+static void sub_81A975C(void);
+static void sub_81A97C8(void);
+static void sub_81A9828(void);
+static void sub_81A9834(void);
+static void InitBagItems(u8 lvlMode);
+static u8 sub_81AA9E4(void);
+static u8 sub_81A9998(s32 *, u8, u8);
+static void sub_81A97DC(u8 taskId);
+static void sub_81A9B44(u16 trainerId);
+static void sub_81AA96C(u8 *mapNums);
+static void sub_81AA33C(u8 *, u8 *);
+static void sub_81AA398(u8);
+static bool8 sub_81AA4D8(u8, u8);
+static bool8 sub_81AA648(u8, u8);
+static bool8 sub_81AA760(u8 arg0, u8 *mapNums, u8 whichMap, u8 id);
+static bool8 sub_81AA810(u8 arg0, u8 x, u8 y, u8 *mapNums, u8 whichMap, u8 id);
+
+// Const rom data.
+extern const struct Struct_08613650 gUnknown_08613650[];
+extern const u16 sPickupItemsLvl50[TOTAL_ROUNDS][PICKUP_ITEMS_PER_ROUND];
+extern const u16 sPickupItemsLvlOpen[TOTAL_ROUNDS][PICKUP_ITEMS_PER_ROUND];
+extern const u8 gUnknown_08613ABC[63][2];
+extern const u8 gUnknown_08613B3A[];
+extern const u16 gUnknown_08D856C8[][16];
+extern const u8 gUnknown_08613C1C[50][2];
+extern const u8 *const *const *const gUnknown_08613EC0[];
+extern const struct ClassMusic gUnknown_08613B44[54];
+extern const struct PyramidWildMon *const gBattlePyramidOpenLevelWildMonPointers[];
+extern const struct PyramidWildMon *const gBattlePyramidLevel50WildMonPointers[];
+extern const u8 gUnknown_08613794[];
+extern const u8 gUnknown_08613750[34][2];
+
+static const u8 gUnknown_08613ED8[] = {3, 4, 5, 6, 7, 8, 3, 4};
+
+static void (* const sBattlePyramidFunctions[])(void) =
+{
+ sub_81A8E9C,
+ sub_81A8F38,
+ sub_81A9048,
+ sub_81A9134,
+ sub_81A917C,
+ sub_81A91FC,
+ sub_81A9254,
+ sub_81A9290,
+ sub_81A93C8,
+ sub_81A9414,
+ sub_81A9424,
+ sub_81A9618,
+ sub_81A966C,
+ sub_81A9684,
+ sub_81A975C,
+ sub_81A97C8,
+ sub_81A9828,
+ sub_81A9834,
+};
+
+static const u16 gUnknown_08613F28[] = {ITEM_HP_UP, ITEM_PROTEIN, ITEM_IRON, ITEM_CALCIUM, ITEM_CARBOS, ITEM_ZINC};
+static const u16 gUnknown_08613F34[] = {ITEM_BRIGHT_POWDER, ITEM_WHITE_HERB, ITEM_QUICK_CLAW, ITEM_LEFTOVERS, ITEM_MENTAL_HERB, ITEM_KINGS_ROCK, ITEM_FOCUS_BAND, ITEM_SCOPE_LENS, ITEM_CHOICE_BAND};
+
+static const u8 gUnknown_08613F46[][4] =
+{
+ {0x01, 0x04, 0xff, 0xff},
+ {0x00, 0x02, 0x05, 0xff},
+ {0x01, 0x03, 0x06, 0xff},
+ {0x02, 0x07, 0xff, 0xff},
+ {0x00, 0x05, 0x08, 0xff},
+ {0x01, 0x04, 0x06, 0x09},
+ {0x02, 0x05, 0x07, 0x0a},
+ {0x03, 0x06, 0x0b, 0xff},
+ {0x04, 0x09, 0x0c, 0xff},
+ {0x05, 0x08, 0x0a, 0x0d},
+ {0x06, 0x09, 0x0b, 0x0e},
+ {0x07, 0x0a, 0x0f, 0xff},
+ {0x08, 0x0d, 0xff, 0xff},
+ {0x09, 0x0c, 0x0e, 0xff},
+ {0x0a, 0x0d, 0x0f, 0xff},
+ {0x0b, 0x0e, 0xff, 0xff},
+};
+
+static const u8 sPickupPercentages[PICKUP_ITEMS_PER_ROUND] = {30, 40, 50, 60, 70, 80, 85, 90, 95, 100};
+
+// code
+void CallBattlePyramidFunction(void)
+{
+ sBattlePyramidFunctions[gSpecialVar_0x8004]();
+}
+
+static void sub_81A8E9C(void)
+{
+ bool32 isCurrent;
+ u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
+
+ gSaveBlock2Ptr->frontier.field_CA8 = 0;
+ gSaveBlock2Ptr->frontier.curChallengeBattleNum = 0;
+ gSaveBlock2Ptr->frontier.field_CA9_a = 0;
+ if (lvlMode != FRONTIER_LVL_50)
+ isCurrent = gSaveBlock2Ptr->frontier.field_CDC & 0x2000;
+ else
+ isCurrent = gSaveBlock2Ptr->frontier.field_CDC & 0x1000;
+
+ if (!isCurrent)
+ {
+ gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] = 0;
+ InitBagItems(lvlMode);
+ }
+
+ sub_81C4EEC();
+ gTrainerBattleOpponent_A = 0;
+ gBattleOutcome = 0;
+}
+
+static void sub_81A8F38(void)
+{
+ u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
+
+ switch (gSpecialVar_0x8005)
+ {
+ case 0:
+ gSpecialVar_Result = gSaveBlock2Ptr->frontier.field_E18;
+ break;
+ case 1:
+ gSpecialVar_Result = gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode];
+ break;
+ case 2:
+ if (lvlMode != FRONTIER_LVL_50)
+ gSpecialVar_Result = gSaveBlock2Ptr->frontier.field_CDC & 0x2000;
+ else
+ gSpecialVar_Result = gSaveBlock2Ptr->frontier.field_CDC & 0x1000;
+ break;
+ case 3:
+ gSpecialVar_Result = gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_50];
+ break;
+ case 4:
+ gSpecialVar_Result = gSaveBlock2Ptr->frontier.pyramidWinStreaks[FRONTIER_LVL_OPEN];
+ break;
+ case 5:
+ gSpecialVar_Result = gSaveBlock2Ptr->frontier.field_CDC & 0x1000;
+ break;
+ case 6:
+ gSpecialVar_Result = gSaveBlock2Ptr->frontier.field_CDC & 0x2000;
+ break;
+ }
+}
+
+static void sub_81A9048(void)
+{
+ u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
+
+ switch (gSpecialVar_0x8005)
+ {
+ case 0:
+ gSaveBlock2Ptr->frontier.field_E18 = gSpecialVar_0x8006;
+ break;
+ case 1:
+ gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] = gSpecialVar_0x8006;
+ break;
+ case 2:
+ if (lvlMode != FRONTIER_LVL_50)
+ {
+ if (gSpecialVar_0x8006)
+ gSaveBlock2Ptr->frontier.field_CDC |= 0x2000;
+ else
+ gSaveBlock2Ptr->frontier.field_CDC &= ~(0x2000);
+ }
+ else
+ {
+ if (gSpecialVar_0x8006)
+ gSaveBlock2Ptr->frontier.field_CDC |= 0x1000;
+ else
+ gSaveBlock2Ptr->frontier.field_CDC &= ~(0x1000);
+ }
+ break;
+ case 7:
+ gSaveBlock2Ptr->frontier.field_E2A = gSpecialVar_0x8006;
+ break;
+ }
+}
+
+static void sub_81A9134(void)
+{
+ gSaveBlock2Ptr->frontier.field_CA8 = gSpecialVar_0x8005;
+ VarSet(VAR_TEMP_0, 0);
+ gSaveBlock2Ptr->frontier.field_CA9_a = 1;
+ save_serialize_map();
+ TrySavingData(SAVE_LINK);
+}
+
+static void sub_81A917C(void)
+{
+ u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
+
+ if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] > 41)
+ gSaveBlock2Ptr->frontier.field_E18 = gUnknown_08613F34[Random() % ARRAY_COUNT(gUnknown_08613F34)];
+ else
+ gSaveBlock2Ptr->frontier.field_E18 = gUnknown_08613F28[Random() % ARRAY_COUNT(gUnknown_08613F28)];
+}
+
+static void sub_81A91FC(void)
+{
+ if (AddBagItem(gSaveBlock2Ptr->frontier.field_E18, 1) == TRUE)
+ {
+ CopyItemName(gSaveBlock2Ptr->frontier.field_E18, gStringVar1);
+ gSaveBlock2Ptr->frontier.field_E18 = 0;
+ gSpecialVar_Result = TRUE;
+ }
+ else
+ {
+ gSpecialVar_Result = FALSE;
+ }
+}
+
+static void sub_81A9254(void)
+{
+ s32 i;
+
+ for (i = 0; i < 4; i++)
+ gSaveBlock2Ptr->frontier.field_E22[i] = Random();
+
+ gSaveBlock2Ptr->frontier.field_E2A = 0;
+}
+
+static void sub_81A9290(void)
+{
+ s32 i;
+ s32 r7;
+ s32 rand;
+ u8 id;
+ u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
+ u32 floor = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
+ u32 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / 7) % TOTAL_ROUNDS;
+
+ if (round >= TOTAL_ROUNDS)
+ round = TOTAL_ROUNDS - 1;
+
+ id = sub_81AA9E4();
+ r7 = (gSpecialVar_LastTalked - gUnknown_08613650[id].unk1) - 1;
+ rand = gSaveBlock2Ptr->frontier.field_E22[r7 / 2];
+ SeedRng2(rand);
+
+ for (i = 0; i < r7 + 1; i++)
+ rand = Random2() % 100;
+
+ for (i = gUnknown_08613B3A[floor]; i < ARRAY_COUNT(gUnknown_08613ABC); i++)
+ {
+ if (rand < gUnknown_08613ABC[i][0])
+ break;
+ }
+
+ if (lvlMode != FRONTIER_LVL_50)
+ gSpecialVar_0x8000 = sPickupItemsLvlOpen[round][gUnknown_08613ABC[i][1]];
+ else
+ gSpecialVar_0x8000 = sPickupItemsLvl50[round][gUnknown_08613ABC[i][1]];
+
+ gSpecialVar_0x8001 = 1;
+}
+
+static void sub_81A93C8(void)
+{
+ struct EventObjectTemplate *events = gSaveBlock1Ptr->eventObjectTemplates;
+ s32 i = 0;
+
+ for (;;)
+ {
+ if (events[i].localId == gSpecialVar_LastTalked)
+ {
+ events[i].x = 0x7FFF;
+ events[i].y = 0x7FFF;
+ break;
+ }
+ i++;
+ if (events[i].localId == 0)
+ break;
+ }
+}
+
+static void sub_81A9414(void)
+{
+ gFacilityTrainers = gBattleFrontierTrainers;
+}
+
+static void sub_81A9424(void)
+{
+ s32 i;
+ s32 var_24;
+ u8 id;
+ s32 class = 0;
+ s32 r7 = 0;
+ struct EventObjectTemplate *events = gSaveBlock1Ptr->eventObjectTemplates;
+ u16 trainerId = LocalIdToPyramidTrainerId(gEventObjects[gSelectedEventObject].localId);
+
+ for (i = 0; i < ARRAY_COUNT(gUnknown_08613C1C); i++)
+ {
+ if (gUnknown_08613C1C[i][0] == gFacilityTrainers[trainerId].facilityClass)
+ {
+ class = gUnknown_08613C1C[i][1];
+ break;
+ }
+ }
+
+ var_24 = gUnknown_08613ED8[gEventObjects[gSelectedEventObject].localId - 1];
+ i = 0;
+ while (!i)
+ {
+ switch (var_24)
+ {
+ case 0:
+ r7 = sub_81A9998(&var_24, 8, 0);
+ i = 1;
+ break;
+ case 1:
+ for (i = 0; i < sub_81AAA40(); i++)
+ {
+ if (events[i].graphicsId == EVENT_OBJ_GFX_ITEM_BALL && events[i].x != 0x7FFF && events[i].y != 0x7FFF)
+ r7++;
+ }
+ i = 1;
+ break;
+ case 2:
+ id = sub_81AA9E4();
+ r7 = gUnknown_08613650[id].unk1;
+ for (i = 0; i < 8; i++)
+ {
+ if (gBitTable[i] & gSaveBlock2Ptr->frontier.field_E2A)
+ r7--;
+ }
+ i = 1;
+ break;
+ case 3:
+ sub_81A9998(&var_24, 8, 2);
+ break;
+ case 4:
+ sub_81A9998(&var_24, 8, 1);
+ break;
+ case 5:
+ sub_81A9998(&var_24, 16, 2);
+ break;
+ case 6:
+ sub_81A9998(&var_24, 16, 1);
+ break;
+ case 7:
+ sub_81A9998(&var_24, 24, 2);
+ break;
+ case 8:
+ sub_81A9998(&var_24, 24, 1);
+ break;
+ }
+ }
+ ShowFieldMessage(gUnknown_08613EC0[class][var_24][r7]);
+}
+
+static void sub_81A9618(void)
+{
+ u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
+
+ if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] < 999)
+ gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode]++;
+ if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] > gSaveBlock2Ptr->frontier.pyramidRecordStreaks[lvlMode])
+ gSaveBlock2Ptr->frontier.pyramidRecordStreaks[lvlMode] = gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode];
+}
+
+static void sub_81A966C(void)
+{
+ gSpecialVar_Result = InBattlePyramid();
+}
+
+static void sub_81A9684(void)
+{
+ switch (gSpecialVar_0x8006)
+ {
+ case 0:
+ gSaveBlock2Ptr->frontier.field_E68 = gSpecialVar_0x8005;
+ break;
+ case 1:
+ switch (gSpecialVar_Result)
+ {
+ case 0:
+ if (!gPaletteFade.active)
+ {
+ if (gSaveBlock2Ptr->frontier.field_E68 >= 120)
+ gSaveBlock2Ptr->frontier.field_E68 = 120;
+ else
+ PlaySE(gSpecialVar_0x8007);
+ gSpecialVar_Result++;
+ }
+ break;
+ case 1:
+ if (gSpecialVar_0x8005 != 0)
+ {
+ gSpecialVar_0x8005--;
+ gSaveBlock2Ptr->frontier.field_E68++;
+ if (gSaveBlock2Ptr->frontier.field_E68 > 120)
+ {
+ gSaveBlock2Ptr->frontier.field_E68 = 120;
+ gSpecialVar_Result++;
+ }
+ door_upload_tiles();
+ }
+ else
+ {
+ gSpecialVar_Result = 2;
+ }
+ break;
+ case 2:
+ default:
+ break;
+ }
+ break;
+ }
+}
+
+static void sub_81A975C(void)
+{
+ s32 i, j;
+ u16 item = 0;
+
+ for (i = 0; i < PARTY_SIZE; i++)
+ {
+ for (j = 0; j < 4; j++)
+ {
+ if (gSaveBlock2Ptr->frontier.selectedPartyMons[j] != 0 && gSaveBlock2Ptr->frontier.selectedPartyMons[j] - 1 == i)
+ SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &item);
+ }
+ }
+}
+
+static void sub_81A97C8(void)
+{
+ CreateTask(sub_81A97DC, 0);
+}
+
+static void sub_81A97DC(u8 taskId)
+{
+ if (gPaletteFade.active)
+ {
+ CpuCopy16(gUnknown_08D856C8[gSaveBlock2Ptr->frontier.curChallengeBattleNum], &gPlttBufferUnfaded[96], 32);
+ DestroyTask(taskId);
+ }
+}
+
+static void sub_81A9828(void)
+{
+ sub_809FDD4();
+}
+
+static void sub_81A9834(void)
+{
+ s32 i, j, k, l;
+
+ for (i = 0; i < 3; i++)
+ {
+ s32 id = gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1;
+ for (j = 0; j < 3; j++)
+ {
+ if (GetMonData(&gSaveBlock1Ptr->playerParty[id], MON_DATA_SPECIES, NULL) == GetMonData(&gPlayerParty[j], MON_DATA_SPECIES, NULL))
+ {
+ for (k = 0; k < 4; k++)
+ {
+ for (l = 0; l < 4; l++)
+ {
+ if (GetMonData(&gSaveBlock1Ptr->playerParty[id], MON_DATA_MOVE1 + l, NULL) == GetMonData(&gPlayerParty[j], MON_DATA_MOVE1 + k, NULL))
+ break;
+ }
+ if (l == 4)
+ SetMonMoveSlot(&gPlayerParty[j], MOVE_SKETCH, k);
+ }
+ gSaveBlock1Ptr->playerParty[id] = gPlayerParty[j];
+ gSelectedOrderFromParty[j] = id + 1;
+ break;
+ }
+ }
+ }
+
+ for (i = 0; i < 3; i++)
+ gSaveBlock2Ptr->frontier.selectedPartyMons[i] = gSelectedOrderFromParty[i];
+}
+
+static u8 sub_81A9998(s32 *arg0, u8 arg1, u8 arg2)
+{
+ s32 i, j;
+ u8 ret = 0;
+ u16 *map = gUnknown_03005DC0.map;
+ map += gUnknown_03005DC0.width * 7 + 7;
+
+ for (i = 0; i < 32; map += 47, i++)
+ {
+ for (j = 0; j < 32; j++)
+ {
+ if ((map[j] & 0x3FF) == 0x28E)
+ {
+ j += 7 - gEventObjects[gSelectedEventObject].initialCoords.x;
+ i += 7 - gEventObjects[gSelectedEventObject].initialCoords.y;
+ if (j >= arg1 || j <= -arg1 || i >= arg1 || i <= -arg1 || arg2 == 0)
+ {
+ if (j > 0 && i > 0)
+ {
+ if (j >= i)
+ ret = 2;
+ else
+ ret = 3;
+ }
+ else if (j < 0 && i < 0)
+ {
+ if (j > i)
+ ret = 0;
+ else
+ ret = 1;
+ }
+ else if (j == 0)
+ {
+ if (i > 0)
+ ret = 3;
+ else
+ ret = 0;
+ }
+ else if (i == 0)
+ {
+ if (j > 0)
+ ret = 2;
+ else
+ ret = 1;
+ }
+ else if (j < 0)
+ {
+ if (j + i > 0)
+ ret = 3;
+ else
+ ret = 1;
+ }
+ else
+ {
+ ret = (~(j + i) >= 0) ? 0 : 2;
+ }
+ *arg0 = 0;
+ }
+ else
+ {
+ *arg0 = arg2;
+ }
+ return ret;
+ }
+ }
+ }
+
+ return ret;
+}
+
+u16 LocalIdToPyramidTrainerId(u8 localId)
+{
+ return gSaveBlock2Ptr->frontier.field_CB4[localId - 1];
+}
+
+bool8 GetBattlePyramidTrainerFlag(u8 eventId)
+{
+ return gSaveBlock2Ptr->frontier.field_E2A & gBitTable[gEventObjects[eventId].localId - 1];
+}
+
+void sub_81A9B04(void)
+{
+ sub_81A9B44(gTrainerBattleOpponent_A);
+ if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)
+ {
+ gSelectedEventObject = GetChosenApproachingTrainerEventObjectId(1);
+ sub_81A9B44(gTrainerBattleOpponent_B);
+ }
+}
+
+static void sub_81A9B44(u16 trainerId)
+{
+ s32 i;
+
+ for (i = 0; i < 8; i++)
+ {
+ if (gSaveBlock2Ptr->frontier.field_CB4[i] == trainerId)
+ gSaveBlock2Ptr->frontier.field_E2A |= gBitTable[i];
+ }
+
+ gEventObjects[gSelectedEventObject].movementType = MOVEMENT_TYPE_WANDER_AROUND;
+ gSaveBlock1Ptr->eventObjectTemplates[gSpecialVar_LastTalked - 1].movementType = MOVEMENT_TYPE_WANDER_AROUND;
+ gEventObjects[gSelectedEventObject].initialCoords.x = gEventObjects[gSelectedEventObject].currentCoords.x;
+ gEventObjects[gSelectedEventObject].initialCoords.y = gEventObjects[gSelectedEventObject].currentCoords.y;
+}
+
+void GenerateBattlePyramidWildMon(void)
+{
+ u8 name[POKEMON_NAME_LENGTH + 1];
+ s32 i;
+ const struct PyramidWildMon *wildMons;
+ u32 id;
+ u32 lvl = gSaveBlock2Ptr->frontier.lvlMode;
+ u16 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvl] / 7) % TOTAL_ROUNDS;
+
+ if (round >= TOTAL_ROUNDS)
+ round = TOTAL_ROUNDS - 1;
+
+ if (lvl != FRONTIER_LVL_50)
+ wildMons = gBattlePyramidOpenLevelWildMonPointers[round];
+ else
+ wildMons = gBattlePyramidLevel50WildMonPointers[round];
+
+ id = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, NULL) - 1;
+ SetMonData(&gEnemyParty[0], MON_DATA_SPECIES, &wildMons[id].species);
+ GetSpeciesName(name, wildMons[id].species);
+ SetMonData(&gEnemyParty[0], MON_DATA_NICKNAME, &name);
+ if (lvl != FRONTIER_LVL_50)
+ {
+ lvl = SetFacilityPtrsGetLevel();
+ lvl -= wildMons[id].lvl;
+ lvl = lvl - 5 + (Random() % 11);
+ }
+ else
+ {
+ lvl = wildMons[id].lvl - 5 + ((Random() % 11));
+ }
+ SetMonData(&gEnemyParty[0],
+ MON_DATA_EXP,
+ &gExperienceTables[gBaseStats[wildMons[id].species].growthRate][lvl]);
+
+ switch (wildMons[id].abilityBit)
+ {
+ case 0:
+ case 1:
+ SetMonData(&gEnemyParty[0], MON_DATA_ALT_ABILITY, &wildMons[id].abilityBit);
+ break;
+ case 2:
+ default:
+ if (gBaseStats[wildMons[id].species].ability2)
+ {
+ i = GetMonData(&gEnemyParty[0], MON_DATA_PERSONALITY, NULL) % 2;
+ SetMonData(&gEnemyParty[0], MON_DATA_ALT_ABILITY, &i);
+ }
+ else
+ {
+ i = 0;
+ SetMonData(&gEnemyParty[0], MON_DATA_ALT_ABILITY, &i);
+ }
+ break;
+ }
+
+ for (i = 0; i < 4; i++)
+ SetMonMoveSlot(&gEnemyParty[0], wildMons[id].moves[i], i);
+
+ if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvl] >= 140) // BUG: Reading outside the array as lvl was used for mon level instead of frontier lvl mode.
+ {
+ id = (Random() % 17) + 15;
+ for (i = 0; i < NUM_STATS; i++)
+ SetMonData(&gEnemyParty[0], MON_DATA_HP_IV + i, &id);
+ }
+ CalculateMonStats(&gEnemyParty[0]);
+}
+
+u8 GetPyramidRunMultiplier(void)
+{
+ u8 id = sub_81AA9E4();
+ return gUnknown_08613650[id].runMultiplier;
+}
+
+u8 InBattlePyramid(void)
+{
+ if (gMapHeader.mapLayoutId == 361)
+ return 1;
+ else if (gMapHeader.mapLayoutId == 378)
+ return 2;
+ else
+ return FALSE;
+}
+
+bool8 InBattlePyramid_(void)
+{
+ return (gMapHeader.mapLayoutId == 361 || gMapHeader.mapLayoutId == 378);
+}
+
+void sub_81A9E90(void)
+{
+ if (InBattlePyramid())
+ {
+ sub_81A9834();
+ gSaveBlock2Ptr->frontier.field_CA8 = 2;
+ VarSet(VAR_TEMP_E, 0);
+ LoadPlayerParty();
+ }
+}
+
+void sub_81A9EC8(void)
+{
+ if (InBattlePyramid())
+ DoSoftReset();
+}
+
+void CopyPyramidTrainerSpeechBefore(u16 trainerId)
+{
+ FrontierSpeechToString(gFacilityTrainers[trainerId].speechBefore);
+}
+
+void CopyPyramidTrainerWinSpeech(u16 trainerId)
+{
+ FrontierSpeechToString(gFacilityTrainers[trainerId].speechWin);
+}
+
+void CopyPyramidTrainerLoseSpeech(u16 trainerId)
+{
+ FrontierSpeechToString(gFacilityTrainers[trainerId].speechLose);
+}
+
+u8 GetTrainerEncounterMusicIdInBattlePyramind(u16 trainerId)
+{
+ s32 i;
+
+ for (i = 0; i < ARRAY_COUNT(gUnknown_08613B44); i++)
+ {
+ if (gUnknown_08613B44[i].class == gFacilityClassToTrainerClass[gFacilityTrainers[trainerId].facilityClass])
+ return gUnknown_08613B44[i].music;
+ }
+ return 0;
+}
+
+static void sub_81A9F80(void)
+{
+ ScriptContext1_SetupScript(BattleFrontier_BattlePyramidEmptySquare_EventScript_252C88);
+}
+
+static u16 sub_81A9F90(u8 count)
+{
+ s32 i;
+ u16 trainerId;
+ u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
+ u32 challengeNum = gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / 7;
+ u32 battleNum = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
+ if (battleNum == 7)
+ {
+ do
+ {
+ trainerId = sub_8162548(challengeNum + 1, battleNum);
+ for (i = 0 ; i < count; i++)
+ {
+ if (gSaveBlock2Ptr->frontier.field_CB4[i] == trainerId)
+ break;
+ }
+ } while (i != count);
+ }
+ else
+ {
+ do
+ {
+ trainerId = sub_8162548(challengeNum, battleNum);
+ for (i = 0 ; i < count; i++)
+ {
+ if (gSaveBlock2Ptr->frontier.field_CB4[i] == trainerId)
+ break;
+ }
+ } while (i != count);
+ }
+
+ return trainerId;
+}
+
+void sub_81AA078(u16 *mapArg, u8 arg1)
+{
+ s32 j, k;
+ s32 i;
+ u8 var0, var1;
+ u8 *allocated = AllocZeroed(0x10);
+
+ sub_81AA96C(allocated);
+ sub_81AA33C(&var0, &var1);
+ for (i = 0; i < 16; i++)
+ {
+ u16 *map;
+ s32 heightAdd, widthAdd;
+ const struct MapLayout *mapLayout = gMapLayouts[allocated[i] + 0x169];
+ const u16 *layoutMap = mapLayout->map;
+
+ gUnknown_03005DC0.map = mapArg;
+ gUnknown_03005DC0.width = mapLayout->width * 4 + 15;
+ gUnknown_03005DC0.height = mapLayout->height * 4 + 14;
+ map = mapArg;
+ heightAdd = (((i / 4 * mapLayout->height) + 7) * (gUnknown_03005DC0.width));
+ widthAdd = ((i % 4 * mapLayout->width) + 7);
+ map += heightAdd + widthAdd;
+ for (j = 0; j < mapLayout->height; j++)
+ {
+ for (k = 0; k < mapLayout->width; k++)
+ {
+ if ((layoutMap[k] & 0x3FF) != 0x28E)
+ {
+ map[k] = layoutMap[k];
+ }
+ else if (i != var1)
+ {
+ if (i == var0 && arg1 == 0)
+ {
+ gSaveBlock1Ptr->pos.x = (mapLayout->width * (i % 4)) + k;
+ gSaveBlock1Ptr->pos.y = (mapLayout->height * (i / 4)) + j;
+ }
+ map[k] = (layoutMap[k] & 0xFC00) | 0x28D;
+ }
+ else
+ {
+ map[k] = layoutMap[k];
+ }
+ }
+ map += 15 + (mapLayout->width * 4);
+ layoutMap += mapLayout->width;
+ }
+ }
+ mapheader_run_script_with_tag_x1();
+ free(allocated);
+}
+
+void sub_81AA1D8(void)
+{
+ s32 i;
+ u8 id;
+ u8 var0, var1;
+
+ for (i = 0; i < 8; i++)
+ gSaveBlock2Ptr->frontier.field_CB4[i] |= 0xFFFF;
+
+ id = sub_81AA9E4();
+ sub_81AA33C(&var0, &var1);
+ CpuFill32(0, gSaveBlock1Ptr->eventObjectTemplates, sizeof(gSaveBlock1Ptr->eventObjectTemplates));
+ for (i = 0; i < 2; i++)
+ {
+ u8 value;
+
+ if (i == 0)
+ value = gUnknown_08613650[id].unk3;
+ else
+ value = gUnknown_08613650[id].unk2;
+
+ switch (value)
+ {
+ case 0:
+ sub_81AA398(i);
+ break;
+ case 1:
+ if (sub_81AA4D8(i, var0))
+ sub_81AA398(i);
+ break;
+ case 2:
+ if (sub_81AA4D8(i, var1))
+ sub_81AA398(i);
+ break;
+ case 3:
+ if (sub_81AA648(i, var0))
+ sub_81AA398(i);
+ break;
+ case 4:
+ if (sub_81AA648(i, var1))
+ sub_81AA398(i);
+ break;
+ }
+ }
+}
+
+void sub_81AA2F8(void)
+{
+ s32 i;
+ struct EventObjectTemplate *events = gSaveBlock1Ptr->eventObjectTemplates;
+
+ for (i = 0; i < EVENT_OBJECT_TEMPLATES_COUNT; i++)
+ {
+ if (events[i].graphicsId != EVENT_OBJ_GFX_ITEM_BALL)
+ events[i].script = BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F;
+ else
+ events[i].script = BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A;
+ }
+}
+
+static void sub_81AA33C(u8 *var0, u8 *var1)
+{
+ *var0 = gSaveBlock2Ptr->frontier.field_E22[3] % 16;
+ *var1 = gSaveBlock2Ptr->frontier.field_E22[0] % 16;
+
+ if (*var0 == *var1)
+ {
+ *var0 = (gSaveBlock2Ptr->frontier.field_E22[3] + 1 ) % 16;
+ *var1 = (gSaveBlock2Ptr->frontier.field_E22[0] + 15) % 16;
+ }
+}
+
+static void sub_81AA398(u8 arg0)
+{
+ s32 i;
+ s32 count;
+ s32 var_28;
+ s32 r4;
+ u32 bits = 0;
+ u8 id = sub_81AA9E4();
+ u8 *allocated = AllocZeroed(0x10);
+
+ sub_81AA96C(allocated);
+ r4 = gSaveBlock2Ptr->frontier.field_E22[2] % 16;
+ if (arg0 == 0)
+ {
+ count = gUnknown_08613650[id].unk1;
+ var_28 = 0;
+ }
+ else
+ {
+ count = gUnknown_08613650[id].unk0;
+ var_28 = gUnknown_08613650[id].unk1;
+ }
+
+ for (i = 0; i < count; i++)
+ {
+ do
+ {
+ do
+ {
+ if (bits & 1)
+ {
+ if (!(gBitTable[r4] & gSaveBlock2Ptr->frontier.field_E22[3]))
+ bits |= 2;
+ }
+ else
+ {
+ if (gBitTable[r4] & gSaveBlock2Ptr->frontier.field_E22[3])
+ bits |= 2;
+ }
+ if (++r4 >= 16)
+ r4 = 0;
+
+ if (r4 == gSaveBlock2Ptr->frontier.field_E22[2] % 16)
+ {
+ if (bits & 1)
+ bits |= 6;
+ else
+ bits |= 1;
+ }
+ } while (!(bits & 2));
+
+ } while (!(bits & 4) && sub_81AA760(arg0, allocated, r4, var_28 + i));
+ bits &= 1;
+ }
+ free(allocated);
+}
+
+static bool8 sub_81AA4D8(u8 arg0, u8 arg1)
+{
+ s32 i;
+ s32 var_28;
+ s32 r6 = 0;
+ s32 r7 = 0;
+ s32 var_34 = 0;
+ s32 count;
+ u8 id = sub_81AA9E4();
+ u8 *allocated = AllocZeroed(0x10);
+
+ sub_81AA96C(allocated);
+ if (arg0 == 0)
+ {
+ count = gUnknown_08613650[id].unk1;
+ var_28 = 0;
+ }
+ else
+ {
+ count = gUnknown_08613650[id].unk0;
+ var_28 = gUnknown_08613650[id].unk1;
+ }
+
+ for (i = 0; i < count; i++)
+ {
+ if (r7 == 0)
+ {
+ if (sub_81AA760(arg0, allocated, arg1, var_28 + i))
+ r7 = 1;
+ else
+ var_34++;
+ }
+ if (r7 & 1)
+ {
+ if (sub_81AA760(arg0, allocated, gUnknown_08613F46[arg1][r6], var_28 + i))
+ {
+ do
+ {
+ r6++;
+ if (gUnknown_08613F46[arg1][r6] == 0xFF || r6 >= 4)
+ r6 = 0;
+ r7 += 2;
+ } while (r7 >> 1 != 4 && sub_81AA760(arg0, allocated, gUnknown_08613F46[arg1][r6], var_28 + i));
+ var_34++;
+ }
+ else
+ {
+ r6++;
+ if (gUnknown_08613F46[arg1][r6] == 0xFF || r6 >= 4)
+ r6 = 0;
+ var_34++;
+ }
+ }
+
+ if (r7 >> 1 == 4)
+ break;
+
+ r7 &= 1;
+ }
+ // free(allocated); BUG: allocated memory not freed
+
+ return (count / 2 > var_34);
+}
+
+static bool8 sub_81AA648(u8 arg0, u8 arg1)
+{
+ s32 i;
+ s32 var_28;
+ s32 r4 = 0;
+ s32 r7 = 0;
+ s32 r8 = 0;
+ s32 count;
+ u8 id = sub_81AA9E4();
+ u8 *allocated = AllocZeroed(0x10);
+
+ sub_81AA96C(allocated);
+ if (arg0 == 0)
+ {
+ count = gUnknown_08613650[id].unk1;
+ var_28 = 0;
+ }
+ else
+ {
+ count = gUnknown_08613650[id].unk0;
+ var_28 = gUnknown_08613650[id].unk1;
+ }
+
+ for (i = 0; i < count; i++)
+ {
+ if (sub_81AA760(arg0, allocated, gUnknown_08613F46[arg1][r4], var_28 + i))
+ {
+ do
+ {
+ r4++;
+ if (gUnknown_08613F46[arg1][r4] == 0xFF || r4 >= 4)
+ r4 = 0;
+ r8++;
+ } while (r8 != 4 && sub_81AA760(arg0, allocated, gUnknown_08613F46[arg1][r4], var_28 + i));
+ r7++;
+ }
+ else
+ {
+ r4++;
+ if (gUnknown_08613F46[arg1][r4] == 0xFF || r4 >= 4)
+ r4 = 0;
+ r7++;
+ }
+
+ if (r8 == 4)
+ break;
+ }
+ // free(allocated); BUG: allocated memory not freed
+
+ return (count / 2 > r7);
+}
+
+static bool8 sub_81AA760(u8 arg0, u8 *mapNums, u8 whichMap, u8 id)
+{
+ s32 i, j;
+
+ if (gSaveBlock2Ptr->frontier.field_E22[0] & 1)
+ {
+ s32 minus1 = -1;
+ for (i = 7; i > minus1; i--)
+ {
+ for (j = 7; j >= 0; j--)
+ {
+ if (!sub_81AA810(arg0, j, i, mapNums, whichMap, id))
+ return FALSE;
+ }
+ }
+ }
+ else
+ {
+ for (i = 0; i < 8; i++)
+ {
+ for (j = 0; j < 8; j++)
+ {
+ if (!sub_81AA810(arg0, j, i, mapNums, whichMap, id))
+ return FALSE;
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+static bool8 sub_81AA810(u8 arg0, u8 x, u8 y, u8 *mapNums, u8 whichMap, u8 id)
+{
+ s32 i, j;
+ const struct MapHeader *mapHeader;
+ struct EventObjectTemplate *events = gSaveBlock1Ptr->eventObjectTemplates;
+
+ mapHeader = Overworld_GetMapHeaderByGroupAndId(MAP_GROUP(BATTLE_PYRAMID_SQUARE01), mapNums[whichMap] + MAP_NUM(BATTLE_PYRAMID_SQUARE01));
+ for (i = 0; i < mapHeader->events->eventObjectCount; i++)
+ {
+ if (mapHeader->events->eventObjects[i].x != x || mapHeader->events->eventObjects[i].y != y)
+ continue;
+
+ if (arg0 != 0 || mapHeader->events->eventObjects[i].graphicsId == EVENT_OBJ_GFX_ITEM_BALL)
+ {
+ if (arg0 != 1 || mapHeader->events->eventObjects[i].graphicsId != EVENT_OBJ_GFX_ITEM_BALL)
+ continue;
+ }
+
+ for (j = 0; j < id; j++)
+ {
+ if (events[j].x == x + ((whichMap % 4) * 8) && events[j].y == y + ((whichMap / 4) * 8))
+ break;
+ }
+ if (j != id)
+ continue;
+
+ events[id] = mapHeader->events->eventObjects[i];
+ events[id].x += ((whichMap % 4) * 8);
+ events[id].y += ((whichMap / 4) * 8);
+ events[id].localId = id + 1;
+ if (events[id].graphicsId != EVENT_OBJ_GFX_ITEM_BALL)
+ {
+ i = sub_81A9F90(id);
+ events[id].graphicsId = GetBattleFacilityTrainerGfxId(i);
+ gSaveBlock2Ptr->frontier.field_CB4[id] = i;
+ }
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void sub_81AA96C(u8 *mapNums)
+{
+ s32 i;
+ s32 bits = (gSaveBlock2Ptr->frontier.field_E22[0]) | (gSaveBlock2Ptr->frontier.field_E22[1] << 16);
+ u8 id = sub_81AA9E4();
+
+ for (i = 0; i < 16; i++)
+ {
+ mapNums[i] = gUnknown_08613650[id].unk5[bits & 7];
+ bits >>= 3;
+ if (i == 7)
+ {
+ bits = (gSaveBlock2Ptr->frontier.field_E22[2]) | (gSaveBlock2Ptr->frontier.field_E22[3] << 16);
+ bits >>= 8;
+ }
+ }
+}
+
+static u8 sub_81AA9E4(void)
+{
+ s32 i;
+ s32 var = gSaveBlock2Ptr->frontier.field_E22[3] % 100;
+ s32 battleNum = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
+
+ for (i = gUnknown_08613794[battleNum]; i < ARRAY_COUNT(gUnknown_08613750); i++)
+ {
+ if (var < gUnknown_08613750[i][0])
+ return gUnknown_08613750[i][1];
+ }
+ return 0;
+}
+
+u8 sub_81AAA40(void)
+{
+ u8 i;
+ struct EventObjectTemplate *events = gSaveBlock1Ptr->eventObjectTemplates;
+
+ for (i = 0; i < 16; i++)
+ {
+ if (events[i].localId == 0)
+ break;
+ }
+
+ return i;
+}
+
+static void InitBagItems(u8 lvlMode)
+{
+ s32 i;
+
+ for (i = 0; i < PYRAMID_BAG_ITEMS_COUNT; i++)
+ {
+ gSaveBlock2Ptr->frontier.pyramidBag.itemId[lvlMode][i] = 0;
+ gSaveBlock2Ptr->frontier.pyramidBag.quantity[lvlMode][i] = 0;
+ }
+
+ AddPyramidBagItem(ITEM_HYPER_POTION, 1);
+ AddPyramidBagItem(ITEM_ETHER, 1);
+}
+
+u16 GetBattlePyramidPickupItemId(void)
+{
+ s32 rand;
+ u32 i;
+ u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
+ s32 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / 7);
+
+ if (round >= TOTAL_ROUNDS)
+ round = TOTAL_ROUNDS - 1;
+
+ rand = Random() % 100;
+
+ for (i = 0; i < ARRAY_COUNT(sPickupPercentages); i++)
+ {
+ if (sPickupPercentages[i] > rand)
+ break;
+ }
+
+ if (i >= PICKUP_ITEMS_PER_ROUND)
+ i = PICKUP_ITEMS_PER_ROUND - 1;
+
+ if (lvlMode != FRONTIER_LVL_50)
+ return sPickupItemsLvlOpen[round][i];
+ else
+ return sPickupItemsLvl50[round][i];
+}
diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c
index 665ee3750..5bd7de072 100644
--- a/src/battle_script_commands.c
+++ b/src/battle_script_commands.c
@@ -45,12 +45,8 @@
#include "party_menu.h"
#include "battle_arena.h"
#include "battle_pike.h"
+#include "battle_pyramid.h"
-extern u16 gBattle_BG1_X;
-extern u16 gBattle_BG1_Y;
-extern u16 gBattle_BG2_X;
-extern u16 gBattle_BG2_Y;
-extern u16 gBattle_BG3_X;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern const u8* const gBattleScriptsForMoveEffects[];
@@ -62,11 +58,8 @@ extern void sub_81D388C(struct Pokemon* mon, void* statStoreLocation); // pokena
extern void sub_81D3640(u8 arg0, void* statStoreLocation1, void* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); // pokenav.s
extern void sub_81D3784(u8 arg0, void* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); // pokenav.s
extern u8* GetMonNickname(struct Pokemon* mon, u8* dst); // party_menu
-extern u8 BattleArena_ShowJudgmentWindow(u8* arg0); // battle frontier 2
extern void sub_81B8E80(u8 battlerId, u8, u8); // party menu
extern bool8 sub_81B1250(void); // ?
-extern bool8 InBattlePyramid(void);
-extern u16 GetBattlePyramidPickupItemId(void);
extern u8 sub_813B21C(void);
extern u16 get_unknown_box_id(void);
@@ -3285,7 +3278,7 @@ static void atk23_getexp(void)
u16 calculatedExp;
s32 viaSentIn;
- for (viaSentIn = 0, i = 0; i < 6; i++)
+ for (viaSentIn = 0, i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE || GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0)
continue;
@@ -3543,7 +3536,7 @@ static void atk24(void)
}
else
{
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)
&& (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->arenaLostPlayerMons & gBitTable[i])))
@@ -3556,7 +3549,7 @@ static void atk24(void)
if (HP_count == 0)
gBattleOutcome |= B_OUTCOME_LOST;
- for (HP_count = 0, i = 0; i < 6; i++)
+ for (HP_count = 0, i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&gEnemyParty[i], MON_DATA_SPECIES) && !GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG)
&& (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->arenaLostOpponentMons & gBitTable[i])))
@@ -4952,7 +4945,7 @@ static void atk4D_switchindataupdate(void)
if (gBattleMoves[gCurrentMove].effect == EFFECT_BATON_PASS)
{
- for (i = 0; i < BATTLE_STATS_NO; i++)
+ for (i = 0; i < NUM_BATTLE_STATS; i++)
{
gBattleMons[gActiveBattler].statStages[i] = oldData.statStages[i];
}
@@ -7406,7 +7399,7 @@ static void atk8A_normalisebuffs(void) // haze
for (i = 0; i < gBattlersCount; i++)
{
- for (j = 0; j < BATTLE_STATS_NO; j++)
+ for (j = 0; j < NUM_BATTLE_STATS; j++)
gBattleMons[i].statStages[j] = 6;
}
@@ -9034,7 +9027,7 @@ static void atkBD_copyfoestats(void) // psych up
{
s32 i;
- for (i = 0; i < BATTLE_STATS_NO; i++)
+ for (i = 0; i < NUM_BATTLE_STATS; i++)
{
gBattleMons[gBattlerAttacker].statStages[i] = gBattleMons[gBattlerTarget].statStages[i];
}
@@ -9860,71 +9853,72 @@ static void atkE4_getsecretpowereffect(void)
static void atkE5_pickup(void)
{
- if (!InBattlePike())
+ s32 i;
+ u16 species, heldItem;
+ u8 ability;
+
+ if (InBattlePike())
{
- s32 i;
- u16 species, heldItem;
- u8 ability;
- if (InBattlePyramid())
+ }
+ else if (InBattlePyramid())
+ {
+ for (i = 0; i < PARTY_SIZE; i++)
{
- for (i = 0; i < 6; i++)
- {
- species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
- heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
+ species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
+ heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
- if (GetMonData(&gPlayerParty[i], MON_DATA_ALT_ABILITY))
- ability = gBaseStats[species].ability2;
- else
- ability = gBaseStats[species].ability1;
+ if (GetMonData(&gPlayerParty[i], MON_DATA_ALT_ABILITY))
+ ability = gBaseStats[species].ability2;
+ else
+ ability = gBaseStats[species].ability1;
- if (ability == ABILITY_PICKUP
- && species != 0
- && species != SPECIES_EGG
- && heldItem == ITEM_NONE
- && (Random() % 10) == 0)
- {
- heldItem = GetBattlePyramidPickupItemId();
- SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &heldItem);
- }
+ if (ability == ABILITY_PICKUP
+ && species != 0
+ && species != SPECIES_EGG
+ && heldItem == ITEM_NONE
+ && (Random() % 10) == 0)
+ {
+ heldItem = GetBattlePyramidPickupItemId();
+ SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &heldItem);
}
}
- else
+ }
+ else
+ {
+ for (i = 0; i < PARTY_SIZE; i++)
{
- for (i = 0; i < 6; i++)
- {
- species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
- heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
+ species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
+ heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
- if (GetMonData(&gPlayerParty[i], MON_DATA_ALT_ABILITY))
- ability = gBaseStats[species].ability2;
- else
- ability = gBaseStats[species].ability1;
+ if (GetMonData(&gPlayerParty[i], MON_DATA_ALT_ABILITY))
+ ability = gBaseStats[species].ability2;
+ else
+ ability = gBaseStats[species].ability1;
- if (ability == ABILITY_PICKUP
- && species != 0
- && species != SPECIES_EGG
- && heldItem == ITEM_NONE
- && (Random() % 10) == 0)
- {
- s32 j;
- s32 rand = Random() % 100;
- u8 lvlDivBy10 = (GetMonData(&gPlayerParty[i], MON_DATA_LEVEL) - 1) / 10;
- if (lvlDivBy10 > 9)
- lvlDivBy10 = 9;
+ if (ability == ABILITY_PICKUP
+ && species != 0
+ && species != SPECIES_EGG
+ && heldItem == ITEM_NONE
+ && (Random() % 10) == 0)
+ {
+ s32 j;
+ s32 rand = Random() % 100;
+ u8 lvlDivBy10 = (GetMonData(&gPlayerParty[i], MON_DATA_LEVEL) - 1) / 10;
+ if (lvlDivBy10 > 9)
+ lvlDivBy10 = 9;
- for (j = 0; j < 9; j++)
+ for (j = 0; j < 9; j++)
+ {
+ if (sPickupProbabilities[j] > rand)
{
- if (sPickupProbabilities[j] > rand)
- {
- SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &sPickupItems[lvlDivBy10 + j]);
- break;
- }
- else if (rand == 99 || rand == 98)
- {
- SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &sRarePickupItems[lvlDivBy10 + (99 - rand)]);
- break;
- }
+ SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &sPickupItems[lvlDivBy10 + j]);
+ break;
+ }
+ else if (rand == 99 || rand == 98)
+ {
+ SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &sRarePickupItems[lvlDivBy10 + (99 - rand)]);
+ break;
}
}
}
diff --git a/src/battle_setup.c b/src/battle_setup.c
index 18998e564..ab2a12fb7 100644
--- a/src/battle_setup.c
+++ b/src/battle_setup.c
@@ -34,6 +34,7 @@
#include "battle_tower.h"
#include "gym_leader_rematch.h"
#include "battle_pike.h"
+#include "battle_pyramid.h"
#include "constants/map_types.h"
#include "constants/battle_frontier.h"
@@ -54,7 +55,6 @@ struct TrainerBattleParameter
u8 ptrType;
};
-extern bool8 InBattlePyramid(void);
extern bool32 InTrainerHill(void);
extern bool32 FieldPoisonEffectIsRunning(void);
extern void RestartWildEncounterImmunitySteps(void);
@@ -63,17 +63,13 @@ extern void sub_81BE72C(void);
extern void sub_808BCF4(void);
extern void sub_80EECC8(void);
extern void sub_80AF6F0(void);
-extern u16 sub_81A9AA8(u8 localId);
extern u16 sub_81D6180(u8 localId);
-extern bool8 GetBattlePyramidTrainerFlag(u8 eventObjId);
extern bool8 GetTrainerHillTrainerFlag(u8 eventObjId);
extern bool8 sub_81D5C18(void);
-extern void sub_81A9B04(void);
extern void sub_81D639C(void);
extern void sub_81D6384(void);
extern void sub_81D61E8(void);
extern void sub_80982B8(void);
-extern void sub_81A9EDC(u16 a0);
extern void CopyTrainerHillTrainerText(u8 a0, u16 arg1);
// this file's functions
@@ -1131,12 +1127,12 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data)
{
TrainerBattleLoadArgs(sOrdinaryBattleParams, data);
SetMapVarsToTrainer();
- gTrainerBattleOpponent_A = sub_81A9AA8(gSpecialVar_LastTalked);
+ gTrainerBattleOpponent_A = LocalIdToPyramidTrainerId(gSpecialVar_LastTalked);
}
else
{
TrainerBattleLoadArgs(sTrainerBOrdinaryBattleParams, data);
- gTrainerBattleOpponent_B = sub_81A9AA8(gSpecialVar_LastTalked);
+ gTrainerBattleOpponent_B = LocalIdToPyramidTrainerId(gSpecialVar_LastTalked);
}
return EventScript_271362;
case TRAINER_BATTLE_SET_TRAINER_A:
@@ -1360,9 +1356,9 @@ void ShowTrainerIntroSpeech(void)
if (InBattlePyramid())
{
if (gNoOfApproachingTrainers == 0 || gNoOfApproachingTrainers == 1)
- sub_81A9EDC(sub_81A9AA8(gSpecialVar_LastTalked));
+ CopyPyramidTrainerSpeechBefore(LocalIdToPyramidTrainerId(gSpecialVar_LastTalked));
else
- sub_81A9EDC(sub_81A9AA8(gEventObjects[gApproachingTrainers[gApproachingTrainerId].eventObjectId].localId));
+ CopyPyramidTrainerSpeechBefore(LocalIdToPyramidTrainerId(gEventObjects[gApproachingTrainers[gApproachingTrainerId].eventObjectId].localId));
sub_80982B8();
}
diff --git a/src/battle_tent.c b/src/battle_tent.c
index 678222ff5..c7e70912c 100644
--- a/src/battle_tent.c
+++ b/src/battle_tent.c
@@ -10,6 +10,7 @@
#include "item.h"
#include "battle_factory_screen.h"
#include "frontier_util.h"
+#include "string_util.h"
#include "constants/items.h"
#include "constants/region_map_sections.h"
@@ -17,10 +18,6 @@ extern const struct BattleFrontierTrainer gSlateportBattleTentTrainers[];
extern const struct FacilityMon gSlateportBattleTentMons[];
extern const u16 gBattleFrontierHeldItems[];
-extern u16 gUnknown_03006298[];
-
-extern void sub_81A4C30(void);
-
// This file's functions.
static void sub_81B99D4(void);
static void sub_81B9A28(void);
diff --git a/src/battle_tower.c b/src/battle_tower.c
index 000a03a5b..165b6bf64 100644
--- a/src/battle_tower.c
+++ b/src/battle_tower.c
@@ -28,8 +28,6 @@
#include "constants/moves.h"
#include "constants/species.h"
-extern u16 gUnknown_03006298[];
-
extern void sub_81A4C30(void);
extern const u8 *const *const gUnknown_085DD690[];
@@ -68,6 +66,9 @@ extern const u8 MossdeepCity_SpaceCenter_2F_EventScript_224166[];
EWRAM_DATA const struct BattleFrontierTrainer *gFacilityTrainers = NULL;
EWRAM_DATA const struct FacilityMon *gFacilityTrainerMons = NULL;
+// IWRAM common
+u16 gUnknown_03006298[4];
+
// This file's functions.
static void sub_8161F94(void);
static void sub_8162054(void);
diff --git a/src/battle_transition.c b/src/battle_transition.c
index 759f15eee..94b9e78f9 100644
--- a/src/battle_transition.c
+++ b/src/battle_transition.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "battle.h"
#include "battle_transition.h"
#include "bg.h"
#include "decompress.h"
@@ -56,9 +57,6 @@ struct StructRectangularSpiral
typedef bool8 (*TransitionStateFunc)(struct Task *task);
typedef bool8 (*TransitionSpriteCallback)(struct Sprite *sprite);
-extern u16 gBattle_BG0_X;
-extern u16 gBattle_BG0_Y;
-
extern const struct OamData gEventObjectBaseOam_32x32;
extern void sub_80AC3D0(void);
diff --git a/src/battle_util.c b/src/battle_util.c
index 6fb5f4bdc..251a545c9 100644
--- a/src/battle_util.c
+++ b/src/battle_util.c
@@ -2616,7 +2616,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
gBattleStruct->moneyMultiplier = 2;
break;
case HOLD_EFFECT_RESTORE_STATS:
- for (i = 0; i < BATTLE_STATS_NO; i++)
+ for (i = 0; i < NUM_BATTLE_STATS; i++)
{
if (gBattleMons[battlerId].statStages[i] < 6)
{
@@ -2687,7 +2687,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
case HOLD_EFFECT_RESTORE_STATS:
- for (i = 0; i < BATTLE_STATS_NO; i++)
+ for (i = 0; i < NUM_BATTLE_STATS; i++)
{
if (gBattleMons[battlerId].statStages[i] < 6)
{
@@ -3163,7 +3163,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
case HOLD_EFFECT_RESTORE_STATS:
- for (i = 0; i < BATTLE_STATS_NO; i++)
+ for (i = 0; i < NUM_BATTLE_STATS; i++)
{
if (gBattleMons[battlerId].statStages[i] < 6)
{
diff --git a/src/berry.c b/src/berry.c
index 7cd28d69f..9f08165b8 100644
--- a/src/berry.c
+++ b/src/berry.c
@@ -1,10 +1,13 @@
#include "global.h"
#include "berry.h"
#include "event_data.h"
+#include "field_control_avatar.h"
#include "fieldmap.h"
#include "item.h"
+#include "item_menu.h"
#include "main.h"
#include "random.h"
+#include "string_util.h"
#include "text.h"
#include "constants/event_object_movement_constants.h"
#include "constants/items.h"
@@ -12,11 +15,8 @@
extern u8 EventObjectGetBerryTreeId(u8 eventObjectId);
extern void sub_8092EF0(u8 mapId, u8 mapNumber, u8 mapGroup);
extern void CB2_ChooseBerry(void);
-extern const u8* GetEventObjectScriptPointerPlayerFacing(void);
extern bool8 IsBerryTreeSparkling(u8, u8, u8);
-extern u16 gSpecialVar_ItemId;
-
extern const u8 BerryTreeScript[];
static u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry);
diff --git a/src/berry_blender.c b/src/berry_blender.c
index fca544e03..7320e905f 100644
--- a/src/berry_blender.c
+++ b/src/berry_blender.c
@@ -33,6 +33,7 @@
#include "item_menu.h"
#include "battle_records.h"
#include "graphics.h"
+#include "new_game.h"
#define BLENDER_SCORE_BEST 0
#define BLENDER_SCORE_GOOD 1
@@ -132,8 +133,6 @@ struct BerryBlenderData
extern struct MusicPlayerInfo gMPlayInfo_SE2;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
-extern u8 gInGameOpponentsNo;
-extern u8 gUnknown_020322D5;
// text
extern const u8 gText_SavingDontTurnOff2[];
@@ -195,18 +194,21 @@ static void sub_8083170(u16 a0, u16 a1);
static void Blender_PrintMadePokeblockString(struct Pokeblock *pokeblock, u8 *dst);
static bool32 TryAddContestLinkTvShow(struct Pokeblock *pokeblock, struct TvBlenderStruct *a1);
-// ewram
+// EWRAM
EWRAM_DATA static struct BerryBlenderData *sBerryBlenderData = NULL;
EWRAM_DATA static s32 sUnknown_020322A8[5] = {0};
EWRAM_DATA static s32 sUnknown_020322BC[5] = {0};
EWRAM_DATA static u32 sUnknown_020322D0 = 0;
-// iwram
+// IWRAM bss
IWRAM_DATA static s16 sUnknown_03000DE8[8];
IWRAM_DATA static s16 sUnknown_03000DF8[6];
IWRAM_DATA static s16 sUnknown_03000E04;
IWRAM_DATA static s16 sUnknown_03000E06;
+// IWRAM common
+u8 gInGameOpponentsNo;
+
// rom
static const u16 sBlenderCenterPal[] = INCBIN_U16("graphics/berry_blender/center.gbapal");
diff --git a/src/bg.c b/src/bg.c
index 7c55410b1..a41075ad7 100644
--- a/src/bg.c
+++ b/src/bg.c
@@ -135,22 +135,22 @@ u16 GetBgControlAttribute(u8 bg, u8 attributeId)
{
switch (attributeId)
{
- case BG_CTRL_ATTR_VISIBLE:
- return sGpuBgConfigs.configs[bg].visible;
- case BG_CTRL_ATTR_CHARBASEINDEX:
- return sGpuBgConfigs.configs[bg].charBaseIndex;
- case BG_CTRL_ATTR_MAPBASEINDEX:
- return sGpuBgConfigs.configs[bg].mapBaseIndex;
- case BG_CTRL_ATTR_SCREENSIZE:
- return sGpuBgConfigs.configs[bg].screenSize;
- case BG_CTRL_ATTR_PALETTEMODE:
- return sGpuBgConfigs.configs[bg].paletteMode;
- case BG_CTRL_ATTR_PRIORITY:
- return sGpuBgConfigs.configs[bg].priority;
- case BG_CTRL_ATTR_MOSAIC:
- return sGpuBgConfigs.configs[bg].mosaic;
- case BG_CTRL_ATTR_WRAPAROUND:
- return sGpuBgConfigs.configs[bg].wraparound;
+ case BG_CTRL_ATTR_VISIBLE:
+ return sGpuBgConfigs.configs[bg].visible;
+ case BG_CTRL_ATTR_CHARBASEINDEX:
+ return sGpuBgConfigs.configs[bg].charBaseIndex;
+ case BG_CTRL_ATTR_MAPBASEINDEX:
+ return sGpuBgConfigs.configs[bg].mapBaseIndex;
+ case BG_CTRL_ATTR_SCREENSIZE:
+ return sGpuBgConfigs.configs[bg].screenSize;
+ case BG_CTRL_ATTR_PALETTEMODE:
+ return sGpuBgConfigs.configs[bg].paletteMode;
+ case BG_CTRL_ATTR_PRIORITY:
+ return sGpuBgConfigs.configs[bg].priority;
+ case BG_CTRL_ATTR_MOSAIC:
+ return sGpuBgConfigs.configs[bg].mosaic;
+ case BG_CTRL_ATTR_WRAPAROUND:
+ return sGpuBgConfigs.configs[bg].wraparound;
}
}
@@ -166,15 +166,15 @@ u8 LoadBgVram(u8 bg, const void *src, u16 size, u16 destOffset, u8 mode)
{
switch (mode)
{
- case 0x1:
- offset = sGpuBgConfigs.configs[bg].charBaseIndex * BG_CHAR_SIZE;
- break;
- case 0x2:
- offset = sGpuBgConfigs.configs[bg].mapBaseIndex * BG_SCREEN_SIZE;
- break;
- default:
- cursor = -1;
- goto end;
+ case 0x1:
+ offset = sGpuBgConfigs.configs[bg].charBaseIndex * BG_CHAR_SIZE;
+ break;
+ case 0x2:
+ offset = sGpuBgConfigs.configs[bg].mapBaseIndex * BG_SCREEN_SIZE;
+ break;
+ default:
+ cursor = -1;
+ goto end;
}
offset = destOffset + offset;
@@ -241,17 +241,17 @@ static void SetBgAffineInternal(u8 bg, u32 srcCenterX, u32 srcCenterY, s16 dispC
switch (sGpuBgConfigs.bgVisibilityAndMode & 0x7)
{
- case 1:
- if (bg != 2)
- return;
- break;
- case 2:
- if (bg < 2 || bg > 3)
- return;
- break;
- case 0:
- default:
+ case 1:
+ if (bg != 2)
+ return;
+ break;
+ case 2:
+ if (bg < 2 || bg > 3)
return;
+ break;
+ case 0:
+ default:
+ return;
}
src.texX = srcCenterX;
@@ -279,7 +279,8 @@ bool8 IsInvalidBg(u8 bg)
{
if (bg > 3)
return TRUE;
- return FALSE;
+ else
+ return FALSE;
}
int DummiedOutFireRedLeafGreenTileAllocFunc(int a1, int a2, int a3, int a4)
@@ -434,7 +435,6 @@ u16 Unused_LoadBgPalette(u8 bg, const void *src, u16 size, u16 destOffset)
return (u8)cursor;
}
-#ifdef NONMATCHING // Matches everything but r5 and r6 are flipped, rrr
bool8 IsDma3ManagerBusyWithBgCopy(void)
{
u8 mod;
@@ -462,60 +462,6 @@ bool8 IsDma3ManagerBusyWithBgCopy(void)
return FALSE;
}
-#else
-NAKED
-bool8 IsDma3ManagerBusyWithBgCopy(void)
-{
- asm("push {r4-r7,lr}\n\
- mov r5, #0\n\
- mov r7, #0x1\n\
- neg r7, r7\n\
-_08001ADC:\n\
- add r0, r5, #0\n\
- cmp r5, #0\n\
- bge _08001AE4\n\
- add r0, #0x1F\n\
-_08001AE4:\n\
- asr r0, #5\n\
- lsl r2, r0, #24\n\
- lsl r0, #5\n\
- sub r0, r5, r0\n\
- lsl r0, #24\n\
- lsr r0, #24\n\
- ldr r1, =sDmaBusyBitfield\n\
- lsr r2, #22\n\
- add r4, r2, r1\n\
- mov r6, #0x1\n\
- lsl r6, r0\n\
- ldr r0, [r4]\n\
- and r0, r6\n\
- cmp r0, #0\n\
- beq _08001B22\n\
- lsl r0, r5, #16\n\
- asr r0, #16\n\
- bl CheckForSpaceForDma3Request\n\
- lsl r0, #24\n\
- asr r0, #24\n\
- cmp r0, r7\n\
- bne _08001B1C\n\
- mov r0, #0x1\n\
- b _08001B2A\n\
- .pool\n\
-_08001B1C:\n\
- ldr r0, [r4]\n\
- bic r0, r6\n\
- str r0, [r4]\n\
-_08001B22:\n\
- add r5, #0x1\n\
- cmp r5, #0x7F\n\
- ble _08001ADC\n\
- mov r0, #0\n\
-_08001B2A:\n\
- pop {r4-r7}\n\
- pop {r1}\n\
- bx r1\n");
-}
-#endif // NONMATCHING
void ShowBg(u8 bg)
{
@@ -533,27 +479,27 @@ void SetBgAttribute(u8 bg, u8 attributeId, u8 value)
{
switch (attributeId)
{
- case 1:
- SetBgControlAttributes(bg, value, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
- break;
- case 2:
- SetBgControlAttributes(bg, 0xFF, value, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
- break;
- case 3:
- SetBgControlAttributes(bg, 0xFF, 0xFF, value, 0xFF, 0xFF, 0xFF, 0xFF);
- break;
- case 4:
- SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, value, 0xFF, 0xFF, 0xFF);
- break;
- case 7:
- SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, 0xFF, value, 0xFF, 0xFF);
- break;
- case 5:
- SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, value, 0xFF);
- break;
- case 6:
- SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, value);
- break;
+ case 1:
+ SetBgControlAttributes(bg, value, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
+ break;
+ case 2:
+ SetBgControlAttributes(bg, 0xFF, value, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
+ break;
+ case 3:
+ SetBgControlAttributes(bg, 0xFF, 0xFF, value, 0xFF, 0xFF, 0xFF, 0xFF);
+ break;
+ case 4:
+ SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, value, 0xFF, 0xFF, 0xFF);
+ break;
+ case 7:
+ SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, 0xFF, value, 0xFF, 0xFF);
+ break;
+ case 5:
+ SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, value, 0xFF);
+ break;
+ case 6:
+ SetBgControlAttributes(bg, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, value);
+ break;
}
}
@@ -561,36 +507,36 @@ u16 GetBgAttribute(u8 bg, u8 attributeId)
{
switch (attributeId)
{
- case 1:
- return GetBgControlAttribute(bg, BG_CTRL_ATTR_CHARBASEINDEX);
- case 2:
- return GetBgControlAttribute(bg, BG_CTRL_ATTR_MAPBASEINDEX);
- case 3:
- return GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE);
- case 4:
- return GetBgControlAttribute(bg, BG_CTRL_ATTR_PALETTEMODE);
- case 7:
- return GetBgControlAttribute(bg, BG_CTRL_ATTR_PRIORITY);
- case 5:
- return GetBgControlAttribute(bg, BG_CTRL_ATTR_MOSAIC);
- case 6:
- return GetBgControlAttribute(bg, BG_CTRL_ATTR_WRAPAROUND);
- case 8:
- switch (GetBgType(bg))
- {
- case 0:
- return GetBgMetricTextMode(bg, 0) * 0x800;
- case 1:
- return GetBgMetricAffineMode(bg, 0) * 0x100;
- default:
- return 0;
- }
- case 9:
- return GetBgType(bg);
- case 10:
- return sGpuBgConfigs2[bg].baseTile;
- default:
- return -1;
+ case 1:
+ return GetBgControlAttribute(bg, BG_CTRL_ATTR_CHARBASEINDEX);
+ case 2:
+ return GetBgControlAttribute(bg, BG_CTRL_ATTR_MAPBASEINDEX);
+ case 3:
+ return GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE);
+ case 4:
+ return GetBgControlAttribute(bg, BG_CTRL_ATTR_PALETTEMODE);
+ case 7:
+ return GetBgControlAttribute(bg, BG_CTRL_ATTR_PRIORITY);
+ case 5:
+ return GetBgControlAttribute(bg, BG_CTRL_ATTR_MOSAIC);
+ case 6:
+ return GetBgControlAttribute(bg, BG_CTRL_ATTR_WRAPAROUND);
+ case 8:
+ switch (GetBgType(bg))
+ {
+ case 0:
+ return GetBgMetricTextMode(bg, 0) * 0x800;
+ case 1:
+ return GetBgMetricAffineMode(bg, 0) * 0x100;
+ default:
+ return 0;
+ }
+ case 9:
+ return GetBgType(bg);
+ case 10:
+ return sGpuBgConfigs2[bg].baseTile;
+ default:
+ return -1;
}
}
@@ -607,58 +553,58 @@ u32 ChangeBgX(u8 bg, u32 value, u8 op)
switch (op)
{
- case 0:
- default:
- sGpuBgConfigs2[bg].bg_x = value;
- break;
- case 1:
- sGpuBgConfigs2[bg].bg_x += value;
- break;
- case 2:
- sGpuBgConfigs2[bg].bg_x -= value;
- break;
+ case 0:
+ default:
+ sGpuBgConfigs2[bg].bg_x = value;
+ break;
+ case 1:
+ sGpuBgConfigs2[bg].bg_x += value;
+ break;
+ case 2:
+ sGpuBgConfigs2[bg].bg_x -= value;
+ break;
}
mode = GetBgMode();
switch (bg)
{
- case 0:
- temp1 = sGpuBgConfigs2[0].bg_x >> 0x8;
- SetGpuReg(REG_OFFSET_BG0HOFS, temp1);
- break;
- case 1:
- temp1 = sGpuBgConfigs2[1].bg_x >> 0x8;
- SetGpuReg(REG_OFFSET_BG1HOFS, temp1);
- break;
- case 2:
- if (mode == 0)
- {
- temp1 = sGpuBgConfigs2[2].bg_x >> 0x8;
- SetGpuReg(REG_OFFSET_BG2HOFS, temp1);
- }
- else
- {
- temp1 = sGpuBgConfigs2[2].bg_x >> 0x10;
- temp2 = sGpuBgConfigs2[2].bg_x & 0xFFFF;
- SetGpuReg(REG_OFFSET_BG2X_H, temp1);
- SetGpuReg(REG_OFFSET_BG2X_L, temp2);
- }
- break;
- case 3:
- if (mode == 0)
- {
- temp1 = sGpuBgConfigs2[3].bg_x >> 0x8;
- SetGpuReg(REG_OFFSET_BG3HOFS, temp1);
- }
- else if (mode == 2)
- {
- temp1 = sGpuBgConfigs2[3].bg_x >> 0x10;
- temp2 = sGpuBgConfigs2[3].bg_x & 0xFFFF;
- SetGpuReg(REG_OFFSET_BG3X_H, temp1);
- SetGpuReg(REG_OFFSET_BG3X_L, temp2);
- }
- break;
+ case 0:
+ temp1 = sGpuBgConfigs2[0].bg_x >> 0x8;
+ SetGpuReg(REG_OFFSET_BG0HOFS, temp1);
+ break;
+ case 1:
+ temp1 = sGpuBgConfigs2[1].bg_x >> 0x8;
+ SetGpuReg(REG_OFFSET_BG1HOFS, temp1);
+ break;
+ case 2:
+ if (mode == 0)
+ {
+ temp1 = sGpuBgConfigs2[2].bg_x >> 0x8;
+ SetGpuReg(REG_OFFSET_BG2HOFS, temp1);
+ }
+ else
+ {
+ temp1 = sGpuBgConfigs2[2].bg_x >> 0x10;
+ temp2 = sGpuBgConfigs2[2].bg_x & 0xFFFF;
+ SetGpuReg(REG_OFFSET_BG2X_H, temp1);
+ SetGpuReg(REG_OFFSET_BG2X_L, temp2);
+ }
+ break;
+ case 3:
+ if (mode == 0)
+ {
+ temp1 = sGpuBgConfigs2[3].bg_x >> 0x8;
+ SetGpuReg(REG_OFFSET_BG3HOFS, temp1);
+ }
+ else if (mode == 2)
+ {
+ temp1 = sGpuBgConfigs2[3].bg_x >> 0x10;
+ temp2 = sGpuBgConfigs2[3].bg_x & 0xFFFF;
+ SetGpuReg(REG_OFFSET_BG3X_H, temp1);
+ SetGpuReg(REG_OFFSET_BG3X_L, temp2);
+ }
+ break;
}
return sGpuBgConfigs2[bg].bg_x;
@@ -668,9 +614,10 @@ u32 GetBgX(u8 bg)
{
if (IsInvalidBg32(bg) != FALSE)
return -1;
- if (GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0)
+ else if (GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0)
return -1;
- return sGpuBgConfigs2[bg].bg_x;
+ else
+ return sGpuBgConfigs2[bg].bg_x;
}
u32 ChangeBgY(u8 bg, u32 value, u8 op)
@@ -686,58 +633,58 @@ u32 ChangeBgY(u8 bg, u32 value, u8 op)
switch (op)
{
- case 0:
- default:
- sGpuBgConfigs2[bg].bg_y = value;
- break;
- case 1:
- sGpuBgConfigs2[bg].bg_y += value;
- break;
- case 2:
- sGpuBgConfigs2[bg].bg_y -= value;
- break;
+ case 0:
+ default:
+ sGpuBgConfigs2[bg].bg_y = value;
+ break;
+ case 1:
+ sGpuBgConfigs2[bg].bg_y += value;
+ break;
+ case 2:
+ sGpuBgConfigs2[bg].bg_y -= value;
+ break;
}
mode = GetBgMode();
switch (bg)
{
- case 0:
- temp1 = sGpuBgConfigs2[0].bg_y >> 0x8;
- SetGpuReg(REG_OFFSET_BG0VOFS, temp1);
- break;
- case 1:
- temp1 = sGpuBgConfigs2[1].bg_y >> 0x8;
- SetGpuReg(REG_OFFSET_BG1VOFS, temp1);
- break;
- case 2:
- if (mode == 0)
- {
- temp1 = sGpuBgConfigs2[2].bg_y >> 0x8;
- SetGpuReg(REG_OFFSET_BG2VOFS, temp1);
- }
- else
- {
- temp1 = sGpuBgConfigs2[2].bg_y >> 0x10;
- temp2 = sGpuBgConfigs2[2].bg_y & 0xFFFF;
- SetGpuReg(REG_OFFSET_BG2Y_H, temp1);
- SetGpuReg(REG_OFFSET_BG2Y_L, temp2);
- }
- break;
- case 3:
- if (mode == 0)
- {
- temp1 = sGpuBgConfigs2[3].bg_y >> 0x8;
- SetGpuReg(REG_OFFSET_BG3VOFS, temp1);
- }
- else if (mode == 2)
- {
- temp1 = sGpuBgConfigs2[3].bg_y >> 0x10;
- temp2 = sGpuBgConfigs2[3].bg_y & 0xFFFF;
- SetGpuReg(REG_OFFSET_BG3Y_H, temp1);
- SetGpuReg(REG_OFFSET_BG3Y_L, temp2);
- }
- break;
+ case 0:
+ temp1 = sGpuBgConfigs2[0].bg_y >> 0x8;
+ SetGpuReg(REG_OFFSET_BG0VOFS, temp1);
+ break;
+ case 1:
+ temp1 = sGpuBgConfigs2[1].bg_y >> 0x8;
+ SetGpuReg(REG_OFFSET_BG1VOFS, temp1);
+ break;
+ case 2:
+ if (mode == 0)
+ {
+ temp1 = sGpuBgConfigs2[2].bg_y >> 0x8;
+ SetGpuReg(REG_OFFSET_BG2VOFS, temp1);
+ }
+ else
+ {
+ temp1 = sGpuBgConfigs2[2].bg_y >> 0x10;
+ temp2 = sGpuBgConfigs2[2].bg_y & 0xFFFF;
+ SetGpuReg(REG_OFFSET_BG2Y_H, temp1);
+ SetGpuReg(REG_OFFSET_BG2Y_L, temp2);
+ }
+ break;
+ case 3:
+ if (mode == 0)
+ {
+ temp1 = sGpuBgConfigs2[3].bg_y >> 0x8;
+ SetGpuReg(REG_OFFSET_BG3VOFS, temp1);
+ }
+ else if (mode == 2)
+ {
+ temp1 = sGpuBgConfigs2[3].bg_y >> 0x10;
+ temp2 = sGpuBgConfigs2[3].bg_y & 0xFFFF;
+ SetGpuReg(REG_OFFSET_BG3Y_H, temp1);
+ SetGpuReg(REG_OFFSET_BG3Y_L, temp2);
+ }
+ break;
}
return sGpuBgConfigs2[bg].bg_y;
@@ -756,59 +703,59 @@ u32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op)
switch (op)
{
- case 0:
- default:
- sGpuBgConfigs2[bg].bg_y = value;
- break;
- case 1:
- sGpuBgConfigs2[bg].bg_y += value;
- break;
- case 2:
- sGpuBgConfigs2[bg].bg_y -= value;
- break;
+ case 0:
+ default:
+ sGpuBgConfigs2[bg].bg_y = value;
+ break;
+ case 1:
+ sGpuBgConfigs2[bg].bg_y += value;
+ break;
+ case 2:
+ sGpuBgConfigs2[bg].bg_y -= value;
+ break;
}
mode = GetBgMode();
switch (bg)
{
- case 0:
- temp1 = sGpuBgConfigs2[0].bg_y >> 0x8;
- SetGpuReg_ForcedBlank(REG_OFFSET_BG0VOFS, temp1);
- break;
- case 1:
- temp1 = sGpuBgConfigs2[1].bg_y >> 0x8;
- SetGpuReg_ForcedBlank(REG_OFFSET_BG1VOFS, temp1);
- break;
- case 2:
- if (mode == 0)
- {
- temp1 = sGpuBgConfigs2[2].bg_y >> 0x8;
- SetGpuReg_ForcedBlank(REG_OFFSET_BG2VOFS, temp1);
+ case 0:
+ temp1 = sGpuBgConfigs2[0].bg_y >> 0x8;
+ SetGpuReg_ForcedBlank(REG_OFFSET_BG0VOFS, temp1);
+ break;
+ case 1:
+ temp1 = sGpuBgConfigs2[1].bg_y >> 0x8;
+ SetGpuReg_ForcedBlank(REG_OFFSET_BG1VOFS, temp1);
+ break;
+ case 2:
+ if (mode == 0)
+ {
+ temp1 = sGpuBgConfigs2[2].bg_y >> 0x8;
+ SetGpuReg_ForcedBlank(REG_OFFSET_BG2VOFS, temp1);
- }
- else
- {
- temp1 = sGpuBgConfigs2[2].bg_y >> 0x10;
- temp2 = sGpuBgConfigs2[2].bg_y & 0xFFFF;
- SetGpuReg_ForcedBlank(REG_OFFSET_BG2Y_H, temp1);
- SetGpuReg_ForcedBlank(REG_OFFSET_BG2Y_L, temp2);
- }
- break;
- case 3:
- if (mode == 0)
- {
- temp1 = sGpuBgConfigs2[3].bg_y >> 0x8;
- SetGpuReg_ForcedBlank(REG_OFFSET_BG3VOFS, temp1);
- }
- else if (mode == 2)
- {
- temp1 = sGpuBgConfigs2[3].bg_y >> 0x10;
- temp2 = sGpuBgConfigs2[3].bg_y & 0xFFFF;
- SetGpuReg_ForcedBlank(REG_OFFSET_BG3Y_H, temp1);
- SetGpuReg_ForcedBlank(REG_OFFSET_BG3Y_L, temp2);
- }
- break;
+ }
+ else
+ {
+ temp1 = sGpuBgConfigs2[2].bg_y >> 0x10;
+ temp2 = sGpuBgConfigs2[2].bg_y & 0xFFFF;
+ SetGpuReg_ForcedBlank(REG_OFFSET_BG2Y_H, temp1);
+ SetGpuReg_ForcedBlank(REG_OFFSET_BG2Y_L, temp2);
+ }
+ break;
+ case 3:
+ if (mode == 0)
+ {
+ temp1 = sGpuBgConfigs2[3].bg_y >> 0x8;
+ SetGpuReg_ForcedBlank(REG_OFFSET_BG3VOFS, temp1);
+ }
+ else if (mode == 2)
+ {
+ temp1 = sGpuBgConfigs2[3].bg_y >> 0x10;
+ temp2 = sGpuBgConfigs2[3].bg_y & 0xFFFF;
+ SetGpuReg_ForcedBlank(REG_OFFSET_BG3Y_H, temp1);
+ SetGpuReg_ForcedBlank(REG_OFFSET_BG3Y_L, temp2);
+ }
+ break;
}
return sGpuBgConfigs2[bg].bg_y;
@@ -818,9 +765,10 @@ u32 GetBgY(u8 bg)
{
if (IsInvalidBg32(bg) != FALSE)
return -1;
- if (GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0)
+ else if (GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0)
return -1;
- return sGpuBgConfigs2[bg].bg_y;
+ else
+ return sGpuBgConfigs2[bg].bg_y;
}
void SetBgAffine(u8 bg, u32 srcCenterX, u32 srcCenterY, s16 dispCenterX, s16 dispCenterY, s16 scaleX, s16 scaleY, u16 rotationAngle)
@@ -842,57 +790,57 @@ u8 Unused_AdjustBgMosaic(u8 a1, u8 a2)
switch (a2)
{
- case 0:
- default:
- test1 = a1 & 0xF;
- test2 = a1 >> 0x4;
- break;
- case 1:
- test1 = a1 & 0xF;
- break;
- case 2:
- if ((test1 + a1) > 0xF)
- {
- test1 = 0xF;
- }
- else
- {
- test1 += a1;
- }
- break;
- case 3:
- if ((test1 - a1) < 0)
- {
- test1 = 0x0;
- }
- else
- {
- test1 -= a1;
- }
- break;
- case 4:
- test2 = a1 & 0xF;
- break;
- case 5:
- if ((test2 + a1) > 0xF)
- {
- test2 = 0xF;
- }
- else
- {
- test2 += a1;
- }
- break;
- case 6:
- if ((test2 - a1) < 0)
- {
- test2 = 0x0;
- }
- else
- {
- test2 -= a1;
- }
- break;
+ case 0:
+ default:
+ test1 = a1 & 0xF;
+ test2 = a1 >> 0x4;
+ break;
+ case 1:
+ test1 = a1 & 0xF;
+ break;
+ case 2:
+ if ((test1 + a1) > 0xF)
+ {
+ test1 = 0xF;
+ }
+ else
+ {
+ test1 += a1;
+ }
+ break;
+ case 3:
+ if ((test1 - a1) < 0)
+ {
+ test1 = 0x0;
+ }
+ else
+ {
+ test1 -= a1;
+ }
+ break;
+ case 4:
+ test2 = a1 & 0xF;
+ break;
+ case 5:
+ if ((test2 + a1) > 0xF)
+ {
+ test2 = 0xF;
+ }
+ else
+ {
+ test2 += a1;
+ }
+ break;
+ case 6:
+ if ((test2 - a1) < 0)
+ {
+ test2 = 0x0;
+ }
+ else
+ {
+ test2 -= a1;
+ }
+ break;
}
result |= ((test2 << 0x4) & 0xF0);
@@ -923,9 +871,10 @@ void* GetBgTilemapBuffer(u8 bg)
{
if (IsInvalidBg32(bg) != FALSE)
return NULL;
- if (GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0)
+ else if (GetBgControlAttribute(bg, BG_CTRL_ATTR_VISIBLE) == 0)
return NULL;
- return sGpuBgConfigs2[bg].tilemap;
+ else
+ return sGpuBgConfigs2[bg].tilemap;
}
void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset)
@@ -933,13 +882,9 @@ void CopyToBgTilemapBuffer(u8 bg, const void *src, u16 mode, u16 destOffset)
if (IsInvalidBg32(bg) == FALSE && IsTileMapOutsideWram(bg) == FALSE)
{
if (mode != 0)
- {
CpuCopy16(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)), mode);
- }
else
- {
LZ77UnCompWram(src, (void *)(sGpuBgConfigs2[bg].tilemap + (destOffset * 2)));
- }
}
}
@@ -951,15 +896,15 @@ void CopyBgTilemapBufferToVram(u8 bg)
{
switch (GetBgType(bg))
{
- case 0:
- sizeToLoad = GetBgMetricTextMode(bg, 0) * 0x800;
- break;
- case 1:
- sizeToLoad = GetBgMetricAffineMode(bg, 0) * 0x100;
- break;
- default:
- sizeToLoad = 0;
- break;
+ case 0:
+ sizeToLoad = GetBgMetricTextMode(bg, 0) * 0x800;
+ break;
+ case 1:
+ sizeToLoad = GetBgMetricAffineMode(bg, 0) * 0x100;
+ break;
+ default:
+ sizeToLoad = 0;
+ break;
}
LoadBgVram(bg, sGpuBgConfigs2[bg].tilemap, sizeToLoad, 0, 2);
}
@@ -976,27 +921,27 @@ void CopyToBgTilemapBufferRect(u8 bg, const void* src, u8 destX, u8 destY, u8 wi
{
switch (GetBgType(bg))
{
- case 0:
- srcCopy = src;
- for (destY16 = destY; destY16 < (destY + height); destY16++)
+ case 0:
+ srcCopy = src;
+ for (destY16 = destY; destY16 < (destY + height); destY16++)
+ {
+ for (destX16 = destX; destX16 < (destX + width); destX16++)
{
- for (destX16 = destX; destX16 < (destX + width); destX16++)
- {
- ((u16*)sGpuBgConfigs2[bg].tilemap)[((destY16 * 0x20) + destX16)] = *((u16*)srcCopy)++;
- }
+ ((u16*)sGpuBgConfigs2[bg].tilemap)[((destY16 * 0x20) + destX16)] = *((u16*)srcCopy)++;
}
- break;
- case 1:
- srcCopy = src;
- mode = GetBgMetricAffineMode(bg, 0x1);
- for (destY16 = destY; destY16 < (destY + height); destY16++)
+ }
+ break;
+ case 1:
+ srcCopy = src;
+ mode = GetBgMetricAffineMode(bg, 0x1);
+ for (destY16 = destY; destY16 < (destY + height); destY16++)
+ {
+ for (destX16 = destX; destX16 < (destX + width); destX16++)
{
- for (destX16 = destX; destX16 < (destX + width); destX16++)
- {
- ((u8*)sGpuBgConfigs2[bg].tilemap)[((destY16 * mode) + destX16)] = *((u8*)srcCopy)++;
- }
+ ((u8*)sGpuBgConfigs2[bg].tilemap)[((destY16 * mode) + destX16)] = *((u8*)srcCopy)++;
}
- break;
+ }
+ break;
}
}
}
@@ -1005,295 +950,49 @@ void CopyToBgTilemapBufferRect_ChangePalette(u8 bg, const void *src, u8 destX, u
{
CopyRectToBgTilemapBufferRect(bg, src, 0, 0, rectWidth, rectHeight, destX, destY, rectWidth, rectHeight, palette, 0, 0);
}
-// Skipping for now, it probably uses structs passed by value
-/*
-void CopyRectToBgTilemapBufferRect(u8 bg, const void* src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2)
-{
- u16 attribute;
- u16 mode;
- u16 mode2;
- void* srcCopy;
- u16 destX16;
- u16 destY16;
+void CopyRectToBgTilemapBufferRect(u8 bg, const void *src, u8 srcX, u8 srcY, u8 srcWidth, u8 unused, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, s16 palette1, s16 tileOffset)
+{
+ u16 screenWidth, screenHeight, screenSize;
+ u16 var;
+ const void *srcPtr;
+ u16 i, j;
- if (IsInvalidBg32(bg) == FALSE && IsTileMapOutsideWram(bg) == FALSE)
+ if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg))
{
- attribute = GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE);
- mode = GetBgMetricTextMode(bg, 0x1) * 0x20;
- mode2 = GetBgMetricTextMode(bg, 0x2) * 0x20;
+ screenSize = GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE);
+ screenWidth = GetBgMetricTextMode(bg, 0x1) * 0x20;
+ screenHeight = GetBgMetricTextMode(bg, 0x2) * 0x20;
switch (GetBgType(bg))
{
- case 0:
- srcCopy = src;
- for (destY16 = destY; destY16 < (destY + rectHeight); destY16++)
+ case 0:
+ srcPtr = src + ((srcY * srcWidth) + srcX) * 2;
+ for (i = destX; i < (destX + rectWidth); i++)
+ {
+ for (j = srcHeight; j < (srcHeight + destY); j++)
{
- for (destX16 = destX; destX16 < (destX + rectWidth); destX16++)
- {
- CopyTileMapEntry(&((u16*)srcCopy)[(srcY * rectWidth) + srcX], &((u16*)sGpuBgConfigs2[bg].tilemap)[GetTileMapIndexFromCoords(destX16, destY16, attribute, mode, mode2)], palette1, tileOffset, palette2);
- }
+ u16 index = GetTileMapIndexFromCoords(j, i, screenSize, screenWidth, screenHeight);
+ CopyTileMapEntry(srcPtr, sGpuBgConfigs2[bg].tilemap + (index * 2), rectHeight, palette1, tileOffset);
+ srcPtr += 2;
}
- break;
- case 1:
- srcCopy = src;
- mode = GetBgMetricAffineMode(bg, 0x1);
- for (destY16 = destY; destY16 < (destY + rectHeight); destY16++)
+ srcPtr += (srcWidth - destY) * 2;
+ }
+ break;
+ case 1:
+ srcPtr = src + ((srcY * srcWidth) + srcX);
+ var = GetBgMetricAffineMode(bg, 0x1);
+ for (i = destX; i < (destX + rectWidth); i++)
+ {
+ for (j = srcHeight; j < (srcHeight + destY); j++)
{
- for (destX16 = destX; destX16 < (destX + rectWidth); destX16++)
- {
- CopyTileMapEntry(&((u16*)srcCopy)[(srcY * rectWidth) + srcX], &((u16*)sGpuBgConfigs2[bg].tilemap)[GetTileMapIndexFromCoords(destX16, destY16, attribute, mode, mode2)], palette1, tileOffset, palette2);
- }
+ *(u8*)(sGpuBgConfigs2[bg].tilemap + ((var * i) + j)) = *(u8*)(srcPtr) + palette1;
+ srcPtr++;
}
- break;
+ srcPtr += (srcWidth - destY);
+ }
+ break;
}
}
-}*/
-NAKED
-void CopyRectToBgTilemapBufferRect(u8 bg, const void* src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2)
-{
- asm("push {r4-r7,lr}\n\
- mov r7, r10\n\
- mov r6, r9\n\
- mov r5, r8\n\
- push {r5-r7}\n\
- sub sp, #0x40\n\
- str r1, [sp, #0x8]\n\
- ldr r1, [sp, #0x60]\n\
- ldr r4, [sp, #0x68]\n\
- ldr r5, [sp, #0x6C]\n\
- ldr r6, [sp, #0x70]\n\
- ldr r7, [sp, #0x74]\n\
- mov r8, r7\n\
- ldr r7, [sp, #0x78]\n\
- mov r9, r7\n\
- ldr r7, [sp, #0x7C]\n\
- mov r10, r7\n\
- ldr r7, [sp, #0x80]\n\
- mov r12, r7\n\
- lsl r0, #24\n\
- lsr r0, #24\n\
- str r0, [sp, #0x4]\n\
- lsl r2, #24\n\
- lsr r2, #24\n\
- str r2, [sp, #0xC]\n\
- lsl r3, #24\n\
- lsr r3, #24\n\
- str r3, [sp, #0x10]\n\
- lsl r1, #24\n\
- lsr r7, r1, #24\n\
- lsl r4, #24\n\
- lsr r4, #24\n\
- str r4, [sp, #0x14]\n\
- lsl r5, #24\n\
- lsr r5, #24\n\
- lsl r6, #24\n\
- lsr r6, #24\n\
- str r6, [sp, #0x18]\n\
- mov r0, r8\n\
- lsl r0, #24\n\
- lsr r4, r0, #24\n\
- mov r1, r9\n\
- lsl r1, #24\n\
- lsr r1, #24\n\
- str r1, [sp, #0x1C]\n\
- mov r2, r10\n\
- lsl r2, #16\n\
- lsr r2, #16\n\
- str r2, [sp, #0x20]\n\
- mov r0, r12\n\
- lsl r0, #16\n\
- lsr r0, #16\n\
- str r0, [sp, #0x24]\n\
- ldr r0, [sp, #0x4]\n\
- bl IsInvalidBg32\n\
- cmp r0, #0\n\
- beq _08002592\n\
- b _080026EE\n\
-_08002592:\n\
- ldr r0, [sp, #0x4]\n\
- bl IsTileMapOutsideWram\n\
- cmp r0, #0\n\
- beq _0800259E\n\
- b _080026EE\n\
-_0800259E:\n\
- ldr r0, [sp, #0x4]\n\
- mov r1, #0x4\n\
- bl GetBgControlAttribute\n\
- lsl r0, #16\n\
- lsr r0, #16\n\
- str r0, [sp, #0x30]\n\
- ldr r0, [sp, #0x4]\n\
- mov r1, #0x1\n\
- bl GetBgMetricTextMode\n\
- lsl r0, #21\n\
- lsr r0, #16\n\
- str r0, [sp, #0x28]\n\
- ldr r0, [sp, #0x4]\n\
- mov r1, #0x2\n\
- bl GetBgMetricTextMode\n\
- lsl r0, #21\n\
- lsr r0, #16\n\
- str r0, [sp, #0x2C]\n\
- ldr r0, [sp, #0x4]\n\
- bl GetBgType\n\
- cmp r0, #0\n\
- beq _080025D8\n\
- cmp r0, #0x1\n\
- beq _08002674\n\
- b _080026EE\n\
-_080025D8:\n\
- ldr r1, [sp, #0x10]\n\
- add r0, r1, #0\n\
- mul r0, r7\n\
- ldr r2, [sp, #0xC]\n\
- add r0, r2\n\
- lsl r0, #1\n\
- ldr r1, [sp, #0x8]\n\
- add r6, r1, r0\n\
- add r0, r5, r4\n\
- cmp r5, r0\n\
- blt _080025F0\n\
- b _080026EE\n\
-_080025F0:\n\
- ldr r2, [sp, #0x18]\n\
- sub r2, r7, r2\n\
- str r2, [sp, #0x34]\n\
- str r0, [sp, #0x38]\n\
-_080025F8:\n\
- ldr r4, [sp, #0x14]\n\
- ldr r7, [sp, #0x18]\n\
- add r0, r4, r7\n\
- add r1, r5, #0x1\n\
- str r1, [sp, #0x3C]\n\
- cmp r4, r0\n\
- bge _0800265A\n\
- ldr r2, [sp, #0x4]\n\
- lsl r0, r2, #4\n\
- ldr r1, =sGpuBgConfigs2+4\n\
- add r0, r1\n\
- mov r10, r0\n\
- ldr r7, [sp, #0x20]\n\
- lsl r7, #16\n\
- mov r9, r7\n\
- ldr r1, [sp, #0x24]\n\
- lsl r0, r1, #16\n\
- asr r0, #16\n\
- mov r8, r0\n\
-_0800261E:\n\
- ldr r2, [sp, #0x2C]\n\
- str r2, [sp]\n\
- add r0, r4, #0\n\
- add r1, r5, #0\n\
- ldr r2, [sp, #0x30]\n\
- ldr r3, [sp, #0x28]\n\
- bl GetTileMapIndexFromCoords\n\
- lsl r0, #16\n\
- lsr r0, #15\n\
- mov r7, r10\n\
- ldr r1, [r7]\n\
- add r1, r0\n\
- mov r0, r8\n\
- str r0, [sp]\n\
- add r0, r6, #0\n\
- ldr r2, [sp, #0x1C]\n\
- mov r7, r9\n\
- asr r3, r7, #16\n\
- bl CopyTileMapEntry\n\
- add r6, #0x2\n\
- add r0, r4, #0x1\n\
- lsl r0, #16\n\
- lsr r4, r0, #16\n\
- ldr r1, [sp, #0x14]\n\
- ldr r2, [sp, #0x18]\n\
- add r0, r1, r2\n\
- cmp r4, r0\n\
- blt _0800261E\n\
-_0800265A:\n\
- ldr r5, [sp, #0x34]\n\
- lsl r0, r5, #1\n\
- add r6, r0\n\
- ldr r7, [sp, #0x3C]\n\
- lsl r0, r7, #16\n\
- lsr r5, r0, #16\n\
- ldr r0, [sp, #0x38]\n\
- cmp r5, r0\n\
- blt _080025F8\n\
- b _080026EE\n\
- .pool\n\
-_08002674:\n\
- ldr r1, [sp, #0x10]\n\
- add r0, r1, #0\n\
- mul r0, r7\n\
- ldr r2, [sp, #0xC]\n\
- add r0, r2\n\
- ldr r1, [sp, #0x8]\n\
- add r6, r1, r0\n\
- ldr r0, [sp, #0x4]\n\
- mov r1, #0x1\n\
- bl GetBgMetricAffineMode\n\
- lsl r0, #16\n\
- lsr r0, #16\n\
- mov r9, r0\n\
- add r0, r5, r4\n\
- cmp r5, r0\n\
- bge _080026EE\n\
- ldr r2, [sp, #0x18]\n\
- sub r2, r7, r2\n\
- str r2, [sp, #0x34]\n\
- str r0, [sp, #0x38]\n\
- ldr r7, =sGpuBgConfigs2+4\n\
- mov r10, r7\n\
- ldr r0, [sp, #0x4]\n\
- lsl r0, #4\n\
- mov r8, r0\n\
-_080026A8:\n\
- ldr r4, [sp, #0x14]\n\
- ldr r1, [sp, #0x18]\n\
- add r0, r4, r1\n\
- add r2, r5, #0x1\n\
- str r2, [sp, #0x3C]\n\
- cmp r4, r0\n\
- bge _080026DE\n\
- mov r3, r8\n\
- add r3, r10\n\
- mov r7, r9\n\
- mul r7, r5\n\
- mov r12, r7\n\
- add r2, r0, #0\n\
-_080026C2:\n\
- ldr r1, [r3]\n\
- mov r5, r12\n\
- add r0, r5, r4\n\
- add r1, r0\n\
- ldrb r0, [r6]\n\
- ldr r7, [sp, #0x20]\n\
- add r0, r7\n\
- strb r0, [r1]\n\
- add r6, #0x1\n\
- add r0, r4, #0x1\n\
- lsl r0, #16\n\
- lsr r4, r0, #16\n\
- cmp r4, r2\n\
- blt _080026C2\n\
-_080026DE:\n\
- ldr r0, [sp, #0x34]\n\
- add r6, r0\n\
- ldr r1, [sp, #0x3C]\n\
- lsl r0, r1, #16\n\
- lsr r5, r0, #16\n\
- ldr r2, [sp, #0x38]\n\
- cmp r5, r2\n\
- blt _080026A8\n\
-_080026EE:\n\
- add sp, #0x40\n\
- pop {r3-r5}\n\
- mov r8, r3\n\
- mov r9, r4\n\
- mov r10, r5\n\
- pop {r4-r7}\n\
- pop {r0}\n\
- bx r0\n\
- .pool\n");
}
void FillBgTilemapBufferRect_Palette0(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height)
@@ -1384,42 +1083,42 @@ u16 GetBgMetricTextMode(u8 bg, u8 whichMetric)
switch (whichMetric)
{
+ case 0:
+ switch (attribute)
+ {
case 0:
- switch (attribute)
- {
- case 0:
- return 1;
- case 1:
- case 2:
- return 2;
- case 3:
- return 4;
- }
- break;
+ return 1;
case 1:
- switch (attribute)
- {
- case 0:
- return 1;
- case 1:
- return 2;
- case 2:
- return 1;
- case 3:
- return 2;
- }
- break;
case 2:
- switch (attribute)
- {
- case 0:
- case 1:
- return 1;
- case 2:
- case 3:
- return 2;
- }
- break;
+ return 2;
+ case 3:
+ return 4;
+ }
+ break;
+ case 1:
+ switch (attribute)
+ {
+ case 0:
+ return 1;
+ case 1:
+ return 2;
+ case 2:
+ return 1;
+ case 3:
+ return 2;
+ }
+ break;
+ case 2:
+ switch (attribute)
+ {
+ case 0:
+ case 1:
+ return 1;
+ case 2:
+ case 3:
+ return 2;
+ }
+ break;
}
return 0;
}
@@ -1432,22 +1131,22 @@ u32 GetBgMetricAffineMode(u8 bg, u8 whichMetric)
switch (whichMetric)
{
+ case 0:
+ switch (attribute)
+ {
case 0:
- switch (attribute)
- {
- case 0:
- return 0x1;
- case 1:
- return 0x4;
- case 2:
- return 0x10;
- case 3:
- return 0x40;
- }
- break;
+ return 0x1;
case 1:
+ return 0x4;
case 2:
- return 0x10 << attribute;
+ return 0x10;
+ case 3:
+ return 0x40;
+ }
+ break;
+ case 1:
+ case 2:
+ return 0x10 << attribute;
}
return 0;
}
@@ -1459,44 +1158,45 @@ u32 GetTileMapIndexFromCoords(s32 x, s32 y, s32 screenSize, u32 screenWidth, u32
switch (screenSize)
{
- case 0:
- case 2:
- break;
- case 3:
- if (y >= 0x20)
- y += 0x20;
- case 1:
- if (x >= 0x20)
- {
- x -= 0x20;
- y += 0x20;
- }
+ case 0:
+ case 2:
+ break;
+ case 3:
+ if (y >= 0x20)
+ y += 0x20;
+ case 1:
+ if (x >= 0x20)
+ {
+ x -= 0x20;
+ y += 0x20;
+ }
+ break;
}
return (y * 0x20) + x;
}
#ifdef NONMATCHING // This one has some weird switch statement cases that refuse to cooperate
-void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u32 tileOffset, u32 palette2)
+void CopyTileMapEntry(const u16 *src, u16 *dest, s32 palette1, s32 tileOffset, s32 palette2)
{
- u16 test;
+ u16 var;
switch (palette1)
{
- default:
- if (palette1 > 0x10 || palette1 < 0)
- test = *src + tileOffset + (palette2 << 12);
- else
- test = ((*src + tileOffset) & 0xFFF) + ((palette1 + palette2) << 12);
- break;
- case 0x10:
- test = ((*dest & 0xFC00) + (palette2 << 12)) | ((*src + tileOffset) & 0x3FF);
- break;
+ case 0 ... 16:
+ if (palette1 != 16)
+ var = ((*src + tileOffset) & 0xFFF) + ((palette1 + palette2) << 12);
+ else
+ var = ((*dest & 0xFC00) + (palette2 << 12)) | ((*src + tileOffset) & 0x3FF);
+ break;
+ default:
+ var = *src + tileOffset + (palette2 << 12);
+ break;
}
- *dest = test;
+ *dest = var;
}
#else
NAKED
-void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u32 tileOffset, u32 palette2)
+void CopyTileMapEntry(const u16 *src, u16 *dest, s32 palette1, s32 tileOffset, s32 palette2)
{
asm("push {r4-r6,lr}\n\
add r4, r0, #0\n\
@@ -1550,41 +1250,38 @@ _08002B3C:\n\
u32 GetBgType(u8 bg)
{
- u8 mode;
-
- mode = GetBgMode();
-
+ u8 mode = GetBgMode();
switch (bg)
{
+ case 0:
+ case 1:
+ switch (mode)
+ {
case 0:
case 1:
- switch (mode)
- {
- case 0:
- case 1:
- return 0;
- }
- break;
+ return 0;
+ }
+ break;
+ case 2:
+ switch (mode)
+ {
+ case 0:
+ return 0;
+ case 1:
case 2:
- switch (mode)
- {
- case 0:
- return 0;
- case 1:
- case 2:
- return 1;
- }
- break;
- case 3:
- switch (mode)
- {
- case 0:
- return 0;
- case 2:
- return 1;
- }
- break;
+ return 1;
+ }
+ break;
+ case 3:
+ switch (mode)
+ {
+ case 0:
+ return 0;
+ case 2:
+ return 1;
+ }
+ break;
}
return 0xFFFF;
@@ -1594,14 +1291,16 @@ bool32 IsInvalidBg32(u8 bg)
{
if (bg > 3)
return TRUE;
- return FALSE;
+ else
+ return FALSE;
}
bool32 IsTileMapOutsideWram(u8 bg)
{
if (sGpuBgConfigs2[bg].tilemap > (void*)IWRAM_END)
return TRUE;
- if (sGpuBgConfigs2[bg].tilemap == 0x0)
+ else if (sGpuBgConfigs2[bg].tilemap == NULL)
return TRUE;
- return FALSE;
+ else
+ return FALSE;
}
diff --git a/src/bug.c b/src/bug.c
index a14ec2226..59b31b37d 100644
--- a/src/bug.c
+++ b/src/bug.c
@@ -1,15 +1,22 @@
#include "global.h"
#include "battle_anim.h"
+#include "gpu_regs.h"
+#include "trig.h"
#include "constants/rgb.h"
-extern void sub_8110368(struct Sprite *);
-extern void sub_8110438(struct Sprite *);
-extern void sub_81104E4(struct Sprite *);
-extern void sub_81105B4(struct Sprite *);
-extern void sub_811067C(struct Sprite *);
-extern void sub_8110720(struct Sprite *);
-extern void sub_8110850(struct Sprite *);
-extern void sub_8110994(struct Sprite *);
+void sub_8110368(struct Sprite *);
+void sub_8110438(struct Sprite *);
+void sub_81104E4(struct Sprite *);
+void sub_81105B4(struct Sprite *);
+void sub_811067C(struct Sprite *);
+void AnimTranslateStinger(struct Sprite *);
+void AnimMissileArc(struct Sprite *);
+void sub_8110994(struct Sprite *);
+static void sub_811057C(struct Sprite *);
+static void sub_8110630(struct Sprite *);
+static void sub_81106A4(struct Sprite *);
+static void sub_8110700(struct Sprite *);
+static void AnimMissileArcStep(struct Sprite *);
const union AffineAnimCmd gUnknown_08596938[] =
{
@@ -136,7 +143,7 @@ const struct SpriteTemplate gLinearStingerSpriteTemplate =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_8110720,
+ .callback = AnimTranslateStinger,
};
const struct SpriteTemplate gPinMissileSpriteTemplate =
@@ -147,7 +154,7 @@ const struct SpriteTemplate gPinMissileSpriteTemplate =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_8110850,
+ .callback = AnimMissileArc,
};
const struct SpriteTemplate gIcicleSpearSpriteTemplate =
@@ -158,7 +165,7 @@ const struct SpriteTemplate gIcicleSpearSpriteTemplate =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_8110850,
+ .callback = AnimMissileArc,
};
const union AffineAnimCmd gUnknown_08596A8C[] =
@@ -187,3 +194,291 @@ const struct SpriteTemplate gUnknown_08596AC8 =
.affineAnims = gUnknown_08596AC4,
.callback = sub_8110994,
};
+
+void sub_8110368(struct Sprite *sprite)
+{
+ if (IsContest())
+ {
+ StartSpriteAffineAnim(sprite, 2);
+ gBattleAnimArgs[2] = -gBattleAnimArgs[2];
+ gBattleAnimArgs[0] = -gBattleAnimArgs[0];
+ }
+ else if (!GetBattlerSide(gBattleAnimTarget))
+ {
+ StartSpriteAffineAnim(sprite, 1);
+ gBattleAnimArgs[1] = -gBattleAnimArgs[1];
+ gBattleAnimArgs[2] = -gBattleAnimArgs[2];
+ gBattleAnimArgs[3] = -gBattleAnimArgs[3];
+ gBattleAnimArgs[0] = -gBattleAnimArgs[0];
+ }
+
+ sprite->pos1.x = GetBattlerSpriteCoord2(gBattleAnimTarget, 2) + gBattleAnimArgs[0];
+ sprite->pos1.y = GetBattlerSpriteCoord2(gBattleAnimTarget, 3) + gBattleAnimArgs[1];
+ sprite->data[0] = gBattleAnimArgs[4];
+
+ sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[2];
+ sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[3];
+
+ sprite->callback = StartAnimLinearTranslation;
+ StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
+}
+
+void sub_8110438(struct Sprite *sprite)
+{
+ if (IsContest())
+ {
+ gBattleAnimArgs[0] = -gBattleAnimArgs[0];
+ StartSpriteAffineAnim(sprite, 2);
+ }
+ else if (!GetBattlerSide(gBattleAnimTarget))
+ {
+ gBattleAnimArgs[1] = -gBattleAnimArgs[1];
+ gBattleAnimArgs[0] = -gBattleAnimArgs[0];
+ }
+
+ sprite->pos1.x = GetBattlerSpriteCoord2(gBattleAnimTarget, 2) + gBattleAnimArgs[0];
+ sprite->pos1.y = GetBattlerSpriteCoord2(gBattleAnimTarget, 3) + gBattleAnimArgs[1];
+ sprite->data[0] = gBattleAnimArgs[2];
+
+ sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
+ sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
+
+ sprite->callback = StartAnimLinearTranslation;
+ StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
+}
+
+void sub_81104E4(struct Sprite *sprite)
+{
+ if (IsContest())
+ gBattleAnimArgs[2] /= 2;
+
+ InitAnimSpritePos(sprite, 1);
+ sprite->data[0] = gBattleAnimArgs[2];
+ sprite->data[1] = sprite->pos1.x;
+ sprite->data[3] = sprite->pos1.y;
+
+ if (!gBattleAnimArgs[4])
+ {
+ sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
+ sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
+ }
+ else
+ {
+ SetAverageBattlerPositions(gBattleAnimTarget, 1, &sprite->data[2], &sprite->data[4]);
+ }
+
+ sub_80A6FD4(sprite);
+ sprite->data[5] = gBattleAnimArgs[3];
+ sprite->callback = sub_811057C;
+}
+
+static void sub_811057C(struct Sprite *sprite)
+{
+ if (TranslateAnimLinear(sprite))
+ {
+ DestroyAnimSprite(sprite);
+ return;
+ }
+
+ sprite->pos2.x += Sin(sprite->data[6], sprite->data[5]);
+ sprite->data[6] = (sprite->data[6] + 13) & 0xFF;
+}
+
+void sub_81105B4(struct Sprite *sprite)
+{
+ SetAverageBattlerPositions(gBattleAnimTarget, 0, &sprite->pos1.x, &sprite->pos1.y);
+ if (GetBattlerSide(gBattleAnimAttacker))
+ sprite->pos1.x -= gBattleAnimArgs[0];
+ else
+ sprite->pos1.x += gBattleAnimArgs[0];
+
+ sprite->pos1.y += gBattleAnimArgs[1];
+ if (!GetBattlerSide(gBattleAnimTarget))
+ sprite->pos1.y += 8;
+
+ sprite->callback = sub_8110630;
+}
+
+static void sub_8110630(struct Sprite *sprite)
+{
+ if (++sprite->data[0] == 3)
+ {
+ sprite->data[0] = 0;
+ sprite->invisible ^= 1;
+ }
+
+ if (++sprite->data[1] == 51)
+ {
+ DestroyAnimSprite(sprite);
+ }
+}
+
+void sub_811067C(struct Sprite *sprite)
+{
+ SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND);
+ SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 0));
+
+ sprite->data[0] = 16;
+ sprite->callback = sub_81106A4;
+}
+
+static void sub_81106A4(struct Sprite *sprite)
+{
+ if (sprite->data[2] < 20)
+ {
+ sprite->data[2]++;
+ }
+ else if (sprite->data[1]++ & 1)
+ {
+ sprite->data[0]--;
+ SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(sprite->data[0], 16 - sprite->data[0]));
+
+ if (sprite->data[0] == 0)
+ {
+ sprite->invisible = TRUE;
+ sprite->callback = sub_8110700;
+ }
+ }
+}
+
+static void sub_8110700(struct Sprite *sprite)
+{
+ SetGpuReg(REG_OFFSET_BLDCNT, 0);
+ SetGpuReg(REG_OFFSET_BLDALPHA, 0);
+ DestroyAnimSprite(sprite);
+}
+
+// Translates a stinger sprite linearly to a destination location. The sprite is
+// initially rotated so that it appears to be traveling in a straight line.
+// arg 0: initial x pixel offset
+// arg 1: initial y pixel offset
+// arg 2: target x pixel offset
+// arg 3: target y pixel offset
+// arg 4: duration
+void AnimTranslateStinger(struct Sprite *sprite)
+{
+ s16 lVarX, lVarY;
+ u16 rot;
+
+ if (IsContest())
+ {
+ gBattleAnimArgs[2] = -gBattleAnimArgs[2];
+ }
+ else
+ {
+ if (GetBattlerSide(gBattleAnimAttacker))
+ {
+ gBattleAnimArgs[2] = -gBattleAnimArgs[2];
+ gBattleAnimArgs[1] = -gBattleAnimArgs[1];
+ gBattleAnimArgs[3] = -gBattleAnimArgs[3];
+ }
+ }
+
+ if (!IsContest() && GetBattlerSide(gBattleAnimAttacker) == GetBattlerSide(gBattleAnimTarget))
+ {
+ if (GetBattlerPosition(gBattleAnimTarget) == B_POSITION_PLAYER_LEFT
+ || GetBattlerPosition(gBattleAnimTarget) == B_POSITION_OPPONENT_LEFT)
+ {
+ s16 temp1, temp2;
+
+ temp1 = gBattleAnimArgs[2];
+ gBattleAnimArgs[2] = -temp1;
+
+ temp2 = gBattleAnimArgs[0];
+ gBattleAnimArgs[0] = -temp2;
+ }
+ }
+
+ InitAnimSpritePos(sprite, 1);
+
+ lVarX = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[2];
+ lVarY = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[3];
+ rot = ArcTan2Neg(lVarX - sprite->pos1.x, lVarY - sprite->pos1.y);
+ rot += 0xC000;
+ sub_80A73E0(sprite, FALSE, 0x100, 0x100, rot);
+
+ sprite->data[0] = gBattleAnimArgs[4];
+ sprite->data[2] = lVarX;
+ sprite->data[4] = lVarY;
+
+ sprite->callback = StartAnimLinearTranslation;
+ StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
+}
+
+// Rotates sprite and moves it in an arc, so that it appears like a missle or arrow traveling.
+// arg 0: initial x pixel offset
+// arg 1: initial y pixel offset
+// arg 2: target x pixel offset
+// arg 3: target y pixel offset
+// arg 4: duration
+// arg 5: wave amplitude
+void AnimMissileArc(struct Sprite *sprite)
+{
+ InitAnimSpritePos(sprite, 1);
+
+ if (GetBattlerSide(gBattleAnimAttacker))
+ gBattleAnimArgs[2] = -gBattleAnimArgs[2];
+
+ sprite->data[0] = gBattleAnimArgs[4];
+ sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[2];
+ sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[3];
+ sprite->data[5] = gBattleAnimArgs[5];
+ InitAnimArcTranslation(sprite);
+
+ sprite->callback = AnimMissileArcStep;
+ sprite->invisible = TRUE;
+}
+
+static void AnimMissileArcStep(struct Sprite *sprite)
+{
+ sprite->invisible = FALSE;
+
+ if (TranslateAnimArc(sprite))
+ {
+ DestroyAnimSprite(sprite);
+ }
+ else
+ {
+ s16 tempData[8];
+ u16 *data = sprite->data;
+ u16 x1 = sprite->pos1.x;
+ s16 x2 = sprite->pos2.x;
+ u16 y1 = sprite->pos1.y;
+ s16 y2 = sprite->pos2.y;
+ int i;
+
+ for (i = 0; i < 8; i++)
+ tempData[i] = data[i];
+
+ x2 += x1;
+ y2 += y1;
+
+ if (!TranslateAnimArc(sprite))
+ {
+ u16 rotation = ArcTan2Neg(sprite->pos1.x + sprite->pos2.x - x2,
+ sprite->pos1.y + sprite->pos2.y - y2);
+ rotation += 0xC000;
+ sub_80A73E0(sprite, FALSE, 0x100, 0x100, rotation);
+
+ for (i = 0; i < 8; i++)
+ data[i] = tempData[i];
+ }
+ }
+}
+
+void sub_8110994(struct Sprite *sprite)
+{
+ if (gBattleAnimArgs[0] == 0)
+ {
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + 18;
+ }
+ else
+ {
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + 18;
+ }
+
+ StoreSpriteCallbackInData6(sprite, move_anim_8074EE0);
+ sprite->callback = sub_80A67BC;
+}
diff --git a/src/cable_club.c b/src/cable_club.c
index b0e5f0500..56154d5bf 100644
--- a/src/cable_club.c
+++ b/src/cable_club.c
@@ -31,7 +31,7 @@
#include "constants/songs.h"
extern u8 gUnknown_02032298[2];
-extern u8 gUnknown_0203CEF8[];
+extern u8 gSelectedOrderFromParty[];
static const struct WindowTemplate gUnknown_08550594 = {
.bg = 0,
@@ -358,8 +358,8 @@ static void sub_80B2918(u8 taskId)
sub_800AA04(gFieldLinkPlayerCount);
card = (struct TrainerCard *)gBlockSendBuffer;
TrainerCard_GenerateCardForPlayer(card);
- card->monSpecies[0] = GetMonData(&gPlayerParty[gUnknown_0203CEF8[0] - 1], MON_DATA_SPECIES, NULL);
- card->monSpecies[1] = GetMonData(&gPlayerParty[gUnknown_0203CEF8[1] - 1], MON_DATA_SPECIES, NULL);
+ card->monSpecies[0] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[0] - 1], MON_DATA_SPECIES, NULL);
+ card->monSpecies[1] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[1] - 1], MON_DATA_SPECIES, NULL);
gTasks[taskId].func = sub_80B2C30;
}
}
@@ -405,8 +405,8 @@ static void sub_80B2A08(u8 taskId)
sub_800AA04(gFieldLinkPlayerCount);
card = (struct TrainerCard *)gBlockSendBuffer;
TrainerCard_GenerateCardForPlayer(card);
- card->monSpecies[0] = GetMonData(&gPlayerParty[gUnknown_0203CEF8[0] - 1], MON_DATA_SPECIES, NULL);
- card->monSpecies[1] = GetMonData(&gPlayerParty[gUnknown_0203CEF8[1] - 1], MON_DATA_SPECIES, NULL);
+ card->monSpecies[0] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[0] - 1], MON_DATA_SPECIES, NULL);
+ card->monSpecies[1] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[1] - 1], MON_DATA_SPECIES, NULL);
gTasks[taskId].func = sub_80B2C30;
sub_800A4D8(2);
}
@@ -800,7 +800,7 @@ static void sub_80B3260(int a0)
gBattleTypeFlags = BATTLE_TYPE_DOUBLE | BATTLE_TYPE_LINK | BATTLE_TYPE_TRAINER;
break;
case 5:
- ReducePlayerPartyToThree();
+ ReducePlayerPartyToSelectedMons();
gBattleTypeFlags = BATTLE_TYPE_DOUBLE | BATTLE_TYPE_LINK | BATTLE_TYPE_TRAINER | BATTLE_TYPE_MULTI;
break;
case 9:
diff --git a/src/clear_save_data_screen.c b/src/clear_save_data_screen.c
index 8da8502b3..72d0daf55 100644
--- a/src/clear_save_data_screen.c
+++ b/src/clear_save_data_screen.c
@@ -10,6 +10,7 @@
#include "bg.h"
#include "text_window.h"
#include "constants/songs.h"
+#include "constants/rgb.h"
extern const u8 gText_ClearAllSaveData[];
extern const u8 gText_ClearingData[];
@@ -72,7 +73,7 @@ static const struct WindowTemplate sClearSaveYesNo[] =
void CB2_InitClearSaveDataScreen(void)
{
- if(SetupClearSaveDataScreen())
+ if (SetupClearSaveDataScreen())
CreateTask(Task_DoClearSaveDataScreenYesNo, 0);
}
@@ -86,18 +87,18 @@ static void Task_DoClearSaveDataScreenYesNo(u8 taskId)
static void Task_ClearSaveDataScreenYesNoChoice(u8 taskId)
{
- switch(Menu_ProcessInputNoWrapClearOnChoose())
+ switch (Menu_ProcessInputNoWrapClearOnChoose())
{
- case 0:
- FillWindowPixelBuffer(0, 17);
- AddTextPrinterParameterized(0, 1, gText_ClearingData, 0, 1, 0, 0);
- gTasks[taskId].func = Task_ClearSaveData;
- break;
- case 1:
- case -1:
- PlaySE(SE_SELECT);
- DestroyTask(taskId);
- SetMainCallback2(CB2_FadeAndDoReset);
+ case 0:
+ FillWindowPixelBuffer(0, 17);
+ AddTextPrinterParameterized(0, 1, gText_ClearingData, 0, 1, 0, 0);
+ gTasks[taskId].func = Task_ClearSaveData;
+ break;
+ case 1:
+ case -1:
+ PlaySE(SE_SELECT);
+ DestroyTask(taskId);
+ SetMainCallback2(CB2_FadeAndDoReset);
}
}
@@ -125,55 +126,55 @@ static bool8 SetupClearSaveDataScreen(void)
switch(gMain.state)
{
- case 0:
- default:
- SetVBlankCallback(NULL);
- SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0);
- SetGpuReg(REG_OFFSET_BG0HOFS, 0);
- SetGpuReg(REG_OFFSET_BG0VOFS, 0);
- SetGpuReg(REG_OFFSET_BG3HOFS, 0);
- SetGpuReg(REG_OFFSET_BG3VOFS, 0);
- SetGpuReg(REG_OFFSET_WIN0H, 0);
- SetGpuReg(REG_OFFSET_WIN0V, 0);
- SetGpuReg(REG_OFFSET_WININ, 0);
- SetGpuReg(REG_OFFSET_WINOUT, 0);
- SetGpuReg(REG_OFFSET_BLDCNT, 0);
- SetGpuReg(REG_OFFSET_BLDALPHA, 0);
- SetGpuReg(REG_OFFSET_BLDY, 0);
- DmaFill16(3, 0, (void *)VRAM, VRAM_SIZE);
- DmaFill32(3, 0, (void *)OAM, OAM_SIZE);
- DmaFill16(3, 0, (void *)(PLTT + 2), PLTT_SIZE - 2);
- ResetPaletteFade();
- gPlttBufferUnfaded[0] = 0x7fff;
- gPlttBufferFaded[0] = 0x7fff;
- gPlttBufferUnfaded[1] = 0x3945;
- gPlttBufferFaded[1] = 0x3945;
- for (i = 0; i < 0x10; i++)
- ((u16 *)(VRAM + 0x20))[i] = 0x1111;
-
- for (i = 0; i < 0x400; i++)
- ((u16 *)(VRAM + 0xF000))[i] = 0x0001;
- ResetTasks();
- ResetSpriteData();
- ResetBgsAndClearDma3BusyFlags(0);
- InitBgsFromTemplates(0, sClearSaveBgTemplates, ARRAY_COUNT(sClearSaveBgTemplates));
- SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
- ShowBg(0);
- ShowBg(3);
- SetGpuReg(REG_OFFSET_BLDCNT, 0);
- InitClearSaveDataScreenWindows();
- BeginNormalPaletteFade(0x0000FFFF, 0, 0x10, 0, 0xFFFF);
- EnableInterrupts(1);
- SetVBlankCallback(VBlankCB);
- gMain.state = 1;
- break;
- case 1:
- UpdatePaletteFade();
- if(!gPaletteFade.active)
- {
- SetMainCallback2(MainCB);
- return TRUE;
- }
+ case 0:
+ default:
+ SetVBlankCallback(NULL);
+ SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0);
+ SetGpuReg(REG_OFFSET_BG0HOFS, 0);
+ SetGpuReg(REG_OFFSET_BG0VOFS, 0);
+ SetGpuReg(REG_OFFSET_BG3HOFS, 0);
+ SetGpuReg(REG_OFFSET_BG3VOFS, 0);
+ SetGpuReg(REG_OFFSET_WIN0H, 0);
+ SetGpuReg(REG_OFFSET_WIN0V, 0);
+ SetGpuReg(REG_OFFSET_WININ, 0);
+ SetGpuReg(REG_OFFSET_WINOUT, 0);
+ SetGpuReg(REG_OFFSET_BLDCNT, 0);
+ SetGpuReg(REG_OFFSET_BLDALPHA, 0);
+ SetGpuReg(REG_OFFSET_BLDY, 0);
+ DmaFill16(3, 0, (void *)VRAM, VRAM_SIZE);
+ DmaFill32(3, 0, (void *)OAM, OAM_SIZE);
+ DmaFill16(3, 0, (void *)(PLTT + 2), PLTT_SIZE - 2);
+ ResetPaletteFade();
+ gPlttBufferUnfaded[0] = RGB_WHITE;
+ gPlttBufferFaded[0] = RGB_WHITE;
+ gPlttBufferUnfaded[1] = RGB(5, 10, 14);
+ gPlttBufferFaded[1] = RGB(5, 10, 14);
+ for (i = 0; i < 0x10; i++)
+ ((u16 *)(VRAM + 0x20))[i] = 0x1111;
+
+ for (i = 0; i < 0x400; i++)
+ ((u16 *)(VRAM + 0xF000))[i] = 0x0001;
+ ResetTasks();
+ ResetSpriteData();
+ ResetBgsAndClearDma3BusyFlags(0);
+ InitBgsFromTemplates(0, sClearSaveBgTemplates, ARRAY_COUNT(sClearSaveBgTemplates));
+ SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
+ ShowBg(0);
+ ShowBg(3);
+ SetGpuReg(REG_OFFSET_BLDCNT, 0);
+ InitClearSaveDataScreenWindows();
+ BeginNormalPaletteFade(0x0000FFFF, 0, 0x10, 0, 0xFFFF);
+ EnableInterrupts(INTR_FLAG_VBLANK);
+ SetVBlankCallback(VBlankCB);
+ gMain.state = 1;
+ break;
+ case 1:
+ UpdatePaletteFade();
+ if(!gPaletteFade.active)
+ {
+ SetMainCallback2(MainCB);
+ return TRUE;
+ }
}
return FALSE;
}
@@ -182,18 +183,19 @@ static void CB2_FadeAndDoReset(void)
{
switch(gMain.state)
{
- case 0:
- default:
- BeginNormalPaletteFade(0x0000FFFF, 0, 0, 0x10, 0xFFFF);
- gMain.state = 1;
- break;
- case 1:
- UpdatePaletteFade();
- if(!gPaletteFade.active)
- {
- FreeAllWindowBuffers();
- DoSoftReset();
- }
+ case 0:
+ default:
+ BeginNormalPaletteFade(0x0000FFFF, 0, 0, 0x10, RGB_WHITEALPHA);
+ gMain.state = 1;
+ break;
+ case 1:
+ UpdatePaletteFade();
+ if(!gPaletteFade.active)
+ {
+ FreeAllWindowBuffers();
+ DoSoftReset();
+ }
+ break;
}
}
diff --git a/src/contest.c b/src/contest.c
index 76e13781c..0c3a041b0 100644
--- a/src/contest.c
+++ b/src/contest.c
@@ -193,19 +193,6 @@ EWRAM_DATA struct ContestWinner gUnknown_02039F3C = {0};
u32 gContestRngValue;
-extern u16 gBattle_BG0_X;
-extern u16 gBattle_BG0_Y;
-extern u16 gBattle_BG1_X;
-extern s16 gBattle_BG1_Y;
-extern u16 gBattle_BG2_X;
-extern u16 gBattle_BG2_Y;
-extern u16 gBattle_BG3_X;
-extern u16 gBattle_BG3_Y;
-extern u16 gBattle_WIN0H;
-extern u16 gBattle_WIN0V;
-extern u16 gBattle_WIN1H;
-extern u16 gBattle_WIN1V;
-
extern const u16 gUnknown_08587C30[];
extern const struct BgTemplate gUnknown_08587F34[4];
extern const struct WindowTemplate gUnknown_08587F44[];
@@ -638,7 +625,8 @@ void sub_80D8108(u8 taskId)
gTasks[taskId].data[0]++;
break;
case 1:
- if ((gBattle_BG1_Y += 7) <= 160)
+ (s16)gBattle_BG1_Y += 7;
+ if ((s16)gBattle_BG1_Y <= 160)
break;
gTasks[taskId].data[0]++;
break;
@@ -1915,9 +1903,9 @@ void sub_80DA6B4(u8 taskId)
void sub_80DA700(u8 taskId)
{
gBattle_BG1_Y -= 7;
- if (gBattle_BG1_Y < 0)
+ if ((s16)gBattle_BG1_Y < 0)
gBattle_BG1_Y = 0;
- if (*(u16 *)&gBattle_BG1_Y == 0) // Why cast?
+ if (gBattle_BG1_Y == 0) // Why cast?
{
gTasks[taskId].func = sub_80DA740;
gTasks[taskId].data[0] = 0;
diff --git a/src/contest_ai.c b/src/contest_ai.c
index 3324ddf87..1342ea102 100644
--- a/src/contest_ai.c
+++ b/src/contest_ai.c
@@ -4,8 +4,6 @@
#include "contest_ai.h"
#include "contest_effect.h"
-extern u16 gContestMonConditions[];
-
extern const u8 *gAIScriptPtr;
extern const u8 *gContestAIs[];
diff --git a/src/contest_painting.c b/src/contest_painting.c
new file mode 100644
index 000000000..7950b7cac
--- /dev/null
+++ b/src/contest_painting.c
@@ -0,0 +1,8 @@
+#include "global.h"
+
+// IWRAM bss
+IWRAM_DATA u8 gUnknown_030011F0;
+IWRAM_DATA u16 gUnknown_030011F2;
+IWRAM_DATA u16 gUnknown_030011F4;
+IWRAM_DATA u8 gUnknown_030011F6;
+IWRAM_DATA u8 gUnknown_030011F7;
diff --git a/src/data/pokemon/pokedex_entries.h b/src/data/pokemon/pokedex_entries.h
new file mode 100644
index 000000000..acf6506bd
--- /dev/null
+++ b/src/data/pokemon/pokedex_entries.h
@@ -0,0 +1,3873 @@
+const struct PokedexEntry gPokedexEntries[] =
+{
+ { //Dummy
+ .categoryName = _("UNKNOWN"),
+ .height = 0,
+ .weight = 0,
+ .description = gDummyPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Bulbasaur
+ .categoryName = _("SEED"),
+ .height = 7,
+ .weight = 69,
+ .description = gBulbasaurPokedexText,
+ .pokemonScale = 356,
+ .pokemonOffset = 17,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Ivysaur
+ .categoryName = _("SEED"),
+ .height = 10,
+ .weight = 130,
+ .description = gIvysaurPokedexText,
+ .pokemonScale = 335,
+ .pokemonOffset = 13,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Venusaur
+ .categoryName = _("SEED"),
+ .height = 20,
+ .weight = 1000,
+ .description = gVenusaurPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 388,
+ .trainerOffset = 6,
+ },
+ { //Charmander
+ .categoryName = _("LIZARD"),
+ .height = 6,
+ .weight = 85,
+ .description = gCharmanderPokedexText,
+ .pokemonScale = 444,
+ .pokemonOffset = 18,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Charmeleon
+ .categoryName = _("FLAME"),
+ .height = 11,
+ .weight = 190,
+ .description = gCharmeleonPokedexText,
+ .pokemonScale = 302,
+ .pokemonOffset = 9,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Charizard
+ .categoryName = _("FLAME"),
+ .height = 17,
+ .weight = 905,
+ .description = gCharizardPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 1,
+ .trainerScale = 302,
+ .trainerOffset = 3,
+ },
+ { //Squirtle
+ .categoryName = _("TINY TURTLE"),
+ .height = 5,
+ .weight = 90,
+ .description = gSquirtlePokedexText,
+ .pokemonScale = 412,
+ .pokemonOffset = 18,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Wartortle
+ .categoryName = _("TURTLE"),
+ .height = 10,
+ .weight = 225,
+ .description = gWartortlePokedexText,
+ .pokemonScale = 332,
+ .pokemonOffset = 10,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Blastoise
+ .categoryName = _("SHELLFISH"),
+ .height = 16,
+ .weight = 855,
+ .description = gBlastoisePokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = -1,
+ .trainerScale = 293,
+ .trainerOffset = 2,
+ },
+ { //Caterpie
+ .categoryName = _("WORM"),
+ .height = 3,
+ .weight = 29,
+ .description = gCaterpiePokedexText,
+ .pokemonScale = 549,
+ .pokemonOffset = 22,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Metapod
+ .categoryName = _("COCOON"),
+ .height = 7,
+ .weight = 99,
+ .description = gMetapodPokedexText,
+ .pokemonScale = 350,
+ .pokemonOffset = 18,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Butterfree
+ .categoryName = _("BUTTERFLY"),
+ .height = 11,
+ .weight = 320,
+ .description = gButterfreePokedexText,
+ .pokemonScale = 312,
+ .pokemonOffset = 2,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Weedle
+ .categoryName = _("HAIRY BUG"),
+ .height = 3,
+ .weight = 32,
+ .description = gWeedlePokedexText,
+ .pokemonScale = 455,
+ .pokemonOffset = 22,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Kakuna
+ .categoryName = _("COCOON"),
+ .height = 6,
+ .weight = 100,
+ .description = gKakunaPokedexText,
+ .pokemonScale = 424,
+ .pokemonOffset = 17,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Beedrill
+ .categoryName = _("POISON BEE"),
+ .height = 10,
+ .weight = 295,
+ .description = gBeedrillPokedexText,
+ .pokemonScale = 366,
+ .pokemonOffset = 2,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Pidgey
+ .categoryName = _("TINY BIRD"),
+ .height = 3,
+ .weight = 18,
+ .description = gPidgeyPokedexText,
+ .pokemonScale = 508,
+ .pokemonOffset = -3,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Pidgeotto
+ .categoryName = _("BIRD"),
+ .height = 11,
+ .weight = 300,
+ .description = gPidgeottoPokedexText,
+ .pokemonScale = 331,
+ .pokemonOffset = 10,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Pidgeot
+ .categoryName = _("BIRD"),
+ .height = 15,
+ .weight = 395,
+ .description = gPidgeotPokedexText,
+ .pokemonScale = 269,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Rattata
+ .categoryName = _("MOUSE"),
+ .height = 3,
+ .weight = 35,
+ .description = gRattataPokedexText,
+ .pokemonScale = 481,
+ .pokemonOffset = 21,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Raticate
+ .categoryName = _("MOUSE"),
+ .height = 7,
+ .weight = 185,
+ .description = gRaticatePokedexText,
+ .pokemonScale = 459,
+ .pokemonOffset = 18,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Spearow
+ .categoryName = _("TINY BIRD"),
+ .height = 3,
+ .weight = 20,
+ .description = gSpearowPokedexText,
+ .pokemonScale = 571,
+ .pokemonOffset = 22,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Fearow
+ .categoryName = _("BEAK"),
+ .height = 12,
+ .weight = 380,
+ .description = gFearowPokedexText,
+ .pokemonScale = 278,
+ .pokemonOffset = 1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Ekans
+ .categoryName = _("SNAKE"),
+ .height = 20,
+ .weight = 69,
+ .description = gEkansPokedexText,
+ .pokemonScale = 298,
+ .pokemonOffset = 12,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Arbok
+ .categoryName = _("COBRA"),
+ .height = 35,
+ .weight = 650,
+ .description = gArbokPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 296,
+ .trainerOffset = 2,
+ },
+ { //Pikachu
+ .categoryName = _("MOUSE"),
+ .height = 4,
+ .weight = 60,
+ .description = gPikachuPokedexText,
+ .pokemonScale = 479,
+ .pokemonOffset = 19,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Raichu
+ .categoryName = _("MOUSE"),
+ .height = 8,
+ .weight = 300,
+ .description = gRaichuPokedexText,
+ .pokemonScale = 426,
+ .pokemonOffset = 13,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Sandshrew
+ .categoryName = _("MOUSE"),
+ .height = 6,
+ .weight = 120,
+ .description = gSandshrewPokedexText,
+ .pokemonScale = 365,
+ .pokemonOffset = 18,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Sandslash
+ .categoryName = _("MOUSE"),
+ .height = 10,
+ .weight = 295,
+ .description = gSandslashPokedexText,
+ .pokemonScale = 341,
+ .pokemonOffset = 11,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //NidoranF
+ .categoryName = _("POISON PIN"),
+ .height = 4,
+ .weight = 70,
+ .description = gNidoranFPokedexText,
+ .pokemonScale = 488,
+ .pokemonOffset = 21,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Nidorina
+ .categoryName = _("POISON PIN"),
+ .height = 8,
+ .weight = 200,
+ .description = gNidorinaPokedexText,
+ .pokemonScale = 381,
+ .pokemonOffset = 15,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Nidoqueen
+ .categoryName = _("DRILL"),
+ .height = 13,
+ .weight = 600,
+ .description = gNidoqueenPokedexText,
+ .pokemonScale = 293,
+ .pokemonOffset = 4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //NidoranM
+ .categoryName = _("POISON PIN"),
+ .height = 5,
+ .weight = 90,
+ .description = gNidoranMPokedexText,
+ .pokemonScale = 511,
+ .pokemonOffset = 20,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Nidorino
+ .categoryName = _("POISON PIN"),
+ .height = 9,
+ .weight = 195,
+ .description = gNidorinoPokedexText,
+ .pokemonScale = 408,
+ .pokemonOffset = 15,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Nidoking
+ .categoryName = _("DRILL"),
+ .height = 14,
+ .weight = 620,
+ .description = gNidokingPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Clefairy
+ .categoryName = _("FAIRY"),
+ .height = 6,
+ .weight = 75,
+ .description = gClefairyPokedexText,
+ .pokemonScale = 441,
+ .pokemonOffset = 20,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Clefable
+ .categoryName = _("FAIRY"),
+ .height = 13,
+ .weight = 400,
+ .description = gClefablePokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 5,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Vulpix
+ .categoryName = _("FOX"),
+ .height = 6,
+ .weight = 99,
+ .description = gVulpixPokedexText,
+ .pokemonScale = 542,
+ .pokemonOffset = 19,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Ninetales
+ .categoryName = _("FOX"),
+ .height = 11,
+ .weight = 199,
+ .description = gNinetalesPokedexText,
+ .pokemonScale = 339,
+ .pokemonOffset = 10,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Jigglypuff
+ .categoryName = _("BALLOON"),
+ .height = 5,
+ .weight = 55,
+ .description = gJigglypuffPokedexText,
+ .pokemonScale = 433,
+ .pokemonOffset = 2,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Wigglytuff
+ .categoryName = _("BALLOON"),
+ .height = 10,
+ .weight = 120,
+ .description = gWigglytuffPokedexText,
+ .pokemonScale = 328,
+ .pokemonOffset = 11,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Zubat
+ .categoryName = _("BAT"),
+ .height = 8,
+ .weight = 75,
+ .description = gZubatPokedexText,
+ .pokemonScale = 362,
+ .pokemonOffset = -5,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Golbat
+ .categoryName = _("BAT"),
+ .height = 16,
+ .weight = 550,
+ .description = gGolbatPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Oddish
+ .categoryName = _("WEED"),
+ .height = 5,
+ .weight = 54,
+ .description = gOddishPokedexText,
+ .pokemonScale = 423,
+ .pokemonOffset = 19,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Gloom
+ .categoryName = _("WEED"),
+ .height = 8,
+ .weight = 86,
+ .description = gGloomPokedexText,
+ .pokemonScale = 329,
+ .pokemonOffset = 13,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Vileplume
+ .categoryName = _("FLOWER"),
+ .height = 12,
+ .weight = 186,
+ .description = gVileplumePokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Paras
+ .categoryName = _("MUSHROOM"),
+ .height = 3,
+ .weight = 54,
+ .description = gParasPokedexText,
+ .pokemonScale = 593,
+ .pokemonOffset = 22,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Parasect
+ .categoryName = _("MUSHROOM"),
+ .height = 10,
+ .weight = 295,
+ .description = gParasectPokedexText,
+ .pokemonScale = 307,
+ .pokemonOffset = 8,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Venonat
+ .categoryName = _("INSECT"),
+ .height = 10,
+ .weight = 300,
+ .description = gVenonatPokedexText,
+ .pokemonScale = 360,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = -1,
+ },
+ { //Venomoth
+ .categoryName = _("POISON MOTH"),
+ .height = 15,
+ .weight = 125,
+ .description = gVenomothPokedexText,
+ .pokemonScale = 285,
+ .pokemonOffset = 2,
+ .trainerScale = 256,
+ .trainerOffset = 1,
+ },
+ { //Diglett
+ .categoryName = _("MOLE"),
+ .height = 2,
+ .weight = 8,
+ .description = gDiglettPokedexText,
+ .pokemonScale = 833,
+ .pokemonOffset = 25,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Dugtrio
+ .categoryName = _("MOLE"),
+ .height = 7,
+ .weight = 333,
+ .description = gDugtrioPokedexText,
+ .pokemonScale = 406,
+ .pokemonOffset = 18,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Meowth
+ .categoryName = _("SCRATCH CAT"),
+ .height = 4,
+ .weight = 42,
+ .description = gMeowthPokedexText,
+ .pokemonScale = 480,
+ .pokemonOffset = 19,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Persian
+ .categoryName = _("CLASSY CAT"),
+ .height = 10,
+ .weight = 320,
+ .description = gPersianPokedexText,
+ .pokemonScale = 320,
+ .pokemonOffset = 10,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Psyduck
+ .categoryName = _("DUCK"),
+ .height = 8,
+ .weight = 196,
+ .description = gPsyduckPokedexText,
+ .pokemonScale = 369,
+ .pokemonOffset = 15,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Golduck
+ .categoryName = _("DUCK"),
+ .height = 17,
+ .weight = 766,
+ .description = gGolduckPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 1,
+ .trainerScale = 273,
+ .trainerOffset = 1,
+ },
+ { //Mankey
+ .categoryName = _("PIG MONKEY"),
+ .height = 5,
+ .weight = 280,
+ .description = gMankeyPokedexText,
+ .pokemonScale = 404,
+ .pokemonOffset = 19,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Primeape
+ .categoryName = _("PIG MONKEY"),
+ .height = 10,
+ .weight = 320,
+ .description = gPrimeapePokedexText,
+ .pokemonScale = 326,
+ .pokemonOffset = 10,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Growlithe
+ .categoryName = _("PUPPY"),
+ .height = 7,
+ .weight = 190,
+ .description = gGrowlithePokedexText,
+ .pokemonScale = 346,
+ .pokemonOffset = 14,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Arcanine
+ .categoryName = _("LEGENDARY"),
+ .height = 19,
+ .weight = 1550,
+ .description = gArcaninePokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 1,
+ .trainerScale = 312,
+ .trainerOffset = 4,
+ },
+ { //Poliwag
+ .categoryName = _("TADPOLE"),
+ .height = 6,
+ .weight = 124,
+ .description = gPoliwagPokedexText,
+ .pokemonScale = 369,
+ .pokemonOffset = 20,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Poliwhirl
+ .categoryName = _("TADPOLE"),
+ .height = 10,
+ .weight = 200,
+ .description = gPoliwhirlPokedexText,
+ .pokemonScale = 288,
+ .pokemonOffset = 11,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Poliwrath
+ .categoryName = _("TADPOLE"),
+ .height = 13,
+ .weight = 540,
+ .description = gPoliwrathPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 6,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Abra
+ .categoryName = _("PSI"),
+ .height = 9,
+ .weight = 195,
+ .description = gAbraPokedexText,
+ .pokemonScale = 363,
+ .pokemonOffset = 14,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Kadabra
+ .categoryName = _("PSI"),
+ .height = 13,
+ .weight = 565,
+ .description = gKadabraPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 3,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Alakazam
+ .categoryName = _("PSI"),
+ .height = 15,
+ .weight = 480,
+ .description = gAlakazamPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 3,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Machop
+ .categoryName = _("SUPERPOWER"),
+ .height = 8,
+ .weight = 195,
+ .description = gMachopPokedexText,
+ .pokemonScale = 342,
+ .pokemonOffset = 14,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Machoke
+ .categoryName = _("SUPERPOWER"),
+ .height = 15,
+ .weight = 705,
+ .description = gMachokePokedexText,
+ .pokemonScale = 323,
+ .pokemonOffset = 9,
+ .trainerScale = 257,
+ .trainerOffset = 0,
+ },
+ { //Machamp
+ .categoryName = _("SUPERPOWER"),
+ .height = 16,
+ .weight = 1300,
+ .description = gMachampPokedexText,
+ .pokemonScale = 280,
+ .pokemonOffset = 1,
+ .trainerScale = 269,
+ .trainerOffset = -1,
+ },
+ { //Bellsprout
+ .categoryName = _("FLOWER"),
+ .height = 7,
+ .weight = 40,
+ .description = gBellsproutPokedexText,
+ .pokemonScale = 354,
+ .pokemonOffset = 16,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Weepinbell
+ .categoryName = _("FLYCATCHER"),
+ .height = 10,
+ .weight = 64,
+ .description = gWeepinbellPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Victreebel
+ .categoryName = _("FLYCATCHER"),
+ .height = 17,
+ .weight = 155,
+ .description = gVictreebelPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 1,
+ .trainerScale = 312,
+ .trainerOffset = 3,
+ },
+ { //Tentacool
+ .categoryName = _("JELLYFISH"),
+ .height = 9,
+ .weight = 455,
+ .description = gTentacoolPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Tentacruel
+ .categoryName = _("JELLYFISH"),
+ .height = 16,
+ .weight = 550,
+ .description = gTentacruelPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 312,
+ .trainerOffset = 1,
+ },
+ { //Geodude
+ .categoryName = _("ROCK"),
+ .height = 4,
+ .weight = 200,
+ .description = gGeodudePokedexText,
+ .pokemonScale = 347,
+ .pokemonOffset = 18,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Graveler
+ .categoryName = _("ROCK"),
+ .height = 10,
+ .weight = 1050,
+ .description = gGravelerPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 2,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Golem
+ .categoryName = _("MEGATON"),
+ .height = 14,
+ .weight = 3000,
+ .description = gGolemPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 3,
+ .trainerScale = 296,
+ .trainerOffset = 2,
+ },
+ { //Ponyta
+ .categoryName = _("FIRE HORSE"),
+ .height = 10,
+ .weight = 300,
+ .description = gPonytaPokedexText,
+ .pokemonScale = 283,
+ .pokemonOffset = 8,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Rapidash
+ .categoryName = _("FIRE HORSE"),
+ .height = 17,
+ .weight = 950,
+ .description = gRapidashPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 289,
+ .trainerOffset = 1,
+ },
+ { //Slowpoke
+ .categoryName = _("DOPEY"),
+ .height = 12,
+ .weight = 360,
+ .description = gSlowpokePokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 10,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Slowbro
+ .categoryName = _("HERMIT CRAB"),
+ .height = 16,
+ .weight = 785,
+ .description = gSlowbroPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 6,
+ .trainerScale = 296,
+ .trainerOffset = 2,
+ },
+ { //Magnemite
+ .categoryName = _("MAGNET"),
+ .height = 3,
+ .weight = 60,
+ .description = gMagnemitePokedexText,
+ .pokemonScale = 288,
+ .pokemonOffset = -9,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Magneton
+ .categoryName = _("MAGNET"),
+ .height = 10,
+ .weight = 600,
+ .description = gMagnetonPokedexText,
+ .pokemonScale = 292,
+ .pokemonOffset = 1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Farfetchd
+ .categoryName = _("WILD DUCK"),
+ .height = 8,
+ .weight = 150,
+ .description = gFarfetchdPokedexText,
+ .pokemonScale = 330,
+ .pokemonOffset = 2,
+ .trainerScale = 293,
+ .trainerOffset = 2,
+ },
+ { //Doduo
+ .categoryName = _("TWIN BIRD"),
+ .height = 14,
+ .weight = 392,
+ .description = gDoduoPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 3,
+ .trainerScale = 257,
+ .trainerOffset = -1,
+ },
+ { //Dodrio
+ .categoryName = _("TRIPLE BIRD"),
+ .height = 18,
+ .weight = 852,
+ .description = gDodrioPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 268,
+ .trainerOffset = 0,
+ },
+ { //Seel
+ .categoryName = _("SEA LION"),
+ .height = 11,
+ .weight = 900,
+ .description = gSeelPokedexText,
+ .pokemonScale = 297,
+ .pokemonOffset = 8,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Dewgong
+ .categoryName = _("SEA LION"),
+ .height = 17,
+ .weight = 1200,
+ .description = gDewgongPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 275,
+ .trainerOffset = 0,
+ },
+ { //Grimer
+ .categoryName = _("SLUDGE"),
+ .height = 9,
+ .weight = 300,
+ .description = gGrimerPokedexText,
+ .pokemonScale = 258,
+ .pokemonOffset = 10,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Muk
+ .categoryName = _("SLUDGE"),
+ .height = 12,
+ .weight = 300,
+ .description = gMukPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 2,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Shellder
+ .categoryName = _("BIVALVE"),
+ .height = 3,
+ .weight = 40,
+ .description = gShellderPokedexText,
+ .pokemonScale = 675,
+ .pokemonOffset = 24,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Cloyster
+ .categoryName = _("BIVALVE"),
+ .height = 15,
+ .weight = 1325,
+ .description = gCloysterPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 269,
+ .trainerOffset = 1,
+ },
+ { //Gastly
+ .categoryName = _("GAS"),
+ .height = 13,
+ .weight = 1,
+ .description = gGastlyPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Haunter
+ .categoryName = _("GAS"),
+ .height = 16,
+ .weight = 1,
+ .description = gHaunterPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 2,
+ .trainerScale = 293,
+ .trainerOffset = 2,
+ },
+ { //Gengar
+ .categoryName = _("SHADOW"),
+ .height = 15,
+ .weight = 405,
+ .description = gGengarPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 2,
+ .trainerScale = 302,
+ .trainerOffset = 2,
+ },
+ { //Onix
+ .categoryName = _("ROCK SNAKE"),
+ .height = 88,
+ .weight = 2100,
+ .description = gOnixPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 1,
+ .trainerScale = 515,
+ .trainerOffset = 14,
+ },
+ { //Drowzee
+ .categoryName = _("HYPNOSIS"),
+ .height = 10,
+ .weight = 324,
+ .description = gDrowzeePokedexText,
+ .pokemonScale = 274,
+ .pokemonOffset = 6,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Hypno
+ .categoryName = _("HYPNOSIS"),
+ .height = 16,
+ .weight = 756,
+ .description = gHypnoPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 3,
+ .trainerScale = 257,
+ .trainerOffset = 0,
+ },
+ { //Krabby
+ .categoryName = _("RIVER CRAB"),
+ .height = 4,
+ .weight = 65,
+ .description = gKrabbyPokedexText,
+ .pokemonScale = 469,
+ .pokemonOffset = 20,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Kingler
+ .categoryName = _("PINCER"),
+ .height = 13,
+ .weight = 600,
+ .description = gKinglerPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 2,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Voltorb
+ .categoryName = _("BALL"),
+ .height = 5,
+ .weight = 104,
+ .description = gVoltorbPokedexText,
+ .pokemonScale = 364,
+ .pokemonOffset = -8,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Electrode
+ .categoryName = _("BALL"),
+ .height = 12,
+ .weight = 666,
+ .description = gElectrodePokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Exeggcute
+ .categoryName = _("EGG"),
+ .height = 4,
+ .weight = 25,
+ .description = gExeggcutePokedexText,
+ .pokemonScale = 489,
+ .pokemonOffset = -4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Exeggutor
+ .categoryName = _("COCONUT"),
+ .height = 20,
+ .weight = 1200,
+ .description = gExeggutorPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 309,
+ .trainerOffset = 5,
+ },
+ { //Cubone
+ .categoryName = _("LONELY"),
+ .height = 4,
+ .weight = 65,
+ .description = gCubonePokedexText,
+ .pokemonScale = 545,
+ .pokemonOffset = 21,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Marowak
+ .categoryName = _("BONE KEEPER"),
+ .height = 10,
+ .weight = 450,
+ .description = gMarowakPokedexText,
+ .pokemonScale = 293,
+ .pokemonOffset = 12,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Hitmonlee
+ .categoryName = _("KICKING"),
+ .height = 15,
+ .weight = 498,
+ .description = gHitmonleePokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 3,
+ .trainerScale = 259,
+ .trainerOffset = 1,
+ },
+ { //Hitmonchan
+ .categoryName = _("PUNCHING"),
+ .height = 14,
+ .weight = 502,
+ .description = gHitmonchanPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 2,
+ .trainerScale = 277,
+ .trainerOffset = 2,
+ },
+ { //Lickitung
+ .categoryName = _("LICKING"),
+ .height = 12,
+ .weight = 655,
+ .description = gLickitungPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Koffing
+ .categoryName = _("POISON GAS"),
+ .height = 6,
+ .weight = 10,
+ .description = gKoffingPokedexText,
+ .pokemonScale = 369,
+ .pokemonOffset = -1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Weezing
+ .categoryName = _("POISON GAS"),
+ .height = 12,
+ .weight = 95,
+ .description = gWeezingPokedexText,
+ .pokemonScale = 305,
+ .pokemonOffset = 3,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Rhyhorn
+ .categoryName = _("SPIKES"),
+ .height = 10,
+ .weight = 1150,
+ .description = gRhyhornPokedexText,
+ .pokemonScale = 267,
+ .pokemonOffset = 6,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Rhydon
+ .categoryName = _("DRILL"),
+ .height = 19,
+ .weight = 1200,
+ .description = gRhydonPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 1,
+ .trainerScale = 299,
+ .trainerOffset = 2,
+ },
+ { //Chansey
+ .categoryName = _("EGG"),
+ .height = 11,
+ .weight = 346,
+ .description = gChanseyPokedexText,
+ .pokemonScale = 257,
+ .pokemonOffset = 7,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Tangela
+ .categoryName = _("VINE"),
+ .height = 10,
+ .weight = 350,
+ .description = gTangelaPokedexText,
+ .pokemonScale = 304,
+ .pokemonOffset = 1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Kangaskhan
+ .categoryName = _("PARENT"),
+ .height = 22,
+ .weight = 800,
+ .description = gKangaskhanPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 387,
+ .trainerOffset = 8,
+ },
+ { //Horsea
+ .categoryName = _("DRAGON"),
+ .height = 4,
+ .weight = 80,
+ .description = gHorseaPokedexText,
+ .pokemonScale = 399,
+ .pokemonOffset = -1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Seadra
+ .categoryName = _("DRAGON"),
+ .height = 12,
+ .weight = 250,
+ .description = gSeadraPokedexText,
+ .pokemonScale = 299,
+ .pokemonOffset = 3,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Goldeen
+ .categoryName = _("GOLDFISH"),
+ .height = 6,
+ .weight = 150,
+ .description = gGoldeenPokedexText,
+ .pokemonScale = 379,
+ .pokemonOffset = 4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Seaking
+ .categoryName = _("GOLDFISH"),
+ .height = 13,
+ .weight = 390,
+ .description = gSeakingPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 3,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Staryu
+ .categoryName = _("STAR SHAPE"),
+ .height = 8,
+ .weight = 345,
+ .description = gStaryuPokedexText,
+ .pokemonScale = 326,
+ .pokemonOffset = 1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Starmie
+ .categoryName = _("MYSTERIOUS"),
+ .height = 11,
+ .weight = 800,
+ .description = gStarmiePokedexText,
+ .pokemonScale = 301,
+ .pokemonOffset = 3,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Mrmime
+ .categoryName = _("BARRIER"),
+ .height = 13,
+ .weight = 545,
+ .description = gMrmimePokedexText,
+ .pokemonScale = 258,
+ .pokemonOffset = 6,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Scyther
+ .categoryName = _("MANTIS"),
+ .height = 15,
+ .weight = 560,
+ .description = gScytherPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 1,
+ .trainerScale = 293,
+ .trainerOffset = 2,
+ },
+ { //Jynx
+ .categoryName = _("HUMAN SHAPE"),
+ .height = 14,
+ .weight = 406,
+ .description = gJynxPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 3,
+ .trainerScale = 300,
+ .trainerOffset = 1,
+ },
+ { //Electabuzz
+ .categoryName = _("ELECTRIC"),
+ .height = 11,
+ .weight = 300,
+ .description = gElectabuzzPokedexText,
+ .pokemonScale = 351,
+ .pokemonOffset = 8,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Magmar
+ .categoryName = _("SPITFIRE"),
+ .height = 13,
+ .weight = 445,
+ .description = gMagmarPokedexText,
+ .pokemonScale = 277,
+ .pokemonOffset = 5,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Pinsir
+ .categoryName = _("STAG BEETLE"),
+ .height = 15,
+ .weight = 550,
+ .description = gPinsirPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 2,
+ .trainerScale = 257,
+ .trainerOffset = 0,
+ },
+ { //Tauros
+ .categoryName = _("WILD BULL"),
+ .height = 14,
+ .weight = 884,
+ .description = gTaurosPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Magikarp
+ .categoryName = _("FISH"),
+ .height = 9,
+ .weight = 100,
+ .description = gMagikarpPokedexText,
+ .pokemonScale = 310,
+ .pokemonOffset = 4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Gyarados
+ .categoryName = _("ATROCIOUS"),
+ .height = 65,
+ .weight = 2350,
+ .description = gGyaradosPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 6,
+ .trainerScale = 481,
+ .trainerOffset = 13,
+ },
+ { //Lapras
+ .categoryName = _("TRANSPORT"),
+ .height = 25,
+ .weight = 2200,
+ .description = gLaprasPokedexText,
+ .pokemonScale = 257,
+ .pokemonOffset = 10,
+ .trainerScale = 423,
+ .trainerOffset = 8,
+ },
+ { //Ditto
+ .categoryName = _("TRANSFORM"),
+ .height = 3,
+ .weight = 40,
+ .description = gDittoPokedexText,
+ .pokemonScale = 633,
+ .pokemonOffset = 23,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Eevee
+ .categoryName = _("EVOLUTION"),
+ .height = 3,
+ .weight = 65,
+ .description = gEeveePokedexText,
+ .pokemonScale = 476,
+ .pokemonOffset = 18,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Vaporeon
+ .categoryName = _("BUBBLE JET"),
+ .height = 10,
+ .weight = 290,
+ .description = gVaporeonPokedexText,
+ .pokemonScale = 316,
+ .pokemonOffset = 8,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Jolteon
+ .categoryName = _("LIGHTNING"),
+ .height = 8,
+ .weight = 245,
+ .description = gJolteonPokedexText,
+ .pokemonScale = 283,
+ .pokemonOffset = 8,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Flareon
+ .categoryName = _("FLAME"),
+ .height = 9,
+ .weight = 250,
+ .description = gFlareonPokedexText,
+ .pokemonScale = 306,
+ .pokemonOffset = 12,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Porygon
+ .categoryName = _("VIRTUAL"),
+ .height = 8,
+ .weight = 365,
+ .description = gPorygonPokedexText,
+ .pokemonScale = 328,
+ .pokemonOffset = 15,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Omanyte
+ .categoryName = _("SPIRAL"),
+ .height = 4,
+ .weight = 75,
+ .description = gOmanytePokedexText,
+ .pokemonScale = 521,
+ .pokemonOffset = 22,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Omastar
+ .categoryName = _("SPIRAL"),
+ .height = 10,
+ .weight = 350,
+ .description = gOmastarPokedexText,
+ .pokemonScale = 307,
+ .pokemonOffset = 7,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Kabuto
+ .categoryName = _("SHELLFISH"),
+ .height = 5,
+ .weight = 115,
+ .description = gKabutoPokedexText,
+ .pokemonScale = 454,
+ .pokemonOffset = 21,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Kabutops
+ .categoryName = _("SHELLFISH"),
+ .height = 13,
+ .weight = 405,
+ .description = gKabutopsPokedexText,
+ .pokemonScale = 271,
+ .pokemonOffset = 3,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Aerodactyl
+ .categoryName = _("FOSSIL"),
+ .height = 18,
+ .weight = 590,
+ .description = gAerodactylPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 302,
+ .trainerOffset = 4,
+ },
+ { //Snorlax
+ .categoryName = _("SLEEPING"),
+ .height = 21,
+ .weight = 4600,
+ .description = gSnorlaxPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 4,
+ .trainerScale = 423,
+ .trainerOffset = 11,
+ },
+ { //Articuno
+ .categoryName = _("FREEZE"),
+ .height = 17,
+ .weight = 554,
+ .description = gArticunoPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 309,
+ .trainerOffset = 2,
+ },
+ { //Zapdos
+ .categoryName = _("ELECTRIC"),
+ .height = 16,
+ .weight = 526,
+ .description = gZapdosPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 318,
+ .trainerOffset = 3,
+ },
+ { //Moltres
+ .categoryName = _("FLAME"),
+ .height = 20,
+ .weight = 600,
+ .description = gMoltresPokedexText,
+ .pokemonScale = 270,
+ .pokemonOffset = 0,
+ .trainerScale = 387,
+ .trainerOffset = 8,
+ },
+ { //Dratini
+ .categoryName = _("DRAGON"),
+ .height = 18,
+ .weight = 33,
+ .description = gDratiniPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 8,
+ .trainerScale = 386,
+ .trainerOffset = 6,
+ },
+ { //Dragonair
+ .categoryName = _("DRAGON"),
+ .height = 40,
+ .weight = 165,
+ .description = gDragonairPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 411,
+ .trainerOffset = 5,
+ },
+ { //Dragonite
+ .categoryName = _("DRAGON"),
+ .height = 22,
+ .weight = 2100,
+ .description = gDragonitePokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 309,
+ .trainerOffset = 4,
+ },
+ { //Mewtwo
+ .categoryName = _("GENETIC"),
+ .height = 20,
+ .weight = 1220,
+ .description = gMewtwoPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 309,
+ .trainerOffset = 4,
+ },
+ { //Mew
+ .categoryName = _("NEW SPECIES"),
+ .height = 4,
+ .weight = 40,
+ .description = gMewPokedexText,
+ .pokemonScale = 457,
+ .pokemonOffset = -2,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Chikorita
+ .categoryName = _("LEAF"),
+ .height = 9,
+ .weight = 64,
+ .description = gChikoritaPokedexText,
+ .pokemonScale = 512,
+ .pokemonOffset = 20,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Bayleef
+ .categoryName = _("LEAF"),
+ .height = 12,
+ .weight = 158,
+ .description = gBayleefPokedexText,
+ .pokemonScale = 296,
+ .pokemonOffset = 4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Meganium
+ .categoryName = _("HERB"),
+ .height = 18,
+ .weight = 1005,
+ .description = gMeganiumPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 277,
+ .trainerOffset = 1,
+ },
+ { //Cyndaquil
+ .categoryName = _("FIRE MOUSE"),
+ .height = 5,
+ .weight = 79,
+ .description = gCyndaquilPokedexText,
+ .pokemonScale = 539,
+ .pokemonOffset = 21,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Quilava
+ .categoryName = _("VOLCANO"),
+ .height = 9,
+ .weight = 190,
+ .description = gQuilavaPokedexText,
+ .pokemonScale = 329,
+ .pokemonOffset = 11,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Typhlosion
+ .categoryName = _("VOLCANO"),
+ .height = 17,
+ .weight = 795,
+ .description = gTyphlosionPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 268,
+ .trainerOffset = 1,
+ },
+ { //Totodile
+ .categoryName = _("BIG JAW"),
+ .height = 6,
+ .weight = 95,
+ .description = gTotodilePokedexText,
+ .pokemonScale = 487,
+ .pokemonOffset = 20,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Croconaw
+ .categoryName = _("BIG JAW"),
+ .height = 11,
+ .weight = 250,
+ .description = gCroconawPokedexText,
+ .pokemonScale = 378,
+ .pokemonOffset = 13,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Feraligatr
+ .categoryName = _("BIG JAW"),
+ .height = 23,
+ .weight = 888,
+ .description = gFeraligatrPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 342,
+ .trainerOffset = 7,
+ },
+ { //Sentret
+ .categoryName = _("SCOUT"),
+ .height = 8,
+ .weight = 60,
+ .description = gSentretPokedexText,
+ .pokemonScale = 439,
+ .pokemonOffset = 12,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Furret
+ .categoryName = _("LONG BODY"),
+ .height = 18,
+ .weight = 325,
+ .description = gFurretPokedexText,
+ .pokemonScale = 346,
+ .pokemonOffset = 11,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Hoothoot
+ .categoryName = _("OWL"),
+ .height = 7,
+ .weight = 212,
+ .description = gHoothootPokedexText,
+ .pokemonScale = 380,
+ .pokemonOffset = -2,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Noctowl
+ .categoryName = _("OWL"),
+ .height = 16,
+ .weight = 408,
+ .description = gNoctowlPokedexText,
+ .pokemonScale = 278,
+ .pokemonOffset = 3,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Ledyba
+ .categoryName = _("FIVE STAR"),
+ .height = 10,
+ .weight = 108,
+ .description = gLedybaPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Ledian
+ .categoryName = _("FIVE STAR"),
+ .height = 14,
+ .weight = 356,
+ .description = gLedianPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 2,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Spinarak
+ .categoryName = _("STRING SPIT"),
+ .height = 5,
+ .weight = 85,
+ .description = gSpinarakPokedexText,
+ .pokemonScale = 414,
+ .pokemonOffset = 21,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Ariados
+ .categoryName = _("LONG LEG"),
+ .height = 11,
+ .weight = 335,
+ .description = gAriadosPokedexText,
+ .pokemonScale = 316,
+ .pokemonOffset = 8,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Crobat
+ .categoryName = _("BAT"),
+ .height = 18,
+ .weight = 750,
+ .description = gCrobatPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 281,
+ .trainerOffset = 1,
+ },
+ { //Chinchou
+ .categoryName = _("ANGLER"),
+ .height = 5,
+ .weight = 120,
+ .description = gChinchouPokedexText,
+ .pokemonScale = 424,
+ .pokemonOffset = -2,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Lanturn
+ .categoryName = _("LIGHT"),
+ .height = 12,
+ .weight = 225,
+ .description = gLanturnPokedexText,
+ .pokemonScale = 269,
+ .pokemonOffset = 6,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Pichu
+ .categoryName = _("TINY MOUSE"),
+ .height = 3,
+ .weight = 20,
+ .description = gPichuPokedexText,
+ .pokemonScale = 508,
+ .pokemonOffset = 20,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Cleffa
+ .categoryName = _("STAR SHAPE"),
+ .height = 3,
+ .weight = 30,
+ .description = gCleffaPokedexText,
+ .pokemonScale = 462,
+ .pokemonOffset = 23,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Igglybuff
+ .categoryName = _("BALLOON"),
+ .height = 3,
+ .weight = 10,
+ .description = gIgglybuffPokedexText,
+ .pokemonScale = 457,
+ .pokemonOffset = -1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Togepi
+ .categoryName = _("SPIKE BALL"),
+ .height = 3,
+ .weight = 15,
+ .description = gTogepiPokedexText,
+ .pokemonScale = 507,
+ .pokemonOffset = 23,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Togetic
+ .categoryName = _("HAPPINESS"),
+ .height = 6,
+ .weight = 32,
+ .description = gTogeticPokedexText,
+ .pokemonScale = 424,
+ .pokemonOffset = 17,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Natu
+ .categoryName = _("TINY BIRD"),
+ .height = 2,
+ .weight = 20,
+ .description = gNatuPokedexText,
+ .pokemonScale = 610,
+ .pokemonOffset = 25,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Xatu
+ .categoryName = _("MYSTIC"),
+ .height = 15,
+ .weight = 150,
+ .description = gXatuPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 6,
+ .trainerScale = 318,
+ .trainerOffset = 4,
+ },
+ { //Mareep
+ .categoryName = _("WOOL"),
+ .height = 6,
+ .weight = 78,
+ .description = gMareepPokedexText,
+ .pokemonScale = 379,
+ .pokemonOffset = 18,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Flaaffy
+ .categoryName = _("WOOL"),
+ .height = 8,
+ .weight = 133,
+ .description = gFlaaffyPokedexText,
+ .pokemonScale = 372,
+ .pokemonOffset = 15,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Ampharos
+ .categoryName = _("LIGHT"),
+ .height = 14,
+ .weight = 615,
+ .description = gAmpharosPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Bellossom
+ .categoryName = _("FLOWER"),
+ .height = 4,
+ .weight = 58,
+ .description = gBellossomPokedexText,
+ .pokemonScale = 472,
+ .pokemonOffset = 21,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Marill
+ .categoryName = _("AQUA MOUSE"),
+ .height = 4,
+ .weight = 85,
+ .description = gMarillPokedexText,
+ .pokemonScale = 476,
+ .pokemonOffset = 20,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Azumarill
+ .categoryName = _("AQUA RABBIT"),
+ .height = 8,
+ .weight = 285,
+ .description = gAzumarillPokedexText,
+ .pokemonScale = 448,
+ .pokemonOffset = 16,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Sudowoodo
+ .categoryName = _("IMITATION"),
+ .height = 12,
+ .weight = 380,
+ .description = gSudowoodoPokedexText,
+ .pokemonScale = 305,
+ .pokemonOffset = 8,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Politoed
+ .categoryName = _("FROG"),
+ .height = 11,
+ .weight = 339,
+ .description = gPolitoedPokedexText,
+ .pokemonScale = 289,
+ .pokemonOffset = 6,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Hoppip
+ .categoryName = _("COTTONWEED"),
+ .height = 4,
+ .weight = 5,
+ .description = gHoppipPokedexText,
+ .pokemonScale = 562,
+ .pokemonOffset = -7,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Skiploom
+ .categoryName = _("COTTONWEED"),
+ .height = 6,
+ .weight = 10,
+ .description = gSkiploomPokedexText,
+ .pokemonScale = 387,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Jumpluff
+ .categoryName = _("COTTONWEED"),
+ .height = 8,
+ .weight = 30,
+ .description = gJumpluffPokedexText,
+ .pokemonScale = 418,
+ .pokemonOffset = -4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Aipom
+ .categoryName = _("LONG TAIL"),
+ .height = 8,
+ .weight = 115,
+ .description = gAipomPokedexText,
+ .pokemonScale = 363,
+ .pokemonOffset = 6,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Sunkern
+ .categoryName = _("SEED"),
+ .height = 3,
+ .weight = 18,
+ .description = gSunkernPokedexText,
+ .pokemonScale = 541,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Sunflora
+ .categoryName = _("SUN"),
+ .height = 8,
+ .weight = 85,
+ .description = gSunfloraPokedexText,
+ .pokemonScale = 444,
+ .pokemonOffset = 15,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Yanma
+ .categoryName = _("CLEAR WING"),
+ .height = 12,
+ .weight = 380,
+ .description = gYanmaPokedexText,
+ .pokemonScale = 274,
+ .pokemonOffset = -1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Wooper
+ .categoryName = _("WATER FISH"),
+ .height = 4,
+ .weight = 85,
+ .description = gWooperPokedexText,
+ .pokemonScale = 479,
+ .pokemonOffset = 21,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Quagsire
+ .categoryName = _("WATER FISH"),
+ .height = 14,
+ .weight = 750,
+ .description = gQuagsirePokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Espeon
+ .categoryName = _("SUN"),
+ .height = 9,
+ .weight = 265,
+ .description = gEspeonPokedexText,
+ .pokemonScale = 363,
+ .pokemonOffset = 14,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Umbreon
+ .categoryName = _("MOONLIGHT"),
+ .height = 10,
+ .weight = 270,
+ .description = gUmbreonPokedexText,
+ .pokemonScale = 317,
+ .pokemonOffset = 11,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Murkrow
+ .categoryName = _("DARKNESS"),
+ .height = 5,
+ .weight = 21,
+ .description = gMurkrowPokedexText,
+ .pokemonScale = 401,
+ .pokemonOffset = -8,
+ .trainerScale = 256,
+ .trainerOffset = 1,
+ },
+ { //Slowking
+ .categoryName = _("ROYAL"),
+ .height = 20,
+ .weight = 795,
+ .description = gSlowkingPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 309,
+ .trainerOffset = 5,
+ },
+ { //Misdreavus
+ .categoryName = _("SCREECH"),
+ .height = 7,
+ .weight = 10,
+ .description = gMisdreavusPokedexText,
+ .pokemonScale = 407,
+ .pokemonOffset = -8,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Unown
+ .categoryName = _("SYMBOL"),
+ .height = 5,
+ .weight = 50,
+ .description = gUnownPokedexText,
+ .pokemonScale = 411,
+ .pokemonOffset = 2,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Wobbuffet
+ .categoryName = _("PATIENT"),
+ .height = 13,
+ .weight = 285,
+ .description = gWobbuffetPokedexText,
+ .pokemonScale = 274,
+ .pokemonOffset = 4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Girafarig
+ .categoryName = _("LONG NECK"),
+ .height = 15,
+ .weight = 415,
+ .description = gGirafarigPokedexText,
+ .pokemonScale = 281,
+ .pokemonOffset = 1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Pineco
+ .categoryName = _("BAGWORM"),
+ .height = 6,
+ .weight = 72,
+ .description = gPinecoPokedexText,
+ .pokemonScale = 445,
+ .pokemonOffset = 2,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Forretress
+ .categoryName = _("BAGWORM"),
+ .height = 12,
+ .weight = 1258,
+ .description = gForretressPokedexText,
+ .pokemonScale = 293,
+ .pokemonOffset = 5,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Dunsparce
+ .categoryName = _("LAND SNAKE"),
+ .height = 15,
+ .weight = 140,
+ .description = gDunsparcePokedexText,
+ .pokemonScale = 316,
+ .pokemonOffset = 17,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Gligar
+ .categoryName = _("FLYSCORPION"),
+ .height = 11,
+ .weight = 648,
+ .description = gGligarPokedexText,
+ .pokemonScale = 350,
+ .pokemonOffset = -1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Steelix
+ .categoryName = _("IRON SNAKE"),
+ .height = 92,
+ .weight = 4000,
+ .description = gSteelixPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 516,
+ .trainerOffset = 13,
+ },
+ { //Snubbull
+ .categoryName = _("FAIRY"),
+ .height = 6,
+ .weight = 78,
+ .description = gSnubbullPokedexText,
+ .pokemonScale = 465,
+ .pokemonOffset = 19,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Granbull
+ .categoryName = _("FAIRY"),
+ .height = 14,
+ .weight = 487,
+ .description = gGranbullPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Qwilfish
+ .categoryName = _("BALLOON"),
+ .height = 5,
+ .weight = 39,
+ .description = gQwilfishPokedexText,
+ .pokemonScale = 430,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Scizor
+ .categoryName = _("PINCER"),
+ .height = 18,
+ .weight = 1180,
+ .description = gScizorPokedexText,
+ .pokemonScale = 278,
+ .pokemonOffset = 1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Shuckle
+ .categoryName = _("MOLD"),
+ .height = 6,
+ .weight = 205,
+ .description = gShucklePokedexText,
+ .pokemonScale = 485,
+ .pokemonOffset = 18,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Heracross
+ .categoryName = _("SINGLE HORN"),
+ .height = 15,
+ .weight = 540,
+ .description = gHeracrossPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Sneasel
+ .categoryName = _("SHARP CLAW"),
+ .height = 9,
+ .weight = 280,
+ .description = gSneaselPokedexText,
+ .pokemonScale = 413,
+ .pokemonOffset = -3,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Teddiursa
+ .categoryName = _("LITTLE BEAR"),
+ .height = 6,
+ .weight = 88,
+ .description = gTeddiursaPokedexText,
+ .pokemonScale = 455,
+ .pokemonOffset = 19,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Ursaring
+ .categoryName = _("HIBERNATOR"),
+ .height = 18,
+ .weight = 1258,
+ .description = gUrsaringPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Slugma
+ .categoryName = _("LAVA"),
+ .height = 7,
+ .weight = 350,
+ .description = gSlugmaPokedexText,
+ .pokemonScale = 329,
+ .pokemonOffset = 15,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Magcargo
+ .categoryName = _("LAVA"),
+ .height = 8,
+ .weight = 550,
+ .description = gMagcargoPokedexText,
+ .pokemonScale = 332,
+ .pokemonOffset = 15,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Swinub
+ .categoryName = _("PIG"),
+ .height = 4,
+ .weight = 65,
+ .description = gSwinubPokedexText,
+ .pokemonScale = 324,
+ .pokemonOffset = 20,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Piloswine
+ .categoryName = _("SWINE"),
+ .height = 11,
+ .weight = 558,
+ .description = gPiloswinePokedexText,
+ .pokemonScale = 306,
+ .pokemonOffset = 10,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Corsola
+ .categoryName = _("CORAL"),
+ .height = 6,
+ .weight = 50,
+ .description = gCorsolaPokedexText,
+ .pokemonScale = 410,
+ .pokemonOffset = 15,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Remoraid
+ .categoryName = _("JET"),
+ .height = 6,
+ .weight = 120,
+ .description = gRemoraidPokedexText,
+ .pokemonScale = 316,
+ .pokemonOffset = 4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Octillery
+ .categoryName = _("JET"),
+ .height = 9,
+ .weight = 285,
+ .description = gOctilleryPokedexText,
+ .pokemonScale = 296,
+ .pokemonOffset = 3,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Delibird
+ .categoryName = _("DELIVERY"),
+ .height = 9,
+ .weight = 160,
+ .description = gDelibirdPokedexText,
+ .pokemonScale = 293,
+ .pokemonOffset = 11,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Mantine
+ .categoryName = _("KITE"),
+ .height = 21,
+ .weight = 2200,
+ .description = gMantinePokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 342,
+ .trainerOffset = 7,
+ },
+ { //Skarmory
+ .categoryName = _("ARMOR BIRD"),
+ .height = 17,
+ .weight = 505,
+ .description = gSkarmoryPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 271,
+ .trainerOffset = 1,
+ },
+ { //Houndour
+ .categoryName = _("DARK"),
+ .height = 6,
+ .weight = 108,
+ .description = gHoundourPokedexText,
+ .pokemonScale = 393,
+ .pokemonOffset = 16,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Houndoom
+ .categoryName = _("DARK"),
+ .height = 14,
+ .weight = 350,
+ .description = gHoundoomPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Kingdra
+ .categoryName = _("DRAGON"),
+ .height = 18,
+ .weight = 1520,
+ .description = gKingdraPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 287,
+ .trainerOffset = 0,
+ },
+ { //Phanpy
+ .categoryName = _("LONG NOSE"),
+ .height = 5,
+ .weight = 335,
+ .description = gPhanpyPokedexText,
+ .pokemonScale = 465,
+ .pokemonOffset = 21,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Donphan
+ .categoryName = _("ARMOR"),
+ .height = 11,
+ .weight = 1200,
+ .description = gDonphanPokedexText,
+ .pokemonScale = 313,
+ .pokemonOffset = 9,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Porygon2
+ .categoryName = _("VIRTUAL"),
+ .height = 6,
+ .weight = 325,
+ .description = gPorygon2PokedexText,
+ .pokemonScale = 320,
+ .pokemonOffset = 17,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Stantler
+ .categoryName = _("BIG HORN"),
+ .height = 14,
+ .weight = 712,
+ .description = gStantlerPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Smeargle
+ .categoryName = _("PAINTER"),
+ .height = 12,
+ .weight = 580,
+ .description = gSmearglePokedexText,
+ .pokemonScale = 287,
+ .pokemonOffset = 5,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Tyrogue
+ .categoryName = _("SCUFFLE"),
+ .height = 7,
+ .weight = 210,
+ .description = gTyroguePokedexText,
+ .pokemonScale = 292,
+ .pokemonOffset = 9,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Hitmontop
+ .categoryName = _("HANDSTAND"),
+ .height = 14,
+ .weight = 480,
+ .description = gHitmontopPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 2,
+ .trainerScale = 257,
+ .trainerOffset = 0,
+ },
+ { //Smoochum
+ .categoryName = _("KISS"),
+ .height = 4,
+ .weight = 60,
+ .description = gSmoochumPokedexText,
+ .pokemonScale = 440,
+ .pokemonOffset = 20,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Elekid
+ .categoryName = _("ELECTRIC"),
+ .height = 6,
+ .weight = 235,
+ .description = gElekidPokedexText,
+ .pokemonScale = 363,
+ .pokemonOffset = 14,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Magby
+ .categoryName = _("LIVE COAL"),
+ .height = 7,
+ .weight = 214,
+ .description = gMagbyPokedexText,
+ .pokemonScale = 284,
+ .pokemonOffset = 13,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Miltank
+ .categoryName = _("MILK COW"),
+ .height = 12,
+ .weight = 755,
+ .description = gMiltankPokedexText,
+ .pokemonScale = 280,
+ .pokemonOffset = 5,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Blissey
+ .categoryName = _("HAPPINESS"),
+ .height = 15,
+ .weight = 468,
+ .description = gBlisseyPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 4,
+ .trainerScale = 310,
+ .trainerOffset = 3,
+ },
+ { //Raikou
+ .categoryName = _("THUNDER"),
+ .height = 19,
+ .weight = 1780,
+ .description = gRaikouPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 345,
+ .trainerOffset = 7,
+ },
+ { //Entei
+ .categoryName = _("VOLCANO"),
+ .height = 21,
+ .weight = 1980,
+ .description = gEnteiPokedexText,
+ .pokemonScale = 259,
+ .pokemonOffset = 0,
+ .trainerScale = 345,
+ .trainerOffset = 7,
+ },
+ { //Suicune
+ .categoryName = _("AURORA"),
+ .height = 20,
+ .weight = 1870,
+ .description = gSuicunePokedexText,
+ .pokemonScale = 269,
+ .pokemonOffset = 0,
+ .trainerScale = 345,
+ .trainerOffset = 7,
+ },
+ { //Larvitar
+ .categoryName = _("ROCK SKIN"),
+ .height = 6,
+ .weight = 720,
+ .description = gLarvitarPokedexText,
+ .pokemonScale = 472,
+ .pokemonOffset = 18,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Pupitar
+ .categoryName = _("HARD SHELL"),
+ .height = 12,
+ .weight = 1520,
+ .description = gPupitarPokedexText,
+ .pokemonScale = 292,
+ .pokemonOffset = 8,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Tyranitar
+ .categoryName = _("ARMOR"),
+ .height = 20,
+ .weight = 2020,
+ .description = gTyranitarPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 345,
+ .trainerOffset = 7,
+ },
+ { //Lugia
+ .categoryName = _("DIVING"),
+ .height = 52,
+ .weight = 2160,
+ .description = gLugiaPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 721,
+ .trainerOffset = 19,
+ },
+ { //HoOh
+ .categoryName = _("RAINBOW"),
+ .height = 38,
+ .weight = 1990,
+ .description = gHoOhPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 610,
+ .trainerOffset = 17,
+ },
+ { //Celebi
+ .categoryName = _("TIME TRAVEL"),
+ .height = 6,
+ .weight = 50,
+ .description = gCelebiPokedexText,
+ .pokemonScale = 393,
+ .pokemonOffset = -10,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Treecko
+ .categoryName = _("WOOD GECKO"),
+ .height = 5,
+ .weight = 50,
+ .description = gTreeckoPokedexText,
+ .pokemonScale = 541,
+ .pokemonOffset = 19,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Grovyle
+ .categoryName = _("WOOD GECKO"),
+ .height = 9,
+ .weight = 216,
+ .description = gGrovylePokedexText,
+ .pokemonScale = 360,
+ .pokemonOffset = 5,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Sceptile
+ .categoryName = _("FOREST"),
+ .height = 17,
+ .weight = 522,
+ .description = gSceptilePokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = -1,
+ .trainerScale = 275,
+ .trainerOffset = 2,
+ },
+ { //Torchic
+ .categoryName = _("CHICK"),
+ .height = 4,
+ .weight = 25,
+ .description = gTorchicPokedexText,
+ .pokemonScale = 566,
+ .pokemonOffset = 19,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Combusken
+ .categoryName = _("YOUNG FOWL"),
+ .height = 9,
+ .weight = 195,
+ .description = gCombuskenPokedexText,
+ .pokemonScale = 343,
+ .pokemonOffset = 5,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Blaziken
+ .categoryName = _("BLAZE"),
+ .height = 19,
+ .weight = 520,
+ .description = gBlazikenPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 301,
+ .trainerOffset = 4,
+ },
+ { //Mudkip
+ .categoryName = _("MUD FISH"),
+ .height = 4,
+ .weight = 76,
+ .description = gMudkipPokedexText,
+ .pokemonScale = 535,
+ .pokemonOffset = 20,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Marshtomp
+ .categoryName = _("MUD FISH"),
+ .height = 7,
+ .weight = 280,
+ .description = gMarshtompPokedexText,
+ .pokemonScale = 340,
+ .pokemonOffset = 7,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Swampert
+ .categoryName = _("MUD FISH"),
+ .height = 15,
+ .weight = 819,
+ .description = gSwampertPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Poochyena
+ .categoryName = _("BITE"),
+ .height = 5,
+ .weight = 136,
+ .description = gPoochyenaPokedexText,
+ .pokemonScale = 481,
+ .pokemonOffset = 19,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Mightyena
+ .categoryName = _("BITE"),
+ .height = 10,
+ .weight = 370,
+ .description = gMightyenaPokedexText,
+ .pokemonScale = 362,
+ .pokemonOffset = 9,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Zigzagoon
+ .categoryName = _("TINYRACCOON"),
+ .height = 4,
+ .weight = 175,
+ .description = gZigzagoonPokedexText,
+ .pokemonScale = 560,
+ .pokemonOffset = 22,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Linoone
+ .categoryName = _("RUSHING"),
+ .height = 5,
+ .weight = 325,
+ .description = gLinoonePokedexText,
+ .pokemonScale = 321,
+ .pokemonOffset = 7,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Wurmple
+ .categoryName = _("WORM"),
+ .height = 3,
+ .weight = 36,
+ .description = gWurmplePokedexText,
+ .pokemonScale = 711,
+ .pokemonOffset = 24,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Silcoon
+ .categoryName = _("COCOON"),
+ .height = 6,
+ .weight = 100,
+ .description = gSilcoonPokedexText,
+ .pokemonScale = 431,
+ .pokemonOffset = 19,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Beautifly
+ .categoryName = _("BUTTERFLY"),
+ .height = 10,
+ .weight = 284,
+ .description = gBeautiflyPokedexText,
+ .pokemonScale = 298,
+ .pokemonOffset = -1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Cascoon
+ .categoryName = _("COCOON"),
+ .height = 7,
+ .weight = 115,
+ .description = gCascoonPokedexText,
+ .pokemonScale = 391,
+ .pokemonOffset = 20,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Dustox
+ .categoryName = _("POISON MOTH"),
+ .height = 12,
+ .weight = 316,
+ .description = gDustoxPokedexText,
+ .pokemonScale = 269,
+ .pokemonOffset = 1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Lotad
+ .categoryName = _("WATER WEED"),
+ .height = 5,
+ .weight = 26,
+ .description = gLotadPokedexText,
+ .pokemonScale = 406,
+ .pokemonOffset = 19,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Lombre
+ .categoryName = _("JOLLY"),
+ .height = 12,
+ .weight = 325,
+ .description = gLombrePokedexText,
+ .pokemonScale = 277,
+ .pokemonOffset = 9,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Ludicolo
+ .categoryName = _("CAREFREE"),
+ .height = 15,
+ .weight = 550,
+ .description = gLudicoloPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 268,
+ .trainerOffset = -1,
+ },
+ { //Seedot
+ .categoryName = _("ACORN"),
+ .height = 5,
+ .weight = 40,
+ .description = gSeedotPokedexText,
+ .pokemonScale = 472,
+ .pokemonOffset = 20,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Nuzleaf
+ .categoryName = _("WILY"),
+ .height = 10,
+ .weight = 280,
+ .description = gNuzleafPokedexText,
+ .pokemonScale = 299,
+ .pokemonOffset = 10,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Shiftry
+ .categoryName = _("WICKED"),
+ .height = 13,
+ .weight = 596,
+ .description = gShiftryPokedexText,
+ .pokemonScale = 290,
+ .pokemonOffset = 4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Taillow
+ .categoryName = _("TINYSWALLOW"),
+ .height = 3,
+ .weight = 23,
+ .description = gTaillowPokedexText,
+ .pokemonScale = 465,
+ .pokemonOffset = 21,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Swellow
+ .categoryName = _("SWALLOW"),
+ .height = 7,
+ .weight = 198,
+ .description = gSwellowPokedexText,
+ .pokemonScale = 428,
+ .pokemonOffset = 15,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Wingull
+ .categoryName = _("SEAGULL"),
+ .height = 6,
+ .weight = 95,
+ .description = gWingullPokedexText,
+ .pokemonScale = 295,
+ .pokemonOffset = -2,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Pelipper
+ .categoryName = _("WATER BIRD"),
+ .height = 12,
+ .weight = 280,
+ .description = gPelipperPokedexText,
+ .pokemonScale = 288,
+ .pokemonOffset = 1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Ralts
+ .categoryName = _("FEELING"),
+ .height = 4,
+ .weight = 66,
+ .description = gRaltsPokedexText,
+ .pokemonScale = 457,
+ .pokemonOffset = -3,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Kirlia
+ .categoryName = _("EMOTION"),
+ .height = 8,
+ .weight = 202,
+ .description = gKirliaPokedexText,
+ .pokemonScale = 354,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Gardevoir
+ .categoryName = _("EMBRACE"),
+ .height = 16,
+ .weight = 484,
+ .description = gGardevoirPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Surskit
+ .categoryName = _("POND SKATER"),
+ .height = 5,
+ .weight = 17,
+ .description = gSurskitPokedexText,
+ .pokemonScale = 375,
+ .pokemonOffset = 17,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Masquerain
+ .categoryName = _("EYEBALL"),
+ .height = 8,
+ .weight = 36,
+ .description = gMasquerainPokedexText,
+ .pokemonScale = 378,
+ .pokemonOffset = 8,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Shroomish
+ .categoryName = _("MUSHROOM"),
+ .height = 4,
+ .weight = 45,
+ .description = gShroomishPokedexText,
+ .pokemonScale = 513,
+ .pokemonOffset = 22,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Breloom
+ .categoryName = _("MUSHROOM"),
+ .height = 12,
+ .weight = 392,
+ .description = gBreloomPokedexText,
+ .pokemonScale = 324,
+ .pokemonOffset = 6,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Slakoth
+ .categoryName = _("SLACKER"),
+ .height = 8,
+ .weight = 240,
+ .description = gSlakothPokedexText,
+ .pokemonScale = 291,
+ .pokemonOffset = 16,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Vigoroth
+ .categoryName = _("WILD MONKEY"),
+ .height = 14,
+ .weight = 465,
+ .description = gVigorothPokedexText,
+ .pokemonScale = 301,
+ .pokemonOffset = 2,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Slaking
+ .categoryName = _("LAZY"),
+ .height = 20,
+ .weight = 1305,
+ .description = gSlakingPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 2,
+ .trainerScale = 300,
+ .trainerOffset = 1,
+ },
+ { //Nincada
+ .categoryName = _("TRAINEE"),
+ .height = 5,
+ .weight = 55,
+ .description = gNincadaPokedexText,
+ .pokemonScale = 405,
+ .pokemonOffset = 21,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Ninjask
+ .categoryName = _("NINJA"),
+ .height = 8,
+ .weight = 120,
+ .description = gNinjaskPokedexText,
+ .pokemonScale = 383,
+ .pokemonOffset = -9,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Shedinja
+ .categoryName = _("SHED"),
+ .height = 8,
+ .weight = 12,
+ .description = gShedinjaPokedexText,
+ .pokemonScale = 372,
+ .pokemonOffset = -8,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Whismur
+ .categoryName = _("WHISPER"),
+ .height = 6,
+ .weight = 163,
+ .description = gWhismurPokedexText,
+ .pokemonScale = 373,
+ .pokemonOffset = 17,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Loudred
+ .categoryName = _("BIG VOICE"),
+ .height = 10,
+ .weight = 405,
+ .description = gLoudredPokedexText,
+ .pokemonScale = 356,
+ .pokemonOffset = 10,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Exploud
+ .categoryName = _("LOUD NOISE"),
+ .height = 15,
+ .weight = 840,
+ .description = gExploudPokedexText,
+ .pokemonScale = 284,
+ .pokemonOffset = 1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Makuhita
+ .categoryName = _("GUTS"),
+ .height = 10,
+ .weight = 864,
+ .description = gMakuhitaPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 10,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Hariyama
+ .categoryName = _("ARM THRUST"),
+ .height = 23,
+ .weight = 2538,
+ .description = gHariyamaPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 343,
+ .trainerOffset = 7,
+ },
+ { //Azurill
+ .categoryName = _("POLKA DOT"),
+ .height = 2,
+ .weight = 20,
+ .description = gAzurillPokedexText,
+ .pokemonScale = 603,
+ .pokemonOffset = 23,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Nosepass
+ .categoryName = _("COMPASS"),
+ .height = 10,
+ .weight = 970,
+ .description = gNosepassPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 9,
+ .trainerScale = 289,
+ .trainerOffset = 3,
+ },
+ { //Skitty
+ .categoryName = _("KITTEN"),
+ .height = 6,
+ .weight = 110,
+ .description = gSkittyPokedexText,
+ .pokemonScale = 492,
+ .pokemonOffset = 19,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Delcatty
+ .categoryName = _("PRIM"),
+ .height = 11,
+ .weight = 326,
+ .description = gDelcattyPokedexText,
+ .pokemonScale = 322,
+ .pokemonOffset = 10,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Sableye
+ .categoryName = _("DARKNESS"),
+ .height = 5,
+ .weight = 110,
+ .description = gSableyePokedexText,
+ .pokemonScale = 451,
+ .pokemonOffset = 17,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Mawile
+ .categoryName = _("DECEIVER"),
+ .height = 6,
+ .weight = 115,
+ .description = gMawilePokedexText,
+ .pokemonScale = 466,
+ .pokemonOffset = 17,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Aron
+ .categoryName = _("IRON ARMOR"),
+ .height = 4,
+ .weight = 600,
+ .description = gAronPokedexText,
+ .pokemonScale = 419,
+ .pokemonOffset = 23,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Lairon
+ .categoryName = _("IRON ARMOR"),
+ .height = 9,
+ .weight = 1200,
+ .description = gLaironPokedexText,
+ .pokemonScale = 275,
+ .pokemonOffset = 12,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Aggron
+ .categoryName = _("IRON ARMOR"),
+ .height = 21,
+ .weight = 3600,
+ .description = gAggronPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = -1,
+ .trainerScale = 350,
+ .trainerOffset = 6,
+ },
+ { //Meditite
+ .categoryName = _("MEDITATE"),
+ .height = 6,
+ .weight = 112,
+ .description = gMedititePokedexText,
+ .pokemonScale = 465,
+ .pokemonOffset = 17,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Medicham
+ .categoryName = _("MEDITATE"),
+ .height = 13,
+ .weight = 315,
+ .description = gMedichamPokedexText,
+ .pokemonScale = 298,
+ .pokemonOffset = 5,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Electrike
+ .categoryName = _("LIGHTNING"),
+ .height = 6,
+ .weight = 152,
+ .description = gElectrikePokedexText,
+ .pokemonScale = 290,
+ .pokemonOffset = 15,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Manectric
+ .categoryName = _("DISCHARGE"),
+ .height = 15,
+ .weight = 402,
+ .description = gManectricPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 3,
+ .trainerScale = 257,
+ .trainerOffset = 0,
+ },
+ { //Plusle
+ .categoryName = _("CHEERING"),
+ .height = 4,
+ .weight = 42,
+ .description = gPluslePokedexText,
+ .pokemonScale = 515,
+ .pokemonOffset = -9,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Minun
+ .categoryName = _("CHEERING"),
+ .height = 4,
+ .weight = 42,
+ .description = gMinunPokedexText,
+ .pokemonScale = 512,
+ .pokemonOffset = -7,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Volbeat
+ .categoryName = _("FIREFLY"),
+ .height = 7,
+ .weight = 177,
+ .description = gVolbeatPokedexText,
+ .pokemonScale = 442,
+ .pokemonOffset = 16,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Illumise
+ .categoryName = _("FIREFLY"),
+ .height = 6,
+ .weight = 177,
+ .description = gIllumisePokedexText,
+ .pokemonScale = 572,
+ .pokemonOffset = 19,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Roselia
+ .categoryName = _("THORN"),
+ .height = 3,
+ .weight = 20,
+ .description = gRoseliaPokedexText,
+ .pokemonScale = 677,
+ .pokemonOffset = 20,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Gulpin
+ .categoryName = _("STOMACH"),
+ .height = 4,
+ .weight = 103,
+ .description = gGulpinPokedexText,
+ .pokemonScale = 593,
+ .pokemonOffset = 23,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Swalot
+ .categoryName = _("POISON BAG"),
+ .height = 17,
+ .weight = 800,
+ .description = gSwalotPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 6,
+ .trainerScale = 345,
+ .trainerOffset = 3,
+ },
+ { //Carvanha
+ .categoryName = _("SAVAGE"),
+ .height = 8,
+ .weight = 208,
+ .description = gCarvanhaPokedexText,
+ .pokemonScale = 362,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Sharpedo
+ .categoryName = _("BRUTAL"),
+ .height = 18,
+ .weight = 888,
+ .description = gSharpedoPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 317,
+ .trainerOffset = 3,
+ },
+ { //Wailmer
+ .categoryName = _("BALL WHALE"),
+ .height = 20,
+ .weight = 1300,
+ .description = gWailmerPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 2,
+ .trainerScale = 493,
+ .trainerOffset = 0,
+ },
+ { //Wailord
+ .categoryName = _("FLOAT WHALE"),
+ .height = 145,
+ .weight = 3980,
+ .description = gWailordPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 1352,
+ .trainerOffset = 18,
+ },
+ { //Numel
+ .categoryName = _("NUMB"),
+ .height = 7,
+ .weight = 240,
+ .description = gNumelPokedexText,
+ .pokemonScale = 342,
+ .pokemonOffset = 17,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Camerupt
+ .categoryName = _("ERUPTION"),
+ .height = 19,
+ .weight = 2200,
+ .description = gCameruptPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 7,
+ .trainerScale = 345,
+ .trainerOffset = 6,
+ },
+ { //Torkoal
+ .categoryName = _("COAL"),
+ .height = 5,
+ .weight = 804,
+ .description = gTorkoalPokedexText,
+ .pokemonScale = 390,
+ .pokemonOffset = 9,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Spoink
+ .categoryName = _("BOUNCE"),
+ .height = 7,
+ .weight = 306,
+ .description = gSpoinkPokedexText,
+ .pokemonScale = 423,
+ .pokemonOffset = 17,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Grumpig
+ .categoryName = _("MANIPULATE"),
+ .height = 9,
+ .weight = 715,
+ .description = gGrumpigPokedexText,
+ .pokemonScale = 358,
+ .pokemonOffset = 10,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Spinda
+ .categoryName = _("SPOT PANDA"),
+ .height = 11,
+ .weight = 50,
+ .description = gSpindaPokedexText,
+ .pokemonScale = 321,
+ .pokemonOffset = 4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Trapinch
+ .categoryName = _("ANT PIT"),
+ .height = 7,
+ .weight = 150,
+ .description = gTrapinchPokedexText,
+ .pokemonScale = 298,
+ .pokemonOffset = 17,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Vibrava
+ .categoryName = _("VIBRATION"),
+ .height = 11,
+ .weight = 153,
+ .description = gVibravaPokedexText,
+ .pokemonScale = 370,
+ .pokemonOffset = 11,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Flygon
+ .categoryName = _("MYSTIC"),
+ .height = 20,
+ .weight = 820,
+ .description = gFlygonPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 268,
+ .trainerOffset = 1,
+ },
+ { //Cacnea
+ .categoryName = _("CACTUS"),
+ .height = 4,
+ .weight = 513,
+ .description = gCacneaPokedexText,
+ .pokemonScale = 455,
+ .pokemonOffset = 20,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Cacturne
+ .categoryName = _("SCARECROW"),
+ .height = 13,
+ .weight = 774,
+ .description = gCacturnePokedexText,
+ .pokemonScale = 327,
+ .pokemonOffset = 5,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Swablu
+ .categoryName = _("COTTON BIRD"),
+ .height = 4,
+ .weight = 12,
+ .description = gSwabluPokedexText,
+ .pokemonScale = 422,
+ .pokemonOffset = -8,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Altaria
+ .categoryName = _("HUMMING"),
+ .height = 11,
+ .weight = 206,
+ .description = gAltariaPokedexText,
+ .pokemonScale = 327,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Zangoose
+ .categoryName = _("CAT FERRET"),
+ .height = 13,
+ .weight = 403,
+ .description = gZangoosePokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 3,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Seviper
+ .categoryName = _("FANG SNAKE"),
+ .height = 27,
+ .weight = 525,
+ .description = gSeviperPokedexText,
+ .pokemonScale = 275,
+ .pokemonOffset = 7,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Lunatone
+ .categoryName = _("METEORITE"),
+ .height = 10,
+ .weight = 1680,
+ .description = gLunatonePokedexText,
+ .pokemonScale = 300,
+ .pokemonOffset = 3,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Solrock
+ .categoryName = _("METEORITE"),
+ .height = 12,
+ .weight = 1540,
+ .description = gSolrockPokedexText,
+ .pokemonScale = 328,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Barboach
+ .categoryName = _("WHISKERS"),
+ .height = 4,
+ .weight = 19,
+ .description = gBarboachPokedexText,
+ .pokemonScale = 581,
+ .pokemonOffset = -3,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Whiscash
+ .categoryName = _("WHISKERS"),
+ .height = 9,
+ .weight = 236,
+ .description = gWhiscashPokedexText,
+ .pokemonScale = 317,
+ .pokemonOffset = 1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Corphish
+ .categoryName = _("RUFFIAN"),
+ .height = 6,
+ .weight = 115,
+ .description = gCorphishPokedexText,
+ .pokemonScale = 484,
+ .pokemonOffset = 19,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Crawdaunt
+ .categoryName = _("ROGUE"),
+ .height = 11,
+ .weight = 328,
+ .description = gCrawdauntPokedexText,
+ .pokemonScale = 365,
+ .pokemonOffset = 9,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Baltoy
+ .categoryName = _("CLAY DOLL"),
+ .height = 5,
+ .weight = 215,
+ .description = gBaltoyPokedexText,
+ .pokemonScale = 457,
+ .pokemonOffset = 21,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Claydol
+ .categoryName = _("CLAY DOLL"),
+ .height = 15,
+ .weight = 1080,
+ .description = gClaydolPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 3,
+ .trainerScale = 280,
+ .trainerOffset = 1,
+ },
+ { //Lileep
+ .categoryName = _("SEA LILY"),
+ .height = 10,
+ .weight = 238,
+ .description = gLileepPokedexText,
+ .pokemonScale = 305,
+ .pokemonOffset = 8,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Cradily
+ .categoryName = _("BARNACLE"),
+ .height = 15,
+ .weight = 604,
+ .description = gCradilyPokedexText,
+ .pokemonScale = 267,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Anorith
+ .categoryName = _("OLD SHRIMP"),
+ .height = 7,
+ .weight = 125,
+ .description = gAnorithPokedexText,
+ .pokemonScale = 296,
+ .pokemonOffset = 4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Armaldo
+ .categoryName = _("PLATE"),
+ .height = 15,
+ .weight = 682,
+ .description = gArmaldoPokedexText,
+ .pokemonScale = 312,
+ .pokemonOffset = 3,
+ .trainerScale = 271,
+ .trainerOffset = 0,
+ },
+ { //Feebas
+ .categoryName = _("FISH"),
+ .height = 6,
+ .weight = 74,
+ .description = gFeebasPokedexText,
+ .pokemonScale = 423,
+ .pokemonOffset = -4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Milotic
+ .categoryName = _("TENDER"),
+ .height = 62,
+ .weight = 1620,
+ .description = gMiloticPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 360,
+ .trainerOffset = 7,
+ },
+ { //Castform
+ .categoryName = _("WEATHER"),
+ .height = 3,
+ .weight = 8,
+ .description = gCastformPokedexText,
+ .pokemonScale = 435,
+ .pokemonOffset = -5,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Kecleon
+ .categoryName = _("COLOR SWAP"),
+ .height = 10,
+ .weight = 220,
+ .description = gKecleonPokedexText,
+ .pokemonScale = 316,
+ .pokemonOffset = 10,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Shuppet
+ .categoryName = _("PUPPET"),
+ .height = 6,
+ .weight = 23,
+ .description = gShuppetPokedexText,
+ .pokemonScale = 440,
+ .pokemonOffset = 20,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Banette
+ .categoryName = _("MARIONETTE"),
+ .height = 11,
+ .weight = 125,
+ .description = gBanettePokedexText,
+ .pokemonScale = 262,
+ .pokemonOffset = 9,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Duskull
+ .categoryName = _("REQUIEM"),
+ .height = 8,
+ .weight = 150,
+ .description = gDuskullPokedexText,
+ .pokemonScale = 406,
+ .pokemonOffset = -4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Dusclops
+ .categoryName = _("BECKON"),
+ .height = 16,
+ .weight = 306,
+ .description = gDusclopsPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 3,
+ .trainerScale = 299,
+ .trainerOffset = 1,
+ },
+ { //Tropius
+ .categoryName = _("FRUIT"),
+ .height = 20,
+ .weight = 1000,
+ .description = gTropiusPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 344,
+ .trainerOffset = 7,
+ },
+ { //Chimecho
+ .categoryName = _("WIND CHIME"),
+ .height = 6,
+ .weight = 10,
+ .description = gChimechoPokedexText,
+ .pokemonScale = 505,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Absol
+ .categoryName = _("DISASTER"),
+ .height = 12,
+ .weight = 470,
+ .description = gAbsolPokedexText,
+ .pokemonScale = 301,
+ .pokemonOffset = 3,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Wynaut
+ .categoryName = _("BRIGHT"),
+ .height = 6,
+ .weight = 140,
+ .description = gWynautPokedexText,
+ .pokemonScale = 484,
+ .pokemonOffset = 19,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Snorunt
+ .categoryName = _("SNOW HAT"),
+ .height = 7,
+ .weight = 168,
+ .description = gSnoruntPokedexText,
+ .pokemonScale = 380,
+ .pokemonOffset = 15,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Glalie
+ .categoryName = _("FACE"),
+ .height = 15,
+ .weight = 2565,
+ .description = gGlaliePokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 3,
+ .trainerScale = 344,
+ .trainerOffset = 0,
+ },
+ { //Spheal
+ .categoryName = _("CLAP"),
+ .height = 8,
+ .weight = 395,
+ .description = gSphealPokedexText,
+ .pokemonScale = 315,
+ .pokemonOffset = 16,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Sealeo
+ .categoryName = _("BALL ROLL"),
+ .height = 11,
+ .weight = 876,
+ .description = gSealeoPokedexText,
+ .pokemonScale = 338,
+ .pokemonOffset = 13,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Walrein
+ .categoryName = _("ICE BREAK"),
+ .height = 14,
+ .weight = 1506,
+ .description = gWalreinPokedexText,
+ .pokemonScale = 316,
+ .pokemonOffset = 4,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Clamperl
+ .categoryName = _("BIVALVE"),
+ .height = 4,
+ .weight = 525,
+ .description = gClamperlPokedexText,
+ .pokemonScale = 691,
+ .pokemonOffset = 22,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Huntail
+ .categoryName = _("DEEP SEA"),
+ .height = 17,
+ .weight = 270,
+ .description = gHuntailPokedexText,
+ .pokemonScale = 307,
+ .pokemonOffset = 1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Gorebyss
+ .categoryName = _("SOUTH SEA"),
+ .height = 18,
+ .weight = 226,
+ .description = gGorebyssPokedexText,
+ .pokemonScale = 278,
+ .pokemonOffset = 5,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Relicanth
+ .categoryName = _("LONGEVITY"),
+ .height = 10,
+ .weight = 234,
+ .description = gRelicanthPokedexText,
+ .pokemonScale = 316,
+ .pokemonOffset = 7,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Luvdisc
+ .categoryName = _("RENDEZVOUS"),
+ .height = 6,
+ .weight = 87,
+ .description = gLuvdiscPokedexText,
+ .pokemonScale = 371,
+ .pokemonOffset = 2,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Bagon
+ .categoryName = _("ROCK HEAD"),
+ .height = 6,
+ .weight = 421,
+ .description = gBagonPokedexText,
+ .pokemonScale = 448,
+ .pokemonOffset = 18,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Shelgon
+ .categoryName = _("ENDURANCE"),
+ .height = 11,
+ .weight = 1105,
+ .description = gShelgonPokedexText,
+ .pokemonScale = 311,
+ .pokemonOffset = 12,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Salamence
+ .categoryName = _("DRAGON"),
+ .height = 15,
+ .weight = 1026,
+ .description = gSalamencePokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Beldum
+ .categoryName = _("IRON BALL"),
+ .height = 6,
+ .weight = 952,
+ .description = gBeldumPokedexText,
+ .pokemonScale = 414,
+ .pokemonOffset = -1,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Metang
+ .categoryName = _("IRON CLAW"),
+ .height = 12,
+ .weight = 2025,
+ .description = gMetangPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 6,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Metagross
+ .categoryName = _("IRON LEG"),
+ .height = 16,
+ .weight = 5500,
+ .description = gMetagrossPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 4,
+ .trainerScale = 447,
+ .trainerOffset = 9,
+ },
+ { //Regirock
+ .categoryName = _("ROCK PEAK"),
+ .height = 17,
+ .weight = 2300,
+ .description = gRegirockPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 2,
+ .trainerScale = 309,
+ .trainerOffset = 1,
+ },
+ { //Regice
+ .categoryName = _("ICEBERG"),
+ .height = 18,
+ .weight = 1750,
+ .description = gRegicePokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 301,
+ .trainerOffset = 2,
+ },
+ { //Registeel
+ .categoryName = _("IRON"),
+ .height = 19,
+ .weight = 2050,
+ .description = gRegisteelPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 359,
+ .trainerOffset = 6,
+ },
+ { //Latias
+ .categoryName = _("EON"),
+ .height = 14,
+ .weight = 400,
+ .description = gLatiasPokedexText,
+ .pokemonScale = 304,
+ .pokemonOffset = 3,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Latios
+ .categoryName = _("EON"),
+ .height = 20,
+ .weight = 600,
+ .description = gLatiosPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 294,
+ .trainerOffset = 3,
+ },
+ { //Kyogre
+ .categoryName = _("SEA BASIN"),
+ .height = 45,
+ .weight = 3520,
+ .description = gKyogrePokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 614,
+ .trainerOffset = 13,
+ },
+ { //Groudon
+ .categoryName = _("CONTINENT"),
+ .height = 35,
+ .weight = 9500,
+ .description = gGroudonPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 515,
+ .trainerOffset = 14,
+ },
+ { //Rayquaza
+ .categoryName = _("SKY HIGH"),
+ .height = 70,
+ .weight = 2065,
+ .description = gRayquazaPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 448,
+ .trainerOffset = 12,
+ },
+ { //Jirachi
+ .categoryName = _("WISH"),
+ .height = 3,
+ .weight = 11,
+ .description = gJirachiPokedexText,
+ .pokemonScale = 608,
+ .pokemonOffset = -8,
+ .trainerScale = 256,
+ .trainerOffset = 0,
+ },
+ { //Deoxys
+ .categoryName = _("DNA"),
+ .height = 17,
+ .weight = 608,
+ .description = gDeoxysPokedexText,
+ .pokemonScale = 256,
+ .pokemonOffset = 0,
+ .trainerScale = 290,
+ .trainerOffset = 2,
+ },
+};
diff --git a/src/data/pokemon/pokedex_text.h b/src/data/pokemon/pokedex_text.h
new file mode 100644
index 000000000..565c1acaf
--- /dev/null
+++ b/src/data/pokemon/pokedex_text.h
@@ -0,0 +1,2321 @@
+const u8 gDummyPokedexText[] = _(
+ "This is a newly discovered POKéMON.\n"
+ "It is currently under investigation.\n"
+ "No detailed information is available\n"
+ "at this time.");
+
+const u8 gBulbasaurPokedexText[] = _(
+ "BULBASAUR can be seen napping in bright\n"
+ "sunlight. There is a seed on its back.\n"
+ "By soaking up the sun’s rays, the seed\n"
+ "grows progressively larger.");
+
+const u8 gIvysaurPokedexText[] = _(
+ "To support its bulb, IVYSAUR’s legs\n"
+ "grow sturdy. If it spends more time lying in\n"
+ "the sunlight, the bud will soon bloom into\n"
+ "a large flower.");
+
+const u8 gVenusaurPokedexText[] = _(
+ "VENUSAUR’s flower is said to take on vivid\n"
+ "colors if it gets plenty of nutrition and\n"
+ "sunlight. The flower’s aroma soothes the\n"
+ "emotions of people.");
+
+const u8 gCharmanderPokedexText[] = _(
+ "The flame that burns at the tip of its\n"
+ "tail is an indication of its emotions.\n"
+ "The flame wavers when CHARMANDER is\n"
+ "happy, and blazes when it is enraged.");
+
+const u8 gCharmeleonPokedexText[] = _(
+ "Without pity, its sharp claws destroy foes.\n"
+ "If it encounters a strong enemy, it\n"
+ "becomes agitated, and the flame on its\n"
+ "tail flares with a bluish white color.");
+
+const u8 gCharizardPokedexText[] = _(
+ "A CHARIZARD flies about in search of\n"
+ "strong opponents. It breathes intense\n"
+ "flames that can melt any material. However,\n"
+ "it will never torch a weaker foe.");
+
+const u8 gSquirtlePokedexText[] = _(
+ "Its shell is not just for protection.\n"
+ "Its rounded shape and the grooves on its\n"
+ "surface minimize resistance in water,\n"
+ "enabling SQUIRTLE to swim at high speeds.");
+
+const u8 gWartortlePokedexText[] = _(
+ "Its large tail is covered with rich, thick\n"
+ "fur that deepens in color with age.\n"
+ "The scratches on its shell are evidence\n"
+ "of this POKéMON’s toughness in battle.");
+
+const u8 gBlastoisePokedexText[] = _(
+ "The waterspouts that protrude from its\n"
+ "shell are highly accurate. Their bullets of\n"
+ "water can precisely nail tin cans from\n"
+ "a distance of over 160 feet.");
+
+const u8 gCaterpiePokedexText[] = _(
+ "Its voracious appetite compels it to\n"
+ "devour leaves bigger than itself without\n"
+ "hesitation. It releases a terribly strong\n"
+ "odor from its antennae.");
+
+const u8 gMetapodPokedexText[] = _(
+ "Its shell is as hard as an iron slab.\n"
+ "A METAPOD does not move very much\n"
+ "because it is preparing its soft innards\n"
+ "for evolution inside the shell.");
+
+const u8 gButterfreePokedexText[] = _(
+ "It has a superior ability to search for\n"
+ "delicious honey from flowers. It can seek,\n"
+ "extract, and carry honey from flowers\n"
+ "blooming over six miles away.");
+
+const u8 gWeedlePokedexText[] = _(
+ "A WEEDLE has an extremely acute sense\n"
+ "of smell. It distinguishes its favorite\n"
+ "kinds of leaves from those it dislikes by\n"
+ "sniffing with its big red proboscis (nose).");
+
+const u8 gKakunaPokedexText[] = _(
+ "It remains virtually immobile while it\n"
+ "clings to a tree. However, on the inside,\n"
+ "it busily prepares for evolution. This is\n"
+ "evident from how hot its shell becomes.");
+
+const u8 gBeedrillPokedexText[] = _(
+ "A BEEDRILL is extremely territorial.\n"
+ "For safety reasons, no one should \n"
+ "ever approach its nest. If angered,\n"
+ "they will attack in a swarm.");
+
+const u8 gPidgeyPokedexText[] = _(
+ "It has an extremely sharp sense of\n"
+ "direction. It can unerringly return home to\n"
+ "its nest, however far it may be removed\n"
+ "from its familiar surroundings.");
+
+const u8 gPidgeottoPokedexText[] = _(
+ "This POKéMON flies around, patrolling its\n"
+ "large territory. If its living space is\n"
+ "violated, it shows no mercy in thoroughly\n"
+ "punishing the foe with its sharp claws.");
+
+const u8 gPidgeotPokedexText[] = _(
+ "This POKéMON has gorgeous, glossy\n"
+ "feathers. Many TRAINERS are so captivated\n"
+ "by the beautiful feathers on its head that\n"
+ "they choose PIDGEOT as their POKéMON.");
+
+const u8 gRattataPokedexText[] = _(
+ "A RATTATA is cautious in the extreme.\n"
+ "Even while it is asleep, it constantly\n"
+ "moves its ears and listens for danger.\n"
+ "It will make its nest anywhere.");
+
+const u8 gRaticatePokedexText[] = _(
+ "A RATICATE’s sturdy fangs grow steadily.\n"
+ "To keep them ground down, it gnaws on\n"
+ "rocks and logs. It may even chew on the\n"
+ "walls of houses.");
+
+const u8 gSpearowPokedexText[] = _(
+ "Its loud cry can be heard over half a mile\n"
+ "away. If its high, keening cry is heard\n"
+ "echoing all around, it is a sign that they\n"
+ "are warning each other of danger.");
+
+const u8 gFearowPokedexText[] = _(
+ "Its long neck and elongated beak are\n"
+ "ideal for catching prey in soil or water.\n"
+ "It deftly moves this extended and skinny\n"
+ "beak to pluck prey.");
+
+const u8 gEkansPokedexText[] = _(
+ "An EKANS curls itself up in a spiral while\n"
+ "it rests. This position allows it to quickly\n"
+ "respond to an enemy from any direction\n"
+ "with a threat from its upraised head.");
+
+const u8 gArbokPokedexText[] = _(
+ "This POKéMON has a terrifically strong\n"
+ "constricting power. It can even flatten\n"
+ "steel oil drums. Once it wraps its body\n"
+ "around its foe, escaping is impossible.");
+
+const u8 gPikachuPokedexText[] = _(
+ "It stores electricity in the electric sacs\n"
+ "on its cheeks. When it releases pent-up\n"
+ "energy in a burst, the electric power is\n"
+ "equal to a lightning bolt.");
+
+const u8 gRaichuPokedexText[] = _(
+ "If it stores too much electricity, its\n"
+ "behavior turns aggressive. To avoid this,\n"
+ "it occasionally discharges excess energy\n"
+ "and calms itself down.");
+
+const u8 gSandshrewPokedexText[] = _(
+ "When it curls up in a ball, it can make any\n"
+ "attack bounce off harmlessly. Its hide has\n"
+ "turned tough and solid as a result of\n"
+ "living in the desert.");
+
+const u8 gSandslashPokedexText[] = _(
+ "It curls up in a ball to protect itself from\n"
+ "enemy attacks. It also curls up to prevent\n"
+ "heatstroke during the daytime when\n"
+ "temperatures rise sharply.");
+
+const u8 gNidoranFPokedexText[] = _(
+ "Its highly toxic barbs are thought to have\n"
+ "developed as protection for this small-\n"
+ "bodied POKéMON. When enraged, it releases\n"
+ "a horrible toxin from its horn.");
+
+const u8 gNidorinaPokedexText[] = _(
+ "When it is with its friends or\n"
+ "family, its barbs are tucked away to\n"
+ "prevent injury. It appears to become\n"
+ "nervous if separated from the others.");
+
+const u8 gNidoqueenPokedexText[] = _(
+ "It is adept at sending foes flying with\n"
+ "harsh tackles using its tough, scaly body.\n"
+ "This POKéMON is at its strongest when\n"
+ "it is defending its young.");
+
+const u8 gNidoranMPokedexText[] = _(
+ "The male NIDORAN has developed muscles\n"
+ "that freely move its ears in any direction.\n"
+ "Even the slightest sound does not escape\n"
+ "this POKéMON’s notice.");
+
+const u8 gNidorinoPokedexText[] = _(
+ "Its horn is harder than a diamond.\n"
+ "If it senses a hostile presence, all the\n"
+ "barbs on its back bristle up at once, and it\n"
+ "challenges the foe with all its might.");
+
+const u8 gNidokingPokedexText[] = _(
+ "A NIDOKING’s thick tail packs enormously\n"
+ "destructive power capable of toppling\n"
+ "a metal transmission tower. Once it goes\n"
+ "on a rampage, there is no stopping it.");
+
+const u8 gClefairyPokedexText[] = _(
+ "On every night of a full moon, they come\n"
+ "out to play. When dawn arrives, the tired\n"
+ "CLEFAIRY go to sleep nestled up against\n"
+ "each other in deep and quiet mountains.");
+
+const u8 gClefablePokedexText[] = _(
+ "A CLEFABLE uses its wings to skip lightly \n"
+ "as if it were flying. Its bouncy step\n"
+ "lets it even walk on water. On quiet,\n"
+ "moonlit nights, it strolls on lakes.");
+
+const u8 gVulpixPokedexText[] = _(
+ "It can freely control fire, making fiery\n"
+ "orbs fly like will-o’-the-wisps. Just\n"
+ "before evolution, its six tails grow hot \n"
+ "as if on fire.");
+
+const u8 gNinetalesPokedexText[] = _(
+ "It has long been said that each of the\n"
+ "nine tails embody an enchanted power.\n"
+ "A long-lived NINETALES will have fur that\n"
+ "shines like gold.");
+
+const u8 gJigglypuffPokedexText[] = _(
+ "Nothing can avoid falling asleep hearing a\n"
+ "JIGGLYPUFF’s song. The sound waves of its\n"
+ "singing voice match the brain waves of\n"
+ "someone in a deep sleep.");
+
+const u8 gWigglytuffPokedexText[] = _(
+ "Its fur is the ultimate in luxuriousness.\n"
+ "Sleeping alongside a WIGGLYTUFF is simply\n"
+ "divine. Its body expands seemingly without\n"
+ "end when it inhales.");
+
+const u8 gZubatPokedexText[] = _(
+ "While living in pitch-black caverns, their\n"
+ "eyes gradually grew shut and deprived\n"
+ "them of vision. They use ultrasonic waves\n"
+ "to detect obstacles.");
+
+const u8 gGolbatPokedexText[] = _(
+ "Its fangs easily puncture even thick\n"
+ "animal hide. It loves to feast on the blood\n"
+ "of people and POKéMON. It flits about in\n"
+ "darkness and strikes from behind.");
+
+const u8 gOddishPokedexText[] = _(
+ "This POKéMON grows by absorbing moonlight.\n"
+ "During the daytime, it buries itself in the\n"
+ "ground, leaving only its leaves exposed to\n"
+ "avoid detection by its enemies.");
+
+const u8 gGloomPokedexText[] = _(
+ "A horribly noxious honey drools from its\n"
+ "mouth. One whiff of the honey can result\n"
+ "in memory loss. Some fans are said to\n"
+ "enjoy this overwhelming stink, however.");
+
+const u8 gVileplumePokedexText[] = _(
+ "In seasons when it produces more pollen,\n"
+ "the air around a VILEPLUME turns yellow\n"
+ "with the powder as it walks. The pollen is\n"
+ "highly toxic and causes paralysis.");
+
+const u8 gParasPokedexText[] = _(
+ "A PARAS has parasitic tochukaso\n"
+ "mushrooms growing on its back. They grow\n"
+ "by drawing nutrients from the host. They\n"
+ "are valued as a medicine for long life.");
+
+const u8 gParasectPokedexText[] = _(
+ "PARASECT are known to infest the roots of\n"
+ "large trees en masse and drain nutrients.\n"
+ "When an infested tree dies, they move\n"
+ "onto another tree all at once.");
+
+const u8 gVenonatPokedexText[] = _(
+ "Its coat of thin, stiff hair that covers\n"
+ "its entire body is said to have evolved\n"
+ "for protection. Its large eyes never fail\n"
+ "to spot even miniscule prey.");
+
+const u8 gVenomothPokedexText[] = _(
+ "VENOMOTH are nocturnal--they only are\n"
+ "active at night. Their favorite prey are\n"
+ "insects that gather around streetlights,\n"
+ "attracted by the light in the darkness.");
+
+const u8 gDiglettPokedexText[] = _(
+ "DIGLETT are raised in most farms.\n"
+ "The reason is simple--wherever they\n"
+ "burrow, the soil is left perfectly tilled\n"
+ "for growing delicious crops.");
+
+const u8 gDugtrioPokedexText[] = _(
+ "Because the triplets originally split from\n"
+ "one body, they think exactly alike.\n"
+ "They work cooperatively to burrow\n"
+ "endlessly through the ground.");
+
+const u8 gMeowthPokedexText[] = _(
+ "MEOWTH withdraw their sharp claws into\n"
+ "their paws to silently sneak about.\n"
+ "For some reason, this POKéMON loves\n"
+ "shiny coins that glitter with light.");
+
+const u8 gPersianPokedexText[] = _(
+ "A PERSIAN’s six bold whiskers sense air\n"
+ "movements to determine what is in its\n"
+ "vicinity. It becomes docile if grabbed\n"
+ "by the whiskers.");
+
+const u8 gPsyduckPokedexText[] = _(
+ "When its headache intensifies, it starts\n"
+ "using strange powers. However, it has no\n"
+ "recollection of its powers, so it always\n"
+ "looks befuddled and bewildered.");
+
+const u8 gGolduckPokedexText[] = _(
+ "A GOLDUCK is an adept swimmer.\n"
+ "It sometimes joins competitive swimmers\n"
+ "in training. It uses psychic powers when\n"
+ "its forehead shimmers with light.");
+
+const u8 gMankeyPokedexText[] = _(
+ "When it starts shaking and its nasal\n"
+ "breathing turns rough, it’s a sure sign\n"
+ "of anger. However, since this happens\n"
+ "instantly, there is no time to flee.");
+
+const u8 gPrimeapePokedexText[] = _(
+ "When it becomes furious, its blood\n"
+ "circulation becomes more robust, and\n"
+ "its muscles are made stronger. But it\n"
+ "also becomes much less intelligent.");
+
+const u8 gGrowlithePokedexText[] = _(
+ "Its superb sense of smell ensures that\n"
+ "this POKéMON won’t forget any scent,\n"
+ "no matter what. It uses its sense of smell\n"
+ "to detect the emotions of others.");
+
+const u8 gArcaninePokedexText[] = _(
+ "This fleet-footed POKéMON is said to run\n"
+ "over 6,200 miles in a single day and night.\n"
+ "The fire that blazes wildly within its body\n"
+ "is its source of power.");
+
+const u8 gPoliwagPokedexText[] = _(
+ "It is possible to see this POKéMON’s spiral\n"
+ "innards right through its thin skin.\n"
+ "However, the skin is also very flexible.\n"
+ "Even sharp fangs bounce right off it.");
+
+const u8 gPoliwhirlPokedexText[] = _(
+ "Its body surface is always wet and slick\n"
+ "with an oily fluid. Because of this greasy\n"
+ "covering, it can easily slip and slide out\n"
+ "of the clutches of any enemy in battle.");
+
+const u8 gPoliwrathPokedexText[] = _(
+ "Its highly developed muscles never grow\n"
+ "fatigued, however much it exercises.\n"
+ "This POKéMON can swim back and forth\n"
+ "across the Pacific Ocean without effort.");
+
+const u8 gAbraPokedexText[] = _(
+ "A POKéMON that sleeps 18 hours a day.\n"
+ "Observation revealed that it uses\n"
+ "TELEPORT to change its location once\n"
+ "every hour.");
+
+const u8 gKadabraPokedexText[] = _(
+ "It is rumored that a boy with psychic\n"
+ "abilities suddenly transformed into\n"
+ "KADABRA while he was assisting research\n"
+ "into extrasensory powers.");
+
+const u8 gAlakazamPokedexText[] = _(
+ "While it has strong psychic abilities and\n"
+ "high intelligence, an ALAKAZAM’s muscles\n"
+ "are very weak. It uses psychic power to\n"
+ "move its body.");
+
+const u8 gMachopPokedexText[] = _(
+ "It continually undertakes strenuous\n"
+ "training to master all forms of martial\n"
+ "arts. Its strength lets it easily hoist\n"
+ "a sumo wrestler onto its shoulders.");
+
+const u8 gMachokePokedexText[] = _(
+ "A belt is worn by a MACHOKE to keep its\n"
+ "overwhelming power under control.\n"
+ "Because it is so dangerous, no one has\n"
+ "ever removed the belt.");
+
+const u8 gMachampPokedexText[] = _(
+ "It is impossible to defend against punches\n"
+ "and chops doled out by its four arms.\n"
+ "Its fighting spirit flares up when it faces\n"
+ "a tough opponent.");
+
+const u8 gBellsproutPokedexText[] = _(
+ "A BELLSPROUT’s thin and flexible body lets\n"
+ "it bend and sway to avoid any attack,\n"
+ "however strong it may be. From its mouth,\n"
+ "it leaks a fluid that melts even iron.");
+
+const u8 gWeepinbellPokedexText[] = _(
+ "At night, a WEEPINBELL hangs on to a tree\n"
+ "branch with its hooked rear and sleeps.\n"
+ "If it moves around in its sleep, it may\n"
+ "wake up to find itself on the ground.");
+
+const u8 gVictreebelPokedexText[] = _(
+ "The long vine extending from its head is\n"
+ "waved about as if it were a living thing to\n"
+ "attract prey. When an unsuspecting victim\n"
+ "approaches, it is swallowed whole.");
+
+const u8 gTentacoolPokedexText[] = _(
+ "Its body is almost entirely composed of\n"
+ "water. It ensnares its foe with its two\n"
+ "long tentacles, then stabs with the poison\n"
+ "stingers at their tips.");
+
+const u8 gTentacruelPokedexText[] = _(
+ "It lives in complex rock formations on\n"
+ "the ocean floor and traps prey using its\n"
+ "80 tentacles. Its red orbs glow when it\n"
+ "grows excited or agitated.");
+
+const u8 gGeodudePokedexText[] = _(
+ "It climbs mountain paths using only the\n"
+ "power of its arms. Because they look just\n"
+ "like boulders lining paths, hikers may step\n"
+ "on them without noticing.");
+
+const u8 gGravelerPokedexText[] = _(
+ "They descend from mountains by tumbling\n"
+ "down steep slopes. They are so brutal,\n"
+ "they smash aside obstructing trees and\n"
+ "massive boulders with thunderous tackles.");
+
+const u8 gGolemPokedexText[] = _(
+ "It is said to live in volcanic craters\n"
+ "on mountain peaks. Once a year, it sheds\n"
+ "its hide and grows larger. The shed hide\n"
+ "crumbles and returns to the soil.");
+
+const u8 gPonytaPokedexText[] = _(
+ "A PONYTA is very weak at birth. It can\n"
+ "barely stand up. Its legs become stronger\n"
+ "as it stumbles and falls while trying to\n"
+ "keep up with its parent.");
+
+const u8 gRapidashPokedexText[] = _(
+ "It usually canters casually in the fields\n"
+ "and plains. But once a RAPIDASH turns\n"
+ "serious, its fiery manes flare and blaze\n"
+ "as it gallops its way up to 150 mph.");
+
+const u8 gSlowpokePokedexText[] = _(
+ "It catches prey by dipping its tail in\n"
+ "water at the side of a river. But it often\n"
+ "forgets what it is doing and spends entire\n"
+ "days just loafing at water’s edge.");
+
+const u8 gSlowbroPokedexText[] = _(
+ "Its tail has a SHELLDER firmly attached\n"
+ "with a bite. As a result, the tail can’t be\n"
+ "used for fishing anymore. This forces it\n"
+ "to reluctantly swim and catch prey.");
+
+const u8 gMagnemitePokedexText[] = _(
+ "The units at its sides are extremely\n"
+ "powerful magnets. They generate enough\n"
+ "magnetism to draw in iron objects from\n"
+ "over 300 feet away.");
+
+const u8 gMagnetonPokedexText[] = _(
+ "It is actually three MAGNEMITE linked\n"
+ "by magnetism. It generates powerful radio\n"
+ "waves that raise temperatures by 3.6\n"
+ "degrees F within a 3,300-foot radius.");
+
+const u8 gFarfetchdPokedexText[] = _(
+ "It is always seen with a stick from a plant.\n"
+ "Apparently, there are good sticks and bad\n"
+ "sticks. This POKéMON occasionally fights\n"
+ "with others over choice sticks.");
+
+const u8 gDoduoPokedexText[] = _(
+ "Even while eating or sleeping, one of the\n"
+ "heads remains always vigilant for any sign\n"
+ "of danger. When threatened, it flees at\n"
+ "over 60 miles per hour.");
+
+const u8 gDodrioPokedexText[] = _(
+ "A peculiar POKéMON species with three\n"
+ "heads. It vigorously races across grassy\n"
+ "plains even in arid seasons with little\n"
+ "rainfall.");
+
+const u8 gSeelPokedexText[] = _(
+ "SEEL hunt for prey in frigid, ice-covered\n"
+ "seas. When it needs to breathe, it punches\n"
+ "a hole through the ice with the sharply\n"
+ "protruding section of its head.");
+
+const u8 gDewgongPokedexText[] = _(
+ "It loves to snooze on bitterly cold ice.\n"
+ "The sight of this POKéMON sleeping on\n"
+ "a glacier was mistakenly thought to be\n"
+ "a mermaid by a mariner long ago.");
+
+const u8 gGrimerPokedexText[] = _(
+ "Born from polluted sludge in the sea,\n"
+ "GRIMER’s favorite food is anything filthy.\n"
+ "They feed on wastewater pumped out from\n"
+ "factories.");
+
+const u8 gMukPokedexText[] = _(
+ "It prefers warm and humid habitats.\n"
+ "In the summertime, the toxic substances\n"
+ "in its body intensify, making MUK reek like\n"
+ "putrid kitchen garbage.");
+
+const u8 gShellderPokedexText[] = _(
+ "At night, it burrows a hole in the seafloor\n"
+ "with its broad tongue to make a place to\n"
+ "sleep. While asleep, it closes its shell,\n"
+ "but leaves its tongue hanging out.");
+
+const u8 gCloysterPokedexText[] = _(
+ "It swims in the sea by swallowing water,\n"
+ "then jetting it out toward the rear.\n"
+ "The CLOYSTER shoots spikes from its\n"
+ "shell using the same system.");
+
+const u8 gGastlyPokedexText[] = _(
+ "When exposed to a strong wind, a GASTLY’s\n"
+ "gaseous body quickly dwindles away.\n"
+ "They cluster under the eaves of houses\n"
+ "to escape the ravages of wind.");
+
+const u8 gHaunterPokedexText[] = _(
+ "If a HAUNTER beckons you while it is\n"
+ "floating in darkness, don’t approach it.\n"
+ "This POKéMON will try to lick you with its\n"
+ "tongue and steal your life away.");
+
+const u8 gGengarPokedexText[] = _(
+ "Deep in the night, your shadow cast by\n"
+ "a streetlight may suddenly overtake you.\n"
+ "It is actually a GENGAR running past\n"
+ "you, pretending to be your shadow.");
+
+const u8 gOnixPokedexText[] = _(
+ "There is a magnet in its brain that\n"
+ "prevents an ONIX from losing direction\n"
+ "while tunneling. As it grows older, its body\n"
+ "becomes steadily rounder and smoother.");
+
+const u8 gDrowzeePokedexText[] = _(
+ "If your nose becomes itchy while you are\n"
+ "sleeping, it’s a sure sign that a DROWZEE is\n"
+ "standing above your pillow and trying to\n"
+ "eat your dream through your nostrils.");
+
+const u8 gHypnoPokedexText[] = _(
+ "The arcing movement and glitter of the\n"
+ "pendulum in a HYPNO’s hand lull the foe\n"
+ "into deep hypnosis. While searching for\n"
+ "prey, it polishes the pendulum.");
+
+const u8 gKrabbyPokedexText[] = _(
+ "KRABBY live in holes dug into beaches.\n"
+ "On sandy shores with little in the way\n"
+ "of food, they can be seen squabbling with\n"
+ "each other over territory.");
+
+const u8 gKinglerPokedexText[] = _(
+ "It waves its huge, oversized claw in the\n"
+ "air to communicate with others.\n"
+ "But since the claw is so heavy, this\n"
+ "POKéMON quickly tires.");
+
+const u8 gVoltorbPokedexText[] = _(
+ "It bears an uncanny and unexplained\n"
+ "resemblance to a POKé BALL. Because it\n"
+ "explodes at the slightest shock, even\n"
+ "veteran TRAINERS treat it with caution.");
+
+const u8 gElectrodePokedexText[] = _(
+ "They appear in great numbers at electric\n"
+ "power plants. Because they feed on\n"
+ "electricity, they cause massive and\n"
+ "chaotic blackouts in nearby cities.");
+
+const u8 gExeggcutePokedexText[] = _(
+ "It consists of six eggs that care for each\n"
+ "other. The eggs attract each other and\n"
+ "spin around. When cracks increasingly\n"
+ "appear, it is close to evolution.");
+
+const u8 gExeggutorPokedexText[] = _(
+ "Originally from the tropics, EXEGGUTOR’s\n"
+ "heads grow larger from exposure to strong\n"
+ "sunlight. It is said that when the heads\n"
+ "fall, they group to form an EXEGGCUTE.");
+
+const u8 gCubonePokedexText[] = _(
+ "It pines for the mother it will never see\n"
+ "again. Seeing a likeness of its mother in\n"
+ "the full moon, it cries. The stains on the\n"
+ "skull it wears are from its tears.");
+
+const u8 gMarowakPokedexText[] = _(
+ "A MAROWAK is the evolved form of a CUBONE\n"
+ "that has grown tough by overcoming the\n"
+ "grief of losing its mother. Its tempered\n"
+ "and hardened spirit is not easily broken.");
+
+const u8 gHitmonleePokedexText[] = _(
+ "Its legs freely stretch and contract.\n"
+ "Using these springlike limbs, it bowls over\n"
+ "foes with devastating kicks. After battle,\n"
+ "it rubs down its tired legs.");
+
+const u8 gHitmonchanPokedexText[] = _(
+ "A HITMONCHAN is said to possess the\n"
+ "spirit of a boxer who aimed to become the\n"
+ "world champion. Having an indomitable\n"
+ "spirit means that it will never give up.");
+
+const u8 gLickitungPokedexText[] = _(
+ "Whenever it sees something unfamiliar,\n"
+ "it always licks the object because it\n"
+ "memorizes things by texture and taste.\n"
+ "It is somewhat put off by sour things.");
+
+const u8 gKoffingPokedexText[] = _(
+ "Getting up close to a KOFFING will give\n"
+ "you a chance to observe, through its thin\n"
+ "skin, the toxic gases swirling inside. It\n"
+ "blows up at the slightest stimulation.");
+
+const u8 gWeezingPokedexText[] = _(
+ "By diluting its toxic gases with a special\n"
+ "process, the highest grade of perfume can\n"
+ "be extracted. To WEEZING, gases emanating\n"
+ "from garbage are the ultimate feast.");
+
+const u8 gRhyhornPokedexText[] = _(
+ "Once it starts running, it doesn’t stop.\n"
+ "Its tiny brain makes it so stupid that it\n"
+ "can’t remember why it started running in\n"
+ "the first place.");
+
+const u8 gRhydonPokedexText[] = _(
+ "Its horn, which rotates like a drill,\n"
+ "destroys tall buildings with one strike.\n"
+ "It stands on its hind legs, and its brain\n"
+ "is well developed.");
+
+const u8 gChanseyPokedexText[] = _(
+ "CHANSEY lay nutritionally excellent eggs\n"
+ "every day. The eggs are so delicious, they\n"
+ "are eagerly devoured by even those people\n"
+ "who have lost their appetite.");
+
+const u8 gTangelaPokedexText[] = _(
+ "Its vines snap off easily and painlessly\n"
+ "if they are grabbed, allowing it to make a\n"
+ "quick getaway. The lost vines are replaced\n"
+ "by new growth the very next day.");
+
+const u8 gKangaskhanPokedexText[] = _(
+ "If you come across a young KANGASKHAN\n"
+ "playing by itself, never try to catch it.\n"
+ "The baby’s parent is sure to be in the area,\n"
+ "and it will become violently enraged.");
+
+const u8 gHorseaPokedexText[] = _(
+ "By cleverly flicking the fins on its back\n"
+ "side to side, it moves in any direction\n"
+ "while facing forward. It spits ink to\n"
+ "escape if it senses danger.");
+
+const u8 gSeadraPokedexText[] = _(
+ "The poisonous barbs all over its body are\n"
+ "highly valued as ingredients for making\n"
+ "traditional herbal medicine. It shows no\n"
+ "mercy to anything approaching its nest.");
+
+const u8 gGoldeenPokedexText[] = _(
+ "In the springtime, schools of GOLDEEN\n"
+ "can be seen swimming up falls and rivers.\n"
+ "It metes out staggering damage with its\n"
+ "single horn.");
+
+const u8 gSeakingPokedexText[] = _(
+ "It punches holes in boulders on stream-\n"
+ "beds. This is a clever innovation that\n"
+ "prevents its eggs from being attacked or\n"
+ "washed away by the current.");
+
+const u8 gStaryuPokedexText[] = _(
+ "It gathers with others in the night and\n"
+ "makes its red core glow on and off with\n"
+ "the twinkling stars. It can regenerate\n"
+ "limbs if they are severed from its body.");
+
+const u8 gStarmiePokedexText[] = _(
+ "People in ancient times imagined that\n"
+ "STARMIE were transformed from the\n"
+ "reflections of stars that twinkled on\n"
+ "gentle waves at night.");
+
+const u8 gMrmimePokedexText[] = _(
+ "A MR. MIME is a master of pantomime. It can\n"
+ "convince others that something unseeable\n"
+ "actually exists. Once believed, the\n"
+ "imaginary object does become real.");
+
+const u8 gScytherPokedexText[] = _(
+ "Its blindingly fast speed adds to the\n"
+ "sharpness of its twin forearm scythes.\n"
+ "The scythes can slice through thick logs\n"
+ "in one wicked stroke.");
+
+const u8 gJynxPokedexText[] = _(
+ "A JYNX sashays rhythmically as if it were\n"
+ "dancing. Its motions are so bouncingly\n"
+ "alluring, people seeing it are compelled to\n"
+ "shake their hips without noticing.");
+
+const u8 gElectabuzzPokedexText[] = _(
+ "When a storm approaches, it competes with\n"
+ "others to scale heights that are likely to\n"
+ "be stricken by lightning. Some towns use\n"
+ "ELECTABUZZ in place of lightning rods.");
+
+const u8 gMagmarPokedexText[] = _(
+ "In battle, it blows out intense flames from\n"
+ "all over its body to intimidate its foe.\n"
+ "These fiery bursts create heat waves that\n"
+ "ignite grass and trees in the area.");
+
+const u8 gPinsirPokedexText[] = _(
+ "Their pincers are strong enough to\n"
+ "shatter thick logs. Because they dislike\n"
+ "cold, PINSIR burrow and sleep under\n"
+ "the ground on chilly nights.");
+
+const u8 gTaurosPokedexText[] = _(
+ "It is not satisfied unless it is rampaging\n"
+ "at all times. If there is no opponent for\n"
+ "TAUROS to battle, it will charge at thick\n"
+ "trees and knock them down to calm itself.");
+
+const u8 gMagikarpPokedexText[] = _(
+ "Its swimming muscles are weak, so it is\n"
+ "easily washed away by currents. In places\n"
+ "where water pools, you can see many\n"
+ "MAGIKARP deposited there by the flow.");
+
+const u8 gGyaradosPokedexText[] = _(
+ "It is an extremely vicious and violent\n"
+ "POKéMON. When humans begin to fight,\n"
+ "it will appear and burn everything to the\n"
+ "ground with intensely hot flames.");
+
+const u8 gLaprasPokedexText[] = _(
+ "People have driven LAPRAS almost to the\n"
+ "point of extinction. In the evenings,\n"
+ "it is said to sing plaintively as it seeks\n"
+ "what few others of its kind still remain.");
+
+const u8 gDittoPokedexText[] = _(
+ "A DITTO rearranges its cell structure to\n"
+ "transform itself. However, if it tries to\n"
+ "change based on its memory, it will get\n"
+ "details wrong.");
+
+const u8 gEeveePokedexText[] = _(
+ "An EEVEE has an unstable genetic makeup\n"
+ "that suddenly mutates due to its\n"
+ "environment. Radiation from various\n"
+ "STONES causes this POKéMON to evolve.");
+
+const u8 gVaporeonPokedexText[] = _(
+ "VAPOREON underwent a spontaneous\n"
+ "mutation and grew fins and gills that\n"
+ "allow them to live underwater. They have\n"
+ "the ability to freely control water.");
+
+const u8 gJolteonPokedexText[] = _(
+ "Its cells generate weak power that is\n"
+ "amplified by its fur’s static electricity\n"
+ "to drop thunderbolts. The bristling fur is\n"
+ "made of electrically charged needles.");
+
+const u8 gFlareonPokedexText[] = _(
+ "FLAREON’s fluffy fur releases heat into\n"
+ "the air so that its body does not get\n"
+ "excessively hot. Its body temperature can\n"
+ "rise to a maximum of 1,650 degrees F.");
+
+const u8 gPorygonPokedexText[] = _(
+ "It is capable of reverting itself entirely\n"
+ "back to program data in order to enter\n"
+ "cyberspace. A PORYGON is copy-\n"
+ "protected so it cannot be duplicated.");
+
+const u8 gOmanytePokedexText[] = _(
+ "One of the ancient and long-since-extinct\n"
+ "POKéMON that have been regenerated\n"
+ "from fossils by humans. If attacked,\n"
+ "it withdraws into its hard shell.");
+
+const u8 gOmastarPokedexText[] = _(
+ "An OMASTAR uses its tentacles to capture\n"
+ "its prey. It is believed to have become\n"
+ "extinct because its shell grew too large,\n"
+ "making its movements slow and ponderous.");
+
+const u8 gKabutoPokedexText[] = _(
+ "It is a POKéMON that has been regenerated\n"
+ "from a fossil. However, in rare cases, living\n"
+ "examples have been discovered. KABUTO\n"
+ "have not changed for 300 million years.");
+
+const u8 gKabutopsPokedexText[] = _(
+ "KABUTOPS once swam underwater to hunt \n"
+ "for prey. It was apparently evolving from\n"
+ "being a water dweller to living on land as\n"
+ "evident from changes in its gills and legs.");
+
+const u8 gAerodactylPokedexText[] = _(
+ "AERODACTYL is a POKéMON from the age\n"
+ "of dinosaurs. It was regenerated from DNA\n"
+ "extracted from amber. It is imagined to\n"
+ "have been the king of the skies.");
+
+const u8 gSnorlaxPokedexText[] = _(
+ "SNORLAX’s typical day consists of nothing\n"
+ "more than eating and sleeping. It is such\n"
+ "a docile POKéMON that there are children\n"
+ "who use its big belly as a place to play.");
+
+const u8 gArticunoPokedexText[] = _(
+ "ARTICUNO is a legendary bird POKéMON that\n"
+ "can control ice. The flapping of its wings\n"
+ "chills the air. As a result, it is said that\n"
+ "when this POKéMON flies, snow will fall.");
+
+const u8 gZapdosPokedexText[] = _(
+ "ZAPDOS is a legendary bird POKéMON that\n"
+ "has the ability to control electricity.\n"
+ "It usually lives in thunderclouds. It gains\n"
+ "power if it is stricken by lightning bolts.");
+
+const u8 gMoltresPokedexText[] = _(
+ "MOLTRES is a legendary bird POKéMON\n"
+ "that can control fire. If injured, it is said\n"
+ "to dip its body in the molten magma of\n"
+ "a volcano to burn and heal itself.");
+
+const u8 gDratiniPokedexText[] = _(
+ "A DRATINI continually molts and sloughs\n"
+ "off its old skin. It does so because the\n"
+ "life energy within its body steadily builds\n"
+ "to reach uncontrollable levels.");
+
+const u8 gDragonairPokedexText[] = _(
+ "A DRAGONAIR stores an enormous amount of\n"
+ "energy inside its body. It is said to alter\n"
+ "the weather around it by loosing energy\n"
+ "from the crystals on its neck and tail.");
+
+const u8 gDragonitePokedexText[] = _(
+ "It can circle the globe in just 16 hours.\n"
+ "It is a kindhearted POKéMON that leads\n"
+ "lost and foundering ships in a storm\n"
+ "to the safety of land.");
+
+const u8 gMewtwoPokedexText[] = _(
+ "A POKéMON that was created by genetic\n"
+ "manipulation. However, even though the\n"
+ "scientific power of humans made its body,\n"
+ "they failed to give it a warm heart.");
+
+const u8 gMewPokedexText[] = _(
+ "A MEW is said to possess the genes of all\n"
+ "POKéMON. It is capable of making itself\n"
+ "invisible at will, so it entirely avoids\n"
+ "notice even if it approaches people.");
+
+const u8 gChikoritaPokedexText[] = _(
+ "It waves its leaf around to keep foes\n"
+ "at bay. However, a sweet fragrance also\n"
+ "wafts from the leaf, creating a friendly\n"
+ "atmosphere that becalms the battlers.");
+
+const u8 gBayleefPokedexText[] = _(
+ "A BAYLEEF’s neck is ringed by curled-up\n"
+ "leaves. Inside each leaf is a small tree\n"
+ "shoot. The fragrance of this shoot\n"
+ "makes people peppy.");
+
+const u8 gMeganiumPokedexText[] = _(
+ "The fragrance of a MEGANIUM’s flower\n"
+ "soothes and calms emotions. In battle,\n"
+ "it gives off more of its becalming scent\n"
+ "to blunt the foe’s fighting spirit.");
+
+const u8 gCyndaquilPokedexText[] = _(
+ "It flares flames from its back to protect\n"
+ "itself. The fire burns vigorously if the\n"
+ "POKéMON is angry. When it is tired,\n"
+ "it sputters with incomplete combustion.");
+
+const u8 gQuilavaPokedexText[] = _(
+ "It intimidates foes with intense gusts of\n"
+ "flames and superheated air. Its quick\n"
+ "nimbleness lets it dodge attacks even\n"
+ "while scorching an enemy.");
+
+const u8 gTyphlosionPokedexText[] = _(
+ "It can hide behind a shimmering heat haze\n"
+ "that it creates using its intense flames.\n"
+ "TYPHLOSION create blazing explosive\n"
+ "blasts that burn everything to cinders.");
+
+const u8 gTotodilePokedexText[] = _(
+ "Despite its small body, TOTODILE’s jaws\n"
+ "are very powerful. While it may think it is\n"
+ "just playfully nipping, its bite has enough\n"
+ "strength to cause serious injury.");
+
+const u8 gCroconawPokedexText[] = _(
+ "Once its jaws clamp down on its foe, it will\n"
+ "absolutely not let go. Because the tips of\n"
+ "its fangs are forked back like fishhooks,\n"
+ "they become irremovably embedded.");
+
+const u8 gFeraligatrPokedexText[] = _(
+ "It opens its huge mouth to intimidate\n"
+ "enemies. In battle, it runs using its thick\n"
+ "and powerful hind legs to charge the\n"
+ "foe with incredible speed.");
+
+const u8 gSentretPokedexText[] = _(
+ "They take turns standing guard when it\n"
+ "is time to sleep. The sentry awakens the\n"
+ "others if it senses danger. If one becomes\n"
+ "separated, it turns sleepless with fear.");
+
+const u8 gFurretPokedexText[] = _(
+ "A FURRET has a very slim build. When under\n"
+ "attack, it can squirm through narrow\n"
+ "spaces and get away. In spite of its short\n"
+ "limbs, it is very nimble and fleet.");
+
+const u8 gHoothootPokedexText[] = _(
+ "It has an internal organ that senses\n"
+ "the earth’s rotation. Using this special\n"
+ "organ, a HOOTHOOT begins hooting at\n"
+ "precisely the same time every day.");
+
+const u8 gNoctowlPokedexText[] = _(
+ "It unfailingly catches prey in darkness.\n"
+ "NOCTOWL owe their success to superior\n"
+ "vision that allows them to see in minimal\n"
+ "light, and to their supple and silent wings.");
+
+const u8 gLedybaPokedexText[] = _(
+ "LEDYBA communicate using a fluid that\n"
+ "they secrete from where the legs join the\n"
+ "body. They are said to convey feelings to\n"
+ "others by altering the fluid’s scent.");
+
+const u8 gLedianPokedexText[] = _(
+ "It is said that in lands with clean air,\n"
+ "where the stars fill the sky, there live\n"
+ "many LEDIAN. For good reason, they use\n"
+ "the light of the stars as energy.");
+
+const u8 gSpinarakPokedexText[] = _(
+ "The web it spins can be considered its\n"
+ "second nervous system. It is said that a\n"
+ "SPINARAK determines its prey by the tiny\n"
+ "vibrations it feels through the web.");
+
+const u8 gAriadosPokedexText[] = _(
+ "Its feet are tipped with tiny hooked claws\n"
+ "that enable it to scuttle on ceilings and\n"
+ "vertical walls. It constricts its foe with\n"
+ "thin and strong silk webbing.");
+
+const u8 gCrobatPokedexText[] = _(
+ "Over the course of evolution, its hind legs\n"
+ "turned into wings. By alternately resting\n"
+ "its front and rear wings, it can fly all day\n"
+ "without having to stop.");
+
+const u8 gChinchouPokedexText[] = _(
+ "When it senses danger, it discharges\n"
+ "positive and negative electricity from its\n"
+ "two antennae. It lives in depths beyond\n"
+ "sunlight’s reach.");
+
+const u8 gLanturnPokedexText[] = _(
+ "The light-emitting orbs on its back are\n"
+ "very bright. They are formed from a part of\n"
+ "its dorsal fin. This POKéMON illuminates\n"
+ "the inky darkness of deep seas.");
+
+const u8 gPichuPokedexText[] = _(
+ "It is still inept at retaining electricity.\n"
+ "When it is startled, it discharges power\n"
+ "accidentally. It gets better at holding\n"
+ "power as it grows older.");
+
+const u8 gCleffaPokedexText[] = _(
+ "On nights with many shooting stars,\n"
+ "CLEFFA can be seen dancing in a ring.\n"
+ "They dance until daybreak, when they\n"
+ "quench their thirst with the morning dew.");
+
+const u8 gIgglybuffPokedexText[] = _(
+ "Its soft and pliable body is very bouncy.\n"
+ "When it sings continuously with all its\n"
+ "might, its body steadily turns a deepening\n"
+ "pink color.");
+
+const u8 gTogepiPokedexText[] = _(
+ "As its energy, it uses the feelings of\n"
+ "compassion and pleasure exuded by\n"
+ "people and POKéMON. It stores up happy\n"
+ "feelings in its shell, then shares them out.");
+
+const u8 gTogeticPokedexText[] = _(
+ "It is said to be a POKéMON that brings good\n"
+ "fortune. When it spots someone who is pure\n"
+ "of heart, a TOGETIC appears and shares its\n"
+ "happiness with that person.");
+
+const u8 gNatuPokedexText[] = _(
+ "It runs up short trees that grow on the\n"
+ "savanna to peck at new shoots.\n"
+ "A NATU’s eyes look as if they are\n"
+ "always observing something.");
+
+const u8 gXatuPokedexText[] = _(
+ "It has the enigmatic power of foreseeing\n"
+ "the future. Some people in different lands\n"
+ "have long believed that XATU are\n"
+ "emissaries from another world.");
+
+const u8 gMareepPokedexText[] = _(
+ "Its fluffy wool rubs together and builds\n"
+ "a static charge. The more energy is\n"
+ "charged, the more brightly the lightbulb\n"
+ "at the tip of its tail glows.");
+
+const u8 gFlaaffyPokedexText[] = _(
+ "Its fleece quality changes to generate\n"
+ "strong static electricity with a small\n"
+ "amount of wool. The bare, slick parts of its\n"
+ "hide are shielded against electricity.");
+
+const u8 gAmpharosPokedexText[] = _(
+ "It gives off so much light that it can be\n"
+ "seen even from space. People in the old\n"
+ "days used its light to send signals back\n"
+ "and forth with others far away.");
+
+const u8 gBellossomPokedexText[] = _(
+ "Its flower petals deepen in color through\n"
+ "exposure to sunlight. When cloudy weather\n"
+ "persists, it does a dance that is thought\n"
+ "to be a ritual for summoning the sun.");
+
+const u8 gMarillPokedexText[] = _(
+ "Its body is covered with water-repellent\n"
+ "fur. Because of the fur, it can swim\n"
+ "through water at high speed without being\n"
+ "slowed by the water’s resistance.");
+
+const u8 gAzumarillPokedexText[] = _(
+ "It lives in water virtually all day long.\n"
+ "Its body color and pattern act as\n"
+ "camouflage that makes it tough for\n"
+ "enemies to spot in water.");
+
+const u8 gSudowoodoPokedexText[] = _(
+ "It mimics a tree to avoid being attacked\n"
+ "by enemies. But since its forelegs\n"
+ "remain green throughout the year, it is\n"
+ "easily identified as a fake in the winter.");
+
+const u8 gPolitoedPokedexText[] = _(
+ "The curled hair on its head proves its\n"
+ "status as a king. It is said that the\n"
+ "longer and curlier the hair, the more\n"
+ "respect it earns from its peers.");
+
+const u8 gHoppipPokedexText[] = _(
+ "This POKéMON drifts and floats with the\n"
+ "wind. If it senses the approach of strong\n"
+ "winds, a HOPPIP links leaves with others\n"
+ "to prepare against being blown away.");
+
+const u8 gSkiploomPokedexText[] = _(
+ "It blossoms when the temperature rises\n"
+ "above 64 degrees F. Because its flower’s\n"
+ "blooming changes with the temperature,\n"
+ "it is sometimes used as a thermometer.");
+
+const u8 gJumpluffPokedexText[] = _(
+ "JUMPLUFF ride warm southern winds to\n"
+ "cross the sea and fly to foreign lands.\n"
+ "This POKéMON lands when it encounters\n"
+ "cold air while it is floating.");
+
+const u8 gAipomPokedexText[] = _(
+ "Its tail ends with a dexterous, handlike\n"
+ "appendage. However, because it uses the\n"
+ "tail so much, AIPOM’s real hands have\n"
+ "become rather clumsy.");
+
+const u8 gSunkernPokedexText[] = _(
+ "SUNKERN try to minimize movement to\n"
+ "conserve the nutrients they have stored\n"
+ "in their bodies for evolution. They will\n"
+ "not eat, subsisting only on morning dew.");
+
+const u8 gSunfloraPokedexText[] = _(
+ "SUNFLORA convert solar energy into\n"
+ "nutrition. They are highly active in the\n"
+ "warm daytime but suddenly stop moving as\n"
+ "soon as the sun sets.");
+
+const u8 gYanmaPokedexText[] = _(
+ "It can see 360 degrees without moving\n"
+ "its eyes. It is a great flier capable of\n"
+ "making sudden stops and turning midair to\n"
+ "quickly chase down targeted prey.");
+
+const u8 gWooperPokedexText[] = _(
+ "WOOPER usually live in water but come\n"
+ "out onto land seeking food occasionally.\n"
+ "On land, they coat their bodies with a\n"
+ "gooey, toxic film.");
+
+const u8 gQuagsirePokedexText[] = _(
+ "A QUAGSIRE hunts by leaving its mouth wide\n"
+ "open in water and waiting for its prey to\n"
+ "blunder in. Because it doesn’t move, it\n"
+ "does not get very hungry.");
+
+const u8 gEspeonPokedexText[] = _(
+ "An ESPEON is extremely loyal to any\n"
+ "TRAINER it considers to be worthy. It is\n"
+ "said to have developed precognitive\n"
+ "powers to protect its TRAINER from harm.");
+
+const u8 gUmbreonPokedexText[] = _(
+ "UMBREON evolved from exposure to the\n"
+ "moon’s energy pulses. It lurks in darkness\n"
+ "and waits for its foes to move. The rings\n"
+ "on its body glow when it leaps to attack.");
+
+const u8 gMurkrowPokedexText[] = _(
+ "MURKROW were feared as the alleged\n"
+ "bearers of ill fortune. It shows strong\n"
+ "interest in anything that sparkles. It will\n"
+ "even try to steal rings from women.");
+
+const u8 gSlowkingPokedexText[] = _(
+ "It undertakes research every day to\n"
+ "solve the mysteries of the world.\n"
+ "However, it apparently forgets everything\n"
+ "if the SHELLDER on its head comes off.");
+
+const u8 gMisdreavusPokedexText[] = _(
+ "A MISDREAVUS frightens people with a\n"
+ "creepy, sobbing cry. It apparently uses\n"
+ "its red spheres to absorb the fear of foes\n"
+ "as its nutrition.");
+
+const u8 gUnownPokedexText[] = _(
+ "This POKéMON is shaped like ancient text\n"
+ "characters. Although research is ongoing,\n"
+ "it is a mystery as to which came first,\n"
+ "the ancient writings or the various UNOWN.");
+
+const u8 gWobbuffetPokedexText[] = _(
+ "Usually docile, a WOBBUFFET strikes back\n"
+ "ferociously if its black tail is attacked.\n"
+ "It makes its lair in caves where it waits\n"
+ "for nightfall.");
+
+const u8 gGirafarigPokedexText[] = _(
+ "A GIRAFARIG is an herbivore--it eats\n"
+ "grass and tree shoots. While it is eating,\n"
+ "its tail makes chewing and swallowing\n"
+ "motions as if it were also eating.");
+
+const u8 gPinecoPokedexText[] = _(
+ "A PINECO hangs from a tree branch and\n"
+ "waits for prey. While eating, if it is\n"
+ "disturbed by someone shaking its tree, it\n"
+ "falls on the ground and suddenly explodes.");
+
+const u8 gForretressPokedexText[] = _(
+ "It keeps itself inside its steel shell.\n"
+ "The shell is opened when it is catching\n"
+ "prey, but it is so quick that the shell’s\n"
+ "inside cannot be seen.");
+
+const u8 gDunsparcePokedexText[] = _(
+ "Its drill-tipped tail is used to burrow into\n"
+ "the ground backwards. This POKéMON is\n"
+ "known to make its nest in complex shapes\n"
+ "deep under the ground.");
+
+const u8 gGligarPokedexText[] = _(
+ "It glides without making a single sound.\n"
+ "It grasps the face of its foe using its\n"
+ "hind and large front claws, then stabs\n"
+ "with its poison barb.");
+
+const u8 gSteelixPokedexText[] = _(
+ "STEELIX live even further underground\n"
+ "than ONIX. This POKéMON is known to dig\n"
+ "toward the earth’s core, reaching a depth\n"
+ "of over six-tenths of a mile underground.");
+
+const u8 gSnubbullPokedexText[] = _(
+ "By baring its fangs and making a scary\n"
+ "face, it sends smaller POKéMON scurrying\n"
+ "in terror. The SNUBBULL does seem a\n"
+ "little sad at making its foes flee.");
+
+const u8 gGranbullPokedexText[] = _(
+ "It has a particularly well-developed lower\n"
+ "jaw. The huge fangs are heavy, causing\n"
+ "it to tilt its head. Unless it is startled, it\n"
+ "will not try to bite.");
+
+const u8 gQwilfishPokedexText[] = _(
+ "A QWILFISH uses the pressure of water\n"
+ "it swallows to shoot toxic quills all at\n"
+ "once from all over its body. It finds\n"
+ "swimming to be somewhat challenging.");
+
+const u8 gScizorPokedexText[] = _(
+ "A SCIZOR has a body with the hardness of\n"
+ "steel. It is not easily fazed by ordinary\n"
+ "sorts of attacks. It flaps its wings to\n"
+ "regulate its body temperature.");
+
+const u8 gShucklePokedexText[] = _(
+ "A SHUCKLE hides under rocks, keeping its\n"
+ "body concealed inside its shell while\n"
+ "eating stored berries. The berries mix with\n"
+ "its body fluids to become a juice.");
+
+const u8 gHeracrossPokedexText[] = _(
+ "They gather in forests seeking the sweet\n"
+ "sap of trees. It is completely clad in a\n"
+ "steel-hard shell. It is proud of its horn,\n"
+ "which it uses to fling foes.");
+
+const u8 gSneaselPokedexText[] = _(
+ "A SNEASEL scales trees by punching its\n"
+ "hooked claws into the bark. It seeks out\n"
+ "unguarded nests and steals eggs for food\n"
+ "while the parents are away.");
+
+const u8 gTeddiursaPokedexText[] = _(
+ "It licks its palms that are sweetened by\n"
+ "being soaked in honey. A TEDDIURSA makes\n"
+ "its own honey by blending fruits and pollen\n"
+ "collected by BEEDRILL.");
+
+const u8 gUrsaringPokedexText[] = _(
+ "In forests, it is said that there are many\n"
+ "streams and towering trees where an\n"
+ "URSARING gathers food. It walks through\n"
+ "its forest collecting food every day.");
+
+const u8 gSlugmaPokedexText[] = _(
+ "It is a species of POKéMON that lives in\n"
+ "volcanic areas. If its body cools, its skin\n"
+ "hardens and immobilizes it. To avoid that,\n"
+ "it sleeps near magma.");
+
+const u8 gMagcargoPokedexText[] = _(
+ "The shell on its back is made of hardened\n"
+ "magma. Tens of thousands of years spent\n"
+ "living in volcanic craters have turned\n"
+ "MAGCARGO’s bodies into magma.");
+
+const u8 gSwinubPokedexText[] = _(
+ "It roots for food by rubbing its snout\n"
+ "against the ground. Its favorite food is a\n"
+ "mushroom that grows under dried grass.\n"
+ "It occasionally roots out hot springs.");
+
+const u8 gPiloswinePokedexText[] = _(
+ "A PILOSWINE is covered by a thick coat\n"
+ "of long hair for enduring freezing cold.\n"
+ "It uses its tusks to dig up food that has\n"
+ "been buried under ice.");
+
+const u8 gCorsolaPokedexText[] = _(
+ "CORSOLA live in warm southern seas.\n"
+ "If the sea becomes polluted, the beautiful\n"
+ "coral stalks become discolored and crumble\n"
+ "away in tatters.");
+
+const u8 gRemoraidPokedexText[] = _(
+ "A REMORAID uses its abdominal muscles\n"
+ "to forcefully expel swallowed water, then\n"
+ "shoot down flying prey. When evolution\n"
+ "approaches, it travels down rivers.");
+
+const u8 gOctilleryPokedexText[] = _(
+ "It ensnares its foe with its suction-\n"
+ "cupped tentacles before delivering the\n"
+ "finishing blow. If the foe turns out to be\n"
+ "too strong, it spews ink to escape.");
+
+const u8 gDelibirdPokedexText[] = _(
+ "It carries food bundled up in its tail.\n"
+ "There was a famous explorer who\n"
+ "managed to scale Mt. Everest thanks\n"
+ "to a DELIBIRD sharing its food.");
+
+const u8 gMantinePokedexText[] = _(
+ "On sunny days, schools of MANTINE can be\n"
+ "seen elegantly leaping over the waves.\n"
+ "It is not bothered by the REMORAID that\n"
+ "hitches rides.");
+
+const u8 gSkarmoryPokedexText[] = _(
+ "A POKéMON that has a body and wings of\n"
+ "steel. People in the past used feathers\n"
+ "fallen from SKARMORY to make swords and\n"
+ "knives.");
+
+const u8 gHoundourPokedexText[] = _(
+ "HOUNDOUR communicate with each other\n"
+ "using a variety of cries to corner their\n"
+ "prey. This POKéMON’s remarkable teamwork\n"
+ "is simply unparalleled.");
+
+const u8 gHoundoomPokedexText[] = _(
+ "In a HOUNDOOM pack, the one with its horns\n"
+ "raked sharply back serves a leadership\n"
+ "role. They choose their leader by fighting\n"
+ "among themselves.");
+
+const u8 gKingdraPokedexText[] = _(
+ "It sleeps quietly, deep on the seafloor.\n"
+ "When it comes up to the surface, it\n"
+ "creates a huge whirlpool that can swallow\n"
+ "even ships.");
+
+const u8 gPhanpyPokedexText[] = _(
+ "PHANPY’s big ears serve as broad fans.\n"
+ "When it becomes hot, it flaps the ears\n"
+ "busily to cool down. Even the young are\n"
+ "very strong.");
+
+const u8 gDonphanPokedexText[] = _(
+ "A DONPHAN is so strong it can easily haul\n"
+ "a dump truck. Its hide has toughened to a\n"
+ "rock-hard state. An ordinary sort of\n"
+ "attack won’t even leave a scratch.");
+
+const u8 gPorygon2PokedexText[] = _(
+ "It was created by humans using the power\n"
+ "of science. It has been given artificial\n"
+ "intelligence that enables it to learn new\n"
+ "gestures and emotions on its own.");
+
+const u8 gStantlerPokedexText[] = _(
+ "STANTLER’s magnificent antlers were\n"
+ "once traded at high prices as works of art.\n"
+ "As a result, this POKéMON was hunted\n"
+ "close to extinction.");
+
+const u8 gSmearglePokedexText[] = _(
+ "A SMEARGLE marks its territory using a\n"
+ "fluid that leaks out from the tip of its\n"
+ "tail. About 5,000 different marks left by\n"
+ "this POKéMON have been found.");
+
+const u8 gTyroguePokedexText[] = _(
+ "TYROGUE become stressed out if they do\n"
+ "not get to train every day. When raising\n"
+ "this POKéMON, the TRAINER must establish\n"
+ "a regular training schedule.");
+
+const u8 gHitmontopPokedexText[] = _(
+ "Its technique of kicking while spinning is\n"
+ "a remarkable mix of both offense and\n"
+ "defense. HITMONTOP travel faster\n"
+ "spinning than they do walking.");
+
+const u8 gSmoochumPokedexText[] = _(
+ "It actively runs about, but also falls\n"
+ "often. Whenever it falls, it will check its\n"
+ "reflection on a lake’s surface to make\n"
+ "sure its face hasn’t become dirty.");
+
+const u8 gElekidPokedexText[] = _(
+ "If it touches metal and discharges the\n"
+ "electricity it has stored in its body, an\n"
+ "ELEKID begins swinging its arms in circles\n"
+ "to recharge itself.");
+
+const u8 gMagbyPokedexText[] = _(
+ "If a MAGBY is spouting yellow flames from\n"
+ "its mouth, it is in good health. When it is\n"
+ "fatigued, black smoke will be mixed in with\n"
+ "the flames.");
+
+const u8 gMiltankPokedexText[] = _(
+ "It gives over five gallons of milk daily.\n"
+ "Its sweet milk is enjoyed by children and\n"
+ "grown-ups alike. People who can’t drink\n"
+ "milk turn it into yogurt and eat it instead.");
+
+const u8 gBlisseyPokedexText[] = _(
+ "If it senses sadness with its fluffy fur,\n"
+ "a BLISSEY will rush over to the sad person,\n"
+ "however far away, to share an egg of\n"
+ "happiness that brings a smile to any face.");
+
+const u8 gRaikouPokedexText[] = _(
+ "RAIKOU embodies the speed of lightning.\n"
+ "Its roars send shock waves shuddering\n"
+ "through the air and ground as if\n"
+ "lightning bolts were crashing down.");
+
+const u8 gEnteiPokedexText[] = _(
+ "ENTEI embodies the passion of magma.\n"
+ "It is thought to have been born in the\n"
+ "eruption of a volcano. It blasts fire that\n"
+ "consumes all that it touches.");
+
+const u8 gSuicunePokedexText[] = _(
+ "SUICUNE embodies the compassion of\n"
+ "a pure spring of water. It runs across\n"
+ "the land with gliding elegance. It has the\n"
+ "power to purify dirty water.");
+
+const u8 gLarvitarPokedexText[] = _(
+ "A LARVITAR is born deep under the ground.\n"
+ "It must eat its way through the soil above\n"
+ "and reach the surface for it to see its\n"
+ "parents’ faces.");
+
+const u8 gPupitarPokedexText[] = _(
+ "A PUPITAR creates a gas inside its body\n"
+ "that it ejects under compression to propel\n"
+ "itself like a jet. Its body can withstand\n"
+ "a collision with solid steel.");
+
+const u8 gTyranitarPokedexText[] = _(
+ "A TYRANITAR is so overwhelmingly powerful,\n"
+ "it can bring down a whole mountain to make\n"
+ "its nest. It roams in mountains seeking\n"
+ "new opponents to fight.");
+
+const u8 gLugiaPokedexText[] = _(
+ "LUGIA is so powerful even a light\n"
+ "fluttering of its wings can blow apart\n"
+ "houses. As a result, it chooses to live out\n"
+ "of sight deep under the sea.");
+
+const u8 gHoOhPokedexText[] = _(
+ "Its feathers--which glow in seven colors\n"
+ "depending on the angle at which they are\n"
+ "struck by light--are thought to bring joy.\n"
+ "It is said to live at the foot of a rainbow.");
+
+const u8 gCelebiPokedexText[] = _(
+ "This POKéMON came from the future by\n"
+ "crossing over time. It is thought that so\n"
+ "long as CELEBI appears, a bright and\n"
+ "shining future awaits us.");
+
+const u8 gTreeckoPokedexText[] = _(
+ "It makes its nest in a giant tree in the\n"
+ "forest. It ferociously guards against\n"
+ "anything nearing its territory. It is said\n"
+ "to be the protector of the forest’s trees.");
+
+const u8 gGrovylePokedexText[] = _(
+ "Leaves grow out of this POKéMON’s body.\n"
+ "They help obscure a GROVYLE from the eyes\n"
+ "of its enemies while it is in a thickly\n"
+ "overgrown forest.");
+
+const u8 gSceptilePokedexText[] = _(
+ "In the jungle, its power is without equal.\n"
+ "This POKéMON carefully grows trees and\n"
+ "plants. It regulates its body temperature\n"
+ "by basking in sunlight.");
+
+const u8 gTorchicPokedexText[] = _(
+ "If attacked, it strikes back by spitting\n"
+ "balls of fire it forms in its stomach.\n"
+ "A TORCHIC dislikes darkness because it\n"
+ "can’t see its surroundings.");
+
+const u8 gCombuskenPokedexText[] = _(
+ "It lashes out with 10 kicks per second.\n"
+ "Its strong fighting instinct compels it\n"
+ "to keep up its offensive until the\n"
+ "opponent gives up.");
+
+const u8 gBlazikenPokedexText[] = _(
+ "It learns martial arts that use punches\n"
+ "and kicks. Every several years, its old\n"
+ "feathers burn off, and new, supple\n"
+ "feathers grow back in their place.");
+
+const u8 gMudkipPokedexText[] = _(
+ "On land, it can powerfully lift large\n"
+ "boulders by planting its four feet and\n"
+ "heaving. It sleeps by burying itself in soil\n"
+ "at the water’s edge.");
+
+const u8 gMarshtompPokedexText[] = _(
+ "Its toughened hind legs enable it to stand\n"
+ "upright. Because it weakens if its skin\n"
+ "dries out, it replenishes fluids by playing\n"
+ "in mud.");
+
+const u8 gSwampertPokedexText[] = _(
+ "If it senses the approach of a storm and\n"
+ "a tidal wave, it protects its seaside nest\n"
+ "by piling up boulders. It swims as fast as\n"
+ "a jet ski.");
+
+const u8 gPoochyenaPokedexText[] = _(
+ "It savagely threatens foes with bared\n"
+ "fangs. It chases after fleeing targets\n"
+ "tenaciously. It turns tail and runs,\n"
+ "however, if the foe strikes back.");
+
+const u8 gMightyenaPokedexText[] = _(
+ "In the wild, MIGHTYENA live in a pack.\n"
+ "They never defy their leader’s orders.\n"
+ "They defeat foes with perfectly\n"
+ "coordinated teamwork.");
+
+const u8 gZigzagoonPokedexText[] = _(
+ "Rubbing its nose against the ground, it\n"
+ "always wanders about back and forth in\n"
+ "search of something. It is distinguished\n"
+ "by the zigzag footprints it leaves.");
+
+const u8 gLinoonePokedexText[] = _(
+ "It is exceedingly fast if it only has to run\n"
+ "in a straight line. When it spots pond-\n"
+ "dwelling prey underwater, it quickly leaps\n"
+ "in and catches it with its sharp claws.");
+
+const u8 gWurmplePokedexText[] = _(
+ "It sticks to tree branches and eats\n"
+ "leaves. The thread it spits from its mouth,\n"
+ "which becomes gooey when it touches\n"
+ "air, slows the movement of its foes.");
+
+const u8 gSilcoonPokedexText[] = _(
+ "It prepares for evolution using the\n"
+ "energy it stored while it was a WURMPLE.\n"
+ "It keeps watch over the surroundings with\n"
+ "its two eyes.");
+
+const u8 gBeautiflyPokedexText[] = _(
+ "Its colorfully patterned wings are its\n"
+ "most prominent feature. It flies through\n"
+ "flower-covered fields collecting pollen.\n"
+ "It attacks ferociously when angered.");
+
+const u8 gCascoonPokedexText[] = _(
+ "To avoid detection by its enemies, it hides\n"
+ "motionlessly beneath large leaves and in\n"
+ "the gaps of branches. It also attaches\n"
+ "dead leaves to its body for camouflage.");
+
+const u8 gDustoxPokedexText[] = _(
+ "It is a nocturnal POKéMON that flies from\n"
+ "fields and mountains to the attraction of\n"
+ "streetlights at night. It looses highly\n"
+ "toxic powder from its wings.");
+
+const u8 gLotadPokedexText[] = _(
+ "This POKéMON lives in ponds with clean\n"
+ "water. It is known to ferry small POKéMON\n"
+ "across ponds by carrying them on the\n"
+ "broad leaf on its head.");
+
+const u8 gLombrePokedexText[] = _(
+ "In the evening, it takes great delight in\n"
+ "popping out of rivers and startling people.\n"
+ "It feeds on aquatic moss that grows on\n"
+ "rocks in the riverbed.");
+
+const u8 gLudicoloPokedexText[] = _(
+ "When it hears festive music, all the cells\n"
+ "in its body become stimulated, and it\n"
+ "begins moving in rhythm. It does not\n"
+ "quail even when it faces a tough opponent.");
+
+const u8 gSeedotPokedexText[] = _(
+ "It hangs off branches and absorbs\n"
+ "nutrients. When it finishes eating, its\n"
+ "body becomes so heavy that it drops to\n"
+ "the ground with a thump.");
+
+const u8 gNuzleafPokedexText[] = _(
+ "A forest-dwelling POKéMON that is skilled\n"
+ "at climbing trees. Its long and pointed\n"
+ "nose is its weak point. It loses power if\n"
+ "the nose is gripped.");
+
+const u8 gShiftryPokedexText[] = _(
+ "It is said to arrive on chilly, wintry winds.\n"
+ "Feared from long ago as the guardian of\n"
+ "forests, this POKéMON lives in a deep\n"
+ "forest where people do not venture.");
+
+const u8 gTaillowPokedexText[] = _(
+ "Although it is small, it is very courageous.\n"
+ "It will take on a larger SKARMORY on an\n"
+ "equal footing. However, its will weakens if\n"
+ "it becomes hungry.");
+
+const u8 gSwellowPokedexText[] = _(
+ "A SWELLOW dives upon prey from far above.\n"
+ "It never misses its targets. It takes to\n"
+ "the skies in search of lands with a warm\n"
+ "climate.");
+
+const u8 gWingullPokedexText[] = _(
+ "It makes its nest on a sheer cliff at the\n"
+ "edge of the sea. It has trouble keeping\n"
+ "its wings flapping in flight. Instead, it\n"
+ "soars on updrafts.");
+
+const u8 gPelipperPokedexText[] = _(
+ "It skims the tops of waves as it flies.\n"
+ "When it spots prey, it uses its large beak\n"
+ "to scoop up the victim with water.\n"
+ "It protects its eggs in its beak.");
+
+const u8 gRaltsPokedexText[] = _(
+ "A RALTS has the power to sense the\n"
+ "emotions of people and POKéMON with the\n"
+ "horns on its head. It takes cover if it\n"
+ "senses any hostility.");
+
+const u8 gKirliaPokedexText[] = _(
+ "A KIRLIA has the psychic power to create \n"
+ "a rip in the dimensions and see into the\n"
+ "future. It is said to dance with pleasure\n"
+ "on sunny mornings.");
+
+const u8 gGardevoirPokedexText[] = _(
+ "It apparently does not feel the pull of\n"
+ "gravity because it supports itself with\n"
+ "psychic power. It will give its life to\n"
+ "protect its TRAINER.");
+
+const u8 gSurskitPokedexText[] = _(
+ "They gather on puddles after evening\n"
+ "downpours, gliding across the surface\n"
+ "of water as if sliding. It secretes honey\n"
+ "with a sweet aroma from its head.");
+
+const u8 gMasquerainPokedexText[] = _(
+ "It intimidates foes with the large eyelike\n"
+ "patterns on its antennae. Because it can’t\n"
+ "fly if its wings get wet, it shelters itself\n"
+ "from rain under large trees and eaves.");
+
+const u8 gShroomishPokedexText[] = _(
+ "It loves to eat damp, composted soil in\n"
+ "forests. If you enter a forest after a\n"
+ "long rain, you can see many SHROOMISH\n"
+ "feasting on composted soil.");
+
+const u8 gBreloomPokedexText[] = _(
+ "It scatters spores from holes in the cap\n"
+ "on its head. It loves warm and humid\n"
+ "climates. It feeds on trees and plants in\n"
+ "fields and forests.");
+
+const u8 gSlakothPokedexText[] = _(
+ "It sleeps virtually all day and night long.\n"
+ "It doesn’t change its nest its entire life,\n"
+ "but it sometimes travels great distances\n"
+ "by swimming in rivers.");
+
+const u8 gVigorothPokedexText[] = _(
+ "It can’t keep still because its blood boils\n"
+ "with energy. It runs through the fields\n"
+ "and mountains all day to calm itself. If it\n"
+ "doesn’t, it can’t sleep at night.");
+
+const u8 gSlakingPokedexText[] = _(
+ "Hordes of SLAKING gather around trees\n"
+ "when fruits come into season. They wait\n"
+ "around patiently for ripened fruits to fall\n"
+ "out of the trees.");
+
+const u8 gNincadaPokedexText[] = _(
+ "It makes its nest at the roots of a mighty\n"
+ "tree. Using its whiskerlike antennae, it\n"
+ "probes its surroundings in the\n"
+ "pitch-black darkness of soil.");
+
+const u8 gNinjaskPokedexText[] = _(
+ "Because it darts about vigorously at high\n"
+ "speed, it is very difficult to see. Hearing\n"
+ "its distinctive cries for too long induces\n"
+ "a headache.");
+
+const u8 gShedinjaPokedexText[] = _(
+ "A peculiar POKéMON that floats in air even\n"
+ "though its wings remain completely still.\n"
+ "The inside of its body is hollow and\n"
+ "utterly dark.");
+
+const u8 gWhismurPokedexText[] = _(
+ "Its cries equal a jet plane in volume.\n"
+ "It inhales through its ear canals. Because\n"
+ "of this system, it can cry continually\n"
+ "without having to catch its breath.");
+
+const u8 gLoudredPokedexText[] = _(
+ "It positions the round speakers on its\n"
+ "head to assail foes with ultrasonic waves\n"
+ "at massive volume. It builds power by\n"
+ "stomping the ground.");
+
+const u8 gExploudPokedexText[] = _(
+ "It has sound-generating organs all over\n"
+ "its body. It communicates with others by\n"
+ "adjusting the tone and volume of the cries\n"
+ "it emits.");
+
+const u8 gMakuhitaPokedexText[] = _(
+ "It loves to toughen up its body above all\n"
+ "else. If you hear quaking rumbles in a cave,\n"
+ "it is the sound of MAKUHITA undertaking\n"
+ "strenuous training.");
+
+const u8 gHariyamaPokedexText[] = _(
+ "It has the habit of challenging others\n"
+ "without hesitation to tests of strength.\n"
+ "It’s been known to stand on train tracks\n"
+ "and stop trains using forearm thrusts.");
+
+const u8 gAzurillPokedexText[] = _(
+ "Its tail, which is packed with nutrition,\n"
+ "is very bouncy like a rubber ball. On sunny\n"
+ "days they gather at the edge of water and\n"
+ "splash about for fun.");
+
+const u8 gNosepassPokedexText[] = _(
+ "Its body emits a powerful magnetism.\n"
+ "It feeds on prey that is pulled in by the\n"
+ "force. Its magnetism is stronger in cold\n"
+ "seasons.");
+
+const u8 gSkittyPokedexText[] = _(
+ "A SKITTY’s adorably cute behavior makes it\n"
+ "highly popular. In battle, it makes its tail\n"
+ "puff out. It threatens foes with a sharp\n"
+ "growl.");
+
+const u8 gDelcattyPokedexText[] = _(
+ "Rather than keeping a permanent lair,\n"
+ "it habitually seeks comfortable spots and\n"
+ "sleeps there. It is nocturnal and becomes\n"
+ "active at dusk.");
+
+const u8 gSableyePokedexText[] = _(
+ "It digs branching holes in caves using its\n"
+ "sharp claws in search of food--raw gems.\n"
+ "A SABLEYE lurks in darkness and is seen\n"
+ "only rarely.");
+
+const u8 gMawilePokedexText[] = _(
+ "Its giant jaws are actually steel horns\n"
+ "that transformed. It fools foes into\n"
+ "complacency with its adorable gestures,\n"
+ "then chomps them with its huge jaws.");
+
+const u8 gAronPokedexText[] = _(
+ "A POKéMON that is clad in steel armor.\n"
+ "A new suit of armor is made when it evolves.\n"
+ "The old, discarded armor is salvaged as\n"
+ "metal for making iron products.");
+
+const u8 gLaironPokedexText[] = _(
+ "When two LAIRON meet in the wild, they\n"
+ "fight for territory by bashing into each\n"
+ "other with their steel bodies. The sound\n"
+ "of their collision carries for miles.");
+
+const u8 gAggronPokedexText[] = _(
+ "Its iron horns grow longer a little at\n"
+ "a time. They are used to determine the\n"
+ "AGGRON’s age. The gouges in its armor are\n"
+ "worn with pride as mementos from battles.");
+
+const u8 gMedititePokedexText[] = _(
+ "It continually meditates for hours every\n"
+ "day. As a result of rigorous and dedicated\n"
+ "yoga training, it has tempered its\n"
+ "spiritual power so much it can fly.");
+
+const u8 gMedichamPokedexText[] = _(
+ "Through crushingly harsh yoga training, it\n"
+ "gained the power to foretell its foe’s\n"
+ "actions. It battles with elegant, dance-\n"
+ "like movement.");
+
+const u8 gElectrikePokedexText[] = _(
+ "It generates electricity using friction\n"
+ "from the atmosphere. In seasons with\n"
+ "especially arid air, its entire body blazes\n"
+ "with violent showers of sparks.");
+
+const u8 gManectricPokedexText[] = _(
+ "Because lightning falls in their vicinities,\n"
+ "MANECTRIC were thought to have been born\n"
+ "from lightning. In battle, they create\n"
+ "thunderclouds.");
+
+const u8 gPluslePokedexText[] = _(
+ "It has the trait of cheering on its fellow\n"
+ "POKéMON. By shorting out the electricity\n"
+ "it releases from its paws, it creates\n"
+ "pom-poms for cheering.");
+
+const u8 gMinunPokedexText[] = _(
+ "At a meeting of POKéMON academics, it was\n"
+ "announced that simultaneous exposure to\n"
+ "electricity from a PLUSLE and MINUN will\n"
+ "promote circulation and boost vitality.");
+
+const u8 gVolbeatPokedexText[] = _(
+ "With their taillights lit, VOLBEAT fly in\n"
+ "a swarm, drawing geometric designs in the\n"
+ "night sky. They move their nests if their\n"
+ "pond water becomes dirty.");
+
+const u8 gIllumisePokedexText[] = _(
+ "A nocturnal POKéMON that becomes active\n"
+ "upon nightfall. It leads a VOLBEAT swarm\n"
+ "to draw patterns in the night sky. Over 200\n"
+ "different patterns have been confirmed.");
+
+const u8 gRoseliaPokedexText[] = _(
+ "A ROSELIA that drinks nutritionally rich\n"
+ "springwater blooms with lovely flowers.\n"
+ "The fragrance of its flowers has the\n"
+ "effect of making its foes careless.");
+
+const u8 gGulpinPokedexText[] = _(
+ "This POKéMON’s stomach fluid can even\n"
+ "digest scrap iron. In one gulp, it can\n"
+ "swallow something that is as large as\n"
+ "itself.");
+
+const u8 gSwalotPokedexText[] = _(
+ "Its powerful stomach acid is capable of\n"
+ "digesting almost anything. The one thing\n"
+ "in the whole world a SWALOT can’t digest is\n"
+ "its own stomach.");
+
+const u8 gCarvanhaPokedexText[] = _(
+ "CARVANHA attack ships in swarms, making\n"
+ "them sink. Although it is said to be a very\n"
+ "vicious POKéMON, it timidly flees as soon\n"
+ "as it finds itself alone.");
+
+const u8 gSharpedoPokedexText[] = _(
+ "The vicious and sly gangster of the sea.\n"
+ "Its skin is specially textured to minimize\n"
+ "drag in water. Its speed tops out at over\n"
+ "75 miles per hour.");
+
+const u8 gWailmerPokedexText[] = _(
+ "While this POKéMON usually lives in the sea,\n"
+ "it can survive on land, although not too\n"
+ "long. It loses vitality if its body becomes\n"
+ "dried out.");
+
+const u8 gWailordPokedexText[] = _(
+ "It breathes through nostrils that it\n"
+ "raises above the sea. By inhaling to its\n"
+ "maximum capacity, a WAILORD can dive close\n"
+ "to 10,000 feet beneath the waves.");
+
+const u8 gNumelPokedexText[] = _(
+ "A NUMEL stores boiling magma in the hump\n"
+ "on its back. It is a hardy POKéMON that can\n"
+ "transport a 220-pound load. It has served\n"
+ "humans at work since long ago.");
+
+const u8 gCameruptPokedexText[] = _(
+ "A POKéMON that lives in the crater of\n"
+ "a volcano. Every 10 years, the volcanoes\n"
+ "on its back erupt violently. Research is\n"
+ "under way on the cause of eruption.");
+
+const u8 gTorkoalPokedexText[] = _(
+ "It battles using energy it gets from\n"
+ "burning coal. When loosing smoke from its\n"
+ "nostrils, it lets off a sound that is\n"
+ "similar to a locomotive’s horn.");
+
+const u8 gSpoinkPokedexText[] = _(
+ "A POKéMON that manipulates psychic power\n"
+ "at will. It doesn’t stop bouncing even when\n"
+ "it is asleep. It loves eating mushrooms\n"
+ "that grow underground.");
+
+const u8 gGrumpigPokedexText[] = _(
+ "It stores power in the black pearls on its\n"
+ "forehead. When it uses psychic power, it\n"
+ "performs an odd dance step. Its style of\n"
+ "dancing became hugely popular overseas.");
+
+const u8 gSpindaPokedexText[] = _(
+ "It is distinguished by a pattern of\n"
+ "spots that is always different. Its\n"
+ "unsteady, tottering walk has the\n"
+ "effect of fouling its foe’s aim.");
+
+const u8 gTrapinchPokedexText[] = _(
+ "Its big jaws crunch through boulders.\n"
+ "Because its head is so big, it has a hard\n"
+ "time getting back upright if it tips over\n"
+ "onto its back.");
+
+const u8 gVibravaPokedexText[] = _(
+ "It looses ultrasonic waves by rubbing its\n"
+ "wings together. Since a VIBRAVA’s wings\n"
+ "are still in the process of growing, it can\n"
+ "only fly short distances.");
+
+const u8 gFlygonPokedexText[] = _(
+ "The flapping of its wings sounds like\n"
+ "singing. To prevent detection by enemies,\n"
+ "it hides itself by flapping up a cloud of\n"
+ "desert sand.");
+
+const u8 gCacneaPokedexText[] = _(
+ "CACNEA live in deserts with virtually no\n"
+ "rainfall. It battles by swinging its thick,\n"
+ "spiked arms. Once a year, a yellow flower\n"
+ "blooms.");
+
+const u8 gCacturnePokedexText[] = _(
+ "After spending thousands of years in\n"
+ "harsh deserts, its blood transformed into\n"
+ "the same substances as sand. It is\n"
+ "nocturnal, so it hunts at night.");
+
+const u8 gSwabluPokedexText[] = _(
+ "A POKéMON that has wings like cottony\n"
+ "clouds. After enduring winter, in which\n"
+ "little food is available, SWABLU flocks\n"
+ "move closer to towns in the spring.");
+
+const u8 gAltariaPokedexText[] = _(
+ "It hums in a beautiful soprano voice.\n"
+ "It flies among white clouds in the blue\n"
+ "sky. It launches intensely hot fireballs\n"
+ "from its mouth.");
+
+const u8 gZangoosePokedexText[] = _(
+ "When it battles, it stands on its hind legs\n"
+ "and attacks with its sharply clawed\n"
+ "forelegs. Its fur bristles if it encounters\n"
+ "any SEVIPER.");
+
+const u8 gSeviperPokedexText[] = _(
+ "SEVIPER and ZANGOOSE are eternal rivals.\n"
+ "It counters a ZANGOOSE’s dazzling agility\n"
+ "with its swordlike tail, which also oozes\n"
+ "a horrible poison.");
+
+const u8 gLunatonePokedexText[] = _(
+ "It becomes very active on the night of\n"
+ "a full moon. This POKéMON was first\n"
+ "discovered 40 years ago at the site of\n"
+ "a meteor strike.");
+
+const u8 gSolrockPokedexText[] = _(
+ "Solar energy is the source of this \n"
+ "POKéMON’s power. On sunny days, groups of\n"
+ "SOLROCK line up facing the sun and absorb\n"
+ "its light.");
+
+const u8 gBarboachPokedexText[] = _(
+ "Its body is covered with a slimy film.\n"
+ "The film acts as a barrier to prevent germs\n"
+ "in muddy water from entering the\n"
+ "BARBOACH’s body.");
+
+const u8 gWhiscashPokedexText[] = _(
+ "Mysteriously, it can foretell earthquakes.\n"
+ "In the daytime, it sleeps in mud at the\n"
+ "bottom of a pond. When it awakens, it\n"
+ "continually feeds throughout the night.");
+
+const u8 gCorphishPokedexText[] = _(
+ "Once it grips prey with its large pincers,\n"
+ "it will never let go, no matter what.\n"
+ "It is a hardy POKéMON that can thrive\n"
+ "in any environment.");
+
+const u8 gCrawdauntPokedexText[] = _(
+ "A brutish POKéMON that loves to battle.\n"
+ "A veteran CRAWDAUNT that has prevailed in\n"
+ "hundreds of battles has giant pincers\n"
+ "marked with countless scars.");
+
+const u8 gBaltoyPokedexText[] = _(
+ "A BALTOY moves by spinning on its single\n"
+ "foot. It has been depicted in murals \n"
+ "adorning the walls of a once-bustling city\n"
+ "in an ancient age.");
+
+const u8 gClaydolPokedexText[] = _(
+ "A CLAYDOL sleeps while hovering in midair.\n"
+ "Its arms are separate from its body.\n"
+ "They are kept floating by the POKéMON’s\n"
+ "manipulation of psychic power.");
+
+const u8 gLileepPokedexText[] = _(
+ "It disguises itself as seaweed by making\n"
+ "its tentacles sway. Unsuspecting prey\n"
+ "that come too close are swallowed whole.\n"
+ "It became extinct 100 million years ago.");
+
+const u8 gCradilyPokedexText[] = _(
+ "It drags its heavy body along the\n"
+ "seafloor. It makes its nest in the shallows\n"
+ "of warm seas. CRADILY can be seen on\n"
+ "beaches when the tide goes out.");
+
+const u8 gAnorithPokedexText[] = _(
+ "It was resurrected from a fossil using the\n"
+ "power of science. It swims by undulating\n"
+ "the eight wings at its sides. They were\n"
+ "feet that adapted to life in the sea.");
+
+const u8 gArmaldoPokedexText[] = _(
+ "ARMALDO usually lives on land. However,\n"
+ "when it hunts for prey, it dives beneath\n"
+ "the ocean. It swims around using its two\n"
+ "large wings.");
+
+const u8 gFeebasPokedexText[] = _(
+ "FEEBAS live in ponds that are heavily\n"
+ "infested with weeds. Because of its\n"
+ "hopelessly shabby appearance, it\n"
+ "seems as if few TRAINERS raise it.");
+
+const u8 gMiloticPokedexText[] = _(
+ "It is said to live at the bottom of\n"
+ "large lakes. Considered to be the most\n"
+ "beautiful of all POKéMON, it has been\n"
+ "depicted in paintings and statues.");
+
+const u8 gCastformPokedexText[] = _(
+ "It alters its form depending on the\n"
+ "weather. Changes in the climate such as\n"
+ "the temperature and humidity appear to\n"
+ "affect its cellular structure.");
+
+const u8 gKecleonPokedexText[] = _(
+ "A POKéMON that has the ability to alter its\n"
+ "body colors to match its surroundings.\n"
+ "A KECLEON reverts to its original colors if\n"
+ "it is startled.");
+
+const u8 gShuppetPokedexText[] = _(
+ "This POKéMON roams about deep in the\n"
+ "night seeking such negative emotions as\n"
+ "grudges and envy. It retreats to its nest\n"
+ "when the sun begins to rise.");
+
+const u8 gBanettePokedexText[] = _(
+ "An abandoned plush doll became this\n"
+ "POKéMON. They are said to live in garbage\n"
+ "dumps and wander about in search of the\n"
+ "children that threw them away.");
+
+const u8 gDuskullPokedexText[] = _(
+ "A glare from its single scarlet eye makes\n"
+ "even burly grown-ups freeze in utter fear.\n"
+ "It is a nocturnal POKéMON that roams\n"
+ "about under the cloak of darkness.");
+
+const u8 gDusclopsPokedexText[] = _(
+ "It is thought that its body is hollow with\n"
+ "only a spectral ball of fire burning inside.\n"
+ "However, no one has been able to\n"
+ "confirm this theory as fact.");
+
+const u8 gTropiusPokedexText[] = _(
+ "It flies by flapping its broad leaves.\n"
+ "The bunch of fruit that grows around its\n"
+ "neck is deliciously sweet. In the spring,\n"
+ "it scatters pollen from its neck.");
+
+const u8 gChimechoPokedexText[] = _(
+ "They fly about very actively when the hot\n"
+ "season arrives. They communicate among\n"
+ "themselves using seven different and\n"
+ "distinguishing cries.");
+
+const u8 gAbsolPokedexText[] = _(
+ "It sharply senses even subtle changes in\n"
+ "the sky and the land to predict natural\n"
+ "disasters. It is a long-lived POKéMON that\n"
+ "has a life-span of 100 years.");
+
+const u8 gWynautPokedexText[] = _(
+ "A WYNAUT loves to eat sweet fruits.\n"
+ "It cleverly picks fruits using its earlike\n"
+ "arms. They gather in fruit gardens, drawn\n"
+ "by the fragrance.");
+
+const u8 gSnoruntPokedexText[] = _(
+ "They tend to move about in groups of\n"
+ "around five SNORUNT. In snowy regions,\n"
+ "it is said that when they are seen late at\n"
+ "night, snowfall will arrive by morning.");
+
+const u8 gGlaliePokedexText[] = _(
+ "A GLALIE has the power to instantaneously\n"
+ "freeze moisture in the atmosphere.\n"
+ "A dazzling cloud of diamondlike ice\n"
+ "crystals forms around its body.");
+
+const u8 gSphealPokedexText[] = _(
+ "It is completely covered with plushy fur.\n"
+ "As a result, it never feels the cold even\n"
+ "when it is rolling about on ice floes or\n"
+ "diving in the sea.");
+
+const u8 gSealeoPokedexText[] = _(
+ "SEALEO live in herds on ice floes. Using its\n"
+ "powerful flippers, it shatters ice.\n"
+ "It dives into the sea to hunt prey five\n"
+ "times a day.");
+
+const u8 gWalreinPokedexText[] = _(
+ "To protect its herd, the leader battles\n"
+ "anything that invades its territory, even\n"
+ "at the cost of its life. Its tusks may snap\n"
+ "off in battle.");
+
+const u8 gClamperlPokedexText[] = _(
+ "A CLAMPERL slams its shell closed on prey\n"
+ "to prevent escape. The pearl it creates\n"
+ "upon evolution is said to be infused with\n"
+ "a mysterious energy.");
+
+const u8 gHuntailPokedexText[] = _(
+ "To withstand the crushing pressure of\n"
+ "water deep under the sea, its spine is very\n"
+ "thick and sturdy. Its tail, which is shaped\n"
+ "like a small fish, has eyes that light up.");
+
+const u8 gGorebyssPokedexText[] = _(
+ "A GOREBYSS siphons the body fluids of prey\n"
+ "through its thin, tubular mouth. Its light\n"
+ "pink body color turns vivid when it\n"
+ "finishes feeding.");
+
+const u8 gRelicanthPokedexText[] = _(
+ "A POKéMON that was once believed to have\n"
+ "been extinct. The species has not changed\n"
+ "its form for 100 million years. It walks on\n"
+ "the seafloor using its pectoral fins.");
+
+const u8 gLuvdiscPokedexText[] = _(
+ "LUVDISC make the branches of CORSOLA\n"
+ "their nests. There is a custom from long\n"
+ "ago of giving a LUVDISC as a gift to\n"
+ "express one’s feelings of love.");
+
+const u8 gBagonPokedexText[] = _(
+ "Although it is small, this POKéMON is very\n"
+ "powerful because its body is a bundle of\n"
+ "muscles. It launches head-butts with its\n"
+ "ironlike skull.");
+
+const u8 gShelgonPokedexText[] = _(
+ "It hardly eats while it awaits evolution.\n"
+ "It becomes hardier by enduring hunger.\n"
+ "Its shell peels off the instant it begins\n"
+ "to evolve.");
+
+const u8 gSalamencePokedexText[] = _(
+ "After many long years, its cellular\n"
+ "structure underwent a sudden mutation to\n"
+ "grow wings. When angered, it loses all\n"
+ "thought and rampages out of control.");
+
+const u8 gBeldumPokedexText[] = _(
+ "When BELDUM gather in a swarm, they move\n"
+ "in perfect unison as if they were but one\n"
+ "POKéMON. They communicate with each other\n"
+ "using brain waves.");
+
+const u8 gMetangPokedexText[] = _(
+ "The claws tipping its arms pack the\n"
+ "destructive power to tear through thick\n"
+ "iron sheets as if they were silk. It flies\n"
+ "at over 60 miles per hour.");
+
+const u8 gMetagrossPokedexText[] = _(
+ "METAGROSS has four brains that are joined\n"
+ "by a complex neural network. As a result of\n"
+ "integration, this POKéMON is smarter than\n"
+ "a supercomputer.");
+
+const u8 gRegirockPokedexText[] = _(
+ "A POKéMON that is made entirely of rocks\n"
+ "and boulders. If parts of its body chip off\n"
+ "in battle, REGIROCK repairs itself by\n"
+ "adding new rocks.");
+
+const u8 gRegicePokedexText[] = _(
+ "Its entire body is made of Antarctic ice.\n"
+ "After extensive studies, researchers\n"
+ "believe the ice was formed during an\n"
+ "ice age.");
+
+const u8 gRegisteelPokedexText[] = _(
+ "Its body is harder than any other kind of\n"
+ "metal. The body metal is composed of a\n"
+ "mysterious substance. Not only is it hard,\n"
+ "it shrinks and stretches flexibly.");
+
+const u8 gLatiasPokedexText[] = _(
+ "They make a small herd of only several\n"
+ "members. They rarely make contact with\n"
+ "people or other POKéMON. They disappear\n"
+ "if they sense enemies.");
+
+const u8 gLatiosPokedexText[] = _(
+ "Even in hiding, it can detect the locations\n"
+ "of others and sense their emotions since\n"
+ "it has telepathy. Its intelligence allows\n"
+ "it to understand human languages.");
+
+const u8 gKyogrePokedexText[] = _(
+ "KYOGRE has appeared in mythology as the\n"
+ "creator of the sea. After long years of\n"
+ "feuding with GROUDON, it took to sleep at\n"
+ "the bottom of the sea.");
+
+const u8 gGroudonPokedexText[] = _(
+ "GROUDON has appeared in mythology as the\n"
+ "creator of the land. It sleeps in magma\n"
+ "underground and is said to make volcanoes\n"
+ "erupt on awakening.");
+
+const u8 gRayquazaPokedexText[] = _(
+ "A POKéMON that flies endlessly in the\n"
+ "ozone layer. It is said it would descend\n"
+ "to the ground if KYOGRE and GROUDON\n"
+ "were to fight.");
+
+const u8 gJirachiPokedexText[] = _(
+ "JIRACHI is said to make wishes come true.\n"
+ "While it sleeps, a tough crystalline shell\n"
+ "envelops the body to protect it from\n"
+ "enemies.");
+
+const u8 gDeoxysPokedexText[] = _(
+ "A POKéMON that mutated from an\n"
+ "extraterrestrial virus exposed to a laser\n"
+ "beam. Its body is configured for superior\n"
+ "agility and speed.");
diff --git a/src/data/pokemon_graphics/back_pic_coordinates.h b/src/data/pokemon_graphics/back_pic_coordinates.h
index 877bf3475..29d0ff32e 100644
--- a/src/data/pokemon_graphics/back_pic_coordinates.h
+++ b/src/data/pokemon_graphics/back_pic_coordinates.h
@@ -47,211 +47,212 @@ const struct MonCoords gMonBackPicCoords[] =
{0x66, 0x0a}, // SPECIES_GLOOM
{0x87, 0x07}, // SPECIES_VILEPLUME
{0x63, 0x14}, // SPECIES_PARAS
- {0x87, 0x07}, // SPECIES_VENONAT
- {0x77, 0x06}, // SPECIES_VENOMOTH
- {0x77, 0x04}, // SPECIES_DIGLETT
- {0x54, 0x10}, // SPECIES_DUGTRIO
- {0x66, 0x0b}, // SPECIES_MEOWTH
- {0x65, 0x0c}, // SPECIES_PERSIAN
- {0x87, 0x07}, // SPECIES_PSYDUCK
- {0x67, 0x07}, // SPECIES_GOLDUCK
- {0x77, 0x05}, // SPECIES_MANKEY
- {0x76, 0x0b}, // SPECIES_PRIMEAPE
- {0x77, 0x07}, // SPECIES_GROWLITHE
- {0x66, 0x08}, // SPECIES_ARCANINE
- {0x87, 0x06}, // SPECIES_POLIWAG
- {0x74, 0x10}, // SPECIES_POLIWHIRL
- {0x65, 0x0c}, // SPECIES_POLIWRATH
- {0x86, 0x0b}, // SPECIES_ABRA
- {0x66, 0x0b}, // SPECIES_KADABRA
- {0x76, 0x08}, // SPECIES_ALAKAZAM
- {0x67, 0x05}, // SPECIES_MACHOP
- {0x65, 0x0c}, // SPECIES_MACHOKE
- {0x76, 0x09}, // SPECIES_MACHAMP
- {0x67, 0x04}, // SPECIES_BELLSPROUT
- {0x66, 0x0a}, // SPECIES_WEEPINBELL
- {0x66, 0x09}, // SPECIES_VICTREEBEL
- {0x87, 0x06}, // SPECIES_TENTACOOL
- {0x56, 0x0a}, // SPECIES_TENTACRUEL
- {0x86, 0x0b}, // SPECIES_GEODUDE
- {0x66, 0x0b}, // SPECIES_GRAVELER
- {0x75, 0x0c}, // SPECIES_GOLEM
- {0x84, 0x10}, // SPECIES_PONYTA
- {0x66, 0x09}, // SPECIES_RAPIDASH
- {0x87, 0x05}, // SPECIES_SLOWPOKE
- {0x85, 0x0e}, // SPECIES_SLOWBRO
- {0x86, 0x0a}, // SPECIES_MAGNEMITE
- {0x43, 0x14}, // SPECIES_MAGNETON
+ {0x87, 0x07}, // SPECIES_PARASECT
+ {0x77, 0x06}, // SPECIES_VENONAT
+ {0x77, 0x04}, // SPECIES_VENOMOTH
+ {0x54, 0x10}, // SPECIES_DIGLETT
+ {0x66, 0x0b}, // SPECIES_DUGTRIO
+ {0x65, 0x0c}, // SPECIES_MEOWTH
+ {0x87, 0x07}, // SPECIES_PERSIAN
+ {0x67, 0x07}, // SPECIES_PSYDUCK
+ {0x77, 0x05}, // SPECIES_GOLDUCK
+ {0x76, 0x0b}, // SPECIES_MANKEY
+ {0x77, 0x07}, // SPECIES_PRIMEAPE
+ {0x66, 0x08}, // SPECIES_GROWLITHE
+ {0x87, 0x06}, // SPECIES_ARCANINE
+ {0x74, 0x10}, // SPECIES_POLIWAG
+ {0x65, 0x0c}, // SPECIES_POLIWHIRL
+ {0x86, 0x0b}, // SPECIES_POLIWRATH
+ {0x66, 0x0b}, // SPECIES_ABRA
+ {0x76, 0x08}, // SPECIES_KADABRA
+ {0x67, 0x05}, // SPECIES_ALAKAZAM
+ {0x65, 0x0c}, // SPECIES_MACHOP
+ {0x76, 0x09}, // SPECIES_MACHOKE
+ {0x67, 0x04}, // SPECIES_MACHAMP
+ {0x66, 0x0a}, // SPECIES_BELLSPROUT
+ {0x66, 0x09}, // SPECIES_WEEPINBELL
+ {0x87, 0x06}, // SPECIES_VICTREEBEL
+ {0x56, 0x0a}, // SPECIES_TENTACOOL
+ {0x86, 0x0b}, // SPECIES_TENTACRUEL
+ {0x66, 0x0b}, // SPECIES_GEODUDE
+ {0x75, 0x0c}, // SPECIES_GRAVELER
+ {0x84, 0x10}, // SPECIES_GOLEM
+ {0x66, 0x09}, // SPECIES_PONYTA
+ {0x87, 0x05}, // SPECIES_RAPIDASH
+ {0x85, 0x0e}, // SPECIES_SLOWPOKE
+ {0x86, 0x0a}, // SPECIES_SLOWBRO
+ {0x43, 0x14}, // SPECIES_MAGNEMITE
+ {0x66, 0x0a}, // SPECIES_MAGNETON
{0x66, 0x0a}, // SPECIES_FARFETCHD
- {0x66, 0x0a}, // SPECIES_DODUO
- {0x66, 0x08}, // SPECIES_DODRIO
- {0x88, 0x01}, // SPECIES_SEEL
- {0x66, 0x0a}, // SPECIES_DEWGONG
- {0x77, 0x05}, // SPECIES_GRIMER
- {0x75, 0x0c}, // SPECIES_MUK
- {0x87, 0x05}, // SPECIES_SHELLDER
- {0x76, 0x0b}, // SPECIES_CLOYSTER
- {0x87, 0x06}, // SPECIES_GASTLY
- {0x85, 0x0e}, // SPECIES_HAUNTER
- {0x76, 0x08}, // SPECIES_GENGAR
- {0x76, 0x09}, // SPECIES_ONIX
- {0x78, 0x00}, // SPECIES_DROWZEE
- {0x65, 0x0d}, // SPECIES_HYPNO
- {0x66, 0x09}, // SPECIES_KRABBY
- {0x66, 0x0a}, // SPECIES_KINGLER
- {0x77, 0x04}, // SPECIES_VOLTORB
- {0x55, 0x0e}, // SPECIES_ELECTRODE
+ {0x66, 0x08}, // SPECIES_DODUO
+ {0x88, 0x01}, // SPECIES_DODRIO
+ {0x66, 0x0a}, // SPECIES_SEEL
+ {0x77, 0x05}, // SPECIES_DEWGONG
+ {0x75, 0x0c}, // SPECIES_GRIMER
+ {0x87, 0x05}, // SPECIES_MUK
+ {0x76, 0x0b}, // SPECIES_SHELLDER
+ {0x87, 0x06}, // SPECIES_CLOYSTER
+ {0x85, 0x0e}, // SPECIES_GASTLY
+ {0x76, 0x08}, // SPECIES_HAUNTER
+ {0x76, 0x09}, // SPECIES_GENGAR
+ {0x78, 0x00}, // SPECIES_ONIX
+ {0x65, 0x0d}, // SPECIES_DROWZEE
+ {0x66, 0x09}, // SPECIES_HYPNO
+ {0x66, 0x0a}, // SPECIES_KRABBY
+ {0x77, 0x04}, // SPECIES_KINGLER
+ {0x55, 0x0e}, // SPECIES_VOLTORB
+ {0x65, 0x0d}, // SPECIES_ELECTRODE
{0x65, 0x0d}, // SPECIES_EXEGGCUTE
- {0x65, 0x0d}, // SPECIES_EXEGGUTOR
- {0x87, 0x04}, // SPECIES_CUBONE
- {0x66, 0x0a}, // SPECIES_MAROWAK
- {0x66, 0x08}, // SPECIES_HITMONLEE
+ {0x87, 0x04}, // SPECIES_EXEGGUTOR
+ {0x66, 0x0a}, // SPECIES_CUBONE
+ {0x66, 0x08}, // SPECIES_MAROWAK
+ {0x65, 0x0c}, // SPECIES_HITMONLEE
{0x65, 0x0c}, // SPECIES_HITMONCHAN
- {0x65, 0x0c}, // SPECIES_LICKITUNG
- {0x65, 0x0e}, // SPECIES_KOFFING
- {0x66, 0x09}, // SPECIES_WEEZING
- {0x77, 0x06}, // SPECIES_RHYHORN
- {0x85, 0x0c}, // SPECIES_RHYDON
- {0x88, 0x03}, // SPECIES_CHANSEY
- {0x86, 0x0b}, // SPECIES_TANGELA
- {0x85, 0x0e}, // SPECIES_KANGASKHAN
- {0x77, 0x05}, // SPECIES_HORSEA
- {0x66, 0x09}, // SPECIES_SEADRA
+ {0x65, 0x0e}, // SPECIES_LICKITUNG
+ {0x66, 0x09}, // SPECIES_KOFFING
+ {0x77, 0x06}, // SPECIES_WEEZING
+ {0x85, 0x0c}, // SPECIES_RHYHORN
+ {0x88, 0x03}, // SPECIES_RHYDON
+ {0x86, 0x0b}, // SPECIES_CHANSEY
+ {0x85, 0x0e}, // SPECIES_TANGELA
+ {0x77, 0x05}, // SPECIES_KANGASKHAN
+ {0x66, 0x09}, // SPECIES_HORSEA
+ {0x66, 0x08}, // SPECIES_SEADRA
{0x66, 0x08}, // SPECIES_GOLDEEN
- {0x66, 0x08}, // SPECIES_SEAKING
- {0x76, 0x0b}, // SPECIES_STARYU
- {0x65, 0x0d}, // SPECIES_STARMIE
- {0x85, 0x0e}, // SPECIES_MR_MIME
- {0x85, 0x0d}, // SPECIES_SCYTHER
- {0x77, 0x07}, // SPECIES_JYNX
- {0x86, 0x0a}, // SPECIES_ELECTABUZZ
+ {0x76, 0x0b}, // SPECIES_SEAKING
+ {0x65, 0x0d}, // SPECIES_STARYU
+ {0x85, 0x0e}, // SPECIES_STARMIE
+ {0x85, 0x0d}, // SPECIES_MR_MIME
+ {0x77, 0x07}, // SPECIES_SCYTHER
+ {0x86, 0x0a}, // SPECIES_JYNX
+ {0x66, 0x08}, // SPECIES_ELECTABUZZ
{0x66, 0x08}, // SPECIES_MAGMAR
- {0x66, 0x08}, // SPECIES_PINSIR
- {0x66, 0x09}, // SPECIES_TAUROS
- {0x85, 0x0d}, // SPECIES_MAGIKARP
- {0x76, 0x09}, // SPECIES_GYARADOS
- {0x78, 0x00}, // SPECIES_LAPRAS
- {0x77, 0x04}, // SPECIES_DITTO
- {0x54, 0x11}, // SPECIES_EEVEE
+ {0x66, 0x09}, // SPECIES_PINSIR
+ {0x85, 0x0d}, // SPECIES_TAUROS
+ {0x76, 0x09}, // SPECIES_MAGIKARP
+ {0x78, 0x00}, // SPECIES_GYARADOS
+ {0x77, 0x04}, // SPECIES_LAPRAS
+ {0x54, 0x11}, // SPECIES_DITTO
+ {0x66, 0x0a}, // SPECIES_EEVEE
{0x66, 0x0a}, // SPECIES_VAPOREON
- {0x66, 0x0a}, // SPECIES_JOLTEON
- {0x87, 0x06}, // SPECIES_FLAREON
- {0x67, 0x05}, // SPECIES_PORYGON
- {0x65, 0x0d}, // SPECIES_OMANYTE
- {0x66, 0x0a}, // SPECIES_OMASTAR
- {0x66, 0x08}, // SPECIES_KABUTO
- {0x65, 0x0d}, // SPECIES_KABUTOPS
- {0x77, 0x05}, // SPECIES_AERODACTYL
- {0x86, 0x08}, // SPECIES_SNORLAX
- {0x86, 0x0b}, // SPECIES_ARTICUNO
- {0x65, 0x0c}, // SPECIES_ZAPDOS
- {0x76, 0x0b}, // SPECIES_MOLTRES
- {0x87, 0x04}, // SPECIES_DRATINI
- {0x66, 0x09}, // SPECIES_DRAGONAIR
- {0x78, 0x00}, // SPECIES_DRAGONITE
- {0x87, 0x06}, // SPECIES_MEWTWO
- {0x78, 0x01}, // SPECIES_MEW
- {0x66, 0x08}, // SPECIES_CHIKORITA
- {0x56, 0x0a}, // SPECIES_BAYLEEF
- {0x66, 0x08}, // SPECIES_MEGANIUM
- {0x78, 0x00}, // SPECIES_CYNDAQUIL
- {0x76, 0x09}, // SPECIES_QUILAVA
+ {0x87, 0x06}, // SPECIES_JOLTEON
+ {0x67, 0x05}, // SPECIES_FLAREON
+ {0x65, 0x0d}, // SPECIES_PORYGON
+ {0x66, 0x0a}, // SPECIES_OMANYTE
+ {0x66, 0x08}, // SPECIES_OMASTAR
+ {0x65, 0x0d}, // SPECIES_KABUTO
+ {0x77, 0x05}, // SPECIES_KABUTOPS
+ {0x86, 0x08}, // SPECIES_AERODACTYL
+ {0x86, 0x0b}, // SPECIES_SNORLAX
+ {0x65, 0x0c}, // SPECIES_ARTICUNO
+ {0x76, 0x0b}, // SPECIES_ZAPDOS
+ {0x87, 0x04}, // SPECIES_MOLTRES
+ {0x66, 0x09}, // SPECIES_DRATINI
+ {0x78, 0x00}, // SPECIES_DRAGONAIR
+ {0x87, 0x06}, // SPECIES_DRAGONITE
+ {0x78, 0x01}, // SPECIES_MEWTWO
+ {0x66, 0x08}, // SPECIES_MEW
+ {0x56, 0x0a}, // SPECIES_CHIKORITA
+ {0x66, 0x08}, // SPECIES_BAYLEEF
+ {0x78, 0x00}, // SPECIES_MEGANIUM
+ {0x76, 0x09}, // SPECIES_CYNDAQUIL
+ {0x87, 0x04}, // SPECIES_QUILAVA
{0x87, 0x04}, // SPECIES_TYPHLOSION
- {0x87, 0x04}, // SPECIES_TOTODILE
- {0x66, 0x0b}, // SPECIES_CROCONAW
- {0x67, 0x07}, // SPECIES_FERALIGATR
- {0x88, 0x01}, // SPECIES_SENTRET
- {0x67, 0x05}, // SPECIES_FURRET
+ {0x66, 0x0b}, // SPECIES_TOTODILE
+ {0x67, 0x07}, // SPECIES_CROCONAW
+ {0x88, 0x01}, // SPECIES_FERALIGATR
+ {0x67, 0x05}, // SPECIES_SENTRET
+ {0x66, 0x08}, // SPECIES_FURRET
{0x66, 0x08}, // SPECIES_HOOTHOOT
- {0x66, 0x08}, // SPECIES_NOCTOWL
- {0x68, 0x03}, // SPECIES_LEDYBA
- {0x76, 0x0b}, // SPECIES_LEDIAN
- {0x77, 0x07}, // SPECIES_SPINARAK
- {0x73, 0x15}, // SPECIES_ARIADOS
- {0x86, 0x0b}, // SPECIES_CROBAT
- {0x87, 0x05}, // SPECIES_CHINCHOU
+ {0x68, 0x03}, // SPECIES_NOCTOWL
+ {0x76, 0x0b}, // SPECIES_LEDYBA
+ {0x77, 0x07}, // SPECIES_LEDIAN
+ {0x73, 0x15}, // SPECIES_SPINARAK
+ {0x86, 0x0b}, // SPECIES_ARIADOS
+ {0x87, 0x05}, // SPECIES_CROBAT
+ {0x86, 0x08}, // SPECIES_CHINCHOU
{0x86, 0x08}, // SPECIES_LANTURN
- {0x86, 0x08}, // SPECIES_PICHU
- {0x66, 0x0b}, // SPECIES_CLEFFA
- {0x65, 0x0f}, // SPECIES_IGGLYBUFF
- {0x66, 0x0b}, // SPECIES_TOGEPI
- {0x54, 0x10}, // SPECIES_TOGETIC
- {0x66, 0x08}, // SPECIES_NATU
- {0x54, 0x11}, // SPECIES_XATU
- {0x76, 0x08}, // SPECIES_MAREEP
+ {0x66, 0x0b}, // SPECIES_PICHU
+ {0x65, 0x0f}, // SPECIES_CLEFFA
+ {0x66, 0x0b}, // SPECIES_IGGLYBUFF
+ {0x54, 0x10}, // SPECIES_TOGEPI
+ {0x66, 0x08}, // SPECIES_TOGETIC
+ {0x54, 0x11}, // SPECIES_NATU
+ {0x76, 0x08}, // SPECIES_XATU
+ {0x66, 0x09}, // SPECIES_MAREEP
{0x66, 0x09}, // SPECIES_FLAAFFY
- {0x66, 0x09}, // SPECIES_AMPHAROS
- {0x88, 0x01}, // SPECIES_BELLOSSOM
- {0x66, 0x0b}, // SPECIES_MARILL
- {0x75, 0x0c}, // SPECIES_AZUMARILL
- {0x86, 0x08}, // SPECIES_SUDOWOODO
- {0x66, 0x08}, // SPECIES_POLITOED
- {0x66, 0x09}, // SPECIES_HOPPIP
- {0x66, 0x0b}, // SPECIES_SKIPLOOM
- {0x65, 0x0d}, // SPECIES_JUMPLUFF
- {0x87, 0x04}, // SPECIES_AIPOM
- {0x66, 0x09}, // SPECIES_SUNKERN
- {0x56, 0x0a}, // SPECIES_SUNFLORA
- {0x66, 0x08}, // SPECIES_YANMA
- {0x77, 0x04}, // SPECIES_WOOPER
- {0x85, 0x0f}, // SPECIES_QUAGSIRE
- {0x76, 0x08}, // SPECIES_ESPEON
- {0x76, 0x0b}, // SPECIES_UMBREON
- {0x87, 0x04}, // SPECIES_MURKROW
- {0x66, 0x09}, // SPECIES_SLOWKING
- {0x66, 0x08}, // SPECIES_MISDREAVUS
- {0x66, 0x0a}, // SPECIES_UNOWN
- {0x36, 0x08}, // SPECIES_WOBBUFFET
- {0x75, 0x0c}, // SPECIES_GIRAFARIG
- {0x87, 0x05}, // SPECIES_PINECO
- {0x65, 0x0f}, // SPECIES_FORRETRESS
- {0x84, 0x10}, // SPECIES_DUNSPARCE
- {0x85, 0x0f}, // SPECIES_GLIGAR
- {0x87, 0x05}, // SPECIES_STEELIX
- {0x88, 0x00}, // SPECIES_SNUBBULL
- {0x76, 0x0a}, // SPECIES_GRANBULL
- {0x87, 0x05}, // SPECIES_QWILFISH
- {0x77, 0x07}, // SPECIES_SCIZOR
- {0x77, 0x04}, // SPECIES_SHUCKLE
- {0x56, 0x0b}, // SPECIES_HERACROSS
- {0x77, 0x04}, // SPECIES_SNEASEL
+ {0x88, 0x01}, // SPECIES_AMPHAROS
+ {0x66, 0x0b}, // SPECIES_BELLOSSOM
+ {0x75, 0x0c}, // SPECIES_MARILL
+ {0x86, 0x08}, // SPECIES_AZUMARILL
+ {0x66, 0x08}, // SPECIES_SUDOWOODO
+ {0x66, 0x09}, // SPECIES_POLITOED
+ {0x66, 0x0b}, // SPECIES_HOPPIP
+ {0x65, 0x0d}, // SPECIES_SKIPLOOM
+ {0x87, 0x04}, // SPECIES_JUMPLUFF
+ {0x66, 0x09}, // SPECIES_AIPOM
+ {0x56, 0x0a}, // SPECIES_SUNKERN
+ {0x66, 0x08}, // SPECIES_SUNFLORA
+ {0x77, 0x04}, // SPECIES_YANMA
+ {0x85, 0x0f}, // SPECIES_WOOPER
+ {0x76, 0x08}, // SPECIES_QUAGSIRE
+ {0x76, 0x0b}, // SPECIES_ESPEON
+ {0x87, 0x04}, // SPECIES_UMBREON
+ {0x66, 0x09}, // SPECIES_MURKROW
+ {0x66, 0x08}, // SPECIES_SLOWKING
+ {0x66, 0x0a}, // SPECIES_MISDREAVUS
+ {0x36, 0x08}, // SPECIES_UNOWN
+ {0x75, 0x0c}, // SPECIES_WOBBUFFET
+ {0x87, 0x05}, // SPECIES_GIRAFARIG
+ {0x65, 0x0f}, // SPECIES_PINECO
+ {0x84, 0x10}, // SPECIES_FORRETRESS
+ {0x85, 0x0f}, // SPECIES_DUNSPARCE
+ {0x87, 0x05}, // SPECIES_GLIGAR
+ {0x88, 0x00}, // SPECIES_STEELIX
+ {0x76, 0x0a}, // SPECIES_SNUBBULL
+ {0x87, 0x05}, // SPECIES_GRANBULL
+ {0x77, 0x07}, // SPECIES_QWILFISH
+ {0x77, 0x04}, // SPECIES_SCIZOR
+ {0x56, 0x0b}, // SPECIES_SHUCKLE
+ {0x77, 0x04}, // SPECIES_HERACROSS
+ {0x66, 0x08}, // SPECIES_SNEASEL
{0x66, 0x08}, // SPECIES_TEDDIURSA
- {0x66, 0x08}, // SPECIES_URSARING
- {0x88, 0x03}, // SPECIES_SLUGMA
- {0x66, 0x08}, // SPECIES_MAGCARGO
- {0x76, 0x09}, // SPECIES_SWINUB
- {0x63, 0x15}, // SPECIES_PILOSWINE
- {0x75, 0x0d}, // SPECIES_CORSOLA
- {0x65, 0x0c}, // SPECIES_REMORAID
- {0x75, 0x0d}, // SPECIES_OCTILLERY
- {0x66, 0x0a}, // SPECIES_DELIBIRD
- {0x67, 0x06}, // SPECIES_MANTINE
- {0x87, 0x07}, // SPECIES_SKARMORY
- {0x87, 0x04}, // SPECIES_HOUNDOUR
- {0x55, 0x0c}, // SPECIES_HOUNDOOM
- {0x87, 0x07}, // SPECIES_KINGDRA
- {0x87, 0x06}, // SPECIES_PHANPY
- {0x65, 0x0e}, // SPECIES_DONPHAN
- {0x85, 0x0d}, // SPECIES_PORYGON2
- {0x76, 0x0a}, // SPECIES_STANTLER
- {0x78, 0x03}, // SPECIES_SMEARGLE
- {0x76, 0x0a}, // SPECIES_TYROGUE
- {0x66, 0x08}, // SPECIES_HITMONTOP
- {0x87, 0x05}, // SPECIES_SMOOCHUM
- {0x56, 0x09}, // SPECIES_ELEKID
- {0x66, 0x08}, // SPECIES_MAGBY
- {0x66, 0x0b}, // SPECIES_MILTANK
- {0x87, 0x07}, // SPECIES_BLISSEY
- {0x85, 0x0d}, // SPECIES_RAIKOU
- {0x86, 0x0a}, // SPECIES_ENTEI
- {0x87, 0x06}, // SPECIES_SUICUNE
- {0x88, 0x03}, // SPECIES_LARVITAR
- {0x66, 0x08}, // SPECIES_PUPITAR
- {0x67, 0x05}, // SPECIES_TYRANITAR
- {0x88, 0x00}, // SPECIES_LUGIA
+ {0x88, 0x03}, // SPECIES_URSARING
+ {0x66, 0x08}, // SPECIES_SLUGMA
+ {0x76, 0x09}, // SPECIES_MAGCARGO
+ {0x63, 0x15}, // SPECIES_SWINUB
+ {0x75, 0x0d}, // SPECIES_PILOSWINE
+ {0x65, 0x0c}, // SPECIES_CORSOLA
+ {0x75, 0x0d}, // SPECIES_REMORAID
+ {0x66, 0x0a}, // SPECIES_OCTILLERY
+ {0x67, 0x06}, // SPECIES_DELIBIRD
+ {0x87, 0x07}, // SPECIES_MANTINE
+ {0x87, 0x04}, // SPECIES_SKARMORY
+ {0x55, 0x0c}, // SPECIES_HOUNDOUR
+ {0x87, 0x07}, // SPECIES_HOUNDOOM
+ {0x87, 0x06}, // SPECIES_KINGDRA
+ {0x65, 0x0e}, // SPECIES_PHANPY
+ {0x85, 0x0d}, // SPECIES_DONPHAN
+ {0x76, 0x0a}, // SPECIES_PORYGON2
+ {0x78, 0x03}, // SPECIES_STANTLER
+ {0x76, 0x0a}, // SPECIES_SMEARGLE
+ {0x66, 0x08}, // SPECIES_TYROGUE
+ {0x87, 0x05}, // SPECIES_HITMONTOP
+ {0x56, 0x09}, // SPECIES_SMOOCHUM
+ {0x66, 0x08}, // SPECIES_ELEKID
+ {0x66, 0x0b}, // SPECIES_MAGBY
+ {0x87, 0x07}, // SPECIES_MILTANK
+ {0x85, 0x0d}, // SPECIES_BLISSEY
+ {0x86, 0x0a}, // SPECIES_RAIKOU
+ {0x87, 0x06}, // SPECIES_ENTEI
+ {0x88, 0x03}, // SPECIES_SUICUNE
+ {0x66, 0x08}, // SPECIES_LARVITAR
+ {0x67, 0x05}, // SPECIES_PUPITAR
+ {0x88, 0x00}, // SPECIES_TYRANITAR
+ {0x88, 0x01}, // SPECIES_LUGIA
{0x88, 0x01}, // SPECIES_HO_OH
- {0x88, 0x01}, // SPECIES_CELEBI
- {0x66, 0x08}, // SPECIES_OLD_UNOWN_B
+ {0x66, 0x08}, // SPECIES_CELEBI
+ {0x88, 0x02}, // SPECIES_OLD_UNOWN_B
{0x88, 0x02}, // SPECIES_OLD_UNOWN_C
{0x88, 0x02}, // SPECIES_OLD_UNOWN_D
{0x88, 0x02}, // SPECIES_OLD_UNOWN_E
@@ -276,168 +277,167 @@ const struct MonCoords gMonBackPicCoords[] =
{0x88, 0x02}, // SPECIES_OLD_UNOWN_X
{0x88, 0x02}, // SPECIES_OLD_UNOWN_Y
{0x88, 0x02}, // SPECIES_OLD_UNOWN_Z
- {0x88, 0x02}, // SPECIES_TREECKO
- {0x87, 0x06}, // SPECIES_GROVYLE
- {0x86, 0x08}, // SPECIES_SCEPTILE
- {0x88, 0x01}, // SPECIES_TORCHIC
- {0x67, 0x05}, // SPECIES_COMBUSKEN
+ {0x87, 0x06}, // SPECIES_TREECKO
+ {0x86, 0x08}, // SPECIES_GROVYLE
+ {0x88, 0x01}, // SPECIES_SCEPTILE
+ {0x67, 0x05}, // SPECIES_TORCHIC
+ {0x88, 0x00}, // SPECIES_COMBUSKEN
{0x88, 0x00}, // SPECIES_BLAZIKEN
- {0x88, 0x00}, // SPECIES_MUDKIP
- {0x77, 0x05}, // SPECIES_MARSHTOMP
- {0x87, 0x04}, // SPECIES_SWAMPERT
- {0x87, 0x05}, // SPECIES_POOCHYENA
- {0x76, 0x09}, // SPECIES_MIGHTYENA
- {0x87, 0x04}, // SPECIES_ZIGZAGOON
- {0x76, 0x0b}, // SPECIES_LINOONE
- {0x85, 0x0f}, // SPECIES_WURMPLE
- {0x76, 0x0b}, // SPECIES_SILCOON
- {0x83, 0x15}, // SPECIES_BEAUTIFLY
- {0x88, 0x00}, // SPECIES_CASCOON
- {0x73, 0x14}, // SPECIES_DUSTOX
- {0x83, 0x14}, // SPECIES_LOTAD
- {0x75, 0x0f}, // SPECIES_LOMBRE
- {0x86, 0x08}, // SPECIES_LUDICOLO
- {0x86, 0x0a}, // SPECIES_SEEDOT
- {0x86, 0x09}, // SPECIES_NUZLEAF
- {0x76, 0x0a}, // SPECIES_SHIFTRY
- {0x86, 0x08}, // SPECIES_NINCADA
- {0x83, 0x14}, // SPECIES_NINJASK
- {0x86, 0x08}, // SPECIES_SHEDINJA
- {0x77, 0x06}, // SPECIES_TAILLOW
- {0x64, 0x11}, // SPECIES_SWELLOW
- {0x86, 0x08}, // SPECIES_SHROOMISH
- {0x85, 0x0d}, // SPECIES_BRELOOM
- {0x87, 0x04}, // SPECIES_SPINDA
- {0x77, 0x04}, // SPECIES_WINGULL
- {0x85, 0x0e}, // SPECIES_PELIPPER
- {0x87, 0x06}, // SPECIES_SURSKIT
- {0x86, 0x0b}, // SPECIES_MASQUERAIN
- {0x88, 0x00}, // SPECIES_WAILMER
- {0x83, 0x15}, // SPECIES_WAILORD
- {0x83, 0x16}, // SPECIES_SKITTY
- {0x86, 0x0a}, // SPECIES_DELCATTY
- {0x86, 0x08}, // SPECIES_KECLEON
- {0x87, 0x06}, // SPECIES_BALTOY
- {0x86, 0x08}, // SPECIES_CLAYDOL
- {0x87, 0x07}, // SPECIES_NOSEPASS
- {0x85, 0x0c}, // SPECIES_TORKOAL
- {0x86, 0x0a}, // SPECIES_SABLEYE
- {0x76, 0x08}, // SPECIES_BARBOACH
- {0x66, 0x0a}, // SPECIES_WHISCASH
- {0x86, 0x0a}, // SPECIES_LUVDISC
- {0x46, 0x0a}, // SPECIES_CORPHISH
- {0x77, 0x07}, // SPECIES_CRAWDAUNT
- {0x87, 0x05}, // SPECIES_FEEBAS
- {0x67, 0x07}, // SPECIES_MILOTIC
- {0x68, 0x02}, // SPECIES_CARVANHA
- {0x87, 0x07}, // SPECIES_SHARPEDO
- {0x88, 0x02}, // SPECIES_TRAPINCH
- {0x75, 0x0e}, // SPECIES_VIBRAVA
- {0x74, 0x11}, // SPECIES_FLYGON
- {0x88, 0x02}, // SPECIES_MAKUHITA
- {0x76, 0x0b}, // SPECIES_HARIYAMA
- {0x87, 0x07}, // SPECIES_ELECTRIKE
- {0x84, 0x10}, // SPECIES_MANECTRIC
- {0x87, 0x04}, // SPECIES_NUMEL
- {0x86, 0x0b}, // SPECIES_CAMERUPT
- {0x84, 0x13}, // SPECIES_SPHEAL
- {0x64, 0x12}, // SPECIES_SEALEO
- {0x86, 0x0a}, // SPECIES_WALREIN
- {0x87, 0x06}, // SPECIES_CACNEA
- {0x85, 0x0f}, // SPECIES_CACTURNE
- {0x87, 0x07}, // SPECIES_SNORUNT
- {0x76, 0x0a}, // SPECIES_GLALIE
- {0x85, 0x0c}, // SPECIES_LUNATONE
+ {0x77, 0x05}, // SPECIES_MUDKIP
+ {0x87, 0x04}, // SPECIES_MARSHTOMP
+ {0x87, 0x05}, // SPECIES_SWAMPERT
+ {0x76, 0x09}, // SPECIES_POOCHYENA
+ {0x87, 0x04}, // SPECIES_MIGHTYENA
+ {0x76, 0x0b}, // SPECIES_ZIGZAGOON
+ {0x85, 0x0f}, // SPECIES_LINOONE
+ {0x76, 0x0b}, // SPECIES_WURMPLE
+ {0x83, 0x15}, // SPECIES_SILCOON
+ {0x88, 0x00}, // SPECIES_BEAUTIFLY
+ {0x73, 0x14}, // SPECIES_CASCOON
+ {0x83, 0x14}, // SPECIES_DUSTOX
+ {0x75, 0x0f}, // SPECIES_LOTAD
+ {0x86, 0x08}, // SPECIES_LOMBRE
+ {0x86, 0x0a}, // SPECIES_LUDICOLO
+ {0x86, 0x09}, // SPECIES_SEEDOT
+ {0x76, 0x0a}, // SPECIES_NUZLEAF
+ {0x86, 0x08}, // SPECIES_SHIFTRY
+ {0x83, 0x14}, // SPECIES_NINCADA
+ {0x86, 0x08}, // SPECIES_NINJASK
+ {0x77, 0x06}, // SPECIES_SHEDINJA
+ {0x64, 0x11}, // SPECIES_TAILLOW
+ {0x86, 0x08}, // SPECIES_SWELLOW
+ {0x85, 0x0d}, // SPECIES_SHROOMISH
+ {0x87, 0x04}, // SPECIES_BRELOOM
+ {0x77, 0x04}, // SPECIES_SPINDA
+ {0x85, 0x0e}, // SPECIES_WINGULL
+ {0x87, 0x06}, // SPECIES_PELIPPER
+ {0x86, 0x0b}, // SPECIES_SURSKIT
+ {0x88, 0x00}, // SPECIES_MASQUERAIN
+ {0x83, 0x15}, // SPECIES_WAILMER
+ {0x83, 0x16}, // SPECIES_WAILORD
+ {0x86, 0x0a}, // SPECIES_SKITTY
+ {0x86, 0x08}, // SPECIES_DELCATTY
+ {0x87, 0x06}, // SPECIES_KECLEON
+ {0x86, 0x08}, // SPECIES_BALTOY
+ {0x87, 0x07}, // SPECIES_CLAYDOL
+ {0x85, 0x0c}, // SPECIES_NOSEPASS
+ {0x86, 0x0a}, // SPECIES_TORKOAL
+ {0x76, 0x08}, // SPECIES_SABLEYE
+ {0x66, 0x0a}, // SPECIES_BARBOACH
+ {0x86, 0x0a}, // SPECIES_WHISCASH
+ {0x46, 0x0a}, // SPECIES_LUVDISC
+ {0x77, 0x07}, // SPECIES_CORPHISH
+ {0x87, 0x05}, // SPECIES_CRAWDAUNT
+ {0x67, 0x07}, // SPECIES_FEEBAS
+ {0x68, 0x02}, // SPECIES_MILOTIC
+ {0x87, 0x07}, // SPECIES_CARVANHA
+ {0x88, 0x02}, // SPECIES_SHARPEDO
+ {0x75, 0x0e}, // SPECIES_TRAPINCH
+ {0x74, 0x11}, // SPECIES_VIBRAVA
+ {0x88, 0x02}, // SPECIES_FLYGON
+ {0x76, 0x0b}, // SPECIES_MAKUHITA
+ {0x87, 0x07}, // SPECIES_HARIYAMA
+ {0x84, 0x10}, // SPECIES_ELECTRIKE
+ {0x87, 0x04}, // SPECIES_MANECTRIC
+ {0x86, 0x0b}, // SPECIES_NUMEL
+ {0x84, 0x13}, // SPECIES_CAMERUPT
+ {0x64, 0x12}, // SPECIES_SPHEAL
+ {0x86, 0x0a}, // SPECIES_SEALEO
+ {0x87, 0x06}, // SPECIES_WALREIN
+ {0x85, 0x0f}, // SPECIES_CACNEA
+ {0x87, 0x07}, // SPECIES_CACTURNE
+ {0x76, 0x0a}, // SPECIES_SNORUNT
+ {0x85, 0x0c}, // SPECIES_GLALIE
+ {0x87, 0x05}, // SPECIES_LUNATONE
{0x87, 0x05}, // SPECIES_SOLROCK
- {0x87, 0x05}, // SPECIES_AZURILL
- {0x86, 0x0a}, // SPECIES_SPOINK
- {0x56, 0x0b}, // SPECIES_GRUMPIG
- {0x87, 0x04}, // SPECIES_PLUSLE
+ {0x86, 0x0a}, // SPECIES_AZURILL
+ {0x56, 0x0b}, // SPECIES_SPOINK
+ {0x87, 0x04}, // SPECIES_GRUMPIG
+ {0x76, 0x08}, // SPECIES_PLUSLE
{0x76, 0x08}, // SPECIES_MINUN
- {0x76, 0x08}, // SPECIES_MAWILE
- {0x87, 0x04}, // SPECIES_MEDITITE
- {0x76, 0x0b}, // SPECIES_MEDICHAM
- {0x68, 0x03}, // SPECIES_SWABLU
- {0x86, 0x09}, // SPECIES_ALTARIA
- {0x87, 0x06}, // SPECIES_WYNAUT
- {0x77, 0x07}, // SPECIES_DUSKULL
- {0x66, 0x0b}, // SPECIES_DUSCLOPS
+ {0x87, 0x04}, // SPECIES_MAWILE
+ {0x76, 0x0b}, // SPECIES_MEDITITE
+ {0x68, 0x03}, // SPECIES_MEDICHAM
+ {0x86, 0x09}, // SPECIES_SWABLU
+ {0x87, 0x06}, // SPECIES_ALTARIA
+ {0x77, 0x07}, // SPECIES_WYNAUT
+ {0x66, 0x0b}, // SPECIES_DUSKULL
+ {0x86, 0x08}, // SPECIES_DUSCLOPS
{0x86, 0x08}, // SPECIES_ROSELIA
- {0x86, 0x08}, // SPECIES_SLAKOTH
- {0x85, 0x0f}, // SPECIES_VIGOROTH
- {0x86, 0x0a}, // SPECIES_SLAKING
- {0x86, 0x08}, // SPECIES_GULPIN
- {0x66, 0x0b}, // SPECIES_SWALOT
- {0x77, 0x06}, // SPECIES_TROPIUS
- {0x87, 0x07}, // SPECIES_WHISMUR
- {0x85, 0x0d}, // SPECIES_LOUDRED
- {0x86, 0x09}, // SPECIES_EXPLOUD
- {0x88, 0x03}, // SPECIES_CLAMPERL
- {0x85, 0x0d}, // SPECIES_HUNTAIL
- {0x68, 0x02}, // SPECIES_GOREBYSS
- {0x77, 0x05}, // SPECIES_ABSOL
- {0x78, 0x03}, // SPECIES_SHUPPET
- {0x77, 0x06}, // SPECIES_BANETTE
- {0x65, 0x0c}, // SPECIES_SEVIPER
- {0x88, 0x03}, // SPECIES_ZANGOOSE
- {0x88, 0x01}, // SPECIES_RELICANTH
- {0x86, 0x0a}, // SPECIES_ARON
- {0x54, 0x11}, // SPECIES_LAIRON
- {0x84, 0x11}, // SPECIES_AGGRON
- {0x87, 0x07}, // SPECIES_CASTFORM
- {0x45, 0x0d}, // SPECIES_VOLBEAT
- {0x76, 0x08}, // SPECIES_ILLUMISE
- {0x67, 0x06}, // SPECIES_LILEEP
- {0x86, 0x09}, // SPECIES_CRADILY
- {0x77, 0x04}, // SPECIES_ANORITH
- {0x83, 0x17}, // SPECIES_ARMALDO
- {0x77, 0x05}, // SPECIES_RALTS
- {0x45, 0x0d}, // SPECIES_KIRLIA
- {0x57, 0x06}, // SPECIES_GARDEVOIR
- {0x77, 0x04}, // SPECIES_BAGON
- {0x66, 0x08}, // SPECIES_SHELGON
- {0x85, 0x0d}, // SPECIES_SALAMENCE
- {0x77, 0x06}, // SPECIES_BELDUM
- {0x66, 0x0a}, // SPECIES_METANG
- {0x84, 0x10}, // SPECIES_METAGROSS
- {0x83, 0x14}, // SPECIES_REGIROCK
- {0x86, 0x0a}, // SPECIES_REGICE
+ {0x85, 0x0f}, // SPECIES_SLAKOTH
+ {0x86, 0x0a}, // SPECIES_VIGOROTH
+ {0x86, 0x08}, // SPECIES_SLAKING
+ {0x66, 0x0b}, // SPECIES_GULPIN
+ {0x77, 0x06}, // SPECIES_SWALOT
+ {0x87, 0x07}, // SPECIES_TROPIUS
+ {0x85, 0x0d}, // SPECIES_WHISMUR
+ {0x86, 0x09}, // SPECIES_LOUDRED
+ {0x88, 0x03}, // SPECIES_EXPLOUD
+ {0x85, 0x0d}, // SPECIES_CLAMPERL
+ {0x68, 0x02}, // SPECIES_HUNTAIL
+ {0x77, 0x05}, // SPECIES_GOREBYSS
+ {0x78, 0x03}, // SPECIES_ABSOL
+ {0x77, 0x06}, // SPECIES_SHUPPET
+ {0x65, 0x0c}, // SPECIES_BANETTE
+ {0x88, 0x03}, // SPECIES_SEVIPER
+ {0x88, 0x01}, // SPECIES_ZANGOOSE
+ {0x86, 0x0a}, // SPECIES_RELICANTH
+ {0x54, 0x11}, // SPECIES_ARON
+ {0x84, 0x11}, // SPECIES_LAIRON
+ {0x87, 0x07}, // SPECIES_AGGRON
+ {0x45, 0x0d}, // SPECIES_CASTFORM
+ {0x76, 0x08}, // SPECIES_VOLBEAT
+ {0x67, 0x06}, // SPECIES_ILLUMISE
+ {0x86, 0x09}, // SPECIES_LILEEP
+ {0x77, 0x04}, // SPECIES_CRADILY
+ {0x83, 0x17}, // SPECIES_ANORITH
+ {0x77, 0x05}, // SPECIES_ARMALDO
+ {0x45, 0x0d}, // SPECIES_RALTS
+ {0x57, 0x06}, // SPECIES_KIRLIA
+ {0x77, 0x04}, // SPECIES_GARDEVOIR
+ {0x66, 0x08}, // SPECIES_BAGON
+ {0x85, 0x0d}, // SPECIES_SHELGON
+ {0x77, 0x06}, // SPECIES_SALAMENCE
+ {0x66, 0x0a}, // SPECIES_BELDUM
+ {0x84, 0x10}, // SPECIES_METANG
+ {0x83, 0x14}, // SPECIES_METAGROSS
+ {0x86, 0x0a}, // SPECIES_REGIROCK
+ {0x85, 0x0e}, // SPECIES_REGICE
{0x85, 0x0e}, // SPECIES_REGISTEEL
- {0x85, 0x0e}, // SPECIES_KYOGRE
- {0x84, 0x13}, // SPECIES_GROUDON
- {0x87, 0x07}, // SPECIES_RAYQUAZA
- {0x78, 0x00}, // SPECIES_LATIAS
- {0x88, 0x02}, // SPECIES_LATIOS
- {0x88, 0x03}, // SPECIES_JIRACHI
- {0x87, 0x05}, // SPECIES_DEOXYS
- {0x86, 0x09}, // SPECIES_CHIMECHO
- {0x47, 0x07}, // SPECIES_EGG
- {0x36, 0x0a}, // SPECIES_UNOWN_B
- {0x56, 0x09}, // SPECIES_UNOWN_C
- {0x67, 0x06}, // SPECIES_UNOWN_D
- {0x56, 0x08}, // SPECIES_UNOWN_E
- {0x56, 0x0a}, // SPECIES_UNOWN_F
- {0x66, 0x0a}, // SPECIES_UNOWN_G
- {0x57, 0x05}, // SPECIES_UNOWN_H
- {0x66, 0x08}, // SPECIES_UNOWN_I
- {0x37, 0x07}, // SPECIES_UNOWN_J
- {0x46, 0x09}, // SPECIES_UNOWN_K
- {0x57, 0x07}, // SPECIES_UNOWN_L
- {0x46, 0x0a}, // SPECIES_UNOWN_M
+ {0x84, 0x13}, // SPECIES_KYOGRE
+ {0x87, 0x07}, // SPECIES_GROUDON
+ {0x78, 0x00}, // SPECIES_RAYQUAZA
+ {0x88, 0x02}, // SPECIES_LATIAS
+ {0x88, 0x03}, // SPECIES_LATIOS
+ {0x87, 0x05}, // SPECIES_JIRACHI
+ {0x86, 0x09}, // SPECIES_DEOXYS
+ {0x47, 0x07}, // SPECIES_CHIMECHO
+ {0x36, 0x0a}, // SPECIES_EGG
+ {0x56, 0x09}, // SPECIES_UNOWN_B
+ {0x67, 0x06}, // SPECIES_UNOWN_C
+ {0x56, 0x08}, // SPECIES_UNOWN_D
+ {0x56, 0x0a}, // SPECIES_UNOWN_E
+ {0x66, 0x0a}, // SPECIES_UNOWN_F
+ {0x57, 0x05}, // SPECIES_UNOWN_G
+ {0x66, 0x08}, // SPECIES_UNOWN_H
+ {0x37, 0x07}, // SPECIES_UNOWN_I
+ {0x46, 0x09}, // SPECIES_UNOWN_J
+ {0x57, 0x07}, // SPECIES_UNOWN_K
+ {0x46, 0x0a}, // SPECIES_UNOWN_L
+ {0x65, 0x0d}, // SPECIES_UNOWN_M
{0x65, 0x0d}, // SPECIES_UNOWN_N
- {0x65, 0x0d}, // SPECIES_UNOWN_O
- {0x66, 0x08}, // SPECIES_UNOWN_P
- {0x46, 0x0a}, // SPECIES_UNOWN_Q
- {0x55, 0x0f}, // SPECIES_UNOWN_R
- {0x45, 0x0c}, // SPECIES_UNOWN_S
- {0x57, 0x04}, // SPECIES_UNOWN_T
- {0x45, 0x0d}, // SPECIES_UNOWN_U
- {0x65, 0x0d}, // SPECIES_UNOWN_V
- {0x56, 0x0b}, // SPECIES_UNOWN_W
- {0x55, 0x0d}, // SPECIES_UNOWN_X
- {0x55, 0x0f}, // SPECIES_UNOWN_Y
+ {0x66, 0x08}, // SPECIES_UNOWN_O
+ {0x46, 0x0a}, // SPECIES_UNOWN_P
+ {0x55, 0x0f}, // SPECIES_UNOWN_Q
+ {0x45, 0x0c}, // SPECIES_UNOWN_R
+ {0x57, 0x04}, // SPECIES_UNOWN_S
+ {0x45, 0x0d}, // SPECIES_UNOWN_T
+ {0x65, 0x0d}, // SPECIES_UNOWN_U
+ {0x56, 0x0b}, // SPECIES_UNOWN_V
+ {0x55, 0x0d}, // SPECIES_UNOWN_W
+ {0x55, 0x0f}, // SPECIES_UNOWN_X
+ {0x46, 0x0a}, // SPECIES_UNOWN_Y
{0x46, 0x0a}, // SPECIES_UNOWN_Z
- {0x46, 0x0a}, // SPECIES_UNOWN_EMARK
- {0x37, 0x06}, // SPECIES_UNOWN_QMARK
- {0x47, 0x06},
+ {0x37, 0x06}, // SPECIES_UNOWN_EMARK
+ {0x47, 0x06}, // SPECIES_UNOWN_QMARK
};
diff --git a/src/data/pokemon_graphics/footprint_table.h b/src/data/pokemon_graphics/footprint_table.h
new file mode 100644
index 000000000..779ce3dcd
--- /dev/null
+++ b/src/data/pokemon_graphics/footprint_table.h
@@ -0,0 +1,416 @@
+const u8 *const gMonFootprintTable[] =
+{
+ gMonFootprint_Bulbasaur,
+ gMonFootprint_Bulbasaur,
+ gMonFootprint_Ivysaur,
+ gMonFootprint_Venusaur,
+ gMonFootprint_Charmander,
+ gMonFootprint_Charmeleon,
+ gMonFootprint_Charizard,
+ gMonFootprint_Squirtle,
+ gMonFootprint_Wartortle,
+ gMonFootprint_Blastoise,
+ gMonFootprint_Caterpie,
+ gMonFootprint_Metapod,
+ gMonFootprint_Butterfree,
+ gMonFootprint_Weedle,
+ gMonFootprint_Kakuna,
+ gMonFootprint_Beedrill,
+ gMonFootprint_Pidgey,
+ gMonFootprint_Pidgeotto,
+ gMonFootprint_Pidgeot,
+ gMonFootprint_Rattata,
+ gMonFootprint_Raticate,
+ gMonFootprint_Spearow,
+ gMonFootprint_Fearow,
+ gMonFootprint_Ekans,
+ gMonFootprint_Arbok,
+ gMonFootprint_Pikachu,
+ gMonFootprint_Raichu,
+ gMonFootprint_Sandshrew,
+ gMonFootprint_Sandslash,
+ gMonFootprint_NidoranF,
+ gMonFootprint_Nidorina,
+ gMonFootprint_Nidoqueen,
+ gMonFootprint_NidoranM,
+ gMonFootprint_Nidorino,
+ gMonFootprint_Nidoking,
+ gMonFootprint_Clefairy,
+ gMonFootprint_Clefable,
+ gMonFootprint_Vulpix,
+ gMonFootprint_Ninetales,
+ gMonFootprint_Jigglypuff,
+ gMonFootprint_Wigglytuff,
+ gMonFootprint_Zubat,
+ gMonFootprint_Golbat,
+ gMonFootprint_Oddish,
+ gMonFootprint_Gloom,
+ gMonFootprint_Vileplume,
+ gMonFootprint_Paras,
+ gMonFootprint_Parasect,
+ gMonFootprint_Venonat,
+ gMonFootprint_Venomoth,
+ gMonFootprint_Diglett,
+ gMonFootprint_Dugtrio,
+ gMonFootprint_Meowth,
+ gMonFootprint_Persian,
+ gMonFootprint_Psyduck,
+ gMonFootprint_Golduck,
+ gMonFootprint_Mankey,
+ gMonFootprint_Primeape,
+ gMonFootprint_Growlithe,
+ gMonFootprint_Arcanine,
+ gMonFootprint_Poliwag,
+ gMonFootprint_Poliwhirl,
+ gMonFootprint_Poliwrath,
+ gMonFootprint_Abra,
+ gMonFootprint_Kadabra,
+ gMonFootprint_Alakazam,
+ gMonFootprint_Machop,
+ gMonFootprint_Machoke,
+ gMonFootprint_Machamp,
+ gMonFootprint_Bellsprout,
+ gMonFootprint_Weepinbell,
+ gMonFootprint_Victreebel,
+ gMonFootprint_Tentacool,
+ gMonFootprint_Tentacruel,
+ gMonFootprint_Geodude,
+ gMonFootprint_Graveler,
+ gMonFootprint_Golem,
+ gMonFootprint_Ponyta,
+ gMonFootprint_Rapidash,
+ gMonFootprint_Slowpoke,
+ gMonFootprint_Slowbro,
+ gMonFootprint_Magnemite,
+ gMonFootprint_Magneton,
+ gMonFootprint_Farfetchd,
+ gMonFootprint_Doduo,
+ gMonFootprint_Dodrio,
+ gMonFootprint_Seel,
+ gMonFootprint_Dewgong,
+ gMonFootprint_Grimer,
+ gMonFootprint_Muk,
+ gMonFootprint_Shellder,
+ gMonFootprint_Cloyster,
+ gMonFootprint_Gastly,
+ gMonFootprint_Haunter,
+ gMonFootprint_Gengar,
+ gMonFootprint_Onix,
+ gMonFootprint_Drowzee,
+ gMonFootprint_Hypno,
+ gMonFootprint_Krabby,
+ gMonFootprint_Kingler,
+ gMonFootprint_Voltorb,
+ gMonFootprint_Electrode,
+ gMonFootprint_Exeggcute,
+ gMonFootprint_Exeggutor,
+ gMonFootprint_Cubone,
+ gMonFootprint_Marowak,
+ gMonFootprint_Hitmonlee,
+ gMonFootprint_Hitmonchan,
+ gMonFootprint_Lickitung,
+ gMonFootprint_Koffing,
+ gMonFootprint_Weezing,
+ gMonFootprint_Rhyhorn,
+ gMonFootprint_Rhydon,
+ gMonFootprint_Chansey,
+ gMonFootprint_Tangela,
+ gMonFootprint_Kangaskhan,
+ gMonFootprint_Horsea,
+ gMonFootprint_Seadra,
+ gMonFootprint_Goldeen,
+ gMonFootprint_Seaking,
+ gMonFootprint_Staryu,
+ gMonFootprint_Starmie,
+ gMonFootprint_Mrmime,
+ gMonFootprint_Scyther,
+ gMonFootprint_Jynx,
+ gMonFootprint_Electabuzz,
+ gMonFootprint_Magmar,
+ gMonFootprint_Pinsir,
+ gMonFootprint_Tauros,
+ gMonFootprint_Magikarp,
+ gMonFootprint_Gyarados,
+ gMonFootprint_Lapras,
+ gMonFootprint_Ditto,
+ gMonFootprint_Eevee,
+ gMonFootprint_Vaporeon,
+ gMonFootprint_Jolteon,
+ gMonFootprint_Flareon,
+ gMonFootprint_Porygon,
+ gMonFootprint_Omanyte,
+ gMonFootprint_Omastar,
+ gMonFootprint_Kabuto,
+ gMonFootprint_Kabutops,
+ gMonFootprint_Aerodactyl,
+ gMonFootprint_Snorlax,
+ gMonFootprint_Articuno,
+ gMonFootprint_Zapdos,
+ gMonFootprint_Moltres,
+ gMonFootprint_Dratini,
+ gMonFootprint_Dragonair,
+ gMonFootprint_Dragonite,
+ gMonFootprint_Mewtwo,
+ gMonFootprint_Mew,
+ gMonFootprint_Chikorita,
+ gMonFootprint_Bayleef,
+ gMonFootprint_Meganium,
+ gMonFootprint_Cyndaquil,
+ gMonFootprint_Quilava,
+ gMonFootprint_Typhlosion,
+ gMonFootprint_Totodile,
+ gMonFootprint_Croconaw,
+ gMonFootprint_Feraligatr,
+ gMonFootprint_Sentret,
+ gMonFootprint_Furret,
+ gMonFootprint_Hoothoot,
+ gMonFootprint_Noctowl,
+ gMonFootprint_Ledyba,
+ gMonFootprint_Ledian,
+ gMonFootprint_Spinarak,
+ gMonFootprint_Ariados,
+ gMonFootprint_Crobat,
+ gMonFootprint_Chinchou,
+ gMonFootprint_Lanturn,
+ gMonFootprint_Pichu,
+ gMonFootprint_Cleffa,
+ gMonFootprint_Igglybuff,
+ gMonFootprint_Togepi,
+ gMonFootprint_Togetic,
+ gMonFootprint_Natu,
+ gMonFootprint_Xatu,
+ gMonFootprint_Mareep,
+ gMonFootprint_Flaaffy,
+ gMonFootprint_Ampharos,
+ gMonFootprint_Bellossom,
+ gMonFootprint_Marill,
+ gMonFootprint_Azumarill,
+ gMonFootprint_Sudowoodo,
+ gMonFootprint_Politoed,
+ gMonFootprint_Hoppip,
+ gMonFootprint_Skiploom,
+ gMonFootprint_Jumpluff,
+ gMonFootprint_Aipom,
+ gMonFootprint_Sunkern,
+ gMonFootprint_Sunflora,
+ gMonFootprint_Yanma,
+ gMonFootprint_Wooper,
+ gMonFootprint_Quagsire,
+ gMonFootprint_Espeon,
+ gMonFootprint_Umbreon,
+ gMonFootprint_Murkrow,
+ gMonFootprint_Slowking,
+ gMonFootprint_Misdreavus,
+ gMonFootprint_Unown,
+ gMonFootprint_Wobbuffet,
+ gMonFootprint_Girafarig,
+ gMonFootprint_Pineco,
+ gMonFootprint_Forretress,
+ gMonFootprint_Dunsparce,
+ gMonFootprint_Gligar,
+ gMonFootprint_Steelix,
+ gMonFootprint_Snubbull,
+ gMonFootprint_Granbull,
+ gMonFootprint_Qwilfish,
+ gMonFootprint_Scizor,
+ gMonFootprint_Shuckle,
+ gMonFootprint_Heracross,
+ gMonFootprint_Sneasel,
+ gMonFootprint_Teddiursa,
+ gMonFootprint_Ursaring,
+ gMonFootprint_Slugma,
+ gMonFootprint_Magcargo,
+ gMonFootprint_Swinub,
+ gMonFootprint_Piloswine,
+ gMonFootprint_Corsola,
+ gMonFootprint_Remoraid,
+ gMonFootprint_Octillery,
+ gMonFootprint_Delibird,
+ gMonFootprint_Mantine,
+ gMonFootprint_Skarmory,
+ gMonFootprint_Houndour,
+ gMonFootprint_Houndoom,
+ gMonFootprint_Kingdra,
+ gMonFootprint_Phanpy,
+ gMonFootprint_Donphan,
+ gMonFootprint_Porygon2,
+ gMonFootprint_Stantler,
+ gMonFootprint_Smeargle,
+ gMonFootprint_Tyrogue,
+ gMonFootprint_Hitmontop,
+ gMonFootprint_Smoochum,
+ gMonFootprint_Elekid,
+ gMonFootprint_Magby,
+ gMonFootprint_Miltank,
+ gMonFootprint_Blissey,
+ gMonFootprint_Raikou,
+ gMonFootprint_Entei,
+ gMonFootprint_Suicune,
+ gMonFootprint_Larvitar,
+ gMonFootprint_Pupitar,
+ gMonFootprint_Tyranitar,
+ gMonFootprint_Lugia,
+ gMonFootprint_HoOh,
+ gMonFootprint_Celebi,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_QuestionMark,
+ gMonFootprint_Treecko,
+ gMonFootprint_Grovyle,
+ gMonFootprint_Sceptile,
+ gMonFootprint_Torchic,
+ gMonFootprint_Combusken,
+ gMonFootprint_Blaziken,
+ gMonFootprint_Mudkip,
+ gMonFootprint_Marshtomp,
+ gMonFootprint_Swampert,
+ gMonFootprint_Poochyena,
+ gMonFootprint_Mightyena,
+ gMonFootprint_Zigzagoon,
+ gMonFootprint_Linoone,
+ gMonFootprint_Wurmple,
+ gMonFootprint_Silcoon,
+ gMonFootprint_Beautifly,
+ gMonFootprint_Cascoon,
+ gMonFootprint_Dustox,
+ gMonFootprint_Lotad,
+ gMonFootprint_Lombre,
+ gMonFootprint_Ludicolo,
+ gMonFootprint_Seedot,
+ gMonFootprint_Nuzleaf,
+ gMonFootprint_Shiftry,
+ gMonFootprint_Nincada,
+ gMonFootprint_Ninjask,
+ gMonFootprint_Shedinja,
+ gMonFootprint_Taillow,
+ gMonFootprint_Swellow,
+ gMonFootprint_Shroomish,
+ gMonFootprint_Breloom,
+ gMonFootprint_Spinda,
+ gMonFootprint_Wingull,
+ gMonFootprint_Pelipper,
+ gMonFootprint_Surskit,
+ gMonFootprint_Masquerain,
+ gMonFootprint_Wailmer,
+ gMonFootprint_Wailord,
+ gMonFootprint_Skitty,
+ gMonFootprint_Delcatty,
+ gMonFootprint_Kecleon,
+ gMonFootprint_Baltoy,
+ gMonFootprint_Claydol,
+ gMonFootprint_Nosepass,
+ gMonFootprint_Torkoal,
+ gMonFootprint_Sableye,
+ gMonFootprint_Barboach,
+ gMonFootprint_Whiscash,
+ gMonFootprint_Luvdisc,
+ gMonFootprint_Corphish,
+ gMonFootprint_Crawdaunt,
+ gMonFootprint_Feebas,
+ gMonFootprint_Milotic,
+ gMonFootprint_Carvanha,
+ gMonFootprint_Sharpedo,
+ gMonFootprint_Trapinch,
+ gMonFootprint_Vibrava,
+ gMonFootprint_Flygon,
+ gMonFootprint_Makuhita,
+ gMonFootprint_Hariyama,
+ gMonFootprint_Electrike,
+ gMonFootprint_Manectric,
+ gMonFootprint_Numel,
+ gMonFootprint_Camerupt,
+ gMonFootprint_Spheal,
+ gMonFootprint_Sealeo,
+ gMonFootprint_Walrein,
+ gMonFootprint_Cacnea,
+ gMonFootprint_Cacturne,
+ gMonFootprint_Snorunt,
+ gMonFootprint_Glalie,
+ gMonFootprint_Lunatone,
+ gMonFootprint_Solrock,
+ gMonFootprint_Azurill,
+ gMonFootprint_Spoink,
+ gMonFootprint_Grumpig,
+ gMonFootprint_Plusle,
+ gMonFootprint_Minun,
+ gMonFootprint_Mawile,
+ gMonFootprint_Meditite,
+ gMonFootprint_Medicham,
+ gMonFootprint_Swablu,
+ gMonFootprint_Altaria,
+ gMonFootprint_Wynaut,
+ gMonFootprint_Duskull,
+ gMonFootprint_Dusclops,
+ gMonFootprint_Roselia,
+ gMonFootprint_Slakoth,
+ gMonFootprint_Vigoroth,
+ gMonFootprint_Slaking,
+ gMonFootprint_Gulpin,
+ gMonFootprint_Swalot,
+ gMonFootprint_Tropius,
+ gMonFootprint_Whismur,
+ gMonFootprint_Loudred,
+ gMonFootprint_Exploud,
+ gMonFootprint_Clamperl,
+ gMonFootprint_Huntail,
+ gMonFootprint_Gorebyss,
+ gMonFootprint_Absol,
+ gMonFootprint_Shuppet,
+ gMonFootprint_Banette,
+ gMonFootprint_Seviper,
+ gMonFootprint_Zangoose,
+ gMonFootprint_Relicanth,
+ gMonFootprint_Aron,
+ gMonFootprint_Lairon,
+ gMonFootprint_Aggron,
+ gMonFootprint_Castform,
+ gMonFootprint_Volbeat,
+ gMonFootprint_Illumise,
+ gMonFootprint_Lileep,
+ gMonFootprint_Cradily,
+ gMonFootprint_Anorith,
+ gMonFootprint_Armaldo,
+ gMonFootprint_Ralts,
+ gMonFootprint_Kirlia,
+ gMonFootprint_Gardevoir,
+ gMonFootprint_Bagon,
+ gMonFootprint_Shelgon,
+ gMonFootprint_Salamence,
+ gMonFootprint_Beldum,
+ gMonFootprint_Metang,
+ gMonFootprint_Metagross,
+ gMonFootprint_Regirock,
+ gMonFootprint_Regice,
+ gMonFootprint_Registeel,
+ gMonFootprint_Kyogre,
+ gMonFootprint_Groudon,
+ gMonFootprint_Rayquaza,
+ gMonFootprint_Latias,
+ gMonFootprint_Latios,
+ gMonFootprint_Jirachi,
+ gMonFootprint_Deoxys,
+ gMonFootprint_Chimecho,
+ gMonFootprint_Bulbasaur,
+};
diff --git a/src/data/pokemon_graphics/front_pic_coordinates.h b/src/data/pokemon_graphics/front_pic_coordinates.h
index fde423570..923df2cde 100644
--- a/src/data/pokemon_graphics/front_pic_coordinates.h
+++ b/src/data/pokemon_graphics/front_pic_coordinates.h
@@ -47,211 +47,212 @@ const struct MonCoords gMonFrontPicCoords[] =
{0x66, 0x0a}, // SPECIES_GLOOM
{0x77, 0x06}, // SPECIES_VILEPLUME
{0x55, 0x0f}, // SPECIES_PARAS
- {0x86, 0x08}, // SPECIES_VENONAT
- {0x66, 0x08}, // SPECIES_VENOMOTH
- {0x88, 0x02}, // SPECIES_DIGLETT
- {0x54, 0x12}, // SPECIES_DUGTRIO
- {0x75, 0x0d}, // SPECIES_MEOWTH
- {0x55, 0x0c}, // SPECIES_PERSIAN
- {0x77, 0x07}, // SPECIES_PSYDUCK
- {0x56, 0x09}, // SPECIES_GOLDUCK
- {0x78, 0x02}, // SPECIES_MANKEY
- {0x65, 0x0e}, // SPECIES_PRIMEAPE
- {0x77, 0x07}, // SPECIES_GROWLITHE
- {0x66, 0x0b}, // SPECIES_ARCANINE
- {0x88, 0x02}, // SPECIES_POLIWAG
- {0x74, 0x13}, // SPECIES_POLIWHIRL
- {0x76, 0x0a}, // SPECIES_POLIWRATH
- {0x76, 0x08}, // SPECIES_ABRA
- {0x66, 0x0b}, // SPECIES_KADABRA
- {0x77, 0x05}, // SPECIES_ALAKAZAM
- {0x87, 0x04}, // SPECIES_MACHOP
- {0x56, 0x0b}, // SPECIES_MACHOKE
- {0x67, 0x06}, // SPECIES_MACHAMP
- {0x88, 0x01}, // SPECIES_BELLSPROUT
- {0x65, 0x0f}, // SPECIES_WEEPINBELL
- {0x66, 0x0b}, // SPECIES_VICTREEBEL
- {0x77, 0x05}, // SPECIES_TENTACOOL
- {0x46, 0x09}, // SPECIES_TENTACRUEL
- {0x87, 0x04}, // SPECIES_GEODUDE
- {0x54, 0x12}, // SPECIES_GRAVELER
- {0x87, 0x04}, // SPECIES_GOLEM
- {0x77, 0x05}, // SPECIES_PONYTA
- {0x66, 0x08}, // SPECIES_RAPIDASH
- {0x88, 0x01}, // SPECIES_SLOWPOKE
- {0x66, 0x0b}, // SPECIES_SLOWBRO
- {0x86, 0x08}, // SPECIES_MAGNEMITE
- {0x43, 0x15}, // SPECIES_MAGNETON
- {0x76, 0x08}, // SPECIES_FARFETCHD
- {0x66, 0x09}, // SPECIES_DODUO
- {0x57, 0x05}, // SPECIES_DODRIO
- {0x88, 0x00}, // SPECIES_SEEL
- {0x76, 0x0a}, // SPECIES_DEWGONG
- {0x87, 0x07}, // SPECIES_GRIMER
- {0x65, 0x0c}, // SPECIES_MUK
- {0x87, 0x04}, // SPECIES_SHELLDER
- {0x55, 0x10}, // SPECIES_CLOYSTER
- {0x87, 0x05}, // SPECIES_GASTLY
- {0x77, 0x06}, // SPECIES_HAUNTER
+ {0x86, 0x08}, // SPECIES_PARASECT
+ {0x66, 0x08}, // SPECIES_VENONAT
+ {0x88, 0x02}, // SPECIES_VENOMOTH
+ {0x54, 0x12}, // SPECIES_DIGLETT
+ {0x75, 0x0d}, // SPECIES_DUGTRIO
+ {0x55, 0x0c}, // SPECIES_MEOWTH
+ {0x77, 0x07}, // SPECIES_PERSIAN
+ {0x56, 0x09}, // SPECIES_PSYDUCK
+ {0x78, 0x02}, // SPECIES_GOLDUCK
+ {0x65, 0x0e}, // SPECIES_MANKEY
+ {0x77, 0x07}, // SPECIES_PRIMEAPE
+ {0x66, 0x0b}, // SPECIES_GROWLITHE
+ {0x88, 0x02}, // SPECIES_ARCANINE
+ {0x74, 0x13}, // SPECIES_POLIWAG
+ {0x76, 0x0a}, // SPECIES_POLIWHIRL
+ {0x76, 0x08}, // SPECIES_POLIWRATH
+ {0x66, 0x0b}, // SPECIES_ABRA
+ {0x77, 0x05}, // SPECIES_KADABRA
+ {0x87, 0x04}, // SPECIES_ALAKAZAM
+ {0x56, 0x0b}, // SPECIES_MACHOP
+ {0x67, 0x06}, // SPECIES_MACHOKE
+ {0x88, 0x01}, // SPECIES_MACHAMP
+ {0x65, 0x0f}, // SPECIES_BELLSPROUT
+ {0x66, 0x0b}, // SPECIES_WEEPINBELL
+ {0x77, 0x05}, // SPECIES_VICTREEBEL
+ {0x46, 0x09}, // SPECIES_TENTACOOL
+ {0x87, 0x04}, // SPECIES_TENTACRUEL
+ {0x54, 0x12}, // SPECIES_GEODUDE
+ {0x87, 0x04}, // SPECIES_GRAVELER
+ {0x77, 0x05}, // SPECIES_GOLEM
+ {0x66, 0x08}, // SPECIES_PONYTA
+ {0x88, 0x01}, // SPECIES_RAPIDASH
+ {0x66, 0x0b}, // SPECIES_SLOWPOKE
+ {0x86, 0x08}, // SPECIES_SLOWBRO
+ {0x43, 0x15}, // SPECIES_MAGNEMITE
+ {0x76, 0x08}, // SPECIES_MAGNETON
+ {0x66, 0x09}, // SPECIES_FARFETCHD
+ {0x57, 0x05}, // SPECIES_DODUO
+ {0x88, 0x00}, // SPECIES_DODRIO
+ {0x76, 0x0a}, // SPECIES_SEEL
+ {0x87, 0x07}, // SPECIES_DEWGONG
+ {0x65, 0x0c}, // SPECIES_GRIMER
+ {0x87, 0x04}, // SPECIES_MUK
+ {0x55, 0x10}, // SPECIES_SHELLDER
+ {0x87, 0x05}, // SPECIES_CLOYSTER
+ {0x77, 0x06}, // SPECIES_GASTLY
+ {0x77, 0x05}, // SPECIES_HAUNTER
{0x77, 0x05}, // SPECIES_GENGAR
- {0x77, 0x05}, // SPECIES_ONIX
- {0x78, 0x02}, // SPECIES_DROWZEE
- {0x77, 0x07}, // SPECIES_HYPNO
- {0x77, 0x04}, // SPECIES_KRABBY
- {0x65, 0x0d}, // SPECIES_KINGLER
- {0x88, 0x03}, // SPECIES_VOLTORB
- {0x44, 0x13}, // SPECIES_ELECTRODE
- {0x55, 0x0e}, // SPECIES_EXEGGCUTE
- {0x87, 0x07}, // SPECIES_EXEGGUTOR
- {0x88, 0x00}, // SPECIES_CUBONE
- {0x55, 0x0f}, // SPECIES_MAROWAK
- {0x76, 0x0b}, // SPECIES_HITMONLEE
- {0x87, 0x04}, // SPECIES_HITMONCHAN
- {0x67, 0x04}, // SPECIES_LICKITUNG
- {0x86, 0x08}, // SPECIES_KOFFING
- {0x66, 0x08}, // SPECIES_WEEZING
- {0x88, 0x02}, // SPECIES_RHYHORN
- {0x76, 0x09}, // SPECIES_RHYDON
- {0x88, 0x02}, // SPECIES_CHANSEY
- {0x76, 0x09}, // SPECIES_TANGELA
- {0x67, 0x07}, // SPECIES_KANGASKHAN
- {0x88, 0x00}, // SPECIES_HORSEA
- {0x45, 0x0f}, // SPECIES_SEADRA
- {0x67, 0x07}, // SPECIES_GOLDEEN
- {0x66, 0x0a}, // SPECIES_SEAKING
- {0x77, 0x04}, // SPECIES_STARYU
- {0x66, 0x0a}, // SPECIES_STARMIE
- {0x77, 0x06}, // SPECIES_MR_MIME
- {0x66, 0x08}, // SPECIES_SCYTHER
- {0x88, 0x00}, // SPECIES_JYNX
- {0x77, 0x04}, // SPECIES_ELECTABUZZ
- {0x78, 0x02}, // SPECIES_MAGMAR
+ {0x78, 0x02}, // SPECIES_ONIX
+ {0x77, 0x07}, // SPECIES_DROWZEE
+ {0x77, 0x04}, // SPECIES_HYPNO
+ {0x65, 0x0d}, // SPECIES_KRABBY
+ {0x88, 0x03}, // SPECIES_KINGLER
+ {0x44, 0x13}, // SPECIES_VOLTORB
+ {0x55, 0x0e}, // SPECIES_ELECTRODE
+ {0x87, 0x07}, // SPECIES_EXEGGCUTE
+ {0x88, 0x00}, // SPECIES_EXEGGUTOR
+ {0x55, 0x0f}, // SPECIES_CUBONE
+ {0x76, 0x0b}, // SPECIES_MAROWAK
+ {0x87, 0x04}, // SPECIES_HITMONLEE
+ {0x67, 0x04}, // SPECIES_HITMONCHAN
+ {0x86, 0x08}, // SPECIES_LICKITUNG
+ {0x66, 0x08}, // SPECIES_KOFFING
+ {0x88, 0x02}, // SPECIES_WEEZING
+ {0x76, 0x09}, // SPECIES_RHYHORN
+ {0x88, 0x02}, // SPECIES_RHYDON
+ {0x76, 0x09}, // SPECIES_CHANSEY
+ {0x67, 0x07}, // SPECIES_TANGELA
+ {0x88, 0x00}, // SPECIES_KANGASKHAN
+ {0x45, 0x0f}, // SPECIES_HORSEA
+ {0x67, 0x07}, // SPECIES_SEADRA
+ {0x66, 0x0a}, // SPECIES_GOLDEEN
+ {0x77, 0x04}, // SPECIES_SEAKING
+ {0x66, 0x0a}, // SPECIES_STARYU
+ {0x77, 0x06}, // SPECIES_STARMIE
+ {0x66, 0x08}, // SPECIES_MR_MIME
+ {0x88, 0x00}, // SPECIES_SCYTHER
+ {0x77, 0x04}, // SPECIES_JYNX
+ {0x78, 0x02}, // SPECIES_ELECTABUZZ
+ {0x77, 0x04}, // SPECIES_MAGMAR
{0x77, 0x04}, // SPECIES_PINSIR
- {0x77, 0x04}, // SPECIES_TAUROS
- {0x78, 0x00}, // SPECIES_MAGIKARP
- {0x67, 0x06}, // SPECIES_GYARADOS
- {0x88, 0x08}, // SPECIES_LAPRAS
- {0x85, 0x0d}, // SPECIES_DITTO
- {0x54, 0x11}, // SPECIES_EEVEE
- {0x56, 0x09}, // SPECIES_VAPOREON
- {0x67, 0x06}, // SPECIES_JOLTEON
- {0x76, 0x09}, // SPECIES_FLAREON
- {0x66, 0x0a}, // SPECIES_PORYGON
- {0x55, 0x0d}, // SPECIES_OMANYTE
- {0x45, 0x0f}, // SPECIES_OMASTAR
- {0x67, 0x07}, // SPECIES_KABUTO
- {0x54, 0x11}, // SPECIES_KABUTOPS
- {0x88, 0x03}, // SPECIES_AERODACTYL
- {0x88, 0x01}, // SPECIES_SNORLAX
- {0x87, 0x05}, // SPECIES_ARTICUNO
- {0x88, 0x03}, // SPECIES_ZAPDOS
- {0x87, 0x04}, // SPECIES_MOLTRES
- {0x88, 0x00}, // SPECIES_DRATINI
- {0x75, 0x0e}, // SPECIES_DRAGONAIR
- {0x87, 0x06}, // SPECIES_DRAGONITE
+ {0x78, 0x00}, // SPECIES_TAUROS
+ {0x67, 0x06}, // SPECIES_MAGIKARP
+ {0x88, 0x08}, // SPECIES_GYARADOS
+ {0x85, 0x0d}, // SPECIES_LAPRAS
+ {0x54, 0x11}, // SPECIES_DITTO
+ {0x56, 0x09}, // SPECIES_EEVEE
+ {0x67, 0x06}, // SPECIES_VAPOREON
+ {0x76, 0x09}, // SPECIES_JOLTEON
+ {0x66, 0x0a}, // SPECIES_FLAREON
+ {0x55, 0x0d}, // SPECIES_PORYGON
+ {0x45, 0x0f}, // SPECIES_OMANYTE
+ {0x67, 0x07}, // SPECIES_OMASTAR
+ {0x54, 0x11}, // SPECIES_KABUTO
+ {0x88, 0x03}, // SPECIES_KABUTOPS
+ {0x88, 0x01}, // SPECIES_AERODACTYL
+ {0x87, 0x05}, // SPECIES_SNORLAX
+ {0x88, 0x03}, // SPECIES_ARTICUNO
+ {0x87, 0x04}, // SPECIES_ZAPDOS
+ {0x88, 0x00}, // SPECIES_MOLTRES
+ {0x75, 0x0e}, // SPECIES_DRATINI
+ {0x87, 0x06}, // SPECIES_DRAGONAIR
+ {0x88, 0x00}, // SPECIES_DRAGONITE
{0x88, 0x00}, // SPECIES_MEWTWO
- {0x88, 0x00}, // SPECIES_MEW
- {0x55, 0x0d}, // SPECIES_CHIKORITA
- {0x75, 0x0d}, // SPECIES_BAYLEEF
- {0x77, 0x04}, // SPECIES_MEGANIUM
- {0x88, 0x00}, // SPECIES_CYNDAQUIL
- {0x55, 0x0e}, // SPECIES_QUILAVA
- {0x76, 0x08}, // SPECIES_TYPHLOSION
- {0x78, 0x00}, // SPECIES_TOTODILE
- {0x55, 0x0f}, // SPECIES_CROCONAW
- {0x67, 0x06}, // SPECIES_FERALIGATR
- {0x88, 0x00}, // SPECIES_SENTRET
- {0x47, 0x04}, // SPECIES_FURRET
- {0x67, 0x07}, // SPECIES_HOOTHOOT
- {0x55, 0x0d}, // SPECIES_NOCTOWL
- {0x58, 0x03}, // SPECIES_LEDYBA
- {0x56, 0x0c}, // SPECIES_LEDIAN
- {0x67, 0x04}, // SPECIES_SPINARAK
- {0x54, 0x13}, // SPECIES_ARIADOS
- {0x87, 0x05}, // SPECIES_CROBAT
- {0x88, 0x00}, // SPECIES_CHINCHOU
- {0x75, 0x10}, // SPECIES_LANTURN
- {0x87, 0x0b}, // SPECIES_PICHU
- {0x45, 0x0c}, // SPECIES_CLEFFA
- {0x44, 0x14}, // SPECIES_IGGLYBUFF
- {0x44, 0x12}, // SPECIES_TOGEPI
- {0x34, 0x14}, // SPECIES_TOGETIC
- {0x46, 0x09}, // SPECIES_NATU
- {0x44, 0x14}, // SPECIES_XATU
- {0x47, 0x07}, // SPECIES_MAREEP
- {0x55, 0x10}, // SPECIES_FLAAFFY
- {0x56, 0x0a}, // SPECIES_AMPHAROS
- {0x77, 0x05}, // SPECIES_BELLOSSOM
- {0x45, 0x0e}, // SPECIES_MARILL
- {0x65, 0x0e}, // SPECIES_AZUMARILL
- {0x76, 0x09}, // SPECIES_SUDOWOODO
+ {0x55, 0x0d}, // SPECIES_MEW
+ {0x75, 0x0d}, // SPECIES_CHIKORITA
+ {0x77, 0x04}, // SPECIES_BAYLEEF
+ {0x88, 0x00}, // SPECIES_MEGANIUM
+ {0x55, 0x0e}, // SPECIES_CYNDAQUIL
+ {0x76, 0x08}, // SPECIES_QUILAVA
+ {0x78, 0x00}, // SPECIES_TYPHLOSION
+ {0x55, 0x0f}, // SPECIES_TOTODILE
+ {0x67, 0x06}, // SPECIES_CROCONAW
+ {0x88, 0x00}, // SPECIES_FERALIGATR
+ {0x47, 0x04}, // SPECIES_SENTRET
+ {0x67, 0x07}, // SPECIES_FURRET
+ {0x55, 0x0d}, // SPECIES_HOOTHOOT
+ {0x58, 0x03}, // SPECIES_NOCTOWL
+ {0x56, 0x0c}, // SPECIES_LEDYBA
+ {0x67, 0x04}, // SPECIES_LEDIAN
+ {0x54, 0x13}, // SPECIES_SPINARAK
+ {0x87, 0x05}, // SPECIES_ARIADOS
+ {0x88, 0x00}, // SPECIES_CROBAT
+ {0x75, 0x10}, // SPECIES_CHINCHOU
+ {0x87, 0x0b}, // SPECIES_LANTURN
+ {0x45, 0x0c}, // SPECIES_PICHU
+ {0x44, 0x14}, // SPECIES_CLEFFA
+ {0x44, 0x12}, // SPECIES_IGGLYBUFF
+ {0x34, 0x14}, // SPECIES_TOGEPI
+ {0x46, 0x09}, // SPECIES_TOGETIC
+ {0x44, 0x14}, // SPECIES_NATU
+ {0x47, 0x07}, // SPECIES_XATU
+ {0x55, 0x10}, // SPECIES_MAREEP
+ {0x56, 0x0a}, // SPECIES_FLAAFFY
+ {0x77, 0x05}, // SPECIES_AMPHAROS
+ {0x45, 0x0e}, // SPECIES_BELLOSSOM
+ {0x65, 0x0e}, // SPECIES_MARILL
+ {0x76, 0x09}, // SPECIES_AZUMARILL
+ {0x67, 0x06}, // SPECIES_SUDOWOODO
{0x67, 0x06}, // SPECIES_POLITOED
- {0x67, 0x06}, // SPECIES_HOPPIP
- {0x66, 0x0a}, // SPECIES_SKIPLOOM
- {0x55, 0x0f}, // SPECIES_JUMPLUFF
- {0x77, 0x07}, // SPECIES_AIPOM
- {0x58, 0x03}, // SPECIES_SUNKERN
- {0x44, 0x10}, // SPECIES_SUNFLORA
- {0x56, 0x08}, // SPECIES_YANMA
- {0x86, 0x0a}, // SPECIES_WOOPER
- {0x54, 0x10}, // SPECIES_QUAGSIRE
- {0x77, 0x07}, // SPECIES_ESPEON
- {0x66, 0x08}, // SPECIES_UMBREON
- {0x67, 0x08}, // SPECIES_MURKROW
- {0x66, 0x0b}, // SPECIES_SLOWKING
- {0x58, 0x01}, // SPECIES_MISDREAVUS
- {0x55, 0x0c}, // SPECIES_UNOWN
- {0x35, 0x0f}, // SPECIES_WOBBUFFET
- {0x77, 0x06}, // SPECIES_GIRAFARIG
- {0x88, 0x03}, // SPECIES_PINECO
- {0x56, 0x0a}, // SPECIES_FORRETRESS
- {0x76, 0x09}, // SPECIES_DUNSPARCE
- {0x74, 0x11}, // SPECIES_GLIGAR
- {0x78, 0x03}, // SPECIES_STEELIX
- {0x88, 0x00}, // SPECIES_SNUBBULL
- {0x55, 0x0d}, // SPECIES_GRANBULL
- {0x57, 0x06}, // SPECIES_QWILFISH
- {0x56, 0x0a}, // SPECIES_SCIZOR
- {0x88, 0x00}, // SPECIES_SHUCKLE
- {0x66, 0x09}, // SPECIES_HERACROSS
- {0x88, 0x03}, // SPECIES_SNEASEL
- {0x67, 0x05}, // SPECIES_TEDDIURSA
- {0x45, 0x0d}, // SPECIES_URSARING
- {0x78, 0x01}, // SPECIES_SLUGMA
- {0x45, 0x0d}, // SPECIES_MAGCARGO
- {0x57, 0x0d}, // SPECIES_SWINUB
- {0x43, 0x14}, // SPECIES_PILOSWINE
- {0x66, 0x08}, // SPECIES_CORSOLA
- {0x65, 0x0c}, // SPECIES_REMORAID
- {0x55, 0x0e}, // SPECIES_OCTILLERY
- {0x66, 0x0a}, // SPECIES_DELIBIRD
- {0x56, 0x08}, // SPECIES_MANTINE
- {0x88, 0x01}, // SPECIES_SKARMORY
- {0x88, 0x00}, // SPECIES_HOUNDOUR
- {0x56, 0x0b}, // SPECIES_HOUNDOOM
- {0x77, 0x05}, // SPECIES_KINGDRA
- {0x78, 0x04}, // SPECIES_PHANPY
- {0x54, 0x10}, // SPECIES_DONPHAN
- {0x86, 0x08}, // SPECIES_PORYGON2
- {0x55, 0x0f}, // SPECIES_STANTLER
- {0x88, 0x00}, // SPECIES_SMEARGLE
- {0x77, 0x06}, // SPECIES_TYROGUE
- {0x46, 0x09}, // SPECIES_HITMONTOP
- {0x67, 0x05}, // SPECIES_SMOOCHUM
- {0x35, 0x0f}, // SPECIES_ELEKID
- {0x76, 0x0a}, // SPECIES_MAGBY
- {0x45, 0x0d}, // SPECIES_MILTANK
- {0x77, 0x04}, // SPECIES_BLISSEY
- {0x77, 0x06}, // SPECIES_RAIKOU
+ {0x66, 0x0a}, // SPECIES_HOPPIP
+ {0x55, 0x0f}, // SPECIES_SKIPLOOM
+ {0x77, 0x07}, // SPECIES_JUMPLUFF
+ {0x58, 0x03}, // SPECIES_AIPOM
+ {0x44, 0x10}, // SPECIES_SUNKERN
+ {0x56, 0x08}, // SPECIES_SUNFLORA
+ {0x86, 0x0a}, // SPECIES_YANMA
+ {0x54, 0x10}, // SPECIES_WOOPER
+ {0x77, 0x07}, // SPECIES_QUAGSIRE
+ {0x66, 0x08}, // SPECIES_ESPEON
+ {0x67, 0x08}, // SPECIES_UMBREON
+ {0x66, 0x0b}, // SPECIES_MURKROW
+ {0x58, 0x01}, // SPECIES_SLOWKING
+ {0x55, 0x0c}, // SPECIES_MISDREAVUS
+ {0x35, 0x0f}, // SPECIES_UNOWN
+ {0x77, 0x06}, // SPECIES_WOBBUFFET
+ {0x88, 0x03}, // SPECIES_GIRAFARIG
+ {0x56, 0x0a}, // SPECIES_PINECO
+ {0x76, 0x09}, // SPECIES_FORRETRESS
+ {0x74, 0x11}, // SPECIES_DUNSPARCE
+ {0x78, 0x03}, // SPECIES_GLIGAR
+ {0x88, 0x00}, // SPECIES_STEELIX
+ {0x55, 0x0d}, // SPECIES_SNUBBULL
+ {0x57, 0x06}, // SPECIES_GRANBULL
+ {0x56, 0x0a}, // SPECIES_QWILFISH
+ {0x88, 0x00}, // SPECIES_SCIZOR
+ {0x66, 0x09}, // SPECIES_SHUCKLE
+ {0x88, 0x03}, // SPECIES_HERACROSS
+ {0x67, 0x05}, // SPECIES_SNEASEL
+ {0x45, 0x0d}, // SPECIES_TEDDIURSA
+ {0x78, 0x01}, // SPECIES_URSARING
+ {0x45, 0x0d}, // SPECIES_SLUGMA
+ {0x57, 0x0d}, // SPECIES_MAGCARGO
+ {0x43, 0x14}, // SPECIES_SWINUB
+ {0x66, 0x08}, // SPECIES_PILOSWINE
+ {0x65, 0x0c}, // SPECIES_CORSOLA
+ {0x55, 0x0e}, // SPECIES_REMORAID
+ {0x66, 0x0a}, // SPECIES_OCTILLERY
+ {0x56, 0x08}, // SPECIES_DELIBIRD
+ {0x88, 0x01}, // SPECIES_MANTINE
+ {0x88, 0x00}, // SPECIES_SKARMORY
+ {0x56, 0x0b}, // SPECIES_HOUNDOUR
+ {0x77, 0x05}, // SPECIES_HOUNDOOM
+ {0x78, 0x04}, // SPECIES_KINGDRA
+ {0x54, 0x10}, // SPECIES_PHANPY
+ {0x86, 0x08}, // SPECIES_DONPHAN
+ {0x55, 0x0f}, // SPECIES_PORYGON2
+ {0x88, 0x00}, // SPECIES_STANTLER
+ {0x77, 0x06}, // SPECIES_SMEARGLE
+ {0x46, 0x09}, // SPECIES_TYROGUE
+ {0x67, 0x05}, // SPECIES_HITMONTOP
+ {0x35, 0x0f}, // SPECIES_SMOOCHUM
+ {0x76, 0x0a}, // SPECIES_ELEKID
+ {0x45, 0x0d}, // SPECIES_MAGBY
+ {0x77, 0x04}, // SPECIES_MILTANK
+ {0x77, 0x06}, // SPECIES_BLISSEY
+ {0x88, 0x00}, // SPECIES_RAIKOU
{0x88, 0x00}, // SPECIES_ENTEI
{0x88, 0x00}, // SPECIES_SUICUNE
- {0x88, 0x00}, // SPECIES_LARVITAR
- {0x46, 0x09}, // SPECIES_PUPITAR
- {0x56, 0x09}, // SPECIES_TYRANITAR
+ {0x46, 0x09}, // SPECIES_LARVITAR
+ {0x56, 0x09}, // SPECIES_PUPITAR
+ {0x88, 0x00}, // SPECIES_TYRANITAR
{0x88, 0x00}, // SPECIES_LUGIA
{0x88, 0x00}, // SPECIES_HO_OH
- {0x88, 0x00}, // SPECIES_CELEBI
- {0x55, 0x0e}, // SPECIES_OLD_UNOWN_B
+ {0x55, 0x0e}, // SPECIES_CELEBI
+ {0x87, 0x04}, // SPECIES_OLD_UNOWN_B
{0x87, 0x04}, // SPECIES_OLD_UNOWN_C
{0x87, 0x04}, // SPECIES_OLD_UNOWN_D
{0x87, 0x04}, // SPECIES_OLD_UNOWN_E
@@ -276,168 +277,167 @@ const struct MonCoords gMonFrontPicCoords[] =
{0x87, 0x04}, // SPECIES_OLD_UNOWN_X
{0x87, 0x04}, // SPECIES_OLD_UNOWN_Y
{0x87, 0x04}, // SPECIES_OLD_UNOWN_Z
- {0x87, 0x04}, // SPECIES_TREECKO
- {0x66, 0x08}, // SPECIES_GROVYLE
- {0x87, 0x04}, // SPECIES_SCEPTILE
- {0x88, 0x00}, // SPECIES_TORCHIC
- {0x56, 0x08}, // SPECIES_COMBUSKEN
- {0x88, 0x01}, // SPECIES_BLAZIKEN
- {0x88, 0x00}, // SPECIES_MUDKIP
- {0x56, 0x0c}, // SPECIES_MARSHTOMP
- {0x67, 0x06}, // SPECIES_SWAMPERT
- {0x88, 0x00}, // SPECIES_POOCHYENA
- {0x55, 0x0c}, // SPECIES_MIGHTYENA
- {0x87, 0x04}, // SPECIES_ZIGZAGOON
- {0x85, 0x0f}, // SPECIES_LINOONE
- {0x78, 0x03}, // SPECIES_WURMPLE
- {0x45, 0x0e}, // SPECIES_SILCOON
- {0x75, 0x11}, // SPECIES_BEAUTIFLY
- {0x86, 0x09}, // SPECIES_CASCOON
- {0x74, 0x10}, // SPECIES_DUSTOX
- {0x86, 0x0f}, // SPECIES_LOTAD
- {0x65, 0x0e}, // SPECIES_LOMBRE
- {0x66, 0x09}, // SPECIES_LUDICOLO
- {0x88, 0x00}, // SPECIES_SEEDOT
- {0x46, 0x10}, // SPECIES_NUZLEAF
- {0x56, 0x08}, // SPECIES_SHIFTRY
- {0x88, 0x02}, // SPECIES_NINCADA
- {0x74, 0x12}, // SPECIES_NINJASK
- {0x86, 0x0a}, // SPECIES_SHEDINJA
- {0x66, 0x0a}, // SPECIES_TAILLOW
- {0x64, 0x10}, // SPECIES_SWELLOW
- {0x87, 0x06}, // SPECIES_SHROOMISH
- {0x54, 0x10}, // SPECIES_BRELOOM
- {0x77, 0x04}, // SPECIES_SPINDA
- {0x68, 0x08}, // SPECIES_WINGULL
- {0x84, 0x18}, // SPECIES_PELIPPER
- {0x77, 0x04}, // SPECIES_SURSKIT
- {0x65, 0x0f}, // SPECIES_MASQUERAIN
- {0x88, 0x01}, // SPECIES_WAILMER
- {0x75, 0x0f}, // SPECIES_WAILORD
- {0x87, 0x0a}, // SPECIES_SKITTY
- {0x66, 0x0b}, // SPECIES_DELCATTY
- {0x66, 0x08}, // SPECIES_KECLEON
- {0x67, 0x07}, // SPECIES_BALTOY
- {0x55, 0x10}, // SPECIES_CLAYDOL
- {0x78, 0x06}, // SPECIES_NOSEPASS
- {0x56, 0x0c}, // SPECIES_TORKOAL
- {0x88, 0x02}, // SPECIES_SABLEYE
- {0x66, 0x09}, // SPECIES_BARBOACH
- {0x46, 0x0b}, // SPECIES_WHISCASH
- {0x76, 0x09}, // SPECIES_LUVDISC
- {0x46, 0x18}, // SPECIES_CORPHISH
- {0x66, 0x0c}, // SPECIES_CRAWDAUNT
- {0x88, 0x01}, // SPECIES_FEEBAS
- {0x46, 0x0d}, // SPECIES_MILOTIC
- {0x88, 0x00}, // SPECIES_CARVANHA
- {0x67, 0x06}, // SPECIES_SHARPEDO
- {0x78, 0x03}, // SPECIES_TRAPINCH
- {0x54, 0x10}, // SPECIES_VIBRAVA
- {0x86, 0x0c}, // SPECIES_FLYGON
- {0x88, 0x01}, // SPECIES_MAKUHITA
- {0x65, 0x0c}, // SPECIES_HARIYAMA
- {0x88, 0x01}, // SPECIES_ELECTRIKE
- {0x64, 0x12}, // SPECIES_MANECTRIC
- {0x67, 0x04}, // SPECIES_NUMEL
- {0x65, 0x0f}, // SPECIES_CAMERUPT
- {0x87, 0x09}, // SPECIES_SPHEAL
- {0x65, 0x10}, // SPECIES_SEALEO
- {0x86, 0x0a}, // SPECIES_WALREIN
- {0x88, 0x01}, // SPECIES_CACNEA
- {0x74, 0x10}, // SPECIES_CACTURNE
- {0x88, 0x00}, // SPECIES_SNORUNT
- {0x56, 0x0b}, // SPECIES_GLALIE
- {0x76, 0x0a}, // SPECIES_LUNATONE
- {0x66, 0x09}, // SPECIES_SOLROCK
- {0x88, 0x01}, // SPECIES_AZURILL
- {0x55, 0x0f}, // SPECIES_SPOINK
- {0x46, 0x09}, // SPECIES_GRUMPIG
- {0x77, 0x05}, // SPECIES_PLUSLE
- {0x56, 0x0e}, // SPECIES_MINUN
- {0x66, 0x0c}, // SPECIES_MAWILE
- {0x76, 0x08}, // SPECIES_MEDITITE
- {0x65, 0x0c}, // SPECIES_MEDICHAM
- {0x68, 0x01}, // SPECIES_SWABLU
- {0x76, 0x11}, // SPECIES_ALTARIA
- {0x88, 0x02}, // SPECIES_WYNAUT
- {0x55, 0x0c}, // SPECIES_DUSKULL
- {0x66, 0x0a}, // SPECIES_DUSCLOPS
- {0x77, 0x05}, // SPECIES_ROSELIA
- {0x76, 0x08}, // SPECIES_SLAKOTH
- {0x74, 0x12}, // SPECIES_VIGOROTH
- {0x78, 0x00}, // SPECIES_SLAKING
- {0x86, 0x08}, // SPECIES_GULPIN
- {0x55, 0x12}, // SPECIES_SWALOT
- {0x66, 0x08}, // SPECIES_TROPIUS
- {0x88, 0x00}, // SPECIES_WHISMUR
- {0x55, 0x0e}, // SPECIES_LOUDRED
- {0x78, 0x03}, // SPECIES_EXPLOUD
- {0x88, 0x01}, // SPECIES_CLAMPERL
- {0x55, 0x0e}, // SPECIES_HUNTAIL
- {0x78, 0x03}, // SPECIES_GOREBYSS
- {0x86, 0x0b}, // SPECIES_ABSOL
- {0x68, 0x00}, // SPECIES_SHUPPET
- {0x56, 0x0e}, // SPECIES_BANETTE
- {0x55, 0x0c}, // SPECIES_SEVIPER
- {0x77, 0x08}, // SPECIES_ZANGOOSE
- {0x87, 0x05}, // SPECIES_RELICANTH
- {0x77, 0x0b}, // SPECIES_ARON
- {0x43, 0x14}, // SPECIES_LAIRON
- {0x75, 0x0d}, // SPECIES_AGGRON
- {0x88, 0x00}, // SPECIES_CASTFORM
- {0x34, 0x11}, // SPECIES_VOLBEAT
- {0x66, 0x08}, // SPECIES_ILLUMISE
- {0x56, 0x08}, // SPECIES_LILEEP
- {0x67, 0x07}, // SPECIES_CRADILY
- {0x78, 0x00}, // SPECIES_ANORITH
- {0x66, 0x08}, // SPECIES_ARMALDO
- {0x88, 0x00}, // SPECIES_RALTS
- {0x35, 0x0f}, // SPECIES_KIRLIA
- {0x47, 0x06}, // SPECIES_GARDEVOIR
- {0x78, 0x01}, // SPECIES_BAGON
- {0x56, 0x0b}, // SPECIES_SHELGON
- {0x66, 0x09}, // SPECIES_SALAMENCE
- {0x87, 0x04}, // SPECIES_BELDUM
- {0x55, 0x0f}, // SPECIES_METANG
- {0x87, 0x07}, // SPECIES_METAGROSS
- {0x87, 0x06}, // SPECIES_REGIROCK
- {0x78, 0x04}, // SPECIES_REGICE
- {0x88, 0x02}, // SPECIES_REGISTEEL
- {0x88, 0x03}, // SPECIES_KYOGRE
- {0x87, 0x04}, // SPECIES_GROUDON
- {0x88, 0x01}, // SPECIES_RAYQUAZA
- {0x88, 0x00}, // SPECIES_LATIAS
- {0x88, 0x01}, // SPECIES_LATIOS
- {0x88, 0x02}, // SPECIES_JIRACHI
- {0x66, 0x0d}, // SPECIES_DEOXYS
- {0x88, 0x01}, // SPECIES_CHIMECHO
- {0x37, 0x06}, // SPECIES_EGG
- {0x33, 0x14}, // SPECIES_UNOWN_B
- {0x34, 0x10}, // SPECIES_UNOWN_C
+ {0x66, 0x08}, // SPECIES_TREECKO
+ {0x87, 0x04}, // SPECIES_GROVYLE
+ {0x88, 0x00}, // SPECIES_SCEPTILE
+ {0x56, 0x08}, // SPECIES_TORCHIC
+ {0x88, 0x01}, // SPECIES_COMBUSKEN
+ {0x88, 0x00}, // SPECIES_BLAZIKEN
+ {0x56, 0x0c}, // SPECIES_MUDKIP
+ {0x67, 0x06}, // SPECIES_MARSHTOMP
+ {0x88, 0x00}, // SPECIES_SWAMPERT
+ {0x55, 0x0c}, // SPECIES_POOCHYENA
+ {0x87, 0x04}, // SPECIES_MIGHTYENA
+ {0x85, 0x0f}, // SPECIES_ZIGZAGOON
+ {0x78, 0x03}, // SPECIES_LINOONE
+ {0x45, 0x0e}, // SPECIES_WURMPLE
+ {0x75, 0x11}, // SPECIES_SILCOON
+ {0x86, 0x09}, // SPECIES_BEAUTIFLY
+ {0x74, 0x10}, // SPECIES_CASCOON
+ {0x86, 0x0f}, // SPECIES_DUSTOX
+ {0x65, 0x0e}, // SPECIES_LOTAD
+ {0x66, 0x09}, // SPECIES_LOMBRE
+ {0x88, 0x00}, // SPECIES_LUDICOLO
+ {0x46, 0x10}, // SPECIES_SEEDOT
+ {0x56, 0x08}, // SPECIES_NUZLEAF
+ {0x88, 0x02}, // SPECIES_SHIFTRY
+ {0x74, 0x12}, // SPECIES_NINCADA
+ {0x86, 0x0a}, // SPECIES_NINJASK
+ {0x66, 0x0a}, // SPECIES_SHEDINJA
+ {0x64, 0x10}, // SPECIES_TAILLOW
+ {0x87, 0x06}, // SPECIES_SWELLOW
+ {0x54, 0x10}, // SPECIES_SHROOMISH
+ {0x77, 0x04}, // SPECIES_BRELOOM
+ {0x68, 0x08}, // SPECIES_SPINDA
+ {0x84, 0x18}, // SPECIES_WINGULL
+ {0x77, 0x04}, // SPECIES_PELIPPER
+ {0x65, 0x0f}, // SPECIES_SURSKIT
+ {0x88, 0x01}, // SPECIES_MASQUERAIN
+ {0x75, 0x0f}, // SPECIES_WAILMER
+ {0x87, 0x0a}, // SPECIES_WAILORD
+ {0x66, 0x0b}, // SPECIES_SKITTY
+ {0x66, 0x08}, // SPECIES_DELCATTY
+ {0x67, 0x07}, // SPECIES_KECLEON
+ {0x55, 0x10}, // SPECIES_BALTOY
+ {0x78, 0x06}, // SPECIES_CLAYDOL
+ {0x56, 0x0c}, // SPECIES_NOSEPASS
+ {0x88, 0x02}, // SPECIES_TORKOAL
+ {0x66, 0x09}, // SPECIES_SABLEYE
+ {0x46, 0x0b}, // SPECIES_BARBOACH
+ {0x76, 0x09}, // SPECIES_WHISCASH
+ {0x46, 0x18}, // SPECIES_LUVDISC
+ {0x66, 0x0c}, // SPECIES_CORPHISH
+ {0x88, 0x01}, // SPECIES_CRAWDAUNT
+ {0x46, 0x0d}, // SPECIES_FEEBAS
+ {0x88, 0x00}, // SPECIES_MILOTIC
+ {0x67, 0x06}, // SPECIES_CARVANHA
+ {0x78, 0x03}, // SPECIES_SHARPEDO
+ {0x54, 0x10}, // SPECIES_TRAPINCH
+ {0x86, 0x0c}, // SPECIES_VIBRAVA
+ {0x88, 0x01}, // SPECIES_FLYGON
+ {0x65, 0x0c}, // SPECIES_MAKUHITA
+ {0x88, 0x01}, // SPECIES_HARIYAMA
+ {0x64, 0x12}, // SPECIES_ELECTRIKE
+ {0x67, 0x04}, // SPECIES_MANECTRIC
+ {0x65, 0x0f}, // SPECIES_NUMEL
+ {0x87, 0x09}, // SPECIES_CAMERUPT
+ {0x65, 0x10}, // SPECIES_SPHEAL
+ {0x86, 0x0a}, // SPECIES_SEALEO
+ {0x88, 0x01}, // SPECIES_WALREIN
+ {0x74, 0x10}, // SPECIES_CACNEA
+ {0x88, 0x00}, // SPECIES_CACTURNE
+ {0x56, 0x0b}, // SPECIES_SNORUNT
+ {0x76, 0x0a}, // SPECIES_GLALIE
+ {0x66, 0x09}, // SPECIES_LUNATONE
+ {0x88, 0x01}, // SPECIES_SOLROCK
+ {0x55, 0x0f}, // SPECIES_AZURILL
+ {0x46, 0x09}, // SPECIES_SPOINK
+ {0x77, 0x05}, // SPECIES_GRUMPIG
+ {0x56, 0x0e}, // SPECIES_PLUSLE
+ {0x66, 0x0c}, // SPECIES_MINUN
+ {0x76, 0x08}, // SPECIES_MAWILE
+ {0x65, 0x0c}, // SPECIES_MEDITITE
+ {0x68, 0x01}, // SPECIES_MEDICHAM
+ {0x76, 0x11}, // SPECIES_SWABLU
+ {0x88, 0x02}, // SPECIES_ALTARIA
+ {0x55, 0x0c}, // SPECIES_WYNAUT
+ {0x66, 0x0a}, // SPECIES_DUSKULL
+ {0x77, 0x05}, // SPECIES_DUSCLOPS
+ {0x76, 0x08}, // SPECIES_ROSELIA
+ {0x74, 0x12}, // SPECIES_SLAKOTH
+ {0x78, 0x00}, // SPECIES_VIGOROTH
+ {0x86, 0x08}, // SPECIES_SLAKING
+ {0x55, 0x12}, // SPECIES_GULPIN
+ {0x66, 0x08}, // SPECIES_SWALOT
+ {0x88, 0x00}, // SPECIES_TROPIUS
+ {0x55, 0x0e}, // SPECIES_WHISMUR
+ {0x78, 0x03}, // SPECIES_LOUDRED
+ {0x88, 0x01}, // SPECIES_EXPLOUD
+ {0x55, 0x0e}, // SPECIES_CLAMPERL
+ {0x78, 0x03}, // SPECIES_HUNTAIL
+ {0x86, 0x0b}, // SPECIES_GOREBYSS
+ {0x68, 0x00}, // SPECIES_ABSOL
+ {0x56, 0x0e}, // SPECIES_SHUPPET
+ {0x55, 0x0c}, // SPECIES_BANETTE
+ {0x77, 0x08}, // SPECIES_SEVIPER
+ {0x87, 0x05}, // SPECIES_ZANGOOSE
+ {0x77, 0x0b}, // SPECIES_RELICANTH
+ {0x43, 0x14}, // SPECIES_ARON
+ {0x75, 0x0d}, // SPECIES_LAIRON
+ {0x88, 0x00}, // SPECIES_AGGRON
+ {0x34, 0x11}, // SPECIES_CASTFORM
+ {0x66, 0x08}, // SPECIES_VOLBEAT
+ {0x56, 0x08}, // SPECIES_ILLUMISE
+ {0x67, 0x07}, // SPECIES_LILEEP
+ {0x78, 0x00}, // SPECIES_CRADILY
+ {0x66, 0x08}, // SPECIES_ANORITH
+ {0x88, 0x00}, // SPECIES_ARMALDO
+ {0x35, 0x0f}, // SPECIES_RALTS
+ {0x47, 0x06}, // SPECIES_KIRLIA
+ {0x78, 0x01}, // SPECIES_GARDEVOIR
+ {0x56, 0x0b}, // SPECIES_BAGON
+ {0x66, 0x09}, // SPECIES_SHELGON
+ {0x87, 0x04}, // SPECIES_SALAMENCE
+ {0x55, 0x0f}, // SPECIES_BELDUM
+ {0x87, 0x07}, // SPECIES_METANG
+ {0x87, 0x06}, // SPECIES_METAGROSS
+ {0x78, 0x04}, // SPECIES_REGIROCK
+ {0x88, 0x02}, // SPECIES_REGICE
+ {0x88, 0x03}, // SPECIES_REGISTEEL
+ {0x87, 0x04}, // SPECIES_KYOGRE
+ {0x88, 0x01}, // SPECIES_GROUDON
+ {0x88, 0x00}, // SPECIES_RAYQUAZA
+ {0x88, 0x01}, // SPECIES_LATIAS
+ {0x88, 0x02}, // SPECIES_LATIOS
+ {0x66, 0x0d}, // SPECIES_JIRACHI
+ {0x88, 0x01}, // SPECIES_DEOXYS
+ {0x37, 0x06}, // SPECIES_CHIMECHO
+ {0x33, 0x14}, // SPECIES_EGG
+ {0x34, 0x10}, // SPECIES_UNOWN_B
+ {0x44, 0x10}, // SPECIES_UNOWN_C
{0x44, 0x10}, // SPECIES_UNOWN_D
- {0x44, 0x10}, // SPECIES_UNOWN_E
+ {0x44, 0x11}, // SPECIES_UNOWN_E
{0x44, 0x11}, // SPECIES_UNOWN_F
- {0x44, 0x11}, // SPECIES_UNOWN_G
- {0x35, 0x0e}, // SPECIES_UNOWN_H
- {0x44, 0x10}, // SPECIES_UNOWN_I
- {0x34, 0x10}, // SPECIES_UNOWN_J
- {0x34, 0x11}, // SPECIES_UNOWN_K
- {0x44, 0x11}, // SPECIES_UNOWN_L
- {0x34, 0x13}, // SPECIES_UNOWN_M
- {0x44, 0x13}, // SPECIES_UNOWN_N
- {0x43, 0x14}, // SPECIES_UNOWN_O
- {0x44, 0x10}, // SPECIES_UNOWN_P
- {0x34, 0x13}, // SPECIES_UNOWN_Q
- {0x43, 0x15}, // SPECIES_UNOWN_R
- {0x34, 0x13}, // SPECIES_UNOWN_S
- {0x45, 0x0c}, // SPECIES_UNOWN_T
- {0x34, 0x12}, // SPECIES_UNOWN_U
+ {0x35, 0x0e}, // SPECIES_UNOWN_G
+ {0x44, 0x10}, // SPECIES_UNOWN_H
+ {0x34, 0x10}, // SPECIES_UNOWN_I
+ {0x34, 0x11}, // SPECIES_UNOWN_J
+ {0x44, 0x11}, // SPECIES_UNOWN_K
+ {0x34, 0x13}, // SPECIES_UNOWN_L
+ {0x44, 0x13}, // SPECIES_UNOWN_M
+ {0x43, 0x14}, // SPECIES_UNOWN_N
+ {0x44, 0x10}, // SPECIES_UNOWN_O
+ {0x34, 0x13}, // SPECIES_UNOWN_P
+ {0x43, 0x15}, // SPECIES_UNOWN_Q
+ {0x34, 0x13}, // SPECIES_UNOWN_R
+ {0x45, 0x0c}, // SPECIES_UNOWN_S
+ {0x34, 0x12}, // SPECIES_UNOWN_T
+ {0x44, 0x12}, // SPECIES_UNOWN_U
{0x44, 0x12}, // SPECIES_UNOWN_V
- {0x44, 0x12}, // SPECIES_UNOWN_W
- {0x44, 0x13}, // SPECIES_UNOWN_X
- {0x33, 0x15}, // SPECIES_UNOWN_Y
- {0x34, 0x11}, // SPECIES_UNOWN_Z
- {0x34, 0x10}, // SPECIES_UNOWN_EMARK
- {0x35, 0x0f}, // SPECIES_UNOWN_QMARK
- {0x35, 0x0d},
+ {0x44, 0x13}, // SPECIES_UNOWN_W
+ {0x33, 0x15}, // SPECIES_UNOWN_X
+ {0x34, 0x11}, // SPECIES_UNOWN_Y
+ {0x34, 0x10}, // SPECIES_UNOWN_Z
+ {0x35, 0x0f}, // SPECIES_UNOWN_EMARK
+ {0x35, 0x0d}, // SPECIES_UNOWN_QMARK
};
diff --git a/src/dewford_trend.c b/src/dewford_trend.c
index 44b42c123..3050ebecf 100644
--- a/src/dewford_trend.c
+++ b/src/dewford_trend.c
@@ -1,13 +1,14 @@
#include "global.h"
#include "dewford_trend.h"
#include "easy_chat.h"
-#include "constants/easy_chat.h"
#include "event_data.h"
#include "link.h"
#include "malloc.h"
#include "random.h"
#include "text.h"
#include "tv.h"
+#include "string_util.h"
+#include "constants/easy_chat.h"
// static functions
static void sub_8122804(struct EasyChatPair *s, u16 b, u8 c);
diff --git a/src/dragon.c b/src/dragon.c
index 20ef357a0..49f1b57c8 100644
--- a/src/dragon.c
+++ b/src/dragon.c
@@ -1,13 +1,21 @@
#include "global.h"
#include "battle_anim.h"
+#include "scanline_effect.h"
+#include "task.h"
+#include "trig.h"
#include "constants/rgb.h"
-extern void sub_8113064(struct Sprite *);
-extern void sub_8113224(struct Sprite *);
-extern void sub_81131B4(struct Sprite *);
-extern void sub_8113224(struct Sprite *);
-extern void sub_8113250(struct Sprite *);
-extern void sub_81135EC(struct Sprite *);
+extern u16 gUnknown_0203A100[];
+
+void sub_8113064(struct Sprite *);
+void sub_81131B4(struct Sprite *);
+void sub_8113224(struct Sprite *);
+void sub_8113250(struct Sprite *);
+void sub_81135EC(struct Sprite *);
+static void sub_81132E0(struct Sprite *);
+static void sub_81134B8(u8);
+static void sub_8113574(struct Task *);
+static void sub_811369C(struct Sprite *);
const union AnimCmd gUnknown_08596E60[] =
{
@@ -178,3 +186,252 @@ const struct SpriteTemplate gUnknown_08596FB0 =
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_81135EC,
};
+
+void sub_8113064(struct Sprite *sprite)
+{
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
+ if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
+ {
+ sprite->pos1.x -= gBattleAnimArgs[0];
+ gBattleAnimArgs[3] = -gBattleAnimArgs[3];
+ gBattleAnimArgs[4] = -gBattleAnimArgs[4];
+ }
+ else
+ {
+ sprite->pos1.x += gBattleAnimArgs[0];
+ }
+
+ sprite->pos1.y += gBattleAnimArgs[1];
+ sprite->data[0] = gBattleAnimArgs[2];
+ sprite->data[1] = gBattleAnimArgs[3];
+ sprite->data[3] = gBattleAnimArgs[4];
+ sprite->data[5] = gBattleAnimArgs[5];
+ sprite->invisible = 1;
+ StoreSpriteCallbackInData6(sprite, move_anim_8074EE0);
+ sprite->callback = sub_80A66DC;
+}
+
+static void sub_8113100(struct Sprite *sprite)
+{
+ sub_80A6838(sprite);
+ sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
+ sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
+ if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
+ {
+ sprite->pos1.x -= gBattleAnimArgs[1];
+ sprite->pos1.y += gBattleAnimArgs[1];
+ sprite->data[2] -= gBattleAnimArgs[2];
+ sprite->data[4] += gBattleAnimArgs[3];
+ }
+ else
+ {
+ sprite->pos1.x += gBattleAnimArgs[0];
+ sprite->pos1.y += gBattleAnimArgs[1];
+ sprite->data[2] += gBattleAnimArgs[2];
+ sprite->data[4] += gBattleAnimArgs[3];
+ StartSpriteAnim(sprite, 1);
+ }
+
+ sprite->data[0] = gBattleAnimArgs[4];
+ sprite->callback = StartAnimLinearTranslation;
+ StoreSpriteCallbackInData6(sprite, move_anim_8074EE0);
+}
+
+void sub_81131B4(struct Sprite *sprite)
+{
+ if (gBattleAnimArgs[0] == 0)
+ {
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1);
+ }
+ else
+ {
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 1);
+ }
+
+ sub_80A6864(sprite, gBattleAnimArgs[1]);
+ sprite->pos1.y += gBattleAnimArgs[2];
+ sprite->callback = sub_80A67D8;
+ StoreSpriteCallbackInData6(sprite, move_anim_8074EE0);
+}
+
+void sub_8113224(struct Sprite *sprite)
+{
+ if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
+ StartSpriteAffineAnim(sprite, 1);
+
+ sub_8113100(sprite);
+}
+
+void sub_8113250(struct Sprite *sprite)
+{
+ u16 r5;
+ u16 r0;
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
+ sprite->data[4] = 0;
+ sprite->data[5] = 1;
+ sprite->data[6] = gBattleAnimArgs[0];
+ r5 = sub_80A861C(gBattlerAttacker, 0);
+ r0 = sub_80A861C(gBattlerAttacker, 1);
+ if (r5 > r0)
+ sprite->data[7] = r5 / 2;
+ else
+ sprite->data[7] = r0 / 2;
+ sprite->pos2.x = Cos(sprite->data[6], sprite->data[7]);
+ sprite->pos2.y = Sin(sprite->data[6], sprite->data[7]);
+ sprite->callback = sub_81132E0;
+}
+
+static void sub_81132E0(struct Sprite *sprite)
+{
+ switch (sprite->data[0])
+ {
+ case 0:
+ sprite->data[6] = (sprite->data[6] - sprite->data[5]) & 0xFF;
+ sprite->pos2.x = Cos(sprite->data[6], sprite->data[7]);
+ sprite->pos2.y = Sin(sprite->data[6], sprite->data[7]);
+ if (++sprite->data[4] > 5)
+ {
+ sprite->data[4] = 0;
+ if (sprite->data[5] <= 15 && ++sprite->data[5] > 15)
+ sprite->data[5] = 16;
+ }
+ if (++sprite->data[3] > 0x3C)
+ {
+ sprite->data[3] = 0;
+ sprite->data[0]++;
+ }
+ break;
+ case 1:
+ sprite->data[6] = (sprite->data[6] - sprite->data[5]) & 0xFF;
+ if (sprite->data[7] <= 0x95 && (sprite->data[7] += 8) > 0x95)
+ sprite->data[7] = 0x96;
+ sprite->pos2.x = Cos(sprite->data[6], sprite->data[7]);
+ sprite->pos2.y = Sin(sprite->data[6], sprite->data[7]);
+ if (++sprite->data[4] > 5)
+ {
+ sprite->data[4] = 0;
+ if (sprite->data[5] <= 15 && ++sprite->data[5] > 15)
+ sprite->data[5] = 16;
+ }
+ if (++sprite->data[3] > 20)
+ DestroyAnimSprite(sprite);
+ break;
+ }
+}
+
+void sub_81133E8(u8 taskId)
+{
+ struct ScanlineEffectParams sp;
+ struct Task *task = &gTasks[taskId];
+ u16 i;
+ u8 r1;
+ if (sub_80A8364(gBattleAnimAttacker) == 1)
+ {
+ sp.dmaDest = &REG_BG1HOFS;
+ task->data[2] = gBattle_BG1_X;
+ }
+ else
+ {
+ sp.dmaDest = &REG_BG2HOFS;
+ task->data[2] = gBattle_BG2_X;
+ }
+
+ sp.dmaControl = 0xA2600001;
+ sp.initState = 1;
+ sp.unused9 = 0;
+ r1 = GetBattlerYCoordWithElevation(gBattleAnimAttacker);
+ task->data[3] = r1 - 32;
+ task->data[4] = r1 + 32;
+ if (task->data[3] < 0)
+ task->data[3] = 0;
+
+ for (i = task->data[3]; i <= task->data[4]; i++)
+ {
+ gScanlineEffectRegBuffers[0][i] = task->data[2];
+ gScanlineEffectRegBuffers[1][i] = task->data[2];
+ }
+
+ ScanlineEffect_SetParams(sp);
+ task->func = sub_81134B8;
+}
+
+static void sub_81134B8(u8 taskId)
+{
+ struct Task *task = &gTasks[taskId];
+ switch (task->data[0])
+ {
+ case 0:
+ if (++task->data[7] > 1)
+ {
+ task->data[7] = 0;
+ if (++task->data[6] == 3)
+ task->data[0]++;
+ }
+ sub_8113574(task);
+ break;
+ case 1:
+ if (++task->data[1] > 0x3C)
+ task->data[0]++;
+ sub_8113574(task);
+ break;
+ case 2:
+ if (++task->data[7] > 1)
+ {
+ task->data[7] = 0;
+ if (--task->data[6] == 0)
+ task->data[0]++;
+ }
+ sub_8113574(task);
+ break;
+ case 3:
+ gScanlineEffect.state = 3;
+ task->data[0]++;
+ break;
+ case 4:
+ DestroyAnimVisualTask(taskId);
+ break;
+ }
+}
+
+static void sub_8113574(struct Task *task)
+{
+ u16 r3 = task->data[5];
+ u16 i;
+ for (i = task->data[3]; i <= task->data[4]; i++)
+ {
+ gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = ((gSineTable[r3] * task->data[6]) >> 7) + task->data[2];
+ r3 = (r3 + 8) & 0xFF;
+ }
+
+ task->data[5] = (task->data[5] + 9) & 0xFF;
+}
+
+void sub_81135EC(struct Sprite *sprite)
+{
+ int r6 = (gBattleAnimArgs[2] * 3) / 5;
+ int i;
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + gBattleAnimArgs[4];
+ sprite->data[1] = Cos(gBattleAnimArgs[1], gBattleAnimArgs[2]);
+ sprite->data[2] = Sin(gBattleAnimArgs[1], r6);
+ sprite->pos1.x += sprite->data[1] * gBattleAnimArgs[0];
+ sprite->pos1.y += sprite->data[2] * gBattleAnimArgs[0];
+ sprite->data[3] = gBattleAnimArgs[3];
+ sprite->callback = sub_811369C;
+ for (i = 0; i < 7; i++)
+ gUnknown_0203A100[i] = sprite->data[i];
+}
+
+static void sub_811369C(struct Sprite *sprite)
+{
+ sprite->data[4] += sprite->data[1];
+ sprite->data[5] += sprite->data[2];
+ sprite->pos2.x = sprite->data[4] / 10;
+ sprite->pos2.y = sprite->data[5] / 10;
+ if (++sprite->data[0] > sprite->data[3])
+ DestroyAnimSprite(sprite);
+}
diff --git a/src/easy_chat.c b/src/easy_chat.c
index 7d25d1430..e4233fb7f 100644
--- a/src/easy_chat.c
+++ b/src/easy_chat.c
@@ -13,6 +13,7 @@
#include "palette.h"
#include "event_data.h"
#include "easy_chat.h"
+#include "string_util.h"
// Static type declarations
diff --git a/src/effects_1.c b/src/effects_1.c
index 36676b70d..a8687bc38 100644
--- a/src/effects_1.c
+++ b/src/effects_1.c
@@ -13,7 +13,7 @@ extern void sub_80FED28(struct Sprite *);
extern void sub_80FEE78(struct Sprite *);
extern void sub_80FEF44(struct Sprite *);
extern void sub_80FEFFC(struct Sprite *);
-extern void sub_80FF268(struct Sprite *);
+extern void AnimMoveTwisterParticle(struct Sprite *);
extern void sub_80FF0F4(struct Sprite *);
extern void sub_80FF374(struct Sprite *);
extern void sub_80FF698(struct Sprite *);
@@ -437,7 +437,7 @@ const struct SpriteTemplate gUnknown_085923A8 =
.anims = gUnknown_08592388,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_80FF268,
+ .callback = AnimMoveTwisterParticle,
};
const union AnimCmd gUnknown_085923C0[] =
diff --git a/src/egg_hatch.c b/src/egg_hatch.c
index 43beef442..4b7ee9a61 100644
--- a/src/egg_hatch.c
+++ b/src/egg_hatch.c
@@ -305,7 +305,7 @@ static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
u32 personality, pokerus;
u8 i, friendship, language, gameMet, markings, obedience;
u16 moves[4];
- u32 ivs[6];
+ u32 ivs[NUM_STATS];
species = GetMonData(egg, MON_DATA_SPECIES);
@@ -317,7 +317,7 @@ static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
personality = GetMonData(egg, MON_DATA_PERSONALITY);
- for (i = 0; i < 6; i++)
+ for (i = 0; i < NUM_STATS; i++)
{
ivs[i] = GetMonData(egg, MON_DATA_HP_IV + i);
}
@@ -335,7 +335,7 @@ static void CreatedHatchedMon(struct Pokemon *egg, struct Pokemon *temp)
SetMonData(temp, MON_DATA_MOVE1 + i, &moves[i]);
}
- for (i = 0; i < 6; i++)
+ for (i = 0; i < NUM_STATS; i++)
{
SetMonData(temp, MON_DATA_HP_IV + i, &ivs[i]);
}
diff --git a/src/event_object_movement.c b/src/event_object_movement.c
index 93be006ea..cd5a547a9 100644
--- a/src/event_object_movement.c
+++ b/src/event_object_movement.c
@@ -2559,7 +2559,7 @@ struct EventObjectTemplate *GetBaseTemplateForEventObject(const struct EventObje
{
return NULL;
}
- for (i = 0; i < 64; i++) // Using ARRAY_COUNT here results in the wrong conditional branch instruction (bls instead of ble)
+ for (i = 0; i < EVENT_OBJECT_TEMPLATES_COUNT; i++)
{
if (eventObject->localId == gSaveBlock1Ptr->eventObjectTemplates[i].localId)
{
diff --git a/src/evolution_scene.c b/src/evolution_scene.c
index c1d2ce59e..0d2072a15 100644
--- a/src/evolution_scene.c
+++ b/src/evolution_scene.c
@@ -41,15 +41,6 @@ struct EvoInfo
static EWRAM_DATA struct EvoInfo *sEvoStructPtr = NULL;
static EWRAM_DATA u16 *sEvoMovingBgPtr = NULL;
-extern u16 gBattle_BG0_X;
-extern u16 gBattle_BG0_Y;
-extern u16 gBattle_BG1_X;
-extern u16 gBattle_BG1_Y;
-extern u16 gBattle_BG2_X;
-extern u16 gBattle_BG2_Y;
-extern u16 gBattle_BG3_X;
-extern u16 gBattle_BG3_Y;
-
#define sEvoCursorPos gBattleCommunication[1] // when learning a new move
#define sEvoGraphicsTaskID gBattleCommunication[2]
diff --git a/src/field_effect.c b/src/field_effect.c
index 2ec5edf1e..a26d43030 100644
--- a/src/field_effect.c
+++ b/src/field_effect.c
@@ -32,6 +32,8 @@
#define subsprite_table(ptr) {.subsprites = ptr, .subspriteCount = (sizeof ptr) / (sizeof(struct Subsprite))}
+extern struct CompressedSpritePalette gMonPaletteTable[]; // GF made a mistake and did not extern it as const.
+
EWRAM_DATA s32 gFieldEffectArguments[8] = {0};
// Static type declarations
@@ -755,67 +757,15 @@ u8 AddNewGameBirchObject(s16 x, s16 y, u8 subpriority)
return CreateSprite(&gNewGameBirchObjectTemplate, x, y, subpriority);
}
-#ifdef NONMATCHING
u8 CreateMonSprite_PicBox(u16 species, s16 x, s16 y, u8 subpriority)
{
- u16 spriteId = CreateMonPicSprite_HandleDeoxys(species, 0, 0x8000, 1, x, y, 0, gMonPaletteTable[species].tag);
+ s32 spriteId = CreateMonPicSprite_HandleDeoxys(species, 0, 0x8000, 1, x, y, 0, gMonPaletteTable[species].tag);
PreservePaletteInWeather(IndexOfSpritePaletteTag(gMonPaletteTable[species].tag) + 0x10);
if (spriteId == 0xFFFF)
return MAX_SPRITES;
-
- return spriteId;
+ else
+ return spriteId;
}
-#else
-NAKED
-u8 CreateMonSprite_PicBox(u16 species, s16 x, s16 y, u8 subpriority)
-{
- asm_unified("push {r4,r5,lr}\n\
- sub sp, 0x10\n\
- lsls r0, 16\n\
- lsrs r0, 16\n\
- movs r3, 0x80\n\
- lsls r3, 8\n\
- lsls r1, 16\n\
- asrs r1, 16\n\
- str r1, [sp]\n\
- lsls r2, 16\n\
- asrs r2, 16\n\
- str r2, [sp, 0x4]\n\
- movs r1, 0\n\
- str r1, [sp, 0x8]\n\
- ldr r1, =gMonPaletteTable\n\
- lsls r4, r0, 3\n\
- adds r4, r1\n\
- ldrh r1, [r4, 0x4]\n\
- str r1, [sp, 0xC]\n\
- movs r1, 0\n\
- adds r2, r3, 0\n\
- movs r3, 0x1\n\
- bl CreateMonPicSprite_HandleDeoxys\n\
- lsls r0, 16\n\
- lsrs r5, r0, 16\n\
- ldrh r0, [r4, 0x4]\n\
- bl IndexOfSpritePaletteTag\n\
- adds r0, 0x10\n\
- lsls r0, 24\n\
- lsrs r0, 24\n\
- bl PreservePaletteInWeather\n\
- ldr r0, =0x0000ffff\n\
- cmp r5, r0\n\
- beq _080B5FDC\n\
- lsls r0, r5, 24\n\
- lsrs r0, 24\n\
- b _080B5FDE\n\
- .pool\n\
-_080B5FDC:\n\
- movs r0, 0x40\n\
-_080B5FDE:\n\
- add sp, 0x10\n\
- pop {r4,r5}\n\
- pop {r1}\n\
- bx r1");
-}
-#endif //NONMATCHING
u8 CreateMonSprite_FieldMove(u16 species, u32 d, u32 g, s16 x, s16 y, u8 subpriority)
{
@@ -824,8 +774,8 @@ u8 CreateMonSprite_FieldMove(u16 species, u32 d, u32 g, s16 x, s16 y, u8 subprio
PreservePaletteInWeather(IndexOfSpritePaletteTag(spritePalette->tag) + 0x10);
if (spriteId == 0xFFFF)
return 0x40;
-
- return spriteId;
+ else
+ return spriteId;
}
void FreeResourcesAndDestroySprite(struct Sprite *sprite, u8 spriteId)
@@ -3123,134 +3073,134 @@ NAKED
u8 sub_80B8F98(void)
{
asm_unified("push {r4-r7,lr}\n\
- mov r7, r8\n\
- push {r7}\n\
- ldr r0, =gFieldEffectObjectTemplatePointers\n\
- adds r0, 0x90\n\
- ldr r0, [r0]\n\
- movs r2, 0x18\n\
- negs r2, r2\n\
- movs r1, 0x78\n\
- movs r3, 0x1\n\
- bl CreateSprite\n\
- lsls r0, 24\n\
- lsrs r0, 24\n\
- mov r8, r0\n\
- lsls r1, r0, 4\n\
- add r1, r8\n\
- lsls r1, 2\n\
- ldr r0, =gSprites\n\
- adds r1, r0\n\
- ldrb r2, [r1, 0x5]\n\
- movs r0, 0xD\n\
- negs r0, r0\n\
- ands r0, r2\n\
- movs r2, 0x4\n\
- orrs r0, r2\n\
- movs r2, 0xF\n\
- ands r0, r2\n\
- movs r2, 0x40\n\
- orrs r0, r2\n\
- strb r0, [r1, 0x5]\n\
- movs r2, 0\n\
- strh r2, [r1, 0x2E]\n\
- strh r2, [r1, 0x30]\n\
- strh r2, [r1, 0x32]\n\
- ldr r0, =0x0000ffff\n\
- strh r0, [r1, 0x34]\n\
- ldrh r0, [r1, 0x22]\n\
- strh r0, [r1, 0x36]\n\
- strh r2, [r1, 0x38]\n\
- ldr r1, =0x00003e41\n\
- movs r0, 0x50\n\
- bl SetGpuReg\n\
- ldr r1, =0x00000e0e\n\
- movs r0, 0x52\n\
- bl SetGpuReg\n\
- ldr r1, =0x00003f3f\n\
- movs r0, 0x48\n\
- bl SetGpuReg\n\
- ldr r0, =gUnknown_0855B610\n\
- movs r1, 0xC0\n\
- movs r2, 0x20\n\
- bl LoadPalette\n\
- movs r0, 0x12\n\
- movs r1, 0x78\n\
- bl SetGpuReg\n\
- movs r4, 0x3\n\
- ldr r7, =0x0600f800\n\
- ldr r0, =0x0000bff4\n\
- adds r6, r0, 0\n\
+ mov r7, r8\n\
+ push {r7}\n\
+ ldr r0, =gFieldEffectObjectTemplatePointers\n\
+ adds r0, 0x90\n\
+ ldr r0, [r0]\n\
+ movs r2, 0x18\n\
+ negs r2, r2\n\
+ movs r1, 0x78\n\
+ movs r3, 0x1\n\
+ bl CreateSprite\n\
+ lsls r0, 24\n\
+ lsrs r0, 24\n\
+ mov r8, r0\n\
+ lsls r1, r0, 4\n\
+ add r1, r8\n\
+ lsls r1, 2\n\
+ ldr r0, =gSprites\n\
+ adds r1, r0\n\
+ ldrb r2, [r1, 0x5]\n\
+ movs r0, 0xD\n\
+ negs r0, r0\n\
+ ands r0, r2\n\
+ movs r2, 0x4\n\
+ orrs r0, r2\n\
+ movs r2, 0xF\n\
+ ands r0, r2\n\
+ movs r2, 0x40\n\
+ orrs r0, r2\n\
+ strb r0, [r1, 0x5]\n\
+ movs r2, 0\n\
+ strh r2, [r1, 0x2E]\n\
+ strh r2, [r1, 0x30]\n\
+ strh r2, [r1, 0x32]\n\
+ ldr r0, =0x0000ffff\n\
+ strh r0, [r1, 0x34]\n\
+ ldrh r0, [r1, 0x22]\n\
+ strh r0, [r1, 0x36]\n\
+ strh r2, [r1, 0x38]\n\
+ ldr r1, =0x00003e41\n\
+ movs r0, 0x50\n\
+ bl SetGpuReg\n\
+ ldr r1, =0x00000e0e\n\
+ movs r0, 0x52\n\
+ bl SetGpuReg\n\
+ ldr r1, =0x00003f3f\n\
+ movs r0, 0x48\n\
+ bl SetGpuReg\n\
+ ldr r0, =gUnknown_0855B610\n\
+ movs r1, 0xC0\n\
+ movs r2, 0x20\n\
+ bl LoadPalette\n\
+ movs r0, 0x12\n\
+ movs r1, 0x78\n\
+ bl SetGpuReg\n\
+ movs r4, 0x3\n\
+ ldr r7, =0x0600f800\n\
+ ldr r0, =0x0000bff4\n\
+ adds r6, r0, 0\n\
_080B901A:\n\
- movs r2, 0xC\n\
- lsls r0, r4, 1\n\
- lsls r5, r4, 5\n\
- adds r0, r4\n\
- lsls r3, r0, 1\n\
+ movs r2, 0xC\n\
+ lsls r0, r4, 1\n\
+ lsls r5, r4, 5\n\
+ adds r0, r4\n\
+ lsls r3, r0, 1\n\
_080B9024:\n\
- adds r0, r5, r2\n\
- lsls r0, 1\n\
- adds r0, r7\n\
- adds r1, r2, r6\n\
- adds r1, r3, r1\n\
- adds r1, 0x1\n\
- strh r1, [r0]\n\
- adds r0, r2, 0x1\n\
- lsls r0, 24\n\
- lsrs r2, r0, 24\n\
- cmp r2, 0x11\n\
- bls _080B9024\n\
- adds r0, r4, 0x1\n\
- lsls r0, 24\n\
- lsrs r4, r0, 24\n\
- cmp r4, 0xE\n\
- bls _080B901A\n\
- movs r0, 0\n\
- ldr r5, =gUnknown_0855B630\n\
+ adds r0, r5, r2\n\
+ lsls r0, 1\n\
+ adds r0, r7\n\
+ adds r1, r2, r6\n\
+ adds r1, r3, r1\n\
+ adds r1, 0x1\n\
+ strh r1, [r0]\n\
+ adds r0, r2, 0x1\n\
+ lsls r0, 24\n\
+ lsrs r2, r0, 24\n\
+ cmp r2, 0x11\n\
+ bls _080B9024\n\
+ adds r0, r4, 0x1\n\
+ lsls r0, 24\n\
+ lsrs r4, r0, 24\n\
+ cmp r4, 0xE\n\
+ bls _080B901A\n\
+ movs r0, 0\n\
+ ldr r5, =gUnknown_0855B630\n\
_080B904A:\n\
- movs r4, 0\n\
- adds r7, r0, 0x1\n\
- lsls r6, r0, 5\n\
+ movs r4, 0\n\
+ adds r7, r0, 0x1\n\
+ lsls r6, r0, 5\n\
_080B9050:\n\
- lsls r1, r4, 2\n\
- adds r1, r6, r1\n\
- ldr r0, =0x06008020\n\
- adds r3, r1, r0\n\
- adds r0, r1, 0x1\n\
- adds r0, r5\n\
- ldrb r2, [r0]\n\
- lsls r2, 8\n\
- adds r0, r1, r5\n\
- ldrb r0, [r0]\n\
- adds r0, r2\n\
- strh r0, [r3]\n\
- ldr r0, =0x06008022\n\
- adds r3, r1, r0\n\
- adds r0, r1, 0x3\n\
- adds r0, r5\n\
- ldrb r2, [r0]\n\
- lsls r2, 8\n\
- adds r1, 0x2\n\
- adds r1, r5\n\
- ldrb r0, [r1]\n\
- adds r0, r2\n\
- strh r0, [r3]\n\
- adds r0, r4, 0x1\n\
- lsls r0, 24\n\
- lsrs r4, r0, 24\n\
- cmp r4, 0x7\n\
- bls _080B9050\n\
- lsls r0, r7, 24\n\
- lsrs r0, 24\n\
- cmp r0, 0x59\n\
- bls _080B904A\n\
- mov r0, r8\n\
- pop {r3}\n\
- mov r8, r3\n\
- pop {r4-r7}\n\
- pop {r1}\n\
- bx r1\n\
- .pool");
+ lsls r1, r4, 2\n\
+ adds r1, r6, r1\n\
+ ldr r0, =0x06008020\n\
+ adds r3, r1, r0\n\
+ adds r0, r1, 0x1\n\
+ adds r0, r5\n\
+ ldrb r2, [r0]\n\
+ lsls r2, 8\n\
+ adds r0, r1, r5\n\
+ ldrb r0, [r0]\n\
+ adds r0, r2\n\
+ strh r0, [r3]\n\
+ ldr r0, =0x06008022\n\
+ adds r3, r1, r0\n\
+ adds r0, r1, 0x3\n\
+ adds r0, r5\n\
+ ldrb r2, [r0]\n\
+ lsls r2, 8\n\
+ adds r1, 0x2\n\
+ adds r1, r5\n\
+ ldrb r0, [r1]\n\
+ adds r0, r2\n\
+ strh r0, [r3]\n\
+ adds r0, r4, 0x1\n\
+ lsls r0, 24\n\
+ lsrs r4, r0, 24\n\
+ cmp r4, 0x7\n\
+ bls _080B9050\n\
+ lsls r0, r7, 24\n\
+ lsrs r0, 24\n\
+ cmp r0, 0x59\n\
+ bls _080B904A\n\
+ mov r0, r8\n\
+ pop {r3}\n\
+ mov r8, r3\n\
+ pop {r4-r7}\n\
+ pop {r1}\n\
+ bx r1\n\
+ .pool");
}
#endif // NONMATCHING
diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c
index 856f7d5ef..1f90c02b9 100755
--- a/src/field_effect_helpers.c
+++ b/src/field_effect_helpers.c
@@ -142,7 +142,7 @@ static void UpdateObjectReflectionSprite(struct Sprite *reflectionSprite)
reflectionSprite->pos2.x = mainSprite->pos2.x;
reflectionSprite->pos2.y = -mainSprite->pos2.y;
reflectionSprite->coordOffsetEnabled = mainSprite->coordOffsetEnabled;
-
+
if (eventObject->unk3_3 == TRUE)
reflectionSprite->invisible = TRUE;
@@ -1022,19 +1022,19 @@ static void SynchroniseSurfAnim(struct EventObject *eventObject, struct Sprite *
StartSpriteAnimIfDifferent(sprite, surfBlobDirectionAnims[eventObject->movementDirection]);
}
-#ifdef NONMATCHING
void sub_81556E8(struct EventObject *eventObject, struct Sprite *sprite)
{
- s16 x;
- s16 y;
u8 i;
+ s16 x = eventObject->currentCoords.x;
+ s16 y = eventObject->currentCoords.y;
+ s32 spriteY = sprite->pos2.y;
- x = eventObject->currentCoords.x;
- y = eventObject->currentCoords.y;
- if (sprite->pos2.y == 0 && (x != sprite->data[6] || y != sprite->data[7]))
+ if (spriteY == 0 && (x != sprite->data[6] || y != sprite->data[7]))
{
- sprite->data[5] = sprite->pos2.y;
- for (sprite->data[6] = x, sprite->data[7] = y, i = DIR_SOUTH; i <= DIR_EAST; i ++, x = sprite->data[6], y = sprite->data[7])
+ sprite->data[5] = spriteY;
+ sprite->data[6] = x;
+ sprite->data[7] = y;
+ for (i = DIR_SOUTH; i <= DIR_EAST; i++, x = sprite->data[6], y = sprite->data[7])
{
MoveCoords(i, &x, &y);
if (MapGridGetZCoordAt(x, y) == 3)
@@ -1045,87 +1045,6 @@ void sub_81556E8(struct EventObject *eventObject, struct Sprite *sprite)
}
}
}
-#else
-NAKED void sub_81556E8(struct EventObject *eventObject, struct Sprite *sprite)
-{
- asm_unified("push {r4-r7,lr}\n\
- mov r7, r8\n\
- push {r7}\n\
- sub sp, 0x4\n\
- adds r4, r1, 0\n\
- ldrh r2, [r0, 0x10]\n\
- mov r1, sp\n\
- strh r2, [r1]\n\
- ldrh r1, [r0, 0x12]\n\
- mov r0, sp\n\
- adds r0, 0x2\n\
- strh r1, [r0]\n\
- movs r2, 0x26\n\
- ldrsh r3, [r4, r2]\n\
- mov r8, r0\n\
- cmp r3, 0\n\
- bne _08155770\n\
- mov r0, sp\n\
- movs r5, 0\n\
- ldrsh r2, [r0, r5]\n\
- movs r5, 0x3A\n\
- ldrsh r0, [r4, r5]\n\
- cmp r2, r0\n\
- bne _08155724\n\
- lsls r0, r1, 16\n\
- asrs r0, 16\n\
- movs r5, 0x3C\n\
- ldrsh r1, [r4, r5]\n\
- cmp r0, r1\n\
- beq _08155770\n\
-_08155724:\n\
- strh r3, [r4, 0x38]\n\
- strh r2, [r4, 0x3A]\n\
- mov r1, r8\n\
- movs r2, 0\n\
- ldrsh r0, [r1, r2]\n\
- strh r0, [r4, 0x3C]\n\
- movs r5, 0x1\n\
- mov r7, r8\n\
- mov r6, sp\n\
-_08155736:\n\
- adds r0, r5, 0\n\
- mov r1, sp\n\
- adds r2, r7, 0\n\
- bl MoveCoords\n\
- movs r1, 0\n\
- ldrsh r0, [r6, r1]\n\
- movs r2, 0\n\
- ldrsh r1, [r7, r2]\n\
- bl MapGridGetZCoordAt\n\
- lsls r0, 24\n\
- lsrs r0, 24\n\
- cmp r0, 0x3\n\
- bne _0815575C\n\
- ldrh r0, [r4, 0x38]\n\
- adds r0, 0x1\n\
- strh r0, [r4, 0x38]\n\
- b _08155770\n\
-_0815575C:\n\
- adds r0, r5, 0x1\n\
- lsls r0, 24\n\
- lsrs r5, r0, 24\n\
- ldrh r0, [r4, 0x3A]\n\
- strh r0, [r6]\n\
- ldrh r0, [r4, 0x3C]\n\
- mov r1, r8\n\
- strh r0, [r1]\n\
- cmp r5, 0x4\n\
- bls _08155736\n\
-_08155770:\n\
- add sp, 0x4\n\
- pop {r3}\n\
- mov r8, r3\n\
- pop {r4-r7}\n\
- pop {r0}\n\
- bx r0");
-}
-#endif
static void CreateBobbingEffect(struct EventObject *eventObject, struct Sprite *linkedSprite, struct Sprite *sprite)
{
@@ -1450,7 +1369,7 @@ void sub_8155EA0(struct Sprite *sprite)
bool8 sub_8155EA8(struct Sprite *sprite)
{
bool8 returnBool = FALSE;
-
+
switch (sprite->data[7])
{
case 0:
@@ -1470,7 +1389,7 @@ bool8 sub_8155EA8(struct Sprite *sprite)
sprite->pos2.y += sub_8097728(0x47 - sprite->data[6]);
break;
}
-
+
SetGpuReg(REG_OFFSET_BG0HOFS, -sprite->pos2.x);
if (++sprite->data[6] == 72)
{
@@ -1483,14 +1402,14 @@ bool8 sub_8155EA8(struct Sprite *sprite)
sprite->pos2.x = 0;
returnBool = TRUE;
}
-
+
return returnBool;
}
void sub_8155F80(struct Sprite *sprite)
{
u8 i, j;
-
+
switch (sprite->data[2])
{
case 0:
@@ -1594,7 +1513,7 @@ void sub_8155F80(struct Sprite *sprite)
FieldEffectStop(sprite, FLDEFF_64);
break;
}
-
+
if (sprite->data[2] == 1)
{
if ((sprite->data[1] & 7) == 0)
@@ -1603,7 +1522,7 @@ void sub_8155F80(struct Sprite *sprite)
sprite->data[3] = -sprite->data[3];
sprite->data[1]++;
}
-
+
sprite->data[0]++;
}
@@ -1676,102 +1595,102 @@ static void sub_81561FC(struct Sprite *sprite /*r6*/, u8 z, u8 offset)
NAKED void sub_81561FC(struct Sprite *sprite /*r6*/, u8 z, u8 offset)
{
asm_unified("push {r4-r7,lr}\n\
- adds r6, r0, 0\n\
- adds r0, r1, 0\n\
- lsls r0, 24\n\
- lsrs r0, 24\n\
- lsls r2, 24\n\
- lsrs r2, 24\n\
- adds r1, r6, 0\n\
- bl SetObjectSubpriorityByZCoord\n\
- movs r7, 0\n\
+ adds r6, r0, 0\n\
+ adds r0, r1, 0\n\
+ lsls r0, 24\n\
+ lsrs r0, 24\n\
+ lsls r2, 24\n\
+ lsrs r2, 24\n\
+ adds r1, r6, 0\n\
+ bl SetObjectSubpriorityByZCoord\n\
+ movs r7, 0\n\
_08156212:\n\
- lsls r0, r7, 3\n\
- adds r0, r7\n\
- lsls r0, 2\n\
- ldr r1, =gEventObjects\n\
- adds r4, r0, r1\n\
- ldrb r0, [r4]\n\
- lsls r0, 31\n\
- cmp r0, 0\n\
- beq _081562B4\n\
- ldrb r0, [r4, 0x5]\n\
- bl GetEventObjectGraphicsInfo\n\
- ldrb r1, [r4, 0x4]\n\
- lsls r0, r1, 4\n\
- adds r0, r1\n\
- lsls r0, 2\n\
- ldr r1, =gSprites\n\
- adds r5, r0, r1\n\
- adds r0, r6, 0\n\
- adds r0, 0x28\n\
- movs r2, 0\n\
- ldrsb r2, [r0, r2]\n\
- ldrh r0, [r6, 0x20]\n\
- adds r1, r0, r2\n\
- subs r0, r2\n\
- lsls r0, 16\n\
- lsrs r4, r0, 16\n\
- lsls r1, 16\n\
- asrs r1, 16\n\
- movs r0, 0x20\n\
- ldrsh r2, [r5, r0]\n\
- cmp r1, r2\n\
- bge _081562B4\n\
- lsls r0, r4, 16\n\
- asrs r0, 16\n\
- cmp r0, r2\n\
- ble _081562B4\n\
- adds r0, r5, 0\n\
- adds r0, 0x29\n\
- movs r3, 0\n\
- ldrsb r3, [r0, r3]\n\
- ldrh r2, [r5, 0x22]\n\
- adds r2, r3\n\
- ldrh r4, [r5, 0x22]\n\
- adds r0, r6, 0\n\
- adds r0, 0x29\n\
- movs r1, 0\n\
- ldrsb r1, [r0, r1]\n\
- ldrh r0, [r6, 0x22]\n\
- subs r0, r1\n\
- lsls r0, 16\n\
- asrs r0, 16\n\
- adds r3, r0, r3\n\
- lsls r2, 16\n\
- asrs r2, 16\n\
- lsls r3, 16\n\
- asrs r3, 16\n\
- cmp r2, r3\n\
- blt _0815628C\n\
- cmp r2, r0\n\
- bge _081562B4\n\
+ lsls r0, r7, 3\n\
+ adds r0, r7\n\
+ lsls r0, 2\n\
+ ldr r1, =gEventObjects\n\
+ adds r4, r0, r1\n\
+ ldrb r0, [r4]\n\
+ lsls r0, 31\n\
+ cmp r0, 0\n\
+ beq _081562B4\n\
+ ldrb r0, [r4, 0x5]\n\
+ bl GetEventObjectGraphicsInfo\n\
+ ldrb r1, [r4, 0x4]\n\
+ lsls r0, r1, 4\n\
+ adds r0, r1\n\
+ lsls r0, 2\n\
+ ldr r1, =gSprites\n\
+ adds r5, r0, r1\n\
+ adds r0, r6, 0\n\
+ adds r0, 0x28\n\
+ movs r2, 0\n\
+ ldrsb r2, [r0, r2]\n\
+ ldrh r0, [r6, 0x20]\n\
+ adds r1, r0, r2\n\
+ subs r0, r2\n\
+ lsls r0, 16\n\
+ lsrs r4, r0, 16\n\
+ lsls r1, 16\n\
+ asrs r1, 16\n\
+ movs r0, 0x20\n\
+ ldrsh r2, [r5, r0]\n\
+ cmp r1, r2\n\
+ bge _081562B4\n\
+ lsls r0, r4, 16\n\
+ asrs r0, 16\n\
+ cmp r0, r2\n\
+ ble _081562B4\n\
+ adds r0, r5, 0\n\
+ adds r0, 0x29\n\
+ movs r3, 0\n\
+ ldrsb r3, [r0, r3]\n\
+ ldrh r2, [r5, 0x22]\n\
+ adds r2, r3\n\
+ ldrh r4, [r5, 0x22]\n\
+ adds r0, r6, 0\n\
+ adds r0, 0x29\n\
+ movs r1, 0\n\
+ ldrsb r1, [r0, r1]\n\
+ ldrh r0, [r6, 0x22]\n\
+ subs r0, r1\n\
+ lsls r0, 16\n\
+ asrs r0, 16\n\
+ adds r3, r0, r3\n\
+ lsls r2, 16\n\
+ asrs r2, 16\n\
+ lsls r3, 16\n\
+ asrs r3, 16\n\
+ cmp r2, r3\n\
+ blt _0815628C\n\
+ cmp r2, r0\n\
+ bge _081562B4\n\
_0815628C:\n\
- lsls r0, r4, 16\n\
- asrs r0, 16\n\
- cmp r0, r3\n\
- ble _081562B4\n\
- adds r2, r6, 0\n\
- adds r2, 0x43\n\
- adds r0, r5, 0\n\
- adds r0, 0x43\n\
- ldrb r1, [r0]\n\
- ldrb r0, [r2]\n\
- cmp r0, r1\n\
- bhi _081562B4\n\
- adds r0, r1, 0x2\n\
- strb r0, [r2]\n\
- b _081562BE\n\
- .pool\n\
+ lsls r0, r4, 16\n\
+ asrs r0, 16\n\
+ cmp r0, r3\n\
+ ble _081562B4\n\
+ adds r2, r6, 0\n\
+ adds r2, 0x43\n\
+ adds r0, r5, 0\n\
+ adds r0, 0x43\n\
+ ldrb r1, [r0]\n\
+ ldrb r0, [r2]\n\
+ cmp r0, r1\n\
+ bhi _081562B4\n\
+ adds r0, r1, 0x2\n\
+ strb r0, [r2]\n\
+ b _081562BE\n\
+ .pool\n\
_081562B4:\n\
- adds r0, r7, 0x1\n\
- lsls r0, 24\n\
- lsrs r7, r0, 24\n\
- cmp r7, 0xF\n\
- bls _08156212\n\
+ adds r0, r7, 0x1\n\
+ lsls r0, 24\n\
+ lsrs r7, r0, 24\n\
+ cmp r7, 0xF\n\
+ bls _08156212\n\
_081562BE:\n\
- pop {r4-r7}\n\
- pop {r0}\n\
- bx r0");
+ pop {r4-r7}\n\
+ pop {r0}\n\
+ bx r0");
}
#endif
diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c
index f0a8da7d7..a5aa23e32 100644
--- a/src/field_player_avatar.c
+++ b/src/field_player_avatar.c
@@ -1306,7 +1306,7 @@ bool8 PartyHasMonWithSurf(void)
if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
{
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE)
break;
diff --git a/src/field_specials.c b/src/field_specials.c
index 113f46922..562127890 100644
--- a/src/field_specials.c
+++ b/src/field_specials.c
@@ -2052,26 +2052,26 @@ _08139D7C:\n\
void sub_8139D98(void)
{
u8 i;
- u32 ivStorage[6];
+ u32 ivStorage[NUM_STATS];
- ivStorage[0] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_HP_IV);
- ivStorage[1] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_ATK_IV);
- ivStorage[2] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_DEF_IV);
- ivStorage[3] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPEED_IV);
- ivStorage[4] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPATK_IV);
- ivStorage[5] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPDEF_IV);
+ ivStorage[STAT_HP] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_HP_IV);
+ ivStorage[STAT_ATK] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_ATK_IV);
+ ivStorage[STAT_DEF] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_DEF_IV);
+ ivStorage[STAT_SPEED] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPEED_IV);
+ ivStorage[STAT_SPATK] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPATK_IV);
+ ivStorage[STAT_SPDEF] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPDEF_IV);
gSpecialVar_0x8005 = 0;
- for (i = 0; i < ARRAY_COUNT(ivStorage); i++)
+ for (i = 0; i < NUM_STATS; i++)
{
gSpecialVar_0x8005 += ivStorage[i];
}
gSpecialVar_0x8006 = 0;
- gSpecialVar_0x8007 = ivStorage[0]; // HP IV
+ gSpecialVar_0x8007 = ivStorage[STAT_HP];
- for (i = 1; i < 6; i++)
+ for (i = 1; i < NUM_STATS; i++)
{
if (ivStorage[gSpecialVar_0x8006] < ivStorage[i])
{
@@ -2081,7 +2081,7 @@ void sub_8139D98(void)
else if (ivStorage[gSpecialVar_0x8006] == ivStorage[i])
{
u16 randomNumber = Random();
- if ((randomNumber & 1) != 0)
+ if (randomNumber & 1)
{
gSpecialVar_0x8006 = i;
gSpecialVar_0x8007 = ivStorage[i];
diff --git a/src/fight.c b/src/fight.c
index 89fe5900b..c9000fae4 100644
--- a/src/fight.c
+++ b/src/fight.c
@@ -1,25 +1,42 @@
#include "global.h"
#include "battle_anim.h"
+#include "gpu_regs.h"
+#include "random.h"
+#include "task.h"
+#include "trig.h"
#include "constants/rgb.h"
-extern void unc_080B08A0(struct Sprite *);
-extern void sub_810CE68(struct Sprite *);
-extern void sub_810CEB4(struct Sprite *);
-extern void sub_810CEE0(struct Sprite *);
-extern void sub_810CF30(struct Sprite *);
-extern void sub_810D10C(struct Sprite *);
-extern void sub_810D1B4(struct Sprite *);
-extern void sub_810D278(struct Sprite *);
-extern void sub_810D2E4(struct Sprite *);
-extern void sub_810D37C(struct Sprite *);
-extern void sub_810D40C(struct Sprite *);
-extern void sub_810D4F4(struct Sprite *);
-extern void sub_810D608(struct Sprite *);
-extern void sub_810D714(struct Sprite *);
-extern void sub_810D874(struct Sprite *);
-extern void sub_810D984(struct Sprite *);
-extern void sub_810DA10(struct Sprite *);
-extern void sub_810DA7C(struct Sprite *);
+void unc_080B08A0(struct Sprite *);
+void sub_810CE68(struct Sprite *);
+void sub_810CEB4(struct Sprite *);
+void AnimBasicFistOrFoot(struct Sprite *);
+void sub_810CF30(struct Sprite *);
+void sub_810D10C(struct Sprite *);
+void sub_810D1B4(struct Sprite *);
+void AnimSpinningKickOrPunch(struct Sprite *);
+void AnimStompFoot(struct Sprite *);
+void sub_810D37C(struct Sprite *);
+void sub_810D40C(struct Sprite *);
+void sub_810D4F4(struct Sprite *);
+void sub_810D608(struct Sprite *);
+void sub_810D714(struct Sprite *);
+void sub_810D874(struct Sprite *);
+void sub_810D984(struct Sprite *);
+void sub_810DA10(struct Sprite *);
+void sub_810DA7C(struct Sprite *);
+static void sub_810D0B8(struct Sprite *);
+static void sub_810D164(struct Sprite *);
+static void sub_810D240(struct Sprite *);
+static void AnimSpinningKickOrPunchFinish(struct Sprite *);
+static void AnimStompFootStep(struct Sprite *);
+static void AnimStompFootEnd(struct Sprite *);
+static void sub_810D47C(struct Sprite *);
+static void sub_810D5DC(struct Sprite *);
+static void sub_810D6A8(struct Sprite *);
+static void sub_810D770(struct Sprite *);
+static void sub_810D830(struct Sprite *);
+
+extern struct SpriteTemplate gBasicHitSplatSpriteTemplate;
const struct SpriteTemplate gUnknown_08595E14 =
{
@@ -109,7 +126,7 @@ const struct SpriteTemplate gFistFootSpriteTemplate =
.anims = gUnknown_08595E54,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_810CEE0,
+ .callback = AnimBasicFistOrFoot,
};
const struct SpriteTemplate gUnknown_08595EB0 =
@@ -165,7 +182,7 @@ const struct SpriteTemplate gUnknown_08595F14 =
.anims = gUnknown_08595E54,
.images = NULL,
.affineAnims = gUnknown_08595F10,
- .callback = sub_810D278,
+ .callback = AnimSpinningKickOrPunch,
};
const union AffineAnimCmd gUnknown_08595F2C[] =
@@ -188,7 +205,7 @@ const struct SpriteTemplate gMegaPunchKickSpriteTemplate =
.anims = gUnknown_08595E54,
.images = NULL,
.affineAnims = gUnknown_08595F44,
- .callback = sub_810D278,
+ .callback = AnimSpinningKickOrPunch,
};
const struct SpriteTemplate gUnknown_08595F60 =
@@ -199,7 +216,7 @@ const struct SpriteTemplate gUnknown_08595F60 =
.anims = gUnknown_08595E58,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_810D2E4,
+ .callback = AnimStompFoot,
};
const struct SpriteTemplate gUnknown_08595F78 =
@@ -396,3 +413,623 @@ const struct SpriteTemplate gUnknown_08596104 =
.affineAnims = gUnknown_08596100,
.callback = sub_810DA7C,
};
+
+void unc_080B08A0(struct Sprite *sprite)
+{
+ sub_80A6864(sprite, gBattleAnimArgs[0]);
+ sprite->pos1.y += gBattleAnimArgs[1];
+ sprite->data[0] = 15;
+ sprite->callback = WaitAnimForDuration;
+ StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
+}
+
+void sub_810CE68(struct Sprite *sprite)
+{
+ if (gBattleAnimArgs[7] == 1 && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
+ {
+ gBattleAnimArgs[1] = -gBattleAnimArgs[1];
+ gBattleAnimArgs[3] = -gBattleAnimArgs[3];
+ }
+
+ StartSpriteAnim(sprite, gBattleAnimArgs[6]);
+ gBattleAnimArgs[6] = 0;
+ sub_80A7938(sprite);
+}
+
+void sub_810CEB4(struct Sprite *sprite)
+{
+ if (IsContest())
+ {
+ gBattleAnimArgs[1] = -gBattleAnimArgs[1];
+ gBattleAnimArgs[3] = -gBattleAnimArgs[3];
+ }
+
+ sub_810CE68(sprite);
+}
+
+// Displays a basic fist or foot sprite for a given duration.
+// Used by many fighting moves (and elemental "punch" moves).
+// arg 0: initial x pixel offset
+// arg 1: initial y pixel offset
+// arg 2: duration
+// arg 3: ? (todo: related to initial pixel offsets)
+// arg 4: anim num
+void AnimBasicFistOrFoot(struct Sprite *sprite)
+{
+ StartSpriteAnim(sprite, gBattleAnimArgs[4]);
+
+ if (gBattleAnimArgs[3] == 0)
+ InitAnimSpritePos(sprite, 1);
+ else
+ sub_80A6980(sprite, TRUE);
+
+ sprite->data[0] = gBattleAnimArgs[2];
+ sprite->callback = WaitAnimForDuration;
+ StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
+}
+
+void sub_810CF30(struct Sprite *sprite)
+{
+ u8 battler;
+ s16 xMod, yMod;
+ s16 x, y;
+
+ if (gBattleAnimArgs[0] == 0)
+ battler = gBattleAnimAttacker;
+ else
+ battler = gBattleAnimTarget;
+
+ if (gBattleAnimArgs[2] < 0)
+ gBattleAnimArgs[2] = Random2() % 5;
+
+ StartSpriteAnim(sprite, gBattleAnimArgs[2]);
+ sprite->pos1.x = GetBattlerSpriteCoord(battler, 2);
+ sprite->pos1.y = GetBattlerSpriteCoord(battler, 3);
+
+ xMod = sub_80A861C(battler, 1) / 2;
+ yMod = sub_80A861C(battler, 0) / 4;
+
+ x = Random2() % xMod;
+ y = Random2() % yMod;
+
+ if (Random2() & 1)
+ x *= -1;
+ if (Random2() & 1)
+ y *= -1;
+
+ if ((gBattlerPositions[battler] & BIT_SIDE) == B_SIDE_PLAYER)
+ y += 0xFFF0;
+
+ sprite->pos1.x += x;
+ sprite->pos1.y += y;
+
+ sprite->data[0] = gBattleAnimArgs[1];
+ sprite->data[7] = CreateSprite(&gBasicHitSplatSpriteTemplate, sprite->pos1.x, sprite->pos1.y, sprite->subpriority + 1);
+ if (sprite->data[7] != 64)
+ {
+ StartSpriteAffineAnim(&gSprites[sprite->data[7]], 0);
+ gSprites[sprite->data[7]].callback = SpriteCallbackDummy;
+ }
+
+ sprite->callback = sub_810D0B8;
+}
+
+static void sub_810D0B8(struct Sprite *sprite)
+{
+ if (sprite->data[0] == 0)
+ {
+ if (sprite->data[7] != 64)
+ {
+ FreeOamMatrix(gSprites[sprite->data[7]].oam.matrixNum);
+ DestroySprite(&gSprites[sprite->data[7]]);
+ }
+
+ DestroyAnimSprite(sprite);
+ }
+ else
+ {
+ sprite->data[0]--;
+ }
+}
+
+void sub_810D10C(struct Sprite *sprite)
+{
+ sub_80A6980(sprite, TRUE);
+ sprite->data[0] = 30;
+
+ if (gBattleAnimArgs[2] == 0)
+ {
+ sprite->data[2] = sprite->pos1.x - 20;
+ }
+ else
+ {
+ sprite->data[2] = sprite->pos1.x + 20;
+ sprite->hFlip = 1;
+ }
+
+ sprite->data[4] = sprite->pos1.y - 20;
+ sprite->callback = StartAnimLinearTranslation;
+ StoreSpriteCallbackInData6(sprite, sub_810D164);
+}
+
+static void sub_810D164(struct Sprite *sprite)
+{
+ if (++sprite->data[5] == 11)
+ {
+ sprite->data[2] = sprite->pos1.x - sprite->pos2.x;
+ sprite->data[4] = sprite->pos1.y - sprite->pos2.y;
+ sprite->data[0] = 8;
+ sprite->pos1.x += sprite->pos2.x;
+ sprite->pos1.y += sprite->pos2.y;
+ sprite->pos2.y = 0;
+ sprite->pos2.x = 0;
+
+ sprite->callback = StartAnimLinearTranslation;
+ StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
+ }
+}
+
+void sub_810D1B4(struct Sprite *sprite)
+{
+ if (BATTLE_PARTNER(gBattleAnimAttacker) == gBattleAnimTarget && GetBattlerPosition(gBattleAnimTarget) < B_POSITION_PLAYER_RIGHT)
+ gBattleAnimArgs[0] *= -1;
+
+ sub_80A6980(sprite, TRUE);
+
+ if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
+ gBattleAnimArgs[2] = -gBattleAnimArgs[2];
+
+ sprite->data[0] = gBattleAnimArgs[3];
+ sprite->data[1] = sprite->pos1.x;
+ sprite->data[2] = sprite->pos1.x + gBattleAnimArgs[2];
+ sprite->data[3] = sprite->pos1.y;
+ sprite->data[4] = sprite->pos1.y;
+
+ InitAnimLinearTranslation(sprite);
+
+ sprite->data[5] = gBattleAnimArgs[5];
+ sprite->data[6] = gBattleAnimArgs[4];
+ sprite->data[7] = 0;
+
+ sprite->callback = sub_810D240;
+}
+
+static void sub_810D240(struct Sprite *sprite)
+{
+ if (!TranslateAnimLinear(sprite))
+ {
+ sprite->pos2.y += Sin(sprite->data[7] >> 8, sprite->data[5]);
+ sprite->data[7] += sprite->data[6];
+ }
+ else
+ {
+ DestroyAnimSprite(sprite);
+ }
+}
+
+// Animates the spinning, shrinking kick or punch, which then
+// reappears at full size. Used by moves such as MOVE_MEGA_PUNCH and MOVE_MEGA_KICK.
+// arg 0: initial x pixel offset
+// arg 1: initial y pixel offset
+// arg 2: anim num
+// arg 3: spin duration
+void AnimSpinningKickOrPunch(struct Sprite *sprite)
+{
+ sub_80A6980(sprite, TRUE);
+ StartSpriteAnim(sprite, gBattleAnimArgs[2]);
+ sprite->data[0] = gBattleAnimArgs[3];
+
+ sprite->callback = WaitAnimForDuration;
+ StoreSpriteCallbackInData6(sprite, AnimSpinningKickOrPunchFinish);
+}
+
+static void AnimSpinningKickOrPunchFinish(struct Sprite *sprite)
+{
+ StartSpriteAffineAnim(sprite, 0);
+ sprite->affineAnimPaused = 1;
+ sprite->data[0] = 20;
+
+ sprite->callback = WaitAnimForDuration;
+ StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
+}
+
+// Animates MOVE_STOMP's foot that slides downward.
+// arg 0: initial x pixel offset
+// arg 1: initial y pixel offset
+// arg 2: initial wait duration
+void AnimStompFoot(struct Sprite *sprite)
+{
+ sub_80A6980(sprite, TRUE);
+ sprite->data[0] = gBattleAnimArgs[2];
+
+ sprite->callback = AnimStompFootStep;
+}
+
+static void AnimStompFootStep(struct Sprite *sprite)
+{
+ if (--sprite->data[0] == -1)
+ {
+ sprite->data[0] = 6;
+ sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
+ sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
+
+ sprite->callback = StartAnimLinearTranslation;
+ StoreSpriteCallbackInData6(sprite, AnimStompFootEnd);
+ }
+}
+
+static void AnimStompFootEnd(struct Sprite *sprite)
+{
+ sprite->data[0] = 15;
+
+ sprite->callback = WaitAnimForDuration;
+ StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
+}
+
+void sub_810D37C(struct Sprite *sprite)
+{
+ if (sprite->data[0] == 0)
+ {
+ sub_80A6980(sprite, TRUE);
+ sprite->data[1] = gBattleAnimArgs[2];
+ sprite->data[2] = gBattleAnimArgs[3];
+ sprite->data[0]++;
+ }
+ else
+ {
+ sprite->data[4] += sprite->data[1];
+ sprite->pos2.x = sprite->data[4] >> 8;
+ sprite->pos2.y = Sin(sprite->data[3], sprite->data[2]);
+ sprite->data[3] = (sprite->data[3] + 3) & 0xFF;
+
+ if (sprite->data[3] > 100)
+ sprite->invisible = sprite->data[3] % 2;
+
+ if (sprite->data[3] > 120)
+ DestroyAnimSprite(sprite);
+ }
+}
+
+void sub_810D40C(struct Sprite *sprite)
+{
+ if (gBattleAnimArgs[0] == 0)
+ {
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1);
+ }
+ else
+ {
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 1);
+ }
+
+ sprite->pos1.x += gBattleAnimArgs[1];
+ sprite->pos1.y += gBattleAnimArgs[2];
+
+ sprite->data[0] = 0;
+ sprite->data[1] = gBattleAnimArgs[3];
+ sprite->data[2] = gBattleAnimArgs[4];
+ sprite->data[3] = 0;
+ sprite->callback = sub_810D47C;
+}
+
+static void sub_810D47C(struct Sprite *sprite)
+{
+ switch (sprite->data[0])
+ {
+ case 0:
+ if (--sprite->data[1] == 0)
+ {
+ if (sprite->data[2] == 0)
+ DestroyAnimSprite(sprite);
+ else
+ sprite->data[0]++;
+ }
+ break;
+ case 1:
+ if (++sprite->data[1] > 1)
+ {
+ sprite->data[1] = 0;
+ sprite->data[3]++;
+ if (sprite->data[3] & 1)
+ sprite->pos2.x = 2;
+ else
+ sprite->pos2.x = -2;
+ }
+
+ if (--sprite->data[2] == 0)
+ DestroyAnimSprite(sprite);
+ break;
+ }
+}
+
+void sub_810D4F4(struct Sprite *sprite)
+{
+ if (gBattleAnimArgs[0] == 0)
+ {
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 0) + gBattleAnimArgs[2];
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + gBattleAnimArgs[3];
+ }
+ else
+ {
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 0) + gBattleAnimArgs[2];
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + gBattleAnimArgs[3];
+ }
+
+ sprite->oam.tileNum += gBattleAnimArgs[1] * 16;
+ sprite->data[0] = 0;
+
+ switch (gBattleAnimArgs[1])
+ {
+ case 0:
+ sprite->data[6] = -3;
+ sprite->data[7] = -3;
+ break;
+ case 1:
+ sprite->data[6] = 3;
+ sprite->data[7] = -3;
+ break;
+ case 2:
+ sprite->data[6] = -3;
+ sprite->data[7] = 3;
+ break;
+ case 3:
+ sprite->data[6] = 3;
+ sprite->data[7] = 3;
+ break;
+ default:
+ DestroyAnimSprite(sprite);
+ return;
+ }
+
+ sprite->callback = sub_810D5DC;
+}
+
+static void sub_810D5DC(struct Sprite *sprite)
+{
+ sprite->pos1.x += sprite->data[6];
+ sprite->pos1.y += sprite->data[7];
+
+ if (++sprite->data[0] > 40)
+ DestroyAnimSprite(sprite);
+}
+
+void sub_810D608(struct Sprite *sprite)
+{
+ if (gBattleAnimArgs[0] == 0)
+ {
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattlerAttacker, 2);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattlerAttacker, 3);
+ sprite->oam.priority = sub_80A8328(gBattleAnimAttacker);
+ sprite->data[7] = gBattleAnimTarget;
+ }
+ else
+ {
+ sprite->oam.priority = sub_80A8328(gBattleAnimTarget);
+ sprite->data[7] = gBattleAnimAttacker;
+ }
+
+ sprite->data[0] = 0;
+ sprite->data[1] = 12;
+ sprite->data[2] = 8;
+ sprite->callback = sub_810D6A8;
+}
+
+static void sub_810D6A8(struct Sprite *sprite)
+{
+ if (++sprite->data[0] == 180)
+ {
+ SetGpuReg(REG_OFFSET_BLDCNT, 0);
+
+ sprite->data[0] = 16;
+ sprite->data[1] = sprite->pos1.x;
+ sprite->data[2] = GetBattlerSpriteCoord(sprite->data[7], 2);
+ sprite->data[3] = sprite->pos1.y;
+ sprite->data[4] = GetBattlerSpriteCoord(sprite->data[7], 3);
+
+ InitAnimLinearTranslation(sprite);
+ StoreSpriteCallbackInData6(sprite, move_anim_8074EE0);
+ sprite->callback = sub_80A6F98;
+ }
+}
+
+void sub_810D714(struct Sprite *sprite)
+{
+ sprite->pos1.x = gBattleAnimArgs[0];
+ sprite->pos1.y = 120;
+
+ sprite->data[0] = gBattleAnimArgs[3];
+ sub_80A8048(&sprite->data[4], &sprite->data[5], (void *)(sprite->pos1.y << 8));
+
+ sprite->data[6] = gBattleAnimArgs[1];
+ sprite->oam.tileNum += gBattleAnimArgs[2] * 4;
+
+ sprite->callback = sub_810D770;
+}
+
+static void sub_810D770(struct Sprite *sprite)
+{
+ void *var0;
+
+ if (sprite->data[0] != 0)
+ {
+ var0 = sub_80A8050(sprite->data[4], sprite->data[5]);
+ var0 -= sprite->data[6];
+ sub_80A8048(&sprite->data[4], &sprite->data[5], var0);
+
+ var0 = (void *)(((intptr_t)var0) >> 8);
+ sprite->pos1.y = (intptr_t)var0;
+ if (sprite->pos1.y < -8)
+ DestroyAnimSprite(sprite);
+ else
+ sprite->data[0]--;
+ }
+ else
+ {
+ s16 pos0 = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
+ s16 pos1 = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
+ s16 pos2 = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
+ s16 pos3 = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
+
+ sprite->data[0] = pos2 - pos0;
+ sprite->data[1] = pos3 - pos1;
+ sprite->data[2] = sprite->pos1.x << 4;
+ sprite->data[3] = sprite->pos1.y << 4;
+
+ sprite->callback = sub_810D830;
+ }
+}
+
+static void sub_810D830(struct Sprite *sprite)
+{
+ u16 edgeX;
+
+ sprite->data[2] += sprite->data[0];
+ sprite->data[3] += sprite->data[1];
+ sprite->pos1.x = sprite->data[2] >> 4;
+ sprite->pos1.y = sprite->data[3] >> 4;
+
+ edgeX = sprite->pos1.x + 8;
+ if (edgeX > 256 || sprite->pos1.y < -8 || sprite->pos1.y > 120)
+ DestroyAnimSprite(sprite);
+}
+
+void sub_810D874(struct Sprite *sprite)
+{
+ u8 battler;
+
+ if (gBattleAnimArgs[0] == 0)
+ {
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattlerAttacker, 2);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattlerAttacker, 3);
+ battler = gBattleAnimTarget;
+ sprite->oam.priority = sub_80A8328(gBattleAnimAttacker);
+ }
+ else
+ {
+ battler = gBattleAnimAttacker;
+ sprite->oam.priority = sub_80A8328(gBattleAnimTarget);
+ }
+
+ if (IsContest())
+ sprite->oam.matrixNum |= 0x8;
+ else if (GetBattlerSide(battler) == B_SIDE_PLAYER)
+ sprite->oam.matrixNum |= 0x18;
+
+ sprite->data[0] = 16;
+ sprite->data[1] = sprite->pos1.x;
+ sprite->data[2] = GetBattlerSpriteCoord(battler, 2);
+ sprite->data[3] = sprite->pos1.y;
+ sprite->data[4] = GetBattlerSpriteCoord(battler, 3);
+
+ InitAnimLinearTranslation(sprite);
+ StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
+ sprite->callback = sub_80A6F98;
+}
+
+static void sub_810D960(struct Sprite *sprite)
+{
+ if (sprite->data[0] == sprite->data[4])
+ DestroyAnimSprite(sprite);
+
+ sprite->data[0]++;
+}
+
+void sub_810D984(struct Sprite *sprite)
+{
+ u8 turn;
+
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
+ sprite->data[1] = gBattleAnimArgs[3];
+ sprite->data[2] = gBattleAnimArgs[0];
+ sprite->data[3] = gBattleAnimArgs[1];
+ sprite->data[4] = gBattleAnimArgs[2];
+
+ turn = gAnimMoveTurn;
+ if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
+ turn++;
+
+ if (turn & 1)
+ {
+ sprite->data[2] = -sprite->data[2];
+ sprite->data[1]++;
+ }
+
+ StartSpriteAnim(sprite, sprite->data[1]);
+ sprite->pos2.x = sprite->data[2];
+ sprite->pos2.y = sprite->data[3];
+ sprite->callback = sub_810D960;
+}
+
+void sub_810DA10(struct Sprite *sprite)
+{
+ if (gBattleAnimArgs[2] == 0)
+ InitAnimSpritePos(sprite, 0);
+ else
+ sub_80A6980(sprite, FALSE);
+
+ if (IsContest())
+ {
+ StartSpriteAnim(sprite, 2);
+ }
+ else if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
+ {
+ StartSpriteAnim(sprite, 1);
+ }
+
+ sprite->callback = sub_80A67D8;
+ StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
+}
+
+void sub_810DA7C(struct Sprite *sprite)
+{
+ if (sprite->affineAnimEnded)
+ {
+ sprite->data[1] = (sprite->data[1] + 40) & 0xFF;
+ sprite->pos2.x = Sin(sprite->data[1], 2);
+ if (++sprite->data[0] > 40)
+ DestroyAnimSprite(sprite);
+ }
+}
+
+void sub_810DABC(u8 taskId)
+{
+ struct Task *task = &gTasks[taskId];
+
+ switch (task->data[0])
+ {
+ case 0:
+ sub_80A6DAC(0);
+ task->data[8] = gBattleAnimArgs[0];
+ task->data[0]++;
+ break;
+ case 1:
+ if (--task->data[8] == -1)
+ task->data[0]++;
+ break;
+ case 2:
+ default:
+ task->data[9] += 1280;
+ break;
+ }
+
+ task->data[10] += 2816;
+
+ if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
+ gBattle_BG3_X += task->data[9] >> 8;
+ else
+ gBattle_BG3_X -= task->data[9] >> 8;
+
+ gBattle_BG3_Y += task->data[10] >> 8;
+ task->data[9] &= 0xFF;
+ task->data[10] &= 0xFF;
+
+ if (gBattleAnimArgs[7] == -1)
+ {
+ gBattle_BG3_X = 0;
+ gBattle_BG3_Y = 0;
+ sub_80A6DAC(1);
+ DestroyAnimVisualTask(taskId);
+ }
+}
diff --git a/src/fldeff_strength.c b/src/fldeff_strength.c
index c9b91f97f..f796ecea6 100644
--- a/src/fldeff_strength.c
+++ b/src/fldeff_strength.c
@@ -5,6 +5,7 @@
#include "party_menu.h"
#include "rom6.h"
#include "script.h"
+#include "string_util.h"
#include "task.h"
#include "constants/event_objects.h"
#include "constants/field_effects.h"
diff --git a/src/fossil_specials.c b/src/fossil_specials.c
index 49db0f5b6..8164a3a78 100644
--- a/src/fossil_specials.c
+++ b/src/fossil_specials.c
@@ -17,29 +17,32 @@
#include "task.h"
#include "window.h"
-#define MIRAGE_TOWER_GFX_LENGTH (sizeof(gUnknown_08617274) + sizeof(gMirageTower_Gfx))
+#define MIRAGE_TOWER_GFX_LENGTH (32 + sizeof(gMirageTower_Gfx))
#define MIRAGE_TOWER_PALETTE_LENGTH 0x800
#define ROOT_FOSSIL_GFX_LENGTH sizeof(gRootFossil_Gfx)
#define ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH 0x100
-//struct
-struct Struct8617DA4 {
+struct Struct8617DA4
+{
u8 x;
u8 y;
u16 tileId;
};
-struct Struct203CF10 {
+struct Struct203CF10
+{
u8 *buffer;
- u8 curr_buffer_index;
+ u8 currIndex;
};
-struct DynamicSpriteFrameImage{
+struct DynamicSpriteFrameImage
+{
u8 *data;
u16 size;
};
-struct Struct203CF0C {
+struct Struct203CF0C
+{
u8 *frameImageTiles;
struct DynamicSpriteFrameImage *frameImage;
u8 spriteId;
@@ -52,10 +55,10 @@ static void sub_81BED50(u8 taskId);
static void sub_81BEBF4(u8 taskId);
static void sub_81BF028(u8 taskId);
static void sub_81BF248(struct Sprite *);
-/*static*/ void sub_81BF2B8(u8* a, u16 b, u8 c, u8 d, u8 e);
+static void sub_81BF2B8(u8* a, u16 b, u8 c, u8 d, u8 e);
// .rodata
-static const u8 gUnknown_08617274[] = {00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00};
+static const u8 gUnknown_08617274[32] = {0};
static const u8 gMirageTower_Gfx[] = INCBIN_U8("graphics/misc/mirage_tower.4bpp");
static const u16 gUnknown_08617B94[] = INCBIN_U16("graphics/misc/mirage_tower.bin");
static const u16 gRootFossil_Pal[] = INCBIN_U16("graphics/misc/fossil.gbapal");
@@ -64,16 +67,16 @@ static const u8 gMirageTowerCrumbles_Gfx[] = INCBIN_U8("graphics/misc/mirage_tow
static const u16 gMirageTowerCrumbles_Palette[] = INCBIN_U16("graphics/misc/mirage_tower_crumbles.gbapal");
const s16 gUnknown_08617D64[][3] =
- {
- { 0, 10, 65},
- { 17, 3, 50},
- {-12, 0, 75},
- { 10, 15, 90},
- { 7, 8, 65},
- {-18, 5, 75},
- { 22, -10, 55},
- {-24, -4, 65},
- };
+{
+ { 0, 10, 65},
+ { 17, 3, 50},
+ {-12, 0, 75},
+ { 10, 15, 90},
+ { 7, 8, 65},
+ {-18, 5, 75},
+ { 22, -10, 55},
+ {-24, -4, 65},
+};
const struct SpriteSheet gUnknown_08617D94[] =
{
@@ -82,26 +85,26 @@ const struct SpriteSheet gUnknown_08617D94[] =
};
static const struct Struct8617DA4 gUnknown_08617DA4[] =
- {
- {0x12, 0x35, 0x251},
- {0x13, 0x35, 0x251},
- {0x14, 0x35, 0x251},
- {0x12, 0x36, 0x251},
- {0x13, 0x36, 0x251},
- {0x14, 0x36, 0x251},
- {0x12, 0x37, 0x251},
- {0x13, 0x37, 0x251},
- {0x14, 0x37, 0x251},
- {0x12, 0x38, 0x251},
- {0x13, 0x38, 0x251},
- {0x14, 0x38, 0x251},
- {0x12, 0x39, 0x259},
- {0x13, 0x39, 0x259},
- {0x14, 0x39, 0x259},
- {0x12, 0x3A, 0x121},
- {0x13, 0x3A, 0x121},
- {0x14, 0x3A, 0x121},
- };
+{
+ {0x12, 0x35, 0x251},
+ {0x13, 0x35, 0x251},
+ {0x14, 0x35, 0x251},
+ {0x12, 0x36, 0x251},
+ {0x13, 0x36, 0x251},
+ {0x14, 0x36, 0x251},
+ {0x12, 0x37, 0x251},
+ {0x13, 0x37, 0x251},
+ {0x14, 0x37, 0x251},
+ {0x12, 0x38, 0x251},
+ {0x13, 0x38, 0x251},
+ {0x14, 0x38, 0x251},
+ {0x12, 0x39, 0x259},
+ {0x13, 0x39, 0x259},
+ {0x14, 0x39, 0x259},
+ {0x12, 0x3A, 0x121},
+ {0x13, 0x3A, 0x121},
+ {0x14, 0x3A, 0x121},
+};
static const union AnimCmd gSpriteAnim_8617DEC[] =
{
@@ -131,67 +134,70 @@ static const union AnimCmd *const gSpriteAnimTable_8617DFC[] =
gSpriteAnim_8617DEC,
};
-static const struct SpriteTemplate gUnknown_08617E00 = {
+static const struct SpriteTemplate gUnknown_08617E00 =
+{
0xFFFF, 0xFFFF, &gOamData_8617DF4, gSpriteAnimTable_8617DFC, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
};
-// ewram
-EWRAM_DATA u8* gUnknown_0203CF04 = NULL;
-EWRAM_DATA u8* gUnknown_0203CF08 = NULL;
-EWRAM_DATA struct Struct203CF0C *gUnknown_0203CF0C = NULL;
-EWRAM_DATA struct Struct203CF10 *gUnknown_0203CF10 = NULL;
-EWRAM_DATA u16 *gUnknown_0203CF14 = NULL;
+// EWRAM
+EWRAM_DATA static u8* sUnknown_0203CF04 = NULL;
+EWRAM_DATA static u8* sUnknown_0203CF08 = NULL;
+EWRAM_DATA static struct Struct203CF0C *sUnknown_0203CF0C = NULL;
+EWRAM_DATA static struct Struct203CF10 *sUnknown_0203CF10 = NULL;
+EWRAM_DATA static u16 *sUnknown_0203CF14 = NULL;
-// iwram
-IWRAM_DATA u16 gUnknown_030012A8[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+// IWRAM bss
+IWRAM_DATA static u16 gUnknown_030012A8[8];
// text
void sub_81BEB24(void)
{
u8 i;
- for(i = 0; i < (sizeof(gUnknown_08617DA4)/sizeof(gUnknown_08617DA4[0])); i++)
+ for (i = 0; i < (sizeof(gUnknown_08617DA4)/sizeof(gUnknown_08617DA4[0])); i++)
MapGridSetMetatileIdAt(gUnknown_08617DA4[i].x + 7, gUnknown_08617DA4[i].y + 7, gUnknown_08617DA4[i].tileId);
DrawWholeMapView();
}
void sub_81BEB54(void)
{
- CreateTask(sub_81BED50, 0x9);
+ CreateTask(sub_81BED50, 9);
}
void sub_81BEB68(void)
{
- CreateTask(sub_81BEBF4, 0x9);
+ CreateTask(sub_81BEBF4, 9);
}
void sub_81BEB7C(void)
{
- CreateTask(sub_81BF028, 0x9);
+ CreateTask(sub_81BF028, 9);
}
void sub_81BEB90(void)
{
- SetGpuReg(REG_OFFSET_BG0HOFS, gUnknown_0203CF14[0]);
- SetGpuReg(REG_OFFSET_BG0VOFS, gUnknown_0203CF14[1]);
+ SetGpuReg(REG_OFFSET_BG0HOFS, sUnknown_0203CF14[0]);
+ SetGpuReg(REG_OFFSET_BG0VOFS, sUnknown_0203CF14[1]);
}
void sub_81BEBB4(u8 taskId)
{
- if(!(gTasks[taskId].data[0]))
+ if (!(gTasks[taskId].data[0]))
{
- gUnknown_0203CF14[0] = -gUnknown_0203CF14[0];
+ sUnknown_0203CF14[0] = -sUnknown_0203CF14[0];
gTasks[taskId].data[0] = 2;
sub_81BEB90();
}
else
+ {
gTasks[taskId].data[0]--;
+ }
}
static void sub_81BEBF4(u8 taskId)
{
u8 zero;
- switch(gTasks[taskId].data[0])
+ switch (gTasks[taskId].data[0])
{
case 0:
FreeAllWindowBuffers();
@@ -199,19 +205,19 @@ static void sub_81BEBF4(u8 taskId)
gTasks[taskId].data[0]++;
break;
case 1:
- gUnknown_0203CF04 = (u8 *)AllocZeroed(MIRAGE_TOWER_GFX_LENGTH);
- gUnknown_0203CF08 = (u8 *)AllocZeroed(MIRAGE_TOWER_PALETTE_LENGTH);
+ sUnknown_0203CF04 = (u8 *)AllocZeroed(MIRAGE_TOWER_GFX_LENGTH);
+ sUnknown_0203CF08 = (u8 *)AllocZeroed(MIRAGE_TOWER_PALETTE_LENGTH);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
gTasks[taskId].data[0]++;
break;
case 2:
- CpuSet(gUnknown_08617274, gUnknown_0203CF04, MIRAGE_TOWER_GFX_LENGTH / 2);
- LoadBgTiles(0, gUnknown_0203CF04, MIRAGE_TOWER_GFX_LENGTH, 0);
+ CpuSet(gUnknown_08617274, sUnknown_0203CF04, MIRAGE_TOWER_GFX_LENGTH / 2);
+ LoadBgTiles(0, sUnknown_0203CF04, MIRAGE_TOWER_GFX_LENGTH, 0);
gTasks[taskId].data[0]++;
break;
case 3:
- SetBgTilemapBuffer(0, gUnknown_0203CF08);
+ SetBgTilemapBuffer(0, sUnknown_0203CF08);
CopyToBgTilemapBufferRect_ChangePalette(0, &gUnknown_08617B94, 12, 29, 6, 12, 17);
CopyBgTilemapBufferToVram(0);
gTasks[taskId].data[0]++;
@@ -225,10 +231,10 @@ static void sub_81BEBF4(u8 taskId)
gTasks[taskId].data[0]++;
break;
case 6:
- gUnknown_0203CF14 = (u16 *)Alloc(4);
+ sUnknown_0203CF14 = Alloc(4);
zero = 0;
- gUnknown_0203CF14[0] = 2;
- gUnknown_0203CF14[1] = zero;
+ sUnknown_0203CF14[0] = 2;
+ sUnknown_0203CF14[1] = zero;
CreateTask(sub_81BEBB4, 0xA);
DestroyTask(taskId);
EnableBothScriptContexts();
@@ -236,86 +242,76 @@ static void sub_81BEBF4(u8 taskId)
}
}
-#ifdef NONMATCHING
#define OUTER_BUFFER_LENGTH 0x60
#define INNER_BUFFER_LENGTH 0x30
static void sub_81BED50(u8 taskId)
{
u8 anotherTaskId, j;
+ u16 i;
+ u8 index;
-
- switch(gTasks[taskId].data[0])
+ switch (gTasks[taskId].data[0])
{
case 1:
- gUnknown_0203CF10 = (struct Struct203CF10 *)AllocZeroed(OUTER_BUFFER_LENGTH * sizeof(struct Struct203CF10));
+ sUnknown_0203CF10 = AllocZeroed(OUTER_BUFFER_LENGTH * sizeof(struct Struct203CF10));
break;
case 3:
+ if (gTasks[taskId].data[3] <= (OUTER_BUFFER_LENGTH - 1))
{
- u16 i;
- u16 left;
- u32 index, next;
-
- index = (u16)gTasks[taskId].data[3];
- if(gTasks[taskId].data[3] <= (OUTER_BUFFER_LENGTH - 1))
+ if (gTasks[taskId].data[1] > 1)
{
- if(gTasks[taskId].data[1] > 1)
+ index = gTasks[taskId].data[3];
+ sUnknown_0203CF10[index].buffer = Alloc(INNER_BUFFER_LENGTH);
+ for (i = 0; i <= (INNER_BUFFER_LENGTH - 1); i++)
+ sUnknown_0203CF10[index].buffer[i] = i;
+ for (i = 0; i <= (INNER_BUFFER_LENGTH - 1); i++)
{
- index = (u8)index;
- gUnknown_0203CF10[index].buffer = (u8 *)Alloc(INNER_BUFFER_LENGTH);
- for(i = 0; i <= (INNER_BUFFER_LENGTH - 1); i++)
- gUnknown_0203CF10[index].buffer[i] = i;
- for(i = 0; i <= (INNER_BUFFER_LENGTH - 1); i++)
- {
- u16 rand1, rand2, temp;
-
- rand1 = Random() % 0x30;
- rand2 = Random() % 0x30;
- temp = gUnknown_0203CF10[index].buffer[rand2];
- gUnknown_0203CF10[index].buffer[rand2] = gUnknown_0203CF10[index].buffer[rand1];
- gUnknown_0203CF10[index].buffer[rand1] = temp;
- }
- if(gTasks[taskId].data[3] <= (OUTER_BUFFER_LENGTH - 1))
- gTasks[taskId].data[3]++;
- gTasks[taskId].data[1] = 0;
+ u16 rand1, rand2, temp;
+
+ rand1 = Random() % 0x30;
+ rand2 = Random() % 0x30;
+ SWAP(sUnknown_0203CF10[index].buffer[rand2], sUnknown_0203CF10[index].buffer[rand1], temp);
}
- gTasks[taskId].data[1]++;
+ if (gTasks[taskId].data[3] <= (OUTER_BUFFER_LENGTH - 1))
+ gTasks[taskId].data[3]++;
+ gTasks[taskId].data[1] = 0;
}
- index = (u8)gTasks[taskId].data[3];
- for(left = (u8)gTasks[taskId].data[2]; left < (u16)index; left = next)
+ gTasks[taskId].data[1]++;
+ }
+ index = gTasks[taskId].data[3];
+ for (i = (u8)(gTasks[taskId].data[2]); i < index; i++)
+ {
+ for (j = 0; j < 1; j++)
{
- j = 0;
- next = left + 1;
- while(!j)
- {
- sub_81BF2B8(gUnknown_0203CF04, ((((OUTER_BUFFER_LENGTH - 1) - left) * INNER_BUFFER_LENGTH) + gUnknown_0203CF10[left].buffer[(gUnknown_0203CF10[left].curr_buffer_index)++]), 0, INNER_BUFFER_LENGTH, 1);
- j++;
- }
- if(gUnknown_0203CF10[left].curr_buffer_index > (INNER_BUFFER_LENGTH - 1))
- {
- FREE_AND_SET_NULL(gUnknown_0203CF10[left].buffer);
- gTasks[taskId].data[2]++;
- if((left % 2) == 1)
- gUnknown_0203CF14[1]--;
- }
+ sub_81BF2B8(sUnknown_0203CF04,
+ ((((OUTER_BUFFER_LENGTH - 1) - i) * INNER_BUFFER_LENGTH) + sUnknown_0203CF10[i].buffer[(sUnknown_0203CF10[i].currIndex)++]),
+ 0, INNER_BUFFER_LENGTH, 1);
+ }
+ if (sUnknown_0203CF10[i].currIndex > (INNER_BUFFER_LENGTH - 1))
+ {
+ FREE_AND_SET_NULL(sUnknown_0203CF10[i].buffer);
+ gTasks[taskId].data[2]++;
+ if ((i % 2) == 1)
+ sUnknown_0203CF14[1]--;
}
- LoadBgTiles(0, gUnknown_0203CF04, MIRAGE_TOWER_GFX_LENGTH, 0);
- if(gUnknown_0203CF10[OUTER_BUFFER_LENGTH - 1].curr_buffer_index > (INNER_BUFFER_LENGTH - 1))
- break;
- return;
}
+ LoadBgTiles(0, sUnknown_0203CF04, MIRAGE_TOWER_GFX_LENGTH, 0);
+ if (sUnknown_0203CF10[OUTER_BUFFER_LENGTH - 1].currIndex > (INNER_BUFFER_LENGTH - 1))
+ break;
+ return;
case 4:
UnsetBgTilemapBuffer(0);
anotherTaskId = FindTaskIdByFunc(sub_81BEBB4);
- if(anotherTaskId != 0xFF)
+ if (anotherTaskId != 0xFF)
DestroyTask(anotherTaskId);
- gUnknown_0203CF14[1] = gUnknown_0203CF14[0] = 0;
+ sUnknown_0203CF14[1] = sUnknown_0203CF14[0] = 0;
sub_81BEB90();
break;
case 5:
- FREE_AND_SET_NULL(gUnknown_0203CF14);
- FREE_AND_SET_NULL(gUnknown_0203CF10);
- FREE_AND_SET_NULL(gUnknown_0203CF04);
- FREE_AND_SET_NULL(gUnknown_0203CF08);
+ FREE_AND_SET_NULL(sUnknown_0203CF14);
+ FREE_AND_SET_NULL(sUnknown_0203CF10);
+ FREE_AND_SET_NULL(sUnknown_0203CF04);
+ FREE_AND_SET_NULL(sUnknown_0203CF08);
break;
case 6:
SetGpuRegBits(REG_OFFSET_BG2CNT, 0x2);
@@ -334,423 +330,75 @@ static void sub_81BED50(u8 taskId)
gTasks[taskId].data[0]++;
}
-#else
-NAKED
-static void sub_81BED50(u8 taskId)
-{
- asm("\n\
- .syntax unified\n\
- push {r4-r7,lr}\n\
- mov r7, r10\n\
- mov r6, r9\n\
- mov r5, r8\n\
- push {r5-r7}\n\
- sub sp, 0x10\n\
- lsls r0, 24\n\
- lsrs r0, 24\n\
- mov r10, r0\n\
- ldr r1, =gTasks\n\
- lsls r0, 2\n\
- add r0, r10\n\
- lsls r0, 3\n\
- adds r0, r1\n\
- ldrh r0, [r0, 0x8]\n\
- subs r0, 0x1\n\
- lsls r0, 16\n\
- asrs r0, 16\n\
- adds r6, r1, 0\n\
- cmp r0, 0x7\n\
- bls _081BED7C\n\
- b _081BF002\n\
- _081BED7C:\n\
- lsls r0, 2\n\
- ldr r1, =_081BED90\n\
- adds r0, r1\n\
- ldr r0, [r0]\n\
- mov pc, r0\n\
- .pool\n\
- .align 2, 0\n\
- _081BED90:\n\
- .4byte _081BEDB0\n\
- .4byte _081BF002\n\
- .4byte _081BEDC4\n\
- .4byte _081BEF64\n\
- .4byte _081BEF94\n\
- .4byte _081BEFD0\n\
- .4byte _081BEFF0\n\
- .4byte _081BEFF8\n\
- _081BEDB0:\n\
- ldr r4, =gUnknown_0203CF10\n\
- movs r0, 0xC0\n\
- lsls r0, 2\n\
- bl AllocZeroed\n\
- str r0, [r4]\n\
- b _081BF002\n\
- .pool\n\
- _081BEDC4:\n\
- mov r1, r10\n\
- lsls r0, r1, 2\n\
- adds r1, r0, r1\n\
- lsls r1, 3\n\
- adds r2, r1, r6\n\
- ldrh r3, [r2, 0xE]\n\
- movs r4, 0xE\n\
- ldrsh r1, [r2, r4]\n\
- str r0, [sp, 0x8]\n\
- cmp r1, 0x5F\n\
- bgt _081BEE8A\n\
- movs r1, 0xA\n\
- ldrsh r0, [r2, r1]\n\
- cmp r0, 0x1\n\
- ble _081BEE7C\n\
- lsls r0, r3, 24\n\
- lsrs r4, r0, 24\n\
- movs r0, 0x30\n\
- bl Alloc\n\
- ldr r3, =gUnknown_0203CF10\n\
- ldr r1, [r3]\n\
- lsls r2, r4, 3\n\
- adds r1, r2, r1\n\
- str r0, [r1]\n\
- movs r5, 0\n\
- adds r4, r2, 0\n\
- _081BEDFA:\n\
- ldr r0, [r3]\n\
- adds r0, r4, r0\n\
- ldr r0, [r0]\n\
- adds r0, r5\n\
- strb r5, [r0]\n\
- adds r0, r5, 0x1\n\
- lsls r0, 16\n\
- lsrs r5, r0, 16\n\
- cmp r5, 0x2F\n\
- bls _081BEDFA\n\
- movs r5, 0\n\
- ldr r7, =gUnknown_0203CF10\n\
- adds r6, r2, 0\n\
- _081BEE14:\n\
- bl Random\n\
- lsls r0, 16\n\
- lsrs r0, 16\n\
- movs r1, 0x30\n\
- bl __umodsi3\n\
- adds r4, r0, 0\n\
- lsls r4, 16\n\
- lsrs r4, 16\n\
- bl Random\n\
- lsls r0, 16\n\
- lsrs r0, 16\n\
- movs r1, 0x30\n\
- bl __umodsi3\n\
- lsls r0, 16\n\
- lsrs r0, 16\n\
- ldr r1, [r7]\n\
- adds r1, r6, r1\n\
- ldr r1, [r1]\n\
- adds r0, r1, r0\n\
- ldrb r2, [r0]\n\
- adds r1, r4 \n\
- ldrb r1, [r1]\n\
- strb r1, [r0]\n\
- ldr r0, [r7]\n\
- adds r0, r6, r0\n\
- ldr r0, [r0]\n\
- adds r0, r4\n\
- strb r2, [r0]\n\
- adds r0, r5, 0x1\n\
- lsls r0, 16\n\
- lsrs r5, r0, 16\n\
- cmp r5, 0x2F\n\
- bls _081BEE14\n\
- ldr r0, =gTasks\n\
- ldr r1, [sp, 0x8]\n\
- add r1, r10\n\
- lsls r1, 3\n\
- adds r2, r1, r0\n\
- ldrh r3, [r2, 0xE]\n\
- movs r4, 0xE\n\
- ldrsh r1, [r2, r4]\n\
- adds r6, r0, 0\n\
- cmp r1, 0x5F\n\
- bgt _081BEE78\n\
- adds r0, r3, 0x1\n\
- strh r0, [r2, 0xE]\n\
- _081BEE78:\n\
- movs r0, 0\n\
- strh r0, [r2, 0xA]\n\
- _081BEE7C:\n\
- ldr r1, [sp, 0x8]\n\
- add r1, r10\n\
- lsls r1, 3\n\
- adds r1, r6\n\
- ldrh r0, [r1, 0xA]\n\
- adds r0, 0x1\n\
- strh r0, [r1, 0xA]\n\
- _081BEE8A:\n\
- ldr r0, [sp, 0x8]\n\
- add r0, r10\n\
- lsls r0, 3\n\
- adds r0, r6\n\
- ldrb r4, [r0, 0xE]\n\
- ldrb r5, [r0, 0xC]\n\
- lsls r0, r4, 16\n\
- cmp r5, r4\n\
- bcs _081BEF32\n\
- str r0, [sp, 0xC]\n\
- _081BEE9E:\n\
- movs r6, 0\n\
- adds r0, r5, 0x1\n\
- str r0, [sp, 0x4]\n\
- lsls r4, r5, 3\n\
- movs r2, 0x5F\n\
- subs r1, r2, r5\n\
- lsls r0, r1, 1\n\
- adds r0, r1\n\
- lsls r0, 4\n\
- mov r9, r0\n\
- _081BEEB2:\n\
- ldr r0, =gUnknown_0203CF04\n\
- ldr r0, [r0]\n\
- ldr r7, =gUnknown_0203CF10\n\
- ldr r3, [r7]\n\
- adds r3, r4, r3\n\
- ldrb r2, [r3, 0x4]\n\
- adds r1, r2, 0x1\n\
- strb r1, [r3, 0x4]\n\
- lsls r2, 24\n\
- lsrs r2, 24\n\
- ldr r1, [r3]\n\
- adds r1, r2\n\
- ldrb r1, [r1]\n\
- add r1, r9\n\
- lsls r1, 16\n\
- lsrs r1, 16\n\
- movs r2, 0x1\n\
- mov r8, r2\n\
- str r2, [sp]\n\
- movs r2, 0\n\
- movs r3, 0x30\n\
- bl sub_81BF2B8\n\
- adds r0, r6, 0x1\n\
- lsls r0, 24\n\
- lsrs r6, r0, 24\n\
- cmp r6, 0\n\
- beq _081BEEB2\n\
- ldr r0, [r7]\n\
- adds r1, r4, r0\n\
- ldrb r0, [r1, 0x4]\n\
- cmp r0, 0x2F\n\
- bls _081BEF24\n\
- ldr r0, [r1]\n\
- bl Free\n\
- ldr r0, [r7]\n\
- adds r0, r4, r0\n\
- movs r1, 0\n\
- str r1, [r0]\n\
- ldr r1, [sp, 0x8]\n\
- add r1, r10\n\
- lsls r1, 3\n\
- ldr r4, =gTasks\n\
- adds r1, r4\n\
- ldrh r0, [r1, 0xC]\n\
- adds r0, 0x1\n\
- strh r0, [r1, 0xC]\n\
- mov r0, r8\n\
- ands r5, r0\n\
- cmp r5, 0x1\n\
- bne _081BEF24\n\
- ldr r0, =gUnknown_0203CF14\n\
- ldr r1, [r0]\n\
- ldrh r0, [r1, 0x2]\n\
- subs r0, 0x1\n\
- strh r0, [r1, 0x2]\n\
- _081BEF24:\n\
- ldr r1, [sp, 0x4]\n\
- lsls r0, r1, 16\n\
- lsrs r5, r0, 16\n\
- ldr r2, [sp, 0xC]\n\
- lsrs r0, r2, 16\n\
- cmp r5, r0\n\
- bcc _081BEE9E\n\
- _081BEF32:\n\
- ldr r0, =gUnknown_0203CF04\n\
- ldr r1, [r0]\n\
- movs r2, 0x92\n\
- lsls r2, 4\n\
- movs r0, 0\n\
- movs r3, 0\n\
- bl LoadBgTiles\n\
- ldr r0, =gUnknown_0203CF10\n\
- ldr r0, [r0]\n\
- movs r4, 0xBE\n\
- lsls r4, 2\n\
- adds r0, r4\n\
- ldrb r0, [r0, 0x4]\n\
- cmp r0, 0x2F\n\
- bhi _081BF002\n\
- b _081BF014\n\
- .pool\n\
- _081BEF64:\n\
- movs r0, 0\n\
- bl UnsetBgTilemapBuffer\n\
- ldr r0, =sub_81BEBB4\n\
- bl FindTaskIdByFunc\n\
- lsls r0, 24\n\
- lsrs r0, 24\n\
- cmp r0, 0xFF\n\
- beq _081BEF7C\n\
- bl DestroyTask\n\
- _081BEF7C:\n\
- ldr r0, =gUnknown_0203CF14\n\
- ldr r1, [r0]\n\
- movs r0, 0\n\
- strh r0, [r1]\n\
- strh r0, [r1, 0x2]\n\
- bl sub_81BEB90\n\
- b _081BF002\n\
- .pool\n\
- _081BEF94:\n\
- ldr r4, =gUnknown_0203CF14\n\
- ldr r0, [r4]\n\
- bl Free\n\
- movs r5, 0\n\
- str r5, [r4]\n\
- ldr r4, =gUnknown_0203CF10\n\
- ldr r0, [r4]\n\
- bl Free\n\
- str r5, [r4]\n\
- ldr r4, =gUnknown_0203CF04\n\
- ldr r0, [r4]\n\
- bl Free\n\
- str r5, [r4]\n\
- ldr r4, =gUnknown_0203CF08\n\
- ldr r0, [r4]\n\
- bl Free\n\
- str r5, [r4]\n\
- b _081BF002\n\
- .pool\n\
- _081BEFD0:\n\
- movs r0, 0xC\n\
- movs r1, 0x2\n\
- bl SetGpuRegBits\n\
- movs r0, 0x8\n\
- movs r1, 0\n\
- bl SetGpuRegBits\n\
- movs r0, 0\n\
- movs r1, 0x7\n\
- movs r2, 0\n\
- bl SetBgAttribute\n\
- bl sub_81971D0\n\
- b _081BF002\n\
- _081BEFF0:\n\
- movs r0, 0\n\
- bl ShowBg\n\
- b _081BF002\n\
- _081BEFF8:\n\
- mov r0, r10\n\
- bl DestroyTask\n\
- bl EnableBothScriptContexts\n\
- _081BF002:\n\
- ldr r0, =gTasks\n\
- mov r2, r10\n\
- lsls r1, r2, 2\n\
- add r1, r10\n\
- lsls r1, 3\n\
- adds r1, r0\n\
- ldrh r0, [r1, 0x8]\n\
- adds r0, 0x1\n\
- strh r0, [r1, 0x8]\n\
- _081BF014:\n\
- add sp, 0x10\n\
- pop {r3-r5}\n\
- mov r8, r3\n\
- mov r9, r4\n\
- mov r10, r5\n\
- pop {r4-r7}\n\
- pop {r0}\n\
- bx r0\n\
- .pool\n\
- .syntax divided");
-}
-#endif // NONMATCHING
-
static void sub_81BF028(u8 taskId)
{
u16 i;
+ u8 *buffer;
- switch(gTasks[taskId].data[0])
+ switch (gTasks[taskId].data[0])
{
case 1:
- gUnknown_0203CF0C = (struct Struct203CF0C *)AllocZeroed(sizeof(struct Struct203CF0C));
- gUnknown_0203CF0C->frameImageTiles = (u8 *)AllocZeroed(ROOT_FOSSIL_GFX_LENGTH);
- gUnknown_0203CF0C->frameImage = (struct DynamicSpriteFrameImage *) AllocZeroed(sizeof(struct DynamicSpriteFrameImage));
- gUnknown_0203CF0C->unkC = (u16 *)AllocZeroed(ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH * sizeof(u16));
- gUnknown_0203CF0C->unk10 = 0;
+ sUnknown_0203CF0C = AllocZeroed(sizeof(*sUnknown_0203CF0C));
+ sUnknown_0203CF0C->frameImageTiles = AllocZeroed(ROOT_FOSSIL_GFX_LENGTH);
+ sUnknown_0203CF0C->frameImage = AllocZeroed(sizeof(*sUnknown_0203CF0C->frameImage));
+ sUnknown_0203CF0C->unkC = AllocZeroed(ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH * sizeof(u16));
+ sUnknown_0203CF0C->unk10 = 0;
break;
case 2:
- {
- u8 *buffer;
- buffer = gUnknown_0203CF0C->frameImageTiles;
- for(i = 0; i < ROOT_FOSSIL_GFX_LENGTH; i++, buffer++)
- *buffer = gRootFossil_Gfx[i];
- }
+ buffer = sUnknown_0203CF0C->frameImageTiles;
+ for (i = 0; i < ROOT_FOSSIL_GFX_LENGTH; i++, buffer++)
+ *buffer = gRootFossil_Gfx[i];
break;
case 3:
- gUnknown_0203CF0C->frameImage->data = gUnknown_0203CF0C->frameImageTiles;
- gUnknown_0203CF0C->frameImage->size = ROOT_FOSSIL_GFX_LENGTH;
+ sUnknown_0203CF0C->frameImage->data = sUnknown_0203CF0C->frameImageTiles;
+ sUnknown_0203CF0C->frameImage->size = ROOT_FOSSIL_GFX_LENGTH;
break;
case 4:
{
- u8 spriteId, zero;
struct SpriteTemplate fossilTemplate;
fossilTemplate = gUnknown_08617E00;
- fossilTemplate.images = (struct SpriteFrameImage *)(gUnknown_0203CF0C->frameImage);
- spriteId = CreateSprite(&fossilTemplate, 128, -16, 1);
- gUnknown_0203CF0C->spriteId = spriteId;
- zero = 0;
- gSprites[gUnknown_0203CF0C->spriteId].centerToCornerVecX = zero;
- gSprites[gUnknown_0203CF0C->spriteId].data[0] = gSprites[gUnknown_0203CF0C->spriteId].pos1.x;
- gSprites[gUnknown_0203CF0C->spriteId].data[1] = 1;
+ fossilTemplate.images = (struct SpriteFrameImage *)(sUnknown_0203CF0C->frameImage);
+ sUnknown_0203CF0C->spriteId = CreateSprite(&fossilTemplate, 128, -16, 1);
+ gSprites[sUnknown_0203CF0C->spriteId].centerToCornerVecX = 0;
+ gSprites[sUnknown_0203CF0C->spriteId].data[0] = gSprites[sUnknown_0203CF0C->spriteId].pos1.x;
+ gSprites[sUnknown_0203CF0C->spriteId].data[1] = 1;
}
case 5:
- for(i = 0; i < ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH; i++)
- gUnknown_0203CF0C->unkC[i] = i;
+ for (i = 0; i < ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH; i++)
+ sUnknown_0203CF0C->unkC[i] = i;
break;
case 6:
+ for (i = 0; i < (ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH * sizeof(u16)); i++)
{
- u16 rand1, rand2, temp, j;
- j = (ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH * sizeof(u16)) - 1;
- for(i = 0; i <= j; i++)
- {
- rand1 = Random() % 0x100;
- rand2 = Random() % 0x100;
- j = (ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH * sizeof(u16)) - 1;
- temp = gUnknown_0203CF0C->unkC[rand2];
- gUnknown_0203CF0C->unkC[rand2] = gUnknown_0203CF0C->unkC[rand1];
- gUnknown_0203CF0C->unkC[rand1] = temp;
- }
- gSprites[gUnknown_0203CF0C->spriteId].callback = sub_81BF248;
- break;
+ u16 rand1, rand2, temp;
+
+ rand1 = Random() % 0x100;
+ rand2 = Random() % 0x100;
+ SWAP(sUnknown_0203CF0C->unkC[rand2], sUnknown_0203CF0C->unkC[rand1], temp);
}
+ gSprites[sUnknown_0203CF0C->spriteId].callback = sub_81BF248;
+ break;
case 7:
- if(gSprites[gUnknown_0203CF0C->spriteId].callback != SpriteCallbackDummy)
+ if (gSprites[sUnknown_0203CF0C->spriteId].callback != SpriteCallbackDummy)
return;
- DestroySprite(&gSprites[gUnknown_0203CF0C->spriteId]);
- FREE_AND_SET_NULL(gUnknown_0203CF0C->unkC);;
- FREE_AND_SET_NULL(gUnknown_0203CF0C->frameImage);
- FREE_AND_SET_NULL(gUnknown_0203CF0C->frameImageTiles);
- FREE_AND_SET_NULL(gUnknown_0203CF0C);
+ DestroySprite(&gSprites[sUnknown_0203CF0C->spriteId]);
+ FREE_AND_SET_NULL(sUnknown_0203CF0C->unkC);;
+ FREE_AND_SET_NULL(sUnknown_0203CF0C->frameImage);
+ FREE_AND_SET_NULL(sUnknown_0203CF0C->frameImageTiles);
+ FREE_AND_SET_NULL(sUnknown_0203CF0C);
break;
case 8:
EnableBothScriptContexts();
+ break;
}
- ++gTasks[taskId].data[0];
+
+ gTasks[taskId].data[0]++;
}
static void sub_81BF248(struct Sprite *sprite)
{
- if (gUnknown_0203CF0C->unk10 >= (ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH))
+ if (sUnknown_0203CF0C->unk10 >= (ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH))
{
sprite->callback = SpriteCallbackDummy;
}
@@ -759,7 +407,7 @@ static void sub_81BF248(struct Sprite *sprite)
u8 i;
for (i = 0; i < 2; i++)
{
- sub_81BF2B8(gUnknown_0203CF0C->frameImageTiles, gUnknown_0203CF0C->unkC[gUnknown_0203CF0C->unk10++], 0, 16, 0);
+ sub_81BF2B8(sUnknown_0203CF0C->frameImageTiles, sUnknown_0203CF0C->unkC[sUnknown_0203CF0C->unk10++], 0, 16, 0);
}
StartSpriteAnim(sprite, 0);
}
@@ -768,3 +416,146 @@ static void sub_81BF248(struct Sprite *sprite)
sprite->pos1.y++;
}
}
+
+#ifdef NONMATCHING
+static void sub_81BF2B8(u8* a, u16 b, u8 c, u8 d, u8 e)
+{
+ u8 r5, r4, r0, r2;
+ u16 var;
+
+ r4 = r5 = b / d;
+ gUnknown_030012A8[0] = r4;
+
+ r0 = r2 = b % d;
+ gUnknown_030012A8[1] = r2;
+
+ r4 &= 7;
+ r2 &= 7;
+ gUnknown_030012A8[2] = r4;
+ gUnknown_030012A8[3] = r2;
+
+ r0 /= 8;
+ r5 /= 8;
+ gUnknown_030012A8[4] = r0;
+ gUnknown_030012A8[5] = r5;
+
+ var = ((d / 8) * (r5 * 64)) + (r0 * 64);
+ gUnknown_030012A8[6] = var;
+
+ var += (r4 * 8) + r2;
+ gUnknown_030012A8[7] = var;
+
+ // This part is non-matching. 99% sure it IS functionally equivalent, though.
+ b = (b & 1) ^ 1;
+ c = (c << ((b) << 2)) | (15 << ((b ^ 1) << 2));
+
+ a[(var / 2) + (e * 32)] &= c;
+}
+
+#else
+NAKED
+static void sub_81BF2B8(u8* a, u16 b, u8 c, u8 d, u8 e)
+{
+ asm_unified("\n\
+ push {r4-r7,lr}\n\
+ mov r7, r10\n\
+ mov r6, r9\n\
+ mov r5, r8\n\
+ push {r5-r7}\n\
+ sub sp, 0x8\n\
+ str r0, [sp]\n\
+ mov r10, r1\n\
+ adds r6, r2, 0\n\
+ mov r8, r3\n\
+ ldr r0, [sp, 0x28]\n\
+ mov r9, r0\n\
+ lsls r1, 16\n\
+ lsrs r1, 16\n\
+ mov r10, r1\n\
+ lsls r6, 24\n\
+ lsrs r6, 24\n\
+ mov r0, r8\n\
+ lsls r0, 24\n\
+ mov r8, r0\n\
+ lsrs r7, r0, 24\n\
+ mov r1, r9\n\
+ lsls r1, 24\n\
+ lsrs r1, 24\n\
+ mov r9, r1\n\
+ mov r0, r10\n\
+ adds r1, r7, 0\n\
+ bl __divsi3\n\
+ adds r5, r0, 0\n\
+ lsls r5, 24\n\
+ lsrs r4, r5, 24\n\
+ ldr r3, =gUnknown_030012A8\n\
+ strh r4, [r3]\n\
+ mov r0, r10\n\
+ adds r1, r7, 0\n\
+ str r3, [sp, 0x4]\n\
+ bl __modsi3\n\
+ lsls r0, 24\n\
+ lsrs r2, r0, 24\n\
+ ldr r3, [sp, 0x4]\n\
+ strh r2, [r3, 0x2]\n\
+ movs r1, 0x7\n\
+ ands r4, r1\n\
+ ands r2, r1\n\
+ strh r4, [r3, 0x4]\n\
+ strh r2, [r3, 0x6]\n\
+ lsrs r0, 27\n\
+ lsrs r5, 27\n\
+ strh r0, [r3, 0x8]\n\
+ strh r5, [r3, 0xA]\n\
+ mov r1, r8\n\
+ lsrs r1, 27\n\
+ lsls r1, 6\n\
+ mov r8, r1\n\
+ mov r1, r8\n\
+ muls r1, r5\n\
+ lsls r0, 6\n\
+ adds r1, r0\n\
+ lsls r1, 16\n\
+ lsrs r1, 16\n\
+ strh r1, [r3, 0xC]\n\
+ lsls r4, 3\n\
+ adds r4, r2\n\
+ adds r1, r4\n\
+ lsls r4, r1, 16\n\
+ lsrs r4, 17\n\
+ strh r1, [r3, 0xE]\n\
+ movs r1, 0x1\n\
+ mov r0, r10\n\
+ ands r1, r0\n\
+ movs r2, 0x1\n\
+ eors r1, r2\n\
+ lsls r0, r1, 2\n\
+ lsls r6, r0\n\
+ eors r1, r2\n\
+ lsls r1, 2\n\
+ movs r0, 0xF\n\
+ lsls r0, r1\n\
+ orrs r6, r0\n\
+ lsls r6, 24\n\
+ lsrs r6, 24\n\
+ mov r1, r9\n\
+ lsls r1, 5\n\
+ mov r9, r1\n\
+ add r9, r4\n\
+ ldr r1, [sp]\n\
+ add r1, r9\n\
+ ldrb r0, [r1]\n\
+ ands r6, r0\n\
+ strb r6, [r1]\n\
+ add sp, 0x8\n\
+ pop {r3-r5}\n\
+ mov r8, r3\n\
+ mov r9, r4\n\
+ mov r10, r5\n\
+ pop {r4-r7}\n\
+ pop {r0}\n\
+ bx r0\n\
+ .pool\n\
+ ");
+}
+#endif // NONMATCHING
diff --git a/src/frontier_util.c b/src/frontier_util.c
index a65d14784..a35088f6f 100644
--- a/src/frontier_util.c
+++ b/src/frontier_util.c
@@ -36,7 +36,7 @@
#include "constants/items.h"
#include "constants/event_objects.h"
-extern u8 gUnknown_0203CEF8[];
+extern u8 gSelectedOrderFromParty[];
struct FrontierBrainMon
{
@@ -111,397 +111,397 @@ static const struct FrontierBrainMon sFrontierBrainsMons[][2][3] =
// Silver Symbol.
{
{
- .species = SPECIES_ALAKAZAM,
- .heldItem = ITEM_BRIGHT_POWDER,
- .fixedIV = 24,
- .nature = 15,
- .evs = {106, 0, 152, 152, 100, 0},
- .moves = {MOVE_THUNDER_PUNCH, MOVE_FIRE_PUNCH, MOVE_ICE_PUNCH, MOVE_DISABLE},
+ .species = SPECIES_ALAKAZAM,
+ .heldItem = ITEM_BRIGHT_POWDER,
+ .fixedIV = 24,
+ .nature = 15,
+ .evs = {106, 0, 152, 152, 100, 0},
+ .moves = {MOVE_THUNDER_PUNCH, MOVE_FIRE_PUNCH, MOVE_ICE_PUNCH, MOVE_DISABLE},
},
{
- .species = SPECIES_ENTEI,
- .heldItem = ITEM_LUM_BERRY,
- .fixedIV = 24,
- .nature = 1,
- .evs = {100, 152, 152, 0, 100, 6},
- .moves = {MOVE_FIRE_BLAST, MOVE_CALM_MIND, MOVE_RETURN, MOVE_ROAR},
+ .species = SPECIES_ENTEI,
+ .heldItem = ITEM_LUM_BERRY,
+ .fixedIV = 24,
+ .nature = 1,
+ .evs = {100, 152, 152, 0, 100, 6},
+ .moves = {MOVE_FIRE_BLAST, MOVE_CALM_MIND, MOVE_RETURN, MOVE_ROAR},
},
{
- .species = SPECIES_SNORLAX,
- .heldItem = ITEM_QUICK_CLAW,
- .fixedIV = 24,
- .nature = 3,
- .evs = {152, 152, 0, 0, 106, 100},
- .moves = {MOVE_BODY_SLAM, MOVE_BELLY_DRUM, MOVE_YAWN, MOVE_SHADOW_BALL},
+ .species = SPECIES_SNORLAX,
+ .heldItem = ITEM_QUICK_CLAW,
+ .fixedIV = 24,
+ .nature = 3,
+ .evs = {152, 152, 0, 0, 106, 100},
+ .moves = {MOVE_BODY_SLAM, MOVE_BELLY_DRUM, MOVE_YAWN, MOVE_SHADOW_BALL},
},
},
// Gold Symbol.
{
{
- .species = SPECIES_RAIKOU,
- .heldItem = ITEM_LUM_BERRY,
- .fixedIV = 31,
- .nature = 15,
- .evs = {158, 0, 252, 100, 0, 0},
- .moves = {MOVE_THUNDERBOLT, MOVE_CALM_MIND, MOVE_REFLECT, MOVE_REST},
+ .species = SPECIES_RAIKOU,
+ .heldItem = ITEM_LUM_BERRY,
+ .fixedIV = 31,
+ .nature = 15,
+ .evs = {158, 0, 252, 100, 0, 0},
+ .moves = {MOVE_THUNDERBOLT, MOVE_CALM_MIND, MOVE_REFLECT, MOVE_REST},
},
{
- .species = SPECIES_LATIOS,
- .heldItem = ITEM_BRIGHT_POWDER,
- .fixedIV = 31,
- .nature = 15,
- .evs = {252, 0, 252, 6, 0, 0},
- .moves = {MOVE_PSYCHIC, MOVE_CALM_MIND, MOVE_RECOVER, MOVE_DRAGON_CLAW},
+ .species = SPECIES_LATIOS,
+ .heldItem = ITEM_BRIGHT_POWDER,
+ .fixedIV = 31,
+ .nature = 15,
+ .evs = {252, 0, 252, 6, 0, 0},
+ .moves = {MOVE_PSYCHIC, MOVE_CALM_MIND, MOVE_RECOVER, MOVE_DRAGON_CLAW},
},
{
- .species = SPECIES_SNORLAX,
- .heldItem = ITEM_CHESTO_BERRY,
- .fixedIV = 31,
- .nature = 3,
- .evs = {252, 252, 0, 0, 6, 0},
- .moves = {MOVE_CURSE, MOVE_RETURN, MOVE_REST, MOVE_SHADOW_BALL},
+ .species = SPECIES_SNORLAX,
+ .heldItem = ITEM_CHESTO_BERRY,
+ .fixedIV = 31,
+ .nature = 3,
+ .evs = {252, 252, 0, 0, 6, 0},
+ .moves = {MOVE_CURSE, MOVE_RETURN, MOVE_REST, MOVE_SHADOW_BALL},
},
},
},
- [FRONTIER_FACILITY_DOME] =
- {
+ [FRONTIER_FACILITY_DOME] =
+ {
// Silver Symbol.
{
{
- .species = SPECIES_SWAMPERT,
- .heldItem = ITEM_FOCUS_BAND,
- .fixedIV = 20,
- .nature = 2,
- .evs = {152, 152, 106, 0, 100, 0},
- .moves = {MOVE_SURF, MOVE_EARTHQUAKE, MOVE_ICE_BEAM, MOVE_COUNTER},
+ .species = SPECIES_SWAMPERT,
+ .heldItem = ITEM_FOCUS_BAND,
+ .fixedIV = 20,
+ .nature = 2,
+ .evs = {152, 152, 106, 0, 100, 0},
+ .moves = {MOVE_SURF, MOVE_EARTHQUAKE, MOVE_ICE_BEAM, MOVE_COUNTER},
},
{
- .species = SPECIES_SALAMENCE,
- .heldItem = ITEM_LUM_BERRY,
- .fixedIV = 20,
- .nature = 3,
- .evs = {152, 152, 106, 100, 0, 0},
- .moves = {MOVE_EARTHQUAKE, MOVE_BRICK_BREAK, MOVE_DRAGON_CLAW, MOVE_AERIAL_ACE},
+ .species = SPECIES_SALAMENCE,
+ .heldItem = ITEM_LUM_BERRY,
+ .fixedIV = 20,
+ .nature = 3,
+ .evs = {152, 152, 106, 100, 0, 0},
+ .moves = {MOVE_EARTHQUAKE, MOVE_BRICK_BREAK, MOVE_DRAGON_CLAW, MOVE_AERIAL_ACE},
},
{
- .species = SPECIES_CHARIZARD,
- .heldItem = ITEM_WHITE_HERB,
- .fixedIV = 20,
- .nature = 17,
- .evs = {100, 152, 106, 152, 0, 0},
- .moves = {MOVE_OVERHEAT, MOVE_ROCK_SLIDE, MOVE_AERIAL_ACE, MOVE_EARTHQUAKE},
+ .species = SPECIES_CHARIZARD,
+ .heldItem = ITEM_WHITE_HERB,
+ .fixedIV = 20,
+ .nature = 17,
+ .evs = {100, 152, 106, 152, 0, 0},
+ .moves = {MOVE_OVERHEAT, MOVE_ROCK_SLIDE, MOVE_AERIAL_ACE, MOVE_EARTHQUAKE},
},
},
// Gold Symbol.
{
{
- .species = SPECIES_SWAMPERT,
- .heldItem = ITEM_LEFTOVERS,
- .fixedIV = 31,
- .nature = 2,
- .evs = {252, 252, 6, 0, 0, 0},
- .moves = {MOVE_SURF, MOVE_EARTHQUAKE, MOVE_ICE_BEAM, MOVE_MIRROR_COAT},
+ .species = SPECIES_SWAMPERT,
+ .heldItem = ITEM_LEFTOVERS,
+ .fixedIV = 31,
+ .nature = 2,
+ .evs = {252, 252, 6, 0, 0, 0},
+ .moves = {MOVE_SURF, MOVE_EARTHQUAKE, MOVE_ICE_BEAM, MOVE_MIRROR_COAT},
},
{
- .species = SPECIES_METAGROSS,
- .heldItem = ITEM_QUICK_CLAW,
- .fixedIV = 31,
- .nature = 2,
- .evs = {252, 252, 6, 0, 0, 0},
- .moves = {MOVE_PSYCHIC, MOVE_METEOR_MASH, MOVE_EARTHQUAKE, MOVE_PROTECT},
+ .species = SPECIES_METAGROSS,
+ .heldItem = ITEM_QUICK_CLAW,
+ .fixedIV = 31,
+ .nature = 2,
+ .evs = {252, 252, 6, 0, 0, 0},
+ .moves = {MOVE_PSYCHIC, MOVE_METEOR_MASH, MOVE_EARTHQUAKE, MOVE_PROTECT},
},
{
- .species = SPECIES_LATIAS,
- .heldItem = ITEM_CHESTO_BERRY,
- .fixedIV = 31,
- .nature = 15,
- .evs = {252, 0, 252, 6, 0, 0},
- .moves = {MOVE_THUNDERBOLT, MOVE_PSYCHIC, MOVE_CALM_MIND, MOVE_REST},
+ .species = SPECIES_LATIAS,
+ .heldItem = ITEM_CHESTO_BERRY,
+ .fixedIV = 31,
+ .nature = 15,
+ .evs = {252, 0, 252, 6, 0, 0},
+ .moves = {MOVE_THUNDERBOLT, MOVE_PSYCHIC, MOVE_CALM_MIND, MOVE_REST},
},
},
},
- [FRONTIER_FACILITY_PALACE] =
- {
+ [FRONTIER_FACILITY_PALACE] =
+ {
// Silver Symbol.
{
{
- .species = SPECIES_CROBAT,
- .heldItem = ITEM_BRIGHT_POWDER,
- .fixedIV = 16,
- .nature = 3,
- .evs = {152, 0, 0, 152, 100, 106},
- .moves = {MOVE_CONFUSE_RAY, MOVE_DOUBLE_TEAM, MOVE_TOXIC, MOVE_FLY},
+ .species = SPECIES_CROBAT,
+ .heldItem = ITEM_BRIGHT_POWDER,
+ .fixedIV = 16,
+ .nature = 3,
+ .evs = {152, 0, 0, 152, 100, 106},
+ .moves = {MOVE_CONFUSE_RAY, MOVE_DOUBLE_TEAM, MOVE_TOXIC, MOVE_FLY},
},
{
- .species = SPECIES_SLAKING,
- .heldItem = ITEM_SCOPE_LENS,
- .fixedIV = 16,
- .nature = 0,
- .evs = {152, 152, 0, 106, 100, 0},
- .moves = {MOVE_EARTHQUAKE, MOVE_SWAGGER, MOVE_SHADOW_BALL, MOVE_BRICK_BREAK},
+ .species = SPECIES_SLAKING,
+ .heldItem = ITEM_SCOPE_LENS,
+ .fixedIV = 16,
+ .nature = 0,
+ .evs = {152, 152, 0, 106, 100, 0},
+ .moves = {MOVE_EARTHQUAKE, MOVE_SWAGGER, MOVE_SHADOW_BALL, MOVE_BRICK_BREAK},
},
{
- .species = SPECIES_LAPRAS,
- .heldItem = ITEM_QUICK_CLAW,
- .fixedIV = 16,
- .nature = 17,
- .evs = {0, 0, 252, 0, 106, 152},
- .moves = {MOVE_ICE_BEAM, MOVE_HORN_DRILL, MOVE_CONFUSE_RAY, MOVE_PROTECT},
+ .species = SPECIES_LAPRAS,
+ .heldItem = ITEM_QUICK_CLAW,
+ .fixedIV = 16,
+ .nature = 17,
+ .evs = {0, 0, 252, 0, 106, 152},
+ .moves = {MOVE_ICE_BEAM, MOVE_HORN_DRILL, MOVE_CONFUSE_RAY, MOVE_PROTECT},
},
},
// Gold Symbol.
{
{
- .species = SPECIES_ARCANINE,
- .heldItem = ITEM_WHITE_HERB,
- .fixedIV = 31,
- .nature = 11,
- .evs = {6, 252, 252, 0, 0, 0},
- .moves = {MOVE_OVERHEAT, MOVE_EXTREME_SPEED, MOVE_ROAR, MOVE_PROTECT},
+ .species = SPECIES_ARCANINE,
+ .heldItem = ITEM_WHITE_HERB,
+ .fixedIV = 31,
+ .nature = 11,
+ .evs = {6, 252, 252, 0, 0, 0},
+ .moves = {MOVE_OVERHEAT, MOVE_EXTREME_SPEED, MOVE_ROAR, MOVE_PROTECT},
},
{
- .species = SPECIES_SLAKING,
- .heldItem = ITEM_SCOPE_LENS,
- .fixedIV = 31,
- .nature = 0,
- .evs = {6, 252, 0, 252, 0, 0},
- .moves = {MOVE_HYPER_BEAM, MOVE_EARTHQUAKE, MOVE_SHADOW_BALL, MOVE_YAWN},
+ .species = SPECIES_SLAKING,
+ .heldItem = ITEM_SCOPE_LENS,
+ .fixedIV = 31,
+ .nature = 0,
+ .evs = {6, 252, 0, 252, 0, 0},
+ .moves = {MOVE_HYPER_BEAM, MOVE_EARTHQUAKE, MOVE_SHADOW_BALL, MOVE_YAWN},
},
{
- .species = SPECIES_SUICUNE,
- .heldItem = ITEM_KINGS_ROCK,
- .fixedIV = 31,
- .nature = 11,
- .evs = {252, 0, 252, 6, 0, 0},
- .moves = {MOVE_BLIZZARD, MOVE_SURF, MOVE_BITE, MOVE_CALM_MIND},
+ .species = SPECIES_SUICUNE,
+ .heldItem = ITEM_KINGS_ROCK,
+ .fixedIV = 31,
+ .nature = 11,
+ .evs = {252, 0, 252, 6, 0, 0},
+ .moves = {MOVE_BLIZZARD, MOVE_SURF, MOVE_BITE, MOVE_CALM_MIND},
},
},
},
- [FRONTIER_FACILITY_ARENA] =
- {
+ [FRONTIER_FACILITY_ARENA] =
+ {
// Silver Symbol.
{
{
- .species = SPECIES_HERACROSS,
- .heldItem = ITEM_SALAC_BERRY,
- .fixedIV = 20,
- .nature = 13,
- .evs = {106, 152, 0, 152, 0, 100},
- .moves = {MOVE_MEGAHORN, MOVE_ROCK_TOMB, MOVE_ENDURE, MOVE_REVERSAL},
+ .species = SPECIES_HERACROSS,
+ .heldItem = ITEM_SALAC_BERRY,
+ .fixedIV = 20,
+ .nature = 13,
+ .evs = {106, 152, 0, 152, 0, 100},
+ .moves = {MOVE_MEGAHORN, MOVE_ROCK_TOMB, MOVE_ENDURE, MOVE_REVERSAL},
},
{
- .species = SPECIES_UMBREON,
- .heldItem = ITEM_LEFTOVERS,
- .fixedIV = 20,
- .nature = 20,
- .evs = {152, 0, 100, 0, 152, 106},
- .moves = {MOVE_BODY_SLAM, MOVE_CONFUSE_RAY, MOVE_PSYCHIC, MOVE_FAINT_ATTACK},
+ .species = SPECIES_UMBREON,
+ .heldItem = ITEM_LEFTOVERS,
+ .fixedIV = 20,
+ .nature = 20,
+ .evs = {152, 0, 100, 0, 152, 106},
+ .moves = {MOVE_BODY_SLAM, MOVE_CONFUSE_RAY, MOVE_PSYCHIC, MOVE_FAINT_ATTACK},
},
{
- .species = SPECIES_SHEDINJA,
- .heldItem = ITEM_BRIGHT_POWDER,
- .fixedIV = 20,
- .nature = 3,
- .evs = {0, 252, 6, 252, 0, 0},
- .moves = {MOVE_SHADOW_BALL, MOVE_RETURN, MOVE_CONFUSE_RAY, MOVE_AERIAL_ACE},
+ .species = SPECIES_SHEDINJA,
+ .heldItem = ITEM_BRIGHT_POWDER,
+ .fixedIV = 20,
+ .nature = 3,
+ .evs = {0, 252, 6, 252, 0, 0},
+ .moves = {MOVE_SHADOW_BALL, MOVE_RETURN, MOVE_CONFUSE_RAY, MOVE_AERIAL_ACE},
},
},
// Gold Symbol.
{
{
- .species = SPECIES_UMBREON,
- .heldItem = ITEM_CHESTO_BERRY,
- .fixedIV = 31,
- .nature = 20,
- .evs = {252, 0, 0, 0, 252, 6},
- .moves = {MOVE_DOUBLE_EDGE, MOVE_CONFUSE_RAY, MOVE_REST, MOVE_PSYCHIC},
+ .species = SPECIES_UMBREON,
+ .heldItem = ITEM_CHESTO_BERRY,
+ .fixedIV = 31,
+ .nature = 20,
+ .evs = {252, 0, 0, 0, 252, 6},
+ .moves = {MOVE_DOUBLE_EDGE, MOVE_CONFUSE_RAY, MOVE_REST, MOVE_PSYCHIC},
},
{
- .species = SPECIES_GENGAR,
- .heldItem = ITEM_LEFTOVERS,
- .fixedIV = 31,
- .nature = 15,
- .evs = {252, 0, 252, 0, 6, 0},
- .moves = {MOVE_PSYCHIC, MOVE_HYPNOSIS, MOVE_DREAM_EATER, MOVE_DESTINY_BOND},
+ .species = SPECIES_GENGAR,
+ .heldItem = ITEM_LEFTOVERS,
+ .fixedIV = 31,
+ .nature = 15,
+ .evs = {252, 0, 252, 0, 6, 0},
+ .moves = {MOVE_PSYCHIC, MOVE_HYPNOSIS, MOVE_DREAM_EATER, MOVE_DESTINY_BOND},
},
{
- .species = SPECIES_BRELOOM,
- .heldItem = ITEM_LUM_BERRY,
- .fixedIV = 31,
- .nature = 13,
- .evs = {6, 252, 0, 252, 0, 0},
- .moves = {MOVE_SPORE, MOVE_FOCUS_PUNCH, MOVE_GIGA_DRAIN, MOVE_HEADBUTT},
+ .species = SPECIES_BRELOOM,
+ .heldItem = ITEM_LUM_BERRY,
+ .fixedIV = 31,
+ .nature = 13,
+ .evs = {6, 252, 0, 252, 0, 0},
+ .moves = {MOVE_SPORE, MOVE_FOCUS_PUNCH, MOVE_GIGA_DRAIN, MOVE_HEADBUTT},
},
},
},
- [FRONTIER_FACILITY_FACTORY] =
- {
+ [FRONTIER_FACILITY_FACTORY] =
+ {
// Because Factory's pokemon are random, this facility's Brain also uses random pokemon.
// What is interesting, this team is actually the one Steven uses in the multi tag battle alongside the player.
{
{
- .species = SPECIES_METANG,
- .heldItem = ITEM_SITRUS_BERRY,
- .fixedIV = 31,
- .nature = 2,
- .evs = {0, 252, 252, 0, 6, 0},
- .moves = {MOVE_LIGHT_SCREEN, MOVE_PSYCHIC, MOVE_REFLECT, MOVE_METAL_CLAW},
+ .species = SPECIES_METANG,
+ .heldItem = ITEM_SITRUS_BERRY,
+ .fixedIV = 31,
+ .nature = 2,
+ .evs = {0, 252, 252, 0, 6, 0},
+ .moves = {MOVE_LIGHT_SCREEN, MOVE_PSYCHIC, MOVE_REFLECT, MOVE_METAL_CLAW},
},
{
- .species = SPECIES_SKARMORY,
- .heldItem = ITEM_SITRUS_BERRY,
- .fixedIV = 31,
- .nature = 8,
- .evs = {252, 0, 0, 0, 6, 252},
- .moves = {MOVE_TOXIC, MOVE_AERIAL_ACE, MOVE_PROTECT, MOVE_STEEL_WING},
+ .species = SPECIES_SKARMORY,
+ .heldItem = ITEM_SITRUS_BERRY,
+ .fixedIV = 31,
+ .nature = 8,
+ .evs = {252, 0, 0, 0, 6, 252},
+ .moves = {MOVE_TOXIC, MOVE_AERIAL_ACE, MOVE_PROTECT, MOVE_STEEL_WING},
},
{
- .species = SPECIES_AGGRON,
- .heldItem = ITEM_SITRUS_BERRY,
- .fixedIV = 31,
- .nature = 3,
- .evs = {0, 252, 0, 0, 252, 6},
- .moves = {MOVE_THUNDERBOLT, MOVE_PROTECT, MOVE_SOLAR_BEAM, MOVE_DRAGON_CLAW},
+ .species = SPECIES_AGGRON,
+ .heldItem = ITEM_SITRUS_BERRY,
+ .fixedIV = 31,
+ .nature = 3,
+ .evs = {0, 252, 0, 0, 252, 6},
+ .moves = {MOVE_THUNDERBOLT, MOVE_PROTECT, MOVE_SOLAR_BEAM, MOVE_DRAGON_CLAW},
},
},
{
{
- .species = SPECIES_METANG,
- .heldItem = ITEM_SITRUS_BERRY,
- .fixedIV = 31,
- .nature = 2,
- .evs = {0, 252, 252, 0, 6, 0},
- .moves = {MOVE_LIGHT_SCREEN, MOVE_PSYCHIC, MOVE_REFLECT, MOVE_METAL_CLAW},
+ .species = SPECIES_METANG,
+ .heldItem = ITEM_SITRUS_BERRY,
+ .fixedIV = 31,
+ .nature = 2,
+ .evs = {0, 252, 252, 0, 6, 0},
+ .moves = {MOVE_LIGHT_SCREEN, MOVE_PSYCHIC, MOVE_REFLECT, MOVE_METAL_CLAW},
},
{
- .species = SPECIES_SKARMORY,
- .heldItem = ITEM_SITRUS_BERRY,
- .fixedIV = 31,
- .nature = 8,
- .evs = {252, 0, 0, 0, 6, 252},
- .moves = {MOVE_TOXIC, MOVE_AERIAL_ACE, MOVE_PROTECT, MOVE_STEEL_WING},
+ .species = SPECIES_SKARMORY,
+ .heldItem = ITEM_SITRUS_BERRY,
+ .fixedIV = 31,
+ .nature = 8,
+ .evs = {252, 0, 0, 0, 6, 252},
+ .moves = {MOVE_TOXIC, MOVE_AERIAL_ACE, MOVE_PROTECT, MOVE_STEEL_WING},
},
{
- .species = SPECIES_AGGRON,
- .heldItem = ITEM_SITRUS_BERRY,
- .fixedIV = 31,
- .nature = 3,
- .evs = {0, 252, 0, 0, 252, 6},
- .moves = {MOVE_THUNDERBOLT, MOVE_PROTECT, MOVE_SOLAR_BEAM, MOVE_DRAGON_CLAW},
+ .species = SPECIES_AGGRON,
+ .heldItem = ITEM_SITRUS_BERRY,
+ .fixedIV = 31,
+ .nature = 3,
+ .evs = {0, 252, 0, 0, 252, 6},
+ .moves = {MOVE_THUNDERBOLT, MOVE_PROTECT, MOVE_SOLAR_BEAM, MOVE_DRAGON_CLAW},
},
},
},
- [FRONTIER_FACILITY_PIKE] =
- {
+ [FRONTIER_FACILITY_PIKE] =
+ {
// Silver Symbol.
{
{
- .species = SPECIES_SEVIPER,
- .heldItem = ITEM_QUICK_CLAW,
- .fixedIV = 16,
- .nature = 2,
- .evs = {252, 0, 252, 0, 6, 0},
- .moves = {MOVE_SWAGGER, MOVE_CRUNCH, MOVE_POISON_FANG, MOVE_GIGA_DRAIN},
+ .species = SPECIES_SEVIPER,
+ .heldItem = ITEM_QUICK_CLAW,
+ .fixedIV = 16,
+ .nature = 2,
+ .evs = {252, 0, 252, 0, 6, 0},
+ .moves = {MOVE_SWAGGER, MOVE_CRUNCH, MOVE_POISON_FANG, MOVE_GIGA_DRAIN},
},
{
- .species = SPECIES_SHUCKLE,
- .heldItem = ITEM_CHESTO_BERRY,
- .fixedIV = 16,
- .nature = 5,
- .evs = {252, 0, 0, 0, 106, 252},
- .moves = {MOVE_TOXIC, MOVE_SANDSTORM, MOVE_PROTECT, MOVE_REST},
+ .species = SPECIES_SHUCKLE,
+ .heldItem = ITEM_CHESTO_BERRY,
+ .fixedIV = 16,
+ .nature = 5,
+ .evs = {252, 0, 0, 0, 106, 252},
+ .moves = {MOVE_TOXIC, MOVE_SANDSTORM, MOVE_PROTECT, MOVE_REST},
},
{
- .species = SPECIES_MILOTIC,
- .heldItem = ITEM_LEFTOVERS,
- .fixedIV = 16,
- .nature = 15,
- .evs = {152, 0, 100, 0, 152, 106},
- .moves = {MOVE_ICE_BEAM, MOVE_MIRROR_COAT, MOVE_SURF, MOVE_RECOVER},
+ .species = SPECIES_MILOTIC,
+ .heldItem = ITEM_LEFTOVERS,
+ .fixedIV = 16,
+ .nature = 15,
+ .evs = {152, 0, 100, 0, 152, 106},
+ .moves = {MOVE_ICE_BEAM, MOVE_MIRROR_COAT, MOVE_SURF, MOVE_RECOVER},
},
},
// Gold Symbol.
{
{
- .species = SPECIES_SEVIPER,
- .heldItem = ITEM_FOCUS_BAND,
- .fixedIV = 31,
- .nature = 5,
- .evs = {252, 0, 0, 0, 252, 6},
- .moves = {MOVE_SWAGGER, MOVE_CRUNCH, MOVE_SLUDGE_BOMB, MOVE_GIGA_DRAIN},
+ .species = SPECIES_SEVIPER,
+ .heldItem = ITEM_FOCUS_BAND,
+ .fixedIV = 31,
+ .nature = 5,
+ .evs = {252, 0, 0, 0, 252, 6},
+ .moves = {MOVE_SWAGGER, MOVE_CRUNCH, MOVE_SLUDGE_BOMB, MOVE_GIGA_DRAIN},
},
{
- .species = SPECIES_STEELIX,
- .heldItem = ITEM_BRIGHT_POWDER,
- .fixedIV = 31,
- .nature = 2,
- .evs = {252, 0, 0, 0, 6, 252},
- .moves = {MOVE_EARTHQUAKE, MOVE_ROCK_SLIDE, MOVE_EXPLOSION, MOVE_SCREECH},
+ .species = SPECIES_STEELIX,
+ .heldItem = ITEM_BRIGHT_POWDER,
+ .fixedIV = 31,
+ .nature = 2,
+ .evs = {252, 0, 0, 0, 6, 252},
+ .moves = {MOVE_EARTHQUAKE, MOVE_ROCK_SLIDE, MOVE_EXPLOSION, MOVE_SCREECH},
},
{
- .species = SPECIES_GYARADOS,
- .heldItem = ITEM_CHESTO_BERRY,
- .fixedIV = 31,
- .nature = 3,
- .evs = {252, 6, 0, 0, 0, 252},
- .moves = {MOVE_DRAGON_DANCE, MOVE_RETURN, MOVE_ROAR, MOVE_REST},
+ .species = SPECIES_GYARADOS,
+ .heldItem = ITEM_CHESTO_BERRY,
+ .fixedIV = 31,
+ .nature = 3,
+ .evs = {252, 6, 0, 0, 0, 252},
+ .moves = {MOVE_DRAGON_DANCE, MOVE_RETURN, MOVE_ROAR, MOVE_REST},
},
},
},
- [FRONTIER_FACILITY_PYRAMID] =
- {
+ [FRONTIER_FACILITY_PYRAMID] =
+ {
// Silver Symbol.
{
{
- .species = SPECIES_REGIROCK,
- .heldItem = ITEM_QUICK_CLAW,
- .fixedIV = 16,
- .nature = 3,
- .evs = {152, 152, 0, 0, 106, 100},
- .moves = {MOVE_EXPLOSION, MOVE_SUPERPOWER, MOVE_EARTHQUAKE, MOVE_ANCIENT_POWER},
+ .species = SPECIES_REGIROCK,
+ .heldItem = ITEM_QUICK_CLAW,
+ .fixedIV = 16,
+ .nature = 3,
+ .evs = {152, 152, 0, 0, 106, 100},
+ .moves = {MOVE_EXPLOSION, MOVE_SUPERPOWER, MOVE_EARTHQUAKE, MOVE_ANCIENT_POWER},
},
{
- .species = SPECIES_REGISTEEL,
- .heldItem = ITEM_LEFTOVERS,
- .fixedIV = 16,
- .nature = 3,
- .evs = {152, 152, 0, 0, 6, 200},
- .moves = {MOVE_EARTHQUAKE, MOVE_METAL_CLAW, MOVE_TOXIC, MOVE_IRON_DEFENSE},
+ .species = SPECIES_REGISTEEL,
+ .heldItem = ITEM_LEFTOVERS,
+ .fixedIV = 16,
+ .nature = 3,
+ .evs = {152, 152, 0, 0, 6, 200},
+ .moves = {MOVE_EARTHQUAKE, MOVE_METAL_CLAW, MOVE_TOXIC, MOVE_IRON_DEFENSE},
},
{
- .species = SPECIES_REGICE,
- .heldItem = ITEM_CHESTO_BERRY,
- .fixedIV = 16,
- .nature = 15,
- .evs = {106, 0, 152, 0, 100, 152},
- .moves = {MOVE_ICE_BEAM, MOVE_AMNESIA, MOVE_THUNDER, MOVE_REST},
+ .species = SPECIES_REGICE,
+ .heldItem = ITEM_CHESTO_BERRY,
+ .fixedIV = 16,
+ .nature = 15,
+ .evs = {106, 0, 152, 0, 100, 152},
+ .moves = {MOVE_ICE_BEAM, MOVE_AMNESIA, MOVE_THUNDER, MOVE_REST},
},
},
// Gold Symbol.
{
{
- .species = SPECIES_ARTICUNO,
- .heldItem = ITEM_SCOPE_LENS,
- .fixedIV = 31,
- .nature = 16,
- .evs = {6, 0, 252, 252, 0, 0},
- .moves = {MOVE_BLIZZARD, MOVE_WATER_PULSE, MOVE_AERIAL_ACE, MOVE_REFLECT},
+ .species = SPECIES_ARTICUNO,
+ .heldItem = ITEM_SCOPE_LENS,
+ .fixedIV = 31,
+ .nature = 16,
+ .evs = {6, 0, 252, 252, 0, 0},
+ .moves = {MOVE_BLIZZARD, MOVE_WATER_PULSE, MOVE_AERIAL_ACE, MOVE_REFLECT},
},
{
- .species = SPECIES_ZAPDOS,
- .heldItem = ITEM_LUM_BERRY,
- .fixedIV = 31,
- .nature = 16,
- .evs = {6, 0, 252, 252, 0, 0},
- .moves = {MOVE_THUNDER, MOVE_DETECT, MOVE_DRILL_PECK, MOVE_LIGHT_SCREEN},
+ .species = SPECIES_ZAPDOS,
+ .heldItem = ITEM_LUM_BERRY,
+ .fixedIV = 31,
+ .nature = 16,
+ .evs = {6, 0, 252, 252, 0, 0},
+ .moves = {MOVE_THUNDER, MOVE_DETECT, MOVE_DRILL_PECK, MOVE_LIGHT_SCREEN},
},
{
- .species = SPECIES_MOLTRES,
- .heldItem = ITEM_BRIGHT_POWDER,
- .fixedIV = 31,
- .nature = 16,
- .evs = {6, 0, 252, 252, 0, 0},
- .moves = {MOVE_FIRE_BLAST, MOVE_HYPER_BEAM, MOVE_AERIAL_ACE, MOVE_SAFEGUARD},
+ .species = SPECIES_MOLTRES,
+ .heldItem = ITEM_BRIGHT_POWDER,
+ .fixedIV = 31,
+ .nature = 16,
+ .evs = {6, 0, 252, 252, 0, 0},
+ .moves = {MOVE_FIRE_BLAST, MOVE_HYPER_BEAM, MOVE_AERIAL_ACE, MOVE_SAFEGUARD},
},
},
},
@@ -614,29 +614,29 @@ static const u16 gUnknown_08611BFC[][2] =
static void (* const sFrontierUtilFuncs[])(void) =
{
- sub_81A17A0,
- sub_81A1830,
- sub_81A1968,
- sub_81A1AD4,
- DoSoftReset_,
- sub_81A1B28,
- sub_81A1B38,
- ShowFacilityResultsWindow,
- sub_81A31FC,
- sub_81A35EC,
- sub_81A3B00,
- sub_81A3B64,
- sub_81A3D30,
- sub_81A3D58,
- sub_81A3DA0,
- sub_81A3FD4,
- sub_81A4224,
- sub_81A4230,
- sub_81A43A8,
- sub_81A4410,
- sub_81A443C,
- sub_81A447C,
- sub_81A457C,
+ sub_81A17A0,
+ sub_81A1830,
+ sub_81A1968,
+ sub_81A1AD4,
+ DoSoftReset_,
+ sub_81A1B28,
+ sub_81A1B38,
+ ShowFacilityResultsWindow,
+ sub_81A31FC,
+ sub_81A35EC,
+ sub_81A3B00,
+ sub_81A3B64,
+ sub_81A3D30,
+ sub_81A3D58,
+ sub_81A3DA0,
+ sub_81A3FD4,
+ sub_81A4224,
+ sub_81A4230,
+ sub_81A43A8,
+ sub_81A4410,
+ sub_81A443C,
+ sub_81A447C,
+ sub_81A457C,
};
static const struct WindowTemplate gUnknown_08611C74 =
@@ -676,12 +676,12 @@ static const struct WindowTemplate gUnknown_08611C84 =
static const u8 sFacilityToBrainEventObjGfx[][2] =
{
[FRONTIER_FACILITY_TOWER] = {EVENT_OBJ_GFX_ANABEL, TRUE},
- [FRONTIER_FACILITY_DOME] = {EVENT_OBJ_GFX_TUCKER, FALSE},
- [FRONTIER_FACILITY_PALACE] = {EVENT_OBJ_GFX_SPENSER, FALSE},
- [FRONTIER_FACILITY_ARENA] = {EVENT_OBJ_GFX_GRETA, TRUE},
- [FRONTIER_FACILITY_FACTORY] = {EVENT_OBJ_GFX_NOLAND, FALSE},
- [FRONTIER_FACILITY_PIKE] = {EVENT_OBJ_GFX_LUCY, TRUE},
- [FRONTIER_FACILITY_PYRAMID] = {EVENT_OBJ_GFX_BRANDON, FALSE},
+ [FRONTIER_FACILITY_DOME] = {EVENT_OBJ_GFX_TUCKER, FALSE},
+ [FRONTIER_FACILITY_PALACE] = {EVENT_OBJ_GFX_SPENSER, FALSE},
+ [FRONTIER_FACILITY_ARENA] = {EVENT_OBJ_GFX_GRETA, TRUE},
+ [FRONTIER_FACILITY_FACTORY] = {EVENT_OBJ_GFX_NOLAND, FALSE},
+ [FRONTIER_FACILITY_PIKE] = {EVENT_OBJ_GFX_LUCY, TRUE},
+ [FRONTIER_FACILITY_PYRAMID] = {EVENT_OBJ_GFX_BRANDON, FALSE},
};
const u16 gFrontierBannedSpecies[] =
@@ -765,7 +765,7 @@ static void sub_81A1968(void)
switch (gSpecialVar_0x8005)
{
- case 0:
+ case 0:
gSaveBlock2Ptr->frontier.field_CA8 = gSpecialVar_0x8006;
break;
case 1:
@@ -779,7 +779,7 @@ static void sub_81A1968(void)
break;
case 4:
for (i = 0; i < 4; i++)
- gSaveBlock2Ptr->frontier.selectedPartyMons[i] = gUnknown_0203CEF8[i];
+ gSaveBlock2Ptr->frontier.selectedPartyMons[i] = gSelectedOrderFromParty[i];
break;
case 6:
gSaveBlock2Ptr->frontier.field_CA9_b = gSpecialVar_0x8006;
@@ -796,8 +796,8 @@ static void sub_81A1AD4(void)
sub_81B8558();
for (i = 0; i < gSpecialVar_0x8005; i++)
- gUnknown_0203CEF8[i] = gSaveBlock2Ptr->frontier.selectedPartyMons[i];
- ReducePlayerPartyToThree();
+ gSelectedOrderFromParty[i] = gSaveBlock2Ptr->frontier.selectedPartyMons[i];
+ ReducePlayerPartyToSelectedMons();
}
static void DoSoftReset_(void)
@@ -2434,235 +2434,235 @@ NAKED
void CreateFrontierBrainPokemon(void)
{
asm_unified("\n\
- push {r4-r7,lr}\n\
- mov r7, r10\n\
- mov r6, r9\n\
- mov r5, r8\n\
- push {r5-r7}\n\
- sub sp, 0x44\n\
- ldr r0, =0x000040cf\n\
- bl VarGet\n\
- lsls r0, 16\n\
- lsrs r0, 16\n\
- str r0, [sp, 0x20]\n\
- bl GetFronterBrainSymbol\n\
- str r0, [sp, 0x24]\n\
- ldr r0, [sp, 0x20]\n\
- cmp r0, 0x1\n\
- bne _081A4E44\n\
- ldr r0, =0x000003fe\n\
- bl TrainerIdToDomeTournamentId\n\
- lsls r0, 16\n\
- lsrs r0, 16\n\
- bl GetDomeTrainerMonCountInBits\n\
- adds r4, r0, 0\n\
- b _081A4E46\n\
- .pool\n\
+ push {r4-r7,lr}\n\
+ mov r7, r10\n\
+ mov r6, r9\n\
+ mov r5, r8\n\
+ push {r5-r7}\n\
+ sub sp, 0x44\n\
+ ldr r0, =0x000040cf\n\
+ bl VarGet\n\
+ lsls r0, 16\n\
+ lsrs r0, 16\n\
+ str r0, [sp, 0x20]\n\
+ bl GetFronterBrainSymbol\n\
+ str r0, [sp, 0x24]\n\
+ ldr r0, [sp, 0x20]\n\
+ cmp r0, 0x1\n\
+ bne _081A4E44\n\
+ ldr r0, =0x000003fe\n\
+ bl TrainerIdToDomeTournamentId\n\
+ lsls r0, 16\n\
+ lsrs r0, 16\n\
+ bl GetDomeTrainerMonCountInBits\n\
+ adds r4, r0, 0\n\
+ b _081A4E46\n\
+ .pool\n\
_081A4E44:\n\
- movs r4, 0x7\n\
+ movs r4, 0x7\n\
_081A4E46:\n\
- bl ZeroEnemyPartyMons\n\
- movs r1, 0\n\
- str r1, [sp, 0x18]\n\
- bl SetFacilityPtrsGetLevel\n\
- lsls r0, 24\n\
- lsrs r0, 24\n\
- str r0, [sp, 0x1C]\n\
- movs r2, 0\n\
- str r2, [sp, 0x14]\n\
+ bl ZeroEnemyPartyMons\n\
+ movs r1, 0\n\
+ str r1, [sp, 0x18]\n\
+ bl SetFacilityPtrsGetLevel\n\
+ lsls r0, 24\n\
+ lsrs r0, 24\n\
+ str r0, [sp, 0x1C]\n\
+ movs r2, 0\n\
+ str r2, [sp, 0x14]\n\
_081A4E5C:\n\
- movs r0, 0x1\n\
- ands r0, r4\n\
- asrs r4, 1\n\
- str r4, [sp, 0x30]\n\
- ldr r3, [sp, 0x14]\n\
- adds r3, 0x1\n\
- str r3, [sp, 0x28]\n\
- cmp r0, 0\n\
- bne _081A4E70\n\
- b _081A4FC4\n\
+ movs r0, 0x1\n\
+ ands r0, r4\n\
+ asrs r4, 1\n\
+ str r4, [sp, 0x30]\n\
+ ldr r3, [sp, 0x14]\n\
+ adds r3, 0x1\n\
+ str r3, [sp, 0x28]\n\
+ cmp r0, 0\n\
+ bne _081A4E70\n\
+ b _081A4FC4\n\
_081A4E70:\n\
- ldr r4, [sp, 0x14]\n\
- lsls r4, 2\n\
- mov r9, r4\n\
- ldr r0, [sp, 0x24]\n\
- lsls r0, 4\n\
- str r0, [sp, 0x38]\n\
- ldr r1, [sp, 0x20]\n\
- lsls r1, 4\n\
- str r1, [sp, 0x34]\n\
- ldr r2, [sp, 0x1C]\n\
- lsls r2, 24\n\
- str r2, [sp, 0x3C]\n\
- ldr r3, [sp, 0x18]\n\
- adds r3, 0x1\n\
- str r3, [sp, 0x2C]\n\
- ldr r0, [sp, 0x14]\n\
- add r0, r9\n\
- lsls r0, 2\n\
- mov r8, r0\n\
+ ldr r4, [sp, 0x14]\n\
+ lsls r4, 2\n\
+ mov r9, r4\n\
+ ldr r0, [sp, 0x24]\n\
+ lsls r0, 4\n\
+ str r0, [sp, 0x38]\n\
+ ldr r1, [sp, 0x20]\n\
+ lsls r1, 4\n\
+ str r1, [sp, 0x34]\n\
+ ldr r2, [sp, 0x1C]\n\
+ lsls r2, 24\n\
+ str r2, [sp, 0x3C]\n\
+ ldr r3, [sp, 0x18]\n\
+ adds r3, 0x1\n\
+ str r3, [sp, 0x2C]\n\
+ ldr r0, [sp, 0x14]\n\
+ add r0, r9\n\
+ lsls r0, 2\n\
+ mov r8, r0\n\
_081A4E96:\n\
- bl Random\n\
- adds r4, r0, 0\n\
- bl Random\n\
- lsls r4, 16\n\
- lsrs r7, r4, 16\n\
- lsls r0, 16\n\
- orrs r7, r0\n\
- ldr r0, =0x0000ef2a\n\
- adds r1, r7, 0\n\
- bl IsShinyOtIdPersonality\n\
- lsls r0, 24\n\
- cmp r0, 0\n\
- bne _081A4E96\n\
- ldr r4, [sp, 0x38]\n\
- ldr r1, [sp, 0x24]\n\
- subs r0, r4, r1\n\
- lsls r5, r0, 2\n\
- mov r2, r8\n\
- adds r4, r2, r5\n\
- ldr r3, [sp, 0x34]\n\
- ldr r1, [sp, 0x20]\n\
- subs r0, r3, r1\n\
- lsls r6, r0, 3\n\
- adds r4, r6\n\
- ldr r2, =sFrontierBrainsMons\n\
- adds r4, r2\n\
- adds r0, r7, 0\n\
- bl GetNatureFromPersonality\n\
- ldrb r1, [r4, 0x5]\n\
- lsls r0, 24\n\
- lsrs r0, 24\n\
- cmp r1, r0\n\
- bne _081A4E96\n\
- ldr r4, [sp, 0x18]\n\
- movs r0, 0x64\n\
- adds r3, r4, 0\n\
- muls r3, r0\n\
- mov r8, r3\n\
- ldr r1, =gEnemyParty\n\
- add r1, r8\n\
- mov r10, r1\n\
- ldr r4, [sp, 0x14]\n\
- add r4, r9\n\
- lsls r4, 2\n\
- adds r0, r4, r5\n\
- adds r0, r6\n\
- ldr r2, =sFrontierBrainsMons\n\
- adds r0, r2\n\
- ldrh r1, [r0]\n\
- ldr r3, [sp, 0x3C]\n\
- lsrs r2, r3, 24\n\
- ldrb r3, [r0, 0x4]\n\
- movs r0, 0x1\n\
- str r0, [sp]\n\
- str r7, [sp, 0x4]\n\
- str r0, [sp, 0x8]\n\
- ldr r0, =0x0000ef2a\n\
- str r0, [sp, 0xC]\n\
- mov r0, r10\n\
- bl CreateMon\n\
- ldr r0, =sFrontierBrainsMons\n\
- adds r5, r0\n\
- adds r5, r6, r5\n\
- adds r4, r5, r4\n\
- adds r4, 0x2\n\
- mov r0, r10\n\
- movs r1, 0xC\n\
- adds r2, r4, 0\n\
- bl SetMonData\n\
- movs r7, 0\n\
- mov r6, r8\n\
- ldr r3, =gEnemyParty\n\
+ bl Random\n\
+ adds r4, r0, 0\n\
+ bl Random\n\
+ lsls r4, 16\n\
+ lsrs r7, r4, 16\n\
+ lsls r0, 16\n\
+ orrs r7, r0\n\
+ ldr r0, =0x0000ef2a\n\
+ adds r1, r7, 0\n\
+ bl IsShinyOtIdPersonality\n\
+ lsls r0, 24\n\
+ cmp r0, 0\n\
+ bne _081A4E96\n\
+ ldr r4, [sp, 0x38]\n\
+ ldr r1, [sp, 0x24]\n\
+ subs r0, r4, r1\n\
+ lsls r5, r0, 2\n\
+ mov r2, r8\n\
+ adds r4, r2, r5\n\
+ ldr r3, [sp, 0x34]\n\
+ ldr r1, [sp, 0x20]\n\
+ subs r0, r3, r1\n\
+ lsls r6, r0, 3\n\
+ adds r4, r6\n\
+ ldr r2, =sFrontierBrainsMons\n\
+ adds r4, r2\n\
+ adds r0, r7, 0\n\
+ bl GetNatureFromPersonality\n\
+ ldrb r1, [r4, 0x5]\n\
+ lsls r0, 24\n\
+ lsrs r0, 24\n\
+ cmp r1, r0\n\
+ bne _081A4E96\n\
+ ldr r4, [sp, 0x18]\n\
+ movs r0, 0x64\n\
+ adds r3, r4, 0\n\
+ muls r3, r0\n\
+ mov r8, r3\n\
+ ldr r1, =gEnemyParty\n\
+ add r1, r8\n\
+ mov r10, r1\n\
+ ldr r4, [sp, 0x14]\n\
+ add r4, r9\n\
+ lsls r4, 2\n\
+ adds r0, r4, r5\n\
+ adds r0, r6\n\
+ ldr r2, =sFrontierBrainsMons\n\
+ adds r0, r2\n\
+ ldrh r1, [r0]\n\
+ ldr r3, [sp, 0x3C]\n\
+ lsrs r2, r3, 24\n\
+ ldrb r3, [r0, 0x4]\n\
+ movs r0, 0x1\n\
+ str r0, [sp]\n\
+ str r7, [sp, 0x4]\n\
+ str r0, [sp, 0x8]\n\
+ ldr r0, =0x0000ef2a\n\
+ str r0, [sp, 0xC]\n\
+ mov r0, r10\n\
+ bl CreateMon\n\
+ ldr r0, =sFrontierBrainsMons\n\
+ adds r5, r0\n\
+ adds r5, r6, r5\n\
+ adds r4, r5, r4\n\
+ adds r4, 0x2\n\
+ mov r0, r10\n\
+ movs r1, 0xC\n\
+ adds r2, r4, 0\n\
+ bl SetMonData\n\
+ movs r7, 0\n\
+ mov r6, r8\n\
+ ldr r3, =gEnemyParty\n\
_081A4F32:\n\
- adds r1, r7, 0\n\
- adds r1, 0x1A\n\
- ldr r0, [sp, 0x14]\n\
- add r0, r9\n\
- lsls r4, r0, 2\n\
- adds r2, r5, r4\n\
- adds r0, r7, 0x6\n\
- adds r2, r0\n\
- adds r0, r6, r3\n\
- str r3, [sp, 0x40]\n\
- bl SetMonData\n\
- adds r7, 0x1\n\
- ldr r3, [sp, 0x40]\n\
- cmp r7, 0x5\n\
- ble _081A4F32\n\
- movs r1, 0xFF\n\
- add r0, sp, 0x10\n\
- strb r1, [r0]\n\
- movs r7, 0\n\
- ldr r1, [sp, 0x18]\n\
- movs r2, 0x64\n\
- adds r6, r1, 0\n\
- muls r6, r2\n\
- ldr r3, =sFrontierBrainsMons + 0xC\n\
- mov r8, r3\n\
- ldr r3, =gEnemyParty\n\
- adds r5, r4, 0\n\
+ adds r1, r7, 0\n\
+ adds r1, 0x1A\n\
+ ldr r0, [sp, 0x14]\n\
+ add r0, r9\n\
+ lsls r4, r0, 2\n\
+ adds r2, r5, r4\n\
+ adds r0, r7, 0x6\n\
+ adds r2, r0\n\
+ adds r0, r6, r3\n\
+ str r3, [sp, 0x40]\n\
+ bl SetMonData\n\
+ adds r7, 0x1\n\
+ ldr r3, [sp, 0x40]\n\
+ cmp r7, 0x5\n\
+ ble _081A4F32\n\
+ movs r1, 0xFF\n\
+ add r0, sp, 0x10\n\
+ strb r1, [r0]\n\
+ movs r7, 0\n\
+ ldr r1, [sp, 0x18]\n\
+ movs r2, 0x64\n\
+ adds r6, r1, 0\n\
+ muls r6, r2\n\
+ ldr r3, =sFrontierBrainsMons + 0xC\n\
+ mov r8, r3\n\
+ ldr r3, =gEnemyParty\n\
+ adds r5, r4, 0\n\
_081A4F6A:\n\
- ldr r4, [sp, 0x38]\n\
- ldr r0, [sp, 0x24]\n\
- subs r1, r4, r0\n\
- lsls r1, 2\n\
- adds r1, r5, r1\n\
- ldr r2, [sp, 0x34]\n\
- ldr r4, [sp, 0x20]\n\
- subs r0, r2, r4\n\
- lsls r0, 3\n\
- adds r1, r0\n\
- add r1, r8\n\
- ldrh r4, [r1]\n\
- lsls r2, r7, 24\n\
- lsrs r2, 24\n\
- adds r0, r6, r3\n\
- adds r1, r4, 0\n\
- str r3, [sp, 0x40]\n\
- bl SetMonMoveSlot\n\
- ldr r3, [sp, 0x40]\n\
- cmp r4, 0xDA\n\
- bne _081A4F9C\n\
- movs r1, 0\n\
- add r0, sp, 0x10\n\
- strb r1, [r0]\n\
+ ldr r4, [sp, 0x38]\n\
+ ldr r0, [sp, 0x24]\n\
+ subs r1, r4, r0\n\
+ lsls r1, 2\n\
+ adds r1, r5, r1\n\
+ ldr r2, [sp, 0x34]\n\
+ ldr r4, [sp, 0x20]\n\
+ subs r0, r2, r4\n\
+ lsls r0, 3\n\
+ adds r1, r0\n\
+ add r1, r8\n\
+ ldrh r4, [r1]\n\
+ lsls r2, r7, 24\n\
+ lsrs r2, 24\n\
+ adds r0, r6, r3\n\
+ adds r1, r4, 0\n\
+ str r3, [sp, 0x40]\n\
+ bl SetMonMoveSlot\n\
+ ldr r3, [sp, 0x40]\n\
+ cmp r4, 0xDA\n\
+ bne _081A4F9C\n\
+ movs r1, 0\n\
+ add r0, sp, 0x10\n\
+ strb r1, [r0]\n\
_081A4F9C:\n\
- adds r5, 0x2\n\
- adds r7, 0x1\n\
- cmp r7, 0x3\n\
- ble _081A4F6A\n\
- ldr r0, [sp, 0x18]\n\
- movs r1, 0x64\n\
- adds r4, r0, 0\n\
- muls r4, r1\n\
- ldr r0, =gEnemyParty\n\
- adds r4, r0\n\
- adds r0, r4, 0\n\
- movs r1, 0x20\n\
- add r2, sp, 0x10\n\
- bl SetMonData\n\
- adds r0, r4, 0\n\
- bl CalculateMonStats\n\
- ldr r2, [sp, 0x2C]\n\
- str r2, [sp, 0x18]\n\
+ adds r5, 0x2\n\
+ adds r7, 0x1\n\
+ cmp r7, 0x3\n\
+ ble _081A4F6A\n\
+ ldr r0, [sp, 0x18]\n\
+ movs r1, 0x64\n\
+ adds r4, r0, 0\n\
+ muls r4, r1\n\
+ ldr r0, =gEnemyParty\n\
+ adds r4, r0\n\
+ adds r0, r4, 0\n\
+ movs r1, 0x20\n\
+ add r2, sp, 0x10\n\
+ bl SetMonData\n\
+ adds r0, r4, 0\n\
+ bl CalculateMonStats\n\
+ ldr r2, [sp, 0x2C]\n\
+ str r2, [sp, 0x18]\n\
_081A4FC4:\n\
- ldr r4, [sp, 0x30]\n\
- ldr r3, [sp, 0x28]\n\
- str r3, [sp, 0x14]\n\
- cmp r3, 0x2\n\
- bgt _081A4FD0\n\
- b _081A4E5C\n\
+ ldr r4, [sp, 0x30]\n\
+ ldr r3, [sp, 0x28]\n\
+ str r3, [sp, 0x14]\n\
+ cmp r3, 0x2\n\
+ bgt _081A4FD0\n\
+ b _081A4E5C\n\
_081A4FD0:\n\
- add sp, 0x44\n\
- pop {r3-r5}\n\
- mov r8, r3\n\
- mov r9, r4\n\
- mov r10, r5\n\
- pop {r4-r7}\n\
- pop {r0}\n\
- bx r0\n\
- .pool\n\
+ add sp, 0x44\n\
+ pop {r3-r5}\n\
+ mov r8, r3\n\
+ mov r9, r4\n\
+ mov r10, r5\n\
+ pop {r4-r7}\n\
+ pop {r0}\n\
+ bx r0\n\
+ .pool\n\
");
}
#endif
diff --git a/src/graphics.c b/src/graphics.c
index b055e5249..2a21b610a 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -1,8 +1,8 @@
#include "global.h"
-const u32 gBattleTextboxTiles[] = INCBIN_U32("graphics/interface/menu.4bpp.lz");
-const u32 gBattleTextboxPalette[] = INCBIN_U32("graphics/interface/menu.gbapal.lz");
-const u32 gBattleTextboxTilemap[] = INCBIN_U32("graphics/interface/menu_map.bin.lz");
+const u32 gBattleTextboxTiles[] = INCBIN_U32("graphics/battle_interface/textbox.4bpp.lz");
+const u32 gBattleTextboxPalette[] = INCBIN_U32("graphics/battle_interface/textbox.gbapal.lz");
+const u32 gBattleTextboxTilemap[] = INCBIN_U32("graphics/battle_interface/textbox_map.bin.lz");
const u32 gMonStillFrontPic_CircledQuestionMark[] = INCBIN_U32("graphics/pokemon/front_pics/circled_question_mark_still_front_pic.4bpp.lz");
const u32 gMonBackPic_CircledQuestionMark[] = INCBIN_U32("graphics/pokemon/back_pics/circled_question_mark_back_pic.4bpp.lz");
@@ -884,18 +884,18 @@ const u32 gBattleAnimSpritePalette_242[] = INCBIN_U32("graphics/battle_anims/spr
const u32 gBattleAnimSpriteSheet_243[] = INCBIN_U32("graphics/battle_anims/sprites/243.4bpp.lz");
const u32 gBattleAnimSpritePalette_243[] = INCBIN_U32("graphics/battle_anims/sprites/243.gbapal.lz");
-const u32 gUnknown_08C2D720[] = INCBIN_U32("graphics/battle_anims/masks/stat.4bpp.lz");
-const u32 gUnknown_08C2D930[] = INCBIN_U32("graphics/battle_anims/masks/stat_tilemap_1.bin.lz");
-const u32 gUnknown_08C2DA4C[] = INCBIN_U32("graphics/battle_anims/masks/stat_tilemap_2.bin.lz");
+const u32 gBattleStatMask_Gfx[] = INCBIN_U32("graphics/battle_anims/masks/stat.4bpp.lz");
+const u32 gBattleStatMask1_Tilemap[] = INCBIN_U32("graphics/battle_anims/masks/stat_tilemap_1.bin.lz");
+const u32 gBattleStatMask2_Tilemap[] = INCBIN_U32("graphics/battle_anims/masks/stat_tilemap_2.bin.lz");
-const u32 gUnknown_08C2DB68[] = INCBIN_U32("graphics/battle_anims/masks/stat1.gbapal.lz");
-const u32 gUnknown_08C2DB88[] = INCBIN_U32("graphics/battle_anims/masks/stat2.gbapal.lz");
-const u32 gUnknown_08C2DBA8[] = INCBIN_U32("graphics/battle_anims/masks/stat3.gbapal.lz");
-const u32 gUnknown_08C2DBC8[] = INCBIN_U32("graphics/battle_anims/masks/stat4.gbapal.lz");
-const u32 gUnknown_08C2DBE8[] = INCBIN_U32("graphics/battle_anims/masks/stat5.gbapal.lz");
-const u32 gUnknown_08C2DC08[] = INCBIN_U32("graphics/battle_anims/masks/stat6.gbapal.lz");
-const u32 gUnknown_08C2DC28[] = INCBIN_U32("graphics/battle_anims/masks/stat7.gbapal.lz");
-const u32 gUnknown_08C2DC48[] = INCBIN_U32("graphics/battle_anims/masks/stat8.gbapal.lz");
+const u32 gBattleStatMask1_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat1.gbapal.lz");
+const u32 gBattleStatMask2_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat2.gbapal.lz");
+const u32 gBattleStatMask3_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat3.gbapal.lz");
+const u32 gBattleStatMask4_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat4.gbapal.lz");
+const u32 gBattleStatMask5_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat5.gbapal.lz");
+const u32 gBattleStatMask6_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat6.gbapal.lz");
+const u32 gBattleStatMask7_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat7.gbapal.lz");
+const u32 gBattleStatMask8_Pal[] = INCBIN_U32("graphics/battle_anims/masks/stat8.gbapal.lz");
const u32 gUnknown_08C2DC68[] = INCBIN_U32("graphics/battle_anims/masks/cure_bubbles.4bpp.lz");
const u32 gUnknown_08C2DDA4[] = INCBIN_U32("graphics/battle_anims/masks/cure_bubbles.gbapal.lz");
@@ -1485,7 +1485,7 @@ const u32 gUnknown_08DD4C4C[] = INCBIN_U32("graphics/link/link_winedge.bin.lz");
const u32 gUnknown_08DD4CF8[] = INCBIN_U32("graphics/interface/unk_change_case.4bpp.lz");
-const u16 gTilesetPalettes_General[][16] =
+const u16 gTilesetPalettes_General[][16] =
{
INCBIN_U16("data/tilesets/primary/general/palettes/00.gbapal"),
INCBIN_U16("data/tilesets/primary/general/palettes/01.gbapal"),
diff --git a/src/ground.c b/src/ground.c
index 33eb3660a..6cb7b8557 100644
--- a/src/ground.c
+++ b/src/ground.c
@@ -1,14 +1,31 @@
#include "global.h"
#include "battle_anim.h"
+#include "random.h"
+#include "scanline_effect.h"
+#include "task.h"
+#include "trig.h"
#include "constants/rgb.h"
-extern void sub_8114994(struct Sprite *);
-extern void sub_8114A7C(struct Sprite *);
-extern void sub_8114AF0(struct Sprite *);
-extern void sub_8114AF0(struct Sprite *);
-extern void sub_8114B80(struct Sprite *);
-extern void sub_81151A0(struct Sprite *);
-extern void sub_8115244(struct Sprite *);
+void AnimBonemerangProjectile(struct Sprite *);
+void AnimBoneHitProjectile(struct Sprite *);
+void AnimDirtScatter(struct Sprite *);
+void AnimMudSportDirt(struct Sprite *);
+void AnimFissureDirtPlumeParticle(struct Sprite *);
+void AnimDigDirtMound(struct Sprite *);
+static void AnimBonemerangProjectileStep(struct Sprite *);
+static void AnimBonemerangProjectileEnd(struct Sprite *);
+static void AnimMudSportDirtRising(struct Sprite *);
+static void AnimMudSportDirtFalling(struct Sprite *);
+static void sub_8114CFC(u8);
+static void sub_8114EB4(u8);
+static void sub_8114F54(u8);
+static void sub_8114FD8(u8);
+static void sub_81150E0(u8, s16, s16);
+static void AnimFissureDirtPlumeParticleStep(struct Sprite *);
+static void sub_81153AC(u8);
+static void sub_81154A4(u8);
+static void sub_8115588(struct Task *);
+static void sub_81156D0(u8);
const union AffineAnimCmd gUnknown_08597150[] =
{
@@ -40,7 +57,7 @@ const struct SpriteTemplate gUnknown_08597178 =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gUnknown_08597170,
- .callback = sub_8114994,
+ .callback = AnimBonemerangProjectile,
};
const struct SpriteTemplate gUnknown_08597190 =
@@ -51,7 +68,7 @@ const struct SpriteTemplate gUnknown_08597190 =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gUnknown_08597174,
- .callback = sub_8114A7C,
+ .callback = AnimBoneHitProjectile,
};
const struct SpriteTemplate gUnknown_085971A8 =
@@ -62,7 +79,7 @@ const struct SpriteTemplate gUnknown_085971A8 =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_8114AF0,
+ .callback = AnimDirtScatter,
};
const union AnimCmd gUnknown_085971C0[] =
@@ -84,7 +101,7 @@ const struct SpriteTemplate gUnknown_085971CC =
.anims = gUnknown_085971C8,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_8114AF0,
+ .callback = AnimDirtScatter,
};
const struct SpriteTemplate gUnknown_085971E4 =
@@ -95,7 +112,7 @@ const struct SpriteTemplate gUnknown_085971E4 =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_8114B80,
+ .callback = AnimMudSportDirt,
};
const struct SpriteTemplate gUnknown_085971FC =
@@ -106,7 +123,7 @@ const struct SpriteTemplate gUnknown_085971FC =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_81151A0,
+ .callback = AnimFissureDirtPlumeParticle,
};
const struct SpriteTemplate gUnknown_08597214 =
@@ -117,5 +134,615 @@ const struct SpriteTemplate gUnknown_08597214 =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_8115244,
+ .callback = AnimDigDirtMound,
};
+
+// Moves a bone projectile towards the target mon, which moves like
+// a boomerang. After hitting the target mon, it comes back to the user.
+void AnimBonemerangProjectile(struct Sprite *sprite)
+{
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
+ sprite->data[0] = 20;
+ sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
+ sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
+ sprite->data[5] = -40;
+ InitAnimArcTranslation(sprite);
+ sprite->callback = AnimBonemerangProjectileStep;
+}
+
+static void AnimBonemerangProjectileStep(struct Sprite *sprite)
+{
+ if (TranslateAnimArc(sprite))
+ {
+ sprite->pos1.x += sprite->pos2.x;
+ sprite->pos1.y += sprite->pos2.y;
+ sprite->pos2.y = 0;
+ sprite->pos2.x = 0;
+ sprite->data[0] = 20;
+ sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
+ sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
+ sprite->data[5] = 40;
+ InitAnimArcTranslation(sprite);
+ sprite->callback = AnimBonemerangProjectileEnd;
+ }
+}
+
+static void AnimBonemerangProjectileEnd(struct Sprite *sprite)
+{
+ if (TranslateAnimArc(sprite))
+ DestroyAnimSprite(sprite);
+}
+
+// Moves a bone projectile towards the target mon, starting right next to
+// the target mon.
+// arg 0: initial x pixel offset
+// arg 1: initial y pixel offset
+// arg 2: target x pixel offset
+// arg 3: target y pixel offset
+// arg 4: duration
+void AnimBoneHitProjectile(struct Sprite *sprite)
+{
+ sub_80A6980(sprite, TRUE);
+ if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
+ gBattleAnimArgs[2] = -gBattleAnimArgs[2];
+
+ sprite->data[0] = gBattleAnimArgs[4];
+ sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[2];
+ sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[3];
+ sprite->callback = StartAnimLinearTranslation;
+ StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
+}
+
+// Moves a small dirt projectile towards the target mon.
+// arg 0: initial x pixel offset
+// arg 1: initial y pixel offset
+// arg 2: duration
+// arg 3: target x pixel offset
+// arg 4: target y pixel offset
+void AnimDirtScatter(struct Sprite *sprite)
+{
+ u8 targetXPos, targetYPos;
+ s16 xOffset, yOffset;
+
+ InitAnimSpritePos(sprite, 1);
+
+ targetXPos = GetBattlerSpriteCoord2(gBattleAnimTarget, 2);
+ targetYPos = GetBattlerSpriteCoord2(gBattleAnimTarget, 3);
+
+ xOffset = Random2() & 0x1F;
+ yOffset = Random2() & 0x1F;
+ if (xOffset > 16)
+ xOffset = 16 - xOffset;
+ if (yOffset > 16)
+ yOffset = 16 - yOffset;
+
+ sprite->data[0] = gBattleAnimArgs[2];
+ sprite->data[2] = targetXPos + xOffset;
+ sprite->data[4] = targetYPos + yOffset;
+ sprite->callback = StartAnimLinearTranslation;
+ StoreSpriteCallbackInData6(sprite, move_anim_8074EE0);
+}
+
+// Moves a particle of dirt in the Mud Sport animation.
+// The dirt can either be rising upward, or falling down.
+// arg 0: 0 = dirt is rising into the air, 1 = dirt is falling down
+// arg 1: initial x pixel offset
+// arg 2: initial y pixel offset
+void AnimMudSportDirt(struct Sprite *sprite)
+{
+ sprite->oam.tileNum++;
+ if (gBattleAnimArgs[0] == 0)
+ {
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2) + gBattleAnimArgs[1];
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3) + gBattleAnimArgs[2];
+ sprite->data[0] = gBattleAnimArgs[1] > 0 ? 1 : -1;
+ sprite->callback = AnimMudSportDirtRising;
+ }
+ else
+ {
+ sprite->pos1.x = gBattleAnimArgs[1];
+ sprite->pos1.y = gBattleAnimArgs[2];
+ sprite->pos2.y = -gBattleAnimArgs[2];
+ sprite->callback = AnimMudSportDirtFalling;
+ }
+}
+
+static void AnimMudSportDirtRising(struct Sprite *sprite)
+{
+ if (++sprite->data[1] > 1)
+ {
+ sprite->data[1] = 0;
+ sprite->pos1.x += sprite->data[0];
+ }
+
+ sprite->pos1.y -= 4;
+ if (sprite->pos1.y < -4)
+ DestroyAnimSprite(sprite);
+}
+
+static void AnimMudSportDirtFalling(struct Sprite *sprite)
+{
+ switch (sprite->data[0])
+ {
+ case 0:
+ sprite->pos2.y += 4;
+ if (sprite->pos2.y >= 0)
+ {
+ sprite->pos2.y = 0;
+ sprite->data[0]++;
+ }
+ break;
+ case 1:
+ if (++sprite->data[1] > 0)
+ {
+ sprite->data[1] = 0;
+ sprite->invisible ^= 1;
+ if (++sprite->data[2] == 10)
+ DestroyAnimSprite(sprite);
+ }
+ break;
+ }
+}
+
+void sub_8114CBC(u8 taskId)
+{
+ struct Task *task = &gTasks[taskId];
+
+ if (gBattleAnimArgs[0] == 0)
+ task->func = sub_8114CFC;
+ else
+ task->func = sub_8114EB4;
+
+ task->func(taskId);
+}
+
+static void sub_8114CFC(u8 taskId)
+{
+ u8 var0;
+ struct Task *task = &gTasks[taskId];
+
+ switch (task->data[0])
+ {
+ case 0:
+ task->data[10] = GetAnimBattlerSpriteId(0);
+ task->data[11] = sub_80A8364(gBattleAnimAttacker);
+ if (task->data[11] == 1)
+ {
+ task->data[12] = gBattle_BG1_X;
+ task->data[13] = gBattle_BG1_Y;
+ }
+ else
+ {
+ task->data[12] = gBattle_BG2_X;
+ task->data[13] = gBattle_BG2_Y;
+ }
+
+ var0 = GetBattlerYCoordWithElevation(gBattleAnimAttacker);
+ task->data[14] = var0 - 32;
+ task->data[15] = var0 + 32;
+ if (task->data[14] < 0)
+ task->data[14] = 0;
+
+ gSprites[task->data[10]].invisible = 1;
+ task->data[0]++;
+ break;
+ case 1:
+ sub_81150E0(task->data[11], task->data[14], task->data[15]);
+ task->data[0]++;
+ break;
+ case 2:
+ task->data[2] = (task->data[2] + 6) & 0x7F;
+ if (++task->data[4] > 2)
+ {
+ task->data[4] = 0;
+ task->data[3]++;
+ }
+
+ task->data[5] = task->data[3] + (gSineTable[task->data[2]] >> 4);
+ if (task->data[11] == 1)
+ gBattle_BG1_Y = task->data[13] - task->data[5];
+ else
+ gBattle_BG2_Y = task->data[13] - task->data[5];
+
+ if (task->data[5] > 63)
+ {
+ task->data[5] = 120 - task->data[14];
+ if (task->data[11] == 1)
+ gBattle_BG1_Y = task->data[13] - task->data[5];
+ else
+ gBattle_BG2_Y = task->data[13] - task->data[5];
+
+ gSprites[task->data[10]].pos2.x = 272 - gSprites[task->data[10]].pos1.x;
+ task->data[0]++;
+ }
+ break;
+ case 3:
+ gScanlineEffect.state = 3;
+ task->data[0]++;
+ break;
+ case 4:
+ DestroyAnimVisualTask(taskId);
+ gSprites[task->data[10]].invisible = 1;
+ break;
+ }
+}
+
+static void sub_8114EB4(u8 taskId)
+{
+ u8 spriteId = GetAnimBattlerSpriteId(0);
+ gSprites[spriteId].invisible = 1;
+ gSprites[spriteId].pos2.x = 0;
+ gSprites[spriteId].pos2.y = 0;
+
+ if (sub_80A8364(gBattleAnimAttacker) == 1)
+ gBattle_BG1_Y = 0;
+ else
+ gBattle_BG2_Y = 0;
+
+ DestroyAnimVisualTask(taskId);
+}
+
+void sub_8114F14(u8 taskId)
+{
+ struct Task *task = &gTasks[taskId];
+
+ if (gBattleAnimArgs[0] == 0)
+ task->func = sub_8114F54;
+ else
+ task->func = sub_8114FD8;
+
+ task->func(taskId);
+}
+
+static void sub_8114F54(u8 taskId)
+{
+ struct Task *task = &gTasks[taskId];
+
+ switch (task->data[0])
+ {
+ case 0:
+ task->data[10] = GetAnimBattlerSpriteId(0);
+ gSprites[task->data[10]].invisible = 0;
+ gSprites[task->data[10]].pos2.x = 0;
+ gSprites[task->data[10]].pos2.y = 160 - gSprites[task->data[10]].pos1.y;
+ task->data[0]++;
+ break;
+ case 1:
+ DestroyAnimVisualTask(taskId);
+ }
+}
+
+static void sub_8114FD8(u8 taskId)
+{
+ u8 var0;
+ struct Task *task = &gTasks[taskId];
+
+ switch (task->data[0])
+ {
+ case 0:
+ task->data[10] = GetAnimBattlerSpriteId(0);
+ task->data[11] = sub_80A8364(gBattleAnimAttacker);
+ if (task->data[11] == 1)
+ task->data[12] = gBattle_BG1_X;
+ else
+ task->data[12] = gBattle_BG2_X;
+
+ var0 = GetBattlerYCoordWithElevation(gBattleAnimAttacker);
+ task->data[14] = var0 - 32;
+ task->data[15] = var0 + 32;
+ task->data[0]++;
+ break;
+ case 1:
+ sub_81150E0(task->data[11], 0, task->data[15]);
+ task->data[0]++;
+ break;
+ case 2:
+ gSprites[task->data[10]].pos2.y = 96;
+ task->data[0]++;
+ break;
+ case 3:
+ gSprites[task->data[10]].pos2.y -= 8;
+ if (gSprites[task->data[10]].pos2.y == 0)
+ {
+ gScanlineEffect.state = 3;
+ task->data[0]++;
+ }
+ break;
+ case 4:
+ DestroyAnimVisualTask(taskId);
+ break;
+ }
+}
+
+static void sub_81150E0(u8 useBG1, s16 y, s16 endY)
+{
+ s16 bgX;
+ struct ScanlineEffectParams scanlineParams;
+
+ if (useBG1 == 1)
+ {
+ bgX = gBattle_BG1_X;
+ scanlineParams.dmaDest = &REG_BG1HOFS;
+ }
+ else
+ {
+ bgX = gBattle_BG2_X;
+ scanlineParams.dmaDest = &REG_BG2HOFS;
+ }
+
+ if (y < 0)
+ y = 0;
+
+ while (y < endY)
+ {
+ gScanlineEffectRegBuffers[0][y] = bgX;
+ gScanlineEffectRegBuffers[1][y] = bgX;
+ y++;
+ }
+
+ while (y < 160)
+ {
+ gScanlineEffectRegBuffers[0][y] = bgX + 240;
+ gScanlineEffectRegBuffers[1][y] = bgX + 240;
+ y++;
+ }
+
+ scanlineParams.dmaControl = SCANLINE_EFFECT_DMACNT_16BIT;
+ scanlineParams.initState = 1;
+ scanlineParams.unused9 = 0;
+ ScanlineEffect_SetParams(scanlineParams);
+}
+
+// Moves a particle of dirt in a plume of dirt. Used in Fissure and Dig.
+// arg 0: which mon (0 = attacker, 1 = target)
+// arg 1: which side of mon (0 = left, 1 = right)
+// arg 2: target x offset
+// arg 3: target y offset
+// arg 4: wave amplitude
+// arg 5: duration
+void AnimFissureDirtPlumeParticle(struct Sprite *sprite)
+{
+ s8 battler;
+ s16 xOffset;
+
+ if (gBattleAnimArgs[0] == 0)
+ battler = gBattleAnimAttacker;
+ else
+ battler = gBattleAnimTarget;
+
+ xOffset = 24;
+ if (gBattleAnimArgs[1] == 1)
+ {
+ xOffset *= -1;
+ gBattleAnimArgs[2] *= -1;
+ }
+
+ sprite->pos1.x = GetBattlerSpriteCoord(battler, 2) + xOffset;
+ sprite->pos1.y = GetBattlerYCoordWithElevation(battler) + 30;
+ sprite->data[0] = gBattleAnimArgs[5];
+ sprite->data[2] = sprite->pos1.x + gBattleAnimArgs[2];
+ sprite->data[4] = sprite->pos1.y + gBattleAnimArgs[3];
+ sprite->data[5] = gBattleAnimArgs[4];
+ InitAnimArcTranslation(sprite);
+ sprite->callback = AnimFissureDirtPlumeParticleStep;
+}
+
+static void AnimFissureDirtPlumeParticleStep(struct Sprite *sprite)
+{
+ if (TranslateAnimArc(sprite))
+ DestroyAnimSprite(sprite);
+}
+
+// Displays the dirt mound seen in the move Dig for set duration.
+// The dirt mound image is too large for a single sprite, so two
+// sprites are lined up next to each other.
+// arg 0: which mon (0 = attacker, 1 = target)
+// arg 1: oam tile num (0 = left half of image, 1 = right half of image)
+// arg 2: duration
+void AnimDigDirtMound(struct Sprite *sprite)
+{
+ s8 battler;
+
+ if (gBattleAnimArgs[0] == 0)
+ battler = gBattleAnimAttacker;
+ else
+ battler = gBattleAnimTarget;
+
+ sprite->pos1.x = GetBattlerSpriteCoord(battler, 0) - 16 + (gBattleAnimArgs[1] * 32);
+ sprite->pos1.y = GetBattlerYCoordWithElevation(battler) + 32;
+ sprite->oam.tileNum += gBattleAnimArgs[1] * 8;
+ StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
+ sprite->data[0] = gBattleAnimArgs[2];
+ sprite->callback = WaitAnimForDuration;
+}
+
+void sub_81152DC(u8 taskId)
+{
+ u16 i;
+ struct Task *task = &gTasks[taskId];
+
+ if (gBattleAnimArgs[1])
+ task->data[14] = task->data[15] = gBattleAnimArgs[1] + 3;
+ else
+ task->data[14] = task->data[15] = (gAnimMovePower / 10) + 3;
+
+ task->data[3] = gBattleAnimArgs[2];
+ switch (gBattleAnimArgs[0])
+ {
+ case 5:
+ task->data[13] = gBattle_BG3_X;
+ task->func = sub_81153AC;
+ break;
+ case 4:
+ task->data[13] = 0;
+ for (i = 0; i < MAX_BATTLERS_COUNT; i++)
+ {
+ if (IsBattlerSpriteVisible(i))
+ {
+ task->data[task->data[13] + 9] = gBattlerSpriteIds[i];
+ task->data[13]++;
+ }
+ }
+ task->func = sub_81154A4;
+ break;
+ default:
+ task->data[9] = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
+ if (task->data[9] == 0xFF)
+ {
+ DestroyAnimVisualTask(taskId);
+ }
+ else
+ {
+ task->data[13] = 1;
+ task->func = sub_81154A4;
+ }
+
+ break;
+ }
+}
+
+static void sub_81153AC(u8 taskId)
+{
+ struct Task *task = &gTasks[taskId];
+
+ switch (task->data[0])
+ {
+ case 0:
+ if (++task->data[1] > 1)
+ {
+ task->data[1] = 0;
+ if ((task->data[2] & 1) == 0)
+ gBattle_BG3_X = task->data[13] + task->data[15];
+ else
+ gBattle_BG3_X = task->data[13] - task->data[15];
+
+ if (++task->data[2] == task->data[3])
+ {
+ task->data[2] = 0;
+ task->data[14]--;
+ task->data[0]++;
+ }
+ }
+ break;
+ case 1:
+ if (++task->data[1] > 1)
+ {
+ task->data[1] = 0;
+ if ((task->data[2] & 1) == 0)
+ gBattle_BG3_X = task->data[13] + task->data[14];
+ else
+ gBattle_BG3_X = task->data[13] - task->data[14];
+
+ if (++task->data[2] == 4)
+ {
+ task->data[2] = 0;
+ if (--task->data[14] == 0)
+ task->data[0]++;
+ }
+ }
+ break;
+ case 2:
+ gBattle_BG3_X = task->data[13];
+ DestroyAnimVisualTask(taskId);
+ break;
+ }
+}
+
+static void sub_81154A4(u8 taskId)
+{
+ u16 i;
+ struct Task *task = &gTasks[taskId];
+
+ switch (task->data[0])
+ {
+ case 0:
+ if (++task->data[1] > 1)
+ {
+ task->data[1] = 0;
+ sub_8115588(task);
+ if (++task->data[2] == task->data[3])
+ {
+ task->data[2] = 0;
+ task->data[14]--;
+ task->data[0]++;
+ }
+ }
+ break;
+ case 1:
+ if (++task->data[1] > 1)
+ {
+ task->data[1] = 0;
+ sub_8115588(task);
+ if (++task->data[2] == 4)
+ {
+ task->data[2] = 0;
+ if (--task->data[14] == 0)
+ task->data[0]++;
+ }
+ }
+ break;
+ case 2:
+ for (i = 0; i < task->data[13]; i++)
+ gSprites[task->data[9 + i]].pos2.x = 0;
+
+ DestroyAnimVisualTask(taskId);
+ break;
+ }
+}
+
+static void sub_8115588(struct Task *task)
+{
+ u16 i;
+ u16 xOffset;
+
+ if ((task->data[2] & 1) == 0)
+ xOffset = (task->data[14] / 2) + (task->data[14] & 1);
+ else
+ xOffset = -(task->data[14] / 2);
+
+ for (i = 0; i < task->data[13]; i++)
+ {
+ gSprites[task->data[9 + i]].pos2.x = xOffset;
+ }
+}
+
+void AnimTask_IsPowerOver99(u8 taskId)
+{
+ gBattleAnimArgs[15] = gAnimMovePower > 99;
+ DestroyAnimVisualTask(taskId);
+}
+
+void sub_8115628(u8 taskId)
+{
+ struct Task *newTask;
+ u8 battler = (gBattleAnimArgs[0] & 1) ? gBattleAnimTarget : gBattleAnimAttacker;
+
+ if (gBattleAnimArgs[0] > 1)
+ battler ^= 2;
+
+ newTask = &gTasks[CreateTask(sub_81156D0, gBattleAnimArgs[1])];
+ newTask->data[1] = (32 - GetBattlerSpriteCoord(battler, 2)) & 0x1FF;
+ newTask->data[2] = (64 - GetBattlerSpriteCoord(battler, 3)) & 0xFF;
+ gBattle_BG3_X = newTask->data[1];
+ gBattle_BG3_Y = newTask->data[2];
+ newTask->data[3] = gBattleAnimArgs[2];
+ DestroyAnimVisualTask(taskId);
+}
+
+static void sub_81156D0(u8 taskId)
+{
+ struct Task *task = &gTasks[taskId];
+
+ if (gBattleAnimArgs[7] == task->data[3])
+ {
+ gBattle_BG3_X = 0;
+ gBattle_BG3_Y = 0;
+ DestroyTask(taskId);
+ }
+ else
+ {
+ gBattle_BG3_X = task->data[1];
+ gBattle_BG3_Y = task->data[2];
+ }
+}
diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c
index 22206405b..315990256 100644
--- a/src/hall_of_fame.c
+++ b/src/hall_of_fame.c
@@ -31,6 +31,7 @@
#include "trainer_pokemon_sprites.h"
#include "data2.h"
#include "rom_81520A8.h"
+#include "constants/rgb.h"
struct HallofFameMon
{
@@ -388,7 +389,7 @@ static bool8 InitHallOfFameScreen(void)
if (!sub_8175024())
{
SetVBlankCallback(VBlankCB_HallOfFame);
- BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, 0);
+ BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK);
gMain.state++;
}
break;
@@ -438,7 +439,7 @@ static void Task_Hof_InitMonData(u8 taskId)
gTasks[taskId].tMonNumber = 0; // valid pokes
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
u8 nick[POKEMON_NAME_LENGTH + 2];
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES))
@@ -468,7 +469,7 @@ static void Task_Hof_InitMonData(u8 taskId)
gTasks[taskId].tDisplayedMonId = 0;
gTasks[taskId].tPlayerSpriteID = 0xFF;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
gTasks[taskId].tMonSpriteId(i) = 0xFF;
}
@@ -521,7 +522,7 @@ static void Task_Hof_InitTeamSaveData(u8 taskId)
static void Task_Hof_TrySaveData(u8 taskId)
{
gGameContinueCallback = CB2_DoHallOfFameScreenDontSaveData;
- if (TrySavingData(3) == 0xFF && gDamagedSaveSectors != 0)
+ if (TrySavingData(SAVE_HALL_OF_FAME) == 0xFF && gDamagedSaveSectors != 0)
{
UnsetBgTilemapBuffer(1);
UnsetBgTilemapBuffer(3);
@@ -626,7 +627,7 @@ static void Task_Hof_TryDisplayAnotherMon(u8 taskId)
if (gTasks[taskId].tDisplayedMonId <= 4 && currMon[1].species != SPECIES_NONE) // there is another pokemon to display
{
gTasks[taskId].tDisplayedMonId++;
- BeginNormalPaletteFade(sUnknown_0203BCD4, 0, 12, 12, 0x63B0);
+ BeginNormalPaletteFade(sUnknown_0203BCD4, 0, 12, 12, RGB(16, 29, 24));
gSprites[gTasks[taskId].tMonSpriteId(currPokeID)].oam.priority = 1;
gTasks[taskId].func = Task_Hof_DisplayMon;
}
@@ -641,8 +642,8 @@ static void Task_Hof_PaletteFadeAndPrintWelcomeText(u8 taskId)
{
u16 i;
- BeginNormalPaletteFade(0xFFFF0000, 0, 0, 0, 0);
- for (i = 0; i < 6; i++)
+ BeginNormalPaletteFade(0xFFFF0000, 0, 0, 0, RGB_BLACK);
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (gTasks[taskId].tMonSpriteId(i) != 0xFF)
gSprites[gTasks[taskId].tMonSpriteId(i)].oam.priority = 0;
@@ -665,12 +666,12 @@ static void sub_8173DC0(u8 taskId)
else
{
u16 i;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
if (gTasks[taskId].tMonSpriteId(i) != 0xFF)
gSprites[gTasks[taskId].tMonSpriteId(i)].oam.priority = 1;
}
- BeginNormalPaletteFade(sUnknown_0203BCD4, 0, 12, 12, 0x63B0);
+ BeginNormalPaletteFade(sUnknown_0203BCD4, 0, 12, 12, RGB(16, 29, 24));
FillWindowPixelBuffer(0, 0);
CopyWindowToVram(0, 3);
gTasks[taskId].tFrameCount = 7;
@@ -738,7 +739,7 @@ static void Task_Hof_ExitOnKeyPressed(u8 taskId)
static void Task_Hof_HandlePaletteOnExit(u8 taskId)
{
CpuCopy16(gPlttBufferFaded, gPlttBufferUnfaded, 0x400);
- BeginNormalPaletteFade(0xFFFFFFFF, 8, 0, 0x10, 0);
+ BeginNormalPaletteFade(0xFFFFFFFF, 8, 0, 0x10, RGB_BLACK);
gTasks[taskId].func = Task_Hof_HandleExit;
}
@@ -748,7 +749,7 @@ static void Task_Hof_HandleExit(u8 taskId)
{
s32 i;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
u8 spriteId = gTasks[taskId].tMonSpriteId(i);
if (spriteId != 0xFF)
@@ -844,7 +845,7 @@ void CB2_DoHallOfFamePC(void)
SetGpuReg(REG_OFFSET_BLDY, 0);
taskId = CreateTask(Task_HofPC_CopySaveData, 0);
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
gTasks[taskId].tMonSpriteId(i) = 0xFF;
}
@@ -901,7 +902,7 @@ static void Task_HofPC_DrawSpritesPrintText(u8 taskId)
gTasks[taskId].tCurrMonId = 0;
gTasks[taskId].tMonNo = 0;
- for (i = 0; i < 6; i++, currMon++)
+ for (i = 0; i < PARTY_SIZE; i++, currMon++)
{
if (currMon->species != 0)
gTasks[taskId].tMonNo++;
@@ -909,7 +910,7 @@ static void Task_HofPC_DrawSpritesPrintText(u8 taskId)
currMon = &savedTeams->mon[0];
- for (i = 0; i < 6; i++, currMon++)
+ for (i = 0; i < PARTY_SIZE; i++, currMon++)
{
if (currMon->species != 0)
{
@@ -940,7 +941,7 @@ static void Task_HofPC_DrawSpritesPrintText(u8 taskId)
}
}
- BlendPalettes(0xFFFF0000, 0xC, 0x63B0);
+ BlendPalettes(0xFFFF0000, 0xC, RGB(16, 29, 24));
ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].tCurrPageNo, STR_CONV_MODE_RIGHT_ALIGN, 3);
StringExpandPlaceholders(gStringVar4, gText_HOFNumber);
@@ -963,7 +964,7 @@ static void Task_HofPC_PrintMonInfo(u8 taskId)
for (i = 0; i < gTasks[taskId].tCurrTeamNo; i++)
savedTeams++;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
u16 spriteId = gTasks[taskId].tMonSpriteId(i);
if (spriteId != 0xFF)
@@ -973,7 +974,7 @@ static void Task_HofPC_PrintMonInfo(u8 taskId)
currMonID = gTasks[taskId].tMonSpriteId(gTasks[taskId].tCurrMonId);
gSprites[currMonID].oam.priority = 0;
sUnknown_0203BCD4 = (0x10000 << gSprites[currMonID].oam.paletteNum) ^ 0xFFFF0000;
- BlendPalettesUnfaded(sUnknown_0203BCD4, 0xC, 0x63B0);
+ BlendPalettesUnfaded(sUnknown_0203BCD4, 0xC, RGB(16, 29, 24));
currMon = &savedTeams->mon[gTasks[taskId].tCurrMonId];
if (currMon->species != SPECIES_EGG)
@@ -1056,7 +1057,7 @@ static void Task_HofPC_HandleExit(u8 taskId)
{
u8 i;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
u16 spriteId = gTasks[taskId].tMonSpriteId(i);
if (spriteId != 0xFF)
diff --git a/src/item.c b/src/item.c
index b4a2fd6f0..b2c009be6 100644
--- a/src/item.c
+++ b/src/item.c
@@ -10,9 +10,9 @@
#include "item_menu.h"
#include "strings.h"
#include "load_save.h"
+#include "battle_pyramid.h"
#include "battle_pyramid_bag.h"
-extern bool8 InBattlePyramid(void);
extern u16 gUnknown_0203CF30[];
extern const struct Item gItems[];
diff --git a/src/load_save.c b/src/load_save.c
index 45b4d200b..960a98981 100644
--- a/src/load_save.c
+++ b/src/load_save.c
@@ -6,14 +6,15 @@
#include "random.h"
#include "malloc.h"
#include "item.h"
+#include "overworld.h"
+#include "decoration_inventory.h"
+
+static void ApplyNewEncryptionKeyToAllEncryptedData(u32 encryptionKey);
extern void* gUnknown_0203CF5C;
extern bool16 IdentifyFlash(void);
-extern void SetDecorationInventoriesPointers(void);
-extern void ApplyNewEncryptionKeyToGameStats(u32 key);
extern void ApplyNewEncryptionKeyToBerryPowder(u32 key);
-extern void sub_8084FAC(int unused);
#define SAVEBLOCK_MOVE_RANGE 128
@@ -286,7 +287,7 @@ void ApplyNewEncryptionKeyToWord(u32 *word, u32 newKey)
*word ^= newKey;
}
-void ApplyNewEncryptionKeyToAllEncryptedData(u32 encryptionKey)
+static void ApplyNewEncryptionKeyToAllEncryptedData(u32 encryptionKey)
{
ApplyNewEncryptionKeyToGameStats(encryptionKey);
ApplyNewEncryptionKeyToBagItems_(encryptionKey);
diff --git a/src/lottery_corner.c b/src/lottery_corner.c
index 2ded9c943..bd7d17ef7 100644
--- a/src/lottery_corner.c
+++ b/src/lottery_corner.c
@@ -7,6 +7,7 @@
#include "constants/species.h"
#include "string_util.h"
#include "text.h"
+#include "pokemon_storage_system.h"
static EWRAM_DATA u16 sWinNumberDigit = 0;
static EWRAM_DATA u16 sOtIdDigit = 0;
@@ -55,23 +56,22 @@ void PickLotteryCornerTicket(void)
gSpecialVar_0x8004 = 0;
slot = 0;
box = 0;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
- struct Pokemon *pkmn = &gPlayerParty[i];
+ struct Pokemon *mon = &gPlayerParty[i];
- // UB: Too few arguments for function GetMonData
- if (GetMonData(pkmn, MON_DATA_SPECIES) != SPECIES_NONE)
+ if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE)
{
// do not calculate ticket values for eggs.
- if (!GetMonData(pkmn, MON_DATA_IS_EGG))
+ if (!GetMonData(mon, MON_DATA_IS_EGG))
{
- u32 otId = GetMonData(pkmn, MON_DATA_OT_ID);
+ u32 otId = GetMonData(mon, MON_DATA_OT_ID);
u8 numMatchingDigits = GetMatchingDigits(gSpecialVar_Result, otId);
if (numMatchingDigits > gSpecialVar_0x8004 && numMatchingDigits > 1)
{
gSpecialVar_0x8004 = numMatchingDigits - 1;
- box = 14;
+ box = TOTAL_BOXES_COUNT;
slot = i;
}
}
@@ -80,11 +80,9 @@ void PickLotteryCornerTicket(void)
break;
}
- // player has 14 boxes.
- for (i = 0; i < 14; i++)
+ for (i = 0; i < TOTAL_BOXES_COUNT; i++)
{
- // player has 30 slots per box.
- for (j = 0; j < 30; j++)
+ for (j = 0; j < IN_BOX_COUNT; j++)
{
if (GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_SPECIES) != SPECIES_NONE &&
!GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_IS_EGG))
@@ -106,7 +104,7 @@ void PickLotteryCornerTicket(void)
{
gSpecialVar_0x8005 = sLotteryPrizes[gSpecialVar_0x8004 - 1];
- if (box == 14)
+ if (box == TOTAL_BOXES_COUNT)
{
gSpecialVar_0x8006 = 0;
GetMonData(&gPlayerParty[slot], MON_DATA_NICKNAME, gStringVar1);
diff --git a/src/map_name_popup.c b/src/map_name_popup.c
index 172fcc723..ab52cb37e 100644
--- a/src/map_name_popup.c
+++ b/src/map_name_popup.c
@@ -15,7 +15,6 @@
#include "task.h"
#include "text.h"
-
// enums
enum MapPopUp_Themes
{
@@ -33,7 +32,7 @@ static void ShowMapNamePopUpWindow(void);
static void LoadMapNamePopUpWindowBg(void);
// EWRAM
-static EWRAM_DATA u8 mapNamePopupTaskId = 0;
+static EWRAM_DATA u8 sPopupTaskId = 0;
// .rodata
static const u8 gMapPopUp_Table[][960] =
@@ -202,7 +201,7 @@ bool8 sub_80D47D4(void)
{
HideStartMenu();
ShowMapNamePopup();
- return 1;
+ return TRUE;
}
void ShowMapNamePopup(void)
@@ -211,16 +210,16 @@ void ShowMapNamePopup(void)
{
if (!FuncIsActiveTask(Task_MapNamePopUpWindow))
{
- mapNamePopupTaskId = CreateTask(Task_MapNamePopUpWindow, 90);
+ sPopupTaskId = CreateTask(Task_MapNamePopUpWindow, 90);
SetGpuReg(REG_OFFSET_BG0VOFS, 40);
- gTasks[mapNamePopupTaskId].data[0] = 6;
- gTasks[mapNamePopupTaskId].data[2] = 40;
+ gTasks[sPopupTaskId].data[0] = 6;
+ gTasks[sPopupTaskId].data[2] = 40;
}
else
{
- if (gTasks[mapNamePopupTaskId].data[0] != 2)
- gTasks[mapNamePopupTaskId].data[0] = 2;
- gTasks[mapNamePopupTaskId].data[3] = 1;
+ if (gTasks[sPopupTaskId].data[0] != 2)
+ gTasks[sPopupTaskId].data[0] = 2;
+ gTasks[sPopupTaskId].data[3] = 1;
}
}
}
@@ -246,7 +245,7 @@ static void Task_MapNamePopUpWindow(u8 taskId)
{
task->data[2] = 0;
task->data[0] = 1;
- gTasks[mapNamePopupTaskId].data[1] = 0;
+ gTasks[sPopupTaskId].data[1] = 0;
}
break;
case 1:
@@ -293,7 +292,7 @@ void HideMapNamePopUpWindow(void)
sub_819746C(GetMapNamePopUpWindowId(), TRUE);
RemoveMapNamePopUpWindow();
SetGpuReg_ForcedBlank(REG_OFFSET_BG0VOFS, 0);
- DestroyTask(mapNamePopupTaskId);
+ DestroyTask(sPopupTaskId);
}
}
@@ -304,9 +303,9 @@ static void ShowMapNamePopUpWindow(void)
u8 x;
const u8* mapDisplayHeaderSource;
- if(InBattlePyramid())
+ if (InBattlePyramid())
{
- if(gMapHeader.mapLayoutId == 0x17A)
+ if (gMapHeader.mapLayoutId == 0x17A)
{
withoutPrefixPtr = &(mapDisplayHeader[3]);
mapDisplayHeaderSource = gBattlePyramid_MapHeaderStrings[7];
@@ -333,220 +332,47 @@ static void ShowMapNamePopUpWindow(void)
CopyWindowToVram(GetMapNamePopUpWindowId(), 3);
}
-#ifdef NONMATCHING
static void sub_80D4A78(u8 bg, u8 x, u8 y, u8 deltaX, u8 deltaY, u8 unused)
{
s32 i;
- for(i=0; i<=11; i++)
+ for (i = 0; i < 12; i++)
{
- FillBgTilemapBufferRect(bg, 0x21D + i, x + i - 1, y - 1, 1, 1, 0xE);
+ FillBgTilemapBufferRect(bg, 0x21D + i, i - 1 + x, y - 1, 1, 1, 0xE);
}
- FillBgTilemapBufferRect(bg, 0x229 + i, x - 1, y, 1, 1, 0xE);
- FillBgTilemapBufferRect(bg, 0x22A + i, deltaX + x, y, 1, 1, 0xE);
- FillBgTilemapBufferRect(bg, 0x22B + i, x - 1, y + 1 , 1, 1, 0xE);
- FillBgTilemapBufferRect(bg, 0x22C + i, deltaX + x, y + 1, 1, 1, 0xE);
- FillBgTilemapBufferRect(bg, 0x22D + i, x - 1, y + 2, 1, 1, 0xE);
- FillBgTilemapBufferRect(bg, 0x22E + i, deltaX + x, y + 2, 1, 1, 0xE);
- for(i=0; i<=11; i++)
+ FillBgTilemapBufferRect(bg, 0x229, x - 1, y, 1, 1, 0xE);
+ FillBgTilemapBufferRect(bg, 0x22A, deltaX + x, y, 1, 1, 0xE);
+ FillBgTilemapBufferRect(bg, 0x22B, x - 1, y + 1 , 1, 1, 0xE);
+ FillBgTilemapBufferRect(bg, 0x22C, deltaX + x, y + 1, 1, 1, 0xE);
+ FillBgTilemapBufferRect(bg, 0x22D, x - 1, y + 2, 1, 1, 0xE);
+ FillBgTilemapBufferRect(bg, 0x22E, deltaX + x, y + 2, 1, 1, 0xE);
+ for (i = 0; i < 12; i++)
{
- FillBgTilemapBufferRect(bg, 0x22F + i, x + i - 1, y + deltaY, 1, 1, 0xE);
+ FillBgTilemapBufferRect(bg, 0x22F + i, i - 1 + x, y + deltaY, 1, 1, 0xE);
}
}
-#else
-NAKED
-static void sub_80D4A78(u8 bg, u8 x, u8 y, u8 deltaX, u8 deltaY, u8 unused)
-{
- asm("\n\
- .syntax unified\n\
- push {r4-r7,lr}\n\
- mov r7, r10\n\
- mov r6, r9\n\
- mov r5, r8\n\
- push {r5-r7}\n\
- sub sp, 0x1C\n\
- ldr r4, [sp, 0x3C]\n\
- lsls r0, 24\n\
- lsrs r7, r0, 24\n\
- lsls r1, 24\n\
- lsrs r1, 24\n\
- mov r10, r1\n\
- lsls r2, 24\n\
- lsls r3, 24\n\
- lsrs r3, 24\n\
- str r3, [sp, 0x10]\n\
- lsls r4, 24\n\
- lsrs r4, 24\n\
- str r4, [sp, 0x14]\n\
- movs r5, 0\n\
- lsls r0, r1, 24\n\
- asrs r1, r0, 24\n\
- lsrs r3, r2, 24\n\
- str r3, [sp, 0xC]\n\
- movs r6, 0xFF\n\
- lsls r6, 24\n\
- adds r6, r2\n\
- mov r8, r6\n\
- str r0, [sp, 0x18]\n\
- subs r4, r1, 0x1\n\
- _080D4AB4:\n\
- ldr r0, =0x0000021d\n\
- adds r1, r5, r0\n\
- lsls r1, 16\n\
- lsrs r1, 16\n\
- lsls r2, r4, 24\n\
- lsrs r2, 24\n\
- movs r3, 0x1\n\
- str r3, [sp]\n\
- str r3, [sp, 0x4]\n\
- movs r6, 0xE\n\
- mov r9, r6\n\
- str r6, [sp, 0x8]\n\
- adds r0, r7, 0\n\
- mov r6, r8\n\
- lsrs r3, r6, 24\n\
- bl FillBgTilemapBufferRect\n\
- adds r4, 0x1\n\
- adds r5, 0x1\n\
- cmp r5, 0xB\n\
- ble _080D4AB4\n\
- ldr r1, =0x00000229\n\
- movs r0, 0x1\n\
- negs r0, r0\n\
- add r0, r10\n\
- lsls r0, 24\n\
- lsrs r0, 24\n\
- mov r8, r0\n\
- movs r5, 0x1\n\
- str r5, [sp]\n\
- str r5, [sp, 0x4]\n\
- mov r2, r9\n\
- str r2, [sp, 0x8]\n\
- adds r0, r7, 0\n\
- mov r2, r8\n\
- ldr r3, [sp, 0xC]\n\
- bl FillBgTilemapBufferRect\n\
- ldr r1, =0x0000022a\n\
- ldr r6, [sp, 0x10]\n\
- add r6, r10\n\
- lsls r6, 24\n\
- lsrs r6, 24\n\
- str r5, [sp]\n\
- str r5, [sp, 0x4]\n\
- mov r3, r9\n\
- str r3, [sp, 0x8]\n\
- adds r0, r7, 0\n\
- adds r2, r6, 0\n\
- ldr r3, [sp, 0xC]\n\
- bl FillBgTilemapBufferRect\n\
- ldr r1, =0x0000022b\n\
- ldr r4, [sp, 0xC]\n\
- adds r4, 0x1\n\
- lsls r4, 24\n\
- lsrs r4, 24\n\
- str r5, [sp]\n\
- str r5, [sp, 0x4]\n\
- mov r0, r9\n\
- str r0, [sp, 0x8]\n\
- adds r0, r7, 0\n\
- mov r2, r8\n\
- adds r3, r4, 0\n\
- bl FillBgTilemapBufferRect\n\
- movs r1, 0x8B\n\
- lsls r1, 2\n\
- str r5, [sp]\n\
- str r5, [sp, 0x4]\n\
- mov r2, r9\n\
- str r2, [sp, 0x8]\n\
- adds r0, r7, 0\n\
- adds r2, r6, 0\n\
- adds r3, r4, 0\n\
- bl FillBgTilemapBufferRect\n\
- ldr r1, =0x0000022d\n\
- ldr r4, [sp, 0xC]\n\
- adds r4, 0x2\n\
- lsls r4, 24\n\
- lsrs r4, 24\n\
- str r5, [sp]\n\
- str r5, [sp, 0x4]\n\
- mov r3, r9\n\
- str r3, [sp, 0x8]\n\
- adds r0, r7, 0\n\
- mov r2, r8\n\
- adds r3, r4, 0\n\
- bl FillBgTilemapBufferRect\n\
- ldr r1, =0x0000022e\n\
- str r5, [sp]\n\
- str r5, [sp, 0x4]\n\
- mov r0, r9\n\
- str r0, [sp, 0x8]\n\
- adds r0, r7, 0\n\
- adds r2, r6, 0\n\
- adds r3, r4, 0\n\
- bl FillBgTilemapBufferRect\n\
- movs r5, 0\n\
- ldr r1, [sp, 0xC]\n\
- ldr r2, [sp, 0x14]\n\
- adds r0, r1, r2\n\
- lsls r4, r0, 24\n\
- movs r6, 0x1\n\
- _080D4B8A:\n\
- ldr r3, =0x0000022f\n\
- adds r1, r5, r3\n\
- lsls r1, 16\n\
- lsrs r1, 16\n\
- subs r0, r5, 0x1\n\
- ldr r3, [sp, 0x18]\n\
- asrs r2, r3, 24\n\
- adds r2, r0\n\
- lsls r2, 24\n\
- lsrs r2, 24\n\
- str r6, [sp]\n\
- str r6, [sp, 0x4]\n\
- movs r0, 0xE\n\
- str r0, [sp, 0x8]\n\
- adds r0, r7, 0\n\
- lsrs r3, r4, 24\n\
- bl FillBgTilemapBufferRect\n\
- adds r5, 0x1\n\
- cmp r5, 0xB\n\
- ble _080D4B8A\n\
- add sp, 0x1C\n\
- pop {r3-r5}\n\
- mov r8, r3\n\
- mov r9, r4\n\
- mov r10, r5\n\
- pop {r4-r7}\n\
- pop {r0}\n\
- bx r0\n\
- .pool\n\
- .syntax divided");
-}
-#endif // NONMATCHING
static void LoadMapNamePopUpWindowBg(void)
{
- u8 popupWindowId;
- u16 regionMapSectionId;
u8 popUpThemeId;
+ u8 popupWindowId = GetMapNamePopUpWindowId();
+ u16 regionMapSectionId = gMapHeader.regionMapSectionId;
- popupWindowId = GetMapNamePopUpWindowId();
- regionMapSectionId = gMapHeader.regionMapSectionId;
- if(regionMapSectionId > MAPSEC_DYNAMIC)
+ if (regionMapSectionId > MAPSEC_DYNAMIC)
{
- if(regionMapSectionId > MAPSEC_SPECIAL_AREA)
+ if (regionMapSectionId > MAPSEC_SPECIAL_AREA)
regionMapSectionId -= (MAPSEC_SPECIAL_AREA - MAPSEC_DYNAMIC);
else
- regionMapSectionId = 0; //discard kanto region sections
+ regionMapSectionId = 0; // Discard kanto region sections;
}
popUpThemeId = gRegionMapSectionId_To_PopUpThemeIdMapping[regionMapSectionId];
- LoadBgTiles(GetWindowAttribute(popupWindowId, WINDOW_BG), &(gMapPopUp_Outline_Table[popUpThemeId][0]), 0x400, 0x21D);
+ LoadBgTiles(GetWindowAttribute(popupWindowId, WINDOW_BG), gMapPopUp_Outline_Table[popUpThemeId], 0x400, 0x21D);
CallWindowFunction(popupWindowId, sub_80D4A78);
PutWindowTilemap(popupWindowId);
if(gMapHeader.weather == WEATHER_BUBBLES)
LoadPalette(&gUnknown_0857F444, 0xE0, 0x20);
else
- LoadPalette(&(gMapPopUp_Palette_Table[popUpThemeId][0]), 0xE0, 0x20);
- BlitBitmapToWindow(popupWindowId, &(gMapPopUp_Table[popUpThemeId][0]), 0, 0, 80, 24);
+ LoadPalette(gMapPopUp_Palette_Table[popUpThemeId], 0xE0, 0x20);
+ BlitBitmapToWindow(popupWindowId, gMapPopUp_Table[popUpThemeId], 0, 0, 80, 24);
}
diff --git a/src/mossdeep_gym.c b/src/mossdeep_gym.c
new file mode 100644
index 000000000..cd377ad83
--- /dev/null
+++ b/src/mossdeep_gym.c
@@ -0,0 +1,313 @@
+#include "global.h"
+#include "event_object_movement.h"
+#include "fieldmap.h"
+#include "malloc.h"
+#include "mossdeep_gym.h"
+#include "script_movement.h"
+#include "constants/event_object_movement_constants.h"
+
+// Movement scripts.
+extern const u8 gUnknown_08612698[];
+extern const u8 gUnknown_0861269C[];
+extern const u8 gUnknown_086126A0[];
+extern const u8 gUnknown_086126A4[];
+extern const u8 gUnknown_086126A8[];
+extern const u8 gUnknown_086126AA[];
+extern const u8 gUnknown_086126AC[];
+extern const u8 gUnknown_086126AE[];
+
+struct MossdeepSubStruct
+{
+ u8 unk0;
+ u8 eventTemplateId;
+};
+
+struct MossdeepStruct
+{
+ struct MossdeepSubStruct objects[EVENT_OBJECTS_COUNT];
+ u8 count;
+ bool8 unk41;
+};
+
+// This file's functions.
+static void AddEventObject(u8 eventTemplateId, u8 arg1);
+static void sub_81A8D94(u8 eventTemplateId, u8 arg1);
+
+// EWRAM vars
+EWRAM_DATA static struct MossdeepStruct *gUnknown_0203CE50 = NULL;
+
+// code
+void InitMossdeepGymTiles(bool8 arg0)
+{
+ if (gUnknown_0203CE50 == NULL)
+ gUnknown_0203CE50 = AllocZeroed(sizeof(*gUnknown_0203CE50));
+
+ gUnknown_0203CE50->unk41 = arg0;
+}
+
+void FinishMossdeepGymTiles(void)
+{
+ u8 id;
+
+ if (gUnknown_0203CE50 != NULL)
+ FREE_AND_SET_NULL(gUnknown_0203CE50);
+
+ id = GetEventObjectIdByLocalIdAndMap(0xFF, 0, 0);
+ EventObjectClearHeldMovementIfFinished(&gEventObjects[id]);
+ sub_80D338C();
+}
+
+u16 MossdeepGym_MoveEvents(u8 arg0)
+{
+ u8 i;
+ struct EventObjectTemplate *events = gSaveBlock1Ptr->eventObjectTemplates;
+ u16 localId = 0;
+
+ for (i = 0; i < EVENT_OBJECT_TEMPLATES_COUNT; i++)
+ {
+ s32 var;
+ u8 r5;
+ s16 x = events[i].x + 7;
+ s16 y = events[i].y + 7;
+ u16 metatile = MapGridGetMetatileIdAt(x, y);
+
+ if (!gUnknown_0203CE50->unk41)
+ var = 0x250;
+ else
+ var = 0x298;
+
+ if (metatile < 0x250)
+ continue;
+
+ if ((u8)((metatile - var) / 8) >= 5)
+ continue;
+ if ((u8)((metatile - var) / 8) != arg0)
+ continue;
+
+ r5 = (u8)((metatile - var) % 8);
+ if (r5 < 4)
+ {
+ s8 x = 0;
+ s8 y = 0;
+ const u8 *movementScript;
+
+ switch (r5)
+ {
+ case 0:
+ movementScript = gUnknown_08612698;
+ x = 1;
+ break;
+ case 1:
+ movementScript = gUnknown_0861269C;
+ y = 1;
+ break;
+ case 2:
+ movementScript = gUnknown_086126A0;
+ x = -1;
+ break;
+ case 3:
+ movementScript = gUnknown_086126A4;
+ y = -1;
+ break;
+ default:
+ continue;
+ }
+
+ events[i].x += x;
+ events[i].y += y;
+ if (GetEventObjectIdByLocalIdAndMap(events[i].localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup) != EVENT_OBJECTS_COUNT)
+ {
+ AddEventObject(i, r5);
+ localId = events[i].localId;
+ ScriptMovement_StartObjectMovementScript(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, movementScript);
+ }
+ else
+ {
+ sub_81A8D94(i, r5);
+ }
+ }
+ }
+
+ return localId;
+}
+
+void MossdeepGym_TurnEvents(void)
+{
+ u8 i;
+ s32 var;
+ struct EventObjectTemplate *events;
+
+ if (gUnknown_0203CE50 == NULL)
+ return;
+
+ if (!gUnknown_0203CE50->unk41)
+ var = 0x250;
+ else
+ var = 0x298;
+
+ events = gSaveBlock1Ptr->eventObjectTemplates;
+ for (i = 0; i < gUnknown_0203CE50->count; i++)
+ {
+ s32 r6;
+ s8 r0;
+ u8 eventObjectId;
+ s16 x = events[gUnknown_0203CE50->objects[i].eventTemplateId].x + 7;
+ s16 y = events[gUnknown_0203CE50->objects[i].eventTemplateId].y + 7;
+ u16 metatile = MapGridGetMetatileIdAt(x, y);
+
+ r0 = (u8)((metatile - var) % 8);
+ r0 -= (gUnknown_0203CE50->objects[i].unk0);
+ if (r0 < 0 || r0 == 3)
+ {
+ if (r0 == -3)
+ r6 = 1;
+ else
+ r6 = 0;
+ }
+ else
+ {
+ if (r0 > 0)
+ r6 = 1;
+ else
+ r6 = 2;
+ }
+
+ eventObjectId = GetEventObjectIdByLocalIdAndMap(events[gUnknown_0203CE50->objects[i].eventTemplateId].localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
+ if (eventObjectId != EVENT_OBJECTS_COUNT)
+ {
+ const u8 *movementScript;
+ u8 direction = gEventObjects[eventObjectId].facingDirection;
+ if (r6 == 0)
+ {
+ switch (direction)
+ {
+ case DIR_EAST:
+ movementScript = gUnknown_086126AE;
+ events[gUnknown_0203CE50->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_UP;
+ break;
+ case DIR_SOUTH:
+ movementScript = gUnknown_086126A8;
+ events[gUnknown_0203CE50->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_RIGHT;
+ break;
+ case DIR_WEST:
+ movementScript = gUnknown_086126AA;
+ events[gUnknown_0203CE50->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_DOWN;
+ break;
+ case DIR_NORTH:
+ movementScript = gUnknown_086126AC;
+ events[gUnknown_0203CE50->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_LEFT;
+ break;
+ default:
+ continue;
+ }
+ ScriptMovement_StartObjectMovementScript(events[gUnknown_0203CE50->objects[i].eventTemplateId].localId,
+ gSaveBlock1Ptr->location.mapNum,
+ gSaveBlock1Ptr->location.mapGroup,
+ movementScript);
+ }
+ else if (r6 == 1)
+ {
+ switch (direction)
+ {
+ case DIR_EAST:
+ movementScript = gUnknown_086126AA;
+ events[gUnknown_0203CE50->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_DOWN;
+ break;
+ case DIR_SOUTH:
+ movementScript = gUnknown_086126AC;
+ events[gUnknown_0203CE50->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_LEFT;
+ break;
+ case DIR_WEST:
+ movementScript = gUnknown_086126AE;
+ events[gUnknown_0203CE50->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_UP;
+ break;
+ case DIR_NORTH:
+ movementScript = gUnknown_086126A8;
+ events[gUnknown_0203CE50->objects[i].eventTemplateId].movementType = MOVEMENT_TYPE_FACE_RIGHT;
+ break;
+ default:
+ continue;
+ }
+ ScriptMovement_StartObjectMovementScript(events[gUnknown_0203CE50->objects[i].eventTemplateId].localId,
+ gSaveBlock1Ptr->location.mapNum,
+ gSaveBlock1Ptr->location.mapGroup,
+ movementScript);
+ }
+ }
+ }
+}
+
+static void AddEventObject(u8 eventTemplateId, u8 arg1)
+{
+ gUnknown_0203CE50->objects[gUnknown_0203CE50->count].eventTemplateId = eventTemplateId;
+ gUnknown_0203CE50->objects[gUnknown_0203CE50->count].unk0 = arg1;
+ gUnknown_0203CE50->count++;
+}
+
+static void sub_81A8D94(u8 eventTemplateId, u8 arg1)
+{
+ s8 r0;
+ s32 r6;
+ s32 var;
+ u16 movementType;
+ struct EventObjectTemplate *events = gSaveBlock1Ptr->eventObjectTemplates;
+ s16 x = events[eventTemplateId].x + 7;
+ s16 y = events[eventTemplateId].y + 7;
+ u16 metatile = MapGridGetMetatileIdAt(x, y);
+
+ if (!gUnknown_0203CE50->unk41)
+ var = 0x250;
+ else
+ var = 0x298;
+
+ r0 = (u8)((metatile - var) % 8);
+ r0 -= arg1;
+ if (r0 < 0 || r0 == 3)
+ r6 = 0;
+ else if (r0 > 0 || r0 == -3)
+ r6 = 1;
+ else
+ r6 = 2;
+
+ movementType = events[eventTemplateId].movementType;
+ if (r6 == 0)
+ {
+ switch (movementType)
+ {
+ case MOVEMENT_TYPE_FACE_RIGHT:
+ events[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_UP;
+ break;
+ case MOVEMENT_TYPE_FACE_DOWN:
+ events[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_RIGHT;
+ break;
+ case MOVEMENT_TYPE_FACE_LEFT:
+ events[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_DOWN;
+ break;
+ case MOVEMENT_TYPE_FACE_UP:
+ events[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_LEFT;
+ break;
+ default:
+ break;
+ }
+ }
+ else if (r6 == 1)
+ {
+ switch (movementType)
+ {
+ case MOVEMENT_TYPE_FACE_RIGHT:
+ events[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_DOWN;
+ break;
+ case MOVEMENT_TYPE_FACE_DOWN:
+ events[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_LEFT;
+ break;
+ case MOVEMENT_TYPE_FACE_LEFT:
+ events[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_UP;
+ break;
+ case MOVEMENT_TYPE_FACE_UP:
+ events[eventTemplateId].movementType = MOVEMENT_TYPE_FACE_RIGHT;
+ break;
+ default:
+ break;
+ }
+ }
+}
diff --git a/src/multiboot.c b/src/multiboot.c
index 7fd6df2d0..da90a55c0 100644
--- a/src/multiboot.c
+++ b/src/multiboot.c
@@ -1,7 +1,7 @@
#include "gba/gba.h"
#include "multiboot.h"
-static u16 MultiBoot_required_data[MULTIBOOT_NCHILD];
+IWRAM_DATA static u16 MultiBoot_required_data[MULTIBOOT_NCHILD];
static int MultiBootSend(struct MultiBootParam *mp, u16 data);
static int MultiBootHandShake(struct MultiBootParam *mp);
diff --git a/src/mystery_event_script.c b/src/mystery_event_script.c
index 921c8e97c..4196bb34c 100644
--- a/src/mystery_event_script.c
+++ b/src/mystery_event_script.c
@@ -18,7 +18,6 @@
#include "pokemon_storage_system.h"
extern void sub_811EFC0(u8);
-extern void ValidateEReaderTrainer(void);
extern ScrCmdFunc gMysteryEventScriptCmdTable[];
extern ScrCmdFunc gMysteryEventScriptCmdTableEnd[];
diff --git a/src/new_game.c b/src/new_game.c
index cdabd5ccc..18b128624 100644
--- a/src/new_game.c
+++ b/src/new_game.c
@@ -28,7 +28,6 @@
#include "apprentice.h"
#include "frontier_util.h"
-extern u8 gDifferentSaveFile;
extern u16 gSaveFileStatus;
extern u8 gUnknown_030060B0;
@@ -61,6 +60,10 @@ static void ClearFrontierRecord(void);
static void WarpToTruck(void);
static void ResetMiniGamesResults(void);
+// EWRAM vars
+EWRAM_DATA bool8 gDifferentSaveFile = FALSE;
+EWRAM_DATA bool8 gUnknown_020322D5 = FALSE;
+
// const rom data
static const struct ContestWinner sContestWinnerPicDummy =
{
diff --git a/src/overworld.c b/src/overworld.c
index 69ac9c822..10f2ebd26 100644
--- a/src/overworld.c
+++ b/src/overworld.c
@@ -1,5 +1,6 @@
#include "global.h"
#include "overworld.h"
+#include "battle_pyramid.h"
#include "battle_setup.h"
#include "berry.h"
#include "bg.h"
@@ -87,12 +88,6 @@ extern const struct MapHeader *const *const gMapGroups[];
extern const s32 gMaxFlashLevel;
extern const u16 gUnknown_82EC7C4[];
-u16 gUnknown_03005DA8;
-MainCallback gFieldCallback;
-bool8 (*gFieldCallback2)(void);
-u8 gUnknown_03005DB4;
-u8 gFieldLinkPlayerCount;
-
// functions
extern void HealPlayerParty(void);
extern void move_tilemap_camera_to_upper_left_corner(void);
@@ -113,7 +108,6 @@ extern void ShowMapNamePopup(void);
extern bool32 InTrainerHill(void);
extern bool32 sub_808651C(void);
extern bool8 sub_80AF6A4(void);
-extern bool8 sub_81A9E6C(void);
extern bool8 sub_80E909C(void);
extern void sub_81AA1D8(void);
extern void c2_change_map(void);
@@ -256,6 +250,16 @@ IWRAM_DATA static u8 sUnknown_03000E18;
IWRAM_DATA static u8 sUnknown_03000E19;
IWRAM_DATA static u32 sUnusedVar;
+// IWRAM common
+u16 *gBGTilemapBuffers1;
+u16 *gBGTilemapBuffers2;
+u16 *gBGTilemapBuffers3;
+u16 gUnknown_03005DA8;
+void (*gFieldCallback)(void);
+bool8 (*gFieldCallback2)(void);
+u8 gUnknown_03005DB4;
+u8 gFieldLinkPlayerCount;
+
// EWRAM vars
EWRAM_DATA static u8 sUnknown_020322D8 = 0;
EWRAM_DATA struct WarpData gLastUsedWarp = {0};
@@ -517,7 +521,7 @@ void LoadSaveblockEventObjScripts(void)
struct EventObjectTemplate *savObjTemplates = gSaveBlock1Ptr->eventObjectTemplates;
s32 i;
- for (i = 0; i < 64; i++)
+ for (i = 0; i < EVENT_OBJECT_TEMPLATES_COUNT; i++)
savObjTemplates[i].script = mapHeaderObjTemplates[i].script;
}
@@ -526,7 +530,7 @@ void Overworld_SetEventObjTemplateCoords(u8 localId, s16 x, s16 y)
s32 i;
struct EventObjectTemplate *savObjTemplates = gSaveBlock1Ptr->eventObjectTemplates;
- for (i = 0; i < 64; i++)
+ for (i = 0; i < EVENT_OBJECT_TEMPLATES_COUNT; i++)
{
struct EventObjectTemplate *eventObjectTemplate = &savObjTemplates[i];
if (eventObjectTemplate->localId == localId)
@@ -543,7 +547,7 @@ void Overworld_SetEventObjTemplateMovementType(u8 localId, u8 movementType)
s32 i;
struct EventObjectTemplate *savObjTemplates = gSaveBlock1Ptr->eventObjectTemplates;
- for (i = 0; i < 64; i++)
+ for (i = 0; i < EVENT_OBJECT_TEMPLATES_COUNT; i++)
{
struct EventObjectTemplate *eventObjectTemplate = &savObjTemplates[i];
if (eventObjectTemplate->localId == localId)
@@ -764,7 +768,7 @@ void sub_8084F6C(u8 a1)
SetWarpData(&gSaveBlock1Ptr->warp1, warp->group, warp->map, -1, warp->x, warp->y);
}
-void sub_8084FAC(void)
+void sub_8084FAC(int unused)
{
gSaveBlock1Ptr->warp1 = gSaveBlock1Ptr->warp2;
}
@@ -1808,7 +1812,7 @@ static void InitCurrentFlashLevelScanlineEffect(void)
{
u8 flashLevel;
- if (sub_81A9E6C())
+ if (InBattlePyramid_())
{
door_upload_tiles();
ScanlineEffect_SetParams(sFlashEffectParams);
diff --git a/src/poison.c b/src/poison.c
index f0d8ec553..efa89ec13 100644
--- a/src/poison.c
+++ b/src/poison.c
@@ -1,14 +1,19 @@
#include "global.h"
#include "battle_anim.h"
+#include "trig.h"
#include "constants/rgb.h"
extern void sub_80A77C8(struct Sprite *);
-extern void sub_810DBAC(struct Sprite *);
-extern void sub_810DC2C(struct Sprite *);
-extern void sub_810DCD0(struct Sprite *);
-extern void sub_810DD50(struct Sprite *);
-extern void sub_810DDC4(struct Sprite *);
-extern void sub_810DDC4(struct Sprite *);
+
+void sub_810DBAC(struct Sprite *);
+void sub_810DC2C(struct Sprite *);
+void sub_810DCD0(struct Sprite *);
+void sub_810DD50(struct Sprite *);
+void AnimBubbleEffect(struct Sprite *);
+static void sub_810DC10(struct Sprite *);
+static void sub_810DCB4(struct Sprite *);
+static void sub_810DD24(struct Sprite *);
+static void AnimBubbleEffectStep(struct Sprite *);
extern const union AnimCmd *const gUnknown_08595200[];
@@ -170,7 +175,7 @@ const struct SpriteTemplate gPoisonBubbleSpriteTemplate =
.anims = gUnknown_08596164,
.images = NULL,
.affineAnims = gUnknown_0859623C,
- .callback = sub_810DDC4,
+ .callback = AnimBubbleEffect,
};
const struct SpriteTemplate gWaterBubbleSpriteTemplate =
@@ -181,5 +186,138 @@ const struct SpriteTemplate gWaterBubbleSpriteTemplate =
.anims = gUnknown_08595200,
.images = NULL,
.affineAnims = gUnknown_0859623C,
- .callback = sub_810DDC4,
+ .callback = AnimBubbleEffect,
};
+
+void sub_810DBAC(struct Sprite *sprite)
+{
+ if (!gBattleAnimArgs[3])
+ StartSpriteAnim(sprite, 2);
+
+ InitAnimSpritePos(sprite, 1);
+
+ sprite->data[0] = gBattleAnimArgs[2];
+ sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
+ sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
+ sprite->data[5] = -30;
+
+ InitAnimArcTranslation(sprite);
+
+ sprite->callback = sub_810DC10;
+}
+
+static void sub_810DC10(struct Sprite *sprite)
+{
+ if (TranslateAnimArc(sprite))
+ DestroyAnimSprite(sprite);
+}
+
+void sub_810DC2C(struct Sprite *sprite)
+{
+ s16 l1, l2;
+ if (!gBattleAnimArgs[3])
+ StartSpriteAnim(sprite, 2);
+
+ InitAnimSpritePos(sprite, 1);
+ SetAverageBattlerPositions(gBattleAnimTarget, 1, &l1, &l2);
+
+ if (GetBattlerSide(gBattleAnimAttacker))
+ gBattleAnimArgs[4] = -gBattleAnimArgs[4];
+
+ sprite->data[0] = gBattleAnimArgs[2];
+ sprite->data[2] = l1 + gBattleAnimArgs[4];
+ sprite->data[4] = l2 + gBattleAnimArgs[5];
+ sprite->data[5] = -30;
+
+ InitAnimArcTranslation(sprite);
+
+ sprite->callback = sub_810DCB4;
+}
+
+static void sub_810DCB4(struct Sprite *sprite)
+{
+ if (TranslateAnimArc(sprite))
+ DestroyAnimSprite(sprite);
+}
+
+void sub_810DCD0(struct Sprite *sprite)
+{
+ sprite->data[0] = gBattleAnimArgs[2];
+ sprite->data[1] = sprite->pos1.x;
+ sprite->data[2] = sprite->pos1.x + gBattleAnimArgs[0];
+ sprite->data[3] = sprite->pos1.y;
+ sprite->data[4] = sprite->pos1.y + gBattleAnimArgs[1];
+
+ InitSpriteDataForLinearTranslation(sprite);
+
+ sprite->data[5] = sprite->data[1] / gBattleAnimArgs[2];
+ sprite->data[6] = sprite->data[2] / gBattleAnimArgs[2];
+
+ sprite->callback = sub_810DD24;
+}
+
+static void sub_810DD24(struct Sprite *sprite)
+{
+ sub_80A656C(sprite);
+
+ sprite->data[1] -= sprite->data[5];
+ sprite->data[2] -= sprite->data[6];
+
+ if (!sprite->data[0])
+ DestroyAnimSprite(sprite);
+}
+
+void sub_810DD50(struct Sprite *sprite)
+{
+ SetAverageBattlerPositions(gBattleAnimTarget, TRUE, &sprite->pos1.x, &sprite->pos1.y);
+
+ if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
+ gBattleAnimArgs[0] = -gBattleAnimArgs[0];
+
+ sprite->pos1.x += gBattleAnimArgs[0];
+ sprite->pos1.y += gBattleAnimArgs[1];
+
+ sprite->data[0] = gBattleAnimArgs[4];
+ sprite->data[2] = sprite->pos1.x + gBattleAnimArgs[2];
+ sprite->data[4] = sprite->pos1.y + sprite->data[0];
+
+ sprite->callback = StartAnimLinearTranslation;
+ StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
+}
+
+// Animates a bubble by rising upward, swaying side to side, and
+// enlarging the sprite. This is used as an after-effect by poison-type
+// moves, along with MOVE_BUBBLE, and MOVE_BUBBLEBEAM.
+// arg 0: initial x pixel offset
+// arg 1: initial y pixel offset
+// arg 2: 0 = single-target, 1 = multi-target
+void AnimBubbleEffect(struct Sprite *sprite)
+{
+ if (!gBattleAnimArgs[2])
+ {
+ sub_80A6980(sprite, TRUE);
+ }
+ else
+ {
+ SetAverageBattlerPositions(gBattleAnimTarget, TRUE, &sprite->pos1.x, &sprite->pos1.y);
+
+ if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
+ gBattleAnimArgs[0] = -gBattleAnimArgs[0];
+
+ sprite->pos1.x += gBattleAnimArgs[0];
+ sprite->pos1.y += gBattleAnimArgs[1];
+ }
+
+ sprite->callback = AnimBubbleEffectStep;
+}
+
+static void AnimBubbleEffectStep(struct Sprite *sprite)
+{
+ sprite->data[0] = (sprite->data[0] + 0xB) & 0xFF;
+ sprite->pos2.x = Sin(sprite->data[0], 4);
+ sprite->data[1] += 0x30;
+ sprite->pos2.y = -(sprite->data[1] >> 8);
+
+ if (sprite->affineAnimEnded)
+ DestroyAnimSprite(sprite);
+}
diff --git a/src/pokeball.c b/src/pokeball.c
index 09e7ac639..ad839e6af 100644
--- a/src/pokeball.c
+++ b/src/pokeball.c
@@ -402,7 +402,7 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
gSprites[ballSpriteId].data[2] = GetBattlerSpriteCoord(gBattlerTarget, BATTLER_COORD_X);
gSprites[ballSpriteId].data[4] = GetBattlerSpriteCoord(gBattlerTarget, BATTLER_COORD_Y) - 16;
gSprites[ballSpriteId].data[5] = -40;
- sub_80A68D4(&gSprites[ballSpriteId]);
+ InitAnimArcTranslation(&gSprites[ballSpriteId]);
gSprites[ballSpriteId].oam.affineParam = taskId;
gTasks[taskId].tOpponentBattler = gBattlerTarget;
gTasks[taskId].func = TaskDummy;
@@ -898,7 +898,7 @@ static void SpriteCB_PlayerMonSendOut_1(struct Sprite *sprite)
sprite->data[4] = GetBattlerSpriteCoord(sprite->sBattler, 3) + 24;
sprite->data[5] = -30;
sprite->oam.affineParam = sprite->sBattler;
- sub_80A68D4(sprite);
+ InitAnimArcTranslation(sprite);
sprite->callback = SpriteCB_PlayerMonSendOut_2;
}
diff --git a/src/pokedex.c b/src/pokedex.c
index 93ff06876..66a68f0bd 100644
--- a/src/pokedex.c
+++ b/src/pokedex.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "battle_main.h"
#include "bg.h"
#include "data2.h"
#include "decompress.h"
@@ -29,14 +30,17 @@
#include "constants/songs.h"
#include "constants/species.h"
+extern u8 gUnknown_030061EC;
+
+// EWRAM
static EWRAM_DATA struct PokedexView *gUnknown_02039B4C = NULL;
static EWRAM_DATA u16 gUnknown_02039B50 = 0;
static EWRAM_DATA u8 gUnknown_02039B52 = 0;
static EWRAM_DATA struct PokedexListItem *gUnknown_02039B54 = NULL;
+// IWRAM common
u8 gUnknown_030060B0;
-MainCallback gUnknown_030060B4;
-u8 gUnknown_030061EC;
+void (*gUnknown_030060B4)(void);
struct PokedexEntry
{
@@ -84,35 +88,6 @@ struct UnknownStruct4
u8 unk9;
};
-//TO BE CONVERTED TO C
-
-extern const u8 gUnknown_0855D30C[];
-extern struct BgTemplate gUnknown_0856E630[];
-extern struct WindowTemplate gUnknown_0856E640[];
-extern const u16 gUnknown_0856E610[16];
-extern const struct PokedexEntry gPokedexEntries[];
-extern struct BgTemplate gUnknown_0856E668[];
-extern struct WindowTemplate gUnknown_0856E670[];
-extern const u8 *gMonFootprintTable[];
-extern u8 gUnknown_0856ED08[][4];
-extern struct BgTemplate gUnknown_0856EFF8[];
-extern struct WindowTemplate gUnknown_0856F008[];
-extern const u8 gUnknown_0856ED9C[][4];
-extern const u8 gUnknown_0856EDB8[][4];
-extern const u8 gUnknown_0856EDD4[][4];
-extern const u8 gUnknown_0856EDF0[][4];
-extern const struct UnknownStruct1 gUnknown_0856EFC8[];
-extern const struct UnknownStruct3 gUnknown_0856ED30[];
-extern const struct UnknownStruct4 gUnknown_0856ED48[];
-extern const struct UnknownStruct2 gUnknown_0856EE0C[];
-extern const struct UnknownStruct2 gUnknown_0856EE5C[];
-extern const struct UnknownStruct2 gUnknown_0856EEB4[];
-extern const struct UnknownStruct2 gUnknown_0856EF14[];
-extern const struct UnknownStruct2 gUnknown_0856EE24[];
-extern const u8 gUnknown_0856EFAC[];
-extern const u8 gUnknown_0856EFAE[];
-extern const u8 gUnknown_0856EFB4[];
-
#define HOENN_DEX_COUNT 202
#define NATIONAL_DEX_COUNT 386
@@ -651,7 +626,7 @@ static const union AnimCmd *const sSpriteAnimTable_855D190[] =
sSpriteAnim_855D10C
};
-const struct SpriteTemplate gUnknown_0855D194 =
+static const struct SpriteTemplate gUnknown_0855D194 =
{
.tileTag = 4096,
.paletteTag = 4096,
@@ -662,7 +637,7 @@ const struct SpriteTemplate gUnknown_0855D194 =
.callback = sub_80BE604,
};
-const struct SpriteTemplate gUnknown_0855D1AC =
+static const struct SpriteTemplate gUnknown_0855D1AC =
{
.tileTag = 4096,
.paletteTag = 4096,
@@ -673,7 +648,7 @@ const struct SpriteTemplate gUnknown_0855D1AC =
.callback = sub_80BE658,
};
-const struct SpriteTemplate gUnknown_0855D1C4 =
+static const struct SpriteTemplate gUnknown_0855D1C4 =
{
.tileTag = 4096,
.paletteTag = 4096,
@@ -684,7 +659,7 @@ const struct SpriteTemplate gUnknown_0855D1C4 =
.callback = sub_80BE758,
};
-const struct SpriteTemplate gUnknown_0855D1DC =
+static const struct SpriteTemplate gUnknown_0855D1DC =
{
.tileTag = 4096,
.paletteTag = 4096,
@@ -695,7 +670,7 @@ const struct SpriteTemplate gUnknown_0855D1DC =
.callback = sub_80BE780,
};
-const struct SpriteTemplate gUnknown_0855D1F4 =
+static const struct SpriteTemplate gUnknown_0855D1F4 =
{
.tileTag = 4096,
.paletteTag = 4096,
@@ -706,7 +681,7 @@ const struct SpriteTemplate gUnknown_0855D1F4 =
.callback = sub_80BE44C,
};
-const struct SpriteTemplate gUnknown_0855D20C =
+static const struct SpriteTemplate gUnknown_0855D20C =
{
.tileTag = 4096,
.paletteTag = 4096,
@@ -717,7 +692,7 @@ const struct SpriteTemplate gUnknown_0855D20C =
.callback = sub_80BE44C,
};
-const struct SpriteTemplate gUnknown_0855D224 =
+static const struct SpriteTemplate gUnknown_0855D224 =
{
.tileTag = 4096,
.paletteTag = 4096,
@@ -728,7 +703,7 @@ const struct SpriteTemplate gUnknown_0855D224 =
.callback = sub_80BE44C,
};
-const struct SpriteTemplate gUnknown_0855D23C =
+static const struct SpriteTemplate gUnknown_0855D23C =
{
.tileTag = 4096,
.paletteTag = 4096,
@@ -739,7 +714,7 @@ const struct SpriteTemplate gUnknown_0855D23C =
.callback = sub_80BE44C,
};
-const struct SpriteTemplate gUnknown_0855D254 =
+static const struct SpriteTemplate gUnknown_0855D254 =
{
.tileTag = 4096,
.paletteTag = 4096,
@@ -750,22 +725,22 @@ const struct SpriteTemplate gUnknown_0855D254 =
.callback = sub_80BE834,
};
-const struct CompressedSpriteSheet gSpriteSheets_0855D26C[] =
+static const struct CompressedSpriteSheet gSpriteSheets_0855D26C[] =
{
{gPokedexMenu2_Gfx, 0x2000, 4096},
{0}
};
-const struct SpritePalette gSpritePalettes_0855D26C[] =
+static const struct SpritePalette gSpritePalettes_0855D26C[] =
{
{gPokedexText_Pal, 4096},
{0}
};
-const u8 gUnknown_0855D28C[] = {0x4, 0x8, 0x10, 0x20, 0x20};
-const u8 gUnknown_0855D291[] = {0x8, 0x4, 0x2, 0x1, 0x1};
+static const u8 gUnknown_0855D28C[] = {0x4, 0x8, 0x10, 0x20, 0x20};
+static const u8 gUnknown_0855D291[] = {0x8, 0x4, 0x2, 0x1, 0x1};
-const struct BgTemplate gBgTemplates_0855D298[] =
+static const struct BgTemplate gBgTemplates_0855D298[] =
{
{
.bg = 0,
@@ -805,15 +780,447 @@ const struct BgTemplate gBgTemplates_0855D298[] =
}
};
-const struct WindowTemplate sWindowTemplates_0855D2A8[] =
+static const struct WindowTemplate sWindowTemplates_0855D2A8[] =
{
- {2, 0, 0, 0x20, 0x20, 0, 1},
+ {
+ .bg = 2,
+ .tilemapLeft = 0,
+ .tilemapTop = 0,
+ .width = 32,
+ .height = 32,
+ .paletteNum = 0,
+ .baseBlock = 1,
+ },
DUMMY_WIN_TEMPLATE
};
-const u8 gUnknown_0855D2B8[] = _("{NO}000");
-const u8 gUnknown_0855D2BE[] = INCBIN_U8("graphics/pokedex/caught_ball.4bpp");
-const u8 sText_TenDashes[] = _("----------");
+static const u8 gUnknown_0855D2B8[] = _("{NO}000");
+static const u8 gUnknown_0855D2BE[] = INCBIN_U8("graphics/pokedex/caught_ball.4bpp");
+static const u8 sText_TenDashes[] = _("----------");
+
+ALIGNED(4) static const u8 gExpandedPlaceholder_PokedexDescription[] = _("");
+
+#include "data/pokemon/pokedex_text.h"
+#include "data/pokemon/pokedex_entries.h"
+
+static const u16 gUnknown_0856E610[] = INCBIN_U16("graphics/pokedex/black.gbapal");
+
+static const struct BgTemplate gUnknown_0856E630[] =
+{
+ {
+ .bg = 0,
+ .charBaseIndex = 2,
+ .mapBaseIndex = 12,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 3,
+ .baseTile = 0
+ },
+ {
+ .bg = 1,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 13,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 0,
+ .baseTile = 0
+ },
+ {
+ .bg = 2,
+ .charBaseIndex = 2,
+ .mapBaseIndex = 14,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 1,
+ .baseTile = 0
+ },
+ {
+ .bg = 3,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 15,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 2,
+ .baseTile = 0
+ }
+};
+
+static const struct WindowTemplate gUnknown_0856E640[] =
+{
+ {
+ .bg = 2,
+ .tilemapLeft = 0,
+ .tilemapTop = 0,
+ .width = 32,
+ .height = 20,
+ .paletteNum = 0,
+ .baseBlock = 0x0001,
+ },
+ {
+ .bg = 2,
+ .tilemapLeft = 25,
+ .tilemapTop = 8,
+ .width = 2,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x0281,
+ },
+ {
+ .bg = 0,
+ .tilemapLeft = 0,
+ .tilemapTop = 12,
+ .width = 32,
+ .height = 7,
+ .paletteNum = 8,
+ .baseBlock = 0x0285,
+ },
+ {
+ .bg = 2,
+ .tilemapLeft = 18,
+ .tilemapTop = 3,
+ .width = 10,
+ .height = 8,
+ .paletteNum = 9,
+ .baseBlock = 0x0365,
+ },
+ DUMMY_WIN_TEMPLATE
+};
+
+static const struct BgTemplate gUnknown_0856E668[] =
+{
+ {
+ .bg = 2,
+ .charBaseIndex = 2,
+ .mapBaseIndex = 14,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 2,
+ .baseTile = 0
+ },
+ {
+ .bg = 3,
+ .charBaseIndex = 1,
+ .mapBaseIndex = 15,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 3,
+ .baseTile = 0
+ },
+};
+
+static const struct WindowTemplate gUnknown_0856E670[] =
+{
+ {
+ .bg = 2,
+ .tilemapLeft = 0,
+ .tilemapTop = 0,
+ .width = 32,
+ .height = 20,
+ .paletteNum = 0,
+ .baseBlock = 0x0001,
+ },
+ {
+ .bg = 2,
+ .tilemapLeft = 25,
+ .tilemapTop = 8,
+ .width = 2,
+ .height = 2,
+ .paletteNum = 15,
+ .baseBlock = 0x0281,
+ },
+ DUMMY_WIN_TEMPLATE
+};
+
+static const u8 sText_TenDashes2[] = _("----------");
+
+#include "data/pokemon_graphics/footprint_table.h"
+
+static const u8 gUnknown_0856ED08[][4] =
+{
+ {0x00, 0x00, 0x00, 0x00},
+ {0xbb, 0x03, 0xd5, 0x03},
+ {0xbe, 0x03, 0xd8, 0x03},
+ {0xc1, 0x03, 0xdb, 0x03},
+ {0xc4, 0x03, 0xde, 0x03},
+ {0xc7, 0x03, 0xe1, 0x03},
+ {0xca, 0x03, 0xe4, 0x03},
+ {0xcd, 0x03, 0xe7, 0x03},
+ {0xd0, 0x03, 0xea, 0x03},
+ {0xd3, 0x02, 0xed, 0x02},
+};
+
+static const struct UnknownStruct3 gUnknown_0856ED30[] =
+{
+ {
+ .text = gUnknown_085E87A5,
+ .unk4 = 0,
+ .unk5 = 0,
+ .unk6 = 5,
+ },
+ {
+ .text = gUnknown_085E87D6,
+ .unk4 = 6,
+ .unk5 = 0,
+ .unk6 = 5,
+ },
+ {
+ .text = gUnknown_085E87EF,
+ .unk4 = 12,
+ .unk5 = 0,
+ .unk6 = 5,
+ },
+};
+
+static const struct UnknownStruct4 gUnknown_0856ED48[] =
+{
+ {
+ .text = gUnknown_085E8840,
+ .unk4 = 0,
+ .unk5 = 2,
+ .unk6 = 5,
+ .unk7 = 5,
+ .unk8 = 2,
+ .unk9 = 12,
+ },
+ {
+ .text = gUnknown_085E887C,
+ .unk4 = 0,
+ .unk5 = 4,
+ .unk6 = 5,
+ .unk7 = 5,
+ .unk8 = 4,
+ .unk9 = 12,
+ },
+ {
+ .text = gUnknown_085E88A6,
+ .unk4 = 0,
+ .unk5 = 6,
+ .unk6 = 5,
+ .unk7 = 5,
+ .unk8 = 6,
+ .unk9 = 6,
+ },
+ {
+ .text = gUnknown_085E88A6,
+ .unk4 = 0,
+ .unk5 = 6,
+ .unk6 = 5,
+ .unk7 = 11,
+ .unk8 = 6,
+ .unk9 = 6,
+ },
+ {
+ .text = gUnknown_085E881F,
+ .unk4 = 0,
+ .unk5 = 8,
+ .unk6 = 5,
+ .unk7 = 5,
+ .unk8 = 8,
+ .unk9 = 12,
+ },
+ {
+ .text = gUnknown_085E8806,
+ .unk4 = 0,
+ .unk5 = 10,
+ .unk6 = 5,
+ .unk7 = 5,
+ .unk8 = 10,
+ .unk9 = 12,
+ },
+ {
+ .text = gUnknown_085E88C8,
+ .unk4 = 0,
+ .unk5 = 12,
+ .unk6 = 5,
+ .unk7 = 0,
+ .unk8 = 0,
+ .unk9 = 0,
+ },
+};
+
+static const u8 gUnknown_0856ED9C[][4] =
+{
+ {0xFF, 0xFF, 0xFF, 1},
+ {0xFF, 0xFF, 0, 2},
+ {0xFF, 3, 1, 4},
+ { 2, 0xFF, 1, 4},
+ {0xFF, 0xFF, 2, 5},
+ {0xFF, 0xFF, 4, 6},
+ {0xFF, 0xFF, 5, 0xFF},
+};
+
+static const u8 gUnknown_0856EDB8[][4] =
+{
+ {0xFF, 0xFF, 0xFF, 0xFF},
+ {0xFF, 0xFF, 0xFF, 0xFF},
+ {0xFF, 0xFF, 0xFF, 0xFF},
+ {0xFF, 0xFF, 0xFF, 0xFF},
+ {0xFF, 0xFF, 0xFF, 5},
+ {0xFF, 0xFF, 4, 6},
+ {0xFF, 0xFF, 5, 0xFF},
+};
+
+static const u8 gUnknown_0856EDD4[][4] =
+{
+ {0xFF, 0xFF, 0xFF, 1},
+ {0xFF, 0xFF, 0, 2},
+ {0xFF, 3, 1, 4},
+ { 2, 0xFF, 1, 4},
+ {0xFF, 0xFF, 2, 6},
+ {0xFF, 0xFF, 0xFF, 0xFF},
+ {0xFF, 0xFF, 4, 0xFF},
+};
+
+static const u8 gUnknown_0856EDF0[][4] =
+{
+ {0xFF, 0xFF, 0xFF, 0xFF},
+ {0xFF, 0xFF, 0xFF, 0xFF},
+ {0xFF, 0xFF, 0xFF, 0xFF},
+ {0xFF, 0xFF, 0xFF, 0xFF},
+ {0xFF, 0xFF, 0xFF, 6},
+ {0xFF, 0xFF, 0xFF, 0xFF},
+ {0xFF, 0xFF, 4, 0xFF},
+};
+
+static const struct UnknownStruct2 gUnknown_0856EE0C[] =
+{
+ {gUnknown_085E89A4, gUnknown_085E88DF},
+ {gUnknown_085E89BB, gUnknown_085E88E9},
+ {NULL, NULL},
+};
+
+static const struct UnknownStruct2 gUnknown_0856EE24[] =
+{
+ {gUnknown_085E89D4, gUnknown_085E88F6},
+ {gUnknown_085E8A02, gUnknown_085E8905},
+ {gUnknown_085E8A37, gUnknown_085E8911},
+ {gUnknown_085E8A73, gUnknown_085E891F},
+ {gUnknown_085E8AAF, gUnknown_085E892D},
+ {gUnknown_085E8AEA, gUnknown_085E893A},
+ {NULL, NULL},
+};
+
+static const struct UnknownStruct2 gUnknown_0856EE5C[] =
+{
+ {gUnknown_085E8B25, gUnknown_085E8B26},
+ {gUnknown_085E8B25, gUnknown_085E8948},
+ {gUnknown_085E8B25, gUnknown_085E894C},
+ {gUnknown_085E8B25, gUnknown_085E8950},
+ {gUnknown_085E8B25, gUnknown_085E8954},
+ {gUnknown_085E8B25, gUnknown_085E8958},
+ {gUnknown_085E8B25, gUnknown_085E895C},
+ {gUnknown_085E8B25, gUnknown_085E8960},
+ {gUnknown_085E8B25, gUnknown_085E8964},
+ {gUnknown_085E8B25, gUnknown_085E8968},
+ {NULL, NULL},
+};
+
+static const struct UnknownStruct2 gUnknown_0856EEB4[] =
+{
+ {gUnknown_085E8B25, gUnknown_085E8B26},
+ {gUnknown_085E8B25, gUnknown_085E896B},
+ {gUnknown_085E8B25, gUnknown_085E896F},
+ {gUnknown_085E8B25, gUnknown_085E8974},
+ {gUnknown_085E8B25, gUnknown_085E897B},
+ {gUnknown_085E8B25, gUnknown_085E8981},
+ {gUnknown_085E8B25, gUnknown_085E8987},
+ {gUnknown_085E8B25, gUnknown_085E898D},
+ {gUnknown_085E8B25, gUnknown_085E8994},
+ {gUnknown_085E8B25, gUnknown_085E8999},
+ {gUnknown_085E8B25, gUnknown_085E899F},
+ {NULL, NULL},
+};
+
+static const struct UnknownStruct2 gUnknown_0856EF14[] =
+{
+ {gUnknown_085E8B25, gUnknown_085E8B35},
+ {gUnknown_085E8B25, gTypeNames[TYPE_NORMAL]},
+ {gUnknown_085E8B25, gTypeNames[TYPE_FIGHTING]},
+ {gUnknown_085E8B25, gTypeNames[TYPE_FLYING]},
+ {gUnknown_085E8B25, gTypeNames[TYPE_POISON]},
+ {gUnknown_085E8B25, gTypeNames[TYPE_GROUND]},
+ {gUnknown_085E8B25, gTypeNames[TYPE_ROCK]},
+ {gUnknown_085E8B25, gTypeNames[TYPE_BUG]},
+ {gUnknown_085E8B25, gTypeNames[TYPE_GHOST]},
+ {gUnknown_085E8B25, gTypeNames[TYPE_STEEL]},
+ {gUnknown_085E8B25, gTypeNames[TYPE_FIRE]},
+ {gUnknown_085E8B25, gTypeNames[TYPE_WATER]},
+ {gUnknown_085E8B25, gTypeNames[TYPE_GRASS]},
+ {gUnknown_085E8B25, gTypeNames[TYPE_ELECTRIC]},
+ {gUnknown_085E8B25, gTypeNames[TYPE_PSYCHIC]},
+ {gUnknown_085E8B25, gTypeNames[TYPE_ICE]},
+ {gUnknown_085E8B25, gTypeNames[TYPE_DRAGON]},
+ {gUnknown_085E8B25, gTypeNames[TYPE_DARK]},
+ {NULL, NULL},
+};
+
+static const u8 gUnknown_0856EFAC[] = {0x00, 0x01};
+static const u8 gUnknown_0856EFAE[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05};
+static const u8 gUnknown_0856EFB4[] = {0xFF, 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17};
+
+static const struct UnknownStruct1 gUnknown_0856EFC8[] =
+{
+ {gUnknown_0856EE5C, 6, 7, 10},
+ {gUnknown_0856EEB4, 8, 9, 11},
+ {gUnknown_0856EF14, 10,11, 18},
+ {gUnknown_0856EF14, 12, 13, 18},
+ {gUnknown_0856EE24, 4, 5, 6},
+ {gUnknown_0856EE0C, 2, 3, 2},
+};
+
+static const struct BgTemplate gUnknown_0856EFF8[] =
+{
+ {
+ .bg = 0,
+ .charBaseIndex = 2,
+ .mapBaseIndex = 12,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 0,
+ .baseTile = 0
+ },
+ {
+ .bg = 1,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 13,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 1,
+ .baseTile = 0
+ },
+ {
+ .bg = 2,
+ .charBaseIndex = 2,
+ .mapBaseIndex = 14,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 2,
+ .baseTile = 0
+ },
+ {
+ .bg = 3,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 15,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 3,
+ .baseTile = 0
+ }
+};
+
+static const struct WindowTemplate gUnknown_0856F008[] =
+{
+ {
+ .bg = 2,
+ .tilemapLeft = 0,
+ .tilemapTop = 0,
+ .width = 32,
+ .height = 20,
+ .paletteNum = 0,
+ .baseBlock = 0x0001,
+ },
+ DUMMY_WIN_TEMPLATE
+};
// .text
@@ -3511,7 +3918,7 @@ void sub_80C020C(u32 num, u32 value, u32 c, u32 d)
if (c)
text3 = gPokedexEntries[num].description;
else
- text3 = gUnknown_0855D30C;
+ text3 = gExpandedPlaceholder_PokedexDescription;
sub_80BE8DC(text3, GetStringCenterAlignXOffset(1, text3, 0xF0), 0x5F);
}
diff --git a/src/pokemon.c b/src/pokemon.c
index 47c4f9217..0f7c80b77 100644
--- a/src/pokemon.c
+++ b/src/pokemon.c
@@ -4,6 +4,7 @@
#include "battle_controllers.h"
#include "battle_message.h"
#include "battle_pike.h"
+#include "battle_pyramid.h"
#include "battle_setup.h"
#include "battle_tower.h"
#include "event_data.h"
@@ -81,9 +82,7 @@ extern u8 StorageGetCurrentBox(void);
extern void set_unknown_box_id(u8);
extern void sub_803FA70(u8 battlerId);
extern u8 sav1_map_get_name(void);
-extern bool8 InBattlePyramid(void);
extern bool8 sub_806F104(void);
-extern u8 GetTrainerEncounterMusicIdInBattlePyramind(u16 trainerOpponentId);
extern u8 sub_81D63C8(u16 trainerOpponentId);
extern void SummaryScreen_SetUnknownTaskId(u8);
diff --git a/src/pokemon_size_record.c b/src/pokemon_size_record.c
index 473bbee03..2d9a2f08f 100644
--- a/src/pokemon_size_record.c
+++ b/src/pokemon_size_record.c
@@ -206,13 +206,13 @@ void GiveGiftRibbonToParty(u8 index, u8 ribbonId)
if (index < 11 && ribbonId < 65)
{
gSaveBlock1Ptr->giftRibbons[index] = ribbonId;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
- struct Pokemon *pkmn = &gPlayerParty[i];
+ struct Pokemon *mon = &gPlayerParty[i];
- if (GetMonData(pkmn, MON_DATA_SPECIES) != 0 && GetMonData(pkmn, MON_DATA_SANITY_BIT3) == 0)
+ if (GetMonData(mon, MON_DATA_SPECIES) != 0 && GetMonData(mon, MON_DATA_SANITY_BIT3) == 0)
{
- SetMonData(pkmn, array[index], &data);
+ SetMonData(mon, array[index], &data);
gotRibbon = TRUE;
}
}
diff --git a/src/post_battle_event_funcs.c b/src/post_battle_event_funcs.c
index 9765ef5b6..934972b7c 100644
--- a/src/post_battle_event_funcs.c
+++ b/src/post_battle_event_funcs.c
@@ -43,7 +43,7 @@ int GameClear(void)
ribbonGet = FALSE;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
struct Pokemon *mon = &gPlayerParty[i];
diff --git a/src/recorded_battle.c b/src/recorded_battle.c
index 50dd2efa8..5d79cb789 100644
--- a/src/recorded_battle.c
+++ b/src/recorded_battle.c
@@ -490,7 +490,7 @@ bool32 MoveRecordedBattleToSaveData(void)
static bool32 TryCopyRecordedBattleSaveData(struct RecordedBattleSave *dst, struct SaveSection *saveBuffer)
{
- if (TryCopySpecialSaveSection(SECTION_ID_RECORDED_BATTLE, (void*)(saveBuffer)) != 1)
+ if (TryCopySpecialSaveSection(SECTOR_ID_RECORDED_BATTLE, (void*)(saveBuffer)) != 1)
return FALSE;
memcpy(dst, saveBuffer, sizeof(struct RecordedBattleSave));
diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c
index 60580ef2d..7f2eb3746 100644
--- a/src/reshow_battle_screen.c
+++ b/src/reshow_battle_screen.c
@@ -16,15 +16,6 @@
#include "battle_anim.h"
#include "data2.h"
-extern u16 gBattle_BG0_X;
-extern u16 gBattle_BG0_Y;
-extern u16 gBattle_BG1_X;
-extern u16 gBattle_BG1_Y;
-extern u16 gBattle_BG2_X;
-extern u16 gBattle_BG2_Y;
-extern u16 gBattle_BG3_X;
-extern u16 gBattle_BG3_Y;
-
extern const union AnimCmd * const * const gMonAnimationsSpriteAnimsPtrTable[];
extern void SetMultiuseSpriteTemplateToTrainerBack(u16 backPicId, u8 battlerPosition);
diff --git a/src/rock.c b/src/rock.c
index 83af52865..3b8e505d8 100644
--- a/src/rock.c
+++ b/src/rock.c
@@ -1,22 +1,37 @@
#include "global.h"
#include "battle_anim.h"
+#include "gpu_regs.h"
+#include "graphics.h"
+#include "palette.h"
+#include "sound.h"
+#include "task.h"
+#include "trig.h"
#include "constants/rgb.h"
-
-extern void sub_81109F0(struct Sprite *);
-extern void sub_8110AB4(struct Sprite *);
-extern void sub_8110B38(struct Sprite *);
-extern void sub_8110E4C(struct Sprite *);
-extern void sub_8110F30(struct Sprite *);
-extern void sub_811131C(struct Sprite *);
-extern void sub_8111388(struct Sprite *);
-extern void sub_8111418(struct Sprite *);
-extern void sub_8111444(struct Sprite *);
-extern void sub_80FF268(struct Sprite *);
-extern void sub_80A8EE4(struct Sprite *);
+#include "constants/songs.h"
extern const union AnimCmd *const gUnknown_085950E0[];
extern const union AnimCmd *const gUnknown_085954D0[];
+extern void AnimMoveTwisterParticle(struct Sprite *);
+
+void sub_81109F0(struct Sprite *);
+void sub_8110AB4(struct Sprite *);
+void AnimDirtParticleAcrossScreen(struct Sprite *);
+void AnimRaiseSprite(struct Sprite *);
+void sub_81110A4(u8 taskId);
+void sub_811131C(struct Sprite *);
+void sub_8111388(struct Sprite *);
+void sub_8111418(struct Sprite *);
+void sub_8111444(struct Sprite *);
+void sub_8110B38(struct Sprite *);
+static void sub_8110A70(struct Sprite *);
+static void sub_8110B80(struct Sprite *sprite);
+static void sub_8110CB0(u8 taskId);
+static void sub_8111214(struct Task *task);
+static u8 sub_811135C(void);
+static void sub_81113C8(struct Sprite *sprite);
+static void sub_811149C(struct Sprite *sprite);
+
const union AnimCmd gUnknown_08596AE0[] =
{
ANIMCMD_FRAME(32, 1),
@@ -118,7 +133,7 @@ const struct SpriteTemplate gBattleAnimSpriteTemplate_8596BA0 =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_8110E4C,
+ .callback = AnimDirtParticleAcrossScreen,
};
const struct Subsprite gUnknown_08596BB8[] =
@@ -194,7 +209,7 @@ const struct SpriteTemplate gUnknown_08596C10 =
.anims = gUnknown_08596BF8,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_8110F30,
+ .callback = AnimRaiseSprite,
};
const struct SpriteTemplate gUnknown_08596C28 =
@@ -278,7 +293,7 @@ const struct SpriteTemplate gUnknown_08596CC8 =
.anims = gUnknown_08596C08,
.images = NULL,
.affineAnims = gUnknown_08596C90,
- .callback = sub_80FF268,
+ .callback = AnimMoveTwisterParticle,
};
const struct SpriteTemplate gUnknown_08596CE0 =
@@ -291,3 +306,573 @@ const struct SpriteTemplate gUnknown_08596CE0 =
.affineAnims = gUnknown_08596C90,
.callback = sub_80A8EE4,
};
+
+void sub_81109F0(struct Sprite *sprite)
+{
+ if (gBattleAnimArgs[3] != 0)
+ SetAverageBattlerPositions(gBattleAnimTarget, 0, &sprite->pos1.x, &sprite->pos1.y);
+
+ sprite->pos1.x += gBattleAnimArgs[0];
+ sprite->pos1.y += 14;
+
+ StartSpriteAnim(sprite, gBattleAnimArgs[1]);
+ AnimateSprite(sprite);
+
+ sprite->data[0] = 0;
+ sprite->data[1] = 0;
+ sprite->data[2] = 4;
+ sprite->data[3] = 16;
+ sprite->data[4] = -70;
+ sprite->data[5] = gBattleAnimArgs[2];
+
+ StoreSpriteCallbackInData6(sprite, sub_8110A70);
+ sprite->callback = sub_80A6450;
+ sprite->callback(sprite);
+}
+
+static void sub_8110A70(struct Sprite *sprite)
+{
+ sprite->pos1.x += sprite->data[5];
+
+ sprite->data[0] = 192;
+ sprite->data[1] = sprite->data[5];
+ sprite->data[2] = 4;
+ sprite->data[3] = 32;
+ sprite->data[4] = -24;
+
+ StoreSpriteCallbackInData6(sprite, move_anim_8074EE0);
+ sprite->callback = sub_80A6450;
+ sprite->callback(sprite);
+}
+
+void sub_8110AB4(struct Sprite *sprite)
+{
+ StartSpriteAnim(sprite, gBattleAnimArgs[5]);
+ AnimateSprite(sprite);
+
+ if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
+ sprite->pos1.x -= gBattleAnimArgs[0];
+ else
+ sprite->pos1.x += gBattleAnimArgs[0];
+
+ sprite->pos1.y += gBattleAnimArgs[1];
+
+ sprite->data[0] = gBattleAnimArgs[4];
+ sprite->data[1] = sprite->pos1.x;
+ sprite->data[2] = sprite->pos1.x + gBattleAnimArgs[2];
+ sprite->data[3] = sprite->pos1.y;
+ sprite->data[4] = sprite->pos1.y + gBattleAnimArgs[3];
+
+ InitSpriteDataForLinearTranslation(sprite);
+ sprite->data[3] = 0;
+ sprite->data[4] = 0;
+
+ sprite->callback = sub_80A656C;
+ StoreSpriteCallbackInData6(sprite, move_anim_8074EE0);
+}
+
+void sub_8110B38(struct Sprite *sprite)
+{
+ if (gBattleAnimArgs[6] == 0)
+ InitAnimSpritePos(sprite, 0);
+ else
+ sub_80A6980(sprite, FALSE);
+
+ sprite->data[0] = gBattleAnimArgs[3];
+ sprite->data[1] = gBattleAnimArgs[2];
+ sprite->data[2] = gBattleAnimArgs[4];
+ sprite->data[3] = gBattleAnimArgs[5];
+
+ sprite->callback = sub_8110B80;
+}
+
+static void sub_8110B80(struct Sprite *sprite)
+{
+ sprite->data[4] += sprite->data[1];
+ sprite->pos2.y = -(sprite->data[4] >> 8);
+ sprite->pos2.x = Sin(sprite->data[5], sprite->data[3]);
+ sprite->data[5] = (sprite->data[5] + sprite->data[2]) & 0xFF;
+
+ if (--sprite->data[0] == -1)
+ {
+ DestroyAnimSprite(sprite);
+ }
+}
+
+void AnimTask_LoadSandstormBackground(u8 taskId)
+{
+ int var0;
+ struct UnknownAnimStruct2 unknownStruct;
+
+ var0 = 0;
+ SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND);
+ SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
+ SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
+ SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 0);
+
+ if (!IsContest())
+ SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1);
+
+ gBattle_BG1_X = 0;
+ gBattle_BG1_Y = 0;
+ SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X);
+ SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y);
+
+ sub_80A6B30(&unknownStruct);
+ sub_80A6CC0(unknownStruct.bgId, gUnknown_08D8D58C, unknownStruct.tilesOffset);
+ sub_80A6D60(&unknownStruct, gUnknown_08D8D410, 0);
+ LoadCompressedPalette(&gBattleAnimSpritePalette_261, unknownStruct.unk8 * 16, 32);
+
+ if (gBattleAnimArgs[0] && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
+ var0 = 1;
+
+ gTasks[taskId].data[0] = var0;
+ gTasks[taskId].func = sub_8110CB0;
+}
+
+static void sub_8110CB0(u8 taskId)
+{
+ struct UnknownAnimStruct2 unknownStruct;
+
+ if (gTasks[taskId].data[0] == 0)
+ gBattle_BG1_X += -6;
+ else
+ gBattle_BG1_X += 6;
+
+ gBattle_BG1_Y += -1;
+
+ switch (gTasks[taskId].data[12])
+ {
+ case 0:
+ if (++gTasks[taskId].data[10] == 4)
+ {
+ gTasks[taskId].data[10] = 0;
+ gTasks[taskId].data[11]++;
+ SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 16 - gTasks[taskId].data[11]));
+ if (gTasks[taskId].data[11] == 7)
+ {
+ gTasks[taskId].data[12]++;
+ gTasks[taskId].data[11] = 0;
+ }
+ }
+ break;
+ case 1:
+ if (++gTasks[taskId].data[11] == 101)
+ {
+ gTasks[taskId].data[11] = 7;
+ gTasks[taskId].data[12]++;
+ }
+ break;
+ case 2:
+ if (++gTasks[taskId].data[10] == 4)
+ {
+ gTasks[taskId].data[10] = 0;
+ gTasks[taskId].data[11]--;
+ SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 16 - gTasks[taskId].data[11]));
+ if (gTasks[taskId].data[11] == 0)
+ {
+ gTasks[taskId].data[12]++;
+ gTasks[taskId].data[11] = 0;
+ }
+ }
+ break;
+ case 3:
+ sub_80A6B30(&unknownStruct);
+ sub_80A6C68(unknownStruct.bgId);
+ gTasks[taskId].data[12]++;
+ break;
+ case 4:
+ if (!IsContest())
+ SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0);
+
+ gBattle_BG1_X = 0;
+ gBattle_BG1_Y = 0;
+ SetGpuReg(REG_OFFSET_BLDCNT, 0);
+ SetGpuReg(REG_OFFSET_BLDALPHA, 0);
+ SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
+ DestroyAnimVisualTask(taskId);
+ break;
+ }
+}
+
+// Animates the sprites that fly diagonally across the screen
+// in Sandstorm and Heat Wave.
+// arg 0: initial y pixel offset
+// arg 1: projectile speed
+// arg 2: y pixel drop
+// arg 3: ??? unknown (possibly a color bit)
+void AnimDirtParticleAcrossScreen(struct Sprite *sprite)
+{
+ if (sprite->data[0] == 0)
+ {
+ if (gBattleAnimArgs[3] != 0 && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
+ {
+ sprite->pos1.x = 304;
+ gBattleAnimArgs[1] = -gBattleAnimArgs[1];
+ sprite->data[5] = 1;
+ sprite->oam.matrixNum = 8;
+ }
+ else
+ {
+ sprite->pos1.x = -64;
+ }
+
+ sprite->pos1.y = gBattleAnimArgs[0];
+ SetSubspriteTables(sprite, gUnknown_08596BC0);
+ sprite->data[1] = gBattleAnimArgs[1];
+ sprite->data[2] = gBattleAnimArgs[2];
+ sprite->data[0]++;
+ }
+ else
+ {
+ sprite->data[3] += sprite->data[1];
+ sprite->data[4] += sprite->data[2];
+ sprite->pos2.x += (sprite->data[3] >> 8);
+ sprite->pos2.y += (sprite->data[4] >> 8);
+ sprite->data[3] &= 0xFF;
+ sprite->data[4] &= 0xFF;
+
+ if (sprite->data[5] == 0)
+ {
+ if (sprite->pos1.x + sprite->pos2.x > 272)
+ {
+ sprite->callback = DestroyAnimSprite;
+ }
+ }
+ else if (sprite->pos1.x + sprite->pos2.x < -32)
+ {
+ sprite->callback = DestroyAnimSprite;
+ }
+ }
+}
+
+// Animates the rising rocks in Ancient Power.
+// arg 0: initial x pixel offset
+// arg 1: initial y pixel offset
+// arg 2: terminal y offset
+// arg 3: duration
+// arg 4: sprite size [1,5]
+void AnimRaiseSprite(struct Sprite *sprite)
+{
+ StartSpriteAnim(sprite, gBattleAnimArgs[4]);
+ InitAnimSpritePos(sprite, 0);
+
+ sprite->data[0] = gBattleAnimArgs[3];
+ sprite->data[2] = sprite->pos1.x;
+ sprite->data[4] = sprite->pos1.y + gBattleAnimArgs[2];
+
+ sprite->callback = StartAnimLinearTranslation;
+ StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
+}
+
+void sub_8110F74(u8 taskId)
+{
+ u16 var0, var1, var2, var3;
+ u8 var4;
+ int var5;
+ s16 pan1, pan2;
+ struct Task *task;
+
+ task = &gTasks[taskId];
+
+ var0 = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
+ var1 = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + 24;
+ var2 = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
+ var3 = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + 24;
+
+ if (BATTLE_PARTNER(gBattleAnimAttacker) == gBattleAnimTarget)
+ var3 = var1;
+
+ var4 = sub_811135C();
+ if (var4 == 1)
+ task->data[8] = 32;
+ else
+ task->data[8] = 48 - (var4 * 8);
+
+ task->data[0] = 0;
+ task->data[11] = 0;
+ task->data[9] = 0;
+ task->data[12] = 1;
+
+ var5 = task->data[8];
+ if (var5 < 0)
+ var5 += 7;
+
+ task->data[10] = (var5 >> 3) - 1;
+
+ task->data[2] = var0 * 8;
+ task->data[3] = var1 * 8;
+ task->data[4] = ((var2 - var0) * 8) / task->data[8];
+ task->data[5] = ((var3 - var1) * 8) / task->data[8];
+ task->data[6] = 0;
+ task->data[7] = 0;
+
+ pan1 = BattleAnimAdjustPanning(-64);
+ pan2 = BattleAnimAdjustPanning(63);
+
+ task->data[13] = pan1;
+ task->data[14] = (pan2 - pan1) / task->data[8];
+ task->data[1] = var4;
+ task->data[15] = GetAnimBattlerSpriteId(0);
+
+ task->func = sub_81110A4;
+}
+
+void sub_81110A4(u8 taskId)
+{
+ struct Task *task;
+
+ task = &gTasks[taskId];
+
+ switch (task->data[0])
+ {
+ case 0:
+ task->data[6] -= task->data[4];
+ task->data[7] -= task->data[5];
+ gSprites[task->data[15]].pos2.x = task->data[6] >> 3;
+ gSprites[task->data[15]].pos2.y = task->data[7] >> 3;
+
+ if (++task->data[9] == 10)
+ {
+ task->data[11] = 20;
+ task->data[0]++;
+ }
+
+ PlaySE12WithPanning(SE_W029, task->data[13]);
+ break;
+ case 1:
+ if (--task->data[11] == 0)
+ task->data[0]++;
+ break;
+ case 2:
+ if (--task->data[9] != 0)
+ {
+ task->data[6] += task->data[4];
+ task->data[7] += task->data[5];
+ }
+ else
+ {
+ task->data[6] = 0;
+ task->data[7] = 0;
+ task->data[0]++;
+ }
+
+ gSprites[task->data[15]].pos2.x = task->data[6] >> 3;
+ gSprites[task->data[15]].pos2.y = task->data[7] >> 3;
+ break;
+ case 3:
+ task->data[2] += task->data[4];
+ task->data[3] += task->data[5];
+ if (++task->data[9] >= task->data[10])
+ {
+ task->data[9] = 0;
+ sub_8111214(task);
+ task->data[13] += task->data[14];
+ PlaySE12WithPanning(SE_W091, task->data[13]);
+ }
+
+ if (--task->data[8] == 0)
+ {
+ task->data[0]++;
+ }
+ break;
+ case 4:
+ if (task->data[11] == 0)
+ DestroyAnimVisualTask(taskId);
+ break;
+ }
+}
+
+static void sub_8111214(struct Task *task)
+{
+ const struct SpriteTemplate *spriteTemplate;
+ int var0;
+ u16 x, y;
+ u8 spriteId;
+
+ switch (task->data[1])
+ {
+ case 1:
+ spriteTemplate = &gUnknown_08596C28;
+ var0 = 0;
+ break;
+ case 2:
+ case 3:
+ spriteTemplate = &gUnknown_08596C40;
+ var0 = 80;
+ break;
+ case 4:
+ spriteTemplate = &gUnknown_08596C40;
+ var0 = 64;
+ break;
+ case 5:
+ spriteTemplate = &gUnknown_08596C40;
+ var0 = 48;
+ break;
+ default:
+ return;
+ }
+
+ x = task->data[2] >> 3;
+ y = task->data[3] >> 3;
+ x += (task->data[12] * 4);
+
+ spriteId = CreateSprite(spriteTemplate, x, y, 35);
+ if (spriteId != MAX_SPRITES)
+ {
+ gSprites[spriteId].data[0] = 18;
+ gSprites[spriteId].data[2] = ((task->data[12] * 20) + x) + (task->data[1] * 3);
+ gSprites[spriteId].data[4] = y;
+ gSprites[spriteId].data[5] = -16 - (task->data[1] * 2);
+ gSprites[spriteId].oam.tileNum += var0;
+
+ InitAnimArcTranslation(&gSprites[spriteId]);
+ task->data[11]++;
+ }
+
+ task->data[12] *= -1;
+}
+
+void sub_811131C(struct Sprite *sprite)
+{
+ if (TranslateAnimArc(sprite))
+ {
+ u8 taskId = FindTaskIdByFunc(sub_81110A4);
+ if (taskId != 0xFF)
+ gTasks[taskId].data[11]--;
+
+ DestroySprite(sprite);
+ }
+}
+
+static u8 sub_811135C(void)
+{
+ u8 retVal = gAnimDisableStructPtr->rolloutTimerStartValue - gAnimDisableStructPtr->rolloutTimer;
+ u8 var0 = retVal - 1;
+ if (var0 > 4)
+ retVal = 1;
+
+ return retVal;
+}
+
+void sub_8111388(struct Sprite *sprite)
+{
+ StartSpriteAnim(sprite, gBattleAnimArgs[4]);
+
+ sprite->pos2.x = gBattleAnimArgs[0];
+ sprite->data[2] = gBattleAnimArgs[1];
+ sprite->data[3] -= gBattleAnimArgs[2];
+ sprite->data[0] = 3;
+ sprite->data[1] = gBattleAnimArgs[3];
+ sprite->callback = sub_81113C8;
+ sprite->invisible = 1;
+}
+
+static void sub_81113C8(struct Sprite *sprite)
+{
+ sprite->invisible = 0;
+ if (sprite->data[3] != 0)
+ {
+ sprite->pos2.y = sprite->data[2] + sprite->data[3];
+ sprite->data[3] += sprite->data[0];
+ sprite->data[0]++;
+ if (sprite->data[3] > 0)
+ {
+ sprite->data[3] = 0;
+ }
+ }
+ else
+ {
+ if (--sprite->data[1] == 0)
+ DestroyAnimSprite(sprite);
+ }
+}
+
+void sub_8111418(struct Sprite *sprite)
+{
+ if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT)
+ StartSpriteAffineAnim(sprite, 1);
+
+ TranslateAnimSpriteToTargetMonLocation(sprite);
+}
+
+void sub_8111444(struct Sprite *sprite)
+{
+ sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
+ sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimTarget, 1);
+ sprite->pos1.x += gBattleAnimArgs[0];
+ sprite->pos1.y += gBattleAnimArgs[1];
+
+ sprite->data[1] = gBattleAnimArgs[0];
+ sprite->data[2] = gBattleAnimArgs[1];
+ sprite->data[5] = gBattleAnimArgs[2];
+
+ StartSpriteAnim(sprite, gBattleAnimArgs[3]);
+ sprite->callback = sub_811149C;
+}
+
+static void sub_811149C(struct Sprite *sprite)
+{
+ sprite->data[0] += 8;
+ sprite->data[3] += sprite->data[1];
+ sprite->data[4] += sprite->data[2];
+
+ sprite->pos2.x += sprite->data[3] / 40;
+ sprite->pos2.y -= Sin(sprite->data[0], sprite->data[5]);
+
+ if (sprite->data[0] > 140)
+ DestroyAnimSprite(sprite);
+}
+
+void AnimTask_GetSeismicTossDamageLevel(u8 taskId)
+{
+ if (gAnimMoveDmg < 33)
+ gBattleAnimArgs[7] = 0;
+ if ((u32)gAnimMoveDmg - 33 < 33)
+ gBattleAnimArgs[7] = 1;
+ if (gAnimMoveDmg > 65)
+ gBattleAnimArgs[7] = 2;
+
+ DestroyAnimVisualTask(taskId);
+}
+
+void sub_811152C(u8 taskId)
+{
+ if (gTasks[taskId].data[0] == 0)
+ {
+ sub_80A6DAC(0);
+ gTasks[taskId].data[1] = 200;
+ }
+
+ gBattle_BG3_Y += gTasks[taskId].data[1] / 10;
+ gTasks[taskId].data[1] -= 3;
+
+ if (gTasks[taskId].data[0] == 120)
+ {
+ sub_80A6DAC(1);
+ DestroyAnimVisualTask(taskId);
+ }
+
+ gTasks[taskId].data[0]++;
+}
+
+void sub_8111590(u8 taskId)
+{
+ if (gTasks[taskId].data[0] == 0)
+ {
+ sub_80A6DAC(0);
+ gTasks[taskId].data[0]++;
+ gTasks[taskId].data[2] = gBattle_BG3_Y;
+ }
+
+ gTasks[taskId].data[1] += 80;
+ gTasks[taskId].data[1] &= 0xFF;
+ gBattle_BG3_Y = gTasks[taskId].data[2] + Cos(4, gTasks[taskId].data[1]);
+
+ if (gBattleAnimArgs[7] == 0xFFF)
+ {
+ gBattle_BG3_Y = 0;
+ sub_80A6DAC(1);
+ DestroyAnimVisualTask(taskId);
+ }
+}
diff --git a/src/rom_8011DC0.c b/src/rom_8011DC0.c
index bf16a20fc..b7ca087fd 100644
--- a/src/rom_8011DC0.c
+++ b/src/rom_8011DC0.c
@@ -1784,7 +1784,7 @@ void sub_801440C(u8 taskId)
ScriptContext2_Disable();
}
-extern u8 gUnknown_0203CEF8[];
+extern u8 gSelectedOrderFromParty[];
void sub_8014790(u8 taskId)
{
@@ -1802,8 +1802,8 @@ void sub_8014790(u8 taskId)
gLinkPlayers[0].linkType = 0x2211;
gLinkPlayers[0].id = 0;
gLinkPlayers[1].id = 2;
- sendBuff[0] = GetMonData(&gPlayerParty[gUnknown_0203CEF8[0] - 1], MON_DATA_SPECIES);
- sendBuff[1] = GetMonData(&gPlayerParty[gUnknown_0203CEF8[1] - 1], MON_DATA_SPECIES, NULL);
+ sendBuff[0] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[0] - 1], MON_DATA_SPECIES);
+ sendBuff[1] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[1] - 1], MON_DATA_SPECIES, NULL);
gMain.savedCallback = NULL;
data[0] = 4;
sub_800E3A8();
diff --git a/src/save.c b/src/save.c
index 0bd48cca9..4ae516fc9 100644
--- a/src/save.c
+++ b/src/save.c
@@ -1,15 +1,23 @@
#include "global.h"
#include "gba/flash_internal.h"
#include "save.h"
-#include "constants/game_stat.h"
#include "task.h"
#include "decompress.h"
#include "load_save.h"
#include "overworld.h"
+#include "main.h"
+#include "constants/game_stat.h"
+
+static u16 CalculateChecksum(void *data, u16 size);
+static u8 DoReadFlashWholeSection(u8 sector, struct SaveSection *section);
+static u8 GetSaveValidStatus(const struct SaveSectionLocation *location);
+static u8 sub_8152E10(u16 a1, const struct SaveSectionLocation *location);
+static u8 ClearSaveData_2(u16 a1, const struct SaveSectionLocation *location);
+static u8 TryWriteSector(u8 sector, u8 *data);
+static u8 HandleWriteSector(u16 a1, const struct SaveSectionLocation *location);
// for the chunk declarations
-extern bool8 gSoftResetDisabled;
extern u32 gUnknown_0203CF5C;
// Divide save blocks into individual chunks to be written to flash sectors
@@ -24,7 +32,7 @@ extern u32 gUnknown_0203CF5C;
* Sectors 0 - 13: Save Slot 1
* Sectors 14 - 27: Save Slot 2
* Sectors 28 - 29: Hall of Fame
- * Sector 30: e-Reader/Mystery Gift Stuff (note: e-Reader is deprecated in Emerald US)
+ * Sector 30: Trainer Hill
* Sector 31: Recorded Battle
*
* There are two save slots for saving the player's game data. We alternate between
@@ -86,6 +94,7 @@ u16 gSaveUnusedVar2;
u16 gUnknown_03006294;
EWRAM_DATA struct SaveSection gSaveDataBuffer = {0};
+EWRAM_DATA static u8 sUnusedVar = 0;
void ClearSaveData(void)
{
@@ -105,7 +114,7 @@ void Save_ResetSaveCounters(void)
gDamagedSaveSectors = 0;
}
-bool32 SetDamagedSectorBits(u8 op, u8 bit)
+static bool32 SetDamagedSectorBits(u8 op, u8 bit)
{
bool32 retVal = FALSE;
@@ -126,7 +135,7 @@ bool32 SetDamagedSectorBits(u8 op, u8 bit)
return retVal;
}
-u8 save_write_to_flash(u16 a1, const struct SaveSectionLocation *location)
+static u8 save_write_to_flash(u16 a1, const struct SaveSectionLocation *location)
{
u32 retVal;
u16 i;
@@ -142,11 +151,11 @@ u8 save_write_to_flash(u16 a1, const struct SaveSectionLocation *location)
gLastKnownGoodSector = gLastWrittenSector; // backup the current written sector before attempting to write.
gLastSaveCounter = gSaveCounter;
gLastWrittenSector++;
- gLastWrittenSector = gLastWrittenSector % 0xE; // array count save sector locations
+ gLastWrittenSector = gLastWrittenSector % SECTOR_SAVE_SLOT_LENGTH; // array count save sector locations
gSaveCounter++;
retVal = 1;
- for (i = 0; i < 0xE; i++)
+ for (i = 0; i < SECTOR_SAVE_SLOT_LENGTH; i++)
HandleWriteSector(i, location);
if (gDamagedSaveSectors != 0) // skip the damaged sector.
@@ -160,7 +169,7 @@ u8 save_write_to_flash(u16 a1, const struct SaveSectionLocation *location)
return retVal;
}
-u8 HandleWriteSector(u16 a1, const struct SaveSectionLocation *location)
+static u8 HandleWriteSector(u16 a1, const struct SaveSectionLocation *location)
{
u16 i;
u16 sector;
@@ -168,8 +177,8 @@ u8 HandleWriteSector(u16 a1, const struct SaveSectionLocation *location)
u16 size;
sector = a1 + gLastWrittenSector;
- sector %= 0xE;
- sector += 0xE * (gSaveCounter % 2);
+ sector %= SECTOR_SAVE_SLOT_LENGTH;
+ sector += SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % 2);
data = location[a1].data;
size = location[a1].size;
@@ -189,7 +198,7 @@ u8 HandleWriteSector(u16 a1, const struct SaveSectionLocation *location)
return TryWriteSector(sector, gFastSaveSection->data);
}
-u8 HandleWriteSectorNBytes(u8 sector, u8 *data, u16 size)
+static u8 HandleWriteSectorNBytes(u8 sector, u8 *data, u16 size)
{
u16 i;
struct SaveSection *section = &gSaveDataBuffer;
@@ -206,7 +215,7 @@ u8 HandleWriteSectorNBytes(u8 sector, u8 *data, u16 size)
return TryWriteSector(sector, section->data);
}
-u8 TryWriteSector(u8 sector, u8 *data)
+static u8 TryWriteSector(u8 sector, u8 *data)
{
if (ProgramFlashSectorAndVerify(sector, data) != 0) // is damaged?
{
@@ -220,20 +229,20 @@ u8 TryWriteSector(u8 sector, u8 *data)
}
}
-u32 RestoreSaveBackupVarsAndIncrement(const struct SaveSectionLocation *location) // location is unused
+static u32 RestoreSaveBackupVarsAndIncrement(const struct SaveSectionLocation *location) // location is unused
{
gFastSaveSection = &gSaveDataBuffer;
gLastKnownGoodSector = gLastWrittenSector;
gLastSaveCounter = gSaveCounter;
gLastWrittenSector++;
- gLastWrittenSector = gLastWrittenSector % 0xE;
+ gLastWrittenSector %= SECTOR_SAVE_SLOT_LENGTH;
gSaveCounter++;
gUnknown_03006208 = 0;
gDamagedSaveSectors = 0;
return 0;
}
-u32 RestoreSaveBackupVars(const struct SaveSectionLocation *location) // only ever called once, and gSaveBlock2 is passed to this function. location is unused
+static u32 RestoreSaveBackupVars(const struct SaveSectionLocation *location) // only ever called once, and gSaveBlock2 is passed to this function. location is unused
{
gFastSaveSection = &gSaveDataBuffer;
gLastKnownGoodSector = gLastWrittenSector;
@@ -243,7 +252,7 @@ u32 RestoreSaveBackupVars(const struct SaveSectionLocation *location) // only ev
return 0;
}
-u8 sub_81529D4(u16 a1, const struct SaveSectionLocation *location)
+static u8 sub_81529D4(u16 a1, const struct SaveSectionLocation *location)
{
u8 retVal;
@@ -267,7 +276,7 @@ u8 sub_81529D4(u16 a1, const struct SaveSectionLocation *location)
return retVal;
}
-u8 sub_8152A34(u16 a1, const struct SaveSectionLocation *location)
+static u8 sub_8152A34(u16 a1, const struct SaveSectionLocation *location)
{
u8 retVal = 1;
@@ -282,7 +291,7 @@ u8 sub_8152A34(u16 a1, const struct SaveSectionLocation *location)
return retVal;
}
-u8 ClearSaveData_2(u16 a1, const struct SaveSectionLocation *location)
+static u8 ClearSaveData_2(u16 a1, const struct SaveSectionLocation *location)
{
u16 i;
u16 sector;
@@ -291,8 +300,8 @@ u8 ClearSaveData_2(u16 a1, const struct SaveSectionLocation *location)
u8 status;
sector = a1 + gLastWrittenSector;
- sector %= 0xE;
- sector += 0xE * (gSaveCounter % 2);
+ sector %= SECTOR_SAVE_SLOT_LENGTH;
+ sector += SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % 2);
data = location[a1].data;
size = location[a1].size;
@@ -356,13 +365,13 @@ u8 ClearSaveData_2(u16 a1, const struct SaveSectionLocation *location)
}
}
-u8 sav12_xor_get(u16 a1, const struct SaveSectionLocation *location)
+static u8 sav12_xor_get(u16 a1, const struct SaveSectionLocation *location)
{
u16 sector;
sector = a1 + gLastWrittenSector; // no sub 1?
- sector %= 0xE;
- sector += 0xE * (gSaveCounter % 2);
+ sector %= SECTOR_SAVE_SLOT_LENGTH;
+ sector += SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % 2);
if (ProgramFlashByte(sector, sizeof(struct UnkSaveSection), 0x25))
{
@@ -379,13 +388,13 @@ u8 sav12_xor_get(u16 a1, const struct SaveSectionLocation *location)
}
}
-u8 sub_8152CAC(u16 a1, const struct SaveSectionLocation *location)
+static u8 sub_8152CAC(u16 a1, const struct SaveSectionLocation *location)
{
u16 sector;
sector = a1 + gLastWrittenSector - 1;
- sector %= 0xE;
- sector += 0xE * (gSaveCounter % 2);
+ sector %= SECTOR_SAVE_SLOT_LENGTH;
+ sector += SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % 2);
if (ProgramFlashByte(sector, sizeof(struct UnkSaveSection), ((u8 *)gFastSaveSection)[sizeof(struct UnkSaveSection)]))
{
@@ -402,13 +411,13 @@ u8 sub_8152CAC(u16 a1, const struct SaveSectionLocation *location)
}
}
-u8 sub_8152D44(u16 a1, const struct SaveSectionLocation *location)
+static u8 sub_8152D44(u16 a1, const struct SaveSectionLocation *location)
{
u16 sector;
sector = a1 + gLastWrittenSector - 1; // no sub 1?
- sector %= 0xE;
- sector += 0xE * (gSaveCounter % 2);
+ sector %= SECTOR_SAVE_SLOT_LENGTH;
+ sector += SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % 2);
if (ProgramFlashByte(sector, sizeof(struct UnkSaveSection), 0x25))
{
@@ -425,7 +434,7 @@ u8 sub_8152D44(u16 a1, const struct SaveSectionLocation *location)
}
}
-u8 sub_8152DD0(u16 a1, const struct SaveSectionLocation *location)
+static u8 sub_8152DD0(u16 a1, const struct SaveSectionLocation *location)
{
u8 retVal;
gFastSaveSection = &gSaveDataBuffer;
@@ -442,14 +451,14 @@ u8 sub_8152DD0(u16 a1, const struct SaveSectionLocation *location)
return retVal;
}
-u8 sub_8152E10(u16 a1, const struct SaveSectionLocation *location)
+static u8 sub_8152E10(u16 a1, const struct SaveSectionLocation *location)
{
u16 i;
u16 checksum;
- u16 v3 = 0xE * (gSaveCounter % 2);
+ u16 v3 = SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % 2);
u16 id;
- for (i = 0; i < 0xE; i++)
+ for (i = 0; i < SECTOR_SAVE_SLOT_LENGTH; i++)
{
DoReadFlashWholeSection(i + v3, gFastSaveSection);
id = gFastSaveSection->id;
@@ -468,7 +477,7 @@ u8 sub_8152E10(u16 a1, const struct SaveSectionLocation *location)
return 1;
}
-u8 GetSaveValidStatus(const struct SaveSectionLocation *location)
+static u8 GetSaveValidStatus(const struct SaveSectionLocation *location)
{
u16 i;
u16 checksum;
@@ -480,7 +489,7 @@ u8 GetSaveValidStatus(const struct SaveSectionLocation *location)
u8 saveSlot2Status;
// check save slot 1.
- for (i = 0; i < 0xE; i++)
+ for (i = 0; i < SECTOR_SAVE_SLOT_LENGTH; i++)
{
DoReadFlashWholeSection(i, gFastSaveSection);
if (gFastSaveSection->security == UNKNOWN_CHECK_VALUE)
@@ -511,9 +520,9 @@ u8 GetSaveValidStatus(const struct SaveSectionLocation *location)
securityPassed = FALSE;
// check save slot 2.
- for (i = 0; i < 0xE; i++)
+ for (i = 0; i < SECTOR_SAVE_SLOT_LENGTH; i++)
{
- DoReadFlashWholeSection(i + 0xE, gFastSaveSection);
+ DoReadFlashWholeSection(i + SECTOR_SAVE_SLOT_LENGTH, gFastSaveSection);
if (gFastSaveSection->security == UNKNOWN_CHECK_VALUE)
{
securityPassed = TRUE;
@@ -543,24 +552,16 @@ u8 GetSaveValidStatus(const struct SaveSectionLocation *location)
if ((saveSlot1Counter == -1 && saveSlot2Counter == 0) || (saveSlot1Counter == 0 && saveSlot2Counter == -1))
{
if ((unsigned)(saveSlot1Counter + 1) < (unsigned)(saveSlot2Counter + 1))
- {
gSaveCounter = saveSlot2Counter;
- }
else
- {
gSaveCounter = saveSlot1Counter;
- }
}
else
{
if (saveSlot1Counter < saveSlot2Counter)
- {
gSaveCounter = saveSlot2Counter;
- }
else
- {
gSaveCounter = saveSlot1Counter;
- }
}
return 1;
}
@@ -593,7 +594,7 @@ u8 GetSaveValidStatus(const struct SaveSectionLocation *location)
return 2;
}
-u8 sub_81530DC(u8 a1, u8 *data, u16 size)
+static u8 sub_81530DC(u8 a1, u8 *data, u16 size)
{
u16 i;
struct SaveSection *section = &gSaveDataBuffer;
@@ -618,13 +619,13 @@ u8 sub_81530DC(u8 a1, u8 *data, u16 size)
}
}
-u8 DoReadFlashWholeSection(u8 sector, struct SaveSection *section)
+static u8 DoReadFlashWholeSection(u8 sector, struct SaveSection *section)
{
ReadFlash(sector, 0, section->data, sizeof(struct SaveSection));
return 1;
}
-u16 CalculateChecksum(void *data, u16 size)
+static u16 CalculateChecksum(void *data, u16 size)
{
u16 i;
u32 checksum = 0;
@@ -635,7 +636,7 @@ u16 CalculateChecksum(void *data, u16 size)
return ((checksum >> 16) + checksum);
}
-void UpdateSaveAddresses(void)
+static void UpdateSaveAddresses(void)
{
int i = 0;
@@ -668,7 +669,7 @@ u8 HandleSavingData(u8 saveType)
switch (saveType)
{
case SAVE_HALL_OF_FAME_ERASE_BEFORE: // deletes HOF before overwriting HOF completely. unused
- for (i = 0xE * 2 + 0; i < 32; i++)
+ for (i = SECTOR_ID_HOF_1; i < SECTORS_COUNT; i++)
EraseFlashSector(i);
case SAVE_HALL_OF_FAME: // hall of fame.
if (GetGameStat(GAME_STAT_ENTERED_HOF) < 999)
@@ -676,8 +677,8 @@ u8 HandleSavingData(u8 saveType)
SaveSerializedGame();
save_write_to_flash(0xFFFF, gRamSaveSectionLocations);
tempAddr = gDecompressionBuffer;
- HandleWriteSectorNBytes(0x1C, tempAddr, 0xF80);
- HandleWriteSectorNBytes(0x1D, tempAddr + 0xF80, 0xF80);
+ HandleWriteSectorNBytes(SECTOR_ID_HOF_1, tempAddr, 0xF80);
+ HandleWriteSectorNBytes(SECTOR_ID_HOF_2, tempAddr + 0xF80, 0xF80);
break;
case SAVE_NORMAL: // normal save. also called by overwriting your own save.
default:
@@ -692,7 +693,7 @@ u8 HandleSavingData(u8 saveType)
for(i = 0; i < 5; i++)
sav12_xor_get(i, gRamSaveSectionLocations);
break;
- // support for Ereader was removed in Emerald.
+ // Support for Ereader was removed in Emerald.
/*
case EREADER_SAVE: // used in mossdeep "game corner" before/after battling old man e-reader trainer
SaveSerializedGame();
@@ -700,7 +701,7 @@ u8 HandleSavingData(u8 saveType)
break;
*/
case SAVE_OVERWRITE_DIFFERENT_FILE:
- for (i = (0xE * 2 + 0); i < 32; i++)
+ for (i = SECTOR_ID_HOF_1; i < SECTORS_COUNT; i++)
EraseFlashSector(i); // erase HOF.
SaveSerializedGame();
save_write_to_flash(0xFFFF, gRamSaveSectionLocations);
@@ -710,7 +711,7 @@ u8 HandleSavingData(u8 saveType)
return 0;
}
-u8 TrySavingData(u8 saveType) // TrySave
+u8 TrySavingData(u8 saveType)
{
if (gFlashMemoryPresent != TRUE)
{
@@ -744,7 +745,7 @@ bool8 sub_8153380(void) // trade.s save
bool8 sub_81533AC(void) // trade.s save
{
- u8 retVal = sub_81529D4(0xE, gRamSaveSectionLocations);
+ u8 retVal = sub_81529D4(SECTOR_SAVE_SLOT_LENGTH, gRamSaveSectionLocations);
if (gDamagedSaveSectors)
DoSaveFailedScreen(0);
if (retVal == 0xFF)
@@ -755,7 +756,7 @@ bool8 sub_81533AC(void) // trade.s save
u8 sub_81533E0(void) // trade.s save
{
- sub_8152A34(0xE, gRamSaveSectionLocations);
+ sub_8152A34(SECTOR_SAVE_SLOT_LENGTH, gRamSaveSectionLocations);
if (gDamagedSaveSectors)
DoSaveFailedScreen(0);
return 0;
@@ -763,7 +764,7 @@ u8 sub_81533E0(void) // trade.s save
u8 sub_8153408(void) // trade.s save
{
- sub_8152CAC(0xE, gRamSaveSectionLocations);
+ sub_8152CAC(SECTOR_SAVE_SLOT_LENGTH, gRamSaveSectionLocations);
if (gDamagedSaveSectors)
DoSaveFailedScreen(0);
return 0;
@@ -840,8 +841,8 @@ u16 sub_815355C(void)
return 0;
UpdateSaveAddresses();
GetSaveValidStatus(gRamSaveSectionLocations);
- v3 = 0xE * (gSaveCounter % 2);
- for (i = 0; i < 14; i++)
+ v3 = SECTOR_SAVE_SLOT_LENGTH * (gSaveCounter % 2);
+ for (i = 0; i < SECTOR_SAVE_SLOT_LENGTH; i++)
{
DoReadFlashWholeSection(i + v3, gFastSaveSection);
if (gFastSaveSection->id == 0)
@@ -859,7 +860,7 @@ u32 TryCopySpecialSaveSection(u8 sector, u8* dst)
s32 size;
u8* savData;
- if (sector != 30 && sector != 31)
+ if (sector != SECTOR_ID_TRAINER_HILL && sector != SECTOR_ID_RECORDED_BATTLE)
return 0xFF;
ReadFlash(sector, 0, (u8 *)&gSaveDataBuffer, sizeof(struct SaveSection));
if (*(u32*)(&gSaveDataBuffer.data[0]) != 0xB39D)
diff --git a/src/save_failed_screen.c b/src/save_failed_screen.c
index 010279a87..c668c1db0 100644
--- a/src/save_failed_screen.c
+++ b/src/save_failed_screen.c
@@ -13,16 +13,17 @@
#include "starter_choose.h"
#include "gba/flash_internal.h"
#include "text_window.h"
+#include "constants/rgb.h"
#define MSG_WIN_TOP 12
#define CLOCK_WIN_TOP (MSG_WIN_TOP - 4)
-extern u8 gText_SaveFailedCheckingBackup[];
-extern u8 gText_BackupMemoryDamaged[];
-extern u8 gText_CheckCompleted[];
-extern u8 gText_SaveCompleteGameCannotContinue[];
-extern u8 gText_SaveCompletePressA[];
-extern u8 gText_GamePlayCannotBeContinued[];
+extern const u8 gText_SaveFailedCheckingBackup[];
+extern const u8 gText_BackupMemoryDamaged[];
+extern const u8 gText_CheckCompleted[];
+extern const u8 gText_SaveCompleteGameCannotContinue[];
+extern const u8 gText_SaveCompletePressA[];
+extern const u8 gText_GamePlayCannotBeContinued[];
// gSaveFailedClockInfo enum
enum
@@ -155,8 +156,8 @@ static void VBlankCB_UpdateClockGraphics(void);
static bool8 VerifySectorWipe(u16 sector);
static bool8 WipeSectors(u32);
-// although this is a general text printer, it's only used in this file.
-static void SaveFailedScreenTextPrint(u8 *text, u8 var1, u8 var2)
+// Although this is a general text printer, it's only used in this file.
+static void SaveFailedScreenTextPrint(const u8 *text, u8 var1, u8 var2)
{
u8 color[3];
@@ -187,72 +188,70 @@ static void CB2_SaveFailedScreen(void)
{
switch (gMain.state)
{
- case 0:
- default:
- SetVBlankCallback(NULL);
- SetGpuReg(REG_OFFSET_DISPCNT, 0);
- SetGpuReg(REG_OFFSET_BG3CNT, 0);
- SetGpuReg(REG_OFFSET_BG2CNT, 0);
- SetGpuReg(REG_OFFSET_BG1CNT, 0);
- SetGpuReg(REG_OFFSET_BG0CNT, 0);
- SetGpuReg(REG_OFFSET_BG3HOFS, 0);
- SetGpuReg(REG_OFFSET_BG3VOFS, 0);
- SetGpuReg(REG_OFFSET_BG2HOFS, 0);
- SetGpuReg(REG_OFFSET_BG2VOFS, 0);
- SetGpuReg(REG_OFFSET_BG1HOFS, 0);
- SetGpuReg(REG_OFFSET_BG1VOFS, 0);
- SetGpuReg(REG_OFFSET_BG0HOFS, 0);
- SetGpuReg(REG_OFFSET_BG0VOFS, 0);
- // how come this doesnt use the Dma manager?
- DmaFill16(3, 0, VRAM, VRAM_SIZE);
- DmaFill32(3, 0, OAM, OAM_SIZE);
- DmaFill16(3, 0, PLTT, PLTT_SIZE);
- LZ77UnCompVram(gBirchHelpGfx, (void *)VRAM);
- LZ77UnCompVram(gBirchBagTilemap, (void *)(VRAM + 0x7000));
- LZ77UnCompVram(gBirchGrassTilemap, (void *)(VRAM + 0x7800));
- LZ77UnCompVram(sSaveFailedClockGfx, (void *)(VRAM + 0x10020));
- ResetBgsAndClearDma3BusyFlags(0);
- InitBgsFromTemplates(0, gUnknown_085EFD88, 3);
- SetBgTilemapBuffer(0, (void *)&gDecompressionBuffer[0x2000]);
- CpuFill32(0, &gDecompressionBuffer[0x2000], 0x800);
- LoadBgTiles(0, gTextWindowFrame1_Gfx, 0x120, 0x214);
- InitWindows(gUnknown_085EFD94);
- // AddWindowWithoutTileMap returns a u16/integer, but the info is clobbered into a u8 here resulting in lost info. Bug?
- gSaveFailedWindowIds[TEXT_WIN_ID] = AddWindowWithoutTileMap(gUnknown_085EFD9C);
- SetWindowAttribute(gSaveFailedWindowIds[TEXT_WIN_ID], 7, (u32)&gDecompressionBuffer[0x2800]);
- gSaveFailedWindowIds[CLOCK_WIN_ID] = AddWindowWithoutTileMap(gUnknown_085EFDA4);
- SetWindowAttribute(gSaveFailedWindowIds[CLOCK_WIN_ID], 7, (u32)&gDecompressionBuffer[0x3D00]);
- DeactivateAllTextPrinters();
- ResetSpriteData();
- ResetTasks();
- ResetPaletteFade();
- LoadPalette(gBirchBagGrassPal, 0, 0x40);
- LoadPalette(sSaveFailedClockPal, 0x100, 0x20);
- LoadPalette(gTextWindowFrame1_Pal, 0xE0, 0x20);
- LoadPalette(gUnknown_0860F074, 0xF0, 0x20);
- SetWindowBorderStyle(gSaveFailedWindowIds[TEXT_WIN_ID], FALSE, 0x214, 0xE);
- SetWindowBorderStyle(gSaveFailedWindowIds[CLOCK_WIN_ID], FALSE, 0x214, 0xE);
- FillWindowPixelBuffer(gSaveFailedWindowIds[CLOCK_WIN_ID], 0x11); // backwards?
- FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], 0x11);
- CopyWindowToVram(gSaveFailedWindowIds[CLOCK_WIN_ID], 2); // again?
- CopyWindowToVram(gSaveFailedWindowIds[TEXT_WIN_ID], 1);
- SaveFailedScreenTextPrint(gText_SaveFailedCheckingBackup, 1, 0);
- BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0);
- EnableInterrupts(1);
- SetVBlankCallback(VBlankCB);
- SetGpuReg(0, 0x1040);
- ShowBg(0);
- ShowBg(2);
- ShowBg(3);
- gMain.state++;
- break;
- case 1:
- if (!UpdatePaletteFade())
- {
- SetMainCallback2(CB2_WipeSave);
- SetVBlankCallback(VBlankCB_UpdateClockGraphics);
- }
- break;
+ case 0:
+ default:
+ SetVBlankCallback(NULL);
+ SetGpuReg(REG_OFFSET_DISPCNT, 0);
+ SetGpuReg(REG_OFFSET_BG3CNT, 0);
+ SetGpuReg(REG_OFFSET_BG2CNT, 0);
+ SetGpuReg(REG_OFFSET_BG1CNT, 0);
+ SetGpuReg(REG_OFFSET_BG0CNT, 0);
+ SetGpuReg(REG_OFFSET_BG3HOFS, 0);
+ SetGpuReg(REG_OFFSET_BG3VOFS, 0);
+ SetGpuReg(REG_OFFSET_BG2HOFS, 0);
+ SetGpuReg(REG_OFFSET_BG2VOFS, 0);
+ SetGpuReg(REG_OFFSET_BG1HOFS, 0);
+ SetGpuReg(REG_OFFSET_BG1VOFS, 0);
+ SetGpuReg(REG_OFFSET_BG0HOFS, 0);
+ SetGpuReg(REG_OFFSET_BG0VOFS, 0);
+ DmaFill16(3, 0, VRAM, VRAM_SIZE);
+ DmaFill32(3, 0, OAM, OAM_SIZE);
+ DmaFill16(3, 0, PLTT, PLTT_SIZE);
+ LZ77UnCompVram(gBirchHelpGfx, (void *)VRAM);
+ LZ77UnCompVram(gBirchBagTilemap, (void *)(VRAM + 0x7000));
+ LZ77UnCompVram(gBirchGrassTilemap, (void *)(VRAM + 0x7800));
+ LZ77UnCompVram(sSaveFailedClockGfx, (void *)(VRAM + 0x10020));
+ ResetBgsAndClearDma3BusyFlags(0);
+ InitBgsFromTemplates(0, gUnknown_085EFD88, 3);
+ SetBgTilemapBuffer(0, (void *)&gDecompressionBuffer[0x2000]);
+ CpuFill32(0, &gDecompressionBuffer[0x2000], 0x800);
+ LoadBgTiles(0, gTextWindowFrame1_Gfx, 0x120, 0x214);
+ InitWindows(gUnknown_085EFD94);
+ gSaveFailedWindowIds[TEXT_WIN_ID] = AddWindowWithoutTileMap(gUnknown_085EFD9C);
+ SetWindowAttribute(gSaveFailedWindowIds[TEXT_WIN_ID], 7, (u32)&gDecompressionBuffer[0x2800]);
+ gSaveFailedWindowIds[CLOCK_WIN_ID] = AddWindowWithoutTileMap(gUnknown_085EFDA4);
+ SetWindowAttribute(gSaveFailedWindowIds[CLOCK_WIN_ID], 7, (u32)&gDecompressionBuffer[0x3D00]);
+ DeactivateAllTextPrinters();
+ ResetSpriteData();
+ ResetTasks();
+ ResetPaletteFade();
+ LoadPalette(gBirchBagGrassPal, 0, 0x40);
+ LoadPalette(sSaveFailedClockPal, 0x100, 0x20);
+ LoadPalette(gTextWindowFrame1_Pal, 0xE0, 0x20);
+ LoadPalette(gUnknown_0860F074, 0xF0, 0x20);
+ SetWindowBorderStyle(gSaveFailedWindowIds[TEXT_WIN_ID], FALSE, 0x214, 0xE);
+ SetWindowBorderStyle(gSaveFailedWindowIds[CLOCK_WIN_ID], FALSE, 0x214, 0xE);
+ FillWindowPixelBuffer(gSaveFailedWindowIds[CLOCK_WIN_ID], 0x11); // backwards?
+ FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], 0x11);
+ CopyWindowToVram(gSaveFailedWindowIds[CLOCK_WIN_ID], 2); // again?
+ CopyWindowToVram(gSaveFailedWindowIds[TEXT_WIN_ID], 1);
+ SaveFailedScreenTextPrint(gText_SaveFailedCheckingBackup, 1, 0);
+ BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK);
+ EnableInterrupts(1);
+ SetVBlankCallback(VBlankCB);
+ SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
+ ShowBg(0);
+ ShowBg(2);
+ ShowBg(3);
+ gMain.state++;
+ break;
+ case 1:
+ if (!UpdatePaletteFade())
+ {
+ SetMainCallback2(CB2_WipeSave);
+ SetVBlankCallback(VBlankCB_UpdateClockGraphics);
+ }
+ break;
}
}
@@ -346,7 +345,7 @@ static void CB2_ReturnToTitleScreen(void)
static void VBlankCB_UpdateClockGraphics(void)
{
- unsigned int n = (gMain.vblankCounter2 >> 3) & 7;
+ u32 n = (gMain.vblankCounter2 >> 3) & 7;
gMain.oamBuffer[0] = sClockOamData;
gMain.oamBuffer[0].x = 112;
diff --git a/src/save_location.c b/src/save_location.c
index 262aaf40c..d49afa736 100644
--- a/src/save_location.c
+++ b/src/save_location.c
@@ -9,21 +9,18 @@
static bool32 IsCurMapInLocationList(const u16 *list)
{
+ s32 i;
u16 locSum = (gSaveBlock1Ptr->location.mapGroup << 8) + (gSaveBlock1Ptr->location.mapNum);
- // im sure it was written a different way, but for the love of christ I cant figure out how to write it different where it still matches.
- if (*list != 0xFFFF)
+ for (i = 0; list[i] != 0xFFFF; i++)
{
- u16 termValue = 0xFFFF;
- const u16 *localList;
- for (localList = list; *localList != termValue; localList++)
- if (*localList == locSum)
- return TRUE;
+ if (list[i] == locSum)
+ return TRUE;
}
+
return FALSE;
}
-// TODO: Not require a packed u16 array for these lists
static const u16 sSaveLocationPokeCenterList[] =
{
MAP_OLDALE_TOWN_POKEMON_CENTER_1F,
@@ -72,7 +69,7 @@ static bool32 IsCurMapPokeCenter(void)
return IsCurMapInLocationList(sSaveLocationPokeCenterList);
}
-static const u16 sSaveLocationReloadLocList[] = // there's only 1 location, and it's presumed its for the save reload feature for battle tower
+static const u16 sSaveLocationReloadLocList[] = // There's only 1 location, and it's presumed its for the save reload feature for battle tower.
{
MAP_BATTLE_FRONTIER_BATTLE_TOWER_LOBBY,
0xFFFF,
@@ -83,13 +80,13 @@ static bool32 IsCurMapReloadLocation(void)
return IsCurMapInLocationList(sSaveLocationReloadLocList);
}
-// nulled out list. unknown what this would have been
+// Nulled out list. Unknown what this would have been.
static const u16 sUnknown_0861440E[] =
{
0xFFFF,
};
-bool32 sub_81AFCEC(void)
+static bool32 sub_81AFCEC(void)
{
return IsCurMapInLocationList(sUnknown_0861440E);
}
diff --git a/src/scanline_effect.c b/src/scanline_effect.c
index 148e053fc..a9ae9427b 100644
--- a/src/scanline_effect.c
+++ b/src/scanline_effect.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "battle.h"
#include "data2.h"
#include "task.h"
#include "trig.h"
@@ -7,15 +8,6 @@
static void CopyValue16Bit(void);
static void CopyValue32Bit(void);
-extern u16 gBattle_BG0_Y;
-extern u16 gBattle_BG0_X;
-extern u16 gBattle_BG1_X;
-extern u16 gBattle_BG1_Y;
-extern u16 gBattle_BG2_X;
-extern u16 gBattle_BG2_Y;
-extern u16 gBattle_BG3_X;
-extern u16 gBattle_BG3_Y;
-
// EWRAM vars
// Per-scanline register values.
diff --git a/src/scrcmd.c b/src/scrcmd.c
index 127a5ecaa..310387337 100644
--- a/src/scrcmd.c
+++ b/src/scrcmd.c
@@ -4,6 +4,7 @@
#include "berry.h"
#include "clock.h"
#include "coins.h"
+#include "contest.h"
#include "contest_link_80F57C4.h"
#include "contest_painting.h"
#include "data2.h"
@@ -27,6 +28,7 @@
#include "event_obj_lock.h"
#include "menu.h"
#include "money.h"
+#include "mossdeep_gym.h"
#include "mystery_event_script.h"
#include "palette.h"
#include "party_menu.h"
@@ -49,11 +51,6 @@
#include "tv.h"
#include "window.h"
-extern u16 sub_81A89A0(u8);
-extern void sub_81A8AF8(void);
-extern void sub_81A895C(void);
-extern void sub_81A8934(u8);
-
typedef u16 (*SpecialFunc)(void);
typedef void (*NativeFunc)(void);
@@ -66,8 +63,6 @@ static EWRAM_DATA u16 sMovingNpcMapBank = 0;
static EWRAM_DATA u16 sMovingNpcMapId = 0;
static EWRAM_DATA u16 sFieldEffectScriptId = 0;
-extern u16 gSpecialVar_ContestCategory;
-
IWRAM_DATA u8 gUnknown_03000F30;
extern const SpecialFunc gSpecials[];
@@ -1713,8 +1708,8 @@ bool8 ScrCmd_checkpartymove(struct ScriptContext *ctx)
u8 i;
u16 moveId = ScriptReadHalfword(ctx);
- gSpecialVar_Result = 6;
- for (i = 0; i < 6; i++)
+ gSpecialVar_Result = PARTY_SIZE;
+ for (i = 0; i < PARTY_SIZE; i++)
{
u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL);
if (!species)
@@ -2157,13 +2152,13 @@ bool8 ScrCmd_mossdeepgym1(struct ScriptContext *ctx)
{
u16 v1 = VarGet(ScriptReadHalfword(ctx));
- sMovingNpcId = sub_81A89A0(v1);
+ sMovingNpcId = MossdeepGym_MoveEvents(v1);
return FALSE;
}
bool8 ScrCmd_mossdeepgym2(struct ScriptContext *ctx)
{
- sub_81A8AF8();
+ MossdeepGym_TurnEvents();
return FALSE;
}
@@ -2171,13 +2166,13 @@ bool8 ScrCmd_mossdeepgym3(struct ScriptContext *ctx)
{
u16 v1 = VarGet(ScriptReadHalfword(ctx));
- sub_81A8934(v1);
+ InitMossdeepGymTiles(v1);
return FALSE;
}
bool8 ScrCmd_mossdeepgym4(struct ScriptContext *ctx)
{
- sub_81A895C();
+ FinishMossdeepGymTiles();
return FALSE;
}
@@ -2204,7 +2199,7 @@ bool8 ScrCmd_cmdD9(struct ScriptContext *ctx)
}
}
-// This command will force the Pokémon to be obedient, you don't get to make it disobedient
+// This command will force the Pokémon to be obedient, you don't get to make it disobedient.
bool8 ScrCmd_setmonobedient(struct ScriptContext *ctx)
{
bool8 obedient = TRUE;
diff --git a/src/script_pokemon_util_80F87D8.c b/src/script_pokemon_util_80F87D8.c
new file mode 100755
index 000000000..7fc61f953
--- /dev/null
+++ b/src/script_pokemon_util_80F87D8.c
@@ -0,0 +1,707 @@
+#include "global.h"
+#include "battle.h"
+#include "battle_gfx_sfx_util.h"
+#include "berry.h"
+#include "contest.h"
+#include "contest_link_80F57C4.h"
+#include "contest_painting.h"
+#include "daycare.h"
+#include "decompress.h"
+#include "event_data.h"
+#include "event_object_movement.h"
+#include "international_string_util.h"
+#include "link.h"
+#include "link_rfu.h"
+#include "main.h"
+#include "menu.h"
+#include "overworld.h"
+#include "palette.h"
+#include "party_menu.h"
+#include "pokedex.h"
+#include "pokemon.h"
+#include "random.h"
+#include "script.h"
+#include "script_menu.h"
+#include "sprite.h"
+#include "string_util.h"
+#include "tv.h"
+#include "constants/event_objects.h"
+#include "constants/items.h"
+#include "constants/species.h"
+#include "constants/vars.h"
+
+extern const u16 gEventObjectPalette8[];
+extern const u16 gEventObjectPalette17[];
+extern const u16 gEventObjectPalette33[];
+extern const u16 gEventObjectPalette34[];
+extern const struct CompressedSpriteSheet gMonFrontPicTable[];
+
+extern u8 gSelectedOrderFromParty[];
+
+static const u8 gUnknown_0858D8EC[] = { 3, 4, 5, 14 };
+
+static void sub_80F8EE8(u8 taskId);
+static void sub_80F9088(u8 taskId);
+static void sub_80F9460(void);
+static void sub_80F94B8(void);
+
+void SetContestTrainerGfxIds(void)
+{
+ gSaveBlock1Ptr->vars[VAR_OBJ_GFX_ID_0 - VARS_START] = gContestMons[0].trainerGfxId;
+ gSaveBlock1Ptr->vars[VAR_OBJ_GFX_ID_1 - VARS_START] = gContestMons[1].trainerGfxId;
+ gSaveBlock1Ptr->vars[VAR_OBJ_GFX_ID_2 - VARS_START] = gContestMons[2].trainerGfxId;
+}
+
+void sub_80F8814(void)
+{
+ u16 var1;
+ u8 var0 = gSpecialVar_0x8005;
+ switch (var0)
+ {
+ case 0:
+ var1 = 3;
+ break;
+ case 1:
+ var1 = 4;
+ break;
+ case 2:
+ var1 = 5;
+ break;
+ default:
+ var1 = 100;
+ break;
+ }
+
+ gSpecialVar_0x8004 = var1;
+}
+
+void sub_80F8850(void)
+{
+ sub_80F8264();
+ sub_80F8290();
+ sub_80F8438();
+}
+
+void sub_80F8864(void)
+{
+ int contestWinner;
+ switch (gSpecialVar_ContestCategory)
+ {
+ case CONTEST_CATEGORY_COOL:
+ contestWinner = 8;
+ break;
+ case CONTEST_CATEGORY_BEAUTY:
+ contestWinner = 9;
+ break;
+ case CONTEST_CATEGORY_CUTE:
+ contestWinner = 10;
+ break;
+ case CONTEST_CATEGORY_SMART:
+ contestWinner = 11;
+ break;
+ case CONTEST_CATEGORY_TOUGH:
+ default:
+ contestWinner = 12;
+ break;
+ }
+
+ if (!gSaveBlock1Ptr->contestWinners[contestWinner].species)
+ gSpecialVar_0x8004 = 0;
+ else
+ gSpecialVar_0x8004 = 1;
+}
+
+void sub_80F88DC(void)
+{
+ sub_80DEDA8(0xFF);
+}
+
+void sub_80F88E8(void)
+{
+ if (gContestFinalStandings[gContestPlayerMonIndex] == 0
+ && gSpecialVar_ContestRank == 3
+ && gUnknown_02039F08[gContestPlayerMonIndex] >= 800)
+ {
+ gSpecialVar_0x8004 = 1;
+ }
+ else
+ {
+ gSpecialVar_0x8004 = 0;
+ }
+}
+
+u8 sub_80F8940(void)
+{
+ int i;
+ u8 var0 = 0;
+
+ for (i = 0; i < 5; i++)
+ {
+ if (gSaveBlock1Ptr->contestWinners[8 + i].species)
+ var0++;
+ }
+
+ return var0;
+}
+
+void sub_80F8970(void)
+{
+ s16 sp[4];
+ int i, j;
+ s16 condition;
+ s8 var0;
+ u8 var2;
+ u8 r8;
+ u8 r7;
+
+ for (i = 0; i < 4; i++)
+ sp[i] = gContestMonConditions[i];
+
+ for (i = 0; i < 3; i++)
+ {
+ for (j = 3; j > i; j--)
+ {
+ if (sp[j - 1] < sp[j])
+ {
+ int temp = sp[j];
+ sp[j] = sp[j - 1];
+ sp[j - 1] = temp;
+ }
+ }
+ }
+
+ condition = sp[gSpecialVar_0x8006];
+ var0 = 0;
+ r8 = 0;
+ for (i = 0; i < 4; i++)
+ {
+ if (sp[i] == condition)
+ {
+ var0++;
+ if (i == gSpecialVar_0x8006)
+ r8 = var0;
+ }
+ }
+
+ for (i = 0; i < 4; i++)
+ {
+ if (sp[i] == condition)
+ break;
+ }
+
+ r7 = i;
+ var2 = r8;
+ for (i = 0; i < 4; i++)
+ {
+ if (condition == gContestMonConditions[i])
+ {
+ if (var2 == 1)
+ break;
+ var2--;
+ }
+ }
+
+ StringCopy(gStringVar1, gContestMons[i].nickname);
+ StringCopy(gStringVar2, gContestMons[i].trainerName);
+ sub_81DB5AC(gStringVar2);
+
+ if (var0 == 1)
+ gSpecialVar_0x8006 = r7;
+ else if (r8 == var0)
+ gSpecialVar_0x8006 = r7;
+ else
+ gSpecialVar_0x8006 = r7 + 4;
+}
+
+static void ShowContestWinnerCleanup(void)
+{
+ SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
+}
+
+void ShowContestWinner(void)
+{
+ SetMainCallback2(sub_812FDEC);
+ gMain.savedCallback = ShowContestWinnerCleanup;
+}
+
+void sub_80F8AFC(void)
+{
+ int i;
+
+ if (gIsLinkContest & 1)
+ {
+ for (i = 0; i < gUnknown_02039F30; i++)
+ {
+ int version = (u8)gLinkPlayers[i].version;
+ if (version == VERSION_RUBY || version == VERSION_SAPPHIRE)
+ {
+ if (gLinkPlayers[i].gender == MALE)
+ gContestMons[i].trainerGfxId = EVENT_OBJ_GFX_LINK_RS_BRENDAN;
+ else
+ gContestMons[i].trainerGfxId = EVENT_OBJ_GFX_LINK_RS_MAY;
+ }
+ }
+
+ VarSet(VAR_OBJ_GFX_ID_0, gContestMons[0].trainerGfxId);
+ VarSet(VAR_OBJ_GFX_ID_1, gContestMons[1].trainerGfxId);
+ VarSet(VAR_OBJ_GFX_ID_2, gContestMons[2].trainerGfxId);
+ VarSet(VAR_OBJ_GFX_ID_3, gContestMons[3].trainerGfxId);
+ }
+}
+
+void sub_80F8B94(void)
+{
+ int i;
+ u8 eventObjectId;
+ int version;
+ struct Sprite *sprite;
+
+ gReservedSpritePaletteCount = 12;
+ if (gIsLinkContest & 1)
+ {
+ for (i = 0; i < gUnknown_02039F30; i++)
+ {
+ eventObjectId = GetEventObjectIdByLocalIdAndMap(gUnknown_0858D8EC[i], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
+ sprite = &gSprites[gEventObjects[eventObjectId].spriteId];
+ sprite->oam.paletteNum = 6 + i;
+ version = (u8)gLinkPlayers[i].version;
+ if (version == VERSION_RUBY || version == VERSION_SAPPHIRE)
+ {
+ if (gLinkPlayers[i].gender == MALE)
+ LoadPalette(gEventObjectPalette33, 0x160 + i * 0x10, 0x20);
+ else
+ LoadPalette(gEventObjectPalette34, 0x160 + i * 0x10, 0x20);
+ }
+ else
+ {
+ if (gLinkPlayers[i].gender == MALE)
+ LoadPalette(gEventObjectPalette8, 0x160 + i * 0x10, 0x20);
+ else
+ LoadPalette(gEventObjectPalette17, 0x160 + i * 0x10, 0x20);
+ }
+ }
+ }
+}
+
+u8 GiveMonArtistRibbon(void)
+{
+ u8 hasArtistRibbon;
+
+ hasArtistRibbon = GetMonData(&gPlayerParty[gUnknown_02039F24], MON_DATA_ARTIST_RIBBON);
+ if (!hasArtistRibbon && gContestFinalStandings[gContestPlayerMonIndex] == 0 && gSpecialVar_ContestRank == 3
+ && gUnknown_02039F08[gContestPlayerMonIndex] >= 800)
+ {
+ hasArtistRibbon = 1;
+ SetMonData(&gPlayerParty[gUnknown_02039F24], MON_DATA_ARTIST_RIBBON, &hasArtistRibbon);
+ if (GetRibbonCount(&gPlayerParty[gUnknown_02039F24]) > 4)
+ sub_80EE4DC(&gPlayerParty[gUnknown_02039F24], MON_DATA_ARTIST_RIBBON);
+
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+u8 sub_80F8D24(void)
+{
+ return 0;
+}
+
+void ShowContestEntryMonPic(void)
+{
+ const struct CompressedSpritePalette *palette;
+ u32 personality, otId;
+ u16 species;
+ u8 spriteId;
+ u8 taskId;
+ u8 left, top;
+
+ if (FindTaskIdByFunc(sub_80F8EE8) == 0xFF)
+ {
+ AllocateMonSpritesGfx();
+ left = 10;
+ top = 3;
+ species = gContestMons[gSpecialVar_0x8006].species;
+ personality = gContestMons[gSpecialVar_0x8006].personality;
+ otId = gContestMons[gSpecialVar_0x8006].otId;
+ taskId = CreateTask(sub_80F8EE8, 0x50);
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].data[1] = species;
+ if (gSpecialVar_0x8006 == gContestPlayerMonIndex)
+ HandleLoadSpecialPokePic_2(&gMonFrontPicTable[species], gMonSpritesGfxPtr->sprites[1], species, personality);
+ else
+ HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species], gMonSpritesGfxPtr->sprites[1], species, personality);
+
+ palette = GetMonSpritePalStructFromOtIdPersonality(species, otId, personality);
+ LoadCompressedObjectPalette(palette);
+ SetMultiuseSpriteTemplateToPokemon(species, 1);
+ gMultiuseSpriteTemplate.paletteTag = palette->tag;
+ spriteId = CreateSprite(&gMultiuseSpriteTemplate, (left + 1) * 8 + 32, (top * 8) + 40, 0);
+
+ if (gIsLinkContest & 1)
+ {
+ if (!(gIsLinkContest & 4))
+ DoMonFrontSpriteAnimation(&gSprites[spriteId], species, FALSE, 0);
+ }
+ else
+ {
+ DoMonFrontSpriteAnimation(&gSprites[spriteId], species, FALSE, 0);
+ }
+
+ gTasks[taskId].data[2] = spriteId;
+ gTasks[taskId].data[3] = left;
+ gTasks[taskId].data[4] = top;
+ gSprites[spriteId].callback = SpriteCallbackDummy;
+ gSprites[spriteId].oam.priority = 0;
+ }
+}
+
+void sub_80F8EB8(void)
+{
+ u8 taskId = FindTaskIdByFunc(sub_80F8EE8);
+ if (taskId != 0xFF)
+ {
+ gTasks[taskId].data[0]++;
+ FreeMonSpritesGfx();
+ }
+}
+
+static void sub_80F8EE8(u8 taskId)
+{
+ struct Task *task = &gTasks[taskId];
+ struct Sprite *sprite;
+
+ switch(task->data[0])
+ {
+ case 0:
+ task->data[0]++;
+ break;
+ case 1:
+ task->data[5] = CreateWindowFromRect(10, 3, 8, 8);
+ SetStandardWindowBorderStyle(task->data[5], 1);
+ task->data[0]++;
+ break;
+ case 2:
+ break;
+ case 3:
+ sprite = &gSprites[task->data[2]];
+ FreeSpritePaletteByTag(GetSpritePaletteTagByPaletteNum(sprite->oam.paletteNum));
+
+ if(sprite->oam.affineMode)
+ FreeOamMatrix(sprite->oam.matrixNum);
+
+ DestroySprite(sprite);
+ task->data[0]++;
+ break;
+ case 4:
+ sub_80E2A78(gTasks[taskId].data[5]);
+ DestroyTask(taskId);
+ break;
+ }
+}
+
+void ScriptGetMultiplayerId(void)
+{
+ if ((gIsLinkContest & 1) && gUnknown_02039F30 == 4 && !(gIsLinkContest & 2))
+ gSpecialVar_Result = GetMultiplayerId();
+ else
+ gSpecialVar_Result = 4;
+}
+
+void ScriptRandom(void)
+{
+ u16 random;
+ u16 *scriptPtr;
+
+ if (gIsLinkContest & 1)
+ {
+ gContestRngValue = 1103515245 * gContestRngValue + 24691;
+ random = gContestRngValue >> 16;
+ scriptPtr = &gSpecialVar_Result;
+ }
+ else
+ {
+ scriptPtr = &gSpecialVar_Result;
+ random = Random();
+ }
+ *scriptPtr = random % *scriptPtr;
+}
+
+u16 sub_80F903C(void)
+{
+ gContestRngValue = 1103515245 * gContestRngValue + 24691;
+ return gContestRngValue >> 16;
+}
+
+u8 sub_80F905C(void)
+{
+ if (gIsLinkContest & 2)
+ {
+ CreateTask(sub_80F9088, 5);
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+static void sub_80F9088(u8 taskId)
+{
+ switch (gTasks[taskId].data[0])
+ {
+ case 0:
+ if (sub_800A520())
+ {
+ sub_800ADF8();
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ gTasks[taskId].data[0]++;
+ break;
+ default:
+ if (sub_800A520() == 1)
+ {
+ EnableBothScriptContexts();
+ DestroyTask(taskId);
+ }
+ break;
+ }
+}
+
+void sub_80F90DC(void)
+{
+ if (gIsLinkContest & 2)
+ {
+ if (gReceivedRemoteLinkPlayers)
+ {
+ sub_800E0E8();
+ CreateWirelessStatusIndicatorSprite(8, 8);
+ }
+ }
+}
+
+void sub_80F910C(void)
+{
+ if (gIsLinkContest & 2)
+ {
+ if (gReceivedRemoteLinkPlayers)
+ sub_800E084();
+ }
+}
+
+u8 sub_80F9134(void)
+{
+ if (gIsLinkContest & 4)
+ return 1;
+ else
+ return 0;
+}
+
+void sub_80F9154(void)
+{
+ gIsLinkContest = 0;
+}
+
+u8 sub_80F9160(void)
+{
+ if (gIsLinkContest & 2)
+ return 1;
+ else
+ return 0;
+}
+
+void HealPlayerParty(void)
+{
+ u8 i, j;
+ u8 ppBonuses;
+ u8 arg[4];
+
+ // restore HP.
+ for(i = 0; i < gPlayerPartyCount; i++)
+ {
+ u16 maxHP = GetMonData(&gPlayerParty[i], MON_DATA_MAX_HP);
+ arg[0] = maxHP;
+ arg[1] = maxHP >> 8;
+ SetMonData(&gPlayerParty[i], MON_DATA_HP, arg);
+ ppBonuses = GetMonData(&gPlayerParty[i], MON_DATA_PP_BONUSES);
+
+ // restore PP.
+ for(j = 0; j < 4; j++)
+ {
+ arg[0] = CalculatePPWithBonus(GetMonData(&gPlayerParty[i], MON_DATA_MOVE1 + j), ppBonuses, j);
+ SetMonData(&gPlayerParty[i], MON_DATA_PP1 + j, arg);
+ }
+
+ // since status is u32, the four 0 assignments here are probably for safety to prevent undefined data from reaching SetMonData.
+ arg[0] = 0;
+ arg[1] = 0;
+ arg[2] = 0;
+ arg[3] = 0;
+ SetMonData(&gPlayerParty[i], MON_DATA_STATUS, arg);
+ }
+}
+
+u8 ScriptGiveMon(u16 species, u8 level, u16 item, u32 unused1, u32 unused2, u8 unused3)
+{
+ u16 nationalDexNum;
+ int sentToPc;
+ u8 heldItem[2];
+ struct Pokemon mon;
+
+ CreateMon(&mon, species, level, 32, 0, 0, 0, 0);
+ heldItem[0] = item;
+ heldItem[1] = item >> 8;
+ SetMonData(&mon, MON_DATA_HELD_ITEM, heldItem);
+ sentToPc = GiveMonToPlayer(&mon);
+ nationalDexNum = SpeciesToNationalPokedexNum(species);
+
+ switch(sentToPc)
+ {
+ case 0:
+ case 1:
+ GetSetPokedexFlag(nationalDexNum, 2);
+ GetSetPokedexFlag(nationalDexNum, 3);
+ break;
+ }
+ return sentToPc;
+}
+
+u8 ScriptGiveEgg(u16 species)
+{
+ struct Pokemon mon;
+ u8 isEgg;
+
+ CreateEgg(&mon, species, TRUE);
+ isEgg = TRUE;
+ SetMonData(&mon, MON_DATA_IS_EGG, &isEgg);
+
+ return GiveMonToPlayer(&mon);
+}
+
+void HasEnoughMonsForDoubleBattle(void)
+{
+ switch (GetMonsStateToDoubles())
+ {
+ case 0:
+ gSpecialVar_Result = 0;
+ break;
+ case 1:
+ gSpecialVar_Result = 1;
+ break;
+ case 2:
+ gSpecialVar_Result = 2;
+ break;
+ }
+}
+
+static bool8 CheckPartyMonHasHeldItem(u16 item)
+{
+ int i;
+
+ for(i = 0; i < PARTY_SIZE; i++)
+ {
+ u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
+ if (species != SPECIES_NONE && species != SPECIES_EGG && GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM) == item)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+bool8 sub_80F9370(void)
+{
+ bool8 hasItem = CheckPartyMonHasHeldItem(ITEM_ENIGMA_BERRY);
+ if (hasItem == TRUE)
+ GetBerryNameByBerryType(ItemIdToBerryType(ITEM_ENIGMA_BERRY), gStringVar1);
+
+ return hasItem;
+}
+
+void CreateScriptedWildMon(u16 species, u8 level, u16 item)
+{
+ u8 heldItem[2];
+
+ ZeroEnemyPartyMons();
+ CreateMon(&gEnemyParty[0], species, level, 0x20, 0, 0, 0, 0);
+ if (item)
+ {
+ heldItem[0] = item;
+ heldItem[1] = item >> 8;
+ SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, heldItem);
+ }
+}
+
+void ScriptSetMonMoveSlot(u8 monIndex, u16 move, u8 slot)
+{
+ if (monIndex > PARTY_SIZE)
+ monIndex = gPlayerPartyCount - 1;
+
+ SetMonMoveSlot(&gPlayerParty[monIndex], move, slot);
+}
+
+void sub_80F9438(void)
+{
+ gMain.savedCallback = sub_80F9460;
+ VarSet(VAR_FRONTIER_FACILITY, 9); // this isn't a valid frontier facility id (??)
+ sub_81B8518(0);
+}
+
+static void sub_80F9460(void)
+{
+ switch (gSelectedOrderFromParty[0])
+ {
+ case 0:
+ gSpecialVar_Result = 0;
+ break;
+ default:
+ gSpecialVar_Result = 1;
+ break;
+ }
+
+ SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
+}
+
+void sub_80F9490(void)
+{
+ gMain.savedCallback = sub_80F94B8;
+ sub_81B8518(gSpecialVar_0x8004 + 1);
+}
+
+static void sub_80F94B8(void)
+{
+ switch (gSelectedOrderFromParty[0])
+ {
+ case 0:
+ gSpecialVar_Result = 0;
+ break;
+ default:
+ gSpecialVar_Result = 1;
+ break;
+ }
+
+ SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
+}
+
+void ReducePlayerPartyToSelectedMons(void)
+{
+ struct Pokemon party[4];
+ int i;
+
+ CpuFill32(0, party, sizeof party);
+
+ // copy the selected pokemon according to the order.
+ for (i = 0; i < 4; i++)
+ if (gSelectedOrderFromParty[i]) // as long as the order keeps going (did the player select 1 mon? 2? 3?), do not stop
+ party[i] = gPlayerParty[gSelectedOrderFromParty[i] - 1]; // index is 0 based, not literal
+
+ CpuFill32(0, gPlayerParty, sizeof gPlayerParty);
+
+ // overwrite the first 4 with the order copied to.
+ for (i = 0; i < 4; i++)
+ gPlayerParty[i] = party[i];
+
+ CalculatePlayerPartyCount();
+}
diff --git a/src/start_menu.c b/src/start_menu.c
index 173d0a79f..455d26509 100644
--- a/src/start_menu.c
+++ b/src/start_menu.c
@@ -35,6 +35,7 @@
#include "field_player_avatar.h"
#include "battle_pyramid_bag.h"
#include "battle_pike.h"
+#include "new_game.h"
// Menu actions
enum
@@ -63,6 +64,10 @@ enum
SAVE_ERROR
};
+// IWRAM common
+bool8 (*gMenuCallback)(void);
+
+// EWRAM
EWRAM_DATA static u8 sSafariBallsWindowId = 0;
EWRAM_DATA static u8 sBattlePyramidFloorWindowId = 0;
EWRAM_DATA static u8 sStartMenuCursorPos = 0;
@@ -76,7 +81,6 @@ EWRAM_DATA static bool8 sSavingComplete = FALSE;
EWRAM_DATA static u8 sSaveInfoWindowId = 0;
// Extern variables.
-extern u8 gDifferentSaveFile;
extern u8 gUnknown_03005DB4;
// Extern functions in not decompiled files.
@@ -460,18 +464,18 @@ static bool32 InitStartMenuStep(void)
sUnknown_02037619[0]++;
break;
case 3:
- if (GetSafariZoneFlag() != FALSE)
+ if (GetSafariZoneFlag())
{
ShowSafariBallsWindow();
}
- if (InBattlePyramid() != FALSE)
+ if (InBattlePyramid())
{
ShowPyramidFloorWindow();
}
sUnknown_02037619[0]++;
break;
case 4:
- if (PrintStartMenuActions(&sUnknown_02037619[1], 2) == FALSE)
+ if (!PrintStartMenuActions(&sUnknown_02037619[1], 2))
{
break;
}
diff --git a/src/string_util.c b/src/string_util.c
index 3fbf79d87..8ce9a97ed 100644
--- a/src/string_util.c
+++ b/src/string_util.c
@@ -2,7 +2,11 @@
#include "string_util.h"
#include "text.h"
-EWRAM_DATA u8 gUnknownStringVar[16] = {0};
+EWRAM_DATA u8 gStringVar1[0x100] = {0};
+EWRAM_DATA u8 gStringVar2[0x100] = {0};
+EWRAM_DATA u8 gStringVar3[0x100] = {0};
+EWRAM_DATA u8 gStringVar4[0x3E8] = {0};
+EWRAM_DATA static u8 sUnknownStringVar[16] = {0};
static const u8 sDigits[] = __("0123456789ABCDEF");
@@ -421,7 +425,7 @@ u8 *StringBraille(u8 *dest, const u8 *src)
static const u8 *ExpandPlaceholder_UnknownStringVar(void)
{
- return gUnknownStringVar;
+ return sUnknownStringVar;
}
static const u8 *ExpandPlaceholder_PlayerName(void)
diff --git a/src/strings.c b/src/strings.c
index 9cb384e70..1198835cb 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -1,9 +1,7 @@
#include "global.h"
#include "strings.h"
-// Yes, all the aligns are absolutely necessary.
-// Until someone can come up with a better way to align byte arrays in C, this is what we're doing.
-asm(".align 2");
+ALIGNED(4)
const u8 gExpandedPlaceholder_Empty[] = _("");
const u8 gExpandedPlaceholder_Kun[] = _("");
const u8 gExpandedPlaceholder_Chan[] = _("");
@@ -49,24 +47,12 @@ const u8 gUnknown_085E8504[] = _("SELECT");
const u8 gUnknown_085E850B[] = _("+ Control Pad");
const u8 gUnknown_085E8519[] = _("L Button R Button");
const u8 gUnknown_085E852C[] = _("CONTROLS");
-
-asm(".align 2");
-const u8 gUnknown_085E8538[] = _("{DPAD_UPDOWN}PICK {A_BUTTON}OK");
-
-asm(".align 2");
-const u8 gUnknown_085E8544[] = _("{A_BUTTON}NEXT");
-
-asm(".align 2");
-const u8 gUnknown_085E854C[] = _("{A_BUTTON}NEXT {B_BUTTON}BACK");
-
-asm(".align 2");
-const u8 gText_PickNextCancel[] = _("{DPAD_UPDOWN}PICK {A_BUTTON}NEXT {B_BUTTON}CANCEL");
-
-asm(".align 2");
-const u8 gText_PickCancel[] = _("{DPAD_UPDOWN}PICK {A_BUTTON}{B_BUTTON}CANCEL");
-
-asm(".align 2");
-const u8 gText_UnkCtrlF800Exit[] = _("{A_BUTTON}EXIT");
+ALIGNED(4) const u8 gUnknown_085E8538[] = _("{DPAD_UPDOWN}PICK {A_BUTTON}OK");
+ALIGNED(4) const u8 gUnknown_085E8544[] = _("{A_BUTTON}NEXT");
+ALIGNED(4) const u8 gUnknown_085E854C[] = _("{A_BUTTON}NEXT {B_BUTTON}BACK");
+ALIGNED(4) const u8 gText_PickNextCancel[] = _("{DPAD_UPDOWN}PICK {A_BUTTON}NEXT {B_BUTTON}CANCEL");
+ALIGNED(4) const u8 gText_PickCancel[] = _("{DPAD_UPDOWN}PICK {A_BUTTON}{B_BUTTON}CANCEL");
+ALIGNED(4) const u8 gText_UnkCtrlF800Exit[] = _("{A_BUTTON}EXIT");
const u8 gText_BirchBoy[] = _("BOY");
const u8 gText_BirchGirl[] = _("GIRL");
const u8 gText_DefaultNameStu[] = _("STU");
@@ -486,30 +472,14 @@ const u8 gText_EscapeFromHere[] = _("Want to escape from here and return\nto {ST
const u8 gText_ReturnToHealingSpot[] = _("Want to return to the healing spot\nused last in {STR_VAR_1}?");
const u8 gText_PauseUntilPress[] = _("{PAUSE_UNTIL_PRESS}");
const u8 gJPText_PutVar1IntoSpinner[] = _("{STR_VAR_1}を ぐるぐるこうかんに\nだして よろしいですか?");
-
-asm(".align 2");
-const u8 gText_OnlyPkmnForBattle[] = _("That’s your only\nPOKéMON for battle.");
-
-asm(".align 2");
-const u8 gText_PkmnCantBeTradedNow[] = _("That POKéMON can’t be traded\nnow.");
-
-asm(".align 2");
-const u8 gText_EggCantBeTradedNow[] = _("An EGG can’t be traded now.");
-
-asm(".align 2");
-const u8 gText_OtherTrainersPkmnCantBeTraded[] = _("The other TRAINER’s POKéMON\ncan’t be traded now.");
-
-asm(".align 2");
-const u8 gText_OtherTrainerCantAcceptPkmn[] = _("The other TRAINER can’t accept\nthat POKéMON now.");
-
-asm(".align 2");
-const u8 gText_CantTradeWithTrainer[] = _("You can’t trade with that\nTRAINER now.");
-
-asm(".align 2");
-const u8 gText_NotPkmnOtherTrainerWants[] = _("That isn’t the type of POKéMON\nthat the other TRAINER wants.");
-
-asm(".align 2");
-const u8 gText_ThatIsntAnEgg[] = _("That isn’t an EGG.");
+ALIGNED(4) const u8 gText_OnlyPkmnForBattle[] = _("That’s your only\nPOKéMON for battle.");
+ALIGNED(4) const u8 gText_PkmnCantBeTradedNow[] = _("That POKéMON can’t be traded\nnow.");
+ALIGNED(4) const u8 gText_EggCantBeTradedNow[] = _("An EGG can’t be traded now.");
+ALIGNED(4) const u8 gText_OtherTrainersPkmnCantBeTraded[] = _("The other TRAINER’s POKéMON\ncan’t be traded now.");
+ALIGNED(4) const u8 gText_OtherTrainerCantAcceptPkmn[] = _("The other TRAINER can’t accept\nthat POKéMON now.");
+ALIGNED(4) const u8 gText_CantTradeWithTrainer[] = _("You can’t trade with that\nTRAINER now.");
+ALIGNED(4) const u8 gText_NotPkmnOtherTrainerWants[] = _("That isn’t the type of POKéMON\nthat the other TRAINER wants.");
+ALIGNED(4) const u8 gText_ThatIsntAnEgg[] = _("That isn’t an EGG.");
const u8 gText_Register[] = _("REGISTER");
const u8 gText_Attack3[] = _("ATTACK");
const u8 gText_Defense3[] = _("DEFENSE");
@@ -1250,21 +1220,11 @@ const u8 gText_BattleFactory[] = _("BATTLE FACTORY");
const u8 gText_BattleArena[] = _("BATTLE ARENA");
const u8 gText_BattlePike[] = _("BATTLE PIKE");
const u8 gText_BattlePyramid[] = _("BATTLE PYRAMID");
-
-asm(".align 2");
-const u8 gUnknown_085ED164[] = _("{STR_VAR_1} SINGLE");
-
-asm(".align 2");
-const u8 gUnknown_085ED170[] = _("{STR_VAR_1} DOUBLE");
-
-asm(".align 2");
-const u8 gUnknown_085ED17C[] = _("{STR_VAR_1} MULTI");
-
-asm(".align 2");
-const u8 gUnknown_085ED188[] = _("{STR_VAR_1} LINK");
-
-asm(".align 2");
-const u8 gUnknown_085ED190[] = _("{STR_VAR_1}");
+ALIGNED(4) const u8 gUnknown_085ED164[] = _("{STR_VAR_1} SINGLE");
+ALIGNED(4) const u8 gUnknown_085ED170[] = _("{STR_VAR_1} DOUBLE");
+ALIGNED(4) const u8 gUnknown_085ED17C[] = _("{STR_VAR_1} MULTI");
+ALIGNED(4) const u8 gUnknown_085ED188[] = _("{STR_VAR_1} LINK");
+ALIGNED(4) const u8 gUnknown_085ED190[] = _("{STR_VAR_1}");
const u8 gText_Give[] = _("Give");
const u8 gText_NoNeed[] = _("No need");
const u8 gText_ColorLightShadowDarkGrey[] = _("{COLOR LIGHT_GREY}{SHADOW DARK_GREY}");
@@ -1331,93 +1291,35 @@ const u8 gMatchCall_MaySelfIntroductionText_Line1[] = _("My POKéMON and I help"
const u8 gMatchCall_MaySelfIntroductionText_Line2[] = _("my father’s research.");
const u8 gText_HatchedFromEgg[] = _("{STR_VAR_1} hatched from the EGG!");
const u8 gText_NickHatchPrompt[] = _("Would you like to nickname the newly\nhatched {STR_VAR_1}?");
-
-asm(".align 2");
-const u8 gText_ReadyToBerryCrush[] = _("Are you ready to BERRY-CRUSH?\nPlease pick a BERRY for use.\p");
-
-asm(".align 2");
-const u8 gText_WaitForAllChooseBerry[] = _("Please wait while each member\nchooses a BERRY.");
-
-asm(".align 2");
-const u8 gText_EndedWithXUnitsPowder[] = _("{PAUSE_MUSIC}{PLAY_BGM MUS_FANFA1}You ended up with {STR_VAR_1} units of\nsilky-smooth BERRY POWDER.{RESUME_MUSIC}\pYour total amount of BERRY POWDER\nis {STR_VAR_2}.\p");
-
-asm(".align 2");
-const u8 gText_RecordingGameResults[] = _("Recording your game results in the\nsave file.\lPlease wait.");
-
-asm(".align 2");
-const u8 gText_PlayBerryCrushAgain[] = _("Want to play BERRY CRUSH again?");
-
-asm(".align 2");
-const u8 gText_YouHaveNoBerries[] = _("You have no BERRIES.\nThe game will be canceled.");
-
-asm(".align 2");
-const u8 gText_MemberDroppedOut[] = _("A member dropped out.\nThe game will be canceled.");
-
-asm(".align 2");
-const u8 gText_TimesUpNoGoodPowder[] = _("Time’s up.\pGood BERRY POWDER could not be\nmade…\p");
-
-asm(".align 2");
-const u8 gText_CommunicationStandby2[] = _("Communication standby…");
-
-asm(".align 2");
-const u8 gText_1DotBlueF700[] = _("1. {COLOR BLUE}{SHADOW LIGHT_BLUE}{SPECIAL_F7 0x00}");
-
-asm(".align 2");
-const u8 gText_1DotF700[] = _("1. {SPECIAL_F7 0x00}");
-
-asm(".align 2");
-const u8 gText_SpaceTimes2[] = _(" time(s)");
-
-asm(".align 2");
-const u8 gText_XDotY[] = _("{STR_VAR_1}.{STR_VAR_2}");
-
-asm(".align 2");
-const u8 gText_Var1Berry[] = _("{STR_VAR_1} BERRY");
-
-asm(".align 2");
-const u8 gText_TimeColon[] = _("Time:");
-
-asm(".align 2");
-const u8 gText_PressingSpeed[] = _("Pressing Speed:");
-
-asm(".align 2");
-const u8 gText_Silkiness[] = _("Silkiness:");
-
-asm(".align 2");
-const u8 gText_StrVar1[] = _("{STR_VAR_1}");
-
-asm(".align 2");
-const u8 gText_SpaceMin[] = _(" min. ");
-
-asm(".align 2");
-const u8 gText_XDotY2[] = _("{STR_VAR_1}.{STR_VAR_2}");
-
-asm(".align 2");
-const u8 gText_SpaceSec[] = _(" sec.");
-
-asm(".align 2");
-const u8 gText_XDotY3[] = _("{STR_VAR_1}.{STR_VAR_2}");
-
-asm(".align 2");
-const u8 gText_TimesPerSec[] = _(" Times/sec.");
-
-asm(".align 2");
-const u8 gText_Var1Percent[] = _("{STR_VAR_1}%");
-
-asm(".align 2");
-const u8 gText_PressesRankings[] = _("No. of Presses Rankings");
-
-asm(".align 2");
-const u8 gText_CrushingResults[] = _("Crushing Results");
-
-asm(".align 2");
-const u8 gText_NeatnessRankings[] = _("Neatness Rankings");
-
-asm(".align 2");
-const u8 gText_CoopRankings[] = _("Cooperative Rankings");
-
-asm(".align 2");
-const u8 gText_PressingPowerRankings[] = _("Pressing-Power Rankings");
+ALIGNED(4) const u8 gText_ReadyToBerryCrush[] = _("Are you ready to BERRY-CRUSH?\nPlease pick a BERRY for use.\p");
+ALIGNED(4) const u8 gText_WaitForAllChooseBerry[] = _("Please wait while each member\nchooses a BERRY.");
+ALIGNED(4) const u8 gText_EndedWithXUnitsPowder[] = _("{PAUSE_MUSIC}{PLAY_BGM MUS_FANFA1}You ended up with {STR_VAR_1} units of\nsilky-smooth BERRY POWDER.{RESUME_MUSIC}\pYour total amount of BERRY POWDER\nis {STR_VAR_2}.\p");
+ALIGNED(4) const u8 gText_RecordingGameResults[] = _("Recording your game results in the\nsave file.\lPlease wait.");
+ALIGNED(4) const u8 gText_PlayBerryCrushAgain[] = _("Want to play BERRY CRUSH again?");
+ALIGNED(4) const u8 gText_YouHaveNoBerries[] = _("You have no BERRIES.\nThe game will be canceled.");
+ALIGNED(4) const u8 gText_MemberDroppedOut[] = _("A member dropped out.\nThe game will be canceled.");
+ALIGNED(4) const u8 gText_TimesUpNoGoodPowder[] = _("Time’s up.\pGood BERRY POWDER could not be\nmade…\p");
+ALIGNED(4) const u8 gText_CommunicationStandby2[] = _("Communication standby…");
+ALIGNED(4) const u8 gText_1DotBlueF700[] = _("1. {COLOR BLUE}{SHADOW LIGHT_BLUE}{SPECIAL_F7 0x00}");
+ALIGNED(4) const u8 gText_1DotF700[] = _("1. {SPECIAL_F7 0x00}");
+ALIGNED(4) const u8 gText_SpaceTimes2[] = _(" time(s)");
+ALIGNED(4) const u8 gText_XDotY[] = _("{STR_VAR_1}.{STR_VAR_2}");
+ALIGNED(4) const u8 gText_Var1Berry[] = _("{STR_VAR_1} BERRY");
+ALIGNED(4) const u8 gText_TimeColon[] = _("Time:");
+ALIGNED(4) const u8 gText_PressingSpeed[] = _("Pressing Speed:");
+ALIGNED(4) const u8 gText_Silkiness[] = _("Silkiness:");
+ALIGNED(4) const u8 gText_StrVar1[] = _("{STR_VAR_1}");
+ALIGNED(4) const u8 gText_SpaceMin[] = _(" min. ");
+ALIGNED(4) const u8 gText_XDotY2[] = _("{STR_VAR_1}.{STR_VAR_2}");
+ALIGNED(4) const u8 gText_SpaceSec[] = _(" sec.");
+ALIGNED(4) const u8 gText_XDotY3[] = _("{STR_VAR_1}.{STR_VAR_2}");
+ALIGNED(4) const u8 gText_TimesPerSec[] = _(" Times/sec.");
+ALIGNED(4) const u8 gText_Var1Percent[] = _("{STR_VAR_1}%");
+ALIGNED(4) const u8 gText_PressesRankings[] = _("No. of Presses Rankings");
+ALIGNED(4) const u8 gText_CrushingResults[] = _("Crushing Results");
+ALIGNED(4) const u8 gText_NeatnessRankings[] = _("Neatness Rankings");
+ALIGNED(4) const u8 gText_CoopRankings[] = _("Cooperative Rankings");
+ALIGNED(4) const u8 gText_PressingPowerRankings[] = _("Pressing-Power Rankings");
const u8 gText_BerryCrush2[] = _("BERRY CRUSH");
const u8 gText_PressingSpeedRankings[] = _("Pressing-Speed Rankings");
const u8 gText_Var1Players[] = _("{STR_VAR_1} PLAYERS");
@@ -1546,30 +1448,14 @@ const u8 gText_TimesCleared[] = _("Times cleared:{CLEAR 0x05}{STR_VAR_1}");
const u8 gText_KOsInARow[] = _("KOs in a row: {STR_VAR_1}");
const u8 gText_TimesVar1[] = _("Times: {STR_VAR_1}");
const u8 gText_FloorsCleared[] = _("Floors cleared: {STR_VAR_1}");
-
-asm(".align 2");
-const u8 gUnknown_085EE3B0[] = _("LV. 50");
-
-asm(".align 2");
-const u8 gUnknown_085EE3B8[] = _("OPEN LEVEL");
-
-asm(".align 2");
-const u8 gUnknown_085EE3C4[] = _("Win streak: {STR_VAR_2}");
-
-asm(".align 2");
-const u8 gUnknown_085EE3D4[] = _("Clear streak: {STR_VAR_2}");
-
-asm(".align 2");
-const u8 gUnknown_085EE3E8[] = _("Rooms cleared: {STR_VAR_2}");
-
-asm(".align 2");
-const u8 gUnknown_085EE3FC[] = _("KOs in a row: {STR_VAR_2}");
-
-asm(".align 2");
-const u8 gUnknown_085EE410[] = _("Floors cleared: {STR_VAR_2}");
-
-asm(".align 2");
-const u8 gText_123Dot[][3] = {_("1."), _("2."), _("3.")};
+ALIGNED(4) const u8 gUnknown_085EE3B0[] = _("LV. 50");
+ALIGNED(4) const u8 gUnknown_085EE3B8[] = _("OPEN LEVEL");
+ALIGNED(4) const u8 gUnknown_085EE3C4[] = _("Win streak: {STR_VAR_2}");
+ALIGNED(4) const u8 gUnknown_085EE3D4[] = _("Clear streak: {STR_VAR_2}");
+ALIGNED(4) const u8 gUnknown_085EE3E8[] = _("Rooms cleared: {STR_VAR_2}");
+ALIGNED(4) const u8 gUnknown_085EE3FC[] = _("KOs in a row: {STR_VAR_2}");
+ALIGNED(4) const u8 gUnknown_085EE410[] = _("Floors cleared: {STR_VAR_2}");
+ALIGNED(4) const u8 gText_123Dot[][3] = {_("1."), _("2."), _("3.")};
const u8 gText_SavingDontTurnOff2[] = _("SAVING…\nDON’T TURN OFF THE POWER.");
const u8 gText_BlenderMaxSpeedRecord[] = _("BERRY BLENDER\nMAXIMUM SPEED RECORD!");
const u8 gText_234Players[] = _("2 PLAYERS\n3 PLAYERS\n4 PLAYERS");
@@ -1768,185 +1654,66 @@ const u8 *const gTextTable_Players[] = {
gText_F703Players
};
-asm(".align 2");
-const u8 gText_WonderCards[] = _("WONDER CARDS");
-
-asm(".align 2");
-const u8 gText_WonderNews[] = _("WONDER NEWS");
-
-asm(".align 2");
-const u8 gText_WirelessCommunication[] = _("WIRELESS COMMUNICATION");
-
-asm(".align 2");
-const u8 gText_Friend2[] = _("FRIEND");
-
-asm(".align 2");
-const u8 gText_Exit3[] = _("EXIT");
-
-asm(".align 2");
-const u8 gText_Receive[] = _("RECEIVE");
-
-asm(".align 2");
-const u8 gText_Send[] = _("SEND");
-
-asm(".align 2");
-const u8 gText_Toss[] = _("TOSS");
-
-asm(".align 2");
-const u8 gText_VarietyOfEventsImportedWireless[] = _("A variety of events will be imported\nover Wireless Communication.");
-
-asm(".align 2");
-const u8 gText_WonderCardsInPossession[] = _("Read the WONDER CARDS in your\npossession.");
-
-asm(".align 2");
-const u8 gText_ReadNewsThatArrived[] = _("Read the NEWS that arrived.");
-
-asm(".align 2");
-const u8 gText_ReturnToTitle[] = _("Return to the title screen.");
-
-asm(".align 2");
-const u8 gText_DontHaveCardNewOneInput[] = _("You don’t have a WONDER CARD,\nso a new CARD will be input.");
-
-asm(".align 2");
-const u8 gText_DontHaveNewsNewOneInput[] = _("You don’t have any WONDER NEWS,\nso new NEWS will be input.");
-
-asm(".align 2");
-const u8 gText_WhereShouldCardBeAccessed[] = _("Where should the WONDER CARD\nbe accessed?");
-
-asm(".align 2");
-const u8 gText_WhereShouldNewsBeAccessed[] = _("Where should the WONDER NEWS\nbe accessed?");
-
-asm(".align 2");
-const u8 gUnknown_085EEFC0[] = _("Communication standby…\nB Button: Cancel");
-
-asm(".align 2");
-const u8 gText_Communicating[] = _("Communicating…");
-
-asm(".align 2");
-const u8 gText_CommunicationCompleted[] = _("Communication completed.");
-
-asm(".align 2");
-const u8 gText_CommunicationError[] = _("Communication error.");
-
-asm(".align 2");
-const u8 gText_CommunicationCanceled[] = _("Communication has been canceled.");
-
-asm(".align 2");
-const u8 gText_ThrowAwayWonderCard[] = _("Throw away the WONDER CARD\nand input a new CARD?");
-
-asm(".align 2");
-const u8 gText_HaventReceivedCardsGift[] = _("You haven’t received the CARD’s gift\nyet. Input a new CARD anyway?");
-
-asm(".align 2");
-const u8 gText_WonderCardReceivedFrom[] = _("A WONDER CARD has been received\nfrom {STR_VAR_1}.");
-
-asm(".align 2");
-const u8 gText_WonderNewsReceivedFrom[] = _("A WONDER NEWS item has been\nreceived from {STR_VAR_1}.");
-
-asm(".align 2");
-const u8 gText_WonderCardReceived[] = _("A new WONDER CARD has been\nreceived.");
-
-asm(".align 2");
-const u8 gText_WonderNewsReceived[] = _("A new WONDER NEWS item has been\nreceived.");
-
-asm(".align 2");
-const u8 gText_NewStampReceived[] = _("A new STAMP has been received.");
-
-asm(".align 2");
-const u8 gText_NewTrainerReceived[] = _("A new TRAINER has arrived.");
-
-asm(".align 2");
-const u8 gText_AlreadyHadCard[] = _("You already had that\nWONDER CARD.");
-
-asm(".align 2");
-const u8 gText_AlreadyHadNews[] = _("You already had that\nWONDER NEWS item.");
-
-asm(".align 2");
-const u8 gText_AlreadyHadStamp[] = _("You already had that\nSTAMP.");
-
-asm(".align 2");
-const u8 gText_NoMoreRoomForStamps[] = _("There’s no more room for adding\nSTAMPS.");
-
-asm(".align 2");
-const u8 gText_RecordUploadedViaWireless[] = _("Your record has been uploaded via\nWIRELESS COMMUNICATION.");
-
-asm(".align 2");
-const u8 gText_CantAcceptCardFromTrainer[] = _("You can’t accept a WONDER CARD\nfrom this TRAINER.");
-
-asm(".align 2");
-const u8 gText_CantAcceptNewsFromTrainer[] = _("You can’t accept WONDER NEWS\nfrom this TRAINER.");
-
-asm(".align 2");
-const u8 gText_NothingSentOver[] = _("Nothing was sent over…");
-
-asm(".align 2");
-const u8 gText_WhatToDoWithCards[] = _("What would you like to do\nwith the WONDER CARDS?");
-
-asm(".align 2");
-const u8 gText_WhatToDoWithNews[] = _("What would you like to do\nwith the WONDER NEWS?");
-
-asm(".align 2");
-const u8 gText_SendingWonderCard[] = _("Sending your WONDER CARD…");
-
-asm(".align 2");
-const u8 gText_SendingWonderNews[] = _("Sending your WONDER NEWS item…");
-
-asm(".align 2");
-const u8 gText_WonderCardSentTo[] = _("Your WONDER CARD has been sent\nto {STR_VAR_1}.");
-
-asm(".align 2");
-const u8 gText_WonderNewsSentTo[] = _("Your WONDER NEWS item has been\nsent to {STR_VAR_1}.");
-
-asm(".align 2");
-const u8 gText_StampSentTo[] = _("A STAMP has been sent to {STR_VAR_1}.");
-
-asm(".align 2");
-const u8 gText_GiftSentTo[] = _("A GIFT has been sent to {STR_VAR_1}.");
-
-asm(".align 2");
-const u8 gText_OtherTrainerHasCard[] = _("The other TRAINER has the same\nWONDER CARD already.");
-
-asm(".align 2");
-const u8 gText_OtherTrainerHasNews[] = _("The other TRAINER has the same\nWONDER NEWS already.");
-
-asm(".align 2");
-const u8 gText_OtherTrainerHasStamp[] = _("The other TRAINER has the same\nSTAMP already.");
-
-asm(".align 2");
-const u8 gText_OtherTrainerCanceled[] = _("The other TRAINER canceled\ncommunication.");
-
-asm(".align 2");
-const u8 gText_CantSendGiftToTrainer[] = _("You can’t send a MYSTERY GIFT to\nthis TRAINER.");
-
-asm(".align 2");
-const u8 gText_IfThrowAwayCardEventWontHappen[] = _("If you throw away the CARD,\nits event won’t happen. Okay?");
-
-asm(".align 2");
-const u8 gText_OkayToDiscardNews[] = _("Is it okay to discard this\nNEWS item?");
-
-asm(".align 2");
-const u8 gText_HaventReceivedGiftOkayToDiscard[] = _("You haven’t received the\nGIFT. Is it okay to discard?");
-
-asm(".align 2");
-const u8 gText_DataWillBeSaved[] = _("Data will be saved.\nPlease wait.");
-
-asm(".align 2");
-const u8 gText_SaveCompletedPressA[] = _("Save completed.\nPlease press the A Button.");
-
-asm(".align 2");
-const u8 gText_WonderCardThrownAway[] = _("The WONDER CARD was thrown away.");
-
-asm(".align 2");
-const u8 gText_WonderNewsThrownAway[] = _("The WONDER NEWS was thrown away.");
-
-asm(".align 2");
-const u8 gText_MysteryGift[] = _("MYSTERY GIFT");
-
-asm(".align 2");
-const u8 gText_PickOKExit[] = _("{DPAD_UPDOWN}PICK {A_BUTTON}OK {B_BUTTON}EXIT");
-
-asm(".align 2");
-const u8 gText_PickOKCancel[] = _("{DPAD_UPDOWN}PICK {A_BUTTON}OK {B_BUTTON}CANCEL");
+ALIGNED(4) const u8 gText_WonderCards[] = _("WONDER CARDS");
+ALIGNED(4) const u8 gText_WonderNews[] = _("WONDER NEWS");
+ALIGNED(4) const u8 gText_WirelessCommunication[] = _("WIRELESS COMMUNICATION");
+ALIGNED(4) const u8 gText_Friend2[] = _("FRIEND");
+ALIGNED(4) const u8 gText_Exit3[] = _("EXIT");
+ALIGNED(4) const u8 gText_Receive[] = _("RECEIVE");
+ALIGNED(4) const u8 gText_Send[] = _("SEND");
+ALIGNED(4) const u8 gText_Toss[] = _("TOSS");
+ALIGNED(4) const u8 gText_VarietyOfEventsImportedWireless[] = _("A variety of events will be imported\nover Wireless Communication.");
+ALIGNED(4) const u8 gText_WonderCardsInPossession[] = _("Read the WONDER CARDS in your\npossession.");
+ALIGNED(4) const u8 gText_ReadNewsThatArrived[] = _("Read the NEWS that arrived.");
+ALIGNED(4) const u8 gText_ReturnToTitle[] = _("Return to the title screen.");
+ALIGNED(4) const u8 gText_DontHaveCardNewOneInput[] = _("You don’t have a WONDER CARD,\nso a new CARD will be input.");
+ALIGNED(4) const u8 gText_DontHaveNewsNewOneInput[] = _("You don’t have any WONDER NEWS,\nso new NEWS will be input.");
+ALIGNED(4) const u8 gText_WhereShouldCardBeAccessed[] = _("Where should the WONDER CARD\nbe accessed?");
+ALIGNED(4) const u8 gText_WhereShouldNewsBeAccessed[] = _("Where should the WONDER NEWS\nbe accessed?");
+ALIGNED(4) const u8 gUnknown_085EEFC0[] = _("Communication standby…\nB Button: Cancel");
+ALIGNED(4) const u8 gText_Communicating[] = _("Communicating…");
+ALIGNED(4) const u8 gText_CommunicationCompleted[] = _("Communication completed.");
+ALIGNED(4) const u8 gText_CommunicationError[] = _("Communication error.");
+ALIGNED(4) const u8 gText_CommunicationCanceled[] = _("Communication has been canceled.");
+ALIGNED(4) const u8 gText_ThrowAwayWonderCard[] = _("Throw away the WONDER CARD\nand input a new CARD?");
+ALIGNED(4) const u8 gText_HaventReceivedCardsGift[] = _("You haven’t received the CARD’s gift\nyet. Input a new CARD anyway?");
+ALIGNED(4) const u8 gText_WonderCardReceivedFrom[] = _("A WONDER CARD has been received\nfrom {STR_VAR_1}.");
+ALIGNED(4) const u8 gText_WonderNewsReceivedFrom[] = _("A WONDER NEWS item has been\nreceived from {STR_VAR_1}.");
+ALIGNED(4) const u8 gText_WonderCardReceived[] = _("A new WONDER CARD has been\nreceived.");
+ALIGNED(4) const u8 gText_WonderNewsReceived[] = _("A new WONDER NEWS item has been\nreceived.");
+ALIGNED(4) const u8 gText_NewStampReceived[] = _("A new STAMP has been received.");
+ALIGNED(4) const u8 gText_NewTrainerReceived[] = _("A new TRAINER has arrived.");
+ALIGNED(4) const u8 gText_AlreadyHadCard[] = _("You already had that\nWONDER CARD.");
+ALIGNED(4) const u8 gText_AlreadyHadNews[] = _("You already had that\nWONDER NEWS item.");
+ALIGNED(4) const u8 gText_AlreadyHadStamp[] = _("You already had that\nSTAMP.");
+ALIGNED(4) const u8 gText_NoMoreRoomForStamps[] = _("There’s no more room for adding\nSTAMPS.");
+ALIGNED(4) const u8 gText_RecordUploadedViaWireless[] = _("Your record has been uploaded via\nWIRELESS COMMUNICATION.");
+ALIGNED(4) const u8 gText_CantAcceptCardFromTrainer[] = _("You can’t accept a WONDER CARD\nfrom this TRAINER.");
+ALIGNED(4) const u8 gText_CantAcceptNewsFromTrainer[] = _("You can’t accept WONDER NEWS\nfrom this TRAINER.");
+ALIGNED(4) const u8 gText_NothingSentOver[] = _("Nothing was sent over…");
+ALIGNED(4) const u8 gText_WhatToDoWithCards[] = _("What would you like to do\nwith the WONDER CARDS?");
+ALIGNED(4) const u8 gText_WhatToDoWithNews[] = _("What would you like to do\nwith the WONDER NEWS?");
+ALIGNED(4) const u8 gText_SendingWonderCard[] = _("Sending your WONDER CARD…");
+ALIGNED(4) const u8 gText_SendingWonderNews[] = _("Sending your WONDER NEWS item…");
+ALIGNED(4) const u8 gText_WonderCardSentTo[] = _("Your WONDER CARD has been sent\nto {STR_VAR_1}.");
+ALIGNED(4) const u8 gText_WonderNewsSentTo[] = _("Your WONDER NEWS item has been\nsent to {STR_VAR_1}.");
+ALIGNED(4) const u8 gText_StampSentTo[] = _("A STAMP has been sent to {STR_VAR_1}.");
+ALIGNED(4) const u8 gText_GiftSentTo[] = _("A GIFT has been sent to {STR_VAR_1}.");
+ALIGNED(4) const u8 gText_OtherTrainerHasCard[] = _("The other TRAINER has the same\nWONDER CARD already.");
+ALIGNED(4) const u8 gText_OtherTrainerHasNews[] = _("The other TRAINER has the same\nWONDER NEWS already.");
+ALIGNED(4) const u8 gText_OtherTrainerHasStamp[] = _("The other TRAINER has the same\nSTAMP already.");
+ALIGNED(4) const u8 gText_OtherTrainerCanceled[] = _("The other TRAINER canceled\ncommunication.");
+ALIGNED(4) const u8 gText_CantSendGiftToTrainer[] = _("You can’t send a MYSTERY GIFT to\nthis TRAINER.");
+ALIGNED(4) const u8 gText_IfThrowAwayCardEventWontHappen[] = _("If you throw away the CARD,\nits event won’t happen. Okay?");
+ALIGNED(4) const u8 gText_OkayToDiscardNews[] = _("Is it okay to discard this\nNEWS item?");
+ALIGNED(4) const u8 gText_HaventReceivedGiftOkayToDiscard[] = _("You haven’t received the\nGIFT. Is it okay to discard?");
+ALIGNED(4) const u8 gText_DataWillBeSaved[] = _("Data will be saved.\nPlease wait.");
+ALIGNED(4) const u8 gText_SaveCompletedPressA[] = _("Save completed.\nPlease press the A Button.");
+ALIGNED(4) const u8 gText_WonderCardThrownAway[] = _("The WONDER CARD was thrown away.");
+ALIGNED(4) const u8 gText_WonderNewsThrownAway[] = _("The WONDER NEWS was thrown away.");
+ALIGNED(4) const u8 gText_MysteryGift[] = _("MYSTERY GIFT");
+ALIGNED(4) const u8 gText_PickOKExit[] = _("{DPAD_UPDOWN}PICK {A_BUTTON}OK {B_BUTTON}EXIT");
+ALIGNED(4) const u8 gText_PickOKCancel[] = _("{DPAD_UPDOWN}PICK {A_BUTTON}OK {B_BUTTON}CANCEL");
const u8 gText_PlayersBattleResults[] = _("{PLAYER}’s BATTLE RESULTS");
const u8 gText_TotalRecordWLD[] = _("TOTAL RECORD W:{STR_VAR_1} L:{STR_VAR_2} D:{STR_VAR_3}");
const u8 gText_WinLoseDraw[] = _("{CLEAR_TO 0x53}WIN{CLEAR_TO 0x80}LOSE{CLEAR_TO 0xB0}DRAW");
diff --git a/src/text.c b/src/text.c
index b134bcacd..ecd3a3095 100644
--- a/src/text.c
+++ b/src/text.c
@@ -29,7 +29,8 @@ u8 gUnknown_03002F84;
struct Struct_03002F90 gUnknown_03002F90;
TextFlags gTextFlags;
-const u8 gFontHalfRowOffsets[] = {
+const u8 gFontHalfRowOffsets[] =
+{
0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x03, 0x06, 0x07, 0x08, 0x06, 0x00, 0x01, 0x02, 0x00,
0x09, 0x0A, 0x0B, 0x09, 0x0C, 0x0D, 0x0E, 0x0C, 0x0F, 0x10, 0x11, 0x0F, 0x09, 0x0A, 0x0B, 0x09,
0x12, 0x13, 0x14, 0x12, 0x15, 0x16, 0x17, 0x15, 0x18, 0x19, 0x1A, 0x18, 0x12, 0x13, 0x14, 0x12,
@@ -55,7 +56,8 @@ const u8 gUnusedFRLGDownArrow[] = INCBIN_U8("data/graphics/fonts/unused_frlg_dow
const u8 gDownArrowYCoords[] = { 0x0, 0x1, 0x2, 0x1 };
const u8 gWindowVerticalScrollSpeeds[] = { 0x1, 0x2, 0x4, 0x0 };
-const struct GlyphWidthFunc gGlyphWidthFuncs[] = {
+const struct GlyphWidthFunc gGlyphWidthFuncs[] =
+{
{ 0x0, GetGlyphWidthFont0 },
{ 0x1, GetGlyphWidthFont1 },
{ 0x2, GetGlyphWidthFont2 },
@@ -67,7 +69,8 @@ const struct GlyphWidthFunc gGlyphWidthFuncs[] = {
{ 0x8, GetGlyphWidthFont8 }
};
-const struct KeypadIcon gKeypadIcons[] = {
+const struct KeypadIcon gKeypadIcons[] =
+{
{ 0x0, 0x8, 0xC },
{ 0x1, 0x8, 0xC },
{ 0x2, 0x10, 0xC },
@@ -85,7 +88,8 @@ const struct KeypadIcon gKeypadIcons[] = {
const u8 gKeypadIconTiles[] = INCBIN_U8("data/graphics/fonts/keypad_icons.4bpp");
-const struct FontInfo gFontInfos[] = {
+const struct FontInfo gFontInfos[] =
+{
{ Font0Func, 0x5, 0xC, 0x0, 0x0, 0x0, 0x2, 0x1, 0x3 },
{ Font1Func, 0x6, 0x10, 0x0, 0x0, 0x0, 0x2, 0x1, 0x3 },
{ Font2Func, 0x6, 0xE, 0x0, 0x0, 0x0, 0x2, 0x1, 0x3 },
@@ -98,7 +102,8 @@ const struct FontInfo gFontInfos[] = {
{ NULL, 0x8, 0x8, 0x0, 0x0, 0x0, 0x1, 0x2, 0xF }
};
-const u8 gMenuCursorDimensions[][2] = {
+const u8 gMenuCursorDimensions[][2] =
+{
{ 0x8, 0xC },
{ 0x8, 0xF },
{ 0x8, 0xE },
@@ -211,25 +216,25 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, voi
void RunTextPrinters(void)
{
int i;
- u16 temp;
if (gUnknown_03002F84 == 0)
{
for (i = 0; i < 0x20; ++i)
{
- if (gTextPrinters[i].active != 0)
+ if (gTextPrinters[i].active)
{
- temp = RenderFont(&gTextPrinters[i]);
- switch (temp) {
- case 0:
- CopyWindowToVram(gTextPrinters[i].printerTemplate.windowId, 2);
- case 3:
- if (gTextPrinters[i].callback != 0)
- gTextPrinters[i].callback(&gTextPrinters[i].printerTemplate, temp);
- break;
- case 1:
- gTextPrinters[i].active = 0;
- break;
+ u16 temp = RenderFont(&gTextPrinters[i]);
+ switch (temp)
+ {
+ case 0:
+ CopyWindowToVram(gTextPrinters[i].printerTemplate.windowId, 2);
+ case 3:
+ if (gTextPrinters[i].callback != 0)
+ gTextPrinters[i].callback(&gTextPrinters[i].printerTemplate, temp);
+ break;
+ case 1:
+ gTextPrinters[i].active = 0;
+ break;
}
}
}
@@ -252,584 +257,156 @@ u32 RenderFont(struct TextPrinter *textPrinter)
}
}
-#ifdef NONMATCHING
void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor)
{
- u16* current = gFontHalfRowLookupTable;
+ u32 fg12, bg12, shadow12;
+ u32 temp;
+
+ u16 *current = gFontHalfRowLookupTable;
gLastTextBgColor = bgColor;
gLastTextFgColor = fgColor;
gLastTextShadowColor = shadowColor;
- *(current++) = (bgColor << 12) | (bgColor << 8) | (bgColor << 4) | bgColor;
- *(current++) = (fgColor << 12) | (bgColor << 8) | (bgColor << 4) | bgColor;
- *(current++) = (shadowColor << 12) | (bgColor << 8) | (bgColor << 4) | bgColor;
-
- *(current++) = (bgColor << 12) | (fgColor << 8) | (bgColor << 4) | bgColor;
- *(current++) = (fgColor << 12) | (fgColor << 8) | (bgColor << 4) | bgColor;
- *(current++) = (shadowColor << 12) | (fgColor << 8) | (bgColor << 4) | bgColor;
-
- *(current++) = (bgColor << 12) | (shadowColor << 8) | (bgColor << 4) | bgColor;
- *(current++) = (fgColor << 12) | (shadowColor << 8) | (bgColor << 4) | bgColor;
- *(current++) = (shadowColor << 12) | (shadowColor << 8) | (bgColor << 4) | bgColor;
-
- *(current++) = (bgColor << 12) | (bgColor << 8) | (fgColor << 4) | bgColor;
- *(current++) = (fgColor << 12) | (bgColor << 8) | (fgColor << 4) | bgColor;
- *(current++) = (shadowColor << 12) | (bgColor << 8) | (fgColor << 4) | bgColor;
-
- *(current++) = (bgColor << 12) | (fgColor << 8) | (fgColor << 4) | bgColor;
- *(current++) = (fgColor << 12) | (fgColor << 8) | (fgColor << 4) | bgColor;
- *(current++) = (shadowColor << 12) | (fgColor << 8) | (fgColor << 4) | bgColor;
-
- *(current++) = (bgColor << 12) | (shadowColor << 8) | (fgColor << 4) | bgColor;
- *(current++) = (fgColor << 12) | (shadowColor << 8) | (fgColor << 4) | bgColor;
- *(current++) = (shadowColor << 12) | (shadowColor << 8) | (fgColor << 4) | bgColor;
-
- *(current++) = (bgColor << 12) | (bgColor << 8) | (shadowColor << 4) | bgColor;
- *(current++) = (fgColor << 12) | (bgColor << 8) | (shadowColor << 4) | bgColor;
- *(current++) = (shadowColor << 12) | (bgColor << 8) | (shadowColor << 4) | bgColor;
-
- *(current++) = (bgColor << 12) | (fgColor << 8) | (shadowColor << 4) | bgColor;
- *(current++) = (fgColor << 12) | (fgColor << 8) | (shadowColor << 4) | bgColor;
- *(current++) = (shadowColor << 12) | (fgColor << 8) | (shadowColor << 4) | bgColor;
-
- *(current++) = (bgColor << 12) | (shadowColor << 8) | (shadowColor << 4) | bgColor;
- *(current++) = (fgColor << 12) | (shadowColor << 8) | (shadowColor << 4) | bgColor;
- *(current++) = (shadowColor << 12) | (shadowColor << 8) | (shadowColor << 4) | bgColor;
-
- *(current++) = (bgColor << 12) | (bgColor << 8) | (bgColor << 4) | fgColor;
- *(current++) = (fgColor << 12) | (bgColor << 8) | (bgColor << 4) | fgColor;
- *(current++) = (shadowColor << 12) | (bgColor << 8) | (bgColor << 4) | fgColor;
-
- *(current++) = (bgColor << 12) | (fgColor << 8) | (bgColor << 4) | fgColor;
- *(current++) = (fgColor << 12) | (fgColor << 8) | (bgColor << 4) | fgColor;
- *(current++) = (shadowColor << 12) | (fgColor << 8) | (bgColor << 4) | fgColor;
-
- *(current++) = (bgColor << 12) | (shadowColor << 8) | (bgColor << 4) | fgColor;
- *(current++) = (fgColor << 12) | (shadowColor << 8) | (bgColor << 4) | fgColor;
- *(current++) = (shadowColor << 12) | (shadowColor << 8) | (bgColor << 4) | fgColor;
-
- *(current++) = (bgColor << 12) | (bgColor << 8) | (fgColor << 4) | fgColor;
- *(current++) = (fgColor << 12) | (bgColor << 8) | (fgColor << 4) | fgColor;
- *(current++) = (shadowColor << 12) | (bgColor << 8) | (fgColor << 4) | fgColor;
-
- *(current++) = (bgColor << 12) | (fgColor << 8) | (fgColor << 4) | fgColor;
- *(current++) = (fgColor << 12) | (fgColor << 8) | (fgColor << 4) | fgColor;
- *(current++) = (shadowColor << 12) | (fgColor << 8) | (fgColor << 4) | fgColor;
-
- *(current++) = (bgColor << 12) | (shadowColor << 8) | (fgColor << 4) | fgColor;
- *(current++) = (fgColor << 12) | (shadowColor << 8) | (fgColor << 4) | fgColor;
- *(current++) = (shadowColor << 12) | (shadowColor << 8) | (fgColor << 4) | fgColor;
-
- *(current++) = (bgColor << 12) | (bgColor << 8) | (shadowColor << 4) | fgColor;
- *(current++) = (fgColor << 12) | (bgColor << 8) | (shadowColor << 4) | fgColor;
- *(current++) = (shadowColor << 12) | (bgColor << 8) | (shadowColor << 4) | fgColor;
-
- *(current++) = (bgColor << 12) | (fgColor << 8) | (shadowColor << 4) | fgColor;
- *(current++) = (fgColor << 12) | (fgColor << 8) | (shadowColor << 4) | fgColor;
- *(current++) = (shadowColor << 12) | (fgColor << 8) | (shadowColor << 4) | fgColor;
-
- *(current++) = (bgColor << 12) | (shadowColor << 8) | (shadowColor << 4) | fgColor;
- *(current++) = (fgColor << 12) | (shadowColor << 8) | (shadowColor << 4) | fgColor;
- *(current++) = (shadowColor << 12) | (shadowColor << 8) | (shadowColor << 4) | fgColor;
-
- *(current++) = (bgColor << 12) | (bgColor << 8) | (bgColor << 4) | shadowColor;
- *(current++) = (fgColor << 12) | (bgColor << 8) | (bgColor << 4) | shadowColor;
- *(current++) = (shadowColor << 12) | (bgColor << 8) | (bgColor << 4) | shadowColor;
-
- *(current++) = (bgColor << 12) | (fgColor << 8) | (bgColor << 4) | shadowColor;
- *(current++) = (fgColor << 12) | (fgColor << 8) | (bgColor << 4) | shadowColor;
- *(current++) = (shadowColor << 12) | (fgColor << 8) | (bgColor << 4) | shadowColor;
-
- *(current++) = (bgColor << 12) | (shadowColor << 8) | (bgColor << 4) | shadowColor;
- *(current++) = (fgColor << 12) | (shadowColor << 8) | (bgColor << 4) | shadowColor;
- *(current++) = (shadowColor << 12) | (shadowColor << 8) | (bgColor << 4) | shadowColor;
-
- *(current++) = (bgColor << 12) | (bgColor << 8) | (fgColor << 4) | shadowColor;
- *(current++) = (fgColor << 12) | (bgColor << 8) | (fgColor << 4) | shadowColor;
- *(current++) = (shadowColor << 12) | (bgColor << 8) | (fgColor << 4) | shadowColor;
-
- *(current++) = (bgColor << 12) | (fgColor << 8) | (fgColor << 4) | shadowColor;
- *(current++) = (fgColor << 12) | (fgColor << 8) | (fgColor << 4) | shadowColor;
- *(current++) = (shadowColor << 12) | (fgColor << 8) | (fgColor << 4) | shadowColor;
-
- *(current++) = (bgColor << 12) | (shadowColor << 8) | (fgColor << 4) | shadowColor;
- *(current++) = (fgColor << 12) | (shadowColor << 8) | (fgColor << 4) | shadowColor;
- *(current++) = (shadowColor << 12) | (shadowColor << 8) | (fgColor << 4) | shadowColor;
-
- *(current++) = (bgColor << 12) | (bgColor << 8) | (shadowColor << 4) | shadowColor;
- *(current++) = (fgColor << 12) | (bgColor << 8) | (shadowColor << 4) | shadowColor;
- *(current++) = (shadowColor << 12) | (bgColor << 8) | (shadowColor << 4) | shadowColor;
-
- *(current++) = (bgColor << 12) | (fgColor << 8) | (shadowColor << 4) | shadowColor;
- *(current++) = (fgColor << 12) | (fgColor << 8) | (shadowColor << 4) | shadowColor;
- *(current++) = (shadowColor << 12) | (fgColor << 8) | (shadowColor << 4) | shadowColor;
-
- *(current++) = (bgColor << 12) | (shadowColor << 8) | (shadowColor << 4) | shadowColor;
- *(current++) = (fgColor << 12) | (shadowColor << 8) | (shadowColor << 4) | shadowColor;
- *(current++) = (shadowColor << 12) | (shadowColor << 8) | (shadowColor << 4) | shadowColor;
-}
-#else
-NAKED
-void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor)
-{
- asm("push {r4-r7,lr}\n\
- mov r7, r10\n\
- mov r6, r9\n\
- mov r5, r8\n\
- push {r5-r7}\n\
- sub sp, #0x24\n\
- lsl r0, #24\n\
- lsr r0, #24\n\
- lsl r1, #24\n\
- lsr r1, #24\n\
- lsl r2, #24\n\
- lsr r2, #24\n\
- ldr r3, =gFontHalfRowLookupTable\n\
- ldr r4, =gLastTextBgColor\n\
- strh r1, [r4]\n\
- ldr r4, =gLastTextFgColor\n\
- strh r0, [r4]\n\
- ldr r4, =gLastTextShadowColor\n\
- strh r2, [r4]\n\
- lsl r5, r1, #12\n\
- lsl r6, r0, #12\n\
- lsl r4, r2, #12\n\
- mov r8, r4\n\
- lsl r7, r1, #8\n\
- str r7, [sp]\n\
- lsl r4, r1, #4\n\
- mov r9, r4\n\
- orr r7, r4\n\
- str r7, [sp, #0x4]\n\
- orr r7, r1\n\
- add r4, r5, #0\n\
- orr r4, r7\n\
- strh r4, [r3]\n\
- add r3, #0x2\n\
- add r4, r6, #0\n\
- orr r4, r7\n\
- strh r4, [r3]\n\
- add r3, #0x2\n\
- mov r4, r8\n\
- orr r7, r4\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- lsl r7, r0, #8\n\
- mov r10, r7\n\
- mov r4, r10\n\
- mov r7, r9\n\
- orr r4, r7\n\
- str r4, [sp, #0x8]\n\
- add r7, r4, #0\n\
- orr r7, r1\n\
- add r4, r5, #0\n\
- orr r4, r7\n\
- strh r4, [r3]\n\
- add r3, #0x2\n\
- add r4, r6, #0\n\
- orr r4, r7\n\
- strh r4, [r3]\n\
- add r3, #0x2\n\
- mov r4, r8\n\
- orr r7, r4\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- lsl r7, r2, #8\n\
- mov r12, r7\n\
- mov r4, r12\n\
- mov r7, r9\n\
- orr r4, r7\n\
- str r4, [sp, #0xC]\n\
- add r7, r4, #0\n\
- orr r7, r1\n\
- add r4, r5, #0\n\
- orr r4, r7\n\
- strh r4, [r3]\n\
- add r3, #0x2\n\
- add r4, r6, #0\n\
- orr r4, r7\n\
- strh r4, [r3]\n\
- add r3, #0x2\n\
- mov r4, r8\n\
- orr r7, r4\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- lsl r7, r0, #4\n\
- mov r9, r7\n\
- ldr r4, [sp]\n\
- orr r4, r7\n\
- str r4, [sp, #0x10]\n\
- add r7, r4, #0\n\
- orr r7, r1\n\
- add r4, r5, #0\n\
- orr r4, r7\n\
- strh r4, [r3]\n\
- add r3, #0x2\n\
- add r4, r6, #0\n\
- orr r4, r7\n\
- strh r4, [r3]\n\
- add r3, #0x2\n\
- mov r4, r8\n\
- orr r7, r4\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- mov r7, r10\n\
- add r4, r7, #0\n\
- mov r7, r9\n\
- orr r4, r7\n\
- str r4, [sp, #0x14]\n\
- add r7, r4, #0\n\
- orr r7, r1\n\
- add r4, r5, #0\n\
- orr r4, r7\n\
- strh r4, [r3]\n\
- add r3, #0x2\n\
- add r4, r6, #0\n\
- orr r4, r7\n\
- strh r4, [r3]\n\
- add r3, #0x2\n\
- mov r4, r8\n\
- orr r7, r4\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- mov r7, r12\n\
- add r4, r7, #0\n\
- mov r7, r9\n\
- orr r4, r7\n\
- str r4, [sp, #0x18]\n\
- add r7, r4, #0\n\
- orr r7, r1\n\
- add r4, r5, #0\n\
- orr r4, r7\n\
- strh r4, [r3]\n\
- add r3, #0x2\n\
- add r4, r6, #0\n\
- orr r4, r7\n\
- strh r4, [r3]\n\
- add r3, #0x2\n\
- mov r4, r8\n\
- orr r7, r4\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- lsl r7, r2, #4\n\
- mov r9, r7\n\
- mov r4, r9\n\
- ldr r7, [sp]\n\
- orr r7, r4\n\
- str r7, [sp, #0x1C]\n\
- orr r7, r1\n\
- add r4, r5, #0\n\
- orr r4, r7\n\
- strh r4, [r3]\n\
- add r3, #0x2\n\
- add r4, r6, #0\n\
- orr r4, r7\n\
- strh r4, [r3]\n\
- add r3, #0x2\n\
- mov r4, r8\n\
- orr r7, r4\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- mov r7, r9\n\
- mov r4, r10\n\
- orr r4, r7\n\
- str r4, [sp, #0x20]\n\
- add r7, r4, #0\n\
- orr r7, r1\n\
- add r4, r5, #0\n\
- orr r4, r7\n\
- strh r4, [r3]\n\
- add r3, #0x2\n\
- add r4, r6, #0\n\
- orr r4, r7\n\
- strh r4, [r3]\n\
- add r3, #0x2\n\
- mov r4, r8\n\
- orr r7, r4\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- mov r4, r12\n\
- mov r7, r9\n\
- orr r4, r7\n\
- add r7, r4, #0\n\
- orr r7, r1\n\
- add r1, r5, #0\n\
- orr r1, r7\n\
- strh r1, [r3]\n\
- add r3, #0x2\n\
- add r1, r6, #0\n\
- orr r1, r7\n\
- strh r1, [r3]\n\
- add r3, #0x2\n\
- mov r1, r8\n\
- orr r7, r1\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- ldr r7, [sp, #0x4]\n\
- orr r7, r0\n\
- add r1, r5, #0\n\
- orr r1, r7\n\
- strh r1, [r3]\n\
- add r3, #0x2\n\
- add r1, r6, #0\n\
- orr r1, r7\n\
- strh r1, [r3]\n\
- add r3, #0x2\n\
- mov r1, r8\n\
- orr r7, r1\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- ldr r7, [sp, #0x8]\n\
- orr r7, r0\n\
- add r1, r5, #0\n\
- orr r1, r7\n\
- strh r1, [r3]\n\
- add r3, #0x2\n\
- add r1, r6, #0\n\
- orr r1, r7\n\
- strh r1, [r3]\n\
- add r3, #0x2\n\
- mov r1, r8\n\
- orr r7, r1\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- ldr r7, [sp, #0xC]\n\
- orr r7, r0\n\
- add r1, r5, #0\n\
- orr r1, r7\n\
- strh r1, [r3]\n\
- add r3, #0x2\n\
- add r1, r6, #0\n\
- orr r1, r7\n\
- strh r1, [r3]\n\
- add r3, #0x2\n\
- mov r1, r8\n\
- orr r7, r1\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- ldr r7, [sp, #0x10]\n\
- orr r7, r0\n\
- add r1, r5, #0\n\
- orr r1, r7\n\
- strh r1, [r3]\n\
- add r3, #0x2\n\
- add r1, r6, #0\n\
- orr r1, r7\n\
- strh r1, [r3]\n\
- add r3, #0x2\n\
- mov r1, r8\n\
- orr r7, r1\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- ldr r7, [sp, #0x14]\n\
- orr r7, r0\n\
- add r1, r5, #0\n\
- orr r1, r7\n\
- strh r1, [r3]\n\
- add r3, #0x2\n\
- add r1, r6, #0\n\
- orr r1, r7\n\
- strh r1, [r3]\n\
- add r3, #0x2\n\
- mov r1, r8\n\
- orr r7, r1\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- ldr r7, [sp, #0x18]\n\
- orr r7, r0\n\
- add r1, r5, #0\n\
- orr r1, r7\n\
- strh r1, [r3]\n\
- add r3, #0x2\n\
- add r1, r6, #0\n\
- orr r1, r7\n\
- strh r1, [r3]\n\
- add r3, #0x2\n\
- mov r1, r8\n\
- orr r7, r1\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- ldr r7, [sp, #0x1C]\n\
- orr r7, r0\n\
- add r1, r5, #0\n\
- orr r1, r7\n\
- strh r1, [r3]\n\
- add r3, #0x2\n\
- add r1, r6, #0\n\
- orr r1, r7\n\
- strh r1, [r3]\n\
- add r3, #0x2\n\
- mov r1, r8\n\
- orr r7, r1\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- ldr r7, [sp, #0x20]\n\
- orr r7, r0\n\
- add r1, r5, #0\n\
- orr r1, r7\n\
- strh r1, [r3]\n\
- add r3, #0x2\n\
- add r1, r6, #0\n\
- orr r1, r7\n\
- strh r1, [r3]\n\
- add r3, #0x2\n\
- mov r1, r8\n\
- orr r7, r1\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- add r7, r4, #0\n\
- orr r7, r0\n\
- add r0, r5, #0\n\
- orr r0, r7\n\
- strh r0, [r3]\n\
- add r3, #0x2\n\
- add r0, r6, #0\n\
- orr r0, r7\n\
- strh r0, [r3]\n\
- add r3, #0x2\n\
- orr r7, r1\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- add r7, r2, #0\n\
- ldr r0, [sp, #0x4]\n\
- orr r7, r0\n\
- add r0, r5, #0\n\
- orr r0, r7\n\
- strh r0, [r3]\n\
- add r3, #0x2\n\
- add r0, r6, #0\n\
- orr r0, r7\n\
- strh r0, [r3]\n\
- add r3, #0x2\n\
- orr r7, r1\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- add r7, r2, #0\n\
- ldr r1, [sp, #0x8]\n\
- orr r7, r1\n\
- add r0, r5, #0\n\
- orr r0, r7\n\
- strh r0, [r3]\n\
- add r3, #0x2\n\
- add r0, r6, #0\n\
- orr r0, r7\n\
- strh r0, [r3]\n\
- add r3, #0x2\n\
- mov r0, r8\n\
- orr r7, r0\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- add r7, r2, #0\n\
- ldr r1, [sp, #0xC]\n\
- orr r7, r1\n\
- add r0, r5, #0\n\
- orr r0, r7\n\
- strh r0, [r3]\n\
- add r3, #0x2\n\
- add r0, r6, #0\n\
- orr r0, r7\n\
- strh r0, [r3]\n\
- add r3, #0x2\n\
- mov r0, r8\n\
- orr r7, r0\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- add r7, r2, #0\n\
- ldr r1, [sp, #0x10]\n\
- orr r7, r1\n\
- add r0, r5, #0\n\
- orr r0, r7\n\
- strh r0, [r3]\n\
- add r3, #0x2\n\
- add r0, r6, #0\n\
- orr r0, r7\n\
- strh r0, [r3]\n\
- add r3, #0x2\n\
- mov r0, r8\n\
- orr r7, r0\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- add r7, r2, #0\n\
- ldr r1, [sp, #0x14]\n\
- orr r7, r1\n\
- add r0, r5, #0\n\
- orr r0, r7\n\
- strh r0, [r3]\n\
- add r3, #0x2\n\
- add r0, r6, #0\n\
- orr r0, r7\n\
- strh r0, [r3]\n\
- add r3, #0x2\n\
- mov r0, r8\n\
- orr r7, r0\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- add r7, r2, #0\n\
- ldr r1, [sp, #0x18]\n\
- orr r7, r1\n\
- add r0, r5, #0\n\
- orr r0, r7\n\
- strh r0, [r3]\n\
- add r3, #0x2\n\
- add r0, r6, #0\n\
- orr r0, r7\n\
- strh r0, [r3]\n\
- add r3, #0x2\n\
- mov r0, r8\n\
- orr r7, r0\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- add r7, r2, #0\n\
- ldr r1, [sp, #0x1C]\n\
- orr r7, r1\n\
- add r0, r5, #0\n\
- orr r0, r7\n\
- strh r0, [r3]\n\
- add r3, #0x2\n\
- add r0, r6, #0\n\
- orr r0, r7\n\
- strh r0, [r3]\n\
- add r3, #0x2\n\
- mov r0, r8\n\
- orr r7, r0\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- add r7, r2, #0\n\
- ldr r1, [sp, #0x20]\n\
- orr r7, r1\n\
- add r0, r5, #0\n\
- orr r0, r7\n\
- strh r0, [r3]\n\
- add r3, #0x2\n\
- add r0, r6, #0\n\
- orr r0, r7\n\
- strh r0, [r3]\n\
- add r3, #0x2\n\
- mov r0, r8\n\
- orr r7, r0\n\
- strh r7, [r3]\n\
- add r3, #0x2\n\
- add r7, r2, #0\n\
- orr r7, r4\n\
- orr r5, r7\n\
- strh r5, [r3]\n\
- add r3, #0x2\n\
- orr r6, r7\n\
- strh r6, [r3]\n\
- orr r0, r7\n\
- strh r0, [r3, #0x2]\n\
- add sp, #0x24\n\
- pop {r3-r5}\n\
- mov r8, r3\n\
- mov r9, r4\n\
- mov r10, r5\n\
- pop {r4-r7}\n\
- pop {r0}\n\
- bx r0\n\
- .pool");
+ bg12 = bgColor << 12;
+ fg12 = fgColor << 12;
+ shadow12 = shadowColor << 12;
+
+ temp = (bgColor << 8) | (bgColor << 4) | bgColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (fgColor << 8) | (bgColor << 4) | bgColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (shadowColor << 8) | (bgColor << 4) | bgColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (bgColor << 8) | (fgColor << 4) | bgColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (fgColor << 8) | (fgColor << 4) | bgColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (shadowColor << 8) | (fgColor << 4) | bgColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (bgColor << 8) | (shadowColor << 4) | bgColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (fgColor << 8) | (shadowColor << 4) | bgColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (shadowColor << 8) | (shadowColor << 4) | bgColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (bgColor << 8) | (bgColor << 4) | fgColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (fgColor << 8) | (bgColor << 4) | fgColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (shadowColor << 8) | (bgColor << 4) | fgColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (bgColor << 8) | (fgColor << 4) | fgColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (fgColor << 8) | (fgColor << 4) | fgColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (shadowColor << 8) | (fgColor << 4) | fgColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (bgColor << 8) | (shadowColor << 4) | fgColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (fgColor << 8) | (shadowColor << 4) | fgColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (shadowColor << 8) | (shadowColor << 4) | fgColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (bgColor << 8) | (bgColor << 4) | shadowColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (fgColor << 8) | (bgColor << 4) | shadowColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (shadowColor << 8) | (bgColor << 4) | shadowColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (bgColor << 8) | (fgColor << 4) | shadowColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (fgColor << 8) | (fgColor << 4) | shadowColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (shadowColor << 8) | (fgColor << 4) | shadowColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (bgColor << 8) | (shadowColor << 4) | shadowColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (fgColor << 8) | (shadowColor << 4) | shadowColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
+
+ temp = (shadowColor << 8) | (shadowColor << 4) | shadowColor;
+ *(current++) = (bg12) | temp;
+ *(current++) = (fg12) | temp;
+ *(current++) = (shadow12) | temp;
}
-#endif
void SaveTextColors(u8 *fgColor, u8 *bgColor, u8 *shadowColor)
{
@@ -843,207 +420,49 @@ void RestoreTextColors(u8 *fgColor, u8 *bgColor, u8 *shadowColor)
GenerateFontHalfRowLookupTable(*fgColor, *bgColor, *shadowColor);
}
-#ifdef NONMATCHING
-void DecompressGlyphTile(const u16 *src, u16 *dest)
+void DecompressGlyphTile(const void *src_, void *dest_)
{
u32 temp;
+ const u16 *src = src_;
+ u32 *dest = dest_;
- temp = src[0];
- *(dest++) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]];
- temp = src[1];
- src += 2;
- dest[1] = (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]];
- dest++;
temp = *(src++);
- *(dest++) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]];
+ *(dest)++ = ((gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]]) << 16) | (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]]);
+
temp = *(src++);
- *(dest++) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]];
+ *(dest++) = ((gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]]) << 16) | (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]]);
+
temp = *(src++);
- *(dest++) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]];
+ *(dest++) = ((gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]]) << 16) | (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]]);
+
temp = *(src++);
- *(dest++) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]];
- *(dest++) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[src[0] & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[src[0] >> 8]];
- *(dest) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[src[1] & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[src[1] >> 8]];
-}
-#else
-NAKED
-void DecompressGlyphTile(const u16 *src, u16 *dest)
-{
- asm("push {r4-r7,lr}\n\
- mov r7, r8\n\
- push {r7}\n\
- ldrh r7, [r0]\n\
- ldr r5, =gFontHalfRowLookupTable\n\
- ldr r4, =gFontHalfRowOffsets\n\
- mov r2, #0xFF\n\
- mov r8, r2\n\
- add r2, r7, #0\n\
- mov r3, r8\n\
- and r2, r3\n\
- add r2, r4\n\
- ldrb r2, [r2]\n\
- lsl r2, #1\n\
- add r2, r5\n\
- ldrh r3, [r2]\n\
- lsl r3, #16\n\
- lsr r2, r7, #8\n\
- add r2, r4\n\
- ldrb r2, [r2]\n\
- lsl r2, #1\n\
- add r2, r5\n\
- ldrh r2, [r2]\n\
- orr r3, r2\n\
- add r6, r1, #0\n\
- stmia r6!, {r3}\n\
- ldrh r7, [r0, #0x2]\n\
- add r0, #0x4\n\
- add r2, r7, #0\n\
- mov r3, r8\n\
- and r2, r3\n\
- add r2, r4\n\
- ldrb r2, [r2]\n\
- lsl r2, #1\n\
- add r2, r5\n\
- ldrh r3, [r2]\n\
- lsl r3, #16\n\
- lsr r2, r7, #8\n\
- add r2, r4\n\
- ldrb r2, [r2]\n\
- lsl r2, #1\n\
- add r2, r5\n\
- ldrh r2, [r2]\n\
- orr r3, r2\n\
- str r3, [r1, #0x4]\n\
- add r6, #0x4\n\
- ldrh r7, [r0]\n\
- add r0, #0x2\n\
- add r1, r7, #0\n\
- mov r2, r8\n\
- and r1, r2\n\
- add r1, r4\n\
- ldrb r1, [r1]\n\
- lsl r1, #1\n\
- add r1, r5\n\
- ldrh r2, [r1]\n\
- lsl r2, #16\n\
- lsr r1, r7, #8\n\
- add r1, r4\n\
- ldrb r1, [r1]\n\
- lsl r1, #1\n\
- add r1, r5\n\
- ldrh r1, [r1]\n\
- orr r2, r1\n\
- stmia r6!, {r2}\n\
- ldrh r7, [r0]\n\
- add r0, #0x2\n\
- add r1, r7, #0\n\
- mov r3, r8\n\
- and r1, r3\n\
- add r1, r4\n\
- ldrb r1, [r1]\n\
- lsl r1, #1\n\
- add r1, r5\n\
- ldrh r2, [r1]\n\
- lsl r2, #16\n\
- lsr r1, r7, #8\n\
- add r1, r4\n\
- ldrb r1, [r1]\n\
- lsl r1, #1\n\
- add r1, r5\n\
- ldrh r1, [r1]\n\
- orr r2, r1\n\
- stmia r6!, {r2}\n\
- ldrh r7, [r0]\n\
- add r0, #0x2\n\
- add r1, r7, #0\n\
- and r1, r3\n\
- add r1, r4\n\
- ldrb r1, [r1]\n\
- lsl r1, #1\n\
- add r1, r5\n\
- ldrh r2, [r1]\n\
- lsl r2, #16\n\
- lsr r1, r7, #8\n\
- add r1, r4\n\
- ldrb r1, [r1]\n\
- lsl r1, #1\n\
- add r1, r5\n\
- ldrh r1, [r1]\n\
- orr r2, r1\n\
- stmia r6!, {r2}\n\
- ldrh r7, [r0]\n\
- add r0, #0x2\n\
- add r1, r7, #0\n\
- and r1, r3\n\
- add r1, r4\n\
- ldrb r1, [r1]\n\
- lsl r1, #1\n\
- add r1, r5\n\
- ldrh r2, [r1]\n\
- lsl r2, #16\n\
- lsr r1, r7, #8\n\
- add r1, r4\n\
- ldrb r1, [r1]\n\
- lsl r1, #1\n\
- add r1, r5\n\
- ldrh r1, [r1]\n\
- orr r2, r1\n\
- stmia r6!, {r2}\n\
- ldrh r7, [r0]\n\
- add r1, r7, #0\n\
- and r1, r3\n\
- add r1, r4\n\
- ldrb r1, [r1]\n\
- lsl r1, #1\n\
- add r1, r5\n\
- ldrh r2, [r1]\n\
- lsl r2, #16\n\
- lsr r1, r7, #8\n\
- add r1, r4\n\
- ldrb r1, [r1]\n\
- lsl r1, #1\n\
- add r1, r5\n\
- ldrh r1, [r1]\n\
- orr r2, r1\n\
- stmia r6!, {r2}\n\
- ldrh r7, [r0, #0x2]\n\
- add r0, r7, #0\n\
- and r0, r3\n\
- add r0, r4\n\
- ldrb r0, [r0]\n\
- lsl r0, #1\n\
- add r0, r5\n\
- ldrh r1, [r0]\n\
- lsl r1, #16\n\
- lsr r0, r7, #8\n\
- add r0, r4\n\
- ldrb r0, [r0]\n\
- lsl r0, #1\n\
- add r0, r5\n\
- ldrh r0, [r0]\n\
- orr r1, r0\n\
- str r1, [r6]\n\
- pop {r3}\n\
- mov r8, r3\n\
- pop {r4-r7}\n\
- pop {r0}\n\
- bx r0\n\
- .pool");
+ *(dest++) = ((gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]]) << 16) | (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]]);
+
+ temp = *(src++);
+ *(dest++) = ((gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]]) << 16) | (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]]);
+
+ temp = *(src++);
+ *(dest++) = ((gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]]) << 16) | (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]]);
+
+ temp = *(src++);
+ *(dest++) = ((gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]]) << 16) | (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]]);
+
+ temp = *(src++);
+ *(dest++) = ((gFontHalfRowLookupTable[gFontHalfRowOffsets[temp & 0xFF]]) << 16) | (gFontHalfRowLookupTable[gFontHalfRowOffsets[temp >> 8]]);
}
-#endif
u8 GetLastTextColor(u8 colorType)
{
switch (colorType)
{
- case 0:
- return gLastTextFgColor;
- case 2:
- return gLastTextBgColor;
- case 1:
- return gLastTextShadowColor;
- default:
- return 0;
+ case 0:
+ return gLastTextFgColor;
+ case 2:
+ return gLastTextBgColor;
+ case 1:
+ return gLastTextShadowColor;
+ default:
+ return 0;
}
}
@@ -2802,8 +2221,8 @@ void DecompressGlyphFont0(u16 glyphId, bool32 isJapanese)
if (isJapanese == 1)
{
glyphs = gFont0JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF));
- DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0);
- DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90.unk40)); // gUnknown_03002F90 + 0x40
+ DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
+ DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40
gUnknown_03002F90.unk80 = 8; // gGlyphWidth
gUnknown_03002F90.unk81 = 12; // gGlyphHeight
}
@@ -2814,15 +2233,15 @@ void DecompressGlyphFont0(u16 glyphId, bool32 isJapanese)
if (gUnknown_03002F90.unk80 <= 8)
{
- DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0);
- DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90.unk40));
+ DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
+ DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
}
else
{
- DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0);
- DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90.unk20));
- DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90.unk40));
- DecompressGlyphTile(glyphs + 0x18, (u16 *)(gUnknown_03002F90.unk60));
+ DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
+ DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20);
+ DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
+ DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60);
}
gUnknown_03002F90.unk81 = 13;
@@ -2845,8 +2264,8 @@ void DecompressGlyphFont7(u16 glyphId, bool32 isJapanese)
{
int eff;
glyphs = gFont1JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & (eff = 0xF))); // shh, no questions, only matching now
- DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0);
- DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90.unk40)); // gUnknown_03002F90 + 0x40
+ DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
+ DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40
gUnknown_03002F90.unk80 = 8; // gGlyphWidth
gUnknown_03002F90.unk81 = 15; // gGlyphHeight
}
@@ -2857,15 +2276,15 @@ void DecompressGlyphFont7(u16 glyphId, bool32 isJapanese)
if (gUnknown_03002F90.unk80 <= 8)
{
- DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0);
- DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90.unk40));
+ DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
+ DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
}
else
{
- DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0);
- DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90.unk20));
- DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90.unk40));
- DecompressGlyphTile(glyphs + 0x18, (u16 *)(gUnknown_03002F90.unk60));
+ DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
+ DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20);
+ DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
+ DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60);
}
gUnknown_03002F90.unk81 = 15;
@@ -2887,8 +2306,8 @@ void DecompressGlyphFont8(u16 glyphId, bool32 isJapanese)
if (isJapanese == TRUE)
{
glyphs = gFont0JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF));
- DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0);
- DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90.unk40)); // gUnknown_03002F90 + 0x40
+ DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
+ DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40
gUnknown_03002F90.unk80 = 8; // gGlyphWidth
gUnknown_03002F90.unk81 = 12; // gGlyphHeight
}
@@ -2899,15 +2318,15 @@ void DecompressGlyphFont8(u16 glyphId, bool32 isJapanese)
if (gUnknown_03002F90.unk80 <= 8)
{
- DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0);
- DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90.unk40));
+ DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
+ DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
}
else
{
- DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0);
- DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90.unk20));
- DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90.unk40));
- DecompressGlyphTile(glyphs + 0x18, (u16 *)(gUnknown_03002F90.unk60));
+ DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
+ DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20);
+ DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
+ DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60);
}
gUnknown_03002F90.unk81 = 12;
@@ -2929,10 +2348,10 @@ void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese)
if (isJapanese == TRUE)
{
glyphs = gFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7));
- DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0);
- DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90.unk20)); // gUnknown_03002F90 + 0x40
- DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90.unk40)); // gUnknown_03002F90 + 0x20
- DecompressGlyphTile(glyphs + 0x88, (u16 *)(gUnknown_03002F90.unk60)); // gUnknown_03002F90 + 0x60
+ DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
+ DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20); // gUnknown_03002F90 + 0x40
+ DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x20
+ DecompressGlyphTile(glyphs + 0x88, gUnknown_03002F90.unk60); // gUnknown_03002F90 + 0x60
gUnknown_03002F90.unk80 = gFont2JapaneseGlyphWidths[glyphId]; // gGlyphWidth
gUnknown_03002F90.unk81 = 14; // gGlyphHeight
}
@@ -2943,15 +2362,15 @@ void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese)
if (gUnknown_03002F90.unk80 <= 8)
{
- DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0);
- DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90.unk40));
+ DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
+ DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
}
else
{
- DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0);
- DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90.unk20));
- DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90.unk40));
- DecompressGlyphTile(glyphs + 0x18, (u16 *)(gUnknown_03002F90.unk60));
+ DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
+ DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20);
+ DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
+ DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60);
}
gUnknown_03002F90.unk81 = 14;
@@ -2974,8 +2393,8 @@ void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese)
{
int eff;
glyphs = gFont1JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & (eff = 0xF))); // shh, no questions, only matching now
- DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0);
- DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90.unk40)); // gUnknown_03002F90 + 0x40
+ DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
+ DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40
gUnknown_03002F90.unk80 = 8; // gGlyphWidth
gUnknown_03002F90.unk81 = 15; // gGlyphHeight
}
@@ -2986,15 +2405,15 @@ void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese)
if (gUnknown_03002F90.unk80 <= 8)
{
- DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0);
- DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90.unk40));
+ DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
+ DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
}
else
{
- DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0);
- DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90.unk20));
- DecompressGlyphTile(glyphs + 0x10, (u16 *)(gUnknown_03002F90.unk40));
- DecompressGlyphTile(glyphs + 0x18, (u16 *)(gUnknown_03002F90.unk60));
+ DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
+ DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20);
+ DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
+ DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60);
}
gUnknown_03002F90.unk81 = 15;
@@ -3014,8 +2433,8 @@ void DecompressGlyphFont9(u16 glyphId)
const u16* glyphs;
glyphs = gFont9JapaneseGlyphs + (0x100 * (glyphId >> 4)) + (0x8 * (glyphId & 0xF));
- DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0);
- DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90.unk40));
+ DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
+ DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40);
gUnknown_03002F90.unk80 = 8;
gUnknown_03002F90.unk81 = 12;
}
diff --git a/src/title_screen.c b/src/title_screen.c
index 40e0f5b2f..70a1a3449 100644
--- a/src/title_screen.c
+++ b/src/title_screen.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "battle.h"
#include "title_screen.h"
#include "sprite.h"
#include "gba/m4a_internal.h"
@@ -37,8 +38,6 @@
#define A_B_START_SELECT (A_BUTTON | B_BUTTON | START_BUTTON | SELECT_BUTTON)
extern struct MusicPlayerInfo gMPlayInfo_BGM;
-extern u16 gBattle_BG1_X;
-extern u16 gBattle_BG1_Y;
// this file's functions
static void MainCB2(void);
diff --git a/src/trainer_see.c b/src/trainer_see.c
index 726d89847..b74608d0b 100644
--- a/src/trainer_see.c
+++ b/src/trainer_see.c
@@ -12,11 +12,10 @@
#include "task.h"
#include "trainer_see.h"
#include "util.h"
+#include "battle_pyramid.h"
#include "constants/field_effects.h"
-extern bool8 InBattlePyramid(void);
extern bool32 InTrainerHill(void);
-extern bool8 GetBattlePyramidTrainerFlag(u8 eventObjectId);
extern bool8 GetTrainerHillTrainerFlag(u8 eventObjectId);
extern void sub_809BE48(u16 npcId);
diff --git a/src/wild_encounter.c b/src/wild_encounter.c
index 52dbdf65e..9b3c70ad7 100644
--- a/src/wild_encounter.c
+++ b/src/wild_encounter.c
@@ -19,6 +19,7 @@
#include "link.h"
#include "script.h"
#include "battle_pike.h"
+#include "battle_pyramid.h"
#include "constants/items.h"
#include "constants/maps.h"
@@ -26,9 +27,6 @@ extern const u8 EventScript_RepelWoreOff[];
#define NUM_FEEBAS_SPOTS 6
-extern void GenerateBattlePyramidWildMon(void);
-extern bool8 InBattlePyramid(void);
-
// this file's functions
static u16 FeebasRandom(void);
static void FeebasSeedRng(u16 seed);