diff options
Diffstat (limited to 'src/scrcmd.c')
-rw-r--r-- | src/scrcmd.c | 91 |
1 files changed, 44 insertions, 47 deletions
diff --git a/src/scrcmd.c b/src/scrcmd.c index d25ce88e0..9d6f36a54 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -11,10 +11,10 @@ #include "field_message_box.h" #include "sound.h" #include "string_util.h" +#include "flag.h" +#include "var.h" extern void ClearRamScript(void); -extern u16 *GetVarPointer(u16); -extern u16 VarGet(u16); extern void sub_8126160(u8); extern u8 AddBagItem(u16, u16); extern u8 RemoveBagItem(u16, u16); @@ -27,9 +27,6 @@ extern u8 IsThereStorageSpaceForDecoration(u8); extern s8 sub_81340A8(u8); extern u8 sub_8134074(u8); extern u8 sub_8133FE4(u8); -extern void FlagSet(u16); -extern void FlagReset(u16); -extern u8 FlagGet(u16); extern void sav12_xor_increment(u8); extern void sub_8081594(u8); extern void sub_8053CE4(u32); @@ -115,7 +112,7 @@ extern void CreatePokemartMenu(void *); extern void CreateDecorationShop1Menu(void *); extern void CreateDecorationShop2Menu(void *); extern void PlaySlotMachine(u8, void *); -extern void PlantBerryTree(u8, u8, u8, u8); +extern void PlantBerryTree(u8, u8, u8, bool8); extern bool8 GetPriceReduction(u8); extern void sub_80F99CC(void); extern void sub_80C48C8(void); @@ -126,11 +123,11 @@ extern bool8 FieldEffectActiveListContains(u8); extern void sub_8053588(u8); extern void MapGridSetMetatileIdAt(u32, u32, u16); 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); -extern void sub_80586B4(u32, u32); -extern void sub_80586E0(u32, u32); +extern bool8 FieldAnimateDoorOpen(u32, u32); +extern bool8 FieldAnimateDoorClose(u32, u32); +extern bool8 FieldIsDoorAnimationRunning(void); +extern void FieldSetDoorOpened(u32, u32); +extern void FieldSetDoorClosed(u32, u32); extern void ScriptAddElevatorMenuItem(u8, u8, u8, u8); extern void ScriptShowElevatorMenu(void); extern u16 GetCoins(void); @@ -155,16 +152,16 @@ 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 gSpecialVar_0x8000; +extern u16 gSpecialVar_0x8001; +extern u16 gSpecialVar_0x8002; +extern u16 gSpecialVar_0x8004; extern u16 gScriptResult; extern u32 gUnknown_0202FF84[]; -extern u16 gUnknown_0203869C; +extern u16 gScriptContestCategory; extern SpecialFunc gSpecials[]; extern u8 *gStdScripts[]; @@ -717,9 +714,9 @@ bool8 ScrCmd_checkdailyflags(struct ScriptContext *ctx) bool8 ScrCmd_resetvars(struct ScriptContext *ctx) { RtcCalcLocalTime(); - gUnknown_0202E8C4 = gLocalTime.hours; - gUnknown_0202E8C6 = gLocalTime.minutes; - gUnknown_0202E8C8 = gLocalTime.seconds; + gSpecialVar_0x8000 = gLocalTime.hours; + gSpecialVar_0x8001 = gLocalTime.minutes; + gSpecialVar_0x8002 = gLocalTime.seconds; return FALSE; } @@ -1574,7 +1571,7 @@ bool8 ScrCmd_checkattack(struct ScriptContext *ctx) if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG) && pokemon_has_move(&gPlayerParty[i], moveId) == TRUE) { gScriptResult = i; - gUnknown_0202E8CC = species; + gSpecialVar_0x8004 = species; break; } } @@ -1759,9 +1756,9 @@ bool8 ScrCmd_event_8a(struct ScriptContext *ctx) u8 v3 = ScriptReadByte(ctx); u8 v4 = ScriptReadByte(ctx); if (!v3) - PlantBerryTree(v2, 0, v4, 0); + PlantBerryTree(v2, 0, v4, FALSE); else - PlantBerryTree(v2, v3, v4, 0); + PlantBerryTree(v2, v3, v4, FALSE); return FALSE; } @@ -1795,7 +1792,7 @@ bool8 ScrCmd_showcontestresults(struct ScriptContext *ctx) bool8 ScrCmd_contestlinktransfer(struct ScriptContext *ctx) { - sub_80C4980(gUnknown_0203869C); + sub_80C4980(gScriptContestCategory); ScriptContext1_Stop(); return TRUE; } @@ -1874,28 +1871,28 @@ bool8 ScrCmd_setmaptile(struct ScriptContext *ctx) bool8 ScrCmd_setdooropened(struct ScriptContext *ctx) { - u16 v3 = VarGet(ScriptReadHalfword(ctx)); - u16 v4 = VarGet(ScriptReadHalfword(ctx)); - v3 += 7; - v4 += 7; - PlaySE(sub_8058790(v3, v4)); - task_overworld_door_add_if_role_69_for_opening_door_at(v3, v4); + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + x += 7; + y += 7; + PlaySE(sub_8058790(x, y)); + FieldAnimateDoorOpen(x, y); return FALSE; } bool8 ScrCmd_setdoorclosed(struct ScriptContext *ctx) { - u16 v3 = VarGet(ScriptReadHalfword(ctx)); - u16 v5 = VarGet(ScriptReadHalfword(ctx)); - v3 += 7; - v5 += 7; - sub_805870C(v3, v5); + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + x += 7; + y += 7; + FieldAnimateDoorClose(x, y); return FALSE; } -bool8 sub_8067D2C() +bool8 IsDoorAnimationStopped() { - if (!sub_805877C()) + if (!FieldIsDoorAnimationRunning()) return TRUE; else return FALSE; @@ -1903,27 +1900,27 @@ bool8 sub_8067D2C() bool8 ScrCmd_doorchange(struct ScriptContext *ctx) { - SetupNativeScript(ctx, sub_8067D2C); + SetupNativeScript(ctx, IsDoorAnimationStopped); return TRUE; } bool8 ScrCmd_setdooropened2(struct ScriptContext *ctx) { - u16 v3 = VarGet(ScriptReadHalfword(ctx)); - u16 v5 = VarGet(ScriptReadHalfword(ctx)); - v3 += 7; - v5 += 7; - sub_80586B4(v3, v5); + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + x += 7; + y += 7; + FieldSetDoorOpened(x, y); return FALSE; } bool8 ScrCmd_setdoorclosed2(struct ScriptContext *ctx) { - u16 v3 = VarGet(ScriptReadHalfword(ctx)); - u16 v5 = VarGet(ScriptReadHalfword(ctx)); - v3 += 7; - v5 += 7; - sub_80586E0(v3, v5); + u16 x = VarGet(ScriptReadHalfword(ctx)); + u16 y = VarGet(ScriptReadHalfword(ctx)); + x += 7; + y += 7; + FieldSetDoorClosed(x, y); return FALSE; } |