diff --git a/asm/macros/event.inc b/asm/macros/event.inc index e00bdb600..15889b1c6 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 0bc74b1bd..f09166f5a 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 f56411104..fa29f4099 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 959153d8a..f688918ea 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 b6a278b03..de6545ec3 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 b129e137e..144113d72 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 11abafa0c..8dcc74116 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 1a677001d..fd195b973 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 a036296e3..6447b49c5 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 d5a2de5ce..9257b3a64 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 cd5f4c84d..22177c783 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 8d2a4be80..8cb20e372 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 1bf570549..bc4f04b7f 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 32fa9fa5d..c46923bb0 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 7d2143346..2f3ef0434 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 5f2352645..78938b7d8 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 5214edc44..b6983eac0 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 e9a14437a..910227a92 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 57cd3edbe..8746e0cfb 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));