diff --git a/include/code_80118A4.h b/include/code_80118A4.h index 308c910e6..4136d450e 100644 --- a/include/code_80118A4.h +++ b/include/code_80118A4.h @@ -7,10 +7,15 @@ void PlaySound(u16); void sub_801180C(void); void sub_8011830(void); void sub_8011860(void); -void xxx_call_fade_in_new_bgm(u16, u16); -void xxx_call_fade_out_bgm(u16); +void xxx_call_fade_in_new_bgm(u16 songIndex, u16 speed); +void xxx_call_fade_out_bgm(u16 speed); void xxx_call_start_bg_music(void); void xxx_call_stop_bgm(void); -void xxx_call_stop_fanfare_se(u16); +void xxx_call_stop_fanfare_se(u16 songIndex); +void StopAllMusic_1(void); +void xxx_call_start_new_bgm(u16 songIndex); +void xxx_call_queue_bgm(u16 songIndex); +void xxx_call_play_fanfare_se(u16 songIndex, u16 volume); +void xxx_call_fade_out_fanfare_se(u16 songIndex, u16 speed); -#endif // GUARD_CODE_80118A4_H \ No newline at end of file +#endif // GUARD_CODE_80118A4_H diff --git a/include/ground_main.h b/include/ground_main.h index 432b7c2ac..aceca0191 100644 --- a/include/ground_main.h +++ b/include/ground_main.h @@ -27,6 +27,7 @@ bool8 GroundMainRescueRequest(s16 r0, u32 r1); bool32 GroundMainGameEndRequest(u32 r0); bool32 GroundMainGameCancelRequest(u32 r0); +bool8 sub_8098D80(u32 speed); extern GroundConversionStruct gGroundConversion_811BAF4[10]; diff --git a/include/ground_script.h b/include/ground_script.h index c001a4fcb..987e00af9 100644 --- a/include/ground_script.h +++ b/include/ground_script.h @@ -139,8 +139,15 @@ extern FunctionScript gFunctionScriptTable[]; #include "debug.h" +void InitScriptData(ScriptData *a0); +u8 sub_809D8EC(Action *param_1, s16 param_2); +void sub_809D648(Action *action); +void sub_809D710(Action *param_1, ScriptInfoSmall *script, s16 index); +bool8 sub_809DA08(Action *param_1, s16 index, u32 param_3); +bool8 InitActionScriptData(Action *param_1, const DebugLocation *unused); bool8 GroundScript_ExecutePP(Action *, s32 *, ScriptInfoSmall *, const DebugLocation *unused); ScriptCommand *sub_80A242C(Action *action, s32 r1); ScriptCommand *sub_80A2460(Action *action, s32 r1); +void InitActionWithParams(Action *action, const CallbackData *callbacks, void *parent, s16 group, s8 sector); #endif // GUARD_GROUND_SCRIPT_H diff --git a/src/ground_map.c b/src/ground_map.c index b07deb84c..f7cee1d59 100644 --- a/src/ground_map.c +++ b/src/ground_map.c @@ -13,9 +13,7 @@ extern const CallbackData gUnknown_811736C; extern const DebugLocation gUnknown_8117538[]; extern void InitActionWithParams(Action *action, const CallbackData *callbacks, void *parent, s16 group, s8 sector); -extern void sub_809D648(void *); extern void sub_80A2D00(unkStruct_3001B70 *); -extern void InitActionScriptData(GroundMapAction *, const DebugLocation *); extern void sub_80A2D68(unkStruct_3001B70 *); extern void sub_80A2D88(unkStruct_3001B70 *); @@ -32,7 +30,7 @@ void FreeGroundMapAction(void) { GroundMap_Reset(); sub_80A5EBC(); - sub_809D648(gGroundMapAction); + sub_809D648((Action *)gGroundMapAction); MemoryFree(gGroundMapAction); gGroundMapAction = NULL; } @@ -41,7 +39,7 @@ void GroundMap_Reset(void) { sub_80015C0(0, 0x37); sub_80015C0(0, 0x38); - InitActionScriptData(gGroundMapAction, gUnknown_8117538); + InitActionScriptData((Action *)gGroundMapAction, gUnknown_8117538); if (gUnknown_3001B70 != NULL) { sub_80A2D00(gUnknown_3001B70); diff --git a/src/ground_map_1.c b/src/ground_map_1.c index ca1e42dd3..32e050e52 100644 --- a/src/ground_map_1.c +++ b/src/ground_map_1.c @@ -16,7 +16,6 @@ extern const DebugLocation gUnknown_8117698; extern void GroundMap_GetStationScript(ScriptInfoSmall *, s16, u32, u32); extern u8 sub_809D678(void *); -extern void sub_809D710(u8 *, ScriptInfoSmall *, s32); extern bool8 sub_809D968(void *, s32); static void sub_80A4BE8(ScriptInfoSmall *script, s16 r1) diff --git a/src/ground_script.c b/src/ground_script.c index a87deb888..9219272fe 100644 --- a/src/ground_script.c +++ b/src/ground_script.c @@ -195,7 +195,7 @@ void sub_809D710(Action *param_1, ScriptInfoSmall *script, s16 index) } } -bool8 InitActionScriptData(Action *param_1, DebugLocation *unused) +bool8 InitActionScriptData(Action *param_1, const DebugLocation *unused) { InitScriptData(¶m_1->scriptData); InitScriptData(¶m_1->scriptData2); diff --git a/src/ground_script_1.c b/src/ground_script_1.c index 1e54db691..63b65ebe0 100644 --- a/src/ground_script_1.c +++ b/src/ground_script_1.c @@ -8,6 +8,9 @@ #include "other_random.h" #include "rescue_team_info.h" #include "code_80118A4.h" +#include "code_8097670.h" +#include "exclusive_pokemon.h" +#include "items.h" #ifndef NONMATCHING #define GROUND_SCRIPT_INCOMPLETE_DECLARATIONS @@ -94,27 +97,15 @@ u32 sub_8002D54(); u8 sub_8002DF0(Position32*, Position32*, Position32*, Position32*); s32 sub_8009FB8(); -// TODO: move to code_80118A4.h -u32 StopAllMusic_1(); -u32 xxx_call_start_new_bgm(); -u32 xxx_call_queue_bgm(); -u32 xxx_call_play_fanfare_se(); -u32 xxx_call_fade_out_fanfare_se(); - bool8 sub_8021700(s32); bool8 sub_802FCF0(void); -s32 FindItemInInventory(); -u32 ShiftItemsDownFrom(); void sub_809733C(s16, bool8); void sub_80973A8(s16, bool8); void sub_8097418(s16, bool8); void sub_80975A8(s16, bool8); -void sub_80976F8(u8); -u32 sub_8098100(); void sub_8098D1C(s32, u32, s32); -void sub_8098D80(s32); void sub_8098E18(s32, s32); u32 sub_80999E8(); u32 sub_80999FC(); @@ -129,7 +120,7 @@ u32 sub_809A738(); u32 sub_809A768(); bool8 ScriptPrintNullTextbox(void); bool8 ScriptPrintEmptyTextbox(void); -u32 sub_809A83C(); +void sub_809A83C(s16); u32 sub_809AC7C(); u32 sub_809ADD8(); bool8 ScriptPrintText(s32, s16, char*); @@ -154,12 +145,8 @@ void sub_809D1E4(s32, s32, s32); void sub_809D208(s32, Position32*, s32); void sub_809D220(s32, s32, s32); u32 sub_809D52C(); -u32 InitScriptData(); -void sub_809D710(Action*, ScriptInfoSmall*, s16); -u8 sub_809D8EC(Action*, s16); bool8 sub_809D940(void); void sub_809D9B8(s16); -bool8 sub_809DA08(Action*, s16, u8); s16 sub_80A4D7C(s32); s16 sub_80A7AE8(s16); void sub_80A87AC(s32, s32); @@ -183,9 +170,7 @@ void DeleteBlankGroundObjects(void); void DeleteBlankGroundEffects(void); u32 sub_80A14E8(u32, u8, u32, u32); -extern void InitActionWithParams(Action *action, const CallbackData *callbacks, void *parent, s16 group, s8 sector); s16 HandleAction(void *, DebugLocation *); -extern void sub_809D648(void *); extern int gFormatData_202DE30[10]; @@ -1614,7 +1599,9 @@ s32 ExecuteScriptCommand(Action *action) { break; } case 0x41: { - if (FindItemInInventory((u8)curCmd.argShort) >= 0) ShiftItemsDownFrom(); + s32 val; + val = FindItemInInventory(curCmd.argShort); + if ( val >= 0) ShiftItemsDownFrom(val); break; } case 0xc0 ... 0xcb: {