diff options
author | GriffinR <griffin.richards@comcast.net> | 2019-10-07 17:37:04 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-07 17:37:04 -0400 |
commit | d8f5e73bb7738da97647bc06a87b6b70f4c0966f (patch) | |
tree | 1efdd0f6e8bab9e14eade4096ee114eb78094de0 | |
parent | c4deb4db96ac8463c2ef1dd92ca5c7d6d13c4dae (diff) | |
parent | 7ba11b7a1b4e8639cdd65ab147a24b430f6424c5 (diff) |
Merge branch 'master' into doc-inc
44 files changed, 313 insertions, 320 deletions
diff --git a/asm/macros/movement.inc b/asm/macros/movement.inc index 99b5c8f84..e26a00d76 100644 --- a/asm/macros/movement.inc +++ b/asm/macros/movement.inc @@ -102,8 +102,8 @@ create_movement_action clear_fixed_priority create_movement_action init_affine_anim create_movement_action clear_affine_anim - create_movement_action unknown_movement_1 - create_movement_action unknown_movement_2 + create_movement_action hide_reflection + create_movement_action show_reflection create_movement_action walk_down_start_affine create_movement_action walk_down_affine diff --git a/data/event_scripts.s b/data/event_scripts.s index 2ffce2386..1d12dc6a4 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -1318,9 +1318,9 @@ BirthIsland_Harbor_EventScript_272250:: @ 8272250 FarawayIsland_Entrance_EventScript_272250:: @ 8272250 NavelRock_Harbor_EventScript_272250:: @ 8272250 SouthernIsland_Exterior_EventScript_272250:: @ 8272250 - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH call_if_eq BattleFrontier_OutsideWest_EventScript_242A21 - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq BattleFrontier_OutsideWest_EventScript_242A2C delay 30 hideobjectat 255, MAP_PETALBURG_CITY diff --git a/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc b/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc index 4b2f088eb..d053c33e4 100644 --- a/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc +++ b/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc @@ -190,9 +190,9 @@ BattleFrontier_BattleTowerMultiBattleRoom_EventScript_243F36:: @ 8243F36 waitmessage waitbuttonpress closemessage - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH call_if_ne BattleFrontier_BattleTowerMultiBattleRoom_EventScript_243FD4 - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH call_if_eq BattleFrontier_BattleTowerMultiBattleRoom_EventScript_243FDF removeobject VAR_LAST_TALKED setflag FLAG_CHOSEN_MULTI_BATTLE_NPC_PARTNER diff --git a/data/maps/BattleFrontier_OutsideWest/scripts.inc b/data/maps/BattleFrontier_OutsideWest/scripts.inc index 4e1bb8421..1f3d61628 100644 --- a/data/maps/BattleFrontier_OutsideWest/scripts.inc +++ b/data/maps/BattleFrontier_OutsideWest/scripts.inc @@ -144,13 +144,13 @@ BattleFrontier_OutsideWest_EventScript_23D57F:: @ 823D57F lock faceplayer delay 20 - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq BattleFrontier_OutsideWest_EventScript_23D5BA - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH call_if_eq BattleFrontier_OutsideWest_EventScript_23D5C5 - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq BattleFrontier_OutsideWest_EventScript_23D5BA - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq BattleFrontier_OutsideWest_EventScript_23D5BA msgbox BattleFrontier_OutsideWest_Text_23DC36, MSGBOX_DEFAULT release @@ -169,13 +169,13 @@ BattleFrontier_OutsideWest_EventScript_23D5C6:: @ 823D5C6 faceplayer message BattleFrontier_OutsideWest_Text_23DCB0 waitmessage - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq BattleFrontier_OutsideWest_EventScript_23D5FD - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH call_if_eq BattleFrontier_OutsideWest_EventScript_23D608 - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq BattleFrontier_OutsideWest_EventScript_23D613 - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq BattleFrontier_OutsideWest_EventScript_23D61E waitbuttonpress release diff --git a/data/maps/BattleFrontier_ScottsHouse/scripts.inc b/data/maps/BattleFrontier_ScottsHouse/scripts.inc index 220137ba9..eeb6f6904 100644 --- a/data/maps/BattleFrontier_ScottsHouse/scripts.inc +++ b/data/maps/BattleFrontier_ScottsHouse/scripts.inc @@ -172,13 +172,13 @@ BattleFrontier_ScottsHouse_EventScript_263943:: @ 8263943 msgbox BattleFrontier_ScottsHouse_Text_263A3F, MSGBOX_DEFAULT closemessage delay 30 - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq BattleFrontier_ScottsHouse_EventScript_263A13 - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH call_if_eq BattleFrontier_ScottsHouse_EventScript_263A1E - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq BattleFrontier_ScottsHouse_EventScript_263A29 - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq BattleFrontier_ScottsHouse_EventScript_263A34 msgbox BattleFrontier_ScottsHouse_Text_263B29, MSGBOX_DEFAULT applymovement 1, Common_Movement_FacePlayer diff --git a/data/maps/DewfordTown_Hall/scripts.inc b/data/maps/DewfordTown_Hall/scripts.inc index 242af3c2f..9790753cf 100644 --- a/data/maps/DewfordTown_Hall/scripts.inc +++ b/data/maps/DewfordTown_Hall/scripts.inc @@ -198,7 +198,7 @@ DewfordTown_Hall_EventScript_1FD73A:: @ 81FD73A end DewfordTown_Hall_EventScript_1FD75B:: @ 81FD75B - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST goto_if_eq DewfordTown_Hall_EventScript_1FD739 applymovement EVENT_OBJ_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight waitmovement 0 @@ -217,9 +217,9 @@ DewfordTown_Hall_EventScript_1FD772:: @ 81FD772 end DewfordTown_Hall_EventScript_1FD793:: @ 81FD793 - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq DewfordTown_Hall_EventScript_1FD7AA - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH call_if_eq DewfordTown_Hall_EventScript_1FD7B5 return @@ -234,7 +234,7 @@ DewfordTown_Hall_EventScript_1FD7B5:: @ 81FD7B5 return DewfordTown_Hall_EventScript_1FD7C0:: @ 81FD7C0 - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST goto_if_eq DewfordTown_Hall_EventScript_1FD739 applymovement EVENT_OBJ_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft waitmovement 0 diff --git a/data/maps/EverGrandeCity_PokemonCenter_1F/scripts.inc b/data/maps/EverGrandeCity_PokemonCenter_1F/scripts.inc index b9dcc07dd..e3bf7ada8 100644 --- a/data/maps/EverGrandeCity_PokemonCenter_1F/scripts.inc +++ b/data/maps/EverGrandeCity_PokemonCenter_1F/scripts.inc @@ -34,11 +34,11 @@ EverGrandeCity_PokemonCenter_1F_EventScript_229A79:: @ 8229A79 faceplayer msgbox EverGrandeCity_PokemonCenter_1F_Text_229BF1, MSGBOX_DEFAULT closemessage - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq EverGrandeCity_PokemonCenter_1F_EventScript_229AB6 - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq EverGrandeCity_PokemonCenter_1F_EventScript_229AC1 - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq EverGrandeCity_PokemonCenter_1F_EventScript_229AC1 addvar VAR_SCOTT_STATE, 1 setflag FLAG_MET_SCOTT_IN_EVERGRANDE diff --git a/data/maps/FallarborTown_PokemonCenter_1F/scripts.inc b/data/maps/FallarborTown_PokemonCenter_1F/scripts.inc index 062e6dedc..5954ca787 100644 --- a/data/maps/FallarborTown_PokemonCenter_1F/scripts.inc +++ b/data/maps/FallarborTown_PokemonCenter_1F/scripts.inc @@ -30,8 +30,8 @@ FallarborTown_PokemonCenter_1F_EventScript_200C01:: @ 8200C01 msgbox FallarborTown_PokemonCenter_1F_Text_200C6B, MSGBOX_DEFAULT closemessage switch VAR_FACING - case 2, FallarborTown_PokemonCenter_1F_EventScript_200C28 - case 3, FallarborTown_PokemonCenter_1F_EventScript_200C38 + case DIR_NORTH, FallarborTown_PokemonCenter_1F_EventScript_200C28 + case DIR_WEST, FallarborTown_PokemonCenter_1F_EventScript_200C38 end FallarborTown_PokemonCenter_1F_EventScript_200C28:: @ 8200C28 diff --git a/data/maps/FarawayIsland_Interior/scripts.inc b/data/maps/FarawayIsland_Interior/scripts.inc index 9bbf0575d..133cc02f4 100644 --- a/data/maps/FarawayIsland_Interior/scripts.inc +++ b/data/maps/FarawayIsland_Interior/scripts.inc @@ -125,13 +125,13 @@ FarawayIsland_Interior_EventScript_267DF2:: @ 8267DF2 message FarawayIsland_Interior_Text_Mew waitse playmoncry SPECIES_MEW, 2 - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq FarawayIsland_Interior_EventScript_267EAF - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH call_if_eq FarawayIsland_Interior_EventScript_267EBA - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq FarawayIsland_Interior_EventScript_267EC5 - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq FarawayIsland_Interior_EventScript_267ED0 special sub_81D4BEC delay 40 diff --git a/data/maps/GraniteCave_StevensRoom/scripts.inc b/data/maps/GraniteCave_StevensRoom/scripts.inc index c08e4c6af..333f97a66 100644 --- a/data/maps/GraniteCave_StevensRoom/scripts.inc +++ b/data/maps/GraniteCave_StevensRoom/scripts.inc @@ -23,13 +23,13 @@ GraniteCave_StevensRoom_EventScript_22DC7B:: @ 822DC7B setflag FLAG_REGISTERED_STEVEN_POKENAV msgbox GraniteCave_StevensRoom_Text_22DF8C, MSGBOX_DEFAULT closemessage - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq GraniteCave_StevensRoom_EventScript_22DD0D - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH call_if_eq GraniteCave_StevensRoom_EventScript_22DD2A - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq GraniteCave_StevensRoom_EventScript_22DD18 - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq GraniteCave_StevensRoom_EventScript_22DD18 playse SE_KAIDAN removeobject 1 diff --git a/data/maps/LilycoveCity_LilycoveMuseum_1F/scripts.inc b/data/maps/LilycoveCity_LilycoveMuseum_1F/scripts.inc index 8ac18ba85..51e9129f9 100644 --- a/data/maps/LilycoveCity_LilycoveMuseum_1F/scripts.inc +++ b/data/maps/LilycoveCity_LilycoveMuseum_1F/scripts.inc @@ -40,9 +40,9 @@ LilycoveCity_LilycoveMuseum_1F_EventScript_218D1E:: @ 8218D1E waitmovement 0 removeobject 2 switch VAR_FACING - case 2, LilycoveCity_LilycoveMuseum_1F_EventScript_218D5A - case 3, LilycoveCity_LilycoveMuseum_1F_EventScript_218D6F - case 4, LilycoveCity_LilycoveMuseum_1F_EventScript_218D84 + case DIR_NORTH, LilycoveCity_LilycoveMuseum_1F_EventScript_218D5A + case DIR_WEST, LilycoveCity_LilycoveMuseum_1F_EventScript_218D6F + case DIR_EAST, LilycoveCity_LilycoveMuseum_1F_EventScript_218D84 end LilycoveCity_LilycoveMuseum_1F_EventScript_218D5A:: @ 8218D5A diff --git a/data/maps/LittlerootTown_BrendansHouse_2F/scripts.inc b/data/maps/LittlerootTown_BrendansHouse_2F/scripts.inc index 6593ec23e..130781f23 100644 --- a/data/maps/LittlerootTown_BrendansHouse_2F/scripts.inc +++ b/data/maps/LittlerootTown_BrendansHouse_2F/scripts.inc @@ -73,13 +73,13 @@ LittlerootTown_BrendansHouse_2F_EventScript_1F8497:: @ 81F8497 waitmovement 0 delay 10 playbgm MUS_BOY_SUP, 1 - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq LittlerootTown_BrendansHouse_2F_EventScript_1F8507 - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH call_if_eq LittlerootTown_BrendansHouse_2F_EventScript_1F8536 - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq LittlerootTown_BrendansHouse_2F_EventScript_1F8565 - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq LittlerootTown_BrendansHouse_2F_EventScript_1F8594 setvar VAR_LITTLEROOT_RIVAL_STATE, 3 setflag FLAG_HIDE_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F_POKE_BALL diff --git a/data/maps/LittlerootTown_MaysHouse_2F/scripts.inc b/data/maps/LittlerootTown_MaysHouse_2F/scripts.inc index 2f3c090aa..31a097ead 100644 --- a/data/maps/LittlerootTown_MaysHouse_2F/scripts.inc +++ b/data/maps/LittlerootTown_MaysHouse_2F/scripts.inc @@ -74,13 +74,13 @@ LittlerootTown_MaysHouse_2F_EventScript_1F934A:: @ 81F934A waitmovement 0 delay 10 playbgm MUS_GIRL_SUP, 1 - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq LittlerootTown_MaysHouse_2F_EventScript_1F93BA - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH call_if_eq LittlerootTown_MaysHouse_2F_EventScript_1F93E9 - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq LittlerootTown_MaysHouse_2F_EventScript_1F9418 - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq LittlerootTown_MaysHouse_2F_EventScript_1F9440 setvar VAR_LITTLEROOT_RIVAL_STATE, 3 setflag FLAG_HIDE_LITTLEROOT_TOWN_MAYS_HOUSE_2F_POKE_BALL diff --git a/data/maps/MauvilleCity/scripts.inc b/data/maps/MauvilleCity/scripts.inc index 7bf711526..52ff2237c 100644 --- a/data/maps/MauvilleCity/scripts.inc +++ b/data/maps/MauvilleCity/scripts.inc @@ -109,8 +109,8 @@ MauvilleCity_EventScript_1DF4AD:: @ 81DF4AD goto_if_eq MauvilleCity_EventScript_1DF683 closemessage switch VAR_FACING - case 2, MauvilleCity_EventScript_1DF4E0 - case 4, MauvilleCity_EventScript_1DF53D + case DIR_NORTH, MauvilleCity_EventScript_1DF4E0 + case DIR_EAST, MauvilleCity_EventScript_1DF53D end MauvilleCity_EventScript_1DF4E0:: @ 81DF4E0 @@ -160,18 +160,18 @@ MauvilleCity_EventScript_1DF593:: @ 81DF593 setflag FLAG_DEFEATED_WALLY_MAUVILLE setvar VAR_WALLY_CALL_STEP_COUNTER, 0 setflag FLAG_ENABLE_FIRST_WALLY_POKENAV_CALL - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq MauvilleCity_EventScript_1DF5F3 - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq MauvilleCity_EventScript_1DF601 applymovement EVENT_OBJ_ID_PLAYER, Common_Movement_WalkInPlaceFastestDown waitmovement 0 msgbox MauvilleCity_Text_1DFED5, MSGBOX_DEFAULT closemessage addvar VAR_SCOTT_STATE, 1 - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq MauvilleCity_EventScript_1DF616 - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq MauvilleCity_EventScript_1DF628 removeobject 11 releaseall diff --git a/data/maps/MossdeepCity/scripts.inc b/data/maps/MossdeepCity/scripts.inc index 646b1d908..cbdec6b33 100644 --- a/data/maps/MossdeepCity/scripts.inc +++ b/data/maps/MossdeepCity/scripts.inc @@ -255,9 +255,9 @@ MossdeepCity_EventScript_1E4C85:: @ 81E4C85 faceplayer msgbox MossdeepCity_Text_1E5453, MSGBOX_DEFAULT closemessage - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq MossdeepCity_EventScript_1E4CB0 - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq MossdeepCity_EventScript_1E4CC2 addvar VAR_SCOTT_STATE, 1 removeobject 16 diff --git a/data/maps/MossdeepCity_House2/scripts.inc b/data/maps/MossdeepCity_House2/scripts.inc index 2151b2626..792ee7fd1 100644 --- a/data/maps/MossdeepCity_House2/scripts.inc +++ b/data/maps/MossdeepCity_House2/scripts.inc @@ -19,9 +19,9 @@ MossdeepCity_House2_EventScript_2220F1:: @ 82220F1 closemessage setflag FLAG_WINGULL_DELIVERED_MAIL clearflag FLAG_HIDE_FORTREE_CITY_HOUSE_4_WINGULL - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq MossdeepCity_House2_EventScript_222124 - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq MossdeepCity_House2_EventScript_22212F removeobject 3 release diff --git a/data/maps/MossdeepCity_SpaceCenter_1F/scripts.inc b/data/maps/MossdeepCity_SpaceCenter_1F/scripts.inc index ad3eb89f7..1058761c5 100644 --- a/data/maps/MossdeepCity_SpaceCenter_1F/scripts.inc +++ b/data/maps/MossdeepCity_SpaceCenter_1F/scripts.inc @@ -238,8 +238,8 @@ MossdeepCity_SpaceCenter_1F_EventScript_22321F:: @ 822321F setflag FLAG_DEFEATED_GRUNT_SPACE_CENTER_1F copyobjectxytoperm 9 switch VAR_FACING - case 3, MossdeepCity_SpaceCenter_1F_EventScript_223278 - case 3, MossdeepCity_SpaceCenter_1F_EventScript_223289 + case DIR_WEST, MossdeepCity_SpaceCenter_1F_EventScript_223278 + case DIR_WEST, MossdeepCity_SpaceCenter_1F_EventScript_223289 applymovement 9, MossdeepCity_SpaceCenter_1F_Movement_2232A2 waitmovement 0 setvar VAR_MOSSDEEP_SPACE_CENTER_STATE_1, 2 diff --git a/data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc b/data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc index 71da27914..32c34ed23 100644 --- a/data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc +++ b/data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc @@ -194,7 +194,7 @@ MossdeepCity_SpaceCenter_2F_EventScript_223F7A:: @ 8223F7A delay 30 playse SE_KOUKA_L switch VAR_FACING - case 1, MossdeepCity_SpaceCenter_2F_EventScript_223FBA + case DIR_SOUTH, MossdeepCity_SpaceCenter_2F_EventScript_223FBA applymovement 4, MossdeepCity_SpaceCenter_2F_Movement_223FC6 waitmovement 0 releaseall @@ -326,8 +326,8 @@ MossdeepCity_SpaceCenter_2F_EventScript_224071:: @ 8224071 MossdeepCity_SpaceCenter_2F_EventScript_224131:: @ 8224131 switch VAR_FACING - case 1, MossdeepCity_SpaceCenter_2F_EventScript_22414D - case 3, MossdeepCity_SpaceCenter_2F_EventScript_224152 + case DIR_SOUTH, MossdeepCity_SpaceCenter_2F_EventScript_22414D + case DIR_WEST, MossdeepCity_SpaceCenter_2F_EventScript_224152 return MossdeepCity_SpaceCenter_2F_EventScript_22414D:: @ 822414D diff --git a/data/maps/MtChimney/scripts.inc b/data/maps/MtChimney/scripts.inc index 70cb2d58e..c4a013108 100644 --- a/data/maps/MtChimney/scripts.inc +++ b/data/maps/MtChimney/scripts.inc @@ -56,17 +56,17 @@ MtChimney_EventScript_22EE0B:: @ 822EE0B fadescreen 0 setobjectxyperm 1, 10, 12 addobject 1 - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq MtChimney_EventScript_22EEC7 - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq MtChimney_EventScript_22EED2 applymovement EVENT_OBJ_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft waitmovement 0 msgbox MtChimney_Text_22FC3D, MSGBOX_DEFAULT closemessage - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq MtChimney_EventScript_22EEDD - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq MtChimney_EventScript_22EEE8 removeobject 1 setflag FLAG_HIDE_MT_CHIMNEY_TEAM_AQUA diff --git a/data/maps/OldaleTown/scripts.inc b/data/maps/OldaleTown/scripts.inc index ee3930e8f..8e3950cae 100644 --- a/data/maps/OldaleTown/scripts.inc +++ b/data/maps/OldaleTown/scripts.inc @@ -42,9 +42,9 @@ OldaleTown_EventScript_1E8EFC:: @ 81E8EFC msgbox OldaleTown_Text_1E91C0, MSGBOX_DEFAULT closemessage switch VAR_FACING - case 1, OldaleTown_EventScript_1E8F47 - case 2, OldaleTown_EventScript_1E8F5E - case 4, OldaleTown_EventScript_1E8F75 + case DIR_SOUTH, OldaleTown_EventScript_1E8F47 + case DIR_NORTH, OldaleTown_EventScript_1E8F5E + case DIR_EAST, OldaleTown_EventScript_1E8F75 end OldaleTown_EventScript_1E8F47:: @ 81E8F47 @@ -286,7 +286,7 @@ OldaleTown_EventScript_1E911A:: @ 81E911A end OldaleTown_EventScript_1E9148:: @ 81E9148 - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH goto_if_ne OldaleTown_EventScript_1E915E applymovement 4, OldaleTown_Movement_1E9177 waitmovement 0 diff --git a/data/maps/PetalburgCity_Gym/scripts.inc b/data/maps/PetalburgCity_Gym/scripts.inc index b9f5dee26..4da701395 100644 --- a/data/maps/PetalburgCity_Gym/scripts.inc +++ b/data/maps/PetalburgCity_Gym/scripts.inc @@ -125,10 +125,10 @@ PetalburgCity_Gym_EventScript_2049F1:: @ 82049F1 msgbox PetalburgCity_Gym_Text_2057A2, MSGBOX_DEFAULT closemessage switch VAR_FACING - case 1, PetalburgCity_Gym_EventScript_204A80 - case 2, PetalburgCity_Gym_EventScript_204A8B - case 3, PetalburgCity_Gym_EventScript_204A96 - case 4, PetalburgCity_Gym_EventScript_204AA1 + case DIR_SOUTH, PetalburgCity_Gym_EventScript_204A80 + case DIR_NORTH, PetalburgCity_Gym_EventScript_204A8B + case DIR_WEST, PetalburgCity_Gym_EventScript_204A96 + case DIR_EAST, PetalburgCity_Gym_EventScript_204AA1 end PetalburgCity_Gym_EventScript_204A80:: @ 8204A80 @@ -436,9 +436,9 @@ PetalburgCity_Gym_EventScript_204E3B:: @ 8204E3B delay 10 addobject 11 switch VAR_FACING - case 2, PetalburgCity_Gym_EventScript_204EF5 - case 3, PetalburgCity_Gym_EventScript_204F09 - case 4, PetalburgCity_Gym_EventScript_204EFF + case DIR_NORTH, PetalburgCity_Gym_EventScript_204EF5 + case DIR_WEST, PetalburgCity_Gym_EventScript_204F09 + case DIR_EAST, PetalburgCity_Gym_EventScript_204EFF end PetalburgCity_Gym_EventScript_204ED2:: @ 8204ED2 diff --git a/data/maps/Route103/scripts.inc b/data/maps/Route103/scripts.inc index 84e7ad98b..363da2cb4 100644 --- a/data/maps/Route103/scripts.inc +++ b/data/maps/Route103/scripts.inc @@ -103,10 +103,10 @@ Route103_EventScript_1EC4FC:: @ 81EC4FC Route103_EventScript_1EC50A:: @ 81EC50A closemessage switch VAR_FACING - case 1, Route103_EventScript_1EC585 - case 2, Route103_EventScript_1EC53D - case 3, Route103_EventScript_1EC561 - case 4, Route103_EventScript_1EC561 + case DIR_SOUTH, Route103_EventScript_1EC585 + case DIR_NORTH, Route103_EventScript_1EC53D + case DIR_WEST, Route103_EventScript_1EC561 + case DIR_EAST, Route103_EventScript_1EC561 end Route103_EventScript_1EC53D:: @ 81EC53D diff --git a/data/maps/Route109/scripts.inc b/data/maps/Route109/scripts.inc index a74c3223d..a4ac60a9c 100644 --- a/data/maps/Route109/scripts.inc +++ b/data/maps/Route109/scripts.inc @@ -9,9 +9,9 @@ Route109_EventScript_1EE760:: @ 81EE760 waitmovement 0 removeobject 2 switch VAR_FACING - case 1, Route109_EventScript_1EE7A5 - case 3, Route109_EventScript_1EE7C5 - case 4, Route109_EventScript_1EE7B5 + case DIR_SOUTH, Route109_EventScript_1EE7A5 + case DIR_WEST, Route109_EventScript_1EE7C5 + case DIR_EAST, Route109_EventScript_1EE7B5 end Route109_EventScript_1EE7A5:: @ 81EE7A5 diff --git a/data/maps/Route110_TrickHouseEnd/scripts.inc b/data/maps/Route110_TrickHouseEnd/scripts.inc index 745c122c8..46c4c316e 100644 --- a/data/maps/Route110_TrickHouseEnd/scripts.inc +++ b/data/maps/Route110_TrickHouseEnd/scripts.inc @@ -150,13 +150,13 @@ Route110_TrickHouseEnd_EventScript_26AEEC:: @ 826AEEC Route110_TrickHouseEnd_EventScript_26AF28:: @ 826AF28 msgbox Route110_TrickHouseEnd_Text_26B3AB, MSGBOX_DEFAULT closemessage - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH call_if_eq Route110_TrickHouseEnd_EventScript_26B015 - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq Route110_TrickHouseEnd_EventScript_26B020 - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq Route110_TrickHouseEnd_EventScript_26B02B - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq Route110_TrickHouseEnd_EventScript_26B036 delay 30 msgbox Route110_TrickHouseEnd_Text_26B3FA, MSGBOX_DEFAULT diff --git a/data/maps/Route116/scripts.inc b/data/maps/Route116/scripts.inc index b2fd2cac1..a314a454d 100644 --- a/data/maps/Route116/scripts.inc +++ b/data/maps/Route116/scripts.inc @@ -63,13 +63,13 @@ Route116_EventScript_1F2CBB:: @ 81F2CBB goto_if_eq Route116_EventScript_1F2D39 msgbox Route116_Text_1F3521, MSGBOX_DEFAULT closemessage - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq Route116_EventScript_1F2D15 - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH call_if_eq Route116_EventScript_1F2D15 - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq Route116_EventScript_1F2D15 - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq Route116_EventScript_1F2D20 removeobject VAR_LAST_TALKED clearflag FLAG_HIDE_RUSTBORO_CITY_DEVON_CORP_3F_EMPLOYEE @@ -196,13 +196,13 @@ Route116_EventScript_1F2E1B:: @ 81F2E1B Route116_EventScript_1F2E2A:: @ 81F2E2A delay 20 - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq Route116_EventScript_1F2E5E - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH call_if_eq Route116_EventScript_1F2E5E - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq Route116_EventScript_1F2E5E - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq Route116_EventScript_1F2E69 removeobject VAR_LAST_TALKED release diff --git a/data/maps/RustboroCity_PokemonSchool/scripts.inc b/data/maps/RustboroCity_PokemonSchool/scripts.inc index 486cefb6a..db4bf21f0 100644 --- a/data/maps/RustboroCity_PokemonSchool/scripts.inc +++ b/data/maps/RustboroCity_PokemonSchool/scripts.inc @@ -78,9 +78,9 @@ RustboroCity_PokemonSchool_EventScript_213F95:: @ 8213F95 lock faceplayer goto_if_set FLAG_RECEIVED_QUICK_CLAW, RustboroCity_PokemonSchool_EventScript_213FFB - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq RustboroCity_PokemonSchool_EventScript_213FE5 - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq RustboroCity_PokemonSchool_EventScript_213FF0 msgbox RustboroCity_PokemonSchool_Text_214433, MSGBOX_DEFAULT giveitem_std ITEM_QUICK_CLAW diff --git a/data/maps/SafariZone_South/scripts.inc b/data/maps/SafariZone_South/scripts.inc index 45273de12..a6c3629bc 100644 --- a/data/maps/SafariZone_South/scripts.inc +++ b/data/maps/SafariZone_South/scripts.inc @@ -69,8 +69,8 @@ SafariZone_South_EventScript_23D31A:: @ 823D31A msgbox SafariZone_South_Text_2A5248, MSGBOX_DEFAULT closemessage switch VAR_FACING - case 2, SafariZone_South_EventScript_23D33F - case 4, SafariZone_South_EventScript_23D359 + case DIR_NORTH, SafariZone_South_EventScript_23D33F + case DIR_EAST, SafariZone_South_EventScript_23D359 end SafariZone_South_EventScript_23D33F:: @ 823D33F diff --git a/data/maps/SeafloorCavern_Entrance/scripts.inc b/data/maps/SeafloorCavern_Entrance/scripts.inc index a85443399..e10b52d00 100644 --- a/data/maps/SeafloorCavern_Entrance/scripts.inc +++ b/data/maps/SeafloorCavern_Entrance/scripts.inc @@ -18,11 +18,11 @@ SeafloorCavern_Entrance_EventScript_234485:: @ 8234485 applymovement 1, Common_Movement_Delay48 waitmovement 0 delay 20 - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq SeafloorCavern_Entrance_EventScript_23452E - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq SeafloorCavern_Entrance_EventScript_234523 - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq SeafloorCavern_Entrance_EventScript_234539 delay 30 setvar VAR_HAS_TALKED_TO_SEAFLOOR_CAVERN_ENTRANCE_GRUNT, 1 @@ -35,11 +35,11 @@ SeafloorCavern_Entrance_EventScript_234485:: @ 8234485 end SeafloorCavern_Entrance_EventScript_2344ED:: @ 82344ED - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq SeafloorCavern_Entrance_EventScript_23452E - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq SeafloorCavern_Entrance_EventScript_234523 - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq SeafloorCavern_Entrance_EventScript_234539 msgbox SeafloorCavern_Entrance_Text_2346C8, MSGBOX_DEFAULT closemessage diff --git a/data/maps/SlateportCity_Harbor/scripts.inc b/data/maps/SlateportCity_Harbor/scripts.inc index 20d3bdab4..aa0eaab77 100644 --- a/data/maps/SlateportCity_Harbor/scripts.inc +++ b/data/maps/SlateportCity_Harbor/scripts.inc @@ -230,9 +230,9 @@ SlateportCity_Harbor_EventScript_20CBE9:: @ 820CBE9 waitmovement 0 delay 30 hideobjectat VAR_LAST_TALKED, MAP_SLATEPORT_CITY_HARBOR - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq SlateportCity_Harbor_EventScript_20CC42 - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq SlateportCity_Harbor_EventScript_20CC37 delay 30 hideobjectat EVENT_OBJ_ID_PLAYER, MAP_PETALBURG_CITY diff --git a/data/maps/SlateportCity_OceanicMuseum_1F/scripts.inc b/data/maps/SlateportCity_OceanicMuseum_1F/scripts.inc index e68789f0b..f0a4305c1 100644 --- a/data/maps/SlateportCity_OceanicMuseum_1F/scripts.inc +++ b/data/maps/SlateportCity_OceanicMuseum_1F/scripts.inc @@ -165,13 +165,13 @@ SlateportCity_OceanicMuseum_1F_EventScript_20AEF8:: @ 820AEF8 setflag FLAG_RECEIVED_TM46 msgbox SlateportCity_OceanicMuseum_1F_Text_20B449, MSGBOX_DEFAULT closemessage - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH goto_if_eq SlateportCity_OceanicMuseum_1F_EventScript_20AF6C - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH goto_if_eq SlateportCity_OceanicMuseum_1F_EventScript_20AF83 - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST goto_if_eq SlateportCity_OceanicMuseum_1F_EventScript_20AF93 - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST goto_if_eq SlateportCity_OceanicMuseum_1F_EventScript_20AF93 end diff --git a/data/maps/SlateportCity_OceanicMuseum_2F/scripts.inc b/data/maps/SlateportCity_OceanicMuseum_2F/scripts.inc index d7a2185f0..ab47c1dea 100644 --- a/data/maps/SlateportCity_OceanicMuseum_2F/scripts.inc +++ b/data/maps/SlateportCity_OceanicMuseum_2F/scripts.inc @@ -16,21 +16,21 @@ SlateportCity_OceanicMuseum_2F_EventScript_20BB00:: @ 820BB00 applymovement 3, SlateportCity_OceanicMuseum_2F_Movement_20BCE8 applymovement 4, SlateportCity_OceanicMuseum_2F_Movement_20BCF5 waitmovement 0 - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH call_if_eq SlateportCity_OceanicMuseum_2F_EventScript_20BC92 - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq SlateportCity_OceanicMuseum_2F_EventScript_20BC92 msgbox SlateportCity_OceanicMuseum_2F_Text_20BE40, MSGBOX_DEFAULT - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_ne SlateportCity_OceanicMuseum_2F_EventScript_20BC9D msgbox SlateportCity_OceanicMuseum_2F_Text_20BE69, MSGBOX_DEFAULT msgbox SlateportCity_OceanicMuseum_2F_Text_20BE93, MSGBOX_DEFAULT closemessage applymovement 4, SlateportCity_OceanicMuseum_2F_Movement_20BCE2 waitmovement 0 - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH call_if_eq SlateportCity_OceanicMuseum_2F_EventScript_20BCA8 - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq SlateportCity_OceanicMuseum_2F_EventScript_20BCB3 trainerbattle_no_intro TRAINER_GRUNT_14, SlateportCity_OceanicMuseum_2F_Text_20BEE2 msgbox SlateportCity_OceanicMuseum_2F_Text_20BEFA, MSGBOX_DEFAULT diff --git a/data/maps/SootopolisCity/scripts.inc b/data/maps/SootopolisCity/scripts.inc index 58bb63dbb..817ae4402 100644 --- a/data/maps/SootopolisCity/scripts.inc +++ b/data/maps/SootopolisCity/scripts.inc @@ -959,9 +959,9 @@ SootopolisCity_EventScript_1E61C2:: @ 81E61C2 SootopolisCity_EventScript_1E61CC:: @ 81E61CC msgbox SootopolisCity_Text_1E75CB, MSGBOX_DEFAULT closemessage - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq SootopolisCity_EventScript_1E6243 - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq SootopolisCity_EventScript_1E6255 msgbox SootopolisCity_Text_1E7737, MSGBOX_DEFAULT closemessage @@ -1354,11 +1354,11 @@ SootopolisCity_EventScript_1E646F:: @ 81E646F setflag FLAG_RECEIVED_HM07 msgbox SootopolisCity_Text_1E7B86, MSGBOX_DEFAULT closemessage - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq SootopolisCity_EventScript_1E64B2 - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq SootopolisCity_EventScript_1E64B2 - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq SootopolisCity_EventScript_1E64C5 release end diff --git a/data/maps/SootopolisCity_MysteryEventsHouse_1F/scripts.inc b/data/maps/SootopolisCity_MysteryEventsHouse_1F/scripts.inc index 4480cf40f..e6e522908 100644 --- a/data/maps/SootopolisCity_MysteryEventsHouse_1F/scripts.inc +++ b/data/maps/SootopolisCity_MysteryEventsHouse_1F/scripts.inc @@ -109,11 +109,11 @@ SootopolisCity_MysteryEventsHouse_1F_EventScript_227A58:: @ 8227A58 special ReducePlayerPartyToSelectedMons msgbox SootopolisCity_MysteryEventsHouse_1F_Text_227D21, MSGBOX_DEFAULT closemessage - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq SootopolisCity_MysteryEventsHouse_1F_EventScript_227AFE - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq SootopolisCity_MysteryEventsHouse_1F_EventScript_227B10 - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq SootopolisCity_MysteryEventsHouse_1F_EventScript_227B22 warp MAP_SOOTOPOLIS_CITY_MYSTERY_EVENTS_HOUSE_B1F, 255, 3, 1 waitstate diff --git a/data/scripts/apprentice.inc b/data/scripts/apprentice.inc index b75a3c579..7eae99dcf 100644 --- a/data/scripts/apprentice.inc +++ b/data/scripts/apprentice.inc @@ -74,7 +74,7 @@ Script_Apprentice_FirstMeetingNag: release releaseall switch VAR_FACING - case 2, Script_Apprentice_LeaveGoRight + case DIR_NORTH, Script_Apprentice_LeaveGoRight goto Script_Apprentice_Leave end @@ -117,7 +117,7 @@ BattleFrontier_BattleTowerLobby_EventScript_2B69D3: release releaseall switch VAR_FACING - case 2, Script_Apprentice_LeaveGoRight + case DIR_NORTH, Script_Apprentice_LeaveGoRight goto Script_Apprentice_Leave end @@ -163,7 +163,7 @@ BattleFrontier_BattleTowerLobby_EventScript_2B6B09: release releaseall switch VAR_FACING - case 2, Script_Apprentice_LeaveGoRight + case DIR_NORTH, Script_Apprentice_LeaveGoRight goto Script_Apprentice_Leave end @@ -187,7 +187,7 @@ BattleFrontier_BattleTowerLobby_EventScript_2B6BD4: release releaseall switch VAR_FACING - case 2, Script_Apprentice_LeaveGoRight + case DIR_NORTH, Script_Apprentice_LeaveGoRight goto Script_Apprentice_Leave end @@ -235,7 +235,7 @@ BattleFrontier_BattleTowerLobby_EventScript_2B6C77: release releaseall switch VAR_FACING - case 2, Script_Apprentice_LeaveGoRight + case DIR_NORTH, Script_Apprentice_LeaveGoRight goto Script_Apprentice_Leave end @@ -261,7 +261,7 @@ BattleFrontier_BattleTowerLobby_EventScript_2B6D5C: release releaseall switch VAR_FACING - case 2, Script_Apprentice_LeaveGoRight + case DIR_NORTH, Script_Apprentice_LeaveGoRight goto Script_Apprentice_Leave end @@ -283,7 +283,7 @@ BattleFrontier_BattleTowerLobby_EventScript_2B6DD4: release releaseall switch VAR_FACING - case 2, Script_Apprentice_LeaveGoRight + case DIR_NORTH, Script_Apprentice_LeaveGoRight goto Script_Apprentice_Leave end diff --git a/data/scripts/gabby_and_ty.inc b/data/scripts/gabby_and_ty.inc index af9688f55..0f8d71f6b 100644 --- a/data/scripts/gabby_and_ty.inc +++ b/data/scripts/gabby_and_ty.inc @@ -214,11 +214,11 @@ Route120_EventScript_28CF36:: @ 828CF36 Route111_EventScript_28CF56:: @ 828CF56 special GabbyAndTyBeforeInterview special GabbyAndTySetScriptVarsToEventObjectLocalIds - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq Route111_EventScript_28CF94 - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH call_if_eq Route111_EventScript_28CF9F - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq Route111_EventScript_28CFB1 goto_if_set FLAG_TEMP_1, Route111_EventScript_28D0EE msgbox Route111_Text_28B042, MSGBOX_YESNO @@ -247,11 +247,11 @@ Route118_EventScript_28CFC3:: @ 828CFC3 Route120_EventScript_28CFC3:: @ 828CFC3 special GabbyAndTyBeforeInterview special GabbyAndTySetScriptVarsToEventObjectLocalIds - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq Route111_EventScript_28CF94 - compare VAR_FACING, 1 + compare VAR_FACING, DIR_SOUTH call_if_eq Route111_EventScript_28CF9F - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq Route111_EventScript_28CFB1 goto_if_set FLAG_TEMP_1, Route111_EventScript_28D0EE specialvar VAR_RESULT, GabbyAndTyGetLastQuote diff --git a/data/scripts/secret_power_tm.inc b/data/scripts/secret_power_tm.inc index 647064829..51a327142 100644 --- a/data/scripts/secret_power_tm.inc +++ b/data/scripts/secret_power_tm.inc @@ -51,11 +51,11 @@ Route111_EventScript_27661E:: @ 827661E closemessage setflag FLAG_RECEIVED_SECRET_POWER clearflag FLAG_HIDE_SLATEPORT_CITY_TM_SALESMAN - compare VAR_FACING, 3 + compare VAR_FACING, DIR_WEST call_if_eq Route111_EventScript_27666A - compare VAR_FACING, 4 + compare VAR_FACING, DIR_EAST call_if_eq Route111_EventScript_27666A - compare VAR_FACING, 2 + compare VAR_FACING, DIR_NORTH call_if_eq Route111_EventScript_276675 removeobject VAR_LAST_TALKED release diff --git a/include/constants/event_object_movement_constants.h b/include/constants/event_object_movement_constants.h index b1f9b4cb5..ed6f6c7fb 100755 --- a/include/constants/event_object_movement_constants.h +++ b/include/constants/event_object_movement_constants.h @@ -179,8 +179,8 @@ #define MOVEMENT_ACTION_CLEAR_FIXED_PRIORITY 0x5D #define MOVEMENT_ACTION_INIT_AFFINE_ANIM 0x5E #define MOVEMENT_ACTION_CLEAR_AFFINE_ANIM 0x5F -#define MOVEMENT_ACTION_UNKNOWN1 0x60 -#define MOVEMENT_ACTION_UNKNOWN2 0x61 +#define MOVEMENT_ACTION_HIDE_REFLECTION 0x60 +#define MOVEMENT_ACTION_SHOW_REFLECTION 0x61 #define MOVEMENT_ACTION_WALK_DOWN_START_AFFINE 0x62 #define MOVEMENT_ACTION_WALK_DOWN_AFFINE 0x63 #define MOVEMENT_ACTION_ACRO_WHEELIE_FACE_DOWN 0x64 diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index a17180589..de08fd1ec 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -65,7 +65,7 @@ struct EventObjectTemplate /*0x0E*/ u16 trainerRange_berryTreeId; /*0x10*/ const u8 *script; /*0x14*/ u16 flagId; -}; /*size = 0x18*/ +}; struct WarpEvent { @@ -82,7 +82,6 @@ struct CoordEvent u8 elevation; u16 trigger; u16 index; - u8 filler_A[0x2]; u8 *script; }; @@ -90,20 +89,14 @@ struct BgEvent { u16 x, y; u8 elevation; - u8 kind; - union { // carried over from diego's FR/LG work, seems to be the same struct - // in gen 3, "kind" (0x3 in BgEvent struct) determines the method to read the union. + u8 kind; // The "kind" field determines how to access bgUnion union below. + union { u8 *script; - - // hidden item type struct { u16 item; - u16 hiddenItemId; // flag offset to determine flag lookup + u16 hiddenItemId; } hiddenItem; - - // secret base type u32 secretBaseId; - } bgUnion; }; @@ -113,7 +106,6 @@ struct MapEvents u8 warpCount; u8 coordEventCount; u8 bgEventCount; - struct EventObjectTemplate *eventObjects; struct WarpEvent *warps; struct CoordEvent *coordEvents; @@ -122,10 +114,10 @@ struct MapEvents struct MapConnection { - /*0x00*/ u8 direction; - /*0x01*/ u32 offset; - /*0x05*/ u8 mapGroup; - /*0x06*/ u8 mapNum; + u8 direction; + u32 offset; + u8 mapGroup; + u8 mapNum; }; struct MapConnections @@ -180,7 +172,7 @@ struct EventObject /*0x03*/ u32 spriteAffineAnimPausedBackup:1; u32 disableJumpLandingGroundEffect:1; u32 fixedPriority:1; - u32 unk3_3:1; + u32 hideReflection:1; /*0x04*/ u8 spriteId; /*0x05*/ u8 graphicsId; /*0x06*/ u8 movementType; @@ -267,7 +259,20 @@ enum enum { - COLLISION_LEDGE_JUMP = 6 + COLLISION_NONE, + COLLISION_OUTSIDE_RANGE, + COLLISION_IMPASSABLE, + COLLISION_ELEVATION_MISMATCH, + COLLISION_EVENT_OBJECT, + COLLISION_STOP_SURFING, + COLLISION_LEDGE_JUMP, + COLLISION_PUSHED_BOULDER, + COLLISION_ROTATING_GATE, + COLLISION_WHEELIE_HOP, + COLLISION_ISOLATED_VERTICAL_RAIL, + COLLISION_ISOLATED_HORIZONTAL_RAIL, + COLLISION_VERTICAL_RAIL, + COLLISION_HORIZONTAL_RAIL, }; // player running states diff --git a/src/bike.c b/src/bike.c index 7f84f350b..fad61ffab 100644 --- a/src/bike.c +++ b/src/bike.c @@ -45,8 +45,8 @@ static u8 AcroBike_GetJumpDirection(void); static void Bike_UpdateDirTimerHistory(u8); static void Bike_UpdateABStartSelectHistory(u8); static u8 Bike_DPadToDirection(u16); -static u8 get_some_collision(u8); -static u8 Bike_CheckCollisionTryAdvanceCollisionCount(struct EventObject *, s16, s16, u8, u8); +static u8 GetBikeCollision(u8); +static u8 GetBikeCollisionAt(struct EventObject *, s16, s16, u8, u8); static bool8 IsRunningDisallowedByMetatile(u8); static void Bike_TryAdvanceCyclingRoadCollisions(); static u8 CanBikeFaceDirOnMetatile(u8, u8); @@ -214,8 +214,8 @@ static void MachBikeTransition_TrySpeedUp(u8 direction) } else { - collision = get_some_collision(direction); - if (collision > 0 && collision < 12) + collision = GetBikeCollision(direction); + if (collision > 0 && collision < COLLISION_VERTICAL_RAIL) { // we hit a solid object, but check to see if its a ledge and then jump. if (collision == COLLISION_LEDGE_JUMP) @@ -226,9 +226,9 @@ static void MachBikeTransition_TrySpeedUp(u8 direction) { // we hit a solid object that is not a ledge, so perform the collision. Bike_SetBikeStill(); - if (collision == 4 && IsPlayerCollidingWithFarawayIslandMew(direction)) + if (collision == COLLISION_EVENT_OBJECT && IsPlayerCollidingWithFarawayIslandMew(direction)) PlayerOnBikeCollideWithFarawayIslandMew(direction); - else if (collision < 5 || collision > 8) + else if (collision < COLLISION_STOP_SURFING || collision > COLLISION_ROTATING_GATE) PlayerOnBikeCollide(direction); } } @@ -250,9 +250,9 @@ static void MachBikeTransition_TrySlowDown(u8 direction) if (gPlayerAvatar.bikeSpeed != SPEED_STANDING) gPlayerAvatar.bikeFrameCounter = --gPlayerAvatar.bikeSpeed; - collision = get_some_collision(direction); + collision = GetBikeCollision(direction); - if (collision > 0 && collision < 12) + if (collision > 0 && collision < COLLISION_VERTICAL_RAIL) { if (collision == COLLISION_LEDGE_JUMP) { @@ -261,9 +261,9 @@ static void MachBikeTransition_TrySlowDown(u8 direction) else { Bike_SetBikeStill(); - if (collision == 4 && IsPlayerCollidingWithFarawayIslandMew(direction)) + if (collision == COLLISION_EVENT_OBJECT && IsPlayerCollidingWithFarawayIslandMew(direction)) PlayerOnBikeCollideWithFarawayIslandMew(direction); - else if (collision < 5 || collision > 8) + else if (collision < COLLISION_STOP_SURFING || collision > COLLISION_ROTATING_GATE) PlayerOnBikeCollide(direction); } } @@ -552,14 +552,14 @@ static void AcroBikeTransition_Moving(u8 direction) AcroBikeTransition_FaceDirection(playerEventObj->movementDirection); return; } - collision = get_some_collision(direction); - if (collision > 0 && collision < 12) + collision = GetBikeCollision(direction); + if (collision > 0 && collision < COLLISION_VERTICAL_RAIL) { if (collision == COLLISION_LEDGE_JUMP) PlayerJumpLedge(direction); - else if (collision == 4 && IsPlayerCollidingWithFarawayIslandMew(direction)) + else if (collision == COLLISION_EVENT_OBJECT && IsPlayerCollidingWithFarawayIslandMew(direction)) PlayerOnBikeCollideWithFarawayIslandMew(direction); - else if (collision < 5 || collision > 8) + else if (collision < COLLISION_STOP_SURFING || collision > COLLISION_ROTATING_GATE) PlayerOnBikeCollide(direction); } else @@ -614,19 +614,19 @@ static void AcroBikeTransition_WheelieHoppingMoving(u8 direction) AcroBikeTransition_WheelieHoppingStanding(playerEventObj->movementDirection); return; } - collision = get_some_collision(direction); + collision = GetBikeCollision(direction); // TODO: Try to get rid of this goto - if (collision == 0 || collision == 9) + if (collision == 0 || collision == COLLISION_WHEELIE_HOP) { goto derp; } - else if (collision == 6) + else if (collision == COLLISION_LEDGE_JUMP) { PlayerLedgeHoppingWheelie(direction); } - else if (collision < 5 || collision > 8) + else if (collision < COLLISION_STOP_SURFING || collision > COLLISION_ROTATING_GATE) { - if (collision <= 11) + if (collision < COLLISION_VERTICAL_RAIL) { AcroBikeTransition_WheelieHoppingStanding(direction); } @@ -643,12 +643,12 @@ static void AcroBikeTransition_SideJump(u8 direction) u8 collision; struct EventObject *playerEventObj; - collision = get_some_collision(direction); - if (collision != 0) + collision = GetBikeCollision(direction); + if (collision) { - if (collision == 7) + if (collision == COLLISION_PUSHED_BOULDER) return; - if (collision < 10) + if (collision < COLLISION_ISOLATED_VERTICAL_RAIL) { AcroBikeTransition_TurnDirection(direction); return; @@ -680,18 +680,18 @@ static void AcroBikeTransition_WheelieMoving(u8 direction) PlayerIdleWheelie(playerEventObj->movementDirection); return; } - collision = get_some_collision(direction); - if (collision > 0 && collision < 12) + collision = GetBikeCollision(direction); + if (collision > 0 && collision < COLLISION_VERTICAL_RAIL) { - if (collision == 6) + if (collision == COLLISION_LEDGE_JUMP) { PlayerLedgeHoppingWheelie(direction); } - else if (collision == 9) + else if (collision == COLLISION_WHEELIE_HOP) { PlayerIdleWheelie(direction); } - else if (collision <= 4) + else if (collision < COLLISION_STOP_SURFING) { if (MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior)) PlayerIdleWheelie(direction); @@ -714,18 +714,18 @@ static void AcroBikeTransition_WheelieRisingMoving(u8 direction) PlayerStartWheelie(playerEventObj->movementDirection); return; } - collision = get_some_collision(direction); - if (collision > 0 && collision < 12) + collision = GetBikeCollision(direction); + if (collision > 0 && collision < COLLISION_VERTICAL_RAIL) { - if (collision == 6) + if (collision == COLLISION_LEDGE_JUMP) { PlayerLedgeHoppingWheelie(direction); } - else if (collision == 9) + else if (collision == COLLISION_WHEELIE_HOP) { PlayerIdleWheelie(direction); } - else if (collision <= 4) + else if (collision < COLLISION_STOP_SURFING) { if (MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior)) PlayerIdleWheelie(direction); @@ -748,12 +748,12 @@ static void AcroBikeTransition_WheelieLoweringMoving(u8 direction) PlayerEndWheelie(playerEventObj->movementDirection); return; } - collision = get_some_collision(direction); - if (collision > 0 && collision < 12) + collision = GetBikeCollision(direction); + if (collision > 0 && collision < COLLISION_VERTICAL_RAIL) { - if (collision == 6) + if (collision == COLLISION_LEDGE_JUMP) PlayerJumpLedge(direction); - else if (collision < 5 || collision > 8) + else if (collision < COLLISION_STOP_SURFING || collision > COLLISION_ROTATING_GATE) PlayerEndWheelie(direction); return; } @@ -865,29 +865,26 @@ static u8 Bike_DPadToDirection(u16 heldKeys) return DIR_NONE; } -static u8 get_some_collision(u8 direction) +static u8 GetBikeCollision(u8 direction) { - s16 x; - s16 y; u8 metatitleBehavior; struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; - - x = playerEventObj->currentCoords.x; - y = playerEventObj->currentCoords.y; + s16 x = playerEventObj->currentCoords.x; + s16 y = playerEventObj->currentCoords.y; MoveCoords(direction, &x, &y); metatitleBehavior = MapGridGetMetatileBehaviorAt(x, y); - return Bike_CheckCollisionTryAdvanceCollisionCount(playerEventObj, x, y, direction, metatitleBehavior); + return GetBikeCollisionAt(playerEventObj, x, y, direction, metatitleBehavior); } -static u8 Bike_CheckCollisionTryAdvanceCollisionCount(struct EventObject *eventObject, s16 x, s16 y, u8 direction, u8 metatitleBehavior) +static u8 GetBikeCollisionAt(struct EventObject *eventObject, s16 x, s16 y, u8 direction, u8 metatitleBehavior) { u8 collision = CheckForEventObjectCollision(eventObject, x, y, direction, metatitleBehavior); - if (collision > 4) + if (collision > COLLISION_EVENT_OBJECT) return collision; - if (collision == 0 && IsRunningDisallowedByMetatile(metatitleBehavior)) - collision = 2; + if (collision == COLLISION_NONE && IsRunningDisallowedByMetatile(metatitleBehavior)) + collision = COLLISION_IMPASSABLE; if (collision) Bike_TryAdvanceCyclingRoadCollisions(); @@ -941,10 +938,10 @@ static bool8 WillPlayerCollideWithCollision(u8 newTileCollision, u8 direction) { if (direction == DIR_NORTH || direction == DIR_SOUTH) { - if (newTileCollision == 10 || newTileCollision == 12) + if (newTileCollision == COLLISION_ISOLATED_VERTICAL_RAIL || newTileCollision == COLLISION_VERTICAL_RAIL) return FALSE; } - else if (newTileCollision == 11 || newTileCollision == 13) + else if (newTileCollision == COLLISION_ISOLATED_HORIZONTAL_RAIL || newTileCollision == COLLISION_HORIZONTAL_RAIL) { return FALSE; } diff --git a/src/data/field_event_obj/movement_action_func_tables.h b/src/data/field_event_obj/movement_action_func_tables.h index 712988f5e..8e136b58b 100755 --- a/src/data/field_event_obj/movement_action_func_tables.h +++ b/src/data/field_event_obj/movement_action_func_tables.h @@ -170,8 +170,8 @@ u8 MovementAction_SetFixedPriority_Step0(struct EventObject *, struct Sprite *); u8 MovementAction_ClearFixedPriority_Step0(struct EventObject *, struct Sprite *); u8 MovementAction_InitAffineAnim_Step0(struct EventObject *, struct Sprite *); u8 MovementAction_ClearAffineAnim_Step0(struct EventObject *, struct Sprite *); -u8 MovementAction_Unknown1_Step0(struct EventObject *, struct Sprite *); -u8 MovementAction_Unknown2_Step0(struct EventObject *, struct Sprite *); +u8 MovementAction_HideReflection_Step0(struct EventObject *, struct Sprite *); +u8 MovementAction_ShowReflection_Step0(struct EventObject *, struct Sprite *); u8 MovementAction_WalkDownStartAffine_Step0(struct EventObject *, struct Sprite *); u8 MovementAction_WalkDownStartAffine_Step1(struct EventObject *, struct Sprite *); u8 MovementAction_WalkDownAffine_Step0(struct EventObject *, struct Sprite *); @@ -358,8 +358,8 @@ u8 (*const gMovementActionFuncs_SetFixedPriority[])(struct EventObject *, struct u8 (*const gMovementActionFuncs_ClearFixedPriority[])(struct EventObject *, struct Sprite *); u8 (*const gMovementActionFuncs_InitAffineAnim[])(struct EventObject *, struct Sprite *); u8 (*const gMovementActionFuncs_ClearAffineAnim[])(struct EventObject *, struct Sprite *); -u8 (*const gMovementActionFuncs_Unknown1[])(struct EventObject *, struct Sprite *); -u8 (*const gMovementActionFuncs_Unknown2[])(struct EventObject *, struct Sprite *); +u8 (*const gMovementActionFuncs_HideReflection[])(struct EventObject *, struct Sprite *); +u8 (*const gMovementActionFuncs_ShowReflection[])(struct EventObject *, struct Sprite *); u8 (*const gMovementActionFuncs_WalkDownStartAffine[])(struct EventObject *, struct Sprite *); u8 (*const gMovementActionFuncs_WalkDownAffine[])(struct EventObject *, struct Sprite *); u8 (*const gMovementActionFuncs_AcroWheelieFaceDown[])(struct EventObject *, struct Sprite *); @@ -518,8 +518,8 @@ u8 (*const *const gMovementActionFuncs[])(struct EventObject *, struct Sprite *) [MOVEMENT_ACTION_CLEAR_FIXED_PRIORITY] = gMovementActionFuncs_ClearFixedPriority, [MOVEMENT_ACTION_INIT_AFFINE_ANIM] = gMovementActionFuncs_InitAffineAnim, [MOVEMENT_ACTION_CLEAR_AFFINE_ANIM] = gMovementActionFuncs_ClearAffineAnim, - [MOVEMENT_ACTION_UNKNOWN1] = gMovementActionFuncs_Unknown1, - [MOVEMENT_ACTION_UNKNOWN2] = gMovementActionFuncs_Unknown2, + [MOVEMENT_ACTION_HIDE_REFLECTION] = gMovementActionFuncs_HideReflection, + [MOVEMENT_ACTION_SHOW_REFLECTION] = gMovementActionFuncs_ShowReflection, [MOVEMENT_ACTION_WALK_DOWN_START_AFFINE] = gMovementActionFuncs_WalkDownStartAffine, [MOVEMENT_ACTION_WALK_DOWN_AFFINE] = gMovementActionFuncs_WalkDownAffine, [MOVEMENT_ACTION_ACRO_WHEELIE_FACE_DOWN] = gMovementActionFuncs_AcroWheelieFaceDown, @@ -1197,13 +1197,13 @@ u8 (*const gMovementActionFuncs_ClearAffineAnim[])(struct EventObject *, struct MovementAction_Finish, }; -u8 (*const gMovementActionFuncs_Unknown1[])(struct EventObject *, struct Sprite *) = { - MovementAction_Unknown1_Step0, +u8 (*const gMovementActionFuncs_HideReflection[])(struct EventObject *, struct Sprite *) = { + MovementAction_HideReflection_Step0, MovementAction_Finish, }; -u8 (*const gMovementActionFuncs_Unknown2[])(struct EventObject *, struct Sprite *) = { - MovementAction_Unknown2_Step0, +u8 (*const gMovementActionFuncs_ShowReflection[])(struct EventObject *, struct Sprite *) = { + MovementAction_ShowReflection_Step0, MovementAction_Finish, }; diff --git a/src/event_object_movement.c b/src/event_object_movement.c index c493c6d87..b3daaad67 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -2723,9 +2723,8 @@ bool8 MovementType_WanderAround_Step4(struct EventObject *eventObject, struct Sp SetEventObjectDirection(eventObject, chosenDirection); sprite->data[1] = 5; if (GetCollisionInDirection(eventObject, chosenDirection)) - { sprite->data[1] = 1; - } + return TRUE; } @@ -3093,9 +3092,8 @@ bool8 MovementType_WanderUpAndDown_Step4(struct EventObject *eventObject, struct SetEventObjectDirection(eventObject, direction); sprite->data[1] = 5; if (GetCollisionInDirection(eventObject, direction)) - { sprite->data[1] = 1; - } + return TRUE; } @@ -3163,9 +3161,8 @@ bool8 MovementType_WanderLeftAndRight_Step4(struct EventObject *eventObject, str SetEventObjectDirection(eventObject, direction); sprite->data[1] = 5; if (GetCollisionInDirection(eventObject, direction)) - { sprite->data[1] = 1; - } + return TRUE; } @@ -3952,7 +3949,7 @@ bool8 MovementType_WalkBackAndForth_Step1(struct EventObject *eventObject, struc bool8 MovementType_WalkBackAndForth_Step2(struct EventObject *eventObject, struct Sprite *sprite) { - bool8 collisionState; + bool8 collision; u8 movementActionId; if (eventObject->directionSequenceIndex && eventObject->initialCoords.x == eventObject->currentCoords.x && eventObject->initialCoords.y == eventObject->currentCoords.y) @@ -3960,19 +3957,19 @@ bool8 MovementType_WalkBackAndForth_Step2(struct EventObject *eventObject, struc eventObject->directionSequenceIndex = 0; SetEventObjectDirection(eventObject, GetOppositeDirection(eventObject->movementDirection)); } - collisionState = GetCollisionInDirection(eventObject, eventObject->movementDirection); + collision = GetCollisionInDirection(eventObject, eventObject->movementDirection); movementActionId = GetWalkNormalMovementAction(eventObject->movementDirection); - if (collisionState == TRUE) + if (collision == COLLISION_OUTSIDE_RANGE) { eventObject->directionSequenceIndex++; SetEventObjectDirection(eventObject, GetOppositeDirection(eventObject->movementDirection)); movementActionId = GetWalkNormalMovementAction(eventObject->movementDirection); - collisionState = GetCollisionInDirection(eventObject, eventObject->movementDirection); + collision = GetCollisionInDirection(eventObject, eventObject->movementDirection); } - if (collisionState) - { + + if (collision) movementActionId = GetWalkInPlaceNormalMovementAction(eventObject->facingDirection); - } + EventObjectSetSingleMovement(eventObject, sprite, movementActionId); eventObject->singleMovementActive = 1; sprite->data[1] = 3; @@ -3998,27 +3995,26 @@ bool8 MovementType_WalkSequence_Step0(struct EventObject *eventObject, struct Sp bool8 MoveNextDirectionInSequence(struct EventObject *eventObject, struct Sprite *sprite, u8 *route) { - u8 collisionState; + u8 collision; u8 movementActionId; if (eventObject->directionSequenceIndex == 3 && eventObject->initialCoords.x == eventObject->currentCoords.x && eventObject->initialCoords.y == eventObject->currentCoords.y) - { eventObject->directionSequenceIndex = 0; - } + SetEventObjectDirection(eventObject, route[eventObject->directionSequenceIndex]); movementActionId = GetWalkNormalMovementAction(eventObject->movementDirection); - collisionState = GetCollisionInDirection(eventObject, eventObject->movementDirection); - if (collisionState == TRUE) + collision = GetCollisionInDirection(eventObject, eventObject->movementDirection); + if (collision == COLLISION_OUTSIDE_RANGE) { eventObject->directionSequenceIndex++; SetEventObjectDirection(eventObject, route[eventObject->directionSequenceIndex]); movementActionId = GetWalkNormalMovementAction(eventObject->movementDirection); - collisionState = GetCollisionInDirection(eventObject, eventObject->movementDirection); + collision = GetCollisionInDirection(eventObject, eventObject->movementDirection); } - if (collisionState) - { + + if (collision) movementActionId = GetWalkInPlaceNormalMovementAction(eventObject->facingDirection); - } + EventObjectSetSingleMovement(eventObject, sprite, movementActionId); eventObject->singleMovementActive = 1; sprite->data[1] = 2; @@ -4868,22 +4864,20 @@ static u8 GetCollisionInDirection(struct EventObject *eventObject, u8 direction) return GetCollisionAtCoords(eventObject, x, y, direction); } -u8 GetCollisionAtCoords(struct EventObject *eventObject, s16 x, s16 y, u32 dirn) +u8 GetCollisionAtCoords(struct EventObject *eventObject, s16 x, s16 y, u32 dir) { - u8 direction; - - direction = dirn; + u8 direction = dir; if (IsCoordOutsideEventObjectMovementRange(eventObject, x, y)) - return 1; + return COLLISION_OUTSIDE_RANGE; else if (MapGridIsImpassableAt(x, y) || GetMapBorderIdAt(x, y) == -1 || IsMetatileDirectionallyImpassable(eventObject, x, y, direction)) - return 2; + return COLLISION_IMPASSABLE; else if (eventObject->trackedByCamera && !CanCameraMoveInDirection(direction)) - return 2; + return COLLISION_IMPASSABLE; else if (IsZCoordMismatchAt(eventObject->currentElevation, x, y)) - return 3; + return COLLISION_ELEVATION_MISMATCH; else if (DoesObjectCollideWithObjectAt(eventObject, x, y)) - return 4; - return 0; + return COLLISION_EVENT_OBJECT; + return COLLISION_NONE; } u8 GetCollisionFlagsAtCoords(struct EventObject *eventObject, s16 x, s16 y, u8 direction) @@ -6831,15 +6825,15 @@ bool8 MovementAction_ClearAffineAnim_Step0(struct EventObject *eventObject, stru return TRUE; } -bool8 MovementAction_Unknown1_Step0(struct EventObject *eventObject, struct Sprite *sprite) +bool8 MovementAction_HideReflection_Step0(struct EventObject *eventObject, struct Sprite *sprite) { - eventObject->unk3_3 = TRUE; + eventObject->hideReflection = TRUE; return TRUE; } -bool8 MovementAction_Unknown2_Step0(struct EventObject *eventObject, struct Sprite *sprite) +bool8 MovementAction_ShowReflection_Step0(struct EventObject *eventObject, struct Sprite *sprite) { - eventObject->unk3_3 = FALSE; + eventObject->hideReflection = FALSE; return TRUE; } diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c index fb883b105..8db58ad7a 100755 --- a/src/field_effect_helpers.c +++ b/src/field_effect_helpers.c @@ -143,7 +143,7 @@ static void UpdateObjectReflectionSprite(struct Sprite *reflectionSprite) reflectionSprite->pos2.y = -mainSprite->pos2.y; reflectionSprite->coordOffsetEnabled = mainSprite->coordOffsetEnabled; - if (eventObject->unk3_3 == TRUE) + if (eventObject->hideReflection == TRUE) reflectionSprite->invisible = TRUE; // Check if the reflection is not still. diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 6d62cdc4a..229e5aedb 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -71,10 +71,10 @@ static void PlayerNotOnBikeMoving(u8, u16); static u8 CheckForPlayerAvatarCollision(u8); static u8 sub_808B028(u8); static u8 sub_808B164(struct EventObject *, s16, s16, u8, u8); -static bool8 sub_808B1BC(s16, s16, u8); +static bool8 CanStopSurfing(s16, s16, u8); static bool8 ShouldJumpLedge(s16, s16, u8); -static u8 sub_808B238(s16, s16, u8); -static void check_acro_bike_metatile(s16, s16, u8, u8 *); +static bool8 TryPushBoulder(s16, s16, u8); +static void CheckAcroBikeCollision(s16, s16, u8, u8 *); static void DoPlayerAvatarTransition(void); static void PlayerAvatarTransition_Dummy(struct EventObject *a); @@ -115,9 +115,9 @@ static bool8 PlayerAvatar_SecretBaseMatSpinStep1(struct Task *task, struct Event static bool8 PlayerAvatar_SecretBaseMatSpinStep2(struct Task *task, struct EventObject *eventObject); static bool8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *task, struct EventObject *eventObject); -static void sub_808C750(u8); -static void taskFF_0805D1D4(u8 taskId); -static void sub_808C814(u8 taskId); +static void CreateStopSurfingTask(u8); +static void Task_StopSurfingInit(u8 taskId); +static void Task_WaitStopSurfing(u8 taskId); static void Task_Fishing(u8 taskId); static u8 Fishing1(struct Task *task); @@ -194,7 +194,7 @@ static void (*const gUnknown_08497490[])(u8, u16) = PlayerNotOnBikeMoving, }; -static bool8 (*const gUnknown_0849749C[])(u8) = +static bool8 (*const sAcroBikeTrickMetatiles[])(u8) = { MetatileBehavior_IsBumpySlope, MetatileBehavior_IsIsolatedVerticalRail, @@ -203,7 +203,13 @@ static bool8 (*const gUnknown_0849749C[])(u8) = MetatileBehavior_IsHorizontalRail, }; -static const u8 gUnknown_084974B0[] = {9, 10, 11, 12, 13, 0, 0, 0}; +static const u8 sAcroBikeTrickCollisionTypes[] = { + COLLISION_WHEELIE_HOP, + COLLISION_ISOLATED_VERTICAL_RAIL, + COLLISION_ISOLATED_HORIZONTAL_RAIL, + COLLISION_VERTICAL_RAIL, + COLLISION_HORIZONTAL_RAIL, +}; static void (*const gUnknown_084974B8[])(struct EventObject *) = { @@ -432,19 +438,19 @@ static bool8 ForcedMovement_None(void) static u8 DoForcedMovement(u8 direction, void (*b)(u8)) { struct PlayerAvatar *playerAvatar = &gPlayerAvatar; - u8 collisionType = CheckForPlayerAvatarCollision(direction); + u8 collision = CheckForPlayerAvatarCollision(direction); playerAvatar->flags |= PLAYER_AVATAR_FLAG_6; - if (collisionType != 0) + if (collision) { ForcedMovement_None(); - if (collisionType <= 4) + if (collision < COLLISION_STOP_SURFING) { return 0; } else { - if (collisionType == COLLISION_LEDGE_JUMP) + if (collision == COLLISION_LEDGE_JUMP) PlayerJumpLedge(direction); playerAvatar->flags |= PLAYER_AVATAR_FLAG_6; playerAvatar->runningState = MOVING; @@ -605,33 +611,26 @@ static void PlayerNotOnBikeTurningInPlace(u8 direction, u16 heldKeys) static void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys) { - u8 r0 = CheckForPlayerAvatarCollision(direction); + u8 collision = CheckForPlayerAvatarCollision(direction); - if (r0 != 0) + if (collision) { - if (r0 == 6) + if (collision == COLLISION_LEDGE_JUMP) { PlayerJumpLedge(direction); return; } - else if (r0 == 4 && IsPlayerCollidingWithFarawayIslandMew(direction) != 0) + else if (collision == COLLISION_EVENT_OBJECT && IsPlayerCollidingWithFarawayIslandMew(direction)) { PlayerNotOnBikeCollideWithFarawayIslandMew(direction); return; } else { - u8 r4 = r0 - 5; - - if (r4 > 3) - { + u8 adjustedCollision = collision - COLLISION_STOP_SURFING; + if (adjustedCollision > 3) PlayerNotOnBikeCollide(direction); - return; - } - else - { - return; - } + return; } } @@ -677,50 +676,49 @@ static u8 sub_808B028(u8 direction) return sub_808B164(playerEventObj, x, y, direction, MapGridGetMetatileBehaviorAt(x, y)); } -u8 CheckForEventObjectCollision(struct EventObject *a, s16 x, s16 y, u8 direction, u8 e) +u8 CheckForEventObjectCollision(struct EventObject *eventObject, s16 x, s16 y, u8 direction, u8 metatileBehavior) { - u8 collision; + u8 collision = GetCollisionAtCoords(eventObject, x, y, direction); + if (collision == COLLISION_ELEVATION_MISMATCH && CanStopSurfing(x, y, direction)) + return COLLISION_STOP_SURFING; - collision = GetCollisionAtCoords(a, x, y, direction); - if (collision == 3 && sub_808B1BC(x, y, direction)) - return 5; if (ShouldJumpLedge(x, y, direction)) { IncrementGameStat(GAME_STAT_JUMPED_DOWN_LEDGES); return COLLISION_LEDGE_JUMP; } - if (collision == 4 && sub_808B238(x, y, direction)) - return 7; + if (collision == COLLISION_EVENT_OBJECT && TryPushBoulder(x, y, direction)) + return COLLISION_PUSHED_BOULDER; - if (collision == 0) + if (collision == COLLISION_NONE) { if (CheckForRotatingGatePuzzleCollision(direction, x, y)) - return 8; - check_acro_bike_metatile(x, y, e, &collision); + return COLLISION_ROTATING_GATE; + CheckAcroBikeCollision(x, y, metatileBehavior, &collision); } return collision; } -static u8 sub_808B164(struct EventObject *a, s16 x, s16 y, u8 direction, u8 e) +static u8 sub_808B164(struct EventObject *eventObject, s16 x, s16 y, u8 direction, u8 metatileBehavior) { - u8 collision = GetCollisionAtCoords(a, x, y, direction); + u8 collision = GetCollisionAtCoords(eventObject, x, y, direction); - if (collision == 0) + if (collision == COLLISION_NONE) { - if (CheckForRotatingGatePuzzleCollisionWithoutAnimation(direction, x, y) != 0) - return 8; - check_acro_bike_metatile(x, y, e, &collision); + if (CheckForRotatingGatePuzzleCollisionWithoutAnimation(direction, x, y)) + return COLLISION_ROTATING_GATE; + CheckAcroBikeCollision(x, y, metatileBehavior, &collision); } return collision; } -static bool8 sub_808B1BC(s16 x, s16 y, u8 direction) +static bool8 CanStopSurfing(s16 x, s16 y, u8 direction) { if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) && MapGridGetZCoordAt(x, y) == 3 && GetEventObjectIdByXYZ(x, y, 3) == EVENT_OBJECTS_COUNT) { - sub_808C750(direction); + CreateStopSurfingTask(direction); return TRUE; } else @@ -737,7 +735,7 @@ static bool8 ShouldJumpLedge(s16 x, s16 y, u8 z) return FALSE; } -static u8 sub_808B238(s16 x, s16 y, u8 direction) +static bool8 TryPushBoulder(s16 x, s16 y, u8 direction) { if (FlagGet(FLAG_SYS_USE_STRENGTH)) { @@ -748,26 +746,26 @@ static u8 sub_808B238(s16 x, s16 y, u8 direction) x = gEventObjects[eventObjectId].currentCoords.x; y = gEventObjects[eventObjectId].currentCoords.y; MoveCoords(direction, &x, &y); - if (GetCollisionAtCoords(&gEventObjects[eventObjectId], x, y, direction) == 0 + if (GetCollisionAtCoords(&gEventObjects[eventObjectId], x, y, direction) == COLLISION_NONE && MetatileBehavior_IsNonAnimDoor(MapGridGetMetatileBehaviorAt(x, y)) == 0) { StartStrengthAnim(eventObjectId, direction); - return 1; + return TRUE; } } } - return 0; + return FALSE; } -static void check_acro_bike_metatile(s16 unused1, s16 unused2, u8 c, u8 *d) +static void CheckAcroBikeCollision(s16 x, s16 y, u8 metatileBehavior, u8 *collision) { u8 i; - for (i = 0; i < 5; i++) + for (i = 0; i < ARRAY_COUNT(sAcroBikeTrickMetatiles); i++) { - if (gUnknown_0849749C[i](c)) + if (sAcroBikeTrickMetatiles[i](metatileBehavior)) { - *d = gUnknown_084974B0[i]; + *collision = sAcroBikeTrickCollisionTypes[i]; return; } } @@ -1314,7 +1312,8 @@ bool8 IsPlayerFacingSurfableFishableWater(void) s16 y = playerEventObj->currentCoords.y; MoveCoords(playerEventObj->facingDirection, &x, &y); - if (GetCollisionAtCoords(playerEventObj, x, y, playerEventObj->facingDirection) == 3 && PlayerGetZCoord() == 3 + if (GetCollisionAtCoords(playerEventObj, x, y, playerEventObj->facingDirection) == COLLISION_ELEVATION_MISMATCH + && PlayerGetZCoord() == 3 && MetatileBehavior_IsSurfableFishableWater(MapGridGetMetatileBehaviorAt(x, y))) return TRUE; else @@ -1626,9 +1625,7 @@ static bool8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *task, struct Event return FALSE; } -/* Some Field effect */ - -static void sub_808C750(u8 a) +static void CreateStopSurfingTask(u8 direction) { u8 taskId; @@ -1638,12 +1635,12 @@ static void sub_808C750(u8 a) gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_SURFING; gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_ON_FOOT; gPlayerAvatar.preventStep = TRUE; - taskId = CreateTask(taskFF_0805D1D4, 0xFF); - gTasks[taskId].data[0] = a; - taskFF_0805D1D4(taskId); + taskId = CreateTask(Task_StopSurfingInit, 0xFF); + gTasks[taskId].data[0] = direction; + Task_StopSurfingInit(taskId); } -static void taskFF_0805D1D4(u8 taskId) +static void Task_StopSurfingInit(u8 taskId) { struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -1654,10 +1651,10 @@ static void taskFF_0805D1D4(u8 taskId) } sub_81555AC(playerEventObj->fieldEffectSpriteId, 2); EventObjectSetHeldMovement(playerEventObj, GetJumpSpecialMovementAction((u8)gTasks[taskId].data[0])); - gTasks[taskId].func = sub_808C814; + gTasks[taskId].func = Task_WaitStopSurfing; } -static void sub_808C814(u8 taskId) +static void Task_WaitStopSurfing(u8 taskId) { struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; diff --git a/src/overworld.c b/src/overworld.c index e32024c77..8a8544259 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -2742,7 +2742,7 @@ static bool32 PlayerIsAtSouthExit(struct TradeRoomPlayer *player) return FALSE; else if (!MetatileBehavior_IsSouthArrowWarp(player->field_C)) return FALSE; - else if (player->facing != 1) + else if (player->facing != DIR_SOUTH) return FALSE; else return TRUE; |