From 6508469259cc7eb37c37814f16b2f3a29e9d9555 Mon Sep 17 00:00:00 2001 From: Tustin2121 Date: Sat, 17 Aug 2019 10:38:02 -0400 Subject: [PATCH] Rename movobjectoffscreen to copyobjectxytoperm Renaming the command to something that makes more sense as to what the command actually does. The command copies the current xy of the instantiated object back to its template, so that the object remains in the same place if the player walks away and despawns the object, and then comes back. "moveobjectoffscreen" implies that it might be taking the object and moving it physically to an off-screen location somehow. --- asm/macros/event.inc | 3 ++- .../BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc | 2 +- data/maps/DewfordTown/scripts.inc | 2 +- data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc | 4 ++-- data/maps/FarawayIsland_Interior/scripts.inc | 2 +- data/maps/MossdeepCity_SpaceCenter_1F/scripts.inc | 2 +- data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc | 6 +++--- data/maps/Route104/scripts.inc | 6 +++--- data/maps/Route109/scripts.inc | 2 +- data/maps/Route119_WeatherInstitute_2F/scripts.inc | 2 +- data/maps/RustboroCity/scripts.inc | 2 +- data/maps/RusturfTunnel/scripts.inc | 4 ++-- data/maps/SeafloorCavern_Entrance/scripts.inc | 2 +- data/maps/SlateportCity_Harbor/scripts.inc | 2 +- data/maps/SootopolisCity/scripts.inc | 4 ++-- data/maps/SootopolisCity_MysteryEventsHouse_1F/scripts.inc | 2 +- data/maps/VictoryRoad_1F/scripts.inc | 2 +- data/script_cmd_table.inc | 2 +- src/scrcmd.c | 2 +- 19 files changed, 27 insertions(+), 26 deletions(-) diff --git a/asm/macros/event.inc b/asm/macros/event.inc index e00bdb6005..15889b1c6e 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -765,7 +765,8 @@ .2byte \y .endm - .macro moveobjectoffscreen index:req + @ Copies a live event object's xy position to its template, so that if the sprite goes off screen, it'll still be there when it comes back on screen. + .macro copyobjectxytoperm index:req .byte 0x64 .2byte \index .endm diff --git a/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc b/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc index 0bc74b1bd9..f09166f5ae 100644 --- a/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc +++ b/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc @@ -63,7 +63,7 @@ BattleFrontier_BattleTowerMultiBattleRoom_EventScript_243E41:: @ 8243E41 waitmovement 0 applymovement 1, BattleFrontier_BattleTowerMultiBattleRoom_Movement_243E77 waitmovement 0 - moveobjectoffscreen 1 + copyobjectxytoperm 1 applymovement EVENT_OBJ_ID_PLAYER, Common_Movement_WalkInPlaceUp waitmovement 0 msgbox BattleFrontier_BattleTowerMultiBattleRoom_Text_244056, MSGBOX_DEFAULT diff --git a/data/maps/DewfordTown/scripts.inc b/data/maps/DewfordTown/scripts.inc index f564111040..fa29f4099c 100644 --- a/data/maps/DewfordTown/scripts.inc +++ b/data/maps/DewfordTown/scripts.inc @@ -180,7 +180,7 @@ DewfordTown_EventScript_1E96E7:: @ 81E96E7 copyvar VAR_BRINEY_LOCATION, VAR_0x8008 resetobjectpriority EVENT_OBJ_ID_PLAYER, MAP_DEWFORD_TOWN resetobjectpriority 2, MAP_ROUTE109 - moveobjectoffscreen 2 + copyobjectxytoperm 2 release end diff --git a/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc b/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc index 959153d8ae..f688918eaf 100644 --- a/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc +++ b/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc @@ -67,8 +67,8 @@ EverGrandeCity_PokemonLeague_1F_EventScript_229636:: @ 8229636 waitmessage waitfanfare closemessage - moveobjectoffscreen 3 - moveobjectoffscreen 4 + copyobjectxytoperm 3 + copyobjectxytoperm 4 setflag FLAG_ENTERED_ELITE_FOUR releaseall end diff --git a/data/maps/FarawayIsland_Interior/scripts.inc b/data/maps/FarawayIsland_Interior/scripts.inc index b6a278b033..de6545ec32 100644 --- a/data/maps/FarawayIsland_Interior/scripts.inc +++ b/data/maps/FarawayIsland_Interior/scripts.inc @@ -62,7 +62,7 @@ FarawayIsland_Interior_EventScript_267DA2:: @ 8267DA2 waitmovement 0 applymovement 1, FarawayIsland_Interior_Movement_267DCE waitmovement 0 - moveobjectoffscreen 1 + copyobjectxytoperm 1 setvar VAR_TEMP_1, 1 releaseall end diff --git a/data/maps/MossdeepCity_SpaceCenter_1F/scripts.inc b/data/maps/MossdeepCity_SpaceCenter_1F/scripts.inc index b129e137eb..144113d724 100644 --- a/data/maps/MossdeepCity_SpaceCenter_1F/scripts.inc +++ b/data/maps/MossdeepCity_SpaceCenter_1F/scripts.inc @@ -236,7 +236,7 @@ MossdeepCity_SpaceCenter_1F_EventScript_22321F:: @ 822321F msgbox MossdeepCity_SpaceCenter_1F_Text_223B90, MSGBOX_DEFAULT trainerbattle_no_intro TRAINER_GRUNT_23, MossdeepCity_SpaceCenter_1F_Text_223BC2 setflag FLAG_DEFEATED_GRUNT_SPACE_CENTER_1F - moveobjectoffscreen 9 + copyobjectxytoperm 9 switch VAR_FACING case 3, MossdeepCity_SpaceCenter_1F_EventScript_223278 case 3, MossdeepCity_SpaceCenter_1F_EventScript_223289 diff --git a/data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc b/data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc index 11abafa0cf..8dcc74116d 100644 --- a/data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc +++ b/data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc @@ -70,9 +70,9 @@ MossdeepCity_SpaceCenter_2F_EventScript_223E09:: @ 8223E09 applymovement 7, MossdeepCity_SpaceCenter_2F_Movement_223E89 waitmovement 0 setvar VAR_MOSSDEEP_SPACE_CENTER_STATE_2, 2 - moveobjectoffscreen 5 - moveobjectoffscreen 7 - moveobjectoffscreen 6 + copyobjectxytoperm 5 + copyobjectxytoperm 7 + copyobjectxytoperm 6 releaseall end diff --git a/data/maps/Route104/scripts.inc b/data/maps/Route104/scripts.inc index 1a677001d1..fd195b973f 100644 --- a/data/maps/Route104/scripts.inc +++ b/data/maps/Route104/scripts.inc @@ -114,7 +114,7 @@ Route104_EventScript_1ECD4B:: @ 81ECD4B waitmovement 0 applymovement 34, Route104_Movement_1ECDCA waitmovement 0 - moveobjectoffscreen 34 + copyobjectxytoperm 34 msgbox Route104_Text_1EDCED, MSGBOX_YESNO compare VAR_RESULT, 1 goto_if_eq Route104_EventScript_1ECDED @@ -203,7 +203,7 @@ Route104_EventScript_1ECE6F:: @ 81ECE6F waitmovement 0 applymovement 34, Route104_Movement_1ECDCA waitmovement 0 - moveobjectoffscreen 34 + copyobjectxytoperm 34 msgbox Route104_Text_1EE009, MSGBOX_YESNO compare VAR_RESULT, 1 goto_if_eq Route104_EventScript_1ECF09 @@ -416,7 +416,7 @@ Route104_EventScript_1ED139:: @ 81ED139 copyvar VAR_BRINEY_LOCATION, VAR_0x8008 resetobjectpriority EVENT_OBJ_ID_PLAYER, MAP_ROUTE104 resetobjectpriority 2, MAP_DEWFORD_TOWN - moveobjectoffscreen 2 + copyobjectxytoperm 2 setvar VAR_BOARD_BRINEY_BOAT_STATE, 0 goto_if_unset FLAG_DELIVERED_STEVEN_LETTER, Route104_EventScript_1ED1B4 goto_if_set FLAG_DELIVERED_STEVEN_LETTER, Route104_EventScript_1ED1BE diff --git a/data/maps/Route109/scripts.inc b/data/maps/Route109/scripts.inc index a036296e34..6447b49c53 100644 --- a/data/maps/Route109/scripts.inc +++ b/data/maps/Route109/scripts.inc @@ -58,7 +58,7 @@ Route109_EventScript_1EE7D5:: @ 81EE7D5 copyvar VAR_BRINEY_LOCATION, VAR_0x8008 resetobjectpriority EVENT_OBJ_ID_PLAYER, MAP_ROUTE109 resetobjectpriority 2, MAP_DEWFORD_TOWN - moveobjectoffscreen 2 + copyobjectxytoperm 2 release end diff --git a/data/maps/Route119_WeatherInstitute_2F/scripts.inc b/data/maps/Route119_WeatherInstitute_2F/scripts.inc index d5a2de5ce1..9257b3a644 100644 --- a/data/maps/Route119_WeatherInstitute_2F/scripts.inc +++ b/data/maps/Route119_WeatherInstitute_2F/scripts.inc @@ -77,7 +77,7 @@ Route119_WeatherInstitute_2F_EventScript_26FFC8:: @ 826FFC8 fadescreen 0 applymovement 5, Route119_WeatherInstitute_2F_Movement_270187 waitmovement 0 - moveobjectoffscreen 5 + copyobjectxytoperm 5 goto Route119_WeatherInstitute_2F_EventScript_27004D end diff --git a/data/maps/RustboroCity/scripts.inc b/data/maps/RustboroCity/scripts.inc index cd5f4c84dd..22177c783d 100644 --- a/data/maps/RustboroCity/scripts.inc +++ b/data/maps/RustboroCity/scripts.inc @@ -494,7 +494,7 @@ RustboroCity_EventScript_1E0B2E:: @ 81E0B2E call_if_eq RustboroCity_EventScript_1E0BF3 setflag FLAG_INTERACTED_WITH_DEVON_EMPLOYEE_GOODS_STOLEN setvar VAR_RUSTBORO_CITY_STATE, 3 - moveobjectoffscreen 9 + copyobjectxytoperm 9 msgbox RustboroCity_Text_1E183E, MSGBOX_DEFAULT releaseall end diff --git a/data/maps/RusturfTunnel/scripts.inc b/data/maps/RusturfTunnel/scripts.inc index 8d2a4be80e..8cb20e3729 100644 --- a/data/maps/RusturfTunnel/scripts.inc +++ b/data/maps/RusturfTunnel/scripts.inc @@ -285,8 +285,8 @@ RusturfTunnel_EventScript_22D083:: @ 822D083 applymovement 6, RusturfTunnel_Movement_22D0AB applymovement 7, RusturfTunnel_Movement_22D0AB waitmovement 0 - moveobjectoffscreen 6 - moveobjectoffscreen 7 + copyobjectxytoperm 6 + copyobjectxytoperm 7 setvar VAR_RUSTURF_TUNNEL_STATE, 3 releaseall end diff --git a/data/maps/SeafloorCavern_Entrance/scripts.inc b/data/maps/SeafloorCavern_Entrance/scripts.inc index 1bf5705495..bc4f04b7f9 100644 --- a/data/maps/SeafloorCavern_Entrance/scripts.inc +++ b/data/maps/SeafloorCavern_Entrance/scripts.inc @@ -26,7 +26,7 @@ SeafloorCavern_Entrance_EventScript_234485:: @ 8234485 call_if_eq SeafloorCavern_Entrance_EventScript_234539 delay 30 setvar VAR_HAS_TALKED_TO_SEAFLOOR_CAVERN_ENTRANCE_GRUNT, 1 - moveobjectoffscreen 1 + copyobjectxytoperm 1 msgbox SeafloorCavern_Entrance_Text_234544, MSGBOX_DEFAULT closemessage applymovement 1, Common_Movement_WalkInPlaceUp diff --git a/data/maps/SlateportCity_Harbor/scripts.inc b/data/maps/SlateportCity_Harbor/scripts.inc index 32fa9fa5dc..c46923bb07 100644 --- a/data/maps/SlateportCity_Harbor/scripts.inc +++ b/data/maps/SlateportCity_Harbor/scripts.inc @@ -77,7 +77,7 @@ SlateportCity_Harbor_EventScript_20C9F5:: @ 820C9F5 closemessage setflag FLAG_HIDE_AQUA_HIDEOUT_1F_GRUNT_1_BLOCKING_ENTRANCE setflag FLAG_HIDE_AQUA_HIDEOUT_1F_GRUNT_2_BLOCKING_ENTRANCE - moveobjectoffscreen 4 + copyobjectxytoperm 4 setobjectmovementtype 4, MOVEMENT_TYPE_FACE_RIGHT releaseall end diff --git a/data/maps/SootopolisCity/scripts.inc b/data/maps/SootopolisCity/scripts.inc index 7d2143346a..2f3ef04343 100644 --- a/data/maps/SootopolisCity/scripts.inc +++ b/data/maps/SootopolisCity/scripts.inc @@ -1366,14 +1366,14 @@ SootopolisCity_EventScript_1E646F:: @ 81E646F SootopolisCity_EventScript_1E64B2:: @ 81E64B2 applymovement 18, SootopolisCity_Movement_1E64EC waitmovement 0 - moveobjectoffscreen 18 + copyobjectxytoperm 18 setvar VAR_SOOTOPOLIS_WALLACE_STATE, 1 return SootopolisCity_EventScript_1E64C5:: @ 81E64C5 applymovement 18, SootopolisCity_Movement_1E64EF waitmovement 0 - moveobjectoffscreen 18 + copyobjectxytoperm 18 setvar VAR_SOOTOPOLIS_WALLACE_STATE, 2 return diff --git a/data/maps/SootopolisCity_MysteryEventsHouse_1F/scripts.inc b/data/maps/SootopolisCity_MysteryEventsHouse_1F/scripts.inc index 5f2352645f..78938b7d84 100644 --- a/data/maps/SootopolisCity_MysteryEventsHouse_1F/scripts.inc +++ b/data/maps/SootopolisCity_MysteryEventsHouse_1F/scripts.inc @@ -36,7 +36,7 @@ SootopolisCity_MysteryEventsHouse_1F_EventScript_2279B7:: @ 82279B7 waitmovement 0 applymovement 1, SootopolisCity_MysteryEventsHouse_1F_Movement_227A21 waitmovement 0 - moveobjectoffscreen 1 + copyobjectxytoperm 1 applymovement EVENT_OBJ_ID_PLAYER, Common_Movement_WalkInPlaceUp waitmovement 0 compare VAR_SOOTOPOLIS_MYSTERY_EVENTS_STATE, 1 diff --git a/data/maps/VictoryRoad_1F/scripts.inc b/data/maps/VictoryRoad_1F/scripts.inc index 5214edc44f..b6983eac0f 100644 --- a/data/maps/VictoryRoad_1F/scripts.inc +++ b/data/maps/VictoryRoad_1F/scripts.inc @@ -44,7 +44,7 @@ VictoryRoad_1F_EventScript_235DE1:: @ 8235DE1 trainerbattle_no_intro TRAINER_WALLY_1, VictoryRoad_1F_Text_235FFC msgbox VictoryRoad_1F_Text_236020, MSGBOX_DEFAULT clearflag FLAG_HIDE_VICTORY_ROAD_ENTRANCE_WALLY - moveobjectoffscreen 4 + copyobjectxytoperm 4 setflag FLAG_DEFEATED_WALLY_VICTORY_ROAD copyvar VAR_VICTORY_ROAD_1F_STATE, VAR_0x8008 releaseall diff --git a/data/script_cmd_table.inc b/data/script_cmd_table.inc index e9a14437a7..910227a921 100644 --- a/data/script_cmd_table.inc +++ b/data/script_cmd_table.inc @@ -100,7 +100,7 @@ gScriptCmdTable:: @ 81DB67C .4byte ScrCmd_settrainerflag .4byte ScrCmd_cleartrainerflag .4byte ScrCmd_setobjectxyperm - .4byte ScrCmd_moveobjectoffscreen + .4byte ScrCmd_copyobjectxytoperm .4byte ScrCmd_setobjectmovementtype .4byte ScrCmd_waitmessage .4byte ScrCmd_message diff --git a/src/scrcmd.c b/src/scrcmd.c index 57cd3edbed..8746e0cfb9 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -1102,7 +1102,7 @@ bool8 ScrCmd_setobjectxyperm(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_moveobjectoffscreen(struct ScriptContext *ctx) +bool8 ScrCmd_copyobjectxytoperm(struct ScriptContext *ctx) { u16 localId = VarGet(ScriptReadHalfword(ctx));