diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/scrcmd.c | 779 |
1 files changed, 770 insertions, 9 deletions
diff --git a/src/scrcmd.c b/src/scrcmd.c index 946a2f1c2..c6da1b33e 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -5,6 +5,8 @@ #include "rtc.h" #include "pokemon.h" #include "fieldmap.h" +#include "main.h" +#include "decoration.h" extern void killram(void); extern u16 *GetVarPointer(u16); @@ -87,11 +89,11 @@ extern bool8 box_related_two__2(u8 *); extern bool8 box_related_two__3(u8 *); extern bool8 sub_8064C84(void); extern bool8 yes_no_box(u8, u8); -extern bool8 sub_80B5054(u8, u8, u8); -extern bool8 sub_80B50B0(u8, u8, u8); +extern bool8 sub_80B5054(u8, u8, u8, u8); +extern bool8 sub_80B50B0(u8, u8, u8, u8, u8); extern bool8 sub_80B5578(u8, u8, u8, u8, u8); -extern bool8 Multichoice(u8, u8, u8); -extern bool8 sub_80B58C4(u8, u8, u8); +extern bool8 Multichoice(u8, u8, u8, u8); +extern bool8 sub_80B58C4(u16, u8, u8); extern void *picbox_close(void); extern void sub_8106630(u32); extern void sub_80C4F10(void); @@ -103,14 +105,14 @@ extern sub_80B79E0(u32 *, u32); extern bool8 IsEnoughMoney(u32, u32); extern void sub_80B7C14(u32, u8, u8); extern void RemoveMoneyLabelObject(u8, u8); -extern void sub_80B7BEC(u8, u8, u8); +extern void sub_80B7BEC(u32, u8, u8); extern void sub_811A72C(u32, u8, u8); extern void sub_811A770(u8, u8); extern void sub_811A704(u32, u8, u8); extern void *sub_80823C8(u8 *); extern void sub_80825E4(void); -extern void *sub_80826E8(void); -extern void *sub_8082700(void); +extern u8 *sub_80826E8(void); +extern u8 *sub_8082700(void); extern u8 trainer_flag_check(u16); extern void trainer_flag_set(u16); extern void trainer_flag_clear(u16); @@ -119,7 +121,7 @@ extern void sub_8081B3C(void); extern void CreatePokemartMenu(void *); extern void CreateDecorationShop1Menu(void *); extern void CreateDecorationShop2Menu(void *); -extern void sub_81018A0(u8); +extern void sub_81018A0(u8, void *); extern void PlantBerryTree(u8, u8, u8, u8); extern bool8 GetPriceReduction(u8); extern void sub_80F99CC(void); @@ -132,7 +134,7 @@ extern void sub_8053588(u8); extern void sub_8075178(u16, u8); extern bool8 sub_8075374(void); extern void MapGridSetMetatileIdAt(u32, u32, u16); -extern u8 sub_8058790(u32, u32, u32); +extern u16 sub_8058790(u32, u32); extern bool8 task_overworld_door_add_if_role_69_for_opening_door_at(u32, u32); extern bool8 sub_805870C(u32, u32); extern bool8 sub_805877C(void); @@ -142,26 +144,48 @@ extern void sub_810E7AC(u8, u8, u8, u8); extern void sub_810E824(void); extern u16 GetCoins(void); extern bool8 sub_811A840(u16); +extern bool8 sub_811A898(u16); +extern u8 sub_80C5374(u16, u8, u16, u32, u32, u8); +extern u8 sub_80C53F8(u16); +extern void sub_80C5530(u8, u16, u8); +extern bool8 pokemon_has_move(struct Pokemon *, u16); +extern void c2_exit_to_overworld_1_continue_scripts_restart_music(void); typedef u16 (*SpecialFunc)(void); typedef void (*NativeFunc)(void); +extern struct Pokemon gPlayerParty[6]; // 0x3004360 +extern struct Pokemon gEnemyParty[6]; // 0x30045C0 + extern u32 gUnknown_0202E8AC; extern u32 gUnknown_0202E8B0; extern u16 gUnknown_0202E8B4; extern u16 gUnknown_0202E8B6; extern u16 gUnknown_0202E8B8; extern u16 gUnknown_0202E8BA; +extern u16 gUnknown_0202E8BC; extern u16 gUnknown_0202E8C4; extern u16 gUnknown_0202E8C6; extern u16 gUnknown_0202E8C8; +extern u16 gUnknown_0202E8CC; extern u16 gScriptResult; +extern u32 gUnknown_0202FF84[]; + +extern u16 gUnknown_0203869C; + extern SpecialFunc gSpecials[]; extern u8 *gStdScripts[]; extern u8 *gStdScripts_End[]; + +extern u8 gSpeciesNames[][11]; +extern u8 gMoveNames[][13]; + extern u8 gUnknown_083762DC[6][3]; +extern u8 * const gUnknown_083762F0[]; +extern u8 * const gUnknown_083CE048[]; +extern struct Decoration gDecorations[]; bool8 ScrCmd_snop(struct ScriptContext *ctx) { @@ -1224,3 +1248,740 @@ bool8 ScrCmd_release(struct ScriptContext *ctx) sub_806451C(); return FALSE; } + +bool8 ScrCmd_message(struct ScriptContext *ctx) +{ + u8 *msg = (u8 *)script_read_word(ctx); + if (!msg) + msg = (u8 *)ctx->data[0]; + box_related_two__2(msg); + return FALSE; +} + +bool8 ScrCmd_message2(struct ScriptContext *ctx) +{ + u8 *msg = (u8 *)script_read_word(ctx); + if (!msg) + msg = (u8 *)ctx->data[0]; + box_related_two__3(msg); + return FALSE; +} + +bool8 ScrCmd_waittext(struct ScriptContext *ctx) +{ + script_setup_asm_script(ctx, sub_8064C84); + return TRUE; +} + +bool8 ScrCmd_closebutton(struct ScriptContext *ctx) +{ + textbox_close(); + return FALSE; +} + +bool8 sub_80670C0() +{ + if (gMain.newKeys & A_BUTTON) + return TRUE; + if (gMain.newKeys & B_BUTTON) + return TRUE; + return FALSE; +} + +bool8 ScrCmd_waitbutton(struct ScriptContext *ctx) +{ + script_setup_asm_script(ctx, sub_80670C0); + return TRUE; +} + +bool8 ScrCmd_yesnobox(struct ScriptContext *ctx) +{ + u8 v1 = *(ctx->scriptPtr++); + u8 v2 = *(ctx->scriptPtr++); + if (yes_no_box(v1, v2) == 1) + { + sub_80655F0(); + return TRUE; + } + else + { + return FALSE; + } +} + +bool8 ScrCmd_multichoice(struct ScriptContext *ctx) +{ + u8 v1 = *(ctx->scriptPtr++); + u8 v2 = *(ctx->scriptPtr++); + u8 v3 = *(ctx->scriptPtr++); + u8 v4 = *(ctx->scriptPtr++); + if (sub_80B5054(v1, v2, v3, v4) == 1) + { + sub_80655F0(); + return TRUE; + } + else + { + return FALSE; + } +} + +bool8 ScrCmd_multichoicedef(struct ScriptContext *ctx) +{ + u8 v1 = *(ctx->scriptPtr++); + u8 v2 = *(ctx->scriptPtr++); + u8 v3 = *(ctx->scriptPtr++); + u8 v4 = *(ctx->scriptPtr++); + u8 v5 = *(ctx->scriptPtr++); + if (sub_80B50B0(v1, v2, v3, v5, v4) == 1) + { + sub_80655F0(); + return TRUE; + } + else + { + return FALSE; + } +} + +bool8 ScrCmd_showbox(struct ScriptContext *ctx) +{ + u8 v1 = *(ctx->scriptPtr++); + u8 v2 = *(ctx->scriptPtr++); + u8 v3 = *(ctx->scriptPtr++); + u8 v4 = *(ctx->scriptPtr++); + MenuDrawTextWindow(v1, v2, v3, v4); + return FALSE; +} + +bool8 ScrCmd_multichoicerow(struct ScriptContext *ctx) +{ + u8 v1 = *(ctx->scriptPtr++); + u8 v2 = *(ctx->scriptPtr++); + u8 v3 = *(ctx->scriptPtr++); + u8 v4 = *(ctx->scriptPtr++); + u8 v5 = *(ctx->scriptPtr++); + if (sub_80B5578(v1, v2, v3, v5, v4) == 1) + { + sub_80655F0(); + return TRUE; + } + else + { + return FALSE; + } +} + +bool8 ScrCmd_hidebox(struct ScriptContext *ctx) +{ + u8 v1 = *(ctx->scriptPtr++); + u8 v2 = *(ctx->scriptPtr++); + u8 v3 = *(ctx->scriptPtr++); + u8 v4 = *(ctx->scriptPtr++); + MenuZeroFillWindowRect(v1, v2, v3, v4); + return FALSE; +} + +bool8 ScrCmd_clearbox(struct ScriptContext *ctx) +{ + u8 v1 = *(ctx->scriptPtr++); + u8 v2 = *(ctx->scriptPtr++); + u8 v3 = *(ctx->scriptPtr++); + u8 v4 = *(ctx->scriptPtr++); + if (Multichoice(v1, v2, v3, v4) == 1) + { + sub_80655F0(); + return TRUE; + } + else + { + return FALSE; + } +} + +bool8 ScrCmd_showpokepic(struct ScriptContext *ctx) +{ + u16 v1 = VarGet(script_read_halfword(ctx)); + u8 v2 = *(ctx->scriptPtr++); + u8 v3 = *(ctx->scriptPtr++); + sub_80B58C4(v1, v2, v3); + return FALSE; +} + +bool8 ScrCmd_hidepokepic(struct ScriptContext *ctx) +{ + void *func = picbox_close(); + if (!func) + return FALSE; + + script_setup_asm_script(ctx, func); + return TRUE; +} + +bool8 ScrCmd_showcontestwinner(struct ScriptContext *ctx) +{ + u8 v1 = *(ctx->scriptPtr++); + if (v1) + sub_8106630(v1); + sub_80C4F10(); + sub_80655F0(); + return TRUE; +} + +bool8 ScrCmd_braillemsg(struct ScriptContext *ctx) +{ + u8 *ptr = (u8 *)script_read_word(ctx); + u8 v2 = ptr[0]; + u8 v3 = ptr[1]; + u8 v4 = ptr[2]; + u8 v5 = ptr[3]; + u8 v6 = ptr[4]; + u8 v7 = ptr[5]; + StringBraille(gStringVar4, ptr + 6); + MenuDrawTextWindow(v2, v3, v4, v5); + MenuPrint(gStringVar4, v6, v7); + return FALSE; +} + +bool8 ScrCmd_vtext(struct ScriptContext *ctx) +{ + u32 v1 = script_read_word(ctx); + box_related_two__2((u8 *)(v1 - gUnknown_0202E8B0)); + return FALSE; +} + +bool8 ScrCmd_bufferpoke(struct ScriptContext *ctx) +{ + u8 stringVarIndex = *(ctx->scriptPtr++); + u16 species = VarGet(script_read_halfword(ctx)); + StringCopy(gUnknown_083762F0[stringVarIndex], &gSpeciesNames[species]); + return FALSE; +} + +bool8 ScrCmd_bufferfirstpoke(struct ScriptContext *ctx) +{ + u8 stringVarIndex = *(ctx->scriptPtr++); + u8 *dest = gUnknown_083762F0[stringVarIndex]; + u8 partyIndex = sub_810F87C(); + u32 species = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPECIES, NULL); + StringCopy(dest, &gSpeciesNames[species]); + return FALSE; +} + +bool8 ScrCmd_bufferpartypoke(struct ScriptContext *ctx) +{ + u8 stringVarIndex = *(ctx->scriptPtr++); + u16 partyIndex = VarGet(script_read_halfword(ctx)); + GetMonData(&gPlayerParty[partyIndex], MON_DATA_NICKNAME, gUnknown_083762F0[stringVarIndex]); + StringGetEnd10(gUnknown_083762F0[stringVarIndex]); + return FALSE; +} + +bool8 ScrCmd_bufferitem(struct ScriptContext *ctx) +{ + u8 stringVarIndex = *(ctx->scriptPtr++); + u16 itemId = VarGet(script_read_halfword(ctx)); + itemid_copy_name(itemId, gUnknown_083762F0[stringVarIndex]); + return FALSE; +} + +bool8 ScrCmd_bufferdecor(struct ScriptContext *ctx) +{ + u8 stringVarIndex = *(ctx->scriptPtr++); + u16 decorId = VarGet(script_read_halfword(ctx)); + StringCopy(gUnknown_083762F0[stringVarIndex], gDecorations[decorId].name); + return FALSE; +} + +bool8 ScrCmd_bufferattack(struct ScriptContext *ctx) +{ + u8 stringVarIndex = *(ctx->scriptPtr++); + u16 moveId = VarGet(script_read_halfword(ctx)); + StringCopy(gUnknown_083762F0[stringVarIndex], &gMoveNames[moveId]); + return FALSE; +} + +bool8 ScrCmd_buffernum(struct ScriptContext *ctx) +{ + u8 stringVarIndex = *(ctx->scriptPtr++); + u16 v1 = VarGet(script_read_halfword(ctx)); + u8 v2 = sub_80BF0B8(v1); + ConvertIntToDecimalStringN(gUnknown_083762F0[stringVarIndex], v1, 0, v2); + return FALSE; +} + +bool8 ScrCmd_bufferstd(struct ScriptContext *ctx) +{ + u8 stringVarIndex = *(ctx->scriptPtr++); + u16 index = VarGet(script_read_halfword(ctx)); + StringCopy(gUnknown_083762F0[stringVarIndex], gUnknown_083CE048[index]); + return FALSE; +} + +bool8 ScrCmd_buffertext(struct ScriptContext *ctx) +{ + u8 stringVarIndex = *(ctx->scriptPtr++); + u8 *text = (u8 *)script_read_word(ctx); + StringCopy(gUnknown_083762F0[stringVarIndex], text); + return FALSE; +} + +bool8 ScrCmd_vloadptr(struct ScriptContext *ctx) +{ + u8 *ptr = (u8 *)(script_read_word(ctx) - gUnknown_0202E8B0); + StringExpandPlaceholders(gStringVar4, ptr); + return FALSE; +} + +bool8 ScrCmd_vbuffer(struct ScriptContext *ctx) +{ + u8 stringVarIndex = *(ctx->scriptPtr++); + u32 addr = script_read_word(ctx); + u8 *src = (u8 *)(addr - gUnknown_0202E8B0); + u8 *dest = gUnknown_083762F0[stringVarIndex]; + StringCopy(dest, src); + return FALSE; +} + +bool8 ScrCmd_givepokemon(struct ScriptContext *ctx) +{ + u16 v3 = VarGet(script_read_halfword(ctx)); + u8 v5 = *(ctx->scriptPtr++); + u16 v7 = VarGet(script_read_halfword(ctx)); + u32 v8 = script_read_word(ctx); + u32 v9 = script_read_word(ctx); + u8 v10 = *(ctx->scriptPtr++); + gScriptResult = sub_80C5374(v3, v5, v7, v8, v9, v10); + return FALSE; +} + +bool8 ScrCmd_giveegg(struct ScriptContext *ctx) +{ + u16 value = VarGet(script_read_halfword(ctx)); + gScriptResult = sub_80C53F8(value); + return FALSE; +} + +bool8 ScrCmd_setpokemove(struct ScriptContext *ctx) +{ + u8 v2 = *(ctx->scriptPtr++); + u8 v3 = *(ctx->scriptPtr++); + u16 v4 = script_read_halfword(ctx); + sub_80C5530(v2, v4, v3); + return FALSE; +} + +bool8 ScrCmd_checkattack(struct ScriptContext *ctx) +{ + u8 i; + u16 moveId = script_read_halfword(ctx); + gScriptResult = 6; + for (i = 0; i < 6; i++) + { + register u8 *dummy asm("r2"); + u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL); + if (!species) + break; + if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG, dummy) && pokemon_has_move(&gPlayerParty[i], moveId) == TRUE) + { + gScriptResult = i; + gUnknown_0202E8CC = species; + break; + } + } + return FALSE; +} + +bool8 ScrCmd_givemoney(struct ScriptContext *ctx) +{ + u32 amount = script_read_word(ctx); + u8 ignore = *(ctx->scriptPtr++); + if (!ignore) + sub_80B79B8(&gSaveBlock1.money, amount); + return FALSE; +} + +bool8 ScrCmd_paymoney(struct ScriptContext *ctx) +{ + u32 amount = script_read_word(ctx); + u8 ignore = *(ctx->scriptPtr++); + if (!ignore) + sub_80B79E0(&gSaveBlock1.money, amount); + return FALSE; +} + +bool8 ScrCmd_checkmoney(struct ScriptContext *ctx) +{ + u32 amount = script_read_word(ctx); + u8 ignore = *(ctx->scriptPtr++); + if (!ignore) + gScriptResult = IsEnoughMoney(gSaveBlock1.money, amount); + return FALSE; +} + +bool8 ScrCmd_showmoney(struct ScriptContext *ctx) +{ + u8 v2 = *(ctx->scriptPtr++); + u8 v3 = *(ctx->scriptPtr++); + u8 ignore = *(ctx->scriptPtr++); + if (!ignore) + sub_80B7C14(gSaveBlock1.money, v2, v3); + return FALSE; +} + +bool8 ScrCmd_hidemoney(struct ScriptContext *ctx) +{ + u8 v2 = *(ctx->scriptPtr++); + u8 v3 = *(ctx->scriptPtr++); + RemoveMoneyLabelObject(v2, v3); + return FALSE; +} + +bool8 ScrCmd_updatemoney(struct ScriptContext *ctx) +{ + u8 v2 = *(ctx->scriptPtr++); + u8 v3 = *(ctx->scriptPtr++); + u8 ignore = *(ctx->scriptPtr++); + if (!ignore) + sub_80B7BEC(gSaveBlock1.money, v2, v3); + return FALSE; +} + +bool8 ScrCmd_showcoins(struct ScriptContext *ctx) +{ + u8 v2 = *(ctx->scriptPtr++); + u8 v3 = *(ctx->scriptPtr++); + sub_811A72C(gSaveBlock1.coins, v2, v3); + return FALSE; +} + +bool8 ScrCmd_hidecoins(struct ScriptContext *ctx) +{ + u8 v2 = *(ctx->scriptPtr++); + u8 v3 = *(ctx->scriptPtr++); + sub_811A770(v2, v3); + return FALSE; +} + +bool8 ScrCmd_updatecoins(struct ScriptContext *ctx) +{ + u8 v2 = *(ctx->scriptPtr++); + u8 v3 = *(ctx->scriptPtr++); + sub_811A704(gSaveBlock1.coins, v2, v3); + return FALSE; +} + +bool8 ScrCmd_trainerbattle(struct ScriptContext *ctx) +{ + ctx->scriptPtr = sub_80823C8(ctx->scriptPtr); + return FALSE; +} + +bool8 ScrCmd_reptrainerbattle(struct ScriptContext *ctx) +{ + sub_80825E4(); + return TRUE; +} + +bool8 ScrCmd_endtrainerbattle(struct ScriptContext *ctx) +{ + ctx->scriptPtr = sub_80826E8(); + return FALSE; +} + +bool8 ScrCmd_endtrainerbattle2(struct ScriptContext *ctx) +{ + ctx->scriptPtr = sub_8082700(); + return FALSE; +} + +bool8 ScrCmd_checktrainerflag(struct ScriptContext *ctx) +{ + u16 index = VarGet(script_read_halfword(ctx)); + ctx->comparisonResult = trainer_flag_check(index); + return FALSE; +} + +bool8 ScrCmd_cleartrainerflag(struct ScriptContext *ctx) +{ + u16 index = VarGet(script_read_halfword(ctx)); + trainer_flag_set(index); + return FALSE; +} + +bool8 ScrCmd_settrainerflag(struct ScriptContext *ctx) +{ + u16 index = VarGet(script_read_halfword(ctx)); + trainer_flag_clear(index); + return FALSE; +} + +bool8 ScrCmd_setwildbattle(struct ScriptContext *ctx) +{ + u16 v2 = script_read_halfword(ctx); + u8 v4 = *(ctx->scriptPtr++); + u16 v5 = script_read_halfword(ctx); + sub_80C54D0(v2, v4, v5); + return FALSE; +} + +bool8 ScrCmd_dowildbattle(struct ScriptContext *ctx) +{ + sub_8081B3C(); + sub_80655F0(); + return TRUE; +} + +bool8 ScrCmd_pokemart(struct ScriptContext *ctx) +{ + void *ptr = (void *)script_read_word(ctx); + CreatePokemartMenu(ptr); + sub_80655F0(); + return TRUE; +} + +bool8 ScrCmd_pokemartdecor(struct ScriptContext *ctx) +{ + void *ptr = (void *)script_read_word(ctx); + CreateDecorationShop1Menu(ptr); + sub_80655F0(); + return TRUE; +} + +bool8 ScrCmd_pokemartbp(struct ScriptContext *ctx) +{ + void *ptr = (void *)script_read_word(ctx); + CreateDecorationShop2Menu(ptr); + sub_80655F0(); + return TRUE; +} + +bool8 ScrCmd_pokecasino(struct ScriptContext *ctx) +{ + u8 v2 = VarGet(script_read_halfword(ctx)); + sub_81018A0(v2, c2_exit_to_overworld_1_continue_scripts_restart_music); + sub_80655F0(); + return TRUE; +} + +bool8 ScrCmd_event_8a(struct ScriptContext *ctx) +{ + u8 v2 = *(ctx->scriptPtr++); + u8 v3 = *(ctx->scriptPtr++); + u8 v4 = *(ctx->scriptPtr++); + if (!v3) + PlantBerryTree(v2, 0, v4, 0); + else + PlantBerryTree(v2, v3, v4, 0); + return FALSE; +} + +bool8 ScrCmd_event_96(struct ScriptContext *ctx) +{ + u16 value = VarGet(script_read_halfword(ctx)); + gScriptResult = GetPriceReduction(value); + return FALSE; +} + +bool8 ScrCmd_choosecontestpkmn(struct ScriptContext *ctx) +{ + sub_80F99CC(); + sub_80655F0(); + return TRUE; +} + +bool8 ScrCmd_startcontest(struct ScriptContext *ctx) +{ + sub_80C48C8(); + sub_80655F0(); + return TRUE; +} + +bool8 ScrCmd_showcontestresults(struct ScriptContext *ctx) +{ + sub_80C4940(); + sub_80655F0(); + return TRUE; +} + +bool8 ScrCmd_contestlinktransfer(struct ScriptContext *ctx) +{ + sub_80C4980(gUnknown_0203869C); + sub_80655F0(); + return TRUE; +} + +bool8 ScrCmd_doanimation(struct ScriptContext *ctx) +{ + u16 effectId = VarGet(script_read_halfword(ctx)); + gUnknown_0202E8BC = effectId; + FieldEffectStart(gUnknown_0202E8BC); + return FALSE; +} + +bool8 ScrCmd_setanimation(struct ScriptContext *ctx) +{ + u8 v2 = *(ctx->scriptPtr++); + gUnknown_0202FF84[v2] = (s16)VarGet(script_read_halfword(ctx)); + return FALSE; +} + +bool8 sub_8067B48() +{ + if (!FieldEffectActiveListContains(gUnknown_0202E8BC)) + return TRUE; + else + return FALSE; +} + +bool8 ScrCmd_checkanimation(struct ScriptContext *ctx) +{ + gUnknown_0202E8BC = VarGet(script_read_halfword(ctx)); + script_setup_asm_script(ctx, sub_8067B48); + return TRUE; +} + +bool8 ScrCmd_sethealplace(struct ScriptContext *ctx) +{ + u16 v2 = VarGet(script_read_halfword(ctx)); + sub_8053588(v2); + return FALSE; +} + +bool8 ScrCmd_checkgender(struct ScriptContext *ctx) +{ + gScriptResult = gSaveBlock2.playerGender; + return FALSE; +} + +bool8 ScrCmd_pokecry(struct ScriptContext *ctx) +{ + u16 v3 = VarGet(script_read_halfword(ctx)); + u16 v5 = VarGet(script_read_halfword(ctx)); + sub_8075178(v3, v5); + return FALSE; +} + +bool8 ScrCmd_waitpokecry(struct ScriptContext *ctx) +{ + script_setup_asm_script(ctx, sub_8075374); + return TRUE; +} + +bool8 ScrCmd_setmaptile(struct ScriptContext *ctx) +{ + u16 v3 = VarGet(script_read_halfword(ctx)); + u16 v5 = VarGet(script_read_halfword(ctx)); + u16 v7 = VarGet(script_read_halfword(ctx)); + u16 v8 = VarGet(script_read_halfword(ctx)); + v3 += 7; + v5 += 7; + if (!v8) + MapGridSetMetatileIdAt(v3, v5, v7); + else + MapGridSetMetatileIdAt(v3, v5, v7 | 0xC00); + return FALSE; +} + +bool8 ScrCmd_setdooropened(struct ScriptContext *ctx) +{ + u16 v3 = VarGet(script_read_halfword(ctx)); + u16 v4 = VarGet(script_read_halfword(ctx)); + u16 v7; + v3 += 7; + v4 += 7; + v7 = sub_8058790(v3, v4); + audio_play(v7); + task_overworld_door_add_if_role_69_for_opening_door_at(v3, v4); + return FALSE; +} + +bool8 ScrCmd_setdoorclosed(struct ScriptContext *ctx) +{ + u16 v3 = VarGet(script_read_halfword(ctx)); + u16 v5 = VarGet(script_read_halfword(ctx)); + v3 += 7; + v5 += 7; + sub_805870C(v3, v5); + return FALSE; +} + +bool8 sub_8067D2C() +{ + if (!sub_805877C()) + return TRUE; + else + return FALSE; +} + +bool8 ScrCmd_doorchange(struct ScriptContext *ctx) +{ + script_setup_asm_script(ctx, sub_8067D2C); + return TRUE; +} + +bool8 ScrCmd_setdooropened2(struct ScriptContext *ctx) +{ + u16 v3 = VarGet(script_read_halfword(ctx)); + u16 v5 = VarGet(script_read_halfword(ctx)); + v3 += 7; + v5 += 7; + sub_80586B4(v3, v5); + return FALSE; +} + +bool8 ScrCmd_setdoorclosed2(struct ScriptContext *ctx) +{ + u16 v3 = VarGet(script_read_halfword(ctx)); + u16 v5 = VarGet(script_read_halfword(ctx)); + v3 += 7; + v5 += 7; + sub_80586E0(v3, v5); + return FALSE; +} + +bool8 ScrCmd_event_b1(struct ScriptContext *ctx) +{ + u8 v3 = *(ctx->scriptPtr++); + u16 v5 = VarGet(script_read_halfword(ctx)); + u16 v7 = VarGet(script_read_halfword(ctx)); + u16 v9 = VarGet(script_read_halfword(ctx)); + sub_810E7AC(v3, v5, v7, v9); + return FALSE; +} + +bool8 ScrCmd_event_b2(struct ScriptContext *ctx) +{ + sub_810E824(); + sub_80655F0(); + return TRUE; +} + +bool8 ScrCmd_checkcoins(struct ScriptContext *ctx) +{ + u16 *ptr = GetVarPointer(script_read_halfword(ctx)); + *ptr = GetCoins(); + return FALSE; +} + +bool8 ScrCmd_givecoins(struct ScriptContext *ctx) +{ + u16 v2 = VarGet(script_read_halfword(ctx)); + if (sub_811A840(v2) == TRUE) + gScriptResult = 0; + else + gScriptResult = 1; + + return FALSE; +} + +bool8 ScrCmd_removecoins(struct ScriptContext *ctx) +{ + u16 v2 = VarGet(script_read_halfword(ctx)); + if (sub_811A898(v2) == TRUE) + gScriptResult = 0; + else + gScriptResult = 1; + + return FALSE; +} |