|
|
|
@@ -9,6 +9,7 @@
|
|
|
|
|
#include "field_screen_effect.h"
|
|
|
|
|
#include "quest_log.h"
|
|
|
|
|
#include "map_preview_screen.h"
|
|
|
|
|
#include "fieldmap.h"
|
|
|
|
|
#include "field_weather.h"
|
|
|
|
|
#include "field_tasks.h"
|
|
|
|
|
#include "field_fadetransition.h"
|
|
|
|
@@ -34,6 +35,7 @@
|
|
|
|
|
#include "fieldmap.h"
|
|
|
|
|
#include "field_door.h"
|
|
|
|
|
#include "constants/event_objects.h"
|
|
|
|
|
#include "constants/maps.h"
|
|
|
|
|
#include "constants/sound.h"
|
|
|
|
|
|
|
|
|
|
extern u16 (*const gSpecials[])(void);
|
|
|
|
@@ -44,12 +46,12 @@ extern const u8 *const gStdScriptsEnd[];
|
|
|
|
|
static bool8 ScriptContext_NextCommandEndsScript(struct ScriptContext * ctx);
|
|
|
|
|
static u8 ScriptContext_GetQuestLogInput(struct ScriptContext * ctx);
|
|
|
|
|
|
|
|
|
|
static EWRAM_DATA ptrdiff_t gVScriptOffset = 0;
|
|
|
|
|
static EWRAM_DATA ptrdiff_t sAddressOffset = 0; // For relative addressing in vgoto etc., used by saved scripts (e.g. Mystery Event)
|
|
|
|
|
static EWRAM_DATA u8 sQuestLogWaitButtonPressTimer = 0;
|
|
|
|
|
static EWRAM_DATA u16 sPauseCounter = 0;
|
|
|
|
|
static EWRAM_DATA u16 sMovingNpcId = 0;
|
|
|
|
|
static EWRAM_DATA u16 sMovingNpcMapBank = 0;
|
|
|
|
|
static EWRAM_DATA u16 sMovingNpcMapId = 0;
|
|
|
|
|
static EWRAM_DATA u16 sMovingNpcMapGroup = 0;
|
|
|
|
|
static EWRAM_DATA u16 sMovingNpcMapNum = 0;
|
|
|
|
|
static EWRAM_DATA u16 sFieldEffectScriptId = 0;
|
|
|
|
|
|
|
|
|
|
struct ScriptContext * sQuestLogScriptContextPtr;
|
|
|
|
@@ -95,7 +97,7 @@ bool8 ScrCmd_gotonative(struct ScriptContext * ctx)
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_special(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u16 (*const *specialPtr)(void) = gSpecials + ScriptReadHalfword(ctx);
|
|
|
|
|
u16 (*const *specialPtr)(void) = &gSpecials[ScriptReadHalfword(ctx)];
|
|
|
|
|
if (specialPtr < gSpecialsEnd)
|
|
|
|
|
(*specialPtr)();
|
|
|
|
|
else
|
|
|
|
@@ -106,7 +108,7 @@ bool8 ScrCmd_special(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_specialvar(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u16 * varPtr = GetVarPointer(ScriptReadHalfword(ctx));
|
|
|
|
|
u16 (*const *specialPtr)(void) = gSpecials + ScriptReadHalfword(ctx);
|
|
|
|
|
u16 (*const *specialPtr)(void) = &gSpecials[ScriptReadHalfword(ctx)];
|
|
|
|
|
if (specialPtr < gSpecialsEnd)
|
|
|
|
|
*varPtr = (*specialPtr)();
|
|
|
|
|
else
|
|
|
|
@@ -170,28 +172,28 @@ bool8 ScrCmd_setvaddress(struct ScriptContext * ctx)
|
|
|
|
|
u32 addr1 = (u32)ctx->scriptPtr - 1;
|
|
|
|
|
u32 addr2 = ScriptReadWord(ctx);
|
|
|
|
|
|
|
|
|
|
gVScriptOffset = addr2 - addr1;
|
|
|
|
|
sAddressOffset = addr2 - addr1;
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_vgoto(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
const u8 * scrptr = (const u8 *)ScriptReadWord(ctx);
|
|
|
|
|
ScriptJump(ctx, scrptr - gVScriptOffset);
|
|
|
|
|
ScriptJump(ctx, scrptr - sAddressOffset);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_vcall(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
const u8 * scrptr = (const u8 *)ScriptReadWord(ctx);
|
|
|
|
|
ScriptCall(ctx, scrptr - gVScriptOffset);
|
|
|
|
|
ScriptCall(ctx, scrptr - sAddressOffset);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_vgoto_if(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u8 condition = ScriptReadByte(ctx);
|
|
|
|
|
const u8 * scrptr = (const u8 *)ScriptReadWord(ctx) - gVScriptOffset;
|
|
|
|
|
const u8 * scrptr = (const u8 *)ScriptReadWord(ctx) - sAddressOffset;
|
|
|
|
|
if (sScriptConditionTable[condition][ctx->comparisonResult] == 1)
|
|
|
|
|
ScriptJump(ctx, scrptr);
|
|
|
|
|
return FALSE;
|
|
|
|
@@ -200,7 +202,7 @@ bool8 ScrCmd_vgoto_if(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_vcall_if(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u8 condition = ScriptReadByte(ctx);
|
|
|
|
|
const u8 * scrptr = (const u8 *)ScriptReadWord(ctx) - gVScriptOffset;
|
|
|
|
|
const u8 * scrptr = (const u8 *)ScriptReadWord(ctx) - sAddressOffset;
|
|
|
|
|
if (sScriptConditionTable[condition][ctx->comparisonResult] == 1)
|
|
|
|
|
ScriptCall(ctx, scrptr);
|
|
|
|
|
return FALSE;
|
|
|
|
@@ -209,7 +211,7 @@ bool8 ScrCmd_vcall_if(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_gotostd(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u8 stdIdx = ScriptReadByte(ctx);
|
|
|
|
|
const u8 *const * script = gStdScripts + stdIdx;
|
|
|
|
|
const u8 *const * script = &gStdScripts[stdIdx];
|
|
|
|
|
if (script < gStdScriptsEnd)
|
|
|
|
|
ScriptJump(ctx, *script);
|
|
|
|
|
return FALSE;
|
|
|
|
@@ -218,7 +220,7 @@ bool8 ScrCmd_gotostd(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_callstd(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u8 stdIdx = ScriptReadByte(ctx);
|
|
|
|
|
const u8 *const * script = gStdScripts + stdIdx;
|
|
|
|
|
const u8 *const * script = &gStdScripts[stdIdx];
|
|
|
|
|
if (script < gStdScriptsEnd)
|
|
|
|
|
ScriptCall(ctx, *script);
|
|
|
|
|
return FALSE;
|
|
|
|
@@ -250,13 +252,13 @@ bool8 ScrCmd_callstd_if(struct ScriptContext * ctx)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_gotoram(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_returnram(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
ScriptJump(ctx, gRAMScriptPtr);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_killscript(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_endram(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
ClearRamScript();
|
|
|
|
|
StopScript(ctx);
|
|
|
|
@@ -269,9 +271,9 @@ bool8 ScrCmd_setmysteryeventstatus(struct ScriptContext * ctx)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_execram(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_trywondercardscript(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
const u8 * script = sub_8069E48();
|
|
|
|
|
const u8 * script = GetSavedRamScriptIfValid();
|
|
|
|
|
if (script != NULL)
|
|
|
|
|
{
|
|
|
|
|
gRAMScriptPtr = ctx->scriptPtr;
|
|
|
|
@@ -282,19 +284,19 @@ bool8 ScrCmd_execram(struct ScriptContext * ctx)
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_loadword(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u8 which = ScriptReadByte(ctx);
|
|
|
|
|
ctx->data[which] = ScriptReadWord(ctx);
|
|
|
|
|
u8 index = ScriptReadByte(ctx);
|
|
|
|
|
ctx->data[index] = ScriptReadWord(ctx);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_loadbytefromaddr(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_loadbytefromptr(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u8 which = ScriptReadByte(ctx);
|
|
|
|
|
ctx->data[which] = *(const u8 *)ScriptReadWord(ctx);
|
|
|
|
|
u8 index = ScriptReadByte(ctx);
|
|
|
|
|
ctx->data[index] = *(const u8 *)ScriptReadWord(ctx);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_writebytetoaddr(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_setptr(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u8 value = ScriptReadByte(ctx);
|
|
|
|
|
*(u8 *)ScriptReadWord(ctx) = value;
|
|
|
|
@@ -303,23 +305,23 @@ bool8 ScrCmd_writebytetoaddr(struct ScriptContext * ctx)
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_loadbyte(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u8 which = ScriptReadByte(ctx);
|
|
|
|
|
ctx->data[which] = ScriptReadByte(ctx);
|
|
|
|
|
u8 index = ScriptReadByte(ctx);
|
|
|
|
|
ctx->data[index] = ScriptReadByte(ctx);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_setptrbyte(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u8 which = ScriptReadByte(ctx);
|
|
|
|
|
*(u8 *)ScriptReadWord(ctx) = ctx->data[which];
|
|
|
|
|
u8 index = ScriptReadByte(ctx);
|
|
|
|
|
*(u8 *)ScriptReadWord(ctx) = ctx->data[index];
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_copylocal(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u8 whichDst = ScriptReadByte(ctx);
|
|
|
|
|
u8 whichSrc = ScriptReadByte(ctx);
|
|
|
|
|
ctx->data[whichDst] = ctx->data[whichSrc];
|
|
|
|
|
u8 destIndex = ScriptReadByte(ctx);
|
|
|
|
|
u8 srcIndex = ScriptReadByte(ctx);
|
|
|
|
|
ctx->data[destIndex] = ctx->data[srcIndex];
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -352,69 +354,67 @@ bool8 ScrCmd_setorcopyvar(struct ScriptContext * ctx)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u8 compare_012(u16 left, u16 right)
|
|
|
|
|
static u8 Compare(u16 a, u16 b)
|
|
|
|
|
{
|
|
|
|
|
if (left < right)
|
|
|
|
|
if (a < b)
|
|
|
|
|
return 0;
|
|
|
|
|
else if (left == right)
|
|
|
|
|
else if (a == b)
|
|
|
|
|
return 1;
|
|
|
|
|
else
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// comparelocaltolocal
|
|
|
|
|
bool8 ScrCmd_compare_local_to_local(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
const u8 value1 = ctx->data[ScriptReadByte(ctx)];
|
|
|
|
|
const u8 value2 = ctx->data[ScriptReadByte(ctx)];
|
|
|
|
|
|
|
|
|
|
ctx->comparisonResult = compare_012(value1, value2);
|
|
|
|
|
ctx->comparisonResult = Compare(value1, value2);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// comparelocaltoimm
|
|
|
|
|
bool8 ScrCmd_compare_local_to_value(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
const u8 value1 = ctx->data[ScriptReadByte(ctx)];
|
|
|
|
|
const u8 value2 = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
|
|
ctx->comparisonResult = compare_012(value1, value2);
|
|
|
|
|
ctx->comparisonResult = Compare(value1, value2);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_compare_local_to_addr(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_compare_local_to_ptr(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
const u8 value1 = ctx->data[ScriptReadByte(ctx)];
|
|
|
|
|
const u8 value2 = *(const u8 *)ScriptReadWord(ctx);
|
|
|
|
|
|
|
|
|
|
ctx->comparisonResult = compare_012(value1, value2);
|
|
|
|
|
ctx->comparisonResult = Compare(value1, value2);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_compare_addr_to_local(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_compare_ptr_to_local(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
const u8 value1 = *(const u8 *)ScriptReadWord(ctx);
|
|
|
|
|
const u8 value2 = ctx->data[ScriptReadByte(ctx)];
|
|
|
|
|
|
|
|
|
|
ctx->comparisonResult = compare_012(value1, value2);
|
|
|
|
|
ctx->comparisonResult = Compare(value1, value2);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_compare_addr_to_value(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_compare_ptr_to_value(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
const u8 value1 = *(const u8 *)ScriptReadWord(ctx);
|
|
|
|
|
const u8 value2 = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
|
|
ctx->comparisonResult = compare_012(value1, value2);
|
|
|
|
|
ctx->comparisonResult = Compare(value1, value2);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_compare_addr_to_addr(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_compare_ptr_to_ptr(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
const u8 value1 = *(const u8 *)ScriptReadWord(ctx);
|
|
|
|
|
const u8 value2 = *(const u8 *)ScriptReadWord(ctx);
|
|
|
|
|
|
|
|
|
|
ctx->comparisonResult = compare_012(value1, value2);
|
|
|
|
|
ctx->comparisonResult = Compare(value1, value2);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -423,7 +423,7 @@ bool8 ScrCmd_compare_var_to_value(struct ScriptContext * ctx)
|
|
|
|
|
const u16 value1 = *GetVarPointer(ScriptReadHalfword(ctx));
|
|
|
|
|
const u16 value2 = ScriptReadHalfword(ctx);
|
|
|
|
|
|
|
|
|
|
ctx->comparisonResult = compare_012(value1, value2);
|
|
|
|
|
ctx->comparisonResult = Compare(value1, value2);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -432,10 +432,11 @@ bool8 ScrCmd_compare_var_to_var(struct ScriptContext * ctx)
|
|
|
|
|
const u16 *ptr1 = GetVarPointer(ScriptReadHalfword(ctx));
|
|
|
|
|
const u16 *ptr2 = GetVarPointer(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
|
|
ctx->comparisonResult = compare_012(*ptr1, *ptr2);
|
|
|
|
|
ctx->comparisonResult = Compare(*ptr1, *ptr2);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Note: addvar doesn't support adding from a variable in vanilla.
|
|
|
|
|
bool8 ScrCmd_addvar(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u16 *ptr = GetVarPointer(ScriptReadHalfword(ctx));
|
|
|
|
@@ -521,7 +522,7 @@ bool8 ScrCmd_checkpcitem(struct ScriptContext * ctx)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_givedecoration(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_adddecoration(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u32 decorId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
|
@@ -529,7 +530,7 @@ bool8 ScrCmd_givedecoration(struct ScriptContext * ctx)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_takedecoration(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_removedecoration(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u32 decorId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
|
@@ -607,11 +608,9 @@ bool8 ScrCmd_animateflash(struct ScriptContext * ctx)
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_setflashradius(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_setflashlevel(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u16 flashLevel = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
|
|
Overworld_SetFlashLevel(flashLevel);
|
|
|
|
|
SetFlashLevel(VarGet(ScriptReadHalfword(ctx)));
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -642,9 +641,7 @@ bool8 ScrCmd_fadescreenspeed(struct ScriptContext * ctx)
|
|
|
|
|
|
|
|
|
|
static bool8 RunPauseTimer(void)
|
|
|
|
|
{
|
|
|
|
|
sPauseCounter--;
|
|
|
|
|
|
|
|
|
|
if (sPauseCounter == 0)
|
|
|
|
|
if (--sPauseCounter == 0)
|
|
|
|
|
return TRUE;
|
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
|
|
|
@@ -666,7 +663,7 @@ bool8 ScrCmd_initclock(struct ScriptContext * ctx)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_dodailyevents(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_dotimebasedevents(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
// DoTimeBasedEvents();
|
|
|
|
|
return FALSE;
|
|
|
|
@@ -688,13 +685,13 @@ bool8 ScrCmd_setweather(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u16 weather = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
|
|
SetSav1Weather(weather);
|
|
|
|
|
SetSavedWeather(weather);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_resetweather(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
SetSav1WeatherFromCurrMapHeader();
|
|
|
|
|
SetSavedWeatherFromCurrMapHeader();
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -768,10 +765,10 @@ bool8 ScrCmd_warphole(struct ScriptContext * ctx)
|
|
|
|
|
u16 y;
|
|
|
|
|
|
|
|
|
|
PlayerGetDestCoords(&x, &y);
|
|
|
|
|
if (mapGroup == 0xFF && mapNum == 0xFF)
|
|
|
|
|
SetWarpDestinationToFixedHoleWarp(x - 7, y - 7);
|
|
|
|
|
if (mapGroup == MAP_GROUP(UNDEFINED) && mapNum == MAP_NUM(UNDEFINED))
|
|
|
|
|
SetWarpDestinationToFixedHoleWarp(x - MAP_OFFSET, y - MAP_OFFSET);
|
|
|
|
|
else
|
|
|
|
|
SetWarpDestination(mapGroup, mapNum, -1, x - 7, y - 7);
|
|
|
|
|
SetWarpDestination(mapGroup, mapNum, WARP_ID_NONE, x - MAP_OFFSET, y - MAP_OFFSET);
|
|
|
|
|
DoFallWarp();
|
|
|
|
|
ResetInitialPlayerAvatarState();
|
|
|
|
|
return TRUE;
|
|
|
|
@@ -791,7 +788,7 @@ bool8 ScrCmd_warpteleport(struct ScriptContext * ctx)
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_warpteleport2(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_warpspinenter(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
@@ -922,11 +919,11 @@ bool8 ScrCmd_waitfanfare(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_playbgm(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u16 songId = ScriptReadHalfword(ctx);
|
|
|
|
|
bool8 val = ScriptReadByte(ctx);
|
|
|
|
|
bool8 save = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
|
|
if (QL_IS_PLAYBACK_STATE)
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (val == TRUE)
|
|
|
|
|
if (save == TRUE)
|
|
|
|
|
Overworld_SetSavedMusic(songId);
|
|
|
|
|
PlayNewMapMusic(songId);
|
|
|
|
|
return FALSE;
|
|
|
|
@@ -992,7 +989,7 @@ bool8 ScrCmd_applymovement(struct ScriptContext * ctx)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_applymovement_at(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_applymovementat(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
const void *movementScript = (const void *)ScriptReadWord(ctx);
|
|
|
|
@@ -1006,7 +1003,7 @@ bool8 ScrCmd_applymovement_at(struct ScriptContext * ctx)
|
|
|
|
|
|
|
|
|
|
static bool8 WaitForMovementFinish(void)
|
|
|
|
|
{
|
|
|
|
|
return ScriptMovement_IsObjectMovementFinished(sMovingNpcId, sMovingNpcMapId, sMovingNpcMapBank);
|
|
|
|
|
return ScriptMovement_IsObjectMovementFinished(sMovingNpcId, sMovingNpcMapNum, sMovingNpcMapGroup);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_waitmovement(struct ScriptContext * ctx)
|
|
|
|
@@ -1015,13 +1012,13 @@ bool8 ScrCmd_waitmovement(struct ScriptContext * ctx)
|
|
|
|
|
|
|
|
|
|
if (localId != 0)
|
|
|
|
|
sMovingNpcId = localId;
|
|
|
|
|
sMovingNpcMapBank = gSaveBlock1Ptr->location.mapGroup;
|
|
|
|
|
sMovingNpcMapId = gSaveBlock1Ptr->location.mapNum;
|
|
|
|
|
sMovingNpcMapGroup = gSaveBlock1Ptr->location.mapGroup;
|
|
|
|
|
sMovingNpcMapNum = gSaveBlock1Ptr->location.mapNum;
|
|
|
|
|
SetupNativeScript(ctx, WaitForMovementFinish);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_waitmovement_at(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_waitmovementat(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
u8 mapBank;
|
|
|
|
@@ -1031,8 +1028,8 @@ bool8 ScrCmd_waitmovement_at(struct ScriptContext * ctx)
|
|
|
|
|
sMovingNpcId = localId;
|
|
|
|
|
mapBank = ScriptReadByte(ctx);
|
|
|
|
|
mapId = ScriptReadByte(ctx);
|
|
|
|
|
sMovingNpcMapBank = mapBank;
|
|
|
|
|
sMovingNpcMapId = mapId;
|
|
|
|
|
sMovingNpcMapGroup = mapBank;
|
|
|
|
|
sMovingNpcMapNum = mapId;
|
|
|
|
|
SetupNativeScript(ctx, WaitForMovementFinish);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
@@ -1045,7 +1042,7 @@ bool8 ScrCmd_removeobject(struct ScriptContext * ctx)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_removeobject_at(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_removeobjectat(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u16 objectId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
@@ -1063,7 +1060,7 @@ bool8 ScrCmd_addobject(struct ScriptContext * ctx)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_addobject_at(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_addobjectat(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u16 objectId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
@@ -1089,11 +1086,11 @@ bool8 ScrCmd_setobjectxyperm(struct ScriptContext * ctx)
|
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
|
|
Overworld_SetMapObjTemplateCoords(localId, x, y);
|
|
|
|
|
SetObjEventTemplateCoords(localId, x, y);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_moveobjectoffscreen(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_copyobjectxytoperm(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
|
@@ -1101,44 +1098,44 @@ bool8 ScrCmd_moveobjectoffscreen(struct ScriptContext * ctx)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_showobject_at(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_showobjectat(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
|
|
ShowOrHideObjectByLocalIdAndMap(localId, mapNum, mapGroup, 0);
|
|
|
|
|
SetObjectInvisibility(localId, mapNum, mapGroup, FALSE);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_hideobject_at(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_hideobjectat(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
|
|
ShowOrHideObjectByLocalIdAndMap(localId, mapNum, mapGroup, 1);
|
|
|
|
|
SetObjectInvisibility(localId, mapNum, mapGroup, TRUE);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_setobjectpriority(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_setobjectsubpriority(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
|
u8 priority = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
|
|
SetObjectPriorityByLocalIdAndMap(localId, mapNum, mapGroup, priority + 83);
|
|
|
|
|
SetObjectSubpriority(localId, mapNum, mapGroup, priority + 83);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_resetobjectpriority(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_resetobjectsubpriority(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
|
|
UnfixObjectPriorityByLocalIdAndMap(localId, mapNum, mapGroup);
|
|
|
|
|
ResetObjectSubpriority(localId, mapNum, mapGroup);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1166,32 +1163,34 @@ bool8 ScrCmd_setobjectmovementtype(struct ScriptContext * ctx)
|
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
u8 movementType = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
|
|
Overworld_SetObjEventTemplateMovementType(localId, movementType);
|
|
|
|
|
SetObjEventTemplateMovementType(localId, movementType);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_createvobject(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u8 graphicsId = ScriptReadByte(ctx);
|
|
|
|
|
u8 v2 = ScriptReadByte(ctx);
|
|
|
|
|
u8 virtualObjId = 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);
|
|
|
|
|
CreateVirtualObject(graphicsId, virtualObjId, x, y, elevation, direction);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_turnvobject(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u8 v1 = ScriptReadByte(ctx);
|
|
|
|
|
u8 virtualObjId = ScriptReadByte(ctx);
|
|
|
|
|
u8 direction = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
|
|
TurnObjectEvent(v1, direction);
|
|
|
|
|
TurnVirtualObject(virtualObjId, direction);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// lockall freezes all object events except the player immediately.
|
|
|
|
|
// The player is frozen after waiting for their current movement to finish.
|
|
|
|
|
bool8 ScrCmd_lockall(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
if (IsUpdateLinkStateCBActive())
|
|
|
|
@@ -1200,8 +1199,8 @@ bool8 ScrCmd_lockall(struct ScriptContext * ctx)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ScriptFreezeObjectEvents();
|
|
|
|
|
SetupNativeScript(ctx, NativeScript_WaitPlayerStopMoving);
|
|
|
|
|
FreezeObjects_WaitForPlayer();
|
|
|
|
|
SetupNativeScript(ctx, IsFreezePlayerFinished);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -1216,13 +1215,13 @@ bool8 ScrCmd_lock(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
if (gObjectEvents[gSelectedObjectEvent].active)
|
|
|
|
|
{
|
|
|
|
|
LockSelectedObjectEvent();
|
|
|
|
|
SetupNativeScript(ctx, NativeScript_WaitPlayerAndTargetNPCStopMoving);
|
|
|
|
|
FreezeObjects_WaitForPlayerAndSelected();
|
|
|
|
|
SetupNativeScript(ctx, IsFreezeSelectedObjectAndPlayerFinished);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ScriptFreezeObjectEvents();
|
|
|
|
|
SetupNativeScript(ctx, NativeScript_WaitPlayerStopMoving);
|
|
|
|
|
FreezeObjects_WaitForPlayer();
|
|
|
|
|
SetupNativeScript(ctx, IsFreezePlayerFinished);
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
@@ -1429,7 +1428,7 @@ bool8 ScrCmd_multichoice(struct ScriptContext * ctx)
|
|
|
|
|
u8 left = ScriptReadByte(ctx);
|
|
|
|
|
u8 top = ScriptReadByte(ctx);
|
|
|
|
|
u8 multichoiceId = ScriptReadByte(ctx);
|
|
|
|
|
u8 ignoreBPress = ScriptReadByte(ctx);
|
|
|
|
|
bool8 ignoreBPress = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
|
|
if (ScriptMenu_Multichoice(left, top, multichoiceId, ignoreBPress) == TRUE)
|
|
|
|
|
{
|
|
|
|
@@ -1448,7 +1447,7 @@ bool8 ScrCmd_multichoicedefault(struct ScriptContext * ctx)
|
|
|
|
|
u8 top = ScriptReadByte(ctx);
|
|
|
|
|
u8 multichoiceId = ScriptReadByte(ctx);
|
|
|
|
|
u8 defaultChoice = ScriptReadByte(ctx);
|
|
|
|
|
u8 ignoreBPress = ScriptReadByte(ctx);
|
|
|
|
|
bool8 ignoreBPress = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
|
|
if (ScriptMenu_MultichoiceWithDefault(left, top, multichoiceId, ignoreBPress, defaultChoice) == TRUE)
|
|
|
|
|
{
|
|
|
|
@@ -1478,7 +1477,7 @@ bool8 ScrCmd_multichoicegrid(struct ScriptContext * ctx)
|
|
|
|
|
u8 top = ScriptReadByte(ctx);
|
|
|
|
|
u8 multichoiceId = ScriptReadByte(ctx);
|
|
|
|
|
u8 numColumns = ScriptReadByte(ctx);
|
|
|
|
|
u8 ignoreBPress = ScriptReadByte(ctx);
|
|
|
|
|
bool8 ignoreBPress = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
|
|
if (ScriptMenu_MultichoiceGrid(left, top, multichoiceId, ignoreBPress, numColumns) == TRUE)
|
|
|
|
|
{
|
|
|
|
@@ -1498,7 +1497,7 @@ bool8 ScrCmd_erasebox(struct ScriptContext * ctx)
|
|
|
|
|
u8 right = ScriptReadByte(ctx);
|
|
|
|
|
u8 bottom = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
|
|
// MenuZeroFillWindowRect(left, top, right, bottom);
|
|
|
|
|
// Menu_EraseWindowRect(left, top, right, bottom);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1507,7 +1506,7 @@ bool8 ScrCmd_drawboxtext(struct ScriptContext * ctx)
|
|
|
|
|
// u8 left = ScriptReadByte(ctx);
|
|
|
|
|
// u8 top = ScriptReadByte(ctx);
|
|
|
|
|
// u8 multichoiceId = ScriptReadByte(ctx);
|
|
|
|
|
// u8 ignoreBPress = ScriptReadByte(ctx);
|
|
|
|
|
// bool8 ignoreBPress = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
|
|
/*if (Multichoice(left, top, multichoiceId, ignoreBPress) == TRUE)
|
|
|
|
|
{
|
|
|
|
@@ -1530,7 +1529,9 @@ bool8 ScrCmd_showmonpic(struct ScriptContext * ctx)
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_hidemonpic(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
bool8 (*func)(void) = ScriptMenu_GetPicboxWaitFunc();
|
|
|
|
|
// The hide function returns a pointer to a function
|
|
|
|
|
// that returns true once the pic is hidden
|
|
|
|
|
bool8 (*func)(void) = ScriptMenu_HidePokemonPic();
|
|
|
|
|
|
|
|
|
|
if (func == NULL)
|
|
|
|
|
return FALSE;
|
|
|
|
@@ -1538,18 +1539,18 @@ bool8 ScrCmd_hidemonpic(struct ScriptContext * ctx)
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_showcontestwinner(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_showcontestpainting(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u8 v1 = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
|
|
u8 contestWinnerId = ScriptReadByte(ctx);
|
|
|
|
|
/*
|
|
|
|
|
if (v1)
|
|
|
|
|
sub_812FDA8(v1);
|
|
|
|
|
ShowContestWinner();
|
|
|
|
|
ScriptContext1_Stop();
|
|
|
|
|
return TRUE;
|
|
|
|
|
*/
|
|
|
|
|
// Artist's painting is temporary and already has its data loaded
|
|
|
|
|
if (contestWinnerId != CONTEST_WINNER_ARTIST)
|
|
|
|
|
SetContestWinnerForPainting(contestWinnerId);
|
|
|
|
|
|
|
|
|
|
ShowContestPainting();
|
|
|
|
|
ScriptContext1_Stop()
|
|
|
|
|
return TRUE;
|
|
|
|
|
*/
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1561,7 +1562,7 @@ bool8 ScrCmd_braillemessage(struct ScriptContext * ctx)
|
|
|
|
|
|
|
|
|
|
LoadStdWindowFrameGfx();
|
|
|
|
|
DrawDialogueFrame(0, 1);
|
|
|
|
|
AddTextPrinterParameterized(0, FONT_6, ptr, 0, 1, 0, NULL);
|
|
|
|
|
AddTextPrinterParameterized(0, FONT_BRAILLE, ptr, 0, 1, 0, NULL);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1571,15 +1572,15 @@ bool8 ScrCmd_getbraillestringwidth(struct ScriptContext * ctx)
|
|
|
|
|
if (ptr == NULL)
|
|
|
|
|
ptr = (u8 *)ctx->data[0];
|
|
|
|
|
|
|
|
|
|
gSpecialVar_0x8004 = GetStringWidth(FONT_6, ptr, -1);
|
|
|
|
|
gSpecialVar_0x8004 = GetStringWidth(FONT_BRAILLE, ptr, -1);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_vmessage(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u32 v1 = ScriptReadWord(ctx);
|
|
|
|
|
u32 msg = ScriptReadWord(ctx);
|
|
|
|
|
|
|
|
|
|
ShowFieldMessage((u8 *)(v1 - gVScriptOffset));
|
|
|
|
|
ShowFieldMessage((u8 *)(msg - sAddressOffset));
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1629,8 +1630,8 @@ bool8 ScrCmd_bufferitemname(struct ScriptContext * ctx)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const u8 gUnknown_83A72A0[] = _("S");
|
|
|
|
|
const u8 gUnknown_83A72A2[] = _("IES");
|
|
|
|
|
static const u8 sText_S[] = _("S");
|
|
|
|
|
static const u8 sText_IES[] = _("IES");
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_bufferitemnameplural(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
@@ -1640,15 +1641,15 @@ bool8 ScrCmd_bufferitemnameplural(struct ScriptContext * 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)
|
|
|
|
|
StringAppend(sScriptStringVars[stringVarIndex], sText_S);
|
|
|
|
|
else if (itemId >= FIRST_BERRY_INDEX && itemId < LAST_BERRY_INDEX && quantity >= 2)
|
|
|
|
|
{
|
|
|
|
|
u16 strlength = StringLength(sScriptStringVars[stringVarIndex]);
|
|
|
|
|
if (strlength != 0)
|
|
|
|
|
{
|
|
|
|
|
u8 * endptr = sScriptStringVars[stringVarIndex] + strlength;
|
|
|
|
|
endptr[-1] = EOS;
|
|
|
|
|
StringAppend(sScriptStringVars[stringVarIndex], gUnknown_83A72A2);
|
|
|
|
|
StringAppend(sScriptStringVars[stringVarIndex], sText_IES);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1676,10 +1677,10 @@ bool8 ScrCmd_buffermovename(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_buffernumberstring(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u8 stringVarIndex = ScriptReadByte(ctx);
|
|
|
|
|
u16 v1 = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
u8 v2 = CountDigits(v1);
|
|
|
|
|
u16 num = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
u8 numDigits = CountDigits(num);
|
|
|
|
|
|
|
|
|
|
ConvertIntToDecimalStringN(sScriptStringVars[stringVarIndex], v1, 0, v2);
|
|
|
|
|
ConvertIntToDecimalStringN(sScriptStringVars[stringVarIndex], num, STR_CONV_MODE_LEFT_ALIGN, numDigits);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1692,17 +1693,6 @@ bool8 ScrCmd_bufferstdstring(struct ScriptContext * ctx)
|
|
|
|
|
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);
|
|
|
|
@@ -1712,9 +1702,9 @@ bool8 ScrCmd_bufferstring(struct ScriptContext * ctx)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_vloadword(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_vbuffermessage(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
const u8 *ptr = (u8 *)(ScriptReadWord(ctx) - gVScriptOffset);
|
|
|
|
|
const u8 *ptr = (u8 *)(ScriptReadWord(ctx) - sAddressOffset);
|
|
|
|
|
|
|
|
|
|
StringExpandPlaceholders(gStringVar4, ptr);
|
|
|
|
|
return FALSE;
|
|
|
|
@@ -1725,7 +1715,7 @@ bool8 ScrCmd_vbufferstring(struct ScriptContext * ctx)
|
|
|
|
|
u8 stringVarIndex = ScriptReadByte(ctx);
|
|
|
|
|
u32 addr = ScriptReadWord(ctx);
|
|
|
|
|
|
|
|
|
|
const u8 *src = (u8 *)(addr - gVScriptOffset);
|
|
|
|
|
const u8 *src = (u8 *)(addr - sAddressOffset);
|
|
|
|
|
u8 *dest = sScriptStringVars[stringVarIndex];
|
|
|
|
|
StringCopy(dest, src);
|
|
|
|
|
return FALSE;
|
|
|
|
@@ -1964,6 +1954,7 @@ bool8 ScrCmd_pokemartdecoration(struct ScriptContext * ctx)
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Changes clerk dialogue slightly from above. See MART_TYPE_DECOR2
|
|
|
|
|
bool8 ScrCmd_pokemartdecoration2(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
const void *ptr = (void *)ScriptReadWord(ctx);
|
|
|
|
@@ -1989,13 +1980,13 @@ bool8 ScrCmd_setberrytree(struct ScriptContext * ctx)
|
|
|
|
|
// u8 growthStage = ScriptReadByte(ctx);
|
|
|
|
|
//
|
|
|
|
|
// if (berry == 0)
|
|
|
|
|
// PlantBerryTree(treeId, 0, growthStage, FALSE);
|
|
|
|
|
// PlantBerryTree(treeId, berry, growthStage, FALSE);
|
|
|
|
|
// else
|
|
|
|
|
// PlantBerryTree(treeId, berry, growthStage, FALSE);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_getpricereduction(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_getpokenewsactive(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
// u16 value = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
//
|
|
|
|
@@ -2005,7 +1996,7 @@ bool8 ScrCmd_getpricereduction(struct ScriptContext * ctx)
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_choosecontestmon(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
// sub_81B9404();
|
|
|
|
|
// ChooseContestMon();
|
|
|
|
|
ScriptContext1_Stop();
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
@@ -2013,7 +2004,7 @@ bool8 ScrCmd_choosecontestmon(struct ScriptContext * ctx)
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_startcontest(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
// sub_80F840C();
|
|
|
|
|
// StartContest();
|
|
|
|
|
// ScriptContext1_Stop();
|
|
|
|
|
// return TRUE;
|
|
|
|
|
return FALSE;
|
|
|
|
@@ -2021,7 +2012,7 @@ bool8 ScrCmd_startcontest(struct ScriptContext * ctx)
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_showcontestresults(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
// sub_80F8484();
|
|
|
|
|
// ShowContestResults();
|
|
|
|
|
// ScriptContext1_Stop();
|
|
|
|
|
// return TRUE;
|
|
|
|
|
return FALSE;
|
|
|
|
@@ -2029,7 +2020,7 @@ bool8 ScrCmd_showcontestresults(struct ScriptContext * ctx)
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_contestlinktransfer(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
// sub_80F84C4(gSpecialVar_ContestCategory);
|
|
|
|
|
// ContestLinkTransfer(gSpecialVar_ContestCategory);
|
|
|
|
|
// ScriptContext1_Stop();
|
|
|
|
|
// return TRUE;
|
|
|
|
|
return FALSE;
|
|
|
|
@@ -2044,7 +2035,7 @@ bool8 ScrCmd_dofieldeffect(struct ScriptContext * ctx)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_setfieldeffectarg(struct ScriptContext * ctx)
|
|
|
|
|
bool8 ScrCmd_setfieldeffectargument(struct ScriptContext * ctx)
|
|
|
|
|
{
|
|
|
|
|
u8 argNum = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
|
@@ -2101,11 +2092,11 @@ bool8 ScrCmd_setmetatile(struct ScriptContext * ctx)
|
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
u16 tileId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
u16 v8 = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
bool16 isImpassable = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
|
|
x += 7;
|
|
|
|
|
y += 7;
|
|
|
|
|
if (!v8)
|
|
|
|
|
x += MAP_OFFSET;
|
|
|
|
|
y += MAP_OFFSET;
|
|
|
|
|
if (!isImpassable)
|
|
|
|
|
MapGridSetMetatileIdAt(x, y, tileId);
|
|
|
|
|
else
|
|
|
|
|
MapGridSetMetatileIdAt(x, y, tileId | METATILE_COLLISION_MASK);
|
|
|
|
@@ -2117,8 +2108,8 @@ bool8 ScrCmd_opendoor(struct ScriptContext * ctx)
|
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
|
|
x += 7;
|
|
|
|
|
y += 7;
|
|
|
|
|
x += MAP_OFFSET;
|
|
|
|
|
y += MAP_OFFSET;
|
|
|
|
|
PlaySE(GetDoorSoundEffect(x, y));
|
|
|
|
|
FieldAnimateDoorOpen(x, y);
|
|
|
|
|
return FALSE;
|
|
|
|
@@ -2129,8 +2120,8 @@ bool8 ScrCmd_closedoor(struct ScriptContext * ctx)
|
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
|
|
x += 7;
|
|
|
|
|
y += 7;
|
|
|
|
|
x += MAP_OFFSET;
|
|
|
|
|
y += MAP_OFFSET;
|
|
|
|
|
FieldAnimateDoorClose(x, y);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
@@ -2154,8 +2145,8 @@ bool8 ScrCmd_setdooropen(struct ScriptContext * ctx)
|
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
|
|
x += 7;
|
|
|
|
|
y += 7;
|
|
|
|
|
x += MAP_OFFSET;
|
|
|
|
|
y += MAP_OFFSET;
|
|
|
|
|
FieldSetDoorOpened(x, y);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
@@ -2165,8 +2156,8 @@ bool8 ScrCmd_setdoorclosed(struct ScriptContext * ctx)
|
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
|
|
x += 7;
|
|
|
|
|
y += 7;
|
|
|
|
|
x += MAP_OFFSET;
|
|
|
|
|
y += MAP_OFFSET;
|
|
|
|
|
FieldSetDoorClosed(x, y);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
@@ -2202,9 +2193,9 @@ bool8 ScrCmd_addcoins(struct ScriptContext * ctx)
|
|
|
|
|
u16 coins = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
|
|
if (AddCoins(coins) == TRUE)
|
|
|
|
|
gSpecialVar_Result = 0;
|
|
|
|
|
gSpecialVar_Result = FALSE;
|
|
|
|
|
else
|
|
|
|
|
gSpecialVar_Result = 1;
|
|
|
|
|
gSpecialVar_Result = TRUE;
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -2213,9 +2204,9 @@ bool8 ScrCmd_removecoins(struct ScriptContext * ctx)
|
|
|
|
|
u16 coins = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
|
|
if (RemoveCoins(coins) == TRUE)
|
|
|
|
|
gSpecialVar_Result = 0;
|
|
|
|
|
gSpecialVar_Result = FALSE;
|
|
|
|
|
else
|
|
|
|
|
gSpecialVar_Result = 1;
|
|
|
|
|
gSpecialVar_Result = TRUE;
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|