diff --git a/data/fldeff_flash.s b/data/fldeff_flash.s deleted file mode 100644 index 3c3071b37..000000000 --- a/data/fldeff_flash.s +++ /dev/null @@ -1,81 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_085B27C8:: @ 85B27C8 - .byte 0x01, 0x04, 0x01, 0x00 - .4byte sub_81375A8 - - .byte 0x02, 0x04, 0x01, 0x00 - .4byte sub_81375A8 - - .byte 0x03, 0x04, 0x01, 0x00 - .4byte sub_81375A8 - - .byte 0x05, 0x04, 0x01, 0x00 - .4byte sub_81375A8 - - .byte 0x06, 0x04, 0x01, 0x00 - .4byte sub_81375A8 - - .byte 0x07, 0x04, 0x01, 0x00 - .4byte sub_81375A8 - - .byte 0x08, 0x04, 0x01, 0x00 - .4byte sub_81375A8 - - .byte 0x09, 0x04, 0x01, 0x00 - .4byte sub_81375A8 - - .byte 0x04, 0x01, 0x00, 0x01 - .4byte sub_81373F0 - - .byte 0x04, 0x02, 0x00, 0x01 - .4byte sub_81373F0 - - .byte 0x04, 0x03, 0x00, 0x01 - .4byte sub_81373F0 - - .byte 0x04, 0x05, 0x00, 0x01 - .4byte sub_81373F0 - - .byte 0x04, 0x06, 0x00, 0x01 - .4byte sub_81373F0 - - .byte 0x04, 0x07, 0x00, 0x01 - .4byte sub_81373F0 - - .byte 0x04, 0x08, 0x00, 0x01 - .4byte sub_81373F0 - - .byte 0x04, 0x09, 0x00, 0x01 - .4byte sub_81373F0 - - .byte 0x00, 0x00, 0x00, 0x00 - .4byte NULL - - .align 2 -gCaveTransitionPalette_White:: @ 85B2850 - .incbin "graphics/misc/cave_transition_white.gbapal" - - .align 2 -gCaveTransitionPalette_Black:: @ 85B2870 - .incbin "graphics/misc/cave_transition_black.gbapal" - - .align 2 -gUnknown_085B2890:: @ 85B2890 - .incbin "graphics/misc/85B2890.gbapal" - - .align 2 -gUnknown_085B28A0:: @ 85B28A0 - .incbin "graphics/misc/85B28A0.gbapal" - - .align 2 -gCaveTransitionTilemap:: @ 85B28B0 - .incbin "graphics/misc/cave_transition_map.bin.lz" - - .align 2 -gCaveTransitionTiles:: @ 85B2A90 - .incbin "graphics/misc/cave_transition.4bpp.lz" diff --git a/include/braille_puzzles.h b/include/braille_puzzles.h new file mode 100644 index 000000000..780abeeba --- /dev/null +++ b/include/braille_puzzles.h @@ -0,0 +1,7 @@ +#ifndef GUARD_BRAILLE_PUZZLES_H +#define GUARD_BRAILLE_PUZZLES_H + +bool8 ShouldDoBrailleFlyEffect(void); +void sub_8179918(void); + +#endif // GUARD_BRAILLE_PUZZLES_H diff --git a/include/event_scripts.h b/include/event_scripts.h index a835782ed..4c5dfd544 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -22,6 +22,7 @@ extern const u8 EventScript_2713D1[]; extern const u8 EventScript_2766A2[]; extern const u8 EventScript_2766A6[]; + extern const u8 gTVBravoTrainerText00[]; extern const u8 gTVBravoTrainerText01[]; extern const u8 gTVBravoTrainerText02[]; @@ -381,6 +382,9 @@ extern const u8 SecretBase_RedCave1_Text_2751E1[]; extern const u8 SecretBase_RedCave1_Text_2754F6[]; extern const u8 SecretBase_RedCave1_Text_2758CC[]; +//field effects extern const u8 FieryPath_EventScript_2908FD[]; extern const u8 EventScript_290CAE[]; +extern const u8 EventScript_2926F8[]; + #endif //GUARD_EVENT_SCRIPTS_H diff --git a/include/roulette_util.h b/include/roulette_util.h new file mode 100644 index 000000000..f59c4e44c --- /dev/null +++ b/include/roulette_util.h @@ -0,0 +1,17 @@ +#ifndef GUARD_ROULETTE_UTIL_H +#define GUARD_ROULETTE_UTIL_H + +// structures +struct InnerStruct203CF18 +{ + u8 filler[0xC4]; +}; + +void sub_8151B68(struct InnerStruct203CF18 *, const u8*); +void sub_8151B3C(struct InnerStruct203CF18 *); +void sub_8151CA8(struct InnerStruct203CF18 *, u8, u8); +void sub_8151C50(struct InnerStruct203CF18 *, u8, u8); +void sub_8151D28(struct InnerStruct203CF18 *, u8, u8); +void sub_8151E50(struct InnerStruct203CF18 *); + +#endif // GUARD_ROULETTE_UTIL_H diff --git a/ld_script.txt b/ld_script.txt index 5f027d303..4b2b4ee3a 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -470,7 +470,7 @@ SECTIONS { data/starter_choose.o(.rodata); src/wallclock.o(.rodata); src/pokeblock.o(.rodata); - data/fldeff_flash.o(.rodata); + src/fldeff_flash.o(.rodata); src/time_events.o(.rodata); data/field_specials.o(.rodata); data/battle_records.o(.rodata); diff --git a/src/fldeff_flash.c b/src/fldeff_flash.c index 6a3a1a963..f31fe2b47 100644 --- a/src/fldeff_flash.c +++ b/src/fldeff_flash.c @@ -1,5 +1,6 @@ #include "global.h" #include "constants/songs.h" +#include "braille_puzzles.h" #include "event_data.h" #include "event_scripts.h" #include "field_effect.h" @@ -25,42 +26,53 @@ struct FlashStruct void (*func)(void); }; -// extern data -extern u8 EventScript_2926F8[]; - -// extern functions -extern bool8 ShouldDoBrailleFlyEffect(void); -extern void sub_8179918(void); - // static functions -void hm2_flash(void); -void sub_81371B4(void); -bool8 sub_8137304(void); -void sub_8137404(u8 taskId); -void sub_8137420(u8 taskId); -void sub_81374C4(u8 taskId); -void sub_813750C(u8 taskId); -void sub_8137574(u8 taskId); -void sub_81375BC(u8 taskId); -void sub_81375D8(u8 taskId); -void sub_8137678(u8 taskId); -void sub_81376DC(u8 taskId); +static void hm2_flash(void); +static void sub_81371B4(void); +static bool8 sub_8137304(void); +static void sub_81373F0(void); +static void sub_8137404(u8 taskId); +static void sub_8137420(u8 taskId); +static void sub_81374C4(u8 taskId); +static void sub_813750C(u8 taskId); +static void sub_8137574(u8 taskId); +static void sub_81375A8(void); +static void sub_81375BC(u8 taskId); +static void sub_81375D8(u8 taskId); +static void sub_8137678(u8 taskId); +static void sub_81376DC(u8 taskId); // rodata -extern struct FlashStruct gUnknown_085B27C8[]; +static const struct FlashStruct gUnknown_085B27C8[] = +{ + {1, 4, 1, 0, sub_81375A8}, + {2, 4, 1, 0, sub_81375A8}, + {3, 4, 1, 0, sub_81375A8}, + {5, 4, 1, 0, sub_81375A8}, + {6, 4, 1, 0, sub_81375A8}, + {7, 4, 1, 0, sub_81375A8}, + {8, 4, 1, 0, sub_81375A8}, + {9, 4, 1, 0, sub_81375A8}, + {4, 1, 0, 1, sub_81373F0}, + {4, 2, 0, 1, sub_81373F0}, + {4, 3, 0, 1, sub_81373F0}, + {4, 5, 0, 1, sub_81373F0}, + {4, 6, 0, 1, sub_81373F0}, + {4, 7, 0, 1, sub_81373F0}, + {4, 8, 0, 1, sub_81373F0}, + {4, 9, 0, 1, sub_81373F0}, + {0, 0, 0, 0, NULL}, +}; -/*static const*/ extern u16 gCaveTransitionPalette_White[];// = {0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF}; -/*static const*/ extern u16 gCaveTransitionPalette_Black[];// = {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}; +static const u16 gCaveTransitionPalette_White[] = INCBIN_U16("graphics/misc/cave_transition_white.gbapal"); +static const u16 gCaveTransitionPalette_Black[] = INCBIN_U16("graphics/misc/cave_transition_black.gbapal"); -/*static const*/ extern u16 gUnknown_085B2890[];// = INCBIN_U16("graphics/misc/83F808C.gbapal"); -/*static const*/ extern u16 gUnknown_085B28A0[];// = INCBIN_U16("graphics/misc/83F809C.gbapal"); -/*static const*/ extern u16 gCaveTransitionTilemap[];// = INCBIN_U16("graphics/misc/cave_transition_map.bin.lz"); -/*static const*/ extern u8 gCaveTransitionTiles[];// = INCBIN_U8("graphics/misc/cave_transition.4bpp.lz"); - -// ewram +static const u16 gUnknown_085B2890[] = INCBIN_U16("graphics/misc/85B2890.gbapal"); +static const u16 gUnknown_085B28A0[] = INCBIN_U16("graphics/misc/85B28A0.gbapal"); +static const u16 gCaveTransitionTilemap[] = INCBIN_U16("graphics/misc/cave_transition_map.bin.lz"); +static const u8 gCaveTransitionTiles[] = INCBIN_U8("graphics/misc/cave_transition.4bpp.lz"); // text - bool8 SetUpFieldMove_Flash(void) { if(ShouldDoBrailleFlyEffect()) @@ -80,7 +92,7 @@ bool8 SetUpFieldMove_Flash(void) return FALSE; } -void hm2_flash(void) +static void hm2_flash(void) { u8 taskId = oei_task_add(); gFieldEffectArguments[0] = GetCursorSelectionMonId(); @@ -88,14 +100,14 @@ void hm2_flash(void) gTasks[taskId].data[9] = (uintptr_t)sub_81371B4; } -void sub_81371B4(void) +static void sub_81371B4(void) { PlaySE(SE_W115); FlagSet(FLAG_SYS_USE_FLASH); ScriptContext1_SetupScript(EventScript_2926F8); } -void sub_81371D4(void) +static void sub_81371D4(void) { RunTasks(); AnimateSprites(); @@ -103,7 +115,7 @@ void sub_81371D4(void) UpdatePaletteFade(); } -void sub_81371EC(void) +static void sub_81371EC(void) { LoadOam(); ProcessSpriteCopyRequests(); @@ -141,7 +153,7 @@ void c2_change_map(void) SetMainCallback2(gMain.savedCallback); } -bool8 sub_8137304(void) +static bool8 sub_8137304(void) { u8 i; u8 v0 = get_map_light_from_warp0(); @@ -193,17 +205,17 @@ bool8 fade_type_for_given_maplight_pair(u8 a1, u8 a2) return FALSE; } -void sub_81373F0(void) +static void sub_81373F0(void) { CreateTask(sub_8137404, 0); } -void sub_8137404(u8 taskId) +static void sub_8137404(u8 taskId) { gTasks[taskId].func = sub_8137420; } -void sub_8137420(u8 taskId) +static void sub_8137420(u8 taskId) { SetGpuReg(REG_OFFSET_DISPCNT, 0); LZ77UnCompVram(gCaveTransitionTiles, (void *)0x600C000); @@ -233,7 +245,7 @@ void sub_8137420(u8 taskId) gTasks[taskId].data[1] = 0; } -void sub_81374C4(u8 taskId) +static void sub_81374C4(u8 taskId) { u16 count = gTasks[taskId].data[1]; u16 blend = count + 0x1000; @@ -250,11 +262,11 @@ void sub_81374C4(u8 taskId) } } -void sub_813750C(u8 taskId) +static void sub_813750C(u8 taskId) { u16 count; - SetGpuReg(REG_OFFSET_BLDALPHA, 4112); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 16)); count = gTasks[taskId].data[2]; if (count < 8) @@ -270,7 +282,7 @@ void sub_813750C(u8 taskId) } } -void sub_8137574(u8 taskId) +static void sub_8137574(u8 taskId) { if (gTasks[taskId].data[2]) gTasks[taskId].data[2]--; @@ -278,17 +290,17 @@ void sub_8137574(u8 taskId) SetMainCallback2(gMain.savedCallback); } -void sub_81375A8(void) +static void sub_81375A8(void) { CreateTask(sub_81375BC, 0); } -void sub_81375BC(u8 taskId) +static void sub_81375BC(u8 taskId) { gTasks[taskId].func = sub_81375D8; } -void sub_81375D8(u8 taskId) +static void sub_81375D8(u8 taskId) { SetGpuReg(REG_OFFSET_DISPCNT, 0); LZ77UnCompVram(gCaveTransitionTiles, (void *)0x600C000); @@ -313,7 +325,7 @@ void sub_81375D8(u8 taskId) gTasks[taskId].data[2] = 0; } -void sub_8137678(u8 taskId) +static void sub_8137678(u8 taskId) { u16 count = gTasks[taskId].data[2]; @@ -337,7 +349,7 @@ void sub_8137678(u8 taskId) } } -void sub_81376DC(u8 taskId) +static void sub_81376DC(u8 taskId) { u16 count = 16 - gTasks[taskId].data[1]; u16 blend = count + 0x1000; diff --git a/src/fldeff_groundshake.c b/src/fldeff_groundshake.c index e16b01b6e..bee4d2c4b 100644 --- a/src/fldeff_groundshake.c +++ b/src/fldeff_groundshake.c @@ -7,17 +7,13 @@ #include "field_map_obj.h" #include "malloc.h" #include "random.h" +#include "roulette_util.h" #include "script.h" #include "sound.h" #include "sprite.h" #include "task.h" // structures -struct InnerStruct203CF18 -{ - u8 filler[0xC4]; -}; - struct Struct203CF18 { u8 taskId; struct InnerStruct203CF18 unk4; @@ -27,14 +23,6 @@ struct Struct203CF18 { extern const struct SpriteSheet gUnknown_08617D94[]; extern const s16 gUnknown_08617D64[][3]; -// extern functions -extern void sub_8151B68(struct InnerStruct203CF18 *, const u8*); -extern void sub_8151B3C(struct InnerStruct203CF18 *); -extern void sub_8151CA8(struct InnerStruct203CF18 *, u8, u8); -extern void sub_8151C50(struct InnerStruct203CF18 *, u8, u8); -extern void sub_8151D28(struct InnerStruct203CF18 *, u8, u8); -extern void sub_8151E50(struct InnerStruct203CF18 *); - // static functions static void sub_81BE808(u8 taskId); static void sub_81BE900(u8 taskId); diff --git a/src/fldeff_softboiled.c b/src/fldeff_softboiled.c index b61cf9f32..d0a40a9a9 100644 --- a/src/fldeff_softboiled.c +++ b/src/fldeff_softboiled.c @@ -9,10 +9,10 @@ #include "strings.h" #include "task.h" -void sub_816166C(u8 taskId); -void sub_81617B8(u8 taskId); -void sub_81616C0(u8 taskId); -void sub_8161724(u8 taskId); +static void sub_816166C(u8 taskId); +static void sub_81616C0(u8 taskId); +static void sub_8161724(u8 taskId); +static void sub_81617B8(u8 taskId); bool8 SetUpFieldMove_SoftBoiled(void) { @@ -63,13 +63,13 @@ void sub_81615A8(u8 taskId) sub_81B1F18(taskId, unk9, -1, GetMonData(&gPlayerParty[unk9], MON_DATA_MAX_HP)/5, sub_816166C); } -void sub_816166C(u8 taskId) +static void sub_816166C(u8 taskId) { PlaySE(SE_KAIFUKU); sub_81B1F18(taskId, gUnknown_0203CEC8.unkA, 1, GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_MAX_HP)/5, sub_81616C0); } -void sub_81616C0(u8 taskId) +static void sub_81616C0(u8 taskId) { GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.unkA], gStringVar1); StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2); @@ -78,7 +78,7 @@ void sub_81616C0(u8 taskId) gTasks[taskId].func = sub_8161724; } -void sub_8161724(u8 taskId) +static void sub_8161724(u8 taskId) { if(sub_81B1BD4() == 1) return; @@ -92,7 +92,7 @@ void sub_8161724(u8 taskId) gTasks[taskId].func = sub_81B1370; } -void sub_8161784(u8 taskId) +static void sub_8161784(u8 taskId) { if(sub_81B1BD4() == 1) return; @@ -100,7 +100,7 @@ void sub_8161784(u8 taskId) gTasks[taskId].func = sub_81B1370; } -void sub_81617B8(u8 taskId) +static void sub_81617B8(u8 taskId) { PlaySE(SE_SELECT); sub_81B1B5C(&gText_CantBeUsedOnPkmn, 0); diff --git a/src/fldeff_strength.c b/src/fldeff_strength.c index c1965d983..162479c73 100644 --- a/src/fldeff_strength.c +++ b/src/fldeff_strength.c @@ -7,9 +7,11 @@ #include "script.h" #include "task.h" -void FldEff_UseStrength(void); -void sub_8145E74(void); +// static functions +static void FldEff_UseStrength(void); +static void sub_8145E74(void); +// text bool8 SetUpFieldMove_Strength(void) { if (npc_before_player_of_type(87) == TRUE) @@ -22,7 +24,7 @@ bool8 SetUpFieldMove_Strength(void) return FALSE; } -void FldEff_UseStrength(void) +static void FldEff_UseStrength(void) { gFieldEffectArguments[0] = GetCursorSelectionMonId(); ScriptContext1_SetupScript(FieryPath_EventScript_2908FD); @@ -37,7 +39,7 @@ bool8 sub_8145E2C(void) return FALSE; } -void sub_8145E74(void) +static void sub_8145E74(void) { FieldEffectActiveListRemove(FLDEFF_USE_STRENGTH); EnableBothScriptContexts();