From 0eba7e0870f3f7e51b69a1f1a7e1e436a977f78b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 5 Jan 2019 23:13:12 -0500 Subject: Start porting scrcmd from emerald --- src/scrcmd.c | 223 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 223 insertions(+) create mode 100644 src/scrcmd.c (limited to 'src/scrcmd.c') diff --git a/src/scrcmd.c b/src/scrcmd.c new file mode 100644 index 000000000..bb8d969c1 --- /dev/null +++ b/src/scrcmd.c @@ -0,0 +1,223 @@ +#include "global.h" +#include "gba/isagbprint.h" +#include "script.h" +#include "event_data.h" + +extern u16 (*const gSpecials[])(void); +extern u16 (*const gSpecialsEnd[])(void); +extern const u8 *const gStdScripts[]; +extern const u8 *const gStdScriptsEnd[]; + +EWRAM_DATA ptrdiff_t gVScriptOffset = 0; +EWRAM_DATA u8 gUnknown_20370AC = 0; +EWRAM_DATA u16 gUnknown_20370AE = 0; +EWRAM_DATA u16 gUnknown_20370B0 = 0; +EWRAM_DATA u16 gUnknown_20370B2 = 0; +EWRAM_DATA u16 gUnknown_20370B4 = 0; +EWRAM_DATA u16 gUnknown_20370B6 = 0; + +// This is defined in here so the optimizer can't see its value when compiling +// script.c. +void * const gNullScriptPtr = NULL; + +const u8 sScriptConditionTable[6][3] = + { +// < = > + 1, 0, 0, // < + 0, 1, 0, // = + 0, 0, 1, // > + 1, 1, 0, // <= + 0, 1, 1, // >= + 1, 0, 1, // != + }; + + + +#define SCRCMD_DEF(name) bool8 name(struct ScriptContext *ctx) + +SCRCMD_DEF(ScrCmd_nop) +{ + return FALSE; +} + +SCRCMD_DEF(ScrCmd_nop1) +{ + return FALSE; +} + +SCRCMD_DEF(ScrCmd_end) +{ + StopScript(ctx); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_gotonative) +{ + bool8 (*func)(void) = (bool8 (*)(void))ScriptReadWord(ctx); + SetupNativeScript(ctx, func); + return TRUE; +} + +SCRCMD_DEF(ScrCmd_special) +{ + u16 (*const *specialPtr)(void) = gSpecials + ScriptReadHalfword(ctx); + if (specialPtr < gSpecialsEnd) + (*specialPtr)(); + else + AGB_ASSERT_EX(0, "C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/scrcmd.c", 241); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_specialvar) +{ + u16 * varPtr = GetVarPointer(ScriptReadHalfword(ctx)); + u16 (*const *specialPtr)(void) = gSpecials + ScriptReadHalfword(ctx); + if (specialPtr < gSpecialsEnd) + *varPtr = (*specialPtr)(); + else + AGB_ASSERT_EX(0, "C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/scrcmd.c", 263); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_callnative) +{ + void (*func )(void) = ((void (*)(void))ScriptReadWord(ctx)); + func(); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_waitstate) +{ + ScriptContext1_Stop(); + return TRUE; +} + +SCRCMD_DEF(ScrCmd_goto) +{ + const u8 * scrptr = (const u8 *)ScriptReadWord(ctx); + ScriptJump(ctx, scrptr); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_return) +{ + ScriptReturn(ctx); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_call) +{ + const u8 * scrptr = (const u8 *)ScriptReadWord(ctx); + ScriptCall(ctx, scrptr); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_goto_if) +{ + u8 condition = ScriptReadByte(ctx); + const u8 * scrptr = (const u8 *)ScriptReadWord(ctx); + if (sScriptConditionTable[condition][ctx->comparisonResult] == 1) + ScriptJump(ctx, scrptr); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_call_if) +{ + u8 condition = ScriptReadByte(ctx); + const u8 * scrptr = (const u8 *)ScriptReadWord(ctx); + if (sScriptConditionTable[condition][ctx->comparisonResult] == 1) + ScriptCall(ctx, scrptr); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_setvaddress) +{ + u32 addr1 = (u32)ctx->scriptPtr - 1; + u32 addr2 = ScriptReadWord(ctx); + + gVScriptOffset = addr2 - addr1; + return FALSE; +} + +SCRCMD_DEF(ScrCmd_vgoto) +{ + const u8 * scrptr = (const u8 *)ScriptReadWord(ctx); + ScriptJump(ctx, scrptr - gVScriptOffset); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_vcall) +{ + const u8 * scrptr = (const u8 *)ScriptReadWord(ctx); + ScriptCall(ctx, scrptr - gVScriptOffset); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_vgoto_if) +{ + u8 condition = ScriptReadByte(ctx); + const u8 * scrptr = (const u8 *)ScriptReadWord(ctx) - gVScriptOffset; + if (sScriptConditionTable[condition][ctx->comparisonResult] == 1) + ScriptJump(ctx, scrptr); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_vcall_if) +{ + u8 condition = ScriptReadByte(ctx); + const u8 * scrptr = (const u8 *)ScriptReadWord(ctx) - gVScriptOffset; + if (sScriptConditionTable[condition][ctx->comparisonResult] == 1) + ScriptCall(ctx, scrptr); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_gotostd) +{ + u8 stdIdx = ScriptReadByte(ctx); + const u8 *const * script = gStdScripts + stdIdx; + if (script < gStdScriptsEnd) + ScriptJump(ctx, *script); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_callstd) +{ + u8 stdIdx = ScriptReadByte(ctx); + const u8 *const * script = gStdScripts + stdIdx; + if (script < gStdScriptsEnd) + ScriptCall(ctx, *script); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_gotostd_if) +{ + u8 condition = ScriptReadByte(ctx); + u8 stdIdx = ScriptReadByte(ctx); + if (sScriptConditionTable[condition][ctx->comparisonResult] == 1) + { + const u8 *const * script = gStdScripts + stdIdx; + if (script < gStdScriptsEnd) + ScriptJump(ctx, *script); + } + return FALSE; +} + +SCRCMD_DEF(ScrCmd_callstd_if) +{ + u8 condition = ScriptReadByte(ctx); + u8 stdIdx = ScriptReadByte(ctx); + if (sScriptConditionTable[condition][ctx->comparisonResult] == 1) + { + const u8 *const * script = gStdScripts + stdIdx; + if (script < gStdScriptsEnd) + ScriptCall(ctx, *script); + } + return FALSE; +} + +u8 * const sScriptStringVars[] = +{ + gStringVar1, + gStringVar2, + gStringVar3, +}; -- cgit v1.2.3 From d2538cffa03a21aca4e116971a7eb8b760f98ce0 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 6 Jan 2019 07:54:57 -0500 Subject: through ScrCmd_copyvar --- src/scrcmd.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) (limited to 'src/scrcmd.c') diff --git a/src/scrcmd.c b/src/scrcmd.c index bb8d969c1..20f1dbc3b 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -1,6 +1,7 @@ #include "global.h" #include "gba/isagbprint.h" #include "script.h" +#include "mystery_event_script.h" #include "event_data.h" extern u16 (*const gSpecials[])(void); @@ -215,6 +216,101 @@ SCRCMD_DEF(ScrCmd_callstd_if) return FALSE; } +SCRCMD_DEF(ScrCmd_gotoram) +{ + ScriptJump(ctx, gRAMScriptPtr); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_killscript) +{ + ClearRamScript(); + StopScript(ctx); + return TRUE; +} + +SCRCMD_DEF(ScrCmd_setmysteryeventstatus) +{ + SetMysteryEventScriptStatus(ScriptReadByte(ctx)); + return FALSE; +} + +SCRCMD_DEF(sub_806A28C) +{ + const u8 * script = sub_8069E48(); + if (script != NULL) + { + gRAMScriptPtr = ctx->scriptPtr; + ScriptJump(ctx, script); + } + return FALSE; +} + +SCRCMD_DEF(ScrCmd_loadword) +{ + u8 which = ScriptReadByte(ctx); + ctx->data[which] = ScriptReadWord(ctx); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_loadbytefromaddr) +{ + u8 which = ScriptReadByte(ctx); + ctx->data[which] = *(const u8 *)ScriptReadWord(ctx); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_writebytetoaddr) +{ + u8 value = ScriptReadByte(ctx); + *(u8 *)ScriptReadWord(ctx) = value; + return FALSE; +} + +SCRCMD_DEF(ScrCmd_loadbyte) +{ + u8 which = ScriptReadByte(ctx); + ctx->data[which] = ScriptReadByte(ctx); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_setptrbyte) +{ + u8 which = ScriptReadByte(ctx); + *(u8 *)ScriptReadWord(ctx) = ctx->data[which]; + return FALSE; +} + +SCRCMD_DEF(ScrCmd_copylocal) +{ + u8 whichDst = ScriptReadByte(ctx); + u8 whichSrc = ScriptReadByte(ctx); + ctx->data[whichDst] = ctx->data[whichSrc]; + return FALSE; +} + +SCRCMD_DEF(ScrCmd_copybyte) +{ + u8 * dest = (u8 *)ScriptReadWord(ctx); + *dest = *(const u8 *)ScriptReadWord(ctx); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_setvar) +{ + u16 * varPtr = GetVarPointer(ScriptReadHalfword(ctx)); + *varPtr = ScriptReadHalfword(ctx); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_copyvar) +{ + u16 * destPtr = GetVarPointer(ScriptReadHalfword(ctx)); + u16 * srcPtr = GetVarPointer(ScriptReadHalfword(ctx)); + *destPtr = *srcPtr; + return FALSE; +} + u8 * const sScriptStringVars[] = { gStringVar1, -- cgit v1.2.3 From 1cb1fd2bf8416821a897fbc6b5a60c60595b4a7b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 6 Jan 2019 10:09:03 -0500 Subject: through ScrCmd_checkdecor --- src/scrcmd.c | 211 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 211 insertions(+) (limited to 'src/scrcmd.c') diff --git a/src/scrcmd.c b/src/scrcmd.c index 20f1dbc3b..9802791bf 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -3,6 +3,8 @@ #include "script.h" #include "mystery_event_script.h" #include "event_data.h" +#include "random.h" +#include "item.h" extern u16 (*const gSpecials[])(void); extern u16 (*const gSpecialsEnd[])(void); @@ -311,9 +313,218 @@ SCRCMD_DEF(ScrCmd_copyvar) return FALSE; } +SCRCMD_DEF(ScrCmd_setorcopyvar) +{ + u16 * destPtr = GetVarPointer(ScriptReadHalfword(ctx)); + *destPtr = VarGet(ScriptReadHalfword(ctx)); + return FALSE; +} + u8 * const sScriptStringVars[] = { gStringVar1, gStringVar2, gStringVar3, }; + +u8 compare_012(u16 left, u16 right) +{ + if (left < right) + return 0; + else if (left == right) + return 1; + else + return 2; +} + +// comparelocaltolocal +SCRCMD_DEF(ScrCmd_compare_local_to_local) +{ + const u8 value1 = ctx->data[ScriptReadByte(ctx)]; + const u8 value2 = ctx->data[ScriptReadByte(ctx)]; + + ctx->comparisonResult = compare_012(value1, value2); + return FALSE; +} + +// comparelocaltoimm +SCRCMD_DEF(ScrCmd_compare_local_to_value) +{ + const u8 value1 = ctx->data[ScriptReadByte(ctx)]; + const u8 value2 = ScriptReadByte(ctx); + + ctx->comparisonResult = compare_012(value1, value2); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_compare_local_to_addr) +{ + const u8 value1 = ctx->data[ScriptReadByte(ctx)]; + const u8 value2 = *(const u8 *)ScriptReadWord(ctx); + + ctx->comparisonResult = compare_012(value1, value2); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_compare_addr_to_local) +{ + const u8 value1 = *(const u8 *)ScriptReadWord(ctx); + const u8 value2 = ctx->data[ScriptReadByte(ctx)]; + + ctx->comparisonResult = compare_012(value1, value2); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_compare_addr_to_value) +{ + const u8 value1 = *(const u8 *)ScriptReadWord(ctx); + const u8 value2 = ScriptReadByte(ctx); + + ctx->comparisonResult = compare_012(value1, value2); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_compare_addr_to_addr) +{ + const u8 value1 = *(const u8 *)ScriptReadWord(ctx); + const u8 value2 = *(const u8 *)ScriptReadWord(ctx); + + ctx->comparisonResult = compare_012(value1, value2); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_compare_var_to_value) +{ + const u16 value1 = *GetVarPointer(ScriptReadHalfword(ctx)); + const u16 value2 = ScriptReadHalfword(ctx); + + ctx->comparisonResult = compare_012(value1, value2); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_compare_var_to_var) +{ + const u16 *ptr1 = GetVarPointer(ScriptReadHalfword(ctx)); + const u16 *ptr2 = GetVarPointer(ScriptReadHalfword(ctx)); + + ctx->comparisonResult = compare_012(*ptr1, *ptr2); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_addvar) +{ + u16 *ptr = GetVarPointer(ScriptReadHalfword(ctx)); + *ptr += ScriptReadHalfword(ctx); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_subvar) +{ + u16 *ptr = GetVarPointer(ScriptReadHalfword(ctx)); + *ptr -= VarGet(ScriptReadHalfword(ctx)); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_random) +{ + u16 max = VarGet(ScriptReadHalfword(ctx)); + + gSpecialVar_Result = Random() % max; + return FALSE; +} + +SCRCMD_DEF(ScrCmd_giveitem) +{ + u16 itemId = VarGet(ScriptReadHalfword(ctx)); + u32 quantity = VarGet(ScriptReadHalfword(ctx)); + + gSpecialVar_Result = AddBagItem(itemId, (u8)quantity); + sub_809A824(itemId); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_takeitem) +{ + u16 itemId = VarGet(ScriptReadHalfword(ctx)); + u32 quantity = VarGet(ScriptReadHalfword(ctx)); + + gSpecialVar_Result = RemoveBagItem(itemId, (u8)quantity); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_checkitemspace) +{ + u16 itemId = VarGet(ScriptReadHalfword(ctx)); + u32 quantity = VarGet(ScriptReadHalfword(ctx)); + + gSpecialVar_Result = CheckBagHasSpace(itemId, (u8)quantity); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_checkitem) +{ + u16 itemId = VarGet(ScriptReadHalfword(ctx)); + u32 quantity = VarGet(ScriptReadHalfword(ctx)); + + gSpecialVar_Result = CheckBagHasItem(itemId, (u8)quantity); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_checkitemtype) +{ + u16 itemId = VarGet(ScriptReadHalfword(ctx)); + + gSpecialVar_Result = GetPocketByItemId(itemId); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_givepcitem) +{ + u16 itemId = VarGet(ScriptReadHalfword(ctx)); + u16 quantity = VarGet(ScriptReadHalfword(ctx)); + + gSpecialVar_Result = AddPCItem(itemId, quantity); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_checkpcitem) +{ + u16 itemId = VarGet(ScriptReadHalfword(ctx)); + u16 quantity = VarGet(ScriptReadHalfword(ctx)); + + gSpecialVar_Result = CheckPCHasItem(itemId, quantity); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_givedecoration) +{ + u32 decorId = VarGet(ScriptReadHalfword(ctx)); + +// gSpecialVar_Result = DecorationAdd(decorId); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_takedecoration) +{ + u32 decorId = VarGet(ScriptReadHalfword(ctx)); + +// gSpecialVar_Result = DecorationRemove(decorId); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_checkdecorspace) +{ + u32 decorId = VarGet(ScriptReadHalfword(ctx)); + +// gSpecialVar_Result = DecorationCheckSpace(decorId); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_checkdecor) +{ + u32 decorId = VarGet(ScriptReadHalfword(ctx)); + +// gSpecialVar_Result = CheckHasDecoration(decorId); + return FALSE; +} + -- cgit v1.2.3 From 257bde9b08e907b59aed05d662a1d8daed8d79fa Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 6 Jan 2019 10:22:04 -0500 Subject: through ScrCmd_fadescreenspeed --- src/scrcmd.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) (limited to 'src/scrcmd.c') diff --git a/src/scrcmd.c b/src/scrcmd.c index 9802791bf..c8e7babcc 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -1,10 +1,16 @@ #include "global.h" #include "gba/isagbprint.h" +#include "palette.h" #include "script.h" #include "mystery_event_script.h" #include "event_data.h" #include "random.h" #include "item.h" +#include "overworld.h" +#include "field_screen_effect.h" +#include "quest_log.h" +#include "map_preview_screen.h" +#include "field_weather.h" extern u16 (*const gSpecials[])(void); extern u16 (*const gSpecialsEnd[])(void); @@ -528,3 +534,89 @@ SCRCMD_DEF(ScrCmd_checkdecor) return FALSE; } +SCRCMD_DEF(ScrCmd_setflag) +{ + FlagSet(ScriptReadHalfword(ctx)); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_clearflag) +{ + FlagClear(ScriptReadHalfword(ctx)); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_checkflag) +{ + ctx->comparisonResult = FlagGet(ScriptReadHalfword(ctx)); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_incrementgamestat) +{ + IncrementGameStat(ScriptReadByte(ctx)); + return FALSE; +} + +SCRCMD_DEF(sub_806A888) +{ + u8 statIdx = ScriptReadByte(ctx); + u32 value = ScriptReadWord(ctx); + u32 statValue = GetGameStat(statIdx); + + if (statValue < value) + ctx ->comparisonResult = 0; + else if (statValue == value) + ctx->comparisonResult = 1; + else + ctx->comparisonResult = 2; + return FALSE; +} + +SCRCMD_DEF(sub_806A8C0) +{ + u16 value = ScriptReadHalfword(ctx); + sub_8115748(value); + sub_80F85BC(value); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_animateflash) +{ + sub_807F028(ScriptReadByte(ctx)); + ScriptContext1_Stop(); + return TRUE; +} + +SCRCMD_DEF(ScrCmd_setflashradius) +{ + u16 flashLevel = VarGet(ScriptReadHalfword(ctx)); + + Overworld_SetFlashLevel(flashLevel); + return FALSE; +} + +static bool8 IsPaletteNotActive(void) +{ + if (!gPaletteFade.active) + return TRUE; + else + return FALSE; +} + +SCRCMD_DEF(ScrCmd_fadescreen) +{ + fade_screen(ScriptReadByte(ctx), 0); + SetupNativeScript(ctx, IsPaletteNotActive); + return TRUE; +} + +SCRCMD_DEF(ScrCmd_fadescreenspeed) +{ + u8 mode = ScriptReadByte(ctx); + u8 speed = ScriptReadByte(ctx); + + fade_screen(mode, speed); + SetupNativeScript(ctx, IsPaletteNotActive); + return TRUE; +} -- cgit v1.2.3 From b16831e97bb8b94c29854a81e11647e8a5db68c6 Mon Sep 17 00:00:00 2001 From: scnorton Date: Sun, 6 Jan 2019 11:57:00 -0500 Subject: through ScrCmd_fadeinbgm --- src/scrcmd.c | 348 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 347 insertions(+), 1 deletion(-) (limited to 'src/scrcmd.c') diff --git a/src/scrcmd.c b/src/scrcmd.c index c8e7babcc..8b9551c64 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -11,6 +11,10 @@ #include "quest_log.h" #include "map_preview_screen.h" #include "field_weather.h" +#include "field_tasks.h" +#include "field_fadetransition.h" +#include "field_player_avatar.h" +#include "sound.h" extern u16 (*const gSpecials[])(void); extern u16 (*const gSpecialsEnd[])(void); @@ -19,7 +23,7 @@ extern const u8 *const gStdScriptsEnd[]; EWRAM_DATA ptrdiff_t gVScriptOffset = 0; EWRAM_DATA u8 gUnknown_20370AC = 0; -EWRAM_DATA u16 gUnknown_20370AE = 0; +EWRAM_DATA u16 sPauseCounter = 0; EWRAM_DATA u16 gUnknown_20370B0 = 0; EWRAM_DATA u16 gUnknown_20370B2 = 0; EWRAM_DATA u16 gUnknown_20370B4 = 0; @@ -620,3 +624,345 @@ SCRCMD_DEF(ScrCmd_fadescreenspeed) SetupNativeScript(ctx, IsPaletteNotActive); return TRUE; } + +static bool8 RunPauseTimer(void) +{ + sPauseCounter--; + + if (sPauseCounter == 0) + return TRUE; + else + return FALSE; +} + +SCRCMD_DEF(ScrCmd_delay) +{ + sPauseCounter = ScriptReadHalfword(ctx); + SetupNativeScript(ctx, RunPauseTimer); + return TRUE; +} + +SCRCMD_DEF(ScrCmd_initclock) +{ +// u8 hour = VarGet(ScriptReadHalfword(ctx)); +// u8 minute = VarGet(ScriptReadHalfword(ctx)); +// +// RtcInitLocalTimeOffset(hour, minute); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_dodailyevents) +{ +// DoTimeBasedEvents(); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_gettime) +{ +// RtcCalcLocalTime(); +// gSpecialVar_0x8000 = gLocalTime.hours; +// gSpecialVar_0x8001 = gLocalTime.minutes; +// gSpecialVar_0x8002 = gLocalTime.seconds; + gSpecialVar_0x8000 = 0; + gSpecialVar_0x8001 = 0; + gSpecialVar_0x8002 = 0; + return FALSE; +} + +SCRCMD_DEF(ScrCmd_setweather) +{ + u16 weather = VarGet(ScriptReadHalfword(ctx)); + + SetSav1Weather(weather); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_resetweather) +{ + SetSav1WeatherFromCurrMapHeader(); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_doweather) +{ + DoCurrentWeather(); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_setstepcallback) +{ + ActivatePerStepCallback(ScriptReadByte(ctx)); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_setmaplayoutindex) +{ + u16 value = VarGet(ScriptReadHalfword(ctx)); + + SetCurrentMapLayout(value); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_warp) +{ + u8 mapGroup = ScriptReadByte(ctx); + u8 mapNum = ScriptReadByte(ctx); + u8 warpId = ScriptReadByte(ctx); + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + + Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); + DoWarp(); + ResetInitialPlayerAvatarState(); + return TRUE; +} + +SCRCMD_DEF(ScrCmd_warpsilent) +{ + u8 mapGroup = ScriptReadByte(ctx); + u8 mapNum = ScriptReadByte(ctx); + u8 warpId = ScriptReadByte(ctx); + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + + Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); + DoDiveWarp(); + ResetInitialPlayerAvatarState(); + return TRUE; +} + +SCRCMD_DEF(ScrCmd_warpdoor) +{ + u8 mapGroup = ScriptReadByte(ctx); + u8 mapNum = ScriptReadByte(ctx); + u8 warpId = ScriptReadByte(ctx); + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + + Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); + DoDoorWarp(); + ResetInitialPlayerAvatarState(); + return TRUE; +} + +SCRCMD_DEF(ScrCmd_warphole) +{ + u8 mapGroup = ScriptReadByte(ctx); + u8 mapNum = ScriptReadByte(ctx); + u16 x; + u16 y; + + PlayerGetDestCoords(&x, &y); + if (mapGroup == 0xFF && mapNum == 0xFF) + SetWarpDestinationToFixedHoleWarp(x - 7, y - 7); + else + Overworld_SetWarpDestination(mapGroup, mapNum, -1, x - 7, y - 7); + DoFallWarp(); + ResetInitialPlayerAvatarState(); + return TRUE; +} + +SCRCMD_DEF(ScrCmd_warpteleport) +{ + u8 mapGroup = ScriptReadByte(ctx); + u8 mapNum = ScriptReadByte(ctx); + u8 warpId = ScriptReadByte(ctx); + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + + Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); + sub_807E59C(); + ResetInitialPlayerAvatarState(); + return TRUE; +} + +SCRCMD_DEF(ScrCmd_warpD7) +{ + u8 mapGroup = ScriptReadByte(ctx); + u8 mapNum = ScriptReadByte(ctx); + u8 warpId = ScriptReadByte(ctx); + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + + Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); + sub_805DAE4(player_get_direction_lower_nybble()); + sub_807E500(); + ResetInitialPlayerAvatarState(); + return TRUE; +} + +SCRCMD_DEF(ScrCmd_setwarp) +{ + u8 mapGroup = ScriptReadByte(ctx); + u8 mapNum = ScriptReadByte(ctx); + u8 warpId = ScriptReadByte(ctx); + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + + Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_setdynamicwarp) +{ + u8 mapGroup = ScriptReadByte(ctx); + u8 mapNum = ScriptReadByte(ctx); + u8 warpId = ScriptReadByte(ctx); + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + + SetDynamicWarpWithCoords(0, mapGroup, mapNum, warpId, x, y); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_setdivewarp) +{ + u8 mapGroup = ScriptReadByte(ctx); + u8 mapNum = ScriptReadByte(ctx); + u8 warpId = ScriptReadByte(ctx); + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + + SetFixedDiveWarp(mapGroup, mapNum, warpId, x, y); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_setholewarp) +{ + u8 mapGroup = ScriptReadByte(ctx); + u8 mapNum = ScriptReadByte(ctx); + u8 warpId = ScriptReadByte(ctx); + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + + SetFixedHoleWarp(mapGroup, mapNum, warpId, x, y); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_setescapewarp) +{ + u8 mapGroup = ScriptReadByte(ctx); + u8 mapNum = ScriptReadByte(ctx); + u8 warpId = ScriptReadByte(ctx); + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + + SetEscapeWarp(mapGroup, mapNum, warpId, x, y); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_getplayerxy) +{ + u16 *pX = GetVarPointer(ScriptReadHalfword(ctx)); + u16 *pY = GetVarPointer(ScriptReadHalfword(ctx)); + + *pX = gSaveBlock1Ptr->pos.x; + *pY = gSaveBlock1Ptr->pos.y; + return FALSE; +} + +SCRCMD_DEF(ScrCmd_getpartysize) +{ + gSpecialVar_Result = CalculatePlayerPartyCount(); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_playse) +{ + PlaySE(ScriptReadHalfword(ctx)); + return FALSE; +} + +static bool8 WaitForSoundEffectFinish(void) +{ + if (!IsSEPlaying()) + return TRUE; + else + return FALSE; +} + +SCRCMD_DEF(ScrCmd_waitse) +{ + SetupNativeScript(ctx, WaitForSoundEffectFinish); + return TRUE; +} + +SCRCMD_DEF(ScrCmd_playfanfare) +{ + PlayFanfare(ScriptReadHalfword(ctx)); + return FALSE; +} + +static bool8 WaitForFanfareFinish(void) +{ + return IsFanfareTaskInactive(); +} + +SCRCMD_DEF(ScrCmd_waitfanfare) +{ + SetupNativeScript(ctx, WaitForFanfareFinish); + return TRUE; +} + +SCRCMD_DEF(ScrCmd_playbgm) +{ + u16 songId = ScriptReadHalfword(ctx); + bool8 val = ScriptReadByte(ctx); + + if (gUnknown_203ADFA == 2 || gUnknown_203ADFA == 3) + return FALSE; + if (val == TRUE) + Overworld_SetSavedMusic(songId); + PlayNewMapMusic(songId); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_savebgm) +{ + Overworld_SetSavedMusic(ScriptReadHalfword(ctx)); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_fadedefaultbgm) +{ + if (gUnknown_203ADFA == 2 || gUnknown_203ADFA == 3) + return FALSE; + Overworld_ChangeMusicToDefault(); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_fadenewbgm) +{ + u16 music = ScriptReadHalfword(ctx); + if (gUnknown_203ADFA == 2 || gUnknown_203ADFA == 3) + return FALSE; + Overworld_ChangeMusicTo(music); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_fadeoutbgm) +{ + u8 speed = ScriptReadByte(ctx); + + if (gUnknown_203ADFA == 2 || gUnknown_203ADFA == 3) + return FALSE; + if (speed != 0) + FadeOutBGMTemporarily(4 * speed); + else + FadeOutBGMTemporarily(4); + SetupNativeScript(ctx, IsBGMPausedOrStopped); + return TRUE; +} + +SCRCMD_DEF(ScrCmd_fadeinbgm) +{ + u8 speed = ScriptReadByte(ctx); + + if (gUnknown_203ADFA == 2 || gUnknown_203ADFA == 3) + return FALSE; + if (speed != 0) + FadeInBGM(4 * speed); + else + FadeInBGM(4); + return FALSE; +} -- cgit v1.2.3 From 96e1b19dc1ea9dbf686fd26743d79c68d12e0f24 Mon Sep 17 00:00:00 2001 From: scnorton Date: Sun, 6 Jan 2019 13:06:56 -0500 Subject: through ScrCmd_release; propose names for remaining funcs --- src/scrcmd.c | 293 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 286 insertions(+), 7 deletions(-) (limited to 'src/scrcmd.c') diff --git a/src/scrcmd.c b/src/scrcmd.c index 8b9551c64..ce1519b94 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -15,6 +15,11 @@ #include "field_fadetransition.h" #include "field_player_avatar.h" #include "sound.h" +#include "script_movement.h" +#include "field_map_obj.h" +#include "field_map_obj_helpers.h" +#include "map_obj_lock.h" +#include "field_message_box.h" extern u16 (*const gSpecials[])(void); extern u16 (*const gSpecialsEnd[])(void); @@ -24,11 +29,13 @@ extern const u8 *const gStdScriptsEnd[]; EWRAM_DATA ptrdiff_t gVScriptOffset = 0; EWRAM_DATA u8 gUnknown_20370AC = 0; EWRAM_DATA u16 sPauseCounter = 0; -EWRAM_DATA u16 gUnknown_20370B0 = 0; -EWRAM_DATA u16 gUnknown_20370B2 = 0; -EWRAM_DATA u16 gUnknown_20370B4 = 0; +EWRAM_DATA u16 sMovingNpcId = 0; +EWRAM_DATA u16 sMovingNpcMapBank = 0; +EWRAM_DATA u16 sMovingNpcMapId = 0; EWRAM_DATA u16 gUnknown_20370B6 = 0; +extern u8 gSelectedEventObject; + // This is defined in here so the optimizer can't see its value when compiling // script.c. void * const gNullScriptPtr = NULL; @@ -247,7 +254,7 @@ SCRCMD_DEF(ScrCmd_setmysteryeventstatus) return FALSE; } -SCRCMD_DEF(sub_806A28C) +SCRCMD_DEF(ScrCmd_cmdCF) { const u8 * script = sub_8069E48(); if (script != NULL) @@ -562,7 +569,7 @@ SCRCMD_DEF(ScrCmd_incrementgamestat) return FALSE; } -SCRCMD_DEF(sub_806A888) +SCRCMD_DEF(ScrCmd_comparestattoword) { u8 statIdx = ScriptReadByte(ctx); u32 value = ScriptReadWord(ctx); @@ -577,7 +584,7 @@ SCRCMD_DEF(sub_806A888) return FALSE; } -SCRCMD_DEF(sub_806A8C0) +SCRCMD_DEF(ScrCmd_cmdD0) { u16 value = ScriptReadHalfword(ctx); sub_8115748(value); @@ -776,7 +783,7 @@ SCRCMD_DEF(ScrCmd_warpteleport) return TRUE; } -SCRCMD_DEF(ScrCmd_warpD7) +SCRCMD_DEF(ScrCmd_warpD1) { u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); @@ -966,3 +973,275 @@ SCRCMD_DEF(ScrCmd_fadeinbgm) FadeInBGM(4); return FALSE; } + +SCRCMD_DEF(ScrCmd_applymovement) +{ + u16 localId = VarGet(ScriptReadHalfword(ctx)); + const void *movementScript = (const void *)ScriptReadWord(ctx); + + ScriptMovement_StartObjectMovementScript(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, movementScript); + sMovingNpcId = localId; + return FALSE; +} + +SCRCMD_DEF(ScrCmd_applymovement_at) +{ + u16 localId = VarGet(ScriptReadHalfword(ctx)); + const void *movementScript = (const void *)ScriptReadWord(ctx); + u8 mapGroup = ScriptReadByte(ctx); + u8 mapNum = ScriptReadByte(ctx); + + ScriptMovement_StartObjectMovementScript(localId, mapNum, mapGroup, movementScript); + sMovingNpcId = localId; + return FALSE; +} + +static bool8 WaitForMovementFinish(void) +{ + return ScriptMovement_IsObjectMovementFinished(sMovingNpcId, sMovingNpcMapId, sMovingNpcMapBank); +} + +SCRCMD_DEF(ScrCmd_waitmovement) +{ + u16 localId = VarGet(ScriptReadHalfword(ctx)); + + if (localId != 0) + sMovingNpcId = localId; + sMovingNpcMapBank = gSaveBlock1Ptr->location.mapGroup; + sMovingNpcMapId = gSaveBlock1Ptr->location.mapNum; + SetupNativeScript(ctx, WaitForMovementFinish); + return TRUE; +} + +SCRCMD_DEF(ScrCmd_waitmovement_at) +{ + u16 localId = VarGet(ScriptReadHalfword(ctx)); + u8 mapBank; + u8 mapId; + + if (localId != 0) + sMovingNpcId = localId; + mapBank = ScriptReadByte(ctx); + mapId = ScriptReadByte(ctx); + sMovingNpcMapBank = mapBank; + sMovingNpcMapId = mapId; + SetupNativeScript(ctx, WaitForMovementFinish); + return TRUE; +} + +SCRCMD_DEF(ScrCmd_removeobject) +{ + u16 localId = VarGet(ScriptReadHalfword(ctx)); + + RemoveFieldObjectByLocalIdAndMap(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_removeobject_at) +{ + u16 objectId = VarGet(ScriptReadHalfword(ctx)); + u8 mapGroup = ScriptReadByte(ctx); + u8 mapNum = ScriptReadByte(ctx); + + RemoveFieldObjectByLocalIdAndMap(objectId, mapNum, mapGroup); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_addobject) +{ + u16 objectId = VarGet(ScriptReadHalfword(ctx)); + + show_sprite(objectId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_addobject_at) +{ + u16 objectId = VarGet(ScriptReadHalfword(ctx)); + u8 mapGroup = ScriptReadByte(ctx); + u8 mapNum = ScriptReadByte(ctx); + + show_sprite(objectId, mapNum, mapGroup); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_setobjectxy) +{ + u16 localId = VarGet(ScriptReadHalfword(ctx)); + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + + sub_805F7C4(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, x, y); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_setobjectxyperm) +{ + u16 localId = VarGet(ScriptReadHalfword(ctx)); + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + + Overworld_SetMapObjTemplateCoords(localId, x, y); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_moveobjectoffscreen) +{ + u16 localId = VarGet(ScriptReadHalfword(ctx)); + + sub_805FE94(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_showobject_at) +{ + u16 localId = VarGet(ScriptReadHalfword(ctx)); + u8 mapGroup = ScriptReadByte(ctx); + u8 mapNum = ScriptReadByte(ctx); + + npc_by_local_id_and_map_set_field_1_bit_x20(localId, mapNum, mapGroup, 0); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_hideobject_at) +{ + u16 localId = VarGet(ScriptReadHalfword(ctx)); + u8 mapGroup = ScriptReadByte(ctx); + u8 mapNum = ScriptReadByte(ctx); + + npc_by_local_id_and_map_set_field_1_bit_x20(localId, mapNum, mapGroup, 1); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_setobjectpriority) +{ + u16 localId = VarGet(ScriptReadHalfword(ctx)); + u8 mapGroup = ScriptReadByte(ctx); + u8 mapNum = ScriptReadByte(ctx); + u8 priority = ScriptReadByte(ctx); + + sub_805F3A8(localId, mapNum, mapGroup, priority + 83); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_resetobjectpriority) +{ + u16 localId = VarGet(ScriptReadHalfword(ctx)); + u8 mapGroup = ScriptReadByte(ctx); + u8 mapNum = ScriptReadByte(ctx); + + sub_805F400(localId, mapNum, mapGroup); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_faceplayer) +{ + if (gMapObjects[gSelectedEventObject].active) + { + FieldObjectFaceOppositeDirection(&gMapObjects[gSelectedEventObject], + player_get_direction_lower_nybble()); + } + return FALSE; +} + +SCRCMD_DEF(ScrCmd_turnobject) +{ + u16 localId = VarGet(ScriptReadHalfword(ctx)); + u8 direction = ScriptReadByte(ctx); + + FieldObjectTurnByLocalIdAndMap(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, direction); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_setobjectmovementtype) +{ + u16 localId = VarGet(ScriptReadHalfword(ctx)); + u8 movementType = ScriptReadByte(ctx); + + Overworld_SetMapObjTemplateMovementType(localId, movementType); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_createvobject) +{ + u8 graphicsId = ScriptReadByte(ctx); + u8 v2 = ScriptReadByte(ctx); + u16 x = VarGet(ScriptReadHalfword(ctx)); + u32 y = VarGet(ScriptReadHalfword(ctx)); + u8 elevation = ScriptReadByte(ctx); + u8 direction = ScriptReadByte(ctx); + + sprite_new(graphicsId, v2, x, y, elevation, direction); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_turnvobject) +{ + u8 v1 = ScriptReadByte(ctx); + u8 direction = ScriptReadByte(ctx); + + sub_8069058(v1, direction); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_lockall) +{ + if (is_c1_link_related_active()) + { + return FALSE; + } + else + { + ScriptFreezeMapObjects(); + SetupNativeScript(ctx, sub_8069590); + return TRUE; + } +} + +SCRCMD_DEF(ScrCmd_lock) +{ + if (is_c1_link_related_active()) + { + return FALSE; + } + else + { + if (gMapObjects[gSelectedEventObject].active) + { + LockSelectedMapObject(); + SetupNativeScript(ctx, sub_8069648); + } + else + { + ScriptFreezeMapObjects(); + SetupNativeScript(ctx, sub_8069590); + } + return TRUE; + } +} + +SCRCMD_DEF(ScrCmd_releaseall) +{ + u8 playerObjectId; + + HideFieldMessageBox(); + playerObjectId = GetFieldObjectIdByLocalIdAndMap(0xFF, 0, 0); + FieldObjectClearAnimIfSpecialAnimFinished(&gMapObjects[playerObjectId]); + sub_80974D8(); + UnfreezeMapObjects(); + return FALSE; +} + +SCRCMD_DEF(ScrCmd_release) +{ + u8 playerObjectId; + + HideFieldMessageBox(); + if (gMapObjects[gSelectedEventObject].active) + FieldObjectClearAnimIfSpecialAnimFinished(&gMapObjects[gSelectedEventObject]); + playerObjectId = GetFieldObjectIdByLocalIdAndMap(0xFF, 0, 0); + FieldObjectClearAnimIfSpecialAnimFinished(&gMapObjects[playerObjectId]); + sub_80974D8(); + UnfreezeMapObjects(); + return FALSE; +} -- cgit v1.2.3 From 607d6e13d4378ea6530f03d2c290ddd30506aa14 Mon Sep 17 00:00:00 2001 From: scnorton Date: Sun, 6 Jan 2019 14:52:00 -0500 Subject: ScrCmd_waitbuttonpress --- src/scrcmd.c | 155 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) (limited to 'src/scrcmd.c') diff --git a/src/scrcmd.c b/src/scrcmd.c index 4cd0fdad2..976b80564 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -20,6 +20,9 @@ #include "field_map_obj_helpers.h" #include "map_obj_lock.h" #include "field_message_box.h" +#include "new_menu_helpers.h" +#include "window.h" +#include "start_menu.h" extern u16 (*const gSpecials[])(void); extern u16 (*const gSpecialsEnd[])(void); @@ -1252,3 +1255,155 @@ SCRCMD_DEF(cmdC7) gUnknown_20370DA = ScriptReadByte(ctx); return FALSE; } + +SCRCMD_DEF(message) +{ + const u8 *msg = (const u8 *)ScriptReadWord(ctx); + + if (msg == NULL) + msg = (const u8 *)ctx->data[0]; + ShowFieldMessage(msg); + return FALSE; +} + +SCRCMD_DEF(cmdC8) +{ + const u8 *msg = (const u8 *)ScriptReadWord(ctx); + + if (msg == NULL) + msg = (const u8 *)ctx->data[0]; + sub_80F7974(msg); + CopyWindowToVram(GetStartMenuWindowId(), 1); + return FALSE; +} + +SCRCMD_DEF(cmdC9) +{ + sub_80F7998(); + return FALSE; +} + +SCRCMD_DEF(messageautoscroll) +{ + const u8 *msg = (const u8 *)ScriptReadWord(ctx); + + if (msg == NULL) + msg = (const u8 *)ctx->data[0]; + ShowFieldAutoScrollMessage(msg); + return FALSE; +} + +SCRCMD_DEF(waitmessage) +{ + SetupNativeScript(ctx, IsFieldMessageBoxHidden); + return TRUE; +} + +SCRCMD_DEF(closemessage) +{ + HideFieldMessageBox(); + return FALSE; +} + +extern IWRAM_DATA struct ScriptContext * gUnknown_3005070; + +bool8 sub_806B93C(struct ScriptContext * ctx); +u8 sub_806B96C(struct ScriptContext * ctx); + +bool8 WaitForAorBPress(void) +{ + if (gMain.newKeys & A_BUTTON) + return TRUE; + if (gMain.newKeys & B_BUTTON) + return TRUE; + + if (sub_806B93C(gUnknown_3005070) == TRUE) + { + u8 r4 = sub_806B96C(gUnknown_3005070); + sub_8069998(r4); + if (r4) + { + if (gUnknown_203ADFA != 2) + { + sub_80699F8(); + if (r4 < 9 || r4 > 10) + sub_8069964(); + else + { + sub_80699A4(); + sub_8069970(); + } + return TRUE; + } + } + } + if (sub_8112CAC() == 1 || gUnknown_203ADFA == 2) + { + if (gUnknown_20370AC == 120) + return TRUE; + else + gUnknown_20370AC++; + } + + return FALSE; +} + +bool8 sub_806B93C(struct ScriptContext * ctx) +{ + const u8 * script = ctx->scriptPtr; + u8 nextCmd = *script; + if (nextCmd == 3) // return + { + script = ctx->stack[ctx->stackDepth - 1]; + nextCmd = *script; + } + if (nextCmd < 0x6B || nextCmd > 0x6C) // releaseall or release + return FALSE; + else + return TRUE; +} + +u8 sub_806B96C(struct ScriptContext * ctx) +{ + if (gMain.heldKeys & DPAD_UP && gSpecialVar_Facing != 2) + return 1; + + if (gMain.heldKeys & DPAD_DOWN && gSpecialVar_Facing != 1) + return 2; + + if (gMain.heldKeys & DPAD_LEFT && gSpecialVar_Facing != 3) + return 3; + + if (gMain.heldKeys & DPAD_RIGHT && gSpecialVar_Facing != 4) + return 4; + + if (gMain.newKeys & L_BUTTON) + return 5; + + if (gMain.heldKeys & R_BUTTON) + return 6; + + if (gMain.heldKeys & START_BUTTON) + return 7; + + if (gMain.heldKeys & SELECT_BUTTON) + return 8; + + if (gMain.newKeys & A_BUTTON) + return 9; + + if (gMain.newKeys & B_BUTTON) + return 10; + + return 0; +} + +SCRCMD_DEF(waitbuttonpress) +{ + gUnknown_3005070 = ctx; + + if (sub_8112CAC() == 1 || gUnknown_203ADFA == 2) + gUnknown_20370AC = 0; + SetupNativeScript(ctx, WaitForAorBPress); + return TRUE; +} -- cgit v1.2.3 From 6a064a4fa4bedaa1e46470645e175ba7d11a2e41 Mon Sep 17 00:00:00 2001 From: scnorton Date: Sun, 6 Jan 2019 15:08:17 -0500 Subject: Through ScrCmd_getbraillestringwidth --- src/scrcmd.c | 168 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) (limited to 'src/scrcmd.c') diff --git a/src/scrcmd.c b/src/scrcmd.c index 976b80564..c77dda666 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -23,6 +23,7 @@ #include "new_menu_helpers.h" #include "window.h" #include "start_menu.h" +#include "script_menu.h" extern u16 (*const gSpecials[])(void); extern u16 (*const gSpecialsEnd[])(void); @@ -1407,3 +1408,170 @@ SCRCMD_DEF(waitbuttonpress) SetupNativeScript(ctx, WaitForAorBPress); return TRUE; } + +SCRCMD_DEF(yesnobox) +{ + u8 left = ScriptReadByte(ctx); + u8 top = ScriptReadByte(ctx); + + if (ScriptMenu_YesNo(left, top) == TRUE) + { + ScriptContext1_Stop(); + return TRUE; + } + else + { + return FALSE; + } +} + +SCRCMD_DEF(multichoice) +{ + u8 left = ScriptReadByte(ctx); + u8 top = ScriptReadByte(ctx); + u8 multichoiceId = ScriptReadByte(ctx); + u8 ignoreBPress = ScriptReadByte(ctx); + + if (ScriptMenu_Multichoice(left, top, multichoiceId, ignoreBPress) == TRUE) + { + ScriptContext1_Stop(); + return TRUE; + } + else + { + return FALSE; + } +} + +SCRCMD_DEF(multichoicedefault) +{ + u8 left = ScriptReadByte(ctx); + u8 top = ScriptReadByte(ctx); + u8 multichoiceId = ScriptReadByte(ctx); + u8 defaultChoice = ScriptReadByte(ctx); + u8 ignoreBPress = ScriptReadByte(ctx); + + if (ScriptMenu_MultichoiceWithDefault(left, top, multichoiceId, ignoreBPress, defaultChoice) == TRUE) + { + ScriptContext1_Stop(); + return TRUE; + } + else + { + return FALSE; + } +} + +SCRCMD_DEF(drawbox) +{ + /*u8 left = ScriptReadByte(ctx); + u8 top = ScriptReadByte(ctx); + u8 right = ScriptReadByte(ctx); + u8 bottom = ScriptReadByte(ctx); + + MenuDrawTextWindow(left, top, right, bottom);*/ + return FALSE; +} + +SCRCMD_DEF(multichoicegrid) +{ + u8 left = ScriptReadByte(ctx); + u8 top = ScriptReadByte(ctx); + u8 multichoiceId = ScriptReadByte(ctx); + u8 numColumns = ScriptReadByte(ctx); + u8 ignoreBPress = ScriptReadByte(ctx); + + if (ScriptMenu_MultichoiceGrid(left, top, multichoiceId, ignoreBPress, numColumns) == TRUE) + { + ScriptContext1_Stop(); + return TRUE; + } + else + { + return FALSE; + } +} + +SCRCMD_DEF(erasebox) +{ + u8 left = ScriptReadByte(ctx); + u8 top = ScriptReadByte(ctx); + u8 right = ScriptReadByte(ctx); + u8 bottom = ScriptReadByte(ctx); + + // MenuZeroFillWindowRect(left, top, right, bottom); + return FALSE; +} + +SCRCMD_DEF(drawboxtext) +{ +// u8 left = ScriptReadByte(ctx); +// u8 top = ScriptReadByte(ctx); +// u8 multichoiceId = ScriptReadByte(ctx); +// u8 ignoreBPress = ScriptReadByte(ctx); + + /*if (Multichoice(left, top, multichoiceId, ignoreBPress) == TRUE) + { + ScriptContext1_Stop(); + return TRUE; + }*/ + return FALSE; +} + +SCRCMD_DEF(showmonpic) +{ + u16 species = VarGet(ScriptReadHalfword(ctx)); + u8 x = ScriptReadByte(ctx); + u8 y = ScriptReadByte(ctx); + + ScriptMenu_ShowPokemonPic(species, x, y); + PlayCry7(species, 0); + return FALSE; +} + +SCRCMD_DEF(hidemonpic) +{ + bool8 (*func)(void) = ScriptMenu_GetPicboxWaitFunc(); + + if (func == NULL) + return FALSE; + SetupNativeScript(ctx, func); + return TRUE; +} + +SCRCMD_DEF(showcontestwinner) +{ + u8 v1 = ScriptReadByte(ctx); + + /* + if (v1) + sub_812FDA8(v1); + ShowContestWinner(); + ScriptContext1_Stop(); + return TRUE; + */ + + return FALSE; +} + +SCRCMD_DEF(braillemessage) +{ + u8 *ptr = (u8 *)ScriptReadWord(ctx); + if (ptr == NULL) + ptr = (u8 *)ctx->data[0]; + + sub_80F6E9C(); + sub_80F6EE4(0, 1); + AddTextPrinterParameterized(0, 6, ptr, 0, 1, 0, NULL); + return FALSE; +} + +SCRCMD_DEF(getbraillestringwidth) +{ + u8 *ptr = (u8 *)ScriptReadWord(ctx); + if (ptr == NULL) + ptr = (u8 *)ctx->data[0]; + + gSpecialVar_0x8004 = GetStringWidth(6, ptr, -1); + return FALSE; +} -- cgit v1.2.3 From 2822d29c0bd7e579388f9d0772a7b5d1af430b31 Mon Sep 17 00:00:00 2001 From: scnorton Date: Sun, 6 Jan 2019 15:28:10 -0500 Subject: through ScrCmd_bufferstring --- src/scrcmd.c | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 141 insertions(+), 7 deletions(-) (limited to 'src/scrcmd.c') diff --git a/src/scrcmd.c b/src/scrcmd.c index c77dda666..98a3fa027 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -24,6 +24,10 @@ #include "window.h" #include "start_menu.h" #include "script_menu.h" +#include "string_util.h" +#include "data2.h" +#include "field_specials.h" +#include "constants/items.h" extern u16 (*const gSpecials[])(void); extern u16 (*const gSpecialsEnd[])(void); @@ -341,13 +345,6 @@ SCRCMD_DEF(setorcopyvar) return FALSE; } -u8 * const sScriptStringVars[] = -{ - gStringVar1, - gStringVar2, - gStringVar3, -}; - u8 compare_012(u16 left, u16 right) { if (left < right) @@ -1575,3 +1572,140 @@ SCRCMD_DEF(getbraillestringwidth) gSpecialVar_0x8004 = GetStringWidth(6, ptr, -1); return FALSE; } + +SCRCMD_DEF(vmessage) +{ + u32 v1 = ScriptReadWord(ctx); + + ShowFieldMessage((u8 *)(v1 - gVScriptOffset)); + return FALSE; +} + +u8 * const sScriptStringVars[] = +{ + gStringVar1, + gStringVar2, + gStringVar3, +}; + +bool8 ScrCmd_bufferspeciesname(struct ScriptContext *ctx) +{ + u8 stringVarIndex = ScriptReadByte(ctx); + u16 species = VarGet(ScriptReadHalfword(ctx)); + + StringCopy(sScriptStringVars[stringVarIndex], gSpeciesNames[species]); + return FALSE; +} + +bool8 ScrCmd_bufferleadmonspeciesname(struct ScriptContext *ctx) +{ + u8 stringVarIndex = ScriptReadByte(ctx); + + u8 *dest = sScriptStringVars[stringVarIndex]; + u8 partyIndex = GetLeadMonIndex(); + u32 species = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPECIES, NULL); + StringCopy(dest, gSpeciesNames[species]); + return FALSE; +} + +bool8 ScrCmd_bufferpartymonnick(struct ScriptContext *ctx) +{ + u8 stringVarIndex = ScriptReadByte(ctx); + u16 partyIndex = VarGet(ScriptReadHalfword(ctx)); + + GetMonData(&gPlayerParty[partyIndex], MON_DATA_NICKNAME, sScriptStringVars[stringVarIndex]); + StringGetEnd10(sScriptStringVars[stringVarIndex]); + return FALSE; +} + +bool8 ScrCmd_bufferitemname(struct ScriptContext *ctx) +{ + u8 stringVarIndex = ScriptReadByte(ctx); + u16 itemId = VarGet(ScriptReadHalfword(ctx)); + + CopyItemName(itemId, sScriptStringVars[stringVarIndex]); + return FALSE; +} + +extern const u8 gUnknown_83A72A0[]; +extern const u8 gUnknown_83A72A2[]; + +bool8 ScrCmd_bufferitemnameplural(struct ScriptContext *ctx) +{ + u8 stringVarIndex = ScriptReadByte(ctx); + u16 itemId = VarGet(ScriptReadHalfword(ctx)); + u16 quantity = VarGet(ScriptReadHalfword(ctx)); + + CopyItemName(itemId, sScriptStringVars[stringVarIndex]); + if (itemId == ITEM_POKE_BALL && quantity >= 2) + StringAppend(sScriptStringVars[stringVarIndex], gUnknown_83A72A0); + else if (itemId >= ITEM_CHERI_BERRY && itemId < ITEM_ENIGMA_BERRY && quantity >= 2) + { + u16 strlength = StringLength(sScriptStringVars[stringVarIndex]); + if (strlength != 0) + { + u8 * endptr = sScriptStringVars[stringVarIndex] + strlength; + endptr[-1] = EOS; + StringAppend(sScriptStringVars[stringVarIndex], gUnknown_83A72A2); + } + } + + return FALSE; +} + +bool8 ScrCmd_bufferdecorationname(struct ScriptContext *ctx) +{ + u8 stringVarIndex = ScriptReadByte(ctx); + u16 decorId = VarGet(ScriptReadHalfword(ctx)); + +// StringCopy(sScriptStringVars[stringVarIndex], gDecorations[decorId].name); + return FALSE; +} + +bool8 ScrCmd_buffermovename(struct ScriptContext *ctx) +{ + u8 stringVarIndex = ScriptReadByte(ctx); + u16 moveId = VarGet(ScriptReadHalfword(ctx)); + + StringCopy(sScriptStringVars[stringVarIndex], gMoveNames[moveId]); + return FALSE; +} + +bool8 ScrCmd_buffernumberstring(struct ScriptContext *ctx) +{ + u8 stringVarIndex = ScriptReadByte(ctx); + u16 v1 = VarGet(ScriptReadHalfword(ctx)); + u8 v2 = CountDigits(v1); + + ConvertIntToDecimalStringN(sScriptStringVars[stringVarIndex], v1, 0, v2); + return FALSE; +} + +bool8 ScrCmd_bufferstdstring(struct ScriptContext *ctx) +{ + u8 stringVarIndex = ScriptReadByte(ctx); + u16 index = VarGet(ScriptReadHalfword(ctx)); + + StringCopy(sScriptStringVars[stringVarIndex], gStdStringPtrs[index]); + return FALSE; +} + +/* +bool8 ScrCmd_buffercontesttype(struct ScriptContext *ctx) +{ + u8 stringVarIndex = ScriptReadByte(ctx); + u16 index = VarGet(ScriptReadHalfword(ctx)); + + sub_818E868(sScriptStringVars[stringVarIndex], index); + return FALSE; +} +*/ + +bool8 ScrCmd_bufferstring(struct ScriptContext *ctx) +{ + u8 stringVarIndex = ScriptReadByte(ctx); + const u8 *text = (u8 *)ScriptReadWord(ctx); + + StringCopy(sScriptStringVars[stringVarIndex], text); + return FALSE; +} -- cgit v1.2.3 From fdd7b1033cb32f02eb861ca87fa92b9886bdfe37 Mon Sep 17 00:00:00 2001 From: scnorton Date: Sun, 6 Jan 2019 16:00:27 -0500 Subject: Through ScrCmd_pokemart --- src/scrcmd.c | 273 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 262 insertions(+), 11 deletions(-) (limited to 'src/scrcmd.c') diff --git a/src/scrcmd.c b/src/scrcmd.c index 98a3fa027..3d7200b5b 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -28,6 +28,14 @@ #include "data2.h" #include "field_specials.h" #include "constants/items.h" +#include "script_pokemon_util_80A0058.h" +#include "pokemon_storage_system.h" +#include "party_menu.h" +#include "money.h" +#include "coins.h" +#include "battle_setup.h" +#include "shop.h" +#include "script_pokemon_80F8.h" extern u16 (*const gSpecials[])(void); extern u16 (*const gSpecialsEnd[])(void); @@ -1588,7 +1596,7 @@ u8 * const sScriptStringVars[] = gStringVar3, }; -bool8 ScrCmd_bufferspeciesname(struct ScriptContext *ctx) +SCRCMD_DEF(bufferspeciesname) { u8 stringVarIndex = ScriptReadByte(ctx); u16 species = VarGet(ScriptReadHalfword(ctx)); @@ -1597,7 +1605,7 @@ bool8 ScrCmd_bufferspeciesname(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_bufferleadmonspeciesname(struct ScriptContext *ctx) +SCRCMD_DEF(bufferleadmonspeciesname) { u8 stringVarIndex = ScriptReadByte(ctx); @@ -1608,7 +1616,7 @@ bool8 ScrCmd_bufferleadmonspeciesname(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_bufferpartymonnick(struct ScriptContext *ctx) +SCRCMD_DEF(bufferpartymonnick) { u8 stringVarIndex = ScriptReadByte(ctx); u16 partyIndex = VarGet(ScriptReadHalfword(ctx)); @@ -1618,7 +1626,7 @@ bool8 ScrCmd_bufferpartymonnick(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_bufferitemname(struct ScriptContext *ctx) +SCRCMD_DEF(bufferitemname) { u8 stringVarIndex = ScriptReadByte(ctx); u16 itemId = VarGet(ScriptReadHalfword(ctx)); @@ -1630,7 +1638,7 @@ bool8 ScrCmd_bufferitemname(struct ScriptContext *ctx) extern const u8 gUnknown_83A72A0[]; extern const u8 gUnknown_83A72A2[]; -bool8 ScrCmd_bufferitemnameplural(struct ScriptContext *ctx) +SCRCMD_DEF(bufferitemnameplural) { u8 stringVarIndex = ScriptReadByte(ctx); u16 itemId = VarGet(ScriptReadHalfword(ctx)); @@ -1653,7 +1661,7 @@ bool8 ScrCmd_bufferitemnameplural(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_bufferdecorationname(struct ScriptContext *ctx) +SCRCMD_DEF(bufferdecorationname) { u8 stringVarIndex = ScriptReadByte(ctx); u16 decorId = VarGet(ScriptReadHalfword(ctx)); @@ -1662,7 +1670,7 @@ bool8 ScrCmd_bufferdecorationname(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_buffermovename(struct ScriptContext *ctx) +SCRCMD_DEF(buffermovename) { u8 stringVarIndex = ScriptReadByte(ctx); u16 moveId = VarGet(ScriptReadHalfword(ctx)); @@ -1671,7 +1679,7 @@ bool8 ScrCmd_buffermovename(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_buffernumberstring(struct ScriptContext *ctx) +SCRCMD_DEF(buffernumberstring) { u8 stringVarIndex = ScriptReadByte(ctx); u16 v1 = VarGet(ScriptReadHalfword(ctx)); @@ -1681,7 +1689,7 @@ bool8 ScrCmd_buffernumberstring(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_bufferstdstring(struct ScriptContext *ctx) +SCRCMD_DEF(bufferstdstring) { u8 stringVarIndex = ScriptReadByte(ctx); u16 index = VarGet(ScriptReadHalfword(ctx)); @@ -1691,7 +1699,7 @@ bool8 ScrCmd_bufferstdstring(struct ScriptContext *ctx) } /* -bool8 ScrCmd_buffercontesttype(struct ScriptContext *ctx) +SCRCMD_DEF(buffercontesttype) { u8 stringVarIndex = ScriptReadByte(ctx); u16 index = VarGet(ScriptReadHalfword(ctx)); @@ -1701,7 +1709,7 @@ bool8 ScrCmd_buffercontesttype(struct ScriptContext *ctx) } */ -bool8 ScrCmd_bufferstring(struct ScriptContext *ctx) +SCRCMD_DEF(bufferstring) { u8 stringVarIndex = ScriptReadByte(ctx); const u8 *text = (u8 *)ScriptReadWord(ctx); @@ -1709,3 +1717,246 @@ bool8 ScrCmd_bufferstring(struct ScriptContext *ctx) StringCopy(sScriptStringVars[stringVarIndex], text); return FALSE; } + +SCRCMD_DEF(vloadword) +{ + const u8 *ptr = (u8 *)(ScriptReadWord(ctx) - gVScriptOffset); + + StringExpandPlaceholders(gStringVar4, ptr); + return FALSE; +} + +SCRCMD_DEF(vbufferstring) +{ + u8 stringVarIndex = ScriptReadByte(ctx); + u32 addr = ScriptReadWord(ctx); + + const u8 *src = (u8 *)(addr - gVScriptOffset); + u8 *dest = sScriptStringVars[stringVarIndex]; + StringCopy(dest, src); + return FALSE; +} + +SCRCMD_DEF(bufferboxname) +{ + u8 stringVarIndex = ScriptReadByte(ctx); + u16 boxId = VarGet(ScriptReadHalfword(ctx)); + + StringCopy(sScriptStringVars[stringVarIndex], GetBoxNamePtr(boxId)); + return FALSE; +} + +SCRCMD_DEF(givemon) +{ + u16 species = VarGet(ScriptReadHalfword(ctx)); + u8 level = ScriptReadByte(ctx); + u16 item = VarGet(ScriptReadHalfword(ctx)); + u32 unkParam1 = ScriptReadWord(ctx); + u32 unkParam2 = ScriptReadWord(ctx); + u8 unkParam3 = ScriptReadByte(ctx); + + gSpecialVar_Result = ScriptGiveMon(species, level, item, unkParam1, unkParam2, unkParam3); + return FALSE; +} + +SCRCMD_DEF(giveegg) +{ + u16 species = VarGet(ScriptReadHalfword(ctx)); + + gSpecialVar_Result = ScriptGiveEgg(species); + return FALSE; +} + +SCRCMD_DEF(setmonmove) +{ + u8 partyIndex = ScriptReadByte(ctx); + u8 slot = ScriptReadByte(ctx); + u16 move = ScriptReadHalfword(ctx); + + ScriptSetMonMoveSlot(partyIndex, move, slot); + return FALSE; +} + +SCRCMD_DEF(checkpartymove) +{ + u8 i; + u16 moveId = ScriptReadHalfword(ctx); + + gSpecialVar_Result = PARTY_SIZE; + for (i = 0; i < PARTY_SIZE; i++) + { + u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL); + if (!species) + break; + if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG) && MonKnowsMove(&gPlayerParty[i], moveId) == TRUE) + { + gSpecialVar_Result = i; + gSpecialVar_0x8004 = species; + break; + } + } + return FALSE; +} + +SCRCMD_DEF(givemoney) +{ + u32 amount = ScriptReadWord(ctx); + u8 ignore = ScriptReadByte(ctx); + + if (!ignore) + AddMoney(&gSaveBlock1Ptr->money, amount); + return FALSE; +} + +SCRCMD_DEF(takemoney) +{ + u32 amount = ScriptReadWord(ctx); + u8 ignore = ScriptReadByte(ctx); + + if (!ignore) + RemoveMoney(&gSaveBlock1Ptr->money, amount); + return FALSE; +} + +SCRCMD_DEF(checkmoney) +{ + u32 amount = ScriptReadWord(ctx); + u8 ignore = ScriptReadByte(ctx); + + if (!ignore) + gSpecialVar_Result = IsEnoughMoney(&gSaveBlock1Ptr->money, amount); + return FALSE; +} + +SCRCMD_DEF(showmoneybox) +{ + u8 x = ScriptReadByte(ctx); + u8 y = ScriptReadByte(ctx); + u8 ignore = ScriptReadByte(ctx); + + if (!ignore && sub_81119D4(sub_809D6D4) != TRUE) + DrawMoneyBox(GetMoney(&gSaveBlock1Ptr->money), x, y); + return FALSE; +} + +SCRCMD_DEF(hidemoneybox) +{ + /*u8 x = ScriptReadByte(ctx); + u8 y = ScriptReadByte(ctx);*/ + + HideMoneyBox(); + return FALSE; +} + +SCRCMD_DEF(updatemoneybox) +{ + u8 x = ScriptReadByte(ctx); + u8 y = ScriptReadByte(ctx); + u8 ignore = ScriptReadByte(ctx); + + if (!ignore) + ChangeAmountInMoneyBox(GetMoney(&gSaveBlock1Ptr->money)); + return FALSE; +} + +SCRCMD_DEF(showcoinsbox) +{ + u8 x = ScriptReadByte(ctx); + u8 y = ScriptReadByte(ctx); + + if (sub_81119D4(sub_809D6D4) != TRUE) + ShowCoinsWindow(GetCoins(), x, y); + return FALSE; +} + +SCRCMD_DEF(hidecoinsbox) +{ + u8 x = ScriptReadByte(ctx); + u8 y = ScriptReadByte(ctx); + + HideCoinsWindow(); + return FALSE; +} + +SCRCMD_DEF(updatecoinsbox) +{ + u8 x = ScriptReadByte(ctx); + u8 y = ScriptReadByte(ctx); + + PrintCoinsString(GetCoins()); + return FALSE; +} + +SCRCMD_DEF(trainerbattle) +{ + ctx->scriptPtr = BattleSetup_ConfigureTrainerBattle(ctx->scriptPtr); + return FALSE; +} + +SCRCMD_DEF(dotrainerbattle) +{ + BattleSetup_StartTrainerBattle(); + return TRUE; +} + +SCRCMD_DEF(gotopostbattlescript) +{ + ctx->scriptPtr = BattleSetup_GetScriptAddrAfterBattle(); + return FALSE; +} + +SCRCMD_DEF(gotobeatenscript) +{ + ctx->scriptPtr = BattleSetup_GetTrainerPostBattleScript(); + return FALSE; +} + +SCRCMD_DEF(checktrainerflag) +{ + u16 index = VarGet(ScriptReadHalfword(ctx)); + + ctx->comparisonResult = HasTrainerAlreadyBeenFought(index); + return FALSE; +} + +SCRCMD_DEF(settrainerflag) +{ + u16 index = VarGet(ScriptReadHalfword(ctx)); + + SetTrainerFlag(index); + return FALSE; +} + +SCRCMD_DEF(cleartrainerflag) +{ + u16 index = VarGet(ScriptReadHalfword(ctx)); + + ClearTrainerFlag(index); + return FALSE; +} + +SCRCMD_DEF(setwildbattle) +{ + u16 species = ScriptReadHalfword(ctx); + u8 level = ScriptReadByte(ctx); + u16 item = ScriptReadHalfword(ctx); + + CreateScriptedWildMon(species, level, item); + return FALSE; +} + +SCRCMD_DEF(dowildbattle) +{ + BattleSetup_StartScriptedWildBattle(); + ScriptContext1_Stop(); + return TRUE; +} + +SCRCMD_DEF(pokemart) +{ + const void *ptr = (void *)ScriptReadWord(ctx); + + CreatePokemartMenu(ptr); + ScriptContext1_Stop(); + return TRUE; +} -- cgit v1.2.3 From abac6f3ec853f451a7d456cfd336d8c51c0541c1 Mon Sep 17 00:00:00 2001 From: scnorton Date: Sun, 6 Jan 2019 16:14:59 -0500 Subject: Through ScrCmd_takecoins --- src/scrcmd.c | 270 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 269 insertions(+), 1 deletion(-) (limited to 'src/scrcmd.c') diff --git a/src/scrcmd.c b/src/scrcmd.c index 3d7200b5b..c6f6ab5d3 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -36,6 +36,10 @@ #include "battle_setup.h" #include "shop.h" #include "script_pokemon_80F8.h" +#include "slot_machine.h" +#include "field_effect.h" +#include "fieldmap.h" +#include "field_door.h" extern u16 (*const gSpecials[])(void); extern u16 (*const gSpecialsEnd[])(void); @@ -48,7 +52,7 @@ EWRAM_DATA u16 sPauseCounter = 0; EWRAM_DATA u16 sMovingNpcId = 0; EWRAM_DATA u16 sMovingNpcMapBank = 0; EWRAM_DATA u16 sMovingNpcMapId = 0; -EWRAM_DATA u16 gUnknown_20370B6 = 0; +EWRAM_DATA u16 sFieldEffectScriptId = 0; extern u8 gSelectedEventObject; @@ -1960,3 +1964,267 @@ SCRCMD_DEF(pokemart) ScriptContext1_Stop(); return TRUE; } + +SCRCMD_DEF(pokemartdecoration) +{ + const void *ptr = (void *)ScriptReadWord(ctx); + + CreateDecorationShop1Menu(ptr); + ScriptContext1_Stop(); + return TRUE; +} + +SCRCMD_DEF(pokemartdecoration2) +{ + const void *ptr = (void *)ScriptReadWord(ctx); + + CreateDecorationShop2Menu(ptr); + ScriptContext1_Stop(); + return TRUE; +} + +SCRCMD_DEF(playslotmachine) +{ + u8 slotMachineIndex = VarGet(ScriptReadHalfword(ctx)); + + PlaySlotMachine(slotMachineIndex, c2_exit_to_overworld_1_continue_scripts_restart_music); + ScriptContext1_Stop(); + return TRUE; +} + +SCRCMD_DEF(setberrytree) +{ +// u8 treeId = ScriptReadByte(ctx); +// u8 berry = ScriptReadByte(ctx); +// u8 growthStage = ScriptReadByte(ctx); +// +// if (berry == 0) +// PlantBerryTree(treeId, 0, growthStage, FALSE); +// else +// PlantBerryTree(treeId, berry, growthStage, FALSE); + return FALSE; +} + +SCRCMD_DEF(getpricereduction) +{ +// u16 value = VarGet(ScriptReadHalfword(ctx)); +// +// gSpecialVar_Result = GetPriceReduction(value); + return FALSE; +} + +SCRCMD_DEF(choosecontestmon) +{ +// sub_81B9404(); + ScriptContext1_Stop(); + return TRUE; +} + + +SCRCMD_DEF(startcontest) +{ +// sub_80F840C(); +// ScriptContext1_Stop(); +// return TRUE; + return FALSE; +} + +SCRCMD_DEF(showcontestresults) +{ +// sub_80F8484(); +// ScriptContext1_Stop(); +// return TRUE; + return FALSE; +} + +SCRCMD_DEF(contestlinktransfer) +{ +// sub_80F84C4(gSpecialVar_ContestCategory); +// ScriptContext1_Stop(); +// return TRUE; + return FALSE; +} + +SCRCMD_DEF(dofieldeffect) +{ + u16 effectId = VarGet(ScriptReadHalfword(ctx)); + + sFieldEffectScriptId = effectId; + FieldEffectStart(sFieldEffectScriptId); + return FALSE; +} + +SCRCMD_DEF(setfieldeffectarg) +{ + u8 argNum = ScriptReadByte(ctx); + + gFieldEffectArguments[argNum] = (s16)VarGet(ScriptReadHalfword(ctx)); + return FALSE; +} + +static bool8 WaitForFieldEffectFinish(void) +{ + if (!FieldEffectActiveListContains(sFieldEffectScriptId)) + return TRUE; + else + return FALSE; +} + +SCRCMD_DEF(waitfieldeffect) +{ + sFieldEffectScriptId = VarGet(ScriptReadHalfword(ctx)); + SetupNativeScript(ctx, WaitForFieldEffectFinish); + return TRUE; +} + +SCRCMD_DEF(setrespawn) +{ + u16 healLocationId = VarGet(ScriptReadHalfword(ctx)); + + SetLastHealLocationWarp(healLocationId); + return FALSE; +} + +SCRCMD_DEF(checkplayergender) +{ + gSpecialVar_Result = gSaveBlock2Ptr->playerGender; + return FALSE; +} + +SCRCMD_DEF(playmoncry) +{ + u16 species = VarGet(ScriptReadHalfword(ctx)); + u16 mode = VarGet(ScriptReadHalfword(ctx)); + + PlayCry7(species, mode); + return FALSE; +} + +SCRCMD_DEF(waitmoncry) +{ + SetupNativeScript(ctx, IsCryFinished); + return TRUE; +} + +SCRCMD_DEF(setmetatile) +{ + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + u16 tileId = VarGet(ScriptReadHalfword(ctx)); + u16 v8 = VarGet(ScriptReadHalfword(ctx)); + + x += 7; + y += 7; + if (!v8) + MapGridSetMetatileIdAt(x, y, tileId); + else + MapGridSetMetatileIdAt(x, y, tileId | 0xC00); + return FALSE; +} + +SCRCMD_DEF(opendoor) +{ + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + + x += 7; + y += 7; + PlaySE(GetDoorSoundEffect(x, y)); + FieldAnimateDoorOpen(x, y); + return FALSE; +} + +SCRCMD_DEF(closedoor) +{ + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + + x += 7; + y += 7; + FieldAnimateDoorClose(x, y); + return FALSE; +} + +static bool8 IsDoorAnimationStopped(void) +{ + if (!FieldIsDoorAnimationRunning()) + return TRUE; + else + return FALSE; +} + +SCRCMD_DEF(waitdooranim) +{ + SetupNativeScript(ctx, IsDoorAnimationStopped); + return TRUE; +} + +SCRCMD_DEF(setdooropen) +{ + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + + x += 7; + y += 7; + FieldSetDoorOpened(x, y); + return FALSE; +} + +SCRCMD_DEF(setdoorclosed) +{ + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + + x += 7; + y += 7; + FieldSetDoorClosed(x, y); + return FALSE; +} + +SCRCMD_DEF(addelevmenuitem) +{ +// u8 v3 = ScriptReadByte(ctx); +// u16 v5 = VarGet(ScriptReadHalfword(ctx)); +// u16 v7 = VarGet(ScriptReadHalfword(ctx)); +// u16 v9 = VarGet(ScriptReadHalfword(ctx)); + + //ScriptAddElevatorMenuItem(v3, v5, v7, v9); + return FALSE; +} + +SCRCMD_DEF(showelevmenu) +{ + /*ScriptShowElevatorMenu(); + ScriptContext1_Stop(); + return TRUE;*/ + return FALSE; +} + +SCRCMD_DEF(checkcoins) +{ + u16 *ptr = GetVarPointer(ScriptReadHalfword(ctx)); + *ptr = GetCoins(); + return FALSE; +} + +SCRCMD_DEF(givecoins) +{ + u16 coins = VarGet(ScriptReadHalfword(ctx)); + + if (GiveCoins(coins) == TRUE) + gSpecialVar_Result = 0; + else + gSpecialVar_Result = 1; + return FALSE; +} + +SCRCMD_DEF(takecoins) +{ + u16 coins = VarGet(ScriptReadHalfword(ctx)); + + if (TakeCoins(coins) == TRUE) + gSpecialVar_Result = 0; + else + gSpecialVar_Result = 1; + return FALSE; +} -- cgit v1.2.3 From 1581631e6286e0ec8178630433e8c15cd7076ead Mon Sep 17 00:00:00 2001 From: scnorton Date: Sun, 6 Jan 2019 16:17:40 -0500 Subject: Finish decompiling scrcmd --- src/scrcmd.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'src/scrcmd.c') diff --git a/src/scrcmd.c b/src/scrcmd.c index c6f6ab5d3..911ad2a42 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -2228,3 +2228,43 @@ SCRCMD_DEF(takecoins) gSpecialVar_Result = 1; return FALSE; } + +SCRCMD_DEF(cmdCA) +{ + sub_8069A20(); + return FALSE; +} + +SCRCMD_DEF(cmdCB) +{ + sub_8069A2C(); + return FALSE; +} + +// This command will force the Pokémon to be obedient, you don't get to make it disobedient. +SCRCMD_DEF(setmonobedient) +{ + bool8 obedient = TRUE; + u16 partyIndex = VarGet(ScriptReadHalfword(ctx)); + + SetMonData(&gPlayerParty[partyIndex], MON_DATA_OBEDIENCE, &obedient); + return FALSE; +} + +SCRCMD_DEF(checkmonobedience) +{ + u16 partyIndex = VarGet(ScriptReadHalfword(ctx)); + + gSpecialVar_Result = GetMonData(&gPlayerParty[partyIndex], MON_DATA_OBEDIENCE, NULL); + return FALSE; +} + +SCRCMD_DEF(setmonmetlocation) +{ + u16 partyIndex = VarGet(ScriptReadHalfword(ctx)); + u8 location = ScriptReadByte(ctx); + + if (partyIndex < PARTY_SIZE) + SetMonData(&gPlayerParty[partyIndex], MON_DATA_MET_LOCATION, &location); + return FALSE; +} -- cgit v1.2.3 From 08ffdce1b642dfc00080f99578049b8c3ddfd7e9 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 6 Jan 2019 20:13:06 -0500 Subject: Nuke SCRCMD_DEF macro --- src/scrcmd.c | 471 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 234 insertions(+), 237 deletions(-) (limited to 'src/scrcmd.c') diff --git a/src/scrcmd.c b/src/scrcmd.c index 911ad2a42..12b35daa4 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -40,12 +40,16 @@ #include "field_effect.h" #include "fieldmap.h" #include "field_door.h" +#include "scrcmd.h" extern u16 (*const gSpecials[])(void); extern u16 (*const gSpecialsEnd[])(void); extern const u8 *const gStdScripts[]; extern const u8 *const gStdScriptsEnd[]; +static bool8 sub_806B93C(struct ScriptContext * ctx); +static u8 sub_806B96C(struct ScriptContext * ctx); + EWRAM_DATA ptrdiff_t gVScriptOffset = 0; EWRAM_DATA u8 gUnknown_20370AC = 0; EWRAM_DATA u16 sPauseCounter = 0; @@ -54,105 +58,103 @@ EWRAM_DATA u16 sMovingNpcMapBank = 0; EWRAM_DATA u16 sMovingNpcMapId = 0; EWRAM_DATA u16 sFieldEffectScriptId = 0; +IWRAM_DATA struct ScriptContext * gUnknown_3005070; + extern u8 gSelectedEventObject; // This is defined in here so the optimizer can't see its value when compiling // script.c. void * const gNullScriptPtr = NULL; -const u8 sScriptConditionTable[6][3] = - { +static const u8 sScriptConditionTable[6][3] = +{ // < = > - 1, 0, 0, // < - 0, 1, 0, // = - 0, 0, 1, // > - 1, 1, 0, // <= - 0, 1, 1, // >= - 1, 0, 1, // != - }; - - - -#define SCRCMD_DEF(name) bool8 ScrCmd_##name(struct ScriptContext *ctx) + 1, 0, 0, // < + 0, 1, 0, // = + 0, 0, 1, // > + 1, 1, 0, // <= + 0, 1, 1, // >= + 1, 0, 1, // != +}; -SCRCMD_DEF(nop) +bool8 ScrCmd_nop(struct ScriptContext *ctx) { return FALSE; } -SCRCMD_DEF(nop1) +bool8 ScrCmd_nop1(struct ScriptContext *ctx) { return FALSE; } -SCRCMD_DEF(end) +bool8 ScrCmd_end(struct ScriptContext *ctx) { StopScript(ctx); return FALSE; } -SCRCMD_DEF(gotonative) +bool8 ScrCmd_gotonative(struct ScriptContext *ctx) { bool8 (*func)(void) = (bool8 (*)(void))ScriptReadWord(ctx); SetupNativeScript(ctx, func); return TRUE; } -SCRCMD_DEF(special) +bool8 ScrCmd_special(struct ScriptContext *ctx) { u16 (*const *specialPtr)(void) = gSpecials + ScriptReadHalfword(ctx); if (specialPtr < gSpecialsEnd) (*specialPtr)(); else - AGB_ASSERT_EX(0, "C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/scrcmd.c", 241); + AGB_ASSERT_EX(0, "C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/scrcmd.c", 241); return FALSE; } -SCRCMD_DEF(specialvar) +bool8 ScrCmd_specialvar(struct ScriptContext *ctx) { u16 * varPtr = GetVarPointer(ScriptReadHalfword(ctx)); u16 (*const *specialPtr)(void) = gSpecials + ScriptReadHalfword(ctx); if (specialPtr < gSpecialsEnd) *varPtr = (*specialPtr)(); else - AGB_ASSERT_EX(0, "C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/scrcmd.c", 263); + AGB_ASSERT_EX(0, "C:/WORK/POKeFRLG/src/pm_lgfr_ose/source/scrcmd.c", 263); return FALSE; } -SCRCMD_DEF(callnative) +bool8 ScrCmd_callnative(struct ScriptContext *ctx) { void (*func )(void) = ((void (*)(void))ScriptReadWord(ctx)); func(); return FALSE; } -SCRCMD_DEF(waitstate) +bool8 ScrCmd_waitstate(struct ScriptContext *ctx) { ScriptContext1_Stop(); return TRUE; } -SCRCMD_DEF(goto) +bool8 ScrCmd_goto(struct ScriptContext *ctx) { const u8 * scrptr = (const u8 *)ScriptReadWord(ctx); ScriptJump(ctx, scrptr); return FALSE; } -SCRCMD_DEF(return) +bool8 ScrCmd_return(struct ScriptContext *ctx) { ScriptReturn(ctx); return FALSE; } -SCRCMD_DEF(call) +bool8 ScrCmd_call(struct ScriptContext *ctx) { const u8 * scrptr = (const u8 *)ScriptReadWord(ctx); ScriptCall(ctx, scrptr); return FALSE; } -SCRCMD_DEF(goto_if) +bool8 ScrCmd_goto_if(struct ScriptContext *ctx) { u8 condition = ScriptReadByte(ctx); const u8 * scrptr = (const u8 *)ScriptReadWord(ctx); @@ -161,7 +163,7 @@ SCRCMD_DEF(goto_if) return FALSE; } -SCRCMD_DEF(call_if) +bool8 ScrCmd_call_if(struct ScriptContext *ctx) { u8 condition = ScriptReadByte(ctx); const u8 * scrptr = (const u8 *)ScriptReadWord(ctx); @@ -170,7 +172,7 @@ SCRCMD_DEF(call_if) return FALSE; } -SCRCMD_DEF(setvaddress) +bool8 ScrCmd_setvaddress(struct ScriptContext *ctx) { u32 addr1 = (u32)ctx->scriptPtr - 1; u32 addr2 = ScriptReadWord(ctx); @@ -179,21 +181,21 @@ SCRCMD_DEF(setvaddress) return FALSE; } -SCRCMD_DEF(vgoto) +bool8 ScrCmd_vgoto(struct ScriptContext *ctx) { const u8 * scrptr = (const u8 *)ScriptReadWord(ctx); ScriptJump(ctx, scrptr - gVScriptOffset); return FALSE; } -SCRCMD_DEF(vcall) +bool8 ScrCmd_vcall(struct ScriptContext *ctx) { const u8 * scrptr = (const u8 *)ScriptReadWord(ctx); ScriptCall(ctx, scrptr - gVScriptOffset); return FALSE; } -SCRCMD_DEF(vgoto_if) +bool8 ScrCmd_vgoto_if(struct ScriptContext *ctx) { u8 condition = ScriptReadByte(ctx); const u8 * scrptr = (const u8 *)ScriptReadWord(ctx) - gVScriptOffset; @@ -202,7 +204,7 @@ SCRCMD_DEF(vgoto_if) return FALSE; } -SCRCMD_DEF(vcall_if) +bool8 ScrCmd_vcall_if(struct ScriptContext *ctx) { u8 condition = ScriptReadByte(ctx); const u8 * scrptr = (const u8 *)ScriptReadWord(ctx) - gVScriptOffset; @@ -211,7 +213,7 @@ SCRCMD_DEF(vcall_if) return FALSE; } -SCRCMD_DEF(gotostd) +bool8 ScrCmd_gotostd(struct ScriptContext *ctx) { u8 stdIdx = ScriptReadByte(ctx); const u8 *const * script = gStdScripts + stdIdx; @@ -220,7 +222,7 @@ SCRCMD_DEF(gotostd) return FALSE; } -SCRCMD_DEF(callstd) +bool8 ScrCmd_callstd(struct ScriptContext *ctx) { u8 stdIdx = ScriptReadByte(ctx); const u8 *const * script = gStdScripts + stdIdx; @@ -229,7 +231,7 @@ SCRCMD_DEF(callstd) return FALSE; } -SCRCMD_DEF(gotostd_if) +bool8 ScrCmd_gotostd_if(struct ScriptContext *ctx) { u8 condition = ScriptReadByte(ctx); u8 stdIdx = ScriptReadByte(ctx); @@ -242,7 +244,7 @@ SCRCMD_DEF(gotostd_if) return FALSE; } -SCRCMD_DEF(callstd_if) +bool8 ScrCmd_callstd_if(struct ScriptContext *ctx) { u8 condition = ScriptReadByte(ctx); u8 stdIdx = ScriptReadByte(ctx); @@ -255,26 +257,26 @@ SCRCMD_DEF(callstd_if) return FALSE; } -SCRCMD_DEF(gotoram) +bool8 ScrCmd_gotoram(struct ScriptContext *ctx) { ScriptJump(ctx, gRAMScriptPtr); return FALSE; } -SCRCMD_DEF(killscript) +bool8 ScrCmd_killscript(struct ScriptContext *ctx) { ClearRamScript(); StopScript(ctx); return TRUE; } -SCRCMD_DEF(setmysteryeventstatus) +bool8 ScrCmd_setmysteryeventstatus(struct ScriptContext *ctx) { SetMysteryEventScriptStatus(ScriptReadByte(ctx)); return FALSE; } -SCRCMD_DEF(cmdCF) +bool8 ScrCmd_cmdCF(struct ScriptContext *ctx) { const u8 * script = sub_8069E48(); if (script != NULL) @@ -285,42 +287,42 @@ SCRCMD_DEF(cmdCF) return FALSE; } -SCRCMD_DEF(loadword) +bool8 ScrCmd_loadword(struct ScriptContext *ctx) { u8 which = ScriptReadByte(ctx); ctx->data[which] = ScriptReadWord(ctx); return FALSE; } -SCRCMD_DEF(loadbytefromaddr) +bool8 ScrCmd_loadbytefromaddr(struct ScriptContext *ctx) { u8 which = ScriptReadByte(ctx); ctx->data[which] = *(const u8 *)ScriptReadWord(ctx); return FALSE; } -SCRCMD_DEF(writebytetoaddr) +bool8 ScrCmd_writebytetoaddr(struct ScriptContext *ctx) { u8 value = ScriptReadByte(ctx); *(u8 *)ScriptReadWord(ctx) = value; return FALSE; } -SCRCMD_DEF(loadbyte) +bool8 ScrCmd_loadbyte(struct ScriptContext *ctx) { u8 which = ScriptReadByte(ctx); ctx->data[which] = ScriptReadByte(ctx); return FALSE; } -SCRCMD_DEF(setptrbyte) +bool8 ScrCmd_setptrbyte(struct ScriptContext *ctx) { u8 which = ScriptReadByte(ctx); *(u8 *)ScriptReadWord(ctx) = ctx->data[which]; return FALSE; } -SCRCMD_DEF(copylocal) +bool8 ScrCmd_copylocal(struct ScriptContext *ctx) { u8 whichDst = ScriptReadByte(ctx); u8 whichSrc = ScriptReadByte(ctx); @@ -328,21 +330,21 @@ SCRCMD_DEF(copylocal) return FALSE; } -SCRCMD_DEF(copybyte) +bool8 ScrCmd_copybyte(struct ScriptContext *ctx) { u8 * dest = (u8 *)ScriptReadWord(ctx); *dest = *(const u8 *)ScriptReadWord(ctx); return FALSE; } -SCRCMD_DEF(setvar) +bool8 ScrCmd_setvar(struct ScriptContext *ctx) { u16 * varPtr = GetVarPointer(ScriptReadHalfword(ctx)); *varPtr = ScriptReadHalfword(ctx); return FALSE; } -SCRCMD_DEF(copyvar) +bool8 ScrCmd_copyvar(struct ScriptContext *ctx) { u16 * destPtr = GetVarPointer(ScriptReadHalfword(ctx)); u16 * srcPtr = GetVarPointer(ScriptReadHalfword(ctx)); @@ -350,7 +352,7 @@ SCRCMD_DEF(copyvar) return FALSE; } -SCRCMD_DEF(setorcopyvar) +bool8 ScrCmd_setorcopyvar(struct ScriptContext *ctx) { u16 * destPtr = GetVarPointer(ScriptReadHalfword(ctx)); *destPtr = VarGet(ScriptReadHalfword(ctx)); @@ -368,7 +370,7 @@ u8 compare_012(u16 left, u16 right) } // comparelocaltolocal -SCRCMD_DEF(compare_local_to_local) +bool8 ScrCmd_compare_local_to_local(struct ScriptContext *ctx) { const u8 value1 = ctx->data[ScriptReadByte(ctx)]; const u8 value2 = ctx->data[ScriptReadByte(ctx)]; @@ -378,7 +380,7 @@ SCRCMD_DEF(compare_local_to_local) } // comparelocaltoimm -SCRCMD_DEF(compare_local_to_value) +bool8 ScrCmd_compare_local_to_value(struct ScriptContext *ctx) { const u8 value1 = ctx->data[ScriptReadByte(ctx)]; const u8 value2 = ScriptReadByte(ctx); @@ -387,7 +389,7 @@ SCRCMD_DEF(compare_local_to_value) return FALSE; } -SCRCMD_DEF(compare_local_to_addr) +bool8 ScrCmd_compare_local_to_addr(struct ScriptContext *ctx) { const u8 value1 = ctx->data[ScriptReadByte(ctx)]; const u8 value2 = *(const u8 *)ScriptReadWord(ctx); @@ -396,7 +398,7 @@ SCRCMD_DEF(compare_local_to_addr) return FALSE; } -SCRCMD_DEF(compare_addr_to_local) +bool8 ScrCmd_compare_addr_to_local(struct ScriptContext *ctx) { const u8 value1 = *(const u8 *)ScriptReadWord(ctx); const u8 value2 = ctx->data[ScriptReadByte(ctx)]; @@ -405,7 +407,7 @@ SCRCMD_DEF(compare_addr_to_local) return FALSE; } -SCRCMD_DEF(compare_addr_to_value) +bool8 ScrCmd_compare_addr_to_value(struct ScriptContext *ctx) { const u8 value1 = *(const u8 *)ScriptReadWord(ctx); const u8 value2 = ScriptReadByte(ctx); @@ -414,7 +416,7 @@ SCRCMD_DEF(compare_addr_to_value) return FALSE; } -SCRCMD_DEF(compare_addr_to_addr) +bool8 ScrCmd_compare_addr_to_addr(struct ScriptContext *ctx) { const u8 value1 = *(const u8 *)ScriptReadWord(ctx); const u8 value2 = *(const u8 *)ScriptReadWord(ctx); @@ -423,7 +425,7 @@ SCRCMD_DEF(compare_addr_to_addr) return FALSE; } -SCRCMD_DEF(compare_var_to_value) +bool8 ScrCmd_compare_var_to_value(struct ScriptContext *ctx) { const u16 value1 = *GetVarPointer(ScriptReadHalfword(ctx)); const u16 value2 = ScriptReadHalfword(ctx); @@ -432,7 +434,7 @@ SCRCMD_DEF(compare_var_to_value) return FALSE; } -SCRCMD_DEF(compare_var_to_var) +bool8 ScrCmd_compare_var_to_var(struct ScriptContext *ctx) { const u16 *ptr1 = GetVarPointer(ScriptReadHalfword(ctx)); const u16 *ptr2 = GetVarPointer(ScriptReadHalfword(ctx)); @@ -441,21 +443,21 @@ SCRCMD_DEF(compare_var_to_var) return FALSE; } -SCRCMD_DEF(addvar) +bool8 ScrCmd_addvar(struct ScriptContext *ctx) { u16 *ptr = GetVarPointer(ScriptReadHalfword(ctx)); *ptr += ScriptReadHalfword(ctx); return FALSE; } -SCRCMD_DEF(subvar) +bool8 ScrCmd_subvar(struct ScriptContext *ctx) { u16 *ptr = GetVarPointer(ScriptReadHalfword(ctx)); *ptr -= VarGet(ScriptReadHalfword(ctx)); return FALSE; } -SCRCMD_DEF(random) +bool8 ScrCmd_random(struct ScriptContext *ctx) { u16 max = VarGet(ScriptReadHalfword(ctx)); @@ -463,7 +465,7 @@ SCRCMD_DEF(random) return FALSE; } -SCRCMD_DEF(giveitem) +bool8 ScrCmd_giveitem(struct ScriptContext *ctx) { u16 itemId = VarGet(ScriptReadHalfword(ctx)); u32 quantity = VarGet(ScriptReadHalfword(ctx)); @@ -473,7 +475,7 @@ SCRCMD_DEF(giveitem) return FALSE; } -SCRCMD_DEF(takeitem) +bool8 ScrCmd_takeitem(struct ScriptContext *ctx) { u16 itemId = VarGet(ScriptReadHalfword(ctx)); u32 quantity = VarGet(ScriptReadHalfword(ctx)); @@ -482,7 +484,7 @@ SCRCMD_DEF(takeitem) return FALSE; } -SCRCMD_DEF(checkitemspace) +bool8 ScrCmd_checkitemspace(struct ScriptContext *ctx) { u16 itemId = VarGet(ScriptReadHalfword(ctx)); u32 quantity = VarGet(ScriptReadHalfword(ctx)); @@ -491,7 +493,7 @@ SCRCMD_DEF(checkitemspace) return FALSE; } -SCRCMD_DEF(checkitem) +bool8 ScrCmd_checkitem(struct ScriptContext *ctx) { u16 itemId = VarGet(ScriptReadHalfword(ctx)); u32 quantity = VarGet(ScriptReadHalfword(ctx)); @@ -500,7 +502,7 @@ SCRCMD_DEF(checkitem) return FALSE; } -SCRCMD_DEF(checkitemtype) +bool8 ScrCmd_checkitemtype(struct ScriptContext *ctx) { u16 itemId = VarGet(ScriptReadHalfword(ctx)); @@ -508,7 +510,7 @@ SCRCMD_DEF(checkitemtype) return FALSE; } -SCRCMD_DEF(givepcitem) +bool8 ScrCmd_givepcitem(struct ScriptContext *ctx) { u16 itemId = VarGet(ScriptReadHalfword(ctx)); u16 quantity = VarGet(ScriptReadHalfword(ctx)); @@ -517,7 +519,7 @@ SCRCMD_DEF(givepcitem) return FALSE; } -SCRCMD_DEF(checkpcitem) +bool8 ScrCmd_checkpcitem(struct ScriptContext *ctx) { u16 itemId = VarGet(ScriptReadHalfword(ctx)); u16 quantity = VarGet(ScriptReadHalfword(ctx)); @@ -526,7 +528,7 @@ SCRCMD_DEF(checkpcitem) return FALSE; } -SCRCMD_DEF(givedecoration) +bool8 ScrCmd_givedecoration(struct ScriptContext *ctx) { u32 decorId = VarGet(ScriptReadHalfword(ctx)); @@ -534,7 +536,7 @@ SCRCMD_DEF(givedecoration) return FALSE; } -SCRCMD_DEF(takedecoration) +bool8 ScrCmd_takedecoration(struct ScriptContext *ctx) { u32 decorId = VarGet(ScriptReadHalfword(ctx)); @@ -542,7 +544,7 @@ SCRCMD_DEF(takedecoration) return FALSE; } -SCRCMD_DEF(checkdecorspace) +bool8 ScrCmd_checkdecorspace(struct ScriptContext *ctx) { u32 decorId = VarGet(ScriptReadHalfword(ctx)); @@ -550,7 +552,7 @@ SCRCMD_DEF(checkdecorspace) return FALSE; } -SCRCMD_DEF(checkdecor) +bool8 ScrCmd_checkdecor(struct ScriptContext *ctx) { u32 decorId = VarGet(ScriptReadHalfword(ctx)); @@ -558,31 +560,31 @@ SCRCMD_DEF(checkdecor) return FALSE; } -SCRCMD_DEF(setflag) +bool8 ScrCmd_setflag(struct ScriptContext *ctx) { FlagSet(ScriptReadHalfword(ctx)); return FALSE; } -SCRCMD_DEF(clearflag) +bool8 ScrCmd_clearflag(struct ScriptContext *ctx) { FlagClear(ScriptReadHalfword(ctx)); return FALSE; } -SCRCMD_DEF(checkflag) +bool8 ScrCmd_checkflag(struct ScriptContext *ctx) { ctx->comparisonResult = FlagGet(ScriptReadHalfword(ctx)); return FALSE; } -SCRCMD_DEF(incrementgamestat) +bool8 ScrCmd_incrementgamestat(struct ScriptContext *ctx) { IncrementGameStat(ScriptReadByte(ctx)); return FALSE; } -SCRCMD_DEF(comparestattoword) +bool8 ScrCmd_comparestattoword(struct ScriptContext *ctx) { u8 statIdx = ScriptReadByte(ctx); u32 value = ScriptReadWord(ctx); @@ -597,7 +599,7 @@ SCRCMD_DEF(comparestattoword) return FALSE; } -SCRCMD_DEF(cmdD0) +bool8 ScrCmd_cmdD0(struct ScriptContext *ctx) { u16 value = ScriptReadHalfword(ctx); sub_8115748(value); @@ -605,14 +607,14 @@ SCRCMD_DEF(cmdD0) return FALSE; } -SCRCMD_DEF(animateflash) +bool8 ScrCmd_animateflash(struct ScriptContext *ctx) { sub_807F028(ScriptReadByte(ctx)); ScriptContext1_Stop(); return TRUE; } -SCRCMD_DEF(setflashradius) +bool8 ScrCmd_setflashradius(struct ScriptContext *ctx) { u16 flashLevel = VarGet(ScriptReadHalfword(ctx)); @@ -628,14 +630,14 @@ static bool8 IsPaletteNotActive(void) return FALSE; } -SCRCMD_DEF(fadescreen) +bool8 ScrCmd_fadescreen(struct ScriptContext *ctx) { fade_screen(ScriptReadByte(ctx), 0); SetupNativeScript(ctx, IsPaletteNotActive); return TRUE; } -SCRCMD_DEF(fadescreenspeed) +bool8 ScrCmd_fadescreenspeed(struct ScriptContext *ctx) { u8 mode = ScriptReadByte(ctx); u8 speed = ScriptReadByte(ctx); @@ -655,14 +657,14 @@ static bool8 RunPauseTimer(void) return FALSE; } -SCRCMD_DEF(delay) +bool8 ScrCmd_delay(struct ScriptContext *ctx) { sPauseCounter = ScriptReadHalfword(ctx); SetupNativeScript(ctx, RunPauseTimer); return TRUE; } -SCRCMD_DEF(initclock) +bool8 ScrCmd_initclock(struct ScriptContext *ctx) { // u8 hour = VarGet(ScriptReadHalfword(ctx)); // u8 minute = VarGet(ScriptReadHalfword(ctx)); @@ -671,13 +673,13 @@ SCRCMD_DEF(initclock) return FALSE; } -SCRCMD_DEF(dodailyevents) +bool8 ScrCmd_dodailyevents(struct ScriptContext *ctx) { // DoTimeBasedEvents(); return FALSE; } -SCRCMD_DEF(gettime) +bool8 ScrCmd_gettime(struct ScriptContext *ctx) { // RtcCalcLocalTime(); // gSpecialVar_0x8000 = gLocalTime.hours; @@ -689,7 +691,7 @@ SCRCMD_DEF(gettime) return FALSE; } -SCRCMD_DEF(setweather) +bool8 ScrCmd_setweather(struct ScriptContext *ctx) { u16 weather = VarGet(ScriptReadHalfword(ctx)); @@ -697,25 +699,25 @@ SCRCMD_DEF(setweather) return FALSE; } -SCRCMD_DEF(resetweather) +bool8 ScrCmd_resetweather(struct ScriptContext *ctx) { SetSav1WeatherFromCurrMapHeader(); return FALSE; } -SCRCMD_DEF(doweather) +bool8 ScrCmd_doweather(struct ScriptContext *ctx) { DoCurrentWeather(); return FALSE; } -SCRCMD_DEF(setstepcallback) +bool8 ScrCmd_setstepcallback(struct ScriptContext *ctx) { ActivatePerStepCallback(ScriptReadByte(ctx)); return FALSE; } -SCRCMD_DEF(setmaplayoutindex) +bool8 ScrCmd_setmaplayoutindex(struct ScriptContext *ctx) { u16 value = VarGet(ScriptReadHalfword(ctx)); @@ -723,7 +725,7 @@ SCRCMD_DEF(setmaplayoutindex) return FALSE; } -SCRCMD_DEF(warp) +bool8 ScrCmd_warp(struct ScriptContext *ctx) { u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); @@ -737,7 +739,7 @@ SCRCMD_DEF(warp) return TRUE; } -SCRCMD_DEF(warpsilent) +bool8 ScrCmd_warpsilent(struct ScriptContext *ctx) { u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); @@ -751,7 +753,7 @@ SCRCMD_DEF(warpsilent) return TRUE; } -SCRCMD_DEF(warpdoor) +bool8 ScrCmd_warpdoor(struct ScriptContext *ctx) { u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); @@ -765,7 +767,7 @@ SCRCMD_DEF(warpdoor) return TRUE; } -SCRCMD_DEF(warphole) +bool8 ScrCmd_warphole(struct ScriptContext *ctx) { u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); @@ -782,7 +784,7 @@ SCRCMD_DEF(warphole) return TRUE; } -SCRCMD_DEF(warpteleport) +bool8 ScrCmd_warpteleport(struct ScriptContext *ctx) { u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); @@ -796,7 +798,7 @@ SCRCMD_DEF(warpteleport) return TRUE; } -SCRCMD_DEF(warpD1) +bool8 ScrCmd_warpD1(struct ScriptContext *ctx) { u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); @@ -811,7 +813,7 @@ SCRCMD_DEF(warpD1) return TRUE; } -SCRCMD_DEF(setwarp) +bool8 ScrCmd_setwarp(struct ScriptContext *ctx) { u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); @@ -823,7 +825,7 @@ SCRCMD_DEF(setwarp) return FALSE; } -SCRCMD_DEF(setdynamicwarp) +bool8 ScrCmd_setdynamicwarp(struct ScriptContext *ctx) { u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); @@ -835,7 +837,7 @@ SCRCMD_DEF(setdynamicwarp) return FALSE; } -SCRCMD_DEF(setdivewarp) +bool8 ScrCmd_setdivewarp(struct ScriptContext *ctx) { u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); @@ -847,7 +849,7 @@ SCRCMD_DEF(setdivewarp) return FALSE; } -SCRCMD_DEF(setholewarp) +bool8 ScrCmd_setholewarp(struct ScriptContext *ctx) { u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); @@ -859,7 +861,7 @@ SCRCMD_DEF(setholewarp) return FALSE; } -SCRCMD_DEF(setescapewarp) +bool8 ScrCmd_setescapewarp(struct ScriptContext *ctx) { u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); @@ -871,7 +873,7 @@ SCRCMD_DEF(setescapewarp) return FALSE; } -SCRCMD_DEF(getplayerxy) +bool8 ScrCmd_getplayerxy(struct ScriptContext *ctx) { u16 *pX = GetVarPointer(ScriptReadHalfword(ctx)); u16 *pY = GetVarPointer(ScriptReadHalfword(ctx)); @@ -881,13 +883,13 @@ SCRCMD_DEF(getplayerxy) return FALSE; } -SCRCMD_DEF(getpartysize) +bool8 ScrCmd_getpartysize(struct ScriptContext *ctx) { gSpecialVar_Result = CalculatePlayerPartyCount(); return FALSE; } -SCRCMD_DEF(playse) +bool8 ScrCmd_playse(struct ScriptContext *ctx) { PlaySE(ScriptReadHalfword(ctx)); return FALSE; @@ -901,13 +903,13 @@ static bool8 WaitForSoundEffectFinish(void) return FALSE; } -SCRCMD_DEF(waitse) +bool8 ScrCmd_waitse(struct ScriptContext *ctx) { SetupNativeScript(ctx, WaitForSoundEffectFinish); return TRUE; } -SCRCMD_DEF(playfanfare) +bool8 ScrCmd_playfanfare(struct ScriptContext *ctx) { PlayFanfare(ScriptReadHalfword(ctx)); return FALSE; @@ -918,13 +920,13 @@ static bool8 WaitForFanfareFinish(void) return IsFanfareTaskInactive(); } -SCRCMD_DEF(waitfanfare) +bool8 ScrCmd_waitfanfare(struct ScriptContext *ctx) { SetupNativeScript(ctx, WaitForFanfareFinish); return TRUE; } -SCRCMD_DEF(playbgm) +bool8 ScrCmd_playbgm(struct ScriptContext *ctx) { u16 songId = ScriptReadHalfword(ctx); bool8 val = ScriptReadByte(ctx); @@ -937,13 +939,13 @@ SCRCMD_DEF(playbgm) return FALSE; } -SCRCMD_DEF(savebgm) +bool8 ScrCmd_savebgm(struct ScriptContext *ctx) { Overworld_SetSavedMusic(ScriptReadHalfword(ctx)); return FALSE; } -SCRCMD_DEF(fadedefaultbgm) +bool8 ScrCmd_fadedefaultbgm(struct ScriptContext *ctx) { if (gUnknown_203ADFA == 2 || gUnknown_203ADFA == 3) return FALSE; @@ -951,7 +953,7 @@ SCRCMD_DEF(fadedefaultbgm) return FALSE; } -SCRCMD_DEF(fadenewbgm) +bool8 ScrCmd_fadenewbgm(struct ScriptContext *ctx) { u16 music = ScriptReadHalfword(ctx); if (gUnknown_203ADFA == 2 || gUnknown_203ADFA == 3) @@ -960,7 +962,7 @@ SCRCMD_DEF(fadenewbgm) return FALSE; } -SCRCMD_DEF(fadeoutbgm) +bool8 ScrCmd_fadeoutbgm(struct ScriptContext *ctx) { u8 speed = ScriptReadByte(ctx); @@ -974,7 +976,7 @@ SCRCMD_DEF(fadeoutbgm) return TRUE; } -SCRCMD_DEF(fadeinbgm) +bool8 ScrCmd_fadeinbgm(struct ScriptContext *ctx) { u8 speed = ScriptReadByte(ctx); @@ -987,7 +989,7 @@ SCRCMD_DEF(fadeinbgm) return FALSE; } -SCRCMD_DEF(applymovement) +bool8 ScrCmd_applymovement(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); const void *movementScript = (const void *)ScriptReadWord(ctx); @@ -997,7 +999,7 @@ SCRCMD_DEF(applymovement) return FALSE; } -SCRCMD_DEF(applymovement_at) +bool8 ScrCmd_applymovement_at(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); const void *movementScript = (const void *)ScriptReadWord(ctx); @@ -1014,7 +1016,7 @@ static bool8 WaitForMovementFinish(void) return ScriptMovement_IsObjectMovementFinished(sMovingNpcId, sMovingNpcMapId, sMovingNpcMapBank); } -SCRCMD_DEF(waitmovement) +bool8 ScrCmd_waitmovement(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); @@ -1026,7 +1028,7 @@ SCRCMD_DEF(waitmovement) return TRUE; } -SCRCMD_DEF(waitmovement_at) +bool8 ScrCmd_waitmovement_at(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); u8 mapBank; @@ -1042,7 +1044,7 @@ SCRCMD_DEF(waitmovement_at) return TRUE; } -SCRCMD_DEF(removeobject) +bool8 ScrCmd_removeobject(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); @@ -1050,7 +1052,7 @@ SCRCMD_DEF(removeobject) return FALSE; } -SCRCMD_DEF(removeobject_at) +bool8 ScrCmd_removeobject_at(struct ScriptContext *ctx) { u16 objectId = VarGet(ScriptReadHalfword(ctx)); u8 mapGroup = ScriptReadByte(ctx); @@ -1060,7 +1062,7 @@ SCRCMD_DEF(removeobject_at) return FALSE; } -SCRCMD_DEF(addobject) +bool8 ScrCmd_addobject(struct ScriptContext *ctx) { u16 objectId = VarGet(ScriptReadHalfword(ctx)); @@ -1068,7 +1070,7 @@ SCRCMD_DEF(addobject) return FALSE; } -SCRCMD_DEF(addobject_at) +bool8 ScrCmd_addobject_at(struct ScriptContext *ctx) { u16 objectId = VarGet(ScriptReadHalfword(ctx)); u8 mapGroup = ScriptReadByte(ctx); @@ -1078,7 +1080,7 @@ SCRCMD_DEF(addobject_at) return FALSE; } -SCRCMD_DEF(setobjectxy) +bool8 ScrCmd_setobjectxy(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); u16 x = VarGet(ScriptReadHalfword(ctx)); @@ -1088,7 +1090,7 @@ SCRCMD_DEF(setobjectxy) return FALSE; } -SCRCMD_DEF(setobjectxyperm) +bool8 ScrCmd_setobjectxyperm(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); u16 x = VarGet(ScriptReadHalfword(ctx)); @@ -1098,7 +1100,7 @@ SCRCMD_DEF(setobjectxyperm) return FALSE; } -SCRCMD_DEF(moveobjectoffscreen) +bool8 ScrCmd_moveobjectoffscreen(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); @@ -1106,7 +1108,7 @@ SCRCMD_DEF(moveobjectoffscreen) return FALSE; } -SCRCMD_DEF(showobject_at) +bool8 ScrCmd_showobject_at(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); u8 mapGroup = ScriptReadByte(ctx); @@ -1116,7 +1118,7 @@ SCRCMD_DEF(showobject_at) return FALSE; } -SCRCMD_DEF(hideobject_at) +bool8 ScrCmd_hideobject_at(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); u8 mapGroup = ScriptReadByte(ctx); @@ -1126,7 +1128,7 @@ SCRCMD_DEF(hideobject_at) return FALSE; } -SCRCMD_DEF(setobjectpriority) +bool8 ScrCmd_setobjectpriority(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); u8 mapGroup = ScriptReadByte(ctx); @@ -1137,7 +1139,7 @@ SCRCMD_DEF(setobjectpriority) return FALSE; } -SCRCMD_DEF(resetobjectpriority) +bool8 ScrCmd_resetobjectpriority(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); u8 mapGroup = ScriptReadByte(ctx); @@ -1147,7 +1149,7 @@ SCRCMD_DEF(resetobjectpriority) return FALSE; } -SCRCMD_DEF(faceplayer) +bool8 ScrCmd_faceplayer(struct ScriptContext *ctx) { if (gMapObjects[gSelectedEventObject].active) { @@ -1157,7 +1159,7 @@ SCRCMD_DEF(faceplayer) return FALSE; } -SCRCMD_DEF(turnobject) +bool8 ScrCmd_turnobject(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); u8 direction = ScriptReadByte(ctx); @@ -1166,7 +1168,7 @@ SCRCMD_DEF(turnobject) return FALSE; } -SCRCMD_DEF(setobjectmovementtype) +bool8 ScrCmd_setobjectmovementtype(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx)); u8 movementType = ScriptReadByte(ctx); @@ -1175,7 +1177,7 @@ SCRCMD_DEF(setobjectmovementtype) return FALSE; } -SCRCMD_DEF(createvobject) +bool8 ScrCmd_createvobject(struct ScriptContext *ctx) { u8 graphicsId = ScriptReadByte(ctx); u8 v2 = ScriptReadByte(ctx); @@ -1188,7 +1190,7 @@ SCRCMD_DEF(createvobject) return FALSE; } -SCRCMD_DEF(turnvobject) +bool8 ScrCmd_turnvobject(struct ScriptContext *ctx) { u8 v1 = ScriptReadByte(ctx); u8 direction = ScriptReadByte(ctx); @@ -1197,7 +1199,7 @@ SCRCMD_DEF(turnvobject) return FALSE; } -SCRCMD_DEF(lockall) +bool8 ScrCmd_lockall(struct ScriptContext *ctx) { if (is_c1_link_related_active()) { @@ -1211,7 +1213,7 @@ SCRCMD_DEF(lockall) } } -SCRCMD_DEF(lock) +bool8 ScrCmd_lock(struct ScriptContext *ctx) { if (is_c1_link_related_active()) { @@ -1233,7 +1235,7 @@ SCRCMD_DEF(lock) } } -SCRCMD_DEF(releaseall) +bool8 ScrCmd_releaseall(struct ScriptContext *ctx) { u8 playerObjectId; @@ -1245,7 +1247,7 @@ SCRCMD_DEF(releaseall) return FALSE; } -SCRCMD_DEF(release) +bool8 ScrCmd_release(struct ScriptContext *ctx) { u8 playerObjectId; @@ -1259,14 +1261,14 @@ SCRCMD_DEF(release) return FALSE; } -SCRCMD_DEF(cmdC7) +bool8 ScrCmd_cmdC7(struct ScriptContext *ctx) { gUnknown_20370DC = gUnknown_20370DA; gUnknown_20370DA = ScriptReadByte(ctx); return FALSE; } -SCRCMD_DEF(message) +bool8 ScrCmd_message(struct ScriptContext *ctx) { const u8 *msg = (const u8 *)ScriptReadWord(ctx); @@ -1276,7 +1278,7 @@ SCRCMD_DEF(message) return FALSE; } -SCRCMD_DEF(cmdC8) +bool8 ScrCmd_cmdC8(struct ScriptContext *ctx) { const u8 *msg = (const u8 *)ScriptReadWord(ctx); @@ -1287,13 +1289,13 @@ SCRCMD_DEF(cmdC8) return FALSE; } -SCRCMD_DEF(cmdC9) +bool8 ScrCmd_cmdC9(struct ScriptContext *ctx) { sub_80F7998(); return FALSE; } -SCRCMD_DEF(messageautoscroll) +bool8 ScrCmd_messageautoscroll(struct ScriptContext *ctx) { const u8 *msg = (const u8 *)ScriptReadWord(ctx); @@ -1303,24 +1305,19 @@ SCRCMD_DEF(messageautoscroll) return FALSE; } -SCRCMD_DEF(waitmessage) +bool8 ScrCmd_waitmessage(struct ScriptContext *ctx) { SetupNativeScript(ctx, IsFieldMessageBoxHidden); return TRUE; } -SCRCMD_DEF(closemessage) +bool8 ScrCmd_closemessage(struct ScriptContext *ctx) { HideFieldMessageBox(); return FALSE; } -extern IWRAM_DATA struct ScriptContext * gUnknown_3005070; - -bool8 sub_806B93C(struct ScriptContext * ctx); -u8 sub_806B96C(struct ScriptContext * ctx); - -bool8 WaitForAorBPress(void) +static bool8 WaitForAorBPress(void) { if (gMain.newKeys & A_BUTTON) return TRUE; @@ -1358,7 +1355,7 @@ bool8 WaitForAorBPress(void) return FALSE; } -bool8 sub_806B93C(struct ScriptContext * ctx) +static bool8 sub_806B93C(struct ScriptContext * ctx) { const u8 * script = ctx->scriptPtr; u8 nextCmd = *script; @@ -1373,7 +1370,7 @@ bool8 sub_806B93C(struct ScriptContext * ctx) return TRUE; } -u8 sub_806B96C(struct ScriptContext * ctx) +static u8 sub_806B96C(struct ScriptContext * ctx) { if (gMain.heldKeys & DPAD_UP && gSpecialVar_Facing != 2) return 1; @@ -1408,7 +1405,7 @@ u8 sub_806B96C(struct ScriptContext * ctx) return 0; } -SCRCMD_DEF(waitbuttonpress) +bool8 ScrCmd_waitbuttonpress(struct ScriptContext *ctx) { gUnknown_3005070 = ctx; @@ -1418,7 +1415,7 @@ SCRCMD_DEF(waitbuttonpress) return TRUE; } -SCRCMD_DEF(yesnobox) +bool8 ScrCmd_yesnobox(struct ScriptContext *ctx) { u8 left = ScriptReadByte(ctx); u8 top = ScriptReadByte(ctx); @@ -1434,7 +1431,7 @@ SCRCMD_DEF(yesnobox) } } -SCRCMD_DEF(multichoice) +bool8 ScrCmd_multichoice(struct ScriptContext *ctx) { u8 left = ScriptReadByte(ctx); u8 top = ScriptReadByte(ctx); @@ -1452,7 +1449,7 @@ SCRCMD_DEF(multichoice) } } -SCRCMD_DEF(multichoicedefault) +bool8 ScrCmd_multichoicedefault(struct ScriptContext *ctx) { u8 left = ScriptReadByte(ctx); u8 top = ScriptReadByte(ctx); @@ -1471,7 +1468,7 @@ SCRCMD_DEF(multichoicedefault) } } -SCRCMD_DEF(drawbox) +bool8 ScrCmd_drawbox(struct ScriptContext *ctx) { /*u8 left = ScriptReadByte(ctx); u8 top = ScriptReadByte(ctx); @@ -1482,7 +1479,7 @@ SCRCMD_DEF(drawbox) return FALSE; } -SCRCMD_DEF(multichoicegrid) +bool8 ScrCmd_multichoicegrid(struct ScriptContext *ctx) { u8 left = ScriptReadByte(ctx); u8 top = ScriptReadByte(ctx); @@ -1501,7 +1498,7 @@ SCRCMD_DEF(multichoicegrid) } } -SCRCMD_DEF(erasebox) +bool8 ScrCmd_erasebox(struct ScriptContext *ctx) { u8 left = ScriptReadByte(ctx); u8 top = ScriptReadByte(ctx); @@ -1512,7 +1509,7 @@ SCRCMD_DEF(erasebox) return FALSE; } -SCRCMD_DEF(drawboxtext) +bool8 ScrCmd_drawboxtext(struct ScriptContext *ctx) { // u8 left = ScriptReadByte(ctx); // u8 top = ScriptReadByte(ctx); @@ -1527,7 +1524,7 @@ SCRCMD_DEF(drawboxtext) return FALSE; } -SCRCMD_DEF(showmonpic) +bool8 ScrCmd_showmonpic(struct ScriptContext *ctx) { u16 species = VarGet(ScriptReadHalfword(ctx)); u8 x = ScriptReadByte(ctx); @@ -1538,7 +1535,7 @@ SCRCMD_DEF(showmonpic) return FALSE; } -SCRCMD_DEF(hidemonpic) +bool8 ScrCmd_hidemonpic(struct ScriptContext *ctx) { bool8 (*func)(void) = ScriptMenu_GetPicboxWaitFunc(); @@ -1548,7 +1545,7 @@ SCRCMD_DEF(hidemonpic) return TRUE; } -SCRCMD_DEF(showcontestwinner) +bool8 ScrCmd_showcontestwinner(struct ScriptContext *ctx) { u8 v1 = ScriptReadByte(ctx); @@ -1563,7 +1560,7 @@ SCRCMD_DEF(showcontestwinner) return FALSE; } -SCRCMD_DEF(braillemessage) +bool8 ScrCmd_braillemessage(struct ScriptContext *ctx) { u8 *ptr = (u8 *)ScriptReadWord(ctx); if (ptr == NULL) @@ -1575,7 +1572,7 @@ SCRCMD_DEF(braillemessage) return FALSE; } -SCRCMD_DEF(getbraillestringwidth) +bool8 ScrCmd_getbraillestringwidth(struct ScriptContext *ctx) { u8 *ptr = (u8 *)ScriptReadWord(ctx); if (ptr == NULL) @@ -1585,7 +1582,7 @@ SCRCMD_DEF(getbraillestringwidth) return FALSE; } -SCRCMD_DEF(vmessage) +bool8 ScrCmd_vmessage(struct ScriptContext *ctx) { u32 v1 = ScriptReadWord(ctx); @@ -1600,7 +1597,7 @@ u8 * const sScriptStringVars[] = gStringVar3, }; -SCRCMD_DEF(bufferspeciesname) +bool8 ScrCmd_bufferspeciesname(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u16 species = VarGet(ScriptReadHalfword(ctx)); @@ -1609,7 +1606,7 @@ SCRCMD_DEF(bufferspeciesname) return FALSE; } -SCRCMD_DEF(bufferleadmonspeciesname) +bool8 ScrCmd_bufferleadmonspeciesname(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); @@ -1620,7 +1617,7 @@ SCRCMD_DEF(bufferleadmonspeciesname) return FALSE; } -SCRCMD_DEF(bufferpartymonnick) +bool8 ScrCmd_bufferpartymonnick(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u16 partyIndex = VarGet(ScriptReadHalfword(ctx)); @@ -1630,7 +1627,7 @@ SCRCMD_DEF(bufferpartymonnick) return FALSE; } -SCRCMD_DEF(bufferitemname) +bool8 ScrCmd_bufferitemname(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u16 itemId = VarGet(ScriptReadHalfword(ctx)); @@ -1642,7 +1639,7 @@ SCRCMD_DEF(bufferitemname) extern const u8 gUnknown_83A72A0[]; extern const u8 gUnknown_83A72A2[]; -SCRCMD_DEF(bufferitemnameplural) +bool8 ScrCmd_bufferitemnameplural(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u16 itemId = VarGet(ScriptReadHalfword(ctx)); @@ -1665,7 +1662,7 @@ SCRCMD_DEF(bufferitemnameplural) return FALSE; } -SCRCMD_DEF(bufferdecorationname) +bool8 ScrCmd_bufferdecorationname(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u16 decorId = VarGet(ScriptReadHalfword(ctx)); @@ -1674,7 +1671,7 @@ SCRCMD_DEF(bufferdecorationname) return FALSE; } -SCRCMD_DEF(buffermovename) +bool8 ScrCmd_buffermovename(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u16 moveId = VarGet(ScriptReadHalfword(ctx)); @@ -1683,7 +1680,7 @@ SCRCMD_DEF(buffermovename) return FALSE; } -SCRCMD_DEF(buffernumberstring) +bool8 ScrCmd_buffernumberstring(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u16 v1 = VarGet(ScriptReadHalfword(ctx)); @@ -1693,7 +1690,7 @@ SCRCMD_DEF(buffernumberstring) return FALSE; } -SCRCMD_DEF(bufferstdstring) +bool8 ScrCmd_bufferstdstring(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u16 index = VarGet(ScriptReadHalfword(ctx)); @@ -1703,7 +1700,7 @@ SCRCMD_DEF(bufferstdstring) } /* -SCRCMD_DEF(buffercontesttype) +bool8 ScrCmd_buffercontesttype(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u16 index = VarGet(ScriptReadHalfword(ctx)); @@ -1713,7 +1710,7 @@ SCRCMD_DEF(buffercontesttype) } */ -SCRCMD_DEF(bufferstring) +bool8 ScrCmd_bufferstring(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); const u8 *text = (u8 *)ScriptReadWord(ctx); @@ -1722,7 +1719,7 @@ SCRCMD_DEF(bufferstring) return FALSE; } -SCRCMD_DEF(vloadword) +bool8 ScrCmd_vloadword(struct ScriptContext *ctx) { const u8 *ptr = (u8 *)(ScriptReadWord(ctx) - gVScriptOffset); @@ -1730,7 +1727,7 @@ SCRCMD_DEF(vloadword) return FALSE; } -SCRCMD_DEF(vbufferstring) +bool8 ScrCmd_vbufferstring(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u32 addr = ScriptReadWord(ctx); @@ -1741,7 +1738,7 @@ SCRCMD_DEF(vbufferstring) return FALSE; } -SCRCMD_DEF(bufferboxname) +bool8 ScrCmd_bufferboxname(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u16 boxId = VarGet(ScriptReadHalfword(ctx)); @@ -1750,7 +1747,7 @@ SCRCMD_DEF(bufferboxname) return FALSE; } -SCRCMD_DEF(givemon) +bool8 ScrCmd_givemon(struct ScriptContext *ctx) { u16 species = VarGet(ScriptReadHalfword(ctx)); u8 level = ScriptReadByte(ctx); @@ -1763,7 +1760,7 @@ SCRCMD_DEF(givemon) return FALSE; } -SCRCMD_DEF(giveegg) +bool8 ScrCmd_giveegg(struct ScriptContext *ctx) { u16 species = VarGet(ScriptReadHalfword(ctx)); @@ -1771,7 +1768,7 @@ SCRCMD_DEF(giveegg) return FALSE; } -SCRCMD_DEF(setmonmove) +bool8 ScrCmd_setmonmove(struct ScriptContext *ctx) { u8 partyIndex = ScriptReadByte(ctx); u8 slot = ScriptReadByte(ctx); @@ -1781,7 +1778,7 @@ SCRCMD_DEF(setmonmove) return FALSE; } -SCRCMD_DEF(checkpartymove) +bool8 ScrCmd_checkpartymove(struct ScriptContext *ctx) { u8 i; u16 moveId = ScriptReadHalfword(ctx); @@ -1802,7 +1799,7 @@ SCRCMD_DEF(checkpartymove) return FALSE; } -SCRCMD_DEF(givemoney) +bool8 ScrCmd_givemoney(struct ScriptContext *ctx) { u32 amount = ScriptReadWord(ctx); u8 ignore = ScriptReadByte(ctx); @@ -1812,7 +1809,7 @@ SCRCMD_DEF(givemoney) return FALSE; } -SCRCMD_DEF(takemoney) +bool8 ScrCmd_takemoney(struct ScriptContext *ctx) { u32 amount = ScriptReadWord(ctx); u8 ignore = ScriptReadByte(ctx); @@ -1822,7 +1819,7 @@ SCRCMD_DEF(takemoney) return FALSE; } -SCRCMD_DEF(checkmoney) +bool8 ScrCmd_checkmoney(struct ScriptContext *ctx) { u32 amount = ScriptReadWord(ctx); u8 ignore = ScriptReadByte(ctx); @@ -1832,7 +1829,7 @@ SCRCMD_DEF(checkmoney) return FALSE; } -SCRCMD_DEF(showmoneybox) +bool8 ScrCmd_showmoneybox(struct ScriptContext *ctx) { u8 x = ScriptReadByte(ctx); u8 y = ScriptReadByte(ctx); @@ -1843,7 +1840,7 @@ SCRCMD_DEF(showmoneybox) return FALSE; } -SCRCMD_DEF(hidemoneybox) +bool8 ScrCmd_hidemoneybox(struct ScriptContext *ctx) { /*u8 x = ScriptReadByte(ctx); u8 y = ScriptReadByte(ctx);*/ @@ -1852,7 +1849,7 @@ SCRCMD_DEF(hidemoneybox) return FALSE; } -SCRCMD_DEF(updatemoneybox) +bool8 ScrCmd_updatemoneybox(struct ScriptContext *ctx) { u8 x = ScriptReadByte(ctx); u8 y = ScriptReadByte(ctx); @@ -1863,7 +1860,7 @@ SCRCMD_DEF(updatemoneybox) return FALSE; } -SCRCMD_DEF(showcoinsbox) +bool8 ScrCmd_showcoinsbox(struct ScriptContext *ctx) { u8 x = ScriptReadByte(ctx); u8 y = ScriptReadByte(ctx); @@ -1873,7 +1870,7 @@ SCRCMD_DEF(showcoinsbox) return FALSE; } -SCRCMD_DEF(hidecoinsbox) +bool8 ScrCmd_hidecoinsbox(struct ScriptContext *ctx) { u8 x = ScriptReadByte(ctx); u8 y = ScriptReadByte(ctx); @@ -1882,7 +1879,7 @@ SCRCMD_DEF(hidecoinsbox) return FALSE; } -SCRCMD_DEF(updatecoinsbox) +bool8 ScrCmd_updatecoinsbox(struct ScriptContext *ctx) { u8 x = ScriptReadByte(ctx); u8 y = ScriptReadByte(ctx); @@ -1891,31 +1888,31 @@ SCRCMD_DEF(updatecoinsbox) return FALSE; } -SCRCMD_DEF(trainerbattle) +bool8 ScrCmd_trainerbattle(struct ScriptContext *ctx) { ctx->scriptPtr = BattleSetup_ConfigureTrainerBattle(ctx->scriptPtr); return FALSE; } -SCRCMD_DEF(dotrainerbattle) +bool8 ScrCmd_dotrainerbattle(struct ScriptContext *ctx) { BattleSetup_StartTrainerBattle(); return TRUE; } -SCRCMD_DEF(gotopostbattlescript) +bool8 ScrCmd_gotopostbattlescript(struct ScriptContext *ctx) { ctx->scriptPtr = BattleSetup_GetScriptAddrAfterBattle(); return FALSE; } -SCRCMD_DEF(gotobeatenscript) +bool8 ScrCmd_gotobeatenscript(struct ScriptContext *ctx) { ctx->scriptPtr = BattleSetup_GetTrainerPostBattleScript(); return FALSE; } -SCRCMD_DEF(checktrainerflag) +bool8 ScrCmd_checktrainerflag(struct ScriptContext *ctx) { u16 index = VarGet(ScriptReadHalfword(ctx)); @@ -1923,7 +1920,7 @@ SCRCMD_DEF(checktrainerflag) return FALSE; } -SCRCMD_DEF(settrainerflag) +bool8 ScrCmd_settrainerflag(struct ScriptContext *ctx) { u16 index = VarGet(ScriptReadHalfword(ctx)); @@ -1931,7 +1928,7 @@ SCRCMD_DEF(settrainerflag) return FALSE; } -SCRCMD_DEF(cleartrainerflag) +bool8 ScrCmd_cleartrainerflag(struct ScriptContext *ctx) { u16 index = VarGet(ScriptReadHalfword(ctx)); @@ -1939,7 +1936,7 @@ SCRCMD_DEF(cleartrainerflag) return FALSE; } -SCRCMD_DEF(setwildbattle) +bool8 ScrCmd_setwildbattle(struct ScriptContext *ctx) { u16 species = ScriptReadHalfword(ctx); u8 level = ScriptReadByte(ctx); @@ -1949,14 +1946,14 @@ SCRCMD_DEF(setwildbattle) return FALSE; } -SCRCMD_DEF(dowildbattle) +bool8 ScrCmd_dowildbattle(struct ScriptContext *ctx) { BattleSetup_StartScriptedWildBattle(); ScriptContext1_Stop(); return TRUE; } -SCRCMD_DEF(pokemart) +bool8 ScrCmd_pokemart(struct ScriptContext *ctx) { const void *ptr = (void *)ScriptReadWord(ctx); @@ -1965,7 +1962,7 @@ SCRCMD_DEF(pokemart) return TRUE; } -SCRCMD_DEF(pokemartdecoration) +bool8 ScrCmd_pokemartdecoration(struct ScriptContext *ctx) { const void *ptr = (void *)ScriptReadWord(ctx); @@ -1974,7 +1971,7 @@ SCRCMD_DEF(pokemartdecoration) return TRUE; } -SCRCMD_DEF(pokemartdecoration2) +bool8 ScrCmd_pokemartdecoration2(struct ScriptContext *ctx) { const void *ptr = (void *)ScriptReadWord(ctx); @@ -1983,7 +1980,7 @@ SCRCMD_DEF(pokemartdecoration2) return TRUE; } -SCRCMD_DEF(playslotmachine) +bool8 ScrCmd_playslotmachine(struct ScriptContext *ctx) { u8 slotMachineIndex = VarGet(ScriptReadHalfword(ctx)); @@ -1992,7 +1989,7 @@ SCRCMD_DEF(playslotmachine) return TRUE; } -SCRCMD_DEF(setberrytree) +bool8 ScrCmd_setberrytree(struct ScriptContext *ctx) { // u8 treeId = ScriptReadByte(ctx); // u8 berry = ScriptReadByte(ctx); @@ -2005,7 +2002,7 @@ SCRCMD_DEF(setberrytree) return FALSE; } -SCRCMD_DEF(getpricereduction) +bool8 ScrCmd_getpricereduction(struct ScriptContext *ctx) { // u16 value = VarGet(ScriptReadHalfword(ctx)); // @@ -2013,7 +2010,7 @@ SCRCMD_DEF(getpricereduction) return FALSE; } -SCRCMD_DEF(choosecontestmon) +bool8 ScrCmd_choosecontestmon(struct ScriptContext *ctx) { // sub_81B9404(); ScriptContext1_Stop(); @@ -2021,7 +2018,7 @@ SCRCMD_DEF(choosecontestmon) } -SCRCMD_DEF(startcontest) +bool8 ScrCmd_startcontest(struct ScriptContext *ctx) { // sub_80F840C(); // ScriptContext1_Stop(); @@ -2029,7 +2026,7 @@ SCRCMD_DEF(startcontest) return FALSE; } -SCRCMD_DEF(showcontestresults) +bool8 ScrCmd_showcontestresults(struct ScriptContext *ctx) { // sub_80F8484(); // ScriptContext1_Stop(); @@ -2037,7 +2034,7 @@ SCRCMD_DEF(showcontestresults) return FALSE; } -SCRCMD_DEF(contestlinktransfer) +bool8 ScrCmd_contestlinktransfer(struct ScriptContext *ctx) { // sub_80F84C4(gSpecialVar_ContestCategory); // ScriptContext1_Stop(); @@ -2045,7 +2042,7 @@ SCRCMD_DEF(contestlinktransfer) return FALSE; } -SCRCMD_DEF(dofieldeffect) +bool8 ScrCmd_dofieldeffect(struct ScriptContext *ctx) { u16 effectId = VarGet(ScriptReadHalfword(ctx)); @@ -2054,7 +2051,7 @@ SCRCMD_DEF(dofieldeffect) return FALSE; } -SCRCMD_DEF(setfieldeffectarg) +bool8 ScrCmd_setfieldeffectarg(struct ScriptContext *ctx) { u8 argNum = ScriptReadByte(ctx); @@ -2070,14 +2067,14 @@ static bool8 WaitForFieldEffectFinish(void) return FALSE; } -SCRCMD_DEF(waitfieldeffect) +bool8 ScrCmd_waitfieldeffect(struct ScriptContext *ctx) { sFieldEffectScriptId = VarGet(ScriptReadHalfword(ctx)); SetupNativeScript(ctx, WaitForFieldEffectFinish); return TRUE; } -SCRCMD_DEF(setrespawn) +bool8 ScrCmd_setrespawn(struct ScriptContext *ctx) { u16 healLocationId = VarGet(ScriptReadHalfword(ctx)); @@ -2085,13 +2082,13 @@ SCRCMD_DEF(setrespawn) return FALSE; } -SCRCMD_DEF(checkplayergender) +bool8 ScrCmd_checkplayergender(struct ScriptContext *ctx) { gSpecialVar_Result = gSaveBlock2Ptr->playerGender; return FALSE; } -SCRCMD_DEF(playmoncry) +bool8 ScrCmd_playmoncry(struct ScriptContext *ctx) { u16 species = VarGet(ScriptReadHalfword(ctx)); u16 mode = VarGet(ScriptReadHalfword(ctx)); @@ -2100,13 +2097,13 @@ SCRCMD_DEF(playmoncry) return FALSE; } -SCRCMD_DEF(waitmoncry) +bool8 ScrCmd_waitmoncry(struct ScriptContext *ctx) { SetupNativeScript(ctx, IsCryFinished); return TRUE; } -SCRCMD_DEF(setmetatile) +bool8 ScrCmd_setmetatile(struct ScriptContext *ctx) { u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); @@ -2122,7 +2119,7 @@ SCRCMD_DEF(setmetatile) return FALSE; } -SCRCMD_DEF(opendoor) +bool8 ScrCmd_opendoor(struct ScriptContext *ctx) { u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); @@ -2134,7 +2131,7 @@ SCRCMD_DEF(opendoor) return FALSE; } -SCRCMD_DEF(closedoor) +bool8 ScrCmd_closedoor(struct ScriptContext *ctx) { u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); @@ -2153,13 +2150,13 @@ static bool8 IsDoorAnimationStopped(void) return FALSE; } -SCRCMD_DEF(waitdooranim) +bool8 ScrCmd_waitdooranim(struct ScriptContext *ctx) { SetupNativeScript(ctx, IsDoorAnimationStopped); return TRUE; } -SCRCMD_DEF(setdooropen) +bool8 ScrCmd_setdooropen(struct ScriptContext *ctx) { u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); @@ -2170,7 +2167,7 @@ SCRCMD_DEF(setdooropen) return FALSE; } -SCRCMD_DEF(setdoorclosed) +bool8 ScrCmd_setdoorclosed(struct ScriptContext *ctx) { u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); @@ -2181,7 +2178,7 @@ SCRCMD_DEF(setdoorclosed) return FALSE; } -SCRCMD_DEF(addelevmenuitem) +bool8 ScrCmd_addelevmenuitem(struct ScriptContext *ctx) { // u8 v3 = ScriptReadByte(ctx); // u16 v5 = VarGet(ScriptReadHalfword(ctx)); @@ -2192,7 +2189,7 @@ SCRCMD_DEF(addelevmenuitem) return FALSE; } -SCRCMD_DEF(showelevmenu) +bool8 ScrCmd_showelevmenu(struct ScriptContext *ctx) { /*ScriptShowElevatorMenu(); ScriptContext1_Stop(); @@ -2200,14 +2197,14 @@ SCRCMD_DEF(showelevmenu) return FALSE; } -SCRCMD_DEF(checkcoins) +bool8 ScrCmd_checkcoins(struct ScriptContext *ctx) { u16 *ptr = GetVarPointer(ScriptReadHalfword(ctx)); *ptr = GetCoins(); return FALSE; } -SCRCMD_DEF(givecoins) +bool8 ScrCmd_givecoins(struct ScriptContext *ctx) { u16 coins = VarGet(ScriptReadHalfword(ctx)); @@ -2218,7 +2215,7 @@ SCRCMD_DEF(givecoins) return FALSE; } -SCRCMD_DEF(takecoins) +bool8 ScrCmd_takecoins(struct ScriptContext *ctx) { u16 coins = VarGet(ScriptReadHalfword(ctx)); @@ -2229,20 +2226,20 @@ SCRCMD_DEF(takecoins) return FALSE; } -SCRCMD_DEF(cmdCA) +bool8 ScrCmd_cmdCA(struct ScriptContext *ctx) { sub_8069A20(); return FALSE; } -SCRCMD_DEF(cmdCB) +bool8 ScrCmd_cmdCB(struct ScriptContext *ctx) { sub_8069A2C(); return FALSE; } // This command will force the Pokémon to be obedient, you don't get to make it disobedient. -SCRCMD_DEF(setmonobedient) +bool8 ScrCmd_setmonobedient(struct ScriptContext *ctx) { bool8 obedient = TRUE; u16 partyIndex = VarGet(ScriptReadHalfword(ctx)); @@ -2251,7 +2248,7 @@ SCRCMD_DEF(setmonobedient) return FALSE; } -SCRCMD_DEF(checkmonobedience) +bool8 ScrCmd_checkmonobedience(struct ScriptContext *ctx) { u16 partyIndex = VarGet(ScriptReadHalfword(ctx)); @@ -2259,7 +2256,7 @@ SCRCMD_DEF(checkmonobedience) return FALSE; } -SCRCMD_DEF(setmonmetlocation) +bool8 ScrCmd_setmonmetlocation(struct ScriptContext *ctx) { u16 partyIndex = VarGet(ScriptReadHalfword(ctx)); u8 location = ScriptReadByte(ctx); -- cgit v1.2.3