summaryrefslogtreecommitdiff
path: root/src/field/field_weather.c
diff options
context:
space:
mode:
authorProjectRevoTPP <projectrevotpp@hotmail.com>2018-02-18 20:21:56 -0500
committerProjectRevoTPP <projectrevotpp@hotmail.com>2018-02-18 20:21:56 -0500
commit958dac2cf952ff94767ddec90bc3b1ddd0887a51 (patch)
tree41cfe9278c3590493c3ba4ed904fc08e44c377e9 /src/field/field_weather.c
parent2ecf9cb5f3f89ad8c9bbe64957de40ac509e4ea7 (diff)
parent2e21a867487e2187a954a351f775bd3f3a9535b1 (diff)
Merge branch 'master' of https://github.com/pret/pokeruby into visual_studio
Diffstat (limited to 'src/field/field_weather.c')
-rw-r--r--src/field/field_weather.c251
1 files changed, 81 insertions, 170 deletions
diff --git a/src/field/field_weather.c b/src/field/field_weather.c
index 3f500ba50..5857145ef 100644
--- a/src/field/field_weather.c
+++ b/src/field/field_weather.c
@@ -1,12 +1,15 @@
#include "global.h"
+#include "constants/songs.h"
+#include "constants/weather.h"
#include "blend_palette.h"
#include "event_object_movement.h"
#include "field_weather.h"
+#include "main.h"
+#include "menu.h"
#include "palette.h"
#include "random.h"
#include "script.h"
-#include "constants/weather.h"
-#include "constants/songs.h"
+#include "start_menu.h"
#include "sound.h"
#include "sprite.h"
#include "task.h"
@@ -15,7 +18,8 @@
#define MACRO1(color) ((((color) >> 1) & 0xF) | (((color) >> 2) & 0xF0) | (((color) >> 3) & 0xF00))
-enum {
+enum
+{
GAMMA_NONE,
GAMMA_NORMAL,
GAMMA_ALT,
@@ -44,9 +48,6 @@ struct WeatherCallbacks
EWRAM_DATA struct Weather gWeather = {0};
EWRAM_DATA u8 gFieldEffectPaletteGammaTypes[32] = {0};
EWRAM_DATA u16 gUnknown_0202FF58 = 0;
-#if DEBUG
-EWRAM_DATA u16 gUnknown_Debug_20301FE = 0;
-#endif
static const u8 *sPaletteGammaTypes;
@@ -215,39 +216,39 @@ static const u8 sBasePaletteGammaTypes[32] =
#if DEBUG
-const u8 gDebugText_Weather_0[] = _("なし   ");
-const u8 gDebugText_Weather_1[] = _("はれ   ");
-const u8 gDebugText_Weather_2[] = _("はれ2  ");
-const u8 gDebugText_Weather_3[] = _("あめ   ");
-const u8 gDebugText_Weather_4[] = _("ゆき   ");
-const u8 gDebugText_Weather_5[] = _("かみなり ");
-const u8 gDebugText_Weather_6[] = _("きり   ");
-const u8 gDebugText_Weather_7[] = _("かざんばい");
-const u8 gDebugText_Weather_8[] = _("すなあらし");
-const u8 gDebugText_Weather_9[] = _("きり2  ");
-const u8 gDebugText_Weather_10[] = _("かいてい ");
-const u8 gDebugText_Weather_11[] = _("くもり  ");
-const u8 gDebugText_Weather_12[] = _("はれ3  ");
-const u8 gDebugText_Weather_13[] = _("おおあめ");
-const u8 gDebugText_Weather_14[] = _("かいてい2");
-
-const u8 *const gDebugText_Weather[] =
+static const u8 sDebugText_Weather_None[] = _("なし   "); // "none"
+static const u8 sDebugText_Weather_Clear[] = _("はれ   "); // "clear"
+static const u8 sDebugText_Weather_Clear2[] = _("はれ2  "); // "clear2"
+static const u8 sDebugText_Weather_Rain[] = _("あめ   "); // "rain"
+static const u8 sDebugText_Weather_Snow[] = _("ゆき   "); // "snow"
+static const u8 sDebugText_Weather_Lightning[] = _("かみなり "); // "lightning"
+static const u8 sDebugText_Weather_Fog[] = _("きり   "); // "fog"
+static const u8 sDebugText_Weather_VolcanicAsh[] = _("かざんばい"); // "volcanic ash"
+static const u8 sDebugText_Weather_Sandstorm[] = _("すなあらし"); // "sandstorm
+static const u8 sDebugText_Weather_Fog2[] = _("きり2  "); // "fog2"
+static const u8 sDebugText_Weather_Underwater[] = _("かいてい "); // "undersea"
+static const u8 sDebugText_Weather_Cloudy[] = _("くもり  "); // "cloudy"
+static const u8 sDebugText_Weather_Clear3[] = _("はれ3  "); // "clear3"
+static const u8 sDebugText_Weather_HeavyRain[] = _("おおあめ"); // "heavy rain"
+static const u8 sDebugText_Weather_Underwater2[] = _("かいてい2"); // "undersea2"
+
+static const u8 *const sDebugText_Weather[] =
{
- gDebugText_Weather_0,
- gDebugText_Weather_1,
- gDebugText_Weather_2,
- gDebugText_Weather_3,
- gDebugText_Weather_4,
- gDebugText_Weather_5,
- gDebugText_Weather_6,
- gDebugText_Weather_7,
- gDebugText_Weather_8,
- gDebugText_Weather_9,
- gDebugText_Weather_10,
- gDebugText_Weather_11,
- gDebugText_Weather_12,
- gDebugText_Weather_13,
- gDebugText_Weather_14,
+ [WEATHER_NONE] = sDebugText_Weather_None,
+ [WEATHER_CLOUDS] = sDebugText_Weather_Clear,
+ [WEATHER_SUNNY] = sDebugText_Weather_Clear2,
+ [WEATHER_RAIN_LIGHT] = sDebugText_Weather_Rain,
+ [WEATHER_SNOW] = sDebugText_Weather_Snow,
+ [WEATHER_RAIN_MED] = sDebugText_Weather_Lightning,
+ [WEATHER_FOG_1] = sDebugText_Weather_Fog,
+ [WEATHER_ASH] = sDebugText_Weather_VolcanicAsh,
+ [WEATHER_SANDSTORM] = sDebugText_Weather_Sandstorm,
+ [WEATHER_FOG_2] = sDebugText_Weather_Fog2,
+ [WEATHER_FOG_3] = sDebugText_Weather_Underwater,
+ [WEATHER_SHADE] = sDebugText_Weather_Cloudy,
+ [WEATHER_DROUGHT] = sDebugText_Weather_Clear3,
+ [WEATHER_RAIN_HEAVY] = sDebugText_Weather_HeavyRain,
+ [WEATHER_BUBBLES] = sDebugText_Weather_Underwater2,
};
#endif
@@ -1258,142 +1259,52 @@ void ResetPreservedPalettesInWeather(void)
#if DEBUG
-__attribute__((naked))
-u8 debug_sub_8085564(void)
+EWRAM_DATA static u8 sSelectedDebugWeather = 0;
+
+bool8 debug_sub_8085564(void)
{
- asm("\
- push {lr}\n\
- mov r2, #0x0\n\
- ldr r0, ._375 @ gMain\n\
- ldrh r1, [r0, #0x2e]\n\
- mov r0, #0x80\n\
- lsl r0, r0, #0x1\n\
- and r0, r0, r1\n\
- cmp r0, #0\n\
- beq ._370 @cond_branch\n\
- ldr r1, ._375 + 4 @ gUnknown_Debug_20301FE\n\
- ldrb r0, [r1]\n\
- add r0, r0, #0x1\n\
- strb r0, [r1]\n\
- lsl r0, r0, #0x18\n\
- lsr r0, r0, #0x18\n\
- cmp r0, #0xf\n\
- bne ._371 @cond_branch\n\
- strb r2, [r1]\n\
-._371:\n\
- mov r2, #0x1\n\
-._370:\n\
- ldr r0, ._375 @ gMain\n\
- ldrh r1, [r0, #0x2e]\n\
- mov r0, #0x80\n\
- lsl r0, r0, #0x2\n\
- and r0, r0, r1\n\
- cmp r0, #0\n\
- beq ._372 @cond_branch\n\
- ldr r1, ._375 + 4 @ gUnknown_Debug_20301FE\n\
- ldrb r0, [r1]\n\
- cmp r0, #0\n\
- beq ._373 @cond_branch\n\
- sub r0, r0, #0x1\n\
- b ._374\n\
-._376:\n\
- .align 2, 0\n\
-._375:\n\
- .word gMain\n\
- .word gUnknown_Debug_20301FE\n\
-._373:\n\
- mov r0, #0xe\n\
-._374:\n\
- strb r0, [r1]\n\
- mov r2, #0x1\n\
-._372:\n\
- cmp r2, #0\n\
- beq ._377 @cond_branch\n\
- mov r0, #0x16\n\
- mov r1, #0x1\n\
- mov r2, #0x1c\n\
- mov r3, #0x2\n\
- bl Menu_BlankWindowRect\n\
- ldr r1, ._380 @ gDebugText_Weather\n\
- ldr r0, ._380 + 4 @ gUnknown_Debug_20301FE\n\
- ldrb r0, [r0]\n\
- lsl r0, r0, #0x2\n\
- add r0, r0, r1\n\
- ldr r0, [r0]\n\
- mov r1, #0x17\n\
- mov r2, #0x1\n\
- bl Menu_PrintText\n\
-._377:\n\
- ldr r0, ._380 + 8 @ gMain\n\
- ldrh r1, [r0, #0x2e]\n\
- mov r0, #0x1\n\
- and r0, r0, r1\n\
- cmp r0, #0\n\
- bne ._378 @cond_branch\n\
- mov r0, #0x0\n\
- b ._379\n\
-._381:\n\
- .align 2, 0\n\
-._380:\n\
- .word gDebugText_Weather\n\
- .word gUnknown_Debug_20301FE\n\
- .word gMain\n\
-._378:\n\
- ldr r0, ._382 @ gUnknown_Debug_20301FE\n\
- ldrb r0, [r0]\n\
- bl ChangeWeather\n\
- bl CloseMenu\n\
- mov r0, #0x1\n\
-._379:\n\
- pop {r1}\n\
- bx r1\n\
-._383:\n\
- .align 2, 0\n\
-._382:\n\
- .word gUnknown_Debug_20301FE");
+ bool8 changed = FALSE;
+
+ if (gMain.newKeys & R_BUTTON)
+ {
+ sSelectedDebugWeather++;
+ if (sSelectedDebugWeather == 15)
+ sSelectedDebugWeather = 0;
+ changed = TRUE;
+ }
+ if (gMain.newKeys & L_BUTTON)
+ {
+ if (sSelectedDebugWeather != 0)
+ sSelectedDebugWeather--;
+ else
+ sSelectedDebugWeather = 14;
+ changed = TRUE;
+ }
+
+ if (changed)
+ {
+ Menu_BlankWindowRect(22, 1, 28, 2);
+ Menu_PrintText(sDebugText_Weather[sSelectedDebugWeather], 23, 1);
+ }
+
+ if (gMain.newKeys & A_BUTTON)
+ {
+ ChangeWeather(sSelectedDebugWeather);
+ CloseMenu();
+ return TRUE;
+ }
+
+ return FALSE;
}
-__attribute__((naked))
-u8 debug_sub_808560C(void)
+bool8 debug_sub_808560C(void)
{
- asm("\
- push {r4, lr}\n\
- ldr r4, ._384 @ gUnknown_Debug_20301FE\n\
- ldr r0, ._384 + 4 @ gWeather\n\
- mov r1, #0xda\n\
- lsl r1, r1, #0x3\n\
- add r0, r0, r1\n\
- ldrb r0, [r0]\n\
- strb r0, [r4]\n\
- bl Menu_EraseScreen\n\
- mov r0, #0x16\n\
- mov r1, #0x1\n\
- mov r2, #0x1c\n\
- mov r3, #0x2\n\
- bl Menu_BlankWindowRect\n\
- ldr r1, ._384 + 8 @ gDebugText_Weather\n\
- ldrb r0, [r4]\n\
- lsl r0, r0, #0x2\n\
- add r0, r0, r1\n\
- ldr r0, [r0]\n\
- mov r1, #0x17\n\
- mov r2, #0x1\n\
- bl Menu_PrintText\n\
- ldr r1, ._384 + 12 @ gMenuCallback\n\
- ldr r0, ._384 + 16 @ debug_sub_8085564\n\
- str r0, [r1]\n\
- mov r0, #0x0\n\
- pop {r4}\n\
- pop {r1}\n\
- bx r1\n\
-._385:\n\
- .align 2, 0\n\
-._384:\n\
- .word gUnknown_Debug_20301FE\n\
- .word gWeather\n\
- .word gDebugText_Weather\n\
- .word gMenuCallback\n\
- .word debug_sub_8085564+1");
+ sSelectedDebugWeather = gWeather.currWeather;
+ Menu_EraseScreen();
+ Menu_BlankWindowRect(22, 1, 28, 2);
+ Menu_PrintText(sDebugText_Weather[sSelectedDebugWeather], 23, 1);
+ gMenuCallback = debug_sub_8085564;
+ return FALSE;
}
#endif