2017-10-01 03:19:29 +02:00
|
|
|
#include "global.h"
|
2018-10-30 22:17:03 +01:00
|
|
|
#include "frontier_util.h"
|
2017-10-12 09:06:19 +02:00
|
|
|
#include "battle_setup.h"
|
|
|
|
#include "berry.h"
|
|
|
|
#include "clock.h"
|
|
|
|
#include "coins.h"
|
2018-11-19 17:16:01 +01:00
|
|
|
#include "contest.h"
|
2020-06-19 00:01:32 +02:00
|
|
|
#include "contest_util.h"
|
2017-10-12 09:06:19 +02:00
|
|
|
#include "contest_painting.h"
|
2019-04-04 23:53:06 +02:00
|
|
|
#include "data.h"
|
2017-10-12 09:06:19 +02:00
|
|
|
#include "decoration.h"
|
|
|
|
#include "decoration_inventory.h"
|
|
|
|
#include "event_data.h"
|
|
|
|
#include "field_door.h"
|
|
|
|
#include "field_effect.h"
|
2019-12-06 08:55:30 +01:00
|
|
|
#include "event_object_lock.h"
|
2018-06-11 15:34:19 +02:00
|
|
|
#include "event_object_movement.h"
|
2017-10-12 09:06:19 +02:00
|
|
|
#include "field_message_box.h"
|
|
|
|
#include "field_player_avatar.h"
|
|
|
|
#include "field_screen_effect.h"
|
|
|
|
#include "field_specials.h"
|
|
|
|
#include "field_tasks.h"
|
|
|
|
#include "field_weather.h"
|
|
|
|
#include "fieldmap.h"
|
|
|
|
#include "item.h"
|
|
|
|
#include "lilycove_lady.h"
|
|
|
|
#include "main.h"
|
2017-10-14 02:48:09 +02:00
|
|
|
#include "menu.h"
|
2017-10-12 09:06:19 +02:00
|
|
|
#include "money.h"
|
|
|
|
#include "mystery_event_script.h"
|
|
|
|
#include "palette.h"
|
|
|
|
#include "party_menu.h"
|
|
|
|
#include "pokemon_storage_system.h"
|
2017-12-05 19:27:33 +01:00
|
|
|
#include "random.h"
|
2017-10-12 09:06:19 +02:00
|
|
|
#include "overworld.h"
|
2019-10-16 10:09:30 +02:00
|
|
|
#include "rotating_tile_puzzle.h"
|
2017-10-12 09:06:19 +02:00
|
|
|
#include "rtc.h"
|
|
|
|
#include "script.h"
|
|
|
|
#include "script_menu.h"
|
|
|
|
#include "script_movement.h"
|
2020-08-13 23:42:12 +02:00
|
|
|
#include "script_pokemon_util.h"
|
2017-10-12 09:06:19 +02:00
|
|
|
#include "shop.h"
|
|
|
|
#include "slot_machine.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "string_util.h"
|
|
|
|
#include "text.h"
|
2017-10-14 02:48:09 +02:00
|
|
|
#include "text_window.h"
|
2017-10-12 09:06:19 +02:00
|
|
|
#include "trainer_see.h"
|
|
|
|
#include "tv.h"
|
|
|
|
#include "window.h"
|
2018-12-28 19:29:21 +01:00
|
|
|
#include "constants/event_objects.h"
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
typedef u16 (*SpecialFunc)(void);
|
|
|
|
typedef void (*NativeFunc)(void);
|
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
EWRAM_DATA const u8 *gRamScriptRetAddr = NULL;
|
|
|
|
static EWRAM_DATA u32 sAddressOffset = 0; // For relative addressing in vgoto etc., used by saved scripts (e.g. Mystery Event)
|
2017-10-12 09:06:19 +02:00
|
|
|
static EWRAM_DATA u16 sPauseCounter = 0;
|
|
|
|
static EWRAM_DATA u16 sMovingNpcId = 0;
|
2021-11-15 16:57:22 +01:00
|
|
|
static EWRAM_DATA u16 sMovingNpcMapGroup = 0;
|
|
|
|
static EWRAM_DATA u16 sMovingNpcMapNum = 0;
|
2017-10-12 09:06:19 +02:00
|
|
|
static EWRAM_DATA u16 sFieldEffectScriptId = 0;
|
2017-10-01 03:19:29 +02:00
|
|
|
|
2021-11-15 16:57:22 +01:00
|
|
|
static u8 sBrailleWindowId;
|
2020-11-17 09:13:00 +01:00
|
|
|
static bool8 gIsScriptedWildDouble;
|
2017-10-01 03:19:29 +02:00
|
|
|
|
2017-10-12 21:36:26 +02:00
|
|
|
extern const SpecialFunc gSpecials[];
|
|
|
|
extern const u8 *gStdScripts[];
|
|
|
|
extern const u8 *gStdScripts_End[];
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2019-10-31 22:00:37 +01:00
|
|
|
static void CloseBrailleWindow(void);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
// This is defined in here so the optimizer can't see its value when compiling
|
|
|
|
// script.c.
|
|
|
|
void * const gNullScriptPtr = NULL;
|
|
|
|
|
|
|
|
static const u8 sScriptConditionTable[6][3] =
|
|
|
|
{
|
|
|
|
// < = >
|
|
|
|
1, 0, 0, // <
|
|
|
|
0, 1, 0, // =
|
|
|
|
0, 0, 1, // >
|
|
|
|
1, 1, 0, // <=
|
|
|
|
0, 1, 1, // >=
|
|
|
|
1, 0, 1, // !=
|
|
|
|
};
|
|
|
|
|
|
|
|
static u8 * const sScriptStringVars[] =
|
|
|
|
{
|
|
|
|
gStringVar1,
|
|
|
|
gStringVar2,
|
|
|
|
gStringVar3,
|
|
|
|
};
|
|
|
|
|
|
|
|
bool8 ScrCmd_nop(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_nop1(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_end(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
StopScript(ctx);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_gotonative(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
bool8 (*addr)(void) = (bool8 (*)(void))ScriptReadWord(ctx);
|
|
|
|
|
|
|
|
SetupNativeScript(ctx, addr);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_special(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 index = ScriptReadHalfword(ctx);
|
|
|
|
|
|
|
|
gSpecials[index]();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_specialvar(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 *var = GetVarPointer(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
*var = gSpecials[ScriptReadHalfword(ctx)]();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_callnative(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
NativeFunc func = (NativeFunc)ScriptReadWord(ctx);
|
|
|
|
|
|
|
|
func();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_waitstate(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
ScriptContext1_Stop();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_goto(struct ScriptContext *ctx)
|
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 *ptr = (const u8 *)ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
ScriptJump(ctx, ptr);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_return(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
ScriptReturn(ctx);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_call(struct ScriptContext *ctx)
|
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 *ptr = (const u8 *)ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
ScriptCall(ctx, ptr);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_goto_if(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 condition = ScriptReadByte(ctx);
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 *ptr = (const u8 *)ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
if (sScriptConditionTable[condition][ctx->comparisonResult] == 1)
|
|
|
|
ScriptJump(ctx, ptr);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_call_if(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 condition = ScriptReadByte(ctx);
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 *ptr = (const u8 *)ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
if (sScriptConditionTable[condition][ctx->comparisonResult] == 1)
|
|
|
|
ScriptCall(ctx, ptr);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setvaddress(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u32 addr1 = (u32)ctx->scriptPtr - 1;
|
|
|
|
u32 addr2 = ScriptReadWord(ctx);
|
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
sAddressOffset = addr2 - addr1;
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_vgoto(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u32 addr = ScriptReadWord(ctx);
|
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
ScriptJump(ctx, (u8 *)(addr - sAddressOffset));
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_vcall(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u32 addr = ScriptReadWord(ctx);
|
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
ScriptCall(ctx, (u8 *)(addr - sAddressOffset));
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_vgoto_if(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 condition = ScriptReadByte(ctx);
|
2021-01-26 08:16:26 +01:00
|
|
|
const u8 *ptr = (const u8 *)(ScriptReadWord(ctx) - sAddressOffset);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
if (sScriptConditionTable[condition][ctx->comparisonResult] == 1)
|
|
|
|
ScriptJump(ctx, ptr);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_vcall_if(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 condition = ScriptReadByte(ctx);
|
2021-01-26 08:16:26 +01:00
|
|
|
const u8 *ptr = (const u8 *)(ScriptReadWord(ctx) - sAddressOffset);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
if (sScriptConditionTable[condition][ctx->comparisonResult] == 1)
|
|
|
|
ScriptCall(ctx, ptr);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_gotostd(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 index = ScriptReadByte(ctx);
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 **ptr = &gStdScripts[index];
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
if (ptr < gStdScripts_End)
|
|
|
|
ScriptJump(ctx, *ptr);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_callstd(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 index = ScriptReadByte(ctx);
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 **ptr = &gStdScripts[index];
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
if (ptr < gStdScripts_End)
|
|
|
|
ScriptCall(ctx, *ptr);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_gotostd_if(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 condition = ScriptReadByte(ctx);
|
|
|
|
u8 index = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
if (sScriptConditionTable[condition][ctx->comparisonResult] == 1)
|
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 **ptr = &gStdScripts[index];
|
2017-10-12 09:06:19 +02:00
|
|
|
if (ptr < gStdScripts_End)
|
|
|
|
ScriptJump(ctx, *ptr);
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_callstd_if(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 condition = ScriptReadByte(ctx);
|
|
|
|
u8 index = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
if (sScriptConditionTable[condition][ctx->comparisonResult] == 1)
|
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 **ptr = &gStdScripts[index];
|
2017-10-12 09:06:19 +02:00
|
|
|
if (ptr < gStdScripts_End)
|
|
|
|
ScriptCall(ctx, *ptr);
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-04-03 15:55:17 +02:00
|
|
|
bool8 ScrCmd_returnram(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2021-01-26 08:16:26 +01:00
|
|
|
ScriptJump(ctx, gRamScriptRetAddr);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-11-18 06:32:28 +01:00
|
|
|
bool8 ScrCmd_endram(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
ClearRamScript();
|
|
|
|
StopScript(ctx);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setmysteryeventstatus(struct ScriptContext *ctx)
|
|
|
|
{
|
2021-11-18 06:32:28 +01:00
|
|
|
u8 status = ScriptReadByte(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2021-11-18 06:32:28 +01:00
|
|
|
SetMysteryEventScriptStatus(status);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_loadword(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 index = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
ctx->data[index] = ScriptReadWord(ctx);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-11-18 06:32:28 +01:00
|
|
|
bool8 ScrCmd_loadbytefromptr(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 index = ScriptReadByte(ctx);
|
|
|
|
|
2017-10-12 21:36:26 +02:00
|
|
|
ctx->data[index] = *(const u8 *)ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-11-18 06:32:28 +01:00
|
|
|
bool8 ScrCmd_setptr(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 value = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
*(u8 *)ScriptReadWord(ctx) = value;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_loadbyte(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 index = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
ctx->data[index] = ScriptReadByte(ctx);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setptrbyte(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 index = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
*(u8 *)ScriptReadWord(ctx) = ctx->data[index];
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_copylocal(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 destIndex = ScriptReadByte(ctx);
|
|
|
|
u8 srcIndex = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
ctx->data[destIndex] = ctx->data[srcIndex];
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_copybyte(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 *ptr = (u8 *)ScriptReadWord(ctx);
|
2017-10-12 21:36:26 +02:00
|
|
|
*ptr = *(const u8 *)ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setvar(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 *ptr = GetVarPointer(ScriptReadHalfword(ctx));
|
|
|
|
*ptr = ScriptReadHalfword(ctx);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_copyvar(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 *ptr = GetVarPointer(ScriptReadHalfword(ctx));
|
|
|
|
*ptr = *GetVarPointer(ScriptReadHalfword(ctx));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setorcopyvar(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 *ptr = GetVarPointer(ScriptReadHalfword(ctx));
|
|
|
|
*ptr = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
u8 Compare(u16 a, u16 b)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2021-01-26 08:16:26 +01:00
|
|
|
if (a < b)
|
2017-10-12 09:06:19 +02:00
|
|
|
return 0;
|
2021-01-26 08:16:26 +01:00
|
|
|
if (a == b)
|
2017-10-12 09:06:19 +02:00
|
|
|
return 1;
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_compare_local_to_local(struct ScriptContext *ctx)
|
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 value1 = ctx->data[ScriptReadByte(ctx)];
|
|
|
|
const u8 value2 = ctx->data[ScriptReadByte(ctx)];
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
ctx->comparisonResult = Compare(value1, value2);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_compare_local_to_value(struct ScriptContext *ctx)
|
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 value1 = ctx->data[ScriptReadByte(ctx)];
|
|
|
|
const u8 value2 = ScriptReadByte(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
ctx->comparisonResult = Compare(value1, value2);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-11-18 06:32:28 +01:00
|
|
|
bool8 ScrCmd_compare_local_to_ptr(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 value1 = ctx->data[ScriptReadByte(ctx)];
|
|
|
|
const u8 value2 = *(const u8 *)ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
ctx->comparisonResult = Compare(value1, value2);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-11-18 06:32:28 +01:00
|
|
|
bool8 ScrCmd_compare_ptr_to_local(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 value1 = *(const u8 *)ScriptReadWord(ctx);
|
|
|
|
const u8 value2 = ctx->data[ScriptReadByte(ctx)];
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
ctx->comparisonResult = Compare(value1, value2);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-11-18 06:32:28 +01:00
|
|
|
bool8 ScrCmd_compare_ptr_to_value(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 value1 = *(const u8 *)ScriptReadWord(ctx);
|
|
|
|
const u8 value2 = ScriptReadByte(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
ctx->comparisonResult = Compare(value1, value2);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-11-18 06:32:28 +01:00
|
|
|
bool8 ScrCmd_compare_ptr_to_ptr(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 value1 = *(const u8 *)ScriptReadWord(ctx);
|
|
|
|
const u8 value2 = *(const u8 *)ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
ctx->comparisonResult = Compare(value1, value2);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_compare_var_to_value(struct ScriptContext *ctx)
|
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const u16 value1 = *GetVarPointer(ScriptReadHalfword(ctx));
|
|
|
|
const u16 value2 = ScriptReadHalfword(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
ctx->comparisonResult = Compare(value1, value2);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_compare_var_to_var(struct ScriptContext *ctx)
|
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const u16 *ptr1 = GetVarPointer(ScriptReadHalfword(ctx));
|
|
|
|
const u16 *ptr2 = GetVarPointer(ScriptReadHalfword(ctx));
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
ctx->comparisonResult = Compare(*ptr1, *ptr2);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-08-25 00:59:32 +02:00
|
|
|
// Note: addvar doesn't support adding from a variable in vanilla. If you were to
|
2019-11-11 03:54:00 +01:00
|
|
|
// add a VarGet() to the above, make sure you change the `addvar VAR_*, -1`
|
|
|
|
// in the contest scripts to `subvar VAR_*, 1`, else contests will break.
|
2017-10-12 09:06:19 +02:00
|
|
|
bool8 ScrCmd_addvar(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 *ptr = GetVarPointer(ScriptReadHalfword(ctx));
|
|
|
|
*ptr += ScriptReadHalfword(ctx);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_subvar(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 *ptr = GetVarPointer(ScriptReadHalfword(ctx));
|
|
|
|
*ptr -= VarGet(ScriptReadHalfword(ctx));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_random(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 max = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = Random() % max;
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-01-13 05:24:52 +01:00
|
|
|
bool8 ScrCmd_additem(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 itemId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u32 quantity = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = AddBagItem(itemId, (u8)quantity);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-01-13 05:24:52 +01:00
|
|
|
bool8 ScrCmd_removeitem(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 itemId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u32 quantity = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = RemoveBagItem(itemId, (u8)quantity);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_checkitemspace(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 itemId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u32 quantity = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = CheckBagHasSpace(itemId, (u8)quantity);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_checkitem(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 itemId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u32 quantity = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = CheckBagHasItem(itemId, (u8)quantity);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_checkitemtype(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 itemId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = GetPocketByItemId(itemId);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-01-13 05:24:52 +01:00
|
|
|
bool8 ScrCmd_addpcitem(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 itemId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 quantity = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = AddPCItem(itemId, quantity);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_checkpcitem(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 itemId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 quantity = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = CheckPCHasItem(itemId, quantity);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-01-13 05:24:52 +01:00
|
|
|
bool8 ScrCmd_adddecoration(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u32 decorId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = DecorationAdd(decorId);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-01-13 05:24:52 +01:00
|
|
|
bool8 ScrCmd_removedecoration(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u32 decorId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = DecorationRemove(decorId);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_checkdecorspace(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u32 decorId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = DecorationCheckSpace(decorId);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_checkdecor(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u32 decorId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = CheckHasDecoration(decorId);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setflag(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
FlagSet(ScriptReadHalfword(ctx));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_clearflag(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
FlagClear(ScriptReadHalfword(ctx));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_checkflag(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
ctx->comparisonResult = FlagGet(ScriptReadHalfword(ctx));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_incrementgamestat(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
IncrementGameStat(ScriptReadByte(ctx));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_animateflash(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2019-10-11 23:25:07 +02:00
|
|
|
AnimateFlash(ScriptReadByte(ctx));
|
2017-10-12 09:06:19 +02:00
|
|
|
ScriptContext1_Stop();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-11-16 23:12:16 +01:00
|
|
|
bool8 ScrCmd_setflashlevel(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2021-11-15 16:57:22 +01:00
|
|
|
SetFlashLevel(VarGet(ScriptReadHalfword(ctx)));
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool8 IsPaletteNotActive(void)
|
|
|
|
{
|
|
|
|
if (!gPaletteFade.active)
|
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_fadescreen(struct ScriptContext *ctx)
|
|
|
|
{
|
2018-01-29 16:25:09 +01:00
|
|
|
FadeScreen(ScriptReadByte(ctx), 0);
|
2017-10-12 09:06:19 +02:00
|
|
|
SetupNativeScript(ctx, IsPaletteNotActive);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_fadescreenspeed(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2017-10-13 05:34:58 +02:00
|
|
|
u8 mode = ScriptReadByte(ctx);
|
2017-10-23 07:34:55 +02:00
|
|
|
u8 speed = ScriptReadByte(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2018-01-29 16:25:09 +01:00
|
|
|
FadeScreen(mode, speed);
|
2017-10-12 09:06:19 +02:00
|
|
|
SetupNativeScript(ctx, IsPaletteNotActive);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-10-13 05:34:58 +02:00
|
|
|
bool8 ScrCmd_fadescreenswapbuffers(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2017-10-13 05:34:58 +02:00
|
|
|
u8 mode = ScriptReadByte(ctx);
|
2017-12-01 21:25:13 +01:00
|
|
|
|
2017-10-13 05:34:58 +02:00
|
|
|
switch (mode)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2021-11-18 06:32:28 +01:00
|
|
|
case FADE_TO_BLACK:
|
|
|
|
case FADE_TO_WHITE:
|
|
|
|
default:
|
|
|
|
CpuCopy32(gPlttBufferUnfaded, gPaletteDecompressionBuffer, PLTT_DECOMP_BUFFER_SIZE);
|
|
|
|
FadeScreen(mode, 0);
|
|
|
|
break;
|
|
|
|
case FADE_FROM_BLACK:
|
|
|
|
case FADE_FROM_WHITE:
|
|
|
|
CpuCopy32(gPaletteDecompressionBuffer, gPlttBufferUnfaded, PLTT_DECOMP_BUFFER_SIZE);
|
|
|
|
FadeScreen(mode, 0);
|
|
|
|
break;
|
2017-10-12 09:06:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
SetupNativeScript(ctx, IsPaletteNotActive);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool8 RunPauseTimer(void)
|
|
|
|
{
|
2021-11-15 16:57:22 +01:00
|
|
|
if (--sPauseCounter == 0)
|
2017-10-12 09:06:19 +02:00
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_delay(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
sPauseCounter = ScriptReadHalfword(ctx);
|
|
|
|
SetupNativeScript(ctx, RunPauseTimer);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_initclock(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 hour = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u8 minute = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
RtcInitLocalTimeOffset(hour, minute);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-02-12 07:40:34 +01:00
|
|
|
bool8 ScrCmd_dotimebasedevents(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
DoTimeBasedEvents();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_gettime(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
RtcCalcLocalTime();
|
|
|
|
gSpecialVar_0x8000 = gLocalTime.hours;
|
|
|
|
gSpecialVar_0x8001 = gLocalTime.minutes;
|
|
|
|
gSpecialVar_0x8002 = gLocalTime.seconds;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setweather(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 weather = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2021-11-16 23:12:16 +01:00
|
|
|
SetSavedWeather(weather);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_resetweather(struct ScriptContext *ctx)
|
|
|
|
{
|
2021-11-16 23:12:16 +01:00
|
|
|
SetSavedWeatherFromCurrMapHeader();
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_doweather(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
DoCurrentWeather();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_setstepcallback(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
ActivatePerStepCallback(ScriptReadByte(ctx));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setmaplayoutindex(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 value = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2018-12-27 23:30:47 +01:00
|
|
|
SetCurrentMapLayout(value);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_warp(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
u8 warpId = ScriptReadByte(ctx);
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2018-12-27 23:30:47 +01:00
|
|
|
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
2018-12-28 22:11:15 +01:00
|
|
|
DoWarp();
|
2018-09-05 00:31:37 +02:00
|
|
|
ResetInitialPlayerAvatarState();
|
2017-10-12 09:06:19 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_warpsilent(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
u8 warpId = ScriptReadByte(ctx);
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2018-12-27 23:30:47 +01:00
|
|
|
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
2018-12-28 22:11:15 +01:00
|
|
|
DoDiveWarp();
|
2018-09-05 00:31:37 +02:00
|
|
|
ResetInitialPlayerAvatarState();
|
2017-10-12 09:06:19 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_warpdoor(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
u8 warpId = ScriptReadByte(ctx);
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2018-12-27 23:30:47 +01:00
|
|
|
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
2018-12-28 22:11:15 +01:00
|
|
|
DoDoorWarp();
|
2018-09-05 00:31:37 +02:00
|
|
|
ResetInitialPlayerAvatarState();
|
2017-10-12 09:06:19 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_warphole(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
|
|
|
u16 x;
|
|
|
|
u16 y;
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
PlayerGetDestCoords(&x, &y);
|
2021-11-03 23:29:18 +01:00
|
|
|
if (mapGroup == MAP_GROUP(UNDEFINED) && mapNum == MAP_NUM(UNDEFINED))
|
2021-10-09 18:12:18 +02:00
|
|
|
SetWarpDestinationToFixedHoleWarp(x - MAP_OFFSET, y - MAP_OFFSET);
|
2017-10-12 09:06:19 +02:00
|
|
|
else
|
2021-11-15 18:04:54 +01:00
|
|
|
SetWarpDestination(mapGroup, mapNum, WARP_ID_NONE, x - MAP_OFFSET, y - MAP_OFFSET);
|
2018-12-28 22:11:15 +01:00
|
|
|
DoFallWarp();
|
2018-09-05 00:31:37 +02:00
|
|
|
ResetInitialPlayerAvatarState();
|
2017-10-12 09:06:19 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-06-29 23:24:17 +02:00
|
|
|
// RS mossdeep gym warp, unused in Emerald
|
2017-10-12 09:06:19 +02:00
|
|
|
bool8 ScrCmd_warpteleport(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
u8 warpId = ScriptReadByte(ctx);
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2018-12-27 23:30:47 +01:00
|
|
|
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
2020-06-29 23:24:17 +02:00
|
|
|
DoTeleportTileWarp();
|
2018-09-05 00:31:37 +02:00
|
|
|
ResetInitialPlayerAvatarState();
|
2017-10-12 09:06:19 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-10-15 11:00:08 +02:00
|
|
|
bool8 ScrCmd_warpmossdeepgym(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
u8 warpId = ScriptReadByte(ctx);
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2018-12-27 23:30:47 +01:00
|
|
|
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
2019-10-15 11:00:08 +02:00
|
|
|
DoMossdeepGymWarp();
|
2018-09-05 00:31:37 +02:00
|
|
|
ResetInitialPlayerAvatarState();
|
2017-10-12 09:06:19 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setwarp(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
u8 warpId = ScriptReadByte(ctx);
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2018-12-27 23:30:47 +01:00
|
|
|
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setdynamicwarp(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
u8 warpId = ScriptReadByte(ctx);
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2018-12-27 23:30:47 +01:00
|
|
|
SetDynamicWarpWithCoords(0, mapGroup, mapNum, warpId, x, y);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setdivewarp(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
u8 warpId = ScriptReadByte(ctx);
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2018-09-05 00:31:37 +02:00
|
|
|
SetFixedDiveWarp(mapGroup, mapNum, warpId, x, y);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setholewarp(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
u8 warpId = ScriptReadByte(ctx);
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2018-09-05 00:31:37 +02:00
|
|
|
SetFixedHoleWarp(mapGroup, mapNum, warpId, x, y);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setescapewarp(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
u8 warpId = ScriptReadByte(ctx);
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2018-12-27 23:30:47 +01:00
|
|
|
SetEscapeWarp(mapGroup, mapNum, warpId, x, y);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_getplayerxy(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 *pX = GetVarPointer(ScriptReadHalfword(ctx));
|
|
|
|
u16 *pY = GetVarPointer(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
*pX = gSaveBlock1Ptr->pos.x;
|
|
|
|
*pY = gSaveBlock1Ptr->pos.y;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_getpartysize(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = CalculatePlayerPartyCount();
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_playse(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
PlaySE(ScriptReadHalfword(ctx));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool8 WaitForSoundEffectFinish(void)
|
|
|
|
{
|
|
|
|
if (!IsSEPlaying())
|
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_waitse(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
SetupNativeScript(ctx, WaitForSoundEffectFinish);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_playfanfare(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
PlayFanfare(ScriptReadHalfword(ctx));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool8 WaitForFanfareFinish(void)
|
|
|
|
{
|
|
|
|
return IsFanfareTaskInactive();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_waitfanfare(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
SetupNativeScript(ctx, WaitForFanfareFinish);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_playbgm(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 songId = ScriptReadHalfword(ctx);
|
2021-11-15 16:57:22 +01:00
|
|
|
bool8 save = ScriptReadByte(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2021-11-15 16:57:22 +01:00
|
|
|
if (save == TRUE)
|
2017-10-12 09:06:19 +02:00
|
|
|
Overworld_SetSavedMusic(songId);
|
|
|
|
PlayNewMapMusic(songId);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_savebgm(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
Overworld_SetSavedMusic(ScriptReadHalfword(ctx));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_fadedefaultbgm(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
Overworld_ChangeMusicToDefault();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_fadenewbgm(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
Overworld_ChangeMusicTo(ScriptReadHalfword(ctx));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_fadeoutbgm(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 speed = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
if (speed != 0)
|
|
|
|
FadeOutBGMTemporarily(4 * speed);
|
|
|
|
else
|
|
|
|
FadeOutBGMTemporarily(4);
|
|
|
|
SetupNativeScript(ctx, IsBGMPausedOrStopped);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_fadeinbgm(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 speed = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
if (speed != 0)
|
|
|
|
FadeInBGM(4 * speed);
|
|
|
|
else
|
|
|
|
FadeInBGM(4);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_applymovement(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
2017-10-12 21:36:26 +02:00
|
|
|
const void *movementScript = (const void *)ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
ScriptMovement_StartObjectMovementScript(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, movementScript);
|
|
|
|
sMovingNpcId = localId;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2022-01-04 16:09:42 +01:00
|
|
|
bool8 ScrCmd_applymovementat(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
2017-10-12 21:36:26 +02:00
|
|
|
const void *movementScript = (const void *)ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
ScriptMovement_StartObjectMovementScript(localId, mapNum, mapGroup, movementScript);
|
|
|
|
sMovingNpcId = localId;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool8 WaitForMovementFinish(void)
|
|
|
|
{
|
2021-11-15 16:57:22 +01:00
|
|
|
return ScriptMovement_IsObjectMovementFinished(sMovingNpcId, sMovingNpcMapNum, sMovingNpcMapGroup);
|
2017-10-12 09:06:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_waitmovement(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
if (localId != 0)
|
|
|
|
sMovingNpcId = localId;
|
2021-11-15 16:57:22 +01:00
|
|
|
sMovingNpcMapGroup = gSaveBlock1Ptr->location.mapGroup;
|
|
|
|
sMovingNpcMapNum = gSaveBlock1Ptr->location.mapNum;
|
2017-10-12 09:06:19 +02:00
|
|
|
SetupNativeScript(ctx, WaitForMovementFinish);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2022-01-04 16:09:42 +01:00
|
|
|
bool8 ScrCmd_waitmovementat(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
2021-11-15 16:57:22 +01:00
|
|
|
u8 mapGroup;
|
|
|
|
u8 mapNum;
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
if (localId != 0)
|
|
|
|
sMovingNpcId = localId;
|
2021-11-15 16:57:22 +01:00
|
|
|
mapGroup = ScriptReadByte(ctx);
|
|
|
|
mapNum = ScriptReadByte(ctx);
|
|
|
|
sMovingNpcMapGroup = mapGroup;
|
|
|
|
sMovingNpcMapNum = mapNum;
|
2017-10-12 09:06:19 +02:00
|
|
|
SetupNativeScript(ctx, WaitForMovementFinish);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_removeobject(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2019-11-21 04:55:44 +01:00
|
|
|
RemoveObjectEventByLocalIdAndMap(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2022-01-04 16:09:42 +01:00
|
|
|
bool8 ScrCmd_removeobjectat(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 objectId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
|
2019-11-21 04:55:44 +01:00
|
|
|
RemoveObjectEventByLocalIdAndMap(objectId, mapNum, mapGroup);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_addobject(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 objectId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2019-11-21 04:55:44 +01:00
|
|
|
TrySpawnObjectEvent(objectId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2022-01-04 16:09:42 +01:00
|
|
|
bool8 ScrCmd_addobjectat(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 objectId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
|
2019-11-21 04:55:44 +01:00
|
|
|
TrySpawnObjectEvent(objectId, mapNum, mapGroup);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setobjectxy(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2019-11-21 04:55:44 +01:00
|
|
|
TryMoveObjectEventToMapCoords(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, x, y);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setobjectxyperm(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2021-11-15 16:57:22 +01:00
|
|
|
SetObjEventTemplateCoords(localId, x, y);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-08-17 16:38:02 +02:00
|
|
|
bool8 ScrCmd_copyobjectxytoperm(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2019-11-21 04:55:44 +01:00
|
|
|
TryOverrideObjectEventTemplateCoords(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2022-01-04 16:09:42 +01:00
|
|
|
bool8 ScrCmd_showobjectat(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
SetObjectInvisibility(localId, mapNum, mapGroup, FALSE);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2022-01-04 16:09:42 +01:00
|
|
|
bool8 ScrCmd_hideobjectat(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
SetObjectInvisibility(localId, mapNum, mapGroup, TRUE);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-11-17 23:15:45 +01:00
|
|
|
bool8 ScrCmd_setobjectsubpriority(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
u8 priority = ScriptReadByte(ctx);
|
|
|
|
|
2021-11-17 23:15:45 +01:00
|
|
|
SetObjectSubpriority(localId, mapNum, mapGroup, priority + 83);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-11-17 23:15:45 +01:00
|
|
|
bool8 ScrCmd_resetobjectsubpriority(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
|
2021-11-17 23:15:45 +01:00
|
|
|
ResetObjectSubpriority(localId, mapNum, mapGroup);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_faceplayer(struct ScriptContext *ctx)
|
|
|
|
{
|
2019-11-21 04:55:44 +01:00
|
|
|
if (gObjectEvents[gSelectedObjectEvent].active)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2019-11-21 04:55:44 +01:00
|
|
|
ObjectEventFaceOppositeDirection(&gObjectEvents[gSelectedObjectEvent],
|
2018-06-14 00:51:26 +02:00
|
|
|
GetPlayerFacingDirection());
|
2017-10-12 09:06:19 +02:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_turnobject(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u8 direction = ScriptReadByte(ctx);
|
|
|
|
|
2019-11-21 04:55:44 +01:00
|
|
|
ObjectEventTurnByLocalIdAndMap(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, direction);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setobjectmovementtype(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u8 movementType = ScriptReadByte(ctx);
|
|
|
|
|
2021-11-15 16:57:22 +01:00
|
|
|
SetObjEventTemplateMovementType(localId, movementType);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_createvobject(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 graphicsId = ScriptReadByte(ctx);
|
2021-11-18 05:28:43 +01:00
|
|
|
u8 virtualObjId = ScriptReadByte(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u32 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u8 elevation = ScriptReadByte(ctx);
|
|
|
|
u8 direction = ScriptReadByte(ctx);
|
|
|
|
|
2021-11-18 05:28:43 +01:00
|
|
|
CreateVirtualObject(graphicsId, virtualObjId, x, y, elevation, direction);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_turnvobject(struct ScriptContext *ctx)
|
|
|
|
{
|
2021-11-18 05:28:43 +01:00
|
|
|
u8 virtualObjId = ScriptReadByte(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
u8 direction = ScriptReadByte(ctx);
|
|
|
|
|
2021-11-18 05:28:43 +01:00
|
|
|
TurnVirtualObject(virtualObjId, direction);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-05-04 07:21:50 +02:00
|
|
|
// lockall freezes all object events except the player immediately.
|
|
|
|
// The player is frozen after waiting for their current movement to finish.
|
2017-10-12 09:06:19 +02:00
|
|
|
bool8 ScrCmd_lockall(struct ScriptContext *ctx)
|
|
|
|
{
|
2021-11-01 23:06:15 +01:00
|
|
|
if (IsOverworldLinkActive())
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-05-04 07:21:50 +02:00
|
|
|
FreezeObjects_WaitForPlayer();
|
2021-01-26 10:41:13 +01:00
|
|
|
SetupNativeScript(ctx, IsFreezePlayerFinished);
|
2017-10-12 09:06:19 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-04 07:21:50 +02:00
|
|
|
// lock freezes all object events except the player and the selected object immediately.
|
|
|
|
// The player and selected object are frozen after waiting for their current movement to finish.
|
2017-10-12 09:06:19 +02:00
|
|
|
bool8 ScrCmd_lock(struct ScriptContext *ctx)
|
|
|
|
{
|
2021-11-01 23:06:15 +01:00
|
|
|
if (IsOverworldLinkActive())
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-11-21 04:55:44 +01:00
|
|
|
if (gObjectEvents[gSelectedObjectEvent].active)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2021-05-04 07:21:50 +02:00
|
|
|
FreezeObjects_WaitForPlayerAndSelected();
|
2021-01-26 10:41:13 +01:00
|
|
|
SetupNativeScript(ctx, IsFreezeSelectedObjectAndPlayerFinished);
|
2017-10-12 09:06:19 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-05-04 07:21:50 +02:00
|
|
|
FreezeObjects_WaitForPlayer();
|
2021-01-26 10:41:13 +01:00
|
|
|
SetupNativeScript(ctx, IsFreezePlayerFinished);
|
2017-10-12 09:06:19 +02:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_releaseall(struct ScriptContext *ctx)
|
|
|
|
{
|
2018-12-28 19:29:21 +01:00
|
|
|
u8 playerObjectId;
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
HideFieldMessageBox();
|
2019-11-21 05:12:51 +01:00
|
|
|
playerObjectId = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0);
|
2019-11-21 04:55:44 +01:00
|
|
|
ObjectEventClearHeldMovementIfFinished(&gObjectEvents[playerObjectId]);
|
|
|
|
ScriptMovement_UnfreezeObjectEvents();
|
|
|
|
UnfreezeObjectEvents();
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_release(struct ScriptContext *ctx)
|
|
|
|
{
|
2018-12-28 19:29:21 +01:00
|
|
|
u8 playerObjectId;
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
HideFieldMessageBox();
|
2019-11-21 04:55:44 +01:00
|
|
|
if (gObjectEvents[gSelectedObjectEvent].active)
|
|
|
|
ObjectEventClearHeldMovementIfFinished(&gObjectEvents[gSelectedObjectEvent]);
|
2019-11-21 05:12:51 +01:00
|
|
|
playerObjectId = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0);
|
2019-11-21 04:55:44 +01:00
|
|
|
ObjectEventClearHeldMovementIfFinished(&gObjectEvents[playerObjectId]);
|
|
|
|
ScriptMovement_UnfreezeObjectEvents();
|
|
|
|
UnfreezeObjectEvents();
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_message(struct ScriptContext *ctx)
|
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 *msg = (const u8 *)ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
if (msg == NULL)
|
2017-10-12 21:36:26 +02:00
|
|
|
msg = (const u8 *)ctx->data[0];
|
2017-10-12 09:06:19 +02:00
|
|
|
ShowFieldMessage(msg);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-13 05:34:58 +02:00
|
|
|
bool8 ScrCmd_pokenavcall(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 *msg = (const u8 *)ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
if (msg == NULL)
|
2017-10-12 21:36:26 +02:00
|
|
|
msg = (const u8 *)ctx->data[0];
|
2020-06-04 00:25:16 +02:00
|
|
|
ShowPokenavFieldMessage(msg);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_messageautoscroll(struct ScriptContext *ctx)
|
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 *msg = (const u8 *)ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
if (msg == NULL)
|
2017-10-12 21:36:26 +02:00
|
|
|
msg = (const u8 *)ctx->data[0];
|
2018-11-06 18:30:21 +01:00
|
|
|
gTextFlags.autoScroll = TRUE;
|
|
|
|
gTextFlags.forceMidTextSpeed = TRUE;
|
2017-10-12 09:06:19 +02:00
|
|
|
ShowFieldAutoScrollMessage(msg);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
// Prints all at once. Skips waiting for player input. Only used by link contests
|
|
|
|
bool8 ScrCmd_messageinstant(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 *msg = (const u8 *)ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
if (msg == NULL)
|
2017-10-12 21:36:26 +02:00
|
|
|
msg = (const u8 *)ctx->data[0];
|
2020-02-07 18:48:47 +01:00
|
|
|
LoadMessageBoxAndBorderGfx();
|
2019-02-22 07:40:11 +01:00
|
|
|
DrawDialogueFrame(0, 1);
|
2021-11-15 16:57:22 +01:00
|
|
|
AddTextPrinterParameterized(0, FONT_NORMAL, msg, 0, 1, 0, NULL);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_waitmessage(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
SetupNativeScript(ctx, IsFieldMessageBoxHidden);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_closemessage(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
HideFieldMessageBox();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool8 WaitForAorBPress(void)
|
|
|
|
{
|
2020-11-03 02:02:39 +01:00
|
|
|
if (JOY_NEW(A_BUTTON))
|
2017-10-12 09:06:19 +02:00
|
|
|
return TRUE;
|
2020-11-03 02:02:39 +01:00
|
|
|
if (JOY_NEW(B_BUTTON))
|
2017-10-12 09:06:19 +02:00
|
|
|
return TRUE;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_waitbuttonpress(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
SetupNativeScript(ctx, WaitForAorBPress);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_yesnobox(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 left = ScriptReadByte(ctx);
|
|
|
|
u8 top = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
if (ScriptMenu_YesNo(left, top) == TRUE)
|
|
|
|
{
|
|
|
|
ScriptContext1_Stop();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_multichoice(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 left = ScriptReadByte(ctx);
|
|
|
|
u8 top = ScriptReadByte(ctx);
|
|
|
|
u8 multichoiceId = ScriptReadByte(ctx);
|
2021-03-31 06:35:56 +02:00
|
|
|
bool8 ignoreBPress = ScriptReadByte(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
if (ScriptMenu_Multichoice(left, top, multichoiceId, ignoreBPress) == TRUE)
|
|
|
|
{
|
|
|
|
ScriptContext1_Stop();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_multichoicedefault(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 left = ScriptReadByte(ctx);
|
|
|
|
u8 top = ScriptReadByte(ctx);
|
|
|
|
u8 multichoiceId = ScriptReadByte(ctx);
|
|
|
|
u8 defaultChoice = ScriptReadByte(ctx);
|
2021-03-31 06:35:56 +02:00
|
|
|
bool8 ignoreBPress = ScriptReadByte(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
if (ScriptMenu_MultichoiceWithDefault(left, top, multichoiceId, ignoreBPress, defaultChoice) == TRUE)
|
|
|
|
{
|
|
|
|
ScriptContext1_Stop();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-13 05:34:58 +02:00
|
|
|
bool8 ScrCmd_drawbox(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
/*u8 left = ScriptReadByte(ctx);
|
|
|
|
u8 top = ScriptReadByte(ctx);
|
|
|
|
u8 right = ScriptReadByte(ctx);
|
|
|
|
u8 bottom = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
MenuDrawTextWindow(left, top, right, bottom);*/
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_multichoicegrid(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 left = ScriptReadByte(ctx);
|
|
|
|
u8 top = ScriptReadByte(ctx);
|
|
|
|
u8 multichoiceId = ScriptReadByte(ctx);
|
|
|
|
u8 numColumns = ScriptReadByte(ctx);
|
2021-03-31 06:35:56 +02:00
|
|
|
bool8 ignoreBPress = ScriptReadByte(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
if (ScriptMenu_MultichoiceGrid(left, top, multichoiceId, ignoreBPress, numColumns) == TRUE)
|
|
|
|
{
|
|
|
|
ScriptContext1_Stop();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-13 05:34:58 +02:00
|
|
|
bool8 ScrCmd_erasebox(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 left = ScriptReadByte(ctx);
|
|
|
|
u8 top = ScriptReadByte(ctx);
|
|
|
|
u8 right = ScriptReadByte(ctx);
|
|
|
|
u8 bottom = ScriptReadByte(ctx);
|
|
|
|
|
2021-03-31 06:35:56 +02:00
|
|
|
// Menu_EraseWindowRect(left, top, right, bottom);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-13 05:34:58 +02:00
|
|
|
bool8 ScrCmd_drawboxtext(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 left = ScriptReadByte(ctx);
|
|
|
|
u8 top = ScriptReadByte(ctx);
|
|
|
|
u8 multichoiceId = ScriptReadByte(ctx);
|
2021-03-31 06:35:56 +02:00
|
|
|
bool8 ignoreBPress = ScriptReadByte(ctx);
|
2017-12-01 21:25:13 +01:00
|
|
|
|
2017-10-12 09:06:19 +02:00
|
|
|
/*if (Multichoice(left, top, multichoiceId, ignoreBPress) == TRUE)
|
|
|
|
{
|
|
|
|
ScriptContext1_Stop();
|
|
|
|
return TRUE;
|
|
|
|
}*/
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_showmonpic(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 species = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u8 x = ScriptReadByte(ctx);
|
|
|
|
u8 y = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
ScriptMenu_ShowPokemonPic(species, x, y);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_hidemonpic(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2021-11-16 16:53:18 +01:00
|
|
|
// The hide function returns a pointer to a function
|
|
|
|
// that returns true once the pic is hidden
|
|
|
|
bool8 (*func)(void) = ScriptMenu_HidePokemonPic();
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
if (func == NULL)
|
|
|
|
return FALSE;
|
|
|
|
SetupNativeScript(ctx, func);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-04-22 02:04:12 +02:00
|
|
|
bool8 ScrCmd_showcontestpainting(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2019-11-10 19:46:39 +01:00
|
|
|
u8 contestWinnerId = ScriptReadByte(ctx);
|
2020-06-17 23:48:20 +02:00
|
|
|
|
2021-04-22 02:04:12 +02:00
|
|
|
// Artist's painting is temporary and already has its data loaded
|
2020-06-17 23:48:20 +02:00
|
|
|
if (contestWinnerId != CONTEST_WINNER_ARTIST)
|
2019-11-10 19:46:39 +01:00
|
|
|
SetContestWinnerForPainting(contestWinnerId);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2021-04-22 02:04:12 +02:00
|
|
|
ShowContestPainting();
|
2017-10-12 09:06:19 +02:00
|
|
|
ScriptContext1_Stop();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-10-14 02:48:09 +02:00
|
|
|
bool8 ScrCmd_braillemessage(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 *ptr = (u8 *)ScriptReadWord(ctx);
|
2018-02-19 01:46:32 +01:00
|
|
|
struct WindowTemplate winTemplate;
|
|
|
|
s32 i;
|
|
|
|
u8 width, height;
|
|
|
|
u8 xWindow, yWindow, xText, yText;
|
|
|
|
u8 temp;
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
// + 6 for the 6 bytes at the start of a braille message (brailleformat macro)
|
|
|
|
// In RS these bytes are used to position the text and window, but
|
|
|
|
// in Emerald they are unused and position is calculated below instead
|
2017-10-14 02:48:09 +02:00
|
|
|
StringExpandPlaceholders(gStringVar4, ptr + 6);
|
2017-12-01 21:25:13 +01:00
|
|
|
|
2021-10-30 22:47:37 +02:00
|
|
|
width = GetStringWidth(FONT_BRAILLE, gStringVar4, -1) / 8u;
|
2017-12-01 21:25:13 +01:00
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
if (width > 28)
|
|
|
|
width = 28;
|
2017-12-01 21:25:13 +01:00
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
for (i = 0, height = 4; gStringVar4[i] != EOS;)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2021-01-26 08:16:26 +01:00
|
|
|
if (gStringVar4[i++] == CHAR_NEWLINE)
|
2017-10-14 02:48:09 +02:00
|
|
|
height += 3;
|
2017-10-12 09:06:19 +02:00
|
|
|
}
|
2017-12-01 21:25:13 +01:00
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
if (height > 18)
|
|
|
|
height = 18;
|
2017-12-01 21:25:13 +01:00
|
|
|
|
2018-02-19 01:46:32 +01:00
|
|
|
temp = width + 2;
|
2021-01-26 08:16:26 +01:00
|
|
|
xWindow = (30 - temp) / 2;
|
2017-12-01 21:25:13 +01:00
|
|
|
|
2018-02-19 01:46:32 +01:00
|
|
|
temp = height + 2;
|
2021-01-26 08:16:26 +01:00
|
|
|
yText = (20 - temp) / 2;
|
2017-12-01 21:25:13 +01:00
|
|
|
|
2018-02-19 01:46:32 +01:00
|
|
|
xText = xWindow;
|
|
|
|
xWindow += 1;
|
|
|
|
|
|
|
|
yWindow = yText;
|
|
|
|
yText += 2;
|
|
|
|
|
|
|
|
xText = (xWindow - xText - 1) * 8 + 3;
|
|
|
|
yText = (yText - yWindow - 1) * 8;
|
|
|
|
|
2018-08-09 08:53:21 +02:00
|
|
|
winTemplate = CreateWindowTemplate(0, xWindow, yWindow + 1, width, height, 0xF, 0x1);
|
2021-11-15 16:57:22 +01:00
|
|
|
sBrailleWindowId = AddWindow(&winTemplate);
|
|
|
|
LoadUserWindowBorderGfx(sBrailleWindowId, 0x214, 0xE0);
|
|
|
|
DrawStdWindowFrame(sBrailleWindowId, 0);
|
|
|
|
PutWindowTilemap(sBrailleWindowId);
|
|
|
|
FillWindowPixelBuffer(sBrailleWindowId, PIXEL_FILL(1));
|
|
|
|
AddTextPrinterParameterized(sBrailleWindowId, FONT_BRAILLE, gStringVar4, xText, yText, TEXT_SKIP_DRAW, NULL);
|
|
|
|
CopyWindowToVram(sBrailleWindowId, COPYWIN_FULL);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-10-31 22:00:37 +01:00
|
|
|
bool8 ScrCmd_closebraillemessage(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2019-10-31 22:00:37 +01:00
|
|
|
CloseBrailleWindow();
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_vmessage(struct ScriptContext *ctx)
|
|
|
|
{
|
2021-01-26 08:16:26 +01:00
|
|
|
u32 msg = ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
ShowFieldMessage((u8 *)(msg - sAddressOffset));
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_bufferspeciesname(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 stringVarIndex = ScriptReadByte(ctx);
|
|
|
|
u16 species = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
StringCopy(sScriptStringVars[stringVarIndex], gSpeciesNames[species]);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_bufferleadmonspeciesname(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_bufferpartymonnick(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 stringVarIndex = ScriptReadByte(ctx);
|
|
|
|
u16 partyIndex = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
GetMonData(&gPlayerParty[partyIndex], MON_DATA_NICKNAME, sScriptStringVars[stringVarIndex]);
|
2021-11-18 04:11:03 +01:00
|
|
|
StringGet_Nickname(sScriptStringVars[stringVarIndex]);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_bufferitemname(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 stringVarIndex = ScriptReadByte(ctx);
|
|
|
|
u16 itemId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
CopyItemName(itemId, sScriptStringVars[stringVarIndex]);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_bufferitemnameplural(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 stringVarIndex = ScriptReadByte(ctx);
|
|
|
|
u16 itemId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 quantity = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
CopyItemNameHandlePlural(itemId, sScriptStringVars[stringVarIndex], quantity);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_bufferdecorationname(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 stringVarIndex = ScriptReadByte(ctx);
|
|
|
|
u16 decorId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
StringCopy(sScriptStringVars[stringVarIndex], gDecorations[decorId].name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_buffermovename(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 stringVarIndex = ScriptReadByte(ctx);
|
|
|
|
u16 moveId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
StringCopy(sScriptStringVars[stringVarIndex], gMoveNames[moveId]);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_buffernumberstring(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 stringVarIndex = ScriptReadByte(ctx);
|
2019-09-30 21:43:44 +02:00
|
|
|
u16 num = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u8 numDigits = CountDigits(num);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2019-09-30 21:43:44 +02:00
|
|
|
ConvertIntToDecimalStringN(sScriptStringVars[stringVarIndex], num, STR_CONV_MODE_LEFT_ALIGN, numDigits);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_bufferstdstring(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 stringVarIndex = ScriptReadByte(ctx);
|
|
|
|
u16 index = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2019-09-19 00:57:25 +02:00
|
|
|
StringCopy(sScriptStringVars[stringVarIndex], gStdStrings[index]);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-11-17 23:15:45 +01:00
|
|
|
bool8 ScrCmd_buffercontestname(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 stringVarIndex = ScriptReadByte(ctx);
|
2021-11-17 23:15:45 +01:00
|
|
|
u16 category = VarGet(ScriptReadHalfword(ctx));
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2021-11-17 23:15:45 +01:00
|
|
|
BufferContestName(sScriptStringVars[stringVarIndex], category);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_bufferstring(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 stringVarIndex = ScriptReadByte(ctx);
|
2017-10-12 21:36:26 +02:00
|
|
|
const u8 *text = (u8 *)ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
StringCopy(sScriptStringVars[stringVarIndex], text);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-11-18 06:32:28 +01:00
|
|
|
bool8 ScrCmd_vbuffermessage(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2021-01-26 08:16:26 +01:00
|
|
|
const u8 *ptr = (u8 *)(ScriptReadWord(ctx) - sAddressOffset);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
StringExpandPlaceholders(gStringVar4, ptr);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_vbufferstring(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 stringVarIndex = ScriptReadByte(ctx);
|
|
|
|
u32 addr = ScriptReadWord(ctx);
|
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
const u8 *src = (u8 *)(addr - sAddressOffset);
|
2017-10-12 09:06:19 +02:00
|
|
|
u8 *dest = sScriptStringVars[stringVarIndex];
|
|
|
|
StringCopy(dest, src);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_bufferboxname(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 stringVarIndex = ScriptReadByte(ctx);
|
|
|
|
u16 boxId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
StringCopy(sScriptStringVars[stringVarIndex], GetBoxNamePtr(boxId));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_givemon(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = ScriptGiveMon(species, level, item, unkParam1, unkParam2, unkParam3);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_giveegg(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 species = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = ScriptGiveEgg(species);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_setmonmove(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 partyIndex = ScriptReadByte(ctx);
|
|
|
|
u8 slot = ScriptReadByte(ctx);
|
|
|
|
u16 move = ScriptReadHalfword(ctx);
|
|
|
|
|
|
|
|
ScriptSetMonMoveSlot(partyIndex, move, slot);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_checkpartymove(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
u16 moveId = ScriptReadHalfword(ctx);
|
|
|
|
|
2018-11-18 20:00:36 +01:00
|
|
|
gSpecialVar_Result = PARTY_SIZE;
|
|
|
|
for (i = 0; i < PARTY_SIZE; i++)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL);
|
|
|
|
if (!species)
|
|
|
|
break;
|
2018-12-24 21:59:05 +01:00
|
|
|
if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG) && MonKnowsMove(&gPlayerParty[i], moveId) == TRUE)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = i;
|
2017-10-12 09:06:19 +02:00
|
|
|
gSpecialVar_0x8004 = species;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-01-13 05:24:52 +01:00
|
|
|
bool8 ScrCmd_addmoney(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u32 amount = ScriptReadWord(ctx);
|
|
|
|
u8 ignore = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
if (!ignore)
|
|
|
|
AddMoney(&gSaveBlock1Ptr->money, amount);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-01-13 05:24:52 +01:00
|
|
|
bool8 ScrCmd_removemoney(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u32 amount = ScriptReadWord(ctx);
|
|
|
|
u8 ignore = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
if (!ignore)
|
|
|
|
RemoveMoney(&gSaveBlock1Ptr->money, amount);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_checkmoney(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u32 amount = ScriptReadWord(ctx);
|
|
|
|
u8 ignore = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
if (!ignore)
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = IsEnoughMoney(&gSaveBlock1Ptr->money, amount);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_showmoneybox(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 x = ScriptReadByte(ctx);
|
|
|
|
u8 y = ScriptReadByte(ctx);
|
|
|
|
u8 ignore = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
if (!ignore)
|
|
|
|
DrawMoneyBox(GetMoney(&gSaveBlock1Ptr->money), x, y);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_hidemoneybox(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
/*u8 x = ScriptReadByte(ctx);
|
|
|
|
u8 y = ScriptReadByte(ctx);*/
|
2017-12-01 21:25:13 +01:00
|
|
|
|
2017-10-12 09:06:19 +02:00
|
|
|
HideMoneyBox();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_updatemoneybox(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 x = ScriptReadByte(ctx);
|
|
|
|
u8 y = ScriptReadByte(ctx);
|
|
|
|
u8 ignore = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
if (!ignore)
|
|
|
|
ChangeAmountInMoneyBox(GetMoney(&gSaveBlock1Ptr->money));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_showcoinsbox(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 x = ScriptReadByte(ctx);
|
|
|
|
u8 y = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
ShowCoinsWindow(GetCoins(), x, y);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_hidecoinsbox(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 x = ScriptReadByte(ctx);
|
|
|
|
u8 y = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
HideCoinsWindow();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_updatecoinsbox(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u8 x = ScriptReadByte(ctx);
|
|
|
|
u8 y = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
PrintCoinsString(GetCoins());
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_trainerbattle(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
ctx->scriptPtr = BattleSetup_ConfigureTrainerBattle(ctx->scriptPtr);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_dotrainerbattle(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
BattleSetup_StartTrainerBattle();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-12-17 20:38:01 +01:00
|
|
|
bool8 ScrCmd_gotopostbattlescript(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
ctx->scriptPtr = BattleSetup_GetScriptAddrAfterBattle();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-12-17 20:38:01 +01:00
|
|
|
bool8 ScrCmd_gotobeatenscript(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
ctx->scriptPtr = BattleSetup_GetTrainerPostBattleScript();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_checktrainerflag(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 index = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2017-12-01 21:25:13 +01:00
|
|
|
ctx->comparisonResult = HasTrainerBeenFought(index);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_settrainerflag(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 index = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2017-12-01 21:25:13 +01:00
|
|
|
SetTrainerFlag(index);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_cleartrainerflag(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 index = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2017-12-01 21:25:13 +01:00
|
|
|
ClearTrainerFlag(index);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setwildbattle(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 species = ScriptReadHalfword(ctx);
|
|
|
|
u8 level = ScriptReadByte(ctx);
|
|
|
|
u16 item = ScriptReadHalfword(ctx);
|
2020-11-17 09:13:00 +01:00
|
|
|
u16 species2 = ScriptReadHalfword(ctx);
|
|
|
|
u8 level2 = ScriptReadByte(ctx);
|
|
|
|
u16 item2 = ScriptReadHalfword(ctx);
|
|
|
|
|
|
|
|
if(species2 == SPECIES_NONE)
|
|
|
|
{
|
|
|
|
CreateScriptedWildMon(species, level, item);
|
|
|
|
gIsScriptedWildDouble = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CreateScriptedDoubleWildMon(species, level, item, species2, level2, item2);
|
|
|
|
gIsScriptedWildDouble = TRUE;
|
|
|
|
}
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_dowildbattle(struct ScriptContext *ctx)
|
|
|
|
{
|
2020-11-17 09:13:00 +01:00
|
|
|
if(gIsScriptedWildDouble == FALSE)
|
|
|
|
{
|
|
|
|
BattleSetup_StartScriptedWildBattle();
|
|
|
|
ScriptContext1_Stop();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
BattleSetup_StartScriptedDoubleWildBattle();
|
|
|
|
ScriptContext1_Stop();
|
|
|
|
}
|
|
|
|
|
2017-10-12 09:06:19 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_pokemart(struct ScriptContext *ctx)
|
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const void *ptr = (void *)ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
CreatePokemartMenu(ptr);
|
|
|
|
ScriptContext1_Stop();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_pokemartdecoration(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const void *ptr = (void *)ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
CreateDecorationShop1Menu(ptr);
|
|
|
|
ScriptContext1_Stop();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
// Changes clerk dialogue slightly from above. See MART_TYPE_DECOR2
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_pokemartdecoration2(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2017-10-12 21:36:26 +02:00
|
|
|
const void *ptr = (void *)ScriptReadWord(ctx);
|
2017-10-12 09:06:19 +02:00
|
|
|
|
|
|
|
CreateDecorationShop2Menu(ptr);
|
|
|
|
ScriptContext1_Stop();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_playslotmachine(struct ScriptContext *ctx)
|
|
|
|
{
|
2022-02-02 04:30:50 +01:00
|
|
|
u8 machineId = VarGet(ScriptReadHalfword(ctx));
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2022-02-02 04:30:50 +01:00
|
|
|
PlaySlotMachine(machineId, CB2_ReturnToFieldContinueScriptPlayMapMusic);
|
2017-10-12 09:06:19 +02:00
|
|
|
ScriptContext1_Stop();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_setberrytree(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 treeId = ScriptReadByte(ctx);
|
|
|
|
u8 berry = ScriptReadByte(ctx);
|
|
|
|
u8 growthStage = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
if (berry == 0)
|
2021-11-15 16:57:22 +01:00
|
|
|
PlantBerryTree(treeId, berry, growthStage, FALSE);
|
2017-10-12 09:06:19 +02:00
|
|
|
else
|
|
|
|
PlantBerryTree(treeId, berry, growthStage, FALSE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-11-16 19:55:02 +01:00
|
|
|
bool8 ScrCmd_getpokenewsactive(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2019-10-07 08:00:16 +02:00
|
|
|
u16 newsKind = VarGet(ScriptReadHalfword(ctx));
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2021-11-16 19:55:02 +01:00
|
|
|
gSpecialVar_Result = IsPokeNewsActive(newsKind);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-12-21 20:47:52 +01:00
|
|
|
bool8 ScrCmd_choosecontestmon(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2019-10-18 01:22:03 +02:00
|
|
|
ChooseContestMon();
|
2017-10-12 09:06:19 +02:00
|
|
|
ScriptContext1_Stop();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool8 ScrCmd_startcontest(struct ScriptContext *ctx)
|
|
|
|
{
|
2019-11-11 03:54:00 +01:00
|
|
|
StartContest();
|
2017-10-12 09:06:19 +02:00
|
|
|
ScriptContext1_Stop();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_showcontestresults(struct ScriptContext *ctx)
|
|
|
|
{
|
2020-06-17 23:48:20 +02:00
|
|
|
ShowContestResults();
|
2017-10-12 09:06:19 +02:00
|
|
|
ScriptContext1_Stop();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_contestlinktransfer(struct ScriptContext *ctx)
|
|
|
|
{
|
2020-06-17 23:48:20 +02:00
|
|
|
ContestLinkTransfer(gSpecialVar_ContestCategory);
|
2017-10-12 09:06:19 +02:00
|
|
|
ScriptContext1_Stop();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_dofieldeffect(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 effectId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
sFieldEffectScriptId = effectId;
|
|
|
|
FieldEffectStart(sFieldEffectScriptId);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-11-16 23:12:16 +01:00
|
|
|
bool8 ScrCmd_setfieldeffectargument(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 argNum = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
gFieldEffectArguments[argNum] = (s16)VarGet(ScriptReadHalfword(ctx));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool8 WaitForFieldEffectFinish(void)
|
|
|
|
{
|
|
|
|
if (!FieldEffectActiveListContains(sFieldEffectScriptId))
|
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_waitfieldeffect(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
sFieldEffectScriptId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
SetupNativeScript(ctx, WaitForFieldEffectFinish);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_setrespawn(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 healLocationId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2018-12-27 23:30:47 +01:00
|
|
|
SetLastHealLocationWarp(healLocationId);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_checkplayergender(struct ScriptContext *ctx)
|
|
|
|
{
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = gSaveBlock2Ptr->playerGender;
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_playmoncry(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 species = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 mode = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2021-11-07 19:54:44 +01:00
|
|
|
PlayCry_Script(species, mode);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_waitmoncry(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
SetupNativeScript(ctx, IsCryFinished);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_setmetatile(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 tileId = VarGet(ScriptReadHalfword(ctx));
|
2019-02-22 09:08:48 +01:00
|
|
|
u16 isImpassable = VarGet(ScriptReadHalfword(ctx));
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2021-10-09 18:12:18 +02:00
|
|
|
x += MAP_OFFSET;
|
|
|
|
y += MAP_OFFSET;
|
2019-02-22 09:08:48 +01:00
|
|
|
if (!isImpassable)
|
2017-10-12 09:06:19 +02:00
|
|
|
MapGridSetMetatileIdAt(x, y, tileId);
|
|
|
|
else
|
2022-01-19 16:15:32 +01:00
|
|
|
MapGridSetMetatileIdAt(x, y, tileId | MAPGRID_COLLISION_MASK);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_opendoor(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2021-10-09 18:12:18 +02:00
|
|
|
x += MAP_OFFSET;
|
|
|
|
y += MAP_OFFSET;
|
2017-10-12 09:06:19 +02:00
|
|
|
PlaySE(GetDoorSoundEffect(x, y));
|
|
|
|
FieldAnimateDoorOpen(x, y);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_closedoor(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2021-10-09 18:12:18 +02:00
|
|
|
x += MAP_OFFSET;
|
|
|
|
y += MAP_OFFSET;
|
2017-10-12 09:06:19 +02:00
|
|
|
FieldAnimateDoorClose(x, y);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool8 IsDoorAnimationStopped(void)
|
|
|
|
{
|
|
|
|
if (!FieldIsDoorAnimationRunning())
|
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_waitdooranim(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
SetupNativeScript(ctx, IsDoorAnimationStopped);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setdooropen(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2021-10-09 18:12:18 +02:00
|
|
|
x += MAP_OFFSET;
|
|
|
|
y += MAP_OFFSET;
|
2017-10-12 09:06:19 +02:00
|
|
|
FieldSetDoorOpened(x, y);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_setdoorclosed(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2021-10-09 18:12:18 +02:00
|
|
|
x += MAP_OFFSET;
|
|
|
|
y += MAP_OFFSET;
|
2017-10-12 09:06:19 +02:00
|
|
|
FieldSetDoorClosed(x, y);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
// Below two are functions for elevators in RS, do nothing in Emerald
|
2017-10-13 05:34:58 +02:00
|
|
|
bool8 ScrCmd_addelevmenuitem(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2017-10-13 05:34:58 +02:00
|
|
|
bool8 ScrCmd_showelevmenu(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
/*ScriptShowElevatorMenu();
|
|
|
|
ScriptContext1_Stop();
|
|
|
|
return TRUE;*/
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool8 ScrCmd_checkcoins(struct ScriptContext *ctx)
|
|
|
|
{
|
|
|
|
u16 *ptr = GetVarPointer(ScriptReadHalfword(ctx));
|
|
|
|
*ptr = GetCoins();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-01-13 05:24:52 +01:00
|
|
|
bool8 ScrCmd_addcoins(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 coins = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2020-01-13 05:24:52 +01:00
|
|
|
if (AddCoins(coins) == TRUE)
|
2021-01-26 08:16:26 +01:00
|
|
|
gSpecialVar_Result = FALSE;
|
2017-10-12 09:06:19 +02:00
|
|
|
else
|
2021-01-26 08:16:26 +01:00
|
|
|
gSpecialVar_Result = TRUE;
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2020-01-13 05:24:52 +01:00
|
|
|
bool8 ScrCmd_removecoins(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 coins = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2020-01-13 05:24:52 +01:00
|
|
|
if (RemoveCoins(coins) == TRUE)
|
2021-01-26 08:16:26 +01:00
|
|
|
gSpecialVar_Result = FALSE;
|
2017-10-12 09:06:19 +02:00
|
|
|
else
|
2021-01-26 08:16:26 +01:00
|
|
|
gSpecialVar_Result = TRUE;
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-10-16 10:09:30 +02:00
|
|
|
bool8 ScrCmd_moverotatingtileobjects(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2019-10-15 11:00:08 +02:00
|
|
|
u16 puzzleNumber = VarGet(ScriptReadHalfword(ctx));
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2019-10-16 10:09:30 +02:00
|
|
|
sMovingNpcId = MoveRotatingTileObjects(puzzleNumber);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-10-16 10:09:30 +02:00
|
|
|
bool8 ScrCmd_turnrotatingtileobjects(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2019-10-16 10:09:30 +02:00
|
|
|
TurnRotatingTileObjects();
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-10-15 11:00:08 +02:00
|
|
|
bool8 ScrCmd_initrotatingtilepuzzle(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2019-10-15 11:00:08 +02:00
|
|
|
u16 isTrickHouse = VarGet(ScriptReadHalfword(ctx));
|
2017-10-12 09:06:19 +02:00
|
|
|
|
2019-10-15 11:00:08 +02:00
|
|
|
InitRotatingTilePuzzle(isTrickHouse);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-10-16 10:09:30 +02:00
|
|
|
bool8 ScrCmd_freerotatingtilepuzzle(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2019-10-16 10:09:30 +02:00
|
|
|
FreeRotatingTilePuzzle();
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
bool8 ScrCmd_selectapproachingtrainer(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2019-11-21 04:55:44 +01:00
|
|
|
gSelectedObjectEvent = GetCurrentApproachingTrainerObjectEventId();
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-01-26 10:41:13 +01:00
|
|
|
bool8 ScrCmd_lockfortrainer(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2021-11-01 23:06:15 +01:00
|
|
|
if (IsOverworldLinkActive())
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-11-21 04:55:44 +01:00
|
|
|
if (gObjectEvents[gSelectedObjectEvent].active)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2021-01-26 10:41:13 +01:00
|
|
|
FreezeForApproachingTrainers();
|
|
|
|
SetupNativeScript(ctx, IsFreezeObjectAndPlayerFinished);
|
2017-10-12 09:06:19 +02:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-15 20:54:35 +01:00
|
|
|
// This command will set a Pokémon's eventLegal bit; there is no similar command to clear it.
|
|
|
|
bool8 ScrCmd_setmoneventlegal(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2021-02-15 20:54:35 +01:00
|
|
|
bool8 isEventLegal = TRUE;
|
2017-10-12 09:06:19 +02:00
|
|
|
u16 partyIndex = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2021-02-15 20:54:35 +01:00
|
|
|
SetMonData(&gPlayerParty[partyIndex], MON_DATA_EVENT_LEGAL, &isEventLegal);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-02-15 20:54:35 +01:00
|
|
|
bool8 ScrCmd_checkmoneventlegal(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 partyIndex = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2021-02-15 20:54:35 +01:00
|
|
|
gSpecialVar_Result = GetMonData(&gPlayerParty[partyIndex], MON_DATA_EVENT_LEGAL, NULL);
|
2017-10-12 09:06:19 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-11-18 06:32:28 +01:00
|
|
|
bool8 ScrCmd_trywondercardscript(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2021-01-26 08:16:26 +01:00
|
|
|
const u8* script = GetSavedRamScriptIfValid();
|
2017-12-01 21:25:13 +01:00
|
|
|
|
2021-01-26 08:16:26 +01:00
|
|
|
if (script)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2021-01-26 08:16:26 +01:00
|
|
|
gRamScriptRetAddr = ctx->scriptPtr;
|
|
|
|
ScriptJump(ctx, script);
|
2017-10-12 09:06:19 +02:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-11-15 18:04:54 +01:00
|
|
|
// This warp is only used by the Union Room.
|
2021-01-01 21:34:21 +01:00
|
|
|
// For the warp used by the Aqua Hideout, see DoTeleportTileWarp
|
|
|
|
bool8 ScrCmd_warpspinenter(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
u8 warpId = ScriptReadByte(ctx);
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
2018-12-27 23:30:47 +01:00
|
|
|
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
2021-01-01 21:34:21 +01:00
|
|
|
SetSpinStartFacingDir(GetPlayerFacingDirection());
|
|
|
|
DoSpinEnterWarp();
|
2018-09-05 00:31:37 +02:00
|
|
|
ResetInitialPlayerAvatarState();
|
2017-10-12 09:06:19 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_setmonmetlocation(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u16 partyIndex = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u8 location = ScriptReadByte(ctx);
|
|
|
|
|
|
|
|
if (partyIndex < PARTY_SIZE)
|
|
|
|
SetMonData(&gPlayerParty[partyIndex], MON_DATA_MET_LOCATION, &location);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-10-31 22:00:37 +01:00
|
|
|
static void CloseBrailleWindow(void)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
2021-11-15 16:57:22 +01:00
|
|
|
ClearStdWindowAndFrame(sBrailleWindowId, 1);
|
|
|
|
RemoveWindow(sBrailleWindowId);
|
2017-10-12 09:06:19 +02:00
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_buffertrainerclassname(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 stringVarIndex = ScriptReadByte(ctx);
|
|
|
|
u16 trainerClassId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
StringCopy(sScriptStringVars[stringVarIndex], GetTrainerClassNameFromId(trainerClassId));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-23 07:34:55 +02:00
|
|
|
bool8 ScrCmd_buffertrainername(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 stringVarIndex = ScriptReadByte(ctx);
|
|
|
|
u16 trainerClassId = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
|
|
|
|
StringCopy(sScriptStringVars[stringVarIndex], GetTrainerNameFromId(trainerClassId));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-11-01 08:41:55 +01:00
|
|
|
void SetMovingNpcId(u16 npcId)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
sMovingNpcId = npcId;
|
|
|
|
}
|
2017-10-01 03:19:29 +02:00
|
|
|
|
2021-11-18 06:32:28 +01:00
|
|
|
bool8 ScrCmd_warpwhitefade(struct ScriptContext *ctx)
|
2017-10-12 09:06:19 +02:00
|
|
|
{
|
|
|
|
u8 mapGroup = ScriptReadByte(ctx);
|
|
|
|
u8 mapNum = ScriptReadByte(ctx);
|
|
|
|
u8 warpId = ScriptReadByte(ctx);
|
|
|
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
|
|
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
2017-10-01 03:19:29 +02:00
|
|
|
|
2018-12-27 23:30:47 +01:00
|
|
|
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
2021-11-18 06:32:28 +01:00
|
|
|
DoWhiteFadeWarp();
|
2018-09-05 00:31:37 +02:00
|
|
|
ResetInitialPlayerAvatarState();
|
2017-10-12 09:06:19 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|