summaryrefslogtreecommitdiff
path: root/src/rom_8080874.c
diff options
context:
space:
mode:
authorProjectRevoTPP <projectrevotpp@hotmail.com>2017-01-10 23:17:43 -0500
committerYamaArashi <YamaArashi@users.noreply.github.com>2017-01-10 20:17:43 -0800
commitf88eeb607409528dadbf841f2cb8e805d6e86deb (patch)
tree6b4f6411a0e02bff918cb924251b68a5038ae1f8 /src/rom_8080874.c
parent6b0268e0c0fb98014cb72f8a918a33c0645162d2 (diff)
more labels and finish decompiling battle_ai.c except for unk_24 (#184)
* labels for save_menu_util.c * formatting, i suck at it * fix sub_80712B4 to not use MyTask struct * pls don't kill me * current changes * decompile BattleAICmd_if_damage_bonus * formatting * label thinking struct unk8 * decompile BattleAICMd_if_status_not_in_party * decompile more battle_ai.c functions * Began decompilation of a random file * decompile BattleAICmd_if_can_faint and BattleAICmd_if_cant_faint * decompile unk_3F and unk_40 * decompile if_move_effect and if_not_move_effect * formatting, silly * decompile if_last_move_did_damage and if_encored * decompile unk_45 if_random_2 and unk_47 * decompile get_hold_effect and get_gender * decompile is_first_turn and get_stockpile_count * decompile unk_4C and get_item * decompile unk_4E unk_4F and unk_50 * decompile get_protect_count and the remaining stub macros * decompile call jump and unk_5A * decompile if_level_cond * decompile the last AI macros besides unk_24 * finish decompiling battle_ai.c except for unk_24
Diffstat (limited to 'src/rom_8080874.c')
-rw-r--r--src/rom_8080874.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/rom_8080874.c b/src/rom_8080874.c
new file mode 100644
index 000000000..8c41b913a
--- /dev/null
+++ b/src/rom_8080874.c
@@ -0,0 +1,85 @@
+#include "global.h"
+#include "global.fieldmap.h"
+#include "gba/syscall.h"
+#include "weather.h"
+#include "task.h"
+#include "script.h"
+
+void palette_bg_fill_white(void);
+void palette_bg_fill_black(void);
+void pal_fill_black(void);
+void task0A_asap_script_env_2_enable_and_set_ctx_running(u8);
+
+extern u8 get_map_light_from_warp0(void);
+extern u8 sav1_map_get_light_level(void);
+extern u8 fade_type_for_given_maplight_pair(u8, u8);
+extern u16 gPlttBufferFaded[];
+extern struct MapHeader * warp1_get_mapheader(void);
+extern void sub_8059B88(u8);
+extern void sub_8053E90(void);
+
+extern u8 sub_810CDB8(u8, u8);
+extern int sub_8080E70(void);
+
+void palette_bg_fill_white (void) {
+ u32 source_color = 0x7fff7fff;
+ CpuFastSet(&source_color, gPlttBufferFaded, 0x100 | (1 << 24));
+}
+
+void palette_bg_fill_black (void) {
+ u32 source_color = 0;
+ CpuFastSet(&source_color, gPlttBufferFaded, 0x100 | (1 << 24));
+}
+
+void pal_fill_for_map_transition (void) {
+ u8 map_light = get_map_light_from_warp0();
+ switch (fade_type_for_given_maplight_pair(map_light, sav1_map_get_light_level())) {
+ case 0:
+ fade_screen(0, 0);
+ palette_bg_fill_black();
+ break;
+ case 1:
+ fade_screen(2, 0);
+ palette_bg_fill_white();
+ }
+}
+
+void pal_fill_black (void) {
+ fade_screen(0, 0);
+ palette_bg_fill_black();
+}
+
+void fade_8080918 (void) {
+ u8 light_level = sav1_map_get_light_level();
+ switch (sub_810CDB8(light_level, warp1_get_mapheader() -> mapType)) {
+ case 0:
+ fade_screen(1, 0);
+ break;
+ case 1:
+ fade_screen(3, 0);
+ }
+}
+
+void sub_8080958 (u8 arg) {
+ sub_8059B88(!arg);
+}
+
+void task0A_asap_script_env_2_enable_and_set_ctx_running (u8 taskID) {
+ if (sub_8080E70() == 1) {
+ DestroyTask(taskID);
+ EnableBothScriptContexts();
+ }
+}
+
+void sub_8080990 (void) {
+ ScriptContext2_Enable();
+ sub_8053E90();
+ pal_fill_black();
+ CreateTask(&task0A_asap_script_env_2_enable_and_set_ctx_running, 0x0a);
+}
+
+void sub_80809B0 (void) {
+ ScriptContext2_Enable();
+ pal_fill_black();
+ CreateTask(&task0A_asap_script_env_2_enable_and_set_ctx_running, 0x0a);
+}