summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorProjectRevoTPP <projectrevotpp@hotmail.com>2017-05-09 19:08:23 -0400
committerProjectRevoTPP <projectrevotpp@hotmail.com>2017-05-09 19:08:23 -0400
commitc10de4945141a6cca8c1b7328f4102bfc2c8ae28 (patch)
tree6ae5a6428c1ac5f33004e5bf57af3bb31e2338fd /src
parentfc761599b412206f80d961a6052dce49b9998689 (diff)
parentc0c3d2c52ad839450041d1ca6a29691efc5c5d35 (diff)
Merge branch 'master' of https://github.com/pret/pokeruby
Diffstat (limited to 'src')
-rw-r--r--src/battle_811DA74.c1
-rw-r--r--src/battle_anim.c1
-rw-r--r--src/battle_setup.c2
-rw-r--r--src/berry_tag_screen.c6
-rw-r--r--src/cable_club.c304
-rw-r--r--src/clear_save_data_menu.c6
-rw-r--r--src/contest_painting.c6
-rw-r--r--src/credits.c8
-rw-r--r--src/dewford_trend.c2
-rw-r--r--src/diploma.c2
-rw-r--r--src/field_control_avatar.c2
-rw-r--r--src/field_effect.c2
-rw-r--r--src/field_fadetransition.c2
-rw-r--r--src/field_region_map.c4
-rw-r--r--src/field_special_scene.c4
-rw-r--r--src/field_weather.c (renamed from src/field_screeneffect.c)2
-rw-r--r--src/item_use.c2
-rw-r--r--src/link.c8
-rw-r--r--src/mail.c10
-rw-r--r--src/mail_data.c50
-rw-r--r--src/main_menu.c9
-rw-r--r--src/matsuda_debug_menu.c5
-rw-r--r--src/mystery_event_menu.c2
-rw-r--r--src/naming_screen.c8
-rw-r--r--src/new_game.c30
-rw-r--r--src/player_pc.c2
-rw-r--r--src/pokedex.c32
-rw-r--r--src/pokemon_storage_system.c93
-rw-r--r--src/pokenav.c45
-rw-r--r--src/record_mixing.c2
-rw-r--r--src/rom3.c1
-rw-r--r--src/rom4.c2
-rw-r--r--src/save_failed_screen.c6
-rw-r--r--src/scrcmd.c2
-rw-r--r--src/secret_base.c18
-rw-r--r--src/shop.c2
-rw-r--r--src/slot_machine.c154
-rw-r--r--src/start_menu.c4
-rw-r--r--src/starter_choose.c6
-rw-r--r--src/wallclock.c4
40 files changed, 732 insertions, 119 deletions
diff --git a/src/battle_811DA74.c b/src/battle_811DA74.c
index 4d66910ba..328b45f49 100644
--- a/src/battle_811DA74.c
+++ b/src/battle_811DA74.c
@@ -69,7 +69,6 @@ extern void c3_0802FDF4(u8);
extern void sub_8031F88();
extern void sub_8141828();
extern void c2_8011A1C(void);
-extern void sub_800832C();
extern void dp01_prepare_buffer_wireless_probably();
extern void dp01_build_cmdbuf_x1D_1D_numargs_varargs(int, u16, void *);
diff --git a/src/battle_anim.c b/src/battle_anim.c
index b9aa5b898..bdb34365f 100644
--- a/src/battle_anim.c
+++ b/src/battle_anim.c
@@ -65,7 +65,6 @@ extern u8 sub_8078874(u8);
extern void sub_8078914();
extern u8 sub_80AEB1C();
extern void sub_80E4EF8(int, int, int, int, u16, u8, int);
-extern void sub_800D238();
extern u8 sub_80789BC();
extern void sub_80AB2AC(void);
extern void sub_800D7B8(void);
diff --git a/src/battle_setup.c b/src/battle_setup.c
index abc0b978d..0753fba70 100644
--- a/src/battle_setup.c
+++ b/src/battle_setup.c
@@ -7,7 +7,7 @@
#include "field_map_obj_helpers.h"
#include "field_message_box.h"
#include "field_player_avatar.h"
-#include "field_screeneffect.h"
+#include "field_weather.h"
#include "main.h"
#include "map_constants.h"
#include "metatile_behavior.h"
diff --git a/src/berry_tag_screen.c b/src/berry_tag_screen.c
index 103f0a85e..511b88c5a 100644
--- a/src/berry_tag_screen.c
+++ b/src/berry_tag_screen.c
@@ -178,9 +178,9 @@ void BerryTagScreen_814625C(u8 taskId)
static void sub_8146288(void)
{
- REG_BG1CNT = 0x502;
- REG_BG2CNT = 0x600;
- REG_BG3CNT = 0x703;
+ REG_BG1CNT = BGCNT_PRIORITY(2) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(5) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_BG2CNT = BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(6) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_BG3CNT = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(7) | BGCNT_16COLOR | BGCNT_TXT256x256;
gUnknown_030041B4 = 0;
}
diff --git a/src/cable_club.c b/src/cable_club.c
new file mode 100644
index 000000000..45fb347f3
--- /dev/null
+++ b/src/cable_club.c
@@ -0,0 +1,304 @@
+#include "global.h"
+#include "asm.h"
+#include "field_message_box.h"
+#include "link.h"
+#include "main.h"
+#include "script.h"
+#include "songs.h"
+#include "sound.h"
+#include "string_util.h"
+#include "task.h"
+#include "text.h"
+#include "trainer_card.h"
+
+extern u16 gScriptResult;
+extern struct TrainerCard gTrainerCards[4];
+
+extern u8 gUnknown_03004860;
+extern u8 gFieldLinkPlayerCount;
+
+extern u8 gUnknown_081A4932[];
+extern const u8 gUnknown_081A4975[];
+
+void sub_8082D4C();
+void sub_8082D60(u8, u8);
+u16 sub_8082D9C(u8, u8);
+u32 sub_8082DF4(u8);
+u32 sub_8082E28(u8);
+u32 sub_8082EB8(u8);
+void sub_8082FEC(u8 taskId);
+static void sub_80830E4(u8 taskId);
+void sub_8083188(u8 taskId);
+static void sub_8083288(u8 taskId);
+static void sub_8083314(u8 taskId);
+void sub_80833C4(u8 taskId);
+void sub_8083418(u8 taskId);
+u8 sub_8083444(u8 taskId);
+
+void sub_808303C(u8 taskId) {
+ s32 linkPlayerCount;
+ s16 *taskData;
+
+ taskData = gTasks[taskId].data;
+
+ linkPlayerCount = GetLinkPlayerCount_2();
+
+ if (sub_8082E28(taskId) == 1 ||
+ sub_8082EB8(taskId) == 1 ||
+ sub_8082DF4(taskId) == 1)
+ {
+ return;
+ }
+
+ sub_8082D60(taskId, linkPlayerCount);
+
+ if (!(gMain.newKeys & A_BUTTON))
+ {
+ return;
+ }
+
+ if (linkPlayerCount < taskData[1])
+ {
+ return;
+ }
+
+ sub_80081C8(linkPlayerCount);
+ sub_8082D4C();
+ ConvertIntToDecimalStringN(gStringVar1, linkPlayerCount, STR_CONV_MODE_LEFT_ALIGN, 1); // r5
+ ShowFieldAutoScrollMessage((u8 *) gUnknown_081A4975);
+ gTasks[taskId].func = sub_80830E4;
+}
+
+#ifdef NONMATCHING
+static void sub_80830E4(u8 taskId) {
+ if (sub_8082E28(taskId) == 1 ||
+ sub_8082EB8(taskId) == 1 ||
+ sub_8082DF4(taskId) == 1 ||
+ GetFieldMessageBoxMode())
+ {
+ return;
+ }
+
+ if (sub_800820C() == GetLinkPlayerCount_2() &&
+ !(gMain.heldKeys & B_BUTTON))
+ {
+ ShowFieldAutoScrollMessage(gUnknown_081A4932);
+ gTasks[taskId].func = sub_8082FEC;
+ return;
+ }
+
+ if (gMain.heldKeys & A_BUTTON)
+ {
+ PlaySE(SE_SELECT);
+ sub_8007F4C();
+ gTasks[(u32) taskId].func = sub_8083188;
+ }
+}
+#else
+__attribute__((naked))
+static void sub_80830E4(u8 taskId) {
+ asm(".syntax unified\n\
+ push {r4-r6,lr}\n\
+ lsls r0, 24\n\
+ lsrs r5, r0, 24\n\
+ adds r6, r5, 0\n\
+ adds r0, r5, 0\n\
+ bl sub_8082E28\n\
+ cmp r0, 0x1\n\
+ beq _08083178\n\
+ adds r0, r5, 0\n\
+ bl sub_8082EB8\n\
+ cmp r0, 0x1\n\
+ beq _08083178\n\
+ adds r0, r5, 0\n\
+ bl sub_8082DF4\n\
+ cmp r0, 0x1\n\
+ beq _08083178\n\
+ bl GetFieldMessageBoxMode\n\
+ lsls r0, 24\n\
+ cmp r0, 0\n\
+ bne _08083178\n\
+ bl sub_800820C\n\
+ adds r4, r0, 0\n\
+ bl GetLinkPlayerCount_2\n\
+ lsls r4, 24\n\
+ lsls r0, 24\n\
+ cmp r4, r0\n\
+ bne _08083132\n\
+ ldr r0, _08083148 @ =gMain\n\
+ ldrh r1, [r0, 0x2C]\n\
+ movs r0, 0x2\n\
+ ands r0, r1\n\
+ cmp r0, 0\n\
+ beq _08083158\n\
+_08083132:\n\
+ ldr r0, _0808314C @ =gUnknown_081A4932\n\
+ bl ShowFieldAutoScrollMessage\n\
+ ldr r1, _08083150 @ =gTasks\n\
+ lsls r0, r5, 2\n\
+ adds r0, r5\n\
+ lsls r0, 3\n\
+ adds r0, r1\n\
+ ldr r1, _08083154 @ =sub_8082FEC\n\
+ str r1, [r0]\n\
+ b _08083178\n\
+ .align 2, 0\n\
+_08083148: .4byte gMain\n\
+_0808314C: .4byte gUnknown_081A4932\n\
+_08083150: .4byte gTasks\n\
+_08083154: .4byte sub_8082FEC\n\
+_08083158:\n\
+ movs r0, 0x1\n\
+ ands r0, r1\n\
+ cmp r0, 0\n\
+ beq _08083178\n\
+ movs r0, 0x5\n\
+ bl PlaySE\n\
+ bl sub_8007F4C\n\
+ ldr r0, _08083180 @ =gTasks\n\
+ lsls r1, r6, 2\n\
+ adds r1, r6\n\
+ lsls r1, 3\n\
+ adds r1, r0\n\
+ ldr r0, _08083184 @ =sub_8083188\n\
+ str r0, [r1]\n\
+_08083178:\n\
+ pop {r4-r6}\n\
+ pop {r0}\n\
+ bx r0\n\
+ .align 2, 0\n\
+_08083180: .4byte gTasks\n\
+_08083184: .4byte sub_8083188\n\
+ .syntax divided\n");
+}
+#endif
+
+void sub_8083188(u8 taskId) {
+ u8 local1, local2;
+ u16 *result;
+
+ local1 = gTasks[taskId].data[1];
+ local2 = gTasks[taskId].data[2];
+
+
+ if (sub_8082DF4(taskId) == 1 ||
+ sub_8083444(taskId) == 1)
+ {
+ return;
+ }
+
+ if (GetLinkPlayerCount_2() != sub_800820C())
+ {
+ gTasks[taskId].func = sub_8083418;
+ return;
+ }
+
+ result = &gScriptResult;
+ *result = sub_8082D9C(local1, local2);
+ if (*result)
+ {
+ gTasks[taskId].func = sub_8083288;
+ }
+}
+
+void sub_80831F8(u8 taskId) {
+ u8 local1, local2;
+ u16 *result;
+
+ local1 = gTasks[taskId].data[1];
+ local2 = gTasks[taskId].data[2];
+
+ if (sub_8082E28(taskId) == 1 ||
+ sub_8082DF4(taskId) == 1)
+ {
+ return;
+ }
+
+ result = &gScriptResult;
+ *result = sub_8082D9C(local1, local2);
+ if (*result == 0)
+ {
+ return;
+ }
+
+
+ if (*result == 3)
+ {
+ sub_800832C();
+ HideFieldMessageBox();
+ gTasks[taskId].func = sub_80833C4;
+ }
+ else
+ {
+ gFieldLinkPlayerCount = GetLinkPlayerCount_2();
+ gUnknown_03004860 = GetMultiplayerId();
+ sub_80081C8(gFieldLinkPlayerCount);
+ sub_8093390((struct TrainerCard *) gBlockSendBuffer);
+ gTasks[taskId].func = sub_8083314;
+ }
+}
+
+static void sub_8083288(u8 taskId) {
+ if (sub_8082DF4(taskId) == 1)
+ {
+ return;
+ }
+
+ if (gScriptResult == 3)
+ {
+ sub_800832C();
+ HideFieldMessageBox();
+ gTasks[taskId].func = sub_80833C4;
+ }
+ else
+ {
+ gFieldLinkPlayerCount = GetLinkPlayerCount_2();
+ gUnknown_03004860 = GetMultiplayerId();
+ sub_80081C8(gFieldLinkPlayerCount);
+ sub_8093390((struct TrainerCard *) gBlockSendBuffer);
+ gTasks[taskId].func = sub_8083314;
+ sub_8007E9C(2);
+ }
+}
+
+static void sub_8083314(u8 taskId) {
+ u8 index;
+
+ struct TrainerCard *trainerCards;
+
+ if (sub_8082DF4(taskId) == 1)
+ {
+ return;
+ }
+
+ if (GetBlockReceivedStatus() != sub_8008198())
+ {
+ return;
+ }
+
+ index = 0;
+ trainerCards = gTrainerCards;
+ for (index = 0; index < GetLinkPlayerCount(); index++)
+ {
+ void *src;
+ src = gBlockRecvBuffer[index];
+ memcpy(&trainerCards[index], src, sizeof(struct TrainerCard));
+ }
+
+ SetSuppressLinkErrorMessage(FALSE);
+ ResetBlockReceivedFlags();
+ HideFieldMessageBox();
+
+ if (gScriptResult == 1)
+ {
+ u16 linkType;
+ linkType = gLinkType;
+ sub_8082D4C(0x00004411, linkType);
+ EnableBothScriptContexts();
+ DestroyTask(taskId);
+ return;
+ }
+
+ sub_800832C();
+ gTasks[taskId].func = sub_80833C4;
+}
diff --git a/src/clear_save_data_menu.c b/src/clear_save_data_menu.c
index 6b0cc821a..21cd643ef 100644
--- a/src/clear_save_data_menu.c
+++ b/src/clear_save_data_menu.c
@@ -41,7 +41,7 @@ static void Task_InitMenu(u8 taskId)
{
ResetSpriteData();
- REG_DISPCNT = DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG3_ON | DISPCNT_OBJ_ON;
+ REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG3_ON | DISPCNT_OBJ_ON;
SetVBlankCallback(VBlankCB_ClearSaveDataScreen);
MenuDrawTextWindow(2, 14, 27, 19);
@@ -148,8 +148,8 @@ static u8 InitClearSaveDataScreen(void)
SetVBlankCallback(VBlankCB_InitClearSaveDataScreen);
- REG_BG3CNT = 0x0703;
- REG_DISPCNT = 0x0900;
+ REG_BG3CNT = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(7) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_BG0_ON | DISPCNT_BG3_ON;
gMain.state = 1;
return 0;
case 1:
diff --git a/src/contest_painting.c b/src/contest_painting.c
index 08244597e..2ef50ee17 100644
--- a/src/contest_painting.c
+++ b/src/contest_painting.c
@@ -336,8 +336,8 @@ static void ContestPaintingInitBG(void)
{
REG_DISPCNT = 0;
REG_IE |= INTR_FLAG_VBLANK;
- REG_BG0CNT = 0x0C42;
- REG_BG1CNT = 0x0A45;
+ REG_BG0CNT = BGCNT_PRIORITY(2) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(12) | BGCNT_MOSAIC | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_BG1CNT = BGCNT_PRIORITY(1) | BGCNT_CHARBASE(1) | BGCNT_SCREENBASE(10) | BGCNT_MOSAIC | BGCNT_16COLOR | BGCNT_TXT256x256;
REG_BLDCNT = 0;
REG_BLDALPHA = 0;
REG_BLDY = 0;
@@ -367,7 +367,7 @@ static void ContestPaintingMosaic(void)
return;
}
- REG_BG1CNT = 0xA45;
+ REG_BG1CNT = BGCNT_PRIORITY(1) | BGCNT_CHARBASE(1) | BGCNT_SCREENBASE(10) | BGCNT_MOSAIC | BGCNT_16COLOR | BGCNT_TXT256x256;
gUnknown_03000752 = gUnknown_03000754 / 2;
REG_MOSAIC = (gUnknown_03000752 << 12) | (gUnknown_03000752 << 8) | (gUnknown_03000752 << 4) | (gUnknown_03000752 << 0);
diff --git a/src/credits.c b/src/credits.c
index 17d3507aa..01af78bce 100644
--- a/src/credits.c
+++ b/src/credits.c
@@ -474,8 +474,8 @@ void task_a_8143D04(u8 taskIdA)
BeginNormalPaletteFade(-1, 0, 16, 0, 0);
REG_BG3HOFS = 0;
REG_BG3VOFS = 32;
- REG_BG3CNT = 0x703;
- REG_DISPCNT = 0x1940;
+ REG_BG3CNT = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(7) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG3_ON | DISPCNT_OBJ_ON;
gMain.state = 0;
gUnknown_0203935C = 0;
@@ -518,13 +518,13 @@ static void task_a_8143F3C(u8 taskIdA)
FreeAllSpritePalettes();
BeginNormalPaletteFade(-1, 8, 16, 0, 0);
- REG_BG0CNT = 0x700;
+ REG_BG0CNT = BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(7) | BGCNT_16COLOR | BGCNT_TXT256x256;
backup = REG_IME;
REG_IME = 0;
REG_IE |= INTR_FLAG_VBLANK;
REG_IME = backup;
REG_DISPSTAT |= DISPSTAT_VBLANK_INTR;
- REG_DISPCNT = 0x140;
+ REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON;
gTasks[taskIdA].data[TDA_0] = 0x100;
gTasks[taskIdA].func = task_a_8143FDC;
diff --git a/src/dewford_trend.c b/src/dewford_trend.c
index b90100d90..fe9311655 100644
--- a/src/dewford_trend.c
+++ b/src/dewford_trend.c
@@ -19,7 +19,7 @@ static bool8 SB1ContainsWords(u16 *a);
static bool8 IsEasyChatPairEqual(u16 *words1, u16 *words2);
static s16 sub_80FA828(struct EasyChatPair *a, u16 b);
-void sub_80FA17C(void)
+void InitDewfordTrends(void)
{
u16 i;
diff --git a/src/diploma.c b/src/diploma.c
index 112647956..c32b72a70 100644
--- a/src/diploma.c
+++ b/src/diploma.c
@@ -87,7 +87,7 @@ void sub_8145D88(void)
REG_BLDCNT = 0;
REG_BLDALPHA = 0;
REG_BLDY = 0;
- REG_BG3CNT = 0x4603;
+ REG_BG3CNT = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(6) | BGCNT_16COLOR | BGCNT_TXT512x256;
REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG3_ON | DISPCNT_OBJ_ON;
CreateTask(Task_DiplomaFadeIn, 0);
diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c
index 1f049c0bd..c5f2c08e7 100644
--- a/src/field_control_avatar.c
+++ b/src/field_control_avatar.c
@@ -517,7 +517,7 @@ bool8 sub_8068894(void)
}
if (SafariZoneTakeStep() == TRUE)
return TRUE;
- if (sub_810D9B0(1) == TRUE)
+ if (CountSSTidalStep(1) == TRUE)
{
ScriptContext1_SetupScript(gUnknown_0815FD0D);
return TRUE;
diff --git a/src/field_effect.c b/src/field_effect.c
index 1b2346a00..bbc1144c1 100644
--- a/src/field_effect.c
+++ b/src/field_effect.c
@@ -1,6 +1,6 @@
#include "global.h"
#include "field_effect.h"
-#include "field_screeneffect.h"
+#include "field_weather.h"
#include "sprite.h"
#include "text.h"
diff --git a/src/field_fadetransition.c b/src/field_fadetransition.c
index f7d591c69..b5e6c1039 100644
--- a/src/field_fadetransition.c
+++ b/src/field_fadetransition.c
@@ -1,6 +1,6 @@
#include "global.h"
#include "gba/syscall.h"
-#include "field_screeneffect.h"
+#include "field_weather.h"
#include "global.fieldmap.h"
#include "script.h"
#include "task.h"
diff --git a/src/field_region_map.c b/src/field_region_map.c
index db12eb6a5..ec630ad00 100644
--- a/src/field_region_map.c
+++ b/src/field_region_map.c
@@ -64,7 +64,7 @@ void CB2_FieldInitRegionMap(void)
SetUpWindowConfig(&gWindowConfig_81E709C);
InitMenuWindow(&gWindowConfig_81E709C);
MenuZeroFillScreen();
- REG_BG0CNT = 7936;
+ REG_BG0CNT = BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(31) | BGCNT_16COLOR | BGCNT_TXT256x256;
MenuDrawTextWindow(21, 0, 29, 3);
sub_8072BD8(gOtherText_Hoenn, 0x16, 1, 0x38);
MenuDrawTextWindow(16, 16, 29, 19);
@@ -94,7 +94,7 @@ void sub_813EFDC(void)
switch (unk_2000000.unk888)
{
case 0:
- REG_DISPCNT = 5441;
+ REG_DISPCNT = DISPCNT_MODE_1 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG2_ON | DISPCNT_OBJ_ON;
unk_2000000.unk888++;
break;
case 1:
diff --git a/src/field_special_scene.c b/src/field_special_scene.c
index fc4d96e18..59280b743 100644
--- a/src/field_special_scene.c
+++ b/src/field_special_scene.c
@@ -239,7 +239,7 @@ bool8 sub_80C7754(void)
s8 mapGroup, mapNum;
s16 x, y;
- if (sub_810D9EC(&mapGroup, &mapNum, &x, &y))
+ if (GetSSTidalLocation(&mapGroup, &mapNum, &x, &y))
{
return FALSE;
}
@@ -270,7 +270,7 @@ void Task_HandlePorthole(u8 taskId)
data[1] = 1;
if (!sub_80A212C(0xFF, location->mapNum, location->mapGroup))
return;
- if (sub_810D9B0(1) == TRUE)
+ if (CountSSTidalStep(1) == TRUE)
{
if (*var == 2)
*var = 9;
diff --git a/src/field_screeneffect.c b/src/field_weather.c
index 6cae0c18a..ff5d5b507 100644
--- a/src/field_screeneffect.c
+++ b/src/field_weather.c
@@ -1,5 +1,5 @@
#include "global.h"
-#include "field_screeneffect.h"
+#include "field_weather.h"
#include "asm.h"
#include "palette.h"
#include "sprite.h"
diff --git a/src/item_use.c b/src/item_use.c
index 762bb70f2..4047ade5c 100644
--- a/src/item_use.c
+++ b/src/item_use.c
@@ -6,7 +6,7 @@
#include "event_data.h"
#include "field_map_obj_helpers.h"
#include "field_player_avatar.h"
-#include "field_screeneffect.h"
+#include "field_weather.h"
#include "fieldmap.h"
#include "item.h"
#include "items.h"
diff --git a/src/link.c b/src/link.c
index 336616f1a..224c0ae1c 100644
--- a/src/link.c
+++ b/src/link.c
@@ -207,13 +207,13 @@ static void InitLinkTestBG(u8 paletteNum, u8 bgNum, u8 screenBaseBlock, u8 charB
switch (bgNum)
{
case 1:
- REG_BG1CNT = 1 | (screenBaseBlock << 8) | (charBaseBlock << 2);
+ REG_BG1CNT = BGCNT_PRIORITY(1) | BGCNT_SCREENBASE(screenBaseBlock) | BGCNT_CHARBASE(charBaseBlock);
break;
case 2:
- REG_BG2CNT = 1 | (screenBaseBlock << 8) | (charBaseBlock << 2);
+ REG_BG2CNT = BGCNT_PRIORITY(1) | BGCNT_SCREENBASE(screenBaseBlock) | BGCNT_CHARBASE(charBaseBlock);
break;
case 3:
- REG_BG3CNT = 1 | (screenBaseBlock << 8) | (charBaseBlock << 2);
+ REG_BG3CNT = BGCNT_PRIORITY(1) | BGCNT_SCREENBASE(screenBaseBlock) | BGCNT_CHARBASE(charBaseBlock);
break;
}
}
@@ -255,7 +255,7 @@ void LinkTestScreen(void)
}
InitLinkTestBG(0, 2, 4, 0);
- REG_DISPCNT = DISPCNT_OBJ_ON | DISPCNT_BG0_ON | DISPCNT_BG2_ON | DISPCNT_OBJ_1D_MAP;
+ REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_ON | DISPCNT_BG0_ON | DISPCNT_BG2_ON | DISPCNT_OBJ_1D_MAP;
CreateTask(Task_DestroySelf, 0);
RunTasks();
AnimateSprites();
diff --git a/src/mail.c b/src/mail.c
index 1bd4e73dc..807864332 100644
--- a/src/mail.c
+++ b/src/mail.c
@@ -116,7 +116,7 @@ void HandleReadMail(struct MailStruct *arg0, MainCallback arg1, bool8 arg2)
break;
}
- if (((sub_80A2D64(arg0->species, buffer) << 16) + 0xFFFF0000) <= (410 << 16))
+ if (((MailSpeciesToSpecies(arg0->species, buffer) << 16) + 0xFFFF0000) <= (410 << 16))
{
switch (ewram0.varFA)
{
@@ -273,11 +273,11 @@ static u8 sub_80F8A28(void)
RETURN_SKIP_STATE;
case 18:
- REG_BG0CNT = 0x9F08;
- REG_BG1CNT = 0x0801;
- REG_BG2CNT = 0x0902;
+ REG_BG0CNT = BGCNT_PRIORITY(0) | BGCNT_CHARBASE(2) | BGCNT_SCREENBASE(31) | BGCNT_16COLOR | BGCNT_TXT256x512;
+ REG_BG1CNT = BGCNT_PRIORITY(1) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(8) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_BG2CNT = BGCNT_PRIORITY(2) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(9) | BGCNT_16COLOR | BGCNT_TXT256x256;
REG_BLDCNT = 0;
- REG_DISPCNT = DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_BG2_ON | DISPCNT_OBJ_ON;
+ REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_BG2_ON | DISPCNT_OBJ_ON;
BeginNormalPaletteFade(-1, 0, 16, 0, 0);
gPaletteFade.bufferTransferDisabled = 0;
ewram0.varF0 = sub_80F8F58;
diff --git a/src/mail_data.c b/src/mail_data.c
index f83484346..23d22e21f 100644
--- a/src/mail_data.c
+++ b/src/mail_data.c
@@ -5,20 +5,20 @@
#include "species.h"
#include "text.h"
-void sub_80A2B40(struct MailStruct *);
-u16 sub_80A2D44(u16, u32);
-bool8 itemid_is_mail(u16);
-u16 sub_809D474(u32);
+void ClearMailStruct(struct MailStruct *);
+u16 SpeciesToMailSpecies(u16, u32);
+bool8 ItemIsMail(u16);
+u16 GetUnownLetterByPersonality(u32);
-void sub_80A2B18(void)
+void ClearMailData(void)
{
u8 i;
for (i = 0; i < 16; i++)
- sub_80A2B40(&gSaveBlock1.mail[i]);
+ ClearMailStruct(&gSaveBlock1.mail[i]);
}
-void sub_80A2B40(struct MailStruct *mail)
+void ClearMailStruct(struct MailStruct *mail)
{
int i;
@@ -35,16 +35,16 @@ void sub_80A2B40(struct MailStruct *mail)
mail->itemId = 0;
}
-bool8 sub_80A2B94(struct Pokemon *mon)
+bool8 MonHasMail(struct Pokemon *mon)
{
u16 heldItem = GetMonData(mon, MON_DATA_HELD_ITEM);
- if (itemid_is_mail(heldItem) && GetMonData(mon, MON_DATA_MAIL) != 0xFF)
+ if (ItemIsMail(heldItem) && GetMonData(mon, MON_DATA_MAIL) != 0xFF)
return TRUE;
else
return FALSE;
}
-u8 sub_80A2BC4(struct Pokemon *mon, u16 itemId)
+u8 GiveMailToMon(struct Pokemon *mon, u16 itemId)
{
u16 _itemId;
u8 heldItem[2];
@@ -75,7 +75,7 @@ u8 sub_80A2BC4(struct Pokemon *mon, u16 itemId)
species = GetBoxMonData(&mon->box, MON_DATA_SPECIES);
personality = GetBoxMonData(&mon->box, MON_DATA_PERSONALITY);
- gSaveBlock1.mail[id].species = sub_80A2D44(species, personality);
+ gSaveBlock1.mail[id].species = SpeciesToMailSpecies(species, personality);
gSaveBlock1.mail[id].itemId = _itemId;
SetMonData(mon, MON_DATA_MAIL, &id);
SetMonData(mon, MON_DATA_HELD_ITEM, heldItem);
@@ -87,14 +87,18 @@ u8 sub_80A2BC4(struct Pokemon *mon, u16 itemId)
return -1;
}
-u16 sub_80A2D44(u16 species, u32 personality)
+u16 SpeciesToMailSpecies(u16 species, u32 personality)
{
- if (species != SPECIES_UNOWN)
- return species;
- return ((sub_809D474(personality) << 16) + (30000 << 16)) >> 16;
+ if (species == SPECIES_UNOWN)
+ {
+ int mailSpecies = GetUnownLetterByPersonality(personality) + 30000;
+ return mailSpecies;
+ }
+
+ return species;
}
-u16 sub_80A2D64(u16 a1, u16 *a2)
+u16 MailSpeciesToSpecies(u16 a1, u16 *a2)
{
u16 result;
@@ -111,11 +115,11 @@ u16 sub_80A2D64(u16 a1, u16 *a2)
return result;
}
-u8 sub_80A2D88(struct Pokemon *mon, struct MailStruct *mail)
+u8 GiveMailToMon2(struct Pokemon *mon, struct MailStruct *mail)
{
u8 heldItem[2];
u16 itemId = mail->itemId;
- u8 mailId = sub_80A2BC4(mon, itemId);
+ u8 mailId = GiveMailToMon(mon, itemId);
if (mailId == 0xFF)
return 0xFF;
@@ -137,12 +141,12 @@ int unref_sub_80A2DF4(void)
return 0;
}
-void sub_80A2DF8(struct Pokemon *mon)
+void TakeMailFromMon(struct Pokemon *mon)
{
u8 heldItem[2];
u8 mailId;
- if (sub_80A2B94(mon))
+ if (MonHasMail(mon))
{
mailId = GetMonData(mon, MON_DATA_MAIL);
gSaveBlock1.mail[mailId].itemId = 0;
@@ -154,12 +158,12 @@ void sub_80A2DF8(struct Pokemon *mon)
}
}
-void unref_sub_80A2E58(u8 mailId)
+void DeleteMail(u8 mailId)
{
gSaveBlock1.mail[mailId].itemId = 0;
}
-u8 sub_80A2E78(struct Pokemon *mon)
+u8 TakeMailFromMon2(struct Pokemon *mon)
{
u8 i;
u8 newHeldItem[2];
@@ -184,7 +188,7 @@ u8 sub_80A2E78(struct Pokemon *mon)
return 0xFF;
}
-bool8 itemid_is_mail(u16 itemId)
+bool8 ItemIsMail(u16 itemId)
{
switch (itemId)
{
diff --git a/src/main_menu.c b/src/main_menu.c
index 294d33620..50fefc471 100644
--- a/src/main_menu.c
+++ b/src/main_menu.c
@@ -250,7 +250,8 @@ u32 InitMainMenu(u8 a1)
SetVBlankCallback(VBlankCB_MainMenu);
SetMainCallback2(CB2_MainMenu);
- REG_DISPCNT = DISPCNT_OBJ_1D_MAP
+ REG_DISPCNT = DISPCNT_MODE_0
+ | DISPCNT_OBJ_1D_MAP
| DISPCNT_BG0_ON
| DISPCNT_OBJ_ON
| DISPCNT_WIN0_ON;
@@ -747,8 +748,8 @@ static void Task_NewGameSpeech1(u8 taskId)
FreeAllSpritePalettes();
AddBirchSpeechObjects(taskId);
BeginNormalPaletteFade(-1, 0, 0x10, 0, 0);
- REG_BG1CNT = 0x00000703;
- REG_DISPCNT = DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP;
+ REG_BG1CNT = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(7) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP;
gTasks[taskId].data[TD_BGHOFS] = 0;
gTasks[taskId].func = Task_NewGameSpeech2;
gTasks[taskId].data[TD_TRAINER_SPRITE_ID] = 0xFF;
@@ -1391,7 +1392,7 @@ void CB_ContinueNewGameSpeechPart2()
SetVBlankCallback(VBlankCB_MainMenu);
SetMainCallback2(CB2_MainMenu);
- REG_BG1CNT = 1795;
+ REG_BG1CNT = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(7) | BGCNT_16COLOR | BGCNT_TXT256x256;
REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP |
DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_OBJ_ON;
}
diff --git a/src/matsuda_debug_menu.c b/src/matsuda_debug_menu.c
index 39c338658..d2ca754bb 100644
--- a/src/matsuda_debug_menu.c
+++ b/src/matsuda_debug_menu.c
@@ -64,7 +64,6 @@ extern u8* gMatsudaDebugMenuTextList3[];
extern u8 gMatsudaDebugMenuContestTopLeft[][2];
extern bool8 gReceivedRemoteLinkPlayers;
-extern u16 gBlockRecvBuffer[MAX_LINK_PLAYERS][BLOCK_BUFFER_SIZE / 2];
extern struct MenuAction gMatsudaDebugMenuActions[];
@@ -290,7 +289,7 @@ static void sub_80A9F10(u8 taskId)
static void sub_80A9F50(void)
{
- REG_DISPCNT = DISPCNT_OBJ_1D_MAP;
+ REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP;
REG_DISPCNT |= DISPCNT_OBJ_ON | DISPCNT_BG0_ON;
SetUpWindowConfig(&gWindowConfig_81E6C3C);
InitWindowFromConfig(&gMenuWindow, &gWindowConfig_81E6C3C);
@@ -1073,7 +1072,7 @@ void unref_sub_80AB084(u8 *text)
REG_WIN0V = 0;
REG_WIN1H = 0;
REG_WIN1V = 0;
- REG_DISPCNT = 0x1F40;
+ REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_ON;
savedIme = REG_IME;
REG_IME = 0;
diff --git a/src/mystery_event_menu.c b/src/mystery_event_menu.c
index 693b28948..97deb348c 100644
--- a/src/mystery_event_menu.c
+++ b/src/mystery_event_menu.c
@@ -54,7 +54,7 @@ void CB2_InitMysteryEventMenu(void)
SetUpWindowConfig(&gWindowConfig_81E6CE4);
InitMenuWindow(&gWindowConfig_81E6CE4);
MenuZeroFillScreen();
- REG_DISPCNT = 320;
+ REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON;
REG_BLDCNT = 0;
CreateTask(Task_DestroySelf, 0);
StopMapMusic();
diff --git a/src/naming_screen.c b/src/naming_screen.c
index f00a9bd3e..b14c690e2 100644
--- a/src/naming_screen.c
+++ b/src/naming_screen.c
@@ -298,10 +298,10 @@ static void NamingScreen_SetUpVideoRegs(void)
REG_BG2VOFS = 0;
REG_BG3HOFS = 0;
REG_BG3VOFS = 0;
- REG_BG0CNT = 0x1F00;
- REG_BG1CNT = 0x1C01;
- REG_BG2CNT = 0x1D0A;
- REG_BG3CNT = 0x1E03;
+ REG_BG0CNT = BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(31) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_BG1CNT = BGCNT_PRIORITY(1) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(28) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_BG2CNT = BGCNT_PRIORITY(2) | BGCNT_CHARBASE(2) | BGCNT_SCREENBASE(29) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_BG3CNT = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(30) | BGCNT_16COLOR | BGCNT_TXT256x256;
REG_BLDCNT = 0x640;
REG_BLDALPHA = 0x80C;
}
diff --git a/src/new_game.c b/src/new_game.c
index 3b93d37cc..6d2722c44 100644
--- a/src/new_game.c
+++ b/src/new_game.c
@@ -47,7 +47,7 @@ void copy_word_to_mem(u8 *copyTo, u8 *copyFrom)
copyTo[i] = copyFrom[i];
}
-void set_player_trainer_id(void)
+void InitPlayerTrainerId(void)
{
write_word_to_mem((Random() << 16) | Random(), gSaveBlock2.playerTrainerId);
}
@@ -113,21 +113,21 @@ void NewGameInitData(void)
gDifferentSaveFile = 1;
ZeroPlayerPartyMons();
ZeroEnemyPartyMons();
- sub_808C02C();
+ ResetPokedex();
sub_8052DE4();
memset(&gSaveBlock1, 0, sizeof(gSaveBlock1));
- sub_80A2B18();
+ ClearMailData();
gSaveBlock2.specialSaveWarp = 0;
- set_player_trainer_id();
+ InitPlayerTrainerId();
PlayTimeCounter_Reset();
ClearPokedexFlags();
InitEventData();
- sub_80BD7A8();
- sub_80BDAB4();
- sub_80BB5B4();
+ ClearTVShowData();
+ ResetGabbyAndTy();
+ ResetSecretBases();
ClearBerryTrees();
gSaveBlock1.money = 3000;
- sub_80AB1B0();
+ ResetLinkContestBoolean();
ResetGameStats();
sub_8052DA8();
InitLinkBattleRecords();
@@ -135,18 +135,18 @@ void NewGameInitData(void)
InitBarboachSizeRecord();
gPlayerPartyCount = 0;
ZeroPlayerPartyMons();
- sub_80961D8();
+ ResetPokemonStorageSystem();
ClearRoamerData();
ClearRoamerLocationData();
gSaveBlock1.registeredItem = 0;
- sub_80A3714();
+ ClearBag();
NewGameInitPCItems();
- sub_810C994();
- sub_8133F80();
- sub_80E6764();
+ ClearPokeblocks();
+ ClearDecorationInventories();
+ InitEasyChatPhrases();
SetMauvilleOldMan();
- sub_80FA17C();
- sub_810FA54();
+ InitDewfordTrends();
+ ResetFanClub();
ResetLotteryCorner();
WarpToTruck();
ScriptContext2_RunNewScript(gUnknown_0819FA81);
diff --git a/src/player_pc.c b/src/player_pc.c
index 02a2dc1a2..f0f0709b1 100644
--- a/src/player_pc.c
+++ b/src/player_pc.c
@@ -1,6 +1,6 @@
#include "global.h"
#include "asm.h"
-#include "field_screeneffect.h"
+#include "field_weather.h"
#include "item.h"
#include "items.h"
#include "main.h"
diff --git a/src/pokedex.c b/src/pokedex.c
index 3ef1de51e..5ea1f9938 100644
--- a/src/pokedex.c
+++ b/src/pokedex.c
@@ -115,7 +115,7 @@ u16 NationalPokedexNumToSpecies(u16);
// asm/pokedex_area_screen
void ShowPokedexAreaScreen(u16 species, u8 *string);
-void sub_808C02C(void)
+void ResetPokedex(void)
{
u16 i;
@@ -789,10 +789,10 @@ bool8 sub_808D344(u8 a)
REG_BLDCNT = 0;
REG_BLDALPHA = 0;
REG_BLDY = 0;
- REG_BG3CNT = 0xF03;
- REG_BG1CNT = 0xD01;
- REG_BG0CNT = 0xC00;
- REG_DISPCNT = 0x9F40;
+ REG_BG3CNT = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(15) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_BG1CNT = BGCNT_PRIORITY(1) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(13) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_BG0CNT = BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(12) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_ON | DISPCNT_OBJWIN_ON;
gMain.state++;
break;
case 6:
@@ -2296,8 +2296,8 @@ void Task_InitPageScreenMultistep(u8 taskId)
REG_BLDCNT = 0;
REG_BLDALPHA = 0;
REG_BLDY = 0;
- REG_BG3CNT = 0xF03;
- REG_BG1CNT = 0xD00;
+ REG_BG3CNT = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(15) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_BG1CNT = BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(13) | BGCNT_16COLOR | BGCNT_TXT256x256;
REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG1_ON | DISPCNT_BG2_ON | DISPCNT_BG3_ON | DISPCNT_OBJ_ON;
gMain.state++;
break;
@@ -2422,7 +2422,7 @@ void Task_InitAreaScreenMultistep(u8 taskId)
sub_8090540(0xD);
sub_8090644(1, 0xD);
sub_808D640();
- REG_BG1CNT = 0xD00;
+ REG_BG1CNT = BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(13) | BGCNT_16COLOR | BGCNT_TXT256x256;
gMain.state++;
break;
case 2:
@@ -2544,10 +2544,10 @@ void Task_InitCryScreenMultistep(u8 taskId)
REG_BLDCNT = 0;
REG_BLDALPHA = 0;
REG_BLDY = 0;
- REG_BG2CNT = 0xE02;
- REG_BG0CNT = 0x1F07;
- REG_BG1CNT = 0xD00;
- REG_DISPCNT = 0x1F07 + 0x39;
+ REG_BG2CNT = BGCNT_PRIORITY(2) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(14) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_BG0CNT = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(1) | BGCNT_SCREENBASE(31) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_BG1CNT = BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(13) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_ON;
gMain.state++;
break;
case 10:
@@ -2715,8 +2715,8 @@ void Task_InitSizeScreenMultistep(u8 taskId)
REG_BLDCNT = 0;
REG_BLDALPHA = 0;
REG_BLDY = 0;
- REG_BG2CNT = 0xE03;
- REG_DISPCNT = 0x1E40;
+ REG_BG2CNT = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(14) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG1_ON | DISPCNT_BG2_ON | DISPCNT_BG3_ON | DISPCNT_OBJ_ON;
gMain.state++;
break;
case 9:
@@ -3156,8 +3156,8 @@ void sub_8090750(u8 taskId)
REG_BLDCNT = 0;
REG_BLDALPHA = 0;
REG_BLDY = 0;
- REG_BG3CNT = 0xF07;
- REG_DISPCNT = 0x1C40;
+ REG_BG3CNT = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(1) | BGCNT_SCREENBASE(15) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG2_ON | DISPCNT_BG3_ON | DISPCNT_OBJ_ON;
gTasks[taskId].data[0]++;
break;
case 6:
diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c
new file mode 100644
index 000000000..679ec0bc4
--- /dev/null
+++ b/src/pokemon_storage_system.c
@@ -0,0 +1,93 @@
+#include "global.h"
+#include "menu.h"
+#include "string_util.h"
+
+struct StorageAction {
+ u8 *text;
+ u8 format;
+};
+
+extern const struct StorageAction gUnknown_083B6DF4[];
+
+extern const u8 unk_2000000[];
+
+#define gUnk2002694 (u8 *)(&unk_2000000[0x2694])
+#define gUnk20026A6 (u8 *)(&unk_2000000[0x26a6])
+#define gUnk20011fa (u8 *)(&unk_2000000[0x11fa])
+#define gUnk20026e4 (u8 *)(&unk_2000000[0x26e4])
+
+void sub_8098898(u8 index) {
+ u8 *ptr;
+
+ MenuDrawTextWindow(10, 16, 29, 19);
+
+ switch (gUnknown_083B6DF4[index].format)
+ {
+
+ case 2:
+ ptr = StringCopy(gUnk2002694, gUnknown_083B6DF4[index].text);
+ ptr = StringCopy(ptr, gUnk20011fa);
+ break;
+
+ case 5:
+ ptr = StringCopy(gUnk2002694, gUnknown_083B6DF4[index].text);
+ ptr = StringCopy(ptr, gUnk20026e4);
+ break;
+
+ case 1:
+ // {var} + " is selected."
+ ptr = StringCopy(gUnk2002694, gUnk20011fa);
+ ptr = StringCopy(ptr, gUnknown_083B6DF4[index].text);
+ break;
+
+ case 4:
+ // TODO: fix for German
+ // {var} + " was released."
+ ptr = StringCopy(gUnk2002694, gUnk20026e4);
+ ptr = StringCopy(ptr, gUnknown_083B6DF4[index].text);
+ break;
+
+ case 3:
+ {
+ u8 *stringLength;
+ u8 *text;
+
+ text = gUnknown_083B6DF4[index].text;
+ stringLength = &text[StringLength(text)] + 1;
+
+ ptr = StringCopy(gUnk2002694, gUnknown_083B6DF4[index].text);
+ ptr = StringCopy(ptr, gUnk20011fa);
+ ptr = StringCopy(ptr, stringLength);
+ }
+ break;
+
+ case 6:
+ // "Bye-bye, ".substr(0, -1) + {var} + "Bye-bye, !".substr(-1, 1)
+ {
+ u8 *stringLength;
+ u8 *text;
+
+ text = gUnknown_083B6DF4[index].text;
+ stringLength = &text[StringLength(text)] - 1;
+
+ ptr = StringCopy(gUnk2002694, gUnknown_083B6DF4[index].text);
+ ptr = StringCopy(ptr - 1, gUnk20026e4);
+ ptr = StringCopy(ptr, stringLength);
+ }
+ break;
+
+ case 0:
+ default:
+ ptr = StringCopy(gUnk2002694, gUnknown_083B6DF4[index].text);
+ break;
+ }
+
+ while (ptr < gUnk20026A6)
+ {
+ ptr[0] = CHAR_SPACE;
+ ptr++;
+ }
+
+ ptr[0] = EOS;
+ MenuPrint(gUnk2002694, 11, 17);
+}
diff --git a/src/pokenav.c b/src/pokenav.c
new file mode 100644
index 000000000..60e7c73e1
--- /dev/null
+++ b/src/pokenav.c
@@ -0,0 +1,45 @@
+#include "global.h"
+#include "battle.h"
+#include "string_util.h"
+
+struct UnkPokenavStruct_Sub {
+ /*0x0*/ u16 unk0;
+ /*0x2*/ u8 filler2[6];
+};
+
+
+struct UnkPokenavStruct {
+ /*0x0000*/ u8 filler0000[0xCEE8];
+ /*0xCEE8*/ struct UnkPokenavStruct_Sub unkCEE8[78];
+ /*0xD158*/ u16 unkD158;
+
+};
+
+extern struct UnkPokenavStruct *gUnknown_083DFEC4;
+
+extern const struct Trainer gTrainers[];
+extern const u8 gTrainerClassNames[][13];
+
+void sub_80F700C(u8 *arg0, u16 arg1) {
+ struct Trainer *trainer;
+ u8 *ptr;
+
+ trainer = (struct Trainer *) &gTrainers[gUnknown_083DFEC4->unkCEE8[arg1].unk0];
+
+ ptr = arg0;
+ if (arg1 < gUnknown_083DFEC4->unkD158)
+ {
+ ptr = StringCopy(ptr, gTrainerClassNames[trainer->trainerClass]);
+
+ ptr[0] = 0xFC;
+ ptr[1] = 0x13;
+ ptr[2] = 0x4B;
+ ptr += 3;
+ ptr = StringCopy(ptr, trainer->trainerName);
+ }
+
+ ptr[0] = 0xFC;
+ ptr[1] = 0x13;
+ ptr[2] = 0x80;
+ ptr[3] = 0xFF;
+}
diff --git a/src/record_mixing.c b/src/record_mixing.c
index c08128637..76fe13059 100644
--- a/src/record_mixing.c
+++ b/src/record_mixing.c
@@ -31,8 +31,6 @@ extern u8 gUnknown_0300071C[];
extern u8 gOtherText_MixingComplete[];
extern u8 gOtherText_MixingRecordsWithFriend[];
extern bool8 gReceivedRemoteLinkPlayers;
-extern u8 gBlockSendBuffer[BLOCK_BUFFER_SIZE];
-extern u16 gBlockRecvBuffer[MAX_LINK_PLAYERS][BLOCK_BUFFER_SIZE / 2];
#define BUFFER_CHUNK_SIZE 200
diff --git a/src/rom3.c b/src/rom3.c
index b0ef7f088..126248705 100644
--- a/src/rom3.c
+++ b/src/rom3.c
@@ -13,7 +13,6 @@ extern u8 unk_2000000[];
#define EWRAM_15000 ((u8 *)(unk_2000000 + 0x15000))
extern u16 gBattleTypeFlags;
-extern u16 gBlockRecvBuffer[MAX_LINK_PLAYERS][BLOCK_BUFFER_SIZE / 2];
extern const u32 gBitTable[];
extern u16 gBattleWeather;
extern const struct BattleMove gBattleMoves[];
diff --git a/src/rom4.c b/src/rom4.c
index 5beb698ab..79ac6d769 100644
--- a/src/rom4.c
+++ b/src/rom4.c
@@ -13,7 +13,7 @@
#include "field_map_obj_helpers.h"
#include "field_message_box.h"
#include "field_player_avatar.h"
-#include "field_screeneffect.h"
+#include "field_weather.h"
#include "field_special_scene.h"
#include "heal_location.h"
#include "link.h"
diff --git a/src/save_failed_screen.c b/src/save_failed_screen.c
index 102909779..d46abc74d 100644
--- a/src/save_failed_screen.c
+++ b/src/save_failed_screen.c
@@ -150,9 +150,9 @@ static void CB2_SaveFailedScreen(void)
REG_IME = ime;
REG_DISPSTAT |= DISPSTAT_VBLANK_INTR;
SetVBlankCallback(VBlankCB);
- REG_BG3CNT = 0x703;
- REG_BG2CNT = 0x602;
- REG_BG0CNT = 0x1f08;
+ REG_BG3CNT = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(7) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_BG2CNT = BGCNT_PRIORITY(2) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(6) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_BG0CNT = BGCNT_PRIORITY(0) | BGCNT_CHARBASE(2) | BGCNT_SCREENBASE(31) | BGCNT_16COLOR | BGCNT_TXT256x256;
REG_DISPCNT = DISPCNT_OBJ_ON | DISPCNT_BG3_ON | DISPCNT_BG2_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP | DISPCNT_MODE_0;
gMain.state++;
break;
diff --git a/src/scrcmd.c b/src/scrcmd.c
index 7569462e6..136181bd3 100644
--- a/src/scrcmd.c
+++ b/src/scrcmd.c
@@ -13,7 +13,7 @@
#include "field_map_obj_helpers.h"
#include "field_message_box.h"
#include "field_player_avatar.h"
-#include "field_screeneffect.h"
+#include "field_weather.h"
#include "item.h"
#include "main.h"
#include "map_obj_lock.h"
diff --git a/src/secret_base.c b/src/secret_base.c
new file mode 100644
index 000000000..572dfaa1d
--- /dev/null
+++ b/src/secret_base.c
@@ -0,0 +1,18 @@
+#include "global.h"
+#include "string_util.h"
+#include "strings.h"
+#include "text.h"
+
+u8 sub_80BB8A8(void *);
+
+u8 *sub_80BC190(u8 *dest, u8 arg1) {
+ u8 local1;
+ u8 *str;
+
+ local1 = sub_80BB8A8(gSaveBlock1.secretBases[arg1].sbr_field_2);
+
+ str = StringCopyN(dest, gSaveBlock1.secretBases[arg1].sbr_field_2, local1);
+ str[0] = EOS;
+
+ return StringAppend(dest, gOtherText_PlayersBase);
+}
diff --git a/src/shop.c b/src/shop.c
index c78771be7..780dff02a 100644
--- a/src/shop.c
+++ b/src/shop.c
@@ -1,7 +1,7 @@
#include "global.h"
#include "asm.h"
#include "decompress.h"
-#include "field_screeneffect.h"
+#include "field_weather.h"
#include "main.h"
#include "menu.h"
#include "money.h"
diff --git a/src/slot_machine.c b/src/slot_machine.c
new file mode 100644
index 000000000..c087bf6b4
--- /dev/null
+++ b/src/slot_machine.c
@@ -0,0 +1,154 @@
+#include "global.h"
+#include "decompress.h"
+#include "palette.h"
+#include "task.h"
+
+struct UnkStruct2000000 {
+ /*0x00*/ u8 filler00[61];
+ /*0x3D*/ u8 unk3D;
+};
+
+struct UnkStruct1 {
+ /*0x00*/ u8 unk00;
+ /*0x01*/ u8 unk01;
+ /*0x02*/ s16 unk02;
+};
+
+extern struct UnkStruct2000000 unk_2000000;
+
+extern struct UnkStruct1 *gUnknown_083ED048[];
+extern const u16 gPalette_83EDE24[];
+
+extern const u8 gSlotMachine_Gfx[];
+#if ENGLISH
+#define SLOTMACHINE_GFX_TILES 233
+#elif GERMAN
+#define SLOTMACHINE_GFX_TILES 236
+#endif
+
+extern const u16 gUnknown_08E95A18[];
+
+extern u16 gUnknown_08E95AB8[];
+extern u16 gUnknown_08E95FB8[];
+
+
+void sub_8104DA4(void);
+
+u8 sub_8105BB4(u8, u8, s16);
+
+static void LoadSlotMachineWheelOverlay(void);
+
+void sub_8104CAC(u8 arg0) {
+ u8 i;
+ struct Task *task;
+
+ sub_8104DA4();
+
+ task = &gTasks[unk_2000000.unk3D];
+ task->data[1] = arg0;
+
+ i = 0;
+ while (gUnknown_083ED048[arg0][i].unk00 != 0xFF)
+ {
+ u8 spriteId;
+ spriteId = sub_8105BB4(
+ gUnknown_083ED048[arg0][i].unk00,
+ gUnknown_083ED048[arg0][i].unk01,
+ gUnknown_083ED048[arg0][i].unk02
+ );
+ task->data[4 + i] = spriteId;
+
+#ifdef GERMAN
+ if (arg0 == 5 && i <= 2)
+ {
+ gSprites[spriteId].invisible = TRUE;
+ }
+#endif
+
+ i += 1;
+ }
+}
+
+asm(".section .text_b");
+
+void sub_8106448(void) {
+ u32 offsetRead, offsetWrite;
+ u32 size;
+
+ sub_800D238(gSlotMachine_Gfx, (void *) 0x02010000);
+
+ offsetRead = 0x02010000;
+ offsetWrite = BG_VRAM;
+ size = SLOTMACHINE_GFX_TILES * 32;
+ while (TRUE)
+ {
+ DmaCopy16(3, offsetRead, (void *) (offsetWrite), 0x1000);
+ offsetRead += 0x1000;
+ offsetWrite += 0x1000;
+ size -= 0x1000;
+ if (size <= 0x1000)
+ {
+ DmaCopy16(3, offsetRead, (void *) (offsetWrite), size);
+ break;
+ }
+ }
+
+ LoadPalette(gUnknown_08E95A18, 0, 160);
+ LoadPalette(gPalette_83EDE24, 208, 32);
+}
+
+void sub_81064B8(void) {
+ CpuCopy16(gUnknown_08E95AB8, (void *) BG_SCREEN_ADDR(29), 20 * 32 * 2);
+ LoadSlotMachineWheelOverlay();
+}
+
+static void LoadSlotMachineWheelOverlay(void) {
+ s16 x, y, dx;
+ u16 *screen;
+
+ screen = (u16 *) BG_SCREEN_ADDR(30);
+
+ for (x = 4; x < 18; x += 5)
+ {
+ for (dx = 0; dx < 4; dx++)
+ {
+ screen[5 * 32 + dx + x] = 0x2051;
+ screen[13 * 32 + dx + x] = 0x2851;
+ screen[6 * 32 + dx + x] = 0x2061;
+ screen[12 * 32 + dx + x] = 0x2861;
+ }
+
+ screen[6 * 32 + x] = 0x20BE;
+ screen[12 * 32 + x] = 0x28BE;
+
+ for (y = 7; y <= 11; y++)
+ {
+ screen[y * 32 + x] = 0x20BF;
+ }
+ }
+}
+
+void sub_81065A8(s16 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4) {
+ u16 *vram = (u16 *) BG_SCREEN_ADDR(29);
+
+ vram[15 * 32 + arg0] = arg1;
+ vram[15 * 32 + 1 + arg0] = arg2;
+ vram[16 * 32 + arg0] = arg3;
+ vram[16 * 32 + 1 + arg0] = arg4;
+}
+
+void sub_81065DC(void) {
+ s16 y, x;
+ u16 *screen;
+
+ CpuCopy16(gUnknown_08E95FB8, (void *) BG_SCREEN_ADDR(29), 20 * 32 * 2);
+
+ screen = (u16 *) BG_SCREEN_ADDR(30);
+ for (y = 0; y < 20; y++)
+ {
+ for (x = 0; x < 30; x++)
+ {
+ screen[x + y * 32] = 0;
+ }
+ }
+}
diff --git a/src/start_menu.c b/src/start_menu.c
index 48217219d..37d361c0b 100644
--- a/src/start_menu.c
+++ b/src/start_menu.c
@@ -4,7 +4,7 @@
#include "event_data.h"
#include "field_map_obj_helpers.h"
#include "field_player_avatar.h"
-#include "field_screeneffect.h"
+#include "field_weather.h"
#include "load_save.h"
#include "main.h"
#include "map_obj_lock.h"
@@ -782,7 +782,7 @@ static bool32 sub_80719FC(u8 *step)
case 2:
SetUpWindowConfig(&gWindowConfig_81E6CE4);
InitMenuWindow(&gWindowConfig_81E6CE4);
- REG_DISPCNT = 0x100;
+ REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_BG0_ON;
break;
case 3:
{
diff --git a/src/starter_choose.c b/src/starter_choose.c
index 63d153ebd..6ef410d21 100644
--- a/src/starter_choose.c
+++ b/src/starter_choose.c
@@ -325,9 +325,9 @@ void CB2_ChooseStarter(void)
REG_BLDCNT = 0xFE;
REG_BLDALPHA = 0;
REG_BLDY = 0x7;
- REG_BG3CNT = 0x703;
- REG_BG2CNT = 0x602;
- REG_BG0CNT = 0x1F08;
+ REG_BG3CNT = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(7) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_BG2CNT = BGCNT_PRIORITY(2) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(6) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_BG0CNT = BGCNT_PRIORITY(0) | BGCNT_CHARBASE(2) | BGCNT_SCREENBASE(31) | BGCNT_16COLOR | BGCNT_TXT256x256;
REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG2_ON | DISPCNT_BG3_ON | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON;
taskId = CreateTask(Task_StarterChoose1, 0);
diff --git a/src/wallclock.c b/src/wallclock.c
index 2f4d694a6..0f3665c65 100644
--- a/src/wallclock.c
+++ b/src/wallclock.c
@@ -256,8 +256,8 @@ static void WallClockInit(void)
REG_BLDCNT = 0;
REG_BLDALPHA = 0;
REG_BLDY = 0;
- REG_BG3CNT = 0x701;
- REG_BG0CNT = 0x1F08;
+ REG_BG3CNT = BGCNT_PRIORITY(1) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(7) | BGCNT_16COLOR | BGCNT_TXT256x256;
+ REG_BG0CNT = BGCNT_PRIORITY(0) | BGCNT_CHARBASE(2) | BGCNT_SCREENBASE(31) | BGCNT_16COLOR | BGCNT_TXT256x256;
REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON |
DISPCNT_BG3_ON | DISPCNT_OBJ_ON;
}