summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile11
-rw-r--r--asm/macros/battle_script.inc12
-rw-r--r--asm/macros/event.inc124
-rw-r--r--berry_fix/asm/loader.s12
-rw-r--r--berry_fix/payload/asm/crt0.s8
-rw-r--r--berry_fix/payload/asm/libagbsyscall.s12
-rw-r--r--common_syms/link.txt16
-rw-r--r--data/battle_scripts_1.s28
-rw-r--r--data/event_scripts.s4
-rw-r--r--data/maps/AbandonedShip_CaptainsOffice/scripts.inc2
-rw-r--r--data/maps/AquaHideout_B2F/scripts.inc9
-rw-r--r--data/maps/BattleFrontier_BattleArenaBattleRoom/scripts.inc103
-rw-r--r--data/maps/BattleFrontier_BattleArenaCorridor/scripts.inc8
-rw-r--r--data/maps/BattleFrontier_BattleArenaLobby/scripts.inc10
-rw-r--r--data/maps/BattleFrontier_BattleDomeBattleRoom/scripts.inc71
-rw-r--r--data/maps/BattleFrontier_BattleDomeCorridor/scripts.inc10
-rw-r--r--data/maps/BattleFrontier_BattleDomeLobby/scripts.inc11
-rw-r--r--data/maps/BattleFrontier_BattleDomePreBattleRoom/scripts.inc4
-rw-r--r--data/maps/BattleFrontier_BattleFactoryBattleRoom/scripts.inc45
-rw-r--r--data/maps/BattleFrontier_BattleFactoryLobby/scripts.inc7
-rw-r--r--data/maps/BattleFrontier_BattleFactoryPreBattleRoom/scripts.inc16
-rw-r--r--data/maps/BattleFrontier_BattlePalaceBattleRoom/scripts.inc82
-rw-r--r--data/maps/BattleFrontier_BattlePalaceCorridor/scripts.inc12
-rw-r--r--data/maps/BattleFrontier_BattlePalaceLobby/scripts.inc7
-rw-r--r--data/maps/BattleFrontier_BattlePikeCorridor/scripts.inc4
-rw-r--r--data/maps/BattleFrontier_BattlePikeLobby/scripts.inc4
-rw-r--r--data/maps/BattleFrontier_BattlePikeRoomFinal/scripts.inc4
-rw-r--r--data/maps/BattleFrontier_BattlePikeRoomNormal/scripts.inc69
-rw-r--r--data/maps/BattleFrontier_BattlePikeThreePathRoom/scripts.inc6
-rw-r--r--data/maps/BattleFrontier_BattlePyramidLobby/scripts.inc9
-rw-r--r--data/maps/BattleFrontier_BattlePyramidTop/scripts.inc19
-rw-r--r--data/maps/BattleFrontier_BattleTowerBattleRoom/scripts.inc44
-rw-r--r--data/maps/BattleFrontier_BattleTowerCorridor/scripts.inc6
-rw-r--r--data/maps/BattleFrontier_BattleTowerElevator/scripts.inc6
-rw-r--r--data/maps/BattleFrontier_BattleTowerLobby/scripts.inc47
-rw-r--r--data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc67
-rw-r--r--data/maps/BattleFrontier_BattleTowerMultiCorridor/scripts.inc41
-rw-r--r--data/maps/BattleFrontier_BattleTowerMultiPartnerRoom/scripts.inc16
-rw-r--r--data/maps/BattleFrontier_Mart/scripts.inc4
-rw-r--r--data/maps/BattleFrontier_OutsideEast/scripts.inc10
-rw-r--r--data/maps/BattleFrontier_OutsideWest/scripts.inc35
-rw-r--r--data/maps/BattleFrontier_PokemonCenter_1F/scripts.inc5
-rw-r--r--data/maps/BattleFrontier_ReceptionGate/scripts.inc26
-rw-r--r--data/maps/BattleFrontier_ScottsHouse/scripts.inc12
-rw-r--r--data/maps/BirthIsland_Exterior/scripts.inc13
-rw-r--r--data/maps/BirthIsland_Harbor/scripts.inc7
-rw-r--r--data/maps/CaveOfOrigin_B1F/scripts.inc12
-rw-r--r--data/maps/DesertUnderpass/scripts.inc6
-rw-r--r--data/maps/DewfordTown/scripts.inc46
-rw-r--r--data/maps/DewfordTown_Hall/scripts.inc13
-rw-r--r--data/maps/DewfordTown_PokemonCenter_1F/scripts.inc5
-rw-r--r--data/maps/EverGrandeCity_ChampionsRoom/scripts.inc34
-rw-r--r--data/maps/EverGrandeCity_DrakesRoom/scripts.inc2
-rw-r--r--data/maps/EverGrandeCity_HallOfFame/scripts.inc12
-rw-r--r--data/maps/EverGrandeCity_PokemonCenter_1F/scripts.inc12
-rw-r--r--data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc19
-rw-r--r--data/maps/FallarborTown_BattleTentBattleRoom/scripts.inc38
-rw-r--r--data/maps/FallarborTown_BattleTentCorridor/scripts.inc6
-rw-r--r--data/maps/FallarborTown_BattleTentLobby/scripts.inc6
-rw-r--r--data/maps/FallarborTown_MoveRelearnersHouse/scripts.inc6
-rw-r--r--data/maps/FallarborTown_PokemonCenter_1F/scripts.inc12
-rw-r--r--data/maps/FarawayIsland_Entrance/scripts.inc7
-rw-r--r--data/maps/FarawayIsland_Interior/scripts.inc22
-rw-r--r--data/maps/FortreeCity_Gym/scripts.inc4
-rw-r--r--data/maps/FortreeCity_House4/scripts.inc6
-rw-r--r--data/maps/FortreeCity_PokemonCenter_1F/scripts.inc5
-rw-r--r--data/maps/GraniteCave_StevensRoom/scripts.inc10
-rw-r--r--data/maps/JaggedPass/scripts.inc20
-rw-r--r--data/maps/LavaridgeTown/scripts.inc39
-rw-r--r--data/maps/LavaridgeTown_Gym_1F/scripts.inc35
-rw-r--r--data/maps/LavaridgeTown_Gym_B1F/scripts.inc13
-rw-r--r--data/maps/LavaridgeTown_HerbShop/scripts.inc2
-rw-r--r--data/maps/LavaridgeTown_PokemonCenter_1F/scripts.inc5
-rw-r--r--data/maps/LilycoveCity/scripts.inc7
-rw-r--r--data/maps/LilycoveCity_ContestHall/scripts.inc85
-rw-r--r--data/maps/LilycoveCity_ContestLobby/scripts.inc100
-rw-r--r--data/maps/LilycoveCity_CoveLilyMotel_1F/scripts.inc22
-rw-r--r--data/maps/LilycoveCity_DepartmentStore_1F/scripts.inc6
-rw-r--r--data/maps/LilycoveCity_DepartmentStore_5F/scripts.inc10
-rw-r--r--data/maps/LilycoveCity_Harbor/scripts.inc63
-rw-r--r--data/maps/LilycoveCity_LilycoveMuseum_1F/scripts.inc11
-rw-r--r--data/maps/LilycoveCity_LilycoveMuseum_2F/scripts.inc24
-rw-r--r--data/maps/LilycoveCity_MoveDeletersHouse/scripts.inc4
-rw-r--r--data/maps/LilycoveCity_PokemonCenter_1F/scripts.inc5
-rw-r--r--data/maps/LilycoveCity_PokemonTrainerFanClub/scripts.inc35
-rw-r--r--data/maps/LittlerootTown/scripts.inc149
-rw-r--r--data/maps/LittlerootTown_BrendansHouse_1F/scripts.inc52
-rw-r--r--data/maps/LittlerootTown_BrendansHouse_2F/scripts.inc30
-rw-r--r--data/maps/LittlerootTown_MaysHouse_1F/scripts.inc52
-rw-r--r--data/maps/LittlerootTown_MaysHouse_2F/scripts.inc30
-rw-r--r--data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc89
-rw-r--r--data/maps/MagmaHideout_4F/scripts.inc32
-rw-r--r--data/maps/MarineCave_End/scripts.inc8
-rw-r--r--data/maps/MauvilleCity/scripts.inc68
-rw-r--r--data/maps/MauvilleCity_Gym/scripts.inc4
-rw-r--r--data/maps/MauvilleCity_PokemonCenter_1F/scripts.inc5
-rw-r--r--data/maps/MeteorFalls_1F_1R/scripts.inc68
-rw-r--r--data/maps/MeteorFalls_StevensCave/scripts.inc10
-rw-r--r--data/maps/MirageTower_4F/scripts.inc7
-rw-r--r--data/maps/MossdeepCity/scripts.inc43
-rw-r--r--data/maps/MossdeepCity_Gym/scripts.inc4
-rw-r--r--data/maps/MossdeepCity_House2/scripts.inc8
-rw-r--r--data/maps/MossdeepCity_PokemonCenter_1F/scripts.inc5
-rw-r--r--data/maps/MossdeepCity_SpaceCenter_1F/scripts.inc43
-rw-r--r--data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc93
-rw-r--r--data/maps/MossdeepCity_StevensHouse/scripts.inc19
-rw-r--r--data/maps/MtChimney/scripts.inc37
-rw-r--r--data/maps/MtChimney_CableCarStation/scripts.inc14
-rw-r--r--data/maps/MtPyre_Summit/scripts.inc86
-rw-r--r--data/maps/NavelRock_Bottom/scripts.inc4
-rw-r--r--data/maps/NavelRock_Harbor/scripts.inc7
-rw-r--r--data/maps/NavelRock_Top/scripts.inc10
-rw-r--r--data/maps/OldaleTown/scripts.inc42
-rw-r--r--data/maps/OldaleTown_PokemonCenter_1F/scripts.inc5
-rw-r--r--data/maps/PacifidlogTown_House2/scripts.inc2
-rw-r--r--data/maps/PacifidlogTown_PokemonCenter_1F/scripts.inc5
-rw-r--r--data/maps/PetalburgCity/map.json4
-rw-r--r--data/maps/PetalburgCity/scripts.inc92
-rw-r--r--data/maps/PetalburgCity_Gym/scripts.inc102
-rw-r--r--data/maps/PetalburgCity_PokemonCenter_1F/scripts.inc7
-rw-r--r--data/maps/PetalburgCity_WallysHouse/scripts.inc4
-rw-r--r--data/maps/PetalburgWoods/scripts.inc51
-rw-r--r--data/maps/Route101/scripts.inc33
-rw-r--r--data/maps/Route103/scripts.inc28
-rw-r--r--data/maps/Route104/scripts.inc58
-rw-r--r--data/maps/Route104_MrBrineysHouse/scripts.inc11
-rw-r--r--data/maps/Route104_PrettyPetalFlowerShop/scripts.inc4
-rw-r--r--data/maps/Route109/scripts.inc27
-rw-r--r--data/maps/Route109_SeashoreHouse/scripts.inc2
-rw-r--r--data/maps/Route110/map.json4
-rw-r--r--data/maps/Route110/scripts.inc73
-rw-r--r--data/maps/Route110_TrickHouseEnd/scripts.inc32
-rw-r--r--data/maps/Route110_TrickHouseEntrance/scripts.inc72
-rw-r--r--data/maps/Route110_TrickHousePuzzle5/scripts.inc256
-rw-r--r--data/maps/Route111/scripts.inc51
-rw-r--r--data/maps/Route111_WinstrateFamilysHouse/scripts.inc13
-rw-r--r--data/maps/Route112/scripts.inc19
-rw-r--r--data/maps/Route112_CableCarStation/scripts.inc14
-rw-r--r--data/maps/Route114_FossilManiacsTunnel/scripts.inc8
-rw-r--r--data/maps/Route116/scripts.inc7
-rw-r--r--data/maps/Route117/scripts.inc4
-rw-r--r--data/maps/Route118/scripts.inc16
-rw-r--r--data/maps/Route119/scripts.inc46
-rw-r--r--data/maps/Route119_WeatherInstitute_1F/scripts.inc6
-rw-r--r--data/maps/Route119_WeatherInstitute_2F/scripts.inc41
-rw-r--r--data/maps/Route120/scripts.inc28
-rw-r--r--data/maps/Route121/scripts.inc18
-rw-r--r--data/maps/Route128/scripts.inc38
-rw-r--r--data/maps/RustboroCity/scripts.inc205
-rw-r--r--data/maps/RustboroCity_DevonCorp_1F/scripts.inc6
-rw-r--r--data/maps/RustboroCity_DevonCorp_2F/scripts.inc10
-rw-r--r--data/maps/RustboroCity_DevonCorp_3F/scripts.inc16
-rw-r--r--data/maps/RustboroCity_Flat1_2F/scripts.inc6
-rw-r--r--data/maps/RustboroCity_Flat2_2F/scripts.inc2
-rw-r--r--data/maps/RustboroCity_Gym/scripts.inc2
-rw-r--r--data/maps/RustboroCity_PokemonCenter_1F/scripts.inc5
-rw-r--r--data/maps/RusturfTunnel/scripts.inc66
-rw-r--r--data/maps/SSTidalCorridor/scripts.inc13
-rw-r--r--data/maps/SafariZone_South/scripts.inc12
-rw-r--r--data/maps/SeafloorCavern_Entrance/scripts.inc18
-rw-r--r--data/maps/SeafloorCavern_Room9/scripts.inc33
-rw-r--r--data/maps/SkyPillar_Outside/scripts.inc14
-rw-r--r--data/maps/SkyPillar_Top/scripts.inc12
-rw-r--r--data/maps/SlateportCity/scripts.inc157
-rw-r--r--data/maps/SlateportCity_BattleTentBattleRoom/scripts.inc17
-rw-r--r--data/maps/SlateportCity_BattleTentCorridor/scripts.inc12
-rw-r--r--data/maps/SlateportCity_BattleTentLobby/scripts.inc6
-rw-r--r--data/maps/SlateportCity_Harbor/scripts.inc38
-rw-r--r--data/maps/SlateportCity_OceanicMuseum_1F/scripts.inc16
-rw-r--r--data/maps/SlateportCity_OceanicMuseum_2F/scripts.inc47
-rw-r--r--data/maps/SlateportCity_PokemonCenter_1F/scripts.inc5
-rw-r--r--data/maps/SlateportCity_SternsShipyard_1F/scripts.inc16
-rw-r--r--data/maps/SootopolisCity/scripts.inc204
-rw-r--r--data/maps/SootopolisCity_Gym_1F/scripts.inc4
-rw-r--r--data/maps/SootopolisCity_MysteryEventsHouse_1F/scripts.inc14
-rw-r--r--data/maps/SootopolisCity_MysteryEventsHouse_B1F/scripts.inc6
-rw-r--r--data/maps/SootopolisCity_PokemonCenter_1F/scripts.inc5
-rw-r--r--data/maps/SouthernIsland_Exterior/scripts.inc7
-rw-r--r--data/maps/SouthernIsland_Interior/scripts.inc10
-rw-r--r--data/maps/TerraCave_End/scripts.inc8
-rw-r--r--data/maps/TrainerHill_Elevator/scripts.inc6
-rw-r--r--data/maps/TrainerHill_Entrance/scripts.inc15
-rw-r--r--data/maps/UnionRoom/scripts.inc47
-rw-r--r--data/maps/VerdanturfTown/scripts.inc6
-rw-r--r--data/maps/VerdanturfTown_BattleTentBattleRoom/scripts.inc28
-rw-r--r--data/maps/VerdanturfTown_BattleTentCorridor/scripts.inc6
-rw-r--r--data/maps/VerdanturfTown_BattleTentLobby/scripts.inc6
-rw-r--r--data/maps/VerdanturfTown_PokemonCenter_1F/scripts.inc5
-rw-r--r--data/maps/VictoryRoad_1F/scripts.inc20
-rw-r--r--data/scripts/apprentice.inc6
-rw-r--r--data/scripts/battle_pike.inc25
-rw-r--r--data/scripts/berry_blender.inc48
-rw-r--r--data/scripts/cable_club.inc96
-rw-r--r--data/scripts/contest_hall.inc126
-rw-r--r--data/scripts/day_care.inc4
-rw-r--r--data/scripts/gabby_and_ty.inc1
-rw-r--r--data/scripts/lilycove_lady.inc11
-rw-r--r--data/scripts/new_game.inc2
-rw-r--r--data/scripts/players_house.inc17
-rw-r--r--data/scripts/secret_base.inc2
-rw-r--r--data/specials.inc10
-rw-r--r--gflib/text.h266
-rw-r--r--graphics/contest/results_screen.bin (renamed from graphics/contest/clink_tilemap11.bin)bin24 -> 24 bytes
-rw-r--r--graphics/contest/results_screen.pal (renamed from graphics/contest/misc_2.pal)0
-rw-r--r--graphics/contest/results_screen.png (renamed from graphics/contest/misc_2.png)bin1775 -> 1775 bytes
-rw-r--r--graphics/contest/results_screen_beauty.bin (renamed from graphics/contest/clink_tilemap7.bin)0
-rw-r--r--graphics/contest/results_screen_cool.bin (renamed from graphics/contest/clink_tilemap6.bin)bin20 -> 20 bytes
-rw-r--r--graphics/contest/results_screen_cute.bin (renamed from graphics/contest/clink_tilemap8.bin)0
-rw-r--r--graphics/contest/results_screen_hyper.bin (renamed from graphics/contest/clink_tilemap3.bin)bin40 -> 40 bytes
-rw-r--r--graphics/contest/results_screen_link.bin (renamed from graphics/contest/clink_tilemap5.bin)bin20 -> 20 bytes
-rw-r--r--graphics/contest/results_screen_master.bin (renamed from graphics/contest/clink_tilemap4.bin)bin40 -> 40 bytes
-rw-r--r--graphics/contest/results_screen_normal.bin (renamed from graphics/contest/clink_tilemap1.bin)bin40 -> 40 bytes
-rw-r--r--graphics/contest/results_screen_smart.bin (renamed from graphics/contest/clink_tilemap9.bin)0
-rw-r--r--graphics/contest/results_screen_super.bin (renamed from graphics/contest/clink_tilemap2.bin)bin40 -> 40 bytes
-rw-r--r--graphics/contest/results_screen_tough.bin (renamed from graphics/contest/clink_tilemap10.bin)0
-rw-r--r--graphics/misc/pokeball_selection.png (renamed from graphics/misc/birch_ballarrow.png)bin635 -> 635 bytes
-rw-r--r--graphics/misc/starter_circle.png (renamed from graphics/misc/birch_circle.png)bin349 -> 349 bytes
-rw-r--r--graphics/union_room_chat/background.bin (renamed from graphics/link/misc.bin)bin1280 -> 1280 bytes
-rw-r--r--graphics/union_room_chat/background.png (renamed from graphics/link/misc.png)bin513 -> 513 bytes
-rw-r--r--graphics/union_room_chat/border.bin (renamed from graphics/link/link_winedge.bin)bin1280 -> 1280 bytes
-rw-r--r--graphics/union_room_chat/border.png (renamed from graphics/link/link_winedge.png)bin189 -> 189 bytes
-rw-r--r--graphics/union_room_chat/interface.pal (renamed from graphics/interface/unk_palette3.pal)0
-rw-r--r--graphics/union_room_chat/keyboard_cursor.png (renamed from graphics/interface/unk_cursor.png)bin307 -> 307 bytes
-rw-r--r--graphics/union_room_chat/r_button.png (renamed from graphics/interface/unk_rbutton.png)bin188 -> 188 bytes
-rw-r--r--graphics/union_room_chat/r_button_labels.png (renamed from graphics/interface/unk_change_case.png)bin247 -> 247 bytes
-rw-r--r--graphics/union_room_chat/text_entry_arrow.png (renamed from graphics/interface/unk_cursor_arrow.png)bin157 -> 157 bytes
-rw-r--r--graphics/union_room_chat/text_entry_cursor.png (renamed from graphics/interface/unk_dash.png)bin146 -> 146 bytes
-rw-r--r--graphics/union_room_chat/unk_palette1.pal (renamed from graphics/interface/unk_palette1.pal)0
-rw-r--r--graphics/union_room_chat/unk_palette2.pal (renamed from graphics/interface/unk_palette2.pal)0
-rw-r--r--graphics/union_room_chat/window_1.pal (renamed from graphics/link/link1.pal)0
-rw-r--r--graphics/union_room_chat/window_2.pal (renamed from graphics/link/link2.pal)0
-rw-r--r--include/battle.h2
-rw-r--r--include/battle_main.h8
-rw-r--r--include/battle_script_commands.h4
-rw-r--r--include/battle_scripts.h2
-rwxr-xr-xinclude/berry_crush.h2
-rw-r--r--include/cable_club.h16
-rw-r--r--include/confetti_util.h33
-rw-r--r--include/config.h8
-rw-r--r--include/constants/battle.h371
-rw-r--r--include/constants/battle_palace.h10
-rw-r--r--include/constants/battle_script_commands.h2
-rw-r--r--include/constants/cable_club.h16
-rw-r--r--include/constants/contest.h17
-rw-r--r--include/constants/field_specials.h5
-rw-r--r--include/constants/flags.h12
-rw-r--r--include/constants/global.h4
-rw-r--r--include/constants/items.h2
-rw-r--r--include/constants/opponents.h1
-rw-r--r--include/constants/pokemon.h3
-rw-r--r--include/constants/trainers.h2
-rw-r--r--include/constants/union_room.h78
-rw-r--r--include/constants/vars.h1
-rw-r--r--include/contest.h5
-rw-r--r--include/contest_link.h (renamed from include/contest_link_80FC4F4.h)6
-rw-r--r--include/contest_util.h (renamed from include/contest_link_80F57C4.h)10
-rw-r--r--include/dodrio_berry_picking.h2
-rw-r--r--include/event_data.h3
-rw-r--r--include/event_object_lock.h2
-rw-r--r--include/event_object_movement.h18
-rw-r--r--include/fieldmap.h2
-rw-r--r--include/gba/types.h3
-rw-r--r--include/global.h15
-rw-r--r--include/global.tv.h7
-rw-r--r--include/graphics.h48
-rw-r--r--include/hall_of_fame.h1
-rw-r--r--include/item_menu.h5
-rw-r--r--include/libgcnmultiboot.h2
-rw-r--r--include/link.h47
-rw-r--r--include/link_rfu.h367
-rw-r--r--include/menu.h2
-rwxr-xr-xinclude/mevent.h4
-rw-r--r--include/mevent2.h2
-rw-r--r--include/mystery_gift.h2
-rw-r--r--include/pokeblock.h5
-rw-r--r--include/pokemon.h4
-rw-r--r--include/pokemon_jump.h2
-rw-r--r--include/rom_81520A8.h33
-rw-r--r--include/save.h2
-rw-r--r--include/start_menu.h4
-rw-r--r--include/starter_choose.h1
-rw-r--r--include/strings.h15
-rw-r--r--include/union_room.h145
-rw-r--r--include/union_room_battle.h3
-rwxr-xr-xinclude/union_room_chat.h15
-rw-r--r--include/union_room_player_avatar.h18
-rw-r--r--ld_script.txt14
-rw-r--r--libagbsyscall/libagbsyscall.s120
-rw-r--r--sound/direct_sound_data.inc776
-rw-r--r--sound/direct_sound_samples/cries/abra.aif (renamed from sound/direct_sound_samples/cry_abra.aif)bin11660 -> 11660 bytes
-rw-r--r--sound/direct_sound_samples/cries/absol.aif (renamed from sound/direct_sound_samples/cry_absol.aif)bin5256 -> 5256 bytes
-rw-r--r--sound/direct_sound_samples/cries/aerodactyl.aif (renamed from sound/direct_sound_samples/cry_aerodactyl.aif)bin12142 -> 12142 bytes
-rw-r--r--sound/direct_sound_samples/cries/aggron.aif (renamed from sound/direct_sound_samples/cry_aggron.aif)bin12776 -> 12776 bytes
-rw-r--r--sound/direct_sound_samples/cries/aipom.aif (renamed from sound/direct_sound_samples/cry_aipom.aif)bin7058 -> 7058 bytes
-rw-r--r--sound/direct_sound_samples/cries/alakazam.aif (renamed from sound/direct_sound_samples/cry_alakazam.aif)bin15740 -> 15740 bytes
-rw-r--r--sound/direct_sound_samples/cries/altaria.aif (renamed from sound/direct_sound_samples/cry_altaria.aif)bin5564 -> 5564 bytes
-rw-r--r--sound/direct_sound_samples/cries/ampharos.aif (renamed from sound/direct_sound_samples/cry_ampharos.aif)bin8242 -> 8242 bytes
-rw-r--r--sound/direct_sound_samples/cries/anorith.aif (renamed from sound/direct_sound_samples/cry_anorith.aif)bin5862 -> 5862 bytes
-rw-r--r--sound/direct_sound_samples/cries/arbok.aif (renamed from sound/direct_sound_samples/cry_arbok.aif)bin9648 -> 9648 bytes
-rw-r--r--sound/direct_sound_samples/cries/arcanine.aif (renamed from sound/direct_sound_samples/cry_arcanine.aif)bin8602 -> 8602 bytes
-rw-r--r--sound/direct_sound_samples/cries/ariados.aif (renamed from sound/direct_sound_samples/cry_ariados.aif)bin6170 -> 6170 bytes
-rw-r--r--sound/direct_sound_samples/cries/armaldo.aif (renamed from sound/direct_sound_samples/cry_armaldo.aif)bin11380 -> 11380 bytes
-rw-r--r--sound/direct_sound_samples/cries/aron.aif (renamed from sound/direct_sound_samples/cry_aron.aif)bin4600 -> 4600 bytes
-rw-r--r--sound/direct_sound_samples/cries/articuno.aif (renamed from sound/direct_sound_samples/cry_articuno.aif)bin11792 -> 11792 bytes
-rw-r--r--sound/direct_sound_samples/cries/azumarill.aif (renamed from sound/direct_sound_samples/cry_azumarill.aif)bin8452 -> 8452 bytes
-rw-r--r--sound/direct_sound_samples/cries/azurill.aif (renamed from sound/direct_sound_samples/cry_azurill.aif)bin5212 -> 5212 bytes
-rw-r--r--sound/direct_sound_samples/cries/bagon.aif (renamed from sound/direct_sound_samples/cry_bagon.aif)bin3934 -> 3934 bytes
-rw-r--r--sound/direct_sound_samples/cries/baltoy.aif (renamed from sound/direct_sound_samples/cry_baltoy.aif)bin6264 -> 6264 bytes
-rw-r--r--sound/direct_sound_samples/cries/banette.aif (renamed from sound/direct_sound_samples/cry_banette.aif)bin6334 -> 6334 bytes
-rw-r--r--sound/direct_sound_samples/cries/barboach.aif (renamed from sound/direct_sound_samples/cry_barboach.aif)bin4632 -> 4632 bytes
-rw-r--r--sound/direct_sound_samples/cries/bayleef.aif (renamed from sound/direct_sound_samples/cry_bayleef.aif)bin4414 -> 4414 bytes
-rw-r--r--sound/direct_sound_samples/cries/beautifly.aif (renamed from sound/direct_sound_samples/cry_beautifly.aif)bin4128 -> 4128 bytes
-rw-r--r--sound/direct_sound_samples/cries/beedrill.aif (renamed from sound/direct_sound_samples/cry_beedrill.aif)bin9656 -> 9656 bytes
-rw-r--r--sound/direct_sound_samples/cries/beldum.aif (renamed from sound/direct_sound_samples/cry_beldum.aif)bin4828 -> 4828 bytes
-rw-r--r--sound/direct_sound_samples/cries/bellossom.aif (renamed from sound/direct_sound_samples/cry_bellossom.aif)bin7042 -> 7042 bytes
-rw-r--r--sound/direct_sound_samples/cries/bellsprout.aif (renamed from sound/direct_sound_samples/cry_bellsprout.aif)bin3792 -> 3792 bytes
-rw-r--r--sound/direct_sound_samples/cries/blastoise.aif (renamed from sound/direct_sound_samples/cry_blastoise.aif)bin9622 -> 9622 bytes
-rw-r--r--sound/direct_sound_samples/cries/blaziken.aif (renamed from sound/direct_sound_samples/cry_blaziken.aif)bin15690 -> 15690 bytes
-rw-r--r--sound/direct_sound_samples/cries/blissey.aif (renamed from sound/direct_sound_samples/cry_blissey.aif)bin8278 -> 8278 bytes
-rw-r--r--sound/direct_sound_samples/cries/breloom.aif (renamed from sound/direct_sound_samples/cry_breloom.aif)bin6376 -> 6376 bytes
-rw-r--r--sound/direct_sound_samples/cries/bulbasaur.aif (renamed from sound/direct_sound_samples/cry_bulbasaur.aif)bin8266 -> 8266 bytes
-rw-r--r--sound/direct_sound_samples/cries/butterfree.aif (renamed from sound/direct_sound_samples/cry_butterfree.aif)bin5026 -> 5026 bytes
-rw-r--r--sound/direct_sound_samples/cries/cacnea.aif (renamed from sound/direct_sound_samples/cry_cacnea.aif)bin4488 -> 4488 bytes
-rw-r--r--sound/direct_sound_samples/cries/cacturne.aif (renamed from sound/direct_sound_samples/cry_cacturne.aif)bin11310 -> 11310 bytes
-rw-r--r--sound/direct_sound_samples/cries/camerupt.aif (renamed from sound/direct_sound_samples/cry_camerupt.aif)bin11526 -> 11526 bytes
-rw-r--r--sound/direct_sound_samples/cries/carvanha.aif (renamed from sound/direct_sound_samples/cry_carvanha.aif)bin5048 -> 5048 bytes
-rw-r--r--sound/direct_sound_samples/cries/cascoon.aif (renamed from sound/direct_sound_samples/cry_cascoon.aif)bin8126 -> 8126 bytes
-rw-r--r--sound/direct_sound_samples/cries/castform.aif (renamed from sound/direct_sound_samples/cry_castform.aif)bin6302 -> 6302 bytes
-rw-r--r--sound/direct_sound_samples/cries/caterpie.aif (renamed from sound/direct_sound_samples/cry_caterpie.aif)bin4192 -> 4192 bytes
-rw-r--r--sound/direct_sound_samples/cries/celebi.aif (renamed from sound/direct_sound_samples/cry_celebi.aif)bin7230 -> 7230 bytes
-rw-r--r--sound/direct_sound_samples/cries/chansey.aif (renamed from sound/direct_sound_samples/cry_chansey.aif)bin7390 -> 7390 bytes
-rw-r--r--sound/direct_sound_samples/cries/charizard.aif (renamed from sound/direct_sound_samples/cry_charizard.aif)bin9622 -> 9622 bytes
-rw-r--r--sound/direct_sound_samples/cries/charmander.aif (renamed from sound/direct_sound_samples/cry_charmander.aif)bin7216 -> 7216 bytes
-rw-r--r--sound/direct_sound_samples/cries/charmeleon.aif (renamed from sound/direct_sound_samples/cry_charmeleon.aif)bin7248 -> 7248 bytes
-rw-r--r--sound/direct_sound_samples/cries/chikorita.aif (renamed from sound/direct_sound_samples/cry_chikorita.aif)bin2654 -> 2654 bytes
-rw-r--r--sound/direct_sound_samples/cries/chimecho.aif (renamed from sound/direct_sound_samples/cry_chimecho.aif)bin5040 -> 5040 bytes
-rw-r--r--sound/direct_sound_samples/cries/chinchou.aif (renamed from sound/direct_sound_samples/cry_chinchou.aif)bin6346 -> 6346 bytes
-rw-r--r--sound/direct_sound_samples/cries/clamperl.aif (renamed from sound/direct_sound_samples/cry_clamperl.aif)bin9142 -> 9142 bytes
-rw-r--r--sound/direct_sound_samples/cries/claydol.aif (renamed from sound/direct_sound_samples/cry_claydol.aif)bin9668 -> 9668 bytes
-rw-r--r--sound/direct_sound_samples/cries/clefable.aif (renamed from sound/direct_sound_samples/cry_clefable.aif)bin5294 -> 5294 bytes
-rw-r--r--sound/direct_sound_samples/cries/clefairy.aif (renamed from sound/direct_sound_samples/cry_clefairy.aif)bin4234 -> 4234 bytes
-rw-r--r--sound/direct_sound_samples/cries/cleffa.aif (renamed from sound/direct_sound_samples/cry_cleffa.aif)bin2992 -> 2992 bytes
-rw-r--r--sound/direct_sound_samples/cries/cloyster.aif (renamed from sound/direct_sound_samples/cry_cloyster.aif)bin10354 -> 10354 bytes
-rw-r--r--sound/direct_sound_samples/cries/combusken.aif (renamed from sound/direct_sound_samples/cry_combusken.aif)bin14360 -> 14360 bytes
-rw-r--r--sound/direct_sound_samples/cries/corphish.aif (renamed from sound/direct_sound_samples/cry_corphish.aif)bin6010 -> 6010 bytes
-rw-r--r--sound/direct_sound_samples/cries/corsola.aif (renamed from sound/direct_sound_samples/cry_corsola.aif)bin6440 -> 6440 bytes
-rw-r--r--sound/direct_sound_samples/cries/cradily.aif (renamed from sound/direct_sound_samples/cry_cradily.aif)bin14542 -> 14542 bytes
-rw-r--r--sound/direct_sound_samples/cries/crawdaunt.aif (renamed from sound/direct_sound_samples/cry_crawdaunt.aif)bin12316 -> 12316 bytes
-rw-r--r--sound/direct_sound_samples/cries/crobat.aif (renamed from sound/direct_sound_samples/cry_crobat.aif)bin11562 -> 11562 bytes
-rw-r--r--sound/direct_sound_samples/cries/croconaw.aif (renamed from sound/direct_sound_samples/cry_croconaw.aif)bin10096 -> 10096 bytes
-rw-r--r--sound/direct_sound_samples/cries/cubone.aif (renamed from sound/direct_sound_samples/cry_cubone.aif)bin7558 -> 7558 bytes
-rw-r--r--sound/direct_sound_samples/cries/cyndaquil.aif (renamed from sound/direct_sound_samples/cry_cyndaquil.aif)bin3528 -> 3528 bytes
-rw-r--r--sound/direct_sound_samples/cries/delcatty.aif (renamed from sound/direct_sound_samples/cry_delcatty.aif)bin10518 -> 10518 bytes
-rw-r--r--sound/direct_sound_samples/cries/delibird.aif (renamed from sound/direct_sound_samples/cry_delibird.aif)bin8094 -> 8094 bytes
-rw-r--r--sound/direct_sound_samples/cries/deoxys.aif (renamed from sound/direct_sound_samples/cry_deoxys.aif)bin10388 -> 10388 bytes
-rw-r--r--sound/direct_sound_samples/cries/dewgong.aif (renamed from sound/direct_sound_samples/cry_dewgong.aif)bin10546 -> 10546 bytes
-rw-r--r--sound/direct_sound_samples/cries/diglett.aif (renamed from sound/direct_sound_samples/cry_diglett.aif)bin9698 -> 9698 bytes
-rw-r--r--sound/direct_sound_samples/cries/ditto.aif (renamed from sound/direct_sound_samples/cry_ditto.aif)bin5566 -> 5566 bytes
-rw-r--r--sound/direct_sound_samples/cries/dodrio.aif (renamed from sound/direct_sound_samples/cry_dodrio.aif)bin9712 -> 9712 bytes
-rw-r--r--sound/direct_sound_samples/cries/doduo.aif (renamed from sound/direct_sound_samples/cry_doduo.aif)bin9616 -> 9616 bytes
-rw-r--r--sound/direct_sound_samples/cries/donphan.aif (renamed from sound/direct_sound_samples/cry_donphan.aif)bin8554 -> 8554 bytes
-rw-r--r--sound/direct_sound_samples/cries/dragonair.aif (renamed from sound/direct_sound_samples/cry_dragonair.aif)bin8318 -> 8318 bytes
-rw-r--r--sound/direct_sound_samples/cries/dragonite.aif (renamed from sound/direct_sound_samples/cry_dragonite.aif)bin9502 -> 9502 bytes
-rw-r--r--sound/direct_sound_samples/cries/dratini.aif (renamed from sound/direct_sound_samples/cry_dratini.aif)bin5812 -> 5812 bytes
-rw-r--r--sound/direct_sound_samples/cries/drowzee.aif (renamed from sound/direct_sound_samples/cry_drowzee.aif)bin14494 -> 14494 bytes
-rw-r--r--sound/direct_sound_samples/cries/dugtrio.aif (renamed from sound/direct_sound_samples/cry_dugtrio.aif)bin9686 -> 9686 bytes
-rw-r--r--sound/direct_sound_samples/cries/dunsparce.aif (renamed from sound/direct_sound_samples/cry_dunsparce.aif)bin7926 -> 7926 bytes
-rw-r--r--sound/direct_sound_samples/cries/dusclops.aif (renamed from sound/direct_sound_samples/cry_dusclops.aif)bin6858 -> 6858 bytes
-rw-r--r--sound/direct_sound_samples/cries/duskull.aif (renamed from sound/direct_sound_samples/cry_duskull.aif)bin5310 -> 5310 bytes
-rw-r--r--sound/direct_sound_samples/cries/dustox.aif (renamed from sound/direct_sound_samples/cry_dustox.aif)bin6338 -> 6338 bytes
-rw-r--r--sound/direct_sound_samples/cries/eevee.aif (renamed from sound/direct_sound_samples/cry_eevee.aif)bin7104 -> 7104 bytes
-rw-r--r--sound/direct_sound_samples/cries/ekans.aif (renamed from sound/direct_sound_samples/cry_ekans.aif)bin9626 -> 9626 bytes
-rw-r--r--sound/direct_sound_samples/cries/electabuzz.aif (renamed from sound/direct_sound_samples/cry_electabuzz.aif)bin15380 -> 15380 bytes
-rw-r--r--sound/direct_sound_samples/cries/electrike.aif (renamed from sound/direct_sound_samples/cry_electrike.aif)bin6186 -> 6186 bytes
-rw-r--r--sound/direct_sound_samples/cries/electrode.aif (renamed from sound/direct_sound_samples/cry_electrode.aif)bin12564 -> 12564 bytes
-rw-r--r--sound/direct_sound_samples/cries/elekid.aif (renamed from sound/direct_sound_samples/cry_elekid.aif)bin5284 -> 5284 bytes
-rw-r--r--sound/direct_sound_samples/cries/entei.aif (renamed from sound/direct_sound_samples/cry_entei.aif)bin10198 -> 10198 bytes
-rw-r--r--sound/direct_sound_samples/cries/espeon.aif (renamed from sound/direct_sound_samples/cry_espeon.aif)bin9828 -> 9828 bytes
-rw-r--r--sound/direct_sound_samples/cries/exeggcute.aif (renamed from sound/direct_sound_samples/cry_exeggcute.aif)bin9416 -> 9416 bytes
-rw-r--r--sound/direct_sound_samples/cries/exeggutor.aif (renamed from sound/direct_sound_samples/cry_exeggutor.aif)bin15880 -> 15880 bytes
-rw-r--r--sound/direct_sound_samples/cries/exploud.aif (renamed from sound/direct_sound_samples/cry_exploud.aif)bin14086 -> 14086 bytes
-rw-r--r--sound/direct_sound_samples/cries/farfetchd.aif (renamed from sound/direct_sound_samples/cry_farfetchd.aif)bin3766 -> 3766 bytes
-rw-r--r--sound/direct_sound_samples/cries/fearow.aif (renamed from sound/direct_sound_samples/cry_fearow.aif)bin8602 -> 8602 bytes
-rw-r--r--sound/direct_sound_samples/cries/feebas.aif (renamed from sound/direct_sound_samples/cry_feebas.aif)bin3932 -> 3932 bytes
-rw-r--r--sound/direct_sound_samples/cries/feraligatr.aif (renamed from sound/direct_sound_samples/cry_feraligatr.aif)bin12712 -> 12712 bytes
-rw-r--r--sound/direct_sound_samples/cries/flaaffy.aif (renamed from sound/direct_sound_samples/cry_flaaffy.aif)bin6854 -> 6854 bytes
-rw-r--r--sound/direct_sound_samples/cries/flareon.aif (renamed from sound/direct_sound_samples/cry_flareon.aif)bin7748 -> 7748 bytes
-rw-r--r--sound/direct_sound_samples/cries/flygon.aif (renamed from sound/direct_sound_samples/cry_flygon.aif)bin12974 -> 12974 bytes
-rw-r--r--sound/direct_sound_samples/cries/forretress.aif (renamed from sound/direct_sound_samples/cry_forretress.aif)bin9990 -> 9990 bytes
-rw-r--r--sound/direct_sound_samples/cries/furret.aif (renamed from sound/direct_sound_samples/cry_furret.aif)bin3168 -> 3168 bytes
-rw-r--r--sound/direct_sound_samples/cries/gardevoir.aif (renamed from sound/direct_sound_samples/cry_gardevoir.aif)bin12154 -> 12154 bytes
-rw-r--r--sound/direct_sound_samples/cries/gastly.aif (renamed from sound/direct_sound_samples/cry_gastly.aif)bin11620 -> 11620 bytes
-rw-r--r--sound/direct_sound_samples/cries/gengar.aif (renamed from sound/direct_sound_samples/cry_gengar.aif)bin7372 -> 7372 bytes
-rw-r--r--sound/direct_sound_samples/cries/geodude.aif (renamed from sound/direct_sound_samples/cry_geodude.aif)bin11816 -> 11816 bytes
-rw-r--r--sound/direct_sound_samples/cries/girafarig.aif (renamed from sound/direct_sound_samples/cry_girafarig.aif)bin7346 -> 7346 bytes
-rw-r--r--sound/direct_sound_samples/cries/glalie.aif (renamed from sound/direct_sound_samples/cry_glalie.aif)bin10420 -> 10420 bytes
-rw-r--r--sound/direct_sound_samples/cries/gligar.aif (renamed from sound/direct_sound_samples/cry_gligar.aif)bin6068 -> 6068 bytes
-rw-r--r--sound/direct_sound_samples/cries/gloom.aif (renamed from sound/direct_sound_samples/cry_gloom.aif)bin6246 -> 6246 bytes
-rw-r--r--sound/direct_sound_samples/cries/golbat.aif (renamed from sound/direct_sound_samples/cry_golbat.aif)bin9674 -> 9674 bytes
-rw-r--r--sound/direct_sound_samples/cries/goldeen.aif (renamed from sound/direct_sound_samples/cry_goldeen.aif)bin4936 -> 4936 bytes
-rw-r--r--sound/direct_sound_samples/cries/golduck.aif (renamed from sound/direct_sound_samples/cry_golduck.aif)bin5646 -> 5646 bytes
-rw-r--r--sound/direct_sound_samples/cries/golem.aif (renamed from sound/direct_sound_samples/cry_golem.aif)bin7080 -> 7080 bytes
-rw-r--r--sound/direct_sound_samples/cries/gorebyss.aif (renamed from sound/direct_sound_samples/cry_gorebyss.aif)bin11176 -> 11176 bytes
-rw-r--r--sound/direct_sound_samples/cries/granbull.aif (renamed from sound/direct_sound_samples/cry_granbull.aif)bin11782 -> 11782 bytes
-rw-r--r--sound/direct_sound_samples/cries/graveler.aif (renamed from sound/direct_sound_samples/cry_graveler.aif)bin13900 -> 13900 bytes
-rw-r--r--sound/direct_sound_samples/cries/grimer.aif (renamed from sound/direct_sound_samples/cry_grimer.aif)bin5274 -> 5274 bytes
-rw-r--r--sound/direct_sound_samples/cries/groudon.aif (renamed from sound/direct_sound_samples/cry_groudon.aif)bin18438 -> 18438 bytes
-rw-r--r--sound/direct_sound_samples/cries/grovyle.aif (renamed from sound/direct_sound_samples/cry_grovyle.aif)bin10198 -> 10198 bytes
-rw-r--r--sound/direct_sound_samples/cries/growlithe.aif (renamed from sound/direct_sound_samples/cry_growlithe.aif)bin6696 -> 6696 bytes
-rw-r--r--sound/direct_sound_samples/cries/grumpig.aif (renamed from sound/direct_sound_samples/cry_grumpig.aif)bin6318 -> 6318 bytes
-rw-r--r--sound/direct_sound_samples/cries/gulpin.aif (renamed from sound/direct_sound_samples/cry_gulpin.aif)bin4028 -> 4028 bytes
-rw-r--r--sound/direct_sound_samples/cries/gyarados.aif (renamed from sound/direct_sound_samples/cry_gyarados.aif)bin10078 -> 10078 bytes
-rw-r--r--sound/direct_sound_samples/cries/hariyama.aif (renamed from sound/direct_sound_samples/cry_hariyama.aif)bin8348 -> 8348 bytes
-rw-r--r--sound/direct_sound_samples/cries/haunter.aif (renamed from sound/direct_sound_samples/cry_haunter.aif)bin11714 -> 11714 bytes
-rw-r--r--sound/direct_sound_samples/cries/heracross.aif (renamed from sound/direct_sound_samples/cry_heracross.aif)bin9144 -> 9144 bytes
-rw-r--r--sound/direct_sound_samples/cries/hitmonchan.aif (renamed from sound/direct_sound_samples/cry_hitmonchan.aif)bin8906 -> 8906 bytes
-rw-r--r--sound/direct_sound_samples/cries/hitmonlee.aif (renamed from sound/direct_sound_samples/cry_hitmonlee.aif)bin9318 -> 9318 bytes
-rw-r--r--sound/direct_sound_samples/cries/hitmontop.aif (renamed from sound/direct_sound_samples/cry_hitmontop.aif)bin6936 -> 6936 bytes
-rw-r--r--sound/direct_sound_samples/cries/ho_oh.aif (renamed from sound/direct_sound_samples/cry_ho_oh.aif)bin11260 -> 11260 bytes
-rw-r--r--sound/direct_sound_samples/cries/hoothoot.aif (renamed from sound/direct_sound_samples/cry_hoothoot.aif)bin5458 -> 5458 bytes
-rw-r--r--sound/direct_sound_samples/cries/hoppip.aif (renamed from sound/direct_sound_samples/cry_hoppip.aif)bin4226 -> 4226 bytes
-rw-r--r--sound/direct_sound_samples/cries/horsea.aif (renamed from sound/direct_sound_samples/cry_horsea.aif)bin4754 -> 4754 bytes
-rw-r--r--sound/direct_sound_samples/cries/houndoom.aif (renamed from sound/direct_sound_samples/cry_houndoom.aif)bin9820 -> 9820 bytes
-rw-r--r--sound/direct_sound_samples/cries/houndour.aif (renamed from sound/direct_sound_samples/cry_houndour.aif)bin6332 -> 6332 bytes
-rw-r--r--sound/direct_sound_samples/cries/huntail.aif (renamed from sound/direct_sound_samples/cry_huntail.aif)bin7944 -> 7944 bytes
-rw-r--r--sound/direct_sound_samples/cries/hypno.aif (renamed from sound/direct_sound_samples/cry_hypno.aif)bin14450 -> 14450 bytes
-rw-r--r--sound/direct_sound_samples/cries/igglybuff.aif (renamed from sound/direct_sound_samples/cry_igglybuff.aif)bin3518 -> 3518 bytes
-rw-r--r--sound/direct_sound_samples/cries/illumise.aif (renamed from sound/direct_sound_samples/cry_illumise.aif)bin8536 -> 8536 bytes
-rw-r--r--sound/direct_sound_samples/cries/ivysaur.aif (renamed from sound/direct_sound_samples/cry_ivysaur.aif)bin8270 -> 8270 bytes
-rw-r--r--sound/direct_sound_samples/cries/jigglypuff.aif (renamed from sound/direct_sound_samples/cry_jigglypuff.aif)bin2720 -> 2720 bytes
-rw-r--r--sound/direct_sound_samples/cries/jirachi.aif (renamed from sound/direct_sound_samples/cry_jirachi.aif)bin6758 -> 6758 bytes
-rw-r--r--sound/direct_sound_samples/cries/jolteon.aif (renamed from sound/direct_sound_samples/cry_jolteon.aif)bin7904 -> 7904 bytes
-rw-r--r--sound/direct_sound_samples/cries/jumpluff.aif (renamed from sound/direct_sound_samples/cry_jumpluff.aif)bin8106 -> 8106 bytes
-rw-r--r--sound/direct_sound_samples/cries/jynx.aif (renamed from sound/direct_sound_samples/cry_jynx.aif)bin23606 -> 23606 bytes
-rw-r--r--sound/direct_sound_samples/cries/kabuto.aif (renamed from sound/direct_sound_samples/cry_kabuto.aif)bin6170 -> 6170 bytes
-rw-r--r--sound/direct_sound_samples/cries/kabutops.aif (renamed from sound/direct_sound_samples/cry_kabutops.aif)bin6867 -> 6867 bytes
-rw-r--r--sound/direct_sound_samples/cries/kadabra.aif (renamed from sound/direct_sound_samples/cry_kadabra.aif)bin13408 -> 13408 bytes
-rw-r--r--sound/direct_sound_samples/cries/kakuna.aif (renamed from sound/direct_sound_samples/cry_kakuna.aif)bin9104 -> 9104 bytes
-rw-r--r--sound/direct_sound_samples/cries/kangaskhan.aif (renamed from sound/direct_sound_samples/cry_kangaskhan.aif)bin9334 -> 9334 bytes
-rw-r--r--sound/direct_sound_samples/cries/kecleon.aif (renamed from sound/direct_sound_samples/cry_kecleon.aif)bin4202 -> 4202 bytes
-rw-r--r--sound/direct_sound_samples/cries/kingdra.aif (renamed from sound/direct_sound_samples/cry_kingdra.aif)bin6922 -> 6922 bytes
-rw-r--r--sound/direct_sound_samples/cries/kingler.aif (renamed from sound/direct_sound_samples/cry_kingler.aif)bin12132 -> 12132 bytes
-rw-r--r--sound/direct_sound_samples/cries/kirlia.aif (renamed from sound/direct_sound_samples/cry_kirlia.aif)bin6100 -> 6100 bytes
-rw-r--r--sound/direct_sound_samples/cries/koffing.aif (renamed from sound/direct_sound_samples/cry_koffing.aif)bin10154 -> 10154 bytes
-rw-r--r--sound/direct_sound_samples/cries/krabby.aif (renamed from sound/direct_sound_samples/cry_krabby.aif)bin12112 -> 12112 bytes
-rw-r--r--sound/direct_sound_samples/cries/kyogre.aif (renamed from sound/direct_sound_samples/cry_kyogre.aif)bin17782 -> 17782 bytes
-rw-r--r--sound/direct_sound_samples/cries/lairon.aif (renamed from sound/direct_sound_samples/cry_lairon.aif)bin10392 -> 10392 bytes
-rw-r--r--sound/direct_sound_samples/cries/lanturn.aif (renamed from sound/direct_sound_samples/cry_lanturn.aif)bin5282 -> 5282 bytes
-rw-r--r--sound/direct_sound_samples/cries/lapras.aif (renamed from sound/direct_sound_samples/cry_lapras.aif)bin7408 -> 7408 bytes
-rw-r--r--sound/direct_sound_samples/cries/larvitar.aif (renamed from sound/direct_sound_samples/cry_larvitar.aif)bin6350 -> 6350 bytes
-rw-r--r--sound/direct_sound_samples/cries/latias.aif (renamed from sound/direct_sound_samples/cry_latias.aif)bin6098 -> 6098 bytes
-rw-r--r--sound/direct_sound_samples/cries/latios.aif (renamed from sound/direct_sound_samples/cry_latios.aif)bin10958 -> 10958 bytes
-rw-r--r--sound/direct_sound_samples/cries/ledian.aif (renamed from sound/direct_sound_samples/cry_ledian.aif)bin4214 -> 4214 bytes
-rw-r--r--sound/direct_sound_samples/cries/ledyba.aif (renamed from sound/direct_sound_samples/cry_ledyba.aif)bin3506 -> 3506 bytes
-rw-r--r--sound/direct_sound_samples/cries/lickitung.aif (renamed from sound/direct_sound_samples/cry_lickitung.aif)bin7571 -> 7571 bytes
-rw-r--r--sound/direct_sound_samples/cries/lileep.aif (renamed from sound/direct_sound_samples/cry_lileep.aif)bin4838 -> 4838 bytes
-rw-r--r--sound/direct_sound_samples/cries/linoone.aif (renamed from sound/direct_sound_samples/cry_linoone.aif)bin15248 -> 15248 bytes
-rw-r--r--sound/direct_sound_samples/cries/lombre.aif (renamed from sound/direct_sound_samples/cry_lombre.aif)bin7282 -> 7282 bytes
-rw-r--r--sound/direct_sound_samples/cries/lotad.aif (renamed from sound/direct_sound_samples/cry_lotad.aif)bin2232 -> 2232 bytes
-rw-r--r--sound/direct_sound_samples/cries/loudred.aif (renamed from sound/direct_sound_samples/cry_loudred.aif)bin6582 -> 6582 bytes
-rw-r--r--sound/direct_sound_samples/cries/ludicolo.aif (renamed from sound/direct_sound_samples/cry_ludicolo.aif)bin8398 -> 8398 bytes
-rw-r--r--sound/direct_sound_samples/cries/lugia.aif (renamed from sound/direct_sound_samples/cry_lugia.aif)bin18900 -> 18900 bytes
-rw-r--r--sound/direct_sound_samples/cries/lunatone.aif (renamed from sound/direct_sound_samples/cry_lunatone.aif)bin11956 -> 11956 bytes
-rw-r--r--sound/direct_sound_samples/cries/luvdisc.aif (renamed from sound/direct_sound_samples/cry_luvdisc.aif)bin2456 -> 2456 bytes
-rw-r--r--sound/direct_sound_samples/cries/machamp.aif (renamed from sound/direct_sound_samples/cry_machamp.aif)bin8256 -> 8256 bytes
-rw-r--r--sound/direct_sound_samples/cries/machoke.aif (renamed from sound/direct_sound_samples/cry_machoke.aif)bin6782 -> 6782 bytes
-rw-r--r--sound/direct_sound_samples/cries/machop.aif (renamed from sound/direct_sound_samples/cry_machop.aif)bin6696 -> 6696 bytes
-rw-r--r--sound/direct_sound_samples/cries/magby.aif (renamed from sound/direct_sound_samples/cry_magby.aif)bin7218 -> 7218 bytes
-rw-r--r--sound/direct_sound_samples/cries/magcargo.aif (renamed from sound/direct_sound_samples/cry_magcargo.aif)bin10486 -> 10486 bytes
-rw-r--r--sound/direct_sound_samples/cries/magikarp.aif (renamed from sound/direct_sound_samples/cry_magikarp.aif)bin9492 -> 9492 bytes
-rw-r--r--sound/direct_sound_samples/cries/magmar.aif (renamed from sound/direct_sound_samples/cry_magmar.aif)bin7738 -> 7738 bytes
-rw-r--r--sound/direct_sound_samples/cries/magnemite.aif (renamed from sound/direct_sound_samples/cry_magnemite.aif)bin9610 -> 9610 bytes
-rw-r--r--sound/direct_sound_samples/cries/magneton.aif (renamed from sound/direct_sound_samples/cry_magneton.aif)bin11914 -> 11914 bytes
-rw-r--r--sound/direct_sound_samples/cries/makuhita.aif (renamed from sound/direct_sound_samples/cry_makuhita.aif)bin3704 -> 3704 bytes
-rw-r--r--sound/direct_sound_samples/cries/manectric.aif (renamed from sound/direct_sound_samples/cry_manectric.aif)bin10492 -> 10492 bytes
-rw-r--r--sound/direct_sound_samples/cries/mankey.aif (renamed from sound/direct_sound_samples/cry_mankey.aif)bin8178 -> 8178 bytes
-rw-r--r--sound/direct_sound_samples/cries/mantine.aif (renamed from sound/direct_sound_samples/cry_mantine.aif)bin7884 -> 7884 bytes
-rw-r--r--sound/direct_sound_samples/cries/mareep.aif (renamed from sound/direct_sound_samples/cry_mareep.aif)bin3694 -> 3694 bytes
-rw-r--r--sound/direct_sound_samples/cries/marill.aif (renamed from sound/direct_sound_samples/cry_marill.aif)bin6538 -> 6538 bytes
-rw-r--r--sound/direct_sound_samples/cries/marowak.aif (renamed from sound/direct_sound_samples/cry_marowak.aif)bin7216 -> 7216 bytes
-rw-r--r--sound/direct_sound_samples/cries/marshtomp.aif (renamed from sound/direct_sound_samples/cry_marshtomp.aif)bin8498 -> 8498 bytes
-rw-r--r--sound/direct_sound_samples/cries/masquerain.aif (renamed from sound/direct_sound_samples/cry_masquerain.aif)bin9830 -> 9830 bytes
-rw-r--r--sound/direct_sound_samples/cries/mawile.aif (renamed from sound/direct_sound_samples/cry_mawile.aif)bin5756 -> 5756 bytes
-rw-r--r--sound/direct_sound_samples/cries/medicham.aif (renamed from sound/direct_sound_samples/cry_medicham.aif)bin8246 -> 8246 bytes
-rw-r--r--sound/direct_sound_samples/cries/meditite.aif (renamed from sound/direct_sound_samples/cry_meditite.aif)bin4078 -> 4078 bytes
-rw-r--r--sound/direct_sound_samples/cries/meganium.aif (renamed from sound/direct_sound_samples/cry_meganium.aif)bin8100 -> 8100 bytes
-rw-r--r--sound/direct_sound_samples/cries/meowth.aif (renamed from sound/direct_sound_samples/cry_meowth.aif)bin4796 -> 4796 bytes
-rw-r--r--sound/direct_sound_samples/cries/metagross.aif (renamed from sound/direct_sound_samples/cry_metagross.aif)bin19644 -> 19644 bytes
-rw-r--r--sound/direct_sound_samples/cries/metang.aif (renamed from sound/direct_sound_samples/cry_metang.aif)bin9398 -> 9398 bytes
-rw-r--r--sound/direct_sound_samples/cries/metapod.aif (renamed from sound/direct_sound_samples/cry_metapod.aif)bin11622 -> 11622 bytes
-rw-r--r--sound/direct_sound_samples/cries/mew.aif (renamed from sound/direct_sound_samples/cry_mew.aif)bin15146 -> 15146 bytes
-rw-r--r--sound/direct_sound_samples/cries/mewtwo.aif (renamed from sound/direct_sound_samples/cry_mewtwo.aif)bin15144 -> 15144 bytes
-rw-r--r--sound/direct_sound_samples/cries/mightyena.aif (renamed from sound/direct_sound_samples/cry_mightyena.aif)bin9748 -> 9748 bytes
-rw-r--r--sound/direct_sound_samples/cries/milotic.aif (renamed from sound/direct_sound_samples/cry_milotic.aif)bin19542 -> 19542 bytes
-rw-r--r--sound/direct_sound_samples/cries/miltank.aif (renamed from sound/direct_sound_samples/cry_miltank.aif)bin7424 -> 7424 bytes
-rw-r--r--sound/direct_sound_samples/cries/minun.aif (renamed from sound/direct_sound_samples/cry_minun.aif)bin8004 -> 8004 bytes
-rw-r--r--sound/direct_sound_samples/cries/misdreavus.aif (renamed from sound/direct_sound_samples/cry_misdreavus.aif)bin5816 -> 5816 bytes
-rw-r--r--sound/direct_sound_samples/cries/moltres.aif (renamed from sound/direct_sound_samples/cry_moltres.aif)bin11796 -> 11796 bytes
-rw-r--r--sound/direct_sound_samples/cries/mr_mime.aif (renamed from sound/direct_sound_samples/cry_mr_mime.aif)bin9446 -> 9446 bytes
-rw-r--r--sound/direct_sound_samples/cries/mudkip.aif (renamed from sound/direct_sound_samples/cry_mudkip.aif)bin3776 -> 3776 bytes
-rw-r--r--sound/direct_sound_samples/cries/muk.aif (renamed from sound/direct_sound_samples/cry_muk.aif)bin7374 -> 7374 bytes
-rw-r--r--sound/direct_sound_samples/cries/murkrow.aif (renamed from sound/direct_sound_samples/cry_murkrow.aif)bin8370 -> 8370 bytes
-rw-r--r--sound/direct_sound_samples/cries/natu.aif (renamed from sound/direct_sound_samples/cry_natu.aif)bin5294 -> 5294 bytes
-rw-r--r--sound/direct_sound_samples/cries/nidoking.aif (renamed from sound/direct_sound_samples/cry_nidoking.aif)bin12176 -> 12176 bytes
-rw-r--r--sound/direct_sound_samples/cries/nidoqueen.aif (renamed from sound/direct_sound_samples/cry_nidoqueen.aif)bin8424 -> 8424 bytes
-rw-r--r--sound/direct_sound_samples/cries/nidoran_f.aif (renamed from sound/direct_sound_samples/cry_nidoran_f.aif)bin4858 -> 4858 bytes
-rw-r--r--sound/direct_sound_samples/cries/nidoran_m.aif (renamed from sound/direct_sound_samples/cry_nidoran_m.aif)bin5216 -> 5216 bytes
-rw-r--r--sound/direct_sound_samples/cries/nidorina.aif (renamed from sound/direct_sound_samples/cry_nidorina.aif)bin6394 -> 6394 bytes
-rw-r--r--sound/direct_sound_samples/cries/nidorino.aif (renamed from sound/direct_sound_samples/cry_nidorino.aif)bin6042 -> 6042 bytes
-rw-r--r--sound/direct_sound_samples/cries/nincada.aif (renamed from sound/direct_sound_samples/cry_nincada.aif)bin3244 -> 3244 bytes
-rw-r--r--sound/direct_sound_samples/cries/ninetales.aif (renamed from sound/direct_sound_samples/cry_ninetales.aif)bin12174 -> 12174 bytes
-rw-r--r--sound/direct_sound_samples/cries/ninjask.aif (renamed from sound/direct_sound_samples/cry_ninjask.aif)bin6084 -> 6084 bytes
-rw-r--r--sound/direct_sound_samples/cries/noctowl.aif (renamed from sound/direct_sound_samples/cry_noctowl.aif)bin10564 -> 10564 bytes
-rw-r--r--sound/direct_sound_samples/cries/nosepass.aif (renamed from sound/direct_sound_samples/cry_nosepass.aif)bin6696 -> 6696 bytes
-rw-r--r--sound/direct_sound_samples/cries/numel.aif (renamed from sound/direct_sound_samples/cry_numel.aif)bin4664 -> 4664 bytes
-rw-r--r--sound/direct_sound_samples/cries/nuzleaf.aif (renamed from sound/direct_sound_samples/cry_nuzleaf.aif)bin5712 -> 5712 bytes
-rw-r--r--sound/direct_sound_samples/cries/octillery.aif (renamed from sound/direct_sound_samples/cry_octillery.aif)bin13084 -> 13084 bytes
-rw-r--r--sound/direct_sound_samples/cries/oddish.aif (renamed from sound/direct_sound_samples/cry_oddish.aif)bin7298 -> 7298 bytes
-rw-r--r--sound/direct_sound_samples/cries/omanyte.aif (renamed from sound/direct_sound_samples/cry_omanyte.aif)bin6672 -> 6672 bytes
-rw-r--r--sound/direct_sound_samples/cries/omastar.aif (renamed from sound/direct_sound_samples/cry_omastar.aif)bin6666 -> 6666 bytes
-rw-r--r--sound/direct_sound_samples/cries/onix.aif (renamed from sound/direct_sound_samples/cry_onix.aif)bin12340 -> 12340 bytes
-rw-r--r--sound/direct_sound_samples/cries/paras.aif (renamed from sound/direct_sound_samples/cry_paras.aif)bin13924 -> 13924 bytes
-rw-r--r--sound/direct_sound_samples/cries/parasect.aif (renamed from sound/direct_sound_samples/cry_parasect.aif)bin15140 -> 15140 bytes
-rw-r--r--sound/direct_sound_samples/cries/pelipper.aif (renamed from sound/direct_sound_samples/cry_pelipper.aif)bin5894 -> 5894 bytes
-rw-r--r--sound/direct_sound_samples/cries/persian.aif (renamed from sound/direct_sound_samples/cry_persian.aif)bin9412 -> 9412 bytes
-rw-r--r--sound/direct_sound_samples/cries/phanpy.aif (renamed from sound/direct_sound_samples/cry_phanpy.aif)bin5664 -> 5664 bytes
-rw-r--r--sound/direct_sound_samples/cries/pichu.aif (renamed from sound/direct_sound_samples/cry_pichu.aif)bin3684 -> 3684 bytes
-rw-r--r--sound/direct_sound_samples/cries/pidgeot.aif (renamed from sound/direct_sound_samples/cry_pidgeot.aif)bin8590 -> 8590 bytes
-rw-r--r--sound/direct_sound_samples/cries/pidgeotto.aif (renamed from sound/direct_sound_samples/cry_pidgeotto.aif)bin7512 -> 7512 bytes
-rw-r--r--sound/direct_sound_samples/cries/pidgey.aif (renamed from sound/direct_sound_samples/cry_pidgey.aif)bin1984 -> 1984 bytes
-rw-r--r--sound/direct_sound_samples/cries/pikachu.aif (renamed from sound/direct_sound_samples/cry_pikachu.aif)bin8316 -> 8316 bytes
-rw-r--r--sound/direct_sound_samples/cries/piloswine.aif (renamed from sound/direct_sound_samples/cry_piloswine.aif)bin6480 -> 6480 bytes
-rw-r--r--sound/direct_sound_samples/cries/pineco.aif (renamed from sound/direct_sound_samples/cry_pineco.aif)bin6690 -> 6690 bytes
-rw-r--r--sound/direct_sound_samples/cries/pinsir.aif (renamed from sound/direct_sound_samples/cry_pinsir.aif)bin6186 -> 6186 bytes
-rw-r--r--sound/direct_sound_samples/cries/plusle.aif (renamed from sound/direct_sound_samples/cry_plusle.aif)bin4504 -> 4504 bytes
-rw-r--r--sound/direct_sound_samples/cries/politoed.aif (renamed from sound/direct_sound_samples/cry_politoed.aif)bin9114 -> 9114 bytes
-rw-r--r--sound/direct_sound_samples/cries/poliwag.aif (renamed from sound/direct_sound_samples/cry_poliwag.aif)bin5562 -> 5562 bytes
-rw-r--r--sound/direct_sound_samples/cries/poliwhirl.aif (renamed from sound/direct_sound_samples/cry_poliwhirl.aif)bin3354 -> 3354 bytes
-rw-r--r--sound/direct_sound_samples/cries/poliwrath.aif (renamed from sound/direct_sound_samples/cry_poliwrath.aif)bin5582 -> 5582 bytes
-rw-r--r--sound/direct_sound_samples/cries/ponyta.aif (renamed from sound/direct_sound_samples/cry_ponyta.aif)bin7524 -> 7524 bytes
-rw-r--r--sound/direct_sound_samples/cries/poochyena.aif (renamed from sound/direct_sound_samples/cry_poochyena.aif)bin4656 -> 4656 bytes
-rw-r--r--sound/direct_sound_samples/cries/porygon.aif (renamed from sound/direct_sound_samples/cry_porygon.aif)bin10002 -> 10002 bytes
-rw-r--r--sound/direct_sound_samples/cries/porygon2.aif (renamed from sound/direct_sound_samples/cry_porygon2.aif)bin7854 -> 7854 bytes
-rw-r--r--sound/direct_sound_samples/cries/primeape.aif (renamed from sound/direct_sound_samples/cry_primeape.aif)bin8086 -> 8086 bytes
-rw-r--r--sound/direct_sound_samples/cries/psyduck.aif (renamed from sound/direct_sound_samples/cry_psyduck.aif)bin6578 -> 6578 bytes
-rw-r--r--sound/direct_sound_samples/cries/pupitar.aif (renamed from sound/direct_sound_samples/cry_pupitar.aif)bin4234 -> 4234 bytes
-rw-r--r--sound/direct_sound_samples/cries/quagsire.aif (renamed from sound/direct_sound_samples/cry_quagsire.aif)bin6684 -> 6684 bytes
-rw-r--r--sound/direct_sound_samples/cries/quilava.aif (renamed from sound/direct_sound_samples/cry_quilava.aif)bin5962 -> 5962 bytes
-rw-r--r--sound/direct_sound_samples/cries/qwilfish.aif (renamed from sound/direct_sound_samples/cry_qwilfish.aif)bin5808 -> 5808 bytes
-rw-r--r--sound/direct_sound_samples/cries/raichu.aif (renamed from sound/direct_sound_samples/cry_raichu.aif)bin11842 -> 11842 bytes
-rw-r--r--sound/direct_sound_samples/cries/raikou.aif (renamed from sound/direct_sound_samples/cry_raikou.aif)bin8704 -> 8704 bytes
-rw-r--r--sound/direct_sound_samples/cries/ralts.aif (renamed from sound/direct_sound_samples/cry_ralts.aif)bin5066 -> 5066 bytes
-rw-r--r--sound/direct_sound_samples/cries/rapidash.aif (renamed from sound/direct_sound_samples/cry_rapidash.aif)bin9292 -> 9292 bytes
-rw-r--r--sound/direct_sound_samples/cries/raticate.aif (renamed from sound/direct_sound_samples/cry_raticate.aif)bin4770 -> 4770 bytes
-rw-r--r--sound/direct_sound_samples/cries/rattata.aif (renamed from sound/direct_sound_samples/cry_rattata.aif)bin3956 -> 3956 bytes
-rw-r--r--sound/direct_sound_samples/cries/rayquaza.aif (renamed from sound/direct_sound_samples/cry_rayquaza.aif)bin14532 -> 14532 bytes
-rw-r--r--sound/direct_sound_samples/cries/regice.aif (renamed from sound/direct_sound_samples/cry_regice.aif)bin15936 -> 15936 bytes
-rw-r--r--sound/direct_sound_samples/cries/regirock.aif (renamed from sound/direct_sound_samples/cry_regirock.aif)bin15862 -> 15862 bytes
-rw-r--r--sound/direct_sound_samples/cries/registeel.aif (renamed from sound/direct_sound_samples/cry_registeel.aif)bin11476 -> 11476 bytes
-rw-r--r--sound/direct_sound_samples/cries/relicanth.aif (renamed from sound/direct_sound_samples/cry_relicanth.aif)bin10072 -> 10072 bytes
-rw-r--r--sound/direct_sound_samples/cries/remoraid.aif (renamed from sound/direct_sound_samples/cry_remoraid.aif)bin5290 -> 5290 bytes
-rw-r--r--sound/direct_sound_samples/cries/rhydon.aif (renamed from sound/direct_sound_samples/cry_rhydon.aif)bin10186 -> 10186 bytes
-rw-r--r--sound/direct_sound_samples/cries/rhyhorn.aif (renamed from sound/direct_sound_samples/cry_rhyhorn.aif)bin9686 -> 9686 bytes
-rw-r--r--sound/direct_sound_samples/cries/roselia.aif (renamed from sound/direct_sound_samples/cry_roselia.aif)bin5382 -> 5382 bytes
-rw-r--r--sound/direct_sound_samples/cries/sableye.aif (renamed from sound/direct_sound_samples/cry_sableye.aif)bin5826 -> 5826 bytes
-rw-r--r--sound/direct_sound_samples/cries/salamence.aif (renamed from sound/direct_sound_samples/cry_salamence.aif)bin12514 -> 12514 bytes
-rw-r--r--sound/direct_sound_samples/cries/sandshrew.aif (renamed from sound/direct_sound_samples/cry_sandshrew.aif)bin4678 -> 4678 bytes
-rw-r--r--sound/direct_sound_samples/cries/sandslash.aif (renamed from sound/direct_sound_samples/cry_sandslash.aif)bin6784 -> 6784 bytes
-rw-r--r--sound/direct_sound_samples/cries/sceptile.aif (renamed from sound/direct_sound_samples/cry_sceptile.aif)bin13012 -> 13012 bytes
-rw-r--r--sound/direct_sound_samples/cries/scizor.aif (renamed from sound/direct_sound_samples/cry_scizor.aif)bin11462 -> 11462 bytes
-rw-r--r--sound/direct_sound_samples/cries/scyther.aif (renamed from sound/direct_sound_samples/cry_scyther.aif)bin6676 -> 6676 bytes
-rw-r--r--sound/direct_sound_samples/cries/seadra.aif (renamed from sound/direct_sound_samples/cry_seadra.aif)bin4228 -> 4228 bytes
-rw-r--r--sound/direct_sound_samples/cries/seaking.aif (renamed from sound/direct_sound_samples/cry_seaking.aif)bin9654 -> 9654 bytes
-rw-r--r--sound/direct_sound_samples/cries/sealeo.aif (renamed from sound/direct_sound_samples/cry_sealeo.aif)bin5928 -> 5928 bytes
-rw-r--r--sound/direct_sound_samples/cries/seedot.aif (renamed from sound/direct_sound_samples/cry_seedot.aif)bin4106 -> 4106 bytes
-rw-r--r--sound/direct_sound_samples/cries/seel.aif (renamed from sound/direct_sound_samples/cry_seel.aif)bin8954 -> 8954 bytes
-rw-r--r--sound/direct_sound_samples/cries/sentret.aif (renamed from sound/direct_sound_samples/cry_sentret.aif)bin2108 -> 2108 bytes
-rw-r--r--sound/direct_sound_samples/cries/seviper.aif (renamed from sound/direct_sound_samples/cry_seviper.aif)bin5820 -> 5820 bytes
-rw-r--r--sound/direct_sound_samples/cries/sharpedo.aif (renamed from sound/direct_sound_samples/cry_sharpedo.aif)bin11488 -> 11488 bytes
-rw-r--r--sound/direct_sound_samples/cries/shedinja.aif (renamed from sound/direct_sound_samples/cry_shedinja.aif)bin3876 -> 3876 bytes
-rw-r--r--sound/direct_sound_samples/cries/shelgon.aif (renamed from sound/direct_sound_samples/cry_shelgon.aif)bin9992 -> 9992 bytes
-rw-r--r--sound/direct_sound_samples/cries/shellder.aif (renamed from sound/direct_sound_samples/cry_shellder.aif)bin7718 -> 7718 bytes
-rw-r--r--sound/direct_sound_samples/cries/shiftry.aif (renamed from sound/direct_sound_samples/cry_shiftry.aif)bin9860 -> 9860 bytes
-rw-r--r--sound/direct_sound_samples/cries/shroomish.aif (renamed from sound/direct_sound_samples/cry_shroomish.aif)bin4436 -> 4436 bytes
-rw-r--r--sound/direct_sound_samples/cries/shuckle.aif (renamed from sound/direct_sound_samples/cry_shuckle.aif)bin5110 -> 5110 bytes
-rw-r--r--sound/direct_sound_samples/cries/shuppet.aif (renamed from sound/direct_sound_samples/cry_shuppet.aif)bin4144 -> 4144 bytes
-rw-r--r--sound/direct_sound_samples/cries/silcoon.aif (renamed from sound/direct_sound_samples/cry_silcoon.aif)bin8074 -> 8074 bytes
-rw-r--r--sound/direct_sound_samples/cries/skarmory.aif (renamed from sound/direct_sound_samples/cry_skarmory.aif)bin11982 -> 11982 bytes
-rw-r--r--sound/direct_sound_samples/cries/skiploom.aif (renamed from sound/direct_sound_samples/cry_skiploom.aif)bin6516 -> 6516 bytes
-rw-r--r--sound/direct_sound_samples/cries/skitty.aif (renamed from sound/direct_sound_samples/cry_skitty.aif)bin3560 -> 3560 bytes
-rw-r--r--sound/direct_sound_samples/cries/slaking.aif (renamed from sound/direct_sound_samples/cry_slaking.aif)bin4970 -> 4970 bytes
-rw-r--r--sound/direct_sound_samples/cries/slakoth.aif (renamed from sound/direct_sound_samples/cry_slakoth.aif)bin4272 -> 4272 bytes
-rw-r--r--sound/direct_sound_samples/cries/slowbro.aif (renamed from sound/direct_sound_samples/cry_slowbro.aif)bin6720 -> 6720 bytes
-rw-r--r--sound/direct_sound_samples/cries/slowking.aif (renamed from sound/direct_sound_samples/cry_slowking.aif)bin11908 -> 11908 bytes
-rw-r--r--sound/direct_sound_samples/cries/slowpoke.aif (renamed from sound/direct_sound_samples/cry_slowpoke.aif)bin3724 -> 3724 bytes
-rw-r--r--sound/direct_sound_samples/cries/slugma.aif (renamed from sound/direct_sound_samples/cry_slugma.aif)bin8536 -> 8536 bytes
-rw-r--r--sound/direct_sound_samples/cries/smeargle.aif (renamed from sound/direct_sound_samples/cry_smeargle.aif)bin5114 -> 5114 bytes
-rw-r--r--sound/direct_sound_samples/cries/smoochum.aif (renamed from sound/direct_sound_samples/cry_smoochum.aif)bin5860 -> 5860 bytes
-rw-r--r--sound/direct_sound_samples/cries/sneasel.aif (renamed from sound/direct_sound_samples/cry_sneasel.aif)bin4586 -> 4586 bytes
-rw-r--r--sound/direct_sound_samples/cries/snorlax.aif (renamed from sound/direct_sound_samples/cry_snorlax.aif)bin2648 -> 2648 bytes
-rw-r--r--sound/direct_sound_samples/cries/snorunt.aif (renamed from sound/direct_sound_samples/cry_snorunt.aif)bin8500 -> 8500 bytes
-rw-r--r--sound/direct_sound_samples/cries/snubbull.aif (renamed from sound/direct_sound_samples/cry_snubbull.aif)bin7220 -> 7220 bytes
-rw-r--r--sound/direct_sound_samples/cries/solrock.aif (renamed from sound/direct_sound_samples/cry_solrock.aif)bin8080 -> 8080 bytes
-rw-r--r--sound/direct_sound_samples/cries/spearow.aif (renamed from sound/direct_sound_samples/cry_spearow.aif)bin8806 -> 8806 bytes
-rw-r--r--sound/direct_sound_samples/cries/spheal.aif (renamed from sound/direct_sound_samples/cry_spheal.aif)bin2880 -> 2880 bytes
-rw-r--r--sound/direct_sound_samples/cries/spinarak.aif (renamed from sound/direct_sound_samples/cry_spinarak.aif)bin6696 -> 6696 bytes
-rw-r--r--sound/direct_sound_samples/cries/spinda.aif (renamed from sound/direct_sound_samples/cry_spinda.aif)bin6216 -> 6216 bytes
-rw-r--r--sound/direct_sound_samples/cries/spoink.aif (renamed from sound/direct_sound_samples/cry_spoink.aif)bin3648 -> 3648 bytes
-rw-r--r--sound/direct_sound_samples/cries/squirtle.aif (renamed from sound/direct_sound_samples/cry_squirtle.aif)bin7222 -> 7222 bytes
-rw-r--r--sound/direct_sound_samples/cries/stantler.aif (renamed from sound/direct_sound_samples/cry_stantler.aif)bin11208 -> 11208 bytes
-rw-r--r--sound/direct_sound_samples/cries/starmie.aif (renamed from sound/direct_sound_samples/cry_starmie.aif)bin10402 -> 10402 bytes
-rw-r--r--sound/direct_sound_samples/cries/staryu.aif (renamed from sound/direct_sound_samples/cry_staryu.aif)bin9934 -> 9934 bytes
-rw-r--r--sound/direct_sound_samples/cries/steelix.aif (renamed from sound/direct_sound_samples/cry_steelix.aif)bin18988 -> 18988 bytes
-rw-r--r--sound/direct_sound_samples/cries/sudowoodo.aif (renamed from sound/direct_sound_samples/cry_sudowoodo.aif)bin8084 -> 8084 bytes
-rw-r--r--sound/direct_sound_samples/cries/suicune.aif (renamed from sound/direct_sound_samples/cry_suicune.aif)bin9126 -> 9126 bytes
-rw-r--r--sound/direct_sound_samples/cries/sunflora.aif (renamed from sound/direct_sound_samples/cry_sunflora.aif)bin7928 -> 7928 bytes
-rw-r--r--sound/direct_sound_samples/cries/sunkern.aif (renamed from sound/direct_sound_samples/cry_sunkern.aif)bin4056 -> 4056 bytes
-rw-r--r--sound/direct_sound_samples/cries/surskit.aif (renamed from sound/direct_sound_samples/cry_surskit.aif)bin5258 -> 5258 bytes
-rw-r--r--sound/direct_sound_samples/cries/swablu.aif (renamed from sound/direct_sound_samples/cry_swablu.aif)bin2824 -> 2824 bytes
-rw-r--r--sound/direct_sound_samples/cries/swalot.aif (renamed from sound/direct_sound_samples/cry_swalot.aif)bin8676 -> 8676 bytes
-rw-r--r--sound/direct_sound_samples/cries/swampert.aif (renamed from sound/direct_sound_samples/cry_swampert.aif)bin11220 -> 11220 bytes
-rw-r--r--sound/direct_sound_samples/cries/swellow.aif (renamed from sound/direct_sound_samples/cry_swellow.aif)bin4524 -> 4524 bytes
-rw-r--r--sound/direct_sound_samples/cries/swinub.aif (renamed from sound/direct_sound_samples/cry_swinub.aif)bin6328 -> 6328 bytes
-rw-r--r--sound/direct_sound_samples/cries/taillow.aif (renamed from sound/direct_sound_samples/cry_taillow.aif)bin3024 -> 3024 bytes
-rw-r--r--sound/direct_sound_samples/cries/tangela.aif (renamed from sound/direct_sound_samples/cry_tangela.aif)bin7550 -> 7550 bytes
-rw-r--r--sound/direct_sound_samples/cries/tauros.aif (renamed from sound/direct_sound_samples/cry_tauros.aif)bin9150 -> 9150 bytes
-rw-r--r--sound/direct_sound_samples/cries/teddiursa.aif (renamed from sound/direct_sound_samples/cry_teddiursa.aif)bin8266 -> 8266 bytes
-rw-r--r--sound/direct_sound_samples/cries/tentacool.aif (renamed from sound/direct_sound_samples/cry_tentacool.aif)bin7960 -> 7960 bytes
-rw-r--r--sound/direct_sound_samples/cries/tentacruel.aif (renamed from sound/direct_sound_samples/cry_tentacruel.aif)bin11458 -> 11458 bytes
-rw-r--r--sound/direct_sound_samples/cries/togepi.aif (renamed from sound/direct_sound_samples/cry_togepi.aif)bin5460 -> 5460 bytes
-rw-r--r--sound/direct_sound_samples/cries/togetic.aif (renamed from sound/direct_sound_samples/cry_togetic.aif)bin3526 -> 3526 bytes
-rw-r--r--sound/direct_sound_samples/cries/torchic.aif (renamed from sound/direct_sound_samples/cry_torchic.aif)bin4840 -> 4840 bytes
-rw-r--r--sound/direct_sound_samples/cries/torkoal.aif (renamed from sound/direct_sound_samples/cry_torkoal.aif)bin4662 -> 4662 bytes
-rw-r--r--sound/direct_sound_samples/cries/totodile.aif (renamed from sound/direct_sound_samples/cry_totodile.aif)bin9152 -> 9152 bytes
-rw-r--r--sound/direct_sound_samples/cries/trapinch.aif (renamed from sound/direct_sound_samples/cry_trapinch.aif)bin5080 -> 5080 bytes
-rw-r--r--sound/direct_sound_samples/cries/treecko.aif (renamed from sound/direct_sound_samples/cry_treecko.aif)bin5836 -> 5836 bytes
-rw-r--r--sound/direct_sound_samples/cries/tropius.aif (renamed from sound/direct_sound_samples/cry_tropius.aif)bin16318 -> 16318 bytes
-rw-r--r--sound/direct_sound_samples/cries/typhlosion.aif (renamed from sound/direct_sound_samples/cry_typhlosion.aif)bin18944 -> 18944 bytes
-rw-r--r--sound/direct_sound_samples/cries/tyranitar.aif (renamed from sound/direct_sound_samples/cry_tyranitar.aif)bin11656 -> 11656 bytes
-rw-r--r--sound/direct_sound_samples/cries/tyrogue.aif (renamed from sound/direct_sound_samples/cry_tyrogue.aif)bin8072 -> 8072 bytes
-rw-r--r--sound/direct_sound_samples/cries/umbreon.aif (renamed from sound/direct_sound_samples/cry_umbreon.aif)bin7746 -> 7746 bytes
-rw-r--r--sound/direct_sound_samples/cries/unown.aif (renamed from sound/direct_sound_samples/cry_unown.aif)bin6576 -> 6576 bytes
-rw-r--r--sound/direct_sound_samples/cries/unused_265.aif (renamed from sound/direct_sound_samples/cry_unused_265.aif)bin4676 -> 4676 bytes
-rw-r--r--sound/direct_sound_samples/cries/unused_268.aif (renamed from sound/direct_sound_samples/cry_unused_268.aif)bin8828 -> 8828 bytes
-rw-r--r--sound/direct_sound_samples/cries/ursaring.aif (renamed from sound/direct_sound_samples/cry_ursaring.aif)bin14862 -> 14862 bytes
-rw-r--r--sound/direct_sound_samples/cries/vaporeon.aif (renamed from sound/direct_sound_samples/cry_vaporeon.aif)bin11018 -> 11018 bytes
-rw-r--r--sound/direct_sound_samples/cries/venomoth.aif (renamed from sound/direct_sound_samples/cry_venomoth.aif)bin8002 -> 8002 bytes
-rw-r--r--sound/direct_sound_samples/cries/venonat.aif (renamed from sound/direct_sound_samples/cry_venonat.aif)bin7746 -> 7746 bytes
-rw-r--r--sound/direct_sound_samples/cries/venusaur.aif (renamed from sound/direct_sound_samples/cry_venusaur.aif)bin9648 -> 9648 bytes
-rw-r--r--sound/direct_sound_samples/cries/vibrava.aif (renamed from sound/direct_sound_samples/cry_vibrava.aif)bin7002 -> 7002 bytes
-rw-r--r--sound/direct_sound_samples/cries/victreebel.aif (renamed from sound/direct_sound_samples/cry_victreebel.aif)bin9630 -> 9630 bytes
-rw-r--r--sound/direct_sound_samples/cries/vigoroth.aif (renamed from sound/direct_sound_samples/cry_vigoroth.aif)bin7168 -> 7168 bytes
-rw-r--r--sound/direct_sound_samples/cries/vileplume.aif (renamed from sound/direct_sound_samples/cry_vileplume.aif)bin12760 -> 12760 bytes
-rw-r--r--sound/direct_sound_samples/cries/volbeat.aif (renamed from sound/direct_sound_samples/cry_volbeat.aif)bin5772 -> 5772 bytes
-rw-r--r--sound/direct_sound_samples/cries/voltorb.aif (renamed from sound/direct_sound_samples/cry_voltorb.aif)bin12346 -> 12346 bytes
-rw-r--r--sound/direct_sound_samples/cries/vulpix.aif (renamed from sound/direct_sound_samples/cry_vulpix.aif)bin11870 -> 11870 bytes
-rw-r--r--sound/direct_sound_samples/cries/wailmer.aif (renamed from sound/direct_sound_samples/cry_wailmer.aif)bin14134 -> 14134 bytes
-rw-r--r--sound/direct_sound_samples/cries/wailord.aif (renamed from sound/direct_sound_samples/cry_wailord.aif)bin20928 -> 20928 bytes
-rw-r--r--sound/direct_sound_samples/cries/walrein.aif (renamed from sound/direct_sound_samples/cry_walrein.aif)bin18067 -> 18067 bytes
-rw-r--r--sound/direct_sound_samples/cries/wartortle.aif (renamed from sound/direct_sound_samples/cry_wartortle.aif)bin8614 -> 8614 bytes
-rw-r--r--sound/direct_sound_samples/cries/weedle.aif (renamed from sound/direct_sound_samples/cry_weedle.aif)bin8124 -> 8124 bytes
-rw-r--r--sound/direct_sound_samples/cries/weepinbell.aif (renamed from sound/direct_sound_samples/cry_weepinbell.aif)bin7310 -> 7310 bytes
-rw-r--r--sound/direct_sound_samples/cries/weezing.aif (renamed from sound/direct_sound_samples/cry_weezing.aif)bin10806 -> 10806 bytes
-rw-r--r--sound/direct_sound_samples/cries/whiscash.aif (renamed from sound/direct_sound_samples/cry_whiscash.aif)bin8478 -> 8478 bytes
-rw-r--r--sound/direct_sound_samples/cries/whismur.aif (renamed from sound/direct_sound_samples/cry_whismur.aif)bin4092 -> 4092 bytes
-rw-r--r--sound/direct_sound_samples/cries/wigglytuff.aif (renamed from sound/direct_sound_samples/cry_wigglytuff.aif)bin3412 -> 3412 bytes
-rw-r--r--sound/direct_sound_samples/cries/wingull.aif (renamed from sound/direct_sound_samples/cry_wingull.aif)bin6132 -> 6132 bytes
-rw-r--r--sound/direct_sound_samples/cries/wobbuffet.aif (renamed from sound/direct_sound_samples/cry_wobbuffet.aif)bin10276 -> 10276 bytes
-rw-r--r--sound/direct_sound_samples/cries/wooper.aif (renamed from sound/direct_sound_samples/cry_wooper.aif)bin3710 -> 3710 bytes
-rw-r--r--sound/direct_sound_samples/cries/wurmple.aif (renamed from sound/direct_sound_samples/cry_wurmple.aif)bin4412 -> 4412 bytes
-rw-r--r--sound/direct_sound_samples/cries/wynaut.aif (renamed from sound/direct_sound_samples/cry_wynaut.aif)bin6932 -> 6932 bytes
-rw-r--r--sound/direct_sound_samples/cries/xatu.aif (renamed from sound/direct_sound_samples/cry_xatu.aif)bin7392 -> 7392 bytes
-rw-r--r--sound/direct_sound_samples/cries/yanma.aif (renamed from sound/direct_sound_samples/cry_yanma.aif)bin8506 -> 8506 bytes
-rw-r--r--sound/direct_sound_samples/cries/zangoose.aif (renamed from sound/direct_sound_samples/cry_zangoose.aif)bin4778 -> 4778 bytes
-rw-r--r--sound/direct_sound_samples/cries/zapdos.aif (renamed from sound/direct_sound_samples/cry_zapdos.aif)bin7724 -> 7724 bytes
-rw-r--r--sound/direct_sound_samples/cries/zigzagoon.aif (renamed from sound/direct_sound_samples/cry_zigzagoon.aif)bin5786 -> 5786 bytes
-rw-r--r--sound/direct_sound_samples/cries/zubat.aif (renamed from sound/direct_sound_samples/cry_zubat.aif)bin9688 -> 9688 bytes
-rw-r--r--src/battle_ai_script_commands.c4
-rw-r--r--src/battle_anim_smokescreen.c55
-rw-r--r--src/battle_controller_link_opponent.c4
-rw-r--r--src/battle_controller_player.c18
-rw-r--r--src/battle_controller_recorded_opponent.c4
-rw-r--r--src/battle_controllers.c7
-rw-r--r--src/battle_dome.c8
-rw-r--r--src/battle_factory.c184
-rw-r--r--src/battle_factory_screen.c57
-rw-r--r--src/battle_gfx_sfx_util.c164
-rw-r--r--src/battle_main.c32
-rw-r--r--src/battle_message.c40
-rw-r--r--src/battle_script_commands.c365
-rw-r--r--src/battle_util.c22
-rw-r--r--src/berry.c16
-rw-r--r--src/berry_blender.c11
-rwxr-xr-xsrc/berry_crush.c17
-rw-r--r--src/bike.c1
-rw-r--r--src/braille_puzzles.c1
-rw-r--r--src/cable_club.c772
-rw-r--r--src/confetti_util.c218
-rw-r--r--src/contest.c71
-rw-r--r--src/contest_link.c (renamed from src/contest_link_80FC4F4.c)12
-rw-r--r--src/contest_link_util.c (renamed from src/contest_link_81D9DE4.c)0
-rw-r--r--src/contest_painting.c18
-rw-r--r--src/contest_util.c (renamed from src/contest_link_80F57C4.c)1259
-rw-r--r--src/credits.c1
-rw-r--r--src/crt0.s80
-rw-r--r--src/data/text/nature_names.h2
-rw-r--r--src/data/union_room.h472
-rw-r--r--src/dodrio_berry_picking.c12
-rw-r--r--src/easy_chat.c6
-rwxr-xr-xsrc/ereader_screen.c12
-rw-r--r--src/event_object_lock.c2
-rw-r--r--src/event_object_movement.c143
-rwxr-xr-xsrc/faraway_island.c4
-rw-r--r--src/field_door.c1
-rw-r--r--src/field_effect.c4
-rwxr-xr-xsrc/field_effect_helpers.c38
-rw-r--r--src/field_player_avatar.c1
-rw-r--r--src/field_screen_effect.c8
-rw-r--r--src/field_special_scene.c1
-rw-r--r--src/field_specials.c15
-rw-r--r--src/field_tasks.c1
-rw-r--r--src/fieldmap.c11
-rw-r--r--src/fldeff_misc.c3
-rw-r--r--src/graphics.c56
-rw-r--r--src/gym_leader_rematch.c1
-rw-r--r--src/hall_of_fame.c340
-rw-r--r--src/image_processing_effects.c44
-rwxr-xr-xsrc/item_menu.c10
-rwxr-xr-xsrc/item_use.c2
-rw-r--r--src/libgcnmultiboot.s86
-rw-r--r--src/librfu_rfu.c4
-rw-r--r--src/link.c346
-rw-r--r--src/link_rfu_2.c2294
-rw-r--r--src/link_rfu_3.c754
-rw-r--r--src/main.c6
-rw-r--r--src/main_menu.c1
-rw-r--r--src/mauville_old_man.c1
-rw-r--r--src/menu.c3
-rwxr-xr-xsrc/mevent2.c6
-rw-r--r--src/mirage_tower.c1
-rw-r--r--src/mystery_event_menu.c4
-rw-r--r--src/mystery_gift.c17
-rw-r--r--src/naming_screen.c1
-rw-r--r--src/new_game.c2
-rw-r--r--src/overworld.c2
-rwxr-xr-xsrc/party_menu.c6
-rw-r--r--src/pokeball.c4
-rw-r--r--src/pokeblock.c4
-rw-r--r--src/pokeblock_feed.c2
-rw-r--r--src/pokedex.c12
-rwxr-xr-xsrc/pokedex_area_screen.c1
-rw-r--r--src/pokemon.c44
-rw-r--r--src/pokemon_animation.c2
-rwxr-xr-xsrc/pokemon_jump.c16
-rwxr-xr-xsrc/pokenav_match_call_1.c1
-rw-r--r--src/post_battle_event_funcs.c1
-rw-r--r--src/record_mixing.c15
-rw-r--r--src/region_map.c1
-rw-r--r--src/rom_81520A8.c218
-rw-r--r--src/save.c50
-rw-r--r--src/scrcmd.c18
-rwxr-xr-xsrc/script_pokemon_util_80F87D8.c7
-rw-r--r--src/secret_base.c3
-rw-r--r--src/slot_machine.c23
-rw-r--r--src/start_menu.c78
-rw-r--r--src/starter_choose.c291
-rw-r--r--src/strings.c16
-rw-r--r--src/trade.c21
-rwxr-xr-xsrc/trainer_card.c1
-rw-r--r--src/tv.c16
-rw-r--r--src/union_room.c3666
-rw-r--r--src/union_room_battle.c473
-rwxr-xr-xsrc/union_room_chat.c2588
-rw-r--r--src/union_room_player_avatar.c494
-rw-r--r--src/wild_encounter.c20
-rw-r--r--src/wireless_communication_status_screen.c432
-rw-r--r--sym_bss.txt1
-rw-r--r--sym_ewram.txt5
-rw-r--r--tools/gbagfx/main.c1
779 files changed, 13314 insertions, 11476 deletions
diff --git a/Makefile b/Makefile
index 27d77754c..99a93718b 100644
--- a/Makefile
+++ b/Makefile
@@ -49,6 +49,8 @@ DATA_SRC_SUBDIR = src/data
DATA_ASM_SUBDIR = data
SONG_SUBDIR = sound/songs
MID_SUBDIR = sound/songs/midi
+SAMPLE_SUBDIR = sound/direct_sound_samples
+CRY_SUBDIR = sound/direct_sound_samples/cries
C_BUILDDIR = $(OBJ_DIR)/$(C_SUBDIR)
GFLIB_BUILDDIR = $(OBJ_DIR)/$(GFLIB_SUBDIR)
@@ -67,7 +69,7 @@ OBJ_DIR := build/emerald
LIBPATH := -L ../../tools/agbcc/lib
else
CC1 = $(shell $(CC) --print-prog-name=cc1) -quiet
-override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -fno-aggressive-loop-optimizations -Wno-pointer-to-int-cast
+override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast
ROM := pokeemerald_modern.gba
OBJ_DIR := build/modern
LIBPATH := -L "$(dir $(shell $(CC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(CC) -mthumb -print-file-name=libc.a))"
@@ -173,7 +175,8 @@ clean-tools:
@$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);)
mostlyclean: tidy
- rm -f sound/direct_sound_samples/*.bin
+ rm -f $(SAMPLE_SUBDIR)/*.bin
+ rm -f $(CRY_SUBDIR)/*.bin
rm -f $(MID_SUBDIR)/*.s
find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} +
rm -f $(DATA_ASM_SUBDIR)/layouts/layouts.inc $(DATA_ASM_SUBDIR)/layouts/layouts_table.inc
@@ -212,7 +215,7 @@ include songs.mk
%.gbapal: %.png ; $(GFX) $< $@
%.lz: % ; $(GFX) $< $@
%.rl: % ; $(GFX) $< $@
-sound/direct_sound_samples/cry_%.bin: sound/direct_sound_samples/cry_%.aif ; $(AIF) $< $@ --compress
+$(CRY_SUBDIR)/%.bin: $(CRY_SUBDIR)/%.aif ; $(AIF) $< $@ --compress
sound/%.bin: sound/%.aif ; $(AIF) $< $@
@@ -232,7 +235,7 @@ $(C_BUILDDIR)/record_mixing.o: CFLAGS += -ffreestanding
$(C_BUILDDIR)/librfu_intr.o: CC1 := tools/agbcc/bin/agbcc_arm
$(C_BUILDDIR)/librfu_intr.o: CFLAGS := -O2 -mthumb-interwork -quiet
else
-$(C_BUILDDIR)/librfu_intr.o: CFLAGS := -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -fno-aggressive-loop-optimizations -Wno-pointer-to-int-cast
+$(C_BUILDDIR)/librfu_intr.o: CFLAGS := -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast
endif
ifeq ($(NODEP),1)
diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc
index eda410c5b..37548f410 100644
--- a/asm/macros/battle_script.inc
+++ b/asm/macros/battle_script.inc
@@ -1263,8 +1263,8 @@
various \battler, VARIOUS_GET_MOVE_TARGET
.endm
- .macro various4 battler:req
- various \battler, 4
+ .macro getbattlerfainted battler:req
+ various \battler, VARIOUS_GET_BATTLER_FAINTED
.endm
.macro resetintimidatetracebits battler:req
@@ -1279,8 +1279,8 @@
various \battler, 7
.endm
- .macro various8 battler:req
- various \battler, 8
+ .macro palaceflavortext battler:req
+ various \battler, VARIOUS_PALACE_FLAVOR_TEXT
.endm
.macro arenajudgmentwindow
@@ -1365,11 +1365,11 @@
.endm
.macro chosenstatus1animation battler:req, status:req
- chosenstatusanimation \battler 0x0 \status
+ chosenstatusanimation \battler, 0x0, \status
.endm
.macro chosenstatus2animation battler:req, status:req
- chosenstatusanimation \battler 0x1 \status
+ chosenstatusanimation \battler, 0x1, \status
.endm
.macro sethword dst:req, value:req
diff --git a/asm/macros/event.inc b/asm/macros/event.inc
index a4beb3527..5e5a2758d 100644
--- a/asm/macros/event.inc
+++ b/asm/macros/event.inc
@@ -274,15 +274,17 @@
.2byte \functionId
.endm
- @ Blocks script execution until a command or ASM code manually unblocks it. Generally used with specific commands and specials. If this command runs, and a subsequent command or piece of ASM does not unblock state, the script will remain blocked indefinitely (essentially a hang).
+ @ Blocks script execution until a command or ASM code manually unblocks it. Generally used with specific
+ @ commands and specials. If this command runs, and a subsequent command or piece of ASM does not unblock
+ @ state, the script will remain blocked indefinitely (essentially a hang).
.macro waitstate
.byte 0x27
.endm
- @ Blocks script execution for time (frames? milliseconds?).
- .macro delay time:req
+ @ Blocks script execution for frames. (Pokemon Emerald runs at just shy of 60 frames per second.)
+ .macro delay frames:req
.byte 0x28
- .2byte \time
+ .2byte \frames
.endm
@ Sets a to 1.
@@ -315,7 +317,8 @@
.byte 0x2d
.endm
- @ Sets the values of variables 0x8000, 0x8001, and 0x8002 to the current hour, minute, and second. In FRLG, this command sets those variables to zero.
+ @ Sets the values of variables 0x8000, 0x8001, and 0x8002 to the current hour, minute, and second. In FRLG,
+ @ this command sets those variables to zero.
.macro gettime
.byte 0x2e
.endm
@@ -378,7 +381,8 @@
.byte \speed
.endm
- @ Sends the player to Warp warp on Map bank.map. If the specified warp is 0xFF, then the player will instead be sent to (X, Y) on the map.
+ @ Sends the player to Warp warp on Map bank.map. If the specified warp is 0xFF,
+ @ then the player will instead be sent to (X, Y) on the map.
.macro warp map:req, warp:req, X:req, Y:req
.byte 0x39
map \map
@@ -429,7 +433,8 @@
.2byte \Y
.endm
- @ Sets the warp destination that a warp to Warp 127 on Map 127.127 will connect to. Useful when a map has warps that need to go to script-controlled locations (i.e. elevators).
+ @ Sets the warp destination that a warp to Warp 127 on Map 127.127 will connect to.
+ @ Useful when a map has warps that need to go to script-controlled locations (i.e. elevators).
.macro setdynamicwarp map:req, warp:req, X:req, Y:req
.byte 0x3f
map \map
@@ -468,7 +473,8 @@
.byte 0x43
.endm
- @ Attempts to add quantity of item index to the player's Bag. If the player has enough room, the item will be added and VAR_RESULT will be set to TRUE; otherwise, VAR_RESULT is set to FALSE.
+ @ Attempts to add quantity of item index to the player's Bag. If the player has enough room, the item will be added and
+ @ VAR_RESULT will be set to TRUE; otherwise, VAR_RESULT is set to FALSE.
.macro additem index:req, quantity=1
.byte 0x44
.2byte \index
@@ -482,21 +488,24 @@
.2byte \quantity
.endm
- @ Checks if the player has enough space in their Bag to hold quantity more of item index. Sets VAR_RESULT to TRUE if there is room, or FALSE is there is no room.
+ @ Checks if the player has enough space in their Bag to hold quantity more of item index. Sets VAR_RESULT to
+ @ TRUE if there is room, or FALSE is there is no room.
.macro checkitemspace index:req, quantity:req
.byte 0x46
.2byte \index
.2byte \quantity
.endm
- @ Checks if the player has quantity or more of item index in their Bag. Sets VAR_RESULT to TRUE if the player has enough of the item, or FALSE if they have fewer than quantity of the item.
+ @ Checks if the player has quantity or more of item index in their Bag. Sets VAR_RESULT to TRUE if the player has
+ @ enough of the item, or FALSE if they have fewer than quantity of the item.
.macro checkitem index:req, quantity:req
.byte 0x47
.2byte \index
.2byte \quantity
.endm
- @ Checks which Bag pocket the specified item belongs in, and writes the pocket value (POCKET_*) to VAR_RESULT. This script is used to show the name of the proper Bag pocket when the player receives an item via callstd (simplified to giveitem in XSE).
+ @ Checks which Bag pocket the specified item belongs in, and writes the pocket value (POCKET_*) to VAR_RESULT.
+ @ This script is used to show the name of the proper Bag pocket when the player receives an item via callstd (simplified to giveitem in XSE).
.macro checkitemtype index:req
.byte 0x48
.2byte \index
@@ -534,7 +543,8 @@
.2byte \decoration
.endm
- @ Checks if the player has enough space in their PC to hold decoration. Sets VAR_RESULT to TRUE if there is room, or FALSE is there is no room. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
+ @ Checks if the player has enough space in their PC to hold decoration. Sets VAR_RESULT to TRUE if there is room, or
+ @ FALSE is there is no room. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
.macro checkdecorspace decoration:req
.byte 0x4e
.2byte \decoration
@@ -556,7 +566,10 @@
.endif
.endm
- @ Blocks script execution until the movements being applied to the specified (index) Object finish. If the specified Object is 0x0000, then the command will block script execution until all Objects affected by applymovement finish their movements. If the specified Object is not currently being manipulated with applymovement, then this command does nothing.
+ @ Blocks script execution until the movements being applied to the specified (index) Object finish.
+ @ If the specified Object is 0x0000, then the command will block script execution until all Objects
+ @ affected by applymovement finish their movements. If the specified Object is not currently being
+ @ manipulated with applymovement, then this command does nothing.
@ If no map is specified, then the current map is used.
.macro waitmovement index:req, map
.ifb \map
@@ -569,7 +582,9 @@
.endif
.endm
- @ Attempts to hide the specified (index) Object on the specified (map_group, map_num) map, by setting its visibility flag if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing.
+ @ Attempts to hide the specified (index) Object on the specified (map_group, map_num) map,
+ @ by setting its visibility flag if it has a valid one. If the Object does not have a valid
+ @ visibility flag, this command does nothing.
@ If no map is specified, then the current map is used.
.macro removeobject index:req, map
.ifb \map
@@ -582,7 +597,8 @@
.endif
.endm
- @ Unsets the specified (index) Object's visibility flag on the specified (map_group, map_num) map if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing.
+ @ Unsets the specified (index) Object's visibility flag on the specified (map_group, map_num) map if it has a valid one.
+ @ If the Object does not have a valid visibility flag, this command does nothing.
@ If no map is specified, then the current map is used.
.macro addobject index:req, map
.ifb \map
@@ -723,7 +739,8 @@
.endm
- @ Starts a trainer battle using the battle information stored in RAM (usually by trainerbattle, which actually calls this command behind-the-scenes), and blocks script execution until the battle finishes.
+ @ Starts a trainer battle using the battle information stored in RAM (usually by trainerbattle, which actually calls this
+ @ command behind-the-scenes), and blocks script execution until the battle finishes.
.macro trainerbattlebegin
.byte 0x5d
.endm
@@ -763,7 +780,8 @@
.2byte \y
.endm
- @ Copies a live object event'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.
+ @ Copies a live object event'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
@@ -775,12 +793,15 @@
.byte \byte
.endm
- @ If a standard message box (or its text) is being drawn on-screen, this command blocks script execution until the box and its text have been fully drawn.
+ @ If a standard message box (or its text) is being drawn on-screen, this command blocks script execution until the
+ @ box and its text have been fully drawn.
.macro waitmessage
.byte 0x66
.endm
- @ Starts displaying a standard message box containing the specified text. If text is a pointer, then the string at that offset will be loaded and used. If text is script bank 0, then the value of script bank 0 will be treated as a pointer to the text. (You can use loadpointer to place a string pointer in a script bank.)
+ @ Starts displaying a standard message box containing the specified text. If text is a pointer, then the string at
+ @ that offset will be loaded and used. If text is script bank 0, then the value of script bank 0 will be treated as
+ @ a pointer to the text. (You can use loadpointer to place a string pointer in a script bank.)
.macro message text:req
.byte 0x67
.4byte \text
@@ -816,14 +837,16 @@
.byte 0x6d
.endm
- @ Displays a YES/NO multichoice box at the specified coordinates, and blocks script execution until the user makes a selection. Their selection is stored in VAR_RESULT as NO (0) or YES (1). Pressing B is equivalent to answering NO
+ @ Displays a YES/NO multichoice box at the specified coordinates, and blocks script execution until the user makes a selection.
+ @ Their selection is stored in VAR_RESULT as NO (0) or YES (1). Pressing B is equivalent to answering NO
.macro yesnobox x:req, y:req
.byte 0x6e
.byte \x
.byte \y
.endm
- @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
+ @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made.
+ @ Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
.macro multichoice x:req, y:req, list:req, b:req
.byte 0x6f
.byte \x
@@ -832,7 +855,10 @@
.byte \b
.endm
- @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. The default argument determines the initial position of the cursor when the box is first opened; it is zero-indexed, and if it is too large, it is treated as 0x00. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
+ @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made.
+ @ Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. The default argument determines
+ @ the initial position of the cursor when the box is first opened; it is zero-indexed, and if it is too large, it is treated as 0x00.
+ @ If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
.macro multichoicedefault x:req, y:req, list:req, default:req, b:req
.byte 0x70
.byte \x
@@ -842,7 +868,9 @@
.byte \b
.endm
- @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. The per_row argument determines how many list items will be shown on a single row of the box.
+ @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made.
+ @ Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list.
+ @ The per_row argument determines how many list items will be shown on a single row of the box.
.macro multichoicegrid x:req, y:req, list:req, per_row:req, B:req
.byte 0x71
.byte \x
@@ -894,7 +922,9 @@
.byte \a
.endm
- @ Displays the string at pointer as braille text in a standard message box. The string must be formatted to use braille characters and needs to provide six extra starting characters that are skipped (in RS, these characters determined the box's size and position, but in Emerald these are calculated automatically).
+ @ Displays the string at pointer as braille text in a standard message box. The string must be formatted to use braille
+ @ characters and needs to provide six extra starting characters that are skipped (in RS, these characters determined the
+ @ box's size and position, but in Emerald these are calculated automatically).
.macro braillemessage text:req
.byte 0x78
.4byte \text
@@ -923,7 +953,9 @@
.2byte \move
.endm
- @ Checks if at least one Pokemon in the player's party knows the specified (index) attack. If so, VAR_RESULT is set to the (zero-indexed) slot number of the first Pokemon that knows the move. If not, VAR_RESULT is set to PARTY_SIZE. VAR_0x8004 is also set to this Pokemon's species.
+ @ Checks if at least one Pokemon in the player's party knows the specified (index) attack. If so, VAR_RESULT is set to the
+ @ (zero-indexed) slot number of the first Pokemon that knows the move. If not, VAR_RESULT is set to PARTY_SIZE.
+ @ VAR_0x8004 is also set to this Pokemon's species.
.macro checkpartymove index:req
.byte 0x7c
.2byte \index
@@ -942,14 +974,16 @@
.byte \out
.endm
- @ Writes the nickname of the Pokemon in slot slot (zero-indexed) of the player's party to the specified buffer. If an empty or invalid slot is specified, ten spaces ("") are written to the buffer.
+ @ Writes the nickname of the Pokemon in slot slot (zero-indexed) of the player's party to the specified buffer.
+ @ If an empty or invalid slot is specified, ten spaces ("") are written to the buffer.
.macro bufferpartymonnick out:req, slot:req
.byte 0x7f
.byte \out
.2byte \slot
.endm
- @ Writes the name of the item at index item to the specified buffer. If the specified index is larger than the number of items in the game (0x176), the name of item 0 ("????????") is buffered instead.
+ @ Writes the name of the item at index item to the specified buffer. If the specified index is larger than
+ @ the number of items in the game (0x176), the name of item 0 ("????????") is buffered instead.
.macro bufferitemname out:req, item:req
.byte 0x80
.byte \out
@@ -977,7 +1011,8 @@
.2byte \input
.endm
- @ Writes the standard string identified by index to the specified buffer. This command has no protections in place at all, so specifying an invalid standard string (e.x. 0x2B) can and usually will cause data corruption.
+ @ Writes the standard string identified by index to the specified buffer. This command has no protections in place at all,
+ @ so specifying an invalid standard string (e.x. 0x2B) can and usually will cause crashes or garbage characters.
.macro bufferstdstring out:req, index:req
.byte 0x84
.byte \out
@@ -1063,7 +1098,8 @@
.byte \check
.endm
- @ If check is 0x00, this command will check if the player has money >= value; VAR_RESULT is set to TRUE if the player has enough money, or FALSE if they do not.
+ @ If check is 0x00, this command will check if the player has money >= value; VAR_RESULT is set to TRUE if the player
+ @ has enough money, or FALSE if they do not.
.macro checkmoney value:req, check:req
.byte 0x92
.4byte \value
@@ -1291,7 +1327,8 @@
.2byte \count
.endm
- @ Prepares to start a wild battle against a species at Level level holding item. Running this command will not affect normal wild battles. You start the prepared battle with dowildbattle.
+ @ Prepares to start a wild battle against a species at Level level holding item. Running this command will not affect
+ @ normal wild battles. You start the prepared battle with dowildbattle.
.macro setwildbattle species:req, level:req, item:req
.byte 0xb6
.2byte \species
@@ -1395,19 +1432,22 @@
.2byte \box
.endm
- @ Sets the color of the text in standard message boxes. 0x00 produces blue (male) text, 0x01 produces red (female) text, 0xFF resets the color to the default for the current OW's gender, and all other values produce black text.
+ @ Sets the color of the text in standard message boxes. 0x00 produces blue (male) text, 0x01 produces red (female) text,
+ @ 0xFF resets the color to the default for the current OW's gender, and all other values produce black text.
.macro textcolor color:req
.byte 0xc7
.byte \color
.endm
- @ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of the screen when the Main Menu is opened.
+ @ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom
+ @ of the screen when the Main Menu is opened.
.macro loadhelp pointer:req
.byte 0xc8
.4byte \pointer
.endm
- @ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of the screen when the Main Menu is opened.
+ @ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of
+ @ the screen when the Main Menu is opened.
.macro unloadhelp
.byte 0xc9
.endm
@@ -1435,13 +1475,15 @@
.2byte \slot
.endm
- @ Checks if the Pokemon in the specified slot of the player's party is obedient. If the Pokemon is disobedient, VAR_RESULT is TRUE. If the Pokemon is obedient (or if the specified slot is empty or invalid), VAR_RESULT is FALSE.
+ @ Checks if the Pokemon in the specified slot of the player's party is obedient. If the Pokemon is disobedient,
+ @ VAR_RESULT is TRUE. If the Pokemon is obedient (or if the specified slot is empty or invalid), VAR_RESULT is FALSE.
.macro checkmonobedience slot:req
.byte 0xce
.2byte \slot
.endm
- @ Depending on factors I haven't managed to understand yet, this command may cause script execution to jump to the offset specified by the pointer at 0x020375C0.
+ @ Depending on factors I haven't managed to understand yet, this command may cause script execution to jump to the
+ @ offset specified by the pointer at 0x020375C0.
.macro gotoram
.byte 0xcf
.endm
@@ -1468,7 +1510,8 @@
.byte \location
.endm
- @ For the rotating tile puzzles in Mossdeep Gym/Trick House Room 7. Moves the objects on the colored puzzle specified by puzzleNumber one rotation
+ @ For the rotating tile puzzles in Mossdeep Gym/Trick House Room 7. Moves the objects on the colored puzzle
+ @ specified by puzzleNumber one rotation
.macro moverotatingtileobjects puzzleNumber:req
.byte 0xd3
.2byte \puzzleNumber
@@ -1479,7 +1522,9 @@
.byte 0xd4
.endm
- @ For the rotating tile puzzles in Mossdeep Gym/Trick House Room 7. Allocates memory for the puzzle objects. isTrickHouse is needed to determine which of the two maps the puzzle is on, in order to know where in the tileset the puzzle tiles start. In FireRed, this command is a nop.
+ @ For the rotating tile puzzles in Mossdeep Gym/Trick House Room 7. Allocates memory for the puzzle objects.
+ @ isTrickHouse is needed to determine which of the two maps the puzzle is on, in order to know where in the tileset
+ @ the puzzle tiles start. In FireRed, this command is a nop.
.macro initrotatingtilepuzzle isTrickHouse:req
.byte 0xd5
.2byte \isTrickHouse
@@ -1551,7 +1596,10 @@
.2byte \word
.endm
- @ Writes the name of the specified (item) item to the specified buffer. If the specified item is a Berry (0x85 - 0xAE) or Poke Ball (0x4) and if the quantity is 2 or more, the buffered string will be pluralized ("IES" or "S" appended). If the specified item is the Enigma Berry, I have no idea what this command does (but testing showed no pluralization). If the specified index is larger than the number of items in the game (0x176), the name of item 0 ("????????") is buffered instead.
+ @ Writes the name of the specified (item) item to the specified buffer. If the specified item is a Berry (0x85 - 0xAE) or
+ @ Poke Ball (0x4) and if the quantity is 2 or more, the buffered string will be pluralized ("IES" or "S" appended).
+ @ If the specified item is the Enigma Berry, I have no idea what this command does (but testing showed no pluralization).
+ @ If the specified index is larger than the number of items in the game (0x176), the name of item 0 ("????????") is buffered instead.
.macro bufferitemnameplural out:req, item:req, quantity:req
.byte 0xe2
.byte \out
diff --git a/berry_fix/asm/loader.s b/berry_fix/asm/loader.s
index 39e0b768a..a78014078 100644
--- a/berry_fix/asm/loader.s
+++ b/berry_fix/asm/loader.s
@@ -75,21 +75,21 @@ _send: @ 14c
_150:
bl _recv
bne _150
- mov r2, 0
+ mov r2, #0
strh r2, [r0, 0xa] @ SIOMLT_SEND
- cmp r1, 0
+ cmp r1, #0
bne _150
mov r2, 0x8000
_16c:
- mov r1, 0
+ mov r1, #0
_170:
strh r1, [r0, 0xa] @ SIOMLT_SEND
bl _recv
bne _150
cmp r1, r2
bne _16c
- lsr r2, 5
- cmp r1, 0
+ lsr r2, #5
+ cmp r1, #0
bne _170
ldr r3, =BerryFixMBHeaderGameCode
ldrh r2, [r3]
@@ -105,7 +105,7 @@ _1a0:
bne _1a0
cmp r1, r2
bne _1a0
- mov r1, 0
+ mov r1, #0
strh r1, [r0, 0xa] @ SIOMLT_SEND
ldr r0, =_data_2f0
ldr r1, =gCode
diff --git a/berry_fix/payload/asm/crt0.s b/berry_fix/payload/asm/crt0.s
index 872a63018..2bca00636 100644
--- a/berry_fix/payload/asm/crt0.s
+++ b/berry_fix/payload/asm/crt0.s
@@ -9,10 +9,10 @@
.align 2, 0
.global Init
Init:
- mov r0, PSR_IRQ_MODE
+ mov r0, #PSR_IRQ_MODE
msr cpsr_cf, r0
ldr sp, sp_irq
- mov r0, PSR_SYS_MODE
+ mov r0, #PSR_SYS_MODE
msr cpsr_cf, r0
ldr sp, sp_sys
ldr r1, =INTR_VECTOR
@@ -34,8 +34,8 @@ sp_irq: .word IWRAM_END - 0x60
.align 2, 0
.global IntrMain
IntrMain: @ 0x2010048
- mov ip, REG_BASE
- add r3, ip, OFFSET_REG_IE
+ mov ip, #REG_BASE
+ add r3, ip, #OFFSET_REG_IE
ldr r2, [r3]
and r1, r2, r2, lsr #16
mov r2, #0
diff --git a/berry_fix/payload/asm/libagbsyscall.s b/berry_fix/payload/asm/libagbsyscall.s
index ea8ef3e89..9548e80d2 100644
--- a/berry_fix/payload/asm/libagbsyscall.s
+++ b/berry_fix/payload/asm/libagbsyscall.s
@@ -7,39 +7,39 @@
thumb_func_start CpuSet
CpuSet: @ 81E3B64
- swi 0xB
+ svc 0xB
bx lr
thumb_func_end CpuSet
thumb_func_start Div
Div: @ 81E3B68
- swi 0x6
+ svc 0x6
bx lr
thumb_func_end Div
thumb_func_start Mod
Mod:
- swi 0x6
+ svc 0x6
adds r0, r1, 0
bx lr
thumb_func_end Mod
thumb_func_start LZ77UnCompVram
LZ77UnCompVram: @ 81E3B6C
- swi 0x12
+ svc 0x12
bx lr
thumb_func_end LZ77UnCompVram
thumb_func_start RegisterRamReset
RegisterRamReset: @ 81E3B80
- swi 0x1
+ svc 0x1
bx lr
thumb_func_end RegisterRamReset
thumb_func_start VBlankIntrWait
VBlankIntrWait: @ 81E3BA0
movs r2, 0
- swi 0x5
+ svc 0x5
bx lr
thumb_func_end VBlankIntrWait
diff --git a/common_syms/link.txt b/common_syms/link.txt
index a6d096116..37c16a557 100644
--- a/common_syms/link.txt
+++ b/common_syms/link.txt
@@ -3,15 +3,15 @@ gLinkDebugSeed
gLocalLinkPlayerBlock
gLinkErrorOccurred
gLinkDebugFlags
-gFiller_03003074
+gLinkFiller1
gRemoteLinkPlayersNotReceived
gBlockReceivedStatus
-gFiller_03003080
+gLinkFiller2
gLinkHeldKeys
gRecvCmds
gLinkStatus
-gUnknown_030030E4
-gUnknown_030030E8
+gLinkDummy1
+gLinkDummy2
gUnknown_030030EC
gUnknown_030030F0
gUnknown_030030F4
@@ -26,12 +26,10 @@ gLinkCallback
gShouldAdvanceLinkState
gLinkTestBlockChecksums
gBlockRequestType
-gFiller_03003154
-gFiller_03003158
-gFiller_0300315c
+gLinkFiller3
+gLinkFiller4
+gLinkFiller5
gLastSendQueueCount
gLink
gLastRecvQueueCount
gLinkSavedIme
-gFiller_03004138
-gFiller_0300413C
diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s
index f2f82ee50..3db9f28ff 100644
--- a/data/battle_scripts_1.s
+++ b/data/battle_scripts_1.s
@@ -3153,8 +3153,8 @@ BattleScript_PursuitDmgOnSwitchOut::
waitmessage 0x40
tryfaintmon BS_TARGET, FALSE, NULL
moveendfromto MOVEEND_ON_DAMAGE_ABILITIES, MOVEEND_CHOICE_MOVE
- various4 BS_TARGET
- jumpifbyte CMP_EQUAL, gBattleCommunication, 0x0, BattleScript_PursuitDmgOnSwitchOutRet
+ getbattlerfainted BS_TARGET
+ jumpifbyte CMP_EQUAL, gBattleCommunication, FALSE, BattleScript_PursuitDmgOnSwitchOutRet
setbyte sGIVEEXP_STATE, 0x0
getexp BS_TARGET
BattleScript_PursuitDmgOnSwitchOutRet:
@@ -4442,18 +4442,18 @@ BattleScript_FlushMessageBox::
printstring STRINGID_EMPTYSTRING3
return
-BattleScript_82DB881::
- setbyte gBattleCommunication + 1, 0x0
-BattleScript_82DB887::
- various8 BS_ATTACKER
- jumpifbyte CMP_NOT_EQUAL, gBattleCommunication, 0x1, BattleScript_82DB89D
- printfromtable gStringIds_85CCF0A
- waitmessage 0x40
-BattleScript_82DB89D::
- addbyte gBattleCommunication + 1, 0x1
- jumpifbytenotequal gBattleCommunication + 1, gBattlersCount, BattleScript_82DB887
- setbyte gBattleCommunication, 0x0
- setbyte gBattleCommunication + 1, 0x0
+BattleScript_PalacePrintFlavorText::
+ setbyte gBattleCommunication + 1, 0
+BattleScript_PalaceTryBattlerFlavorText::
+ palaceflavortext BS_ATTACKER @ BS_ATTACKER here overwritten by gBattleCommunication + 1
+ jumpifbyte CMP_NOT_EQUAL, gBattleCommunication, TRUE, BattleScript_PalaceEndFlavorText
+ printfromtable gBattlePalaceFlavorTextTable
+ waitmessage 0x40
+BattleScript_PalaceEndFlavorText::
+ addbyte gBattleCommunication + 1, 1
+ jumpifbytenotequal gBattleCommunication + 1, gBattlersCount, BattleScript_PalaceTryBattlerFlavorText
+ setbyte gBattleCommunication, 0
+ setbyte gBattleCommunication + 1, 0
end2
BattleScript_ArenaTurnBeginning::
diff --git a/data/event_scripts.s b/data/event_scripts.s
index 4cc10fef8..7cc5960d4 100644
--- a/data/event_scripts.s
+++ b/data/event_scripts.s
@@ -775,8 +775,8 @@ EventScript_HideMrBriney:: @ 82721F8
return
RusturfTunnel_EventScript_SetRusturfTunnelOpen:: @ 8272216
- removeobject 1
- removeobject 10
+ removeobject LOCALID_WANDAS_BF
+ removeobject LOCALID_WANDA
clearflag FLAG_HIDE_VERDANTURF_TOWN_WANDAS_HOUSE_WANDAS_BOYFRIEND
clearflag FLAG_HIDE_VERDANTURF_TOWN_WANDAS_HOUSE_WANDA
setvar VAR_RUSTURF_TUNNEL_STATE, 6
diff --git a/data/maps/AbandonedShip_CaptainsOffice/scripts.inc b/data/maps/AbandonedShip_CaptainsOffice/scripts.inc
index b2940eb6f..139701edb 100644
--- a/data/maps/AbandonedShip_CaptainsOffice/scripts.inc
+++ b/data/maps/AbandonedShip_CaptainsOffice/scripts.inc
@@ -6,7 +6,7 @@ AbandonedShip_CaptainsOffice_EventScript_CaptSternAide:: @ 82387E2
faceplayer
goto_if_set FLAG_EXCHANGED_SCANNER, AbandonedShip_CaptainsOffice_EventScript_ThisIsSSCactus
checkitem ITEM_SCANNER, 1
- compare VAR_RESULT, 1
+ compare VAR_RESULT, TRUE
goto_if_eq AbandonedShip_CaptainsOffice_EventScript_CanYouDeliverScanner
goto_if_set FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_4_SCANNER, AbandonedShip_CaptainsOffice_EventScript_ThisIsSSCactus
msgbox AbandonedShip_CaptainsOffice_Text_NoSuccessFindingScanner, MSGBOX_DEFAULT
diff --git a/data/maps/AquaHideout_B2F/scripts.inc b/data/maps/AquaHideout_B2F/scripts.inc
index dd2c38fa4..25fc1820f 100644
--- a/data/maps/AquaHideout_B2F/scripts.inc
+++ b/data/maps/AquaHideout_B2F/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_MATT, 1
+.set LOCALID_SUBMARINE, 4
+
AquaHideout_B2F_MapScripts:: @ 8233DCF
map_script MAP_SCRIPT_ON_TRANSITION, AquaHideout_B2F_OnTransition
.byte 0
@@ -12,7 +15,7 @@ AquaHideout_B2F_EventScript_PreventMattNoticing:: @ 8233DDF
AquaHideout_B2F_EventScript_MattNoticePlayer:: @ 8233DE5
lockall
- setvar VAR_0x8008, 1 @ Matt object event id
+ setvar VAR_0x8008, LOCALID_MATT
playse SE_PIN
applymovement VAR_0x8008, Common_Movement_ExclamationMark
waitmovement 0
@@ -29,8 +32,8 @@ AquaHideout_B2F_EventScript_Matt:: @ 8233E09
end
AquaHideout_B2F_EventScript_SubmarineEscape:: @ 8233E25
- setvar VAR_0x8008, 1 @ Matt object event id
- setvar VAR_0x8009, 4 @ Submarine object event id
+ setvar VAR_0x8008, LOCALID_MATT
+ setvar VAR_0x8009, LOCALID_SUBMARINE
applymovement VAR_0x8008, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
delay 20
diff --git a/data/maps/BattleFrontier_BattleArenaBattleRoom/scripts.inc b/data/maps/BattleFrontier_BattleArenaBattleRoom/scripts.inc
index 910cabac3..c3b4154ba 100644
--- a/data/maps/BattleFrontier_BattleArenaBattleRoom/scripts.inc
+++ b/data/maps/BattleFrontier_BattleArenaBattleRoom/scripts.inc
@@ -1,3 +1,12 @@
+.set LOCALID_BLACK_BELT_1, 1
+.set LOCALID_BLACK_BELT_2, 2
+.set LOCALID_BLACK_BELT_3, 3
+.set LOCALID_BLACK_BELT_4, 4
+.set LOCALID_ATTENDANT, 5
+.set LOCALID_OPPONENT, 7
+.set LOCALID_PLAYER, 8
+.set LOCALID_ANNOUNCER, 9
+
BattleFrontier_BattleArenaBattleRoom_MapScripts:: @ 8257487
map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_BattleArenaBattleRoom_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattleArenaBattleRoom_OnFrame
@@ -6,7 +15,7 @@ BattleFrontier_BattleArenaBattleRoom_MapScripts:: @ 8257487
.byte 0
@ On this map the player (OBJ_EVENT_ID_PLAYER) is hidden
- @ The player is represented instead by object event 8, which has the gfx id VAR_OBJ_GFX_ID_1
+ @ The player is represented instead by LOCALID_PLAYER, which has the gfx id VAR_OBJ_GFX_ID_1
BattleFrontier_BattleArenaBattleRoom_OnResume: @ 825749C
special OffsetCameraForBattle
@@ -39,48 +48,48 @@ BattleFrontier_BattleArenaBattleRoom_OnFrame: @ 82574D2
BattleFrontier_BattleArenaBattleRoom_EventScript_EnterRoom:: @ 82574DC
lockall
- showobjectat 8, MAP_BATTLE_FRONTIER_BATTLE_ARENA_BATTLE_ROOM
- applymovement 8, BattleFrontier_BattleArenaBattleRoom_Movement_PlayerEnter
+ showobjectat LOCALID_PLAYER, MAP_BATTLE_FRONTIER_BATTLE_ARENA_BATTLE_ROOM
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleArenaBattleRoom_Movement_PlayerEnter
waitmovement 0
frontier_get FRONTIER_DATA_BATTLE_NUM
compare VAR_RESULT, 0
goto_if_eq BattleFrontier_BattleArenaBattleRoom_EventScript_AnnounceTrainers
- applymovement 5, BattleFrontier_BattleArenaBattleRoom_Movement_WalkInPlaceDown
- applymovement 8, BattleFrontier_BattleArenaBattleRoom_Movement_WalkInPlaceLeft
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleArenaBattleRoom_Movement_WalkInPlaceDown
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleArenaBattleRoom_Movement_WalkInPlaceLeft
setvar VAR_TEMP_2, 1
frontier_set FRONTIER_DATA_RECORD_DISABLED, TRUE
goto BattleFrontier_BattleArenaBattleRoom_EventScript_AskReadyForOpponent
BattleFrontier_BattleArenaBattleRoom_EventScript_AnnounceTrainers:: @ 825752E
tower_setopponent
- addobject 7
- applymovement 7, BattleFrontier_BattleArenaBattleRoom_Movement_OpponentEnter
+ addobject LOCALID_OPPONENT
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleArenaBattleRoom_Movement_OpponentEnter
waitmovement 0
- applymovement 9, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
+ applymovement LOCALID_ANNOUNCER, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
playse SE_W187
waitse
waitmovement 0
msgbox BattleFrontier_BattleArenaBattleRoom_Text_PlayerStepForward, MSGBOX_DEFAULT
closemessage
- applymovement 8, BattleFrontier_BattleArenaBattleRoom_Movement_PlayerStepForward
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleArenaBattleRoom_Movement_PlayerStepForward
waitmovement 0
- applymovement 9, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
+ applymovement LOCALID_ANNOUNCER, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
playse SE_W187
waitse
waitmovement 0
arena_gettrainername
msgbox BattleFrontier_BattleArenaBattleRoom_Text_OpponentStepForward, MSGBOX_DEFAULT
closemessage
- applymovement 7, BattleFrontier_BattleArenaBattleRoom_Movement_OpponentStepForward
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleArenaBattleRoom_Movement_OpponentStepForward
waitmovement 0
- applymovement 9, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
+ applymovement LOCALID_ANNOUNCER, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
playse SE_W187
waitse
waitmovement 0
msgbox BattleFrontier_BattleArenaBattleRoom_Text_SetKOTourneyBegin, MSGBOX_DEFAULT
closemessage
- applymovement 8, BattleFrontier_BattleArenaBattleRoom_Movement_PlayerStepForward
- applymovement 7, BattleFrontier_BattleArenaBattleRoom_Movement_OpponentStepForward
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleArenaBattleRoom_Movement_PlayerStepForward
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleArenaBattleRoom_Movement_OpponentStepForward
waitmovement 0
palace_getopponentintro
msgbox gStringVar4, MSGBOX_DEFAULT
@@ -89,11 +98,11 @@ BattleFrontier_BattleArenaBattleRoom_EventScript_AnnounceTrainers:: @ 825752E
switch VAR_RESULT
case 1, BattleFrontier_BattleArenaBattleRoom_EventScript_DefeatedOpponent
BattleFrontier_BattleArenaBattleRoom_EventScript_DeclareOpponentWinner:: @ 82575DB
- applymovement 9, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
- applymovement 1, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
- applymovement 2, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
- applymovement 3, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceUp
- applymovement 4, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceUp
+ applymovement LOCALID_ANNOUNCER, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
+ applymovement LOCALID_BLACK_BELT_1, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
+ applymovement LOCALID_BLACK_BELT_2, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
+ applymovement LOCALID_BLACK_BELT_3, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceUp
+ applymovement LOCALID_BLACK_BELT_4, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceUp
playse SE_W173
waitse
waitmovement 0
@@ -111,12 +120,12 @@ BattleFrontier_BattleArenaBattleRoom_EventScript_DefeatedOpponent:: @ 8257630
frontier_set FRONTIER_DATA_BATTLE_NUM, VAR_RESULT
switch VAR_RESULT
case 7, BattleFrontier_BattleArenaBattleRoom_EventScript_ReturnToLobbyWon
- applymovement 8, BattleFrontier_BattleArenaBattleRoom_Movement_PlayerWalkBackToLine
- applymovement 7, BattleFrontier_BattleArenaBattleRoom_Movement_OpponentExit
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleArenaBattleRoom_Movement_PlayerWalkBackToLine
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleArenaBattleRoom_Movement_OpponentExit
waitmovement 0
- removeobject 7
- applymovement 5, BattleFrontier_BattleArenaBattleRoom_Movement_WalkInPlaceDown
- applymovement 8, BattleFrontier_BattleArenaBattleRoom_Movement_WalkInPlaceLeft
+ removeobject LOCALID_OPPONENT
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleArenaBattleRoom_Movement_WalkInPlaceDown
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleArenaBattleRoom_Movement_WalkInPlaceLeft
waitmovement 0
msgbox BattleFrontier_BattleArenaBattleRoom_Text_MonsWillBeRestored, MSGBOX_DEFAULT
special LoadPlayerParty
@@ -193,8 +202,8 @@ BattleFrontier_BattleArenaBattleRoom_EventScript_AskRetireChallenge:: @ 8257808
BattleFrontier_BattleArenaBattleRoom_EventScript_ContinueChallenge:: @ 825783A
closemessage
- applymovement 8, BattleFrontier_BattleArenaBattleRoom_Movement_WalkInPlaceRight
- applymovement 5, BattleFrontier_BattleArenaBattleRoom_Movement_WalkInPlaceRight
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleArenaBattleRoom_Movement_WalkInPlaceRight
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleArenaBattleRoom_Movement_WalkInPlaceRight
waitmovement 0
goto BattleFrontier_BattleArenaBattleRoom_EventScript_AnnounceTrainers
waitstate
@@ -273,27 +282,27 @@ BattleFrontier_BattleArenaBattleRoom_EventScript_AskReadyForTycoonNoRecord:: @ 8
BattleFrontier_BattleArenaBattleRoom_EventScript_BattleGreta:: @ 8257961
call BattleFrontier_EventScript_SetBrainObjectGfx
- applymovement 8, BattleFrontier_BattleArenaBattleRoom_Movement_WalkInPlaceRight
- applymovement 5, BattleFrontier_BattleArenaBattleRoom_Movement_WalkInPlaceRight
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleArenaBattleRoom_Movement_WalkInPlaceRight
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleArenaBattleRoom_Movement_WalkInPlaceRight
waitmovement 0
- applymovement 9, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
+ applymovement LOCALID_ANNOUNCER, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
playse SE_W187
waitse
waitmovement 0
msgbox BattleFrontier_BattleArenaBattleRoom_Text_PlayerStepForward, MSGBOX_DEFAULT
closemessage
- applymovement 8, BattleFrontier_BattleArenaBattleRoom_Movement_PlayerStepForwardLong
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleArenaBattleRoom_Movement_PlayerStepForwardLong
waitmovement 0
- applymovement 9, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
+ applymovement LOCALID_ANNOUNCER, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
playse SE_W187
waitse
waitmovement 0
msgbox BattleFrontier_BattleArenaBattleRoom_Text_MakeWayForGreta, MSGBOX_DEFAULT
closemessage
- addobject 7
- applymovement 7, BattleFrontier_BattleArenaBattleRoom_Movement_GretaEnter
+ addobject LOCALID_OPPONENT
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleArenaBattleRoom_Movement_GretaEnter
waitmovement 0
- applymovement 7, BattleFrontier_BattleArenaBattleRoom_Movement_OpponentStepForward
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleArenaBattleRoom_Movement_OpponentStepForward
waitmovement 0
switch VAR_TEMP_F
case FRONTIER_BRAIN_GOLD, BattleFrontier_BattleArenaBattleRoom_EventScript_IntroGretaGold
@@ -305,11 +314,11 @@ BattleFrontier_BattleArenaBattleRoom_EventScript_BattleGreta:: @ 8257961
msgbox BattleFrontier_BattleArenaBattleRoom_Text_GretaYoureChallenger, MSGBOX_DEFAULT
closemessage
frontier_set FRONTIER_DATA_HEARD_BRAIN_SPEECH
- applymovement 7, BattleFrontier_BattleArenaBattleRoom_Movement_GretaLookAroundPlayer
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleArenaBattleRoom_Movement_GretaLookAroundPlayer
waitmovement 0
msgbox BattleFrontier_BattleArenaBattleRoom_Text_IsThatRight, MSGBOX_DEFAULT
closemessage
- applymovement 7, BattleFrontier_BattleArenaBattleRoom_Movement_GretaWalkBackToCenter
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleArenaBattleRoom_Movement_GretaWalkBackToCenter
waitmovement 0
msgbox BattleFrontier_BattleArenaBattleRoom_Text_YouLookWeakTakeThingsEasy, MSGBOX_DEFAULT
BattleFrontier_BattleArenaBattleRoom_EventScript_BattleGretaSilver:: @ 8257A3F
@@ -324,7 +333,7 @@ BattleFrontier_BattleArenaBattleRoom_EventScript_DefeatedGretaSilver:: @ 8257A5C
frontier_getsymbols
compare VAR_RESULT, 0
goto_if_ne BattleFrontier_BattleArenaBattleRoom_EventScript_ReturnToLobbyWon
- applymovement 7, BattleFrontier_BattleArenaBattleRoom_Movement_OpponentStepForwardLong
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleArenaBattleRoom_Movement_OpponentStepForwardLong
waitmovement 0
msgbox BattleFrontier_BattleArenaBattleRoom_Text_GretaYoureToughAfterAll, MSGBOX_DEFAULT
playfanfare MUS_ME_SYMBOLGET
@@ -342,11 +351,11 @@ BattleFrontier_BattleArenaBattleRoom_EventScript_IntroGretaGold:: @ 8257AA5
msgbox BattleFrontier_BattleArenaBattleRoom_Text_GretaLookingForwardToSeeingAgain, MSGBOX_DEFAULT
closemessage
frontier_set FRONTIER_DATA_HEARD_BRAIN_SPEECH
- applymovement 7, BattleFrontier_BattleArenaBattleRoom_Movement_GretaLookAroundPlayer
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleArenaBattleRoom_Movement_GretaLookAroundPlayer
waitmovement 0
msgbox BattleFrontier_BattleArenaBattleRoom_Text_SoAreYouReady, MSGBOX_DEFAULT
closemessage
- applymovement 7, BattleFrontier_BattleArenaBattleRoom_Movement_GretaWalkBackToCenter
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleArenaBattleRoom_Movement_GretaWalkBackToCenter
waitmovement 0
msgbox BattleFrontier_BattleArenaBattleRoom_Text_WontAllowHalfheartedEffort, MSGBOX_DEFAULT
BattleFrontier_BattleArenaBattleRoom_EventScript_BattleGretaGold:: @ 8257AF8
@@ -361,7 +370,7 @@ BattleFrontier_BattleArenaBattleRoom_EventScript_DefeatedGretaGold:: @ 8257B15
frontier_getsymbols
compare VAR_RESULT, 2
goto_if_eq BattleFrontier_BattleArenaBattleRoom_EventScript_ReturnToLobbyWon
- applymovement 7, BattleFrontier_BattleArenaBattleRoom_Movement_OpponentStepForwardLong
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleArenaBattleRoom_Movement_OpponentStepForwardLong
waitmovement 0
msgbox BattleFrontier_BattleArenaBattleRoom_Text_GretaBlownAway, MSGBOX_DEFAULT
playfanfare MUS_ME_SYMBOLGET
@@ -392,11 +401,11 @@ BattleFrontier_BattleArenaBattleRoom_EventScript_DoArenaBattle:: @ 8257B6C
return
BattleFrontier_BattleArenaBattleRoom_EventScript_DeclarePlayerWinner:: @ 8257BA9
- applymovement 9, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
- applymovement 1, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
- applymovement 2, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
- applymovement 3, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceUp
- applymovement 4, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceUp
+ applymovement LOCALID_ANNOUNCER, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
+ applymovement LOCALID_BLACK_BELT_1, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
+ applymovement LOCALID_BLACK_BELT_2, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceDown
+ applymovement LOCALID_BLACK_BELT_3, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceUp
+ applymovement LOCALID_BLACK_BELT_4, BattleFrontier_BattleArenaBattleRoom_Movement_JumpInPlaceUp
playse SE_BAN
waitse
waitmovement 0
@@ -479,8 +488,8 @@ BattleFrontier_BattleArenaBattleRoom_OnWarp: @ 8257C0C
.2byte 0
BattleFrontier_BattleArenaBattleRoom_EventScript_SetUpRoomObjects:: @ 8257C16
- hideobjectat 8, MAP_BATTLE_FRONTIER_BATTLE_ARENA_BATTLE_ROOM
- removeobject 7
+ hideobjectat LOCALID_PLAYER, MAP_BATTLE_FRONTIER_BATTLE_ARENA_BATTLE_ROOM
+ removeobject LOCALID_OPPONENT
call BattleFrontier_BattleDomeBattleRoom_EventScript_SetPlayerGfx
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleDomeBattleRoom_Movement_SetInvisible
setvar VAR_TEMP_1, 1
diff --git a/data/maps/BattleFrontier_BattleArenaCorridor/scripts.inc b/data/maps/BattleFrontier_BattleArenaCorridor/scripts.inc
index f75f53893..7044caa39 100644
--- a/data/maps/BattleFrontier_BattleArenaCorridor/scripts.inc
+++ b/data/maps/BattleFrontier_BattleArenaCorridor/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
BattleFrontier_BattleArenaCorridor_MapScripts:: @ 82573B9
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattleArenaCorridor_OnFrame
.byte 0
@@ -9,13 +11,13 @@ BattleFrontier_BattleArenaCorridor_OnFrame: @ 82573BF
BattleFrontier_BattleArenaCorridor_EventScript_WalkToBattleRoom:: @ 82573C9
delay 16
setvar VAR_TEMP_0, 1
- applymovement 1, BattleFrontier_BattleArenaCorridor_Movement_AttendantWalkToDoor
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleArenaCorridor_Movement_AttendantWalkToDoor
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleArenaCorridor_Movement_PlayerWalkToDoor
waitmovement 0
- applymovement 1, BattleFrontier_BattleArenaCorridor_Movement_AttendantFacePlayer
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleArenaCorridor_Movement_AttendantFacePlayer
waitmovement 0
msgbox BattleFrontier_BattleArenaCorridor_Text_PleaseStepIn, MSGBOX_SIGN
- applymovement 1, BattleFrontier_BattleArenaCorridor_Movement_AttendantMoveOutOfWay
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleArenaCorridor_Movement_AttendantMoveOutOfWay
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleArenaCorridor_Movement_PlayerEnterDoor
waitmovement 0
diff --git a/data/maps/BattleFrontier_BattleArenaLobby/scripts.inc b/data/maps/BattleFrontier_BattleArenaLobby/scripts.inc
index 90c374c23..a2d785e66 100644
--- a/data/maps/BattleFrontier_BattleArenaLobby/scripts.inc
+++ b/data/maps/BattleFrontier_BattleArenaLobby/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
BattleFrontier_BattleArenaLobby_MapScripts:: @ 8255C36
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattleArenaLobby_OnFrame
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, BattleFrontier_BattleArenaLobby_OnWarp
@@ -206,12 +208,12 @@ BattleFrontier_BattleArenaLobby_EventScript_EndCancelChallenge:: @ 8256003
end
BattleFrontier_BattleArenaLobby_EventScript_WalkToDoorLv50:: @ 8256005
- applymovement 1, BattleFrontier_BattleArenaLobby_Movement_AttendantWalkToLeftDoor
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleArenaLobby_Movement_AttendantWalkToLeftDoor
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleArenaLobby_Movement_PlayerWalkToLeftDoor
waitmovement 0
opendoor 2, 2
waitdooranim
- applymovement 1, BattleFrontier_BattleArenaLobby_Movement_AttendantEnterDoor
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleArenaLobby_Movement_AttendantEnterDoor
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleArenaLobby_Movement_PlayerEnterDoor
waitmovement 0
closedoor 2, 2
@@ -255,12 +257,12 @@ BattleFrontier_BattleArenaLobby_Movement_PlayerEnterDoor: @ 825604C
step_end
BattleFrontier_BattleArenaLobby_EventScript_WalkToDoorLvOpen:: @ 8256050
- applymovement 1, BattleFrontier_BattleArenaLobby_Movement_AttendantWalkToRightDoor
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleArenaLobby_Movement_AttendantWalkToRightDoor
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleArenaLobby_Movement_PlayerWalkToRightDoor
waitmovement 0
opendoor 11, 2
waitdooranim
- applymovement 1, BattleFrontier_BattleArenaLobby_Movement_AttendantEnterDoor
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleArenaLobby_Movement_AttendantEnterDoor
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleArenaLobby_Movement_PlayerEnterDoor
waitmovement 0
closedoor 11, 2
diff --git a/data/maps/BattleFrontier_BattleDomeBattleRoom/scripts.inc b/data/maps/BattleFrontier_BattleDomeBattleRoom/scripts.inc
index 25522f0c0..78665edc1 100644
--- a/data/maps/BattleFrontier_BattleDomeBattleRoom/scripts.inc
+++ b/data/maps/BattleFrontier_BattleDomeBattleRoom/scripts.inc
@@ -1,3 +1,10 @@
+.set LOCALID_ANNOUNCER, 1
+.set LOCALID_AUDIENCE_TWIN, 2
+.set LOCALID_AUDIENCE_WALKING, 6
+.set LOCALID_REFEREE, 9
+.set LOCALID_PLAYER, 13
+.set LOCALID_OPPONENT, 15
+
BattleFrontier_BattleDomeBattleRoom_MapScripts:: @ 824BC9C
map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_BattleDomeBattleRoom_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattleDomeBattleRoom_OnFrame
@@ -43,22 +50,22 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_EnterRoom:: @ 824BD0A
call BattleFrontier_BattleDomeBattleRoom_EventScript_GetRoundNum
compare VAR_RESULT, DOME_ROUND1
call_if_eq BattleFrontier_BattleDomeBattleRoom_EventScript_TryDoAudienceMemberWalkToSeat
- applymovement 1, Common_Movement_WalkInPlaceDown
+ applymovement LOCALID_ANNOUNCER, Common_Movement_WalkInPlaceDown
waitmovement 0
call BattleFrontier_BattleDomeBattleRoom_EventScript_AnnouncePlayer
msgbox BattleFrontier_BattleDomeBattleRoom_Text_PlayerHasEnteredDome, MSGBOX_DEFAULT
closemessage
- showobjectat 13, MAP_BATTLE_FRONTIER_BATTLE_DOME_BATTLE_ROOM
+ showobjectat LOCALID_PLAYER, MAP_BATTLE_FRONTIER_BATTLE_DOME_BATTLE_ROOM
compare VAR_TEMP_F, DOME_FINAL
goto_if_ne BattleFrontier_BattleDomeBattleRoom_EventScript_PlayerEnter
compare VAR_TEMP_E, FRONTIER_BRAIN_NOT_READY
goto_if_ne BattleFrontier_BattleDomeBattleRoom_EventScript_PlayerEnterForTucker
BattleFrontier_BattleDomeBattleRoom_EventScript_PlayerEnter:: @ 824BD4E
- applymovement 13, BattleFrontier_BattleDomeBattleRoom_Movement_PlayerEnter
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleDomeBattleRoom_Movement_PlayerEnter
goto BattleFrontier_BattleDomeBattleRoom_EventScript_AudienceReactToPlayer
BattleFrontier_BattleDomeBattleRoom_EventScript_PlayerEnterForTucker:: @ 824BD5A
- applymovement 13, BattleFrontier_BattleDomeBattleRoom_Movement_PlayerEnterForTucker
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleDomeBattleRoom_Movement_PlayerEnterForTucker
BattleFrontier_BattleDomeBattleRoom_EventScript_AudienceReactToPlayer:: @ 824BD61
playse SE_W227B
call BattleFrontier_BattleDomeBattleRoom_EventScript_AudienceLookAround
@@ -71,8 +78,8 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_BattleOpponent:: @ 824BD82
dome_getopponentname
msgbox BattleFrontier_BattleDomeBattleRoom_Text_PlayerVersusTrainer, MSGBOX_DEFAULT
closemessage
- applymovement 13, BattleFrontier_BattleDomeBattleRoom_Movement_PlayerStepForward
- applymovement 15, BattleFrontier_BattleDomeBattleRoom_Movement_OpponentStepForward
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleDomeBattleRoom_Movement_PlayerStepForward
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleDomeBattleRoom_Movement_OpponentStepForward
waitmovement 0
tower_getopponentintro 0
msgbox gStringVar4, MSGBOX_DEFAULT
@@ -91,12 +98,12 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_Draw:: @ 824BDF7
playse SE_W227B
call BattleFrontier_BattleDomeBattleRoom_EventScript_AudienceLookAround
delay 60
- applymovement 9, BattleFrontier_BattleDomeBattleRoom_Movement_TieRefereeEnter
+ applymovement LOCALID_REFEREE, BattleFrontier_BattleDomeBattleRoom_Movement_RefereeEnter
waitmovement 0
- applymovement 1, BattleFrontier_BattleDomeBattleRoom_Movement_RefereeFaceLeft
+ applymovement LOCALID_ANNOUNCER, BattleFrontier_BattleDomeBattleRoom_Movement_AnnouncerFaceLeft
waitmovement 0
delay 180
- applymovement 9, BattleFrontier_BattleDomeBattleRoom_Movement_TieRefereeExit
+ applymovement LOCALID_REFEREE, BattleFrontier_BattleDomeBattleRoom_Movement_RefereeExit
waitmovement 0
compare VAR_TEMP_2, DRAW_TUCKER @ Tucker always wins on a draw
goto_if_eq BattleFrontier_BattleDomeBattleRoom_EventScript_LostToOpponent
@@ -104,7 +111,7 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_Draw:: @ 824BDF7
switch VAR_RESULT
case 1, BattleFrontier_BattleDomeBattleRoom_EventScript_DefeatedOpponent
BattleFrontier_BattleDomeBattleRoom_EventScript_LostToOpponent:: @ 824BE4F
- applymovement 1, Common_Movement_WalkInPlaceDown
+ applymovement LOCALID_ANNOUNCER, Common_Movement_WalkInPlaceDown
waitmovement 0
dome_getopponentname
compare VAR_TEMP_2, NO_DRAW
@@ -140,7 +147,7 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_TuckerWonDraw:: @ 824BED9
return
BattleFrontier_BattleDomeBattleRoom_EventScript_DefeatedOpponent:: @ 824BEE0
- applymovement 1, Common_Movement_WalkInPlaceDown
+ applymovement LOCALID_ANNOUNCER, Common_Movement_WalkInPlaceDown
waitmovement 0
compare VAR_TEMP_2, NO_DRAW
call_if_eq BattleFrontier_BattleDomeBattleRoom_EventScript_PlayerWon
@@ -161,7 +168,7 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_DefeatedOpponent:: @ 824BEE0
waitstate
BattleFrontier_BattleDomeBattleRoom_EventScript_WonTourney:: @ 824BF62
- applymovement 13, BattleFrontier_BattleDomeBattleRoom_Movement_PlayerApproachAudience
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleDomeBattleRoom_Movement_PlayerApproachAudience
waitmovement 0
frontier_get FRONTIER_DATA_LVL_MODE
switch VAR_RESULT
@@ -172,7 +179,7 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_WonTourney:: @ 824BF62
BattleFrontier_BattleDomeBattleRoom_EventScript_WonLvOpenTourney:: @ 824BF96
msgbox BattleFrontier_BattleDomeBattleRoom_Text_PlayerIsLvOpenChamp, MSGBOX_DEFAULT
BattleFrontier_BattleDomeBattleRoom_EventScript_CelebrateWin:: @ 824BF9E
- special DoConfettiEffect
+ special DoDomeConfetti
playse SE_W227B
call BattleFrontier_BattleDomeBattleRoom_EventScript_AudienceLookAround
delay 60
@@ -351,9 +358,9 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_AnnounceTuckerGold:: @ 824C209
msgbox BattleFrontier_BattleDomeBattleRoom_Text_LegendHasReturnedDomeAceTucker, MSGBOX_DEFAULT
BattleFrontier_BattleDomeBattleRoom_EventScript_TuckerEnter:: @ 824C211
closemessage
- applymovement 2, BattleFrontier_BattleDomeBattleRoom_Movement_AudienceTwinJump
- applymovement 1, BattleFrontier_BattleDomeBattleRoom_Movement_RefereeMoveForTuckerEntrance
- applymovement 15, BattleFrontier_BattleDomeBattleRoom_Movement_TuckerEnterAndDance
+ applymovement LOCALID_AUDIENCE_TWIN, BattleFrontier_BattleDomeBattleRoom_Movement_AudienceTwinJump
+ applymovement LOCALID_ANNOUNCER, BattleFrontier_BattleDomeBattleRoom_Movement_AnnouncerMoveForTuckerEntrance
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleDomeBattleRoom_Movement_TuckerEnterAndDance
playse SE_W227B
call BattleFrontier_BattleDomeBattleRoom_EventScript_AudienceLookAround
waitse
@@ -397,7 +404,7 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_BattleTuckerSilver:: @ 824C2B9
compare VAR_RESULT, 0
goto_if_ne BattleFrontier_BattleDomeBattleRoom_EventScript_WonTourney
closemessage
- applymovement 15, BattleFrontier_BattleDomeBattleRoom_Movement_TuckerApproachPlayer
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleDomeBattleRoom_Movement_TuckerApproachPlayer
waitmovement 0
msgbox BattleFrontier_BattleDomeBattleRoom_Text_SeeYourFrontierPass, MSGBOX_DEFAULT
playfanfare MUS_ME_SYMBOLGET
@@ -427,7 +434,7 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_BattleTuckerGold:: @ 824C373
compare VAR_RESULT, 2
goto_if_eq BattleFrontier_BattleDomeBattleRoom_EventScript_WonTourney
closemessage
- applymovement 15, BattleFrontier_BattleDomeBattleRoom_Movement_TuckerApproachPlayer
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleDomeBattleRoom_Movement_TuckerApproachPlayer
waitmovement 0
msgbox BattleFrontier_BattleDomeBattleRoom_Text_NeverLostWhenPowerUnleashed, MSGBOX_DEFAULT
playfanfare MUS_ME_SYMBOLGET
@@ -441,8 +448,8 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_BattleTuckerGold:: @ 824C373
BattleFrontier_BattleDomeBattleRoom_EventScript_DoTuckerBattle:: @ 824C400
msgbox BattleFrontier_BattleDomeBattleRoom_Text_PlayerVersusTucker, MSGBOX_DEFAULT
closemessage
- applymovement 13, BattleFrontier_BattleDomeBattleRoom_Movement_PlayerStepForward2
- applymovement 15, BattleFrontier_BattleDomeBattleRoom_Movement_TuckerStepForward
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleDomeBattleRoom_Movement_PlayerStepForward2
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleDomeBattleRoom_Movement_TuckerStepForward
waitmovement 0
call BattleFrontier_BattleDomeBattleRoom_EventScript_DoDomeBattle
return
@@ -477,7 +484,7 @@ BattleFrontier_BattleDomeBattleRoom_OnWarp: @ 824C481
.2byte 0
BattleFrontier_BattleDomeBattleRoom_EventScript_SetUpObjects:: @ 824C48B
- hideobjectat 13, MAP_BATTLE_FRONTIER_BATTLE_DOME_BATTLE_ROOM
+ hideobjectat LOCALID_PLAYER, MAP_BATTLE_FRONTIER_BATTLE_DOME_BATTLE_ROOM
call BattleFrontier_BattleDomeBattleRoom_EventScript_AddAudience
call BattleFrontier_BattleDomeBattleRoom_EventScript_SetPlayerGfx
setvar VAR_TEMP_1, 1
@@ -490,10 +497,10 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_SetUpObjects:: @ 824C48B
compare VAR_RESULT, FRONTIER_BRAIN_NOT_READY
goto_if_eq BattleFrontier_BattleDomeBattleRoom_EventScript_EndSetUpObjects
call BattleFrontier_EventScript_SetBrainObjectGfx
- setobjectxyperm 15, 13, 9
- removeobject 15
- addobject 15
- applymovement 15, BattleFrontier_BattleDomeBattleRoom_Movement_SetInvisibleFacingUp
+ setobjectxyperm LOCALID_OPPONENT, 13, 9
+ removeobject LOCALID_OPPONENT
+ addobject LOCALID_OPPONENT
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleDomeBattleRoom_Movement_SetInvisibleFacingUp
BattleFrontier_BattleDomeBattleRoom_EventScript_EndSetUpObjects:: @ 824C4EF
end
@@ -746,7 +753,7 @@ BattleFrontier_BattleDomeBattleRoom_Movement_TuckerEnterAndDance: @ 824C78E
walk_left
step_end
-BattleFrontier_BattleDomeBattleRoom_Movement_RefereeMoveForTuckerEntrance: @ 824C7F9
+BattleFrontier_BattleDomeBattleRoom_Movement_AnnouncerMoveForTuckerEntrance: @ 824C7F9
delay_16
delay_16
walk_left
@@ -893,14 +900,14 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_SetWalkingAudienceMemberPos:: @
copyvar VAR_TEMP_D, VAR_RESULT
compare VAR_TEMP_D, 0
goto_if_eq Common_EventScript_NopReturn
- setobjectxyperm 6, 2, 0
- setobjectmovementtype 6, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_AUDIENCE_WALKING, 2, 0
+ setobjectmovementtype LOCALID_AUDIENCE_WALKING, MOVEMENT_TYPE_FACE_RIGHT
return
BattleFrontier_BattleDomeBattleRoom_EventScript_TryDoAudienceMemberWalkToSeat:: @ 824C938
compare VAR_TEMP_D, 0
goto_if_eq Common_EventScript_NopReturn
- applymovement 6, BattleFrontier_BattleDomeBattleRoom_Movement_AudienceMemberWalkToSeat
+ applymovement LOCALID_AUDIENCE_WALKING, BattleFrontier_BattleDomeBattleRoom_Movement_AudienceMemberWalkToSeat
return
BattleFrontier_BattleDomeBattleRoom_Movement_AudienceTwinJump: @ 824C94B
@@ -932,18 +939,18 @@ BattleFrontier_BattleDomeBattleRoom_Movement_AudienceMemberWalkToSeat: @ 824C95E
walk_in_place_fastest_down
step_end
-BattleFrontier_BattleDomeBattleRoom_Movement_TieRefereeEnter: @ 824C964
+BattleFrontier_BattleDomeBattleRoom_Movement_RefereeEnter: @ 824C964
walk_right
walk_right
walk_right
walk_right
step_end
-BattleFrontier_BattleDomeBattleRoom_Movement_RefereeFaceLeft: @ 824C969
+BattleFrontier_BattleDomeBattleRoom_Movement_AnnouncerFaceLeft: @ 824C969
walk_in_place_fastest_left
step_end
-BattleFrontier_BattleDomeBattleRoom_Movement_TieRefereeExit: @ 824C96B
+BattleFrontier_BattleDomeBattleRoom_Movement_RefereeExit: @ 824C96B
walk_left
walk_left
walk_left
diff --git a/data/maps/BattleFrontier_BattleDomeCorridor/scripts.inc b/data/maps/BattleFrontier_BattleDomeCorridor/scripts.inc
index ea9da5183..44db802e8 100644
--- a/data/maps/BattleFrontier_BattleDomeCorridor/scripts.inc
+++ b/data/maps/BattleFrontier_BattleDomeCorridor/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
BattleFrontier_BattleDomeCorridor_MapScripts:: @ 824B0FE
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattleDomeCorridor_OnFrame
.byte 0
@@ -12,12 +14,12 @@ BattleFrontier_BattleDomeCorridor_EventScript_EnterCorridor:: @ 824B10E
frontier_get FRONTIER_DATA_LVL_MODE
compare VAR_RESULT, FRONTIER_LVL_OPEN
goto_if_eq BattleFrontier_BattleDomeCorridor_EventScript_WalkToBattleRoomLvOpen
- applymovement 1, BattleFrontier_BattleDomeCorridor_Movement_AttendantWalkToDoorLv50
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleDomeCorridor_Movement_AttendantWalkToDoorLv50
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleDomeCorridor_Movement_PlayerWalkToDoorLv50
waitmovement 0
opendoor 13, 3
waitdooranim
- applymovement 1, BattleFrontier_BattleDomeCorridor_Movement_AttendantEnterDoorLv50
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleDomeCorridor_Movement_AttendantEnterDoorLv50
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleDomeCorridor_Movement_PlayerEnterDoorLv50
waitmovement 0
closedoor 13, 3
@@ -25,12 +27,12 @@ BattleFrontier_BattleDomeCorridor_EventScript_EnterCorridor:: @ 824B10E
goto BattleFrontier_BattleDomeCorridor_EventScript_WarpToPreBattleRoom
BattleFrontier_BattleDomeCorridor_EventScript_WalkToBattleRoomLvOpen:: @ 824B161
- applymovement 1, BattleFrontier_BattleDomeCorridor_Movement_AttendantWalkToDoorLvOpen
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleDomeCorridor_Movement_AttendantWalkToDoorLvOpen
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleDomeCorridor_Movement_PlayerWalkToDoorLvOpen
waitmovement 0
opendoor 37, 3
waitdooranim
- applymovement 1, BattleFrontier_BattleDomeCorridor_Movement_AttendantEnterDoorLvOpen
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleDomeCorridor_Movement_AttendantEnterDoorLvOpen
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleDomeCorridor_Movement_PlayerEnterDoorLvOpen
waitmovement 0
closedoor 37, 3
diff --git a/data/maps/BattleFrontier_BattleDomeLobby/scripts.inc b/data/maps/BattleFrontier_BattleDomeLobby/scripts.inc
index 6dfae4acc..328f7bd40 100644
--- a/data/maps/BattleFrontier_BattleDomeLobby/scripts.inc
+++ b/data/maps/BattleFrontier_BattleDomeLobby/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_ATTENDANT_SINGLES, 1
+.set LOCALID_ATTENDANT_DOUBLES, 6
+
BattleFrontier_BattleDomeLobby_MapScripts:: @ 82497E2
map_script MAP_SCRIPT_ON_RESUME, BattleFrontier_BattleDomeLobby_OnResume
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattleDomeLobby_OnFrame
@@ -262,19 +265,19 @@ BattleFrontier_BattleDomeLobby_EventScript_WalkToDoor:: @ 8249C6E
return
BattleFrontier_BattleDomeLobby_EventScript_SinglesAttendantWalkToDoor:: @ 8249CDD
- applymovement 1, BattleFrontier_BattleDomeLobby_Movement_WalkToDoor
+ applymovement LOCALID_ATTENDANT_SINGLES, BattleFrontier_BattleDomeLobby_Movement_WalkToDoor
return
BattleFrontier_BattleDomeLobby_EventScript_DoublesAttendantWalkToDoor:: @ 8249CE5
- applymovement 6, BattleFrontier_BattleDomeLobby_Movement_WalkToDoor
+ applymovement LOCALID_ATTENDANT_DOUBLES, BattleFrontier_BattleDomeLobby_Movement_WalkToDoor
return
BattleFrontier_BattleDomeLobby_EventScript_SinglesAttendantEnterDoor:: @ 8249CED
- applymovement 1, BattleFrontier_BattleDomeLobby_Movement_AttendantEnterDoor
+ applymovement LOCALID_ATTENDANT_SINGLES, BattleFrontier_BattleDomeLobby_Movement_AttendantEnterDoor
return
BattleFrontier_BattleDomeLobby_EventScript_DoublesAttendantEnterDoor:: @ 8249CF5
- applymovement 6, BattleFrontier_BattleDomeLobby_Movement_AttendantEnterDoor
+ applymovement LOCALID_ATTENDANT_DOUBLES, BattleFrontier_BattleDomeLobby_Movement_AttendantEnterDoor
return
BattleFrontier_BattleDomeLobby_EventScript_WelcomeSingles:: @ 8249CFD
diff --git a/data/maps/BattleFrontier_BattleDomePreBattleRoom/scripts.inc b/data/maps/BattleFrontier_BattleDomePreBattleRoom/scripts.inc
index b09674268..0d67792b9 100644
--- a/data/maps/BattleFrontier_BattleDomePreBattleRoom/scripts.inc
+++ b/data/maps/BattleFrontier_BattleDomePreBattleRoom/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
BattleFrontier_BattleDomePreBattleRoom_MapScripts:: @ 824B1F9
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattleDomePreBattleRoom_OnFrame
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, BattleFrontier_BattleDomePreBattleRoom_OnWarp
@@ -151,7 +153,7 @@ BattleFrontier_BattleDomePreBattleRoom_EventScript_ContinueChallenge:: @ 824B46D
dome_setopponent
msgbox BattleFrontier_BattleDomePreBattleRoom_Text_RightThisWay, MSGBOX_DEFAULT
closemessage
- applymovement 1, BattleFrontier_BattleDomePreBattleRoom_Movement_AttendantMoveAside
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleDomePreBattleRoom_Movement_AttendantMoveAside
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleDomePreBattleRoom_Movement_PlayerWalkToDoor
waitmovement 0
diff --git a/data/maps/BattleFrontier_BattleFactoryBattleRoom/scripts.inc b/data/maps/BattleFrontier_BattleFactoryBattleRoom/scripts.inc
index f3befad15..ee7a724d1 100644
--- a/data/maps/BattleFrontier_BattleFactoryBattleRoom/scripts.inc
+++ b/data/maps/BattleFrontier_BattleFactoryBattleRoom/scripts.inc
@@ -1,3 +1,12 @@
+.set LOCALID_SCIENTIST_1, 1
+.set LOCALID_OPPONENT, 2
+.set LOCALID_SCIENTIST_2, 3
+.set LOCALID_SCIENTIST_3, 4
+.set LOCALID_SCIENTIST_4, 5
+.set LOCALID_SCIENTIST_5, 6
+.set LOCALID_SCIENTIST_6, 7
+.set LOCALID_PLAYER, 8
+
BattleFrontier_BattleFactoryBattleRoom_MapScripts:: @ 825ADAB
map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_BattleFactoryBattleRoom_OnTransition
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, BattleFrontier_BattleFactoryBattleRoom_OnWarp
@@ -5,7 +14,7 @@ BattleFrontier_BattleFactoryBattleRoom_MapScripts:: @ 825ADAB
.byte 0
@ On this map the player (OBJ_EVENT_ID_PLAYER) is hidden
- @ The player is represented instead by object event 8, which has the gfx id VAR_OBJ_GFX_ID_F
+ @ The player is represented instead by LOCALID_PLAYER, which has the gfx id VAR_OBJ_GFX_ID_F
BattleFrontier_BattleFactoryBattleRoom_OnTransition: @ 825ADBB
frontier_settrainers
@@ -22,7 +31,7 @@ BattleFrontier_BattleFactoryBattleRoom_OnTransition: @ 825ADBB
BattleFrontier_BattleFactoryBattleRoom_EventScript_SetUpFactoryHeadObj:: @ 825ADF3
call BattleFrontier_EventScript_SetBrainObjectGfx
- setobjectxyperm 2, 7, 9
+ setobjectxyperm LOCALID_OPPONENT, 7, 9
end
BattleFrontier_BattleFactoryBattleRoom_OnWarp: @ 825AE00
@@ -34,7 +43,7 @@ BattleFrontier_BattleFactoryBattleRoom_EventScript_HideObjects:: @ 825AE0A
hideobjectat OBJ_EVENT_ID_PLAYER, MAP_BATTLE_FRONTIER_BATTLE_FACTORY_BATTLE_ROOM
compare VAR_TEMP_F, FRONTIER_BRAIN_NOT_READY
goto_if_ne BattleFrontier_BattleFactoryBattleRoom_EventScript_EndHideObjects
- hideobjectat 2, MAP_BATTLE_FRONTIER_BATTLE_FACTORY_BATTLE_ROOM
+ hideobjectat LOCALID_OPPONENT, MAP_BATTLE_FRONTIER_BATTLE_FACTORY_BATTLE_ROOM
BattleFrontier_BattleFactoryBattleRoom_EventScript_EndHideObjects:: @ 825AE24
end
@@ -53,8 +62,8 @@ BattleFrontier_BattleFactoryBattleRoom_OnFrame: @ 825AE31
BattleFrontier_BattleFactoryBattleRoom_EventScript_EnterRoomFactoryHeadBattle:: @ 825AE3B
msgbox BattleFrontier_BattleFactoryBattleRoom_Text_GetAMoveOn, MSGBOX_DEFAULT
closemessage
- applymovement 2, BattleFrontier_BattleFactoryBattleRoom_Movement_NolandMoveToBattle
- applymovement 8, BattleFrontier_BattleFactoryBattleRoom_Movement_PlayerEnterRoom
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleFactoryBattleRoom_Movement_NolandMoveToBattle
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleFactoryBattleRoom_Movement_PlayerEnterRoom
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleFactoryBattleRoom_Movement_PlayerEnterRoom
waitmovement 0
call BattleFrontier_BattleFactoryBattleRoom_EventScript_ScientistsFaceBattle
@@ -64,15 +73,15 @@ BattleFrontier_BattleFactoryBattleRoom_EventScript_EnterRoomFactoryHeadBattle::
BattleFrontier_BattleFactoryBattleRoom_EventScript_EnterRoom:: @ 825AE67
compare VAR_TEMP_F, FRONTIER_BRAIN_NOT_READY
goto_if_ne BattleFrontier_BattleFactoryBattleRoom_EventScript_EnterRoomFactoryHeadBattle
- applymovement 8, BattleFrontier_BattleFactoryBattleRoom_Movement_PlayerEnterRoom
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleFactoryBattleRoom_Movement_PlayerEnterRoom
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleFactoryBattleRoom_Movement_PlayerEnterRoom
waitmovement 0
call BattleFrontier_BattleFactoryBattleRoom_EventScript_ScientistsFaceBattle
factory_setopponentgfx
- removeobject 2
- setobjectxyperm 2, 7, 1
- addobject 2
- applymovement 2, BattleFrontier_BattleFactoryBattleRoom_Movement_OpponentEnter
+ removeobject LOCALID_OPPONENT
+ setobjectxyperm LOCALID_OPPONENT, 7, 1
+ addobject LOCALID_OPPONENT
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleFactoryBattleRoom_Movement_OpponentEnter
waitmovement 0
BattleFrontier_BattleFactoryBattleRoom_EventScript_BattleOpponent:: @ 825AEA7
compare VAR_TEMP_F, FRONTIER_BRAIN_NOT_READY
@@ -139,7 +148,7 @@ BattleFrontier_BattleFactoryBattleRoom_EventScript_DefeatedNolandSilver:: @ 825B
goto_if_ne BattleFrontier_BattleFactoryBattleRoom_EventScript_DefeatedNoland
msgbox BattleFrontier_BattleFactoryBattleRoom_Text_NolandLetsSeeFrontierPass, MSGBOX_DEFAULT
closemessage
- applymovement 8, BattleFrontier_BattleFactoryBattleRoom_Movement_PlayerApproachNoland
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleFactoryBattleRoom_Movement_PlayerApproachNoland
waitmovement 0
playfanfare MUS_ME_SYMBOLGET
message BattleFrontier_BattleFactoryBattleRoom_Text_ReceivedKnowledgeSymbol
@@ -168,7 +177,7 @@ BattleFrontier_BattleFactoryBattleRoom_EventScript_DefeatedNolandGold:: @ 825B09
goto_if_eq BattleFrontier_BattleFactoryBattleRoom_EventScript_DefeatedNoland
msgbox BattleFrontier_BattleFactoryBattleRoom_Text_OutOfMyLeagueLetsSeePass, MSGBOX_DEFAULT
waitmessage
- applymovement 8, BattleFrontier_BattleFactoryBattleRoom_Movement_PlayerApproachNoland
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleFactoryBattleRoom_Movement_PlayerApproachNoland
waitmovement 0
playfanfare MUS_ME_SYMBOLGET
message BattleFrontier_BattleFactoryBattleRoom_Text_KnowledgeSymbolTookGoldenShine
@@ -248,12 +257,12 @@ BattleFrontier_BattleFactoryBattleRoom_EventScript_WarpToLobbyDoubles:: @ 825B1A
end
BattleFrontier_BattleFactoryBattleRoom_EventScript_ScientistsFaceBattle:: @ 825B1B4
- applymovement 1, Common_Movement_WalkInPlaceFastestRight
- applymovement 3, Common_Movement_WalkInPlaceFastestRight
- applymovement 4, Common_Movement_WalkInPlaceFastestRight
- applymovement 5, Common_Movement_WalkInPlaceFastestLeft
- applymovement 6, Common_Movement_WalkInPlaceFastestLeft
- applymovement 7, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_SCIENTIST_1, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_SCIENTIST_2, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_SCIENTIST_3, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_SCIENTIST_4, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_SCIENTIST_5, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_SCIENTIST_6, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
return
diff --git a/data/maps/BattleFrontier_BattleFactoryLobby/scripts.inc b/data/maps/BattleFrontier_BattleFactoryLobby/scripts.inc
index 87c7dcbbb..60d0ae587 100644
--- a/data/maps/BattleFrontier_BattleFactoryLobby/scripts.inc
+++ b/data/maps/BattleFrontier_BattleFactoryLobby/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_ATTENDANT_SINGLES, 1
+.set LOCALID_ATTENDANT_DOUBLES, 6
+
BattleFrontier_BattleFactoryLobby_MapScripts:: @ 82583E8
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattleFactoryLobby_OnFrame
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, BattleFrontier_BattleFactoryLobby_OnWarp
@@ -184,11 +187,11 @@ BattleFrontier_BattleFactoryLobby_EventScript_EnterChallenge:: @ 825871A
end
BattleFrontier_BattleFactoryLobby_EventScript_TalkedToSinglesAttendant:: @ 825875C
- setvar VAR_LAST_TALKED, 1
+ setvar VAR_LAST_TALKED, LOCALID_ATTENDANT_SINGLES
return
BattleFrontier_BattleFactoryLobby_EventScript_TalkedToDoublesAttendant:: @ 8258762
- setvar VAR_LAST_TALKED, 6
+ setvar VAR_LAST_TALKED, LOCALID_ATTENDANT_DOUBLES
return
BattleFrontier_BattleFactoryLobby_EventScript_ExplainChallenge:: @ 8258768
diff --git a/data/maps/BattleFrontier_BattleFactoryPreBattleRoom/scripts.inc b/data/maps/BattleFrontier_BattleFactoryPreBattleRoom/scripts.inc
index 862b04de5..0491c925a 100644
--- a/data/maps/BattleFrontier_BattleFactoryPreBattleRoom/scripts.inc
+++ b/data/maps/BattleFrontier_BattleFactoryPreBattleRoom/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
BattleFrontier_BattleFactoryPreBattleRoom_MapScripts:: @ 8259ABA
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattleFactoryPreBattleRoom_OnFrame
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, BattleFrontier_BattleFactoryPreBattleRoom_OnWarp
@@ -11,8 +13,8 @@ BattleFrontier_BattleFactoryPreBattleRoom_EventScript_SetUpObjects:: @ 8259ACF
setvar VAR_TEMP_1, 1
compare VAR_0x8006, 1
goto_if_ne BattleFrontier_BattleFactoryPreBattleRoom_EventScript_TurnPlayerNorth
- setobjectxy 1, 8, 7
- turnobject 1, DIR_SOUTH
+ setobjectxy LOCALID_ATTENDANT, 8, 7
+ turnobject LOCALID_ATTENDANT, DIR_SOUTH
BattleFrontier_BattleFactoryPreBattleRoom_EventScript_TurnPlayerNorth:: @ 8259AEA
turnobject OBJ_EVENT_ID_PLAYER, DIR_NORTH
end
@@ -25,7 +27,7 @@ BattleFrontier_BattleFactoryPreBattleRoom_EventScript_EnterRoom:: @ 8259AF9
compare VAR_0x8006, 1
goto_if_eq BattleFrontier_BattleFactoryPreBattleRoom_EventScript_ReturnToRoomFromBattle
setvar VAR_TEMP_0, 1
- applymovement 1, BattleFrontier_BattleFactoryPreBattleRoom_Movement_AttendantEnterRoom
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleFactoryPreBattleRoom_Movement_AttendantEnterRoom
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleFactoryPreBattleRoom_Movement_PlayerEnterRoom
waitmovement 0
compare VAR_0x8006, 2
@@ -70,11 +72,11 @@ BattleFrontier_BattleFactoryPreBattleRoom_EventScript_ReturnToRoomFromBattle:: @
waitse
msgbox BattleFrontier_BattleFactoryPreBattleRoom_Text_WaitFewMoments, MSGBOX_DEFAULT
closemessage
- applymovement 1, BattleFrontier_BattleFactoryPreBattleRoom_Movement_AttendantMoveToReceiveCall
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleFactoryPreBattleRoom_Movement_AttendantMoveToReceiveCall
waitmovement 0
msgbox BattleFrontier_BattleFactoryPreBattleRoom_Text_UnderstoodSirWillDo, MSGBOX_DEFAULT
closemessage
- applymovement 1, BattleFrontier_BattleFactoryPreBattleRoom_Movement_AttendantReturnToPlayer
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleFactoryPreBattleRoom_Movement_AttendantReturnToPlayer
waitmovement 0
msgbox BattleFrontier_BattleFactoryPreBattleRoom_Text_MessageFromHeadComeRightNow, MSGBOX_DEFAULT
closemessage
@@ -419,12 +421,12 @@ BattleFrontier_BattleFactoryPreBattleRoom_EventScript_AskSwapBeforeHead:: @ 825A
case MULTI_B_PRESSED, BattleFrontier_BattleFactoryPreBattleRoom_EventScript_EnterBattleRoom
BattleFrontier_BattleFactoryPreBattleRoom_EventScript_WalkToBattleRoomLv50:: @ 825A17C
- applymovement 1, BattleFrontier_BattleFactoryPreBattleRoom_Movement_GuideWalkToBattleRoomLv50
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleFactoryPreBattleRoom_Movement_GuideWalkToBattleRoomLv50
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleFactoryPreBattleRoom_Movement_PlayerWalkToBattleRoomLv50
return
BattleFrontier_BattleFactoryPreBattleRoom_EventScript_WalkToBattleRoomLvOpen:: @ 825A18B
- applymovement 1, BattleFrontier_BattleFactoryPreBattleRoom_Movement_GuideWalkToBattleRoomLvOpen
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleFactoryPreBattleRoom_Movement_GuideWalkToBattleRoomLvOpen
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleFactoryPreBattleRoom_Movement_PlayerWalkToBattleRoomLvOpen
return
diff --git a/data/maps/BattleFrontier_BattlePalaceBattleRoom/scripts.inc b/data/maps/BattleFrontier_BattlePalaceBattleRoom/scripts.inc
index 55a8dcbb7..f1ea064d6 100644
--- a/data/maps/BattleFrontier_BattlePalaceBattleRoom/scripts.inc
+++ b/data/maps/BattleFrontier_BattlePalaceBattleRoom/scripts.inc
@@ -1,3 +1,9 @@
+.set LOCALID_PLAYER, 1
+.set LOCALID_OPPONENT, 2
+.set LOCALID_ATTENDANT, 3
+.set LOCALID_DUSCLOPS, 4
+.set LOCALID_AZURILL, 5
+
BattleFrontier_BattlePalaceBattleRoom_MapScripts:: @ 824F815
map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_BattlePalaceBattleRoom_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattlePalaceBattleRoom_OnFrame
@@ -5,8 +11,8 @@ BattleFrontier_BattlePalaceBattleRoom_MapScripts:: @ 824F815
.byte 0
@ On this map the player (OBJ_EVENT_ID_PLAYER) is hidden
- @ The player is represented instead by object event 1, which has the gfx id VAR_OBJ_GFX_ID_0
- @ The opponent is represented by object event 2, which has the gfx id VAR_OBJ_GFX_ID_1
+ @ The player is represented instead by LOCALID_PLAYER, which has the gfx id VAR_OBJ_GFX_ID_0
+ @ The opponent is represented by LOCALID_OPPONENT, which has the gfx id VAR_OBJ_GFX_ID_1
BattleFrontier_BattlePalaceBattleRoom_OnTransition: @ 824F825
frontier_settrainers
@@ -37,24 +43,24 @@ BattleFrontier_BattlePalaceBattleRoom_OnFrame: @ 824F861
.2byte 0
BattleFrontier_BattlePalaceBattleRoom_EventScript_EnterRoom:: @ 824F86B
- showobjectat 1, MAP_BATTLE_FRONTIER_BATTLE_PALACE_BATTLE_ROOM
+ showobjectat LOCALID_PLAYER, MAP_BATTLE_FRONTIER_BATTLE_PALACE_BATTLE_ROOM
frontier_get FRONTIER_DATA_BATTLE_NUM
compare VAR_RESULT, 0
goto_if_eq BattleFrontier_BattlePalaceBattleRoom_EventScript_BeginChallenge
- applymovement 1, BattleFrontier_BattlePalaceBattleRoom_Movement_PlayerReturnToChallenge
+ applymovement LOCALID_PLAYER, BattleFrontier_BattlePalaceBattleRoom_Movement_PlayerReturnToChallenge
waitmovement 0
- applymovement 3, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceDown
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceDown
setvar VAR_TEMP_2, 1
frontier_set FRONTIER_DATA_RECORD_DISABLED, TRUE
goto BattleFrontier_BattlePalaceBattleRoom_EventScript_AskReadyForOpponent
BattleFrontier_BattlePalaceBattleRoom_EventScript_BeginChallenge:: @ 824F8B5
- applymovement 1, BattleFrontier_BattlePalaceBattleRoom_Movement_PlayerEnterRoom
+ applymovement LOCALID_PLAYER, BattleFrontier_BattlePalaceBattleRoom_Movement_PlayerEnterRoom
waitmovement 0
BattleFrontier_BattlePalaceBattleRoom_EventScript_NextOpponentEnter:: @ 824F8BF
tower_setopponent
- addobject 2
- applymovement 2, BattleFrontier_BattlePalaceBattleRoom_Movement_OpponentEnter
+ addobject LOCALID_OPPONENT
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattlePalaceBattleRoom_Movement_OpponentEnter
waitmovement 0
palace_getopponentintro
msgbox gStringVar4, MSGBOX_DEFAULT
@@ -73,11 +79,11 @@ BattleFrontier_BattlePalaceBattleRoom_EventScript_DefeatedOpponent:: @ 824F911
frontier_set FRONTIER_DATA_BATTLE_NUM, VAR_RESULT
switch VAR_RESULT
case 7, BattleFrontier_BattlePalaceBattleRoom_EventScript_WarpToLobbyWon
- applymovement 2, BattleFrontier_BattlePalaceBattleRoom_Movement_OpponentExit
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattlePalaceBattleRoom_Movement_OpponentExit
waitmovement 0
- removeobject 2
- applymovement 1, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceUp
- applymovement 3, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceDown
+ removeobject LOCALID_OPPONENT
+ applymovement LOCALID_PLAYER, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceUp
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceDown
waitmovement 0
msgbox BattleFrontier_BattlePalaceBattleRoom_Text_LetMeRestoreYourMons, MSGBOX_DEFAULT
special LoadPlayerParty
@@ -153,8 +159,8 @@ BattleFrontier_BattlePalaceBattleRoom_EventScript_AskRetireChallenge:: @ 824FAE2
case MULTI_B_PRESSED, BattleFrontier_BattlePalaceBattleRoom_EventScript_AskReadyForOpponent
BattleFrontier_BattlePalaceBattleRoom_EventScript_ContinueChallenge:: @ 824FB14
- applymovement 1, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceRight
- applymovement 3, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceRight
+ applymovement LOCALID_PLAYER, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceRight
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceRight
closemessage
goto BattleFrontier_BattlePalaceBattleRoom_EventScript_NextOpponentEnter
@@ -203,16 +209,16 @@ BattleFrontier_BattlePalaceBattleRoom_EventScript_BattleSpenser:: @ 824FC06
call BattleFrontier_EventScript_SetBrainObjectGfx
msgbox BattleFrontier_BattlePalaceBattleRoom_Text_AnnounceArrivalOfSpenser, MSGBOX_DEFAULT
closemessage
- applymovement 1, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceRight
- applymovement 3, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceRight
- setobjectxyperm 2, 15, 1
- addobject 2
- hideobjectat 2, MAP_BATTLE_FRONTIER_BATTLE_PALACE_BATTLE_ROOM
- setobjectxy 2, 13, 1
- setobjectxyperm 2, 13, 1
- applymovement 4, BattleFrontier_BattlePalaceBattleRoom_Movement_DusclopsEnter
- applymovement 5, BattleFrontier_BattlePalaceBattleRoom_Movement_AzurillEnter
- applymovement 2, BattleFrontier_BattlePalaceBattleRoom_Movement_SpenserEnter
+ applymovement LOCALID_PLAYER, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceRight
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceRight
+ setobjectxyperm LOCALID_OPPONENT, 15, 1
+ addobject LOCALID_OPPONENT
+ hideobjectat LOCALID_OPPONENT, MAP_BATTLE_FRONTIER_BATTLE_PALACE_BATTLE_ROOM
+ setobjectxy LOCALID_OPPONENT, 13, 1
+ setobjectxyperm LOCALID_OPPONENT, 13, 1
+ applymovement LOCALID_DUSCLOPS, BattleFrontier_BattlePalaceBattleRoom_Movement_DusclopsEnter
+ applymovement LOCALID_AZURILL, BattleFrontier_BattlePalaceBattleRoom_Movement_AzurillEnter
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattlePalaceBattleRoom_Movement_SpenserEnter
waitmovement 0
switch VAR_TEMP_F
case FRONTIER_BRAIN_GOLD, BattleFrontier_BattlePalaceBattleRoom_EventScript_IntroSpenserGold
@@ -236,18 +242,18 @@ BattleFrontier_BattlePalaceBattleRoom_EventScript_DefeatedSpenserSilver:: @ 824F
compare VAR_RESULT, 0
goto_if_ne BattleFrontier_BattlePalaceBattleRoom_EventScript_WarpToLobbyWon
msgbox BattleFrontier_BattlePalaceBattleRoom_Text_SpenserPostSilverBattle, MSGBOX_DEFAULT
- applymovement 1, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceUp
- applymovement 3, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceDown
+ applymovement LOCALID_PLAYER, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceUp
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceDown
msgbox BattleFrontier_BattlePalaceBattleRoom_Text_LetsSeeFrontierPass, MSGBOX_DEFAULT
playfanfare MUS_ME_SYMBOLGET
message BattleFrontier_BattlePalaceBattleRoom_Text_ReceivedSpiritsSymbol
waitmessage
waitfanfare
frontier_givesymbol
- applymovement 2, Common_Movement_WalkInPlaceLeft
+ applymovement LOCALID_OPPONENT, Common_Movement_WalkInPlaceLeft
waitmovement 0
- applymovement 1, Common_Movement_WalkInPlaceFastestRight
- applymovement 3, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_PLAYER, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_ATTENDANT, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
msgbox BattleFrontier_BattlePalaceBattleRoom_Text_SpenserAwaitNextTime, MSGBOX_DEFAULT
goto BattleFrontier_BattlePalaceBattleRoom_EventScript_WarpToLobbyWon
@@ -271,18 +277,18 @@ BattleFrontier_BattlePalaceBattleRoom_EventScript_DefeatedSpenserGold:: @ 824FD8
compare VAR_RESULT, 2
goto_if_eq BattleFrontier_BattlePalaceBattleRoom_EventScript_WarpToLobbyWon
msgbox BattleFrontier_BattlePalaceBattleRoom_Text_SpenserYourTeamIsAdmirable, MSGBOX_DEFAULT
- applymovement 1, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceUp
- applymovement 3, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceDown
+ applymovement LOCALID_PLAYER, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceUp
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePalaceBattleRoom_Movement_FaceDown
msgbox BattleFrontier_BattlePalaceBattleRoom_Text_HurryWithFrontierPass, MSGBOX_DEFAULT
playfanfare MUS_ME_SYMBOLGET
message BattleFrontier_BattlePalaceBattleRoom_Text_SpiritsSymbolTookGoldenShine
waitmessage
waitfanfare
frontier_givesymbol
- applymovement 2, Common_Movement_WalkInPlaceLeft
+ applymovement LOCALID_OPPONENT, Common_Movement_WalkInPlaceLeft
waitmovement 0
- applymovement 1, Common_Movement_WalkInPlaceFastestRight
- applymovement 3, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_PLAYER, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_ATTENDANT, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
msgbox BattleFrontier_BattlePalaceBattleRoom_Text_SpenserComeSeeMeAgain, MSGBOX_DEFAULT
goto BattleFrontier_BattlePalaceBattleRoom_EventScript_WarpToLobbyWon
@@ -306,13 +312,13 @@ BattleFrontier_BattlePalaceBattleRoom_OnWarp: @ 824FE34
.2byte 0
BattleFrontier_BattlePalaceBattleRoom_EventScript_SetUpRoomObjects:: @ 824FE3E
- hideobjectat 1, MAP_BATTLE_FRONTIER_BATTLE_PALACE_BATTLE_ROOM
+ hideobjectat LOCALID_PLAYER, MAP_BATTLE_FRONTIER_BATTLE_PALACE_BATTLE_ROOM
call BattleFrontier_BattlePalaceBattleRoom_EventScript_SetPlayerGfx
setvar VAR_TEMP_1, 1
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattlePalaceBattleRoom_Movement_SetInvisible
- removeobject 2
- applymovement 4, BattleFrontier_BattlePalaceBattleRoom_Movement_SetInvisible
- applymovement 5, BattleFrontier_BattlePalaceBattleRoom_Movement_SetInvisible
+ removeobject LOCALID_OPPONENT
+ applymovement LOCALID_DUSCLOPS, BattleFrontier_BattlePalaceBattleRoom_Movement_SetInvisible
+ applymovement LOCALID_AZURILL, BattleFrontier_BattlePalaceBattleRoom_Movement_SetInvisible
end
BattleFrontier_BattlePalaceBattleRoom_EventScript_ReadyFor2ndOpponent:: @ 824FE66
diff --git a/data/maps/BattleFrontier_BattlePalaceCorridor/scripts.inc b/data/maps/BattleFrontier_BattlePalaceCorridor/scripts.inc
index 64fd79d76..2b3b8aab3 100644
--- a/data/maps/BattleFrontier_BattlePalaceCorridor/scripts.inc
+++ b/data/maps/BattleFrontier_BattlePalaceCorridor/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
BattleFrontier_BattlePalaceCorridor_MapScripts:: @ 824F4A3
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattlePalaceCorridor_OnFrame
.byte 0
@@ -8,7 +10,7 @@ BattleFrontier_BattlePalaceCorridor_OnFrame: @ 824F4A9
BattleFrontier_BattlePalaceCorridor_EventScript_WalkThroughCorridor:: @ 824F4B3
delay 16
- applymovement 1, BattleFrontier_BattlePalaceCorridor_Movement_EnterCorridor
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePalaceCorridor_Movement_EnterCorridor
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattlePalaceCorridor_Movement_EnterCorridor
waitmovement 0
lockall
@@ -27,12 +29,12 @@ BattleFrontier_BattlePalaceCorridor_EventScript_WalkThroughCorridor:: @ 824F4B3
frontier_get FRONTIER_DATA_LVL_MODE
compare VAR_RESULT, FRONTIER_LVL_OPEN
goto_if_eq BattleFrontier_BattlePalaceCorridor_EventScript_WalkToOpenBattleRoom
- applymovement 1, BattleFrontier_BattlePalaceCorridor_Movement_AttendantWalkTo50BattleRoom
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePalaceCorridor_Movement_AttendantWalkTo50BattleRoom
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattlePalaceCorridor_Movement_PlayerWalkTo50BattleRoom
waitmovement 0
opendoor 6, 3
waitdooranim
- applymovement 1, BattleFrontier_BattlePalaceCorridor_Movement_AttendantEnterBattleRoom
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePalaceCorridor_Movement_AttendantEnterBattleRoom
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattlePalaceCorridor_Movement_PlayerEnterBattleRoom
waitmovement 0
closedoor 6, 3
@@ -40,12 +42,12 @@ BattleFrontier_BattlePalaceCorridor_EventScript_WalkThroughCorridor:: @ 824F4B3
goto BattleFrontier_BattlePalaceCorridor_EventScript_WarpToBattleRoom
BattleFrontier_BattlePalaceCorridor_EventScript_WalkToOpenBattleRoom:: @ 824F553
- applymovement 1, BattleFrontier_BattlePalaceCorridor_Movement_AttendantWalkToOpenBattleRoom
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePalaceCorridor_Movement_AttendantWalkToOpenBattleRoom
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattlePalaceCorridor_Movement_PlayerWalkToOpenBattleRoom
waitmovement 0
opendoor 10, 3
waitdooranim
- applymovement 1, BattleFrontier_BattlePalaceCorridor_Movement_AttendantEnterBattleRoom
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePalaceCorridor_Movement_AttendantEnterBattleRoom
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattlePalaceCorridor_Movement_PlayerEnterBattleRoom
waitmovement 0
closedoor 10, 3
diff --git a/data/maps/BattleFrontier_BattlePalaceLobby/scripts.inc b/data/maps/BattleFrontier_BattlePalaceLobby/scripts.inc
index 4d5c1d312..dc0fe4af1 100644
--- a/data/maps/BattleFrontier_BattlePalaceLobby/scripts.inc
+++ b/data/maps/BattleFrontier_BattlePalaceLobby/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_ATTENDANT_SINGLES, 1
+.set LOCALID_ATTENDANT_DOUBLES, 6
+
BattleFrontier_BattlePalaceLobby_MapScripts:: @ 824D77E
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattlePalaceLobby_OnFrame
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, BattleFrontier_BattlePalaceLobby_OnWarp
@@ -269,11 +272,11 @@ BattleFrontier_BattlePalaceLobby_EventScript_WalkToDoor:: @ 824DBBC
return
BattleFrontier_BattlePalaceLobby_EventScript_TalkedToSinglesAttendant:: @ 824DC23
- setvar VAR_LAST_TALKED, 1
+ setvar VAR_LAST_TALKED, LOCALID_ATTENDANT_SINGLES
return
BattleFrontier_BattlePalaceLobby_EventScript_TalkedToDoublesAttendant:: @ 824DC29
- setvar VAR_LAST_TALKED, 6
+ setvar VAR_LAST_TALKED, LOCALID_ATTENDANT_DOUBLES
return
BattleFrontier_BattlePalaceLobby_EventScript_OpenSinglesHallDoor:: @ 824DC2F
diff --git a/data/maps/BattleFrontier_BattlePikeCorridor/scripts.inc b/data/maps/BattleFrontier_BattlePikeCorridor/scripts.inc
index e4421acbe..1c55d7bf5 100644
--- a/data/maps/BattleFrontier_BattlePikeCorridor/scripts.inc
+++ b/data/maps/BattleFrontier_BattlePikeCorridor/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
BattleFrontier_BattlePikeCorridor_MapScripts:: @ 825C771
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattlePikeCorridor_OnFrame
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, BattleFrontier_BattlePikeCorridor_OnWarp
@@ -13,7 +15,7 @@ BattleFrontier_BattlePikeCorridor_EventScript_EnterCorridor:: @ 825C786
pike_cleartrainerids
pike_nohealing TRUE
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattlePikeCorridor_Movement_PlayerEnterCorridor
- applymovement 1, BattleFrontier_BattlePikeCorridor_Movement_AttendantEnterCorridor
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePikeCorridor_Movement_AttendantEnterCorridor
waitmovement 0
lockall
msgbox BattleFrontier_BattlePikeCorridor_Text_YourChallengeHasBegun, MSGBOX_DEFAULT
diff --git a/data/maps/BattleFrontier_BattlePikeLobby/scripts.inc b/data/maps/BattleFrontier_BattlePikeLobby/scripts.inc
index d2cf3fe32..c1d3fc974 100644
--- a/data/maps/BattleFrontier_BattlePikeLobby/scripts.inc
+++ b/data/maps/BattleFrontier_BattlePikeLobby/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
BattleFrontier_BattlePikeLobby_MapScripts:: @ 825B6C6
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattlePikeLobby_OnFrame
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, BattleFrontier_BattlePikeLobby_OnWarp
@@ -200,7 +202,7 @@ BattleFrontier_BattlePikeLobby_EventScript_ShowResults:: @ 825BA80
end
BattleFrontier_BattlePikeLobby_EventScript_WalkToCorridor:: @ 825BA94
- applymovement 1, BattleFrontier_BattlePikeLobby_Movement_AttendantWalkToCorridor
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePikeLobby_Movement_AttendantWalkToCorridor
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattlePikeLobby_Movement_PlayerWalkToCorridor
waitmovement 0
return
diff --git a/data/maps/BattleFrontier_BattlePikeRoomFinal/scripts.inc b/data/maps/BattleFrontier_BattlePikeRoomFinal/scripts.inc
index d6c6c3993..51c7d5610 100644
--- a/data/maps/BattleFrontier_BattlePikeRoomFinal/scripts.inc
+++ b/data/maps/BattleFrontier_BattlePikeRoomFinal/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
BattleFrontier_BattlePikeRoomFinal_MapScripts:: @ 825E392
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattlePikeRoomFinal_OnFrame
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, BattleFrontier_BattlePikeRoomFinal_OnWarp
@@ -9,7 +11,7 @@ BattleFrontier_BattlePikeRoomFinal_OnFrame: @ 825E39D
BattleFrontier_BattlePikeRoomFinal_EventScript_EnterRoom:: @ 825E3A7
delay 16
- applymovement 1, BattleFrontier_BattlePikeRoomFinal_Movement_AttendantApproachPlayer
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePikeRoomFinal_Movement_AttendantApproachPlayer
waitmovement 0
frontier_set FRONTIER_DATA_CHALLENGE_STATUS, CHALLENGE_STATUS_WON
lockall
diff --git a/data/maps/BattleFrontier_BattlePikeRoomNormal/scripts.inc b/data/maps/BattleFrontier_BattlePikeRoomNormal/scripts.inc
index d8ff75e1e..327b6463c 100644
--- a/data/maps/BattleFrontier_BattlePikeRoomNormal/scripts.inc
+++ b/data/maps/BattleFrontier_BattlePikeRoomNormal/scripts.inc
@@ -1,3 +1,8 @@
+@ Objects in this room are set dynamically with OBJ_EVENT_GFX_VAR_0 and OBJ_EVENT_GFX_VAR_1
+@ Note: LOCALIDs shared with data/scripts/battle_pike.inc
+.equ LOCALID_OBJ_0, 1
+.equ LOCALID_OBJ_1, 2
+
BattleFrontier_BattlePikeRoomNormal_MapScripts:: @ 825D152
map_script MAP_SCRIPT_ON_RESUME, BattleFrontier_BattlePikeRoom_OnResume
map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_BattlePikeRoom_OnTransition
@@ -24,7 +29,7 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_EnterRoom:: @ 825D171
BattleFrontier_BattlePikeRoomNormal_EventScript_EnterSingleBattleRoom:: @ 825D1C6
lockall
delay 16
- applymovement 1, BattleFrontier_BattlePikeRoomNormal_Movement_ApproachPlayer
+ applymovement LOCALID_OBJ_0, BattleFrontier_BattlePikeRoomNormal_Movement_ApproachPlayer
waitmovement 0
pike_gettrainerintro 0
msgbox gStringVar4, MSGBOX_DEFAULT
@@ -44,7 +49,7 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_WarpToLobbyLost:: @ 825D20A
end
BattleFrontier_BattlePikeRoomNormal_EventScript_WonSingleBattle:: @ 825D226
- applymovement 1, BattleFrontier_BattlePikeRoomNormal_Movement_NPCExit
+ applymovement LOCALID_OBJ_0, BattleFrontier_BattlePikeRoomNormal_Movement_NPCExit
waitmovement 0
end
@@ -54,7 +59,7 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_EnterHardBattleRoom:: @ 825D231
msgbox BattleFrontier_BattlePikeRoomNormal_Text_BattleSomewhatToughTrainer, MSGBOX_DEFAULT
waitmessage
closemessage
- applymovement 1, BattleFrontier_BattlePikeRoomNormal_Movement_ApproachPlayer
+ applymovement LOCALID_OBJ_0, BattleFrontier_BattlePikeRoomNormal_Movement_ApproachPlayer
waitmovement 0
pike_gettrainerintro 0
msgbox gStringVar4, MSGBOX_DEFAULT
@@ -71,9 +76,9 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_EnterHardBattleRoom:: @ 825D231
end
BattleFrontier_BattlePikeRoomNormal_EventScript_WonHardBattle:: @ 825D285
- applymovement 1, BattleFrontier_BattlePikeRoomNormal_Movement_NPCExit
+ applymovement LOCALID_OBJ_0, BattleFrontier_BattlePikeRoomNormal_Movement_NPCExit
waitmovement 0
- applymovement 2, BattleFrontier_BattlePikeRoomNormal_Movement_HealNPCApproachPlayer
+ applymovement LOCALID_OBJ_1, BattleFrontier_BattlePikeRoomNormal_Movement_HealNPCApproachPlayer
waitmovement 0
lock
faceplayer
@@ -84,14 +89,14 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_WonHardBattle:: @ 825D285
msgbox BattleFrontier_BattlePikeRoomNormal_Text_EnjoyRestOfChallenge2, MSGBOX_DEFAULT
closemessage
release
- applymovement 2, BattleFrontier_BattlePikeRoomNormal_Movement_NPCExit
+ applymovement LOCALID_OBJ_1, BattleFrontier_BattlePikeRoomNormal_Movement_NPCExit
waitmovement 0
end
BattleFrontier_BattlePikeRoomNormal_EventScript_EnterBrainRoom:: @ 825D2BF
delay 22
lockall
- applymovement 2, BattleFrontier_BattlePikeRoomNormal_Movement_PreQueenHealNPCApproachPlayer
+ applymovement LOCALID_OBJ_1, BattleFrontier_BattlePikeRoomNormal_Movement_PreQueenHealNPCApproachPlayer
waitmovement 0
pike_prequeenheal
switch VAR_RESULT
@@ -104,7 +109,7 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_LucyEnter:: @ 825D2FB
closemessage
special SpawnCameraObject
applymovement OBJ_EVENT_ID_CAMERA, BattleFrontier_BattlePikeRoomNormal_Movement_CameraPanUp
- applymovement 2, BattleFrontier_BattlePikeRoomNormal_Movement_HealNPCExitForLucy
+ applymovement LOCALID_OBJ_1, BattleFrontier_BattlePikeRoomNormal_Movement_HealNPCExitForLucy
waitmovement 0
playse SE_CURTAIN
call BattleFrontier_BattlePikeRoomNormal_EventScript_SetCurtainTilesLittleClosed
@@ -118,13 +123,13 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_LucyEnter:: @ 825D2FB
playse SE_CURTAIN1
delay 65
call BattleFrontier_BattlePikeRoomNormal_EventScript_SetCurtainTilesMostlyClosed
- showobjectat 1, MAP_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_NORMAL
+ showobjectat LOCALID_OBJ_0, MAP_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_NORMAL
delay 4
call BattleFrontier_BattlePikeRoomNormal_EventScript_SetCurtainTilesLittleClosed
delay 4
call BattleFrontier_BattlePikeRoomNormal_EventScript_SetCurtainTilesOpen
waitse
- applymovement 1, BattleFrontier_BattlePikeRoomNormal_Movement_LucyEnter
+ applymovement LOCALID_OBJ_0, BattleFrontier_BattlePikeRoomNormal_Movement_LucyEnter
waitmovement 0
pike_getbrainstatus
switch VAR_RESULT
@@ -188,7 +193,7 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_DefeatedLucyGold:: @ 825D460
end
BattleFrontier_BattlePikeRoomNormal_EventScript_DefeatedLucy:: @ 825D49D
- applymovement 1, BattleFrontier_BattlePikeRoomNormal_Movement_LucyMoveAside
+ applymovement LOCALID_OBJ_0, BattleFrontier_BattlePikeRoomNormal_Movement_LucyMoveAside
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattlePikeRoomNormal_Movement_PlayerWalkUp2
waitmovement 0
@@ -221,7 +226,7 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_PreQueenHealTwoMons:: @ 825D4FC
BattleFrontier_BattlePikeRoomNormal_EventScript_EnterFullHealRoom:: @ 825D50E
lockall
delay 16
- applymovement 1, BattleFrontier_BattlePikeRoomNormal_Movement_ApproachPlayer
+ applymovement LOCALID_OBJ_0, BattleFrontier_BattlePikeRoomNormal_Movement_ApproachPlayer
waitmovement 0
message BattleFrontier_BattlePikeRoomNormal_Text_WillRestoreToFullHealth
waitmessage
@@ -230,7 +235,7 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_EnterFullHealRoom:: @ 825D50E
special HealPlayerParty
msgbox BattleFrontier_BattlePikeRoomNormal_Text_EnjoyRestOfChallenge, MSGBOX_DEFAULT
closemessage
- applymovement 1, BattleFrontier_BattlePikeRoomNormal_Movement_NPCExit
+ applymovement LOCALID_OBJ_0, BattleFrontier_BattlePikeRoomNormal_Movement_NPCExit
waitmovement 0
releaseall
end
@@ -238,14 +243,14 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_EnterFullHealRoom:: @ 825D50E
BattleFrontier_BattlePikeRoomNormal_EventScript_EnterDoubleBattleRoom:: @ 825D53E
lockall
delay 16
- applymovement 1, BattleFrontier_BattlePikeRoomNormal_Movement_Trainer1WalkRight
- applymovement 2, BattleFrontier_BattlePikeRoomNormal_Movement_Trainer2WalkLeft
+ applymovement LOCALID_OBJ_0, BattleFrontier_BattlePikeRoomNormal_Movement_Trainer1WalkRight
+ applymovement LOCALID_OBJ_1, BattleFrontier_BattlePikeRoomNormal_Movement_Trainer2WalkLeft
waitmovement 0
- applymovement 1, BattleFrontier_BattlePikeRoomNormal_Movement_DoubleTrainersWalkDown
- applymovement 2, BattleFrontier_BattlePikeRoomNormal_Movement_DoubleTrainersWalkDown
+ applymovement LOCALID_OBJ_0, BattleFrontier_BattlePikeRoomNormal_Movement_DoubleTrainersWalkDown
+ applymovement LOCALID_OBJ_1, BattleFrontier_BattlePikeRoomNormal_Movement_DoubleTrainersWalkDown
waitmovement 0
- applymovement 1, BattleFrontier_BattlePikeRoomNormal_Movement_Trainer1FacePlayer
- applymovement 2, BattleFrontier_BattlePikeRoomNormal_Movement_Trainer2FacePlayer
+ applymovement LOCALID_OBJ_0, BattleFrontier_BattlePikeRoomNormal_Movement_Trainer1FacePlayer
+ applymovement LOCALID_OBJ_1, BattleFrontier_BattlePikeRoomNormal_Movement_Trainer2FacePlayer
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattlePikeRoomNormal_Movement_PlayerFaceTrainer1
waitmovement 0
@@ -270,9 +275,9 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_EnterDoubleBattleRoom:: @ 825D53
BattleFrontier_BattlePikeRoomNormal_EventScript_WonDoubleBattle:: @ 825D5DC
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattlePikeRoomNormal_Movement_PlayerFaceTrainer2
waitmovement 0
- applymovement 1, BattleFrontier_BattlePikeRoomNormal_Movement_Trainer1Exit
+ applymovement LOCALID_OBJ_0, BattleFrontier_BattlePikeRoomNormal_Movement_Trainer1Exit
waitmovement 0
- applymovement 2, BattleFrontier_BattlePikeRoomNormal_Movement_Trainer2Exit
+ applymovement LOCALID_OBJ_1, BattleFrontier_BattlePikeRoomNormal_Movement_Trainer2Exit
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattlePikeRoomNormal_Movement_PlayerFaceUp
waitmovement 0
@@ -281,7 +286,7 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_WonDoubleBattle:: @ 825D5DC
BattleFrontier_BattlePikeRoomNormal_EventScript_EnterStatusRoom:: @ 825D605
lockall
message BattleFrontier_BattlePikeRoomNormal_Text_WatchOut
- applymovement 2, BattleFrontier_BattlePikeRoomNormal_Movement_MonApproachPlayer
+ applymovement LOCALID_OBJ_1, BattleFrontier_BattlePikeRoomNormal_Movement_MonApproachPlayer
waitmovement 0
pike_getstatusmon
copyvar VAR_0x8004, VAR_RESULT
@@ -311,9 +316,9 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_KirliaAttack:: @ 825D643
call_if_eq BattleFrontier_BattlePikeRoomNormal_EventScript_KirliaUsedHypnosis
pike_flashscreen
waitstate
- applymovement 1, BattleFrontier_BattlePikeRoomNormal_Movement_NPCApproachMon
+ applymovement LOCALID_OBJ_0, BattleFrontier_BattlePikeRoomNormal_Movement_NPCApproachMon
waitmovement 0
- applymovement 2, BattleFrontier_BattlePikeRoomNormal_Movement_MonFaceNPC
+ applymovement LOCALID_OBJ_1, BattleFrontier_BattlePikeRoomNormal_Movement_MonFaceNPC
waitmovement 0
waitse
playmoncry SPECIES_KIRLIA, 0
@@ -323,8 +328,8 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_KirliaAttack:: @ 825D643
playmoncry SPECIES_KIRLIA, 0
waitmoncry
closemessage
- applymovement 2, BattleFrontier_BattlePikeRoomNormal_Movement_MonMoveAside
- applymovement 1, BattleFrontier_BattlePikeRoomNormal_Movement_StatusNPCApproachPlayer
+ applymovement LOCALID_OBJ_1, BattleFrontier_BattlePikeRoomNormal_Movement_MonMoveAside
+ applymovement LOCALID_OBJ_0, BattleFrontier_BattlePikeRoomNormal_Movement_StatusNPCApproachPlayer
waitmovement 0
msgbox BattleFrontier_BattlePikeRoomNormal_Text_ApologizeForKirlia, MSGBOX_DEFAULT
return
@@ -342,9 +347,9 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_DusclopsAttack:: @ 825D6D5
call_if_eq BattleFrontier_BattlePikeRoomNormal_EventScript_DusclopsUsedWillOWisp
pike_flashscreen
waitstate
- applymovement 1, BattleFrontier_BattlePikeRoomNormal_Movement_NPCApproachMon
+ applymovement LOCALID_OBJ_0, BattleFrontier_BattlePikeRoomNormal_Movement_NPCApproachMon
waitmovement 0
- applymovement 2, BattleFrontier_BattlePikeRoomNormal_Movement_MonFaceNPC
+ applymovement LOCALID_OBJ_1, BattleFrontier_BattlePikeRoomNormal_Movement_MonFaceNPC
waitmovement 0
waitse
playmoncry SPECIES_DUSCLOPS, 0
@@ -354,8 +359,8 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_DusclopsAttack:: @ 825D6D5
playmoncry SPECIES_DUSCLOPS, 0
waitmoncry
closemessage
- applymovement 2, BattleFrontier_BattlePikeRoomNormal_Movement_MonMoveAside
- applymovement 1, BattleFrontier_BattlePikeRoomNormal_Movement_StatusNPCApproachPlayer
+ applymovement LOCALID_OBJ_1, BattleFrontier_BattlePikeRoomNormal_Movement_MonMoveAside
+ applymovement LOCALID_OBJ_0, BattleFrontier_BattlePikeRoomNormal_Movement_StatusNPCApproachPlayer
waitmovement 0
msgbox BattleFrontier_BattlePikeRoomNormal_Text_ApologizeForDusclops, MSGBOX_DEFAULT
return
@@ -573,7 +578,7 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_HealNPC:: @ 825D83E
msgbox BattleFrontier_BattlePikeRoomNormal_Text_BestOfLuckFarewell, MSGBOX_DEFAULT
closemessage
release
- applymovement 1, BattleFrontier_BattlePikeRoomNormal_Movement_HealNPCExit
+ applymovement LOCALID_OBJ_0, BattleFrontier_BattlePikeRoomNormal_Movement_HealNPCExit
waitmovement 0
end
@@ -598,7 +603,7 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_StatusMon:: @ 825D88D
msgbox BattleFrontier_BattlePikeRoomNormal_Text_Silence, MSGBOX_DEFAULT
closemessage
release
- applymovement 2, BattleFrontier_BattlePikeRoomNormal_Movement_MonFaceRight
+ applymovement LOCALID_OBJ_1, BattleFrontier_BattlePikeRoomNormal_Movement_MonFaceRight
waitmovement 0
end
diff --git a/data/maps/BattleFrontier_BattlePikeThreePathRoom/scripts.inc b/data/maps/BattleFrontier_BattlePikeThreePathRoom/scripts.inc
index a9da7a092..46edebce6 100644
--- a/data/maps/BattleFrontier_BattlePikeThreePathRoom/scripts.inc
+++ b/data/maps/BattleFrontier_BattlePikeThreePathRoom/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_HINT_GIVER, 2
+
BattleFrontier_BattlePikeThreePathRoom_MapScripts:: @ 825C843
map_script MAP_SCRIPT_ON_RESUME, BattleFrontier_BattlePikeRoom_OnResume
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattlePikeThreePathRoom_OnFrame
@@ -159,12 +161,12 @@ BattleFrontier_BattlePikeThreePathRoom_EventScript_SetPikeQueenHint:: @ 825CA91
end
BattleFrontier_BattlePikeThreePathRoom_EventScript_GivePikeQueenHint:: @ 825CA97
- applymovement 2, BattleFrontier_BattlePikeThreePathRoom_Movement_HintGiverApproachPlayer
+ applymovement LOCALID_HINT_GIVER, BattleFrontier_BattlePikeThreePathRoom_Movement_HintGiverApproachPlayer
waitmovement 0
lockall
msgbox BattleFrontier_BattlePikeThreePathRoom_Text_TerrifyingEvent, MSGBOX_DEFAULT
releaseall
- applymovement 2, BattleFrontier_BattlePikeThreePathRoom_Movement_HintGiverReturnToPos
+ applymovement LOCALID_HINT_GIVER, BattleFrontier_BattlePikeThreePathRoom_Movement_HintGiverReturnToPos
waitmovement 0
setvar VAR_TEMP_5, 255
end
diff --git a/data/maps/BattleFrontier_BattlePyramidLobby/scripts.inc b/data/maps/BattleFrontier_BattlePyramidLobby/scripts.inc
index c23f62d78..6c17ca02a 100644
--- a/data/maps/BattleFrontier_BattlePyramidLobby/scripts.inc
+++ b/data/maps/BattleFrontier_BattlePyramidLobby/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_ATTENDANT, 1
+.set LOCALID_HINT_GIVER, 2
+
BattleFrontier_BattlePyramidLobby_MapScripts:: @ 8250716
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattlePyramidLobby_OnFrame
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, BattleFrontier_BattleDomeLobby_OnWarp
@@ -206,7 +209,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_EndCancelChallenge:: @ 8250ACC
BattleFrontier_BattlePyramidLobby_EventScript_HintGiver:: @ 8250ACE
lockall
- applymovement 2, Common_Movement_FacePlayer
+ applymovement LOCALID_HINT_GIVER, Common_Movement_FacePlayer
waitmovement 0
msgbox BattleFrontier_BattlePyramidLobby_Text_TellYouWhatMisfortunesAwait, MSGBOX_DEFAULT
call BattleFrontier_BattlePyramidLobby_EventScript_GiveHint
@@ -370,7 +373,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_ShowResults:: @ 8250D42
end
BattleFrontier_BattlePyramidLobby_EventScript_WalkToPanelAndReceiveBag:: @ 8250D56
- applymovement 1, BattleFrontier_BattlePyramidLobby_Movement_AttendantWalkToPanel
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePyramidLobby_Movement_AttendantWalkToPanel
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattlePyramidLobby_Movement_PlayerWalkToPanel
waitmovement 0
msgbox BattleFrontier_BattlePyramidLobby_Text_WeWillHoldBagForSafekeeping, MSGBOX_DEFAULT
@@ -389,7 +392,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_ReceiveBattleBag:: @ 8250D9C
waitse
msgbox BattleFrontier_BattlePyramidLobby_Text_StepOnFloorPanel, MSGBOX_DEFAULT
closemessage
- applymovement 1, BattleFrontier_BattlePyramidLobby_Movement_AttendantMoveAside
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePyramidLobby_Movement_AttendantMoveAside
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattlePyramidLobby_Movement_PlayerStepOnPanel
waitmovement 0
diff --git a/data/maps/BattleFrontier_BattlePyramidTop/scripts.inc b/data/maps/BattleFrontier_BattlePyramidTop/scripts.inc
index d09bac10f..7aee4512d 100644
--- a/data/maps/BattleFrontier_BattlePyramidTop/scripts.inc
+++ b/data/maps/BattleFrontier_BattlePyramidTop/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_ATTENDANT, 1
+.set LOCALID_BRANDON, 2
+
BattleFrontier_BattlePyramidTop_MapScripts:: @ 82550A1
map_script MAP_SCRIPT_ON_RESUME, BattleFrontier_BattlePyramidTop_OnResume
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattlePyramidTop_OnFrame
@@ -19,7 +22,7 @@ BattleFrontier_BattlePyramidTop_EventScript_SetUpObjects:: @ 82550D8
turnobject OBJ_EVENT_ID_PLAYER, DIR_NORTH
compare VAR_TEMP_C, 0
goto_if_ne BattleFrontier_BattlePyramidTop_EventScript_EndSetUpObjects
- setobjectxyperm 2, 0, 0
+ setobjectxyperm LOCALID_BRANDON, 0, 0
BattleFrontier_BattlePyramidTop_EventScript_EndSetUpObjects:: @ 82550F3
end
@@ -77,11 +80,11 @@ BattleFrontier_BattlePyramidTop_EventScript_Attendant:: @ 82551D0
goto_if_ne BattleFrontier_BattlePyramidTop_EventScript_BrandonHereMoveAside
msgbox BattleFrontier_BattlePyramidTop_Text_ReachedSummitUpYouGo, MSGBOX_DEFAULT
closemessage
- applymovement 1, BattleFrontier_BattlePyramidTop_Movement_AttendantMoveAside
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePyramidTop_Movement_AttendantMoveAside
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattlePyramidTop_Movement_PlayerClimbToTop
waitmovement 0
- applymovement 1, BattleFrontier_BattlePyramidTop_Movement_AttendantBlockPath
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePyramidTop_Movement_AttendantBlockPath
waitmovement 0
message BattleFrontier_BattlePyramidTop_Text_PlayerConqueredPyramid
waitmessage
@@ -101,7 +104,7 @@ BattleFrontier_BattlePyramidTop_EventScript_StepForwardWhenReady:: @ 8255236
BattleFrontier_BattlePyramidTop_EventScript_BrandonHereMoveAside:: @ 8255240
msgbox BattleFrontier_BattlePyramidTop_Text_ChiefBeatYouHere, MSGBOX_DEFAULT
- applymovement 1, BattleFrontier_BattlePyramidTop_Movement_AttendantMoveAside
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePyramidTop_Movement_AttendantMoveAside
setvar VAR_TEMP_D, 1
closemessage
end
@@ -121,14 +124,14 @@ BattleFrontier_BattlePyramidTop_EventScript_BattleBrandon:: @ 8255256
msgbox BattleFrontier_BattlePyramidTop_Text_ExplorationsAreGrandestAdventure, MSGBOX_DEFAULT
closemessage
frontier_set FRONTIER_DATA_HEARD_BRAIN_SPEECH
- applymovement 2, BattleFrontier_BattlePyramidTop_Movement_BrandonApproachPlayer
+ applymovement LOCALID_BRANDON, BattleFrontier_BattlePyramidTop_Movement_BrandonApproachPlayer
waitmovement 0
msgbox BattleFrontier_BattlePyramidTop_Text_ImPyramidKingBrandon, MSGBOX_DEFAULT
goto BattleFrontier_BattlePyramidTop_EventScript_BattleBrandonSilver
end
BattleFrontier_BattlePyramidTop_EventScript_BrandonHeardSilverSpeech:: @ 82552D0
- applymovement 2, BattleFrontier_BattlePyramidTop_Movement_BrandonApproachPlayer
+ applymovement LOCALID_BRANDON, BattleFrontier_BattlePyramidTop_Movement_BrandonApproachPlayer
waitmovement 0
BattleFrontier_BattlePyramidTop_EventScript_BattleBrandonSilver:: @ 82552DA
msgbox BattleFrontier_BattlePyramidTop_Text_BringCourageToOurBattle, MSGBOX_DEFAULT
@@ -161,14 +164,14 @@ BattleFrontier_BattlePyramidTop_EventScript_BrandonIntroGold:: @ 8255335
msgbox BattleFrontier_BattlePyramidTop_Text_BrandonYouveReturned, MSGBOX_DEFAULT
closemessage
frontier_set FRONTIER_DATA_HEARD_BRAIN_SPEECH
- applymovement 2, BattleFrontier_BattlePyramidTop_Movement_BrandonApproachPlayer
+ applymovement LOCALID_BRANDON, BattleFrontier_BattlePyramidTop_Movement_BrandonApproachPlayer
waitmovement 0
msgbox BattleFrontier_BattlePyramidTop_Text_MyCourageIsOffMeter, MSGBOX_DEFAULT
goto BattleFrontier_BattlePyramidTop_EventScript_BattleBrandonGold
end
BattleFrontier_BattlePyramidTop_EventScript_BrandonHeardGoldSpeech:: @ 8255388
- applymovement 2, BattleFrontier_BattlePyramidTop_Movement_BrandonApproachPlayer
+ applymovement LOCALID_BRANDON, BattleFrontier_BattlePyramidTop_Movement_BrandonApproachPlayer
waitmovement 0
BattleFrontier_BattlePyramidTop_EventScript_BattleBrandonGold:: @ 8255392
msgbox BattleFrontier_BattlePyramidTop_Text_EverythingYouHave, MSGBOX_DEFAULT
diff --git a/data/maps/BattleFrontier_BattleTowerBattleRoom/scripts.inc b/data/maps/BattleFrontier_BattleTowerBattleRoom/scripts.inc
index 029009294..bc12c14f4 100644
--- a/data/maps/BattleFrontier_BattleTowerBattleRoom/scripts.inc
+++ b/data/maps/BattleFrontier_BattleTowerBattleRoom/scripts.inc
@@ -1,3 +1,7 @@
+.set LOCALID_OPPONENT, 1
+.set LOCALID_ATTENDANT_1, 2
+.set LOCALID_ATTENDANT_2, 3
+
BattleFrontier_BattleTowerBattleRoom_MapScripts:: @ 8241B40
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattleTowerBattleRoom_OnFrame
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, BattleFrontier_BattleTowerBattleRoom_OnWarp
@@ -9,7 +13,7 @@ BattleFrontier_BattleTowerBattleRoom_OnWarp: @ 8241B4B
BattleFrontier_BattleTowerBattleRoom_EventScript_SetUpObjects:: @ 8241B55
setvar VAR_TEMP_1, 1
- applymovement 3, BattleFrontier_BattleTowerBattleRoom_Movement_SetInvisible
+ applymovement LOCALID_ATTENDANT_2, BattleFrontier_BattleTowerBattleRoom_Movement_SetInvisible
end
BattleFrontier_BattleTowerBattleRoom_OnFrame: @ 8241B62
@@ -23,7 +27,7 @@ BattleFrontier_BattleTowerBattleRoom_EventScript_EnterRoom:: @ 8241B6C
frontier_get FRONTIER_DATA_BATTLE_NUM
compare VAR_RESULT, 0
goto_if_eq BattleFrontier_BattleTowerBattleRoom_EventScript_OpponentEnter
- applymovement 2, BattleFrontier_BattleTowerBattleRoom_Movement_AttendantApproachPlayer
+ applymovement LOCALID_ATTENDANT_1, BattleFrontier_BattleTowerBattleRoom_Movement_AttendantApproachPlayer
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleTowerBattleRoom_Movement_PlayerFaceAttendant
waitmovement 0
@@ -33,8 +37,8 @@ BattleFrontier_BattleTowerBattleRoom_EventScript_EnterRoom:: @ 8241B6C
BattleFrontier_BattleTowerBattleRoom_EventScript_OpponentEnter:: @ 8241BC3
tower_setopponent
- addobject 1
- applymovement 1, BattleFrontier_BattleTowerBattleRoom_Movement_OpponentEnter
+ addobject LOCALID_OPPONENT
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleTowerBattleRoom_Movement_OpponentEnter
waitmovement 0
tower_getopponentintro 0
msgbox gStringVar4, MSGBOX_DEFAULT
@@ -45,7 +49,7 @@ BattleFrontier_BattleTowerBattleRoom_EventScript_OpponentEnter:: @ 8241BC3
BattleFrontier_BattleTower_EventScript_WarpToLobbyLost:: @ 8241C03
frontier_set FRONTIER_DATA_CHALLENGE_STATUS, CHALLENGE_STATUS_LOST
tower_set TOWER_DATA_LVL_MODE
- setvar VAR_0x8004, 3
+ setvar VAR_0x8004, FANCOUNTER_USED_BATTLE_TOWER
special Script_TryGainNewFanFromCounter
goto BattleFrontier_BattleTowerBattleRoom_EventScript_WarpToLobby
@@ -54,13 +58,13 @@ BattleFrontier_BattleTowerBattleRoom_EventScript_DefeatedOpponent:: @ 8241C2F
tower_setbattlewon
switch VAR_RESULT
case 7, BattleFrontier_BattleTowerBattleRoom_EventScript_WarpToLobbyWon
- applymovement 1, BattleFrontier_BattleTowerBattleRoom_Movement_OpponentExit
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleTowerBattleRoom_Movement_OpponentExit
waitmovement 0
- removeobject 1
+ removeobject LOCALID_OPPONENT
frontier_getbrainstatus
compare VAR_RESULT, FRONTIER_BRAIN_NOT_READY
call_if_ne BattleFrontier_BattleTowerBattleRoom_EventScript_SecondAttendantEnter
- applymovement 2, BattleFrontier_BattleTowerBattleRoom_Movement_AttendantApproachPlayer
+ applymovement LOCALID_ATTENDANT_1, BattleFrontier_BattleTowerBattleRoom_Movement_AttendantApproachPlayer
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleTowerBattleRoom_Movement_PlayerFaceAttendant
waitmovement 0
@@ -127,14 +131,14 @@ BattleFrontier_BattleTowerBattleRoom_EventScript_ContinueChallenge:: @ 8241DDC
closemessage
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleTowerBattleRoom_Movement_PlayerFaceBattle
waitmovement 0
- applymovement 2, BattleFrontier_BattleTowerBattleRoom_Movement_AttendantReturnToPos
+ applymovement LOCALID_ATTENDANT_1, BattleFrontier_BattleTowerBattleRoom_Movement_AttendantReturnToPos
waitmovement 0
goto BattleFrontier_BattleTowerBattleRoom_EventScript_OpponentEnter
BattleFrontier_BattleTowerBattleRoom_EventScript_WarpToLobbyWon:: @ 8241DF6
frontier_set FRONTIER_DATA_CHALLENGE_STATUS, CHALLENGE_STATUS_WON
tower_set TOWER_DATA_LVL_MODE
- setvar VAR_0x8004, 3
+ setvar VAR_0x8004, FANCOUNTER_USED_BATTLE_TOWER
special Script_TryGainNewFanFromCounter
goto BattleFrontier_BattleTowerBattleRoom_EventScript_WarpToLobby
@@ -193,19 +197,19 @@ BattleFrontier_EventScript_IncrementWinStreak:: @ 8241EBA
return
BattleFrontier_BattleTowerBattleRoom_EventScript_SecondAttendantEnter:: @ 8241EC3
- applymovement 3, BattleFrontier_BattleTowerBattleRoom_Movement_SecondAttendantEnter
+ applymovement LOCALID_ATTENDANT_2, BattleFrontier_BattleTowerBattleRoom_Movement_SecondAttendantEnter
waitmovement 0
- applymovement 3, Common_Movement_WalkInPlaceLeft
+ applymovement LOCALID_ATTENDANT_2, Common_Movement_WalkInPlaceLeft
waitmovement 0
playse SE_PIN
- applymovement 2, Common_Movement_ExclamationMark
+ applymovement LOCALID_ATTENDANT_1, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 2, Common_Movement_Delay48
+ applymovement LOCALID_ATTENDANT_1, Common_Movement_Delay48
waitmovement 0
- applymovement 3, BattleFrontier_BattleTowerBattleRoom_Movement_SecondAttendantDelay
- applymovement 2, BattleFrontier_BattleTowerBattleRoom_Movement_AttendantFaceSecondAttendant
+ applymovement LOCALID_ATTENDANT_2, BattleFrontier_BattleTowerBattleRoom_Movement_SecondAttendantDelay
+ applymovement LOCALID_ATTENDANT_1, BattleFrontier_BattleTowerBattleRoom_Movement_AttendantFaceSecondAttendant
waitmovement 0
- applymovement 3, BattleFrontier_BattleTowerBattleRoom_Movement_SecondAttendantExit
+ applymovement LOCALID_ATTENDANT_2, BattleFrontier_BattleTowerBattleRoom_Movement_SecondAttendantExit
waitmovement 0
return
@@ -241,10 +245,10 @@ BattleFrontier_BattleTowerBattleRoom_EventScript_BattleAnabel:: @ 8241FAF
closemessage
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleTowerBattleRoom_Movement_PlayerFaceBattle
waitmovement 0
- applymovement 2, BattleFrontier_BattleTowerBattleRoom_Movement_AttendantReturnToPos
+ applymovement LOCALID_ATTENDANT_1, BattleFrontier_BattleTowerBattleRoom_Movement_AttendantReturnToPos
waitmovement 0
- addobject 1
- applymovement 1, BattleFrontier_BattleTowerBattleRoom_Movement_AnabelEnter
+ addobject LOCALID_OPPONENT
+ applymovement LOCALID_OPPONENT, BattleFrontier_BattleTowerBattleRoom_Movement_AnabelEnter
waitmovement 0
switch VAR_TEMP_F
case FRONTIER_BRAIN_GOLD, BattleFrontier_BattleTowerBattleRoom_EventScript_AnabelGoldIntro
diff --git a/data/maps/BattleFrontier_BattleTowerCorridor/scripts.inc b/data/maps/BattleFrontier_BattleTowerCorridor/scripts.inc
index 1acea4785..0237e525c 100644
--- a/data/maps/BattleFrontier_BattleTowerCorridor/scripts.inc
+++ b/data/maps/BattleFrontier_BattleTowerCorridor/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
BattleFrontier_BattleTowerCorridor_MapScripts:: @ 8241AAA
map_script MAP_SCRIPT_ON_LOAD, BattleFrontier_BattleTowerCorridor_OnLoad
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattleTowerCorridor_OnFrame
@@ -23,13 +25,13 @@ BattleFrontier_BattleTowerCorridor_EventScript_EnterCorridor:: @ 8241AF0
setvar VAR_TEMP_0, 1
compare VAR_0x8006, 1
goto_if_eq BattleFrontier_BattleTowerCorridor_EventScript_WalkToFarDoor
- applymovement 1, BattleFrontier_BattleTowerCorridor_Movement_AttendantWalkToDoor
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleTowerCorridor_Movement_AttendantWalkToDoor
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleTowerCorridor_Movement_PlayerWalkToDoor
waitmovement 0
goto BattleFrontier_BattleTowerCorridor_EventScript_WarpToBattleRoom
BattleFrontier_BattleTowerCorridor_EventScript_WalkToFarDoor:: @ 8241B16
- applymovement 1, BattleFrontier_BattleTowerCorridor_Movement_AttendantWalkToFarDoor
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleTowerCorridor_Movement_AttendantWalkToFarDoor
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleTowerCorridor_Movement_PlayerWalkToFarDoor
waitmovement 0
diff --git a/data/maps/BattleFrontier_BattleTowerElevator/scripts.inc b/data/maps/BattleFrontier_BattleTowerElevator/scripts.inc
index e74d08a17..8e66465b7 100644
--- a/data/maps/BattleFrontier_BattleTowerElevator/scripts.inc
+++ b/data/maps/BattleFrontier_BattleTowerElevator/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
BattleFrontier_BattleTowerElevator_MapScripts:: @ 82419DB
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattleTowerElevator_OnFrame
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, BattleFrontier_BattleTowerElevator_OnWarp
@@ -9,7 +11,7 @@ BattleFrontier_BattleTowerElevator_OnFrame: @ 82419E6
BattleFrontier_BattleTowerElevator_EventScript_EnterElevator:: @ 82419F0
setvar VAR_TEMP_0, 1
- applymovement 1, BattleFrontier_BattleTowerElevator_Movement_AttendantEnter
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleTowerElevator_Movement_AttendantEnter
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleTowerElevator_Movement_PlayerEnter
waitmovement 0
special BufferBattleTowerElevatorFloors
@@ -17,7 +19,7 @@ BattleFrontier_BattleTowerElevator_EventScript_EnterElevator:: @ 82419F0
special MoveElevator
waitstate
delay 48
- applymovement 1, BattleFrontier_BattleTowerElevator_Movement_AttendantExit
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleTowerElevator_Movement_AttendantExit
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleTowerElevator_Movement_PlayerExit
waitmovement 0
call BattleFrontier_BattleTowerElevator_EventScript_WarpToNextRoom
diff --git a/data/maps/BattleFrontier_BattleTowerLobby/scripts.inc b/data/maps/BattleFrontier_BattleTowerLobby/scripts.inc
index 843cacef4..4b1f196e3 100644
--- a/data/maps/BattleFrontier_BattleTowerLobby/scripts.inc
+++ b/data/maps/BattleFrontier_BattleTowerLobby/scripts.inc
@@ -1,3 +1,8 @@
+.set LOCALID_ATTENDANT_SINGLES, 1
+.set LOCALID_ATTENDANT_DOUBLES, 7
+.set LOCALID_ATTENDANT_MULTIS, 8
+.set LOCALID_ATTENDANT_LINK_MULTIS, 9
+
BattleFrontier_BattleTowerLobby_MapScripts:: @ 823E67B
map_script MAP_SCRIPT_ON_RESUME, BattleFrontier_BattleTowerLobby_OnResume
map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_BattleTowerLobby_OnTransition
@@ -706,19 +711,19 @@ BattleFrontier_BattleTowerLobby_EventScript_SetAttendantTalkedTo:: @ 823F1E8
return
BattleFrontier_BattleTowerLobby_EventScript_TalkedToSinglesAttendant:: @ 823F215
- setvar VAR_LAST_TALKED, 1
+ setvar VAR_LAST_TALKED, LOCALID_ATTENDANT_SINGLES
return
BattleFrontier_BattleTowerLobby_EventScript_TalkedToDoublesAttendant:: @ 823F21B
- setvar VAR_LAST_TALKED, 7
+ setvar VAR_LAST_TALKED, LOCALID_ATTENDANT_DOUBLES
return
BattleFrontier_BattleTowerLobby_EventScript_TalkedToMultisAttendant:: @ 823F221
- setvar VAR_LAST_TALKED, 8
+ setvar VAR_LAST_TALKED, LOCALID_ATTENDANT_MULTIS
return
BattleFrontier_BattleTowerLobby_EventScript_TalkedToLinkMultisAttendant:: @ 823F227
- setvar VAR_LAST_TALKED, 9
+ setvar VAR_LAST_TALKED, LOCALID_ATTENDANT_LINK_MULTIS
return
BattleFrontier_BattleTowerLobby_EventScript_GetDoorXCoord:: @ 823F22D
@@ -786,19 +791,19 @@ BattleFrontier_BattleTowerLobby_EventScript_TryCableLink:: @ 823F2C5
setvar VAR_0x8005, 0
special TryBattleLinkup
waitstate
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq BattleFrontier_BattleTowerLobby_EventScript_CableLinkSuccessful
- compare VAR_RESULT, 2
+ compare VAR_RESULT, LINKUP_SOMEONE_NOT_READY
goto_if_eq CableClub_EventScript_AbortLinkSomeoneNotReady
- compare VAR_RESULT, 3
+ compare VAR_RESULT, LINKUP_DIFF_SELECTIONS
goto_if_eq BattleFrontier_BattleTowerLobby_EventScript_AbortLinkDifferentSelections
- compare VAR_RESULT, 4
+ compare VAR_RESULT, LINKUP_WRONG_NUM_PLAYERS
goto_if_eq BattleFrontier_BattleTowerLobby_EventScript_AbortLinkIncorrectNumberOfPlayers
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq BattleFrontier_BattleTowerLobby_EventScript_CancelChallenge
- compare VAR_RESULT, 6
+ compare VAR_RESULT, LINKUP_CONNECTION_ERROR
goto_if_eq CableClub_EventScript_AbortLinkConnectionError
- compare VAR_RESULT, 11
+ compare VAR_RESULT, LINKUP_FAILED_BATTLE_TOWER
goto_if_eq BattleFrontier_BattleTowerLobby_EventScript_AbortLink
end
@@ -853,7 +858,7 @@ BattleFrontier_BattleTowerLobby_EventScript_CableLinkSuccessful:: @ 823F3AF
message BattleFrontier_BattleTowerLobby_Text_SaveGameBeforeShowingIn
waitmessage
tower_save CHALLENGE_STATUS_SAVING
- special sub_80A08CC
+ special SaveForBattleTowerLink
waitstate
playse SE_SAVE
waitse
@@ -884,26 +889,26 @@ BattleFrontier_BattleTowerLobby_EventScript_ChooseLeader:: @ 823F3F3
BattleFrontier_BattleTowerLobby_EventScript_TryBecomeLeader:: @ 823F430
call CableClub_EventScript_TryBecomeLinkLeader
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq BattleFrontier_BattleTowerLobby_EventScript_WirelessLinkSuccessful
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq BattleFrontier_BattleTowerLobby_EventScript_ChooseLeader
- compare VAR_RESULT, 8
+ compare VAR_RESULT, LINKUP_RETRY_ROLE_ASSIGN
goto_if_eq BattleFrontier_BattleTowerLobby_EventScript_TryBecomeLeader
- compare VAR_RESULT, 11
+ compare VAR_RESULT, LINKUP_FAILED_BATTLE_TOWER
goto_if_eq BattleFrontier_BattleTowerLobby_EventScript_AbortLink
release
return
BattleFrontier_BattleTowerLobby_EventScript_TryJoinGroup:: @ 823F463
call CableClub_EventScript_TryJoinLinkGroup
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq BattleFrontier_BattleTowerLobby_EventScript_WirelessLinkSuccessful
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq BattleFrontier_BattleTowerLobby_EventScript_ChooseLeader
- compare VAR_RESULT, 8
+ compare VAR_RESULT, LINKUP_RETRY_ROLE_ASSIGN
goto_if_eq BattleFrontier_BattleTowerLobby_EventScript_TryJoinGroup
- compare VAR_RESULT, 11
+ compare VAR_RESULT, LINKUP_FAILED_BATTLE_TOWER
goto_if_eq BattleFrontier_BattleTowerLobby_EventScript_AbortLink
release
return
@@ -914,7 +919,7 @@ BattleFrontier_BattleTowerLobby_EventScript_WirelessLinkSuccessful:: @ 823F496
message BattleFrontier_BattleTowerLobby_Text_SaveGameBeforeShowingIn
waitmessage
tower_save CHALLENGE_STATUS_SAVING
- special sub_80A08CC
+ special SaveForBattleTowerLink
waitstate
playse SE_SAVE
waitse
diff --git a/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc b/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc
index 3c549a919..d764419fd 100644
--- a/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc
+++ b/data/maps/BattleFrontier_BattleTowerMultiBattleRoom/scripts.inc
@@ -1,3 +1,10 @@
+.set LOCALID_OPPONENT_1, 1
+.set LOCALID_ATTENDANT_1, 2
+.set LOCALID_ATTENDANT_2, 3
+.set LOCALID_OPPONENT_2, 4
+.set LOCALID_PLAYER, 5
+.set LOCALID_PARTNER, 6
+
BattleFrontier_BattleTowerMultiBattleRoom_MapScripts:: @ 8248EE8
map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_BattleTowerMultiBattleRoom_OnTransition
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, BattleFrontier_BattleTowerMultiBattleRoom_OnWarp
@@ -5,8 +12,8 @@ BattleFrontier_BattleTowerMultiBattleRoom_MapScripts:: @ 8248EE8
.byte 0
@ On this map the player (OBJ_EVENT_ID_PLAYER) is hidden
- @ The player is represented instead by object event 5, which has the gfx id VAR_OBJ_GFX_ID_F
- @ The multi partner is represented by object event 6, which has the gfx id VAR_OBJ_GFX_ID_E
+ @ The player is represented instead by LOCALID_PLAYER, which has the gfx id VAR_OBJ_GFX_ID_F
+ @ The multi partner is represented by LOCALID_PARTNER, which has the gfx id VAR_OBJ_GFX_ID_E
BattleFrontier_BattleTowerMultiBattleRoom_OnTransition: @ 8248EF8
compare VAR_FRONTIER_BATTLE_MODE, FRONTIER_MODE_MULTIS
@@ -45,38 +52,38 @@ BattleFrontier_BattleTowerMultiBattleRoom_OnFrame: @ 8248F43
BattleFrontier_BattleTowerMultiBattleRoom_EventScript_EnterRoom:: @ 8248F4D
setvar VAR_TEMP_0, 1
- applymovement 5, BattleFrontier_BattleTowerMultiBattleRoom_Movement_PlayerEnterRoom
- applymovement 6, BattleFrontier_BattleTowerMultiBattleRoom_Movement_PartnerEnterRoom
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleTowerMultiBattleRoom_Movement_PlayerEnterRoom
+ applymovement LOCALID_PARTNER, BattleFrontier_BattleTowerMultiBattleRoom_Movement_PartnerEnterRoom
waitmovement 0
frontier_get FRONTIER_DATA_BATTLE_NUM
compare VAR_RESULT, 0
goto_if_eq BattleFrontier_BattleTowerMultiBattleRoom_EventScript_OpponentsEnter
- applymovement 2, BattleFrontier_BattleTowerMultiBattleRoom_Movement_AttendantApproachPlayer
- applymovement 3, BattleFrontier_BattleTowerMultiBattleRoom_Movement_AttendantApproachPlayer
+ applymovement LOCALID_ATTENDANT_1, BattleFrontier_BattleTowerMultiBattleRoom_Movement_AttendantApproachPlayer
+ applymovement LOCALID_ATTENDANT_2, BattleFrontier_BattleTowerMultiBattleRoom_Movement_AttendantApproachPlayer
waitmovement 0
- applymovement 5, BattleFrontier_BattleTowerMultiBattleRoom_Movement_FaceAttendant
- applymovement 6, BattleFrontier_BattleTowerMultiBattleRoom_Movement_FaceAttendant
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleTowerMultiBattleRoom_Movement_FaceAttendant
+ applymovement LOCALID_PARTNER, BattleFrontier_BattleTowerMultiBattleRoom_Movement_FaceAttendant
waitmovement 0
frontier_set FRONTIER_DATA_RECORD_DISABLED, TRUE
goto BattleFrontier_BattleTowerMultiBattleRoom_EventScript_AskReadyForOpponents
BattleFrontier_BattleTowerMultiBattleRoom_EventScript_OpponentsEnter:: @ 8248FB4
tower_setopponent
- addobject 1
- addobject 4
- applymovement 1, BattleFrontier_BattleTowerMultiBattleRoom_Movement_Opponent1Enter
- applymovement 4, BattleFrontier_BattleTowerMultiBattleRoom_Movement_Opponent2Enter
+ addobject LOCALID_OPPONENT_1
+ addobject LOCALID_OPPONENT_2
+ applymovement LOCALID_OPPONENT_1, BattleFrontier_BattleTowerMultiBattleRoom_Movement_Opponent1Enter
+ applymovement LOCALID_OPPONENT_2, BattleFrontier_BattleTowerMultiBattleRoom_Movement_Opponent2Enter
waitmovement 0
compare VAR_FRONTIER_BATTLE_MODE, FRONTIER_MODE_LINK_MULTIS
goto_if_eq BattleFrontier_BattleTowerMultiBattleRoom_EventScript_DoOpponentIntrosLink
tower_getopponentintro 0
delay 15
- applymovement 1, BattleFrontier_BattleTowerMultiBattleRoom_Movement_WalkInPlaceLeft
+ applymovement LOCALID_OPPONENT_1, BattleFrontier_BattleTowerMultiBattleRoom_Movement_WalkInPlaceLeft
waitmovement 0
msgbox gStringVar4, MSGBOX_DEFAULT
waitmessage
tower_getopponentintro 1
- applymovement 4, BattleFrontier_BattleTowerMultiBattleRoom_Movement_WalkInPlaceLeft
+ applymovement LOCALID_OPPONENT_2, BattleFrontier_BattleTowerMultiBattleRoom_Movement_WalkInPlaceLeft
waitmovement 0
msgbox gStringVar4, MSGBOX_DEFAULT
waitmessage
@@ -85,13 +92,13 @@ BattleFrontier_BattleTowerMultiBattleRoom_EventScript_OpponentsEnter:: @ 8248FB4
BattleFrontier_BattleTowerMultiBattleRoom_EventScript_DoOpponentIntrosLink:: @ 8249026
tower_getopponentintro 0
delay 15
- applymovement 1, BattleFrontier_BattleTowerMultiBattleRoom_Movement_WalkInPlaceLeft
+ applymovement LOCALID_OPPONENT_1, BattleFrontier_BattleTowerMultiBattleRoom_Movement_WalkInPlaceLeft
waitmovement 0
messageautoscroll gStringVar4
waitmessage
delay 48
tower_getopponentintro 1
- applymovement 4, BattleFrontier_BattleTowerMultiBattleRoom_Movement_WalkInPlaceLeft
+ applymovement LOCALID_OPPONENT_2, BattleFrontier_BattleTowerMultiBattleRoom_Movement_WalkInPlaceLeft
waitmovement 0
messageautoscroll gStringVar4
waitmessage
@@ -103,7 +110,7 @@ BattleFrontier_BattleTowerMultiBattleRoom_EventScript_DoTowerBattle:: @ 8249069
BattleFrontier_BattleTowerMultiBattleRoom_EventScript_WarpToLobbyLost:: @ 824907E
frontier_set FRONTIER_DATA_CHALLENGE_STATUS, CHALLENGE_STATUS_LOST
tower_set TOWER_DATA_LVL_MODE
- setvar VAR_0x8004, 3
+ setvar VAR_0x8004, FANCOUNTER_USED_BATTLE_TOWER
special Script_TryGainNewFanFromCounter
goto BattleFrontier_BattleTowerBattleRoom_EventScript_WarpToLobby
@@ -112,16 +119,16 @@ BattleFrontier_BattleTowerMultiBattleRoom_EventScript_DefeatedOpponents:: @ 8249
tower_setbattlewon
switch VAR_RESULT
case 7, BattleFrontier_BattleTowerMultiBattleRoom_EventScript_WarpToLobbyWon
- applymovement 4, BattleFrontier_BattleTowerMultiBattleRoom_Movement_Opponent2Exit
- applymovement 1, BattleFrontier_BattleTowerMultiBattleRoom_Movement_Opponent1Exit
+ applymovement LOCALID_OPPONENT_2, BattleFrontier_BattleTowerMultiBattleRoom_Movement_Opponent2Exit
+ applymovement LOCALID_OPPONENT_1, BattleFrontier_BattleTowerMultiBattleRoom_Movement_Opponent1Exit
waitmovement 0
- removeobject 1
- removeobject 4
- applymovement 2, BattleFrontier_BattleTowerMultiBattleRoom_Movement_AttendantApproachPlayer
- applymovement 3, BattleFrontier_BattleTowerMultiBattleRoom_Movement_AttendantApproachPlayer
+ removeobject LOCALID_OPPONENT_1
+ removeobject LOCALID_OPPONENT_2
+ applymovement LOCALID_ATTENDANT_1, BattleFrontier_BattleTowerMultiBattleRoom_Movement_AttendantApproachPlayer
+ applymovement LOCALID_ATTENDANT_2, BattleFrontier_BattleTowerMultiBattleRoom_Movement_AttendantApproachPlayer
waitmovement 0
- applymovement 5, BattleFrontier_BattleTowerMultiBattleRoom_Movement_FaceAttendant
- applymovement 6, BattleFrontier_BattleTowerMultiBattleRoom_Movement_FaceAttendant
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleTowerMultiBattleRoom_Movement_FaceAttendant
+ applymovement LOCALID_PARTNER, BattleFrontier_BattleTowerMultiBattleRoom_Movement_FaceAttendant
waitmovement 0
compare VAR_FRONTIER_BATTLE_MODE, FRONTIER_MODE_LINK_MULTIS
goto_if_eq BattleFrontier_BattleTowerMultiBattleRoom_EventScript_RetorePartyMsgLink
@@ -196,11 +203,11 @@ BattleFrontier_BattleTowerMultiBattleRoom_EventScript_AskRetireChallenge:: @ 824
BattleFrontier_BattleTowerMultiBattleRoom_EventScript_ContinueChallenge:: @ 8249283
closemessage
clearflag FLAG_TEMP_2
- applymovement 5, BattleFrontier_BattleTowerMultiBattleRoom_Movement_FaceBattle
- applymovement 6, BattleFrontier_BattleTowerMultiBattleRoom_Movement_FaceBattle
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleTowerMultiBattleRoom_Movement_FaceBattle
+ applymovement LOCALID_PARTNER, BattleFrontier_BattleTowerMultiBattleRoom_Movement_FaceBattle
waitmovement 0
- applymovement 2, BattleFrontier_BattleTowerMultiBattleRoom_Movement_AttendantReturnToPos
- applymovement 3, BattleFrontier_BattleTowerMultiBattleRoom_Movement_AttendantReturnToPos
+ applymovement LOCALID_ATTENDANT_1, BattleFrontier_BattleTowerMultiBattleRoom_Movement_AttendantReturnToPos
+ applymovement LOCALID_ATTENDANT_2, BattleFrontier_BattleTowerMultiBattleRoom_Movement_AttendantReturnToPos
waitmovement 0
goto BattleFrontier_BattleTowerMultiBattleRoom_EventScript_OpponentsEnter
end
@@ -208,7 +215,7 @@ BattleFrontier_BattleTowerMultiBattleRoom_EventScript_ContinueChallenge:: @ 8249
BattleFrontier_BattleTowerMultiBattleRoom_EventScript_WarpToLobbyWon:: @ 82492AF
frontier_set FRONTIER_DATA_CHALLENGE_STATUS, CHALLENGE_STATUS_WON
tower_set TOWER_DATA_LVL_MODE
- setvar VAR_0x8004, 3
+ setvar VAR_0x8004, FANCOUNTER_USED_BATTLE_TOWER
special Script_TryGainNewFanFromCounter
goto BattleFrontier_BattleTowerBattleRoom_EventScript_WarpToLobby
diff --git a/data/maps/BattleFrontier_BattleTowerMultiCorridor/scripts.inc b/data/maps/BattleFrontier_BattleTowerMultiCorridor/scripts.inc
index 532347ea9..5e496527e 100644
--- a/data/maps/BattleFrontier_BattleTowerMultiCorridor/scripts.inc
+++ b/data/maps/BattleFrontier_BattleTowerMultiCorridor/scripts.inc
@@ -1,3 +1,8 @@
+.set LOCALID_PLAYER, 1
+.set LOCALID_ATTENDANT_1, 2
+.set LOCALID_ATTENDANT_2, 3
+.set LOCALID_PARTNER, 4
+
BattleFrontier_BattleTowerMultiCorridor_MapScripts:: @ 8248D4A
map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_BattleTowerMultiCorridor_OnTransition
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, BattleFrontier_BattleTowerMultiCorridor_OnWarp
@@ -5,8 +10,8 @@ BattleFrontier_BattleTowerMultiCorridor_MapScripts:: @ 8248D4A
.byte 0
@ On this map the player (OBJ_EVENT_ID_PLAYER) is hidden
- @ The player is represented instead by object event 1, which has the gfx id VAR_OBJ_GFX_ID_F
- @ The multi partner is represented by object event 4, which has the gfx id VAR_OBJ_GFX_ID_E
+ @ The player is represented instead by LOCALID_PLAYER, and has the gfx id VAR_OBJ_GFX_ID_F
+ @ The multi partner is represented by LOCALID_PARTNER, and has the gfx id VAR_OBJ_GFX_ID_E
BattleFrontier_BattleTowerMultiCorridor_OnTransition: @ 8248D5A
compare VAR_FRONTIER_BATTLE_MODE, FRONTIER_MODE_MULTIS
@@ -37,8 +42,8 @@ BattleFrontier_BattleTowerMultiCorridor_OnWarp: @ 8248D95
BattleFrontier_BattleTowerMultiCorridor_EventScript_SetUpObjects:: @ 8248D9F
hideobjectat OBJ_EVENT_ID_PLAYER, MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_CORRIDOR
- hideobjectat 1, MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_CORRIDOR
- hideobjectat 4, MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_CORRIDOR
+ hideobjectat LOCALID_PLAYER, MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_CORRIDOR
+ hideobjectat LOCALID_PARTNER, MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_CORRIDOR
special OffsetCameraForBattle
end
@@ -54,10 +59,10 @@ BattleFrontier_BattleTowerMultiCorridor_EventScript_EnterCorridor:: @ 8248DBC
opendoor 1, 1
waitdooranim
clearflag FLAG_ENABLE_MULTI_CORRIDOR_DOOR
- showobjectat 1, MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_CORRIDOR
- showobjectat 4, MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_CORRIDOR
- applymovement 1, BattleFrontier_BattleTowerMultiCorridor_Movement_ExitElevator
- applymovement 4, BattleFrontier_BattleTowerMultiCorridor_Movement_ExitElevator
+ showobjectat LOCALID_PLAYER, MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_CORRIDOR
+ showobjectat LOCALID_PARTNER, MAP_BATTLE_FRONTIER_BATTLE_TOWER_MULTI_CORRIDOR
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleTowerMultiCorridor_Movement_ExitElevator
+ applymovement LOCALID_PARTNER, BattleFrontier_BattleTowerMultiCorridor_Movement_ExitElevator
waitmovement 0
setflag FLAG_ENABLE_MULTI_CORRIDOR_DOOR
setvar VAR_0x8004, 14 @ x coord of far door, used by DrawDoor
@@ -65,21 +70,21 @@ BattleFrontier_BattleTowerMultiCorridor_EventScript_EnterCorridor:: @ 8248DBC
closedoor 1, 1
waitdooranim
clearflag FLAG_ENABLE_MULTI_CORRIDOR_DOOR
- applymovement 1, BattleFrontier_BattleTowerMultiCorridor_Movement_PlayerWalkToDoor
- applymovement 4, BattleFrontier_BattleTowerMultiCorridor_Movement_PartnerWalkToDoor
- applymovement 3, BattleFrontier_BattleTowerMultiCorridor_Movement_PlayerAttendantWalkToDoor
- applymovement 2, BattleFrontier_BattleTowerMultiCorridor_Movement_PartnerAttendantWalkToDoor
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleTowerMultiCorridor_Movement_PlayerWalkToDoor
+ applymovement LOCALID_PARTNER, BattleFrontier_BattleTowerMultiCorridor_Movement_PartnerWalkToDoor
+ applymovement LOCALID_ATTENDANT_2, BattleFrontier_BattleTowerMultiCorridor_Movement_PlayerAttendantWalkToDoor
+ applymovement LOCALID_ATTENDANT_1, BattleFrontier_BattleTowerMultiCorridor_Movement_PartnerAttendantWalkToDoor
waitmovement 0
delay 40
- applymovement 3, Common_Movement_WalkInPlaceFastestUp
- applymovement 2, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_ATTENDANT_2, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_ATTENDANT_1, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
opendoor 7, 1
waitdooranim
- applymovement 3, BattleFrontier_BattleTowerMultiCorridor_Movement_AttendantEnterDoor
- applymovement 2, BattleFrontier_BattleTowerMultiCorridor_Movement_AttendantEnterDoor
- applymovement 1, BattleFrontier_BattleTowerMultiCorridor_Movement_TrainerEnterDoor
- applymovement 4, BattleFrontier_BattleTowerMultiCorridor_Movement_TrainerEnterDoor
+ applymovement LOCALID_ATTENDANT_2, BattleFrontier_BattleTowerMultiCorridor_Movement_AttendantEnterDoor
+ applymovement LOCALID_ATTENDANT_1, BattleFrontier_BattleTowerMultiCorridor_Movement_AttendantEnterDoor
+ applymovement LOCALID_PLAYER, BattleFrontier_BattleTowerMultiCorridor_Movement_TrainerEnterDoor
+ applymovement LOCALID_PARTNER, BattleFrontier_BattleTowerMultiCorridor_Movement_TrainerEnterDoor
waitmovement 0
closedoor 7, 1
waitdooranim
diff --git a/data/maps/BattleFrontier_BattleTowerMultiPartnerRoom/scripts.inc b/data/maps/BattleFrontier_BattleTowerMultiPartnerRoom/scripts.inc
index 77b9d1cd0..71487225c 100644
--- a/data/maps/BattleFrontier_BattleTowerMultiPartnerRoom/scripts.inc
+++ b/data/maps/BattleFrontier_BattleTowerMultiPartnerRoom/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
BattleFrontier_BattleTowerMultiPartnerRoom_MapScripts:: @ 8243D92
map_script MAP_SCRIPT_ON_RESUME, BattleFrontier_BattleTowerMultiPartnerRoom_OnResume
map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_BattleTowerMultiPartnerRoom_OnTransition
@@ -33,7 +35,7 @@ BattleFrontier_BattleTowerMultiPartnerRoom_EventScript_ChosePartner:: @ 8243DDA
setvar VAR_OBJ_GFX_ID_7, OBJ_EVENT_GFX_BOY_1
setvar VAR_TEMP_1, 1
setvar VAR_TEMP_3, 1
- setobjectxyperm 1, 10, 2
+ setobjectxyperm LOCALID_ATTENDANT, 10, 2
end
BattleFrontier_BattleTowerMultiPartnerRoom_OnWarp: @ 8243E14
@@ -59,9 +61,9 @@ BattleFrontier_BattleTowerMultiPartnerRoom_EventScript_EnterRoom:: @ 8243E41
lockall
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleTowerMultiPartnerRoom_Movement_PlayerEnterRoom
waitmovement 0
- applymovement 1, BattleFrontier_BattleTowerMultiPartnerRoom_Movement_AttendantBlockExit
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleTowerMultiPartnerRoom_Movement_AttendantBlockExit
waitmovement 0
- copyobjectxytoperm 1
+ copyobjectxytoperm LOCALID_ATTENDANT
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
msgbox BattleFrontier_BattleTowerMultiPartnerRoom_Text_PleaseFindPartner, MSGBOX_DEFAULT
@@ -99,7 +101,7 @@ BattleFrontier_BattleTowerMultiPartnerRoom_EventScript_QuitChallenge:: @ 8243E9D
BattleFrontier_BattleTowerMultiPartnerRoom_EventScript_EnterElevator:: @ 8243EB5
msgbox BattleFrontier_BattleTowerMultiPartnerRoom_Text_ThankYouForChoosingPartner, MSGBOX_DEFAULT
closemessage
- applymovement 1, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_ATTENDANT, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
opendoor 10, 1
waitdooranim
@@ -112,21 +114,21 @@ BattleFrontier_BattleTowerMultiPartnerRoom_EventScript_EnterElevator:: @ 8243EB5
end
BattleFrontier_BattleTowerMultiPartnerRoom_EventScript_MoveToElevator:: @ 8243EE4
- applymovement 1, BattleFrontier_BattleTowerMultiPartnerRoom_Movement_AttendantEnterElevator
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleTowerMultiPartnerRoom_Movement_AttendantEnterElevator
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleTowerMultiPartnerRoom_Movement_PlayerEnterElevator
waitmovement 0
return
@ Unused
BattleFrontier_BattleTowerMultiPartnerRoom_EventScript_MoveToElevatorEast: @ 8243EF6
- applymovement 1, BattleFrontier_BattleTowerMultiPartnerRoom_Movement_AttendantEnterElevator
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleTowerMultiPartnerRoom_Movement_AttendantEnterElevator
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleTowerMultiPartnerRoom_Movement_PlayerEnterElevatorEast
waitmovement 0
return
@ Unused
BattleFrontier_BattleTowerMultiPartnerRoom_EventScript_MoveToElevatorWest: @ 8243F08
- applymovement 1, BattleFrontier_BattleTowerMultiPartnerRoom_Movement_AttendantEnterElevator
+ applymovement LOCALID_ATTENDANT, BattleFrontier_BattleTowerMultiPartnerRoom_Movement_AttendantEnterElevator
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleTowerMultiPartnerRoom_Movement_PlayerEneterElevatorWest
waitmovement 0
return
diff --git a/data/maps/BattleFrontier_Mart/scripts.inc b/data/maps/BattleFrontier_Mart/scripts.inc
index e04a2e6d3..4e60e9ce5 100644
--- a/data/maps/BattleFrontier_Mart/scripts.inc
+++ b/data/maps/BattleFrontier_Mart/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_OLD_WOMAN, 2
+
BattleFrontier_Mart_MapScripts:: @ 8267ACB
.byte 0
@@ -36,7 +38,7 @@ BattleFrontier_Mart_EventScript_OldMan:: @ 8267B02
BattleFrontier_Mart_EventScript_OldWoman:: @ 8267B0B
lock
- applymovement 2, Common_Movement_FaceDown
+ applymovement LOCALID_OLD_WOMAN, Common_Movement_FaceDown
waitmovement 0
msgbox BattleFrontier_Mart_Text_ProteinMakeNiceGift, MSGBOX_DEFAULT
release
diff --git a/data/maps/BattleFrontier_OutsideEast/scripts.inc b/data/maps/BattleFrontier_OutsideEast/scripts.inc
index ebfdba916..6995e405e 100644
--- a/data/maps/BattleFrontier_OutsideEast/scripts.inc
+++ b/data/maps/BattleFrontier_OutsideEast/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_SUDOWOODO, 14
+
BattleFrontier_OutsideEast_MapScripts:: @ 8242C04
map_script MAP_SCRIPT_ON_RESUME, BattleFrontier_OutsideEast_OnResume
map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_OutsideEast_OnTransition
@@ -106,8 +108,8 @@ BattleFrontier_OutsideEast_EventScript_Sudowoodo:: @ 8242CEA
lock
faceplayer
waitse
- playse 269
- applymovement 14, BattleFrontier_OutsideEast_Movement_SudowoodoShake
+ playse SE_USSOKI
+ applymovement LOCALID_SUDOWOODO, BattleFrontier_OutsideEast_Movement_SudowoodoShake
waitmovement 0
release
end
@@ -119,7 +121,7 @@ BattleFrontier_OutsideEast_EventScript_WaterSudowoodo:: @ 8242CFC
waitstate
waitse
playse SE_USSOKI
- applymovement 14, BattleFrontier_OutsideEast_Movement_SudowoodoShake
+ applymovement LOCALID_SUDOWOODO, BattleFrontier_OutsideEast_Movement_SudowoodoShake
waitmovement 0
msgbox gText_Sudowoodo_Attacked, MSGBOX_DEFAULT
closemessage
@@ -127,7 +129,7 @@ BattleFrontier_OutsideEast_EventScript_WaterSudowoodo:: @ 8242CFC
playmoncry SPECIES_SUDOWOODO, 2
delay 40
waitmoncry
- setvar VAR_LAST_TALKED, 14 @ Sudowoodo object event id
+ setvar VAR_LAST_TALKED, LOCALID_SUDOWOODO
setwildbattle SPECIES_SUDOWOODO, 40, ITEM_NONE
setflag FLAG_SYS_CTRL_OBJ_DELETE
dowildbattle
diff --git a/data/maps/BattleFrontier_OutsideWest/scripts.inc b/data/maps/BattleFrontier_OutsideWest/scripts.inc
index 4fb750023..561b4e86a 100644
--- a/data/maps/BattleFrontier_OutsideWest/scripts.inc
+++ b/data/maps/BattleFrontier_OutsideWest/scripts.inc
@@ -1,3 +1,12 @@
+.set LOCALID_SS_TIDAL, 2
+.set LOCALID_FERRY_ATTENDANT, 3
+.set LOCALID_MANIAC_1, 9
+.set LOCALID_MANIAC_2, 10
+.set LOCALID_GIRL, 12
+.set LOCALID_CAMPER, 14
+.set LOCALID_FISHERMAN_2, 18
+.set LOCALID_MAN_4, 23
+
BattleFrontier_OutsideWest_MapScripts:: @ 823D3E1
map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_OutsideWest_OnTransition
.byte 0
@@ -66,8 +75,8 @@ BattleFrontier_OutsideWest_EventScript_BoardFerry:: @ 823D4BA
applymovement VAR_LAST_TALKED, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
delay 30
- hideobjectat 3, MAP_BATTLE_FRONTIER_OUTSIDE_WEST
- setvar VAR_0x8004, 2
+ hideobjectat LOCALID_FERRY_ATTENDANT, MAP_BATTLE_FRONTIER_OUTSIDE_WEST
+ setvar VAR_0x8004, LOCALID_SS_TIDAL
call Common_EventScript_FerryDepartIsland
return
@@ -107,7 +116,7 @@ BattleFrontier_OutsideWest_EventScript_Fisherman2:: @ 823D518
faceplayer
message BattleFrontier_OutsideWest_Text_GotSeasickOnWayHere
waitmessage
- applymovement 18, Common_Movement_FaceAwayPlayer
+ applymovement LOCALID_FISHERMAN_2, Common_Movement_FaceAwayPlayer
waitmovement 0
waitbuttonpress
release
@@ -128,16 +137,16 @@ BattleFrontier_OutsideWest_EventScript_Maniac2:: @ 823D53D
end
BattleFrontier_OutsideWest_EventScript_FactoryChallengersTalk:: @ 823D544
- applymovement 9, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_MANIAC_1, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
msgbox BattleFrontier_OutsideWest_Text_SureWeCanChallengeWithNoMons, MSGBOX_DEFAULT
- applymovement 10, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_MANIAC_2, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
msgbox BattleFrontier_OutsideWest_Text_BigGuySaidIllLendYouMons, MSGBOX_DEFAULT
closemessage
delay 25
- applymovement 9, Common_Movement_WalkInPlaceFastestUp
- applymovement 10, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_MANIAC_1, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_MANIAC_2, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
release
end
@@ -159,7 +168,7 @@ BattleFrontier_OutsideWest_EventScript_Camper:: @ 823D57F
end
BattleFrontier_OutsideWest_EventScript_CamperFaceFactory:: @ 823D5BA
- applymovement 14, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_CAMPER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
return
@@ -184,22 +193,22 @@ BattleFrontier_OutsideWest_EventScript_Girl:: @ 823D5C6
end
BattleFrontier_OutsideWest_EventScript_GirlShudderNorth:: @ 823D5FD
- applymovement 12, BattleFrontier_OutsideWest_Movement_GirlShudderNorth
+ applymovement LOCALID_GIRL, BattleFrontier_OutsideWest_Movement_GirlShudderNorth
waitmovement 0
return
BattleFrontier_OutsideWest_EventScript_GirlShudderSouth:: @ 823D608
- applymovement 12, BattleFrontier_OutsideWest_Movement_GirlShudderSouth
+ applymovement LOCALID_GIRL, BattleFrontier_OutsideWest_Movement_GirlShudderSouth
waitmovement 0
return
BattleFrontier_OutsideWest_EventScript_GirlShudderWest:: @ 823D613
- applymovement 12, BattleFrontier_OutsideWest_Movement_GirlShudderWest
+ applymovement LOCALID_GIRL, BattleFrontier_OutsideWest_Movement_GirlShudderWest
waitmovement 0
return
BattleFrontier_OutsideWest_EventScript_GirlShudderEast:: @ 823D61E
- applymovement 12, BattleFrontier_OutsideWest_Movement_GirlShudderEast
+ applymovement LOCALID_GIRL, BattleFrontier_OutsideWest_Movement_GirlShudderEast
waitmovement 0
return
@@ -301,7 +310,7 @@ BattleFrontier_OutsideWest_EventScript_Man4:: @ 823D6D7
faceplayer
msgbox BattleFrontier_OutsideWest_Text_FansOverThereUsedToBeTrainers, MSGBOX_DEFAULT
closemessage
- applymovement 23, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_MAN_4, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
diff --git a/data/maps/BattleFrontier_PokemonCenter_1F/scripts.inc b/data/maps/BattleFrontier_PokemonCenter_1F/scripts.inc
index f77d9ab83..795c3fabe 100644
--- a/data/maps/BattleFrontier_PokemonCenter_1F/scripts.inc
+++ b/data/maps/BattleFrontier_PokemonCenter_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_NURSE, 1
+
BattleFrontier_PokemonCenter_1F_MapScripts:: @ 82678F9
map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_PokemonCenter_1F_OnTransition
map_script MAP_SCRIPT_ON_RESUME, CableClub_OnResume
@@ -7,9 +9,8 @@ BattleFrontier_PokemonCenter_1F_OnTransition: @ 8267904
setrespawn HEAL_LOCATION_BATTLE_FRONTIER_OUTSIDE_EAST
end
-@ VAR_0x800B is the Nurse's object event id
BattleFrontier_PokemonCenter_1F_EventScript_Nurse:: @ 8267908
- setvar VAR_0x800B, 1
+ setvar VAR_0x800B, LOCALID_NURSE
call Common_EventScript_PkmnCenterNurse
waitmessage
waitbuttonpress
diff --git a/data/maps/BattleFrontier_ReceptionGate/scripts.inc b/data/maps/BattleFrontier_ReceptionGate/scripts.inc
index 94fadd69a..495ad165f 100644
--- a/data/maps/BattleFrontier_ReceptionGate/scripts.inc
+++ b/data/maps/BattleFrontier_ReceptionGate/scripts.inc
@@ -1,3 +1,7 @@
+.set LOCALID_GREETER, 1
+.set LOCALID_GUIDE, 2
+.set LOCALID_SCOTT, 4
+
BattleFrontier_ReceptionGate_MapScripts:: @ 82661DA
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_ReceptionGate_OnFrame
map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_ReceptionGate_OnTransition
@@ -15,9 +19,9 @@ BattleFrontier_ReceptionGate_EventScript_FirstTimeEntering:: @ 82661F3
lockall
setvar VAR_HAS_ENTERED_BATTLE_FRONTIER, 1
playse SE_PIN
- applymovement 1, Common_Movement_ExclamationMark
+ applymovement LOCALID_GREETER, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 1, Common_Movement_Delay48
+ applymovement LOCALID_GREETER, Common_Movement_Delay48
waitmovement 0
msgbox BattleFrontier_ReceptionGate_Text_FirstTimeHereThisWay, MSGBOX_DEFAULT
closemessage
@@ -38,27 +42,27 @@ BattleFrontier_ReceptionGate_EventScript_ScottScene:: @ 8266229
msgbox BattleFrontier_ReceptionGate_Text_EnjoyBattleFrontier, MSGBOX_DEFAULT
msgbox BattleFrontier_ReceptionGate_Text_IfItIsntPlayerYouCame, MSGBOX_DEFAULT
closemessage
- applymovement 1, Common_Movement_WalkInPlaceFastestUp
- applymovement 2, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_GREETER, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_GUIDE, Common_Movement_WalkInPlaceFastestUp
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
playse SE_PIN
- applymovement 1, Common_Movement_ExclamationMark
- applymovement 2, Common_Movement_ExclamationMark
+ applymovement LOCALID_GREETER, Common_Movement_ExclamationMark
+ applymovement LOCALID_GUIDE, Common_Movement_ExclamationMark
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_ExclamationMark
waitmovement 0
msgbox BattleFrontier_ReceptionGate_Text_OhMrScottGoodDay, MSGBOX_DEFAULT
closemessage
- applymovement 1, BattleFrontier_ReceptionGate_Movement_GreeterFaceScott
- applymovement 2, BattleFrontier_ReceptionGate_Movement_FacilityGuideFaceScott
+ applymovement LOCALID_GREETER, BattleFrontier_ReceptionGate_Movement_GreeterFaceScott
+ applymovement LOCALID_GUIDE, BattleFrontier_ReceptionGate_Movement_FacilityGuideFaceScott
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_ReceptionGate_Movement_PlayerFaceScott
- applymovement 4, BattleFrontier_ReceptionGate_Movement_ScottEnter
+ applymovement LOCALID_SCOTT, BattleFrontier_ReceptionGate_Movement_ScottEnter
waitmovement 0
msgbox BattleFrontier_ReceptionGate_Text_ScottGreatToSeeYouHere, MSGBOX_DEFAULT
closemessage
- applymovement 4, BattleFrontier_ReceptionGate_Movement_ScottExit
+ applymovement LOCALID_SCOTT, BattleFrontier_ReceptionGate_Movement_ScottExit
waitmovement 0
- removeobject 4
+ removeobject LOCALID_SCOTT
releaseall
end
diff --git a/data/maps/BattleFrontier_ScottsHouse/scripts.inc b/data/maps/BattleFrontier_ScottsHouse/scripts.inc
index e4b0c28e9..ece1577b4 100644
--- a/data/maps/BattleFrontier_ScottsHouse/scripts.inc
+++ b/data/maps/BattleFrontier_ScottsHouse/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_SCOTT, 1
+
BattleFrontier_ScottsHouse_MapScripts:: @ 82636A7
.byte 0
@@ -161,7 +163,7 @@ BattleFrontier_ScottsHouse_EventScript_WelcomeToFrontier:: @ 8263943
compare VAR_FACING, DIR_WEST
call_if_eq BattleFrontier_ScottsHouse_EventScript_ScottFaceAwayWest
msgbox BattleFrontier_ScottsHouse_Text_HowMuchEffortItTookToMakeReal, MSGBOX_DEFAULT
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_SCOTT, Common_Movement_FacePlayer
waitmovement 0
msgbox BattleFrontier_ScottsHouse_Text_HaveThisAsMementoOfOurPathsCrossing, MSGBOX_DEFAULT
compare VAR_SCOTT_STATE, 13
@@ -207,22 +209,22 @@ BattleFrontier_ScottsHouse_EventScript_GiveBattlePoints:: @ 82639F8
end
BattleFrontier_ScottsHouse_EventScript_ScottFaceAwayNorth:: @ 8263A13
- applymovement 1, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_SCOTT, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
return
BattleFrontier_ScottsHouse_EventScript_ScottFaceAwaySouth:: @ 8263A1E
- applymovement 1, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_SCOTT, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
BattleFrontier_ScottsHouse_EventScript_ScottFaceAwayEast:: @ 8263A29
- applymovement 1, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_SCOTT, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
return
BattleFrontier_ScottsHouse_EventScript_ScottFaceAwayWest:: @ 8263A34
- applymovement 1, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_SCOTT, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
return
diff --git a/data/maps/BirthIsland_Exterior/scripts.inc b/data/maps/BirthIsland_Exterior/scripts.inc
index 8cf47bfdb..6bc902426 100644
--- a/data/maps/BirthIsland_Exterior/scripts.inc
+++ b/data/maps/BirthIsland_Exterior/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_DEOXYS_ROCK, 1
+.set LOCALID_DEOXYS, 2
+
BirthIsland_Exterior_MapScripts:: @ 8267F15
map_script MAP_SCRIPT_ON_TRANSITION, BirthIsland_Exterior_OnTransition
map_script MAP_SCRIPT_ON_RESUME, BirthIsland_Exterior_OnResume
@@ -36,7 +39,7 @@ BirthIsland_Exterior_EventScript_TryRemoveDeoxys:: @ 8267F6F
specialvar VAR_RESULT, GetBattleOutcome
compare VAR_RESULT, B_OUTCOME_CAUGHT
goto_if_ne Common_EventScript_NopReturn
- removeobject 2
+ removeobject LOCALID_DEOXYS
return
BirthIsland_Exterior_EventScript_Triangle:: @ 8267F83
@@ -65,20 +68,20 @@ BirthIsland_Exterior_EventScript_NotSolved3:: @ 8267FBF
BirthIsland_Exterior_EventScript_Deoxys:: @ 8267FC1
waitse
- setfieldeffectargument 0, 1
+ setfieldeffectargument 0, LOCALID_DEOXYS_ROCK
setfieldeffectargument 1, 58
setfieldeffectargument 2, 26
dofieldeffect FLDEFF_65
playbgm MUS_RG_DEOEYE, 0
waitfieldeffect FLDEFF_65
- addobject 2
- applymovement 2, BirthIsland_Exterior_Movement_DeoxysApproach
+ addobject LOCALID_DEOXYS
+ applymovement LOCALID_DEOXYS, BirthIsland_Exterior_Movement_DeoxysApproach
waitmovement 0
waitse
playmoncry SPECIES_DEOXYS, 2
delay 40
waitmoncry
- setvar VAR_LAST_TALKED, 2
+ setvar VAR_LAST_TALKED, LOCALID_DEOXYS
setvar VAR_0x8004, SPECIES_DEOXYS
setvar VAR_0x8005, 30 @ level
setvar VAR_0x8006, ITEM_NONE
diff --git a/data/maps/BirthIsland_Harbor/scripts.inc b/data/maps/BirthIsland_Harbor/scripts.inc
index f19b373f5..b9274ee2f 100644
--- a/data/maps/BirthIsland_Harbor/scripts.inc
+++ b/data/maps/BirthIsland_Harbor/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_SAILOR, 1
+.set LOCALID_SS_TIDAL, 2
+
BirthIsland_Harbor_MapScripts:: @ 826805C
.byte 0
@@ -12,8 +15,8 @@ BirthIsland_Harbor_EventScript_Sailor:: @ 826805D
applymovement VAR_LAST_TALKED, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
delay 30
- hideobjectat 1, MAP_BIRTH_ISLAND_HARBOR
- setvar VAR_0x8004, 2
+ hideobjectat LOCALID_SAILOR, MAP_BIRTH_ISLAND_HARBOR
+ setvar VAR_0x8004, LOCALID_SS_TIDAL
call Common_EventScript_FerryDepartIsland
warp MAP_LILYCOVE_CITY_HARBOR, 255, 8, 11
waitstate
diff --git a/data/maps/CaveOfOrigin_B1F/scripts.inc b/data/maps/CaveOfOrigin_B1F/scripts.inc
index 552f3b095..ea8d6cec8 100644
--- a/data/maps/CaveOfOrigin_B1F/scripts.inc
+++ b/data/maps/CaveOfOrigin_B1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_WALLACE, 1
+
CaveOfOrigin_B1F_MapScripts:: @ 82357A8
.byte 0
@@ -6,16 +8,16 @@ CaveOfOrigin_B1F_EventScript_Wallace:: @ 82357A9
faceplayer
msgbox CaveOfOrigin_B1F_Text_WallaceStory, MSGBOX_DEFAULT
closemessage
- applymovement 1, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_WALLACE, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
delay 60
playse SE_PIN
- applymovement 1, Common_Movement_ExclamationMark
+ applymovement LOCALID_WALLACE, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 1, Common_Movement_Delay48
+ applymovement LOCALID_WALLACE, Common_Movement_Delay48
waitmovement 0
delay 30
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_WALLACE, Common_Movement_FacePlayer
waitmovement 0
message CaveOfOrigin_B1F_Text_WhereIsRayquaza
waitmessage
@@ -53,7 +55,7 @@ CaveOfOrigin_B1F_EventScript_AtSkyPillar:: @ 823584D
fadescreenspeed FADE_TO_BLACK, 4
setflag FLAG_WALLACE_GOES_TO_SKY_PILLAR
setvar VAR_SOOTOPOLIS_CITY_STATE, 3
- removeobject 1
+ removeobject LOCALID_WALLACE
clearflag FLAG_HIDE_SKY_PILLAR_WALLACE
fadescreen FADE_FROM_BLACK
release
diff --git a/data/maps/DesertUnderpass/scripts.inc b/data/maps/DesertUnderpass/scripts.inc
index bba7dfe08..7025a268b 100644
--- a/data/maps/DesertUnderpass/scripts.inc
+++ b/data/maps/DesertUnderpass/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_FOSSIL, 1
+
DesertUnderpass_MapScripts:: @ 823AF37
map_script MAP_SCRIPT_ON_TRANSITION, DesertUnderpass_OnTransition
.byte 0
@@ -16,13 +18,13 @@ DesertUnderpass_EventScript_Fossil:: @ 823AF41
DesertUnderpass_EventScript_GiveClawFossil:: @ 823AF57
giveitem ITEM_CLAW_FOSSIL
- removeobject 1
+ removeobject LOCALID_FOSSIL
release
end
DesertUnderpass_EventScript_GiveRootFossil:: @ 823AF68
giveitem ITEM_ROOT_FOSSIL
- removeobject 1
+ removeobject LOCALID_FOSSIL
release
end
diff --git a/data/maps/DewfordTown/scripts.inc b/data/maps/DewfordTown/scripts.inc
index 6682d8cdb..f6d06bea7 100644
--- a/data/maps/DewfordTown/scripts.inc
+++ b/data/maps/DewfordTown/scripts.inc
@@ -1,3 +1,15 @@
+@ Sailing to and from Dewford uses local IDs from different maps
+@ e.g. Route 104's sail to Dewford script references local IDs from Dewford's map
+@ All of these local IDs are labeled here
+.equ LOCALID_BRINEY_DEWFORD, 2
+.equ LOCALID_BOAT_DEWFORD, 4
+
+.equ LOCALID_BOAT_R109, 1
+.equ LOCALID_BRINEY_R109, 2
+
+.equ LOCALID_BOAT_R104, 7
+.equ LOCALID_BRINEY_R104, 8
+
DewfordTown_MapScripts:: @ 81E9507
map_script MAP_SCRIPT_ON_TRANSITION, DewfordTown_OnTransition
.byte 0
@@ -116,16 +128,16 @@ DewfordTown_EventScript_FishingNotSoGood:: @ 81E9656
DewfordTown_EventScript_SailToPetalburg:: @ 81E9660
call EventScript_BackupMrBrineyLocation
- setobjectpriority 2, MAP_DEWFORD_TOWN, 0
+ setobjectpriority LOCALID_BRINEY_DEWFORD, MAP_DEWFORD_TOWN, 0
setobjectpriority OBJ_EVENT_ID_PLAYER, MAP_DEWFORD_TOWN, 0
- applymovement 2, DewfordTown_Movement_BrineyBoardBoat
+ applymovement LOCALID_BRINEY_DEWFORD, DewfordTown_Movement_BrineyBoardBoat
waitmovement 0
- removeobject 2
+ removeobject LOCALID_BRINEY_DEWFORD
applymovement OBJ_EVENT_ID_PLAYER, DewfordTown_Movement_PlayerBoardBoat
waitmovement 0
hideobjectat OBJ_EVENT_ID_PLAYER, MAP_DEWFORD_TOWN
call Common_EventScript_PlayBrineysBoatMusic
- applymovement 4, DewfordTown_Movement_SailToPetalburg
+ applymovement LOCALID_BOAT_DEWFORD, DewfordTown_Movement_SailToPetalburg
applymovement OBJ_EVENT_ID_PLAYER, DewfordTown_Movement_SailToPetalburg
waitmovement 0
showobjectat OBJ_EVENT_ID_PLAYER, MAP_ROUTE104
@@ -137,7 +149,7 @@ DewfordTown_EventScript_SailToPetalburg:: @ 81E9660
clearflag FLAG_HIDE_BRINEYS_HOUSE_PEEKO
clearflag FLAG_HIDE_ROUTE_104_MR_BRINEY_BOAT
setflag FLAG_HIDE_MR_BRINEY_BOAT_DEWFORD_TOWN
- hideobjectat 4, MAP_DEWFORD_TOWN
+ hideobjectat LOCALID_BOAT_DEWFORD, MAP_DEWFORD_TOWN
setvar VAR_BOARD_BRINEY_BOAT_STATE, 2
resetobjectpriority OBJ_EVENT_ID_PLAYER, MAP_DEWFORD_TOWN
warp MAP_ROUTE104_MR_BRINEYS_HOUSE, 255, 5, 4
@@ -148,39 +160,39 @@ DewfordTown_EventScript_SailToPetalburg:: @ 81E9660
DewfordTown_EventScript_SailToSlateport:: @ 81E96E7
call EventScript_BackupMrBrineyLocation
- setobjectpriority 2, MAP_DEWFORD_TOWN, 0
+ setobjectpriority LOCALID_BRINEY_DEWFORD, MAP_DEWFORD_TOWN, 0
setobjectpriority OBJ_EVENT_ID_PLAYER, MAP_DEWFORD_TOWN, 1
- applymovement 2, DewfordTown_Movement_BrineyBoardBoat
+ applymovement LOCALID_BRINEY_DEWFORD, DewfordTown_Movement_BrineyBoardBoat
waitmovement 0
- removeobject 2
+ removeobject LOCALID_BRINEY_DEWFORD
applymovement OBJ_EVENT_ID_PLAYER, DewfordTown_Movement_PlayerBoardBoat
waitmovement 0
hideobjectat OBJ_EVENT_ID_PLAYER, MAP_DEWFORD_TOWN
call Common_EventScript_PlayBrineysBoatMusic
- applymovement 4, DewfordTown_Movement_SailToSlateport
+ applymovement LOCALID_BOAT_DEWFORD, DewfordTown_Movement_SailToSlateport
applymovement OBJ_EVENT_ID_PLAYER, DewfordTown_Movement_SailToSlateport
waitmovement 0
call Common_EventScript_StopBrineysBoatMusic
showobjectat OBJ_EVENT_ID_PLAYER, MAP_ROUTE109
applymovement OBJ_EVENT_ID_PLAYER, DewfordTown_Movement_ExitBoatSlateport
waitmovement 0
- setobjectxyperm 2, 21, 26
- addobject 2
- setobjectpriority 2, MAP_ROUTE109, 0
- applymovement 2, DewfordTown_Movement_BrineyExitBoat
+ setobjectxyperm LOCALID_BRINEY_R109, 21, 26
+ addobject LOCALID_BRINEY_R109
+ setobjectpriority LOCALID_BRINEY_R109, MAP_ROUTE109, 0
+ applymovement LOCALID_BRINEY_R109, DewfordTown_Movement_BrineyExitBoat
waitmovement 0
clearflag FLAG_HIDE_ROUTE_109_MR_BRINEY
- addobject 1
+ addobject LOCALID_BOAT_R109
clearflag FLAG_HIDE_ROUTE_109_MR_BRINEY_BOAT
setflag FLAG_HIDE_MR_BRINEY_BOAT_DEWFORD_TOWN
- hideobjectat 4, MAP_DEWFORD_TOWN
+ hideobjectat LOCALID_BOAT_DEWFORD, MAP_DEWFORD_TOWN
call_if_unset FLAG_DELIVERED_DEVON_GOODS, DewfordTown_EventScript_LandedSlateportDeliverGoods
call_if_set FLAG_DELIVERED_DEVON_GOODS, DewfordTown_EventScript_LandedSlateport
closemessage
copyvar VAR_BRINEY_LOCATION, VAR_0x8008
resetobjectpriority OBJ_EVENT_ID_PLAYER, MAP_DEWFORD_TOWN
- resetobjectpriority 2, MAP_ROUTE109
- copyobjectxytoperm 2
+ resetobjectpriority LOCALID_BRINEY_R109, MAP_ROUTE109
+ copyobjectxytoperm LOCALID_BRINEY_R109
release
end
diff --git a/data/maps/DewfordTown_Hall/scripts.inc b/data/maps/DewfordTown_Hall/scripts.inc
index e63f1b24e..72db32317 100644
--- a/data/maps/DewfordTown_Hall/scripts.inc
+++ b/data/maps/DewfordTown_Hall/scripts.inc
@@ -1,3 +1,8 @@
+.set LOCALID_EXPERT_M, 4
+.set LOCALID_TWIN, 5
+.set LOCALID_SCHOOL_KID_M, 7
+.set LOCALID_PSYCHIC_M, 8
+
DewfordTown_Hall_MapScripts:: @ 81FD4CF
.byte 0
@@ -53,7 +58,7 @@ DewfordTown_Hall_EventScript_ExpertM:: @ 81FD547
call Common_EventScript_BufferTrendyPhrase
msgbox DewfordTown_Hall_Text_TVShowAboutTrend, MSGBOX_DEFAULT
closemessage
- applymovement 4, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_EXPERT_M, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
release
end
@@ -64,7 +69,7 @@ DewfordTown_Hall_EventScript_Twin:: @ 81FD563
call Common_EventScript_BufferTrendyPhrase
msgbox DewfordTown_Hall_Text_IsTrendMorePopularAcrossSea, MSGBOX_DEFAULT
closemessage
- applymovement 5, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_TWIN, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
release
end
@@ -189,7 +194,7 @@ DewfordTown_Hall_EventScript_DontMovePlayer1:: @ 81FD739
return
DewfordTown_Hall_EventScript_DebateReact1:: @ 81FD73A
- applymovement 8, DewfordTown_Hall_Movement_PsychicWalkInPlaceLeft
+ applymovement LOCALID_PSYCHIC_M, DewfordTown_Hall_Movement_PsychicWalkInPlaceLeft
waitmovement 0
compare VAR_0x8008, 0
goto_if_eq DewfordTown_Hall_EventScript_PlayerReactWest
@@ -208,7 +213,7 @@ DewfordTown_Hall_EventScript_DontMovePlayer2:: @ 81FD771
return
DewfordTown_Hall_EventScript_DebateReact2:: @ 81FD772
- applymovement 7, DewfordTown_Hall_Movement_SchoolKidWalkInPlaceRight
+ applymovement LOCALID_SCHOOL_KID_M, DewfordTown_Hall_Movement_SchoolKidWalkInPlaceRight
waitmovement 0
compare VAR_0x8008, 0
goto_if_eq DewfordTown_Hall_EventScript_PlayerReactNorthSouth
diff --git a/data/maps/DewfordTown_PokemonCenter_1F/scripts.inc b/data/maps/DewfordTown_PokemonCenter_1F/scripts.inc
index 99d180d8f..9873c9e7a 100644
--- a/data/maps/DewfordTown_PokemonCenter_1F/scripts.inc
+++ b/data/maps/DewfordTown_PokemonCenter_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_NURSE, 1
+
DewfordTown_PokemonCenter_1F_MapScripts:: @ 81FC523
map_script MAP_SCRIPT_ON_TRANSITION, DewfordTown_PokemonCenter_1F_OnTransition
map_script MAP_SCRIPT_ON_RESUME, CableClub_OnResume
@@ -8,9 +10,8 @@ DewfordTown_PokemonCenter_1F_OnTransition: @ 81FC52E
call Common_EventScript_UpdateBrineyLocation
end
-@ VAR_0x800B is the Nurse's object event id
DewfordTown_PokemonCenter_1F_EventScript_Nurse:: @ 81FC537
- setvar VAR_0x800B, 1
+ setvar VAR_0x800B, LOCALID_NURSE
call Common_EventScript_PkmnCenterNurse
waitmessage
waitbuttonpress
diff --git a/data/maps/EverGrandeCity_ChampionsRoom/scripts.inc b/data/maps/EverGrandeCity_ChampionsRoom/scripts.inc
index 4ea20827a..5ef3a946e 100644
--- a/data/maps/EverGrandeCity_ChampionsRoom/scripts.inc
+++ b/data/maps/EverGrandeCity_ChampionsRoom/scripts.inc
@@ -1,3 +1,7 @@
+.set LOCALID_WALLACE, 1
+.set LOCALID_RIVAL, 2
+.set LOCALID_BIRCH, 3
+
EverGrandeCity_ChampionsRoom_MapScripts:: @ 82289EF
map_script MAP_SCRIPT_ON_TRANSITION, EverGrandeCity_ChampionsRoom_OnTransition
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, EverGrandeCity_ChampionsRoom_OnWarp
@@ -57,7 +61,7 @@ EverGrandeCity_ChampionsRoom_EventScript_Defeated:: @ 8228A61
call_if_eq EverGrandeCity_ChampionsRoom_EventScript_PlayMayMusic
compare VAR_RESULT, FEMALE
call_if_eq EverGrandeCity_ChampionsRoom_EventScript_PlayBrendanMusic
- addobject 2
+ addobject LOCALID_RIVAL
call EverGrandeCity_ChampionsRoom_EventScript_RivalApproachPlayer
checkplayergender
compare VAR_RESULT, MALE
@@ -78,9 +82,9 @@ EverGrandeCity_ChampionsRoom_EventScript_MayAdvice:: @ 8228AC6
msgbox EverGrandeCity_ChampionsRoom_Text_MayAdvice, MSGBOX_DEFAULT
delay 40
playse SE_PIN
- applymovement 2, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 2, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
call EverGrandeCity_ChampionsRoom_EventScript_RivalLookBackAndForth
msgbox EverGrandeCity_ChampionsRoom_Text_MayItsAlreadyOver, MSGBOX_DEFAULT
@@ -91,9 +95,9 @@ EverGrandeCity_ChampionsRoom_EventScript_BrendanAdvice:: @ 8228AFB
msgbox EverGrandeCity_ChampionsRoom_Text_BrendanAdvice, MSGBOX_DEFAULT
delay 40
playse SE_PIN
- applymovement 2, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 2, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
call EverGrandeCity_ChampionsRoom_EventScript_RivalLookBackAndForth
msgbox EverGrandeCity_ChampionsRoom_Text_BrendanYouveWon, MSGBOX_DEFAULT
@@ -102,26 +106,26 @@ EverGrandeCity_ChampionsRoom_EventScript_BrendanAdvice:: @ 8228AFB
EverGrandeCity_ChampionsRoom_EventScript_BirchArrivesExitForHoF:: @ 8228B30
closemessage
- addobject 3
- applymovement 3, EverGrandeCity_ChampionsRoom_Movement_BirchArrives
+ addobject LOCALID_BIRCH
+ applymovement LOCALID_BIRCH, EverGrandeCity_ChampionsRoom_Movement_BirchArrives
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
msgbox EverGrandeCity_ChampionsRoom_Text_BirchArriveRatePokedex, MSGBOX_DEFAULT
call ProfBirch_EventScript_RatePokedex
msgbox EverGrandeCity_ChampionsRoom_Text_BirchCongratulations, MSGBOX_DEFAULT
- applymovement 1, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_WALLACE, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
delay 20
- applymovement 1, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_WALLACE, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
msgbox EverGrandeCity_ChampionsRoom_Text_WallaceComeWithMe, MSGBOX_DEFAULT
closemessage
delay 30
- applymovement 1, EverGrandeCity_ChampionsRoom_Movement_WallaceExitStart
+ applymovement LOCALID_WALLACE, EverGrandeCity_ChampionsRoom_Movement_WallaceExitStart
applymovement OBJ_EVENT_ID_PLAYER, EverGrandeCity_ChampionsRoom_Movement_PlayerExitStart
- applymovement 3, Common_Movement_WalkInPlaceFastestUp
- applymovement 2, EverGrandeCity_ChampionsRoom_Movement_RivalFollows
+ applymovement LOCALID_BIRCH, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_RIVAL, EverGrandeCity_ChampionsRoom_Movement_RivalFollows
waitmovement 0
delay 20
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestDown
@@ -133,7 +137,7 @@ EverGrandeCity_ChampionsRoom_EventScript_BirchArrivesExitForHoF:: @ 8228B30
compare VAR_RESULT, FEMALE
call_if_eq EverGrandeCity_ChampionsRoom_EventScript_BrendanCongratulations
closemessage
- applymovement 1, EverGrandeCity_ChampionsRoom_Movement_WallaceExit
+ applymovement LOCALID_WALLACE, EverGrandeCity_ChampionsRoom_Movement_WallaceExit
applymovement OBJ_EVENT_ID_PLAYER, EverGrandeCity_ChampionsRoom_Movement_PlayerExit
waitmovement 0
setflag FLAG_HIDE_PETALBURG_GYM_GREETER
@@ -151,14 +155,14 @@ EverGrandeCity_ChampionsRoom_EventScript_BrendanCongratulations:: @ 8228BF4
return
EverGrandeCity_ChampionsRoom_EventScript_RivalApproachPlayer:: @ 8228BFD
- applymovement 2, EverGrandeCity_ChampionsRoom_Movement_RivalApproachPlayer
+ applymovement LOCALID_RIVAL, EverGrandeCity_ChampionsRoom_Movement_RivalApproachPlayer
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
return
EverGrandeCity_ChampionsRoom_EventScript_RivalLookBackAndForth:: @ 8228C12
- applymovement 2, EverGrandeCity_ChampionsRoom_Movement_RivalLookBackAndForth
+ applymovement LOCALID_RIVAL, EverGrandeCity_ChampionsRoom_Movement_RivalLookBackAndForth
waitmovement 0
return
diff --git a/data/maps/EverGrandeCity_DrakesRoom/scripts.inc b/data/maps/EverGrandeCity_DrakesRoom/scripts.inc
index 2ae78caad..b9debf676 100644
--- a/data/maps/EverGrandeCity_DrakesRoom/scripts.inc
+++ b/data/maps/EverGrandeCity_DrakesRoom/scripts.inc
@@ -54,7 +54,7 @@ EverGrandeCity_DrakesRoom_EventScript_PostBattleSpeech:: @ 822871A
end
EverGrandeCity_DrakesRoom_EventScript_Defeated:: @ 8228724
- setvar VAR_0x8004, 0
+ setvar VAR_0x8004, FANCOUNTER_DEFEATED_DRAKE
special Script_TryGainNewFanFromCounter
setflag FLAG_DEFEATED_ELITE_4_DRAKE
call PokemonLeague_EliteFour_SetAdvanceToNextRoomMetatiles
diff --git a/data/maps/EverGrandeCity_HallOfFame/scripts.inc b/data/maps/EverGrandeCity_HallOfFame/scripts.inc
index b377271ad..c6281a684 100644
--- a/data/maps/EverGrandeCity_HallOfFame/scripts.inc
+++ b/data/maps/EverGrandeCity_HallOfFame/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_WALLACE, 1
+
EverGrandeCity_HallOfFame_MapScripts:: @ 822982C
map_script MAP_SCRIPT_ON_FRAME_TABLE, EverGrandeCity_HallOfFame_OnFrame
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, EverGrandeCity_HallOfFame_OnWarp
@@ -17,24 +19,24 @@ EverGrandeCity_HallOfFame_OnFrame: @ 8229846
EverGrandeCity_HallOfFame_EventScript_EnterHallOfFame:: @ 8229850
lockall
- applymovement 1, EverGrandeCity_HallOfFame_Movement_WalkIntoHallOfFame1
+ applymovement LOCALID_WALLACE, EverGrandeCity_HallOfFame_Movement_WalkIntoHallOfFame1
applymovement OBJ_EVENT_ID_PLAYER, EverGrandeCity_HallOfFame_Movement_WalkIntoHallOfFame1
waitmovement 0
- applymovement 1, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_WALLACE, Common_Movement_WalkInPlaceFastestRight
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
msgbox EverGrandeCity_HallOfFame_Text_HereWeHonorLeagueChampions, MSGBOX_DEFAULT
closemessage
- applymovement 1, EverGrandeCity_HallOfFame_Movement_WalkIntoHallOfFame2
+ applymovement LOCALID_WALLACE, EverGrandeCity_HallOfFame_Movement_WalkIntoHallOfFame2
applymovement OBJ_EVENT_ID_PLAYER, EverGrandeCity_HallOfFame_Movement_WalkIntoHallOfFame2
waitmovement 0
delay 20
- applymovement 1, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_WALLACE, Common_Movement_WalkInPlaceFastestRight
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
msgbox EverGrandeCity_HallOfFame_Text_LetsRecordYouAndYourPartnersNames, MSGBOX_DEFAULT
closemessage
- applymovement 1, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_WALLACE, Common_Movement_WalkInPlaceFastestUp
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
delay 20
diff --git a/data/maps/EverGrandeCity_PokemonCenter_1F/scripts.inc b/data/maps/EverGrandeCity_PokemonCenter_1F/scripts.inc
index 333bffc37..3b6d94249 100644
--- a/data/maps/EverGrandeCity_PokemonCenter_1F/scripts.inc
+++ b/data/maps/EverGrandeCity_PokemonCenter_1F/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_NURSE, 1
+.set LOCALID_SCOTT, 4
+
EverGrandeCity_PokemonCenter_1F_MapScripts:: @ 8229A34
map_script MAP_SCRIPT_ON_TRANSITION, EverGrandeCity_PokemonCenter_1F_OnTransition
map_script MAP_SCRIPT_ON_RESUME, CableClub_OnResume
@@ -13,9 +16,8 @@ EverGrandeCity_PokemonCenter_1F_EventScript_TryShowScott:: @ 8229A4C
clearflag FLAG_HIDE_EVER_GRANDE_POKEMON_CENTER_1F_SCOTT
return
-@ VAR_0x800B is the Nurse's object event id
EverGrandeCity_PokemonCenter_1F_EventScript_Nurse:: @ 8229A59
- setvar VAR_0x800B, 1
+ setvar VAR_0x800B, LOCALID_NURSE
call Common_EventScript_PkmnCenterNurse
waitmessage
waitbuttonpress
@@ -45,17 +47,17 @@ EverGrandeCity_PokemonCenter_1F_EventScript_Scott:: @ 8229A79
setflag FLAG_MET_SCOTT_IN_EVERGRANDE
playse SE_KAIDAN
waitse
- removeobject 4
+ removeobject LOCALID_SCOTT
release
end
EverGrandeCity_PokemonCenter_1F_EventScript_ScottExitNorth:: @ 8229AB6
- applymovement 4, EverGrandeCity_PokemonCenter_1F_Movement_ScottExitNorth
+ applymovement LOCALID_SCOTT, EverGrandeCity_PokemonCenter_1F_Movement_ScottExitNorth
waitmovement 0
return
EverGrandeCity_PokemonCenter_1F_EventScript_ScottExit:: @ 8229AC1
- applymovement 4, EverGrandeCity_PokemonCenter_1F_Movement_ScottExit
+ applymovement LOCALID_SCOTT, EverGrandeCity_PokemonCenter_1F_Movement_ScottExit
waitmovement 0
return
diff --git a/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc b/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc
index c69c28d8b..cf824b8e8 100644
--- a/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc
+++ b/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc
@@ -1,3 +1,7 @@
+.set LOCALID_NURSE, 1
+.set LOCALID_GUARD_1, 3
+.set LOCALID_GUARD_2, 4
+
EverGrandeCity_PokemonLeague_1F_MapScripts:: @ 82295D2
map_script MAP_SCRIPT_ON_TRANSITION, EverGrandeCity_PokemonLeague_1F_OnTransition
map_script MAP_SCRIPT_ON_RESUME, CableClub_OnResume
@@ -10,13 +14,12 @@ EverGrandeCity_PokemonLeague_1F_OnTransition: @ 82295DD
end
EverGrandeCity_PokemonLeague_1F_EventScript_GuardsBlockDoor:: @ 82295ED
- setobjectxyperm 3, 9, 2
- setobjectxyperm 4, 10, 2
+ setobjectxyperm LOCALID_GUARD_1, 9, 2
+ setobjectxyperm LOCALID_GUARD_2, 10, 2
return
-@ VAR_0x800B is the Nurse's object event id
EverGrandeCity_PokemonLeague_1F_EventScript_Nurse:: @ 82295FC
- setvar VAR_0x800B, 1
+ setvar VAR_0x800B, LOCALID_NURSE
call Common_EventScript_PkmnCenterNurse
waitmessage
waitbuttonpress
@@ -61,8 +64,8 @@ EverGrandeCity_PokemonLeague_1F_EventScript_DoorGuard:: @ 8229636
delay 120
goto_if_unset FLAG_BADGE06_GET, EverGrandeCity_PokemonLeague_1F_EventScript_NotAllBadges
closemessage
- applymovement 3, EverGrandeCity_PokemonLeague_1F_Movement_LeftGuardOutOfWay
- applymovement 4, EverGrandeCity_PokemonLeague_1F_Movement_RightGuardOutOfWay
+ applymovement LOCALID_GUARD_1, EverGrandeCity_PokemonLeague_1F_Movement_LeftGuardOutOfWay
+ applymovement LOCALID_GUARD_2, EverGrandeCity_PokemonLeague_1F_Movement_RightGuardOutOfWay
waitmovement 0
delay 10
playfanfare MUS_ME_BACHI
@@ -70,8 +73,8 @@ EverGrandeCity_PokemonLeague_1F_EventScript_DoorGuard:: @ 8229636
waitmessage
waitfanfare
closemessage
- copyobjectxytoperm 3
- copyobjectxytoperm 4
+ copyobjectxytoperm LOCALID_GUARD_1
+ copyobjectxytoperm LOCALID_GUARD_2
setflag FLAG_ENTERED_ELITE_FOUR
releaseall
end
diff --git a/data/maps/FallarborTown_BattleTentBattleRoom/scripts.inc b/data/maps/FallarborTown_BattleTentBattleRoom/scripts.inc
index 439b37f8c..feb8f49e1 100644
--- a/data/maps/FallarborTown_BattleTentBattleRoom/scripts.inc
+++ b/data/maps/FallarborTown_BattleTentBattleRoom/scripts.inc
@@ -1,3 +1,7 @@
+.set LOCALID_PLAYER, 1
+.set LOCALID_ATTENDANT, 2
+.set LOCALID_OPPONENT, 3
+
FallarborTown_BattleTentBattleRoom_MapScripts:: @ 8200899
map_script MAP_SCRIPT_ON_TRANSITION, FallarborTown_BattleTentBattleRoom_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, FallarborTown_BattleTentBattleRoom_OnFrame
@@ -36,18 +40,18 @@ FallarborTown_BattleTentBattleRoom_OnFrame: @ 82008DD
FallarborTown_BattleTentBattleRoom_EventScript_EnterRoom:: @ 82008E7
lockall
- showobjectat 1, MAP_FALLARBOR_TOWN_BATTLE_TENT_BATTLE_ROOM
- applymovement 1, FallarborTown_BattleTentBattleRoom_Movement_PlayerEnter
+ showobjectat LOCALID_PLAYER, MAP_FALLARBOR_TOWN_BATTLE_TENT_BATTLE_ROOM
+ applymovement LOCALID_PLAYER, FallarborTown_BattleTentBattleRoom_Movement_PlayerEnter
waitmovement 0
frontier_get FRONTIER_DATA_BATTLE_NUM
compare VAR_RESULT, 0
goto_if_ne FallarborTown_BattleTentBattleRoom_EventScript_ResumeChallenge
FallarborTown_BattleTentBattleRoom_EventScript_NextOpponentEnter:: @ 820090F
tower_setopponent
- addobject 3
- applymovement 3, FallarborTown_BattleTentBattleRoom_Movement_OpponentEnter
+ addobject LOCALID_OPPONENT
+ applymovement LOCALID_OPPONENT, FallarborTown_BattleTentBattleRoom_Movement_OpponentEnter
waitmovement 0
- applymovement 2, FallarborTown_BattleTentBattleRoom_Movement_AttendantJump
+ applymovement LOCALID_ATTENDANT, FallarborTown_BattleTentBattleRoom_Movement_AttendantJump
playse SE_W187
waitse
waitmovement 0
@@ -58,7 +62,7 @@ FallarborTown_BattleTentBattleRoom_EventScript_NextOpponentEnter:: @ 820090F
call BattleFrontier_BattleArenaBattleRoom_EventScript_DoArenaBattle
switch VAR_RESULT
case 1, FallarborTown_BattleTentBattleRoom_EventScript_DefeatedOpponent
- applymovement 2, FallarborTown_BattleTentBattleRoom_Movement_AttendantJump
+ applymovement LOCALID_ATTENDANT, FallarborTown_BattleTentBattleRoom_Movement_AttendantJump
playse SE_W173
waitse
waitmovement 0
@@ -71,7 +75,7 @@ FallarborTown_BattleTentBattleRoom_EventScript_WarpToLobbyLost:: @ 820097E
waitstate
FallarborTown_BattleTentBattleRoom_EventScript_DefeatedOpponent:: @ 820099C
- applymovement 2, FallarborTown_BattleTentBattleRoom_Movement_AttendantJump
+ applymovement LOCALID_ATTENDANT, FallarborTown_BattleTentBattleRoom_Movement_AttendantJump
playse SE_BAN
waitse
waitmovement 0
@@ -83,12 +87,12 @@ FallarborTown_BattleTentBattleRoom_EventScript_IncrementBattleNum:: @ 82009B3
frontier_set FRONTIER_DATA_BATTLE_NUM, VAR_RESULT
switch VAR_RESULT
case 3, FallarborTown_BattleTentBattleRoom_EventScript_WarpToLobbyWon
- applymovement 3, FallarborTown_BattleTentBattleRoom_Movement_OpponentExit
+ applymovement LOCALID_OPPONENT, FallarborTown_BattleTentBattleRoom_Movement_OpponentExit
waitmovement 0
- removeobject 3
- applymovement 2, FallarborTown_BattleTentBattleRoom_Movement_AttendantApproachPlayer
+ removeobject LOCALID_OPPONENT
+ applymovement LOCALID_ATTENDANT, FallarborTown_BattleTentBattleRoom_Movement_AttendantApproachPlayer
waitmovement 0
- applymovement 1, FallarborTown_BattleTentBattleRoom_Movement_PlayerFaceAttendant
+ applymovement LOCALID_PLAYER, FallarborTown_BattleTentBattleRoom_Movement_PlayerFaceAttendant
waitmovement 0
msgbox BattleFrontier_BattleArenaBattleRoom_Text_MonsWillBeRestored, MSGBOX_DEFAULT
special LoadPlayerParty
@@ -127,9 +131,9 @@ FallarborTown_BattleTentBattleRoom_EventScript_AskRetireChallenge:: @ 8200AA6
FallarborTown_BattleTentBattleRoom_EventScript_ContinueChallenge:: @ 8200AD8
closemessage
- applymovement 2, FallarborTown_BattleTentBattleRoom_Movement_AttendantReturnToPos
+ applymovement LOCALID_ATTENDANT, FallarborTown_BattleTentBattleRoom_Movement_AttendantReturnToPos
waitmovement 0
- applymovement 1, FallarborTown_BattleTentBattleRoom_Movement_PlayerFaceBattle
+ applymovement LOCALID_PLAYER, FallarborTown_BattleTentBattleRoom_Movement_PlayerFaceBattle
waitmovement 0
goto FallarborTown_BattleTentBattleRoom_EventScript_NextOpponentEnter
waitstate
@@ -170,9 +174,9 @@ FallarborTown_BattleTentBattleRoom_EventScript_PauseChallenge:: @ 8200B51
end
FallarborTown_BattleTentBattleRoom_EventScript_ResumeChallenge:: @ 8200B73
- applymovement 2, FallarborTown_BattleTentBattleRoom_Movement_AttendantApproachPlayer
+ applymovement LOCALID_ATTENDANT, FallarborTown_BattleTentBattleRoom_Movement_AttendantApproachPlayer
waitmovement 0
- applymovement 1, FallarborTown_BattleTentBattleRoom_Movement_PlayerFaceAttendant
+ applymovement LOCALID_PLAYER, FallarborTown_BattleTentBattleRoom_Movement_PlayerFaceAttendant
waitmovement 0
goto FallarborTown_BattleTentBattleRoom_EventScript_AskContinueChallenge
end
@@ -237,8 +241,8 @@ FallarborTown_BattleTentBattleRoom_OnWarp: @ 8200BB0
FallarborTown_BattleTentBattleRoom_EventScript_SetUpObjects:: @ 8200BBA
hideobjectat OBJ_EVENT_ID_PLAYER, MAP_FALLARBOR_TOWN_BATTLE_TENT_BATTLE_ROOM
- hideobjectat 1, MAP_FALLARBOR_TOWN_BATTLE_TENT_BATTLE_ROOM
- removeobject 3
+ hideobjectat LOCALID_PLAYER, MAP_FALLARBOR_TOWN_BATTLE_TENT_BATTLE_ROOM
+ removeobject LOCALID_OPPONENT
setvar VAR_TEMP_1, 1
end
diff --git a/data/maps/FallarborTown_BattleTentCorridor/scripts.inc b/data/maps/FallarborTown_BattleTentCorridor/scripts.inc
index 53f5a2b42..89daef9b9 100644
--- a/data/maps/FallarborTown_BattleTentCorridor/scripts.inc
+++ b/data/maps/FallarborTown_BattleTentCorridor/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
FallarborTown_BattleTentCorridor_MapScripts:: @ 82006A7
map_script MAP_SCRIPT_ON_FRAME_TABLE, FallarborTown_BattleTentCorridor_OnFrame
.byte 0
@@ -9,12 +11,12 @@ FallarborTown_BattleTentCorridor_OnFrame: @ 82006AD
FallarborTown_BattleTentCorridor_EventScript_EnterCorridor:: @ 82006B7
lockall
setvar VAR_TEMP_0, 1
- applymovement 1, FallarborTown_BattleTentCorridor_Movement_WalkToDoor
+ applymovement LOCALID_ATTENDANT, FallarborTown_BattleTentCorridor_Movement_WalkToDoor
applymovement OBJ_EVENT_ID_PLAYER, FallarborTown_BattleTentCorridor_Movement_WalkToDoor
waitmovement 0
opendoor 2, 1
waitdooranim
- applymovement 1, FallarborTown_BattleTentCorridor_Movement_AttendantEnterDoor
+ applymovement LOCALID_ATTENDANT, FallarborTown_BattleTentCorridor_Movement_AttendantEnterDoor
applymovement OBJ_EVENT_ID_PLAYER, FallarborTown_BattleTentCorridor_Movement_PlayerEnterDoor
waitmovement 0
closedoor 2, 1
diff --git a/data/maps/FallarborTown_BattleTentLobby/scripts.inc b/data/maps/FallarborTown_BattleTentLobby/scripts.inc
index cfcffa9ca..54248e402 100644
--- a/data/maps/FallarborTown_BattleTentLobby/scripts.inc
+++ b/data/maps/FallarborTown_BattleTentLobby/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
FallarborTown_BattleTentLobby_MapScripts:: @ 81FFE66
map_script MAP_SCRIPT_ON_FRAME_TABLE, FallarborTown_BattleTentLobby_OnFrame
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, FallarborTown_BattleTentLobby_OnWarp
@@ -193,12 +195,12 @@ FallarborTown_BattleTentLobby_EventScript_EndCancelChallenge:: @ 82001CD
end
FallarborTown_BattleTentLobby_EventScript_WalkToDoor:: @ 82001CF
- applymovement 1, FallarborTown_BattleTentLobby_Movement_AttendantWalkToDoor
+ applymovement LOCALID_ATTENDANT, FallarborTown_BattleTentLobby_Movement_AttendantWalkToDoor
applymovement OBJ_EVENT_ID_PLAYER, FallarborTown_BattleTentLobby_Movement_PlayerWalkToDoor
waitmovement 0
opendoor 6, 1
waitdooranim
- applymovement 1, FallarborTown_BattleTentLobby_Movement_AttendantEnterDoor
+ applymovement LOCALID_ATTENDANT, FallarborTown_BattleTentLobby_Movement_AttendantEnterDoor
applymovement OBJ_EVENT_ID_PLAYER, FallarborTown_BattleTentLobby_Movement_PlayerEnterDoor
waitmovement 0
closedoor 6, 1
diff --git a/data/maps/FallarborTown_MoveRelearnersHouse/scripts.inc b/data/maps/FallarborTown_MoveRelearnersHouse/scripts.inc
index ac0f42f20..780901c42 100644
--- a/data/maps/FallarborTown_MoveRelearnersHouse/scripts.inc
+++ b/data/maps/FallarborTown_MoveRelearnersHouse/scripts.inc
@@ -1,9 +1,11 @@
+.set LOCALID_MOVE_RELEARNER, 1
+
FallarborTown_MoveRelearnersHouse_MapScripts:: @ 8201382
.byte 0
FallarborTown_MoveRelearnersHouse_EventScript_MoveRelearner:: @ 8201383
lockall
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_MOVE_RELEARNER, Common_Movement_FacePlayer
waitmovement 0
goto_if_set FLAG_TEMP_1, FallarborTown_MoveRelearnersHouse_EventScript_AskTeachMove
msgbox FallarborTown_MoveRelearnersHouse_Text_ImTheMoveTutor, MSGBOX_DEFAULT
@@ -13,7 +15,7 @@ FallarborTown_MoveRelearnersHouse_EventScript_MoveRelearner:: @ 8201383
FallarborTown_MoveRelearnersHouse_EventScript_AskTeachMove:: @ 82013A8
checkitem ITEM_HEART_SCALE, 1
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq FallarborTown_MoveRelearnersHouse_EventScript_ComeBackWithHeartScale
msgbox FallarborTown_MoveRelearnersHouse_Text_ThatsAHeartScaleWantMeToTeachMove, MSGBOX_YESNO
switch VAR_RESULT
diff --git a/data/maps/FallarborTown_PokemonCenter_1F/scripts.inc b/data/maps/FallarborTown_PokemonCenter_1F/scripts.inc
index 70c209ef9..c65cf5d4e 100644
--- a/data/maps/FallarborTown_PokemonCenter_1F/scripts.inc
+++ b/data/maps/FallarborTown_PokemonCenter_1F/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_NURSE, 1
+.set LOCALID_LANETTE, 4
+
FallarborTown_PokemonCenter_1F_MapScripts:: @ 8200BCD
map_script MAP_SCRIPT_ON_TRANSITION, FallarborTown_PokemonCenter_1F_OnTransition
map_script MAP_SCRIPT_ON_RESUME, CableClub_OnResume
@@ -8,9 +11,8 @@ FallarborTown_PokemonCenter_1F_OnTransition: @ 8200BD8
call Common_EventScript_UpdateBrineyLocation
end
-@ VAR_0x800B is the Nurse's object event id
FallarborTown_PokemonCenter_1F_EventScript_Nurse:: @ 8200BE1
- setvar VAR_0x800B, 1
+ setvar VAR_0x800B, LOCALID_NURSE
call Common_EventScript_PkmnCenterNurse
waitmessage
waitbuttonpress
@@ -36,20 +38,20 @@ FallarborTown_PokemonCenter_1F_EventScript_Lanette:: @ 8200C01
end
FallarborTown_PokemonCenter_1F_EventScript_LanetteExitNorth:: @ 8200C28
- applymovement 4, FallarborTown_PokemonCenter_1F_Movement_LanetteExitNorth
+ applymovement LOCALID_LANETTE, FallarborTown_PokemonCenter_1F_Movement_LanetteExitNorth
waitmovement 0
goto FallarborTown_PokemonCenter_1F_EventScript_LanetteExited
end
FallarborTown_PokemonCenter_1F_EventScript_LanetteExitWest:: @ 8200C38
- applymovement 4, FallarborTown_PokemonCenter_1F_Movement_LanetteExitWest
+ applymovement LOCALID_LANETTE, FallarborTown_PokemonCenter_1F_Movement_LanetteExitWest
waitmovement 0
goto FallarborTown_PokemonCenter_1F_EventScript_LanetteExited
end
FallarborTown_PokemonCenter_1F_EventScript_LanetteExited:: @ 8200C48
playse SE_JIDO_DOA
- removeobject 4
+ removeobject LOCALID_LANETTE
clearflag FLAG_HIDE_LANETTES_HOUSE_LANETTE
release
end
diff --git a/data/maps/FarawayIsland_Entrance/scripts.inc b/data/maps/FarawayIsland_Entrance/scripts.inc
index 23ce12098..ce0c10c16 100644
--- a/data/maps/FarawayIsland_Entrance/scripts.inc
+++ b/data/maps/FarawayIsland_Entrance/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_SAILOR, 1
+.set LOCALID_SS_TIDAL, 2
+
FarawayIsland_Entrance_MapScripts:: @ 8267C8E
map_script MAP_SCRIPT_ON_TRANSITION, FarawayIsland_Entrance_OnTransition
.byte 0
@@ -27,8 +30,8 @@ FarawayIsland_Entrance_EventScript_Sailor:: @ 8267CA2
applymovement VAR_LAST_TALKED, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
delay 30
- hideobjectat 1, MAP_FARAWAY_ISLAND_ENTRANCE
- setvar VAR_0x8004, 2
+ hideobjectat LOCALID_SAILOR, MAP_FARAWAY_ISLAND_ENTRANCE
+ setvar VAR_0x8004, LOCALID_SS_TIDAL
call Common_EventScript_FerryDepartIsland
warp MAP_LILYCOVE_CITY_HARBOR, 255, 8, 11
waitstate
diff --git a/data/maps/FarawayIsland_Interior/scripts.inc b/data/maps/FarawayIsland_Interior/scripts.inc
index 2cdb626bd..cad875b65 100644
--- a/data/maps/FarawayIsland_Interior/scripts.inc
+++ b/data/maps/FarawayIsland_Interior/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_MEW, 1
+
FarawayIsland_Interior_MapScripts:: @ 8267CFA
map_script MAP_SCRIPT_ON_RESUME, FarawayIsland_Interior_OnResume
map_script MAP_SCRIPT_ON_TRANSITION, FarawayIsland_Interior_OnTransition
@@ -56,13 +58,13 @@ FarawayIsland_Interior_OnFrame: @ 8267D98
FarawayIsland_Interior_EventScript_FindMew:: @ 8267DA2
lockall
playse SE_PIN
- applymovement 1, Common_Movement_ExclamationMark
+ applymovement LOCALID_MEW, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 1, Common_Movement_Delay48
+ applymovement LOCALID_MEW, Common_Movement_Delay48
waitmovement 0
- applymovement 1, FarawayIsland_Interior_Movement_MewMoveAndHide
+ applymovement LOCALID_MEW, FarawayIsland_Interior_Movement_MewMoveAndHide
waitmovement 0
- copyobjectxytoperm 1
+ copyobjectxytoperm LOCALID_MEW
setvar VAR_TEMP_1, 1
releaseall
end
@@ -118,7 +120,7 @@ FarawayIsland_Interior_Movement_MewHideLeft: @ 8267DEB
FarawayIsland_Interior_EventScript_Mew:: @ 8267DF2
lock
faceplayer
- applymovement 1, FarawayIsland_Interior_Movement_MewAppear
+ applymovement LOCALID_MEW, FarawayIsland_Interior_Movement_MewAppear
waitmovement 0
setvar VAR_0x8004, 0
special sub_81D4A90
@@ -169,22 +171,22 @@ FarawayIsland_Interior_EventScript_PlayerOrMewRan:: @ 8267EA4
end
FarawayIsland_Interior_EventScript_MewHideDown:: @ 8267EAF
- applymovement 1, FarawayIsland_Interior_Movement_MewHideDown
+ applymovement LOCALID_MEW, FarawayIsland_Interior_Movement_MewHideDown
waitmovement 0
return
FarawayIsland_Interior_EventScript_MewHideUp:: @ 8267EBA
- applymovement 1, FarawayIsland_Interior_Movement_MewHideUp
+ applymovement LOCALID_MEW, FarawayIsland_Interior_Movement_MewHideUp
waitmovement 0
return
FarawayIsland_Interior_EventScript_MewHideRight:: @ 8267EC5
- applymovement 1, FarawayIsland_Interior_Movement_MewHideRight
+ applymovement LOCALID_MEW, FarawayIsland_Interior_Movement_MewHideRight
waitmovement 0
return
FarawayIsland_Interior_EventScript_MewHideLeft:: @ 8267ED0
- applymovement 1, FarawayIsland_Interior_Movement_MewHideLeft
+ applymovement LOCALID_MEW, FarawayIsland_Interior_Movement_MewHideLeft
waitmovement 0
return
@@ -192,7 +194,7 @@ FarawayIsland_Interior_EventScript_HideMewWhenGrassCut:: @ 8267EDB
lockall
fadescreenswapbuffers FADE_TO_BLACK
setflag FLAG_HIDE_MEW
- removeobject 1
+ removeobject LOCALID_MEW
fadescreenswapbuffers FADE_FROM_BLACK
msgbox FarawayIsland_Interior_Text_TheFeelingOfBeingWatchedFaded, MSGBOX_DEFAULT
closemessage
diff --git a/data/maps/FortreeCity_Gym/scripts.inc b/data/maps/FortreeCity_Gym/scripts.inc
index 15e359175..f209ceefa 100644
--- a/data/maps/FortreeCity_Gym/scripts.inc
+++ b/data/maps/FortreeCity_Gym/scripts.inc
@@ -50,7 +50,7 @@ FortreeCity_Gym_EventScript_WinonaDefeated:: @ 82165FD
FortreeCity_Gym_EventScript_GiveAerialAce2:: @ 8216646
giveitem ITEM_TM40
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_ShowBagIsFull
msgbox FortreeCity_Gym_Text_ExplainAerialAce, MSGBOX_DEFAULT
setflag FLAG_RECEIVED_TM40
@@ -59,7 +59,7 @@ FortreeCity_Gym_EventScript_GiveAerialAce2:: @ 8216646
FortreeCity_Gym_EventScript_GiveAerialAce:: @ 821666A
giveitem ITEM_TM40
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_BagIsFull
msgbox FortreeCity_Gym_Text_ExplainAerialAce, MSGBOX_DEFAULT
setflag FLAG_RECEIVED_TM40
diff --git a/data/maps/FortreeCity_House4/scripts.inc b/data/maps/FortreeCity_House4/scripts.inc
index be5ff9c6e..891e8eb75 100644
--- a/data/maps/FortreeCity_House4/scripts.inc
+++ b/data/maps/FortreeCity_House4/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_WINGULL, 3
+
FortreeCity_House4_MapScripts:: @ 8217C80
.byte 0
@@ -14,9 +16,9 @@ FortreeCity_House4_EventScript_Boy:: @ 8217C8A
closemessage
setflag FLAG_WINGULL_SENT_ON_ERRAND
clearflag FLAG_HIDE_MOSSDEEP_CITY_HOUSE_2_WINGULL
- applymovement 3, FortreeCity_House4_Movement_WingullExit
+ applymovement LOCALID_WINGULL, FortreeCity_House4_Movement_WingullExit
waitmovement 0
- removeobject 3
+ removeobject LOCALID_WINGULL
releaseall
end
diff --git a/data/maps/FortreeCity_PokemonCenter_1F/scripts.inc b/data/maps/FortreeCity_PokemonCenter_1F/scripts.inc
index e759d2d93..5be9e6616 100644
--- a/data/maps/FortreeCity_PokemonCenter_1F/scripts.inc
+++ b/data/maps/FortreeCity_PokemonCenter_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_NURSE, 1
+
FortreeCity_PokemonCenter_1F_MapScripts:: @ 82173D8
map_script MAP_SCRIPT_ON_TRANSITION, FortreeCity_PokemonCenter_1F_OnTransition
map_script MAP_SCRIPT_ON_RESUME, CableClub_OnResume
@@ -7,9 +9,8 @@ FortreeCity_PokemonCenter_1F_OnTransition: @ 82173E3
setrespawn HEAL_LOCATION_FORTREE_CITY
end
-@ VAR_0x800B is the Nurse's object event id
FortreeCity_PokemonCenter_1F_EventScript_Nurse:: @ 82173E7
- setvar VAR_0x800B, 1
+ setvar VAR_0x800B, LOCALID_NURSE
call Common_EventScript_PkmnCenterNurse
waitmessage
waitbuttonpress
diff --git a/data/maps/GraniteCave_StevensRoom/scripts.inc b/data/maps/GraniteCave_StevensRoom/scripts.inc
index 01ce14588..7d0b275a5 100644
--- a/data/maps/GraniteCave_StevensRoom/scripts.inc
+++ b/data/maps/GraniteCave_StevensRoom/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_STEVEN, 1
+
GraniteCave_StevensRoom_MapScripts:: @ 822DC7A
.byte 0
@@ -32,24 +34,24 @@ GraniteCave_StevensRoom_EventScript_Steven:: @ 822DC7B
compare VAR_FACING, DIR_EAST
call_if_eq GraniteCave_StevensRoom_EventScript_StevenExitWestEast
playse SE_KAIDAN
- removeobject 1
+ removeobject LOCALID_STEVEN
release
end
GraniteCave_StevensRoom_EventScript_StevenExitNorth:: @ 822DD0D
- applymovement 1, GraniteCave_StevensRoom_Movement_StevenExit
+ applymovement LOCALID_STEVEN, GraniteCave_StevensRoom_Movement_StevenExit
waitmovement 0
return
GraniteCave_StevensRoom_EventScript_StevenExitWestEast:: @ 822DD18
applymovement OBJ_EVENT_ID_PLAYER, GraniteCave_StevensRoom_Movement_PlayerTurnTowardExit
- applymovement 1, GraniteCave_StevensRoom_Movement_StevenExit
+ applymovement LOCALID_STEVEN, GraniteCave_StevensRoom_Movement_StevenExit
waitmovement 0
return
GraniteCave_StevensRoom_EventScript_StevenExitSouth:: @ 822DD2A
applymovement OBJ_EVENT_ID_PLAYER, GraniteCave_StevensRoom_Movement_PlayerTurnTowardExit
- applymovement 1, GraniteCave_StevensRoom_Movement_StevenExitSouth
+ applymovement LOCALID_STEVEN, GraniteCave_StevensRoom_Movement_StevenExitSouth
waitmovement 0
return
diff --git a/data/maps/JaggedPass/scripts.inc b/data/maps/JaggedPass/scripts.inc
index 9b4aa5383..eacc7835e 100644
--- a/data/maps/JaggedPass/scripts.inc
+++ b/data/maps/JaggedPass/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_HIDEOUT_GUARD, 5
+
JaggedPass_MapScripts:: @ 8230656
map_script MAP_SCRIPT_ON_RESUME, JaggedPass_OnResume
map_script MAP_SCRIPT_ON_TRANSITION, JaggedPass_OnTransition
@@ -12,7 +14,7 @@ JaggedPass_OnResume: @ 8230666
JaggedPass_EventScript_CheckHasMagmaEmblem:: @ 8230674
checkitem ITEM_MAGMA_EMBLEM, 1
- compare VAR_RESULT, 1
+ compare VAR_RESULT, TRUE
goto_if_eq JaggedPass_EventScript_SetReadyToOpenHideout
return
@@ -71,27 +73,27 @@ JaggedPass_EventScript_MagmaHideoutGuard:: @ 8230718
goto_if_set FLAG_BEAT_MAGMA_GRUNT_JAGGED_PASS, JaggedPass_EventScript_GuardDefeated
waitse
playse SE_PIN
- applymovement 5, Common_Movement_ExclamationMark
+ applymovement LOCALID_HIDEOUT_GUARD, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 5, Common_Movement_Delay48
+ applymovement LOCALID_HIDEOUT_GUARD, Common_Movement_Delay48
waitmovement 0
- applymovement 5, Common_Movement_FacePlayer
+ applymovement LOCALID_HIDEOUT_GUARD, Common_Movement_FacePlayer
waitmovement 0
msgbox JaggedPass_Text_GruntIntro, MSGBOX_DEFAULT
closemessage
trainerbattle_no_intro TRAINER_GRUNT_JAGGED_PASS, JaggedPass_Text_GruntDefeat
setflag FLAG_BEAT_MAGMA_GRUNT_JAGGED_PASS
- applymovement 5, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_HIDEOUT_GUARD, Common_Movement_FaceOriginalDirection
waitmovement 0
releaseall
end
JaggedPass_EventScript_GuardDefeated:: @ 8230766
- applymovement 5, Common_Movement_FacePlayer
+ applymovement LOCALID_HIDEOUT_GUARD, Common_Movement_FacePlayer
waitmovement 0
msgbox JaggedPass_Text_GoWhereverYouWant, MSGBOX_DEFAULT
closemessage
- applymovement 5, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_HIDEOUT_GUARD, Common_Movement_FaceOriginalDirection
waitmovement 0
releaseall
end
@@ -104,7 +106,7 @@ JaggedPass_EventScript_Eric:: @ 8230785
JaggedPass_EventScript_Diana:: @ 823079C
trainerbattle_single TRAINER_DIANA_1, JaggedPass_Text_DianaIntro, JaggedPass_Text_DianaDefeat, JaggedPass_EventScript_RegisterDiana
specialvar VAR_RESULT, ShouldTryRematchBattle
- compare VAR_RESULT, 1
+ compare VAR_RESULT, TRUE
goto_if_eq JaggedPass_EventScript_DianaRematch
msgbox JaggedPass_Text_DianaPostBattle, MSGBOX_DEFAULT
release
@@ -125,7 +127,7 @@ JaggedPass_EventScript_DianaRematch:: @ 82307E4
JaggedPass_EventScript_Ethan:: @ 82307FB
trainerbattle_single TRAINER_ETHAN_1, JaggedPass_Text_EthanIntro, JaggedPass_Text_EthanDefeat, JaggedPass_EventScript_RegisterEthan
specialvar VAR_RESULT, ShouldTryRematchBattle
- compare VAR_RESULT, 1
+ compare VAR_RESULT, TRUE
goto_if_eq JaggedPass_EventScript_EthanRematch
msgbox JaggedPass_Text_EthanPostBattle, MSGBOX_DEFAULT
release
diff --git a/data/maps/LavaridgeTown/scripts.inc b/data/maps/LavaridgeTown/scripts.inc
index d1facba32..47c5482a6 100644
--- a/data/maps/LavaridgeTown/scripts.inc
+++ b/data/maps/LavaridgeTown/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_RIVAL_ON_BIKE, 7
+.set LOCALID_RIVAL, 8
+
LavaridgeTown_MapScripts:: @ 81EA4D3
map_script MAP_SCRIPT_ON_TRANSITION, LavaridgeTown_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, LavaridgeTown_OnFrame
@@ -26,9 +29,9 @@ LavaridgeTown_EventScript_CheckSetRivalPos:: @ 81EA518
return
LavaridgeTown_EventScript_SetRivalPos:: @ 81EA529
- setobjectxyperm 8, 11, 9
- setobjectxyperm 7, 9, 8
- setobjectmovementtype 7, MOVEMENT_TYPE_FACE_UP
+ setobjectxyperm LOCALID_RIVAL, 11, 9
+ setobjectxyperm LOCALID_RIVAL_ON_BIKE, 9, 8
+ setobjectmovementtype LOCALID_RIVAL_ON_BIKE, MOVEMENT_TYPE_FACE_UP
clearflag FLAG_HIDE_LAVARIDGE_TOWN_RIVAL
return
@@ -86,14 +89,14 @@ LavaridgeTown_EventScript_BrendanGiveGoGoggles:: @ 81EA5DA
LavaridgeTown_EventScript_RivalExit:: @ 81EA5FF
closemessage
- removeobject 8
- addobject 7
+ removeobject LOCALID_RIVAL
+ addobject LOCALID_RIVAL_ON_BIKE
delay 30
compare VAR_0x8008, 9
call_if_eq LavaridgeTown_EventScript_RivalExit1
compare VAR_0x8008, 9
call_if_ne LavaridgeTown_EventScript_RivalExit2
- removeobject 7
+ removeobject LOCALID_RIVAL_ON_BIKE
setvar VAR_LAVARIDGE_TOWN_STATE, 2
clearflag FLAG_HIDE_MAP_NAME_POPUP
savebgm MUS_DUMMY
@@ -110,52 +113,52 @@ LavaridgeTown_EventScript_PlayBrendanMusic:: @ 81EA635
return
LavaridgeTown_EventScript_RivalNoticePlayer:: @ 81EA63A
- applymovement 8, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_RIVAL, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
playse SE_PIN
- applymovement 8, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 8, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
return
LavaridgeTown_EventScript_RivalExitHerbShop:: @ 81EA65C
opendoor 12, 15
waitdooranim
- addobject 8
- applymovement 8, LavaridgeTown_Movement_RivalExitHerbShop
+ addobject LOCALID_RIVAL
+ applymovement LOCALID_RIVAL, LavaridgeTown_Movement_RivalExitHerbShop
waitmovement 0
closedoor 12, 15
waitdooranim
- applymovement 8, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_RIVAL, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
playse SE_PIN
- applymovement 8, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 8, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
return
LavaridgeTown_EventScript_RivalApproachPlayer1:: @ 81EA6A1
- applymovement 8, LavaridgeTown_Movement_RivalApproachPlayer1
+ applymovement LOCALID_RIVAL, LavaridgeTown_Movement_RivalApproachPlayer1
waitmovement 0
return
LavaridgeTown_EventScript_RivalApproachPlayer2:: @ 81EA6AC
- applymovement 8, LavaridgeTown_Movement_RivalApproachPlayer2
+ applymovement LOCALID_RIVAL, LavaridgeTown_Movement_RivalApproachPlayer2
waitmovement 0
return
LavaridgeTown_EventScript_RivalExit1:: @ 81EA6B7
applymovement OBJ_EVENT_ID_PLAYER, LavaridgeTown_Movement_PlayerWatchRivalExit
- applymovement 7, LavaridgeTown_Movement_RivalExit1
+ applymovement LOCALID_RIVAL_ON_BIKE, LavaridgeTown_Movement_RivalExit1
waitmovement 0
return
LavaridgeTown_EventScript_RivalExit2:: @ 81EA6C9
- applymovement 7, LavaridgeTown_Movement_RivalExit2
+ applymovement LOCALID_RIVAL_ON_BIKE, LavaridgeTown_Movement_RivalExit2
waitmovement 0
return
diff --git a/data/maps/LavaridgeTown_Gym_1F/scripts.inc b/data/maps/LavaridgeTown_Gym_1F/scripts.inc
index 904abfae9..3747d854d 100644
--- a/data/maps/LavaridgeTown_Gym_1F/scripts.inc
+++ b/data/maps/LavaridgeTown_Gym_1F/scripts.inc
@@ -1,3 +1,8 @@
+.set LOCALID_COLE, 2
+.set LOCALID_GERALD, 3
+.set LOCALID_AXLE, 4
+.set LOCALID_DANIELLE, 5
+
LavaridgeTown_Gym_1F_MapScripts:: @ 81FE6F4
map_script MAP_SCRIPT_ON_TRANSITION, LavaridgeTown_Gym_1F_OnTransition
.byte 0
@@ -30,23 +35,23 @@ LavaridgeTown_Gym_1F_EventScript_EndSetTrainerTempVars:: @ 81FE756
LavaridgeTown_Gym_1F_EventScript_CheckHideTrainers:: @ 81FE757
goto_if_defeated TRAINER_COLE, LavaridgeTown_Gym_1F_EventScript_CheckHideGerald
- setobjectmovementtype 2, MOVEMENT_TYPE_HIDDEN
+ setobjectmovementtype LOCALID_COLE, MOVEMENT_TYPE_HIDDEN
LavaridgeTown_Gym_1F_EventScript_CheckHideGerald:: @ 81FE764
goto_if_defeated TRAINER_GERALD, LavaridgeTown_Gym_1F_EventScript_CheckHideAxle
- setobjectmovementtype 3, MOVEMENT_TYPE_HIDDEN
+ setobjectmovementtype LOCALID_GERALD, MOVEMENT_TYPE_HIDDEN
LavaridgeTown_Gym_1F_EventScript_CheckHideAxle:: @ 81FE771
goto_if_defeated TRAINER_AXLE, LavaridgeTown_Gym_1F_EventScript_CheckHideDanielle
- setobjectmovementtype 4, MOVEMENT_TYPE_HIDDEN
+ setobjectmovementtype LOCALID_AXLE, MOVEMENT_TYPE_HIDDEN
LavaridgeTown_Gym_1F_EventScript_CheckHideDanielle:: @ 81FE77E
goto_if_defeated TRAINER_DANIELLE, LavaridgeTown_Gym_1F_EventScript_EndCheckHideTrainers
- setobjectmovementtype 5, MOVEMENT_TYPE_HIDDEN
+ setobjectmovementtype LOCALID_DANIELLE, MOVEMENT_TYPE_HIDDEN
LavaridgeTown_Gym_1F_EventScript_EndCheckHideTrainers:: @ 81FE78B
return
LavaridgeTown_Gym_1F_EventScript_Flannery:: @ 81FE78C
trainerbattle_single TRAINER_FLANNERY_1, LavaridgeTown_Gym_1F_Text_FlanneryIntro, LavaridgeTown_Gym_1F_Text_FlanneryDefeat, LavaridgeTown_Gym_1F_EventScript_FlanneryDefeated, NO_MUSIC
specialvar VAR_RESULT, ShouldTryRematchBattle
- compare VAR_RESULT, 1
+ compare VAR_RESULT, TRUE
goto_if_eq LavaridgeTown_Gym_1F_EventScript_FlanneryRematch
goto_if_unset FLAG_RECEIVED_TM50, LavaridgeTown_Gym_1F_EventScript_GiveOverheat2
msgbox LavaridgeTown_Gym_1F_Text_FlanneryPostBattle, MSGBOX_DEFAULT
@@ -82,7 +87,7 @@ LavaridgeTown_Gym_1F_EventScript_FlanneryDefeated:: @ 81FE7C1
LavaridgeTown_Gym_1F_EventScript_GiveOverheat2:: @ 81FE81D
giveitem ITEM_TM50
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_ShowBagIsFull
msgbox LavaridgeTown_Gym_1F_Text_ExplainOverheat, MSGBOX_DEFAULT
setflag FLAG_RECEIVED_TM50
@@ -91,7 +96,7 @@ LavaridgeTown_Gym_1F_EventScript_GiveOverheat2:: @ 81FE81D
LavaridgeTown_Gym_1F_EventScript_GiveOverheat:: @ 81FE841
giveitem ITEM_TM50
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_BagIsFull
msgbox LavaridgeTown_Gym_1F_Text_ExplainOverheat, MSGBOX_DEFAULT
setflag FLAG_RECEIVED_TM50
@@ -103,7 +108,7 @@ LavaridgeTown_Gym_1F_EventScript_FlanneryRematch:: @ 81FE864
end
LavaridgeTown_Gym_1F_EventScript_Cole:: @ 81FE87F
- trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, TRAINER_COLE, 2, LavaridgeTown_Gym_1F_Text_ColeIntro, LavaridgeTown_Gym_1F_Text_ColeDefeat, LavaridgeTown_Gym_EventScript_CheckTrainerScript
+ trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, TRAINER_COLE, LOCALID_COLE, LavaridgeTown_Gym_1F_Text_ColeIntro, LavaridgeTown_Gym_1F_Text_ColeDefeat, LavaridgeTown_Gym_EventScript_CheckTrainerScript
msgbox LavaridgeTown_Gym_1F_Text_ColePostBattle MSGBOX_AUTOCLOSE
end
@@ -116,37 +121,37 @@ LavaridgeTown_Gym_EventScript_CheckTrainerScript:: @ 81FE89A
end
LavaridgeTown_Gym_1F_EventScript_Axle:: @ 81FE8AF
- trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, TRAINER_AXLE, 4, LavaridgeTown_Gym_1F_Text_AxleIntro, LavaridgeTown_Gym_1F_Text_AxleDefeat, LavaridgeTown_Gym_EventScript_CheckTrainerScript
+ trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, TRAINER_AXLE, LOCALID_AXLE, LavaridgeTown_Gym_1F_Text_AxleIntro, LavaridgeTown_Gym_1F_Text_AxleDefeat, LavaridgeTown_Gym_EventScript_CheckTrainerScript
msgbox LavaridgeTown_Gym_1F_Text_AxlePostBattle, MSGBOX_AUTOCLOSE
end
LavaridgeTown_Gym_B1F_EventScript_Keegan:: @ 81FE8CA
- trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, TRAINER_KEEGAN, 2, LavaridgeTown_Gym_B1F_Text_KeeganIntro, LavaridgeTown_Gym_B1F_Text_KeeganDefeat, LavaridgeTown_Gym_EventScript_CheckTrainerScript
+ trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, TRAINER_KEEGAN, LOCALID_KEEGAN, LavaridgeTown_Gym_B1F_Text_KeeganIntro, LavaridgeTown_Gym_B1F_Text_KeeganDefeat, LavaridgeTown_Gym_EventScript_CheckTrainerScript
msgbox LavaridgeTown_Gym_B1F_Text_KeeganPostBattle, MSGBOX_AUTOCLOSE
end
LavaridgeTown_Gym_1F_EventScript_Danielle:: @ 81FE8E5
- trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, TRAINER_DANIELLE, 5, LavaridgeTown_Gym_1F_Text_DanielleIntro, LavaridgeTown_Gym_1F_Text_DanielleDefeat, LavaridgeTown_Gym_EventScript_CheckTrainerScript
+ trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, TRAINER_DANIELLE, LOCALID_DANIELLE, LavaridgeTown_Gym_1F_Text_DanielleIntro, LavaridgeTown_Gym_1F_Text_DanielleDefeat, LavaridgeTown_Gym_EventScript_CheckTrainerScript
msgbox LavaridgeTown_Gym_1F_Text_DaniellePostBattle, MSGBOX_AUTOCLOSE
end
LavaridgeTown_Gym_1F_EventScript_Gerald:: @ 81FE900
- trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, TRAINER_GERALD, 3, LavaridgeTown_Gym_1F_Text_GeraldIntro, LavaridgeTown_Gym_1F_Text_GeraldDefeat, LavaridgeTown_Gym_EventScript_CheckTrainerScript
+ trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, TRAINER_GERALD, LOCALID_GERALD, LavaridgeTown_Gym_1F_Text_GeraldIntro, LavaridgeTown_Gym_1F_Text_GeraldDefeat, LavaridgeTown_Gym_EventScript_CheckTrainerScript
msgbox LavaridgeTown_Gym_1F_Text_GeraldPostBattle, MSGBOX_AUTOCLOSE
end
LavaridgeTown_Gym_B1F_EventScript_Jace:: @ 81FE91B
- trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, TRAINER_JACE, 1, LavaridgeTown_Gym_B1F_Text_JaceIntro, LavaridgeTown_Gym_B1F_Text_JaceDefeat, LavaridgeTown_Gym_EventScript_CheckTrainerScript
+ trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, TRAINER_JACE, LOCALID_JACE, LavaridgeTown_Gym_B1F_Text_JaceIntro, LavaridgeTown_Gym_B1F_Text_JaceDefeat, LavaridgeTown_Gym_EventScript_CheckTrainerScript
msgbox LavaridgeTown_Gym_B1F_Text_JacePostBattle, MSGBOX_AUTOCLOSE
end
LavaridgeTown_Gym_B1F_EventScript_Jeff:: @ 81FE936
- trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, TRAINER_JEFF, 3, LavaridgeTown_Gym_B1F_Text_JeffIntro, LavaridgeTown_Gym_B1F_Text_JeffDefeat, LavaridgeTown_Gym_EventScript_CheckTrainerScript
+ trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, TRAINER_JEFF, LOCALID_JEFF, LavaridgeTown_Gym_B1F_Text_JeffIntro, LavaridgeTown_Gym_B1F_Text_JeffDefeat, LavaridgeTown_Gym_EventScript_CheckTrainerScript
msgbox LavaridgeTown_Gym_B1F_Text_JeffPostBattle, MSGBOX_AUTOCLOSE
end
LavaridgeTown_Gym_B1F_EventScript_Eli:: @ 81FE951
- trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, TRAINER_ELI, 4, LavaridgeTown_Gym_B1F_Text_EliIntro, LavaridgeTown_Gym_B1F_Text_EliDefeat, LavaridgeTown_Gym_EventScript_CheckTrainerScript
+ trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, TRAINER_ELI, LOCALID_ELI, LavaridgeTown_Gym_B1F_Text_EliIntro, LavaridgeTown_Gym_B1F_Text_EliDefeat, LavaridgeTown_Gym_EventScript_CheckTrainerScript
msgbox LavaridgeTown_Gym_B1F_Text_EliPostBattle, MSGBOX_AUTOCLOSE
end
diff --git a/data/maps/LavaridgeTown_Gym_B1F/scripts.inc b/data/maps/LavaridgeTown_Gym_B1F/scripts.inc
index 3a8f71fad..aad7c4778 100644
--- a/data/maps/LavaridgeTown_Gym_B1F/scripts.inc
+++ b/data/maps/LavaridgeTown_Gym_B1F/scripts.inc
@@ -1,3 +1,8 @@
+.equ LOCALID_JACE, 1
+.equ LOCALID_KEEGAN, 2
+.equ LOCALID_JEFF, 3
+.equ LOCALID_ELI, 4
+
LavaridgeTown_Gym_B1F_MapScripts:: @ 81FF87E
map_script MAP_SCRIPT_ON_TRANSITION, LavaridgeTown_Gym_B1F_OnTransition
.byte 0
@@ -29,16 +34,16 @@ LavaridgeTown_Gym_B1F_EventScript_EndSetTrainerTempVars:: @ 81FF8DB
LavaridgeTown_Gym_B1F_EventScript_CheckHideTrainers:: @ 81FF8DC
goto_if_defeated TRAINER_KEEGAN, LavaridgeTown_Gym_B1F_EventScript_CheckHideJace
- setobjectmovementtype 2, MOVEMENT_TYPE_HIDDEN
+ setobjectmovementtype LOCALID_KEEGAN, MOVEMENT_TYPE_HIDDEN
LavaridgeTown_Gym_B1F_EventScript_CheckHideJace:: @ 81FF8E9
goto_if_defeated TRAINER_JACE, LavaridgeTown_Gym_B1F_EventScript_CheckHideJeff
- setobjectmovementtype 1, MOVEMENT_TYPE_HIDDEN
+ setobjectmovementtype LOCALID_JACE, MOVEMENT_TYPE_HIDDEN
LavaridgeTown_Gym_B1F_EventScript_CheckHideJeff:: @ 81FF8F6
goto_if_defeated TRAINER_JEFF, LavaridgeTown_Gym_B1F_EventScript_CheckHideEli
- setobjectmovementtype 3, MOVEMENT_TYPE_HIDDEN
+ setobjectmovementtype LOCALID_JEFF, MOVEMENT_TYPE_HIDDEN
LavaridgeTown_Gym_B1F_EventScript_CheckHideEli:: @ 81FF903
goto_if_defeated TRAINER_ELI, LavaridgeTown_Gym_B1F_EventScript_EndCheckHideTrainers
- setobjectmovementtype 4, MOVEMENT_TYPE_HIDDEN
+ setobjectmovementtype LOCALID_ELI, MOVEMENT_TYPE_HIDDEN
LavaridgeTown_Gym_B1F_EventScript_EndCheckHideTrainers:: @ 81FF910
return
diff --git a/data/maps/LavaridgeTown_HerbShop/scripts.inc b/data/maps/LavaridgeTown_HerbShop/scripts.inc
index 5f320a942..c08d37609 100644
--- a/data/maps/LavaridgeTown_HerbShop/scripts.inc
+++ b/data/maps/LavaridgeTown_HerbShop/scripts.inc
@@ -31,7 +31,7 @@ LavaridgeTown_HerbShop_EventScript_OldMan:: @ 81FE505
goto_if_set FLFLAG_RECEIVED_CHARCOAL, LavaridgeTown_HerbShop_EventScript_ExplainCharcoal
msgbox LavaridgeTown_HerbShop_Text_YouveComeToLookAtHerbalMedicine, MSGBOX_DEFAULT
giveitem ITEM_CHARCOAL
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_ShowBagIsFull
setflag FLFLAG_RECEIVED_CHARCOAL
release
diff --git a/data/maps/LavaridgeTown_PokemonCenter_1F/scripts.inc b/data/maps/LavaridgeTown_PokemonCenter_1F/scripts.inc
index a2b25fe0e..0b596ba5b 100644
--- a/data/maps/LavaridgeTown_PokemonCenter_1F/scripts.inc
+++ b/data/maps/LavaridgeTown_PokemonCenter_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_NURSE, 1
+
LavaridgeTown_PokemonCenter_1F_MapScripts:: @ 81FFAFA
map_script MAP_SCRIPT_ON_TRANSITION, LavaridgeTown_PokemonCenter_1F_OnTransition
map_script MAP_SCRIPT_ON_RESUME, CableClub_OnResume
@@ -8,9 +10,8 @@ LavaridgeTown_PokemonCenter_1F_OnTransition: @ 81FFB05
call Common_EventScript_UpdateBrineyLocation
end
-@ VAR_0x800B is the Nurse's object event id
LavaridgeTown_PokemonCenter_1F_EventScript_Nurse:: @ 81FFB0E
- setvar VAR_0x800B, 1
+ setvar VAR_0x800B, LOCALID_NURSE
call Common_EventScript_PkmnCenterNurse
waitmessage
waitbuttonpress
diff --git a/data/maps/LilycoveCity/scripts.inc b/data/maps/LilycoveCity/scripts.inc
index fb3775f95..b8f0cd566 100644
--- a/data/maps/LilycoveCity/scripts.inc
+++ b/data/maps/LilycoveCity/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_WOMAN_1, 19
+.set LOCALID_MAN_1, 20
+
LilycoveCity_MapScripts:: @ 81E2B3C
map_script MAP_SCRIPT_ON_TRANSITION, LilycoveCity_OnTransition
map_script MAP_SCRIPT_ON_LOAD, LilycoveCity_OnLoad
@@ -134,13 +137,13 @@ LilycoveCity_EventScript_FatMan:: @ 81E2CD4
LilycoveCity_EventScript_Man1:: @ 81E2CDD
lockall
msgbox LilycoveCity_Text_JustArrivedAndSawRarePokemon, MSGBOX_NPC
- applymovement 20, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_MAN_1, Common_Movement_FaceOriginalDirection
end
LilycoveCity_EventScript_Woman1:: @ 81E2CEE
lockall
msgbox LilycoveCity_Text_HoneymoonVowToSeeRarePokemon, MSGBOX_NPC
- applymovement 19, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_WOMAN_1, Common_Movement_FaceOriginalDirection
end
LilycoveCity_EventScript_CitySign:: @ 81E2CFF
diff --git a/data/maps/LilycoveCity_ContestHall/scripts.inc b/data/maps/LilycoveCity_ContestHall/scripts.inc
index fb98c72f6..f390e9b24 100644
--- a/data/maps/LilycoveCity_ContestHall/scripts.inc
+++ b/data/maps/LilycoveCity_ContestHall/scripts.inc
@@ -1,3 +1,32 @@
+@ VAR_LAST_TALKED would have made all these direct references unnecessary
+.set LOCALID_SMART_MC, 4
+.set LOCALID_SMART_JUDGE, 5
+.set LOCALID_SMART_CONTESTANT_1, 6
+.set LOCALID_SMART_CONTESTANT_2, 7
+.set LOCALID_SMART_CONTESTANT_3, 8
+.set LOCALID_SMART_CONTESTANT_4, 9
+.set LOCALID_SMART_AUDIENCE_4, 11
+.set LOCALID_SMART_AUDIENCE_2, 12
+.set LOCALID_BEAUTY_MC, 13
+.set LOCALID_BEAUTY_JUDGE, 14
+.set LOCALID_BEAUTY_CONTESTANT_1, 15
+.set LOCALID_BEAUTY_CONTESTANT_2, 16
+.set LOCALID_BEAUTY_CONTESTANT_3, 17
+.set LOCALID_BEAUTY_CONTESTANT_4, 18
+.set LOCALID_BEAUTY_AUDIENCE_1, 19
+.set LOCALID_BEAUTY_AUDIENCE_3, 20
+.set LOCALID_BEAUTY_AUDIENCE_2, 21
+.set LOCALID_SMART_AUDIENCE_3, 22
+.set LOCALID_CUTE_MC, 23
+.set LOCALID_CUTE_JUDGE, 24
+.set LOCALID_CUTE_CONTESTANT_1, 25
+.set LOCALID_CUTE_CONTESTANT_2, 26
+.set LOCALID_CUTE_CONTESTANT_3, 27
+.set LOCALID_CUTE_CONTESTANT_4, 28
+.set LOCALID_CUTE_AUDIENCE_1, 29
+.set LOCALID_CUTE_AUDIENCE_3, 30
+.set LOCALID_CUTE_AUDIENCE_2, 31
+
LilycoveCity_ContestHall_MapScripts:: @ 821B484
.byte 0
@@ -22,7 +51,7 @@ LilycoveCity_ContestHall_EventScript_SmartContestMC:: @ 821B4A9
faceplayer
msgbox LilycoveCity_ContestHall_Text_GiveItBestSmartAppeal, MSGBOX_DEFAULT
closemessage
- applymovement 4, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_SMART_MC, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -32,7 +61,7 @@ LilycoveCity_ContestHall_EventScript_SmartContestJudge:: @ 821B4C0
faceplayer
msgbox LilycoveCity_ContestHall_Text_AreYouEnjoyingThisContest, MSGBOX_DEFAULT
closemessage
- applymovement 5, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_SMART_JUDGE, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -42,7 +71,7 @@ LilycoveCity_ContestHall_EventScript_SmartContestant1:: @ 821B4D7
faceplayer
msgbox LilycoveCity_ContestHall_Text_EnteredWrongContest, MSGBOX_DEFAULT
closemessage
- applymovement 6, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_SMART_CONTESTANT_1, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -52,7 +81,7 @@ LilycoveCity_ContestHall_EventScript_SmartContestant2:: @ 821B4EE
faceplayer
msgbox LilycoveCity_ContestHall_Text_RaisedMonToBeSmart, MSGBOX_DEFAULT
closemessage
- applymovement 7, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_SMART_CONTESTANT_2, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -62,7 +91,7 @@ LilycoveCity_ContestHall_EventScript_SmartContestant3:: @ 821B505
faceplayer
msgbox LilycoveCity_ContestHall_Text_IfMonPullsSmartMoveNext, MSGBOX_DEFAULT
closemessage
- applymovement 8, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_SMART_CONTESTANT_3, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -72,7 +101,7 @@ LilycoveCity_ContestHall_EventScript_SmartContestant4:: @ 821B51C
faceplayer
msgbox LilycoveCity_ContestHall_Text_DontAppreciateCuteLeechLife, MSGBOX_DEFAULT
closemessage
- applymovement 9, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_SMART_CONTESTANT_4, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -86,7 +115,7 @@ LilycoveCity_ContestHall_EventScript_SmartContestAudience2:: @ 821B53C
faceplayer
msgbox LilycoveCity_ContestHall_Text_AllSeemToUseDifferentMoves, MSGBOX_DEFAULT
closemessage
- applymovement 12, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_SMART_AUDIENCE_2, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -96,7 +125,7 @@ LilycoveCity_ContestHall_EventScript_SmartContestAudience3:: @ 821B553
faceplayer
msgbox LilycoveCity_ContestHall_Text_PokemonSmarterThanTrainers, MSGBOX_DEFAULT
closemessage
- applymovement 22, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_SMART_AUDIENCE_3, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -106,7 +135,7 @@ LilycoveCity_ContestHall_EventScript_SmartContestAudience4:: @ 821B56A
faceplayer
msgbox LilycoveCity_ContestHall_Text_StillLoveSmartnessContests, MSGBOX_DEFAULT
closemessage
- applymovement 11, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_SMART_AUDIENCE_4, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -116,7 +145,7 @@ LilycoveCity_ContestHall_EventScript_BeautyContestMC:: @ 821B581
faceplayer
msgbox LilycoveCity_ContestHall_Text_AreYouEnteringBeautyContest, MSGBOX_DEFAULT
closemessage
- applymovement 13, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_BEAUTY_MC, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -126,7 +155,7 @@ LilycoveCity_ContestHall_EventScript_BeautyContestJudge:: @ 821B598
faceplayer
msgbox LilycoveCity_ContestHall_Text_EveryPokemonPristineBeauty, MSGBOX_DEFAULT
closemessage
- applymovement 14, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_BEAUTY_JUDGE, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -136,7 +165,7 @@ LilycoveCity_ContestHall_EventScript_BeautyContestant1:: @ 821B5AF
faceplayer
msgbox LilycoveCity_ContestHall_Text_EyesWillBeGluedToMyBeauty, MSGBOX_DEFAULT
closemessage
- applymovement 15, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_BEAUTY_CONTESTANT_1, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -146,7 +175,7 @@ LilycoveCity_ContestHall_EventScript_BeautyContestant2:: @ 821B5C6
faceplayer
msgbox LilycoveCity_ContestHall_Text_OverdidGrooming, MSGBOX_DEFAULT
closemessage
- applymovement 16, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_BEAUTY_CONTESTANT_2, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -156,7 +185,7 @@ LilycoveCity_ContestHall_EventScript_BeautyContestant3:: @ 821B5DD
faceplayer
msgbox LilycoveCity_ContestHall_Text_JudgeWontSeeAuroraBeam, MSGBOX_DEFAULT
closemessage
- applymovement 17, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_BEAUTY_CONTESTANT_3, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -166,7 +195,7 @@ LilycoveCity_ContestHall_EventScript_BeautyContestant4:: @ 821B5F4
faceplayer
msgbox LilycoveCity_ContestHall_Text_PokemonLooksLikeYoungerMe, MSGBOX_DEFAULT
closemessage
- applymovement 18, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_BEAUTY_CONTESTANT_4, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -176,7 +205,7 @@ LilycoveCity_ContestHall_EventScript_BeautyContestAudience1:: @ 821B60B
faceplayer
msgbox LilycoveCity_ContestHall_Text_WinBeautyContestMakesMeHappy, MSGBOX_DEFAULT
closemessage
- applymovement 19, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_BEAUTY_AUDIENCE_1, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -186,7 +215,7 @@ LilycoveCity_ContestHall_EventScript_BeautyContestAudience2:: @ 821B622
faceplayer
msgbox LilycoveCity_ContestHall_Text_GanderAtAllThosePrettyPokemon, MSGBOX_DEFAULT
closemessage
- applymovement 21, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_BEAUTY_AUDIENCE_2, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -196,7 +225,7 @@ LilycoveCity_ContestHall_EventScript_BeautyContestAudience3:: @ 821B639
faceplayer
msgbox LilycoveCity_ContestHall_Text_CantWinOnBeautyAlone, MSGBOX_DEFAULT
closemessage
- applymovement 20, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_BEAUTY_AUDIENCE_3, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -206,7 +235,7 @@ LilycoveCity_ContestHall_EventScript_CuteContestMC:: @ 821B650
faceplayer
msgbox LilycoveCity_ContestHall_Text_InTheMiddleOfContest, MSGBOX_DEFAULT
closemessage
- applymovement 23, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_CUTE_MC, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -216,7 +245,7 @@ LilycoveCity_ContestHall_EventScript_CuteContestJudge:: @ 821B667
faceplayer
msgbox LilycoveCity_ContestHall_Text_SuchCharmingCuteAppeals, MSGBOX_DEFAULT
closemessage
- applymovement 24, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_CUTE_JUDGE, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -226,7 +255,7 @@ LilycoveCity_ContestHall_EventScript_CuteContestant1:: @ 821B67E
faceplayer
msgbox LilycoveCity_ContestHall_Text_MyAzurillWasDistracted, MSGBOX_DEFAULT
closemessage
- applymovement 25, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_CUTE_CONTESTANT_1, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -236,7 +265,7 @@ LilycoveCity_ContestHall_EventScript_CuteContestant2:: @ 821B695
faceplayer
msgbox LilycoveCity_ContestHall_Text_NeverWonBattleButContest, MSGBOX_DEFAULT
closemessage
- applymovement 26, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_CUTE_CONTESTANT_2, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -246,7 +275,7 @@ LilycoveCity_ContestHall_EventScript_CuteContestant3:: @ 821B6AC
faceplayer
msgbox LilycoveCity_ContestHall_Text_PetalDanceIsMarvel, MSGBOX_DEFAULT
closemessage
- applymovement 27, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_CUTE_CONTESTANT_3, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -256,18 +285,18 @@ LilycoveCity_ContestHall_EventScript_CuteContestant4:: @ 821B6C3
faceplayer
msgbox LilycoveCity_ContestHall_Text_MyMonAppealSoMuchCuter, MSGBOX_DEFAULT
closemessage
- applymovement 28, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_CUTE_CONTESTANT_4, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
LilycoveCity_ContestHall_EventScript_CuteContestAudience1:: @ 821B6DA
lockall
- applymovement 29, Common_Movement_FacePlayer
+ applymovement LOCALID_CUTE_AUDIENCE_1, Common_Movement_FacePlayer
waitmovement 0
msgbox LilycoveCity_ContestHall_Text_MyChildIsInContest, MSGBOX_DEFAULT
closemessage
- applymovement 29, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_CUTE_AUDIENCE_1, Common_Movement_FaceOriginalDirection
waitmovement 0
delay 25
msgbox LilycoveCity_ContestHall_Text_ComeOnDear, MSGBOX_DEFAULT
@@ -279,7 +308,7 @@ LilycoveCity_ContestHall_EventScript_CuteContestAudience2:: @ 821B705
faceplayer
msgbox LilycoveCity_ContestHall_Text_WantCuteMonOfMyOwn, MSGBOX_DEFAULT
closemessage
- applymovement 31, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_CUTE_AUDIENCE_2, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -289,7 +318,7 @@ LilycoveCity_ContestHall_EventScript_CuteContestAudience3:: @ 821B71C
faceplayer
msgbox LilycoveCity_ContestHall_Text_ThatGirlThereIsCutest, MSGBOX_DEFAULT
closemessage
- applymovement 30, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_CUTE_AUDIENCE_3, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
diff --git a/data/maps/LilycoveCity_ContestLobby/scripts.inc b/data/maps/LilycoveCity_ContestLobby/scripts.inc
index 12b598346..6b71c5125 100644
--- a/data/maps/LilycoveCity_ContestLobby/scripts.inc
+++ b/data/maps/LilycoveCity_ContestLobby/scripts.inc
@@ -1,3 +1,9 @@
+@ Note: data/scripts/berry_blender.inc is for the same map, so shares local IDs
+.set LOCALID_RECEPTIONIST, 1
+.set LOCALID_LINK_RECEPTIONIST, 2
+.set LOCALID_ARTIST, 4
+.set LOCALID_ARTIST_LINK, 11
+
LilycoveCity_ContestLobby_MapScripts:: @ 821A211
map_script MAP_SCRIPT_ON_TRANSITION, LilycoveCity_ContestLobby_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, LilycoveCity_ContestLobby_OnFrame
@@ -35,15 +41,15 @@ LilycoveCity_ContestLobby_EventScript_TryDoContestArtist:: @ 821A255
LilycoveCity_ContestLobby_EventScript_ContestArtist:: @ 821A264
lockall
- addobject 4
- applymovement 4, LilycoveCity_ContestLobby_Movement_ArtistApproachPlayer
- waitmovement 4
+ addobject LOCALID_ARTIST
+ applymovement LOCALID_ARTIST, LilycoveCity_ContestLobby_Movement_ArtistApproachPlayer
+ waitmovement LOCALID_ARTIST
applymovement OBJ_EVENT_ID_PLAYER, LilycoveCity_ContestLobby_Movement_PlayerFaceArtist
waitmovement 0
msgbox LilycoveCity_ContestLobby_Text_YourPokemonSpurredMeToPaint, MSGBOX_DEFAULT
lockall
fadescreen FADE_TO_BLACK
- showcontestwinner 0
+ showcontestwinner CONTEST_WINNER_ARTIST
lockall
msgbox LilycoveCity_ContestLobby_Text_ShouldITakePaintingToMuseum, MSGBOX_YESNO
compare VAR_RESULT, YES
@@ -61,9 +67,9 @@ LilycoveCity_ContestLobby_EventScript_TakePaintingToMuseum:: @ 821A2AA
specialvar VAR_RESULT, GiveMonArtistRibbon
compare VAR_RESULT, TRUE
call_if_eq LilycoveCity_ContestLobby_EventScript_ReceivedArtistRibbon
- applymovement 4, LilycoveCity_ContestLobby_Movement_ArtistExit
+ applymovement LOCALID_ARTIST, LilycoveCity_ContestLobby_Movement_ArtistExit
waitmovement 0
- removeobject 4
+ removeobject LOCALID_ARTIST
call LilycoveCity_ContestLobby_EventScript_UpdateMuseumPatrons
call LilycoveCity_ContestLobby_EventScript_SetPaintingFlag
releaseall
@@ -75,22 +81,22 @@ LilycoveCity_ContestLobby_EventScript_ConfirmDontTakePainting:: @ 821A2E4
goto_if_eq LilycoveCity_ContestLobby_EventScript_TakePaintingToMuseum
msgbox LilycoveCity_ContestLobby_Text_FineThatsTheWayItIs, MSGBOX_DEFAULT
closemessage
- applymovement 4, LilycoveCity_ContestLobby_Movement_ArtistExit
+ applymovement LOCALID_ARTIST, LilycoveCity_ContestLobby_Movement_ArtistExit
waitmovement 0
setvar VAR_LILYCOVE_CONTEST_LOBBY_STATE, 0
- removeobject 4
+ removeobject LOCALID_ARTIST
releaseall
end
LilycoveCity_ContestLobby_EventScript_ReceivedArtistRibbon:: @ 821A314
incrementgamestat GAME_STAT_RECEIVED_RIBBONS
special BufferContestWinnerMonName
- applymovement 4, LilycoveCity_ContestLobby_Movement_ArtistBeginToExit
+ applymovement LOCALID_ARTIST, LilycoveCity_ContestLobby_Movement_ArtistBeginToExit
waitmovement 0
playse SE_PIN
- applymovement 4, Common_Movement_ExclamationMark
+ applymovement LOCALID_ARTIST, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 4, LilycoveCity_ContestLobby_Movement_ArtistReturnToPlayer
+ applymovement LOCALID_ARTIST, LilycoveCity_ContestLobby_Movement_ArtistReturnToPlayer
waitmovement 0
msgbox LilycoveCity_ContestLobby_Text_TakeMementoOfPainting, MSGBOX_DEFAULT
playfanfare MUS_FANFA4
@@ -209,15 +215,15 @@ LilycoveCity_ContestLobby_EventScript_TryDoLinkContestArtist:: @ 821A427
LilycoveCity_ContestLobby_EventScript_LinkContestArtist:: @ 821A436
lockall
- addobject 11
- applymovement 11, LilycoveCity_ContestLobby_Movement_LinkArtistApproachPlayer
- waitmovement 11
+ addobject LOCALID_ARTIST_LINK
+ applymovement LOCALID_ARTIST_LINK, LilycoveCity_ContestLobby_Movement_LinkArtistApproachPlayer
+ waitmovement LOCALID_ARTIST_LINK
applymovement OBJ_EVENT_ID_PLAYER, LilycoveCity_ContestLobby_Movement_PlayerFaceLinkArtist
waitmovement 0
msgbox LilycoveCity_ContestLobby_Text_YourPokemonSpurredMeToPaint, MSGBOX_DEFAULT
lockall
fadescreen FADE_TO_BLACK
- showcontestwinner 0
+ showcontestwinner CONTEST_WINNER_ARTIST
msgbox LilycoveCity_ContestLobby_Text_ShouldITakePaintingToMuseum, MSGBOX_YESNO
compare VAR_RESULT, YES
goto_if_eq LilycoveCity_ContestLobby_EventScript_TakePaintingToMuseumLink
@@ -233,9 +239,9 @@ LilycoveCity_ContestLobby_EventScript_TakePaintingToMuseumLink:: @ 821A47A
specialvar VAR_RESULT, GiveMonArtistRibbon
compare VAR_RESULT, TRUE
call_if_eq LilycoveCity_ContestLobby_EventScript_ReceivedLinkArtistRibbon
- applymovement 11, LilycoveCity_ContestLobby_Movement_LinkArtistExit
+ applymovement LOCALID_ARTIST_LINK, LilycoveCity_ContestLobby_Movement_LinkArtistExit
waitmovement 0
- removeobject 11
+ removeobject LOCALID_ARTIST_LINK
call LilycoveCity_ContestLobby_EventScript_UpdateMuseumPatrons
call LilycoveCity_ContestLobby_EventScript_SetPaintingFlag
releaseall
@@ -247,10 +253,10 @@ LilycoveCity_ContestLobby_EventScript_ConfirmDontTakePaintingLink:: @ 821A4B4
goto_if_eq LilycoveCity_ContestLobby_EventScript_TakePaintingToMuseumLink
msgbox LilycoveCity_ContestLobby_Text_FineThatsTheWayItIs, MSGBOX_DEFAULT
closemessage
- applymovement 11, LilycoveCity_ContestLobby_Movement_LinkArtistExit
+ applymovement LOCALID_ARTIST_LINK, LilycoveCity_ContestLobby_Movement_LinkArtistExit
waitmovement 0
setvar VAR_LILYCOVE_CONTEST_LOBBY_STATE, 0
- removeobject 11
+ removeobject LOCALID_ARTIST_LINK
releaseall
end
@@ -258,12 +264,12 @@ LilycoveCity_ContestLobby_EventScript_ReceivedLinkArtistRibbon:: @ 821A4E4
incrementgamestat GAME_STAT_RECEIVED_RIBBONS
setflag FLAG_SYS_RIBBON_GET
special BufferContestWinnerMonName
- applymovement 11, LilycoveCity_ContestLobby_Movement_LinkArtistBeginExit
+ applymovement LOCALID_ARTIST_LINK, LilycoveCity_ContestLobby_Movement_LinkArtistBeginExit
waitmovement 0
playse SE_PIN
- applymovement 11, Common_Movement_ExclamationMark
+ applymovement LOCALID_ARTIST_LINK, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 11, LilycoveCity_ContestLobby_Movement_LinkArtistReturnToPlayer
+ applymovement LOCALID_ARTIST_LINK, LilycoveCity_ContestLobby_Movement_LinkArtistReturnToPlayer
waitmovement 0
msgbox LilycoveCity_ContestLobby_Text_TakeMementoOfPainting, MSGBOX_DEFAULT
playfanfare MUS_FANFA4
@@ -409,26 +415,26 @@ LilycoveCity_ContestLobby_EventScript_WarpToToughContestHall:: @ 821A663
LilycoveCity_ContestLobby_EventScript_LeadToContestHall:: @ 821A670
lockall
- applymovement 1, LilycoveCity_ContestLobby_Movement_ReceptionistApproachCounter
+ applymovement LOCALID_RECEPTIONIST, LilycoveCity_ContestLobby_Movement_ReceptionistApproachCounter
waitmovement 0
playse SE_HASHI
setmetatile 12, 2, METATILE_Contest_WallShadow, 1
setmetatile 12, 3, METATILE_Contest_FloorShadow, 1
special DrawWholeMapView
- applymovement 1, LilycoveCity_ContestLobby_Movement_ReceptionistExitCounter
+ applymovement LOCALID_RECEPTIONIST, LilycoveCity_ContestLobby_Movement_ReceptionistExitCounter
waitmovement 0
playse SE_HASHI
setmetatile 12, 2, METATILE_Contest_CounterFlap_Top, 1
setmetatile 12, 3, METATILE_Contest_CounterFlap_Bottom, 1
special DrawWholeMapView
delay 20
- applymovement 1, LilycoveCity_ContestLobby_Movement_ReceptionistFacePlayer
+ applymovement LOCALID_RECEPTIONIST, LilycoveCity_ContestLobby_Movement_ReceptionistFacePlayer
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, LilycoveCity_ContestLobby_Movement_PlayerApproachReceptionist
waitmovement 0
msgbox LilycoveCity_ContestLobby_Text_ComeThroughHere, MSGBOX_DEFAULT
closemessage
- applymovement 1, LilycoveCity_ContestLobby_Movement_ReceptionistWalkToContestHall
+ applymovement LOCALID_RECEPTIONIST, LilycoveCity_ContestLobby_Movement_ReceptionistWalkToContestHall
applymovement OBJ_EVENT_ID_PLAYER, LilycoveCity_ContestLobby_Movement_PlayerWalkToContestHall
waitmovement 0
releaseall
@@ -505,42 +511,42 @@ LilycoveCity_ContestLobby_EventScript_NinjaBoy:: @ 821A735
LilycoveCity_ContestLobby_EventScript_ContestWinner1:: @ 821A73E
lockall
fadescreen FADE_TO_BLACK
- showcontestwinner 1
+ showcontestwinner CONTEST_WINNER_HALL_1
releaseall
end
LilycoveCity_ContestLobby_EventScript_ContestWinner2:: @ 821A745
lockall
fadescreen FADE_TO_BLACK
- showcontestwinner 2
+ showcontestwinner CONTEST_WINNER_HALL_2
releaseall
end
LilycoveCity_ContestLobby_EventScript_ContestWinner3:: @ 821A74C
lockall
fadescreen FADE_TO_BLACK
- showcontestwinner 3
+ showcontestwinner CONTEST_WINNER_HALL_3
releaseall
end
LilycoveCity_ContestLobby_EventScript_ContestWinner4:: @ 821A753
lockall
fadescreen FADE_TO_BLACK
- showcontestwinner 4
+ showcontestwinner CONTEST_WINNER_HALL_4
releaseall
end
LilycoveCity_ContestLobby_EventScript_ContestWinner5:: @ 821A75A
lockall
fadescreen FADE_TO_BLACK
- showcontestwinner 5
+ showcontestwinner CONTEST_WINNER_HALL_5
releaseall
end
LilycoveCity_ContestLobby_EventScript_ContestWinner6:: @ 821A761
lockall
fadescreen FADE_TO_BLACK
- showcontestwinner 6
+ showcontestwinner CONTEST_WINNER_HALL_6
releaseall
end
@@ -767,15 +773,15 @@ LilycoveCity_ContestLobby_EventScript_TrySetUpLinkContest:: @ 821AA15
call_if_eq LilycoveCity_ContestLobby_EventScript_TryLinkGMode
compare VAR_TEMP_C, 2
goto_if_ge LilycoveCity_ContestLobby_EventScript_CancelLinkContest
- compare VAR_RESULT, 4
+ compare VAR_RESULT, LINKUP_WRONG_NUM_PLAYERS
goto_if_eq LilycoveCity_ContestLobby_EventScript_CancelLinkDifferentChoices
- compare VAR_RESULT, 3
+ compare VAR_RESULT, LINKUP_DIFF_SELECTIONS
goto_if_eq LilycoveCity_ContestLobby_EventScript_CancelLinkDifferentChoices
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq LilycoveCity_ContestLobby_EventScript_CancelLinkContest
- compare VAR_RESULT, 6
+ compare VAR_RESULT, LINKUP_CONNECTION_ERROR
goto_if_eq LilycoveCity_ContestLobby_EventScript_CancelLinkError
- compare VAR_RESULT, 10
+ compare VAR_RESULT, LINKUP_FAILED_CONTEST_GMODE
goto_if_eq LilycoveCity_ContestLobby_EventScript_CancelLinkModeDifference
message3 LilycoveCity_ContestLobby_Text_Transmitting
contestlinktransfer
@@ -889,22 +895,22 @@ LilycoveCity_ContestLobby_EventScript_DecideLinkLeader:: @ 821ABA6
LilycoveCity_ContestLobby_EventScript_TryLeadGroup:: @ 821ABE3
call LilycoveCity_ContestLobby_EventScript_TryBecomeLinkLeader
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq LilycoveCity_ContestLobby_EventScript_LinkLeaderDecided
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq LilycoveCity_ContestLobby_EventScript_DecideLinkLeader
- compare VAR_RESULT, 8
+ compare VAR_RESULT, LINKUP_RETRY_ROLE_ASSIGN
goto_if_eq LilycoveCity_ContestLobby_EventScript_TryLeadGroup
release
end
LilycoveCity_ContestLobby_EventScript_TryJoinGroup:: @ 821AC0B
call LilycoveCity_ContestLobby_EventScript_TryJoinLinkGroup
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq LilycoveCity_ContestLobby_EventScript_LinkLeaderDecided
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq LilycoveCity_ContestLobby_EventScript_DecideLinkLeader
- compare VAR_RESULT, 8
+ compare VAR_RESULT, LINKUP_RETRY_ROLE_ASSIGN
goto_if_eq LilycoveCity_ContestLobby_EventScript_TryJoinGroup
release
end
@@ -930,20 +936,20 @@ LilycoveCity_ContestLobby_EventScript_LeadToLinkContestHall:: @ 821AC49
waitmessage
delay 20
closemessage
- applymovement 2, LilycoveCity_ContestLobby_Movement_LinkReceptionistApproachCounter
+ applymovement LOCALID_LINK_RECEPTIONIST, LilycoveCity_ContestLobby_Movement_LinkReceptionistApproachCounter
waitmovement 0
playse SE_HASHI
setmetatile 17, 2, METATILE_Contest_WallShadow, 1
setmetatile 17, 3, METATILE_Contest_FloorShadow, 1
special DrawWholeMapView
- applymovement 2, LilycoveCity_ContestLobby_Movement_LinkReceptionistExitCounter
+ applymovement LOCALID_LINK_RECEPTIONIST, LilycoveCity_ContestLobby_Movement_LinkReceptionistExitCounter
waitmovement 0
playse SE_HASHI
setmetatile 17, 2, METATILE_Contest_CounterFlap_Top, 1
setmetatile 17, 3, METATILE_Contest_CounterFlap_Bottom, 1
special DrawWholeMapView
delay 20
- applymovement 2, LilycoveCity_ContestLobby_Movement_LinkReceptionistFacePlayer
+ applymovement LOCALID_LINK_RECEPTIONIST, LilycoveCity_ContestLobby_Movement_LinkReceptionistFacePlayer
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, LilycoveCity_ContestLobby_Movement_PlayerApproachLinkReceptionist
waitmovement 0
@@ -952,7 +958,7 @@ LilycoveCity_ContestLobby_EventScript_LeadToLinkContestHall:: @ 821AC49
delay 20
closemessage
call LilycoveCity_ContestLobby_EventScript_DelayIfContestWithRSPlayer
- applymovement 2, LilycoveCity_ContestLobby_Movement_LinkReceptionistWalkToContestHall
+ applymovement LOCALID_LINK_RECEPTIONIST, LilycoveCity_ContestLobby_Movement_LinkReceptionistWalkToContestHall
applymovement OBJ_EVENT_ID_PLAYER, LilycoveCity_ContestLobby_Movement_PlayerWalkToLinkContestHall
waitmovement 0
release
diff --git a/data/maps/LilycoveCity_CoveLilyMotel_1F/scripts.inc b/data/maps/LilycoveCity_CoveLilyMotel_1F/scripts.inc
index 49008b035..72667973d 100644
--- a/data/maps/LilycoveCity_CoveLilyMotel_1F/scripts.inc
+++ b/data/maps/LilycoveCity_CoveLilyMotel_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_OWNER, 1
+
LilycoveCity_CoveLilyMotel_1F_MapScripts:: @ 8218188
.byte 0
@@ -6,33 +8,33 @@ LilycoveCity_CoveLilyMotel_1F_EventScript_MotelOwner:: @ 8218189
goto_if_set FLAG_SYS_GAME_CLEAR, LilycoveCity_CoveLilyMotel_1F_EventScript_GameClear
goto_if_set FLAG_BADGE07_GET, LilycoveCity_CoveLilyMotel_1F_EventScript_AquaHideoutBusted
msgbox LilycoveCity_CoveLilyMotel_1F_Text_GuestsDoubledByMascot, MSGBOX_DEFAULT
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_OWNER, Common_Movement_FacePlayer
waitmovement 0
msgbox LilycoveCity_CoveLilyMotel_1F_Text_NoGuestsWithTeamAqua, MSGBOX_DEFAULT
closemessage
- applymovement 1, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_OWNER, Common_Movement_FaceOriginalDirection
waitmovement 0
releaseall
end
LilycoveCity_CoveLilyMotel_1F_EventScript_AquaHideoutBusted:: @ 82181C3
msgbox LilycoveCity_CoveLilyMotel_1F_Text_MonFoundLostItem, MSGBOX_DEFAULT
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_OWNER, Common_Movement_FacePlayer
waitmovement 0
msgbox LilycoveCity_CoveLilyMotel_1F_Text_HeardAquaHideoutBusted, MSGBOX_DEFAULT
closemessage
- applymovement 1, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_OWNER, Common_Movement_FaceOriginalDirection
waitmovement 0
releaseall
end
LilycoveCity_CoveLilyMotel_1F_EventScript_GameClear:: @ 82181EA
msgbox LilycoveCity_CoveLilyMotel_1F_Text_HouseSittingMonCaughtBurglar, MSGBOX_DEFAULT
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_OWNER, Common_Movement_FacePlayer
waitmovement 0
msgbox LilycoveCity_CoveLilyMotel_1F_Text_BetterGetWorkingOnGuestsDinner, MSGBOX_DEFAULT
closemessage
- applymovement 1, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_OWNER, Common_Movement_FaceOriginalDirection
waitmovement 0
releaseall
end
@@ -40,18 +42,18 @@ LilycoveCity_CoveLilyMotel_1F_EventScript_GameClear:: @ 82181EA
LilycoveCity_CoveLilyMotel_1F_EventScript_BlockingTV:: @ 8218211
lockall
playse SE_PIN
- applymovement 1, Common_Movement_ExclamationMark
+ applymovement LOCALID_OWNER, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 1, Common_Movement_Delay48
+ applymovement LOCALID_OWNER, Common_Movement_Delay48
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
msgbox LilycoveCity_CoveLilyMotel_1F_Text_CantSeeTheTV, MSGBOX_DEFAULT
closemessage
applymovement OBJ_EVENT_ID_PLAYER, LilycoveCity_CoveLilyMotel_1F_Movement_PlayerPushFromTV
- applymovement 1, LilycoveCity_CoveLilyMotel_1F_Movement_OwnerPushPlayer
+ applymovement LOCALID_OWNER, LilycoveCity_CoveLilyMotel_1F_Movement_OwnerPushPlayer
waitmovement 0
- applymovement 1, LilycoveCity_CoveLilyMotel_1F_Movement_OwnerReturn
+ applymovement LOCALID_OWNER, LilycoveCity_CoveLilyMotel_1F_Movement_OwnerReturn
waitmovement 0
release
end
diff --git a/data/maps/LilycoveCity_DepartmentStore_1F/scripts.inc b/data/maps/LilycoveCity_DepartmentStore_1F/scripts.inc
index a3cf54ee0..191220091 100644
--- a/data/maps/LilycoveCity_DepartmentStore_1F/scripts.inc
+++ b/data/maps/LilycoveCity_DepartmentStore_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_LOTTERY_CLERK, 2
+
LilycoveCity_DepartmentStore_1F_MapScripts:: @ 821F692
.byte 0
@@ -22,7 +24,7 @@ LilycoveCity_DepartmentStore_1F_EventScript_LotteryClerk:: @ 821F69C
copyvar VAR_0x8008, VAR_RESULT
special BufferLottoTicketNumber
msgbox LilycoveCity_DepartmentStore_1F_Text_TicketNumberIsXPleaseWait, MSGBOX_DEFAULT
- applymovement 2, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_LOTTERY_CLERK, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
playse SE_PC_ON
special DoLotteryCornerComputerEffect
@@ -30,7 +32,7 @@ LilycoveCity_DepartmentStore_1F_EventScript_LotteryClerk:: @ 821F69C
delay 220
special EndLotteryCornerComputerEffect
delay 10
- applymovement 2, Common_Movement_FacePlayer
+ applymovement LOCALID_LOTTERY_CLERK, Common_Movement_FacePlayer
waitmovement 0
compare VAR_0x8004, 0
goto_if_eq LilycoveCity_DepartmentStore_1F_EventScript_NoMatch
diff --git a/data/maps/LilycoveCity_DepartmentStore_5F/scripts.inc b/data/maps/LilycoveCity_DepartmentStore_5F/scripts.inc
index 0a2525b87..2b36e3d27 100644
--- a/data/maps/LilycoveCity_DepartmentStore_5F/scripts.inc
+++ b/data/maps/LilycoveCity_DepartmentStore_5F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_WOMAN, 7
+
LilycoveCity_DepartmentStore_5F_MapScripts:: @ 821FF7A
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, LilycoveCity_DepartmentStore_5F_OnWarp
.byte 0
@@ -11,8 +13,8 @@ LilycoveCity_DepartmentStore_5F_OnWarp: @ 821FF80
.2byte 0
LilycoveCity_DepartmentStore_5F_EventScript_BlockRoofStairs:: @ 821FF9A
- setobjectxy 7, 16, 2
- turnobject 7, DIR_NORTH
+ setobjectxy LOCALID_WOMAN, 16, 2
+ turnobject LOCALID_WOMAN, DIR_NORTH
end
LilycoveCity_DepartmentStore_5F_EventScript_ClerkFarLeft:: @ 821FFA6
@@ -125,7 +127,7 @@ LilycoveCity_DepartmentStore_5F_EventScript_PokefanF:: @ 822006C
LilycoveCity_DepartmentStore_5F_EventScript_Woman:: @ 8220075
lockall
- applymovement 7, Common_Movement_FacePlayer
+ applymovement LOCALID_WOMAN, Common_Movement_FacePlayer
waitmovement 0
compare VAR_SOOTOPOLIS_CITY_STATE, 0
goto_if_eq LilycoveCity_DepartmentStore_5F_EventScript_WomanNormal
@@ -143,7 +145,7 @@ LilycoveCity_DepartmentStore_5F_EventScript_WomanNormal:: @ 822009C
LilycoveCity_DepartmentStore_5F_EventScript_WomanLegendaryWeather:: @ 82200A7
msgbox LilycoveCity_DepartmentStore_5F_Text_ClosedRooftopForWeather, MSGBOX_DEFAULT
closemessage
- applymovement 7, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_WOMAN, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
releaseall
end
diff --git a/data/maps/LilycoveCity_Harbor/scripts.inc b/data/maps/LilycoveCity_Harbor/scripts.inc
index 023f530fb..1d9ae6a01 100644
--- a/data/maps/LilycoveCity_Harbor/scripts.inc
+++ b/data/maps/LilycoveCity_Harbor/scripts.inc
@@ -1,3 +1,8 @@
+.set LOCALID_ATTENDANT, 1
+.set LOCALID_SS_TIDAL, 2
+.set LOCALID_FERRY_SAILOR, 4
+.set LOCALID_BRINEY, 5
+
LilycoveCity_Harbor_MapScripts:: @ 821E000
map_script MAP_SCRIPT_ON_TRANSITION, LilycoveCity_Harbor_OnTransition
.byte 0
@@ -110,7 +115,7 @@ LilycoveCity_Harbor_EventScript_GetEonTicketState:: @ 821E194
setvar VAR_TEMP_E, 0
goto_if_unset FLAG_ENABLE_SHIP_SOUTHERN_ISLAND, Common_EventScript_NopReturn
checkitem ITEM_EON_TICKET, 1
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_NopReturn
setvar VAR_TEMP_E, 1
goto_if_set FLAG_SHOWN_EON_TICKET, Common_EventScript_NopReturn
@@ -121,7 +126,7 @@ LilycoveCity_Harbor_EventScript_GetAuroraTicketState:: @ 821E1C6
setvar VAR_TEMP_D, 0
goto_if_unset FLAG_ENABLE_SHIP_BIRTH_ISLAND, Common_EventScript_NopReturn
checkitem ITEM_AURORA_TICKET, 1
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_NopReturn
setvar VAR_TEMP_D, 1
goto_if_set FLAG_SHOWN_AURORA_TICKET, Common_EventScript_NopReturn
@@ -132,7 +137,7 @@ LilycoveCity_Harbor_EventScript_GetOldSeaMapState:: @ 821E1F8
setvar VAR_TEMP_C, 0
goto_if_unset FLAG_ENABLE_SHIP_FARAWAY_ISLAND, Common_EventScript_NopReturn
checkitem ITEM_OLD_SEA_MAP, 1
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_NopReturn
setvar VAR_TEMP_C, 1
goto_if_set FLAG_SHOWN_OLD_SEA_MAP, Common_EventScript_NopReturn
@@ -143,7 +148,7 @@ LilycoveCity_Harbor_EventScript_GetMysticTicketState:: @ 821E22A
setvar VAR_TEMP_9, 0
goto_if_unset FLAG_ENABLE_SHIP_NAVEL_ROCK, Common_EventScript_NopReturn
checkitem ITEM_MYSTIC_TICKET, 1
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_NopReturn
setvar VAR_TEMP_9, 1
goto_if_set FLAG_SHOWN_MYSTIC_TICKET, Common_EventScript_NopReturn
@@ -247,18 +252,18 @@ LilycoveCity_Harbor_EventScript_OldSeaMapFirstTime:: @ 821E350
call LilycoveCity_Harbor_EventScript_GetEventTicketSailor
msgbox EventTicket_Text_OldSeaMapTooFar, MSGBOX_DEFAULT
closemessage
- applymovement 4, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_FERRY_SAILOR, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
playse SE_PIN
- applymovement 4, Common_Movement_ExclamationMark
+ applymovement LOCALID_FERRY_SAILOR, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 4, Common_Movement_Delay48
+ applymovement LOCALID_FERRY_SAILOR, Common_Movement_Delay48
waitmovement 0
compare VAR_FACING, DIR_NORTH
call_if_eq LilycoveCity_Harbor_EventScript_MoveSailorOutOfWayNorth
compare VAR_FACING, DIR_EAST
call_if_eq LilycoveCity_Harbor_EventScript_MoveSailorOutOfWayEast
- addobject 5
+ addobject LOCALID_BRINEY
compare VAR_FACING, DIR_NORTH
call_if_eq LilycoveCity_Harbor_EventScript_BrineyFaceSailorNorth
compare VAR_FACING, DIR_EAST
@@ -274,7 +279,7 @@ LilycoveCity_Harbor_EventScript_OldSeaMapFirstTime:: @ 821E350
call_if_eq LilycoveCity_Harbor_EventScript_BoardFerryWithBrineyAndSailorNorth
compare VAR_FACING, DIR_EAST
call_if_eq LilycoveCity_Harbor_EventScript_BoardFerryWithBrineyAndSailorEast
- setvar VAR_0x8004, 2
+ setvar VAR_0x8004, LOCALID_SS_TIDAL
call Common_EventScript_FerryDepart
warp MAP_FARAWAY_ISLAND_ENTRANCE, 255, 13, 38
waitstate
@@ -329,14 +334,14 @@ LilycoveCity_Harbor_EventScript_MultipleEventTicketsFirstTime:: @ 821E44D
LilycoveCity_Harbor_EventScript_ExitFirstTimeTicketSailSelect:: @ 821E4B6
msgbox EventTicket_Text_AsYouLike, MSGBOX_DEFAULT
closemessage
- applymovement 4, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_FERRY_SAILOR, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
delay 30
- removeobject 4
+ removeobject LOCALID_FERRY_SAILOR
delay 30
- applymovement 1, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_ATTENDANT, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
- showobjectat 1, MAP_LILYCOVE_CITY_HARBOR
+ showobjectat LOCALID_ATTENDANT, MAP_LILYCOVE_CITY_HARBOR
delay 30
msgbox LilycoveCity_Harbor_Text_SailAnotherTime, MSGBOX_DEFAULT
release
@@ -348,24 +353,24 @@ LilycoveCity_Harbor_EventScript_GetEventTicketSailor:: @ 821E4EE
delay 30
hideobjectat VAR_LAST_TALKED, MAP_LILYCOVE_CITY_HARBOR
delay 60
- addobject 4
+ addobject LOCALID_FERRY_SAILOR
delay 30
- applymovement 4, Common_Movement_FacePlayer
+ applymovement LOCALID_FERRY_SAILOR, Common_Movement_FacePlayer
waitmovement 0
return
LilycoveCity_Harbor_EventScript_BoardFerryWithSailor:: @ 821E514
- applymovement 4, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_FERRY_SAILOR, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
delay 30
- removeobject 4
+ removeobject LOCALID_FERRY_SAILOR
compare VAR_FACING, DIR_NORTH
call_if_eq LilycoveCity_Harbor_EventScript_PlayerBoardFerryNorth
compare VAR_FACING, DIR_EAST
call_if_eq LilycoveCity_Harbor_EventScript_PlayerBoardFerryEast
delay 30
hideobjectat OBJ_EVENT_ID_PLAYER, 0
- setvar VAR_0x8004, 2
+ setvar VAR_0x8004, LOCALID_SS_TIDAL
call Common_EventScript_FerryDepart
return
@@ -429,7 +434,7 @@ LilycoveCity_Harbor_EventScript_BoardFerry:: @ 821E5CC
call_if_eq LilycoveCity_Harbor_EventScript_PlayerBoardFerryEast
delay 30
hideobjectat OBJ_EVENT_ID_PLAYER, 0
- setvar VAR_0x8004, 2
+ setvar VAR_0x8004, LOCALID_SS_TIDAL
call Common_EventScript_FerryDepart
return
@@ -475,12 +480,12 @@ LilycoveCity_Harbor_EventScript_SailorFerryAvailable:: @ 821E64C
end
LilycoveCity_Harbor_EventScript_MoveSailorOutOfWayNorth:: @ 821E656
- applymovement 4, LilycoveCity_Harbor_Movement_SailorOutOfWayNorth
+ applymovement LOCALID_FERRY_SAILOR, LilycoveCity_Harbor_Movement_SailorOutOfWayNorth
waitmovement 0
return
LilycoveCity_Harbor_EventScript_MoveSailorOutOfWayEast:: @ 821E661
- applymovement 4, LilycoveCity_Harbor_Movement_SailorOutOfWayEast
+ applymovement LOCALID_FERRY_SAILOR, LilycoveCity_Harbor_Movement_SailorOutOfWayEast
waitmovement 0
return
@@ -498,36 +503,36 @@ LilycoveCity_Harbor_Movement_SailorOutOfWayEast: @ 821E671
step_end
LilycoveCity_Harbor_EventScript_BrineyFaceSailorNorth:: @ 821E675
- applymovement 5, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_BRINEY, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
return
LilycoveCity_Harbor_EventScript_BrineyFaceSailorEast:: @ 821E680
- applymovement 5, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_BRINEY, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
LilycoveCity_Harbor_EventScript_BrineyFacePlayerNorth:: @ 821E68B
- applymovement 5, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_BRINEY, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
LilycoveCity_Harbor_EventScript_BrineyFacePlayerEast:: @ 821E696
- applymovement 5, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_BRINEY, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
return
LilycoveCity_Harbor_EventScript_BoardFerryWithBrineyAndSailorNorth:: @ 821E6A1
- applymovement 5, LilycoveCity_Harbor_Movement_BrineyBoardFerry
+ applymovement LOCALID_BRINEY, LilycoveCity_Harbor_Movement_BrineyBoardFerry
applymovement OBJ_EVENT_ID_PLAYER, LilycoveCity_Harbor_Movement_PlayerBoardWithBrineyNorth
- applymovement 4, LilycoveCity_Harbor_Movement_SailorBoardWithBrineyNorth
+ applymovement LOCALID_FERRY_SAILOR, LilycoveCity_Harbor_Movement_SailorBoardWithBrineyNorth
waitmovement 0
return
LilycoveCity_Harbor_EventScript_BoardFerryWithBrineyAndSailorEast:: @ 821E6BA
- applymovement 5, LilycoveCity_Harbor_Movement_BrineyBoardFerry
+ applymovement LOCALID_BRINEY, LilycoveCity_Harbor_Movement_BrineyBoardFerry
applymovement OBJ_EVENT_ID_PLAYER, LilycoveCity_Harbor_Movement_PlayerBoardWithBrineyEast
- applymovement 4, LilycoveCity_Harbor_Movement_SailorBoardWithBrineyEast
+ applymovement LOCALID_FERRY_SAILOR, LilycoveCity_Harbor_Movement_SailorBoardWithBrineyEast
waitmovement 0
return
diff --git a/data/maps/LilycoveCity_LilycoveMuseum_1F/scripts.inc b/data/maps/LilycoveCity_LilycoveMuseum_1F/scripts.inc
index 998cd2897..624e304c8 100644
--- a/data/maps/LilycoveCity_LilycoveMuseum_1F/scripts.inc
+++ b/data/maps/LilycoveCity_LilycoveMuseum_1F/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_CURATOR, 2
+.set LOCALID_ARTIST_2, 8
+
LilycoveCity_LilycoveMuseum_1F_MapScripts:: @ 8218CB8
.byte 0
@@ -7,7 +10,7 @@ LilycoveCity_LilycoveMuseum_1F_EventScript_Greeter:: @ 8218CB9
LilycoveCity_LilycoveMuseum_1F_EventScript_Curator:: @ 8218CC2
lockall
- applymovement 2, Common_Movement_FacePlayer
+ applymovement LOCALID_CURATOR, Common_Movement_FacePlayer
message LilycoveCity_LilycoveMuseum_1F_Text_ImCuratorHaveYouViewedOurPaintings
waitmessage
multichoice 20, 8, MULTI_VIEWED_PAINTINGS, 1
@@ -36,9 +39,9 @@ LilycoveCity_LilycoveMuseum_1F_EventScript_NotInterested:: @ 8218D14
LilycoveCity_LilycoveMuseum_1F_EventScript_InterestedInPaintings:: @ 8218D1E
msgbox LilycoveCity_LilycoveMuseum_1F_Text_ExcellentCanYouComeWithMe, MSGBOX_SIGN
- applymovement 2, LilycoveCity_LilycoveMuseum_1F_Movement_CuratorEnterStairs
+ applymovement LOCALID_CURATOR, LilycoveCity_LilycoveMuseum_1F_Movement_CuratorEnterStairs
waitmovement 0
- removeobject 2
+ removeobject LOCALID_CURATOR
switch VAR_FACING
case DIR_NORTH, LilycoveCity_LilycoveMuseum_1F_EventScript_FollowCuratorNorth
case DIR_WEST, LilycoveCity_LilycoveMuseum_1F_EventScript_FollowCuratorWest
@@ -153,7 +156,7 @@ LilycoveCity_LilycoveMuseum_1F_EventScript_Artist2:: @ 8218E2B
faceplayer
msgbox LilycoveCity_LilycoveMuseum_1F_Text_AimToSeeGreatPaintings, MSGBOX_DEFAULT
closemessage
- applymovement 8, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_ARTIST_2, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
diff --git a/data/maps/LilycoveCity_LilycoveMuseum_2F/scripts.inc b/data/maps/LilycoveCity_LilycoveMuseum_2F/scripts.inc
index 5d45ed144..4cebebd82 100644
--- a/data/maps/LilycoveCity_LilycoveMuseum_2F/scripts.inc
+++ b/data/maps/LilycoveCity_LilycoveMuseum_2F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_CURATOR, 1
+
LilycoveCity_LilycoveMuseum_2F_MapScripts:: @ 821973A
map_script MAP_SCRIPT_ON_LOAD, LilycoveCity_LilycoveMuseum_2F_OnLoad
map_script MAP_SCRIPT_ON_FRAME_TABLE, LilycoveCity_LilycoveMuseum_2F_OnFrame
@@ -62,16 +64,16 @@ LilycoveCity_LilycoveMuseum_2F_OnFrame: @ 82197FE
LilycoveCity_LilycoveMuseum_2F_EventScript_ShowExhibitHall:: @ 8219808
lockall
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_CURATOR, Common_Movement_FacePlayer
applymovement OBJ_EVENT_ID_PLAYER, LilycoveCity_LilycoveMuseum_2F_Movement_PlayerWalkInPlaceLeft
waitmovement 0
msgbox LilycoveCity_LilycoveMuseum_2F_Text_ThisIsExhibitHall, MSGBOX_SIGN
- applymovement 1, LilycoveCity_LilycoveMuseum_2F_Movement_FaceExhibitHall
+ applymovement LOCALID_CURATOR, LilycoveCity_LilycoveMuseum_2F_Movement_FaceExhibitHall
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, LilycoveCity_LilycoveMuseum_2F_Movement_FaceExhibitHall
waitmovement 0
msgbox LilycoveCity_LilycoveMuseum_2F_Text_ExplainExhibitHall, MSGBOX_SIGN
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_CURATOR, Common_Movement_FacePlayer
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, LilycoveCity_LilycoveMuseum_2F_Movement_PlayerWalkInPlaceLeft
waitmovement 0
@@ -107,16 +109,16 @@ LilycoveCity_LilycoveMuseum_2F_EventScript_AddedPainting:: @ 82198BA
end
LilycoveCity_LilycoveMuseum_2F_EventScript_ThankPlayer:: @ 82198C3
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_CURATOR, Common_Movement_FacePlayer
waitmovement 0
msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsYouPlayer, MSGBOX_DEFAULT
- applymovement 1, LilycoveCity_LilycoveMuseum_2F_Movement_FaceExhibitHall
+ applymovement LOCALID_CURATOR, LilycoveCity_LilycoveMuseum_2F_Movement_FaceExhibitHall
msgbox LilycoveCity_LilycoveMuseum_2F_Text_PaintingsAttractedMoreGuests, MSGBOX_DEFAULT
goto LilycoveCity_LilycoveMuseum_2F_EventScript_GiveGlassOrnament
end
LilycoveCity_LilycoveMuseum_2F_EventScript_GiveGlassOrnament:: @ 82198EA
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_CURATOR, Common_Movement_FacePlayer
msgbox LilycoveCity_LilycoveMuseum_2F_Text_TokenOfGratitude, MSGBOX_DEFAULT
givedecoration DECOR_GLASS_ORNAMENT
compare VAR_RESULT, FALSE
@@ -183,35 +185,35 @@ LilycoveCity_LilycoveMuseum_2F_EventScript_RichBoy:: @ 821999C
LilycoveCity_LilycoveMuseum_2F_EventScript_ShowCoolPainting:: @ 82199A5
msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN
fadescreen FADE_TO_BLACK
- showcontestwinner 9
+ showcontestwinner CONTEST_WINNER_MUSEUM_COOL
releaseall
end
LilycoveCity_LilycoveMuseum_2F_EventScript_ShowBeautyPainting:: @ 82199B3
msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN
fadescreen FADE_TO_BLACK
- showcontestwinner 10
+ showcontestwinner CONTEST_WINNER_MUSEUM_BEAUTY
releaseall
end
LilycoveCity_LilycoveMuseum_2F_EventScript_ShowCutePainting:: @ 82199C1
msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN
fadescreen FADE_TO_BLACK
- showcontestwinner 11
+ showcontestwinner CONTEST_WINNER_MUSEUM_CUTE
releaseall
end
LilycoveCity_LilycoveMuseum_2F_EventScript_ShowSmartPainting:: @ 82199CF
msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN
fadescreen FADE_TO_BLACK
- showcontestwinner 12
+ showcontestwinner CONTEST_WINNER_MUSEUM_SMART
releaseall
end
LilycoveCity_LilycoveMuseum_2F_EventScript_ShowToughPainting:: @ 82199DD
msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN
fadescreen FADE_TO_BLACK
- showcontestwinner 13
+ showcontestwinner CONTEST_WINNER_MUSEUM_TOUGH
releaseall
end
diff --git a/data/maps/LilycoveCity_MoveDeletersHouse/scripts.inc b/data/maps/LilycoveCity_MoveDeletersHouse/scripts.inc
index 2592ccd9c..6e7f9c580 100644
--- a/data/maps/LilycoveCity_MoveDeletersHouse/scripts.inc
+++ b/data/maps/LilycoveCity_MoveDeletersHouse/scripts.inc
@@ -1,9 +1,11 @@
+.set LOCALID_MOVE_DELETER, 1
+
LilycoveCity_MoveDeletersHouse_MapScripts:: @ 821EA0A
.byte 0
LilycoveCity_MoveDeletersHouse_EventScript_MoveDeleter:: @ 821EA0B
lockall
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_MOVE_DELETER, Common_Movement_FacePlayer
waitmovement 0
msgbox LilycoveCity_MoveDeletersHouse_Text_ICanMakeMonForgetMove, MSGBOX_YESNO
switch VAR_RESULT
diff --git a/data/maps/LilycoveCity_PokemonCenter_1F/scripts.inc b/data/maps/LilycoveCity_PokemonCenter_1F/scripts.inc
index a7df8528e..829c55646 100644
--- a/data/maps/LilycoveCity_PokemonCenter_1F/scripts.inc
+++ b/data/maps/LilycoveCity_PokemonCenter_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_NURSE, 1
+
LilycoveCity_PokemonCenter_1F_MapScripts:: @ 821C5B2
map_script MAP_SCRIPT_ON_TRANSITION, LilycoveCity_PokemonCenter_1F_OnTransition
map_script MAP_SCRIPT_ON_RESUME, CableClub_OnResume
@@ -25,9 +27,8 @@ LilycoveCity_PokemonCenter_1F_EventScript_ShowContestLadyMon:: @ 821C5E4
clearflag FLAG_HIDE_LILYCOVE_POKEMON_CENTER_CONTEST_LADY_MON
end
-@ VAR_0x800B is the Nurse's object event id
LilycoveCity_PokemonCenter_1F_EventScript_Nurse:: @ 821C5E8
- setvar VAR_0x800B, 1
+ setvar VAR_0x800B, LOCALID_NURSE
call Common_EventScript_PkmnCenterNurse
waitmessage
waitbuttonpress
diff --git a/data/maps/LilycoveCity_PokemonTrainerFanClub/scripts.inc b/data/maps/LilycoveCity_PokemonTrainerFanClub/scripts.inc
index b76f96b30..6ff869db3 100644
--- a/data/maps/LilycoveCity_PokemonTrainerFanClub/scripts.inc
+++ b/data/maps/LilycoveCity_PokemonTrainerFanClub/scripts.inc
@@ -1,3 +1,12 @@
+.set LOCALID_LASS, 1
+.set LOCALID_MAN, 2
+.set LOCALID_POKEFAN_M, 3
+.set LOCALID_LITTLE_GIRL, 4
+.set LOCALID_NINJA_BOY, 5
+.set LOCALID_BOY, 6
+.set LOCALID_WOMAN, 7
+.set LOCALID_EXPERT_F, 8
+
LilycoveCity_PokemonTrainerFanClub_MapScripts:: @ 821C785
map_script MAP_SCRIPT_ON_FRAME_TABLE, LilycoveCity_PokemonTrainerFanClub_OnFrame
map_script MAP_SCRIPT_ON_TRANSITION, LilycoveCity_PokemonTrainerFanClub_OnTransition
@@ -11,20 +20,20 @@ LilycoveCity_PokemonTrainerFanClub_OnFrame: @ 821C790
LilycoveCity_PokemonTrainerFanClub_EventScript_MeetFirstFans:: @ 821C79A
lockall
- applymovement 1, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_LASS, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
msgbox LilycoveCity_PokemonTrainerFanClub_Text_OhWowItsPlayer, MSGBOX_DEFAULT
- applymovement 4, LilycoveCity_PokemonTrainerFanClub_Movement_LittleGirlWatchPlayer
- applymovement 2, LilycoveCity_PokemonTrainerFanClub_Movement_FanApproachPlayer
+ applymovement LOCALID_LITTLE_GIRL, LilycoveCity_PokemonTrainerFanClub_Movement_LittleGirlWatchPlayer
+ applymovement LOCALID_MAN, LilycoveCity_PokemonTrainerFanClub_Movement_FanApproachPlayer
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
msgbox LilycoveCity_PokemonTrainerFanClub_Text_HeardAboutYouImYourFan, MSGBOX_DEFAULT
- applymovement 4, LilycoveCity_PokemonTrainerFanClub_Movement_LittleGirlMoveCloserToPlayer
+ applymovement LOCALID_LITTLE_GIRL, LilycoveCity_PokemonTrainerFanClub_Movement_LittleGirlMoveCloserToPlayer
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
- applymovement 4, LilycoveCity_PokemonTrainerFanClub_Movement_LittleGirlHideFromPlayer
+ applymovement LOCALID_LITTLE_GIRL, LilycoveCity_PokemonTrainerFanClub_Movement_LittleGirlHideFromPlayer
waitmovement 0
setvar VAR_LILYCOVE_FAN_CLUB_STATE, 2
releaseall
@@ -168,35 +177,35 @@ LilycoveCity_PokemonTrainerFanClub_EventScript_TrySetUpTVShow:: @ 821C9B4
return
LilycoveCity_PokemonTrainerFanClub_EventScript_MoveMember1ToFarTable:: @ 821C9B8
- setobjectxyperm 1, 7, 5
+ setobjectxyperm LOCALID_LASS, 7, 5
return
LilycoveCity_PokemonTrainerFanClub_EventScript_MoveMember2ToFarTable:: @ 821C9C0
- setobjectxyperm 3, 3, 4
+ setobjectxyperm LOCALID_POKEFAN_M, 3, 4
return
LilycoveCity_PokemonTrainerFanClub_EventScript_MoveMember3ToFarTable:: @ 821C9C8
- setobjectxyperm 4, 7, 2
+ setobjectxyperm LOCALID_LITTLE_GIRL, 7, 2
return
LilycoveCity_PokemonTrainerFanClub_EventScript_MoveMember4ToFarTable:: @ 821C9D0
- setobjectxyperm 5, 5, 5
+ setobjectxyperm LOCALID_NINJA_BOY, 5, 5
return
LilycoveCity_PokemonTrainerFanClub_EventScript_MoveMember5ToFarTable:: @ 821C9D8
- setobjectxyperm 6, 5, 2
+ setobjectxyperm LOCALID_BOY, 5, 2
return
LilycoveCity_PokemonTrainerFanClub_EventScript_MoveMember6ToFarTable:: @ 821C9E0
- setobjectxyperm 2, 8, 4
+ setobjectxyperm LOCALID_MAN, 8, 4
return
LilycoveCity_PokemonTrainerFanClub_EventScript_MoveMember7ToFarTable:: @ 821C9E8
- setobjectxyperm 7, 3, 3
+ setobjectxyperm LOCALID_WOMAN, 3, 3
return
LilycoveCity_PokemonTrainerFanClub_EventScript_MoveMember8ToFarTable:: @ 821C9F0
- setobjectxyperm 8, 8, 3
+ setobjectxyperm LOCALID_EXPERT_F, 8, 3
return
LilycoveCity_PokemonTrainerFanClub_EventScript_SetFanMemberPositionsForFirstFanMeeting:: @ 821C9F8
diff --git a/data/maps/LittlerootTown/scripts.inc b/data/maps/LittlerootTown/scripts.inc
index 5fd2a5fca..347a805e8 100644
--- a/data/maps/LittlerootTown/scripts.inc
+++ b/data/maps/LittlerootTown/scripts.inc
@@ -1,3 +1,8 @@
+.set LOCALID_TWIN, 1
+.set LOCALID_MOM, 4
+.set LOCALID_RIVAL, 7
+.set LOCALID_BIRCH, 8
+
LittlerootTown_MapScripts:: @ 81E7DCB
map_script MAP_SCRIPT_ON_TRANSITION, LittlerootTown_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, LittlerootTown_OnFrame
@@ -79,24 +84,24 @@ LittlerootTown_EventScript_SetExitedHouseAfterLatiSSTicketEvent:: @ 81E7E5C
return
LittlerootTown_EventScript_MoveMomToMaysDoor:: @ 81E7E67
- setobjectxyperm 4, 14, 8
+ setobjectxyperm LOCALID_MOM, 14, 8
return
LittlerootTown_EventScript_SetTwinPos:: @ 81E7E6F
compare VAR_LITTLEROOT_TOWN_STATE, 0
goto_if_eq LittlerootTown_EventScript_SetTwinGuardingRoutePos
- setobjectxyperm 1, 10, 1
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_UP
+ setobjectxyperm LOCALID_TWIN, 10, 1
+ setobjectmovementtype LOCALID_TWIN, MOVEMENT_TYPE_FACE_UP
return
LittlerootTown_EventScript_SetTwinGuardingRoutePos:: @ 81E7E86
- setobjectxyperm 1, 7, 2
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_DOWN
+ setobjectxyperm LOCALID_TWIN, 7, 2
+ setobjectmovementtype LOCALID_TWIN, MOVEMENT_TYPE_FACE_DOWN
return
LittlerootTown_EventScript_SetMomStandingInFrontOfDoorPos:: @ 81E7E92
clearflag FLAG_HIDE_LITTLEROOT_TOWN_MOM_OUTSIDE
- setobjectmovementtype 4, MOVEMENT_TYPE_FACE_DOWN
+ setobjectmovementtype LOCALID_MOM, MOVEMENT_TYPE_FACE_DOWN
checkplayergender
compare VAR_RESULT, MALE
call_if_eq LittlerootTown_EventScript_SetMomInFrontOfDoorMale
@@ -105,11 +110,11 @@ LittlerootTown_EventScript_SetMomStandingInFrontOfDoorPos:: @ 81E7E92
return
LittlerootTown_EventScript_SetMomInFrontOfDoorMale:: @ 81E7EB1
- setobjectxyperm 4, 5, 9
+ setobjectxyperm LOCALID_MOM, 5, 9
return
LittlerootTown_EventScript_SetMomInFrontOfDoorFemale:: @ 81E7EB9
- setobjectxyperm 4, 14, 9
+ setobjectxyperm LOCALID_MOM, 14, 9
return
LittlerootTown_OnFrame: @ 81E7EC1
@@ -147,22 +152,22 @@ LittlerootTown_EventScript_GoInsideWithMom:: @ 81E7F17
waitmovement 0
opendoor VAR_0x8004, VAR_0x8005
waitdooranim
- addobject 4
- applymovement 4, LittlerootTown_Movement_MomExitHouse
+ addobject LOCALID_MOM
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomExitHouse
waitmovement 0
closedoor VAR_0x8004, VAR_0x8005
waitdooranim
delay 10
- applymovement 4, LittlerootTown_Movement_MomApproachPlayerAtTruck
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomApproachPlayerAtTruck
waitmovement 0
msgbox LittlerootTown_Text_OurNewHomeLetsGoInside, MSGBOX_DEFAULT
closemessage
- applymovement 4, LittlerootTown_Movement_MomApproachDoor
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomApproachDoor
applymovement OBJ_EVENT_ID_PLAYER, LittlerootTown_Movement_PlayerApproachDoor
waitmovement 0
opendoor VAR_0x8004, VAR_0x8005
waitdooranim
- applymovement 4, LittlerootTown_Movement_MomEnterHouse
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomEnterHouse
applymovement OBJ_EVENT_ID_PLAYER, LittlerootTown_Movement_PlayerEnterHouse
waitmovement 0
setflag FLAG_HIDE_LITTLEROOT_TOWN_MOM_OUTSIDE
@@ -216,7 +221,7 @@ LittlerootTown_Movement_PlayerStepOffTruck: @ 81E7FAC
LittlerootTown_EventScript_BeginDexUpgradeScene:: @ 81E7FB1
lockall
playse SE_PIN
- applymovement 8, Common_Movement_ExclamationMark
+ applymovement LOCALID_BIRCH, Common_Movement_ExclamationMark
waitmovement 0
delay 80
msgbox LittlerootTown_Text_BirchSomethingToShowYouAtLab, MSGBOX_DEFAULT
@@ -235,8 +240,8 @@ LittlerootTown_OnWarp: @ 81E7FE2
.2byte 0
LittlerootTown_EventScript_SetRivalBirchPosForDexUpgrade:: @ 81E7FEC
- addobject 8
- addobject 7
+ addobject LOCALID_BIRCH
+ addobject LOCALID_RIVAL
checkplayergender
compare VAR_RESULT, MALE
goto_if_eq LittlerootTown_EventScript_SetRivalBirchPosForDexUpgradeMale
@@ -244,13 +249,13 @@ LittlerootTown_EventScript_SetRivalBirchPosForDexUpgrade:: @ 81E7FEC
end
LittlerootTown_EventScript_SetRivalBirchPosForDexUpgradeMale:: @ 81E8004
- setobjectxy 7, 6, 10
- setobjectxy 8, 5, 10
+ setobjectxy LOCALID_RIVAL, 6, 10
+ setobjectxy LOCALID_BIRCH, 5, 10
end
LittlerootTown_EventScript_SetRivalBirchPosForDexUpgradeFemale:: @ 81E8013
- setobjectxy 7, 13, 10
- setobjectxy 8, 14, 10
+ setobjectxy LOCALID_RIVAL, 13, 10
+ setobjectxy LOCALID_BIRCH, 14, 10
end
LittlerootTown_EventScript_FatMan:: @ 81E8022
@@ -276,7 +281,7 @@ LittlerootTown_EventScript_GoSaveBirch:: @ 81E805D
special GetPlayerBigGuyGirlString
msgbox LittlerootTown_Text_CanYouGoSeeWhatsHappening, MSGBOX_DEFAULT
closemessage
- applymovement 1, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_TWIN, Common_Movement_FaceOriginalDirection
waitmovement 0
setvar VAR_LITTLEROOT_TOWN_STATE, 2
release
@@ -295,10 +300,10 @@ LittlerootTown_EventScript_GoodLuck:: @ 81E8087
LittlerootTown_EventScript_NeedPokemonTriggerLeft:: @ 81E8091
lockall
- applymovement 1, LittlerootTown_Movement_TwinApproachPlayerLeft
+ applymovement LOCALID_TWIN, LittlerootTown_Movement_TwinApproachPlayerLeft
waitmovement 0
call LittlerootTown_EventScript_DangerousWithoutPokemon
- applymovement 1, LittlerootTown_Movement_TwinReturnLeft
+ applymovement LOCALID_TWIN, LittlerootTown_Movement_TwinReturnLeft
waitmovement 0
releaseall
end
@@ -306,7 +311,7 @@ LittlerootTown_EventScript_NeedPokemonTriggerLeft:: @ 81E8091
LittlerootTown_EventScript_DangerousWithoutPokemon:: @ 81E80AD
msgbox LittlerootTown_Text_IfYouGoInGrassPokemonWillJumpOut, MSGBOX_DEFAULT
closemessage
- applymovement 1, LittlerootTown_Movement_TwinPushPlayerFromRoute
+ applymovement LOCALID_TWIN, LittlerootTown_Movement_TwinPushPlayerFromRoute
applymovement OBJ_EVENT_ID_PLAYER, LittlerootTown_Movement_PushPlayerBackFromRoute
waitmovement 0
msgbox LittlerootTown_Text_DangerousIfYouDontHavePokemon, MSGBOX_DEFAULT
@@ -353,10 +358,10 @@ LittlerootTown_Movement_PushPlayerBackFromRoute: @ 81E80EB
LittlerootTown_EventScript_NeedPokemonTriggerRight:: @ 81E80EF
lockall
- applymovement 1, LittlerootTown_Movement_TwinApproachPlayerRight
+ applymovement LOCALID_TWIN, LittlerootTown_Movement_TwinApproachPlayerRight
waitmovement 0
call LittlerootTown_EventScript_DangerousWithoutPokemon
- applymovement 1, LittlerootTown_Movement_TwinReturnRight
+ applymovement LOCALID_TWIN, LittlerootTown_Movement_TwinReturnRight
waitmovement 0
releaseall
end
@@ -387,14 +392,14 @@ LittlerootTown_Movement_TwinReturnRight: @ 81E8118
LittlerootTown_EventScript_GoSaveBirchTrigger:: @ 81E811F
lockall
- applymovement 1, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_TWIN, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
special GetPlayerBigGuyGirlString
msgbox LittlerootTown_Text_CanYouGoSeeWhatsHappening, MSGBOX_DEFAULT
closemessage
- applymovement 1, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_TWIN, Common_Movement_FaceOriginalDirection
waitmovement 0
setvar VAR_LITTLEROOT_TOWN_STATE, 2
releaseall
@@ -447,14 +452,14 @@ LittlerootTown_EventScript_PlayersHouseSignFemale:: @ 81E81B2
LittlerootTown_EventScript_GiveRunningShoesTrigger0:: @ 81E81BB
lockall
setvar VAR_0x8008, 0
- setobjectxy 4, 10, 9
+ setobjectxy LOCALID_MOM, 10, 9
goto LittlerootTown_EventScript_GiveRunningShoesTrigger
end
LittlerootTown_EventScript_GiveRunningShoesTrigger1:: @ 81E81CE
lockall
setvar VAR_0x8008, 1
- setobjectxy 4, 11, 9
+ setobjectxy LOCALID_MOM, 11, 9
goto LittlerootTown_EventScript_GiveRunningShoesTrigger
end
@@ -520,12 +525,12 @@ LittlerootTown_EventScript_SetHomeDoorCoordsFemale:: @ 81E828C
return
LittlerootTown_EventScript_MomNoticePlayerMale:: @ 81E8297
- applymovement 4, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_MOM, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
return
LittlerootTown_EventScript_MomNoticePlayerFemale:: @ 81E82A2
- applymovement 4, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_MOM, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
return
@@ -562,70 +567,70 @@ LittlerootTown_EventScript_MomApproachPlayerFemale:: @ 81E82F0
LittlerootTown_EventScript_MomApproachPlayer0:: @ 81E8333
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
- applymovement 4, LittlerootTown_Movement_MomApproachPlayer0
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomApproachPlayer0
waitmovement 0
return
LittlerootTown_EventScript_MomApproachPlayer1:: @ 81E8348
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
- applymovement 4, LittlerootTown_Movement_MomApproachPlayer1
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomApproachPlayer1
waitmovement 0
return
LittlerootTown_EventScript_MomApproachPlayerMale2:: @ 81E835D
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
- applymovement 4, LittlerootTown_Movement_MomApproachPlayerMale2
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomApproachPlayerMale2
waitmovement 0
return
LittlerootTown_EventScript_MomApproachPlayerMale3:: @ 81E8372
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
- applymovement 4, LittlerootTown_Movement_MomApproachPlayerMale3
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomApproachPlayerMale3
waitmovement 0
return
LittlerootTown_EventScript_MomApproachPlayerMale4:: @ 81E8387
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
- applymovement 4, LittlerootTown_Movement_MomApproachPlayerMale4
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomApproachPlayerMale4
waitmovement 0
return
LittlerootTown_EventScript_MomApproachPlayerMale5:: @ 81E839C
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
- applymovement 4, LittlerootTown_Movement_MomApproachPlayerMale5
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomApproachPlayerMale5
waitmovement 0
return
LittlerootTown_EventScript_MomApproachPlayerFemale2:: @ 81E83B1
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
- applymovement 4, LittlerootTown_Movement_MomApproachPlayerFemale2
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomApproachPlayerFemale2
waitmovement 0
return
LittlerootTown_EventScript_MomApproachPlayerFemale3:: @ 81E83C6
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
- applymovement 4, LittlerootTown_Movement_MomApproachPlayerFemale3
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomApproachPlayerFemale3
waitmovement 0
return
LittlerootTown_EventScript_MomApproachPlayerFemale4:: @ 81E83DB
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
- applymovement 4, LittlerootTown_Movement_MomApproachPlayerFemale4
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomApproachPlayerFemale4
waitmovement 0
return
LittlerootTown_EventScript_MomApproachPlayerFemale5:: @ 81E83F0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
- applymovement 4, LittlerootTown_Movement_MomApproachPlayerFemale5
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomApproachPlayerFemale5
waitmovement 0
return
@@ -660,107 +665,107 @@ LittlerootTown_EventScript_MomReturnHomeFemale:: @ 81E8448
return
LittlerootTown_EventScript_MomReturnHome0:: @ 81E848B
- applymovement 4, LittlerootTown_Movement_MomReturnHome0
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomReturnHome0
waitmovement 0
return
LittlerootTown_EventScript_MomReturnHome1:: @ 81E8496
- applymovement 4, LittlerootTown_Movement_MomReturnHome1
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomReturnHome1
waitmovement 0
return
LittlerootTown_EventScript_MomReturnHomeMale2:: @ 81E84A1
- applymovement 4, LittlerootTown_Movement_MomReturnHomeMale2
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomReturnHomeMale2
waitmovement 0
opendoor VAR_0x8009, VAR_0x800A
waitdooranim
- applymovement 4, LittlerootTown_Movement_MomExitThroughDoor
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomExitThroughDoor
waitmovement 0
- hideobjectat 4, MAP_LITTLEROOT_TOWN
+ hideobjectat LOCALID_MOM, MAP_LITTLEROOT_TOWN
closedoor VAR_0x8009, VAR_0x800A
waitdooranim
return
LittlerootTown_EventScript_MomReturnHomeMale3:: @ 81E84C7
- applymovement 4, LittlerootTown_Movement_MomReturnHomeMale3
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomReturnHomeMale3
waitmovement 0
opendoor VAR_0x8009, VAR_0x800A
waitdooranim
- applymovement 4, LittlerootTown_Movement_MomExitThroughDoor
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomExitThroughDoor
waitmovement 0
- hideobjectat 4, MAP_LITTLEROOT_TOWN
+ hideobjectat LOCALID_MOM, MAP_LITTLEROOT_TOWN
closedoor VAR_0x8009, VAR_0x800A
waitdooranim
return
LittlerootTown_EventScript_MomReturnHomeMale4:: @ 81E84ED
- applymovement 4, LittlerootTown_Movement_MomReturnHomeMale4
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomReturnHomeMale4
waitmovement 0
opendoor VAR_0x8009, VAR_0x800A
waitdooranim
- applymovement 4, LittlerootTown_Movement_MomExitThroughDoor
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomExitThroughDoor
waitmovement 0
- hideobjectat 4, MAP_LITTLEROOT_TOWN
+ hideobjectat LOCALID_MOM, MAP_LITTLEROOT_TOWN
closedoor VAR_0x8009, VAR_0x800A
waitdooranim
return
LittlerootTown_EventScript_MomReturnHomeMale5:: @ 81E8513
- applymovement 4, LittlerootTown_Movement_MomReturnHomeMale5
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomReturnHomeMale5
waitmovement 0
opendoor VAR_0x8009, VAR_0x800A
waitdooranim
- applymovement 4, LittlerootTown_Movement_MomExitThroughDoor
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomExitThroughDoor
waitmovement 0
- hideobjectat 4, MAP_LITTLEROOT_TOWN
+ hideobjectat LOCALID_MOM, MAP_LITTLEROOT_TOWN
closedoor VAR_0x8009, VAR_0x800A
waitdooranim
return
LittlerootTown_EventScript_MomReturnHomeFemale2:: @ 81E8539
- applymovement 4, LittlerootTown_Movement_MomReturnHomeFemale2
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomReturnHomeFemale2
waitmovement 0
opendoor VAR_0x8009, VAR_0x800A
waitdooranim
- applymovement 4, LittlerootTown_Movement_MomExitThroughDoor
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomExitThroughDoor
waitmovement 0
- hideobjectat 4, MAP_LITTLEROOT_TOWN
+ hideobjectat LOCALID_MOM, MAP_LITTLEROOT_TOWN
closedoor VAR_0x8009, VAR_0x800A
waitdooranim
return
LittlerootTown_EventScript_MomReturnHomeFemale3:: @ 81E855F
- applymovement 4, LittlerootTown_Movement_MomReturnHomeFemale3
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomReturnHomeFemale3
waitmovement 0
opendoor VAR_0x8009, VAR_0x800A
waitdooranim
- applymovement 4, LittlerootTown_Movement_MomExitThroughDoor
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomExitThroughDoor
waitmovement 0
- hideobjectat 4, MAP_LITTLEROOT_TOWN
+ hideobjectat LOCALID_MOM, MAP_LITTLEROOT_TOWN
closedoor VAR_0x8009, VAR_0x800A
waitdooranim
return
LittlerootTown_EventScript_MomReturnHomeFemale4:: @ 81E8585
- applymovement 4, LittlerootTown_Movement_MomReturnHomeFemale4
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomReturnHomeFemale4
waitmovement 0
opendoor VAR_0x8009, VAR_0x800A
waitdooranim
- applymovement 4, LittlerootTown_Movement_MomExitThroughDoor
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomExitThroughDoor
waitmovement 0
- hideobjectat 4, MAP_LITTLEROOT_TOWN
+ hideobjectat LOCALID_MOM, MAP_LITTLEROOT_TOWN
closedoor VAR_0x8009, VAR_0x800A
waitdooranim
return
LittlerootTown_EventScript_MomReturnHomeFemale5:: @ 81E85AB
- applymovement 4, LittlerootTown_Movement_MomReturnHomeFemale5
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomReturnHomeFemale5
waitmovement 0
opendoor VAR_0x8009, VAR_0x800A
waitdooranim
- applymovement 4, LittlerootTown_Movement_MomExitThroughDoor
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomExitThroughDoor
waitmovement 0
- hideobjectat 4, MAP_LITTLEROOT_TOWN
+ hideobjectat LOCALID_MOM, MAP_LITTLEROOT_TOWN
closedoor VAR_0x8009, VAR_0x800A
waitdooranim
return
@@ -924,20 +929,20 @@ LittlerootTown_EventScript_Mom:: @ 81E863D
compare VAR_RESULT, FEMALE
call_if_eq LittlerootTown_EventScript_SetHomeDoorCoordsFemale
call LittlerootTown_EventScript_GiveRunningShoes
- applymovement 4, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_MOM, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
opendoor VAR_0x8009, VAR_0x800A
waitdooranim
- applymovement 4, LittlerootTown_Movement_MomExitThroughDoor
+ applymovement LOCALID_MOM, LittlerootTown_Movement_MomExitThroughDoor
waitmovement 0
- hideobjectat 4, MAP_LITTLEROOT_TOWN
+ hideobjectat LOCALID_MOM, MAP_LITTLEROOT_TOWN
closedoor VAR_0x8009, VAR_0x800A
waitdooranim
goto LittlerootTown_EventScript_SetReceivedRunningShoes
end
LittlerootTown_EventScript_SetReceivedRunningShoes:: @ 81E8686
- removeobject 4
+ removeobject LOCALID_MOM
setflag FLAG_SYS_B_DASH
setvar VAR_LITTLEROOT_TOWN_STATE, 4
release
diff --git a/data/maps/LittlerootTown_BrendansHouse_1F/scripts.inc b/data/maps/LittlerootTown_BrendansHouse_1F/scripts.inc
index 09b4ce152..65ff3ab98 100644
--- a/data/maps/LittlerootTown_BrendansHouse_1F/scripts.inc
+++ b/data/maps/LittlerootTown_BrendansHouse_1F/scripts.inc
@@ -1,3 +1,7 @@
+.set LOCALID_MOM, 1
+.set LOCALID_RIVAL_MOM, 4
+.set LOCALID_RIVAL, 7
+
LittlerootTown_BrendansHouse_1F_MapScripts:: @ 81F7755
map_script MAP_SCRIPT_ON_LOAD, LittlerootTown_BrendansHouse_1F_OnLoad
map_script MAP_SCRIPT_ON_TRANSITION, LittlerootTown_BrendansHouse_1F_OnTransition
@@ -35,18 +39,18 @@ LittlerootTown_BrendansHouse_1F_OnTransition: @ 81F77A4
end
LittlerootTown_BrendansHouse_1F_EventScript_MoveMomToStairs:: @ 81F77C6
- setobjectxyperm 1, 8, 4
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_UP
+ setobjectxyperm LOCALID_MOM, 8, 4
+ setobjectmovementtype LOCALID_MOM, MOVEMENT_TYPE_FACE_UP
return
LittlerootTown_BrendansHouse_1F_EventScript_MoveMomToTV:: @ 81F77D2
- setobjectxyperm 1, 4, 5
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_UP
+ setobjectxyperm LOCALID_MOM, 4, 5
+ setobjectmovementtype LOCALID_MOM, MOVEMENT_TYPE_FACE_UP
return
LittlerootTown_BrendansHouse_1F_EventScript_MoveMomToDoor:: @ 81F77DE
- setobjectxyperm 1, 9, 8
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_UP
+ setobjectxyperm LOCALID_MOM, 9, 8
+ setobjectmovementtype LOCALID_MOM, MOVEMENT_TYPE_FACE_UP
return
@ Many of the below scripts have no gender check because they assume youre in the correct house
@@ -64,7 +68,7 @@ LittlerootTown_BrendansHouse_1F_EventScript_GoUpstairsToSetClock:: @ 81F7814
msgbox PlayersHouse_1F_Text_GoSetTheClock, MSGBOX_DEFAULT
closemessage
applymovement OBJ_EVENT_ID_PLAYER, LittlerootTown_BrendansHouse_1F_Movement_PushTowardStairs
- applymovement 1, LittlerootTown_BrendansHouse_1F_Movement_PushTowardStairs
+ applymovement LOCALID_MOM, LittlerootTown_BrendansHouse_1F_Movement_PushTowardStairs
waitmovement 0
warp MAP_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F, 255, 7, 1
waitstate
@@ -77,27 +81,27 @@ LittlerootTown_BrendansHouse_1F_Movement_PushTowardStairs: @ 81F783A
LittlerootTown_BrendansHouse_1F_EventScript_EnterHouseMovingIn:: @ 81F783C
lockall
- setvar VAR_0x8004, 1
+ setvar VAR_0x8004, LOCALID_MOM
setvar VAR_0x8005, MALE
goto PlayersHouse_1F_EventScript_EnterHouseMovingIn
end
LittlerootTown_BrendansHouse_1F_EventScript_PetalburgGymReport:: @ 81F784D
lockall
- setvar VAR_0x8004, 0
- setvar VAR_0x8005, 1 @ Object event ID for Mom
+ setvar VAR_0x8004, MALE
+ setvar VAR_0x8005, LOCALID_MOM
goto PlayersHouse_1F_EventScript_PetalburgGymReportMale
end
LittlerootTown_BrendansHouse_1F_EventScript_YoureNewNeighbor:: @ 81F785E
lockall
playse SE_PIN
- applymovement 4, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL_MOM, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 4, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL_MOM, Common_Movement_Delay48
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
- applymovement 4, LittlerootTown_BrendansHouse_1F_Movement_RivalMomApproach
+ applymovement LOCALID_RIVAL_MOM, LittlerootTown_BrendansHouse_1F_Movement_RivalMomApproach
waitmovement 0
special GetRivalSonDaughterString
msgbox RivalsHouse_1F_Text_OhYoureTheNewNeighbor, MSGBOX_DEFAULT
@@ -117,7 +121,7 @@ LittlerootTown_BrendansHouse_1F_Movement_RivalMomApproach: @ 81F789C
LittlerootTown_BrendansHouse_1F_EventScript_GoSeeRoom:: @ 81F78A3
lockall
- setvar VAR_0x8004, 1
+ setvar VAR_0x8004, LOCALID_MOM
setvar VAR_0x8005, MALE
applymovement VAR_0x8004, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
@@ -145,12 +149,12 @@ LittlerootTown_BrendansHouse_1F_EventScript_MeetRival2:: @ 81F78D6
LittlerootTown_BrendansHouse_1F_EventScript_MeetRival:: @ 81F78E2
playse SE_KAIDAN
delay 10
- addobject 7
+ addobject LOCALID_RIVAL
delay 30
playse SE_PIN
- applymovement 7, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 7, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
compare VAR_0x8008, 1
call_if_ne LittlerootTown_BrendansHouse_1F_EventScript_PlayerFaceBrendan
@@ -170,7 +174,7 @@ LittlerootTown_BrendansHouse_1F_EventScript_MeetRival:: @ 81F78E2
compare VAR_0x8008, 2
call_if_eq LittlerootTown_BrendansHouse_1F_EventScript_BrendanGoUpstairs2
playse SE_KAIDAN
- removeobject 7
+ removeobject LOCALID_RIVAL
setflag FLAG_HIDE_LITTLEROOT_TOWN_BRENDANS_HOUSE_BRENDAN
setflag FLAG_HIDE_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F_POKE_BALL
clearflag FLAG_HIDE_LITTLEROOT_TOWN_BRENDANS_HOUSE_RIVAL_BEDROOM
@@ -188,17 +192,17 @@ LittlerootTown_BrendansHouse_1F_EventScript_PlayerFaceBrendan:: @ 81F7981
return
LittlerootTown_BrendansHouse_1F_EventScript_BrendanApproachPlayer0:: @ 81F798C
- applymovement 7, LittlerootTown_BrendansHouse_1F_Movement_BrendanApproachPlayer0
+ applymovement LOCALID_RIVAL, LittlerootTown_BrendansHouse_1F_Movement_BrendanApproachPlayer0
waitmovement 0
return
LittlerootTown_BrendansHouse_1F_EventScript_BrendanApproachPlayer1:: @ 81F7997
- applymovement 7, LittlerootTown_BrendansHouse_1F_Movement_BrendanApproachPlayer1
+ applymovement LOCALID_RIVAL, LittlerootTown_BrendansHouse_1F_Movement_BrendanApproachPlayer1
waitmovement 0
return
LittlerootTown_BrendansHouse_1F_EventScript_BrendanApproachPlayer2:: @ 81F79A2
- applymovement 7, LittlerootTown_BrendansHouse_1F_Movement_BrendanApproachPlayer2
+ applymovement LOCALID_RIVAL, LittlerootTown_BrendansHouse_1F_Movement_BrendanApproachPlayer2
waitmovement 0
return
@@ -230,19 +234,19 @@ LittlerootTown_BrendansHouse_1F_Movement_BrendanApproachPlayer2: @ 81F79B9
LittlerootTown_BrendansHouse_1F_EventScript_BrendanGoUpstairs0:: @ 81F79C1
applymovement OBJ_EVENT_ID_PLAYER, LittlerootTown_BrendansHouse_1F_Movement_PlayerWatchBrendanExit0
- applymovement 7, LittlerootTown_BrendansHouse_1F_Movement_BrendanGoUpstairs0
+ applymovement LOCALID_RIVAL, LittlerootTown_BrendansHouse_1F_Movement_BrendanGoUpstairs0
waitmovement 0
return
LittlerootTown_BrendansHouse_1F_EventScript_BrendanGoUpstairs1:: @ 81F79D3
applymovement OBJ_EVENT_ID_PLAYER, LittlerootTown_BrendansHouse_1F_Movement_PlayerWatchBrendanExit1
- applymovement 7, LittlerootTown_BrendansHouse_1F_Movement_BrendanGoUpstairs1
+ applymovement LOCALID_RIVAL, LittlerootTown_BrendansHouse_1F_Movement_BrendanGoUpstairs1
waitmovement 0
return
LittlerootTown_BrendansHouse_1F_EventScript_BrendanGoUpstairs2:: @ 81F79E5
applymovement OBJ_EVENT_ID_PLAYER, LittlerootTown_BrendansHouse_1F_Movement_PlayerWatchBrendanExit2
- applymovement 7, LittlerootTown_BrendansHouse_1F_Movement_BrendanGoUpstairs2
+ applymovement LOCALID_RIVAL, LittlerootTown_BrendansHouse_1F_Movement_BrendanGoUpstairs2
waitmovement 0
return
diff --git a/data/maps/LittlerootTown_BrendansHouse_2F/scripts.inc b/data/maps/LittlerootTown_BrendansHouse_2F/scripts.inc
index 4f673a7be..7af4580c3 100644
--- a/data/maps/LittlerootTown_BrendansHouse_2F/scripts.inc
+++ b/data/maps/LittlerootTown_BrendansHouse_2F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_RIVAL, 1
+
LittlerootTown_BrendansHouse_2F_MapScripts:: @ 81F83E3
map_script MAP_SCRIPT_ON_TRANSITION, LittlerootTown_BrendansHouse_2F_OnTransition
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, LittlerootTown_BrendansHouse_2F_OnWarp
@@ -26,8 +28,8 @@ LittlerootTown_BrendansHouse_2F_EventScript_TryUpdateBrendanPos:: @ 81F8433
goto_if_eq LittlerootTown_BrendansHouse_2F_EventScript_Ret
compare VAR_DEX_UPGRADE_JOHTO_STARTER_STATE, 2
goto_if_ge LittlerootTown_MaysHouse_2F_EventScript_Ret @ Odd that the MaysHouse equivalent was used here instead
- setobjectxyperm 1, 0, 2
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_UP
+ setobjectxyperm LOCALID_RIVAL, 0, 2
+ setobjectmovementtype LOCALID_RIVAL, MOVEMENT_TYPE_FACE_UP
return
LittlerootTown_BrendansHouse_2F_EventScript_Ret:: @ 81F8456
@@ -63,13 +65,13 @@ LittlerootTown_BrendansHouse_2F_EventScript_RivalsPokeBall:: @ 81F8481
LittlerootTown_BrendansHouse_2F_EventScript_MeetBrendan:: @ 81F8497
delay 10
- addobject 1
- applymovement 1, LittlerootTown_BrendansHouse_2F_Movement_BrendanEnters
+ addobject LOCALID_RIVAL
+ applymovement LOCALID_RIVAL, LittlerootTown_BrendansHouse_2F_Movement_BrendanEnters
waitmovement 0
playse SE_PIN
- applymovement 1, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 1, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
delay 10
playbgm MUS_BOY_SUP, 1
@@ -91,49 +93,49 @@ LittlerootTown_BrendansHouse_2F_EventScript_MeetBrendan:: @ 81F8497
end
LittlerootTown_BrendansHouse_2F_EventScript_MeetBrendanNorth:: @ 81F8507
- applymovement 1, LittlerootTown_BrendansHouse_2F_Movement_BrendanApproachPlayerNorth
+ applymovement LOCALID_RIVAL, LittlerootTown_BrendansHouse_2F_Movement_BrendanApproachPlayerNorth
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
msgbox RivalsHouse_2F_Text_BrendanWhoAreYou, MSGBOX_DEFAULT
closemessage
applymovement OBJ_EVENT_ID_PLAYER, LittlerootTown_BrendansHouse_2F_Movement_PlayerWatchBrendanNorth
- applymovement 1, LittlerootTown_BrendansHouse_2F_Movement_BrendanWalkToPCNorth
+ applymovement LOCALID_RIVAL, LittlerootTown_BrendansHouse_2F_Movement_BrendanWalkToPCNorth
waitmovement 0
return
LittlerootTown_BrendansHouse_2F_EventScript_MeetBrendanSouth:: @ 81F8536
- applymovement 1, LittlerootTown_BrendansHouse_2F_Movement_BrendanApproachPlayerSouth
+ applymovement LOCALID_RIVAL, LittlerootTown_BrendansHouse_2F_Movement_BrendanApproachPlayerSouth
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
msgbox RivalsHouse_2F_Text_BrendanWhoAreYou, MSGBOX_DEFAULT
closemessage
applymovement OBJ_EVENT_ID_PLAYER, LittlerootTown_BrendansHouse_2F_Movement_PlayerWatchBrendanSouth
- applymovement 1, LittlerootTown_BrendansHouse_2F_Movement_BrendanWalkToPCSouth
+ applymovement LOCALID_RIVAL, LittlerootTown_BrendansHouse_2F_Movement_BrendanWalkToPCSouth
waitmovement 0
return
LittlerootTown_BrendansHouse_2F_EventScript_MeetBrendanWest:: @ 81F8565
- applymovement 1, LittlerootTown_BrendansHouse_2F_Movement_BrendanApproachPlayerWest
+ applymovement LOCALID_RIVAL, LittlerootTown_BrendansHouse_2F_Movement_BrendanApproachPlayerWest
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
msgbox RivalsHouse_2F_Text_BrendanWhoAreYou, MSGBOX_DEFAULT
closemessage
applymovement OBJ_EVENT_ID_PLAYER, LittlerootTown_BrendansHouse_2F_Movement_PlayerWatchBrendanWest
- applymovement 1, LittlerootTown_BrendansHouse_2F_Movement_BrendanWalkToPCWest
+ applymovement LOCALID_RIVAL, LittlerootTown_BrendansHouse_2F_Movement_BrendanWalkToPCWest
waitmovement 0
return
LittlerootTown_BrendansHouse_2F_EventScript_MeetBrendanEast:: @ 81F8594
- applymovement 1, LittlerootTown_BrendansHouse_2F_Movement_BrendanApproachPlayerEast
+ applymovement LOCALID_RIVAL, LittlerootTown_BrendansHouse_2F_Movement_BrendanApproachPlayerEast
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
msgbox RivalsHouse_2F_Text_BrendanWhoAreYou, MSGBOX_DEFAULT
closemessage
- applymovement 1, LittlerootTown_BrendansHouse_2F_Movement_BrendanWalkToPCEast
+ applymovement LOCALID_RIVAL, LittlerootTown_BrendansHouse_2F_Movement_BrendanWalkToPCEast
waitmovement 0
return
diff --git a/data/maps/LittlerootTown_MaysHouse_1F/scripts.inc b/data/maps/LittlerootTown_MaysHouse_1F/scripts.inc
index 2a4b653d3..958951dc9 100644
--- a/data/maps/LittlerootTown_MaysHouse_1F/scripts.inc
+++ b/data/maps/LittlerootTown_MaysHouse_1F/scripts.inc
@@ -1,3 +1,7 @@
+.set LOCALID_MOM, 1
+.set LOCALID_RIVAL_MOM, 4
+.set LOCALID_RIVAL, 7
+
LittlerootTown_MaysHouse_1F_MapScripts:: @ 81F88A5
map_script MAP_SCRIPT_ON_LOAD, LittlerootTown_MaysHouse_1F_OnLoad
map_script MAP_SCRIPT_ON_TRANSITION, LittlerootTown_MaysHouse_1F_OnTransition
@@ -35,18 +39,18 @@ LittlerootTown_MaysHouse_1F_OnTransition: @ 81F88F4
end
LittlerootTown_MaysHouse_1F_EventScript_MoveMomToStairs:: @ 81F8916
- setobjectxyperm 1, 2, 4
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_UP
+ setobjectxyperm LOCALID_MOM, 2, 4
+ setobjectmovementtype LOCALID_MOM, MOVEMENT_TYPE_FACE_UP
return
LittlerootTown_MaysHouse_1F_EventScript_MoveMomToTV:: @ 81F8922
- setobjectxyperm 1, 6, 5
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_UP
+ setobjectxyperm LOCALID_MOM, 6, 5
+ setobjectmovementtype LOCALID_MOM, MOVEMENT_TYPE_FACE_UP
return
LittlerootTown_MaysHouse_1F_EventScript_MoveMomToDoor:: @ 81F892E
- setobjectxyperm 1, 1, 8
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_UP
+ setobjectxyperm LOCALID_MOM, 1, 8
+ setobjectmovementtype LOCALID_MOM, MOVEMENT_TYPE_FACE_UP
return
@ Many of the below scripts have no gender check because they assume youre in the correct house
@@ -63,7 +67,7 @@ LittlerootTown_MaysHouse_1F_EventScript_GoUpstairsToSetClock:: @ 81F8964
msgbox PlayersHouse_1F_Text_GoSetTheClock, MSGBOX_DEFAULT
closemessage
applymovement OBJ_EVENT_ID_PLAYER, LittlerootTown_MaysHouse_1F_Movement_PushTowardStairs
- applymovement 1, LittlerootTown_MaysHouse_1F_Movement_PushTowardStairs
+ applymovement LOCALID_MOM, LittlerootTown_MaysHouse_1F_Movement_PushTowardStairs
waitmovement 0
warp MAP_LITTLEROOT_TOWN_MAYS_HOUSE_2F, 255, 1, 1
waitstate
@@ -76,27 +80,27 @@ LittlerootTown_MaysHouse_1F_Movement_PushTowardStairs: @ 81F898A
LittlerootTown_MaysHouse_1F_EventScript_EnterHouseMovingIn:: @ 81F898C
lockall
- setvar VAR_0x8004, 1
+ setvar VAR_0x8004, LOCALID_MOM
setvar VAR_0x8005, FEMALE
goto PlayersHouse_1F_EventScript_EnterHouseMovingIn
end
LittlerootTown_MaysHouse_1F_EventScript_PetalburgGymReport:: @ 81F899D
lockall
- setvar VAR_0x8004, 1
- setvar VAR_0x8005, 1
+ setvar VAR_0x8004, FEMALE
+ setvar VAR_0x8005, LOCALID_MOM
goto PlayersHouse_1F_EventScript_PetalburgGymReportFemale
end
LittlerootTown_MaysHouse_1F_EventScript_YoureNewNeighbor:: @ 81F89AE
lockall
playse SE_PIN
- applymovement 4, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL_MOM, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 4, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL_MOM, Common_Movement_Delay48
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
- applymovement 4, LittlerootTown_MaysHouse_1F_Movement_RivalMomApproach
+ applymovement LOCALID_RIVAL_MOM, LittlerootTown_MaysHouse_1F_Movement_RivalMomApproach
waitmovement 0
special GetRivalSonDaughterString
msgbox RivalsHouse_1F_Text_OhYoureTheNewNeighbor, MSGBOX_DEFAULT
@@ -151,7 +155,7 @@ RivalsHouse_1F_EventScript_RivalSibling:: @ 81F8A3D
LittlerootTown_MaysHouse_1F_EventScript_GoSeeRoom:: @ 81F8A4C
lockall
- setvar VAR_0x8004, 1
+ setvar VAR_0x8004, LOCALID_MOM
setvar VAR_0x8005, FEMALE
applymovement VAR_0x8004, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
@@ -179,12 +183,12 @@ LittlerootTown_MaysHouse_1F_EventScript_MeetRival2:: @ 81F8A7F
LittlerootTown_MaysHouse_1F_EventScript_MeetRival:: @ 81F8A8B
playse SE_KAIDAN
delay 10
- addobject 7
+ addobject LOCALID_RIVAL
delay 30
playse SE_PIN
- applymovement 7, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 7, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
compare VAR_0x8008, 1
call_if_ne LittlerootTown_MaysHouse_1F_EventScript_PlayerFaceMay
@@ -204,7 +208,7 @@ LittlerootTown_MaysHouse_1F_EventScript_MeetRival:: @ 81F8A8B
compare VAR_0x8008, 2
call_if_eq LittlerootTown_MaysHouse_1F_EventScript_MayGoUpstairs2
playse SE_KAIDAN
- removeobject 7
+ removeobject LOCALID_RIVAL
setflag FLAG_HIDE_LITTLEROOT_TOWN_MAYS_HOUSE_MAY
setflag FLAG_HIDE_LITTLEROOT_TOWN_MAYS_HOUSE_2F_POKE_BALL
clearflag FLAG_HIDE_LITTLEROOT_TOWN_MAYS_HOUSE_RIVAL_BEDROOM
@@ -222,17 +226,17 @@ LittlerootTown_MaysHouse_1F_EventScript_PlayerFaceMay:: @ 81F8B2A
return
LittlerootTown_MaysHouse_1F_EventScript_MayApproachPlayer0:: @ 81F8B35
- applymovement 7, LittlerootTown_MaysHouse_1F_Movement_MayApproachPlayer0
+ applymovement LOCALID_RIVAL, LittlerootTown_MaysHouse_1F_Movement_MayApproachPlayer0
waitmovement 0
return
LittlerootTown_MaysHouse_1F_EventScript_MayApproachPlayer1:: @ 81F8B40
- applymovement 7, LittlerootTown_MaysHouse_1F_Movement_MayApproachPlayer1
+ applymovement LOCALID_RIVAL, LittlerootTown_MaysHouse_1F_Movement_MayApproachPlayer1
waitmovement 0
return
LittlerootTown_MaysHouse_1F_EventScript_MayApproachPlayer2:: @ 81F8B4B
- applymovement 7, LittlerootTown_MaysHouse_1F_Movement_MayApproachPlayer2
+ applymovement LOCALID_RIVAL, LittlerootTown_MaysHouse_1F_Movement_MayApproachPlayer2
waitmovement 0
return
@@ -264,19 +268,19 @@ LittlerootTown_MaysHouse_1F_Movement_MayApproachPlayer2: @ 81F8B62
LittlerootTown_MaysHouse_1F_EventScript_MayGoUpstairs0:: @ 81F8B6A
applymovement OBJ_EVENT_ID_PLAYER, LittlerootTown_MaysHouse_1F_Movement_PlayerWatchMayExit0
- applymovement 7, LittlerootTown_MaysHouse_1F_Movement_MayGoUpstairs0
+ applymovement LOCALID_RIVAL, LittlerootTown_MaysHouse_1F_Movement_MayGoUpstairs0
waitmovement 0
return
LittlerootTown_MaysHouse_1F_EventScript_MayGoUpstairs1:: @ 81F8B7C
applymovement OBJ_EVENT_ID_PLAYER, LittlerootTown_MaysHouse_1F_Movement_PlayerWatchMayExit1
- applymovement 7, LittlerootTown_MaysHouse_1F_Movement_MayGoUpstairs1
+ applymovement LOCALID_RIVAL, LittlerootTown_MaysHouse_1F_Movement_MayGoUpstairs1
waitmovement 0
return
LittlerootTown_MaysHouse_1F_EventScript_MayGoUpstairs2:: @ 81F8B8E
applymovement OBJ_EVENT_ID_PLAYER, LittlerootTown_MaysHouse_1F_Movement_PlayerWatchMayExit2
- applymovement 7, LittlerootTown_MaysHouse_1F_Movement_MayGoUpstairs2
+ applymovement LOCALID_RIVAL, LittlerootTown_MaysHouse_1F_Movement_MayGoUpstairs2
waitmovement 0
return
diff --git a/data/maps/LittlerootTown_MaysHouse_2F/scripts.inc b/data/maps/LittlerootTown_MaysHouse_2F/scripts.inc
index d40740835..7c943e0e2 100644
--- a/data/maps/LittlerootTown_MaysHouse_2F/scripts.inc
+++ b/data/maps/LittlerootTown_MaysHouse_2F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_RIVAL, 1
+
LittlerootTown_MaysHouse_2F_MapScripts:: @ 81F9296
map_script MAP_SCRIPT_ON_TRANSITION, LittlerootTown_MaysHouse_2F_OnTransition
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, LittlerootTown_MaysHouse_2F_OnWarp
@@ -26,8 +28,8 @@ LittlerootTown_MaysHouse_2F_EventScript_TryUpdateMayPos:: @ 81F92E6
goto_if_eq LittlerootTown_MaysHouse_2F_EventScript_Ret
compare VAR_DEX_UPGRADE_JOHTO_STARTER_STATE, 2
goto_if_ge LittlerootTown_MaysHouse_2F_EventScript_Ret
- setobjectxyperm 1, 8, 2
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_UP
+ setobjectxyperm LOCALID_RIVAL, 8, 2
+ setobjectmovementtype LOCALID_RIVAL, MOVEMENT_TYPE_FACE_UP
return
LittlerootTown_MaysHouse_2F_EventScript_Ret:: @ 81F9309
@@ -63,13 +65,13 @@ LittlerootTown_MaysHouse_2F_EventScript_RivalsPokeBall:: @ 81F9334
LittlerootTown_MaysHouse_2F_EventScript_MeetMay:: @ 81F934A
delay 10
- addobject 1
- applymovement 1, LittlerootTown_MaysHouse_2F_Movement_MayEnters
+ addobject LOCALID_RIVAL
+ applymovement LOCALID_RIVAL, LittlerootTown_MaysHouse_2F_Movement_MayEnters
waitmovement 0
playse SE_PIN
- applymovement 1, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 1, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
delay 10
playbgm MUS_GIRL_SUP, 1
@@ -91,49 +93,49 @@ LittlerootTown_MaysHouse_2F_EventScript_MeetMay:: @ 81F934A
end
LittlerootTown_MaysHouse_2F_EventScript_MeetMayNorth:: @ 81F93BA
- applymovement 1, LittlerootTown_MaysHouse_2F_Movement_MayApproachPlayerNorth
+ applymovement LOCALID_RIVAL, LittlerootTown_MaysHouse_2F_Movement_MayApproachPlayerNorth
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
msgbox RivalsHouse_2F_Text_MayWhoAreYou, MSGBOX_DEFAULT
closemessage
applymovement OBJ_EVENT_ID_PLAYER, LittlerootTown_MaysHouse_2F_Movement_PlayerWatchMayNorth
- applymovement 1, LittlerootTown_MaysHouse_2F_Movement_MayWalkToPCNorth
+ applymovement LOCALID_RIVAL, LittlerootTown_MaysHouse_2F_Movement_MayWalkToPCNorth
waitmovement 0
return
LittlerootTown_MaysHouse_2F_EventScript_MeetMaySouth:: @ 81F93E9
- applymovement 1, LittlerootTown_MaysHouse_2F_Movement_MayApproachPlayerSouth
+ applymovement LOCALID_RIVAL, LittlerootTown_MaysHouse_2F_Movement_MayApproachPlayerSouth
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
msgbox RivalsHouse_2F_Text_MayWhoAreYou, MSGBOX_DEFAULT
closemessage
applymovement OBJ_EVENT_ID_PLAYER, LittlerootTown_MaysHouse_2F_Movement_PlayerWatchMaySouth
- applymovement 1, LittlerootTown_MaysHouse_2F_Movement_MayWalkToPCSouth
+ applymovement LOCALID_RIVAL, LittlerootTown_MaysHouse_2F_Movement_MayWalkToPCSouth
waitmovement 0
return
LittlerootTown_MaysHouse_2F_EventScript_MeetMayWest:: @ 81F9418
- applymovement 1, LittlerootTown_MaysHouse_2F_Movement_MayApproachPlayerWest
+ applymovement LOCALID_RIVAL, LittlerootTown_MaysHouse_2F_Movement_MayApproachPlayerWest
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
msgbox RivalsHouse_2F_Text_MayWhoAreYou, MSGBOX_DEFAULT
closemessage
- applymovement 1, LittlerootTown_MaysHouse_2F_Movement_MayWalkToPCWest
+ applymovement LOCALID_RIVAL, LittlerootTown_MaysHouse_2F_Movement_MayWalkToPCWest
waitmovement 0
return
LittlerootTown_MaysHouse_2F_EventScript_MeetMayEast:: @ 81F9440
- applymovement 1, LittlerootTown_MaysHouse_2F_Movement_MayApproachPlayerEast
+ applymovement LOCALID_RIVAL, LittlerootTown_MaysHouse_2F_Movement_MayApproachPlayerEast
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
msgbox RivalsHouse_2F_Text_MayWhoAreYou, MSGBOX_DEFAULT
closemessage
applymovement OBJ_EVENT_ID_PLAYER, LittlerootTown_MaysHouse_2F_Movement_PlayerWatchMayEast
- applymovement 1, LittlerootTown_MaysHouse_2F_Movement_MayWalkToPCEast
+ applymovement LOCALID_RIVAL, LittlerootTown_MaysHouse_2F_Movement_MayWalkToPCEast
waitmovement 0
return
diff --git a/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc b/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc
index b9ce0c809..7886bda18 100644
--- a/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc
+++ b/data/maps/LittlerootTown_ProfessorBirchsLab/scripts.inc
@@ -1,3 +1,10 @@
+.set LOCALID_AIDE, 1
+.set LOCALID_BIRCH, 2
+.set LOCALID_RIVAL, 3
+.set LOCALID_BALL_CYNDAQUIL, 4
+.set LOCALID_BALL_TOTODILE, 5
+.set LOCALID_BALL_CHIKORITA, 6
+
LittlerootTown_ProfessorBirchsLab_MapScripts:: @ 81F9C91
map_script MAP_SCRIPT_ON_TRANSITION, LittlerootTown_ProfessorBirchsLab_OnTransition
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, LittlerootTown_ProfessorBirchsLab_OnWarp
@@ -34,8 +41,8 @@ LittlerootTown_ProfessorBirchsLab_EventScript_CheckReadyForJohtoStarter:: @ 81F9
specialvar VAR_RESULT, HasAllHoennMons
compare VAR_RESULT, TRUE
goto_if_eq LittlerootTown_ProfessorBirchsLab_EventScript_SetReadyForJohtoStarter
- setobjectmovementtype 3, MOVEMENT_TYPE_WANDER_UP_AND_DOWN
- setobjectxyperm 3, 5, 10
+ setobjectmovementtype LOCALID_RIVAL, MOVEMENT_TYPE_WANDER_UP_AND_DOWN
+ setobjectxyperm LOCALID_RIVAL, 5, 10
end
LittlerootTown_ProfessorBirchsLab_EventScript_SetReadyForJohtoStarter:: @ 81F9CE9
@@ -48,8 +55,8 @@ LittlerootTown_ProfessorBirchsLab_EventScript_SetJohtoStarterLayout:: @ 81F9CF3
LittlerootTown_ProfessorBirchsLab_EventScript_SetAfterJohtoStarterLayout:: @ 81F9CF7
setmaplayoutindex LAYOUT_LITTLEROOT_TOWN_PROFESSOR_BIRCHS_LAB_WITH_TABLE
- setobjectmovementtype 3, MOVEMENT_TYPE_WANDER_UP_AND_DOWN
- setobjectxyperm 3, 5, 10
+ setobjectmovementtype LOCALID_RIVAL, MOVEMENT_TYPE_WANDER_UP_AND_DOWN
+ setobjectxyperm LOCALID_RIVAL, 5, 10
end
LittlerootTown_ProfessorBirchsLab_OnWarp: @ 81F9D06
@@ -68,35 +75,35 @@ LittlerootTown_ProfessorBirchsLab_EventScript_SetPlayerPosForReceiveStarter:: @
LittlerootTown_ProfessorBirchsLab_EventScript_SetObjectPosForDexUpgrade:: @ 81F9D45
turnobject OBJ_EVENT_ID_PLAYER, DIR_NORTH
- addobject 2
- addobject 3
- turnobject 3, DIR_NORTH
- setobjectxy 3, 5, 5
- turnobject 2, DIR_SOUTH
- setobjectxy 2, 6, 4
- turnobject 1, DIR_EAST
- setobjectxy 1, 10, 10
+ addobject LOCALID_BIRCH
+ addobject LOCALID_RIVAL
+ turnobject LOCALID_RIVAL, DIR_NORTH
+ setobjectxy LOCALID_RIVAL, 5, 5
+ turnobject LOCALID_BIRCH, DIR_SOUTH
+ setobjectxy LOCALID_BIRCH, 6, 4
+ turnobject LOCALID_AIDE, DIR_EAST
+ setobjectxy LOCALID_AIDE, 10, 10
end
LittlerootTown_ProfessorBirchsLab_EventScript_AddRivalObject:: @ 81F9D71
- addobject 3
+ addobject LOCALID_RIVAL
end
LittlerootTown_ProfessorBirchsLab_EventScript_SetObjectPosForJohtoStarters:: @ 81F9D75
- addobject 4
- addobject 5
- addobject 6
- addobject 3
- turnobject 4, DIR_SOUTH
- setobjectxy 4, 8, 4
- turnobject 5, DIR_SOUTH
- setobjectxy 5, 9, 4
- turnobject 6, DIR_SOUTH
- setobjectxy 6, 10, 4
- turnobject 2, DIR_SOUTH
- setobjectxy 2, 6, 4
- turnobject 3, DIR_EAST
- setobjectxy 3, 5, 5
+ addobject LOCALID_BALL_CYNDAQUIL
+ addobject LOCALID_BALL_TOTODILE
+ addobject LOCALID_BALL_CHIKORITA
+ addobject LOCALID_RIVAL
+ turnobject LOCALID_BALL_CYNDAQUIL, DIR_SOUTH
+ setobjectxy LOCALID_BALL_CYNDAQUIL, 8, 4
+ turnobject LOCALID_BALL_TOTODILE, DIR_SOUTH
+ setobjectxy LOCALID_BALL_TOTODILE, 9, 4
+ turnobject LOCALID_BALL_CHIKORITA, DIR_SOUTH
+ setobjectxy LOCALID_BALL_CHIKORITA, 10, 4
+ turnobject LOCALID_BIRCH, DIR_SOUTH
+ setobjectxy LOCALID_BIRCH, 6, 4
+ turnobject LOCALID_RIVAL, DIR_EAST
+ setobjectxy LOCALID_RIVAL, 5, 5
end
LittlerootTown_ProfessorBirchsLab_OnFrame: @ 81F9DB9
@@ -173,7 +180,7 @@ LittlerootTown_ProfessorBirchsLab_EventScript_UpgradeToNationalDex:: @ 81F9E80
delay 30
msgbox LittlerootTown_ProfessorBirchsLab_Text_OtherRegionsUpgradeToNational, MSGBOX_DEFAULT
closemessage
- applymovement 2, LittlerootTown_ProfessorBirchsLab_Movement_BirchRetrievePokedexes
+ applymovement LOCALID_BIRCH, LittlerootTown_ProfessorBirchsLab_Movement_BirchRetrievePokedexes
waitmovement 0
delay 20
playse SE_TK_KASYA
@@ -184,7 +191,7 @@ LittlerootTown_ProfessorBirchsLab_EventScript_UpgradeToNationalDex:: @ 81F9E80
delay 10
playse SE_TK_KASYA
delay 20
- applymovement 3, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_RIVAL, Common_Movement_WalkInPlaceFastestRight
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
checkplayergender
@@ -195,9 +202,9 @@ LittlerootTown_ProfessorBirchsLab_EventScript_UpgradeToNationalDex:: @ 81F9E80
playse SE_PC_ON
waitse
delay 20
- applymovement 2, LittlerootTown_ProfessorBirchsLab_Movement_BirchReturnPokedex
+ applymovement LOCALID_BIRCH, LittlerootTown_ProfessorBirchsLab_Movement_BirchReturnPokedex
waitmovement 0
- applymovement 3, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_RIVAL, Common_Movement_WalkInPlaceFastestUp
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
msgbox LittlerootTown_ProfessorBirchsLab_Text_OkayAllDone, MSGBOX_DEFAULT
@@ -303,7 +310,7 @@ LittlerootTown_ProfessorBirchsLab_EventScript_Cyndaquil:: @ 81F9FBB
release
compare VAR_DEX_UPGRADE_JOHTO_STARTER_STATE, 6
goto_if_ge LittlerootTown_ProfessorBirchsLab_EventScript_AlreadyChoseJohtoStarter
- applymovement 2, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_BIRCH, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
showmonpic SPECIES_CYNDAQUIL, 10, 3
msgbox LittlerootTown_ProfessorBirchsLab_Text_YoullTakeCyndaquil, MSGBOX_YESNO
@@ -316,7 +323,7 @@ LittlerootTown_ProfessorBirchsLab_EventScript_Totodile:: @ 81F9FEF
release
compare VAR_DEX_UPGRADE_JOHTO_STARTER_STATE, 6
goto_if_ge LittlerootTown_ProfessorBirchsLab_EventScript_AlreadyChoseJohtoStarter
- applymovement 2, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_BIRCH, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
showmonpic SPECIES_TOTODILE, 10, 3
msgbox LittlerootTown_ProfessorBirchsLab_Text_YoullTakeTotodile, MSGBOX_YESNO
@@ -329,7 +336,7 @@ LittlerootTown_ProfessorBirchsLab_EventScript_Chikorita:: @ 81FA023
release
compare VAR_DEX_UPGRADE_JOHTO_STARTER_STATE, 6
goto_if_ge LittlerootTown_ProfessorBirchsLab_EventScript_AlreadyChoseJohtoStarter
- applymovement 2, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_BIRCH, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
showmonpic SPECIES_CHIKORITA, 10, 3
msgbox LittlerootTown_ProfessorBirchsLab_Text_YoullTakeChikorita, MSGBOX_YESNO
@@ -363,7 +370,7 @@ LittlerootTown_ProfessorBirchsLab_EventScript_GiveCyndaquil:: @ 81FA06C
LittlerootTown_ProfessorBirchsLab_EventScript_SendCyndaquilToParty:: @ 81FA0A1
call LittlerootTown_ProfessorBirchsLab_EventScript_ReceivedJohtoStarter
- removeobject 4
+ removeobject LOCALID_BALL_CYNDAQUIL
msgbox gText_NicknameThisPokemon, MSGBOX_YESNO
compare VAR_RESULT, NO
goto_if_eq LittlerootTown_ProfessorBirchsLab_EventScript_ReceivedCyndaquil
@@ -374,7 +381,7 @@ LittlerootTown_ProfessorBirchsLab_EventScript_SendCyndaquilToParty:: @ 81FA0A1
LittlerootTown_ProfessorBirchsLab_EventScript_SendCyndaquilToPC:: @ 81FA0CC
call LittlerootTown_ProfessorBirchsLab_EventScript_ReceivedJohtoStarter
- removeobject 4
+ removeobject LOCALID_BALL_CYNDAQUIL
msgbox gText_NicknameThisPokemon, MSGBOX_YESNO
compare VAR_RESULT, NO
goto_if_eq LittlerootTown_ProfessorBirchsLab_EventScript_CyndaquilTransferredToPC
@@ -408,7 +415,7 @@ LittlerootTown_ProfessorBirchsLab_EventScript_GiveTotodile:: @ 81FA10D
LittlerootTown_ProfessorBirchsLab_EventScript_SendTotodileToParty:: @ 81FA142
call LittlerootTown_ProfessorBirchsLab_EventScript_ReceivedJohtoStarter
- removeobject 5
+ removeobject LOCALID_BALL_TOTODILE
msgbox gText_NicknameThisPokemon, MSGBOX_YESNO
compare VAR_RESULT, NO
goto_if_eq LittlerootTown_ProfessorBirchsLab_EventScript_ReceivedTotodile
@@ -419,7 +426,7 @@ LittlerootTown_ProfessorBirchsLab_EventScript_SendTotodileToParty:: @ 81FA142
LittlerootTown_ProfessorBirchsLab_EventScript_SendTotodileToPC:: @ 81FA16D
call LittlerootTown_ProfessorBirchsLab_EventScript_ReceivedJohtoStarter
- removeobject 5
+ removeobject LOCALID_BALL_TOTODILE
msgbox gText_NicknameThisPokemon, MSGBOX_YESNO
compare VAR_RESULT, NO
goto_if_eq LittlerootTown_ProfessorBirchsLab_EventScript_TotodileTransferredToPC
@@ -453,7 +460,7 @@ LittlerootTown_ProfessorBirchsLab_EventScript_GiveChikorita:: @ 81FA1AE
LittlerootTown_ProfessorBirchsLab_EventScript_SendChikoritaToParty:: @ 81FA1E3
call LittlerootTown_ProfessorBirchsLab_EventScript_ReceivedJohtoStarter
- removeobject 6
+ removeobject LOCALID_BALL_CHIKORITA
msgbox gText_NicknameThisPokemon, MSGBOX_YESNO
compare VAR_RESULT, NO
goto_if_eq LittlerootTown_ProfessorBirchsLab_EventScript_ReceivedChikorita
@@ -464,7 +471,7 @@ LittlerootTown_ProfessorBirchsLab_EventScript_SendChikoritaToParty:: @ 81FA1E3
LittlerootTown_ProfessorBirchsLab_EventScript_SendChikoritaToPC:: @ 81FA20E
call LittlerootTown_ProfessorBirchsLab_EventScript_ReceivedJohtoStarter
- removeobject 6
+ removeobject LOCALID_BALL_CHIKORITA
msgbox gText_NicknameThisPokemon, MSGBOX_YESNO
compare VAR_RESULT, NO
goto_if_eq LittlerootTown_ProfessorBirchsLab_EventScript_ChikoritaTransferredToPC
@@ -544,7 +551,7 @@ LittlerootTown_ProfessorBirchsLab_EventScript_GivePokedex:: @ 81FA2F8
call LittlerootTown_ProfessorBirchsLab_EventScript_ReceivePokedex
msgbox LittlerootTown_ProfessorBirchsLab_Text_ExplainPokedex, MSGBOX_DEFAULT
closemessage
- applymovement 3, LittlerootTown_ProfessorBirchsLab_Movement_RivalApproachPlayer
+ applymovement LOCALID_RIVAL, LittlerootTown_ProfessorBirchsLab_Movement_RivalApproachPlayer
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
diff --git a/data/maps/MagmaHideout_4F/scripts.inc b/data/maps/MagmaHideout_4F/scripts.inc
index 5acc683a4..ffca9c75f 100644
--- a/data/maps/MagmaHideout_4F/scripts.inc
+++ b/data/maps/MagmaHideout_4F/scripts.inc
@@ -1,3 +1,11 @@
+.set LOCALID_GROUDON, 1
+.set LOCALID_GRUNT_1, 2
+.set LOCALID_GRUNT_2, 3
+.set LOCALID_GRUNT_3, 4
+.set LOCALID_TABITHA, 5
+.set LOCALID_MAXIE, 6
+.set LOCALID_GROUDON_SLEEPING, 7
+
MagmaHideout_4F_MapScripts:: @ 823A55F
.byte 0
@@ -18,11 +26,11 @@ MagmaHideout_4F_EventScript_Maxie:: @ 823A560
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
delay 150
- removeobject 7 @ sleeping Groudon
- addobject 1 @ awakened Groudon
+ removeobject LOCALID_GROUDON_SLEEPING
+ addobject LOCALID_GROUDON
waitstate
delay 60
- applymovement 1, MagmaHideout_4F_Movement_GroudonApproach
+ applymovement LOCALID_GROUDON, MagmaHideout_4F_Movement_GroudonApproach
waitmovement 0
special FadeOutOrbEffect
waitstate
@@ -32,9 +40,9 @@ MagmaHideout_4F_EventScript_Maxie:: @ 823A560
setvar VAR_0x8007, 5 @ shake delay
special ShakeCamera
waitstate
- applymovement 1, MagmaHideout_4F_Movement_GroudonExit
+ applymovement LOCALID_GROUDON, MagmaHideout_4F_Movement_GroudonExit
waitmovement 0
- removeobject 1
+ removeobject LOCALID_GROUDON
delay 4
setvar VAR_0x8004, 2 @ vertical pan
setvar VAR_0x8005, 2 @ horizontal pan
@@ -43,14 +51,14 @@ MagmaHideout_4F_EventScript_Maxie:: @ 823A560
special ShakeCamera
waitstate
delay 30
- applymovement 6, MagmaHideout_4F_Movement_MaxieLookAround
+ applymovement LOCALID_MAXIE, MagmaHideout_4F_Movement_MaxieLookAround
waitmovement 0
msgbox MagmaHideout_4F_Text_MaxieGroudonWhatsWrong, MSGBOX_DEFAULT
closemessage
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
delay 30
- applymovement 6, Common_Movement_FacePlayer
+ applymovement LOCALID_MAXIE, Common_Movement_FacePlayer
waitmovement 0
msgbox MagmaHideout_4F_Text_MaxieOhItWasYou, MSGBOX_DEFAULT
closemessage
@@ -63,11 +71,11 @@ MagmaHideout_4F_EventScript_Maxie:: @ 823A560
setflag FLAG_GROUDON_AWAKENED_MAGMA_HIDEOUT
setvar VAR_SLATEPORT_HARBOR_STATE, 1
fadescreen FADE_TO_BLACK
- removeobject 6
- removeobject 2
- removeobject 3
- removeobject 4
- removeobject 5
+ removeobject LOCALID_MAXIE
+ removeobject LOCALID_GRUNT_1
+ removeobject LOCALID_GRUNT_2
+ removeobject LOCALID_GRUNT_3
+ removeobject LOCALID_TABITHA
setflag FLAG_HIDE_MAGMA_HIDEOUT_GRUNTS
fadescreen FADE_FROM_BLACK
releaseall
diff --git a/data/maps/MarineCave_End/scripts.inc b/data/maps/MarineCave_End/scripts.inc
index 6eaeb4b51..a6d894793 100644
--- a/data/maps/MarineCave_End/scripts.inc
+++ b/data/maps/MarineCave_End/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_KYOGRE, 1
+
MarineCave_End_MapScripts:: @ 823AFDF
map_script MAP_SCRIPT_ON_RESUME, MarineCave_End_OnResume
map_script MAP_SCRIPT_ON_TRANSITION, MarineCave_End_OnTransition
@@ -11,7 +13,7 @@ MarineCave_End_EventScript_TryRemoveKyogre:: @ 823AFF4
specialvar VAR_RESULT, GetBattleOutcome
compare VAR_RESULT, B_OUTCOME_CAUGHT
goto_if_ne Common_EventScript_NopReturn
- removeobject 1
+ removeobject LOCALID_KYOGRE
return
MarineCave_End_OnTransition: @ 823B008
@@ -27,13 +29,13 @@ MarineCave_End_EventScript_Kyogre:: @ 823B01B
lockall
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_FaceUp
waitmovement 0
- applymovement 1, MarineCave_End_Movement_KyogreApproach
+ applymovement LOCALID_KYOGRE, MarineCave_End_Movement_KyogreApproach
waitmovement 0
waitse
playmoncry SPECIES_KYOGRE, 2
delay 40
waitmoncry
- setvar VAR_LAST_TALKED, 1
+ setvar VAR_LAST_TALKED, LOCALID_KYOGRE
setwildbattle SPECIES_KYOGRE, 70, ITEM_NONE
setflag FLAG_SYS_CTRL_OBJ_DELETE
special BattleSetup_StartLegendaryBattle
diff --git a/data/maps/MauvilleCity/scripts.inc b/data/maps/MauvilleCity/scripts.inc
index 4994b8775..701c36159 100644
--- a/data/maps/MauvilleCity/scripts.inc
+++ b/data/maps/MauvilleCity/scripts.inc
@@ -1,3 +1,7 @@
+.set LOCALID_WALLY, 6
+.set LOCALID_WALLYS_UNCLE, 7
+.set LOCALID_SCOTT, 11
+
MauvilleCity_MapScripts:: @ 81DF385
map_script MAP_SCRIPT_ON_TRANSITION, MauvilleCity_OnTransition
.byte 0
@@ -70,7 +74,7 @@ MauvilleCity_EventScript_WallysUncle:: @ 81DF41D
goto_if_set FLAG_DECLINED_WALLY_BATTLE_MAUVILLE, MauvilleCity_EventScript_UncleAskPlayerToBattleWally
msgbox MauvilleCity_Text_UncleHesTooPeppy, MSGBOX_DEFAULT
closemessage
- applymovement 7, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_WALLYS_UNCLE, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -78,7 +82,7 @@ MauvilleCity_EventScript_WallysUncle:: @ 81DF41D
MauvilleCity_EventScript_UncleAskPlayerToBattleWally:: @ 81DF43D
msgbox MauvilleCity_Text_UncleCanYouBattleWally, MSGBOX_DEFAULT
closemessage
- applymovement 7, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_WALLYS_UNCLE, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -86,17 +90,17 @@ MauvilleCity_EventScript_UncleAskPlayerToBattleWally:: @ 81DF43D
MauvilleCity_EventScript_Wally:: @ 81DF452
lockall
goto_if_set FLAG_DECLINED_WALLY_BATTLE_MAUVILLE, MauvilleCity_EventScript_WallyRequestBattleAgain
- applymovement 6, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_WALLY, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
msgbox MauvilleCity_Text_WallyWantToChallengeGym, MSGBOX_DEFAULT
msgbox MauvilleCity_Text_UncleYourePushingIt, MSGBOX_DEFAULT
msgbox MauvilleCity_Text_WallyWeCanBeatAnyone, MSGBOX_DEFAULT
- applymovement 6, Common_Movement_FacePlayer
+ applymovement LOCALID_WALLY, Common_Movement_FacePlayer
waitmovement 0
playse SE_PIN
- applymovement 6, Common_Movement_ExclamationMark
+ applymovement LOCALID_WALLY, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 6, Common_Movement_Delay48
+ applymovement LOCALID_WALLY, Common_Movement_Delay48
waitmovement 0
msgbox MauvilleCity_Text_WallyWillYouBattleMe, MSGBOX_YESNO
goto MauvilleCity_EventScript_BattleWallyPrompt
@@ -115,46 +119,46 @@ MauvilleCity_EventScript_BattleWallyPrompt:: @ 81DF4AD
MauvilleCity_EventScript_WallyAndUncleExitNorth:: @ 81DF4E0
applymovement OBJ_EVENT_ID_PLAYER, MauvilleCity_Movement_PlayerWatchWallyExitNorth1
- applymovement 6, MauvilleCity_Movement_WallyExitNorth1
- applymovement 7, MauvilleCity_Movement_WallysUncleExitNorth1
+ applymovement LOCALID_WALLY, MauvilleCity_Movement_WallyExitNorth1
+ applymovement LOCALID_WALLYS_UNCLE, MauvilleCity_Movement_WallysUncleExitNorth1
waitmovement 0
- applymovement 6, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_WALLY, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
delay 30
applymovement OBJ_EVENT_ID_PLAYER, MauvilleCity_Movement_PlayerFaceUncleNorth
- applymovement 7, MauvilleCity_Movement_WallysUncleApproachPlayerNorth
+ applymovement LOCALID_WALLYS_UNCLE, MauvilleCity_Movement_WallysUncleApproachPlayerNorth
waitmovement 0
msgbox MauvilleCity_Text_UncleVisitUsSometime, MSGBOX_DEFAULT
closemessage
applymovement OBJ_EVENT_ID_PLAYER, MauvilleCity_Movement_PlayerWatchWallyExitNorth2
- applymovement 7, MauvilleCity_Movement_WallysUncleExitNorth2
- applymovement 6, MauvilleCity_Movement_WallyExitNorth2
+ applymovement LOCALID_WALLYS_UNCLE, MauvilleCity_Movement_WallysUncleExitNorth2
+ applymovement LOCALID_WALLY, MauvilleCity_Movement_WallyExitNorth2
waitmovement 0
goto MauvilleCity_EventScript_DefeatedWally
end
MauvilleCity_EventScript_WallyAndUncleExitEast:: @ 81DF53D
applymovement OBJ_EVENT_ID_PLAYER, MauvilleCity_Movement_PlayerWatchWallyExitEast1
- applymovement 6, MauvilleCity_Movement_WallyExitEast1
- applymovement 7, MauvilleCity_Movement_WallysUncleExitEast1
+ applymovement LOCALID_WALLY, MauvilleCity_Movement_WallyExitEast1
+ applymovement LOCALID_WALLYS_UNCLE, MauvilleCity_Movement_WallysUncleExitEast1
waitmovement 0
- applymovement 6, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_WALLY, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
delay 30
- applymovement 7, MauvilleCity_Movement_WallysUncleApproachPlayerEast
+ applymovement LOCALID_WALLYS_UNCLE, MauvilleCity_Movement_WallysUncleApproachPlayerEast
waitmovement 0
msgbox MauvilleCity_Text_UncleVisitUsSometime, MSGBOX_DEFAULT
closemessage
applymovement OBJ_EVENT_ID_PLAYER, MauvilleCity_Movement_PlayerWatchWallyExitEast2
- applymovement 7, MauvilleCity_Movement_WallysUncleExitEast2
- applymovement 6, MauvilleCity_Movement_WallyExitEast2
+ applymovement LOCALID_WALLYS_UNCLE, MauvilleCity_Movement_WallysUncleExitEast2
+ applymovement LOCALID_WALLY, MauvilleCity_Movement_WallyExitEast2
waitmovement 0
goto MauvilleCity_EventScript_DefeatedWally
end
MauvilleCity_EventScript_DefeatedWally:: @ 81DF593
- removeobject 6
- removeobject 7
+ removeobject LOCALID_WALLY
+ removeobject LOCALID_WALLYS_UNCLE
clearflag FLAG_HIDE_VERDANTURF_TOWN_WANDAS_HOUSE_WALLY
clearflag FLAG_HIDE_VERDANTURF_TOWN_WANDAS_HOUSE_WALLYS_UNCLE
setflag FLAG_DEFEATED_WALLY_MAUVILLE
@@ -173,45 +177,45 @@ MauvilleCity_EventScript_DefeatedWally:: @ 81DF593
call_if_eq MauvilleCity_EventScript_ScottExitNorth
compare VAR_FACING, DIR_EAST
call_if_eq MauvilleCity_EventScript_ScottExitEast
- removeobject 11
+ removeobject LOCALID_SCOTT
releaseall
end
MauvilleCity_EventScript_ScottApproachPlayerNorth:: @ 81DF5F3
- addobject 11
- applymovement 11, MauvilleCity_Movement_ScottApproachPlayerNorth
+ addobject LOCALID_SCOTT
+ applymovement LOCALID_SCOTT, MauvilleCity_Movement_ScottApproachPlayerNorth
waitmovement 0
return
MauvilleCity_EventScript_ScottApproachPlayerEast:: @ 81DF601
- setobjectxyperm 11, 12, 13
- addobject 11
- applymovement 11, MauvilleCity_Movement_ScottApproachPlayerEast
+ setobjectxyperm LOCALID_SCOTT, 12, 13
+ addobject LOCALID_SCOTT
+ applymovement LOCALID_SCOTT, MauvilleCity_Movement_ScottApproachPlayerEast
waitmovement 0
return
MauvilleCity_EventScript_ScottExitNorth:: @ 81DF616
applymovement OBJ_EVENT_ID_PLAYER, MauvilleCity_Movement_PlayerWatchScottExitNorth
- applymovement 11, MauvilleCity_Movement_ScottExitNorth
+ applymovement LOCALID_SCOTT, MauvilleCity_Movement_ScottExitNorth
waitmovement 0
return
MauvilleCity_EventScript_ScottExitEast:: @ 81DF628
applymovement OBJ_EVENT_ID_PLAYER, MauvilleCity_Movement_PlayerWatchScottExitEast
- applymovement 11, MauvilleCity_Movement_ScottExitEast
+ applymovement LOCALID_SCOTT, MauvilleCity_Movement_ScottExitEast
waitmovement 0
return
MauvilleCity_EventScript_BattleWally:: @ 81DF63A
msgbox MauvilleCity_Text_WallyHereICome, MSGBOX_DEFAULT
trainerbattle_no_intro TRAINER_WALLY_MAUVILLE, MauvilleCity_Text_WallyDefeat
- applymovement 6, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_WALLY, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
msgbox MauvilleCity_Text_WallyIllGoBackToVerdanturf, MSGBOX_DEFAULT
- applymovement 6, Common_Movement_FacePlayer
+ applymovement LOCALID_WALLY, Common_Movement_FacePlayer
waitmovement 0
msgbox MauvilleCity_Text_ThankYouNotEnoughToBattle, MSGBOX_DEFAULT
- applymovement 6, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_WALLY, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
msgbox MauvilleCity_Text_UncleNoNeedToBeDown, MSGBOX_DEFAULT
return
@@ -223,7 +227,7 @@ MauvilleCity_EventScript_DeclineWallyBattle:: @ 81DF683
end
MauvilleCity_EventScript_WallyRequestBattleAgain:: @ 81DF690
- applymovement 6, Common_Movement_FacePlayer
+ applymovement LOCALID_WALLY, Common_Movement_FacePlayer
waitmovement 0
msgbox MauvilleCity_Text_WallyPleaseBattleMe, MSGBOX_YESNO
goto MauvilleCity_EventScript_BattleWallyPrompt
diff --git a/data/maps/MauvilleCity_Gym/scripts.inc b/data/maps/MauvilleCity_Gym/scripts.inc
index 1a62fb9df..edf0a3129 100644
--- a/data/maps/MauvilleCity_Gym/scripts.inc
+++ b/data/maps/MauvilleCity_Gym/scripts.inc
@@ -116,7 +116,7 @@ MauvilleCity_Gym_EventScript_WattsonDefeated:: @ 820DF2B
MauvilleCity_Gym_EventScript_GiveShockWave2:: @ 820DF8D
giveitem ITEM_TM34
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_ShowBagIsFull
msgbox MauvilleCity_Gym_Text_ExplainShockWave, MSGBOX_DEFAULT
setflag FLAG_RECEIVED_TM34
@@ -125,7 +125,7 @@ MauvilleCity_Gym_EventScript_GiveShockWave2:: @ 820DF8D
MauvilleCity_Gym_EventScript_GiveShockWave:: @ 820DFB1
giveitem ITEM_TM34
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_BagIsFull
msgbox MauvilleCity_Gym_Text_ExplainShockWave, MSGBOX_DEFAULT
setflag FLAG_RECEIVED_TM34
diff --git a/data/maps/MauvilleCity_PokemonCenter_1F/scripts.inc b/data/maps/MauvilleCity_PokemonCenter_1F/scripts.inc
index ee13ffcfd..179dfad8a 100644
--- a/data/maps/MauvilleCity_PokemonCenter_1F/scripts.inc
+++ b/data/maps/MauvilleCity_PokemonCenter_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_NURSE, 1
+
MauvilleCity_PokemonCenter_1F_MapScripts:: @ 8210E5B
map_script MAP_SCRIPT_ON_TRANSITION, MauvilleCity_PokemonCenter_1F_OnTransition
map_script MAP_SCRIPT_ON_RESUME, CableClub_OnResume
@@ -13,9 +15,8 @@ MauvilleCity_PokemonCenter_1F_EventScript_SetMauvilleOldManGfx:: @ 8210E74
special ScrSpecial_SetMauvilleOldManObjEventGfx
end
-@ VAR_0x800B is the Nurse's object event id
MauvilleCity_PokemonCenter_1F_EventScript_Nurse:: @ 8210E78
- setvar VAR_0x800B, 1
+ setvar VAR_0x800B, LOCALID_NURSE
call Common_EventScript_PkmnCenterNurse
waitmessage
waitbuttonpress
diff --git a/data/maps/MeteorFalls_1F_1R/scripts.inc b/data/maps/MeteorFalls_1F_1R/scripts.inc
index c86d50d4d..56deaa353 100644
--- a/data/maps/MeteorFalls_1F_1R/scripts.inc
+++ b/data/maps/MeteorFalls_1F_1R/scripts.inc
@@ -1,3 +1,9 @@
+.set LOCALID_MAGMA_GRUNT_1, 5
+.set LOCALID_MAGMA_GRUNT_2, 6
+.set LOCALID_ARCHIE, 7
+.set LOCALID_AQUA_GRUNT_1, 8
+.set LOCALID_AQUA_GRUNT_2, 9
+
MeteorFalls_1F_1R_MapScripts:: @ 822BD2A
map_script MAP_SCRIPT_ON_LOAD, MeteorFalls_1F_1R_OnLoad
.byte 0
@@ -19,70 +25,70 @@ MeteorFalls_1F_1R_EventScript_MagmaStealsMeteoriteScene:: @ 822BD5F
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_FaceDown
waitmovement 0
delay 30
- applymovement 5, Common_Movement_WalkInPlaceDown
+ applymovement LOCALID_MAGMA_GRUNT_1, Common_Movement_WalkInPlaceDown
waitmovement 0
msgbox MeteorFalls_1F_1R_Text_WithThisMeteorite, MSGBOX_DEFAULT
closemessage
- applymovement 5, Common_Movement_WalkInPlaceFastestUp
- applymovement 6, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_MAGMA_GRUNT_1, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_MAGMA_GRUNT_2, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
playse SE_PIN
- applymovement 5, Common_Movement_ExclamationMark
+ applymovement LOCALID_MAGMA_GRUNT_1, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 5, Common_Movement_Delay48
+ applymovement LOCALID_MAGMA_GRUNT_1, Common_Movement_Delay48
waitmovement 0
msgbox MeteorFalls_1F_1R_Text_DontExpectMercyFromMagma, MSGBOX_DEFAULT
closemessage
- applymovement 5, MeteorFalls_1F_1R_Movement_MagmaGruntApproachPlayer
+ applymovement LOCALID_MAGMA_GRUNT_1, MeteorFalls_1F_1R_Movement_MagmaGruntApproachPlayer
waitmovement 0
msgbox MeteorFalls_1F_1R_Text_HoldItRightThereMagma, MSGBOX_DEFAULT
closemessage
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
- applymovement 5, Common_Movement_WalkInPlaceFastestLeft
- applymovement 6, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_MAGMA_GRUNT_1, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_MAGMA_GRUNT_2, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
- addobject 7
- addobject 8
- addobject 9
+ addobject LOCALID_ARCHIE
+ addobject LOCALID_AQUA_GRUNT_1
+ addobject LOCALID_AQUA_GRUNT_2
playbgm MUS_AQA_0, 0
- applymovement 7, MeteorFalls_1F_1R_Movement_ArchieArrive
- applymovement 8, MeteorFalls_1F_1R_Movement_AquaGrunt1Arrive
- applymovement 9, MeteorFalls_1F_1R_Movement_AquaGrunt2Arrive
+ applymovement LOCALID_ARCHIE, MeteorFalls_1F_1R_Movement_ArchieArrive
+ applymovement LOCALID_AQUA_GRUNT_1, MeteorFalls_1F_1R_Movement_AquaGrunt1Arrive
+ applymovement LOCALID_AQUA_GRUNT_2, MeteorFalls_1F_1R_Movement_AquaGrunt2Arrive
waitmovement 0
- applymovement 5, Common_Movement_WalkInPlaceFastestLeft
- applymovement 6, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_MAGMA_GRUNT_1, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_MAGMA_GRUNT_2, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
msgbox MeteorFalls_1F_1R_Text_BeSeeingYouTeamAqua, MSGBOX_DEFAULT
closemessage
applymovement OBJ_EVENT_ID_PLAYER, MeteorFalls_1F_1R_Movement_PushPlayerOutOfWay
- applymovement 5, MeteorFalls_1F_1R_Movement_MagmaGrunt1Exit
- applymovement 6, MeteorFalls_1F_1R_Movement_MagmaGrunt2Exit
+ applymovement LOCALID_MAGMA_GRUNT_1, MeteorFalls_1F_1R_Movement_MagmaGrunt1Exit
+ applymovement LOCALID_MAGMA_GRUNT_2, MeteorFalls_1F_1R_Movement_MagmaGrunt2Exit
waitmovement 0
- removeobject 5
- removeobject 6
- applymovement 7, MeteorFalls_1F_1R_Movement_ArchieApproachPlayer
+ removeobject LOCALID_MAGMA_GRUNT_1
+ removeobject LOCALID_MAGMA_GRUNT_2
+ applymovement LOCALID_ARCHIE, MeteorFalls_1F_1R_Movement_ArchieApproachPlayer
waitmovement 0
msgbox MeteorFalls_1F_1R_Text_ArchieSeenYouBefore, MSGBOX_DEFAULT
closemessage
- applymovement 8, MeteorFalls_1F_1R_Movement_AquaGrunt1ApproachArchie
- applymovement 9, MeteorFalls_1F_1R_Movement_AquaGrunt2ApproachArchie
+ applymovement LOCALID_AQUA_GRUNT_1, MeteorFalls_1F_1R_Movement_AquaGrunt1ApproachArchie
+ applymovement LOCALID_AQUA_GRUNT_2, MeteorFalls_1F_1R_Movement_AquaGrunt2ApproachArchie
waitmovement 0
msgbox MeteorFalls_1F_1R_Text_BossWeShouldChaseMagma, MSGBOX_DEFAULT
- applymovement 7, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_ARCHIE, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
msgbox MeteorFalls_1F_1R_Text_ArchieYesNoTellingWhatMagmaWillDo, MSGBOX_DEFAULT
- applymovement 7, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_ARCHIE, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
msgbox MeteorFalls_1F_1R_Text_ArchieFarewell, MSGBOX_DEFAULT
closemessage
- applymovement 7, MeteorFalls_1F_1R_Movement_ArchieExit
- applymovement 8, MeteorFalls_1F_1R_Movement_AquaGrunt1Exit
- applymovement 9, MeteorFalls_1F_1R_Movement_AquaGrunt2Exit
+ applymovement LOCALID_ARCHIE, MeteorFalls_1F_1R_Movement_ArchieExit
+ applymovement LOCALID_AQUA_GRUNT_1, MeteorFalls_1F_1R_Movement_AquaGrunt1Exit
+ applymovement LOCALID_AQUA_GRUNT_2, MeteorFalls_1F_1R_Movement_AquaGrunt2Exit
waitmovement 0
fadedefaultbgm
- removeobject 7
- removeobject 8
- removeobject 9
+ removeobject LOCALID_ARCHIE
+ removeobject LOCALID_AQUA_GRUNT_1
+ removeobject LOCALID_AQUA_GRUNT_2
setflag FLAG_HIDE_ROUTE_112_TEAM_MAGMA
setflag FLAG_MET_ARCHIE_METEOR_FALLS
setflag FLAG_HIDE_FALLARBOR_TOWN_BATTLE_TENT_SCOTT
diff --git a/data/maps/MeteorFalls_StevensCave/scripts.inc b/data/maps/MeteorFalls_StevensCave/scripts.inc
index 71313be67..9ccc2ca68 100644
--- a/data/maps/MeteorFalls_StevensCave/scripts.inc
+++ b/data/maps/MeteorFalls_StevensCave/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_STEVEN, 1
+
MeteorFalls_StevensCave_MapScripts:: @ 823B181
.byte 0
@@ -6,11 +8,11 @@ MeteorFalls_StevensCave_EventScript_Steven:: @ 823B182
goto_if_set FLAG_DEFEATED_METEOR_FALLS_STEVEN, MeteorFalls_StevensCave_EventScript_Defeated
waitse
playse SE_PIN
- applymovement 1, Common_Movement_ExclamationMark
+ applymovement LOCALID_STEVEN, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 1, Common_Movement_Delay48
+ applymovement LOCALID_STEVEN, Common_Movement_Delay48
waitmovement 0
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_STEVEN, Common_Movement_FacePlayer
waitmovement 0
msgbox MeteorFalls_StevensCave_Text_ShouldKnowHowGoodIAmExpectWorst, MSGBOX_DEFAULT
trainerbattle_no_intro TRAINER_STEVEN, MeteorFalls_StevensCave_Text_StevenDefeat
@@ -20,7 +22,7 @@ MeteorFalls_StevensCave_EventScript_Steven:: @ 823B182
end
MeteorFalls_StevensCave_EventScript_Defeated:: @ 823B1CD
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_STEVEN, Common_Movement_FacePlayer
waitmovement 0
msgbox MeteorFalls_StevensCave_Text_MyPredictionCameTrue, MSGBOX_DEFAULT
release
diff --git a/data/maps/MirageTower_4F/scripts.inc b/data/maps/MirageTower_4F/scripts.inc
index ceb78ab45..a258f9dec 100644
--- a/data/maps/MirageTower_4F/scripts.inc
+++ b/data/maps/MirageTower_4F/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_ROOT_FOSSIL, 1
+.set LOCALID_CLAW_FOSSIL, 2
+
MirageTower_4F_MapScripts:: @ 823AD47
.byte 0
@@ -11,7 +14,7 @@ MirageTower_4F_EventScript_RootFossil:: @ 823AD48
closemessage
setflag FLAG_HIDE_MIRAGE_TOWER_ROOT_FOSSIL
setflag FLAG_HIDE_MIRAGE_TOWER_CLAW_FOSSIL
- removeobject 1
+ removeobject LOCALID_ROOT_FOSSIL
delay 30
setflag FLAG_CHOSE_ROOT_FOSSIL
goto MirageTower_4F_EventScript_CollapseMirageTower
@@ -32,7 +35,7 @@ MirageTower_4F_EventScript_ClawFossil:: @ 823AD89
closemessage
setflag FLAG_HIDE_MIRAGE_TOWER_CLAW_FOSSIL
setflag FLAG_HIDE_MIRAGE_TOWER_ROOT_FOSSIL
- removeobject 2
+ removeobject LOCALID_CLAW_FOSSIL
delay 30
setflag FLAG_CHOSE_CLAW_FOSSIL
goto MirageTower_4F_EventScript_CollapseMirageTower
diff --git a/data/maps/MossdeepCity/scripts.inc b/data/maps/MossdeepCity/scripts.inc
index fd5c69962..963635ccd 100644
--- a/data/maps/MossdeepCity/scripts.inc
+++ b/data/maps/MossdeepCity/scripts.inc
@@ -1,3 +1,10 @@
+.set LOCALID_GRUNT_1, 10
+.set LOCALID_GRUNT_2, 11
+.set LOCALID_GRUNT_3, 12
+.set LOCALID_GRUNT_4, 13
+.set LOCALID_MAXIE, 14
+.set LOCALID_SCOTT, 16
+
MossdeepCity_MapScripts:: @ 81E4A96
map_script MAP_SCRIPT_ON_TRANSITION, MossdeepCity_OnTransition
.byte 0
@@ -75,24 +82,24 @@ MossdeepCity_EventScript_VisitedMossdeep:: @ 81E4B38
MossdeepCity_EventScript_TeamMagmaEnterSpaceCenter:: @ 81E4B41
lockall
- applymovement 14, MossdeepCity_Movement_MaxieGestureToSpaceCenter
+ applymovement LOCALID_MAXIE, MossdeepCity_Movement_MaxieGestureToSpaceCenter
waitmovement 0
- applymovement 10, MossdeepCity_Movement_GruntFaceSpaceCenter
- applymovement 11, MossdeepCity_Movement_GruntFaceSpaceCenter
- applymovement 12, MossdeepCity_Movement_GruntFaceSpaceCenter
- applymovement 13, MossdeepCity_Movement_GruntFaceSpaceCenter
+ applymovement LOCALID_GRUNT_1, MossdeepCity_Movement_GruntFaceSpaceCenter
+ applymovement LOCALID_GRUNT_2, MossdeepCity_Movement_GruntFaceSpaceCenter
+ applymovement LOCALID_GRUNT_3, MossdeepCity_Movement_GruntFaceSpaceCenter
+ applymovement LOCALID_GRUNT_4, MossdeepCity_Movement_GruntFaceSpaceCenter
waitmovement 0
- applymovement 14, MossdeepCity_Movement_MaxieEnterSpaceCenter
- applymovement 10, MossdeepCity_Movement_Grunt1EnterSpaceCenter
- applymovement 11, MossdeepCity_Movement_Grunt2EnterSpaceCenter
- applymovement 12, MossdeepCity_Movement_Grunt3EnterSpaceCenter
- applymovement 13, MossdeepCity_Movement_Grunt4EnterSpaceCenter
+ applymovement LOCALID_MAXIE, MossdeepCity_Movement_MaxieEnterSpaceCenter
+ applymovement LOCALID_GRUNT_1, MossdeepCity_Movement_Grunt1EnterSpaceCenter
+ applymovement LOCALID_GRUNT_2, MossdeepCity_Movement_Grunt2EnterSpaceCenter
+ applymovement LOCALID_GRUNT_3, MossdeepCity_Movement_Grunt3EnterSpaceCenter
+ applymovement LOCALID_GRUNT_4, MossdeepCity_Movement_Grunt4EnterSpaceCenter
waitmovement 0
- removeobject 14
- removeobject 10
- removeobject 11
- removeobject 12
- removeobject 13
+ removeobject LOCALID_MAXIE
+ removeobject LOCALID_GRUNT_1
+ removeobject LOCALID_GRUNT_2
+ removeobject LOCALID_GRUNT_3
+ removeobject LOCALID_GRUNT_4
delay 30
setvar VAR_MOSSDEEP_CITY_STATE, 2
setflag FLAG_HIDE_MOSSDEEP_CITY_TEAM_MAGMA
@@ -260,19 +267,19 @@ MossdeepCity_EventScript_Scott:: @ 81E4C85
compare VAR_FACING, DIR_EAST
call_if_eq MossdeepCity_EventScript_ScottExitEast
addvar VAR_SCOTT_STATE, 1
- removeobject 16
+ removeobject LOCALID_SCOTT
release
end
MossdeepCity_EventScript_ScottExitNorth:: @ 81E4CB0
applymovement OBJ_EVENT_ID_PLAYER, MossdeepCity_Movement_PlayerWatchScottExit
- applymovement 16, MossdeepCity_Movement_ScottExitNorth
+ applymovement LOCALID_SCOTT, MossdeepCity_Movement_ScottExitNorth
waitmovement 0
return
MossdeepCity_EventScript_ScottExitEast:: @ 81E4CC2
applymovement OBJ_EVENT_ID_PLAYER, MossdeepCity_Movement_PlayerWatchScottExit
- applymovement 16, MossdeepCity_Movement_ScottExitEast
+ applymovement LOCALID_SCOTT, MossdeepCity_Movement_ScottExitEast
waitmovement 0
return
diff --git a/data/maps/MossdeepCity_Gym/scripts.inc b/data/maps/MossdeepCity_Gym/scripts.inc
index 7e78e3d9f..d8bff6dd1 100644
--- a/data/maps/MossdeepCity_Gym/scripts.inc
+++ b/data/maps/MossdeepCity_Gym/scripts.inc
@@ -92,7 +92,7 @@ MossdeepCity_Gym_EventScript_TateAndLizaDefeated:: @ 82208D1
MossdeepCity_Gym_EventScript_GiveCalmMind2:: @ 8220937
giveitem ITEM_TM04
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_ShowBagIsFull
msgbox MossdeepCity_Gym_Text_ExplainCalmMind, MSGBOX_DEFAULT
setflag FLAG_RECEIVED_TM04
@@ -101,7 +101,7 @@ MossdeepCity_Gym_EventScript_GiveCalmMind2:: @ 8220937
MossdeepCity_Gym_EventScript_GiveCalmMind:: @ 822095B
giveitem ITEM_TM04
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_BagIsFull
msgbox MossdeepCity_Gym_Text_ExplainCalmMind, MSGBOX_DEFAULT
setflag FLAG_RECEIVED_TM04
diff --git a/data/maps/MossdeepCity_House2/scripts.inc b/data/maps/MossdeepCity_House2/scripts.inc
index 8f77aede2..5e4b3b342 100644
--- a/data/maps/MossdeepCity_House2/scripts.inc
+++ b/data/maps/MossdeepCity_House2/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_WINGULL, 3
+
MossdeepCity_House2_MapScripts:: @ 82220DE
.byte 0
@@ -23,17 +25,17 @@ MossdeepCity_House2_EventScript_Wingull:: @ 82220F1
call_if_eq MossdeepCity_House2_EventScript_WingullExitNorth
compare VAR_FACING, DIR_WEST
call_if_eq MossdeepCity_House2_EventScript_WingullExitWest
- removeobject 3
+ removeobject LOCALID_WINGULL
release
end
MossdeepCity_House2_EventScript_WingullExitNorth:: @ 8222124
- applymovement 3, MossdeepCity_House2_Movement_WingullExitNorth
+ applymovement LOCALID_WINGULL, MossdeepCity_House2_Movement_WingullExitNorth
waitmovement 0
return
MossdeepCity_House2_EventScript_WingullExitWest:: @ 822212F
- applymovement 3, MossdeepCity_House2_Movement_WingullExitEast
+ applymovement LOCALID_WINGULL, MossdeepCity_House2_Movement_WingullExitEast
waitmovement 0
return
diff --git a/data/maps/MossdeepCity_PokemonCenter_1F/scripts.inc b/data/maps/MossdeepCity_PokemonCenter_1F/scripts.inc
index 49c31dc6b..7cefc796a 100644
--- a/data/maps/MossdeepCity_PokemonCenter_1F/scripts.inc
+++ b/data/maps/MossdeepCity_PokemonCenter_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_NURSE, 1
+
MossdeepCity_PokemonCenter_1F_MapScripts:: @ 822223F
map_script MAP_SCRIPT_ON_TRANSITION, MossdeepCity_PokemonCenter_1F_OnTransition
map_script MAP_SCRIPT_ON_RESUME, CableClub_OnResume
@@ -7,9 +9,8 @@ MossdeepCity_PokemonCenter_1F_OnTransition: @ 822224A
setrespawn HEAL_LOCATION_MOSSDEEP_CITY
end
-@ VAR_0x800B is the Nurse's object event id
MossdeepCity_PokemonCenter_1F_EventScript_Nurse:: @ 822224E
- setvar VAR_0x800B, 1
+ setvar VAR_0x800B, LOCALID_NURSE
call Common_EventScript_PkmnCenterNurse
waitmessage
waitbuttonpress
diff --git a/data/maps/MossdeepCity_SpaceCenter_1F/scripts.inc b/data/maps/MossdeepCity_SpaceCenter_1F/scripts.inc
index 05c14f11a..667f44114 100644
--- a/data/maps/MossdeepCity_SpaceCenter_1F/scripts.inc
+++ b/data/maps/MossdeepCity_SpaceCenter_1F/scripts.inc
@@ -1,3 +1,10 @@
+.set LOCALID_SCIENTIST_1, 1
+.set LOCALID_SCIENTIST_2, 2
+.set LOCALID_SAILOR, 3
+.set LOCALID_OLD_MAN, 4
+.set LOCALID_WOMAN, 5
+.set LOCALID_STAIR_GRUNT, 9
+
MossdeepCity_SpaceCenter_1F_MapScripts:: @ 8222F41
map_script MAP_SCRIPT_ON_LOAD, MossdeepCity_SpaceCenter_1F_OnLoad
map_script MAP_SCRIPT_ON_TRANSITION, MossdeepCity_SpaceCenter_1F_OnTransition
@@ -9,15 +16,15 @@ MossdeepCity_SpaceCenter_1F_OnTransition: @ 8222F4C
end
MossdeepCity_SpaceCenter_1F_EventScript_MoveObjectsForTeamMagma:: @ 8222F58
- setobjectxyperm 3, 1, 9
- setobjectmovementtype 3, MOVEMENT_TYPE_FACE_RIGHT
- setobjectxyperm 5, 0, 8
- setobjectmovementtype 5, MOVEMENT_TYPE_FACE_RIGHT
- setobjectxyperm 4, 1, 6
- setobjectmovementtype 4, MOVEMENT_TYPE_FACE_RIGHT
- setobjectxyperm 1, 3, 4
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_RIGHT
- setobjectmovementtype 2, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_SAILOR, 1, 9
+ setobjectmovementtype LOCALID_SAILOR, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_WOMAN, 0, 8
+ setobjectmovementtype LOCALID_WOMAN, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_OLD_MAN, 1, 6
+ setobjectmovementtype LOCALID_OLD_MAN, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_SCIENTIST_1, 3, 4
+ setobjectmovementtype LOCALID_SCIENTIST_1, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectmovementtype LOCALID_SCIENTIST_2, MOVEMENT_TYPE_FACE_RIGHT
compare VAR_MOSSDEEP_SPACE_CENTER_STAIR_GUARD_STATE, 1
goto_if_eq MossdeepCity_SpaceCenter_1F_EventScript_MoveStairGuardLeft
compare VAR_MOSSDEEP_SPACE_CENTER_STAIR_GUARD_STATE, 2
@@ -27,16 +34,16 @@ MossdeepCity_SpaceCenter_1F_EventScript_MoveObjectsForTeamMagma:: @ 8222F58
end
MossdeepCity_SpaceCenter_1F_EventScript_MoveStairGuardLeft:: @ 8222FAA
- setobjectxyperm 9, 12, 2
+ setobjectxyperm LOCALID_STAIR_GRUNT, 12, 2
end
MossdeepCity_SpaceCenter_1F_EventScript_MoveStairGuardDown:: @ 8222FB2
- setobjectxyperm 9, 13, 3
+ setobjectxyperm LOCALID_STAIR_GRUNT, 13, 3
end
@ Functionally unused. See comment on MossdeepCity_SpaceCenter_1F_EventScript_MoveGruntFromStairsEast
MossdeepCity_SpaceCenter_1F_EventScript_MoveStairGuardRight:: @ 8222FBA
- setobjectxyperm 9, 14, 2
+ setobjectxyperm LOCALID_STAIR_GRUNT, 14, 2
end
MossdeepCity_SpaceCenter_1F_OnLoad: @ 8222FC2
@@ -120,7 +127,7 @@ MossdeepCity_SpaceCenter_1F_EventScript_SunStoneMan:: @ 822308E
goto_if_set FLAG_RECEIVED_SUN_STONE_MOSSDEEP, MossdeepCity_SpaceCenter_1F_EventScript_GaveSunStone
msgbox MossdeepCity_SpaceCenter_1F_Text_FoundThisYouCanHaveIt, MSGBOX_DEFAULT
giveitem ITEM_SUN_STONE
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_ShowBagIsFull
setflag FLAG_RECEIVED_SUN_STONE_MOSSDEEP
msgbox MossdeepCity_SpaceCenter_1F_Text_HoennFamousForMeteorShowers, MSGBOX_DEFAULT
@@ -136,7 +143,7 @@ MossdeepCity_SpaceCenter_1F_EventScript_SunStoneManMagma:: @ 82230DA
goto_if_set FLAG_RECEIVED_SUN_STONE_MOSSDEEP, MossdeepCity_SpaceCenter_1F_EventScript_GaveSunStoneMagma
msgbox MossdeepCity_SpaceCenter_1F_Text_MagmaCantStealFuelTakeThis, MSGBOX_DEFAULT
giveitem ITEM_SUN_STONE
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_ShowBagIsFull
setflag FLAG_RECEIVED_SUN_STONE_MOSSDEEP
msgbox MossdeepCity_SpaceCenter_1F_Text_CantStrollOnBeachWithMagma, MSGBOX_DEFAULT
@@ -237,11 +244,11 @@ MossdeepCity_SpaceCenter_1F_EventScript_Grunt2:: @ 822321F
msgbox MossdeepCity_SpaceCenter_1F_Text_Grunt2Intro, MSGBOX_DEFAULT
trainerbattle_no_intro TRAINER_GRUNT_SPACE_CENTER_2, MossdeepCity_SpaceCenter_1F_Text_Grunt2Defeat
setflag FLAG_DEFEATED_GRUNT_SPACE_CENTER_1F
- copyobjectxytoperm 9
+ copyobjectxytoperm LOCALID_STAIR_GRUNT
switch VAR_FACING
case DIR_WEST, MossdeepCity_SpaceCenter_1F_EventScript_MoveGruntFromStairsWest
case DIR_WEST, MossdeepCity_SpaceCenter_1F_EventScript_MoveGruntFromStairsEast @ BUG: This was meant to be case DIR_EAST
- applymovement 9, MossdeepCity_SpaceCenter_1F_Movement_MoveGruntFromStairs
+ applymovement LOCALID_STAIR_GRUNT, MossdeepCity_SpaceCenter_1F_Movement_MoveGruntFromStairs
waitmovement 0
setvar VAR_MOSSDEEP_SPACE_CENTER_STAIR_GUARD_STATE, 2
release
@@ -253,7 +260,7 @@ MossdeepCity_SpaceCenter_1F_EventScript_Grunt2Defeated:: @ 822326E
end
MossdeepCity_SpaceCenter_1F_EventScript_MoveGruntFromStairsWest:: @ 8223278
- applymovement 9, MossdeepCity_SpaceCenter_1F_Movement_MoveGruntFromStairsWest
+ applymovement LOCALID_STAIR_GRUNT, MossdeepCity_SpaceCenter_1F_Movement_MoveGruntFromStairsWest
waitmovement 0
setvar VAR_MOSSDEEP_SPACE_CENTER_STAIR_GUARD_STATE, 1
release
@@ -262,7 +269,7 @@ MossdeepCity_SpaceCenter_1F_EventScript_MoveGruntFromStairsWest:: @ 8223278
@ Functionally unused by mistake. The movement is handled anyway after the switch (see above)
@ This also means VAR_MOSSDEEP_SPACE_CENTER_STAIR_GUARD_STATE can never be 3
MossdeepCity_SpaceCenter_1F_EventScript_MoveGruntFromStairsEast:: @ 8223289
- applymovement 9, MossdeepCity_SpaceCenter_1F_Movement_MoveGruntFromStairsEast
+ applymovement LOCALID_STAIR_GRUNT, MossdeepCity_SpaceCenter_1F_Movement_MoveGruntFromStairsEast
waitmovement 0
setvar VAR_MOSSDEEP_SPACE_CENTER_STAIR_GUARD_STATE, 3
release
diff --git a/data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc b/data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc
index 73908ab53..6c9d4a905 100644
--- a/data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc
+++ b/data/maps/MossdeepCity_SpaceCenter_2F/scripts.inc
@@ -1,3 +1,14 @@
+.set LOCALID_RICH_BOY, 1
+.set LOCALID_GENTLEMAN, 2
+.set LOCALID_SCIENTIST, 3
+.set LOCALID_STEVEN, 4
+@ Grunt names numbered like their Trainer values (which are for the full Space Center)
+.set LOCALID_GRUNT_6, 5
+.set LOCALID_GRUNT_5, 6
+.set LOCALID_GRUNT_7, 7
+.set LOCALID_TABITHA, 8
+.set LOCALID_MAXIE, 9
+
MossdeepCity_SpaceCenter_2F_MapScripts:: @ 8223D58
map_script MAP_SCRIPT_ON_TRANSITION, MossdeepCity_SpaceCenter_2F_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, MossdeepCity_SpaceCenter_2F_OnFrame
@@ -5,25 +16,25 @@ MossdeepCity_SpaceCenter_2F_MapScripts:: @ 8223D58
MossdeepCity_SpaceCenter_2F_OnTransition: @ 8223D63
compare VAR_MOSSDEEP_CITY_STATE, 2
- call_if_eq MossdeepCity_SpaceCenter_2F_EventScript_MoveStevenMaxieTabitha
+ call_if_eq MossdeepCity_SpaceCenter_2F_EventScript_MoveCivilians
compare VAR_MOSSDEEP_SPACE_CENTER_STATE, 2
call_if_eq MossdeepCity_SpaceCenter_2F_EventScript_MoveDefeatedGrunts
end
-MossdeepCity_SpaceCenter_2F_EventScript_MoveStevenMaxieTabitha:: @ 8223D7A
+MossdeepCity_SpaceCenter_2F_EventScript_MoveCivilians:: @ 8223D7A
clearflag FLAG_INTERACTED_WITH_STEVEN_SPACE_CENTER
- setobjectxyperm 3, 5, 3
- setobjectmovementtype 3, MOVEMENT_TYPE_FACE_RIGHT
- setobjectxyperm 1, 3, 2
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_RIGHT
- setobjectxyperm 2, 1, 3
- setobjectmovementtype 2, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_SCIENTIST, 5, 3
+ setobjectmovementtype LOCALID_SCIENTIST, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_RICH_BOY, 3, 2
+ setobjectmovementtype LOCALID_RICH_BOY, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_GENTLEMAN, 1, 3
+ setobjectmovementtype LOCALID_GENTLEMAN, MOVEMENT_TYPE_FACE_RIGHT
return
MossdeepCity_SpaceCenter_2F_EventScript_MoveDefeatedGrunts:: @ 8223D9F
- setobjectxyperm 5, 11, 2
- setobjectxyperm 7, 15, 2
- setobjectxyperm 6, 13, 4
+ setobjectxyperm LOCALID_GRUNT_6, 11, 2
+ setobjectxyperm LOCALID_GRUNT_7, 15, 2
+ setobjectxyperm LOCALID_GRUNT_5, 13, 4
return
MossdeepCity_SpaceCenter_2F_OnFrame: @ 8223DB5
@@ -55,24 +66,24 @@ MossdeepCity_SpaceCenter_2F_Movement_PlayerExit: @ 8223E07
MossdeepCity_SpaceCenter_2F_EventScript_BattleThreeMagmaGrunts:: @ 8223E09
msgbox MossdeepCity_SpaceCenter_2F_Text_Grunt5Intro, MSGBOX_DEFAULT
trainerbattle_no_intro TRAINER_GRUNT_SPACE_CENTER_5, MossdeepCity_SpaceCenter_2F_Text_Grunt5Defeat
- applymovement 6, MossdeepCity_SpaceCenter_2F_Movement_Grunt5Defeated
+ applymovement LOCALID_GRUNT_5, MossdeepCity_SpaceCenter_2F_Movement_Grunt5Defeated
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
msgbox MossdeepCity_SpaceCenter_2F_Text_Grunt6Intro, MSGBOX_DEFAULT
trainerbattle_no_intro TRAINER_GRUNT_SPACE_CENTER_6, MossdeepCity_SpaceCenter_2F_Text_Grunt6Defeat
- applymovement 5, MossdeepCity_SpaceCenter_2F_Movement_Grunt6Defeated
+ applymovement LOCALID_GRUNT_6, MossdeepCity_SpaceCenter_2F_Movement_Grunt6Defeated
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
msgbox MossdeepCity_SpaceCenter_2F_Text_Grunt7Intro, MSGBOX_DEFAULT
trainerbattle_no_intro TRAINER_GRUNT_SPACE_CENTER_7, MossdeepCity_SpaceCenter_2F_Text_Grunt7Defeat
- applymovement 7, MossdeepCity_SpaceCenter_2F_Movement_Grunt7Defeated
+ applymovement LOCALID_GRUNT_7, MossdeepCity_SpaceCenter_2F_Movement_Grunt7Defeated
waitmovement 0
setvar VAR_MOSSDEEP_SPACE_CENTER_STATE, 2
- copyobjectxytoperm 5
- copyobjectxytoperm 7
- copyobjectxytoperm 6
+ copyobjectxytoperm LOCALID_GRUNT_6
+ copyobjectxytoperm LOCALID_GRUNT_7
+ copyobjectxytoperm LOCALID_GRUNT_5
releaseall
end
@@ -196,13 +207,13 @@ MossdeepCity_SpaceCenter_2F_EventScript_Steven:: @ 8223F7A
playse SE_KOUKA_L
switch VAR_FACING
case DIR_SOUTH, MossdeepCity_SpaceCenter_2F_EventScript_StevenFightMovementSouth
- applymovement 4, MossdeepCity_SpaceCenter_2F_Movement_StevenFight
+ applymovement LOCALID_STEVEN, MossdeepCity_SpaceCenter_2F_Movement_StevenFight
waitmovement 0
releaseall
end
MossdeepCity_SpaceCenter_2F_EventScript_StevenFightMovementSouth:: @ 8223FBA
- applymovement 4, MossdeepCity_SpaceCenter_2F_Movement_StevenFightSouth
+ applymovement LOCALID_STEVEN, MossdeepCity_SpaceCenter_2F_Movement_StevenFightSouth
waitmovement 0
releaseall
end
@@ -275,12 +286,12 @@ MossdeepCity_SpaceCenter_2F_EventScript_DefeatedMaxieTabitha:: @ 8224071
msgbox MossdeepCity_SpaceCenter_2F_Text_MaxieWeFailedIsAquaAlsoMisguided, MSGBOX_DEFAULT
closemessage
delay 20
- applymovement 9, Common_Movement_WalkInPlaceFastestLeft
- applymovement 8, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_MAXIE, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_TABITHA, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
delay 60
- applymovement 9, Common_Movement_WalkInPlaceFastestUp
- applymovement 8, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_MAXIE, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_TABITHA, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
delay 20
msgbox MossdeepCity_SpaceCenter_2F_Text_MaxieWeWillGiveUp, MSGBOX_DEFAULT
@@ -292,17 +303,17 @@ MossdeepCity_SpaceCenter_2F_EventScript_DefeatedMaxieTabitha:: @ 8224071
setflag FLAG_HIDE_MOSSDEEP_CITY_SPACE_CENTER_1F_TEAM_MAGMA
setflag FLAG_HIDE_MOSSDEEP_CITY_SPACE_CENTER_2F_TEAM_MAGMA
setflag FLAG_HIDE_MOSSDEEP_CITY_TEAM_MAGMA
- removeobject 5
- removeobject 7
- removeobject 6
- removeobject 8
- removeobject 9
- setobjectxy 3, 5, 6
- turnobject 3, DIR_SOUTH
- setobjectxy 2, 11, 8
- turnobject 2, DIR_NORTH
- setobjectxy 1, 6, 2
- turnobject 1, DIR_NORTH
+ removeobject LOCALID_GRUNT_6
+ removeobject LOCALID_GRUNT_7
+ removeobject LOCALID_GRUNT_5
+ removeobject LOCALID_TABITHA
+ removeobject LOCALID_MAXIE
+ setobjectxy LOCALID_SCIENTIST, 5, 6
+ turnobject LOCALID_SCIENTIST, DIR_SOUTH
+ setobjectxy LOCALID_GENTLEMAN, 11, 8
+ turnobject LOCALID_GENTLEMAN, DIR_NORTH
+ setobjectxy LOCALID_RICH_BOY, 6, 2
+ turnobject LOCALID_RICH_BOY, DIR_NORTH
call MossdeepCity_SpaceCenter_2F_EventScript_StevenFacePlayer
fadescreen FADE_FROM_BLACK
msgbox MossdeepCity_SpaceCenter_2F_Text_StevenThankYouComeSeeMeAtHome, MSGBOX_DEFAULT
@@ -310,15 +321,15 @@ MossdeepCity_SpaceCenter_2F_EventScript_DefeatedMaxieTabitha:: @ 8224071
fadescreen FADE_TO_BLACK
setflag FLAG_DEFEATED_MAGMA_SPACE_CENTER
setflag FLAG_HIDE_MOSSDEEP_CITY_STEVENS_HOUSE_STEVEN
- removeobject 4
+ removeobject LOCALID_STEVEN
setflag FLAG_HIDE_MOSSDEEP_CITY_SPACE_CENTER_MAGMA_NOTE
clearflag FLAG_HIDE_MOSSDEEP_CITY_STEVENS_HOUSE_STEVEN
setvar VAR_STEVENS_HOUSE_STATE, 1
setflag FLAG_HIDE_MOSSDEEP_CITY_SCOTT
- removeobject 3
- setobjectxyperm 3, 5, 6
- setobjectmovementtype 3, MOVEMENT_TYPE_WANDER_AROUND
- addobject 3
+ removeobject LOCALID_SCIENTIST
+ setobjectxyperm LOCALID_SCIENTIST, 5, 6
+ setobjectmovementtype LOCALID_SCIENTIST, MOVEMENT_TYPE_WANDER_AROUND
+ addobject LOCALID_SCIENTIST
fadescreen FADE_FROM_BLACK
end
@@ -329,11 +340,11 @@ MossdeepCity_SpaceCenter_2F_EventScript_StevenFacePlayer:: @ 8224131
return
MossdeepCity_SpaceCenter_2F_EventScript_StevenFacePlayerSouth:: @ 822414D
- turnobject 4, DIR_NORTH
+ turnobject LOCALID_STEVEN, DIR_NORTH
return
MossdeepCity_SpaceCenter_2F_EventScript_StevenFacePlayerWest:: @ 8224152
- turnobject 4, DIR_EAST
+ turnobject LOCALID_STEVEN, DIR_EAST
return
MossdeepCity_SpaceCenter_2F_EventScript_MaxieTrainer:: @ 8224157
diff --git a/data/maps/MossdeepCity_StevensHouse/scripts.inc b/data/maps/MossdeepCity_StevensHouse/scripts.inc
index bc71c6ca4..0017f553d 100644
--- a/data/maps/MossdeepCity_StevensHouse/scripts.inc
+++ b/data/maps/MossdeepCity_StevensHouse/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_STEVEN, 1
+.set LOCALID_BELDUM_BALL, 2
+
MossdeepCity_StevensHouse_MapScripts:: @ 8222784
map_script MAP_SCRIPT_ON_LOAD, MossdeepCity_StevensHouse_OnLoad
map_script MAP_SCRIPT_ON_TRANSITION, MossdeepCity_StevensHouse_OnTransition
@@ -18,8 +21,8 @@ MossdeepCity_StevensHouse_OnTransition: @ 82227A8
end
MossdeepCity_StevensHouse_EventScript_SetStevenPos:: @ 82227B4
- setobjectxyperm 1, 6, 5
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_UP
+ setobjectxyperm LOCALID_STEVEN, 6, 5
+ setobjectmovementtype LOCALID_STEVEN, MOVEMENT_TYPE_FACE_UP
return
MossdeepCity_StevensHouse_OnFrame: @ 82227C0
@@ -28,14 +31,14 @@ MossdeepCity_StevensHouse_OnFrame: @ 82227C0
MossdeepCity_StevensHouse_EventScript_StevenGivesDive:: @ 82227CA
lockall
- applymovement 1, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_STEVEN, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
playse SE_PIN
- applymovement 1, Common_Movement_ExclamationMark
+ applymovement LOCALID_STEVEN, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 1, Common_Movement_Delay48
+ applymovement LOCALID_STEVEN, Common_Movement_Delay48
waitmovement 0
- applymovement 1, MossdeepCity_StevensHouse_Movement_StevenApproachPlayer
+ applymovement LOCALID_STEVEN, MossdeepCity_StevensHouse_Movement_StevenApproachPlayer
waitmovement 0
msgbox MossdeepCity_StevensHouse_Text_YouveEarnedHMDive, MSGBOX_DEFAULT
giveitem ITEM_HM08
@@ -44,7 +47,7 @@ MossdeepCity_StevensHouse_EventScript_StevenGivesDive:: @ 82227CA
msgbox MossdeepCity_StevensHouse_Text_ExplainDive, MSGBOX_DEFAULT
closemessage
delay 20
- applymovement 1, MossdeepCity_StevensHouse_Movement_StevenReturn
+ applymovement LOCALID_STEVEN, MossdeepCity_StevensHouse_Movement_StevenReturn
waitmovement 0
setflag FLAG_HIDE_MOSSDEEP_CITY_SCOTT
setflag FLAG_HIDE_SEAFLOOR_CAVERN_ENTRANCE_AQUA_GRUNT
@@ -119,7 +122,7 @@ MossdeepCity_StevensHouse_EventScript_BeldumTransferredToPC:: @ 82228E0
MossdeepCity_StevensHouse_EventScript_ReceivedBeldumFanfare:: @ 82228EB
bufferspeciesname 1, SPECIES_BELDUM
- removeobject 2
+ removeobject LOCALID_BELDUM_BALL
playfanfare MUS_FANFA4
message MossdeepCity_StevensHouse_Text_ObtainedBeldum
waitmessage
diff --git a/data/maps/MtChimney/scripts.inc b/data/maps/MtChimney/scripts.inc
index 9e1213c1b..42ebce0f9 100644
--- a/data/maps/MtChimney/scripts.inc
+++ b/data/maps/MtChimney/scripts.inc
@@ -1,3 +1,10 @@
+.set LOCALID_ARCHIE, 1
+.set LOCALID_MAXIE, 2
+.set LOCALID_TABITHA, 3
+.set LOCALID_MAGMA_GRUNT_2, 22
+.set LOCALID_MAGMA_GRUNT_1, 29
+
+
MtChimney_MapScripts:: @ 822EDC1
map_script MAP_SCRIPT_ON_RESUME, MtChimney_OnResume
map_script MAP_SCRIPT_ON_TRANSITION, MtChimney_OnTransition
@@ -17,7 +24,7 @@ MtChimney_EventScript_Archie:: @ 822EDD5
call_if_unset FLAG_EVIL_LEADER_PLEASE_STOP, MtChimney_EventScript_ArchieGoStopTeamMagma
call_if_set FLAG_EVIL_LEADER_PLEASE_STOP, MtChimney_EventScript_ArchieBusyFighting
closemessage
- applymovement 1, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_ARCHIE, Common_Movement_FaceOriginalDirection
waitmovement 0
setflag FLAG_EVIL_LEADER_PLEASE_STOP
release
@@ -35,12 +42,12 @@ MtChimney_EventScript_Maxie:: @ 822EE0B
lockall
playbgm MUS_MGM0, 0
msgbox MtChimney_Text_MeteoriteWillActivateVolcano, MSGBOX_DEFAULT
- applymovement 2, Common_Movement_FacePlayer
+ applymovement LOCALID_MAXIE, Common_Movement_FacePlayer
waitmovement 0
playse SE_PIN
- applymovement 2, Common_Movement_ExclamationMark
+ applymovement LOCALID_MAXIE, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 2, Common_Movement_Delay48
+ applymovement LOCALID_MAXIE, Common_Movement_Delay48
waitmovement 0
msgbox MtChimney_Text_MaxieIntro, MSGBOX_DEFAULT
trainerbattle_no_intro TRAINER_MAXIE_MT_CHIMNEY, MtChimney_Text_MaxieDefeat
@@ -48,14 +55,14 @@ MtChimney_EventScript_Maxie:: @ 822EE0B
closemessage
delay 30
fadescreen FADE_TO_BLACK
- removeobject 2
- removeobject 29
- removeobject 3
- removeobject 22
+ removeobject LOCALID_MAXIE
+ removeobject LOCALID_MAGMA_GRUNT_1
+ removeobject LOCALID_TABITHA
+ removeobject LOCALID_MAGMA_GRUNT_2
setflag FLAG_HIDE_MT_CHIMNEY_TEAM_MAGMA
fadescreen FADE_FROM_BLACK
- setobjectxyperm 1, 10, 12
- addobject 1
+ setobjectxyperm LOCALID_ARCHIE, 10, 12
+ addobject LOCALID_ARCHIE
compare VAR_FACING, DIR_EAST
call_if_eq MtChimney_EventScript_ArchieApproachPlayerEast
compare VAR_FACING, DIR_NORTH
@@ -68,7 +75,7 @@ MtChimney_EventScript_Maxie:: @ 822EE0B
call_if_eq MtChimney_EventScript_ArchieExitEast
compare VAR_FACING, DIR_NORTH
call_if_eq MtChimney_EventScript_ArchieExitNorth
- removeobject 1
+ removeobject LOCALID_ARCHIE
setflag FLAG_HIDE_MT_CHIMNEY_TEAM_AQUA
setflag FLAG_DEFEATED_EVIL_TEAM_MT_CHIMNEY
clearflag FLAG_HIDE_FALLARBOR_HOUSE_PROF_COZMO
@@ -78,22 +85,22 @@ MtChimney_EventScript_Maxie:: @ 822EE0B
end
MtChimney_EventScript_ArchieApproachPlayerEast:: @ 822EEC7
- applymovement 1, MtChimney_Movement_ArchieApproachPlayerEast
+ applymovement LOCALID_ARCHIE, MtChimney_Movement_ArchieApproachPlayerEast
waitmovement 0
return
MtChimney_EventScript_ArchieApproachPlayerNorth:: @ 822EED2
- applymovement 1, MtChimney_Movement_ArchieApproachPlayerNorth
+ applymovement LOCALID_ARCHIE, MtChimney_Movement_ArchieApproachPlayerNorth
waitmovement 0
return
MtChimney_EventScript_ArchieExitEast:: @ 822EEDD
- applymovement 1, MtChimney_Movement_ArchieExitEast
+ applymovement LOCALID_ARCHIE, MtChimney_Movement_ArchieExitEast
waitmovement 0
return
MtChimney_EventScript_ArchieExitNorth:: @ 822EEE8
- applymovement 1, MtChimney_Movement_ArchieExitNorth
+ applymovement LOCALID_ARCHIE, MtChimney_Movement_ArchieExitNorth
waitmovement 0
return
diff --git a/data/maps/MtChimney_CableCarStation/scripts.inc b/data/maps/MtChimney_CableCarStation/scripts.inc
index 8c4294126..6ce84933f 100644
--- a/data/maps/MtChimney_CableCarStation/scripts.inc
+++ b/data/maps/MtChimney_CableCarStation/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
MtChimney_CableCarStation_MapScripts:: @ 822ABFA
map_script MAP_SCRIPT_ON_TRANSITION, MtChimney_CableCarStation_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, MtChimney_CableCarStation_OnFrame
@@ -9,8 +11,8 @@ MtChimney_CableCarStation_OnTransition: @ 822AC05
end
MtChimney_CableCarStation_EventScript_MoveAttendantAside:: @ 822AC11
- setobjectxyperm 1, 5, 4
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_ATTENDANT, 5, 4
+ setobjectmovementtype LOCALID_ATTENDANT, MOVEMENT_TYPE_FACE_RIGHT
return
MtChimney_CableCarStation_OnFrame: @ 822AC1D
@@ -20,11 +22,11 @@ MtChimney_CableCarStation_OnFrame: @ 822AC1D
MtChimney_CableCarStation_EventScript_ExitCableCar:: @ 822AC27
lockall
applymovement OBJ_EVENT_ID_PLAYER, MtChimney_CableCarStation_Movement_ExitCableCar
- applymovement 1, MtChimney_CableCarStation_Movement_FollowPlayerOutFromCableCar
+ applymovement LOCALID_ATTENDANT, MtChimney_CableCarStation_Movement_FollowPlayerOutFromCableCar
waitmovement 0
setvar VAR_CABLE_CAR_STATION_STATE, 0
- setobjectxyperm 1, 6, 7
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_DOWN
+ setobjectxyperm LOCALID_ATTENDANT, 6, 7
+ setobjectmovementtype LOCALID_ATTENDANT, MOVEMENT_TYPE_FACE_DOWN
releaseall
end
@@ -41,7 +43,7 @@ MtChimney_CableCarStation_EventScript_Attendant:: @ 822AC4B
MtChimney_CableCarStation_EventScript_RideCableCar:: @ 822AC6C
msgbox MtChimney_CableCarStation_Text_StepThisWay, MSGBOX_DEFAULT
closemessage
- applymovement 1, MtChimney_CableCarStation_Movement_LeadPlayerToCableCar
+ applymovement LOCALID_ATTENDANT, MtChimney_CableCarStation_Movement_LeadPlayerToCableCar
applymovement OBJ_EVENT_ID_PLAYER, MtChimney_CableCarStation_Movement_BoardCableCar
waitmovement 0
setvar VAR_0x8004, 1
diff --git a/data/maps/MtPyre_Summit/scripts.inc b/data/maps/MtPyre_Summit/scripts.inc
index 0fa34bcce..9daf02f5b 100644
--- a/data/maps/MtPyre_Summit/scripts.inc
+++ b/data/maps/MtPyre_Summit/scripts.inc
@@ -1,3 +1,11 @@
+.set LOCALID_ARCHIE, 2
+.set LOCALID_OLD_LADY, 3
+.set LOCALID_GRUNT_1, 4
+.set LOCALID_GRUNT_2, 5
+.set LOCALID_GRUNT_3, 6
+.set LOCALID_GRUNT_4, 7
+.set LOCALID_MAXIE, 8
+
MtPyre_Summit_MapScripts:: @ 8231FF7
map_script MAP_SCRIPT_ON_TRANSITION, MtPyre_Summit_OnTransition
.byte 0
@@ -8,8 +16,8 @@ MtPyre_Summit_OnTransition: @ 8231FFD
end
MtPyre_Summit_EventScript_SetArchieMaxiePositions:: @ 8232009
- setobjectxyperm 8, 23, 6
- setobjectxyperm 2, 22, 6
+ setobjectxyperm LOCALID_MAXIE, 23, 6
+ setobjectxyperm LOCALID_ARCHIE, 22, 6
end
MtPyre_Summit_EventScript_TeamAquaTrigger0:: @ 8232018
@@ -34,7 +42,7 @@ MtPyre_Summit_EventScript_TeamAquaExits:: @ 823203C
playbgm MUS_AQA_0, 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_FaceUp
waitmovement 0
- applymovement 2, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_ARCHIE, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
delay 50
compare VAR_0x8008, 0
@@ -46,11 +54,11 @@ MtPyre_Summit_EventScript_TeamAquaExits:: @ 823203C
msgbox MtPyre_Summit_Text_ArchieWeGotTheOrbLetsGo, MSGBOX_DEFAULT
closemessage
fadescreen FADE_TO_BLACK
- removeobject 2
- removeobject 4
- removeobject 5
- removeobject 6
- removeobject 7
+ removeobject LOCALID_ARCHIE
+ removeobject LOCALID_GRUNT_1
+ removeobject LOCALID_GRUNT_2
+ removeobject LOCALID_GRUNT_3
+ removeobject LOCALID_GRUNT_4
setflag FLAG_HIDE_MT_PYRE_SUMMIT_ARCHIE
setflag FLAG_HIDE_MT_PYRE_SUMMIT_TEAM_AQUA
fadedefaultbgm
@@ -71,7 +79,7 @@ MtPyre_Summit_EventScript_TeamAquaExits:: @ 823203C
end
MtPyre_Summit_EventScript_ArchieFacePlayer0:: @ 82320E0
- applymovement 2, MtPyre_Summit_Movement_ArchieFacePlayer0
+ applymovement LOCALID_ARCHIE, MtPyre_Summit_Movement_ArchieFacePlayer0
waitmovement 0
return
@@ -80,24 +88,24 @@ MtPyre_Summit_EventScript_ArchieFacePlayer1:: @ 82320EB
return
MtPyre_Summit_EventScript_ArchieFacePlayer2:: @ 82320EC
- applymovement 2, MtPyre_Summit_Movement_ArchieFacePlayer2
+ applymovement LOCALID_ARCHIE, MtPyre_Summit_Movement_ArchieFacePlayer2
waitmovement 0
return
MtPyre_Summit_EventScript_OldLadyApproachPlayer0:: @ 82320F7
- applymovement 3, MtPyre_Summit_Movement_OldLadyApproachPlayer0
+ applymovement LOCALID_OLD_LADY, MtPyre_Summit_Movement_OldLadyApproachPlayer0
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
return
MtPyre_Summit_EventScript_OldLadyApproachPlayer1:: @ 823210C
- applymovement 3, MtPyre_Summit_Movement_OldLadyApproachPlayer1
+ applymovement LOCALID_OLD_LADY, MtPyre_Summit_Movement_OldLadyApproachPlayer1
waitmovement 0
return
MtPyre_Summit_EventScript_OldLadyApproachPlayer2:: @ 8232117
- applymovement 3, MtPyre_Summit_Movement_OldLadyApproachPlayer2
+ applymovement LOCALID_OLD_LADY, MtPyre_Summit_Movement_OldLadyApproachPlayer2
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
@@ -218,9 +226,9 @@ MtPyre_Summit_EventScript_ArchieMaxieReturnOrbs:: @ 8232210
compare VAR_0x8008, 2
call_if_eq MtPyre_Summit_EventScript_ArchieMaxieBeginExit2
playse SE_PIN
- applymovement 8, Common_Movement_ExclamationMark
+ applymovement LOCALID_MAXIE, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 8, Common_Movement_Delay48
+ applymovement LOCALID_MAXIE, Common_Movement_Delay48
waitmovement 0
delay 30
compare VAR_0x8008, 0
@@ -238,78 +246,78 @@ MtPyre_Summit_EventScript_ArchieMaxieReturnOrbs:: @ 8232210
compare VAR_0x8008, 2
call_if_eq MtPyre_Summit_EventScript_MaxieApproachArchie2
delay 30
- applymovement 2, MtPyre_Summit_Movement_MaxieExit
- applymovement 8, MtPyre_Summit_Movement_ArchieExit
+ applymovement LOCALID_ARCHIE, MtPyre_Summit_Movement_ArchieExit
+ applymovement LOCALID_MAXIE, MtPyre_Summit_Movement_MaxieExit
waitmovement 0
- removeobject 2
- removeobject 8
+ removeobject LOCALID_ARCHIE
+ removeobject LOCALID_MAXIE
setvar VAR_MT_PYRE_STATE, 3
releaseall
end
MtPyre_Summit_EventScript_ArchieMaxieBeginExit0:: @ 82322C4
applymovement OBJ_EVENT_ID_PLAYER, MtPyre_Summit_Movement_PlayerWatchArchieMaxieExit0
- applymovement 2, MtPyre_Summit_Movement_MaxieExit
- applymovement 8, MtPyre_Summit_Movement_ArchieExit
+ applymovement LOCALID_ARCHIE, MtPyre_Summit_Movement_ArchieExit
+ applymovement LOCALID_MAXIE, MtPyre_Summit_Movement_MaxieExit
waitmovement 0
return
MtPyre_Summit_EventScript_ArchieMaxieBeginExit1:: @ 82322DD
applymovement OBJ_EVENT_ID_PLAYER, MtPyre_Summit_Movement_PlayerWatchArchieMaxieExit1
- applymovement 2, MtPyre_Summit_Movement_MaxieExit
- applymovement 8, MtPyre_Summit_Movement_ArchieExit
+ applymovement LOCALID_ARCHIE, MtPyre_Summit_Movement_ArchieExit
+ applymovement LOCALID_MAXIE, MtPyre_Summit_Movement_MaxieExit
waitmovement 0
return
MtPyre_Summit_EventScript_ArchieMaxieBeginExit2:: @ 82322F6
applymovement OBJ_EVENT_ID_PLAYER, MtPyre_Summit_Movement_PlayerWatchArchieMaxieExit2
- applymovement 2, MtPyre_Summit_Movement_MaxieExit
- applymovement 8, MtPyre_Summit_Movement_ArchieExit
+ applymovement LOCALID_ARCHIE, MtPyre_Summit_Movement_ArchieExit
+ applymovement LOCALID_MAXIE, MtPyre_Summit_Movement_MaxieExit
waitmovement 0
return
MtPyre_Summit_EventScript_MaxieApproachPlayer0:: @ 823230F
applymovement OBJ_EVENT_ID_PLAYER, MtPyre_Summit_Movement_PlayerFaceMaxie0
- applymovement 2, MtPyre_Summit_Movement_ArchieWatchMaxie
- applymovement 8, MtPyre_Summit_Movement_MaxieApproachPlayer0
+ applymovement LOCALID_ARCHIE, MtPyre_Summit_Movement_ArchieWatchMaxie
+ applymovement LOCALID_MAXIE, MtPyre_Summit_Movement_MaxieApproachPlayer0
waitmovement 0
return
MtPyre_Summit_EventScript_MaxieApproachPlayer1:: @ 8232328
applymovement OBJ_EVENT_ID_PLAYER, MtPyre_Summit_Movement_PlayerFaceMaxie
- applymovement 2, MtPyre_Summit_Movement_ArchieWatchMaxie
- applymovement 8, MtPyre_Summit_Movement_MaxieApproachPlayer1
+ applymovement LOCALID_ARCHIE, MtPyre_Summit_Movement_ArchieWatchMaxie
+ applymovement LOCALID_MAXIE, MtPyre_Summit_Movement_MaxieApproachPlayer1
waitmovement 0
return
MtPyre_Summit_EventScript_MaxieApproachPlayer2:: @ 8232341
applymovement OBJ_EVENT_ID_PLAYER, MtPyre_Summit_Movement_PlayerFaceMaxie
- applymovement 2, MtPyre_Summit_Movement_ArchieWatchMaxie
- applymovement 8, MtPyre_Summit_Movement_MaxieApproachPlayer2
+ applymovement LOCALID_ARCHIE, MtPyre_Summit_Movement_ArchieWatchMaxie
+ applymovement LOCALID_MAXIE, MtPyre_Summit_Movement_MaxieApproachPlayer2
waitmovement 0
return
MtPyre_Summit_EventScript_MaxieApproachArchie0:: @ 823235A
applymovement OBJ_EVENT_ID_PLAYER, MtPyre_Summit_Movement_PlayerWatchMaxie
- applymovement 8, MtPyre_Summit_Movement_MaxieApproachArchie0
+ applymovement LOCALID_MAXIE, MtPyre_Summit_Movement_MaxieApproachArchie0
waitmovement 0
- applymovement 2, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_ARCHIE, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
return
MtPyre_Summit_EventScript_MaxieApproachArchie1:: @ 8232376
applymovement OBJ_EVENT_ID_PLAYER, MtPyre_Summit_Movement_PlayerWatchMaxie
- applymovement 8, MtPyre_Summit_Movement_MaxieApproachArchie1
+ applymovement LOCALID_MAXIE, MtPyre_Summit_Movement_MaxieApproachArchie1
waitmovement 0
- applymovement 2, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_ARCHIE, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
return
MtPyre_Summit_EventScript_MaxieApproachArchie2:: @ 8232392
applymovement OBJ_EVENT_ID_PLAYER, MtPyre_Summit_Movement_PlayerWatchMaxie
- applymovement 8, MtPyre_Summit_Movement_MaxieApproachArchie2
+ applymovement LOCALID_MAXIE, MtPyre_Summit_Movement_MaxieApproachArchie2
waitmovement 0
- applymovement 2, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_ARCHIE, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
return
@@ -325,7 +333,7 @@ MtPyre_Summit_Movement_PlayerFaceMaxie: @ 82323B2
walk_in_place_fastest_left
step_end
-MtPyre_Summit_Movement_MaxieExit: @ 82323B6
+MtPyre_Summit_Movement_ArchieExit: @ 82323B6
walk_down
walk_down
walk_down
@@ -334,7 +342,7 @@ MtPyre_Summit_Movement_MaxieExit: @ 82323B6
walk_down
step_end
-MtPyre_Summit_Movement_ArchieExit: @ 82323BD
+MtPyre_Summit_Movement_MaxieExit: @ 82323BD
walk_down
walk_down
walk_down
diff --git a/data/maps/NavelRock_Bottom/scripts.inc b/data/maps/NavelRock_Bottom/scripts.inc
index e43f6d513..f0c73b1f8 100644
--- a/data/maps/NavelRock_Bottom/scripts.inc
+++ b/data/maps/NavelRock_Bottom/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_LUGIA, 1
+
NavelRock_Bottom_MapScripts:: @ 8269255
map_script MAP_SCRIPT_ON_TRANSITION, NavelRock_Bottom_OnTransition
map_script MAP_SCRIPT_ON_RESUME, NavelRock_Bottom_OnResume
@@ -25,7 +27,7 @@ NavelRock_Bottom_EventScript_TryRemoveLugia:: @ 826928E
specialvar VAR_RESULT, GetBattleOutcome
compare VAR_RESULT, B_OUTCOME_CAUGHT
goto_if_ne Common_EventScript_NopReturn
- removeobject 1
+ removeobject LOCALID_LUGIA
return
NavelRock_Bottom_EventScript_Lugia:: @ 82692A2
diff --git a/data/maps/NavelRock_Harbor/scripts.inc b/data/maps/NavelRock_Harbor/scripts.inc
index b138b7c5a..7c0cbed6a 100644
--- a/data/maps/NavelRock_Harbor/scripts.inc
+++ b/data/maps/NavelRock_Harbor/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_SAILOR, 1
+.set LOCALID_SS_TIDAL, 2
+
NavelRock_Harbor_MapScripts:: @ 82690BC
.byte 0
@@ -12,8 +15,8 @@ NavelRock_Harbor_EventScript_Sailor:: @ 82690BD
applymovement VAR_LAST_TALKED, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
delay 30
- hideobjectat 1, MAP_NAVEL_ROCK_HARBOR
- setvar VAR_0x8004, 2
+ hideobjectat LOCALID_SAILOR, MAP_NAVEL_ROCK_HARBOR
+ setvar VAR_0x8004, LOCALID_SS_TIDAL
call Common_EventScript_FerryDepartIsland
warp MAP_LILYCOVE_CITY_HARBOR, 255, 8, 11
waitstate
diff --git a/data/maps/NavelRock_Top/scripts.inc b/data/maps/NavelRock_Top/scripts.inc
index 4cb110d81..c95596ff6 100644
--- a/data/maps/NavelRock_Top/scripts.inc
+++ b/data/maps/NavelRock_Top/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_HO_OH, 1
+
NavelRock_Top_MapScripts:: @ 8269113
map_script MAP_SCRIPT_ON_TRANSITION, NavelRock_Top_OnTransition
map_script MAP_SCRIPT_ON_RESUME, NavelRock_Top_OnResume
@@ -28,7 +30,7 @@ NavelRock_Top_EventScript_TryRemoveHoOh:: @ 826915B
specialvar VAR_RESULT, GetBattleOutcome
compare VAR_RESULT, B_OUTCOME_CAUGHT
goto_if_ne Common_EventScript_NopReturn
- removeobject 1
+ removeobject LOCALID_HO_OH
return
NavelRock_Top_EventScript_HoOh:: @ 826916F
@@ -38,7 +40,7 @@ NavelRock_Top_EventScript_HoOh:: @ 826916F
setvar VAR_0x8004, 3 @ num loops
setvar VAR_0x8005, 35 @ delay
special LoopWingFlapSE
- applymovement 1, NavelRock_Top_Movement_HoOhAppear
+ applymovement LOCALID_HO_OH, NavelRock_Top_Movement_HoOhAppear
applymovement OBJ_EVENT_ID_CAMERA, NavelRock_Top_Movement_CameraPanUp
waitmovement 0
delay 50
@@ -53,7 +55,7 @@ NavelRock_Top_EventScript_HoOh:: @ 826916F
setvar VAR_0x8005, 35 @ delay
special LoopWingFlapSE
applymovement OBJ_EVENT_ID_CAMERA, NavelRock_Top_Movement_CameraPanDown
- applymovement 1, NavelRock_Top_Movement_HoOhApproach
+ applymovement LOCALID_HO_OH, NavelRock_Top_Movement_HoOhApproach
waitmovement 0
special RemoveCameraObject
setvar VAR_0x8004, SPECIES_HO_OH
@@ -64,7 +66,7 @@ NavelRock_Top_EventScript_HoOh:: @ 826916F
special BattleSetup_StartLegendaryBattle
waitstate
clearflag FLAG_SYS_CTRL_OBJ_DELETE
- setvar VAR_LAST_TALKED, 1
+ setvar VAR_LAST_TALKED, LOCALID_HO_OH
specialvar VAR_RESULT, GetBattleOutcome
compare VAR_RESULT, B_OUTCOME_WON
goto_if_eq NavelRock_Top_EventScript_DefeatedHoOh
diff --git a/data/maps/OldaleTown/scripts.inc b/data/maps/OldaleTown/scripts.inc
index 2d1dca1ae..aeb0c3dbd 100644
--- a/data/maps/OldaleTown/scripts.inc
+++ b/data/maps/OldaleTown/scripts.inc
@@ -1,3 +1,7 @@
+.set LOCALID_MART_EMPLOYEE, 2
+.set LOCALID_FOOTPRINTS_MAN, 3
+.set LOCALID_RIVAL, 4
+
OldaleTown_MapScripts:: @ 81E8EA2
map_script MAP_SCRIPT_ON_TRANSITION, OldaleTown_OnTransition
.byte 0
@@ -16,13 +20,13 @@ OldaleTown_EventScript_SetOldaleState:: @ 81E8ECC
return
OldaleTown_EventScript_BlockWestEntrance:: @ 81E8ED2
- setobjectxyperm 3, 1, 11
- setobjectmovementtype 3, MOVEMENT_TYPE_FACE_LEFT
+ setobjectxyperm LOCALID_FOOTPRINTS_MAN, 1, 11
+ setobjectmovementtype LOCALID_FOOTPRINTS_MAN, MOVEMENT_TYPE_FACE_LEFT
return
OldaleTown_EventScript_MoveMartEmployee:: @ 81E8EDE
- setobjectxyperm 2, 13, 14
- setobjectmovementtype 2, MOVEMENT_TYPE_FACE_DOWN
+ setobjectxyperm LOCALID_MART_EMPLOYEE, 13, 14
+ setobjectmovementtype LOCALID_MART_EMPLOYEE, MOVEMENT_TYPE_FACE_DOWN
return
OldaleTown_EventScript_CitySign:: @ 81E8EEA
@@ -49,14 +53,14 @@ OldaleTown_EventScript_MartEmployee:: @ 81E8EFC
end
OldaleTown_EventScript_GoToMartSouth:: @ 81E8F47
- applymovement 2, OldaleTown_Movement_EmployeeSouth
+ applymovement LOCALID_MART_EMPLOYEE, OldaleTown_Movement_EmployeeSouth
applymovement OBJ_EVENT_ID_PLAYER, OldaleTown_Movement_PlayerSouth
waitmovement 0
goto OldaleTown_EventScript_ExplainPokemonMart
end
OldaleTown_EventScript_GoToMartNorth:: @ 81E8F5E
- applymovement 2, OldaleTown_Movement_EmployeeNorth
+ applymovement LOCALID_MART_EMPLOYEE, OldaleTown_Movement_EmployeeNorth
applymovement OBJ_EVENT_ID_PLAYER, OldaleTown_Movement_PlayerNorth
waitmovement 0
goto OldaleTown_EventScript_ExplainPokemonMart
@@ -64,7 +68,7 @@ OldaleTown_EventScript_GoToMartNorth:: @ 81E8F5E
OldaleTown_EventScript_GoToMartEast:: @ 81E8F75
applymovement OBJ_EVENT_ID_PLAYER, OldaleTown_Movement_PlayerEast
- applymovement 2, OldaleTown_Movement_EmployeeEast
+ applymovement LOCALID_MART_EMPLOYEE, OldaleTown_Movement_EmployeeEast
waitmovement 0
goto OldaleTown_EventScript_ExplainPokemonMart
end
@@ -72,7 +76,7 @@ OldaleTown_EventScript_GoToMartEast:: @ 81E8F75
OldaleTown_EventScript_ExplainPokemonMart:: @ 81E8F8C
msgbox OldaleTown_Text_ThisIsAPokemonMart, MSGBOX_DEFAULT
giveitem ITEM_POTION
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq OldaleTown_EventScript_BagIsFull
msgbox OldaleTown_Text_PotionExplanation, MSGBOX_DEFAULT
setflag FLAG_RECEIVED_POTION_OLDALE
@@ -194,7 +198,7 @@ OldaleTown_EventScript_FootprintsMan:: @ 81E901F
goto_if_set FLAG_ADVENTURE_STARTED, OldaleTown_EventScript_NotBlockingPath
msgbox OldaleTown_Text_DiscoveredFootprints, MSGBOX_DEFAULT
closemessage
- applymovement 3, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_FOOTPRINTS_MAN, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -202,11 +206,11 @@ OldaleTown_EventScript_FootprintsMan:: @ 81E901F
OldaleTown_EventScript_BlockedPath:: @ 81E903F
lockall
applymovement OBJ_EVENT_ID_PLAYER, OldaleTown_Movement_PlayerStepBack
- applymovement 3, OldaleTown_Movement_BackUp
+ applymovement LOCALID_FOOTPRINTS_MAN, OldaleTown_Movement_BackUp
waitmovement 0
msgbox OldaleTown_Text_WaitDontComeInHere, MSGBOX_DEFAULT
closemessage
- applymovement 3, OldaleTown_Movement_ReturnToOriginalPosition
+ applymovement LOCALID_FOOTPRINTS_MAN, OldaleTown_Movement_ReturnToOriginalPosition
waitmovement 0
releaseall
end
@@ -218,7 +222,7 @@ OldaleTown_EventScript_NotBlockingPath:: @ 81E9066
OldaleTown_EventScript_Rival:: @ 81E9070
lockall
- applymovement 4, Common_Movement_FacePlayer
+ applymovement LOCALID_RIVAL, Common_Movement_FacePlayer
waitmovement 0
setvar VAR_0x8009, 0
goto OldaleTown_EventScript_ShowRivalMessage
@@ -226,7 +230,7 @@ OldaleTown_EventScript_Rival:: @ 81E9070
OldaleTown_EventScript_RivalTrigger1:: @ 81E9086
lockall
- applymovement 4, OldaleTown_Movement_RivalApproachPlayer1
+ applymovement LOCALID_RIVAL, OldaleTown_Movement_RivalApproachPlayer1
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
@@ -236,7 +240,7 @@ OldaleTown_EventScript_RivalTrigger1:: @ 81E9086
OldaleTown_EventScript_RivalTrigger2:: @ 81E90A6
lockall
- applymovement 4, OldaleTown_Movement_RivalApproachPlayer2
+ applymovement LOCALID_RIVAL, OldaleTown_Movement_RivalApproachPlayer2
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
@@ -246,7 +250,7 @@ OldaleTown_EventScript_RivalTrigger2:: @ 81E90A6
OldaleTown_EventScript_RivalTrigger3:: @ 81E90C6
lockall
- applymovement 4, OldaleTown_Movement_RivalApproachPlayer3
+ applymovement LOCALID_RIVAL, OldaleTown_Movement_RivalApproachPlayer3
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
@@ -278,9 +282,9 @@ OldaleTown_EventScript_RivalFinish:: @ 81E911A
call_if_eq OldaleTown_EventScript_DoExitMovement1
compare VAR_0x8009, 1
call_if_eq OldaleTown_EventScript_DoExitMovement2
- applymovement 4, OldaleTown_Movement_RivalExit
+ applymovement LOCALID_RIVAL, OldaleTown_Movement_RivalExit
waitmovement 0
- removeobject 4
+ removeobject LOCALID_RIVAL
setvar VAR_OLDALE_RIVAL_STATE, 2
setflag FLAG_HIDE_OLDALE_TOWN_RIVAL
releaseall
@@ -289,13 +293,13 @@ OldaleTown_EventScript_RivalFinish:: @ 81E911A
OldaleTown_EventScript_DoExitMovement1:: @ 81E9148
compare VAR_FACING, DIR_SOUTH
goto_if_ne OldaleTown_EventScript_DoExitMovement2
- applymovement 4, OldaleTown_Movement_RivalExit
+ applymovement LOCALID_RIVAL, OldaleTown_Movement_RivalExit
waitmovement 0
return
OldaleTown_EventScript_DoExitMovement2:: @ 81E915E
applymovement OBJ_EVENT_ID_PLAYER, OldaleTown_Movement_WatchRivalExit
- applymovement 4, OldaleTown_Movement_RivalExit
+ applymovement LOCALID_RIVAL, OldaleTown_Movement_RivalExit
waitmovement 0
return
diff --git a/data/maps/OldaleTown_PokemonCenter_1F/scripts.inc b/data/maps/OldaleTown_PokemonCenter_1F/scripts.inc
index df405376a..0918f3c39 100644
--- a/data/maps/OldaleTown_PokemonCenter_1F/scripts.inc
+++ b/data/maps/OldaleTown_PokemonCenter_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_NURSE, 1
+
OldaleTown_PokemonCenter_1F_MapScripts:: @ 81FC006
map_script MAP_SCRIPT_ON_TRANSITION, OldaleTown_PokemonCenter_1F_OnTransition
map_script MAP_SCRIPT_ON_RESUME, CableClub_OnResume
@@ -8,9 +10,8 @@ OldaleTown_PokemonCenter_1F_OnTransition: @ 81FC011
call Common_EventScript_UpdateBrineyLocation
end
-@ VAR_0x800B is the Nurse's object event id
OldaleTown_PokemonCenter_1F_EventScript_Nurse:: @ 81FC01A
- setvar VAR_0x800B, 1
+ setvar VAR_0x800B, LOCALID_NURSE
call Common_EventScript_PkmnCenterNurse
waitmessage
waitbuttonpress
diff --git a/data/maps/PacifidlogTown_House2/scripts.inc b/data/maps/PacifidlogTown_House2/scripts.inc
index 2dcff9f29..60b6c9961 100644
--- a/data/maps/PacifidlogTown_House2/scripts.inc
+++ b/data/maps/PacifidlogTown_House2/scripts.inc
@@ -58,7 +58,7 @@ PacifidlogTown_House2_EventScript_PutInEffort:: @ 8203845
PacifidlogTown_House2_EventScript_GiveFrustration:: @ 820384F
msgbox PacifidlogTown_House2_Text_ViciousPokemonTakeThis, MSGBOX_DEFAULT
giveitem ITEM_TM21
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_ShowBagIsFull
setflag FLAG_RECEIVED_FANCLUB_TM_THIS_WEEK
special SetPacifidlogTMReceivedDay
diff --git a/data/maps/PacifidlogTown_PokemonCenter_1F/scripts.inc b/data/maps/PacifidlogTown_PokemonCenter_1F/scripts.inc
index 8b0f0805a..fbe42ce99 100644
--- a/data/maps/PacifidlogTown_PokemonCenter_1F/scripts.inc
+++ b/data/maps/PacifidlogTown_PokemonCenter_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_NURSE, 1
+
PacifidlogTown_PokemonCenter_1F_MapScripts:: @ 82034A7
map_script MAP_SCRIPT_ON_TRANSITION, PacifidlogTown_PokemonCenter_1F_OnTransition
map_script MAP_SCRIPT_ON_RESUME, CableClub_OnResume
@@ -7,9 +9,8 @@ PacifidlogTown_PokemonCenter_1F_OnTransition: @ 82034B2
setrespawn HEAL_LOCATION_PACIFIDLOG_TOWN
end
-@ VAR_0x800B is the Nurse's object event id
PacifidlogTown_PokemonCenter_1F_EventScript_Nurse:: @ 82034B6
- setvar VAR_0x800B, 1
+ setvar VAR_0x800B, LOCALID_NURSE
call Common_EventScript_PkmnCenterNurse
waitmessage
waitbuttonpress
diff --git a/data/maps/PetalburgCity/map.json b/data/maps/PetalburgCity/map.json
index 190d81118..03c0950ca 100644
--- a/data/maps/PetalburgCity/map.json
+++ b/data/maps/PetalburgCity/map.json
@@ -61,7 +61,7 @@
"movement_range_y": 0,
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
- "script": "PetalburgCity_EventScript_Boy1",
+ "script": "PetalburgCity_EventScript_Boy",
"flag": "0"
},
{
@@ -126,7 +126,7 @@
"movement_range_y": 0,
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
- "script": "PetalburgCity_EventScript_Boy2",
+ "script": "PetalburgCity_EventScript_GymBoy",
"flag": "0"
},
{
diff --git a/data/maps/PetalburgCity/scripts.inc b/data/maps/PetalburgCity/scripts.inc
index 70dfee72f..b7df04857 100644
--- a/data/maps/PetalburgCity/scripts.inc
+++ b/data/maps/PetalburgCity/scripts.inc
@@ -1,3 +1,9 @@
+.set LOCALID_WALLY, 2
+.set LOCALID_BOY, 3
+.set LOCALID_WALLYS_UNCLE, 5
+.set LOCALID_GYM_BOY, 8
+.set LOCALID_SCOTT, 9
+
PetalburgCity_MapScripts::
map_script MAP_SCRIPT_ON_TRANSITION, PetalburgCity_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, PetalburgCity_OnFrame
@@ -6,7 +12,7 @@ PetalburgCity_MapScripts::
PetalburgCity_OnTransition: @ 81DC2D7
setflag FLAG_VISITED_PETALBURG_CITY
compare VAR_PETALBURG_CITY_STATE, 0
- call_if_eq PetalburgCity_EventScript_MoveBoyToWestEntrance
+ call_if_eq PetalburgCity_EventScript_MoveGymBoyToWestEntrance
compare VAR_PETALBURG_CITY_STATE, 2
call_if_eq PetalburgCity_EventScript_DisableMapNameAndMusic
compare VAR_PETALBURG_CITY_STATE, 4
@@ -15,8 +21,8 @@ PetalburgCity_OnTransition: @ 81DC2D7
call_if_eq PetalburgCity_EventScript_SetGymDoorsUnlocked
end
-PetalburgCity_EventScript_MoveBoyToWestEntrance:: @ 81DC307
- setobjectxyperm 8, 5, 11
+PetalburgCity_EventScript_MoveGymBoyToWestEntrance:: @ 81DC307
+ setobjectxyperm LOCALID_GYM_BOY, 5, 11
return
PetalburgCity_EventScript_DisableMapNameAndMusic:: @ 81DC30F
@@ -37,15 +43,15 @@ PetalburgCity_EventScript_WallyTutorial:: @ 81DC32E
lockall
special SavePlayerParty
special PutZigzagoonInPlayerParty
- applymovement 2, PetalburgCity_Movement_WallyTutorialWally
+ applymovement LOCALID_WALLY, PetalburgCity_Movement_WallyTutorialWally
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Movement_WallyTutorialPlayer
waitmovement 0
msgbox Route102_Text_WatchMeCatchPokemon, MSGBOX_DEFAULT
special StartWallyTutorialBattle
waitstate
msgbox Route102_Text_WallyIDidIt, MSGBOX_DEFAULT
- applymovement 2, Common_Movement_WalkInPlaceFastestLeft, MAP_PETALBURG_CITY
- waitmovement 2, MAP_PETALBURG_CITY
+ applymovement LOCALID_WALLY, Common_Movement_WalkInPlaceFastestLeft, MAP_PETALBURG_CITY
+ waitmovement LOCALID_WALLY, MAP_PETALBURG_CITY
msgbox Route102_Text_LetsGoBack, MSGBOX_DEFAULT
closemessage
clearflag FLAG_HIDE_MAP_NAME_POPUP
@@ -62,14 +68,14 @@ PetalburgCity_EventScript_WallyTutorial:: @ 81DC32E
PetalburgCity_EventScript_WalkToWallyHouse:: @ 81DC390
lockall
setflag FLAG_HIDE_MAP_NAME_POPUP
- applymovement 5, PetalburgCity_Movement_WalkToWallyHouseUncle
+ applymovement LOCALID_WALLYS_UNCLE, PetalburgCity_Movement_WalkToWallyHouseUncle
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Movement_WalkToWallyHousePlayer
waitmovement 0
setvar VAR_0x8004, 7
setvar VAR_0x8005, 5
opendoor VAR_0x8004, VAR_0x8005
waitdooranim
- applymovement 5, PetalburgCity_Movement_WalkInsideHouseUncle
+ applymovement LOCALID_WALLYS_UNCLE, PetalburgCity_Movement_WalkInsideHouseUncle
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Movement_WalkInsideHousePlayer
waitmovement 0
setflag FLAG_HIDE_PETALBURG_CITY_WALLYS_UNCLE
@@ -84,12 +90,12 @@ PetalburgCity_EventScript_WalkToWallyHouse:: @ 81DC390
releaseall
end
-PetalburgCity_EventScript_Boy1:: @ 81DC3E6
+PetalburgCity_EventScript_Boy:: @ 81DC3E6
lock
faceplayer
msgbox PetalburgCity_Text_WaterReflection, MSGBOX_DEFAULT
closemessage
- applymovement 3, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_BOY, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -263,13 +269,13 @@ PetalburgCity_EventScript_ShowGymToPlayer3:: @ 81DC4BE
end
PetalburgCity_EventScript_ShowGymToPlayer:: @ 81DC4CA
- applymovement 8, Common_Movement_FacePlayer
+ applymovement LOCALID_GYM_BOY, Common_Movement_FacePlayer
waitmovement 0
playbgm MUS_TSURETEK, 0
playse SE_PIN
- applymovement 8, Common_Movement_ExclamationMark
+ applymovement LOCALID_GYM_BOY, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 8, Common_Movement_Delay48
+ applymovement LOCALID_GYM_BOY, Common_Movement_Delay48
waitmovement 0
compare VAR_0x8008, 0
call_if_eq PetalburgCity_EventScript_BoyApproachPlayer0
@@ -290,63 +296,63 @@ PetalburgCity_EventScript_ShowGymToPlayer:: @ 81DC4CA
compare VAR_0x8008, 3
call_if_eq PetalburgCity_EventScript_LeadPlayerToGym3
msgbox PetalburgCity_Text_ThisIsPetalburgGym, MSGBOX_DEFAULT
- applymovement 8, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_GYM_BOY, Common_Movement_WalkInPlaceFastestRight
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
msgbox PetalburgCity_Text_ThisIsGymSign, MSGBOX_DEFAULT
closemessage
- applymovement 8, PetalburgCity_Movement_BoyWalkAway
+ applymovement LOCALID_GYM_BOY, PetalburgCity_Movement_BoyWalkAway
waitmovement 0
fadedefaultbgm
releaseall
end
PetalburgCity_EventScript_BoyApproachPlayer0:: @ 81DC57F
- applymovement 8, PetalburgCity_Movement_BoyApproachPlayer0
+ applymovement LOCALID_GYM_BOY, PetalburgCity_Movement_BoyApproachPlayer0
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
PetalburgCity_EventScript_BoyApproachPlayer1:: @ 81DC594
- applymovement 8, PetalburgCity_Movement_BoyApproachPlayer1
+ applymovement LOCALID_GYM_BOY, PetalburgCity_Movement_BoyApproachPlayer1
waitmovement 0
return
PetalburgCity_EventScript_BoyApproachPlayer2:: @ 81DC59F
- applymovement 8, PetalburgCity_Movement_BoyApproachPlayer2
+ applymovement LOCALID_GYM_BOY, PetalburgCity_Movement_BoyApproachPlayer2
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
return
PetalburgCity_EventScript_BoyApproachPlayer3:: @ 81DC5B4
- applymovement 8, PetalburgCity_Movement_BoyApproachPlayer3
+ applymovement LOCALID_GYM_BOY, PetalburgCity_Movement_BoyApproachPlayer3
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
return
PetalburgCity_EventScript_LeadPlayerToGym0:: @ 81DC5C9
- applymovement 8, PetalburgCity_Movement_BoyWalkToGym0
+ applymovement LOCALID_GYM_BOY, PetalburgCity_Movement_BoyWalkToGym0
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Movement_PlayerWalkToGym0
waitmovement 0
return
PetalburgCity_EventScript_LeadPlayerToGym1:: @ 81DC5DB
- applymovement 8, PetalburgCity_Movement_BoyWalkToGym1
+ applymovement LOCALID_GYM_BOY, PetalburgCity_Movement_BoyWalkToGym1
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Movement_PlayerWalkToGym1
waitmovement 0
return
PetalburgCity_EventScript_LeadPlayerToGym2:: @ 81DC5ED
- applymovement 8, PetalburgCity_Movement_BoyWalkToGym2
+ applymovement LOCALID_GYM_BOY, PetalburgCity_Movement_BoyWalkToGym2
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Movement_PlayerWalkToGym2
waitmovement 0
return
PetalburgCity_EventScript_LeadPlayerToGym3:: @ 81DC5FF
- applymovement 8, PetalburgCity_Movement_BoyWalkToGym3
+ applymovement LOCALID_GYM_BOY, PetalburgCity_Movement_BoyWalkToGym3
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Movement_PlayerWalkToGym3
waitmovement 0
return
@@ -510,57 +516,57 @@ PetalburgCity_Movement_PlayerWalkToGym3: @ 81DC686
PetalburgCity_EventScript_Scott0:: @ 81DC691
lockall
- addobject 9
+ addobject LOCALID_SCOTT
setvar VAR_0x8008, 0
- setobjectxy 9, 13, 10
+ setobjectxy LOCALID_SCOTT, 13, 10
goto PetalburgCity_EventScript_Scott
end
PetalburgCity_EventScript_Scott1:: @ 81DC6A7
lockall
- addobject 9
+ addobject LOCALID_SCOTT
setvar VAR_0x8008, 1
- setobjectxy 9, 13, 11
+ setobjectxy LOCALID_SCOTT, 13, 11
goto PetalburgCity_EventScript_Scott
end
PetalburgCity_EventScript_Scott2:: @ 81DC6BD
lockall
- addobject 9
+ addobject LOCALID_SCOTT
setvar VAR_0x8008, 2
- setobjectxy 9, 13, 12
+ setobjectxy LOCALID_SCOTT, 13, 12
goto PetalburgCity_EventScript_Scott
end
PetalburgCity_EventScript_Scott3:: @ 81DC6D3
lockall
- addobject 9
+ addobject LOCALID_SCOTT
setvar VAR_0x8008, 3
- setobjectxy 9, 13, 13
+ setobjectxy LOCALID_SCOTT, 13, 13
goto PetalburgCity_EventScript_Scott
end
PetalburgCity_EventScript_Scott:: @ 81DC6E9
- applymovement 9, PetalburgCity_Movement_ScottStartWalkLeft
+ applymovement LOCALID_SCOTT, PetalburgCity_Movement_ScottStartWalkLeft
waitmovement 0
playse SE_PIN
- applymovement 9, Common_Movement_ExclamationMark
+ applymovement LOCALID_SCOTT, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 9, Common_Movement_Delay48
+ applymovement LOCALID_SCOTT, Common_Movement_Delay48
waitmovement 0
- applymovement 9, PetalburgCity_Movement_ScottApproachPlayer
+ applymovement LOCALID_SCOTT, PetalburgCity_Movement_ScottApproachPlayer
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
setvar VAR_SCOTT_STATE, 1
msgbox PetalburgCity_Text_AreYouATrainer, MSGBOX_DEFAULT
closemessage
- applymovement 9, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_SCOTT, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
delay 30
msgbox PetalburgCity_Text_WellMaybeNot, MSGBOX_DEFAULT
closemessage
- applymovement 9, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_SCOTT, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
delay 30
msgbox PetalburgCity_Text_ImLookingForTalentedTrainers, MSGBOX_DEFAULT
@@ -574,31 +580,31 @@ PetalburgCity_EventScript_Scott:: @ 81DC6E9
compare VAR_0x8008, 3
call_if_eq PetalburgCity_EventScript_ScottExit3
setvar VAR_SCOTT_PETALBURG_ENCOUNTER, 1
- removeobject 9
+ removeobject LOCALID_SCOTT
releaseall
end
PetalburgCity_EventScript_ScottExit0:: @ 81DC78E
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Movement_PlayerWatchScottExit0
- applymovement 9, PetalburgCity_Movement_ScottExit0
+ applymovement LOCALID_SCOTT, PetalburgCity_Movement_ScottExit0
waitmovement 0
return
PetalburgCity_EventScript_ScottExit1:: @ 81DC7A0
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Movement_PlayerWatchScottExit1
- applymovement 9, PetalburgCity_Movement_ScottExit1
+ applymovement LOCALID_SCOTT, PetalburgCity_Movement_ScottExit1
waitmovement 0
return
PetalburgCity_EventScript_ScottExit2:: @ 81DC7B2
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Movement_PlayerWatchScottExit2
- applymovement 9, PetalburgCity_Movement_ScottExit2
+ applymovement LOCALID_SCOTT, PetalburgCity_Movement_ScottExit2
waitmovement 0
return
PetalburgCity_EventScript_ScottExit3:: @ 81DC7C4
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Movement_PlayerWatchScottExit3
- applymovement 9, PetalburgCity_Movement_ScottExit3
+ applymovement LOCALID_SCOTT, PetalburgCity_Movement_ScottExit3
waitmovement 0
return
@@ -710,7 +716,7 @@ PetalburgCity_Movement_PlayerWatchScottExit3: @ 81DC828
walk_in_place_fastest_left
step_end
-PetalburgCity_EventScript_Boy2:: @ 81DC82E
+PetalburgCity_EventScript_GymBoy:: @ 81DC82E
msgbox PetalburgCity_Text_AreYouRookieTrainer, MSGBOX_NPC
end
diff --git a/data/maps/PetalburgCity_Gym/scripts.inc b/data/maps/PetalburgCity_Gym/scripts.inc
index bc947025c..5df31917f 100644
--- a/data/maps/PetalburgCity_Gym/scripts.inc
+++ b/data/maps/PetalburgCity_Gym/scripts.inc
@@ -1,3 +1,7 @@
+.set LOCALID_NORMAN, 1
+.set LOCALID_WALLY, 10
+.set LOCALID_WALLYS_UNCLE, 11
+
PetalburgCity_Gym_MapScripts:: @ 8204889
map_script MAP_SCRIPT_ON_LOAD, PetalburgCity_Gym_OnLoad
map_script MAP_SCRIPT_ON_TRANSITION, PetalburgCity_Gym_OnTransition
@@ -46,11 +50,11 @@ PetalburgCity_Gym_OnTransition: @ 820492D
end
PetalburgCity_Gym_EventScript_MoveWallyToEntrance:: @ 820494D
- setobjectxyperm 10, 5, 108
+ setobjectxyperm LOCALID_WALLY, 5, 108
return
PetalburgCity_Gym_EventScript_MoveNormanToEntrance:: @ 8204955
- setobjectxyperm 1, 4, 107
+ setobjectxyperm LOCALID_NORMAN, 4, 107
return
PetalburgCity_Gym_EventScript_CheckNormanForRematch:: @ 820495D
@@ -60,7 +64,7 @@ PetalburgCity_Gym_EventScript_CheckNormanForRematch:: @ 820495D
goto_if_eq PetalburgCity_Gym_EventScript_DontMoveNormanToFront
compare VAR_PETALBURG_GYM_STATE, 8
goto_if_eq PetalburgCity_Gym_EventScript_DontMoveNormanToFront
- setobjectxyperm 1, 4, 107
+ setobjectxyperm LOCALID_NORMAN, 4, 107
return
PetalburgCity_Gym_EventScript_DontMoveNormanToFront:: @ 8204985
@@ -85,10 +89,10 @@ PetalburgCity_Gym_EventScript_ReturnFromWallyTutorial:: @ 82049A4
msgbox PetalburgCity_Gym_Text_WallyThankYouBye, MSGBOX_DEFAULT
closemessage
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestDown
- applymovement 10, PetalburgCity_Gym_Movement_WallyExitGym
+ applymovement LOCALID_WALLY, PetalburgCity_Gym_Movement_WallyExitGym
waitmovement 0
playse SE_KAIDAN
- removeobject 10
+ removeobject LOCALID_WALLY
setflag FLAG_HIDE_PETALBURG_CITY_WALLY
delay 30
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
@@ -146,7 +150,7 @@ PetalburgCity_Gym_EventScript_BeginWallyTutorialEast:: @ 8204AA1
end
PetalburgCity_Gym_EventScript_BeginWallyTutorial:: @ 8204AAC
- addobject 10 @ Wally
+ addobject LOCALID_WALLY
playse SE_DOOR
compare VAR_0x8008, 0
call_if_eq PetalburgCity_Gym_EventScript_WallyArriveSouth
@@ -208,7 +212,7 @@ PetalburgCity_Gym_EventScript_BeginWallyTutorial:: @ 8204AAC
call_if_eq PetalburgCity_Gym_EventScript_ExitGymWithWallyWest
compare VAR_0x8008, 3
call_if_eq PetalburgCity_Gym_EventScript_ExitGymWithWallyEast
- removeobject 10
+ removeobject LOCALID_WALLY
setflag FLAG_HIDE_PETALBURG_CITY_WALLYS_AUNT
setvar VAR_PETALBURG_GYM_STATE, 1
setvar VAR_PETALBURG_CITY_STATE, 2
@@ -222,101 +226,101 @@ PetalburgCity_Gym_EventScript_BeginWallyTutorial:: @ 8204AAC
end
PetalburgCity_Gym_EventScript_WallyArriveSouth:: @ 8204C31
- applymovement 1, Common_Movement_WalkInPlaceFastestDown
- applymovement 10, PetalburgCity_Gym_Movement_WallyArrive
+ applymovement LOCALID_NORMAN, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_WALLY, PetalburgCity_Gym_Movement_WallyArrive
waitmovement 0
return
PetalburgCity_Gym_EventScript_WallyArriveNorth:: @ 8204C43
- applymovement 10, PetalburgCity_Gym_Movement_WallyArriveNorth
+ applymovement LOCALID_WALLY, PetalburgCity_Gym_Movement_WallyArriveNorth
waitmovement 0
- applymovement 1, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_NORMAN, Common_Movement_WalkInPlaceFastestRight
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
return
PetalburgCity_Gym_EventScript_WallyArriveWestEast:: @ 8204C5F
- applymovement 1, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_NORMAN, Common_Movement_WalkInPlaceFastestDown
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestDown
- applymovement 10, PetalburgCity_Gym_Movement_WallyArrive
+ applymovement LOCALID_WALLY, PetalburgCity_Gym_Movement_WallyArrive
waitmovement 0
return
PetalburgCity_Gym_EventScript_ExitGymWithWallySouth:: @ 8204C78
- applymovement 1, Common_Movement_WalkInPlaceFastestDown
- applymovement 10, PetalburgCity_Gym_Movement_WallyExitSouthWest
+ applymovement LOCALID_NORMAN, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_WALLY, PetalburgCity_Gym_Movement_WallyExitSouthWest
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Gym_Movement_PlayerExitWithWallySouth
waitmovement 0
return
PetalburgCity_Gym_EventScript_ExitGymWithWallyNorth:: @ 8204C91
- applymovement 10, PetalburgCity_Gym_Movement_WallyExitNorth
+ applymovement LOCALID_WALLY, PetalburgCity_Gym_Movement_WallyExitNorth
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Gym_Movement_PlayerExitWithWallyNorth
waitmovement 0
return
PetalburgCity_Gym_EventScript_ExitGymWithWallyWest:: @ 8204CA3
- applymovement 10, PetalburgCity_Gym_Movement_WallyExitSouthWest
+ applymovement LOCALID_WALLY, PetalburgCity_Gym_Movement_WallyExitSouthWest
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Gym_Movement_PlayerExitWithWallyWest
waitmovement 0
return
PetalburgCity_Gym_EventScript_ExitGymWithWallyEast:: @ 8204CB5
- applymovement 10, PetalburgCity_Gym_Movement_WallyExitEast
+ applymovement LOCALID_WALLY, PetalburgCity_Gym_Movement_WallyExitEast
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Gym_Movement_PlayerExitWithWallyEast
waitmovement 0
return
PetalburgCity_Gym_EventScript_NormanAddressPlayerSouth:: @ 8204CC7
- applymovement 1, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_NORMAN, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
return
PetalburgCity_Gym_EventScript_NormanAddressPlayerNorth:: @ 8204CD2
- applymovement 1, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_NORMAN, Common_Movement_WalkInPlaceFastestDown
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
return
PetalburgCity_Gym_EventScript_NormanAddressPlayerWest:: @ 8204CE4
- applymovement 1, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_NORMAN, Common_Movement_WalkInPlaceFastestRight
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
return
PetalburgCity_Gym_EventScript_NormanAddressPlayerEast:: @ 8204CF6
- applymovement 1, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_NORMAN, Common_Movement_WalkInPlaceFastestLeft
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
return
PetalburgCity_Gym_EventScript_NormanAddressWallySouth:: @ 8204D08
- applymovement 1, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_NORMAN, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
PetalburgCity_Gym_EventScript_NormanAddressWallyNorth:: @ 8204D13
- applymovement 1, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_NORMAN, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
return
PetalburgCity_Gym_EventScript_NormanAddressWallyWest:: @ 8204D1E
- applymovement 1, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_NORMAN, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
PetalburgCity_Gym_EventScript_NormanAddressWallyEast:: @ 8204D29
- applymovement 1, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_NORMAN, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
PetalburgCity_Gym_EventScript_WallyFacePlayer:: @ 8204D34
- applymovement 10, Common_Movement_FacePlayer
+ applymovement LOCALID_WALLY, Common_Movement_FacePlayer
waitmovement 0
return
PetalburgCity_Gym_EventScript_WallyFaceDown:: @ 8204D3F
- applymovement 10, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_WALLY, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
@@ -345,7 +349,7 @@ PetalburgCity_Gym_EventScript_NormanFaceDoorSouth:: @ 8204D72
@ For all other NormanFaceDoorX, Norman is already facing the door from NormanAddressWallyX
PetalburgCity_Gym_EventScript_NormanFaceDoorNorth:: @ 8204D73
- applymovement 1, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_NORMAN, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
@@ -397,7 +401,7 @@ PetalburgCity_Gym_EventScript_DontGiveEnigmaBerry:: @ 8204E17
PetalburgCity_Gym_EventScript_GiveEnigmaBerry:: @ 8204E1D
giveitem ITEM_ENIGMA_BERRY
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_ShowBagIsFull
setvar VAR_ENIGMA_BERRY_AVAILABLE, 0
release
@@ -429,7 +433,7 @@ PetalburgCity_Gym_EventScript_NormanBattle:: @ 8204E3B
delay 40
playse SE_DOOR
delay 10
- addobject 11 @ Wallys Uncle
+ addobject LOCALID_WALLYS_UNCLE
switch VAR_FACING
case DIR_NORTH, PetalburgCity_Gym_EventScript_WallysUncleArrivesNorth
case DIR_WEST, PetalburgCity_Gym_EventScript_WallysUncleArrivesWest
@@ -438,7 +442,7 @@ PetalburgCity_Gym_EventScript_NormanBattle:: @ 8204E3B
PetalburgCity_Gym_EventScript_GiveFacade:: @ 8204ED2
giveitem ITEM_TM42
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_BagIsFull
setflag FLAG_RECEIVED_TM42
msgbox PetalburgCity_Gym_Text_ExplainFacade, MSGBOX_DEFAULT
@@ -457,12 +461,12 @@ PetalburgCity_Gym_EventScript_WallysUncleArrivesWest:: @ 8204F09
goto PetalburgCity_Gym_EventScript_WallysUncleArrives
PetalburgCity_Gym_EventScript_WallysUncleArrives:: @ 8204F13
- applymovement 11, PetalburgCity_Gym_Movement_WallysUncleEnterGym
+ applymovement LOCALID_WALLYS_UNCLE, PetalburgCity_Gym_Movement_WallysUncleEnterGym
waitmovement 0
playse SE_PIN
- applymovement 11, Common_Movement_ExclamationMark
+ applymovement LOCALID_WALLYS_UNCLE, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 11, Common_Movement_Delay48
+ applymovement LOCALID_WALLYS_UNCLE, Common_Movement_Delay48
waitmovement 0
delay 10
compare VAR_0x8008, 1
@@ -490,7 +494,7 @@ PetalburgCity_Gym_EventScript_WallysUncleArrives:: @ 8204F13
call_if_eq PetalburgCity_Gym_EventScript_ExitGymWithWallysUncleEast
compare VAR_0x8008, 3
call_if_eq PetalburgCity_Gym_EventScript_ExitGymWithWallysUncleWest
- removeobject 11
+ removeobject LOCALID_WALLYS_UNCLE
setvar VAR_PETALBURG_CITY_STATE, 4
clearflag FLAG_HIDE_PETALBURG_CITY_WALLYS_UNCLE
warp MAP_PETALBURG_CITY, 255, 15, 8
@@ -499,59 +503,59 @@ PetalburgCity_Gym_EventScript_WallysUncleArrives:: @ 8204F13
end
PetalburgCity_Gym_EventScript_WallysUncleFaceNormanNorth:: @ 8204FCC
- applymovement 11, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_WALLYS_UNCLE, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
return
PetalburgCity_Gym_EventScript_WallysUncleFaceNormanEast:: @ 8204FD7
- applymovement 11, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_WALLYS_UNCLE, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
return
PetalburgCity_Gym_EventScript_WallysUncleFaceNormanWest:: @ 8204FE2
- applymovement 11, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_WALLYS_UNCLE, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
return
PetalburgCity_Gym_EventScript_WallysUncleApproachPlayerNorth:: @ 8204FED
- applymovement 11, PetalburgCity_Gym_Movement_WallysUncleApproachPlayerNorth
+ applymovement LOCALID_WALLYS_UNCLE, PetalburgCity_Gym_Movement_WallysUncleApproachPlayerNorth
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
- applymovement 1, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_NORMAN, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
return
PetalburgCity_Gym_EventScript_WallysUncleApproachPlayerEast:: @ 8205009
- applymovement 11, PetalburgCity_Gym_Movement_WallysUncleApproachPlayerEast
+ applymovement LOCALID_WALLYS_UNCLE, PetalburgCity_Gym_Movement_WallysUncleApproachPlayerEast
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestDown
- applymovement 1, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_NORMAN, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
PetalburgCity_Gym_EventScript_WallysUncleApproachPlayerWest:: @ 8205025
- applymovement 11, PetalburgCity_Gym_Movement_WallysUncleApproachPlayerWest
+ applymovement LOCALID_WALLYS_UNCLE, PetalburgCity_Gym_Movement_WallysUncleApproachPlayerWest
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestDown
- applymovement 1, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_NORMAN, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
PetalburgCity_Gym_EventScript_ExitGymWithWallysUncleNorth:: @ 8205041
- applymovement 11, PetalburgCity_Gym_Movement_WallysUncleExitNorth
- applymovement 1, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_WALLYS_UNCLE, PetalburgCity_Gym_Movement_WallysUncleExitNorth
+ applymovement LOCALID_NORMAN, Common_Movement_WalkInPlaceFastestDown
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Gym_Movement_PlayerExitWithWallysUncleNorth
waitmovement 0
return
PetalburgCity_Gym_EventScript_ExitGymWithWallysUncleEast:: @ 820505A
- applymovement 11, PetalburgCity_Gym_Movement_WallysUncleExitEast
+ applymovement LOCALID_WALLYS_UNCLE, PetalburgCity_Gym_Movement_WallysUncleExitEast
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Gym_Movement_PlayerExitWithWallysUncleEast
waitmovement 0
return
PetalburgCity_Gym_EventScript_ExitGymWithWallysUncleWest:: @ 820506C
- applymovement 11, PetalburgCity_Gym_Movement_WallysUncleExitWest
+ applymovement LOCALID_WALLYS_UNCLE, PetalburgCity_Gym_Movement_WallysUncleExitWest
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Gym_Movement_PlayerExitWithWallysUncleWest
waitmovement 0
return
diff --git a/data/maps/PetalburgCity_PokemonCenter_1F/scripts.inc b/data/maps/PetalburgCity_PokemonCenter_1F/scripts.inc
index 151cd8afb..591014164 100644
--- a/data/maps/PetalburgCity_PokemonCenter_1F/scripts.inc
+++ b/data/maps/PetalburgCity_PokemonCenter_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_NURSE, 1
+
PetalburgCity_PokemonCenter_1F_MapScripts:: @ 82079E8
map_script MAP_SCRIPT_ON_TRANSITION, PetalburgCity_PokemonCenter_1F_OnTransition
map_script MAP_SCRIPT_ON_RESUME, CableClub_OnResume
@@ -8,9 +10,8 @@ PetalburgCity_PokemonCenter_1F_OnTransition: @ 82079F3
call Common_EventScript_UpdateBrineyLocation
end
-@ VAR_0x800B is the Nurse's object event id
PetalburgCity_PokemonCenter_1F_EventScript_Nurse:: @ 82079FC
- setvar VAR_0x800B, 1
+ setvar VAR_0x800B, LOCALID_NURSE
call Common_EventScript_PkmnCenterNurse
waitmessage
waitbuttonpress
@@ -30,7 +31,7 @@ PetalburgCity_PokemonCenter_1F_EventScript_Woman:: @ 8207A1C
faceplayer
msgbox PetalburgCity_PokemonCenter_1F_Text_ManyTypesOfPokemon, MSGBOX_DEFAULT
specialvar VAR_RESULT, IsStarterInParty
- compare VAR_RESULT, 1
+ compare VAR_RESULT, TRUE
goto_if_eq PetalburgCity_PokemonCenter_1F_EventScript_SayStarterTypeInfo
release
end
diff --git a/data/maps/PetalburgCity_WallysHouse/scripts.inc b/data/maps/PetalburgCity_WallysHouse/scripts.inc
index c4be6b292..a46f5d78d 100644
--- a/data/maps/PetalburgCity_WallysHouse/scripts.inc
+++ b/data/maps/PetalburgCity_WallysHouse/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_WALLYS_UNCLE, 1
+
PetalburgCity_WallysHouse_MapScripts:: @ 8204229
map_script MAP_SCRIPT_ON_FRAME_TABLE, PetalburgCity_WallysHouse_OnFrame
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, PetalburgCity_WallysHouse_OnWarp
@@ -9,7 +11,7 @@ PetalburgCity_WallysHouse_OnWarp: @ 8204234
PetalburgCity_WallysHouse_EventScript_PlayerUncleFaceEachOther:: @ 820423E
turnobject OBJ_EVENT_ID_PLAYER, DIR_EAST
- turnobject 1, DIR_WEST
+ turnobject LOCALID_WALLYS_UNCLE, DIR_WEST
end
PetalburgCity_WallysHouse_OnFrame: @ 8204247
diff --git a/data/maps/PetalburgWoods/scripts.inc b/data/maps/PetalburgWoods/scripts.inc
index bbd888e05..292c2dfac 100644
--- a/data/maps/PetalburgWoods/scripts.inc
+++ b/data/maps/PetalburgWoods/scripts.inc
@@ -1,37 +1,40 @@
+.set LOCALID_GRUNT, 3
+.set LOCALID_DEVON_EMPLOYEE, 4
+
PetalburgWoods_MapScripts:: @ 822DFD6
.byte 0
PetalburgWoods_EventScript_DevonResearcherLeft:: @ 822DFD7
lockall
call PetalburgWoods_EventScript_DevonResearcherIntro
- applymovement 4, PetalburgWoods_Movement_DevonResearcherApproachPlayerLeft
+ applymovement LOCALID_DEVON_EMPLOYEE, PetalburgWoods_Movement_DevonResearcherApproachPlayerLeft
waitmovement 0
msgbox PetalburgWoods_Text_HaveYouSeenShroomish, MSGBOX_DEFAULT
closemessage
playbgm MUS_AQA_0, 0
- applymovement 3, PetalburgWoods_Movement_AquaEntrance
+ applymovement LOCALID_GRUNT, PetalburgWoods_Movement_AquaEntrance
waitmovement 0
msgbox PetalburgWoods_Text_IWasGoingToAmbushYou, MSGBOX_DEFAULT
closemessage
- applymovement 3, PetalburgWoods_Movement_AquaApproachResearcherLeft
+ applymovement LOCALID_GRUNT, PetalburgWoods_Movement_AquaApproachResearcherLeft
waitmovement 0
- applymovement 4, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
msgbox PetalburgWoods_Text_HandOverThosePapers, MSGBOX_DEFAULT
closemessage
- applymovement 4, PetalburgWoods_Movement_DevonResearcherFleeToPlayerLeft
+ applymovement LOCALID_DEVON_EMPLOYEE, PetalburgWoods_Movement_DevonResearcherFleeToPlayerLeft
waitmovement 0
msgbox PetalburgWoods_Text_YouHaveToHelpMe, MSGBOX_DEFAULT
closemessage
- applymovement 3, PetalburgWoods_Movement_AquaApproachPlayer
+ applymovement LOCALID_GRUNT, PetalburgWoods_Movement_AquaApproachPlayer
waitmovement 0
msgbox PetalburgWoods_Text_NoOneCrossesTeamAqua, MSGBOX_DEFAULT
trainerbattle_no_intro TRAINER_GRUNT_PETALBURG_WOODS, PetalburgWoods_Text_YoureKiddingMe
- applymovement 3, PetalburgWoods_Movement_AquaBackOff
+ applymovement LOCALID_GRUNT, PetalburgWoods_Movement_AquaBackOff
waitmovement 0
call PetalburgWoods_EventScript_DevonResearcherPostBattle
applymovement OBJ_EVENT_ID_PLAYER, PetalburgWoods_Movement_WatchResearcherLeave
- applymovement 4, PetalburgWoods_Movement_DevonResearcherExitLeft
+ applymovement LOCALID_DEVON_EMPLOYEE, PetalburgWoods_Movement_DevonResearcherExitLeft
waitmovement 0
goto PetalburgWoods_EventScript_RemoveDevonResearcher
end
@@ -39,41 +42,41 @@ PetalburgWoods_EventScript_DevonResearcherLeft:: @ 822DFD7
PetalburgWoods_EventScript_DevonResearcherRight:: @ 822E079
lockall
call PetalburgWoods_EventScript_DevonResearcherIntro
- applymovement 4, PetalburgWoods_Movement_DevonResearcherApproachPlayerRight
+ applymovement LOCALID_DEVON_EMPLOYEE, PetalburgWoods_Movement_DevonResearcherApproachPlayerRight
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
msgbox PetalburgWoods_Text_HaveYouSeenShroomish, MSGBOX_DEFAULT
closemessage
playbgm MUS_AQA_0, 0
- applymovement 3, PetalburgWoods_Movement_AquaEntrance
+ applymovement LOCALID_GRUNT, PetalburgWoods_Movement_AquaEntrance
waitmovement 0
msgbox PetalburgWoods_Text_IWasGoingToAmbushYou, MSGBOX_DEFAULT
closemessage
- applymovement 3, PetalburgWoods_Movement_AquaApproachResearcherRight
+ applymovement LOCALID_GRUNT, PetalburgWoods_Movement_AquaApproachResearcherRight
waitmovement 0
- applymovement 4, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
msgbox PetalburgWoods_Text_HandOverThosePapers, MSGBOX_DEFAULT
closemessage
- applymovement 4, PetalburgWoods_Movement_DevonResearcherFleeToPlayerRight
+ applymovement LOCALID_DEVON_EMPLOYEE, PetalburgWoods_Movement_DevonResearcherFleeToPlayerRight
waitmovement 0
msgbox PetalburgWoods_Text_YouHaveToHelpMe, MSGBOX_DEFAULT
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
msgbox PetalburgWoods_Text_NoOneCrossesTeamAqua, MSGBOX_DEFAULT
trainerbattle_no_intro TRAINER_GRUNT_PETALBURG_WOODS, PetalburgWoods_Text_YoureKiddingMe
- applymovement 3, PetalburgWoods_Movement_AquaBackOff
+ applymovement LOCALID_GRUNT, PetalburgWoods_Movement_AquaBackOff
waitmovement 0
call PetalburgWoods_EventScript_DevonResearcherPostBattle
applymovement OBJ_EVENT_ID_PLAYER, PetalburgWoods_Movement_WatchResearcherLeave
- applymovement 4, PetalburgWoods_Movement_DevonResearcherExitRight
+ applymovement LOCALID_DEVON_EMPLOYEE, PetalburgWoods_Movement_DevonResearcherExitRight
waitmovement 0
goto PetalburgWoods_EventScript_RemoveDevonResearcher
end
PetalburgWoods_EventScript_DevonResearcherIntro:: @ 822E124
- applymovement 4, PetalburgWoods_Movement_DevonResearcherLookAround
+ applymovement LOCALID_DEVON_EMPLOYEE, PetalburgWoods_Movement_DevonResearcherLookAround
waitmovement 0
msgbox PetalburgWoods_Text_NotAOneToBeFound, MSGBOX_DEFAULT
closemessage
@@ -82,14 +85,14 @@ PetalburgWoods_EventScript_DevonResearcherIntro:: @ 822E124
PetalburgWoods_EventScript_DevonResearcherPostBattle:: @ 822E138
msgbox PetalburgWoods_Text_YouveGotSomeNerve, MSGBOX_DEFAULT
closemessage
- applymovement 3, PetalburgWoods_Movement_AquaRunAway
+ applymovement LOCALID_GRUNT, PetalburgWoods_Movement_AquaRunAway
waitmovement 0
- removeobject 3
+ removeobject LOCALID_GRUNT
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
msgbox PetalburgWoods_Text_ThatWasAwfullyClose, MSGBOX_DEFAULT
giveitem ITEM_GREAT_BALL
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq PetalburgWoods_EventScript_BagFull
goto PetalburgWoods_EventScript_DevonResearcherFinish
end
@@ -101,14 +104,14 @@ PetalburgWoods_EventScript_BagFull:: @ 822E17D
PetalburgWoods_EventScript_DevonResearcherFinish:: @ 822E18B
msgbox PetalburgWoods_Text_TeamAquaAfterSomethingInRustboro, MSGBOX_DEFAULT
- applymovement 4, PetalburgWoods_Movement_DevonResearcherStartExit
+ applymovement LOCALID_DEVON_EMPLOYEE, PetalburgWoods_Movement_DevonResearcherStartExit
waitmovement 0
msgbox PetalburgWoods_Text_ICantBeWastingTime, MSGBOX_DEFAULT
closemessage
return
PetalburgWoods_EventScript_RemoveDevonResearcher:: @ 822E1A7
- removeobject 4
+ removeobject LOCALID_DEVON_EMPLOYEE
setvar VAR_PETALBURG_WOODS_STATE, 1
releaseall
end
@@ -252,7 +255,7 @@ PetalburgWoods_EventScript_Girl:: @ 822E222
goto_if_set FLAG_RECEIVED_MIRACLE_SEED, PetalburgWoods_EventScript_ExplainMiracleSeed
msgbox PetalburgWoods_Text_TryUsingThisItem, MSGBOX_DEFAULT
giveitem ITEM_MIRACLE_SEED
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_ShowBagIsFull
setflag FLAG_RECEIVED_MIRACLE_SEED
release
@@ -279,11 +282,11 @@ PetalburgWoods_EventScript_Lyle:: @ 822E26D
PetalburgWoods_EventScript_James:: @ 822E284
trainerbattle_single TRAINER_JAMES_1, PetalburgWoods_Text_InstantlyPopularWithBugPokemon, PetalburgWoods_Text_CantBePopularIfILose, PetalburgWoods_EventScript_TryRegisterJames
specialvar VAR_RESULT, ShouldTryRematchBattle
- compare VAR_RESULT, 1
+ compare VAR_RESULT, TRUE
goto_if_eq PetalburgWoods_EventScript_JamesRematch
setvar VAR_0x8004, TRAINER_JAMES_1
specialvar VAR_RESULT, IsTrainerRegistered
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq PetalburgWoods_EventScript_TryRegisterJames2
msgbox PetalburgWoods_Text_PeopleRespectYou, MSGBOX_DEFAULT
release
diff --git a/data/maps/Route101/scripts.inc b/data/maps/Route101/scripts.inc
index e1805b73d..647c9ee16 100644
--- a/data/maps/Route101/scripts.inc
+++ b/data/maps/Route101/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_BIRCH, 2
+.set LOCALID_ZIGZAGOON, 4
+
Route101_MapScripts:: @ 81EBCBA
map_script MAP_SCRIPT_ON_TRANSITION, Route101_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, Route101_OnFrame
@@ -21,19 +24,19 @@ Route101_EventScript_StartBirchRescue:: @ 81EBCDE
playbgm MUS_EVENT0, 1
msgbox Route101_Text_HelpMe, MSGBOX_DEFAULT
closemessage
- setobjectxy 2, 0, 15
- setobjectxy 4, 0, 16
+ setobjectxy LOCALID_BIRCH, 0, 15
+ setobjectxy LOCALID_ZIGZAGOON, 0, 16
applymovement OBJ_EVENT_ID_PLAYER, Route101_Movement_EnterScene
- applymovement 2, Route101_Movement_BirchRunAway1
- applymovement 4, Route101_Movement_PoochyenaChase1
+ applymovement LOCALID_BIRCH, Route101_Movement_BirchRunAway1
+ applymovement LOCALID_ZIGZAGOON, Route101_Movement_ZigzagoonChase1
waitmovement 0
- applymovement 4, Route101_Movement_PoochyenaChaseInCircles
- applymovement 2, Route101_Movement_BirchRunInCircles
+ applymovement LOCALID_ZIGZAGOON, Route101_Movement_ZigzagoonChaseInCircles
+ applymovement LOCALID_BIRCH, Route101_Movement_BirchRunInCircles
waitmovement 0
- applymovement 2, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_BIRCH, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
- applymovement 4, Route101_Movement_PoochyenaFaceBirch
- applymovement 2, Route101_Movement_BirchFacePoochyena
+ applymovement LOCALID_ZIGZAGOON, Route101_Movement_ZigzagoonFaceBirch
+ applymovement LOCALID_BIRCH, Route101_Movement_BirchFaceZigzagoon
waitmovement 0
msgbox Route101_Text_PleaseHelp, MSGBOX_DEFAULT
closemessage
@@ -80,7 +83,7 @@ Route101_Movement_PreventExitNorth: @ 81EBD94
walk_down
step_end
-Route101_Movement_PoochyenaChaseInCircles: @ 81EBD96
+Route101_Movement_ZigzagoonChaseInCircles: @ 81EBD96
walk_fast_up
walk_fast_up
walk_fast_up
@@ -113,7 +116,7 @@ Route101_Movement_PoochyenaChaseInCircles: @ 81EBD96
walk_fast_left
step_end
-Route101_Movement_PoochyenaChase1: @ 81EBDB5
+Route101_Movement_ZigzagoonChase1: @ 81EBDB5
walk_fast_up
walk_fast_right
walk_fast_right
@@ -125,7 +128,7 @@ Route101_Movement_PoochyenaChase1: @ 81EBDB5
@ Leftover data? This command is unused.
step_end
-Route101_Movement_PoochyenaFaceBirch: @ 81EBDBD
+Route101_Movement_ZigzagoonFaceBirch: @ 81EBDBD
walk_in_place_fast_left
walk_in_place_fast_left
walk_in_place_fast_left
@@ -185,7 +188,7 @@ Route101_Movement_BirchRunAway1: @ 81EBDE7
@ Leftover data? This command is unused.
step_end
-Route101_Movement_BirchFacePoochyena: @ 81EBDEF
+Route101_Movement_BirchFaceZigzagoon: @ 81EBDEF
walk_in_place_fast_right
walk_in_place_fast_right
walk_in_place_fast_right
@@ -221,13 +224,13 @@ Route101_EventScript_BirchsBag:: @ 81EBE16
setflag FLAG_SYS_POKEMON_GET
setflag FLAG_RESCUED_BIRCH
fadescreen FADE_TO_BLACK
- removeobject 4
+ removeobject LOCALID_ZIGZAGOON
setobjectxy OBJ_EVENT_ID_PLAYER, 6, 13
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
special ChooseStarter
waitstate
- applymovement 2, Route101_Movement_BirchApproachPlayer
+ applymovement LOCALID_BIRCH, Route101_Movement_BirchApproachPlayer
waitmovement 0
msgbox Route101_Text_YouSavedMe, MSGBOX_DEFAULT
special HealPlayerParty
diff --git a/data/maps/Route103/scripts.inc b/data/maps/Route103/scripts.inc
index 34f832b1e..df8c3b628 100644
--- a/data/maps/Route103/scripts.inc
+++ b/data/maps/Route103/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_RIVAL, 2
+
Route103_MapScripts:: @ 81EC38E
map_script MAP_SCRIPT_ON_TRANSITION, Route103_OnTransition
map_script MAP_SCRIPT_ON_LOAD, Route103_OnLoad
@@ -30,11 +32,11 @@ Route103_EventScript_RivalMay:: @ 81EC3DA
msgbox Route103_Text_MayRoute103Pokemon, MSGBOX_DEFAULT
closemessage
playbgm MUS_GIRL_SUP, 1
- applymovement 2, Common_Movement_FacePlayer
+ applymovement LOCALID_RIVAL, Common_Movement_FacePlayer
waitmovement 0
- applymovement 2, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 2, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
msgbox Route103_Text_MayLetsBattle, MSGBOX_DEFAULT
switch VAR_STARTER_MON
@@ -47,11 +49,11 @@ Route103_EventScript_RivalBrendan:: @ 81EC434
msgbox Route103_Text_BrendanRoute103Pokemon, MSGBOX_DEFAULT
closemessage
playbgm MUS_BOY_SUP, 1
- applymovement 2, Common_Movement_FacePlayer
+ applymovement LOCALID_RIVAL, Common_Movement_FacePlayer
waitmovement 0
- applymovement 2, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 2, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
msgbox Route103_Text_BrendanLetsBattle, MSGBOX_DEFAULT
switch VAR_STARTER_MON
@@ -111,35 +113,35 @@ Route103_EventScript_RivalExit:: @ 81EC50A
Route103_EventScript_RivalExitFacingNorth:: @ 81EC53D
applymovement OBJ_EVENT_ID_PLAYER, Route103_Movement_WatchRivalExitFacingNorth
- applymovement 2, Route103_Movement_RivalExitFacingNorth1
+ applymovement LOCALID_RIVAL, Route103_Movement_RivalExitFacingNorth1
waitmovement 0
playse SE_DANSA
- applymovement 2, Route103_EventScript_RivalExitFacingNorth2
+ applymovement LOCALID_RIVAL, Route103_EventScript_RivalExitFacingNorth2
waitmovement 0
goto Route103_EventScript_RivalEnd
end
Route103_EventScript_RivalExitFacingEastOrWest:: @ 81EC561
applymovement OBJ_EVENT_ID_PLAYER, Route103_Movement_WatchRivalExitFacingEastOrWest
- applymovement 2, Route103_Movement_RivalExit1
+ applymovement LOCALID_RIVAL, Route103_Movement_RivalExit1
waitmovement 0
playse SE_DANSA
- applymovement 2, Route103_Movement_RivalExit2
+ applymovement LOCALID_RIVAL, Route103_Movement_RivalExit2
waitmovement 0
goto Route103_EventScript_RivalEnd
end
Route103_EventScript_RivalExitFacingSouth:: @ 81EC585
- applymovement 2, Route103_Movement_RivalExit1
+ applymovement LOCALID_RIVAL, Route103_Movement_RivalExit1
waitmovement 0
playse SE_DANSA
- applymovement 2, Route103_Movement_RivalExit2
+ applymovement LOCALID_RIVAL, Route103_Movement_RivalExit2
waitmovement 0
goto Route103_EventScript_RivalEnd
end
Route103_EventScript_RivalEnd:: @ 81EC5A2
- removeobject 2
+ removeobject LOCALID_RIVAL
setvar VAR_BIRCH_LAB_STATE, 4
clearflag FLAG_HIDE_LITTLEROOT_TOWN_BIRCHS_LAB_RIVAL
setflag FLAG_DEFEATED_RIVAL_ROUTE103
diff --git a/data/maps/Route104/scripts.inc b/data/maps/Route104/scripts.inc
index e7e698be6..ff9003887 100644
--- a/data/maps/Route104/scripts.inc
+++ b/data/maps/Route104/scripts.inc
@@ -1,3 +1,7 @@
+@ NOTE: Route 104's sail to Dewford script references local IDs from Dewford's map.
+@ These are labeled in DewfordTown/scripts.inc
+.set LOCALID_RIVAL, 34
+
Route104_MapScripts:: @ 81ECC32
map_script MAP_SCRIPT_ON_FRAME_TABLE, Route104_OnFrame
map_script MAP_SCRIPT_ON_TRANSITION, Route104_OnTransition
@@ -33,7 +37,7 @@ Route104_EventScript_TrySetRivalPos:: @ 81ECC78
goto_if_ge Route104_EventScript_DontSetRivalPos
goto_if_set FLAG_MET_RIVAL_RUSTBORO, Route104_EventScript_DontSetRivalPos
goto_if_unset FLAG_REGISTER_RIVAL_POKENAV, Route104_EventScript_DontSetRivalPos
- setobjectxyperm 34, 17, 52
+ setobjectxyperm LOCALID_RIVAL, 17, 52
return
Route104_EventScript_DontSetRivalPos:: @ 81ECC9D
@@ -42,7 +46,7 @@ Route104_EventScript_DontSetRivalPos:: @ 81ECC9D
Route104_EventScript_Rival:: @ 81ECC9E
lockall
setvar VAR_0x8008, 1
- applymovement 34, Common_Movement_FacePlayer
+ applymovement LOCALID_RIVAL, Common_Movement_FacePlayer
waitmovement 0
goto Route104_EventScript_RivalEncounter
@@ -54,19 +58,19 @@ Route104_EventScript_RivalTrigger:: @ 81ECCB3
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
delay 10
- addobject 34
+ addobject LOCALID_RIVAL
clearflag FLAG_HIDE_ROUTE_104_RIVAL
applymovement OBJ_EVENT_ID_PLAYER, Route104_Movement_PlayerBackUp
waitmovement 0
- applymovement 34, Route104_Movement_RivalExitBrineysCottage
+ applymovement LOCALID_RIVAL, Route104_Movement_RivalExitBrineysCottage
waitmovement 0
delay 20
setvar VAR_0x8008, 0
call RustboroCity_EventScript_PlayRivalMusic
playse SE_PIN
- applymovement 34, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 34, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
goto Route104_EventScript_RivalEncounter
@@ -109,13 +113,13 @@ Route104_EventScript_MayEncounter:: @ 81ECD4B
delay 30
setflag FLAG_ENABLE_RIVAL_MATCH_CALL
applymovement OBJ_EVENT_ID_PLAYER, Route104_Movement_PlayerFaceRival
- applymovement 34, Route104_Movement_RivalWalkSlowLeft
+ applymovement LOCALID_RIVAL, Route104_Movement_RivalWalkSlowLeft
msgbox Route104_Text_MayHowsYourPokedex, MSGBOX_DEFAULT
closemessage
waitmovement 0
- applymovement 34, Route104_Movement_RivalApproachPlayer
+ applymovement LOCALID_RIVAL, Route104_Movement_RivalApproachPlayer
waitmovement 0
- copyobjectxytoperm 34
+ copyobjectxytoperm LOCALID_RIVAL
msgbox Route104_Text_MayMinesDecentLetsBattle, MSGBOX_YESNO
compare VAR_RESULT, YES
goto_if_eq Route104_EventScript_BattleMay
@@ -198,13 +202,13 @@ Route104_EventScript_BrendanEncounter:: @ 81ECE6F
delay 30
setflag FLAG_ENABLE_RIVAL_MATCH_CALL
applymovement OBJ_EVENT_ID_PLAYER, Route104_Movement_PlayerFaceRival
- applymovement 34, Route104_Movement_RivalWalkSlowLeft
+ applymovement LOCALID_RIVAL, Route104_Movement_RivalWalkSlowLeft
msgbox Route104_Text_BrendanHowsYourPokedex, MSGBOX_DEFAULT
closemessage
waitmovement 0
- applymovement 34, Route104_Movement_RivalApproachPlayer
+ applymovement LOCALID_RIVAL, Route104_Movement_RivalApproachPlayer
waitmovement 0
- copyobjectxytoperm 34
+ copyobjectxytoperm LOCALID_RIVAL
msgbox Route104_Text_BrendanDoingGreatLetsBattle, MSGBOX_YESNO
compare VAR_RESULT, YES
goto_if_eq Route104_EventScript_BattleBrendan
@@ -357,11 +361,11 @@ Route104_EventScript_Girl2:: @ 81ED090
end
Route104_EventScript_SailToDewford:: @ 81ED099
- setobjectpriority 8, MAP_ROUTE104, 0
+ setobjectpriority LOCALID_BRINEY_R104, MAP_ROUTE104, 0
setobjectpriority OBJ_EVENT_ID_PLAYER, MAP_ROUTE104, 0
- applymovement 8, Route104_Movement_BrineyBoardBoat
+ applymovement LOCALID_BRINEY_R104, Route104_Movement_BrineyBoardBoat
waitmovement 0
- removeobject 8
+ removeobject LOCALID_BRINEY_R104
applymovement OBJ_EVENT_ID_PLAYER, Route104_Movement_PlayerBoardBoat
waitmovement 0
hideobjectat OBJ_EVENT_ID_PLAYER, MAP_ROUTE104
@@ -371,13 +375,13 @@ Route104_EventScript_SailToDewford:: @ 81ED099
end
Route104_EventScript_SailToDewfordNoCall:: @ 81ED0D9
- applymovement 7, Route104_Movement_SailToDewford
+ applymovement LOCALID_BOAT_R104, Route104_Movement_SailToDewford
applymovement OBJ_EVENT_ID_PLAYER, Route104_Movement_SailToDewford
waitmovement 0
goto Route104_EventScript_ArriveInDewford
Route104_EventScript_SailToDewfordDadCalls:: @ 81ED0EF
- applymovement 7, Route104_Movement_SailToDewfordBeforeDadCalls
+ applymovement LOCALID_BOAT_R104, Route104_Movement_SailToDewfordBeforeDadCalls
applymovement OBJ_EVENT_ID_PLAYER, Route104_Movement_SailToDewfordBeforeDadCalls
waitmovement 0
pokenavcall Route104_Text_DadPokenavCall
@@ -390,8 +394,8 @@ Route104_EventScript_SailToDewfordDadCalls:: @ 81ED0EF
delay 30
setflag FLAG_ENABLE_NORMAN_MATCH_CALL
applymovement OBJ_EVENT_ID_PLAYER, Route104_Movement_SailToDewfordAfterDadCalls
- applymovement 7, Route104_Movement_SailToDewfordAfterDadCalls, MAP_ROUTE104
- waitmovement 7, MAP_ROUTE104
+ applymovement LOCALID_BOAT_R104, Route104_Movement_SailToDewfordAfterDadCalls, MAP_ROUTE104
+ waitmovement LOCALID_BOAT_R104, MAP_ROUTE104
waitmovement 0
goto Route104_EventScript_ArriveInDewford
@@ -403,21 +407,21 @@ Route104_EventScript_ArriveInDewford:: @ 81ED139
showobjectat OBJ_EVENT_ID_PLAYER, MAP_DEWFORD_TOWN
applymovement OBJ_EVENT_ID_PLAYER, Route104_Movement_PlayerMoveForBriney
waitmovement 0
- setobjectxyperm 2, 12, 8
- addobject 2
- setobjectpriority 2, MAP_DEWFORD_TOWN, 0
+ setobjectxyperm LOCALID_BRINEY_DEWFORD, 12, 8
+ addobject LOCALID_BRINEY_DEWFORD
+ setobjectpriority LOCALID_BRINEY_DEWFORD, MAP_DEWFORD_TOWN, 0
clearflag FLAG_HIDE_MR_BRINEY_DEWFORD_TOWN
- applymovement 2, Route104_Movement_BrineyExitBoat
+ applymovement LOCALID_BRINEY_DEWFORD, Route104_Movement_BrineyExitBoat
waitmovement 0
- addobject 4
+ addobject LOCALID_BOAT_DEWFORD
clearflag FLAG_HIDE_MR_BRINEY_BOAT_DEWFORD_TOWN
call Common_EventScript_StopBrineysBoatMusic
setflag FLAG_HIDE_ROUTE_104_MR_BRINEY_BOAT
- hideobjectat 7, MAP_ROUTE104
+ hideobjectat LOCALID_BOAT_R104, MAP_ROUTE104
copyvar VAR_BRINEY_LOCATION, VAR_0x8008
resetobjectpriority OBJ_EVENT_ID_PLAYER, MAP_ROUTE104
- resetobjectpriority 2, MAP_DEWFORD_TOWN
- copyobjectxytoperm 2
+ resetobjectpriority LOCALID_BRINEY_DEWFORD, MAP_DEWFORD_TOWN
+ copyobjectxytoperm LOCALID_BRINEY_DEWFORD
setvar VAR_BOARD_BRINEY_BOAT_STATE, 0
goto_if_unset FLAG_DELIVERED_STEVEN_LETTER, Route104_EventScript_DeliverLetterReminder
goto_if_set FLAG_DELIVERED_STEVEN_LETTER, Route104_EventScript_LandedInDewford
diff --git a/data/maps/Route104_MrBrineysHouse/scripts.inc b/data/maps/Route104_MrBrineysHouse/scripts.inc
index 10fdddee3..aef3ae80f 100644
--- a/data/maps/Route104_MrBrineysHouse/scripts.inc
+++ b/data/maps/Route104_MrBrineysHouse/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_BRINEY, 1
+.set LOCALID_PEEKO, 2
+
Route104_MrBrineysHouse_MapScripts:: @ 8229D2E
map_script MAP_SCRIPT_ON_TRANSITION, Route104_MrBrineysHouse_OnTransition
.byte 0
@@ -14,10 +17,10 @@ Route104_MrBrineysHouse_EventScript_HideRustboroRival:: @ 8229D4C
return
Route104_MrBrineysHouse_EventScript_SetBrineyPeekoPos:: @ 8229D50
- setobjectxyperm 1, 9, 3
- setobjectmovementtype 1, MOVEMENT_TYPE_WALK_SEQUENCE_DOWN_LEFT_UP_RIGHT
- setobjectxyperm 2, 9, 6
- setobjectmovementtype 2, MOVEMENT_TYPE_WALK_SEQUENCE_LEFT_UP_RIGHT_DOWN
+ setobjectxyperm LOCALID_BRINEY, 9, 3
+ setobjectmovementtype LOCALID_BRINEY, MOVEMENT_TYPE_WALK_SEQUENCE_DOWN_LEFT_UP_RIGHT
+ setobjectxyperm LOCALID_PEEKO, 9, 6
+ setobjectmovementtype LOCALID_PEEKO, MOVEMENT_TYPE_WALK_SEQUENCE_LEFT_UP_RIGHT_DOWN
return
Route104_MrBrineysHouse_EventScript_Briney:: @ 8229D67
diff --git a/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc b/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc
index 253ae7192..e2ed46ddc 100644
--- a/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc
+++ b/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_OWNER, 1
+
Route104_PrettyPetalFlowerShop_MapScripts:: @ 822A34C
map_script MAP_SCRIPT_ON_TRANSITION, Route104_PrettyPetalFlowerShop_OnTransition
.byte 0
@@ -10,7 +12,7 @@ Route104_PrettyPetalFlowerShop_OnTransition: @ 822A352
end
Route104_PrettyPetalFlowerShop_EventScript_MoveShopOwner:: @ 822A36B
- setobjectxyperm 1, 4, 6
+ setobjectxyperm LOCALID_OWNER, 4, 6
end
Route104_PrettyPetalFlowerShop_EventScript_ShopOwner:: @ 822A373
diff --git a/data/maps/Route109/scripts.inc b/data/maps/Route109/scripts.inc
index 39fa352e4..26da7f2b5 100644
--- a/data/maps/Route109/scripts.inc
+++ b/data/maps/Route109/scripts.inc
@@ -1,13 +1,16 @@
+@ NOTE: Route 109's sail to Dewford script references local IDs from Dewford's map.
+@ These are labeled in DewfordTown/scripts.inc
+
Route109_MapScripts:: @ 81EE75F
.byte 0
Route109_EventScript_StartDepartForDewford:: @ 81EE760
call EventScript_BackupMrBrineyLocation
- setobjectpriority 2, MAP_ROUTE109, 0
+ setobjectpriority LOCALID_BRINEY_R109, MAP_ROUTE109, 0
setobjectpriority OBJ_EVENT_ID_PLAYER, MAP_ROUTE109, 0
- applymovement 2, Route109_Movement_BrineyEnterBoat
+ applymovement LOCALID_BRINEY_R109, Route109_Movement_BrineyEnterBoat
waitmovement 0
- removeobject 2
+ removeobject LOCALID_BRINEY_R109
switch VAR_FACING
case DIR_SOUTH, Route109_EventScript_EnterBoatSouth
case DIR_WEST, Route109_EventScript_EnterBoatWest
@@ -35,7 +38,7 @@ Route109_EventScript_EnterBoatWest:: @ 81EE7C5
Route109_EventScript_DoSailToDewford:: @ 81EE7D5
hideobjectat OBJ_EVENT_ID_PLAYER, MAP_ROUTE109
call Common_EventScript_PlayBrineysBoatMusic
- applymovement 1, Route109_Movement_SailToDewford
+ applymovement LOCALID_BOAT_R109, Route109_Movement_SailToDewford
applymovement OBJ_EVENT_ID_PLAYER, Route109_Movement_SailToDewford
waitmovement 0
delay 50
@@ -43,22 +46,22 @@ Route109_EventScript_DoSailToDewford:: @ 81EE7D5
showobjectat OBJ_EVENT_ID_PLAYER, MAP_DEWFORD_TOWN
applymovement OBJ_EVENT_ID_PLAYER, Route109_Movement_PlayerExitBoat
waitmovement 0
- addobject 4
+ addobject LOCALID_BOAT_DEWFORD
clearflag FLAG_HIDE_MR_BRINEY_BOAT_DEWFORD_TOWN
- setobjectxyperm 2, 12, 8
- addobject 2
- setobjectpriority 2, MAP_DEWFORD_TOWN, 0
- applymovement 2, Route109_Movement_BrineyExitBoat
+ setobjectxyperm LOCALID_BRINEY_DEWFORD, 12, 8
+ addobject LOCALID_BRINEY_DEWFORD
+ setobjectpriority LOCALID_BRINEY_DEWFORD, MAP_DEWFORD_TOWN, 0
+ applymovement LOCALID_BRINEY_DEWFORD, Route109_Movement_BrineyExitBoat
waitmovement 0
clearflag FLAG_HIDE_MR_BRINEY_DEWFORD_TOWN
setflag FLAG_HIDE_ROUTE_109_MR_BRINEY_BOAT
- hideobjectat 1, MAP_ROUTE109
+ hideobjectat LOCALID_BOAT_R109, MAP_ROUTE109
msgbox DewfordTown_Text_BrineyLandedInDewford, MSGBOX_DEFAULT
closemessage
copyvar VAR_BRINEY_LOCATION, VAR_0x8008
resetobjectpriority OBJ_EVENT_ID_PLAYER, MAP_ROUTE109
- resetobjectpriority 2, MAP_DEWFORD_TOWN
- copyobjectxytoperm 2
+ resetobjectpriority LOCALID_BRINEY_DEWFORD, MAP_DEWFORD_TOWN
+ copyobjectxytoperm LOCALID_BRINEY_DEWFORD
release
end
diff --git a/data/maps/Route109_SeashoreHouse/scripts.inc b/data/maps/Route109_SeashoreHouse/scripts.inc
index dd29e47c3..9334772d6 100644
--- a/data/maps/Route109_SeashoreHouse/scripts.inc
+++ b/data/maps/Route109_SeashoreHouse/scripts.inc
@@ -25,7 +25,7 @@ Route109_SeashoreHouse_EventScript_AlreadyGaveIntroduction:: @ 8269428
Route109_SeashoreHouse_EventScript_DefeatedTrainers:: @ 8269432
msgbox Route109_SeashoreHouse_Text_TakeTheseSodaPopBottles, MSGBOX_DEFAULT
giveitem ITEM_SODA_POP, 6
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Route109_SeashoreHouse_EventScript_BagFull
setflag FLAG_RECEIVED_6_SODA_POP
release
diff --git a/data/maps/Route110/map.json b/data/maps/Route110/map.json
index e9e61f70e..5e15be18c 100644
--- a/data/maps/Route110/map.json
+++ b/data/maps/Route110/map.json
@@ -392,7 +392,7 @@
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "0x0",
- "flag": "FLAG_HIDE_ROUTE_110_RIVAL_1"
+ "flag": "FLAG_HIDE_ROUTE_110_RIVAL"
},
{
"graphics_id": "OBJ_EVENT_GFX_VAR_3",
@@ -405,7 +405,7 @@
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "0x0",
- "flag": "FLAG_HIDE_ROUTE_110_RIVAL_2"
+ "flag": "FLAG_HIDE_ROUTE_110_RIVAL_ON_BIKE"
},
{
"graphics_id": "OBJ_EVENT_GFX_YOUNGSTER",
diff --git a/data/maps/Route110/scripts.inc b/data/maps/Route110/scripts.inc
index 1cb4f4b88..02c13f4d9 100644
--- a/data/maps/Route110/scripts.inc
+++ b/data/maps/Route110/scripts.inc
@@ -1,3 +1,8 @@
+.set LOCALID_CHALLENGE_BIKER, 21
+.set LOCALID_RIVAL, 28
+.set LOCALID_RIVAL_ON_BIKE, 29
+.set LOCALID_BIRCH, 36
+
Route110_MapScripts:: @ 81EF269
map_script MAP_SCRIPT_ON_RESUME, Route110_OnResume
map_script MAP_SCRIPT_ON_TRANSITION, Route110_OnTransition
@@ -307,7 +312,7 @@ Route110_EventScript_Alyssa:: @ 81EF64A
Route110_EventScript_CyclingChallengeEnd:: @ 81EF661
lockall
- applymovement 21, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_CHALLENGE_BIKER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
call Route110_EventScript_CyclingChallengeResults
releaseall
@@ -383,11 +388,11 @@ Route110_EventScript_RivalScene:: @ 81EF76E
call_if_eq Route110_EventScript_PlayMayMusic
compare VAR_RESULT, FEMALE
call_if_eq Route110_EventScript_PlayBrendanMusic
- applymovement 28, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_RIVAL, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
- applymovement 28, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 28, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
delay 30
compare VAR_0x8008, 1
@@ -484,10 +489,10 @@ Route110_EventScript_RivalExit:: @ 81EF8EC
call_if_eq Route110_EventScript_MoveRival2
compare VAR_0x8008, 3
call_if_eq Route110_EventScript_MoveRival3
- setobjectmovementtype 28, MOVEMENT_TYPE_FACE_RIGHT
- setobjectmovementtype 29, MOVEMENT_TYPE_FACE_RIGHT
- removeobject 28
- addobject 29
+ setobjectmovementtype LOCALID_RIVAL, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectmovementtype LOCALID_RIVAL_ON_BIKE, MOVEMENT_TYPE_FACE_RIGHT
+ removeobject LOCALID_RIVAL
+ addobject LOCALID_RIVAL_ON_BIKE
delay 45
compare VAR_0x8008, 1
call_if_eq Route110_EventScript_RivalExit1
@@ -495,7 +500,7 @@ Route110_EventScript_RivalExit:: @ 81EF8EC
call_if_eq Route110_EventScript_RivalExit2
compare VAR_0x8008, 3
call_if_eq Route110_EventScript_RivalExit3
- removeobject 29
+ removeobject LOCALID_RIVAL_ON_BIKE
setvar VAR_ROUTE110_STATE, 1
savebgm MUS_DUMMY
fadedefaultbgm
@@ -503,45 +508,45 @@ Route110_EventScript_RivalExit:: @ 81EF8EC
end
Route110_EventScript_RivalApproachPlayer1:: @ 81EF94E
- applymovement 28, Route110_Movement_RivalApproachPlayer1
+ applymovement LOCALID_RIVAL, Route110_Movement_RivalApproachPlayer1
waitmovement 0
return
Route110_EventScript_RivalApproachPlayer2:: @ 81EF959
- applymovement 28, Route110_Movement_RivalApproachPlayer2
+ applymovement LOCALID_RIVAL, Route110_Movement_RivalApproachPlayer2
waitmovement 0
return
Route110_EventScript_RivalApproachPlayer3:: @ 81EF964
- applymovement 28, Route110_Movement_RivalApproachPlayer3
+ applymovement LOCALID_RIVAL, Route110_Movement_RivalApproachPlayer3
waitmovement 0
return
Route110_EventScript_RivalExit1:: @ 81EF96F
- applymovement 29, Route110_Movement_RivalExit1
+ applymovement LOCALID_RIVAL_ON_BIKE, Route110_Movement_RivalExit1
waitmovement 0
return
Route110_EventScript_RivalExit2:: @ 81EF97A
- applymovement 29, Route110_Movement_RivalExit2
+ applymovement LOCALID_RIVAL_ON_BIKE, Route110_Movement_RivalExit2
waitmovement 0
return
Route110_EventScript_RivalExit3:: @ 81EF985
- applymovement 29, Route110_Movement_RivalExit3
+ applymovement LOCALID_RIVAL_ON_BIKE, Route110_Movement_RivalExit3
waitmovement 0
return
Route110_EventScript_MoveRival1:: @ 81EF990
- setobjectxyperm 29, 33, 55
+ setobjectxyperm LOCALID_RIVAL_ON_BIKE, 33, 55
return
Route110_EventScript_MoveRival2:: @ 81EF998
- setobjectxyperm 29, 34, 55
+ setobjectxyperm LOCALID_RIVAL_ON_BIKE, 34, 55
return
Route110_EventScript_MoveRival3:: @ 81EF9A0
- setobjectxyperm 29, 35, 55
+ setobjectxyperm LOCALID_RIVAL_ON_BIKE, 35, 55
return
Route110_Movement_RivalApproachPlayer1: @ 81EF9A8
@@ -612,13 +617,13 @@ Route110_EventScript_BirchScene4:: @ 81EF9EC
goto Route110_EventScript_BirchScene
Route110_EventScript_BirchScene:: @ 81EF9F7
- addobject 36
- applymovement 36, Route110_Movement_BirchEntrance
+ addobject LOCALID_BIRCH
+ applymovement LOCALID_BIRCH, Route110_Movement_BirchEntrance
waitmovement 0
playse SE_PIN
- applymovement 36, Common_Movement_ExclamationMark
+ applymovement LOCALID_BIRCH, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 36, Common_Movement_Delay48
+ applymovement LOCALID_BIRCH, Common_Movement_Delay48
waitmovement 0
compare VAR_0x8008, 1
call_if_eq Route110_EventScript_BirchApproachPlayer1
@@ -631,13 +636,13 @@ Route110_EventScript_BirchScene:: @ 81EF9F7
msgbox Route110_Text_ImagineSeeingYouHere, MSGBOX_DEFAULT
closemessage
delay 20
- applymovement 36, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_BIRCH, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
delay 10
- applymovement 36, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_BIRCH, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
delay 20
- applymovement 36, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_BIRCH, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
delay 30
msgbox Route110_Text_HeardYouInstallMatchCall, MSGBOX_DEFAULT
@@ -659,48 +664,48 @@ Route110_EventScript_BirchScene:: @ 81EF9F7
call_if_eq Route110_EventScript_BirchExit3
compare VAR_0x8008, 4
call_if_eq Route110_EventScript_BirchExit4
- removeobject 36
+ removeobject LOCALID_BIRCH
setvar VAR_REGISTER_BIRCH_STATE, 2
releaseall
end
Route110_EventScript_BirchApproachPlayer1:: @ 81EFAD8
- applymovement 36, Route110_Movement_BirchApproachPlayer1
+ applymovement LOCALID_BIRCH, Route110_Movement_BirchApproachPlayer1
waitmovement 0
return
Route110_EventScript_BirchApproachPlayer2:: @ 81EFAE3
- applymovement 36, Route110_Movement_BirchApproachPlayer2
+ applymovement LOCALID_BIRCH, Route110_Movement_BirchApproachPlayer2
waitmovement 0
return
Route110_EventScript_BirchApproachPlayer3:: @ 81EFAEE
- applymovement 36, Route110_Movement_BirchApproachPlayer3
+ applymovement LOCALID_BIRCH, Route110_Movement_BirchApproachPlayer3
waitmovement 0
return
Route110_EventScript_BirchApproachPlayer4:: @ 81EFAF9
- applymovement 36, Route110_Movement_BirchApproachPlayer4
+ applymovement LOCALID_BIRCH, Route110_Movement_BirchApproachPlayer4
waitmovement 0
return
Route110_EventScript_BirchExit1:: @ 81EFB04
- applymovement 36, Route110_Movement_BirchExit1
+ applymovement LOCALID_BIRCH, Route110_Movement_BirchExit1
waitmovement 0
return
Route110_EventScript_BirchExit2:: @ 81EFB0F
- applymovement 36, Route110_Movement_BirchExit2
+ applymovement LOCALID_BIRCH, Route110_Movement_BirchExit2
waitmovement 0
return
Route110_EventScript_BirchExit3:: @ 81EFB1A
- applymovement 36, Route110_Movement_BirchExit3
+ applymovement LOCALID_BIRCH, Route110_Movement_BirchExit3
waitmovement 0
return
Route110_EventScript_BirchExit4:: @ 81EFB25
- applymovement 36, Route110_Movement_BirchExit4
+ applymovement LOCALID_BIRCH, Route110_Movement_BirchExit4
waitmovement 0
return
diff --git a/data/maps/Route110_TrickHouseEnd/scripts.inc b/data/maps/Route110_TrickHouseEnd/scripts.inc
index 96765aacc..7e6f6a5bf 100644
--- a/data/maps/Route110_TrickHouseEnd/scripts.inc
+++ b/data/maps/Route110_TrickHouseEnd/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_TRICK_MASTER, 1
+
Route110_TrickHouseEnd_MapScripts:: @ 826ACAF
map_script MAP_SCRIPT_ON_RESUME, Route110_TrickHouseEnd_OnResume
map_script MAP_SCRIPT_ON_TRANSITION, Route110_TrickHouseEnd_OnTransition
@@ -21,9 +23,9 @@ Route110_TrickHouseEnd_OnWarp: @ 826ACDE
.2byte 0
Route110_TrickHouseEnd_EventScript_SetTrickMasterPos:: @ 826ACE8
- addobject 1
- showobjectat 1, MAP_ROUTE110_TRICK_HOUSE_END
- turnobject 1, DIR_EAST
+ addobject LOCALID_TRICK_MASTER
+ showobjectat LOCALID_TRICK_MASTER, MAP_ROUTE110_TRICK_HOUSE_END
+ turnobject LOCALID_TRICK_MASTER, DIR_EAST
end
Route110_TrickHouseEnd_OnFrame: @ 826ACF5
@@ -161,7 +163,7 @@ Route110_TrickHouseEnd_EventScript_CompletedPuzzle8:: @ 826AF28
delay 30
msgbox Route110_TrickHouseEnd_Text_FountainOfIdeasRunDry, MSGBOX_DEFAULT
closemessage
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_TRICK_MASTER, Common_Movement_FacePlayer
waitmovement 0
delay 30
msgbox Route110_TrickHouseEnd_Text_DefeatedMePreferWhichTent, MSGBOX_DEFAULT
@@ -190,12 +192,12 @@ Route110_TrickHouseEnd_EventScript_GiveBlueTent:: @ 826AFC7
return
Route110_TrickHouseEnd_EventScript_TrickMasterExit:: @ 826AFCF
- applymovement 1, Route110_TrickHouse_Movement_TrickMasterSpin
+ applymovement LOCALID_TRICK_MASTER, Route110_TrickHouse_Movement_TrickMasterSpin
waitmovement 0
playse SE_W153
- applymovement 1, Route110_TrickHouse_Movement_TrickMasterJumpAway
+ applymovement LOCALID_TRICK_MASTER, Route110_TrickHouse_Movement_TrickMasterJumpAway
waitmovement 0
- removeobject 1
+ removeobject LOCALID_TRICK_MASTER
addvar VAR_TRICK_HOUSE_LEVEL, 1
return
@@ -212,33 +214,33 @@ Route110_TrickHouseEnd_EventScript_NoRoomForTent:: @ 826B002
return
Route110_TrickHouseEnd_EventScript_TrickMasterFaceAwaySouth:: @ 826B015
- applymovement 1, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_TRICK_MASTER, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
Route110_TrickHouseEnd_EventScript_TrickMasterFaceAwayNorth:: @ 826B020
- applymovement 1, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_TRICK_MASTER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
return
Route110_TrickHouseEnd_EventScript_TrickMasterFaceAwayWest:: @ 826B02B
- applymovement 1, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_TRICK_MASTER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
return
Route110_TrickHouseEnd_EventScript_TrickMasterFaceAwayEast:: @ 826B036
- applymovement 1, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_TRICK_MASTER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
return
Route110_TrickHouseEnd_EventScript_TrickMasterExitTrigger:: @ 826B041
lockall
- turnobject 1, DIR_WEST
+ turnobject LOCALID_TRICK_MASTER, DIR_WEST
playse SE_PIN
- applymovement 1, Common_Movement_ExclamationMark
+ applymovement LOCALID_TRICK_MASTER, Common_Movement_ExclamationMark
waitmovement 0
delay 20
- applymovement 1, Route110_TrickHouseEnd_Movement_TrickMasterSurprise
+ applymovement LOCALID_TRICK_MASTER, Route110_TrickHouseEnd_Movement_TrickMasterSurprise
waitmovement 0
playse SE_W153
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestDown
@@ -248,7 +250,7 @@ Route110_TrickHouseEnd_EventScript_TrickMasterExitTrigger:: @ 826B041
applymovement OBJ_EVENT_ID_PLAYER, Route110_TrickHouseEnd_Movement_KeepPlayerInRoom
waitmovement 0
delay 4
- turnobject 1, DIR_EAST
+ turnobject LOCALID_TRICK_MASTER, DIR_EAST
releaseall
end
diff --git a/data/maps/Route110_TrickHouseEntrance/scripts.inc b/data/maps/Route110_TrickHouseEntrance/scripts.inc
index ed70894e3..98b06a94f 100644
--- a/data/maps/Route110_TrickHouseEntrance/scripts.inc
+++ b/data/maps/Route110_TrickHouseEntrance/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_TRICK_MASTER, 1
+
Route110_TrickHouseEntrance_MapScripts:: @ 8269A50
map_script MAP_SCRIPT_ON_TRANSITION, Route110_TrickHouseEntrance_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, Route110_TrickHouseEntrance_OnFrame
@@ -108,7 +110,7 @@ Route110_TrickHouseEntrance_EventScript_NotReadyForPuzzle:: @ 8269BAD
return
Route110_TrickHouseEntrance_EventScript_MoveTrickMasterToDoor:: @ 8269BB3
- setobjectxyperm 1, 5, 2
+ setobjectxyperm LOCALID_TRICK_MASTER, 5, 2
end
Route110_TrickHouseEntrance_EventScript_ReadyBeingWatchedTrigger:: @ 8269BBB
@@ -139,15 +141,15 @@ Route110_TrickHouseEntrance_OnWarp: @ 8269BD3
.2byte 0
Route110_TrickHouseEntrance_EventScript_TrickMasterFound:: @ 8269C15
- addobject 1
- showobjectat 1, MAP_ROUTE110_TRICK_HOUSE_ENTRANCE
- turnobject 1, DIR_EAST
+ addobject LOCALID_TRICK_MASTER
+ showobjectat LOCALID_TRICK_MASTER, MAP_ROUTE110_TRICK_HOUSE_ENTRANCE
+ turnobject LOCALID_TRICK_MASTER, DIR_EAST
turnobject OBJ_EVENT_ID_PLAYER, DIR_WEST
end
Route110_TrickHouseEntrance_EventScript_SetTrickMasterHidingSpot:: @ 8269C26
- addobject 1
- hideobjectat 1, MAP_ROUTE110_TRICK_HOUSE_ENTRANCE
+ addobject LOCALID_TRICK_MASTER
+ hideobjectat LOCALID_TRICK_MASTER, MAP_ROUTE110_TRICK_HOUSE_ENTRANCE
switch VAR_TRICK_HOUSE_LEVEL
case 0, Route110_TrickHouseEntrance_EventScript_SetHidingSpotPuzzle1
case 1, Route110_TrickHouseEntrance_EventScript_SetHidingSpotPuzzle2
@@ -160,51 +162,51 @@ Route110_TrickHouseEntrance_EventScript_SetTrickMasterHidingSpot:: @ 8269C26
end
Route110_TrickHouseEntrance_EventScript_SetHidingSpotPuzzle1:: @ 8269C8C
- setobjectxy 1, 6, 3
+ setobjectxy LOCALID_TRICK_MASTER, 6, 3
end
Route110_TrickHouseEntrance_EventScript_SetHidingSpotPuzzle2:: @ 8269C94
- setobjectxy 1, 11, 5
+ setobjectxy LOCALID_TRICK_MASTER, 11, 5
end
Route110_TrickHouseEntrance_EventScript_SetHidingSpotPuzzle3:: @ 8269C9C
- setobjectxy 1, 9, 1
+ setobjectxy LOCALID_TRICK_MASTER, 9, 1
end
Route110_TrickHouseEntrance_EventScript_SetHidingSpotPuzzle4:: @ 8269CA4
- setobjectxy 1, 3, 1
+ setobjectxy LOCALID_TRICK_MASTER, 3, 1
end
Route110_TrickHouseEntrance_EventScript_SetHidingSpotPuzzle5:: @ 8269CAC
- setobjectxy 1, 0, 5
+ setobjectxy LOCALID_TRICK_MASTER, 0, 5
end
Route110_TrickHouseEntrance_EventScript_SetHidingSpotPuzzle6:: @ 8269CB4
- setobjectxy 1, 11, 1
+ setobjectxy LOCALID_TRICK_MASTER, 11, 1
end
Route110_TrickHouseEntrance_EventScript_SetHidingSpotPuzzle7:: @ 8269CBC
- setobjectxy 1, 8, 1
+ setobjectxy LOCALID_TRICK_MASTER, 8, 1
end
Route110_TrickHouseEntrance_EventScript_SetHidingSpotPuzzle8:: @ 8269CC4
- setobjectxy 1, 4, 4
+ setobjectxy LOCALID_TRICK_MASTER, 4, 4
end
Route110_TrickHouseEntrance_EventScript_RemoveTrickMaster:: @ 8269CCC
- removeobject 1
+ removeobject LOCALID_TRICK_MASTER
end
Route110_TrickHouseEntrance_EventScript_SetTrickMasterFacingDoor:: @ 8269CD0
- addobject 1
- setobjectxy 1, 5, 2
- turnobject 1, DIR_NORTH
+ addobject LOCALID_TRICK_MASTER
+ setobjectxy LOCALID_TRICK_MASTER, 5, 2
+ turnobject LOCALID_TRICK_MASTER, DIR_NORTH
end
Route110_TrickHouseEntrance_EventScript_SetTrickMasterInFrontOfDoor:: @ 8269CDF
- addobject 1
- setobjectxy 1, 5, 2
- turnobject 1, DIR_SOUTH
+ addobject LOCALID_TRICK_MASTER
+ setobjectxy LOCALID_TRICK_MASTER, 5, 2
+ turnobject LOCALID_TRICK_MASTER, DIR_SOUTH
end
Route110_TrickHouseEntrance_OnFrame: @ 8269CEE
@@ -219,12 +221,12 @@ Route110_TrickHouseEntrance_EventScript_BeginChallenge:: @ 8269CF8
msgbox Route110_TrickHouseEntrance_Text_ComeToChallengeTrickHouse, MSGBOX_DEFAULT
closemessage
delay 20
- applymovement 1, Route110_TrickHouse_Movement_TrickMasterSpin
+ applymovement LOCALID_TRICK_MASTER, Route110_TrickHouse_Movement_TrickMasterSpin
waitmovement 0
playse SE_W153
- applymovement 1, Route110_TrickHouse_Movement_TrickMasterJumpAway
+ applymovement LOCALID_TRICK_MASTER, Route110_TrickHouse_Movement_TrickMasterJumpAway
waitmovement 0
- removeobject 1
+ removeobject LOCALID_TRICK_MASTER
setvar VAR_TRICK_HOUSE_ENTRANCE_STATE, 1
setvar VAR_TRICK_HOUSE_FOUND_TRICK_MASTER, 0
releaseall
@@ -333,21 +335,21 @@ Route110_TrickHouseEntrance_EventScript_MeetTrickMaster:: @ 8269E48
Route110_TrickHouseEntrance_EventScript_StillMakingPuzzle:: @ 8269E51
msgbox Route110_TrickHouseEntrance_Text_NextTimeUseThisTrick, MSGBOX_DEFAULT
closemessage
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_TRICK_MASTER, Common_Movement_FacePlayer
waitmovement 0
playse SE_PIN
- applymovement 1, Common_Movement_ExclamationMark
+ applymovement LOCALID_TRICK_MASTER, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 1, Common_Movement_Delay48
+ applymovement LOCALID_TRICK_MASTER, Common_Movement_Delay48
waitmovement 0
msgbox Route110_TrickHouseEntrance_Text_InMidstOfDevisingNewChallenges, MSGBOX_DEFAULT
- applymovement 1, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_TRICK_MASTER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
releaseall
end
Route110_TrickHouseEntrance_EventScript_GiveReward:: @ 8269E8F
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_TRICK_MASTER, Common_Movement_FacePlayer
waitmovement 0
msgbox Route110_TrickHouseEntrance_Text_YoureHereToAcceptReward, MSGBOX_DEFAULT
compare VAR_TRICK_HOUSE_LEVEL, 1
@@ -439,13 +441,13 @@ Route110_TrickHouseEntrance_EventScript_GivePuzzle7Reward:: @ 8269FF7
Route110_TrickHouseEntrance_EventScript_GotReward:: @ 826A023
setvar VAR_TRICK_HOUSE_PRIZE_PICKUP, 0
setvar VAR_TRICK_HOUSE_ENTRANCE_STATE, 3
- applymovement 1, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_TRICK_MASTER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
releaseall
end
Route110_TrickHouseEntrance_EventScript_MechadollReward:: @ 826A039
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_TRICK_MASTER, Common_Movement_FacePlayer
waitmovement 0
msgbox Route110_TrickHouseEntrance_Text_MechadollWhichTent, MSGBOX_DEFAULT
call Route110_TrickHouseEntrance_EventScript_ChooseTent
@@ -474,14 +476,14 @@ Route110_TrickHouseEntrance_EventScript_GiveBlueTent:: @ 826A092
Route110_TrickHouseEntrance_EventScript_ReceivedTent:: @ 826A09A
msgbox Route110_TrickHouseEntrance_Text_ThenFarewell, MSGBOX_DEFAULT
closemessage
- applymovement 1, Route110_TrickHousePuzzle5_Movement_MechadollShake
+ applymovement LOCALID_TRICK_MASTER, Route110_TrickHousePuzzle5_Movement_MechadollShake
waitmovement 0
- applymovement 1, Route110_TrickHouse_Movement_TrickMasterSpin
+ applymovement LOCALID_TRICK_MASTER, Route110_TrickHouse_Movement_TrickMasterSpin
waitmovement 0
playse SE_W153
- applymovement 1, Route110_TrickHouse_Movement_TrickMasterJumpAway
+ applymovement LOCALID_TRICK_MASTER, Route110_TrickHouse_Movement_TrickMasterJumpAway
waitmovement 0
- removeobject 1
+ removeobject LOCALID_TRICK_MASTER
setvar VAR_TRICK_HOUSE_PRIZE_PICKUP, 0
setvar VAR_TRICK_HOUSE_ENTRANCE_STATE, 5
releaseall
diff --git a/data/maps/Route110_TrickHousePuzzle5/scripts.inc b/data/maps/Route110_TrickHousePuzzle5/scripts.inc
index ac260981f..419fa2831 100644
--- a/data/maps/Route110_TrickHousePuzzle5/scripts.inc
+++ b/data/maps/Route110_TrickHousePuzzle5/scripts.inc
@@ -1,3 +1,9 @@
+.set LOCALID_MECHADOLL_1, 1
+.set LOCALID_MECHADOLL_2, 2
+.set LOCALID_MECHADOLL_3, 3
+.set LOCALID_MECHADOLL_4, 4
+.set LOCALID_MECHADOLL_5, 5
+
Route110_TrickHousePuzzle5_MapScripts:: @ 826CAF0
map_script MAP_SCRIPT_ON_TRANSITION, Route110_TrickHousePuzzle5_OnTransition
.byte 0
@@ -25,7 +31,7 @@ Route110_TrickHousePuzzle5_EventScript_FoundScroll:: @ 826CB27
Route110_TrickHousePuzzle5_EventScript_Mechadoll1:: @ 826CB32
lockall
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_MECHADOLL_1, Common_Movement_FacePlayer
waitmovement 0
compare VAR_TEMP_1, 1
goto_if_eq Route110_TrickHousePuzzle5_EventScript_CorrectGoThrough
@@ -35,7 +41,7 @@ Route110_TrickHousePuzzle5_EventScript_Mechadoll1:: @ 826CB32
Route110_TrickHousePuzzle5_EventScript_Mechadoll2:: @ 826CB53
lockall
- applymovement 2, Common_Movement_FacePlayer
+ applymovement LOCALID_MECHADOLL_2, Common_Movement_FacePlayer
waitmovement 0
compare VAR_TEMP_2, 1
goto_if_eq Route110_TrickHousePuzzle5_EventScript_CorrectGoThrough
@@ -45,7 +51,7 @@ Route110_TrickHousePuzzle5_EventScript_Mechadoll2:: @ 826CB53
Route110_TrickHousePuzzle5_EventScript_Mechadoll3:: @ 826CB74
lockall
- applymovement 3, Common_Movement_FacePlayer
+ applymovement LOCALID_MECHADOLL_3, Common_Movement_FacePlayer
waitmovement 0
compare VAR_TEMP_3, 1
goto_if_eq Route110_TrickHousePuzzle5_EventScript_CorrectGoThrough
@@ -55,7 +61,7 @@ Route110_TrickHousePuzzle5_EventScript_Mechadoll3:: @ 826CB74
Route110_TrickHousePuzzle5_EventScript_Mechadoll4:: @ 826CB95
lockall
- applymovement 4, Common_Movement_FacePlayer
+ applymovement LOCALID_MECHADOLL_4, Common_Movement_FacePlayer
waitmovement 0
compare VAR_TEMP_4, 1
goto_if_eq Route110_TrickHousePuzzle5_EventScript_CorrectGoThrough
@@ -65,7 +71,7 @@ Route110_TrickHousePuzzle5_EventScript_Mechadoll4:: @ 826CB95
Route110_TrickHousePuzzle5_EventScript_Mechadoll5:: @ 826CBB6
lockall
- applymovement 5, Common_Movement_FacePlayer
+ applymovement LOCALID_MECHADOLL_5, Common_Movement_FacePlayer
waitmovement 0
compare VAR_TEMP_5, 1
goto_if_eq Route110_TrickHousePuzzle5_EventScript_CorrectGoThrough
@@ -214,11 +220,11 @@ Route110_TrickHousePuzzle5_EventScript_Mechadoll5Trigger0:: @ 826CCDF
Route110_TrickHousePuzzle5_EventScript_Mechadoll1Activate:: @ 826CCEB
setvar VAR_TEMP_1, 1
- setvar VAR_TEMP_8, 1
+ setvar VAR_TEMP_8, LOCALID_MECHADOLL_1
playse SE_PIN
- applymovement 1, Common_Movement_ExclamationMark
+ applymovement LOCALID_MECHADOLL_1, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 1, Common_Movement_Delay48
+ applymovement LOCALID_MECHADOLL_1, Common_Movement_Delay48
waitmovement 0
compare VAR_TEMP_9, 1
call_if_eq Route110_TrickHousePuzzle5_EventScript_MechadollWalkLeft1
@@ -238,11 +244,11 @@ Route110_TrickHousePuzzle5_EventScript_Mechadoll1Activate:: @ 826CCEB
Route110_TrickHousePuzzle5_EventScript_Mechadoll2Activate:: @ 826CD6A
setvar VAR_TEMP_2, 1
- setvar VAR_TEMP_8, 2
+ setvar VAR_TEMP_8, LOCALID_MECHADOLL_2
playse SE_PIN
- applymovement 2, Common_Movement_ExclamationMark
+ applymovement LOCALID_MECHADOLL_2, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 2, Common_Movement_Delay48
+ applymovement LOCALID_MECHADOLL_2, Common_Movement_Delay48
waitmovement 0
compare VAR_TEMP_9, 1
call_if_eq Route110_TrickHousePuzzle5_EventScript_MechadollWalkRight1
@@ -264,11 +270,11 @@ Route110_TrickHousePuzzle5_EventScript_Mechadoll2Activate:: @ 826CD6A
Route110_TrickHousePuzzle5_EventScript_Mechadoll3Activate:: @ 826CDF4
setvar VAR_TEMP_3, 1
- setvar VAR_TEMP_8, 3
+ setvar VAR_TEMP_8, LOCALID_MECHADOLL_3
playse SE_PIN
- applymovement 3, Common_Movement_ExclamationMark
+ applymovement LOCALID_MECHADOLL_3, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 3, Common_Movement_Delay48
+ applymovement LOCALID_MECHADOLL_3, Common_Movement_Delay48
waitmovement 0
compare VAR_TEMP_9, 1
call_if_eq Route110_TrickHousePuzzle5_EventScript_MechadollWalkLeft1
@@ -288,11 +294,11 @@ Route110_TrickHousePuzzle5_EventScript_Mechadoll3Activate:: @ 826CDF4
Route110_TrickHousePuzzle5_EventScript_Mechadoll4Activate:: @ 826CE73
setvar VAR_TEMP_4, 1
- setvar VAR_TEMP_8, 4
+ setvar VAR_TEMP_8, LOCALID_MECHADOLL_4
playse SE_PIN
- applymovement 4, Common_Movement_ExclamationMark
+ applymovement LOCALID_MECHADOLL_4, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 4, Common_Movement_Delay48
+ applymovement LOCALID_MECHADOLL_4, Common_Movement_Delay48
waitmovement 0
compare VAR_TEMP_9, 1
call_if_eq Route110_TrickHousePuzzle5_EventScript_MechadollWalkLeft1
@@ -312,11 +318,11 @@ Route110_TrickHousePuzzle5_EventScript_Mechadoll4Activate:: @ 826CE73
Route110_TrickHousePuzzle5_EventScript_Mechadoll5Activate:: @ 826CEF2
setvar VAR_TEMP_5, 1
- setvar VAR_TEMP_8, 5
+ setvar VAR_TEMP_8, LOCALID_MECHADOLL_5
playse SE_PIN
- applymovement 5, Common_Movement_ExclamationMark
+ applymovement LOCALID_MECHADOLL_5, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 5, Common_Movement_Delay48
+ applymovement LOCALID_MECHADOLL_5, Common_Movement_Delay48
waitmovement 0
msgbox Route110_TrickHousePuzzle5_Text_Mechadoll5Intro, MSGBOX_DEFAULT
random 3
@@ -450,11 +456,11 @@ Route110_TrickHousePuzzle5_EventScript_IncorrectAnswer:: @ 826D152
waitse
playse SE_HAZURE
msgbox Route110_TrickHousePuzzle5_Text_DisappointmentError, MSGBOX_DEFAULT
- applymovement 1, Route110_TrickHousePuzzle5_Movement_MechadollShake
- applymovement 2, Route110_TrickHousePuzzle5_Movement_MechadollShake
- applymovement 3, Route110_TrickHousePuzzle5_Movement_MechadollShake
- applymovement 4, Route110_TrickHousePuzzle5_Movement_MechadollShake
- applymovement 5, Route110_TrickHousePuzzle5_Movement_MechadollShake
+ applymovement LOCALID_MECHADOLL_1, Route110_TrickHousePuzzle5_Movement_MechadollShake
+ applymovement LOCALID_MECHADOLL_2, Route110_TrickHousePuzzle5_Movement_MechadollShake
+ applymovement LOCALID_MECHADOLL_3, Route110_TrickHousePuzzle5_Movement_MechadollShake
+ applymovement LOCALID_MECHADOLL_4, Route110_TrickHousePuzzle5_Movement_MechadollShake
+ applymovement LOCALID_MECHADOLL_5, Route110_TrickHousePuzzle5_Movement_MechadollShake
msgbox Route110_TrickHousePuzzle5_Text_Wahahahaha, MSGBOX_DEFAULT
waitmovement 0
msgbox Route110_TrickHousePuzzle5_Text_WaitForNextChallenge, MSGBOX_DEFAULT
@@ -481,382 +487,382 @@ Route110_TrickHousePuzzle5_EventScript_CorrectGoThrough:: @ 826D1AA
@ Mechadoll 5 never walks, all the Mechadoll5Walk scripts are unused
@ No mechadoll walks left 5 paces, all the WalkLeft5 scripts are unused
Route110_TrickHousePuzzle5_EventScript_MechadollWalkLeft1:: @ 826D1B4
- compare VAR_TEMP_8, 1
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_1
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkLeft1
- compare VAR_TEMP_8, 2
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_2
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkLeft1
- compare VAR_TEMP_8, 3
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_3
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkLeft1
- compare VAR_TEMP_8, 4
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_4
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkLeft1
- compare VAR_TEMP_8, 5
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_5
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkLeft1
return
Route110_TrickHousePuzzle5_EventScript_MechadollWalkLeft2:: @ 826D1EC
- compare VAR_TEMP_8, 1
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_1
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkLeft2
- compare VAR_TEMP_8, 2
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_2
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkLeft2
- compare VAR_TEMP_8, 3
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_3
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkLeft2
- compare VAR_TEMP_8, 4
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_4
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkLeft2
- compare VAR_TEMP_8, 5
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_5
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkLeft2
return
Route110_TrickHousePuzzle5_EventScript_MechadollWalkLeft3:: @ 826D224
- compare VAR_TEMP_8, 1
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_1
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkLeft3
- compare VAR_TEMP_8, 2
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_2
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkLeft3
- compare VAR_TEMP_8, 3
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_3
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkLeft3
- compare VAR_TEMP_8, 4
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_4
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkLeft3
- compare VAR_TEMP_8, 5
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_5
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkLeft3
return
Route110_TrickHousePuzzle5_EventScript_MechadollWalkLeft4:: @ 826D25C
- compare VAR_TEMP_8, 1
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_1
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkLeft4
- compare VAR_TEMP_8, 2
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_2
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkLeft4
- compare VAR_TEMP_8, 3
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_3
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkLeft4
- compare VAR_TEMP_8, 4
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_4
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkLeft4
- compare VAR_TEMP_8, 5
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_5
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkLeft4
return
Route110_TrickHousePuzzle5_EventScript_MechadollWalkLeft5:: @ 826D294
- compare VAR_TEMP_8, 1
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_1
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkLeft5
- compare VAR_TEMP_8, 2
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_2
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkLeft5
- compare VAR_TEMP_8, 3
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_3
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkLeft5
- compare VAR_TEMP_8, 4
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_4
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkLeft5
- compare VAR_TEMP_8, 5
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_5
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkLeft5
return
Route110_TrickHousePuzzle5_EventScript_MechadollWalkRight1:: @ 826D2CC
- compare VAR_TEMP_8, 1
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_1
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkRight1
- compare VAR_TEMP_8, 2
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_2
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkRight1
- compare VAR_TEMP_8, 3
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_3
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkRight1
- compare VAR_TEMP_8, 4
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_4
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkRight1
- compare VAR_TEMP_8, 5
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_5
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkRight1
return
Route110_TrickHousePuzzle5_EventScript_MechadollWalkRight2:: @ 826D304
- compare VAR_TEMP_8, 1
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_1
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkRight2
- compare VAR_TEMP_8, 2
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_2
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkRight2
- compare VAR_TEMP_8, 3
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_3
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkRight2
- compare VAR_TEMP_8, 4
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_4
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkRight2
- compare VAR_TEMP_8, 5
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_5
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkRight2
return
Route110_TrickHousePuzzle5_EventScript_MechadollWalkRight3:: @ 826D33C
- compare VAR_TEMP_8, 1
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_1
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkRight3
- compare VAR_TEMP_8, 2
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_2
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkRight3
- compare VAR_TEMP_8, 3
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_3
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkRight3
- compare VAR_TEMP_8, 4
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_4
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkRight3
- compare VAR_TEMP_8, 5
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_5
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkRight3
return
Route110_TrickHousePuzzle5_EventScript_MechadollWalkRight4:: @ 826D374
- compare VAR_TEMP_8, 1
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_1
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkRight4
- compare VAR_TEMP_8, 2
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_2
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkRight4
- compare VAR_TEMP_8, 3
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_3
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkRight4
- compare VAR_TEMP_8, 4
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_4
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkRight4
- compare VAR_TEMP_8, 5
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_5
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkRight4
return
Route110_TrickHousePuzzle5_EventScript_MechadollWalkRight5:: @ 826D3AC
- compare VAR_TEMP_8, 1
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_1
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkRight5
- compare VAR_TEMP_8, 2
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_2
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkRight5
- compare VAR_TEMP_8, 3
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_3
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkRight5
- compare VAR_TEMP_8, 4
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_4
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkRight5
- compare VAR_TEMP_8, 5
+ compare VAR_TEMP_8, LOCALID_MECHADOLL_5
call_if_eq Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkRight5
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkLeft1:: @ 826D3E4
- applymovement 1, Route110_TrickHousePuzzle5_Movement_WalkLeft1
+ applymovement LOCALID_MECHADOLL_1, Route110_TrickHousePuzzle5_Movement_WalkLeft1
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkLeft1:: @ 826D3EF
- applymovement 2, Route110_TrickHousePuzzle5_Movement_WalkLeft1
+ applymovement LOCALID_MECHADOLL_2, Route110_TrickHousePuzzle5_Movement_WalkLeft1
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkLeft1:: @ 826D3FA
- applymovement 3, Route110_TrickHousePuzzle5_Movement_WalkLeft1
+ applymovement LOCALID_MECHADOLL_3, Route110_TrickHousePuzzle5_Movement_WalkLeft1
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkLeft1:: @ 826D405
- applymovement 4, Route110_TrickHousePuzzle5_Movement_WalkLeft1
+ applymovement LOCALID_MECHADOLL_4, Route110_TrickHousePuzzle5_Movement_WalkLeft1
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkLeft1:: @ 826D410
- applymovement 5, Route110_TrickHousePuzzle5_Movement_WalkLeft1
+ applymovement LOCALID_MECHADOLL_5, Route110_TrickHousePuzzle5_Movement_WalkLeft1
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkLeft2:: @ 826D41B
- applymovement 1, Route110_TrickHousePuzzle5_Movement_WalkLeft2
+ applymovement LOCALID_MECHADOLL_1, Route110_TrickHousePuzzle5_Movement_WalkLeft2
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkLeft2:: @ 826D426
- applymovement 2, Route110_TrickHousePuzzle5_Movement_WalkLeft2
+ applymovement LOCALID_MECHADOLL_2, Route110_TrickHousePuzzle5_Movement_WalkLeft2
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkLeft2:: @ 826D431
- applymovement 3, Route110_TrickHousePuzzle5_Movement_WalkLeft2
+ applymovement LOCALID_MECHADOLL_3, Route110_TrickHousePuzzle5_Movement_WalkLeft2
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkLeft2:: @ 826D43C
- applymovement 4, Route110_TrickHousePuzzle5_Movement_WalkLeft2
+ applymovement LOCALID_MECHADOLL_4, Route110_TrickHousePuzzle5_Movement_WalkLeft2
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkLeft2:: @ 826D447
- applymovement 5, Route110_TrickHousePuzzle5_Movement_WalkLeft2
+ applymovement LOCALID_MECHADOLL_5, Route110_TrickHousePuzzle5_Movement_WalkLeft2
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkLeft3:: @ 826D452
- applymovement 1, Route110_TrickHousePuzzle5_Movement_WalkLeft3
+ applymovement LOCALID_MECHADOLL_1, Route110_TrickHousePuzzle5_Movement_WalkLeft3
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkLeft3:: @ 826D45D
- applymovement 2, Route110_TrickHousePuzzle5_Movement_WalkLeft3
+ applymovement LOCALID_MECHADOLL_2, Route110_TrickHousePuzzle5_Movement_WalkLeft3
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkLeft3:: @ 826D468
- applymovement 3, Route110_TrickHousePuzzle5_Movement_WalkLeft3
+ applymovement LOCALID_MECHADOLL_3, Route110_TrickHousePuzzle5_Movement_WalkLeft3
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkLeft3:: @ 826D473
- applymovement 4, Route110_TrickHousePuzzle5_Movement_WalkLeft3
+ applymovement LOCALID_MECHADOLL_4, Route110_TrickHousePuzzle5_Movement_WalkLeft3
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkLeft3:: @ 826D47E
- applymovement 5, Route110_TrickHousePuzzle5_Movement_WalkLeft3
+ applymovement LOCALID_MECHADOLL_5, Route110_TrickHousePuzzle5_Movement_WalkLeft3
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkLeft4:: @ 826D489
- applymovement 1, Route110_TrickHousePuzzle5_Movement_WalkLeft4
+ applymovement LOCALID_MECHADOLL_1, Route110_TrickHousePuzzle5_Movement_WalkLeft4
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkLeft4:: @ 826D494
- applymovement 2, Route110_TrickHousePuzzle5_Movement_WalkLeft4
+ applymovement LOCALID_MECHADOLL_2, Route110_TrickHousePuzzle5_Movement_WalkLeft4
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkLeft4:: @ 826D49F
- applymovement 3, Route110_TrickHousePuzzle5_Movement_WalkLeft4
+ applymovement LOCALID_MECHADOLL_3, Route110_TrickHousePuzzle5_Movement_WalkLeft4
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkLeft4:: @ 826D4AA
- applymovement 4, Route110_TrickHousePuzzle5_Movement_WalkLeft4
+ applymovement LOCALID_MECHADOLL_4, Route110_TrickHousePuzzle5_Movement_WalkLeft4
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkLeft4:: @ 826D4B5
- applymovement 5, Route110_TrickHousePuzzle5_Movement_WalkLeft4
+ applymovement LOCALID_MECHADOLL_5, Route110_TrickHousePuzzle5_Movement_WalkLeft4
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkLeft5:: @ 826D4C0
- applymovement 1, Route110_TrickHousePuzzle5_Movement_WalkLeft5
+ applymovement LOCALID_MECHADOLL_1, Route110_TrickHousePuzzle5_Movement_WalkLeft5
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkLeft5:: @ 826D4CB
- applymovement 2, Route110_TrickHousePuzzle5_Movement_WalkLeft5
+ applymovement LOCALID_MECHADOLL_2, Route110_TrickHousePuzzle5_Movement_WalkLeft5
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkLeft5:: @ 826D4D6
- applymovement 3, Route110_TrickHousePuzzle5_Movement_WalkLeft5
+ applymovement LOCALID_MECHADOLL_3, Route110_TrickHousePuzzle5_Movement_WalkLeft5
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkLeft5:: @ 826D4E1
- applymovement 4, Route110_TrickHousePuzzle5_Movement_WalkLeft5
+ applymovement LOCALID_MECHADOLL_4, Route110_TrickHousePuzzle5_Movement_WalkLeft5
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkLeft5:: @ 826D4EC
- applymovement 5, Route110_TrickHousePuzzle5_Movement_WalkLeft5
+ applymovement LOCALID_MECHADOLL_5, Route110_TrickHousePuzzle5_Movement_WalkLeft5
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkRight1:: @ 826D4F7
- applymovement 1, Route110_TrickHousePuzzle5_Movement_WalkRight1
+ applymovement LOCALID_MECHADOLL_1, Route110_TrickHousePuzzle5_Movement_WalkRight1
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkRight1:: @ 826D502
- applymovement 2, Route110_TrickHousePuzzle5_Movement_WalkRight1
+ applymovement LOCALID_MECHADOLL_2, Route110_TrickHousePuzzle5_Movement_WalkRight1
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkRight1:: @ 826D50D
- applymovement 3, Route110_TrickHousePuzzle5_Movement_WalkRight1
+ applymovement LOCALID_MECHADOLL_3, Route110_TrickHousePuzzle5_Movement_WalkRight1
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkRight1:: @ 826D518
- applymovement 4, Route110_TrickHousePuzzle5_Movement_WalkRight1
+ applymovement LOCALID_MECHADOLL_4, Route110_TrickHousePuzzle5_Movement_WalkRight1
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkRight1:: @ 826D523
- applymovement 5, Route110_TrickHousePuzzle5_Movement_WalkRight1
+ applymovement LOCALID_MECHADOLL_5, Route110_TrickHousePuzzle5_Movement_WalkRight1
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkRight2:: @ 826D52E
- applymovement 1, Route110_TrickHousePuzzle5_Movement_WalkRight2
+ applymovement LOCALID_MECHADOLL_1, Route110_TrickHousePuzzle5_Movement_WalkRight2
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkRight2:: @ 826D539
- applymovement 2, Route110_TrickHousePuzzle5_Movement_WalkRight2
+ applymovement LOCALID_MECHADOLL_2, Route110_TrickHousePuzzle5_Movement_WalkRight2
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkRight2:: @ 826D544
- applymovement 3, Route110_TrickHousePuzzle5_Movement_WalkRight2
+ applymovement LOCALID_MECHADOLL_3, Route110_TrickHousePuzzle5_Movement_WalkRight2
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkRight2:: @ 826D54F
- applymovement 4, Route110_TrickHousePuzzle5_Movement_WalkRight2
+ applymovement LOCALID_MECHADOLL_4, Route110_TrickHousePuzzle5_Movement_WalkRight2
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkRight2:: @ 826D55A
- applymovement 5, Route110_TrickHousePuzzle5_Movement_WalkRight2
+ applymovement LOCALID_MECHADOLL_5, Route110_TrickHousePuzzle5_Movement_WalkRight2
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkRight3:: @ 826D565
- applymovement 1, Route110_TrickHousePuzzle5_Movement_WalkRight3
+ applymovement LOCALID_MECHADOLL_1, Route110_TrickHousePuzzle5_Movement_WalkRight3
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkRight3:: @ 826D570
- applymovement 2, Route110_TrickHousePuzzle5_Movement_WalkRight3
+ applymovement LOCALID_MECHADOLL_2, Route110_TrickHousePuzzle5_Movement_WalkRight3
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkRight3:: @ 826D57B
- applymovement 3, Route110_TrickHousePuzzle5_Movement_WalkRight3
+ applymovement LOCALID_MECHADOLL_3, Route110_TrickHousePuzzle5_Movement_WalkRight3
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkRight3:: @ 826D586
- applymovement 4, Route110_TrickHousePuzzle5_Movement_WalkRight3
+ applymovement LOCALID_MECHADOLL_4, Route110_TrickHousePuzzle5_Movement_WalkRight3
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkRight3:: @ 826D591
- applymovement 5, Route110_TrickHousePuzzle5_Movement_WalkRight3
+ applymovement LOCALID_MECHADOLL_5, Route110_TrickHousePuzzle5_Movement_WalkRight3
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkRight4:: @ 826D59C
- applymovement 1, Route110_TrickHousePuzzle5_Movement_WalkRight4
+ applymovement LOCALID_MECHADOLL_1, Route110_TrickHousePuzzle5_Movement_WalkRight4
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkRight4:: @ 826D5A7
- applymovement 2, Route110_TrickHousePuzzle5_Movement_WalkRight4
+ applymovement LOCALID_MECHADOLL_2, Route110_TrickHousePuzzle5_Movement_WalkRight4
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkRight4:: @ 826D5B2
- applymovement 3, Route110_TrickHousePuzzle5_Movement_WalkRight4
+ applymovement LOCALID_MECHADOLL_3, Route110_TrickHousePuzzle5_Movement_WalkRight4
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkRight4:: @ 826D5BD
- applymovement 4, Route110_TrickHousePuzzle5_Movement_WalkRight4
+ applymovement LOCALID_MECHADOLL_4, Route110_TrickHousePuzzle5_Movement_WalkRight4
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkRight4:: @ 826D5C8
- applymovement 5, Route110_TrickHousePuzzle5_Movement_WalkRight4
+ applymovement LOCALID_MECHADOLL_5, Route110_TrickHousePuzzle5_Movement_WalkRight4
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll1WalkRight5:: @ 826D5D3
- applymovement 1, Route110_TrickHousePuzzle5_Movement_WalkRight5
+ applymovement LOCALID_MECHADOLL_1, Route110_TrickHousePuzzle5_Movement_WalkRight5
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll2WalkRight5:: @ 826D5DE
- applymovement 2, Route110_TrickHousePuzzle5_Movement_WalkRight5
+ applymovement LOCALID_MECHADOLL_2, Route110_TrickHousePuzzle5_Movement_WalkRight5
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll3WalkRight5:: @ 826D5E9
- applymovement 3, Route110_TrickHousePuzzle5_Movement_WalkRight5
+ applymovement LOCALID_MECHADOLL_3, Route110_TrickHousePuzzle5_Movement_WalkRight5
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll4WalkRight5:: @ 826D5F4
- applymovement 4, Route110_TrickHousePuzzle5_Movement_WalkRight5
+ applymovement LOCALID_MECHADOLL_4, Route110_TrickHousePuzzle5_Movement_WalkRight5
waitmovement 0
return
Route110_TrickHousePuzzle5_EventScript_Mechadoll5WalkRight5:: @ 826D5FF
- applymovement 5, Route110_TrickHousePuzzle5_Movement_WalkRight5
+ applymovement LOCALID_MECHADOLL_5, Route110_TrickHousePuzzle5_Movement_WalkRight5
waitmovement 0
return
diff --git a/data/maps/Route111/scripts.inc b/data/maps/Route111/scripts.inc
index 89002883c..281dddf0c 100644
--- a/data/maps/Route111/scripts.inc
+++ b/data/maps/Route111/scripts.inc
@@ -1,3 +1,10 @@
+.set LOCALID_VICTOR, 1
+.set LOCALID_VICTORIA, 2
+.set LOCALID_VIVI, 3
+.set LOCALID_VICKY, 4
+.set LOCALID_PLAYER_FALLING, 45
+.set LOCALID_ROCK_SMASH_MAN, 46
+
Route111_MapScripts:: @ 81F0CA7
map_script MAP_SCRIPT_ON_LOAD, Route111_OnLoad
map_script MAP_SCRIPT_ON_TRANSITION, Route111_OnTransition
@@ -120,11 +127,11 @@ Route111_EventScript_MirageTowerDisappear:: @ 81F0E60
waitstate
delay 24
playse SE_RU_HYUU
- addobject 45
+ addobject LOCALID_PLAYER_FALLING
special StartPlayerDescendMirageTower
waitstate
showobjectat OBJ_EVENT_ID_PLAYER, MAP_LITTLEROOT_TOWN
- removeobject 45
+ removeobject LOCALID_PLAYER_FALLING
delay 16
turnobject OBJ_EVENT_ID_PLAYER, DIR_NORTH
delay 16
@@ -286,68 +293,68 @@ Route111_EventScript_Victor:: @ 81F0FC5
Route111_EventScript_BattleWinstrates:: @ 81F0FE7
msgbox Route111_Text_VictorIntro, MSGBOX_DEFAULT
trainerbattle_no_intro TRAINER_VICTOR, Route111_Text_VictorDefeat
- applymovement 1, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_VICTOR, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
call Route111_EventScript_OpenWinstrateDoor
msgbox Route111_Text_VictorPostBattle, MSGBOX_DEFAULT
closemessage
- applymovement 1, Route111_Movement_WinstrateEnterHouse
+ applymovement LOCALID_VICTOR, Route111_Movement_WinstrateEnterHouse
waitmovement 0
- removeobject 1
+ removeobject LOCALID_VICTOR
call Route111_EventScript_CloseWinstrateDoor
applymovement OBJ_EVENT_ID_PLAYER, Route111_Movement_WaitForNextWinstrate
waitmovement 0
call Route111_EventScript_OpenWinstrateDoor
- addobject 2
- applymovement 2, Route111_Movement_WinstrateExitHouse
+ addobject LOCALID_VICTORIA
+ applymovement LOCALID_VICTORIA, Route111_Movement_WinstrateExitHouse
waitmovement 0
call Route111_EventScript_CloseWinstrateDoor
msgbox Route111_Text_VictoriaIntro, MSGBOX_DEFAULT
trainerbattle_no_intro TRAINER_VICTORIA, Route111_Text_VictoriaDefeat
- applymovement 2, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_VICTORIA, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
call Route111_EventScript_OpenWinstrateDoor
msgbox Route111_Text_VictoriaPostBattle, MSGBOX_DEFAULT
closemessage
- applymovement 2, Route111_Movement_WinstrateEnterHouse
+ applymovement LOCALID_VICTORIA, Route111_Movement_WinstrateEnterHouse
waitmovement 0
- removeobject 2
+ removeobject LOCALID_VICTORIA
call Route111_EventScript_CloseWinstrateDoor
applymovement OBJ_EVENT_ID_PLAYER, Route111_Movement_WaitForNextWinstrate
waitmovement 0
call Route111_EventScript_OpenWinstrateDoor
- addobject 3
- applymovement 3, Route111_Movement_WinstrateExitHouse
+ addobject LOCALID_VIVI
+ applymovement LOCALID_VIVI, Route111_Movement_WinstrateExitHouse
waitmovement 0
call Route111_EventScript_CloseWinstrateDoor
msgbox Route111_Text_ViviIntro, MSGBOX_DEFAULT
trainerbattle_no_intro TRAINER_VIVI, Route111_Text_ViviDefeat
- applymovement 3, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_VIVI, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
call Route111_EventScript_OpenWinstrateDoor
msgbox Route111_Text_ViviPostBattle, MSGBOX_DEFAULT
closemessage
- applymovement 3, Route111_Movement_WinstrateEnterHouse
+ applymovement LOCALID_VIVI, Route111_Movement_WinstrateEnterHouse
waitmovement 0
- removeobject 3
+ removeobject LOCALID_VIVI
call Route111_EventScript_CloseWinstrateDoor
applymovement OBJ_EVENT_ID_PLAYER, Route111_Movement_WaitForNextWinstrate
waitmovement 0
call Route111_EventScript_OpenWinstrateDoor
- addobject 4
- applymovement 4, Route111_Movement_WinstrateExitHouse
+ addobject LOCALID_VICKY
+ applymovement LOCALID_VICKY, Route111_Movement_WinstrateExitHouse
waitmovement 0
call Route111_EventScript_CloseWinstrateDoor
msgbox Route111_Text_VickyIntro, MSGBOX_DEFAULT
trainerbattle_no_intro TRAINER_VICKY, Route111_Text_VickyDefeat
msgbox Route111_Text_VickyPostBattle, MSGBOX_DEFAULT
closemessage
- applymovement 4, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_VICKY, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
call Route111_EventScript_OpenWinstrateDoor
- applymovement 4, Route111_Movement_WinstrateEnterHouse
+ applymovement LOCALID_VICKY, Route111_Movement_WinstrateEnterHouse
waitmovement 0
- removeobject 4
+ removeobject LOCALID_VICKY
call Route111_EventScript_CloseWinstrateDoor
release
end
@@ -438,11 +445,11 @@ Route111_EventScript_HikerMirageTowerVisible:: @ 81F11DA
Route111_EventScript_RockSmashTipFatMan:: @ 81F11E4
lockall
- applymovement 46, Common_Movement_FacePlayer
+ applymovement LOCALID_ROCK_SMASH_MAN, Common_Movement_FacePlayer
waitmovement 0
msgbox Route111_Text_MauvilleUncleToldMeToTakeRockSmash, MSGBOX_DEFAULT
closemessage
- applymovement 46, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_ROCK_SMASH_MAN, Common_Movement_FaceOriginalDirection
waitmovement 0
releaseall
end
diff --git a/data/maps/Route111_WinstrateFamilysHouse/scripts.inc b/data/maps/Route111_WinstrateFamilysHouse/scripts.inc
index 499459c24..28bf17dbf 100644
--- a/data/maps/Route111_WinstrateFamilysHouse/scripts.inc
+++ b/data/maps/Route111_WinstrateFamilysHouse/scripts.inc
@@ -1,10 +1,15 @@
+.set LOCALID_VIVI, 1
+.set LOCALID_VICTOR, 2
+.set LOCALID_VICTORIA, 3
+.set LOCALID_VICKY, 4
+
Route111_WinstrateFamilysHouse_MapScripts:: @ 822A48C
.byte 0
Route111_WinstrateFamilysHouse_EventScript_Victor:: @ 822A48D
lock
faceplayer
- setvar VAR_0x8008, 2
+ setvar VAR_0x8008, LOCALID_VICTOR
msgbox Route111_WinstrateFamilysHouse_Text_MySonIsStrongerThanYou, MSGBOX_DEFAULT
goto Route111_WinstrateFamilysHouse_EventScript_FaceOriginalDirection
end
@@ -12,7 +17,7 @@ Route111_WinstrateFamilysHouse_EventScript_Victor:: @ 822A48D
Route111_WinstrateFamilysHouse_EventScript_Victoria:: @ 822A4A2
lock
faceplayer
- setvar VAR_0x8008, 3
+ setvar VAR_0x8008, LOCALID_VICTORIA
goto_if_set FLAG_RECEIVED_MACHO_BRACE, Route111_WinstrateFamilysHouse_EventScript_ReceivedMachoBrace
msgbox Route111_WinstrateFamilysHouse_Text_LikeYouToHaveMachoBrace, MSGBOX_DEFAULT
giveitem ITEM_MACHO_BRACE
@@ -30,7 +35,7 @@ Route111_WinstrateFamilysHouse_EventScript_ReceivedMachoBrace:: @ 822A4DA
Route111_WinstrateFamilysHouse_EventScript_Vivi:: @ 822A4E8
lock
faceplayer
- setvar VAR_0x8008, 1
+ setvar VAR_0x8008, LOCALID_VIVI
msgbox Route111_WinstrateFamilysHouse_Text_StrongerFamilyMembers, MSGBOX_DEFAULT
goto Route111_WinstrateFamilysHouse_EventScript_FaceOriginalDirection
end
@@ -38,7 +43,7 @@ Route111_WinstrateFamilysHouse_EventScript_Vivi:: @ 822A4E8
Route111_WinstrateFamilysHouse_EventScript_Vicky:: @ 822A4FD
lock
faceplayer
- setvar VAR_0x8008, 4
+ setvar VAR_0x8008, LOCALID_VICKY
goto_if_set FLAG_TEMP_4, Route111_WinstrateFamilysHouse_EventScript_AlreadySpokenTo
msgbox Route111_WinstrateFamilysHouse_Text_GrandsonStrong, MSGBOX_DEFAULT
setflag FLAG_TEMP_4
diff --git a/data/maps/Route112/scripts.inc b/data/maps/Route112/scripts.inc
index 4dd4fe112..67f776f67 100644
--- a/data/maps/Route112/scripts.inc
+++ b/data/maps/Route112/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_GRUNT_1, 1
+.set LOCALID_GRUNT_2, 6
+
Route112_MapScripts:: @ 81F1DA8
map_script MAP_SCRIPT_ON_TRANSITION, Route112_OnTransition
.byte 0
@@ -10,36 +13,36 @@ Route112_OnTransition: @ 81F1DAE
Route112_EventScript_MagmaGrunts:: @ 81F1DB7
lockall
delay 40
- applymovement 1, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_GRUNT_1, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
delay 20
msgbox Route112_Text_LeaderGoingToAwakenThing, MSGBOX_DEFAULT
closemessage
- applymovement 1, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_GRUNT_1, Common_Movement_FaceOriginalDirection
waitmovement 0
delay 40
- applymovement 6, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_GRUNT_2, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
delay 20
msgbox Route112_Text_YeahWeNeedMeteorite, MSGBOX_DEFAULT
closemessage
- applymovement 6, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_GRUNT_2, Common_Movement_FaceOriginalDirection
waitmovement 0
delay 40
- applymovement 1, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_GRUNT_1, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
delay 20
msgbox Route112_Text_OhThatsWhyCrewWentToFallarbor, MSGBOX_DEFAULT
closemessage
- applymovement 1, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_GRUNT_1, Common_Movement_FaceOriginalDirection
waitmovement 0
delay 40
- applymovement 6, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_GRUNT_2, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
delay 20
msgbox Route112_Text_CantLetAnyonePassUntilTheyreBack, MSGBOX_DEFAULT
closemessage
- applymovement 6, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_GRUNT_2, Common_Movement_FaceOriginalDirection
waitmovement 0
releaseall
end
diff --git a/data/maps/Route112_CableCarStation/scripts.inc b/data/maps/Route112_CableCarStation/scripts.inc
index 63b33f264..b1da3e3cb 100644
--- a/data/maps/Route112_CableCarStation/scripts.inc
+++ b/data/maps/Route112_CableCarStation/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
Route112_CableCarStation_MapScripts:: @ 822AABE
map_script MAP_SCRIPT_ON_TRANSITION, Route112_CableCarStation_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, Route112_CableCarStation_OnFrame
@@ -10,8 +12,8 @@ Route112_CableCarStation_OnTransition: @ 822AAC9
end
Route112_CableCarStation_EventScript_MoveAttendantAside:: @ 822AADD
- setobjectxyperm 1, 7, 4
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_LEFT
+ setobjectxyperm LOCALID_ATTENDANT, 7, 4
+ setobjectmovementtype LOCALID_ATTENDANT, MOVEMENT_TYPE_FACE_LEFT
return
Route112_CableCarStation_OnFrame: @ 822AAE9
@@ -21,11 +23,11 @@ Route112_CableCarStation_OnFrame: @ 822AAE9
Route112_CableCarStation_EventScript_ExitCableCar:: @ 822AAF3
lockall
applymovement OBJ_EVENT_ID_PLAYER, Route112_CableCarStation_Movement_ExitCableCar
- applymovement 1, Route112_CableCarStation_Movement_FollowPlayerOutFromCableCar
+ applymovement LOCALID_ATTENDANT, Route112_CableCarStation_Movement_FollowPlayerOutFromCableCar
waitmovement 0
setvar VAR_CABLE_CAR_STATION_STATE, 0
- setobjectxyperm 1, 6, 7
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_DOWN
+ setobjectxyperm LOCALID_ATTENDANT, 6, 7
+ setobjectmovementtype LOCALID_ATTENDANT, MOVEMENT_TYPE_FACE_DOWN
releaseall
end
@@ -42,7 +44,7 @@ Route112_CableCarStation_EventScript_Attendant:: @ 822AB17
Route112_CableCarStation_EventScript_RideCableCar:: @ 822AB38
msgbox Route112_CableCarStation_Text_StepThisWay, MSGBOX_DEFAULT
closemessage
- applymovement 1, Route112_CableCarStation_Movement_LeadPlayerToCableCar
+ applymovement LOCALID_ATTENDANT, Route112_CableCarStation_Movement_LeadPlayerToCableCar
applymovement OBJ_EVENT_ID_PLAYER, Route112_CableCarStation_Movement_BoardCableCar
waitmovement 0
setvar VAR_0x8004, 0
diff --git a/data/maps/Route114_FossilManiacsTunnel/scripts.inc b/data/maps/Route114_FossilManiacsTunnel/scripts.inc
index 7483b453f..86bb20eed 100644
--- a/data/maps/Route114_FossilManiacsTunnel/scripts.inc
+++ b/data/maps/Route114_FossilManiacsTunnel/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_FOSSIL_MANIAC, 1
+
Route114_FossilManiacsTunnel_MapScripts:: @ 822AF28
map_script MAP_SCRIPT_ON_TRANSITION, Route114_FossilManiacsTunnel_OnTransition
map_script MAP_SCRIPT_ON_LOAD, Route114_FossilManiacsTunnel_OnLoad
@@ -8,8 +10,8 @@ Route114_FossilManiacsTunnel_OnTransition: @ 822AF33
end
Route114_FossilManiacsTunnel_EventScript_MoveFossilManiac:: @ 822AF3D
- setobjectxyperm 1, 6, 5
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_DOWN
+ setobjectxyperm LOCALID_FOSSIL_MANIAC, 6, 5
+ setobjectmovementtype LOCALID_FOSSIL_MANIAC, MOVEMENT_TYPE_FACE_DOWN
return
Route114_FossilManiacsTunnel_OnLoad: @ 822AF49
@@ -23,7 +25,7 @@ Route114_FossilManiacsTunnel_EventScript_CloseDesertUnderpass:: @ 822AF53
Route114_FossilManiacsTunnel_EventScript_ManiacMentionCaveIn:: @ 822AF66
lockall
- applymovement 1, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_FOSSIL_MANIAC, Common_Movement_WalkInPlaceFastestUp
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
msgbox Route114_FossilManiacsTunnel_Text_NotSafeThatWay, MSGBOX_DEFAULT
diff --git a/data/maps/Route116/scripts.inc b/data/maps/Route116/scripts.inc
index 87ff20904..d904fb9eb 100644
--- a/data/maps/Route116/scripts.inc
+++ b/data/maps/Route116/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_BRINEY, 11
+.set LOCALID_WANDAS_BF_OUTSIDE, 21
+
Route116_MapScripts:: @ 81F2C0C
map_script MAP_SCRIPT_ON_TRANSITION, Route116_OnTransition
map_script MAP_SCRIPT_ON_LOAD, Route116_OnLoad
@@ -15,7 +18,7 @@ Route116_OnTransition: @ 81F2C1C
end
Route116_EventScript_SetWandasBoyfriendPos:: @ 81F2C47
- setobjectxyperm 21, 38, 10
+ setobjectxyperm LOCALID_WANDAS_BF_OUTSIDE, 38, 10
return
Route116_OnLoad: @ 81F2C4F
@@ -151,7 +154,7 @@ Route116_EventScript_Briney:: @ 81F2D84
Route116_EventScript_BrineyTrigger:: @ 81F2D95
lockall
- applymovement 11, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_BRINEY, Common_Movement_WalkInPlaceFastestRight
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
msgbox Route116_Text_ScoundrelMadeOffWithPeeko, MSGBOX_DEFAULT
diff --git a/data/maps/Route117/scripts.inc b/data/maps/Route117/scripts.inc
index 47d8eced9..08f8d0500 100644
--- a/data/maps/Route117/scripts.inc
+++ b/data/maps/Route117/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_DAYCARE_MAN, 3
+
Route117_MapScripts:: @ 81F397D
map_script MAP_SCRIPT_ON_TRANSITION, Route117_OnTransition
.byte 0
@@ -8,7 +10,7 @@ Route117_OnTransition: @ 81F3983
Route117_EventScript_TryMoveDayCareMan:: @ 81F3989
goto_if_unset FLAG_PENDING_DAYCARE_EGG, Route117_EventScript_StopMoveDayCareMan
- setobjectxyperm 3, 47, 6
+ setobjectxyperm LOCALID_DAYCARE_MAN, 47, 6
Route117_EventScript_StopMoveDayCareMan:: @ 81F3999
return
diff --git a/data/maps/Route118/scripts.inc b/data/maps/Route118/scripts.inc
index 2fbbb7016..1a34ad96c 100644
--- a/data/maps/Route118/scripts.inc
+++ b/data/maps/Route118/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_STEVEN, 19
+
Route118_MapScripts:: @ 81F3DBC
map_script MAP_SCRIPT_ON_TRANSITION, Route118_OnTransition
map_script MAP_SCRIPT_ON_LOAD, Route118_OnLoad
@@ -71,7 +73,7 @@ Route118_EventScript_StevenTrigger0:: @ 81F3E8E
setvar VAR_0x8008, 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_FaceUp
waitmovement 0
- applymovement 19, Route118_Movement_StevenApproachLedge0
+ applymovement LOCALID_STEVEN, Route118_Movement_StevenApproachLedge0
waitmovement 0
goto Route118_EventScript_StevenTrigger
end
@@ -89,14 +91,14 @@ Route118_EventScript_StevenTrigger2:: @ 81F3EC4
setvar VAR_0x8008, 2
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_FaceUp
waitmovement 0
- applymovement 19, Route118_Movement_StevenApproachLedge2
+ applymovement LOCALID_STEVEN, Route118_Movement_StevenApproachLedge2
waitmovement 0
goto Route118_EventScript_StevenTrigger
end
Route118_EventScript_StevenTrigger:: @ 81F3EE4
playse SE_DANSA
- applymovement 19, Route118_Movement_StevenJumpLedge
+ applymovement LOCALID_STEVEN, Route118_Movement_StevenJumpLedge
waitmovement 0
delay 30
msgbox Route118_Text_StevenQuestions, MSGBOX_DEFAULT
@@ -108,25 +110,25 @@ Route118_EventScript_StevenTrigger:: @ 81F3EE4
compare VAR_0x8008, 2
call_if_eq Route118_EventScript_StevenExit2
setvar VAR_ROUTE118_STATE, 1
- removeobject 19
+ removeobject LOCALID_STEVEN
releaseall
end
Route118_EventScript_StevenExit0:: @ 81F3F28
applymovement OBJ_EVENT_ID_PLAYER, Route118_Movement_PlayerWatchStevenExit
- applymovement 19, Route118_Movement_StevenExit0
+ applymovement LOCALID_STEVEN, Route118_Movement_StevenExit0
waitmovement 0
return
Route118_EventScript_StevenExit1:: @ 81F3F3A
applymovement OBJ_EVENT_ID_PLAYER, Route118_Movement_PlayerWatchStevenExit
- applymovement 19, Route118_Movement_StevenExit1
+ applymovement LOCALID_STEVEN, Route118_Movement_StevenExit1
waitmovement 0
return
Route118_EventScript_StevenExit2:: @ 81F3F4C
applymovement OBJ_EVENT_ID_PLAYER, Route118_Movement_PlayerWatchStevenExit
- applymovement 19, Route118_Movement_StevenExit2
+ applymovement LOCALID_STEVEN, Route118_Movement_StevenExit2
waitmovement 0
return
diff --git a/data/maps/Route119/scripts.inc b/data/maps/Route119/scripts.inc
index 93d7f257c..2800126f6 100644
--- a/data/maps/Route119/scripts.inc
+++ b/data/maps/Route119/scripts.inc
@@ -1,3 +1,7 @@
+.set LOCALID_RIVAL, 16
+.set LOCALID_RIVAL_ON_BIKE, 25
+.set LOCALID_SCOTT, 43
+
Route119_MapScripts:: @ 81F4424
map_script MAP_SCRIPT_ON_RESUME, Route119_OnResume
map_script MAP_SCRIPT_ON_TRANSITION, Route119_OnTransition
@@ -40,7 +44,7 @@ Route119_EventScript_RivalTrigger2:: @ 81F447D
Route119_EventScript_RivalEncounter:: @ 81F4488
lockall
- addobject 25 @ Rival on bike
+ addobject LOCALID_RIVAL_ON_BIKE
checkplayergender
compare VAR_RESULT, MALE
call_if_eq Route119_EventScript_PlayMayMusic
@@ -58,8 +62,8 @@ Route119_EventScript_RivalEncounter:: @ 81F4488
call_if_eq Route119_EventScript_SetRivalPos1
compare VAR_TEMP_1, 2
call_if_eq Route119_EventScript_SetRivalPos2
- removeobject 25
- addobject 16 @ Rival on foot
+ removeobject LOCALID_RIVAL_ON_BIKE
+ addobject LOCALID_RIVAL
delay 30
checkplayergender
compare VAR_RESULT, MALE
@@ -148,14 +152,14 @@ Route119_EventScript_RivalExitScottArrive:: @ 81F460F
call_if_eq Route119_EventScript_SetRivalPos1
compare VAR_TEMP_1, 2
call_if_eq Route119_EventScript_SetRivalPos2
- removeobject 16 @ Rival on foot
- addobject 25 @ Rival on bike
+ removeobject LOCALID_RIVAL
+ addobject LOCALID_RIVAL_ON_BIKE
delay 30
compare VAR_TEMP_1, 1
call_if_eq Route119_EventScript_RivalExit1
compare VAR_TEMP_1, 2
call_if_eq Route119_EventScript_RivalExit2
- removeobject 25
+ removeobject LOCALID_RIVAL_ON_BIKE
setvar VAR_ROUTE119_STATE, 1
savebgm MUS_DUMMY
fadedefaultbgm
@@ -164,8 +168,8 @@ Route119_EventScript_RivalExitScottArrive:: @ 81F460F
call_if_eq Route119_EventScript_SetScottPos1
compare VAR_TEMP_1, 2
call_if_eq Route119_EventScript_SetScottPos2
- addobject 43 @ Scott
- applymovement 43, Route119_Movement_ScottEnter
+ addobject LOCALID_SCOTT
+ applymovement LOCALID_SCOTT, Route119_Movement_ScottEnter
waitmovement 0
addvar VAR_SCOTT_STATE, 1
msgbox Route119_Text_ScottWayToGoBeSeeingYou, MSGBOX_DEFAULT
@@ -174,58 +178,58 @@ Route119_EventScript_RivalExitScottArrive:: @ 81F460F
call_if_eq Route119_EventScript_ScottExit1
compare VAR_TEMP_1, 2
call_if_eq Route119_EventScript_ScottExit2
- removeobject 43
+ removeobject LOCALID_SCOTT
releaseall
end
Route119_EventScript_SetScottPos1:: @ 81F46A0
- setobjectxyperm 43, 27, 25
+ setobjectxyperm LOCALID_SCOTT, 27, 25
return
Route119_EventScript_SetScottPos2:: @ 81F46A8
- setobjectxyperm 43, 28, 25
+ setobjectxyperm LOCALID_SCOTT, 28, 25
return
Route119_EventScript_ScottExit1:: @ 81F46B0
- applymovement 43, Route119_Movement_ScottExit1
+ applymovement LOCALID_SCOTT, Route119_Movement_ScottExit1
waitmovement 0
return
Route119_EventScript_ScottExit2:: @ 81F46BB
- applymovement 43, Route119_Movement_ScottExit2
+ applymovement LOCALID_SCOTT, Route119_Movement_ScottExit2
waitmovement 0
return
Route119_EventScript_RivalEnter1:: @ 81F46C6
- applymovement 25, Route119_Movement_RivalEnter1
+ applymovement LOCALID_RIVAL_ON_BIKE, Route119_Movement_RivalEnter1
waitmovement 0
return
Route119_EventScript_RivalEnter2:: @ 81F46D1
- applymovement 25, Route119_Movement_RivalEnter2
+ applymovement LOCALID_RIVAL_ON_BIKE, Route119_Movement_RivalEnter2
waitmovement 0
return
Route119_EventScript_RivalExit1:: @ 81F46DC
applymovement OBJ_EVENT_ID_PLAYER, Route119_Movement_PlayerWatchRivalExit1
- applymovement 25, Route119_Movement_RivalExit1
+ applymovement LOCALID_RIVAL_ON_BIKE, Route119_Movement_RivalExit1
waitmovement 0
return
Route119_EventScript_RivalExit2:: @ 81F46EE
applymovement OBJ_EVENT_ID_PLAYER, Route119_Movement_PlayerWatchRivalExit2
- applymovement 25, Route119_Movement_RivalExit2
+ applymovement LOCALID_RIVAL_ON_BIKE, Route119_Movement_RivalExit2
waitmovement 0
return
Route119_EventScript_SetRivalPos1:: @ 81F4700
- setobjectxyperm 16, 25, 32
- setobjectxyperm 25, 25, 32
+ setobjectxyperm LOCALID_RIVAL, 25, 32
+ setobjectxyperm LOCALID_RIVAL_ON_BIKE, 25, 32
return
Route119_EventScript_SetRivalPos2:: @ 81F470F
- setobjectxyperm 16, 26, 32
- setobjectxyperm 25, 26, 32
+ setobjectxyperm LOCALID_RIVAL, 26, 32
+ setobjectxyperm LOCALID_RIVAL_ON_BIKE, 26, 32
return
Route119_Movement_PlayerWatchRivalExit1: @ 81F471E
diff --git a/data/maps/Route119_WeatherInstitute_1F/scripts.inc b/data/maps/Route119_WeatherInstitute_1F/scripts.inc
index c734ee3c4..03c537cf0 100644
--- a/data/maps/Route119_WeatherInstitute_1F/scripts.inc
+++ b/data/maps/Route119_WeatherInstitute_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_LITTLE_BOY, 5
+
Route119_WeatherInstitute_1F_MapScripts:: @ 826FA86
map_script MAP_SCRIPT_ON_TRANSITION, Route119_WeatherInstitute_1F_OnTransition
.byte 0
@@ -8,8 +10,8 @@ Route119_WeatherInstitute_1F_OnTransition: @ 826FA8C
end
Route119_WeatherInstitute_1F_EventScript_SetLittleBoyPos:: @ 826FA98
- setobjectxyperm 5, 0, 5
- setobjectmovementtype 5, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_LITTLE_BOY, 0, 5
+ setobjectmovementtype LOCALID_LITTLE_BOY, MOVEMENT_TYPE_FACE_RIGHT
return
Route119_WeatherInstitute_1F_EventScript_LittleBoy:: @ 826FAA4
diff --git a/data/maps/Route119_WeatherInstitute_2F/scripts.inc b/data/maps/Route119_WeatherInstitute_2F/scripts.inc
index 9e22fca6e..7e2c15606 100644
--- a/data/maps/Route119_WeatherInstitute_2F/scripts.inc
+++ b/data/maps/Route119_WeatherInstitute_2F/scripts.inc
@@ -1,3 +1,10 @@
+.set LOCALID_GRUNT_1, 1
+.set LOCALID_GRUNT_2, 2
+.set LOCALID_SHELLY, 3
+.set LOCALID_SCIENTIST, 5
+.set LOCALID_GRUNT_3, 7
+.set LOCALID_GRUNT_4, 8
+
Route119_WeatherInstitute_2F_MapScripts:: @ 826FF1E
map_script MAP_SCRIPT_ON_TRANSITION, Route119_WeatherInstitute_2F_OnTransition
.byte 0
@@ -11,18 +18,18 @@ Route119_WeatherInstitute_2F_OnTransition: @ 826FF24
end
Route119_WeatherInstitute_2F_EventScript_SetScientistPosAquaHere:: @ 826FF44
- setobjectxyperm 5, 1, 6
- setobjectmovementtype 5, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_SCIENTIST, 1, 6
+ setobjectmovementtype LOCALID_SCIENTIST, MOVEMENT_TYPE_FACE_RIGHT
return
Route119_WeatherInstitute_2F_EventScript_SetScientistPosAquaGone:: @ 826FF50
- setobjectxyperm 5, 4, 6
- setobjectmovementtype 5, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_SCIENTIST, 4, 6
+ setobjectmovementtype LOCALID_SCIENTIST, MOVEMENT_TYPE_FACE_RIGHT
return
Route119_WeatherInstitute_2F_EventScript_SetScientistPosGameClear:: @ 826FF5C
- setobjectxyperm 5, 2, 2
- setobjectmovementtype 5, MOVEMENT_TYPE_FACE_UP
+ setobjectxyperm LOCALID_SCIENTIST, 2, 2
+ setobjectmovementtype LOCALID_SCIENTIST, MOVEMENT_TYPE_FACE_UP
return
Route119_WeatherInstitute_2F_EventScript_Grunt5:: @ 826FF68
@@ -48,16 +55,16 @@ Route119_WeatherInstitute_2F_EventScript_Shelly:: @ 826FFAD
Route119_WeatherInstitute_2F_EventScript_ShellyDefeated:: @ 826FFC8
msgbox Route119_WeatherInstitute_2F_Text_ShellyPostBattle, MSGBOX_DEFAULT
closemessage
- addobject 7 @ Aqua grunt
- applymovement 7, Route119_WeatherInstitute_2F_Movement_GruntApproachShelly
+ addobject LOCALID_GRUNT_3
+ applymovement LOCALID_GRUNT_3, Route119_WeatherInstitute_2F_Movement_GruntApproachShelly
applymovement OBJ_EVENT_ID_PLAYER, Route119_WeatherInstitute_2F_Movement_ShovePlayerOutOfWay
waitmovement 0
msgbox Route119_WeatherInstitute_2F_Text_TeamMagmaJustPassedBy, MSGBOX_DEFAULT
closemessage
playse SE_PIN
- applymovement 3, Common_Movement_ExclamationMark
+ applymovement LOCALID_SHELLY, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 3, Common_Movement_Delay48
+ applymovement LOCALID_SHELLY, Common_Movement_Delay48
waitmovement 0
msgbox Route119_WeatherInstitute_2F_Text_WeHaveToHurryToMtPyre, MSGBOX_DEFAULT
closemessage
@@ -67,17 +74,17 @@ Route119_WeatherInstitute_2F_EventScript_ShellyDefeated:: @ 826FFC8
fadescreen FADE_TO_BLACK
setflag FLAG_HIDE_ROUTE_119_TEAM_AQUA
setflag FLAG_HIDE_WEATHER_INSTITUTE_2F_AQUA_GRUNT_M
- removeobject 1
- removeobject 2
- removeobject 3
- removeobject 8
- removeobject 7
+ removeobject LOCALID_GRUNT_1
+ removeobject LOCALID_GRUNT_2
+ removeobject LOCALID_SHELLY
+ removeobject LOCALID_GRUNT_4
+ removeobject LOCALID_GRUNT_3
applymovement OBJ_EVENT_ID_PLAYER, Route119_WeatherInstitute_2F_Movement_PlayerReturnToPosition
waitmovement 0
fadescreen FADE_FROM_BLACK
- applymovement 5, Route119_WeatherInstitute_2F_Movement_ScientistApproachPlayer
+ applymovement LOCALID_SCIENTIST, Route119_WeatherInstitute_2F_Movement_ScientistApproachPlayer
waitmovement 0
- copyobjectxytoperm 5
+ copyobjectxytoperm LOCALID_SCIENTIST
goto Route119_WeatherInstitute_2F_EventScript_ReceiveCastform
end
diff --git a/data/maps/Route120/scripts.inc b/data/maps/Route120/scripts.inc
index a8aff3f76..7ec3e1221 100644
--- a/data/maps/Route120/scripts.inc
+++ b/data/maps/Route120/scripts.inc
@@ -1,3 +1,7 @@
+.set LOCALID_INVISIBLE_BRIDGE_KECLEON, 30
+.set LOCALID_STEVEN, 31
+.set LOCALID_VISIBLE_BRIDGE_KECLEON, 36
+
Route120_MapScripts:: @ 81F53EC
map_script MAP_SCRIPT_ON_RESUME, Route120_OnResume
map_script MAP_SCRIPT_ON_TRANSITION, Route120_OnTransition
@@ -27,8 +31,8 @@ Route120_EventScript_RemoveBridgeKecleon:: @ 81F5449
specialvar VAR_RESULT, GetBattleOutcome
compare VAR_RESULT, B_OUTCOME_CAUGHT
goto_if_ne Common_EventScript_NopReturn
- removeobject 30 @ Invisible Bridge Kecleon
- removeobject 36 @ Visible Bridge Kecleon
+ removeobject LOCALID_INVISIBLE_BRIDGE_KECLEON
+ removeobject LOCALID_VISIBLE_BRIDGE_KECLEON
return
Route120_EventScript_RemoveKecleon:: @ 81F5460
@@ -57,7 +61,7 @@ Route120_EventScript_SetBridgeClearMetatiles:: @ 81F54A3
return
Route120_EventScript_SetBridgeKecleonMovement:: @ 81F54C8
- setobjectmovementtype 36, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectmovementtype LOCALID_VISIBLE_BRIDGE_KECLEON, MOVEMENT_TYPE_FACE_RIGHT
return
Route120_OnTransition: @ 81F54CD
@@ -146,7 +150,7 @@ Route120_EventScript_GiveIapapaBerry:: @ 81F55F6
Route120_EventScript_GiveBerry:: @ 81F5601
giveitem VAR_0x8004
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_ShowBagIsFull
setflag FLAG_DAILY_ROUTE_120_RECEIVED_BERRY
msgbox Route120_Text_BerryIsRareRaiseItWithCare, MSGBOX_DEFAULT
@@ -196,14 +200,14 @@ Route120_EventScript_StevenBattleKecleon:: @ 81F568B
call_if_eq Route120_EventScript_PlayerApproachKecleonNorth
compare VAR_FACING, DIR_WEST
call_if_eq Route120_EventScript_PlayerApproachKecleonWest
- applymovement 31, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_STEVEN, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
delay 20
msgbox Route120_Text_StevenUsedDevonScope, MSGBOX_DEFAULT
closemessage
- applymovement 30, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_INVISIBLE_BRIDGE_KECLEON, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
- applymovement 30, Movement_KecleonAppears
+ applymovement LOCALID_INVISIBLE_BRIDGE_KECLEON, Movement_KecleonAppears
waitmovement 0
waitse
playmoncry SPECIES_KECLEON, 2
@@ -226,14 +230,14 @@ Route120_EventScript_StevenBattleKecleon:: @ 81F568B
Route120_EventScript_RemoveBridgeKecleonPostBattle:: @ 81F571C
fadescreenswapbuffers FADE_TO_BLACK
- removeobject 30 @ Invisible Bridge Kecleon
- removeobject 36 @ Visible Bridge Kecleon
+ removeobject LOCALID_INVISIBLE_BRIDGE_KECLEON
+ removeobject LOCALID_VISIBLE_BRIDGE_KECLEON
fadescreenswapbuffers FADE_FROM_BLACK
goto Route120_EventScript_StevenGiveDeconScope
end
Route120_EventScript_StevenGiveDeconScope:: @ 81F572C
- applymovement 31, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_STEVEN, Common_Movement_WalkInPlaceFastestDown
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
msgbox Route120_Text_StevenGiveDevonScope, MSGBOX_DEFAULT
@@ -241,13 +245,13 @@ Route120_EventScript_StevenGiveDeconScope:: @ 81F572C
setflag FLAG_RECEIVED_DEVON_SCOPE
msgbox Route120_Text_StevenGoodbye, MSGBOX_DEFAULT
closemessage
- applymovement 31, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_STEVEN, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
delay 50
setfieldeffectargument 0, 1
dofieldeffect FLDEFF_NPCFLY_OUT
delay 15
- removeobject 31
+ removeobject LOCALID_STEVEN
waitfieldeffect FLDEFF_NPCFLY_OUT
setmetatile 13, 15, METATILE_Fortree_WoodBridge1_Top, 0
setmetatile 12, 16, METATILE_Fortree_WoodBridge1_Bottom, 0
diff --git a/data/maps/Route121/scripts.inc b/data/maps/Route121/scripts.inc
index 81330b6e8..1a7591a93 100644
--- a/data/maps/Route121/scripts.inc
+++ b/data/maps/Route121/scripts.inc
@@ -1,3 +1,7 @@
+.set LOCALID_GRUNT_1, 12
+.set LOCALID_GRUNT_2, 13
+.set LOCALID_GRUNT_3, 14
+
Route121_MapScripts:: @ 81F5DFC
.byte 0
@@ -16,18 +20,18 @@ Route121_EventScript_SafariZoneSign:: @ 81F5E0F
Route121_EventScript_AquaGruntsMoveOut:: @ 81F5E18
lockall
playbgm MUS_AQA_0, 0
- applymovement 13, Common_Movement_WalkInPlaceRight
+ applymovement LOCALID_GRUNT_2, Common_Movement_WalkInPlaceRight
waitmovement 0
msgbox Route121_Text_OkayMoveOutToMtPyre, MSGBOX_DEFAULT
closemessage
- applymovement 12, Route121_Movement_Grunt1Exit
- applymovement 13, Route121_Movement_Grunt2Exit
- applymovement 14, Route121_Movement_Grunt3Exit
+ applymovement LOCALID_GRUNT_1, Route121_Movement_Grunt1Exit
+ applymovement LOCALID_GRUNT_2, Route121_Movement_Grunt2Exit
+ applymovement LOCALID_GRUNT_3, Route121_Movement_Grunt3Exit
waitmovement 0
fadedefaultbgm
- removeobject 12
- removeobject 13
- removeobject 14
+ removeobject LOCALID_GRUNT_1
+ removeobject LOCALID_GRUNT_2
+ removeobject LOCALID_GRUNT_3
setvar VAR_ROUTE121_STATE, 1
releaseall
end
diff --git a/data/maps/Route128/scripts.inc b/data/maps/Route128/scripts.inc
index 807f6a382..2e69a50ad 100644
--- a/data/maps/Route128/scripts.inc
+++ b/data/maps/Route128/scripts.inc
@@ -1,3 +1,7 @@
+.set LOCALID_STEVEN, 3
+.set LOCALID_ARCHIE, 4
+.set LOCALID_MAXIE, 5
+
Route128_MapScripts:: @ 81F6B38
map_script MAP_SCRIPT_ON_TRANSITION, Route128_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, Route128_OnFrame
@@ -14,64 +18,64 @@ Route128_OnFrame: @ 81F6B4D
Route128_EventScript_KyogreAwakenedScene:: @ 81F6B57
lockall
delay 20
- applymovement 4, Route128_Movement_ArchieLookAround
+ applymovement LOCALID_ARCHIE, Route128_Movement_ArchieLookAround
waitmovement 0
msgbox Route128_Text_ArchieWhatHappened, MSGBOX_DEFAULT
closemessage
- applymovement 4, Route128_Movement_ArchieBackUp
+ applymovement LOCALID_ARCHIE, Route128_Movement_ArchieBackUp
waitmovement 0
msgbox Route128_Text_ArchieIOnlyWanted, MSGBOX_DEFAULT
closemessage
- applymovement 5, Route128_Movement_MaxieApproachArchie
+ applymovement LOCALID_MAXIE, Route128_Movement_MaxieApproachArchie
waitmovement 0
- applymovement 4, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_ARCHIE, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
msgbox Route128_Text_MaxieDoYouUnderstandNow, MSGBOX_DEFAULT
closemessage
- applymovement 5, Route128_Movement_MaxieApproachPlayer
+ applymovement LOCALID_MAXIE, Route128_Movement_MaxieApproachPlayer
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
msgbox Route128_Text_MaxieResposibilityFallsToArchieAndMe, MSGBOX_DEFAULT
closemessage
- applymovement 4, Route128_Movement_ArchieRunLeft
+ applymovement LOCALID_ARCHIE, Route128_Movement_ArchieRunLeft
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
- applymovement 5, Route128_Movement_MaxieWalkLeft
+ applymovement LOCALID_MAXIE, Route128_Movement_MaxieWalkLeft
waitmovement 0
msgbox Route128_Text_MaxieThisDefiesBelief, MSGBOX_DEFAULT
closemessage
delay 40
- applymovement 5, Route128_Movement_MaxieExit
- applymovement 4, Route128_Movement_ArchieExit
+ applymovement LOCALID_MAXIE, Route128_Movement_MaxieExit
+ applymovement LOCALID_ARCHIE, Route128_Movement_ArchieExit
waitmovement 0
- removeobject 5
- removeobject 4
+ removeobject LOCALID_MAXIE
+ removeobject LOCALID_ARCHIE
delay 100
setfieldeffectargument 0, 1
dofieldeffect FLDEFF_NPCFLY_OUT
waitfieldeffect FLDEFF_NPCFLY_OUT
- addobject 3
- applymovement 3, Route128_Movement_StevenApproachPlayer
+ addobject LOCALID_STEVEN
+ applymovement LOCALID_STEVEN, Route128_Movement_StevenApproachPlayer
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
msgbox Route128_Text_StevenWhatIsHappening, MSGBOX_DEFAULT
closemessage
- applymovement 3, Route128_Movement_StevenWalkUp
+ applymovement LOCALID_STEVEN, Route128_Movement_StevenWalkUp
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
msgbox Route128_Text_StevenWholeWorldWillDrown, MSGBOX_DEFAULT
- applymovement 3, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_STEVEN, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
msgbox Route128_Text_StevenImGoingToSootopolis, MSGBOX_DEFAULT
closemessage
- applymovement 3, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_STEVEN, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
delay 50
setfieldeffectargument 0, 1
dofieldeffect FLDEFF_NPCFLY_OUT
delay 15
- removeobject 3
+ removeobject LOCALID_STEVEN
waitfieldeffect FLDEFF_NPCFLY_OUT
clearflag FLAG_HIDE_MAP_NAME_POPUP
setvar VAR_ROUTE128_STATE, 2
diff --git a/data/maps/RustboroCity/scripts.inc b/data/maps/RustboroCity/scripts.inc
index 27bfab94d..477b0d658 100644
--- a/data/maps/RustboroCity/scripts.inc
+++ b/data/maps/RustboroCity/scripts.inc
@@ -1,3 +1,10 @@
+.set LOCALID_LITTLE_BOY, 7
+.set LOCALID_LITTLE_GIRL, 8
+.set LOCALID_DEVON_EMPLOYEE, 9
+.set LOCALID_GRUNT, 10
+.set LOCALID_RIVAL, 14
+.set LOCALID_SCIENTIST, 15
+
RustboroCity_MapScripts:: @ 81E06BD
map_script MAP_SCRIPT_ON_TRANSITION, RustboroCity_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, RustboroCity_OnFrame
@@ -16,11 +23,11 @@ RustboroCity_OnTransition: @ 81E06C8
RustboroCity_EventScript_PositionScientistForExit:: @ 81E06EC
compare VAR_TEMP_0, 11
goto_if_eq RustboroCity_EventScript_PositionScientistLeftExit
- setobjectxyperm 15, 12, 15
+ setobjectxyperm LOCALID_SCIENTIST, 12, 15
end
RustboroCity_EventScript_PositionScientistLeftExit:: @ 81E06FF
- setobjectxyperm 15, 11, 15
+ setobjectxyperm LOCALID_SCIENTIST, 11, 15
end
RustboroCity_EventScript_HideMapNamePopup:: @ 81E0707
@@ -38,22 +45,22 @@ RustboroCity_EventScript_ScientistAddMatchCall:: @ 81E0715
waitmovement 0
playse SE_KAIDAN
delay 10
- addobject 15
- applymovement 15, RustboroCity_Movement_ScientistApproachPlayer
+ addobject LOCALID_SCIENTIST
+ applymovement LOCALID_SCIENTIST, RustboroCity_Movement_ScientistApproachPlayer
waitmovement 0
playse SE_PIN
- applymovement 15, Common_Movement_ExclamationMark
+ applymovement LOCALID_SCIENTIST, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 15, Common_Movement_Delay48
+ applymovement LOCALID_SCIENTIST, Common_Movement_Delay48
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
- applymovement 15, RustboroCity_Movement_ScientistWalkInPlaceDown
+ applymovement LOCALID_SCIENTIST, RustboroCity_Movement_ScientistWalkInPlaceDown
waitmovement 0
msgbox RustboroCity_Text_DevelopedNewPokenavFeature, MSGBOX_DEFAULT
closemessage
setflag FLAG_HAS_MATCH_CALL
- applymovement 15, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_SCIENTIST, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
playse SE_TK_KASYA
delay 10
@@ -63,7 +70,7 @@ RustboroCity_EventScript_ScientistAddMatchCall:: @ 81E0715
delay 10
playse SE_TK_KASYA
delay 20
- applymovement 15, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_SCIENTIST, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
msgbox RustboroCity_Text_AddedMatchCallPleaseCallMrStone, MSGBOX_DEFAULT
closemessage
@@ -94,10 +101,10 @@ RustboroCity_EventScript_MatchCallTutorial:: @ 81E07BD
delay 20
msgbox RustboroCity_Text_IdBetterGetBackToWork, MSGBOX_DEFAULT
closemessage
- applymovement 15, RustboroCity_Movement_ScientistLeave
+ applymovement LOCALID_SCIENTIST, RustboroCity_Movement_ScientistLeave
waitmovement 0
playse SE_KAIDAN
- removeobject 15
+ removeobject LOCALID_SCIENTIST
setflag FLAG_HIDE_RUSTBORO_CITY_SCIENTIST
setvar VAR_RUSTBORO_CITY_STATE, 7
clearflag FLAG_HIDE_MAP_NAME_POPUP
@@ -223,7 +230,7 @@ RustboroCity_EventScript_LittleBoy:: @ 81E0922
lock
faceplayer
msgbox RustboroCity_Text_PokemonCanChangeLookFromExp, MSGBOX_DEFAULT
- applymovement 7, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_LITTLE_BOY, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -232,7 +239,7 @@ RustboroCity_EventScript_LittleGirl:: @ 81E0938
lock
faceplayer
msgbox RustboroCity_Text_PokemonChangeShape, MSGBOX_DEFAULT
- applymovement 8, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_LITTLE_GIRL, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -246,40 +253,40 @@ RustboroCity_EventScript_Man2:: @ 81E094E
RustboroCity_EventScript_StolenGoodsTrigger0:: @ 81E095A
lockall
- setobjectxyperm 9, 14, 21
- setobjectmovementtype 9, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_DEVON_EMPLOYEE, 14, 21
+ setobjectmovementtype LOCALID_DEVON_EMPLOYEE, MOVEMENT_TYPE_FACE_RIGHT
setvar VAR_0x8004, 0
goto RustboroCity_EventScript_StolenGoodsScene
end
RustboroCity_EventScript_StolenGoodsTrigger1:: @ 81E0971
lockall
- setobjectxyperm 9, 14, 21
- setobjectmovementtype 9, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_DEVON_EMPLOYEE, 14, 21
+ setobjectmovementtype LOCALID_DEVON_EMPLOYEE, MOVEMENT_TYPE_FACE_RIGHT
setvar VAR_0x8004, 1
goto RustboroCity_EventScript_StolenGoodsScene
end
RustboroCity_EventScript_StolenGoodsTrigger2:: @ 81E0988
lockall
- setobjectxyperm 9, 14, 21
- setobjectmovementtype 9, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_DEVON_EMPLOYEE, 14, 21
+ setobjectmovementtype LOCALID_DEVON_EMPLOYEE, MOVEMENT_TYPE_FACE_RIGHT
setvar VAR_0x8004, 2
goto RustboroCity_EventScript_StolenGoodsScene
end
RustboroCity_EventScript_StolenGoodsTrigger3:: @ 81E099F
lockall
- setobjectxyperm 9, 14, 21
- setobjectmovementtype 9, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_DEVON_EMPLOYEE, 14, 21
+ setobjectmovementtype LOCALID_DEVON_EMPLOYEE, MOVEMENT_TYPE_FACE_RIGHT
setvar VAR_0x8004, 3
goto RustboroCity_EventScript_StolenGoodsScene
end
RustboroCity_EventScript_StolenGoodsTrigger4:: @ 81E09B6
lockall
- setobjectxyperm 9, 14, 21
- setobjectmovementtype 9, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_DEVON_EMPLOYEE, 14, 21
+ setobjectmovementtype LOCALID_DEVON_EMPLOYEE, MOVEMENT_TYPE_FACE_RIGHT
setvar VAR_0x8004, 4
goto RustboroCity_EventScript_StolenGoodsScene
end
@@ -288,20 +295,20 @@ RustboroCity_EventScript_StolenGoodsScene:: @ 81E09CD
msgbox RustboroCity_Text_OutOfTheWay, MSGBOX_DEFAULT
closemessage
playbgm MUS_AQA_0, 0
- addobject 10
- addobject 9
- applymovement 10, RustboroCity_Movement_GruntEscape
+ addobject LOCALID_GRUNT
+ addobject LOCALID_DEVON_EMPLOYEE
+ applymovement LOCALID_GRUNT, RustboroCity_Movement_GruntEscape
waitmovement 0
- removeobject 10
- applymovement 9, RustboroCity_Movement_EmployeeChaseGrunt1
+ removeobject LOCALID_GRUNT
+ applymovement LOCALID_DEVON_EMPLOYEE, RustboroCity_Movement_EmployeeChaseGrunt1
waitmovement 0
msgbox RustboroCity_Text_WaitDontTakeMyGoods, MSGBOX_DEFAULT
closemessage
- applymovement 9, RustboroCity_Movement_EmployeeChaseGrunt2
+ applymovement LOCALID_DEVON_EMPLOYEE, RustboroCity_Movement_EmployeeChaseGrunt2
waitmovement 0
fadedefaultbgm
- removeobject 9
- setobjectxyperm 9, 30, 10
+ removeobject LOCALID_DEVON_EMPLOYEE
+ setobjectxyperm LOCALID_DEVON_EMPLOYEE, 30, 10
clearflag FLAG_HIDE_RUSTBORO_CITY_DEVON_EMPLOYEE_1
setflag FLAG_DEVON_GOODS_STOLEN
setvar VAR_RUSTBORO_CITY_STATE, 2
@@ -327,31 +334,31 @@ RustboroCity_EventScript_YouGotItThankYou:: @ 81E0A44
@ Unknown, unused employee movements. Based on the differences in movement theyre for approaching an object (probably the player) in different positions
RustboroCity_EventScript_EmployeeApproachUp:: @ 81E0A4D
- applymovement 9, RustboroCity_Movement_EmployeeApproachUp
+ applymovement LOCALID_DEVON_EMPLOYEE, RustboroCity_Movement_EmployeeApproachUp
waitmovement 0
return
@ Unused, see above
RustboroCity_EventScript_EmployeeApproachLeft:: @ 81E0A58
- applymovement 9, RustboroCity_Movement_EmployeeApproachLeft
+ applymovement LOCALID_DEVON_EMPLOYEE, RustboroCity_Movement_EmployeeApproachLeft
waitmovement 0
return
@ Unused, see above
RustboroCity_EventScript_EmployeeApproachRight:: @ 81E0A63
- applymovement 9, RustboroCity_Movement_EmployeeApproachRight
+ applymovement LOCALID_DEVON_EMPLOYEE, RustboroCity_Movement_EmployeeApproachRight
waitmovement 0
return
@ Unused, see above
RustboroCity_EventScript_EmployeeApproachDown:: @ 81E0A6E
- applymovement 9, RustboroCity_Movement_EmployeeApproachDown
+ applymovement LOCALID_DEVON_EMPLOYEE, RustboroCity_Movement_EmployeeApproachDown
waitmovement 0
return
@ Unused, similar movement to the above scripts
RustboroCity_EventScript_EmployeeApproachPlayerFar:: @ 81E0A79
- applymovement 9, RustboroCity_Movement_EmployeeApproachPlayerFar
+ applymovement LOCALID_DEVON_EMPLOYEE, RustboroCity_Movement_EmployeeApproachPlayerFar
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
@@ -509,57 +516,57 @@ RustboroCity_EventScript_EmployeeAskToGetGoods:: @ 81E0B2E
call_if_eq RustboroCity_EventScript_EmployeeApproachPlayerDown1
setflag FLAG_INTERACTED_WITH_DEVON_EMPLOYEE_GOODS_STOLEN
setvar VAR_RUSTBORO_CITY_STATE, 3
- copyobjectxytoperm 9
+ copyobjectxytoperm LOCALID_DEVON_EMPLOYEE
msgbox RustboroCity_Text_HelpMeIWasRobbed, MSGBOX_DEFAULT
releaseall
end
@ The below movement scripts are either partially or fully duplicated by the movement scripts when the player returns the goods
RustboroCity_EventScript_EmployeeFacePlayerUp1:: @ 81E0B6F
- applymovement 9, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
playse SE_PIN
- applymovement 9, Common_Movement_ExclamationMark
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 9, Common_Movement_Delay48
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_Delay48
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
RustboroCity_EventScript_EmployeeFacePlayerLeft1:: @ 81E0B9B
- applymovement 9, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
playse SE_PIN
- applymovement 9, Common_Movement_ExclamationMark
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 9, Common_Movement_Delay48
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_Delay48
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_FaceRight
waitmovement 0
return
RustboroCity_EventScript_EmployeeFacePlayerDown1:: @ 81E0BC7
- applymovement 9, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
playse SE_PIN
- applymovement 9, Common_Movement_ExclamationMark
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 9, Common_Movement_Delay48
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_Delay48
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
return
RustboroCity_EventScript_EmployeeApproachPlayerDown1:: @ 81E0BF3
- applymovement 9, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
playse SE_PIN
- applymovement 9, Common_Movement_ExclamationMark
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 9, Common_Movement_Delay48
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_Delay48
waitmovement 0
- applymovement 9, RustboroCity_Movement_EmployeeApproachPlayerDown
+ applymovement LOCALID_DEVON_EMPLOYEE, RustboroCity_Movement_EmployeeApproachPlayerDown
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
@@ -624,69 +631,69 @@ RustboroCity_EventScript_BagFull:: @ 81E0CD3
return
RustboroCity_EventScript_EmployeeFacePlayerUp2:: @ 81E0CDC
- applymovement 9, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
playse SE_PIN
- applymovement 9, Common_Movement_ExclamationMark
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 9, Common_Movement_Delay48
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_Delay48
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
RustboroCity_EventScript_EmployeeFacePlayerLeft2:: @ 81E0D08
- applymovement 9, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
playse SE_PIN
- applymovement 9, Common_Movement_ExclamationMark
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 9, Common_Movement_Delay48
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_Delay48
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_FaceLeft
waitmovement 0
return
RustboroCity_EventScript_EmployeeFacePlayerDown2:: @ 81E0D34
- applymovement 9, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
playse SE_PIN
- applymovement 9, Common_Movement_ExclamationMark
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 9, Common_Movement_Delay48
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_Delay48
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
return
RustboroCity_EventScript_EmployeeApproachPlayerDown2:: @ 81E0D60
- applymovement 9, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
playse SE_PIN
- applymovement 9, Common_Movement_ExclamationMark
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 9, Common_Movement_Delay48
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_Delay48
waitmovement 0
- applymovement 9, RustboroCity_Movement_EmployeeApproachPlayerDown
+ applymovement LOCALID_DEVON_EMPLOYEE, RustboroCity_Movement_EmployeeApproachPlayerDown
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
return
RustboroCity_EventScript_EmployeeFacePlayerRight:: @ 81E0D96
- applymovement 9, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
playse SE_PIN
- applymovement 9, Common_Movement_ExclamationMark
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 9, Common_Movement_Delay48
+ applymovement LOCALID_DEVON_EMPLOYEE, Common_Movement_Delay48
waitmovement 0
return
RustboroCity_EventScript_Rival:: @ 81E0DB8
lockall
call_if_unset FLAG_MET_RIVAL_RUSTBORO, RustboroCity_EventScript_PlayRivalMusic
- applymovement 14, Common_Movement_FacePlayer
+ applymovement LOCALID_RIVAL, Common_Movement_FacePlayer
waitmovement 0
goto RustboroCity_EventScript_RivalEncounter
@@ -709,14 +716,14 @@ RustboroCity_EventScript_PlayBrendanMusic:: @ 81E0DEE
RustboroCity_EventScript_RivalTrigger0:: @ 81E0DF3
lockall
call RustboroCity_EventScript_PlayRivalMusic
- applymovement 14, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_RIVAL, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
playse SE_PIN
- applymovement 14, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 14, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
- applymovement 14, RustboroCity_Movement_RivalApproachPlayer0
+ applymovement LOCALID_RIVAL, RustboroCity_Movement_RivalApproachPlayer0
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
@@ -725,14 +732,14 @@ RustboroCity_EventScript_RivalTrigger0:: @ 81E0DF3
RustboroCity_EventScript_RivalTrigger1:: @ 81E0E33
lockall
call RustboroCity_EventScript_PlayRivalMusic
- applymovement 14, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_RIVAL, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
playse SE_PIN
- applymovement 14, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 14, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
- applymovement 14, RustboroCity_Movement_RivalApproachPlayer1
+ applymovement LOCALID_RIVAL, RustboroCity_Movement_RivalApproachPlayer1
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
@@ -741,14 +748,14 @@ RustboroCity_EventScript_RivalTrigger1:: @ 81E0E33
RustboroCity_EventScript_RivalTrigger2:: @ 81E0E73
lockall
call RustboroCity_EventScript_PlayRivalMusic
- applymovement 14, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_RIVAL, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
playse SE_PIN
- applymovement 14, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 14, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
- applymovement 14, RustboroCity_Movement_RivalApproachPlayer2
+ applymovement LOCALID_RIVAL, RustboroCity_Movement_RivalApproachPlayer2
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
@@ -757,14 +764,14 @@ RustboroCity_EventScript_RivalTrigger2:: @ 81E0E73
RustboroCity_EventScript_RivalTrigger3:: @ 81E0EB3
lockall
call RustboroCity_EventScript_PlayRivalMusic
- applymovement 14, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_RIVAL, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
playse SE_PIN
- applymovement 14, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 14, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
- applymovement 14, RustboroCity_Movement_RivalApproachPlayer3
+ applymovement LOCALID_RIVAL, RustboroCity_Movement_RivalApproachPlayer3
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
@@ -773,14 +780,14 @@ RustboroCity_EventScript_RivalTrigger3:: @ 81E0EB3
RustboroCity_EventScript_RivalTrigger4:: @ 81E0EF3
lockall
call RustboroCity_EventScript_PlayRivalMusic
- applymovement 14, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_RIVAL, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
playse SE_PIN
- applymovement 14, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 14, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
- applymovement 14, RustboroCity_Movement_RivalApproachPlayer4
+ applymovement LOCALID_RIVAL, RustboroCity_Movement_RivalApproachPlayer4
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
@@ -789,14 +796,14 @@ RustboroCity_EventScript_RivalTrigger4:: @ 81E0EF3
RustboroCity_EventScript_RivalTrigger5:: @ 81E0F33
lockall
call RustboroCity_EventScript_PlayRivalMusic
- applymovement 14, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_RIVAL, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
playse SE_PIN
- applymovement 14, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 14, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
- applymovement 14, RustboroCity_Movement_RivalApproachPlayer5
+ applymovement LOCALID_RIVAL, RustboroCity_Movement_RivalApproachPlayer5
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
@@ -805,14 +812,14 @@ RustboroCity_EventScript_RivalTrigger5:: @ 81E0F33
RustboroCity_EventScript_RivalTrigger6:: @ 81E0F73
lockall
call RustboroCity_EventScript_PlayRivalMusic
- applymovement 14, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_RIVAL, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
playse SE_PIN
- applymovement 14, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 14, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
- applymovement 14, RustboroCity_Movement_RivalApproachPlayer6
+ applymovement LOCALID_RIVAL, RustboroCity_Movement_RivalApproachPlayer6
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
@@ -821,14 +828,14 @@ RustboroCity_EventScript_RivalTrigger6:: @ 81E0F73
RustboroCity_EventScript_RivalTrigger7:: @ 81E0FB3
lockall
call RustboroCity_EventScript_PlayRivalMusic
- applymovement 14, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_RIVAL, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
playse SE_PIN
- applymovement 14, Common_Movement_ExclamationMark
+ applymovement LOCALID_RIVAL, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 14, Common_Movement_Delay48
+ applymovement LOCALID_RIVAL, Common_Movement_Delay48
waitmovement 0
- applymovement 14, RustboroCity_Movement_RivalApproachPlayer7
+ applymovement LOCALID_RIVAL, RustboroCity_Movement_RivalApproachPlayer7
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
diff --git a/data/maps/RustboroCity_DevonCorp_1F/scripts.inc b/data/maps/RustboroCity_DevonCorp_1F/scripts.inc
index 3ee7e7dc8..80e8f3cf1 100644
--- a/data/maps/RustboroCity_DevonCorp_1F/scripts.inc
+++ b/data/maps/RustboroCity_DevonCorp_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_STAIR_GUARD, 2
+
RustboroCity_DevonCorp_1F_MapScripts:: @ 8211245
map_script MAP_SCRIPT_ON_TRANSITION, RustboroCity_DevonCorp_1F_OnTransition
.byte 0
@@ -7,8 +9,8 @@ RustboroCity_DevonCorp_1F_OnTransition: @ 821124B
end
RustboroCity_DevonCorp_1F_EventScript_BlockStairs:: @ 8211255
- setobjectxyperm 2, 14, 2
- setobjectmovementtype 2, MOVEMENT_TYPE_FACE_DOWN
+ setobjectxyperm LOCALID_STAIR_GUARD, 14, 2
+ setobjectmovementtype LOCALID_STAIR_GUARD, MOVEMENT_TYPE_FACE_DOWN
return
RustboroCity_DevonCorp_1F_EventScript_Employee:: @ 8211261
diff --git a/data/maps/RustboroCity_DevonCorp_2F/scripts.inc b/data/maps/RustboroCity_DevonCorp_2F/scripts.inc
index 9df6d7ab6..e33fb2d0f 100644
--- a/data/maps/RustboroCity_DevonCorp_2F/scripts.inc
+++ b/data/maps/RustboroCity_DevonCorp_2F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_FOSSIL_SCIENTIST, 5
+
RustboroCity_DevonCorp_2F_MapScripts:: @ 8211857
map_script MAP_SCRIPT_ON_TRANSITION, RustboroCity_DevonCorp_2F_OnTransition
.byte 0
@@ -80,9 +82,9 @@ RustboroCity_DevonCorp_2F_EventScript_FossilScientist:: @ 82118F1
RustboroCity_DevonCorp_2F_EventScript_NoticeRootFossil:: @ 8211933
closemessage
playse SE_PIN
- applymovement 5, Common_Movement_ExclamationMark
+ applymovement LOCALID_FOSSIL_SCIENTIST, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 5, Common_Movement_Delay48
+ applymovement LOCALID_FOSSIL_SCIENTIST, Common_Movement_Delay48
waitmovement 0
msgbox RustboroCity_DevonCorp_2F_Text_WantToBringFossilBackToLife, MSGBOX_YESNO
compare VAR_RESULT, NO
@@ -105,9 +107,9 @@ RustboroCity_DevonCorp_2F_EventScript_GiveRootFossil:: @ 8211974
RustboroCity_DevonCorp_2F_EventScript_NoticeClawFossil:: @ 8211991
closemessage
playse SE_PIN
- applymovement 5, Common_Movement_ExclamationMark
+ applymovement LOCALID_FOSSIL_SCIENTIST, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 5, Common_Movement_Delay48
+ applymovement LOCALID_FOSSIL_SCIENTIST, Common_Movement_Delay48
waitmovement 0
msgbox RustboroCity_DevonCorp_2F_Text_WantToBringFossilBackToLife, MSGBOX_YESNO
compare VAR_RESULT, NO
diff --git a/data/maps/RustboroCity_DevonCorp_3F/scripts.inc b/data/maps/RustboroCity_DevonCorp_3F/scripts.inc
index aedbc9f9b..d24b4e902 100644
--- a/data/maps/RustboroCity_DevonCorp_3F/scripts.inc
+++ b/data/maps/RustboroCity_DevonCorp_3F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_DEVON_EMPLOYEE, 2
+
RustboroCity_DevonCorp_3F_MapScripts:: @ 821242D
map_script MAP_SCRIPT_ON_TRANSITION, RustboroCity_DevonCorp_3F_OnTransition
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, RustboroCity_DevonCorp_3F_OnWarp
@@ -10,8 +12,8 @@ RustboroCity_DevonCorp_3F_OnTransition: @ 821243D
end
RustboroCity_DevonCorp_3F_EventScript_SetEmployeePos:: @ 8212449
- setobjectxyperm 2, 3, 2
- setobjectmovementtype 2, MOVEMENT_TYPE_FACE_LEFT
+ setobjectxyperm LOCALID_DEVON_EMPLOYEE, 3, 2
+ setobjectmovementtype LOCALID_DEVON_EMPLOYEE, MOVEMENT_TYPE_FACE_LEFT
return
RustboroCity_DevonCorp_3F_OnWarp: @ 8212455
@@ -30,21 +32,21 @@ RustboroCity_DevonCorp_3F_EventScript_MeetPresident:: @ 821246E
lockall
msgbox RustboroCity_DevonCorp_3F_Text_ThisIs3rdFloorWaitHere, MSGBOX_DEFAULT
closemessage
- applymovement 2, RustboroCity_DevonCorp_3F_Movement_EmployeeWalkOffscreen
+ applymovement LOCALID_DEVON_EMPLOYEE, RustboroCity_DevonCorp_3F_Movement_EmployeeWalkOffscreen
waitmovement 0
delay 80
- applymovement 2, RustboroCity_DevonCorp_3F_Movement_EmployeeReturnToPlayer
+ applymovement LOCALID_DEVON_EMPLOYEE, RustboroCity_DevonCorp_3F_Movement_EmployeeReturnToPlayer
waitmovement 0
msgbox RustboroCity_DevonCorp_3F_Text_WordWithPresidentComeWithMe, MSGBOX_DEFAULT
closemessage
playbgm MUS_TSURETEK, 0
- applymovement 2, RustboroCity_DevonCorp_3F_Movement_LeadPlayerToPresident
+ applymovement LOCALID_DEVON_EMPLOYEE, RustboroCity_DevonCorp_3F_Movement_LeadPlayerToPresident
applymovement OBJ_EVENT_ID_PLAYER, RustboroCity_DevonCorp_3F_Movement_PlayerFollowToPresident
waitmovement 0
msgbox RustboroCity_DevonCorp_3F_Text_PleaseGoAhead, MSGBOX_DEFAULT
closemessage
fadedefaultbgm
- applymovement 2, RustboroCity_DevonCorp_3F_Movement_EmployeeFaceDesk
+ applymovement LOCALID_DEVON_EMPLOYEE, RustboroCity_DevonCorp_3F_Movement_EmployeeFaceDesk
applymovement OBJ_EVENT_ID_PLAYER, RustboroCity_DevonCorp_3F_Movement_PlayerApproachDesk
waitmovement 0
msgbox RustboroCity_DevonCorp_3F_Text_MrStoneIHaveFavor, MSGBOX_DEFAULT
@@ -162,7 +164,7 @@ RustboroCity_DevonCorp_3F_EventScript_MrStone:: @ 821256C
RustboroCity_DevonCorp_3F_EventScript_GiveExpShare:: @ 8212595
msgbox RustboroCity_DevonCorp_3F_Text_ThankYouForDeliveringLetter, MSGBOX_DEFAULT
giveitem ITEM_EXP_SHARE
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_ShowBagIsFull
setflag FLAG_RECEIVED_EXP_SHARE
msgbox RustboroCity_DevonCorp_3F_Text_ExplainExpShare, MSGBOX_DEFAULT
diff --git a/data/maps/RustboroCity_Flat1_2F/scripts.inc b/data/maps/RustboroCity_Flat1_2F/scripts.inc
index 4295f0447..a1943adae 100644
--- a/data/maps/RustboroCity_Flat1_2F/scripts.inc
+++ b/data/maps/RustboroCity_Flat1_2F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_WALDAS_DAD, 6
+
RustboroCity_Flat1_2F_MapScripts:: @ 8215139
.byte 0
@@ -59,7 +61,7 @@ RustboroCity_Flat1_2F_EventScript_WaldaLikesPhrase:: @ 82151F8
msgbox RustboroCity_Flat1_2F_Text_LetsGiveItATry2, MSGBOX_DEFAULT
call RustboroCity_Flat1_2F_EventScript_WaldasDadFaceWalda
msgbox RustboroCity_Flat1_2F_Text_OhShesLaughing, MSGBOX_DEFAULT
- applymovement 6, Common_Movement_FacePlayer
+ applymovement LOCALID_WALDAS_DAD, Common_Movement_FacePlayer
waitmovement 0
msgbox RustboroCity_Flat1_2F_Text_ThankYouIllGiveYouWallpaper, MSGBOX_DEFAULT
release
@@ -73,7 +75,7 @@ RustboroCity_Flat1_2F_EventScript_WaldaDoesntLikePhrase:: @ 8215221
end
RustboroCity_Flat1_2F_EventScript_WaldasDadFaceWalda:: @ 8215238
- turnobject 6, DIR_EAST
+ turnobject LOCALID_WALDAS_DAD, DIR_EAST
return
RustboroCity_Flat1_2F_EventScript_WaldasMom:: @ 821523D
diff --git a/data/maps/RustboroCity_Flat2_2F/scripts.inc b/data/maps/RustboroCity_Flat2_2F/scripts.inc
index 1caeda683..e7909d54b 100644
--- a/data/maps/RustboroCity_Flat2_2F/scripts.inc
+++ b/data/maps/RustboroCity_Flat2_2F/scripts.inc
@@ -11,7 +11,7 @@ RustboroCity_Flat2_2F_EventScript_NinjaBoy:: @ 8215FE1
goto_if_set FLAG_RECEIVED_PREMIER_BALL_RUSTBORO, RustboroCity_Flat2_2F_EventScript_GavePremierBall
msgbox RustboroCity_Flat2_2F_Text_MyDaddyMadeThisYouCanHaveIt, MSGBOX_DEFAULT
giveitem ITEM_PREMIER_BALL
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_ShowBagIsFull
setflag FLAG_RECEIVED_PREMIER_BALL_RUSTBORO
release
diff --git a/data/maps/RustboroCity_Gym/scripts.inc b/data/maps/RustboroCity_Gym/scripts.inc
index 94e032692..ce6fdb127 100644
--- a/data/maps/RustboroCity_Gym/scripts.inc
+++ b/data/maps/RustboroCity_Gym/scripts.inc
@@ -29,7 +29,7 @@ RustboroCity_Gym_EventScript_RoxanneDefeated:: @ 8212F66
RustboroCity_Gym_EventScript_GiveRockTomb:: @ 8212FA4
giveitem ITEM_TM39
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_ShowBagIsFull
setflag FLAG_RECEIVED_TM39
msgbox RustboroCity_Gym_Text_ExplainRockTomb, MSGBOX_DEFAULT
diff --git a/data/maps/RustboroCity_PokemonCenter_1F/scripts.inc b/data/maps/RustboroCity_PokemonCenter_1F/scripts.inc
index ca10592b0..fbe1ac739 100644
--- a/data/maps/RustboroCity_PokemonCenter_1F/scripts.inc
+++ b/data/maps/RustboroCity_PokemonCenter_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_NURSE, 1
+
RustboroCity_PokemonCenter_1F_MapScripts:: @ 8214D62
map_script MAP_SCRIPT_ON_TRANSITION, RustboroCity_PokemonCenter_1F_OnTransition
map_script MAP_SCRIPT_ON_RESUME, CableClub_OnResume
@@ -8,9 +10,8 @@ RustboroCity_PokemonCenter_1F_OnTransition: @ 8214D6D
call Common_EventScript_UpdateBrineyLocation
end
-@ VAR_0x800B is the Nurse's object event id
RustboroCity_PokemonCenter_1F_EventScript_Nurse:: @ 8214D76
- setvar VAR_0x800B, 1
+ setvar VAR_0x800B, LOCALID_NURSE
call Common_EventScript_PkmnCenterNurse
waitmessage
waitbuttonpress
diff --git a/data/maps/RusturfTunnel/scripts.inc b/data/maps/RusturfTunnel/scripts.inc
index 853b94fc7..a342135bf 100644
--- a/data/maps/RusturfTunnel/scripts.inc
+++ b/data/maps/RusturfTunnel/scripts.inc
@@ -1,3 +1,9 @@
+.equ LOCALID_WANDAS_BF, 1
+.set LOCALID_BRINEY, 5
+.set LOCALID_GRUNT, 6
+.set LOCALID_PEEKO, 7
+.equ LOCALID_WANDA, 10
+
RusturfTunnel_MapScripts:: @ 822CE27
map_script MAP_SCRIPT_ON_TRANSITION, RusturfTunnel_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, RusturfTunnel_OnFrame
@@ -14,8 +20,8 @@ RusturfTunnel_OnTransition: @ 822CE44
end
RusturfTunnel_EventScript_SetAquaGruntAndPeekoPos:: @ 822CE50
- setobjectxyperm 7, 13, 4
- setobjectxyperm 6, 13, 5
+ setobjectxyperm LOCALID_PEEKO, 13, 4
+ setobjectxyperm LOCALID_GRUNT, 13, 5
return
RusturfTunnel_EventScript_Wanda:: @ 822CE5F
@@ -86,35 +92,35 @@ RusturfTunnel_EventScript_ClearTunnelScene:: @ 822CEAE
RusturfTunnel_EventScript_BoyfriendApproachWanda1:: @ 822CF5D
applymovement OBJ_EVENT_ID_PLAYER, RusturfTunnel_Movement_PlayerWatchBoyfriend1
- applymovement 1, RusturfTunnel_Movement_BoyfriendApproachWanda1
+ applymovement LOCALID_WANDAS_BF, RusturfTunnel_Movement_BoyfriendApproachWanda1
waitmovement 0
return
RusturfTunnel_EventScript_BoyfriendApproachWanda2:: @ 822CF6F
applymovement OBJ_EVENT_ID_PLAYER, RusturfTunnel_Movement_PlayerWatchBoyfriend
- applymovement 1, RusturfTunnel_Movement_BoyfriendApproachWanda
+ applymovement LOCALID_WANDAS_BF, RusturfTunnel_Movement_BoyfriendApproachWanda
waitmovement 0
- applymovement 10, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_WANDA, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
RusturfTunnel_EventScript_BoyfriendApproachWanda3:: @ 822CF8B
applymovement OBJ_EVENT_ID_PLAYER, RusturfTunnel_Movement_PlayerWatchBoyfriend
- applymovement 1, RusturfTunnel_Movement_BoyfriendApproachWanda
+ applymovement LOCALID_WANDAS_BF, RusturfTunnel_Movement_BoyfriendApproachWanda
waitmovement 0
- applymovement 10, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_WANDA, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
RusturfTunnel_EventScript_FaceWandasBoyfriend1:: @ 822CFA7
- applymovement 1, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_WANDAS_BF, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
RusturfTunnel_EventScript_FaceWandasBoyfriend2:: @ 822CFBC
- applymovement 1, RusturfTunnel_Movement_BoyfriendFaceRight
+ applymovement LOCALID_WANDAS_BF, RusturfTunnel_Movement_BoyfriendFaceRight
waitmovement 0
return
@@ -123,28 +129,28 @@ RusturfTunnel_EventScript_FaceWandasBoyfriend3:: @ 822CFC7
RusturfTunnel_EventScript_WandasBoyfriendApproachPlayer:: @ 822CFC8
closemessage
- applymovement 1, RusturfTunnel_Movement_WandasBoyfriendApproachPlayer
+ applymovement LOCALID_WANDAS_BF, RusturfTunnel_Movement_WandasBoyfriendApproachPlayer
waitmovement 0
return
RusturfTunnel_EventScript_WandaAndBoyfriendExit1:: @ 822CFD4
- applymovement 10, RusturfTunnel_Movement_WandaExit1
- applymovement 1, RusturfTunnel_Movement_WandasBoyfriendExit1
+ applymovement LOCALID_WANDA, RusturfTunnel_Movement_WandaExit1
+ applymovement LOCALID_WANDAS_BF, RusturfTunnel_Movement_WandasBoyfriendExit1
waitmovement 0
return
RusturfTunnel_EventScript_WandaAndBoyfriendExit:: @ 822CFE6
applymovement OBJ_EVENT_ID_PLAYER, RusturfTunnel_Movement_PlayerWatchWandaExit
- applymovement 10, RusturfTunnel_Movement_WandaExit
- applymovement 1, RusturfTunnel_Movement_WandasBoyfriendExit
+ applymovement LOCALID_WANDA, RusturfTunnel_Movement_WandaExit
+ applymovement LOCALID_WANDAS_BF, RusturfTunnel_Movement_WandasBoyfriendExit
waitmovement 0
return
RusturfTunnel_EventScript_WandasBoyfriendNotice:: @ 822CFFF
playse SE_PIN
- applymovement 1, Common_Movement_ExclamationMark
+ applymovement LOCALID_WANDAS_BF, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 1, Common_Movement_Delay48
+ applymovement LOCALID_WANDAS_BF, Common_Movement_Delay48
waitmovement 0
return
@@ -282,11 +288,11 @@ RusturfTunnel_EventScript_AquaGruntBackUp:: @ 822D083
lockall
msgbox RusturfTunnel_Text_ComeAndGetSome, MSGBOX_DEFAULT
closemessage
- applymovement 6, RusturfTunnel_Movement_GruntAndPeekoBackUp
- applymovement 7, RusturfTunnel_Movement_GruntAndPeekoBackUp
+ applymovement LOCALID_GRUNT, RusturfTunnel_Movement_GruntAndPeekoBackUp
+ applymovement LOCALID_PEEKO, RusturfTunnel_Movement_GruntAndPeekoBackUp
waitmovement 0
- copyobjectxytoperm 6
- copyobjectxytoperm 7
+ copyobjectxytoperm LOCALID_GRUNT
+ copyobjectxytoperm LOCALID_PEEKO
setvar VAR_RUSTURF_TUNNEL_STATE, 3
releaseall
end
@@ -317,18 +323,18 @@ RusturfTunnel_EventScript_Grunt:: @ 822D0C2
giveitem ITEM_DEVON_GOODS
closemessage
applymovement OBJ_EVENT_ID_PLAYER, RusturfTunnel_Movement_PushPlayerAsideForGrunt
- applymovement 6, RusturfTunnel_Movement_GruntEscape
+ applymovement LOCALID_GRUNT, RusturfTunnel_Movement_GruntEscape
waitmovement 0
- removeobject 6
+ removeobject LOCALID_GRUNT
delay 50
- addobject 5
- applymovement 5, RusturfTunnel_Movement_BrineyApproachPeeko1
+ addobject LOCALID_BRINEY
+ applymovement LOCALID_BRINEY, RusturfTunnel_Movement_BrineyApproachPeeko1
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, RusturfTunnel_Movement_PlayerMoveAsideForBriney
- applymovement 5, RusturfTunnel_Movement_BrineyApproachPeeko2
+ applymovement LOCALID_BRINEY, RusturfTunnel_Movement_BrineyApproachPeeko2
waitmovement 0
msgbox RusturfTunnel_Text_PeekoGladToSeeYouSafe, MSGBOX_DEFAULT
- applymovement 5, Common_Movement_FacePlayer
+ applymovement LOCALID_BRINEY, Common_Movement_FacePlayer
waitmovement 0
message RusturfTunnel_Text_ThankYouLetsGoHomePeeko
waitmessage
@@ -338,11 +344,11 @@ RusturfTunnel_EventScript_Grunt:: @ 822D0C2
waitmoncry
closemessage
applymovement OBJ_EVENT_ID_PLAYER, RusturfTunnel_Movement_PlayerWatchBrineyExit
- applymovement 5, RusturfTunnel_Movement_BrineyExit
- applymovement 7, RusturfTunnel_Movement_PeekoExit
+ applymovement LOCALID_BRINEY, RusturfTunnel_Movement_BrineyExit
+ applymovement LOCALID_PEEKO, RusturfTunnel_Movement_PeekoExit
waitmovement 0
- removeobject 5
- removeobject 7
+ removeobject LOCALID_BRINEY
+ removeobject LOCALID_PEEKO
clearflag FLAG_DEVON_GOODS_STOLEN
setflag FLAG_RECOVERED_DEVON_GOODS
setvar VAR_RUSTBORO_CITY_STATE, 4
diff --git a/data/maps/SSTidalCorridor/scripts.inc b/data/maps/SSTidalCorridor/scripts.inc
index fae6efc1a..a055c6548 100644
--- a/data/maps/SSTidalCorridor/scripts.inc
+++ b/data/maps/SSTidalCorridor/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_SAILOR, 1
+.set LOCALID_SCOTT, 5
+
SSTidalCorridor_MapScripts:: @ 823BFCF
map_script MAP_SCRIPT_ON_FRAME_TABLE, SSTidalCorridor_OnFrame
.byte 0
@@ -191,20 +194,20 @@ SSTidalCorridor_EventScript_TrainerNotDefeated:: @ 823C218
SSTidalCorridor_EventScript_ScottScene:: @ 823C219
lockall
- applymovement 5, SSTidalCorridor_Movement_ScottApproachPlayer
+ applymovement LOCALID_SCOTT, SSTidalCorridor_Movement_ScottApproachPlayer
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
msgbox SSTidalCorridor_Text_ScottBattleFrontierInvite, MSGBOX_DEFAULT
closemessage
applymovement OBJ_EVENT_ID_PLAYER, SSTidalCorridor_Movement_PlayerWatchScottExit
- applymovement 1, SSTidalCorridor_Movement_SailorMoveForScott
- applymovement 5, SSTidalCorridor_Movement_ScottExit
+ applymovement LOCALID_SAILOR, SSTidalCorridor_Movement_SailorMoveForScott
+ applymovement LOCALID_SCOTT, SSTidalCorridor_Movement_ScottExit
waitmovement 0
playse SE_KAIDAN
waitse
- removeobject 5
- applymovement 1, SSTidalCorridor_Movement_SailorReturn
+ removeobject LOCALID_SCOTT
+ applymovement LOCALID_SAILOR, SSTidalCorridor_Movement_SailorReturn
waitmovement 0
delay 30
setflag FLAG_MET_SCOTT_ON_SS_TIDAL
diff --git a/data/maps/SafariZone_South/scripts.inc b/data/maps/SafariZone_South/scripts.inc
index 7918a9b96..75ea52347 100644
--- a/data/maps/SafariZone_South/scripts.inc
+++ b/data/maps/SafariZone_South/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
SafariZone_South_MapScripts:: @ 823D279
map_script MAP_SCRIPT_ON_TRANSITION, SafariZone_South_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, SafariZone_South_OnFrame
@@ -11,9 +13,9 @@ SafariZone_South_EventScript_EnterSafariZone:: @ 823D28E
lockall
applymovement OBJ_EVENT_ID_PLAYER, SafariZone_South_Movement_PlayerEnter
waitmovement 0
- applymovement 1, SafariZone_South_Movement_ExitAttendantBlockDoor
+ applymovement LOCALID_ATTENDANT, SafariZone_South_Movement_ExitAttendantBlockDoor
waitmovement 0
- setobjectxyperm 1, 32, 34
+ setobjectxyperm LOCALID_ATTENDANT, 32, 34
setvar VAR_SAFARI_ZONE_STATE, 0
releaseall
end
@@ -24,7 +26,7 @@ SafariZone_South_OnTransition: @ 823D2B1
end
SafariZone_South_EventScript_SetExitAttendantAside:: @ 823D2BD
- setobjectxyperm 1, 31, 34
+ setobjectxyperm LOCALID_ATTENDANT, 31, 34
return
SafariZone_South_Movement_PlayerEnter: @ 823D2C5
@@ -74,7 +76,7 @@ SafariZone_South_EventScript_ExitEarly:: @ 823D31A
end
SafariZone_South_EventScript_ExitEarlyNorth:: @ 823D33F
- applymovement 1, SafariZone_South_Movement_MoveExitAttendantNorth
+ applymovement LOCALID_ATTENDANT, SafariZone_South_Movement_MoveExitAttendantNorth
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, SafariZone_South_Movement_PlayerExitNorth
waitmovement 0
@@ -82,7 +84,7 @@ SafariZone_South_EventScript_ExitEarlyNorth:: @ 823D33F
end
SafariZone_South_EventScript_ExitEarlyEast:: @ 823D359
- applymovement 1, SafariZone_South_Movement_MoveExitAttendantEast
+ applymovement LOCALID_ATTENDANT, SafariZone_South_Movement_MoveExitAttendantEast
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, SafariZone_South_Movement_PlayerExitEast
waitmovement 0
diff --git a/data/maps/SeafloorCavern_Entrance/scripts.inc b/data/maps/SeafloorCavern_Entrance/scripts.inc
index b9ff722e6..20f731044 100644
--- a/data/maps/SeafloorCavern_Entrance/scripts.inc
+++ b/data/maps/SeafloorCavern_Entrance/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_GRUNT, 1
+
SeafloorCavern_Entrance_MapScripts:: @ 823446E
map_script MAP_SCRIPT_ON_RESUME, SeafloorCavern_Entrance_OnResume
.byte 0
@@ -13,9 +15,9 @@ SeafloorCavern_Entrance_EventScript_Grunt:: @ 8234485
goto_if_eq SeafloorCavern_Entrance_EventScript_GruntSpeechShort
waitse
playse SE_PIN
- applymovement 1, Common_Movement_ExclamationMark
+ applymovement LOCALID_GRUNT, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 1, Common_Movement_Delay48
+ applymovement LOCALID_GRUNT, Common_Movement_Delay48
waitmovement 0
delay 20
compare VAR_FACING, DIR_WEST
@@ -26,10 +28,10 @@ SeafloorCavern_Entrance_EventScript_Grunt:: @ 8234485
call_if_eq SeafloorCavern_Entrance_EventScript_GruntFacePlayerNorth
delay 30
setvar VAR_HAS_TALKED_TO_SEAFLOOR_CAVERN_ENTRANCE_GRUNT, 1
- copyobjectxytoperm 1
+ copyobjectxytoperm LOCALID_GRUNT
msgbox SeafloorCavern_Entrance_Text_HearMagmaNearMossdeep, MSGBOX_DEFAULT
closemessage
- applymovement 1, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_GRUNT, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
releaseall
end
@@ -43,23 +45,23 @@ SeafloorCavern_Entrance_EventScript_GruntSpeechShort:: @ 82344ED
call_if_eq SeafloorCavern_Entrance_EventScript_GruntFacePlayerNorth
msgbox SeafloorCavern_Entrance_Text_HearMagmaNearMossdeepShort, MSGBOX_DEFAULT
closemessage
- applymovement 1, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_GRUNT, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
releaseall
end
SeafloorCavern_Entrance_EventScript_GruntFacePlayerEast:: @ 8234523
- applymovement 1, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_GRUNT, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
return
SeafloorCavern_Entrance_EventScript_GruntFacePlayerWest:: @ 823452E
- applymovement 1, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_GRUNT, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
return
SeafloorCavern_Entrance_EventScript_GruntFacePlayerNorth:: @ 8234539
- applymovement 1, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_GRUNT, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
diff --git a/data/maps/SeafloorCavern_Room9/scripts.inc b/data/maps/SeafloorCavern_Room9/scripts.inc
index 64ed3ab7c..667251936 100644
--- a/data/maps/SeafloorCavern_Room9/scripts.inc
+++ b/data/maps/SeafloorCavern_Room9/scripts.inc
@@ -1,12 +1,19 @@
+.set LOCALID_KYOGRE, 1
+.set LOCALID_ARCHIE, 2
+.set LOCALID_MAXIE, 3
+.set LOCALID_GRUNT_1, 4
+.set LOCALID_GRUNT_2, 5
+.set LOCALID_KYOGRE_SLEEPING, 7
+
SeafloorCavern_Room9_MapScripts:: @ 8234DC8
.byte 0
SeafloorCavern_Room9_EventScript_ArchieAwakenKyogre:: @ 8234DC9
lockall
- setvar VAR_0x8004, 2 @ Archie
- setvar VAR_0x8005, 3 @ Maxie
- setvar VAR_0x8006, 4 @ Magma grunt 1
- setvar VAR_0x8007, 5 @ Magma grunt 2
+ setvar VAR_0x8004, LOCALID_ARCHIE
+ setvar VAR_0x8005, LOCALID_MAXIE
+ setvar VAR_0x8006, LOCALID_GRUNT_1
+ setvar VAR_0x8007, LOCALID_GRUNT_2
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, SeafloorCavern_Room9_Movement_Delay32
@@ -48,11 +55,11 @@ SeafloorCavern_Room9_EventScript_ArchieAwakenKyogre:: @ 8234DC9
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
delay 150
- removeobject 7 @ sleeping Kyogre
- addobject 1 @ awakened Kyogre
+ removeobject LOCALID_KYOGRE_SLEEPING
+ addobject LOCALID_KYOGRE
waitstate
delay 60
- applymovement 1, SeafloorCavern_Room9_Movement_KyogreApproach
+ applymovement LOCALID_KYOGRE, SeafloorCavern_Room9_Movement_KyogreApproach
waitmovement 0
special FadeOutOrbEffect
waitstate
@@ -62,9 +69,9 @@ SeafloorCavern_Room9_EventScript_ArchieAwakenKyogre:: @ 8234DC9
setvar VAR_0x8007, 5 @ shake delay
special ShakeCamera
waitstate
- applymovement 1, SeafloorCavern_Room9_Movement_KyogreExit
+ applymovement LOCALID_KYOGRE, SeafloorCavern_Room9_Movement_KyogreExit
waitmovement 0
- removeobject 1
+ removeobject LOCALID_KYOGRE
delay 4
setvar VAR_0x8004, 2 @ vertical pan
setvar VAR_0x8005, 2 @ horizontal pan
@@ -73,10 +80,10 @@ SeafloorCavern_Room9_EventScript_ArchieAwakenKyogre:: @ 8234DC9
special ShakeCamera
waitstate
delay 30
- setvar VAR_0x8004, 2
- setvar VAR_0x8005, 3
- setvar VAR_0x8006, 4
- setvar VAR_0x8007, 5
+ setvar VAR_0x8004, LOCALID_ARCHIE
+ setvar VAR_0x8005, LOCALID_MAXIE
+ setvar VAR_0x8006, LOCALID_GRUNT_1
+ setvar VAR_0x8007, LOCALID_GRUNT_2
msgbox SeafloorCavern_Room9_Text_ArchieWhereDidKyogreGo, MSGBOX_DEFAULT
playse SE_PC_LOGIN
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
diff --git a/data/maps/SkyPillar_Outside/scripts.inc b/data/maps/SkyPillar_Outside/scripts.inc
index 545a8126c..60a1702ab 100644
--- a/data/maps/SkyPillar_Outside/scripts.inc
+++ b/data/maps/SkyPillar_Outside/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_WALLACE, 1
+
SkyPillar_Outside_MapScripts:: @ 82392A8
map_script MAP_SCRIPT_ON_TRANSITION, SkyPillar_Outside_OnTransition
map_script MAP_SCRIPT_ON_LOAD, SkyPillar_Outside_OnLoad
@@ -34,7 +36,7 @@ SkyPillar_Outside_OnFrame: @ 82392FA
SkyPillar_Outside_EventScript_WallaceScene:: @ 8239304
lockall
- applymovement 1, SkyPillar_Outside_Movement_WallaceApproachPlayer
+ applymovement LOCALID_WALLACE, SkyPillar_Outside_Movement_WallaceApproachPlayer
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
@@ -51,7 +53,7 @@ SkyPillar_Outside_EventScript_WallaceScene:: @ 8239304
msgbox SkyPillar_Outside_Text_EarthquakeNotMomentToWaste, MSGBOX_DEFAULT
closemessage
applymovement OBJ_EVENT_ID_PLAYER, SkyPillar_Outside_Movement_PlayerClimbSkyPillar
- applymovement 1, SkyPillar_Outside_Movement_WallaceClimbSkyPillar
+ applymovement LOCALID_WALLACE, SkyPillar_Outside_Movement_WallaceClimbSkyPillar
waitmovement 0
setvar VAR_0x8004, 1 @ vertical pan
setvar VAR_0x8005, 3 @ horizontal pan
@@ -60,13 +62,13 @@ SkyPillar_Outside_EventScript_WallaceScene:: @ 8239304
special ShakeCamera
waitstate
delay 20
- applymovement 1, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_WALLACE, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
delay 10
- applymovement 1, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_WALLACE, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
delay 20
- applymovement 1, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_WALLACE, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
delay 30
msgbox SkyPillar_Outside_Text_SituationGettingWorse, MSGBOX_DEFAULT
@@ -83,7 +85,7 @@ SkyPillar_Outside_EventScript_WallaceScene:: @ 8239304
fadescreenswapbuffers FADE_TO_BLACK
clearflag FLAG_HIDE_MAP_NAME_POPUP
setvar VAR_SOOTOPOLIS_CITY_STATE, 4
- removeobject 1
+ removeobject LOCALID_WALLACE
clearflag FLAG_HIDE_SOOTOPOLIS_CITY_WALLACE
fadescreenswapbuffers FADE_FROM_BLACK
releaseall
diff --git a/data/maps/SkyPillar_Top/scripts.inc b/data/maps/SkyPillar_Top/scripts.inc
index 422ec2d1a..b8173bc69 100644
--- a/data/maps/SkyPillar_Top/scripts.inc
+++ b/data/maps/SkyPillar_Top/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_RAYQUAZA_SLEEPING, 1
+
SkyPillar_Top_MapScripts:: @ 82396B8
map_script MAP_SCRIPT_ON_RESUME, SkyPillar_Top_OnResume
map_script MAP_SCRIPT_ON_TRANSITION, SkyPillar_Top_OnTransition
@@ -24,7 +26,7 @@ SkyPillar_Top_OnTransition: @ 82396E6
SkyPillar_Top_EventScript_SetCleanLayout:: @ 82396FD
setmaplayoutindex LAYOUT_SKY_PILLAR_TOP_CLEAN
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_DOWN
+ setobjectmovementtype LOCALID_RAYQUAZA_SLEEPING, MOVEMENT_TYPE_FACE_DOWN
return
SkyPillar_Top_EventScript_TryShowRayquaza:: @ 8239705
@@ -40,7 +42,7 @@ SkyPillar_Top_OnWarp: @ 8239713
.2byte 0
SkyPillar_Top_EventScript_RayquazaFaceDown:: @ 823971D
- turnobject 1, DIR_SOUTH
+ turnobject LOCALID_RAYQUAZA_SLEEPING, DIR_SOUTH
end
SkyPillar_Top_EventScript_Rayquaza:: @ 8239722
@@ -100,7 +102,7 @@ SkyPillar_Top_EventScript_AwakenRayquaza:: @ 823979A
applymovement OBJ_EVENT_ID_CAMERA, SkyPillar_Top_Movement_CameraPanUp
waitmovement 0
special RemoveCameraObject
- applymovement 1, SkyPillar_Top_Movement_RayquazaStir
+ applymovement LOCALID_RAYQUAZA_SLEEPING, SkyPillar_Top_Movement_RayquazaStir
waitmovement 0
waitse
playmoncry SPECIES_RAYQUAZA, 2
@@ -119,9 +121,9 @@ SkyPillar_Top_EventScript_AwakenRayquaza:: @ 823979A
special ShakeCamera
waitstate
waitmoncry
- applymovement 1, SkyPillar_Top_Movement_RayquazaFlyOff
+ applymovement LOCALID_RAYQUAZA_SLEEPING, SkyPillar_Top_Movement_RayquazaFlyOff
waitmovement 0
- removeobject 1
+ removeobject LOCALID_RAYQUAZA_SLEEPING
msgbox SkyPillar_Top_Text_RayquazaFlewOff, MSGBOX_DEFAULT
closemessage
delay 20
diff --git a/data/maps/SlateportCity/scripts.inc b/data/maps/SlateportCity/scripts.inc
index a9d10e297..055e13565 100644
--- a/data/maps/SlateportCity/scripts.inc
+++ b/data/maps/SlateportCity/scripts.inc
@@ -1,3 +1,24 @@
+.set LOCALID_FAT_MAN, 1
+.set LOCALID_MAN_1, 2
+.set LOCALID_RICH_BOY, 3
+.set LOCALID_GRUNT_1, 5
+.set LOCALID_COOK, 6
+.set LOCALID_OLD_WOMAN, 7
+.set LOCALID_GIRL, 8
+.set LOCALID_TY, 9
+.set LOCALID_GABBY, 10
+.set LOCALID_CAPT_STERN, 11
+.set LOCALID_GRUNT_2, 18
+.set LOCALID_GRUNT_3, 19
+.set LOCALID_GRUNT_4, 26
+.set LOCALID_GRUNT_5, 27
+.set LOCALID_GRUNT_6, 28
+.set LOCALID_GRUNT_7, 29
+.set LOCALID_GRUNT_8, 30
+.set LOCALID_GRUNT_9, 31
+.set LOCALID_GRUNT_11, 33
+.set LOCALID_SCOTT, 35
+
SlateportCity_MapScripts:: @ 81DCC61
map_script MAP_SCRIPT_ON_TRANSITION, SlateportCity_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, SlateportCity_OnFrame
@@ -19,20 +40,20 @@ SlateportCity_EventScript_EnterSlateport:: @ 81DCC8D
return
SlateportCity_EventScript_MovePeopleForSternInterview:: @ 81DCC99
- setobjectxyperm 11, 28, 13
- setobjectxyperm 7, 25, 13
- setobjectxyperm 3, 25, 14
- setobjectxyperm 6, 27, 16
- setobjectxyperm 8, 28, 16
- setobjectxyperm 1, 29, 16
- setobjectxyperm 2, 31, 14
- setobjectmovementtype 11, MOVEMENT_TYPE_FACE_DOWN
- setobjectmovementtype 7, MOVEMENT_TYPE_FACE_DOWN_AND_RIGHT
- setobjectmovementtype 3, MOVEMENT_TYPE_FACE_UP_AND_RIGHT
- setobjectmovementtype 6, MOVEMENT_TYPE_FACE_UP
- setobjectmovementtype 8, MOVEMENT_TYPE_FACE_UP
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_UP
- setobjectmovementtype 2, MOVEMENT_TYPE_FACE_LEFT
+ setobjectxyperm LOCALID_CAPT_STERN, 28, 13
+ setobjectxyperm LOCALID_OLD_WOMAN, 25, 13
+ setobjectxyperm LOCALID_RICH_BOY, 25, 14
+ setobjectxyperm LOCALID_COOK, 27, 16
+ setobjectxyperm LOCALID_GIRL, 28, 16
+ setobjectxyperm LOCALID_FAT_MAN, 29, 16
+ setobjectxyperm LOCALID_MAN_1, 31, 14
+ setobjectmovementtype LOCALID_CAPT_STERN, MOVEMENT_TYPE_FACE_DOWN
+ setobjectmovementtype LOCALID_OLD_WOMAN, MOVEMENT_TYPE_FACE_DOWN_AND_RIGHT
+ setobjectmovementtype LOCALID_RICH_BOY, MOVEMENT_TYPE_FACE_UP_AND_RIGHT
+ setobjectmovementtype LOCALID_COOK, MOVEMENT_TYPE_FACE_UP
+ setobjectmovementtype LOCALID_GIRL, MOVEMENT_TYPE_FACE_UP
+ setobjectmovementtype LOCALID_FAT_MAN, MOVEMENT_TYPE_FACE_UP
+ setobjectmovementtype LOCALID_MAN_1, MOVEMENT_TYPE_FACE_LEFT
return
SlateportCity_EventScript_SetReadyForScottScene:: @ 81DCCE7
@@ -40,13 +61,13 @@ SlateportCity_EventScript_SetReadyForScottScene:: @ 81DCCE7
getplayerxy VAR_0x8004, VAR_0x8005
compare VAR_0x8004, 30
goto_if_eq SlateportCity_EventScript_MoveScottLeft
- setobjectxyperm 35, 23, 27
- setobjectmovementtype 35, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_SCOTT, 23, 27
+ setobjectmovementtype LOCALID_SCOTT, MOVEMENT_TYPE_FACE_RIGHT
return
SlateportCity_EventScript_MoveScottLeft:: @ 81DCD06
- setobjectxyperm 35, 22, 27
- setobjectmovementtype 35, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_SCOTT, 22, 27
+ setobjectmovementtype LOCALID_SCOTT, MOVEMENT_TYPE_FACE_RIGHT
return
SlateportCity_OnFrame: @ 81DCD12
@@ -55,17 +76,17 @@ SlateportCity_OnFrame: @ 81DCD12
SlateportCity_EventScript_ScottScene:: @ 81DCD1C
lockall
- addobject 35
+ addobject LOCALID_SCOTT
applymovement OBJ_EVENT_ID_PLAYER, SlateportCity_Movement_PlayerFaceScott
- applymovement 35, SlateportCity_Movement_ScottApproachPlayer
+ applymovement LOCALID_SCOTT, SlateportCity_Movement_ScottApproachPlayer
waitmovement 0
msgbox SlateportCity_Text_YouDroveTeamAquaAway, MSGBOX_DEFAULT
closemessage
- applymovement 35, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_SCOTT, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
delay 60
msgbox SlateportCity_Text_MaybeThisTrainer, MSGBOX_DEFAULT
- applymovement 35, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_SCOTT, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
msgbox SlateportCity_Text_LetsRegisterEachOther, MSGBOX_DEFAULT
closemessage
@@ -78,11 +99,11 @@ SlateportCity_EventScript_ScottScene:: @ 81DCD1C
setflag FLAG_ENABLE_SCOTT_MATCH_CALL
msgbox SlateportCity_Text_KeepEyeOnTrainersBeSeeingYou, MSGBOX_DEFAULT
closemessage
- applymovement 35, SlateportCity_Movement_ScottExit
+ applymovement LOCALID_SCOTT, SlateportCity_Movement_ScottExit
waitmovement 0
- removeobject 35
- setobjectxyperm 35, 10, 12
- setobjectmovementtype 35, MOVEMENT_TYPE_FACE_DOWN
+ removeobject LOCALID_SCOTT
+ setobjectxyperm LOCALID_SCOTT, 10, 12
+ setobjectmovementtype LOCALID_SCOTT, MOVEMENT_TYPE_FACE_DOWN
clearflag FLAG_HIDE_MAP_NAME_POPUP
setvar VAR_SLATEPORT_OUTSIDE_MUSEUM_STATE, 2
addvar VAR_SCOTT_STATE, 1
@@ -360,7 +381,7 @@ SlateportCity_EventScript_AquaGrunt1:: @ 81DD009
faceplayer
msgbox SlateportCity_Text_QuitPushing, MSGBOX_DEFAULT
closemessage
- applymovement 5, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_GRUNT_1, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -370,7 +391,7 @@ SlateportCity_EventScript_AquaGrunt2:: @ 81DD020
faceplayer
msgbox SlateportCity_Text_AquaHasPolicy, MSGBOX_DEFAULT
closemessage
- applymovement 18, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_GRUNT_2, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -380,7 +401,7 @@ SlateportCity_EventScript_AquaGrunt3:: @ 81DD037
faceplayer
msgbox SlateportCity_Text_BossIsBrilliant, MSGBOX_DEFAULT
closemessage
- applymovement 19, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_GRUNT_3, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -390,7 +411,7 @@ SlateportCity_EventScript_AquaGrunt4:: @ 81DD04E
faceplayer
msgbox SlateportCity_Text_WhatsNewSchemeIWonder, MSGBOX_DEFAULT
closemessage
- applymovement 26, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_GRUNT_4, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -400,7 +421,7 @@ SlateportCity_EventScript_AquaGrunt5:: @ 81DD065
faceplayer
msgbox SlateportCity_Text_ShouldTakeItAll, MSGBOX_DEFAULT
closemessage
- applymovement 27, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_GRUNT_5, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -410,7 +431,7 @@ SlateportCity_EventScript_AquaGrunt6:: @ 81DD07C
faceplayer
msgbox SlateportCity_Text_DontButtIn, MSGBOX_DEFAULT
closemessage
- applymovement 28, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_GRUNT_6, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -420,7 +441,7 @@ SlateportCity_EventScript_AquaGrunt7:: @ 81DD093
faceplayer
msgbox SlateportCity_Text_RemindsMeOfLongLineForGames, MSGBOX_DEFAULT
closemessage
- applymovement 29, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_GRUNT_7, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -430,7 +451,7 @@ SlateportCity_EventScript_AquaGrunt8:: @ 81DD0AA
faceplayer
msgbox SlateportCity_Text_WhyAreWeLiningUp, MSGBOX_DEFAULT
closemessage
- applymovement 30, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_GRUNT_8, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -439,31 +460,31 @@ SlateportCity_EventScript_AquaGrunt9:: @ 81DD0C1
lock
faceplayer
playse SE_PIN
- applymovement 31, Common_Movement_ExclamationMark
+ applymovement LOCALID_GRUNT_9, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 31, Common_Movement_Delay48
+ applymovement LOCALID_GRUNT_9, Common_Movement_Delay48
waitmovement 0
msgbox SlateportCity_Text_WhatDoYouWant, MSGBOX_DEFAULT
closemessage
- applymovement 31, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_GRUNT_9, Common_Movement_FaceOriginalDirection
waitmovement 0
- applymovement 31, SlateportCity_Movement_DelayAquaGrunt
+ applymovement LOCALID_GRUNT_9, SlateportCity_Movement_DelayAquaGrunt
waitmovement 0
- applymovement 31, Common_Movement_FacePlayer
+ applymovement LOCALID_GRUNT_9, Common_Movement_FacePlayer
waitmovement 0
msgbox SlateportCity_Text_IllReadSignForYou, MSGBOX_DEFAULT
closemessage
- applymovement 31, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_GRUNT_9, Common_Movement_FaceOriginalDirection
waitmovement 0
- applymovement 31, SlateportCity_Movement_DelayAquaGrunt
+ applymovement LOCALID_GRUNT_9, SlateportCity_Movement_DelayAquaGrunt
waitmovement 0
msgbox SlateportCity_Text_SaysSomethingLikeSeaIsEndless, MSGBOX_DEFAULT
closemessage
- applymovement 31, Common_Movement_FacePlayer
+ applymovement LOCALID_GRUNT_9, Common_Movement_FacePlayer
waitmovement 0
- applymovement 31, SlateportCity_Movement_DelayAquaGrunt
+ applymovement LOCALID_GRUNT_9, SlateportCity_Movement_DelayAquaGrunt
waitmovement 0
- applymovement 31, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_GRUNT_9, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -482,7 +503,7 @@ SlateportCity_EventScript_AquaGrunt11:: @ 81DD153
faceplayer
msgbox SlateportCity_Text_HotSpringsAfterOperation, MSGBOX_DEFAULT
closemessage
- applymovement 33, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_GRUNT_11, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -565,48 +586,48 @@ SlateportCity_EventScript_CaptStern:: @ 81DD1F8
msgbox SlateportCity_Text_SternMoveAheadWithExploration, MSGBOX_DEFAULT
msgbox SlateportCity_Text_GabbyWonderfulThanksForInterview, MSGBOX_DEFAULT
closemessage
- applymovement 10, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_GABBY, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
delay 10
- applymovement 9, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_TY, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
delay 25
- applymovement 11, SlateportCity_Movement_SternWatchGabbyAndTyExit
+ applymovement LOCALID_CAPT_STERN, SlateportCity_Movement_SternWatchGabbyAndTyExit
applymovement OBJ_EVENT_ID_PLAYER, SlateportCity_Movement_PlayerFaceStern
- applymovement 10, SlateportCity_Movement_GabbyExit
- applymovement 9, SlateportCity_Movement_TyExit
+ applymovement LOCALID_GABBY, SlateportCity_Movement_GabbyExit
+ applymovement LOCALID_TY, SlateportCity_Movement_TyExit
waitmovement 0
- removeobject 10
- removeobject 9
+ removeobject LOCALID_GABBY
+ removeobject LOCALID_TY
msgbox SlateportCity_Text_SternWhewFirstInterview, MSGBOX_DEFAULT
- applymovement 11, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_CAPT_STERN, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
msgbox SlateportCity_Text_OhPlayerWeMadeDiscovery, MSGBOX_DEFAULT
playbgm MUS_AQA_0, 0
msgbox SlateportCity_Text_AquaWillAssumeControlOfSubmarine, MSGBOX_DEFAULT
- applymovement 6, Common_Movement_WalkInPlaceFastestLeft
- applymovement 1, Common_Movement_WalkInPlaceFastestLeft
- applymovement 7, SlateportCity_Movement_OldWomanConcern
- applymovement 3, Common_Movement_QuestionMark
- applymovement 2, SlateportCity_Movement_ManConcern
+ applymovement LOCALID_COOK, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_FAT_MAN, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_OLD_WOMAN, SlateportCity_Movement_OldWomanConcern
+ applymovement LOCALID_RICH_BOY, Common_Movement_QuestionMark
+ applymovement LOCALID_MAN_1, SlateportCity_Movement_ManConcern
waitmovement 0
- applymovement 11, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_CAPT_STERN, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
msgbox SlateportCity_Text_SternWhatWasAllThat, MSGBOX_DEFAULT
playse SE_PIN
- applymovement 11, Common_Movement_ExclamationMark
+ applymovement LOCALID_CAPT_STERN, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 11, Common_Movement_Delay48
+ applymovement LOCALID_CAPT_STERN, Common_Movement_Delay48
waitmovement 0
- applymovement 11, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_CAPT_STERN, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
msgbox SlateportCity_Text_FromHarborTryingToTakeSub, MSGBOX_DEFAULT
msgbox SlateportCity_Text_PleaseComeWithMe, MSGBOX_DEFAULT
closemessage
- applymovement 11, SlateportCity_Movement_SternEnterHarbor
+ applymovement LOCALID_CAPT_STERN, SlateportCity_Movement_SternEnterHarbor
applymovement OBJ_EVENT_ID_PLAYER, SlateportCity_Movement_PlayerEnterHarbor
waitmovement 0
- removeobject 11
+ removeobject LOCALID_CAPT_STERN
clearflag FLAG_HIDE_SLATEPORT_CITY_HARBOR_CAPTAIN_STERN
clearflag FLAG_HIDE_SLATEPORT_CITY_HARBOR_SUBMARINE_SHADOW
clearflag FLAG_HIDE_SLATEPORT_CITY_HARBOR_AQUA_GRUNT
@@ -891,18 +912,18 @@ SlateportCity_EventScript_ScottBattleTentScene:: @ 81DD5DC
waitmovement 0
opendoor 10, 12
waitdooranim
- addobject 35
+ addobject LOCALID_SCOTT
applymovement OBJ_EVENT_ID_PLAYER, SlateportCity_Movement_PushPlayerDown
- applymovement 35, SlateportCity_Movement_ScottExitBattleTent
+ applymovement LOCALID_SCOTT, SlateportCity_Movement_ScottExitBattleTent
waitmovement 0
closedoor 10, 12
waitdooranim
msgbox SlateportCity_Text_TakingBattleTentChallenge, MSGBOX_DEFAULT
closemessage
applymovement OBJ_EVENT_ID_PLAYER, SlateportCity_Movement_PlayerWatchScottExit
- applymovement 35, SlateportCity_Movement_ScottExitAfterBattleTent
+ applymovement LOCALID_SCOTT, SlateportCity_Movement_ScottExitAfterBattleTent
waitmovement 0
- removeobject 35
+ removeobject LOCALID_SCOTT
addvar VAR_SCOTT_STATE, 1
setvar VAR_SLATEPORT_OUTSIDE_MUSEUM_STATE, 3
releaseall
diff --git a/data/maps/SlateportCity_BattleTentBattleRoom/scripts.inc b/data/maps/SlateportCity_BattleTentBattleRoom/scripts.inc
index f67c6f081..e642a1386 100644
--- a/data/maps/SlateportCity_BattleTentBattleRoom/scripts.inc
+++ b/data/maps/SlateportCity_BattleTentBattleRoom/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_OPPONENT, 2
+.set LOCALID_PLAYER, 3
+
SlateportCity_BattleTentBattleRoom_MapScripts:: @ 8209960
map_script MAP_SCRIPT_ON_TRANSITION, SlateportCity_BattleTentBattleRoom_OnTransition
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, SlateportCity_BattleTentBattleRoom_OnWarp
@@ -5,7 +8,7 @@ SlateportCity_BattleTentBattleRoom_MapScripts:: @ 8209960
.byte 0
@ On this map the player (OBJ_EVENT_ID_PLAYER) is hidden
- @ The player is represented instead by object event 3, which has the gfx id VAR_OBJ_GFX_ID_1
+ @ The player is represented instead by LOCALID_PLAYER, which has the gfx id VAR_OBJ_GFX_ID_1
SlateportCity_BattleTentBattleRoom_OnTransition: @ 8209970
call SlateportCity_BattleTentBattleRoom_EventScript_SetPlayerGfx
@@ -34,7 +37,7 @@ SlateportCity_BattleTentBattleRoom_OnWarp: @ 820999A
SlateportCity_BattleTentBattleRoom_EventScript_SetUpObjects:: @ 82099A4
setvar VAR_TEMP_1, 1
hideobjectat OBJ_EVENT_ID_PLAYER, MAP_FALLARBOR_TOWN_BATTLE_TENT_BATTLE_ROOM
- hideobjectat 2, MAP_SLATEPORT_CITY_BATTLE_TENT_BATTLE_ROOM
+ hideobjectat LOCALID_OPPONENT, MAP_SLATEPORT_CITY_BATTLE_TENT_BATTLE_ROOM
end
SlateportCity_BattleTentBattleRoom_OnFrame: @ 82099B4
@@ -42,13 +45,13 @@ SlateportCity_BattleTentBattleRoom_OnFrame: @ 82099B4
.2byte 0
SlateportCity_BattleTentBattleRoom_EventScript_EnterRoom:: @ 82099BE
- applymovement 3, SlateportCity_BattleTentBattleRoom_Movement_PlayerEnter
+ applymovement LOCALID_PLAYER, SlateportCity_BattleTentBattleRoom_Movement_PlayerEnter
waitmovement 0
factory_setopponentgfx
- setobjectxyperm 2, 5, 1
- removeobject 2
- addobject 2
- applymovement 2, SlateportCity_BattleTentBattleRoom_Movement_OpponentEnter
+ setobjectxyperm LOCALID_OPPONENT, 5, 1
+ removeobject LOCALID_OPPONENT
+ addobject LOCALID_OPPONENT
+ applymovement LOCALID_OPPONENT, SlateportCity_BattleTentBattleRoom_Movement_OpponentEnter
waitmovement 0
battletent_getopponentintro
lockall
diff --git a/data/maps/SlateportCity_BattleTentCorridor/scripts.inc b/data/maps/SlateportCity_BattleTentCorridor/scripts.inc
index 817e3eaba..85a95ded8 100644
--- a/data/maps/SlateportCity_BattleTentCorridor/scripts.inc
+++ b/data/maps/SlateportCity_BattleTentCorridor/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
SlateportCity_BattleTentCorridor_MapScripts:: @ 8208E26
map_script MAP_SCRIPT_ON_FRAME_TABLE, SlateportCity_BattleTentCorridor_OnFrame
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, SlateportCity_BattleTentCorridor_OnWarp
@@ -13,8 +15,8 @@ SlateportCity_BattleTentCorridor_EventScript_SetUpObjects:: @ 8208E3B
setvar VAR_TEMP_1, 1
compare VAR_0x8006, 1
goto_if_ne SlateportCity_BattleTentCorridor_EventScript_TurnPlayerNorth
- setobjectxy 1, 2, 2
- turnobject 1, DIR_SOUTH
+ setobjectxy LOCALID_ATTENDANT, 2, 2
+ turnobject LOCALID_ATTENDANT, DIR_SOUTH
SlateportCity_BattleTentCorridor_EventScript_TurnPlayerNorth:: @ 8208E56
turnobject OBJ_EVENT_ID_PLAYER, DIR_NORTH
end
@@ -27,7 +29,7 @@ SlateportCity_BattleTentCorridor_EventScript_EnterCorridor:: @ 8208E65
compare VAR_0x8006, 1
goto_if_eq SlateportCity_BattleTentCorridor_EventScript_ReturnToRoomFromBattle
setvar VAR_TEMP_0, 1
- applymovement 1, SlateportCity_BattleTentCorridor_Movement_AttendantEnter
+ applymovement LOCALID_ATTENDANT, SlateportCity_BattleTentCorridor_Movement_AttendantEnter
applymovement OBJ_EVENT_ID_PLAYER, SlateportCity_BattleTentCorridor_Movement_PlayerEnter
waitmovement 0
compare VAR_0x8006, 2
@@ -41,11 +43,11 @@ SlateportCity_BattleTentCorridor_EventScript_EnterCorridor:: @ 8208E65
SlateportCity_BattleTentCorridor_EventScript_EnterBattleRoom:: @ 8208EB4
msgbox BattleFrontier_BattleFactoryPreBattleRoom_Text_RightThisWay, MSGBOX_DEFAULT
closemessage
- applymovement 1, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_ATTENDANT, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
opendoor 2, 1
waitdooranim
- applymovement 1, SlateportCity_BattleTentCorridor_Movement_AttendantExit
+ applymovement LOCALID_ATTENDANT, SlateportCity_BattleTentCorridor_Movement_AttendantExit
applymovement OBJ_EVENT_ID_PLAYER, SlateportCity_BattleTentCorridor_Movement_PlayerExit
waitmovement 0
closedoor 2, 1
diff --git a/data/maps/SlateportCity_BattleTentLobby/scripts.inc b/data/maps/SlateportCity_BattleTentLobby/scripts.inc
index 811232e79..20f3c3e07 100644
--- a/data/maps/SlateportCity_BattleTentLobby/scripts.inc
+++ b/data/maps/SlateportCity_BattleTentLobby/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
SlateportCity_BattleTentLobby_MapScripts:: @ 8208730
map_script MAP_SCRIPT_ON_FRAME_TABLE, SlateportCity_BattleTentLobby_OnFrame
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, SlateportCity_BattleTentLobby_OnWarp
@@ -138,12 +140,12 @@ SlateportCity_BattleTentLobby_EventScript_EnterChallenge:: @ 82089AC
end
SlateportCity_BattleTentLobby_EventScript_WalkToDoor:: @ 82089C9
- applymovement 1, SlateportCity_BattleTentLobby_Movement_AttendantWalkToDoor
+ applymovement LOCALID_ATTENDANT, SlateportCity_BattleTentLobby_Movement_AttendantWalkToDoor
applymovement OBJ_EVENT_ID_PLAYER, SlateportCity_BattleTentLobby_Movement_PlayerWalkToDoor
waitmovement 0
opendoor 6, 1
waitdooranim
- applymovement 1, SlateportCity_BattleTentLobby_Movement_AttendantEnterDoor
+ applymovement LOCALID_ATTENDANT, SlateportCity_BattleTentLobby_Movement_AttendantEnterDoor
applymovement OBJ_EVENT_ID_PLAYER, SlateportCity_BattleTentLobby_Movement_PlayerEnterDoor
waitmovement 0
closedoor 6, 1
diff --git a/data/maps/SlateportCity_Harbor/scripts.inc b/data/maps/SlateportCity_Harbor/scripts.inc
index e195485b2..5d8dad1db 100644
--- a/data/maps/SlateportCity_Harbor/scripts.inc
+++ b/data/maps/SlateportCity_Harbor/scripts.inc
@@ -1,3 +1,9 @@
+.set LOCALID_CAPT_STERN, 4
+.set LOCALID_SS_TIDAL, 5
+.set LOCALID_GRUNT, 6
+.set LOCALID_ARCHIE, 7
+.set LOCALID_SUBMARINE, 8
+
SlateportCity_Harbor_MapScripts:: @ 820C97D
map_script MAP_SCRIPT_ON_TRANSITION, SlateportCity_Harbor_OnTransition
.byte 0
@@ -16,8 +22,8 @@ SlateportCity_Harbor_EventScript_ShowSSTidal:: @ 820C9A5
SlateportCity_Harbor_EventScript_ReadyAquaEscapeScene:: @ 820C9A9
savebgm MUS_AQA_0
- setobjectxyperm 4, 12, 13
- setobjectmovementtype 4, MOVEMENT_TYPE_FACE_LEFT
+ setobjectxyperm LOCALID_CAPT_STERN, 12, 13
+ setobjectmovementtype LOCALID_CAPT_STERN, MOVEMENT_TYPE_FACE_LEFT
setflag FLAG_HIDE_SLATEPORT_CITY_HARBOR_PATRONS
return
@@ -48,20 +54,20 @@ SlateportCity_Harbor_EventScript_AquaEscapeTrigger3:: @ 820C9DF
end
SlateportCity_Harbor_EventScript_AquaEscapeScene:: @ 820C9F5
- applymovement 7, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_ARCHIE, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
- applymovement 6, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_GRUNT, Common_Movement_WalkInPlaceFastestDown
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
msgbox SlateportCity_Harbor_Text_ArchieYouAgainHideoutInLilycove, MSGBOX_DEFAULT
closemessage
- applymovement 6, SlateportCity_Harbor_Movement_AquaBoardSub
- applymovement 7, SlateportCity_Harbor_Movement_AquaBoardSub
- applymovement 8, SlateportCity_Harbor_Movement_SubmarineExit
+ applymovement LOCALID_GRUNT, SlateportCity_Harbor_Movement_AquaBoardSub
+ applymovement LOCALID_ARCHIE, SlateportCity_Harbor_Movement_AquaBoardSub
+ applymovement LOCALID_SUBMARINE, SlateportCity_Harbor_Movement_SubmarineExit
waitmovement 0
- removeobject 6
- removeobject 7
- removeobject 8
+ removeobject LOCALID_GRUNT
+ removeobject LOCALID_ARCHIE
+ removeobject LOCALID_SUBMARINE
setvar VAR_SLATEPORT_HARBOR_STATE, 2
setflag FLAG_MET_TEAM_AQUA_HARBOR
setflag FLAG_HIDE_LILCOVE_MOTEL_SCOTT
@@ -77,27 +83,27 @@ SlateportCity_Harbor_EventScript_AquaEscapeScene:: @ 820C9F5
closemessage
setflag FLAG_HIDE_AQUA_HIDEOUT_1F_GRUNT_1_BLOCKING_ENTRANCE
setflag FLAG_HIDE_AQUA_HIDEOUT_1F_GRUNT_2_BLOCKING_ENTRANCE
- copyobjectxytoperm 4
- setobjectmovementtype 4, MOVEMENT_TYPE_FACE_RIGHT
+ copyobjectxytoperm LOCALID_CAPT_STERN
+ setobjectmovementtype LOCALID_CAPT_STERN, MOVEMENT_TYPE_FACE_RIGHT
releaseall
end
SlateportCity_Harbor_EventScript_SternApproachPlayer0:: @ 820CA89
- applymovement 4, SlateportCity_Harbor_Movement_SternApproachPlayer0
+ applymovement LOCALID_CAPT_STERN, SlateportCity_Harbor_Movement_SternApproachPlayer0
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
return
SlateportCity_Harbor_EventScript_SternApproachPlayer1:: @ 820CA9E
- applymovement 4, SlateportCity_Harbor_Movement_SternApproachPlayer1
+ applymovement LOCALID_CAPT_STERN, SlateportCity_Harbor_Movement_SternApproachPlayer1
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
return
SlateportCity_Harbor_EventScript_SternApproachPlayer:: @ 820CAB3
- applymovement 4, SlateportCity_Harbor_Movement_SternApproachPlayer
+ applymovement LOCALID_CAPT_STERN, SlateportCity_Harbor_Movement_SternApproachPlayer
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
@@ -238,7 +244,7 @@ SlateportCity_Harbor_EventScript_BoardFerry:: @ 820CBE9
call_if_eq SlateportCity_Harbor_EventScript_BoardFerryEast
delay 30
hideobjectat OBJ_EVENT_ID_PLAYER, 0
- setvar VAR_0x8004, 5
+ setvar VAR_0x8004, LOCALID_SS_TIDAL
call Common_EventScript_FerryDepart
return
diff --git a/data/maps/SlateportCity_OceanicMuseum_1F/scripts.inc b/data/maps/SlateportCity_OceanicMuseum_1F/scripts.inc
index 81b4c2008..8af4af40c 100644
--- a/data/maps/SlateportCity_OceanicMuseum_1F/scripts.inc
+++ b/data/maps/SlateportCity_OceanicMuseum_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_FAMILIAR_GRUNT, 13
+
SlateportCity_OceanicMuseum_1F_MapScripts:: @ 820AD95
.byte 0
@@ -33,7 +35,7 @@ SlateportCity_OceanicMuseum_1F_EventScript_PayEntranceFee:: @ 820ADC1
SlateportCity_OceanicMuseum_1F_EventScript_CheckMoneyForFee:: @ 820ADE8
checkmoney 50, 0
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq SlateportCity_OceanicMuseum_1F_EventScript_NotEnoughMoney
playse SE_REGI
removemoney 50, 0
@@ -146,9 +148,9 @@ SlateportCity_OceanicMuseum_1F_EventScript_FamiliarGrunt:: @ 820AEF8
faceplayer
delay 8
playse SE_PIN
- applymovement 13, Common_Movement_ExclamationMark
+ applymovement LOCALID_FAMILIAR_GRUNT, Common_Movement_ExclamationMark
waitmovement 0
- applymovement 13, Common_Movement_Delay48
+ applymovement LOCALID_FAMILIAR_GRUNT, Common_Movement_Delay48
waitmovement 0
msgbox SlateportCity_OceanicMuseum_1F_Text_RememberMeTakeThis, MSGBOX_DEFAULT
giveitem ITEM_TM46
@@ -169,20 +171,20 @@ SlateportCity_OceanicMuseum_1F_EventScript_FamiliarGrunt:: @ 820AEF8
SlateportCity_OceanicMuseum_1F_EventScript_FamiliarGruntExitNorth:: @ 820AF6C
applymovement OBJ_EVENT_ID_PLAYER, SlateportCity_OceanicMuseum_1F_Movement_PlayerWatchGruntExitNorth
- applymovement 13, SlateportCity_OceanicMuseum_1F_Movement_FamiliarGruntExitNorth
+ applymovement LOCALID_FAMILIAR_GRUNT, SlateportCity_OceanicMuseum_1F_Movement_FamiliarGruntExitNorth
waitmovement 0
goto SlateportCity_OceanicMuseum_1F_EventScript_FamiliarGruntExited
end
SlateportCity_OceanicMuseum_1F_EventScript_FamiliarGruntExitSouth:: @ 820AF83
- applymovement 13, SlateportCity_OceanicMuseum_1F_Movement_FamiliarGruntExit
+ applymovement LOCALID_FAMILIAR_GRUNT, SlateportCity_OceanicMuseum_1F_Movement_FamiliarGruntExit
waitmovement 0
goto SlateportCity_OceanicMuseum_1F_EventScript_FamiliarGruntExited
end
SlateportCity_OceanicMuseum_1F_EventScript_FamiliarGruntExitWestEast:: @ 820AF93
applymovement OBJ_EVENT_ID_PLAYER, SlateportCity_OceanicMuseum_1F_Movement_PlayerWatchGruntExitWestEast
- applymovement 13, SlateportCity_OceanicMuseum_1F_Movement_FamiliarGruntExit
+ applymovement LOCALID_FAMILIAR_GRUNT, SlateportCity_OceanicMuseum_1F_Movement_FamiliarGruntExit
waitmovement 0
goto SlateportCity_OceanicMuseum_1F_EventScript_FamiliarGruntExited
end
@@ -190,7 +192,7 @@ SlateportCity_OceanicMuseum_1F_EventScript_FamiliarGruntExitWestEast:: @ 820AF93
SlateportCity_OceanicMuseum_1F_EventScript_FamiliarGruntExited:: @ 820AFAA
setflag FLAG_HIDE_SLATEPORT_CITY_OCEANIC_MUSEUM_FAMILIAR_AQUA_GRUNT
playse SE_KAIDAN
- removeobject 13
+ removeobject LOCALID_FAMILIAR_GRUNT
release
end
diff --git a/data/maps/SlateportCity_OceanicMuseum_2F/scripts.inc b/data/maps/SlateportCity_OceanicMuseum_2F/scripts.inc
index 885c512a3..8efd464c4 100644
--- a/data/maps/SlateportCity_OceanicMuseum_2F/scripts.inc
+++ b/data/maps/SlateportCity_OceanicMuseum_2F/scripts.inc
@@ -1,3 +1,8 @@
+.set LOCALID_CAPT_STERN, 1
+.set LOCALID_ARCHIE, 2
+.set LOCALID_GRUNT_1, 3
+.set LOCALID_GRUNT_2, 4
+
SlateportCity_OceanicMuseum_2F_MapScripts:: @ 820BAFF
.byte 0
@@ -7,14 +12,14 @@ SlateportCity_OceanicMuseum_2F_EventScript_CaptStern:: @ 820BB00
msgbox SlateportCity_OceanicMuseum_2F_Text_ThankYouForTheParts, MSGBOX_DEFAULT
closemessage
playbgm MUS_AQA_0, 1
- addobject 3
- applymovement 3, SlateportCity_OceanicMuseum_2F_Movement_FirstGruntEnter
+ addobject LOCALID_GRUNT_1
+ applymovement LOCALID_GRUNT_1, SlateportCity_OceanicMuseum_2F_Movement_FirstGruntEnter
waitmovement 0
- addobject 4
- applymovement 4, SlateportCity_OceanicMuseum_2F_Movement_SecondGruntEnter
+ addobject LOCALID_GRUNT_2
+ applymovement LOCALID_GRUNT_2, SlateportCity_OceanicMuseum_2F_Movement_SecondGruntEnter
waitmovement 0
- applymovement 3, SlateportCity_OceanicMuseum_2F_Movement_FirstGruntApproach
- applymovement 4, SlateportCity_OceanicMuseum_2F_Movement_SecondGruntApproach
+ applymovement LOCALID_GRUNT_1, SlateportCity_OceanicMuseum_2F_Movement_FirstGruntApproach
+ applymovement LOCALID_GRUNT_2, SlateportCity_OceanicMuseum_2F_Movement_SecondGruntApproach
waitmovement 0
compare VAR_FACING, DIR_SOUTH
call_if_eq SlateportCity_OceanicMuseum_2F_EventScript_PlayerFaceGrunts
@@ -26,7 +31,7 @@ SlateportCity_OceanicMuseum_2F_EventScript_CaptStern:: @ 820BB00
msgbox SlateportCity_OceanicMuseum_2F_Text_SternWhoAreYou, MSGBOX_DEFAULT
msgbox SlateportCity_OceanicMuseum_2F_Text_WereTeamAqua, MSGBOX_DEFAULT
closemessage
- applymovement 4, SlateportCity_OceanicMuseum_2F_Movement_GruntApproachToBattle
+ applymovement LOCALID_GRUNT_2, SlateportCity_OceanicMuseum_2F_Movement_GruntApproachToBattle
waitmovement 0
compare VAR_FACING, DIR_SOUTH
call_if_eq SlateportCity_OceanicMuseum_2F_EventScript_PlayerApproachGruntSouth
@@ -35,36 +40,36 @@ SlateportCity_OceanicMuseum_2F_EventScript_CaptStern:: @ 820BB00
trainerbattle_no_intro TRAINER_GRUNT_MUSEUM_1, SlateportCity_OceanicMuseum_2F_Text_Grunt1Defeat
msgbox SlateportCity_OceanicMuseum_2F_Text_BossGoingToBeFurious, MSGBOX_DEFAULT
closemessage
- applymovement 4, SlateportCity_OceanicMuseum_2F_Movement_GruntDefeated
+ applymovement LOCALID_GRUNT_2, SlateportCity_OceanicMuseum_2F_Movement_GruntDefeated
waitmovement 0
- applymovement 3, SlateportCity_OceanicMuseum_2F_Movement_GruntApproachToBattle
+ applymovement LOCALID_GRUNT_1, SlateportCity_OceanicMuseum_2F_Movement_GruntApproachToBattle
waitmovement 0
msgbox SlateportCity_OceanicMuseum_2F_Text_LetMeTakeCareOfThis, MSGBOX_DEFAULT
trainerbattle_no_intro TRAINER_GRUNT_MUSEUM_2, SlateportCity_OceanicMuseum_2F_Text_Grunt2Defeat
- applymovement 3, SlateportCity_OceanicMuseum_2F_Movement_GruntDefeated
+ applymovement LOCALID_GRUNT_1, SlateportCity_OceanicMuseum_2F_Movement_GruntDefeated
waitmovement 0
- applymovement 3, Common_Movement_WalkInPlaceFastestDown
- applymovement 4, Common_Movement_WalkInPlaceFastestUp
+ applymovement LOCALID_GRUNT_1, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_GRUNT_2, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
msgbox SlateportCity_OceanicMuseum_2F_Text_MeddlingKid, MSGBOX_DEFAULT
closemessage
delay 35
- addobject 2
- applymovement 2, SlateportCity_OceanicMuseum_2F_Movement_ArchieEnter
- applymovement 4, SlateportCity_OceanicMuseum_2F_Movement_GruntMoveForArchie
+ addobject LOCALID_ARCHIE
+ applymovement LOCALID_ARCHIE, SlateportCity_OceanicMuseum_2F_Movement_ArchieEnter
+ applymovement LOCALID_GRUNT_2, SlateportCity_OceanicMuseum_2F_Movement_GruntMoveForArchie
waitmovement 0
msgbox SlateportCity_OceanicMuseum_2F_Text_CameToSeeWhatsTakingSoLong, MSGBOX_DEFAULT
closemessage
- applymovement 2, SlateportCity_OceanicMuseum_2F_Movement_ArchieApproachPlayer
+ applymovement LOCALID_ARCHIE, SlateportCity_OceanicMuseum_2F_Movement_ArchieApproachPlayer
waitmovement 0
msgbox SlateportCity_OceanicMuseum_2F_Text_ArchieWarning, MSGBOX_DEFAULT
closemessage
savebgm MUS_DUMMY
fadedefaultbgm
fadescreen FADE_TO_BLACK
- removeobject 2
- removeobject 3
- removeobject 4
+ removeobject LOCALID_ARCHIE
+ removeobject LOCALID_GRUNT_1
+ removeobject LOCALID_GRUNT_2
fadescreen FADE_FROM_BLACK
delay 30
setflag FLAG_HIDE_SLATEPORT_CITY_OCEANIC_MUSEUM_AQUA_GRUNTS
@@ -79,7 +84,7 @@ SlateportCity_OceanicMuseum_2F_EventScript_CaptStern:: @ 820BB00
playfanfare MUS_ME_ASA
waitfanfare
special HealPlayerParty
- removeobject 1
+ removeobject LOCALID_CAPT_STERN
setflag FLAG_HIDE_ROUTE_110_TEAM_AQUA
compare VAR_REGISTER_BIRCH_STATE, 0
call_if_eq SlateportCity_OceanicMuseum_2F_EventScript_ReadyRegisterBirch
@@ -101,7 +106,7 @@ SlateportCity_OceanicMuseum_2F_EventScript_PlayerFaceGrunts:: @ 820BC92
return
SlateportCity_OceanicMuseum_2F_EventScript_SternFaceGrunts:: @ 820BC9D
- applymovement 1, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_CAPT_STERN, Common_Movement_WalkInPlaceFastestLeft
waitmovement 0
return
diff --git a/data/maps/SlateportCity_PokemonCenter_1F/scripts.inc b/data/maps/SlateportCity_PokemonCenter_1F/scripts.inc
index ba4319cba..e6b1acea8 100644
--- a/data/maps/SlateportCity_PokemonCenter_1F/scripts.inc
+++ b/data/maps/SlateportCity_PokemonCenter_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_NURSE, 1
+
SlateportCity_PokemonCenter_1F_MapScripts:: @ 820DABF
map_script MAP_SCRIPT_ON_TRANSITION, SlateportCity_PokemonCenter_1F_OnTransition
map_script MAP_SCRIPT_ON_RESUME, CableClub_OnResume
@@ -8,9 +10,8 @@ SlateportCity_PokemonCenter_1F_OnTransition: @ 820DACA
call Common_EventScript_UpdateBrineyLocation
end
-@ VAR_0x800B is the Nurse's object event id
SlateportCity_PokemonCenter_1F_EventScript_Nurse:: @ 820DAD3
- setvar VAR_0x800B, 1
+ setvar VAR_0x800B, LOCALID_NURSE
call Common_EventScript_PkmnCenterNurse
waitmessage
waitbuttonpress
diff --git a/data/maps/SlateportCity_SternsShipyard_1F/scripts.inc b/data/maps/SlateportCity_SternsShipyard_1F/scripts.inc
index 4939f5407..8c65f9592 100644
--- a/data/maps/SlateportCity_SternsShipyard_1F/scripts.inc
+++ b/data/maps/SlateportCity_SternsShipyard_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_DOCK, 1
+
SlateportCity_SternsShipyard_1F_MapScripts:: @ 8207F3F
.byte 0
@@ -8,11 +10,11 @@ SlateportCity_SternsShipyard_1F_EventScript_Dock:: @ 8207F40
goto_if_set FLAG_DELIVERED_DEVON_GOODS, SlateportCity_SternsShipyard_1F_EventScript_NeedVeteran
goto_if_set FLAG_DOCK_REJECTED_DEVON_GOODS, SlateportCity_SternsShipyard_1F_EventScript_GoFindStern
msgbox SlateportCity_SternsShipyard_1F_Text_CantMakeHeadsOrTails, MSGBOX_DEFAULT
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_DOCK, Common_Movement_FacePlayer
waitmovement 0
msgbox SlateportCity_SternsShipyard_1F_Text_MeetDockDeliverToStern, MSGBOX_DEFAULT
closemessage
- applymovement 1, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_DOCK, Common_Movement_FaceOriginalDirection
waitmovement 0
setflag FLAG_DOCK_REJECTED_DEVON_GOODS
setflag FLAG_HIDE_SLATEPORT_CITY_TEAM_AQUA
@@ -20,31 +22,31 @@ SlateportCity_SternsShipyard_1F_EventScript_Dock:: @ 8207F40
end
SlateportCity_SternsShipyard_1F_EventScript_FerryReady:: @ 8207F92
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_DOCK, Common_Movement_FacePlayer
waitmovement 0
msgbox SlateportCity_SternsShipyard_1F_Text_FerryIsReady, MSGBOX_DEFAULT
releaseall
end
SlateportCity_SternsShipyard_1F_EventScript_BrineyJoined:: @ 8207FA6
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_DOCK, Common_Movement_FacePlayer
waitmovement 0
msgbox SlateportCity_SternsShipyard_1F_Text_BrineyJoinedUs, MSGBOX_DEFAULT
releaseall
end
SlateportCity_SternsShipyard_1F_EventScript_GoFindStern:: @ 8207FBA
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_DOCK, Common_Movement_FacePlayer
waitmovement 0
msgbox SlateportCity_SternsShipyard_1F_Text_CouldYouFindStern, MSGBOX_DEFAULT
closemessage
- applymovement 1, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_DOCK, Common_Movement_FaceOriginalDirection
waitmovement 0
releaseall
end
SlateportCity_SternsShipyard_1F_EventScript_NeedVeteran:: @ 8207FD9
- applymovement 1, Common_Movement_FacePlayer
+ applymovement LOCALID_DOCK, Common_Movement_FacePlayer
waitmovement 0
msgbox SlateportCity_SternsShipyard_1F_Text_CouldUseAdviceFromVeteran, MSGBOX_DEFAULT
releaseall
diff --git a/data/maps/SootopolisCity/scripts.inc b/data/maps/SootopolisCity/scripts.inc
index a973a0429..2979f104d 100644
--- a/data/maps/SootopolisCity/scripts.inc
+++ b/data/maps/SootopolisCity/scripts.inc
@@ -1,3 +1,21 @@
+.set LOCALID_EXPERT, 1
+.set LOCALID_WOMAN_2, 2
+.set LOCALID_KIRI, 3
+.set LOCALID_NINJA_BOY, 4
+.set LOCALID_BOY_1, 5
+.set LOCALID_STEVEN, 7
+.set LOCALID_WOMAN_1, 8
+.set LOCALID_GROUDON, 9
+.set LOCALID_KYOGRE, 10
+.set LOCALID_RAYQUAZA, 11
+.set LOCALID_MANIAC, 12
+.set LOCALID_GIRL, 13
+.set LOCALID_BLACK_BELT, 14
+.set LOCALID_BOY_2, 15
+.set LOCALID_MAXIE, 16
+.set LOCALID_ARCHIE, 17
+.set LOCALID_WALLACE, 18
+
SootopolisCity_MapScripts:: @ 81E565C
map_script MAP_SCRIPT_ON_LOAD, SootopolisCity_OnLoad
map_script MAP_SCRIPT_ON_TRANSITION, SootopolisCity_OnTransition
@@ -66,14 +84,14 @@ SootopolisCity_EventScript_HideMapNamePopup:: @ 81E5781
return
SootopolisCity_EventScript_SetBattleSpectators:: @ 81E5785
- setobjectxyperm 3, 13, 48
- setobjectxyperm 5, 46, 32
- setobjectxyperm 4, 48, 41
- setobjectxyperm 8, 45, 43
- setobjectmovementtype 3, MOVEMENT_TYPE_FACE_UP
- setobjectmovementtype 5, MOVEMENT_TYPE_FACE_LEFT
- setobjectmovementtype 4, MOVEMENT_TYPE_FACE_LEFT
- setobjectmovementtype 8, MOVEMENT_TYPE_FACE_LEFT
+ setobjectxyperm LOCALID_KIRI, 13, 48
+ setobjectxyperm LOCALID_BOY_1, 46, 32
+ setobjectxyperm LOCALID_NINJA_BOY, 48, 41
+ setobjectxyperm LOCALID_WOMAN_1, 45, 43
+ setobjectmovementtype LOCALID_KIRI, MOVEMENT_TYPE_FACE_UP
+ setobjectmovementtype LOCALID_BOY_1, MOVEMENT_TYPE_FACE_LEFT
+ setobjectmovementtype LOCALID_NINJA_BOY, MOVEMENT_TYPE_FACE_LEFT
+ setobjectmovementtype LOCALID_WOMAN_1, MOVEMENT_TYPE_FACE_LEFT
return
SootopolisCity_EventScript_SetLayout:: @ 81E57B2
@@ -125,21 +143,21 @@ SootopolisCity_EventScript_CheckSetEnterCaveOfOriginObjPos:: @ 81E5842
return
SootopolisCity_EventScript_SetEnterCaveOfOriginObjPos:: @ 81E584C
- setobjectxyperm 1, 30, 18 @ Expert
- setobjectxyperm 7, 32, 18 @ Steven
+ setobjectxyperm LOCALID_EXPERT, 30, 18
+ setobjectxyperm LOCALID_STEVEN, 32, 18
return
SootopolisCity_EventScript_SetExitCaveOfOriginObjPos:: @ 81E585B
- setobjectxyperm 1, 30, 18 @ Expert
- setobjectxyperm 18, 31, 18 @ Wallace
- setobjectxyperm 7, 32, 18 @ Steven
+ setobjectxyperm LOCALID_EXPERT, 30, 18
+ setobjectxyperm LOCALID_WALLACE, 31, 18
+ setobjectxyperm LOCALID_STEVEN, 32, 18
end
SootopolisCity_EventScript_SetOutsideGymObjPos:: @ 81E5871
- setobjectxyperm 1, 31, 18 @ Expert
- setobjectxyperm 7, 29, 33 @ Steven
- setobjectxyperm 16, 33, 35 @ Maxie
- setobjectxyperm 17, 34, 35 @ Archie
+ setobjectxyperm LOCALID_EXPERT, 31, 18
+ setobjectxyperm LOCALID_STEVEN, 29, 33
+ setobjectxyperm LOCALID_MAXIE, 33, 35
+ setobjectxyperm LOCALID_ARCHIE, 34, 35
compare VAR_SOOTOPOLIS_WALLACE_STATE, 0
call_if_eq SootopolisCity_EventScript_SetWallaceMiddle
compare VAR_SOOTOPOLIS_WALLACE_STATE, 1
@@ -149,22 +167,22 @@ SootopolisCity_EventScript_SetOutsideGymObjPos:: @ 81E5871
return
SootopolisCity_EventScript_SetWallaceMiddle:: @ 81E58AF
- setobjectxyperm 18, 31, 33
- setobjectmovementtype 18, MOVEMENT_TYPE_FACE_DOWN
+ setobjectxyperm LOCALID_WALLACE, 31, 33
+ setobjectmovementtype LOCALID_WALLACE, MOVEMENT_TYPE_FACE_DOWN
return
SootopolisCity_EventScript_SetWallaceRight:: @ 81E58BB
- setobjectxyperm 18, 32, 33
- setobjectmovementtype 18, MOVEMENT_TYPE_FACE_DOWN
+ setobjectxyperm LOCALID_WALLACE, 32, 33
+ setobjectmovementtype LOCALID_WALLACE, MOVEMENT_TYPE_FACE_DOWN
return
SootopolisCity_EventScript_SetWallaceLeft:: @ 81E58C7
- setobjectxyperm 18, 30, 33
- setobjectmovementtype 18, MOVEMENT_TYPE_FACE_DOWN
+ setobjectxyperm LOCALID_WALLACE, 30, 33
+ setobjectmovementtype LOCALID_WALLACE, MOVEMENT_TYPE_FACE_DOWN
return
SootopolisCity_EventScript_SetExpertBlockCaveEntrance:: @ 81E58D3
- setobjectxyperm 1, 31, 18 @ Expert
+ setobjectxyperm LOCALID_EXPERT, 31, 18
return
SootopolisCity_OnWarp: @ 81E58DB
@@ -220,14 +238,14 @@ SootopolisCity_EventScript_LegendariesSceneFromPokeCenter:: @ 81E5946
setvar VAR_0x8004, 0
special Script_DoRayquazaScene
waitstate
- applymovement 10, Common_Movement_WalkInPlaceFastestLeft
- applymovement 9, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_KYOGRE, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_GROUDON, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
delay 60
waitse
playmoncry SPECIES_KYOGRE, 2
- applymovement 10, SootopolisCity_Movement_KyogreAttack
- applymovement 9, SootopolisCity_Movement_GroudonDefend
+ applymovement LOCALID_KYOGRE, SootopolisCity_Movement_KyogreAttack
+ applymovement LOCALID_GROUDON, SootopolisCity_Movement_GroudonDefend
waitmovement 0
setvar VAR_0x8004, 1 @ vertical pan
setvar VAR_0x8005, 1 @ horizontal pan
@@ -235,13 +253,13 @@ SootopolisCity_EventScript_LegendariesSceneFromPokeCenter:: @ 81E5946
setvar VAR_0x8007, 5 @ shake delay
special ShakeCamera
waitstate
- applymovement 10, SootopolisCity_Movement_KyogreMoveBack
- applymovement 9, SootopolisCity_Movement_GroudonMoveBack
+ applymovement LOCALID_KYOGRE, SootopolisCity_Movement_KyogreMoveBack
+ applymovement LOCALID_GROUDON, SootopolisCity_Movement_GroudonMoveBack
waitmovement 0
waitse
playmoncry SPECIES_GROUDON, 2
- applymovement 10, SootopolisCity_Movement_GroudonAttack
- applymovement 9, SootopolisCity_Movement_KyogreDefend
+ applymovement LOCALID_KYOGRE, SootopolisCity_Movement_GroudonAttack
+ applymovement LOCALID_GROUDON, SootopolisCity_Movement_KyogreDefend
waitmovement 0
setvar VAR_0x8004, 1 @ vertical pan
setvar VAR_0x8005, 1 @ horizontal pan
@@ -249,13 +267,13 @@ SootopolisCity_EventScript_LegendariesSceneFromPokeCenter:: @ 81E5946
setvar VAR_0x8007, 5 @ shake delay
special ShakeCamera
waitstate
- applymovement 10, SootopolisCity_Movement_KyogreMoveBack
- applymovement 9, SootopolisCity_Movement_GroudonMoveBack
+ applymovement LOCALID_KYOGRE, SootopolisCity_Movement_KyogreMoveBack
+ applymovement LOCALID_GROUDON, SootopolisCity_Movement_GroudonMoveBack
waitmovement 0
waitse
playmoncry SPECIES_KYOGRE, 2
- applymovement 10, SootopolisCity_Movement_KyogreAttack
- applymovement 9, SootopolisCity_Movement_GroudonDefend
+ applymovement LOCALID_KYOGRE, SootopolisCity_Movement_KyogreAttack
+ applymovement LOCALID_GROUDON, SootopolisCity_Movement_GroudonDefend
waitmovement 0
setvar VAR_0x8004, 1 @ vertical pan
setvar VAR_0x8005, 1 @ horizontal pan
@@ -263,12 +281,12 @@ SootopolisCity_EventScript_LegendariesSceneFromPokeCenter:: @ 81E5946
setvar VAR_0x8007, 5 @ shake delay
special ShakeCamera
waitstate
- applymovement 10, SootopolisCity_Movement_KyogreMoveBack
- applymovement 9, SootopolisCity_Movement_GroudonMoveBack
+ applymovement LOCALID_KYOGRE, SootopolisCity_Movement_KyogreMoveBack
+ applymovement LOCALID_GROUDON, SootopolisCity_Movement_GroudonMoveBack
waitmovement 0
special SpawnCameraObject
- applymovement 10, SootopolisCity_Movement_KyogreIdle
- applymovement 9, SootopolisCity_Movement_GroudonIdle
+ applymovement LOCALID_KYOGRE, SootopolisCity_Movement_KyogreIdle
+ applymovement LOCALID_GROUDON, SootopolisCity_Movement_GroudonIdle
applymovement OBJ_EVENT_ID_CAMERA, SootopolisCity_Movement_PanBackToPokeCenter
waitmovement 0
special RemoveCameraObject
@@ -320,14 +338,14 @@ SootopolisCity_EventScript_LegendariesSceneFromDive:: @ 81E5A82
setvar VAR_0x8004, 0
special Script_DoRayquazaScene
waitstate
- applymovement 10, Common_Movement_WalkInPlaceFastestLeft
- applymovement 9, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_KYOGRE, Common_Movement_WalkInPlaceFastestLeft
+ applymovement LOCALID_GROUDON, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
delay 60
waitse
playmoncry SPECIES_KYOGRE, 2
- applymovement 10, SootopolisCity_Movement_KyogreAttack
- applymovement 9, SootopolisCity_Movement_GroudonDefend
+ applymovement LOCALID_KYOGRE, SootopolisCity_Movement_KyogreAttack
+ applymovement LOCALID_GROUDON, SootopolisCity_Movement_GroudonDefend
waitmovement 0
setvar VAR_0x8004, 1 @ vertical pan
setvar VAR_0x8005, 1 @ horizontal pan
@@ -335,13 +353,13 @@ SootopolisCity_EventScript_LegendariesSceneFromDive:: @ 81E5A82
setvar VAR_0x8007, 5 @ shake delay
special ShakeCamera
waitstate
- applymovement 10, SootopolisCity_Movement_KyogreMoveBack
- applymovement 9, SootopolisCity_Movement_GroudonMoveBack
+ applymovement LOCALID_KYOGRE, SootopolisCity_Movement_KyogreMoveBack
+ applymovement LOCALID_GROUDON, SootopolisCity_Movement_GroudonMoveBack
waitmovement 0
waitse
playmoncry SPECIES_GROUDON, 2
- applymovement 10, SootopolisCity_Movement_GroudonAttack
- applymovement 9, SootopolisCity_Movement_KyogreDefend
+ applymovement LOCALID_KYOGRE, SootopolisCity_Movement_GroudonAttack
+ applymovement LOCALID_GROUDON, SootopolisCity_Movement_KyogreDefend
waitmovement 0
setvar VAR_0x8004, 1 @ vertical pan
setvar VAR_0x8005, 1 @ horizontal pan
@@ -349,13 +367,13 @@ SootopolisCity_EventScript_LegendariesSceneFromDive:: @ 81E5A82
setvar VAR_0x8007, 5 @ shake delay
special ShakeCamera
waitstate
- applymovement 10, SootopolisCity_Movement_KyogreMoveBack
- applymovement 9, SootopolisCity_Movement_GroudonMoveBack
+ applymovement LOCALID_KYOGRE, SootopolisCity_Movement_KyogreMoveBack
+ applymovement LOCALID_GROUDON, SootopolisCity_Movement_GroudonMoveBack
waitmovement 0
waitse
playmoncry SPECIES_KYOGRE, 2
- applymovement 10, SootopolisCity_Movement_KyogreAttack
- applymovement 9, SootopolisCity_Movement_GroudonDefend
+ applymovement LOCALID_KYOGRE, SootopolisCity_Movement_KyogreAttack
+ applymovement LOCALID_GROUDON, SootopolisCity_Movement_GroudonDefend
waitmovement 0
setvar VAR_0x8004, 1 @ vertical pan
setvar VAR_0x8005, 1 @ horizontal pan
@@ -363,12 +381,12 @@ SootopolisCity_EventScript_LegendariesSceneFromDive:: @ 81E5A82
setvar VAR_0x8007, 5 @ shake delay
special ShakeCamera
waitstate
- applymovement 10, SootopolisCity_Movement_KyogreMoveBack
- applymovement 9, SootopolisCity_Movement_GroudonMoveBack
+ applymovement LOCALID_KYOGRE, SootopolisCity_Movement_KyogreMoveBack
+ applymovement LOCALID_GROUDON, SootopolisCity_Movement_GroudonMoveBack
waitmovement 0
special SpawnCameraObject
- applymovement 10, SootopolisCity_Movement_KyogreIdle
- applymovement 9, SootopolisCity_Movement_GroudonIdle
+ applymovement LOCALID_KYOGRE, SootopolisCity_Movement_KyogreIdle
+ applymovement LOCALID_GROUDON, SootopolisCity_Movement_GroudonIdle
applymovement OBJ_EVENT_ID_CAMERA, SootopolisCity_Movement_PanBackToDive
waitmovement 0
special RemoveCameraObject
@@ -507,9 +525,9 @@ SootopolisCity_EventScript_RayquazaSceneFromPokeCenter:: @ 81E5C1E
delay 60
fadescreenspeed FADE_TO_BLACK, 8
call SootopolisCity_EventScript_SetRoughWater
- removeobject 9
- removeobject 10
- addobject 11
+ removeobject LOCALID_GROUDON
+ removeobject LOCALID_KYOGRE
+ addobject LOCALID_RAYQUAZA
setvar VAR_0x8004, 1
special Script_DoRayquazaScene
waitstate
@@ -536,9 +554,9 @@ SootopolisCity_EventScript_RayquazaSceneFromPokeCenter:: @ 81E5C1E
waitmoncry
setweather WEATHER_NONE
doweather
- applymovement 11, SootopolisCity_Movement_RayquazaFlyOff
+ applymovement LOCALID_RAYQUAZA, SootopolisCity_Movement_RayquazaFlyOff
waitmovement 0
- removeobject 11
+ removeobject LOCALID_RAYQUAZA
special WaitWeather
waitstate
clearflag FLAG_SYS_WEATHER_CTRL
@@ -560,9 +578,9 @@ SootopolisCity_EventScript_RayquazaSceneFromDive:: @ 81E5CCE
delay 60
fadescreenspeed FADE_TO_BLACK, 8
call SootopolisCity_EventScript_SetRoughWater
- removeobject 9
- removeobject 10
- addobject 11
+ removeobject LOCALID_GROUDON
+ removeobject LOCALID_KYOGRE
+ addobject LOCALID_RAYQUAZA
setvar VAR_0x8004, 1
special Script_DoRayquazaScene
waitstate
@@ -589,9 +607,9 @@ SootopolisCity_EventScript_RayquazaSceneFromDive:: @ 81E5CCE
waitmoncry
setweather WEATHER_NONE
doweather
- applymovement 11, SootopolisCity_Movement_RayquazaFlyOff
+ applymovement LOCALID_RAYQUAZA, SootopolisCity_Movement_RayquazaFlyOff
waitmovement 0
- removeobject 11
+ removeobject LOCALID_RAYQUAZA
special WaitWeather
waitstate
clearflag FLAG_SYS_WEATHER_CTRL
@@ -735,7 +753,7 @@ SootopolisCity_EventScript_Kiri:: @ 81E5ED8
goto_if_eq SootopolisCity_EventScript_KiriRayquaza
msgbox SootopolisCity_Text_BigPokemonFighting, MSGBOX_DEFAULT
closemessage
- applymovement 3, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_KIRI, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -798,13 +816,13 @@ SootopolisCity_EventScript_KiriLikeSeasonBornIn:: @ 81E5FD8
SootopolisCity_EventScript_Woman2:: @ 81E5FE2
lockall
- applymovement 2, Common_Movement_FacePlayer
+ applymovement LOCALID_WOMAN_2, Common_Movement_FacePlayer
waitmovement 0
compare VAR_SOOTOPOLIS_CITY_STATE, 5
goto_if_eq SootopolisCity_EventScript_Woman2Rayquaza
msgbox SootopolisCity_Text_WeatherWentWild, MSGBOX_DEFAULT
closemessage
- applymovement 2, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_WOMAN_2, Common_Movement_FaceOriginalDirection
waitmovement 0
releaseall
end
@@ -844,7 +862,7 @@ SootopolisCity_EventScript_Woman1:: @ 81E6038
SootopolisCity_EventScript_Woman1Legendaries:: @ 81E6065
msgbox SootopolisCity_Text_GiganticPokemonFight, MSGBOX_DEFAULT
closemessage
- applymovement 8, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_WOMAN_1, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -861,7 +879,7 @@ SootopolisCity_EventScript_Woman1Rayquaza:: @ 81E6084
SootopolisCity_EventScript_NinjaBoy:: @ 81E608E
lockall
- applymovement 4, Common_Movement_FacePlayer
+ applymovement LOCALID_NINJA_BOY, Common_Movement_FacePlayer
waitmovement 0
compare VAR_SOOTOPOLIS_CITY_STATE, 5
goto_if_eq SootopolisCity_EventScript_NinjaBoyRayquaza
@@ -871,7 +889,7 @@ SootopolisCity_EventScript_NinjaBoy:: @ 81E608E
goto_if_le SootopolisCity_EventScript_NinjaBoyNormal
msgbox SootopolisCity_Text_ThisIsWicked, MSGBOX_DEFAULT
closemessage
- applymovement 4, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_NINJA_BOY, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -888,7 +906,7 @@ SootopolisCity_EventScript_NinjaBoyRayquaza:: @ 81E60D9
SootopolisCity_EventScript_Boy1:: @ 81E60E3
lockall
- applymovement 5, Common_Movement_FacePlayer
+ applymovement LOCALID_BOY_1, Common_Movement_FacePlayer
waitmovement 0
compare VAR_SOOTOPOLIS_CITY_STATE, 5
goto_if_eq SootopolisCity_EventScript_Boy1Rayquaza
@@ -899,7 +917,7 @@ SootopolisCity_EventScript_Boy1:: @ 81E60E3
goto_if_le SootopolisCity_EventScript_Boy1Normal
msgbox SootopolisCity_Text_GiantPokemonSuddenlyAppeared, MSGBOX_DEFAULT
closemessage
- applymovement 5, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_BOY_1, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
@@ -933,7 +951,7 @@ EventScript_ClosedSootopolisDoor:: @ 81E615D
SootopolisCity_EventScript_Steven:: @ 81E6166
lockall
- applymovement 7, Common_Movement_FacePlayer
+ applymovement LOCALID_STEVEN, Common_Movement_FacePlayer
waitmovement 0
call_if_unset FLAG_STEVEN_GUIDES_TO_CAVE_OF_ORIGIN, SootopolisCity_EventScript_StevenLeadPlayerCaveOfOrigin
compare VAR_SOOTOPOLIS_CITY_STATE, 2
@@ -971,13 +989,13 @@ SootopolisCity_EventScript_StevenLeadPlayerCaveOfOrigin:: @ 81E61CC
call_if_eq SootopolisCity_EventScript_StartWalkToCaveOfOriginNorth
msgbox SootopolisCity_Text_DoesThisMakeYourFearPokemon, MSGBOX_DEFAULT
closemessage
- applymovement 7, SootopolisCity_Movement_StevenWalkToCaveOfOrigin
+ applymovement LOCALID_STEVEN, SootopolisCity_Movement_StevenWalkToCaveOfOrigin
applymovement OBJ_EVENT_ID_PLAYER, SootopolisCity_Movement_PlayerWalkToCaveOfOrigin
waitmovement 0
delay 120
- applymovement 1, SootopolisCity_Movement_ExpertMoveAside
+ applymovement LOCALID_EXPERT, SootopolisCity_Movement_ExpertMoveAside
waitmovement 0
- applymovement 7, SootopolisCity_Movement_StevenArriveCaveEntrance
+ applymovement LOCALID_STEVEN, SootopolisCity_Movement_StevenArriveCaveEntrance
applymovement OBJ_EVENT_ID_PLAYER, SootopolisCity_Movement_PlayerArriveCaveEntrance
waitmovement 0
msgbox SootopolisCity_Text_HereWereAreHelpWallace, MSGBOX_DEFAULT
@@ -990,13 +1008,13 @@ SootopolisCity_EventScript_StevenLeadPlayerCaveOfOrigin:: @ 81E61CC
end
SootopolisCity_EventScript_StartWalkToCaveOfOriginWest:: @ 81E6243
- applymovement 7, SootopolisCity_Movement_StevenStartWalkToCaveOfOrigin
+ applymovement LOCALID_STEVEN, SootopolisCity_Movement_StevenStartWalkToCaveOfOrigin
applymovement OBJ_EVENT_ID_PLAYER, SootopolisCity_Movement_PlayerStartWalkToCaveOfOriginWest
waitmovement 0
return
SootopolisCity_EventScript_StartWalkToCaveOfOriginNorth:: @ 81E6255
- applymovement 7, SootopolisCity_Movement_StevenStartWalkToCaveOfOrigin
+ applymovement LOCALID_STEVEN, SootopolisCity_Movement_StevenStartWalkToCaveOfOrigin
applymovement OBJ_EVENT_ID_PLAYER, SootopolisCity_Movement_PlayerStartWalkToCaveOfOriginNorth
waitmovement 0
return
@@ -1267,13 +1285,13 @@ SootopolisCity_Movement_PlayerEnterCaveOfOrigin: @ 81E635A
SootopolisCity_EventScript_Boy2:: @ 81E635D
lockall
- applymovement 15, Common_Movement_FacePlayer
+ applymovement LOCALID_BOY_2, Common_Movement_FacePlayer
waitmovement 0
compare VAR_SOOTOPOLIS_CITY_STATE, 5
goto_if_eq SootopolisCity_EventScript_Boy2Rayquaza
msgbox SootopolisCity_Text_TwoPokemonArentAngry, MSGBOX_DEFAULT
closemessage
- applymovement 15, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_BOY_2, Common_Movement_FaceOriginalDirection
waitmovement 0
releaseall
end
@@ -1290,17 +1308,17 @@ SootopolisCity_EventScript_BlackBelt:: @ 81E6393
goto_if_eq SootopolisCity_EventScript_BlackBeltRayquaza
msgbox SootopolisCity_Text_GoRedAndBlueMon, MSGBOX_DEFAULT
closemessage
- applymovement 14, Common_Movement_FacePlayer
+ applymovement LOCALID_BLACK_BELT, Common_Movement_FacePlayer
waitmovement 0
msgbox SootopolisCity_Text_DoYouKnowMonNames, MSGBOX_DEFAULT
closemessage
- applymovement 14, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_BLACK_BELT, Common_Movement_FaceOriginalDirection
waitmovement 0
releaseall
end
SootopolisCity_EventScript_BlackBeltRayquaza:: @ 81E63C7
- applymovement 14, Common_Movement_FacePlayer
+ applymovement LOCALID_BLACK_BELT, Common_Movement_FacePlayer
waitmovement 0
msgbox SootopolisCity_Text_GreenOneSettlesThings, MSGBOX_DEFAULT
releaseall
@@ -1308,13 +1326,13 @@ SootopolisCity_EventScript_BlackBeltRayquaza:: @ 81E63C7
SootopolisCity_EventScript_Girl:: @ 81E63DB
lockall
- applymovement 13, Common_Movement_FacePlayer
+ applymovement LOCALID_GIRL, Common_Movement_FacePlayer
waitmovement 0
compare VAR_SOOTOPOLIS_CITY_STATE, 5
goto_if_eq SootopolisCity_EventScript_GirlRayquaza
msgbox SootopolisCity_Text_SootopolisWillBeWrecked, MSGBOX_DEFAULT
closemessage
- applymovement 13, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_GIRL, Common_Movement_FaceOriginalDirection
waitmovement 0
releaseall
end
@@ -1327,13 +1345,13 @@ SootopolisCity_EventScript_GirlRayquaza:: @ 81E6406
SootopolisCity_EventScript_Maniac:: @ 81E6411
lockall
- applymovement 12, Common_Movement_FacePlayer
+ applymovement LOCALID_MANIAC, Common_Movement_FacePlayer
waitmovement 0
compare VAR_SOOTOPOLIS_CITY_STATE, 5
goto_if_eq SootopolisCity_EventScript_ManiacRayquaza
msgbox SootopolisCity_Text_SeeingLegendWithOwnEyes, MSGBOX_DEFAULT
closemessage
- applymovement 12, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_MANIAC, Common_Movement_FaceOriginalDirection
waitmovement 0
releaseall
end
@@ -1370,16 +1388,16 @@ SootopolisCity_EventScript_GiveWaterfall:: @ 81E646F
end
SootopolisCity_EventScript_WallaceMoveFromGym:: @ 81E64B2
- applymovement 18, SootopolisCity_Movement_WallaceMoveFromGym
+ applymovement LOCALID_WALLACE, SootopolisCity_Movement_WallaceMoveFromGym
waitmovement 0
- copyobjectxytoperm 18
+ copyobjectxytoperm LOCALID_WALLACE
setvar VAR_SOOTOPOLIS_WALLACE_STATE, 1
return
SootopolisCity_EventScript_WallaceMoveFromGymWest:: @ 81E64C5
- applymovement 18, SootopolisCity_Movement_WallaceMoveFromGymWest
+ applymovement LOCALID_WALLACE, SootopolisCity_Movement_WallaceMoveFromGymWest
waitmovement 0
- copyobjectxytoperm 18
+ copyobjectxytoperm LOCALID_WALLACE
setvar VAR_SOOTOPOLIS_WALLACE_STATE, 2
return
diff --git a/data/maps/SootopolisCity_Gym_1F/scripts.inc b/data/maps/SootopolisCity_Gym_1F/scripts.inc
index afb4845b3..66588ba08 100644
--- a/data/maps/SootopolisCity_Gym_1F/scripts.inc
+++ b/data/maps/SootopolisCity_Gym_1F/scripts.inc
@@ -121,7 +121,7 @@ SootopolisCity_Gym_1F_EventScript_JuanDefeated:: @ 8224F82
SootopolisCity_Gym_1F_EventScript_GiveWaterPulse:: @ 8224FD4
giveitem ITEM_TM03
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_BagIsFull
msgbox SootopolisCity_Gym_1F_Text_ExplainWaterPulse, MSGBOX_DEFAULT
setflag FLAG_RECEIVED_TM03
@@ -129,7 +129,7 @@ SootopolisCity_Gym_1F_EventScript_GiveWaterPulse:: @ 8224FD4
SootopolisCity_Gym_1F_EventScript_GiveWaterPulse2:: @ 8224FF7
giveitem ITEM_TM03
- compare VAR_RESULT, 0
+ compare VAR_RESULT, FALSE
goto_if_eq Common_EventScript_ShowBagIsFull
msgbox SootopolisCity_Gym_1F_Text_ExplainWaterPulse, MSGBOX_DEFAULT
setflag FLAG_RECEIVED_TM03
diff --git a/data/maps/SootopolisCity_MysteryEventsHouse_1F/scripts.inc b/data/maps/SootopolisCity_MysteryEventsHouse_1F/scripts.inc
index 96a28f2dd..30a755a0f 100644
--- a/data/maps/SootopolisCity_MysteryEventsHouse_1F/scripts.inc
+++ b/data/maps/SootopolisCity_MysteryEventsHouse_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_OLD_MAN, 1
+
SootopolisCity_MysteryEventsHouse_1F_MapScripts:: @ 8227953
map_script MAP_SCRIPT_ON_TRANSITION, SootopolisCity_MysteryEventsHouse_1F_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, SootopolisCity_MysteryEventsHouse_1F_OnFrame
@@ -13,14 +15,14 @@ SootopolisCity_MysteryEventsHouse_1F_OnTransition: @ 822795E
SootopolisCity_MysteryEventsHouse_1F_EventScript_SetTrainerVisitingLayout:: @ 822797D
setvar VAR_TEMP_1, 1
- setobjectxyperm 1, 3, 2
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_DOWN
+ setobjectxyperm LOCALID_OLD_MAN, 3, 2
+ setobjectmovementtype LOCALID_OLD_MAN, MOVEMENT_TYPE_FACE_DOWN
setmaplayoutindex LAYOUT_SOOTOPOLIS_CITY_MYSTERY_EVENTS_HOUSE_1F_STAIRS_UNBLOCKED
return
SootopolisCity_MysteryEventsHouse_1F_EventScript_MoveOldManToDoor:: @ 8227991
- setobjectxyperm 1, 2, 2
- setobjectmovementtype 1, MOVEMENT_TYPE_FACE_RIGHT
+ setobjectxyperm LOCALID_OLD_MAN, 2, 2
+ setobjectmovementtype LOCALID_OLD_MAN, MOVEMENT_TYPE_FACE_RIGHT
return
SootopolisCity_MysteryEventsHouse_1F_OnFrame: @ 822799D
@@ -33,9 +35,9 @@ SootopolisCity_MysteryEventsHouse_1F_EventScript_OldManCommentOnBattle:: @ 82279
lockall
applymovement OBJ_EVENT_ID_PLAYER, SootopolisCity_MysteryEventsHouse_1F_Movement_PlayerExitStairs
waitmovement 0
- applymovement 1, SootopolisCity_MysteryEventsHouse_1F_Movement_OldManWalkBehindPlayer
+ applymovement LOCALID_OLD_MAN, SootopolisCity_MysteryEventsHouse_1F_Movement_OldManWalkBehindPlayer
waitmovement 0
- copyobjectxytoperm 1
+ copyobjectxytoperm LOCALID_OLD_MAN
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
compare VAR_SOOTOPOLIS_MYSTERY_EVENTS_STATE, 1
diff --git a/data/maps/SootopolisCity_MysteryEventsHouse_B1F/scripts.inc b/data/maps/SootopolisCity_MysteryEventsHouse_B1F/scripts.inc
index 8ba872465..992cef5a3 100644
--- a/data/maps/SootopolisCity_MysteryEventsHouse_B1F/scripts.inc
+++ b/data/maps/SootopolisCity_MysteryEventsHouse_B1F/scripts.inc
@@ -22,11 +22,11 @@ SootopolisCity_MysteryEventsHouse_B1F_EventScript_BattleVisitingTrainer:: @ 8227
setvar VAR_0x8005, 0
special DoSpecialTrainerBattle
waitstate
- compare VAR_RESULT, 3
+ compare VAR_RESULT, B_OUTCOME_DREW
call_if_eq SootopolisCity_MysteryEventsHouse_B1F_EventScript_BattleTie
- compare VAR_RESULT, 1
+ compare VAR_RESULT, B_OUTCOME_WON
call_if_eq SootopolisCity_MysteryEventsHouse_B1F_EventScript_BattleWon
- compare VAR_RESULT, 2
+ compare VAR_RESULT, B_OUTCOME_LOST
call_if_eq SootopolisCity_MysteryEventsHouse_B1F_EventScript_BattleLost
closemessage
special HealPlayerParty
diff --git a/data/maps/SootopolisCity_PokemonCenter_1F/scripts.inc b/data/maps/SootopolisCity_PokemonCenter_1F/scripts.inc
index d8ff4e7f6..712fd166b 100644
--- a/data/maps/SootopolisCity_PokemonCenter_1F/scripts.inc
+++ b/data/maps/SootopolisCity_PokemonCenter_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_NURSE, 1
+
SootopolisCity_PokemonCenter_1F_MapScripts:: @ 82264F1
map_script MAP_SCRIPT_ON_TRANSITION, SootopolisCity_PokemonCenter_1F_OnTransition
map_script MAP_SCRIPT_ON_RESUME, CableClub_OnResume
@@ -7,9 +9,8 @@ SootopolisCity_PokemonCenter_1F_OnTransition: @ 82264FC
setrespawn HEAL_LOCATION_SOOTOPOLIS_CITY
end
-@ VAR_0x800B is the Nurse's object event id
SootopolisCity_PokemonCenter_1F_EventScript_Nurse:: @ 8226500
- setvar VAR_0x800B, 1
+ setvar VAR_0x800B, LOCALID_NURSE
call Common_EventScript_PkmnCenterNurse
waitmessage
waitbuttonpress
diff --git a/data/maps/SouthernIsland_Exterior/scripts.inc b/data/maps/SouthernIsland_Exterior/scripts.inc
index e47cbc8f1..1ba417120 100644
--- a/data/maps/SouthernIsland_Exterior/scripts.inc
+++ b/data/maps/SouthernIsland_Exterior/scripts.inc
@@ -1,3 +1,6 @@
+.set LOCALID_SAILOR, 1
+.set LOCALID_SS_TIDAL, 2
+
SouthernIsland_Exterior_MapScripts:: @ 82429C8
map_script MAP_SCRIPT_ON_TRANSITION, SouthernIsland_Exterior_OnTransition
.byte 0
@@ -17,8 +20,8 @@ SouthernIsland_Exterior_EventScript_Sailor:: @ 82429D2
applymovement VAR_LAST_TALKED, Common_Movement_WalkInPlaceFastestDown
waitmovement 0
delay 30
- hideobjectat 1, MAP_SOUTHERN_ISLAND_EXTERIOR
- setvar VAR_0x8004, 2
+ hideobjectat LOCALID_SAILOR, MAP_SOUTHERN_ISLAND_EXTERIOR
+ setvar VAR_0x8004, LOCALID_SS_TIDAL
call Common_EventScript_FerryDepartIsland
warp MAP_LILYCOVE_CITY_HARBOR, 255, 8, 11
waitstate
diff --git a/data/maps/SouthernIsland_Interior/scripts.inc b/data/maps/SouthernIsland_Interior/scripts.inc
index 486f00029..0dd8cc303 100644
--- a/data/maps/SouthernIsland_Interior/scripts.inc
+++ b/data/maps/SouthernIsland_Interior/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_LATI, 2
+
SouthernIsland_Interior_MapScripts:: @ 8242A45
map_script MAP_SCRIPT_ON_RESUME, SouthernIsland_Interior_OnResume
map_script MAP_SCRIPT_ON_TRANSITION, SouthernIsland_Interior_OnTransition
@@ -11,7 +13,7 @@ SouthernIsland_Interior_EventScript_TryRemoveLati:: @ 8242A5A
specialvar VAR_RESULT, GetBattleOutcome
compare VAR_RESULT, B_OUTCOME_CAUGHT
goto_if_ne Common_EventScript_NopReturn
- removeobject 2
+ removeobject LOCALID_LATI
return
SouthernIsland_Interior_OnTransition: @ 8242A6E
@@ -69,14 +71,14 @@ SouthernIsland_Interior_EventScript_Lati:: @ 8242AD0
playmoncry VAR_TEMP_4, 0
delay 30
waitmoncry
- addobject 2
+ addobject LOCALID_LATI
delay 30
applymovement OBJ_EVENT_ID_CAMERA, SouthernIsland_Interior_Movement_CameraPanDown
- applymovement 2, SouthernIsland_Interior_Movement_LatiApproach
+ applymovement LOCALID_LATI, SouthernIsland_Interior_Movement_LatiApproach
waitmovement 0
delay 50
special RemoveCameraObject
- setvar VAR_LAST_TALKED, 2
+ setvar VAR_LAST_TALKED, LOCALID_LATI
compare VAR_ROAMER_POKEMON, 0
call_if_eq SouthernIsland_Interior_EventScript_SetLatiosBattleVars
compare VAR_ROAMER_POKEMON, 0
diff --git a/data/maps/TerraCave_End/scripts.inc b/data/maps/TerraCave_End/scripts.inc
index 46af23e87..9683ca607 100644
--- a/data/maps/TerraCave_End/scripts.inc
+++ b/data/maps/TerraCave_End/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_GROUDON, 1
+
TerraCave_End_MapScripts:: @ 823B0B0
map_script MAP_SCRIPT_ON_RESUME, TerraCave_End_OnResume
map_script MAP_SCRIPT_ON_TRANSITION, TerraCave_End_OnTransition
@@ -11,7 +13,7 @@ TerraCave_End_EventScript_TryRemoveGroudon:: @ 823B0C5
specialvar VAR_RESULT, GetBattleOutcome
compare VAR_RESULT, B_OUTCOME_CAUGHT
goto_if_ne Common_EventScript_NopReturn
- removeobject 1
+ removeobject LOCALID_GROUDON
return
TerraCave_End_OnTransition: @ 823B0D9
@@ -27,13 +29,13 @@ TerraCave_End_EventScript_Groudon:: @ 823B0EC
lockall
applymovement OBJ_EVENT_ID_PLAYER, Common_Movement_FaceUp
waitmovement 0
- applymovement 1, TerraCave_End_Movement_GroudonApproach
+ applymovement LOCALID_GROUDON, TerraCave_End_Movement_GroudonApproach
waitmovement 0
waitse
playmoncry SPECIES_GROUDON, 2
delay 40
waitmoncry
- setvar VAR_LAST_TALKED, 1
+ setvar VAR_LAST_TALKED, LOCALID_GROUDON
setwildbattle SPECIES_GROUDON, 70, ITEM_NONE
setflag FLAG_SYS_CTRL_OBJ_DELETE
special BattleSetup_StartLegendaryBattle
diff --git a/data/maps/TrainerHill_Elevator/scripts.inc b/data/maps/TrainerHill_Elevator/scripts.inc
index c31056ad3..2b3400418 100644
--- a/data/maps/TrainerHill_Elevator/scripts.inc
+++ b/data/maps/TrainerHill_Elevator/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
TrainerHill_Elevator_MapScripts:: @ 826934F
map_script MAP_SCRIPT_ON_FRAME_TABLE, TrainerHill_Elevator_OnFrame
.byte 0
@@ -20,14 +22,14 @@ TrainerHill_Elevator_EventScript_ExitToRoof:: @ 8269360
TrainerHill_Elevator_EventScript_EnterElevator:: @ 8269375
applymovement OBJ_EVENT_ID_PLAYER, TrainerHill_Elevator_Movement_PlayerApproachAttendant
waitmovement 0
- applymovement 1, TrainerHill_Elevator_Movement_AttendantFacePlayer
+ applymovement LOCALID_ATTENDANT, TrainerHill_Elevator_Movement_AttendantFacePlayer
waitmovement 0
lockall
msgbox TrainerHill_Elevator_Text_ReturnToReception, MSGBOX_YESNO
compare VAR_RESULT, NO
goto_if_eq TrainerHill_Elevator_EventScript_ExitToRoof
releaseall
- applymovement 1, TrainerHill_Elevator_Movement_AttendantFaceDown
+ applymovement LOCALID_ATTENDANT, TrainerHill_Elevator_Movement_AttendantFaceDown
waitmovement 0
applymovement OBJ_EVENT_ID_PLAYER, TrainerHill_Elevator_Movement_PlayerMoveToCenterOfElevator
waitmovement 0
diff --git a/data/maps/TrainerHill_Entrance/scripts.inc b/data/maps/TrainerHill_Entrance/scripts.inc
index e1311b6d1..9cf3be806 100644
--- a/data/maps/TrainerHill_Entrance/scripts.inc
+++ b/data/maps/TrainerHill_Entrance/scripts.inc
@@ -1,3 +1,8 @@
+.set LOCALID_ATTENDANT, 1
+.set LOCALID_NURSE, 2
+.set LOCALID_GIRL, 4
+.set LOCALID_MAN, 5
+
TrainerHill_Entrance_MapScripts:: @ 82680AC
map_script MAP_SCRIPT_ON_RESUME, TrainerHill_Entrance_OnResume
map_script MAP_SCRIPT_ON_RETURN_TO_FIELD, TrainerHill_Entrance_OnReturn
@@ -36,10 +41,10 @@ TrainerHill_Entrance_EventScript_PlayerDontFaceAttendant:: @ 826811A
end
TrainerHill_Entrance_OnReturn: @ 826811B
- addobject 2
- addobject 1
- addobject 5
- addobject 4
+ addobject LOCALID_NURSE
+ addobject LOCALID_ATTENDANT
+ addobject LOCALID_MAN
+ addobject LOCALID_GIRL
end
TrainerHill_Entrance_OnLoad: @ 8268128
@@ -99,7 +104,7 @@ TrainerHill_Entrance_EventScript_EndExitChallenge:: @ 82681EE
end
TrainerHill_Entrance_EventScript_Nurse:: @ 82681EF
- setvar VAR_0x800B, 2
+ setvar VAR_0x800B, LOCALID_NURSE
call Common_EventScript_PkmnCenterNurse
waitmessage
waitbuttonpress
diff --git a/data/maps/UnionRoom/scripts.inc b/data/maps/UnionRoom/scripts.inc
index eac27fb5c..f25e7acb6 100644
--- a/data/maps/UnionRoom/scripts.inc
+++ b/data/maps/UnionRoom/scripts.inc
@@ -1,3 +1,12 @@
+.set LOCALID_UR_PLAYER_4, 2
+.set LOCALID_UR_PLAYER_8, 3
+.set LOCALID_UR_PLAYER_7, 4
+.set LOCALID_UR_PLAYER_6, 5
+.set LOCALID_UR_PLAYER_5, 6
+.set LOCALID_UR_PLAYER_3, 7
+.set LOCALID_UR_PLAYER_2, 8
+.set LOCALID_UR_PLAYER_1, 9
+
UnionRoom_MapScripts:: @ 823D1A6
map_script MAP_SCRIPT_ON_RESUME, UnionRoom_OnResume
map_script MAP_SCRIPT_ON_TRANSITION, UnionRoom_OnTransition
@@ -12,15 +21,15 @@ UnionRoom_OnResume: @ 823D1B1
setflag FLAG_HIDE_UNION_ROOM_PLAYER_6
setflag FLAG_HIDE_UNION_ROOM_PLAYER_7
setflag FLAG_HIDE_UNION_ROOM_PLAYER_8
- removeobject 9
- removeobject 8
- removeobject 7
- removeobject 2
- removeobject 6
- removeobject 5
- removeobject 4
- removeobject 3
- special UnionRoomSpecial
+ removeobject LOCALID_UR_PLAYER_1
+ removeobject LOCALID_UR_PLAYER_2
+ removeobject LOCALID_UR_PLAYER_3
+ removeobject LOCALID_UR_PLAYER_4
+ removeobject LOCALID_UR_PLAYER_5
+ removeobject LOCALID_UR_PLAYER_6
+ removeobject LOCALID_UR_PLAYER_7
+ removeobject LOCALID_UR_PLAYER_8
+ special RunUnionRoom
end
UnionRoom_OnTransition: @ 823D1E5
@@ -29,7 +38,7 @@ UnionRoom_OnTransition: @ 823D1E5
UnionRoom_EventScript_Player1:: @ 823D1E6
lock
faceplayer
- setvar VAR_RESULT, 1
+ setvar VAR_RESULT, UR_INTERACT_PLAYER_1
waitstate
release
end
@@ -37,7 +46,7 @@ UnionRoom_EventScript_Player1:: @ 823D1E6
UnionRoom_EventScript_Player2:: @ 823D1F0
lock
faceplayer
- setvar VAR_RESULT, 2
+ setvar VAR_RESULT, UR_INTERACT_PLAYER_2
waitstate
release
end
@@ -45,7 +54,7 @@ UnionRoom_EventScript_Player2:: @ 823D1F0
UnionRoom_EventScript_Player3:: @ 823D1FA
lock
faceplayer
- setvar VAR_RESULT, 3
+ setvar VAR_RESULT, UR_INTERACT_PLAYER_3
waitstate
release
end
@@ -53,7 +62,7 @@ UnionRoom_EventScript_Player3:: @ 823D1FA
UnionRoom_EventScript_Player4:: @ 823D204
lock
faceplayer
- setvar VAR_RESULT, 4
+ setvar VAR_RESULT, UR_INTERACT_PLAYER_4
waitstate
release
end
@@ -61,7 +70,7 @@ UnionRoom_EventScript_Player4:: @ 823D204
UnionRoom_EventScript_Player5:: @ 823D20E
lock
faceplayer
- setvar VAR_RESULT, 5
+ setvar VAR_RESULT, UR_INTERACT_PLAYER_5
waitstate
release
end
@@ -69,7 +78,7 @@ UnionRoom_EventScript_Player5:: @ 823D20E
UnionRoom_EventScript_Player6:: @ 823D218
lock
faceplayer
- setvar VAR_RESULT, 6
+ setvar VAR_RESULT, UR_INTERACT_PLAYER_6
waitstate
release
end
@@ -77,7 +86,7 @@ UnionRoom_EventScript_Player6:: @ 823D218
UnionRoom_EventScript_Player7:: @ 823D222
lock
faceplayer
- setvar VAR_RESULT, 7
+ setvar VAR_RESULT, UR_INTERACT_PLAYER_7
waitstate
release
end
@@ -85,7 +94,7 @@ UnionRoom_EventScript_Player7:: @ 823D222
UnionRoom_EventScript_Player8:: @ 823D22C
lock
faceplayer
- setvar VAR_RESULT, 8
+ setvar VAR_RESULT, UR_INTERACT_PLAYER_8
waitstate
release
end
@@ -93,14 +102,14 @@ UnionRoom_EventScript_Player8:: @ 823D22C
UnionRoom_EventScript_Attendant:: @ 823D236
lock
faceplayer
- setvar VAR_RESULT, 9
+ setvar VAR_RESULT, UR_INTERACT_ATTENDANT
waitstate
release
end
UnionRoom_EventScript_Unused:: @ 823D240
lockall
- setvar VAR_RESULT, 10
+ setvar VAR_RESULT, UR_INTERACT_UNUSED
waitstate
releaseall
end
diff --git a/data/maps/VerdanturfTown/scripts.inc b/data/maps/VerdanturfTown/scripts.inc
index 2f075346c..a419c3319 100644
--- a/data/maps/VerdanturfTown/scripts.inc
+++ b/data/maps/VerdanturfTown/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_TWIN, 2
+
VerdanturfTown_MapScripts:: @ 81EB566
map_script MAP_SCRIPT_ON_TRANSITION, VerdanturfTown_OnTransition
.byte 0
@@ -12,14 +14,14 @@ VerdanturfTown_EventScript_Twin:: @ 81EB575
faceplayer
goto_if_set FLAG_RUSTURF_TUNNEL_OPENED, VerdanturfTown_EventScript_TwinTunnelOpen
msgbox VerdanturfTown_Text_ManTryingToDigTunnel, MSGBOX_DEFAULT
- applymovement 2, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_TWIN, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
VerdanturfTown_EventScript_TwinTunnelOpen:: @ 81EB594
msgbox VerdanturfTown_Text_ManDugTunnelForLove, MSGBOX_DEFAULT
- applymovement 2, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_TWIN, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
diff --git a/data/maps/VerdanturfTown_BattleTentBattleRoom/scripts.inc b/data/maps/VerdanturfTown_BattleTentBattleRoom/scripts.inc
index 0e79fe8df..86b5f3ec1 100644
--- a/data/maps/VerdanturfTown_BattleTentBattleRoom/scripts.inc
+++ b/data/maps/VerdanturfTown_BattleTentBattleRoom/scripts.inc
@@ -1,3 +1,7 @@
+.set LOCALID_PLAYER, 1
+.set LOCALID_OPPONENT, 2
+.set LOCALID_ATTENDANT, 3
+
VerdanturfTown_BattleTentBattleRoom_MapScripts:: @ 82022FA
map_script MAP_SCRIPT_ON_TRANSITION, VerdanturfTown_BattleTentBattleRoom_OnTransition
map_script MAP_SCRIPT_ON_FRAME_TABLE, VerdanturfTown_BattleTentBattleRoom_OnFrame
@@ -35,16 +39,16 @@ VerdanturfTown_BattleTentBattleRoom_OnFrame: @ 820233E
.2byte 0
VerdanturfTown_BattleTentBattleRoom_EventScript_EnterRoom:: @ 8202348
- showobjectat 1, MAP_VERDANTURF_TOWN_BATTLE_TENT_BATTLE_ROOM
- applymovement 1, VerdanturfTown_BattleTentBattleRoom_Movement_PlayerEnter
+ showobjectat LOCALID_PLAYER, MAP_VERDANTURF_TOWN_BATTLE_TENT_BATTLE_ROOM
+ applymovement LOCALID_PLAYER, VerdanturfTown_BattleTentBattleRoom_Movement_PlayerEnter
waitmovement 0
frontier_get FRONTIER_DATA_BATTLE_NUM
compare VAR_RESULT, 0
goto_if_ne VerdanturfTown_BattleTentBattleRoom_EventScript_AskContinueChallenge
VerdanturfTown_BattleTentBattleRoom_EventScript_NextOpponentEnter:: @ 820236F
tower_setopponent
- addobject 2
- applymovement 2, VerdanturfTown_BattleTentBattleRoom_Movement_OpponentEnter
+ addobject LOCALID_OPPONENT
+ applymovement LOCALID_OPPONENT, VerdanturfTown_BattleTentBattleRoom_Movement_OpponentEnter
waitmovement 0
battletent_getopponentintro
msgbox gStringVar4, MSGBOX_DEFAULT
@@ -64,11 +68,11 @@ VerdanturfTown_BattleTentBattleRoom_EventScript_DefeatedOpponent:: @ 82023C8
frontier_set FRONTIER_DATA_BATTLE_NUM, VAR_RESULT
switch VAR_RESULT
case 3, VerdanturfTown_BattleTentBattleRoom_EventScript_WarpToLobbyWon
- applymovement 2, VerdanturfTown_BattleTentBattleRoom_Movement_OpponentExit
+ applymovement LOCALID_OPPONENT, VerdanturfTown_BattleTentBattleRoom_Movement_OpponentExit
waitmovement 0
- removeobject 2
- applymovement 3, Common_Movement_WalkInPlaceFastestDown
- applymovement 1, Common_Movement_WalkInPlaceFastestUp
+ removeobject LOCALID_OPPONENT
+ applymovement LOCALID_ATTENDANT, Common_Movement_WalkInPlaceFastestDown
+ applymovement LOCALID_PLAYER, Common_Movement_WalkInPlaceFastestUp
waitmovement 0
msgbox BattleFrontier_BattlePalaceBattleRoom_Text_LetMeRestoreYourMons, MSGBOX_DEFAULT
special LoadPlayerParty
@@ -107,8 +111,8 @@ VerdanturfTown_BattleTentBattleRoom_EventScript_AskRetireChallenge:: @ 82024B8
case MULTI_B_PRESSED, VerdanturfTown_BattleTentBattleRoom_EventScript_AskContinueChallenge
VerdanturfTown_BattleTentBattleRoom_EventScript_ContinueChallenge:: @ 82024EA
- applymovement 3, Common_Movement_WalkInPlaceFastestRight
- applymovement 1, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_ATTENDANT, Common_Movement_WalkInPlaceFastestRight
+ applymovement LOCALID_PLAYER, Common_Movement_WalkInPlaceFastestRight
waitmovement 0
closemessage
goto VerdanturfTown_BattleTentBattleRoom_EventScript_NextOpponentEnter
@@ -134,11 +138,11 @@ VerdanturfTown_BattleTentBattleRoom_OnWarp: @ 8202541
.2byte 0
VerdanturfTown_BattleTentBattleRoom_EventScript_SetUpObjects:: @ 820254B
- hideobjectat 1, MAP_VERDANTURF_TOWN_BATTLE_TENT_BATTLE_ROOM
+ hideobjectat LOCALID_PLAYER, MAP_VERDANTURF_TOWN_BATTLE_TENT_BATTLE_ROOM
call VerdanturfTown_BattleTentBattleRoom_EventScript_SetPlayerGfx
setvar VAR_TEMP_1, 1
applymovement OBJ_EVENT_ID_PLAYER, VerdanturfTown_BattleTentBattleRoom_Movement_SetInvisible
- removeobject 2
+ removeobject LOCALID_OPPONENT
end
VerdanturfTown_BattleTentBattleRoom_EventScript_ReadyFor2ndOpponent:: @ 8202565
diff --git a/data/maps/VerdanturfTown_BattleTentCorridor/scripts.inc b/data/maps/VerdanturfTown_BattleTentCorridor/scripts.inc
index b1dedf1a1..24d047a2a 100644
--- a/data/maps/VerdanturfTown_BattleTentCorridor/scripts.inc
+++ b/data/maps/VerdanturfTown_BattleTentCorridor/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
VerdanturfTown_BattleTentCorridor_MapScripts:: @ 820208A
map_script MAP_SCRIPT_ON_FRAME_TABLE, VerdanturfTown_BattleTentCorridor_OnFrame
.byte 0
@@ -9,12 +11,12 @@ VerdanturfTown_BattleTentCorridor_OnFrame: @ 8202090
VerdanturfTown_BattleTentCorridor_EventScript_EnterCorridor:: @ 820209A
lockall
setvar VAR_TEMP_0, 1
- applymovement 1, VerdanturfTown_BattleTentCorridor_Movement_WalkToDoor
+ applymovement LOCALID_ATTENDANT, VerdanturfTown_BattleTentCorridor_Movement_WalkToDoor
applymovement OBJ_EVENT_ID_PLAYER, VerdanturfTown_BattleTentCorridor_Movement_WalkToDoor
waitmovement 0
opendoor 2, 1
waitdooranim
- applymovement 1, VerdanturfTown_BattleTentCorridor_Movement_AttendantEnterDoor
+ applymovement LOCALID_ATTENDANT, VerdanturfTown_BattleTentCorridor_Movement_AttendantEnterDoor
applymovement OBJ_EVENT_ID_PLAYER, VerdanturfTown_BattleTentCorridor_Movement_PlayerEnterDoor
waitmovement 0
closedoor 2, 1
diff --git a/data/maps/VerdanturfTown_BattleTentLobby/scripts.inc b/data/maps/VerdanturfTown_BattleTentLobby/scripts.inc
index 4685f0571..7a3aa605c 100644
--- a/data/maps/VerdanturfTown_BattleTentLobby/scripts.inc
+++ b/data/maps/VerdanturfTown_BattleTentLobby/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_ATTENDANT, 1
+
VerdanturfTown_BattleTentLobby_MapScripts:: @ 82016D0
map_script MAP_SCRIPT_ON_FRAME_TABLE, VerdanturfTown_BattleTentLobby_OnFrame
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, VerdanturfTown_BattleTentLobby_OnWarp
@@ -195,12 +197,12 @@ VerdanturfTown_BattleTentLobby_EventScript_EndCancelChallenge:: @ 8201A3F
end
VerdanturfTown_BattleTentLobby_EventScript_WalkToDoor:: @ 8201A41
- applymovement 1, VerdanturfTown_BattleTentLobby_Movement_WalkToDoor
+ applymovement LOCALID_ATTENDANT, VerdanturfTown_BattleTentLobby_Movement_WalkToDoor
applymovement OBJ_EVENT_ID_PLAYER, VerdanturfTown_BattleTentLobby_Movement_WalkToDoor
waitmovement 0
opendoor 6, 1
waitdooranim
- applymovement 1, VerdanturfTown_BattleTentLobby_Movement_AttendantEnterDoor
+ applymovement LOCALID_ATTENDANT, VerdanturfTown_BattleTentLobby_Movement_AttendantEnterDoor
applymovement OBJ_EVENT_ID_PLAYER, VerdanturfTown_BattleTentLobby_Movement_PlayerEnterDoor
waitmovement 0
closedoor 6, 1
diff --git a/data/maps/VerdanturfTown_PokemonCenter_1F/scripts.inc b/data/maps/VerdanturfTown_PokemonCenter_1F/scripts.inc
index 040e69a16..f59d40456 100644
--- a/data/maps/VerdanturfTown_PokemonCenter_1F/scripts.inc
+++ b/data/maps/VerdanturfTown_PokemonCenter_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_NURSE, 1
+
VerdanturfTown_PokemonCenter_1F_MapScripts:: @ 8202726
map_script MAP_SCRIPT_ON_TRANSITION, VerdanturfTown_PokemonCenter_1F_OnTransition
map_script MAP_SCRIPT_ON_RESUME, CableClub_OnResume
@@ -8,9 +10,8 @@ VerdanturfTown_PokemonCenter_1F_OnTransition: @ 8202731
call Common_EventScript_UpdateBrineyLocation
end
-@ VAR_0x800B is the Nurse's object event id
VerdanturfTown_PokemonCenter_1F_EventScript_Nurse:: @ 820273A
- setvar VAR_0x800B, 1
+ setvar VAR_0x800B, LOCALID_NURSE
call Common_EventScript_PkmnCenterNurse
waitmessage
waitbuttonpress
diff --git a/data/maps/VictoryRoad_1F/scripts.inc b/data/maps/VictoryRoad_1F/scripts.inc
index cfd443aec..f7668d4a5 100644
--- a/data/maps/VictoryRoad_1F/scripts.inc
+++ b/data/maps/VictoryRoad_1F/scripts.inc
@@ -1,3 +1,5 @@
+.set LOCALID_WALLY_ENTRANCE, 4
+
VictoryRoad_1F_MapScripts:: @ 8235D7A
map_script MAP_SCRIPT_ON_TRANSITION, VictoryRoad_1F_OnTransition
.byte 0
@@ -10,20 +12,20 @@ VictoryRoad_1F_OnTransition: @ 8235D80
end
VictoryRoad_1F_EventScript_SetEntranceWallyPos1:: @ 8235D97
- setobjectxyperm 4, 2, 24
- setobjectmovementtype 4, MOVEMENT_TYPE_FACE_DOWN
+ setobjectxyperm LOCALID_WALLY_ENTRANCE, 2, 24
+ setobjectmovementtype LOCALID_WALLY_ENTRANCE, MOVEMENT_TYPE_FACE_DOWN
return
VictoryRoad_1F_EventScript_SetEntranceWallyPos2:: @ 8235DA3
- setobjectxyperm 4, 3, 24
- setobjectmovementtype 4, MOVEMENT_TYPE_FACE_DOWN
+ setobjectxyperm LOCALID_WALLY_ENTRANCE, 3, 24
+ setobjectmovementtype LOCALID_WALLY_ENTRANCE, MOVEMENT_TYPE_FACE_DOWN
return
VictoryRoad_1F_EventScript_WallyBattleTrigger1:: @ 8235DAF
lockall
setvar VAR_0x8008, 1
- addobject 4
- applymovement 4, VictoryRoad_1F_Movement_WallyApproachPlayer1
+ addobject LOCALID_WALLY_ENTRANCE
+ applymovement LOCALID_WALLY_ENTRANCE, VictoryRoad_1F_Movement_WallyApproachPlayer1
waitmovement 0
goto VictoryRoad_1F_EventScript_WallyEntranceBattle
end
@@ -31,8 +33,8 @@ VictoryRoad_1F_EventScript_WallyBattleTrigger1:: @ 8235DAF
VictoryRoad_1F_EventScript_WallyBattleTrigger2:: @ 8235DC8
lockall
setvar VAR_0x8008, 2
- addobject 4
- applymovement 4, VictoryRoad_1F_Movement_WallyApproachPlayer2
+ addobject LOCALID_WALLY_ENTRANCE
+ applymovement LOCALID_WALLY_ENTRANCE, VictoryRoad_1F_Movement_WallyApproachPlayer2
waitmovement 0
goto VictoryRoad_1F_EventScript_WallyEntranceBattle
end
@@ -44,7 +46,7 @@ VictoryRoad_1F_EventScript_WallyEntranceBattle:: @ 8235DE1
trainerbattle_no_intro TRAINER_WALLY_VR_1, VictoryRoad_1F_Text_WallyEntranceDefeat
msgbox VictoryRoad_1F_Text_WallyPostEntranceBattle, MSGBOX_DEFAULT
clearflag FLAG_HIDE_VICTORY_ROAD_ENTRANCE_WALLY
- copyobjectxytoperm 4
+ copyobjectxytoperm LOCALID_WALLY_ENTRANCE
setflag FLAG_DEFEATED_WALLY_VICTORY_ROAD
copyvar VAR_VICTORY_ROAD_1F_STATE, VAR_0x8008
releaseall
diff --git a/data/scripts/apprentice.inc b/data/scripts/apprentice.inc
index b3ae904a0..f5fa3aeeb 100644
--- a/data/scripts/apprentice.inc
+++ b/data/scripts/apprentice.inc
@@ -1,3 +1,5 @@
+.set LOCALID_APPRENTICE, 6
+
BattleFrontier_BattleTowerLobby_EventScript_Apprentice:: @ 82B688D
lock
faceplayer
@@ -225,7 +227,7 @@ Apprentice_EventScript_LeaveNorth: @ 82B6E54
apprentice_shouldleave
compare VAR_0x8004, FALSE @ Always TRUE here
goto_if_eq Apprentice_EventScript_DontMove
- applymovement 6, Apprentice_Movement_LeaveNorth
+ applymovement LOCALID_APPRENTICE, Apprentice_Movement_LeaveNorth
waitmovement 0
end
@@ -233,7 +235,7 @@ Apprentice_EventScript_Leave: @ 82B6E72
apprentice_shouldleave
compare VAR_0x8004, FALSE @ Always TRUE here
goto_if_eq Apprentice_EventScript_DontMove
- applymovement 6, Apprentice_Movement_Leave
+ applymovement LOCALID_APPRENTICE, Apprentice_Movement_Leave
waitmovement 0
end
diff --git a/data/scripts/battle_pike.inc b/data/scripts/battle_pike.inc
index 83cc6ec61..67eb19011 100644
--- a/data/scripts/battle_pike.inc
+++ b/data/scripts/battle_pike.inc
@@ -1,3 +1,4 @@
+@ Note: LOCALIDs shared with BattleFrontier_BattlePikeRoomNormal
BattleFrontier_BattlePikeRoomNormal_MapScripts_2C3E1B: @ 82C3E1B
map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_BattlePikeRoom_OnTransition
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, BattleFrontier_BattlePikeRoom_OnWarp
@@ -17,28 +18,28 @@ BattleFrontier_BattlePikeRoom_OnTransition: @ 82C3E25
end
BattleFrontier_BattlePikeRoomNormal_EventScript_SetDoubleBattleObjPos:: @ 82C3E93
- setobjectxyperm 1, 2, 5
- setobjectxyperm 2, 6, 5
+ setobjectxyperm LOCALID_OBJ_0, 2, 5
+ setobjectxyperm LOCALID_OBJ_1, 6, 5
end
BattleFrontier_BattlePikeRoomNormal_EventScript_SetTwoObjectRoomPos:: @ 82C3EA2
- setobjectxyperm 1, 4, 4
- setobjectxyperm 2, 3, 4
+ setobjectxyperm LOCALID_OBJ_0, 4, 4
+ setobjectxyperm LOCALID_OBJ_1, 3, 4
end
BattleFrontier_BattlePikeRoomNormal_EventScript_SetOneObjectRoomPos:: @ 82C3EB1
- setobjectxyperm 1, 4, 4
- setobjectxyperm 2, 0, 0
+ setobjectxyperm LOCALID_OBJ_0, 4, 4
+ setobjectxyperm LOCALID_OBJ_1, 0, 0
end
BattleFrontier_BattlePikeRoomNormal_EventScript_SetNPCRoomObjPos:: @ 82C3EC0
- setobjectxyperm 1, 5, 5
- setobjectxyperm 2, 0, 0
+ setobjectxyperm LOCALID_OBJ_0, 5, 5
+ setobjectxyperm LOCALID_OBJ_1, 0, 0
end
BattleFrontier_BattlePikeRoomNormal_EventScript_SetBrainRoomObjPos:: @ 82C3ECF
- setobjectxyperm 1, 4, 3
- setobjectxyperm 2, 4, 4
+ setobjectxyperm LOCALID_OBJ_0, 4, 3
+ setobjectxyperm LOCALID_OBJ_1, 4, 4
end
BattleFrontier_BattlePikeRoom_OnWarp: @ 82C3EDE
@@ -57,7 +58,7 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_InitRoomObjects:: @ 82C3EE8
goto_if_eq BattleFrontier_BattlePikeRoomNormal_EventScript_InitTwoObjectRoom
compare VAR_RESULT, PIKE_ROOM_BRAIN
goto_if_eq BattleFrontier_BattlePikeRoomNormal_EventScript_InitBrainRoomObjects
- hideobjectat 2, MAP_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_NORMAL
+ hideobjectat LOCALID_OBJ_1, MAP_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_NORMAL
setvar VAR_TEMP_4, 1
turnobject OBJ_EVENT_ID_PLAYER, DIR_NORTH
end
@@ -70,7 +71,7 @@ BattleFrontier_BattlePikeRoomNormal_EventScript_InitTwoObjectRoom:: @ 82C3F35
BattleFrontier_BattlePikeRoomNormal_EventScript_InitBrainRoomObjects:: @ 82C3F3F
setvar VAR_TEMP_4, 1
turnobject OBJ_EVENT_ID_PLAYER, DIR_NORTH
- hideobjectat 1, MAP_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_NORMAL @ Pike Queen hidden initially
+ hideobjectat LOCALID_OBJ_0, MAP_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_NORMAL @ Pike Queen hidden initially
end
BattleFrontier_BattlePikeThreePathRoom_EventScript_LeftRoomWarp:: @ 82C3F4E
diff --git a/data/scripts/berry_blender.inc b/data/scripts/berry_blender.inc
index 975408daf..d98add74d 100644
--- a/data/scripts/berry_blender.inc
+++ b/data/scripts/berry_blender.inc
@@ -1,3 +1,11 @@
+@ Note: local IDs shared with scripts.inc for LilycoveCity_ContestLobby
+.set LOCALID_MAN, 3
+.set LOCALID_BOY, 9
+.set LOCALID_TWIN, 10
+.set LOCALID_POKEFAN_F, 15
+.set LOCALID_EXPERT_M, 16
+.set LOCALID_GIRL, 17
+
BerryBlender_Text_WantToMakePokeblocks: @ 8292DEE
.string "Oh? Did you want to make some {POKEBLOCK}S\n"
.string "with this old-timer?$"
@@ -236,7 +244,7 @@ BerryBlender_EventScript_BerryBlender1:: @ 8293C3E
lockall
goto_if_unset FLAG_HIDE_LILYCOVE_CONTEST_HALL_BLEND_MASTER, BerryBlender_EventScript_BlendMasterPresent
setvar VAR_0x8009, 1
- applymovement 16, BerryBlender_Movement_BlendLeaderWalkInPlace
+ applymovement LOCALID_EXPERT_M, BerryBlender_Movement_BlendLeaderWalkInPlace
waitmovement 0
msgbox BerryBlender_Text_WantToMakePokeblocks, MSGBOX_YESNO
compare VAR_RESULT, YES
@@ -321,8 +329,8 @@ BerryBlender_EventScript_Blender1NoCase: @ 8293D43
BerryBlender_EventScript_BerryBlender2:: @ 8293D4D
lockall
setvar VAR_0x8009, 2
- applymovement 10, Common_Movement_FaceOriginalDirection
- applymovement 3, BerryBlender_Movement_BlendLeaderWalkInPlace
+ applymovement LOCALID_TWIN, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_MAN, BerryBlender_Movement_BlendLeaderWalkInPlace
waitmovement 0
msgbox BerryBlender_Text_WantToBlendPokeblocksWithUs, MSGBOX_YESNO
compare VAR_RESULT, YES
@@ -384,10 +392,10 @@ BerryBlender_EventScript_Blender2NoCase: @ 8293E14
BerryBlender_EventScript_BerryBlender3:: @ 8293E1E
lockall
- setvar VAR_0x8008, 15
+ setvar VAR_0x8008, LOCALID_POKEFAN_F
setvar VAR_0x8009, 3
- applymovement 9, Common_Movement_FaceOriginalDirection
- applymovement 17, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_BOY, Common_Movement_FaceOriginalDirection
+ applymovement LOCALID_GIRL, Common_Movement_FaceOriginalDirection
applymovement VAR_0x8008, BerryBlender_Movement_BlendLeaderWalkInPlace
waitmovement 0
msgbox BerryBlender_Text_LookGoodAtBlendingJoinUs, MSGBOX_YESNO
@@ -600,15 +608,15 @@ BerryBlender_EventScript_TryDoLinkBlender: @ 82940BB
waitmessage
special TryBerryBlenderLinkup
waitstate
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq BerryBlender_EventScript_SpawnLinkPartners
- compare VAR_RESULT, 2
+ compare VAR_RESULT, LINKUP_SOMEONE_NOT_READY
goto_if_eq BerryBlender_EventScript_CloseLinkNotReady
- compare VAR_RESULT, 3
+ compare VAR_RESULT, LINKUP_DIFF_SELECTIONS
goto_if_eq BerryBlender_EventScript_CloseLinkDifferentSelections
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq BerryBlender_EventScript_CloseLink
- compare VAR_RESULT, 6
+ compare VAR_RESULT, LINKUP_CONNECTION_ERROR
goto_if_eq BerryBlender_EventScript_LinkError
end
@@ -630,9 +638,9 @@ BerryBlender_EventScript_FourPlayerLink: @ 8294139
BerryBlender_EventScript_DoLinkBerryBlending: @ 8294147
setvar VAR_0x8004, 0
fadescreen FADE_TO_BLACK
- removeobject 240
- removeobject 239
- removeobject 238
+ removeobject 240 @ Unclear where these local IDs come from,
+ removeobject 239 @ but presumably they'd be the 4 link players
+ removeobject 238
removeobject 237
special DoBerryBlending
waitstate
@@ -712,22 +720,22 @@ BerryBlender_EventScript_DecideLinkLeader: @ 82941F8
BerryBlender_EventScript_TryLeadGroup: @ 8294235
call BerryBlender_EventScript_TryBecomeLinkLeader
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq BerryBlender_EventScript_LinkLeaderDecided
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq BerryBlender_EventScript_DecideLinkLeader
- compare VAR_RESULT, 8
+ compare VAR_RESULT, LINKUP_RETRY_ROLE_ASSIGN
goto_if_eq BerryBlender_EventScript_TryLeadGroup
release
end
BerryBlender_EventScript_TryJoinGroup: @ 829425D
call BerryBlender_EventScript_TryJoinLinkGroup
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq BerryBlender_EventScript_LinkLeaderDecided
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq BerryBlender_EventScript_DecideLinkLeader
- compare VAR_RESULT, 8
+ compare VAR_RESULT, LINKUP_RETRY_ROLE_ASSIGN
goto_if_eq BerryBlender_EventScript_TryJoinGroup
release
end
diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc
index 6d5702f74..66cf74f0a 100644
--- a/data/scripts/cable_club.inc
+++ b/data/scripts/cable_club.inc
@@ -349,17 +349,17 @@ CableClub_EventScript_TryEnterColosseum:: @ 8276F60
waitmessage
special TryBattleLinkup
waitstate
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq CableClub_EventScript_EnterColosseum
- compare VAR_RESULT, 2
+ compare VAR_RESULT, LINKUP_SOMEONE_NOT_READY
goto_if_eq CableClub_EventScript_AbortLinkSomeoneNotReady
- compare VAR_RESULT, 3
+ compare VAR_RESULT, LINKUP_DIFF_SELECTIONS
goto_if_eq CableClub_EventScript_AbortLinkDifferentSelections
- compare VAR_RESULT, 4
+ compare VAR_RESULT, LINKUP_WRONG_NUM_PLAYERS
goto_if_eq CableClub_EventScript_AbortLinkIncorrectNumberOfBattlers
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq CableClub_EventScript_AbortLink
- compare VAR_RESULT, 6
+ compare VAR_RESULT, LINKUP_CONNECTION_ERROR
goto_if_eq CableClub_EventScript_AbortLinkConnectionError
end
@@ -452,21 +452,21 @@ CableClub_EventScript_TradeCenter:: @ 82770B2
waitmessage
special TryTradeLinkup
waitstate
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq CableClub_EventScript_EnterTradeCenter
- compare VAR_RESULT, 2
+ compare VAR_RESULT, LINKUP_SOMEONE_NOT_READY
goto_if_eq CableClub_EventScript_AbortLinkSomeoneNotReady
- compare VAR_RESULT, 3
+ compare VAR_RESULT, LINKUP_DIFF_SELECTIONS
goto_if_eq CableClub_EventScript_AbortLinkDifferentSelections
- compare VAR_RESULT, 4
+ compare VAR_RESULT, LINKUP_WRONG_NUM_PLAYERS
goto_if_eq CableClub_EventScript_AbortLinkIncorrectNumberOfParticipants
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq CableClub_EventScript_AbortLink
- compare VAR_RESULT, 6
+ compare VAR_RESULT, LINKUP_CONNECTION_ERROR
goto_if_eq CableClub_EventScript_AbortLinkConnectionError
- compare VAR_RESULT, 7
+ compare VAR_RESULT, LINKUP_PLAYER_NOT_READY
goto_if_eq CableClub_EventScript_AbortLinkPlayerNotReady
- compare VAR_RESULT, 9
+ compare VAR_RESULT, LINKUP_PARTNER_NOT_READY
goto_if_eq CableClub_EventScript_AbortLinkOtherTrainerNotReady
end
@@ -527,21 +527,21 @@ CableClub_EventScript_RecordCorner:: @ 82771DB
waitmessage
special TryRecordMixLinkup
waitstate
- special sub_80B2EA8
+ special ValidateMixingGameLanguage
waitstate
- compare VAR_RESULT, 12
+ compare VAR_RESULT, LINKUP_FOREIGN_GAME
goto_if_eq CableClub_EventScript_AbortLinkForeignGame
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq CableClub_EventScript_EnterRecordCorner
- compare VAR_RESULT, 2
+ compare VAR_RESULT, LINKUP_SOMEONE_NOT_READY
goto_if_eq CableClub_EventScript_AbortLinkSomeoneNotReady
- compare VAR_RESULT, 3
+ compare VAR_RESULT, LINKUP_DIFF_SELECTIONS
goto_if_eq CableClub_EventScript_AbortLinkDifferentSelections
- compare VAR_RESULT, 4
+ compare VAR_RESULT, LINKUP_WRONG_NUM_PLAYERS
goto_if_eq CableClub_EventScript_AbortLinkIncorrectNumberOfParticipants
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq CableClub_EventScript_AbortLink
- compare VAR_RESULT, 6
+ compare VAR_RESULT, LINKUP_CONNECTION_ERROR
goto_if_eq CableClub_EventScript_AbortLinkConnectionError
end
@@ -972,7 +972,7 @@ CableClub_EventScript_EnterUnionRoom:: @ 827759F
special SetCableClubWarp
warpteleport2 MAP_UNION_ROOM, 255, 7, 11
waitstate
- special UnionRoomSpecial
+ special RunUnionRoom
waitstate
end
@@ -1181,22 +1181,22 @@ CableClub_EventScript_ChooseLinkLeaderFrom2:: @ 8277989
CableClub_EventScript_TryLeadGroup2Players:: @ 82779C6
call CableClub_EventScript_TryBecomeLinkLeader
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq CableClub_EventScript_EnterWirelessLinkRoom
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq CableClub_EventScript_ChooseLinkLeaderFrom2
- compare VAR_RESULT, 8
+ compare VAR_RESULT, LINKUP_RETRY_ROLE_ASSIGN
goto_if_eq CableClub_EventScript_TryLeadGroup2Players
release
return
CableClub_EventScript_TryJoinGroup2Players:: @ 82779EE
call CableClub_EventScript_TryJoinLinkGroup
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq CableClub_EventScript_EnterWirelessLinkRoom
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq CableClub_EventScript_ChooseLinkLeaderFrom2
- compare VAR_RESULT, 8
+ compare VAR_RESULT, LINKUP_RETRY_ROLE_ASSIGN
goto_if_eq CableClub_EventScript_TryJoinGroup2Players
release
return
@@ -1214,22 +1214,22 @@ CableClub_EventScript_ChooseLinkLeaderFrom4:: @ 8277A16
CableClub_EventScript_TryLeadGroup4Players:: @ 8277A53
call CableClub_EventScript_TryBecomeLinkLeader
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq CableClub_EventScript_EnterWirelessLinkRoom
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq CableClub_EventScript_ChooseLinkLeaderFrom4
- compare VAR_RESULT, 8
+ compare VAR_RESULT, LINKUP_RETRY_ROLE_ASSIGN
goto_if_eq CableClub_EventScript_TryLeadGroup4Players
release
return
CableClub_EventScript_TryJoinGroup4Players:: @ 8277A7B
call CableClub_EventScript_TryJoinLinkGroup
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq CableClub_EventScript_EnterWirelessLinkRoom
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq CableClub_EventScript_ChooseLinkLeaderFrom4
- compare VAR_RESULT, 8
+ compare VAR_RESULT, LINKUP_RETRY_ROLE_ASSIGN
goto_if_eq CableClub_EventScript_TryJoinGroup4Players
release
return
@@ -1247,22 +1247,22 @@ CableClub_EventScript_ChooseLinkLeader:: @ 8277AA3
CableClub_EventScript_TryLeadGroupXPlayers:: @ 8277AE0
call CableClub_EventScript_TryBecomeLinkLeader
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq CableClub_EventScript_EnterWirelessLinkRoom
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq CableClub_EventScript_ChooseLinkLeader
- compare VAR_RESULT, 8
+ compare VAR_RESULT, LINKUP_RETRY_ROLE_ASSIGN
goto_if_eq CableClub_EventScript_TryLeadGroupXPlayers
release
return
CableClub_EventScript_TryJoinGroupXPlayers:: @ 8277B08
call CableClub_EventScript_TryJoinLinkGroup
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq CableClub_EventScript_EnterWirelessLinkRoom
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq CableClub_EventScript_ChooseLinkLeader
- compare VAR_RESULT, 8
+ compare VAR_RESULT, LINKUP_RETRY_ROLE_ASSIGN
goto_if_eq CableClub_EventScript_TryJoinGroupXPlayers
release
return
@@ -1310,7 +1310,7 @@ EventScript_WirelessBoxResults:: @ 8277B8A
compare VAR_RESULT, FALSE
goto_if_eq CableClub_EventScript_AdapterNotConnected
fadescreen FADE_TO_BLACK
- special sub_801A42C
+ special ShowWirelessCommunicationScreen
waitstate
msgbox CableClub_Text_ParticipantsStepUpToCounter, MSGBOX_DEFAULT
releaseall
@@ -1453,22 +1453,22 @@ MossdeepCity_GameCorner_1F_EventScript_ChooseLinkLeader:: @ 8277D81
MossdeepCity_GameCorner_1F_EventScript_TryBecomeLinkLeader:: @ 8277DBE
call CableClub_EventScript_TryBecomeLinkLeader
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq MossdeepCity_GameCorner_1F_EventScript_EnterMinigameRoom
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq MossdeepCity_GameCorner_1F_EventScript_ChooseLinkLeader
- compare VAR_RESULT, 8
+ compare VAR_RESULT, LINKUP_RETRY_ROLE_ASSIGN
goto_if_eq MossdeepCity_GameCorner_1F_EventScript_TryBecomeLinkLeader
release
return
MossdeepCity_GameCorner_1F_EventScript_TryJoinLinkGroup:: @ 8277DE6
call CableClub_EventScript_TryJoinLinkGroup
- compare VAR_RESULT, 1
+ compare VAR_RESULT, LINKUP_SUCCESS
goto_if_eq MossdeepCity_GameCorner_1F_EventScript_EnterMinigameRoom
- compare VAR_RESULT, 5
+ compare VAR_RESULT, LINKUP_FAILED
goto_if_eq MossdeepCity_GameCorner_1F_EventScript_ChooseLinkLeader
- compare VAR_RESULT, 8
+ compare VAR_RESULT, LINKUP_RETRY_ROLE_ASSIGN
goto_if_eq MossdeepCity_GameCorner_1F_EventScript_TryJoinLinkGroup
release
return
diff --git a/data/scripts/contest_hall.inc b/data/scripts/contest_hall.inc
index 48fd2e293..c21488502 100644
--- a/data/scripts/contest_hall.inc
+++ b/data/scripts/contest_hall.inc
@@ -1,3 +1,19 @@
+.set LOCALID_MC, 1
+.set LOCALID_JUDGE, 2
+.set LOCALID_CONTESTANT_1, 3
+.set LOCALID_CONTESTANT_2, 4
+.set LOCALID_CONTESTANT_3, 5
+.set LOCALID_AUDIENCE_1, 6
+.set LOCALID_AUDIENCE_3, 7
+.set LOCALID_AUDIENCE_4, 8
+.set LOCALID_AUDIENCE_5, 9
+.set LOCALID_AUDIENCE_6, 10
+.set LOCALID_AUDIENCE_7, 11
+.set LOCALID_AUDIENCE_2, 12
+.set LOCALID_POKEBALL, 13
+.set LOCALID_CONTESTANT_4, 14
+.set LOCALID_ARTIST, 15
+
@ Either ends or returns to EventScript_ContestReceptionist after submitting a contest entry
LilycoveCity_ContestLobby_EventScript_SpeakToContestReceptionist:: @ 8279CC5
lock
@@ -193,9 +209,9 @@ ContestHall_EventScript_DoContest:: @ 8279F97
special LinkContestTryShowWirelessIndicator
setvar VAR_0x8006, 0
lockall
- applymovement 14, ContestHall_Movement_Player4FaceUp
+ applymovement LOCALID_CONTESTANT_4, ContestHall_Movement_Player4FaceUp
waitmovement 0
- applymovement 1, ContestHall_Movement_MCWalkDown
+ applymovement LOCALID_MC, ContestHall_Movement_MCWalkDown
waitmovement 0
releaseall
call ContestHall_EventScript_TryWaitForLink
@@ -271,7 +287,7 @@ ContestHall_EventScript_ContestGettingStarted:: @ 827A097
bufferstdstring 2, VAR_0x8009
call ContestHall_EventScript_GettingStarted
lockall
- applymovement 1, ContestHall_Movement_MCBackUp
+ applymovement LOCALID_MC, ContestHall_Movement_MCBackUp
waitmovement 0
releaseall
return
@@ -341,37 +357,37 @@ ContestHall_EventScript_ContestantWalkToCenter:: @ 827A149
ContestHall_EventScript_Player1WalkToCenter:: @ 827A176
call ContestHall_EventScript_TryWaitForLink
lockall
- applymovement 3, ContestHall_Movement_Player1WalkToCenter
+ applymovement LOCALID_CONTESTANT_1, ContestHall_Movement_Player1WalkToCenter
waitmovement 0
releaseall
- setvar VAR_0x800B, 3
+ setvar VAR_0x800B, LOCALID_CONTESTANT_1
return
ContestHall_EventScript_Player2WalkToCenter:: @ 827A18D
call ContestHall_EventScript_TryWaitForLink
lockall
- applymovement 4, ContestHall_Movement_Player2WalkToCenter
+ applymovement LOCALID_CONTESTANT_2, ContestHall_Movement_Player2WalkToCenter
waitmovement 0
releaseall
- setvar VAR_0x800B, 4
+ setvar VAR_0x800B, LOCALID_CONTESTANT_2
return
ContestHall_EventScript_Player3WalkToCenter:: @ 827A1A4
call ContestHall_EventScript_TryWaitForLink
lockall
- applymovement 5, ContestHall_Movement_Player3WalkToCenter
+ applymovement LOCALID_CONTESTANT_3, ContestHall_Movement_Player3WalkToCenter
waitmovement 0
releaseall
- setvar VAR_0x800B, 5
+ setvar VAR_0x800B, LOCALID_CONTESTANT_3
return
ContestHall_EventScript_Player4WalkToCenter:: @ 827A1BB
call ContestHall_EventScript_TryWaitForLink
lockall
- applymovement 14, ContestHall_Movement_Player4WalkToCenter
+ applymovement LOCALID_CONTESTANT_4, ContestHall_Movement_Player4WalkToCenter
waitmovement 0
releaseall
- setvar VAR_0x800B, 14
+ setvar VAR_0x800B, LOCALID_CONTESTANT_4
return
ContestHall_EventScript_ShowContestMonPic:: @ 827A1D2
@@ -384,7 +400,7 @@ ContestHall_EventScript_ShowContestMonPic:: @ 827A1D2
releaseall
call ContestHall_EventScript_TryWaitForLink
call ContestHall_EventScript_CheckIfContestWithRSPlayer
- addobject 13 @ Place Poke Ball down
+ addobject LOCALID_POKEBALL
playse SE_DANSA
lockall
applymovement VAR_0x800B, ContestHall_Movement_ContestantDelay32
@@ -414,13 +430,13 @@ ContestHall_EventScript_AudienceVote:: @ 827A230
playse SE_W227B
waitmessage
call ContestHall_EventScript_AudienceLookAround
- applymovement 1, ContestHall_Movement_MCFaceJudge2
+ applymovement LOCALID_MC, ContestHall_Movement_MCFaceJudge2
waitmovement 0
- applymovement 2, ContestHall_Movement_JudgeFaceMC
+ applymovement LOCALID_JUDGE, ContestHall_Movement_JudgeFaceMC
waitmovement 0
delay 20
- applymovement 1, ContestHall_Movement_FaceContestants
- applymovement 2, ContestHall_Movement_FaceContestants
+ applymovement LOCALID_MC, ContestHall_Movement_FaceContestants
+ applymovement LOCALID_JUDGE, ContestHall_Movement_FaceContestants
waitmovement 0
return
@@ -463,25 +479,25 @@ ContestHall_EventScript_VotingUnderWayLink:: @ 827A2CA
ContestHall_EventScript_AudienceReactToContestant:: @ 827A2D5
call ContestHall_EventScript_TryWaitForLink
- applymovement 1, ContestHall_Movement_AudienceMemberLookLeft
+ applymovement LOCALID_MC, ContestHall_Movement_AudienceMemberLookLeft
waitmovement 0
playse SE_W227B
call ContestHall_EventScript_VObjectAudienceLookAround
- applymovement 9, ContestHall_Movement_AudienceMemberLookRight
- applymovement 12, ContestHall_Movement_AudienceMemberLookDown
- applymovement 7, ContestHall_Movement_AudienceMemberLookRight
+ applymovement LOCALID_AUDIENCE_5, ContestHall_Movement_AudienceMemberLookRight
+ applymovement LOCALID_AUDIENCE_2, ContestHall_Movement_AudienceMemberLookDown
+ applymovement LOCALID_AUDIENCE_3, ContestHall_Movement_AudienceMemberLookRight
waitmovement 0
- applymovement 1, ContestHall_Movement_AudienceMemberLookRight
+ applymovement LOCALID_MC, ContestHall_Movement_AudienceMemberLookRight
waitmovement 0
- applymovement 10, ContestHall_Movement_AudienceMemberLookLeft
- applymovement 11, ContestHall_Movement_AudienceMemberLookDown
- applymovement 6, ContestHall_Movement_AudienceMemberLookUp
- applymovement 8, ContestHall_Movement_AudienceMemberLookLeft
+ applymovement LOCALID_AUDIENCE_6, ContestHall_Movement_AudienceMemberLookLeft
+ applymovement LOCALID_AUDIENCE_7, ContestHall_Movement_AudienceMemberLookDown
+ applymovement LOCALID_AUDIENCE_1, ContestHall_Movement_AudienceMemberLookUp
+ applymovement LOCALID_AUDIENCE_4, ContestHall_Movement_AudienceMemberLookLeft
waitmovement 0
- applymovement 1, ContestHall_Movement_MCLookAtJudge
+ applymovement LOCALID_MC, ContestHall_Movement_MCLookAtJudge
waitmovement 0
- applymovement 1, ContestHall_Movement_MCWalkInPlaceDown
- applymovement 2, ContestHall_Movement_JudgeLookAtMC
+ applymovement LOCALID_MC, ContestHall_Movement_MCWalkInPlaceDown
+ applymovement LOCALID_JUDGE, ContestHall_Movement_JudgeLookAtMC
waitmovement 0
releaseall
call ContestHall_EventScript_TryWaitForLink
@@ -683,7 +699,7 @@ ContestHall_EventScript_Set8Hearts:: @ 827A654
ContestHall_EventScript_TryDisplayHeartAudienceMember1:: @ 827A65A
compare VAR_TEMP_1, 1
goto_if_eq ContestHall_EventScript_AudienceMember1AlreadyEmoted
- applymovement 6, ContestHall_Movement_Heart
+ applymovement LOCALID_AUDIENCE_1, ContestHall_Movement_Heart
playse SE_PIN
delay 14
setvar VAR_TEMP_1, 1
@@ -696,7 +712,7 @@ ContestHall_EventScript_AudienceMember1AlreadyEmoted:: @ 827A67D
ContestHall_EventScript_TryDisplayHeartAudienceMember2:: @ 827A67E
compare VAR_TEMP_2, 1
goto_if_eq ContestHall_EventScript_AudienceMember2AlreadyEmoted
- applymovement 12, ContestHall_Movement_Heart
+ applymovement LOCALID_AUDIENCE_2, ContestHall_Movement_Heart
playse SE_PIN
delay 14
setvar VAR_TEMP_2, 1
@@ -709,7 +725,7 @@ ContestHall_EventScript_AudienceMember2AlreadyEmoted:: @ 827A6A1
ContestHall_EventScript_TryDisplayHeartAudienceMember3:: @ 827A6A2
compare VAR_TEMP_3, 1
goto_if_eq ContestHall_EventScript_AudienceMember3AlreadyEmoted
- applymovement 7, ContestHall_Movement_Heart
+ applymovement LOCALID_AUDIENCE_3, ContestHall_Movement_Heart
playse SE_PIN
delay 14
setvar VAR_TEMP_3, 1
@@ -722,7 +738,7 @@ ContestHall_EventScript_AudienceMember3AlreadyEmoted:: @ 827A6C5
ContestHall_EventScript_TryDisplayHeartAudienceMember4:: @ 827A6C6
compare VAR_TEMP_4, 1
goto_if_eq ContestHall_EventScript_Audience4MemberAlreadyEmoted
- applymovement 8, ContestHall_Movement_Heart
+ applymovement LOCALID_AUDIENCE_4, ContestHall_Movement_Heart
playse SE_PIN
delay 14
setvar VAR_TEMP_4, 1
@@ -735,7 +751,7 @@ ContestHall_EventScript_Audience4MemberAlreadyEmoted:: @ 827A6E9
ContestHall_EventScript_TryDisplayHeartAudienceMember5:: @ 827A6EA
compare VAR_TEMP_5, 1
goto_if_eq ContestHall_EventScript_AudienceMember5AlreadyEmoted
- applymovement 9, ContestHall_Movement_Heart
+ applymovement LOCALID_AUDIENCE_5, ContestHall_Movement_Heart
playse SE_PIN
delay 14
setvar VAR_TEMP_5, 1
@@ -748,7 +764,7 @@ ContestHall_EventScript_AudienceMember5AlreadyEmoted:: @ 827A70D
ContestHall_EventScript_TryDisplayHeartAudienceMember6:: @ 827A70E
compare VAR_TEMP_6, 1
goto_if_eq ContestHall_EventScript_AudienceMember6AlreadyEmoted
- applymovement 10, ContestHall_Movement_Heart
+ applymovement LOCALID_AUDIENCE_6, ContestHall_Movement_Heart
playse SE_PIN
delay 14
setvar VAR_TEMP_6, 1
@@ -761,7 +777,7 @@ ContestHall_EventScript_AudienceMember6AlreadyEmoted:: @ 827A731
ContestHall_EventScript_TryDisplayHeartAudienceMember7:: @ 827A732
compare VAR_TEMP_7, 1
goto_if_eq ContestHall_EventScript_AudienceMember7AlreadyEmoted
- applymovement 11, ContestHall_Movement_Heart
+ applymovement LOCALID_AUDIENCE_7, ContestHall_Movement_Heart
playse SE_PIN
delay 14
setvar VAR_TEMP_7, 1
@@ -774,7 +790,7 @@ ContestHall_EventScript_AudienceMember7AlreadyEmoted:: @ 827A755
ContestHall_EventScript_TryDisplayHeartAudienceMember8:: @ 827A756
compare VAR_TEMP_8, 1
goto_if_eq ContestHall_EventScript_AudienceMember8AlreadyEmoted
- applymovement 15, ContestHall_Movement_Heart
+ applymovement LOCALID_ARTIST, ContestHall_Movement_Heart
playse SE_PIN
delay 14
setvar VAR_TEMP_8, 1
@@ -787,7 +803,7 @@ ContestHall_EventScript_AudienceMember8AlreadyEmoted:: @ 827A779
ContestHall_EventScript_ContestantReturn:: @ 827A77A
closemessage
release
- removeobject 13 @ Poke Ball
+ removeobject LOCALID_POKEBALL
special HideContestEntryMonPic
call ContestHall_EventScript_TryWaitForLink
switch VAR_0x8006
@@ -831,13 +847,13 @@ ContestHall_EventScript_Player4WalkBack:: @ 827A7EF
ContestHall_EventScript_DoContestAppeals:: @ 827A801
lockall
- applymovement 1, ContestHall_Movement_FaceContestants2
+ applymovement LOCALID_MC, ContestHall_Movement_FaceContestants2
waitmovement 0
call ContestHall_EventScript_TryWaitForLink
call ContestHall_EventScript_LetsAppeal
waitmessage
- applymovement 1, ContestHall_Movement_WalkStageLeft
- applymovement 2, ContestHall_Movement_WalkStageRight
+ applymovement LOCALID_MC, ContestHall_Movement_WalkStageLeft
+ applymovement LOCALID_JUDGE, ContestHall_Movement_WalkStageRight
waitmovement 0
releaseall
call ContestHall_EventScript_TryWaitForLink
@@ -847,8 +863,8 @@ ContestHall_EventScript_DoContestAppeals:: @ 827A801
special LinkContestTryShowWirelessIndicator
setvar VAR_TEMP_9, 0
lockall
- applymovement 1, ContestHall_Movement_WalkStageRight
- applymovement 2, ContestHall_Movement_WalkStageLeft
+ applymovement LOCALID_MC, ContestHall_Movement_WalkStageRight
+ applymovement LOCALID_JUDGE, ContestHall_Movement_WalkStageLeft
waitmovement 0
releaseall
return
@@ -886,13 +902,13 @@ ContestHall_EventScript_ContestResults:: @ 827A8A5
call ContestHall_EventScript_TryWaitForLink
call ContestHall_EventScript_ThankYouForAppeals
call ContestHall_EventScript_TryWaitForLink
- applymovement 1, ContestHall_Movement_MCFaceJudge
+ applymovement LOCALID_MC, ContestHall_Movement_MCFaceJudge
waitmovement 0
call ContestHall_EventScript_JudgeLooksReady
call ContestHall_EventScript_TryWaitForLink
call ContestHall_EventScript_WeWillDeclareWinner
call ContestHall_EventScript_TryWaitForLink
- applymovement 1, ContestHall_Movement_FaceContestants
+ applymovement LOCALID_MC, ContestHall_Movement_FaceContestants
waitmovement 0
closemessage
releaseall
@@ -965,19 +981,19 @@ ContestHall_EventScript_GetWinnerObjEventId:: @ 827A987
return
ContestHall_EventScript_GetPlayer1ObjEventId:: @ 827A9BC
- setvar VAR_TEMP_3, 3
+ setvar VAR_TEMP_3, LOCALID_CONTESTANT_1
return
ContestHall_EventScript_GetPlayer2ObjEventId:: @ 827A9C2
- setvar VAR_TEMP_3, 4
+ setvar VAR_TEMP_3, LOCALID_CONTESTANT_2
return
ContestHall_EventScript_GetPlayer3ObjEventId:: @ 827A9C8
- setvar VAR_TEMP_3, 5
+ setvar VAR_TEMP_3, LOCALID_CONTESTANT_3
return
ContestHall_EventScript_GetPlayer4ObjEventId:: @ 827A9CE
- setvar VAR_TEMP_3, 14
+ setvar VAR_TEMP_3, LOCALID_CONTESTANT_4
return
ContestHall_EventScript_CongratulateWinner:: @ 827A9D4
@@ -1009,14 +1025,14 @@ ContestHall_EventScript_AudienceLookAround:: @ 827AA1B
lockall
compare VAR_CONTEST_TYPE, CONTEST_TYPE_NPC_NORMAL
call_if_gt ContestHall_EventScript_VObjectAudienceLookAround
- applymovement 9, ContestHall_Movement_AudienceMemberLookRight
- applymovement 12, ContestHall_Movement_AudienceMemberLookDown
- applymovement 7, ContestHall_Movement_AudienceMemberLookRight
+ applymovement LOCALID_AUDIENCE_5, ContestHall_Movement_AudienceMemberLookRight
+ applymovement LOCALID_AUDIENCE_2, ContestHall_Movement_AudienceMemberLookDown
+ applymovement LOCALID_AUDIENCE_3, ContestHall_Movement_AudienceMemberLookRight
delay 30
- applymovement 10, ContestHall_Movement_AudienceMemberLookLeft
- applymovement 11, ContestHall_Movement_AudienceMemberLookDown
- applymovement 6, ContestHall_Movement_AudienceMemberLookUp
- applymovement 8, ContestHall_Movement_AudienceMemberLookLeft
+ applymovement LOCALID_AUDIENCE_6, ContestHall_Movement_AudienceMemberLookLeft
+ applymovement LOCALID_AUDIENCE_7, ContestHall_Movement_AudienceMemberLookDown
+ applymovement LOCALID_AUDIENCE_1, ContestHall_Movement_AudienceMemberLookUp
+ applymovement LOCALID_AUDIENCE_4, ContestHall_Movement_AudienceMemberLookLeft
compare VAR_TEMP_1, 4
goto_if_ne ContestHall_EventScript_AudienceLookAround
delay 30
diff --git a/data/scripts/day_care.inc b/data/scripts/day_care.inc
index 6506897ee..87995581f 100644
--- a/data/scripts/day_care.inc
+++ b/data/scripts/day_care.inc
@@ -1,3 +1,5 @@
+.set LOCALID_DAYCARE_LADY, 1
+
Route117_EventScript_DaycareMan:: @ 8291C18
lock
faceplayer
@@ -211,7 +213,7 @@ Route117_PokemonDayCare_EventScript_CheckEnoughMoney:: @ 8291EC8
end
Route117_PokemonDayCare_EventScript_RetrieveMon:: @ 8291EE2
- applymovement 1, Route117_PokemonDayCare_Movement_RetrieveDaycareMon
+ applymovement LOCALID_DAYCARE_LADY, Route117_PokemonDayCare_Movement_RetrieveDaycareMon
waitmovement 0
specialvar VAR_RESULT, TakePokemonFromDaycare
special SubtractMoneyFromVar0x8005
diff --git a/data/scripts/gabby_and_ty.inc b/data/scripts/gabby_and_ty.inc
index dfe8780e7..84cd315f7 100644
--- a/data/scripts/gabby_and_ty.inc
+++ b/data/scripts/gabby_and_ty.inc
@@ -13,6 +13,7 @@ EventScript_UnusedRet:: @ 828CCC6
@ Gabby and Ty always move to the same spots for the first 5 battles
@ From the 6th battle onwards, they move randomly between locations 6-8
+@ Note: The local IDs of Gabby and Ty are hard-coded in GabbyAndTySetScriptVarsToObjectEventLocalIds
GabbyAndTy_EventScript_UpdateLocation:: @ 828CCC7
cleartrainerflag TRAINER_GABBY_AND_TY_6
specialvar VAR_RESULT, GabbyAndTyGetBattleNum
diff --git a/data/scripts/lilycove_lady.inc b/data/scripts/lilycove_lady.inc
index bdd670031..7f629e5db 100644
--- a/data/scripts/lilycove_lady.inc
+++ b/data/scripts/lilycove_lady.inc
@@ -1,3 +1,6 @@
+.set LOCALID_LILYCOVE_LADY, 4
+.set LOCALID_LADYS_MON, 5
+
LilycoveCity_PokemonCenter_1F_EventScript_LilycoveLady:: @ 82A836B
special Script_GetLilycoveLadyId
switch VAR_RESULT
@@ -444,10 +447,10 @@ LilycoveCity_PokemonCenter_1F_EventScript_GivePokeblock:: @ 82A88F6
@ VAR_0x8004 here is the return value from GivePokeblockToContestLady
LilycoveCity_PokemonCenter_1F_EventScript_FeedPokeblock:: @ 82A890A
- applymovement 4, LilycoveCity_PokemonCenter_1F_Movement_LadyFaceMon
+ applymovement LOCALID_LILYCOVE_LADY, LilycoveCity_PokemonCenter_1F_Movement_LadyFaceMon
waitmovement 0
delay 60
- applymovement 5, LilycoveCity_PokemonCenter_1F_Movement_MonFaceLady
+ applymovement LOCALID_LADYS_MON, LilycoveCity_PokemonCenter_1F_Movement_MonFaceLady
waitmovement 0
delay 60
waitse
@@ -461,11 +464,11 @@ LilycoveCity_PokemonCenter_1F_EventScript_FeedPokeblock:: @ 82A890A
@ VAR_0x8004 here is the return value from GivePokeblockToContestLady
LilycoveCity_PokemonCenter_1F_EventScript_MonEnjoyPokeblock:: @ 82A893F
- applymovement 5, LilycoveCity_PokemonCenter_1F_Movement_MonJump
+ applymovement LOCALID_LADYS_MON, LilycoveCity_PokemonCenter_1F_Movement_MonJump
waitmovement 0
delay 60
LilycoveCity_PokemonCenter_1F_EventScript_FinishFeedPokeblock:: @ 82A894C
- applymovement 4, LilycoveCity_PokemonCenter_1F_Movement_LadyFacePlayer
+ applymovement LOCALID_LILYCOVE_LADY, LilycoveCity_PokemonCenter_1F_Movement_LadyFacePlayer
waitmovement 0
delay 60
compare VAR_0x8004, 0
diff --git a/data/scripts/new_game.inc b/data/scripts/new_game.inc
index 74fff4aea..3c68dfa13 100644
--- a/data/scripts/new_game.inc
+++ b/data/scripts/new_game.inc
@@ -195,7 +195,7 @@ EventScript_ResetAllMapFlags:: @ 82715DE
setflag FLAG_HIDE_MAUVILLE_CITY_SCOTT
setflag FLAG_HIDE_CHAMPIONS_ROOM_RIVAL
setflag FLAG_HIDE_CHAMPIONS_ROOM_BIRCH
- setflag FLAG_HIDE_ROUTE_110_RIVAL_2
+ setflag FLAG_HIDE_ROUTE_110_RIVAL_ON_BIKE
setflag FLAG_HIDE_ROUTE_119_RIVAL_ON_BIKE
setflag FLAG_HIDE_ROUTE_104_RIVAL
setflag FLAG_HIDE_LILCOVE_MOTEL_GAME_DESIGNERS
diff --git a/data/scripts/players_house.inc b/data/scripts/players_house.inc
index b6ab10300..440f47a6a 100644
--- a/data/scripts/players_house.inc
+++ b/data/scripts/players_house.inc
@@ -1,3 +1,8 @@
+@ Local IDs are the same for both players houses
+.set LOCALID_MOM, 1
+.set LOCALID_DAD, 5
+.set LOCALID_MOM_2F, 14
+
PlayersHouse_2F_EventScript_BlockStairsUntilClockIsSet:: @ 82926FE
setvar VAR_LITTLEROOT_INTRO_STATE, 5
return
@@ -74,7 +79,7 @@ PlayersHouse_2F_EventScript_WallClock:: @ 8292799
end
PlayersHouse_2F_EventScript_MomComesUpstairsMale:: @ 82927DF
- setvar VAR_0x8008, 14
+ setvar VAR_0x8008, LOCALID_MOM_2F
addobject VAR_0x8008
applymovement VAR_0x8008, PlayersHouse_2F_Movement_MomEntersMale
waitmovement 0
@@ -87,7 +92,7 @@ PlayersHouse_2F_EventScript_MomComesUpstairsMale:: @ 82927DF
return
PlayersHouse_2F_EventScript_MomComesUpstairsFemale:: @ 829280F
- setvar VAR_0x8008, 14
+ setvar VAR_0x8008, LOCALID_MOM_2F
addobject VAR_0x8008
applymovement VAR_0x8008, PlayersHouse_2F_Movement_MomEntersFemale
waitmovement 0
@@ -514,14 +519,14 @@ PlayersHouse_1F_EventScript_AirLatiBroadcast:: @ 8292C72
PlayersHouse_1F_EventScript_SetUpObjectEventVarsMale:: @ 8292C76
setvar VAR_0x8008, MALE
- setvar VAR_0x8009, 5 @ Dad object event ID
- setvar VAR_0x800A, 1 @ Mom object event ID
+ setvar VAR_0x8009, LOCALID_DAD
+ setvar VAR_0x800A, LOCALID_MOM
return
PlayersHouse_1F_EventScript_SetUpObjectEventVarsFemale:: @ 8292C86
setvar VAR_0x8008, FEMALE
- setvar VAR_0x8009, 5 @ Dad object event ID
- setvar VAR_0x800A, 1 @ Mom object event ID
+ setvar VAR_0x8009, LOCALID_DAD
+ setvar VAR_0x800A, LOCALID_MOM
return
PlayersHouse_1F_EventScript_DadApproachPlayerMale:: @ 8292C96
diff --git a/data/scripts/secret_base.inc b/data/scripts/secret_base.inc
index b5c3251b5..0de890aa6 100644
--- a/data/scripts/secret_base.inc
+++ b/data/scripts/secret_base.inc
@@ -308,7 +308,7 @@ SecretBase_EventScript_PutAwayDecorationLoop:: @ 8275D39
compare VAR_0x8005, 0
goto_if_eq SecretBase_EventScript_PutAwayDecorationLoop
removeobject VAR_0x8006
- setflag 0x8005 @ UB: GF likely meant setvar here; setflag 0x8005 is out of bounds
+ setflag VAR_0x8005 @ UB: GF likely meant setvar here; setflag 0x8005 is out of bounds
goto SecretBase_EventScript_PutAwayDecorationLoop
end
diff --git a/data/specials.inc b/data/specials.inc
index 97cc3c782..0f78f981f 100644
--- a/data/specials.inc
+++ b/data/specials.inc
@@ -39,7 +39,7 @@ gSpecials:: @ 81DBA64
def_special TryBattleLinkup
def_special TryTradeLinkup
def_special TryRecordMixLinkup
- def_special sub_80B2EA8
+ def_special ValidateMixingGameLanguage
def_special CloseLink
def_special ColosseumPlayerSpotTriggered
def_special PlayerEnteredTradeSeat
@@ -426,8 +426,8 @@ gSpecials:: @ 81DBA64
def_special IsWirelessAdapterConnected
def_special TryBecomeLinkLeader
def_special TryJoinLinkGroup
- def_special UnionRoomSpecial
- def_special sub_801A42C
+ def_special RunUnionRoom
+ def_special ShowWirelessCommunicationScreen
def_special InitUnionRoom
def_special BufferUnionRoomPlayerName
def_special sub_801DC20
@@ -498,11 +498,11 @@ gSpecials:: @ 81DBA64
def_special GetPCBoxToSendMon
def_special ShouldShowBoxWasFullMessage
def_special SetMatchCallRegisteredFlag
- def_special DoConfettiEffect
+ def_special DoDomeConfetti
def_special CreateAbnormalWeatherEvent
def_special GetAbnormalWeatherMapNameAndType
def_special GetMartEmployeeObjectEventId
- def_special sub_80A08CC
+ def_special SaveForBattleTowerLink
def_special Unused_SetWeatherSunny
def_special SetUnlockedPokedexFlags
def_special IsTrainerRegistered
diff --git a/gflib/text.h b/gflib/text.h
index 4819eb37b..5b317600e 100644
--- a/gflib/text.h
+++ b/gflib/text.h
@@ -1,95 +1,183 @@
#ifndef GUARD_TEXT_H
#define GUARD_TEXT_H
-#define CHAR_SPACE 0x00
-#define CHAR_PLUS 0x2E
-#define CHAR_0 0xA1
-#define CHAR_1 0xA2
-#define CHAR_2 0xA3
-#define CHAR_3 0xA4
-#define CHAR_4 0xA5
-#define CHAR_5 0xA6
-#define CHAR_6 0xA7
-#define CHAR_7 0xA8
-#define CHAR_8 0xA9
-#define CHAR_9 0xAA
-#define CHAR_EXCL_MARK 0xAB
-#define CHAR_QUESTION_MARK 0xAC
-#define CHAR_PERIOD 0xAD
-#define CHAR_HYPHEN 0xAE
-#define CHAR_ELLIPSIS 0xB0
-#define CHAR_DBL_QUOT_LEFT 0xB1
-#define CHAR_DBL_QUOT_RIGHT 0xB2
-#define CHAR_SGL_QUOT_LEFT 0xB3
-#define CHAR_SGL_QUOT_RIGHT 0xB4
-#define CHAR_MALE 0xB5
-#define CHAR_FEMALE 0xB6
-#define CHAR_CURRENCY 0xB7
-#define CHAR_COMMA 0xB8
-#define CHAR_MULT_SIGN 0xB9
-#define CHAR_SLASH 0xBA
-#define CHAR_A 0xBB
-#define CHAR_B 0xBC
-#define CHAR_C 0xBD
-#define CHAR_D 0xBE
-#define CHAR_E 0xBF
-#define CHAR_F 0xC0
-#define CHAR_G 0xC1
-#define CHAR_H 0xC2
-#define CHAR_I 0xC3
-#define CHAR_J 0xC4
-#define CHAR_K 0xC5
-#define CHAR_L 0xC6
-#define CHAR_M 0xC7
-#define CHAR_N 0xC8
-#define CHAR_O 0xC9
-#define CHAR_P 0xCA
-#define CHAR_Q 0xCB
-#define CHAR_R 0xCC
-#define CHAR_S 0xCD
-#define CHAR_T 0xCE
-#define CHAR_U 0xCF
-#define CHAR_V 0xD0
-#define CHAR_W 0xD1
-#define CHAR_X 0xD2
-#define CHAR_Y 0xD3
-#define CHAR_Z 0xD4
-#define CHAR_a 0xD5
-#define CHAR_b 0xD6
-#define CHAR_c 0xD7
-#define CHAR_d 0xD8
-#define CHAR_e 0xD9
-#define CHAR_f 0xDA
-#define CHAR_g 0xDB
-#define CHAR_h 0xDC
-#define CHAR_i 0xDD
-#define CHAR_j 0xDE
-#define CHAR_k 0xDF
-#define CHAR_l 0xE0
-#define CHAR_m 0xE1
-#define CHAR_n 0xE2
-#define CHAR_o 0xE3
-#define CHAR_p 0xE4
-#define CHAR_q 0xE5
-#define CHAR_r 0xE6
-#define CHAR_s 0xE7
-#define CHAR_t 0xE8
-#define CHAR_u 0xE9
-#define CHAR_v 0xEA
-#define CHAR_w 0xEB
-#define CHAR_x 0xEC
-#define CHAR_y 0xED
-#define CHAR_z 0xEE
-#define CHAR_SPECIAL_F7 0xF7
-#define CHAR_SPECIAL_F8 0xF8
-#define CHAR_SPECIAL_F9 0xF9
-#define CHAR_COLON 0xF0
-#define CHAR_PROMPT_SCROLL 0xFA // waits for button press and scrolls dialog
-#define CHAR_PROMPT_CLEAR 0xFB // waits for button press and clears dialog
-#define EXT_CTRL_CODE_BEGIN 0xFC // extended control code
-#define PLACEHOLDER_BEGIN 0xFD // string placeholder
-#define CHAR_NEWLINE 0xFE
-#define EOS 0xFF // end of string
+#define CHAR_SPACE 0x00
+#define CHAR_A_GRAVE 0x01
+#define CHAR_A_ACUTE 0x02
+#define CHAR_A_CIRCUMFLEX 0x03
+#define CHAR_C_CEDILLA 0x04
+#define CHAR_E_GRAVE 0x05
+#define CHAR_E_ACUTE 0x06
+#define CHAR_E_CIRCUMFLEX 0x07
+#define CHAR_E_DIAERESIS 0x08
+#define CHAR_I_GRAVE 0x09
+//#define CHAR_I_ACUTE 0x0A // Is 0x5A instead
+#define CHAR_I_CIRCUMFLEX 0x0B
+#define CHAR_I_DIAERESIS 0x0C
+#define CHAR_O_GRAVE 0x0D
+#define CHAR_O_ACUTE 0x0E
+#define CHAR_O_CIRCUMFLEX 0x0F
+#define CHAR_OE 0x10
+#define CHAR_U_GRAVE 0x11
+#define CHAR_U_ACUTE 0x12
+#define CHAR_U_CIRCUMFLEX 0x13
+#define CHAR_N_TILDE 0x14
+#define CHAR_ESZETT 0x15
+#define CHAR_a_GRAVE 0x16
+#define CHAR_a_ACUTE 0x17
+//#define CHAR_a_CIRCUMFLEX 0x18 // Is 0x68 instead
+#define CHAR_c_CEDILLA 0x19
+#define CHAR_e_GRAVE 0x1A
+#define CHAR_e_ACUTE 0x1B
+#define CHAR_e_CIRCUMFLEX 0x1C
+#define CHAR_e_DIAERESIS 0x1D
+#define CHAR_i_GRAVE 0x1E
+//#define CHAR_i_ACUTE 0x1F // Is 0x6F instead
+#define CHAR_i_CIRCUMFLEX 0x20
+#define CHAR_i_DIAERESIS 0x21
+#define CHAR_o_GRAVE 0x22
+#define CHAR_o_ACUTE 0x23
+#define CHAR_o_CIRCUMFLEX 0x24
+#define CHAR_oe 0x25
+#define CHAR_u_GRAVE 0x26
+#define CHAR_u_ACUTE 0x27
+#define CHAR_u_CIRCUMFLEX 0x28
+#define CHAR_n_TILDE 0x29
+#define CHAR_MASCULINE_ORDINAL 0x2A
+#define CHAR_FEMININE_ORDINAL 0x2B
+#define CHAR_SUPER_ER 0x2C
+#define CHAR_AMPERSAND 0x2D
+#define CHAR_PLUS 0x2E
+//
+#define CHAR_LV 0x34
+#define CHAR_EQUALS 0x35
+#define CHAR_SEMICOLON 0x36
+//
+#define CHAR_INV_QUESTION_MARK 0x51
+#define CHAR_INV_EXCL_MARK 0x52
+#define CHAR_PK 0x53
+#define CHAR_MN 0x54
+#define CHAR_PO 0x55
+#define CHAR_KE 0x56
+#define CHAR_BLOCK_1 0x57 // Each of these 3
+#define CHAR_BLOCK_2 0x58 // chars contains 1/3
+#define CHAR_BLOCK_3 0x59 // of the word BLOCK
+#define CHAR_I_ACUTE 0x5A
+#define CHAR_PERCENT 0x5B
+#define CHAR_LEFT_PAREN 0x5C
+#define CHAR_RIGHT_PAREN 0x5D
+//
+#define CHAR_a_CIRCUMFLEX 0x68
+//
+#define CHAR_i_ACUTE 0x6F
+//
+#define CHAR_UNK_SPACER 0x77
+//
+#define CHAR_UP_ARROW 0x79
+#define CHAR_DOWN_ARROW 0x7A
+#define CHAR_LEFT_ARROW 0x7B
+#define CHAR_RIGHT_ARROW 0x7C
+//
+#define CHAR_SUPER_E 0x84
+#define CHAR_LESS_THAN 0x85
+#define CHAR_GREATER_THAN 0x86
+//
+#define CHAR_SUPER_RE 0xA0
+#define CHAR_0 0xA1
+#define CHAR_1 0xA2
+#define CHAR_2 0xA3
+#define CHAR_3 0xA4
+#define CHAR_4 0xA5
+#define CHAR_5 0xA6
+#define CHAR_6 0xA7
+#define CHAR_7 0xA8
+#define CHAR_8 0xA9
+#define CHAR_9 0xAA
+#define CHAR_EXCL_MARK 0xAB
+#define CHAR_QUESTION_MARK 0xAC
+#define CHAR_PERIOD 0xAD
+#define CHAR_HYPHEN 0xAE
+#define CHAR_BULLET 0xAF
+#define CHAR_ELLIPSIS 0xB0
+#define CHAR_DBL_QUOT_LEFT 0xB1
+#define CHAR_DBL_QUOT_RIGHT 0xB2
+#define CHAR_SGL_QUOT_LEFT 0xB3
+#define CHAR_SGL_QUOT_RIGHT 0xB4
+#define CHAR_MALE 0xB5
+#define CHAR_FEMALE 0xB6
+#define CHAR_CURRENCY 0xB7
+#define CHAR_COMMA 0xB8
+#define CHAR_MULT_SIGN 0xB9
+#define CHAR_SLASH 0xBA
+#define CHAR_A 0xBB
+#define CHAR_B 0xBC
+#define CHAR_C 0xBD
+#define CHAR_D 0xBE
+#define CHAR_E 0xBF
+#define CHAR_F 0xC0
+#define CHAR_G 0xC1
+#define CHAR_H 0xC2
+#define CHAR_I 0xC3
+#define CHAR_J 0xC4
+#define CHAR_K 0xC5
+#define CHAR_L 0xC6
+#define CHAR_M 0xC7
+#define CHAR_N 0xC8
+#define CHAR_O 0xC9
+#define CHAR_P 0xCA
+#define CHAR_Q 0xCB
+#define CHAR_R 0xCC
+#define CHAR_S 0xCD
+#define CHAR_T 0xCE
+#define CHAR_U 0xCF
+#define CHAR_V 0xD0
+#define CHAR_W 0xD1
+#define CHAR_X 0xD2
+#define CHAR_Y 0xD3
+#define CHAR_Z 0xD4
+#define CHAR_a 0xD5
+#define CHAR_b 0xD6
+#define CHAR_c 0xD7
+#define CHAR_d 0xD8
+#define CHAR_e 0xD9
+#define CHAR_f 0xDA
+#define CHAR_g 0xDB
+#define CHAR_h 0xDC
+#define CHAR_i 0xDD
+#define CHAR_j 0xDE
+#define CHAR_k 0xDF
+#define CHAR_l 0xE0
+#define CHAR_m 0xE1
+#define CHAR_n 0xE2
+#define CHAR_o 0xE3
+#define CHAR_p 0xE4
+#define CHAR_q 0xE5
+#define CHAR_r 0xE6
+#define CHAR_s 0xE7
+#define CHAR_t 0xE8
+#define CHAR_u 0xE9
+#define CHAR_v 0xEA
+#define CHAR_w 0xEB
+#define CHAR_x 0xEC
+#define CHAR_y 0xED
+#define CHAR_z 0xEE
+#define CHAR_BLACK_TRIANGLE 0xEF
+#define CHAR_COLON 0xF0
+#define CHAR_A_DIAERESIS 0xF1
+#define CHAR_O_DIAERESIS 0xF2
+#define CHAR_U_DIAERESIS 0xF3
+#define CHAR_a_DIAERESIS 0xF4
+#define CHAR_o_DIAERESIS 0xF5
+#define CHAR_u_DIAERESIS 0xF6
+#define CHAR_SPECIAL_F7 0xF7
+#define CHAR_SPECIAL_F8 0xF8
+#define CHAR_SPECIAL_F9 0xF9
+#define CHAR_PROMPT_SCROLL 0xFA // waits for button press and scrolls dialog
+#define CHAR_PROMPT_CLEAR 0xFB // waits for button press and clears dialog
+#define EXT_CTRL_CODE_BEGIN 0xFC // extended control code
+#define PLACEHOLDER_BEGIN 0xFD // string placeholder
+#define CHAR_NEWLINE 0xFE
+#define EOS 0xFF // end of string
// Special F9 chars
#define CHAR_UP_ARROW_2 0x00
diff --git a/graphics/contest/clink_tilemap11.bin b/graphics/contest/results_screen.bin
index 3b46e00b8..3b46e00b8 100644
--- a/graphics/contest/clink_tilemap11.bin
+++ b/graphics/contest/results_screen.bin
Binary files differ
diff --git a/graphics/contest/misc_2.pal b/graphics/contest/results_screen.pal
index 869aef9e1..869aef9e1 100644
--- a/graphics/contest/misc_2.pal
+++ b/graphics/contest/results_screen.pal
diff --git a/graphics/contest/misc_2.png b/graphics/contest/results_screen.png
index 106b975cf..106b975cf 100644
--- a/graphics/contest/misc_2.png
+++ b/graphics/contest/results_screen.png
Binary files differ
diff --git a/graphics/contest/clink_tilemap7.bin b/graphics/contest/results_screen_beauty.bin
index fe02ec0b5..fe02ec0b5 100644
--- a/graphics/contest/clink_tilemap7.bin
+++ b/graphics/contest/results_screen_beauty.bin
diff --git a/graphics/contest/clink_tilemap6.bin b/graphics/contest/results_screen_cool.bin
index f3939831e..f3939831e 100644
--- a/graphics/contest/clink_tilemap6.bin
+++ b/graphics/contest/results_screen_cool.bin
Binary files differ
diff --git a/graphics/contest/clink_tilemap8.bin b/graphics/contest/results_screen_cute.bin
index d37d6df3c..d37d6df3c 100644
--- a/graphics/contest/clink_tilemap8.bin
+++ b/graphics/contest/results_screen_cute.bin
diff --git a/graphics/contest/clink_tilemap3.bin b/graphics/contest/results_screen_hyper.bin
index d4bb7bae7..d4bb7bae7 100644
--- a/graphics/contest/clink_tilemap3.bin
+++ b/graphics/contest/results_screen_hyper.bin
Binary files differ
diff --git a/graphics/contest/clink_tilemap5.bin b/graphics/contest/results_screen_link.bin
index cc07b0f1a..cc07b0f1a 100644
--- a/graphics/contest/clink_tilemap5.bin
+++ b/graphics/contest/results_screen_link.bin
Binary files differ
diff --git a/graphics/contest/clink_tilemap4.bin b/graphics/contest/results_screen_master.bin
index 32f24abd6..32f24abd6 100644
--- a/graphics/contest/clink_tilemap4.bin
+++ b/graphics/contest/results_screen_master.bin
Binary files differ
diff --git a/graphics/contest/clink_tilemap1.bin b/graphics/contest/results_screen_normal.bin
index e22f21839..e22f21839 100644
--- a/graphics/contest/clink_tilemap1.bin
+++ b/graphics/contest/results_screen_normal.bin
Binary files differ
diff --git a/graphics/contest/clink_tilemap9.bin b/graphics/contest/results_screen_smart.bin
index 79d2e3fbb..79d2e3fbb 100644
--- a/graphics/contest/clink_tilemap9.bin
+++ b/graphics/contest/results_screen_smart.bin
diff --git a/graphics/contest/clink_tilemap2.bin b/graphics/contest/results_screen_super.bin
index 21c804d12..21c804d12 100644
--- a/graphics/contest/clink_tilemap2.bin
+++ b/graphics/contest/results_screen_super.bin
Binary files differ
diff --git a/graphics/contest/clink_tilemap10.bin b/graphics/contest/results_screen_tough.bin
index 2a91bb78d..2a91bb78d 100644
--- a/graphics/contest/clink_tilemap10.bin
+++ b/graphics/contest/results_screen_tough.bin
diff --git a/graphics/misc/birch_ballarrow.png b/graphics/misc/pokeball_selection.png
index d2f0a3d97..d2f0a3d97 100644
--- a/graphics/misc/birch_ballarrow.png
+++ b/graphics/misc/pokeball_selection.png
Binary files differ
diff --git a/graphics/misc/birch_circle.png b/graphics/misc/starter_circle.png
index 3501dfec4..3501dfec4 100644
--- a/graphics/misc/birch_circle.png
+++ b/graphics/misc/starter_circle.png
Binary files differ
diff --git a/graphics/link/misc.bin b/graphics/union_room_chat/background.bin
index e91b50c8d..e91b50c8d 100644
--- a/graphics/link/misc.bin
+++ b/graphics/union_room_chat/background.bin
Binary files differ
diff --git a/graphics/link/misc.png b/graphics/union_room_chat/background.png
index ae6ba4d02..ae6ba4d02 100644
--- a/graphics/link/misc.png
+++ b/graphics/union_room_chat/background.png
Binary files differ
diff --git a/graphics/link/link_winedge.bin b/graphics/union_room_chat/border.bin
index f3e264d05..f3e264d05 100644
--- a/graphics/link/link_winedge.bin
+++ b/graphics/union_room_chat/border.bin
Binary files differ
diff --git a/graphics/link/link_winedge.png b/graphics/union_room_chat/border.png
index 86ddacc03..86ddacc03 100644
--- a/graphics/link/link_winedge.png
+++ b/graphics/union_room_chat/border.png
Binary files differ
diff --git a/graphics/interface/unk_palette3.pal b/graphics/union_room_chat/interface.pal
index 071f73b42..071f73b42 100644
--- a/graphics/interface/unk_palette3.pal
+++ b/graphics/union_room_chat/interface.pal
diff --git a/graphics/interface/unk_cursor.png b/graphics/union_room_chat/keyboard_cursor.png
index fac4e0a93..fac4e0a93 100644
--- a/graphics/interface/unk_cursor.png
+++ b/graphics/union_room_chat/keyboard_cursor.png
Binary files differ
diff --git a/graphics/interface/unk_rbutton.png b/graphics/union_room_chat/r_button.png
index 168a293f3..168a293f3 100644
--- a/graphics/interface/unk_rbutton.png
+++ b/graphics/union_room_chat/r_button.png
Binary files differ
diff --git a/graphics/interface/unk_change_case.png b/graphics/union_room_chat/r_button_labels.png
index 185c4abf5..185c4abf5 100644
--- a/graphics/interface/unk_change_case.png
+++ b/graphics/union_room_chat/r_button_labels.png
Binary files differ
diff --git a/graphics/interface/unk_cursor_arrow.png b/graphics/union_room_chat/text_entry_arrow.png
index 574758cdf..574758cdf 100644
--- a/graphics/interface/unk_cursor_arrow.png
+++ b/graphics/union_room_chat/text_entry_arrow.png
Binary files differ
diff --git a/graphics/interface/unk_dash.png b/graphics/union_room_chat/text_entry_cursor.png
index 34c3709cf..34c3709cf 100644
--- a/graphics/interface/unk_dash.png
+++ b/graphics/union_room_chat/text_entry_cursor.png
Binary files differ
diff --git a/graphics/interface/unk_palette1.pal b/graphics/union_room_chat/unk_palette1.pal
index 12bc76261..12bc76261 100644
--- a/graphics/interface/unk_palette1.pal
+++ b/graphics/union_room_chat/unk_palette1.pal
diff --git a/graphics/interface/unk_palette2.pal b/graphics/union_room_chat/unk_palette2.pal
index d2a55fec6..d2a55fec6 100644
--- a/graphics/interface/unk_palette2.pal
+++ b/graphics/union_room_chat/unk_palette2.pal
diff --git a/graphics/link/link1.pal b/graphics/union_room_chat/window_1.pal
index a86815b0e..a86815b0e 100644
--- a/graphics/link/link1.pal
+++ b/graphics/union_room_chat/window_1.pal
diff --git a/graphics/link/link2.pal b/graphics/union_room_chat/window_2.pal
index a8c95a3c0..a8c95a3c0 100644
--- a/graphics/link/link2.pal
+++ b/graphics/union_room_chat/window_2.pal
diff --git a/include/battle.h b/include/battle.h
index b377dc23c..7da040188 100644
--- a/include/battle.h
+++ b/include/battle.h
@@ -390,7 +390,7 @@ struct BattleStruct
u8 expGetterBattlerId;
u8 unused_5;
u8 field_91; // related to gAbsentBattlerFlags, possibly absent flags turn ago?
- u8 field_92; // battle palace related
+ u8 palaceFlags; // First 4 bits are "is < 50% HP and not asleep" for each battler, last 4 bits are selected moves to pass to AI
u8 field_93; // related to choosing pokemon?
u8 wallyBattleState;
u8 wallyMovesState;
diff --git a/include/battle_main.h b/include/battle_main.h
index e04db17bb..217b10b39 100644
--- a/include/battle_main.h
+++ b/include/battle_main.h
@@ -57,15 +57,15 @@ u32 sub_80397C4(u32 setId, u32 tableId);
void SpriteCb_WildMon(struct Sprite *sprite);
void SpriteCallbackDummy_2(struct Sprite *sprite);
void SpriteCB_FaintOpponentMon(struct Sprite *sprite);
-void sub_8039AD8(struct Sprite *sprite);
-void sub_8039B2C(struct Sprite *sprite);
-void sub_8039B58(struct Sprite *sprite);
+void SpriteCb_ShowAsMoveTarget(struct Sprite *sprite);
+void SpriteCb_HideAsMoveTarget(struct Sprite *sprite);
+void SpriteCb_OpponentMonFromBall(struct Sprite *sprite);
void sub_8039BB4(struct Sprite *sprite);
void sub_80105DC(struct Sprite *sprite);
void sub_8039C00(struct Sprite *sprite);
void DoBounceEffect(u8 battlerId, u8 b, s8 c, s8 d);
void EndBounceEffect(u8 battlerId, bool8 b);
-void sub_8039E44(struct Sprite *sprite);
+void SpriteCb_PlayerMonFromBall(struct Sprite *sprite);
void sub_8039E60(struct Sprite *sprite);
void sub_8039E84(struct Sprite *sprite);
void sub_8039E9C(struct Sprite *sprite);
diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h
index 142ac1f7b..ee3676463 100644
--- a/include/battle_script_commands.h
+++ b/include/battle_script_commands.h
@@ -1,6 +1,8 @@
#ifndef GUARD_BATTLE_SCRIPT_COMMANDS_H
#define GUARD_BATTLE_SCRIPT_COMMANDS_H
+#include "constants/pokemon.h"
+
#define WINDOW_CLEAR 0x1
#define WINDOW_x80 0x80
@@ -16,6 +18,6 @@ void HandleBattleWindow(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags);
bool8 UproarWakeUpCheck(u8 battlerId);
extern void (* const gBattleScriptingCommandsTable[])(void);
-extern const u8 gUnknown_0831C494[][4];
+extern const u8 gBattlePalaceNatureToMoveGroupLikelihood[NUM_NATURES][4];
#endif // GUARD_BATTLE_SCRIPT_COMMANDS_H
diff --git a/include/battle_scripts.h b/include/battle_scripts.h
index 75abaae3c..706d41097 100644
--- a/include/battle_scripts.h
+++ b/include/battle_scripts.h
@@ -205,7 +205,7 @@ extern const u8 BattleScript_BerryStatRaiseEnd2[];
extern const u8 BattleScript_BerryFocusEnergyEnd2[];
extern const u8 BattleScript_ActionSelectionItemsCantBeUsed[];
extern const u8 BattleScript_ArenaTurnBeginning[];
-extern const u8 BattleScript_82DB881[];
+extern const u8 BattleScript_PalacePrintFlavorText[];
extern const u8 BattleScript_ArenaDoJudgment[];
extern const u8 BattleScript_82DAA0B[];
extern const u8 BattleScript_AskIfWantsToForfeitMatch[];
diff --git a/include/berry_crush.h b/include/berry_crush.h
index 8909ae821..a08f1f699 100755
--- a/include/berry_crush.h
+++ b/include/berry_crush.h
@@ -3,6 +3,6 @@
#include "main.h"
-void sub_8020C70(MainCallback callback);
+void StartBerryCrush(MainCallback callback);
#endif // GUARD_BERRY_CRUSH_H
diff --git a/include/cable_club.h b/include/cable_club.h
index c2849ca3e..7340742ea 100644
--- a/include/cable_club.h
+++ b/include/cable_club.h
@@ -3,18 +3,12 @@
#include "task.h"
-// Exported type declarations
-
-// Exported RAM declarations
-
-// Exported ROM declarations
-
-void sub_80B37D4(TaskFunc taskFunc);
-u8 sub_80B3050(void);
-void sub_80B360C(void);
-bool32 sub_80B2AF4(u16 *arg0, u16 *arg1);
+void CreateTask_EnterCableClubSeat(TaskFunc taskFunc);
+u8 CreateTask_ReestablishCableClubLink(void);
+void CB2_ReturnFromCableClubBattle(void);
+bool32 AreBattleTowerLinkSpeciesSame(u16 *speciesList1, u16 *speciesList2);
void sub_80B3AF8(u8 taskId);
-void task00_08081A90(u8 taskId);
+void Task_WaitForLinkPlayerConnection(u8 taskId);
bool32 GetLinkTrainerCardColor(u8 linkPlayerIndex);
#endif //GUARD_CABLE_CLUB_H
diff --git a/include/confetti_util.h b/include/confetti_util.h
new file mode 100644
index 000000000..ecc05a220
--- /dev/null
+++ b/include/confetti_util.h
@@ -0,0 +1,33 @@
+#ifndef GUARD_CONFETTI_UTIL_H
+#define GUARD_CONFETTI_UTIL_H
+
+struct ConfettiUtil
+{
+ struct OamData oam;
+ s16 x;
+ s16 y;
+ s16 xDelta;
+ s16 yDelta;
+ u16 tileTag;
+ u16 palTag;
+ u16 tileNum;
+ u8 id;
+ u8 filler;
+ u8 animNum;
+ u8 active:1;
+ u8 allowUpdates:1;
+ u8 dummied:1;
+ u8 priority:2;
+ s16 data[8];
+ void (*callback)(struct ConfettiUtil *);
+};
+
+bool32 ConfettiUtil_Init(u8 count);
+bool32 ConfettiUtil_Free(void);
+bool32 ConfettiUtil_Update(void);
+u8 ConfettiUtil_SetCallback(u8 id, void (*func)(struct ConfettiUtil *));
+u8 ConfettiUtil_SetData(u8 id, u8 dataArrayId, s16 dataValue);
+u8 ConfettiUtil_AddNew(const struct OamData *oam, u16 tileTag, u16 palTag, s16 x, s16 y, u8 animNum, u8 priority);
+u8 ConfettiUtil_Remove(u8 id);
+
+#endif // GUARD_CONFETTI_UTIL_H
diff --git a/include/config.h b/include/config.h
index 318ed39d8..4f97a12a3 100644
--- a/include/config.h
+++ b/include/config.h
@@ -26,4 +26,12 @@
#define UNITS_METRIC
#endif
+// Various undefined behavior bugs may or may not prevent compilation with
+// newer compilers. So always fix them when using a modern compiler.
+#if MODERN
+#ifndef UBFIX
+#define UBFIX
+#endif
+#endif
+
#endif // GUARD_CONFIG_H
diff --git a/include/constants/battle.h b/include/constants/battle.h
index 346d5d9ea..8b860e384 100644
--- a/include/constants/battle.h
+++ b/include/constants/battle.h
@@ -37,146 +37,156 @@
#define B_SIDE_PLAYER 0
#define B_SIDE_OPPONENT 1
-#define B_FLANK_LEFT 0
+#define B_FLANK_LEFT 0
#define B_FLANK_RIGHT 1
#define BIT_SIDE 1
#define BIT_FLANK 2
// Battle Type Flags
-#define BATTLE_TYPE_DOUBLE 0x0001
-#define BATTLE_TYPE_LINK 0x0002
-#define BATTLE_TYPE_IS_MASTER 0x0004 // In not-link battles, it's always set.
-#define BATTLE_TYPE_TRAINER 0x0008
-#define BATTLE_TYPE_FIRST_BATTLE 0x0010
-#define BATTLE_TYPE_20 0x0020
-#define BATTLE_TYPE_MULTI 0x0040
-#define BATTLE_TYPE_SAFARI 0x0080
-#define BATTLE_TYPE_BATTLE_TOWER 0x0100
-#define BATTLE_TYPE_WALLY_TUTORIAL 0x0200
-#define BATTLE_TYPE_ROAMER 0x0400
-#define BATTLE_TYPE_EREADER_TRAINER 0x0800
-#define BATTLE_TYPE_KYOGRE_GROUDON 0x1000
-#define BATTLE_TYPE_LEGENDARY 0x2000
-#define BATTLE_TYPE_REGI 0x4000
-#define BATTLE_TYPE_TWO_OPPONENTS 0x8000
-#define BATTLE_TYPE_DOME 0x10000
-#define BATTLE_TYPE_PALACE 0x20000
-#define BATTLE_TYPE_ARENA 0x40000
-#define BATTLE_TYPE_FACTORY 0x80000
-#define BATTLE_TYPE_PIKE 0x100000
-#define BATTLE_TYPE_PYRAMID 0x200000
-#define BATTLE_TYPE_INGAME_PARTNER 0x400000
-#define BATTLE_TYPE_x800000 0x800000
-#define BATTLE_TYPE_RECORDED 0x1000000
-#define BATTLE_TYPE_x2000000 0x2000000
-#define BATTLE_TYPE_TRAINER_HILL 0x4000000
-#define BATTLE_TYPE_SECRET_BASE 0x8000000
-#define BATTLE_TYPE_GROUDON 0x10000000
-#define BATTLE_TYPE_KYOGRE 0x20000000
-#define BATTLE_TYPE_RAYQUAZA 0x40000000
-#define BATTLE_TYPE_x80000000 0x80000000
+#define BATTLE_TYPE_DOUBLE (1 << 0)
+#define BATTLE_TYPE_LINK (1 << 1)
+#define BATTLE_TYPE_IS_MASTER (1 << 2) // In not-link battles, it's always set.
+#define BATTLE_TYPE_TRAINER (1 << 3)
+#define BATTLE_TYPE_FIRST_BATTLE (1 << 4)
+#define BATTLE_TYPE_20 (1 << 5)
+#define BATTLE_TYPE_MULTI (1 << 6)
+#define BATTLE_TYPE_SAFARI (1 << 7)
+#define BATTLE_TYPE_BATTLE_TOWER (1 << 8)
+#define BATTLE_TYPE_WALLY_TUTORIAL (1 << 9)
+#define BATTLE_TYPE_ROAMER (1 << 10)
+#define BATTLE_TYPE_EREADER_TRAINER (1 << 11)
+#define BATTLE_TYPE_KYOGRE_GROUDON (1 << 12)
+#define BATTLE_TYPE_LEGENDARY (1 << 13)
+#define BATTLE_TYPE_REGI (1 << 14)
+#define BATTLE_TYPE_TWO_OPPONENTS (1 << 15)
+#define BATTLE_TYPE_DOME (1 << 16)
+#define BATTLE_TYPE_PALACE (1 << 17)
+#define BATTLE_TYPE_ARENA (1 << 18)
+#define BATTLE_TYPE_FACTORY (1 << 19)
+#define BATTLE_TYPE_PIKE (1 << 20)
+#define BATTLE_TYPE_PYRAMID (1 << 21)
+#define BATTLE_TYPE_INGAME_PARTNER (1 << 22)
+#define BATTLE_TYPE_x800000 (1 << 23)
+#define BATTLE_TYPE_RECORDED (1 << 24)
+#define BATTLE_TYPE_x2000000 (1 << 25)
+#define BATTLE_TYPE_TRAINER_HILL (1 << 26)
+#define BATTLE_TYPE_SECRET_BASE (1 << 27)
+#define BATTLE_TYPE_GROUDON (1 << 28)
+#define BATTLE_TYPE_KYOGRE (1 << 29)
+#define BATTLE_TYPE_RAYQUAZA (1 << 30)
+#define BATTLE_TYPE_x80000000 (1 << 31)
#define BATTLE_TYPE_FRONTIER (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID)
#define BATTLE_TYPE_FRONTIER_NO_PYRAMID (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE)
// Battle Outcome defines
-#define B_OUTCOME_WON 0x1
-#define B_OUTCOME_LOST 0x2
-#define B_OUTCOME_DREW 0x3
-#define B_OUTCOME_RAN 0x4
-#define B_OUTCOME_PLAYER_TELEPORTED 0x5
-#define B_OUTCOME_MON_FLED 0x6
-#define B_OUTCOME_CAUGHT 0x7
-#define B_OUTCOME_NO_SAFARI_BALLS 0x8
-#define B_OUTCOME_FORFEITED 0x9
-#define B_OUTCOME_MON_TELEPORTED 0xA
-#define B_OUTCOME_LINK_BATTLE_RAN 0x80
+#define B_OUTCOME_WON 1
+#define B_OUTCOME_LOST 2
+#define B_OUTCOME_DREW 3
+#define B_OUTCOME_RAN 4
+#define B_OUTCOME_PLAYER_TELEPORTED 5
+#define B_OUTCOME_MON_FLED 6
+#define B_OUTCOME_CAUGHT 7
+#define B_OUTCOME_NO_SAFARI_BALLS 8
+#define B_OUTCOME_FORFEITED 9
+#define B_OUTCOME_MON_TELEPORTED 10
+#define B_OUTCOME_LINK_BATTLE_RAN (1 << 7) // 128
// Non-volatile status conditions
// These persist remain outside of battle and after switching out
-#define STATUS1_NONE 0x0
-#define STATUS1_SLEEP 0x7
-#define STATUS1_POISON 0x8
-#define STATUS1_BURN 0x10
-#define STATUS1_FREEZE 0x20
-#define STATUS1_PARALYSIS 0x40
-#define STATUS1_TOXIC_POISON 0x80
-#define STATUS1_TOXIC_COUNTER 0xF00
+#define STATUS1_NONE 0
+#define STATUS1_SLEEP (1 << 0 | 1 << 1 | 1 << 2) // First 3 bits (Number of turns to sleep)
+#define STATUS1_SLEEP_TURN(num) ((num) << 0) // Just for readability (or if rearranging statuses)
+#define STATUS1_POISON (1 << 3)
+#define STATUS1_BURN (1 << 4)
+#define STATUS1_FREEZE (1 << 5)
+#define STATUS1_PARALYSIS (1 << 6)
+#define STATUS1_TOXIC_POISON (1 << 7)
+#define STATUS1_TOXIC_COUNTER (1 << 8 | 1 << 9 | 1 << 10 | 1 << 11)
+#define STATUS1_TOXIC_TURN(num) ((num) << 8)
#define STATUS1_PSN_ANY (STATUS1_POISON | STATUS1_TOXIC_POISON)
#define STATUS1_ANY (STATUS1_SLEEP | STATUS1_POISON | STATUS1_BURN | STATUS1_FREEZE | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON)
// Volatile status ailments
// These are removed after exiting the battle or switching out
-#define STATUS2_CONFUSION 0x00000007
-#define STATUS2_FLINCHED 0x00000008
-#define STATUS2_UPROAR 0x00000070
-#define STATUS2_BIDE 0x00000300 // two bits 0x100, 0x200
-#define STATUS2_LOCK_CONFUSE 0x00000C00
-#define STATUS2_MULTIPLETURNS 0x00001000
-#define STATUS2_WRAPPED 0x0000E000
-#define STATUS2_INFATUATION 0x000F0000 // 4 bits, one for every battler
+#define STATUS2_CONFUSION (1 << 0 | 1 << 1 | 1 << 2)
+#define STATUS2_CONFUSION_TURN(num) ((num) << 0)
+#define STATUS2_FLINCHED (1 << 3)
+#define STATUS2_UPROAR (1 << 4 | 1 << 5 | 1 << 6)
+#define STATUS2_UPROAR_TURN(num) ((num) << 4)
+#define STATUS2_UNUSED (1 << 7)
+#define STATUS2_BIDE (1 << 8 | 1 << 9)
+#define STATUS2_BIDE_TURN(num) (((num) << 8) & STATUS2_BIDE)
+#define STATUS2_LOCK_CONFUSE (1 << 10 | 1 << 11) // e.g. Thrash
+#define STATUS2_LOCK_CONFUSE_TURN(num)((num) << 10)
+#define STATUS2_MULTIPLETURNS (1 << 12)
+#define STATUS2_WRAPPED (1 << 13 | 1 << 14 | 1 << 15)
+#define STATUS2_WRAPPED_TURN(num) ((num) << 13)
+#define STATUS2_INFATUATION (1 << 16 | 1 << 17 | 1 << 18 | 1 << 19) // 4 bits, one for every battler
#define STATUS2_INFATUATED_WITH(battler) (gBitTable[battler] << 16)
-#define STATUS2_FOCUS_ENERGY 0x00100000
-#define STATUS2_TRANSFORMED 0x00200000
-#define STATUS2_RECHARGE 0x00400000
-#define STATUS2_RAGE 0x00800000
-#define STATUS2_SUBSTITUTE 0x01000000
-#define STATUS2_DESTINY_BOND 0x02000000
-#define STATUS2_ESCAPE_PREVENTION 0x04000000
-#define STATUS2_NIGHTMARE 0x08000000
-#define STATUS2_CURSED 0x10000000
-#define STATUS2_FORESIGHT 0x20000000
-#define STATUS2_DEFENSE_CURL 0x40000000
-#define STATUS2_TORMENT 0x80000000
+#define STATUS2_FOCUS_ENERGY (1 << 20)
+#define STATUS2_TRANSFORMED (1 << 21)
+#define STATUS2_RECHARGE (1 << 22)
+#define STATUS2_RAGE (1 << 23)
+#define STATUS2_SUBSTITUTE (1 << 24)
+#define STATUS2_DESTINY_BOND (1 << 25)
+#define STATUS2_ESCAPE_PREVENTION (1 << 26)
+#define STATUS2_NIGHTMARE (1 << 27)
+#define STATUS2_CURSED (1 << 28)
+#define STATUS2_FORESIGHT (1 << 29)
+#define STATUS2_DEFENSE_CURL (1 << 30)
+#define STATUS2_TORMENT (1 << 31)
// Seems like per-battler statuses. Not quite sure how to categorize these
-#define STATUS3_LEECHSEED_BATTLER 0x3
-#define STATUS3_LEECHSEED 0x4
-#define STATUS3_ALWAYS_HITS 0x18 // two bits
-#define STATUS3_PERISH_SONG 0x20
-#define STATUS3_ON_AIR 0x40
-#define STATUS3_UNDERGROUND 0x80
-#define STATUS3_MINIMIZED 0x100
-#define STATUS3_ROOTED 0x400
-#define STATUS3_CHARGED_UP 0x200
-#define STATUS3_YAWN 0x1800 // two bits
-#define STATUS3_IMPRISONED_OTHERS 0x2000
-#define STATUS3_GRUDGE 0x4000
-#define STATUS3_CANT_SCORE_A_CRIT 0x8000
-#define STATUS3_MUDSPORT 0x10000
-#define STATUS3_WATERSPORT 0x20000
-#define STATUS3_UNDERWATER 0x40000
-#define STATUS3_INTIMIDATE_POKES 0x80000
-#define STATUS3_TRACE 0x100000
+#define STATUS3_LEECHSEED_BATTLER (1 << 0 | 1 << 1) // The battler to receive HP from Leech Seed
+#define STATUS3_LEECHSEED (1 << 2)
+#define STATUS3_ALWAYS_HITS (1 << 3 | 1 << 4)
+#define STATUS3_ALWAYS_HITS_TURN(num) (((num) << 3) & STATUS3_ALWAYS_HITS) // "Always Hits" is set as a 2 turn timer, i.e. next turn is the last turn when it's active
+#define STATUS3_PERISH_SONG (1 << 5)
+#define STATUS3_ON_AIR (1 << 6)
+#define STATUS3_UNDERGROUND (1 << 7)
+#define STATUS3_MINIMIZED (1 << 8)
+#define STATUS3_CHARGED_UP (1 << 9)
+#define STATUS3_ROOTED (1 << 10)
+#define STATUS3_YAWN (1 << 11 | 1 << 12) // Number of turns to sleep
+#define STATUS3_YAWN_TURN(num) (((num) << 11) & STATUS3_YAWN)
+#define STATUS3_IMPRISONED_OTHERS (1 << 13)
+#define STATUS3_GRUDGE (1 << 14)
+#define STATUS3_CANT_SCORE_A_CRIT (1 << 15)
+#define STATUS3_MUDSPORT (1 << 16)
+#define STATUS3_WATERSPORT (1 << 17)
+#define STATUS3_UNDERWATER (1 << 18)
+#define STATUS3_INTIMIDATE_POKES (1 << 19)
+#define STATUS3_TRACE (1 << 20)
#define STATUS3_SEMI_INVULNERABLE (STATUS3_UNDERGROUND | STATUS3_ON_AIR | STATUS3_UNDERWATER)
// Not really sure what a "hitmarker" is.
-#define HITMARKER_x10 0x00000010
-#define HITMARKER_x20 0x00000020
-#define HITMARKER_DESTINYBOND 0x00000040
-#define HITMARKER_NO_ANIMATIONS 0x00000080
-#define HITMARKER_IGNORE_SUBSTITUTE 0x00000100
-#define HITMARKER_NO_ATTACKSTRING 0x00000200
-#define HITMARKER_ATTACKSTRING_PRINTED 0x00000400
-#define HITMARKER_NO_PPDEDUCT 0x00000800
-#define HITMARKER_SWAP_ATTACKER_TARGET 0x00001000
-#define HITMARKER_IGNORE_SAFEGUARD 0x00002000
-#define HITMARKER_SYNCHRONISE_EFFECT 0x00004000
-#define HITMARKER_RUN 0x00008000
-#define HITMARKER_IGNORE_ON_AIR 0x00010000
-#define HITMARKER_IGNORE_UNDERGROUND 0x00020000
-#define HITMARKER_IGNORE_UNDERWATER 0x00040000
-#define HITMARKER_UNABLE_TO_USE_MOVE 0x00080000
-#define HITMARKER_x100000 0x00100000
-#define HITMARKER_x200000 0x00200000
-#define HITMARKER_x400000 0x00400000
-#define HITMARKER_x800000 0x00800000
-#define HITMARKER_GRUDGE 0x01000000
-#define HITMARKER_OBEYS 0x02000000
-#define HITMARKER_x4000000 0x04000000
-#define HITMARKER_CHARGING 0x08000000
-#define HITMARKER_FAINTED(battler) (gBitTable[battler] << 0x1C)
-#define HITMARKER_UNK(battler) (0x10000000 << battler)
+#define HITMARKER_x10 (1 << 4)
+#define HITMARKER_x20 (1 << 5)
+#define HITMARKER_DESTINYBOND (1 << 6)
+#define HITMARKER_NO_ANIMATIONS (1 << 7)
+#define HITMARKER_IGNORE_SUBSTITUTE (1 << 8)
+#define HITMARKER_NO_ATTACKSTRING (1 << 9)
+#define HITMARKER_ATTACKSTRING_PRINTED (1 << 10)
+#define HITMARKER_NO_PPDEDUCT (1 << 11)
+#define HITMARKER_SWAP_ATTACKER_TARGET (1 << 12)
+#define HITMARKER_IGNORE_SAFEGUARD (1 << 13)
+#define HITMARKER_SYNCHRONISE_EFFECT (1 << 14)
+#define HITMARKER_RUN (1 << 15)
+#define HITMARKER_IGNORE_ON_AIR (1 << 16)
+#define HITMARKER_IGNORE_UNDERGROUND (1 << 17)
+#define HITMARKER_IGNORE_UNDERWATER (1 << 18)
+#define HITMARKER_UNABLE_TO_USE_MOVE (1 << 19)
+#define HITMARKER_x100000 (1 << 20)
+#define HITMARKER_x200000 (1 << 21)
+#define HITMARKER_x400000 (1 << 22)
+#define HITMARKER_x800000 (1 << 23)
+#define HITMARKER_GRUDGE (1 << 24)
+#define HITMARKER_OBEYS (1 << 25)
+#define HITMARKER_x4000000 (1 << 26)
+#define HITMARKER_CHARGING (1 << 27)
+#define HITMARKER_FAINTED(battler) (gBitTable[battler] << 28)
+#define HITMARKER_FAINTED2(battler) (1 << (28 + battler))
// Per-side statuses that affect an entire party
#define SIDE_STATUS_REFLECT (1 << 0)
@@ -215,71 +225,70 @@
#define WEATHER_ANY (WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY)
// Move Effects
-#define MOVE_EFFECT_SLEEP 0x1
-#define MOVE_EFFECT_POISON 0x2
-#define MOVE_EFFECT_BURN 0x3
-#define MOVE_EFFECT_FREEZE 0x4
-#define MOVE_EFFECT_PARALYSIS 0x5
-#define MOVE_EFFECT_TOXIC 0x6
-#define MOVE_EFFECT_CONFUSION 0x7
-#define MOVE_EFFECT_FLINCH 0x8
-#define MOVE_EFFECT_TRI_ATTACK 0x9
-#define MOVE_EFFECT_UPROAR 0xA
-#define MOVE_EFFECT_PAYDAY 0xB
-#define MOVE_EFFECT_CHARGING 0xC
-#define MOVE_EFFECT_WRAP 0xD
-#define MOVE_EFFECT_RECOIL_25 0xE
-#define MOVE_EFFECT_ATK_PLUS_1 0xF
-#define MOVE_EFFECT_DEF_PLUS_1 0x10
-#define MOVE_EFFECT_SPD_PLUS_1 0x11
-#define MOVE_EFFECT_SP_ATK_PLUS_1 0x12
-#define MOVE_EFFECT_SP_DEF_PLUS_1 0x13
-#define MOVE_EFFECT_ACC_PLUS_1 0x14
-#define MOVE_EFFECT_EVS_PLUS_1 0x15
-#define MOVE_EFFECT_ATK_MINUS_1 0x16
-#define MOVE_EFFECT_DEF_MINUS_1 0x17
-#define MOVE_EFFECT_SPD_MINUS_1 0x18
-#define MOVE_EFFECT_SP_ATK_MINUS_1 0x19
-#define MOVE_EFFECT_SP_DEF_MINUS_1 0x1A
-#define MOVE_EFFECT_ACC_MINUS_1 0x1B
-#define MOVE_EFFECT_EVS_MINUS_1 0x1C
-#define MOVE_EFFECT_RECHARGE 0x1D
-#define MOVE_EFFECT_RAGE 0x1E
-#define MOVE_EFFECT_STEAL_ITEM 0x1F
-#define MOVE_EFFECT_PREVENT_ESCAPE 0x20
-#define MOVE_EFFECT_NIGHTMARE 0x21
-#define MOVE_EFFECT_ALL_STATS_UP 0x22
-#define MOVE_EFFECT_RAPIDSPIN 0x23
-#define MOVE_EFFECT_REMOVE_PARALYSIS 0x24
-#define MOVE_EFFECT_ATK_DEF_DOWN 0x25
-#define MOVE_EFFECT_RECOIL_33 0x26
-#define MOVE_EFFECT_ATK_PLUS_2 0x27
-#define MOVE_EFFECT_DEF_PLUS_2 0x28
-#define MOVE_EFFECT_SPD_PLUS_2 0x29
-#define MOVE_EFFECT_SP_ATK_PLUS_2 0x2A
-#define MOVE_EFFECT_SP_DEF_PLUS_2 0x2B
-#define MOVE_EFFECT_ACC_PLUS_2 0x2C
-#define MOVE_EFFECT_EVS_PLUS_2 0x2D
-#define MOVE_EFFECT_ATK_MINUS_2 0x2E
-#define MOVE_EFFECT_DEF_MINUS_2 0x2F
-#define MOVE_EFFECT_SPD_MINUS_2 0x30
-#define MOVE_EFFECT_SP_ATK_MINUS_2 0x31
-#define MOVE_EFFECT_SP_DEF_MINUS_2 0x32
-#define MOVE_EFFECT_ACC_MINUS_2 0x33
-#define MOVE_EFFECT_EVS_MINUS_2 0x34
-#define MOVE_EFFECT_THRASH 0x35
-#define MOVE_EFFECT_KNOCK_OFF 0x36
-#define MOVE_EFFECT_NOTHING_37 0x37
-#define MOVE_EFFECT_NOTHING_38 0x38
-#define MOVE_EFFECT_NOTHING_39 0x39
-#define MOVE_EFFECT_NOTHING_3A 0x3A
-#define MOVE_EFFECT_SP_ATK_TWO_DOWN 0x3B
-#define MOVE_EFFECT_NOTHING_3C 0x3C
-#define MOVE_EFFECT_NOTHING_3D 0x3D
-#define MOVE_EFFECT_NOTHING_3E 0x3E
-#define MOVE_EFFECT_NOTHING_3F 0x3F
-#define MOVE_EFFECT_AFFECTS_USER 0x40
-#define MOVE_EFFECT_CERTAIN 0x80
+#define MOVE_EFFECT_SLEEP 1
+#define MOVE_EFFECT_POISON 2
+#define MOVE_EFFECT_BURN 3
+#define MOVE_EFFECT_FREEZE 4
+#define MOVE_EFFECT_PARALYSIS 5
+#define MOVE_EFFECT_TOXIC 6
+#define PRIMARY_STATUS_MOVE_EFFECT MOVE_EFFECT_TOXIC // All above move effects apply primary status
+#define MOVE_EFFECT_CONFUSION 7
+#define MOVE_EFFECT_FLINCH 8
+#define MOVE_EFFECT_TRI_ATTACK 9
+#define MOVE_EFFECT_UPROAR 10
+#define MOVE_EFFECT_PAYDAY 11
+#define MOVE_EFFECT_CHARGING 12
+#define MOVE_EFFECT_WRAP 13
+#define MOVE_EFFECT_RECOIL_25 14
+#define MOVE_EFFECT_ATK_PLUS_1 15
+#define MOVE_EFFECT_DEF_PLUS_1 16
+#define MOVE_EFFECT_SPD_PLUS_1 17
+#define MOVE_EFFECT_SP_ATK_PLUS_1 18
+#define MOVE_EFFECT_SP_DEF_PLUS_1 19
+#define MOVE_EFFECT_ACC_PLUS_1 20
+#define MOVE_EFFECT_EVS_PLUS_1 21
+#define MOVE_EFFECT_ATK_MINUS_1 22
+#define MOVE_EFFECT_DEF_MINUS_1 23
+#define MOVE_EFFECT_SPD_MINUS_1 24
+#define MOVE_EFFECT_SP_ATK_MINUS_1 25
+#define MOVE_EFFECT_SP_DEF_MINUS_1 26
+#define MOVE_EFFECT_ACC_MINUS_1 27
+#define MOVE_EFFECT_EVS_MINUS_1 28
+#define MOVE_EFFECT_RECHARGE 29
+#define MOVE_EFFECT_RAGE 30
+#define MOVE_EFFECT_STEAL_ITEM 31
+#define MOVE_EFFECT_PREVENT_ESCAPE 32
+#define MOVE_EFFECT_NIGHTMARE 33
+#define MOVE_EFFECT_ALL_STATS_UP 34
+#define MOVE_EFFECT_RAPIDSPIN 35
+#define MOVE_EFFECT_REMOVE_PARALYSIS 36
+#define MOVE_EFFECT_ATK_DEF_DOWN 37
+#define MOVE_EFFECT_RECOIL_33 38
+#define MOVE_EFFECT_ATK_PLUS_2 39
+#define MOVE_EFFECT_DEF_PLUS_2 40
+#define MOVE_EFFECT_SPD_PLUS_2 41
+#define MOVE_EFFECT_SP_ATK_PLUS_2 42
+#define MOVE_EFFECT_SP_DEF_PLUS_2 43
+#define MOVE_EFFECT_ACC_PLUS_2 44
+#define MOVE_EFFECT_EVS_PLUS_2 45
+#define MOVE_EFFECT_ATK_MINUS_2 46
+#define MOVE_EFFECT_DEF_MINUS_2 47
+#define MOVE_EFFECT_SPD_MINUS_2 48
+#define MOVE_EFFECT_SP_ATK_MINUS_2 49
+#define MOVE_EFFECT_SP_DEF_MINUS_2 50
+#define MOVE_EFFECT_ACC_MINUS_2 51
+#define MOVE_EFFECT_EVS_MINUS_2 52
+#define MOVE_EFFECT_THRASH 53
+#define MOVE_EFFECT_KNOCK_OFF 54
+#define MOVE_EFFECT_NOTHING_37 55
+#define MOVE_EFFECT_NOTHING_38 56
+#define MOVE_EFFECT_NOTHING_39 57
+#define MOVE_EFFECT_NOTHING_3A 58
+#define MOVE_EFFECT_SP_ATK_TWO_DOWN 59
+#define NUM_MOVE_EFFECTS 60
+
+#define MOVE_EFFECT_AFFECTS_USER (1 << 6) // 64
+#define MOVE_EFFECT_CERTAIN (1 << 7) // 128
// Battle terrain defines for gBattleTerrain.
#define BATTLE_TERRAIN_GRASS 0
diff --git a/include/constants/battle_palace.h b/include/constants/battle_palace.h
index db9855101..851655089 100644
--- a/include/constants/battle_palace.h
+++ b/include/constants/battle_palace.h
@@ -16,4 +16,14 @@
#define PALACE_DATA_WIN_STREAK 1
#define PALACE_DATA_WIN_STREAK_ACTIVE 2
+// Pokemon in Battle Palace have a move "group" type preference depending on nature
+#define PALACE_MOVE_GROUP_ATTACK 0
+#define PALACE_MOVE_GROUP_DEFENSE 1
+#define PALACE_MOVE_GROUP_SUPPORT 2
+
+// In palace doubles battles pokemon have a target preference depending on nature
+#define PALACE_TARGET_STRONGER 0
+#define PALACE_TARGET_WEAKER 1
+#define PALACE_TARGET_RANDOM 2
+
#endif //GUARD_CONSTANTS_BATTLE_PALACE_H
diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h
index dfcf79128..9372377c4 100644
--- a/include/constants/battle_script_commands.h
+++ b/include/constants/battle_script_commands.h
@@ -66,8 +66,10 @@
#define VARIOUS_SET_MAGIC_COAT_TARGET 1
#define VARIOUS_IS_RUNNING_IMPOSSIBLE 2
#define VARIOUS_GET_MOVE_TARGET 3
+#define VARIOUS_GET_BATTLER_FAINTED 4
#define VARIOUS_RESET_INTIMIDATE_TRACE_BITS 5
#define VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP 6
+#define VARIOUS_PALACE_FLAVOR_TEXT 8
#define VARIOUS_ARENA_JUDGMENT_WINDOW 9
#define VARIOUS_ARENA_OPPONENT_MON_LOST 10
#define VARIOUS_ARENA_PLAYER_MON_LOST 11
diff --git a/include/constants/cable_club.h b/include/constants/cable_club.h
index f2aa4120c..cbdd049db 100644
--- a/include/constants/cable_club.h
+++ b/include/constants/cable_club.h
@@ -12,4 +12,20 @@
#define USING_MINIGAME 8
#define USING_BATTLE_TOWER 9
+// Return states for the group of specials that use CreateLinkupTask
+// A few also used by TryBecomeLinkLeader and TryJoinLinkGroup
+#define LINKUP_ONGOING 0
+#define LINKUP_SUCCESS 1
+#define LINKUP_SOMEONE_NOT_READY 2
+#define LINKUP_DIFF_SELECTIONS 3
+#define LINKUP_WRONG_NUM_PLAYERS 4
+#define LINKUP_FAILED 5
+#define LINKUP_CONNECTION_ERROR 6
+#define LINKUP_PLAYER_NOT_READY 7
+#define LINKUP_RETRY_ROLE_ASSIGN 8
+#define LINKUP_PARTNER_NOT_READY 9
+#define LINKUP_FAILED_CONTEST_GMODE 10
+#define LINKUP_FAILED_BATTLE_TOWER 11
+#define LINKUP_FOREIGN_GAME 12
+
#endif //GUARD_CONSTANTS_CABLE_CLUB_H
diff --git a/include/constants/contest.h b/include/constants/contest.h
index 186c56e2b..2de2866a3 100644
--- a/include/constants/contest.h
+++ b/include/constants/contest.h
@@ -29,6 +29,23 @@
#define CONTEST_CATEGORY_TOUGH 4
#define CONTEST_CATEGORIES_COUNT 5
+#define CONTEST_WINNER_ARTIST 0 // Winner shown by the artist, painting not necessarily saved
+#define CONTEST_WINNER_HALL_1 1
+#define CONTEST_WINNER_HALL_2 2
+#define CONTEST_WINNER_HALL_3 3
+#define CONTEST_WINNER_HALL_4 4
+#define CONTEST_WINNER_HALL_5 5
+#define CONTEST_WINNER_HALL_6 6
+#define NUM_CONTEST_HALL_WINNERS 6
+#define CONTEST_WINNER_7 7
+#define CONTEST_WINNER_8 8
+#define CONTEST_WINNER_MUSEUM_COOL 9
+#define CONTEST_WINNER_MUSEUM_BEAUTY 10
+#define CONTEST_WINNER_MUSEUM_CUTE 11
+#define CONTEST_WINNER_MUSEUM_SMART 12
+#define CONTEST_WINNER_MUSEUM_TOUGH 13
+// NUM_CONTEST_WINNERS in constants/global.h
+
#define CANT_ENTER_CONTEST 0
#define CAN_ENTER_CONTEST_EQUAL_RANK 1
#define CAN_ENTER_CONTEST_HIGH_RANK 2
diff --git a/include/constants/field_specials.h b/include/constants/field_specials.h
index a2dc117e4..a01151378 100644
--- a/include/constants/field_specials.h
+++ b/include/constants/field_specials.h
@@ -75,4 +75,9 @@
#define FANCLUB_MEMBER7 14
#define FANCLUB_MEMBER8 15
+#define FANCOUNTER_DEFEATED_DRAKE 0
+#define FANCOUNTER_BATTLED_AT_BASE 1
+#define FANCOUNTER_FINISHED_CONTEST 2
+#define FANCOUNTER_USED_BATTLE_TOWER 3
+
#endif // GUARD_CONSTANTS_FIELD_SPECIALS_H
diff --git a/include/constants/flags.h b/include/constants/flags.h
index 4dd18880f..e1a88283a 100644
--- a/include/constants/flags.h
+++ b/include/constants/flags.h
@@ -961,10 +961,10 @@
#define FLAG_HIDE_MT_PYRE_SUMMIT_ARCHIE 0x394
#define FLAG_HIDE_MT_PYRE_SUMMIT_TEAM_AQUA 0x395
#define FLAG_HIDE_BATTLE_TOWER_REPORTER 0x396
-#define FLAG_HIDE_ROUTE_110_RIVAL_1 0x397
+#define FLAG_HIDE_ROUTE_110_RIVAL 0x397
#define FLAG_HIDE_CHAMPIONS_ROOM_RIVAL 0x398
#define FLAG_HIDE_CHAMPIONS_ROOM_BIRCH 0x399
-#define FLAG_HIDE_ROUTE_110_RIVAL_2 0x39A
+#define FLAG_HIDE_ROUTE_110_RIVAL_ON_BIKE 0x39A
#define FLAG_HIDE_ROUTE_119_RIVAL_ON_BIKE 0x39B
#define FLAG_HIDE_AQUA_HIDEOUT_GRUNTS 0x39C
#define FLAG_HIDE_LILCOVE_MOTEL_GAME_DESIGNERS 0x39D
@@ -1573,7 +1573,9 @@
#define FLAG_UNUSED_0x91F (SYSTEM_FLAGS + 0xBF) // Unused Flag
// Daily Flags
-#define DAILY_FLAGS_START 0x920
+// These flags are cleared once per day
+// The start and end are byte-aligned because the flags are cleared in byte increments
+#define DAILY_FLAGS_START (FLAG_UNUSED_0x91F + (8 - FLAG_UNUSED_0x91F % 8))
#define FLAG_UNUSED_0x920 (DAILY_FLAGS_START + 0x0) // Unused Flag
#define FLAG_DAILY_CONTEST_LOBBY_RECEIVED_BERRY (DAILY_FLAGS_START + 0x1)
#define FLAG_DAILY_SECRET_BASE (DAILY_FLAGS_START + 0x2)
@@ -1639,7 +1641,9 @@
#define FLAG_UNUSED_0x95D (DAILY_FLAGS_START + 0x3D) // Unused Flag
#define FLAG_UNUSED_0x95E (DAILY_FLAGS_START + 0x3E) // Unused Flag
#define FLAG_UNUSED_0x95F (DAILY_FLAGS_START + 0x3F) // Unused Flag
-#define DAILY_FLAGS_END FLAG_UNUSED_0x95F
+#define DAILY_FLAGS_END (FLAG_UNUSED_0x95F + (7 - FLAG_UNUSED_0x95F % 8))
+
+#define FLAGS_COUNT (DAILY_FLAGS_END + 1)
// Special Flags (Stored in EWRAM (gSpecialFlags), not in the SaveBlock)
#define SPECIAL_FLAGS_START 0x4000
diff --git a/include/constants/global.h b/include/constants/global.h
index c7063d71c..98f15e7dc 100644
--- a/include/constants/global.h
+++ b/include/constants/global.h
@@ -34,8 +34,6 @@
#define POKEBLOCKS_COUNT 40
#define OBJECT_EVENTS_COUNT 16
#define BERRY_TREES_COUNT 128
-#define FLAGS_COUNT 300
-#define VARS_COUNT 256
#define MAIL_COUNT 16
#define SECRET_BASES_COUNT 20
#define TV_SHOWS_COUNT 25
@@ -52,6 +50,8 @@
#define APPRENTICE_COUNT 4
#define APPRENTICE_MAX_QUESTIONS 9
#define MAX_REMATCH_ENTRIES 100 // only REMATCH_TABLE_ENTRIES (78) are used
+#define NUM_CONTEST_WINNERS 13
+#define UNION_ROOM_KB_ROW_COUNT 10
#define PYRAMID_BAG_ITEMS_COUNT 10
#define HALL_FACILITIES_COUNT 9 // 7 facilities for single mode + tower double mode + tower multi mode.
diff --git a/include/constants/items.h b/include/constants/items.h
index fafcac8b1..ba4d3c49e 100644
--- a/include/constants/items.h
+++ b/include/constants/items.h
@@ -17,6 +17,8 @@
#define ITEM_LUXURY_BALL 11
#define ITEM_PREMIER_BALL 12
+#define LAST_BALL ITEM_PREMIER_BALL
+
// Pokemon Items
#define ITEM_POTION 13
#define ITEM_ANTIDOTE 14
diff --git a/include/constants/opponents.h b/include/constants/opponents.h
index cd35cf6b7..c9cf9239d 100644
--- a/include/constants/opponents.h
+++ b/include/constants/opponents.h
@@ -859,6 +859,7 @@
// NOTE: Because each Trainer uses a flag to determine when they are defeated, there is only space for 9 additional trainers before trainer flag space overflows
// More space can be made by shifting flags around in constants/flags.h or changing how trainer flags are handled
+// MAX_TRAINERS_COUNT can be increased but will take up additional saveblock space
#define TRAINERS_COUNT 855
#define MAX_TRAINERS_COUNT 864
diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h
index b5c60f64d..0d8fc6a57 100644
--- a/include/constants/pokemon.h
+++ b/include/constants/pokemon.h
@@ -69,6 +69,7 @@
#define NATURE_SASSY 22
#define NATURE_CAREFUL 23
#define NATURE_QUIRKY 24
+#define NUM_NATURES 25
// Pokemon Stats
#define STAT_HP 0
@@ -80,7 +81,7 @@
#define STAT_ACC 6 // Only in battles.
#define STAT_EVASION 7 // Only in battles.
-#define NUM_EV_STATS NUM_STATS - 1 // excludes HP
+#define NUM_NATURE_STATS NUM_STATS - 1 // excludes HP
#define NUM_BATTLE_STATS NUM_STATS + 2 // includes Accuracy and Evasion
// Shiny odds
diff --git a/include/constants/trainers.h b/include/constants/trainers.h
index 541b131ca..3f22c7cef 100644
--- a/include/constants/trainers.h
+++ b/include/constants/trainers.h
@@ -13,7 +13,7 @@
#define TRAINER_PLAYER 1023
#define TRAINER_SECRET_BASE 1024
#define TRAINER_LINK_OPPONENT 2048
-#define TRAINER_OPPONENT_C00 3072
+#define TRAINER_UNION_ROOM 3072
#define TRAINER_STEVEN_PARTNER 3075
#define TRAINER_PIC_HIKER 0
diff --git a/include/constants/union_room.h b/include/constants/union_room.h
index 2314f85a0..d867fb340 100644
--- a/include/constants/union_room.h
+++ b/include/constants/union_room.h
@@ -1,6 +1,60 @@
#ifndef GUARD_CONSTANTS_UNION_ROOM_H
#define GUARD_CONSTANTS_UNION_ROOM_H
+#define MAX_UNION_ROOM_PLAYERS 8
+
+#define UNION_ROOM_SPAWN_NONE 0
+#define UNION_ROOM_SPAWN_IN 1
+#define UNION_ROOM_SPAWN_OUT 2
+
+#define ACTIVITY_NONE 0
+#define ACTIVITY_BATTLE_SINGLE 1
+#define ACTIVITY_BATTLE_DOUBLE 2
+#define ACTIVITY_BATTLE_MULTI 3
+#define ACTIVITY_TRADE 4
+#define ACTIVITY_CHAT 5
+#define ACTIVITY_WONDER_CARD 6
+#define ACTIVITY_WONDER_NEWS 7
+#define ACTIVITY_CARD 8
+#define ACTIVITY_POKEMON_JUMP 9
+#define ACTIVITY_BERRY_CRUSH 10
+#define ACTIVITY_BERRY_PICK 11
+#define ACTIVITY_SEARCH 12
+#define ACTIVITY_SPIN_TRADE 13
+#define ACTIVITY_BATTLE_TOWER_OPEN 14
+#define ACTIVITY_RECORD_CORNER 15
+#define ACTIVITY_BERRY_BLENDER 16
+
+// Player response
+#define ACTIVITY_ACCEPT 17
+#define ACTIVITY_DECLINE 18
+
+#define ACTIVITY_NPCTALK 19
+#define ACTIVITY_PLYRTALK 20
+
+// Duplicate IDs?
+#define ACTIVITY_WONDER_CARD2 21
+#define ACTIVITY_WONDER_NEWS2 22
+
+#define ACTIVITY_CONTEST_COOL 23
+#define ACTIVITY_CONTEST_BEAUTY 24
+#define ACTIVITY_CONTEST_CUTE 25
+#define ACTIVITY_CONTEST_SMART 26
+#define ACTIVITY_CONTEST_TOUGH 27
+#define ACTIVITY_BATTLE_TOWER 28
+#define ACTIVITY_29 29
+
+#define IN_UNION_ROOM (1 << 6)
+
+// Used in UR_AddTextPrinterParameterized
+#define UR_COLOR_DKE_WHT_LTE 0
+#define UR_COLOR_RED_WHT_LTR 1
+#define UR_COLOR_GRN_WHT_LTG 2
+#define UR_COLOR_WHT_WHT_LTE 3
+#define UR_COLOR_WHT_DKE_LTE 4
+#define UR_COLOR_GRN_DN6_LTB 5
+#define UR_COLOR_DN5_DN6_LTB 6
+
#define LINK_GROUP_SINGLE_BATTLE 0
#define LINK_GROUP_DOUBLE_BATTLE 1
#define LINK_GROUP_MULTI_BATTLE 2
@@ -10,8 +64,8 @@
#define LINK_GROUP_BERRY_PICKING 6
#define LINK_GROUP_WONDER_CARD 7
#define LINK_GROUP_WONDER_NEWS 8
-#define LINK_GROUP_UNK_9 9
-#define LINK_GROUP_UNK_10 10
+#define LINK_GROUP_UNION_ROOM_RESUME 9
+#define LINK_GROUP_UNION_ROOM_INIT 10
#define LINK_GROUP_UNK_11 11
#define LINK_GROUP_RECORD_CORNER 12
#define LINK_GROUP_BERRY_BLENDER 13
@@ -25,4 +79,24 @@
#define LINK_GROUP_BATTLE_TOWER_OPEN 21
#define NUM_LINK_GROUP_TYPES 22
+#define UR_TRADE_MATCH 0
+#define UR_TRADE_NOTYPE 1
+#define UR_TRADE_NOEGG 2
+
+#define UR_TRADE_READY 0
+#define UR_TRADE_PLAYER_NOT_READY 1
+#define UR_TRADE_PARTNER_NOT_READY 2
+
+#define UR_INTERACT_PLAYER_1 1
+#define UR_INTERACT_PLAYER_2 2
+#define UR_INTERACT_PLAYER_3 3
+#define UR_INTERACT_PLAYER_4 4
+#define UR_INTERACT_PLAYER_5 5
+#define UR_INTERACT_PLAYER_6 6
+#define UR_INTERACT_PLAYER_7 7
+#define UR_INTERACT_PLAYER_8 8
+#define UR_INTERACT_ATTENDANT 9
+#define UR_INTERACT_UNUSED 10
+#define UR_INTERACT_START_MENU 11
+
#endif //GUARD_CONSTANTS_UNION_ROOM_H
diff --git a/include/constants/vars.h b/include/constants/vars.h
index 4a38bde81..625c37aa9 100644
--- a/include/constants/vars.h
+++ b/include/constants/vars.h
@@ -274,6 +274,7 @@
#define VAR_UNUSED_0x40FF 0x40FF // Unused Var
#define VARS_END 0x40FF
+#define VARS_COUNT (VARS_END - VARS_START + 1)
#define SPECIAL_VARS_START 0x8000
// special vars
diff --git a/include/contest.h b/include/contest.h
index 00c3191eb..a9b1db9ee 100644
--- a/include/contest.h
+++ b/include/contest.h
@@ -430,9 +430,9 @@ struct ContestResources
extern struct ContestPokemon gContestMons[CONTESTANT_COUNT];
extern s16 gContestMonConditions[CONTESTANT_COUNT];
-extern s16 gUnknown_02039F08[CONTESTANT_COUNT];
+extern s16 gContestMonTotalPoints[CONTESTANT_COUNT];
extern s16 gUnknown_02039F10[CONTESTANT_COUNT];
-extern s16 gUnknown_02039F18[CONTESTANT_COUNT];
+extern s16 gContestMonRound2Points[CONTESTANT_COUNT];
extern u8 gContestFinalStandings[CONTESTANT_COUNT];
extern u8 gContestMonPartyIndex;
extern u8 gContestPlayerMonIndex;
@@ -448,7 +448,6 @@ extern u8 sContestBgCopyFlags;
extern struct ContestWinner gCurContestWinner;
extern u8 gUnknown_02039F5C;
extern u8 gUnknown_02039F5D;
-
extern u32 gContestRngValue;
// contest.c
diff --git a/include/contest_link_80FC4F4.h b/include/contest_link.h
index a3f118798..4344d55ad 100644
--- a/include/contest_link_80FC4F4.h
+++ b/include/contest_link.h
@@ -1,5 +1,5 @@
-#ifndef GUARD_CONTEST_LINK_80FC4F4_H
-#define GUARD_CONTEST_LINK_80FC4F4_H
+#ifndef GUARD_CONTEST_LINK_H
+#define GUARD_CONTEST_LINK_H
void sub_80FCC88(u8);
void sub_80FCC88(u8);
@@ -10,4 +10,4 @@ void sub_80FC804(u8);
void sub_80FCE48(u8);
void sub_80FC894(u8);
-#endif //GUARD_CONTEST_LINK_80FC4F4_H
+#endif //GUARD_CONTEST_LINK_H
diff --git a/include/contest_link_80F57C4.h b/include/contest_util.h
index add3ae62f..c0d8df031 100644
--- a/include/contest_link_80F57C4.h
+++ b/include/contest_util.h
@@ -1,12 +1,12 @@
-#ifndef GUARD_CONTEST_LINK_80F57C4_H
-#define GUARD_CONTEST_LINK_80F57C4_H
+#ifndef GUARD_CONTEST_UTIL_H
+#define GUARD_CONTEST_UTIL_H
void BufferContestantTrainerName(void);
void BufferContestantMonNickname(void);
void StartContest(void);
void BufferContestantMonSpecies(void);
-void sub_80F8484(void);
-void sub_80F84C4(u8);
+void ShowContestResults(void);
+void ContestLinkTransfer(u8);
void sub_80FC998(u8 taskId);
-#endif // GUARD_CONTEST_LINK_80F57C4_H
+#endif // GUARD_CONTEST_UTIL_H
diff --git a/include/dodrio_berry_picking.h b/include/dodrio_berry_picking.h
index 9995decc2..5decbeccb 100644
--- a/include/dodrio_berry_picking.h
+++ b/include/dodrio_berry_picking.h
@@ -1,7 +1,7 @@
#ifndef GUARD_DODRIO_BERRY_PICKING_H
#define GUARD_DODRIO_BERRY_PICKING_H
-void sub_802493C(u16 a0, void (*callback)(void));
+void StartDodrioBerryPicking(u16 a0, void (*callback)(void));
void IsDodrioInParty(void);
void ShowDodrioBerryPickingRecords(void);
diff --git a/include/event_data.h b/include/event_data.h
index 53999320f..8b4510e39 100644
--- a/include/event_data.h
+++ b/include/event_data.h
@@ -1,9 +1,6 @@
#ifndef GUARD_EVENT_DATA_H
#define GUARD_EVENT_DATA_H
-#include "constants/flags.h"
-#include "constants/vars.h"
-
void InitEventData(void);
void ClearTempFieldEventData(void);
void ClearDailyFlags(void);
diff --git a/include/event_object_lock.h b/include/event_object_lock.h
index a3b350019..0226eb632 100644
--- a/include/event_object_lock.h
+++ b/include/event_object_lock.h
@@ -8,6 +8,6 @@ void LockSelectedObjectEvent(void);
void sub_8098630(void);
bool8 sub_8098734(void);
void ScriptUnfreezeObjectEvents(void);
-void sub_8098524(void);
+void UnionRoom_UnlockPlayerAndChatPartner(void);
#endif // GUARD_EVENT_OBJECT_LOCK_H
diff --git a/include/event_object_movement.h b/include/event_object_movement.h
index f0caa38aa..6ccd4759e 100644
--- a/include/event_object_movement.h
+++ b/include/event_object_movement.h
@@ -81,11 +81,11 @@ void sub_808E16C(s16, s16);
void OverrideSecretBaseDecorationSpriteScript(u8 localId, u8 mapNum, u8 mapGroup, u8 decorCat);
void sub_8092FF0(s16, s16, s16 *, s16 *);
u8 GetFaceDirectionAnimNum(u8);
-void sub_80930E0(s16 *, s16 *, s16, s16);
+void SetSpritePosToOffsetMapCoords(s16 *, s16 *, s16, s16);
void ObjectEventClearHeldMovement(struct ObjectEvent *);
void ObjectEventClearHeldMovementIfActive(struct ObjectEvent *);
void TrySpawnObjectEvents(s16, s16);
-u8 sprite_new(u8 graphicsId, u8 a1, s16 x, s16 y, u8 z, u8 direction);
+u8 CreateObjectSprite(u8 graphicsId, u8 a1, s16 x, s16 y, u8 z, u8 direction);
u8 AddPseudoObjectEvent(u16, void (*)(struct Sprite *), s16 x, s16 y, u8 subpriority);
u8 TrySpawnObjectEvent(u8, u8, u8);
u8 SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 z);
@@ -180,7 +180,7 @@ void CreateLevitateMovementTask(struct ObjectEvent *);
void DestroyExtraMovementTask(u8);
void UnfreezeObjectEvents(void);
void FreezeObjectEventsExceptOne(u8 objectEventId);
-void sub_8097B78(u8, u8);
+void TurnObjectEventSprite(u8, u8);
void sub_8098074(u8 var1, u8 var2);
void FreezeObjectEvents(void);
bool8 FreezeObjectEvent(struct ObjectEvent *objectEvent);
@@ -194,7 +194,7 @@ void UpdateObjectEventSpriteVisibility(struct Sprite *sprite, bool8 invisible);
s16 sub_809773C(s16 a1);
s16 sub_8097728(s16 a1);
void CameraObjectReset2(void);
-u8 ObjectEventGetBerryTreeId(u8 objectEventId);
+u8 GetObjectEventBerryTreeId(u8 objectEventId);
void sub_8092EF0(u8 mapId, u8 mapNumber, u8 mapGroup);
bool8 IsBerryTreeSparkling(u8, u8, u8);
@@ -414,10 +414,10 @@ u8 MovementType_RunInPlace_Step0(struct ObjectEvent *, struct Sprite *);
u8 MovementType_Invisible_Step0(struct ObjectEvent *, struct Sprite *);
u8 MovementType_Invisible_Step1(struct ObjectEvent *, struct Sprite *);
u8 MovementType_Invisible_Step2(struct ObjectEvent *, struct Sprite *);
-void sub_8097C44(u8 var, bool32 var2);
-bool32 sub_8097C8C(u8 var);
-void sub_8097BB4(u8 var1, u8 graphicsId);
-void sub_8097CC4(u8 var1, u8 var2);
-bool32 sub_8097D9C(u8 var);
+void SetObjectEventSpriteInvisibility(u8 var, bool32 var2);
+bool32 IsObjectEventSpriteInvisible(u8 var);
+void SetObjectEventSpriteGraphics(u8 var1, u8 graphicsId);
+void SetObjectEventSpriteAnim(u8 var1, u8 var2);
+bool32 IsObjectEventSpriteAnimating(u8 var);
#endif //GUARD_EVENT_OBJECT_MOVEMENT_H
diff --git a/include/fieldmap.h b/include/fieldmap.h
index dc81d1766..aff458eb1 100644
--- a/include/fieldmap.h
+++ b/include/fieldmap.h
@@ -43,6 +43,7 @@ void copy_map_tileset1_to_vram(const struct MapLayout *);
void copy_map_tileset2_to_vram(const struct MapLayout *);
struct MapHeader const *const mapconnection_get_mapheader(struct MapConnection *connection);
struct MapConnection *GetConnectionAtCoords(s16 x, s16 y);
+void MapGridSetMetatileImpassabilityAt(int x, int y, bool32 impassable);
void SpriteCB_PokeballGlow(struct Sprite *);
void SpriteCB_PokecenterMonitor(struct Sprite *);
@@ -50,6 +51,5 @@ void SpriteCB_HallOfFameMonitor(struct Sprite *);
// field_region_map.c
void FieldInitRegionMap(MainCallback callback);
-void sub_8088B94(int x, int y, int a2);
#endif //GUARD_FIELDMAP_H
diff --git a/include/gba/types.h b/include/gba/types.h
index 7163f925f..35d02e263 100644
--- a/include/gba/types.h
+++ b/include/gba/types.h
@@ -27,6 +27,9 @@ typedef double f64;
typedef u8 bool8;
typedef u16 bool16;
typedef u32 bool32;
+typedef vu8 vbool8;
+typedef vu16 vbool16;
+typedef vu32 vbool32;
struct BgCnt
{
diff --git a/include/global.h b/include/global.h
index 2b03ebbe1..9612a25f0 100644
--- a/include/global.h
+++ b/include/global.h
@@ -6,6 +6,8 @@
#include "config.h" // we need to define config before gba headers as print stuff needs the functions nulled before defines.
#include "gba/gba.h"
#include "constants/global.h"
+#include "constants/flags.h"
+#include "constants/vars.h"
// Prevent cross-jump optimization.
#define BLOCK_CROSS_JUMP asm("");
@@ -109,6 +111,11 @@
f; \
})
+#define ROUND_BITS_TO_BYTES(numBits)(((numBits) / 8) + (((numBits) % 8) ? 1 : 0))
+
+#define DEX_FLAGS_NO (ROUND_BITS_TO_BYTES(POKEMON_SLOTS_NUMBER))
+#define NUM_FLAG_BYTES (ROUND_BITS_TO_BYTES(FLAGS_COUNT))
+
struct Coords8
{
s8 x;
@@ -153,8 +160,6 @@ struct Time
/*0x04*/ s8 seconds;
};
-#define DEX_FLAGS_NO ((POKEMON_SLOTS_NUMBER / 8) + ((POKEMON_SLOTS_NUMBER % 8) ? 1 : 0))
-
struct Pokedex
{
/*0x00*/ u8 order;
@@ -923,7 +928,7 @@ struct SaveBlock1
/*0x9CA*/ u8 trainerRematches[MAX_REMATCH_ENTRIES];
/*0xA30*/ struct ObjectEvent objectEvents[OBJECT_EVENTS_COUNT];
/*0xC70*/ struct ObjectEventTemplate objectEventTemplates[OBJECT_EVENT_TEMPLATES_COUNT];
- /*0x1270*/ u8 flags[FLAGS_COUNT];
+ /*0x1270*/ u8 flags[NUM_FLAG_BYTES];
/*0x139C*/ u16 vars[VARS_COUNT];
/*0x159C*/ u32 gameStats[NUM_GAME_STATS];
/*0x169C*/ struct BerryTree berryTrees[BERRY_TREES_COUNT];
@@ -960,7 +965,7 @@ struct SaveBlock1
/*0x2E20*/ u8 additionalPhrases[8]; // bitfield for 33 additional phrases in easy chat system
/*0x2E28*/ OldMan oldMan;
/*0x2e64*/ struct EasyChatPair easyChatPairs[5]; //Dewford trend [0] and some other stuff
- /*0x2e90*/ struct ContestWinner contestWinners[13]; // 0 - 5 used in contest hall, 6 - 7 unused?, 8 - 12 museum
+ /*0x2e90*/ struct ContestWinner contestWinners[NUM_CONTEST_WINNERS]; // see CONTEST_WINNER_*
/*0x3030*/ struct DayCare daycare;
/*0x3150*/ struct LinkBattleRecords linkBattleRecords;
/*0x31A8*/ u8 giftRibbons[52];
@@ -974,7 +979,7 @@ struct SaveBlock1
/*0x3B24*/ u8 seen2[DEX_FLAGS_NO];
/*0x3B58*/ LilycoveLady lilycoveLady;
/*0x3B98*/ struct TrainerNameRecord trainerNameRecords[20];
- /*0x3C88*/ u8 unk3C88[10][21];
+ /*0x3C88*/ u8 registeredTexts[UNION_ROOM_KB_ROW_COUNT][21];
/*0x3D5A*/ u8 filler3D5A[0xA];
/*0x3D64*/ struct SaveTrainerHill trainerHill;
/*0x3D70*/ struct WaldaPhrase waldaPhrase;
diff --git a/include/global.tv.h b/include/global.tv.h
index 34791d43c..ba1c3c37e 100644
--- a/include/global.tv.h
+++ b/include/global.tv.h
@@ -18,6 +18,13 @@ typedef union // size = 0x24
/*0x23*/ u8 trainerIdHi;
} common;
+ // Common init (used for initialization loop)
+ struct {
+ /*0x00*/ u8 kind;
+ /*0x01*/ bool8 active;
+ /*0x02*/ u8 pad02[34];
+ } commonInit;
+
// Local shows
// TVSHOW_FAN_CLUB_LETTER
struct {
diff --git a/include/graphics.h b/include/graphics.h
index b41a43095..8514d49bd 100644
--- a/include/graphics.h
+++ b/include/graphics.h
@@ -4082,8 +4082,8 @@ extern const u8 gNamingScreenUnderscoreTiles[];
extern const u32 gUnknown_08D9BA44[];
-extern const u32 gContestConfetti_Gfx[];
-extern const u32 gContestConfetti_Pal[];
+extern const u32 gConfetti_Gfx[];
+extern const u32 gConfetti_Pal[];
extern const u32 gUnknown_08C093F0[];
extern const u32 gSubstituteDollTilemap[];
@@ -4927,23 +4927,23 @@ extern const u32 gRouletteCreditTiles[];
extern const u32 gRouletteNumbersTiles[];
extern const u32 gRouletteMultiplierTiles[];
-// Contest Link
-extern const u32 gUnknown_08C19588[];
+// Contest util
+extern const u32 gContestResults_Gfx[];
extern const u32 gUnknown_08C19EEC[];
extern const u32 gUnknown_08C1A000[];
extern const u32 gUnknown_08C1A12C[];
-extern const u32 gUnknown_08C1A2B4[];
-extern const u16 gUnknown_08DC6498[];
-extern const u16 gUnknown_08DC63F8[];
-extern const u16 gUnknown_08DC6420[];
-extern const u16 gUnknown_08DC6448[];
-extern const u16 gUnknown_08DC6470[];
-extern const u16 gUnknown_08DC64AC[];
-extern const u16 gUnknown_08DC64C0[];
-extern const u16 gUnknown_08DC64D4[];
-extern const u16 gUnknown_08DC64E8[];
-extern const u16 gUnknown_08DC64FC[];
-extern const u16 gUnknown_08DC6510[];
+extern const u32 gContestResults_Pal[];
+extern const u16 gLinkContestResults_Tilemap[];
+extern const u16 gNormalContestResults_Tilemap[];
+extern const u16 gSuperContestResults_Tilemap[];
+extern const u16 gHyperContestResults_Tilemap[];
+extern const u16 gMasterContestResults_Tilemap[];
+extern const u16 gCoolContestResults_Tilemap[];
+extern const u16 gBeautyContestResults_Tilemap[];
+extern const u16 gCuteContestResults_Tilemap[];
+extern const u16 gSmartContestResults_Tilemap[];
+extern const u16 gToughContestResults_Tilemap[];
+extern const u16 gContestResults_Tilemap[];
// Trainer Card.
extern const u16 gHoennTrainerCard0Star_Pal[];
@@ -4986,14 +4986,14 @@ extern const u16 gEasyChatRightWindow_Pal[];
extern const u32 gUsePokeblockCondition_Gfx[];
// Union Room Chat
-extern const u16 gUnknown_08DD4BB0[];
-extern const u16 gUnknown_08DD4BD0[];
-extern const u32 gUnknown_08DD4BF0[];
-extern const u32 gUnknown_08DD4C4C[];
-extern const u32 gUnknown_08DD4CF8[];
-extern const u16 gLinkMiscMenu_Pal[];
-extern const u32 gLinkMiscMenu_Gfx[];
-extern const u32 gLinkMiscMenu_Tilemap[];
+extern const u16 gUnionRoomChat_Background_Pal[];
+extern const u32 gUnionRoomChat_Background_Gfx[];
+extern const u32 gUnionRoomChat_Background_Tilemap[];
+extern const u16 gUnionRoomChat_Window_Pal1[];
+extern const u16 gUnionRoomChat_Window_Pal2[];
+extern const u32 gUnionRoomChat_Border_Gfx[];
+extern const u32 gUnionRoomChat_Border_Tilemap[];
+extern const u32 gUnionRoomChat_RButtonLabels[];
// Use Pokeblock
extern const u8 gPokenavConditionCancel_Gfx[];
diff --git a/include/hall_of_fame.h b/include/hall_of_fame.h
index a83fad2fc..f1f456713 100644
--- a/include/hall_of_fame.h
+++ b/include/hall_of_fame.h
@@ -4,7 +4,6 @@
void CB2_DoHallOfFameScreen(void);
void CB2_DoHallOfFameScreenDontSaveData(void);
void CB2_DoHallOfFamePC(void);
-void DoConfettiEffect(void);
// hof_pc.c
void ReturnFromHallOfFamePC(void);
diff --git a/include/item_menu.h b/include/item_menu.h
index 9930ccd4f..edfb986f7 100644
--- a/include/item_menu.h
+++ b/include/item_menu.h
@@ -52,10 +52,7 @@ struct BagMenuStruct
void (*exitCallback)(void);
u8 tilemapBuffer[0x800];
u8 spriteId[12];
- u8 windowPointers[7];
- u8 unk817;
- u8 unk818;
- u8 unk819;
+ u8 windowPointers[10];
u8 itemOriginalLocation;
u8 pocketSwitchDisabled:4;
u8 itemIconSlot:2;
diff --git a/include/libgcnmultiboot.h b/include/libgcnmultiboot.h
index 7d347df05..4a6262d8f 100644
--- a/include/libgcnmultiboot.h
+++ b/include/libgcnmultiboot.h
@@ -1,4 +1,4 @@
-#ifndef GUARD_LIBGCMMULTIBOOT_H
+#ifndef GUARD_LIBGCNMULTIBOOT_H
#define GUARD_LIBGCNMULTIBOOT_H
struct GcmbStruct
diff --git a/include/link.h b/include/link.h
index f41161d23..25e62ff1e 100644
--- a/include/link.h
+++ b/include/link.h
@@ -73,10 +73,10 @@
#define LINKCMD_CANCEL_TRADE 0xEEBB
#define LINKCMD_0xEECC 0xEECC
-#define LINKTYPE_0x1111 0x1111 // trade
-#define LINKTYPE_0x1122 0x1122 // trade
-#define LINKTYPE_0x1133 0x1133 // trade
-#define LINKTYPE_0x1144 0x1144 // trade
+#define LINKTYPE_TRADE 0x1111
+#define LINKTYPE_TRADE_CONNECTING 0x1122
+#define LINKTYPE_TRADE_SETUP 0x1133
+#define LINKTYPE_TRADE_DISCONNECTED 0x1144
#define LINKTYPE_BATTLE 0x2211
#define LINKTYPE_0x2222 0x2222 // unused battle?
#define LINKTYPE_SINGLE_BATTLE 0x2233
@@ -85,13 +85,13 @@
#define LINKTYPE_BATTLE_TOWER_50 0x2266
#define LINKTYPE_BATTLE_TOWER_OPEN 0x2277
#define LINKTYPE_BATTLE_TOWER 0x2288
-#define LINKTYPE_0x3311 0x3311
-#define LINKTYPE_0x3322 0x3322
+#define LINKTYPE_RECORD_MIX_BEFORE 0x3311
+#define LINKTYPE_RECORD_MIX_AFTER 0x3322
#define LINKTYPE_BERRY_BLENDER_SETUP 0x4411
#define LINKTYPE_BERRY_BLENDER 0x4422
-#define LINKTYPE_0x5501 0x5501 // mystery event
+#define LINKTYPE_MYSTERY_EVENT 0x5501
#define LINKTYPE_0x5502 0x5502 // unused?
-#define LINKTYPE_0x5503 0x5503 // eReader
+#define LINKTYPE_EREADER 0x5503
#define LINKTYPE_CONTEST_GMODE 0x6601
#define LINKTYPE_CONTEST_EMODE 0x6602
@@ -126,10 +126,10 @@ enum
EXCHANGE_NOT_STARTED,
EXCHANGE_COMPLETE,
EXCHANGE_TIMED_OUT,
- EXCHANGE_IN_PROGRESS,
+ EXCHANGE_DIFF_SELECTIONS,
EXCHANGE_PLAYER_NOT_READY,
EXCHANGE_PARTNER_NOT_READY,
- EXCHANGE_STAT_6,
+ EXCHANGE_WRONG_NUM_PLAYERS,
EXCHANGE_STAT_7
};
@@ -274,9 +274,8 @@ void LoadWirelessStatusIndicatorSpriteGfx(void);
bool8 IsLinkTaskFinished(void);
void CreateWirelessStatusIndicatorSprite(u8, u8);
void sub_800ADF8(void);
-void sub_800B488(void);
+void SetWirelessCommType1(void);
void CheckShouldAdvanceLinkState(void);
-void sub_8011BD0(void);
u8 IsLinkMaster(void);
void sub_800AC34(void);
bool8 HandleLinkConnection(void);
@@ -285,14 +284,14 @@ void sub_800A418(void);
void SetSuppressLinkErrorMessage(bool8 flag);
void sub_800B524(struct LinkPlayer *linkPlayer);
u8 GetSioMultiSI(void);
-void sub_800AAF4(void);
-void sub_800AF18(u32 status, u8 lastSendQueueCount, u8 lastRecvQueueCount, u8 unk_06);
+void ClearSavedLinkPlayers(void);
+void BufferLinkErrorInfo(u32 status, u8 lastSendQueueCount, u8 lastRecvQueueCount, u8 unk_06);
void sub_800B348(void);
-void sub_800B3A4(u32 who);
-bool32 sub_800A07C(void);
+void LinkPlayerFromBlock(u32 who);
+bool32 Link_AnyPartnersPlayingFRLG_JP(void);
void ResetLinkPlayerCount(void);
-void sub_800AA04(u8 a0);
-void sub_800B4C0(void);
+void SaveLinkPlayers(u8 a0);
+void SetWirelessCommType0(void);
bool32 sub_800B504(void);
extern u16 gLinkPartnersHeldKeys[6];
@@ -331,18 +330,18 @@ extern u32 gFiller_03003080;
extern struct LinkPlayer gLocalLinkPlayer;
bool32 Link_AnyPartnersPlayingRubyOrSapphire(void);
-bool32 sub_800A03C(void);
+bool32 LinkDummy_Return2(void);
void SetLocalLinkPlayerId(u8);
u8 GetSavedPlayerCount(void);
void sub_8009FAC(void);
bool8 sub_800A4D8(u8 a0);
-u8 sub_800A9D8(void);
+u8 GetLinkPlayerCountAsBitFlags(void);
u8 sub_800A0C8(s32, s32);
-u8 sub_800A9A8(void);
+u8 GetSavedLinkPlayerCountAsBitFlags(void);
void sub_800AD10(void);
-void sub_800AB18(void);
-void sub_8009F18(void);
-bool8 sub_800AA60(void);
+void CheckLinkPlayersMatchSaved(void);
+void StartSendingKeysToLink(void);
+bool8 DoesLinkPlayerCountMatchSaved(void);
void sub_800ABF4(u16 a0);
bool32 IsSendingKeysToLink(void);
u32 GetLinkRecvQueueLength(void);
diff --git a/include/link_rfu.h b/include/link_rfu.h
index 2d74e686a..eede41d60 100644
--- a/include/link_rfu.h
+++ b/include/link_rfu.h
@@ -5,7 +5,43 @@
#include "link.h"
#include "AgbRfu_LinkManager.h"
-// Exported type declarations
+#define RFU_COMMAND_0x4400 0x4400
+#define RFU_COMMAND_0x8800 0x8800
+#define RFU_COMMAND_0x8900 0x8900
+#define RFU_COMMAND_0xA100 0xA100
+#define RFU_COMMAND_0x7700 0x7700
+#define RFU_COMMAND_0x7800 0x7800
+#define RFU_COMMAND_0x6600 0x6600
+#define RFU_COMMAND_0x5F00 0x5F00
+#define RFU_COMMAND_0x2F00 0x2F00
+#define RFU_COMMAND_0xBE00 0xBE00
+#define RFU_COMMAND_0xEE00 0xEE00
+#define RFU_COMMAND_0xED00 0xED00
+
+#define RFU_SERIAL_7F7D 0x7F7D
+
+#define RECV_QUEUE_NUM_SLOTS 32
+#define RECV_QUEUE_SLOT_LENGTH (14 * MAX_RFU_PLAYERS)
+
+#define SEND_QUEUE_NUM_SLOTS 40
+#define SEND_QUEUE_SLOT_LENGTH 14
+
+#define BACKUP_QUEUE_NUM_SLOTS 2
+#define BACKUP_QUEUE_SLOT_LENGTH 14
+
+#define RFU_STATUS_OK 0
+#define RFU_STATUS_FATAL_ERROR 1
+#define RFU_STATUS_CONNECTION_ERROR 2
+#define RFU_STATUS_CHILD_SEND_COMPLETE 3
+#define RFU_STATUS_NEW_CHILD_DETECTED 4
+#define RFU_STATUS_JOIN_GROUP_OK 5
+#define RFU_STATUS_JOIN_GROUP_NO 6
+#define RFU_STATUS_WAIT_ACK_JOIN_GROUP 7
+#define RFU_STATUS_LEAVE_GROUP_NOTICE 8
+#define RFU_STATUS_LEAVE_GROUP 9
+#define RFU_STATUS_10 10
+#define RFU_STATUS_11 11
+#define RFU_STATUS_ACK_JOIN_GROUP 12
// RfuTgtData.gname is read as these structs.
struct GFtgtGnameSub
@@ -13,12 +49,11 @@ struct GFtgtGnameSub
u16 language:4;
u16 hasNews:1;
u16 hasCard:1;
- u16 unk_00_6:1;
+ u16 unknown:1; // Never read
u16 isChampion:1;
u16 hasNationalDex:1;
u16 gameClear:1;
u16 version:4;
- u16 unk_01_6:2;
u8 playerTrainerId[2];
};
@@ -38,111 +73,73 @@ struct __attribute__((packed, aligned(2))) GFtgtGname
u8 padding;
}; // size: RFU_GNAME_SIZE
-struct UnkLinkRfuStruct_02022B2C
-{
- u8 unk_00;
- u8 unk_01;
- u16 unk_02;
- u8 unk_04;
- u16 unk_06;
- struct GFtgtGname *unk_08;
- u8 *unk_0c;
- u8 unk_10;
- u8 unk_11;
- u16 unk_12;
- u16 unk_14;
-};
-
-struct UnkLinkRfuStruct_02022B44
-{
- u8 fill_00[6];
- u16 unk_06;
- u8 fill_08[6];
- vu8 unk_0e;
- u8 unk_0f;
- u8 fill_10[0x54];
- u16 unk_64;
- u8 fill_66[0x1d];
- u8 unk_83;
- u8 fill_84[0x58];
-};
-
-struct UnkRfuStruct_2_Sub_6c
+struct RfuBlockSend
{
- /* 0x00 */ u16 unk_00;
- /* 0x02 */ u16 unk_02;
- /* 0x04 */ const u8 *unk_04;
- /* 0x08 */ u32 unk_08;
- /* 0x0c */ u32 unk_0c;
- /* 0x10 */ u8 unk_10;
- /* 0x11 */ u8 unk_11;
- /* 0x12 */ u8 unk_12;
+ /* 0x00 */ u16 next;
+ /* 0x02 */ u16 count;
+ /* 0x04 */ const u8 *payload;
+ /* 0x08 */ u32 receivedFlags;
+ /* 0x0c */ u32 failedFlags;
+ /* 0x10 */ bool8 sending;
+ /* 0x11 */ u8 owner;
+ /* 0x12 */ u8 receiving;
};
-struct UnkRfuStruct_2_Sub_124
+struct RfuRecvQueue
{
- /* 0x000 */ u8 unk_00[32][70];
- /* 0x8c0 */ vu8 unk_8c0;
- /* 0x8c1 */ vu8 unk_8c1;
- /* 0x8c2 */ vu8 unk_8c2;
- /* 0x8c3 */ vu8 unk_8c3;
+ /* 0x000 */ u8 slots[RECV_QUEUE_NUM_SLOTS][RECV_QUEUE_SLOT_LENGTH];
+ /* 0x8c0 */ vu8 recvSlot;
+ /* 0x8c1 */ vu8 sendSlot;
+ /* 0x8c2 */ vu8 count;
+ /* 0x8c3 */ vu8 full;
};
-struct UnkRfuStruct_2_Sub_9e8
+struct RfuSendQueue
{
- /* 0x000 */ u8 unk_00[40][14];
- /* 0x230 */ vu8 unk_230;
- /* 0x231 */ vu8 unk_231;
- /* 0x232 */ vu8 unk_232;
- /* 0x233 */ vu8 unk_233;
+ /* 0x000 */ u8 slots[SEND_QUEUE_NUM_SLOTS][SEND_QUEUE_SLOT_LENGTH];
+ /* 0x230 */ vu8 recvSlot;
+ /* 0x231 */ vu8 sendSlot;
+ /* 0x232 */ vu8 count;
+ /* 0x233 */ vu8 full;
};
-struct UnkRfuStruct_2_Sub_c1c
+struct RfuBackupQueue
{
- /* 0x00 */ u8 unk_00[2][14];
- /* 0x1c */ vu8 unk_1c;
- /* 0x1d */ vu8 unk_1d;
- /* 0x1e */ vu8 unk_1e;
+ /* 0x00 */ u8 slots[BACKUP_QUEUE_NUM_SLOTS][BACKUP_QUEUE_SLOT_LENGTH];
+ /* 0x1c */ vu8 recvSlot;
+ /* 0x1d */ vu8 sendSlot;
+ /* 0x1e */ vu8 count;
};
-struct UnkRfuStruct_Sub_Unused
+struct GFRfuManager
{
- /* 0x000 */ u8 unk_00[2][256];
- /* 0x200 */ vu8 unk_200;
- /* 0x201 */ vu8 unk_201;
- /* 0x202 */ vu8 unk_202;
- /* 0x203 */ vu8 unk_203;
-};
-
-struct UnkRfuStruct_2
-{
- /* 0x000 */ void (*linkRfuCallback)(void);
- /* 0x004 */ u16 unk_04;
+ /* 0x000 */ void (*callback)(void);
+ /* 0x004 */ u16 state;
/* 0x006 */ u8 filler_06[4];
- /* 0x00a */ u16 unk_0a;
- /* 0x00c */ u8 unk_0c;
+ /* 0x00a */ u16 linkmanMsg;
+ /* 0x00c */ u8 parentChild;
/* 0x00d */ u8 playerCount;
- /* 0x00e */ u8 unk_0e;
+ /* 0x00e */ bool8 unk_0e;
/* 0x00f */ u8 unk_0f;
/* 0x010 */ u16 unk_10;
/* 0x012 */ u16 unk_12;
- /* 0x014 */ u8 unk_14[4][14];
+ /* 0x014 */ u8 unk_14[RFU_CHILD_MAX][14];
/* 0x04c */ u8 unk_4c[14];
/* 0x05a */ u8 unk_5a;
/* 0x05b */ u8 unk_5b;
- /* 0x05c */ u8 unk_5c[5];
- /* 0x061 */ u8 unk_61[5];
- /* 0x066 */ u8 unk_66;
- /* 0x067 */ u8 unk_67;
+ /* 0x05c */ bool8 blockReceived[MAX_RFU_PLAYERS];
+ /* 0x061 */ bool8 numBlocksReceived[MAX_RFU_PLAYERS];
+ /* 0x066 */ u8 idleTaskId;
+ /* 0x067 */ u8 searchTaskId;
/* 0x068 */ u8 filler_68[4];
- /* 0x06c */ struct UnkRfuStruct_2_Sub_6c unk_6c;
- /* 0x080 */ struct UnkRfuStruct_2_Sub_6c unk_80[5];
+ /* 0x06c */ struct RfuBlockSend sendBlock;
+ /* 0x080 */ struct RfuBlockSend recvBlock[MAX_RFU_PLAYERS];
/* 0x0e4 */ u8 unk_e4[5];
/* 0x0e9 */ u8 unk_e9[5];
- /* 0x0ee */ vu8 unk_ee;
- /* 0x0ef */ u8 unk_ef;
- /* 0x0f0 */ u8 unk_f0;
- /* 0x0f1 */ u8 unk_f1;
+ /* 0x0ee */ vu8 errorState;
+ /* 0x0ef */ bool8 isShuttingDown;
+ /* 0x0f0 */ u8 linkLossRecoveryState;
+ /* 0x0f1 */ u8 status;
/* 0x0f2 */ u16 unk_f2[6];
/* 0x0fe */ u16 unk_fe;
/* 0x100 */ u16 unk_100;
@@ -151,193 +148,137 @@ struct UnkRfuStruct_2
/* 0x10A */ struct GFtgtGname unk_10A;
u8 filler_;
u8 playerName[PLAYER_NAME_LENGTH + 1];
- /* 0x124 */ struct UnkRfuStruct_2_Sub_124 unk_124;
- /* 0x9e8 */ struct UnkRfuStruct_2_Sub_9e8 unk_9e8;
- /* 0xc1c */ struct UnkRfuStruct_2_Sub_c1c unk_c1c;
- /* 0xc3c */ vu8 unk_c3c;
+ /* 0x124 */ struct RfuRecvQueue recvQueue;
+ /* 0x9e8 */ struct RfuSendQueue sendQueue;
+ /* 0xc1c */ struct RfuBackupQueue backupQueue;
+ /* 0xc3c */ vu8 linkRecovered;
/* 0xc3d */ u8 unk_c3d;
- /* 0xc3e */ vu8 unk_c3e;
+ /* 0xc3e */ vu8 childSlot;
/* 0xc3f */ u8 unk_c3f[70];
/* 0xc85 */ u8 unk_c85;
- /* 0xc86 */ u8 unk_c86;
- /* 0xc87 */ u8 unk_c87[5][7][2];
- /* 0xccd */ u8 unk_ccd;
- /* 0xcce */ u8 unk_cce;
+ /* 0xc86 */ u8 recvStatus;
+ /* 0xc87 */ u8 recvCmds[5][7][2];
+ /* 0xccd */ u8 parentId;
+ /* 0xcce */ u8 multiplayerId;
/* 0xccf */ u8 unk_ccf;
/* 0xcd0 */ vu8 unk_cd0;
- /* 0xcd1 */ u8 unk_cd1[4];
- /* 0xcd5 */ u8 unk_cd5[4];
+ /* 0xcd1 */ u8 partnerSendStatuses[RFU_CHILD_MAX];
+ /* 0xcd5 */ u8 partnerRecvStatuses[RFU_CHILD_MAX];
/* 0xcd9 */ u8 unk_cd9;
/* 0xcda */ u8 unk_cda;
- /* 0xcdb */ vu8 unk_cdb;
- /* 0xcdc */ vu8 unk_cdc;
+ /* 0xcdb */ vbool8 unk_cdb;
+ /* 0xcdc */ vbool8 unk_cdc;
/* 0xcdd */ u8 unk_cdd;
- /* 0xcde */ u8 unk_cde[4];
+ /* 0xcde */ u8 linkPlayerIdx[RFU_CHILD_MAX];
/* 0xce2 */ u8 unk_ce2;
/* 0xce2 */ u8 unk_ce3;
/* 0xce4 */ u8 unk_ce4;
/* 0xce5 */ u8 unk_ce5;
/* 0xce5 */ u8 unk_ce6;
- /* 0xce7 */ u8 unk_ce7;
+ /* 0xce7 */ u8 acceptSlot_flag;
/* 0xce8 */ u8 unk_ce8;
/* 0xce9 */ u8 unk_ce9;
/* 0xcea */ u8 unk_cea[4];
/* 0xcee */ u8 unk_cee[4];
}; // size = 0xcf4
-struct UnkRfuStruct_8010A14
-{
- char unk_00[15];
- u8 unk_0f;
- u8 unk_10[4];
- struct LinkPlayer unk_14[5];
- u8 fill_a0[0x5c];
-};
-
// Exported RAM declarations
-extern struct GFtgtGname gUnknown_02022B14;
-extern u8 gUnknown_02022B22[];
-extern struct UnkRfuStruct_2 Rfu;
+extern struct GFtgtGname gHostRFUtgtGnameBuffer;
+extern u8 gHostRFUtgtUnameBuffer[];
+extern struct GFRfuManager Rfu;
extern u8 gWirelessStatusIndicatorSpriteId;
// Exported ROM declarations
void WipeTrainerNameRecords(void);
-void sub_800E700(void);
-void sub_800EDD4(void);
-void sub_800F6FC(u8 who);
-void sub_800F728(u8 who);
+void InitRFUAPI(void);
+void LinkRfu_Shutdown(void);
+void Rfu_SetBlockReceivedFlag(u8 who);
+void Rfu_ResetBlockReceivedFlag(u8 who);
bool32 IsSendingKeysToRfu(void);
-void sub_800F804(void);
+void StartSendingKeysToRfu(void);
void sub_800F850(void);
-u8 sub_800FCD8(void);
-bool32 sub_800FE84(const u8 *src, size_t size);
+u8 Rfu_GetBlockReceivedStatus(void);
+bool32 Rfu_InitBlockSend(const u8 *src, size_t size);
void ClearLinkRfuCallback(void);
-u8 sub_80104F4(void);
-u8 rfu_get_multiplayer_id(void);
+u8 Rfu_GetLinkPlayerCount(void);
+u8 Rfu_GetMultiplayerId(void);
bool8 sub_8010100(u8 a0);
bool8 IsLinkRfuTaskFinished(void);
bool8 Rfu_IsMaster(void);
void task_add_05_task_del_08FA224_when_no_RfuFunc(void);
void sub_8010434(void);
-void sub_800E604(void);
-void sub_800E174(void);
-void sub_800E6D0(void);
+void ResetLinkRfuGFLayer(void);
+void UpdateWirelessStatusIndicatorSprite(void);
+void InitRFU(void);
bool32 sub_8010EC0(void);
bool32 sub_8010F1C(void);
-bool32 sub_8011A80(void);
+bool32 RfuHasErrored(void);
bool32 IsRfuRecvQueueEmpty(void);
u32 GetRfuRecvQueueLength(void);
void RfuVSync(void);
void sub_80111B0(bool32 a0);
-u8 sub_8011A74(void);
-struct GFtgtGname *sub_800F7DC(void);
-void sub_8011068(u8 a0);
-void sub_8011170(u32 a0);
-void sub_8011A64(u8 a0, u16 a1);
+u8 RfuGetStatus(void);
+struct GFtgtGname *GetHostRFUtgtGname(void);
+void UpdateGameData_GroupLockedIn(u8 a0);
+void GetLinkmanErrorParams(u32 a0);
+void RfuSetStatus(u8 a0, u16 a1);
u8 sub_801048C(bool32 a0);
-void sub_800DF90(struct GFtgtGname *buff1, u8 *buff2);
-void sub_8010F84(u8 a0, u32 a1, u32 a2);
-void sub_8011C10(u32 a0);
+void LinkRfu3_SetGnameUnameFromStaticBuffers(struct GFtgtGname *buff1, u8 *buff2);
+void SetHostRFUtgtGname(u8 activity, u32 child_sprite_genders, bool32 started);
+void InitializeRfuLinkManager_LinkLeader(u32 a0);
bool32 sub_8012240(void);
-void sub_800EF38(void);
+void LinkRfu_StopManagerAndFinalizeSlots(void);
bool32 sub_80105EC(void);
-bool32 sub_801064C(u16 a0, const u8 *a1);
-void sub_8010688(u8 a0, u16 a1, const u8 *a2);
-u32 sub_8010714(u16 a0, const u8 *a1);
-void sub_8011DC0(const u8 *a0, u16 a1);
-bool8 sub_800EF1C(void);
-bool32 sub_800EF58(bool32 a0);
-void DestroyWirelessStatusIndicatorSprite(void);
+bool32 HasTrainerLeftPartnersList(u16 trainerId, const u8 *name);
+void SendRfuStatusToPartner(u8 status, u16 trainerId, const u8 *name);
+u32 WaitSendRfuStatusToPartner(u16 trainerId, const u8 *name);
+void RequestDisconnectSlotByTrainerNameAndId(const u8 *a0, u16 a1);
+bool8 LmanAcceptSlotFlagIsNotZero(void);
+bool32 WaitRfuState(bool32 a0);
void sub_801103C(void);
-void sub_8011C5C(void);
-void sub_80106D4(void);
+void InitializeRfuLinkManager_JoinGroup(void);
+void SendLeaveGroupNotice(void);
void RecordMixTrainerNames(void);
-void sub_800ED10(void);
-void sub_800ED28(void);
-void sub_8011090(u8 a0, u32 a1, u32 a2);
-void sub_8011FC8(const u8 *src, u16 trainerId);
-void sub_8010FA0(bool32 a0, bool32 a1);
-void sub_8010F60(void);
-void sub_8010FCC(u32 a0, u32 a1, u32 a2);
-void sub_8011C84(void);
+void LinkRfu_CreateConnectionAsParent(void);
+void LinkRfu_StopManagerBeforeEnteringChat(void);
+void UpdateGameData_SetActivity(u8 activity, u32 flags, bool32 started);
+void CreateTask_RfuReconnectWithParent(const u8 *src, u16 trainerId);
+void SetGnameBufferWonderFlags(bool32 a0, bool32 a1);
+void ClearAndInitHostRFUtgtGname(void);
+void SetTradeBoardRegisteredMonInfo(u32 type, u32 species, u32 level);
+void InitializeRfuLinkManager_EnterUnionRoom(void);
void sub_8012188(const u8 *name, struct GFtgtGname *structPtr, u8 a2);
-bool32 sub_8011B90(void);
+bool32 IsUnionRoomListenTaskActive(void);
void sub_800FE50(void *a0);
-bool32 sub_800E540(u16 id, u8 *name);
+bool32 PlayerHasMetTrainerBefore(u16 id, u8 *name);
void sub_8011DE0(u32 arg0);
u8 sub_801100C(s32 a0);
void sub_800EF7C(void);
-bool8 sub_800DE7C(struct GFtgtGname *buff1, u8 *buff2, u8 idx);
-bool8 sub_800DF34(struct GFtgtGname *buff1, u8 *buff2, u8 idx);
+bool8 LinkRfu_GetNameIfCompatible(struct GFtgtGname *buff1, u8 *buff2, u8 idx);
+bool8 LinkRfu_GetNameIfSerial7F7D(struct GFtgtGname *buff1, u8 *buff2, u8 idx);
s32 sub_800E87C(u8 idx);
-void sub_8011BA4(void);
-void sub_8010198(void);
+void CreateTask_RfuIdle(void);
+void DestroyTask_RfuIdle(void);
void sub_8011AC8(void);
void LinkRfu_FatalError(void);
bool32 sub_8011A9C(void);
void sub_80104B0(void);
void sub_8011A50(void);
void sub_80110B8(u32 a0);
-bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2);
-void sub_800EAB4(void);
-void sub_800EAFC(void);
-void sub_800ED34(u16 unused);
-void sub_800EDBC(u16 unused);
-void sub_800F048(void);
-void sub_800F86C(u8 unused);
-void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data);
-void sub_800FD14(u16 command);
-void rfufunc_80F9F44(void);
-void sub_800FFB0(void);
-void rfufunc_80FA020(void);
-bool32 sub_8010454(u32 a0);
-void sub_8010528(void);
-void sub_8010750(void);
-s32 sub_80107A0(void);
-void sub_801084C(u8 taskId);
-void sub_80109E8(u16 a0);
-void sub_8010A70(void *a0);
-void sub_8010AAC(u8 taskId);
-void sub_8010D0C(u8 taskId);
-void sub_80115EC(s32 a0);
-u8 sub_8011CE4(const u8 *a0, u16 a1);
-void sub_8011D6C(u32 a0);
-void sub_8011E94(u32 a0, u32 a1);
-bool8 sub_8012224(void);
-void sub_801227C(void);
-void sub_801209C(u8 taskId);
-void sub_8011BF8(void);
-void sub_8011BA4(void);
-void sub_800D6C8(struct UnkRfuStruct_2_Sub_124 *ptr);
-void sub_800D724(struct UnkRfuStruct_2_Sub_9e8 *ptr);
-void sub_800D780(struct UnkRfuStruct_Sub_Unused *ptr);
-void sub_800D7D8(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2);
-void sub_800D888(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2);
-bool8 sub_800D934(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2);
-bool8 sub_800D9DC(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2);
-void sub_800DA68(struct UnkRfuStruct_2_Sub_c1c *q1, const u8 *q2);
-bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2);
-void sub_800DB18(struct UnkRfuStruct_Sub_Unused *q1, u8 *q2);
-bool8 sub_800DB84(struct UnkRfuStruct_Sub_Unused *q1, u8 *q2);
-void sub_800DBF8(u8 *q1, u8 mode);
-void PkmnStrToASCII(u8 *q1, const u8 *q2);
-void ASCIIToPkmnStr(u8 *q1, const u8 *q2);
-u8 sub_800DD1C(u8 maxFlags);
-void sub_800DD94(struct GFtgtGname *data, u8 r9, bool32 r2, s32 r3);
-bool8 sub_800DE7C(struct GFtgtGname *buff1, u8 *buff2, u8 idx);
-bool8 sub_800DF34(struct GFtgtGname *buff1, u8 *buff2, u8 idx);
-void sub_800DF90(struct GFtgtGname *buff1, u8 *buff2);
+bool32 IsRfuSerialNumberValid(u32 serialNo);
+bool8 IsRfuRecoveringFromLinkLoss(void);
+void RfuRecvQueue_Reset(struct RfuRecvQueue *queue);
+void RfuSendQueue_Reset(struct RfuSendQueue *queue);
+void RfuRecvQueue_Enqueue(struct RfuRecvQueue *queue, u8 *data);
+void RfuSendQueue_Enqueue(struct RfuSendQueue *queue, u8 *data);
+bool8 RfuRecvQueue_Dequeue(struct RfuRecvQueue *queue, u8 *dest);
+bool8 RfuSendQueue_Dequeue(struct RfuSendQueue *queue, u8 *dest);
+void RfuBackupQueue_Enqueue(struct RfuBackupQueue *queue, const u8 *q2);
+bool8 RfuBackupQueue_Dequeue(struct RfuBackupQueue *queue, u8 *q2);
+void InitHostRFUtgtGname(struct GFtgtGname *data, u8 activity, bool32 started, s32 child_sprite_genders);
void CreateWirelessStatusIndicatorSprite(u8 x, u8 y);
void DestroyWirelessStatusIndicatorSprite(void);
void LoadWirelessStatusIndicatorSpriteGfx(void);
-u8 sub_800E124(void);
-void sub_800E15C(struct Sprite *sprite, s32 signalStrengthAnimNum);
-void sub_800E174(void);
-void CopyTrainerRecord(struct TrainerNameRecord *dest, u32 trainerId, const u8 *name);
-bool32 NameIsNotEmpty(const u8 *name);
-void RecordMixTrainerNames(void);
-bool32 sub_800E540(u16 id, u8 *name);
-void WipeTrainerNameRecords(void);
#endif //GUARD_LINK_RFU_H
diff --git a/include/menu.h b/include/menu.h
index 1f4d63284..20eda0fce 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -79,7 +79,7 @@ void sub_8198DBC(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 itemCount, u
u8 sub_8199944(u8 windowId, u8 optionWidth, u8 columns, u8 rows, u8 initialCursorPos);
u8 sub_8199134(s8, s8);
u8 GetStartMenuWindowId(void);
-void sub_819A2BC(u8, u8);
+void ListMenuLoadStdPalAt(u8, u8);
u8 Menu_MoveCursor(s8 cursorDelta);
u8 Menu_MoveCursorNoWrapAround(s8 cursorDelta);
void DrawStdWindowFrame(u8 windowId, bool8 CopyToVram);
diff --git a/include/mevent.h b/include/mevent.h
index a34ca355c..8c0ebbad7 100755
--- a/include/mevent.h
+++ b/include/mevent.h
@@ -57,7 +57,7 @@ u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const vo
bool32 MEventStruct_Unk1442CC_CompareField_unk_16(const struct MEventStruct_Unk1442CC *a0, const u16 *a1);
u16 MEventStruct_Unk1442CC_GetValueNFrom_unk_20(const struct MEventStruct_Unk1442CC *a0, u32 command);
u16 mevent_081445C0(u32 command);
-void sub_801B940(void);
-bool32 sub_801B94C(u16 a0);
+void ResetReceivedWonderCardFlag(void);
+bool32 MEventHandleReceivedWonderCard(u16 a0);
#endif //GUARD_MEVENT_H
diff --git a/include/mevent2.h b/include/mevent2.h
index 80b1fd51b..316a9e6de 100644
--- a/include/mevent2.h
+++ b/include/mevent2.h
@@ -1,6 +1,6 @@
#ifndef GUARD_MEVENT2_H
#define GUARD_MEVENT2_H
-void sub_801B990(u32, u32);
+void RecordIdOfWonderCardSenderByEventType(u32, u32);
#endif //GUARD_MEVENT2_H
diff --git a/include/mystery_gift.h b/include/mystery_gift.h
index 243895a67..fb0414ee0 100644
--- a/include/mystery_gift.h
+++ b/include/mystery_gift.h
@@ -12,5 +12,7 @@ bool32 MG_PrintTextOnWindow1AndWaitButton(u8 *textState, const u8 *str);
void AddTextPrinterToWindow1(const u8 *src);
void c2_ereader(void);
void c2_mystery_gift(void);
+void MG_DrawTextBorder(u8 windowId);
+s8 mevent_message_print_and_prompt_yes_no(u8 *textState, u16 *windowId, bool8 yesNoBoxPlacement, const u8 *str);
#endif //GUARD_MYSTERY_GIFT_H
diff --git a/include/pokeblock.h b/include/pokeblock.h
index 6dd07b689..0d413a810 100644
--- a/include/pokeblock.h
+++ b/include/pokeblock.h
@@ -1,6 +1,9 @@
#ifndef GUARD_POKEBLOCK_H
#define GUARD_POKEBLOCK_H
+#include "constants/berry.h"
+#include "constants/pokemon.h"
+
#define GFX_TAG_POKEBLOCK 14818
#define GFX_TAG_POKEBLOCK_CASE 14800
@@ -43,7 +46,7 @@ void ChooseMonToGivePokeblock(struct Pokeblock *pokeblock, void (*callback)(void
void CB2_PreparePokeblockFeedScene(void);
// pokeblock
-extern const s8 gPokeblockFlavorCompatibilityTable[];
+extern const s8 gPokeblockFlavorCompatibilityTable[NUM_NATURES * FLAVOR_COUNT];
extern const u8 *const gPokeblockNames[];
extern const struct CompressedSpriteSheet gPokeblockCase_SpriteSheet;
extern const struct CompressedSpritePalette gPokeblockCase_SpritePal;
diff --git a/include/pokemon.h b/include/pokemon.h
index 7ac65d36b..69ef7a142 100644
--- a/include/pokemon.h
+++ b/include/pokemon.h
@@ -279,8 +279,8 @@ void sub_80686FC(struct Pokemon *mon, struct BattleTowerPokemon *dest);
void CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId);
bool8 sub_80688F8(u8 caseId, u8 battlerId);
void SetDeoxysStats(void);
-u16 sub_8068B48(void);
-u16 sub_8068BB0(void);
+u16 GetUnionRoomTrainerPic(void);
+u16 GetUnionRoomTrainerClass(void);
void CreateObedientEnemyMon(void);
void CalculateMonStats(struct Pokemon *mon);
void BoxMonToMon(const struct BoxPokemon *src, struct Pokemon *dest);
diff --git a/include/pokemon_jump.h b/include/pokemon_jump.h
index 9cf65212f..91733b385 100644
--- a/include/pokemon_jump.h
+++ b/include/pokemon_jump.h
@@ -3,7 +3,7 @@
#include "main.h"
-void sub_802A9A8(u16 monId, MainCallback callback);
+void StartPokemonJump(u16 monId, MainCallback callback);
bool32 IsSpeciesAllowedInPokemonJump(u16 species);
void IsPokemonJumpSpeciesInParty(void);
void ResetPokeJumpResults(void);
diff --git a/include/rom_81520A8.h b/include/rom_81520A8.h
deleted file mode 100644
index 2be12200f..000000000
--- a/include/rom_81520A8.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef GUARD_ROM_81520A8_H
-#define GUARD_ROM_81520A8_H
-
-struct UnkStruct_81520A8
-{
- struct OamData oam;
- s16 x;
- s16 y;
- s16 xDelta;
- s16 yDelta;
- u16 tileTag;
- u16 palTag;
- u16 tileNum;
- u8 id;
- u8 filler17; // Unused.
- u8 unk18;
- u8 unk19_0:1;
- u8 unk19_1:1;
- u8 unk19_2:1;
- u8 priority:2;
- s16 data[8];
- void (*callback)(struct UnkStruct_81520A8 *);
-};
-
-bool32 sub_81521C0(u8 count);
-bool32 sub_8152254(void);
-bool32 sub_81522D4(void);
-u8 sub_8152438(u8 id, void (*func)(struct UnkStruct_81520A8 *));
-u8 sub_8152474(u8 id, u8 dataArrayId, s16 dataValue);
-u8 sub_81524C4(const struct OamData *oam, u16 tileTag, u16 palTag, s16 x, s16 y, u8 arg5, u8 priority);
-u8 sub_81525D0(u8 id);
-
-#endif // GUARD_ROM_81520A8_H
diff --git a/include/save.h b/include/save.h
index 225b2b62c..18b57502b 100644
--- a/include/save.h
+++ b/include/save.h
@@ -102,7 +102,7 @@ u8 Save_LoadGameData(u8 saveType);
u16 sub_815355C(void);
u32 TryReadSpecialSaveSection(u8 sector, u8* dst);
u32 TryWriteSpecialSaveSection(u8 sector, u8* src);
-void sub_8153688(u8 taskId);
+void Task_LinkSave(u8 taskId);
// save_failed_screen.c
void DoSaveFailedScreen(u8 saveType);
diff --git a/include/start_menu.h b/include/start_menu.h
index df2a290a2..1ddd82066 100644
--- a/include/start_menu.h
+++ b/include/start_menu.h
@@ -8,8 +8,8 @@ void Task_ShowStartMenu(u8 taskId);
void ShowStartMenu(void);
void ShowBattlePyramidStartMenu(void);
void SaveGame(void);
-void sub_80A0514(void);
-void sub_80A08CC(void);
+void CB2_SetUpSaveAfterLinkBattle(void);
+void SaveForBattleTowerLink(void);
void HideStartMenu(void);
void AppendToList(u8* list, u8* pos, u8 newEntry);
diff --git a/include/starter_choose.h b/include/starter_choose.h
index 535e272b7..7a4f6e967 100644
--- a/include/starter_choose.h
+++ b/include/starter_choose.h
@@ -5,6 +5,7 @@ extern const u16 gBirchBagGrassPal[2][16];
extern const u32 gBirchBagTilemap[];
extern const u32 gBirchGrassTilemap[];
extern const u32 gBirchHelpGfx[];
+extern const u32 gPokeballSelection_Gfx[];
u16 GetStarterPokemon(u16 chosenStarterId);
void CB2_ChooseStarter(void);
diff --git a/include/strings.h b/include/strings.h
index 5720598ad..702392efa 100644
--- a/include/strings.h
+++ b/include/strings.h
@@ -374,6 +374,9 @@ extern const u8 gText_DefaultNameTerra[];
extern const u8 gText_DefaultNameLucy[];
extern const u8 gText_DefaultNameHalie[];
+extern const u8 gText_BirchInTrouble[];
+extern const u8 gText_ConfirmStarterChoice[];
+
// mystery event menu text
extern const u8 gText_EventSafelyLoaded[];
extern const u8 gText_LoadErrorEndingSession[];
@@ -962,7 +965,7 @@ extern const u8 gText_TwoDashes[];
extern const u8 *const gReturnToXStringsTable2[];
-extern const u8 gText_XPLink[];
+extern const u8 gText_NumPlayerLink[];
extern const u8 gText_ConfirmLinkWhenPlayersReady[];
extern const u8 gText_ConfirmStartLinkWithXPlayers[];
extern const u8 gText_AwaitingLinkup[];
@@ -2494,7 +2497,7 @@ extern const u8 gText_CommunicationStandby[];
extern const u8 gText_AnnouncingResults[];
extern const u8 gText_PreliminaryResults[];
extern const u8 gText_Round2Results[];
-extern const u8 gText_Var1sVar2Won[];
+extern const u8 gText_ContestantsMonWon[];
// Trainer Card
extern const u8 gText_LinkCableBattles[];
@@ -2815,10 +2818,10 @@ extern const u8 gText_RegisterTextHere[];
extern const u8 gText_InputText[];
extern const u8 gText_ExitingChat[];
extern const u8 gText_LeaderLeftEndingChat[];
-extern const u8 gText_RegisteredTextChanged[];
-extern const u8 gText_AlreadySavedFile_Unused[];
-extern const u8 gText_SavingDontTurnOff_Unused[];
-extern const u8 gText_PlayerSavedGame_Unused[];
+extern const u8 gText_RegisteredTextChangedOKToSave[];
+extern const u8 gText_AlreadySavedFile_Chat[];
+extern const u8 gText_SavingDontTurnOff_Chat[];
+extern const u8 gText_PlayerSavedGame_Chat[];
extern const u8 gText_IfLeaderLeavesChatEnds[];
extern const u8 gText_Upper[];
extern const u8 gText_Lower[];
diff --git a/include/union_room.h b/include/union_room.h
index 4c4cb5a62..563a048d3 100644
--- a/include/union_room.h
+++ b/include/union_room.h
@@ -2,71 +2,70 @@
#define GUARD_UNION_ROOM_H
#include "link_rfu.h"
+#include "link.h"
+#include "constants/union_room.h"
// Exported type declarations
-struct UnkStruct_Shared
+struct WirelessGnameUnamePair
{
- struct GFtgtGname field_0;
+ struct GFtgtGname gname;
u8 ALIGNED(4) playerName[PLAYER_NAME_LENGTH + 1];
};
struct UnkStruct_x1C
{
- struct UnkStruct_Shared unk0;
- u8 unk18:1;
+ struct WirelessGnameUnamePair gname_uname;
+ u8 active:1;
};
struct UnkStruct_x20
{
- struct UnkStruct_Shared unk;
- u16 field_18;
- u8 field_1A_0:2;
- u8 field_1A_1:1;
+ struct WirelessGnameUnamePair gname_uname;
+ u16 timeoutCounter;
+ u8 groupScheduledAnim:2;
+ bool8 useRedText:1; // Never set
u8 field_1B;
- u8 field_1D;
- u8 field_1E;
- u8 field_1F;
+ u8 filler[3];
};
struct UnkStruct_Main0
{
- struct UnkStruct_x20 arr[8];
+ struct UnkStruct_x20 arr[MAX_UNION_ROOM_PLAYERS];
};
struct UnkStruct_Main4
{
- struct UnkStruct_x1C arr[5];
+ struct UnkStruct_x1C arr[MAX_RFU_PLAYERS];
};
struct UnkStruct_Main8
{
- struct UnkStruct_x20 arr[5];
+ struct UnkStruct_x20 arr[MAX_RFU_PLAYERS];
};
-struct UnkStruct_Leader
+struct WirelessLink_Leader
{
struct UnkStruct_Main0 *field_0;
struct UnkStruct_Main4 *field_4;
struct UnkStruct_Main8 *field_8;
u8 state;
u8 textState;
- u8 field_E;
+ u8 delayTimerAfterOk;
u8 listWindowId;
- u8 field_10;
- u8 field_11;
+ u8 bButtonCancelWindowId;
+ u8 nPlayerModeWindowId;
u8 listTaskId;
- u8 field_13;
- u8 field_14;
- u8 field_15;
+ u8 playerCount;
+ u16 field_14;
u8 field_16;
- u8 field_17;
- u8 field_18;
- u8 field_19;
- u16 field_1A;
+ u8 listenTaskId;
+ u8 activity;
+ u8 joinRequestAnswer;
+ u16 memberConfirmTimeout;
};
-struct UnkStruct_Group
+struct WirelessLink_Group
{
struct UnkStruct_Main0 *field_0;
struct UnkStruct_Main4 *field_4;
@@ -74,98 +73,96 @@ struct UnkStruct_Group
u8 textState;
u8 field_A;
u8 listWindowId;
- u8 field_C;
- u8 field_D;
+ u8 bButtonCancelWindowId;
+ u8 playerNameAndIdWindowId;
u8 listTaskId;
- u8 field_F;
+ u8 leaderId;
u8 field_10;
- u8 field_11;
- u8 field_12;
+ u8 listenTaskId;
+ u8 isWonderNews;
u8 field_13;
- u8 field_14;
- u8 field_15;
+ u8 refreshTimer;
+ u8 delayBeforePrint;
};
-struct UnkStruct_8019BA8
+struct UnionRoomObject
{
- u8 field_0;
- u8 field_1;
- s8 field_2;
- u8 field_3;
+ u8 state;
+ u8 gfxId;
+ s8 animState;
+ u8 schedAnim;
};
-struct UnkStruct_URoom
+struct WirelessLink_URoom
{
struct UnkStruct_Main0 *field_0;
struct UnkStruct_Main4 *field_4;
struct UnkStruct_Main0 *field_8;
struct UnkStruct_Main4 *field_C;
- u16 field_10;
+ u16 unknown; // Never read
u16 field_12;
u8 state;
u8 stateAfterPrint;
u8 textState;
- u8 field_17;
- u8 field_18;
- u8 field_19;
- u8 field_1A;
- u8 field_1B;
- u8 field_1C;
- u8 field_1D;
- u8 field_1E;
- u8 field_1F;
- u8 field_20;
+ u8 filler[4];
+ u8 topListMenuWindowId;
+ u8 topListMenuId;
+ u8 tradeBoardSelectWindowId;
+ u8 tradeBoardDetailsWindowId;
+ u8 unused1;
+ u8 searchTaskId;
u8 spriteIds[40];
- u8 field_49;
- u8 field_4A;
- u16 field_4C[6];
- u8 field_58[0x98 - 0x58];
- u16 field_98;
- u16 field_9A[3];
- struct UnkStruct_8019BA8 field_A0[8];
- u8 field_C0[12][15];
- u8 field_174[48];
- u8 field_1A4[200];
+ u8 unused2;
+ u8 tradeBoardListMenuId;
+ u16 playerSendBuffer[6];
+ u8 activityRequestStrbufs[4][16];
+ u16 partnerYesNoResponse;
+ u16 recvActivityRequest[3];
+ struct UnionRoomObject objects[MAX_UNION_ROOM_PLAYERS];
+ u8 trainerCardStrBuffer[12][15];
+ u8 trainerCardColorStrBuffer[48];
+ u8 trainerCardMsgStrBuffer[200];
};
-union UnkUnion_Main
+union WirelessLink_Main
{
- struct UnkStruct_Leader *leader;
- struct UnkStruct_Group *group;
- struct UnkStruct_URoom *uRoom;
+ struct WirelessLink_Leader *leader;
+ struct WirelessLink_Group *group;
+ struct WirelessLink_URoom *uRoom;
};
struct UnionRoomTrade
{
- u16 field_0;
+ u16 state;
u16 type;
u32 playerPersonality;
- u8 field_8;
- u8 field_9;
+ u8 offerPlayerId;
+ u8 filler1;
u16 playerSpecies;
u16 playerLevel;
u16 species;
u16 level;
- u16 field_12;
+ u16 filler2;
u32 personality;
};
// Exported RAM declarations
-extern u8 gUnknown_02022C2C;
-extern union UnkUnion_Main gUnknown_02022C30;
-extern struct GFtgtGnameSub gUnknown_02022C38;
+extern u8 gPlayerCurrActivity;
+extern union WirelessLink_Main gUnknown_02022C30;
+extern struct GFtgtGnameSub gPartnerTgtGnameSub;
extern u16 gUnionRoomOfferedSpecies;
extern u8 gUnionRoomRequestedMonType;
// Exported ROM declarations
-u8 sub_8013F78(void);
-void nullsub_89(u8 taskId);
-void var_800D_set_xB(void);
+u8 CreateTask_CreateTradeMenu(void);
+void SetUsingUnionRoomStartMenu(void);
void MEvent_CreateTask_CardOrNewsWithFriend(u32 arg0);
void MEvent_CreateTask_CardOrNewsOverWireless(u32 arg0);
void MEvent_CreateTask_Leader(u32 arg0);
+u8 CreateTask_ListenToWireless(void);
+void StartUnionRoomBattle(u16 battleFlags);
#endif //GUARD_UNION_ROOM_H
diff --git a/include/union_room_battle.h b/include/union_room_battle.h
index 2f5086008..ffccf197f 100644
--- a/include/union_room_battle.h
+++ b/include/union_room_battle.h
@@ -1,7 +1,6 @@
#ifndef GUARD_UNION_ROOM_BATTLE_H
#define GUARD_UNION_ROOM_BATTLE_H
-u8 sub_8013C40(void);
-void sub_8014210(u16 battleFlags);
+void CB2_UnionRoomBattle(void);
#endif //GUARD_UNION_ROOM_BATTLE_H
diff --git a/include/union_room_chat.h b/include/union_room_chat.h
index e7ca9d46e..dbd45c543 100755
--- a/include/union_room_chat.h
+++ b/include/union_room_chat.h
@@ -1,18 +1,7 @@
#ifndef GUARD_UNION_ROOM_CHAT_H
#define GUARD_UNION_ROOM_CHAT_H
-enum
-{
- UNION_ROOM_KB_PAGE_UPPER,
- UNION_ROOM_KB_PAGE_LOWER,
- UNION_ROOM_KB_PAGE_EMOJI,
- UNION_ROOM_KB_PAGE_COUNT
-};
-
-#define UNION_ROOM_KB_ROW_COUNT 10
-
-
-void sub_801DD98(void);
-void copy_strings_to_sav1(void);
+void EnterUnionRoomChat(void);
+void InitUnionRoomChatRegisteredTexts(void);
#endif // GUARD_UNION_ROOM_CHAT_H
diff --git a/include/union_room_player_avatar.h b/include/union_room_player_avatar.h
index 9870d0981..c7add758a 100644
--- a/include/union_room_player_avatar.h
+++ b/include/union_room_player_avatar.h
@@ -1,14 +1,14 @@
#ifndef GUARD_UNION_ROOM_PLAYER_AVATAR_H
#define GUARD_UNION_ROOM_PLAYER_AVATAR_H
-u8 sub_8019BA8(struct UnkStruct_8019BA8 * ptr);
-void sub_8019E3C(void);
-void sub_8019E70(u8 *arg0, s32 arg1);
-void sub_8019F04(u8 *spriteIds);
-void sub_8019F2C(void);
-void sub_801A274(struct UnkStruct_URoom *arg0);
-void sub_801A284(struct UnkStruct_URoom *arg0);
-bool32 sub_801A2A8(struct UnkStruct_Main0 *arg0, s16 *arg1, s16 *arg2, u8 *arg3);
-void sub_801A3D0(u32 arg0, u32 arg1, struct UnkStruct_Main0 *arg2);
+u8 InitUnionRoomPlayerObjects(struct UnionRoomObject *players);
+void DestroyUnionRoomPlayerObjects(void);
+void CreateGroupMemberSpritesInvisible(u8 *spriteIds, s32 playerIdx);
+void DestroyGroupMemberSprites(u8 *spriteIds);
+void SetTilesAroundUnionRoomPlayersPassable(void);
+void ScheduleUnionRoomPlayerRefresh(struct WirelessLink_URoom *uroom);
+void HandleUnionRoomPlayerRefresh(struct WirelessLink_URoom *uroom);
+bool32 TryInteractWithUnionRoomMember(struct UnkStruct_Main0 *main0, s16 *directionPtr, s16 *playerIdxPtr, u8 *spriteIds);
+void UpdateUnionRoomMemberFacing(u32 currDirection, u32 playerIdx, struct UnkStruct_Main0 *main0);
#endif //GUARD_UNION_ROOM_PLAYER_AVATAR_H
diff --git a/ld_script.txt b/ld_script.txt
index 158140993..9b0a82d9c 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -65,6 +65,7 @@ SECTIONS {
src/union_room.o(.text);
src/mystery_gift.o(.text);
src/union_room_player_avatar.o(.text);
+ src/wireless_communication_status_screen.o(.text);
src/union_room_battle.o(.text);
src/mevent2.o(.text);
src/mevent_801BAAC.o(.text);
@@ -168,7 +169,7 @@ SECTIONS {
src/record_mixing.o(.text);
src/secret_base.o(.text);
src/tv.o(.text);
- src/contest_link_80F57C4.o(.text);
+ src/contest_util.o(.text);
src/script_pokemon_util_80F87D8.o(.text);
src/field_poison.o(.text);
src/pokemon_size_record.o(.text);
@@ -176,7 +177,7 @@ SECTIONS {
src/field_special_scene.o(.text);
src/rotating_gate.o(.text);
src/safari_zone.o(.text);
- src/contest_link_80FC4F4.o(.text);
+ src/contest_link.o(.text);
src/item_use.o(.text);
src/battle_anim_effects_1.o(.text);
src/battle_anim_effects_2.o(.text);
@@ -237,7 +238,7 @@ SECTIONS {
src/cable_car.o(.text);
src/math_util.o(.text);
src/roulette_util.o(.text);
- src/rom_81520A8.o(.text);
+ src/confetti_util.o(.text);
src/save.o(.text);
src/mystery_event_script.o(.text);
src/field_effect_helpers.o(.text);
@@ -328,7 +329,7 @@ SECTIONS {
src/trainer_hill.o(.text);
src/rayquaza_scene.o(.text);
src/walda_phrase.o(.text);
- src/contest_link_81D9DE4.o(.text);
+ src/contest_link_util.o(.text);
src/gym_leader_rematch.o(.text);
src/battle_transition_frontier.o(.text);
src/international_string_util.o(.text);
@@ -450,6 +451,7 @@ SECTIONS {
src/union_room.o(.rodata);
src/mystery_gift.o(.rodata);
src/union_room_player_avatar.o(.rodata);
+ src/wireless_communication_status_screen.o(.rodata);
src/union_room_battle.o(.rodata);
src/mevent2.o(.rodata);
src/mevent_801BAAC.o(.rodata);
@@ -542,13 +544,13 @@ SECTIONS {
src/record_mixing.o(.rodata);
src/secret_base.o(.rodata);
src/tv.o(.rodata);
- src/contest_link_80F57C4.o(.rodata);
+ src/contest_util.o(.rodata);
src/script_pokemon_util_80F87D8.o(.rodata);
src/pokemon_size_record.o(.rodata)
src/fldeff_misc.o(.rodata);
src/field_special_scene.o(.rodata);
src/rotating_gate.o(.rodata);
- src/contest_link_80FC4F4.o(.rodata);
+ src/contest_link.o(.rodata);
src/item_use.o(.rodata);
src/battle_anim_effects_1.o(.rodata);
src/battle_anim_effects_2.o(.rodata);
diff --git a/libagbsyscall/libagbsyscall.s b/libagbsyscall/libagbsyscall.s
index 893235e32..00c40d08e 100644
--- a/libagbsyscall/libagbsyscall.s
+++ b/libagbsyscall/libagbsyscall.s
@@ -55,8 +55,8 @@
.ifdef L_IntrWait
thumb_func_start IntrWait
IntrWait:
- mov r2, #0
- swi 4
+ movs r2, #0
+ svc #4
bx lr
thumb_func_end IntrWait
.endif
@@ -64,7 +64,7 @@ IntrWait:
.ifdef L_RegisterRamReset
thumb_func_start RegisterRamReset
RegisterRamReset:
- swi 1
+ svc #1
bx lr
thumb_func_end RegisterRamReset
.endif
@@ -72,7 +72,7 @@ RegisterRamReset:
.ifdef L_Sqrt
thumb_func_start Sqrt
Sqrt:
- swi 8
+ svc #8
bx lr
thumb_func_end Sqrt
.endif
@@ -80,7 +80,7 @@ Sqrt:
.ifdef L_MusicPlayerOpen
thumb_func_start MusicPlayerOpen
MusicPlayerOpen:
- swi 32
+ svc #32
bx lr
thumb_func_end MusicPlayerOpen
.endif
@@ -88,8 +88,8 @@ MusicPlayerOpen:
.ifdef L_SoundBiasReset
thumb_func_start SoundBiasReset
SoundBiasReset:
- mov r0, #0
- swi 25
+ movs r0, #0
+ svc #25
bx lr
thumb_func_end SoundBiasReset
.endif
@@ -97,7 +97,7 @@ SoundBiasReset:
.ifdef L_SoundDriverVSyncOn
thumb_func_start SoundDriverVSyncOn
SoundDriverVSyncOn:
- swi 41
+ svc #41
bx lr
thumb_func_end SoundDriverVSyncOn
.endif
@@ -105,7 +105,7 @@ SoundDriverVSyncOn:
.ifdef L_Mod
thumb_func_start Mod
Mod:
- swi 6
+ svc #6
mov r0, r1
bx lr
thumb_func_end Mod
@@ -114,8 +114,8 @@ Mod:
.ifdef L_VBlankIntrWait
thumb_func_start VBlankIntrWait
VBlankIntrWait:
- mov r2, #0
- swi 5
+ movs r2, #0
+ svc #5
bx lr
thumb_func_end VBlankIntrWait
.endif
@@ -123,7 +123,7 @@ VBlankIntrWait:
.ifdef L_MusicPlayerStart
thumb_func_start MusicPlayerStart
MusicPlayerStart:
- swi 33
+ svc #33
bx lr
thumb_func_end MusicPlayerStart
.endif
@@ -131,7 +131,7 @@ MusicPlayerStart:
.ifdef L_SoundDriverVSyncOff
thumb_func_start SoundDriverVSyncOff
SoundDriverVSyncOff:
- swi 40
+ svc #40
bx lr
thumb_func_end SoundDriverVSyncOff
.endif
@@ -139,34 +139,34 @@ SoundDriverVSyncOff:
.ifdef L_HuffUnComp
thumb_func_start HuffUnComp
HuffUnComp:
- swi 19
+ svc #19
bx lr
thumb_func_end HuffUnComp
.endif
.ifdef L_SoftResetExram
- thumb_func_start SoftResetExram
+ arm_func_start SoftResetExram
SoftResetExram:
ldr r3, =REG_IME
- mov r2, #0
+ movs r2, #0
strb r2, [r3, #0]
ldr r3, =SOFT_RESET_DIRECT_BUF
- mov r2, #1
+ movs r2, #1
strb r2, [r3, #0]
- sub r3, #SOFT_RESET_DIRECT_BUF - 0x3007f00
+ subs r3, #SOFT_RESET_DIRECT_BUF - 0x3007f00
mov sp, r3
- mov r2, #RESET_EX_WRAM_FLAG
- bic r0, r2
- swi 1
- swi 0
+ movs r2, #RESET_EX_WRAM_FLAG
+ bics r0, r2
+ svc #1
+ svc #0
.pool
- thumb_func_end SoftResetExram
+ arm_func_end SoftResetExram
.endif
.ifdef L_MusicPlayerFadeOut
thumb_func_start MusicPlayerFadeOut
MusicPlayerFadeOut:
- swi 36
+ svc #36
bx lr
thumb_func_end MusicPlayerFadeOut
.endif
@@ -174,7 +174,7 @@ MusicPlayerFadeOut:
.ifdef L_LZ77UnCompWram
thumb_func_start LZ77UnCompWram
LZ77UnCompWram:
- swi 17
+ svc #17
bx lr
thumb_func_end LZ77UnCompWram
.endif
@@ -182,7 +182,7 @@ LZ77UnCompWram:
.ifdef L_SoundDriverMain
thumb_func_start SoundDriverMain
SoundDriverMain:
- swi 28
+ svc #28
bx lr
thumb_func_end SoundDriverMain
.endif
@@ -190,7 +190,7 @@ SoundDriverMain:
.ifdef L_SoundBiasChange
thumb_func_start SoundBiasChange
SoundBiasChange:
- swi 25
+ svc #25
bx lr
thumb_func_end SoundBiasChange
.endif
@@ -198,7 +198,7 @@ SoundBiasChange:
.ifdef L_LZ77UnCompVram
thumb_func_start LZ77UnCompVram
LZ77UnCompVram:
- swi 18
+ svc #18
bx lr
thumb_func_end LZ77UnCompVram
.endif
@@ -206,7 +206,7 @@ LZ77UnCompVram:
.ifdef L_ArcTan2
thumb_func_start ArcTan2
ArcTan2:
- swi 10
+ svc #10
bx lr
thumb_func_end ArcTan2
.endif
@@ -214,7 +214,7 @@ ArcTan2:
.ifdef L_MusicPlayerStop
thumb_func_start MusicPlayerStop
MusicPlayerStop:
- swi 34
+ svc #34
bx lr
thumb_func_end MusicPlayerStop
.endif
@@ -222,7 +222,7 @@ MusicPlayerStop:
.ifdef L_DivArm
thumb_func_start DivArm
DivArm:
- swi 7
+ svc #7
bx lr
thumb_func_end DivArm
.endif
@@ -230,7 +230,7 @@ DivArm:
.ifdef L_ModArm
thumb_func_start ModArm
ModArm:
- swi 7
+ svc #7
mov r0, r1
bx lr
thumb_func_end ModArm
@@ -239,7 +239,7 @@ ModArm:
.ifdef L_SoundDriverVSync
thumb_func_start SoundDriverVSync
SoundDriverVSync:
- swi 29
+ svc #29
bx lr
thumb_func_end SoundDriverVSync
.endif
@@ -247,7 +247,7 @@ SoundDriverVSync:
.ifdef L_SoundDriverInit
thumb_func_start SoundDriverInit
SoundDriverInit:
- swi 26
+ svc #26
bx lr
thumb_func_end SoundDriverInit
.endif
@@ -255,7 +255,7 @@ SoundDriverInit:
.ifdef L_BgAffineSet
thumb_func_start BgAffineSet
BgAffineSet:
- swi 14
+ svc #14
bx lr
thumb_func_end BgAffineSet
.endif
@@ -263,7 +263,7 @@ BgAffineSet:
.ifdef L_Diff8bitUnFilterWram
thumb_func_start Diff8bitUnFilterWram
Diff8bitUnFilterWram:
- swi 22
+ svc #22
bx lr
thumb_func_end Diff8bitUnFilterWram
.endif
@@ -272,7 +272,7 @@ Diff8bitUnFilterWram:
thumb_func_start MultiBoot
MultiBoot:
mov r1, #1
- swi 37
+ svc #37
bx lr
thumb_func_end MultiBoot
.endif
@@ -280,7 +280,7 @@ MultiBoot:
.ifdef L_MidiKey2Freq
thumb_func_start MidiKey2Freq
MidiKey2Freq:
- swi 31
+ svc #31
bx lr
thumb_func_end MidiKey2Freq
.endif
@@ -288,7 +288,7 @@ MidiKey2Freq:
.ifdef L_Div
thumb_func_start Div
Div:
- swi 6
+ svc #6
bx lr
thumb_func_end Div
.endif
@@ -296,7 +296,7 @@ Div:
.ifdef L_Diff8bitUnFilterVram
thumb_func_start Diff8bitUnFilterVram
Diff8bitUnFilterVram:
- swi 23
+ svc #23
bx lr
thumb_func_end Diff8bitUnFilterVram
.endif
@@ -304,7 +304,7 @@ Diff8bitUnFilterVram:
.ifdef L_ArcTan
thumb_func_start ArcTan
ArcTan:
- swi 9
+ svc #9
bx lr
thumb_func_end ArcTan
.endif
@@ -312,7 +312,7 @@ ArcTan:
.ifdef L_ObjAffineSet
thumb_func_start ObjAffineSet
ObjAffineSet:
- swi 15
+ svc #15
bx lr
thumb_func_end ObjAffineSet
.endif
@@ -321,15 +321,15 @@ ObjAffineSet:
thumb_func_start SoftResetRom
SoftResetRom:
ldr r3, =REG_IME
- mov r2, #0
+ movs r2, #0
strb r2, [r3, #0]
ldr r3, =SOFT_RESET_DIRECT_BUF
- mov r2, #0
+ movs r2, #0
strb r2, [r3, #0]
sub r3, #SOFT_RESET_DIRECT_BUF - 0x3007f00
mov sp, r3
- swi 1
- swi 0
+ svc #1
+ svc #0
.pool
thumb_func_end SoftResetRom
.endif
@@ -337,7 +337,7 @@ SoftResetRom:
.ifdef L_SoundDriverMode
thumb_func_start SoundDriverMode
SoundDriverMode:
- swi 27
+ svc #27
bx lr
thumb_func_end SoundDriverMode
.endif
@@ -345,7 +345,7 @@ SoundDriverMode:
.ifdef L_RLUnCompWram
thumb_func_start RLUnCompWram
RLUnCompWram:
- swi 20
+ svc #20
bx lr
thumb_func_end RLUnCompWram
.endif
@@ -353,7 +353,7 @@ RLUnCompWram:
.ifdef L_BitUnPack
thumb_func_start BitUnPack
BitUnPack:
- swi 16
+ svc #16
bx lr
thumb_func_end BitUnPack
.endif
@@ -361,7 +361,7 @@ BitUnPack:
.ifdef L_SoundChannelClear
thumb_func_start SoundChannelClear
SoundChannelClear:
- swi 30
+ svc #30
bx lr
thumb_func_end SoundChannelClear
.endif
@@ -369,7 +369,7 @@ SoundChannelClear:
.ifdef L_CpuFastSet
thumb_func_start CpuFastSet
CpuFastSet:
- swi 12
+ svc #12
bx lr
thumb_func_end CpuFastSet
.endif
@@ -377,7 +377,7 @@ CpuFastSet:
.ifdef L_CpuSet
thumb_func_start CpuSet
CpuSet:
- swi 11
+ svc #11
bx lr
thumb_func_end CpuSet
.endif
@@ -385,7 +385,7 @@ CpuSet:
.ifdef L_Diff16bitUnFilter
thumb_func_start Diff16bitUnFilter
Diff16bitUnFilter:
- swi 24
+ svc #24
bx lr
thumb_func_end Diff16bitUnFilter
.endif
@@ -393,8 +393,8 @@ Diff16bitUnFilter:
.ifdef L_SoundBiasSet
thumb_func_start SoundBiasSet
SoundBiasSet:
- mov r0, #1
- swi 25
+ movs r0, #1
+ svc #25
bx lr
thumb_func_end SoundBiasSet
.endif
@@ -402,7 +402,7 @@ SoundBiasSet:
.ifdef L_MusicPlayerContinue
thumb_func_start MusicPlayerContinue
MusicPlayerContinue:
- swi 35
+ svc #35
bx lr
thumb_func_end MusicPlayerContinue
.endif
@@ -411,12 +411,12 @@ MusicPlayerContinue:
thumb_func_start SoftReset
SoftReset:
ldr r3, =REG_IME
- mov r2, #0
+ movs r2, #0
strb r2, [r3, #0]
ldr r1, =0x3007f00
mov sp, r1
- swi 1
- swi 0
+ svc #1
+ svc #0
.pool
thumb_func_end SoftReset
.endif
@@ -424,7 +424,7 @@ SoftReset:
.ifdef L_RLUnCompVram
thumb_func_start RLUnCompVram
RLUnCompVram:
- swi 21
+ svc #21
bx lr
thumb_func_end RLUnCompVram
.endif
diff --git a/sound/direct_sound_data.inc b/sound/direct_sound_data.inc
index 80f91a01d..4a3a3b6d3 100644
--- a/sound/direct_sound_data.inc
+++ b/sound/direct_sound_data.inc
@@ -388,1555 +388,1555 @@ DirectSoundWaveData_8745A7C::
.align 2
Cry_Bulbasaur::
- .incbin "sound/direct_sound_samples/cry_bulbasaur.bin"
+ .incbin "sound/direct_sound_samples/cries/bulbasaur.bin"
.align 2
Cry_Ivysaur::
- .incbin "sound/direct_sound_samples/cry_ivysaur.bin"
+ .incbin "sound/direct_sound_samples/cries/ivysaur.bin"
.align 2
Cry_Venusaur::
- .incbin "sound/direct_sound_samples/cry_venusaur.bin"
+ .incbin "sound/direct_sound_samples/cries/venusaur.bin"
.align 2
Cry_Charmander::
- .incbin "sound/direct_sound_samples/cry_charmander.bin"
+ .incbin "sound/direct_sound_samples/cries/charmander.bin"
.align 2
Cry_Charmeleon::
- .incbin "sound/direct_sound_samples/cry_charmeleon.bin"
+ .incbin "sound/direct_sound_samples/cries/charmeleon.bin"
.align 2
Cry_Charizard::
- .incbin "sound/direct_sound_samples/cry_charizard.bin"
+ .incbin "sound/direct_sound_samples/cries/charizard.bin"
.align 2
Cry_Squirtle::
- .incbin "sound/direct_sound_samples/cry_squirtle.bin"
+ .incbin "sound/direct_sound_samples/cries/squirtle.bin"
.align 2
Cry_Wartortle::
- .incbin "sound/direct_sound_samples/cry_wartortle.bin"
+ .incbin "sound/direct_sound_samples/cries/wartortle.bin"
.align 2
Cry_Blastoise::
- .incbin "sound/direct_sound_samples/cry_blastoise.bin"
+ .incbin "sound/direct_sound_samples/cries/blastoise.bin"
.align 2
Cry_Caterpie::
- .incbin "sound/direct_sound_samples/cry_caterpie.bin"
+ .incbin "sound/direct_sound_samples/cries/caterpie.bin"
.align 2
Cry_Metapod::
- .incbin "sound/direct_sound_samples/cry_metapod.bin"
+ .incbin "sound/direct_sound_samples/cries/metapod.bin"
.align 2
Cry_Butterfree::
- .incbin "sound/direct_sound_samples/cry_butterfree.bin"
+ .incbin "sound/direct_sound_samples/cries/butterfree.bin"
.align 2
Cry_Weedle::
- .incbin "sound/direct_sound_samples/cry_weedle.bin"
+ .incbin "sound/direct_sound_samples/cries/weedle.bin"
.align 2
Cry_Kakuna::
- .incbin "sound/direct_sound_samples/cry_kakuna.bin"
+ .incbin "sound/direct_sound_samples/cries/kakuna.bin"
.align 2
Cry_Beedrill::
- .incbin "sound/direct_sound_samples/cry_beedrill.bin"
+ .incbin "sound/direct_sound_samples/cries/beedrill.bin"
.align 2
Cry_Pidgey::
- .incbin "sound/direct_sound_samples/cry_pidgey.bin"
+ .incbin "sound/direct_sound_samples/cries/pidgey.bin"
.align 2
Cry_Pidgeotto::
- .incbin "sound/direct_sound_samples/cry_pidgeotto.bin"
+ .incbin "sound/direct_sound_samples/cries/pidgeotto.bin"
.align 2
Cry_Pidgeot::
- .incbin "sound/direct_sound_samples/cry_pidgeot.bin"
+ .incbin "sound/direct_sound_samples/cries/pidgeot.bin"
.align 2
Cry_Rattata::
- .incbin "sound/direct_sound_samples/cry_rattata.bin"
+ .incbin "sound/direct_sound_samples/cries/rattata.bin"
.align 2
Cry_Raticate::
- .incbin "sound/direct_sound_samples/cry_raticate.bin"
+ .incbin "sound/direct_sound_samples/cries/raticate.bin"
.align 2
Cry_Spearow::
- .incbin "sound/direct_sound_samples/cry_spearow.bin"
+ .incbin "sound/direct_sound_samples/cries/spearow.bin"
.align 2
Cry_Fearow::
- .incbin "sound/direct_sound_samples/cry_fearow.bin"
+ .incbin "sound/direct_sound_samples/cries/fearow.bin"
.align 2
Cry_Ekans::
- .incbin "sound/direct_sound_samples/cry_ekans.bin"
+ .incbin "sound/direct_sound_samples/cries/ekans.bin"
.align 2
Cry_Arbok::
- .incbin "sound/direct_sound_samples/cry_arbok.bin"
+ .incbin "sound/direct_sound_samples/cries/arbok.bin"
.align 2
Cry_Pikachu::
- .incbin "sound/direct_sound_samples/cry_pikachu.bin"
+ .incbin "sound/direct_sound_samples/cries/pikachu.bin"
.align 2
Cry_Raichu::
- .incbin "sound/direct_sound_samples/cry_raichu.bin"
+ .incbin "sound/direct_sound_samples/cries/raichu.bin"
.align 2
Cry_Sandshrew::
- .incbin "sound/direct_sound_samples/cry_sandshrew.bin"
+ .incbin "sound/direct_sound_samples/cries/sandshrew.bin"
.align 2
Cry_Sandslash::
- .incbin "sound/direct_sound_samples/cry_sandslash.bin"
+ .incbin "sound/direct_sound_samples/cries/sandslash.bin"
.align 2
Cry_NidoranF::
- .incbin "sound/direct_sound_samples/cry_nidoran_f.bin"
+ .incbin "sound/direct_sound_samples/cries/nidoran_f.bin"
.align 2
Cry_Nidorina::
- .incbin "sound/direct_sound_samples/cry_nidorina.bin"
+ .incbin "sound/direct_sound_samples/cries/nidorina.bin"
.align 2
Cry_Nidoqueen::
- .incbin "sound/direct_sound_samples/cry_nidoqueen.bin"
+ .incbin "sound/direct_sound_samples/cries/nidoqueen.bin"
.align 2
Cry_NidoranM::
- .incbin "sound/direct_sound_samples/cry_nidoran_m.bin"
+ .incbin "sound/direct_sound_samples/cries/nidoran_m.bin"
.align 2
Cry_Nidorino::
- .incbin "sound/direct_sound_samples/cry_nidorino.bin"
+ .incbin "sound/direct_sound_samples/cries/nidorino.bin"
.align 2
Cry_Nidoking::
- .incbin "sound/direct_sound_samples/cry_nidoking.bin"
+ .incbin "sound/direct_sound_samples/cries/nidoking.bin"
.align 2
Cry_Clefairy::
- .incbin "sound/direct_sound_samples/cry_clefairy.bin"
+ .incbin "sound/direct_sound_samples/cries/clefairy.bin"
.align 2
Cry_Clefable::
- .incbin "sound/direct_sound_samples/cry_clefable.bin"
+ .incbin "sound/direct_sound_samples/cries/clefable.bin"
.align 2
Cry_Vulpix::
- .incbin "sound/direct_sound_samples/cry_vulpix.bin"
+ .incbin "sound/direct_sound_samples/cries/vulpix.bin"
.align 2
Cry_Ninetales::
- .incbin "sound/direct_sound_samples/cry_ninetales.bin"
+ .incbin "sound/direct_sound_samples/cries/ninetales.bin"
.align 2
Cry_Jigglypuff::
- .incbin "sound/direct_sound_samples/cry_jigglypuff.bin"
+ .incbin "sound/direct_sound_samples/cries/jigglypuff.bin"
.align 2
Cry_Wigglytuff::
- .incbin "sound/direct_sound_samples/cry_wigglytuff.bin"
+ .incbin "sound/direct_sound_samples/cries/wigglytuff.bin"
.align 2
Cry_Zubat::
- .incbin "sound/direct_sound_samples/cry_zubat.bin"
+ .incbin "sound/direct_sound_samples/cries/zubat.bin"
.align 2
Cry_Golbat::
- .incbin "sound/direct_sound_samples/cry_golbat.bin"
+ .incbin "sound/direct_sound_samples/cries/golbat.bin"
.align 2
Cry_Oddish::
- .incbin "sound/direct_sound_samples/cry_oddish.bin"
+ .incbin "sound/direct_sound_samples/cries/oddish.bin"
.align 2
Cry_Gloom::
- .incbin "sound/direct_sound_samples/cry_gloom.bin"
+ .incbin "sound/direct_sound_samples/cries/gloom.bin"
.align 2
Cry_Vileplume::
- .incbin "sound/direct_sound_samples/cry_vileplume.bin"
+ .incbin "sound/direct_sound_samples/cries/vileplume.bin"
.align 2
Cry_Paras::
- .incbin "sound/direct_sound_samples/cry_paras.bin"
+ .incbin "sound/direct_sound_samples/cries/paras.bin"
.align 2
Cry_Parasect::
- .incbin "sound/direct_sound_samples/cry_parasect.bin"
+ .incbin "sound/direct_sound_samples/cries/parasect.bin"
.align 2
Cry_Venonat::
- .incbin "sound/direct_sound_samples/cry_venonat.bin"
+ .incbin "sound/direct_sound_samples/cries/venonat.bin"
.align 2
Cry_Venomoth::
- .incbin "sound/direct_sound_samples/cry_venomoth.bin"
+ .incbin "sound/direct_sound_samples/cries/venomoth.bin"
.align 2
Cry_Diglett::
- .incbin "sound/direct_sound_samples/cry_diglett.bin"
+ .incbin "sound/direct_sound_samples/cries/diglett.bin"
.align 2
Cry_Dugtrio::
- .incbin "sound/direct_sound_samples/cry_dugtrio.bin"
+ .incbin "sound/direct_sound_samples/cries/dugtrio.bin"
.align 2
Cry_Meowth::
- .incbin "sound/direct_sound_samples/cry_meowth.bin"
+ .incbin "sound/direct_sound_samples/cries/meowth.bin"
.align 2
Cry_Persian::
- .incbin "sound/direct_sound_samples/cry_persian.bin"
+ .incbin "sound/direct_sound_samples/cries/persian.bin"
.align 2
Cry_Psyduck::
- .incbin "sound/direct_sound_samples/cry_psyduck.bin"
+ .incbin "sound/direct_sound_samples/cries/psyduck.bin"
.align 2
Cry_Golduck::
- .incbin "sound/direct_sound_samples/cry_golduck.bin"
+ .incbin "sound/direct_sound_samples/cries/golduck.bin"
.align 2
Cry_Mankey::
- .incbin "sound/direct_sound_samples/cry_mankey.bin"
+ .incbin "sound/direct_sound_samples/cries/mankey.bin"
.align 2
Cry_Primeape::
- .incbin "sound/direct_sound_samples/cry_primeape.bin"
+ .incbin "sound/direct_sound_samples/cries/primeape.bin"
.align 2
Cry_Growlithe::
- .incbin "sound/direct_sound_samples/cry_growlithe.bin"
+ .incbin "sound/direct_sound_samples/cries/growlithe.bin"
.align 2
Cry_Arcanine::
- .incbin "sound/direct_sound_samples/cry_arcanine.bin"
+ .incbin "sound/direct_sound_samples/cries/arcanine.bin"
.align 2
Cry_Poliwag::
- .incbin "sound/direct_sound_samples/cry_poliwag.bin"
+ .incbin "sound/direct_sound_samples/cries/poliwag.bin"
.align 2
Cry_Poliwhirl::
- .incbin "sound/direct_sound_samples/cry_poliwhirl.bin"
+ .incbin "sound/direct_sound_samples/cries/poliwhirl.bin"
.align 2
Cry_Poliwrath::
- .incbin "sound/direct_sound_samples/cry_poliwrath.bin"
+ .incbin "sound/direct_sound_samples/cries/poliwrath.bin"
.align 2
Cry_Abra::
- .incbin "sound/direct_sound_samples/cry_abra.bin"
+ .incbin "sound/direct_sound_samples/cries/abra.bin"
.align 2
Cry_Kadabra::
- .incbin "sound/direct_sound_samples/cry_kadabra.bin"
+ .incbin "sound/direct_sound_samples/cries/kadabra.bin"
.align 2
Cry_Alakazam::
- .incbin "sound/direct_sound_samples/cry_alakazam.bin"
+ .incbin "sound/direct_sound_samples/cries/alakazam.bin"
.align 2
Cry_Machop::
- .incbin "sound/direct_sound_samples/cry_machop.bin"
+ .incbin "sound/direct_sound_samples/cries/machop.bin"
.align 2
Cry_Machoke::
- .incbin "sound/direct_sound_samples/cry_machoke.bin"
+ .incbin "sound/direct_sound_samples/cries/machoke.bin"
.align 2
Cry_Machamp::
- .incbin "sound/direct_sound_samples/cry_machamp.bin"
+ .incbin "sound/direct_sound_samples/cries/machamp.bin"
.align 2
Cry_Bellsprout::
- .incbin "sound/direct_sound_samples/cry_bellsprout.bin"
+ .incbin "sound/direct_sound_samples/cries/bellsprout.bin"
.align 2
Cry_Weepinbell::
- .incbin "sound/direct_sound_samples/cry_weepinbell.bin"
+ .incbin "sound/direct_sound_samples/cries/weepinbell.bin"
.align 2
Cry_Victreebel::
- .incbin "sound/direct_sound_samples/cry_victreebel.bin"
+ .incbin "sound/direct_sound_samples/cries/victreebel.bin"
.align 2
Cry_Tentacool::
- .incbin "sound/direct_sound_samples/cry_tentacool.bin"
+ .incbin "sound/direct_sound_samples/cries/tentacool.bin"
.align 2
Cry_Tentacruel::
- .incbin "sound/direct_sound_samples/cry_tentacruel.bin"
+ .incbin "sound/direct_sound_samples/cries/tentacruel.bin"
.align 2
Cry_Geodude::
- .incbin "sound/direct_sound_samples/cry_geodude.bin"
+ .incbin "sound/direct_sound_samples/cries/geodude.bin"
.align 2
Cry_Graveler::
- .incbin "sound/direct_sound_samples/cry_graveler.bin"
+ .incbin "sound/direct_sound_samples/cries/graveler.bin"
.align 2
Cry_Golem::
- .incbin "sound/direct_sound_samples/cry_golem.bin"
+ .incbin "sound/direct_sound_samples/cries/golem.bin"
.align 2
Cry_Ponyta::
- .incbin "sound/direct_sound_samples/cry_ponyta.bin"
+ .incbin "sound/direct_sound_samples/cries/ponyta.bin"
.align 2
Cry_Rapidash::
- .incbin "sound/direct_sound_samples/cry_rapidash.bin"
+ .incbin "sound/direct_sound_samples/cries/rapidash.bin"
.align 2
Cry_Slowpoke::
- .incbin "sound/direct_sound_samples/cry_slowpoke.bin"
+ .incbin "sound/direct_sound_samples/cries/slowpoke.bin"
.align 2
Cry_Slowbro::
- .incbin "sound/direct_sound_samples/cry_slowbro.bin"
+ .incbin "sound/direct_sound_samples/cries/slowbro.bin"
.align 2
Cry_Magnemite::
- .incbin "sound/direct_sound_samples/cry_magnemite.bin"
+ .incbin "sound/direct_sound_samples/cries/magnemite.bin"
.align 2
Cry_Magneton::
- .incbin "sound/direct_sound_samples/cry_magneton.bin"
+ .incbin "sound/direct_sound_samples/cries/magneton.bin"
.align 2
Cry_Farfetchd::
- .incbin "sound/direct_sound_samples/cry_farfetchd.bin"
+ .incbin "sound/direct_sound_samples/cries/farfetchd.bin"
.align 2
Cry_Doduo::
- .incbin "sound/direct_sound_samples/cry_doduo.bin"
+ .incbin "sound/direct_sound_samples/cries/doduo.bin"
.align 2
Cry_Dodrio::
- .incbin "sound/direct_sound_samples/cry_dodrio.bin"
+ .incbin "sound/direct_sound_samples/cries/dodrio.bin"
.align 2
Cry_Seel::
- .incbin "sound/direct_sound_samples/cry_seel.bin"
+ .incbin "sound/direct_sound_samples/cries/seel.bin"
.align 2
Cry_Dewgong::
- .incbin "sound/direct_sound_samples/cry_dewgong.bin"
+ .incbin "sound/direct_sound_samples/cries/dewgong.bin"
.align 2
Cry_Grimer::
- .incbin "sound/direct_sound_samples/cry_grimer.bin"
+ .incbin "sound/direct_sound_samples/cries/grimer.bin"
.align 2
Cry_Muk::
- .incbin "sound/direct_sound_samples/cry_muk.bin"
+ .incbin "sound/direct_sound_samples/cries/muk.bin"
.align 2
Cry_Shellder::
- .incbin "sound/direct_sound_samples/cry_shellder.bin"
+ .incbin "sound/direct_sound_samples/cries/shellder.bin"
.align 2
Cry_Cloyster::
- .incbin "sound/direct_sound_samples/cry_cloyster.bin"
+ .incbin "sound/direct_sound_samples/cries/cloyster.bin"
.align 2
Cry_Gastly::
- .incbin "sound/direct_sound_samples/cry_gastly.bin"
+ .incbin "sound/direct_sound_samples/cries/gastly.bin"
.align 2
Cry_Haunter::
- .incbin "sound/direct_sound_samples/cry_haunter.bin"
+ .incbin "sound/direct_sound_samples/cries/haunter.bin"
.align 2
Cry_Gengar::
- .incbin "sound/direct_sound_samples/cry_gengar.bin"
+ .incbin "sound/direct_sound_samples/cries/gengar.bin"
.align 2
Cry_Onix::
- .incbin "sound/direct_sound_samples/cry_onix.bin"
+ .incbin "sound/direct_sound_samples/cries/onix.bin"
.align 2
Cry_Drowzee::
- .incbin "sound/direct_sound_samples/cry_drowzee.bin"
+ .incbin "sound/direct_sound_samples/cries/drowzee.bin"
.align 2
Cry_Hypno::
- .incbin "sound/direct_sound_samples/cry_hypno.bin"
+ .incbin "sound/direct_sound_samples/cries/hypno.bin"
.align 2
Cry_Krabby::
- .incbin "sound/direct_sound_samples/cry_krabby.bin"
+ .incbin "sound/direct_sound_samples/cries/krabby.bin"
.align 2
Cry_Kingler::
- .incbin "sound/direct_sound_samples/cry_kingler.bin"
+ .incbin "sound/direct_sound_samples/cries/kingler.bin"
.align 2
Cry_Voltorb::
- .incbin "sound/direct_sound_samples/cry_voltorb.bin"
+ .incbin "sound/direct_sound_samples/cries/voltorb.bin"
.align 2
Cry_Electrode::
- .incbin "sound/direct_sound_samples/cry_electrode.bin"
+ .incbin "sound/direct_sound_samples/cries/electrode.bin"
.align 2
Cry_Exeggcute::
- .incbin "sound/direct_sound_samples/cry_exeggcute.bin"
+ .incbin "sound/direct_sound_samples/cries/exeggcute.bin"
.align 2
Cry_Exeggutor::
- .incbin "sound/direct_sound_samples/cry_exeggutor.bin"
+ .incbin "sound/direct_sound_samples/cries/exeggutor.bin"
.align 2
Cry_Cubone::
- .incbin "sound/direct_sound_samples/cry_cubone.bin"
+ .incbin "sound/direct_sound_samples/cries/cubone.bin"
.align 2
Cry_Marowak::
- .incbin "sound/direct_sound_samples/cry_marowak.bin"
+ .incbin "sound/direct_sound_samples/cries/marowak.bin"
.align 2
Cry_Hitmonlee::
- .incbin "sound/direct_sound_samples/cry_hitmonlee.bin"
+ .incbin "sound/direct_sound_samples/cries/hitmonlee.bin"
.align 2
Cry_Hitmonchan::
- .incbin "sound/direct_sound_samples/cry_hitmonchan.bin"
+ .incbin "sound/direct_sound_samples/cries/hitmonchan.bin"
.align 2
Cry_Lickitung::
- .incbin "sound/direct_sound_samples/cry_lickitung.bin"
+ .incbin "sound/direct_sound_samples/cries/lickitung.bin"
.align 2
Cry_Koffing::
- .incbin "sound/direct_sound_samples/cry_koffing.bin"
+ .incbin "sound/direct_sound_samples/cries/koffing.bin"
.align 2
Cry_Weezing::
- .incbin "sound/direct_sound_samples/cry_weezing.bin"
+ .incbin "sound/direct_sound_samples/cries/weezing.bin"
.align 2
Cry_Rhyhorn::
- .incbin "sound/direct_sound_samples/cry_rhyhorn.bin"
+ .incbin "sound/direct_sound_samples/cries/rhyhorn.bin"
.align 2
Cry_Rhydon::
- .incbin "sound/direct_sound_samples/cry_rhydon.bin"
+ .incbin "sound/direct_sound_samples/cries/rhydon.bin"
.align 2
Cry_Chansey::
- .incbin "sound/direct_sound_samples/cry_chansey.bin"
+ .incbin "sound/direct_sound_samples/cries/chansey.bin"
.align 2
Cry_Tangela::
- .incbin "sound/direct_sound_samples/cry_tangela.bin"
+ .incbin "sound/direct_sound_samples/cries/tangela.bin"
.align 2
Cry_Kangaskhan::
- .incbin "sound/direct_sound_samples/cry_kangaskhan.bin"
+ .incbin "sound/direct_sound_samples/cries/kangaskhan.bin"
.align 2
Cry_Horsea::
- .incbin "sound/direct_sound_samples/cry_horsea.bin"
+ .incbin "sound/direct_sound_samples/cries/horsea.bin"
.align 2
Cry_Seadra::
- .incbin "sound/direct_sound_samples/cry_seadra.bin"
+ .incbin "sound/direct_sound_samples/cries/seadra.bin"
.align 2
Cry_Goldeen::
- .incbin "sound/direct_sound_samples/cry_goldeen.bin"
+ .incbin "sound/direct_sound_samples/cries/goldeen.bin"
.align 2
Cry_Seaking::
- .incbin "sound/direct_sound_samples/cry_seaking.bin"
+ .incbin "sound/direct_sound_samples/cries/seaking.bin"
.align 2
Cry_Staryu::
- .incbin "sound/direct_sound_samples/cry_staryu.bin"
+ .incbin "sound/direct_sound_samples/cries/staryu.bin"
.align 2
Cry_Starmie::
- .incbin "sound/direct_sound_samples/cry_starmie.bin"
+ .incbin "sound/direct_sound_samples/cries/starmie.bin"
.align 2
Cry_MrMime::
- .incbin "sound/direct_sound_samples/cry_mr_mime.bin"
+ .incbin "sound/direct_sound_samples/cries/mr_mime.bin"
.align 2
Cry_Scyther::
- .incbin "sound/direct_sound_samples/cry_scyther.bin"
+ .incbin "sound/direct_sound_samples/cries/scyther.bin"
.align 2
Cry_Jynx::
- .incbin "sound/direct_sound_samples/cry_jynx.bin"
+ .incbin "sound/direct_sound_samples/cries/jynx.bin"
.align 2
Cry_Electabuzz::
- .incbin "sound/direct_sound_samples/cry_electabuzz.bin"
+ .incbin "sound/direct_sound_samples/cries/electabuzz.bin"
.align 2
Cry_Magmar::
- .incbin "sound/direct_sound_samples/cry_magmar.bin"
+ .incbin "sound/direct_sound_samples/cries/magmar.bin"
.align 2
Cry_Pinsir::
- .incbin "sound/direct_sound_samples/cry_pinsir.bin"
+ .incbin "sound/direct_sound_samples/cries/pinsir.bin"
.align 2
Cry_Tauros::
- .incbin "sound/direct_sound_samples/cry_tauros.bin"
+ .incbin "sound/direct_sound_samples/cries/tauros.bin"
.align 2
Cry_Magikarp::
- .incbin "sound/direct_sound_samples/cry_magikarp.bin"
+ .incbin "sound/direct_sound_samples/cries/magikarp.bin"
.align 2
Cry_Gyarados::
- .incbin "sound/direct_sound_samples/cry_gyarados.bin"
+ .incbin "sound/direct_sound_samples/cries/gyarados.bin"
.align 2
Cry_Lapras::
- .incbin "sound/direct_sound_samples/cry_lapras.bin"
+ .incbin "sound/direct_sound_samples/cries/lapras.bin"
.align 2
Cry_Ditto::
- .incbin "sound/direct_sound_samples/cry_ditto.bin"
+ .incbin "sound/direct_sound_samples/cries/ditto.bin"
.align 2
Cry_Eevee::
- .incbin "sound/direct_sound_samples/cry_eevee.bin"
+ .incbin "sound/direct_sound_samples/cries/eevee.bin"
.align 2
Cry_Vaporeon::
- .incbin "sound/direct_sound_samples/cry_vaporeon.bin"
+ .incbin "sound/direct_sound_samples/cries/vaporeon.bin"
.align 2
Cry_Jolteon::
- .incbin "sound/direct_sound_samples/cry_jolteon.bin"
+ .incbin "sound/direct_sound_samples/cries/jolteon.bin"
.align 2
Cry_Flareon::
- .incbin "sound/direct_sound_samples/cry_flareon.bin"
+ .incbin "sound/direct_sound_samples/cries/flareon.bin"
.align 2
Cry_Porygon::
- .incbin "sound/direct_sound_samples/cry_porygon.bin"
+ .incbin "sound/direct_sound_samples/cries/porygon.bin"
.align 2
Cry_Omanyte::
- .incbin "sound/direct_sound_samples/cry_omanyte.bin"
+ .incbin "sound/direct_sound_samples/cries/omanyte.bin"
.align 2
Cry_Omastar::
- .incbin "sound/direct_sound_samples/cry_omastar.bin"
+ .incbin "sound/direct_sound_samples/cries/omastar.bin"
.align 2
Cry_Kabuto::
- .incbin "sound/direct_sound_samples/cry_kabuto.bin"
+ .incbin "sound/direct_sound_samples/cries/kabuto.bin"
.align 2
Cry_Kabutops::
- .incbin "sound/direct_sound_samples/cry_kabutops.bin"
+ .incbin "sound/direct_sound_samples/cries/kabutops.bin"
.align 2
Cry_Aerodactyl::
- .incbin "sound/direct_sound_samples/cry_aerodactyl.bin"
+ .incbin "sound/direct_sound_samples/cries/aerodactyl.bin"
.align 2
Cry_Snorlax::
- .incbin "sound/direct_sound_samples/cry_snorlax.bin"
+ .incbin "sound/direct_sound_samples/cries/snorlax.bin"
.align 2
Cry_Articuno::
- .incbin "sound/direct_sound_samples/cry_articuno.bin"
+ .incbin "sound/direct_sound_samples/cries/articuno.bin"
.align 2
Cry_Zapdos::
- .incbin "sound/direct_sound_samples/cry_zapdos.bin"
+ .incbin "sound/direct_sound_samples/cries/zapdos.bin"
.align 2
Cry_Moltres::
- .incbin "sound/direct_sound_samples/cry_moltres.bin"
+ .incbin "sound/direct_sound_samples/cries/moltres.bin"
.align 2
Cry_Dratini::
- .incbin "sound/direct_sound_samples/cry_dratini.bin"
+ .incbin "sound/direct_sound_samples/cries/dratini.bin"
.align 2
Cry_Dragonair::
- .incbin "sound/direct_sound_samples/cry_dragonair.bin"
+ .incbin "sound/direct_sound_samples/cries/dragonair.bin"
.align 2
Cry_Dragonite::
- .incbin "sound/direct_sound_samples/cry_dragonite.bin"
+ .incbin "sound/direct_sound_samples/cries/dragonite.bin"
.align 2
Cry_Mewtwo::
- .incbin "sound/direct_sound_samples/cry_mewtwo.bin"
+ .incbin "sound/direct_sound_samples/cries/mewtwo.bin"
.align 2
Cry_Mew::
- .incbin "sound/direct_sound_samples/cry_mew.bin"
+ .incbin "sound/direct_sound_samples/cries/mew.bin"
.align 2
Cry_Chikorita::
- .incbin "sound/direct_sound_samples/cry_chikorita.bin"
+ .incbin "sound/direct_sound_samples/cries/chikorita.bin"
.align 2
Cry_Bayleef::
- .incbin "sound/direct_sound_samples/cry_bayleef.bin"
+ .incbin "sound/direct_sound_samples/cries/bayleef.bin"
.align 2
Cry_Meganium::
- .incbin "sound/direct_sound_samples/cry_meganium.bin"
+ .incbin "sound/direct_sound_samples/cries/meganium.bin"
.align 2
Cry_Cyndaquil::
- .incbin "sound/direct_sound_samples/cry_cyndaquil.bin"
+ .incbin "sound/direct_sound_samples/cries/cyndaquil.bin"
.align 2
Cry_Quilava::
- .incbin "sound/direct_sound_samples/cry_quilava.bin"
+ .incbin "sound/direct_sound_samples/cries/quilava.bin"
.align 2
Cry_Typhlosion::
- .incbin "sound/direct_sound_samples/cry_typhlosion.bin"
+ .incbin "sound/direct_sound_samples/cries/typhlosion.bin"
.align 2
Cry_Totodile::
- .incbin "sound/direct_sound_samples/cry_totodile.bin"
+ .incbin "sound/direct_sound_samples/cries/totodile.bin"
.align 2
Cry_Croconaw::
- .incbin "sound/direct_sound_samples/cry_croconaw.bin"
+ .incbin "sound/direct_sound_samples/cries/croconaw.bin"
.align 2
Cry_Feraligatr::
- .incbin "sound/direct_sound_samples/cry_feraligatr.bin"
+ .incbin "sound/direct_sound_samples/cries/feraligatr.bin"
.align 2
Cry_Sentret::
- .incbin "sound/direct_sound_samples/cry_sentret.bin"
+ .incbin "sound/direct_sound_samples/cries/sentret.bin"
.align 2
Cry_Furret::
- .incbin "sound/direct_sound_samples/cry_furret.bin"
+ .incbin "sound/direct_sound_samples/cries/furret.bin"
.align 2
Cry_Hoothoot::
- .incbin "sound/direct_sound_samples/cry_hoothoot.bin"
+ .incbin "sound/direct_sound_samples/cries/hoothoot.bin"
.align 2
Cry_Noctowl::
- .incbin "sound/direct_sound_samples/cry_noctowl.bin"
+ .incbin "sound/direct_sound_samples/cries/noctowl.bin"
.align 2
Cry_Ledyba::
- .incbin "sound/direct_sound_samples/cry_ledyba.bin"
+ .incbin "sound/direct_sound_samples/cries/ledyba.bin"
.align 2
Cry_Ledian::
- .incbin "sound/direct_sound_samples/cry_ledian.bin"
+ .incbin "sound/direct_sound_samples/cries/ledian.bin"
.align 2
Cry_Spinarak::
- .incbin "sound/direct_sound_samples/cry_spinarak.bin"
+ .incbin "sound/direct_sound_samples/cries/spinarak.bin"
.align 2
Cry_Ariados::
- .incbin "sound/direct_sound_samples/cry_ariados.bin"
+ .incbin "sound/direct_sound_samples/cries/ariados.bin"
.align 2
Cry_Crobat::
- .incbin "sound/direct_sound_samples/cry_crobat.bin"
+ .incbin "sound/direct_sound_samples/cries/crobat.bin"
.align 2
Cry_Chinchou::
- .incbin "sound/direct_sound_samples/cry_chinchou.bin"
+ .incbin "sound/direct_sound_samples/cries/chinchou.bin"
.align 2
Cry_Lanturn::
- .incbin "sound/direct_sound_samples/cry_lanturn.bin"
+ .incbin "sound/direct_sound_samples/cries/lanturn.bin"
.align 2
Cry_Pichu::
- .incbin "sound/direct_sound_samples/cry_pichu.bin"
+ .incbin "sound/direct_sound_samples/cries/pichu.bin"
.align 2
Cry_Cleffa::
- .incbin "sound/direct_sound_samples/cry_cleffa.bin"
+ .incbin "sound/direct_sound_samples/cries/cleffa.bin"
.align 2
Cry_Igglybuff::
- .incbin "sound/direct_sound_samples/cry_igglybuff.bin"
+ .incbin "sound/direct_sound_samples/cries/igglybuff.bin"
.align 2
Cry_Togepi::
- .incbin "sound/direct_sound_samples/cry_togepi.bin"
+ .incbin "sound/direct_sound_samples/cries/togepi.bin"
.align 2
Cry_Togetic::
- .incbin "sound/direct_sound_samples/cry_togetic.bin"
+ .incbin "sound/direct_sound_samples/cries/togetic.bin"
.align 2
Cry_Natu::
- .incbin "sound/direct_sound_samples/cry_natu.bin"
+ .incbin "sound/direct_sound_samples/cries/natu.bin"
.align 2
Cry_Xatu::
- .incbin "sound/direct_sound_samples/cry_xatu.bin"
+ .incbin "sound/direct_sound_samples/cries/xatu.bin"
.align 2
Cry_Mareep::
- .incbin "sound/direct_sound_samples/cry_mareep.bin"
+ .incbin "sound/direct_sound_samples/cries/mareep.bin"
.align 2
Cry_Flaaffy::
- .incbin "sound/direct_sound_samples/cry_flaaffy.bin"
+ .incbin "sound/direct_sound_samples/cries/flaaffy.bin"
.align 2
Cry_Ampharos::
- .incbin "sound/direct_sound_samples/cry_ampharos.bin"
+ .incbin "sound/direct_sound_samples/cries/ampharos.bin"
.align 2
Cry_Bellossom::
- .incbin "sound/direct_sound_samples/cry_bellossom.bin"
+ .incbin "sound/direct_sound_samples/cries/bellossom.bin"
.align 2
Cry_Marill::
- .incbin "sound/direct_sound_samples/cry_marill.bin"
+ .incbin "sound/direct_sound_samples/cries/marill.bin"
.align 2
Cry_Azumarill::
- .incbin "sound/direct_sound_samples/cry_azumarill.bin"
+ .incbin "sound/direct_sound_samples/cries/azumarill.bin"
.align 2
Cry_Sudowoodo::
- .incbin "sound/direct_sound_samples/cry_sudowoodo.bin"
+ .incbin "sound/direct_sound_samples/cries/sudowoodo.bin"
.align 2
Cry_Politoed::
- .incbin "sound/direct_sound_samples/cry_politoed.bin"
+ .incbin "sound/direct_sound_samples/cries/politoed.bin"
.align 2
Cry_Hoppip::
- .incbin "sound/direct_sound_samples/cry_hoppip.bin"
+ .incbin "sound/direct_sound_samples/cries/hoppip.bin"
.align 2
Cry_Skiploom::
- .incbin "sound/direct_sound_samples/cry_skiploom.bin"
+ .incbin "sound/direct_sound_samples/cries/skiploom.bin"
.align 2
Cry_Jumpluff::
- .incbin "sound/direct_sound_samples/cry_jumpluff.bin"
+ .incbin "sound/direct_sound_samples/cries/jumpluff.bin"
.align 2
Cry_Aipom::
- .incbin "sound/direct_sound_samples/cry_aipom.bin"
+ .incbin "sound/direct_sound_samples/cries/aipom.bin"
.align 2
Cry_Sunkern::
- .incbin "sound/direct_sound_samples/cry_sunkern.bin"
+ .incbin "sound/direct_sound_samples/cries/sunkern.bin"
.align 2
Cry_Sunflora::
- .incbin "sound/direct_sound_samples/cry_sunflora.bin"
+ .incbin "sound/direct_sound_samples/cries/sunflora.bin"
.align 2
Cry_Yanma::
- .incbin "sound/direct_sound_samples/cry_yanma.bin"
+ .incbin "sound/direct_sound_samples/cries/yanma.bin"
.align 2
Cry_Wooper::
- .incbin "sound/direct_sound_samples/cry_wooper.bin"
+ .incbin "sound/direct_sound_samples/cries/wooper.bin"
.align 2
Cry_Quagsire::
- .incbin "sound/direct_sound_samples/cry_quagsire.bin"
+ .incbin "sound/direct_sound_samples/cries/quagsire.bin"
.align 2
Cry_Espeon::
- .incbin "sound/direct_sound_samples/cry_espeon.bin"
+ .incbin "sound/direct_sound_samples/cries/espeon.bin"
.align 2
Cry_Umbreon::
- .incbin "sound/direct_sound_samples/cry_umbreon.bin"
+ .incbin "sound/direct_sound_samples/cries/umbreon.bin"
.align 2
Cry_Murkrow::
- .incbin "sound/direct_sound_samples/cry_murkrow.bin"
+ .incbin "sound/direct_sound_samples/cries/murkrow.bin"
.align 2
Cry_Slowking::
- .incbin "sound/direct_sound_samples/cry_slowking.bin"
+ .incbin "sound/direct_sound_samples/cries/slowking.bin"
.align 2
Cry_Misdreavus::
- .incbin "sound/direct_sound_samples/cry_misdreavus.bin"
+ .incbin "sound/direct_sound_samples/cries/misdreavus.bin"
.align 2
Cry_Unown::
- .incbin "sound/direct_sound_samples/cry_unown.bin"
+ .incbin "sound/direct_sound_samples/cries/unown.bin"
.align 2
Cry_Wobbuffet::
- .incbin "sound/direct_sound_samples/cry_wobbuffet.bin"
+ .incbin "sound/direct_sound_samples/cries/wobbuffet.bin"
.align 2
Cry_Girafarig::
- .incbin "sound/direct_sound_samples/cry_girafarig.bin"
+ .incbin "sound/direct_sound_samples/cries/girafarig.bin"
.align 2
Cry_Pineco::
- .incbin "sound/direct_sound_samples/cry_pineco.bin"
+ .incbin "sound/direct_sound_samples/cries/pineco.bin"
.align 2
Cry_Forretress::
- .incbin "sound/direct_sound_samples/cry_forretress.bin"
+ .incbin "sound/direct_sound_samples/cries/forretress.bin"
.align 2
Cry_Dunsparce::
- .incbin "sound/direct_sound_samples/cry_dunsparce.bin"
+ .incbin "sound/direct_sound_samples/cries/dunsparce.bin"
.align 2
Cry_Gligar::
- .incbin "sound/direct_sound_samples/cry_gligar.bin"
+ .incbin "sound/direct_sound_samples/cries/gligar.bin"
.align 2
Cry_Steelix::
- .incbin "sound/direct_sound_samples/cry_steelix.bin"
+ .incbin "sound/direct_sound_samples/cries/steelix.bin"
.align 2
Cry_Snubbull::
- .incbin "sound/direct_sound_samples/cry_snubbull.bin"
+ .incbin "sound/direct_sound_samples/cries/snubbull.bin"
.align 2
Cry_Granbull::
- .incbin "sound/direct_sound_samples/cry_granbull.bin"
+ .incbin "sound/direct_sound_samples/cries/granbull.bin"
.align 2
Cry_Qwilfish::
- .incbin "sound/direct_sound_samples/cry_qwilfish.bin"
+ .incbin "sound/direct_sound_samples/cries/qwilfish.bin"
.align 2
Cry_Scizor::
- .incbin "sound/direct_sound_samples/cry_scizor.bin"
+ .incbin "sound/direct_sound_samples/cries/scizor.bin"
.align 2
Cry_Shuckle::
- .incbin "sound/direct_sound_samples/cry_shuckle.bin"
+ .incbin "sound/direct_sound_samples/cries/shuckle.bin"
.align 2
Cry_Heracross::
- .incbin "sound/direct_sound_samples/cry_heracross.bin"
+ .incbin "sound/direct_sound_samples/cries/heracross.bin"
.align 2
Cry_Sneasel::
- .incbin "sound/direct_sound_samples/cry_sneasel.bin"
+ .incbin "sound/direct_sound_samples/cries/sneasel.bin"
.align 2
Cry_Teddiursa::
- .incbin "sound/direct_sound_samples/cry_teddiursa.bin"
+ .incbin "sound/direct_sound_samples/cries/teddiursa.bin"
.align 2
Cry_Ursaring::
- .incbin "sound/direct_sound_samples/cry_ursaring.bin"
+ .incbin "sound/direct_sound_samples/cries/ursaring.bin"
.align 2
Cry_Slugma::
- .incbin "sound/direct_sound_samples/cry_slugma.bin"
+ .incbin "sound/direct_sound_samples/cries/slugma.bin"
.align 2
Cry_Magcargo::
- .incbin "sound/direct_sound_samples/cry_magcargo.bin"
+ .incbin "sound/direct_sound_samples/cries/magcargo.bin"
.align 2
Cry_Swinub::
- .incbin "sound/direct_sound_samples/cry_swinub.bin"
+ .incbin "sound/direct_sound_samples/cries/swinub.bin"
.align 2
Cry_Piloswine::
- .incbin "sound/direct_sound_samples/cry_piloswine.bin"
+ .incbin "sound/direct_sound_samples/cries/piloswine.bin"
.align 2
Cry_Corsola::
- .incbin "sound/direct_sound_samples/cry_corsola.bin"
+ .incbin "sound/direct_sound_samples/cries/corsola.bin"
.align 2
Cry_Remoraid::
- .incbin "sound/direct_sound_samples/cry_remoraid.bin"
+ .incbin "sound/direct_sound_samples/cries/remoraid.bin"
.align 2
Cry_Octillery::
- .incbin "sound/direct_sound_samples/cry_octillery.bin"
+ .incbin "sound/direct_sound_samples/cries/octillery.bin"
.align 2
Cry_Delibird::
- .incbin "sound/direct_sound_samples/cry_delibird.bin"
+ .incbin "sound/direct_sound_samples/cries/delibird.bin"
.align 2
Cry_Mantine::
- .incbin "sound/direct_sound_samples/cry_mantine.bin"
+ .incbin "sound/direct_sound_samples/cries/mantine.bin"
.align 2
Cry_Skarmory::
- .incbin "sound/direct_sound_samples/cry_skarmory.bin"
+ .incbin "sound/direct_sound_samples/cries/skarmory.bin"
.align 2
Cry_Houndour::
- .incbin "sound/direct_sound_samples/cry_houndour.bin"
+ .incbin "sound/direct_sound_samples/cries/houndour.bin"
.align 2
Cry_Houndoom::
- .incbin "sound/direct_sound_samples/cry_houndoom.bin"
+ .incbin "sound/direct_sound_samples/cries/houndoom.bin"
.align 2
Cry_Kingdra::
- .incbin "sound/direct_sound_samples/cry_kingdra.bin"
+ .incbin "sound/direct_sound_samples/cries/kingdra.bin"
.align 2
Cry_Phanpy::
- .incbin "sound/direct_sound_samples/cry_phanpy.bin"
+ .incbin "sound/direct_sound_samples/cries/phanpy.bin"
.align 2
Cry_Donphan::
- .incbin "sound/direct_sound_samples/cry_donphan.bin"
+ .incbin "sound/direct_sound_samples/cries/donphan.bin"
.align 2
Cry_Porygon2::
- .incbin "sound/direct_sound_samples/cry_porygon2.bin"
+ .incbin "sound/direct_sound_samples/cries/porygon2.bin"
.align 2
Cry_Stantler::
- .incbin "sound/direct_sound_samples/cry_stantler.bin"
+ .incbin "sound/direct_sound_samples/cries/stantler.bin"
.align 2
Cry_Smeargle::
- .incbin "sound/direct_sound_samples/cry_smeargle.bin"
+ .incbin "sound/direct_sound_samples/cries/smeargle.bin"
.align 2
Cry_Tyrogue::
- .incbin "sound/direct_sound_samples/cry_tyrogue.bin"
+ .incbin "sound/direct_sound_samples/cries/tyrogue.bin"
.align 2
Cry_Hitmontop::
- .incbin "sound/direct_sound_samples/cry_hitmontop.bin"
+ .incbin "sound/direct_sound_samples/cries/hitmontop.bin"
.align 2
Cry_Smoochum::
- .incbin "sound/direct_sound_samples/cry_smoochum.bin"
+ .incbin "sound/direct_sound_samples/cries/smoochum.bin"
.align 2
Cry_Elekid::
- .incbin "sound/direct_sound_samples/cry_elekid.bin"
+ .incbin "sound/direct_sound_samples/cries/elekid.bin"
.align 2
Cry_Magby::
- .incbin "sound/direct_sound_samples/cry_magby.bin"
+ .incbin "sound/direct_sound_samples/cries/magby.bin"
.align 2
Cry_Miltank::
- .incbin "sound/direct_sound_samples/cry_miltank.bin"
+ .incbin "sound/direct_sound_samples/cries/miltank.bin"
.align 2
Cry_Blissey::
- .incbin "sound/direct_sound_samples/cry_blissey.bin"
+ .incbin "sound/direct_sound_samples/cries/blissey.bin"
.align 2
Cry_Raikou::
- .incbin "sound/direct_sound_samples/cry_raikou.bin"
+ .incbin "sound/direct_sound_samples/cries/raikou.bin"
.align 2
Cry_Entei::
- .incbin "sound/direct_sound_samples/cry_entei.bin"
+ .incbin "sound/direct_sound_samples/cries/entei.bin"
.align 2
Cry_Suicune::
- .incbin "sound/direct_sound_samples/cry_suicune.bin"
+ .incbin "sound/direct_sound_samples/cries/suicune.bin"
.align 2
Cry_Larvitar::
- .incbin "sound/direct_sound_samples/cry_larvitar.bin"
+ .incbin "sound/direct_sound_samples/cries/larvitar.bin"
.align 2
Cry_Pupitar::
- .incbin "sound/direct_sound_samples/cry_pupitar.bin"
+ .incbin "sound/direct_sound_samples/cries/pupitar.bin"
.align 2
Cry_Tyranitar::
- .incbin "sound/direct_sound_samples/cry_tyranitar.bin"
+ .incbin "sound/direct_sound_samples/cries/tyranitar.bin"
.align 2
Cry_Lugia::
- .incbin "sound/direct_sound_samples/cry_lugia.bin"
+ .incbin "sound/direct_sound_samples/cries/lugia.bin"
.align 2
Cry_HoOh::
- .incbin "sound/direct_sound_samples/cry_ho_oh.bin"
+ .incbin "sound/direct_sound_samples/cries/ho_oh.bin"
.align 2
Cry_Celebi::
- .incbin "sound/direct_sound_samples/cry_celebi.bin"
+ .incbin "sound/direct_sound_samples/cries/celebi.bin"
.align 2
Cry_Kecleon::
- .incbin "sound/direct_sound_samples/cry_kecleon.bin"
+ .incbin "sound/direct_sound_samples/cries/kecleon.bin"
.align 2
Cry_Roselia::
- .incbin "sound/direct_sound_samples/cry_roselia.bin"
+ .incbin "sound/direct_sound_samples/cries/roselia.bin"
.align 2
Cry_Torkoal::
- .incbin "sound/direct_sound_samples/cry_torkoal.bin"
+ .incbin "sound/direct_sound_samples/cries/torkoal.bin"
.align 2
Cry_Electrike::
- .incbin "sound/direct_sound_samples/cry_electrike.bin"
+ .incbin "sound/direct_sound_samples/cries/electrike.bin"
.align 2
Cry_Manectric::
- .incbin "sound/direct_sound_samples/cry_manectric.bin"
+ .incbin "sound/direct_sound_samples/cries/manectric.bin"
.align 2
Cry_Duskull::
- .incbin "sound/direct_sound_samples/cry_duskull.bin"
+ .incbin "sound/direct_sound_samples/cries/duskull.bin"
.align 2
Cry_Latias::
- .incbin "sound/direct_sound_samples/cry_latias.bin"
+ .incbin "sound/direct_sound_samples/cries/latias.bin"
.align 2
Cry_Wynaut::
- .incbin "sound/direct_sound_samples/cry_wynaut.bin"
+ .incbin "sound/direct_sound_samples/cries/wynaut.bin"
.align 2
Cry_Seviper::
- .incbin "sound/direct_sound_samples/cry_seviper.bin"
+ .incbin "sound/direct_sound_samples/cries/seviper.bin"
.align 2
Cry_Sharpedo::
- .incbin "sound/direct_sound_samples/cry_sharpedo.bin"
+ .incbin "sound/direct_sound_samples/cries/sharpedo.bin"
.align 2
Cry_Zangoose::
- .incbin "sound/direct_sound_samples/cry_zangoose.bin"
+ .incbin "sound/direct_sound_samples/cries/zangoose.bin"
.align 2
Cry_Azurill::
- .incbin "sound/direct_sound_samples/cry_azurill.bin"
+ .incbin "sound/direct_sound_samples/cries/azurill.bin"
.align 2
Cry_Swablu::
- .incbin "sound/direct_sound_samples/cry_swablu.bin"
+ .incbin "sound/direct_sound_samples/cries/swablu.bin"
.align 2
Cry_Altaria::
- .incbin "sound/direct_sound_samples/cry_altaria.bin"
+ .incbin "sound/direct_sound_samples/cries/altaria.bin"
.align 2
Cry_Unused265::
- .incbin "sound/direct_sound_samples/cry_unused_265.bin"
+ .incbin "sound/direct_sound_samples/cries/unused_265.bin"
.align 2
Cry_Taillow::
- .incbin "sound/direct_sound_samples/cry_taillow.bin"
+ .incbin "sound/direct_sound_samples/cries/taillow.bin"
.align 2
Cry_Swellow::
- .incbin "sound/direct_sound_samples/cry_swellow.bin"
+ .incbin "sound/direct_sound_samples/cries/swellow.bin"
.align 2
Cry_Unused268::
- .incbin "sound/direct_sound_samples/cry_unused_268.bin"
+ .incbin "sound/direct_sound_samples/cries/unused_268.bin"
.align 2
Cry_Spinda::
- .incbin "sound/direct_sound_samples/cry_spinda.bin"
+ .incbin "sound/direct_sound_samples/cries/spinda.bin"
.align 2
Cry_Torchic::
- .incbin "sound/direct_sound_samples/cry_torchic.bin"
+ .incbin "sound/direct_sound_samples/cries/torchic.bin"
.align 2
Cry_Combusken::
- .incbin "sound/direct_sound_samples/cry_combusken.bin"
+ .incbin "sound/direct_sound_samples/cries/combusken.bin"
.align 2
Cry_Blaziken::
- .incbin "sound/direct_sound_samples/cry_blaziken.bin"
+ .incbin "sound/direct_sound_samples/cries/blaziken.bin"
.align 2
Cry_Treecko::
- .incbin "sound/direct_sound_samples/cry_treecko.bin"
+ .incbin "sound/direct_sound_samples/cries/treecko.bin"
.align 2
Cry_Grovyle::
- .incbin "sound/direct_sound_samples/cry_grovyle.bin"
+ .incbin "sound/direct_sound_samples/cries/grovyle.bin"
.align 2
Cry_Sceptile::
- .incbin "sound/direct_sound_samples/cry_sceptile.bin"
+ .incbin "sound/direct_sound_samples/cries/sceptile.bin"
.align 2
Cry_Mudkip::
- .incbin "sound/direct_sound_samples/cry_mudkip.bin"
+ .incbin "sound/direct_sound_samples/cries/mudkip.bin"
.align 2
Cry_Marshtomp::
- .incbin "sound/direct_sound_samples/cry_marshtomp.bin"
+ .incbin "sound/direct_sound_samples/cries/marshtomp.bin"
.align 2
Cry_Swampert::
- .incbin "sound/direct_sound_samples/cry_swampert.bin"
+ .incbin "sound/direct_sound_samples/cries/swampert.bin"
.align 2
Cry_Pelipper::
- .incbin "sound/direct_sound_samples/cry_pelipper.bin"
+ .incbin "sound/direct_sound_samples/cries/pelipper.bin"
.align 2
Cry_Wingull::
- .incbin "sound/direct_sound_samples/cry_wingull.bin"
+ .incbin "sound/direct_sound_samples/cries/wingull.bin"
.align 2
Cry_Banette::
- .incbin "sound/direct_sound_samples/cry_banette.bin"
+ .incbin "sound/direct_sound_samples/cries/banette.bin"
.align 2
Cry_Shuppet::
- .incbin "sound/direct_sound_samples/cry_shuppet.bin"
+ .incbin "sound/direct_sound_samples/cries/shuppet.bin"
.align 2
Cry_Lotad::
- .incbin "sound/direct_sound_samples/cry_lotad.bin"
+ .incbin "sound/direct_sound_samples/cries/lotad.bin"
.align 2
Cry_Lombre::
- .incbin "sound/direct_sound_samples/cry_lombre.bin"
+ .incbin "sound/direct_sound_samples/cries/lombre.bin"
.align 2
Cry_Ludicolo::
- .incbin "sound/direct_sound_samples/cry_ludicolo.bin"
+ .incbin "sound/direct_sound_samples/cries/ludicolo.bin"
.align 2
Cry_Seedot::
- .incbin "sound/direct_sound_samples/cry_seedot.bin"
+ .incbin "sound/direct_sound_samples/cries/seedot.bin"
.align 2
Cry_Nuzleaf::
- .incbin "sound/direct_sound_samples/cry_nuzleaf.bin"
+ .incbin "sound/direct_sound_samples/cries/nuzleaf.bin"
.align 2
Cry_Shiftry::
- .incbin "sound/direct_sound_samples/cry_shiftry.bin"
+ .incbin "sound/direct_sound_samples/cries/shiftry.bin"
.align 2
Cry_Carvanha::
- .incbin "sound/direct_sound_samples/cry_carvanha.bin"
+ .incbin "sound/direct_sound_samples/cries/carvanha.bin"
.align 2
Cry_Wurmple::
- .incbin "sound/direct_sound_samples/cry_wurmple.bin"
+ .incbin "sound/direct_sound_samples/cries/wurmple.bin"
.align 2
Cry_Silcoon::
- .incbin "sound/direct_sound_samples/cry_silcoon.bin"
+ .incbin "sound/direct_sound_samples/cries/silcoon.bin"
.align 2
Cry_Beautifly::
- .incbin "sound/direct_sound_samples/cry_beautifly.bin"
+ .incbin "sound/direct_sound_samples/cries/beautifly.bin"
.align 2
Cry_Cascoon::
- .incbin "sound/direct_sound_samples/cry_cascoon.bin"
+ .incbin "sound/direct_sound_samples/cries/cascoon.bin"
.align 2
Cry_Dustox::
- .incbin "sound/direct_sound_samples/cry_dustox.bin"
+ .incbin "sound/direct_sound_samples/cries/dustox.bin"
.align 2
Cry_Ralts::
- .incbin "sound/direct_sound_samples/cry_ralts.bin"
+ .incbin "sound/direct_sound_samples/cries/ralts.bin"
.align 2
Cry_Kirlia::
- .incbin "sound/direct_sound_samples/cry_kirlia.bin"
+ .incbin "sound/direct_sound_samples/cries/kirlia.bin"
.align 2
Cry_Gardevoir::
- .incbin "sound/direct_sound_samples/cry_gardevoir.bin"
+ .incbin "sound/direct_sound_samples/cries/gardevoir.bin"
.align 2
Cry_Slakoth::
- .incbin "sound/direct_sound_samples/cry_slakoth.bin"
+ .incbin "sound/direct_sound_samples/cries/slakoth.bin"
.align 2
Cry_Vigoroth::
- .incbin "sound/direct_sound_samples/cry_vigoroth.bin"
+ .incbin "sound/direct_sound_samples/cries/vigoroth.bin"
.align 2
Cry_Slaking::
- .incbin "sound/direct_sound_samples/cry_slaking.bin"
+ .incbin "sound/direct_sound_samples/cries/slaking.bin"
.align 2
Cry_Nincada::
- .incbin "sound/direct_sound_samples/cry_nincada.bin"
+ .incbin "sound/direct_sound_samples/cries/nincada.bin"
.align 2
Cry_Ninjask::
- .incbin "sound/direct_sound_samples/cry_ninjask.bin"
+ .incbin "sound/direct_sound_samples/cries/ninjask.bin"
.align 2
Cry_Shedinja::
- .incbin "sound/direct_sound_samples/cry_shedinja.bin"
+ .incbin "sound/direct_sound_samples/cries/shedinja.bin"
.align 2
Cry_Makuhita::
- .incbin "sound/direct_sound_samples/cry_makuhita.bin"
+ .incbin "sound/direct_sound_samples/cries/makuhita.bin"
.align 2
Cry_Hariyama::
- .incbin "sound/direct_sound_samples/cry_hariyama.bin"
+ .incbin "sound/direct_sound_samples/cries/hariyama.bin"
.align 2
Cry_Nosepass::
- .incbin "sound/direct_sound_samples/cry_nosepass.bin"
+ .incbin "sound/direct_sound_samples/cries/nosepass.bin"
.align 2
Cry_Glalie::
- .incbin "sound/direct_sound_samples/cry_glalie.bin"
+ .incbin "sound/direct_sound_samples/cries/glalie.bin"
.align 2
Cry_Plusle::
- .incbin "sound/direct_sound_samples/cry_plusle.bin"
+ .incbin "sound/direct_sound_samples/cries/plusle.bin"
.align 2
Cry_Minun::
- .incbin "sound/direct_sound_samples/cry_minun.bin"
+ .incbin "sound/direct_sound_samples/cries/minun.bin"
.align 2
Cry_Surskit::
- .incbin "sound/direct_sound_samples/cry_surskit.bin"
+ .incbin "sound/direct_sound_samples/cries/surskit.bin"
.align 2
Cry_Masquerain::
- .incbin "sound/direct_sound_samples/cry_masquerain.bin"
+ .incbin "sound/direct_sound_samples/cries/masquerain.bin"
.align 2
Cry_Skitty::
- .incbin "sound/direct_sound_samples/cry_skitty.bin"
+ .incbin "sound/direct_sound_samples/cries/skitty.bin"
.align 2
Cry_Delcatty::
- .incbin "sound/direct_sound_samples/cry_delcatty.bin"
+ .incbin "sound/direct_sound_samples/cries/delcatty.bin"
.align 2
Cry_Gulpin::
- .incbin "sound/direct_sound_samples/cry_gulpin.bin"
+ .incbin "sound/direct_sound_samples/cries/gulpin.bin"
.align 2
Cry_Swalot::
- .incbin "sound/direct_sound_samples/cry_swalot.bin"
+ .incbin "sound/direct_sound_samples/cries/swalot.bin"
.align 2
Cry_Numel::
- .incbin "sound/direct_sound_samples/cry_numel.bin"
+ .incbin "sound/direct_sound_samples/cries/numel.bin"
.align 2
Cry_Camerupt::
- .incbin "sound/direct_sound_samples/cry_camerupt.bin"
+ .incbin "sound/direct_sound_samples/cries/camerupt.bin"
.align 2
Cry_Barboach::
- .incbin "sound/direct_sound_samples/cry_barboach.bin"
+ .incbin "sound/direct_sound_samples/cries/barboach.bin"
.align 2
Cry_Whiscash::
- .incbin "sound/direct_sound_samples/cry_whiscash.bin"
+ .incbin "sound/direct_sound_samples/cries/whiscash.bin"
.align 2
Cry_Corphish::
- .incbin "sound/direct_sound_samples/cry_corphish.bin"
+ .incbin "sound/direct_sound_samples/cries/corphish.bin"
.align 2
Cry_Crawdaunt::
- .incbin "sound/direct_sound_samples/cry_crawdaunt.bin"
+ .incbin "sound/direct_sound_samples/cries/crawdaunt.bin"
.align 2
Cry_Spoink::
- .incbin "sound/direct_sound_samples/cry_spoink.bin"
+ .incbin "sound/direct_sound_samples/cries/spoink.bin"
.align 2
Cry_Grumpig::
- .incbin "sound/direct_sound_samples/cry_grumpig.bin"
+ .incbin "sound/direct_sound_samples/cries/grumpig.bin"
.align 2
Cry_Trapinch::
- .incbin "sound/direct_sound_samples/cry_trapinch.bin"
+ .incbin "sound/direct_sound_samples/cries/trapinch.bin"
.align 2
Cry_Vibrava::
- .incbin "sound/direct_sound_samples/cry_vibrava.bin"
+ .incbin "sound/direct_sound_samples/cries/vibrava.bin"
.align 2
Cry_Flygon::
- .incbin "sound/direct_sound_samples/cry_flygon.bin"
+ .incbin "sound/direct_sound_samples/cries/flygon.bin"
.align 2
Cry_Cacnea::
- .incbin "sound/direct_sound_samples/cry_cacnea.bin"
+ .incbin "sound/direct_sound_samples/cries/cacnea.bin"
.align 2
Cry_Cacturne::
- .incbin "sound/direct_sound_samples/cry_cacturne.bin"
+ .incbin "sound/direct_sound_samples/cries/cacturne.bin"
.align 2
Cry_Baltoy::
- .incbin "sound/direct_sound_samples/cry_baltoy.bin"
+ .incbin "sound/direct_sound_samples/cries/baltoy.bin"
.align 2
Cry_Claydol::
- .incbin "sound/direct_sound_samples/cry_claydol.bin"
+ .incbin "sound/direct_sound_samples/cries/claydol.bin"
.align 2
Cry_Lunatone::
- .incbin "sound/direct_sound_samples/cry_lunatone.bin"
+ .incbin "sound/direct_sound_samples/cries/lunatone.bin"
.align 2
Cry_Solrock::
- .incbin "sound/direct_sound_samples/cry_solrock.bin"
+ .incbin "sound/direct_sound_samples/cries/solrock.bin"
.align 2
Cry_Feebas::
- .incbin "sound/direct_sound_samples/cry_feebas.bin"
+ .incbin "sound/direct_sound_samples/cries/feebas.bin"
.align 2
Cry_Milotic::
- .incbin "sound/direct_sound_samples/cry_milotic.bin"
+ .incbin "sound/direct_sound_samples/cries/milotic.bin"
.align 2
Cry_Absol::
- .incbin "sound/direct_sound_samples/cry_absol.bin"
+ .incbin "sound/direct_sound_samples/cries/absol.bin"
.align 2
Cry_Meditite::
- .incbin "sound/direct_sound_samples/cry_meditite.bin"
+ .incbin "sound/direct_sound_samples/cries/meditite.bin"
.align 2
Cry_Medicham::
- .incbin "sound/direct_sound_samples/cry_medicham.bin"
+ .incbin "sound/direct_sound_samples/cries/medicham.bin"
.align 2
Cry_Spheal::
- .incbin "sound/direct_sound_samples/cry_spheal.bin"
+ .incbin "sound/direct_sound_samples/cries/spheal.bin"
.align 2
Cry_Sealeo::
- .incbin "sound/direct_sound_samples/cry_sealeo.bin"
+ .incbin "sound/direct_sound_samples/cries/sealeo.bin"
.align 2
Cry_Walrein::
- .incbin "sound/direct_sound_samples/cry_walrein.bin"
+ .incbin "sound/direct_sound_samples/cries/walrein.bin"
.align 2
Cry_Clamperl::
- .incbin "sound/direct_sound_samples/cry_clamperl.bin"
+ .incbin "sound/direct_sound_samples/cries/clamperl.bin"
.align 2
Cry_Huntail::
- .incbin "sound/direct_sound_samples/cry_huntail.bin"
+ .incbin "sound/direct_sound_samples/cries/huntail.bin"
.align 2
Cry_Gorebyss::
- .incbin "sound/direct_sound_samples/cry_gorebyss.bin"
+ .incbin "sound/direct_sound_samples/cries/gorebyss.bin"
.align 2
Cry_Lileep::
- .incbin "sound/direct_sound_samples/cry_lileep.bin"
+ .incbin "sound/direct_sound_samples/cries/lileep.bin"
.align 2
Cry_Cradily::
- .incbin "sound/direct_sound_samples/cry_cradily.bin"
+ .incbin "sound/direct_sound_samples/cries/cradily.bin"
.align 2
Cry_Anorith::
- .incbin "sound/direct_sound_samples/cry_anorith.bin"
+ .incbin "sound/direct_sound_samples/cries/anorith.bin"
.align 2
Cry_Armaldo::
- .incbin "sound/direct_sound_samples/cry_armaldo.bin"
+ .incbin "sound/direct_sound_samples/cries/armaldo.bin"
.align 2
Cry_Beldum::
- .incbin "sound/direct_sound_samples/cry_beldum.bin"
+ .incbin "sound/direct_sound_samples/cries/beldum.bin"
.align 2
Cry_Metang::
- .incbin "sound/direct_sound_samples/cry_metang.bin"
+ .incbin "sound/direct_sound_samples/cries/metang.bin"
.align 2
Cry_Metagross::
- .incbin "sound/direct_sound_samples/cry_metagross.bin"
+ .incbin "sound/direct_sound_samples/cries/metagross.bin"
.align 2
Cry_Bagon::
- .incbin "sound/direct_sound_samples/cry_bagon.bin"
+ .incbin "sound/direct_sound_samples/cries/bagon.bin"
.align 2
Cry_Shelgon::
- .incbin "sound/direct_sound_samples/cry_shelgon.bin"
+ .incbin "sound/direct_sound_samples/cries/shelgon.bin"
.align 2
Cry_Regirock::
- .incbin "sound/direct_sound_samples/cry_regirock.bin"
+ .incbin "sound/direct_sound_samples/cries/regirock.bin"
.align 2
Cry_Regice::
- .incbin "sound/direct_sound_samples/cry_regice.bin"
+ .incbin "sound/direct_sound_samples/cries/regice.bin"
.align 2
Cry_Registeel::
- .incbin "sound/direct_sound_samples/cry_registeel.bin"
+ .incbin "sound/direct_sound_samples/cries/registeel.bin"
.align 2
Cry_Castform::
- .incbin "sound/direct_sound_samples/cry_castform.bin"
+ .incbin "sound/direct_sound_samples/cries/castform.bin"
.align 2
Cry_Volbeat::
- .incbin "sound/direct_sound_samples/cry_volbeat.bin"
+ .incbin "sound/direct_sound_samples/cries/volbeat.bin"
.align 2
Cry_Illumise::
- .incbin "sound/direct_sound_samples/cry_illumise.bin"
+ .incbin "sound/direct_sound_samples/cries/illumise.bin"
.align 2
Cry_Poochyena::
- .incbin "sound/direct_sound_samples/cry_poochyena.bin"
+ .incbin "sound/direct_sound_samples/cries/poochyena.bin"
.align 2
Cry_Mightyena::
- .incbin "sound/direct_sound_samples/cry_mightyena.bin"
+ .incbin "sound/direct_sound_samples/cries/mightyena.bin"
.align 2
Cry_Dusclops::
- .incbin "sound/direct_sound_samples/cry_dusclops.bin"
+ .incbin "sound/direct_sound_samples/cries/dusclops.bin"
.align 2
Cry_Sableye::
- .incbin "sound/direct_sound_samples/cry_sableye.bin"
+ .incbin "sound/direct_sound_samples/cries/sableye.bin"
.align 2
Cry_Mawile::
- .incbin "sound/direct_sound_samples/cry_mawile.bin"
+ .incbin "sound/direct_sound_samples/cries/mawile.bin"
.align 2
Cry_Aron::
- .incbin "sound/direct_sound_samples/cry_aron.bin"
+ .incbin "sound/direct_sound_samples/cries/aron.bin"
.align 2
Cry_Lairon::
- .incbin "sound/direct_sound_samples/cry_lairon.bin"
+ .incbin "sound/direct_sound_samples/cries/lairon.bin"
.align 2
Cry_Aggron::
- .incbin "sound/direct_sound_samples/cry_aggron.bin"
+ .incbin "sound/direct_sound_samples/cries/aggron.bin"
.align 2
Cry_Relicanth::
- .incbin "sound/direct_sound_samples/cry_relicanth.bin"
+ .incbin "sound/direct_sound_samples/cries/relicanth.bin"
.align 2
Cry_Luvdisc::
- .incbin "sound/direct_sound_samples/cry_luvdisc.bin"
+ .incbin "sound/direct_sound_samples/cries/luvdisc.bin"
.align 2
Cry_Groudon::
- .incbin "sound/direct_sound_samples/cry_groudon.bin"
+ .incbin "sound/direct_sound_samples/cries/groudon.bin"
.align 2
Cry_Kyogre::
- .incbin "sound/direct_sound_samples/cry_kyogre.bin"
+ .incbin "sound/direct_sound_samples/cries/kyogre.bin"
.align 2
Cry_Rayquaza::
- .incbin "sound/direct_sound_samples/cry_rayquaza.bin"
+ .incbin "sound/direct_sound_samples/cries/rayquaza.bin"
.align 2
Cry_Salamence::
- .incbin "sound/direct_sound_samples/cry_salamence.bin"
+ .incbin "sound/direct_sound_samples/cries/salamence.bin"
.align 2
Cry_Breloom::
- .incbin "sound/direct_sound_samples/cry_breloom.bin"
+ .incbin "sound/direct_sound_samples/cries/breloom.bin"
.align 2
Cry_Shroomish::
- .incbin "sound/direct_sound_samples/cry_shroomish.bin"
+ .incbin "sound/direct_sound_samples/cries/shroomish.bin"
.align 2
Cry_Linoone::
- .incbin "sound/direct_sound_samples/cry_linoone.bin"
+ .incbin "sound/direct_sound_samples/cries/linoone.bin"
.align 2
Cry_Tropius::
- .incbin "sound/direct_sound_samples/cry_tropius.bin"
+ .incbin "sound/direct_sound_samples/cries/tropius.bin"
.align 2
Cry_Wailmer::
- .incbin "sound/direct_sound_samples/cry_wailmer.bin"
+ .incbin "sound/direct_sound_samples/cries/wailmer.bin"
.align 2
Cry_Zigzagoon::
- .incbin "sound/direct_sound_samples/cry_zigzagoon.bin"
+ .incbin "sound/direct_sound_samples/cries/zigzagoon.bin"
.align 2
Cry_Exploud::
- .incbin "sound/direct_sound_samples/cry_exploud.bin"
+ .incbin "sound/direct_sound_samples/cries/exploud.bin"
.align 2
Cry_Loudred::
- .incbin "sound/direct_sound_samples/cry_loudred.bin"
+ .incbin "sound/direct_sound_samples/cries/loudred.bin"
.align 2
Cry_Wailord::
- .incbin "sound/direct_sound_samples/cry_wailord.bin"
+ .incbin "sound/direct_sound_samples/cries/wailord.bin"
.align 2
Cry_Whismur::
- .incbin "sound/direct_sound_samples/cry_whismur.bin"
+ .incbin "sound/direct_sound_samples/cries/whismur.bin"
.align 2
Cry_Snorunt::
- .incbin "sound/direct_sound_samples/cry_snorunt.bin"
+ .incbin "sound/direct_sound_samples/cries/snorunt.bin"
.align 2
Cry_Latios::
- .incbin "sound/direct_sound_samples/cry_latios.bin"
+ .incbin "sound/direct_sound_samples/cries/latios.bin"
.align 2
Cry_Jirachi::
- .incbin "sound/direct_sound_samples/cry_jirachi.bin"
+ .incbin "sound/direct_sound_samples/cries/jirachi.bin"
.align 2
Cry_Deoxys::
- .incbin "sound/direct_sound_samples/cry_deoxys.bin"
+ .incbin "sound/direct_sound_samples/cries/deoxys.bin"
.align 2
Cry_Chimecho::
- .incbin "sound/direct_sound_samples/cry_chimecho.bin"
+ .incbin "sound/direct_sound_samples/cries/chimecho.bin"
.align 2
DirectSoundWaveData_register_noise::
diff --git a/sound/direct_sound_samples/cry_abra.aif b/sound/direct_sound_samples/cries/abra.aif
index 7df4446db..7df4446db 100644
--- a/sound/direct_sound_samples/cry_abra.aif
+++ b/sound/direct_sound_samples/cries/abra.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_absol.aif b/sound/direct_sound_samples/cries/absol.aif
index 884ab22b3..884ab22b3 100644
--- a/sound/direct_sound_samples/cry_absol.aif
+++ b/sound/direct_sound_samples/cries/absol.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_aerodactyl.aif b/sound/direct_sound_samples/cries/aerodactyl.aif
index c0e40f6d1..c0e40f6d1 100644
--- a/sound/direct_sound_samples/cry_aerodactyl.aif
+++ b/sound/direct_sound_samples/cries/aerodactyl.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_aggron.aif b/sound/direct_sound_samples/cries/aggron.aif
index b89ea1222..b89ea1222 100644
--- a/sound/direct_sound_samples/cry_aggron.aif
+++ b/sound/direct_sound_samples/cries/aggron.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_aipom.aif b/sound/direct_sound_samples/cries/aipom.aif
index 5ca276de2..5ca276de2 100644
--- a/sound/direct_sound_samples/cry_aipom.aif
+++ b/sound/direct_sound_samples/cries/aipom.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_alakazam.aif b/sound/direct_sound_samples/cries/alakazam.aif
index 920e2ff94..920e2ff94 100644
--- a/sound/direct_sound_samples/cry_alakazam.aif
+++ b/sound/direct_sound_samples/cries/alakazam.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_altaria.aif b/sound/direct_sound_samples/cries/altaria.aif
index 3e8e35e8e..3e8e35e8e 100644
--- a/sound/direct_sound_samples/cry_altaria.aif
+++ b/sound/direct_sound_samples/cries/altaria.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_ampharos.aif b/sound/direct_sound_samples/cries/ampharos.aif
index 4f6e255a0..4f6e255a0 100644
--- a/sound/direct_sound_samples/cry_ampharos.aif
+++ b/sound/direct_sound_samples/cries/ampharos.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_anorith.aif b/sound/direct_sound_samples/cries/anorith.aif
index 96e87e919..96e87e919 100644
--- a/sound/direct_sound_samples/cry_anorith.aif
+++ b/sound/direct_sound_samples/cries/anorith.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_arbok.aif b/sound/direct_sound_samples/cries/arbok.aif
index 6ccace9f9..6ccace9f9 100644
--- a/sound/direct_sound_samples/cry_arbok.aif
+++ b/sound/direct_sound_samples/cries/arbok.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_arcanine.aif b/sound/direct_sound_samples/cries/arcanine.aif
index 61d802153..61d802153 100644
--- a/sound/direct_sound_samples/cry_arcanine.aif
+++ b/sound/direct_sound_samples/cries/arcanine.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_ariados.aif b/sound/direct_sound_samples/cries/ariados.aif
index 1748624fb..1748624fb 100644
--- a/sound/direct_sound_samples/cry_ariados.aif
+++ b/sound/direct_sound_samples/cries/ariados.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_armaldo.aif b/sound/direct_sound_samples/cries/armaldo.aif
index 756bf0842..756bf0842 100644
--- a/sound/direct_sound_samples/cry_armaldo.aif
+++ b/sound/direct_sound_samples/cries/armaldo.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_aron.aif b/sound/direct_sound_samples/cries/aron.aif
index cce70b73b..cce70b73b 100644
--- a/sound/direct_sound_samples/cry_aron.aif
+++ b/sound/direct_sound_samples/cries/aron.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_articuno.aif b/sound/direct_sound_samples/cries/articuno.aif
index 4f237dd0f..4f237dd0f 100644
--- a/sound/direct_sound_samples/cry_articuno.aif
+++ b/sound/direct_sound_samples/cries/articuno.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_azumarill.aif b/sound/direct_sound_samples/cries/azumarill.aif
index 18411f93c..18411f93c 100644
--- a/sound/direct_sound_samples/cry_azumarill.aif
+++ b/sound/direct_sound_samples/cries/azumarill.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_azurill.aif b/sound/direct_sound_samples/cries/azurill.aif
index 7f651c3d3..7f651c3d3 100644
--- a/sound/direct_sound_samples/cry_azurill.aif
+++ b/sound/direct_sound_samples/cries/azurill.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_bagon.aif b/sound/direct_sound_samples/cries/bagon.aif
index 3843fb9f4..3843fb9f4 100644
--- a/sound/direct_sound_samples/cry_bagon.aif
+++ b/sound/direct_sound_samples/cries/bagon.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_baltoy.aif b/sound/direct_sound_samples/cries/baltoy.aif
index 25e1a708a..25e1a708a 100644
--- a/sound/direct_sound_samples/cry_baltoy.aif
+++ b/sound/direct_sound_samples/cries/baltoy.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_banette.aif b/sound/direct_sound_samples/cries/banette.aif
index 23713f1b5..23713f1b5 100644
--- a/sound/direct_sound_samples/cry_banette.aif
+++ b/sound/direct_sound_samples/cries/banette.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_barboach.aif b/sound/direct_sound_samples/cries/barboach.aif
index 4b9228259..4b9228259 100644
--- a/sound/direct_sound_samples/cry_barboach.aif
+++ b/sound/direct_sound_samples/cries/barboach.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_bayleef.aif b/sound/direct_sound_samples/cries/bayleef.aif
index 8cef22df3..8cef22df3 100644
--- a/sound/direct_sound_samples/cry_bayleef.aif
+++ b/sound/direct_sound_samples/cries/bayleef.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_beautifly.aif b/sound/direct_sound_samples/cries/beautifly.aif
index 0924b6c55..0924b6c55 100644
--- a/sound/direct_sound_samples/cry_beautifly.aif
+++ b/sound/direct_sound_samples/cries/beautifly.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_beedrill.aif b/sound/direct_sound_samples/cries/beedrill.aif
index 00d0bc96c..00d0bc96c 100644
--- a/sound/direct_sound_samples/cry_beedrill.aif
+++ b/sound/direct_sound_samples/cries/beedrill.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_beldum.aif b/sound/direct_sound_samples/cries/beldum.aif
index 76435a6a8..76435a6a8 100644
--- a/sound/direct_sound_samples/cry_beldum.aif
+++ b/sound/direct_sound_samples/cries/beldum.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_bellossom.aif b/sound/direct_sound_samples/cries/bellossom.aif
index 86580df65..86580df65 100644
--- a/sound/direct_sound_samples/cry_bellossom.aif
+++ b/sound/direct_sound_samples/cries/bellossom.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_bellsprout.aif b/sound/direct_sound_samples/cries/bellsprout.aif
index cfdd7aed2..cfdd7aed2 100644
--- a/sound/direct_sound_samples/cry_bellsprout.aif
+++ b/sound/direct_sound_samples/cries/bellsprout.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_blastoise.aif b/sound/direct_sound_samples/cries/blastoise.aif
index 76dac2bcc..76dac2bcc 100644
--- a/sound/direct_sound_samples/cry_blastoise.aif
+++ b/sound/direct_sound_samples/cries/blastoise.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_blaziken.aif b/sound/direct_sound_samples/cries/blaziken.aif
index 83e5ccf23..83e5ccf23 100644
--- a/sound/direct_sound_samples/cry_blaziken.aif
+++ b/sound/direct_sound_samples/cries/blaziken.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_blissey.aif b/sound/direct_sound_samples/cries/blissey.aif
index 897eb3d69..897eb3d69 100644
--- a/sound/direct_sound_samples/cry_blissey.aif
+++ b/sound/direct_sound_samples/cries/blissey.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_breloom.aif b/sound/direct_sound_samples/cries/breloom.aif
index ea3f1bb66..ea3f1bb66 100644
--- a/sound/direct_sound_samples/cry_breloom.aif
+++ b/sound/direct_sound_samples/cries/breloom.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_bulbasaur.aif b/sound/direct_sound_samples/cries/bulbasaur.aif
index 040fb1df7..040fb1df7 100644
--- a/sound/direct_sound_samples/cry_bulbasaur.aif
+++ b/sound/direct_sound_samples/cries/bulbasaur.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_butterfree.aif b/sound/direct_sound_samples/cries/butterfree.aif
index f27616395..f27616395 100644
--- a/sound/direct_sound_samples/cry_butterfree.aif
+++ b/sound/direct_sound_samples/cries/butterfree.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_cacnea.aif b/sound/direct_sound_samples/cries/cacnea.aif
index 4fd5acd36..4fd5acd36 100644
--- a/sound/direct_sound_samples/cry_cacnea.aif
+++ b/sound/direct_sound_samples/cries/cacnea.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_cacturne.aif b/sound/direct_sound_samples/cries/cacturne.aif
index d9fb8fda8..d9fb8fda8 100644
--- a/sound/direct_sound_samples/cry_cacturne.aif
+++ b/sound/direct_sound_samples/cries/cacturne.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_camerupt.aif b/sound/direct_sound_samples/cries/camerupt.aif
index 325df1220..325df1220 100644
--- a/sound/direct_sound_samples/cry_camerupt.aif
+++ b/sound/direct_sound_samples/cries/camerupt.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_carvanha.aif b/sound/direct_sound_samples/cries/carvanha.aif
index c7cdedf91..c7cdedf91 100644
--- a/sound/direct_sound_samples/cry_carvanha.aif
+++ b/sound/direct_sound_samples/cries/carvanha.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_cascoon.aif b/sound/direct_sound_samples/cries/cascoon.aif
index 17eef0ee9..17eef0ee9 100644
--- a/sound/direct_sound_samples/cry_cascoon.aif
+++ b/sound/direct_sound_samples/cries/cascoon.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_castform.aif b/sound/direct_sound_samples/cries/castform.aif
index c10745640..c10745640 100644
--- a/sound/direct_sound_samples/cry_castform.aif
+++ b/sound/direct_sound_samples/cries/castform.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_caterpie.aif b/sound/direct_sound_samples/cries/caterpie.aif
index b0b246b4f..b0b246b4f 100644
--- a/sound/direct_sound_samples/cry_caterpie.aif
+++ b/sound/direct_sound_samples/cries/caterpie.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_celebi.aif b/sound/direct_sound_samples/cries/celebi.aif
index 9f9f3ea39..9f9f3ea39 100644
--- a/sound/direct_sound_samples/cry_celebi.aif
+++ b/sound/direct_sound_samples/cries/celebi.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_chansey.aif b/sound/direct_sound_samples/cries/chansey.aif
index d764c86ce..d764c86ce 100644
--- a/sound/direct_sound_samples/cry_chansey.aif
+++ b/sound/direct_sound_samples/cries/chansey.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_charizard.aif b/sound/direct_sound_samples/cries/charizard.aif
index 48321b792..48321b792 100644
--- a/sound/direct_sound_samples/cry_charizard.aif
+++ b/sound/direct_sound_samples/cries/charizard.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_charmander.aif b/sound/direct_sound_samples/cries/charmander.aif
index d72c0f9e0..d72c0f9e0 100644
--- a/sound/direct_sound_samples/cry_charmander.aif
+++ b/sound/direct_sound_samples/cries/charmander.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_charmeleon.aif b/sound/direct_sound_samples/cries/charmeleon.aif
index 8e84af0d8..8e84af0d8 100644
--- a/sound/direct_sound_samples/cry_charmeleon.aif
+++ b/sound/direct_sound_samples/cries/charmeleon.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_chikorita.aif b/sound/direct_sound_samples/cries/chikorita.aif
index 67ceafdc3..67ceafdc3 100644
--- a/sound/direct_sound_samples/cry_chikorita.aif
+++ b/sound/direct_sound_samples/cries/chikorita.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_chimecho.aif b/sound/direct_sound_samples/cries/chimecho.aif
index 87ee2faee..87ee2faee 100644
--- a/sound/direct_sound_samples/cry_chimecho.aif
+++ b/sound/direct_sound_samples/cries/chimecho.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_chinchou.aif b/sound/direct_sound_samples/cries/chinchou.aif
index 356475678..356475678 100644
--- a/sound/direct_sound_samples/cry_chinchou.aif
+++ b/sound/direct_sound_samples/cries/chinchou.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_clamperl.aif b/sound/direct_sound_samples/cries/clamperl.aif
index 7250bd703..7250bd703 100644
--- a/sound/direct_sound_samples/cry_clamperl.aif
+++ b/sound/direct_sound_samples/cries/clamperl.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_claydol.aif b/sound/direct_sound_samples/cries/claydol.aif
index b89772021..b89772021 100644
--- a/sound/direct_sound_samples/cry_claydol.aif
+++ b/sound/direct_sound_samples/cries/claydol.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_clefable.aif b/sound/direct_sound_samples/cries/clefable.aif
index 9c2d8c664..9c2d8c664 100644
--- a/sound/direct_sound_samples/cry_clefable.aif
+++ b/sound/direct_sound_samples/cries/clefable.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_clefairy.aif b/sound/direct_sound_samples/cries/clefairy.aif
index c370c4a9b..c370c4a9b 100644
--- a/sound/direct_sound_samples/cry_clefairy.aif
+++ b/sound/direct_sound_samples/cries/clefairy.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_cleffa.aif b/sound/direct_sound_samples/cries/cleffa.aif
index b27cdeca9..b27cdeca9 100644
--- a/sound/direct_sound_samples/cry_cleffa.aif
+++ b/sound/direct_sound_samples/cries/cleffa.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_cloyster.aif b/sound/direct_sound_samples/cries/cloyster.aif
index b406deab0..b406deab0 100644
--- a/sound/direct_sound_samples/cry_cloyster.aif
+++ b/sound/direct_sound_samples/cries/cloyster.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_combusken.aif b/sound/direct_sound_samples/cries/combusken.aif
index 7d4b0d4cc..7d4b0d4cc 100644
--- a/sound/direct_sound_samples/cry_combusken.aif
+++ b/sound/direct_sound_samples/cries/combusken.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_corphish.aif b/sound/direct_sound_samples/cries/corphish.aif
index f0f5ca01e..f0f5ca01e 100644
--- a/sound/direct_sound_samples/cry_corphish.aif
+++ b/sound/direct_sound_samples/cries/corphish.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_corsola.aif b/sound/direct_sound_samples/cries/corsola.aif
index 68e743bfd..68e743bfd 100644
--- a/sound/direct_sound_samples/cry_corsola.aif
+++ b/sound/direct_sound_samples/cries/corsola.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_cradily.aif b/sound/direct_sound_samples/cries/cradily.aif
index 197dc8d92..197dc8d92 100644
--- a/sound/direct_sound_samples/cry_cradily.aif
+++ b/sound/direct_sound_samples/cries/cradily.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_crawdaunt.aif b/sound/direct_sound_samples/cries/crawdaunt.aif
index a203ce2fb..a203ce2fb 100644
--- a/sound/direct_sound_samples/cry_crawdaunt.aif
+++ b/sound/direct_sound_samples/cries/crawdaunt.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_crobat.aif b/sound/direct_sound_samples/cries/crobat.aif
index 75d039bd8..75d039bd8 100644
--- a/sound/direct_sound_samples/cry_crobat.aif
+++ b/sound/direct_sound_samples/cries/crobat.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_croconaw.aif b/sound/direct_sound_samples/cries/croconaw.aif
index afb7f3fdc..afb7f3fdc 100644
--- a/sound/direct_sound_samples/cry_croconaw.aif
+++ b/sound/direct_sound_samples/cries/croconaw.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_cubone.aif b/sound/direct_sound_samples/cries/cubone.aif
index 170745da1..170745da1 100644
--- a/sound/direct_sound_samples/cry_cubone.aif
+++ b/sound/direct_sound_samples/cries/cubone.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_cyndaquil.aif b/sound/direct_sound_samples/cries/cyndaquil.aif
index 4aa580199..4aa580199 100644
--- a/sound/direct_sound_samples/cry_cyndaquil.aif
+++ b/sound/direct_sound_samples/cries/cyndaquil.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_delcatty.aif b/sound/direct_sound_samples/cries/delcatty.aif
index dd665b110..dd665b110 100644
--- a/sound/direct_sound_samples/cry_delcatty.aif
+++ b/sound/direct_sound_samples/cries/delcatty.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_delibird.aif b/sound/direct_sound_samples/cries/delibird.aif
index dbedc42d4..dbedc42d4 100644
--- a/sound/direct_sound_samples/cry_delibird.aif
+++ b/sound/direct_sound_samples/cries/delibird.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_deoxys.aif b/sound/direct_sound_samples/cries/deoxys.aif
index b9623b337..b9623b337 100644
--- a/sound/direct_sound_samples/cry_deoxys.aif
+++ b/sound/direct_sound_samples/cries/deoxys.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_dewgong.aif b/sound/direct_sound_samples/cries/dewgong.aif
index 72d69b773..72d69b773 100644
--- a/sound/direct_sound_samples/cry_dewgong.aif
+++ b/sound/direct_sound_samples/cries/dewgong.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_diglett.aif b/sound/direct_sound_samples/cries/diglett.aif
index b116af7f2..b116af7f2 100644
--- a/sound/direct_sound_samples/cry_diglett.aif
+++ b/sound/direct_sound_samples/cries/diglett.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_ditto.aif b/sound/direct_sound_samples/cries/ditto.aif
index 2c797f4c4..2c797f4c4 100644
--- a/sound/direct_sound_samples/cry_ditto.aif
+++ b/sound/direct_sound_samples/cries/ditto.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_dodrio.aif b/sound/direct_sound_samples/cries/dodrio.aif
index 111d8bf3e..111d8bf3e 100644
--- a/sound/direct_sound_samples/cry_dodrio.aif
+++ b/sound/direct_sound_samples/cries/dodrio.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_doduo.aif b/sound/direct_sound_samples/cries/doduo.aif
index 5700b91d9..5700b91d9 100644
--- a/sound/direct_sound_samples/cry_doduo.aif
+++ b/sound/direct_sound_samples/cries/doduo.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_donphan.aif b/sound/direct_sound_samples/cries/donphan.aif
index a41c124b1..a41c124b1 100644
--- a/sound/direct_sound_samples/cry_donphan.aif
+++ b/sound/direct_sound_samples/cries/donphan.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_dragonair.aif b/sound/direct_sound_samples/cries/dragonair.aif
index 38c3955ef..38c3955ef 100644
--- a/sound/direct_sound_samples/cry_dragonair.aif
+++ b/sound/direct_sound_samples/cries/dragonair.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_dragonite.aif b/sound/direct_sound_samples/cries/dragonite.aif
index d1e7b11cf..d1e7b11cf 100644
--- a/sound/direct_sound_samples/cry_dragonite.aif
+++ b/sound/direct_sound_samples/cries/dragonite.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_dratini.aif b/sound/direct_sound_samples/cries/dratini.aif
index 298497480..298497480 100644
--- a/sound/direct_sound_samples/cry_dratini.aif
+++ b/sound/direct_sound_samples/cries/dratini.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_drowzee.aif b/sound/direct_sound_samples/cries/drowzee.aif
index 0d53eb2ff..0d53eb2ff 100644
--- a/sound/direct_sound_samples/cry_drowzee.aif
+++ b/sound/direct_sound_samples/cries/drowzee.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_dugtrio.aif b/sound/direct_sound_samples/cries/dugtrio.aif
index dff573dfe..dff573dfe 100644
--- a/sound/direct_sound_samples/cry_dugtrio.aif
+++ b/sound/direct_sound_samples/cries/dugtrio.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_dunsparce.aif b/sound/direct_sound_samples/cries/dunsparce.aif
index 454617c05..454617c05 100644
--- a/sound/direct_sound_samples/cry_dunsparce.aif
+++ b/sound/direct_sound_samples/cries/dunsparce.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_dusclops.aif b/sound/direct_sound_samples/cries/dusclops.aif
index de9657e4f..de9657e4f 100644
--- a/sound/direct_sound_samples/cry_dusclops.aif
+++ b/sound/direct_sound_samples/cries/dusclops.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_duskull.aif b/sound/direct_sound_samples/cries/duskull.aif
index d84ea274e..d84ea274e 100644
--- a/sound/direct_sound_samples/cry_duskull.aif
+++ b/sound/direct_sound_samples/cries/duskull.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_dustox.aif b/sound/direct_sound_samples/cries/dustox.aif
index 56d8eb336..56d8eb336 100644
--- a/sound/direct_sound_samples/cry_dustox.aif
+++ b/sound/direct_sound_samples/cries/dustox.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_eevee.aif b/sound/direct_sound_samples/cries/eevee.aif
index 8711a1470..8711a1470 100644
--- a/sound/direct_sound_samples/cry_eevee.aif
+++ b/sound/direct_sound_samples/cries/eevee.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_ekans.aif b/sound/direct_sound_samples/cries/ekans.aif
index 9eb396735..9eb396735 100644
--- a/sound/direct_sound_samples/cry_ekans.aif
+++ b/sound/direct_sound_samples/cries/ekans.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_electabuzz.aif b/sound/direct_sound_samples/cries/electabuzz.aif
index 5abdb49b7..5abdb49b7 100644
--- a/sound/direct_sound_samples/cry_electabuzz.aif
+++ b/sound/direct_sound_samples/cries/electabuzz.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_electrike.aif b/sound/direct_sound_samples/cries/electrike.aif
index 56c9666df..56c9666df 100644
--- a/sound/direct_sound_samples/cry_electrike.aif
+++ b/sound/direct_sound_samples/cries/electrike.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_electrode.aif b/sound/direct_sound_samples/cries/electrode.aif
index cbd7f0971..cbd7f0971 100644
--- a/sound/direct_sound_samples/cry_electrode.aif
+++ b/sound/direct_sound_samples/cries/electrode.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_elekid.aif b/sound/direct_sound_samples/cries/elekid.aif
index 839bdee17..839bdee17 100644
--- a/sound/direct_sound_samples/cry_elekid.aif
+++ b/sound/direct_sound_samples/cries/elekid.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_entei.aif b/sound/direct_sound_samples/cries/entei.aif
index 56a740207..56a740207 100644
--- a/sound/direct_sound_samples/cry_entei.aif
+++ b/sound/direct_sound_samples/cries/entei.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_espeon.aif b/sound/direct_sound_samples/cries/espeon.aif
index 53dc62f4d..53dc62f4d 100644
--- a/sound/direct_sound_samples/cry_espeon.aif
+++ b/sound/direct_sound_samples/cries/espeon.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_exeggcute.aif b/sound/direct_sound_samples/cries/exeggcute.aif
index 147912c2f..147912c2f 100644
--- a/sound/direct_sound_samples/cry_exeggcute.aif
+++ b/sound/direct_sound_samples/cries/exeggcute.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_exeggutor.aif b/sound/direct_sound_samples/cries/exeggutor.aif
index c0b9177bf..c0b9177bf 100644
--- a/sound/direct_sound_samples/cry_exeggutor.aif
+++ b/sound/direct_sound_samples/cries/exeggutor.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_exploud.aif b/sound/direct_sound_samples/cries/exploud.aif
index 5b80870cc..5b80870cc 100644
--- a/sound/direct_sound_samples/cry_exploud.aif
+++ b/sound/direct_sound_samples/cries/exploud.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_farfetchd.aif b/sound/direct_sound_samples/cries/farfetchd.aif
index f1db556dc..f1db556dc 100644
--- a/sound/direct_sound_samples/cry_farfetchd.aif
+++ b/sound/direct_sound_samples/cries/farfetchd.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_fearow.aif b/sound/direct_sound_samples/cries/fearow.aif
index 74a76f6d4..74a76f6d4 100644
--- a/sound/direct_sound_samples/cry_fearow.aif
+++ b/sound/direct_sound_samples/cries/fearow.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_feebas.aif b/sound/direct_sound_samples/cries/feebas.aif
index c386522f1..c386522f1 100644
--- a/sound/direct_sound_samples/cry_feebas.aif
+++ b/sound/direct_sound_samples/cries/feebas.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_feraligatr.aif b/sound/direct_sound_samples/cries/feraligatr.aif
index 9fcd93cff..9fcd93cff 100644
--- a/sound/direct_sound_samples/cry_feraligatr.aif
+++ b/sound/direct_sound_samples/cries/feraligatr.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_flaaffy.aif b/sound/direct_sound_samples/cries/flaaffy.aif
index 93dfacfaf..93dfacfaf 100644
--- a/sound/direct_sound_samples/cry_flaaffy.aif
+++ b/sound/direct_sound_samples/cries/flaaffy.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_flareon.aif b/sound/direct_sound_samples/cries/flareon.aif
index 58d28e60a..58d28e60a 100644
--- a/sound/direct_sound_samples/cry_flareon.aif
+++ b/sound/direct_sound_samples/cries/flareon.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_flygon.aif b/sound/direct_sound_samples/cries/flygon.aif
index c8c377016..c8c377016 100644
--- a/sound/direct_sound_samples/cry_flygon.aif
+++ b/sound/direct_sound_samples/cries/flygon.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_forretress.aif b/sound/direct_sound_samples/cries/forretress.aif
index 288dacbea..288dacbea 100644
--- a/sound/direct_sound_samples/cry_forretress.aif
+++ b/sound/direct_sound_samples/cries/forretress.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_furret.aif b/sound/direct_sound_samples/cries/furret.aif
index 6b4e9ce11..6b4e9ce11 100644
--- a/sound/direct_sound_samples/cry_furret.aif
+++ b/sound/direct_sound_samples/cries/furret.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_gardevoir.aif b/sound/direct_sound_samples/cries/gardevoir.aif
index a14780990..a14780990 100644
--- a/sound/direct_sound_samples/cry_gardevoir.aif
+++ b/sound/direct_sound_samples/cries/gardevoir.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_gastly.aif b/sound/direct_sound_samples/cries/gastly.aif
index 93cef851d..93cef851d 100644
--- a/sound/direct_sound_samples/cry_gastly.aif
+++ b/sound/direct_sound_samples/cries/gastly.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_gengar.aif b/sound/direct_sound_samples/cries/gengar.aif
index 379b5d37e..379b5d37e 100644
--- a/sound/direct_sound_samples/cry_gengar.aif
+++ b/sound/direct_sound_samples/cries/gengar.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_geodude.aif b/sound/direct_sound_samples/cries/geodude.aif
index 143b9031c..143b9031c 100644
--- a/sound/direct_sound_samples/cry_geodude.aif
+++ b/sound/direct_sound_samples/cries/geodude.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_girafarig.aif b/sound/direct_sound_samples/cries/girafarig.aif
index 1dd5f93e2..1dd5f93e2 100644
--- a/sound/direct_sound_samples/cry_girafarig.aif
+++ b/sound/direct_sound_samples/cries/girafarig.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_glalie.aif b/sound/direct_sound_samples/cries/glalie.aif
index e4e896547..e4e896547 100644
--- a/sound/direct_sound_samples/cry_glalie.aif
+++ b/sound/direct_sound_samples/cries/glalie.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_gligar.aif b/sound/direct_sound_samples/cries/gligar.aif
index 4050f08b0..4050f08b0 100644
--- a/sound/direct_sound_samples/cry_gligar.aif
+++ b/sound/direct_sound_samples/cries/gligar.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_gloom.aif b/sound/direct_sound_samples/cries/gloom.aif
index e930328ac..e930328ac 100644
--- a/sound/direct_sound_samples/cry_gloom.aif
+++ b/sound/direct_sound_samples/cries/gloom.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_golbat.aif b/sound/direct_sound_samples/cries/golbat.aif
index 11413df3a..11413df3a 100644
--- a/sound/direct_sound_samples/cry_golbat.aif
+++ b/sound/direct_sound_samples/cries/golbat.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_goldeen.aif b/sound/direct_sound_samples/cries/goldeen.aif
index 81fd1ecdf..81fd1ecdf 100644
--- a/sound/direct_sound_samples/cry_goldeen.aif
+++ b/sound/direct_sound_samples/cries/goldeen.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_golduck.aif b/sound/direct_sound_samples/cries/golduck.aif
index b6b71a7a4..b6b71a7a4 100644
--- a/sound/direct_sound_samples/cry_golduck.aif
+++ b/sound/direct_sound_samples/cries/golduck.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_golem.aif b/sound/direct_sound_samples/cries/golem.aif
index 0d2c4515e..0d2c4515e 100644
--- a/sound/direct_sound_samples/cry_golem.aif
+++ b/sound/direct_sound_samples/cries/golem.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_gorebyss.aif b/sound/direct_sound_samples/cries/gorebyss.aif
index b7605062c..b7605062c 100644
--- a/sound/direct_sound_samples/cry_gorebyss.aif
+++ b/sound/direct_sound_samples/cries/gorebyss.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_granbull.aif b/sound/direct_sound_samples/cries/granbull.aif
index 146b3bd0c..146b3bd0c 100644
--- a/sound/direct_sound_samples/cry_granbull.aif
+++ b/sound/direct_sound_samples/cries/granbull.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_graveler.aif b/sound/direct_sound_samples/cries/graveler.aif
index 773994228..773994228 100644
--- a/sound/direct_sound_samples/cry_graveler.aif
+++ b/sound/direct_sound_samples/cries/graveler.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_grimer.aif b/sound/direct_sound_samples/cries/grimer.aif
index 95eed1061..95eed1061 100644
--- a/sound/direct_sound_samples/cry_grimer.aif
+++ b/sound/direct_sound_samples/cries/grimer.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_groudon.aif b/sound/direct_sound_samples/cries/groudon.aif
index 62452b4d9..62452b4d9 100644
--- a/sound/direct_sound_samples/cry_groudon.aif
+++ b/sound/direct_sound_samples/cries/groudon.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_grovyle.aif b/sound/direct_sound_samples/cries/grovyle.aif
index 983bcfff3..983bcfff3 100644
--- a/sound/direct_sound_samples/cry_grovyle.aif
+++ b/sound/direct_sound_samples/cries/grovyle.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_growlithe.aif b/sound/direct_sound_samples/cries/growlithe.aif
index 134e29834..134e29834 100644
--- a/sound/direct_sound_samples/cry_growlithe.aif
+++ b/sound/direct_sound_samples/cries/growlithe.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_grumpig.aif b/sound/direct_sound_samples/cries/grumpig.aif
index 97c372076..97c372076 100644
--- a/sound/direct_sound_samples/cry_grumpig.aif
+++ b/sound/direct_sound_samples/cries/grumpig.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_gulpin.aif b/sound/direct_sound_samples/cries/gulpin.aif
index f3043b422..f3043b422 100644
--- a/sound/direct_sound_samples/cry_gulpin.aif
+++ b/sound/direct_sound_samples/cries/gulpin.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_gyarados.aif b/sound/direct_sound_samples/cries/gyarados.aif
index 238b6d721..238b6d721 100644
--- a/sound/direct_sound_samples/cry_gyarados.aif
+++ b/sound/direct_sound_samples/cries/gyarados.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_hariyama.aif b/sound/direct_sound_samples/cries/hariyama.aif
index 1ac1f3f7e..1ac1f3f7e 100644
--- a/sound/direct_sound_samples/cry_hariyama.aif
+++ b/sound/direct_sound_samples/cries/hariyama.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_haunter.aif b/sound/direct_sound_samples/cries/haunter.aif
index 60ec72171..60ec72171 100644
--- a/sound/direct_sound_samples/cry_haunter.aif
+++ b/sound/direct_sound_samples/cries/haunter.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_heracross.aif b/sound/direct_sound_samples/cries/heracross.aif
index a0734748f..a0734748f 100644
--- a/sound/direct_sound_samples/cry_heracross.aif
+++ b/sound/direct_sound_samples/cries/heracross.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_hitmonchan.aif b/sound/direct_sound_samples/cries/hitmonchan.aif
index 40479452c..40479452c 100644
--- a/sound/direct_sound_samples/cry_hitmonchan.aif
+++ b/sound/direct_sound_samples/cries/hitmonchan.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_hitmonlee.aif b/sound/direct_sound_samples/cries/hitmonlee.aif
index 3a4bcddca..3a4bcddca 100644
--- a/sound/direct_sound_samples/cry_hitmonlee.aif
+++ b/sound/direct_sound_samples/cries/hitmonlee.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_hitmontop.aif b/sound/direct_sound_samples/cries/hitmontop.aif
index 3fbee8041..3fbee8041 100644
--- a/sound/direct_sound_samples/cry_hitmontop.aif
+++ b/sound/direct_sound_samples/cries/hitmontop.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_ho_oh.aif b/sound/direct_sound_samples/cries/ho_oh.aif
index 52f8dd307..52f8dd307 100644
--- a/sound/direct_sound_samples/cry_ho_oh.aif
+++ b/sound/direct_sound_samples/cries/ho_oh.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_hoothoot.aif b/sound/direct_sound_samples/cries/hoothoot.aif
index 59e685dcc..59e685dcc 100644
--- a/sound/direct_sound_samples/cry_hoothoot.aif
+++ b/sound/direct_sound_samples/cries/hoothoot.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_hoppip.aif b/sound/direct_sound_samples/cries/hoppip.aif
index ea47877d0..ea47877d0 100644
--- a/sound/direct_sound_samples/cry_hoppip.aif
+++ b/sound/direct_sound_samples/cries/hoppip.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_horsea.aif b/sound/direct_sound_samples/cries/horsea.aif
index e41eff4b1..e41eff4b1 100644
--- a/sound/direct_sound_samples/cry_horsea.aif
+++ b/sound/direct_sound_samples/cries/horsea.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_houndoom.aif b/sound/direct_sound_samples/cries/houndoom.aif
index 6fec16d39..6fec16d39 100644
--- a/sound/direct_sound_samples/cry_houndoom.aif
+++ b/sound/direct_sound_samples/cries/houndoom.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_houndour.aif b/sound/direct_sound_samples/cries/houndour.aif
index 7431bbf29..7431bbf29 100644
--- a/sound/direct_sound_samples/cry_houndour.aif
+++ b/sound/direct_sound_samples/cries/houndour.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_huntail.aif b/sound/direct_sound_samples/cries/huntail.aif
index f1d3b29d9..f1d3b29d9 100644
--- a/sound/direct_sound_samples/cry_huntail.aif
+++ b/sound/direct_sound_samples/cries/huntail.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_hypno.aif b/sound/direct_sound_samples/cries/hypno.aif
index 32672a3c3..32672a3c3 100644
--- a/sound/direct_sound_samples/cry_hypno.aif
+++ b/sound/direct_sound_samples/cries/hypno.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_igglybuff.aif b/sound/direct_sound_samples/cries/igglybuff.aif
index 8de8394d5..8de8394d5 100644
--- a/sound/direct_sound_samples/cry_igglybuff.aif
+++ b/sound/direct_sound_samples/cries/igglybuff.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_illumise.aif b/sound/direct_sound_samples/cries/illumise.aif
index 75e03efc8..75e03efc8 100644
--- a/sound/direct_sound_samples/cry_illumise.aif
+++ b/sound/direct_sound_samples/cries/illumise.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_ivysaur.aif b/sound/direct_sound_samples/cries/ivysaur.aif
index ea474ff88..ea474ff88 100644
--- a/sound/direct_sound_samples/cry_ivysaur.aif
+++ b/sound/direct_sound_samples/cries/ivysaur.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_jigglypuff.aif b/sound/direct_sound_samples/cries/jigglypuff.aif
index 780424b4f..780424b4f 100644
--- a/sound/direct_sound_samples/cry_jigglypuff.aif
+++ b/sound/direct_sound_samples/cries/jigglypuff.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_jirachi.aif b/sound/direct_sound_samples/cries/jirachi.aif
index ea8a5c8ad..ea8a5c8ad 100644
--- a/sound/direct_sound_samples/cry_jirachi.aif
+++ b/sound/direct_sound_samples/cries/jirachi.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_jolteon.aif b/sound/direct_sound_samples/cries/jolteon.aif
index 013369158..013369158 100644
--- a/sound/direct_sound_samples/cry_jolteon.aif
+++ b/sound/direct_sound_samples/cries/jolteon.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_jumpluff.aif b/sound/direct_sound_samples/cries/jumpluff.aif
index 13b0fd315..13b0fd315 100644
--- a/sound/direct_sound_samples/cry_jumpluff.aif
+++ b/sound/direct_sound_samples/cries/jumpluff.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_jynx.aif b/sound/direct_sound_samples/cries/jynx.aif
index 7394a48a2..7394a48a2 100644
--- a/sound/direct_sound_samples/cry_jynx.aif
+++ b/sound/direct_sound_samples/cries/jynx.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_kabuto.aif b/sound/direct_sound_samples/cries/kabuto.aif
index 6ae9801b5..6ae9801b5 100644
--- a/sound/direct_sound_samples/cry_kabuto.aif
+++ b/sound/direct_sound_samples/cries/kabuto.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_kabutops.aif b/sound/direct_sound_samples/cries/kabutops.aif
index cb888bff9..cb888bff9 100644
--- a/sound/direct_sound_samples/cry_kabutops.aif
+++ b/sound/direct_sound_samples/cries/kabutops.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_kadabra.aif b/sound/direct_sound_samples/cries/kadabra.aif
index bfcc18031..bfcc18031 100644
--- a/sound/direct_sound_samples/cry_kadabra.aif
+++ b/sound/direct_sound_samples/cries/kadabra.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_kakuna.aif b/sound/direct_sound_samples/cries/kakuna.aif
index 7c4e9d7a8..7c4e9d7a8 100644
--- a/sound/direct_sound_samples/cry_kakuna.aif
+++ b/sound/direct_sound_samples/cries/kakuna.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_kangaskhan.aif b/sound/direct_sound_samples/cries/kangaskhan.aif
index 643e81eb7..643e81eb7 100644
--- a/sound/direct_sound_samples/cry_kangaskhan.aif
+++ b/sound/direct_sound_samples/cries/kangaskhan.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_kecleon.aif b/sound/direct_sound_samples/cries/kecleon.aif
index f27ae1832..f27ae1832 100644
--- a/sound/direct_sound_samples/cry_kecleon.aif
+++ b/sound/direct_sound_samples/cries/kecleon.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_kingdra.aif b/sound/direct_sound_samples/cries/kingdra.aif
index ade230c82..ade230c82 100644
--- a/sound/direct_sound_samples/cry_kingdra.aif
+++ b/sound/direct_sound_samples/cries/kingdra.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_kingler.aif b/sound/direct_sound_samples/cries/kingler.aif
index a1d845f45..a1d845f45 100644
--- a/sound/direct_sound_samples/cry_kingler.aif
+++ b/sound/direct_sound_samples/cries/kingler.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_kirlia.aif b/sound/direct_sound_samples/cries/kirlia.aif
index 692e03e5f..692e03e5f 100644
--- a/sound/direct_sound_samples/cry_kirlia.aif
+++ b/sound/direct_sound_samples/cries/kirlia.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_koffing.aif b/sound/direct_sound_samples/cries/koffing.aif
index 7ca9de088..7ca9de088 100644
--- a/sound/direct_sound_samples/cry_koffing.aif
+++ b/sound/direct_sound_samples/cries/koffing.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_krabby.aif b/sound/direct_sound_samples/cries/krabby.aif
index 6b7692f21..6b7692f21 100644
--- a/sound/direct_sound_samples/cry_krabby.aif
+++ b/sound/direct_sound_samples/cries/krabby.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_kyogre.aif b/sound/direct_sound_samples/cries/kyogre.aif
index 290948319..290948319 100644
--- a/sound/direct_sound_samples/cry_kyogre.aif
+++ b/sound/direct_sound_samples/cries/kyogre.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_lairon.aif b/sound/direct_sound_samples/cries/lairon.aif
index b487165bf..b487165bf 100644
--- a/sound/direct_sound_samples/cry_lairon.aif
+++ b/sound/direct_sound_samples/cries/lairon.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_lanturn.aif b/sound/direct_sound_samples/cries/lanturn.aif
index dfeac1fbd..dfeac1fbd 100644
--- a/sound/direct_sound_samples/cry_lanturn.aif
+++ b/sound/direct_sound_samples/cries/lanturn.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_lapras.aif b/sound/direct_sound_samples/cries/lapras.aif
index 61de32408..61de32408 100644
--- a/sound/direct_sound_samples/cry_lapras.aif
+++ b/sound/direct_sound_samples/cries/lapras.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_larvitar.aif b/sound/direct_sound_samples/cries/larvitar.aif
index 1ab0e1d5f..1ab0e1d5f 100644
--- a/sound/direct_sound_samples/cry_larvitar.aif
+++ b/sound/direct_sound_samples/cries/larvitar.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_latias.aif b/sound/direct_sound_samples/cries/latias.aif
index 46f7235f3..46f7235f3 100644
--- a/sound/direct_sound_samples/cry_latias.aif
+++ b/sound/direct_sound_samples/cries/latias.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_latios.aif b/sound/direct_sound_samples/cries/latios.aif
index b8ace2a30..b8ace2a30 100644
--- a/sound/direct_sound_samples/cry_latios.aif
+++ b/sound/direct_sound_samples/cries/latios.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_ledian.aif b/sound/direct_sound_samples/cries/ledian.aif
index baefb5fa3..baefb5fa3 100644
--- a/sound/direct_sound_samples/cry_ledian.aif
+++ b/sound/direct_sound_samples/cries/ledian.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_ledyba.aif b/sound/direct_sound_samples/cries/ledyba.aif
index 4f26859a7..4f26859a7 100644
--- a/sound/direct_sound_samples/cry_ledyba.aif
+++ b/sound/direct_sound_samples/cries/ledyba.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_lickitung.aif b/sound/direct_sound_samples/cries/lickitung.aif
index e469450a1..e469450a1 100644
--- a/sound/direct_sound_samples/cry_lickitung.aif
+++ b/sound/direct_sound_samples/cries/lickitung.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_lileep.aif b/sound/direct_sound_samples/cries/lileep.aif
index ed8258eb7..ed8258eb7 100644
--- a/sound/direct_sound_samples/cry_lileep.aif
+++ b/sound/direct_sound_samples/cries/lileep.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_linoone.aif b/sound/direct_sound_samples/cries/linoone.aif
index 4e5e7d3b5..4e5e7d3b5 100644
--- a/sound/direct_sound_samples/cry_linoone.aif
+++ b/sound/direct_sound_samples/cries/linoone.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_lombre.aif b/sound/direct_sound_samples/cries/lombre.aif
index abafe4321..abafe4321 100644
--- a/sound/direct_sound_samples/cry_lombre.aif
+++ b/sound/direct_sound_samples/cries/lombre.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_lotad.aif b/sound/direct_sound_samples/cries/lotad.aif
index 2596f4390..2596f4390 100644
--- a/sound/direct_sound_samples/cry_lotad.aif
+++ b/sound/direct_sound_samples/cries/lotad.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_loudred.aif b/sound/direct_sound_samples/cries/loudred.aif
index fed7ebec8..fed7ebec8 100644
--- a/sound/direct_sound_samples/cry_loudred.aif
+++ b/sound/direct_sound_samples/cries/loudred.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_ludicolo.aif b/sound/direct_sound_samples/cries/ludicolo.aif
index 7cf670f38..7cf670f38 100644
--- a/sound/direct_sound_samples/cry_ludicolo.aif
+++ b/sound/direct_sound_samples/cries/ludicolo.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_lugia.aif b/sound/direct_sound_samples/cries/lugia.aif
index 45890a2fc..45890a2fc 100644
--- a/sound/direct_sound_samples/cry_lugia.aif
+++ b/sound/direct_sound_samples/cries/lugia.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_lunatone.aif b/sound/direct_sound_samples/cries/lunatone.aif
index 42cbc5e3c..42cbc5e3c 100644
--- a/sound/direct_sound_samples/cry_lunatone.aif
+++ b/sound/direct_sound_samples/cries/lunatone.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_luvdisc.aif b/sound/direct_sound_samples/cries/luvdisc.aif
index 3cc0cc744..3cc0cc744 100644
--- a/sound/direct_sound_samples/cry_luvdisc.aif
+++ b/sound/direct_sound_samples/cries/luvdisc.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_machamp.aif b/sound/direct_sound_samples/cries/machamp.aif
index ddeaf22c8..ddeaf22c8 100644
--- a/sound/direct_sound_samples/cry_machamp.aif
+++ b/sound/direct_sound_samples/cries/machamp.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_machoke.aif b/sound/direct_sound_samples/cries/machoke.aif
index 97065ee09..97065ee09 100644
--- a/sound/direct_sound_samples/cry_machoke.aif
+++ b/sound/direct_sound_samples/cries/machoke.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_machop.aif b/sound/direct_sound_samples/cries/machop.aif
index d92419e84..d92419e84 100644
--- a/sound/direct_sound_samples/cry_machop.aif
+++ b/sound/direct_sound_samples/cries/machop.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_magby.aif b/sound/direct_sound_samples/cries/magby.aif
index 12f3dc889..12f3dc889 100644
--- a/sound/direct_sound_samples/cry_magby.aif
+++ b/sound/direct_sound_samples/cries/magby.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_magcargo.aif b/sound/direct_sound_samples/cries/magcargo.aif
index bef0351c0..bef0351c0 100644
--- a/sound/direct_sound_samples/cry_magcargo.aif
+++ b/sound/direct_sound_samples/cries/magcargo.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_magikarp.aif b/sound/direct_sound_samples/cries/magikarp.aif
index f4f9219c5..f4f9219c5 100644
--- a/sound/direct_sound_samples/cry_magikarp.aif
+++ b/sound/direct_sound_samples/cries/magikarp.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_magmar.aif b/sound/direct_sound_samples/cries/magmar.aif
index b79c8b9a1..b79c8b9a1 100644
--- a/sound/direct_sound_samples/cry_magmar.aif
+++ b/sound/direct_sound_samples/cries/magmar.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_magnemite.aif b/sound/direct_sound_samples/cries/magnemite.aif
index ebb9103d9..ebb9103d9 100644
--- a/sound/direct_sound_samples/cry_magnemite.aif
+++ b/sound/direct_sound_samples/cries/magnemite.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_magneton.aif b/sound/direct_sound_samples/cries/magneton.aif
index 53083ac62..53083ac62 100644
--- a/sound/direct_sound_samples/cry_magneton.aif
+++ b/sound/direct_sound_samples/cries/magneton.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_makuhita.aif b/sound/direct_sound_samples/cries/makuhita.aif
index 38d7f4b44..38d7f4b44 100644
--- a/sound/direct_sound_samples/cry_makuhita.aif
+++ b/sound/direct_sound_samples/cries/makuhita.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_manectric.aif b/sound/direct_sound_samples/cries/manectric.aif
index 18a8f4666..18a8f4666 100644
--- a/sound/direct_sound_samples/cry_manectric.aif
+++ b/sound/direct_sound_samples/cries/manectric.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_mankey.aif b/sound/direct_sound_samples/cries/mankey.aif
index dda929d4c..dda929d4c 100644
--- a/sound/direct_sound_samples/cry_mankey.aif
+++ b/sound/direct_sound_samples/cries/mankey.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_mantine.aif b/sound/direct_sound_samples/cries/mantine.aif
index d1840aafa..d1840aafa 100644
--- a/sound/direct_sound_samples/cry_mantine.aif
+++ b/sound/direct_sound_samples/cries/mantine.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_mareep.aif b/sound/direct_sound_samples/cries/mareep.aif
index 2615b9def..2615b9def 100644
--- a/sound/direct_sound_samples/cry_mareep.aif
+++ b/sound/direct_sound_samples/cries/mareep.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_marill.aif b/sound/direct_sound_samples/cries/marill.aif
index 48d936e7d..48d936e7d 100644
--- a/sound/direct_sound_samples/cry_marill.aif
+++ b/sound/direct_sound_samples/cries/marill.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_marowak.aif b/sound/direct_sound_samples/cries/marowak.aif
index 279381bb5..279381bb5 100644
--- a/sound/direct_sound_samples/cry_marowak.aif
+++ b/sound/direct_sound_samples/cries/marowak.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_marshtomp.aif b/sound/direct_sound_samples/cries/marshtomp.aif
index c0106ff6c..c0106ff6c 100644
--- a/sound/direct_sound_samples/cry_marshtomp.aif
+++ b/sound/direct_sound_samples/cries/marshtomp.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_masquerain.aif b/sound/direct_sound_samples/cries/masquerain.aif
index 107bed2f7..107bed2f7 100644
--- a/sound/direct_sound_samples/cry_masquerain.aif
+++ b/sound/direct_sound_samples/cries/masquerain.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_mawile.aif b/sound/direct_sound_samples/cries/mawile.aif
index 81b252b57..81b252b57 100644
--- a/sound/direct_sound_samples/cry_mawile.aif
+++ b/sound/direct_sound_samples/cries/mawile.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_medicham.aif b/sound/direct_sound_samples/cries/medicham.aif
index dc85dd3b5..dc85dd3b5 100644
--- a/sound/direct_sound_samples/cry_medicham.aif
+++ b/sound/direct_sound_samples/cries/medicham.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_meditite.aif b/sound/direct_sound_samples/cries/meditite.aif
index 8ac680f79..8ac680f79 100644
--- a/sound/direct_sound_samples/cry_meditite.aif
+++ b/sound/direct_sound_samples/cries/meditite.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_meganium.aif b/sound/direct_sound_samples/cries/meganium.aif
index ea1e1aa51..ea1e1aa51 100644
--- a/sound/direct_sound_samples/cry_meganium.aif
+++ b/sound/direct_sound_samples/cries/meganium.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_meowth.aif b/sound/direct_sound_samples/cries/meowth.aif
index aaf3825d5..aaf3825d5 100644
--- a/sound/direct_sound_samples/cry_meowth.aif
+++ b/sound/direct_sound_samples/cries/meowth.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_metagross.aif b/sound/direct_sound_samples/cries/metagross.aif
index b96e6647c..b96e6647c 100644
--- a/sound/direct_sound_samples/cry_metagross.aif
+++ b/sound/direct_sound_samples/cries/metagross.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_metang.aif b/sound/direct_sound_samples/cries/metang.aif
index da544ce4d..da544ce4d 100644
--- a/sound/direct_sound_samples/cry_metang.aif
+++ b/sound/direct_sound_samples/cries/metang.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_metapod.aif b/sound/direct_sound_samples/cries/metapod.aif
index ddba3ed44..ddba3ed44 100644
--- a/sound/direct_sound_samples/cry_metapod.aif
+++ b/sound/direct_sound_samples/cries/metapod.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_mew.aif b/sound/direct_sound_samples/cries/mew.aif
index 2651b96ca..2651b96ca 100644
--- a/sound/direct_sound_samples/cry_mew.aif
+++ b/sound/direct_sound_samples/cries/mew.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_mewtwo.aif b/sound/direct_sound_samples/cries/mewtwo.aif
index 8e1e6c7f1..8e1e6c7f1 100644
--- a/sound/direct_sound_samples/cry_mewtwo.aif
+++ b/sound/direct_sound_samples/cries/mewtwo.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_mightyena.aif b/sound/direct_sound_samples/cries/mightyena.aif
index 53a645edc..53a645edc 100644
--- a/sound/direct_sound_samples/cry_mightyena.aif
+++ b/sound/direct_sound_samples/cries/mightyena.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_milotic.aif b/sound/direct_sound_samples/cries/milotic.aif
index 93a14161b..93a14161b 100644
--- a/sound/direct_sound_samples/cry_milotic.aif
+++ b/sound/direct_sound_samples/cries/milotic.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_miltank.aif b/sound/direct_sound_samples/cries/miltank.aif
index ad8a41a45..ad8a41a45 100644
--- a/sound/direct_sound_samples/cry_miltank.aif
+++ b/sound/direct_sound_samples/cries/miltank.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_minun.aif b/sound/direct_sound_samples/cries/minun.aif
index a55aa5631..a55aa5631 100644
--- a/sound/direct_sound_samples/cry_minun.aif
+++ b/sound/direct_sound_samples/cries/minun.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_misdreavus.aif b/sound/direct_sound_samples/cries/misdreavus.aif
index 39a09f4d0..39a09f4d0 100644
--- a/sound/direct_sound_samples/cry_misdreavus.aif
+++ b/sound/direct_sound_samples/cries/misdreavus.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_moltres.aif b/sound/direct_sound_samples/cries/moltres.aif
index 2e038a3d7..2e038a3d7 100644
--- a/sound/direct_sound_samples/cry_moltres.aif
+++ b/sound/direct_sound_samples/cries/moltres.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_mr_mime.aif b/sound/direct_sound_samples/cries/mr_mime.aif
index ff870dbc4..ff870dbc4 100644
--- a/sound/direct_sound_samples/cry_mr_mime.aif
+++ b/sound/direct_sound_samples/cries/mr_mime.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_mudkip.aif b/sound/direct_sound_samples/cries/mudkip.aif
index e8fa5c212..e8fa5c212 100644
--- a/sound/direct_sound_samples/cry_mudkip.aif
+++ b/sound/direct_sound_samples/cries/mudkip.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_muk.aif b/sound/direct_sound_samples/cries/muk.aif
index f61ff4075..f61ff4075 100644
--- a/sound/direct_sound_samples/cry_muk.aif
+++ b/sound/direct_sound_samples/cries/muk.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_murkrow.aif b/sound/direct_sound_samples/cries/murkrow.aif
index 4beddff1e..4beddff1e 100644
--- a/sound/direct_sound_samples/cry_murkrow.aif
+++ b/sound/direct_sound_samples/cries/murkrow.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_natu.aif b/sound/direct_sound_samples/cries/natu.aif
index e6e38d5cc..e6e38d5cc 100644
--- a/sound/direct_sound_samples/cry_natu.aif
+++ b/sound/direct_sound_samples/cries/natu.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_nidoking.aif b/sound/direct_sound_samples/cries/nidoking.aif
index a0c86f9ab..a0c86f9ab 100644
--- a/sound/direct_sound_samples/cry_nidoking.aif
+++ b/sound/direct_sound_samples/cries/nidoking.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_nidoqueen.aif b/sound/direct_sound_samples/cries/nidoqueen.aif
index 6c8f5254b..6c8f5254b 100644
--- a/sound/direct_sound_samples/cry_nidoqueen.aif
+++ b/sound/direct_sound_samples/cries/nidoqueen.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_nidoran_f.aif b/sound/direct_sound_samples/cries/nidoran_f.aif
index b7c8a5317..b7c8a5317 100644
--- a/sound/direct_sound_samples/cry_nidoran_f.aif
+++ b/sound/direct_sound_samples/cries/nidoran_f.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_nidoran_m.aif b/sound/direct_sound_samples/cries/nidoran_m.aif
index 08fc81c8b..08fc81c8b 100644
--- a/sound/direct_sound_samples/cry_nidoran_m.aif
+++ b/sound/direct_sound_samples/cries/nidoran_m.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_nidorina.aif b/sound/direct_sound_samples/cries/nidorina.aif
index 91e293a50..91e293a50 100644
--- a/sound/direct_sound_samples/cry_nidorina.aif
+++ b/sound/direct_sound_samples/cries/nidorina.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_nidorino.aif b/sound/direct_sound_samples/cries/nidorino.aif
index 959351363..959351363 100644
--- a/sound/direct_sound_samples/cry_nidorino.aif
+++ b/sound/direct_sound_samples/cries/nidorino.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_nincada.aif b/sound/direct_sound_samples/cries/nincada.aif
index 5f96bda50..5f96bda50 100644
--- a/sound/direct_sound_samples/cry_nincada.aif
+++ b/sound/direct_sound_samples/cries/nincada.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_ninetales.aif b/sound/direct_sound_samples/cries/ninetales.aif
index 70c8cf528..70c8cf528 100644
--- a/sound/direct_sound_samples/cry_ninetales.aif
+++ b/sound/direct_sound_samples/cries/ninetales.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_ninjask.aif b/sound/direct_sound_samples/cries/ninjask.aif
index a6f07e8d3..a6f07e8d3 100644
--- a/sound/direct_sound_samples/cry_ninjask.aif
+++ b/sound/direct_sound_samples/cries/ninjask.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_noctowl.aif b/sound/direct_sound_samples/cries/noctowl.aif
index fe2e63d45..fe2e63d45 100644
--- a/sound/direct_sound_samples/cry_noctowl.aif
+++ b/sound/direct_sound_samples/cries/noctowl.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_nosepass.aif b/sound/direct_sound_samples/cries/nosepass.aif
index be65ba082..be65ba082 100644
--- a/sound/direct_sound_samples/cry_nosepass.aif
+++ b/sound/direct_sound_samples/cries/nosepass.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_numel.aif b/sound/direct_sound_samples/cries/numel.aif
index 55cce5f2c..55cce5f2c 100644
--- a/sound/direct_sound_samples/cry_numel.aif
+++ b/sound/direct_sound_samples/cries/numel.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_nuzleaf.aif b/sound/direct_sound_samples/cries/nuzleaf.aif
index d668f3fd3..d668f3fd3 100644
--- a/sound/direct_sound_samples/cry_nuzleaf.aif
+++ b/sound/direct_sound_samples/cries/nuzleaf.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_octillery.aif b/sound/direct_sound_samples/cries/octillery.aif
index 75ee28ceb..75ee28ceb 100644
--- a/sound/direct_sound_samples/cry_octillery.aif
+++ b/sound/direct_sound_samples/cries/octillery.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_oddish.aif b/sound/direct_sound_samples/cries/oddish.aif
index 6909a8dad..6909a8dad 100644
--- a/sound/direct_sound_samples/cry_oddish.aif
+++ b/sound/direct_sound_samples/cries/oddish.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_omanyte.aif b/sound/direct_sound_samples/cries/omanyte.aif
index 15ec2d1ef..15ec2d1ef 100644
--- a/sound/direct_sound_samples/cry_omanyte.aif
+++ b/sound/direct_sound_samples/cries/omanyte.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_omastar.aif b/sound/direct_sound_samples/cries/omastar.aif
index e67d5d7fc..e67d5d7fc 100644
--- a/sound/direct_sound_samples/cry_omastar.aif
+++ b/sound/direct_sound_samples/cries/omastar.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_onix.aif b/sound/direct_sound_samples/cries/onix.aif
index aa8a16505..aa8a16505 100644
--- a/sound/direct_sound_samples/cry_onix.aif
+++ b/sound/direct_sound_samples/cries/onix.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_paras.aif b/sound/direct_sound_samples/cries/paras.aif
index f9d69c21c..f9d69c21c 100644
--- a/sound/direct_sound_samples/cry_paras.aif
+++ b/sound/direct_sound_samples/cries/paras.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_parasect.aif b/sound/direct_sound_samples/cries/parasect.aif
index d6d9433e9..d6d9433e9 100644
--- a/sound/direct_sound_samples/cry_parasect.aif
+++ b/sound/direct_sound_samples/cries/parasect.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_pelipper.aif b/sound/direct_sound_samples/cries/pelipper.aif
index 26718f848..26718f848 100644
--- a/sound/direct_sound_samples/cry_pelipper.aif
+++ b/sound/direct_sound_samples/cries/pelipper.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_persian.aif b/sound/direct_sound_samples/cries/persian.aif
index 40b3a2c56..40b3a2c56 100644
--- a/sound/direct_sound_samples/cry_persian.aif
+++ b/sound/direct_sound_samples/cries/persian.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_phanpy.aif b/sound/direct_sound_samples/cries/phanpy.aif
index 2fcab3c82..2fcab3c82 100644
--- a/sound/direct_sound_samples/cry_phanpy.aif
+++ b/sound/direct_sound_samples/cries/phanpy.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_pichu.aif b/sound/direct_sound_samples/cries/pichu.aif
index de47bbab8..de47bbab8 100644
--- a/sound/direct_sound_samples/cry_pichu.aif
+++ b/sound/direct_sound_samples/cries/pichu.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_pidgeot.aif b/sound/direct_sound_samples/cries/pidgeot.aif
index af400cdc6..af400cdc6 100644
--- a/sound/direct_sound_samples/cry_pidgeot.aif
+++ b/sound/direct_sound_samples/cries/pidgeot.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_pidgeotto.aif b/sound/direct_sound_samples/cries/pidgeotto.aif
index 7c71c8f3e..7c71c8f3e 100644
--- a/sound/direct_sound_samples/cry_pidgeotto.aif
+++ b/sound/direct_sound_samples/cries/pidgeotto.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_pidgey.aif b/sound/direct_sound_samples/cries/pidgey.aif
index b9c3a5d2a..b9c3a5d2a 100644
--- a/sound/direct_sound_samples/cry_pidgey.aif
+++ b/sound/direct_sound_samples/cries/pidgey.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_pikachu.aif b/sound/direct_sound_samples/cries/pikachu.aif
index 690bf5e1d..690bf5e1d 100644
--- a/sound/direct_sound_samples/cry_pikachu.aif
+++ b/sound/direct_sound_samples/cries/pikachu.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_piloswine.aif b/sound/direct_sound_samples/cries/piloswine.aif
index b1f34d3b5..b1f34d3b5 100644
--- a/sound/direct_sound_samples/cry_piloswine.aif
+++ b/sound/direct_sound_samples/cries/piloswine.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_pineco.aif b/sound/direct_sound_samples/cries/pineco.aif
index 80292bda0..80292bda0 100644
--- a/sound/direct_sound_samples/cry_pineco.aif
+++ b/sound/direct_sound_samples/cries/pineco.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_pinsir.aif b/sound/direct_sound_samples/cries/pinsir.aif
index cf27a11de..cf27a11de 100644
--- a/sound/direct_sound_samples/cry_pinsir.aif
+++ b/sound/direct_sound_samples/cries/pinsir.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_plusle.aif b/sound/direct_sound_samples/cries/plusle.aif
index d68984263..d68984263 100644
--- a/sound/direct_sound_samples/cry_plusle.aif
+++ b/sound/direct_sound_samples/cries/plusle.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_politoed.aif b/sound/direct_sound_samples/cries/politoed.aif
index 38b1883b4..38b1883b4 100644
--- a/sound/direct_sound_samples/cry_politoed.aif
+++ b/sound/direct_sound_samples/cries/politoed.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_poliwag.aif b/sound/direct_sound_samples/cries/poliwag.aif
index 8467f0540..8467f0540 100644
--- a/sound/direct_sound_samples/cry_poliwag.aif
+++ b/sound/direct_sound_samples/cries/poliwag.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_poliwhirl.aif b/sound/direct_sound_samples/cries/poliwhirl.aif
index f0851c693..f0851c693 100644
--- a/sound/direct_sound_samples/cry_poliwhirl.aif
+++ b/sound/direct_sound_samples/cries/poliwhirl.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_poliwrath.aif b/sound/direct_sound_samples/cries/poliwrath.aif
index 8d19f1d86..8d19f1d86 100644
--- a/sound/direct_sound_samples/cry_poliwrath.aif
+++ b/sound/direct_sound_samples/cries/poliwrath.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_ponyta.aif b/sound/direct_sound_samples/cries/ponyta.aif
index 46feb123d..46feb123d 100644
--- a/sound/direct_sound_samples/cry_ponyta.aif
+++ b/sound/direct_sound_samples/cries/ponyta.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_poochyena.aif b/sound/direct_sound_samples/cries/poochyena.aif
index 3b464ce13..3b464ce13 100644
--- a/sound/direct_sound_samples/cry_poochyena.aif
+++ b/sound/direct_sound_samples/cries/poochyena.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_porygon.aif b/sound/direct_sound_samples/cries/porygon.aif
index ced70b379..ced70b379 100644
--- a/sound/direct_sound_samples/cry_porygon.aif
+++ b/sound/direct_sound_samples/cries/porygon.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_porygon2.aif b/sound/direct_sound_samples/cries/porygon2.aif
index c08a3caaf..c08a3caaf 100644
--- a/sound/direct_sound_samples/cry_porygon2.aif
+++ b/sound/direct_sound_samples/cries/porygon2.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_primeape.aif b/sound/direct_sound_samples/cries/primeape.aif
index a868b3120..a868b3120 100644
--- a/sound/direct_sound_samples/cry_primeape.aif
+++ b/sound/direct_sound_samples/cries/primeape.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_psyduck.aif b/sound/direct_sound_samples/cries/psyduck.aif
index d2d0612f2..d2d0612f2 100644
--- a/sound/direct_sound_samples/cry_psyduck.aif
+++ b/sound/direct_sound_samples/cries/psyduck.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_pupitar.aif b/sound/direct_sound_samples/cries/pupitar.aif
index 7386636ce..7386636ce 100644
--- a/sound/direct_sound_samples/cry_pupitar.aif
+++ b/sound/direct_sound_samples/cries/pupitar.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_quagsire.aif b/sound/direct_sound_samples/cries/quagsire.aif
index 1953d0e42..1953d0e42 100644
--- a/sound/direct_sound_samples/cry_quagsire.aif
+++ b/sound/direct_sound_samples/cries/quagsire.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_quilava.aif b/sound/direct_sound_samples/cries/quilava.aif
index efe873229..efe873229 100644
--- a/sound/direct_sound_samples/cry_quilava.aif
+++ b/sound/direct_sound_samples/cries/quilava.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_qwilfish.aif b/sound/direct_sound_samples/cries/qwilfish.aif
index 268c5c89d..268c5c89d 100644
--- a/sound/direct_sound_samples/cry_qwilfish.aif
+++ b/sound/direct_sound_samples/cries/qwilfish.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_raichu.aif b/sound/direct_sound_samples/cries/raichu.aif
index e59ffbad4..e59ffbad4 100644
--- a/sound/direct_sound_samples/cry_raichu.aif
+++ b/sound/direct_sound_samples/cries/raichu.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_raikou.aif b/sound/direct_sound_samples/cries/raikou.aif
index a57a2365c..a57a2365c 100644
--- a/sound/direct_sound_samples/cry_raikou.aif
+++ b/sound/direct_sound_samples/cries/raikou.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_ralts.aif b/sound/direct_sound_samples/cries/ralts.aif
index 0baef5760..0baef5760 100644
--- a/sound/direct_sound_samples/cry_ralts.aif
+++ b/sound/direct_sound_samples/cries/ralts.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_rapidash.aif b/sound/direct_sound_samples/cries/rapidash.aif
index 920f510e4..920f510e4 100644
--- a/sound/direct_sound_samples/cry_rapidash.aif
+++ b/sound/direct_sound_samples/cries/rapidash.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_raticate.aif b/sound/direct_sound_samples/cries/raticate.aif
index 01601cab5..01601cab5 100644
--- a/sound/direct_sound_samples/cry_raticate.aif
+++ b/sound/direct_sound_samples/cries/raticate.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_rattata.aif b/sound/direct_sound_samples/cries/rattata.aif
index cb0e1f422..cb0e1f422 100644
--- a/sound/direct_sound_samples/cry_rattata.aif
+++ b/sound/direct_sound_samples/cries/rattata.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_rayquaza.aif b/sound/direct_sound_samples/cries/rayquaza.aif
index 6115e11d8..6115e11d8 100644
--- a/sound/direct_sound_samples/cry_rayquaza.aif
+++ b/sound/direct_sound_samples/cries/rayquaza.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_regice.aif b/sound/direct_sound_samples/cries/regice.aif
index 6fa23dd73..6fa23dd73 100644
--- a/sound/direct_sound_samples/cry_regice.aif
+++ b/sound/direct_sound_samples/cries/regice.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_regirock.aif b/sound/direct_sound_samples/cries/regirock.aif
index ab2a47eb8..ab2a47eb8 100644
--- a/sound/direct_sound_samples/cry_regirock.aif
+++ b/sound/direct_sound_samples/cries/regirock.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_registeel.aif b/sound/direct_sound_samples/cries/registeel.aif
index f5374e5f0..f5374e5f0 100644
--- a/sound/direct_sound_samples/cry_registeel.aif
+++ b/sound/direct_sound_samples/cries/registeel.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_relicanth.aif b/sound/direct_sound_samples/cries/relicanth.aif
index 60af9cf4e..60af9cf4e 100644
--- a/sound/direct_sound_samples/cry_relicanth.aif
+++ b/sound/direct_sound_samples/cries/relicanth.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_remoraid.aif b/sound/direct_sound_samples/cries/remoraid.aif
index 16d3f1d65..16d3f1d65 100644
--- a/sound/direct_sound_samples/cry_remoraid.aif
+++ b/sound/direct_sound_samples/cries/remoraid.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_rhydon.aif b/sound/direct_sound_samples/cries/rhydon.aif
index cfa709ee9..cfa709ee9 100644
--- a/sound/direct_sound_samples/cry_rhydon.aif
+++ b/sound/direct_sound_samples/cries/rhydon.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_rhyhorn.aif b/sound/direct_sound_samples/cries/rhyhorn.aif
index 47f344ba2..47f344ba2 100644
--- a/sound/direct_sound_samples/cry_rhyhorn.aif
+++ b/sound/direct_sound_samples/cries/rhyhorn.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_roselia.aif b/sound/direct_sound_samples/cries/roselia.aif
index 50b60b77b..50b60b77b 100644
--- a/sound/direct_sound_samples/cry_roselia.aif
+++ b/sound/direct_sound_samples/cries/roselia.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_sableye.aif b/sound/direct_sound_samples/cries/sableye.aif
index 1b3a9be30..1b3a9be30 100644
--- a/sound/direct_sound_samples/cry_sableye.aif
+++ b/sound/direct_sound_samples/cries/sableye.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_salamence.aif b/sound/direct_sound_samples/cries/salamence.aif
index d2957809c..d2957809c 100644
--- a/sound/direct_sound_samples/cry_salamence.aif
+++ b/sound/direct_sound_samples/cries/salamence.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_sandshrew.aif b/sound/direct_sound_samples/cries/sandshrew.aif
index 6879be11d..6879be11d 100644
--- a/sound/direct_sound_samples/cry_sandshrew.aif
+++ b/sound/direct_sound_samples/cries/sandshrew.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_sandslash.aif b/sound/direct_sound_samples/cries/sandslash.aif
index ee4a458ed..ee4a458ed 100644
--- a/sound/direct_sound_samples/cry_sandslash.aif
+++ b/sound/direct_sound_samples/cries/sandslash.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_sceptile.aif b/sound/direct_sound_samples/cries/sceptile.aif
index 7252cb85f..7252cb85f 100644
--- a/sound/direct_sound_samples/cry_sceptile.aif
+++ b/sound/direct_sound_samples/cries/sceptile.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_scizor.aif b/sound/direct_sound_samples/cries/scizor.aif
index f1f7832ce..f1f7832ce 100644
--- a/sound/direct_sound_samples/cry_scizor.aif
+++ b/sound/direct_sound_samples/cries/scizor.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_scyther.aif b/sound/direct_sound_samples/cries/scyther.aif
index 2b8cbc104..2b8cbc104 100644
--- a/sound/direct_sound_samples/cry_scyther.aif
+++ b/sound/direct_sound_samples/cries/scyther.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_seadra.aif b/sound/direct_sound_samples/cries/seadra.aif
index 2f60cce4a..2f60cce4a 100644
--- a/sound/direct_sound_samples/cry_seadra.aif
+++ b/sound/direct_sound_samples/cries/seadra.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_seaking.aif b/sound/direct_sound_samples/cries/seaking.aif
index e4fc7e70d..e4fc7e70d 100644
--- a/sound/direct_sound_samples/cry_seaking.aif
+++ b/sound/direct_sound_samples/cries/seaking.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_sealeo.aif b/sound/direct_sound_samples/cries/sealeo.aif
index d9ea50026..d9ea50026 100644
--- a/sound/direct_sound_samples/cry_sealeo.aif
+++ b/sound/direct_sound_samples/cries/sealeo.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_seedot.aif b/sound/direct_sound_samples/cries/seedot.aif
index c37b769f8..c37b769f8 100644
--- a/sound/direct_sound_samples/cry_seedot.aif
+++ b/sound/direct_sound_samples/cries/seedot.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_seel.aif b/sound/direct_sound_samples/cries/seel.aif
index 84c4a0a94..84c4a0a94 100644
--- a/sound/direct_sound_samples/cry_seel.aif
+++ b/sound/direct_sound_samples/cries/seel.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_sentret.aif b/sound/direct_sound_samples/cries/sentret.aif
index 4aed7cd70..4aed7cd70 100644
--- a/sound/direct_sound_samples/cry_sentret.aif
+++ b/sound/direct_sound_samples/cries/sentret.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_seviper.aif b/sound/direct_sound_samples/cries/seviper.aif
index 6a15dd6e2..6a15dd6e2 100644
--- a/sound/direct_sound_samples/cry_seviper.aif
+++ b/sound/direct_sound_samples/cries/seviper.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_sharpedo.aif b/sound/direct_sound_samples/cries/sharpedo.aif
index 1b02b56ce..1b02b56ce 100644
--- a/sound/direct_sound_samples/cry_sharpedo.aif
+++ b/sound/direct_sound_samples/cries/sharpedo.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_shedinja.aif b/sound/direct_sound_samples/cries/shedinja.aif
index 6d1d565f3..6d1d565f3 100644
--- a/sound/direct_sound_samples/cry_shedinja.aif
+++ b/sound/direct_sound_samples/cries/shedinja.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_shelgon.aif b/sound/direct_sound_samples/cries/shelgon.aif
index 24f234ffe..24f234ffe 100644
--- a/sound/direct_sound_samples/cry_shelgon.aif
+++ b/sound/direct_sound_samples/cries/shelgon.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_shellder.aif b/sound/direct_sound_samples/cries/shellder.aif
index b2ea85228..b2ea85228 100644
--- a/sound/direct_sound_samples/cry_shellder.aif
+++ b/sound/direct_sound_samples/cries/shellder.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_shiftry.aif b/sound/direct_sound_samples/cries/shiftry.aif
index c91ece114..c91ece114 100644
--- a/sound/direct_sound_samples/cry_shiftry.aif
+++ b/sound/direct_sound_samples/cries/shiftry.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_shroomish.aif b/sound/direct_sound_samples/cries/shroomish.aif
index 9e944ca20..9e944ca20 100644
--- a/sound/direct_sound_samples/cry_shroomish.aif
+++ b/sound/direct_sound_samples/cries/shroomish.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_shuckle.aif b/sound/direct_sound_samples/cries/shuckle.aif
index d835d2de6..d835d2de6 100644
--- a/sound/direct_sound_samples/cry_shuckle.aif
+++ b/sound/direct_sound_samples/cries/shuckle.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_shuppet.aif b/sound/direct_sound_samples/cries/shuppet.aif
index 1cd9a2f14..1cd9a2f14 100644
--- a/sound/direct_sound_samples/cry_shuppet.aif
+++ b/sound/direct_sound_samples/cries/shuppet.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_silcoon.aif b/sound/direct_sound_samples/cries/silcoon.aif
index ff48950ad..ff48950ad 100644
--- a/sound/direct_sound_samples/cry_silcoon.aif
+++ b/sound/direct_sound_samples/cries/silcoon.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_skarmory.aif b/sound/direct_sound_samples/cries/skarmory.aif
index 88d3985a3..88d3985a3 100644
--- a/sound/direct_sound_samples/cry_skarmory.aif
+++ b/sound/direct_sound_samples/cries/skarmory.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_skiploom.aif b/sound/direct_sound_samples/cries/skiploom.aif
index 201744d12..201744d12 100644
--- a/sound/direct_sound_samples/cry_skiploom.aif
+++ b/sound/direct_sound_samples/cries/skiploom.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_skitty.aif b/sound/direct_sound_samples/cries/skitty.aif
index 7dc4578f4..7dc4578f4 100644
--- a/sound/direct_sound_samples/cry_skitty.aif
+++ b/sound/direct_sound_samples/cries/skitty.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_slaking.aif b/sound/direct_sound_samples/cries/slaking.aif
index b6a4160f3..b6a4160f3 100644
--- a/sound/direct_sound_samples/cry_slaking.aif
+++ b/sound/direct_sound_samples/cries/slaking.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_slakoth.aif b/sound/direct_sound_samples/cries/slakoth.aif
index 0e4bbc3c3..0e4bbc3c3 100644
--- a/sound/direct_sound_samples/cry_slakoth.aif
+++ b/sound/direct_sound_samples/cries/slakoth.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_slowbro.aif b/sound/direct_sound_samples/cries/slowbro.aif
index f74b753d2..f74b753d2 100644
--- a/sound/direct_sound_samples/cry_slowbro.aif
+++ b/sound/direct_sound_samples/cries/slowbro.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_slowking.aif b/sound/direct_sound_samples/cries/slowking.aif
index 245a42023..245a42023 100644
--- a/sound/direct_sound_samples/cry_slowking.aif
+++ b/sound/direct_sound_samples/cries/slowking.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_slowpoke.aif b/sound/direct_sound_samples/cries/slowpoke.aif
index 82b05a9a7..82b05a9a7 100644
--- a/sound/direct_sound_samples/cry_slowpoke.aif
+++ b/sound/direct_sound_samples/cries/slowpoke.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_slugma.aif b/sound/direct_sound_samples/cries/slugma.aif
index fed42817c..fed42817c 100644
--- a/sound/direct_sound_samples/cry_slugma.aif
+++ b/sound/direct_sound_samples/cries/slugma.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_smeargle.aif b/sound/direct_sound_samples/cries/smeargle.aif
index 00dbedead..00dbedead 100644
--- a/sound/direct_sound_samples/cry_smeargle.aif
+++ b/sound/direct_sound_samples/cries/smeargle.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_smoochum.aif b/sound/direct_sound_samples/cries/smoochum.aif
index 4005b4ad4..4005b4ad4 100644
--- a/sound/direct_sound_samples/cry_smoochum.aif
+++ b/sound/direct_sound_samples/cries/smoochum.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_sneasel.aif b/sound/direct_sound_samples/cries/sneasel.aif
index 54242a23f..54242a23f 100644
--- a/sound/direct_sound_samples/cry_sneasel.aif
+++ b/sound/direct_sound_samples/cries/sneasel.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_snorlax.aif b/sound/direct_sound_samples/cries/snorlax.aif
index f95128e3a..f95128e3a 100644
--- a/sound/direct_sound_samples/cry_snorlax.aif
+++ b/sound/direct_sound_samples/cries/snorlax.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_snorunt.aif b/sound/direct_sound_samples/cries/snorunt.aif
index 53b05b229..53b05b229 100644
--- a/sound/direct_sound_samples/cry_snorunt.aif
+++ b/sound/direct_sound_samples/cries/snorunt.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_snubbull.aif b/sound/direct_sound_samples/cries/snubbull.aif
index bbba023fd..bbba023fd 100644
--- a/sound/direct_sound_samples/cry_snubbull.aif
+++ b/sound/direct_sound_samples/cries/snubbull.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_solrock.aif b/sound/direct_sound_samples/cries/solrock.aif
index 64c71f289..64c71f289 100644
--- a/sound/direct_sound_samples/cry_solrock.aif
+++ b/sound/direct_sound_samples/cries/solrock.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_spearow.aif b/sound/direct_sound_samples/cries/spearow.aif
index 7ce86ae29..7ce86ae29 100644
--- a/sound/direct_sound_samples/cry_spearow.aif
+++ b/sound/direct_sound_samples/cries/spearow.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_spheal.aif b/sound/direct_sound_samples/cries/spheal.aif
index fb6470210..fb6470210 100644
--- a/sound/direct_sound_samples/cry_spheal.aif
+++ b/sound/direct_sound_samples/cries/spheal.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_spinarak.aif b/sound/direct_sound_samples/cries/spinarak.aif
index 3c4c1eff1..3c4c1eff1 100644
--- a/sound/direct_sound_samples/cry_spinarak.aif
+++ b/sound/direct_sound_samples/cries/spinarak.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_spinda.aif b/sound/direct_sound_samples/cries/spinda.aif
index 0217573c7..0217573c7 100644
--- a/sound/direct_sound_samples/cry_spinda.aif
+++ b/sound/direct_sound_samples/cries/spinda.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_spoink.aif b/sound/direct_sound_samples/cries/spoink.aif
index 6cc9bf546..6cc9bf546 100644
--- a/sound/direct_sound_samples/cry_spoink.aif
+++ b/sound/direct_sound_samples/cries/spoink.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_squirtle.aif b/sound/direct_sound_samples/cries/squirtle.aif
index 43a98a53d..43a98a53d 100644
--- a/sound/direct_sound_samples/cry_squirtle.aif
+++ b/sound/direct_sound_samples/cries/squirtle.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_stantler.aif b/sound/direct_sound_samples/cries/stantler.aif
index 36ba54658..36ba54658 100644
--- a/sound/direct_sound_samples/cry_stantler.aif
+++ b/sound/direct_sound_samples/cries/stantler.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_starmie.aif b/sound/direct_sound_samples/cries/starmie.aif
index 7452a78f9..7452a78f9 100644
--- a/sound/direct_sound_samples/cry_starmie.aif
+++ b/sound/direct_sound_samples/cries/starmie.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_staryu.aif b/sound/direct_sound_samples/cries/staryu.aif
index 6ab5584bf..6ab5584bf 100644
--- a/sound/direct_sound_samples/cry_staryu.aif
+++ b/sound/direct_sound_samples/cries/staryu.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_steelix.aif b/sound/direct_sound_samples/cries/steelix.aif
index aa05e2d4c..aa05e2d4c 100644
--- a/sound/direct_sound_samples/cry_steelix.aif
+++ b/sound/direct_sound_samples/cries/steelix.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_sudowoodo.aif b/sound/direct_sound_samples/cries/sudowoodo.aif
index 1af7e18eb..1af7e18eb 100644
--- a/sound/direct_sound_samples/cry_sudowoodo.aif
+++ b/sound/direct_sound_samples/cries/sudowoodo.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_suicune.aif b/sound/direct_sound_samples/cries/suicune.aif
index 697732d68..697732d68 100644
--- a/sound/direct_sound_samples/cry_suicune.aif
+++ b/sound/direct_sound_samples/cries/suicune.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_sunflora.aif b/sound/direct_sound_samples/cries/sunflora.aif
index 126931adc..126931adc 100644
--- a/sound/direct_sound_samples/cry_sunflora.aif
+++ b/sound/direct_sound_samples/cries/sunflora.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_sunkern.aif b/sound/direct_sound_samples/cries/sunkern.aif
index bede3bf95..bede3bf95 100644
--- a/sound/direct_sound_samples/cry_sunkern.aif
+++ b/sound/direct_sound_samples/cries/sunkern.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_surskit.aif b/sound/direct_sound_samples/cries/surskit.aif
index 438b5b67a..438b5b67a 100644
--- a/sound/direct_sound_samples/cry_surskit.aif
+++ b/sound/direct_sound_samples/cries/surskit.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_swablu.aif b/sound/direct_sound_samples/cries/swablu.aif
index 066095f55..066095f55 100644
--- a/sound/direct_sound_samples/cry_swablu.aif
+++ b/sound/direct_sound_samples/cries/swablu.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_swalot.aif b/sound/direct_sound_samples/cries/swalot.aif
index 518a9bf5a..518a9bf5a 100644
--- a/sound/direct_sound_samples/cry_swalot.aif
+++ b/sound/direct_sound_samples/cries/swalot.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_swampert.aif b/sound/direct_sound_samples/cries/swampert.aif
index 56bd26405..56bd26405 100644
--- a/sound/direct_sound_samples/cry_swampert.aif
+++ b/sound/direct_sound_samples/cries/swampert.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_swellow.aif b/sound/direct_sound_samples/cries/swellow.aif
index 2b94eb432..2b94eb432 100644
--- a/sound/direct_sound_samples/cry_swellow.aif
+++ b/sound/direct_sound_samples/cries/swellow.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_swinub.aif b/sound/direct_sound_samples/cries/swinub.aif
index dc68d62d8..dc68d62d8 100644
--- a/sound/direct_sound_samples/cry_swinub.aif
+++ b/sound/direct_sound_samples/cries/swinub.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_taillow.aif b/sound/direct_sound_samples/cries/taillow.aif
index 8322a3224..8322a3224 100644
--- a/sound/direct_sound_samples/cry_taillow.aif
+++ b/sound/direct_sound_samples/cries/taillow.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_tangela.aif b/sound/direct_sound_samples/cries/tangela.aif
index c900b426d..c900b426d 100644
--- a/sound/direct_sound_samples/cry_tangela.aif
+++ b/sound/direct_sound_samples/cries/tangela.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_tauros.aif b/sound/direct_sound_samples/cries/tauros.aif
index 84fa9b317..84fa9b317 100644
--- a/sound/direct_sound_samples/cry_tauros.aif
+++ b/sound/direct_sound_samples/cries/tauros.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_teddiursa.aif b/sound/direct_sound_samples/cries/teddiursa.aif
index ba5cb5bc3..ba5cb5bc3 100644
--- a/sound/direct_sound_samples/cry_teddiursa.aif
+++ b/sound/direct_sound_samples/cries/teddiursa.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_tentacool.aif b/sound/direct_sound_samples/cries/tentacool.aif
index 332bec4b2..332bec4b2 100644
--- a/sound/direct_sound_samples/cry_tentacool.aif
+++ b/sound/direct_sound_samples/cries/tentacool.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_tentacruel.aif b/sound/direct_sound_samples/cries/tentacruel.aif
index e8ec1b14c..e8ec1b14c 100644
--- a/sound/direct_sound_samples/cry_tentacruel.aif
+++ b/sound/direct_sound_samples/cries/tentacruel.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_togepi.aif b/sound/direct_sound_samples/cries/togepi.aif
index 87ef6ef2d..87ef6ef2d 100644
--- a/sound/direct_sound_samples/cry_togepi.aif
+++ b/sound/direct_sound_samples/cries/togepi.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_togetic.aif b/sound/direct_sound_samples/cries/togetic.aif
index 8aa18ac41..8aa18ac41 100644
--- a/sound/direct_sound_samples/cry_togetic.aif
+++ b/sound/direct_sound_samples/cries/togetic.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_torchic.aif b/sound/direct_sound_samples/cries/torchic.aif
index 185a79499..185a79499 100644
--- a/sound/direct_sound_samples/cry_torchic.aif
+++ b/sound/direct_sound_samples/cries/torchic.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_torkoal.aif b/sound/direct_sound_samples/cries/torkoal.aif
index 9e56d3810..9e56d3810 100644
--- a/sound/direct_sound_samples/cry_torkoal.aif
+++ b/sound/direct_sound_samples/cries/torkoal.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_totodile.aif b/sound/direct_sound_samples/cries/totodile.aif
index dbf2179a7..dbf2179a7 100644
--- a/sound/direct_sound_samples/cry_totodile.aif
+++ b/sound/direct_sound_samples/cries/totodile.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_trapinch.aif b/sound/direct_sound_samples/cries/trapinch.aif
index 01664b72e..01664b72e 100644
--- a/sound/direct_sound_samples/cry_trapinch.aif
+++ b/sound/direct_sound_samples/cries/trapinch.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_treecko.aif b/sound/direct_sound_samples/cries/treecko.aif
index a7416e8da..a7416e8da 100644
--- a/sound/direct_sound_samples/cry_treecko.aif
+++ b/sound/direct_sound_samples/cries/treecko.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_tropius.aif b/sound/direct_sound_samples/cries/tropius.aif
index bbb52787b..bbb52787b 100644
--- a/sound/direct_sound_samples/cry_tropius.aif
+++ b/sound/direct_sound_samples/cries/tropius.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_typhlosion.aif b/sound/direct_sound_samples/cries/typhlosion.aif
index f0238d066..f0238d066 100644
--- a/sound/direct_sound_samples/cry_typhlosion.aif
+++ b/sound/direct_sound_samples/cries/typhlosion.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_tyranitar.aif b/sound/direct_sound_samples/cries/tyranitar.aif
index 557f61769..557f61769 100644
--- a/sound/direct_sound_samples/cry_tyranitar.aif
+++ b/sound/direct_sound_samples/cries/tyranitar.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_tyrogue.aif b/sound/direct_sound_samples/cries/tyrogue.aif
index e5065f58b..e5065f58b 100644
--- a/sound/direct_sound_samples/cry_tyrogue.aif
+++ b/sound/direct_sound_samples/cries/tyrogue.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_umbreon.aif b/sound/direct_sound_samples/cries/umbreon.aif
index 38129b1a7..38129b1a7 100644
--- a/sound/direct_sound_samples/cry_umbreon.aif
+++ b/sound/direct_sound_samples/cries/umbreon.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_unown.aif b/sound/direct_sound_samples/cries/unown.aif
index 8339ccb6b..8339ccb6b 100644
--- a/sound/direct_sound_samples/cry_unown.aif
+++ b/sound/direct_sound_samples/cries/unown.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_unused_265.aif b/sound/direct_sound_samples/cries/unused_265.aif
index 7f5965f06..7f5965f06 100644
--- a/sound/direct_sound_samples/cry_unused_265.aif
+++ b/sound/direct_sound_samples/cries/unused_265.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_unused_268.aif b/sound/direct_sound_samples/cries/unused_268.aif
index 5cae364c3..5cae364c3 100644
--- a/sound/direct_sound_samples/cry_unused_268.aif
+++ b/sound/direct_sound_samples/cries/unused_268.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_ursaring.aif b/sound/direct_sound_samples/cries/ursaring.aif
index fcc748bd1..fcc748bd1 100644
--- a/sound/direct_sound_samples/cry_ursaring.aif
+++ b/sound/direct_sound_samples/cries/ursaring.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_vaporeon.aif b/sound/direct_sound_samples/cries/vaporeon.aif
index 4967cfdeb..4967cfdeb 100644
--- a/sound/direct_sound_samples/cry_vaporeon.aif
+++ b/sound/direct_sound_samples/cries/vaporeon.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_venomoth.aif b/sound/direct_sound_samples/cries/venomoth.aif
index bc291ec33..bc291ec33 100644
--- a/sound/direct_sound_samples/cry_venomoth.aif
+++ b/sound/direct_sound_samples/cries/venomoth.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_venonat.aif b/sound/direct_sound_samples/cries/venonat.aif
index e89d87fa8..e89d87fa8 100644
--- a/sound/direct_sound_samples/cry_venonat.aif
+++ b/sound/direct_sound_samples/cries/venonat.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_venusaur.aif b/sound/direct_sound_samples/cries/venusaur.aif
index 8a1f69e6e..8a1f69e6e 100644
--- a/sound/direct_sound_samples/cry_venusaur.aif
+++ b/sound/direct_sound_samples/cries/venusaur.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_vibrava.aif b/sound/direct_sound_samples/cries/vibrava.aif
index 3e3180219..3e3180219 100644
--- a/sound/direct_sound_samples/cry_vibrava.aif
+++ b/sound/direct_sound_samples/cries/vibrava.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_victreebel.aif b/sound/direct_sound_samples/cries/victreebel.aif
index d6e6a4fe9..d6e6a4fe9 100644
--- a/sound/direct_sound_samples/cry_victreebel.aif
+++ b/sound/direct_sound_samples/cries/victreebel.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_vigoroth.aif b/sound/direct_sound_samples/cries/vigoroth.aif
index fc414f33d..fc414f33d 100644
--- a/sound/direct_sound_samples/cry_vigoroth.aif
+++ b/sound/direct_sound_samples/cries/vigoroth.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_vileplume.aif b/sound/direct_sound_samples/cries/vileplume.aif
index 723eec697..723eec697 100644
--- a/sound/direct_sound_samples/cry_vileplume.aif
+++ b/sound/direct_sound_samples/cries/vileplume.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_volbeat.aif b/sound/direct_sound_samples/cries/volbeat.aif
index 6f765081e..6f765081e 100644
--- a/sound/direct_sound_samples/cry_volbeat.aif
+++ b/sound/direct_sound_samples/cries/volbeat.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_voltorb.aif b/sound/direct_sound_samples/cries/voltorb.aif
index 96e3bff31..96e3bff31 100644
--- a/sound/direct_sound_samples/cry_voltorb.aif
+++ b/sound/direct_sound_samples/cries/voltorb.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_vulpix.aif b/sound/direct_sound_samples/cries/vulpix.aif
index 20da23fb4..20da23fb4 100644
--- a/sound/direct_sound_samples/cry_vulpix.aif
+++ b/sound/direct_sound_samples/cries/vulpix.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_wailmer.aif b/sound/direct_sound_samples/cries/wailmer.aif
index e8de91333..e8de91333 100644
--- a/sound/direct_sound_samples/cry_wailmer.aif
+++ b/sound/direct_sound_samples/cries/wailmer.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_wailord.aif b/sound/direct_sound_samples/cries/wailord.aif
index 2c0468010..2c0468010 100644
--- a/sound/direct_sound_samples/cry_wailord.aif
+++ b/sound/direct_sound_samples/cries/wailord.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_walrein.aif b/sound/direct_sound_samples/cries/walrein.aif
index 91d93f3fb..91d93f3fb 100644
--- a/sound/direct_sound_samples/cry_walrein.aif
+++ b/sound/direct_sound_samples/cries/walrein.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_wartortle.aif b/sound/direct_sound_samples/cries/wartortle.aif
index 5dab7fd93..5dab7fd93 100644
--- a/sound/direct_sound_samples/cry_wartortle.aif
+++ b/sound/direct_sound_samples/cries/wartortle.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_weedle.aif b/sound/direct_sound_samples/cries/weedle.aif
index 773c2c8ae..773c2c8ae 100644
--- a/sound/direct_sound_samples/cry_weedle.aif
+++ b/sound/direct_sound_samples/cries/weedle.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_weepinbell.aif b/sound/direct_sound_samples/cries/weepinbell.aif
index cdd61380a..cdd61380a 100644
--- a/sound/direct_sound_samples/cry_weepinbell.aif
+++ b/sound/direct_sound_samples/cries/weepinbell.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_weezing.aif b/sound/direct_sound_samples/cries/weezing.aif
index 2e4a7fe13..2e4a7fe13 100644
--- a/sound/direct_sound_samples/cry_weezing.aif
+++ b/sound/direct_sound_samples/cries/weezing.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_whiscash.aif b/sound/direct_sound_samples/cries/whiscash.aif
index 219737f32..219737f32 100644
--- a/sound/direct_sound_samples/cry_whiscash.aif
+++ b/sound/direct_sound_samples/cries/whiscash.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_whismur.aif b/sound/direct_sound_samples/cries/whismur.aif
index 4da92ca6a..4da92ca6a 100644
--- a/sound/direct_sound_samples/cry_whismur.aif
+++ b/sound/direct_sound_samples/cries/whismur.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_wigglytuff.aif b/sound/direct_sound_samples/cries/wigglytuff.aif
index 90aa90a23..90aa90a23 100644
--- a/sound/direct_sound_samples/cry_wigglytuff.aif
+++ b/sound/direct_sound_samples/cries/wigglytuff.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_wingull.aif b/sound/direct_sound_samples/cries/wingull.aif
index 182ef18e6..182ef18e6 100644
--- a/sound/direct_sound_samples/cry_wingull.aif
+++ b/sound/direct_sound_samples/cries/wingull.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_wobbuffet.aif b/sound/direct_sound_samples/cries/wobbuffet.aif
index 70ee1f704..70ee1f704 100644
--- a/sound/direct_sound_samples/cry_wobbuffet.aif
+++ b/sound/direct_sound_samples/cries/wobbuffet.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_wooper.aif b/sound/direct_sound_samples/cries/wooper.aif
index 51a6b627e..51a6b627e 100644
--- a/sound/direct_sound_samples/cry_wooper.aif
+++ b/sound/direct_sound_samples/cries/wooper.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_wurmple.aif b/sound/direct_sound_samples/cries/wurmple.aif
index 6442a4063..6442a4063 100644
--- a/sound/direct_sound_samples/cry_wurmple.aif
+++ b/sound/direct_sound_samples/cries/wurmple.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_wynaut.aif b/sound/direct_sound_samples/cries/wynaut.aif
index 798732c74..798732c74 100644
--- a/sound/direct_sound_samples/cry_wynaut.aif
+++ b/sound/direct_sound_samples/cries/wynaut.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_xatu.aif b/sound/direct_sound_samples/cries/xatu.aif
index ac758fdbf..ac758fdbf 100644
--- a/sound/direct_sound_samples/cry_xatu.aif
+++ b/sound/direct_sound_samples/cries/xatu.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_yanma.aif b/sound/direct_sound_samples/cries/yanma.aif
index df76534c5..df76534c5 100644
--- a/sound/direct_sound_samples/cry_yanma.aif
+++ b/sound/direct_sound_samples/cries/yanma.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_zangoose.aif b/sound/direct_sound_samples/cries/zangoose.aif
index 3c206532f..3c206532f 100644
--- a/sound/direct_sound_samples/cry_zangoose.aif
+++ b/sound/direct_sound_samples/cries/zangoose.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_zapdos.aif b/sound/direct_sound_samples/cries/zapdos.aif
index a8d914d14..a8d914d14 100644
--- a/sound/direct_sound_samples/cry_zapdos.aif
+++ b/sound/direct_sound_samples/cries/zapdos.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_zigzagoon.aif b/sound/direct_sound_samples/cries/zigzagoon.aif
index 52b9bb4f4..52b9bb4f4 100644
--- a/sound/direct_sound_samples/cry_zigzagoon.aif
+++ b/sound/direct_sound_samples/cries/zigzagoon.aif
Binary files differ
diff --git a/sound/direct_sound_samples/cry_zubat.aif b/sound/direct_sound_samples/cries/zubat.aif
index 45036d072..45036d072 100644
--- a/sound/direct_sound_samples/cry_zubat.aif
+++ b/sound/direct_sound_samples/cries/zubat.aif
Binary files differ
diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c
index c9a6a6606..748e4729a 100644
--- a/src/battle_ai_script_commands.c
+++ b/src/battle_ai_script_commands.c
@@ -471,9 +471,9 @@ static u8 ChooseMoveOrAction_Doubles(void)
else
{
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
- BattleAI_SetupAIData(gBattleStruct->field_92 >> 4);
+ BattleAI_SetupAIData(gBattleStruct->palaceFlags >> 4);
else
- BattleAI_SetupAIData(0xF);
+ BattleAI_SetupAIData((1 << MAX_MON_MOVES) - 1);
gBattlerTarget = i;
diff --git a/src/battle_anim_smokescreen.c b/src/battle_anim_smokescreen.c
index a8c043e67..4120dda72 100644
--- a/src/battle_anim_smokescreen.c
+++ b/src/battle_anim_smokescreen.c
@@ -6,39 +6,40 @@
#include "sprite.h"
#include "util.h"
#include "constants/pokemon.h"
+#include "constants/battle_palace.h"
static void SmokescreenImpact_Callback(struct Sprite *);
static void SpriteCB_DestroySprite(struct Sprite *sprite);
// The below data for smokescreen starts and ends with some data that belongs to battle_gfx_sfx_util.c
-const u8 gUnknown_0831C604[] =
-{
- [NATURE_HARDY] = 0,
- [NATURE_LONELY] = 0,
- [NATURE_BRAVE] = 1,
- [NATURE_ADAMANT] = 0,
- [NATURE_NAUGHTY] = 1,
- [NATURE_BOLD] = 1,
- [NATURE_DOCILE] = 2,
- [NATURE_RELAXED] = 0,
- [NATURE_IMPISH] = 0,
- [NATURE_LAX] = 0,
- [NATURE_TIMID] = 1,
- [NATURE_HASTY] = 1,
- [NATURE_SERIOUS] = 1,
- [NATURE_JOLLY] = 0,
- [NATURE_NAIVE] = 2,
- [NATURE_MODEST] = 1,
- [NATURE_MILD] = 0,
- [NATURE_QUIET] = 1,
- [NATURE_BASHFUL] = 1,
- [NATURE_RASH] = 0,
- [NATURE_CALM] = 0,
- [NATURE_GENTLE] = 0,
- [NATURE_SASSY] = 1,
- [NATURE_CAREFUL] = 1,
- [NATURE_QUIRKY] = 0,
+const u8 gBattlePalaceNatureToMoveTarget[NUM_NATURES] =
+{
+ [NATURE_HARDY] = PALACE_TARGET_STRONGER,
+ [NATURE_LONELY] = PALACE_TARGET_STRONGER,
+ [NATURE_BRAVE] = PALACE_TARGET_WEAKER,
+ [NATURE_ADAMANT] = PALACE_TARGET_STRONGER,
+ [NATURE_NAUGHTY] = PALACE_TARGET_WEAKER,
+ [NATURE_BOLD] = PALACE_TARGET_WEAKER,
+ [NATURE_DOCILE] = PALACE_TARGET_RANDOM,
+ [NATURE_RELAXED] = PALACE_TARGET_STRONGER,
+ [NATURE_IMPISH] = PALACE_TARGET_STRONGER,
+ [NATURE_LAX] = PALACE_TARGET_STRONGER,
+ [NATURE_TIMID] = PALACE_TARGET_WEAKER,
+ [NATURE_HASTY] = PALACE_TARGET_WEAKER,
+ [NATURE_SERIOUS] = PALACE_TARGET_WEAKER,
+ [NATURE_JOLLY] = PALACE_TARGET_STRONGER,
+ [NATURE_NAIVE] = PALACE_TARGET_RANDOM,
+ [NATURE_MODEST] = PALACE_TARGET_WEAKER,
+ [NATURE_MILD] = PALACE_TARGET_STRONGER,
+ [NATURE_QUIET] = PALACE_TARGET_WEAKER,
+ [NATURE_BASHFUL] = PALACE_TARGET_WEAKER,
+ [NATURE_RASH] = PALACE_TARGET_STRONGER,
+ [NATURE_CALM] = PALACE_TARGET_STRONGER,
+ [NATURE_GENTLE] = PALACE_TARGET_STRONGER,
+ [NATURE_SASSY] = PALACE_TARGET_WEAKER,
+ [NATURE_CAREFUL] = PALACE_TARGET_WEAKER,
+ [NATURE_QUIRKY] = PALACE_TARGET_STRONGER,
};
static const struct CompressedSpriteSheet sSmokescreenImpactSpriteSheet =
diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c
index 6604fa142..ce22c605f 100644
--- a/src/battle_controller_link_opponent.c
+++ b/src/battle_controller_link_opponent.c
@@ -1267,9 +1267,9 @@ static void LinkOpponentHandleDrawTrainerPic(void)
else
{
xPos = 176;
- if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00)
+ if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM)
{
- trainerPicId = sub_8068B48();
+ trainerPicId = GetUnionRoomTrainerPic();
}
else if ((gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_FIRE_RED
|| (gLinkPlayers[GetMultiplayerId() ^ BIT_SIDE].version & 0xFF) == VERSION_LEAF_GREEN)
diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c
index 6dd9cd2f4..fd18c3187 100644
--- a/src/battle_controller_player.c
+++ b/src/battle_controller_player.c
@@ -316,7 +316,7 @@ static void HandleInputChooseAction(void)
if (gBattleBufferA[gActiveBattler][1] == B_ACTION_USE_ITEM)
{
// Add item to bag if it is a ball
- if (itemId <= ITEM_PREMIER_BALL)
+ if (itemId <= LAST_BALL)
AddBagItem(itemId, 1);
else
return;
@@ -359,7 +359,7 @@ static void HandleInputChooseTarget(void)
} while (i < gBattlersCount);
}
- if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == 2)
+ if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
gPlayerDpadHoldFrames++;
else
gPlayerDpadHoldFrames = 0;
@@ -367,7 +367,7 @@ static void HandleInputChooseTarget(void)
if (gMain.newKeys & A_BUTTON)
{
PlaySE(SE_SELECT);
- gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C;
+ gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX);
PlayerBufferExecCompleted();
@@ -375,7 +375,7 @@ static void HandleInputChooseTarget(void)
else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59)
{
PlaySE(SE_SELECT);
- gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C;
+ gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove;
DoBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX, 7, 1);
DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1);
@@ -384,7 +384,7 @@ static void HandleInputChooseTarget(void)
else if (gMain.newKeys & (DPAD_LEFT | DPAD_UP))
{
PlaySE(SE_SELECT);
- gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C;
+ gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
do
{
@@ -421,12 +421,12 @@ static void HandleInputChooseTarget(void)
if (gAbsentBattlerFlags & gBitTable[gMultiUsePlayerCursor])
i = 0;
} while (i == 0);
- gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8;
+ gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget;
}
else if (gMain.newKeys & (DPAD_RIGHT | DPAD_DOWN))
{
PlaySE(SE_SELECT);
- gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039B2C;
+ gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
do
{
@@ -463,7 +463,7 @@ static void HandleInputChooseTarget(void)
if (gAbsentBattlerFlags & gBitTable[gMultiUsePlayerCursor])
i = 0;
} while (i == 0);
- gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8;
+ gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget;
}
}
@@ -536,7 +536,7 @@ static void HandleInputChooseMove(void)
else
gMultiUsePlayerCursor = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
- gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8;
+ gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget;
}
}
else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59)
diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c
index 7c1bff64a..35383611b 100644
--- a/src/battle_controller_recorded_opponent.c
+++ b/src/battle_controller_recorded_opponent.c
@@ -1229,9 +1229,9 @@ static void RecordedOpponentHandleDrawTrainerPic(void)
else
{
xPos = 176;
- if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00)
+ if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM)
{
- trainerPicId = sub_8068B48();
+ trainerPicId = GetUnionRoomTrainerPic();
}
else
{
diff --git a/src/battle_controllers.c b/src/battle_controllers.c
index b411c12f6..7f78c1ac9 100644
--- a/src/battle_controllers.c
+++ b/src/battle_controllers.c
@@ -6,6 +6,7 @@
#include "battle_message.h"
#include "cable_club.h"
#include "link.h"
+#include "link_rfu.h"
#include "party_menu.h"
#include "pokemon.h"
#include "recorded_battle.h"
@@ -33,10 +34,10 @@ void HandleLinkBattleSetup(void)
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
{
if (gWirelessCommType)
- sub_800B488();
+ SetWirelessCommType1();
if (!gReceivedRemoteLinkPlayers)
OpenLink();
- CreateTask(task00_08081A90, 0);
+ CreateTask(Task_WaitForLinkPlayerConnection, 0);
CreateTasksForSendRecvLinkBuffers();
}
}
@@ -827,7 +828,7 @@ void sub_8033648(void)
if (gReceivedRemoteLinkPlayers != 0 && (gBattleTypeFlags & BATTLE_TYPE_20))
{
- sub_8011BD0();
+ DestroyTask_RfuIdle();
for (i = 0; i < GetLinkPlayerCount(); i++)
{
if (GetBlockReceivedStatus() & gBitTable[i])
diff --git a/src/battle_dome.c b/src/battle_dome.c
index 6f3d111ba..151bfc927 100644
--- a/src/battle_dome.c
+++ b/src/battle_dome.c
@@ -4692,7 +4692,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId)
allocatedArray[NUM_STATS] += allocatedArray[STAT_HP];
// Add the EVs with the nature modifier for this mon and and track number of negative natures
- for (j = 0; j < NUM_EV_STATS; j++)
+ for (j = 0; j < NUM_NATURE_STATS; j++)
{
if (trainerId == TRAINER_FRONTIER_BRAIN)
nature = GetFrontierBrainMonNature(i);
@@ -4706,7 +4706,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId)
else if (gNatureStatTable[nature][j] < 0)
{
allocatedArray[j + NUM_STATS + 1] += (allocatedArray[j + 1] * 90) / 100;
- allocatedArray[j + NUM_STATS + NUM_EV_STATS + 2]++;
+ allocatedArray[j + NUM_STATS + NUM_NATURE_STATS + 2]++;
}
else
{
@@ -4742,7 +4742,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId)
}
allocatedArray[NUM_STATS] += allocatedArray[STAT_HP];
- for (j = 0; j < NUM_EV_STATS; j++)
+ for (j = 0; j < NUM_NATURE_STATS; j++)
{
nature = gFacilityTrainerMons[DOME_MONS[trainerTourneyId][i]].nature;
if (gNatureStatTable[nature][j] > 0)
@@ -4752,7 +4752,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId)
else if (gNatureStatTable[nature][j] < 0)
{
allocatedArray[j + NUM_STATS + 1] += (allocatedArray[j + 1] * 90) / 100;
- allocatedArray[j + NUM_STATS + NUM_EV_STATS + 2]++;
+ allocatedArray[j + NUM_STATS + NUM_NATURE_STATS + 2]++;
}
else
{
diff --git a/src/battle_factory.c b/src/battle_factory.c
index 913b1b1a0..940e71f7d 100644
--- a/src/battle_factory.c
+++ b/src/battle_factory.c
@@ -39,7 +39,7 @@ static void GenerateInitialRentalMons(void);
static void GetOpponentMostCommonMonType(void);
static void GetOpponentBattleStyle(void);
static void RestorePlayerPartyHeldItems(void);
-static u16 GetMonSetId(u8 lvlMode, u8 challengeNum, bool8 arg2);
+static u16 GetFactoryMonId(u8 lvlMode, u8 challengeNum, bool8 arg2);
static u8 GetMoveBattleStyle(u16 move);
// Const rom data.
@@ -159,24 +159,27 @@ static const u8 sFixedIVTable[][2] =
{31, 31},
};
-static const u16 sMonsToChooseFrom[][2] =
-{
- {0x006e, 0x00c7},
- {0x00a2, 0x010a},
- {0x010b, 0x0173},
- {0x0174, 0x01d3},
- {0x01d4, 0x0233},
- {0x0234, 0x0293},
- {0x0294, 0x02f3},
- {0x0174, 0x0351},
- {0x0174, 0x01d3},
- {0x01d4, 0x0233},
- {0x0234, 0x0293},
- {0x0294, 0x02f3},
- {0x0174, 0x0371},
- {0x0174, 0x0371},
- {0x0174, 0x0371},
- {0x0174, 0x0371},
+static const u16 sInitialRentalMonRanges[][2] =
+{
+ // Level 50
+ {FRONTIER_MON_GRIMER, FRONTIER_MON_FURRET_1}, // 110 - 199
+ {FRONTIER_MON_DELCATTY_1, FRONTIER_MON_CLOYSTER_1}, // 162 - 266
+ {FRONTIER_MON_DELCATTY_2, FRONTIER_MON_CLOYSTER_2}, // 267 - 371
+ {FRONTIER_MON_DUGTRIO_1, FRONTIER_MON_SLAKING_1}, // 372 - 467
+ {FRONTIER_MON_DUGTRIO_2, FRONTIER_MON_SLAKING_2}, // 468 - 563
+ {FRONTIER_MON_DUGTRIO_3, FRONTIER_MON_SLAKING_3}, // 564 - 659
+ {FRONTIER_MON_DUGTRIO_4, FRONTIER_MON_SLAKING_4}, // 660 - 755
+ {FRONTIER_MON_DUGTRIO_1, FRONTIER_MONS_HIGH_TIER}, // 372 - 849
+
+ // Open level
+ {FRONTIER_MON_DUGTRIO_1, FRONTIER_MON_SLAKING_1}, // 372 - 467
+ {FRONTIER_MON_DUGTRIO_2, FRONTIER_MON_SLAKING_2}, // 468 - 563
+ {FRONTIER_MON_DUGTRIO_3, FRONTIER_MON_SLAKING_3}, // 564 - 659
+ {FRONTIER_MON_DUGTRIO_4, FRONTIER_MON_SLAKING_4}, // 660 - 755
+ {FRONTIER_MON_DUGTRIO_1, NUM_FRONTIER_MONS - 1}, // 372 - 881
+ {FRONTIER_MON_DUGTRIO_1, NUM_FRONTIER_MONS - 1}, // 372 - 881
+ {FRONTIER_MON_DUGTRIO_1, NUM_FRONTIER_MONS - 1}, // 372 - 881
+ {FRONTIER_MON_DUGTRIO_1, NUM_FRONTIER_MONS - 1}, // 372 - 881
};
// code
@@ -320,24 +323,24 @@ static void GenerateOpponentMons(void)
i = 0;
while (i != FRONTIER_PARTY_SIZE)
{
- u16 monSetId = GetMonSetId(lvlMode, challengeNum, FALSE);
- if (gFacilityTrainerMons[monSetId].species == SPECIES_UNOWN)
+ u16 monId = GetFactoryMonId(lvlMode, challengeNum, FALSE);
+ if (gFacilityTrainerMons[monId].species == SPECIES_UNOWN)
continue;
for (j = 0; j < 6; j++)
{
- if (gFacilityTrainerMons[monSetId].species == gFacilityTrainerMons[gSaveBlock2Ptr->frontier.rentalMons[j].monId].species)
+ if (gFacilityTrainerMons[monId].species == gFacilityTrainerMons[gSaveBlock2Ptr->frontier.rentalMons[j].monId].species)
break;
}
if (j != 6)
continue;
- if (lvlMode == FRONTIER_LVL_50 && monSetId > FRONTIER_MONS_HIGH_TIER)
+ if (lvlMode == FRONTIER_LVL_50 && monId > FRONTIER_MONS_HIGH_TIER)
continue;
for (k = firstMonId; k < firstMonId + i; k++)
{
- if (species[k] == gFacilityTrainerMons[monSetId].species)
+ if (species[k] == gFacilityTrainerMons[monId].species)
break;
}
if (k != firstMonId + i)
@@ -345,15 +348,15 @@ static void GenerateOpponentMons(void)
for (k = firstMonId; k < firstMonId + i; k++)
{
- if (heldItems[k] != 0 && heldItems[k] == gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId])
+ if (heldItems[k] != 0 && heldItems[k] == gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId])
break;
}
if (k != firstMonId + i)
continue;
- species[i] = gFacilityTrainerMons[monSetId].species;
- heldItems[i] = gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId];
- gUnknown_03006298[i] = monSetId;
+ species[i] = gFacilityTrainerMons[monId].species;
+ heldItems[i] = gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId];
+ gUnknown_03006298[i] = monId;
i++;
}
}
@@ -388,7 +391,7 @@ static void SetPlayerAndOpponentParties(void)
int count = 0;
u8 bits = 0;
u8 monLevel;
- u16 monSetId;
+ u16 monId;
u16 evs;
u8 ivs;
u8 friendship;
@@ -412,17 +415,17 @@ static void SetPlayerAndOpponentParties(void)
ZeroPlayerPartyMons();
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
{
- monSetId = gSaveBlock2Ptr->frontier.rentalMons[i].monId;
+ monId = gSaveBlock2Ptr->frontier.rentalMons[i].monId;
ivs = gSaveBlock2Ptr->frontier.rentalMons[i].ivs;
CreateMon(&gPlayerParty[i],
- gFacilityTrainerMons[monSetId].species,
+ gFacilityTrainerMons[monId].species,
monLevel,
ivs,
TRUE, gSaveBlock2Ptr->frontier.rentalMons[i].personality,
OT_ID_PLAYER_ID, 0);
count = 0;
- bits = gFacilityTrainerMons[monSetId].evSpread;
+ bits = gFacilityTrainerMons[monId].evSpread;
for (j = 0; j < NUM_STATS; bits >>= 1, j++)
{
if (bits & 1)
@@ -433,16 +436,16 @@ static void SetPlayerAndOpponentParties(void)
bits = 1;
for (j = 0; j < NUM_STATS; bits <<= 1, j++)
{
- if (gFacilityTrainerMons[monSetId].evSpread & bits)
+ if (gFacilityTrainerMons[monId].evSpread & bits)
SetMonData(&gPlayerParty[i], MON_DATA_HP_EV + j, &evs);
}
CalculateMonStats(&gPlayerParty[i]);
friendship = 0;
for (k = 0; k < MAX_MON_MOVES; k++)
- SetMonMoveAvoidReturn(&gPlayerParty[i], gFacilityTrainerMons[monSetId].moves[k], k);
+ SetMonMoveAvoidReturn(&gPlayerParty[i], gFacilityTrainerMons[monId].moves[k], k);
SetMonData(&gPlayerParty[i], MON_DATA_FRIENDSHIP, &friendship);
- SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId]);
+ SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]);
SetMonData(&gPlayerParty[i], MON_DATA_ABILITY_NUM, &gSaveBlock2Ptr->frontier.rentalMons[i].abilityNum);
}
}
@@ -453,17 +456,17 @@ static void SetPlayerAndOpponentParties(void)
case 2:
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
{
- monSetId = gSaveBlock2Ptr->frontier.rentalMons[i + 3].monId;
+ monId = gSaveBlock2Ptr->frontier.rentalMons[i + 3].monId;
ivs = gSaveBlock2Ptr->frontier.rentalMons[i + 3].ivs;
CreateMon(&gEnemyParty[i],
- gFacilityTrainerMons[monSetId].species,
+ gFacilityTrainerMons[monId].species,
monLevel,
ivs,
TRUE, gSaveBlock2Ptr->frontier.rentalMons[i + 3].personality,
OT_ID_PLAYER_ID, 0);
count = 0;
- bits = gFacilityTrainerMons[monSetId].evSpread;
+ bits = gFacilityTrainerMons[monId].evSpread;
for (j = 0; j < NUM_STATS; bits >>= 1, j++)
{
if (bits & 1)
@@ -474,14 +477,14 @@ static void SetPlayerAndOpponentParties(void)
bits = 1;
for (j = 0; j < NUM_STATS; bits <<= 1, j++)
{
- if (gFacilityTrainerMons[monSetId].evSpread & bits)
+ if (gFacilityTrainerMons[monId].evSpread & bits)
SetMonData(&gEnemyParty[i], MON_DATA_HP_EV + j, &evs);
}
CalculateMonStats(&gEnemyParty[i]);
for (k = 0; k < MAX_MON_MOVES; k++)
- SetMonMoveAvoidReturn(&gEnemyParty[i], gFacilityTrainerMons[monSetId].moves[k], k);
- SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId]);
+ SetMonMoveAvoidReturn(&gEnemyParty[i], gFacilityTrainerMons[monId].moves[k], k);
+ SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]);
SetMonData(&gEnemyParty[i], MON_DATA_ABILITY_NUM, &gSaveBlock2Ptr->frontier.rentalMons[i + 3].abilityNum);
}
break;
@@ -497,8 +500,8 @@ static void GenerateInitialRentalMons(void)
u8 challengeNum;
u8 factoryLvlMode;
u8 factoryBattleMode;
- u8 var_40;
- u16 monSetId;
+ u8 rentalRank;
+ u16 monId;
u16 currSpecies;
u16 species[PARTY_SIZE];
u16 monIds[PARTY_SIZE];
@@ -530,30 +533,30 @@ static void GenerateInitialRentalMons(void)
factoryLvlMode = FRONTIER_LVL_50;
firstMonId = 0;
}
- var_40 = GetNumPastRentalsRank(factoryBattleMode, factoryLvlMode);
+ rentalRank = GetNumPastRentalsRank(factoryBattleMode, factoryLvlMode);
currSpecies = SPECIES_NONE;
i = 0;
while (i != PARTY_SIZE)
{
- if (i < var_40)
- monSetId = GetMonSetId(factoryLvlMode, challengeNum, TRUE);
+ if (i < rentalRank) // The more times the player has rented, the more initial rentals are generated from a better set of pokemon
+ monId = GetFactoryMonId(factoryLvlMode, challengeNum, TRUE);
else
- monSetId = GetMonSetId(factoryLvlMode, challengeNum, FALSE);
+ monId = GetFactoryMonId(factoryLvlMode, challengeNum, FALSE);
- if (gFacilityTrainerMons[monSetId].species == SPECIES_UNOWN)
+ if (gFacilityTrainerMons[monId].species == SPECIES_UNOWN)
continue;
// Cannot have two pokemon of the same species.
for (j = firstMonId; j < firstMonId + i; j++)
{
- u16 monId = monIds[j];
- if (monId == monSetId)
+ u16 existingMonId = monIds[j];
+ if (existingMonId == monId)
break;
- if (species[j] == gFacilityTrainerMons[monSetId].species)
+ if (species[j] == gFacilityTrainerMons[monId].species)
{
if (currSpecies == SPECIES_NONE)
- currSpecies = gFacilityTrainerMons[monSetId].species;
+ currSpecies = gFacilityTrainerMons[monId].species;
else
break;
}
@@ -564,9 +567,9 @@ static void GenerateInitialRentalMons(void)
// Cannot have two same held items.
for (j = firstMonId; j < firstMonId + i; j++)
{
- if (heldItems[j] != 0 && heldItems[j] == gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId])
+ if (heldItems[j] != 0 && heldItems[j] == gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId])
{
- if (gFacilityTrainerMons[monSetId].species == currSpecies)
+ if (gFacilityTrainerMons[monId].species == currSpecies)
currSpecies = SPECIES_NONE;
break;
}
@@ -574,10 +577,10 @@ static void GenerateInitialRentalMons(void)
if (j != firstMonId + i)
continue;
- gSaveBlock2Ptr->frontier.rentalMons[i].monId = monSetId;
- species[i] = gFacilityTrainerMons[monSetId].species;
- heldItems[i] = gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId];
- monIds[i] = monSetId;
+ gSaveBlock2Ptr->frontier.rentalMons[i].monId = monId;
+ species[i] = gFacilityTrainerMons[monId].species;
+ heldItems[i] = gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId];
+ monIds[i] = monId;
i++;
}
}
@@ -629,10 +632,10 @@ static void GetOpponentBattleStyle(void)
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
{
- u16 monSetId = gUnknown_03006298[i];
+ u16 monId = gUnknown_03006298[i];
for (j = 0; j < MAX_MON_MOVES; j++)
{
- u8 battleStyle = GetMoveBattleStyle(gFacilityTrainerMons[monSetId].moves[j]);
+ u8 battleStyle = GetMoveBattleStyle(gFacilityTrainerMons[monId].moves[j]);
stylePoints[battleStyle]++;
}
}
@@ -724,16 +727,16 @@ void FillFactoryBrainParty(void)
while (i != FRONTIER_PARTY_SIZE)
{
- u16 monSetId = GetMonSetId(lvlMode, challengeNum, FALSE);
+ u16 monId = GetFactoryMonId(lvlMode, challengeNum, FALSE);
- if (gFacilityTrainerMons[monSetId].species == SPECIES_UNOWN)
+ if (gFacilityTrainerMons[monId].species == SPECIES_UNOWN)
continue;
- if (monLevel == 50 && monSetId > FRONTIER_MONS_HIGH_TIER)
+ if (monLevel == 50 && monId > FRONTIER_MONS_HIGH_TIER)
continue;
for (j = 0; j < 6; j++)
{
- if (monSetId == gSaveBlock2Ptr->frontier.rentalMons[j].monId)
+ if (monId == gSaveBlock2Ptr->frontier.rentalMons[j].monId)
break;
}
if (j != 6)
@@ -741,7 +744,7 @@ void FillFactoryBrainParty(void)
for (k = 0; k < i; k++)
{
- if (species[k] == gFacilityTrainerMons[monSetId].species)
+ if (species[k] == gFacilityTrainerMons[monId].species)
break;
}
if (k != i)
@@ -749,35 +752,35 @@ void FillFactoryBrainParty(void)
for (k = 0; k < i; k++)
{
- if (heldItems[k] != 0 && heldItems[k] == gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId])
+ if (heldItems[k] != 0 && heldItems[k] == gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId])
break;
}
if (k != i)
continue;
- species[i] = gFacilityTrainerMons[monSetId].species;
- heldItems[i] = gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId];
+ species[i] = gFacilityTrainerMons[monId].species;
+ heldItems[i] = gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId];
CreateMonWithEVSpreadNatureOTID(&gEnemyParty[i],
- gFacilityTrainerMons[monSetId].species,
+ gFacilityTrainerMons[monId].species,
monLevel,
- gFacilityTrainerMons[monSetId].nature,
+ gFacilityTrainerMons[monId].nature,
fixedIV,
- gFacilityTrainerMons[monSetId].evSpread,
+ gFacilityTrainerMons[monId].evSpread,
otId);
friendship = 0;
for (k = 0; k < MAX_MON_MOVES; k++)
- SetMonMoveAvoidReturn(&gEnemyParty[i], gFacilityTrainerMons[monSetId].moves[k], k);
+ SetMonMoveAvoidReturn(&gEnemyParty[i], gFacilityTrainerMons[monId].moves[k], k);
SetMonData(&gEnemyParty[i], MON_DATA_FRIENDSHIP, &friendship);
- SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId]);
+ SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]);
i++;
}
}
-static u16 GetMonSetId(u8 lvlMode, u8 challengeNum, bool8 arg2)
+static u16 GetFactoryMonId(u8 lvlMode, u8 challengeNum, bool8 useBetterRange)
{
- u16 range, monSetId;
- u16 adder;
+ u16 numMons, monId;
+ u16 adder; // Used to skip past early mons for open level
if (lvlMode == FRONTIER_LVL_50)
adder = 0;
@@ -786,30 +789,31 @@ static u16 GetMonSetId(u8 lvlMode, u8 challengeNum, bool8 arg2)
if (challengeNum < 7)
{
- if (arg2)
+ if (useBetterRange)
{
- range = (sMonsToChooseFrom[adder + challengeNum + 1][1] - sMonsToChooseFrom[adder + challengeNum + 1][0]) + 1;
- monSetId = Random() % range;
- monSetId += sMonsToChooseFrom[adder + challengeNum + 1][0];
+ numMons = (sInitialRentalMonRanges[adder + challengeNum + 1][1] - sInitialRentalMonRanges[adder + challengeNum + 1][0]) + 1;
+ monId = Random() % numMons;
+ monId += sInitialRentalMonRanges[adder + challengeNum + 1][0];
}
else
{
- range = (sMonsToChooseFrom[adder + challengeNum][1] - sMonsToChooseFrom[adder + challengeNum][0]) + 1;
- monSetId = Random() % range;
- monSetId += sMonsToChooseFrom[adder + challengeNum][0];
+ numMons = (sInitialRentalMonRanges[adder + challengeNum][1] - sInitialRentalMonRanges[adder + challengeNum][0]) + 1;
+ monId = Random() % numMons;
+ monId += sInitialRentalMonRanges[adder + challengeNum][0];
}
}
else
{
- u16 num = challengeNum;
- if (num != 7)
- num = 7;
- range = (sMonsToChooseFrom[adder + num][1] - sMonsToChooseFrom[adder + num][0]) + 1;
- monSetId = Random() % range;
- monSetId += sMonsToChooseFrom[adder + num][0];
+ u16 challenge = challengeNum;
+ if (challenge != 7)
+ challenge = 7; // why bother assigning it above at all
+
+ numMons = (sInitialRentalMonRanges[adder + challenge][1] - sInitialRentalMonRanges[adder + challenge][0]) + 1;
+ monId = Random() % numMons;
+ monId += sInitialRentalMonRanges[adder + challenge][0];
}
- return monSetId;
+ return monId;
}
u8 GetNumPastRentalsRank(u8 battleMode, u8 lvlMode)
diff --git a/src/battle_factory_screen.c b/src/battle_factory_screen.c
index de2f3a10c..388881a1c 100644
--- a/src/battle_factory_screen.c
+++ b/src/battle_factory_screen.c
@@ -24,6 +24,7 @@
#include "pokedex.h"
#include "util.h"
#include "trainer_pokemon_sprites.h"
+#include "starter_choose.h"
#include "constants/battle_frontier.h"
#include "constants/songs.h"
#include "constants/rgb.h"
@@ -57,7 +58,7 @@
struct FactorySelecteableMon
{
- u16 monSetId;
+ u16 monId;
u16 spriteId;
u8 selectedId; // 0 - not selected, 1 - first pokemon, 2 - second pokemon, 3 - third pokemon
struct Pokemon monData;
@@ -132,8 +133,6 @@ struct FactorySwapMonsStruct
bool8 unk30;
};
-extern const u32 gUnknown_085B18AC[];
-
// This file's functions.
static void sub_819A44C(struct Sprite *sprite);
static void CB2_InitSelectScreen(void);
@@ -168,7 +167,7 @@ static u8 sub_819BC9C(void);
static u8 Select_OptionSummary(void);
static u8 Select_OptionOthers(void);
static u8 Select_OptionRentDeselect(void);
-static bool32 Select_AreSpeciesValid(u16 monSetId);
+static bool32 Select_AreSpeciesValid(u16 monId);
static void Swap_DestroyAllSprites(void);
static void Swap_ShowYesNoOptions(void);
static void sub_819E8EC(void);
@@ -263,7 +262,7 @@ static const struct SpriteSheet gUnknown_086103BC[] =
static const struct CompressedSpriteSheet gUnknown_086103E4[] =
{
- {gUnknown_085B18AC, 0x800, TAG_TILE_64},
+ {gPokeballSelection_Gfx, 0x800, TAG_TILE_64},
{},
};
@@ -616,7 +615,7 @@ static const struct SpriteSheet gUnknown_08610650[] =
static const struct CompressedSpriteSheet gUnknown_086106A0[] =
{
- {gUnknown_085B18AC, 0x800, TAG_TILE_64},
+ {gPokeballSelection_Gfx, 0x800, TAG_TILE_64},
{},
};
@@ -1665,7 +1664,7 @@ static void CreateFrontierFactorySelectableMons(u8 firstMonId)
u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
u8 challengeNum = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] / 7;
- u8 var_28 = 0;
+ u8 rentalRank = 0;
gFacilityTrainerMons = gBattleFrontierMons;
if (gSaveBlock2Ptr->frontier.lvlMode != FRONTIER_LVL_50)
@@ -1673,29 +1672,29 @@ static void CreateFrontierFactorySelectableMons(u8 firstMonId)
else
level = 50;
- var_28 = GetNumPastRentalsRank(battleMode, lvlMode);
+ rentalRank = GetNumPastRentalsRank(battleMode, lvlMode);
otId = T1_READ_32(gSaveBlock2Ptr->playerTrainerId);
for (i = 0; i < SELECTABLE_MONS_COUNT; i++)
{
- u16 monSetId = gSaveBlock2Ptr->frontier.rentalMons[i].monId;
- sFactorySelectScreen->mons[i + firstMonId].monSetId = monSetId;
- if (i < var_28)
+ u16 monId = gSaveBlock2Ptr->frontier.rentalMons[i].monId;
+ sFactorySelectScreen->mons[i + firstMonId].monId = monId;
+ if (i < rentalRank)
ivs = GetFactoryMonFixedIV(challengeNum + 1, 0);
else
ivs = GetFactoryMonFixedIV(challengeNum, 0);
CreateMonWithEVSpreadNatureOTID(&sFactorySelectScreen->mons[i + firstMonId].monData,
- gFacilityTrainerMons[monSetId].species,
+ gFacilityTrainerMons[monId].species,
level,
- gFacilityTrainerMons[monSetId].nature,
+ gFacilityTrainerMons[monId].nature,
ivs,
- gFacilityTrainerMons[monSetId].evSpread,
+ gFacilityTrainerMons[monId].evSpread,
otId);
happiness = 0;
for (j = 0; j < MAX_MON_MOVES; j++)
- SetMonMoveAvoidReturn(&sFactorySelectScreen->mons[i + firstMonId].monData, gFacilityTrainerMons[monSetId].moves[j], j);
+ SetMonMoveAvoidReturn(&sFactorySelectScreen->mons[i + firstMonId].monData, gFacilityTrainerMons[monId].moves[j], j);
SetMonData(&sFactorySelectScreen->mons[i + firstMonId].monData, MON_DATA_FRIENDSHIP, &happiness);
- SetMonData(&sFactorySelectScreen->mons[i + firstMonId].monData, MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId]);
+ SetMonData(&sFactorySelectScreen->mons[i + firstMonId].monData, MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]);
}
}
@@ -1712,20 +1711,20 @@ static void CreateTentFactorySelectableMons(u8 firstMonId)
for (i = 0; i < SELECTABLE_MONS_COUNT; i++)
{
- u16 monSetId = gSaveBlock2Ptr->frontier.rentalMons[i].monId;
- sFactorySelectScreen->mons[i + firstMonId].monSetId = monSetId;
+ u16 monId = gSaveBlock2Ptr->frontier.rentalMons[i].monId;
+ sFactorySelectScreen->mons[i + firstMonId].monId = monId;
CreateMonWithEVSpreadNatureOTID(&sFactorySelectScreen->mons[i + firstMonId].monData,
- gFacilityTrainerMons[monSetId].species,
+ gFacilityTrainerMons[monId].species,
level,
- gFacilityTrainerMons[monSetId].nature,
+ gFacilityTrainerMons[monId].nature,
ivs,
- gFacilityTrainerMons[monSetId].evSpread,
+ gFacilityTrainerMons[monId].evSpread,
otId);
happiness = 0;
for (j = 0; j < MAX_MON_MOVES; j++)
- SetMonMoveAvoidReturn(&sFactorySelectScreen->mons[i + firstMonId].monData, gFacilityTrainerMons[monSetId].moves[j], j);
+ SetMonMoveAvoidReturn(&sFactorySelectScreen->mons[i + firstMonId].monData, gFacilityTrainerMons[monId].moves[j], j);
SetMonData(&sFactorySelectScreen->mons[i + firstMonId].monData, MON_DATA_FRIENDSHIP, &happiness);
- SetMonData(&sFactorySelectScreen->mons[i + firstMonId].monData, MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId]);
+ SetMonData(&sFactorySelectScreen->mons[i + firstMonId].monData, MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monId].itemTableId]);
}
}
@@ -1740,7 +1739,7 @@ static void Select_CopyMonsToPlayerParty(void)
if (sFactorySelectScreen->mons[j].selectedId == i + 1)
{
gPlayerParty[i] = sFactorySelectScreen->mons[j].monData;
- gSaveBlock2Ptr->frontier.rentalMons[i].monId = sFactorySelectScreen->mons[j].monSetId;
+ gSaveBlock2Ptr->frontier.rentalMons[i].monId = sFactorySelectScreen->mons[j].monId;
gSaveBlock2Ptr->frontier.rentalMons[i].personality = GetMonData(&gPlayerParty[i], MON_DATA_PERSONALITY, NULL);
gSaveBlock2Ptr->frontier.rentalMons[i].abilityNum = GetBoxMonData(&gPlayerParty[i].box, MON_DATA_ABILITY_NUM, NULL);
gSaveBlock2Ptr->frontier.rentalMons[i].ivs = GetBoxMonData(&gPlayerParty[i].box, MON_DATA_ATK_IV, NULL);
@@ -1871,8 +1870,8 @@ static u8 Select_RunMenuOptionFunc(void)
static u8 Select_OptionRentDeselect(void)
{
u8 selectedId = sFactorySelectScreen->mons[sFactorySelectScreen->cursorPos].selectedId;
- u16 monSetId = sFactorySelectScreen->mons[sFactorySelectScreen->cursorPos].monSetId;
- if (selectedId == 0 && !Select_AreSpeciesValid(monSetId))
+ u16 monId = sFactorySelectScreen->mons[sFactorySelectScreen->cursorPos].monId;
+ if (selectedId == 0 && !Select_AreSpeciesValid(monId))
{
Select_PrintCantSelectSameMon();
sub_819B958(3);
@@ -2160,10 +2159,10 @@ static void Select_SetWinRegs(s16 mWin0H, s16 nWin0H, s16 mWin0V, s16 nWin0V)
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_CLR | WINOUT_WIN01_OBJ);
}
-static bool32 Select_AreSpeciesValid(u16 monSetId)
+static bool32 Select_AreSpeciesValid(u16 monId)
{
u8 i, j;
- u32 species = gFacilityTrainerMons[monSetId].species;
+ u32 species = gFacilityTrainerMons[monId].species;
u8 selectState = sFactorySelectScreen->selectingMonsState;
for (i = 1; i < selectState; i++)
@@ -2172,7 +2171,7 @@ static bool32 Select_AreSpeciesValid(u16 monSetId)
{
if (sFactorySelectScreen->mons[j].selectedId == i)
{
- if (gFacilityTrainerMons[sFactorySelectScreen->mons[j].monSetId].species == species)
+ if (gFacilityTrainerMons[sFactorySelectScreen->mons[j].monId].species == species)
return FALSE;
break;
diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c
index 50001cebe..54fc88f24 100644
--- a/src/battle_gfx_sfx_util.c
+++ b/src/battle_gfx_sfx_util.c
@@ -24,20 +24,21 @@
#include "contest.h"
#include "constants/songs.h"
#include "constants/rgb.h"
+#include "constants/battle_palace.h"
extern struct MusicPlayerInfo gMPlayInfo_SE1;
extern struct MusicPlayerInfo gMPlayInfo_SE2;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
-extern const u8 gUnknown_0831C604[];
+extern const u8 gBattlePalaceNatureToMoveTarget[];
extern const u8 * const gBattleAnims_General[];
extern const u8 * const gBattleAnims_Special[];
extern const struct CompressedSpriteSheet gSpriteSheet_EnemyShadow;
extern const struct SpriteTemplate gSpriteTemplate_EnemyShadow;
// this file's functions
-static u8 sub_805D4A8(u16 move);
-static u16 BattlePalaceGetTargetRetValue(void);
+static u8 GetBattlePalaceMoveGroup(u16 move);
+static u16 GetBattlePalaceTarget(void);
static void sub_805D7EC(struct Sprite *sprite);
static bool8 ShouldAnimBeDoneRegardlessOfSubsitute(u8 animId);
static void Task_ClearBitWhenBattleTableAnimDone(u8 taskId);
@@ -108,6 +109,7 @@ void FreeBattleSpritesData(void)
FREE_AND_SET_NULL(gBattleSpritesDataPtr);
}
+// Pokemon chooses move to use in Battle Palace rather than player
u16 ChooseMoveAndTargetInBattlePalace(void)
{
s32 i, var1, var2;
@@ -116,60 +118,88 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
u8 unusableMovesBits = CheckMoveLimitations(gActiveBattler, 0, 0xFF);
s32 percent = Random() % 100;
- i = (gBattleStruct->field_92 & gBitTable[gActiveBattler]) ? 2 : 0;
- var2 = i;
- var1 = i + 2;
-
- for (; i < var1; i++)
+ // Heavy variable re-use here makes this hard to read without defines
+ // Possibly just optimization? might still match with additional vars
+ #define maxGroupNum var1
+ #define minGroupNum var2
+ #define selectedGroup percent
+ #define selectedMoves var2
+ #define moveTarget var1
+ #define validMoveFlags var1
+ #define numValidMoveGroups var2
+ #define validMoveGroup var2
+
+ // If battler is < 50% HP and not asleep, use second set of move group likelihoods
+ // otherwise use first set
+ i = (gBattleStruct->palaceFlags & gBitTable[gActiveBattler]) ? 2 : 0;
+ minGroupNum = i;
+
+ maxGroupNum = i + 2; // + 2 because there are two percentages per set of likelihoods
+
+ // Each nature has a different percent chance to select a move from one of 3 move groups
+ // If percent is less than 1st check, use move from "Attack" group
+ // If percent is less than 2nd check, use move from "Defense" group
+ // Otherwise use move from "Support" group
+ for (; i < maxGroupNum; i++)
{
- if (gUnknown_0831C494[GetNatureFromPersonality(gBattleMons[gActiveBattler].personality)][i] > percent)
+ if (gBattlePalaceNatureToMoveGroupLikelihood[GetNatureFromPersonality(gBattleMons[gActiveBattler].personality)][i] > percent)
break;
}
+ selectedGroup = i - minGroupNum;
+ if (i == maxGroupNum)
+ selectedGroup = PALACE_MOVE_GROUP_SUPPORT;
- percent = i - var2;
- if (i == var1)
- percent = 2;
-
- for (var2 = 0, i = 0; i < MAX_MON_MOVES; i++)
+ // Flag moves that match selected group, to be passed to AI
+ for (selectedMoves = 0, i = 0; i < MAX_MON_MOVES; i++)
{
if (moveInfo->moves[i] == MOVE_NONE)
break;
- if (percent == sub_805D4A8(moveInfo->moves[i]) && moveInfo->currentPp[i] != 0)
- var2 |= gBitTable[i];
+ if (selectedGroup == GetBattlePalaceMoveGroup(moveInfo->moves[i]) && moveInfo->currentPp[i] != 0)
+ selectedMoves |= gBitTable[i];
}
- if (var2 != 0)
+ // Pass selected moves to AI, pick one
+ if (selectedMoves != 0)
{
- gBattleStruct->field_92 &= 0xF;
- gBattleStruct->field_92 |= (var2 << 4);
- BattleAI_SetupAIData(var2);
+ gBattleStruct->palaceFlags &= 0xF;
+ gBattleStruct->palaceFlags |= (selectedMoves << 4);
+ BattleAI_SetupAIData(selectedMoves);
chosenMoveId = BattleAI_ChooseMoveOrAction();
}
+ // If no moves matched the selected group, pick a new move from groups the pokemon has
+ // In this case the AI is not checked again, so the choice may be worse
+ // If a move is chosen this way, there's a 50% chance that it will be unable to use it anyway
if (chosenMoveId == -1)
{
if (unusableMovesBits != 0xF)
{
- var1 = 0, var2 = 0;
+ validMoveFlags = 0, numValidMoveGroups = 0;
for (i = 0; i < MAX_MON_MOVES; i++)
{
- if (sub_805D4A8(moveInfo->moves[i]) == 0 && !(gBitTable[i] & unusableMovesBits))
- var1 += 0x1;
- if (sub_805D4A8(moveInfo->moves[i]) == 1 && !(gBitTable[i] & unusableMovesBits))
- var1 += 0x10;
- if (sub_805D4A8(moveInfo->moves[i]) == 2 && !(gBitTable[i] & unusableMovesBits))
- var1 += 0x100;
+ // validMoveFlags is used here as a bitfield for which moves can be used for each move group type
+ // first 4 bits are for attack (1 for each move), then 4 bits for defense, and 4 for support
+ if (GetBattlePalaceMoveGroup(moveInfo->moves[i]) == PALACE_MOVE_GROUP_ATTACK && !(gBitTable[i] & unusableMovesBits))
+ validMoveFlags += (1 << 0);
+ if (GetBattlePalaceMoveGroup(moveInfo->moves[i]) == PALACE_MOVE_GROUP_DEFENSE && !(gBitTable[i] & unusableMovesBits))
+ validMoveFlags += (1 << 4);
+ if (GetBattlePalaceMoveGroup(moveInfo->moves[i]) == PALACE_MOVE_GROUP_SUPPORT && !(gBitTable[i] & unusableMovesBits))
+ validMoveFlags += (1 << 8);
}
- if ((var1 & 0xF) > 1)
- var2++;
- if ((var1 & 0xF0) > 0x1F)
- var2++;
- if ((var1 & 0xF0) > 0x1FF)
- var2++;
-
- if (var2 > 1 || var2 == 0)
+ // Count the move groups the pokemon has
+ if ((validMoveFlags & 0xF) > 1)
+ numValidMoveGroups++;
+ if ((validMoveFlags & 0xF0) > 0x1F)
+ numValidMoveGroups++;
+ if ((validMoveFlags & 0xF0) > 0x1FF)
+ numValidMoveGroups++;
+
+
+ // If more than 1 possible move group, or no possible move groups
+ // then choose move randomly
+ if (numValidMoveGroups > 1 || numValidMoveGroups == 0)
{
do
{
@@ -178,32 +208,35 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
chosenMoveId = i;
} while (chosenMoveId == -1);
}
+ // Otherwise randomly choose move of only available move group
else
{
- if ((var1 & 0xF) > 1)
- var2 = 0;
- if ((var1 & 0xF0) > 0x1F)
- var2 = 1;
- if ((var1 & 0xF0) > 0x1FF)
- var2 = 2;
+ if ((validMoveFlags & 0xF) > 1)
+ validMoveGroup = PALACE_MOVE_GROUP_ATTACK;
+ if ((validMoveFlags & 0xF0) > 0x1F)
+ validMoveGroup = PALACE_MOVE_GROUP_DEFENSE;
+ if ((validMoveFlags & 0xF0) > 0x1FF)
+ validMoveGroup = PALACE_MOVE_GROUP_SUPPORT;
do
{
i = Random() % MAX_MON_MOVES;
- if (!(gBitTable[i] & unusableMovesBits) && var2 == sub_805D4A8(moveInfo->moves[i]))
+ if (!(gBitTable[i] & unusableMovesBits) && validMoveGroup == GetBattlePalaceMoveGroup(moveInfo->moves[i]))
chosenMoveId = i;
} while (chosenMoveId == -1);
}
+ // If a move was selected (and in this case was not from the Nature-chosen group)
+ // then there's a 50% chance it won't be used anyway
if (Random() % 100 > 49)
{
- gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1;
+ gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE;
return 0;
}
}
else
{
- gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1;
+ gProtectStructs[gActiveBattler].palaceUnableToUseMove = TRUE;
return 0;
}
}
@@ -211,26 +244,35 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
if (moveInfo->moves[chosenMoveId] == MOVE_CURSE)
{
if (moveInfo->monType1 != TYPE_GHOST && moveInfo->monType2 != TYPE_GHOST)
- var1 = MOVE_TARGET_USER;
+ moveTarget = MOVE_TARGET_USER;
else
- var1 = MOVE_TARGET_SELECTED;
+ moveTarget = MOVE_TARGET_SELECTED;
}
else
{
- var1 = gBattleMoves[moveInfo->moves[chosenMoveId]].target;
+ moveTarget = gBattleMoves[moveInfo->moves[chosenMoveId]].target;
}
- if (var1 & MOVE_TARGET_USER)
+ if (moveTarget & MOVE_TARGET_USER)
chosenMoveId |= (gActiveBattler << 8);
- else if (var1 == MOVE_TARGET_SELECTED)
- chosenMoveId |= (BattlePalaceGetTargetRetValue());
+ else if (moveTarget == MOVE_TARGET_SELECTED)
+ chosenMoveId |= GetBattlePalaceTarget();
else
chosenMoveId |= (GetBattlerAtPosition((GetBattlerPosition(gActiveBattler) & BIT_SIDE) ^ BIT_SIDE) << 8);
return chosenMoveId;
}
-static u8 sub_805D4A8(u16 move)
+#undef maxGroupNum
+#undef minGroupNum
+#undef selectedGroup
+#undef selectedMoves
+#undef moveTarget
+#undef validMoveFlags
+#undef numValidMoveGroups
+#undef validMoveGroup
+
+static u8 GetBattlePalaceMoveGroup(u16 move)
{
switch (gBattleMoves[move].target)
{
@@ -240,21 +282,21 @@ static u8 sub_805D4A8(u16 move)
case MOVE_TARGET_BOTH:
case MOVE_TARGET_FOES_AND_ALLY:
if (gBattleMoves[move].power == 0)
- return 2;
+ return PALACE_MOVE_GROUP_SUPPORT;
else
- return 0;
+ return PALACE_MOVE_GROUP_ATTACK;
break;
case MOVE_TARGET_DEPENDS:
case MOVE_TARGET_OPPONENTS_FIELD:
- return 2;
+ return PALACE_MOVE_GROUP_SUPPORT;
case MOVE_TARGET_USER:
- return 1;
+ return PALACE_MOVE_GROUP_DEFENSE;
default:
- return 0;
+ return PALACE_MOVE_GROUP_ATTACK;
}
}
-static u16 BattlePalaceGetTargetRetValue(void)
+static u16 GetBattlePalaceTarget(void)
{
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
@@ -274,19 +316,19 @@ static u16 BattlePalaceGetTargetRetValue(void)
if (gBattleMons[opposing1].hp == gBattleMons[opposing2].hp)
return (((gActiveBattler & BIT_SIDE) ^ BIT_SIDE) + (Random() & 2)) << 8;
- switch (gUnknown_0831C604[GetNatureFromPersonality(gBattleMons[gActiveBattler].personality)])
+ switch (gBattlePalaceNatureToMoveTarget[GetNatureFromPersonality(gBattleMons[gActiveBattler].personality)])
{
- case 0:
+ case PALACE_TARGET_STRONGER:
if (gBattleMons[opposing1].hp > gBattleMons[opposing2].hp)
return opposing1 << 8;
else
return opposing2 << 8;
- case 1:
+ case PALACE_TARGET_WEAKER:
if (gBattleMons[opposing1].hp < gBattleMons[opposing2].hp)
return opposing1 << 8;
else
return opposing2 << 8;
- case 2:
+ case PALACE_TARGET_RANDOM:
return (((gActiveBattler & BIT_SIDE) ^ BIT_SIDE) + (Random() & 2)) << 8;
}
}
diff --git a/src/battle_main.c b/src/battle_main.c
index e3eea60d0..1d8aeab53 100644
--- a/src/battle_main.c
+++ b/src/battle_main.c
@@ -96,7 +96,7 @@ static void SpriteCb_WildMonShowHealthbox(struct Sprite *sprite);
static void SpriteCb_WildMonAnimate(struct Sprite *sprite);
static void sub_80398D0(struct Sprite *sprite);
static void SpriteCB_AnimFaintOpponent(struct Sprite *sprite);
-static void sub_8039AF4(struct Sprite *sprite);
+static void SpriteCb_BlinkVisible(struct Sprite *sprite);
static void SpriteCallbackDummy_3(struct Sprite *sprite);
static void oac_poke_ally_(struct Sprite *sprite);
static void SpecialStatusesClear(void);
@@ -995,7 +995,7 @@ static void CB2_HandleStartBattle(void)
sub_8036A5C();
SetPlayerBerryDataInBattleStruct();
- if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00)
+ if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM)
{
gLinkPlayers[0].id = 0;
gLinkPlayers[1].id = 1;
@@ -2798,31 +2798,31 @@ static void SpriteCB_AnimFaintOpponent(struct Sprite *sprite)
}
}
-void sub_8039AD8(struct Sprite *sprite)
+// Used when selecting a move, which can hit multiple targets, in double battles.
+void SpriteCb_ShowAsMoveTarget(struct Sprite *sprite)
{
sprite->data[3] = 8;
sprite->data[4] = sprite->invisible;
- sprite->callback = sub_8039AF4;
+ sprite->callback = SpriteCb_BlinkVisible;
}
-static void sub_8039AF4(struct Sprite *sprite)
+static void SpriteCb_BlinkVisible(struct Sprite *sprite)
{
- sprite->data[3]--;
- if (sprite->data[3] == 0)
+ if (--sprite->data[3] == 0)
{
sprite->invisible ^= 1;
sprite->data[3] = 8;
}
}
-void sub_8039B2C(struct Sprite *sprite)
+void SpriteCb_HideAsMoveTarget(struct Sprite *sprite)
{
sprite->invisible = sprite->data[4];
sprite->data[4] = FALSE;
sprite->callback = SpriteCallbackDummy_2;
}
-void sub_8039B58(struct Sprite *sprite)
+void SpriteCb_OpponentMonFromBall(struct Sprite *sprite)
{
if (sprite->affineAnimEnded)
{
@@ -2965,7 +2965,7 @@ static void SpriteCB_BounceEffect(struct Sprite *sprite)
#undef sBouncerSpriteId
#undef sWhich
-void sub_8039E44(struct Sprite *sprite)
+void SpriteCb_PlayerMonFromBall(struct Sprite *sprite)
{
if (sprite->affineAnimEnded)
BattleAnimateBackSprite(sprite, sprite->sSpeciesId);
@@ -3112,7 +3112,7 @@ static void BattleStartClearSetData(void)
}
gBattleStruct->givenExpMons = 0;
- gBattleStruct->field_92 = 0;
+ gBattleStruct->palaceFlags = 0;
gRandomTurnNumber = Random();
@@ -3159,7 +3159,7 @@ void SwitchInClearSetData(void)
&& (gDisableStructs[i].battlerWithSureHit == gActiveBattler))
{
gStatuses3[i] &= ~(STATUS3_ALWAYS_HITS);
- gStatuses3[i] |= 0x10;
+ gStatuses3[i] |= STATUS3_ALWAYS_HITS_TURN(2);
}
}
}
@@ -3214,7 +3214,7 @@ void SwitchInClearSetData(void)
*(3 * 2 + gActiveBattler * 8 + (u8*)(gBattleStruct->lastTakenMoveFrom) + 0) = 0;
*(3 * 2 + gActiveBattler * 8 + (u8*)(gBattleStruct->lastTakenMoveFrom) + 1) = 0;
- gBattleStruct->field_92 &= ~(gBitTable[gActiveBattler]);
+ gBattleStruct->palaceFlags &= ~(gBitTable[gActiveBattler]);
for (i = 0; i < gBattlersCount; i++)
{
@@ -3309,7 +3309,7 @@ void FaintClearSetData(void)
*(3 * 2 + gActiveBattler * 8 + (u8*)(gBattleStruct->lastTakenMoveFrom) + 0) = 0;
*(3 * 2 + gActiveBattler * 8 + (u8*)(gBattleStruct->lastTakenMoveFrom) + 1) = 0;
- gBattleStruct->field_92 &= ~(gBitTable[gActiveBattler]);
+ gBattleStruct->palaceFlags &= ~(gBitTable[gActiveBattler]);
for (i = 0; i < gBattlersCount; i++)
{
@@ -4052,7 +4052,7 @@ void BattleTurnPassed(void)
gRandomTurnNumber = Random();
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
- BattleScriptExecute(BattleScript_82DB881);
+ BattleScriptExecute(BattleScript_PalacePrintFlavorText);
else if (gBattleTypeFlags & BATTLE_TYPE_ARENA && gBattleStruct->arenaTurnCounter == 0)
BattleScriptExecute(BattleScript_ArenaTurnBeginning);
}
@@ -5547,7 +5547,7 @@ static void HandleAction_UseItem(void)
ClearFuryCutterDestinyBondGrudge(gBattlerAttacker);
gLastUsedItem = gBattleBufferB[gBattlerAttacker][1] | (gBattleBufferB[gBattlerAttacker][2] << 8);
- if (gLastUsedItem <= ITEM_PREMIER_BALL) // is ball
+ if (gLastUsedItem <= LAST_BALL) // is ball
{
gBattlescriptCurrInstr = gBattlescriptsForBallThrow[gLastUsedItem];
}
diff --git a/src/battle_message.c b/src/battle_message.c
index efa4500c8..2a0ba4ded 100644
--- a/src/battle_message.c
+++ b/src/battle_message.c
@@ -312,23 +312,23 @@ static const u8 sText_StatsWontIncrease2[] = _("{B_ATK_NAME_WITH_PREFIX}'s stats
static const u8 sText_StatsWontDecrease2[] = _("{B_DEF_NAME_WITH_PREFIX}'s stats won't\ngo any lower!");
static const u8 sText_CriticalHit[] = _("A critical hit!");
static const u8 sText_OneHitKO[] = _("It's a one-hit KO!");
-static const u8 sText_123Poof[] = _("{PAUSE 32}1, {PAUSE 15}2, and{PAUSE 15}… {PAUSE 15}… {PAUSE 15}… {PAUSE 15}{PLAY_SE 0x0038}Poof!\p");
+static const u8 sText_123Poof[] = _("{PAUSE 32}1, {PAUSE 15}2, and{PAUSE 15}… {PAUSE 15}… {PAUSE 15}… {PAUSE 15}{PLAY_SE SE_KON}Poof!\p");
static const u8 sText_AndEllipsis[] = _("And…\p");
static const u8 sText_HMMovesCantBeForgotten[] = _("HM moves can't be\nforgotten now.\p");
static const u8 sText_NotVeryEffective[] = _("It's not very effective…");
static const u8 sText_SuperEffective[] = _("It's super effective!");
-static const u8 sText_GotAwaySafely[] = _("{PLAY_SE 0x0011}Got away safely!\p");
-static const u8 sText_PkmnFledUsingIts[] = _("{PLAY_SE 0x0011}{B_ATK_NAME_WITH_PREFIX} fled\nusing its {B_LAST_ITEM}!\p");
-static const u8 sText_PkmnFledUsing[] = _("{PLAY_SE 0x0011}{B_ATK_NAME_WITH_PREFIX} fled\nusing {B_ATK_ABILITY}!\p");
-static const u8 sText_WildPkmnFled[] = _("{PLAY_SE 0x0011}Wild {B_BUFF1} fled!");
+static const u8 sText_GotAwaySafely[] = _("{PLAY_SE SE_NIGERU}Got away safely!\p");
+static const u8 sText_PkmnFledUsingIts[] = _("{PLAY_SE SE_NIGERU}{B_ATK_NAME_WITH_PREFIX} fled\nusing its {B_LAST_ITEM}!\p");
+static const u8 sText_PkmnFledUsing[] = _("{PLAY_SE SE_NIGERU}{B_ATK_NAME_WITH_PREFIX} fled\nusing {B_ATK_ABILITY}!\p");
+static const u8 sText_WildPkmnFled[] = _("{PLAY_SE SE_NIGERU}Wild {B_BUFF1} fled!");
static const u8 sText_PlayerDefeatedLinkTrainer[] = _("Player defeated\n{B_LINK_OPPONENT1_NAME}!");
static const u8 sText_TwoLinkTrainersDefeated[] = _("Player beat {B_LINK_OPPONENT1_NAME}\nand {B_LINK_OPPONENT2_NAME}!");
static const u8 sText_PlayerLostAgainstLinkTrainer[] = _("Player lost against\n{B_LINK_OPPONENT1_NAME}!");
static const u8 sText_PlayerLostToTwo[] = _("Player lost to {B_LINK_OPPONENT1_NAME}\nand {B_LINK_OPPONENT2_NAME}!");
static const u8 sText_PlayerBattledToDrawLinkTrainer[] = _("Player battled to a draw against\n{B_LINK_OPPONENT1_NAME}!");
static const u8 sText_PlayerBattledToDrawVsTwo[] = _("Player battled to a draw against\n{B_LINK_OPPONENT1_NAME} and {B_LINK_OPPONENT2_NAME}!");
-static const u8 sText_WildFled[] = _("{PLAY_SE 0x0011}{B_LINK_OPPONENT1_NAME} fled!");
-static const u8 sText_TwoWildFled[] = _("{PLAY_SE 0x0011}{B_LINK_OPPONENT1_NAME} and\n{B_LINK_OPPONENT2_NAME} fled!");
+static const u8 sText_WildFled[] = _("{PLAY_SE SE_NIGERU}{B_LINK_OPPONENT1_NAME} fled!");
+static const u8 sText_TwoWildFled[] = _("{PLAY_SE SE_NIGERU}{B_LINK_OPPONENT1_NAME} and\n{B_LINK_OPPONENT2_NAME} fled!");
static const u8 sText_NoRunningFromTrainers[] = _("No! There's no running\nfrom a TRAINER battle!\p");
static const u8 sText_CantEscape[] = _("Can't escape!\p");
static const u8 sText_DontLeaveBirch[] = _("PROF. BIRCH: Don't leave me like this!\p");
@@ -378,7 +378,7 @@ static const u8 sText_PkmnCuriousAboutX[] = _("{B_OPPONENT_MON1_NAME} is curious
static const u8 sText_PkmnEnthralledByX[] = _("{B_OPPONENT_MON1_NAME} is enthralled by\nthe {B_BUFF1}!");
static const u8 sText_PkmnIgnoredX[] = _("{B_OPPONENT_MON1_NAME} completely ignored\nthe {B_BUFF1}!");
static const u8 sText_ThrewPokeblockAtPkmn[] = _("{B_PLAYER_NAME} threw a {POKEBLOCK}\nat the {B_OPPONENT_MON1_NAME}!");
-static const u8 sText_OutOfSafariBalls[] = _("{PLAY_SE 0x0049}ANNOUNCER: You're out of\nSAFARI BALLS! Game over!\p");
+static const u8 sText_OutOfSafariBalls[] = _("{PLAY_SE SE_PINPON}ANNOUNCER: You're out of\nSAFARI BALLS! Game over!\p");
static const u8 sText_OpponentMon1Appeared[] = _("{B_OPPONENT_MON1_NAME} appeared!\p");
static const u8 sText_WildPkmnAppeared[] = _("Wild {B_OPPONENT_MON1_NAME} appeared!\p");
static const u8 sText_WildPkmnAppeared2[] = _("Wild {B_OPPONENT_MON1_NAME} appeared!\p");
@@ -1267,10 +1267,12 @@ static const u8 sText_PkmnGettingIntoPosition[] = _("{B_SCR_ACTIVE_NAME_WITH_PRE
static const u8 sText_PkmnBeganGrowlingDeeply[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} began growling deeply!");
static const u8 sText_PkmnEagerForMore[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} is eager for more!");
-const u16 gStringIds_85CCF0A[] =
+const u16 gBattlePalaceFlavorTextTable[] =
{
- STRINGID_GLINTAPPEARSINEYE, STRINGID_PKMNGETTINGINTOPOSITION,
- STRINGID_PKMNBEGANGROWLINGDEEPLY, STRINGID_PKMNEAGERFORMORE
+ STRINGID_GLINTAPPEARSINEYE,
+ STRINGID_PKMNGETTINGINTOPOSITION,
+ STRINGID_PKMNBEGANGROWLINGDEEPLY,
+ STRINGID_PKMNEAGERFORMORE
};
static const u8 sText_RefIfNothingIsDecided[] = _("REFEREE: If nothing is decided in\n3 turns, we will go to judging!");
@@ -1303,7 +1305,7 @@ static const u8 sText_QuestionForfeitMatch[] = _("Would you like to forfeit the
static const u8 sText_ForfeitedMatch[] = _("{B_PLAYER_NAME} forfeited the match!");
static const u8 sText_Trainer1WinText[] = _("{B_TRAINER1_WIN_TEXT}");
static const u8 sText_Trainer2WinText[] = _("{B_TRAINER2_WIN_TEXT}");
-static const u8 sText_Trainer1Fled[] = _( "{PLAY_SE 0x0011}{B_TRAINER1_CLASS} {B_TRAINER1_NAME} fled!");
+static const u8 sText_Trainer1Fled[] = _( "{PLAY_SE SE_NIGERU}{B_TRAINER1_CLASS} {B_TRAINER1_NAME} fled!");
static const u8 sText_PlayerLostAgainstTrainer1[] = _("Player lost against\n{B_TRAINER1_CLASS} {B_TRAINER1_NAME}!");
static const u8 sText_PlayerBattledToDrawTrainer1[] = _("Player battled to a draw against\n{B_TRAINER1_CLASS} {B_TRAINER1_NAME}!");
const u8 gText_RecordBattleToPass[] = _("Would you like to record your battle\non your FRONTIER PASS?");
@@ -1981,7 +1983,7 @@ void BufferStringBattle(u16 stringID)
}
else
{
- if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00)
+ if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM)
stringPtr = sText_Trainer1WantsToBattle;
else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
stringPtr = sText_LinkTrainerWantsToBattlePause;
@@ -2049,7 +2051,7 @@ void BufferStringBattle(u16 stringID)
{
if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)))
stringPtr = sText_Trainer1SentOutPkmn;
- else if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00)
+ else if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM)
stringPtr = sText_Trainer1SentOutPkmn;
else
stringPtr = sText_LinkTrainerSentOutPkmn;
@@ -2110,7 +2112,7 @@ void BufferStringBattle(u16 stringID)
{
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
stringPtr = sText_LinkTrainerMultiSentOutPkmn;
- else if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00)
+ else if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM)
stringPtr = sText_Trainer1SentOutPkmn2;
else
stringPtr = sText_LinkTrainerSentOutPkmn2;
@@ -2180,7 +2182,7 @@ void BufferStringBattle(u16 stringID)
break;
}
}
- else if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00)
+ else if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM)
{
switch (gBattleTextBuff1[0])
{
@@ -2495,8 +2497,8 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
case B_TXT_TRAINER1_CLASS: // trainer class name
if (gBattleTypeFlags & BATTLE_TYPE_SECRET_BASE)
toCpy = gTrainerClassNames[GetSecretBaseTrainerClass()];
- else if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00)
- toCpy = gTrainerClassNames[sub_8068BB0()];
+ else if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM)
+ toCpy = gTrainerClassNames[GetUnionRoomTrainerClass()];
else if (gTrainerBattleOpponent_A == TRAINER_FRONTIER_BRAIN)
toCpy = gTrainerClassNames[GetFrontierBrainTrainerClass()];
else if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER)
@@ -2517,7 +2519,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst)
ConvertInternationalString(text, gBattleResources->secretBase->language);
toCpy = text;
}
- else if (gTrainerBattleOpponent_A == TRAINER_OPPONENT_C00)
+ else if (gTrainerBattleOpponent_A == TRAINER_UNION_ROOM)
{
toCpy = gLinkPlayers[multiplayerId ^ BIT_SIDE].name;
}
diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c
index 84f2b1f4d..4e0e087b6 100644
--- a/src/battle_script_commands.c
+++ b/src/battle_script_commands.c
@@ -606,111 +606,66 @@ static const struct StatFractions sAccuracyStageRatios[] =
// The chance is 1/N for each stage.
static const u16 sCriticalHitChance[] = {16, 8, 4, 3, 2};
-static const u32 sStatusFlagsForMoveEffects[] =
-{
- 0x00000000,
- STATUS1_SLEEP,
- STATUS1_POISON,
- STATUS1_BURN,
- STATUS1_FREEZE,
- STATUS1_PARALYSIS,
- STATUS1_TOXIC_POISON,
- STATUS2_CONFUSION,
- STATUS2_FLINCHED,
- 0x00000000,
- STATUS2_UPROAR,
- 0x00000000,
- STATUS2_MULTIPLETURNS,
- STATUS2_WRAPPED,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- STATUS2_RECHARGE,
- 0x00000000,
- 0x00000000,
- STATUS2_ESCAPE_PREVENTION,
- STATUS2_NIGHTMARE,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- STATUS2_LOCK_CONFUSE,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000,
- 0x00000000
+static const u32 sStatusFlagsForMoveEffects[NUM_MOVE_EFFECTS] =
+{
+ [MOVE_EFFECT_SLEEP] = STATUS1_SLEEP,
+ [MOVE_EFFECT_POISON] = STATUS1_POISON,
+ [MOVE_EFFECT_BURN] = STATUS1_BURN,
+ [MOVE_EFFECT_FREEZE] = STATUS1_FREEZE,
+ [MOVE_EFFECT_PARALYSIS] = STATUS1_PARALYSIS,
+ [MOVE_EFFECT_TOXIC] = STATUS1_TOXIC_POISON,
+ [MOVE_EFFECT_CONFUSION] = STATUS2_CONFUSION,
+ [MOVE_EFFECT_FLINCH] = STATUS2_FLINCHED,
+ [MOVE_EFFECT_UPROAR] = STATUS2_UPROAR,
+ [MOVE_EFFECT_CHARGING] = STATUS2_MULTIPLETURNS,
+ [MOVE_EFFECT_WRAP] = STATUS2_WRAPPED,
+ [MOVE_EFFECT_RECHARGE] = STATUS2_RECHARGE,
+ [MOVE_EFFECT_PREVENT_ESCAPE] = STATUS2_ESCAPE_PREVENTION,
+ [MOVE_EFFECT_NIGHTMARE] = STATUS2_NIGHTMARE,
+ [MOVE_EFFECT_THRASH] = STATUS2_LOCK_CONFUSE,
};
static const u8* const sMoveEffectBS_Ptrs[] =
{
- [0] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_SLEEP] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_POISON] = BattleScript_MoveEffectPoison,
- [MOVE_EFFECT_BURN] = BattleScript_MoveEffectBurn,
- [MOVE_EFFECT_FREEZE] = BattleScript_MoveEffectFreeze,
- [MOVE_EFFECT_PARALYSIS] = BattleScript_MoveEffectParalysis,
- [MOVE_EFFECT_TOXIC] = BattleScript_MoveEffectToxic,
- [MOVE_EFFECT_CONFUSION] = BattleScript_MoveEffectConfusion,
- [MOVE_EFFECT_FLINCH] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_TRI_ATTACK] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_UPROAR] = BattleScript_MoveEffectUproar,
- [MOVE_EFFECT_PAYDAY] = BattleScript_MoveEffectPayDay,
- [MOVE_EFFECT_CHARGING] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_WRAP] = BattleScript_MoveEffectWrap,
- [MOVE_EFFECT_RECOIL_25] = BattleScript_MoveEffectRecoil,
- [MOVE_EFFECT_ATK_PLUS_1] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_DEF_PLUS_1] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_SPD_PLUS_1] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_SP_ATK_PLUS_1] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_SP_DEF_PLUS_1] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_ACC_PLUS_1] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_EVS_PLUS_1] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_ATK_MINUS_1] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_DEF_MINUS_1] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_SPD_MINUS_1] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_SP_ATK_MINUS_1] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_SP_DEF_MINUS_1] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_ACC_MINUS_1] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_EVS_MINUS_1] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_RECHARGE] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_RAGE] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_STEAL_ITEM] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_PREVENT_ESCAPE] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_NIGHTMARE] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_ALL_STATS_UP] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_RAPIDSPIN] = BattleScript_MoveEffectSleep,
+ [0] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_SLEEP] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_POISON] = BattleScript_MoveEffectPoison,
+ [MOVE_EFFECT_BURN] = BattleScript_MoveEffectBurn,
+ [MOVE_EFFECT_FREEZE] = BattleScript_MoveEffectFreeze,
+ [MOVE_EFFECT_PARALYSIS] = BattleScript_MoveEffectParalysis,
+ [MOVE_EFFECT_TOXIC] = BattleScript_MoveEffectToxic,
+ [MOVE_EFFECT_CONFUSION] = BattleScript_MoveEffectConfusion,
+ [MOVE_EFFECT_FLINCH] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_TRI_ATTACK] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_UPROAR] = BattleScript_MoveEffectUproar,
+ [MOVE_EFFECT_PAYDAY] = BattleScript_MoveEffectPayDay,
+ [MOVE_EFFECT_CHARGING] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_WRAP] = BattleScript_MoveEffectWrap,
+ [MOVE_EFFECT_RECOIL_25] = BattleScript_MoveEffectRecoil,
+ [MOVE_EFFECT_ATK_PLUS_1] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_DEF_PLUS_1] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_SPD_PLUS_1] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_SP_ATK_PLUS_1] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_SP_DEF_PLUS_1] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_ACC_PLUS_1] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_EVS_PLUS_1] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_ATK_MINUS_1] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_DEF_MINUS_1] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_SPD_MINUS_1] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_SP_ATK_MINUS_1] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_SP_DEF_MINUS_1] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_ACC_MINUS_1] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_EVS_MINUS_1] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_RECHARGE] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_RAGE] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_STEAL_ITEM] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_PREVENT_ESCAPE] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_NIGHTMARE] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_ALL_STATS_UP] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_RAPIDSPIN] = BattleScript_MoveEffectSleep,
[MOVE_EFFECT_REMOVE_PARALYSIS] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_ATK_DEF_DOWN] = BattleScript_MoveEffectSleep,
- [MOVE_EFFECT_RECOIL_33] = BattleScript_MoveEffectRecoil,
+ [MOVE_EFFECT_ATK_DEF_DOWN] = BattleScript_MoveEffectSleep,
+ [MOVE_EFFECT_RECOIL_33] = BattleScript_MoveEffectRecoil,
};
static const struct WindowTemplate sUnusedWinTemplate = {0, 1, 3, 7, 0xF, 0x1F, 0x3F};
@@ -797,16 +752,16 @@ static const u8 sFlailHpScaleToPowerTable[] =
static const u16 sNaturePowerMoves[] =
{
- MOVE_STUN_SPORE,
- MOVE_RAZOR_LEAF,
- MOVE_EARTHQUAKE,
- MOVE_HYDRO_PUMP,
- MOVE_SURF,
- MOVE_BUBBLE_BEAM,
- MOVE_ROCK_SLIDE,
- MOVE_SHADOW_BALL,
- MOVE_SWIFT,
- MOVE_SWIFT
+ [BATTLE_TERRAIN_GRASS] = MOVE_STUN_SPORE,
+ [BATTLE_TERRAIN_LONG_GRASS] = MOVE_RAZOR_LEAF,
+ [BATTLE_TERRAIN_SAND] = MOVE_EARTHQUAKE,
+ [BATTLE_TERRAIN_UNDERWATER] = MOVE_HYDRO_PUMP,
+ [BATTLE_TERRAIN_WATER] = MOVE_SURF,
+ [BATTLE_TERRAIN_POND] = MOVE_BUBBLE_BEAM,
+ [BATTLE_TERRAIN_MOUNTAIN] = MOVE_ROCK_SLIDE,
+ [BATTLE_TERRAIN_CAVE] = MOVE_SHADOW_BALL,
+ [BATTLE_TERRAIN_BUILDING] = MOVE_SWIFT,
+ [BATTLE_TERRAIN_PLAIN] = MOVE_SWIFT
};
// format: min. weight (hectograms), base power
@@ -864,58 +819,92 @@ static const u8 sPickupProbabilities[] =
static const u8 sTerrainToType[] =
{
- TYPE_GRASS, // tall grass
- TYPE_GRASS, // long grass
- TYPE_GROUND, // sand
- TYPE_WATER, // underwater
- TYPE_WATER, // water
- TYPE_WATER, // pond water
- TYPE_ROCK, // rock
- TYPE_ROCK, // cave
- TYPE_NORMAL, // building
- TYPE_NORMAL, // plain
+ [BATTLE_TERRAIN_GRASS] = TYPE_GRASS,
+ [BATTLE_TERRAIN_LONG_GRASS] = TYPE_GRASS,
+ [BATTLE_TERRAIN_SAND] = TYPE_GROUND,
+ [BATTLE_TERRAIN_UNDERWATER] = TYPE_WATER,
+ [BATTLE_TERRAIN_WATER] = TYPE_WATER,
+ [BATTLE_TERRAIN_POND] = TYPE_WATER,
+ [BATTLE_TERRAIN_MOUNTAIN] = TYPE_ROCK,
+ [BATTLE_TERRAIN_CAVE] = TYPE_ROCK,
+ [BATTLE_TERRAIN_BUILDING] = TYPE_NORMAL,
+ [BATTLE_TERRAIN_PLAIN] = TYPE_NORMAL,
};
+// - ITEM_ULTRA_BALL skips Master Ball and ITEM_NONE
static const u8 sBallCatchBonuses[] =
{
- 20, 15, 10, 15 // Ultra, Great, Poke, Safari
+ [ITEM_ULTRA_BALL - ITEM_ULTRA_BALL] = 20,
+ [ITEM_GREAT_BALL - ITEM_ULTRA_BALL] = 15,
+ [ITEM_POKE_BALL - ITEM_ULTRA_BALL] = 10,
+ [ITEM_SAFARI_BALL - ITEM_ULTRA_BALL] = 15
};
-const ALIGNED(4) u8 gUnknown_0831C494[][4] =
-{
- {0x3d, 0x44, 0x3d, 0x44},
- {0x14, 0x2d, 0x54, 0x5c},
- {0x46, 0x55, 0x20, 0x5c},
- {0x26, 0x45, 0x46, 0x55},
- {0x14, 0x5a, 0x46, 0x5c},
- {0x1e, 0x32, 0x20, 0x5a},
- {0x38, 0x4e, 0x38, 0x4e},
- {0x19, 0x28, 0x4b, 0x5a},
- {0x45, 0x4b, 0x1c, 0x53},
- {0x23, 0x2d, 0x1d, 0x23},
- {0x3e, 0x48, 0x1e, 0x32},
- {0x3a, 0x5f, 0x58, 0x5e},
- {0x22, 0x2d, 0x1d, 0x28},
- {0x23, 0x28, 0x23, 0x5f},
- {0x38, 0x4e, 0x38, 0x4e},
- {0x23, 0x50, 0x22, 0x5e},
- {0x2c, 0x5e, 0x22, 0x28},
- {0x38, 0x4e, 0x38, 0x4e},
- {0x1e, 0x58, 0x1e, 0x58},
- {0x1e, 0x2b, 0x1b, 0x21},
- {0x28, 0x5a, 0x19, 0x57},
- {0x12, 0x58, 0x5a, 0x5f},
- {0x58, 0x5e, 0x16, 0x2a},
- {0x2a, 0x5c, 0x2a, 0x2f},
- {0x38, 0x4e, 0x38, 0x4e}
+// In Battle Palace, moves are chosen based on the pokemons nature rather than by the player
+// Moves are grouped into "Attack", "Defense", or "Support" (see PALACE_MOVE_GROUP_*)
+// Each nature has a certain percent chance of selecting a move from a particular group
+// and a separate percent chance for each group when below 50% HP
+// The table below doesn't list percentages for Support because you can subtract the other two
+// Support percentages are listed in comments off to the side instead
+#define PALACE_STYLE(atk, def, atkLow, defLow) {atk, atk + def, atkLow, atkLow + defLow}
+
+const ALIGNED(4) u8 gBattlePalaceNatureToMoveGroupLikelihood[NUM_NATURES][4] =
+{
+ [NATURE_HARDY] = PALACE_STYLE(61, 7, 61, 7), // 32% support >= 50% HP, 32% support < 50% HP
+ [NATURE_LONELY] = PALACE_STYLE(20, 25, 84, 8), // 55%, 8%
+ [NATURE_BRAVE] = PALACE_STYLE(70, 15, 32, 60), // 15%, 8%
+ [NATURE_ADAMANT] = PALACE_STYLE(38, 31, 70, 15), // 31%, 15%
+ [NATURE_NAUGHTY] = PALACE_STYLE(20, 70, 70, 22), // 10%, 8%
+ [NATURE_BOLD] = PALACE_STYLE(30, 20, 32, 58), // 50%, 10%
+ [NATURE_DOCILE] = PALACE_STYLE(56, 22, 56, 22), // 22%, 22%
+ [NATURE_RELAXED] = PALACE_STYLE(25, 15, 75, 15), // 60%, 10%
+ [NATURE_IMPISH] = PALACE_STYLE(69, 6, 28, 55), // 25%, 17%
+ [NATURE_LAX] = PALACE_STYLE(35, 10, 29, 6), // 55%, 65%
+ [NATURE_TIMID] = PALACE_STYLE(62, 10, 30, 20), // 28%, 50%
+ [NATURE_HASTY] = PALACE_STYLE(58, 37, 88, 6), // 5%, 6%
+ [NATURE_SERIOUS] = PALACE_STYLE(34, 11, 29, 11), // 55%, 60%
+ [NATURE_JOLLY] = PALACE_STYLE(35, 5, 35, 60), // 60%, 5%
+ [NATURE_NAIVE] = PALACE_STYLE(56, 22, 56, 22), // 22%, 22%
+ [NATURE_MODEST] = PALACE_STYLE(35, 45, 34, 60), // 20%, 6%
+ [NATURE_MILD] = PALACE_STYLE(44, 50, 34, 6), // 6%, 60%
+ [NATURE_QUIET] = PALACE_STYLE(56, 22, 56, 22), // 22%, 22%
+ [NATURE_BASHFUL] = PALACE_STYLE(30, 58, 30, 58), // 12%, 12%
+ [NATURE_RASH] = PALACE_STYLE(30, 13, 27, 6), // 57%, 67%
+ [NATURE_CALM] = PALACE_STYLE(40, 50, 25, 62), // 10%, 13%
+ [NATURE_GENTLE] = PALACE_STYLE(18, 70, 90, 5), // 12%, 5%
+ [NATURE_SASSY] = PALACE_STYLE(88, 6, 22, 20), // 6%, 58%
+ [NATURE_CAREFUL] = PALACE_STYLE(42, 50, 42, 5), // 8%, 53%
+ [NATURE_QUIRKY] = PALACE_STYLE(56, 22, 56, 22) // 22%, 22%
};
-static const u8 sUnknown_0831C4F8[] =
-{
- 0x03, 0x00, 0x01, 0x00, 0x00, 0x01, 0x03, 0x00,
- 0x01, 0x02, 0x02, 0x00, 0x03, 0x01, 0x03, 0x01,
- 0x02, 0x03, 0x03, 0x02, 0x01, 0x00, 0x02, 0x02,
- 0x03, 0x00, 0x00, 0x00
+// Indices into gBattlePalaceFlavorTextTable
+static const u8 sBattlePalaceNatureToFlavorTextId[NUM_NATURES] =
+{
+ [NATURE_HARDY] = 3,
+ [NATURE_LONELY] = 0,
+ [NATURE_BRAVE] = 1,
+ [NATURE_ADAMANT] = 0,
+ [NATURE_NAUGHTY] = 0,
+ [NATURE_BOLD] = 1,
+ [NATURE_DOCILE] = 3,
+ [NATURE_RELAXED] = 0,
+ [NATURE_IMPISH] = 1,
+ [NATURE_LAX] = 2,
+ [NATURE_TIMID] = 2,
+ [NATURE_HASTY] = 0,
+ [NATURE_SERIOUS] = 3,
+ [NATURE_JOLLY] = 1,
+ [NATURE_NAIVE] = 3,
+ [NATURE_MODEST] = 1,
+ [NATURE_MILD] = 2,
+ [NATURE_QUIET] = 3,
+ [NATURE_BASHFUL] = 3,
+ [NATURE_RASH] = 2,
+ [NATURE_CALM] = 1,
+ [NATURE_GENTLE] = 0,
+ [NATURE_SASSY] = 2,
+ [NATURE_CAREFUL] = 2,
+ [NATURE_QUIRKY] = 3,
};
static void Cmd_attackcanceler(void)
@@ -2245,7 +2234,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
if (gBattleMons[gEffectBattler].status2 & STATUS2_SUBSTITUTE && affectsUser != MOVE_EFFECT_AFFECTS_USER)
INCREMENT_RESET_RETURN
- if (gBattleCommunication[MOVE_EFFECT_BYTE] <= 6) // status change
+ if (gBattleCommunication[MOVE_EFFECT_BYTE] <= PRIMARY_STATUS_MOVE_EFFECT)
{
switch (sStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]])
{
@@ -2453,7 +2442,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
BattleScriptPush(gBattlescriptCurrInstr + 1);
if (sStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]] == STATUS1_SLEEP)
- gBattleMons[gEffectBattler].status1 |= ((Random() & 3) + 2);
+ gBattleMons[gEffectBattler].status1 |= STATUS1_SLEEP_TURN((Random() & 3) + 2); // 2-5 turns
else
gBattleMons[gEffectBattler].status1 |= sStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]];
@@ -2513,7 +2502,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
}
else
{
- gBattleMons[gEffectBattler].status2 |= (((Random()) % 0x4)) + 2;
+ gBattleMons[gEffectBattler].status2 |= STATUS2_CONFUSION_TURN(((Random()) % 4) + 2); // 2-5 turns
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleCommunication[MOVE_EFFECT_BYTE]];
@@ -2546,7 +2535,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
gBattleMons[gEffectBattler].status2 |= STATUS2_MULTIPLETURNS;
gLockedMoves[gEffectBattler] = gCurrentMove;
- gBattleMons[gEffectBattler].status2 |= ((Random() & 3) + 2) << 4;
+ gBattleMons[gEffectBattler].status2 |= STATUS2_UPROAR_TURN((Random() & 3) + 2); // 2-5 turns
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleCommunication[MOVE_EFFECT_BYTE]];
@@ -2591,7 +2580,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
}
else
{
- gBattleMons[gEffectBattler].status2 |= ((Random() & 3) + 3) << 0xD;
+ gBattleMons[gEffectBattler].status2 |= STATUS2_WRAPPED_TURN((Random() & 3) + 3); // 3-6 turns
*(gBattleStruct->wrappedMove + gEffectBattler * 2 + 0) = gCurrentMove;
*(gBattleStruct->wrappedMove + gEffectBattler * 2 + 1) = gCurrentMove >> 8;
@@ -2834,7 +2823,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
{
gBattleMons[gEffectBattler].status2 |= STATUS2_MULTIPLETURNS;
gLockedMoves[gEffectBattler] = gCurrentMove;
- gBattleMons[gEffectBattler].status2 |= (((Random() & 1) + 2) << 0xA);
+ gBattleMons[gEffectBattler].status2 |= STATUS2_LOCK_CONFUSE_TURN((Random() & 1) + 2); // thrash for 2-3 turns
}
break;
case MOVE_EFFECT_KNOCK_OFF:
@@ -2929,7 +2918,7 @@ static void Cmd_clearstatusfromeffect(void)
{
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
- if (gBattleCommunication[MOVE_EFFECT_BYTE] <= MOVE_EFFECT_TOXIC)
+ if (gBattleCommunication[MOVE_EFFECT_BYTE] <= PRIMARY_STATUS_MOVE_EFFECT)
gBattleMons[gActiveBattler].status1 &= (~sStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]]);
else
gBattleMons[gActiveBattler].status2 &= (~sStatusFlagsForMoveEffects[gBattleCommunication[MOVE_EFFECT_BYTE]]);
@@ -3482,7 +3471,7 @@ static void Cmd_getexp(void)
else
{
gBattleStruct->expGetterMonId++;
- if (gBattleStruct->expGetterMonId <= 5)
+ if (gBattleStruct->expGetterMonId < PARTY_SIZE)
gBattleScripting.getexpState = 2; // loop again
else
gBattleScripting.getexpState = 6; // we're done
@@ -3552,13 +3541,13 @@ static void Cmd_unknown_24(void)
// Impossible to decompile loops.
for (foundPlayer = 0, i = 0; i < gBattlersCount; i += 2)
{
- if (HITMARKER_UNK(i) & gHitMarker && !gSpecialStatuses[i].flag40)
+ if (HITMARKER_FAINTED2(i) & gHitMarker && !gSpecialStatuses[i].flag40)
foundPlayer++;
}
for (foundOpponent = 0, i = 1; i < gBattlersCount; i += 2)
{
- if (HITMARKER_UNK(i) & gHitMarker && !gSpecialStatuses[i].flag40)
+ if (HITMARKER_FAINTED2(i) & gHitMarker && !gSpecialStatuses[i].flag40)
foundOpponent++;
}
@@ -4914,10 +4903,12 @@ static void Cmd_switchindataupdate(void)
SwitchInClearSetData();
- if (gBattleTypeFlags & BATTLE_TYPE_PALACE && gBattleMons[gActiveBattler].maxHP / 2 >= gBattleMons[gActiveBattler].hp
- && gBattleMons[gActiveBattler].hp != 0 && !(gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP))
+ if (gBattleTypeFlags & BATTLE_TYPE_PALACE
+ && gBattleMons[gActiveBattler].maxHP / 2 >= gBattleMons[gActiveBattler].hp
+ && gBattleMons[gActiveBattler].hp != 0
+ && !(gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP))
{
- gBattleStruct->field_92 |= gBitTable[gActiveBattler];
+ gBattleStruct->palaceFlags |= gBitTable[gActiveBattler];
}
gBattleScripting.battler = gActiveBattler;
@@ -5101,7 +5092,7 @@ static void Cmd_jumpifcantswitch(void)
break;
}
- if (i == 6)
+ if (i == PARTY_SIZE)
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
else
gBattlescriptCurrInstr += 6;
@@ -6588,11 +6579,11 @@ static void Cmd_various(void)
case VARIOUS_GET_MOVE_TARGET:
gBattlerTarget = GetMoveTarget(gCurrentMove, 0);
break;
- case 4:
+ case VARIOUS_GET_BATTLER_FAINTED:
if (gHitMarker & HITMARKER_FAINTED(gActiveBattler))
- gBattleCommunication[0] = 1;
+ gBattleCommunication[0] = TRUE;
else
- gBattleCommunication[0] = 0;
+ gBattleCommunication[0] = FALSE;
break;
case VARIOUS_RESET_INTIMIDATE_TRACE_BITS:
gSpecialStatuses[gActiveBattler].intimidatedMon = 0;
@@ -6628,17 +6619,19 @@ static void Cmd_various(void)
gHitMarker &= ~(HITMARKER_x400000);
}
break;
- case 8:
- gBattleCommunication[0] = 0;
+ case VARIOUS_PALACE_FLAVOR_TEXT:
+ // Try and print end-of-turn Battle Palace flavor text (e.g. "A glint appears in mon's eyes")
+ gBattleCommunication[0] = FALSE; // whether or not msg should be printed
gBattleScripting.battler = gActiveBattler = gBattleCommunication[1];
- if (!(gBattleStruct->field_92 & gBitTable[gActiveBattler])
+
+ if (!(gBattleStruct->palaceFlags & gBitTable[gActiveBattler])
&& gBattleMons[gActiveBattler].maxHP / 2 >= gBattleMons[gActiveBattler].hp
&& gBattleMons[gActiveBattler].hp != 0
&& !(gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP))
{
- gBattleStruct->field_92 |= gBitTable[gActiveBattler];
- gBattleCommunication[0] = 1;
- gBattleCommunication[MULTISTRING_CHOOSER] = sUnknown_0831C4F8[GetNatureFromPersonality(gBattleMons[gActiveBattler].personality)];
+ gBattleStruct->palaceFlags |= gBitTable[gActiveBattler];
+ gBattleCommunication[0] = TRUE;
+ gBattleCommunication[MULTISTRING_CHOOSER] = sBattlePalaceNatureToFlavorTextId[GetNatureFromPersonality(gBattleMons[gActiveBattler].personality)];
}
break;
case VARIOUS_ARENA_JUDGMENT_WINDOW:
@@ -7368,7 +7361,7 @@ static void Cmd_setbide(void)
gBattleMons[gBattlerAttacker].status2 |= STATUS2_MULTIPLETURNS;
gLockedMoves[gBattlerAttacker] = gCurrentMove;
gTakenDmg[gBattlerAttacker] = 0;
- gBattleMons[gBattlerAttacker].status2 |= (STATUS2_BIDE - 0x100); // 2 turns
+ gBattleMons[gBattlerAttacker].status2 |= STATUS2_BIDE_TURN(2);
gBattlescriptCurrInstr++;
}
@@ -8326,7 +8319,7 @@ static void Cmd_settypetorandomresistance(void) // conversion 2
static void Cmd_setalwayshitflag(void)
{
gStatuses3[gBattlerTarget] &= ~(STATUS3_ALWAYS_HITS);
- gStatuses3[gBattlerTarget] |= 0x10;
+ gStatuses3[gBattlerTarget] |= STATUS3_ALWAYS_HITS_TURN(2);
gDisableStructs[gBattlerTarget].battlerWithSureHit = gBattlerAttacker;
gBattlescriptCurrInstr++;
}
@@ -9145,7 +9138,7 @@ static void Cmd_trydobeatup(void)
else
{
u8 beforeLoop = gBattleCommunication[0];
- for (;gBattleCommunication[0] < 6; gBattleCommunication[0]++)
+ for (;gBattleCommunication[0] < PARTY_SIZE; gBattleCommunication[0]++)
{
if (GetMonData(&party[gBattleCommunication[0]], MON_DATA_HP)
&& GetMonData(&party[gBattleCommunication[0]], MON_DATA_SPECIES2)
@@ -9153,7 +9146,7 @@ static void Cmd_trydobeatup(void)
&& !GetMonData(&party[gBattleCommunication[0]], MON_DATA_STATUS))
break;
}
- if (gBattleCommunication[0] < 6)
+ if (gBattleCommunication[0] < PARTY_SIZE)
{
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattlerAttacker, gBattleCommunication[0])
@@ -9520,7 +9513,7 @@ static void Cmd_setyawn(void)
}
else
{
- gStatuses3[gBattlerTarget] |= 0x1000;
+ gStatuses3[gBattlerTarget] |= STATUS3_YAWN_TURN(2);
gBattlescriptCurrInstr += 5;
}
}
@@ -9654,7 +9647,7 @@ static void Cmd_assistattackselect(void)
else
party = gPlayerParty;
- for (monId = 0; monId < 6; monId++)
+ for (monId = 0; monId < PARTY_SIZE; monId++)
{
if (monId == gBattlerPartyIndexes[gBattlerAttacker])
continue;
@@ -9865,7 +9858,7 @@ static void Cmd_pickup(void)
if (lvlDivBy10 > 9)
lvlDivBy10 = 9;
- for (j = 0; j < 9; j++)
+ for (j = 0; j < (int)ARRAY_COUNT(sPickupProbabilities); j++)
{
if (sPickupProbabilities[j] > rand)
{
@@ -10134,7 +10127,7 @@ static void Cmd_handleballthrow(void)
}
}
else
- ballMultiplier = sBallCatchBonuses[gLastUsedItem - 2];
+ ballMultiplier = sBallCatchBonuses[gLastUsedItem - ITEM_ULTRA_BALL];
odds = (catchRate * ballMultiplier / 10)
* (gBattleMons[gBattlerTarget].maxHP * 3 - gBattleMons[gBattlerTarget].hp * 2)
@@ -10436,7 +10429,7 @@ static void Cmd_trygivecaughtmonnick(void)
}
break;
case 4:
- if (CalculatePlayerPartyCount() == 6)
+ if (CalculatePlayerPartyCount() == PARTY_SIZE)
gBattlescriptCurrInstr += 5;
else
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
diff --git a/src/battle_util.c b/src/battle_util.c
index da3d50648..9cc2252b6 100644
--- a/src/battle_util.c
+++ b/src/battle_util.c
@@ -864,9 +864,9 @@ u8 DoBattlerEndTurnEffects(void)
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
- if ((gBattleMons[gActiveBattler].status1 & 0xF00) != 0xF00) // not 16 turns
- gBattleMons[gActiveBattler].status1 += 0x100;
- gBattleMoveDamage *= (gBattleMons[gActiveBattler].status1 & 0xF00) >> 8;
+ if ((gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_COUNTER) != STATUS1_TOXIC_TURN(15)) // not 16 turns
+ gBattleMons[gActiveBattler].status1 += STATUS1_TOXIC_TURN(1);
+ gBattleMoveDamage *= (gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_COUNTER) >> 8;
BattleScriptExecute(BattleScript_PoisonTurnDmg);
effect++;
}
@@ -917,7 +917,7 @@ u8 DoBattlerEndTurnEffects(void)
case ENDTURN_WRAP: // wrap
if ((gBattleMons[gActiveBattler].status2 & STATUS2_WRAPPED) && gBattleMons[gActiveBattler].hp != 0)
{
- gBattleMons[gActiveBattler].status2 -= 0x2000;
+ gBattleMons[gActiveBattler].status2 -= STATUS2_WRAPPED_TURN(1);
if (gBattleMons[gActiveBattler].status2 & STATUS2_WRAPPED) // damaged by wrap
{
// This is the only way I could get this array access to match.
@@ -973,7 +973,7 @@ u8 DoBattlerEndTurnEffects(void)
else
{
gBattlerAttacker = gActiveBattler;
- gBattleMons[gActiveBattler].status2 -= 0x10; // uproar timer goes down
+ gBattleMons[gActiveBattler].status2 -= STATUS2_UPROAR_TURN(1);
if (WasUnableToUseMove(gActiveBattler))
{
CancelMultiTurnMoves(gActiveBattler);
@@ -999,7 +999,7 @@ u8 DoBattlerEndTurnEffects(void)
case ENDTURN_THRASH: // thrash
if (gBattleMons[gActiveBattler].status2 & STATUS2_LOCK_CONFUSE)
{
- gBattleMons[gActiveBattler].status2 -= 0x400;
+ gBattleMons[gActiveBattler].status2 -= STATUS2_LOCK_CONFUSE_TURN(1);
if (WasUnableToUseMove(gActiveBattler))
CancelMultiTurnMoves(gActiveBattler);
else if (!(gBattleMons[gActiveBattler].status2 & STATUS2_LOCK_CONFUSE)
@@ -1062,7 +1062,7 @@ u8 DoBattlerEndTurnEffects(void)
break;
case ENDTURN_LOCK_ON: // lock-on decrement
if (gStatuses3[gActiveBattler] & STATUS3_ALWAYS_HITS)
- gStatuses3[gActiveBattler] -= 0x8;
+ gStatuses3[gActiveBattler] -= STATUS3_ALWAYS_HITS_TURN(1);
gBattleStruct->turnEffectsTracker++;
break;
case ENDTURN_CHARGE: // charge
@@ -1078,13 +1078,13 @@ u8 DoBattlerEndTurnEffects(void)
case ENDTURN_YAWN: // yawn
if (gStatuses3[gActiveBattler] & STATUS3_YAWN)
{
- gStatuses3[gActiveBattler] -= 0x800;
+ gStatuses3[gActiveBattler] -= STATUS3_YAWN_TURN(1);
if (!(gStatuses3[gActiveBattler] & STATUS3_YAWN) && !(gBattleMons[gActiveBattler].status1 & STATUS1_ANY)
&& gBattleMons[gActiveBattler].ability != ABILITY_VITAL_SPIRIT
&& gBattleMons[gActiveBattler].ability != ABILITY_INSOMNIA && !UproarWakeUpCheck(gActiveBattler))
{
CancelMultiTurnMoves(gActiveBattler);
- gBattleMons[gActiveBattler].status1 |= (Random() & 3) + 2;
+ gBattleMons[gActiveBattler].status1 |= STATUS1_SLEEP_TURN((Random() & 3) + 2); // 2-5 turns of sleep
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
MarkBattlerForControllerExec(gActiveBattler);
gEffectBattler = gActiveBattler;
@@ -1478,7 +1478,7 @@ u8 AtkCanceller_UnableToUseMove(void)
case CANCELLER_CONFUSED: // confusion
if (gBattleMons[gBattlerAttacker].status2 & STATUS2_CONFUSION)
{
- gBattleMons[gBattlerAttacker].status2--;
+ gBattleMons[gBattlerAttacker].status2 -= STATUS2_CONFUSION_TURN(1);
if (gBattleMons[gBattlerAttacker].status2 & STATUS2_CONFUSION)
{
if (Random() & 1)
@@ -1540,7 +1540,7 @@ u8 AtkCanceller_UnableToUseMove(void)
case CANCELLER_BIDE: // bide
if (gBattleMons[gBattlerAttacker].status2 & STATUS2_BIDE)
{
- gBattleMons[gBattlerAttacker].status2 -= 0x100;
+ gBattleMons[gBattlerAttacker].status2 -= STATUS2_BIDE_TURN(1);
if (gBattleMons[gBattlerAttacker].status2 & STATUS2_BIDE)
{
gBattlescriptCurrInstr = BattleScript_BideStoringEnergy;
diff --git a/src/berry.c b/src/berry.c
index fe4a66af6..98264f37b 100644
--- a/src/berry.c
+++ b/src/berry.c
@@ -997,7 +997,7 @@ struct BerryTree *GetBerryTreeInfo(u8 id)
bool32 ObjectEventInteractionWaterBerryTree(void)
{
- struct BerryTree *tree = GetBerryTreeInfo(ObjectEventGetBerryTreeId(gSelectedObjectEvent));
+ struct BerryTree *tree = GetBerryTreeInfo(GetObjectEventBerryTreeId(gSelectedObjectEvent));
switch (tree->stage)
{
@@ -1022,7 +1022,7 @@ bool32 ObjectEventInteractionWaterBerryTree(void)
bool8 IsPlayerFacingEmptyBerryTreePatch(void)
{
if (GetObjectEventScriptPointerPlayerFacing() == BerryTreeScript
- && GetStageByBerryTreeId(ObjectEventGetBerryTreeId(gSelectedObjectEvent)) == BERRY_STAGE_NO_BERRY)
+ && GetStageByBerryTreeId(GetObjectEventBerryTreeId(gSelectedObjectEvent)) == BERRY_STAGE_NO_BERRY)
return TRUE;
else
return FALSE;
@@ -1260,7 +1260,7 @@ void ObjectEventInteractionGetBerryTreeData(void)
u8 group;
u8 num;
- id = ObjectEventGetBerryTreeId(gSelectedObjectEvent);
+ id = GetObjectEventBerryTreeId(gSelectedObjectEvent);
berry = GetBerryTypeByBerryTreeId(id);
ResetBerryTreeSparkleFlag(id);
localId = gSpecialVar_LastTalked;
@@ -1277,13 +1277,13 @@ void ObjectEventInteractionGetBerryTreeData(void)
void ObjectEventInteractionGetBerryName(void)
{
- u8 berryType = GetBerryTypeByBerryTreeId(ObjectEventGetBerryTreeId(gSelectedObjectEvent));
+ u8 berryType = GetBerryTypeByBerryTreeId(GetObjectEventBerryTreeId(gSelectedObjectEvent));
GetBerryNameByBerryType(berryType, gStringVar1);
}
void ObjectEventInteractionGetBerryCountString(void)
{
- u8 treeId = ObjectEventGetBerryTreeId(gSelectedObjectEvent);
+ u8 treeId = GetObjectEventBerryTreeId(gSelectedObjectEvent);
u8 berry = GetBerryTypeByBerryTreeId(treeId);
u8 count = GetBerryCountByBerryTreeId(treeId);
GetBerryCountStringByBerryType(berry, gStringVar1, count);
@@ -1298,13 +1298,13 @@ void ObjectEventInteractionPlantBerryTree(void)
{
u8 berry = ItemIdToBerryType(gSpecialVar_ItemId);
- PlantBerryTree(ObjectEventGetBerryTreeId(gSelectedObjectEvent), berry, 1, TRUE);
+ PlantBerryTree(GetObjectEventBerryTreeId(gSelectedObjectEvent), berry, 1, TRUE);
ObjectEventInteractionGetBerryTreeData();
}
void ObjectEventInteractionPickBerryTree(void)
{
- u8 id = ObjectEventGetBerryTreeId(gSelectedObjectEvent);
+ u8 id = GetObjectEventBerryTreeId(gSelectedObjectEvent);
u8 berry = GetBerryTypeByBerryTreeId(id);
gSpecialVar_0x8004 = AddBagItem(BerryTypeToItemId(berry), GetBerryCountByBerryTreeId(id));
@@ -1312,7 +1312,7 @@ void ObjectEventInteractionPickBerryTree(void)
void ObjectEventInteractionRemoveBerryTree(void)
{
- RemoveBerryTree(ObjectEventGetBerryTreeId(gSelectedObjectEvent));
+ RemoveBerryTree(GetObjectEventBerryTreeId(gSelectedObjectEvent));
sub_8092EF0(gSpecialVar_LastTalked, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
}
diff --git a/src/berry_blender.c b/src/berry_blender.c
index 2a122541d..a2a96c089 100644
--- a/src/berry_blender.c
+++ b/src/berry_blender.c
@@ -1246,7 +1246,7 @@ static void sub_8080018(void)
if (++sBerryBlenderData->framesToWait > 20)
{
ClearDialogWindowAndFrameToTransparent(4, TRUE);
- if (GetBlockReceivedStatus() == sub_800A9D8())
+ if (GetBlockReceivedStatus() == GetLinkPlayerCountAsBitFlags())
{
for (i = 0; i < GetLinkPlayerCount(); i++)
{
@@ -1500,7 +1500,7 @@ static void sub_80808D4(void)
switch (sBerryBlenderData->mainState)
{
case 0:
- sub_800B4C0();
+ SetWirelessCommType0();
sub_8080588();
Blender_SetParticipantBerryData(0, gSpecialVar_ItemId);
Blender_CopyBerryData(&sBerryBlenderData->blendedBerries[0], gSpecialVar_ItemId);
@@ -1664,7 +1664,7 @@ static void sub_80808D4(void)
static void sub_8080DF8(void)
{
s32 i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < CMD_LENGTH / 2; i++)
{
gSendCmd[0] = 0;
gSendCmd[2] = 0;
@@ -2202,6 +2202,11 @@ static s16 sub_8081BD4(void)
return sUnknown_03000E06;
}
+#if MODERN
+// TODO remove this as soon as the code below is understood
+// add a UBFIX if required (code buggy?)
+__attribute__((optimize("no-aggressive-loop-optimizations")))
+#endif
static void Blender_CalculatePokeblock(struct BlenderBerry *berries, struct Pokeblock *pokeblock, u8 playersNo, u8 *flavors, u16 maxRPM)
{
s32 i, j;
diff --git a/src/berry_crush.c b/src/berry_crush.c
index 48e4ac4c3..90a299a74 100755
--- a/src/berry_crush.c
+++ b/src/berry_crush.c
@@ -832,7 +832,7 @@ u32 sub_8020C0C(MainCallback callback)
return 0;
}
-void sub_8020C70(MainCallback callback)
+void StartBerryCrush(MainCallback callback)
{
u8 playerCount = 0;
u8 multiplayerId;
@@ -842,7 +842,7 @@ void sub_8020C70(MainCallback callback)
SetMainCallback2(callback);
Rfu.unk_10 = 0;
Rfu.unk_12 = 0;
- Rfu.unk_ee = 1;
+ Rfu.errorState = 1;
return;
}
@@ -853,7 +853,7 @@ void sub_8020C70(MainCallback callback)
SetMainCallback2(callback);
Rfu.unk_10 = 0;
Rfu.unk_12 = 0;
- Rfu.unk_ee = 1;
+ Rfu.errorState = 1;
return;
}
@@ -863,7 +863,7 @@ void sub_8020C70(MainCallback callback)
SetMainCallback2(callback);
Rfu.unk_10 = 0;
Rfu.unk_12 = 0;
- Rfu.unk_ee = 1;
+ Rfu.errorState = 1;
return;
}
@@ -3013,10 +3013,10 @@ static u32 sub_8024134(struct BerryCrushGame *r5, u8 *r4)
DrawDialogueFrame(0, 0);
AddTextPrinterParameterized2(0, 1, gText_SavingDontTurnOffPower, 0, 0, 2, 1, 3);
CopyWindowToVram(0, 3);
- CreateTask(sub_8153688, 0);
+ CreateTask(Task_LinkSave, 0);
break;
case 3:
- if (FuncIsActiveTask(sub_8153688))
+ if (FuncIsActiveTask(Task_LinkSave))
return 0;
break;
case 4:
@@ -3209,6 +3209,11 @@ static u32 sub_8024568(__attribute__((unused)) struct BerryCrushGame *r0, __attr
return 0;
}
+#if MODERN
+// TODO remove this as soon as the code below is understood
+// add a UBFIX if required (code buggy?)
+__attribute__((optimize("no-aggressive-loop-optimizations")))
+#endif
void sub_8024578(struct BerryCrushGame *r4)
{
u8 r5 = 0;
diff --git a/src/bike.c b/src/bike.c
index cd24d2487..3685ebfad 100644
--- a/src/bike.c
+++ b/src/bike.c
@@ -7,7 +7,6 @@
#include "metatile_behavior.h"
#include "overworld.h"
#include "sound.h"
-#include "constants/flags.h"
#include "constants/map_types.h"
#include "constants/songs.h"
diff --git a/src/braille_puzzles.c b/src/braille_puzzles.c
index c00be82ad..f9f06823a 100644
--- a/src/braille_puzzles.c
+++ b/src/braille_puzzles.c
@@ -6,7 +6,6 @@
#include "sound.h"
#include "task.h"
#include "constants/field_effects.h"
-#include "constants/flags.h"
#include "constants/maps.h"
#include "constants/songs.h"
#include "constants/species.h"
diff --git a/src/cable_club.c b/src/cable_club.c
index b9c948a9c..15e468390 100644
--- a/src/cable_club.c
+++ b/src/cable_club.c
@@ -33,8 +33,9 @@
#include "constants/battle_frontier.h"
#include "constants/cable_club.h"
#include "constants/songs.h"
+#include "constants/trainers.h"
-static const struct WindowTemplate gUnknown_08550594 = {
+static const struct WindowTemplate sWindowTemplate_LinkPlayerCount = {
.bg = 0,
.tilemapLeft = 16,
.tilemapTop = 11,
@@ -43,57 +44,67 @@ static const struct WindowTemplate gUnknown_08550594 = {
.paletteNum = 15,
.baseBlock = 0x0125,
};
-static const u8 *const gTrainerCardColorNames[] = {
+
+static const u8 *const sTrainerCardColorNames[] = {
gText_BronzeCard,
gText_CopperCard,
gText_SilverCard,
gText_GoldCard
};
-static void sub_80B2634(u8 taskId);
-static void sub_80B2688(u8 taskId);
-static void sub_80B270C(u8 taskId);
-static void sub_80B275C(u8 taskId);
-static void sub_80B2804(u8 taskId);
-static void sub_80B28A8(u8 taskId);
-static void sub_80B2918(u8 taskId);
-static void sub_80B2A08(u8 taskId);
-static void sub_80B2C30(u8 taskId);
-static void sub_80B2CB0(u8 taskId);
-static void sub_80B2CEC(u8 taskId);
-static void sub_80B2D2C(u8 taskId);
-static bool8 sub_80B2D6C(u8 taskId);
-static void sub_80B2EE4(u8 taskId);
-static void sub_80B3144(u8 taskId);
-static void sub_80B3194(u8 taskId);
-static void sub_80B31E8(u8 taskId);
-static void sub_80B3220(u8 taskId);
-
-static void sub_80B236C(u8 arg0, u8 arg1)
+static void Task_LinkupStart(u8 taskId);
+static void Task_LinkupAwaitConnection(u8 taskId);
+static void Task_LinkupConfirmWhenReady(u8 taskId);
+static void Task_LinkupAwaitConfirmation(u8 taskId);
+static void Task_LinkupTryConfirmation(u8 taskId);
+static void Task_LinkupConfirm(u8 taskId);
+static void Task_LinkupExchangeDataWithLeader(u8 taskId);
+static void Task_LinkupCheckStatusAfterConfirm(u8 taskId);
+static void Task_LinkupAwaitTrainerCardData(u8 taskId);
+static void Task_StopLinkup(u8 taskId);
+static void Task_LinkupFailed(u8 taskId);
+static void Task_LinkupConnectionError(u8 taskId);
+static bool8 TryLinkTimeout(u8 taskId);
+static void Task_ValidateMixingGameLanguage(u8 taskId);
+static void Task_ReestablishLink(u8 taskId);
+static void Task_ReestablishLinkAwaitConnection(u8 taskId);
+static void Task_ReestablishLinkLeader(u8 taskId);
+static void Task_ReestablishLinkAwaitConfirmation(u8 taskId);
+
+#define tState data[0]
+
+
+#define tMinPlayers data[1]
+#define tMaxPlayers data[2]
+#define tNumPlayers data[3]
+#define tTimer data[4]
+#define tWindowId data[5]
+
+static void CreateLinkupTask(u8 minPlayers, u8 maxPlayers)
{
- if (FindTaskIdByFunc(sub_80B2634) == 0xFF)
+ if (FindTaskIdByFunc(Task_LinkupStart) == 0xFF)
{
u8 taskId1;
- taskId1 = CreateTask(sub_80B2634, 80);
- gTasks[taskId1].data[1] = arg0;
- gTasks[taskId1].data[2] = arg1;
+ taskId1 = CreateTask(Task_LinkupStart, 80);
+ gTasks[taskId1].tMinPlayers = minPlayers;
+ gTasks[taskId1].tMaxPlayers = maxPlayers;
}
}
-static void sub_80B23B0(u16 windowId, u32 value)
+static void PrintNumPlayersInLink(u16 windowId, u32 numPlayers)
{
u8 xPos;
- ConvertIntToDecimalStringN(gStringVar1, value, STR_CONV_MODE_LEFT_ALIGN, 1);
+ ConvertIntToDecimalStringN(gStringVar1, numPlayers, STR_CONV_MODE_LEFT_ALIGN, 1);
SetStandardWindowBorderStyle(windowId, 0);
- StringExpandPlaceholders(gStringVar4, gText_XPLink);
+ StringExpandPlaceholders(gStringVar4, gText_NumPlayerLink);
xPos = GetStringCenterAlignXOffset(1, gStringVar4, 88);
AddTextPrinterParameterized(windowId, 1, gStringVar4, xPos, 1, 0xFF, NULL);
CopyWindowToVram(windowId, 3);
}
-static void sub_80B241C(u16 windowId)
+static void ClearLinkPlayerCountWindow(u16 windowId)
{
// Following this call with a copy-to-vram with mode 3 is identical to
// calling ClearStdWindowAndFrame(windowId, TRUE).
@@ -101,68 +112,68 @@ static void sub_80B241C(u16 windowId)
CopyWindowToVram(windowId, 3);
}
-static void sub_80B243C(u8 taskId, u8 arg1)
+static void UpdateLinkPlayerCountDisplay(u8 taskId, u8 numPlayers)
{
s16 *data = gTasks[taskId].data;
- if (arg1 != data[3])
+ if (numPlayers != tNumPlayers)
{
- if (arg1 <= 1)
- sub_80B241C(data[5]);
+ if (numPlayers <= 1)
+ ClearLinkPlayerCountWindow(tWindowId);
else
- sub_80B23B0(data[5], arg1);
- data[3] = arg1;
+ PrintNumPlayersInLink(tWindowId, numPlayers);
+ tNumPlayers = numPlayers;
}
}
-static u32 sub_80B2478(u8 lower, u8 upper)
+static u32 ExchangeDataAndGetLinkupStatus(u8 minPlayers, u8 maxPlayers)
{
int playerCount;
- switch (GetLinkPlayerDataExchangeStatusTimed(lower, upper))
+ switch (GetLinkPlayerDataExchangeStatusTimed(minPlayers, maxPlayers))
{
case EXCHANGE_COMPLETE:
- return 1;
- case EXCHANGE_IN_PROGRESS:
- return 3;
+ return LINKUP_SUCCESS;
+ case EXCHANGE_DIFF_SELECTIONS:
+ return LINKUP_DIFF_SELECTIONS;
case EXCHANGE_PLAYER_NOT_READY:
- return 7;
+ return LINKUP_PLAYER_NOT_READY;
case EXCHANGE_PARTNER_NOT_READY:
- return 9;
- case EXCHANGE_STAT_6:
+ return LINKUP_PARTNER_NOT_READY;
+ case EXCHANGE_WRONG_NUM_PLAYERS:
ConvertIntToDecimalStringN(gStringVar1, GetLinkPlayerCount_2(), STR_CONV_MODE_LEFT_ALIGN, 1);
- return 4;
+ return LINKUP_WRONG_NUM_PLAYERS;
case EXCHANGE_STAT_7:
- return 10;
+ return LINKUP_FAILED_CONTEST_GMODE;
case EXCHANGE_TIMED_OUT:
default:
- return 0;
+ return LINKUP_ONGOING;
}
}
-static bool32 sub_80B24F8(u8 taskId)
+static bool32 CheckLinkErrored(u8 taskId)
{
if (HasLinkErrorOccurred() == TRUE)
{
- gTasks[taskId].func = sub_80B2D2C;
+ gTasks[taskId].func = Task_LinkupConnectionError;
return TRUE;
}
return FALSE;
}
-static bool32 sub_80B252C(u8 taskId)
+static bool32 CheckLinkCanceledBeforeConnection(u8 taskId)
{
if ((gMain.newKeys & B_BUTTON)
&& IsLinkConnectionEstablished() == FALSE)
{
gLinkType = 0;
- gTasks[taskId].func = sub_80B2CEC;
+ gTasks[taskId].func = Task_LinkupFailed;
return TRUE;
}
return FALSE;
}
-static bool32 sub_80B2578(u8 taskId)
+static bool32 CheckLinkCanceled(u8 taskId)
{
if (IsLinkConnectionEstablished())
SetSuppressLinkErrorMessage(TRUE);
@@ -170,7 +181,7 @@ static bool32 sub_80B2578(u8 taskId)
if (gMain.newKeys & B_BUTTON)
{
gLinkType = 0;
- gTasks[taskId].func = sub_80B2CEC;
+ gTasks[taskId].func = Task_LinkupFailed;
return TRUE;
}
return FALSE;
@@ -180,12 +191,13 @@ static bool32 sub_80B25CC(u8 taskId)
{
if (GetSioMultiSI() == 1)
{
- gTasks[taskId].func = sub_80B2D2C;
+ gTasks[taskId].func = Task_LinkupConnectionError;
return TRUE;
}
return FALSE;
}
+// Unused
static void sub_80B2600(u8 taskId)
{
gTasks[taskId].data[0]++;
@@ -196,7 +208,7 @@ static void sub_80B2600(u8 taskId)
}
}
-static void sub_80B2634(u8 taskId)
+static void Task_LinkupStart(u8 taskId)
{
s16 *data = gTasks[taskId].data;
@@ -205,21 +217,21 @@ static void sub_80B2634(u8 taskId)
OpenLinkTimed();
ResetLinkPlayerCount();
ResetLinkPlayers();
- data[5] = AddWindow(&gUnknown_08550594);
+ tWindowId = AddWindow(&sWindowTemplate_LinkPlayerCount);
}
else if (data[0] > 9)
{
- gTasks[taskId].func = sub_80B2688;
+ gTasks[taskId].func = Task_LinkupAwaitConnection;
}
data[0]++;
}
-static void sub_80B2688(u8 taskId)
+static void Task_LinkupAwaitConnection(u8 taskId)
{
u32 playerCount = GetLinkPlayerCount_2();
- if (sub_80B252C(taskId) == TRUE
- || sub_80B2578(taskId) == TRUE
+ if (CheckLinkCanceledBeforeConnection(taskId) == TRUE
+ || CheckLinkCanceled(taskId) == TRUE
|| playerCount < 2)
return;
@@ -229,60 +241,60 @@ static void sub_80B2688(u8 taskId)
{
PlaySE(SE_PIN);
ShowFieldAutoScrollMessage(gText_ConfirmLinkWhenPlayersReady);
- gTasks[taskId].func = sub_80B270C;
+ gTasks[taskId].func = Task_LinkupConfirmWhenReady;
}
else
{
PlaySE(SE_BOO);
ShowFieldAutoScrollMessage(gText_AwaitingLinkup);
- gTasks[taskId].func = sub_80B2918;
+ gTasks[taskId].func = Task_LinkupExchangeDataWithLeader;
}
}
-static void sub_80B270C(u8 taskId)
+static void Task_LinkupConfirmWhenReady(u8 taskId)
{
- if (sub_80B252C(taskId) == TRUE
+ if (CheckLinkCanceledBeforeConnection(taskId) == TRUE
|| sub_80B25CC(taskId) == TRUE
- || sub_80B24F8(taskId) == TRUE)
+ || CheckLinkErrored(taskId) == TRUE)
return;
if (GetFieldMessageBoxMode() == FIELD_MESSAGE_BOX_HIDDEN)
{
- gTasks[taskId].data[3] = 0;
- gTasks[taskId].func = sub_80B275C;
+ gTasks[taskId].tNumPlayers = 0;
+ gTasks[taskId].func = Task_LinkupAwaitConfirmation;
}
}
-static void sub_80B275C(u8 taskId)
+static void Task_LinkupAwaitConfirmation(u8 taskId)
{
s16 *data = gTasks[taskId].data;
s32 linkPlayerCount = GetLinkPlayerCount_2();
- if (sub_80B252C(taskId) == TRUE
+ if (CheckLinkCanceledBeforeConnection(taskId) == TRUE
|| sub_80B25CC(taskId) == TRUE
- || sub_80B24F8(taskId) == TRUE)
+ || CheckLinkErrored(taskId) == TRUE)
return;
- sub_80B243C(taskId, linkPlayerCount);
+ UpdateLinkPlayerCountDisplay(taskId, linkPlayerCount);
if (!(gMain.newKeys & A_BUTTON))
return;
- if (linkPlayerCount < data[1])
+ if (linkPlayerCount < tMinPlayers)
return;
- sub_800AA04(linkPlayerCount);
- sub_80B241C(data[5]);
+ SaveLinkPlayers(linkPlayerCount);
+ ClearLinkPlayerCountWindow(tWindowId);
ConvertIntToDecimalStringN(gStringVar1, linkPlayerCount, STR_CONV_MODE_LEFT_ALIGN, 1);
ShowFieldAutoScrollMessage(gText_ConfirmStartLinkWithXPlayers);
- gTasks[taskId].func = sub_80B2804;
+ gTasks[taskId].func = Task_LinkupTryConfirmation;
}
-static void sub_80B2804(u8 taskId)
+static void Task_LinkupTryConfirmation(u8 taskId)
{
- if (sub_80B252C(taskId) == TRUE
+ if (CheckLinkCanceledBeforeConnection(taskId) == TRUE
|| sub_80B25CC(taskId) == TRUE
- || sub_80B24F8(taskId) == TRUE)
+ || CheckLinkErrored(taskId) == TRUE)
return;
if (GetFieldMessageBoxMode() == FIELD_MESSAGE_BOX_HIDDEN)
@@ -290,213 +302,221 @@ static void sub_80B2804(u8 taskId)
if (GetSavedPlayerCount() != GetLinkPlayerCount_2())
{
ShowFieldAutoScrollMessage(gText_ConfirmLinkWhenPlayersReady);
- gTasks[taskId].func = sub_80B270C;
+ gTasks[taskId].func = Task_LinkupConfirmWhenReady;
}
else if (gMain.heldKeys & B_BUTTON)
{
ShowFieldAutoScrollMessage(gText_ConfirmLinkWhenPlayersReady);
- gTasks[taskId].func = sub_80B270C;
+ gTasks[taskId].func = Task_LinkupConfirmWhenReady;
}
else if (gMain.heldKeys & A_BUTTON)
{
PlaySE(SE_SELECT);
CheckShouldAdvanceLinkState();
- gTasks[taskId].func = sub_80B28A8;
+ gTasks[taskId].func = Task_LinkupConfirm;
}
}
}
-static void sub_80B28A8(u8 taskId)
+static void Task_LinkupConfirm(u8 taskId)
{
- u8 local1 = gTasks[taskId].data[1];
- u8 local2 = gTasks[taskId].data[2];
+ u8 minPlayers = gTasks[taskId].tMinPlayers;
+ u8 maxPlayers = gTasks[taskId].tMaxPlayers;
- if (sub_80B24F8(taskId) == TRUE
- || sub_80B2D6C(taskId) == TRUE)
+ if (CheckLinkErrored(taskId) == TRUE
+ || TryLinkTimeout(taskId) == TRUE)
return;
if (GetLinkPlayerCount_2() != GetSavedPlayerCount())
{
- gTasks[taskId].func = sub_80B2D2C;
+ gTasks[taskId].func = Task_LinkupConnectionError;
}
else
{
- gSpecialVar_Result = sub_80B2478(local1, local2);
- if (gSpecialVar_Result != 0)
- gTasks[taskId].func = sub_80B2A08;
+ gSpecialVar_Result = ExchangeDataAndGetLinkupStatus(minPlayers, maxPlayers);
+ if (gSpecialVar_Result != LINKUP_ONGOING)
+ gTasks[taskId].func = Task_LinkupCheckStatusAfterConfirm;
}
}
-static void sub_80B2918(u8 taskId)
+static void Task_LinkupExchangeDataWithLeader(u8 taskId)
{
- u8 local1, local2;
+ u8 minPlayers, maxPlayers;
struct TrainerCard *card;
- local1 = gTasks[taskId].data[1];
- local2 = gTasks[taskId].data[2];
+ minPlayers = gTasks[taskId].tMinPlayers;
+ maxPlayers = gTasks[taskId].tMaxPlayers;
- if (sub_80B252C(taskId) == TRUE
- || sub_80B24F8(taskId) == TRUE)
+ if (CheckLinkCanceledBeforeConnection(taskId) == TRUE
+ || CheckLinkErrored(taskId) == TRUE)
return;
- gSpecialVar_Result = sub_80B2478(local1, local2);
- if (gSpecialVar_Result == 0)
+ gSpecialVar_Result = ExchangeDataAndGetLinkupStatus(minPlayers, maxPlayers);
+ if (gSpecialVar_Result == LINKUP_ONGOING)
return;
- if (gSpecialVar_Result == 3 || gSpecialVar_Result == 4)
+ if (gSpecialVar_Result == LINKUP_DIFF_SELECTIONS
+ || gSpecialVar_Result == LINKUP_WRONG_NUM_PLAYERS)
{
sub_800AC34();
HideFieldMessageBox();
- gTasks[taskId].func = sub_80B2CB0;
+ gTasks[taskId].func = Task_StopLinkup;
}
- else if (gSpecialVar_Result == 7 || gSpecialVar_Result == 9)
+ else if (gSpecialVar_Result == LINKUP_PLAYER_NOT_READY
+ || gSpecialVar_Result == LINKUP_PARTNER_NOT_READY)
{
CloseLink();
HideFieldMessageBox();
- gTasks[taskId].func = sub_80B2CB0;
+ gTasks[taskId].func = Task_StopLinkup;
}
else
{
gFieldLinkPlayerCount = GetLinkPlayerCount_2();
gLocalLinkPlayerId = GetMultiplayerId();
- sub_800AA04(gFieldLinkPlayerCount);
+ SaveLinkPlayers(gFieldLinkPlayerCount);
card = (struct TrainerCard *)gBlockSendBuffer;
TrainerCard_GenerateCardForPlayer(card);
card->monSpecies[0] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[0] - 1], MON_DATA_SPECIES, NULL);
card->monSpecies[1] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[1] - 1], MON_DATA_SPECIES, NULL);
- gTasks[taskId].func = sub_80B2C30;
+ gTasks[taskId].func = Task_LinkupAwaitTrainerCardData;
}
}
-static void sub_80B2A08(u8 taskId)
+static void Task_LinkupCheckStatusAfterConfirm(u8 taskId)
{
struct TrainerCard *card;
- if (sub_80B24F8(taskId) == TRUE)
+ if (CheckLinkErrored(taskId) == TRUE)
return;
- if (gSpecialVar_Result == 4)
+ if (gSpecialVar_Result == LINKUP_WRONG_NUM_PLAYERS)
{
if (!Link_AnyPartnersPlayingRubyOrSapphire())
{
sub_800AC34();
HideFieldMessageBox();
- gTasks[taskId].func = sub_80B2CB0;
+ gTasks[taskId].func = Task_StopLinkup;
}
else
{
CloseLink();
HideFieldMessageBox();
- gTasks[taskId].func = sub_80B2CB0;
+ gTasks[taskId].func = Task_StopLinkup;
}
}
- else if (gSpecialVar_Result == 3)
+ else if (gSpecialVar_Result == LINKUP_DIFF_SELECTIONS)
{
sub_800AC34();
HideFieldMessageBox();
- gTasks[taskId].func = sub_80B2CB0;
+ gTasks[taskId].func = Task_StopLinkup;
}
- else if (gSpecialVar_Result == 7 || gSpecialVar_Result == 9)
+ else if (gSpecialVar_Result == LINKUP_PLAYER_NOT_READY
+ || gSpecialVar_Result == LINKUP_PARTNER_NOT_READY)
{
CloseLink();
HideFieldMessageBox();
- gTasks[taskId].func = sub_80B2CB0;
+ gTasks[taskId].func = Task_StopLinkup;
}
else
{
gFieldLinkPlayerCount = GetLinkPlayerCount_2();
gLocalLinkPlayerId = GetMultiplayerId();
- sub_800AA04(gFieldLinkPlayerCount);
+ SaveLinkPlayers(gFieldLinkPlayerCount);
card = (struct TrainerCard *)gBlockSendBuffer;
TrainerCard_GenerateCardForPlayer(card);
card->monSpecies[0] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[0] - 1], MON_DATA_SPECIES, NULL);
card->monSpecies[1] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[1] - 1], MON_DATA_SPECIES, NULL);
- gTasks[taskId].func = sub_80B2C30;
+ gTasks[taskId].func = Task_LinkupAwaitTrainerCardData;
sub_800A4D8(2);
}
}
-bool32 sub_80B2AF4(u16 *arg0, u16 *arg1)
+bool32 AreBattleTowerLinkSpeciesSame(u16 *speciesList1, u16 *speciesList2)
{
int i;
int j;
- bool32 result = FALSE;
- int k = 0;
+ bool32 haveSameSpecies = FALSE;
+ int numSameSpecies = 0;
gStringVar1[0] = EOS;
gStringVar2[0] = EOS;
- for (i = 0; i < 2; i++)
+ for (i = 0; i < FRONTIER_MULTI_PARTY_SIZE; i++)
{
- for (j = 0; j < 2; j++)
+ for (j = 0; j < FRONTIER_MULTI_PARTY_SIZE; j++)
{
- if (arg0[i] == arg1[j])
+ if (speciesList1[i] == speciesList2[j])
{
- if (k == 0)
+ if (numSameSpecies == 0)
{
- StringCopy(gStringVar1, gSpeciesNames[arg0[i]]);
- result = TRUE;
+ StringCopy(gStringVar1, gSpeciesNames[speciesList1[i]]);
+ haveSameSpecies = TRUE;
}
- if (k == 1)
+ if (numSameSpecies == 1)
{
- StringCopy(gStringVar2, gSpeciesNames[arg0[i]]);
- result = TRUE;
+ StringCopy(gStringVar2, gSpeciesNames[speciesList1[i]]);
+ haveSameSpecies = TRUE;
}
- k++;
+ numSameSpecies++;
}
}
}
- gSpecialVar_0x8005 = k;
+ // var below is read by BattleFrontier_BattleTowerLobby_EventScript_AbortLink
+ gSpecialVar_0x8005 = numSameSpecies;
- return result;
+ return haveSameSpecies;
}
-static void task_map_chg_seq_0807EC34(u16 *a0, u32 taskId)
+static void FinishLinkup(u16 *linkupStatus, u32 taskId)
{
struct TrainerCard *trainerCards = gTrainerCards;
- if (*a0 == 1)
+ if (*linkupStatus == LINKUP_SUCCESS)
{
if (gLinkType == LINKTYPE_BATTLE_TOWER_50 || gLinkType == LINKTYPE_BATTLE_TOWER_OPEN)
{
- if (sub_80B2AF4(trainerCards[0].monSpecies, trainerCards[1].monSpecies))
+ if (AreBattleTowerLinkSpeciesSame(trainerCards[0].monSpecies, trainerCards[1].monSpecies))
{
- *a0 = 11;
+ // Unsuccessful battle tower linkup
+ *linkupStatus = LINKUP_FAILED_BATTLE_TOWER;
sub_800AC34();
- gTasks[taskId].func = sub_80B2CB0;
+ gTasks[taskId].func = Task_StopLinkup;
}
else
{
- sub_80B241C(gTasks[taskId].data[5]);
+ // Successful battle tower linkup
+ ClearLinkPlayerCountWindow(gTasks[taskId].tWindowId);
EnableBothScriptContexts();
DestroyTask(taskId);
}
}
else
{
- sub_80B241C(gTasks[taskId].data[5]);
+ // Successful linkup
+ ClearLinkPlayerCountWindow(gTasks[taskId].tWindowId);
EnableBothScriptContexts();
DestroyTask(taskId);
}
}
else
{
+ // Unsuccessful linkup
sub_800AC34();
- gTasks[taskId].func = sub_80B2CB0;
+ gTasks[taskId].func = Task_StopLinkup;
}
}
-static void sub_80B2C30(u8 taskId)
+static void Task_LinkupAwaitTrainerCardData(u8 taskId)
{
u8 index;
struct TrainerCard *trainerCards;
- if (sub_80B24F8(taskId) == TRUE)
+ if (CheckLinkErrored(taskId) == TRUE)
return;
- if (GetBlockReceivedStatus() != sub_800A9A8())
+ if (GetBlockReceivedStatus() != GetSavedLinkPlayerCountAsBitFlags())
return;
for (index = 0; index < GetLinkPlayerCount(); index++)
@@ -506,74 +526,74 @@ static void sub_80B2C30(u8 taskId)
SetSuppressLinkErrorMessage(FALSE);
ResetBlockReceivedFlags();
- task_map_chg_seq_0807EC34(&gSpecialVar_Result, taskId);
+ FinishLinkup(&gSpecialVar_Result, taskId);
}
-static void sub_80B2CB0(u8 taskId)
+static void Task_StopLinkup(u8 taskId)
{
- if (gReceivedRemoteLinkPlayers == FALSE)
+ if (!gReceivedRemoteLinkPlayers)
{
- sub_80B241C(gTasks[taskId].data[5]);
+ ClearLinkPlayerCountWindow(gTasks[taskId].tWindowId);
EnableBothScriptContexts();
- RemoveWindow(gTasks[taskId].data[5]);
+ RemoveWindow(gTasks[taskId].tWindowId);
DestroyTask(taskId);
}
}
-static void sub_80B2CEC(u8 taskId)
+static void Task_LinkupFailed(u8 taskId)
{
- gSpecialVar_Result = 5;
- sub_80B241C(gTasks[taskId].data[5]);
+ gSpecialVar_Result = LINKUP_FAILED;
+ ClearLinkPlayerCountWindow(gTasks[taskId].tWindowId);
StopFieldMessage();
- RemoveWindow(gTasks[taskId].data[5]);
+ RemoveWindow(gTasks[taskId].tWindowId);
EnableBothScriptContexts();
DestroyTask(taskId);
}
-static void sub_80B2D2C(u8 taskId)
+static void Task_LinkupConnectionError(u8 taskId)
{
- gSpecialVar_Result = 6;
- sub_80B241C(gTasks[taskId].data[5]);
- RemoveWindow(gTasks[taskId].data[5]);
+ gSpecialVar_Result = LINKUP_CONNECTION_ERROR;
+ ClearLinkPlayerCountWindow(gTasks[taskId].tWindowId);
+ RemoveWindow(gTasks[taskId].tWindowId);
HideFieldMessageBox();
EnableBothScriptContexts();
DestroyTask(taskId);
}
-static bool8 sub_80B2D6C(u8 taskId)
+static bool8 TryLinkTimeout(u8 taskId)
{
- gTasks[taskId].data[4]++;
- if (gTasks[taskId].data[4] > 600)
+ gTasks[taskId].tTimer++;
+ if (gTasks[taskId].tTimer > 600)
{
- gTasks[taskId].func = sub_80B2D2C;
+ gTasks[taskId].func = Task_LinkupConnectionError;
return TRUE;
}
return FALSE;
}
-void TryBattleLinkup(u8 arg0)
+void TryBattleLinkup(void)
{
- u8 r3 = 2;
- u8 r2 = 2;
+ u8 minPlayers = 2;
+ u8 maxPlayers = 2;
switch (gSpecialVar_0x8004)
{
case USING_SINGLE_BATTLE:
- r3 = 2;
+ minPlayers = 2;
gLinkType = LINKTYPE_SINGLE_BATTLE;
break;
case USING_DOUBLE_BATTLE:
- r3 = 2;
+ minPlayers = 2;
gLinkType = LINKTYPE_DOUBLE_BATTLE;
break;
case USING_MULTI_BATTLE:
- r3 = 4;
- r2 = 4;
+ minPlayers = 4;
+ maxPlayers = 4;
gLinkType = LINKTYPE_MULTI_BATTLE;
break;
case USING_BATTLE_TOWER:
- r3 = 2;
+ minPlayers = 2;
if (gSaveBlock2Ptr->frontier.lvlMode == FRONTIER_LVL_50)
gLinkType = LINKTYPE_BATTLE_TOWER_50;
else
@@ -582,46 +602,52 @@ void TryBattleLinkup(u8 arg0)
break;
}
- sub_80B236C(r3, r2);
+ CreateLinkupTask(minPlayers, maxPlayers);
}
+#undef tMinPlayers
+#undef tMaxPlayers
+#undef tNumPlayers
+#undef tTimer
+#undef tWindowId
+
void TryTradeLinkup(void)
{
- gLinkType = LINKTYPE_0x1133;
+ gLinkType = LINKTYPE_TRADE_SETUP;
gBattleTypeFlags = 0;
- sub_80B236C(2, 2);
+ CreateLinkupTask(2, 2);
}
void TryRecordMixLinkup(void)
{
- gSpecialVar_Result = 0;
- gLinkType = LINKTYPE_0x3311;
+ gSpecialVar_Result = LINKUP_ONGOING;
+ gLinkType = LINKTYPE_RECORD_MIX_BEFORE;
gBattleTypeFlags = 0;
- sub_80B236C(2, 4);
+ CreateLinkupTask(2, 4);
}
-void sub_80B2EA8(void)
+void ValidateMixingGameLanguage(void)
{
- u32 taskId = FindTaskIdByFunc(sub_80B2EE4);
+ u32 taskId = FindTaskIdByFunc(Task_ValidateMixingGameLanguage);
if (taskId == 0xFF)
{
- taskId = CreateTask(sub_80B2EE4, 80);
- gTasks[taskId].data[0] = 0;
+ taskId = CreateTask(Task_ValidateMixingGameLanguage, 80);
+ gTasks[taskId].tState = 0;
}
}
-static void sub_80B2EE4(u8 taskId)
+static void Task_ValidateMixingGameLanguage(u8 taskId)
{
int playerCount;
int i;
- switch (gTasks[taskId].data[0])
+ switch (gTasks[taskId].tState)
{
case 0:
- if (gSpecialVar_Result == 1)
+ if (gSpecialVar_Result == LINKUP_SUCCESS)
{
- bool32 unk = FALSE;
+ bool32 mixingForeignGames = FALSE;
bool32 isEnglishRSLinked = FALSE;
bool32 isJapaneseEmeraldLinked = FALSE;
@@ -635,7 +661,7 @@ static void sub_80B2EE4(u8 taskId)
{
if (language == LANGUAGE_JAPANESE)
{
- unk = TRUE;
+ mixingForeignGames = TRUE;
break;
}
else
@@ -654,14 +680,14 @@ static void sub_80B2EE4(u8 taskId)
if (isEnglishRSLinked && isJapaneseEmeraldLinked)
{
- unk = TRUE;
+ mixingForeignGames = TRUE;
}
- if (unk)
+ if (mixingForeignGames)
{
- gSpecialVar_Result = 12;
+ gSpecialVar_Result = LINKUP_FOREIGN_GAME;
sub_800AD10();
- gTasks[taskId].data[0] = 1;
+ gTasks[taskId].tState = 1;
return;
}
}
@@ -669,7 +695,7 @@ static void sub_80B2EE4(u8 taskId)
DestroyTask(taskId);
break;
case 1:
- if (gReceivedRemoteLinkPlayers == FALSE)
+ if (!gReceivedRemoteLinkPlayers)
{
EnableBothScriptContexts();
DestroyTask(taskId);
@@ -682,26 +708,26 @@ void TryBerryBlenderLinkup(void)
{
gLinkType = LINKTYPE_BERRY_BLENDER_SETUP;
gBattleTypeFlags = 0;
- sub_80B236C(2, 4);
+ CreateLinkupTask(2, 4);
}
void TryContestGModeLinkup(void)
{
gLinkType = LINKTYPE_CONTEST_GMODE;
gBattleTypeFlags = 0;
- sub_80B236C(4, 4);
+ CreateLinkupTask(4, 4);
}
void TryContestEModeLinkup(void)
{
gLinkType = LINKTYPE_CONTEST_EMODE;
gBattleTypeFlags = 0;
- sub_80B236C(2, 4);
+ CreateLinkupTask(2, 4);
}
-u8 sub_80B3050(void)
+u8 CreateTask_ReestablishCableClubLink(void)
{
- if (FuncIsActiveTask(sub_80B3144) != FALSE)
+ if (FuncIsActiveTask(Task_ReestablishLink) != FALSE)
return 0xFF;
switch (gSpecialVar_0x8004)
@@ -717,26 +743,22 @@ u8 sub_80B3050(void)
break;
case USING_BATTLE_TOWER:
if (gSaveBlock2Ptr->frontier.lvlMode == FRONTIER_LVL_50)
- {
gLinkType = LINKTYPE_BATTLE_TOWER_50;
- }
else
- {
gLinkType = LINKTYPE_BATTLE_TOWER_OPEN;
- }
break;
case USING_TRADE_CENTER:
- gLinkType = LINKTYPE_0x1111;
+ gLinkType = LINKTYPE_TRADE;
break;
case USING_RECORD_CORNER:
- gLinkType = LINKTYPE_0x3322;
+ gLinkType = LINKTYPE_RECORD_MIX_AFTER;
break;
}
- return CreateTask(sub_80B3144, 80);
+ return CreateTask(Task_ReestablishLink, 80);
}
-static void sub_80B3144(u8 taskId)
+static void Task_ReestablishLink(u8 taskId)
{
s16 *data = gTasks[taskId].data;
@@ -744,42 +766,42 @@ static void sub_80B3144(u8 taskId)
{
OpenLink();
ResetLinkPlayers();
- CreateTask(task00_08081A90, 80);
+ CreateTask(Task_WaitForLinkPlayerConnection, 80);
}
else if (data[0] >= 10)
{
- gTasks[taskId].func = sub_80B3194;
+ gTasks[taskId].func = Task_ReestablishLinkAwaitConnection;
}
data[0]++;
}
-static void sub_80B3194(u8 taskId)
+static void Task_ReestablishLinkAwaitConnection(u8 taskId)
{
if (GetLinkPlayerCount_2() >= 2)
{
if (IsLinkMaster() == TRUE)
- gTasks[taskId].func = sub_80B31E8;
+ gTasks[taskId].func = Task_ReestablishLinkLeader;
else
- gTasks[taskId].func = sub_80B3220;
+ gTasks[taskId].func = Task_ReestablishLinkAwaitConfirmation;
}
}
-static void sub_80B31E8(u8 taskId)
+static void Task_ReestablishLinkLeader(u8 taskId)
{
if (GetSavedPlayerCount() == GetLinkPlayerCount_2())
{
CheckShouldAdvanceLinkState();
- gTasks[taskId].func = sub_80B3220;
+ gTasks[taskId].func = Task_ReestablishLinkAwaitConfirmation;
}
}
-static void sub_80B3220(u8 taskId)
+static void Task_ReestablishLinkAwaitConfirmation(u8 taskId)
{
if (gReceivedRemoteLinkPlayers == TRUE
&& IsLinkPlayerDataExchangeComplete() == TRUE)
{
- sub_800AB18();
- sub_8009F18();
+ CheckLinkPlayersMatchSaved();
+ StartSendingKeysToLink();
DestroyTask(taskId);
}
}
@@ -794,50 +816,52 @@ static void SetLinkBattleTypeFlags(int linkService)
{
switch (linkService)
{
- case USING_SINGLE_BATTLE:
- gBattleTypeFlags = BATTLE_TYPE_LINK | BATTLE_TYPE_TRAINER;
- break;
- case USING_DOUBLE_BATTLE:
- gBattleTypeFlags = BATTLE_TYPE_DOUBLE | BATTLE_TYPE_LINK | BATTLE_TYPE_TRAINER;
- break;
- case USING_MULTI_BATTLE:
- ReducePlayerPartyToSelectedMons();
- gBattleTypeFlags = BATTLE_TYPE_DOUBLE | BATTLE_TYPE_LINK | BATTLE_TYPE_TRAINER | BATTLE_TYPE_MULTI;
- break;
- case USING_BATTLE_TOWER:
- gBattleTypeFlags = BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOUBLE | BATTLE_TYPE_LINK | BATTLE_TYPE_TRAINER | BATTLE_TYPE_MULTI;
- break;
+ case USING_SINGLE_BATTLE:
+ gBattleTypeFlags = BATTLE_TYPE_LINK | BATTLE_TYPE_TRAINER;
+ break;
+ case USING_DOUBLE_BATTLE:
+ gBattleTypeFlags = BATTLE_TYPE_DOUBLE | BATTLE_TYPE_LINK | BATTLE_TYPE_TRAINER;
+ break;
+ case USING_MULTI_BATTLE:
+ ReducePlayerPartyToSelectedMons();
+ gBattleTypeFlags = BATTLE_TYPE_DOUBLE | BATTLE_TYPE_LINK | BATTLE_TYPE_TRAINER | BATTLE_TYPE_MULTI;
+ break;
+ case USING_BATTLE_TOWER:
+ gBattleTypeFlags = BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOUBLE | BATTLE_TYPE_LINK | BATTLE_TYPE_TRAINER | BATTLE_TYPE_MULTI;
+ break;
}
}
-static void sub_80B32B4(u8 taskId)
+#define tTimer data[1]
+
+static void Task_StartWiredCableClubBattle(u8 taskId)
{
struct Task* task = &gTasks[taskId];
- switch (task->data[0])
+ switch (task->tState)
{
case 0:
FadeScreen(FADE_TO_BLACK, 0);
gLinkType = LINKTYPE_BATTLE;
ClearLinkCallback_2();
- task->data[0]++;
+ task->tState++;
break;
case 1:
if (!gPaletteFade.active)
- task->data[0]++;
+ task->tState++;
break;
case 2:
- task->data[1]++;
- if (task->data[1] > 20)
- task->data[0]++;
+ task->tTimer++;
+ if (task->tTimer > 20)
+ task->tState++;
break;
case 3:
sub_800AC34();
- task->data[0]++;
+ task->tState++;
break;
case 4:
if (!gReceivedRemoteLinkPlayers)
- task->data[0]++;
+ task->tState++;
break;
case 5:
if (gLinkPlayers[0].trainerId & 1)
@@ -847,37 +871,37 @@ static void sub_80B32B4(u8 taskId)
SetLinkBattleTypeFlags(gSpecialVar_0x8004);
CleanupOverworldWindowsAndTilemaps();
- gTrainerBattleOpponent_A = 0x800;
+ gTrainerBattleOpponent_A = TRAINER_LINK_OPPONENT;
SetMainCallback2(CB2_InitBattle);
- gMain.savedCallback = sub_80B360C;
+ gMain.savedCallback = CB2_ReturnFromCableClubBattle;
DestroyTask(taskId);
break;
}
}
-static void sub_80B33BC(u8 taskId)
+static void Task_StartWirelessCableClubBattle(u8 taskId)
{
int i;
s16* data = gTasks[taskId].data;
- switch (data[0])
+ switch (tState)
{
case 0:
FadeScreen(FADE_TO_BLACK, 0);
gLinkType = LINKTYPE_BATTLE;
ClearLinkCallback_2();
- data[0] = 1;
+ tState = 1;
break;
case 1:
if (!gPaletteFade.active)
- data[0] = 2;
+ tState = 2;
break;
case 2:
SendBlock(0, &gLocalLinkPlayer, sizeof(gLocalLinkPlayer));
- data[0] = 3;
+ tState = 3;
break;
case 3:
- if (GetBlockReceivedStatus() == sub_800A9D8())
+ if (GetBlockReceivedStatus() == GetLinkPlayerCountAsBitFlags())
{
for (i = 0; i < GetLinkPlayerCount(); i++)
{
@@ -886,22 +910,22 @@ static void sub_80B33BC(u8 taskId)
sub_800B524(&gLinkPlayers[i]);
ResetBlockReceivedFlag(i);
}
- data[0] = 4;
+ tState = 4;
}
break;
case 4:
- data[1]++;
- if (data[1] > 20)
- data[0] = 5;
+ tTimer++;
+ if (tTimer > 20)
+ tState = 5;
break;
case 5:
sub_800ADF8();
- data[0] = 6;
+ tState = 6;
break;
case 6:
if (IsLinkTaskFinished())
{
- data[0] = 7;
+ tState = 7;
}
break;
case 7:
@@ -913,59 +937,61 @@ static void sub_80B33BC(u8 taskId)
gLinkPlayers[0].linkType = LINKTYPE_BATTLE;
SetLinkBattleTypeFlags(gSpecialVar_0x8004);
CleanupOverworldWindowsAndTilemaps();
- gTrainerBattleOpponent_A = 0x800;
+ gTrainerBattleOpponent_A = TRAINER_LINK_OPPONENT;
SetMainCallback2(CB2_InitBattle);
- gMain.savedCallback = sub_80B360C;
+ gMain.savedCallback = CB2_ReturnFromCableClubBattle;
DestroyTask(taskId);
break;
}
}
-static void sub_80B3554(void)
+#undef tTimer
+
+static void CB2_ReturnFromUnionRoomBattle(void)
{
u8 playerCount;
int i;
- bool32 r4;
+ bool32 linkedWithFRLG;
switch (gMain.state)
{
- case 0:
- playerCount = GetLinkPlayerCount();
- r4 = FALSE;
- for (i = 0; i < playerCount; i++)
+ case 0:
+ playerCount = GetLinkPlayerCount();
+ linkedWithFRLG = FALSE;
+ for (i = 0; i < playerCount; i++)
+ {
+ u32 version = (u8)gLinkPlayers[i].version;
+ if (version == VERSION_FIRE_RED || version == VERSION_LEAF_GREEN)
{
- u32 version = (u8)gLinkPlayers[i].version;
- if (version == VERSION_FIRE_RED || version == VERSION_LEAF_GREEN)
- {
- r4 = TRUE;
- break;
- }
+ linkedWithFRLG = TRUE;
+ break;
}
+ }
- if (r4)
- {
- gMain.state = 2;
- }
- else
- {
- sub_800AC34();
- gMain.state = 1;
- }
- break;
- case 1:
- if (gReceivedRemoteLinkPlayers == FALSE)
- {
- SetMainCallback2(CB2_ReturnToField);
- }
- break;
- case 2:
+ if (linkedWithFRLG)
+ {
+ gMain.state = 2;
+ }
+ else
+ {
+ sub_800AC34();
+ gMain.state = 1;
+ }
+ break;
+ case 1:
+ if (!gReceivedRemoteLinkPlayers)
+ {
SetMainCallback2(CB2_ReturnToField);
- break;
+ }
+ break;
+ case 2:
+ SetMainCallback2(CB2_ReturnToField);
+ break;
}
RunTasks();
}
-void sub_80B360C(void)
+void CB2_ReturnFromCableClubBattle(void)
{
gBattleTypeFlags &= ~BATTLE_TYPE_20;
Overworld_ResetMapMusic();
@@ -980,26 +1006,22 @@ void sub_80B360C(void)
{
switch (gBattleOutcome)
{
- case B_OUTCOME_WON:
- sub_801B990(0, gLinkPlayers[GetMultiplayerId() ^ 1].trainerId);
- break;
- case B_OUTCOME_LOST:
- sub_801B990(1, gLinkPlayers[GetMultiplayerId() ^ 1].trainerId);
- break;
+ case B_OUTCOME_WON:
+ RecordIdOfWonderCardSenderByEventType(0, gLinkPlayers[GetMultiplayerId() ^ 1].trainerId);
+ break;
+ case B_OUTCOME_LOST:
+ RecordIdOfWonderCardSenderByEventType(1, gLinkPlayers[GetMultiplayerId() ^ 1].trainerId);
+ break;
}
}
}
if (InUnionRoom() == TRUE)
- {
- gMain.savedCallback = sub_80B3554;
- }
+ gMain.savedCallback = CB2_ReturnFromUnionRoomBattle;
else
- {
gMain.savedCallback = CB2_ReturnToFieldFromMultiplayer;
- }
- SetMainCallback2(sub_80A0514);
+ SetMainCallback2(CB2_SetUpSaveAfterLinkBattle);
}
void CleanupLinkRoomState(void)
@@ -1020,22 +1042,23 @@ void ExitLinkRoom(void)
QueueExitLinkRoomKey();
}
-static void sub_80B3728(u8 taskId)
+// Note: gSpecialVar_0x8005 contains the id of the seat the player entered
+static void Task_EnterCableClubSeat(u8 taskId)
{
struct Task* task = &gTasks[taskId];
- switch (task->data[0])
+ switch (task->tState)
{
case 0:
ShowFieldMessage(gText_PleaseWaitForLink);
- task->data[0] = 1;
+ task->tState = 1;
break;
case 1:
if (IsFieldMessageBoxHidden())
{
sub_8087288();
SetLocalLinkPlayerId(gSpecialVar_0x8005);
- task->data[0] = 2;
+ task->tState = 2;
}
break;
case 2:
@@ -1045,12 +1068,12 @@ static void sub_80B3728(u8 taskId)
break;
case 1:
HideFieldMessageBox();
- task->data[0] = 0;
+ task->tState = 0;
sub_80872C4();
SwitchTaskToFollowupFunc(taskId);
break;
case 2:
- task->data[0] = 3;
+ task->tState = 3;
break;
}
break;
@@ -1063,35 +1086,35 @@ static void sub_80B3728(u8 taskId)
}
}
-void sub_80B37D4(TaskFunc followupFunc)
+void CreateTask_EnterCableClubSeat(TaskFunc followupFunc)
{
- u8 taskId = CreateTask(sub_80B3728, 80);
- SetTaskFuncWithFollowupFunc(taskId, sub_80B3728, followupFunc);
+ u8 taskId = CreateTask(Task_EnterCableClubSeat, 80);
+ SetTaskFuncWithFollowupFunc(taskId, Task_EnterCableClubSeat, followupFunc);
ScriptContext1_Stop();
}
-static void sub_80B37FC(u8 taskId)
+static void Task_StartWiredTrade(u8 taskId)
{
struct Task *task = &gTasks[taskId];
- switch (task->data[0])
+ switch (task->tState)
{
case 0:
ScriptContext2_Enable();
FadeScreen(FADE_TO_BLACK, 0);
ClearLinkCallback_2();
- task->data[0]++;
+ task->tState++;
break;
case 1:
if (!gPaletteFade.active)
- task->data[0]++;
+ task->tState++;
break;
case 2:
gSelectedTradeMonPositions[TRADE_PLAYER] = 0;
gSelectedTradeMonPositions[TRADE_PARTNER] = 0;
m4aMPlayAllStop();
sub_800AC34();
- task->data[0]++;
+ task->tState++;
break;
case 3:
if (!gReceivedRemoteLinkPlayers)
@@ -1103,55 +1126,51 @@ static void sub_80B37FC(u8 taskId)
}
}
-static void sub_80B3894(u8 taskId)
+static void Task_StartWirelessTrade(u8 taskId)
{
s16 *data = gTasks[taskId].data;
- switch (data[0])
+ switch (tState)
{
case 0:
ScriptContext2_Enable();
FadeScreen(FADE_TO_BLACK, 0);
ClearLinkRfuCallback();
- data[0]++;
+ tState++;
break;
case 1:
if (!gPaletteFade.active)
- data[0]++;
+ tState++;
break;
case 2:
gSelectedTradeMonPositions[TRADE_PLAYER] = 0;
gSelectedTradeMonPositions[TRADE_PARTNER] = 0;
m4aMPlayAllStop();
sub_800ADF8();
- data[0]++;
+ tState++;
break;
case 3:
if (IsLinkTaskFinished())
{
- sub_8013F78();
+ CreateTask_CreateTradeMenu();
DestroyTask(taskId);
}
break;
}
}
-// Note: VAR_0x8005 is set to the ID of the trade seat.
void PlayerEnteredTradeSeat(void)
{
if (gWirelessCommType != 0)
- {
- sub_80B37D4(sub_80B3894);
- }
+ CreateTask_EnterCableClubSeat(Task_StartWirelessTrade);
else
- {
- sub_80B37D4(sub_80B37FC);
- }
+ CreateTask_EnterCableClubSeat(Task_StartWiredTrade);
}
-static void sub_80B3950(void)
+// Unused
+static void CreateTask_StartWiredTrade(void)
{
- CreateTask(sub_80B37FC, 80);
+ CreateTask(Task_StartWiredTrade, 80);
}
void nullsub_37(void)
@@ -1159,25 +1178,20 @@ void nullsub_37(void)
}
-// Note: VAR_0x8005 is set to the ID of the player spot.
void ColosseumPlayerSpotTriggered(void)
{
gLinkType = LINKTYPE_BATTLE;
- if (gWirelessCommType != 0)
- {
- sub_80B37D4(sub_80B33BC);
- }
+ if (gWirelessCommType)
+ CreateTask_EnterCableClubSeat(Task_StartWirelessCableClubBattle);
else
- {
- sub_80B37D4(sub_80B32B4);
- }
+ CreateTask_EnterCableClubSeat(Task_StartWiredCableClubBattle);
}
-// This function is never called.
-static void sub_80B39A4(void)
+// Unused
+static void CreateTask_EnterCableClubSeatNoFollowup(void)
{
- u8 taskId = CreateTask(sub_80B3728, 80);
+ u8 taskId = CreateTask(Task_EnterCableClubSeat, 80);
ScriptContext1_Stop();
}
@@ -1199,16 +1213,18 @@ bool32 GetLinkTrainerCardColor(u8 linkPlayerIndex)
if (numStars == 0)
return FALSE;
- StringCopy(gStringVar2, gTrainerCardColorNames[numStars - 1]);
+ StringCopy(gStringVar2, sTrainerCardColorNames[numStars - 1]);
return TRUE;
}
-void task00_08081A90(u8 taskId)
+#define tTimer data[0]
+
+void Task_WaitForLinkPlayerConnection(u8 taskId)
{
struct Task *task = &gTasks[taskId];
- task->data[0]++;
- if (task->data[0] > 300)
+ task->tTimer++;
+ if (task->tTimer > 300)
{
CloseLink();
SetMainCallback2(CB2_LinkError);
@@ -1217,9 +1233,10 @@ void task00_08081A90(u8 taskId)
if (gReceivedRemoteLinkPlayers)
{
+ // Players connected, destroy task
if (gWirelessCommType == 0)
{
- if (!sub_800AA60())
+ if (!DoesLinkPlayerCountMatchSaved())
{
CloseLink();
SetMainCallback2(CB2_LinkError);
@@ -1233,6 +1250,8 @@ void task00_08081A90(u8 taskId)
}
}
+#undef tTimer
+
static void sub_80B3AAC(u8 taskId)
{
if (!gReceivedRemoteLinkPlayers)
@@ -1242,67 +1261,72 @@ static void sub_80B3AAC(u8 taskId)
}
}
+// Unused
static void sub_80B3AD0(u8 taskId)
{
sub_800AC34();
gTasks[taskId].func = sub_80B3AAC;
}
+#define tTimer data[1]
+
void sub_80B3AF8(u8 taskId)
{
s16 *data = gTasks[taskId].data;
- switch (data[0])
+ switch (tState)
{
- case 0:
- if (gWirelessCommType != 0)
- {
- DestroyTask(taskId);
- }
- else
- {
- OpenLink();
- CreateTask(task00_08081A90, 1);
- data[0]++;
- }
- break;
- case 1:
- if (++data[1] > 11)
- {
- data[1] = 0;
- data[0]++;
- }
- break;
- case 2:
- if (GetLinkPlayerCount_2() >= GetSavedPlayerCount())
+ case 0:
+ if (gWirelessCommType != 0)
+ {
+ DestroyTask(taskId);
+ }
+ else
+ {
+ OpenLink();
+ CreateTask(Task_WaitForLinkPlayerConnection, 1);
+ tState++;
+ }
+ break;
+ case 1:
+ if (++tTimer > 11)
+ {
+ tTimer = 0;
+ tState++;
+ }
+ break;
+ case 2:
+ if (GetLinkPlayerCount_2() >= GetSavedPlayerCount())
+ {
+ if (IsLinkMaster())
{
- if (IsLinkMaster())
- {
- if (++data[1] > 30)
- {
- CheckShouldAdvanceLinkState();
- data[0]++;
- }
- }
- else
+ if (++tTimer > 30)
{
- data[0]++;
+ CheckShouldAdvanceLinkState();
+ tState++;
}
}
- break;
- case 3:
- if (gReceivedRemoteLinkPlayers == TRUE && IsLinkPlayerDataExchangeComplete() == TRUE)
+ else
{
- DestroyTask(taskId);
+ tState++;
}
- break;
+ }
+ break;
+ case 3:
+ if (gReceivedRemoteLinkPlayers == TRUE && IsLinkPlayerDataExchangeComplete() == TRUE)
+ {
+ DestroyTask(taskId);
+ }
+ break;
}
}
+#undef tTimer
+
void TrySetBattleTowerLinkType(void)
{
if (gWirelessCommType == 0)
- {
gLinkType = LINKTYPE_BATTLE_TOWER;
- }
}
+
+#undef tState
diff --git a/src/confetti_util.c b/src/confetti_util.c
new file mode 100644
index 000000000..3bda3ab53
--- /dev/null
+++ b/src/confetti_util.c
@@ -0,0 +1,218 @@
+#include "global.h"
+#include "confetti_util.h"
+#include "malloc.h"
+#include "main.h"
+#include "digit_obj_util.h"
+
+static EWRAM_DATA struct
+{
+ u8 count;
+ struct ConfettiUtil *array;
+} *sWork = NULL;
+
+static void sub_81520A8(void *dest, u16 value, u8 left, u8 top, u8 width, u8 height) // Unused.
+{
+ u8 i;
+ u8 j;
+ u8 x;
+ u8 y;
+
+ for (i = 0, y = top; i < height; i++)
+ {
+ for (x = left, j = 0; j < width; j++)
+ {
+ *(u16 *)((dest) + (y * 64 + x * 2)) = value;
+ x = (x + 1) % 32;
+ }
+ y = (y + 1) % 32;
+ }
+}
+
+static void sub_8152134(void *dest, const u16 *src, u8 left, u8 top, u8 width, u8 height) // Unused.
+{
+ u8 i;
+ u8 j;
+ u8 x;
+ u8 y;
+ const u16 *_src;
+
+ for (i = 0, _src = src, y = top; i < height; i++)
+ {
+ for (x = left, j = 0; j < width; j++)
+ {
+ *(u16 *)((dest) + (y * 64 + x * 2)) = *(_src++);
+ x = (x + 1) % 32;
+ }
+ y = (y + 1) % 32;
+ }
+}
+
+bool32 ConfettiUtil_Init(u8 count)
+{
+ u8 i = 0;
+
+ if (count == 0)
+ return FALSE;
+ if (count > 64)
+ count = 64;
+
+ sWork = AllocZeroed(sizeof(*sWork));
+ if (sWork == NULL)
+ return FALSE;
+ sWork->array = AllocZeroed(count * sizeof(struct ConfettiUtil));
+ if (sWork->array == NULL)
+ {
+ FREE_AND_SET_NULL(sWork);
+ return FALSE;
+ }
+
+ sWork->count = count;
+ for (i = 0; i < count; i++)
+ {
+ memcpy(&sWork->array[i].oam, &gDummyOamData, sizeof(struct OamData));
+ sWork->array[i].dummied = TRUE;
+ }
+
+ return TRUE;
+}
+
+bool32 ConfettiUtil_Free(void)
+{
+ u8 i = 0;
+
+ if (sWork == NULL)
+ return FALSE;
+
+ for (i = 0; i < sWork->count; i++)
+ memcpy(&gMain.oamBuffer[i + 64], &gDummyOamData, sizeof(struct OamData));
+
+ memset(sWork->array, 0, sWork->count * sizeof(struct ConfettiUtil));
+ FREE_AND_SET_NULL(sWork->array);
+ memset(sWork, 0, sizeof(*sWork));
+ FREE_AND_SET_NULL(sWork);
+
+ return TRUE;
+}
+
+bool32 ConfettiUtil_Update(void)
+{
+ u8 i = 0;
+
+ if (sWork == NULL || sWork->array == NULL)
+ return FALSE;
+
+ for (i = 0; i < sWork->count; i++)
+ {
+ if (sWork->array[i].active && sWork->array[i].allowUpdates)
+ {
+ if (sWork->array[i].callback != NULL)
+ sWork->array[i].callback(&sWork->array[i]);
+
+ if (sWork->array[i].dummied)
+ {
+ memcpy(&gMain.oamBuffer[i + 64], &gDummyOamData, sizeof(struct OamData));
+ }
+ else
+ {
+ sWork->array[i].oam.y = sWork->array[i].y + sWork->array[i].yDelta;
+ sWork->array[i].oam.x = sWork->array[i].x + sWork->array[i].xDelta;
+ sWork->array[i].oam.priority = sWork->array[i].priority;
+ sWork->array[i].oam.tileNum = sWork->array[i].tileNum;
+ memcpy(&gMain.oamBuffer[i + 64], &sWork->array[i], sizeof(struct OamData));
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+static bool32 SetAnimAndTileNum(struct ConfettiUtil *structPtr, u8 animNum)
+{
+ u16 tileStart;
+
+ if (structPtr == NULL)
+ return FALSE;
+
+ tileStart = GetSpriteTileStartByTag(structPtr->tileTag);
+ if (tileStart == 0xFFFF)
+ return FALSE;
+
+ structPtr->animNum = animNum;
+ structPtr->tileNum = (GetTilesPerImage(structPtr->oam.shape, structPtr->oam.size) * animNum) + tileStart;
+ return TRUE;
+}
+
+u8 ConfettiUtil_SetCallback(u8 id, void (*func)(struct ConfettiUtil *))
+{
+ if (sWork == NULL || id >= sWork->count)
+ return 0xFF;
+ else if (!sWork->array[id].active)
+ return 0xFF;
+
+ sWork->array[id].callback = func;
+ return id;
+}
+
+u8 ConfettiUtil_SetData(u8 id, u8 dataArrayId, s16 dataValue)
+{
+ if (sWork == NULL || id >= sWork->count)
+ return 0xFF;
+ else if (!sWork->array[id].active || dataArrayId > ARRAY_COUNT(sWork->array[id].data) - 1) // - 1 b/c last slot is reserved for taskId
+ return 0xFF;
+
+ sWork->array[id].data[dataArrayId] = dataValue;
+ return id;
+}
+
+u8 ConfettiUtil_AddNew(const struct OamData *oam, u16 tileTag, u16 palTag, s16 x, s16 y, u8 animNum, u8 priority)
+{
+ struct ConfettiUtil *structPtr = NULL;
+ u8 i;
+
+ if (sWork == NULL || oam == NULL)
+ return 0xFF;
+
+ for (i = 0; i < sWork->count; i++)
+ {
+ if (!sWork->array[i].active)
+ {
+ structPtr = &sWork->array[i];
+ memset(structPtr, 0, sizeof(*structPtr));
+ structPtr->id = i;
+ structPtr->active = TRUE;
+ structPtr->allowUpdates = TRUE;
+ break;
+ }
+ }
+
+ if (structPtr == NULL)
+ return 0xFF;
+
+ memcpy(&structPtr->oam, oam, sizeof(*oam));
+ structPtr->tileTag = tileTag;
+ structPtr->palTag = palTag;
+ structPtr->x = x;
+ structPtr->y = y;
+ structPtr->oam.paletteNum = IndexOfSpritePaletteTag(palTag);
+ if (priority < 4)
+ {
+ structPtr->priority = priority;
+ structPtr->oam.priority = priority;
+ }
+ SetAnimAndTileNum(structPtr, animNum);
+
+ return structPtr->id;
+}
+
+u8 ConfettiUtil_Remove(u8 id)
+{
+ if (sWork == NULL || !sWork->array[id].active)
+ return 0xFF;
+
+ memset(&sWork->array[id], 0, sizeof(struct ConfettiUtil));
+ sWork->array[id].oam.y = 160;
+ sWork->array[id].oam.x = 240;
+ sWork->array[id].dummied = TRUE;
+ memcpy(&gMain.oamBuffer[id + 64], &gDummyOamData, sizeof(struct OamData));
+ return id;
+}
diff --git a/src/contest.c b/src/contest.c
index 58628e35d..0b56569cb 100644
--- a/src/contest.c
+++ b/src/contest.c
@@ -7,7 +7,6 @@
#include "constants/moves.h"
#include "constants/songs.h"
#include "constants/species.h"
-#include "constants/flags.h"
#include "battle.h"
#include "battle_anim.h"
#include "contest.h"
@@ -31,14 +30,14 @@
#include "tv.h"
#include "scanline_effect.h"
#include "util.h"
-#include "contest_link_80F57C4.h"
+#include "contest_util.h"
#include "dma3.h"
#include "battle_message.h"
#include "event_scripts.h"
#include "event_data.h"
#include "strings.h"
#include "contest_effect.h"
-#include "contest_link_80FC4F4.h"
+#include "contest_link.h"
#include "script_pokemon_util_80F87D8.h"
#include "international_string_util.h"
#include "data.h"
@@ -155,7 +154,7 @@ static void Contest_StartTextPrinter(const u8 *, u32);
static void ContestBG_FillBoxWithIncrementingTile(u8, u16, u8, u8, u8, u8, u8, s16);
static bool32 Contest_RunTextPrinters(void);
static void Contest_SetBgCopyFlags(u32 flagIndex);
-static void sub_80DBD18(void);
+static void CalculateFinalScores(void);
static void sub_80DD080(u8);
static void sub_80DE9DC(u8);
static void sub_80DCBE8(u8, u8);
@@ -184,7 +183,7 @@ static void sub_80DC3AC(void);
static bool8 sub_80DC3C4(void);
static void ContestBG_FillBoxWithTile(u8, u16, u8, u8, u8, u8, u8);
static void Contest_PrintTextToBg0WindowStd(u32, const u8 *);
-static s16 sub_80DBD34(u8);
+static s16 GetContestantRound2Points(u8);
static void DetermineFinalStandings(void);
static bool8 sub_80DBF30(s32, s32, struct UnknownContestStruct6 *);
static void sub_80DC0F4(u8);
@@ -221,9 +220,9 @@ static void SwapMoveDescAndContestTilemaps(void);
// EWRAM vars.
EWRAM_DATA struct ContestPokemon gContestMons[CONTESTANT_COUNT] = {0};
EWRAM_DATA s16 gContestMonConditions[CONTESTANT_COUNT] = {0};
-EWRAM_DATA s16 gUnknown_02039F08[CONTESTANT_COUNT] = {0};
+EWRAM_DATA s16 gContestMonTotalPoints[CONTESTANT_COUNT] = {0};
EWRAM_DATA s16 gUnknown_02039F10[CONTESTANT_COUNT] = {0};
-EWRAM_DATA s16 gUnknown_02039F18[CONTESTANT_COUNT] = {0};
+EWRAM_DATA s16 gContestMonRound2Points[CONTESTANT_COUNT] = {0};
EWRAM_DATA u8 gContestFinalStandings[CONTESTANT_COUNT] = {0};
EWRAM_DATA u8 gContestMonPartyIndex = 0;
EWRAM_DATA u8 gContestPlayerMonIndex = 0;
@@ -239,7 +238,7 @@ EWRAM_DATA u8 gHighestRibbonRank = 0;
EWRAM_DATA struct ContestResources *gContestResources = NULL;
EWRAM_DATA u8 sContestBgCopyFlags = 0;
EWRAM_DATA struct ContestWinner gCurContestWinner = {0};
-EWRAM_DATA u8 gUnknown_02039F5C = 0;
+EWRAM_DATA bool8 gUnknown_02039F5C = 0;
EWRAM_DATA u8 gUnknown_02039F5D = 0;
// IWRAM common vars.
@@ -2490,7 +2489,7 @@ static void sub_80DA5E8(u8 taskId)
gBattle_BG2_Y = 0;
for (i = 0; i < CONTESTANT_COUNT; i++)
gUnknown_02039F10[i] = eContestantStatus[i].pointTotal;
- sub_80DBD18();
+ CalculateFinalScores();
ContestClearGeneralTextWindow();
if (!(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK))
BravoTrainerPokemonProfile_BeforeInterview1(eContestantStatus[gContestPlayerMonIndex].prevMove);
@@ -3367,22 +3366,22 @@ bool8 Contest_IsMonsTurnDisabled(u8 a)
return FALSE;
}
-static void sub_80DBCE0(u8 contestant)
+static void CalculateTotalPointsForContestant(u8 contestant)
{
- gUnknown_02039F18[contestant] = sub_80DBD34(contestant);
- gUnknown_02039F08[contestant] = gContestMonConditions[contestant] + gUnknown_02039F18[contestant];
+ gContestMonRound2Points[contestant] = GetContestantRound2Points(contestant);
+ gContestMonTotalPoints[contestant] = gContestMonConditions[contestant] + gContestMonRound2Points[contestant];
}
-static void sub_80DBD18(void)
+static void CalculateFinalScores(void)
{
s32 i;
for (i = 0; i < CONTESTANT_COUNT; i++)
- sub_80DBCE0(i);
+ CalculateTotalPointsForContestant(i);
DetermineFinalStandings();
}
-static s16 sub_80DBD34(u8 contestant)
+static s16 GetContestantRound2Points(u8 contestant)
{
return gUnknown_02039F10[contestant] * 2;
}
@@ -3411,7 +3410,7 @@ static void DetermineFinalStandings(void)
for (i = 0; i < CONTESTANT_COUNT; i++)
{
- sp8[i].unk0 = gUnknown_02039F08[i];
+ sp8[i].unk0 = gContestMonTotalPoints[i];
sp8[i].unk4 = gContestMonConditions[i];
sp8[i].unk8 = randomOrdering[i];
sp8[i].unkC = i;
@@ -5313,22 +5312,22 @@ bool8 sub_80DEDA8(u8 rank)
}
if (rank != 0xFE)
{
- u8 r4 = sub_80DEFA8(rank, 1);
+ u8 id = sub_80DEFA8(rank, 1);
- gSaveBlock1Ptr->contestWinners[r4].personality = gContestMons[i].personality;
- gSaveBlock1Ptr->contestWinners[r4].species = gContestMons[i].species;
- gSaveBlock1Ptr->contestWinners[r4].trainerId = gContestMons[i].otId;
- StringCopy(gSaveBlock1Ptr->contestWinners[r4].monName, gContestMons[i].nickname);
- StringCopy(gSaveBlock1Ptr->contestWinners[r4].trainerName, gContestMons[i].trainerName);
+ gSaveBlock1Ptr->contestWinners[id].personality = gContestMons[i].personality;
+ gSaveBlock1Ptr->contestWinners[id].species = gContestMons[i].species;
+ gSaveBlock1Ptr->contestWinners[id].trainerId = gContestMons[i].otId;
+ StringCopy(gSaveBlock1Ptr->contestWinners[id].monName, gContestMons[i].nickname);
+ StringCopy(gSaveBlock1Ptr->contestWinners[id].trainerName, gContestMons[i].trainerName);
if(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
- gSaveBlock1Ptr->contestWinners[r4].contestRank = CONTEST_RANK_LINK;
+ gSaveBlock1Ptr->contestWinners[id].contestRank = CONTEST_RANK_LINK;
else
- gSaveBlock1Ptr->contestWinners[r4].contestRank = gSpecialVar_ContestRank;
+ gSaveBlock1Ptr->contestWinners[id].contestRank = gSpecialVar_ContestRank;
if (rank != 0xFF)
- gSaveBlock1Ptr->contestWinners[r4].contestCategory = gSpecialVar_ContestCategory;
+ gSaveBlock1Ptr->contestWinners[id].contestCategory = gSpecialVar_ContestCategory;
else
- gSaveBlock1Ptr->contestWinners[r4].contestCategory = r7;
+ gSaveBlock1Ptr->contestWinners[id].contestCategory = r7;
}
else
{
@@ -5354,24 +5353,24 @@ u8 sub_80DEFA8(u8 rank, u8 b)
case CONTEST_RANK_MASTER:
if (b != 0)
{
- for (i = 5; i >= 1; i--)
+ for (i = NUM_CONTEST_HALL_WINNERS - 1; i >= 1; i--)
memcpy(&gSaveBlock1Ptr->contestWinners[i], &gSaveBlock1Ptr->contestWinners[i - 1], sizeof(struct ContestWinner));
}
return 0;
- default: // CONTEST_RANK_LINK
+ default:
switch (gSpecialVar_ContestCategory)
{
case CONTEST_CATEGORY_COOL:
- return 8;
+ return CONTEST_WINNER_MUSEUM_COOL - 1;
case CONTEST_CATEGORY_BEAUTY:
- return 9;
+ return CONTEST_WINNER_MUSEUM_BEAUTY - 1;
case CONTEST_CATEGORY_CUTE:
- return 10;
+ return CONTEST_WINNER_MUSEUM_CUTE - 1;
case CONTEST_CATEGORY_SMART:
- return 11;
+ return CONTEST_WINNER_MUSEUM_SMART - 1;
case CONTEST_CATEGORY_TOUGH:
default:
- return 12;
+ return CONTEST_WINNER_MUSEUM_TOUGH - 1;
}
}
}
@@ -5471,7 +5470,7 @@ static void sub_80DF250(void)
gContestResources->field_1c[r1].unkD |= 1;
for (i = 0; i < CONTESTANT_COUNT; i++)
{
- if (i != var_38 && gUnknown_02039F08[var_38] - gUnknown_02039F08[i] <= 50)
+ if (i != var_38 && gContestMonTotalPoints[var_38] - gContestMonTotalPoints[i] <= 50)
gContestResources->field_1c[i].unkD |= 4;
if (!gContestResources->field_1c[i].unkE_2)
@@ -5491,7 +5490,7 @@ static void sub_80DF250(void)
{
if (gContestMonConditions[i] > gContestMonConditions[j])
r12 = TRUE;
- if (gUnknown_02039F18[i] > gUnknown_02039F18[j])
+ if (gContestMonRound2Points[i] > gContestMonRound2Points[j])
r8 = TRUE;
}
if (!r12 && !r8)
@@ -5582,7 +5581,7 @@ static void sub_80DF4F8(void)
{
if (gContestMonConditions[r7] < gContestMonConditions[i])
r9++;
- if (gUnknown_02039F18[r7] < gUnknown_02039F18[i])
+ if (gContestMonRound2Points[r7] < gContestMonRound2Points[i])
r10++;
}
diff --git a/src/contest_link_80FC4F4.c b/src/contest_link.c
index d6cfea638..692c58603 100644
--- a/src/contest_link_80FC4F4.c
+++ b/src/contest_link.c
@@ -6,7 +6,7 @@
#include "pokemon.h"
#include "random.h"
#include "task.h"
-#include "constants/flags.h"
+#include "contest_link.h"
static void sub_80FC5C0(u8);
static void sub_80FC5DC(u8);
@@ -36,7 +36,7 @@ bool8 sub_80FC530(u8 arg0)
bool8 sub_80FC55C(void)
{
- if (GetBlockReceivedStatus() == sub_800A9D8())
+ if (GetBlockReceivedStatus() == GetLinkPlayerCountAsBitFlags())
{
ResetBlockReceivedFlags();
return TRUE;
@@ -296,14 +296,14 @@ void sub_80FCACC(u8 taskId)
case 0:
if (IsLinkTaskFinished())
{
- if (sub_80FC4F4(gUnknown_02039F08, sizeof(gUnknown_02039F08)) == 1)
+ if (sub_80FC4F4(gContestMonTotalPoints, sizeof(gContestMonTotalPoints)) == 1)
gTasks[taskId].data[0]++;
}
break;
case 1:
if (sub_80FC55C())
{
- memcpy(gUnknown_02039F08, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gUnknown_02039F08));
+ memcpy(gContestMonTotalPoints, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestMonTotalPoints));
gTasks[taskId].data[0]++;
}
break;
@@ -334,14 +334,14 @@ void sub_80FCACC(u8 taskId)
case 6:
if (IsLinkTaskFinished())
{
- if (sub_80FC4F4(gUnknown_02039F18, sizeof(gUnknown_02039F18)) == 1)
+ if (sub_80FC4F4(gContestMonRound2Points, sizeof(gContestMonRound2Points)) == 1)
gTasks[taskId].data[0]++;
}
break;
case 7:
if (sub_80FC55C())
{
- memcpy(gUnknown_02039F18, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gUnknown_02039F18));
+ memcpy(gContestMonRound2Points, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestMonRound2Points));
gTasks[taskId].data[0]++;
}
break;
diff --git a/src/contest_link_81D9DE4.c b/src/contest_link_util.c
index 8060b6cdc..8060b6cdc 100644
--- a/src/contest_link_81D9DE4.c
+++ b/src/contest_link_util.c
diff --git a/src/contest_painting.c b/src/contest_painting.c
index 7f33cac09..5dd4a70a5 100644
--- a/src/contest_painting.c
+++ b/src/contest_painting.c
@@ -170,7 +170,7 @@ void SetContestWinnerForPainting(int contestWinnerId)
u8 *ptr2 = &gUnknown_02039F5C;
gCurContestWinner = gSaveBlock1Ptr->contestWinners[contestWinnerId - 1];
*ptr1 = contestWinnerId - 1;
- *ptr2 = 0;
+ *ptr2 = FALSE;
}
void CB2_ContestPainting(void)
@@ -281,7 +281,7 @@ static void InitContestPaintingWindow(void)
ShowBg(1);
}
-static void PrintContestPaintingCaption(u8 contestType, u8 arg1)
+static void PrintContestPaintingCaption(u8 contestType, bool8 arg1)
{
int x;
u8 category;
@@ -519,12 +519,14 @@ _081303F8:\n\
}
#endif
-static void LoadContestPaintingFrame(u8 contestWinnerId, u8 arg1)
+#define VRAM_PICTURE_DATA(x, y) (((u16 *)(BG_SCREEN_ADDR(12)))[(y) * 32 + (x)])
+
+static void LoadContestPaintingFrame(u8 contestWinnerId, bool8 arg1)
{
u8 x, y;
LoadPalette(gPictureFramePalettes, 0, 0x100);
- if (arg1 == 1)
+ if (arg1 == TRUE)
{
switch (gContestPaintingWinner->contestCategory / 3)
{
@@ -550,8 +552,6 @@ static void LoadContestPaintingFrame(u8 contestWinnerId, u8 arg1)
break;
}
-#define VRAM_PICTURE_DATA(x, y) (((u16 *)(BG_SCREEN_ADDR(12)))[(y) * 32 + (x)])
-
// Set the background
for (y = 0; y < 20; y++)
{
@@ -569,8 +569,6 @@ static void LoadContestPaintingFrame(u8 contestWinnerId, u8 arg1)
// Re-set the entire top row to the first top frame part
for (x = 0; x < 16; x++)
VRAM_PICTURE_DATA(x + 7, 2) = (*gContestMonPixels)[2][7];
-
-#undef VRAM_PICTURE_DATA
}
else if (contestWinnerId < 8)
{
@@ -605,6 +603,8 @@ static void LoadContestPaintingFrame(u8 contestWinnerId, u8 arg1)
}
}
+#undef VRAM_PICTURE_DATA
+
static void InitPaintingMonOamData(u8 contestWinnerId)
{
//Some hacks just to get the asm to match
@@ -692,7 +692,7 @@ static void DoContestPaintingImageProcessing(u8 imageEffect)
LoadPalette(gContestPaintingMonPalette, 0x100, 0x200);
}
-static void CreateContestPaintingPicture(u8 contestWinnerId, u8 arg1)
+static void CreateContestPaintingPicture(u8 contestWinnerId, bool8 arg1)
{
AllocPaintingResources();
InitContestMonPixels(gContestPaintingWinner->species, 0);
diff --git a/src/contest_link_80F57C4.c b/src/contest_util.c
index 0cecaed07..e82560a6e 100644
--- a/src/contest_link_80F57C4.c
+++ b/src/contest_util.c
@@ -4,8 +4,8 @@
#include "battle_gfx_sfx_util.h"
#include "bg.h"
#include "contest.h"
-#include "contest_link_80F57C4.h"
-#include "contest_link_80FC4F4.h"
+#include "contest_util.h"
+#include "contest_link.h"
#include "data.h"
#include "decompress.h"
#include "dma3.h"
@@ -36,101 +36,120 @@
#include "tv.h"
#include "util.h"
#include "window.h"
+#include "constants/field_specials.h"
#include "constants/game_stat.h"
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/tv.h"
-#include "constants/vars.h"
#include "contest.h"
-struct ContestLinkUnk0
+enum {
+ SLIDING_TEXT_OFFSCREEN,
+ SLIDING_TEXT_ENTERING,
+ SLIDING_TEXT_ARRIVED,
+ SLIDING_TEXT_EXITING,
+};
+
+enum {
+ SLIDING_MON_ENTERED = 1,
+ SLIDING_MON_EXITED,
+};
+
+#define GET_CONTEST_WINNER_ID(i) { for ((i) = 0; (i) < CONTESTANT_COUNT && gContestFinalStandings[(i)] != 0; (i)++); }
+
+#define TAG_CONFETTI 3017
+
+#define MAX_BAR_LENGTH 87
+
+struct ContestResultsInternal
{
- u8 unk0;
- u8 unk1;
- u8 taskId;
- u8 unk3;
- u8 unk4;
- u8 unk5;
- u8 unk6;
- u8 unk7;
- u8 spriteId;
- u8 unk9;
- u8 unkA;
- s16 unkC[4];
- u8 unk14;
- u8 filler15[0x3];
+ u8 slidingTextBoxSpriteId;
+ u8 linkTextBoxSpriteId;
+ u8 showResultsTaskId;
+ u8 highlightWinnerTaskId;
+ u8 slidingTextBoxState;
+ u8 numStandingsPrinted;
+ u8 winnerMonSlidingState;
+ u8 confettiCount;
+ u8 winnerMonSpriteId;
+ bool8 destroyConfetti;
+ bool8 pointsFlashing;
+ s16 unkC[CONTESTANT_COUNT];
+ u8 numBarsUpdating;
};
-struct ContestLinkUnk14
+struct ContestMonResults
{
- int unk0;
- int unk4;
- u32 unk8;
- u32 unkC;
- u8 unk10;
- u8 unk11;
- u8 unk12;
+ int relativePreliminaryPoints;
+ int relativeRound2Points;
+ u32 barLengthPreliminary;
+ u32 barLengthRound2;
+ bool8 lostPoints;
+ u8 numStars;
+ u8 numHearts;
};
-struct ContestLink80F57C4
+struct ContestResults
{
- struct ContestLinkUnk0 *unk0;
- struct ContestLinkUnk14 (*unk4)[4];
- u8 *unk8;
- u8 *unkC[4];
- u8 *unk1C;
+ struct ContestResultsInternal *data;
+ struct ContestMonResults (*monResults)[CONTESTANT_COUNT];
+ u8 *unusedBg; // Allocated/freed, never used
+ u8 *tilemapBuffers[4];
+ u8 *unused; // Allocated/freed, never used
};
-EWRAM_DATA struct ContestLink80F57C4 *gUnknown_0203A034 = NULL;
+static EWRAM_DATA struct ContestResults *sContestResults = NULL;
-static void sub_80F6A9C(void);
-static void sub_80F71C8(void);
-u8 sub_80F7310(u8, u8);
-s8 sub_80F7364(u8, u8);
-static void sub_80F7ED0(int, u8 *, int);
-static void sub_80F7DF4(void);
+static void LoadAllContestMonIconPalettes(void);
+static void LoadContestResultsTilemaps(void);
+static u8 GetNumPreliminaryPoints(u8, bool8);
+static s8 GetNumRound2Points(u8, bool8);
+static void AddContestTextPrinter(int, u8 *, int);
+static void AllocContestResults(void);
+static void FreeContestResults(void);
static void LoadAllContestMonIcons(u8, u8);
-static void sub_80F6DC0(void);
-static void sub_80F6AE8(void);
-static void sub_80F5CE4(u8);
-static void sub_80F5C00(void);
-static void sub_80F68B4(u8);
-static void sub_80F7880(void);
-static void sub_80F5C24(void);
-static void sub_80F707C(const u8 *);
-static void sub_80F5ED8(u8);
+static void LoadContestResultSprites(void);
+static void TryCreateWirelessSprites(void);
+static void Task_StartShowContestResults(u8 taskId);
+static void CB2_StartShowContestResults(void);
+static void Task_ShowContestResults(u8);
+static void CB2_ShowContestResults(void);
+static void VBlankCB_ShowContestResults(void);
+static void Task_SlideContestResultsBg(u8);
+static void Task_WaitForLinkPartnersBeforeResults(u8);
static void sub_80F5F14(u8);
static void sub_80F5F30(u8);
-static void sub_80F5F74(u8);
-static void sub_80F7144(void);
-static void sub_80F68F0(u8);
-s32 sub_80F6B78(const u8 *, u8);
-static void sub_80F6E9C(s16, u16, u16, u16);
-static void sub_80F6058(u8);
-static void sub_80F7A80(u8, u8);
-void sub_80F7CA8(u8);
-static void sub_80F6EF4(u16);
-static void sub_80F60F0(u8);
-static void sub_80F616C(u8);
-static void sub_80F6204(u8);
-static void sub_80F73DC(u8);
-static void sub_80F74BC(u8);
-static void sub_80F753C(u8);
-static void sub_80F77E0(u8, u8);
-static void sub_80F7824(u8);
-static void sub_80F6404(u8);
-static void sub_80F75A8(struct Sprite *);
-static void sub_80F7670(u8);
-static void sub_80F7620(struct Sprite *);
-static void sub_80F66B4(u8);
-static void sub_80F671C(u8);
-static void sub_80F677C(u8);
-static void sub_80F67C4(u8);
-static void sub_80F6820(u8);
-static void sub_80F7E64(void);
-static void sub_80F6F68(struct Sprite *);
-static void sub_80F7014(struct Sprite *);
-static void sub_80F6FDC(struct Sprite *);
+static void Task_AnnouncePreliminaryResults(u8);
+static void Task_FlashStarsAndHearts(u8);
+static void Task_ShowPreliminaryResults(u8);
+static void Task_AnnounceRound2Results(u8);
+static void Task_ShowRound2Results(u8);
+static void Task_AnnounceWinner(u8);
+static void Task_DrawFinalStandingNumber(u8);
+static void Task_StartHighlightWinnersBox(u8);
+static void Task_HighlightWinnersBox(u8);
+static void Task_ShowWinnerMonBanner(u8);
+static void Task_SetSeenWinnerMon(u8);
+static void Task_TryDisconnectLinkPartners(u8);
+static void Task_WaitForLinkPartnersDisconnect(u8);
+static void Task_TrySetContestInterviewData(u8);
+static void Task_EndShowContestResults(u8);
+static void CalculateContestantsResultData(void);
+static void ShowLinkResultsTextBox(const u8 *);
+static void HideLinkResultsTextBox(void);
+static s32 DrawResultsTextWindow(const u8 *, u8);
+static void StartTextBoxSlideIn(s16, u16, u16, u16);
+static void UpdateContestResultBars(bool8, u8);
+static void Task_UpdateContestResultBar(u8);
+static void StartTextBoxSlideOut(u16);
+static void BounceMonIconInBox(u8, u8);
+static void Task_BounceMonIconInBox(u8);
+static void SpriteCB_WinnerMonSlideIn(struct Sprite *);
+static void SpriteCB_WinnerMonSlideOut(struct Sprite *);
+static void Task_CreateConfetti(u8);
+static void SpriteCB_TextBoxSlideIn(struct Sprite *);
+static void SpriteCB_TextBoxSlideOut(struct Sprite *);
+static void SpriteCB_EndTextBoxSlideIn(struct Sprite *);
static void sub_80F8508(u8);
static void sub_80F8568(u8);
static void sub_80F8584(u8);
@@ -139,7 +158,7 @@ static void sub_80F85BC(u8);
static void sub_80F86B8(u8);
static void sub_80F878C(u8);
static void sub_80F87B4(u8);
-static void sub_80F7768(struct Sprite *sprite);
+static void SpriteCB_Confetti(struct Sprite *sprite);
static const u16 sUnknown_0858D6B0[] = INCBIN_U16("graphics/unknown/unknown_58D6B0.gbapal");
static const u8 sUnknown_0858D6D0[] = INCBIN_U8("graphics/unknown/unknown_58D6D0.4bpp");
@@ -191,7 +210,7 @@ static const struct SpritePalette sUnknown_0858D850 =
.tag = 3009,
};
-static const struct OamData sOamData_858D858 =
+static const struct OamData sOamData_Confetti =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
@@ -208,32 +227,32 @@ static const struct OamData sOamData_858D858 =
.affineParam = 0,
};
-static const struct SpriteTemplate sSpriteTemplate_858D860 =
+static const struct SpriteTemplate sSpriteTemplate_Confetti =
{
- .tileTag = 3017,
- .paletteTag = 3017,
- .oam = &sOamData_858D858,
+ .tileTag = TAG_CONFETTI,
+ .paletteTag = TAG_CONFETTI,
+ .oam = &sOamData_Confetti,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_80F7768
+ .callback = SpriteCB_Confetti
};
-static const struct CompressedSpriteSheet sUnknown_0858D878 =
+static const struct CompressedSpriteSheet sSpriteSheet_Confetti =
{
- .data = gContestConfetti_Gfx,
+ .data = gConfetti_Gfx,
.size = 0x220,
- .tag = 3017
+ .tag = TAG_CONFETTI
};
-static const struct CompressedSpritePalette sUnknown_0858D880 =
+static const struct CompressedSpritePalette sSpritePalette_Confetti =
{
- .data = gContestConfetti_Pal,
- .tag = 3017
+ .data = gConfetti_Pal,
+ .tag = TAG_CONFETTI
};
-static const struct BgTemplate sUnknown_0858D888[] =
+static const struct BgTemplate sBgTemplates[] =
{
{
.bg = 0,
@@ -273,7 +292,7 @@ static const struct BgTemplate sUnknown_0858D888[] =
}
};
-static const struct WindowTemplate sUnknown_0858D898[] =
+static const struct WindowTemplate sWindowTemplates[] =
{
{
.bg = 1,
@@ -353,17 +372,17 @@ static const struct SpriteSheet sUnknown_0858D8E0 =
static const u8 sContestLinkTextColors[4] = {TEXT_COLOR_WHITE, TEXT_DYNAMIC_COLOR_6, TEXT_DYNAMIC_COLOR_5};
-void sub_80F57C4(void)
+static void InitContestResultsDisplay(void)
{
int i;
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP);
ResetBgsAndClearDma3BusyFlags(0);
- InitBgsFromTemplates(0, sUnknown_0858D888, ARRAY_COUNT(sUnknown_0858D888));
- for (i = 0; i < 4; i++)
- SetBgTilemapBuffer(i, gUnknown_0203A034->unkC[i]);
+ InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates));
+ for (i = 0; i < (int)ARRAY_COUNT(sContestResults->tilemapBuffers); i++)
+ SetBgTilemapBuffer(i, sContestResults->tilemapBuffers[i]);
- InitWindows(sUnknown_0858D898);
+ InitWindows(sWindowTemplates);
DeactivateAllTextPrinters();
SetGpuReg(REG_OFFSET_MOSAIC, 0);
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
@@ -398,34 +417,35 @@ void sub_80F57C4(void)
gBattle_WIN1V = 0;
}
-void sub_80F591C(void)
+static void LoadContestResultsBgGfx(void)
{
int i, j;
- s8 var0, var1;
+ s8 numStars, round2Points;
u16 tile1, tile2;
- LZDecompressVram(gUnknown_08C19588, (void *)BG_CHAR_ADDR(0));
+ LZDecompressVram(gContestResults_Gfx, (void *)BG_CHAR_ADDR(0));
CopyToBgTilemapBuffer(3, gUnknown_08C1A12C, 0, 0);
CopyToBgTilemapBuffer(2, gUnknown_08C1A000, 0, 0);
CopyToBgTilemapBuffer(0, gUnknown_08C19EEC, 0, 0);
- sub_80F71C8();
- LoadCompressedPalette(gUnknown_08C1A2B4, 0, 0x200);
+ LoadContestResultsTilemaps();
+ LoadCompressedPalette(gContestResults_Pal, 0, 0x200);
LoadPalette(sUnknown_0858D6B0, 0xF0, 0x20);
- for (i = 0; i < 4; i++)
+ for (i = 0; i < CONTESTANT_COUNT; i++)
{
- var0 = sub_80F7310(i, 1);
- var1 = sub_80F7364(i, 1);
+ numStars = GetNumPreliminaryPoints(i, TRUE);
+ round2Points = GetNumRound2Points(i, TRUE);
for (j = 0; j < 10; j++)
{
tile1 = 0x60B2;
- if (j < var0)
+ if (j < numStars)
tile1 += 2;
- if (j < abs(var1))
+ // Abs of round2Points is number of hearts
+ if (j < abs(round2Points))
{
tile2 = 0x60A4;
- if (var1 < 0)
+ if (round2Points < 0)
tile2 += 2;
}
else
@@ -448,7 +468,7 @@ void sub_80F591C(void)
ShowBg(3);
}
-static void sub_80F5A74(u8 monIndex)
+static void LoadContestMonName(u8 monIndex)
{
struct ContestPokemon *mon = &gContestMons[monIndex];
u8 *str = gDisplayedStringBattle;
@@ -456,58 +476,58 @@ static void sub_80F5A74(u8 monIndex)
str = StringCopy(gDisplayedStringBattle, gText_ColorDarkGrey);
StringCopy(str, mon->nickname);
- sub_80F7ED0(monIndex, gDisplayedStringBattle, 0);
+ AddContestTextPrinter(monIndex, gDisplayedStringBattle, 0);
StringCopy(str, gText_Slash);
StringAppend(str, mon->trainerName);
- sub_80F7ED0(monIndex, gDisplayedStringBattle, 50);
+ AddContestTextPrinter(monIndex, gDisplayedStringBattle, 50);
}
-void sub_80F5AE0(void)
+static void LoadAllContestMonNames(void)
{
int i;
for (i = 0; i < CONTESTANT_COUNT; i++)
- sub_80F5A74(i);
+ LoadContestMonName(i);
CopyBgTilemapBufferToVram(1);
}
-void sub_80F5B00(void)
+static void CB2_StartShowContestResults(void)
{
- gPaletteFade.bufferTransferDisabled = 1;
+ gPaletteFade.bufferTransferDisabled = TRUE;
SetVBlankCallback(NULL);
- sub_80F7DF4();
- sub_80F57C4();
+ AllocContestResults();
+ InitContestResultsDisplay();
ScanlineEffect_Clear();
ResetPaletteFade();
ResetSpriteData();
ResetTasks();
FreeAllSpritePalettes();
- sub_80F591C();
- sub_80F6A9C();
- LoadAllContestMonIcons(0, 1);
- sub_80F5AE0();
- memset(gUnknown_0203A034->unk0, 0, sizeof(*gUnknown_0203A034->unk0));
- memset(gUnknown_0203A034->unk4, 0, sizeof(*gUnknown_0203A034->unk4));
- sub_80F6DC0();
- sub_80F6AE8();
+ LoadContestResultsBgGfx();
+ LoadAllContestMonIconPalettes();
+ LoadAllContestMonIcons(0, TRUE);
+ LoadAllContestMonNames();
+ memset(sContestResults->data, 0, sizeof(*sContestResults->data));
+ memset(sContestResults->monResults, 0, sizeof(*sContestResults->monResults));
+ LoadContestResultSprites();
+ TryCreateWirelessSprites();
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK);
- gPaletteFade.bufferTransferDisabled = 0;
- gUnknown_0203A034->unk0->taskId = CreateTask(sub_80F5CE4, 5);
- SetMainCallback2(sub_80F5C00);
+ gPaletteFade.bufferTransferDisabled = FALSE;
+ sContestResults->data->showResultsTaskId = CreateTask(Task_ShowContestResults, 5);
+ SetMainCallback2(CB2_ShowContestResults);
gBattle_WIN1H = 0x00F0;
gBattle_WIN1V = 0x80A0;
- CreateTask(sub_80F68B4, 20);
- sub_80F7880();
+ CreateTask(Task_SlideContestResultsBg, 20);
+ CalculateContestantsResultData();
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS)
- gPaletteFade.bufferTransferDisabled = 1;
+ gPaletteFade.bufferTransferDisabled = TRUE;
else
PlayBGM(MUS_CON_K);
- SetVBlankCallback(sub_80F5C24);
+ SetVBlankCallback(VBlankCB_ShowContestResults);
}
-static void sub_80F5C00(void)
+static void CB2_ShowContestResults(void)
{
AnimateSprites();
BuildOamBuffer();
@@ -517,7 +537,7 @@ static void sub_80F5C00(void)
CopyBgTilemapBufferToVram(2);
}
-static void sub_80F5C24(void)
+static void VBlankCB_ShowContestResults(void)
{
SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_X);
SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_Y);
@@ -537,29 +557,33 @@ static void sub_80F5C24(void)
ScanlineEffect_InitHBlankDmaTransfer();
}
-static void sub_80F5CE4(u8 taskId)
+#define tState data[0]
+#define tTimer data[1]
+#define tCounter data[2]
+
+static void Task_ShowContestResults(u8 taskId)
{
u16 var;
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
{
- switch (gTasks[taskId].data[0])
+ switch (gTasks[taskId].tState)
{
case 0:
SaveLinkContestResults();
if (gContestFinalStandings[gContestPlayerMonIndex] == 0)
{
IncrementGameStat(GAME_STAT_WON_LINK_CONTEST);
- gSpecialVar_0x8005 = 8;
+ gSpecialVar_0x8005 = TVSHOW_CONTEST_LIVE_UPDATES;
InterviewBefore();
- if (gSpecialVar_Result != 1)
+ if (gSpecialVar_Result != TRUE)
InterviewAfter();
}
- TryGainNewFanFromCounter(2);
+ TryGainNewFanFromCounter(FANCOUNTER_FINISHED_CONTEST);
sub_80DEDA8(gSpecialVar_ContestRank);
sub_80DEDA8(0xFE);
- gUnknown_02039F5C = 1;
+ gUnknown_02039F5C = TRUE;
gUnknown_02039F5D = sub_80DEFA8(0xFE, 0);
var = VarGet(VAR_CONTEST_HALL_STATE);
VarSet(VAR_CONTEST_HALL_STATE, 0);
@@ -567,26 +591,26 @@ static void sub_80F5CE4(u8 taskId)
TrySavingData(SAVE_LINK);
ClearContinueGameWarpStatus2();
VarSet(VAR_CONTEST_HALL_STATE, var);
- gTasks[taskId].data[0]++;
+ gTasks[taskId].tState++;
break;
case 1:
- gTasks[taskId].data[0]++;
+ gTasks[taskId].tState++;
if (!(gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS))
- gTasks[taskId].data[0] = 100;
+ gTasks[taskId].tState = 100;
break;
case 2:
if (IsLinkTaskFinished())
{
sub_800ADF8();
- gTasks[taskId].data[0]++;
+ gTasks[taskId].tState++;
}
return;
case 3:
if (IsLinkTaskFinished() == TRUE)
{
PlayBGM(MUS_CON_K);
- gPaletteFade.bufferTransferDisabled = 0;
- gTasks[taskId].data[0]++;
+ gPaletteFade.bufferTransferDisabled = FALSE;
+ gTasks[taskId].tState++;
break;
}
return;
@@ -595,11 +619,11 @@ static void sub_80F5CE4(u8 taskId)
if (!gPaletteFade.active)
{
- gTasks[taskId].data[0] = 0;
+ gTasks[taskId].tState = 0;
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
{
- sub_80F707C(gText_CommunicationStandby);
- gTasks[taskId].func = sub_80F5ED8;
+ ShowLinkResultsTextBox(gText_CommunicationStandby);
+ gTasks[taskId].func = Task_WaitForLinkPartnersBeforeResults;
}
else
{
@@ -609,15 +633,15 @@ static void sub_80F5CE4(u8 taskId)
sub_80DEDA8(gSpecialVar_ContestRank);
sub_80DEDA8(0xFE);
- gUnknown_02039F5C = 1;
+ gUnknown_02039F5C = TRUE;
gUnknown_02039F5D = sub_80DEFA8(0xFE, 0);
- TryGainNewFanFromCounter(2);
- gTasks[taskId].func = sub_80F5F74;
+ TryGainNewFanFromCounter(FANCOUNTER_FINISHED_CONTEST);
+ gTasks[taskId].func = Task_AnnouncePreliminaryResults;
}
}
}
-static void sub_80F5ED8(u8 taskId)
+static void Task_WaitForLinkPartnersBeforeResults(u8 taskId)
{
if (gReceivedRemoteLinkPlayers)
{
@@ -636,194 +660,193 @@ static void sub_80F5F30(u8 taskId)
if (IsLinkTaskFinished())
{
DestroyTask(taskId);
- gTasks[gUnknown_0203A034->unk0->taskId].func = sub_80F5F74;
- sub_80F7144();
+ gTasks[sContestResults->data->showResultsTaskId].func = Task_AnnouncePreliminaryResults;
+ HideLinkResultsTextBox();
}
}
-static void sub_80F5F74(u8 taskId)
+static void Task_AnnouncePreliminaryResults(u8 taskId)
{
- s16 var0;
+ s16 x;
- if (gTasks[taskId].data[0] == 0)
+ if (gTasks[taskId].tState == 0)
{
- CreateTask(sub_80F68F0, 20);
- var0 = sub_80F6B78(gText_AnnouncingResults, gUnknown_0203A034->unk0->unk0);
- sub_80F6E9C(var0, 144, 120, 1088);
- gTasks[taskId].data[0]++;
+ CreateTask(Task_FlashStarsAndHearts, 20);
+ x = DrawResultsTextWindow(gText_AnnouncingResults, sContestResults->data->slidingTextBoxSpriteId);
+ StartTextBoxSlideIn(x, 144, 120, 1088);
+ gTasks[taskId].tState++;
}
- else if (gTasks[taskId].data[0] == 1)
+ else if (gTasks[taskId].tState == 1)
{
- if (gUnknown_0203A034->unk0->unk4 == 0)
+ // Wait for "Announcing Results" text to leave
+ if (sContestResults->data->slidingTextBoxState == SLIDING_TEXT_OFFSCREEN)
{
- gTasks[taskId].data[1] = 0;
- gTasks[taskId].data[0]++;
+ gTasks[taskId].tTimer = 0;
+ gTasks[taskId].tState++;
}
}
- else if (gTasks[taskId].data[0] == 2)
+ else if (gTasks[taskId].tState == 2)
{
- if (++gTasks[taskId].data[1] == 21)
+ if (++gTasks[taskId].tTimer == 21)
{
- gTasks[taskId].data[1] = 0;
- gTasks[taskId].data[0]++;
+ gTasks[taskId].tTimer = 0;
+ gTasks[taskId].tState++;
}
}
- else if (gTasks[taskId].data[0] == 3)
+ else if (gTasks[taskId].tState == 3)
{
- var0 = sub_80F6B78(gText_PreliminaryResults, gUnknown_0203A034->unk0->unk0);
- sub_80F6E9C(var0, 144, -1, 1088);
- gTasks[taskId].data[0]++;
+ x = DrawResultsTextWindow(gText_PreliminaryResults, sContestResults->data->slidingTextBoxSpriteId);
+ StartTextBoxSlideIn(x, 144, -1, 1088);
+ gTasks[taskId].tState++;
}
- else if (gTasks[taskId].data[0] == 4)
+ else if (gTasks[taskId].tState == 4)
{
- if (gUnknown_0203A034->unk0->unk4 == 2)
+ if (sContestResults->data->slidingTextBoxState == SLIDING_TEXT_ARRIVED)
{
- gTasks[taskId].data[0] = 0;
- gTasks[taskId].func = sub_80F6058;
+ gTasks[taskId].tState = 0;
+ gTasks[taskId].func = Task_ShowPreliminaryResults;
}
}
}
-static void sub_80F6058(u8 taskId)
+static void Task_ShowPreliminaryResults(u8 taskId)
{
- switch (gTasks[taskId].data[0])
+ switch (gTasks[taskId].tState)
{
case 0:
- if (!gUnknown_0203A034->unk0->unkA)
+ if (!sContestResults->data->pointsFlashing)
{
- sub_80F7A80(0, gTasks[taskId].data[2]++);
- if (!gUnknown_0203A034->unk0->unk14)
- gTasks[taskId].data[0] = 2;
+ UpdateContestResultBars(FALSE, gTasks[taskId].tCounter++);
+ if (sContestResults->data->numBarsUpdating == 0)
+ gTasks[taskId].tState = 2;
else
- gTasks[taskId].data[0]++;
+ gTasks[taskId].tState++;
}
break;
case 1:
- if (!gUnknown_0203A034->unk0->unk14)
- gTasks[taskId].data[0] = 0;
+ if (sContestResults->data->numBarsUpdating == 0)
+ gTasks[taskId].tState = 0;
break;
case 2:
- sub_80F6EF4(1088);
- gTasks[taskId].data[0] = 0;
- gTasks[taskId].data[2] = 0;
- gTasks[taskId].func = sub_80F60F0;
+ StartTextBoxSlideOut(1088);
+ gTasks[taskId].tState = 0;
+ gTasks[taskId].tCounter = 0;
+ gTasks[taskId].func = Task_AnnounceRound2Results;
break;
}
}
-static void sub_80F60F0(u8 taskId)
+static void Task_AnnounceRound2Results(u8 taskId)
{
- s16 var0;
+ s16 x;
- if (gUnknown_0203A034->unk0->unk4 == 0)
+ if (sContestResults->data->slidingTextBoxState == SLIDING_TEXT_OFFSCREEN)
{
- if (++gTasks[taskId].data[1] == 21)
+ if (++gTasks[taskId].tTimer == 21)
{
- gTasks[taskId].data[1] = 0;
- var0 = sub_80F6B78(gText_Round2Results, gUnknown_0203A034->unk0->unk0);
- sub_80F6E9C(var0, 144, -1, 1088);
+ gTasks[taskId].tTimer = 0;
+ x = DrawResultsTextWindow(gText_Round2Results, sContestResults->data->slidingTextBoxSpriteId);
+ StartTextBoxSlideIn(x, 144, -1, 1088);
}
}
- else if (gUnknown_0203A034->unk0->unk4 == 2)
+ else if (sContestResults->data->slidingTextBoxState == SLIDING_TEXT_ARRIVED)
{
- gTasks[taskId].func = sub_80F616C;
+ gTasks[taskId].func = Task_ShowRound2Results;
}
}
-static void sub_80F616C(u8 taskId)
+static void Task_ShowRound2Results(u8 taskId)
{
- switch (gTasks[taskId].data[0])
+ switch (gTasks[taskId].tState)
{
case 0:
- if (!gUnknown_0203A034->unk0->unkA)
+ if (!sContestResults->data->pointsFlashing)
{
- sub_80F7A80(1, gTasks[taskId].data[2]++);
- if (!gUnknown_0203A034->unk0->unk14)
- gTasks[taskId].data[0] = 2;
+ UpdateContestResultBars(TRUE, gTasks[taskId].tCounter++);
+ if (sContestResults->data->numBarsUpdating == 0)
+ gTasks[taskId].tState = 2;
else
- gTasks[taskId].data[0]++;
+ gTasks[taskId].tState++;
}
break;
case 1:
- if (!gUnknown_0203A034->unk0->unk14)
- gTasks[taskId].data[0] = 0;
+ if (sContestResults->data->numBarsUpdating == 0)
+ gTasks[taskId].tState = 0;
break;
case 2:
- sub_80F6EF4(1088);
- gTasks[taskId].data[0] = 0;
- gTasks[taskId].func = sub_80F6204;
+ StartTextBoxSlideOut(1088);
+ gTasks[taskId].tState = 0;
+ gTasks[taskId].func = Task_AnnounceWinner;
break;
}
}
-static void sub_80F6204(u8 taskId)
+// Task data for Task_DrawFinalStandingNumber
+#define tFinalStanding data[0]
+#define tMonIndex data[1]
+
+static void Task_AnnounceWinner(u8 taskId)
{
int i;
- u8 newTaskId;
- u8 buffer[100];
- s16 var0;
-
- switch (gTasks[taskId].data[0])
+ switch (gTasks[taskId].tState)
{
case 0:
- if (!gUnknown_0203A034->unk0->unk4)
- gTasks[taskId].data[0]++;
+ if (sContestResults->data->slidingTextBoxState == SLIDING_TEXT_OFFSCREEN)
+ gTasks[taskId].tState++;
break;
case 1:
- if (++gTasks[taskId].data[1] == 31)
+ if (++gTasks[taskId].tTimer == 31)
{
- gTasks[taskId].data[1] = 0;
- gTasks[taskId].data[0]++;
+ gTasks[taskId].tTimer = 0;
+ gTasks[taskId].tState++;
}
break;
case 2:
for (i = 0; i < CONTESTANT_COUNT; i++)
{
- newTaskId = CreateTask(sub_80F73DC, 10);
- gTasks[newTaskId].data[0] = gContestFinalStandings[i];
- gTasks[newTaskId].data[1] = i;
+ u8 newTaskId = CreateTask(Task_DrawFinalStandingNumber, 10);
+ gTasks[newTaskId].tFinalStanding = gContestFinalStandings[i];
+ gTasks[newTaskId].tMonIndex = i;
}
- gTasks[taskId].data[0]++;
+ gTasks[taskId].tState++;
break;
case 3:
- if (gUnknown_0203A034->unk0->unk5 == 4)
+ if (sContestResults->data->numStandingsPrinted == CONTESTANT_COUNT)
{
- if (++gTasks[taskId].data[1] == 31)
+ if (++gTasks[taskId].tTimer == 31)
{
- gTasks[taskId].data[1] = 0;
- CreateTask(sub_80F74BC, 10);
- gTasks[taskId].data[0]++;
- for (i = 0; i < CONTESTANT_COUNT && gContestFinalStandings[i] != 0; i++)
- ;
-
- sub_80F77E0(i, 14);
+ gTasks[taskId].tTimer = 0;
+ CreateTask(Task_StartHighlightWinnersBox, 10);
+ gTasks[taskId].tState++;
+ GET_CONTEST_WINNER_ID(i);
+ BounceMonIconInBox(i, 14);
}
}
break;
case 4:
- if (++gTasks[taskId].data[1] == 21)
+ if (++gTasks[taskId].tTimer == 21)
{
- gTasks[taskId].data[1] = 0;
- for (i = 0; i < CONTESTANT_COUNT && gContestFinalStandings[i] != 0; i++)
- ;
-
+ u8 winnerTextBuffer[100];
+ s16 x;
+ gTasks[taskId].tTimer = 0;
+ GET_CONTEST_WINNER_ID(i);
StringCopy(gStringVar1, gContestMons[i].trainerName);
sub_81DB5AC(gStringVar1);
StringCopy(gStringVar2, gContestMons[i].nickname);
- StringExpandPlaceholders(buffer, gText_Var1sVar2Won);
- var0 = sub_80F6B78(buffer, gUnknown_0203A034->unk0->unk0);
- sub_80F6E9C(var0, 144, -1, 1088);
- gTasks[taskId].data[0]++;
+ StringExpandPlaceholders(winnerTextBuffer, gText_ContestantsMonWon);
+ x = DrawResultsTextWindow(winnerTextBuffer, sContestResults->data->slidingTextBoxSpriteId);
+ StartTextBoxSlideIn(x, 144, -1, 1088);
+ gTasks[taskId].tState++;
}
break;
case 5:
- gTasks[taskId].data[0] = 0;
- gTasks[taskId].func = sub_80F6404;
+ gTasks[taskId].tState = 0;
+ gTasks[taskId].func = Task_ShowWinnerMonBanner;
break;
}
}
-static void sub_80F6404(u8 taskId)
+static void Task_ShowWinnerMonBanner(u8 taskId)
{
int i;
u8 spriteId;
@@ -832,14 +855,13 @@ static void sub_80F6404(u8 taskId)
u32 personality;
const struct CompressedSpritePalette *pokePal;
- switch (gTasks[taskId].data[0])
+ switch (gTasks[taskId].tState)
{
case 0:
gBattle_WIN0H = 0x00F0;
gBattle_WIN0V = 0x5050;
- for (i = 0; i < CONTESTANT_COUNT && gContestFinalStandings[i] != 0; i++)
- ;
+ GET_CONTEST_WINNER_ID(i);
species = gContestMons[i].species;
personality = gContestMons[i].personality;
otId = gContestMons[i].otId;
@@ -867,42 +889,42 @@ static void sub_80F6404(u8 taskId)
spriteId = CreateSprite(&gMultiuseSpriteTemplate, 272, 80, 10);
gSprites[spriteId].data[1] = species;
gSprites[spriteId].oam.priority = 0;
- gSprites[spriteId].callback = sub_80F75A8;
- gUnknown_0203A034->unk0->spriteId = spriteId;
- LoadCompressedSpriteSheet(&sUnknown_0858D878);
- LoadCompressedSpritePalette(&sUnknown_0858D880);
- CreateTask(sub_80F7670, 10);
- gTasks[taskId].data[0]++;
+ gSprites[spriteId].callback = SpriteCB_WinnerMonSlideIn;
+ sContestResults->data->winnerMonSpriteId = spriteId;
+ LoadCompressedSpriteSheet(&sSpriteSheet_Confetti);
+ LoadCompressedSpritePalette(&sSpritePalette_Confetti);
+ CreateTask(Task_CreateConfetti, 10);
+ gTasks[taskId].tState++;
break;
case 1:
if (++gTasks[taskId].data[3] == 1)
{
u8 counter;
gTasks[taskId].data[3] = 0;
- gTasks[taskId].data[2] += 2;
- if (gTasks[taskId].data[2] > 32)
- gTasks[taskId].data[2] = 32;
+ gTasks[taskId].tCounter += 2;
+ if (gTasks[taskId].tCounter > 32)
+ gTasks[taskId].tCounter = 32;
- counter = gTasks[taskId].data[2];
+ counter = gTasks[taskId].tCounter;
gBattle_WIN0V = ((80 - counter) << 8) | (80 + counter);
if (counter == 32)
- gTasks[taskId].data[0]++;
+ gTasks[taskId].tState++;
}
break;
case 2:
- if (gUnknown_0203A034->unk0->unk6 == 1)
- gTasks[taskId].data[0]++;
+ if (sContestResults->data->winnerMonSlidingState == SLIDING_MON_ENTERED)
+ gTasks[taskId].tState++;
break;
case 3:
- if (++gTasks[taskId].data[1] == 121)
+ if (++gTasks[taskId].tTimer == 121)
{
- gTasks[taskId].data[1] = 0;
- gSprites[gUnknown_0203A034->unk0->spriteId].callback = sub_80F7620;
- gTasks[taskId].data[0]++;
+ gTasks[taskId].tTimer = 0;
+ gSprites[sContestResults->data->winnerMonSpriteId].callback = SpriteCB_WinnerMonSlideOut;
+ gTasks[taskId].tState++;
}
break;
case 4:
- if (gUnknown_0203A034->unk0->unk6 == 2)
+ if (sContestResults->data->winnerMonSlidingState == SLIDING_MON_EXITED)
{
u8 top = (gBattle_WIN0V >> 8);
top += 2;
@@ -911,25 +933,25 @@ static void sub_80F6404(u8 taskId)
gBattle_WIN0V = (top << 8) | (160 - top);
if (top == 80)
- gTasks[taskId].data[0]++;
+ gTasks[taskId].tState++;
}
break;
case 5:
- if (gUnknown_0203A034->unk0->unk6 == 2)
+ if (sContestResults->data->winnerMonSlidingState == SLIDING_MON_EXITED)
{
- gUnknown_0203A034->unk0->unk9 = 1;
- gTasks[taskId].data[0] = 0;
- gTasks[taskId].func = sub_80F66B4;
+ sContestResults->data->destroyConfetti = TRUE;
+ gTasks[taskId].tState = 0;
+ gTasks[taskId].func = Task_SetSeenWinnerMon;
}
break;
}
}
-static void sub_80F66B4(u8 taskId)
+static void Task_SetSeenWinnerMon(u8 taskId)
{
int i, nationalDexNum;
- if (gMain.newKeys & A_BUTTON)
+ if (JOY_NEW(A_BUTTON))
{
if (!(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK))
{
@@ -941,62 +963,62 @@ static void sub_80F66B4(u8 taskId)
}
gTasks[taskId].data[10] = 0;
- gTasks[taskId].func = sub_80F671C;
+ gTasks[taskId].func = Task_TryDisconnectLinkPartners;
}
}
-static void sub_80F671C(u8 taskId)
+static void Task_TryDisconnectLinkPartners(u8 taskId)
{
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
{
if (!gTasks[taskId].data[10])
{
- sub_80F707C(gText_CommunicationStandby);
+ ShowLinkResultsTextBox(gText_CommunicationStandby);
sub_800AC34();
- gTasks[taskId].func = sub_80F677C;
+ gTasks[taskId].func = Task_WaitForLinkPartnersDisconnect;
}
}
else
{
- gTasks[taskId].func = sub_80F67C4;
+ gTasks[taskId].func = Task_TrySetContestInterviewData;
}
}
-static void sub_80F677C(u8 taskId)
+static void Task_WaitForLinkPartnersDisconnect(u8 taskId)
{
if (!gReceivedRemoteLinkPlayers)
{
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS)
DestroyWirelessStatusIndicatorSprite();
- sub_80F7144();
- gTasks[taskId].func = sub_80F67C4;
+ HideLinkResultsTextBox();
+ gTasks[taskId].func = Task_TrySetContestInterviewData;
}
}
-static void sub_80F67C4(u8 taskId)
+static void Task_TrySetContestInterviewData(u8 taskId)
{
if (!(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK))
BravoTrainerPokemonProfile_BeforeInterview2(gContestFinalStandings[gContestPlayerMonIndex]);
BeginHardwarePaletteFade(0xFF, 0, 0, 16, 0);
- gTasks[taskId].func = sub_80F6820;
+ gTasks[taskId].func = Task_EndShowContestResults;
}
-static void sub_80F6820(u8 taskId)
+static void Task_EndShowContestResults(u8 taskId)
{
if (!gPaletteFade.active)
{
- if (gTasks[taskId].data[1] == 0)
+ if (gTasks[taskId].tTimer == 0)
{
- DestroyTask(gUnknown_0203A034->unk0->unk3);
+ DestroyTask(sContestResults->data->highlightWinnerTaskId);
BlendPalettes(0x0000FFFF, 16, RGB_BLACK);
- gTasks[taskId].data[1]++;
+ gTasks[taskId].tTimer++;
}
- else if (gTasks[taskId].data[1] == 1)
+ else if (gTasks[taskId].tTimer == 1)
{
BlendPalettes(0xFFFF0000, 16, RGB_BLACK);
- gTasks[taskId].data[1]++;
+ gTasks[taskId].tTimer++;
}
else
{
@@ -1005,12 +1027,16 @@ static void sub_80F6820(u8 taskId)
DestroyTask(taskId);
FreeAllWindowBuffers();
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
- sub_80F7E64();
+ FreeContestResults();
}
}
}
-static void sub_80F68B4(u8 taskId)
+#undef tState
+#undef tTimer
+#undef tCounter
+
+static void Task_SlideContestResultsBg(u8 taskId)
{
gBattle_BG3_X += 2;
gBattle_BG3_Y += 1;
@@ -1020,33 +1046,37 @@ static void sub_80F68B4(u8 taskId)
gBattle_BG3_Y -= 255;
}
-static void sub_80F68F0(u8 taskId)
+#define tDelay data[0]
+#define tCoeff data[1]
+#define tDecreasing data[2]
+
+static void Task_FlashStarsAndHearts(u8 taskId)
{
- if (++gTasks[taskId].data[0] == 2)
+ if (++gTasks[taskId].tDelay == 2)
{
- gTasks[taskId].data[0] = 0;
- if (gTasks[taskId].data[2] == 0)
- gTasks[taskId].data[1]++;
+ gTasks[taskId].tDelay = 0;
+ if (!gTasks[taskId].tDecreasing)
+ gTasks[taskId].tCoeff++;
else
- gTasks[taskId].data[1]--;
+ gTasks[taskId].tCoeff--;
- if (gTasks[taskId].data[1] == 16)
- gTasks[taskId].data[2] = 1;
- else if (gTasks[taskId].data[1] == 0)
- gTasks[taskId].data[2] = 0;
+ if (gTasks[taskId].tCoeff == 16)
+ gTasks[taskId].tDecreasing = TRUE;
+ else if (gTasks[taskId].tCoeff == 0)
+ gTasks[taskId].tDecreasing = FALSE;
- BlendPalette(0x6B, 1, gTasks[taskId].data[1], RGB(30, 22, 11));
- BlendPalette(0x68, 1, gTasks[taskId].data[1], RGB_WHITE);
- BlendPalette(0x6E, 1, gTasks[taskId].data[1], RGB(30, 29, 29));
+ BlendPalette(0x6B, 1, gTasks[taskId].tCoeff, RGB(30, 22, 11));
+ BlendPalette(0x68, 1, gTasks[taskId].tCoeff, RGB_WHITE);
+ BlendPalette(0x6E, 1, gTasks[taskId].tCoeff, RGB(30, 29, 29));
}
- if (gTasks[taskId].data[1] == 0)
- gUnknown_0203A034->unk0->unkA = 0;
+ if (gTasks[taskId].tCoeff == 0)
+ sContestResults->data->pointsFlashing = FALSE;
else
- gUnknown_0203A034->unk0->unkA = 1;
+ sContestResults->data->pointsFlashing = TRUE;
}
-void sub_80F69B8(u16 species, u8 monIndex, u8 srcOffset, u8 useDmaNow, u32 personality)
+static void LoadContestMonIcon(u16 species, u8 monIndex, u8 srcOffset, u8 useDmaNow, u32 personality)
{
const u8 *iconPtr;
u16 var0, var1, frameNum;
@@ -1071,15 +1101,15 @@ void sub_80F69B8(u16 species, u8 monIndex, u8 srcOffset, u8 useDmaNow, u32 perso
}
}
-static void LoadAllContestMonIcons(u8 srcOffset, u8 useDmaNow)
+static void LoadAllContestMonIcons(u8 srcOffset, bool8 useDmaNow)
{
int i;
for (i = 0; i < CONTESTANT_COUNT; i++)
- sub_80F69B8(gContestMons[i].species, i, srcOffset, useDmaNow, gContestMons[i].personality);
+ LoadContestMonIcon(gContestMons[i].species, i, srcOffset, useDmaNow, gContestMons[i].personality);
}
-static void sub_80F6A9C(void)
+static void LoadAllContestMonIconPalettes(void)
{
int i, species;
@@ -1090,7 +1120,7 @@ static void sub_80F6A9C(void)
}
}
-static void sub_80F6AE8(void)
+static void TryCreateWirelessSprites(void)
{
u16 sheet;
u8 spriteId;
@@ -1111,7 +1141,7 @@ static void sub_80F6AE8(void)
// src are placed on different stack positions.
#ifdef NONMATCHING
-s32 sub_80F6B78(const u8 *text, u8 spriteId)
+static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
{
u8 *windowTilesPtr;
u16 windowId;
@@ -1176,7 +1206,7 @@ s32 sub_80F6B78(const u8 *text, u8 spriteId)
#else
NAKED
-s32 sub_80F6B78(const u8 *text, u8 spriteId)
+static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
{
asm_unified("\n\
push {r4-r7,lr}\n\
@@ -1451,18 +1481,18 @@ _080F6D3E:\n\
}
#endif // NONMATCHING
-static void sub_80F6DC0(void)
+static void LoadContestResultSprites(void)
{
int i;
struct SpriteTemplate template;
- u8 spriteIds[8];
+ u8 spriteIds[ARRAY_COUNT(sUnknown_0858D810)];
template = sSpriteTemplate_858D7F8;
for (i = 0; i < (int)ARRAY_COUNT(sUnknown_0858D810); i++)
LoadSpriteSheet(&sUnknown_0858D810[i]);
LoadSpritePalette(&sUnknown_0858D850);
- for (i = 0; i < 8; i++)
+ for (i = 0; i < (int)ARRAY_COUNT(sUnknown_0858D810); i++)
{
spriteIds[i] = CreateSprite(&template, 272, 144, 10);
template.tileTag++;
@@ -1476,60 +1506,68 @@ static void sub_80F6DC0(void)
gSprites[spriteIds[4]].data[1] = spriteIds[6];
gSprites[spriteIds[4]].data[2] = spriteIds[7];
- gUnknown_0203A034->unk0->unk0 = spriteIds[0];
- gUnknown_0203A034->unk0->unk4 = 0;
- gUnknown_0203A034->unk0->unk1 = spriteIds[4];
- sub_80F7144();
+ sContestResults->data->slidingTextBoxSpriteId = spriteIds[0];
+ sContestResults->data->slidingTextBoxState = SLIDING_TEXT_OFFSCREEN;
+ sContestResults->data->linkTextBoxSpriteId = spriteIds[4];
+ HideLinkResultsTextBox();
}
-static void sub_80F6E9C(s16 arg0, u16 y, u16 arg2, u16 arg3)
+#define sTargetX data[4]
+#define sSlideOutTimer data[5]
+#define sSlideIncrement data[6]
+#define sDistance data[7]
+
+// If slideOutTimer is -1, it will not automatically slide out
+static void StartTextBoxSlideIn(s16 x, u16 y, u16 slideOutTimer, u16 slideIncrement)
{
- struct Sprite *sprite = &gSprites[gUnknown_0203A034->unk0->unk0];
+ struct Sprite *sprite = &gSprites[sContestResults->data->slidingTextBoxSpriteId];
sprite->pos1.x = 272;
sprite->pos1.y = y;
sprite->pos2.x = 0;
sprite->pos2.y = 0;
- sprite->data[4] = arg0 + 32;
- sprite->data[5] = arg2;
- sprite->data[6] = arg3;
- sprite->data[7] = 0;
- sprite->callback = sub_80F6F68;
- gUnknown_0203A034->unk0->unk4 = 1;
+ sprite->sTargetX = x + 32;
+ sprite->sSlideOutTimer = slideOutTimer;
+ sprite->sSlideIncrement = slideIncrement;
+ sprite->sDistance = 0;
+ sprite->callback = SpriteCB_TextBoxSlideIn;
+ sContestResults->data->slidingTextBoxState = SLIDING_TEXT_ENTERING;
}
-static void sub_80F6EF4(u16 arg0)
+static void StartTextBoxSlideOut(u16 slideIncrement)
{
- struct Sprite *sprite = &gSprites[gUnknown_0203A034->unk0->unk0];
+ struct Sprite *sprite = &gSprites[sContestResults->data->slidingTextBoxSpriteId];
sprite->pos1.x += sprite->pos2.x;
sprite->pos1.y += sprite->pos2.y;
sprite->pos2.y = 0;
sprite->pos2.x = 0;
- sprite->data[6] = arg0;
- sprite->data[7] = 0;
- sprite->callback = sub_80F7014;
- gUnknown_0203A034->unk0->unk4 = 3;
+ sprite->sSlideIncrement = slideIncrement;
+ sprite->sDistance = 0;
+ sprite->callback = SpriteCB_TextBoxSlideOut;
+ sContestResults->data->slidingTextBoxState = SLIDING_TEXT_EXITING;
}
-static void sub_80F6F40(struct Sprite *sprite)
+static void EndTextBoxSlideOut(struct Sprite *sprite)
{
sprite->pos1.x = 272;
sprite->pos1.y = 144;
sprite->pos2.y = 0;
sprite->pos2.x = 0;
sprite->callback = SpriteCallbackDummy;
- gUnknown_0203A034->unk0->unk4 = 0;
+ sContestResults->data->slidingTextBoxState = SLIDING_TEXT_OFFSCREEN;
}
-static void sub_80F6F68(struct Sprite *sprite)
+static void SpriteCB_TextBoxSlideIn(struct Sprite *sprite)
{
int i;
- s16 delta = sprite->data[7] + sprite->data[6];
+ s16 delta = sprite->sDistance + sprite->sSlideIncrement;
sprite->pos1.x -= delta >> 8;
- sprite->data[7] += sprite->data[6];
- sprite->data[7] &= 0xFF;
- if (sprite->pos1.x < sprite->data[4])
- sprite->pos1.x = sprite->data[4];
+ sprite->sDistance += sprite->sSlideIncrement;
+ sprite->sDistance &= 0xFF;
+
+ // Prevent overshooting target
+ if (sprite->pos1.x < sprite->sTargetX)
+ sprite->pos1.x = sprite->sTargetX;
for (i = 0; i < 3; i++)
{
@@ -1537,29 +1575,29 @@ static void sub_80F6F68(struct Sprite *sprite)
sprite2->pos1.x = sprite->pos1.x + sprite->pos2.x + (i + 1) * 64;
}
- if (sprite->pos1.x == sprite->data[4])
- sprite->callback = sub_80F6FDC;
+ if (sprite->pos1.x == sprite->sTargetX)
+ sprite->callback = SpriteCB_EndTextBoxSlideIn;
}
-static void sub_80F6FDC(struct Sprite *sprite)
+static void SpriteCB_EndTextBoxSlideIn(struct Sprite *sprite)
{
- gUnknown_0203A034->unk0->unk4 = 2;
- if ((u16)sprite->data[5] != 0xFFFF)
+ sContestResults->data->slidingTextBoxState = SLIDING_TEXT_ARRIVED;
+ if ((u16)sprite->sSlideOutTimer != 0xFFFF)
{
- if (--sprite->data[5] == -1)
- sub_80F6EF4(sprite->data[6]);
+ if (--sprite->sSlideOutTimer == -1)
+ StartTextBoxSlideOut(sprite->sSlideIncrement);
}
}
-static void sub_80F7014(struct Sprite *sprite)
+static void SpriteCB_TextBoxSlideOut(struct Sprite *sprite)
{
int i;
s16 delta;
- delta = sprite->data[7] + sprite->data[6];
+ delta = sprite->sDistance + sprite->sSlideIncrement;
sprite->pos1.x -= delta >> 8;
- sprite->data[7] += sprite->data[6];
- sprite->data[7] &= 0xFF;
+ sprite->sDistance += sprite->sSlideIncrement;
+ sprite->sDistance &= 0xFF;
for (i = 0; i < 3; i++)
{
struct Sprite *sprite2 = &gSprites[sprite->data[i]];
@@ -1567,25 +1605,25 @@ static void sub_80F7014(struct Sprite *sprite)
}
if (sprite->pos1.x + sprite->pos2.x < -224)
- sub_80F6F40(sprite);
+ EndTextBoxSlideOut(sprite);
}
-static void sub_80F707C(const u8 *text)
+static void ShowLinkResultsTextBox(const u8 *text)
{
int i;
u16 x;
struct Sprite *sprite;
- x = sub_80F6B78(text, gUnknown_0203A034->unk0->unk1);
- sprite = &gSprites[gUnknown_0203A034->unk0->unk1];
+ x = DrawResultsTextWindow(text, sContestResults->data->linkTextBoxSpriteId);
+ sprite = &gSprites[sContestResults->data->linkTextBoxSpriteId];
sprite->pos1.x = x + 32;
sprite->pos1.y = 80;
- sprite->invisible = 0;
+ sprite->invisible = FALSE;
for (i = 0; i < 3; i++)
{
gSprites[sprite->data[i]].pos1.x = sprite->pos1.x + sprite->pos2.x + (i + 1) * 64;
gSprites[sprite->data[i]].pos1.y = sprite->pos1.y;
- gSprites[sprite->data[i]].invisible = 0;
+ gSprites[sprite->data[i]].invisible = FALSE;
}
gBattle_WIN0H = 0x00F0;
@@ -1594,15 +1632,15 @@ static void sub_80F707C(const u8 *text)
| WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR);
}
-static void sub_80F7144(void)
+static void HideLinkResultsTextBox(void)
{
int i;
struct Sprite *sprite;
- sprite = &gSprites[gUnknown_0203A034->unk0->unk1];
- sprite->invisible = 1;
+ sprite = &gSprites[sContestResults->data->linkTextBoxSpriteId];
+ sprite->invisible = TRUE;
for (i = 0; i < 3; i++)
- gSprites[sprite->data[i]].invisible = 1;
+ gSprites[sprite->data[i]].invisible = TRUE;
gBattle_WIN0H = 0;
gBattle_WIN0V = 0;
@@ -1612,7 +1650,7 @@ static void sub_80F7144(void)
| WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
}
-static void sub_80F71C8(void)
+static void LoadContestResultsTilemaps(void)
{
u8 palette;
int x, y;
@@ -1621,147 +1659,153 @@ static void sub_80F71C8(void)
y = 1;
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
{
- CopyToBgTilemapBufferRect(2, gUnknown_08DC6498, 5, 1, 5, 2);
+ CopyToBgTilemapBufferRect(2, gLinkContestResults_Tilemap, 5, 1, 5, 2);
x = 10;
}
else if (gSpecialVar_ContestRank == CONTEST_RANK_NORMAL)
{
- CopyToBgTilemapBufferRect(2, gUnknown_08DC63F8, 5, 1, 10, 2);
+ CopyToBgTilemapBufferRect(2, gNormalContestResults_Tilemap, 5, 1, 10, 2);
x = 15;
}
else if (gSpecialVar_ContestRank == CONTEST_RANK_SUPER)
{
- CopyToBgTilemapBufferRect(2, gUnknown_08DC6420, 5, 1, 10, 2);
+ CopyToBgTilemapBufferRect(2, gSuperContestResults_Tilemap, 5, 1, 10, 2);
x = 15;
}
else if (gSpecialVar_ContestRank == CONTEST_RANK_HYPER)
{
- CopyToBgTilemapBufferRect(2, gUnknown_08DC6448, 5, 1, 10, 2);
+ CopyToBgTilemapBufferRect(2, gHyperContestResults_Tilemap, 5, 1, 10, 2);
x = 15;
}
else // CONTEST_RANK_MASTER
{
- CopyToBgTilemapBufferRect(2, gUnknown_08DC6470, 5, 1, 10, 2);
+ CopyToBgTilemapBufferRect(2, gMasterContestResults_Tilemap, 5, 1, 10, 2);
x = 15;
}
if (gSpecialVar_ContestCategory == CONTEST_CATEGORY_COOL)
{
palette = 0;
- CopyToBgTilemapBufferRect(2, gUnknown_08DC64AC, x, y, 5, 2);
+ CopyToBgTilemapBufferRect(2, gCoolContestResults_Tilemap, x, y, 5, 2);
}
else if (gSpecialVar_ContestCategory == CONTEST_CATEGORY_BEAUTY)
{
palette = 1;
- CopyToBgTilemapBufferRect(2, gUnknown_08DC64C0, x, y, 5, 2);
+ CopyToBgTilemapBufferRect(2, gBeautyContestResults_Tilemap, x, y, 5, 2);
}
else if (gSpecialVar_ContestCategory == CONTEST_CATEGORY_CUTE)
{
palette = 2;
- CopyToBgTilemapBufferRect(2, gUnknown_08DC64D4, x, y, 5, 2);
+ CopyToBgTilemapBufferRect(2, gCuteContestResults_Tilemap, x, y, 5, 2);
}
else if (gSpecialVar_ContestCategory == CONTEST_CATEGORY_SMART)
{
palette = 3;
- CopyToBgTilemapBufferRect(2, gUnknown_08DC64E8, x, y, 5, 2);
+ CopyToBgTilemapBufferRect(2, gSmartContestResults_Tilemap, x, y, 5, 2);
}
else // CONTEST_CATEGORY_TOUGH
{
palette = 4;
- CopyToBgTilemapBufferRect(2, gUnknown_08DC64FC, x, y, 5, 2);
+ CopyToBgTilemapBufferRect(2, gToughContestResults_Tilemap, x, y, 5, 2);
}
x += 5;
- CopyToBgTilemapBufferRect(2, gUnknown_08DC6510, x, y, 6, 2);
- CopyToBgTilemapBufferRect_ChangePalette(2, gUnknown_0203A034->unkC[2], 0, 0, 32, 4, palette);
+ CopyToBgTilemapBufferRect(2, gContestResults_Tilemap, x, y, 6, 2);
+ CopyToBgTilemapBufferRect_ChangePalette(2, sContestResults->tilemapBuffers[2], 0, 0, 32, 4, palette);
}
-u8 sub_80F7310(u8 monIndex, u8 arg1)
+// Represented on results board as stars
+static u8 GetNumPreliminaryPoints(u8 monIndex, bool8 capPoints)
{
- u32 var0 = gContestMonConditions[monIndex] << 16;
- u32 var1 = var0 / 0x3F;
+ u32 condition = gContestMonConditions[monIndex] << 16;
+ u32 numStars = condition / 0x3F;
- if (var1 & 0xFFFF)
- var1 += 0x10000;
+ if (numStars & 0xFFFF)
+ numStars += 0x10000;
- var1 >>= 16;
- if (var1 == 0 && var0)
- var1 = 1;
+ numStars >>= 16;
+ if (numStars == 0 && condition)
+ numStars = 1;
- if (arg1 && var1 > 10)
- var1 = 10;
+ if (capPoints && numStars > 10)
+ numStars = 10;
- return var1;
+ return numStars;
}
-s8 sub_80F7364(u8 arg0, u8 arg1)
+// Represented on results board as hearts
+static s8 GetNumRound2Points(u8 monIndex, bool8 capPoints)
{
- u32 r4, r2;
- s16 val;
- s8 ret;
+ u32 r4, numHearts;
+ s16 results;
+ s8 points;
- val = gUnknown_02039F18[arg0];
- if (val < 0)
- r4 = -val << 16;
+ results = gContestMonRound2Points[monIndex];
+ if (results < 0)
+ r4 = -results << 16;
else
- r4 = val << 16;
+ r4 = results << 16;
- r2 = r4 / 80;
- if (r2 & 0xFFFF)
- r2 += 0x10000;
+ numHearts = r4 / 80;
+ if (numHearts & 0xFFFF)
+ numHearts += 0x10000;
- r2 >>= 16;
- if (r2 == 0 && r4 != 0)
- r2 = 1;
+ numHearts >>= 16;
+ if (numHearts == 0 && r4 != 0)
+ numHearts = 1;
- if (arg1 != 0 && r2 > 10)
- r2 = 10;
+ if (capPoints && numHearts > 10)
+ numHearts = 10;
- if (gUnknown_02039F18[arg0] < 0)
- ret = -r2;
+ if (gContestMonRound2Points[monIndex] < 0)
+ points = -numHearts;
else
- ret = r2;
+ points = numHearts;
- return ret;
+ return points;
}
-static void sub_80F73DC(u8 taskId)
+#define tState data[10]
+
+static void Task_DrawFinalStandingNumber(u8 taskId)
{
u16 firstTileNum;
- if (gTasks[taskId].data[10] == 0)
+ if (gTasks[taskId].tState == 0)
{
- gTasks[taskId].data[11] = (3 - gTasks[taskId].data[0]) * 40;
- gTasks[taskId].data[10]++;
+ gTasks[taskId].data[11] = (3 - gTasks[taskId].tFinalStanding) * 40;
+ gTasks[taskId].tState++;
}
- else if (gTasks[taskId].data[10] == 1)
+ else if (gTasks[taskId].tState == 1)
{
if (--gTasks[taskId].data[11] == -1)
{
- firstTileNum = gTasks[taskId].data[0] * 2 + 0x5043;
- WriteSequenceToBgTilemapBuffer(2, firstTileNum, 1, gTasks[taskId].data[1] * 3 + 5, 2, 1, 17, 1);
- WriteSequenceToBgTilemapBuffer(2, firstTileNum + 0x10, 1, gTasks[taskId].data[1] * 3 + 6, 2, 1, 17, 1);
- gUnknown_0203A034->unk0->unk5++;
+ firstTileNum = gTasks[taskId].tFinalStanding * 2 + 0x5043;
+ WriteSequenceToBgTilemapBuffer(2, firstTileNum, 1, gTasks[taskId].tMonIndex * 3 + 5, 2, 1, 17, 1);
+ WriteSequenceToBgTilemapBuffer(2, firstTileNum + 0x10, 1, gTasks[taskId].tMonIndex * 3 + 6, 2, 1, 17, 1);
+ sContestResults->data->numStandingsPrinted++;
DestroyTask(taskId);
PlaySE(SE_JYUNI);
}
}
}
-static void sub_80F74BC(u8 taskId)
+#undef tFinalStanding
+#undef tMonIndex
+#undef tState
+
+static void Task_StartHighlightWinnersBox(u8 taskId)
{
int i;
- for (i = 0; i < CONTESTANT_COUNT && gContestFinalStandings[i] != 0; i++)
- ;
-
- CopyToBgTilemapBufferRect_ChangePalette(2, i * 0xC0 + 0x100 + gUnknown_0203A034->unkC[2], 0, i * 3 + 4, 32, 3, 9);
+ GET_CONTEST_WINNER_ID(i);
+ CopyToBgTilemapBufferRect_ChangePalette(2, i * 0xC0 + 0x100 + sContestResults->tilemapBuffers[2], 0, i * 3 + 4, 32, 3, 9);
gTasks[taskId].data[10] = i;
gTasks[taskId].data[12] = 1;
- gTasks[taskId].func = sub_80F753C;
- gUnknown_0203A034->unk0->unk3 = taskId;
+ gTasks[taskId].func = Task_HighlightWinnersBox;
+ sContestResults->data->highlightWinnerTaskId = taskId;
}
-static void sub_80F753C(u8 taskId)
+static void Task_HighlightWinnersBox(u8 taskId)
{
if (++gTasks[taskId].data[11] == 1)
{
@@ -1780,7 +1824,7 @@ static void sub_80F753C(u8 taskId)
}
}
-static void sub_80F75A8(struct Sprite *sprite)
+static void SpriteCB_WinnerMonSlideIn(struct Sprite *sprite)
{
if (sprite->data[0] < 10)
{
@@ -1803,12 +1847,12 @@ static void sub_80F75A8(struct Sprite *sprite)
{
sprite->callback = SpriteCallbackDummy;
sprite->data[1] = 0;
- gUnknown_0203A034->unk0->unk6 = 1;
+ sContestResults->data->winnerMonSlidingState = SLIDING_MON_ENTERED;
}
}
}
-static void sub_80F7620(struct Sprite *sprite)
+static void SpriteCB_WinnerMonSlideOut(struct Sprite *sprite)
{
s16 delta = sprite->data[1] + 0x600;
sprite->pos1.x -= delta >> 8;
@@ -1817,32 +1861,32 @@ static void sub_80F7620(struct Sprite *sprite)
if (sprite->pos1.x < -32)
{
sprite->callback = SpriteCallbackDummy;
- sprite->invisible = 1;
- gUnknown_0203A034->unk0->unk6 = 2;
+ sprite->invisible = TRUE;
+ sContestResults->data->winnerMonSlidingState = SLIDING_MON_EXITED;
}
}
-static void sub_80F7670(u8 taskId)
+static void Task_CreateConfetti(u8 taskId)
{
if (++gTasks[taskId].data[0] == 5)
{
gTasks[taskId].data[0] = 0;
- if (gUnknown_0203A034->unk0->unk7 < 40)
+ if (sContestResults->data->confettiCount < 40)
{
- u8 spriteId = CreateSprite(&sSpriteTemplate_858D860, (Random() % 240) - 20, 44, 5);
+ u8 spriteId = CreateSprite(&sSpriteTemplate_Confetti, (Random() % 240) - 20, 44, 5);
gSprites[spriteId].data[0] = Random() % 512;
gSprites[spriteId].data[1] = (Random() % 24) + 16;
gSprites[spriteId].data[2] = (Random() % 256) + 48;
gSprites[spriteId].oam.tileNum += Random() % 17;
- gUnknown_0203A034->unk0->unk7++;
+ sContestResults->data->confettiCount++;
}
}
- if (gUnknown_0203A034->unk0->unk9)
+ if (sContestResults->data->destroyConfetti)
DestroyTask(taskId);
}
-static void sub_80F7768(struct Sprite *sprite)
+static void SpriteCB_Confetti(struct Sprite *sprite)
{
s16 delta;
@@ -1854,219 +1898,235 @@ static void sub_80F7768(struct Sprite *sprite)
sprite->data[4] &= 0xff;
sprite->pos1.y++;
- if (gUnknown_0203A034->unk0->unk9)
- sprite->invisible = 1;
+ if (sContestResults->data->destroyConfetti)
+ sprite->invisible = TRUE;
if (sprite->pos1.x > 248 || sprite->pos1.y > 116)
{
DestroySprite(sprite);
- gUnknown_0203A034->unk0->unk7--;
+ sContestResults->data->confettiCount--;
}
}
-static void sub_80F77E0(u8 monIndex, u8 numFrames)
+#define tMonIndex data[0]
+#define tNumFrames data[1]
+#define tSpecies data[2]
+#define tTimer data[10]
+#define tBounced data[11]
+
+static void BounceMonIconInBox(u8 monIndex, u8 numFrames)
{
- u8 taskId = CreateTask(sub_80F7824, 8);
- gTasks[taskId].data[0] = monIndex;
- gTasks[taskId].data[1] = numFrames;
- gTasks[taskId].data[2] = gContestMons[monIndex].species;
+ u8 taskId = CreateTask(Task_BounceMonIconInBox, 8);
+ gTasks[taskId].tMonIndex = monIndex;
+ gTasks[taskId].tNumFrames = numFrames;
+ gTasks[taskId].tSpecies = gContestMons[monIndex].species;
}
-static void sub_80F7824(u8 taskId)
+static void Task_BounceMonIconInBox(u8 taskId)
{
- u8 monIndex = gTasks[taskId].data[0];
- if (gTasks[taskId].data[10]++ == gTasks[taskId].data[1])
+ u8 monIndex = gTasks[taskId].tMonIndex;
+ if (gTasks[taskId].tTimer++ == gTasks[taskId].tNumFrames)
{
- gTasks[taskId].data[10] = 0;
- sub_80F69B8(gTasks[taskId].data[2], monIndex, gTasks[taskId].data[11], FALSE, gContestMons[monIndex].personality);
- gTasks[taskId].data[11] ^= 1;
+ gTasks[taskId].tTimer = 0;
+ LoadContestMonIcon(gTasks[taskId].tSpecies, monIndex, gTasks[taskId].tBounced, FALSE, gContestMons[monIndex].personality);
+ gTasks[taskId].tBounced ^= 1;
}
}
-static void sub_80F7880(void)
+#undef tMonIndex
+#undef tNumFrames
+#undef tSpecies
+#undef tTimer
+#undef tBounced
+
+static void CalculateContestantsResultData(void)
{
- int i, r4;
- u32 r1;
- s16 r2;
- s8 var;
+ int i, relativePoints;
+ u32 barLength;
+ s16 highestPoints;
+ s8 round2Points;
- r2 = gUnknown_02039F08[0];
- for (i = 1; i < 4; i++)
+ highestPoints = gContestMonTotalPoints[0];
+ for (i = 1; i < CONTESTANT_COUNT; i++)
{
- if (r2 < gUnknown_02039F08[i])
- r2 = gUnknown_02039F08[i];
+ if (highestPoints < gContestMonTotalPoints[i])
+ highestPoints = gContestMonTotalPoints[i];
}
- if (r2 < 0)
+ if (highestPoints < 0)
{
- r2 = gUnknown_02039F08[0];
- for (i = 1; i < 4; i++)
+ highestPoints = gContestMonTotalPoints[0];
+ for (i = 1; i < CONTESTANT_COUNT; i++)
{
- if (r2 > gUnknown_02039F08[i])
- r2 = gUnknown_02039F08[i];
+ if (highestPoints > gContestMonTotalPoints[i])
+ highestPoints = gContestMonTotalPoints[i];
}
}
for (i = 0; i < CONTESTANT_COUNT; i++)
{
- r4 = (gContestMonConditions[i] * 1000) / abs(r2);
- if (r4 % 10 > 4)
- r4 += 10;
- (*gUnknown_0203A034->unk4)[i].unk0 = r4 / 10;
+ relativePoints = (gContestMonConditions[i] * 1000) / abs(highestPoints);
+ if (relativePoints % 10 > 4)
+ relativePoints += 10;
+ (*sContestResults->monResults)[i].relativePreliminaryPoints = relativePoints / 10;
- r4 = (abs(gUnknown_02039F18[i]) * 1000) / abs(r2);
- if (r4 % 10 > 4)
- r4 += 10;
- (*gUnknown_0203A034->unk4)[i].unk4 = r4 / 10;
+ relativePoints = (abs(gContestMonRound2Points[i]) * 1000) / abs(highestPoints);
+ if (relativePoints % 10 > 4)
+ relativePoints += 10;
+ (*sContestResults->monResults)[i].relativeRound2Points = relativePoints / 10;
- if (gUnknown_02039F18[i] < 0)
- (*gUnknown_0203A034->unk4)[i].unk10 = 1;
+ if (gContestMonRound2Points[i] < 0)
+ (*sContestResults->monResults)[i].lostPoints = TRUE;
- r1 = ((*gUnknown_0203A034->unk4)[i].unk0 * 22528) / 100;
- if ((r1 & 0xFF) > 0x7F)
- r1 += 0x100;
- (*gUnknown_0203A034->unk4)[i].unk8 = r1 >> 8;
+ barLength = ((*sContestResults->monResults)[i].relativePreliminaryPoints * 0x5800) / 100;
+ if ((barLength & 0xFF) > 0x7F)
+ barLength += 0x100;
+ (*sContestResults->monResults)[i].barLengthPreliminary = barLength >> 8;
- r1 = ((*gUnknown_0203A034->unk4)[i].unk4 * 22528) / 100;
- if ((r1 & 0xFF) > 0x7F)
- r1 += 0x100;
- (*gUnknown_0203A034->unk4)[i].unkC = r1 >> 8;
+ barLength = ((*sContestResults->monResults)[i].relativeRound2Points * 0x5800) / 100;
+ if ((barLength & 0xFF) > 0x7F)
+ barLength += 0x100;
+ (*sContestResults->monResults)[i].barLengthRound2 = barLength >> 8;
- (*gUnknown_0203A034->unk4)[i].unk11 = sub_80F7310(i, 1);
- var = sub_80F7364(i, 1);
- (*gUnknown_0203A034->unk4)[i].unk12 = abs(var);
+ (*sContestResults->monResults)[i].numStars = GetNumPreliminaryPoints(i, TRUE);
+ round2Points = GetNumRound2Points(i, TRUE);
+ (*sContestResults->monResults)[i].numHearts = abs(round2Points);
if (gContestFinalStandings[i])
{
- s16 var1 = (*gUnknown_0203A034->unk4)[i].unk8;
- s16 var2 = (*gUnknown_0203A034->unk4)[i].unkC;
+ s16 barLengthPreliminary = (*sContestResults->monResults)[i].barLengthPreliminary;
+ s16 barLengthRound2 = (*sContestResults->monResults)[i].barLengthRound2;
- if ((*gUnknown_0203A034->unk4)[i].unk10)
- var2 *= -1;
+ if ((*sContestResults->monResults)[i].lostPoints)
+ barLengthRound2 *= -1;
- if (var1 + var2 == 88)
+ if (barLengthPreliminary + barLengthRound2 == MAX_BAR_LENGTH + 1)
{
- if (var2 > 0)
- (*gUnknown_0203A034->unk4)[i].unkC--;
- else if (var1 > 0)
- (*gUnknown_0203A034->unk4)[i].unk8--;
+ if (barLengthRound2 > 0)
+ (*sContestResults->monResults)[i].barLengthRound2--;
+ else if (barLengthPreliminary > 0)
+ (*sContestResults->monResults)[i].barLengthPreliminary--;
}
}
}
}
-static void sub_80F7A80(u8 arg0, u8 arg1)
+#define tMonId data[0]
+#define tTarget data[1]
+#define tDecreasing data[2]
+
+static void UpdateContestResultBars(bool8 isRound2, u8 numUpdates)
{
int i, taskId;
- u32 var0;
- u8 sp8 = 0, spC = 0;
+ u32 target;
+ u8 numIncreasing = 0, numDecreasing = 0;
- if (!arg0)
+ if (!isRound2)
{
- for (i = 0; i < 4; i++)
+ for (i = 0; i < CONTESTANT_COUNT; i++)
{
- u8 unk = (*gUnknown_0203A034->unk4)[i].unk11;
- if (arg1 < unk)
+ u8 numStars = (*sContestResults->monResults)[i].numStars;
+ if (numUpdates < numStars)
{
- FillBgTilemapBufferRect_Palette0(1, 0x60B3, ((19 + unk) - arg1) - 1, i * 3 + 5, 1, 1);
- taskId = CreateTask(sub_80F7CA8, 10);
+ FillBgTilemapBufferRect_Palette0(1, 0x60B3, ((19 + numStars) - numUpdates) - 1, i * 3 + 5, 1, 1);
+ taskId = CreateTask(Task_UpdateContestResultBar, 10);
- var0 = (((*gUnknown_0203A034->unk4)[i].unk8 << 16) / (*gUnknown_0203A034->unk4)[i].unk11) * (arg1 + 1);
- if ((var0 & 0xFFFF) > 0x7FFF)
- var0 += 0x10000;
+ target = (((*sContestResults->monResults)[i].barLengthPreliminary << 16) / (*sContestResults->monResults)[i].numStars) * (numUpdates + 1);
+ if ((target & 0xFFFF) > 0x7FFF)
+ target += 0x10000;
- gTasks[taskId].data[0] = i;
- gTasks[taskId].data[1] = var0 >> 16;
- gUnknown_0203A034->unk0->unk14++;
- sp8++;
+ gTasks[taskId].tMonId = i;
+ gTasks[taskId].tTarget = target >> 16;
+ sContestResults->data->numBarsUpdating++;
+ numIncreasing++;
}
}
}
else
{
- for (i = 0; i < 4; i++)
+ for (i = 0; i < CONTESTANT_COUNT; i++)
{
- s8 unk = (*gUnknown_0203A034->unk4)[i].unk12;
- u32 tile = (*gUnknown_0203A034->unk4)[i].unk10 ? 0x60A5 : 0x60A3;
- if (arg1 < unk)
+ s8 numHearts = (*sContestResults->monResults)[i].numHearts;
+ u32 tile = (*sContestResults->monResults)[i].lostPoints ? 0x60A5 : 0x60A3;
+ if (numUpdates < numHearts)
{
- FillBgTilemapBufferRect_Palette0(1, tile, ((19 + unk) - arg1) - 1, i * 3 + 6, 1, 1);
- taskId = CreateTask(sub_80F7CA8, 10);
+ FillBgTilemapBufferRect_Palette0(1, tile, ((19 + numHearts) - numUpdates) - 1, i * 3 + 6, 1, 1);
+ taskId = CreateTask(Task_UpdateContestResultBar, 10);
- var0 = (((*gUnknown_0203A034->unk4)[i].unkC << 16) / (*gUnknown_0203A034->unk4)[i].unk12) * (arg1 + 1);
- if ((var0 & 0xFFFF) > 0x7FFF)
- var0 += 0x10000;
+ target = (((*sContestResults->monResults)[i].barLengthRound2 << 16) / (*sContestResults->monResults)[i].numHearts) * (numUpdates + 1);
+ if ((target & 0xFFFF) > 0x7FFF)
+ target += 0x10000;
- gTasks[taskId].data[0] = i;
- if ((*gUnknown_0203A034->unk4)[i].unk10)
+ gTasks[taskId].tMonId = i;
+ if ((*sContestResults->monResults)[i].lostPoints)
{
- gTasks[taskId].data[2] = 1;
- spC++;
+ gTasks[taskId].tDecreasing = TRUE;
+ numDecreasing++;
}
else
{
- sp8++;
+ numIncreasing++;
}
- if ((*gUnknown_0203A034->unk4)[i].unk10)
- gTasks[taskId].data[1] = -(var0 >> 16) + (*gUnknown_0203A034->unk4)[i].unk8 ;
+ if ((*sContestResults->monResults)[i].lostPoints)
+ gTasks[taskId].tTarget = -(target >> 16) + (*sContestResults->monResults)[i].barLengthPreliminary;
else
- gTasks[taskId].data[1] = (var0 >> 16) + (*gUnknown_0203A034->unk4)[i].unk8;
+ gTasks[taskId].tTarget = (target >> 16) + (*sContestResults->monResults)[i].barLengthPreliminary;
- gUnknown_0203A034->unk0->unk14++;
+ sContestResults->data->numBarsUpdating++;
}
}
}
- if (spC)
+ if (numDecreasing)
PlaySE(SE_BOO);
- if (sp8)
+ if (numIncreasing)
PlaySE(SE_PIN);
}
-void sub_80F7CA8(u8 taskId)
+static void Task_UpdateContestResultBar(u8 taskId)
{
int i;
- u8 var0;
- u16 tileNum;
- bool32 r4 = FALSE;
- bool32 endTask = FALSE;
- u8 r6 = gTasks[taskId].data[0];
- s16 r7 = gTasks[taskId].data[1];
- s16 r12 = gTasks[taskId].data[2];
+ bool32 minMaxReached = FALSE;
+ bool32 targetReached = FALSE;
+ u8 monId = gTasks[taskId].tMonId;
+ s16 target = gTasks[taskId].tTarget;
+ s16 decreasing = gTasks[taskId].tDecreasing;
- if (r12)
+ if (decreasing)
{
- if (gUnknown_0203A034->unk0->unkC[r6] <= 0)
- r4 = TRUE;
+ if (sContestResults->data->unkC[monId] <= 0)
+ minMaxReached = TRUE;
}
else
{
- if (gUnknown_0203A034->unk0->unkC[r6] > 87)
- r4 = TRUE;
+ if (sContestResults->data->unkC[monId] > MAX_BAR_LENGTH)
+ minMaxReached = TRUE;
}
- if (gUnknown_0203A034->unk0->unkC[r6] == r7)
- endTask = TRUE;
+ if (sContestResults->data->unkC[monId] == target)
+ targetReached = TRUE;
- if (!endTask)
+ if (!targetReached)
{
- if (r4)
- gUnknown_0203A034->unk0->unkC[r6] = r7;
- else if (r12)
- gUnknown_0203A034->unk0->unkC[r6] = gUnknown_0203A034->unk0->unkC[r6] - 1;
+ if (minMaxReached)
+ sContestResults->data->unkC[monId] = target;
+ else if (decreasing)
+ sContestResults->data->unkC[monId] = sContestResults->data->unkC[monId] - 1;
else
- gUnknown_0203A034->unk0->unkC[r6] = gUnknown_0203A034->unk0->unkC[r6] + 1;
+ sContestResults->data->unkC[monId] = sContestResults->data->unkC[monId] + 1;
}
- if (!r4 && !endTask)
+ if (!minMaxReached && !targetReached)
{
+ u8 var0;
+ u16 tileNum;
for (i = 0; i < 11; i++)
{
- if (gUnknown_0203A034->unk0->unkC[r6] >= (i + 1) * 8)
+ if (sContestResults->data->unkC[monId] >= (i + 1) * 8)
var0 = 8;
- else if (gUnknown_0203A034->unk0->unkC[r6] >= i * 8)
- var0 = gUnknown_0203A034->unk0->unkC[r6] % 8;
+ else if (sContestResults->data->unkC[monId] >= i * 8)
+ var0 = sContestResults->data->unkC[monId] % 8;
else
var0 = 0;
@@ -2075,54 +2135,58 @@ void sub_80F7CA8(u8 taskId)
else
tileNum = 0x5057 + var0;
- FillBgTilemapBufferRect_Palette0(2, tileNum, i + 7, r6 * 3 + 6, 1, 1);
+ FillBgTilemapBufferRect_Palette0(2, tileNum, i + 7, monId * 3 + 6, 1, 1);
}
}
- if (endTask)
+ if (targetReached)
{
- gUnknown_0203A034->unk0->unk14--;
+ sContestResults->data->numBarsUpdating--;
DestroyTask(taskId);
}
}
-static void sub_80F7DF4(void)
+#undef tMonId
+#undef tTarget
+#undef tDecreasing
+
+static void AllocContestResults(void)
{
- gUnknown_0203A034 = AllocZeroed(sizeof(*gUnknown_0203A034));
- gUnknown_0203A034->unk0 = AllocZeroed(sizeof(*gUnknown_0203A034->unk0));
- gUnknown_0203A034->unk4 = AllocZeroed(sizeof(*gUnknown_0203A034->unk4));
- gUnknown_0203A034->unk8 = AllocZeroed(BG_SCREEN_SIZE);
- gUnknown_0203A034->unkC[0] = AllocZeroed(BG_SCREEN_SIZE);
- gUnknown_0203A034->unkC[1] = AllocZeroed(BG_SCREEN_SIZE);
- gUnknown_0203A034->unkC[2] = AllocZeroed(BG_SCREEN_SIZE);
- gUnknown_0203A034->unkC[3] = AllocZeroed(BG_SCREEN_SIZE);
- gUnknown_0203A034->unk1C = AllocZeroed(0x1000);
+ sContestResults = AllocZeroed(sizeof(*sContestResults));
+ sContestResults->data = AllocZeroed(sizeof(*sContestResults->data));
+ sContestResults->monResults = AllocZeroed(sizeof(*sContestResults->monResults));
+ sContestResults->unusedBg = AllocZeroed(BG_SCREEN_SIZE);
+ sContestResults->tilemapBuffers[0] = AllocZeroed(BG_SCREEN_SIZE);
+ sContestResults->tilemapBuffers[1] = AllocZeroed(BG_SCREEN_SIZE);
+ sContestResults->tilemapBuffers[2] = AllocZeroed(BG_SCREEN_SIZE);
+ sContestResults->tilemapBuffers[3] = AllocZeroed(BG_SCREEN_SIZE);
+ sContestResults->unused = AllocZeroed(0x1000);
AllocateMonSpritesGfx();
}
-static void sub_80F7E64(void)
+static void FreeContestResults(void)
{
- FREE_AND_SET_NULL(gUnknown_0203A034->unk0);
- FREE_AND_SET_NULL(gUnknown_0203A034->unk4);
- FREE_AND_SET_NULL(gUnknown_0203A034->unk8);
- FREE_AND_SET_NULL(gUnknown_0203A034->unkC[0]);
- FREE_AND_SET_NULL(gUnknown_0203A034->unkC[1]);
- FREE_AND_SET_NULL(gUnknown_0203A034->unkC[2]);
- FREE_AND_SET_NULL(gUnknown_0203A034->unkC[3]);
- FREE_AND_SET_NULL(gUnknown_0203A034->unk1C);
- FREE_AND_SET_NULL(gUnknown_0203A034);
+ FREE_AND_SET_NULL(sContestResults->data);
+ FREE_AND_SET_NULL(sContestResults->monResults);
+ FREE_AND_SET_NULL(sContestResults->unusedBg);
+ FREE_AND_SET_NULL(sContestResults->tilemapBuffers[0]);
+ FREE_AND_SET_NULL(sContestResults->tilemapBuffers[1]);
+ FREE_AND_SET_NULL(sContestResults->tilemapBuffers[2]);
+ FREE_AND_SET_NULL(sContestResults->tilemapBuffers[3]);
+ FREE_AND_SET_NULL(sContestResults->unused);
+ FREE_AND_SET_NULL(sContestResults);
FreeMonSpritesGfx();
}
-static void sub_80F7ED0(int windowId, u8 *str, int arg2)
+static void AddContestTextPrinter(int windowId, u8 *str, int x)
{
struct TextPrinterTemplate textPrinter;
textPrinter.currentChar = str;
textPrinter.windowId = windowId;
textPrinter.fontId = 7;
- textPrinter.x = arg2;
+ textPrinter.x = x;
textPrinter.y = 2;
- textPrinter.currentX = arg2;
+ textPrinter.currentX = x;
textPrinter.currentY = 2;
textPrinter.letterSpacing = 0;
textPrinter.lineSpacing = 0;
@@ -2274,20 +2338,14 @@ void GetContestMonCondition(void)
void GetContestWinnerId(void)
{
u8 i;
-
- for (i = 0; i < CONTESTANT_COUNT && gContestFinalStandings[i] != 0; i++)
- ;
-
+ GET_CONTEST_WINNER_ID(i);
gSpecialVar_0x8005 = i;
}
void BufferContestWinnerTrainerName(void)
{
u8 i;
-
- for (i = 0; i < CONTESTANT_COUNT && gContestFinalStandings[i] != 0; i++)
- ;
-
+ GET_CONTEST_WINNER_ID(i);
StringCopy(gStringVar3, gContestMons[i].trainerName);
sub_81DB5AC(gStringVar3);
}
@@ -2295,10 +2353,7 @@ void BufferContestWinnerTrainerName(void)
void BufferContestWinnerMonName(void)
{
u8 i;
-
- for (i = 0; i < CONTESTANT_COUNT && gContestFinalStandings[i] != 0; i++)
- ;
-
+ GET_CONTEST_WINNER_ID(i);
StringCopy(gStringVar1, gContestMons[i].nickname);
}
@@ -2328,19 +2383,19 @@ void BufferContestantMonSpecies(void)
gSpecialVar_0x8004 = gContestMons[gSpecialVar_0x8006].species;
}
-static void sub_80F8458(u8 taskId)
+static void Task_StartShowContestResults(u8 taskId)
{
if (!gPaletteFade.active)
{
DestroyTask(taskId);
- SetMainCallback2(sub_80F5B00);
+ SetMainCallback2(CB2_StartShowContestResults);
}
}
-void sub_80F8484(void)
+void ShowContestResults(void)
{
ScriptContext2_Enable();
- CreateTask(sub_80F8458, 10);
+ CreateTask(Task_StartShowContestResults, 10);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
}
@@ -2349,7 +2404,7 @@ void GetContestPlayerId(void)
gSpecialVar_0x8004 = gContestPlayerMonIndex;
}
-void sub_80F84C4(u8 taskId)
+void ContestLinkTransfer(u8 taskId)
{
u8 newTaskId;
ScriptContext2_Enable();
diff --git a/src/credits.c b/src/credits.c
index dd1166d82..8fc8a1f88 100644
--- a/src/credits.c
+++ b/src/credits.c
@@ -20,7 +20,6 @@
#include "trig.h"
#include "graphics.h"
#include "pokedex.h"
-#include "constants/vars.h"
#include "event_data.h"
#include "random.h"
#include "constants/species.h"
diff --git a/src/crt0.s b/src/crt0.s
index 3ab711713..cb7c93a6b 100644
--- a/src/crt0.s
+++ b/src/crt0.s
@@ -82,10 +82,10 @@ GPIOPortReadEnable: @ 80000C8
.align 2, 0
.global Init
Init: @ 8000204
- mov r0, PSR_IRQ_MODE
+ mov r0, #PSR_IRQ_MODE
msr cpsr_cf, r0
ldr sp, sp_irq
- mov r0, PSR_SYS_MODE
+ mov r0, #PSR_SYS_MODE
msr cpsr_cf, r0
ldr sp, sp_sys
ldr r1, =INTR_VECTOR
@@ -106,91 +106,91 @@ sp_irq: .word IWRAM_END - 0x60
.align 2, 0
.global IntrMain
IntrMain: @ 8000248
- mov r3, REG_BASE
- add r3, r3, 0x200
- ldr r2, [r3, OFFSET_REG_IE - 0x200]
- ldrh r1, [r3, OFFSET_REG_IME - 0x200]
+ mov r3, #REG_BASE
+ add r3, r3, #OFFSET_REG_IE
+ ldr r2, [r3]
+ ldrh r1, [r3, #OFFSET_REG_IME - 0x200]
mrs r0, spsr
- stmdb sp!, {r0-r3,lr}
- mov r0, 0
- strh r0, [r3, OFFSET_REG_IME - 0x200]
- and r1, r2, r2, lsr 16
- mov r12, 0
- ands r0, r1, INTR_FLAG_VCOUNT
+ stmfd sp!, {r0-r3,lr}
+ mov r0, #0
+ strh r0, [r3, #OFFSET_REG_IME - 0x200]
+ and r1, r2, r2, lsr #16
+ mov r12, #0
+ ands r0, r1, #INTR_FLAG_VCOUNT
bne IntrMain_FoundIntr
add r12, r12, 0x4
mov r0, 0x1
- strh r0, [r3, OFFSET_REG_IME - 0x200]
- ands r0, r1, INTR_FLAG_SERIAL
+ strh r0, [r3, #OFFSET_REG_IME - 0x200]
+ ands r0, r1, #INTR_FLAG_SERIAL
bne IntrMain_FoundIntr
add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_TIMER3
+ ands r0, r1, #INTR_FLAG_TIMER3
bne IntrMain_FoundIntr
add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_HBLANK
+ ands r0, r1, #INTR_FLAG_HBLANK
bne IntrMain_FoundIntr
add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_VBLANK
+ ands r0, r1, #INTR_FLAG_VBLANK
bne IntrMain_FoundIntr
add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_TIMER0
+ ands r0, r1, #INTR_FLAG_TIMER0
bne IntrMain_FoundIntr
add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_TIMER1
+ ands r0, r1, #INTR_FLAG_TIMER1
bne IntrMain_FoundIntr
add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_TIMER2
+ ands r0, r1, #INTR_FLAG_TIMER2
bne IntrMain_FoundIntr
add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_DMA0
+ ands r0, r1, #INTR_FLAG_DMA0
bne IntrMain_FoundIntr
add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_DMA1
+ ands r0, r1, #INTR_FLAG_DMA1
bne IntrMain_FoundIntr
add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_DMA2
+ ands r0, r1, #INTR_FLAG_DMA2
bne IntrMain_FoundIntr
add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_DMA3
+ ands r0, r1, #INTR_FLAG_DMA3
bne IntrMain_FoundIntr
add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_KEYPAD
+ ands r0, r1, #INTR_FLAG_KEYPAD
bne IntrMain_FoundIntr
add r12, r12, 0x4
- ands r0, r1, INTR_FLAG_GAMEPAK
- strbne r0, [r3, OFFSET_REG_SOUNDCNT_X - 0x200]
+ ands r0, r1, #INTR_FLAG_GAMEPAK
+ strbne r0, [r3, #REG_SOUNDCNT_X - REG_IE]
bne . @ spin
IntrMain_FoundIntr:
- strh r0, [r3, OFFSET_REG_IF - 0x200]
+ strh r0, [r3, #OFFSET_REG_IF - 0x200]
bic r2, r2, r0
ldr r0, =gSTWIStatus
ldr r0, [r0]
ldrb r0, [r0, 0xA]
mov r1, 0x8
- mov r0, r1, lsl r0
- orr r0, r0, INTR_FLAG_GAMEPAK
- orr r1, r0, INTR_FLAG_SERIAL | INTR_FLAG_TIMER3 | INTR_FLAG_VCOUNT | INTR_FLAG_HBLANK
+ lsl r0, r1, r0
+ orr r0, r0, #INTR_FLAG_GAMEPAK
+ orr r1, r0, #INTR_FLAG_SERIAL | INTR_FLAG_TIMER3 | INTR_FLAG_VCOUNT | INTR_FLAG_HBLANK
and r1, r1, r2
- strh r1, [r3, OFFSET_REG_IE - 0x200]
+ strh r1, [r3, #OFFSET_REG_IE - 0x200]
mrs r3, cpsr
- bic r3, r3, PSR_I_BIT | PSR_F_BIT | PSR_MODE_MASK
- orr r3, r3, PSR_SYS_MODE
+ bic r3, r3, #PSR_I_BIT | PSR_F_BIT | PSR_MODE_MASK
+ orr r3, r3, #PSR_SYS_MODE
msr cpsr_cf, r3
ldr r1, =gIntrTable
add r1, r1, r12
ldr r0, [r1]
- stmdb sp!, {lr}
+ stmfd sp!, {lr}
adr lr, IntrMain_RetAddr
bx r0
IntrMain_RetAddr:
- ldmia sp!, {lr}
+ ldmfd sp!, {lr}
mrs r3, cpsr
- bic r3, r3, PSR_I_BIT | PSR_F_BIT | PSR_MODE_MASK
- orr r3, r3, PSR_I_BIT | PSR_IRQ_MODE
+ bic r3, r3, #PSR_I_BIT | PSR_F_BIT | PSR_MODE_MASK
+ orr r3, r3, #PSR_I_BIT | PSR_IRQ_MODE
msr cpsr_cf, r3
ldmia sp!, {r0-r3,lr}
- strh r2, [r3, OFFSET_REG_IE - 0x200]
- strh r1, [r3, OFFSET_REG_IME - 0x200]
+ strh r2, [r3, #OFFSET_REG_IE - 0x200]
+ strh r1, [r3, #OFFSET_REG_IME - 0x200]
msr spsr_cf, r0
bx lr
diff --git a/src/data/text/nature_names.h b/src/data/text/nature_names.h
index d0d217d9b..601898445 100644
--- a/src/data/text/nature_names.h
+++ b/src/data/text/nature_names.h
@@ -24,7 +24,7 @@ static const u8 sSassyNatureName[] = _("SASSY");
static const u8 sCarefulNatureName[] = _("CAREFUL");
static const u8 sQuirkyNatureName[] = _("QUIRKY");
-const u8 *const gNatureNamePointers[] =
+const u8 *const gNatureNamePointers[NUM_NATURES] =
{
[NATURE_HARDY] = sHardyNatureName,
[NATURE_LONELY] = sLonelyNatureName,
diff --git a/src/data/union_room.h b/src/data/union_room.h
index 8cb0bc8aa..704978766 100644
--- a/src/data/union_room.h
+++ b/src/data/union_room.h
@@ -50,27 +50,36 @@ const u8 sText_4PlayerMode[] = _("4-PLAYER\nMODE");
const u8 sText_5PlayerMode[] = _("5-PLAYER\nMODE");
static const u8 *const sPlayersNeededOrModeTexts[][5] = {
+ // 2 players required
{
sText_1PlayerNeeded,
sText_2PlayerMode
- }, {
+ },
+ // 4 players required
+ {
sText_3PlayersNeeded,
sText_2PlayersNeeded,
sText_1PlayerNeeded,
sText_4PlayerMode
- }, {
+ },
+ // 2-5 players required
+ {
sText_1PlayerNeeded,
sText_2PlayerMode,
sText_3PlayerMode,
sText_4PlayerMode,
sText_5PlayerMode
- }, {
+ },
+ // 3-5 players required
+ {
sText_2PlayersNeeded,
sText_1PlayerNeeded,
sText_3PlayerMode,
sText_4PlayerMode,
sText_5PlayerMode
- }, {
+ },
+ // 2-4 players required
+ {
sText_1PlayerNeeded,
sText_2PlayerMode,
sText_3PlayerMode,
@@ -90,15 +99,15 @@ ALIGNED(4) const u8 sText_OtherTrainerUnavailableNow[] = _("The other TRAINER do
ALIGNED(4) const u8 sText_CantTransmitTrainerTooFar[] = _("You can't transmit with a TRAINER\nwho is too far away.\p");
ALIGNED(4) const u8 sText_TrainersNotReadyYet[] = _("The other TRAINER(S) is/are not\nready yet.\p");
-const u8 *const sCantTransmitToTrainerTexts[] = {
- sText_CantTransmitTrainerTooFar,
- sText_TrainersNotReadyYet
+static const u8 *const sCantTransmitToTrainerTexts[] = {
+ [UR_TRADE_PLAYER_NOT_READY - 1] = sText_CantTransmitTrainerTooFar,
+ [UR_TRADE_PARTNER_NOT_READY - 1] = sText_TrainersNotReadyYet
};
ALIGNED(4) const u8 sText_ModeWithTheseMembersWillBeCanceled[] = _("The {STR_VAR_1} MODE with\nthese members will be canceled.{PAUSE 60}");
ALIGNED(4) const u8 sText_MemberNoLongerAvailable[] = _("There is a member who can no\nlonger remain available.\p");
-const u8 *const sPlayerUnavailableTexts[] = {
+static const u8 *const sPlayerUnavailableTexts[] = {
sText_OtherTrainerUnavailableNow,
sText_MemberNoLongerAvailable
};
@@ -111,17 +120,17 @@ ALIGNED(4) const u8 sText_AwaitingOtherMembers[] = _("{STR_VAR_1}!\nAwaiting oth
ALIGNED(4) const u8 sText_QuitBeingMember[] = _("Quit being a member?");
ALIGNED(4) const u8 sText_StoppedBeingMember[] = _("You stopped being a member.\p");
-const u8 *const sPlayerDisconnectedTexts[] = {
- NULL,
- sText_MemberNoLongerAvailable,
- sText_TrainerAppearsUnavailable,
- NULL,
- NULL,
- NULL,
- sText_PlayerRepliedNo,
- NULL,
- NULL,
- sText_StoppedBeingMember
+static const u8 *const sPlayerDisconnectedTexts[] = {
+ [RFU_STATUS_OK] = NULL,
+ [RFU_STATUS_FATAL_ERROR] = sText_MemberNoLongerAvailable,
+ [RFU_STATUS_CONNECTION_ERROR] = sText_TrainerAppearsUnavailable,
+ [RFU_STATUS_CHILD_SEND_COMPLETE] = NULL,
+ [RFU_STATUS_NEW_CHILD_DETECTED] = NULL,
+ [RFU_STATUS_JOIN_GROUP_OK] = NULL,
+ [RFU_STATUS_JOIN_GROUP_NO] = sText_PlayerRepliedNo,
+ [RFU_STATUS_WAIT_ACK_JOIN_GROUP] = NULL,
+ [RFU_STATUS_LEAVE_GROUP_NOTICE] = NULL,
+ [RFU_STATUS_LEAVE_GROUP] = sText_StoppedBeingMember
};
ALIGNED(4) const u8 sText_WirelessLinkEstablished[] = _("The WIRELESS COMMUNICATION\nSYSTEM link has been established.");
@@ -130,16 +139,16 @@ ALIGNED(4) const u8 sText_LinkWithFriendDropped[] = _("The link with your friend
ALIGNED(4) const u8 sText_PlayerRepliedNo2[] = _("{STR_VAR_1} replied, “No…”");
const u8 *const sLinkDroppedTexts[] = {
- NULL,
- sText_LinkWithFriendDropped,
- sText_LinkWithFriendDropped,
- NULL,
- NULL,
- NULL,
- sText_PlayerRepliedNo2,
- NULL,
- NULL,
- NULL
+ [RFU_STATUS_OK] = NULL,
+ [RFU_STATUS_FATAL_ERROR] = sText_LinkWithFriendDropped,
+ [RFU_STATUS_CONNECTION_ERROR] = sText_LinkWithFriendDropped,
+ [RFU_STATUS_CHILD_SEND_COMPLETE] = NULL,
+ [RFU_STATUS_NEW_CHILD_DETECTED] = NULL,
+ [RFU_STATUS_JOIN_GROUP_OK] = NULL,
+ [RFU_STATUS_JOIN_GROUP_NO] = sText_PlayerRepliedNo2,
+ [RFU_STATUS_WAIT_ACK_JOIN_GROUP] = NULL,
+ [RFU_STATUS_LEAVE_GROUP_NOTICE] = NULL,
+ [RFU_STATUS_LEAVE_GROUP] = NULL
};
ALIGNED(4) const u8 sText_DoYouWantXMode[] = _("Do you want the {STR_VAR_2}\nMODE?");
@@ -251,7 +260,7 @@ ALIGNED(4) const u8 sText_WaitForBattleFemale[] = _("A battle? Of course, but I
ALIGNED(4) const u8 sText_WaitForChatFemale[] = _("Did you want to chat?\nOkay, but please wait a moment.");
ALIGNED(4) const u8 sText_ShowTrainerCardFemale[] = _("As my introduction, I'll show you\nmy TRAINER CARD.");
-const u8 *const sText_WaitOrShowCardTexts[GENDER_COUNT][4] = {
+static const u8 *const sText_WaitOrShowCardTexts[GENDER_COUNT][4] = {
{
sText_WaitForBattleMale,
sText_WaitForChatMale,
@@ -274,7 +283,7 @@ ALIGNED(4) const u8 sText_TradeWillBeStarted[] = _("The trade will be started.{P
ALIGNED(4) const u8 sText_BattleWillBeStarted[] = _("The battle will be started.{PAUSE 60}");
ALIGNED(4) const u8 sText_EnteringChat[] = _("Entering the chat…{PAUSE 60}");
-const u8 *const sStartActivityTexts[][GENDER_COUNT][3] = {
+static const u8 *const sStartActivityTexts[][GENDER_COUNT][3] = {
{
{
sText_BattleWillBeStarted,
@@ -325,18 +334,21 @@ const u8 *const sIfYouWantToDoSomethingTexts[GENDER_COUNT] = {
ALIGNED(4) const u8 sText_TrainerBattleBusy[] = _("Whoops! Sorry, but I have to do\nsomething else.\lAnother time, okay?\p");
ALIGNED(4) const u8 sText_NeedTwoMonsOfLevel30OrLower1[] = _("If you want to battle, you need\ntwo POKéMON that are below\lLv. 30.\p");
ALIGNED(4) const u8 sText_NeedTwoMonsOfLevel30OrLower2[] = _("For a battle, you need two\nPOKéMON that are below Lv. 30.\p");
-ALIGNED(4) const u8 sText_DeclineBattleMale[] = _("Oh, all right.\nCome see me anytime, okay?\p");
-ALIGNED(4) const u8 stext_DeclineBattleFemale[] = _("Oh…\nPlease come by anytime.\p");
-static const u8 *const sDeclineBattleTexts[GENDER_COUNT] = {
- sText_DeclineBattleMale,
- stext_DeclineBattleFemale
+ALIGNED(4) const u8 sText_DeclineChatMale[] = _("Oh, all right.\nCome see me anytime, okay?\p");
+ALIGNED(4) const u8 stext_DeclineChatFemale[] = _("Oh…\nPlease come by anytime.\p");
+
+// Response from partner when player declines chat
+static const u8 *const sDeclineChatTexts[GENDER_COUNT] = {
+ sText_DeclineChatMale,
+ stext_DeclineChatFemale
};
ALIGNED(4) const u8 sText_ChatDeclinedMale[] = _("Oh, sorry!\nI just can't right this instant.\lLet's chat another time.\p");
ALIGNED(4) const u8 sText_ChatDeclinedFemale[] = _("Oh, I'm sorry.\nI have too much to do right now.\lLet's chat some other time.\p");
-const u8 *const sChatDeclinedTexts[GENDER_COUNT] = {
+// Response from partner when they decline chat
+static const u8 *const sChatDeclinedTexts[GENDER_COUNT] = {
sText_ChatDeclinedMale,
sText_ChatDeclinedFemale
};
@@ -484,8 +496,8 @@ static const u8 *const sChooseTrainerTexts[NUM_LINK_GROUP_TYPES] =
[LINK_GROUP_BERRY_PICKING] = sText_ChooseLeaderBerryPicking,
[LINK_GROUP_WONDER_CARD] = sText_ChooseTrainerToShareWonderCards,
[LINK_GROUP_WONDER_NEWS] = sText_ChooseTrainerToShareWonderNews,
- [LINK_GROUP_UNK_9] = NULL,
- [LINK_GROUP_UNK_10] = NULL,
+ [LINK_GROUP_UNION_ROOM_RESUME] = NULL,
+ [LINK_GROUP_UNION_ROOM_INIT] = NULL,
[LINK_GROUP_UNK_11] = NULL,
[LINK_GROUP_RECORD_CORNER] = sText_ChooseLeaderRecordCorner,
[LINK_GROUP_BERRY_BLENDER] = sText_ChooseLeaderBerryBlender,
@@ -567,39 +579,39 @@ const u8 *const sGladToMeetYouTexts[GENDER_COUNT] = {
ALIGNED(4) const u8 sText_FinishedCheckingPlayersTrainerCard[] = _("Finished checking {SPECIAL_F7 0x01}'s\nTRAINER CARD.{PAUSE 60}");
-const u8 *const sLinkGroupActivityTexts[] = {
- sText_EmptyString,
- sText_SingleBattle,
- sText_DoubleBattle,
- sText_MultiBattle,
- sText_PokemonTrades,
- sText_Chat,
- sText_WonderCards,
- sText_WonderNews,
- sText_Cards,
- sText_PokemonJump,
- sText_BerryCrush,
- sText_BerryPicking,
- sText_Search,
- sText_EmptyString,
- sText_BattleTowerOpenLv,
- sText_RecordCorner,
- sText_BerryBlender,
- sText_EmptyString,
- sText_EmptyString,
- sText_EmptyString,
- sText_EmptyString,
- sText_WonderCards,
- sText_WonderNews,
- sText_CoolContest,
- sText_BeautyContest,
- sText_CuteContest,
- sText_SmartContest,
- sText_ToughContest,
- sText_BattleTowerLv50
+static const u8 *const sLinkGroupActivityNameTexts[] = {
+ [ACTIVITY_NONE] = sText_EmptyString,
+ [ACTIVITY_BATTLE_SINGLE] = sText_SingleBattle,
+ [ACTIVITY_BATTLE_DOUBLE] = sText_DoubleBattle,
+ [ACTIVITY_BATTLE_MULTI] = sText_MultiBattle,
+ [ACTIVITY_TRADE] = sText_PokemonTrades,
+ [ACTIVITY_CHAT] = sText_Chat,
+ [ACTIVITY_WONDER_CARD] = sText_WonderCards,
+ [ACTIVITY_WONDER_NEWS] = sText_WonderNews,
+ [ACTIVITY_CARD] = sText_Cards,
+ [ACTIVITY_POKEMON_JUMP] = sText_PokemonJump,
+ [ACTIVITY_BERRY_CRUSH] = sText_BerryCrush,
+ [ACTIVITY_BERRY_PICK] = sText_BerryPicking,
+ [ACTIVITY_SEARCH] = sText_Search,
+ [ACTIVITY_SPIN_TRADE] = sText_EmptyString,
+ [ACTIVITY_BATTLE_TOWER_OPEN] = sText_BattleTowerOpenLv,
+ [ACTIVITY_RECORD_CORNER] = sText_RecordCorner,
+ [ACTIVITY_BERRY_BLENDER] = sText_BerryBlender,
+ [ACTIVITY_ACCEPT] = sText_EmptyString,
+ [ACTIVITY_DECLINE] = sText_EmptyString,
+ [ACTIVITY_NPCTALK] = sText_EmptyString,
+ [ACTIVITY_PLYRTALK] = sText_EmptyString,
+ [ACTIVITY_WONDER_CARD2] = sText_WonderCards,
+ [ACTIVITY_WONDER_NEWS2] = sText_WonderNews,
+ [ACTIVITY_CONTEST_COOL] = sText_CoolContest,
+ [ACTIVITY_CONTEST_BEAUTY] = sText_BeautyContest,
+ [ACTIVITY_CONTEST_CUTE] = sText_CuteContest,
+ [ACTIVITY_CONTEST_SMART] = sText_SmartContest,
+ [ACTIVITY_CONTEST_TOUGH] = sText_ToughContest,
+ [ACTIVITY_BATTLE_TOWER] = sText_BattleTowerLv50
};
-const struct WindowTemplate gUnknown_082F00BC = {
+static const struct WindowTemplate sWindowTemplate_BButtonCancel = {
.bg = 0x00,
.tilemapLeft = 0x00,
.tilemapTop = 0x00,
@@ -609,62 +621,69 @@ const struct WindowTemplate gUnknown_082F00BC = {
.baseBlock = 0x0008
};
-const u32 gUnknown_082F00C4[NUM_LINK_GROUP_TYPES] = {
- 0x0201,
- 0x0202,
- 0x0403,
- 0x0204,
- 0x2509,
- 0x250a,
- 0x350b,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x0000,
- 0x240f,
- 0x2410,
- 0x0000,
- 0x2417,
- 0x2418,
- 0x2419,
- 0x241a,
- 0x241b,
- 0x021c,
- 0x020e
+// Minimum and maximum number of players for a link group
+// A minimum of 0 means the min and max are equal
+#define LINK_GROUP_CAPACITY(min, max)(((min) << 12) | ((max) << 8))
+#define GROUP_MAX(capacity)(capacity & 0x0F)
+#define GROUP_MIN(capacity)(capacity >> 4)
+#define GROUP_MIN2(capacity)(capacity & 0xF0) // Unnecessary to have both, but needed to match
+
+static const u32 sLinkGroupToActivityAndCapacity[NUM_LINK_GROUP_TYPES] = {
+ [LINK_GROUP_SINGLE_BATTLE] = ACTIVITY_BATTLE_SINGLE | LINK_GROUP_CAPACITY(0, 2),
+ [LINK_GROUP_DOUBLE_BATTLE] = ACTIVITY_BATTLE_DOUBLE | LINK_GROUP_CAPACITY(0, 2),
+ [LINK_GROUP_MULTI_BATTLE] = ACTIVITY_BATTLE_MULTI | LINK_GROUP_CAPACITY(0, 4),
+ [LINK_GROUP_TRADE] = ACTIVITY_TRADE | LINK_GROUP_CAPACITY(0, 2),
+ [LINK_GROUP_POKEMON_JUMP] = ACTIVITY_POKEMON_JUMP | LINK_GROUP_CAPACITY(2, 5),
+ [LINK_GROUP_BERRY_CRUSH] = ACTIVITY_BERRY_CRUSH | LINK_GROUP_CAPACITY(2, 5),
+ [LINK_GROUP_BERRY_PICKING] = ACTIVITY_BERRY_PICK | LINK_GROUP_CAPACITY(3, 5),
+ [LINK_GROUP_WONDER_CARD] = ACTIVITY_NONE | LINK_GROUP_CAPACITY(0, 0),
+ [LINK_GROUP_WONDER_NEWS] = ACTIVITY_NONE | LINK_GROUP_CAPACITY(0, 0),
+ [LINK_GROUP_UNION_ROOM_RESUME] = ACTIVITY_NONE | LINK_GROUP_CAPACITY(0, 0),
+ [LINK_GROUP_UNION_ROOM_INIT] = ACTIVITY_NONE | LINK_GROUP_CAPACITY(0, 0),
+ [LINK_GROUP_UNK_11] = ACTIVITY_NONE | LINK_GROUP_CAPACITY(0, 0),
+ [LINK_GROUP_RECORD_CORNER] = ACTIVITY_RECORD_CORNER | LINK_GROUP_CAPACITY(2, 4),
+ [LINK_GROUP_BERRY_BLENDER] = ACTIVITY_BERRY_BLENDER | LINK_GROUP_CAPACITY(2, 4),
+ [LINK_GROUP_UNK_14] = ACTIVITY_NONE | LINK_GROUP_CAPACITY(0, 0),
+ [LINK_GROUP_COOL_CONTEST] = ACTIVITY_CONTEST_COOL | LINK_GROUP_CAPACITY(2, 4),
+ [LINK_GROUP_BEAUTY_CONTEST] = ACTIVITY_CONTEST_BEAUTY | LINK_GROUP_CAPACITY(2, 4),
+ [LINK_GROUP_CUTE_CONTEST] = ACTIVITY_CONTEST_CUTE | LINK_GROUP_CAPACITY(2, 4),
+ [LINK_GROUP_SMART_CONTEST] = ACTIVITY_CONTEST_SMART | LINK_GROUP_CAPACITY(2, 4),
+ [LINK_GROUP_TOUGH_CONTEST] = ACTIVITY_CONTEST_TOUGH | LINK_GROUP_CAPACITY(2, 4),
+ [LINK_GROUP_BATTLE_TOWER] = ACTIVITY_BATTLE_TOWER | LINK_GROUP_CAPACITY(0, 2),
+ [LINK_GROUP_BATTLE_TOWER_OPEN] = ACTIVITY_BATTLE_TOWER_OPEN | LINK_GROUP_CAPACITY(0, 2)
};
-const struct WindowTemplate gUnknown_082F011C = {
- .bg = 0x00,
- .tilemapLeft = 0x01,
- .tilemapTop = 0x03,
- .width = 0x0d,
- .height = 0x08,
- .paletteNum = 0x0f,
+static const struct WindowTemplate sWindowTemplate_PlayerList = {
+ .bg = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 3,
+ .width = 13,
+ .height = 8,
+ .paletteNum = 15,
.baseBlock = 0x0044
};
-const struct WindowTemplate gUnknown_082F0124 = {
- .bg = 0x00,
- .tilemapLeft = 0x01,
- .tilemapTop = 0x03,
- .width = 0x0d,
- .height = 0x0a,
- .paletteNum = 0x0f,
+static const struct WindowTemplate sWindowTemplate_5PlayerList = {
+ .bg = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 3,
+ .width = 13,
+ .height = 10,
+ .paletteNum = 15,
.baseBlock = 0x0044
};
-const struct WindowTemplate gUnknown_082F012C = {
- .bg = 0x00,
- .tilemapLeft = 0x10,
- .tilemapTop = 0x03,
- .width = 0x07,
- .height = 0x04,
- .paletteNum = 0x0f,
+static const struct WindowTemplate sWindowTemplate_NumPlayerMode = {
+ .bg = 0,
+ .tilemapLeft = 16,
+ .tilemapTop = 3,
+ .width = 7,
+ .height = 4,
+ .paletteNum = 15,
.baseBlock = 0x00c6
};
-const struct ListMenuItem gUnknown_082F0134[] = {
+static const struct ListMenuItem sPossibleGroupMembersListMenuItems[] = {
{ sText_EmptyString, 0 },
{ sText_EmptyString, 1 },
{ sText_EmptyString, 2 },
@@ -672,11 +691,11 @@ const struct ListMenuItem gUnknown_082F0134[] = {
{ sText_EmptyString, 4 }
};
-const struct ListMenuTemplate gUnknown_082F015C = {
- .items = gUnknown_082F0134,
+static const struct ListMenuTemplate sListMenuTemplate_PossibleGroupMembers = {
+ .items = sPossibleGroupMembersListMenuItems,
.moveCursorFunc = NULL,
- .itemPrintFunc = sub_8013278,
- .totalItems = 5,
+ .itemPrintFunc = ItemPrintFunc_PossibleGroupMembers,
+ .totalItems = ARRAY_COUNT(sPossibleGroupMembersListMenuItems),
.maxShowed = 5,
.windowId = 0,
.header_X = 0,
@@ -732,11 +751,11 @@ const struct ListMenuItem gUnknown_082F0184[] = {
{ sText_EmptyString, 15 }
};
-const struct ListMenuTemplate gUnknown_082F0204 = {
+static const struct ListMenuTemplate sListMenuTemplate_UnionRoomGroups = {
.items = gUnknown_082F0184,
.moveCursorFunc = ListMenuDefaultCursorMoveFunc,
- .itemPrintFunc = sub_8013DF4,
- .totalItems = 16,
+ .itemPrintFunc = ListMenuItemPrintFunc_UnionRoomGroups,
+ .totalItems = ARRAY_COUNT(gUnknown_082F0184),
.maxShowed = 5,
.windowId = 0,
.header_X = 0,
@@ -753,7 +772,7 @@ const struct ListMenuTemplate gUnknown_082F0204 = {
.cursorKind = 0
};
-const struct WindowTemplate gUnknown_082F021C = {
+static const struct WindowTemplate sWindowTemplate_InviteToActivity = {
.bg = 0x00,
.tilemapLeft = 0x14,
.tilemapTop = 0x05,
@@ -770,11 +789,11 @@ const struct ListMenuItem gUnknown_082F0224[] = {
{ sText_Exit, 0x040 }
};
-const struct ListMenuTemplate gUnknown_082F0244 = {
+static const struct ListMenuTemplate sListMenuTemplate_InviteToActivity = {
.items = gUnknown_082F0224,
.moveCursorFunc = ListMenuDefaultCursorMoveFunc,
.itemPrintFunc = NULL,
- .totalItems = 4,
+ .totalItems = ARRAY_COUNT(gUnknown_082F0224),
.maxShowed = 4,
.windowId = 0,
.header_X = 0,
@@ -791,7 +810,7 @@ const struct ListMenuTemplate gUnknown_082F0244 = {
.cursorKind = 0
};
-const struct WindowTemplate gUnknown_082F025C = {
+static const struct WindowTemplate sWindowTemplate_RegisterForTrade = {
.bg = 0x00,
.tilemapLeft = 0x12,
.tilemapTop = 0x07,
@@ -801,17 +820,17 @@ const struct WindowTemplate gUnknown_082F025C = {
.baseBlock = 0x0001
};
-const struct ListMenuItem gUnknown_082F0264[] = {
+static const struct ListMenuItem sRegisterForTradeListMenuItems[] = {
{ gText_Register, 1 },
{ sText_Info, 2 },
{ sText_Exit, 3 }
};
-const struct ListMenuTemplate gUnknown_082F027C = {
- .items = gUnknown_082F0264,
+static const struct ListMenuTemplate sListMenuTemplate_RegisterForTrade = {
+ .items = sRegisterForTradeListMenuItems,
.moveCursorFunc = ListMenuDefaultCursorMoveFunc,
.itemPrintFunc = NULL,
- .totalItems = 3,
+ .totalItems = ARRAY_COUNT(sRegisterForTradeListMenuItems),
.maxShowed = 3,
.windowId = 0,
.header_X = 0,
@@ -838,7 +857,7 @@ const struct WindowTemplate gUnknown_082F0294 = {
.baseBlock = 0x0001
};
-static const struct ListMenuItem sTradingBoardTypes[] = {
+static const struct ListMenuItem sTradingBoardTypes[NUMBER_OF_MON_TYPES] = {
{ gTypeNames[TYPE_NORMAL], TYPE_NORMAL },
{ gTypeNames[TYPE_FIRE], TYPE_FIRE },
{ gTypeNames[TYPE_WATER], TYPE_WATER },
@@ -856,14 +875,14 @@ static const struct ListMenuItem sTradingBoardTypes[] = {
{ gTypeNames[TYPE_DRAGON], TYPE_DRAGON },
{ gTypeNames[TYPE_STEEL], TYPE_STEEL },
{ gTypeNames[TYPE_DARK], TYPE_DARK },
- { sText_Exit, NUMBER_OF_MON_TYPES }
+ { sText_Exit, NUMBER_OF_MON_TYPES }
};
-const struct ListMenuTemplate sMenuTemplate_TradingBoardRequestType = {
+static const struct ListMenuTemplate sMenuTemplate_TradingBoardRequestType = {
.items = sTradingBoardTypes,
.moveCursorFunc = ListMenuDefaultCursorMoveFunc,
.itemPrintFunc = NULL,
- .totalItems = NUMBER_OF_MON_TYPES,
+ .totalItems = ARRAY_COUNT(sTradingBoardTypes),
.maxShowed = 6,
.windowId = 0,
.header_X = 0,
@@ -880,7 +899,7 @@ const struct ListMenuTemplate sMenuTemplate_TradingBoardRequestType = {
.cursorKind = 0
};
-const struct WindowTemplate gUnknown_082F0344 = {
+static const struct WindowTemplate sWindowTemplate_TradingBoard = {
.bg = 0x00,
.tilemapLeft = 0x01,
.tilemapTop = 0x01,
@@ -900,7 +919,7 @@ const struct WindowTemplate gUnknown_082F034C = {
.baseBlock = 0x0039
};
-const struct ListMenuItem gUnknown_082F0354[] = {
+static const struct ListMenuItem sTradeBoardListMenuItems[] = {
{ sText_EmptyString, -3 },
{ sText_EmptyString, 0 },
{ sText_EmptyString, 1 },
@@ -913,11 +932,11 @@ const struct ListMenuItem gUnknown_082F0354[] = {
{ sText_Exit2, 8 }
};
-const struct ListMenuTemplate gUnknown_082F03A4 = {
- .items = gUnknown_082F0354,
+static const struct ListMenuTemplate sTradeBoardListMenuTemplate = {
+ .items = sTradeBoardListMenuItems,
.moveCursorFunc = ListMenuDefaultCursorMoveFunc,
- .itemPrintFunc = sub_8017BE8,
- .totalItems = 10,
+ .itemPrintFunc = TradeBoardListMenuItemPrintFunc,
+ .totalItems = ARRAY_COUNT(sTradeBoardListMenuItems),
.maxShowed = 6,
.windowId = 0,
.header_X = 0,
@@ -944,7 +963,7 @@ const struct WindowTemplate UnrefWindowTemplate_082F03B4 = {
.baseBlock = 0x0039
};
-const struct ListMenuItem gUnknown_082F03C4[] = {
+static const struct ListMenuItem sEmptyListMenuItems[] = {
{ sText_EmptyString, 0 },
{ sText_EmptyString, 1 },
{ sText_EmptyString, 2 },
@@ -963,11 +982,12 @@ const struct ListMenuItem gUnknown_082F03C4[] = {
{ sText_EmptyString, 15 }
};
-const struct ListMenuTemplate UnrefListMenuTemplate_082F0444 = {
- .items = gUnknown_082F03C4,
+// Unused
+static const struct ListMenuTemplate sUnknownListMenuTemplate = {
+ .items = sEmptyListMenuItems,
.moveCursorFunc = ListMenuDefaultCursorMoveFunc,
.itemPrintFunc = nullsub_14,
- .totalItems = 16,
+ .totalItems = ARRAY_COUNT(sEmptyListMenuItems),
.maxShowed = 4,
.windowId = 0,
.header_X = 0,
@@ -984,78 +1004,100 @@ const struct ListMenuTemplate UnrefListMenuTemplate_082F0444 = {
.cursorKind = 0
};
-const struct UnkStruct_Shared gUnknown_082F045C = {0};
-
-ALIGNED(4) const u8 gUnknown_082F0474[] = {0x01, 0xff};
-ALIGNED(4) const u8 gUnknown_082F0478[] = {0x02, 0xff};
-ALIGNED(4) const u8 gUnknown_082F047C[] = {0x03, 0xff};
-ALIGNED(4) const u8 gUnknown_082F0480[] = {0x04, 0xff};
-ALIGNED(4) const u8 gUnknown_082F0484[] = {0x09, 0xff};
-ALIGNED(4) const u8 gUnknown_082F0488[] = {0x0a, 0xff};
-ALIGNED(4) const u8 gUnknown_082F048C[] = {0x0b, 0xff};
-ALIGNED(4) const u8 gUnknown_082F0490[] = {0x15, 0xff};
-ALIGNED(4) const u8 gUnknown_082F0494[] = {0x16, 0xff};
-ALIGNED(4) const u8 gUnknown_082F0498[] = {0x40, 0x41, 0x44, 0x45, 0x48, 0x51, 0x52, 0x53, 0x54, 0xff};
-ALIGNED(4) const u8 gUnknown_082F04A4[] = {0x0c, 0xff};
-ALIGNED(4) const u8 gUnknown_082F04A8[] = {0x01, 0x02, 0x03, 0x04, 0x09, 0x0a, 0x0b, 0x15, 0x16, 0x0d, 0xff};
-ALIGNED(4) const u8 gUnknown_082F04B4[] = {0x0f, 0xff};
-ALIGNED(4) const u8 gUnknown_082F04B8[] = {0x10, 0xff};
-ALIGNED(4) const u8 gUnknown_082F04BC[] = {0x17, 0xff};
-ALIGNED(4) const u8 gUnknown_082F04C0[] = {0x18, 0xff};
-ALIGNED(4) const u8 gUnknown_082F04C4[] = {0x19, 0xff};
-ALIGNED(4) const u8 gUnknown_082F04C8[] = {0x1a, 0xff};
-ALIGNED(4) const u8 gUnknown_082F04CC[] = {0x1b, 0xff};
-ALIGNED(4) const u8 gUnknown_082F04D0[] = {0x1c, 0xff};
-ALIGNED(4) const u8 gUnknown_082F04D4[] = {0x0e, 0xff};
-
-const u8 *const gUnknown_082F04D8[NUM_LINK_GROUP_TYPES] = {
- gUnknown_082F0474,
- gUnknown_082F0478,
- gUnknown_082F047C,
- gUnknown_082F0480,
- gUnknown_082F0484,
- gUnknown_082F0488,
- gUnknown_082F048C,
- gUnknown_082F0490,
- gUnknown_082F0494,
- gUnknown_082F0498,
- gUnknown_082F04A4,
- gUnknown_082F04A8,
- gUnknown_082F04B4,
- gUnknown_082F04B8,
- NULL,
- gUnknown_082F04BC,
- gUnknown_082F04C0,
- gUnknown_082F04C4,
- gUnknown_082F04C8,
- gUnknown_082F04CC,
- gUnknown_082F04D0,
- gUnknown_082F04D4
+const struct WirelessGnameUnamePair sWirelessGnameUnamePair_Dummy = {0};
+
+ALIGNED(4) const u8 sAcceptedActivityIds_SingleBattle[] = {ACTIVITY_BATTLE_SINGLE, 0xff};
+ALIGNED(4) const u8 sAcceptedActivityIds_DoubleBattle[] = {ACTIVITY_BATTLE_DOUBLE, 0xff};
+ALIGNED(4) const u8 sAcceptedActivityIds_MultiBattle[] = {ACTIVITY_BATTLE_MULTI, 0xff};
+ALIGNED(4) const u8 sAcceptedActivityIds_Trade[] = {ACTIVITY_TRADE, 0xff};
+ALIGNED(4) const u8 sAcceptedActivityIds_PokemonJump[] = {ACTIVITY_POKEMON_JUMP, 0xff};
+ALIGNED(4) const u8 sAcceptedActivityIds_BerryCrush[] = {ACTIVITY_BERRY_CRUSH, 0xff};
+ALIGNED(4) const u8 sAcceptedActivityIds_BerryPicking[] = {ACTIVITY_BERRY_PICK, 0xff};
+ALIGNED(4) const u8 sAcceptedActivityIds_WonderCard[] = {ACTIVITY_WONDER_CARD2, 0xff};
+ALIGNED(4) const u8 sAcceptedActivityIds_WonderNews[] = {ACTIVITY_WONDER_NEWS2, 0xff};
+ALIGNED(4) const u8 sAcceptedActivityIds_Resume[] = {
+ IN_UNION_ROOM | ACTIVITY_NONE,
+ IN_UNION_ROOM | ACTIVITY_BATTLE_SINGLE,
+ IN_UNION_ROOM | ACTIVITY_TRADE,
+ IN_UNION_ROOM | ACTIVITY_CHAT,
+ IN_UNION_ROOM | ACTIVITY_CARD,
+ IN_UNION_ROOM | ACTIVITY_ACCEPT,
+ IN_UNION_ROOM | ACTIVITY_DECLINE,
+ IN_UNION_ROOM | ACTIVITY_NPCTALK,
+ IN_UNION_ROOM | ACTIVITY_PLYRTALK,
+ 0xff
+};
+ALIGNED(4) const u8 sAcceptedActivityIds_Init[] = {ACTIVITY_SEARCH, 0xff};
+ALIGNED(4) const u8 sAcceptedActivityIds_Unk11[] = {
+ ACTIVITY_BATTLE_SINGLE,
+ ACTIVITY_BATTLE_DOUBLE,
+ ACTIVITY_BATTLE_MULTI,
+ ACTIVITY_TRADE,
+ ACTIVITY_POKEMON_JUMP,
+ ACTIVITY_BERRY_CRUSH,
+ ACTIVITY_BERRY_PICK,
+ ACTIVITY_WONDER_CARD2,
+ ACTIVITY_WONDER_NEWS2,
+ ACTIVITY_SPIN_TRADE,
+ 0xff
+};
+ALIGNED(4) const u8 sAcceptedActivityIds_RecordCorner[] = {ACTIVITY_RECORD_CORNER, 0xff};
+ALIGNED(4) const u8 sAcceptedActivityIds_BerryBlender[] = {ACTIVITY_BERRY_BLENDER, 0xff};
+ALIGNED(4) const u8 sAcceptedActivityIds_CoolContest[] = {ACTIVITY_CONTEST_COOL, 0xff};
+ALIGNED(4) const u8 sAcceptedActivityIds_BeautyContest[] = {ACTIVITY_CONTEST_BEAUTY, 0xff};
+ALIGNED(4) const u8 sAcceptedActivityIds_CuteContest[] = {ACTIVITY_CONTEST_CUTE, 0xff};
+ALIGNED(4) const u8 sAcceptedActivityIds_SmartContest[] = {ACTIVITY_CONTEST_SMART, 0xff};
+ALIGNED(4) const u8 sAcceptedActivityIds_ToughContest[] = {ACTIVITY_CONTEST_TOUGH, 0xff};
+ALIGNED(4) const u8 sAcceptedActivityIds_BattleTower[] = {ACTIVITY_BATTLE_TOWER, 0xff};
+ALIGNED(4) const u8 sAcceptedActivityIds_BattleTowerOpen[] = {ACTIVITY_BATTLE_TOWER_OPEN, 0xff};
+
+const u8 *const sAcceptedActivityIds[NUM_LINK_GROUP_TYPES] = {
+ [LINK_GROUP_SINGLE_BATTLE] = sAcceptedActivityIds_SingleBattle,
+ [LINK_GROUP_DOUBLE_BATTLE] = sAcceptedActivityIds_DoubleBattle,
+ [LINK_GROUP_MULTI_BATTLE] = sAcceptedActivityIds_MultiBattle,
+ [LINK_GROUP_TRADE] = sAcceptedActivityIds_Trade,
+ [LINK_GROUP_POKEMON_JUMP] = sAcceptedActivityIds_PokemonJump,
+ [LINK_GROUP_BERRY_CRUSH] = sAcceptedActivityIds_BerryCrush,
+ [LINK_GROUP_BERRY_PICKING] = sAcceptedActivityIds_BerryPicking,
+ [LINK_GROUP_WONDER_CARD] = sAcceptedActivityIds_WonderCard,
+ [LINK_GROUP_WONDER_NEWS] = sAcceptedActivityIds_WonderNews,
+ [LINK_GROUP_UNION_ROOM_RESUME] = sAcceptedActivityIds_Resume,
+ [LINK_GROUP_UNION_ROOM_INIT] = sAcceptedActivityIds_Init,
+ [LINK_GROUP_UNK_11] = sAcceptedActivityIds_Unk11,
+ [LINK_GROUP_RECORD_CORNER] = sAcceptedActivityIds_RecordCorner,
+ [LINK_GROUP_BERRY_BLENDER] = sAcceptedActivityIds_BerryBlender,
+ [LINK_GROUP_UNK_14] = NULL,
+ [LINK_GROUP_COOL_CONTEST] = sAcceptedActivityIds_CoolContest,
+ [LINK_GROUP_BEAUTY_CONTEST] = sAcceptedActivityIds_BeautyContest,
+ [LINK_GROUP_CUTE_CONTEST] = sAcceptedActivityIds_CuteContest,
+ [LINK_GROUP_SMART_CONTEST] = sAcceptedActivityIds_SmartContest,
+ [LINK_GROUP_TOUGH_CONTEST] = sAcceptedActivityIds_ToughContest,
+ [LINK_GROUP_BATTLE_TOWER] = sAcceptedActivityIds_BattleTower,
+ [LINK_GROUP_BATTLE_TOWER_OPEN] = sAcceptedActivityIds_BattleTowerOpen
};
-// Link group type to ID for gUnknown_02022C2C
-const u8 gUnknown_082F0530[NUM_LINK_GROUP_TYPES + 2] =
+static const u8 sLinkGroupToURoomActivity[NUM_LINK_GROUP_TYPES + 2] =
{
- 0x01,
- 0x02,
- 0x03,
- 0x04,
- 0x09,
- 0x0a,
- 0x0b,
- 0x15,
- 0x16,
- 0x00,
- 0x00,
- 0x00,
- 0x0f,
- 0x10,
- 0x00,
- 0x17,
- 0x18,
- 0x19,
- 0x1a,
- 0x1b,
- 0x1c,
- 0x0e
+ [LINK_GROUP_SINGLE_BATTLE] = ACTIVITY_BATTLE_SINGLE,
+ [LINK_GROUP_DOUBLE_BATTLE] = ACTIVITY_BATTLE_DOUBLE,
+ [LINK_GROUP_MULTI_BATTLE] = ACTIVITY_BATTLE_MULTI,
+ [LINK_GROUP_TRADE] = ACTIVITY_TRADE,
+ [LINK_GROUP_POKEMON_JUMP] = ACTIVITY_POKEMON_JUMP,
+ [LINK_GROUP_BERRY_CRUSH] = ACTIVITY_BERRY_CRUSH,
+ [LINK_GROUP_BERRY_PICKING] = ACTIVITY_BERRY_PICK,
+ [LINK_GROUP_WONDER_CARD] = ACTIVITY_WONDER_CARD2,
+ [LINK_GROUP_WONDER_NEWS] = ACTIVITY_WONDER_NEWS2,
+ [LINK_GROUP_UNION_ROOM_RESUME] = ACTIVITY_NONE,
+ [LINK_GROUP_UNION_ROOM_INIT] = ACTIVITY_NONE,
+ [LINK_GROUP_UNK_11] = ACTIVITY_NONE,
+ [LINK_GROUP_RECORD_CORNER] = ACTIVITY_RECORD_CORNER,
+ [LINK_GROUP_BERRY_BLENDER] = ACTIVITY_BERRY_BLENDER,
+ [LINK_GROUP_UNK_14] = ACTIVITY_NONE,
+ [LINK_GROUP_COOL_CONTEST] = ACTIVITY_CONTEST_COOL,
+ [LINK_GROUP_BEAUTY_CONTEST] = ACTIVITY_CONTEST_BEAUTY,
+ [LINK_GROUP_CUTE_CONTEST] = ACTIVITY_CONTEST_CUTE,
+ [LINK_GROUP_SMART_CONTEST] = ACTIVITY_CONTEST_SMART,
+ [LINK_GROUP_TOUGH_CONTEST] = ACTIVITY_CONTEST_TOUGH,
+ [LINK_GROUP_BATTLE_TOWER] = ACTIVITY_BATTLE_TOWER,
+ [LINK_GROUP_BATTLE_TOWER_OPEN] = ACTIVITY_BATTLE_TOWER_OPEN
};
diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c
index 262b7d111..3ca7a1cf7 100644
--- a/src/dodrio_berry_picking.c
+++ b/src/dodrio_berry_picking.c
@@ -450,7 +450,7 @@ static void (*const gUnknown_082F7AF4[])(void) =
};
// code
-void sub_802493C(u16 a0, void (*callback)(void))
+void StartDodrioBerryPicking(u16 a0, void (*callback)(void))
{
gUnknown_03000DB0 = FALSE;
@@ -832,9 +832,9 @@ static void sub_8025158(void)
static bool32 sub_8025170(void)
{
- u8 r4 = GetBlockReceivedStatus();
- u8 r0 = sub_800A9D8();
- if (r4 == r0)
+ u8 recvStatus = GetBlockReceivedStatus();
+ u8 playerFlags = GetLinkPlayerCountAsBitFlags();
+ if (recvStatus == playerFlags)
{
ResetBlockReceivedFlags();
return TRUE;
@@ -4483,12 +4483,12 @@ static void sub_802A380(void)
case 2:
if (!IsDma3ManagerBusyWithBgCopy())
{
- CreateTask(sub_8153688, 0);
+ CreateTask(Task_LinkSave, 0);
gUnknown_02022CF8->state++;
}
break;
case 3:
- if (!FuncIsActiveTask(sub_8153688))
+ if (!FuncIsActiveTask(Task_LinkSave))
gUnknown_02022CF8->state++;
break;
default:
diff --git a/src/easy_chat.c b/src/easy_chat.c
index 1bdb3fdc0..44a7b90c1 100644
--- a/src/easy_chat.c
+++ b/src/easy_chat.c
@@ -29,7 +29,6 @@
#include "window.h"
#include "constants/easy_chat.h"
#include "constants/event_objects.h"
-#include "constants/flags.h"
#include "constants/lilycove_lady.h"
#include "constants/mauville_old_man.h"
#include "constants/songs.h"
@@ -5273,12 +5272,17 @@ void InitEasyChatPhrases(void)
gSaveBlock1Ptr->mail[i].words[j] = 0xFFFF;
}
+#ifndef UBFIX
// BUG: This is supposed to clear 64 bits, but this loop is clearing 64 bytes.
// However, this bug has no resulting effect on gameplay because only the
// Mauville old man data is corrupted, which is initialized directly after
// this function is called when starting a new game.
for (i = 0; i < 64; i++)
gSaveBlock1Ptr->additionalPhrases[i] = 0;
+#else
+ for (i = 0; i < ARRAY_COUNT(gSaveBlock1Ptr->additionalPhrases); i++)
+ gSaveBlock1Ptr->additionalPhrases[i] = 0;
+#endif
}
static bool8 sub_811F28C(void)
diff --git a/src/ereader_screen.c b/src/ereader_screen.c
index 754bbe445..26f7eb679 100755
--- a/src/ereader_screen.c
+++ b/src/ereader_screen.c
@@ -85,10 +85,10 @@ static u8 sub_81D4DE8(struct Unk03006370 *arg0)
return var0;
}
-static void sub_81D4E30(void)
+static void OpenEReaderLink(void)
{
memset(gDecompressionBuffer, 0, 0x2000);
- gLinkType = LINKTYPE_0x5503;
+ gLinkType = LINKTYPE_EREADER;
OpenLink();
SetSuppressLinkErrorMessage(TRUE);
}
@@ -255,7 +255,7 @@ static void sub_81D5084(u8 taskId)
data->unk8 = 1;
break;
case 1:
- sub_81D4E30();
+ OpenEReaderLink();
sub_81D505C(&data->unk0);
data->unk8 = 2;
break;
@@ -285,7 +285,7 @@ static void sub_81D5084(u8 taskId)
case 5:
if (sub_81D5064(&data->unk0, 90))
{
- sub_81D4E30();
+ OpenEReaderLink();
data->unk8 = 6;
}
else if (gMain.newKeys & B_BUTTON)
@@ -319,7 +319,7 @@ static void sub_81D5084(u8 taskId)
else if (sub_81D5064(&data->unk0, 10))
{
CloseLink();
- sub_81D4E30();
+ OpenEReaderLink();
sub_81D505C(&data->unk0);
}
break;
@@ -360,7 +360,7 @@ static void sub_81D5084(u8 taskId)
data->unk8 = 12;
break;
case 12:
- sub_81D4E30();
+ OpenEReaderLink();
AddTextPrinterToWindow1(gJPText_AllowEReaderToLoadCard);
data->unk8 = 13;
break;
diff --git a/src/event_object_lock.c b/src/event_object_lock.c
index b728f7774..67652a99b 100644
--- a/src/event_object_lock.c
+++ b/src/event_object_lock.c
@@ -96,7 +96,7 @@ void ScriptUnfreezeObjectEvents(void)
UnfreezeObjectEvents();
}
-void sub_8098524(void)
+void UnionRoom_UnlockPlayerAndChatPartner(void)
{
u8 playerObjectId;
diff --git a/src/event_object_movement.c b/src/event_object_movement.c
index d6a2fe2ec..ad839e006 100644
--- a/src/event_object_movement.c
+++ b/src/event_object_movement.c
@@ -28,6 +28,7 @@
#include "constants/items.h"
#include "constants/mauville_old_man.h"
#include "constants/trainer_types.h"
+#include "constants/union_room.h"
// this file was known as evobjmv.c in Game Freak's original source
@@ -97,7 +98,7 @@ static void DoRippleFieldEffect(struct ObjectEvent*, struct Sprite*);
static void DoGroundEffects_OnSpawn(struct ObjectEvent*, struct Sprite*);
static void DoGroundEffects_OnBeginStep(struct ObjectEvent*, struct Sprite*);
static void DoGroundEffects_OnFinishStep(struct ObjectEvent*, struct Sprite*);
-static void sub_8097D68(struct Sprite*);
+static void UpdateObjectEventSpritePosition(struct Sprite*);
static void ApplyLevitateMovement(u8);
static bool8 MovementType_Disguise_Callback(struct ObjectEvent *, struct Sprite *);
static bool8 MovementType_Hidden_Callback(struct ObjectEvent *, struct Sprite *);
@@ -129,7 +130,7 @@ static struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8 localId,
static void ClearObjectEventMovement(struct ObjectEvent *, struct Sprite *);
static void ObjectEventSetSingleMovement(struct ObjectEvent *, struct Sprite *, u8);
static void oamt_npc_ministep_reset(struct Sprite *, u8, u8);
-static void UpdateObjectEventSpriteSubpriorityAndVisibility(struct Sprite *);
+static void UpdateObjectEventSprite(struct Sprite *);
const u8 gReflectionEffectPaletteMap[] = {1, 1, 6, 7, 8, 9, 6, 7, 8, 9, 11, 11, 0, 0, 0, 0};
@@ -1522,7 +1523,9 @@ u8 AddPseudoObjectEvent(u16 graphicsId, void (*callback)(struct Sprite *), s16 x
return spriteId;
}
-u8 sprite_new(u8 graphicsId, u8 a1, s16 x, s16 y, u8 z, u8 direction)
+// Used to create sprite object events instead of a full object event
+// Used when resources are limiting, e.g. for the audience in contests or group members in Union Room
+u8 CreateObjectSprite(u8 graphicsId, u8 a1, s16 x, s16 y, u8 z, u8 direction)
{
u8 spriteId;
struct Sprite *sprite;
@@ -1531,11 +1534,11 @@ u8 sprite_new(u8 graphicsId, u8 a1, s16 x, s16 y, u8 z, u8 direction)
const struct ObjectEventGraphicsInfo *graphicsInfo;
graphicsInfo = GetObjectEventGraphicsInfo(graphicsId);
- MakeObjectTemplateFromObjectEventGraphicsInfo(graphicsId, UpdateObjectEventSpriteSubpriorityAndVisibility, &spriteTemplate, &subspriteTables);
+ MakeObjectTemplateFromObjectEventGraphicsInfo(graphicsId, UpdateObjectEventSprite, &spriteTemplate, &subspriteTables);
*(u16 *)&spriteTemplate.paletteTag = 0xFFFF;
x += 7;
y += 7;
- sub_80930E0(&x, &y, 8, 16);
+ SetSpritePosToOffsetMapCoords(&x, &y, 8, 16);
spriteId = CreateSpriteAtEnd(&spriteTemplate, x, y, 0);
if (spriteId != MAX_SPRITES)
{
@@ -2363,7 +2366,8 @@ static u8 GetObjectTrainerTypeByObjectEventId(u8 objectEventId)
return gObjectEvents[objectEventId].trainerType;
}
-u8 sub_808F0D4(u8 localId, u8 mapNum, u8 mapGroup)
+// Unused
+u8 GetObjectEventBerryTreeIdByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup)
{
u8 objectEventId;
@@ -2374,7 +2378,7 @@ u8 sub_808F0D4(u8 localId, u8 mapNum, u8 mapGroup)
return gObjectEvents[objectEventId].trainerRange_berryTreeId;
}
-u8 ObjectEventGetBerryTreeId(u8 objectEventId)
+u8 GetObjectEventBerryTreeId(u8 objectEventId)
{
return gObjectEvents[objectEventId].trainerRange_berryTreeId;
}
@@ -4864,22 +4868,22 @@ void SetSpritePosToMapCoords(s16 mapX, s16 mapY, s16 *destX, s16 *destY)
s16 dx = -gTotalCameraPixelOffsetX - gFieldCamera.x;
s16 dy = -gTotalCameraPixelOffsetY - gFieldCamera.y;
if (gFieldCamera.x > 0)
- dx += 1 << 4;
+ dx += 16;
if (gFieldCamera.x < 0)
- dx -= 1 << 4;
+ dx -= 16;
if (gFieldCamera.y > 0)
- dy += 1 << 4;
+ dy += 16;
if (gFieldCamera.y < 0)
- dy -= 1 << 4;
+ dy -= 16;
*destX = ((mapX - gSaveBlock1Ptr->pos.x) << 4) + dx;
*destY = ((mapY - gSaveBlock1Ptr->pos.y) << 4) + dy;
}
-void sub_80930E0(s16 *x, s16 *y, s16 dx, s16 dy)
+void SetSpritePosToOffsetMapCoords(s16 *x, s16 *y, s16 dx, s16 dy)
{
SetSpritePosToMapCoords(*x, *y, x, y);
*x += dx;
@@ -8630,51 +8634,56 @@ void UpdateObjectEventSpriteVisibility(struct Sprite *sprite, bool8 invisible)
sprite->invisible = TRUE;
}
-static void UpdateObjectEventSpriteSubpriorityAndVisibility(struct Sprite *sprite)
+#define tInvisible data[2]
+#define tAnimNum data[3]
+#define tAnimState data[4]
+
+static void UpdateObjectEventSprite(struct Sprite *sprite)
{
- sub_8097D68(sprite);
+ UpdateObjectEventSpritePosition(sprite);
SetObjectSubpriorityByZCoord(sprite->data[1], sprite, 1);
- UpdateObjectEventSpriteVisibility(sprite, sprite->data[2]);
+ UpdateObjectEventSpriteVisibility(sprite, sprite->tInvisible);
}
-void sub_8097AF0(void)
+// Unused
+static void DestroyObjectEventSprites(void)
{
int i;
- for(i = 0; i < MAX_SPRITES; i++)
+ for (i = 0; i < MAX_SPRITES; i++)
{
struct Sprite *sprite = &gSprites[i];
- if(sprite->inUse && sprite->callback == UpdateObjectEventSpriteSubpriorityAndVisibility)
+ if(sprite->inUse && sprite->callback == UpdateObjectEventSprite)
DestroySprite(sprite);
}
}
-int sub_8097B2C(u8 var) // this should return a u8, because all that call this shifts to u8, but it wont match because it doesnt shift u8 at the end.
+static int GetObjectEventSpriteId(u8 var) // this should return a u8, because all that call this shifts to u8, but it wont match because it doesnt shift u8 at the end.
{
int i;
- for(i = 0; i < MAX_SPRITES; i++)
+ for (i = 0; i < MAX_SPRITES; i++)
{
struct Sprite *sprite = &gSprites[i];
- if(sprite->inUse && sprite->callback == UpdateObjectEventSpriteSubpriorityAndVisibility && (u8)sprite->data[0] == var)
+ if(sprite->inUse && sprite->callback == UpdateObjectEventSprite && (u8)sprite->data[0] == var)
return i;
}
return MAX_SPRITES;
}
-void sub_8097B78(u8 var1, u8 var2)
+void TurnObjectEventSprite(u8 objectEventId, u8 direction)
{
- u8 spriteId = sub_8097B2C(var1);
+ u8 spriteId = GetObjectEventSpriteId(objectEventId);
- if(spriteId != MAX_SPRITES)
- StartSpriteAnim(&gSprites[spriteId], GetFaceDirectionAnimNum(var2));
+ if (spriteId != MAX_SPRITES)
+ StartSpriteAnim(&gSprites[spriteId], GetFaceDirectionAnimNum(direction));
}
-void sub_8097BB4(u8 var1, u8 graphicsId)
+void SetObjectEventSpriteGraphics(u8 objectEventId, u8 graphicsId)
{
- int spriteId = sub_8097B2C(var1);
+ int spriteId = GetObjectEventSpriteId(objectEventId);
- if(spriteId != MAX_SPRITES)
+ if (spriteId != MAX_SPRITES)
{
struct Sprite *sprite = &gSprites[spriteId];
const struct ObjectEventGraphicsInfo *graphicsInfo = GetObjectEventGraphicsInfo(graphicsId);
@@ -8685,7 +8694,7 @@ void sub_8097BB4(u8 var1, u8 graphicsId)
sprite->oam.paletteNum = graphicsInfo->paletteSlot;
sprite->images = graphicsInfo->images;
- if(graphicsInfo->subspriteTables == NULL)
+ if (graphicsInfo->subspriteTables == NULL)
{
sprite->subspriteTables = NULL;
sprite->subspriteTableNum = 0;
@@ -8700,102 +8709,102 @@ void sub_8097BB4(u8 var1, u8 graphicsId)
}
}
-void sub_8097C44(u8 var, bool32 var2)
+void SetObjectEventSpriteInvisibility(u8 objectEventId, bool32 invisible)
{
- u8 spriteId = sub_8097B2C(var);
+ u8 spriteId = GetObjectEventSpriteId(objectEventId);
- if(spriteId == MAX_SPRITES)
+ if (spriteId == MAX_SPRITES)
return;
- if(var2)
- gSprites[spriteId].data[2] = 1;
+ if (invisible)
+ gSprites[spriteId].tInvisible = TRUE;
else
- gSprites[spriteId].data[2] = 0;
+ gSprites[spriteId].tInvisible = FALSE;
}
-bool32 sub_8097C8C(u8 var)
+bool32 IsObjectEventSpriteInvisible(u8 objectEventId)
{
- u8 spriteId = sub_8097B2C(var);
+ u8 spriteId = GetObjectEventSpriteId(objectEventId);
- if(spriteId == MAX_SPRITES)
+ if (spriteId == MAX_SPRITES)
return FALSE;
- return (gSprites[spriteId].data[2] == TRUE);
+ return (gSprites[spriteId].tInvisible == TRUE);
}
-void sub_8097CC4(u8 var1, u8 var2)
+void SetObjectEventSpriteAnim(u8 objectEventId, u8 animNum)
{
- u8 spriteId = sub_8097B2C(var1);
+ u8 spriteId = GetObjectEventSpriteId(objectEventId);
- if(spriteId != MAX_SPRITES)
+ if (spriteId != MAX_SPRITES)
{
- gSprites[spriteId].data[3] = var2;
- gSprites[spriteId].data[4] = 0;
+ gSprites[spriteId].tAnimNum = animNum;
+ gSprites[spriteId].tAnimState = 0;
}
}
-void sub_8097CF4(struct Sprite *sprite)
+static void MoveUnionRoomObjectUp(struct Sprite *sprite)
{
- switch(sprite->data[4])
+ switch(sprite->tAnimState)
{
case 0:
sprite->pos2.y = 0;
- sprite->data[4]++;
+ sprite->tAnimState++;
case 1:
sprite->pos2.y -= 8;
- if(sprite->pos2.y == -160)
+ if (sprite->pos2.y == -160)
{
sprite->pos2.y = 0;
- sprite->data[2] = 1;
- sprite->data[3] = 0;
- sprite->data[4] = 0;
+ sprite->tInvisible = TRUE;
+ sprite->tAnimNum = 0;
+ sprite->tAnimState = 0;
}
}
}
-void sub_8097D30(struct Sprite *sprite)
+static void MoveUnionRoomObjectDown(struct Sprite *sprite)
{
- switch(sprite->data[4])
+ switch(sprite->tAnimState)
{
case 0:
sprite->pos2.y = -160;
- sprite->data[4]++;
+ sprite->tAnimState++;
case 1:
sprite->pos2.y += 8;
if(sprite->pos2.y == 0)
{
- sprite->data[3] = 0;
- sprite->data[4] = 0;
+ sprite->tAnimNum = 0;
+ sprite->tAnimState = 0;
}
}
}
-static void sub_8097D68(struct Sprite *sprite)
+static void UpdateObjectEventSpritePosition(struct Sprite *sprite)
{
- switch(sprite->data[3])
+ switch(sprite->tAnimNum)
{
- case 1:
- sub_8097D30(sprite);
+ case UNION_ROOM_SPAWN_IN:
+ MoveUnionRoomObjectDown(sprite);
break;
- case 2:
- sub_8097CF4(sprite);
+ case UNION_ROOM_SPAWN_OUT:
+ MoveUnionRoomObjectUp(sprite);
break;
case 0:
break;
default:
- sprite->data[3] = 0;
+ sprite->tAnimNum = 0;
break;
}
}
-bool32 sub_8097D9C(u8 var)
+bool32 IsObjectEventSpriteAnimating(u8 var)
{
- u8 spriteId = sub_8097B2C(var);
+ u8 spriteId = GetObjectEventSpriteId(var);
- if(spriteId == MAX_SPRITES)
+ if (spriteId == MAX_SPRITES)
return FALSE;
- if(gSprites[spriteId].data[3] != FALSE)
+ if (gSprites[spriteId].tAnimNum != 0)
return TRUE;
return FALSE;
diff --git a/src/faraway_island.c b/src/faraway_island.c
index f8e3eac14..06e47cd21 100755
--- a/src/faraway_island.c
+++ b/src/faraway_island.c
@@ -6,10 +6,8 @@
#include "metatile_behavior.h"
#include "sprite.h"
#include "constants/event_objects.h"
-#include "constants/flags.h"
#include "constants/maps.h"
#include "constants/metatile_behaviors.h"
-#include "constants/vars.h"
static u8 sub_81D4890(u8);
static bool8 sub_81D4C14(struct ObjectEvent*, u8);
@@ -378,7 +376,7 @@ void sub_81D4A90(void)
x = mew->currentCoords.x;
y = mew->currentCoords.y;
- sub_80930E0(&x, &y, 8, 8);
+ SetSpritePosToOffsetMapCoords(&x, &y, 8, 8);
sUnknown_0203CF50 = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[15], x, y, gSprites[mew->spriteId].subpriority - 1);
if (sUnknown_0203CF50 != MAX_SPRITES)
{
diff --git a/src/field_door.c b/src/field_door.c
index b4794349c..e81c3dc4b 100644
--- a/src/field_door.c
+++ b/src/field_door.c
@@ -5,7 +5,6 @@
#include "fieldmap.h"
#include "metatile_behavior.h"
#include "task.h"
-#include "constants/flags.h"
#include "constants/maps.h"
#include "constants/songs.h"
#include "constants/metatile_labels.h"
diff --git a/src/field_effect.c b/src/field_effect.c
index c4e9fc40a..07579f55d 100644
--- a/src/field_effect.c
+++ b/src/field_effect.c
@@ -2043,7 +2043,7 @@ static bool8 LavaridgeGymB1FWarpExitEffect_4(struct Task *task, struct ObjectEve
u8 FldEff_LavaridgeGymWarp(void)
{
u8 spriteId;
- sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
+ SetSpritePosToOffsetMapCoords((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[33], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]);
gSprites[spriteId].oam.priority = gFieldEffectArguments[3];
gSprites[spriteId].coordOffsetEnabled = 1;
@@ -2136,7 +2136,7 @@ static bool8 LavaridgeGym1FWarpEffect_5(struct Task *task, struct ObjectEvent *o
u8 FldEff_PopOutOfAsh(void)
{
u8 spriteId;
- sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
+ SetSpritePosToOffsetMapCoords((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[32], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]);
gSprites[spriteId].oam.priority = gFieldEffectArguments[3];
gSprites[spriteId].coordOffsetEnabled = 1;
diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c
index 52c30ab0f..e02de959b 100755
--- a/src/field_effect_helpers.c
+++ b/src/field_effect_helpers.c
@@ -274,7 +274,7 @@ u32 FldEff_TallGrass(void)
x = gFieldEffectArguments[0];
y = gFieldEffectArguments[1];
- sub_80930E0(&x, &y, 8, 8);
+ SetSpritePosToOffsetMapCoords(&x, &y, 8, 8);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[4], x, y, 0);
if (spriteId != MAX_SPRITES)
{
@@ -340,7 +340,7 @@ u32 FldEff_JumpTallGrass(void)
u8 spriteId;
struct Sprite *sprite;
- sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 12);
+ SetSpritePosToOffsetMapCoords((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 12);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[10], gFieldEffectArguments[0], gFieldEffectArguments[1], 0);
if (spriteId != MAX_SPRITES)
{
@@ -380,7 +380,7 @@ u32 FldEff_LongGrass(void)
x = gFieldEffectArguments[0];
y = gFieldEffectArguments[1];
- sub_80930E0(&x, &y, 8, 8);
+ SetSpritePosToOffsetMapCoords(&x, &y, 8, 8);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[15], x, y, 0);
if (spriteId != MAX_SPRITES)
{
@@ -443,7 +443,7 @@ u32 FldEff_JumpLongGrass(void)
u8 spriteId;
struct Sprite *sprite;
- sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
+ SetSpritePosToOffsetMapCoords((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[16], gFieldEffectArguments[0], gFieldEffectArguments[1], 0);
if (spriteId != MAX_SPRITES)
{
@@ -521,7 +521,7 @@ u32 FldEff_SandFootprints(void)
u8 spriteId;
struct Sprite *sprite;
- sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
+ SetSpritePosToOffsetMapCoords((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[11], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]);
if (spriteId != MAX_SPRITES)
{
@@ -539,7 +539,7 @@ u32 FldEff_DeepSandFootprints(void)
u8 spriteId;
struct Sprite *sprite;
- sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
+ SetSpritePosToOffsetMapCoords((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[23], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]);
if (spriteId != MAX_SPRITES)
{
@@ -557,7 +557,7 @@ u32 FldEff_BikeTireTracks(void)
u8 spriteId;
struct Sprite *sprite;
- sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
+ SetSpritePosToOffsetMapCoords((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[27], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]);
if (spriteId != MAX_SPRITES)
{
@@ -649,7 +649,7 @@ u32 FldEff_JumpSmallSplash(void)
u8 spriteId;
struct Sprite *sprite;
- sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 12);
+ SetSpritePosToOffsetMapCoords((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 12);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[14], gFieldEffectArguments[0], gFieldEffectArguments[1], 0);
if (spriteId != MAX_SPRITES)
{
@@ -667,7 +667,7 @@ u32 FldEff_JumpBigSplash(void)
u8 spriteId;
struct Sprite *sprite;
- sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
+ SetSpritePosToOffsetMapCoords((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[12], gFieldEffectArguments[0], gFieldEffectArguments[1], 0);
if (spriteId != MAX_SPRITES)
{
@@ -805,7 +805,7 @@ u32 FldEff_Unknown19(void)
u8 spriteId;
struct Sprite *sprite;
- sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
+ SetSpritePosToOffsetMapCoords((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[17], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]);
if (spriteId != MAX_SPRITES)
{
@@ -822,7 +822,7 @@ u32 FldEff_Unknown20(void)
u8 spriteId;
struct Sprite *sprite;
- sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
+ SetSpritePosToOffsetMapCoords((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[18], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]);
if (spriteId != MAX_SPRITES)
{
@@ -839,7 +839,7 @@ u32 FldEff_Unknown21(void)
u8 spriteId;
struct Sprite *sprite;
- sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
+ SetSpritePosToOffsetMapCoords((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[19], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]);
if (spriteId != MAX_SPRITES)
{
@@ -856,7 +856,7 @@ u32 FldEff_Unknown22(void)
u8 spriteId;
struct Sprite *sprite;
- sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
+ SetSpritePosToOffsetMapCoords((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[20], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]);
if (spriteId != MAX_SPRITES)
{
@@ -888,7 +888,7 @@ u32 FldEff_Ash(void)
x = gFieldEffectArguments[0];
y = gFieldEffectArguments[1];
- sub_80930E0(&x, &y, 8, 8);
+ SetSpritePosToOffsetMapCoords(&x, &y, 8, 8);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[6], x, y, gFieldEffectArguments[2]);
if (spriteId != MAX_SPRITES)
{
@@ -944,7 +944,7 @@ u32 FldEff_SurfBlob(void)
u8 spriteId;
struct Sprite *sprite;
- sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
+ SetSpritePosToOffsetMapCoords((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[7], gFieldEffectArguments[0], gFieldEffectArguments[1], 0x96);
if (spriteId !=MAX_SPRITES)
{
@@ -1106,7 +1106,7 @@ u32 FldEff_Dust(void)
u8 spriteId;
struct Sprite *sprite;
- sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 12);
+ SetSpritePosToOffsetMapCoords((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 12);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[9], gFieldEffectArguments[0], gFieldEffectArguments[1], 0);
if (spriteId != MAX_SPRITES)
{
@@ -1182,7 +1182,7 @@ u32 FldEff_Bubbles(void)
u8 spriteId;
struct Sprite *sprite;
- sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 0);
+ SetSpritePosToOffsetMapCoords((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 0);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[34], gFieldEffectArguments[0], gFieldEffectArguments[1], 0x52);
if (spriteId != MAX_SPRITES)
{
@@ -1210,7 +1210,7 @@ u32 FldEff_BerryTreeGrowthSparkle(void)
u8 spriteId;
struct Sprite *sprite;
- sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 4);
+ SetSpritePosToOffsetMapCoords((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 4);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[22], gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2]);
if (spriteId != MAX_SPRITES)
{
@@ -1330,7 +1330,7 @@ u32 FldEff_Sparkle(void)
gFieldEffectArguments[0] += 7;
gFieldEffectArguments[1] += 7;
- sub_80930E0((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
+ SetSpritePosToOffsetMapCoords((s16 *)&gFieldEffectArguments[0], (s16 *)&gFieldEffectArguments[1], 8, 8);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[35], gFieldEffectArguments[0], gFieldEffectArguments[1], 0x52);
if (spriteId != MAX_SPRITES)
{
diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c
index b0918a78d..f5f6e99f7 100644
--- a/src/field_player_avatar.c
+++ b/src/field_player_avatar.c
@@ -25,7 +25,6 @@
#include "constants/event_objects.h"
#include "constants/event_object_movement.h"
#include "constants/field_effects.h"
-#include "constants/flags.h"
#include "constants/maps.h"
#include "constants/moves.h"
#include "constants/songs.h"
diff --git a/src/field_screen_effect.c b/src/field_screen_effect.c
index 51f719fc9..53057fc31 100644
--- a/src/field_screen_effect.c
+++ b/src/field_screen_effect.c
@@ -162,7 +162,7 @@ static void Task_ReturnToFieldCableLink(u8 taskId)
switch (task->data[0])
{
case 0:
- task->data[1] = sub_80B3050();
+ task->data[1] = CreateTask_ReestablishCableClubLink();
task->data[0]++;
break;
case 1:
@@ -204,7 +204,7 @@ static void Task_ReturnToFieldWirelessLink(u8 taskId)
if (!IsLinkTaskFinished())
{
if (++task->data[1] > 1800)
- sub_8011170(0x6000);
+ GetLinkmanErrorParams(0x6000);
}
else
{
@@ -215,7 +215,7 @@ static void Task_ReturnToFieldWirelessLink(u8 taskId)
case 2:
if (WaitForWeatherFadeIn() == TRUE)
{
- sub_8009F18();
+ StartSendingKeysToLink();
ScriptContext2_Disable();
DestroyTask(taskId);
}
@@ -240,7 +240,7 @@ void Task_ReturnToFieldRecordMixing(u8 taskId)
}
break;
case 2:
- sub_8009F18();
+ StartSendingKeysToLink();
ResetAllMultiplayerState();
ScriptContext2_Disable();
DestroyTask(taskId);
diff --git a/src/field_special_scene.c b/src/field_special_scene.c
index 540bcd1d4..3a3367957 100644
--- a/src/field_special_scene.c
+++ b/src/field_special_scene.c
@@ -17,7 +17,6 @@
#include "constants/event_object_movement.h"
#include "constants/field_specials.h"
#include "constants/songs.h"
-#include "constants/vars.h"
#include "constants/metatile_labels.h"
#define SECONDS(value) ((signed) (60.0 * value + 0.5))
diff --git a/src/field_specials.c b/src/field_specials.c
index 818cd70db..86b929491 100644
--- a/src/field_specials.c
+++ b/src/field_specials.c
@@ -63,7 +63,6 @@
#include "constants/species.h"
#include "constants/moves.h"
#include "constants/party_menu.h"
-#include "constants/vars.h"
#include "constants/battle_frontier.h"
#include "constants/weather.h"
#include "constants/metatile_labels.h"
@@ -2855,7 +2854,7 @@ void SetBattleTowerLinkPlayerGfx(void)
void ShowNatureGirlMessage(void)
{
- static const u8 *const sNatureGirlMessages[] = {
+ static const u8 *const sNatureGirlMessages[NUM_NATURES] = {
[NATURE_HARDY] = BattleFrontier_Lounge5_Text_NatureGirlHardy,
[NATURE_LONELY] = BattleFrontier_Lounge5_Text_NatureGirlLonely,
[NATURE_BRAVE] = BattleFrontier_Lounge5_Text_NatureGirlBrave,
@@ -3688,7 +3687,7 @@ void Unused_SetWeatherSunny(void)
SetCurrentAndNextWeather(WEATHER_SUNNY);
}
-// Always returns 1
+// All mart employees have a local id of 1, so function always returns 1
u32 GetMartEmployeeObjectEventId(void)
{
static const u8 sPokeMarts[][3] =
@@ -4095,11 +4094,17 @@ void UpdateTrainerFanClubGameClear(void)
}
// If the player has < 3 fans, gain a new fan whenever the counter reaches 20+
-// Defeating Drake or participating in a Link Contest increments the counter by 2
+// Defeating Drake or participating in a Contest increments the counter by 2
// Participating at Battle Tower or in a Secret Base battle increments the counter by 1
u8 TryGainNewFanFromCounter(u8 incrementId)
{
- static const u8 sCounterIncrements[] = { 2, 1, 2, 1 };
+ static const u8 sCounterIncrements[] =
+ {
+ [FANCOUNTER_DEFEATED_DRAKE] = 2,
+ [FANCOUNTER_BATTLED_AT_BASE] = 1,
+ [FANCOUNTER_FINISHED_CONTEST] = 2,
+ [FANCOUNTER_USED_BATTLE_TOWER] = 1
+ };
if (VarGet(VAR_LILYCOVE_FAN_CLUB_STATE) == 2)
{
diff --git a/src/field_tasks.c b/src/field_tasks.c
index 21b2732c3..901535677 100644
--- a/src/field_tasks.c
+++ b/src/field_tasks.c
@@ -19,7 +19,6 @@
#include "constants/field_tasks.h"
#include "constants/items.h"
#include "constants/songs.h"
-#include "constants/vars.h"
#include "constants/metatile_labels.h"
struct PacifidlogMetatileOffsets
diff --git a/src/fieldmap.c b/src/fieldmap.c
index e953e0f93..cfc7018bd 100644
--- a/src/fieldmap.c
+++ b/src/fieldmap.c
@@ -533,9 +533,16 @@ static bool32 SavedMapViewIsEmpty(void)
u16 i;
u32 marker = 0;
+#ifndef UBFIX
// BUG: This loop extends past the bounds of the mapView array. Its size is only 0x100.
for (i = 0; i < 0x200; i++)
marker |= gSaveBlock1Ptr->mapView[i];
+#else
+ // UBFIX: Only iterate over 0x100
+ for (i = 0; i < ARRAY_COUNT(gSaveBlock1Ptr->mapView); i++)
+ marker |= gSaveBlock1Ptr->mapView[i];
+#endif
+
if (marker == 0)
return TRUE;
@@ -917,11 +924,11 @@ void GetCameraCoords(u16 *x, u16 *y)
*y = gSaveBlock1Ptr->pos.y;
}
-void sub_8088B94(int x, int y, int a2)
+void MapGridSetMetatileImpassabilityAt(int x, int y, bool32 impassable)
{
if (x >= 0 && x < gBackupMapLayout.width && y >= 0 && y < gBackupMapLayout.height)
{
- if (a2 != 0)
+ if (impassable)
gBackupMapLayout.map[x + gBackupMapLayout.width * y] |= METATILE_COLLISION_MASK;
else
gBackupMapLayout.map[x + gBackupMapLayout.width * y] &= ~METATILE_COLLISION_MASK;
diff --git a/src/fldeff_misc.c b/src/fldeff_misc.c
index 9574ac563..410af9fdd 100644
--- a/src/fldeff_misc.c
+++ b/src/fldeff_misc.c
@@ -23,7 +23,6 @@
#include "constants/metatile_labels.h"
#include "constants/songs.h"
#include "constants/tv.h"
-#include "constants/vars.h"
EWRAM_DATA struct MapPosition gPlayerFacingPosition = {0};
@@ -1008,7 +1007,7 @@ void DoSecretBaseGlitterMatSparkle(void)
s16 y = gObjectEvents[gPlayerAvatar.objectEventId].currentCoords.y;
u8 spriteId;
- sub_80930E0(&x, &y, 8, 4);
+ SetSpritePosToOffsetMapCoords(&x, &y, 8, 4);
spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[22], x, y, 0);
if (spriteId != MAX_SPRITES)
diff --git a/src/graphics.c b/src/graphics.c
index 7a3a225c2..b774c5ad2 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -471,13 +471,11 @@ const u8 gTiles_8C19450[] = INCBIN_U8("graphics/contest/heart.4bpp");
const u32 gUnknownGfx_C19470[] = INCBIN_U32("graphics/unknown/unknown_C19470.4bpp.lz");
const u32 gUnknownPal_C19470[] = INCBIN_U32("graphics/unknown/unknown_C19470.gbapal.lz");
-const u32 gUnknown_08C19588[] = INCBIN_U32("graphics/contest/misc_2.4bpp.lz");
-
+const u32 gContestResults_Gfx[] = INCBIN_U32("graphics/contest/results_screen.4bpp.lz");
const u32 gUnknown_08C19EEC[] = INCBIN_U32("graphics/contest/misc_2_tilemap_1.bin.lz");
const u32 gUnknown_08C1A000[] = INCBIN_U32("graphics/contest/misc_2_tilemap_2.bin.lz");
const u32 gUnknown_08C1A12C[] = INCBIN_U32("graphics/contest/misc_2_tilemap_3.bin.lz");
-
-const u32 gUnknown_08C1A2B4[] = INCBIN_U32("graphics/contest/misc_2.gbapal.lz");
+const u32 gContestResults_Pal[] = INCBIN_U32("graphics/contest/results_screen.gbapal.lz");
const u32 gBattleAnimSpriteGfx_Impact[] = INCBIN_U32("graphics/battle_anims/sprites/impact.4bpp.lz");
const u32 gBattleAnimSpritePal_Impact[] = INCBIN_U32("graphics/battle_anims/sprites/impact.gbapal.lz");
@@ -875,8 +873,8 @@ const u32 gSubstituteDollTilemap[] = INCBIN_U32("graphics/battle_anims/sprites/s
const u32 gBattleAnimSpriteGfx_GreenStar[] = INCBIN_U32("graphics/battle_anims/sprites/green_star.4bpp.lz");
const u32 gBattleAnimSpritePal_GreenStar[] = INCBIN_U32("graphics/battle_anims/sprites/green_star.gbapal.lz");
-const u32 gContestConfetti_Gfx[] = INCBIN_U32("graphics/misc/confetti.4bpp.lz");
-const u32 gContestConfetti_Pal[] = INCBIN_U32("graphics/misc/confetti.gbapal.lz");
+const u32 gConfetti_Gfx[] = INCBIN_U32("graphics/misc/confetti.4bpp.lz");
+const u32 gConfetti_Pal[] = INCBIN_U32("graphics/misc/confetti.gbapal.lz");
const u32 gBattleAnimSpriteGfx_PinkCloud[] = INCBIN_U32("graphics/battle_anims/sprites/pink_cloud.4bpp.lz");
const u32 gBattleAnimSpritePal_PinkCloud[] = INCBIN_U32("graphics/battle_anims/sprites/pink_cloud.gbapal.lz");
@@ -1298,19 +1296,19 @@ const u8 gFireRedMenuElements_Gfx[] = INCBIN_U8("graphics/interface_fr/menu.4bpp
const u8 gBagMenuHMIcon_Gfx[] = INCBIN_U8("graphics/interface/hm.4bpp");
-// contest link stuff, appears to be a set of tilemaps
+// contest results screen
-const u16 gUnknown_08DC63F8[] = INCBIN_U16("graphics/contest/clink_tilemap1.bin");
-const u16 gUnknown_08DC6420[] = INCBIN_U16("graphics/contest/clink_tilemap2.bin");
-const u16 gUnknown_08DC6448[] = INCBIN_U16("graphics/contest/clink_tilemap3.bin");
-const u16 gUnknown_08DC6470[] = INCBIN_U16("graphics/contest/clink_tilemap4.bin");
-const u16 gUnknown_08DC6498[] = INCBIN_U16("graphics/contest/clink_tilemap5.bin");
-const u16 gUnknown_08DC64AC[] = INCBIN_U16("graphics/contest/clink_tilemap6.bin");
-const u16 gUnknown_08DC64C0[] = INCBIN_U16("graphics/contest/clink_tilemap7.bin");
-const u16 gUnknown_08DC64D4[] = INCBIN_U16("graphics/contest/clink_tilemap8.bin");
-const u16 gUnknown_08DC64E8[] = INCBIN_U16("graphics/contest/clink_tilemap9.bin");
-const u16 gUnknown_08DC64FC[] = INCBIN_U16("graphics/contest/clink_tilemap10.bin");
-const u16 gUnknown_08DC6510[] = INCBIN_U16("graphics/contest/clink_tilemap11.bin");
+const u16 gNormalContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_normal.bin");
+const u16 gSuperContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_super.bin");
+const u16 gHyperContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_hyper.bin");
+const u16 gMasterContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_master.bin");
+const u16 gLinkContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_link.bin");
+const u16 gCoolContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_cool.bin");
+const u16 gBeautyContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_beauty.bin");
+const u16 gCuteContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_cute.bin");
+const u16 gSmartContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_smart.bin");
+const u16 gToughContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_tough.bin");
+const u16 gContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen.bin");
// pokenav
@@ -1447,19 +1445,15 @@ const u32 gUnknown_08DD4620[] = INCBIN_U32("graphics/unknown/unknown_DD4620.bin.
const u32 gUnknown_08DD46E0[] = INCBIN_U32("graphics/unknown/unknown_DD46E0.bin.lz");
const u32 gUnknown_08DD47A0[] = INCBIN_U32("graphics/unknown/unknown_DD47A0.bin.lz");
-// link
-
-const u16 gLinkMiscMenu_Pal[] = INCBIN_U16("graphics/link/misc.gbapal");
-const u32 gLinkMiscMenu_Gfx[] = INCBIN_U32("graphics/link/misc.4bpp.lz");
-const u32 gLinkMiscMenu_Tilemap[] = INCBIN_U32("graphics/link/misc.bin.lz");
-
-const u16 gUnknown_08DD4BB0[] = INCBIN_U16("graphics/link/link1.gbapal");
-const u16 gUnknown_08DD4BD0[] = INCBIN_U16("graphics/link/link2.gbapal");
-
-const u32 gUnknown_08DD4BF0[] = INCBIN_U32("graphics/link/link_winedge.4bpp.lz");
-const u32 gUnknown_08DD4C4C[] = INCBIN_U32("graphics/link/link_winedge.bin.lz");
-
-const u32 gUnknown_08DD4CF8[] = INCBIN_U32("graphics/interface/unk_change_case.4bpp.lz");
+// union room chat
+const u16 gUnionRoomChat_Background_Pal[] = INCBIN_U16("graphics/union_room_chat/background.gbapal");
+const u32 gUnionRoomChat_Background_Gfx[] = INCBIN_U32("graphics/union_room_chat/background.4bpp.lz");
+const u32 gUnionRoomChat_Background_Tilemap[] = INCBIN_U32("graphics/union_room_chat/background.bin.lz");
+const u16 gUnionRoomChat_Window_Pal1[] = INCBIN_U16("graphics/union_room_chat/window_1.gbapal");
+const u16 gUnionRoomChat_Window_Pal2[] = INCBIN_U16("graphics/union_room_chat/window_2.gbapal");
+const u32 gUnionRoomChat_Border_Gfx[] = INCBIN_U32("graphics/union_room_chat/border.4bpp.lz");
+const u32 gUnionRoomChat_Border_Tilemap[] = INCBIN_U32("graphics/union_room_chat/border.bin.lz");
+const u32 gUnionRoomChat_RButtonLabels[] = INCBIN_U32("graphics/union_room_chat/r_button_labels.4bpp.lz");
const u16 gTilesetPalettes_General[][16] =
{
diff --git a/src/gym_leader_rematch.c b/src/gym_leader_rematch.c
index 355ae5534..efe874894 100644
--- a/src/gym_leader_rematch.c
+++ b/src/gym_leader_rematch.c
@@ -1,5 +1,4 @@
#include "global.h"
-#include "constants/flags.h"
#include "random.h"
#include "event_data.h"
#include "battle_setup.h"
diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c
index 1606c2de5..bf9850dec 100644
--- a/src/hall_of_fame.c
+++ b/src/hall_of_fame.c
@@ -33,9 +33,12 @@
#include "fldeff_misc.h"
#include "trainer_pokemon_sprites.h"
#include "data.h"
-#include "rom_81520A8.h"
+#include "confetti_util.h"
#include "constants/rgb.h"
+#define HALL_OF_FAME_MAX_TEAMS 50
+#define TAG_CONFETTI 1001
+
struct HallofFameMon
{
u32 tid;
@@ -58,33 +61,31 @@ struct HofGfx
u8 tilemap2[0x1000];
};
-static EWRAM_DATA u32 sUnknown_0203BCD4 = 0;
+static EWRAM_DATA u32 sHofFadePalettes = 0;
static EWRAM_DATA struct HallofFameTeam *sHofMonPtr = NULL;
static EWRAM_DATA struct HofGfx *sHofGfxPtr = NULL;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
-#define HALL_OF_FAME_MAX_TEAMS 50
-
// this file's functions
static void ClearVramOamPltt_LoadHofPal(void);
-static void sub_8174F70(void);
-static void sub_8174FAC(void);
-static bool8 sub_81751FC(void);
+static void LoadHofGfx(void);
+static void InitHofBgs(void);
+static bool8 CreateHofConfettiSprite(void);
static void SetCallback2AfterHallOfFameDisplay(void);
static bool8 sub_8175024(void);
static void Task_Hof_InitMonData(u8 taskId);
static void Task_Hof_InitTeamSaveData(u8 taskId);
static void Task_Hof_SetMonDisplayTask(u8 taskId);
static void Task_Hof_TrySaveData(u8 taskId);
-static void Task_Hof_WaitForFrames(u8 taskId);
+static void Task_Hof_WaitToDisplayMon(u8 taskId);
static void Task_Hof_DisplayMon(u8 taskId);
static void Task_Hof_PrintMonInfoAfterAnimating(u8 taskId);
static void Task_Hof_TryDisplayAnotherMon(u8 taskId);
static void Task_Hof_PaletteFadeAndPrintWelcomeText(u8 taskId);
-static void sub_8173DC0(u8 taskId);
-static void sub_8173EA4(u8 taskId);
-static void sub_8173EE4(u8 taskId);
+static void Task_Hof_DoConfetti(u8 taskId);
+static void Task_Hof_WaitToDisplayPlayer(u8 taskId);
+static void Task_Hof_DisplayPlayer(u8 taskId);
static void Task_Hof_WaitAndPrintPlayerInfo(u8 taskId);
static void Task_Hof_ExitOnKeyPressed(u8 taskId);
static void Task_Hof_HandlePaletteOnExit(u8 taskId);
@@ -101,8 +102,8 @@ static void SpriteCB_GetOnScreenAndAnimate(struct Sprite *sprite);
static void HallOfFame_PrintMonInfo(struct HallofFameMon* currMon, u8 unused1, u8 unused2);
static void HallOfFame_PrintWelcomeText(u8 unusedPossiblyWindowId, u8 unused2);
static void HallOfFame_PrintPlayerInfo(u8 unused1, u8 unused2);
-static void Task_DoConfettiEffect(u8 taskId);
-static void sub_81751A4(struct Sprite* sprite);
+static void Task_DoDomeConfetti(u8 taskId);
+static void SpriteCB_HofConfetti(struct Sprite* sprite);
// const rom data
static const struct BgTemplate sHof_BgTemplates[] =
@@ -143,15 +144,15 @@ static const u8 sPlayerInfoTextColors[4] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_D
static const u8 sUnused_085E538C[] = {4, 5, 0, 0};
-static const struct CompressedSpriteSheet sHallOfFame_ConfettiSpriteSheet[] =
+static const struct CompressedSpriteSheet sSpriteSheet_Confetti[] =
{
- {gContestConfetti_Gfx, 0x220, 1001},
+ {.data = gConfetti_Gfx, .size = 0x220, .tag = TAG_CONFETTI},
{},
};
-static const struct CompressedSpritePalette sHallOfFame_ConfettiSpritePalette[] =
+static const struct CompressedSpritePalette sSpritePalette_Confetti[] =
{
- {gContestConfetti_Pal, 1001},
+ {.data = gConfetti_Pal, .tag = TAG_CONFETTI},
{},
};
@@ -172,7 +173,7 @@ static const s16 sHallOfFame_MonHalfTeamPositions[PARTY_SIZE / 2][4] =
{-86, 244, 184, 64}
};
-static const struct OamData sOamData_85E53FC =
+static const struct OamData sOamData_Confetti =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
@@ -189,126 +190,138 @@ static const struct OamData sOamData_85E53FC =
.affineParam = 0,
};
-static const union AnimCmd sSpriteAnim_85E5404[] =
+static const union AnimCmd sAnim_PinkConfettiA[] =
{
ANIMCMD_FRAME(0, 30),
ANIMCMD_END
};
-static const union AnimCmd sSpriteAnim_85E540C[] =
+static const union AnimCmd sAnim_RedConfettiA[] =
{
ANIMCMD_FRAME(1, 30),
ANIMCMD_END
};
-static const union AnimCmd sSpriteAnim_85E5414[] =
+static const union AnimCmd sAnim_BlueConfettiA[] =
{
ANIMCMD_FRAME(2, 30),
ANIMCMD_END
};
-static const union AnimCmd sSpriteAnim_85E541C[] =
+static const union AnimCmd sAnim_RedConfettiB[] =
{
ANIMCMD_FRAME(3, 30),
ANIMCMD_END
};
-static const union AnimCmd sSpriteAnim_85E5424[] =
+static const union AnimCmd sAnim_BlueConfettiB[] =
{
ANIMCMD_FRAME(4, 30),
ANIMCMD_END
};
-static const union AnimCmd sSpriteAnim_85E542C[] =
+static const union AnimCmd sAnim_YellowConfettiA[] =
{
ANIMCMD_FRAME(5, 30),
ANIMCMD_END
};
-static const union AnimCmd sSpriteAnim_85E5434[] =
+static const union AnimCmd sAnim_WhiteConfettiA[] =
{
ANIMCMD_FRAME(6, 30),
ANIMCMD_END
};
-static const union AnimCmd sSpriteAnim_85E543C[] =
+static const union AnimCmd sAnim_GreenConfettiA[] =
{
ANIMCMD_FRAME(7, 30),
ANIMCMD_END
};
-static const union AnimCmd sSpriteAnim_85E5444[] =
+static const union AnimCmd sAnim_PinkConfettiB[] =
{
ANIMCMD_FRAME(8, 30),
ANIMCMD_END
};
-static const union AnimCmd sSpriteAnim_85E544C[] =
+static const union AnimCmd sAnim_BlueConfettiC[] =
{
ANIMCMD_FRAME(9, 30),
ANIMCMD_END
};
-static const union AnimCmd sSpriteAnim_85E5454[] =
+static const union AnimCmd sAnim_YellowConfettiB[] =
{
ANIMCMD_FRAME(10, 30),
ANIMCMD_END
};
-static const union AnimCmd sSpriteAnim_85E545C[] =
+static const union AnimCmd sAnim_WhiteConfettiB[] =
{
ANIMCMD_FRAME(11, 30),
ANIMCMD_END
};
-static const union AnimCmd sSpriteAnim_85E5464[] =
+static const union AnimCmd sAnim_GreenConfettiB[] =
{
ANIMCMD_FRAME(12, 30),
ANIMCMD_END
};
-static const union AnimCmd sSpriteAnim_85E546C[] =
+static const union AnimCmd sAnim_PinkConfettiC[] =
{
ANIMCMD_FRAME(13, 30),
ANIMCMD_END
};
-static const union AnimCmd sSpriteAnim_85E5474[] =
+static const union AnimCmd sAnim_RedConfettiC[] =
{
ANIMCMD_FRAME(14, 30),
ANIMCMD_END
};
-static const union AnimCmd sSpriteAnim_85E547C[] =
+static const union AnimCmd sAnim_YellowConfettiC[] =
{
ANIMCMD_FRAME(15, 30),
ANIMCMD_END
};
-static const union AnimCmd sSpriteAnim_85E5484[] =
+static const union AnimCmd sAnim_WhiteConfettiC[] =
{
ANIMCMD_FRAME(16, 30),
ANIMCMD_END
};
-static const union AnimCmd * const sSpriteAnimTable_85E548C[] =
-{
- sSpriteAnim_85E5404, sSpriteAnim_85E540C, sSpriteAnim_85E5414, sSpriteAnim_85E541C,
- sSpriteAnim_85E5424, sSpriteAnim_85E542C, sSpriteAnim_85E5434, sSpriteAnim_85E543C,
- sSpriteAnim_85E5444, sSpriteAnim_85E544C, sSpriteAnim_85E5454, sSpriteAnim_85E545C,
- sSpriteAnim_85E5464, sSpriteAnim_85E546C, sSpriteAnim_85E5474, sSpriteAnim_85E547C,
- sSpriteAnim_85E5484
+static const union AnimCmd * const sAnims_Confetti[] =
+{
+ sAnim_PinkConfettiA,
+ sAnim_RedConfettiA,
+ sAnim_BlueConfettiA,
+ sAnim_RedConfettiB,
+ sAnim_BlueConfettiB,
+ sAnim_YellowConfettiA,
+ sAnim_WhiteConfettiA,
+ sAnim_GreenConfettiA,
+ sAnim_PinkConfettiB,
+ sAnim_BlueConfettiC,
+ sAnim_YellowConfettiB,
+ sAnim_WhiteConfettiB,
+ sAnim_GreenConfettiB,
+ sAnim_PinkConfettiC,
+ sAnim_RedConfettiC,
+ sAnim_YellowConfettiC,
+ sAnim_WhiteConfettiC
};
-static const struct SpriteTemplate sSpriteTemplate_85E54D0 =
+static const struct SpriteTemplate sSpriteTemplate_HofConfetti =
{
- .tileTag = 1001,
- .paletteTag = 1001,
- .oam = &sOamData_85E53FC,
- .anims = sSpriteAnimTable_85E548C,
+ .tileTag = TAG_CONFETTI,
+ .paletteTag = TAG_CONFETTI,
+ .oam = &sOamData_Confetti,
+ .anims = sAnims_Confetti,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_81751A4
+ .callback = SpriteCB_HofConfetti
};
static const u16 sHallOfFame_Pal[] = INCBIN_U16("graphics/misc/japanese_hof.gbapal");
@@ -317,10 +330,19 @@ static const u32 sHallOfFame_Gfx[] = INCBIN_U32("graphics/misc/japanese_hof.4bpp
static const struct HallofFameMon sDummyFameMon =
{
- 0x3EA03EA, 0, 0, 0, {0}
+ .tid = 0x3EA03EA,
+ .personality = 0,
+ .species = SPECIES_NONE,
+ .lvl = 0,
+ .nick = {0}
};
-static const u8 sUnused2[] = {2, 1, 3, 6, 4, 5, 0, 0};
+// Unused, order of party slots on Hall of Fame screen
+static const u8 sHallOfFame_SlotOrder[] = {
+ 2, 1, 3,
+ 6, 4, 5,
+ 0, 0
+};
// code
static void VBlankCB_HallOfFame(void)
@@ -350,14 +372,14 @@ static bool8 InitHallOfFameScreen(void)
gMain.state = 1;
break;
case 1:
- sub_8174F70();
+ LoadHofGfx();
gMain.state++;
break;
case 2:
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 7));
SetGpuReg(REG_OFFSET_BLDY, 0);
- sub_8174FAC();
+ InitHofBgs();
sHofGfxPtr->state = 0;
gMain.state++;
break;
@@ -433,7 +455,7 @@ static void Task_Hof_InitMonData(u8 taskId)
}
else
{
- sHofMonPtr->mon[i].species = 0;
+ sHofMonPtr->mon[i].species = SPECIES_NONE;
sHofMonPtr->mon[i].tid = 0;
sHofMonPtr->mon[i].personality = 0;
sHofMonPtr->mon[i].lvl = 0;
@@ -441,7 +463,7 @@ static void Task_Hof_InitMonData(u8 taskId)
}
}
- sUnknown_0203BCD4 = 0;
+ sHofFadePalettes = 0;
gTasks[taskId].tDisplayedMonId = 0;
gTasks[taskId].tPlayerSpriteID = 0xFF;
@@ -514,12 +536,12 @@ static void Task_Hof_TrySaveData(u8 taskId)
else
{
PlaySE(SE_SAVE);
- gTasks[taskId].func = Task_Hof_WaitForFrames;
+ gTasks[taskId].func = Task_Hof_WaitToDisplayMon;
gTasks[taskId].tFrameCount = 32;
}
}
-static void Task_Hof_WaitForFrames(u8 taskId)
+static void Task_Hof_WaitToDisplayMon(u8 taskId)
{
if (gTasks[taskId].tFrameCount)
gTasks[taskId].tFrameCount--;
@@ -539,32 +561,32 @@ static void Task_Hof_SetMonDisplayTask(u8 taskId)
static void Task_Hof_DisplayMon(u8 taskId)
{
u8 spriteId;
- s16 xPos, yPos, field4, field6;
+ s16 startX, startY, destX, destY;
u16 currMonId = gTasks[taskId].tDisplayedMonId;
struct HallofFameMon* currMon = &sHofMonPtr->mon[currMonId];
if (gTasks[taskId].tMonNumber > PARTY_SIZE / 2)
{
- xPos = sHallOfFame_MonFullTeamPositions[currMonId][0];
- yPos = sHallOfFame_MonFullTeamPositions[currMonId][1];
- field4 = sHallOfFame_MonFullTeamPositions[currMonId][2];
- field6 = sHallOfFame_MonFullTeamPositions[currMonId][3];
+ startX = sHallOfFame_MonFullTeamPositions[currMonId][0];
+ startY = sHallOfFame_MonFullTeamPositions[currMonId][1];
+ destX = sHallOfFame_MonFullTeamPositions[currMonId][2];
+ destY = sHallOfFame_MonFullTeamPositions[currMonId][3];
}
else
{
- xPos = sHallOfFame_MonHalfTeamPositions[currMonId][0];
- yPos = sHallOfFame_MonHalfTeamPositions[currMonId][1];
- field4 = sHallOfFame_MonHalfTeamPositions[currMonId][2];
- field6 = sHallOfFame_MonHalfTeamPositions[currMonId][3];
+ startX = sHallOfFame_MonHalfTeamPositions[currMonId][0];
+ startY = sHallOfFame_MonHalfTeamPositions[currMonId][1];
+ destX = sHallOfFame_MonHalfTeamPositions[currMonId][2];
+ destY = sHallOfFame_MonHalfTeamPositions[currMonId][3];
}
if (currMon->species == SPECIES_EGG)
- field6 += 10;
+ destY += 10;
- spriteId = CreatePicSprite2(currMon->species, currMon->tid, currMon->personality, 1, xPos, yPos, currMonId, 0xFFFF);
- gSprites[spriteId].tDestinationX = field4;
- gSprites[spriteId].tDestinationY = field6;
+ spriteId = CreatePicSprite2(currMon->species, currMon->tid, currMon->personality, 1, startX, startY, currMonId, 0xFFFF);
+ gSprites[spriteId].tDestinationX = destX;
+ gSprites[spriteId].tDestinationY = destY;
gSprites[spriteId].data[0] = 0;
gSprites[spriteId].tSpecies = currMon->species;
gSprites[spriteId].callback = SpriteCB_GetOnScreenAndAnimate;
@@ -599,11 +621,11 @@ static void Task_Hof_TryDisplayAnotherMon(u8 taskId)
}
else
{
- sUnknown_0203BCD4 |= (0x10000 << gSprites[gTasks[taskId].tMonSpriteId(currPokeID)].oam.paletteNum);
- if (gTasks[taskId].tDisplayedMonId <= 4 && currMon[1].species != SPECIES_NONE) // there is another pokemon to display
+ sHofFadePalettes |= (0x10000 << gSprites[gTasks[taskId].tMonSpriteId(currPokeID)].oam.paletteNum);
+ if (gTasks[taskId].tDisplayedMonId < PARTY_SIZE - 1 && currMon[1].species != SPECIES_NONE) // there is another pokemon to display
{
gTasks[taskId].tDisplayedMonId++;
- BeginNormalPaletteFade(sUnknown_0203BCD4, 0, 12, 12, RGB(16, 29, 24));
+ BeginNormalPaletteFade(sHofFadePalettes, 0, 12, 12, RGB(16, 29, 24));
gSprites[gTasks[taskId].tMonSpriteId(currPokeID)].oam.priority = 1;
gTasks[taskId].func = Task_Hof_DisplayMon;
}
@@ -628,16 +650,19 @@ static void Task_Hof_PaletteFadeAndPrintWelcomeText(u8 taskId)
HallOfFame_PrintWelcomeText(0, 15);
PlaySE(SE_DENDOU);
gTasks[taskId].tFrameCount = 400;
- gTasks[taskId].func = sub_8173DC0;
+ gTasks[taskId].func = Task_Hof_DoConfetti;
}
-static void sub_8173DC0(u8 taskId)
+static void Task_Hof_DoConfetti(u8 taskId)
{
if (gTasks[taskId].tFrameCount != 0)
{
gTasks[taskId].tFrameCount--;
+
+ // Create new confetti every 4th frame for the first 290 frames
+ // For the last 110 frames wait for the existing confetti to fall offscreen
if ((gTasks[taskId].tFrameCount & 3) == 0 && gTasks[taskId].tFrameCount > 110)
- sub_81751FC();
+ CreateHofConfettiSprite();
}
else
{
@@ -647,19 +672,19 @@ static void sub_8173DC0(u8 taskId)
if (gTasks[taskId].tMonSpriteId(i) != 0xFF)
gSprites[gTasks[taskId].tMonSpriteId(i)].oam.priority = 1;
}
- BeginNormalPaletteFade(sUnknown_0203BCD4, 0, 12, 12, RGB(16, 29, 24));
+ BeginNormalPaletteFade(sHofFadePalettes, 0, 12, 12, RGB(16, 29, 24));
FillWindowPixelBuffer(0, PIXEL_FILL(0));
CopyWindowToVram(0, 3);
gTasks[taskId].tFrameCount = 7;
- gTasks[taskId].func = sub_8173EA4;
+ gTasks[taskId].func = Task_Hof_WaitToDisplayPlayer;
}
}
-static void sub_8173EA4(u8 taskId)
+static void Task_Hof_WaitToDisplayPlayer(u8 taskId)
{
if (gTasks[taskId].tFrameCount >= 16)
{
- gTasks[taskId].func = sub_8173EE4;
+ gTasks[taskId].func = Task_Hof_DisplayPlayer;
}
else
{
@@ -668,7 +693,7 @@ static void sub_8173EA4(u8 taskId)
}
}
-static void sub_8173EE4(u8 taskId)
+static void Task_Hof_DisplayPlayer(u8 taskId)
{
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
ShowBg(0);
@@ -784,14 +809,14 @@ void CB2_DoHallOfFamePC(void)
gMain.state = 1;
break;
case 1:
- sub_8174F70();
+ LoadHofGfx();
gMain.state++;
break;
case 2:
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
- sub_8174FAC();
+ InitHofBgs();
gMain.state++;
break;
case 3:
@@ -874,7 +899,7 @@ static void Task_HofPC_DrawSpritesPrintText(u8 taskId)
savedTeams++;
currMon = &savedTeams->mon[0];
- sUnknown_0203BCD4 = 0;
+ sHofFadePalettes = 0;
gTasks[taskId].tCurrMonId = 0;
gTasks[taskId].tMonNo = 0;
@@ -949,8 +974,8 @@ static void Task_HofPC_PrintMonInfo(u8 taskId)
currMonID = gTasks[taskId].tMonSpriteId(gTasks[taskId].tCurrMonId);
gSprites[currMonID].oam.priority = 0;
- sUnknown_0203BCD4 = (0x10000 << gSprites[currMonID].oam.paletteNum) ^ 0xFFFF0000;
- BlendPalettesUnfaded(sUnknown_0203BCD4, 0xC, RGB(16, 29, 24));
+ sHofFadePalettes = (0x10000 << gSprites[currMonID].oam.paletteNum) ^ 0xFFFF0000;
+ BlendPalettesUnfaded(sHofFadePalettes, 0xC, RGB(16, 29, 24));
currMon = &savedTeams->mon[gTasks[taskId].tCurrMonId];
if (currMon->species != SPECIES_EGG)
@@ -972,7 +997,7 @@ static void Task_HofPC_HandleInput(u8 taskId)
if (gTasks[taskId].tCurrTeamNo != 0) // prepare another team to view
{
gTasks[taskId].tCurrTeamNo--;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
{
u8 spriteId = gTasks[taskId].tMonSpriteId(i);
if (spriteId != 0xFF)
@@ -1250,7 +1275,7 @@ static void ClearVramOamPltt_LoadHofPal(void)
LoadPalette(sHallOfFame_Pal, 0, 0x20);
}
-static void sub_8174F70(void)
+static void LoadHofGfx(void)
{
ScanlineEffect_Stop();
ResetTasks();
@@ -1259,11 +1284,11 @@ static void sub_8174F70(void)
ResetAllPicSprites();
FreeAllSpritePalettes();
gReservedSpritePaletteCount = 8;
- LoadCompressedSpriteSheet(sHallOfFame_ConfettiSpriteSheet);
- LoadCompressedSpritePalette(sHallOfFame_ConfettiSpritePalette);
+ LoadCompressedSpriteSheet(sSpriteSheet_Confetti);
+ LoadCompressedSpritePalette(sSpritePalette_Confetti);
}
-static void sub_8174FAC(void)
+static void InitHofBgs(void)
{
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sHof_BgTemplates, ARRAY_COUNT(sHof_BgTemplates));
@@ -1344,7 +1369,10 @@ static void SpriteCB_GetOnScreenAndAnimate(struct Sprite *sprite)
#undef tDestinationY
#undef tSpecies
-static void sub_81751A4(struct Sprite* sprite)
+#define sSineIdx data[0]
+#define sExtraY data[1]
+
+static void SpriteCB_HofConfetti(struct Sprite* sprite)
{
if (sprite->pos2.y > 120)
{
@@ -1353,20 +1381,20 @@ static void sub_81751A4(struct Sprite* sprite)
else
{
u16 rand;
- u8 tableID;
+ u8 sineIdx;
sprite->pos2.y++;
- sprite->pos2.y += sprite->data[1];
+ sprite->pos2.y += sprite->sExtraY;
- tableID = sprite->data[0];
+ sineIdx = sprite->sSineIdx;
rand = (Random() % 4) + 8;
- sprite->pos2.x = rand * gSineTable[tableID] / 256;
+ sprite->pos2.x = rand * gSineTable[sineIdx] / 256;
- sprite->data[0] += 4;
+ sprite->sSineIdx += 4;
}
}
-static bool8 sub_81751FC(void)
+static bool8 CreateHofConfettiSprite(void)
{
u8 spriteID;
struct Sprite* sprite;
@@ -1374,110 +1402,136 @@ static bool8 sub_81751FC(void)
s16 posX = Random() % 240;
s16 posY = -(Random() % 8);
- spriteID = CreateSprite(&sSpriteTemplate_85E54D0, posX, posY, 0);
+ spriteID = CreateSprite(&sSpriteTemplate_HofConfetti, posX, posY, 0);
sprite = &gSprites[spriteID];
- StartSpriteAnim(sprite, Random() % 17);
+ StartSpriteAnim(sprite, Random() % ARRAY_COUNT(sAnims_Confetti));
+ // 1/4 confetti sprites move an extra Y coord each frame
if (Random() & 3)
- sprite->data[1] = 0;
+ sprite->sExtraY = 0;
else
- sprite->data[1] = 1;
+ sprite->sExtraY = 1;
return FALSE;
}
-// Used when a Battle Dome tourney is won
-void DoConfettiEffect(void)
+// The below confetti functions are used when a Battle Dome tourney is won
+// For the Hall of Fame confetti see Task_Hof_DoConfetti
+// The end result is essentially the same, just a very different way of handling it
+#define tState data[0]
+#define tTimer data[1]
+#define tConfettiCount data[15]
+
+// Indexes into the data array of the struct ConfettiUtil
+#define CONFETTI_SINE_IDX 0
+#define CONFETTI_EXTRA_Y 1
+#define CONFETTI_TASK_ID 7
+
+void DoDomeConfetti(void)
{
u8 taskId;
gSpecialVar_0x8004 = 180;
- taskId = CreateTask(Task_DoConfettiEffect, 0);
+ taskId = CreateTask(Task_DoDomeConfetti, 0);
if (taskId != 0xFF)
{
- gTasks[taskId].data[1] = gSpecialVar_0x8004;
+ gTasks[taskId].tTimer = gSpecialVar_0x8004;
gSpecialVar_0x8005 = taskId;
}
}
-static void StopConfettiEffect(void)
+static void StopDomeConfetti(void)
{
u8 taskId;
- if ((taskId = FindTaskIdByFunc(Task_DoConfettiEffect)) != 0xFF)
+ if ((taskId = FindTaskIdByFunc(Task_DoDomeConfetti)) != 0xFF)
DestroyTask(taskId);
- sub_8152254();
- FreeSpriteTilesByTag(0x3E9);
- FreeSpritePaletteByTag(0x3E9);
+ ConfettiUtil_Free();
+ FreeSpriteTilesByTag(TAG_CONFETTI);
+ FreeSpritePaletteByTag(TAG_CONFETTI);
}
-static void sub_81752F4(struct UnkStruct_81520A8 *structPtr)
+static void UpdateDomeConfetti(struct ConfettiUtil *util)
{
- if (structPtr->yDelta > 110)
+ if (util->yDelta > 110)
{
- gTasks[structPtr->data[7]].data[15]--;
- sub_81525D0(structPtr->id);
+ // Destroy confetti after it falls far enough
+ gTasks[util->data[CONFETTI_TASK_ID]].tConfettiCount--;
+ ConfettiUtil_Remove(util->id);
}
else
{
- u8 var;
+ // Move confetti down
+ u8 sineIdx;
s32 rand;
- structPtr->yDelta++;
- structPtr->yDelta += structPtr->data[1];
+ util->yDelta++;
+ util->yDelta += util->data[CONFETTI_EXTRA_Y];
- var = structPtr->data[0];
+ sineIdx = util->data[CONFETTI_SINE_IDX];
rand = Random();
rand &= 3;
rand += 8;
- structPtr->xDelta = (rand) * ((gSineTable[var])) / 256;
+ util->xDelta = (rand) * ((gSineTable[sineIdx])) / 256;
- structPtr->data[0] += 4;
+ util->data[CONFETTI_SINE_IDX] += 4;
}
}
-static void Task_DoConfettiEffect(u8 taskId)
+static void Task_DoDomeConfetti(u8 taskId)
{
- u32 var = 0;
+ u32 id = 0;
u16 *data = gTasks[taskId].data;
- switch (data[0])
+ switch (tState)
{
case 0:
- if (!sub_81521C0(0x40))
+ if (!ConfettiUtil_Init(64))
{
+ // Init failed
DestroyTask(taskId);
- gSpecialVar_0x8004 = var;
+ gSpecialVar_0x8004 = 0;
gSpecialVar_0x8005 = 0xFFFF;
}
- LoadCompressedSpriteSheet(sHallOfFame_ConfettiSpriteSheet);
- LoadCompressedSpritePalette(sHallOfFame_ConfettiSpritePalette);
- data[0]++;
+ LoadCompressedSpriteSheet(sSpriteSheet_Confetti);
+ LoadCompressedSpritePalette(sSpritePalette_Confetti);
+ tState++;
break;
case 1:
- if (data[1] != 0 && data[1] % 3 == 0)
+ if (tTimer != 0 && tTimer % 3 == 0)
{
- var = sub_81524C4(&sOamData_85E53FC, 0x3E9, 0x3E9, Random() % 240, -(Random() % 8), Random() % 0x11, var);
- if (var != 0xFF)
+ // Create new confetti every 3 frames
+ id = ConfettiUtil_AddNew(&sOamData_Confetti,
+ TAG_CONFETTI,
+ TAG_CONFETTI,
+ Random() % 240,
+ -(Random() % 8),
+ Random() % ARRAY_COUNT(sAnims_Confetti),
+ id);
+ if (id != 0xFF)
{
- sub_8152438(var, sub_81752F4);
- if ((Random() & 3) == 0)
- sub_8152474(var, 1, 1);
- sub_8152474(var, 7, taskId);
- data[15]++;
+ ConfettiUtil_SetCallback(id, UpdateDomeConfetti);
+
+ // 1/4 of the confetti move an extra y coord every frame
+ if ((Random() % 4) == 0)
+ ConfettiUtil_SetData(id, CONFETTI_EXTRA_Y, 1);
+
+ ConfettiUtil_SetData(id, CONFETTI_TASK_ID, taskId);
+ tConfettiCount++;
}
}
- sub_81522D4();
- if (data[1] != 0)
- data[1]--;
- else if (data[15] == 0)
- data[0] = 0xFF;
+
+ ConfettiUtil_Update();
+ if (tTimer != 0)
+ tTimer--;
+ else if (tConfettiCount == 0)
+ tState = 0xFF;
break;
case 0xFF:
- StopConfettiEffect();
- gSpecialVar_0x8004 = var;
+ StopDomeConfetti();
+ gSpecialVar_0x8004 = 0;
gSpecialVar_0x8005 = 0xFFFF;
break;
}
diff --git a/src/image_processing_effects.c b/src/image_processing_effects.c
index 13794faf0..cbd8b9b37 100644
--- a/src/image_processing_effects.c
+++ b/src/image_processing_effects.c
@@ -5,7 +5,7 @@
// IWRAM common
u8 gCanvasColumnStart;
-u16 (*gCanvasPixels)[][32];
+u16 *gCanvasPixels;
u8 gCanvasRowEnd;
u8 gCanvasHeight;
u8 gCanvasColumnEnd;
@@ -125,7 +125,7 @@ static void ApplyImageEffect_RedChannelGrayscale(u8 delta)
for (j = 0; j < gCanvasRowEnd; j++)
{
- u16 *pixelRow = &(*gCanvasPixels)[0][(gCanvasRowStart + j) * gCanvasWidth];
+ u16 *pixelRow = &gCanvasPixels[(gCanvasRowStart + j) * gCanvasWidth];
u16 *pixel = &pixelRow[gCanvasColumnStart];
for (i = 0; i < gCanvasColumnEnd; i++, pixel++)
{
@@ -150,7 +150,7 @@ static void ApplyImageEffect_RedChannelGrayscaleHighlight(u8 highlight)
for (j = 0; j < gCanvasRowEnd; j++)
{
- u16 *pixelRow = &(*gCanvasPixels)[0][(gCanvasRowStart + j) * gCanvasWidth];
+ u16 *pixelRow = &gCanvasPixels[(gCanvasRowStart + j) * gCanvasWidth];
u16 *pixel = &pixelRow[gCanvasColumnStart];
for (i = 0; i < gCanvasColumnEnd; i++, pixel++)
{
@@ -179,7 +179,7 @@ static void ApplyImageEffect_Grayscale(void)
for (j = 0; j < gCanvasRowEnd; j++)
{
- u16 *pixelRow = &(*gCanvasPixels)[0][(gCanvasRowStart + j) * gCanvasWidth];
+ u16 *pixelRow = &gCanvasPixels[(gCanvasRowStart + j) * gCanvasWidth];
u16 *pixel = &pixelRow[gCanvasColumnStart];
for (i = 0; i < gCanvasColumnEnd; i++, pixel++)
{
@@ -195,7 +195,7 @@ static void ApplyImageEffect_Blur(void)
for (i = 0; i < gCanvasColumnEnd; i++)
{
- u16 *pixelRow = &(*gCanvasPixels)[0][gCanvasRowStart * gCanvasWidth];
+ u16 *pixelRow = &gCanvasPixels[gCanvasRowStart * gCanvasWidth];
u16 *pixel = &pixelRow[gCanvasColumnStart + i];
u16 prevPixel = *pixel;
@@ -221,7 +221,7 @@ static void ApplyImageEffect_PersonalityColor(u8 personality)
for (j = 0; j < gCanvasRowEnd; j++)
{
- u16 *pixelRow = &(*gCanvasPixels)[0][(gCanvasRowStart + j) * gCanvasWidth];
+ u16 *pixelRow = &gCanvasPixels[(gCanvasRowStart + j) * gCanvasWidth];
u16 *pixel = &pixelRow[gCanvasColumnStart];
for (i = 0; i < gCanvasColumnEnd; i++, pixel++)
{
@@ -237,7 +237,7 @@ static void ApplyImageEffect_BlackAndWhite(void)
for (j = 0; j < gCanvasRowEnd; j++)
{
- u16 *pixelRow = &(*gCanvasPixels)[0][(gCanvasRowStart + j) * gCanvasWidth];
+ u16 *pixelRow = &gCanvasPixels[(gCanvasRowStart + j) * gCanvasWidth];
u16 *pixel = &pixelRow[gCanvasColumnStart];
for (i = 0; i < gCanvasColumnEnd; i++, pixel++)
{
@@ -255,7 +255,7 @@ static void ApplyImageEffect_BlackOutline(void)
// Handle top row of pixels first.
for (j = 0; j < gCanvasRowEnd; j++)
{
- u16 *pixelRow = &(*gCanvasPixels)[0][(gCanvasRowStart + j) * gCanvasWidth];
+ u16 *pixelRow = &gCanvasPixels[(gCanvasRowStart + j) * gCanvasWidth];
pixel = &pixelRow[gCanvasColumnStart];
*pixel = QuantizePixel_BlackOutline(pixel, pixel + 1);
for (i = 1, pixel++; i < gCanvasColumnEnd - 1; i++, pixel++)
@@ -270,7 +270,7 @@ static void ApplyImageEffect_BlackOutline(void)
// Handle each column from left to right.
for (i = 0; i < gCanvasColumnEnd; i++)
{
- u16 *pixelRow = &(*gCanvasPixels)[0][gCanvasRowStart * gCanvasWidth];
+ u16 *pixelRow = &gCanvasPixels[gCanvasRowStart * gCanvasWidth];
pixel = &pixelRow[gCanvasColumnStart + i];
*pixel = QuantizePixel_BlackOutline(pixel, pixel + gCanvasWidth);
for (j = 1, pixel += gCanvasWidth; j < gCanvasRowEnd - 1; j++, pixel += gCanvasWidth)
@@ -289,7 +289,7 @@ static void ApplyImageEffect_Invert(void)
for (j = 0; j < gCanvasRowEnd; j++)
{
- u16 *pixelRow = &(*gCanvasPixels)[0][(gCanvasRowStart + j) * gCanvasWidth];
+ u16 *pixelRow = &gCanvasPixels[(gCanvasRowStart + j) * gCanvasWidth];
u16 *pixel = &pixelRow[gCanvasColumnStart];
for (i = 0; i < gCanvasColumnEnd; i++, pixel++)
{
@@ -306,7 +306,7 @@ static void ApplyImageEffect_Shimmer(void)
u16 prevPixel;
// First, invert all of the colors.
- pixel = (*gCanvasPixels)[0];
+ pixel = gCanvasPixels;
for (i = 0; i < 64; i++)
{
for (j = 0; j < 64; j++, pixel++)
@@ -319,7 +319,7 @@ static void ApplyImageEffect_Shimmer(void)
// Blur the pixels twice.
for (j = 0; j < 64; j++)
{
- pixel = &(*gCanvasPixels)[0][j];
+ pixel = &gCanvasPixels[j];
prevPixel = *pixel;
*pixel = 0x8000;
for (i = 1, pixel += 64; i < 63; i++, pixel += 64)
@@ -332,7 +332,7 @@ static void ApplyImageEffect_Shimmer(void)
}
*pixel = 0x8000;
- pixel = &(*gCanvasPixels)[0][j];
+ pixel = &gCanvasPixels[j];
prevPixel = *pixel;
*pixel = 0x8000;
for (i = 1, pixel += 64; i < 63; i++, pixel += 64)
@@ -350,7 +350,7 @@ static void ApplyImageEffect_Shimmer(void)
// Finally, invert colors back to the original color space.
// The above blur causes the outline areas to darken, which makes
// this inversion give the effect of light outlines.
- pixel = (*gCanvasPixels)[0];
+ pixel = gCanvasPixels;
for (i = 0; i < 64; i++)
{
for (j = 0; j < 64; j++, pixel++)
@@ -367,7 +367,7 @@ static void ApplyImageEffect_BlurRight(void)
for (j = 0; j < gCanvasRowEnd; j++)
{
- u16 *pixelRow = &(*gCanvasPixels)[0][(gCanvasRowStart + j) * gCanvasWidth];
+ u16 *pixelRow = &gCanvasPixels[(gCanvasRowStart + j) * gCanvasWidth];
u16 *pixel = &pixelRow[gCanvasColumnStart];
u16 prevPixel = *pixel;
for (i = 1, pixel++; i < gCanvasColumnEnd - 1; i++, pixel++)
@@ -387,7 +387,7 @@ static void ApplyImageEffect_BlurDown(void)
for (i = 0; i < gCanvasColumnEnd; i++)
{
- u16 *pixelRow = &(*gCanvasPixels)[0][gCanvasRowStart * gCanvasWidth];
+ u16 *pixelRow = &gCanvasPixels[gCanvasRowStart * gCanvasWidth];
u16 *pixel = &pixelRow[gCanvasColumnStart + i];
u16 prevPixel = *pixel;
for (j = 1, pixel += gCanvasWidth; j < gCanvasRowEnd - 1; j++, pixel += gCanvasWidth)
@@ -445,7 +445,7 @@ static void AddPointillismPoints(u16 arg0)
for (i = 0; i < points[0].delta; i++)
{
- u16 *pixel = &(*gCanvasPixels)[points[i].row * 2][points[i].column];
+ u16 *pixel = &gCanvasPixels[points[i].row * 64] + points[i].column;
if (!(0x8000 & *pixel))
{
@@ -910,7 +910,7 @@ static void QuantizePalette_Standard(bool8 useLimitedPalette)
gCanvasPalette[maxIndex] = RGB2(15, 15, 15);
for (j = 0; j < gCanvasRowEnd; j++)
{
- u16 *pixelRow = &(*gCanvasPixels)[0][(gCanvasRowStart + j) * gCanvasWidth];
+ u16 *pixelRow = &gCanvasPixels[(gCanvasRowStart + j) * gCanvasWidth];
u16 *pixel = &pixelRow[gCanvasColumnStart];
for (i = 0; i < gCanvasColumnEnd; i++, pixel++)
{
@@ -978,7 +978,7 @@ static void QuantizePalette_BlackAndWhite(void)
for (j = 0; j < gCanvasRowEnd; j++)
{
- u16 *pixelRow = &(*gCanvasPixels)[0][(gCanvasRowStart + j) * gCanvasWidth];
+ u16 *pixelRow = &gCanvasPixels[(gCanvasRowStart + j) * gCanvasWidth];
u16 *pixel = &pixelRow[gCanvasColumnStart];
for (i = 0; i < gCanvasColumnEnd; i++, pixel++)
{
@@ -1009,7 +1009,7 @@ static void QuantizePalette_GrayscaleSmall(void)
for (j = 0; j < gCanvasRowEnd; j++)
{
- u16 *pixelRow = &(*gCanvasPixels)[0][(gCanvasRowStart + j) * gCanvasWidth];
+ u16 *pixelRow = &gCanvasPixels[(gCanvasRowStart + j) * gCanvasWidth];
u16 *pixel = &pixelRow[gCanvasColumnStart];
for (i = 0; i < gCanvasColumnEnd; i++, pixel++)
{
@@ -1027,7 +1027,7 @@ static void QuantizePalette_Grayscale(void)
for (j = 0; j < gCanvasRowEnd; j++)
{
- u16 *pixelRow = &(*gCanvasPixels)[0][(gCanvasRowStart + j) * gCanvasWidth];
+ u16 *pixelRow = &gCanvasPixels[(gCanvasRowStart + j) * gCanvasWidth];
u16 *pixel = &pixelRow[gCanvasColumnStart];
for (i = 0; i < gCanvasColumnEnd; i++, pixel++)
{
@@ -1045,7 +1045,7 @@ static void QuantizePalette_PrimaryColors(void)
for (j = 0; j < gCanvasRowEnd; j++)
{
- u16 *pixelRow = &(*gCanvasPixels)[0][(gCanvasRowStart + j) * gCanvasWidth];
+ u16 *pixelRow = &gCanvasPixels[(gCanvasRowStart + j) * gCanvasWidth];
u16 *pixel = &pixelRow[gCanvasColumnStart];
for (i = 0; i < gCanvasColumnEnd; i++, pixel++)
{
diff --git a/src/item_menu.c b/src/item_menu.c
index 43e657328..591ebe018 100755
--- a/src/item_menu.c
+++ b/src/item_menu.c
@@ -1776,7 +1776,7 @@ void Task_ChooseHowManyToToss(u8 taskId)
if (AdjustQuantityAccordingToDPadInput(&tItemCount, data[2]) == TRUE)
{
- PrintItemDepositAmount(gBagMenu->unk817, tItemCount);
+ PrintItemDepositAmount(gBagMenu->windowPointers[7], tItemCount);
}
else if (gMain.newKeys & A_BUTTON)
{
@@ -2050,7 +2050,7 @@ void Task_BuyHowManyDialogueHandleInput(u8 taskId)
if (AdjustQuantityAccordingToDPadInput(&tItemCount, data[2]) == TRUE)
{
- PrintItemSoldAmount(gBagMenu->unk818, tItemCount, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount);
+ PrintItemSoldAmount(gBagMenu->windowPointers[8], tItemCount, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount);
}
else if (gMain.newKeys & A_BUTTON)
{
@@ -2094,7 +2094,7 @@ void sub_81AD8C8(u8 taskId)
LoadBagItemListBuffers(gBagPositionStruct.pocket);
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos);
BagMenu_PrintCursor_(data[0], 2);
- PrintMoneyAmountInMoneyBox(gBagMenu->unk819, GetMoney(&gSaveBlock1Ptr->money), 0);
+ PrintMoneyAmountInMoneyBox(gBagMenu->windowPointers[9], GetMoney(&gSaveBlock1Ptr->money), 0);
gTasks[taskId].func = sub_81AD9C0;
}
@@ -2134,7 +2134,7 @@ void sub_81ADA7C(u8 taskId)
if (AdjustQuantityAccordingToDPadInput(&tItemCount, data[2]) == TRUE)
{
- PrintItemDepositAmount(gBagMenu->unk817, tItemCount);
+ PrintItemDepositAmount(gBagMenu->windowPointers[7], tItemCount);
}
else if (gMain.newKeys & A_BUTTON)
{
@@ -2359,7 +2359,7 @@ void SetupBagMenu_Textboxes(void)
DeactivateAllTextPrinters();
LoadUserWindowBorderGfx(0, 1, 0xE0);
LoadMessageBoxGfx(0, 10, 0xD0);
- sub_819A2BC(0xC0, 1);
+ ListMenuLoadStdPalAt(0xC0, 1);
LoadPalette(&gUnknown_0860F074, 0xF0, 0x20);
for (i = 0; i < 3; i++)
{
diff --git a/src/item_use.c b/src/item_use.c
index ff689a19a..0aae441c8 100755
--- a/src/item_use.c
+++ b/src/item_use.c
@@ -38,11 +38,9 @@
#include "text.h"
#include "constants/event_bg.h"
#include "constants/event_objects.h"
-#include "constants/flags.h"
#include "constants/item_effects.h"
#include "constants/items.h"
#include "constants/songs.h"
-#include "constants/vars.h"
static void SetUpItemUseCallback(u8 taskId);
static void FieldCB_UseItemOnField(void);
diff --git a/src/libgcnmultiboot.s b/src/libgcnmultiboot.s
index 0e418e51f..dbf70ccf8 100644
--- a/src/libgcnmultiboot.s
+++ b/src/libgcnmultiboot.s
@@ -22,7 +22,7 @@ GameCubeMultiBoot_Hash: @ 82DED70
movs r2, 0x20
GameCubeMultiBoot_Hash_Loop:
- lsrs r3, 1
+ lsrs r3, #1
bcc GameCubeMultiBoot_Hash_SkipEor
eors r3, r4
@@ -37,8 +37,8 @@ GameCubeMultiBoot_Hash_SkipEor:
thumb_func_start GameCubeMultiBoot_Main
@ void GameCubeMultiBoot_Main(struct GameCubeMultiBoot *mb);
GameCubeMultiBoot_Main: @ 82DED84
- ldr r1, [r0, GCMB_STRUCT_SERIAL_INTR_HANDLER]
- cmp r1, 0
+ ldr r1, [r0, #GCMB_STRUCT_SERIAL_INTR_HANDLER]
+ cmp r1, #0
beq _082DEDAA
ldrb r1, [r0, 0x1]
adds r1, 0x1
@@ -47,30 +47,30 @@ GameCubeMultiBoot_Main: @ 82DED84
cmp r1, 0x2
beq _082DEDF4
ldr r3, pool_InterruptRegs
- ldrh r2, [r3, OFFSET_REG_IME - 0x200]
+ ldrh r2, [r3, #OFFSET_REG_IME - 0x200]
movs r1, 0
- strh r1, [r3, OFFSET_REG_IME - 0x200]
+ strh r1, [r3, #OFFSET_REG_IME - 0x200]
ldrb r1, [r0]
cmp r1, 0xA
bgt _082DEDA8
adds r1, 0x1
strb r1, [r0]
_082DEDA8:
- strh r2, [r3, OFFSET_REG_IME - 0x200]
+ strh r2, [r3, #OFFSET_REG_IME - 0x200]
_082DEDAA:
bcs GameCubeMultiBoot_Init
ldrb r1, [r0, 0x2]
cmp r1, 0
bne _082DEDF6
- ldr r1, [r0, GCMB_STRUCT_CUR_DEST_PTR]
- ldr r2, [r0, GCMB_STRUCT_BASE_DEST_PTR]
+ ldr r1, [r0, #GCMB_STRUCT_CUR_DEST_PTR]
+ ldr r2, [r0, #GCMB_STRUCT_BASE_DEST_PTR]
subs r1, r2
beq _082DEE76
cmp r1, 0xA0
bcc _082DEE76
push {r4-r6}
movs r1, 0x98
- adds r2, ROM_HEADER_NINTENDO_LOGO_OFFSET
+ adds r2, #ROM_HEADER_NINTENDO_LOGO_OFFSET
ldr r4, pool_NintendoLogo
_082DEDC6:
ldm r2!, {r5}
@@ -82,8 +82,8 @@ _082DEDC6:
ldm r2!, {r5}
ldm r4!, {r6}
eors r5, r6
- lsrs r5, 8
- str r2, [r0, GCMB_STRUCT_BASE_DEST_PTR]
+ lsrs r5, #8
+ str r2, [r0, #GCMB_STRUCT_BASE_DEST_PTR]
_082DEDDC:
pop {r4-r6}
bne GameCubeMultiBoot_Init
@@ -100,11 +100,11 @@ _082DEDDC:
_082DEDF4:
bx lr
_082DEDF6:
- ldr r1, [r0, GCMB_STRUCT_CUR_DEST_PTR]
+ ldr r1, [r0, #GCMB_STRUCT_CUR_DEST_PTR]
mov r12, r1
ldr r3, [r0, 0x18]
push {r4-r7}
- ldr r4, [r0, GCMB_STRUCT_BASE_DEST_PTR]
+ ldr r4, [r0, #GCMB_STRUCT_BASE_DEST_PTR]
ldr r5, pool_Kawa
ldr r6, [r0, 0x14]
ldr r7, pool_HashVal
@@ -118,7 +118,7 @@ _082DEE06:
eors r3, r1
movs r2, 0x20
_082DEE16:
- lsrs r3, 1
+ lsrs r3, #1
bcc _082DEE1C
eors r3, r7
_082DEE1C:
@@ -128,22 +128,22 @@ _082DEE1C:
adds r6, 0x1
b _082DEE06
_082DEE26:
- str r4, [r0, GCMB_STRUCT_BASE_DEST_PTR]
+ str r4, [r0, #GCMB_STRUCT_BASE_DEST_PTR]
str r6, [r0, 0x14]
pop {r4-r7}
str r3, [r0, 0x18]
ldrh r1, [r0, 0x12]
- cmp r1, 0
+ cmp r1, #0
bne _082DEE76
- ldr r1, [r0, GCMB_STRUCT_CUR_DEST_PTR]
- ldr r2, [r0, GCMB_STRUCT_BASE_DEST_PTR]
+ ldr r1, [r0, #GCMB_STRUCT_CUR_DEST_PTR]
+ ldr r2, [r0, #GCMB_STRUCT_BASE_DEST_PTR]
cmp r1, r2
bne _082DEE76
ldr r1, [r0, 0xC]
- cmp r1, 0
+ cmp r1, #0
beq _082DEE60
ldrh r1, [r0, 0x10]
- cmp r1, 0
+ cmp r1, #0
beq _082DEDF4
mov r12, lr
movs r1, 0xBB
@@ -159,11 +159,11 @@ _082DEE26:
_082DEE60:
mov r12, lr
ldrb r1, [r0, 0x3]
- lsls r1, 24
+ lsls r1, #24
subs r1, 0x1
str r1, [r0, 0xC]
bl GameCubeMultiBoot_Hash
- lsls r3, 8
+ lsls r3, #8
adds r3, 0xFF
str r3, [r0, 0x1C]
bx r12
@@ -186,8 +186,8 @@ GameCubeMultiBoot_ExecuteProgram: @ 82DEE84
cmp r1, 0x2
bne GameCubeMultiBoot_ExecuteProgram_Fail
ldr r3, pool_InterruptRegs
- movs r1, 0
- strh r1, [r3, OFFSET_REG_IME - 0x200]
+ movs r1, #0
+ strh r1, [r3, #OFFSET_REG_IME - 0x200]
ldr r1, pool_MultiBootLoadAddr
adds r1, 0xC0
bx r1
@@ -201,25 +201,25 @@ GameCubeMultiBoot_Init: @ 82DEE98
ldr r3, pool_InterruptRegs
@ Save IME register.
- ldrh r2, [r3, OFFSET_REG_IME - 0x200]
+ ldrh r2, [r3, #OFFSET_REG_IME - 0x200]
@ Disable interrupts.
movs r1, 0
- strh r1, [r3, OFFSET_REG_IME - 0x200]
+ strh r1, [r3, #OFFSET_REG_IME - 0x200]
@ Set the handler to the "Stop" routine.
@ Unless the first command that is received is a device reset command, the
@ "Stop" routine will be executed and no further commands will be processed.
adr r3, GcMbIntrHandler_Stop
- str r3, [r0, GCMB_STRUCT_SERIAL_INTR_HANDLER]
+ str r3, [r0, #GCMB_STRUCT_SERIAL_INTR_HANDLER]
ldrb r3, [r0, 0x3]
push {r3}
ldrb r3, [r0, 0x1]
push {r0,r3}
- adds r3, r0, 0
- adds r3, GCMB_STRUCT_BASE_DEST_PTR
+ adds r3, r0, #0
+ adds r3, #GCMB_STRUCT_BASE_DEST_PTR
@ clear all but the last 3 fields of the struct
GameCubeMultiBoot_Init_ClearStructLoop:
@@ -261,7 +261,7 @@ GameCubeMultiBoot_Init_ClearStructLoop:
strh r1, [r3, OFFSET_REG_IE - 0x200]
@ Restore IME register.
- strh r2, [r3, OFFSET_REG_IME - 0x200]
+ strh r2, [r3, #OFFSET_REG_IME - 0x200]
bx lr
thumb_func_end GameCubeMultiBoot_Init
@@ -275,11 +275,11 @@ GameCubeMultiBoot_HandleSerialInterrupt: @ 82DEEE2
ldrh r1, [r3, OFFSET_REG_JOYCNT - 0x120]
strh r1, [r3, OFFSET_REG_JOYCNT - 0x120]
- movs r2, 0
+ movs r2, #0
strb r2, [r0]
- ldr r2, [r0, GCMB_STRUCT_SERIAL_INTR_HANDLER]
- cmp r2, 0
+ ldr r2, [r0, #GCMB_STRUCT_SERIAL_INTR_HANDLER]
+ cmp r2, #0
beq GameCubeMultiBoot_HandleSerialInterruptDone
lsrs r1, 1 @ was a device reset command received?
@@ -297,7 +297,7 @@ GcMbIntrHandler_Stop:
strh r2, [r3, OFFSET_REG_JOYSTAT - 0x120]
GameCubeMultiBoot_SetInterruptHandler:
- str r2, [r0, GCMB_STRUCT_SERIAL_INTR_HANDLER]
+ str r2, [r0, #GCMB_STRUCT_SERIAL_INTR_HANDLER]
GameCubeMultiBoot_ReadVCount:
ldr r3, pool_RegDispstat
@@ -319,8 +319,8 @@ GameCubeMultiBoot_BeginHandshake:
cmp r1, 0
bne GcMbIntrHandler_Stop
ldr r1, pool_MultiBootLoadAddr
- str r1, [r0, GCMB_STRUCT_BASE_DEST_PTR]
- str r1, [r0, GCMB_STRUCT_CUR_DEST_PTR]
+ str r1, [r0, #GCMB_STRUCT_BASE_DEST_PTR]
+ str r1, [r0, #GCMB_STRUCT_CUR_DEST_PTR]
adr r2, GcMbIntrHandler_CheckGameCodeSent
b GameCubeMultiBoot_SetInterruptHandler
@@ -417,8 +417,8 @@ _082DEF94:
_082DEFA6:
bne GcMbIntrHandler_Stop
ldr r1, pool_MultiBootLoadAddr
- str r1, [r0, GCMB_STRUCT_BASE_DEST_PTR]
- str r1, [r0, GCMB_STRUCT_CUR_DEST_PTR]
+ str r1, [r0, #GCMB_STRUCT_BASE_DEST_PTR]
+ str r1, [r0, #GCMB_STRUCT_CUR_DEST_PTR]
adr r2, GcMbIntrHandler_82DEFB4
b GameCubeMultiBoot_SetInterruptHandler
@@ -427,7 +427,7 @@ _082DEFA6:
GcMbIntrHandler_82DEFB4: @ 82DEFB4
lsrs r1, 1 @ is receive complete?
bcc GcMbIntrHandler_Stop @ branch if not
- ldr r2, [r0, GCMB_STRUCT_CUR_DEST_PTR]
+ ldr r2, [r0, #GCMB_STRUCT_CUR_DEST_PTR]
movs r1, 0x4
ands r1, r2
adds r1, 0x8
@@ -435,7 +435,7 @@ GcMbIntrHandler_82DEFB4: @ 82DEFB4
strh r1, [r3, OFFSET_REG_JOYSTAT - 0x120]
ldr r1, [r3, OFFSET_REG_JOY_RECV - 0x120]
stm r2!, {r1}
- str r2, [r0, GCMB_STRUCT_CUR_DEST_PTR]
+ str r2, [r0, #GCMB_STRUCT_CUR_DEST_PTR]
ldrh r1, [r0, 0x12]
subs r1, 0x1
strh r1, [r0, 0x12]
@@ -500,11 +500,11 @@ GameCubeMultiBoot_Quit: @ 82DF012
ldr r3, pool_InterruptRegs
@ Save IME register.
- ldrh r2, [r3, OFFSET_REG_IME - 0x200]
+ ldrh r2, [r3, #OFFSET_REG_IME - 0x200]
@ Disable interrupts.
movs r1, 0
- strh r1, [r3, OFFSET_REG_IME - 0x200]
+ strh r1, [r3, #OFFSET_REG_IME - 0x200]
ldr r3, pool_SerialRegs
@@ -528,7 +528,7 @@ GameCubeMultiBoot_Quit: @ 82DF012
strh r1, [r3, OFFSET_REG_IE - 0x200]
@ Restore IME register.
- strh r2, [r3, OFFSET_REG_IME - 0x200]
+ strh r2, [r3, #OFFSET_REG_IME - 0x200]
bx lr
thumb_func_end GameCubeMultiBoot_Quit
diff --git a/src/librfu_rfu.c b/src/librfu_rfu.c
index 3f5bd8b69..fe1d10834 100644
--- a/src/librfu_rfu.c
+++ b/src/librfu_rfu.c
@@ -488,7 +488,7 @@ static void rfu_CB_configGameData(u8 reqCommand, u16 reqResult)
for (i = 0; i < RFU_GAME_NAME_LENGTH; ++i)
gRfuLinkStatus->my.gname[i] = *gname_uname_p++;
++gname_uname_p;
- for (i = 0; i < RFU_USER_NAME_LENGTH; ++i)
+ for (i = 0; i < PLAYER_NAME_LENGTH + 1; ++i)
gRfuLinkStatus->my.uname[i] = *gname_uname_p++;
}
rfu_STC_REQ_callback(reqCommand, reqResult);
@@ -718,7 +718,7 @@ static void rfu_STC_readParentCandidateList(void)
for (j = 0; j < RFU_GAME_NAME_LENGTH; ++j)
target->gname[j] = *packet_p++;
++packet_p;
- for (j = 0; j < RFU_USER_NAME_LENGTH; ++j)
+ for (j = 0; j < PLAYER_NAME_LENGTH + 1; ++j)
target->uname[j] = *packet_p++;
++gRfuLinkStatus->findParentCount;
}
diff --git a/src/link.c b/src/link.c
index aed1afe30..e04e5e29d 100644
--- a/src/link.c
+++ b/src/link.c
@@ -1,5 +1,3 @@
-
-// Includes
#include "global.h"
#include "m4a.h"
#include "malloc.h"
@@ -30,10 +28,6 @@
#include "constants/rgb.h"
#include "constants/trade.h"
-extern u16 gHeldKeyCodeToSend;
-
-// Static type declarations
-
struct BlockTransfer
{
u16 pos;
@@ -51,15 +45,13 @@ struct LinkTestBGInfo
u32 dummy_C;
};
-// Static RAM declarations
-
static struct BlockTransfer sBlockSend;
static struct BlockTransfer sBlockRecv[MAX_LINK_PLAYERS];
static u32 sBlockSendDelayCounter;
-static u32 gUnknown_03000D54;
-static u8 gUnknown_03000D58;
+static bool32 sDummy1; // Never read
+static bool8 sDummy2; // Never assigned, read in unused function
static u32 sPlayerDataExchangeStatus;
-static u32 gUnknown_03000D60;
+static bool32 sDummy3; // Never read
static u8 sLinkTestLastBlockSendPos;
static u8 sLinkTestLastBlockRecvPos[MAX_LINK_PLAYERS];
static u8 sNumVBlanksWithoutSerialIntr;
@@ -74,15 +66,15 @@ u32 gLinkDebugSeed;
struct LinkPlayerBlock gLocalLinkPlayerBlock;
bool8 gLinkErrorOccurred;
u32 gLinkDebugFlags;
-u32 gFiller_03003074;
+u32 gLinkFiller1;
bool8 gRemoteLinkPlayersNotReceived[MAX_LINK_PLAYERS];
u8 gBlockReceivedStatus[MAX_LINK_PLAYERS];
-u32 gFiller_03003080;
+u32 gLinkFiller2;
u16 gLinkHeldKeys;
u16 gRecvCmds[MAX_RFU_PLAYERS][CMD_LENGTH];
u32 gLinkStatus;
-bool8 gUnknown_030030E4;
-bool8 gUnknown_030030E8;
+bool8 gLinkDummy1; // Never read
+bool8 gLinkDummy2; // Never read
bool8 gUnknown_030030EC[MAX_LINK_PLAYERS];
bool8 gUnknown_030030F0[MAX_LINK_PLAYERS];
u16 gUnknown_030030F4;
@@ -97,15 +89,13 @@ void (*gLinkCallback)(void);
u8 gShouldAdvanceLinkState;
u16 gLinkTestBlockChecksums[MAX_LINK_PLAYERS];
u8 gBlockRequestType;
-u32 gFiller_03003154;
-u32 gFiller_03003158;
-u32 gFiller_0300315c;
+u32 gLinkFiller3;
+u32 gLinkFiller4;
+u32 gLinkFiller5;
u8 gLastSendQueueCount;
struct Link gLink;
u8 gLastRecvQueueCount;
u16 gLinkSavedIme;
-u32 gFiller_03004138;
-u32 gFiller_0300413C;
EWRAM_DATA u8 gLinkTestDebugValuesEnabled = 0;
EWRAM_DATA u8 gUnknown_020223BD = 0;
@@ -124,16 +114,16 @@ EWRAM_DATA struct {
u8 lastSendQueueCount;
u8 unk_06;
} sLinkErrorBuffer = {};
-EWRAM_DATA u16 gUnknown_02022B08 = 0;
-EWRAM_DATA void *gUnknown_02022B0C = NULL;
+static EWRAM_DATA u16 sUnknown_02022B08 = 0;
+static EWRAM_DATA void *sLinkErrorBgTilemapBuffer = NULL;
// Static ROM declarations
static void InitLocalLinkPlayer(void);
-static void sub_80096BC(void);
+static void VBlankCB_LinkError(void);
static void CB2_LinkTest(void);
static void ProcessRecvCmds(u8 unused);
-static void sub_8009F70(void);
+static void LinkCB_SendHeldKeys(void);
static void ResetBlockSend(void);
static bool32 InitBlockSend(const void *src, size_t size);
static void LinkCB_BlockSendBegin(void);
@@ -155,7 +145,7 @@ static void sub_800AE5C(void);
static void CheckErrorStatus(void);
static void CB2_PrintErrorMessage(void);
static bool8 IsSioMultiMaster(void);
-static void sub_800B4A4(void);
+static void SetWirelessCommType0_Internal(void);
static void DisableSerial(void);
static void EnableSerial(void);
static void CheckMasterOrSlave(void);
@@ -172,29 +162,29 @@ static void SendRecvDone(void);
// .rodata
-ALIGNED(4) const u16 gWirelessLinkDisplayPal[] = INCBIN_U16("graphics/interface/wireless_link_display.gbapal");
-const u32 gWirelessLinkDisplayGfx[] = INCBIN_U32("graphics/interface/wireless_link_display.4bpp.lz");
-const u32 gWirelessLinkDisplayTilemap[] = INCBIN_U32("graphics/interface/wireless_link_display.bin.lz");
-const u16 gLinkTestDigitsPal[] = INCBIN_U16("graphics/interface/link_test_digits.gbapal");
-const u16 gLinkTestDigitsGfx[] = INCBIN_U16("graphics/interface/link_test_digits.4bpp");
-const u8 unkstring_82ed160[] = _("{HIGHLIGHT TRANSPARENT}{COLOR WHITE}");
-const u16 g2BlankTilesGfx[] = INCBIN_U16("graphics/interface/blank_1x2.4bpp");
-const struct BlockRequest gUnknown_082ED1A8[] = {
+static const u16 sWirelessLinkDisplayPal[] = INCBIN_U16("graphics/interface/wireless_link_display.gbapal");
+static const u32 sWirelessLinkDisplayGfx[] = INCBIN_U32("graphics/interface/wireless_link_display.4bpp.lz");
+static const u32 sWirelessLinkDisplayTilemap[] = INCBIN_U32("graphics/interface/wireless_link_display.bin.lz");
+static const u16 sLinkTestDigitsPal[] = INCBIN_U16("graphics/interface/link_test_digits.gbapal");
+static const u16 sLinkTestDigitsGfx[] = INCBIN_U16("graphics/interface/link_test_digits.4bpp");
+static const u8 sUnusedTransparentWhite[] = _("{HIGHLIGHT TRANSPARENT}{COLOR WHITE}");
+static const u16 s2BlankTilesGfx[] = INCBIN_U16("graphics/interface/blank_1x2.4bpp");
+static const struct BlockRequest sBlockRequests[] = {
{gBlockSendBuffer, 200},
{gBlockSendBuffer, 200},
{gBlockSendBuffer, 100},
{gBlockSendBuffer, 220},
{gBlockSendBuffer, 40}
};
-const u8 gBGControlRegs[] = {
+static const u8 sBGControlRegs[] = {
REG_OFFSET_BG0CNT,
REG_OFFSET_BG1CNT,
REG_OFFSET_BG2CNT,
REG_OFFSET_BG3CNT
};
-const char gASCIIGameFreakInc[] = "GameFreak inc.";
-const char gASCIITestPrint[] = "TEST PRINT\nP0\nP1\nP2\nP3";
-const struct BgTemplate gUnknown_082ED1FC[] = {
+static const char sASCIIGameFreakInc[] = "GameFreak inc.";
+static const char sASCIITestPrint[] = "TEST PRINT\nP0\nP1\nP2\nP3";
+static const struct BgTemplate sLinkErrorBgTemplates[] = {
{
.bg = 0,
.charBaseIndex = 2,
@@ -207,29 +197,50 @@ const struct BgTemplate gUnknown_082ED1FC[] = {
.priority = 1
}
};
-const struct WindowTemplate gUnknown_082ED204[] = {
- {0x00, 0x00, 0x00, 0x1E, 0x05, 0x0F, 0x0002},
- {0x00, 0x00, 0x06, 0x1E, 0x07, 0x0F, 0x0098},
- {0x00, 0x00, 0x0D, 0x1E, 0x07, 0x0F, 0x016A},
- DUMMY_WIN_TEMPLATE
+static const struct WindowTemplate sLinkErrorWindowTemplates[] = {
+ {
+ .bg = 0,
+ .tilemapLeft = 0,
+ .tilemapTop = 0,
+ .width = 30,
+ .height = 5,
+ .paletteNum = 15,
+ .baseBlock = 0x002
+ }, {
+ .bg = 0,
+ .tilemapLeft = 0,
+ .tilemapTop = 6,
+ .width = 30,
+ .height = 7,
+ .paletteNum = 15,
+ .baseBlock = 0x098
+ }, {
+ .bg = 0,
+ .tilemapLeft = 0,
+ .tilemapTop = 13,
+ .width = 30,
+ .height = 7,
+ .paletteNum = 15,
+ .baseBlock = 0x16A
+ }, DUMMY_WIN_TEMPLATE
};
static const u8 sTextColors[] = { TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY };
-static const u8 sUnused_082ED224[] = {0x00, 0xff, 0xfe, 0xff, 0x00};
+static const u8 sUnused_082ED224[] = {0x00, 0xFF, 0xFE, 0xFF, 0x00};
// .text
bool8 IsWirelessAdapterConnected(void)
{
- sub_800B488();
- sub_800E700();
+ SetWirelessCommType1();
+ InitRFUAPI();
if (rfu_LMAN_REQBN_softReset_and_checkID() == 0x8001)
{
rfu_REQ_stopMode();
rfu_waitREQComplete();
return TRUE;
}
- sub_800B4A4();
+ SetWirelessCommType0_Internal();
CloseLink();
RestoreSerialTimer3IntrHandlers();
return FALSE;
@@ -242,8 +253,8 @@ void Task_DestroySelf(u8 taskId)
static void InitLinkTestBG(u8 paletteNum, u8 bgNum, u8 screenBaseBlock, u8 charBaseBlock, u16 a4)
{
- LoadPalette(gLinkTestDigitsPal, paletteNum * 16, 0x20);
- DmaCopy16(3, gLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(charBaseBlock) + (16 * a4), sizeof gLinkTestDigitsGfx);
+ LoadPalette(sLinkTestDigitsPal, paletteNum * 16, 0x20);
+ DmaCopy16(3, sLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(charBaseBlock) + (16 * a4), sizeof sLinkTestDigitsGfx);
gLinkTestBGInfo.screenBaseBlock = screenBaseBlock;
gLinkTestBGInfo.paletteNum = paletteNum;
gLinkTestBGInfo.dummy_8 = a4;
@@ -265,12 +276,12 @@ static void InitLinkTestBG(u8 paletteNum, u8 bgNum, u8 screenBaseBlock, u8 charB
void sub_80094EC(u8 paletteNum, u8 bgNum, u8 screenBaseBlock, u8 charBaseBlock)
{
- LoadPalette(gLinkTestDigitsPal, paletteNum * 16, 0x20);
- DmaCopy16(3, gLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(charBaseBlock), sizeof gLinkTestDigitsGfx);
+ LoadPalette(sLinkTestDigitsPal, paletteNum * 16, 0x20);
+ DmaCopy16(3, sLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(charBaseBlock), sizeof sLinkTestDigitsGfx);
gLinkTestBGInfo.screenBaseBlock = screenBaseBlock;
gLinkTestBGInfo.paletteNum = paletteNum;
gLinkTestBGInfo.dummy_8 = 0;
- SetGpuReg(gBGControlRegs[bgNum], BGCNT_SCREENBASE(screenBaseBlock) | BGCNT_CHARBASE(charBaseBlock));
+ SetGpuReg(sBGControlRegs[bgNum], BGCNT_SCREENBASE(screenBaseBlock) | BGCNT_CHARBASE(charBaseBlock));
}
void LinkTestScreen(void)
@@ -280,9 +291,9 @@ void LinkTestScreen(void)
ResetSpriteData();
FreeAllSpritePalettes();
ResetTasks();
- SetVBlankCallback(sub_80096BC);
+ SetVBlankCallback(VBlankCB_LinkError);
ResetBlockSend();
- gLinkType = LINKTYPE_0x1111;
+ gLinkType = LINKTYPE_TRADE;
OpenLink();
SeedRng(gMain.vblankCounter2);
for (i = 0; i < MAX_LINK_PLAYERS; i++)
@@ -296,7 +307,7 @@ void LinkTestScreen(void)
AnimateSprites();
BuildOamBuffer();
UpdatePaletteFade();
- gUnknown_03000D60 = 0;
+ sDummy3 = FALSE;
InitLocalLinkPlayer();
CreateTask(Task_PrintTestData, 0);
SetMainCallback2(CB2_LinkTest);
@@ -323,7 +334,7 @@ static void InitLocalLinkPlayer(void)
}
}
-static void sub_80096BC(void)
+static void VBlankCB_LinkError(void)
{
LoadOam();
ProcessSpriteCopyRequests();
@@ -334,9 +345,9 @@ static void InitLink(void)
{
int i;
- for (i = 0; i < 8; i++)
+ for (i = 0; i < CMD_LENGTH; i++)
{
- gSendCmd[i] = 0xefff;
+ gSendCmd[i] = 0xEfff;
}
gLinkOpen = TRUE;
EnableSerial();
@@ -365,15 +376,15 @@ void OpenLink(void)
gSuppressLinkErrorMessage = FALSE;
ResetBlockReceivedFlags();
ResetBlockSend();
- gUnknown_03000D54 = 0;
- gUnknown_030030E8 = FALSE;
- gUnknown_030030E4 = FALSE;
+ sDummy1 = FALSE;
+ gLinkDummy2 = FALSE;
+ gLinkDummy1 = FALSE;
gUnknown_030030F4 = 0;
CreateTask(Task_TriggerHandshake, 2);
}
else
{
- sub_800E700();
+ InitRFUAPI();
}
gReceivedRemoteLinkPlayers = 0;
for (i = 0; i < MAX_LINK_PLAYERS; i++)
@@ -389,7 +400,7 @@ void CloseLink(void)
gReceivedRemoteLinkPlayers = FALSE;
if (gWirelessCommType)
{
- sub_800EDD4();
+ LinkRfu_Shutdown();
}
gLinkOpen = FALSE;
DisableSerial();
@@ -482,7 +493,7 @@ u16 LinkMain2(const u16 *heldKeys)
{
return 0;
}
- for (i = 0; i < 8; i++)
+ for (i = 0; i < CMD_LENGTH; i++)
{
gSendCmd[i] = 0;
}
@@ -536,8 +547,8 @@ static void ProcessRecvCmds(u8 unused)
InitLocalLinkPlayer();
block = &gLocalLinkPlayerBlock;
block->linkPlayer = gLocalLinkPlayer;
- memcpy(block->magic1, gASCIIGameFreakInc, sizeof(block->magic1) - 1);
- memcpy(block->magic2, gASCIIGameFreakInc, sizeof(block->magic2) - 1);
+ memcpy(block->magic1, sASCIIGameFreakInc, sizeof(block->magic1) - 1);
+ memcpy(block->magic2, sASCIIGameFreakInc, sizeof(block->magic2) - 1);
InitBlockSend(block, sizeof(*block));
break;
}
@@ -545,10 +556,10 @@ static void ProcessRecvCmds(u8 unused)
gLinkPartnersHeldKeys[i] = gRecvCmds[i][1];
break;
case LINKCMD_0x5555:
- gUnknown_030030E8 = TRUE;
+ gLinkDummy2 = TRUE;
break;
case LINKCMD_0x5566:
- gUnknown_030030E8 = TRUE;
+ gLinkDummy2 = TRUE;
break;
case LINKCMD_INIT_BLOCK:
{
@@ -602,8 +613,8 @@ static void ProcessRecvCmds(u8 unused)
linkPlayer->progressFlags = 0;
}
sub_800B524(linkPlayer);
- if (strcmp(block->magic1, gASCIIGameFreakInc) != 0
- || strcmp(block->magic2, gASCIIGameFreakInc) != 0)
+ if (strcmp(block->magic1, sASCIIGameFreakInc) != 0
+ || strcmp(block->magic2, sASCIIGameFreakInc) != 0)
{
SetMainCallback2(CB2_LinkError);
}
@@ -629,7 +640,7 @@ static void ProcessRecvCmds(u8 unused)
sub_800A418();
break;
case LINKCMD_0xCCCC:
- SendBlock(0, gUnknown_082ED1A8[gRecvCmds[i][1]].address, gUnknown_082ED1A8[gRecvCmds[i][1]].size);
+ SendBlock(0, sBlockRequests[gRecvCmds[i][1]].address, sBlockRequests[gRecvCmds[i][1]].size);
break;
case LINKCMD_SEND_HELD_KEYS_2:
gLinkPartnersHeldKeys[i] = gRecvCmds[i][1];
@@ -705,70 +716,56 @@ static void BuildSendCmd(u16 command)
}
}
-void sub_8009F18(void)
+void StartSendingKeysToLink(void)
{
if (gWirelessCommType)
- {
- sub_800F804();
- }
- gLinkCallback = sub_8009F70;
+ StartSendingKeysToRfu();
+
+ gLinkCallback = LinkCB_SendHeldKeys;
}
bool32 IsSendingKeysToLink(void)
{
if (gWirelessCommType)
- {
return IsSendingKeysToRfu();
- }
- if (gLinkCallback == sub_8009F70)
- {
+
+ if (gLinkCallback == LinkCB_SendHeldKeys)
return TRUE;
- }
+
return FALSE;
}
-static void sub_8009F70(void)
+static void LinkCB_SendHeldKeys(void)
{
if (gReceivedRemoteLinkPlayers == TRUE)
- {
BuildSendCmd(LINKCMD_SEND_HELD_KEYS_2);
- }
}
void ClearLinkCallback(void)
{
if (gWirelessCommType)
- {
ClearLinkRfuCallback();
- }
else
- {
gLinkCallback = NULL;
- }
}
void ClearLinkCallback_2(void)
{
if (gWirelessCommType)
- {
ClearLinkRfuCallback();
- }
else
- {
gLinkCallback = NULL;
- }
}
u8 GetLinkPlayerCount(void)
{
if (gWirelessCommType)
- {
- return sub_80104F4();
- }
+ return Rfu_GetLinkPlayerCount();
+
return EXTRACT_PLAYER_COUNT(gLinkStatus);
}
-static int sub_8009FF8(u32 version1, u32 version2)
+static int AreAnyLinkPlayersUsingVersions(u32 version1, u32 version2)
{
int i;
u8 nPlayers;
@@ -776,22 +773,22 @@ static int sub_8009FF8(u32 version1, u32 version2)
nPlayers = GetLinkPlayerCount();
for (i = 0; i < nPlayers; i++)
{
- if ((gLinkPlayers[i].version & 0xFF) == version1 || (gLinkPlayers[i].version & 0xFF) == version2)
- {
+ if ((gLinkPlayers[i].version & 0xFF) == version1
+ || (gLinkPlayers[i].version & 0xFF) == version2)
return 1;
- }
}
return -1;
}
-u32 sub_800A03C(void)
+u32 LinkDummy_Return2(void)
{
return 2;
}
-bool32 sub_800A040(void)
+// Unused
+static bool32 IsFullLinkGroupWithNoRS(void)
{
- if (GetLinkPlayerCount() != 4 || sub_8009FF8(VERSION_RUBY, VERSION_SAPPHIRE) < 0)
+ if (GetLinkPlayerCount() != MAX_LINK_PLAYERS || AreAnyLinkPlayersUsingVersions(VERSION_RUBY, VERSION_SAPPHIRE) < 0)
{
return FALSE;
}
@@ -800,18 +797,18 @@ bool32 sub_800A040(void)
bool32 Link_AnyPartnersPlayingRubyOrSapphire(void)
{
- if (sub_8009FF8(VERSION_RUBY, VERSION_SAPPHIRE) >= 0)
+ if (AreAnyLinkPlayersUsingVersions(VERSION_RUBY, VERSION_SAPPHIRE) >= 0)
{
return TRUE;
}
return FALSE;
}
-bool32 sub_800A07C(void)
+bool32 Link_AnyPartnersPlayingFRLG_JP(void)
{
int i;
- i = sub_8009FF8(VERSION_FIRE_RED, VERSION_LEAF_GREEN);
+ i = AreAnyLinkPlayersUsingVersions(VERSION_FIRE_RED, VERSION_LEAF_GREEN);
if (i >= 0 && gLinkPlayers[i].language == LANGUAGE_JAPANESE)
{
return TRUE;
@@ -826,23 +823,23 @@ void OpenLinkTimed(void)
OpenLink();
}
-u8 GetLinkPlayerDataExchangeStatusTimed(int lower, int upper)
+u8 GetLinkPlayerDataExchangeStatusTimed(int minPlayers, int maxPlayers)
{
int i;
int count;
u32 index;
- u8 cmpVal;
+ u8 numPlayers;
u32 linkType1;
u32 linkType2;
count = 0;
if (gReceivedRemoteLinkPlayers == TRUE)
{
- cmpVal = GetLinkPlayerCount_2();
- if (lower > cmpVal || cmpVal > upper)
+ numPlayers = GetLinkPlayerCount_2();
+ if (minPlayers > numPlayers || numPlayers > maxPlayers)
{
- sPlayerDataExchangeStatus = EXCHANGE_STAT_6;
- return 6;
+ sPlayerDataExchangeStatus = EXCHANGE_WRONG_NUM_PLAYERS;
+ return sPlayerDataExchangeStatus;
}
else
{
@@ -860,19 +857,19 @@ u8 GetLinkPlayerDataExchangeStatusTimed(int lower, int upper)
}
if (count == GetLinkPlayerCount())
{
- if (gLinkPlayers[0].linkType == 0x1133)
+ if (gLinkPlayers[0].linkType == LINKTYPE_TRADE_SETUP)
{
switch (GetGameProgressForLinkTrade())
{
- case TRADE_PLAYER_NOT_READY:
- sPlayerDataExchangeStatus = EXCHANGE_PLAYER_NOT_READY;
- break;
- case TRADE_PARTNER_NOT_READY:
- sPlayerDataExchangeStatus = EXCHANGE_PARTNER_NOT_READY;
- break;
- case TRADE_BOTH_PLAYERS_READY:
- sPlayerDataExchangeStatus = EXCHANGE_COMPLETE;
- break;
+ case TRADE_PLAYER_NOT_READY:
+ sPlayerDataExchangeStatus = EXCHANGE_PLAYER_NOT_READY;
+ break;
+ case TRADE_PARTNER_NOT_READY:
+ sPlayerDataExchangeStatus = EXCHANGE_PARTNER_NOT_READY;
+ break;
+ case TRADE_BOTH_PLAYERS_READY:
+ sPlayerDataExchangeStatus = EXCHANGE_COMPLETE;
+ break;
}
}
else
@@ -882,11 +879,14 @@ u8 GetLinkPlayerDataExchangeStatusTimed(int lower, int upper)
}
else
{
- sPlayerDataExchangeStatus = EXCHANGE_IN_PROGRESS;
+ sPlayerDataExchangeStatus = EXCHANGE_DIFF_SELECTIONS;
linkType1 = gLinkPlayers[GetMultiplayerId()].linkType;
linkType2 = gLinkPlayers[GetMultiplayerId() ^ 1].linkType;
- if ((linkType1 == 0x2266 && linkType2 == 0x2277) || (linkType1 == 0x2277 && linkType2 == 0x2266))
+ if ((linkType1 == LINKTYPE_BATTLE_TOWER_50 && linkType2 == LINKTYPE_BATTLE_TOWER_OPEN)
+ || (linkType1 == LINKTYPE_BATTLE_TOWER_OPEN && linkType2 == LINKTYPE_BATTLE_TOWER_50))
{
+ // 3 below indicates partner made different level mode selection
+ // See BattleFrontier_BattleTowerLobby_EventScript_AbortLinkDifferentSelections
gSpecialVar_0x8005 = 3;
}
}
@@ -921,7 +921,7 @@ bool8 IsLinkPlayerDataExchangeComplete(void)
else
{
retval = FALSE;
- sPlayerDataExchangeStatus = EXCHANGE_IN_PROGRESS;
+ sPlayerDataExchangeStatus = EXCHANGE_DIFF_SELECTIONS;
}
return retval;
}
@@ -959,7 +959,7 @@ static bool32 InitBlockSend(const void *src, size_t size)
sBlockSend.active = TRUE;
sBlockSend.size = size;
sBlockSend.pos = 0;
- if (size > 0x100)
+ if (size > BLOCK_BUFFER_SIZE)
{
sBlockSend.src = src;
}
@@ -992,7 +992,7 @@ static void LinkCB_BlockSend(void)
src = sBlockSend.src;
gSendCmd[0] = LINKCMD_CONT_BLOCK;
- for (i = 0; i < 7; i++)
+ for (i = 0; i < CMD_LENGTH - 1; i++)
{
gSendCmd[i + 1] = (src[sBlockSend.pos + i * 2 + 1] << 8) | src[sBlockSend.pos + i * 2];
}
@@ -1043,7 +1043,7 @@ u8 GetMultiplayerId(void)
{
if (gWirelessCommType == TRUE)
{
- return rfu_get_multiplayer_id();
+ return Rfu_GetMultiplayerId();
}
return SIO_MULTI_CNT->id;
}
@@ -1060,7 +1060,7 @@ bool8 SendBlock(u8 unused, const void *src, u16 size)
{
if (gWirelessCommType == TRUE)
{
- return sub_800FE84(src, size);
+ return Rfu_InitBlockSend(src, size);
}
return InitBlockSend(src, size);
}
@@ -1093,7 +1093,7 @@ u8 GetBlockReceivedStatus(void)
{
if (gWirelessCommType == TRUE)
{
- return sub_800FCD8();
+ return Rfu_GetBlockReceivedStatus();
}
return (gBlockReceivedStatus[3] << 3) | (gBlockReceivedStatus[2] << 2) | (gBlockReceivedStatus[1] << 1) | (gBlockReceivedStatus[0] << 0);
}
@@ -1102,7 +1102,7 @@ static void SetBlockReceivedFlag(u8 who)
{
if (gWirelessCommType == TRUE)
{
- sub_800F6FC(who);
+ Rfu_SetBlockReceivedFlag(who);
}
else
{
@@ -1118,7 +1118,7 @@ void ResetBlockReceivedFlags(void)
{
for (i = 0; i < MAX_RFU_PLAYERS; i++)
{
- sub_800F728(i);
+ Rfu_ResetBlockReceivedFlag(i);
}
}
else
@@ -1134,7 +1134,7 @@ void ResetBlockReceivedFlag(u8 who)
{
if (gWirelessCommType == TRUE)
{
- sub_800F728(who);
+ Rfu_ResetBlockReceivedFlag(who);
}
else if (gBlockReceivedStatus[who])
{
@@ -1261,7 +1261,7 @@ static void Task_PrintTestData(u8 taskId)
char sp[32];
int i;
- strcpy(sp, gASCIITestPrint);
+ strcpy(sp, sASCIITestPrint);
LinkTest_prntstr(sp, 5, 2);
LinkTest_prnthex(gShouldAdvanceLinkState, 2, 1, 2);
LinkTest_prnthex(gLinkStatus, 15, 1, 8);
@@ -1289,7 +1289,7 @@ void SetLinkDebugValues(u32 seed, u32 flags)
gLinkDebugFlags = flags;
}
-u8 sub_800A9A8(void)
+u8 GetSavedLinkPlayerCountAsBitFlags(void)
{
int i;
u8 flags;
@@ -1302,7 +1302,7 @@ u8 sub_800A9A8(void)
return flags;
}
-u8 sub_800A9D8(void)
+u8 GetLinkPlayerCountAsBitFlags(void)
{
int i;
u8 flags;
@@ -1315,11 +1315,11 @@ u8 sub_800A9D8(void)
return flags;
}
-void sub_800AA04(u8 a0)
+void SaveLinkPlayers(u8 playerCount)
{
int i;
- gSavedLinkPlayerCount = a0;
+ gSavedLinkPlayerCount = playerCount;
gSavedMultiplayerId = GetMultiplayerId();
for (i = 0; i < MAX_RFU_PLAYERS; i++)
{
@@ -1334,17 +1334,17 @@ u8 GetSavedPlayerCount(void)
return gSavedLinkPlayerCount;
}
-u8 sub_800AA54(void)
+// Unused
+static u8 GetSavedMultiplayerId(void)
{
return gSavedMultiplayerId;
}
-bool8 sub_800AA60(void)
+bool8 DoesLinkPlayerCountMatchSaved(void)
{
int i;
- unsigned count;
+ u32 count = 0;
- count = 0;
for (i = 0; i < gSavedLinkPlayerCount; i++)
{
if (gLinkPlayers[i].trainerId == gSavedLinkPlayers[i].trainerId)
@@ -1352,9 +1352,7 @@ bool8 sub_800AA60(void)
if (gLinkType == LINKTYPE_BATTLE_TOWER)
{
if (gLinkType == gLinkPlayers[i].linkType)
- {
count++;
- }
}
else
{
@@ -1372,7 +1370,7 @@ bool8 sub_800AA60(void)
return FALSE;
}
-void sub_800AAF4(void)
+void ClearSavedLinkPlayers(void)
{
int i;
@@ -1383,13 +1381,14 @@ void sub_800AAF4(void)
}
}
-void sub_800AB18(void)
+void CheckLinkPlayersMatchSaved(void)
{
u8 i;
for (i = 0; i < gSavedLinkPlayerCount; i++)
{
- if (gSavedLinkPlayers[i].trainerId != gLinkPlayers[i].trainerId || StringCompare(gSavedLinkPlayers[i].name, gLinkPlayers[i].name) != 0)
+ if (gSavedLinkPlayers[i].trainerId != gLinkPlayers[i].trainerId
+ || StringCompare(gSavedLinkPlayers[i].name, gLinkPlayers[i].name) != 0)
{
gLinkErrorOccurred = TRUE;
CloseLink();
@@ -1418,9 +1417,10 @@ bool8 IsLinkMaster(void)
return EXTRACT_MASTER(gLinkStatus);
}
-u8 sub_800ABE8(void)
+// Unused
+static u8 GetDummy2(void)
{
- return gUnknown_03000D58;
+ return sDummy2;
}
void sub_800ABF4(u16 a0)
@@ -1434,7 +1434,7 @@ void sub_800ABF4(u16 a0)
if (gLinkCallback == NULL)
{
gLinkCallback = sub_800AC80;
- gUnknown_030030E4 = FALSE;
+ gLinkDummy1 = FALSE;
gUnknown_030030F4 = a0;
}
}
@@ -1450,12 +1450,12 @@ void sub_800AC34(void)
{
if (gLinkCallback != NULL)
{
- gUnknown_02022B08++;
+ sUnknown_02022B08++;
}
else
{
gLinkCallback = sub_800AC80;
- gUnknown_030030E4 = FALSE;
+ gLinkDummy1 = FALSE;
gUnknown_030030F4 = 0;
}
}
@@ -1491,7 +1491,7 @@ static void sub_800ACAC(void)
gLinkVSyncDisabled = TRUE;
CloseLink();
gLinkCallback = NULL;
- gUnknown_030030E4 = TRUE;
+ gLinkDummy1 = TRUE;
}
}
@@ -1505,12 +1505,12 @@ void sub_800AD10(void)
{
if (gLinkCallback != NULL)
{
- gUnknown_02022B08++;
+ sUnknown_02022B08++;
}
else
{
gLinkCallback = sub_800AD5C;
- gUnknown_030030E4 = FALSE;
+ gLinkDummy1 = FALSE;
gUnknown_030030F4 = 0;
}
}
@@ -1550,7 +1550,7 @@ static void sub_800AD88(void)
gLinkVSyncDisabled = TRUE;
CloseLink();
gLinkCallback = NULL;
- gUnknown_030030E4 = TRUE;
+ gLinkDummy1 = TRUE;
}
}
@@ -1566,7 +1566,7 @@ void sub_800ADF8(void)
{
gLinkCallback = sub_800AE30;
}
- gUnknown_030030E4 = FALSE;
+ gLinkDummy1 = FALSE;
}
}
@@ -1618,7 +1618,7 @@ static void CheckErrorStatus(void)
}
}
-void sub_800AF18(u32 status, u8 lastSendQueueCount, u8 lastRecvQueueCount, u8 unk_06)
+void BufferLinkErrorInfo(u32 status, u8 lastSendQueueCount, u8 lastRecvQueueCount, bool8 unk_06)
{
sLinkErrorBuffer.status = status;
sLinkErrorBuffer.lastSendQueueCount = lastSendQueueCount;
@@ -1647,14 +1647,14 @@ void CB2_LinkError(void)
{
gWirelessCommType = 3;
}
- sub_800E604();
+ ResetLinkRfuGFLayer();
}
- SetVBlankCallback(sub_80096BC);
+ SetVBlankCallback(VBlankCB_LinkError);
ResetBgsAndClearDma3BusyFlags(0);
- InitBgsFromTemplates(0, gUnknown_082ED1FC, 2);
- gUnknown_02022B0C = tilemapBuffer = malloc(0x800);
+ InitBgsFromTemplates(0, sLinkErrorBgTemplates, ARRAY_COUNT(sLinkErrorBgTemplates));
+ sLinkErrorBgTilemapBuffer = tilemapBuffer = malloc(0x800);
SetBgTilemapBuffer(1, tilemapBuffer);
- if (InitWindows(gUnknown_082ED204))
+ if (InitWindows(sLinkErrorWindowTemplates))
{
DeactivateAllTextPrinters();
ResetTempTileDataBuffers();
@@ -1680,11 +1680,11 @@ void CB2_LinkError(void)
static void sub_800B080(void)
{
- LoadBgTiles(0, g2BlankTilesGfx, 0x20, 0);
- DecompressAndLoadBgGfxUsingHeap(1, gWirelessLinkDisplayGfx, FALSE, 0, 0);
- CopyToBgTilemapBuffer(1, gWirelessLinkDisplayTilemap, 0, 0);
+ LoadBgTiles(0, s2BlankTilesGfx, 0x20, 0);
+ DecompressAndLoadBgGfxUsingHeap(1, sWirelessLinkDisplayGfx, FALSE, 0, 0);
+ CopyToBgTilemapBuffer(1, sWirelessLinkDisplayTilemap, 0, 0);
CopyBgTilemapBufferToVram(1);
- LoadPalette(gWirelessLinkDisplayPal, 0, 0x20);
+ LoadPalette(sWirelessLinkDisplayPal, 0, 0x20);
FillWindowPixelBuffer(0, PIXEL_FILL(0));
FillWindowPixelBuffer(2, PIXEL_FILL(0));
AddTextPrinterParameterized3(0, 3, 2, 6, sTextColors, 0, gText_CommErrorEllipsis);
@@ -1697,7 +1697,7 @@ static void sub_800B080(void)
static void sub_800B138(void)
{
- LoadBgTiles(0, g2BlankTilesGfx, 0x20, 0);
+ LoadBgTiles(0, s2BlankTilesGfx, 0x20, 0);
FillWindowPixelBuffer(1, PIXEL_FILL(0));
FillWindowPixelBuffer(2, PIXEL_FILL(0));
AddTextPrinterParameterized3(1, 3, 2, 0, sTextColors, 0, gText_CommErrorCheckConnections);
@@ -1810,12 +1810,12 @@ void sub_800B348(void)
InitLocalLinkPlayer();
block = &gLocalLinkPlayerBlock;
block->linkPlayer = gLocalLinkPlayer;
- memcpy(block->magic1, gASCIIGameFreakInc, sizeof(block->magic1) - 1);
- memcpy(block->magic2, gASCIIGameFreakInc, sizeof(block->magic2) - 1);
+ memcpy(block->magic1, sASCIIGameFreakInc, sizeof(block->magic1) - 1);
+ memcpy(block->magic2, sASCIIGameFreakInc, sizeof(block->magic2) - 1);
memcpy(gBlockSendBuffer, block, sizeof(*block));
}
-void sub_800B3A4(u32 who)
+void LinkPlayerFromBlock(u32 who)
{
u8 who_ = who;
struct LinkPlayerBlock *block;
@@ -1825,7 +1825,7 @@ void sub_800B3A4(u32 who)
player = &gLinkPlayers[who_];
*player = block->linkPlayer;
sub_800B524(player);
- if (strcmp(block->magic1, gASCIIGameFreakInc) != 0 || strcmp(block->magic2, gASCIIGameFreakInc) != 0)
+ if (strcmp(block->magic1, sASCIIGameFreakInc) != 0 || strcmp(block->magic2, sASCIIGameFreakInc) != 0)
{
SetMainCallback2(CB2_LinkError);
}
@@ -1860,7 +1860,7 @@ bool8 HandleLinkConnection(void)
return FALSE;
}
-void sub_800B488(void)
+void SetWirelessCommType1(void)
{
if (gReceivedRemoteLinkPlayers == 0)
{
@@ -1868,7 +1868,7 @@ void sub_800B488(void)
}
}
-static void sub_800B4A4(void)
+static void SetWirelessCommType0_Internal(void)
{
if (gReceivedRemoteLinkPlayers == 0)
{
@@ -1876,7 +1876,7 @@ static void sub_800B4A4(void)
}
}
-void sub_800B4C0(void)
+void SetWirelessCommType0(void)
{
if (gReceivedRemoteLinkPlayers == 0)
{
diff --git a/src/link_rfu_2.c b/src/link_rfu_2.c
index 3ee193ec6..34e9f719b 100644
--- a/src/link_rfu_2.c
+++ b/src/link_rfu_2.c
@@ -19,34 +19,91 @@
#include "save.h"
#include "mystery_gift.h"
-extern u16 gHeldKeyCodeToSend;
-
-u32 gf_rfu_REQ_api[RFU_API_BUFF_SIZE_RAM / 4];
-struct UnkRfuStruct_2 Rfu;
-
-BSS_DATA u8 gUnknown_03000D78[8];
-BSS_DATA u8 gUnknown_03000D80[16];
-BSS_DATA u16 gUnknown_03000D90[8];
-
-EWRAM_DATA struct GFtgtGname gUnknown_02022B14 = {};
-EWRAM_DATA ALIGNED(2) u8 gUnknown_02022B22[RFU_USER_NAME_LENGTH] = {};
-EWRAM_DATA INIT_PARAM gUnknown_02022B2C = {};
-EWRAM_DATA struct UnkLinkRfuStruct_02022B44 gUnknown_02022B44 = {};
-
-// Static ROM declarations
+struct SioInfo
+{
+ char magic[15]; // PokemonSioInfo
+ u8 playerCount;
+ u8 linkPlayerIdx[RFU_CHILD_MAX];
+ struct LinkPlayer linkPlayers[MAX_RFU_PLAYERS];
+ u8 filler[92];
+};
-// .rodata
+struct RfuDebug
+{
+ u8 filler0[6];
+ u16 unk_06;
+ u8 filler1[6];
+ vu8 unk_0e;
+ u8 unk_0f;
+ u8 filler2[84];
+ u16 unk_64;
+ u8 filler3[29];
+ u8 unk_83;
+ u8 filler4[88];
+};
-const INIT_PARAM gUnknown_082ED608 = {
- 0x04, 0x20, 0x00, 0x00, 0x02,
- (u8 *)&gUnknown_02022B14,
- gUnknown_02022B22,
- 0x01, 0x00, 0x258, 0x12c
+u32 gf_rfu_REQ_api[RFU_API_BUFF_SIZE_RAM / 4];
+struct GFRfuManager Rfu;
+
+static u8 sHeldKeyCount;
+static u8 sResendBlock8[16];
+static u16 sResendBlock16[8];
+
+EWRAM_DATA struct GFtgtGname gHostRFUtgtGnameBuffer = {};
+EWRAM_DATA u8 gHostRFUtgtUnameBuffer[PLAYER_NAME_LENGTH + 1] = {};
+static EWRAM_DATA INIT_PARAM sRfuReqConfig = {};
+static EWRAM_DATA struct RfuDebug sRfuDebug = {};
+
+static void ResetSendDataManager(struct RfuBlockSend *);
+static void sub_800EAB4(void);
+static void sub_800EAFC(void);
+static void sub_800ED34(u16);
+static void sub_800EDBC(u16);
+static void UpdateBackupQueue(void);
+static void Task_ExchangeLinkPlayers(u8);
+static void RfuHandleReceiveCommand(u8);
+static void CallRfuFunc(void);
+static void RfuPrepareSendBuffer(u16);
+static void HandleBlockSend(void);
+static void SendNextBlock(void);
+static void SendLastBlock(void);
+static u8 GetPartnerIndexByNameAndTrainerID(const u8 *, u16);
+static void UpdateChildStatuses(void);
+static s32 sub_80107A0(void);
+static void sub_801084C(u8);
+static void ClearSelectedLinkPlayerIds(u16);
+static void ValidateAndReceivePokemonSioInfo(void *);
+static void sub_8010D0C(u8);
+static void sub_80115EC(s32);
+static void sub_8011BF8(void);
+static void RfuReqDisconnectSlot(u32);
+static void sub_8011E94(u32, u32);
+static void sub_801209C(u8);
+static void Debug_PrintEmpty(void);
+static void Task_Idle(u8);
+
+static const INIT_PARAM sRfuReqConfigTemplate = {
+ .maxMFrame = 4,
+ .MC_TimerCount = 32,
+ .availSlot_flag = 0,
+ .mboot_flag = 0,
+ .serialNo = 2,
+ .gameName = (void *)&gHostRFUtgtGnameBuffer,
+ .userName = gHostRFUtgtUnameBuffer,
+ .fastSearchParent_flag = TRUE,
+ .linkRecovery_enable = FALSE,
+ .linkRecovery_period = 600,
+ .NI_failCounter_limit = 0x12c
};
-const u8 gUnknown_082ED620[] = {
- 0, 3, 2, 1, 0
+
+static const u8 sAvailSlots[] = {
+ [1] = AVAIL_SLOT1,
+ [2] = AVAIL_SLOT2,
+ [3] = AVAIL_SLOT3,
+ [4] = AVAIL_SLOT4
};
-const u32 gUnknown_082ED628[] = {
+
+static const u32 sAllBlocksReceived[] = {
0x000000,
0x000001,
0x000003,
@@ -73,35 +130,43 @@ const u32 gUnknown_082ED628[] = {
0x7fffff,
0xffffff
};
-const u8 gUnknown_082ED68C[] = {
+
+static const u8 sUnknown_082ED68C[] = {
0, 0, 1,
1, 2, 2,
2, 2, 3
};
-const u8 gUnknown_082ED695[] = {
+
+static const u8 sUnknown_082ED695[] = {
0, 1, 1, 2,
1, 2, 2, 3,
1, 2, 2, 3,
2, 3, 3, 4
};
-const u8 gUnknown_082ED6A5[] = {
+
+static const u8 sUnknown_082ED6A5[] = {
0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
};
-const struct {
+
+static const struct {
u8 *buffer;
u32 size;
-} gUnknown_082ED6B8[] = {
+} sUnknown_082ED6B8[] = {
{ gBlockSendBuffer, 200 },
{ gBlockSendBuffer, 200 },
{ gBlockSendBuffer, 100 },
{ gBlockSendBuffer, 220 },
{ gBlockSendBuffer, 40 }
};
-const u16 gUnknown_082ED6E0[] = {
- 0x0002, 0x7f7d, 0x0000, 0xFFFF
+
+static const u16 sAcceptedSerialNos[] = {
+ 0x0002,
+ RFU_SERIAL_7F7D,
+ 0x0000,
+ 0xFFFF
};
-const char sUnref_082ED6E8[][15] = {
+static const char sASCII_RfuCmds[][15] = {
"RFU WAIT",
"RFU BOOT",
"RFU ERROR",
@@ -114,79 +179,83 @@ const char sUnref_082ED6E8[][15] = {
"RFU SEND ERR",
"RFU CP POLL"
};
-const char sUnref_082ED6E9[][16] = {
+
+static const char sASCII_RecoverCmds[][16] = {
" ",
"RECOVER START ",
"DISSCONECT ",
"RECOVER SUUSES",
"RECOVER FAILED"
};
-const TaskFunc gUnknown_082ED7E0[] = {
+
+static const TaskFunc sUnknown_082ED7E0[] = {
sub_801084C,
- sub_8010AAC,
+ Task_ExchangeLinkPlayers,
sub_8010D0C
};
-const char gUnknown_082ED7EC[] = "PokemonSioInfo";
-const char gUnknown_082ED7FC[] = "LINK LOSS DISCONNECT!";
-const char gUnknown_082ED814[] = "LINK LOSS RECOVERY NOW";
-
-ALIGNED(4) const char gUnknown_082ED82C[31] = {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',0x00};
-const char gUnknown_082ED84B[16] = {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',0x00};
-const char gUnknown_082ED85B[9] = {' ',' ',' ',' ',' ',' ',' ',' ',0x00};
-ALIGNED(4) const char gUnknown_082ED864[2] = {' ',0x00};
-const char gUnknown_082ED866[2] = {'*',0x00};
-const char gUnknown_082ED868[8] = "NOWSLOT";
-const char gUnknown_082ED870[12] = " ";
-const char gUnknown_082ED87C[12] = "CLOCK DRIFT";
-const char gUnknown_082ED888[12] = "BUSY SEND ";
-const char gUnknown_082ED894[12] = "CMD REJECT ";
-const char gUnknown_082ED8A0[12] = "CLOCK SLAVE";
-const char gUnknown_082ED8A8[3][8] = {
+
+static const char sASCII_PokemonSioInfo[] = "PokemonSioInfo";
+static const char sASCII_LinkLossDisconnect[] = "LINK LOSS DISCONNECT!";
+static const char sASCII_LinkLossRecoveryNow[] = "LINK LOSS RECOVERY NOW";
+ALIGNED(4) static const char sASCII_30Commas[31] = {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','\0'};
+static const char sASCII_15Commas[16] = {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','\0'};
+static const char sASCII_8Commas[9] = {' ',' ',' ',' ',' ',' ',' ',' ','\0'};
+ALIGNED(4) static const char sASCII_Space[2] = {' ','\0'};
+static const char sASCII_Asterisk[2] = {'*','\0'};
+static const char sASCII_NowSlot[8] = "NOWSLOT";
+
+static const char sASCII_ClockCmds[][12] = {
+ " ",
+ "CLOCK DRIFT",
+ "BUSY SEND ",
+ "CMD REJECT ",
+ "CLOCK SLAVE"
+};
+
+static const char sASCII_ChildParentSearch[3][8] = {
"CHILD ",
"PARENT",
"SEARCH"
};
-// .text
-
-void nullsub_5(const void *unused_0, u8 unused_1, u8 unused_2)
+static void Debug_PrintString(const void *str, u8 x, u8 y)
{
- // debug?
+
}
-void nullsub_13(u16 unused_0, u8 unused_1, u8 unused_2, u8 unused_3)
+static void Debug_PrintNum(u16 num, u8 x, u8 y, u8 numDigits)
{
}
-void sub_800E604(void)
+void ResetLinkRfuGFLayer(void)
{
s32 i;
- u8 unk_ee_bak = Rfu.unk_ee;
+ u8 errorState = Rfu.errorState;
CpuFill16(0, &Rfu, sizeof Rfu);
- Rfu.unk_ee = unk_ee_bak;
- Rfu.unk_0c = 0xFF;
- if (Rfu.unk_ee != 4)
+ Rfu.errorState = errorState;
+ Rfu.parentChild = 0xFF;
+ if (Rfu.errorState != 4)
{
- Rfu.unk_ee = 0;
+ Rfu.errorState = 0;
}
- for (i = 0; i < 5; i++)
+ for (i = 0; i < MAX_RFU_PLAYERS; i++)
{
- sub_800FCC4(Rfu.unk_80 + i);
+ ResetSendDataManager(&Rfu.recvBlock[i]);
}
- sub_800FCC4(&Rfu.unk_6c);
- sub_800D6C8(&Rfu.unk_124);
- sub_800D724(&Rfu.unk_9e8);
+ ResetSendDataManager(&Rfu.sendBlock);
+ RfuRecvQueue_Reset(&Rfu.recvQueue);
+ RfuSendQueue_Reset(&Rfu.sendQueue);
CpuFill16(0, gSendCmd, sizeof gSendCmd);
CpuFill16(0, gRecvCmds, sizeof gRecvCmds);
CpuFill16(0, gLinkPlayers, sizeof gLinkPlayers);
}
-void sub_800E6D0(void)
+void InitRFU(void)
{
IntrFunc serialIntr = gIntrTable[1];
IntrFunc timerIntr = gIntrTable[2];
- sub_800E700();
+ InitRFUAPI();
rfu_REQ_stopMode();
rfu_waitREQComplete();
REG_IME = 0;
@@ -195,59 +264,59 @@ void sub_800E6D0(void)
REG_IME = INTR_FLAG_VBLANK;
}
-void sub_800E700(void)
+void InitRFUAPI(void)
{
if (!rfu_initializeAPI((void *)gf_rfu_REQ_api, sizeof gf_rfu_REQ_api, gIntrTable + 1, TRUE))
{
gLinkType = 0;
- sub_800AAF4();
- sub_80111B0(0);
- sub_800E604();
+ ClearSavedLinkPlayers();
+ sub_80111B0(FALSE);
+ ResetLinkRfuGFLayer();
rfu_setTimerInterrupt(3, gIntrTable + 2);
}
}
-void sub_800E748(u8 taskId)
+static void Task_LinkLeaderSearchForChildren(u8 taskId)
{
- sub_8010750();
- switch (Rfu.unk_04)
+ UpdateChildStatuses();
+ switch (Rfu.state)
{
- case 0:
- rfu_LMAN_initializeRFU(&gUnknown_02022B2C);
- Rfu.unk_04 = 1;
- gTasks[taskId].data[1] = 1;
- break;
- case 1:
- break;
- case 2:
- rfu_LMAN_establishConnection(Rfu.unk_0c, 0, 240, (u16 *)gUnknown_082ED6E0);
- Rfu.unk_04 = 3;
- gTasks[taskId].data[1] = 6;
- break;
- case 3:
- break;
- case 4:
- rfu_LMAN_stopManager(FALSE);
- Rfu.unk_04 = 5;
- break;
- case 5:
- break;
- case 18:
- Rfu.unk_cdb = 0;
- rfu_LMAN_setMSCCallback(sub_800EDBC);
- sub_800EAB4();
- sub_800EAFC();
- Rfu.unk_04 = 20;
- gTasks[taskId].data[1] = 8;
- CreateTask(sub_801084C, 5);
- DestroyTask(taskId);
- break;
+ case 0:
+ rfu_LMAN_initializeRFU(&sRfuReqConfig);
+ Rfu.state = 1;
+ gTasks[taskId].data[1] = 1;
+ break;
+ case 1:
+ break;
+ case 2:
+ rfu_LMAN_establishConnection(Rfu.parentChild, 0, 240, (u16 *)sAcceptedSerialNos);
+ Rfu.state = 3;
+ gTasks[taskId].data[1] = 6;
+ break;
+ case 3:
+ break;
+ case 4:
+ rfu_LMAN_stopManager(FALSE);
+ Rfu.state = 5;
+ break;
+ case 5:
+ break;
+ case 18:
+ Rfu.unk_cdb = FALSE;
+ rfu_LMAN_setMSCCallback(sub_800EDBC);
+ sub_800EAB4();
+ sub_800EAFC();
+ Rfu.state = 20;
+ gTasks[taskId].data[1] = 8;
+ CreateTask(sub_801084C, 5);
+ DestroyTask(taskId);
+ break;
}
}
s32 sub_800E87C(u8 idx)
{
- return gUnknown_082ED6A5[idx];
+ return sUnknown_082ED6A5[idx];
}
void sub_800E88C(s32 r2, s32 r5)
@@ -258,287 +327,287 @@ void sub_800E88C(s32 r2, s32 r5)
s32 r6 = 0;
if (r5 == -1)
{
- for (i = 0; i < 4; r2 >>= 1, i++)
+ for (i = 0; i < RFU_CHILD_MAX; r2 >>= 1, i++)
{
if (r2 & 1)
{
- Rfu.unk_cde[i] = r4;
+ Rfu.linkPlayerIdx[i] = r4;
r4++;
}
}
}
else
{
- for (i = 0; i < 4; r1 >>= 1, i++)
+ for (i = 0; i < RFU_CHILD_MAX; r1 >>= 1, i++)
{
if (!(r1 & 1))
{
- Rfu.unk_cde[i] = 0;
+ Rfu.linkPlayerIdx[i] = 0;
}
}
- for (r4 = 4; r4 != 0; r4--)
+ for (r4 = RFU_CHILD_MAX; r4 != 0; r4--)
{
- for (i = 0; i < 4 && Rfu.unk_cde[i] != r4; i++);
- if (i == 4)
+ for (i = 0; i < RFU_CHILD_MAX && Rfu.linkPlayerIdx[i] != r4; i++);
+ if (i == RFU_CHILD_MAX)
{
r6 = r4;
}
}
- for (r5 &= ~r2, i = 0; i < 4; r5 >>= 1, i++)
+ for (r5 &= ~r2, i = 0; i < RFU_CHILD_MAX; r5 >>= 1, i++)
{
if (r5 & 1)
{
- Rfu.unk_cde[i] = r6++;
+ Rfu.linkPlayerIdx[i] = r6++;
}
}
}
}
-void sub_800E94C(u8 taskId)
+static void Task_JoinGroupSearchForParent(u8 taskId)
{
- switch (Rfu.unk_04)
+ switch (Rfu.state)
{
- case 0:
- rfu_LMAN_initializeRFU((INIT_PARAM *)&gUnknown_082ED608);
- Rfu.unk_04 = 1;
- gTasks[taskId].data[1] = 1;
- break;
- case 1:
- break;
- case 6:
- rfu_LMAN_establishConnection(Rfu.unk_0c, 0, 0xf0, (u16 *)gUnknown_082ED6E0);
- Rfu.unk_04 = 7;
- gTasks[taskId].data[1] = 7;
- break;
- case 7:
- break;
- case 9:
- gTasks[taskId].data[1] = 10;
- break;
- case 11:
- switch (sub_80107A0())
- {
- case 5:
- Rfu.unk_04 = 12;
- break;
- case 6:
- case 9:
- rfu_LMAN_requestChangeAgbClockMaster();
- Rfu.unk_ce4 = 2;
- DestroyTask(taskId);
- break;
- }
- break;
- case 12:
+ case 0:
+ rfu_LMAN_initializeRFU((INIT_PARAM *)&sRfuReqConfigTemplate);
+ Rfu.state = 1;
+ gTasks[taskId].data[1] = 1;
+ break;
+ case 1:
+ break;
+ case 6:
+ rfu_LMAN_establishConnection(Rfu.parentChild, 0, 240, (u16 *)sAcceptedSerialNos);
+ Rfu.state = 7;
+ gTasks[taskId].data[1] = 7;
+ break;
+ case 7:
+ break;
+ case 9:
+ gTasks[taskId].data[1] = 10;
+ break;
+ case 11:
+ switch (sub_80107A0())
{
- u8 r5 = 1 << Rfu.unk_c3e;
- rfu_clearSlot(12, Rfu.unk_c3e);
- rfu_setRecvBuffer(16, Rfu.unk_c3e, Rfu.unk_c3f, 70);
- rfu_UNI_setSendData(r5, Rfu.unk_4c, 14);
- gTasks[taskId].data[1] = 8;
+ case RFU_STATUS_JOIN_GROUP_OK:
+ Rfu.state = 12;
+ break;
+ case RFU_STATUS_JOIN_GROUP_NO:
+ case RFU_STATUS_LEAVE_GROUP:
+ rfu_LMAN_requestChangeAgbClockMaster();
+ Rfu.unk_ce4 = 2;
DestroyTask(taskId);
- if (gUnknown_02022B44.unk_0f == 0)
- {
- sub_801227C();
- gUnknown_02022B44.unk_0f++;
- }
- CreateTask(sub_801084C, 5);
break;
}
+ break;
+ case 12:
+ {
+ u8 bmChildSlot = 1 << Rfu.childSlot;
+ rfu_clearSlot(TYPE_NI_SEND | TYPE_NI_RECV, Rfu.childSlot);
+ rfu_setRecvBuffer(TYPE_UNI, Rfu.childSlot, Rfu.unk_c3f, 70);
+ rfu_UNI_setSendData(bmChildSlot, Rfu.unk_4c, sizeof(Rfu.unk_4c));
+ gTasks[taskId].data[1] = 8;
+ DestroyTask(taskId);
+ if (sRfuDebug.unk_0f == 0)
+ {
+ Debug_PrintEmpty();
+ sRfuDebug.unk_0f++;
+ }
+ CreateTask(sub_801084C, 5);
+ break;
+ }
}
}
-void sub_800EAB4(void)
+static void sub_800EAB4(void)
{
u8 i;
- u8 r5 = lman.acceptSlot_flag;
- for (i = 0; i < 4; i++)
+ u8 acceptSlot = lman.acceptSlot_flag;
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- if (r5 & 1)
+ if (acceptSlot & 1)
{
- rfu_setRecvBuffer(16, i, Rfu.unk_14[i], 14);
- rfu_clearSlot(3, i);
+ rfu_setRecvBuffer(TYPE_UNI, i, Rfu.unk_14[i], 14);
+ rfu_clearSlot(TYPE_UNI_SEND | TYPE_UNI_RECV, i);
}
- r5 >>= 1;
+ acceptSlot >>= 1;
}
}
-void sub_800EAFC(void)
+static void sub_800EAFC(void)
{
- u8 r5 = lman.acceptSlot_flag;
- rfu_UNI_setSendData(r5, Rfu.unk_c87, 70);
- Rfu.unk_cda = sub_800E87C(r5);
- Rfu.unk_ce2 = r5;
- sub_800E88C(r5, -1);
- Rfu.unk_0c = 1;
+ u8 acceptSlot = lman.acceptSlot_flag;
+ rfu_UNI_setSendData(acceptSlot, Rfu.recvCmds, 70);
+ Rfu.unk_cda = sub_800E87C(acceptSlot);
+ Rfu.unk_ce2 = acceptSlot;
+ sub_800E88C(acceptSlot, -1);
+ Rfu.parentChild = MODE_PARENT;
}
-void sub_800EB44(u8 taskId)
+static void Task_LinkRfu_UnionRoomListen(u8 taskId)
{
- if (sub_800F7DC()->activity == 0x54 && sub_8011A74() == 4)
+ if (GetHostRFUtgtGname()->activity == (ACTIVITY_PLYRTALK | IN_UNION_ROOM) && RfuGetStatus() == RFU_STATUS_NEW_CHILD_DETECTED)
{
rfu_REQ_disconnect(lman.acceptSlot_flag);
rfu_waitREQComplete();
- sub_8011A64(0, 0);
+ RfuSetStatus(RFU_STATUS_OK, 0);
}
- switch (Rfu.unk_04)
+ switch (Rfu.state)
{
- case 0:
- rfu_LMAN_initializeRFU(&gUnknown_02022B2C);
- Rfu.unk_04 = 1;
- gTasks[taskId].data[1] = 1;
- break;
- case 1:
- break;
- case 17:
- rfu_LMAN_establishConnection(2, 0, 240, (u16 *)gUnknown_082ED6E0);
- rfu_LMAN_setMSCCallback(sub_800ED34);
- Rfu.unk_04 = 18;
- break;
- case 18:
- break;
- case 13:
- if (rfu_UNI_setSendData(1 << Rfu.unk_c3e, Rfu.unk_4c, 14) == 0)
+ case 0:
+ rfu_LMAN_initializeRFU(&sRfuReqConfig);
+ Rfu.state = 1;
+ gTasks[taskId].data[1] = 1;
+ break;
+ case 1:
+ break;
+ case 17:
+ rfu_LMAN_establishConnection(2, 0, 240, (u16 *)sAcceptedSerialNos);
+ rfu_LMAN_setMSCCallback(sub_800ED34);
+ Rfu.state = 18;
+ break;
+ case 18:
+ break;
+ case 13:
+ if (rfu_UNI_setSendData(1 << Rfu.childSlot, Rfu.unk_4c, sizeof(Rfu.unk_4c)) == 0)
+ {
+ Rfu.parentChild = MODE_CHILD;
+ DestroyTask(taskId);
+ if (gTasks[taskId].data[7])
{
- Rfu.unk_0c = 0;
- DestroyTask(taskId);
- if (gTasks[taskId].data[7])
- {
- CreateTask(sub_8010D0C, 1);
- }
- else
- {
- CreateTask(sub_801084C, 5);
- }
+ CreateTask(sub_8010D0C, 1);
}
- break;
- case 14:
- rfu_LMAN_stopManager(0);
- Rfu.unk_04 = 15;
- break;
- case 15:
- break;
- case 16:
- Rfu.unk_cdb = 0;
- rfu_LMAN_setMSCCallback(sub_800EDBC);
- sub_8011068(1);
- sub_800EAB4();
- sub_800EAFC();
- Rfu.unk_04 = 20;
- gTasks[taskId].data[1] = 8;
- Rfu.unk_0c = 1;
- CreateTask(sub_801084C, 5);
- Rfu.unk_ce8 = 1;
- DestroyTask(taskId);
- break;
+ else
+ {
+ CreateTask(sub_801084C, 5);
+ }
+ }
+ break;
+ case 14:
+ rfu_LMAN_stopManager(0);
+ Rfu.state = 15;
+ break;
+ case 15:
+ break;
+ case 16:
+ Rfu.unk_cdb = FALSE;
+ rfu_LMAN_setMSCCallback(sub_800EDBC);
+ UpdateGameData_GroupLockedIn(TRUE);
+ sub_800EAB4();
+ sub_800EAFC();
+ Rfu.state = 20;
+ gTasks[taskId].data[1] = 8;
+ Rfu.parentChild = MODE_PARENT;
+ CreateTask(sub_801084C, 5);
+ Rfu.unk_ce8 = TRUE;
+ DestroyTask(taskId);
+ break;
}
}
-void sub_800ED10(void)
+void LinkRfu_CreateConnectionAsParent(void)
{
- rfu_LMAN_establishConnection(1, 0, 240, (u16 *)gUnknown_082ED6E0);
+ rfu_LMAN_establishConnection(MODE_PARENT, 0, 240, (u16 *)sAcceptedSerialNos);
}
-void sub_800ED28(void)
+void LinkRfu_StopManagerBeforeEnteringChat(void)
{
rfu_LMAN_stopManager(FALSE);
}
-void sub_800ED34(u16 unused)
+static void sub_800ED34(u16 unused)
{
s32 i;
- for (i = 0; i < 14; i++)
+ for (i = 0; i < (int)ARRAY_COUNT(Rfu.unk_4c); i++)
{
Rfu.unk_4c[i] = 0;
}
rfu_REQ_recvData();
rfu_waitREQComplete();
- if (gRfuSlotStatusUNI[Rfu.unk_c3e]->recv.newDataFlag)
+ if (gRfuSlotStatusUNI[Rfu.childSlot]->recv.newDataFlag)
{
Rfu.unk_cd0++;
- sub_800D7D8(&Rfu.unk_124, Rfu.unk_c3f);
- gUnknown_02022B44.unk_06++;
- sub_800F048();
- rfu_UNI_readySendData(Rfu.unk_c3e);
- rfu_UNI_clearRecvNewDataFlag(Rfu.unk_c3e);
+ RfuRecvQueue_Enqueue(&Rfu.recvQueue, Rfu.unk_c3f);
+ sRfuDebug.unk_06++;
+ UpdateBackupQueue();
+ rfu_UNI_readySendData(Rfu.childSlot);
+ rfu_UNI_clearRecvNewDataFlag(Rfu.childSlot);
}
- rfu_LMAN_REQ_sendData(1);
+ rfu_LMAN_REQ_sendData(TRUE);
}
-void sub_800EDBC(u16 unused)
+static void sub_800EDBC(u16 unused)
{
- Rfu.unk_cdb = 1;
+ Rfu.unk_cdb = TRUE;
}
-void sub_800EDD4(void)
+void LinkRfu_Shutdown(void)
{
u8 i;
rfu_LMAN_powerDownRFU();
- if (Rfu.unk_0c == 1)
+ if (Rfu.parentChild == MODE_PARENT)
{
- if (FuncIsActiveTask(sub_800E748) == TRUE)
+ if (FuncIsActiveTask(Task_LinkLeaderSearchForChildren) == TRUE)
{
- DestroyTask(Rfu.unk_67);
- sub_800E604();
+ DestroyTask(Rfu.searchTaskId);
+ ResetLinkRfuGFLayer();
}
}
- else if (Rfu.unk_0c == 0)
+ else if (Rfu.parentChild == MODE_CHILD)
{
- if (FuncIsActiveTask(sub_800E94C) == TRUE)
+ if (FuncIsActiveTask(Task_JoinGroupSearchForParent) == TRUE)
{
- DestroyTask(Rfu.unk_67);
- sub_800E604();
+ DestroyTask(Rfu.searchTaskId);
+ ResetLinkRfuGFLayer();
}
}
- else if (Rfu.unk_0c == 2)
+ else if (Rfu.parentChild == 2)
{
- if (FuncIsActiveTask(sub_800EB44) == TRUE)
+ if (FuncIsActiveTask(Task_LinkRfu_UnionRoomListen) == TRUE)
{
- DestroyTask(Rfu.unk_67);
- sub_800E604();
+ DestroyTask(Rfu.searchTaskId);
+ ResetLinkRfuGFLayer();
}
}
- for (i = 0; i < 3; i++)
+ for (i = 0; i < ARRAY_COUNT(sUnknown_082ED7E0); i++)
{
- if (FuncIsActiveTask(gUnknown_082ED7E0[i]) == TRUE)
+ if (FuncIsActiveTask(sUnknown_082ED7E0[i]) == TRUE)
{
- DestroyTask(FindTaskIdByFunc(gUnknown_082ED7E0[i]));
+ DestroyTask(FindTaskIdByFunc(sUnknown_082ED7E0[i]));
}
}
}
-void sub_800EE78(void)
+static void CreateTask_LinkLeaderSearchForChildren(void)
{
- Rfu.unk_67 = CreateTask(sub_800E748, 1);
+ Rfu.searchTaskId = CreateTask(Task_LinkLeaderSearchForChildren, 1);
}
-bool8 sub_800EE94(void)
+static bool8 sub_800EE94(void)
{
- if (Rfu.unk_04 == 7 && Rfu.unk_ccd)
+ if (Rfu.state == 7 && Rfu.parentId)
{
return TRUE;
}
return FALSE;
}
-bool32 sub_800EEBC(void)
+static bool32 IsParentSuccessfullyReconnected(void)
{
- if (Rfu.unk_04 == 7 && !rfu_LMAN_CHILD_connectParent(gRfuLinkStatus->partner[Rfu.unk_c3d].id, 240))
+ if (Rfu.state == 7 && !rfu_LMAN_CHILD_connectParent(gRfuLinkStatus->partner[Rfu.unk_c3d].id, 240))
{
- Rfu.unk_04 = 9;
+ Rfu.state = 9;
return TRUE;
}
return FALSE;
}
-void sub_800EF00(void)
+static void CreateTask_JoinGroupSearchForParent(void)
{
- Rfu.unk_67 = CreateTask(sub_800E94C, 1);
+ Rfu.searchTaskId = CreateTask(Task_JoinGroupSearchForParent, 1);
}
-bool8 sub_800EF1C(void)
+bool8 LmanAcceptSlotFlagIsNotZero(void)
{
if (lman.acceptSlot_flag)
{
@@ -547,17 +616,17 @@ bool8 sub_800EF1C(void)
return FALSE;
}
-void sub_800EF38(void)
+void LinkRfu_StopManagerAndFinalizeSlots(void)
{
- Rfu.unk_04 = 4;
- Rfu.unk_ce7 = lman.acceptSlot_flag;
+ Rfu.state = 4;
+ Rfu.acceptSlot_flag = lman.acceptSlot_flag;
}
-bool32 sub_800EF58(bool32 a0)
+bool32 WaitRfuState(bool32 force)
{
- if (Rfu.unk_04 == 17 || a0)
+ if (Rfu.state == 17 || force)
{
- Rfu.unk_04 = 18;
+ Rfu.state = 18;
return TRUE;
}
return FALSE;
@@ -565,14 +634,14 @@ bool32 sub_800EF58(bool32 a0)
void sub_800EF7C(void)
{
- Rfu.unk_04 = 14;
+ Rfu.state = 14;
}
-void sub_800EF88(u8 a0)
+static void sub_800EF88(u8 a0)
{
u8 i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
if (a0 & 1)
{
@@ -583,53 +652,51 @@ void sub_800EF88(u8 a0)
}
}
-void sub_800EFB0(void)
+static void sub_800EFB0(void)
{
s32 i, j;
for (i = 0; i < 5; i++)
{
- struct UnkRfuStruct_2 *ptr = &Rfu;
+ struct GFRfuManager *ptr = &Rfu;
for (j = 0; j < 7; j++)
{
- ptr->unk_c87[i][j][1] = gRecvCmds[i][j] >> 8;
- ptr->unk_c87[i][j][0] = gRecvCmds[i][j];
+ ptr->recvCmds[i][j][1] = gRecvCmds[i][j] >> 8;
+ ptr->recvCmds[i][j][0] = gRecvCmds[i][j];
}
}
CpuFill16(0, gRecvCmds, sizeof gRecvCmds);
}
-void sub_800F014(void)
+static void sub_800F014(void)
{
s32 i;
- for (i = 0; i < 7; i++)
+ for (i = 0; i < CMD_LENGTH - 1; i++)
{
gRecvCmds[0][i] = gSendCmd[i];
}
- for (i = 0; i < 7; i++)
+ for (i = 0; i < CMD_LENGTH - 1; i++)
{
gSendCmd[i] = 0;
}
}
-void sub_800F048(void)
+static void UpdateBackupQueue(void)
{
- if (Rfu.unk_c3c)
+ if (Rfu.linkRecovered)
{
- u8 r2 = sub_800DAC8(&Rfu.unk_c1c, Rfu.unk_4c);
- if (Rfu.unk_c1c.unk_1e == 0)
- {
- Rfu.unk_c3c = 0;
- }
- if (r2)
- {
+ bool8 backupEmpty = RfuBackupQueue_Dequeue(&Rfu.backupQueue, Rfu.unk_4c);
+
+ if (Rfu.backupQueue.count == 0)
+ Rfu.linkRecovered = FALSE;
+
+ if (backupEmpty)
return;
- }
}
- if (Rfu.unk_c3c == 0)
+ if (!Rfu.linkRecovered)
{
- sub_800D9DC(&Rfu.unk_9e8, Rfu.unk_4c);
- sub_800DA68(&Rfu.unk_c1c, Rfu.unk_4c);
+ RfuSendQueue_Dequeue(&Rfu.sendQueue, Rfu.unk_4c);
+ RfuBackupQueue_Enqueue(&Rfu.backupQueue, Rfu.unk_4c);
}
}
@@ -642,9 +709,9 @@ bool32 IsRfuRecvQueueEmpty(void)
{
return FALSE;
}
- for (i = 0; i < 5; i++)
+ for (i = 0; i < MAX_RFU_PLAYERS; i++)
{
- for (j = 0; j < 7; j++)
+ for (j = 0; j < CMD_LENGTH - 1; j++)
{
if (gRecvCmds[i][j] != 0)
{
@@ -655,53 +722,53 @@ bool32 IsRfuRecvQueueEmpty(void)
return TRUE;
}
-bool32 sub_800F0F8(void)
+static bool32 sub_800F0F8(void)
{
- if (Rfu.unk_04 < 20)
+ if (Rfu.state < 20)
{
rfu_REQ_recvData();
rfu_waitREQComplete();
- rfu_LMAN_REQ_sendData(0);
+ rfu_LMAN_REQ_sendData(FALSE);
}
else
{
- Rfu.unk_cdb = 0;
+ Rfu.unk_cdb = FALSE;
if ((Rfu.unk_ce2 & gRfuLinkStatus->connSlotFlag) == Rfu.unk_ce2 && (Rfu.unk_ce2 & gRfuLinkStatus->connSlotFlag))
{
if (!Rfu.unk_cdc)
{
if (Rfu.unk_ce3)
{
- sub_8011D6C(Rfu.unk_ce3);
+ RfuReqDisconnectSlot(Rfu.unk_ce3);
Rfu.unk_ce3 = 0;
if (Rfu.unk_ce4 == 1)
{
- sub_8011A64(2, 0x8000);
- sub_8011170(0x8000);
+ RfuSetStatus(RFU_STATUS_CONNECTION_ERROR, 0x8000);
+ GetLinkmanErrorParams(0x8000);
return FALSE;
}
if (!lman.acceptSlot_flag)
{
- sub_800EDD4();
+ LinkRfu_Shutdown();
gReceivedRemoteLinkPlayers = 0;
return FALSE;
}
}
sub_800EFB0();
rfu_UNI_readySendData(Rfu.unk_cda);
- rfu_LMAN_REQ_sendData(1);
+ rfu_LMAN_REQ_sendData(TRUE);
}
else
{
rfu_REQ_PARENT_resumeRetransmitAndChange();
}
- Rfu.unk_0e = 1;
+ Rfu.unk_0e = TRUE;
}
}
return FALSE;
}
-bool32 sub_800F1E0(void)
+static bool32 sub_800F1E0(void)
{
u16 i;
u16 flags;
@@ -709,12 +776,12 @@ bool32 sub_800F1E0(void)
u16 j;
u8 retval;
- if (Rfu.unk_04 >= 20 && Rfu.unk_0e == 1)
+ if (Rfu.state >= 20 && Rfu.unk_0e == TRUE)
{
rfu_waitREQComplete();
- while (Rfu.unk_cdb == 0)
+ while (Rfu.unk_cdb == FALSE)
{
- if (Rfu.unk_ee != 0)
+ if (Rfu.errorState != 0)
{
return FALSE;
}
@@ -723,10 +790,10 @@ bool32 sub_800F1E0(void)
rfu_waitREQComplete();
if ((lman.parentAck_flag & Rfu.unk_ce2) == Rfu.unk_ce2)
{
- Rfu.unk_cdc = 0;
- gUnknown_02022B44.unk_06++;
+ Rfu.unk_cdc = FALSE;
+ sRfuDebug.unk_06++;
flags = lman.acceptSlot_flag;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
if (flags & 1)
{
@@ -735,14 +802,14 @@ bool32 sub_800F1E0(void)
if (Rfu.unk_cee[i] != 0xFF && (Rfu.unk_14[i][0] >> 5) != ((Rfu.unk_cee[i] + 1) & 7))
{
if (++Rfu.unk_cea[i] > 4)
- sub_8011170(0x8100);
+ GetLinkmanErrorParams(0x8100);
}
else
{
Rfu.unk_cee[i] = Rfu.unk_14[i][0] / 32;
Rfu.unk_cea[i] = 0;
Rfu.unk_14[i][0] &= 0x1f;
- r0 = Rfu.unk_cde[i];
+ r0 = Rfu.linkPlayerIdx[i];
for (j = 0; j < 7; j++)
{
gRecvCmds[r0][j] = (Rfu.unk_14[i][(j << 1) + 1] << 8) | Rfu.unk_14[i][(j << 1) + 0];
@@ -756,40 +823,40 @@ bool32 sub_800F1E0(void)
flags >>= 1;
}
sub_800F014();
- sub_800F86C(0);
- sub_8010528();
+ RfuHandleReceiveCommand(0);
+ CallRfuFunc();
if (Rfu.unk_ce5 && !Rfu.unk_cd9)
{
- gUnknown_02022B44.unk_0e = 0;
- rfu_clearSlot(3, Rfu.unk_cda);
- for (i = 0; i < 4; i++)
+ sRfuDebug.unk_0e = FALSE;
+ rfu_clearSlot(TYPE_UNI_SEND | TYPE_UNI_RECV, Rfu.unk_cda);
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
if ((Rfu.unk_ce5 >> i) & 1)
{
- rfu_setRecvBuffer(0x10, i, Rfu.unk_14[i], 14);
+ rfu_setRecvBuffer(TYPE_UNI, i, Rfu.unk_14[i], 14);
}
}
sub_800E88C(Rfu.unk_ce2, Rfu.unk_ce2 | Rfu.unk_ce5);
Rfu.unk_ce9 = Rfu.unk_ce5;
Rfu.unk_ce2 |= Rfu.unk_ce5;
Rfu.unk_ce5 = 0;
- rfu_UNI_setSendData(Rfu.unk_ce2, Rfu.unk_c87, 70);
+ rfu_UNI_setSendData(Rfu.unk_ce2, Rfu.recvCmds, 70);
Rfu.unk_cda = sub_800E87C(Rfu.unk_ce2);
- CreateTask(sub_8010AAC, 0);
+ CreateTask(Task_ExchangeLinkPlayers, 0);
}
}
else
{
- Rfu.unk_cdc = 1;
- Rfu.unk_0e = 0;
+ Rfu.unk_cdc = TRUE;
+ Rfu.unk_0e = FALSE;
}
- Rfu.unk_0e = 0;
+ Rfu.unk_0e = FALSE;
}
retval = Rfu.unk_cdc;
return gRfuLinkStatus->sendSlotUNIFlag ? retval & 1 : FALSE;
}
-void sub_800F498(u16 *a0, u8 *a1)
+static void sub_800F498(u16 *a0, u8 *a1)
{
s32 i;
@@ -810,15 +877,15 @@ void sub_800F498(u16 *a0, u8 *a1)
}
}
-bool32 sub_800F4F0(void)
+static bool32 RfuProcessEnqueuedRecvBlock(void)
{
u8 i;
u8 j;
u8 sp00[MAX_RFU_PLAYERS * (2 * (CMD_LENGTH - 1))];
u8 sp48[2 * (CMD_LENGTH - 1)];
- u8 switchval;
+ u8 status;
- sub_800D934(&Rfu.unk_124, sp00);
+ RfuRecvQueue_Dequeue(&Rfu.recvQueue, sp00);
for (i = 0; i < MAX_RFU_PLAYERS; i++)
{
for (j = 0; j < CMD_LENGTH - 1; j++)
@@ -826,21 +893,21 @@ bool32 sub_800F4F0(void)
gRecvCmds[i][j] = (sp00[i * 14 + (j << 1) + 1] << 8) | sp00[i * 14 + (j << 1) + 0];
}
}
- sub_800F86C(0);
+ RfuHandleReceiveCommand(0);
if (lman.childClockSlave_flag == 0 && Rfu.unk_ce4)
{
rfu_REQ_disconnect(gRfuLinkStatus->connSlotFlag | gRfuLinkStatus->linkLossSlotFlag);
rfu_waitREQComplete();
- switchval = sub_8011A74();
- if (switchval != 1 && switchval != 6 && switchval != 9)
- sub_8011A64(2, 0x9000);
+ status = RfuGetStatus();
+ if (status != RFU_STATUS_FATAL_ERROR && status != RFU_STATUS_JOIN_GROUP_NO && status != RFU_STATUS_LEAVE_GROUP)
+ RfuSetStatus(RFU_STATUS_CONNECTION_ERROR, 0x9000);
rfu_clearAllSlot();
gReceivedRemoteLinkPlayers = FALSE;
- Rfu.linkRfuCallback = NULL;
+ Rfu.callback = NULL;
if (Rfu.unk_ce4 == 1)
{
- sub_8011A64(2, 0x9000);
- sub_8011170(0x9000);
+ RfuSetStatus(RFU_STATUS_CONNECTION_ERROR, 0x9000);
+ GetLinkmanErrorParams(0x9000);
}
lman.state = lman.next_state = 0;
Rfu.unk_ce4 = 0;
@@ -848,105 +915,105 @@ bool32 sub_800F4F0(void)
if (Rfu.unk_cd0)
{
Rfu.unk_cd0--;
- sub_8010528();
+ CallRfuFunc();
sub_800F498(gSendCmd, sp48);
- sub_800D888(&Rfu.unk_9e8, sp48);
+ RfuSendQueue_Enqueue(&Rfu.sendQueue, sp48);
for (i = 0; i < CMD_LENGTH - 1; i++)
gSendCmd[i] = 0;
}
return IsRfuRecvQueueEmpty();
}
-void sub_800F638(u8 unused, u32 flags)
+static void HandleSendFailure(u8 unused, u32 flags)
{
s32 i, j;
- const u8 *r10 = Rfu.unk_6c.unk_04;
- for (i = 0; i < Rfu.unk_6c.unk_02; i++)
+ const u8 *r10 = Rfu.sendBlock.payload;
+ for (i = 0; i < Rfu.sendBlock.count; i++)
{
if (!(flags & 1))
{
- gUnknown_03000D90[0] = (~0x76ff) | i;
+ sResendBlock16[0] = RFU_COMMAND_0x8900 | i;
for (j = 0; j < 7; j++)
{
- gUnknown_03000D90[j + 1] = (r10[12 * i + (j << 1) + 1] << 8) | r10[12 * i + (j << 1) + 0];
+ sResendBlock16[j + 1] = (r10[12 * i + (j << 1) + 1] << 8) | r10[12 * i + (j << 1) + 0];
}
for (j = 0; j < 7; j++)
{
- gUnknown_03000D80[2 * j + 1] = gUnknown_03000D90[j] >> 8;
- gUnknown_03000D80[2 * j + 0] = gUnknown_03000D90[j];
+ sResendBlock8[2 * j + 1] = sResendBlock16[j] >> 8;
+ sResendBlock8[2 * j + 0] = sResendBlock16[j];
j++;j--; // Needed to match;
}
- sub_800D888(&Rfu.unk_9e8, gUnknown_03000D80);
- Rfu.unk_6c.unk_0c |= (1 << i);
+ RfuSendQueue_Enqueue(&Rfu.sendQueue, sResendBlock8);
+ Rfu.sendBlock.failedFlags |= (1 << i);
}
flags >>= 1;
}
}
-void sub_800F6FC(u8 a0)
+void Rfu_SetBlockReceivedFlag(u8 linkPlayerId)
{
- if (Rfu.unk_0c == 1 && a0)
- Rfu.unk_61[a0] = 1;
+ if (Rfu.parentChild == MODE_PARENT && linkPlayerId)
+ Rfu.numBlocksReceived[linkPlayerId] = 1;
else
- Rfu.unk_5c[a0] = 1;
+ Rfu.blockReceived[linkPlayerId] = TRUE;
}
-void sub_800F728(u8 a0)
+void Rfu_ResetBlockReceivedFlag(u8 linkPlayerId)
{
- Rfu.unk_5c[a0] = 0;
- Rfu.unk_80[a0].unk_12 = 0;
+ Rfu.blockReceived[linkPlayerId] = FALSE;
+ Rfu.recvBlock[linkPlayerId].receiving = 0;
}
-u8 sub_800F74C(const u8 *a0)
+static u8 sub_800F74C(const u8 *a0)
{
u8 i;
- if (Rfu.unk_0c == 1)
+ if (Rfu.parentChild == MODE_PARENT)
return FALSE;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- Rfu.unk_cde[i] = a0[i];
+ Rfu.linkPlayerIdx[i] = a0[i];
}
- return a0[Rfu.unk_c3e];
+ return a0[Rfu.childSlot];
}
-void rfu_func_080F97B8(void)
+static void RfuFunc_SendKeysToRfu(void)
{
if (gReceivedRemoteLinkPlayers
&& gHeldKeyCodeToSend != LINK_KEY_CODE_NULL
&& gLinkTransferringData != TRUE)
{
- gUnknown_03000D78[0]++;
- gHeldKeyCodeToSend |= (gUnknown_03000D78[0] << 8);
- sub_800FD14(0xbe00);
+ sHeldKeyCount++;
+ gHeldKeyCodeToSend |= (sHeldKeyCount << 8);
+ RfuPrepareSendBuffer(RFU_COMMAND_0xBE00);
}
}
-struct GFtgtGname *sub_800F7DC(void)
+struct GFtgtGname *GetHostRFUtgtGname(void)
{
- return &gUnknown_02022B14;
+ return &gHostRFUtgtGnameBuffer;
}
bool32 IsSendingKeysToRfu(void)
{
- return Rfu.linkRfuCallback == rfu_func_080F97B8;
+ return Rfu.callback == RfuFunc_SendKeysToRfu;
}
-void sub_800F804(void)
+void StartSendingKeysToRfu(void)
{
- Rfu.linkRfuCallback = rfu_func_080F97B8;
+ Rfu.callback = RfuFunc_SendKeysToRfu;
}
void ClearLinkRfuCallback(void)
{
- Rfu.linkRfuCallback = NULL;
+ Rfu.callback = NULL;
}
void sub_800F820(void)
{
- sub_800FD14(0x4400);
+ RfuPrepareSendBuffer(RFU_COMMAND_0x4400);
if (GetMultiplayerId() == 0)
gSendCmd[6] = GetBlenderArrowPosition();
gUnknown_020223C0++;
@@ -954,11 +1021,11 @@ void sub_800F820(void)
void sub_800F850(void)
{
- if (Rfu.linkRfuCallback == NULL)
- Rfu.linkRfuCallback = sub_800F820;
+ if (Rfu.callback == NULL)
+ Rfu.callback = sub_800F820;
}
-void sub_800F86C(u8 unused)
+static void RfuHandleReceiveCommand(u8 unused)
{
u16 i;
u16 j;
@@ -967,58 +1034,58 @@ void sub_800F86C(u8 unused)
{
switch (gRecvCmds[i][0] & 0xff00)
{
- case 0x7800:
- if (Rfu.unk_0c == 0 && gReceivedRemoteLinkPlayers != 0)
+ case RFU_COMMAND_0x7800:
+ if (Rfu.parentChild == MODE_CHILD && gReceivedRemoteLinkPlayers)
return;
// fallthrough
- case 0x7700:
- if (gRfuLinkStatus->parentChild == 0)
+ case RFU_COMMAND_0x7700:
+ if (gRfuLinkStatus->parentChild == MODE_CHILD)
{
Rfu.playerCount = gRecvCmds[i][1];
- Rfu.unk_cce = sub_800F74C((u8 *)(gRecvCmds[i] + 2));
+ Rfu.multiplayerId = sub_800F74C((u8 *)(gRecvCmds[i] + 2));
}
break;
- case 0x8800:
- if (Rfu.unk_80[i].unk_12 == 0)
+ case RFU_COMMAND_0x8800:
+ if (Rfu.recvBlock[i].receiving == 0)
{
- Rfu.unk_80[i].unk_00 = 0;
- Rfu.unk_80[i].unk_02 = gRecvCmds[i][1];
- Rfu.unk_80[i].unk_11 = gRecvCmds[i][2];
- Rfu.unk_80[i].unk_08 = 0;
- Rfu.unk_80[i].unk_12 = 1;
- Rfu.unk_5c[i] = 0;
+ Rfu.recvBlock[i].next = 0;
+ Rfu.recvBlock[i].count = gRecvCmds[i][1];
+ Rfu.recvBlock[i].owner = gRecvCmds[i][2];
+ Rfu.recvBlock[i].receivedFlags = 0;
+ Rfu.recvBlock[i].receiving = 1;
+ Rfu.blockReceived[i] = FALSE;
}
break;
- case 0x8900:
- if (Rfu.unk_80[i].unk_12 == 1)
+ case RFU_COMMAND_0x8900:
+ if (Rfu.recvBlock[i].receiving == 1)
{
- Rfu.unk_80[i].unk_00 = gRecvCmds[i][0] & 0xff;
- Rfu.unk_80[i].unk_08 |= (1 << Rfu.unk_80[i].unk_00);
+ Rfu.recvBlock[i].next = gRecvCmds[i][0] & 0xff;
+ Rfu.recvBlock[i].receivedFlags |= (1 << Rfu.recvBlock[i].next);
for (j = 0; j < 6; j++)
- gBlockRecvBuffer[i][Rfu.unk_80[i].unk_00 * 6 + j] = gRecvCmds[i][j + 1];
- if (Rfu.unk_80[i].unk_08 == gUnknown_082ED628[Rfu.unk_80[i].unk_02])
+ gBlockRecvBuffer[i][Rfu.recvBlock[i].next * 6 + j] = gRecvCmds[i][j + 1];
+ if (Rfu.recvBlock[i].receivedFlags == sAllBlocksReceived[Rfu.recvBlock[i].count])
{
- Rfu.unk_80[i].unk_12 = 2;
- sub_800F6FC(i);
- if (sub_800F7DC()->activity == 0x45 && gReceivedRemoteLinkPlayers != 0 && Rfu.unk_0c == 0)
- sub_8010A70(gBlockRecvBuffer);
+ Rfu.recvBlock[i].receiving = 2;
+ Rfu_SetBlockReceivedFlag(i);
+ if (GetHostRFUtgtGname()->activity == (ACTIVITY_CHAT | IN_UNION_ROOM) && gReceivedRemoteLinkPlayers != 0 && Rfu.parentChild == MODE_CHILD)
+ ValidateAndReceivePokemonSioInfo(gBlockRecvBuffer);
}
}
break;
- case 0xa100:
- sub_800FE84(gUnknown_082ED6B8[gRecvCmds[i][1]].buffer, (u16)gUnknown_082ED6B8[gRecvCmds[i][1]].size);
+ case RFU_COMMAND_0xA100:
+ Rfu_InitBlockSend(sUnknown_082ED6B8[gRecvCmds[i][1]].buffer, (u16)sUnknown_082ED6B8[gRecvCmds[i][1]].size);
break;
- case 0x5f00:
+ case RFU_COMMAND_0x5F00:
Rfu.unk_e4[i] = 1;
break;
- case 0x6600:
+ case RFU_COMMAND_0x6600:
if (Rfu.unk_100 == gRecvCmds[i][1])
Rfu.unk_e9[i] = 1;
break;
- case 0xed00:
- if (Rfu.unk_0c == 0)
+ case RFU_COMMAND_0xED00:
+ if (Rfu.parentChild == MODE_CHILD)
{
- if (gReceivedRemoteLinkPlayers != 0)
+ if (gReceivedRemoteLinkPlayers)
{
if (gRecvCmds[i][1] & gRfuLinkStatus->connSlotFlag)
{
@@ -1027,86 +1094,86 @@ void sub_800F86C(u8 unused)
Rfu.unk_ce4 = gRecvCmds[i][2];
}
Rfu.playerCount = gRecvCmds[i][3];
- sub_80109E8(gRecvCmds[i][1]);
+ ClearSelectedLinkPlayerIds(gRecvCmds[i][1]);
}
}
else
{
- sub_800FD14(0xee00);
+ RfuPrepareSendBuffer(RFU_COMMAND_0xEE00);
gSendCmd[1] = gRecvCmds[i][1];
gSendCmd[2] = gRecvCmds[i][2];
gSendCmd[3] = gRecvCmds[i][3];
}
break;
- case 0xee00:
- if (Rfu.unk_0c == 1)
+ case RFU_COMMAND_0xEE00:
+ if (Rfu.parentChild == MODE_PARENT)
{
Rfu.unk_ce3 |= gRecvCmds[i][1];
Rfu.unk_ce4 = gRecvCmds[i][2];
- sub_80109E8(gRecvCmds[i][1]);
+ ClearSelectedLinkPlayerIds(gRecvCmds[i][1]);
}
break;
- case 0x4400:
- case 0xbe00:
+ case RFU_COMMAND_0x4400:
+ case RFU_COMMAND_0xBE00:
gLinkPartnersHeldKeys[i] = gRecvCmds[i][1];
break;
}
- if (Rfu.unk_0c == 1 && Rfu.unk_61[i])
+ if (Rfu.parentChild == MODE_PARENT && Rfu.numBlocksReceived[i])
{
- if (Rfu.unk_61[i] == 4)
+ if (Rfu.numBlocksReceived[i] == 4)
{
- Rfu.unk_5c[i] = 1;
- Rfu.unk_61[i] = 0;
+ Rfu.blockReceived[i] = TRUE;
+ Rfu.numBlocksReceived[i] = 0;
}
else
- Rfu.unk_61[i]++;
+ Rfu.numBlocksReceived[i]++;
}
}
}
-bool8 sub_800FC60(void)
+static bool8 AreNoPlayersReceiving(void)
{
s32 i;
- for (i = 0; i < 5; i++)
+ for (i = 0; i < MAX_RFU_PLAYERS; i++)
{
- if (Rfu.unk_80[i].unk_12)
+ if (Rfu.recvBlock[i].receiving)
return FALSE;
}
return TRUE;
}
-bool8 sub_800FC88(void)
+static bool8 sub_800FC88(void)
{
s32 i;
for (i = 0; i < Rfu.playerCount; i++)
{
- if (Rfu.unk_80[i].unk_12 != 2 || Rfu.unk_5c[i] != 1)
+ if (Rfu.recvBlock[i].receiving != 2 || Rfu.blockReceived[i] != TRUE)
return FALSE;
}
return TRUE;
}
-void sub_800FCC4(struct UnkRfuStruct_2_Sub_6c *data)
+static void ResetSendDataManager(struct RfuBlockSend *data)
{
- data->unk_00 = 0;
- data->unk_02 = 0;
- data->unk_04 = NULL;
- data->unk_08 = 0;
- data->unk_10 = 0;
- data->unk_11 = 0;
- data->unk_12 = 0;
+ data->next = 0;
+ data->count = 0;
+ data->payload = NULL;
+ data->receivedFlags = 0;
+ data->sending = FALSE;
+ data->owner = 0;
+ data->receiving = 0;
}
-u8 sub_800FCD8(void)
+u8 Rfu_GetBlockReceivedStatus(void)
{
u8 flags = 0;
s32 i;
- for (i = 0; i < 5; i++)
+ for (i = 0; i < MAX_RFU_PLAYERS; i++)
{
- if (Rfu.unk_80[i].unk_12 == 2 && Rfu.unk_5c[i] == 1)
+ if (Rfu.recvBlock[i].receiving == 2 && Rfu.blockReceived[i] == TRUE)
{
flags |= (1 << i);
}
@@ -1114,7 +1181,7 @@ u8 sub_800FCD8(void)
return flags;
}
-void sub_800FD14(u16 command)
+static void RfuPrepareSendBuffer(u16 command)
{
u8 i;
u8 *buff;
@@ -1123,175 +1190,175 @@ void sub_800FD14(u16 command)
gSendCmd[0] = command;
switch (command)
{
- case 0x8800:
- gSendCmd[1] = Rfu.unk_6c.unk_02;
- gSendCmd[2] = Rfu.unk_6c.unk_11 + 0x80;
+ case RFU_COMMAND_0x8800:
+ gSendCmd[1] = Rfu.sendBlock.count;
+ gSendCmd[2] = Rfu.sendBlock.owner + 0x80;
break;
- case 0xa100:
- if (sub_800FC60())
+ case RFU_COMMAND_0xA100:
+ if (AreNoPlayersReceiving())
gSendCmd[1] = Rfu.unk_5a;
break;
- case 0x7700:
- case 0x7800:
+ case RFU_COMMAND_0x7700:
+ case RFU_COMMAND_0x7800:
tmp = Rfu.unk_ce2 ^ Rfu.unk_ce3;
- Rfu.playerCount = gUnknown_082ED695[tmp] + 1;
+ Rfu.playerCount = sUnknown_082ED695[tmp] + 1;
gSendCmd[1] = Rfu.playerCount;
buff = (u8 *)(gSendCmd + 2);
- for (i = 0; i < 4; i++)
- buff[i] = Rfu.unk_cde[i];
+ for (i = 0; i < RFU_CHILD_MAX; i++)
+ buff[i] = Rfu.linkPlayerIdx[i];
break;
- case 0x6600:
- case 0x5f00:
+ case RFU_COMMAND_0x6600:
+ case RFU_COMMAND_0x5F00:
gSendCmd[1] = Rfu.unk_100;
break;
- case 0x4400:
+ case RFU_COMMAND_0x4400:
gSendCmd[0] = command;
gSendCmd[1] = gMain.heldKeys;
break;
- case 0x2f00:
+ case RFU_COMMAND_0x2F00:
for (i = 0; i < 6; i++)
gSendCmd[1 + i] = Rfu.unk_f2[i];
break;
- case 0xbe00:
+ case RFU_COMMAND_0xBE00:
gSendCmd[1] = gHeldKeyCodeToSend;
break;
- case 0xee00:
+ case RFU_COMMAND_0xEE00:
break;
- case 0xed00:
+ case RFU_COMMAND_0xED00:
break;
}
}
void sub_800FE50(void *a0)
{
- if (gSendCmd[0] == 0 && !sub_8011A80())
+ if (gSendCmd[0] == 0 && !RfuHasErrored())
{
memcpy(Rfu.unk_f2, a0, sizeof(Rfu.unk_f2));
- sub_800FD14(0x2f00);
+ RfuPrepareSendBuffer(RFU_COMMAND_0x2F00);
}
}
-bool32 sub_800FE84(const u8 *src, size_t size)
+bool32 Rfu_InitBlockSend(const u8 *src, size_t size)
{
bool8 r4;
- if (Rfu.linkRfuCallback != NULL)
+ if (Rfu.callback != NULL)
return FALSE;
if (gSendCmd[0] != 0)
return FALSE;
- if (Rfu.unk_6c.unk_10 != 0)
+ if (Rfu.sendBlock.sending)
{
- gUnknown_02022B44.unk_83++;
+ sRfuDebug.unk_83++;
return FALSE;
}
r4 = (size % 12) != 0;
- Rfu.unk_6c.unk_11 = GetMultiplayerId();
- Rfu.unk_6c.unk_10 = 1;
- Rfu.unk_6c.unk_02 = (size / 12) + r4;
- Rfu.unk_6c.unk_00 = 0;
+ Rfu.sendBlock.owner = GetMultiplayerId();
+ Rfu.sendBlock.sending = TRUE;
+ Rfu.sendBlock.count = (size / 12) + r4;
+ Rfu.sendBlock.next = 0;
if (size > 0x100)
- Rfu.unk_6c.unk_04 = src;
+ Rfu.sendBlock.payload = src;
else
{
if (src != gBlockSendBuffer)
memcpy(gBlockSendBuffer, src, size);
- Rfu.unk_6c.unk_04 = gBlockSendBuffer;
+ Rfu.sendBlock.payload = gBlockSendBuffer;
}
- sub_800FD14(0x8800);
- Rfu.linkRfuCallback = rfufunc_80F9F44;
+ RfuPrepareSendBuffer(RFU_COMMAND_0x8800);
+ Rfu.callback = HandleBlockSend;
Rfu.unk_5b = 0;
return TRUE;
}
-void rfufunc_80F9F44(void)
+static void HandleBlockSend(void)
{
if (gSendCmd[0] == 0)
{
- sub_800FD14(0x8800);
- if (Rfu.unk_0c == 1)
+ RfuPrepareSendBuffer(RFU_COMMAND_0x8800);
+ if (Rfu.parentChild == MODE_PARENT)
{
if (++Rfu.unk_5b > 2)
- Rfu.linkRfuCallback = sub_800FFB0;
+ Rfu.callback = SendNextBlock;
}
else
{
- if ((gRecvCmds[GetMultiplayerId()][0] & 0xff00) == 0x8800)
- Rfu.linkRfuCallback = sub_800FFB0;
+ if ((gRecvCmds[GetMultiplayerId()][0] & 0xff00) == RFU_COMMAND_0x8800)
+ Rfu.callback = SendNextBlock;
}
}
}
-void sub_800FFB0(void)
+static void SendNextBlock(void)
{
s32 i;
- const u8 *src = Rfu.unk_6c.unk_04;
- gSendCmd[0] = 0x8900 | Rfu.unk_6c.unk_00;
- for (i = 0; i < 7; i++)
- gSendCmd[i + 1] = (src[(i << 1) + Rfu.unk_6c.unk_00 * 12 + 1] << 8) | src[(i << 1) + Rfu.unk_6c.unk_00 * 12 + 0];
- Rfu.unk_6c.unk_00++;
- if (Rfu.unk_6c.unk_02 <= Rfu.unk_6c.unk_00)
+ const u8 *src = Rfu.sendBlock.payload;
+ gSendCmd[0] = RFU_COMMAND_0x8900 | Rfu.sendBlock.next;
+ for (i = 0; i < CMD_LENGTH - 1; i++)
+ gSendCmd[i + 1] = (src[(i << 1) + Rfu.sendBlock.next * 12 + 1] << 8) | src[(i << 1) + Rfu.sendBlock.next * 12 + 0];
+ Rfu.sendBlock.next++;
+ if (Rfu.sendBlock.count <= Rfu.sendBlock.next)
{
- Rfu.unk_6c.unk_10 = 0;
- Rfu.linkRfuCallback = rfufunc_80FA020;
+ Rfu.sendBlock.sending = FALSE;
+ Rfu.callback = SendLastBlock;
}
}
-void rfufunc_80FA020(void)
+static void SendLastBlock(void)
{
- const u8 *src = Rfu.unk_6c.unk_04;
+ const u8 *src = Rfu.sendBlock.payload;
u8 mpId = GetMultiplayerId();
s32 i;
- if (Rfu.unk_0c == 0)
+ if (Rfu.parentChild == MODE_CHILD)
{
- gSendCmd[0] = (~0x76ff) | (Rfu.unk_6c.unk_02 - 1);
- for (i = 0; i < 7; i++)
- gSendCmd[i + 1] = (src[(i << 1) + (Rfu.unk_6c.unk_02 - 1) * 12 + 1] << 8) | src[(i << 1) + (Rfu.unk_6c.unk_02 - 1) * 12 + 0];
- if ((u8)gRecvCmds[mpId][0] == Rfu.unk_6c.unk_02 - 1)
+ gSendCmd[0] = RFU_COMMAND_0x8900 | (Rfu.sendBlock.count - 1);
+ for (i = 0; i < CMD_LENGTH - 1; i++)
+ gSendCmd[i + 1] = (src[(i << 1) + (Rfu.sendBlock.count - 1) * 12 + 1] << 8) | src[(i << 1) + (Rfu.sendBlock.count - 1) * 12 + 0];
+ if ((u8)gRecvCmds[mpId][0] == Rfu.sendBlock.count - 1)
{
- if (Rfu.unk_80[mpId].unk_08 != gUnknown_082ED628[Rfu.unk_80[mpId].unk_02])
+ if (Rfu.recvBlock[mpId].receivedFlags != sAllBlocksReceived[Rfu.recvBlock[mpId].count])
{
- sub_800F638(mpId, Rfu.unk_80[mpId].unk_08);
- gUnknown_02022B44.unk_64++;
+ HandleSendFailure(mpId, Rfu.recvBlock[mpId].receivedFlags);
+ sRfuDebug.unk_64++;
}
else
- Rfu.linkRfuCallback = NULL;
+ Rfu.callback = NULL;
}
}
else
- Rfu.linkRfuCallback = NULL;
+ Rfu.callback = NULL;
}
-bool8 sub_8010100(u8 a0)
+bool8 sub_8010100(u8 blockRequestType)
{
- Rfu.unk_5a = a0;
- sub_800FD14(0xa100);
+ Rfu.unk_5a = blockRequestType;
+ RfuPrepareSendBuffer(RFU_COMMAND_0xA100);
return TRUE;
}
-void sub_801011C(void)
+static void sub_801011C(void)
{
rfu_clearAllSlot();
rfu_LMAN_powerDownRFU();
gReceivedRemoteLinkPlayers = 0;
- Rfu.unk_ef = 1;
- Rfu.linkRfuCallback = NULL;
+ Rfu.isShuttingDown = TRUE;
+ Rfu.callback = NULL;
}
-void sub_8010148(void)
+static void sub_8010148(void)
{
rfu_REQ_disconnect(gRfuLinkStatus->connSlotFlag | gRfuLinkStatus->linkLossSlotFlag);
rfu_waitREQComplete();
sub_801011C();
}
-void sub_8010168(void)
+static void sub_8010168(void)
{
- if (Rfu.unk_0c == 0)
+ if (Rfu.parentChild == MODE_CHILD)
{
rfu_LMAN_requestChangeAgbClockMaster();
Rfu.unk_ce4 = 2;
}
else
- Rfu.linkRfuCallback = sub_8010148;
+ Rfu.callback = sub_8010148;
}
void LinkRfu_FatalError(void)
@@ -1301,7 +1368,7 @@ void LinkRfu_FatalError(void)
Rfu.unk_ce3 = gRfuLinkStatus->connSlotFlag | gRfuLinkStatus->linkLossSlotFlag;
}
-void sub_80101CC(void)
+static void sub_80101CC(void)
{
s32 i;
u8 playerCount = Rfu.playerCount;
@@ -1315,31 +1382,31 @@ void sub_80101CC(void)
if (count == playerCount)
{
gBattleTypeFlags &= ~BATTLE_TYPE_20;
- if (Rfu.unk_0c == 0)
+ if (Rfu.parentChild == MODE_CHILD)
{
- Rfu.unk_ee = 3;
+ Rfu.errorState = 3;
sub_8010168();
}
else
- Rfu.linkRfuCallback = sub_8010168;
+ Rfu.callback = sub_8010168;
}
}
-void sub_801022C(void)
+static void sub_801022C(void)
{
if (gSendCmd[0] == 0 && Rfu.unk_ce8 == 0)
{
- sub_800FD14(0x5f00);
- Rfu.linkRfuCallback = sub_80101CC;
+ RfuPrepareSendBuffer(RFU_COMMAND_0x5F00);
+ Rfu.callback = sub_80101CC;
}
}
-void sub_8010264(u8 taskId)
+static void sub_8010264(u8 taskId)
{
- if (Rfu.linkRfuCallback == NULL)
+ if (Rfu.callback == NULL)
{
Rfu.unk_cd9 = 1;
- Rfu.linkRfuCallback = sub_801022C;
+ Rfu.callback = sub_801022C;
DestroyTask(taskId);
}
}
@@ -1350,18 +1417,17 @@ void task_add_05_task_del_08FA224_when_no_RfuFunc(void)
CreateTask(sub_8010264, 5);
}
-void sub_80102B8(void)
+static void sub_80102B8(void)
{
u8 playerCount;
u8 i;
if (GetMultiplayerId() != 0)
{
- u8 r4 = Rfu.unk_124.unk_8c2;
- if (r4 == 0 && Rfu.unk_fe > 0x3c)
+ if (Rfu.recvQueue.count == 0 && Rfu.unk_fe > 60)
{
- sub_800FD14(0x6600);
- Rfu.unk_fe = r4;
+ RfuPrepareSendBuffer(RFU_COMMAND_0x6600);
+ Rfu.unk_fe = 0;
}
}
playerCount = GetLinkPlayerCount();
@@ -1375,31 +1441,31 @@ void sub_80102B8(void)
for (i = 0; i < MAX_RFU_PLAYERS; i++)
Rfu.unk_e9[i] = 0;
Rfu.unk_100++;
- Rfu.linkRfuCallback = NULL;
+ Rfu.callback = NULL;
}
Rfu.unk_fe++;
}
-void sub_8010358(void)
+static void sub_8010358(void)
{
- if (Rfu.unk_124.unk_8c2 == 0 && gSendCmd[0] == 0)
+ if (Rfu.recvQueue.count == 0 && gSendCmd[0] == 0)
{
- sub_800FD14(0x6600);
- Rfu.linkRfuCallback = sub_80102B8;
+ RfuPrepareSendBuffer(RFU_COMMAND_0x6600);
+ Rfu.callback = sub_80102B8;
}
}
-void sub_8010390(void)
+static void sub_8010390(void)
{
u8 i;
u8 playerCount;
if (GetMultiplayerId() != 0)
{
- if (Rfu.unk_124.unk_8c2 == 0 && gSendCmd[0] == 0)
+ if (Rfu.recvQueue.count == 0 && gSendCmd[0] == 0)
{
- sub_800FD14(0x6600);
- Rfu.linkRfuCallback = sub_80102B8;
+ RfuPrepareSendBuffer(RFU_COMMAND_0x6600);
+ Rfu.callback = sub_80102B8;
}
}
else
@@ -1412,10 +1478,10 @@ void sub_8010390(void)
}
if (i == playerCount)
{
- if (Rfu.unk_124.unk_8c2 == 0 && gSendCmd[0] == 0)
+ if (Rfu.recvQueue.count == 0 && gSendCmd[0] == 0)
{
- sub_800FD14(0x6600);
- Rfu.linkRfuCallback = sub_8010358;
+ RfuPrepareSendBuffer(RFU_COMMAND_0x6600);
+ Rfu.callback = sub_8010358;
}
}
}
@@ -1423,19 +1489,19 @@ void sub_8010390(void)
void sub_8010434(void)
{
- if (Rfu.linkRfuCallback == NULL)
+ if (Rfu.callback == NULL)
{
- Rfu.linkRfuCallback = sub_8010390;
+ Rfu.callback = sub_8010390;
Rfu.unk_fe = 0;
}
}
-bool32 sub_8010454(u32 a0)
+bool32 IsRfuSerialNumberValid(u32 serialNo)
{
s32 i;
- for (i = 0; gUnknown_082ED6E0[i] != a0; i++)
+ for (i = 0; sAcceptedSerialNos[i] != serialNo; i++)
{
- if (gUnknown_082ED6E0[i] == 0xFFFF)
+ if (sAcceptedSerialNos[i] == 0xFFFF)
return FALSE;
}
return TRUE;
@@ -1445,7 +1511,7 @@ u8 sub_801048C(bool32 a0)
{
if (a0 == FALSE)
return rfu_LMAN_setLinkRecovery(0, 0);
- rfu_LMAN_setLinkRecovery(1, 0x258);
+ rfu_LMAN_setLinkRecovery(1, 600);
return 0;
}
@@ -1455,71 +1521,73 @@ void sub_80104B0(void)
rfu_LMAN_stopManager(FALSE);
}
-u8 rfu_get_multiplayer_id(void)
+u8 Rfu_GetMultiplayerId(void)
{
- if (Rfu.unk_0c == 1)
+ if (Rfu.parentChild == MODE_PARENT)
return 0;
- return Rfu.unk_cce;
+ return Rfu.multiplayerId;
}
-u8 sub_80104F4(void)
+u8 Rfu_GetLinkPlayerCount(void)
{
return Rfu.playerCount;
}
bool8 IsLinkRfuTaskFinished(void)
{
- if (Rfu.unk_f1 == 2)
+ if (Rfu.status == RFU_STATUS_CONNECTION_ERROR)
return FALSE;
- return Rfu.linkRfuCallback ? FALSE : TRUE;
+ return Rfu.callback ? FALSE : TRUE;
}
-void sub_8010528(void)
+static void CallRfuFunc(void)
{
- if (Rfu.linkRfuCallback)
- Rfu.linkRfuCallback();
+ if (Rfu.callback)
+ Rfu.callback();
}
-bool8 sub_8010540(void)
+static bool8 CheckForLeavingGroupMembers(void)
{
s32 i;
- bool8 retval = FALSE;
- for (i = 0; i < 4; i++)
+ bool8 memberLeft = FALSE;
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- if (Rfu.unk_cd1[i] < 5 || Rfu.unk_cd1[i] > 6)
+ if (Rfu.partnerSendStatuses[i] < RFU_STATUS_JOIN_GROUP_OK
+ || Rfu.partnerSendStatuses[i] > RFU_STATUS_JOIN_GROUP_NO)
{
- if (gRfuSlotStatusNI[i]->recv.state == 0x46 || gRfuSlotStatusNI[i]->recv.state == 0x48)
+ if (gRfuSlotStatusNI[i]->recv.state == SLOT_STATE_RECV_SUCCESS
+ || gRfuSlotStatusNI[i]->recv.state == SLOT_STATE_RECV_SUCCESS_AND_SENDSIDE_UNKNOWN)
{
- if (Rfu.unk_cd5[i] == 8)
+ if (Rfu.partnerRecvStatuses[i] == RFU_STATUS_LEAVE_GROUP_NOTICE)
{
- Rfu.unk_cd1[i] = 9;
- Rfu.unk_cd5[i] = 10;
- rfu_clearSlot(8, i);
- rfu_NI_setSendData(1 << i, 8, Rfu.unk_cd1 + i, 1);
- retval = TRUE;
+ Rfu.partnerSendStatuses[i] = RFU_STATUS_LEAVE_GROUP;
+ Rfu.partnerRecvStatuses[i] = RFU_STATUS_10;
+ rfu_clearSlot(TYPE_NI_RECV, i);
+ rfu_NI_setSendData(1 << i, 8, &Rfu.partnerSendStatuses[i], 1);
+ memberLeft = TRUE;
}
}
- else if (gRfuSlotStatusNI[Rfu.unk_c3e]->recv.state == 0x47)
- rfu_clearSlot(8, i);
+ else if (gRfuSlotStatusNI[Rfu.childSlot]->recv.state == SLOT_STATE_RECV_FAILED)
+ rfu_clearSlot(TYPE_NI_RECV, i);
{
}
}
}
- return retval;
+ return memberLeft;
}
bool32 sub_80105EC(void)
{
u8 flags = 0;
s32 i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- if (Rfu.unk_cd5[i] == 11)
+ if (Rfu.partnerRecvStatuses[i] == RFU_STATUS_11)
{
flags |= (1 << i);
- Rfu.unk_cd5[i] = 0;
+ Rfu.partnerRecvStatuses[i] = RFU_STATUS_OK;
}
}
if (flags)
@@ -1527,335 +1595,339 @@ bool32 sub_80105EC(void)
rfu_REQ_disconnect(flags);
rfu_waitREQComplete();
}
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- if (Rfu.unk_cd5[i] == 10 || Rfu.unk_cd5[i] == 11)
+ if (Rfu.partnerRecvStatuses[i] == RFU_STATUS_10
+ || Rfu.partnerRecvStatuses[i] == RFU_STATUS_11)
return TRUE;
}
return FALSE;
}
-bool32 sub_801064C(u16 a0, const u8 *a1)
+bool32 HasTrainerLeftPartnersList(u16 trainerId, const u8 *name)
{
- u8 r1 = sub_8011CE4(a1, a0);
- if (r1 == 0xFF)
+ u8 idx = GetPartnerIndexByNameAndTrainerID(name, trainerId);
+ if (idx == 0xFF)
return TRUE;
- if (Rfu.unk_cd1[r1] == 9)
+ if (Rfu.partnerSendStatuses[idx] == RFU_STATUS_LEAVE_GROUP)
return TRUE;
return FALSE;
}
-void sub_8010688(u8 a0, u16 a1, const u8 *a2)
+void SendRfuStatusToPartner(u8 status, u16 trainerId, const u8 *name)
{
- u8 r4 = sub_8011CE4(a2, a1);
- Rfu.unk_cd1[r4] = a0;
- rfu_clearSlot(4, r4);
- rfu_NI_setSendData(1 << r4, 8, Rfu.unk_cd1 + r4, 1);
+ u8 idx = GetPartnerIndexByNameAndTrainerID(name, trainerId);
+ Rfu.partnerSendStatuses[idx] = status;
+ rfu_clearSlot(TYPE_NI_SEND, idx);
+ rfu_NI_setSendData(1 << idx, 8, &Rfu.partnerSendStatuses[idx], 1);
}
-void sub_80106D4(void)
+void SendLeaveGroupNotice(void)
{
- Rfu.unk_c85 = 8;
- rfu_clearSlot(4, Rfu.unk_c3e);
- rfu_NI_setSendData(1 << Rfu.unk_c3e, 8, &Rfu.unk_c85, 1);
+ Rfu.unk_c85 = RFU_STATUS_LEAVE_GROUP_NOTICE;
+ rfu_clearSlot(TYPE_NI_SEND, Rfu.childSlot);
+ rfu_NI_setSendData(1 << Rfu.childSlot, 8, &Rfu.unk_c85, 1);
}
-u32 sub_8010714(u16 a0, const u8 *a1)
+u32 WaitSendRfuStatusToPartner(u16 trainerId, const u8 *name)
{
- u8 r0 = sub_8011CE4(a1, a0);
- if (r0 == 0xFF)
+ u8 idx = GetPartnerIndexByNameAndTrainerID(name, trainerId);
+ if (idx == 0xFF)
return 2;
- if (gRfuSlotStatusNI[r0]->send.state == 0)
+ if (gRfuSlotStatusNI[idx]->send.state == 0)
return 1;
return 0;
}
-void sub_8010750(void)
+static void UpdateChildStatuses(void)
{
s32 i;
- sub_8010540();
- for (i = 0; i < 4; i++)
+ CheckForLeavingGroupMembers();
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- if (gRfuSlotStatusNI[i]->send.state == 0x26 || gRfuSlotStatusNI[i]->send.state == 0x27)
+ if (gRfuSlotStatusNI[i]->send.state == SLOT_STATE_SEND_SUCCESS
+ || gRfuSlotStatusNI[i]->send.state == SLOT_STATE_SEND_FAILED)
{
- if (Rfu.unk_cd5[i] == 10)
- Rfu.unk_cd5[i] = 11;
- rfu_clearSlot(4, i);
+ if (Rfu.partnerRecvStatuses[i] == RFU_STATUS_10)
+ Rfu.partnerRecvStatuses[i] = RFU_STATUS_11;
+ rfu_clearSlot(TYPE_NI_SEND, i);
}
}
}
-s32 sub_80107A0(void)
+static s32 sub_80107A0(void)
{
- s32 retval = 0;
+ s32 status = RFU_STATUS_OK;
if (Rfu.unk_c85 == 8)
{
- if (gRfuSlotStatusNI[Rfu.unk_c3e]->send.state == 0x26 || gRfuSlotStatusNI[Rfu.unk_c3e]->send.state == 0x27)
- rfu_clearSlot(4, Rfu.unk_c3e);
+ if (gRfuSlotStatusNI[Rfu.childSlot]->send.state == SLOT_STATE_SEND_SUCCESS
+ || gRfuSlotStatusNI[Rfu.childSlot]->send.state == SLOT_STATE_SEND_FAILED)
+ rfu_clearSlot(TYPE_NI_SEND, Rfu.childSlot);
}
- if (gRfuSlotStatusNI[Rfu.unk_c3e]->recv.state == 0x46 || gRfuSlotStatusNI[Rfu.unk_c3e]->recv.state == 0x48)
+ if (gRfuSlotStatusNI[Rfu.childSlot]->recv.state == SLOT_STATE_RECV_SUCCESS
+ || gRfuSlotStatusNI[Rfu.childSlot]->recv.state == SLOT_STATE_RECV_SUCCESS_AND_SENDSIDE_UNKNOWN)
{
- rfu_clearSlot(8, Rfu.unk_c3e);
- sub_8011A64(Rfu.unk_c86, 0);
- retval = Rfu.unk_c86;
+ rfu_clearSlot(TYPE_NI_RECV, Rfu.childSlot);
+ RfuSetStatus(Rfu.recvStatus, 0);
+ status = Rfu.recvStatus;
}
- else if (gRfuSlotStatusNI[Rfu.unk_c3e]->recv.state == 0x47)
+ else if (gRfuSlotStatusNI[Rfu.childSlot]->recv.state == SLOT_STATE_RECV_FAILED)
{
- rfu_clearSlot(8, Rfu.unk_c3e);
- retval = 6;
+ rfu_clearSlot(TYPE_NI_RECV, Rfu.childSlot);
+ status = RFU_STATUS_JOIN_GROUP_NO;
}
- return retval;
+ return status;
}
-void sub_801084C(u8 taskId)
+static void sub_801084C(u8 taskId)
{
s32 i;
- if (Rfu.unk_f1 == 1 || Rfu.unk_f1 == 2)
+ if (Rfu.status == RFU_STATUS_FATAL_ERROR || Rfu.status == RFU_STATUS_CONNECTION_ERROR)
{
Rfu.unk_ce8 = 0;
DestroyTask(taskId);
}
switch (gTasks[taskId].data[0])
{
- case 0:
- if (sub_800FC60())
- {
- ResetBlockReceivedFlags();
- sub_800B348();
- gTasks[taskId].data[0]++;
- }
- break;
- case 1:
- if (Rfu.unk_0c == 1)
- {
- if (gReceivedRemoteLinkPlayers)
- sub_800FD14(0x7800);
- else
- sub_800FD14(0x7700);
- gTasks[taskId].data[0] = 101;
- }
+ case 0:
+ if (AreNoPlayersReceiving())
+ {
+ ResetBlockReceivedFlags();
+ sub_800B348();
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ if (Rfu.parentChild == MODE_PARENT)
+ {
+ if (gReceivedRemoteLinkPlayers)
+ RfuPrepareSendBuffer(RFU_COMMAND_0x7800);
else
- gTasks[taskId].data[0] = 2;
- break;
- case 101:
- if (gSendCmd[0] == 0)
- gTasks[taskId].data[0] = 2;
- break;
- case 2:
- if (Rfu.playerCount)
- gTasks[taskId].data[0]++;
- break;
- case 3:
- if (Rfu.unk_0c == 1)
+ RfuPrepareSendBuffer(RFU_COMMAND_0x7700);
+ gTasks[taskId].data[0] = 101;
+ }
+ else
+ gTasks[taskId].data[0] = 2;
+ break;
+ case 101:
+ if (gSendCmd[0] == 0)
+ gTasks[taskId].data[0] = 2;
+ break;
+ case 2:
+ if (Rfu.playerCount)
+ gTasks[taskId].data[0]++;
+ break;
+ case 3:
+ if (Rfu.parentChild == MODE_PARENT)
+ {
+ if (AreNoPlayersReceiving())
{
- if (sub_800FC60())
- {
- Rfu.unk_5a = 0;
- sub_800FD14(0xa100);
- gTasks[taskId].data[0]++;
- }
- }
- else
+ Rfu.unk_5a = 0;
+ RfuPrepareSendBuffer(RFU_COMMAND_0xA100);
gTasks[taskId].data[0]++;
- break;
- case 4:
- if (sub_800FC88())
- gTasks[taskId].data[0]++;
- break;
- case 5:
- for (i = 0; i < Rfu.playerCount; i++)
- {
- sub_800B3A4(i);
- sub_800F728(i);
}
+ }
+ else
gTasks[taskId].data[0]++;
- break;
- case 6:
- DestroyTask(taskId);
- gReceivedRemoteLinkPlayers = 1;
- Rfu.unk_ce8 = 0;
- rfu_LMAN_setLinkRecovery(1, 0x258);
- if (Rfu.unk_ce6)
+ break;
+ case 4:
+ if (sub_800FC88())
+ gTasks[taskId].data[0]++;
+ break;
+ case 5:
+ for (i = 0; i < Rfu.playerCount; i++)
+ {
+ LinkPlayerFromBlock(i);
+ Rfu_ResetBlockReceivedFlag(i);
+ }
+ gTasks[taskId].data[0]++;
+ break;
+ case 6:
+ DestroyTask(taskId);
+ gReceivedRemoteLinkPlayers = TRUE;
+ Rfu.unk_ce8 = FALSE;
+ rfu_LMAN_setLinkRecovery(1, 600);
+ if (Rfu.unk_ce6)
+ {
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- for (i = 0; i < 4; i++)
+ if ((Rfu.unk_ce6 >> i) & 1)
{
- if ((Rfu.unk_ce6 >> i) & 1)
- {
- Rfu.unk_ce5 = 1 << i;
- Rfu.unk_ce6 ^= (1 << i);
- }
+ Rfu.unk_ce5 = 1 << i;
+ Rfu.unk_ce6 ^= (1 << i);
}
}
- break;
+ }
+ break;
}
}
-void sub_80109E8(u16 a0)
+static void ClearSelectedLinkPlayerIds(u16 selected)
{
s32 i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- if ((a0 >> i) & 1)
- Rfu.unk_cde[i] = 0;
+ if ((selected >> i) & 1)
+ Rfu.linkPlayerIdx[i] = 0;
}
}
-void sub_8010A14(const struct UnkRfuStruct_8010A14 *a0)
+static void ReceiveRfuLinkPlayers(const struct SioInfo *sioInfo)
{
s32 i;
- Rfu.playerCount = a0->unk_0f;
- for (i = 0; i < 4; i++)
- Rfu.unk_cde[i] = a0->unk_10[i];
+ Rfu.playerCount = sioInfo->playerCount;
+ for (i = 0; i < RFU_CHILD_MAX; i++)
+ Rfu.linkPlayerIdx[i] = sioInfo->linkPlayerIdx[i];
for (i = 0; i < MAX_RFU_PLAYERS; i++)
{
- gLinkPlayers[i] = a0->unk_14[i];
+ gLinkPlayers[i] = sioInfo->linkPlayers[i];
sub_800B524(gLinkPlayers + i);
}
}
-void sub_8010A70(void *a0)
+static void ValidateAndReceivePokemonSioInfo(void *recvBuffer)
{
- if (strcmp(gUnknown_082ED7EC, a0) == 0)
+ if (strcmp(sASCII_PokemonSioInfo, recvBuffer) == 0)
{
- sub_8010A14(a0);
- CpuFill16(0, a0, sizeof(struct UnkRfuStruct_8010A14));
+ ReceiveRfuLinkPlayers(recvBuffer);
+ CpuFill16(0, recvBuffer, sizeof(struct SioInfo));
ResetBlockReceivedFlag(0);
}
}
-void sub_8010AAC(u8 taskId)
+static void Task_ExchangeLinkPlayers(u8 taskId)
{
s32 i;
struct LinkPlayerBlock *r2;
- struct UnkRfuStruct_8010A14 *r5;
- u8 r4 = Rfu.unk_cde[gUnknown_082ED68C[Rfu.unk_ce9]];
- if (Rfu.unk_f1 == 1 || Rfu.unk_f1 == 2)
+ struct SioInfo *r5;
+ u8 r4 = Rfu.linkPlayerIdx[sUnknown_082ED68C[Rfu.unk_ce9]];
+ if (Rfu.status == RFU_STATUS_FATAL_ERROR || Rfu.status == RFU_STATUS_CONNECTION_ERROR)
{
Rfu.unk_ce8 = 0;
DestroyTask(taskId);
}
switch (gTasks[taskId].data[0])
{
- case 0:
- if (gSendCmd[0] == 0)
- {
- ResetBlockReceivedFlag(r4);
- sub_800FD14(0x7800);
- gTasks[taskId].data[0]++;
- }
- break;
- case 1:
- if (gSendCmd[0] == 0)
- gTasks[taskId].data[0]++;
- break;
- case 2:
- if ((GetBlockReceivedStatus() >> r4) & 1)
- {
- ResetBlockReceivedFlag(r4);
- r2 = (struct LinkPlayerBlock *)gBlockRecvBuffer[r4];
- gLinkPlayers[r4] = r2->linkPlayer;
- sub_800B524(gLinkPlayers + r4);
- gTasks[taskId].data[0]++;
- }
- break;
- case 3:
- r5 = (struct UnkRfuStruct_8010A14 *)gBlockSendBuffer;
- memcpy(r5->unk_00, gUnknown_082ED7EC, sizeof gUnknown_082ED7EC);
- r5->unk_0f = Rfu.playerCount;
- for (i = 0; i < 4; i++)
- r5->unk_10[i] = Rfu.unk_cde[i];
- memcpy(r5->unk_14, gLinkPlayers, sizeof gLinkPlayers);
+ case 0:
+ if (gSendCmd[0] == 0)
+ {
+ ResetBlockReceivedFlag(r4);
+ RfuPrepareSendBuffer(RFU_COMMAND_0x7800);
gTasks[taskId].data[0]++;
- // fallthrough
- case 4:
- r5 = (struct UnkRfuStruct_8010A14 *)gBlockSendBuffer;
- r5->unk_0f = Rfu.playerCount;
- for (i = 0; i < 4; i++)
- r5->unk_10[i] = Rfu.unk_cde[i];
- memcpy(r5->unk_14, gLinkPlayers, sizeof gLinkPlayers);
- if (SendBlock(0, gBlockSendBuffer, 0xa0))
- gTasks[taskId].data[0]++;
- break;
- case 5:
- if (IsLinkTaskFinished() && GetBlockReceivedStatus() & 1)
+ }
+ break;
+ case 1:
+ if (gSendCmd[0] == 0)
+ gTasks[taskId].data[0]++;
+ break;
+ case 2:
+ if ((GetBlockReceivedStatus() >> r4) & 1)
+ {
+ ResetBlockReceivedFlag(r4);
+ r2 = (struct LinkPlayerBlock *)gBlockRecvBuffer[r4];
+ gLinkPlayers[r4] = r2->linkPlayer;
+ sub_800B524(gLinkPlayers + r4);
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 3:
+ r5 = (struct SioInfo *)gBlockSendBuffer;
+ memcpy(r5->magic, sASCII_PokemonSioInfo, sizeof sASCII_PokemonSioInfo);
+ r5->playerCount = Rfu.playerCount;
+ for (i = 0; i < RFU_CHILD_MAX; i++)
+ r5->linkPlayerIdx[i] = Rfu.linkPlayerIdx[i];
+ memcpy(r5->linkPlayers, gLinkPlayers, sizeof gLinkPlayers);
+ gTasks[taskId].data[0]++;
+ // fallthrough
+ case 4:
+ r5 = (struct SioInfo *)gBlockSendBuffer;
+ r5->playerCount = Rfu.playerCount;
+ for (i = 0; i < RFU_CHILD_MAX; i++)
+ r5->linkPlayerIdx[i] = Rfu.linkPlayerIdx[i];
+ memcpy(r5->linkPlayers, gLinkPlayers, sizeof gLinkPlayers);
+ if (SendBlock(0, gBlockSendBuffer, 0xa0))
+ gTasks[taskId].data[0]++;
+ break;
+ case 5:
+ if (IsLinkTaskFinished() && GetBlockReceivedStatus() & 1)
+ {
+ CpuFill16(0, gBlockRecvBuffer, sizeof(struct SioInfo));
+ ResetBlockReceivedFlag(0);
+ Rfu.unk_ce8 = 0;
+ if (Rfu.unk_ce6)
{
- CpuFill16(0, gBlockRecvBuffer, sizeof(struct UnkRfuStruct_8010A14));
- ResetBlockReceivedFlag(0);
- Rfu.unk_ce8 = 0;
- if (Rfu.unk_ce6)
+ for (i = 0; i < 4; i++)
{
- for (i = 0; i < 4; i++)
+ if ((Rfu.unk_ce6 >> i) & 1)
{
- if ((Rfu.unk_ce6 >> i) & 1)
- {
- Rfu.unk_ce5 = 1 << i;
- Rfu.unk_ce6 ^= (1 << i);
- Rfu.unk_ce8 = 1;
- break;
- }
+ Rfu.unk_ce5 = 1 << i;
+ Rfu.unk_ce6 ^= (1 << i);
+ Rfu.unk_ce8 = 1;
+ break;
}
}
- DestroyTask(taskId);
}
- break;
+ DestroyTask(taskId);
+ }
+ break;
}
}
-void sub_8010D0C(u8 taskId)
+static void sub_8010D0C(u8 taskId)
{
- if (Rfu.unk_f1 == 1 || Rfu.unk_f1 == 2)
+ if (Rfu.status == RFU_STATUS_FATAL_ERROR || Rfu.status == RFU_STATUS_CONNECTION_ERROR)
DestroyTask(taskId);
switch (gTasks[taskId].data[0])
{
- case 0:
- if (Rfu.playerCount)
- {
- sub_800B348();
- SendBlock(0, gBlockSendBuffer, sizeof(struct LinkPlayerBlock));
- gTasks[taskId].data[0]++;
- }
- break;
- case 1:
- if (IsLinkTaskFinished())
- gTasks[taskId].data[0]++;
- break;
- case 2:
- if (GetBlockReceivedStatus() & 1)
- {
- sub_8010A14((const struct UnkRfuStruct_8010A14 *)gBlockRecvBuffer);
- ResetBlockReceivedFlag(0);
- gReceivedRemoteLinkPlayers = 1;
- DestroyTask(taskId);
- }
- break;
+ case 0:
+ if (Rfu.playerCount)
+ {
+ sub_800B348();
+ SendBlock(0, gBlockSendBuffer, sizeof(struct LinkPlayerBlock));
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ if (IsLinkTaskFinished())
+ gTasks[taskId].data[0]++;
+ break;
+ case 2:
+ if (GetBlockReceivedStatus() & 1)
+ {
+ ReceiveRfuLinkPlayers((const struct SioInfo *)gBlockRecvBuffer);
+ ResetBlockReceivedFlag(0);
+ gReceivedRemoteLinkPlayers = 1;
+ DestroyTask(taskId);
+ }
+ break;
}
}
-void sub_8010DB4(void)
+static void RfuCheckErrorStatus(void)
{
- if (Rfu.unk_ee == 1 && lman.childClockSlave_flag == 0)
+ if (Rfu.errorState == 1 && lman.childClockSlave_flag == 0)
{
if (gMain.callback2 == c2_mystery_gift_e_reader_run || lman.init_param->mboot_flag)
gWirelessCommType = 2;
SetMainCallback2(CB2_LinkError);
gMain.savedCallback = CB2_LinkError;
- sub_800AF18((Rfu.unk_0a << 16) | (Rfu.unk_10 << 8) | Rfu.unk_12, Rfu.unk_124.unk_8c2, Rfu.unk_9e8.unk_232, sub_8011A74() == 2);
- Rfu.unk_ee = 2;
+ BufferLinkErrorInfo((Rfu.linkmanMsg << 16) | (Rfu.unk_10 << 8) | Rfu.unk_12, Rfu.recvQueue.count, Rfu.sendQueue.count, RfuGetStatus() == RFU_STATUS_CONNECTION_ERROR);
+ Rfu.errorState = 2;
CloseLink();
}
- else if (Rfu.unk_9e8.unk_233 == 1 || Rfu.unk_124.unk_8c3 == 1)
+ else if (Rfu.sendQueue.full == TRUE || Rfu.recvQueue.full == TRUE)
{
if (lman.childClockSlave_flag)
rfu_LMAN_requestChangeAgbClockMaster();
- sub_8011A64(1, 0x7000);
- sub_8011170(0x7000);
+ RfuSetStatus(RFU_STATUS_FATAL_ERROR, 0x7000);
+ GetLinkmanErrorParams(0x7000);
}
}
-void rfu_REQ_recvData_then_sendData(void)
+static void rfu_REQ_recvData_then_sendData(void)
{
if (lman.parent_child == 1)
{
@@ -1868,21 +1940,21 @@ void rfu_REQ_recvData_then_sendData(void)
bool32 sub_8010EC0(void)
{
bool32 retval = FALSE;
- Rfu.unk_ccd = 0;
+ Rfu.parentId = 0;
rfu_LMAN_manager_entity(Random2());
- if (Rfu.unk_ef == 0)
+ if (!Rfu.isShuttingDown)
{
- switch (Rfu.unk_0c)
+ switch (Rfu.parentChild)
{
- case 1:
- sub_800F0F8();
- break;
- case 0:
- retval = sub_800F4F0();
- break;
- case 2:
- rfu_REQ_recvData_then_sendData();
- break;
+ case MODE_PARENT:
+ sub_800F0F8();
+ break;
+ case MODE_CHILD:
+ retval = RfuProcessEnqueuedRecvBlock();
+ break;
+ case 2:
+ rfu_REQ_recvData_then_sendData();
+ break;
}
}
return retval;
@@ -1891,42 +1963,42 @@ bool32 sub_8010EC0(void)
bool32 sub_8010F1C(void)
{
bool32 retval = FALSE;
- if (Rfu.unk_ef == 0)
+ if (!Rfu.isShuttingDown)
{
- if (Rfu.unk_0c == 1)
+ if (Rfu.parentChild == MODE_PARENT)
retval = sub_800F1E0();
- sub_8010DB4();
+ RfuCheckErrorStatus();
}
return retval;
}
-void sub_8010F48(void)
+static void CopyPlayerNameToUnameBuffer(void)
{
- StringCopy(gUnknown_02022B22, gSaveBlock2Ptr->playerName);
+ StringCopy(gHostRFUtgtUnameBuffer, gSaveBlock2Ptr->playerName);
}
-void sub_8010F60(void)
+void ClearAndInitHostRFUtgtGname(void)
{
- memset(&gUnknown_02022B14, 0, 0xD);
- sub_800DD94(&gUnknown_02022B14, 0, 0, 0);
+ memset(&gHostRFUtgtGnameBuffer, 0, RFU_GAME_NAME_LENGTH);
+ InitHostRFUtgtGname(&gHostRFUtgtGnameBuffer, ACTIVITY_NONE, FALSE, 0);
}
-void sub_8010F84(u8 a0, u32 a1, u32 a2)
+void SetHostRFUtgtGname(u8 activity, u32 child_sprite_genders, bool32 started)
{
- sub_800DD94(&gUnknown_02022B14, a0, a2, a1);
+ InitHostRFUtgtGname(&gHostRFUtgtGnameBuffer, activity, started, child_sprite_genders);
}
-void sub_8010FA0(bool32 a0, bool32 a1)
+void SetGnameBufferWonderFlags(bool32 hasNews, bool32 hasCard)
{
- gUnknown_02022B14.unk_00.hasNews = a0;
- gUnknown_02022B14.unk_00.hasCard = a1;
+ gHostRFUtgtGnameBuffer.unk_00.hasNews = hasNews;
+ gHostRFUtgtGnameBuffer.unk_00.hasCard = hasCard;
}
-void sub_8010FCC(u32 type, u32 species, u32 level)
+void SetTradeBoardRegisteredMonInfo(u32 type, u32 species, u32 level)
{
- gUnknown_02022B14.type = type;
- gUnknown_02022B14.species = species;
- gUnknown_02022B14.level = level;
+ gHostRFUtgtGnameBuffer.type = type;
+ gHostRFUtgtGnameBuffer.species = species;
+ gHostRFUtgtGnameBuffer.level = level;
}
u8 sub_801100C(s32 a0)
@@ -1939,244 +2011,252 @@ u8 sub_801100C(s32 a0)
void sub_801103C(void)
{
- struct GFtgtGname *r5 = &gUnknown_02022B14;
+ struct GFtgtGname *r5 = &gHostRFUtgtGnameBuffer;
s32 i;
for (i = 1; i < GetLinkPlayerCount(); i++)
r5->child_sprite_gender[i - 1] = sub_801100C(i);
}
-void sub_8011068(u8 a0)
+void UpdateGameData_GroupLockedIn(bool8 started)
{
- gUnknown_02022B14.started = a0;
- rfu_REQ_configGameData(0, 2, (const u8 *)&gUnknown_02022B14, gUnknown_02022B22);
+ gHostRFUtgtGnameBuffer.started = started;
+ rfu_REQ_configGameData(0, 2, (void *)&gHostRFUtgtGnameBuffer, gHostRFUtgtUnameBuffer);
}
-void sub_8011090(u8 a0, u32 a1, u32 a2)
+void UpdateGameData_SetActivity(u8 activity, u32 flags, bool32 started)
{
- if (a0)
- sub_8010F84(a0, a1, a2);
- rfu_REQ_configGameData(0, 2, (const u8 *)&gUnknown_02022B14, gUnknown_02022B22);
+ if (activity != ACTIVITY_NONE)
+ SetHostRFUtgtGname(activity, flags, started);
+ rfu_REQ_configGameData(0, 2, (void *)&gHostRFUtgtGnameBuffer, gHostRFUtgtUnameBuffer);
}
void sub_80110B8(u32 a0)
{
s32 i;
- u32 r5;
- u32 r7;
+ u32 numConnectedChildren;
+ u32 child_sprite_genders;
s32 r8;
- if (sub_800F7DC()->activity == 0x45)
+ if (GetHostRFUtgtGname()->activity == (ACTIVITY_CHAT | IN_UNION_ROOM))
{
- r5 = 0;
- r7 = 0;
+ numConnectedChildren = 0;
+ child_sprite_genders = 0;
r8 = Rfu.unk_ce2 ^ Rfu.unk_ce3;
for (i = 0; i < 4; i++)
{
if ((r8 >> i) & 1)
{
- r7 |= ((0x80 | ((gLinkPlayers[Rfu.unk_cde[i]].gender & 1) << 3) | (gLinkPlayers[Rfu.unk_cde[i]].trainerId & 7)) << (r5 << 3));
- r5++;
- if (r5 == a0 - 1)
+ child_sprite_genders |= ((0x80 | ((gLinkPlayers[Rfu.linkPlayerIdx[i]].gender & 1) << 3) | (gLinkPlayers[Rfu.linkPlayerIdx[i]].trainerId & 7)) << (numConnectedChildren << 3));
+ numConnectedChildren++;
+ if (numConnectedChildren == a0 - 1)
break;
}
}
- sub_8011090(0x45, r7, 0);
+ UpdateGameData_SetActivity((ACTIVITY_CHAT | IN_UNION_ROOM), child_sprite_genders, FALSE);
}
}
-void sub_8011170(u32 a0)
+void GetLinkmanErrorParams(u32 msg)
{
- if (Rfu.unk_ee == 0)
+ if (Rfu.errorState == 0)
{
Rfu.unk_10 = lman.param[0];
Rfu.unk_12 = lman.param[1];
- Rfu.unk_0a = a0;
- Rfu.unk_ee = 1;
+ Rfu.linkmanMsg = msg;
+ Rfu.errorState = 1;
}
}
-void sub_80111A0(void)
+static void ResetErrorState(void)
{
- Rfu.unk_ee = 0;
+ Rfu.errorState = 0;
}
void sub_80111B0(bool32 a0)
{
if (!a0)
- Rfu.unk_ee = 0;
+ Rfu.errorState = 0;
else
- Rfu.unk_ee = 4;
+ Rfu.errorState = 4;
}
-void sub_80111DC(void)
+static void sub_80111DC(void)
{
sub_8011E94(lman.acceptSlot_flag, 1);
- Rfu.linkRfuCallback = NULL;
+ Rfu.callback = NULL;
}
-void sub_80111FC(void)
+static void sub_80111FC(void)
{
- Rfu.linkRfuCallback = sub_80111DC;
+ Rfu.callback = sub_80111DC;
}
-void sub_801120C(u8 a0, u8 unused1)
+static void sub_801120C(u8 msg, u8 paramCount)
{
u8 i;
- u8 r6 = 0;
- switch (a0)
+ u8 disconnectFlag = 0;
+ switch (msg)
{
- case 0x00:
- Rfu.unk_04 = 2;
+ case LMAN_MSG_INITIALIZE_COMPLETED:
+ Rfu.state = 2;
break;
- case 0x10:
+ case LMAN_MSG_NEW_CHILD_CONNECT_DETECTED:
break;
- case 0x11:
+ case LMAN_MSG_NEW_CHILD_CONNECT_ACCEPTED:
sub_80115EC(lman.param[0]);
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
if ((lman.param[0] >> i) & 1)
{
struct GFtgtGname *structPtr = (void *)gRfuLinkStatus->partner[i].gname;
- if (structPtr->activity == sub_800F7DC()->activity)
+ if (structPtr->activity == GetHostRFUtgtGname()->activity)
{
- Rfu.unk_cd1[i] = 0;
- Rfu.unk_cd5[i] = 0;
- rfu_setRecvBuffer(0x20, i, Rfu.unk_cd5 + i, 1);
+ Rfu.partnerSendStatuses[i] = RFU_STATUS_OK;
+ Rfu.partnerRecvStatuses[i] = RFU_STATUS_OK;
+ rfu_setRecvBuffer(TYPE_NI, i, &Rfu.partnerRecvStatuses[i], 1);
}
else
{
- r6 |= (1 << i);
+ disconnectFlag |= (1 << i);
}
}
}
- if (r6)
+ if (disconnectFlag)
{
- rfu_REQ_disconnect(r6);
+ rfu_REQ_disconnect(disconnectFlag);
rfu_waitREQComplete();
}
break;
- case 0x12:
+ case LMAN_MSG_NEW_CHILD_CONNECT_REJECTED:
break;
- case 0x13:
+ case LMAN_MSG_SEARCH_CHILD_PERIOD_EXPIRED:
break;
- case 0x14:
- if (Rfu.unk_ce7 != lman.acceptSlot_flag)
+ case LMAN_MSG_END_WAIT_CHILD_NAME:
+ if (Rfu.acceptSlot_flag != lman.acceptSlot_flag)
{
- rfu_REQ_disconnect(Rfu.unk_ce7 ^ lman.acceptSlot_flag);
+ rfu_REQ_disconnect(Rfu.acceptSlot_flag ^ lman.acceptSlot_flag);
rfu_waitREQComplete();
}
- Rfu.unk_04 = 0x11;
+ Rfu.state = 17;
break;
- case 0x31:
- Rfu.unk_f0 = 1;
+ case LMAN_MSG_LINK_LOSS_DETECTED_AND_START_RECOVERY:
+ Rfu.linkLossRecoveryState = 1;
break;
- case 0x32:
- Rfu.unk_f0 = 3;
+ case LMAN_MSG_LINK_RECOVERY_SUCCESSED:
+ Rfu.linkLossRecoveryState = 3;
break;
- case 0x30:
- case 0x33:
- Rfu.unk_f0 = 4;
+ case LMAN_MSG_LINK_LOSS_DETECTED_AND_DISCONNECTED:
+ case LMAN_MSG_LINK_RECOVERY_FAILED_AND_DISCONNECTED:
+ Rfu.linkLossRecoveryState = 4;
Rfu.unk_ce2 &= ~lman.param[0];
if (gReceivedRemoteLinkPlayers == 1)
{
if (Rfu.unk_ce2 == 0)
- sub_8011170(a0);
+ GetLinkmanErrorParams(msg);
else
sub_80111FC();
}
- sub_8011A64(2, a0);
+ RfuSetStatus(RFU_STATUS_CONNECTION_ERROR, msg);
break;
case 0x34:
break;
- case 0x42 ... 0x44:
+ case LMAN_MSG_RFU_POWER_DOWN:
+ case LMAN_MSG_MANAGER_STOPPED:
+ case LMAN_MSG_MANAGER_FORCED_STOPPED_AND_RFU_RESET:
break;
- case 0xf3:
- sub_8011A64(1, a0);
- sub_8011170(a0);
- Rfu.unk_ef = 1;
+ case LMAN_MSG_LMAN_API_ERROR_RETURN:
+ RfuSetStatus(RFU_STATUS_FATAL_ERROR, msg);
+ GetLinkmanErrorParams(msg);
+ Rfu.isShuttingDown = TRUE;
break;
- case 0xf0 ... 0xf2:
- case 0xff:
- sub_8011170(a0);
- sub_8011A64(1, a0);
- Rfu.unk_cdb = 1;
+ case LMAN_MSG_REQ_API_ERROR:
+ case LMAN_MSG_WATCH_DOG_TIMER_ERROR:
+ case LMAN_MSG_CLOCK_SLAVE_MS_CHANGE_ERROR_BY_DMA:
+ case LMAN_MSG_RFU_FATAL_ERROR:
+ GetLinkmanErrorParams(msg);
+ RfuSetStatus(RFU_STATUS_FATAL_ERROR, msg);
+ Rfu.unk_cdb = TRUE;
break;
}
}
-void sub_8011404(u8 a0, u8 unused1)
+void sub_8011404(u8 msg, u8 unused1)
{
- switch (a0)
+ switch (msg)
{
- case 0x00:
- Rfu.unk_04 = 6;
+ case LMAN_MSG_INITIALIZE_COMPLETED:
+ Rfu.state = 6;
break;
- case 0x20:
- Rfu.unk_ccd = lman.param[0];
+ case LMAN_MSG_PARENT_FOUND:
+ Rfu.parentId = lman.param[0];
break;
- case 0x21:
+ case LMAN_MSG_SEARCH_PARENT_PERIOD_EXPIRED:
break;
- case 0x22:
- Rfu.unk_c3e = lman.param[0];
+ case LMAN_MSG_CONNECT_PARENT_SUCCESSED:
+ Rfu.childSlot = lman.param[0];
break;
- case 0x23:
- sub_8011A64(2, a0);
+ case LMAN_MSG_CONNECT_PARENT_FAILED:
+ RfuSetStatus(RFU_STATUS_CONNECTION_ERROR, msg);
break;
- case 0x24:
- Rfu.unk_04 = 11;
+ case LMAN_MSG_CHILD_NAME_SEND_COMPLETED:
+ Rfu.state = 11;
Rfu.unk_c85 = 0;
- Rfu.unk_c86 = 0;
- rfu_setRecvBuffer(0x20, Rfu.unk_c3e, &Rfu.unk_c86, 1);
- rfu_setRecvBuffer(0x10, Rfu.unk_c3e, Rfu.unk_c3f, 70);
+ Rfu.recvStatus = RFU_STATUS_OK;
+ rfu_setRecvBuffer(TYPE_NI, Rfu.childSlot, &Rfu.recvStatus, 1);
+ rfu_setRecvBuffer(TYPE_UNI, Rfu.childSlot, Rfu.unk_c3f, 70);
break;
- case 0x25:
- sub_8011A64(2, 0x25);
+ case LMAN_MSG_CHILD_NAME_SEND_FAILED_AND_DISCONNECTED:
+ RfuSetStatus(RFU_STATUS_CONNECTION_ERROR, msg);
break;
- case 0x30:
- Rfu.unk_f0 = 2;
- if (Rfu.unk_c86 == 6)
+ case LMAN_MSG_LINK_LOSS_DETECTED_AND_DISCONNECTED:
+ Rfu.linkLossRecoveryState = 2;
+ if (Rfu.recvStatus == RFU_STATUS_JOIN_GROUP_NO)
break;
- case 0x33:
- if (Rfu.unk_f0 != 2)
- Rfu.unk_f0 = 4;
- if (Rfu.unk_c86 != 9)
- sub_8011A64(2, a0);
- nullsub_5(gUnknown_082ED7FC, 5, 5);
+ case LMAN_MSG_LINK_RECOVERY_FAILED_AND_DISCONNECTED:
+ if (Rfu.linkLossRecoveryState != 2)
+ Rfu.linkLossRecoveryState = 4;
+ if (Rfu.recvStatus != RFU_STATUS_LEAVE_GROUP)
+ RfuSetStatus(RFU_STATUS_CONNECTION_ERROR, msg);
+ Debug_PrintString(sASCII_LinkLossDisconnect, 5, 5);
if (gReceivedRemoteLinkPlayers == 1)
- sub_8011170(a0);
+ GetLinkmanErrorParams(msg);
break;
- case 0x31:
- Rfu.unk_f0 = 1;
- nullsub_5(gUnknown_082ED814, 5, 5);
+ case LMAN_MSG_LINK_LOSS_DETECTED_AND_START_RECOVERY:
+ Rfu.linkLossRecoveryState = 1;
+ Debug_PrintString(sASCII_LinkLossRecoveryNow, 5, 5);
break;
- case 0x32:
- Rfu.unk_f0 = 3;
- Rfu.unk_c3c = 1;
+ case LMAN_MSG_LINK_RECOVERY_SUCCESSED:
+ Rfu.linkLossRecoveryState = 3;
+ Rfu.linkRecovered = TRUE;
break;
case 0x34:
break;
- case 0x42 ... 0x44:
+ case LMAN_MSG_RFU_POWER_DOWN:
+ case LMAN_MSG_MANAGER_STOPPED:
+ case LMAN_MSG_MANAGER_FORCED_STOPPED_AND_RFU_RESET:
break;
- case 0xF3:
- sub_8011A64(1, a0);
- sub_8011170(a0);
- Rfu.unk_ef = 1;
+ case LMAN_MSG_LMAN_API_ERROR_RETURN:
+ RfuSetStatus(RFU_STATUS_FATAL_ERROR, msg);
+ GetLinkmanErrorParams(msg);
+ Rfu.isShuttingDown = TRUE;
break;
- case 0xF0 ... 0xF2:
- case 0xFF:
- sub_8011A64(1, a0);
- sub_8011170(a0);
- Rfu.unk_cdb = 1;
+ case LMAN_MSG_REQ_API_ERROR:
+ case LMAN_MSG_WATCH_DOG_TIMER_ERROR:
+ case LMAN_MSG_CLOCK_SLAVE_MS_CHANGE_ERROR_BY_DMA:
+ case LMAN_MSG_RFU_FATAL_ERROR:
+ RfuSetStatus(RFU_STATUS_FATAL_ERROR, msg);
+ GetLinkmanErrorParams(msg);
+ Rfu.unk_cdb = TRUE;
break;
}
}
-void sub_80115EC(s32 a0)
+static void sub_80115EC(s32 a0)
{
s32 i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
if ((a0 >> i) & 1)
{
@@ -2186,17 +2266,17 @@ void sub_80115EC(s32 a0)
}
}
-u8 sub_8011628(s32 a0)
+static u8 GetNewChildrenInUnionRoomChat(s32 a0)
{
u8 ret = 0;
u8 i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
if ((a0 >> i) & 1)
{
struct GFtgtGname *structPtr = (void *)gRfuLinkStatus->partner[i].gname;
- if (structPtr->activity == 0x45)
+ if (structPtr->activity == (ACTIVITY_CHAT | IN_UNION_ROOM))
ret |= (1 << i);
}
}
@@ -2204,22 +2284,22 @@ u8 sub_8011628(s32 a0)
return ret;
}
-void sub_8011674(u8 a0, u8 unused1)
+static void sub_8011674(u8 msg, u8 paramCount)
{
u8 r1;
- switch (a0)
+ switch (msg)
{
- case 0x00:
- Rfu.unk_04 = 0x11;
+ case LMAN_MSG_INITIALIZE_COMPLETED:
+ Rfu.state = 17;
break;
- case 0x10:
- sub_8011A64(4, 0);
+ case LMAN_MSG_NEW_CHILD_CONNECT_DETECTED:
+ RfuSetStatus(RFU_STATUS_NEW_CHILD_DETECTED, 0);
break;
- case 0x11:
- if (sub_800F7DC()->activity == 0x45 && Rfu.unk_cd9 == 0)
+ case LMAN_MSG_NEW_CHILD_CONNECT_ACCEPTED:
+ if (GetHostRFUtgtGname()->activity == (ACTIVITY_CHAT | IN_UNION_ROOM) && Rfu.unk_cd9 == 0)
{
- u8 idx = sub_8011628(lman.param[0]);
+ u8 idx = GetNewChildrenInUnionRoomChat(lman.param[0]);
if (idx != 0)
{
r1 = 1 << sub_800E87C(idx);
@@ -2227,7 +2307,7 @@ void sub_8011674(u8 a0, u8 unused1)
{
Rfu.unk_ce5 = r1;
Rfu.unk_ce6 |= (r1 ^ idx);
- Rfu.unk_ce8 = 1;
+ Rfu.unk_ce8 = TRUE;
}
else
{
@@ -2240,38 +2320,38 @@ void sub_8011674(u8 a0, u8 unused1)
Rfu.unk_ce4 = 2;
}
}
- else if (sub_800F7DC()->activity == 0x54)
+ else if (GetHostRFUtgtGname()->activity == (ACTIVITY_PLYRTALK | IN_UNION_ROOM))
{
rfu_REQ_disconnect(lman.acceptSlot_flag);
rfu_waitREQComplete();
}
sub_80115EC(lman.param[0]);
break;
- case 0x12:
+ case LMAN_MSG_NEW_CHILD_CONNECT_REJECTED:
break;
- case 0x13:
+ case LMAN_MSG_SEARCH_CHILD_PERIOD_EXPIRED:
break;
- case 0x14:
- if (sub_800F7DC()->activity != 0x45 && lman.acceptCount > 1)
+ case LMAN_MSG_END_WAIT_CHILD_NAME:
+ if (GetHostRFUtgtGname()->activity != (ACTIVITY_CHAT | IN_UNION_ROOM) && lman.acceptCount > 1)
{
r1 = 1 << sub_800E87C(lman.param[0]);
rfu_REQ_disconnect(lman.acceptSlot_flag ^ r1);
rfu_waitREQComplete();
}
- if (Rfu.unk_04 == 0xF)
- Rfu.unk_04 = 0x10;
+ if (Rfu.state == 15)
+ Rfu.state = 16;
break;
break;
- case 0x20:
- Rfu.unk_ccd = lman.param[0];
+ case LMAN_MSG_PARENT_FOUND:
+ Rfu.parentId = lman.param[0];
break;
- case 0x21:
+ case LMAN_MSG_SEARCH_PARENT_PERIOD_EXPIRED:
break;
- case 0x22:
- Rfu.unk_c3e = lman.param[0];
+ case LMAN_MSG_CONNECT_PARENT_SUCCESSED:
+ Rfu.childSlot = lman.param[0];
break;
- case 0x23:
- Rfu.unk_04 = 0x12;
+ case LMAN_MSG_CONNECT_PARENT_FAILED:
+ Rfu.state = 18;
if (Rfu.unk_ccf < 2)
{
Rfu.unk_ccf++;
@@ -2279,68 +2359,72 @@ void sub_8011674(u8 a0, u8 unused1)
}
else
{
- sub_8011A64(2, a0);
+ RfuSetStatus(RFU_STATUS_CONNECTION_ERROR, msg);
}
break;
- case 0x24:
- Rfu.unk_04 = 0xD;
- sub_8011A64(3, 0);
- rfu_setRecvBuffer(0x10, Rfu.unk_c3e, Rfu.unk_c3f, 70);
+ case LMAN_MSG_CHILD_NAME_SEND_COMPLETED:
+ Rfu.state = 13;
+ RfuSetStatus(RFU_STATUS_CHILD_SEND_COMPLETE, 0);
+ rfu_setRecvBuffer(TYPE_UNI, Rfu.childSlot, Rfu.unk_c3f, 70);
break;
- case 0x25:
- sub_8011A64(2, a0);
+ case LMAN_MSG_CHILD_NAME_SEND_FAILED_AND_DISCONNECTED:
+ RfuSetStatus(RFU_STATUS_CONNECTION_ERROR, msg);
break;
- case 0x31:
+ case LMAN_MSG_LINK_LOSS_DETECTED_AND_START_RECOVERY:
if (lman.acceptSlot_flag & lman.param[0])
- Rfu.unk_f0 = 1;
+ Rfu.linkLossRecoveryState = 1;
break;
- case 0x32:
- Rfu.unk_f0 = 3;
- if (gRfuLinkStatus->parentChild == 0)
- Rfu.unk_c3c = 1;
+ case LMAN_MSG_LINK_RECOVERY_SUCCESSED:
+ Rfu.linkLossRecoveryState = 3;
+ if (gRfuLinkStatus->parentChild == MODE_CHILD)
+ Rfu.linkRecovered = TRUE;
break;
- case 0x30:
- Rfu.unk_f0 = 2;
- case 0x33:
- if (Rfu.unk_f0 != 2)
- Rfu.unk_f0 = 4;
- if (Rfu.unk_0c == 1)
+ case LMAN_MSG_LINK_LOSS_DETECTED_AND_DISCONNECTED:
+ Rfu.linkLossRecoveryState = 2;
+ case LMAN_MSG_LINK_RECOVERY_FAILED_AND_DISCONNECTED:
+ if (Rfu.linkLossRecoveryState != 2)
+ Rfu.linkLossRecoveryState = 4;
+ if (Rfu.parentChild == MODE_PARENT)
{
if (gReceivedRemoteLinkPlayers == 1)
{
Rfu.unk_ce2 &= ~(lman.param[0]);
if (Rfu.unk_ce2 == 0)
- sub_8011170(a0);
+ GetLinkmanErrorParams(msg);
else
sub_80111FC();
}
}
else if (Rfu.unk_ce4 != 2 && gReceivedRemoteLinkPlayers == 1)
{
- sub_8011170(a0);
+ GetLinkmanErrorParams(msg);
rfu_LMAN_stopManager(0);
}
- if (gRfuLinkStatus->parentChild == 0xFF && lman.pcswitch_flag == 0 && FuncIsActiveTask(sub_800EB44) == TRUE)
- Rfu.unk_04 = 0x11;
+ if (gRfuLinkStatus->parentChild == MODE_NEUTRAL && lman.pcswitch_flag == 0 && FuncIsActiveTask(Task_LinkRfu_UnionRoomListen) == TRUE)
+ Rfu.state = 17;
- sub_8011A64(2, a0);
+ RfuSetStatus(RFU_STATUS_CONNECTION_ERROR, msg);
break;
- case 0x40:
+ case LMAN_MSG_LINK_DISCONNECTED_BY_USER:
Rfu.unk_ce3 = 0;
break;
- case 0x42 ... 0x44:
+ case LMAN_MSG_RFU_POWER_DOWN:
+ case LMAN_MSG_MANAGER_STOPPED:
+ case LMAN_MSG_MANAGER_FORCED_STOPPED_AND_RFU_RESET:
break;
- case 0xF3:
- sub_8011A64(1, a0);
- sub_8011170(a0);
- Rfu.unk_ef = 1;
+ case LMAN_MSG_LMAN_API_ERROR_RETURN:
+ RfuSetStatus(RFU_STATUS_FATAL_ERROR, msg);
+ GetLinkmanErrorParams(msg);
+ Rfu.isShuttingDown = TRUE;
break;
- case 0xF0 ... 0xF2:
- case 0xFF:
- sub_8011170(a0);
- sub_8011A64(1, a0);
- Rfu.unk_cdb = 0;
+ case LMAN_MSG_REQ_API_ERROR:
+ case LMAN_MSG_WATCH_DOG_TIMER_ERROR:
+ case LMAN_MSG_CLOCK_SLAVE_MS_CHANGE_ERROR_BY_DMA:
+ case LMAN_MSG_RFU_FATAL_ERROR:
+ GetLinkmanErrorParams(msg);
+ RfuSetStatus(RFU_STATUS_FATAL_ERROR, msg);
+ Rfu.unk_cdb = FALSE;
break;
}
}
@@ -2350,21 +2434,22 @@ void sub_8011A50(void)
Rfu.unk_ce4 = 2;
}
-void sub_8011A64(u8 a0, u16 a1)
+void RfuSetStatus(u8 status, u16 msg)
{
- Rfu.unk_f1 = a0;
- Rfu.unk_0a = a1;
+ Rfu.status = status;
+ Rfu.linkmanMsg = msg;
}
-u8 sub_8011A74(void)
+u8 RfuGetStatus(void)
{
- return Rfu.unk_f1;
+ return Rfu.status;
}
-bool32 sub_8011A80(void)
+bool32 RfuHasErrored(void)
{
- u32 var = sub_8011A74() - 1;
- if (var < 2)
+ // RFU_STATUS_OK will underflow here intentionally
+ u32 var = RfuGetStatus() - 1;
+ if (var < RFU_STATUS_CONNECTION_ERROR)
return TRUE;
else
return FALSE;
@@ -2377,7 +2462,7 @@ bool32 sub_8011A9C(void)
bool8 Rfu_IsMaster(void)
{
- return Rfu.unk_0c;
+ return Rfu.parentChild;
}
void RfuVSync(void)
@@ -2390,14 +2475,14 @@ void sub_8011AC8(void)
CpuFill32(0, gRecvCmds, sizeof(gRecvCmds));
}
-void sub_8011AE8(void)
+static void sub_8011AE8(void)
{
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
-void sub_8011AFC(void)
+static void sub_8011AFC(void)
{
s32 i;
@@ -2408,8 +2493,8 @@ void sub_8011AFC(void)
SetVBlankCallback(sub_8011AE8);
if (IsWirelessAdapterConnected())
{
- gLinkType = LINKTYPE_0x1111;
- sub_800B488();
+ gLinkType = LINKTYPE_TRADE;
+ SetWirelessCommType1();
OpenLink();
SeedRng(gMain.vblankCounter2);
for (i = 0; i < 4; i++)
@@ -2420,29 +2505,29 @@ void sub_8011AFC(void)
AnimateSprites();
BuildOamBuffer();
UpdatePaletteFade();
- sub_8011BA4();
+ CreateTask_RfuIdle();
SetMainCallback2(sub_8011BF8);
}
}
-bool32 sub_8011B90(void)
+bool32 IsUnionRoomListenTaskActive(void)
{
- return FuncIsActiveTask(sub_800EB44);
+ return FuncIsActiveTask(Task_LinkRfu_UnionRoomListen);
}
-void sub_8011BA4(void)
+void CreateTask_RfuIdle(void)
{
- if (!FuncIsActiveTask(nullsub_89))
- Rfu.unk_66 = CreateTask(nullsub_89, 0);
+ if (!FuncIsActiveTask(Task_Idle))
+ Rfu.idleTaskId = CreateTask(Task_Idle, 0);
}
-void sub_8011BD0(void)
+void DestroyTask_RfuIdle(void)
{
- if (FuncIsActiveTask(nullsub_89) == TRUE)
- DestroyTask(Rfu.unk_66);
+ if (FuncIsActiveTask(Task_Idle) == TRUE)
+ DestroyTask(Rfu.idleTaskId);
}
-void sub_8011BF8(void)
+static void sub_8011BF8(void)
{
RunTasks();
AnimateSprites();
@@ -2450,77 +2535,77 @@ void sub_8011BF8(void)
UpdatePaletteFade();
}
-void sub_8011C10(u32 a0)
+void InitializeRfuLinkManager_LinkLeader(u32 a0)
{
- Rfu.unk_0c = 1;
- sub_8010F48();
+ Rfu.parentChild = MODE_PARENT;
+ CopyPlayerNameToUnameBuffer();
rfu_LMAN_initializeManager(sub_801120C, NULL);
- gUnknown_02022B2C = gUnknown_082ED608;
- gUnknown_02022B2C.availSlot_flag = gUnknown_082ED620[a0 - 1];
- sub_800EE78();
+ sRfuReqConfig = sRfuReqConfigTemplate;
+ sRfuReqConfig.availSlot_flag = sAvailSlots[a0 - 1];
+ CreateTask_LinkLeaderSearchForChildren();
}
-void sub_8011C5C(void)
+void InitializeRfuLinkManager_JoinGroup(void)
{
- Rfu.unk_0c = 0;
- sub_8010F48();
+ Rfu.parentChild = MODE_CHILD;
+ CopyPlayerNameToUnameBuffer();
rfu_LMAN_initializeManager(sub_8011404, sub_800ED34);
- sub_800EF00();
+ CreateTask_JoinGroupSearchForParent();
}
-void sub_8011C84(void)
+void InitializeRfuLinkManager_EnterUnionRoom(void)
{
- Rfu.unk_0c = 2;
- sub_8010F48();
+ Rfu.parentChild = 2;
+ CopyPlayerNameToUnameBuffer();
rfu_LMAN_initializeManager(sub_8011674, NULL);
- gUnknown_02022B2C = gUnknown_082ED608;
- gUnknown_02022B2C.linkRecovery_enable = 0;
- gUnknown_02022B2C.linkRecovery_period = 0x258;
- Rfu.unk_67 = CreateTask(sub_800EB44, 1);
+ sRfuReqConfig = sRfuReqConfigTemplate;
+ sRfuReqConfig.linkRecovery_enable = 0;
+ sRfuReqConfig.linkRecovery_period = 600;
+ Rfu.searchTaskId = CreateTask(Task_LinkRfu_UnionRoomListen, 1);
}
-u16 ReadU16(const void *ptr)
+static u16 ReadU16(const void *ptr)
{
const u8 *ptr_ = ptr;
return (ptr_[1] << 8) | (ptr_[0]);
}
-u8 sub_8011CE4(const u8 *a0, u16 a1)
+static u8 GetPartnerIndexByNameAndTrainerID(const u8 *name, u16 id)
{
u8 i;
- u8 ret = 0xFF;
+ u8 idx = 0xFF;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
u16 trainerId = ReadU16(gRfuLinkStatus->partner[i].gname + 2);
- if (sub_8010454(gRfuLinkStatus->partner[i].serialNo)
- && !StringCompare(a0, gRfuLinkStatus->partner[i].uname)
- && a1 == trainerId)
+ if (IsRfuSerialNumberValid(gRfuLinkStatus->partner[i].serialNo)
+ && !StringCompare(name, gRfuLinkStatus->partner[i].uname)
+ && id == trainerId)
{
- ret = i;
+ idx = i;
if (gRfuLinkStatus->partner[i].slot != 0xFF)
break;
}
}
- return ret;
+ return idx;
}
-void sub_8011D6C(u32 a0)
+static void RfuReqDisconnectSlot(u32 slot)
{
- rfu_REQ_disconnect(a0);
+ rfu_REQ_disconnect(slot);
rfu_waitREQComplete();
- Rfu.unk_ce2 &= ~(a0);
+ Rfu.unk_ce2 &= ~(slot);
rfu_clearSlot(1, Rfu.unk_cda);
- rfu_UNI_setSendData(Rfu.unk_ce2, Rfu.unk_c87, 70);
+ rfu_UNI_setSendData(Rfu.unk_ce2, Rfu.recvCmds, 70);
Rfu.unk_cda = sub_800E87C(Rfu.unk_ce2);
}
-void sub_8011DC0(const u8 *ptr, u16 a1)
+void RequestDisconnectSlotByTrainerNameAndId(const u8 *name, u16 id)
{
- u8 var = sub_8011CE4(ptr, a1);
+ u8 var = GetPartnerIndexByNameAndTrainerID(name, id);
if (var != 0xFF)
- sub_8011D6C(1 << var);
+ RfuReqDisconnectSlot(1 << var);
}
void sub_8011DE0(u32 a0)
@@ -2530,9 +2615,9 @@ void sub_8011DE0(u32 a0)
s32 i;
u8 var = 0;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- if (Rfu.unk_cde[i] == a0 && (Rfu.unk_ce2 >> i) & 1)
+ if (Rfu.linkPlayerIdx[i] == a0 && (Rfu.unk_ce2 >> i) & 1)
var |= 1 << i;
}
if (var)
@@ -2540,20 +2625,20 @@ void sub_8011DE0(u32 a0)
}
}
-void sub_8011E2C(u8 taskId)
+static void sub_8011E2C(u8 taskId)
{
if (gSendCmd[0] == 0 && Rfu.unk_ce8 == 0)
{
- sub_800FD14(0xED00);
+ RfuPrepareSendBuffer(RFU_COMMAND_0xED00);
gSendCmd[1] = gTasks[taskId].data[0];
gSendCmd[2] = gTasks[taskId].data[1];
- Rfu.playerCount -= gUnknown_082ED695[gTasks[taskId].data[0]];
+ Rfu.playerCount -= sUnknown_082ED695[gTasks[taskId].data[0]];
gSendCmd[3] = Rfu.playerCount;
DestroyTask(taskId);
}
}
-void sub_8011E94(u32 a0, u32 a1)
+static void sub_8011E94(u32 a0, u32 a1)
{
u8 taskId = FindTaskIdByFunc(sub_8011E2C);
if (taskId == 0xFF)
@@ -2569,28 +2654,29 @@ void sub_8011E94(u32 a0, u32 a1)
gTasks[taskId].data[1] = a1;
}
-void sub_8011EF4(u8 taskId)
+static void Task_RfuReconnectWithParent(u8 taskId)
{
s16 *data = gTasks[taskId].data;
if (sub_800EE94())
{
- u8 id = sub_8011CE4((u8*)data, ReadU16(&data[8]));
+ u8 id = GetPartnerIndexByNameAndTrainerID((u8*)data, ReadU16(&data[8]));
if (id != 0xFF)
{
if (gRfuLinkStatus->partner[id].slot != 0xFF)
{
Rfu.unk_c3d = id;
- if (sub_800EEBC())
+ if (IsParentSuccessfullyReconnected())
DestroyTask(taskId);
}
- else if (sub_800F7DC()->activity == 0x15 || sub_800F7DC()->activity == 0x16)
+ else if (GetHostRFUtgtGname()->activity == ACTIVITY_WONDER_CARD2
+ || GetHostRFUtgtGname()->activity == ACTIVITY_WONDER_NEWS2)
{
data[15]++;
}
else
{
- sub_8011A64(2, 0x7000);
+ RfuSetStatus(RFU_STATUS_CONNECTION_ERROR, 0x7000);
DestroyTask(taskId);
}
}
@@ -2607,47 +2693,47 @@ void sub_8011EF4(u8 taskId)
if (data[15] > 240)
{
- sub_8011A64(2, 0x7000);
+ RfuSetStatus(RFU_STATUS_CONNECTION_ERROR, 0x7000);
DestroyTask(taskId);
}
}
-void sub_8011FC8(const u8 *src, u16 trainerId)
+void CreateTask_RfuReconnectWithParent(const u8 *name, u16 trainerId)
{
u8 taskId;
s16 *data;
- Rfu.unk_f1 = 0;
- taskId = CreateTask(sub_8011EF4, 3);
+ Rfu.status = RFU_STATUS_OK;
+ taskId = CreateTask(Task_RfuReconnectWithParent, 3);
data = gTasks[taskId].data;
- StringCopy((u8*)(data), src);
+ StringCopy((u8*)(data), name);
data[8] = trainerId;
}
-bool32 sub_801200C(s16 a1, struct GFtgtGname *structPtr)
+static bool32 ShouldRejectPartnerConnectionBasedOnActivity(s16 activity, struct GFtgtGname *partnerGname)
{
- if (sub_800F7DC()->activity == 0x45)
+ if (GetHostRFUtgtGname()->activity == (ACTIVITY_CHAT | IN_UNION_ROOM))
{
- if (structPtr->activity != 0x45)
+ if (partnerGname->activity != (ACTIVITY_CHAT | IN_UNION_ROOM))
return TRUE;
}
- else if (structPtr->activity != 0x40)
+ else if (partnerGname->activity != IN_UNION_ROOM)
{
return TRUE;
}
- else if (a1 == 0x44)
+ else if (activity == (ACTIVITY_TRADE | IN_UNION_ROOM))
{
- struct GFtgtGname *structPtr2 = &Rfu.unk_10A;
- if (structPtr2->species == SPECIES_EGG)
+ struct GFtgtGname *tradeGname = &Rfu.unk_10A;
+ if (tradeGname->species == SPECIES_EGG)
{
- if (structPtr->species == structPtr2->species)
+ if (partnerGname->species == tradeGname->species)
return FALSE;
else
return TRUE;
}
- else if (structPtr->species != structPtr2->species
- || structPtr->level != structPtr2->level
- || structPtr->type != structPtr2->type)
+ else if (partnerGname->species != tradeGname->species
+ || partnerGname->level != tradeGname->level
+ || partnerGname->type != tradeGname->type)
{
return TRUE;
}
@@ -2656,53 +2742,53 @@ bool32 sub_801200C(s16 a1, struct GFtgtGname *structPtr)
return FALSE;
}
-void sub_801209C(u8 taskId)
+static void sub_801209C(u8 taskId)
{
- if (Rfu.unk_f1 == 4)
+ if (Rfu.status == RFU_STATUS_NEW_CHILD_DETECTED)
DestroyTask(taskId);
if (++gTasks[taskId].data[0] > 300)
{
- sub_8011A64(2, 0x7000);
+ RfuSetStatus(RFU_STATUS_CONNECTION_ERROR, 0x7000);
DestroyTask(taskId);
}
- if (Rfu.unk_ccd != 0 && lman.parent_child == 0)
+ if (Rfu.parentId != 0 && lman.parent_child == 0)
{
u16 trainerId = ReadU16(Rfu.unk_10A.unk_00.playerTrainerId);
- u8 id = sub_8011CE4(Rfu.playerName, trainerId);
+ u8 id = GetPartnerIndexByNameAndTrainerID(Rfu.playerName, trainerId);
if (id != 0xFF)
{
- if (!sub_801200C(gTasks[taskId].data[1], (void *)gRfuLinkStatus->partner[id].gname))
+ if (!ShouldRejectPartnerConnectionBasedOnActivity(gTasks[taskId].data[1], (void *)gRfuLinkStatus->partner[id].gname))
{
if (gRfuLinkStatus->partner[id].slot != 0xFF && !rfu_LMAN_CHILD_connectParent(gRfuLinkStatus->partner[id].id, 0x5A))
{
- Rfu.unk_04 = 0xA;
+ Rfu.state = 0xA;
DestroyTask(taskId);
}
}
else
{
- sub_8011A64(2, 0x7000);
+ RfuSetStatus(RFU_STATUS_CONNECTION_ERROR, 0x7000);
DestroyTask(taskId);
}
}
}
}
-void sub_8012188(const u8 *name, struct GFtgtGname *structPtr, u8 a2)
+void sub_8012188(const u8 *name, struct GFtgtGname *structPtr, u8 activity)
{
u8 taskId, taskId2;
Rfu.unk_ccf = 0;
- Rfu.unk_f1 = 0;
+ Rfu.status = RFU_STATUS_OK;
StringCopy(Rfu.playerName, name);
- memcpy(&Rfu.unk_10A, structPtr, 0xD);
+ memcpy(&Rfu.unk_10A, structPtr, RFU_GAME_NAME_LENGTH);
rfu_LMAN_forceChangeSP();
taskId = CreateTask(sub_801209C, 2);
- gTasks[taskId].data[1] = a2;
- taskId2 = FindTaskIdByFunc(sub_800EB44);
- if (a2 == 0x45)
+ gTasks[taskId].data[1] = activity;
+ taskId2 = FindTaskIdByFunc(Task_LinkRfu_UnionRoomListen);
+ if (activity == (ACTIVITY_CHAT | IN_UNION_ROOM))
{
if (taskId2 != 0xFF)
gTasks[taskId2].data[7] = 1;
@@ -2714,9 +2800,9 @@ void sub_8012188(const u8 *name, struct GFtgtGname *structPtr, u8 a2)
}
}
-bool8 sub_8012224(void)
+bool8 IsRfuRecoveringFromLinkLoss(void)
{
- if (Rfu.unk_f0 == 1)
+ if (Rfu.linkLossRecoveryState == 1)
return TRUE;
else
return FALSE;
@@ -2726,61 +2812,61 @@ bool32 sub_8012240(void)
{
s32 i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- if ((lman.acceptSlot_flag >> i) & 1 && Rfu.unk_cd1[i] == 0)
+ if ((lman.acceptSlot_flag >> i) & 1 && Rfu.partnerSendStatuses[i] == RFU_STATUS_OK)
return FALSE;
}
return TRUE;
}
-void sub_801227C(void)
+static void Debug_PrintEmpty(void)
{
s32 i;
for (i = 0; i < 20; i++)
- nullsub_5(gUnknown_082ED82C, 0, i);
+ Debug_PrintString(sASCII_30Commas, 0, i);
}
-void sub_801229C(void)
+static void Debug_PrintStatus(void)
{
s32 i, j;
- nullsub_13(GetBlockReceivedStatus(), 0x1C, 0x13, 2);
- nullsub_13(gRfuLinkStatus->connSlotFlag, 0x14, 1, 1);
- nullsub_13(gRfuLinkStatus->linkLossSlotFlag, 0x17, 1, 1);
- if (Rfu.unk_0c == 1)
+ Debug_PrintNum(GetBlockReceivedStatus(), 0x1C, 0x13, 2);
+ Debug_PrintNum(gRfuLinkStatus->connSlotFlag, 0x14, 1, 1);
+ Debug_PrintNum(gRfuLinkStatus->linkLossSlotFlag, 0x17, 1, 1);
+ if (Rfu.parentChild == MODE_PARENT)
{
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
if ((gRfuLinkStatus->getNameFlag >> i) & 1)
{
- nullsub_13(gRfuLinkStatus->partner[i].serialNo, 1, i + 3, 4);
- nullsub_5((void*)gRfuLinkStatus->partner[i].gname, 6, i + 3);
- nullsub_5(gRfuLinkStatus->partner[i].uname, 0x16, i + 3);
+ Debug_PrintNum(gRfuLinkStatus->partner[i].serialNo, 1, i + 3, 4);
+ Debug_PrintString((void*)gRfuLinkStatus->partner[i].gname, 6, i + 3);
+ Debug_PrintString(gRfuLinkStatus->partner[i].uname, 0x16, i + 3);
}
}
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- for (j = 0; j < 14; j++)
+ for (j = 0; j < (int)ARRAY_COUNT(Rfu.unk_14[0]); j++)
{
- nullsub_13(Rfu.unk_14[i][j], j * 2, i + 11, 2);
+ Debug_PrintNum(Rfu.unk_14[i][j], j * 2, i + 11, 2);
}
}
- nullsub_5(gUnknown_082ED868, 1, 0xF);
+ Debug_PrintString(sASCII_NowSlot, 1, 0xF);
}
else if (gRfuLinkStatus->connSlotFlag != 0 && gRfuLinkStatus->getNameFlag != 0)
{
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- nullsub_13(0, 1, i + 3, 4);
- nullsub_5(gUnknown_082ED84B, 6, i + 3);
- nullsub_5(gUnknown_082ED85B, 0x16, i + 3);
+ Debug_PrintNum(0, 1, i + 3, 4);
+ Debug_PrintString(sASCII_15Commas, 6, i + 3);
+ Debug_PrintString(sASCII_8Commas, 0x16, i + 3);
}
- nullsub_13(gRfuLinkStatus->partner[Rfu.unk_c3e].serialNo, 1, 3, 4);
- nullsub_5((void*)gRfuLinkStatus->partner[Rfu.unk_c3e].gname, 6, 3);
- nullsub_5(gRfuLinkStatus->partner[Rfu.unk_c3e].uname, 0x16, 3);
+ Debug_PrintNum(gRfuLinkStatus->partner[Rfu.childSlot].serialNo, 1, 3, 4);
+ Debug_PrintString((void*)gRfuLinkStatus->partner[Rfu.childSlot].gname, 6, 3);
+ Debug_PrintString(gRfuLinkStatus->partner[Rfu.childSlot].uname, 0x16, 3);
}
else
{
@@ -2788,31 +2874,31 @@ void sub_801229C(void)
{
if (gRfuLinkStatus->partner[i].slot != 0xFF)
{
- nullsub_13(gRfuLinkStatus->partner[i].serialNo, 1, i + 3, 4);
- nullsub_13(gRfuLinkStatus->partner[i].id, 6, i + 3, 4);
- nullsub_5(gRfuLinkStatus->partner[i].uname, 0x16, i + 3);
+ Debug_PrintNum(gRfuLinkStatus->partner[i].serialNo, 1, i + 3, 4);
+ Debug_PrintNum(gRfuLinkStatus->partner[i].id, 6, i + 3, 4);
+ Debug_PrintString(gRfuLinkStatus->partner[i].uname, 0x16, i + 3);
}
}
- for (; i < 4; i++)
+ for (; i < RFU_CHILD_MAX; i++)
{
- nullsub_13(0, 1, i + 3, 4);
- nullsub_5(gUnknown_082ED84B, 6, i + 3);
- nullsub_5(gUnknown_082ED85B, 0x16, i + 3);
+ Debug_PrintNum(0, 1, i + 3, 4);
+ Debug_PrintString(sASCII_15Commas, 6, i + 3);
+ Debug_PrintString(sASCII_8Commas, 0x16, i + 3);
}
}
}
-u32 sub_80124C0(void)
+static u32 GetRfuSendQueueLength(void)
{
- return Rfu.unk_9e8.unk_232;
+ return Rfu.sendQueue.count;
}
u32 GetRfuRecvQueueLength(void)
{
- return Rfu.unk_124.unk_8c2;
+ return Rfu.recvQueue.count;
}
-void nullsub_89(u8 taskId)
+static void Task_Idle(u8 taskId)
{
}
diff --git a/src/link_rfu_3.c b/src/link_rfu_3.c
index 535deeca6..c53e1c59e 100644
--- a/src/link_rfu_3.c
+++ b/src/link_rfu_3.c
@@ -7,30 +7,112 @@
#include "text.h"
#include "event_data.h"
+enum {
+ WIRELESS_STATUS_ANIM_3_BARS,
+ WIRELESS_STATUS_ANIM_2_BARS,
+ WIRELESS_STATUS_ANIM_1_BAR,
+ WIRELESS_STATUS_ANIM_SEARCHING,
+ WIRELESS_STATUS_ANIM_ERROR,
+};
+
+#define UNUSED_QUEUE_NUM_SLOTS 2
+#define UNUSED_QUEUE_SLOT_LENGTH 256
+
+struct RfuUnusedQueue
+{
+ u8 slots[UNUSED_QUEUE_NUM_SLOTS][UNUSED_QUEUE_SLOT_LENGTH];
+ vu8 recvSlot;
+ vu8 sendSlot;
+ vu8 count;
+ vu8 full;
+};
+
EWRAM_DATA u8 gWirelessStatusIndicatorSpriteId = 0;
-static u8 gUnknown_03000D74;
+static u8 sUnknown_03000D74;
-const u16 gWirelessLinkIconPalette[] = INCBIN_U16("graphics/interface/wireless_link_icon.gbapal");
-const u32 gWirelessLinkIconPic[] = INCBIN_U32("graphics/interface/wireless_link_icon.4bpp.lz");
+static const u16 sWirelessLinkIconPalette[] = INCBIN_U16("graphics/interface/wireless_link_icon.gbapal");
+static const u32 sWirelessLinkIconPic[] = INCBIN_U32("graphics/interface/wireless_link_icon.4bpp.lz");
-const u8 sWireless_ASCIItoRSETable[] = {
- 0xff, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x37,
+// Most of the below two tables won't make sense with ASCII encoding.
+static const u8 sWireless_ASCIItoRSETable[256] = {
+ EOS,
+ 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x37,
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
- 0x00, 0xab, 0xb5, 0xb6, 0xb1, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xb2, 0xf1, 0x00, 0xae, 0xad, 0xba,
- 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8,
- 0xa9, 0xaa, 0x00, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
- 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1,
- 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
- 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1,
- 0xd2, 0xd3, 0xd4, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6,
- 0x00, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb,
- 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3,
- 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb,
- 0xec, 0xed, 0xee, 0x2d, 0x2f, 0x30, 0x31, 0x32,
+ [' '] = CHAR_SPACE,
+ ['!'] = CHAR_EXCL_MARK,
+ 0xb5, 0xb6, 0xb1, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xb2, 0xf1, 0x00,
+ ['-'] = CHAR_HYPHEN,
+ ['.'] = CHAR_PERIOD,
+ ['/'] = CHAR_SLASH,
+ ['0'] = CHAR_0,
+ ['1'] = CHAR_1,
+ ['2'] = CHAR_2,
+ ['3'] = CHAR_3,
+ ['4'] = CHAR_4,
+ ['5'] = CHAR_5,
+ ['6'] = CHAR_6,
+ ['7'] = CHAR_7,
+ ['8'] = CHAR_8,
+ ['9'] = CHAR_9,
+ 0x00, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0x00,
+ ['A'] = CHAR_A,
+ ['B'] = CHAR_B,
+ ['C'] = CHAR_C,
+ ['D'] = CHAR_D,
+ ['E'] = CHAR_E,
+ ['F'] = CHAR_F,
+ ['G'] = CHAR_G,
+ ['H'] = CHAR_H,
+ ['I'] = CHAR_I,
+ ['J'] = CHAR_J,
+ ['K'] = CHAR_K,
+ ['L'] = CHAR_L,
+ ['M'] = CHAR_M,
+ ['N'] = CHAR_N,
+ ['O'] = CHAR_O,
+ ['P'] = CHAR_P,
+ ['Q'] = CHAR_Q,
+ ['R'] = CHAR_R,
+ ['S'] = CHAR_S,
+ ['T'] = CHAR_T,
+ ['U'] = CHAR_U,
+ ['V'] = CHAR_V,
+ ['W'] = CHAR_W,
+ ['X'] = CHAR_X,
+ ['Y'] = CHAR_Y,
+ ['Z'] = CHAR_Z,
+ 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0x00,
+ ['a'] = CHAR_a,
+ ['b'] = CHAR_b,
+ ['c'] = CHAR_c,
+ ['d'] = CHAR_d,
+ ['e'] = CHAR_e,
+ ['f'] = CHAR_f,
+ ['g'] = CHAR_g,
+ ['h'] = CHAR_h,
+ ['i'] = CHAR_i,
+ ['j'] = CHAR_j,
+ ['k'] = CHAR_k,
+ ['l'] = CHAR_l,
+ ['m'] = CHAR_m,
+ ['n'] = CHAR_n,
+ ['o'] = CHAR_o,
+ ['p'] = CHAR_p,
+ ['q'] = CHAR_q,
+ ['r'] = CHAR_r,
+ ['s'] = CHAR_s,
+ ['t'] = CHAR_t,
+ ['u'] = CHAR_u,
+ ['v'] = CHAR_v,
+ ['w'] = CHAR_w,
+ ['x'] = CHAR_x,
+ ['y'] = CHAR_y,
+ ['z'] = CHAR_z,
+ 0x2d, 0x2f, 0x30, 0x31, 0x32,
0x33, 0x34, 0x35, 0x36, 0x50, 0x00, 0x01, 0x02,
0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12,
@@ -49,42 +131,107 @@ const u8 sWireless_ASCIItoRSETable[] = {
0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94
};
-const u8 sWireless_RSEtoASCIITable[] = {
- 0x20, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c,
- 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
- 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c,
- 0x9d, 0x9e, 0x9f, 0xa0, 0xe0, 0xe1, 0xe2, 0xe3,
- 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb,
- 0xec, 0xed, 0xee, 0xef, 0xf0, 0x7b, 0xf1, 0x7c,
- 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x84, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
- 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xa6, 0xdd, 0xa7,
- 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xf2,
- 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa,
- 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0x01, 0x02, 0x03,
- 0x04, 0x05, 0x06, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
- 0xaf, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
- 0x37, 0x38, 0x39, 0x21, 0xdf, 0xa1, 0xb0, 0xa5,
- 0xde, 0x24, 0x2a, 0xa2, 0xa3, 0x22, 0x23, 0x20,
- 0xa4, 0x20, 0x2f, 0x41, 0x42, 0x43, 0x44, 0x45,
- 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d,
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55,
- 0x56, 0x57, 0x58, 0x59, 0x5a, 0x61, 0x62, 0x63,
- 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
- 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73,
- 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x20,
- 0x20, 0x2b, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00
+static const u8 sWireless_RSEtoASCIITable[256] = {
+ [CHAR_SPACE] = ' ',
+ 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d,
+ 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95,
+ 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d,
+ 0x9e, 0x9f, 0xa0, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4,
+ 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec,
+ 0xed, 0xee, 0xef, 0xf0, 0x7b, 0xf1, 0x7c, 0x7d,
+ 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x07, 0x08,
+ 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
+ 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
+ 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x84,
+ 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8,
+ 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0,
+ 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8,
+ 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
+ 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8,
+ 0xd9, 0xda, 0xdb, 0xdc, 0xa6, 0xdd, 0xa7, 0xa8,
+ 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xf2, 0xf3,
+ 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb,
+ 0xfc, 0xfd, 0xfe, 0xff, 0x01, 0x02, 0x03, 0x04,
+ 0x05, 0x06, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0xaf,
+ [CHAR_0] = '0',
+ [CHAR_1] = '1',
+ [CHAR_2] = '2',
+ [CHAR_3] = '3',
+ [CHAR_4] = '4',
+ [CHAR_5] = '5',
+ [CHAR_6] = '6',
+ [CHAR_7] = '7',
+ [CHAR_8] = '8',
+ [CHAR_9] = '9',
+ [CHAR_EXCL_MARK] = '!',
+ 0xdf, 0xa1, 0xb0, 0xa5, 0xde, 0x24, 0x2a,
+ 0xa2, 0xa3, 0x22, 0x23, 0x20, 0xa4, 0x20,
+ [CHAR_SLASH] = '/',
+ [CHAR_A] = 'A',
+ [CHAR_B] = 'B',
+ [CHAR_C] = 'C',
+ [CHAR_D] = 'D',
+ [CHAR_E] = 'E',
+ [CHAR_F] = 'F',
+ [CHAR_G] = 'G',
+ [CHAR_H] = 'H',
+ [CHAR_I] = 'I',
+ [CHAR_J] = 'J',
+ [CHAR_K] = 'K',
+ [CHAR_L] = 'L',
+ [CHAR_M] = 'M',
+ [CHAR_N] = 'N',
+ [CHAR_O] = 'O',
+ [CHAR_P] = 'P',
+ [CHAR_Q] = 'Q',
+ [CHAR_R] = 'R',
+ [CHAR_S] = 'S',
+ [CHAR_T] = 'T',
+ [CHAR_U] = 'U',
+ [CHAR_V] = 'V',
+ [CHAR_W] = 'W',
+ [CHAR_X] = 'X',
+ [CHAR_Y] = 'Y',
+ [CHAR_Z] = 'Z',
+ [CHAR_a] = 'a',
+ [CHAR_b] = 'b',
+ [CHAR_c] = 'c',
+ [CHAR_d] = 'd',
+ [CHAR_e] = 'e',
+ [CHAR_f] = 'f',
+ [CHAR_g] = 'g',
+ [CHAR_h] = 'h',
+ [CHAR_i] = 'i',
+ [CHAR_j] = 'j',
+ [CHAR_k] = 'k',
+ [CHAR_l] = 'l',
+ [CHAR_m] = 'm',
+ [CHAR_n] = 'n',
+ [CHAR_o] = 'o',
+ [CHAR_p] = 'p',
+ [CHAR_q] = 'q',
+ [CHAR_r] = 'r',
+ [CHAR_s] = 's',
+ [CHAR_t] = 't',
+ [CHAR_u] = 'u',
+ [CHAR_v] = 'v',
+ [CHAR_w] = 'w',
+ [CHAR_x] = 'x',
+ [CHAR_y] = 'y',
+ [CHAR_z] = 'z',
+ 0x20, 0x20, 0x2b, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+ [CHAR_SPECIAL_F7] = ' ',
+ [CHAR_SPECIAL_F8] = ' ',
+ [CHAR_SPECIAL_F9] = ' ',
+ [CHAR_PROMPT_SCROLL] = ' ',
+ [CHAR_PROMPT_CLEAR] = ' ',
+ [EXT_CTRL_CODE_BEGIN] = ' ',
+ [PLACEHOLDER_BEGIN] = ' ',
+ [CHAR_NEWLINE] = ' ',
+ [EOS] = 0
};
-const struct OamData sWirelessStatusIndicatorOamData =
+static const struct OamData sWirelessStatusIndicatorOamData =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
@@ -98,8 +245,7 @@ const struct OamData sWirelessStatusIndicatorOamData =
.paletteNum = 0,
};
-const union AnimCmd sWirelessStatusIndicatorAnim0[] = {
- // 3 bars
+static const union AnimCmd sWirelessStatusIndicator_3Bars[] = {
ANIMCMD_FRAME( 4, 5),
ANIMCMD_FRAME( 8, 5),
ANIMCMD_FRAME(12, 5),
@@ -109,8 +255,7 @@ const union AnimCmd sWirelessStatusIndicatorAnim0[] = {
ANIMCMD_JUMP(0)
};
-const union AnimCmd sWirelessStatusIndicatorAnim1[] = {
- // 2 bars
+static const union AnimCmd sWirelessStatusIndicator_2Bars[] = {
ANIMCMD_FRAME( 4, 5),
ANIMCMD_FRAME( 8, 5),
ANIMCMD_FRAME(12, 10),
@@ -118,321 +263,299 @@ const union AnimCmd sWirelessStatusIndicatorAnim1[] = {
ANIMCMD_JUMP(0)
};
-const union AnimCmd sWirelessStatusIndicatorAnim2[] = {
- // 1 bar
+static const union AnimCmd sWirelessStatusIndicator_1Bar[] = {
ANIMCMD_FRAME(4, 5),
ANIMCMD_FRAME(8, 5),
ANIMCMD_JUMP(0)
};
-const union AnimCmd sWirelessStatusIndicatorAnim3[] = {
- // searching
+static const union AnimCmd sWirelessStatusIndicator_Searching[] = {
ANIMCMD_FRAME( 4, 10),
ANIMCMD_FRAME(20, 10),
ANIMCMD_JUMP(0)
};
-const union AnimCmd sWirelessStatusIndicatorAnim4[] = {
- // error
+static const union AnimCmd sWirelessStatusIndicator_Error[] = {
ANIMCMD_FRAME(24, 10),
ANIMCMD_FRAME( 4, 10),
ANIMCMD_JUMP(0)
};
-const union AnimCmd *const sWirelessStatusIndicatorAnims[] = {
- sWirelessStatusIndicatorAnim0,
- sWirelessStatusIndicatorAnim1,
- sWirelessStatusIndicatorAnim2,
- sWirelessStatusIndicatorAnim3,
- sWirelessStatusIndicatorAnim4
+static const union AnimCmd *const sWirelessStatusIndicatorAnims[] = {
+ [WIRELESS_STATUS_ANIM_3_BARS] = sWirelessStatusIndicator_3Bars,
+ [WIRELESS_STATUS_ANIM_2_BARS] = sWirelessStatusIndicator_2Bars,
+ [WIRELESS_STATUS_ANIM_1_BAR] = sWirelessStatusIndicator_1Bar,
+ [WIRELESS_STATUS_ANIM_SEARCHING] = sWirelessStatusIndicator_Searching,
+ [WIRELESS_STATUS_ANIM_ERROR] = sWirelessStatusIndicator_Error
};
-const struct CompressedSpriteSheet sWirelessStatusIndicatorSpriteSheet = {
- gWirelessLinkIconPic, 0x0380, 0xD431
+static const struct CompressedSpriteSheet sWirelessStatusIndicatorSpriteSheet = {
+ sWirelessLinkIconPic, 0x0380, 0xD431
};
-const struct SpritePalette sWirelessStatusIndicatorSpritePalette = {
- gWirelessLinkIconPalette, 0xD432
+static const struct SpritePalette sWirelessStatusIndicatorSpritePalette = {
+ sWirelessLinkIconPalette, 0xD432
};
-const struct SpriteTemplate sWirelessStatusIndicatorSpriteTemplate = {
- 0xD431,
- 0xD432,
- &sWirelessStatusIndicatorOamData,
- sWirelessStatusIndicatorAnims,
- NULL,
- gDummySpriteAffineAnimTable,
- SpriteCallbackDummy
+static const struct SpriteTemplate sWirelessStatusIndicatorSpriteTemplate = {
+ .tileTag = 0xD431,
+ .paletteTag = 0xD432,
+ .oam = &sWirelessStatusIndicatorOamData,
+ .anims = sWirelessStatusIndicatorAnims,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy
};
-void sub_800D6C8(struct UnkRfuStruct_2_Sub_124 *ptr)
+void RfuRecvQueue_Reset(struct RfuRecvQueue *queue)
{
s32 i;
s32 j;
- for (i = 0; i < 32; i++)
+ for (i = 0; i < RECV_QUEUE_NUM_SLOTS; i++)
{
- for (j = 0; j < 70; j++)
+ for (j = 0; j < RECV_QUEUE_SLOT_LENGTH; j++)
{
- ptr->unk_00[i][j] = 0;
+ queue->slots[i][j] = 0;
}
}
- ptr->unk_8c1 = 0;
- ptr->unk_8c0 = 0;
- ptr->unk_8c2 = 0;
- ptr->unk_8c3 = 0;
+ queue->sendSlot = 0;
+ queue->recvSlot = 0;
+ queue->count = 0;
+ queue->full = FALSE;
}
-void sub_800D724(struct UnkRfuStruct_2_Sub_9e8 *ptr)
+void RfuSendQueue_Reset(struct RfuSendQueue *queue)
{
s32 i;
s32 j;
- for (i = 0; i < 40; i++)
+ for (i = 0; i < SEND_QUEUE_NUM_SLOTS; i++)
{
- for (j = 0; j < 14; j++)
+ for (j = 0; j < SEND_QUEUE_SLOT_LENGTH; j++)
{
- ptr->unk_00[i][j] = 0;
+ queue->slots[i][j] = 0;
}
}
- ptr->unk_231 = 0;
- ptr->unk_230 = 0;
- ptr->unk_232 = 0;
- ptr->unk_233 = 0;
+ queue->sendSlot = 0;
+ queue->recvSlot = 0;
+ queue->count = 0;
+ queue->full = FALSE;
}
-void sub_800D780(struct UnkRfuStruct_Sub_Unused *ptr)
+static void RfuUnusedQueue_Reset(struct RfuUnusedQueue *queue)
{
s32 i;
s32 j;
- for (i = 0; i < 2; i++)
+ for (i = 0; i < UNUSED_QUEUE_NUM_SLOTS; i++)
{
- for (j = 0; j < 256; j++)
+ for (j = 0; j < UNUSED_QUEUE_SLOT_LENGTH; j++)
{
- ptr->unk_00[i][j] = 0;
+ queue->slots[i][j] = 0;
}
}
- ptr->unk_201 = 0;
- ptr->unk_200 = 0;
- ptr->unk_202 = 0;
- ptr->unk_203 = 0;
+ queue->sendSlot = 0;
+ queue->recvSlot = 0;
+ queue->count = 0;
+ queue->full = FALSE;
}
-void sub_800D7D8(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2)
+void RfuRecvQueue_Enqueue(struct RfuRecvQueue *queue, u8 *data)
{
s32 i;
u16 imeBak;
u8 count;
- if (q1->unk_8c2 < 32)
+ if (queue->count < RECV_QUEUE_NUM_SLOTS)
{
imeBak = REG_IME;
REG_IME = 0;
count = 0;
- for (i = 0; i < 70; i += 14)
+ for (i = 0; i < RECV_QUEUE_SLOT_LENGTH; i += RECV_QUEUE_SLOT_LENGTH / MAX_RFU_PLAYERS)
{
- if (q2[i] == 0 && q2[i + 1] == 0)
- {
+ if (data[i] == 0 && data[i + 1] == 0)
count++;
- }
}
- if (count != 5)
+ if (count != MAX_RFU_PLAYERS)
{
- for (i = 0; i < 70; i++)
- {
- q1->unk_00[q1->unk_8c0][i] = q2[i];
- }
- q1->unk_8c0++;
- q1->unk_8c0 %= 32;
- q1->unk_8c2++;
- for (i = 0; i < 70; i++)
- {
- q2[i] = 0;
- }
+ for (i = 0; i < RECV_QUEUE_SLOT_LENGTH; i++)
+ queue->slots[queue->recvSlot][i] = data[i];
+
+ queue->recvSlot++;
+ queue->recvSlot %= RECV_QUEUE_NUM_SLOTS;
+ queue->count++;
+
+ for (i = 0; i < RECV_QUEUE_SLOT_LENGTH; i++)
+ data[i] = 0;
}
REG_IME = imeBak;
}
else
{
- q1->unk_8c3 = 1;
+ queue->full = TRUE;
}
}
-void sub_800D888(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2)
+void RfuSendQueue_Enqueue(struct RfuSendQueue *queue, u8 *data)
{
s32 i;
u16 imeBak;
- if (q1->unk_232 < 40)
+ if (queue->count < SEND_QUEUE_NUM_SLOTS)
{
imeBak = REG_IME;
REG_IME = 0;
- for (i = 0; i < 14; i++)
+ for (i = 0; i < SEND_QUEUE_SLOT_LENGTH; i++)
{
- if (q2[i] != 0)
- {
+ if (data[i] != 0)
break;
- }
}
- if (i != 14)
+ if (i != SEND_QUEUE_SLOT_LENGTH)
{
- for (i = 0; i < 14; i++)
- {
- q1->unk_00[q1->unk_230][i] = q2[i];
- }
- q1->unk_230++;
- q1->unk_230 %= 40;
- q1->unk_232++;
- for (i = 0; i < 14; i++)
+ for (i = 0; i < SEND_QUEUE_SLOT_LENGTH; i++)
{
- q2[i] = 0;
+ queue->slots[queue->recvSlot][i] = data[i];
}
+ queue->recvSlot++;
+ queue->recvSlot %= SEND_QUEUE_NUM_SLOTS;
+ queue->count++;
+
+ for (i = 0; i < SEND_QUEUE_SLOT_LENGTH; i++)
+ data[i] = 0;
}
REG_IME = imeBak;
}
else
{
- q1->unk_233 = 1;
+ queue->full = TRUE;
}
}
-bool8 sub_800D934(struct UnkRfuStruct_2_Sub_124 *q1, u8 *q2)
+bool8 RfuRecvQueue_Dequeue(struct RfuRecvQueue *queue, u8 *src)
{
u16 imeBak;
s32 i;
imeBak = REG_IME;
REG_IME = 0;
- if (q1->unk_8c0 == q1->unk_8c1 || q1->unk_8c3 != 0)
+ if (queue->recvSlot == queue->sendSlot || queue->full)
{
- for (i = 0; i < 70; i++)
- {
- q2[i] = 0;
- }
+ for (i = 0; i < RECV_QUEUE_SLOT_LENGTH; i++)
+ src[i] = 0;
+
REG_IME = imeBak;
return FALSE;
}
- for (i = 0; i < 70; i++)
+ for (i = 0; i < RECV_QUEUE_SLOT_LENGTH; i++)
{
- q2[i] = q1->unk_00[q1->unk_8c1][i];
+ src[i] = queue->slots[queue->sendSlot][i];
}
- q1->unk_8c1++;
- q1->unk_8c1 %= 32;
- q1->unk_8c2--;
+ queue->sendSlot++;
+ queue->sendSlot %= RECV_QUEUE_NUM_SLOTS;
+ queue->count--;
REG_IME = imeBak;
return TRUE;
}
-bool8 sub_800D9DC(struct UnkRfuStruct_2_Sub_9e8 *q1, u8 *q2)
+bool8 RfuSendQueue_Dequeue(struct RfuSendQueue *queue, u8 *src)
{
s32 i;
u16 imeBak;
- if (q1->unk_230 == q1->unk_231 || q1->unk_233 != 0)
- {
+ if (queue->recvSlot == queue->sendSlot || queue->full)
return FALSE;
- }
+
imeBak = REG_IME;
REG_IME = 0;
- for (i = 0; i < 14; i++)
- {
- q2[i] = q1->unk_00[q1->unk_231][i];
- }
- q1->unk_231++;
- q1->unk_231 %= 40;
- q1->unk_232--;
+ for (i = 0; i < SEND_QUEUE_SLOT_LENGTH; i++)
+ src[i] = queue->slots[queue->sendSlot][i];
+
+ queue->sendSlot++;
+ queue->sendSlot %= SEND_QUEUE_NUM_SLOTS;
+ queue->count--;
REG_IME = imeBak;
return TRUE;
}
-void sub_800DA68(struct UnkRfuStruct_2_Sub_c1c *q1, const u8 *q2)
+void RfuBackupQueue_Enqueue(struct RfuBackupQueue *queue, const u8 *data)
{
s32 i;
- if (q2[1] == 0)
+ if (data[1] == 0)
{
- sub_800DAC8(q1, NULL);
+ RfuBackupQueue_Dequeue(queue, NULL);
}
else
{
- for (i = 0; i < 14; i++)
- {
- q1->unk_00[q1->unk_1c][i] = q2[i];
- }
- q1->unk_1c++;
- q1->unk_1c %= 2;
- if (q1->unk_1e < 2)
- {
- q1->unk_1e++;
- }
+ for (i = 0; i < BACKUP_QUEUE_SLOT_LENGTH; i++)
+ queue->slots[queue->recvSlot][i] = data[i];
+
+ queue->recvSlot++;
+ queue->recvSlot %= BACKUP_QUEUE_NUM_SLOTS;
+
+ if (queue->count < BACKUP_QUEUE_NUM_SLOTS)
+ queue->count++;
else
- {
- q1->unk_1d = q1->unk_1c;
- }
+ queue->sendSlot = queue->recvSlot;
}
}
-bool8 sub_800DAC8(struct UnkRfuStruct_2_Sub_c1c *q1, u8 *q2)
+bool8 RfuBackupQueue_Dequeue(struct RfuBackupQueue *queue, u8 *src)
{
s32 i;
- if (q1->unk_1e == 0)
- {
+ if (queue->count == 0)
return FALSE;
- }
- if (q2 != NULL)
+
+ if (src != NULL)
{
- for (i = 0; i < 14; i++)
- {
- q2[i] = q1->unk_00[q1->unk_1d][i];
- }
+ for (i = 0; i < BACKUP_QUEUE_SLOT_LENGTH; i++)
+ src[i] = queue->slots[queue->sendSlot][i];
}
- q1->unk_1d++;
- q1->unk_1d %= 2;
- q1->unk_1e--;
+ queue->sendSlot++;
+ queue->sendSlot %= BACKUP_QUEUE_NUM_SLOTS;
+ queue->count--;
return TRUE;
}
-void sub_800DB18(struct UnkRfuStruct_Sub_Unused *q1, u8 *q2)
+static void RfuUnusedQueue_Enqueue(struct RfuUnusedQueue *queue, u8 *data)
{
s32 i;
- if (q1->unk_202 < 2)
+ if (queue->count < UNUSED_QUEUE_NUM_SLOTS)
{
- for (i = 0; i < 256; i++)
- {
- q1->unk_00[q1->unk_200][i] = q2[i];
- }
- q1->unk_200++;
- q1->unk_200 %= 2;
- q1->unk_202++;
+ for (i = 0; i < UNUSED_QUEUE_SLOT_LENGTH; i++)
+ queue->slots[queue->recvSlot][i] = data[i];
+
+ queue->recvSlot++;
+ queue->recvSlot %= UNUSED_QUEUE_NUM_SLOTS;
+ queue->count++;
}
else
{
- q1->unk_203 = 1;
+ queue->full = TRUE;
}
}
-bool8 sub_800DB84(struct UnkRfuStruct_Sub_Unused *q1, u8 *q2)
+static bool8 RfuUnusedQueue_Dequeue(struct RfuUnusedQueue *queue, u8 *dest)
{
s32 i;
- if (q1->unk_200 == q1->unk_201 || q1->unk_203)
- {
+ if (queue->recvSlot == queue->sendSlot || queue->full)
return FALSE;
- }
- for (i = 0; i < 256; i++)
- {
- q2[i] = q1->unk_00[q1->unk_201][i];
- }
- q1->unk_201++;
- q1->unk_201 %= 2;
- q1->unk_202--;
+
+ for (i = 0; i < UNUSED_QUEUE_SLOT_LENGTH; i++)
+ dest[i] = queue->slots[queue->sendSlot][i];
+
+ queue->sendSlot++;
+ queue->sendSlot %= UNUSED_QUEUE_NUM_SLOTS;
+ queue->count--;
return TRUE;
}
-void sub_800DBF8(u8 *q1, u8 mode)
+// Unused
+static void sub_800DBF8(u8 *q1, u8 mode)
{
s32 i;
u8 rval;
@@ -467,47 +590,47 @@ void sub_800DBF8(u8 *q1, u8 mode)
case 3:
for (i = 0; i < 200; i++)
{
- q1[i] = i + 1 + gUnknown_03000D74;
- r5 += (i + 1 + gUnknown_03000D74) & 0xFF;
+ q1[i] = i + 1 + sUnknown_03000D74;
+ r5 += (i + 1 + sUnknown_03000D74) & 0xFF;
}
*((u16 *)(q1 + i)) = r5;
- gUnknown_03000D74++;
+ sUnknown_03000D74++;
break;
}
}
// File boundary here maybe?
-void PkmnStrToASCII(u8 *q1, const u8 *q2)
+static void PkmnStrToASCII(u8 *asciiStr, const u8 *pkmnStr)
{
s32 i;
- for (i = 0; q2[i] != EOS; i++)
+ for (i = 0; pkmnStr[i] != EOS; i++)
{
- q1[i] = sWireless_RSEtoASCIITable[q2[i]];
+ asciiStr[i] = sWireless_RSEtoASCIITable[pkmnStr[i]];
}
- q1[i] = 0;
+ asciiStr[i] = 0;
}
-void ASCIIToPkmnStr(u8 *q1, const u8 *q2)
+static void ASCIIToPkmnStr(u8 *pkmnStr, const u8 *asciiStr)
{
s32 i;
- for (i = 0; q2[i] != 0; i++)
+ for (i = 0; asciiStr[i] != 0; i++)
{
- q1[i] = sWireless_ASCIItoRSETable[q2[i]];
+ pkmnStr[i] = sWireless_ASCIItoRSETable[asciiStr[i]];
}
- q1[i] = EOS;
+ pkmnStr[i] = EOS;
}
#ifdef NONMATCHING
-u8 sub_800DD1C(u8 maxFlags)
+static u8 GetConnectedChildStrength(u8 maxFlags)
{
u8 flagCount = 0;
u32 flags = gRfuLinkStatus->connSlotFlag;
u8 i;
- if (gRfuLinkStatus->parentChild == 1)
+ if (gRfuLinkStatus->parentChild == MODE_PARENT)
{
for (i = 0; i < 4; flags >>= 1, i++)
{
@@ -530,7 +653,8 @@ u8 sub_800DD1C(u8 maxFlags)
return 0;
}
#else
-NAKED u8 sub_800DD1C(u8 maxFlags)
+NAKED
+static u8 GetConnectedChildStrength(u8 maxFlags)
{
asm_unified("\tpush {r4-r7,lr}\n"
"\tlsls r0, 24\n"
@@ -599,7 +723,7 @@ NAKED u8 sub_800DD1C(u8 maxFlags)
}
#endif
-void sub_800DD94(struct GFtgtGname *data, u8 r9, bool32 r2, s32 r3)
+void InitHostRFUtgtGname(struct GFtgtGname *data, u8 activity, bool32 started, s32 child_sprite_genders)
{
s32 i;
@@ -607,82 +731,91 @@ void sub_800DD94(struct GFtgtGname *data, u8 r9, bool32 r2, s32 r3)
{
data->unk_00.playerTrainerId[i] = gSaveBlock2Ptr->playerTrainerId[i];
}
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- data->child_sprite_gender[i] = r3;
- r3 >>= 8;
+ data->child_sprite_gender[i] = child_sprite_genders;
+ child_sprite_genders >>= 8;
}
data->playerGender = gSaveBlock2Ptr->playerGender;
- data->activity = r9;
- data->started = r2;
+ data->activity = activity;
+ data->started = started;
data->unk_00.language = GAME_LANGUAGE;
data->unk_00.version = GAME_VERSION;
- data->unk_00.hasNews = 0;
- data->unk_00.hasCard = 0;
- data->unk_00.unk_00_6 = 0;
+ data->unk_00.hasNews = FALSE;
+ data->unk_00.hasCard = FALSE;
+ data->unk_00.unknown = FALSE;
data->unk_00.isChampion = FlagGet(FLAG_IS_CHAMPION);
data->unk_00.hasNationalDex = IsNationalPokedexEnabled();
data->unk_00.gameClear = FlagGet(FLAG_SYS_GAME_CLEAR);
}
-bool8 sub_800DE7C(struct GFtgtGname *buff1, u8 *buff2, u8 idx)
+bool8 LinkRfu_GetNameIfCompatible(struct GFtgtGname *buff1, u8 *buff2, u8 idx)
{
bool8 retVal;
- if (lman.parent_child == 1)
+ if (lman.parent_child == MODE_PARENT)
{
retVal = TRUE;
- if (sub_8010454(gRfuLinkStatus->partner[idx].serialNo) && ((gRfuLinkStatus->getNameFlag >> idx) & 1))
+ if (IsRfuSerialNumberValid(gRfuLinkStatus->partner[idx].serialNo) && ((gRfuLinkStatus->getNameFlag >> idx) & 1))
{
- memcpy(buff1, gRfuLinkStatus->partner[idx].gname, 0xD);
+ memcpy(buff1, gRfuLinkStatus->partner[idx].gname, RFU_GAME_NAME_LENGTH);
memcpy(buff2, gRfuLinkStatus->partner[idx].uname, PLAYER_NAME_LENGTH + 1);
}
else
{
- memset(buff1, 0, 0xD);
+ memset(buff1, 0, RFU_GAME_NAME_LENGTH);
memset(buff2, 0, PLAYER_NAME_LENGTH + 1);
}
}
else
{
retVal = FALSE;
- if (sub_8010454(gRfuLinkStatus->partner[idx].serialNo))
+ if (IsRfuSerialNumberValid(gRfuLinkStatus->partner[idx].serialNo))
{
- memcpy(buff1, gRfuLinkStatus->partner[idx].gname, 0xD);
+ memcpy(buff1, gRfuLinkStatus->partner[idx].gname, RFU_GAME_NAME_LENGTH);
memcpy(buff2, gRfuLinkStatus->partner[idx].uname, PLAYER_NAME_LENGTH + 1);
}
else
{
- memset(buff1, 0, 0xD);
+ memset(buff1, 0, RFU_GAME_NAME_LENGTH);
memset(buff2, 0, PLAYER_NAME_LENGTH + 1);
}
}
return retVal;
}
-bool8 sub_800DF34(struct GFtgtGname *buff1, u8 *buff2, u8 idx)
+bool8 LinkRfu_GetNameIfSerial7F7D(struct GFtgtGname *buff1, u8 *buff2, u8 idx)
{
bool8 retVal = FALSE;
- if (gRfuLinkStatus->partner[idx].serialNo == 0x7F7D)
+ if (gRfuLinkStatus->partner[idx].serialNo == RFU_SERIAL_7F7D)
{
- memcpy(buff1, gRfuLinkStatus->partner[idx].gname, 0xD);
- memcpy(buff2, gRfuLinkStatus->partner[idx].uname, 8);
+ memcpy(buff1, gRfuLinkStatus->partner[idx].gname, RFU_GAME_NAME_LENGTH);
+ memcpy(buff2, gRfuLinkStatus->partner[idx].uname, PLAYER_NAME_LENGTH + 1);
retVal = TRUE;
}
else
{
- memset(buff1, 0, 0xD);
- memset(buff2, 0, 8);
+ memset(buff1, 0, RFU_GAME_NAME_LENGTH);
+ memset(buff2, 0, PLAYER_NAME_LENGTH + 1);
}
return retVal;
}
-void sub_800DF90(struct GFtgtGname *buff1, u8 *buff2)
+void LinkRfu3_SetGnameUnameFromStaticBuffers(struct GFtgtGname *buff1, u8 *buff2)
{
- memcpy(buff1, &gUnknown_02022B14, 0xD);
- memcpy(buff2, gUnknown_02022B22, 8);
+ memcpy(buff1, &gHostRFUtgtGnameBuffer, RFU_GAME_NAME_LENGTH);
+ memcpy(buff2, gHostRFUtgtUnameBuffer, PLAYER_NAME_LENGTH + 1);
}
+#define sNextAnimNum data[0]
+#define sSavedAnimNum data[1]
+#define sCurrAnimNum data[2]
+#define sFrameDelay data[3]
+#define sFrameIdx data[4]
+#define sTileStart data[6]
+#define sValidator data[7]
+#define STATUS_INDICATOR_ACTIVE 0x1234 // Used to validate active indicator
+
void CreateWirelessStatusIndicatorSprite(u8 x, u8 y)
{
u8 sprId;
@@ -692,28 +825,28 @@ void CreateWirelessStatusIndicatorSprite(u8 x, u8 y)
x = 0xE7;
y = 0x08;
}
- if (gRfuLinkStatus->parentChild == 1)
+ if (gRfuLinkStatus->parentChild == MODE_PARENT)
{
sprId = CreateSprite(&sWirelessStatusIndicatorSpriteTemplate, x, y, 0);
- gSprites[sprId].data[7] = 0x1234;
- gSprites[sprId].data[6] = GetSpriteTileStartByTag(sWirelessStatusIndicatorSpriteSheet.tag);
+ gSprites[sprId].sValidator = STATUS_INDICATOR_ACTIVE;
+ gSprites[sprId].sTileStart = GetSpriteTileStartByTag(sWirelessStatusIndicatorSpriteSheet.tag);
gSprites[sprId].invisible = TRUE;
gWirelessStatusIndicatorSpriteId = sprId;
}
else
{
gWirelessStatusIndicatorSpriteId = CreateSprite(&sWirelessStatusIndicatorSpriteTemplate, x, y, 0);
- gSprites[gWirelessStatusIndicatorSpriteId].data[7] = 0x1234;
- gSprites[gWirelessStatusIndicatorSpriteId].data[6] = GetSpriteTileStartByTag(sWirelessStatusIndicatorSpriteSheet.tag);
+ gSprites[gWirelessStatusIndicatorSpriteId].sValidator = STATUS_INDICATOR_ACTIVE;
+ gSprites[gWirelessStatusIndicatorSpriteId].sTileStart = GetSpriteTileStartByTag(sWirelessStatusIndicatorSpriteSheet.tag);
gSprites[gWirelessStatusIndicatorSpriteId].invisible = TRUE;
}
}
void DestroyWirelessStatusIndicatorSprite(void)
{
- if (gSprites[gWirelessStatusIndicatorSpriteId].data[7] == 0x1234)
+ if (gSprites[gWirelessStatusIndicatorSpriteId].sValidator == STATUS_INDICATOR_ACTIVE)
{
- gSprites[gWirelessStatusIndicatorSpriteId].data[7] = 0;
+ gSprites[gWirelessStatusIndicatorSpriteId].sValidator = 0;
DestroySprite(&gSprites[gWirelessStatusIndicatorSpriteId]);
gMain.oamBuffer[125] = gDummyOamData;
CpuCopy16(&gDummyOamData, (struct OamData *)OAM + 125, sizeof(struct OamData));
@@ -730,11 +863,11 @@ void LoadWirelessStatusIndicatorSpriteGfx(void)
gWirelessStatusIndicatorSpriteId = 0xFF;
}
-u8 sub_800E124(void)
+static u8 GetParentSignalStrength(void)
{
u8 i;
u8 flags = gRfuLinkStatus->connSlotFlag;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
if (flags & 1)
{
@@ -745,104 +878,110 @@ u8 sub_800E124(void)
return 0;
}
-void sub_800E15C(struct Sprite *sprite, s32 signalStrengthAnimNum)
+static void SetWirelessStatusIndicatorAnim(struct Sprite *sprite, s32 animNum)
{
- if (sprite->data[2] != signalStrengthAnimNum)
+ if (sprite->sCurrAnimNum != animNum)
{
- sprite->data[2] = signalStrengthAnimNum;
- sprite->data[3] = 0;
- sprite->data[4] = 0;
+ sprite->sCurrAnimNum = animNum;
+ sprite->sFrameDelay = 0;
+ sprite->sFrameIdx = 0;
}
}
-void sub_800E174(void)
+void UpdateWirelessStatusIndicatorSprite(void)
{
- if (gWirelessStatusIndicatorSpriteId != 0xFF && gSprites[gWirelessStatusIndicatorSpriteId].data[7] == 0x1234)
+ if (gWirelessStatusIndicatorSpriteId != 0xFF && gSprites[gWirelessStatusIndicatorSpriteId].sValidator == STATUS_INDICATOR_ACTIVE)
{
struct Sprite *sprite = &gSprites[gWirelessStatusIndicatorSpriteId];
- u8 signalStrength = 255;
+ u8 signalStrength = RFU_LINK_ICON_LEVEL4_MAX;
u8 i = 0;
- if (gRfuLinkStatus->parentChild == 1)
+ if (gRfuLinkStatus->parentChild == MODE_PARENT)
{
for (i = 0; i < GetLinkPlayerCount() - 1; i++)
{
- if (signalStrength >= sub_800DD1C(i + 1))
+ if (signalStrength >= GetConnectedChildStrength(i + 1))
{
- signalStrength = sub_800DD1C(i + 1);
+ signalStrength = GetConnectedChildStrength(i + 1);
}
}
}
else
{
- signalStrength = sub_800E124();
+ signalStrength = GetParentSignalStrength();
}
- if (sub_8012224() == TRUE)
+ if (IsRfuRecoveringFromLinkLoss() == TRUE)
{
- sprite->data[0] = 4;
+ sprite->sNextAnimNum = WIRELESS_STATUS_ANIM_ERROR;
}
- else if (signalStrength < 25)
+ else if (signalStrength <= RFU_LINK_ICON_LEVEL1_MAX)
{
- sprite->data[0] = 3;
+ sprite->sNextAnimNum = WIRELESS_STATUS_ANIM_SEARCHING;
}
- else if (signalStrength >= 25 && signalStrength < 127)
+ else if (signalStrength >= RFU_LINK_ICON_LEVEL2_MIN && signalStrength <= RFU_LINK_ICON_LEVEL2_MAX)
{
- sprite->data[0] = 2;
+ sprite->sNextAnimNum = WIRELESS_STATUS_ANIM_1_BAR;
}
- else if (signalStrength >= 127 && signalStrength < 229)
+ else if (signalStrength >= RFU_LINK_ICON_LEVEL3_MIN && signalStrength <= RFU_LINK_ICON_LEVEL3_MAX)
{
- sprite->data[0] = 1;
+ sprite->sNextAnimNum = WIRELESS_STATUS_ANIM_2_BARS;
}
- else if (signalStrength >= 229)
+ else if (signalStrength >= RFU_LINK_ICON_LEVEL4_MIN)
{
- sprite->data[0] = 0;
+ sprite->sNextAnimNum = WIRELESS_STATUS_ANIM_3_BARS;
}
- if (sprite->data[0] != sprite->data[1])
+ if (sprite->sNextAnimNum != sprite->sSavedAnimNum)
{
- sub_800E15C(sprite, sprite->data[0]);
- sprite->data[1] = sprite->data[0];
+ SetWirelessStatusIndicatorAnim(sprite, sprite->sNextAnimNum);
+ sprite->sSavedAnimNum = sprite->sNextAnimNum;
}
- if (sprite->anims[sprite->data[2]][sprite->data[4]].frame.duration < sprite->data[3])
+ if (sprite->anims[sprite->sCurrAnimNum][sprite->sFrameIdx].frame.duration < sprite->sFrameDelay)
{
- sprite->data[4]++;
- sprite->data[3] = 0;
- if (sprite->anims[sprite->data[2]][sprite->data[4]].type == -2)
+ sprite->sFrameIdx++;
+ sprite->sFrameDelay = 0;
+ if (sprite->anims[sprite->sCurrAnimNum][sprite->sFrameIdx].type == -2)
{
- sprite->data[4] = 0;
+ sprite->sFrameIdx = 0;
}
}
else
{
- sprite->data[3]++;
+ sprite->sFrameDelay++;
}
gMain.oamBuffer[125] = sWirelessStatusIndicatorOamData;
gMain.oamBuffer[125].x = sprite->pos1.x + sprite->centerToCornerVecX;
gMain.oamBuffer[125].y = sprite->pos1.y + sprite->centerToCornerVecY;
gMain.oamBuffer[125].paletteNum = sprite->oam.paletteNum;
- gMain.oamBuffer[125].tileNum = sprite->data[6] + sprite->anims[sprite->data[2]][sprite->data[4]].frame.imageValue;
+ gMain.oamBuffer[125].tileNum = sprite->sTileStart + sprite->anims[sprite->sCurrAnimNum][sprite->sFrameIdx].frame.imageValue;
CpuCopy16(gMain.oamBuffer + 125, (struct OamData *)OAM + 125, sizeof(struct OamData));
- if (sub_8011A74() == 1)
+ if (RfuGetStatus() == RFU_STATUS_FATAL_ERROR)
{
DestroyWirelessStatusIndicatorSprite();
}
}
}
-void CopyTrainerRecord(struct TrainerNameRecord *dest, u32 trainerId, const u8 *name)
+#undef sNextAnimNum
+#undef sSavedAnimNum
+#undef sCurrAnimNum
+#undef sFrameDelay
+#undef sFrameIdx
+#undef sTileStart
+#undef sValidator
+
+static void CopyTrainerRecord(struct TrainerNameRecord *dest, u32 trainerId, const u8 *name)
{
dest->trainerId = trainerId;
StringCopy(dest->trainerName, name);
}
-bool32 NameIsNotEmpty(const u8 *name)
+static bool32 NameIsNotEmpty(const u8 *name)
{
s32 i;
for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++)
{
if (name[i] != 0)
- {
return TRUE;
- }
}
return FALSE;
}
@@ -856,13 +995,13 @@ void RecordMixTrainerNames(void)
s32 j;
s32 nextSpace;
s32 connectedTrainerRecordIndices[5];
- struct TrainerNameRecord *newRecords = calloc(20, sizeof(struct TrainerNameRecord));
+ struct TrainerNameRecord *newRecords = calloc(ARRAY_COUNT(gSaveBlock1Ptr->trainerNameRecords), sizeof(struct TrainerNameRecord));
// Check if we already have a record saved for connected trainers.
for (i = 0; i < GetLinkPlayerCount(); i++)
{
connectedTrainerRecordIndices[i] = -1;
- for (j = 0; j < 20; j++)
+ for (j = 0; j < (int)ARRAY_COUNT(gSaveBlock1Ptr->trainerNameRecords); j++)
{
if ((u16)gLinkPlayers[i].trainerId == gSaveBlock1Ptr->trainerNameRecords[j].trainerId && StringCompare(gLinkPlayers[i].name, gSaveBlock1Ptr->trainerNameRecords[j].trainerName) == 0)
{
@@ -890,12 +1029,12 @@ void RecordMixTrainerNames(void)
// Copy all non-empty records to the new list, in the order they appear on the old list. If the list is full,
// the last (oldest) records will be dropped.
- for (i = 0; i < 20; i++)
+ for (i = 0; i < (int)ARRAY_COUNT(gSaveBlock1Ptr->trainerNameRecords); i++)
{
if (NameIsNotEmpty(gSaveBlock1Ptr->trainerNameRecords[i].trainerName))
{
CopyTrainerRecord(&newRecords[nextSpace], gSaveBlock1Ptr->trainerNameRecords[i].trainerId, gSaveBlock1Ptr->trainerNameRecords[i].trainerName);
- if (++nextSpace >= 20)
+ if (++nextSpace >= (int)ARRAY_COUNT(gSaveBlock1Ptr->trainerNameRecords))
{
break;
}
@@ -903,25 +1042,22 @@ void RecordMixTrainerNames(void)
}
// Finalize the new list, and clean up.
- memcpy(gSaveBlock1Ptr->trainerNameRecords, newRecords, 20 * sizeof(struct TrainerNameRecord));
+ memcpy(gSaveBlock1Ptr->trainerNameRecords, newRecords, sizeof(gSaveBlock1Ptr->trainerNameRecords));
free(newRecords);
}
}
-bool32 sub_800E540(u16 id, u8 *name)
+bool32 PlayerHasMetTrainerBefore(u16 id, u8 *name)
{
s32 i;
- for (i = 0; i < 20; i++)
+ for (i = 0; i < (int)ARRAY_COUNT(gSaveBlock1Ptr->trainerNameRecords); i++)
{
if (StringCompare(gSaveBlock1Ptr->trainerNameRecords[i].trainerName, name) == 0 && gSaveBlock1Ptr->trainerNameRecords[i].trainerId == id)
- {
return TRUE;
- }
+
if (!NameIsNotEmpty(gSaveBlock1Ptr->trainerNameRecords[i].trainerName))
- {
return FALSE;
- }
}
return FALSE;
}
@@ -930,7 +1066,7 @@ void WipeTrainerNameRecords(void)
{
s32 i;
- for (i = 0; i < 20; i++)
+ for (i = 0; i < (int)ARRAY_COUNT(gSaveBlock1Ptr->trainerNameRecords); i++)
{
gSaveBlock1Ptr->trainerNameRecords[i].trainerId = 0;
CpuFill16(0, gSaveBlock1Ptr->trainerNameRecords[i].trainerName, 8);
diff --git a/src/main.c b/src/main.c
index cf19f39b3..454fefc5c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -113,7 +113,7 @@ void AgbMain()
InitIntrHandlers();
m4aSoundInit();
EnableVCountIntrAtLine150();
- sub_800E6D0();
+ InitRFU();
RtcInit();
CheckForFlashMemory();
InitMainCallbacks();
@@ -280,7 +280,7 @@ static void ReadKeys(void)
gMain.heldKeys = gMain.heldKeysRaw;
// Remap L to A if the L=A option is enabled.
- if (gSaveBlock2Ptr->optionsButtonMode == 2)
+ if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
{
if (gMain.newKeys & L_BUTTON)
gMain.newKeys |= A_BUTTON;
@@ -367,7 +367,7 @@ static void VBlankIntr(void)
if (!gMain.inBattle || !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_RECORDED)))
Random();
- sub_800E174();
+ UpdateWirelessStatusIndicatorSprite();
INTR_CHECK |= INTR_FLAG_VBLANK;
gMain.intrCheck |= INTR_FLAG_VBLANK;
diff --git a/src/main_menu.c b/src/main_menu.c
index 91931e581..781d7f85c 100644
--- a/src/main_menu.c
+++ b/src/main_menu.c
@@ -1,7 +1,6 @@
#include "global.h"
#include "trainer_pokemon_sprites.h"
#include "bg.h"
-#include "constants/flags.h"
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/species.h"
diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c
index dc5a0b335..bbf0f8972 100644
--- a/src/mauville_old_man.c
+++ b/src/mauville_old_man.c
@@ -3,7 +3,6 @@
#include "constants/songs.h"
#include "constants/easy_chat.h"
#include "constants/event_objects.h"
-#include "constants/vars.h"
#include "mauville_old_man.h"
#include "event_data.h"
#include "string_util.h"
diff --git a/src/menu.c b/src/menu.c
index 738c904ce..7c90c4d93 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -18,7 +18,6 @@
#include "task.h"
#include "text_window.h"
#include "window.h"
-#include "constants/flags.h"
#include "constants/songs.h"
#define DLG_WINDOW_PALETTE_NUM 15
@@ -2107,7 +2106,7 @@ void sub_819A27C(u8 windowId, u16 speciesId, u32 personality, u16 x, u16 y)
BlitBitmapToWindow(windowId, GetMonIconPtr(speciesId, personality, 1), x, y, 32, 32);
}
-void sub_819A2BC(u8 palOffset, u8 palId)
+void ListMenuLoadStdPalAt(u8 palOffset, u8 palId)
{
const u16 *palette;
diff --git a/src/mevent2.c b/src/mevent2.c
index 2991ac27c..7a2edc7f5 100755
--- a/src/mevent2.c
+++ b/src/mevent2.c
@@ -548,12 +548,12 @@ u16 mevent_081445C0(u32 command)
return 0;
}
-void sub_801B940(void)
+void ResetReceivedWonderCardFlag(void)
{
gUnknown_02022C70 = FALSE;
}
-bool32 sub_801B94C(u16 a0)
+bool32 MEventHandleReceivedWonderCard(u16 a0)
{
gUnknown_02022C70 = FALSE;
if (a0 == 0)
@@ -569,7 +569,7 @@ bool32 sub_801B94C(u16 a0)
return TRUE;
}
-void sub_801B990(u32 a0, u32 a1)
+void RecordIdOfWonderCardSenderByEventType(u32 a0, u32 a1)
{
if (gUnknown_02022C70)
{
diff --git a/src/mirage_tower.c b/src/mirage_tower.c
index 2a6d6d6c4..e2f5cefb7 100644
--- a/src/mirage_tower.c
+++ b/src/mirage_tower.c
@@ -14,7 +14,6 @@
#include "sprite.h"
#include "task.h"
#include "window.h"
-#include "constants/flags.h"
#include "constants/maps.h"
#include "constants/rgb.h"
#include "constants/songs.h"
diff --git a/src/mystery_event_menu.c b/src/mystery_event_menu.c
index 14c00fd96..04902dee8 100644
--- a/src/mystery_event_menu.c
+++ b/src/mystery_event_menu.c
@@ -152,7 +152,7 @@ static void CB2_MysteryEventMenu(void)
if (!IsTextPrinterActive(0))
{
gMain.state++;
- gLinkType = LINKTYPE_0x5501;
+ gLinkType = LINKTYPE_MYSTERY_EVENT;
OpenLink();
}
break;
@@ -206,7 +206,7 @@ static void CB2_MysteryEventMenu(void)
{
if (gReceivedRemoteLinkPlayers != 0)
{
- if (GetLinkPlayerDataExchangeStatusTimed(2, 2) == 3)
+ if (GetLinkPlayerDataExchangeStatusTimed(2, 2) == EXCHANGE_DIFF_SELECTIONS)
{
sub_800AC34();
GetEventLoadMessage(gStringVar4, 1);
diff --git a/src/mystery_gift.c b/src/mystery_gift.c
index 06427d2dd..9672fe0ec 100644
--- a/src/mystery_gift.c
+++ b/src/mystery_gift.c
@@ -30,6 +30,7 @@
#include "link_rfu.h"
#include "mevent_news.h"
#include "mevent_server.h"
+#include "constants/cable_club.h"
void bgid_upload_textbox_1(u8 bgId);
void task_add_00_mystery_gift(void);
@@ -1242,21 +1243,21 @@ void task00_mystery_gift(u8 taskId)
case 0:
if (data->source == 1)
{
- MEvent_CreateTask_CardOrNewsWithFriend(0x15);
+ MEvent_CreateTask_CardOrNewsWithFriend(ACTIVITY_WONDER_CARD2);
}
else if (data->source == 0)
{
- MEvent_CreateTask_CardOrNewsOverWireless(0x15);
+ MEvent_CreateTask_CardOrNewsOverWireless(ACTIVITY_WONDER_CARD2);
}
break;
case 1:
if (data->source == 1)
{
- MEvent_CreateTask_CardOrNewsWithFriend(0x16);
+ MEvent_CreateTask_CardOrNewsWithFriend(ACTIVITY_WONDER_NEWS2);
}
else if (data->source == 0)
{
- MEvent_CreateTask_CardOrNewsOverWireless(0x16);
+ MEvent_CreateTask_CardOrNewsOverWireless(ACTIVITY_WONDER_NEWS2);
}
break;
}
@@ -1269,7 +1270,7 @@ void task00_mystery_gift(u8 taskId)
data->state = 7;
mevent_client_do_init(data->IsCardOrNews);
}
- else if (gSpecialVar_Result == 5)
+ else if (gSpecialVar_Result == LINKUP_FAILED)
{
ClearScreenInBg0(TRUE);
data->state = 3;
@@ -1599,10 +1600,10 @@ void task00_mystery_gift(u8 taskId)
switch (data->IsCardOrNews)
{
case 0:
- MEvent_CreateTask_Leader(21);
+ MEvent_CreateTask_Leader(ACTIVITY_WONDER_CARD2);
break;
case 1:
- MEvent_CreateTask_Leader(22);
+ MEvent_CreateTask_Leader(ACTIVITY_WONDER_NEWS2);
break;
}
data->source = 1;
@@ -1615,7 +1616,7 @@ void task00_mystery_gift(u8 taskId)
ClearScreenInBg0(1);
data->state = 31;
}
- else if (gSpecialVar_Result == 5)
+ else if (gSpecialVar_Result == LINKUP_FAILED)
{
ClearScreenInBg0(1);
data->state = 18;
diff --git a/src/naming_screen.c b/src/naming_screen.c
index 161d4a7e0..84b540e99 100644
--- a/src/naming_screen.c
+++ b/src/naming_screen.c
@@ -13,7 +13,6 @@
#include "field_player_avatar.h"
#include "event_object_movement.h"
#include "event_data.h"
-#include "constants/vars.h"
#include "constants/songs.h"
#include "pokemon_storage_system.h"
#include "graphics.h"
diff --git a/src/new_game.c b/src/new_game.c
index 290c0c2bb..55a568132 100644
--- a/src/new_game.c
+++ b/src/new_game.c
@@ -197,7 +197,7 @@ void NewGameInitData(void)
WarpToTruck();
ScriptContext2_RunNewScript(EventScript_ResetAllMapFlags);
ResetMiniGamesResults();
- copy_strings_to_sav1();
+ InitUnionRoomChatRegisteredTexts();
InitLilycoveLady();
ResetAllApprenticeData();
ClearRankingHallRecords();
diff --git a/src/overworld.c b/src/overworld.c
index 8937af8f1..ea0d633bc 100644
--- a/src/overworld.c
+++ b/src/overworld.c
@@ -2913,7 +2913,7 @@ bool32 sub_808766C(void)
static u32 GetLinkSendQueueLength(void)
{
if (gWirelessCommType != 0)
- return Rfu.unk_9e8.unk_232;
+ return Rfu.sendQueue.count;
else
return gLink.sendQueue.count;
}
diff --git a/src/party_menu.c b/src/party_menu.c
index c4497e824..d5bc6dfb6 100755
--- a/src/party_menu.c
+++ b/src/party_menu.c
@@ -67,7 +67,6 @@
#include "constants/battle_frontier.h"
#include "constants/easy_chat.h"
#include "constants/field_effects.h"
-#include "constants/flags.h"
#include "constants/item_effects.h"
#include "constants/items.h"
#include "constants/maps.h"
@@ -76,7 +75,6 @@
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/species.h"
-#include "constants/vars.h"
#define PARTY_PAL_SELECTED (1 << 0)
#define PARTY_PAL_FAINTED (1 << 1)
@@ -3527,7 +3525,7 @@ static void CursorCb_Register(u8 taskId)
u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES);
u8 obedience = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_OBEDIENCE);
- switch (CanRegisterMonForTradingBoard(*(struct GFtgtGnameSub *)sub_800F7DC(), species2, species, obedience))
+ switch (CanRegisterMonForTradingBoard(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), species2, species, obedience))
{
case CANT_REGISTER_MON:
StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTradedNow);
@@ -3553,7 +3551,7 @@ static void CursorCb_Trade1(u8 taskId)
u16 species2 = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES2);
u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES);
u8 obedience = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_OBEDIENCE);
- u32 stringId = GetUnionRoomTradeMessageId(*(struct GFtgtGnameSub *)sub_800F7DC(), gUnknown_02022C38, species2, gUnionRoomOfferedSpecies, gUnionRoomRequestedMonType, species, obedience);
+ u32 stringId = GetUnionRoomTradeMessageId(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), gPartnerTgtGnameSub, species2, gUnionRoomOfferedSpecies, gUnionRoomRequestedMonType, species, obedience);
if (stringId != UR_TRADE_MSG_NONE)
{
diff --git a/src/pokeball.c b/src/pokeball.c
index d473f9ba0..1a0561c33 100644
--- a/src/pokeball.c
+++ b/src/pokeball.c
@@ -798,9 +798,9 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[sprite->sBattler]], 1);
if (GetBattlerSide(sprite->sBattler) == B_SIDE_OPPONENT)
- gSprites[gBattlerSpriteIds[sprite->sBattler]].callback = sub_8039B58;
+ gSprites[gBattlerSpriteIds[sprite->sBattler]].callback = SpriteCb_OpponentMonFromBall;
else
- gSprites[gBattlerSpriteIds[sprite->sBattler]].callback = sub_8039E44;
+ gSprites[gBattlerSpriteIds[sprite->sBattler]].callback = SpriteCb_PlayerMonFromBall;
AnimateSprite(&gSprites[gBattlerSpriteIds[sprite->sBattler]]);
gSprites[gBattlerSpriteIds[sprite->sBattler]].data[1] = 0x1000;
diff --git a/src/pokeblock.c b/src/pokeblock.c
index 523c4ad91..506c5e4c4 100644
--- a/src/pokeblock.c
+++ b/src/pokeblock.c
@@ -117,7 +117,7 @@ EWRAM_DATA static struct PokeblockSavedData sSavedPokeblockData = {0};
EWRAM_DATA static struct PokeblockMenuStruct *sPokeblockMenu = NULL;
// const rom data
-const s8 gPokeblockFlavorCompatibilityTable[] =
+const s8 gPokeblockFlavorCompatibilityTable[NUM_NATURES * FLAVOR_COUNT] =
{
// Cool, Beauty, Cute, Smart, Tough
0, 0, 0, 0, 0, // Hardy
@@ -1386,7 +1386,7 @@ s16 PokeblockGetGain(u8 nature, const struct Pokeblock *pokeblock)
{
curGain = GetPokeblockData(pokeblock, flavor + PBLOCK_SPICY);
if (curGain > 0)
- totalGain += curGain * gPokeblockFlavorCompatibilityTable[5 * nature + flavor];
+ totalGain += curGain * gPokeblockFlavorCompatibilityTable[FLAVOR_COUNT * nature + flavor];
}
return totalGain;
diff --git a/src/pokeblock_feed.c b/src/pokeblock_feed.c
index f6e6a19b2..fa29ca981 100644
--- a/src/pokeblock_feed.c
+++ b/src/pokeblock_feed.c
@@ -84,7 +84,7 @@ EWRAM_DATA static struct PokeblockFeedStruct *sPokeblockFeed = NULL;
EWRAM_DATA static struct CompressedSpritePalette sPokeblockSpritePal = {0};
// const rom data
-static const u8 sNatureToMonPokeblockAnim[][2] =
+static const u8 sNatureToMonPokeblockAnim[NUM_NATURES][2] =
{
[NATURE_HARDY] = { 0, 0 },
[NATURE_LONELY] = { 3, 0 },
diff --git a/src/pokedex.c b/src/pokedex.c
index c3d38681c..0541f3f2e 100644
--- a/src/pokedex.c
+++ b/src/pokedex.c
@@ -2218,18 +2218,14 @@ static void CreatePokedexList(u8 dexMode, u8 order)
}
else
{
- bool32 r10;
- s16 r5;
-
- r10 = r5 = i = 0;
- for (i = 0; i < temp_dexCount; i++)
+ s16 r5, r10;
+ for (i = 0, r5 = 0, r10 = 0; i < temp_dexCount; i++)
{
temp_dexNum = i + 1;
if (GetSetPokedexFlag(temp_dexNum, FLAG_GET_SEEN))
r10 = 1;
if (r10)
{
- asm(""); //Needed to match for some reason
sPokedexView->pokedexList[r5].dexNum = temp_dexNum;
sPokedexView->pokedexList[r5].seen = GetSetPokedexFlag(temp_dexNum, FLAG_GET_SEEN);
sPokedexView->pokedexList[r5].owned = GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT);
@@ -4525,7 +4521,11 @@ static void UnusedPrintMonName(u8 windowId, const u8* name, u8 left, u8 top)
;
for (i = 0; i < nameLength; i++)
str[ARRAY_COUNT(str) - nameLength + i] = name[i];
+#ifdef UBFIX
+ str[ARRAY_COUNT(str) - 1] = EOS;
+#else
str[ARRAY_COUNT(str)] = EOS;
+#endif
PrintInfoSubMenuText(windowId, str, left, top);
}
diff --git a/src/pokedex_area_screen.c b/src/pokedex_area_screen.c
index a2545cc1a..0232d4fc4 100755
--- a/src/pokedex_area_screen.c
+++ b/src/pokedex_area_screen.c
@@ -21,7 +21,6 @@
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/species.h"
-#include "constants/vars.h"
#define AREA_SCREEN_WIDTH 32
#define AREA_SCREEN_HEIGHT 20
diff --git a/src/pokemon.c b/src/pokemon.c
index 87ea2551f..80e93c568 100644
--- a/src/pokemon.c
+++ b/src/pokemon.c
@@ -1349,7 +1349,7 @@ const struct SpindaSpot gSpindaSpotGraphics[] =
#include "data/pokemon/item_effects.h"
-const s8 gNatureStatTable[][NUM_EV_STATS] =
+const s8 gNatureStatTable[NUM_NATURES][NUM_NATURE_STATS] =
{
// Atk Def Spd Sp.Atk Sp.Def
{ 0, 0, 0, 0, 0}, // Hardy
@@ -2725,7 +2725,7 @@ void SetDeoxysStats(void)
}
}
-u16 sub_8068B48(void)
+u16 GetUnionRoomTrainerPic(void)
{
u8 linkId;
u32 arrId;
@@ -2740,7 +2740,7 @@ u16 sub_8068B48(void)
return FacilityClassToPicIndex(gLinkPlayerFacilityClasses[arrId]);
}
-u16 sub_8068BB0(void)
+u16 GetUnionRoomTrainerClass(void)
{
u8 linkId;
u32 arrId;
@@ -3234,7 +3234,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
damage /= 2;
}
- if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gBattleMoves[move].target == 8 && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2)
+ if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gBattleMoves[move].target == MOVE_TARGET_BOTH && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2)
damage /= 2;
// moves always do at least 1 damage.
@@ -3281,7 +3281,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
damage /= 2;
}
- if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gBattleMoves[move].target == 8 && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2)
+ if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gBattleMoves[move].target == MOVE_TARGET_BOTH && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2)
damage /= 2;
// are effects of weather negated with cloud nine or air lock
@@ -5372,12 +5372,12 @@ u8 *UseStatIncreaseItem(u16 itemId)
u8 GetNature(struct Pokemon *mon)
{
- return GetMonData(mon, MON_DATA_PERSONALITY, 0) % 25;
+ return GetMonData(mon, MON_DATA_PERSONALITY, 0) % NUM_NATURES;
}
u8 GetNatureFromPersonality(u32 personality)
{
- return personality % 25;
+ return personality % NUM_NATURES;
}
u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
@@ -5747,7 +5747,7 @@ u8 GetTrainerEncounterMusicId(u16 trainerOpponentId)
u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex)
{
// Dont modify HP, Accuracy, or Evasion by nature
- if (statIndex <= STAT_HP || statIndex > NUM_EV_STATS)
+ if (statIndex <= STAT_HP || statIndex > NUM_NATURE_STATS)
{
// Should just be "return n", but it wouldn't match without this.
u16 retVal = n;
@@ -5836,7 +5836,7 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies)
u16 totalEVs = 0;
u16 heldItem;
u8 holdEffect;
- int i;
+ int i, multiplier;
for (i = 0; i < NUM_STATS; i++)
{
@@ -5846,43 +5846,37 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies)
for (i = 0; i < NUM_STATS; i++)
{
- u8 hasHadPokerus;
- int multiplier;
-
if (totalEVs >= MAX_TOTAL_EVS)
break;
-
- hasHadPokerus = CheckPartyHasHadPokerus(mon, 0);
-
- if (hasHadPokerus)
+
+ if (CheckPartyHasHadPokerus(mon, 0))
multiplier = 2;
else
multiplier = 1;
switch (i)
{
- case 0:
+ case STAT_HP:
evIncrease = gBaseStats[defeatedSpecies].evYield_HP * multiplier;
break;
- case 1:
+ case STAT_ATK:
evIncrease = gBaseStats[defeatedSpecies].evYield_Attack * multiplier;
break;
- case 2:
+ case STAT_DEF:
evIncrease = gBaseStats[defeatedSpecies].evYield_Defense * multiplier;
break;
- case 3:
+ case STAT_SPEED:
evIncrease = gBaseStats[defeatedSpecies].evYield_Speed * multiplier;
break;
- case 4:
+ case STAT_SPATK:
evIncrease = gBaseStats[defeatedSpecies].evYield_SpAttack * multiplier;
break;
- case 5:
+ case STAT_SPDEF:
evIncrease = gBaseStats[defeatedSpecies].evYield_SpDefense * multiplier;
break;
}
heldItem = GetMonData(mon, MON_DATA_HELD_ITEM, 0);
-
if (heldItem == ITEM_ENIGMA_BERRY)
{
if (gMain.inBattle)
@@ -6410,13 +6404,13 @@ bool8 IsMonSpriteNotFlipped(u16 species)
s8 GetMonFlavorRelation(struct Pokemon *mon, u8 flavor)
{
u8 nature = GetNature(mon);
- return gPokeblockFlavorCompatibilityTable[nature * 5 + flavor];
+ return gPokeblockFlavorCompatibilityTable[nature * FLAVOR_COUNT + flavor];
}
s8 GetFlavorRelationByPersonality(u32 personality, u8 flavor)
{
u8 nature = GetNatureFromPersonality(personality);
- return gPokeblockFlavorCompatibilityTable[nature * 5 + flavor];
+ return gPokeblockFlavorCompatibilityTable[nature * FLAVOR_COUNT + flavor];
}
bool8 IsTradedMon(struct Pokemon *mon)
diff --git a/src/pokemon_animation.c b/src/pokemon_animation.c
index 1c07b0962..a388be39a 100644
--- a/src/pokemon_animation.c
+++ b/src/pokemon_animation.c
@@ -783,7 +783,7 @@ static const u8 sBackAnimationIds[] =
0x94, 0x95, 0x96, // 0x19
};
-static const u8 sBackAnimNatureModTable[] =
+static const u8 sBackAnimNatureModTable[NUM_NATURES] =
{
[NATURE_HARDY] = 0x00,
[NATURE_LONELY] = 0x02,
diff --git a/src/pokemon_jump.c b/src/pokemon_jump.c
index e755b6ca8..33ddee1b5 100755
--- a/src/pokemon_jump.c
+++ b/src/pokemon_jump.c
@@ -216,7 +216,7 @@ static bool32 sub_802C618(void);
static bool32 sub_802C650(void);
static void sub_802C688(int);
static int sub_802C6B0(void);
-static bool32 sub_802C70C(void);
+static bool32 AreLinkQueuesEmpty(void);
static int sub_802C73C(u8 *);
static void sub_802C780(void);
static int sub_802C790(int);
@@ -400,7 +400,7 @@ static const struct PokemonJumpMons gPkmnJumpSpecies[] =
{ .species = SPECIES_BAGON, .unk2 = 1, },
};
-void sub_802A9A8(u16 partyIndex, MainCallback callback)
+void StartPokemonJump(u16 partyIndex, MainCallback callback)
{
u8 taskId;
@@ -876,7 +876,7 @@ static bool32 sub_802B31C(void)
gUnknown_02022CFC->unk8++;
// fall through
case 1:
- if (sub_802C70C())
+ if (AreLinkQueuesEmpty())
return FALSE;
break;
}
@@ -1146,14 +1146,14 @@ static bool32 sub_802B720(void)
}
break;
case 2:
- if (sub_802C70C())
+ if (AreLinkQueuesEmpty())
{
- CreateTask(sub_8153688, 6);
+ CreateTask(Task_LinkSave, 6);
gUnknown_02022CFC->unk8++;
}
break;
case 3:
- if (!FuncIsActiveTask(sub_8153688))
+ if (!FuncIsActiveTask(Task_LinkSave))
{
sub_802DA14();
gUnknown_02022CFC->unk8++;
@@ -2025,9 +2025,9 @@ static int sub_802C6B0(void)
return count;
}
-static bool32 sub_802C70C(void)
+static bool32 AreLinkQueuesEmpty(void)
{
- return !Rfu.unk_124.unk_8c2 && !Rfu.unk_9e8.unk_232;
+ return !Rfu.recvQueue.count && !Rfu.sendQueue.count;
}
static int sub_802C73C(u8 *arg0)
diff --git a/src/pokenav_match_call_1.c b/src/pokenav_match_call_1.c
index ef1d5343f..1e4239bbc 100755
--- a/src/pokenav_match_call_1.c
+++ b/src/pokenav_match_call_1.c
@@ -12,7 +12,6 @@
#include "sound.h"
#include "string_util.h"
#include "strings.h"
-#include "constants/flags.h"
#include "constants/songs.h"
struct Pokenav3Struct
diff --git a/src/post_battle_event_funcs.c b/src/post_battle_event_funcs.c
index 4fa5d1b21..07690960f 100644
--- a/src/post_battle_event_funcs.c
+++ b/src/post_battle_event_funcs.c
@@ -8,7 +8,6 @@
#include "script_pokemon_util_80F87D8.h"
#include "tv.h"
#include "constants/heal_locations.h"
-#include "constants/flags.h"
#include "constants/tv.h"
int GameClear(void)
diff --git a/src/record_mixing.c b/src/record_mixing.c
index 3a93d72f8..075bc6aee 100644
--- a/src/record_mixing.c
+++ b/src/record_mixing.c
@@ -169,10 +169,9 @@ static const u8 gUnknown_0858CFBE[3][4] =
#define BUFFER_CHUNK_SIZE 200
-// Note: VAR_0x8005 contains the spotId.
void RecordMixingPlayerSpotTriggered(void)
{
- sub_80B37D4(Task_RecordMixing_Main);
+ CreateTask_EnterCableClubSeat(Task_RecordMixing_Main);
}
// these variables were const in R/S, but had to become changeable because of saveblocks changing RAM position
@@ -232,7 +231,7 @@ static void PrepareExchangePacket(void)
if (Link_AnyPartnersPlayingRubyOrSapphire())
{
- if (sub_800A03C() == 0)
+ if (LinkDummy_Return2() == 0)
PrepareUnknownExchangePacket(&sSentRecord->ruby);
else
PrepareExchangePacketForRubySapphire(&sSentRecord->ruby);
@@ -351,7 +350,7 @@ static void Task_RecordMixing_Main(u8 taskId)
{
tState = 4;
if (gWirelessCommType == 0)
- data[10] = sub_80B3050();
+ data[10] = CreateTask_ReestablishCableClubLink();
PrintTextOnRecordMixing(gText_RecordMixingComplete);
data[8] = 0;
@@ -527,7 +526,7 @@ static void Task_CopyReceiveBuffer(u8 taskId)
u8 status = GetBlockReceivedStatus();
u8 handledPlayers = 0;
- if (status == sub_800A9D8())
+ if (status == GetLinkPlayerCountAsBitFlags())
{
u8 i;
@@ -987,12 +986,12 @@ static void Task_DoRecordMixing(u8 taskId)
case 6:
if (!sub_801048C(FALSE))
{
- CreateTask(sub_8153688, 5);
+ CreateTask(Task_LinkSave, 5);
task->data[0] ++;
}
break;
- case 7: // wait for sub_8153688 to finish.
- if (!FuncIsActiveTask(sub_8153688))
+ case 7: // wait for Task_LinkSave to finish.
+ if (!FuncIsActiveTask(Task_LinkSave))
{
if (gWirelessCommType)
{
diff --git a/src/region_map.c b/src/region_map.c
index 287e97fe9..b8e07c835 100644
--- a/src/region_map.c
+++ b/src/region_map.c
@@ -9,7 +9,6 @@
#include "trig.h"
#include "constants/maps.h"
#include "overworld.h"
-#include "constants/flags.h"
#include "event_data.h"
#include "secret_base.h"
#include "string_util.h"
diff --git a/src/rom_81520A8.c b/src/rom_81520A8.c
deleted file mode 100644
index 8b10d44d0..000000000
--- a/src/rom_81520A8.c
+++ /dev/null
@@ -1,218 +0,0 @@
-#include "global.h"
-#include "rom_81520A8.h"
-#include "malloc.h"
-#include "main.h"
-#include "digit_obj_util.h"
-
-static EWRAM_DATA struct
-{
- u8 count;
- struct UnkStruct_81520A8 *unk4;
-} *sUnknown_0203ABB8 = NULL;
-
-void sub_81520A8(void *dest, u16 value, u8 left, u8 top, u8 width, u8 height) // Unused.
-{
- u8 i;
- u8 j;
- u8 x;
- u8 y;
-
- for (i = 0, y = top; i < height; i++)
- {
- for (x = left, j = 0; j < width; j++)
- {
- *(u16 *)((dest) + (y * 64 + x * 2)) = value;
- x = (x + 1) % 32;
- }
- y = (y + 1) % 32;
- }
-}
-
-void sub_8152134(void *dest, const u16 *src, u8 left, u8 top, u8 width, u8 height) // Unused.
-{
- u8 i;
- u8 j;
- u8 x;
- u8 y;
- const u16 *_src;
-
- for (i = 0, _src = src, y = top; i < height; i++)
- {
- for (x = left, j = 0; j < width; j++)
- {
- *(u16 *)((dest) + (y * 64 + x * 2)) = *(_src++);
- x = (x + 1) % 32;
- }
- y = (y + 1) % 32;
- }
-}
-
-bool32 sub_81521C0(u8 count)
-{
- u8 i = 0;
-
- if (count == 0)
- return FALSE;
- if (count > 64)
- count = 64;
-
- sUnknown_0203ABB8 = AllocZeroed(sizeof(*sUnknown_0203ABB8));
- if (sUnknown_0203ABB8 == NULL)
- return FALSE;
- sUnknown_0203ABB8->unk4 = AllocZeroed(count * sizeof(struct UnkStruct_81520A8));
- if (sUnknown_0203ABB8->unk4 == NULL)
- {
- FREE_AND_SET_NULL(sUnknown_0203ABB8);
- return FALSE;
- }
-
- sUnknown_0203ABB8->count = count;
- for (i = 0; i < count; i++)
- {
- memcpy(&sUnknown_0203ABB8->unk4[i].oam, &gDummyOamData, sizeof(struct OamData));
- sUnknown_0203ABB8->unk4[i].unk19_2 = TRUE;
- }
-
- return TRUE;
-}
-
-bool32 sub_8152254(void)
-{
- u8 i = 0;
-
- if (sUnknown_0203ABB8 == NULL)
- return FALSE;
-
- for (i = 0; i < sUnknown_0203ABB8->count; i++)
- memcpy(&gMain.oamBuffer[i + 64], &gDummyOamData, sizeof(struct OamData));
-
- memset(sUnknown_0203ABB8->unk4, 0, sUnknown_0203ABB8->count * sizeof(struct UnkStruct_81520A8));
- FREE_AND_SET_NULL(sUnknown_0203ABB8->unk4);
- memset(sUnknown_0203ABB8, 0, sizeof(*sUnknown_0203ABB8));
- FREE_AND_SET_NULL(sUnknown_0203ABB8);
-
- return TRUE;
-}
-
-bool32 sub_81522D4(void)
-{
- u8 i = 0;
-
- if (sUnknown_0203ABB8 == NULL || sUnknown_0203ABB8->unk4 == NULL)
- return FALSE;
-
- for (i = 0; i < sUnknown_0203ABB8->count; i++)
- {
- if (sUnknown_0203ABB8->unk4[i].unk19_0 && sUnknown_0203ABB8->unk4[i].unk19_1)
- {
- if (sUnknown_0203ABB8->unk4[i].callback != NULL)
- sUnknown_0203ABB8->unk4[i].callback(&sUnknown_0203ABB8->unk4[i]);
-
- if (sUnknown_0203ABB8->unk4[i].unk19_2)
- {
- memcpy(&gMain.oamBuffer[i + 64], &gDummyOamData, sizeof(struct OamData));
- }
- else
- {
- sUnknown_0203ABB8->unk4[i].oam.y = sUnknown_0203ABB8->unk4[i].y + sUnknown_0203ABB8->unk4[i].yDelta;
- sUnknown_0203ABB8->unk4[i].oam.x = sUnknown_0203ABB8->unk4[i].x + sUnknown_0203ABB8->unk4[i].xDelta;
- sUnknown_0203ABB8->unk4[i].oam.priority = sUnknown_0203ABB8->unk4[i].priority;
- sUnknown_0203ABB8->unk4[i].oam.tileNum = sUnknown_0203ABB8->unk4[i].tileNum;
- memcpy(&gMain.oamBuffer[i + 64], &sUnknown_0203ABB8->unk4[i], sizeof(struct OamData));
- }
- }
- }
-
- return TRUE;
-}
-
-static bool32 sub_81523F4(struct UnkStruct_81520A8 *structPtr, u8 arg1)
-{
- u16 tileStart;
-
- if (structPtr == NULL)
- return FALSE;
-
- tileStart = GetSpriteTileStartByTag(structPtr->tileTag);
- if (tileStart == 0xFFFF)
- return FALSE;
-
- structPtr->unk18 = arg1;
- structPtr->tileNum = (GetTilesPerImage(structPtr->oam.shape, structPtr->oam.size) * arg1) + tileStart;
- return TRUE;
-}
-
-u8 sub_8152438(u8 id, void (*func)(struct UnkStruct_81520A8 *))
-{
- if (sUnknown_0203ABB8 == NULL || id >= sUnknown_0203ABB8->count)
- return 0xFF;
- else if (!sUnknown_0203ABB8->unk4[id].unk19_0)
- return 0xFF;
-
- sUnknown_0203ABB8->unk4[id].callback = func;
- return id;
-}
-
-u8 sub_8152474(u8 id, u8 dataArrayId, s16 dataValue)
-{
- if (sUnknown_0203ABB8 == NULL || id >= sUnknown_0203ABB8->count)
- return 0xFF;
- else if (!sUnknown_0203ABB8->unk4[id].unk19_0 || dataArrayId >= ARRAY_COUNT(sUnknown_0203ABB8->unk4[id].data))
- return 0xFF;
-
- sUnknown_0203ABB8->unk4[id].data[dataArrayId] = dataValue;
- return id;
-}
-
-u8 sub_81524C4(const struct OamData *oam, u16 tileTag, u16 palTag, s16 x, s16 y, u8 arg5, u8 priority)
-{
- struct UnkStruct_81520A8 *structPtr = NULL;
- u8 i;
-
- if (sUnknown_0203ABB8 == NULL || oam == NULL)
- return 0xFF;
-
- for (i = 0; i < sUnknown_0203ABB8->count; i++)
- {
- if (!sUnknown_0203ABB8->unk4[i].unk19_0)
- {
- structPtr = &sUnknown_0203ABB8->unk4[i];
- memset(structPtr, 0, sizeof(*structPtr));
- structPtr->id = i;
- structPtr->unk19_0 = TRUE;
- structPtr->unk19_1 = TRUE;
- break;
- }
- }
-
- if (structPtr == NULL)
- return 0xFF;
-
- memcpy(&structPtr->oam, oam, sizeof(*oam));
- structPtr->tileTag = tileTag;
- structPtr->palTag = palTag;
- structPtr->x = x;
- structPtr->y = y;
- structPtr->oam.paletteNum = IndexOfSpritePaletteTag(palTag);
- if (priority < 4)
- {
- structPtr->priority = priority;
- structPtr->oam.priority = priority;
- }
- sub_81523F4(structPtr, arg5);
-
- return structPtr->id;
-}
-
-u8 sub_81525D0(u8 id)
-{
- if (sUnknown_0203ABB8 == NULL || !sUnknown_0203ABB8->unk4[id].unk19_0)
- return 0xFF;
-
- memset(&sUnknown_0203ABB8->unk4[id], 0, sizeof(struct UnkStruct_81520A8));
- sUnknown_0203ABB8->unk4[id].oam.y = 160;
- sUnknown_0203ABB8->unk4[id].oam.x = 240;
- sUnknown_0203ABB8->unk4[id].unk19_2 = TRUE;
- memcpy(&gMain.oamBuffer[id + 64], &gDummyOamData, sizeof(struct OamData));
- return id;
-}
diff --git a/src/save.c b/src/save.c
index c19aff4d8..09e1b7aae 100644
--- a/src/save.c
+++ b/src/save.c
@@ -897,74 +897,78 @@ u32 TryWriteSpecialSaveSection(u8 sector, u8* src)
return SAVE_STATUS_OK;
}
-void sub_8153688(u8 taskId)
+#define tState data[0]
+#define tTimer data[1]
+#define tPartialSave data[2]
+
+void Task_LinkSave(u8 taskId)
{
- s16* taskData = gTasks[taskId].data;
+ s16* data = gTasks[taskId].data;
- switch (taskData[0])
+ switch (tState)
{
case 0:
gSoftResetDisabled = TRUE;
- taskData[0] = 1;
+ tState = 1;
break;
case 1:
sub_800ADF8();
- taskData[0] = 2;
+ tState = 2;
break;
case 2:
if (IsLinkTaskFinished())
{
- if (taskData[2] == 0)
+ if (!tPartialSave)
save_serialize_map();
- taskData[0] = 3;
+ tState = 3;
}
break;
case 3:
- if (taskData[2] == 0)
+ if (!tPartialSave)
SetContinueGameWarpStatusToDynamicWarp();
sub_8153380();
- taskData[0] = 4;
+ tState = 4;
break;
case 4:
- if (++taskData[1] == 5)
+ if (++tTimer == 5)
{
- taskData[1] = 0;
- taskData[0] = 5;
+ tTimer = 0;
+ tState = 5;
}
break;
case 5:
if (sub_81533AC())
- taskData[0] = 6;
+ tState = 6;
else
- taskData[0] = 4;
+ tState = 4;
break;
case 6:
sub_81533E0();
- taskData[0] = 7;
+ tState = 7;
break;
case 7:
- if (taskData[2] == 0)
+ if (!tPartialSave)
ClearContinueGameWarpStatus2();
sub_800ADF8();
- taskData[0] = 8;
+ tState = 8;
break;
case 8:
if (IsLinkTaskFinished())
{
sub_8153408();
- taskData[0] = 9;
+ tState = 9;
}
break;
case 9:
sub_800ADF8();
- taskData[0] = 10;
+ tState = 10;
break;
case 10:
if (IsLinkTaskFinished())
- taskData[0]++;
+ tState++;
break;
case 11:
- if (++taskData[1] > 5)
+ if (++tTimer > 5)
{
gSoftResetDisabled = FALSE;
DestroyTask(taskId);
@@ -972,3 +976,7 @@ void sub_8153688(u8 taskId)
break;
}
}
+
+#undef tState
+#undef tTimer
+#undef tPartialSave
diff --git a/src/scrcmd.c b/src/scrcmd.c
index 9e62c45c5..4a7f4ea73 100644
--- a/src/scrcmd.c
+++ b/src/scrcmd.c
@@ -5,7 +5,7 @@
#include "clock.h"
#include "coins.h"
#include "contest.h"
-#include "contest_link_80F57C4.h"
+#include "contest_util.h"
#include "contest_painting.h"
#include "data.h"
#include "decoration.h"
@@ -1185,22 +1185,22 @@ bool8 ScrCmd_setobjectmovementtype(struct ScriptContext *ctx)
bool8 ScrCmd_createvobject(struct ScriptContext *ctx)
{
u8 graphicsId = ScriptReadByte(ctx);
- u8 v2 = ScriptReadByte(ctx);
+ u8 objectEventId = ScriptReadByte(ctx);
u16 x = VarGet(ScriptReadHalfword(ctx));
u32 y = VarGet(ScriptReadHalfword(ctx));
u8 elevation = ScriptReadByte(ctx);
u8 direction = ScriptReadByte(ctx);
- sprite_new(graphicsId, v2, x, y, elevation, direction);
+ CreateObjectSprite(graphicsId, objectEventId, x, y, elevation, direction);
return FALSE;
}
bool8 ScrCmd_turnvobject(struct ScriptContext *ctx)
{
- u8 v1 = ScriptReadByte(ctx);
+ u8 objectEventId = ScriptReadByte(ctx);
u8 direction = ScriptReadByte(ctx);
- sub_8097B78(v1, direction);
+ TurnObjectEventSprite(objectEventId, direction);
return FALSE;
}
@@ -1469,7 +1469,9 @@ bool8 ScrCmd_hidemonpic(struct ScriptContext *ctx)
bool8 ScrCmd_showcontestwinner(struct ScriptContext *ctx)
{
u8 contestWinnerId = ScriptReadByte(ctx);
- if (contestWinnerId)
+
+ // Don't save artist's painting yet
+ if (contestWinnerId != CONTEST_WINNER_ARTIST)
SetContestWinnerForPainting(contestWinnerId);
ShowContestWinner();
@@ -1953,14 +1955,14 @@ bool8 ScrCmd_startcontest(struct ScriptContext *ctx)
bool8 ScrCmd_showcontestresults(struct ScriptContext *ctx)
{
- sub_80F8484();
+ ShowContestResults();
ScriptContext1_Stop();
return TRUE;
}
bool8 ScrCmd_contestlinktransfer(struct ScriptContext *ctx)
{
- sub_80F84C4(gSpecialVar_ContestCategory);
+ ContestLinkTransfer(gSpecialVar_ContestCategory);
ScriptContext1_Stop();
return TRUE;
}
diff --git a/src/script_pokemon_util_80F87D8.c b/src/script_pokemon_util_80F87D8.c
index 134004fd0..70f68b879 100755
--- a/src/script_pokemon_util_80F87D8.c
+++ b/src/script_pokemon_util_80F87D8.c
@@ -3,7 +3,7 @@
#include "battle_gfx_sfx_util.h"
#include "berry.h"
#include "contest.h"
-#include "contest_link_80F57C4.h"
+#include "contest_util.h"
#include "contest_painting.h"
#include "data.h"
#include "daycare.h"
@@ -30,7 +30,6 @@
#include "constants/items.h"
#include "constants/species.h"
#include "constants/tv.h"
-#include "constants/vars.h"
#include "constants/battle_frontier.h"
extern const u16 gObjectEventPalette8[];
@@ -122,7 +121,7 @@ void ShouldReadyContestArtist(void)
{
if (gContestFinalStandings[gContestPlayerMonIndex] == 0
&& gSpecialVar_ContestRank == CONTEST_RANK_MASTER
- && gUnknown_02039F08[gContestPlayerMonIndex] >= 800)
+ && gContestMonTotalPoints[gContestPlayerMonIndex] >= 800)
{
gSpecialVar_0x8004 = TRUE;
}
@@ -304,7 +303,7 @@ u8 GiveMonArtistRibbon(void)
if (!hasArtistRibbon
&& gContestFinalStandings[gContestPlayerMonIndex] == 0
&& gSpecialVar_ContestRank == CONTEST_RANK_MASTER
- && gUnknown_02039F08[gContestPlayerMonIndex] >= 800)
+ && gContestMonTotalPoints[gContestPlayerMonIndex] >= 800)
{
hasArtistRibbon = 1;
SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_ARTIST_RIBBON, &hasArtistRibbon);
diff --git a/src/secret_base.c b/src/secret_base.c
index 172568db6..83626710f 100644
--- a/src/secret_base.c
+++ b/src/secret_base.c
@@ -37,6 +37,7 @@
#include "constants/event_bg.h"
#include "constants/decorations.h"
#include "constants/event_objects.h"
+#include "constants/field_specials.h"
#include "constants/items.h"
#include "constants/maps.h"
#include "constants/map_types.h"
@@ -1120,7 +1121,7 @@ const u8 *GetSecretBaseTrainerLoseText(void)
void PrepSecretBaseBattleFlags(void)
{
- TryGainNewFanFromCounter(1);
+ TryGainNewFanFromCounter(FANCOUNTER_BATTLED_AT_BASE);
gTrainerBattleOpponent_A = TRAINER_SECRET_BASE;
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_SECRET_BASE;
}
diff --git a/src/slot_machine.c b/src/slot_machine.c
index 9e94d11f0..d1cb05b18 100644
--- a/src/slot_machine.c
+++ b/src/slot_machine.c
@@ -384,7 +384,7 @@ static const u16 gSlotPayouts[];
static const u8 *const gUnknown_083EDCE4;
static const u8 *const gUnknown_083EDCDC;
static const u32 gReelTimeGfx[];
-static const struct SpriteSheet gSlotMachineSpriteSheets[];
+static const struct SpriteSheet gSlotMachineSpriteSheets[22];
static const struct SpritePalette gSlotMachineSpritePalettes[];
static const u16 *const gUnknown_083EDE20;
static const s16 gInitialReelPositions[][2];
@@ -4171,8 +4171,8 @@ static void sub_81063C0(void)
LZDecompressWram(gSlotMachineReelTime_Gfx, sUnknown_0203AAD4);
sUnknown_0203AAD8 = Alloc(0x3600);
LZDecompressWram(gReelTimeGfx, sUnknown_0203AAD8);
- sUnknown_0203AB30 = AllocZeroed(sizeof(struct SpriteSheet) * 22);
- for (i = 0; i < 22; i++)
+ sUnknown_0203AB30 = AllocZeroed(sizeof(struct SpriteSheet) * ARRAY_COUNT(gSlotMachineSpriteSheets));
+ for (i = 0; i < ARRAY_COUNT(gSlotMachineSpriteSheets); i++)
{
sUnknown_0203AB30[i].data = gSlotMachineSpriteSheets[i].data;
sUnknown_0203AB30[i].size = gSlotMachineSpriteSheets[i].size;
@@ -6708,7 +6708,7 @@ static const struct SubspriteTable *const gUnknown_083EDBC4[] =
NULL
};
-static const struct SpriteSheet gSlotMachineSpriteSheets[] =
+static const struct SpriteSheet gSlotMachineSpriteSheets[22] =
{
{ .data = gSlotMachineReelSymbol1Tiles, .size = 0x200, .tag = 0 },
{ .data = gSlotMachineReelSymbol2Tiles, .size = 0x200, .tag = 1 },
@@ -6727,15 +6727,12 @@ static const struct SpriteSheet gSlotMachineSpriteSheets[] =
{ .data = gSlotMachineNumber7Tiles, .size = 0x40, .tag = 14 },
{ .data = gSlotMachineNumber8Tiles, .size = 0x40, .tag = 15 },
{ .data = gSlotMachineNumber9Tiles, .size = 0x40, .tag = 16 },
-};
-
-static const u8 sUnused1[][8] =
-{
- {0, 0, 0, 0, 0, 2, 18},
- {0, 0, 0, 0, 0, 2, 19},
- {0, 0, 0, 0, 0, 3, 20},
- {0, 0, 0, 0, 0, 3, 21},
- {0, 0, 0, 0, 0, 0, 0}
+ // the data for these sheets is determined at runtime
+ { .data = NULL, .size = 0x200, .tag = 18 },
+ { .data = NULL, .size = 0x200, .tag = 19 },
+ { .data = NULL, .size = 0x300, .tag = 20 },
+ { .data = NULL, .size = 0x300, .tag = 21 },
+ {},
};
static const u8 *const gUnknown_083EDCDC = gUnknown_08DD19F8;
diff --git a/src/start_menu.c b/src/start_menu.c
index 4b6fce57b..88ad364c7 100644
--- a/src/start_menu.c
+++ b/src/start_menu.c
@@ -133,8 +133,8 @@ static u8 BattlePyramidRetireInputCallback(void);
// Task callbacks
static void StartMenuTask(u8 taskId);
static void SaveGameTask(u8 taskId);
-static void sub_80A0550(u8 taskId);
-static void sub_80A08A4(u8 taskId);
+static void Task_SaveAfterLinkBattle(u8 taskId);
+static void Task_WaitForBattleTowerLinkSave(u8 taskId);
static bool8 FieldCB_ReturnToFieldStartMenu(void);
static const struct WindowTemplate sSafariBallsWindowTemplate = {0, 1, 1, 9, 4, 0xF, 8};
@@ -219,8 +219,8 @@ static bool8 SaveSuccesTimer(void);
static bool8 SaveErrorTimer(void);
static void InitBattlePyramidRetire(void);
static void sub_80A03D8(void);
-static bool32 sub_80A03E4(u8 *par1);
-static void sub_80A0540(void);
+static bool32 InitSaveWindowAfterLinkBattle(u8 *par1);
+static void CB2_SaveAfterLinkBattle(void);
static void ShowSaveInfoWindow(void);
static void RemoveSaveInfoWindow(void);
static void HideStartMenuWindow(void);
@@ -525,7 +525,7 @@ void Task_ShowStartMenu(u8 taskId)
{
case 0:
if (InUnionRoom() == TRUE)
- var_800D_set_xB();
+ SetUsingUnionRoomStartMenu();
gMenuCallback = HandleStartMenuInput;
task->data[0]++;
@@ -1159,9 +1159,9 @@ static void sub_80A03D8(void)
TransferPlttBuffer();
}
-static bool32 sub_80A03E4(u8 *par1)
+static bool32 InitSaveWindowAfterLinkBattle(u8 *state)
{
- switch (*par1)
+ switch (*state)
{
case 0:
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0);
@@ -1193,43 +1193,43 @@ static bool32 sub_80A03E4(u8 *par1)
return TRUE;
}
- (*par1)++;
+ (*state)++;
return FALSE;
}
-void sub_80A0514(void)
+void CB2_SetUpSaveAfterLinkBattle(void)
{
- if (sub_80A03E4(&gMain.state))
+ if (InitSaveWindowAfterLinkBattle(&gMain.state))
{
- CreateTask(sub_80A0550, 0x50);
- SetMainCallback2(sub_80A0540);
+ CreateTask(Task_SaveAfterLinkBattle, 0x50);
+ SetMainCallback2(CB2_SaveAfterLinkBattle);
}
}
-static void sub_80A0540(void)
+static void CB2_SaveAfterLinkBattle(void)
{
RunTasks();
UpdatePaletteFade();
}
-static void sub_80A0550(u8 taskId)
+static void Task_SaveAfterLinkBattle(u8 taskId)
{
- s16 *step = gTasks[taskId].data;
+ s16 *state = gTasks[taskId].data;
if (!gPaletteFade.active)
{
- switch (*step)
+ switch (*state)
{
case 0:
FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0,
1,
gText_SavingDontTurnOffPower,
- 255,
+ TEXT_SPEED_FF,
NULL,
- 2,
- 1,
- 3);
+ TEXT_COLOR_DARK_GREY,
+ TEXT_COLOR_WHITE,
+ TEXT_COLOR_LIGHT_GREY);
DrawTextBorderOuter(0, 8, 14);
PutWindowTilemap(0);
CopyWindowToVram(0, 3);
@@ -1237,37 +1237,37 @@ static void sub_80A0550(u8 taskId)
if (gWirelessCommType != 0 && InUnionRoom())
{
- if (sub_800A07C())
+ if (Link_AnyPartnersPlayingFRLG_JP())
{
- *step = 1;
+ *state = 1;
}
else
{
- *step = 5;
+ *state = 5;
}
}
else
{
gSoftResetDisabled = 1;
- *step = 1;
+ *state = 1;
}
break;
case 1:
SetContinueGameWarpStatusToDynamicWarp();
FullSaveGame();
- *step = 2;
+ *state = 2;
break;
case 2:
if (CheckSaveFile())
{
ClearContinueGameWarpStatus2();
- *step = 3;
+ *state = 3;
gSoftResetDisabled = 0;
}
break;
case 3:
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
- *step = 4;
+ *state = 4;
break;
case 4:
FreeAllWindowBuffers();
@@ -1275,13 +1275,13 @@ static void sub_80A0550(u8 taskId)
DestroyTask(taskId);
break;
case 5:
- CreateTask(sub_8153688, 0x5);
- *step = 6;
+ CreateTask(Task_LinkSave, 5);
+ *state = 6;
break;
case 6:
- if (!FuncIsActiveTask(sub_8153688))
+ if (!FuncIsActiveTask(Task_LinkSave))
{
- *step = 3;
+ *state = 3;
}
break;
}
@@ -1357,22 +1357,26 @@ static void RemoveSaveInfoWindow(void)
RemoveWindow(sSaveInfoWindowId);
}
-static void sub_80A08A4(u8 taskId)
+static void Task_WaitForBattleTowerLinkSave(u8 taskId)
{
- if (!FuncIsActiveTask(sub_8153688))
+ if (!FuncIsActiveTask(Task_LinkSave))
{
DestroyTask(taskId);
EnableBothScriptContexts();
}
}
-void sub_80A08CC(void)
+#define tPartialSave data[2]
+
+void SaveForBattleTowerLink(void)
{
- u8 taskId = CreateTask(sub_8153688, 0x5);
- gTasks[taskId].data[2] = 1;
- gTasks[CreateTask(sub_80A08A4, 0x6)].data[1] = taskId;
+ u8 taskId = CreateTask(Task_LinkSave, 5);
+ gTasks[taskId].tPartialSave = TRUE;
+ gTasks[CreateTask(Task_WaitForBattleTowerLinkSave, 6)].data[1] = taskId;
}
+#undef tPartialSave
+
static void HideStartMenuWindow(void)
{
ClearStdWindowAndFrame(GetStartMenuWindowId(), TRUE);
diff --git a/src/starter_choose.c b/src/starter_choose.c
index dbdb1a8b3..6295e33ca 100644
--- a/src/starter_choose.c
+++ b/src/starter_choose.c
@@ -14,6 +14,7 @@
#include "sound.h"
#include "sprite.h"
#include "starter_choose.h"
+#include "strings.h"
#include "task.h"
#include "text.h"
#include "text_window.h"
@@ -27,54 +28,45 @@
#define STARTER_MON_COUNT 3
// Position of the sprite of the selected starter Pokemon
-#define STARTER_PKMN_POS_X 120
+#define STARTER_PKMN_POS_X (DISPLAY_WIDTH / 2)
#define STARTER_PKMN_POS_Y 64
-// text
-extern const u8 gText_BirchInTrouble[];
-extern const u8 gText_ConfirmStarterChoice[];
-
-// this file's functions
-static void MainCallback2_StarterChoose(void);
-static void sub_8134604(void);
-static void Task_StarterChoose1(u8 taskId);
-static void Task_StarterChoose2(u8 taskId);
-static void Task_StarterChoose3(u8 taskId);
-static void Task_StarterChoose4(u8 taskId);
-static void Task_StarterChoose5(u8 taskId);
-static void Task_StarterChoose6(u8 taskId);
+#define TAG_POKEBALL_SELECT 0x1000
+#define TAG_STARTER_CIRCLE 0x1001
+
+static void CB2_StarterChoose(void);
+static void ClearStarterLabel(void);
+static void Task_StarterChoose(u8 taskId);
+static void Task_HandleStarterChooseInput(u8 taskId);
+static void Task_WaitForStarterSprite(u8 taskId);
+static void Task_AskConfirmStarter(u8 taskId);
+static void Task_HandleConfirmStarterInput(u8 taskId);
+static void Task_DeclineStarter(u8 taskId);
static void Task_MoveStarterChooseCursor(u8 taskId);
-static void sub_8134668(u8 taskId);
+static void Task_CreateStarterLabel(u8 taskId);
static void CreateStarterPokemonLabel(u8 selection);
static u8 CreatePokemonFrontSprite(u16 species, u8 x, u8 y);
-void sub_81346DC(struct Sprite *sprite);
-void sub_813473C(struct Sprite *sprite);
-void StarterPokemonSpriteCallback(struct Sprite *sprite);
+static void SpriteCB_SelectionHand(struct Sprite *sprite);
+static void SpriteCB_Pokeball(struct Sprite *sprite);
+static void SpriteCB_StarterPokemon(struct Sprite *sprite);
-static u16 sStarterChooseWindowId;
+static u16 sStarterLabelWindowId;
-// .rodata
const u16 gBirchBagGrassPal[][16] =
{
INCBIN_U16("graphics/misc/birch_bag.gbapal"),
INCBIN_U16("graphics/misc/birch_grass.gbapal"),
};
-const u16 gBirchBallarrow_Pal[] = INCBIN_U16("graphics/misc/birch_ballarrow.gbapal");
-
-const u16 gBirchCircle_Pal[] = INCBIN_U16("graphics/misc/birch_circle.gbapal");
-
+static const u16 sPokeballSelection_Pal[] = INCBIN_U16("graphics/misc/pokeball_selection.gbapal");
+static const u16 sStarterCircle_Pal[] = INCBIN_U16("graphics/misc/starter_circle.gbapal");
const u32 gBirchBagTilemap[] = INCBIN_U32("graphics/misc/birch_bag_map.bin.lz");
-
const u32 gBirchGrassTilemap[] = INCBIN_U32("graphics/misc/birch_grass_map.bin.lz");
+const u32 gBirchHelpGfx[] = INCBIN_U32("graphics/misc/birch_help.4bpp.lz"); // Birch bag and grass combined
+const u32 gPokeballSelection_Gfx[] = INCBIN_U32("graphics/misc/pokeball_selection.4bpp.lz");
+static const u32 sStarterCircle_Gfx[] = INCBIN_U32("graphics/misc/starter_circle.4bpp.lz");
-const u32 gBirchHelpGfx[] = INCBIN_U32("graphics/misc/birch_help.4bpp.lz");
-
-const u32 gUnknown_085B18AC[] = INCBIN_U32("graphics/misc/birch_ballarrow.4bpp.lz");
-
-const u32 gUnknown_085B1BCC[] = INCBIN_U32("graphics/misc/birch_circle.4bpp.lz");
-
-static const struct WindowTemplate gUnknown_085B1DCC[] =
+static const struct WindowTemplate sWindowTemplates[] =
{
{
.bg = 0,
@@ -88,7 +80,7 @@ static const struct WindowTemplate gUnknown_085B1DCC[] =
DUMMY_WIN_TEMPLATE,
};
-static const struct WindowTemplate gUnknown_085B1DDC =
+static const struct WindowTemplate sWindowTemplate_ConfirmStarter =
{
.bg = 0,
.tilemapLeft = 24,
@@ -99,7 +91,7 @@ static const struct WindowTemplate gUnknown_085B1DDC =
.baseBlock = 0x0260
};
-static const struct WindowTemplate gUnknown_085B1DE4 =
+static const struct WindowTemplate sWindowTemplate_StarterLabel =
{
.bg = 0,
.tilemapLeft = 0,
@@ -117,7 +109,7 @@ static const u8 sPokeballCoords[STARTER_MON_COUNT][2] =
{180, 64},
};
-static const u8 sStarterLabelCoords[][2] =
+static const u8 sStarterLabelCoords[STARTER_MON_COUNT][2] =
{
{0, 9},
{16, 10},
@@ -131,7 +123,7 @@ static const u16 sStarterMon[STARTER_MON_COUNT] =
SPECIES_MUDKIP,
};
-static const struct BgTemplate gUnknown_085B1E00[3] =
+static const struct BgTemplate sBgTemplates[3] =
{
{
.bg = 0,
@@ -164,7 +156,7 @@ static const struct BgTemplate gUnknown_085B1E00[3] =
static const u8 sTextColors[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GREY};
-static const struct OamData gOamData_85B1E10 =
+static const struct OamData sOam_Hand =
{
.y = 160,
.affineMode = ST_OAM_AFFINE_OFF,
@@ -181,7 +173,7 @@ static const struct OamData gOamData_85B1E10 =
.affineParam = 0,
};
-static const struct OamData gOamData_85B1E18 =
+static const struct OamData sOam_Pokeball =
{
.y = 160,
.affineMode = ST_OAM_AFFINE_OFF,
@@ -198,7 +190,7 @@ static const struct OamData gOamData_85B1E18 =
.affineParam = 0,
};
-static const struct OamData gOamData_85B1E20 =
+static const struct OamData sOam_StarterCircle =
{
.y = 160,
.affineMode = ST_OAM_AFFINE_DOUBLE,
@@ -222,19 +214,19 @@ static const u8 sCursorCoords[][2] =
{180, 32},
};
-static const union AnimCmd gSpriteAnim_85B1E30[] =
+static const union AnimCmd sAnim_Hand[] =
{
ANIMCMD_FRAME(48, 30),
ANIMCMD_END,
};
-static const union AnimCmd gSpriteAnim_85B1E38[] =
+static const union AnimCmd sAnim_Pokeball_Still[] =
{
ANIMCMD_FRAME(0, 30),
ANIMCMD_END,
};
-static const union AnimCmd gSpriteAnim_85B1E40[] =
+static const union AnimCmd sAnim_Pokeball_Moving[] =
{
ANIMCMD_FRAME(16, 4),
ANIMCMD_FRAME(0, 4),
@@ -256,109 +248,109 @@ static const union AnimCmd gSpriteAnim_85B1E40[] =
ANIMCMD_JUMP(0),
};
-static const union AnimCmd gSpriteAnim_85B1E88[] =
+static const union AnimCmd sAnim_StarterCircle[] =
{
ANIMCMD_FRAME(0, 8),
ANIMCMD_END,
};
-static const union AnimCmd * const gSpriteAnimTable_85B1E90[] =
+static const union AnimCmd * const sAnims_Hand[] =
{
- gSpriteAnim_85B1E30,
+ sAnim_Hand,
};
-static const union AnimCmd * const gSpriteAnimTable_85B1E94[] =
+static const union AnimCmd * const sAnims_Pokeball[] =
{
- gSpriteAnim_85B1E38,
- gSpriteAnim_85B1E40,
+ sAnim_Pokeball_Still,
+ sAnim_Pokeball_Moving,
};
-static const union AnimCmd * const gSpriteAnimTable_85B1E9C[] =
+static const union AnimCmd * const sAnims_StarterCircle[] =
{
- gSpriteAnim_85B1E88,
+ sAnim_StarterCircle,
};
-static const union AffineAnimCmd gSpriteAffineAnim_85B1EA0[] =
+static const union AffineAnimCmd sAffineAnim_StarterPokemon[] =
{
AFFINEANIMCMD_FRAME(16, 16, 0, 0),
AFFINEANIMCMD_FRAME(16, 16, 0, 15),
AFFINEANIMCMD_END,
};
-static const union AffineAnimCmd gSpriteAffineAnim_85B1EB8[] =
+static const union AffineAnimCmd sAffineAnim_StarterCircle[] =
{
AFFINEANIMCMD_FRAME(20, 20, 0, 0),
AFFINEANIMCMD_FRAME(20, 20, 0, 15),
AFFINEANIMCMD_END,
};
-static const union AffineAnimCmd * const gUnknown_085B1ED0 = {gSpriteAffineAnim_85B1EA0};
-static const union AffineAnimCmd * const gSpriteAffineAnimTable_85B1ED4[] = {gSpriteAffineAnim_85B1EB8};
+static const union AffineAnimCmd * const sAffineAnims_StarterPokemon = {sAffineAnim_StarterPokemon};
+static const union AffineAnimCmd * const sAffineAnims_StarterCircle[] = {sAffineAnim_StarterCircle};
-static const struct CompressedSpriteSheet gUnknown_085B1ED8[] =
+static const struct CompressedSpriteSheet sSpriteSheet_PokeballSelect[] =
{
{
- .data = gUnknown_085B18AC,
+ .data = gPokeballSelection_Gfx,
.size = 0x0800,
- .tag = 0x1000
+ .tag = TAG_POKEBALL_SELECT
},
{}
};
-static const struct CompressedSpriteSheet gUnknown_085B1EE8[] =
+static const struct CompressedSpriteSheet sSpriteSheet_StarterCircle[] =
{
{
- .data = gUnknown_085B1BCC,
+ .data = sStarterCircle_Gfx,
.size = 0x0800,
- .tag = 0x1001
+ .tag = TAG_STARTER_CIRCLE
},
{}
};
-static const struct SpritePalette gUnknown_085B1EF8[] =
+static const struct SpritePalette sSpritePalettes_StarterChoose[] =
{
{
- .data = gBirchBallarrow_Pal,
- .tag = 0x1000
+ .data = sPokeballSelection_Pal,
+ .tag = TAG_POKEBALL_SELECT
},
{
- .data = gBirchCircle_Pal,
- .tag = 0x1001
+ .data = sStarterCircle_Pal,
+ .tag = TAG_STARTER_CIRCLE
},
{},
};
static const struct SpriteTemplate sSpriteTemplate_Hand =
{
- .tileTag = 0x1000,
- .paletteTag = 0x1000,
- .oam = &gOamData_85B1E10,
- .anims = gSpriteAnimTable_85B1E90,
+ .tileTag = TAG_POKEBALL_SELECT,
+ .paletteTag = TAG_POKEBALL_SELECT,
+ .oam = &sOam_Hand,
+ .anims = sAnims_Hand,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_81346DC
+ .callback = SpriteCB_SelectionHand
};
-static const struct SpriteTemplate sSpriteTemplate_PokeBall =
+static const struct SpriteTemplate sSpriteTemplate_Pokeball =
{
- .tileTag = 0x1000,
- .paletteTag = 0x1000,
- .oam = &gOamData_85B1E18,
- .anims = gSpriteAnimTable_85B1E94,
+ .tileTag = TAG_POKEBALL_SELECT,
+ .paletteTag = TAG_POKEBALL_SELECT,
+ .oam = &sOam_Pokeball,
+ .anims = sAnims_Pokeball,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_813473C
+ .callback = SpriteCB_Pokeball
};
-static const struct SpriteTemplate gUnknown_085B1F40 =
+static const struct SpriteTemplate sSpriteTemplate_StarterCircle =
{
- .tileTag = 0x1001,
- .paletteTag = 0x1001,
- .oam = &gOamData_85B1E20,
- .anims = gSpriteAnimTable_85B1E9C,
+ .tileTag = TAG_STARTER_CIRCLE,
+ .paletteTag = TAG_STARTER_CIRCLE,
+ .oam = &sOam_StarterCircle,
+ .anims = sAnims_StarterCircle,
.images = NULL,
- .affineAnims = gSpriteAffineAnimTable_85B1ED4,
- .callback = StarterPokemonSpriteCallback
+ .affineAnims = sAffineAnims_StarterCircle,
+ .callback = SpriteCB_StarterPokemon
};
// .text
@@ -376,10 +368,15 @@ static void VblankCB_StarterChoose(void)
TransferPlttBuffer();
}
+// Data for Task_StarterChoose
#define tStarterSelection data[0]
#define tPkmnSpriteId data[1]
#define tCircleSpriteId data[2]
+// Data for sSpriteTemplate_Pokeball
+#define sTaskId data[0]
+#define sBallId data[1]
+
void CB2_ChooseStarter(void)
{
u16 savedIme;
@@ -412,8 +409,8 @@ void CB2_ChooseStarter(void)
LZ77UnCompVram(gBirchGrassTilemap, (void *)(BG_SCREEN_ADDR(7)));
ResetBgsAndClearDma3BusyFlags(0);
- InitBgsFromTemplates(0, gUnknown_085B1E00, ARRAY_COUNT(gUnknown_085B1E00));
- InitWindows(gUnknown_085B1DCC);
+ InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates));
+ InitWindows(sWindowTemplates);
DeactivateAllTextPrinters();
LoadUserWindowBorderGfx(0, 0x2A8, 0xD0);
@@ -427,17 +424,17 @@ void CB2_ChooseStarter(void)
LoadPalette(GetOverworldTextboxPalettePtr(), 0xE0, 0x20);
LoadPalette(gBirchBagGrassPal, 0, 0x40);
- LoadCompressedSpriteSheet(&gUnknown_085B1ED8[0]);
- LoadCompressedSpriteSheet(&gUnknown_085B1EE8[0]);
- LoadSpritePalettes(gUnknown_085B1EF8);
+ LoadCompressedSpriteSheet(&sSpriteSheet_PokeballSelect[0]);
+ LoadCompressedSpriteSheet(&sSpriteSheet_StarterCircle[0]);
+ LoadSpritePalettes(sSpritePalettes_StarterChoose);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK);
EnableInterrupts(DISPSTAT_VBLANK);
SetVBlankCallback(VblankCB_StarterChoose);
- SetMainCallback2(MainCallback2_StarterChoose);
+ SetMainCallback2(CB2_StarterChoose);
- SetGpuReg(REG_OFFSET_WININ, 0x3F);
- SetGpuReg(REG_OFFSET_WINOUT, 0x1F);
+ SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR);
+ SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ);
SetGpuReg(REG_OFFSET_WIN0H, 0);
SetGpuReg(REG_OFFSET_WIN0V, 0);
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_TGT1_BG2 | BLDCNT_TGT1_BG3 | BLDCNT_TGT1_OBJ | BLDCNT_TGT1_BD | BLDCNT_EFFECT_DARKEN);
@@ -449,7 +446,7 @@ void CB2_ChooseStarter(void)
ShowBg(2);
ShowBg(3);
- taskId = CreateTask(Task_StarterChoose1, 0);
+ taskId = CreateTask(Task_StarterChoose, 0);
gTasks[taskId].tStarterSelection = 1;
// Create hand sprite
@@ -457,22 +454,22 @@ void CB2_ChooseStarter(void)
gSprites[spriteId].data[0] = taskId;
// Create three Pokeball sprites
- spriteId = CreateSprite(&sSpriteTemplate_PokeBall, sPokeballCoords[0][0], sPokeballCoords[0][1], 2);
- gSprites[spriteId].data[0] = taskId;
- gSprites[spriteId].data[1] = 0;
+ spriteId = CreateSprite(&sSpriteTemplate_Pokeball, sPokeballCoords[0][0], sPokeballCoords[0][1], 2);
+ gSprites[spriteId].sTaskId = taskId;
+ gSprites[spriteId].sBallId = 0;
- spriteId = CreateSprite(&sSpriteTemplate_PokeBall, sPokeballCoords[1][0], sPokeballCoords[1][1], 2);
- gSprites[spriteId].data[0] = taskId;
- gSprites[spriteId].data[1] = 1;
+ spriteId = CreateSprite(&sSpriteTemplate_Pokeball, sPokeballCoords[1][0], sPokeballCoords[1][1], 2);
+ gSprites[spriteId].sTaskId = taskId;
+ gSprites[spriteId].sBallId = 1;
- spriteId = CreateSprite(&sSpriteTemplate_PokeBall, sPokeballCoords[2][0], sPokeballCoords[2][1], 2);
- gSprites[spriteId].data[0] = taskId;
- gSprites[spriteId].data[1] = 2;
+ spriteId = CreateSprite(&sSpriteTemplate_Pokeball, sPokeballCoords[2][0], sPokeballCoords[2][1], 2);
+ gSprites[spriteId].sTaskId = taskId;
+ gSprites[spriteId].sBallId = 2;
- sStarterChooseWindowId = 0xFF;
+ sStarterLabelWindowId = 0xFF;
}
-static void MainCallback2_StarterChoose(void)
+static void CB2_StarterChoose(void)
{
RunTasks();
AnimateSprites();
@@ -481,71 +478,71 @@ static void MainCallback2_StarterChoose(void)
UpdatePaletteFade();
}
-static void Task_StarterChoose1(u8 taskId)
+static void Task_StarterChoose(u8 taskId)
{
CreateStarterPokemonLabel(gTasks[taskId].tStarterSelection);
DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x2A8, 0xD);
AddTextPrinterParameterized(0, 1, gText_BirchInTrouble, 0, 1, 0, NULL);
PutWindowTilemap(0);
ScheduleBgCopyTilemapToVram(0);
- gTasks[taskId].func = Task_StarterChoose2;
+ gTasks[taskId].func = Task_HandleStarterChooseInput;
}
-static void Task_StarterChoose2(u8 taskId)
+static void Task_HandleStarterChooseInput(u8 taskId)
{
u8 selection = gTasks[taskId].tStarterSelection;
- if (gMain.newKeys & A_BUTTON)
+ if (JOY_NEW(A_BUTTON))
{
u8 spriteId;
- sub_8134604();
+ ClearStarterLabel();
// Create white circle background
- spriteId = CreateSprite(&gUnknown_085B1F40, sPokeballCoords[selection][0], sPokeballCoords[selection][1], 1);
+ spriteId = CreateSprite(&sSpriteTemplate_StarterCircle, sPokeballCoords[selection][0], sPokeballCoords[selection][1], 1);
gTasks[taskId].tCircleSpriteId = spriteId;
// Create Pokemon sprite
spriteId = CreatePokemonFrontSprite(GetStarterPokemon(gTasks[taskId].tStarterSelection), sPokeballCoords[selection][0], sPokeballCoords[selection][1]);
- gSprites[spriteId].affineAnims = &gUnknown_085B1ED0;
- gSprites[spriteId].callback = StarterPokemonSpriteCallback;
+ gSprites[spriteId].affineAnims = &sAffineAnims_StarterPokemon;
+ gSprites[spriteId].callback = SpriteCB_StarterPokemon;
gTasks[taskId].tPkmnSpriteId = spriteId;
- gTasks[taskId].func = Task_StarterChoose3;
+ gTasks[taskId].func = Task_WaitForStarterSprite;
}
- else if ((gMain.newKeys & DPAD_LEFT) && selection > 0)
+ else if (JOY_NEW(DPAD_LEFT) && selection > 0)
{
gTasks[taskId].tStarterSelection--;
gTasks[taskId].func = Task_MoveStarterChooseCursor;
}
- else if ((gMain.newKeys & DPAD_RIGHT) && selection < (STARTER_MON_COUNT - 1))
+ else if (JOY_NEW(DPAD_RIGHT) && selection < STARTER_MON_COUNT - 1)
{
gTasks[taskId].tStarterSelection++;
gTasks[taskId].func = Task_MoveStarterChooseCursor;
}
}
-static void Task_StarterChoose3(u8 taskId)
+static void Task_WaitForStarterSprite(u8 taskId)
{
if (gSprites[gTasks[taskId].tCircleSpriteId].affineAnimEnded &&
- gSprites[gTasks[taskId].tCircleSpriteId].pos1.x == STARTER_PKMN_POS_X &&
- gSprites[gTasks[taskId].tCircleSpriteId].pos1.y == STARTER_PKMN_POS_Y)
+ gSprites[gTasks[taskId].tCircleSpriteId].pos1.x == STARTER_PKMN_POS_X &&
+ gSprites[gTasks[taskId].tCircleSpriteId].pos1.y == STARTER_PKMN_POS_Y)
{
- gTasks[taskId].func = Task_StarterChoose4;
+ gTasks[taskId].func = Task_AskConfirmStarter;
}
}
-static void Task_StarterChoose4(u8 taskId)
+static void Task_AskConfirmStarter(u8 taskId)
{
PlayCry1(GetStarterPokemon(gTasks[taskId].tStarterSelection), 0);
FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized(0, 1, gText_ConfirmStarterChoice, 0, 1, 0, NULL);
ScheduleBgCopyTilemapToVram(0);
- CreateYesNoMenu(&gUnknown_085B1DDC, 0x2A8, 0xD, 0);
- gTasks[taskId].func = Task_StarterChoose5;
+ CreateYesNoMenu(&sWindowTemplate_ConfirmStarter, 0x2A8, 0xD, 0);
+ gTasks[taskId].func = Task_HandleConfirmStarterInput;
}
-static void Task_StarterChoose5(u8 taskId)
+static void Task_HandleConfirmStarterInput(u8 taskId)
{
u8 spriteId;
@@ -558,7 +555,7 @@ static void Task_StarterChoose5(u8 taskId)
SetMainCallback2(gMain.savedCallback);
break;
case 1: // NO
- case -1: // B button
+ case MENU_B_PRESSED:
PlaySE(SE_SELECT);
spriteId = gTasks[taskId].tPkmnSpriteId;
FreeOamMatrix(gSprites[spriteId].oam.matrixNum);
@@ -567,14 +564,14 @@ static void Task_StarterChoose5(u8 taskId)
spriteId = gTasks[taskId].tCircleSpriteId;
FreeOamMatrix(gSprites[spriteId].oam.matrixNum);
DestroySprite(&gSprites[spriteId]);
- gTasks[taskId].func = Task_StarterChoose6;
+ gTasks[taskId].func = Task_DeclineStarter;
break;
}
}
-static void Task_StarterChoose6(u8 taskId)
+static void Task_DeclineStarter(u8 taskId)
{
- gTasks[taskId].func = Task_StarterChoose1;
+ gTasks[taskId].func = Task_StarterChoose;
}
static void CreateStarterPokemonLabel(u8 selection)
@@ -589,20 +586,20 @@ static void CreateStarterPokemonLabel(u8 selection)
CopyMonCategoryText(SpeciesToNationalPokedexNum(species), categoryText);
speciesName = gSpeciesNames[species];
- winTemplate = gUnknown_085B1DE4;
+ winTemplate = sWindowTemplate_StarterLabel;
winTemplate.tilemapLeft = sStarterLabelCoords[selection][0];
winTemplate.tilemapTop = sStarterLabelCoords[selection][1];
- sStarterChooseWindowId = AddWindow(&winTemplate);
- FillWindowPixelBuffer(sStarterChooseWindowId, PIXEL_FILL(0));
+ sStarterLabelWindowId = AddWindow(&winTemplate);
+ FillWindowPixelBuffer(sStarterLabelWindowId, PIXEL_FILL(0));
width = GetStringCenterAlignXOffset(7, categoryText, 0x68);
- AddTextPrinterParameterized3(sStarterChooseWindowId, 7, width, 1, sTextColors, 0, categoryText);
+ AddTextPrinterParameterized3(sStarterLabelWindowId, 7, width, 1, sTextColors, 0, categoryText);
width = GetStringCenterAlignXOffset(1, speciesName, 0x68);
- AddTextPrinterParameterized3(sStarterChooseWindowId, 1, width, 0x11, sTextColors, 0, speciesName);
+ AddTextPrinterParameterized3(sStarterLabelWindowId, 1, width, 17, sTextColors, 0, speciesName);
- PutWindowTilemap(sStarterChooseWindowId);
+ PutWindowTilemap(sStarterLabelWindowId);
ScheduleBgCopyTilemapToVram(0);
labelLeft = sStarterLabelCoords[selection][0] * 8 - 4;
@@ -613,12 +610,12 @@ static void CreateStarterPokemonLabel(u8 selection)
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(labelTop, labelBottom));
}
-static void sub_8134604(void)
+static void ClearStarterLabel(void)
{
- FillWindowPixelBuffer(sStarterChooseWindowId, PIXEL_FILL(0));
- ClearWindowTilemap(sStarterChooseWindowId);
- RemoveWindow(sStarterChooseWindowId);
- sStarterChooseWindowId = 0xFF;
+ FillWindowPixelBuffer(sStarterLabelWindowId, PIXEL_FILL(0));
+ ClearWindowTilemap(sStarterLabelWindowId);
+ RemoveWindow(sStarterLabelWindowId);
+ sStarterLabelWindowId = 0xFF;
SetGpuReg(REG_OFFSET_WIN0H, 0);
SetGpuReg(REG_OFFSET_WIN0V, 0);
ScheduleBgCopyTilemapToVram(0);
@@ -626,14 +623,14 @@ static void sub_8134604(void)
static void Task_MoveStarterChooseCursor(u8 taskId)
{
- sub_8134604();
- gTasks[taskId].func = sub_8134668;
+ ClearStarterLabel();
+ gTasks[taskId].func = Task_CreateStarterLabel;
}
-static void sub_8134668(u8 taskId)
+static void Task_CreateStarterLabel(u8 taskId)
{
CreateStarterPokemonLabel(gTasks[taskId].tStarterSelection);
- gTasks[taskId].func = Task_StarterChoose2;
+ gTasks[taskId].func = Task_HandleStarterChooseInput;
}
static u8 CreatePokemonFrontSprite(u16 species, u8 x, u8 y)
@@ -645,25 +642,27 @@ static u8 CreatePokemonFrontSprite(u16 species, u8 x, u8 y)
return spriteId;
}
-void sub_81346DC(struct Sprite *sprite)
+static void SpriteCB_SelectionHand(struct Sprite *sprite)
{
+ // Float up and down above selected pokeball
sprite->pos1.x = sCursorCoords[gTasks[sprite->data[0]].tStarterSelection][0];
sprite->pos1.y = sCursorCoords[gTasks[sprite->data[0]].tStarterSelection][1];
sprite->pos2.y = Sin(sprite->data[1], 8);
sprite->data[1] = (u8)(sprite->data[1]) + 4;
}
-void sub_813473C(struct Sprite *sprite)
+static void SpriteCB_Pokeball(struct Sprite *sprite)
{
- if (gTasks[sprite->data[0]].tStarterSelection == sprite->data[1])
+ // Animate pokeball if currently selected
+ if (gTasks[sprite->sTaskId].tStarterSelection == sprite->sBallId)
StartSpriteAnimIfDifferent(sprite, 1);
else
StartSpriteAnimIfDifferent(sprite, 0);
}
-void StarterPokemonSpriteCallback(struct Sprite *sprite)
+static void SpriteCB_StarterPokemon(struct Sprite *sprite)
{
- //Move sprite to upper center of screen
+ // Move sprite to upper center of screen
if (sprite->pos1.x > STARTER_PKMN_POS_X)
sprite->pos1.x -= 4;
if (sprite->pos1.x < STARTER_PKMN_POS_X)
diff --git a/src/strings.c b/src/strings.c
index 3ca7f693f..2ea06c1ad 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -402,7 +402,7 @@ const u8 gText_PkmnNeedsToReplaceMove[] = _("{STR_VAR_1} wants to learn the\nmov
const u8 gText_StopLearningMove2[] = _("Stop trying to teach\n{STR_VAR_2}?");
const u8 gText_MoveNotLearned[] = _("{STR_VAR_1} did not learn the\nmove {STR_VAR_2}.{PAUSE_UNTIL_PRESS}");
const u8 gText_WhichMoveToForget[] = _("Which move should be forgotten?{PAUSE_UNTIL_PRESS}");
-const u8 gText_12PoofForgotMove[] = _("1, {PAUSE 15}2, and{PAUSE 15}… {PAUSE 15}… {PAUSE 15}… {PAUSE 15}{PLAY_SE 0x0038}Poof!\p{STR_VAR_1} forgot how to\nuse {STR_VAR_2}.\pAnd…{PAUSE_UNTIL_PRESS}");
+const u8 gText_12PoofForgotMove[] = _("1, {PAUSE 15}2, and{PAUSE 15}… {PAUSE 15}… {PAUSE 15}… {PAUSE 15}{PLAY_SE SE_KON}Poof!\p{STR_VAR_1} forgot how to\nuse {STR_VAR_2}.\pAnd…{PAUSE_UNTIL_PRESS}");
const u8 gText_PkmnAlreadyKnows[] = _("{STR_VAR_1} already knows\n{STR_VAR_2}.{PAUSE_UNTIL_PRESS}");
const u8 gText_PkmnHPRestoredByVar2[] = _("{STR_VAR_1}'s HP was restored\nby {STR_VAR_2} point(s).{PAUSE_UNTIL_PRESS}");
const u8 gText_PkmnCuredOfPoison[] = _("{STR_VAR_1} was cured of its\npoisoning.{PAUSE_UNTIL_PRESS}");
@@ -1236,7 +1236,7 @@ const u8 gText_BDot[] = _("B.");
const u8 gText_AnnouncingResults[] = _("Announcing the results!");
const u8 gText_PreliminaryResults[] = _("The preliminary results!");
const u8 gText_Round2Results[] = _("Round 2 results!");
-const u8 gText_Var1sVar2Won[] = _("{STR_VAR_1}'s {STR_VAR_2} won!");
+const u8 gText_ContestantsMonWon[] = _("{STR_VAR_1}'s {STR_VAR_2} won!");
const u8 gText_CommunicationStandby[] = _("Communication standby…");
const u8 gText_ColorDarkGrey[] = _("{COLOR DARK_GREY}");
const u8 gText_ColorDynamic6WhiteDynamic5[] = _("{COLOR_HIGHLIGHT_SHADOW DYNAMIC_COLOR6 WHITE DYNAMIC_COLOR5}"); // Unused
@@ -1261,10 +1261,10 @@ const u8 gJPText_PlayersXPokemon[] = _("{SPECIAL_F7 0x00}の{SPECIAL_F7 0x01}ひ
const u8 gJPText_PlayersXPokmonDoesNotExist[] = _("{SPECIAL_F7 0x00}の{SPECIAL_F7 0x01}ひきめは いません"); // Unused
const u8 gText_ExitingChat[] = _("Exiting the chat…");
const u8 gText_LeaderLeftEndingChat[] = _("The LEADER, {SPECIAL_F7 0x00}, has\nleft, ending the chat.");
-const u8 gText_RegisteredTextChanged[] = _("The registered text has been changed.\nIs it okay to save the game?");
-const u8 gText_AlreadySavedFile_Unused[] = _("There is already a saved file.\nIs it okay to overwrite it?");
-const u8 gText_SavingDontTurnOff_Unused[] = _("SAVING…\nDON'T TURN OFF THE POWER.");
-const u8 gText_PlayerSavedGame_Unused[] = _("{SPECIAL_F7 0x00} saved the game.");
+const u8 gText_RegisteredTextChangedOKToSave[] = _("The registered text has been changed.\nIs it okay to save the game?");
+const u8 gText_AlreadySavedFile_Chat[] = _("There is already a saved file.\nIs it okay to overwrite it?");
+const u8 gText_SavingDontTurnOff_Chat[] = _("SAVING…\nDON'T TURN OFF THE POWER.");
+const u8 gText_PlayerSavedGame_Chat[] = _("{SPECIAL_F7 0x00} saved the game.");
const u8 gText_IfLeaderLeavesChatEnds[] = _("If the LEADER leaves, the chat\nwill end. Is that okay?");
const u8 gText_Hello[] = _("HELLO");
const u8 gText_Pokemon2[] = _("POKéMON");
@@ -1492,7 +1492,7 @@ const u8 gText_FrameTypeNumber[] = _("{COLOR GREEN}{SHADOW LIGHT_GREEN}");
const u8 gText_ButtonTypeNormal[] = _("{COLOR GREEN}{SHADOW LIGHT_GREEN}NORMAL");
const u8 gText_ButtonTypeLR[] = _("{COLOR GREEN}{SHADOW LIGHT_GREEN}LR");
const u8 gText_ButtonTypeLEqualsA[] = _("{COLOR GREEN}{SHADOW LIGHT_GREEN}L=A");
-const u8 gText_XPLink[] = _("{STR_VAR_1}P LINK");
+const u8 gText_NumPlayerLink[] = _("{STR_VAR_1}P LINK");
const u8 gText_BronzeCard[] = _("BRONZE");
const u8 gText_CopperCard[] = _("COPPER");
const u8 gText_SilverCard[] = _("SILVER");
@@ -1745,7 +1745,7 @@ const u8 gText_MoveRelearnerTeachMoveConfirm[] = _("Teach {STR_VAR_2}?");
const u8 gText_MoveRelearnerPkmnLearnedMove[] = _("{STR_VAR_1} learned\n{STR_VAR_2}!");
const u8 gText_MoveRelearnerPkmnTryingToLearnMove[] = _("{STR_VAR_1} is trying to learn\n{STR_VAR_2}.\pBut {STR_VAR_1} can't learn more\nthan four moves.\pDelete an older move to make\nroom for {STR_VAR_2}?");
const u8 gText_MoveRelearnerStopTryingToTeachMove[] = _("Stop trying to teach\n{STR_VAR_2}?");
-const u8 gText_MoveRelearnerAndPoof[] = _("{PAUSE 32}1, {PAUSE 15}2, and {PAUSE 15}… {PAUSE 15}… {PAUSE 15}… {PAUSE 15}{PLAY_SE 0x0038}Poof!\p");
+const u8 gText_MoveRelearnerAndPoof[] = _("{PAUSE 32}1, {PAUSE 15}2, and {PAUSE 15}… {PAUSE 15}… {PAUSE 15}… {PAUSE 15}{PLAY_SE SE_KON}Poof!\p");
const u8 gText_MoveRelearnerPkmnForgotMoveAndLearnedNew[] = _("{STR_VAR_1} forgot {STR_VAR_3}.\pAnd…\p{STR_VAR_1} learned {STR_VAR_2}.");
const u8 gText_MoveRelearnedPkmnDidNotLearnMove[] = _("{STR_VAR_1} did not learn the\nmove {STR_VAR_2}."); // Unused
const u8 gText_MoveRelearnerGiveUp[] = _("Give up trying to teach a new\nmove to {STR_VAR_1}?");
diff --git a/src/trade.c b/src/trade.c
index e22180ae9..3a0f07ac6 100644
--- a/src/trade.c
+++ b/src/trade.c
@@ -52,6 +52,7 @@
#include "constants/rgb.h"
#include "constants/species.h"
#include "constants/songs.h"
+#include "constants/union_room.h"
#define Trade_SendData(ptr) (SendBlock(bitmask_all_link_players_but_self(), ptr->linkData, 20))
@@ -234,7 +235,7 @@ static void CB2_SaveAndEndWirelessTrade(void);
static bool8 SendLinkData(const void *linkData, u32 size)
{
- if (gUnknown_02022C2C == 29)
+ if (gPlayerCurrActivity == ACTIVITY_29)
{
rfu_NI_setSendData(lman.acceptSlot_flag, 84, linkData, size);
return TRUE;
@@ -252,7 +253,7 @@ static void sub_80771AC(u8 a0)
static bool32 sub_80771BC(void)
{
- if (gUnknown_02022C2C == 29)
+ if (gPlayerCurrActivity == ACTIVITY_29)
{
if (gRfuSlotStatusNI[sub_800E87C(lman.acceptSlot_flag)]->send.state == 0)
return TRUE;
@@ -288,7 +289,7 @@ static void TradeResetReceivedFlag(u32 who)
static bool32 IsWirelessTrade(void)
{
- if (gWirelessCommType && gUnknown_02022C2C == 29)
+ if (gWirelessCommType && gPlayerCurrActivity == ACTIVITY_29)
return TRUE;
else
return FALSE;
@@ -388,20 +389,20 @@ static void CB2_CreateTradeMenu(void)
if (!gReceivedRemoteLinkPlayers)
{
- gLinkType = LINKTYPE_0x1122;
+ gLinkType = LINKTYPE_TRADE_CONNECTING;
sTradeMenuData->timer = 0;
if (gWirelessCommType)
{
- sub_800B488();
+ SetWirelessCommType1();
OpenLink();
- sub_8011BA4();
+ CreateTask_RfuIdle();
}
else
{
OpenLink();
gMain.state++;
- CreateTask(task00_08081A90, 1);
+ CreateTask(Task_WaitForLinkPlayerConnection, 1);
}
}
else
@@ -437,7 +438,7 @@ static void CB2_CreateTradeMenu(void)
case 4:
if (gReceivedRemoteLinkPlayers == TRUE && IsLinkPlayerDataExchangeComplete() == TRUE)
{
- sub_8011BD0();
+ DestroyTask_RfuIdle();
CalculatePlayerPartyCount();
gMain.state++;
sTradeMenuData->timer = 0;
@@ -2749,7 +2750,7 @@ void CB2_LinkTrade(void)
case 0:
if (!gReceivedRemoteLinkPlayers)
{
- gLinkType = LINKTYPE_0x1144;
+ gLinkType = LINKTYPE_TRADE_DISCONNECTED;
CloseLink();
}
sTradeData = AllocZeroed(sizeof(*sTradeData));
@@ -4596,7 +4597,7 @@ static void CB2_SaveAndEndTrade(void)
IncrementGameStat(GAME_STAT_POKEMON_TRADES);
if (gWirelessCommType)
{
- sub_801B990(2, gLinkPlayers[GetMultiplayerId() ^ 1].trainerId);
+ RecordIdOfWonderCardSenderByEventType(2, gLinkPlayers[GetMultiplayerId() ^ 1].trainerId);
}
SetContinueGameWarpStatusToDynamicWarp();
sub_8153380();
diff --git a/src/trainer_card.c b/src/trainer_card.c
index fb92dc336..d625bc13e 100755
--- a/src/trainer_card.c
+++ b/src/trainer_card.c
@@ -27,7 +27,6 @@
#include "trainer_pokemon_sprites.h"
#include "script_pokemon_util_80F87D8.h"
#include "constants/songs.h"
-#include "constants/flags.h"
#include "constants/game_stat.h"
#include "constants/battle_frontier.h"
#include "constants/rgb.h"
diff --git a/src/tv.c b/src/tv.c
index eaf30f82b..b3722e87a 100644
--- a/src/tv.c
+++ b/src/tv.c
@@ -764,11 +764,11 @@ void ClearTVShowData(void)
for (i = 0; i < ARRAY_COUNT(gSaveBlock1Ptr->tvShows); i ++)
{
- gSaveBlock1Ptr->tvShows[i].common.kind = 0;
- gSaveBlock1Ptr->tvShows[i].common.active = 0;
- for (j = 0; j < sizeof(TVShow) - 2; j ++)
+ gSaveBlock1Ptr->tvShows[i].commonInit.kind = 0;
+ gSaveBlock1Ptr->tvShows[i].commonInit.active = 0;
+ for (j = 0; j < ARRAY_COUNT(gSaveBlock1Ptr->tvShows[i].commonInit.pad02); j ++)
{
- gSaveBlock1Ptr->tvShows[i].common.pad02[j] = 0;
+ gSaveBlock1Ptr->tvShows[i].commonInit.pad02[j] = 0;
}
}
ClearPokemonNews();
@@ -3167,11 +3167,11 @@ void DeleteTVShowInArrayByIdx(TVShow *shows, u8 idx)
{
u8 i;
- shows[idx].common.kind = TVSHOW_OFF_AIR;
- shows[idx].common.active = FALSE;
- for (i = 0; i < 34; i ++)
+ shows[idx].commonInit.kind = TVSHOW_OFF_AIR;
+ shows[idx].commonInit.active = FALSE;
+ for (i = 0; i < ARRAY_COUNT(shows[idx].commonInit.pad02); i++)
{
- shows[idx].common.pad02[i] = 0;
+ shows[idx].commonInit.pad02[i] = 0;
}
}
diff --git a/src/union_room.c b/src/union_room.c
index cd45907f5..1ef8cd4cb 100644
--- a/src/union_room.c
+++ b/src/union_room.c
@@ -41,6 +41,7 @@
#include "trade.h"
#include "trainer_card.h"
#include "union_room.h"
+#include "union_room_battle.h"
#include "union_room_chat.h"
#include "union_room_player_avatar.h"
#include "window.h"
@@ -52,158 +53,293 @@
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/species.h"
-#include "constants/union_room.h"
-
-EWRAM_DATA u8 sUnionRoomPlayerName[12] = {};
-EWRAM_DATA u8 gUnknown_02022C2C = 0;
-EWRAM_DATA u8 gUnknown_02022C2D = 0;
-EWRAM_DATA union UnkUnion_Main gUnknown_02022C30 = {};
-EWRAM_DATA u32 gFiller_02022C34 = 0;
-EWRAM_DATA struct GFtgtGnameSub gUnknown_02022C38 = {};
+
+// States for Task_RunUnionRoom
+enum {
+ UR_STATE_INIT,
+ UR_STATE_INIT_OBJECTS,
+ UR_STATE_INIT_LINK,
+ UR_STATE_CHECK_SELECTING_MON,
+ UR_STATE_MAIN,
+ UR_STATE_DO_SOMETHING_PROMPT,
+ UR_STATE_HANDLE_DO_SOMETHING_PROMPT_INPUT,
+ UR_STATE_DO_SOMETHING_PROMPT_2,
+ UR_STATE_PRINT_MSG,
+ UR_STATE_HANDLE_ACTIVITY_REQUEST,
+ UR_STATE_DECLINE_ACTIVITY_REQUEST,
+ UR_STATE_PLAYER_CONTACTED_YOU,
+ UR_STATE_RECV_CONTACT_DATA,
+ UR_STATE_PRINT_START_ACTIVITY_MSG,
+ UR_STATE_START_ACTIVITY_LINK,
+ UR_STATE_START_ACTIVITY_WAIT_FOR_LINK,
+ UR_STATE_START_ACTIVITY_FREE_UROOM,
+ UR_STATE_START_ACTIVITY_FADE,
+ UR_STATE_START_ACTIVITY,
+ UR_STATE_RECV_JOIN_CHAT_REQUEST,
+ UR_STATE_TRY_ACCEPT_CHAT_REQUEST_DELAY,
+ UR_STATE_TRY_ACCEPT_CHAT_REQUEST,
+ UR_STATE_ACCEPT_CHAT_REQUEST,
+ UR_STATE_WAIT_FOR_START_MENU,
+ UR_STATE_INTERACT_WITH_PLAYER,
+ UR_STATE_TRY_COMMUNICATING,
+ UR_STATE_PRINT_AND_EXIT,
+ UR_STATE_SEND_ACTIVITY_REQUEST,
+ UR_STATE_TRAINER_APPEARS_BUSY,
+ UR_STATE_WAIT_FOR_RESPONSE_TO_REQUEST,
+ UR_STATE_CANCEL_ACTIVITY_LINK_ERROR,
+ UR_STATE_SEND_TRADE_REQUST,
+ UR_STATE_REQUEST_DECLINED,
+ UR_STATE_PRINT_CONTACT_MSG,
+ UR_STATE_HANDLE_CONTACT_DATA,
+ UR_STATE_RECV_ACTIVITY_REQUEST,
+ UR_STATE_CANCEL_REQUEST_PRINT_MSG,
+ UR_STATE_CANCEL_REQUEST_RESTART_LINK,
+ UR_STATE_COMMUNICATING_WAIT_FOR_DATA,
+ UR_STATE_WAIT_FOR_CONTACT_DATA,
+ UR_STATE_PRINT_CARD_INFO,
+ UR_STATE_WAIT_FINISH_READING_CARD,
+ UR_STATE_INTERACT_WITH_ATTENDANT,
+ UR_STATE_REGISTER_PROMPT,
+ UR_STATE_CANCEL_REGISTRATION_PROMPT,
+ UR_STATE_CHECK_TRADING_BOARD,
+ UR_STATE_TRADING_BOARD_LOAD,
+ UR_STATE_REGISTER_PROMPT_HANDLE_INPUT,
+ UR_STATE_TRADING_BOARD_HANDLE_INPUT,
+ UR_STATE_TRADE_PROMPT,
+ UR_STATE_TRADE_SELECT_MON,
+ UR_STATE_TRADE_OFFER_MON,
+ UR_STATE_REGISTER_REQUEST_TYPE,
+ UR_STATE_REGISTER_SELECT_MON_FADE,
+ UR_STATE_REGISTER_SELECT_MON,
+ UR_STATE_REGISTER_COMPLETE,
+ UR_STATE_CANCEL_REGISTRATION,
+};
+
+// States for sUnionRoomTrade.state
+enum {
+ URTRADE_STATE_NONE,
+ URTRADE_STATE_REGISTERING,
+ URTRADE_STATE_OFFERING,
+};
+
+// States for Task_TryBecomeLinkLeader
+enum {
+ LL_STATE_INIT,
+ LL_STATE_INIT2 = 3,
+ LL_STATE_GET_AWAITING_PLAYERS_TEXT,
+ LL_STATE_PRINT_AWAITING_PLAYERS,
+ LL_STATE_AWAIT_PLAYERS,
+ LL_STATE_ACCEPT_NEW_MEMBER_PROMPT,
+ LL_STATE_9 = 9,
+ LL_STATE_MEMBER_LEFT,
+ LL_STATE_ACCEPT_NEW_MEMBER_PROMPT_HANDLE_INPUT,
+ LL_STATE_UPDATE_AFTER_JOIN_REQUEST,
+ LL_STATE_ACCEPTED_FINAL_MEMBER,
+ LL_STATE_WAIT_AND_CONFIRM_MEMBERS,
+ LL_STATE_MEMBERS_OK_PROMPT,
+ LL_STATE_MEMBERS_OK_PROMPT_HANDLE_INPUT,
+ LL_STATE_CONFIRMED_MEMBERS,
+ LL_STATE_FINAL_MEMBER_CHECK,
+ LL_STATE_CANCEL_PROMPT,
+ LL_STATE_CANCEL_PROMPT_HANDLE_INPUT,
+ LL_STATE_SHUTDOWN_AND_RETRY,
+ LL_STATE_RETRY,
+ LL_STATE_SHUTDOWN_AND_FAIL,
+ LL_STATE_FAILED,
+ LL_STATE_TRY_START_ACTIVITY = 26,
+ LL_STATE_MEMBER_DISCONNECTED = 29,
+ LL_STATE_CANCEL_WITH_MSG
+};
+
+// States for Task_TryJoinLinkGroup
+enum {
+ LG_STATE_INIT,
+ LG_STATE_CHOOSE_LEADER_MSG,
+ LG_STATE_INIT_WINDOWS,
+ LG_STATE_CHOOSE_LEADER_HANDLE_INPUT,
+ LG_STATE_ASK_JOIN_GROUP = 5,
+ LG_STATE_MAIN,
+ LG_STATE_ASK_LEAVE_GROUP,
+ LG_STATE_ASK_LEAVE_GROUP_HANDLE_INPUT,
+ LG_STATE_WAIT_LEAVE_GROUP,
+ LG_STATE_CANCEL_CHOOSE_LEADER,
+ LG_STATE_CANCELED,
+ LG_STATE_RFU_ERROR,
+ LG_STATE_RFU_ERROR_SHUTDOWN,
+ LG_STATE_DISCONNECTED,
+ LG_STATE_RETRY_CONNECTION,
+ LG_STATE_TRADE_NOT_READY = 18,
+ LG_STATE_TRADE_NOT_READY_RETRY,
+ LG_STATE_READY_START_ACTIVITY,
+ LG_STATE_START_ACTIVITY,
+ LG_STATE_SHUTDOWN = 23,
+};
+
+static EWRAM_DATA u8 sUnionRoomPlayerName[12] = {};
+EWRAM_DATA u8 gPlayerCurrActivity = 0;
+static EWRAM_DATA u8 sPlayerActivityGroupSize = 0;
+static EWRAM_DATA union WirelessLink_Main sWirelessLinkMain = {};
+static EWRAM_DATA u32 sUnused = 0;
+EWRAM_DATA struct GFtgtGnameSub gPartnerTgtGnameSub = {};
EWRAM_DATA u16 gUnionRoomOfferedSpecies = 0;
EWRAM_DATA u8 gUnionRoomRequestedMonType = 0;
static EWRAM_DATA struct UnionRoomTrade sUnionRoomTrade = {};
// IWRAM vars
-static struct UnkStruct_Leader *gUnknown_03000DA0;
-static struct UnkStruct_Group *gUnknown_03000DA4;
-static struct UnkStruct_URoom *gUnknown_03000DA8;
+static struct WirelessLink_Leader *sLeader;
+static struct WirelessLink_Group *sGroup;
+static struct WirelessLink_URoom *sURoom;
// this file's functions
-void sub_80173E0(u8 windowId, u8 arg1, const u8 *str, u8 arg3, u8 arg4, u8 arg5);
-u16 ReadAsU16(const u8 *ptr);
-void sub_8012780(u8 taskId);
-void sub_80134E8(u8 taskId);
-void sub_8013C7C(u8 taskId);
-void sub_8014A40(u8 taskId);
-void sub_8014F48(u8 taskId);
-void sub_80152F4(u8 taskId);
-void sub_80156E0(u8 taskId);
-void sub_80175EC(struct UnkStruct_Main4 *arg0, u8 count);
-void sub_8017580(struct UnkStruct_x20 *arg0, u8 count);
-u8 sub_8016FC0(struct UnkStruct_Main4 *arg0, u32 arg1);
-u8 sub_8016FF0(struct UnkStruct_Main4 *arg0, u32 arg1);
-bool8 PrintOnTextbox(u8 *textState, const u8 *str);
-bool8 sub_801320C(struct UnkStruct_Leader *data, u32 arg1, u32 arg2);
-u8 sub_8013398(struct UnkStruct_Main0 *arg0);
-s8 sub_80170B8(u8 *arg0, bool32 arg1);
-void sub_8018404(u8 *dest, struct UnkStruct_x20 *arg1);
-void sub_8012F64(struct UnkStruct_Leader *data);
-void sub_80149C4(void);
-u8 sub_80132D4(struct UnkStruct_Main0 *arg0);
-void sub_80178A0(u8 arg0, u8 arg1, u8 arg2, struct UnkStruct_x20 *arg3, u8 arg4, u8 id);
-u32 sub_80176E4(struct UnkStruct_x20 *arg0, struct UnkStruct_x1C *arg1);
-u8 sub_8017734(struct UnkStruct_x20 *arg0, struct UnkStruct_x1C *arg1, u8 arg2);
-u8 sub_8013E44(void);
-u32 sub_8013B8C(struct UnkStruct_Group *arg0, s32 id);
-void sub_8013BD8(struct UnkStruct_Group *arg0, s32 id);
-void sub_80173D4(void);
-void sub_80177B8(u8 arg0, u8 arg1, u8 arg2, struct UnkStruct_x20 *arg3, u8 arg4, u8 id);
-bool32 sub_8017678(struct UnkStruct_Shared *arg0, struct UnkStruct_Shared *arg1);
-static u32 GetPartyPositionOfRegisteredMon(struct UnionRoomTrade *arg0, u8 multiplayerId);
-static void ResetUnionRoomTrade(struct UnionRoomTrade *arg0);
-void sub_801AC54(void);
-void sub_80149D8(void);
-void MG_DrawTextBorder(u8 windowId);
-s8 mevent_message_print_and_prompt_yes_no(u8 *textState, u8 *arg1, u8 arg2, const u8 *str);
-bool32 sub_8016F1C(struct GFtgtGname *arg0, s16 arg1);
-u8 sub_8016DF0(struct UnkStruct_Main4 *arg0, struct UnkStruct_Main4 *arg1, u32 arg2);
-void sub_8019F2C(void);
-static bool32 RegisterTradeMonAndGetIsEgg(u32 monId, struct UnionRoomTrade *trade);
-static void RegisterTradeMon(u32 monId, struct UnionRoomTrade *arg1);
-void sub_80181CC(void);
-bool32 sub_8017940(void);
-u8 sub_8016B00(void);
-void sub_801A274(struct UnkStruct_URoom *arg0);
-bool32 sub_8017FD8(struct UnkStruct_URoom *arg0);
-void sub_801689C(struct UnkStruct_URoom *arg0);
-u8 sub_80181DC(struct UnkStruct_URoom *arg0);
-bool32 sub_80168DC(struct UnkStruct_URoom *arg0);
-bool32 sub_801704C(void);
-s32 sub_8017CF8(s32 arg1, struct UnkStruct_Main0 *arg0);
-s32 sub_80179D4(struct UnkStruct_Main0 *arg0, u8 arg1, u8 arg2, u32 playerGender);
-void sub_801818C(bool32 arg0);
-s32 sub_8017178(u8 *arg0, u8 *arg1, u8 *arg2, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate);
-s32 sub_80172A0(u8 *arg0, u8 *arg1, u8 *arg2, u8 *arg3, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate, struct UnkStruct_Main0 *arg6);
-s32 sub_8017CB0(struct UnkStruct_x20 * arg, s32 arg1);
-bool32 HasAtLeastTwoMonsOfLevel30OrLower(void);
-u32 sub_8017984(s32 arg0);
-void sub_8018220(u8 *unused, struct UnkStruct_URoom *arg1, bool8 arg2);
-void sub_8017D9C(u8 *dst, s32 arg1, u32 playerGender);
-u32 sub_80179AC(struct UnkStruct_x20 *arg0);
-void sub_8017E00(u8 *dst, u8 arg1);
-void sub_80173B0(void);
-s32 sub_8017D04(u32 type, u32 species);
-bool32 sub_8017020(const u8 *src);
-u8 sub_8019BA8(struct UnkStruct_8019BA8 * );
-s32 sub_8017EA0(u8 *dst, u32 gender, u16 *arg2, struct UnkStruct_URoom *arg3);
-void sub_801697C(u8 taskId);
-bool8 sub_8017630(struct UnkStruct_Shared* arg0, const struct UnkStruct_Shared* arg1);
-void sub_8013278(u8 windowId, s32 itemId, u8 y);
-void sub_8013DF4(u8 windowId, s32 itemId, u8 y);
-void sub_8017BE8(u8 windowId, s32 itemId, u8 y);
-void nullsub_14(u8 windowId, s32 itemId, u8 y);
+static void UR_AddTextPrinterParameterized(u8, u8, const u8 *, u8, u8, u8);
+static u16 ReadAsU16(const u8 *);
+static void Task_TryBecomeLinkLeader(u8);
+static void Task_TryJoinLinkGroup(u8);
+static void Task_ListenToWireless(u8);
+static void Task_MEvent_Leader(u8);
+static void Task_CardOrNewsWithFriend(u8);
+static void Task_CardOrNewsOverWireless(u8);
+static void Task_RunUnionRoom(u8);
+static void ClearUnkStruct_x1CArray(struct UnkStruct_Main4 *, u8);
+static void ClearUnkStruct_x20Array(struct UnkStruct_x20 *, u8);
+static u8 CreateTask_ListenForPartnersWithCompatibleSerialNos(struct UnkStruct_Main4 *, u32);
+static u8 CreateTask_ListenForPartnersWithSerial7F7D(struct UnkStruct_Main4 *, u32 );
+static bool8 PrintOnTextbox(u8 *, const u8 *);
+static bool8 Leader_SetStateIfMemberListChanged(struct WirelessLink_Leader *, u32, u32);
+static u8 sub_8013398(struct UnkStruct_Main0 *);
+static s8 UnionRoomHandleYesNo(u8 *, bool32);
+static void IntlConvPartnerUname7(u8 *, struct UnkStruct_x20 *);
+static void Leader_DestroyResources(struct WirelessLink_Leader *);
+static void CreateTask_RunScriptAndFadeToActivity(void);
+static u8 LeaderUpdateGroupMembership(struct UnkStruct_Main0 *);
+static void PrintGroupMemberCandidateOnWindowWithColor(u8, u8, u8, struct UnkStruct_x20 *, u8, u8 );
+static u32 Findx20Inx1CArray(struct UnkStruct_x20 *, struct UnkStruct_x1C *);
+static u8 Appendx1Ctox20(struct UnkStruct_x20 *, struct UnkStruct_x1C *, u8);
+static u8 GetNewLeaderCandidate(void);
+static u32 IsTryingToTradeAcrossVersionTooSoon(struct WirelessLink_Group *, s32);
+static void AskToJoinRfuGroup(struct WirelessLink_Group *, s32);
+static void JoinGroup_EnableScriptContexts(void);
+static void PrintUnionRoomGroupOnWindow(u8, u8, u8, struct UnkStruct_x20 *, u8, u8);
+static bool32 AreUnionRoomPlayerGnamesDifferent(struct WirelessGnameUnamePair *, struct WirelessGnameUnamePair *);
+static u32 GetPartyPositionOfRegisteredMon(struct UnionRoomTrade *, u8);
+static void ResetUnionRoomTrade(struct UnionRoomTrade *);
+static void CreateTask_StartActivity(void);
+static bool32 HasWonderCardOrNewsByLinkGroup(struct GFtgtGname *, s16);
+static u8 CreateTask_SearchForChildOrParent(struct UnkStruct_Main4 *, struct UnkStruct_Main4 *, u32);
+static bool32 RegisterTradeMonAndGetIsEgg(u32, struct UnionRoomTrade *);
+static void RegisterTradeMon(u32, struct UnionRoomTrade *);
+static void UR_EnableScriptContext2AndFreezeObjectEvents(void);
+static bool32 IsPlayerFacingTradingBoard(void);
+static u8 HandlePlayerListUpdate(void);
+static bool32 PollPartnerYesNoResponse(struct WirelessLink_URoom *);
+static void ReceiveUnionRoomActivityPacket(struct WirelessLink_URoom *);
+static u8 GetActivePartnerSpriteGenderParam(struct WirelessLink_URoom *);
+static bool32 UnionRoom_HandleContactFromOtherPlayer(struct WirelessLink_URoom *);
+static bool32 UR_RunTextPrinters_CheckPrinter0Active(void);
+static s32 GetUnionRoomPlayerGender(s32, struct UnkStruct_Main0 *);
+static s32 UnionRoomGetPlayerInteractionResponse(struct UnkStruct_Main0 *, u8, u8, u32);
+static void HandleCancelActivity(bool32);
+static s32 ListMenuHandler_AllItemsAvailable(u8 *, u8 *, u8 *, const struct WindowTemplate *, const struct ListMenuTemplate *);
+static s32 TradeBoardMenuHandler(u8 *, u8 *, u8 *, u8 *, const struct WindowTemplate *, const struct ListMenuTemplate *, struct UnkStruct_Main0 *);
+static s32 GetIndexOfNthTradeBoardOffer(struct UnkStruct_x20 *, s32);
+static bool32 HasAtLeastTwoMonsOfLevel30OrLower(void);
+static u32 GetResponseIdx_InviteToURoomActivity(s32);
+static void ViewURoomPartnerTrainerCard(u8 *, struct WirelessLink_URoom *, bool8);
+static void GetURoomActivityRejectMsg(u8 *, s32, u32);
+static u32 ConvPartnerUnameAndGetWhetherMetAlready(struct UnkStruct_x20 *);
+static void GetURoomActivityStartMsg(u8 *, u8);
+static void UR_ClearBg0(void);
+static s32 IsRequestedTypeOrEggInPlayerParty(u32, u32);
+static bool32 UR_PrintFieldMessage(const u8 *);
+static s32 GetChatLeaderActionRequestMessage(u8 *, u32, u16 *, struct WirelessLink_URoom *);
+static void Task_InitUnionRoom(u8 taskId);
+static bool8 AreGnameUnameDifferent(struct WirelessGnameUnamePair*, const struct WirelessGnameUnamePair*);
+static void ItemPrintFunc_PossibleGroupMembers(u8, s32, u8);
+static void ListMenuItemPrintFunc_UnionRoomGroups(u8, s32, u8);
+static void TradeBoardListMenuItemPrintFunc(u8, s32, u8);
+static void nullsub_14(u8, s32, u8);
#include "data/union_room.h"
// code
-void sub_80124EC(u8 windowId, u8 arg1, u8 stringId)
+static void PrintNumPlayersWaitingForMsg(u8 windowId, u8 capacityCode, u8 stringId)
{
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
- switch (arg1 << 8)
+ switch (capacityCode << 8)
{
- case 0x200:
- sub_80173E0(windowId, 1, sPlayersNeededOrModeTexts[0][stringId - 1], 0, 1, 0);
+ case LINK_GROUP_CAPACITY(0, 2):
+ UR_AddTextPrinterParameterized(windowId, 1, sPlayersNeededOrModeTexts[0][stringId - 1], 0, 1, UR_COLOR_DKE_WHT_LTE);
break;
- case 0x400:
- sub_80173E0(windowId, 1, sPlayersNeededOrModeTexts[1][stringId - 1], 0, 1, 0);
+ case LINK_GROUP_CAPACITY(0, 4):
+ UR_AddTextPrinterParameterized(windowId, 1, sPlayersNeededOrModeTexts[1][stringId - 1], 0, 1, UR_COLOR_DKE_WHT_LTE);
break;
- case 0x2500:
- sub_80173E0(windowId, 1, sPlayersNeededOrModeTexts[2][stringId - 1], 0, 1, 0);
+ case LINK_GROUP_CAPACITY(2, 5):
+ UR_AddTextPrinterParameterized(windowId, 1, sPlayersNeededOrModeTexts[2][stringId - 1], 0, 1, UR_COLOR_DKE_WHT_LTE);
break;
- case 0x3500:
- sub_80173E0(windowId, 1, sPlayersNeededOrModeTexts[3][stringId - 1], 0, 1, 0);
+ case LINK_GROUP_CAPACITY(3, 5):
+ UR_AddTextPrinterParameterized(windowId, 1, sPlayersNeededOrModeTexts[3][stringId - 1], 0, 1, UR_COLOR_DKE_WHT_LTE);
break;
- case 0x2400:
- sub_80173E0(windowId, 1, sPlayersNeededOrModeTexts[4][stringId - 1], 0, 1, 0);
+ case LINK_GROUP_CAPACITY(2, 4):
+ UR_AddTextPrinterParameterized(windowId, 1, sPlayersNeededOrModeTexts[4][stringId - 1], 0, 1, UR_COLOR_DKE_WHT_LTE);
break;
}
CopyWindowToVram(windowId, 2);
}
-void sub_80125BC(u8 windowId)
+static void PrintPlayerNameAndIdOnWindow(u8 windowId)
{
u8 text[30];
u8 *txtPtr;
- sub_80173E0(windowId, 1, gSaveBlock2Ptr->playerName, 0, 1, 0);
+ UR_AddTextPrinterParameterized(windowId, 1, gSaveBlock2Ptr->playerName, 0, 1, UR_COLOR_DKE_WHT_LTE);
txtPtr = StringCopy(text, sText_ID);
ConvertIntToDecimalStringN(txtPtr, ReadAsU16(gSaveBlock2Ptr->playerTrainerId), STR_CONV_MODE_LEADING_ZEROS, 5);
- sub_80173E0(windowId, 1, text, 0, 0x11, 0);
+ UR_AddTextPrinterParameterized(windowId, 1, text, 0, 0x11, UR_COLOR_DKE_WHT_LTE);
}
-void sub_801262C(u8 *dst, u8 caseId)
+static void StringExpandPlaceholders_AwaitingCommFromAnother(u8 *dst, u8 caseId)
{
switch (caseId)
{
- case 1 ... 4:
- case 9 ... 11:
- case 14 ... 16:
- case 21 ... 28:
+ case ACTIVITY_BATTLE_SINGLE:
+ case ACTIVITY_BATTLE_DOUBLE:
+ case ACTIVITY_BATTLE_MULTI:
+ case ACTIVITY_TRADE:
+ case ACTIVITY_POKEMON_JUMP:
+ case ACTIVITY_BERRY_CRUSH:
+ case ACTIVITY_BERRY_PICK:
+ case ACTIVITY_BATTLE_TOWER:
+ case ACTIVITY_BATTLE_TOWER_OPEN:
+ case ACTIVITY_RECORD_CORNER:
+ case ACTIVITY_BERRY_BLENDER:
+ case ACTIVITY_WONDER_CARD2:
+ case ACTIVITY_WONDER_NEWS2:
+ case ACTIVITY_CONTEST_COOL:
+ case ACTIVITY_CONTEST_BEAUTY:
+ case ACTIVITY_CONTEST_CUTE:
+ case ACTIVITY_CONTEST_SMART:
+ case ACTIVITY_CONTEST_TOUGH:
// UB: argument *dst isn't used, instead it always prints to gStringVar4
StringExpandPlaceholders(gStringVar4, sText_AwaitingCommunication);
break;
}
}
-bool32 sub_80126CC(u32 caseId)
+static bool32 IsActivityWithVariableGroupSize(u32 caseId)
{
switch (caseId)
{
- case 9 ... 11:
- case 15 ... 16:
- case 23 ... 27:
+ case ACTIVITY_POKEMON_JUMP:
+ case ACTIVITY_BERRY_CRUSH:
+ case ACTIVITY_BERRY_PICK:
+ case ACTIVITY_RECORD_CORNER:
+ case ACTIVITY_BERRY_BLENDER:
+ case ACTIVITY_CONTEST_COOL:
+ case ACTIVITY_CONTEST_BEAUTY:
+ case ACTIVITY_CONTEST_CUTE:
+ case ACTIVITY_CONTEST_SMART:
+ case ACTIVITY_CONTEST_TOUGH:
return TRUE;
default:
return FALSE;
@@ -213,331 +349,334 @@ bool32 sub_80126CC(u32 caseId)
void TryBecomeLinkLeader(void)
{
u8 taskId;
- struct UnkStruct_Leader *dataPtr;
+ struct WirelessLink_Leader *data;
- taskId = CreateTask(sub_8012780, 0);
- gUnknown_02022C30.leader = dataPtr = (void*)(gTasks[taskId].data);
- gUnknown_03000DA0 = dataPtr;
+ taskId = CreateTask(Task_TryBecomeLinkLeader, 0);
+ sWirelessLinkMain.leader = data = (void*)(gTasks[taskId].data);
+ sLeader = data;
- dataPtr->state = 0;
- dataPtr->textState = 0;
- gSpecialVar_Result = 0;
+ data->state = LL_STATE_INIT;
+ data->textState = 0;
+ gSpecialVar_Result = LINKUP_ONGOING;
}
-void sub_8012780(u8 taskId)
+static void Task_TryBecomeLinkLeader(u8 taskId)
{
u32 id, val;
- struct UnkStruct_Leader *data = gUnknown_02022C30.leader;
+ struct WirelessLink_Leader *data = sWirelessLinkMain.leader;
switch (data->state)
{
- case 0:
+ case LL_STATE_INIT:
if (gSpecialVar_0x8004 == LINK_GROUP_BATTLE_TOWER && gSaveBlock2Ptr->frontier.lvlMode == FRONTIER_LVL_OPEN)
gSpecialVar_0x8004++;
- gUnknown_02022C2C = gUnknown_082F00C4[gSpecialVar_0x8004];
- gUnknown_02022C2D = gUnknown_082F00C4[gSpecialVar_0x8004] >> 8;
- sub_8010F84(gUnknown_02022C2C, 0, 0);
- sub_800B488();
+ gPlayerCurrActivity = sLinkGroupToActivityAndCapacity[gSpecialVar_0x8004];
+ sPlayerActivityGroupSize = sLinkGroupToActivityAndCapacity[gSpecialVar_0x8004] >> 8;
+ SetHostRFUtgtGname(gPlayerCurrActivity, 0, 0);
+ SetWirelessCommType1();
OpenLink();
- sub_8011C10(gUnknown_02022C2D & 0xF);
- data->state = 3;
- break;
- case 3:
- data->field_4 = AllocZeroed(0x70);
- data->field_0 = AllocZeroed(0xA0);
- data->field_8 = AllocZeroed(0xA0);
- sub_80175EC(data->field_4, 4);
- sub_8017580(data->field_0->arr, 5);
- sub_800DF90(&data->field_0->arr[0].unk.field_0, data->field_0->arr[0].unk.playerName);
- data->field_0->arr[0].field_18 = 0;
- data->field_0->arr[0].field_1A_0 = 1;
- data->field_0->arr[0].field_1A_1 = 0;
+ InitializeRfuLinkManager_LinkLeader(GROUP_MAX(sPlayerActivityGroupSize));
+ data->state = LL_STATE_INIT2;
+ break;
+ case LL_STATE_INIT2:
+ data->field_4 = AllocZeroed(4 * sizeof(struct UnkStruct_x1C));
+ data->field_0 = AllocZeroed(5 * sizeof(struct UnkStruct_x20));
+ data->field_8 = AllocZeroed(5 * sizeof(struct UnkStruct_x20));
+ ClearUnkStruct_x1CArray(data->field_4, 4);
+ ClearUnkStruct_x20Array(data->field_0->arr, 5);
+ LinkRfu3_SetGnameUnameFromStaticBuffers(&data->field_0->arr[0].gname_uname.gname, data->field_0->arr[0].gname_uname.playerName);
+ data->field_0->arr[0].timeoutCounter = 0;
+ data->field_0->arr[0].groupScheduledAnim = UNION_ROOM_SPAWN_IN;
+ data->field_0->arr[0].useRedText = FALSE;
data->field_0->arr[0].field_1B = 0;
- data->field_17 = sub_8016FC0(data->field_4, 0xFF);
- data->field_10 = AddWindow(&gUnknown_082F00BC);
- switch (gUnknown_02022C2D & 0xF)
+ data->listenTaskId = CreateTask_ListenForPartnersWithCompatibleSerialNos(data->field_4, 0xFF);
+ data->bButtonCancelWindowId = AddWindow(&sWindowTemplate_BButtonCancel);
+ switch (GROUP_MAX(sPlayerActivityGroupSize))
{
case 2:
case 3:
case 4:
- data->listWindowId = AddWindow(&gUnknown_082F011C);
+ data->listWindowId = AddWindow(&sWindowTemplate_PlayerList);
break;
case 5:
- data->listWindowId = AddWindow(&gUnknown_082F0124);
+ data->listWindowId = AddWindow(&sWindowTemplate_5PlayerList);
break;
}
- data->field_11 = AddWindow(&gUnknown_082F012C);
+ data->nPlayerModeWindowId = AddWindow(&sWindowTemplate_NumPlayerMode);
- FillWindowPixelBuffer(data->field_10, PIXEL_FILL(2));
- sub_80173E0(data->field_10, 0, sText_BButtonCancel, 8, 1, 4);
- PutWindowTilemap(data->field_10);
- CopyWindowToVram(data->field_10, 2);
+ FillWindowPixelBuffer(data->bButtonCancelWindowId, PIXEL_FILL(2));
+ UR_AddTextPrinterParameterized(data->bButtonCancelWindowId, 0, sText_BButtonCancel, 8, 1, 4);
+ PutWindowTilemap(data->bButtonCancelWindowId);
+ CopyWindowToVram(data->bButtonCancelWindowId, 2);
DrawStdWindowFrame(data->listWindowId, FALSE);
- gMultiuseListMenuTemplate = gUnknown_082F015C;
+ gMultiuseListMenuTemplate = sListMenuTemplate_PossibleGroupMembers;
gMultiuseListMenuTemplate.windowId = data->listWindowId;
data->listTaskId = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0);
- DrawStdWindowFrame(data->field_11, FALSE);
- PutWindowTilemap(data->field_11);
- CopyWindowToVram(data->field_11, 2);
+ DrawStdWindowFrame(data->nPlayerModeWindowId, FALSE);
+ PutWindowTilemap(data->nPlayerModeWindowId);
+ CopyWindowToVram(data->nPlayerModeWindowId, 2);
CopyBgTilemapBufferToVram(0);
- data->field_13 = 1;
- data->state = 4;
+ data->playerCount = 1;
+ data->state = LL_STATE_GET_AWAITING_PLAYERS_TEXT;
break;
- case 4:
- StringCopy(gStringVar1, sLinkGroupActivityTexts[gUnknown_02022C2C]);
- if ((gUnknown_02022C2D >> 4) != 0)
+ case LL_STATE_GET_AWAITING_PLAYERS_TEXT:
+ StringCopy(gStringVar1, sLinkGroupActivityNameTexts[gPlayerCurrActivity]);
+ if (GROUP_MIN(sPlayerActivityGroupSize) != 0)
{
- if (data->field_13 > (gUnknown_02022C2D >> 4) - 1 && (gUnknown_02022C2D & 0xF) != 0)
+ if (data->playerCount > GROUP_MIN(sPlayerActivityGroupSize) - 1 && GROUP_MAX(sPlayerActivityGroupSize) != 0)
StringExpandPlaceholders(gStringVar4, sText_AwaitingLinkPressStart);
else
StringExpandPlaceholders(gStringVar4, sText_AwaitingCommunication);
}
else
{
- sub_801262C(gStringVar4, gUnknown_02022C2C);
+ StringExpandPlaceholders_AwaitingCommFromAnother(gStringVar4, gPlayerCurrActivity);
}
- sub_80124EC(data->field_11, gUnknown_02022C2D, data->field_13);
- data->state = 5;
+ PrintNumPlayersWaitingForMsg(data->nPlayerModeWindowId, sPlayerActivityGroupSize, data->playerCount);
+ data->state = LL_STATE_PRINT_AWAITING_PLAYERS;
break;
- case 5:
+ case LL_STATE_PRINT_AWAITING_PLAYERS:
if (PrintOnTextbox(&data->textState, gStringVar4))
- data->state = 6;
+ data->state = LL_STATE_AWAIT_PLAYERS;
break;
- case 6:
- sub_801320C(data, 7, 10);
+ case LL_STATE_AWAIT_PLAYERS:
+ Leader_SetStateIfMemberListChanged(data, LL_STATE_ACCEPT_NEW_MEMBER_PROMPT, LL_STATE_MEMBER_LEFT);
if (gMain.newKeys & B_BUTTON)
{
- if (data->field_13 == 1)
- data->state = 23;
- else if ((gUnknown_02022C2D & 0xF0) != 0)
- data->state = 30;
+ if (data->playerCount == 1)
+ data->state = LL_STATE_SHUTDOWN_AND_FAIL;
+ else if (GROUP_MIN2(sPlayerActivityGroupSize) != 0)
+ data->state = LL_STATE_CANCEL_WITH_MSG;
else
- data->state = 19;
+ data->state = LL_STATE_CANCEL_PROMPT;
}
- if ((gUnknown_02022C2D >> 4) != 0
- && data->field_13 > (gUnknown_02022C2D >> 4) - 1
- && (gUnknown_02022C2D & 0xF) != 0
+ if (GROUP_MIN(sPlayerActivityGroupSize) != 0
+ && data->playerCount > GROUP_MIN(sPlayerActivityGroupSize) - 1
+ && GROUP_MAX(sPlayerActivityGroupSize) != 0
&& sub_8012240()
&& gMain.newKeys & START_BUTTON)
{
- data->state = 15;
- sub_800EF38();
+ data->state = LL_STATE_MEMBERS_OK_PROMPT;
+ LinkRfu_StopManagerAndFinalizeSlots();
}
- if (data->state == 6 && sub_80105EC())
+ if (data->state == LL_STATE_AWAIT_PLAYERS && sub_80105EC())
{
- data->state = 9;
+ data->state = LL_STATE_9;
}
break;
- case 9:
+ case LL_STATE_9:
if (!sub_80105EC())
{
- data->state = 6;
- data->field_13 = sub_8013398(data->field_0);
+ data->state = LL_STATE_AWAIT_PLAYERS;
+ data->playerCount = sub_8013398(data->field_0);
}
break;
- case 10:
- id = ((gUnknown_02022C2C & 0xF) == 2) ? 1 : 0;
+ case LL_STATE_MEMBER_LEFT:
+ // BUG: sPlayerActivityGroupSize was meant below, not gPlayerCurrActivity
+ // This will be false for all but ACTIVITY_BATTLE_DOUBLE and ACTIVITY_DECLINE
+ // All this changes is which of two texts gets printed
+ id = (GROUP_MAX(gPlayerCurrActivity) == 2) ? 1 : 0;
if (PrintOnTextbox(&data->textState, sPlayerUnavailableTexts[id]))
{
- data->field_13 = sub_8013398(data->field_0);
+ data->playerCount = sub_8013398(data->field_0);
RedrawListMenu(data->listTaskId);
- data->state = 4;
+ data->state = LL_STATE_GET_AWAITING_PLAYERS_TEXT;
}
break;
- case 29:
- id = ((gUnknown_02022C2D & 0xF) == 2) ? 0 : 1;
+ case LL_STATE_MEMBER_DISCONNECTED:
+ id = (GROUP_MAX(sPlayerActivityGroupSize) == 2) ? 0 : 1;
if (PrintOnTextbox(&data->textState, sPlayerUnavailableTexts[id]))
{
- data->state = 21;
+ data->state = LL_STATE_SHUTDOWN_AND_RETRY;
}
break;
- case 7:
+ case LL_STATE_ACCEPT_NEW_MEMBER_PROMPT:
if (PrintOnTextbox(&data->textState, gStringVar4))
{
- data->state = 11;
+ data->state = LL_STATE_ACCEPT_NEW_MEMBER_PROMPT_HANDLE_INPUT;
}
break;
- case 11:
- switch (sub_80170B8(&data->textState, sub_801064C(ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName)))
+ case LL_STATE_ACCEPT_NEW_MEMBER_PROMPT_HANDLE_INPUT:
+ switch (UnionRoomHandleYesNo(&data->textState, HasTrainerLeftPartnersList(ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.unk_00.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.playerName)))
{
- case 0:
+ case 0: // YES
LoadWirelessStatusIndicatorSpriteGfx();
CreateWirelessStatusIndicatorSprite(0, 0);
- data->field_19 = 5;
- sub_8010688(5, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName);
- data->state = 12;
+ data->joinRequestAnswer = RFU_STATUS_JOIN_GROUP_OK;
+ SendRfuStatusToPartner(data->joinRequestAnswer, ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.unk_00.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.playerName);
+ data->state = LL_STATE_UPDATE_AFTER_JOIN_REQUEST;
break;
- case 1:
+ case 1: // NO
case -1:
- data->field_19 = 6;
- sub_8010688(6, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName);
- data->state = 12;
+ data->joinRequestAnswer = RFU_STATUS_JOIN_GROUP_NO;
+ SendRfuStatusToPartner(data->joinRequestAnswer, ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.unk_00.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.playerName);
+ data->state = LL_STATE_UPDATE_AFTER_JOIN_REQUEST;
break;
case -3:
- data->state = 9;
+ data->state = LL_STATE_9;
break;
}
break;
- case 12:
- val = sub_8010714(ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName);
- if (val == 1)
+ case LL_STATE_UPDATE_AFTER_JOIN_REQUEST:
+ val = WaitSendRfuStatusToPartner(ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.unk_00.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.playerName);
+ if (val == 1) // Send complete
{
- if (data->field_19 == 5)
+ if (data->joinRequestAnswer == RFU_STATUS_JOIN_GROUP_OK)
{
- data->field_0->arr[data->field_13].field_1B = 0;
+ data->field_0->arr[data->playerCount].field_1B = 0;
RedrawListMenu(data->listTaskId);
- data->field_13++;
- if (data->field_13 == (gUnknown_02022C2D & 0xF))
+ data->playerCount++;
+ if (data->playerCount == GROUP_MAX(sPlayerActivityGroupSize))
{
- if ((gUnknown_02022C2D & 0xF0) != 0 || data->field_13 == 4)
+ if (GROUP_MIN2(sPlayerActivityGroupSize) != 0 || data->playerCount == 4)
{
- data->state = 15;
+ data->state = LL_STATE_MEMBERS_OK_PROMPT;
}
else
{
- sub_8018404(gStringVar1, &data->field_0->arr[data->field_13 - 1]);
+ IntlConvPartnerUname7(gStringVar1, &data->field_0->arr[data->playerCount - 1]);
StringExpandPlaceholders(gStringVar4, sText_AnOKWasSentToPlayer);
- data->state = 13;
+ data->state = LL_STATE_ACCEPTED_FINAL_MEMBER;
}
- sub_800EF38();
- sub_80124EC(data->field_11, gUnknown_02022C2D, data->field_13);
+ LinkRfu_StopManagerAndFinalizeSlots();
+ PrintNumPlayersWaitingForMsg(data->nPlayerModeWindowId, sPlayerActivityGroupSize, data->playerCount);
}
else
{
- data->state = 4;
+ data->state = LL_STATE_GET_AWAITING_PLAYERS_TEXT;
}
}
- else
+ else // Member disconnected
{
- sub_8011DC0(data->field_0->arr[data->field_13].unk.playerName, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId));
- data->field_0->arr[data->field_13].field_1A_0 = 0;
+ RequestDisconnectSlotByTrainerNameAndId(data->field_0->arr[data->playerCount].gname_uname.playerName, ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.unk_00.playerTrainerId));
+ data->field_0->arr[data->playerCount].groupScheduledAnim = UNION_ROOM_SPAWN_NONE;
sub_8013398(data->field_0);
RedrawListMenu(data->listTaskId);
- data->state = 4;
+ data->state = LL_STATE_GET_AWAITING_PLAYERS_TEXT;
}
- data->field_19 = 0;
+ data->joinRequestAnswer = 0;
}
else if (val == 2)
{
- sub_8011A64(0, 0);
- data->state = 4;
+ RfuSetStatus(RFU_STATUS_OK, 0);
+ data->state = LL_STATE_GET_AWAITING_PLAYERS_TEXT;
}
break;
- case 13:
+ case LL_STATE_ACCEPTED_FINAL_MEMBER:
if (PrintOnTextbox(&data->textState, gStringVar4))
- data->state = 14;
+ data->state = LL_STATE_WAIT_AND_CONFIRM_MEMBERS;
break;
- case 14:
- if (++data->field_E > 120)
- data->state = 17;
+ case LL_STATE_WAIT_AND_CONFIRM_MEMBERS:
+ if (++data->delayTimerAfterOk > 120)
+ data->state = LL_STATE_CONFIRMED_MEMBERS;
break;
- case 15:
+ case LL_STATE_MEMBERS_OK_PROMPT:
if (PrintOnTextbox(&data->textState, sText_AreTheseMembersOK))
- data->state = 16;
+ data->state = LL_STATE_MEMBERS_OK_PROMPT_HANDLE_INPUT;
break;
- case 16:
- switch (sub_80170B8(&data->textState, FALSE))
+ case LL_STATE_MEMBERS_OK_PROMPT_HANDLE_INPUT:
+ switch (UnionRoomHandleYesNo(&data->textState, FALSE))
{
- case 0:
- data->state = 17;
+ case 0: // YES
+ data->state = LL_STATE_CONFIRMED_MEMBERS;
break;
- case 1:
+ case 1: // NO
case -1:
- if ((gUnknown_02022C2D & 0xF0) != 0)
- data->state = 30;
+ if (GROUP_MIN2(sPlayerActivityGroupSize) != 0)
+ data->state = LL_STATE_CANCEL_WITH_MSG;
else
- data->state = 19;
+ data->state = LL_STATE_CANCEL_PROMPT;
break;
}
break;
- case 19:
+ case LL_STATE_CANCEL_PROMPT:
if (PrintOnTextbox(&data->textState, sText_CancelModeWithTheseMembers))
- data->state = 20;
+ data->state = LL_STATE_CANCEL_PROMPT_HANDLE_INPUT;
break;
- case 20:
- switch (sub_80170B8(&data->textState, FALSE))
+ case LL_STATE_CANCEL_PROMPT_HANDLE_INPUT:
+ switch (UnionRoomHandleYesNo(&data->textState, FALSE))
{
- case 0:
- data->state = 23;
+ case 0: // YES
+ data->state = LL_STATE_SHUTDOWN_AND_FAIL;
break;
- case 1:
+ case 1: // NO
case -1:
- if ((gUnknown_02022C2D & 0xF0) != 0)
- data->state = 15;
- else if (data->field_13 == (gUnknown_02022C2D & 0xF))
- data->state = 15;
+ if (GROUP_MIN2(sPlayerActivityGroupSize) != 0)
+ data->state = LL_STATE_MEMBERS_OK_PROMPT;
+ else if (data->playerCount == GROUP_MAX(sPlayerActivityGroupSize))
+ data->state = LL_STATE_MEMBERS_OK_PROMPT;
else
- data->state = 4;
+ data->state = LL_STATE_GET_AWAITING_PLAYERS_TEXT;
break;
}
break;
- case 17:
- if (!sub_801320C(data, 7, 29))
- data->state = 18;
+ case LL_STATE_CONFIRMED_MEMBERS:
+ if (!Leader_SetStateIfMemberListChanged(data, LL_STATE_ACCEPT_NEW_MEMBER_PROMPT, LL_STATE_MEMBER_DISCONNECTED))
+ data->state = LL_STATE_FINAL_MEMBER_CHECK;
break;
- case 18:
- if (sub_800EF1C())
+ case LL_STATE_FINAL_MEMBER_CHECK:
+ if (LmanAcceptSlotFlagIsNotZero())
{
- if (sub_800EF58(FALSE))
+ if (WaitRfuState(FALSE))
{
- data->state = 26;
+ data->state = LL_STATE_TRY_START_ACTIVITY;
}
else
{
- if (++data->field_1A > 300)
+ if (++data->memberConfirmTimeout > 300)
{
- data->state = 29;
+ data->state = LL_STATE_MEMBER_DISCONNECTED;
data->textState = 0;
}
}
}
else
{
- data->state = 29;
+ data->state = LL_STATE_MEMBER_DISCONNECTED;
data->textState = 0;
}
break;
- case 30:
+ case LL_STATE_CANCEL_WITH_MSG:
if (PrintOnTextbox(&data->textState, sText_ModeWithTheseMembersWillBeCanceled))
- data->state = 23;
+ data->state = LL_STATE_SHUTDOWN_AND_FAIL;
break;
- case 21:
- case 23:
+ case LL_STATE_SHUTDOWN_AND_RETRY:
+ case LL_STATE_SHUTDOWN_AND_FAIL:
DestroyWirelessStatusIndicatorSprite();
- sub_800EDD4();
- sub_8012F64(data);
- data->state++;
+ LinkRfu_Shutdown();
+ Leader_DestroyResources(data);
+ data->state++; // LL_STATE_RETRY or LL_STATE_FAILED
break;
- case 24:
+ case LL_STATE_FAILED:
EnableBothScriptContexts();
DestroyTask(taskId);
- gSpecialVar_Result = 5;
+ gSpecialVar_Result = LINKUP_FAILED;
break;
- case 22:
+ case LL_STATE_RETRY:
EnableBothScriptContexts();
DestroyTask(taskId);
- gSpecialVar_Result = 8;
+ gSpecialVar_Result = LINKUP_RETRY_ROLE_ASSIGN;
break;
- case 26:
- if (sub_8011A80())
+ case LL_STATE_TRY_START_ACTIVITY:
+ if (RfuHasErrored())
{
- data->state = 29;
+ data->state = LL_STATE_MEMBER_DISCONNECTED;
}
else
{
if (gReceivedRemoteLinkPlayers != 0)
{
- if (sub_80126CC(gUnknown_02022C2C))
+ if (IsActivityWithVariableGroupSize(gPlayerCurrActivity))
sub_801103C();
- sub_8011068(1);
- sub_80149C4();
- sub_8012F64(data);
+ UpdateGameData_GroupLockedIn(TRUE);
+ CreateTask_RunScriptAndFadeToActivity();
+ Leader_DestroyResources(data);
DestroyTask(taskId);
}
}
@@ -545,319 +684,319 @@ void sub_8012780(u8 taskId)
}
}
-void sub_8012F64(struct UnkStruct_Leader *data)
+static void Leader_DestroyResources(struct WirelessLink_Leader *data)
{
- ClearWindowTilemap(data->field_11);
- ClearStdWindowAndFrame(data->field_11, FALSE);
+ ClearWindowTilemap(data->nPlayerModeWindowId);
+ ClearStdWindowAndFrame(data->nPlayerModeWindowId, FALSE);
DestroyListMenuTask(data->listTaskId, 0, 0);
- ClearWindowTilemap(data->field_10);
+ ClearWindowTilemap(data->bButtonCancelWindowId);
ClearStdWindowAndFrame(data->listWindowId, FALSE);
CopyBgTilemapBufferToVram(0);
- RemoveWindow(data->field_11);
+ RemoveWindow(data->nPlayerModeWindowId);
RemoveWindow(data->listWindowId);
- RemoveWindow(data->field_10);
- DestroyTask(data->field_17);
+ RemoveWindow(data->bButtonCancelWindowId);
+ DestroyTask(data->listenTaskId);
Free(data->field_8);
Free(data->field_0);
Free(data->field_4);
}
-void sub_8012FC4(u8 *dst, u8 caseId)
+static void Leader_GetAcceptNewMemberPrompt(u8 *dst, u8 caseId)
{
switch (caseId)
{
- case 1:
- case 2:
- case 4:
- case 14:
- case 28:
+ case ACTIVITY_BATTLE_SINGLE:
+ case ACTIVITY_BATTLE_DOUBLE:
+ case ACTIVITY_TRADE:
+ case ACTIVITY_BATTLE_TOWER_OPEN:
+ case ACTIVITY_BATTLE_TOWER:
StringExpandPlaceholders(dst, sText_PlayerContactedYouForXAccept);
break;
- case 21:
- case 22:
+ case ACTIVITY_WONDER_CARD2:
+ case ACTIVITY_WONDER_NEWS2:
StringExpandPlaceholders(dst, sText_PlayerContactedYouShareX);
break;
- case 3:
- case 9:
- case 10:
- case 11:
- case 15:
- case 16:
- case 23:
- case 24:
- case 25:
- case 26:
- case 27:
+ case ACTIVITY_BATTLE_MULTI:
+ case ACTIVITY_POKEMON_JUMP:
+ case ACTIVITY_BERRY_CRUSH:
+ case ACTIVITY_BERRY_PICK:
+ case ACTIVITY_RECORD_CORNER:
+ case ACTIVITY_BERRY_BLENDER:
+ case ACTIVITY_CONTEST_COOL:
+ case ACTIVITY_CONTEST_BEAUTY:
+ case ACTIVITY_CONTEST_CUTE:
+ case ACTIVITY_CONTEST_SMART:
+ case ACTIVITY_CONTEST_TOUGH:
StringExpandPlaceholders(dst, sText_PlayerContactedYouAddToMembers);
break;
}
}
-void sub_8013078(u8 *dst, u8 caseId)
+static void GetYouDeclinedTheOfferMessage(u8 *dst, u8 caseId)
{
switch (caseId)
{
- case 65:
- case 68:
+ case ACTIVITY_BATTLE_SINGLE | IN_UNION_ROOM:
+ case ACTIVITY_TRADE | IN_UNION_ROOM:
StringExpandPlaceholders(dst, sText_OfferDeclined1);
break;
- case 69:
- case 72:
+ case ACTIVITY_CHAT | IN_UNION_ROOM:
+ case ACTIVITY_CARD | IN_UNION_ROOM:
StringExpandPlaceholders(dst, sText_OfferDeclined2);
break;
}
}
-void sub_80130B4(u8 *dst, u8 caseId)
+static void GetYouAskedToJoinGroupPleaseWaitMessage(u8 *dst, u8 caseId)
{
switch (caseId)
{
- case 1:
- case 2:
- case 4:
- case 14:
- case 21:
- case 22:
- case 28:
+ case ACTIVITY_BATTLE_SINGLE:
+ case ACTIVITY_BATTLE_DOUBLE:
+ case ACTIVITY_TRADE:
+ case ACTIVITY_BATTLE_TOWER:
+ case ACTIVITY_BATTLE_TOWER_OPEN:
+ case ACTIVITY_WONDER_CARD2:
+ case ACTIVITY_WONDER_NEWS2:
StringExpandPlaceholders(dst, sText_AwaitingPlayersResponse);
break;
- case 3:
- case 9:
- case 10:
- case 11:
- case 15:
- case 16:
- case 23:
- case 24:
- case 25:
- case 26:
- case 27:
+ case ACTIVITY_BATTLE_MULTI:
+ case ACTIVITY_POKEMON_JUMP:
+ case ACTIVITY_BERRY_CRUSH:
+ case ACTIVITY_BERRY_PICK:
+ case ACTIVITY_RECORD_CORNER:
+ case ACTIVITY_BERRY_BLENDER:
+ case ACTIVITY_CONTEST_COOL:
+ case ACTIVITY_CONTEST_BEAUTY:
+ case ACTIVITY_CONTEST_CUTE:
+ case ACTIVITY_CONTEST_SMART:
+ case ACTIVITY_CONTEST_TOUGH:
StringExpandPlaceholders(dst, sText_PlayerHasBeenAskedToRegisterYouPleaseWait);
break;
}
}
-void sub_8013160(u8 *dst, u8 caseId)
+static void GetGroupLeaderSentAnOKMessage(u8 *dst, u8 caseId)
{
switch (caseId)
{
- case 1:
- case 2:
- case 4:
- case 14:
- case 21:
- case 22:
- case 28:
+ case ACTIVITY_BATTLE_SINGLE:
+ case ACTIVITY_BATTLE_DOUBLE:
+ case ACTIVITY_TRADE:
+ case ACTIVITY_BATTLE_TOWER:
+ case ACTIVITY_BATTLE_TOWER_OPEN:
+ case ACTIVITY_WONDER_CARD2:
+ case ACTIVITY_WONDER_NEWS2:
StringExpandPlaceholders(dst, sText_PlayerSentBackOK);
break;
- case 3:
- case 9:
- case 10:
- case 11:
- case 15:
- case 16:
- case 23:
- case 24:
- case 25:
- case 26:
- case 27:
+ case ACTIVITY_BATTLE_MULTI:
+ case ACTIVITY_POKEMON_JUMP:
+ case ACTIVITY_BERRY_CRUSH:
+ case ACTIVITY_BERRY_PICK:
+ case ACTIVITY_RECORD_CORNER:
+ case ACTIVITY_BERRY_BLENDER:
+ case ACTIVITY_CONTEST_COOL:
+ case ACTIVITY_CONTEST_BEAUTY:
+ case ACTIVITY_CONTEST_CUTE:
+ case ACTIVITY_CONTEST_SMART:
+ case ACTIVITY_CONTEST_TOUGH:
StringExpandPlaceholders(dst, sText_PlayerOKdRegistration);
break;
}
}
-bool8 sub_801320C(struct UnkStruct_Leader *data, u32 arg1, u32 arg2)
+static bool8 Leader_SetStateIfMemberListChanged(struct WirelessLink_Leader *data, u32 joinedState, u32 droppedState)
{
- switch (sub_80132D4(data->field_0))
+ switch (LeaderUpdateGroupMembership(data->field_0))
{
- case 1:
+ case UNION_ROOM_SPAWN_IN:
PlaySE(SE_PC_LOGIN);
RedrawListMenu(data->listTaskId);
- sub_8018404(gStringVar2, &data->field_0->arr[data->field_13]);
- sub_8012FC4(gStringVar4, gUnknown_02022C2C);
- data->state = arg1;
+ IntlConvPartnerUname7(gStringVar2, &data->field_0->arr[data->playerCount]);
+ Leader_GetAcceptNewMemberPrompt(gStringVar4, gPlayerCurrActivity);
+ data->state = joinedState;
break;
- case 2:
- sub_8011A64(0, 0);
+ case UNION_ROOM_SPAWN_OUT:
+ RfuSetStatus(RFU_STATUS_OK, 0);
RedrawListMenu(data->listTaskId);
- data->state = arg2;
+ data->state = droppedState;
return TRUE;
}
return FALSE;
}
-void sub_8013278(u8 arg0, s32 id, u8 arg2)
+static void ItemPrintFunc_PossibleGroupMembers(u8 windowId, s32 id, u8 y)
{
- struct UnkStruct_Leader *data = gUnknown_02022C30.leader;
- u8 var = 0;
+ struct WirelessLink_Leader *data = sWirelessLinkMain.leader;
+ u8 colorIdx = UR_COLOR_DKE_WHT_LTE;
- switch (data->field_0->arr[id].field_1A_0)
+ switch (data->field_0->arr[id].groupScheduledAnim)
{
- case 1:
+ case UNION_ROOM_SPAWN_IN:
if (data->field_0->arr[id].field_1B != 0)
- var = 2;
+ colorIdx = UR_COLOR_GRN_WHT_LTG;
break;
- case 2:
- var = 1;
+ case UNION_ROOM_SPAWN_OUT:
+ colorIdx = UR_COLOR_RED_WHT_LTR;
break;
}
- sub_80178A0(arg0, 0, arg2, &data->field_0->arr[id], var, id);
+ PrintGroupMemberCandidateOnWindowWithColor(windowId, 0, y, &data->field_0->arr[id], colorIdx, id);
}
-u8 sub_80132D4(struct UnkStruct_Main0 *arg0)
+static u8 LeaderUpdateGroupMembership(struct UnkStruct_Main0 *arg0)
{
- struct UnkStruct_Leader *data = gUnknown_02022C30.leader;
- u8 ret = 0;
+ struct WirelessLink_Leader *data = sWirelessLinkMain.leader;
+ u8 ret = UNION_ROOM_SPAWN_NONE;
u8 i;
s32 id;
- for (i = 1; i < 5; i++)
+ for (i = 1; i < MAX_RFU_PLAYERS; i++)
{
- u16 var = data->field_0->arr[i].field_1A_0;
- if (var == 1)
+ u16 var = data->field_0->arr[i].groupScheduledAnim;
+ if (var == UNION_ROOM_SPAWN_IN)
{
- id = sub_80176E4(&data->field_0->arr[i], data->field_4->arr);
+ id = Findx20Inx1CArray(&data->field_0->arr[i], data->field_4->arr);
if (id != 0xFF)
{
- data->field_0->arr[i].unk = data->field_4->arr[id].unk0;
- data->field_0->arr[i].field_18 = var;
+ data->field_0->arr[i].gname_uname = data->field_4->arr[id].gname_uname;
+ data->field_0->arr[i].timeoutCounter = 1;
}
else
{
- data->field_0->arr[i].field_1A_0 = 2;
- ret = 2;
+ data->field_0->arr[i].groupScheduledAnim = UNION_ROOM_SPAWN_OUT;
+ ret = UNION_ROOM_SPAWN_OUT;
}
}
}
- for (id = 0; id < 4; id++)
- sub_8017734(data->field_0->arr, &data->field_4->arr[id], 5);
+ for (id = 0; id < RFU_CHILD_MAX; id++)
+ Appendx1Ctox20(data->field_0->arr, &data->field_4->arr[id], MAX_RFU_PLAYERS);
- if (ret != 2)
+ if (ret != UNION_ROOM_SPAWN_OUT)
{
- for (id = 0; id < 5; id++)
+ for (id = 0; id < MAX_RFU_PLAYERS; id++)
{
if (data->field_0->arr[id].field_1B != 0)
- ret = 1;
+ ret = UNION_ROOM_SPAWN_IN;
}
}
return ret;
}
-u8 sub_8013398(struct UnkStruct_Main0 *arg0)
+static u8 sub_8013398(struct UnkStruct_Main0 *arg0)
{
- struct UnkStruct_Leader *data = gUnknown_02022C30.leader;
+ struct WirelessLink_Leader *data = sWirelessLinkMain.leader;
u8 copiedCount;
s32 i;
- u8 ret;
+ u8 playerCount;
- for (i = 0; i < 5; i++)
+ for (i = 0; i < MAX_RFU_PLAYERS; i++)
data->field_8->arr[i] = data->field_0->arr[i];
copiedCount = 0;
- for (i = 0; i < 5; i++)
+ for (i = 0; i < MAX_RFU_PLAYERS; i++)
{
- if (data->field_8->arr[i].field_1A_0 == 1)
+ if (data->field_8->arr[i].groupScheduledAnim == UNION_ROOM_SPAWN_IN)
{
data->field_0->arr[copiedCount] = data->field_8->arr[i];
copiedCount++;
}
}
- ret = copiedCount;
- for (; copiedCount < 5; copiedCount++)
+ playerCount = copiedCount;
+ for (; copiedCount < MAX_RFU_PLAYERS; copiedCount++)
{
- data->field_0->arr[copiedCount].unk = gUnknown_082F045C;
- data->field_0->arr[copiedCount].field_18 = 0;
- data->field_0->arr[copiedCount].field_1A_0 = 0;
- data->field_0->arr[copiedCount].field_1A_1 = 0;
+ data->field_0->arr[copiedCount].gname_uname = sWirelessGnameUnamePair_Dummy;
+ data->field_0->arr[copiedCount].timeoutCounter = 0;
+ data->field_0->arr[copiedCount].groupScheduledAnim = UNION_ROOM_SPAWN_NONE;
+ data->field_0->arr[copiedCount].useRedText = FALSE;
data->field_0->arr[copiedCount].field_1B = 0;
}
- for (i = 0; i < 5; i++)
+ for (i = 0; i < MAX_RFU_PLAYERS; i++)
{
- if (data->field_0->arr[i].field_1A_0 != 1)
+ if (data->field_0->arr[i].groupScheduledAnim != UNION_ROOM_SPAWN_IN)
continue;
- if (data->field_0->arr[i].field_1B != 0x40)
+ if (data->field_0->arr[i].field_1B != 64)
continue;
- ret = i;
+ playerCount = i;
break;
}
- return ret;
+ return playerCount;
}
void TryJoinLinkGroup(void)
{
u8 taskId;
- struct UnkStruct_Group *dataPtr;
+ struct WirelessLink_Group *data;
- taskId = CreateTask(sub_80134E8, 0);
- gUnknown_02022C30.group = dataPtr = (void*)(gTasks[taskId].data);
- gUnknown_03000DA4 = dataPtr;
+ taskId = CreateTask(Task_TryJoinLinkGroup, 0);
+ sWirelessLinkMain.group = data = (void*)(gTasks[taskId].data);
+ sGroup = data;
- dataPtr->state = 0;
- dataPtr->textState = 0;
- gSpecialVar_Result = 0;
+ data->state = LG_STATE_INIT;
+ data->textState = 0;
+ gSpecialVar_Result = LINKUP_ONGOING;
}
-void sub_80134E8(u8 taskId)
+static void Task_TryJoinLinkGroup(u8 taskId)
{
s32 id;
- struct UnkStruct_Group *data = gUnknown_02022C30.group;
+ struct WirelessLink_Group *data = sWirelessLinkMain.group;
switch (data->state)
{
- case 0:
+ case LG_STATE_INIT:
if (gSpecialVar_0x8004 == LINK_GROUP_BATTLE_TOWER && gSaveBlock2Ptr->frontier.lvlMode == FRONTIER_LVL_OPEN)
gSpecialVar_0x8004++;
- gUnknown_02022C2C = gUnknown_082F0530[gSpecialVar_0x8004];
- sub_8010F84(gUnknown_02022C2C, 0, 0);
- sub_800B488();
+ gPlayerCurrActivity = sLinkGroupToURoomActivity[gSpecialVar_0x8004];
+ SetHostRFUtgtGname(gPlayerCurrActivity, 0, 0);
+ SetWirelessCommType1();
OpenLink();
- sub_8011C5C();
- data->field_4 = AllocZeroed(0x70);
- data->field_0 = AllocZeroed(0x200);
- data->state = 1;
+ InitializeRfuLinkManager_JoinGroup();
+ data->field_4 = AllocZeroed(4 * sizeof(struct UnkStruct_x1C));
+ data->field_0 = AllocZeroed(16 * sizeof(struct UnkStruct_x20));
+ data->state = LG_STATE_CHOOSE_LEADER_MSG;
break;
- case 1:
+ case LG_STATE_CHOOSE_LEADER_MSG:
if (PrintOnTextbox(&data->textState, sChooseTrainerTexts[gSpecialVar_0x8004]))
- data->state = 2;
+ data->state = LG_STATE_INIT_WINDOWS;
break;
- case 2:
- sub_80175EC(data->field_4, 4);
- sub_8017580(data->field_0->arr, 16);
- data->field_11 = sub_8016FC0(data->field_4, gSpecialVar_0x8004);
- data->field_C = AddWindow(&gUnknown_082F00BC);
+ case LG_STATE_INIT_WINDOWS:
+ ClearUnkStruct_x1CArray(data->field_4, 4);
+ ClearUnkStruct_x20Array(data->field_0->arr, 16);
+ data->listenTaskId = CreateTask_ListenForPartnersWithCompatibleSerialNos(data->field_4, gSpecialVar_0x8004);
+ data->bButtonCancelWindowId = AddWindow(&sWindowTemplate_BButtonCancel);
data->listWindowId = AddWindow(&gUnknown_082F0174);
- data->field_D = AddWindow(&gUnknown_082F017C);
+ data->playerNameAndIdWindowId = AddWindow(&gUnknown_082F017C);
- FillWindowPixelBuffer(data->field_C, PIXEL_FILL(2));
- sub_80173E0(data->field_C, 0, sText_ChooseJoinCancel, 8, 1, 4);
- PutWindowTilemap(data->field_C);
- CopyWindowToVram(data->field_C, 2);
+ FillWindowPixelBuffer(data->bButtonCancelWindowId, PIXEL_FILL(2));
+ UR_AddTextPrinterParameterized(data->bButtonCancelWindowId, 0, sText_ChooseJoinCancel, 8, 1, 4);
+ PutWindowTilemap(data->bButtonCancelWindowId);
+ CopyWindowToVram(data->bButtonCancelWindowId, 2);
DrawStdWindowFrame(data->listWindowId, FALSE);
- gMultiuseListMenuTemplate = gUnknown_082F0204;
+ gMultiuseListMenuTemplate = sListMenuTemplate_UnionRoomGroups;
gMultiuseListMenuTemplate.windowId = data->listWindowId;
data->listTaskId = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0);
- DrawStdWindowFrame(data->field_D, FALSE);
- PutWindowTilemap(data->field_D);
- sub_80125BC(data->field_D);
- CopyWindowToVram(data->field_D, 2);
+ DrawStdWindowFrame(data->playerNameAndIdWindowId, FALSE);
+ PutWindowTilemap(data->playerNameAndIdWindowId);
+ PrintPlayerNameAndIdOnWindow(data->playerNameAndIdWindowId);
+ CopyWindowToVram(data->playerNameAndIdWindowId, 2);
CopyBgTilemapBufferToVram(0);
- data->field_F = 0;
- data->state = 3;
+ data->leaderId = 0;
+ data->state = LG_STATE_CHOOSE_LEADER_HANDLE_INPUT;
break;
- case 3:
- id = sub_8013E44();
+ case LG_STATE_CHOOSE_LEADER_HANDLE_INPUT:
+ id = GetNewLeaderCandidate();
switch (id)
{
case 1:
@@ -869,22 +1008,22 @@ void sub_80134E8(u8 taskId)
if (gMain.newKeys & A_BUTTON && id != -1)
{
// this unused variable along with the assignment is needed to match
- u32 unusedVar;
- unusedVar = data->field_0->arr[id].unk.field_0.activity;
+ u32 activity = data->field_0->arr[id].gname_uname.gname.activity;
- if (data->field_0->arr[id].field_1A_0 == 1 && !data->field_0->arr[id].unk.field_0.started)
+ if (data->field_0->arr[id].groupScheduledAnim == UNION_ROOM_SPAWN_IN && !data->field_0->arr[id].gname_uname.gname.started)
{
- u32 var = sub_8013B8C(data, id);
- if (var == 0)
+ u32 readyStatus = IsTryingToTradeAcrossVersionTooSoon(data, id);
+ if (readyStatus == UR_TRADE_READY)
{
- sub_8013BD8(data, id);
- data->state = 5;
+ // Trading is allowed, or not trading at all
+ AskToJoinRfuGroup(data, id);
+ data->state = LG_STATE_ASK_JOIN_GROUP;
PlaySE(SE_PN_ON);
}
else
{
- StringCopy(gStringVar4, sCantTransmitToTrainerTexts[var - 1]);
- data->state = 18;
+ StringCopy(gStringVar4, sCantTransmitToTrainerTexts[readyStatus - 1]);
+ data->state = LG_STATE_TRADE_NOT_READY;
PlaySE(SE_PN_ON);
}
}
@@ -895,7 +1034,7 @@ void sub_80134E8(u8 taskId)
}
else if (gMain.newKeys & B_BUTTON)
{
- data->state = 10;
+ data->state = LG_STATE_CANCEL_CHOOSE_LEADER;
}
break;
default:
@@ -903,273 +1042,292 @@ void sub_80134E8(u8 taskId)
break;
}
break;
- case 5:
- sub_80130B4(gStringVar4, gUnknown_02022C2C);
+ case LG_STATE_ASK_JOIN_GROUP:
+ GetYouAskedToJoinGroupPleaseWaitMessage(gStringVar4, gPlayerCurrActivity);
if (PrintOnTextbox(&data->textState, gStringVar4))
{
- sub_8018404(gStringVar1, &data->field_0->arr[data->field_F]);
- data->state = 6;
+ IntlConvPartnerUname7(gStringVar1, &data->field_0->arr[data->leaderId]);
+ data->state = LG_STATE_MAIN;
}
break;
- case 6:
- if (gReceivedRemoteLinkPlayers != 0)
+ case LG_STATE_MAIN:
+ if (gReceivedRemoteLinkPlayers)
{
- gUnknown_02022C2C = data->field_0->arr[data->field_F].unk.field_0.activity;
- sub_8011A64(0, 0);
- switch (gUnknown_02022C2C)
+ gPlayerCurrActivity = data->field_0->arr[data->leaderId].gname_uname.gname.activity;
+ RfuSetStatus(RFU_STATUS_OK, 0);
+ switch (gPlayerCurrActivity)
{
- case 1 ... 5:
- case 9 ... 11:
- case 13 ... 16:
- case 21 ... 28:
- data->state = 20;
+ case ACTIVITY_BATTLE_SINGLE:
+ case ACTIVITY_BATTLE_DOUBLE:
+ case ACTIVITY_BATTLE_MULTI:
+ case ACTIVITY_TRADE:
+ case ACTIVITY_CHAT:
+ case ACTIVITY_POKEMON_JUMP:
+ case ACTIVITY_BERRY_CRUSH:
+ case ACTIVITY_BERRY_PICK:
+ case ACTIVITY_SPIN_TRADE:
+ case ACTIVITY_BATTLE_TOWER:
+ case ACTIVITY_BATTLE_TOWER_OPEN:
+ case ACTIVITY_RECORD_CORNER:
+ case ACTIVITY_BERRY_BLENDER:
+ case ACTIVITY_WONDER_CARD2:
+ case ACTIVITY_WONDER_NEWS2:
+ case ACTIVITY_CONTEST_COOL:
+ case ACTIVITY_CONTEST_BEAUTY:
+ case ACTIVITY_CONTEST_CUTE:
+ case ACTIVITY_CONTEST_SMART:
+ case ACTIVITY_CONTEST_TOUGH:
+ data->state = LG_STATE_READY_START_ACTIVITY;
return;
}
}
- switch (sub_8011A74())
+ switch (RfuGetStatus())
{
- case 1:
- data->state = 12;
+ case RFU_STATUS_FATAL_ERROR:
+ data->state = LG_STATE_RFU_ERROR;
break;
- case 2:
- case 6:
- case 9:
- data->state = 14;
+ case RFU_STATUS_CONNECTION_ERROR:
+ case RFU_STATUS_JOIN_GROUP_NO:
+ case RFU_STATUS_LEAVE_GROUP:
+ data->state = LG_STATE_DISCONNECTED;
break;
- case 5:
- sub_8013160(gStringVar4, gUnknown_02022C2C);
+ case RFU_STATUS_JOIN_GROUP_OK:
+ GetGroupLeaderSentAnOKMessage(gStringVar4, gPlayerCurrActivity);
if (PrintOnTextbox(&data->textState, gStringVar4))
{
- if (gUnknown_02022C2C == 28 || gUnknown_02022C2C == 14)
+ if (gPlayerCurrActivity == ACTIVITY_BATTLE_TOWER || gPlayerCurrActivity == ACTIVITY_BATTLE_TOWER_OPEN)
{
- sub_8011A64(12, 0);
+ RfuSetStatus(RFU_STATUS_ACK_JOIN_GROUP, 0);
}
else
{
- sub_8011A64(7, 0);
- StringCopy(gStringVar1, sLinkGroupActivityTexts[gUnknown_02022C2C]);
+ RfuSetStatus(RFU_STATUS_WAIT_ACK_JOIN_GROUP, 0);
+ StringCopy(gStringVar1, sLinkGroupActivityNameTexts[gPlayerCurrActivity]);
StringExpandPlaceholders(gStringVar4, sText_AwaitingOtherMembers);
}
}
break;
- case 7:
- if (data->field_15 > 0xF0)
+ case RFU_STATUS_WAIT_ACK_JOIN_GROUP:
+ if (data->delayBeforePrint > 240)
{
if (PrintOnTextbox(&data->textState, gStringVar4))
{
- sub_8011A64(12, 0);
- data->field_15 = 0;
+ RfuSetStatus(RFU_STATUS_ACK_JOIN_GROUP, 0);
+ data->delayBeforePrint = 0;
}
}
else
{
- switch (gUnknown_02022C2C)
+ switch (gPlayerCurrActivity)
{
- case 1:
- case 2:
- case 4:
- case 14:
- case 28:
+ case ACTIVITY_BATTLE_SINGLE:
+ case ACTIVITY_BATTLE_DOUBLE:
+ case ACTIVITY_TRADE:
+ case ACTIVITY_BATTLE_TOWER:
+ case ACTIVITY_BATTLE_TOWER_OPEN:
break;
default:
- data->field_15++;
+ data->delayBeforePrint++;
break;
}
}
break;
}
- if (!sub_8011A74() && gMain.newKeys & B_BUTTON)
- data->state = 7;
+ if (RfuGetStatus() == RFU_STATUS_OK && gMain.newKeys & B_BUTTON)
+ data->state = LG_STATE_ASK_LEAVE_GROUP;
break;
- case 7:
+ case LG_STATE_ASK_LEAVE_GROUP:
if (PrintOnTextbox(&data->textState, sText_QuitBeingMember))
- data->state = 8;
+ data->state = LG_STATE_ASK_LEAVE_GROUP_HANDLE_INPUT;
break;
- case 8:
- switch (sub_80170B8(&data->textState, sub_8011A74()))
+ case LG_STATE_ASK_LEAVE_GROUP_HANDLE_INPUT:
+ switch (UnionRoomHandleYesNo(&data->textState, RfuGetStatus()))
{
- case 0:
- sub_80106D4();
- data->state = 9;
+ case 0: // YES
+ SendLeaveGroupNotice();
+ data->state = LG_STATE_WAIT_LEAVE_GROUP;
RedrawListMenu(data->listTaskId);
break;
- case 1:
+ case 1: // NO
case -1:
- data->state = 5;
+ data->state = LG_STATE_ASK_JOIN_GROUP;
RedrawListMenu(data->listTaskId);
break;
case -3:
- data->state = 6;
+ data->state = LG_STATE_MAIN;
RedrawListMenu(data->listTaskId);
break;
}
break;
- case 9:
- if (sub_8011A74())
- data->state = 6;
+ case LG_STATE_WAIT_LEAVE_GROUP:
+ if (RfuGetStatus())
+ data->state = LG_STATE_MAIN;
break;
- case 10:
- case 12:
- case 14:
- case 18:
- case 20:
- ClearWindowTilemap(data->field_D);
- ClearStdWindowAndFrame(data->field_D, FALSE);
+ case LG_STATE_CANCEL_CHOOSE_LEADER: // next: LG_STATE_CANCELED
+ case LG_STATE_RFU_ERROR: // next: LG_STATE_RFU_ERROR_SHUTDOWN
+ case LG_STATE_DISCONNECTED: // next: LG_STATE_RETRY_CONNECTION
+ case LG_STATE_TRADE_NOT_READY: // next: LG_STATE_TRADE_NOT_READY_RETRY
+ case LG_STATE_READY_START_ACTIVITY: // next: LG_STATE_START_ACTIVITY
+ ClearWindowTilemap(data->playerNameAndIdWindowId);
+ ClearStdWindowAndFrame(data->playerNameAndIdWindowId, FALSE);
DestroyListMenuTask(data->listTaskId, 0, 0);
- ClearWindowTilemap(data->field_C);
+ ClearWindowTilemap(data->bButtonCancelWindowId);
ClearStdWindowAndFrame(data->listWindowId, FALSE);
CopyBgTilemapBufferToVram(0);
- RemoveWindow(data->field_D);
+ RemoveWindow(data->playerNameAndIdWindowId);
RemoveWindow(data->listWindowId);
- RemoveWindow(data->field_C);
- DestroyTask(data->field_11);
+ RemoveWindow(data->bButtonCancelWindowId);
+ DestroyTask(data->listenTaskId);
Free(data->field_0);
Free(data->field_4);
data->state++;
break;
- case 13:
+ case LG_STATE_RFU_ERROR_SHUTDOWN:
DestroyWirelessStatusIndicatorSprite();
- if (PrintOnTextbox(&data->textState, sPlayerDisconnectedTexts[sub_8011A74()]))
+ if (PrintOnTextbox(&data->textState, sPlayerDisconnectedTexts[RfuGetStatus()]))
{
- gSpecialVar_Result = 6;
- data->state = 23;
+ gSpecialVar_Result = LINKUP_CONNECTION_ERROR;
+ data->state = LG_STATE_SHUTDOWN;
}
break;
- case 11:
+ case LG_STATE_CANCELED:
DestroyWirelessStatusIndicatorSprite();
- gSpecialVar_Result = 5;
- data->state = 23;
+ gSpecialVar_Result = LINKUP_FAILED;
+ data->state = LG_STATE_SHUTDOWN;
break;
- case 15:
+ case LG_STATE_RETRY_CONNECTION:
+ // Failure from disconnection
+ // Happens if player or required member(s) leave group
+ // or if player is rejected from joining group
DestroyWirelessStatusIndicatorSprite();
- if (PrintOnTextbox(&data->textState, sPlayerDisconnectedTexts[sub_8011A74()]))
+ if (PrintOnTextbox(&data->textState, sPlayerDisconnectedTexts[RfuGetStatus()]))
{
- gSpecialVar_Result = 8;
- data->state = 23;
+ gSpecialVar_Result = LINKUP_RETRY_ROLE_ASSIGN;
+ data->state = LG_STATE_SHUTDOWN;
}
break;
- case 19:
+ case LG_STATE_TRADE_NOT_READY_RETRY:
if (PrintOnTextbox(&data->textState, gStringVar4))
{
- gSpecialVar_Result = 8;
- data->state = 23;
+ gSpecialVar_Result = LINKUP_RETRY_ROLE_ASSIGN;
+ data->state = LG_STATE_SHUTDOWN;
}
break;
- case 23:
+ case LG_STATE_SHUTDOWN:
DestroyTask(taskId);
- sub_80173D4();
- sub_800EDD4();
+ JoinGroup_EnableScriptContexts();
+ LinkRfu_Shutdown();
break;
- case 21:
- sub_80149C4();
+ case LG_STATE_START_ACTIVITY:
+ CreateTask_RunScriptAndFadeToActivity();
DestroyTask(taskId);
break;
}
}
-u32 sub_8013B8C(struct UnkStruct_Group *arg0, s32 id)
+static u32 IsTryingToTradeAcrossVersionTooSoon(struct WirelessLink_Group *data, s32 id)
{
- struct UnkStruct_x20 *structPtr = &arg0->field_0->arr[id];
+ struct UnkStruct_x20 *structPtr = &data->field_0->arr[id];
- if (gUnknown_02022C2C == 4 && structPtr->unk.field_0.unk_00.version != VERSION_EMERALD)
+ if (gPlayerCurrActivity == ACTIVITY_TRADE && structPtr->gname_uname.gname.unk_00.version != VERSION_EMERALD)
{
if (!(gSaveBlock2Ptr->specialSaveWarpFlags & CHAMPION_SAVEWARP))
- return 1;
- else if (structPtr->unk.field_0.unk_00.isChampion)
- return 0;
+ return UR_TRADE_PLAYER_NOT_READY;
+ else if (structPtr->gname_uname.gname.unk_00.isChampion)
+ return UR_TRADE_READY;
}
else
{
- return 0;
+ return UR_TRADE_READY;
}
- return 2;
+ return UR_TRADE_PARTNER_NOT_READY;
}
-void sub_8013BD8(struct UnkStruct_Group *data, s32 id)
+static void AskToJoinRfuGroup(struct WirelessLink_Group *data, s32 id)
{
- data->field_F = id;
+ data->leaderId = id;
LoadWirelessStatusIndicatorSpriteGfx();
CreateWirelessStatusIndicatorSprite(0, 0);
RedrawListMenu(data->listTaskId);
- sub_8018404(gStringVar1, &data->field_0->arr[data->field_F]);
- sub_8011090(gUnknown_082F0530[gSpecialVar_0x8004], 0, 1);
- sub_8011FC8(data->field_0->arr[data->field_F].unk.playerName, ReadAsU16(data->field_0->arr[data->field_F].unk.field_0.unk_00.playerTrainerId));
+ IntlConvPartnerUname7(gStringVar1, &data->field_0->arr[data->leaderId]);
+ UpdateGameData_SetActivity(sLinkGroupToURoomActivity[gSpecialVar_0x8004], 0, TRUE);
+ CreateTask_RfuReconnectWithParent(data->field_0->arr[data->leaderId].gname_uname.playerName, ReadAsU16(data->field_0->arr[data->leaderId].gname_uname.gname.unk_00.playerTrainerId));
}
-u8 sub_8013C40(void)
+u8 CreateTask_ListenToWireless(void)
{
u8 taskId;
- struct UnkStruct_Group *dataPtr;
+ struct WirelessLink_Group *data;
- taskId = CreateTask(sub_8013C7C, 0);
- gUnknown_02022C30.group = dataPtr = (void*)(gTasks[taskId].data);
+ taskId = CreateTask(Task_ListenToWireless, 0);
+ sWirelessLinkMain.group = data = (void*)(gTasks[taskId].data);
- dataPtr->state = 0;
- dataPtr->textState = 0;
+ data->state = 0;
+ data->textState = 0;
- gUnknown_03000DA4 = dataPtr;
+ sGroup = data;
return taskId;
}
-void sub_8013C7C(u8 taskId)
+static void Task_ListenToWireless(u8 taskId)
{
- struct UnkStruct_Group *data = gUnknown_02022C30.group;
+ struct WirelessLink_Group *data = sWirelessLinkMain.group;
switch (data->state)
{
case 0:
- sub_8010F84(0, 0, 0);
- sub_800B488();
+ SetHostRFUtgtGname(0, 0, 0);
+ SetWirelessCommType1();
OpenLink();
- sub_8011C5C();
+ InitializeRfuLinkManager_JoinGroup();
sub_80111B0(TRUE);
- data->field_4 = AllocZeroed(0x70);
- data->field_0 = AllocZeroed(0x200);
+ data->field_4 = AllocZeroed(4 * sizeof(struct UnkStruct_x1C));
+ data->field_0 = AllocZeroed(16 * sizeof(struct UnkStruct_x20));
data->state = 2;
break;
case 2:
- sub_80175EC(data->field_4, 4);
- sub_8017580(data->field_0->arr, 16);
- data->field_11 = sub_8016FC0(data->field_4, 0xFF);
- data->field_F = 0;
+ ClearUnkStruct_x1CArray(data->field_4, 4);
+ ClearUnkStruct_x20Array(data->field_0->arr, 16);
+ data->listenTaskId = CreateTask_ListenForPartnersWithCompatibleSerialNos(data->field_4, 0xFF);
+ data->leaderId = 0;
data->state = 3;
break;
case 3:
- if (sub_8013E44() == 1)
+ if (GetNewLeaderCandidate() == 1)
PlaySE(SE_PC_LOGIN);
if (gTasks[taskId].data[15] == 0xFF)
data->state = 10;
break;
case 10:
- DestroyTask(data->field_11);
+ DestroyTask(data->listenTaskId);
Free(data->field_0);
Free(data->field_4);
- sub_800EDD4();
+ LinkRfu_Shutdown();
data->state++;
break;
case 11:
- sub_800EDD4();
+ LinkRfu_Shutdown();
DestroyTask(taskId);
break;
}
}
-bool32 sub_8013D88(u32 arg0, u32 id)
+static bool32 IsPartnerActivityAcceptable(u32 activity, u32 linkGroup)
{
- if (id == 0xFF)
+ if (linkGroup == 0xFF)
return TRUE;
- if (id <= ARRAY_COUNT(gUnknown_082F04D8)) // UB: <= may access data outside the array
+ if (linkGroup <= ARRAY_COUNT(sAcceptedActivityIds)) // UB: <= may access data outside the array
{
- const u8 *bytes = gUnknown_082F04D8[id];
+ const u8 *bytes = sAcceptedActivityIds[linkGroup];
while ((*(bytes) != 0xFF))
{
- if ((*bytes) == arg0)
+ if ((*bytes) == activity)
return TRUE;
bytes++;
}
@@ -1178,49 +1336,49 @@ bool32 sub_8013D88(u32 arg0, u32 id)
return FALSE;
}
-u8 sub_8013DBC(struct UnkStruct_Group *data, u32 id)
+static u8 URoomGroupListGetTextColor(struct WirelessLink_Group *data, u32 id)
{
- if (data->field_0->arr[id].field_1A_0 == 1)
+ if (data->field_0->arr[id].groupScheduledAnim == UNION_ROOM_SPAWN_IN)
{
- if (data->field_0->arr[id].unk.field_0.started)
- return 3;
- else if (data->field_0->arr[id].field_1A_1 != 0)
- return 1;
+ if (data->field_0->arr[id].gname_uname.gname.started)
+ return UR_COLOR_WHT_WHT_LTE;
+ else if (data->field_0->arr[id].useRedText)
+ return UR_COLOR_RED_WHT_LTR;
else if (data->field_0->arr[id].field_1B != 0)
- return 2;
+ return UR_COLOR_GRN_WHT_LTG;
}
- return 0;
+ return UR_COLOR_DKE_WHT_LTE;
}
-void sub_8013DF4(u8 arg0, s32 id, u8 arg2)
+static void ListMenuItemPrintFunc_UnionRoomGroups(u8 windowId, s32 id, u8 y)
{
- struct UnkStruct_Group *data = gUnknown_02022C30.group;
- u8 var = sub_8013DBC(data, id);
+ struct WirelessLink_Group *data = sWirelessLinkMain.group;
+ u8 colorId = URoomGroupListGetTextColor(data, id);
- sub_80177B8(arg0, 8, arg2, &data->field_0->arr[id], var, id);
+ PrintUnionRoomGroupOnWindow(windowId, 8, y, &data->field_0->arr[id], colorId, id);
}
-u8 sub_8013E44(void)
+static u8 GetNewLeaderCandidate(void)
{
- struct UnkStruct_Group *data = gUnknown_02022C30.group;
+ struct WirelessLink_Group *data = sWirelessLinkMain.group;
u8 ret = 0;
u8 i;
s32 id;
for (i = 0; i < 16; i++)
{
- if (data->field_0->arr[i].field_1A_0 != 0)
+ if (data->field_0->arr[i].groupScheduledAnim != UNION_ROOM_SPAWN_NONE)
{
- id = sub_80176E4(&data->field_0->arr[i], data->field_4->arr);
+ id = Findx20Inx1CArray(&data->field_0->arr[i], data->field_4->arr);
if (id != 0xFF)
{
- if (data->field_0->arr[i].field_1A_0 == 1)
+ if (data->field_0->arr[i].groupScheduledAnim == UNION_ROOM_SPAWN_IN)
{
- if (sub_8017678(&data->field_0->arr[i].unk, &data->field_4->arr[id].unk0))
+ if (AreUnionRoomPlayerGnamesDifferent(&data->field_0->arr[i].gname_uname, &data->field_4->arr[id].gname_uname))
{
- data->field_0->arr[i].unk = data->field_4->arr[id].unk0;
- data->field_0->arr[i].field_1B = 0x40;
+ data->field_0->arr[i].gname_uname = data->field_4->arr[id].gname_uname;
+ data->field_0->arr[i].field_1B = 64;
ret = 1;
}
else
@@ -1235,21 +1393,21 @@ u8 sub_8013E44(void)
}
else
{
- data->field_0->arr[i].field_1A_0 = 1;
- data->field_0->arr[i].field_1B = 0x40;
+ data->field_0->arr[i].groupScheduledAnim = UNION_ROOM_SPAWN_IN;
+ data->field_0->arr[i].field_1B = 64;
ret = 1;
}
- data->field_0->arr[i].field_18 = 0;
+ data->field_0->arr[i].timeoutCounter = 0;
}
else
{
- if (data->field_0->arr[i].field_1A_0 != 2)
+ if (data->field_0->arr[i].groupScheduledAnim != UNION_ROOM_SPAWN_OUT)
{
- data->field_0->arr[i].field_18++;
- if (data->field_0->arr[i].field_18 >= 300)
+ data->field_0->arr[i].timeoutCounter++;
+ if (data->field_0->arr[i].timeoutCounter >= 300)
{
- data->field_0->arr[i].field_1A_0 = 2;
+ data->field_0->arr[i].groupScheduledAnim = UNION_ROOM_SPAWN_OUT;
ret = 2;
}
}
@@ -1257,9 +1415,9 @@ u8 sub_8013E44(void)
}
}
- for (id = 0; id < 4; id++)
+ for (id = 0; id < RFU_CHILD_MAX; id++)
{
- if (sub_8017734(data->field_0->arr, &data->field_4->arr[id], 16) != 0xFF)
+ if (Appendx1Ctox20(data->field_0->arr, &data->field_4->arr[id], 16) != 0xFF)
ret = 1;
}
@@ -1272,14 +1430,14 @@ static void Task_CreateTradeMenu(u8 taskId)
DestroyTask(taskId);
}
-u8 sub_8013F78(void)
+u8 CreateTask_CreateTradeMenu(void)
{
u8 taskId = CreateTask(Task_CreateTradeMenu, 0);
return taskId;
}
-void sub_8013F90(u8 taskId)
+static void Task_StartUnionRoomTrade(u8 taskId)
{
u32 monId = GetPartyPositionOfRegisteredMon(&sUnionRoomTrade, GetMultiplayerId());
@@ -1319,7 +1477,7 @@ void sub_8013F90(u8 taskId)
}
}
-void sub_80140E0(u8 taskId)
+static void Task_ExchangeCards(u8 taskId)
{
switch (gTasks[taskId].data[0])
{
@@ -1329,7 +1487,7 @@ void sub_80140E0(u8 taskId)
gTasks[taskId].data[0]++;
break;
case 1:
- if (GetBlockReceivedStatus() == sub_800A9D8())
+ if (GetBlockReceivedStatus() == GetLinkPlayerCountAsBitFlags())
{
s32 i;
u16 *recvBuff;
@@ -1343,11 +1501,11 @@ void sub_80140E0(u8 taskId)
if (GetLinkPlayerCount() == 2)
{
recvBuff = gBlockRecvBuffer[GetMultiplayerId() ^ 1];
- sub_801B94C(recvBuff[48]);
+ MEventHandleReceivedWonderCard(recvBuff[48]);
}
else
{
- sub_801B940();
+ ResetReceivedWonderCardFlag();
}
ResetBlockReceivedFlags();
@@ -1357,16 +1515,16 @@ void sub_80140E0(u8 taskId)
}
}
-void sub_80141A4(void)
+static void CB2_ShowCard(void)
{
switch (gMain.state)
{
case 0:
- CreateTask(sub_80140E0, 5);
+ CreateTask(Task_ExchangeCards, 5);
gMain.state++;
break;
case 1:
- if (!FuncIsActiveTask(sub_80140E0))
+ if (!FuncIsActiveTask(Task_ExchangeCards))
ShowTrainerCardInLink(GetMultiplayerId() ^ 1, CB2_ReturnToField);
break;
}
@@ -1377,7 +1535,7 @@ void sub_80141A4(void)
BuildOamBuffer();
}
-void sub_8014210(u16 battleFlags)
+void StartUnionRoomBattle(u16 battleFlags)
{
HealPlayerParty();
SavePlayerParty();
@@ -1385,12 +1543,12 @@ void sub_8014210(u16 battleFlags)
gLinkPlayers[0].linkType = LINKTYPE_BATTLE;
gLinkPlayers[GetMultiplayerId()].id = GetMultiplayerId();
gLinkPlayers[GetMultiplayerId() ^ 1].id = GetMultiplayerId() ^ 1;
- gMain.savedCallback = sub_80B360C;
+ gMain.savedCallback = CB2_ReturnFromCableClubBattle;
gBattleTypeFlags = battleFlags;
PlayBattleBGM();
}
-static void sub_8014290(u16 linkService, u16 x, u16 y)
+static void WarpForWirelessMinigame(u16 linkService, u16 x, u16 y)
{
VarSet(VAR_CABLE_CLUB_STATE, linkService);
SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x, y);
@@ -1398,7 +1556,7 @@ static void sub_8014290(u16 linkService, u16 x, u16 y)
WarpIntoMap();
}
-void sub_8014304(s8 mapGroup, s8 mapNum, s32 x, s32 y, u16 linkService)
+static void WarpForCableClubActivity(s8 mapGroup, s8 mapNum, s32 x, s32 y, u16 linkService)
{
gSpecialVar_0x8004 = linkService;
VarSet(VAR_CABLE_CLUB_STATE, linkService);
@@ -1409,16 +1567,16 @@ void sub_8014304(s8 mapGroup, s8 mapNum, s32 x, s32 y, u16 linkService)
WarpIntoMap();
}
-void sub_8014384(void)
+static void CB2_TransitionToCableClub(void)
{
switch (gMain.state)
{
case 0:
- CreateTask(sub_80140E0, 5);
+ CreateTask(Task_ExchangeCards, 5);
gMain.state++;
break;
case 1:
- if (!FuncIsActiveTask(sub_80140E0))
+ if (!FuncIsActiveTask(Task_ExchangeCards))
SetMainCallback2(CB2_ReturnToFieldCableClub);
break;
}
@@ -1429,120 +1587,125 @@ void sub_8014384(void)
BuildOamBuffer();
}
-void sub_80143E4(void *arg0, bool32 arg1)
+static void CreateTrainerCardInBuffer(void *dest, bool32 setWonderCard)
{
- u16 *argAsU16Ptr = arg0;
+ u16 *argAsU16Ptr = dest;
TrainerCard_GenerateCardForPlayer((struct TrainerCard *)argAsU16Ptr);
- if (arg1)
+ if (setWonderCard)
argAsU16Ptr[48] = GetWonderCardFlagID();
else
argAsU16Ptr[48] = 0;
}
-void sub_801440C(u8 taskId)
+static void Task_StartActivity(u8 taskId)
{
- sub_801B940();
- switch (gUnknown_02022C2C)
+ ResetReceivedWonderCardFlag();
+ switch (gPlayerCurrActivity)
{
- case 1 ... 4:
- case 9 ... 11:
- case 13:
- case 15:
+ case ACTIVITY_BATTLE_SINGLE:
+ case ACTIVITY_BATTLE_DOUBLE:
+ case ACTIVITY_BATTLE_MULTI:
+ case ACTIVITY_TRADE:
+ case ACTIVITY_POKEMON_JUMP:
+ case ACTIVITY_BERRY_CRUSH:
+ case ACTIVITY_BERRY_PICK:
+ case ACTIVITY_SPIN_TRADE:
+ case ACTIVITY_RECORD_CORNER:
RecordMixTrainerNames();
break;
}
- switch (gUnknown_02022C2C)
+ switch (gPlayerCurrActivity)
{
- case 65:
- case 81:
+ case ACTIVITY_BATTLE_SINGLE | IN_UNION_ROOM:
+ case ACTIVITY_ACCEPT | IN_UNION_ROOM:
CleanupOverworldWindowsAndTilemaps();
- gMain.savedCallback = sub_801AC54;
+ gMain.savedCallback = CB2_UnionRoomBattle;
InitChooseHalfPartyForBattle(3);
break;
- case 1:
+ case ACTIVITY_BATTLE_SINGLE:
CleanupOverworldWindowsAndTilemaps();
- sub_80143E4(gBlockSendBuffer, TRUE);
+ CreateTrainerCardInBuffer(gBlockSendBuffer, TRUE);
HealPlayerParty();
SavePlayerParty();
LoadPlayerBag();
- sub_8014304(MAP_GROUP(BATTLE_COLOSSEUM_2P), MAP_NUM(BATTLE_COLOSSEUM_2P), 6, 8, USING_SINGLE_BATTLE);
- SetMainCallback2(sub_8014384);
+ WarpForCableClubActivity(MAP_GROUP(BATTLE_COLOSSEUM_2P), MAP_NUM(BATTLE_COLOSSEUM_2P), 6, 8, USING_SINGLE_BATTLE);
+ SetMainCallback2(CB2_TransitionToCableClub);
break;
- case 2:
+ case ACTIVITY_BATTLE_DOUBLE:
CleanupOverworldWindowsAndTilemaps();
HealPlayerParty();
SavePlayerParty();
LoadPlayerBag();
- sub_80143E4(gBlockSendBuffer, TRUE);
- sub_8014304(MAP_GROUP(BATTLE_COLOSSEUM_2P), MAP_NUM(BATTLE_COLOSSEUM_2P), 6, 8, USING_DOUBLE_BATTLE);
- SetMainCallback2(sub_8014384);
+ CreateTrainerCardInBuffer(gBlockSendBuffer, TRUE);
+ WarpForCableClubActivity(MAP_GROUP(BATTLE_COLOSSEUM_2P), MAP_NUM(BATTLE_COLOSSEUM_2P), 6, 8, USING_DOUBLE_BATTLE);
+ SetMainCallback2(CB2_TransitionToCableClub);
break;
- case 3:
+ case ACTIVITY_BATTLE_MULTI:
CleanupOverworldWindowsAndTilemaps();
HealPlayerParty();
SavePlayerParty();
LoadPlayerBag();
- sub_80143E4(gBlockSendBuffer, TRUE);
- sub_8014304(MAP_GROUP(BATTLE_COLOSSEUM_4P), MAP_NUM(BATTLE_COLOSSEUM_4P), 5, 8, USING_MULTI_BATTLE);
- SetMainCallback2(sub_8014384);
+ CreateTrainerCardInBuffer(gBlockSendBuffer, TRUE);
+ WarpForCableClubActivity(MAP_GROUP(BATTLE_COLOSSEUM_4P), MAP_NUM(BATTLE_COLOSSEUM_4P), 5, 8, USING_MULTI_BATTLE);
+ SetMainCallback2(CB2_TransitionToCableClub);
break;
- case 4:
- sub_80143E4(gBlockSendBuffer, TRUE);
+ case ACTIVITY_TRADE:
+ CreateTrainerCardInBuffer(gBlockSendBuffer, TRUE);
CleanupOverworldWindowsAndTilemaps();
- sub_8014304(MAP_GROUP(TRADE_CENTER), MAP_NUM(TRADE_CENTER), 5, 8, USING_TRADE_CENTER);
- SetMainCallback2(sub_8014384);
+ WarpForCableClubActivity(MAP_GROUP(TRADE_CENTER), MAP_NUM(TRADE_CENTER), 5, 8, USING_TRADE_CENTER);
+ SetMainCallback2(CB2_TransitionToCableClub);
break;
- case 15:
- sub_80143E4(gBlockSendBuffer, TRUE);
+ case ACTIVITY_RECORD_CORNER:
+ CreateTrainerCardInBuffer(gBlockSendBuffer, TRUE);
CleanupOverworldWindowsAndTilemaps();
- sub_8014304(MAP_GROUP(RECORD_CORNER), MAP_NUM(RECORD_CORNER), 8, 9, USING_RECORD_CORNER);
- SetMainCallback2(sub_8014384);
+ WarpForCableClubActivity(MAP_GROUP(RECORD_CORNER), MAP_NUM(RECORD_CORNER), 8, 9, USING_RECORD_CORNER);
+ SetMainCallback2(CB2_TransitionToCableClub);
break;
- case 68:
+ case ACTIVITY_TRADE | IN_UNION_ROOM:
CleanupOverworldWindowsAndTilemaps();
- CreateTask(sub_8013F90, 0);
+ CreateTask(Task_StartUnionRoomTrade, 0);
break;
- case 5:
- case 69:
+ case ACTIVITY_CHAT:
+ case ACTIVITY_CHAT | IN_UNION_ROOM:
if (GetMultiplayerId() == 0)
{
- sub_800ED10();
+ LinkRfu_CreateConnectionAsParent();
}
else
{
- sub_800ED28();
- sub_8010F84(69, 0, 1);
+ LinkRfu_StopManagerBeforeEnteringChat();
+ SetHostRFUtgtGname(69, 0, 1);
}
- sub_801DD98();
+ EnterUnionRoomChat();
break;
- case 8:
- case 72:
- sub_80143E4(gBlockSendBuffer, FALSE);
- SetMainCallback2(sub_80141A4);
+ case ACTIVITY_CARD:
+ case ACTIVITY_CARD | IN_UNION_ROOM:
+ CreateTrainerCardInBuffer(gBlockSendBuffer, FALSE);
+ SetMainCallback2(CB2_ShowCard);
break;
- case 9:
- sub_8014290(USING_MINIGAME, 5, 1);
- sub_802A9A8(GetCursorSelectionMonId(), CB2_LoadMap);
+ case ACTIVITY_POKEMON_JUMP:
+ WarpForWirelessMinigame(USING_MINIGAME, 5, 1);
+ StartPokemonJump(GetCursorSelectionMonId(), CB2_LoadMap);
break;
- case 10:
- sub_8014290(USING_BERRY_CRUSH, 9, 1);
- sub_8020C70(CB2_LoadMap);
+ case ACTIVITY_BERRY_CRUSH:
+ WarpForWirelessMinigame(USING_BERRY_CRUSH, 9, 1);
+ StartBerryCrush(CB2_LoadMap);
break;
- case 11:
- sub_8014290(USING_MINIGAME, 5, 1);
- sub_802493C(GetCursorSelectionMonId(), CB2_LoadMap);
+ case ACTIVITY_BERRY_PICK:
+ WarpForWirelessMinigame(USING_MINIGAME, 5, 1);
+ StartDodrioBerryPicking(GetCursorSelectionMonId(), CB2_LoadMap);
break;
}
DestroyTask(taskId);
- gSpecialVar_Result = 1;
- if (gUnknown_02022C2C != 68)
+ gSpecialVar_Result = LINKUP_SUCCESS;
+ if (gPlayerCurrActivity != (ACTIVITY_TRADE | IN_UNION_ROOM))
ScriptContext2_Disable();
}
-void sub_8014790(u8 taskId)
+static void Task_RunScriptAndFadeToActivity(u8 taskId)
{
s16 *data = gTasks[taskId].data;
u16 *sendBuff = (u16*)(gBlockSendBuffer);
@@ -1550,11 +1713,11 @@ void sub_8014790(u8 taskId)
switch (data[0])
{
case 0:
- gSpecialVar_Result = 1;
- switch (gUnknown_02022C2C)
+ gSpecialVar_Result = LINKUP_SUCCESS;
+ switch (gPlayerCurrActivity)
{
- case 14:
- case 28:
+ case ACTIVITY_BATTLE_TOWER:
+ case ACTIVITY_BATTLE_TOWER_OPEN:
gLinkPlayers[0].linkType = LINKTYPE_BATTLE;
gLinkPlayers[0].id = 0;
gLinkPlayers[1].id = 2;
@@ -1565,8 +1728,12 @@ void sub_8014790(u8 taskId)
RecordMixTrainerNames();
ResetBlockReceivedFlags();
break;
- case 16:
- case 23 ... 27:
+ case ACTIVITY_BERRY_BLENDER:
+ case ACTIVITY_CONTEST_COOL:
+ case ACTIVITY_CONTEST_BEAUTY:
+ case ACTIVITY_CONTEST_CUTE:
+ case ACTIVITY_CONTEST_SMART:
+ case ACTIVITY_CONTEST_TOUGH:
RecordMixTrainerNames();
DestroyTask(taskId);
default:
@@ -1585,7 +1752,7 @@ void sub_8014790(u8 taskId)
case 2:
if (!gPaletteFade.active)
{
- if (gUnknown_02022C2C == 29)
+ if (gPlayerCurrActivity == ACTIVITY_29)
{
DestroyTask(taskId);
SetMainCallback2(CB2_StartCreateTradeMenu);
@@ -1601,7 +1768,7 @@ void sub_8014790(u8 taskId)
if (IsLinkTaskFinished())
{
DestroyTask(taskId);
- sub_80149D8();
+ CreateTask_StartActivity();
}
break;
case 4:
@@ -1612,9 +1779,9 @@ void sub_8014790(u8 taskId)
if (GetBlockReceivedStatus() == 3)
{
ResetBlockReceivedFlags();
- if (sub_80B2AF4(gBlockRecvBuffer[0], gBlockRecvBuffer[1]))
+ if (AreBattleTowerLinkSpeciesSame(gBlockRecvBuffer[0], gBlockRecvBuffer[1]))
{
- gSpecialVar_Result = 11;
+ gSpecialVar_Result = LINKUP_FAILED_BATTLE_TOWER;
data[0] = 7;
}
else
@@ -1642,78 +1809,78 @@ void sub_8014790(u8 taskId)
}
}
-void sub_80149C4(void)
+static void CreateTask_RunScriptAndFadeToActivity(void)
{
- CreateTask(sub_8014790, 0);
+ CreateTask(Task_RunScriptAndFadeToActivity, 0);
}
-void sub_80149D8(void)
+static void CreateTask_StartActivity(void)
{
- u8 taskId = CreateTask(sub_801440C, 0);
+ u8 taskId = CreateTask(Task_StartActivity, 0);
gTasks[taskId].data[0] = 0;
}
-void MEvent_CreateTask_Leader(u32 arg0)
+void MEvent_CreateTask_Leader(u32 activity)
{
u8 taskId;
- struct UnkStruct_Leader *dataPtr;
+ struct WirelessLink_Leader *data;
- taskId = CreateTask(sub_8014A40, 0);
- gUnknown_02022C30.leader = dataPtr = (void*)(gTasks[taskId].data);
+ taskId = CreateTask(Task_MEvent_Leader, 0);
+ sWirelessLinkMain.leader = data = (void*)(gTasks[taskId].data);
- dataPtr->state = 0;
- dataPtr->textState = 0;
- dataPtr->field_18 = arg0;
- gSpecialVar_Result = 0;
+ data->state = 0;
+ data->textState = 0;
+ data->activity = activity;
+ gSpecialVar_Result = LINKUP_ONGOING;
}
-void sub_8014A40(u8 taskId)
+static void Task_MEvent_Leader(u8 taskId)
{
- struct UnkStruct_Leader *data = gUnknown_02022C30.leader;
+ struct WirelessLink_Leader *data = sWirelessLinkMain.leader;
struct WindowTemplate winTemplate;
s32 val;
switch (data->state)
{
case 0:
- gUnknown_02022C2C = data->field_18;
- gUnknown_02022C2D = 2;
- sub_8010F84(data->field_18, 0, 0);
- sub_8010FA0(FALSE, FALSE);
- sub_800B488();
+ gPlayerCurrActivity = data->activity;
+ sPlayerActivityGroupSize = 2;
+ SetHostRFUtgtGname(data->activity, 0, 0);
+ SetGnameBufferWonderFlags(FALSE, FALSE);
+ SetWirelessCommType1();
OpenLink();
- sub_8011C10(2);
+ InitializeRfuLinkManager_LinkLeader(2);
data->state = 1;
break;
case 1:
- data->field_4 = AllocZeroed(0x70);
- data->field_0 = AllocZeroed(0xA0);
- data->field_8 = AllocZeroed(0xA0);
- sub_80175EC(data->field_4, 4);
- sub_8017580(data->field_0->arr, 5);
- sub_800DF90(&data->field_0->arr[0].unk.field_0, data->field_0->arr[0].unk.playerName);
- data->field_0->arr[0].field_18 = 0;
- data->field_0->arr[0].field_1A_0 = 1;
- data->field_0->arr[0].field_1A_1 = 0;
+ data->field_4 = AllocZeroed(4 * sizeof(struct UnkStruct_x1C));
+ data->field_0 = AllocZeroed(5 * sizeof(struct UnkStruct_x20));
+ data->field_8 = AllocZeroed(5 * sizeof(struct UnkStruct_x20));
+ ClearUnkStruct_x1CArray(data->field_4, 4);
+ ClearUnkStruct_x20Array(data->field_0->arr, 5);
+ LinkRfu3_SetGnameUnameFromStaticBuffers(&data->field_0->arr[0].gname_uname.gname, data->field_0->arr[0].gname_uname.playerName);
+ data->field_0->arr[0].timeoutCounter = 0;
+ data->field_0->arr[0].groupScheduledAnim = UNION_ROOM_SPAWN_IN;
+ data->field_0->arr[0].useRedText = FALSE;
data->field_0->arr[0].field_1B = 0;
- data->field_17 = sub_8016FC0(data->field_4, 0xFF);
+ data->listenTaskId = CreateTask_ListenForPartnersWithCompatibleSerialNos(data->field_4, 0xFF);
- winTemplate = gUnknown_082F011C;
+ winTemplate = sWindowTemplate_PlayerList;
winTemplate.baseBlock = GetMysteryGiftBaseBlock();
winTemplate.paletteNum = 0xC;
data->listWindowId = AddWindow(&winTemplate);
MG_DrawTextBorder(data->listWindowId);
- gMultiuseListMenuTemplate = gUnknown_082F015C;
+ gMultiuseListMenuTemplate = sListMenuTemplate_PossibleGroupMembers;
gMultiuseListMenuTemplate.windowId = data->listWindowId;
data->listTaskId = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0);
CopyBgTilemapBufferToVram(0);
- data->field_13 = 1;
+ data->playerCount = 1;
data->state = 2;
break;
case 2:
- StringCopy(gStringVar1, sLinkGroupActivityTexts[gUnknown_02022C2C]);
- sub_801262C(gStringVar4, gUnknown_02022C2C);
+ StringCopy(gStringVar1, sLinkGroupActivityNameTexts[gPlayerCurrActivity]);
+ StringExpandPlaceholders_AwaitingCommFromAnother(gStringVar4, gPlayerCurrActivity);
data->state = 3;
break;
case 3:
@@ -1721,7 +1888,7 @@ void sub_8014A40(u8 taskId)
data->state = 4;
break;
case 4:
- sub_801320C(data, 5, 6);
+ Leader_SetStateIfMemberListChanged(data, 5, 6);
if (gMain.newKeys & B_BUTTON)
{
data->state = 13;
@@ -1731,7 +1898,7 @@ void sub_8014A40(u8 taskId)
case 6:
if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, sText_LinkWithFriendDropped))
{
- data->field_13 = sub_8013398(data->field_0);
+ data->playerCount = sub_8013398(data->field_0);
RedrawListMenu(data->listTaskId);
data->state = 2;
}
@@ -1745,48 +1912,48 @@ void sub_8014A40(u8 taskId)
case 0:
LoadWirelessStatusIndicatorSpriteGfx();
CreateWirelessStatusIndicatorSprite(0, 0);
- data->field_0->arr[data->field_13].field_1B = 0;
+ data->field_0->arr[data->playerCount].field_1B = 0;
RedrawListMenu(data->listTaskId);
- data->field_19 = 5;
- sub_8010688(5, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName);
+ data->joinRequestAnswer = RFU_STATUS_JOIN_GROUP_OK;
+ SendRfuStatusToPartner(data->joinRequestAnswer, ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.unk_00.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.playerName);
data->state = 8;
break;
case 1:
case -1:
- data->field_19 = 6;
- sub_8010688(6, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName);
+ data->joinRequestAnswer = RFU_STATUS_JOIN_GROUP_NO;
+ SendRfuStatusToPartner(data->joinRequestAnswer, ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.unk_00.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.playerName);
data->state = 8;
break;
}
break;
case 8:
- val = sub_8010714(ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName);
- if (val == 1)
+ val = WaitSendRfuStatusToPartner(ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.unk_00.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.playerName);
+ if (val == 1) // Send complete
{
- if (data->field_19 == 5)
+ if (data->joinRequestAnswer == RFU_STATUS_JOIN_GROUP_OK)
{
- data->field_0->arr[data->field_13].field_1B = 0;
+ data->field_0->arr[data->playerCount].field_1B = 0;
RedrawListMenu(data->listTaskId);
- data->field_13++;
- sub_8018404(gStringVar1, &data->field_0->arr[data->field_13 - 1]);
+ data->playerCount++;
+ IntlConvPartnerUname7(gStringVar1, &data->field_0->arr[data->playerCount - 1]);
StringExpandPlaceholders(gStringVar4, sText_AnOKWasSentToPlayer);
data->state = 9;
- sub_800EF38();
+ LinkRfu_StopManagerAndFinalizeSlots();
}
else
{
- sub_8011DC0(data->field_0->arr[data->field_13].unk.playerName, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId));
- data->field_0->arr[data->field_13].field_1A_0 = 0;
+ RequestDisconnectSlotByTrainerNameAndId(data->field_0->arr[data->playerCount].gname_uname.playerName, ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.unk_00.playerTrainerId));
+ data->field_0->arr[data->playerCount].groupScheduledAnim = UNION_ROOM_SPAWN_NONE;
sub_8013398(data->field_0);
RedrawListMenu(data->listTaskId);
data->state = 2;
}
- data->field_19 = 0;
+ data->joinRequestAnswer = 0;
}
- else if (val == 2)
+ else if (val == 2) // Member disconnected
{
- sub_8011A64(0, 0);
+ RfuSetStatus(RFU_STATUS_OK, 0);
data->state = 2;
}
break;
@@ -1795,17 +1962,17 @@ void sub_8014A40(u8 taskId)
data->state = 10;
break;
case 10:
- if (++data->field_E > 120)
+ if (++data->delayTimerAfterOk > 120)
data->state = 11;
break;
case 11:
- if (!sub_801320C(data, 5, 6))
+ if (!Leader_SetStateIfMemberListChanged(data, 5, 6))
data->state = 12;
break;
case 12:
- if (sub_800EF1C())
+ if (LmanAcceptSlotFlagIsNotZero())
{
- sub_800EF58(FALSE);
+ WaitRfuState(FALSE);
data->state = 15;
}
else
@@ -1815,11 +1982,11 @@ void sub_8014A40(u8 taskId)
break;
case 13:
DestroyWirelessStatusIndicatorSprite();
- sub_800EDD4();
+ LinkRfu_Shutdown();
DestroyListMenuTask(data->listTaskId, 0, 0);
CopyBgTilemapBufferToVram(0);
RemoveWindow(data->listWindowId);
- DestroyTask(data->field_17);
+ DestroyTask(data->listenTaskId);
Free(data->field_8);
Free(data->field_0);
Free(data->field_4);
@@ -1829,17 +1996,17 @@ void sub_8014A40(u8 taskId)
if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, sText_PleaseStartOver))
{
DestroyTask(taskId);
- gSpecialVar_Result = 5;
+ gSpecialVar_Result = LINKUP_FAILED;
}
break;
case 15:
- if (sub_8011A74() == 1 || sub_8011A74() == 2)
+ if (RfuGetStatus() == RFU_STATUS_FATAL_ERROR || RfuGetStatus() == RFU_STATUS_CONNECTION_ERROR)
{
data->state = 13;
}
else if (gReceivedRemoteLinkPlayers != 0)
{
- sub_8011068(1);
+ UpdateGameData_GroupLockedIn(TRUE);
data->state++;
}
break;
@@ -1847,7 +2014,7 @@ void sub_8014A40(u8 taskId)
DestroyListMenuTask(data->listTaskId, 0, 0);
CopyBgTilemapBufferToVram(0);
RemoveWindow(data->listWindowId);
- DestroyTask(data->field_17);
+ DestroyTask(data->listenTaskId);
Free(data->field_8);
Free(data->field_0);
Free(data->field_4);
@@ -1861,36 +2028,36 @@ void sub_8014A40(u8 taskId)
}
}
-void MEvent_CreateTask_CardOrNewsWithFriend(u32 arg0)
+void MEvent_CreateTask_CardOrNewsWithFriend(u32 activity)
{
u8 taskId;
- struct UnkStruct_Group *dataPtr;
+ struct WirelessLink_Group *data;
- taskId = CreateTask(sub_8014F48, 0);
- gUnknown_02022C30.group = dataPtr = (void*)(gTasks[taskId].data);
- gUnknown_03000DA4 = dataPtr;
+ taskId = CreateTask(Task_CardOrNewsWithFriend, 0);
+ sWirelessLinkMain.group = data = (void*)(gTasks[taskId].data);
+ sGroup = data;
- dataPtr->state = 0;
- dataPtr->textState = 0;
- dataPtr->field_12 = arg0 - 21;
- gSpecialVar_Result = 0;
+ data->state = 0;
+ data->textState = 0;
+ data->isWonderNews = activity - ACTIVITY_WONDER_CARD2;
+ gSpecialVar_Result = LINKUP_ONGOING;
}
-void sub_8014F48(u8 taskId)
+static void Task_CardOrNewsWithFriend(u8 taskId)
{
s32 id;
struct WindowTemplate winTemplate1, winTemplate2;
- struct UnkStruct_Group *data = gUnknown_02022C30.group;
+ struct WirelessLink_Group *data = sWirelessLinkMain.group;
switch (data->state)
{
case 0:
- sub_8010F84(data->field_12 + 21, 0, 0);
- sub_800B488();
+ SetHostRFUtgtGname(data->isWonderNews + ACTIVITY_WONDER_CARD2, 0, 0);
+ SetWirelessCommType1();
OpenLink();
- sub_8011C5C();
- data->field_4 = AllocZeroed(0x70);
- data->field_0 = AllocZeroed(0x200);
+ InitializeRfuLinkManager_JoinGroup();
+ data->field_4 = AllocZeroed(4 * sizeof(struct UnkStruct_x1C));
+ data->field_0 = AllocZeroed(16 * sizeof(struct UnkStruct_x20));
data->state = 1;
break;
case 1:
@@ -1898,9 +2065,9 @@ void sub_8014F48(u8 taskId)
data->state = 2;
break;
case 2:
- sub_80175EC(data->field_4, 4);
- sub_8017580(data->field_0->arr, 16);
- data->field_11 = sub_8016FC0(data->field_4, data->field_12 + 7);
+ ClearUnkStruct_x1CArray(data->field_4, 4);
+ ClearUnkStruct_x20Array(data->field_0->arr, 16);
+ data->listenTaskId = CreateTask_ListenForPartnersWithCompatibleSerialNos(data->field_4, data->isWonderNews + LINK_GROUP_WONDER_CARD);
winTemplate1 = gUnknown_082F0174;
winTemplate1.baseBlock = GetMysteryGiftBaseBlock();
@@ -1909,25 +2076,25 @@ void sub_8014F48(u8 taskId)
winTemplate2 = gUnknown_082F017C;
winTemplate2.paletteNum = 0xC;
- data->field_D = AddWindow(&winTemplate2);
+ data->playerNameAndIdWindowId = AddWindow(&winTemplate2);
MG_DrawTextBorder(data->listWindowId);
- gMultiuseListMenuTemplate = gUnknown_082F0204;
+ gMultiuseListMenuTemplate = sListMenuTemplate_UnionRoomGroups;
gMultiuseListMenuTemplate.windowId = data->listWindowId;
data->listTaskId = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0);
- MG_DrawTextBorder(data->field_D);
- FillWindowPixelBuffer(data->field_D, PIXEL_FILL(1));
- PutWindowTilemap(data->field_D);
- sub_80125BC(data->field_D);
- CopyWindowToVram(data->field_D, 2);
+ MG_DrawTextBorder(data->playerNameAndIdWindowId);
+ FillWindowPixelBuffer(data->playerNameAndIdWindowId, PIXEL_FILL(1));
+ PutWindowTilemap(data->playerNameAndIdWindowId);
+ PrintPlayerNameAndIdOnWindow(data->playerNameAndIdWindowId);
+ CopyWindowToVram(data->playerNameAndIdWindowId, 2);
CopyBgTilemapBufferToVram(0);
- data->field_F = 0;
+ data->leaderId = 0;
data->state = 3;
break;
case 3:
- id = sub_8013E44();
+ id = GetNewLeaderCandidate();
switch (id)
{
case 1:
@@ -1941,16 +2108,16 @@ void sub_8014F48(u8 taskId)
{
// this unused variable along with the assignment is needed to match
u32 unusedVar;
- unusedVar = data->field_0->arr[id].unk.field_0.activity;
+ unusedVar = data->field_0->arr[id].gname_uname.gname.activity;
- if (data->field_0->arr[id].field_1A_0 == 1 && !data->field_0->arr[id].unk.field_0.started)
+ if (data->field_0->arr[id].groupScheduledAnim == UNION_ROOM_SPAWN_IN && !data->field_0->arr[id].gname_uname.gname.started)
{
- data->field_F = id;
+ data->leaderId = id;
LoadWirelessStatusIndicatorSpriteGfx();
CreateWirelessStatusIndicatorSprite(0, 0);
RedrawListMenu(data->listTaskId);
- sub_8018404(gStringVar1, &data->field_0->arr[data->field_F]);
- sub_8011FC8(data->field_0->arr[data->field_F].unk.playerName, ReadAsU16(data->field_0->arr[data->field_F].unk.field_0.unk_00.playerTrainerId));
+ IntlConvPartnerUname7(gStringVar1, &data->field_0->arr[data->leaderId]);
+ CreateTask_RfuReconnectWithParent(data->field_0->arr[data->leaderId].gname_uname.playerName, ReadAsU16(data->field_0->arr[data->leaderId].gname_uname.gname.unk_00.playerTrainerId));
PlaySE(SE_PN_ON);
data->state = 4;
}
@@ -1968,26 +2135,26 @@ void sub_8014F48(u8 taskId)
break;
case 4:
AddTextPrinterToWindow1(sText_AwaitingPlayersResponse);
- sub_8018404(gStringVar1, &data->field_0->arr[data->field_F]);
+ IntlConvPartnerUname7(gStringVar1, &data->field_0->arr[data->leaderId]);
data->state = 5;
break;
case 5:
- if (gReceivedRemoteLinkPlayers != 0)
+ if (gReceivedRemoteLinkPlayers)
{
- gUnknown_02022C2C = data->field_0->arr[data->field_F].unk.field_0.activity;
+ gPlayerCurrActivity = data->field_0->arr[data->leaderId].gname_uname.gname.activity;
data->state = 10;
}
- switch (sub_8011A74())
+ switch (RfuGetStatus())
{
- case 1:
- case 2:
- case 6:
+ case RFU_STATUS_FATAL_ERROR:
+ case RFU_STATUS_CONNECTION_ERROR:
+ case RFU_STATUS_JOIN_GROUP_NO:
data->state = 8;
break;
- case 5:
+ case RFU_STATUS_JOIN_GROUP_OK:
AddTextPrinterToWindow1(sText_PlayerSentBackOK);
- sub_8011A64(0, 0);
+ RfuSetStatus(RFU_STATUS_OK, 0);
break;
}
break;
@@ -1996,28 +2163,28 @@ void sub_8014F48(u8 taskId)
case 10:
DestroyListMenuTask(data->listTaskId, 0, 0);
CopyBgTilemapBufferToVram(0);
- RemoveWindow(data->field_D);
+ RemoveWindow(data->playerNameAndIdWindowId);
RemoveWindow(data->listWindowId);
- DestroyTask(data->field_11);
+ DestroyTask(data->listenTaskId);
Free(data->field_0);
Free(data->field_4);
data->state++;
break;
case 9:
- if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, sLinkDroppedTexts[sub_8011A74()]))
+ if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, sLinkDroppedTexts[RfuGetStatus()]))
{
DestroyWirelessStatusIndicatorSprite();
DestroyTask(taskId);
- sub_800EDD4();
- gSpecialVar_Result = 5;
+ LinkRfu_Shutdown();
+ gSpecialVar_Result = LINKUP_FAILED;
}
break;
case 7:
DestroyWirelessStatusIndicatorSprite();
AddTextPrinterToWindow1(sText_PleaseStartOver);
DestroyTask(taskId);
- sub_800EDD4();
- gSpecialVar_Result = 5;
+ LinkRfu_Shutdown();
+ gSpecialVar_Result = LINKUP_FAILED;
break;
case 11:
data->state++;
@@ -2030,36 +2197,36 @@ void sub_8014F48(u8 taskId)
}
}
-void MEvent_CreateTask_CardOrNewsOverWireless(u32 arg0)
+void MEvent_CreateTask_CardOrNewsOverWireless(u32 activity)
{
u8 taskId;
- struct UnkStruct_Group *dataPtr;
+ struct WirelessLink_Group *data;
- taskId = CreateTask(sub_80152F4, 0);
- gUnknown_02022C30.group = dataPtr = (void*)(gTasks[taskId].data);
- gUnknown_03000DA4 = dataPtr;
+ taskId = CreateTask(Task_CardOrNewsOverWireless, 0);
+ sWirelessLinkMain.group = data = (void*)(gTasks[taskId].data);
+ sGroup = data;
- dataPtr->state = 0;
- dataPtr->textState = 0;
- dataPtr->field_12 = arg0 - 21;
- gSpecialVar_Result = 0;
+ data->state = 0;
+ data->textState = 0;
+ data->isWonderNews = activity - ACTIVITY_WONDER_CARD2;
+ gSpecialVar_Result = LINKUP_ONGOING;
}
-void sub_80152F4(u8 taskId)
+static void Task_CardOrNewsOverWireless(u8 taskId)
{
s32 id;
struct WindowTemplate winTemplate;
- struct UnkStruct_Group *data = gUnknown_02022C30.group;
+ struct WirelessLink_Group *data = sWirelessLinkMain.group;
switch (data->state)
{
case 0:
- sub_8010F84(0, 0, 0);
- sub_800B488();
+ SetHostRFUtgtGname(0, 0, 0);
+ SetWirelessCommType1();
OpenLink();
- sub_8011C5C();
- data->field_4 = AllocZeroed(0x70);
- data->field_0 = AllocZeroed(0x200);
+ InitializeRfuLinkManager_JoinGroup();
+ data->field_4 = AllocZeroed(4 * sizeof(struct UnkStruct_x1C));
+ data->field_0 = AllocZeroed(16 * sizeof(struct UnkStruct_x20));
data->state = 1;
break;
case 1:
@@ -2067,9 +2234,9 @@ void sub_80152F4(u8 taskId)
data->state = 2;
break;
case 2:
- sub_80175EC(data->field_4, 4);
- sub_8017580(data->field_0->arr, 16);
- data->field_11 = sub_8016FF0(data->field_4, data->field_12 + 7);
+ ClearUnkStruct_x1CArray(data->field_4, 4);
+ ClearUnkStruct_x20Array(data->field_0->arr, 16);
+ data->listenTaskId = CreateTask_ListenForPartnersWithSerial7F7D(data->field_4, data->isWonderNews + LINK_GROUP_WONDER_CARD);
if (data->field_13 != 0)
{
@@ -2078,18 +2245,18 @@ void sub_80152F4(u8 taskId)
data->listWindowId = AddWindow(&winTemplate);
MG_DrawTextBorder(data->listWindowId);
- gMultiuseListMenuTemplate = gUnknown_082F0204;
+ gMultiuseListMenuTemplate = sListMenuTemplate_UnionRoomGroups;
gMultiuseListMenuTemplate.windowId = data->listWindowId;
data->listTaskId = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0);
CopyBgTilemapBufferToVram(0);
}
- data->field_F = 0;
+ data->leaderId = 0;
data->state = 3;
break;
case 3:
- id = sub_8013E44();
+ id = GetNewLeaderCandidate();
switch (id)
{
case 1:
@@ -2101,17 +2268,17 @@ void sub_80152F4(u8 taskId)
case 0:
if (data->field_13 != 0)
id = ListMenu_ProcessInput(data->listTaskId);
- if (data->field_14 > 120)
+ if (data->refreshTimer > 120)
{
- if (data->field_0->arr[0].field_1A_0 == 1 && !data->field_0->arr[0].unk.field_0.started)
+ if (data->field_0->arr[0].groupScheduledAnim == UNION_ROOM_SPAWN_IN && !data->field_0->arr[0].gname_uname.gname.started)
{
- if (sub_8016F1C(&data->field_0->arr[0].unk.field_0, data->field_12 + 7))
+ if (HasWonderCardOrNewsByLinkGroup(&data->field_0->arr[0].gname_uname.gname, data->isWonderNews + LINK_GROUP_WONDER_CARD))
{
- data->field_F = 0;
- data->field_14 = 0;
+ data->leaderId = 0;
+ data->refreshTimer = 0;
LoadWirelessStatusIndicatorSpriteGfx();
CreateWirelessStatusIndicatorSprite(0, 0);
- sub_8011FC8(data->field_0->arr[0].unk.playerName, ReadAsU16(data->field_0->arr[0].unk.field_0.unk_00.playerTrainerId));
+ CreateTask_RfuReconnectWithParent(data->field_0->arr[0].gname_uname.playerName, ReadAsU16(data->field_0->arr[0].gname_uname.gname.unk_00.playerTrainerId));
PlaySE(SE_PN_ON);
data->state = 4;
}
@@ -2125,34 +2292,34 @@ void sub_80152F4(u8 taskId)
else if (gMain.newKeys & B_BUTTON)
{
data->state = 6;
- data->field_14 = 0;
+ data->refreshTimer = 0;
}
- data->field_14++;
+ data->refreshTimer++;
break;
}
break;
case 4:
AddTextPrinterToWindow1(sText_AwaitingResponseFromWirelessSystem);
- sub_8018404(gStringVar1, &data->field_0->arr[data->field_F]);
+ IntlConvPartnerUname7(gStringVar1, &data->field_0->arr[data->leaderId]);
data->state = 5;
break;
case 5:
- if (gReceivedRemoteLinkPlayers != 0)
+ if (gReceivedRemoteLinkPlayers)
{
- gUnknown_02022C2C = data->field_0->arr[data->field_F].unk.field_0.activity;
+ gPlayerCurrActivity = data->field_0->arr[data->leaderId].gname_uname.gname.activity;
data->state = 12;
}
- switch (sub_8011A74())
+ switch (RfuGetStatus())
{
- case 1:
- case 2:
- case 6:
+ case RFU_STATUS_FATAL_ERROR:
+ case RFU_STATUS_CONNECTION_ERROR:
+ case RFU_STATUS_JOIN_GROUP_NO:
data->state = 8;
break;
- case 5:
+ case RFU_STATUS_JOIN_GROUP_OK:
AddTextPrinterToWindow1(sText_WirelessLinkEstablished);
- sub_8011A64(0, 0);
+ RfuSetStatus(RFU_STATUS_OK, 0);
break;
}
break;
@@ -2166,7 +2333,7 @@ void sub_80152F4(u8 taskId)
CopyBgTilemapBufferToVram(0);
RemoveWindow(data->listWindowId);
}
- DestroyTask(data->field_11);
+ DestroyTask(data->listenTaskId);
Free(data->field_0);
Free(data->field_4);
data->state++;
@@ -2176,8 +2343,8 @@ void sub_80152F4(u8 taskId)
{
DestroyWirelessStatusIndicatorSprite();
DestroyTask(taskId);
- sub_800EDD4();
- gSpecialVar_Result = 5;
+ LinkRfu_Shutdown();
+ gSpecialVar_Result = LINKUP_FAILED;
}
break;
case 7:
@@ -2185,17 +2352,17 @@ void sub_80152F4(u8 taskId)
{
DestroyWirelessStatusIndicatorSprite();
DestroyTask(taskId);
- sub_800EDD4();
- gSpecialVar_Result = 5;
+ LinkRfu_Shutdown();
+ gSpecialVar_Result = LINKUP_FAILED;
}
break;
case 11:
- if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, sNoWonderSharedTexts[data->field_12]))
+ if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, sNoWonderSharedTexts[data->isWonderNews]))
{
DestroyWirelessStatusIndicatorSprite();
DestroyTask(taskId);
- sub_800EDD4();
- gSpecialVar_Result = 5;
+ LinkRfu_Shutdown();
+ gSpecialVar_Result = LINKUP_FAILED;
}
break;
case 13:
@@ -2209,172 +2376,172 @@ void sub_80152F4(u8 taskId)
}
}
-void UnionRoomSpecial(void)
+void RunUnionRoom(void)
{
- struct UnkStruct_URoom *dataPtr;
+ struct WirelessLink_URoom *uroom;
- sub_8010F60();
- CreateTask(sub_80156E0, 10);
+ ClearAndInitHostRFUtgtGname();
+ CreateTask(Task_RunUnionRoom, 10);
// dumb line needed to match
- gUnknown_02022C30.uRoom = gUnknown_02022C30.uRoom;
+ sWirelessLinkMain.uRoom = sWirelessLinkMain.uRoom;
- dataPtr = AllocZeroed(sizeof(*gUnknown_02022C30.uRoom));
- gUnknown_02022C30.uRoom = dataPtr;
- gUnknown_03000DA8 = dataPtr;
+ uroom = AllocZeroed(sizeof(*sWirelessLinkMain.uRoom));
+ sWirelessLinkMain.uRoom = uroom;
+ sURoom = uroom;
- dataPtr->state = 0;
- dataPtr->textState = 0;
- dataPtr->field_10 = 0;
- dataPtr->field_12 = 0;
+ uroom->state = UR_STATE_INIT;
+ uroom->textState = 0;
+ uroom->unknown = 0;
+ uroom->field_12 = 0;
gSpecialVar_Result = 0;
- sub_819A2BC(0xD0, 1);
+ ListMenuLoadStdPalAt(0xD0, 1);
}
-u16 ReadAsU16(const u8 *ptr)
+static u16 ReadAsU16(const u8 *ptr)
{
return (ptr[1] << 8) | (ptr[0]);
}
-void sub_8015664(u32 nextState, const u8 *src)
+static void ScheduleFieldMessageWithFollowupState(u32 nextState, const u8 *src)
{
- struct UnkStruct_URoom *data = gUnknown_02022C30.uRoom;
+ struct WirelessLink_URoom *uroom = sWirelessLinkMain.uRoom;
- data->state = 8;
- data->stateAfterPrint = nextState;
+ uroom->state = UR_STATE_PRINT_MSG;
+ uroom->stateAfterPrint = nextState;
if (src != gStringVar4)
StringExpandPlaceholders(gStringVar4, src);
}
-void sub_801568C(const u8 *src)
+static void ScheduleFieldMessageAndExit(const u8 *src)
{
- struct UnkStruct_URoom *data = gUnknown_02022C30.uRoom;
+ struct WirelessLink_URoom *uroom = sWirelessLinkMain.uRoom;
- data->state = 26;
+ uroom->state = UR_STATE_PRINT_AND_EXIT;
if (src != gStringVar4)
StringExpandPlaceholders(gStringVar4, src);
}
-void sub_80156B0(struct UnkStruct_URoom *data)
+static void sub_80156B0(struct WirelessLink_URoom *uroom)
{
- memcpy(&gDecompressionBuffer[0x3F00], data->field_0, 0x100);
+ memcpy(&gDecompressionBuffer[0x3F00], uroom->field_0, 0x100);
}
-void sub_80156C8(struct UnkStruct_URoom *data)
+static void sub_80156C8(struct WirelessLink_URoom *uroom)
{
- memcpy(data->field_0, &gDecompressionBuffer[0x3F00], 0x100);
+ memcpy(uroom->field_0, &gDecompressionBuffer[0x3F00], 0x100);
}
-void sub_80156E0(u8 taskId)
+static void Task_RunUnionRoom(u8 taskId)
{
u32 id = 0;
- s32 var5 = 0;
- s32 playerGender = 0;
- struct UnkStruct_URoom *data = gUnknown_02022C30.uRoom;
+ s32 input = 0;
+ s32 playerGender = MALE;
+ struct WirelessLink_URoom *uroom = sWirelessLinkMain.uRoom;
s16 *taskData = gTasks[taskId].data;
- switch (data->state)
+ switch (uroom->state)
{
- case 0:
- data->field_4 = AllocZeroed(0x70);
- data->field_C = AllocZeroed(0x70);
- data->field_0 = AllocZeroed(0x100);
- data->field_8 = AllocZeroed(0x20);
- sub_8017580(data->field_0->arr, 8);
- gUnknown_02022C2C = 0x40;
- data->field_20 = sub_8016DF0(data->field_C, data->field_4, 9);
- sub_8019BA8(data->field_A0);
- sub_8019F2C();
- data->state = 1;
- break;
- case 1:
- sub_8019E70(data->spriteIds, taskData[0]);
+ case UR_STATE_INIT:
+ uroom->field_4 = AllocZeroed(RFU_CHILD_MAX * sizeof(struct UnkStruct_x1C));
+ uroom->field_C = AllocZeroed(RFU_CHILD_MAX * sizeof(struct UnkStruct_x1C));
+ uroom->field_0 = AllocZeroed(8 * sizeof(struct UnkStruct_x20));
+ uroom->field_8 = AllocZeroed(sizeof(struct UnkStruct_x20));
+ ClearUnkStruct_x20Array(uroom->field_0->arr, ARRAY_COUNT(uroom->field_0->arr));
+ gPlayerCurrActivity = IN_UNION_ROOM;
+ uroom->searchTaskId = CreateTask_SearchForChildOrParent(uroom->field_C, uroom->field_4, LINK_GROUP_UNION_ROOM_RESUME);
+ InitUnionRoomPlayerObjects(uroom->objects);
+ SetTilesAroundUnionRoomPlayersPassable();
+ uroom->state = UR_STATE_INIT_OBJECTS;
+ break;
+ case UR_STATE_INIT_OBJECTS:
+ CreateGroupMemberSpritesInvisible(uroom->spriteIds, taskData[0]);
if (++taskData[0] == 8)
- data->state = 2;
+ uroom->state = UR_STATE_INIT_LINK;
break;
- case 2:
- sub_8010F84(0x40, 0, 0);
- sub_8010FCC(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel);
- sub_800B488();
+ case UR_STATE_INIT_LINK:
+ SetHostRFUtgtGname(IN_UNION_ROOM, 0, 0);
+ SetTradeBoardRegisteredMonInfo(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel);
+ SetWirelessCommType1();
OpenLink();
- sub_8011C84();
- sub_8017580(&data->field_8->arr[0], 1);
- sub_80175EC(data->field_4, 4);
- sub_80175EC(data->field_C, 4);
+ InitializeRfuLinkManager_EnterUnionRoom();
+ ClearUnkStruct_x20Array(&uroom->field_8->arr[0], 1);
+ ClearUnkStruct_x1CArray(uroom->field_4, 4);
+ ClearUnkStruct_x1CArray(uroom->field_C, 4);
gSpecialVar_Result = 0;
- data->state = 3;
+ uroom->state = UR_STATE_CHECK_SELECTING_MON;
break;
- case 3:
+ case UR_STATE_CHECK_SELECTING_MON:
if ((GetPartyMenuType() == PARTY_MENU_TYPE_UNION_ROOM_REGISTER
- || GetPartyMenuType() == PARTY_MENU_TYPE_UNION_ROOM_TRADE)
- && sUnionRoomTrade.field_0 != 0)
+ || GetPartyMenuType() == PARTY_MENU_TYPE_UNION_ROOM_TRADE)
+ && sUnionRoomTrade.state != URTRADE_STATE_NONE)
{
id = GetCursorSelectionMonId();
- switch (sUnionRoomTrade.field_0)
+ switch (sUnionRoomTrade.state)
{
- case 1:
- sub_8011090(0x54, 0, 1);
+ case URTRADE_STATE_REGISTERING:
+ UpdateGameData_SetActivity(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
if (id >= PARTY_SIZE)
{
ResetUnionRoomTrade(&sUnionRoomTrade);
- sub_8010FCC(0, 0, 0);
- sub_801568C(sText_RegistrationCanceled);
+ SetTradeBoardRegisteredMonInfo(TYPE_NORMAL, SPECIES_NONE, 0);
+ ScheduleFieldMessageAndExit(sText_RegistrationCanceled);
}
else if (!RegisterTradeMonAndGetIsEgg(GetCursorSelectionMonId(), &sUnionRoomTrade))
{
- sub_8015664(0x34, sText_ChooseRequestedMonType);
+ ScheduleFieldMessageWithFollowupState(UR_STATE_REGISTER_REQUEST_TYPE, sText_ChooseRequestedMonType);
}
else
{
- data->state = 55;
+ uroom->state = UR_STATE_REGISTER_COMPLETE;
}
break;
- case 2:
- sub_80156C8(data);
- taskData[1] = sUnionRoomTrade.field_8;
+ case URTRADE_STATE_OFFERING:
+ sub_80156C8(uroom);
+ taskData[1] = sUnionRoomTrade.offerPlayerId;
if (id >= PARTY_SIZE)
{
- sub_801568C(sText_TradeCanceled);
+ ScheduleFieldMessageAndExit(sText_TradeCanceled);
}
else
{
- sub_8011090(0x54, 0, 1);
- gUnknown_02022C2C = 0x44;
+ UpdateGameData_SetActivity(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
+ gPlayerCurrActivity = ACTIVITY_TRADE | IN_UNION_ROOM;
RegisterTradeMon(GetCursorSelectionMonId(), &sUnionRoomTrade);
- data->state = 51;
+ uroom->state = UR_STATE_TRADE_OFFER_MON;
}
break;
}
- sUnionRoomTrade.field_0 = 0;
+ sUnionRoomTrade.state = URTRADE_STATE_NONE;
}
else
{
- data->state = 4;
+ uroom->state = UR_STATE_MAIN;
}
break;
- case 4:
+ case UR_STATE_MAIN:
if (gSpecialVar_Result != 0)
{
- if (gSpecialVar_Result == 9)
+ if (gSpecialVar_Result == UR_INTERACT_ATTENDANT)
{
- sub_8011090(0x54, 0, 1);
+ UpdateGameData_SetActivity(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
PlaySE(SE_PC_LOGIN);
StringCopy(gStringVar1, gSaveBlock2Ptr->playerName);
- data->state = 42;
+ uroom->state = UR_STATE_INTERACT_WITH_ATTENDANT;
gSpecialVar_Result = 0;
}
- else if (gSpecialVar_Result == 11)
+ else if (gSpecialVar_Result == UR_INTERACT_START_MENU)
{
- sub_8011090(0x54, 0, 1);
- data->state = 23;
+ UpdateGameData_SetActivity(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
+ uroom->state = UR_STATE_WAIT_FOR_START_MENU;
gSpecialVar_Result = 0;
}
- else
+ else // UR_INTERACT_PLAYER_# (1-8)
{
taskData[0] = 0;
taskData[1] = gSpecialVar_Result - 1;
- data->state = 24;
+ uroom->state = UR_STATE_INTERACT_WITH_PLAYER;
gSpecialVar_Result = 0;
}
}
@@ -2382,676 +2549,688 @@ void sub_80156E0(u8 taskId)
{
if (gMain.newKeys & A_BUTTON)
{
- if (sub_801A2A8(data->field_0, &taskData[0], &taskData[1], data->spriteIds))
+ if (TryInteractWithUnionRoomMember(uroom->field_0, &taskData[0], &taskData[1], uroom->spriteIds))
{
PlaySE(SE_SELECT);
- sub_80181CC();
- data->state = 24;
+ UR_EnableScriptContext2AndFreezeObjectEvents();
+ uroom->state = UR_STATE_INTERACT_WITH_PLAYER;
break;
}
- else if (sub_8017940())
+ else if (IsPlayerFacingTradingBoard())
{
- sub_8011090(0x54, 0, 1);
+ UpdateGameData_SetActivity(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
PlaySE(SE_PC_LOGIN);
- sub_80181CC();
+ UR_EnableScriptContext2AndFreezeObjectEvents();
StringCopy(gStringVar1, gSaveBlock2Ptr->playerName);
- data->state = 45;
+ uroom->state = UR_STATE_CHECK_TRADING_BOARD;
break;
}
}
- switch (sub_8016B00())
+ switch (HandlePlayerListUpdate())
{
case 1:
PlaySE(SE_PC_LOGIN);
case 2:
- sub_801A274(data);
+ ScheduleUnionRoomPlayerRefresh(uroom);
break;
case 4:
- data->state = 11;
- sub_80181CC();
- sub_8010FCC(0, 0, 0);
- sub_8011090(0x53, sub_80181DC(data), 0);
+ uroom->state = UR_STATE_PLAYER_CONTACTED_YOU;
+ UR_EnableScriptContext2AndFreezeObjectEvents();
+ SetTradeBoardRegisteredMonInfo(TYPE_NORMAL, SPECIES_NONE, 0);
+ UpdateGameData_SetActivity(ACTIVITY_NPCTALK | IN_UNION_ROOM, GetActivePartnerSpriteGenderParam(uroom), FALSE);
break;
}
- sub_801A284(data);
+ HandleUnionRoomPlayerRefresh(uroom);
}
break;
- case 23:
+ case UR_STATE_WAIT_FOR_START_MENU:
if (!FuncIsActiveTask(Task_ShowStartMenu))
{
- sub_8011090(0x40, 0, 0);
- data->state = 4;
+ UpdateGameData_SetActivity(ACTIVITY_NONE | IN_UNION_ROOM, 0, FALSE);
+ uroom->state = UR_STATE_MAIN;
}
break;
- case 24:
- sub_801704C();
- playerGender = sub_8017CF8(taskData[1], data->field_0);
- sub_8011090(0x54, 0, 1);
- switch (sub_80179D4(data->field_0, taskData[0], taskData[1], playerGender))
+ case UR_STATE_INTERACT_WITH_PLAYER:
+ UR_RunTextPrinters_CheckPrinter0Active();
+ playerGender = GetUnionRoomPlayerGender(taskData[1], uroom->field_0);
+ UpdateGameData_SetActivity(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
+ switch (UnionRoomGetPlayerInteractionResponse(uroom->field_0, taskData[0], taskData[1], playerGender))
{
- case 0:
- data->state = 26;
+ case 0: // Player is or was just doing an activity
+ uroom->state = UR_STATE_PRINT_AND_EXIT;
break;
- case 1:
- sub_8012188(data->field_0->arr[taskData[1]].unk.playerName, &data->field_0->arr[taskData[1]].unk.field_0, gUnknown_02022C2C);
- data->field_12 = id; // Should be just 0, but won't match any other way.
- data->state = 25;
+ case 1: // Link communicating
+ sub_8012188(uroom->field_0->arr[taskData[1]].gname_uname.playerName, &uroom->field_0->arr[taskData[1]].gname_uname.gname, gPlayerCurrActivity);
+ uroom->field_12 = id; // Should be just 0, but won't match any other way.
+ uroom->state = UR_STATE_TRY_COMMUNICATING;
break;
- case 2:
- sub_8015664(0x13, gStringVar4);
+ case 2: // Ask to join chat
+ ScheduleFieldMessageWithFollowupState(UR_STATE_RECV_JOIN_CHAT_REQUEST, gStringVar4);
break;
}
break;
- case 25:
- sub_801704C();
- switch (sub_8011A74())
+ case UR_STATE_TRY_COMMUNICATING:
+ UR_RunTextPrinters_CheckPrinter0Active();
+ switch (RfuGetStatus())
{
- case 4:
- sub_801818C(TRUE);
- data->state = 4;
+ case RFU_STATUS_NEW_CHILD_DETECTED:
+ HandleCancelActivity(TRUE);
+ uroom->state = UR_STATE_MAIN;
break;
- case 1:
- case 2:
- if (sub_8011B90() == TRUE)
- sub_801568C(sText_TrainerAppearsBusy);
+ case RFU_STATUS_FATAL_ERROR:
+ case RFU_STATUS_CONNECTION_ERROR:
+ if (IsUnionRoomListenTaskActive() == TRUE)
+ ScheduleFieldMessageAndExit(sText_TrainerAppearsBusy);
else
- sub_8015664(30, sText_TrainerAppearsBusy);
+ ScheduleFieldMessageWithFollowupState(UR_STATE_CANCEL_ACTIVITY_LINK_ERROR, sText_TrainerAppearsBusy);
- gUnknown_02022C2C = 0x40;
+ gPlayerCurrActivity = IN_UNION_ROOM;
break;
}
- if (gReceivedRemoteLinkPlayers != 0)
+ if (gReceivedRemoteLinkPlayers)
{
- sub_80143E4(gBlockSendBuffer, TRUE);
- CreateTask(sub_80140E0, 5);
- data->state = 38;
+ CreateTrainerCardInBuffer(gBlockSendBuffer, TRUE);
+ CreateTask(Task_ExchangeCards, 5);
+ uroom->state = UR_STATE_COMMUNICATING_WAIT_FOR_DATA;
}
break;
- case 38:
- if (!FuncIsActiveTask(sub_80140E0))
+ case UR_STATE_COMMUNICATING_WAIT_FOR_DATA:
+ if (!FuncIsActiveTask(Task_ExchangeCards))
{
- if (gUnknown_02022C2C == 0x44)
- sub_8015664(31, sText_AwaitingPlayersResponseAboutTrade);
+ if (gPlayerCurrActivity == (ACTIVITY_TRADE | IN_UNION_ROOM))
+ ScheduleFieldMessageWithFollowupState(UR_STATE_SEND_TRADE_REQUST, sText_AwaitingPlayersResponseAboutTrade);
else
- data->state = 5;
+ uroom->state = UR_STATE_DO_SOMETHING_PROMPT;
}
break;
- case 30:
- if (gReceivedRemoteLinkPlayers == 0)
+ case UR_STATE_CANCEL_ACTIVITY_LINK_ERROR:
+ if (!gReceivedRemoteLinkPlayers)
{
- sub_801818C(FALSE);
- sub_801A3D0(taskData[0], taskData[1], data->field_0);
- data->state = 2;
+ HandleCancelActivity(FALSE);
+ UpdateUnionRoomMemberFacing(taskData[0], taskData[1], uroom->field_0);
+ uroom->state = UR_STATE_INIT_LINK;
}
break;
- case 5:
- id = sub_80179AC(&data->field_0->arr[taskData[1]]);
- playerGender = sub_8017CF8(taskData[1], data->field_0);
- sub_8015664(6, sHiDoSomethingTexts[id][playerGender]);
+ case UR_STATE_DO_SOMETHING_PROMPT:
+ id = ConvPartnerUnameAndGetWhetherMetAlready(&uroom->field_0->arr[taskData[1]]);
+ playerGender = GetUnionRoomPlayerGender(taskData[1], uroom->field_0);
+ ScheduleFieldMessageWithFollowupState(UR_STATE_HANDLE_DO_SOMETHING_PROMPT_INPUT, sHiDoSomethingTexts[id][playerGender]);
break;
- case 6:
- var5 = sub_8017178(&data->textState, &data->field_1B, &data->field_1C, &gUnknown_082F021C, &gUnknown_082F0244);
- if (var5 != -1)
+ case UR_STATE_HANDLE_DO_SOMETHING_PROMPT_INPUT:
+ input = ListMenuHandler_AllItemsAvailable(&uroom->textState,
+ &uroom->topListMenuWindowId,
+ &uroom->topListMenuId,
+ &sWindowTemplate_InviteToActivity,
+ &sListMenuTemplate_InviteToActivity);
+ if (input != -1)
{
- if (gReceivedRemoteLinkPlayers == 0)
+ if (!gReceivedRemoteLinkPlayers)
{
- data->state = 28;
+ uroom->state = UR_STATE_TRAINER_APPEARS_BUSY;
}
else
{
- data->field_98 = 0;
- playerGender = sub_8017CF8(taskData[1], data->field_0);
- if (var5 == -2 || var5 == 0x40)
+ uroom->partnerYesNoResponse = 0;
+ playerGender = GetUnionRoomPlayerGender(taskData[1], uroom->field_0);
+ if (input == -2 || input == IN_UNION_ROOM)
{
- data->field_4C[0] = 0x40;
- sub_800FE50(data->field_4C);
+ uroom->playerSendBuffer[0] = IN_UNION_ROOM;
+ sub_800FE50(uroom->playerSendBuffer);
StringCopy(gStringVar4, sIfYouWantToDoSomethingTexts[gLinkPlayers[0].gender]);
- data->state = 32;
+ uroom->state = UR_STATE_REQUEST_DECLINED;
}
else
{
- gUnknown_02022C2C = var5;
- gUnknown_02022C2D = (u32)(var5) >> 8;
- if (gUnknown_02022C2C == 0x41 && !HasAtLeastTwoMonsOfLevel30OrLower())
+ gPlayerCurrActivity = input;
+ sPlayerActivityGroupSize = (u32)(input) >> 8;
+ if (gPlayerCurrActivity == (ACTIVITY_BATTLE_SINGLE | IN_UNION_ROOM) && !HasAtLeastTwoMonsOfLevel30OrLower())
{
- sub_8015664(5, sText_NeedTwoMonsOfLevel30OrLower1);
+ ScheduleFieldMessageWithFollowupState(UR_STATE_DO_SOMETHING_PROMPT, sText_NeedTwoMonsOfLevel30OrLower1);
}
else
{
- data->field_4C[0] = gUnknown_02022C2C | 0x40;
- sub_800FE50(data->field_4C);
- data->state = 27;
+ uroom->playerSendBuffer[0] = gPlayerCurrActivity | IN_UNION_ROOM;
+ sub_800FE50(uroom->playerSendBuffer);
+ uroom->state = UR_STATE_SEND_ACTIVITY_REQUEST;
}
}
}
}
break;
- case 28:
+ case UR_STATE_TRAINER_APPEARS_BUSY:
StringCopy(gStringVar4, sText_TrainerBattleBusy);
- data->state = 36;
+ uroom->state = UR_STATE_CANCEL_REQUEST_PRINT_MSG;
break;
- case 27:
- sub_8017FD8(data);
- playerGender = sub_8017CF8(taskData[1], data->field_0);
- id = sub_8017984(data->field_4C[0] & 0x3F);
- if (PrintOnTextbox(&data->textState, sText_WaitOrShowCardTexts[playerGender][id]))
+ case UR_STATE_SEND_ACTIVITY_REQUEST:
+ PollPartnerYesNoResponse(uroom);
+ playerGender = GetUnionRoomPlayerGender(taskData[1], uroom->field_0);
+ id = GetResponseIdx_InviteToURoomActivity(uroom->playerSendBuffer[0] & 0x3F);
+ if (PrintOnTextbox(&uroom->textState, sText_WaitOrShowCardTexts[playerGender][id]))
{
taskData[3] = 0;
- data->state = 29;
+ uroom->state = UR_STATE_WAIT_FOR_RESPONSE_TO_REQUEST;
}
break;
- case 32:
+ case UR_STATE_REQUEST_DECLINED:
sub_800AC34();
- data->state = 36;
+ uroom->state = UR_STATE_CANCEL_REQUEST_PRINT_MSG;
break;
- case 31:
- data->field_4C[0] = 0x44;
- data->field_4C[1] = sUnionRoomTrade.species;
- data->field_4C[2] = sUnionRoomTrade.level;
- sub_800FE50(data->field_4C);
- data->state = 29;
+ case UR_STATE_SEND_TRADE_REQUST:
+ uroom->playerSendBuffer[0] = ACTIVITY_TRADE | IN_UNION_ROOM;
+ uroom->playerSendBuffer[1] = sUnionRoomTrade.species;
+ uroom->playerSendBuffer[2] = sUnionRoomTrade.level;
+ sub_800FE50(uroom->playerSendBuffer);
+ uroom->state = UR_STATE_WAIT_FOR_RESPONSE_TO_REQUEST;
break;
- case 29:
- if (gReceivedRemoteLinkPlayers == 0)
+ case UR_STATE_WAIT_FOR_RESPONSE_TO_REQUEST:
+ if (!gReceivedRemoteLinkPlayers)
{
- StringCopy(gStringVar4, sText_TrainerBattleBusy);
- data->state = 28;
+ StringCopy(gStringVar4, sText_TrainerBattleBusy); // Redundant, will be copied again in next state
+ uroom->state = UR_STATE_TRAINER_APPEARS_BUSY;
}
else
{
- sub_8017FD8(data);
- if (data->field_98 == 0x51)
+ PollPartnerYesNoResponse(uroom);
+ if (uroom->partnerYesNoResponse == (ACTIVITY_ACCEPT | IN_UNION_ROOM))
{
- if (gUnknown_02022C2C == 8)
+ if (gPlayerCurrActivity == ACTIVITY_CARD)
{
- sub_8018220(gStringVar4, data, FALSE);
- data->state = 40;
+ ViewURoomPartnerTrainerCard(gStringVar4, uroom, FALSE);
+ uroom->state = UR_STATE_PRINT_CARD_INFO;
}
else
{
- data->state = 13;
+ uroom->state = UR_STATE_PRINT_START_ACTIVITY_MSG;
}
}
- else if (data->field_98 == 0x52)
+ else if (uroom->partnerYesNoResponse == (ACTIVITY_DECLINE | IN_UNION_ROOM))
{
- data->state = 32;
- sub_8017D9C(gStringVar4, gUnknown_02022C2C | 0x40, gLinkPlayers[0].gender);
- gUnknown_02022C2C = 0;
+ uroom->state = UR_STATE_REQUEST_DECLINED;
+ GetURoomActivityRejectMsg(gStringVar4, gPlayerCurrActivity | IN_UNION_ROOM, gLinkPlayers[0].gender);
+ gPlayerCurrActivity = ACTIVITY_NONE;
}
}
break;
- case 7:
- id = sub_80179AC(&data->field_0->arr[taskData[1]]);
- playerGender = sub_8017CF8(taskData[1], data->field_0);
- sub_8015664(6, sHiDoSomethingTexts[id][playerGender]);
+ case UR_STATE_DO_SOMETHING_PROMPT_2: // Identical to UR_STATE_DO_SOMETHING_PROMPT
+ id = ConvPartnerUnameAndGetWhetherMetAlready(&uroom->field_0->arr[taskData[1]]);
+ playerGender = GetUnionRoomPlayerGender(taskData[1], uroom->field_0);
+ ScheduleFieldMessageWithFollowupState(UR_STATE_HANDLE_DO_SOMETHING_PROMPT_INPUT, sHiDoSomethingTexts[id][playerGender]);
break;
- case 40:
- if (PrintOnTextbox(&data->textState, gStringVar4))
+ case UR_STATE_PRINT_CARD_INFO:
+ if (PrintOnTextbox(&uroom->textState, gStringVar4))
{
- data->state = 41;
+ uroom->state = UR_STATE_WAIT_FINISH_READING_CARD;
sub_800ADF8();
- data->field_98 = 0;
- data->field_9A[0] = 0;
+ uroom->partnerYesNoResponse = 0;
+ uroom->recvActivityRequest[0] = 0;
}
break;
- case 41:
+ case UR_STATE_WAIT_FINISH_READING_CARD:
if (IsLinkTaskFinished())
{
if (GetMultiplayerId() == 0)
{
StringCopy(gStringVar1, gLinkPlayers[GetMultiplayerId() ^ 1].name);
- id = sub_800E540(gLinkPlayers[1].trainerId, gLinkPlayers[1].name);
+ id = PlayerHasMetTrainerBefore(gLinkPlayers[1].trainerId, gLinkPlayers[1].name);
StringExpandPlaceholders(gStringVar4, sAwaitingResponseTexts[id]);
- data->state = 33;
+ uroom->state = UR_STATE_PRINT_CONTACT_MSG;
}
else
{
- data->state = 7;
+ uroom->state = UR_STATE_DO_SOMETHING_PROMPT_2;
}
}
break;
- case 19:
- switch (sub_80170B8(&data->textState, FALSE))
+ case UR_STATE_RECV_JOIN_CHAT_REQUEST:
+ switch (UnionRoomHandleYesNo(&uroom->textState, FALSE))
{
- case 0:
+ case 0: // YES
CopyBgTilemapBufferToVram(0);
- gUnknown_02022C2C = 0x45;
- sub_8011090(0x45, 0, 1);
- sub_8012188(data->field_0->arr[taskData[1]].unk.playerName, &data->field_0->arr[taskData[1]].unk.field_0, gUnknown_02022C2C);
- data->field_12 = taskData[1];
- data->state = 20;
+ gPlayerCurrActivity = ACTIVITY_CHAT | IN_UNION_ROOM;
+ UpdateGameData_SetActivity(ACTIVITY_CHAT | IN_UNION_ROOM, 0, TRUE);
+ sub_8012188(uroom->field_0->arr[taskData[1]].gname_uname.playerName, &uroom->field_0->arr[taskData[1]].gname_uname.gname, gPlayerCurrActivity);
+ uroom->field_12 = taskData[1];
+ uroom->state = UR_STATE_TRY_ACCEPT_CHAT_REQUEST_DELAY;
taskData[3] = 0;
break;
- case 1:
+ case 1: // NO
case -1:
- playerGender = sub_8017CF8(taskData[1], data->field_0);
- sub_801568C(sDeclineBattleTexts[playerGender]);
+ playerGender = GetUnionRoomPlayerGender(taskData[1], uroom->field_0);
+ ScheduleFieldMessageAndExit(sDeclineChatTexts[playerGender]);
break;
}
break;
- case 20:
+ case UR_STATE_TRY_ACCEPT_CHAT_REQUEST_DELAY:
if (++taskData[2] > 60)
{
- data->state = 21;
+ uroom->state = UR_STATE_TRY_ACCEPT_CHAT_REQUEST;
taskData[2] = 0;
}
break;
- case 21:
- switch (sub_8011A74())
+ case UR_STATE_TRY_ACCEPT_CHAT_REQUEST:
+ switch (RfuGetStatus())
{
- case 4:
- sub_801818C(TRUE);
- data->state = 4;
+ case RFU_STATUS_NEW_CHILD_DETECTED:
+ HandleCancelActivity(TRUE);
+ uroom->state = UR_STATE_MAIN;
break;
- case 1:
- case 2:
- playerGender = sub_8017CF8(taskData[1], data->field_0);
- sub_8011090(0x54, 0, 1);
- if (sub_8011B90() == TRUE)
- sub_801568C(sChatDeclinedTexts[playerGender]);
+ case RFU_STATUS_FATAL_ERROR:
+ case RFU_STATUS_CONNECTION_ERROR:
+ playerGender = GetUnionRoomPlayerGender(taskData[1], uroom->field_0);
+ UpdateGameData_SetActivity(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
+ if (IsUnionRoomListenTaskActive() == TRUE)
+ ScheduleFieldMessageAndExit(sChatDeclinedTexts[playerGender]);
else
- sub_8015664(30, sChatDeclinedTexts[playerGender]);
+ ScheduleFieldMessageWithFollowupState(UR_STATE_CANCEL_ACTIVITY_LINK_ERROR, sChatDeclinedTexts[playerGender]);
break;
- case 3:
- data->state = 22;
+ case RFU_STATUS_CHILD_SEND_COMPLETE:
+ uroom->state = UR_STATE_ACCEPT_CHAT_REQUEST;
break;
}
taskData[3]++;
break;
- case 22:
- if (sub_8011A80())
+ case UR_STATE_ACCEPT_CHAT_REQUEST:
+ if (RfuHasErrored())
{
- playerGender = sub_8017CF8(taskData[1], data->field_0);
- sub_8011090(0x54, 0, 1);
- if (sub_8011B90() == TRUE)
- sub_801568C(sChatDeclinedTexts[playerGender]);
+ playerGender = GetUnionRoomPlayerGender(taskData[1], uroom->field_0);
+ UpdateGameData_SetActivity(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
+ if (IsUnionRoomListenTaskActive() == TRUE)
+ ScheduleFieldMessageAndExit(sChatDeclinedTexts[playerGender]);
else
- sub_8015664(30, sChatDeclinedTexts[playerGender]);
+ ScheduleFieldMessageWithFollowupState(UR_STATE_CANCEL_ACTIVITY_LINK_ERROR, sChatDeclinedTexts[playerGender]);
}
- if (gReceivedRemoteLinkPlayers != 0)
- data->state = 16;
+ if (gReceivedRemoteLinkPlayers)
+ uroom->state = UR_STATE_START_ACTIVITY_FREE_UROOM;
break;
- case 11:
+ case UR_STATE_PLAYER_CONTACTED_YOU:
PlaySE(SE_PINPON);
sub_800EF7C();
- data->state = 12;
- data->field_9A[0] = 0;
+ uroom->state = UR_STATE_RECV_CONTACT_DATA;
+ uroom->recvActivityRequest[0] = 0;
break;
- case 12:
- if (sub_8011A80())
+ case UR_STATE_RECV_CONTACT_DATA:
+ if (RfuHasErrored())
{
- sub_801818C(FALSE);
- data->state = 2;
+ HandleCancelActivity(FALSE);
+ uroom->state = UR_STATE_INIT_LINK;
}
- else if (gReceivedRemoteLinkPlayers != 0)
+ else if (gReceivedRemoteLinkPlayers)
{
- sub_80143E4(gBlockSendBuffer, TRUE);
- CreateTask(sub_80140E0, 5);
- data->state = 39;
+ CreateTrainerCardInBuffer(gBlockSendBuffer, TRUE);
+ CreateTask(Task_ExchangeCards, 5);
+ uroom->state = UR_STATE_WAIT_FOR_CONTACT_DATA;
}
break;
- case 39:
- sub_801689C(data);
- if (!FuncIsActiveTask(sub_80140E0))
+ case UR_STATE_WAIT_FOR_CONTACT_DATA:
+ ReceiveUnionRoomActivityPacket(uroom);
+ if (!FuncIsActiveTask(Task_ExchangeCards))
{
- data->state = 33;
+ uroom->state = UR_STATE_PRINT_CONTACT_MSG;
StringCopy(gStringVar1, gLinkPlayers[1].name);
- id = sub_800E540(gLinkPlayers[1].trainerId, gLinkPlayers[1].name);
+ id = PlayerHasMetTrainerBefore(gLinkPlayers[1].trainerId, gLinkPlayers[1].name);
StringExpandPlaceholders(gStringVar4, sPlayerContactedYouTexts[id]);
}
break;
- case 33:
- sub_801689C(data);
- if (PrintOnTextbox(&data->textState, gStringVar4))
- data->state = 34;
+ case UR_STATE_PRINT_CONTACT_MSG:
+ ReceiveUnionRoomActivityPacket(uroom);
+ if (PrintOnTextbox(&uroom->textState, gStringVar4))
+ uroom->state = UR_STATE_HANDLE_CONTACT_DATA;
break;
- case 34:
- sub_801689C(data);
- if (sub_80168DC(data) && gMain.newKeys & B_BUTTON)
+ case UR_STATE_HANDLE_CONTACT_DATA:
+ ReceiveUnionRoomActivityPacket(uroom);
+ if (UnionRoom_HandleContactFromOtherPlayer(uroom) && gMain.newKeys & B_BUTTON)
{
sub_8011DE0(1);
StringCopy(gStringVar4, sText_ChatEnded);
- data->state = 36;
+ uroom->state = UR_STATE_CANCEL_REQUEST_PRINT_MSG;
}
break;
- case 35:
- sub_8015664(9, gStringVar4);
+ case UR_STATE_RECV_ACTIVITY_REQUEST:
+ ScheduleFieldMessageWithFollowupState(UR_STATE_HANDLE_ACTIVITY_REQUEST, gStringVar4);
break;
- case 9:
- switch (sub_80170B8(&data->textState, FALSE))
+ case UR_STATE_HANDLE_ACTIVITY_REQUEST:
+ switch (UnionRoomHandleYesNo(&uroom->textState, FALSE))
{
- case 0:
- data->field_4C[0] = 0x51;
- if (gUnknown_02022C2C == 0x45)
- sub_8011090(gUnknown_02022C2C | 0x40, sub_801100C(1), 0);
+ case 0: // ACCEPT
+ uroom->playerSendBuffer[0] = ACTIVITY_ACCEPT | IN_UNION_ROOM;
+ if (gPlayerCurrActivity == (ACTIVITY_CHAT | IN_UNION_ROOM))
+ UpdateGameData_SetActivity(gPlayerCurrActivity | IN_UNION_ROOM, sub_801100C(1), FALSE);
else
- sub_8011090(gUnknown_02022C2C | 0x40, sub_801100C(1), 1);
+ UpdateGameData_SetActivity(gPlayerCurrActivity | IN_UNION_ROOM, sub_801100C(1), TRUE);
- data->field_8->arr[0].field_1B = 0;
+ uroom->field_8->arr[0].field_1B = 0;
taskData[3] = 0;
- if (gUnknown_02022C2C == 0x41)
+ if (gPlayerCurrActivity == (ACTIVITY_BATTLE_SINGLE | IN_UNION_ROOM))
{
if (!HasAtLeastTwoMonsOfLevel30OrLower())
{
- data->field_4C[0] = 0x52;
- sub_800FE50(data->field_4C);
- data->state = 10;
+ uroom->playerSendBuffer[0] = ACTIVITY_DECLINE | IN_UNION_ROOM;
+ sub_800FE50(uroom->playerSendBuffer);
+ uroom->state = UR_STATE_DECLINE_ACTIVITY_REQUEST;
StringCopy(gStringVar4, sText_NeedTwoMonsOfLevel30OrLower2);
}
else
{
- sub_800FE50(data->field_4C);
- data->state = 13;
+ sub_800FE50(uroom->playerSendBuffer);
+ uroom->state = UR_STATE_PRINT_START_ACTIVITY_MSG;
}
}
- else if (gUnknown_02022C2C == 0x48)
+ else if (gPlayerCurrActivity == (ACTIVITY_CARD | IN_UNION_ROOM))
{
- sub_800FE50(data->field_4C);
- sub_8018220(gStringVar4, data, 1);
- data->state = 40;
+ sub_800FE50(uroom->playerSendBuffer);
+ ViewURoomPartnerTrainerCard(gStringVar4, uroom, TRUE);
+ uroom->state = UR_STATE_PRINT_CARD_INFO;
}
else
{
- sub_800FE50(data->field_4C);
- data->state = 13;
+ sub_800FE50(uroom->playerSendBuffer);
+ uroom->state = UR_STATE_PRINT_START_ACTIVITY_MSG;
}
break;
- case 1:
+ case 1: // DECLINE
case -1:
- data->field_4C[0] = 0x52;
- sub_800FE50(data->field_4C);
- data->state = 10;
- sub_8013078(gStringVar4, gUnknown_02022C2C);
+ uroom->playerSendBuffer[0] = ACTIVITY_DECLINE | IN_UNION_ROOM;
+ sub_800FE50(uroom->playerSendBuffer);
+ uroom->state = UR_STATE_DECLINE_ACTIVITY_REQUEST;
+ GetYouDeclinedTheOfferMessage(gStringVar4, gPlayerCurrActivity);
break;
}
break;
- case 10:
+ case UR_STATE_DECLINE_ACTIVITY_REQUEST:
sub_800AC34();
- data->state = 36;
+ uroom->state = UR_STATE_CANCEL_REQUEST_PRINT_MSG;
break;
- case 36:
- if (gReceivedRemoteLinkPlayers == 0)
+ case UR_STATE_CANCEL_REQUEST_PRINT_MSG:
+ if (!gReceivedRemoteLinkPlayers)
{
- gUnknown_02022C2C = 0x40;
- sub_8015664(0x25, gStringVar4);
- memset(data->field_4C, 0, sizeof(data->field_4C));
- data->field_9A[0] = 0;
- data->field_98 = 0;
+ gPlayerCurrActivity = IN_UNION_ROOM;
+ ScheduleFieldMessageWithFollowupState(UR_STATE_CANCEL_REQUEST_RESTART_LINK, gStringVar4);
+ memset(uroom->playerSendBuffer, 0, sizeof(uroom->playerSendBuffer));
+ uroom->recvActivityRequest[0] = 0;
+ uroom->partnerYesNoResponse = 0;
}
break;
- case 37:
- data->state = 2;
- sub_801818C(FALSE);
+ case UR_STATE_CANCEL_REQUEST_RESTART_LINK:
+ uroom->state = UR_STATE_INIT_LINK;
+ HandleCancelActivity(FALSE);
break;
- case 13:
- sub_8017E00(gStringVar4, gUnknown_02022C2C | 0x40);
- sub_8015664(14, gStringVar4);
+ case UR_STATE_PRINT_START_ACTIVITY_MSG:
+ GetURoomActivityStartMsg(gStringVar4, gPlayerCurrActivity | IN_UNION_ROOM);
+ ScheduleFieldMessageWithFollowupState(UR_STATE_START_ACTIVITY_LINK, gStringVar4);
break;
- case 14:
+ case UR_STATE_START_ACTIVITY_LINK:
sub_800ADF8();
- data->state = 15;
+ uroom->state = UR_STATE_START_ACTIVITY_WAIT_FOR_LINK;
break;
- case 15:
+ case UR_STATE_START_ACTIVITY_WAIT_FOR_LINK:
if (IsLinkTaskFinished())
- data->state = 16;
- break;
- case 16:
- Free(data->field_8);
- Free(data->field_0);
- Free(data->field_C);
- Free(data->field_4);
- DestroyTask(data->field_20);
- sub_8019F04(data->spriteIds);
- data->state = 17;
- break;
- case 17:
+ uroom->state = UR_STATE_START_ACTIVITY_FREE_UROOM;
+ break;
+ case UR_STATE_START_ACTIVITY_FREE_UROOM:
+ Free(uroom->field_8);
+ Free(uroom->field_0);
+ Free(uroom->field_C);
+ Free(uroom->field_4);
+ DestroyTask(uroom->searchTaskId);
+ DestroyGroupMemberSprites(uroom->spriteIds);
+ uroom->state = UR_STATE_START_ACTIVITY_FADE;
+ break;
+ case UR_STATE_START_ACTIVITY_FADE:
BeginNormalPaletteFade(-1, 0, 0, 0x10, RGB_BLACK);
- data->state = 18;
+ uroom->state = UR_STATE_START_ACTIVITY;
break;
- case 18:
+ case UR_STATE_START_ACTIVITY:
if (!UpdatePaletteFade())
{
- sub_8019E3C();
+ DestroyUnionRoomPlayerObjects();
DestroyTask(taskId);
- Free(gUnknown_02022C30.uRoom);
- sub_80149D8();
+ Free(sWirelessLinkMain.uRoom);
+ CreateTask_StartActivity();
}
break;
- case 42:
- if (sub_800F7DC()->species == SPECIES_NONE)
+ case UR_STATE_INTERACT_WITH_ATTENDANT:
+ if (GetHostRFUtgtGname()->species == SPECIES_NONE)
{
- data->state = 43;
+ uroom->state = UR_STATE_REGISTER_PROMPT;
}
else
{
- if (sub_800F7DC()->species == SPECIES_EGG)
+ if (GetHostRFUtgtGname()->species == SPECIES_EGG)
{
StringCopy(gStringVar4, sText_CancelRegistrationOfEgg);
}
else
{
- StringCopy(gStringVar1, gSpeciesNames[sub_800F7DC()->species]);
- ConvertIntToDecimalStringN(gStringVar2, sub_800F7DC()->level, STR_CONV_MODE_LEFT_ALIGN, 3);
+ StringCopy(gStringVar1, gSpeciesNames[GetHostRFUtgtGname()->species]);
+ ConvertIntToDecimalStringN(gStringVar2, GetHostRFUtgtGname()->level, STR_CONV_MODE_LEFT_ALIGN, 3);
StringExpandPlaceholders(gStringVar4, sText_CancelRegistrationOfMon);
}
- sub_8015664(44, gStringVar4);
+ ScheduleFieldMessageWithFollowupState(UR_STATE_CANCEL_REGISTRATION_PROMPT, gStringVar4);
}
break;
- case 43:
- if (PrintOnTextbox(&data->textState, sText_RegisterMonAtTradingBoard))
- data->state = 47;
+ case UR_STATE_REGISTER_PROMPT:
+ if (PrintOnTextbox(&uroom->textState, sText_RegisterMonAtTradingBoard))
+ uroom->state = UR_STATE_REGISTER_PROMPT_HANDLE_INPUT;
break;
- case 47:
- var5 = sub_8017178(&data->textState, &data->field_1D, &data->field_1E, &gUnknown_082F025C, &gUnknown_082F027C);
- if (var5 != -1)
+ case UR_STATE_REGISTER_PROMPT_HANDLE_INPUT:
+ input = ListMenuHandler_AllItemsAvailable(&uroom->textState,
+ &uroom->tradeBoardSelectWindowId,
+ &uroom->tradeBoardDetailsWindowId,
+ &sWindowTemplate_RegisterForTrade,
+ &sListMenuTemplate_RegisterForTrade);
+ if (input != -1)
{
- if (var5 == -2 || var5 == 3)
+ if (input == -2 || input == 3)
{
- data->state = 4;
- sub_801818C(TRUE);
+ uroom->state = UR_STATE_MAIN;
+ HandleCancelActivity(TRUE);
}
else
{
- switch (var5)
+ switch (input)
{
case 1: // REGISTER
- sub_8015664(53, sText_WhichMonWillYouOffer);
+ ScheduleFieldMessageWithFollowupState(UR_STATE_REGISTER_SELECT_MON_FADE, sText_WhichMonWillYouOffer);
break;
case 2: // INFO
- sub_8015664(47, sText_TradingBoardInfo);
+ ScheduleFieldMessageWithFollowupState(UR_STATE_REGISTER_PROMPT_HANDLE_INPUT, sText_TradingBoardInfo);
break;
}
}
}
break;
- case 53:
+ case UR_STATE_REGISTER_SELECT_MON_FADE:
BeginNormalPaletteFade(-1, 0, 0, 0x10, RGB_BLACK);
- data->state = 54;
+ uroom->state = UR_STATE_REGISTER_SELECT_MON;
break;
- case 54:
+ case UR_STATE_REGISTER_SELECT_MON:
if (!gPaletteFade.active)
{
- sUnionRoomTrade.field_0 = 1;
+ sUnionRoomTrade.state = URTRADE_STATE_REGISTERING;
gFieldCallback = FieldCB_ContinueScriptUnionRoom;
ChooseMonForTradingBoard(PARTY_MENU_TYPE_UNION_ROOM_REGISTER, CB2_ReturnToField);
}
break;
- case 52:
- var5 = sub_8017178(&data->textState, &data->field_1D, &data->field_1E, &gUnknown_082F0294, &sMenuTemplate_TradingBoardRequestType);
- if (var5 != -1)
+ case UR_STATE_REGISTER_REQUEST_TYPE:
+ input = ListMenuHandler_AllItemsAvailable(&uroom->textState,
+ &uroom->tradeBoardSelectWindowId,
+ &uroom->tradeBoardDetailsWindowId,
+ &gUnknown_082F0294,
+ &sMenuTemplate_TradingBoardRequestType);
+ if (input != -1)
{
- switch (var5)
+ switch (input)
{
case -2:
- case 18:
+ case NUMBER_OF_MON_TYPES: // Exit
ResetUnionRoomTrade(&sUnionRoomTrade);
- sub_8010FCC(0, 0, 0);
- sub_801568C(sText_RegistrationCanceled);
+ SetTradeBoardRegisteredMonInfo(TYPE_NORMAL, SPECIES_NONE, 0);
+ ScheduleFieldMessageAndExit(sText_RegistrationCanceled);
break;
default:
- sUnionRoomTrade.type = var5;
- data->state = 55;
+ sUnionRoomTrade.type = input;
+ uroom->state = UR_STATE_REGISTER_COMPLETE;
break;
}
}
break;
- case 55:
- sub_8010FCC(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel);
- sub_801568C(sText_RegistraionCompleted);
+ case UR_STATE_REGISTER_COMPLETE:
+ SetTradeBoardRegisteredMonInfo(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel);
+ ScheduleFieldMessageAndExit(sText_RegistraionCompleted);
break;
- case 44:
- switch (sub_80170B8(&data->textState, FALSE))
+ case UR_STATE_CANCEL_REGISTRATION_PROMPT:
+ switch (UnionRoomHandleYesNo(&uroom->textState, FALSE))
{
- case 0:
- data->state = 56;
+ case 0: // YES
+ uroom->state = UR_STATE_CANCEL_REGISTRATION;
break;
- case 1:
+ case 1: // NO
case -1:
- sub_801818C(TRUE);
- data->state = 4;
+ HandleCancelActivity(TRUE);
+ uroom->state = UR_STATE_MAIN;
break;
}
break;
- case 56:
- if (PrintOnTextbox(&data->textState, sText_RegistrationCanceled2))
+ case UR_STATE_CANCEL_REGISTRATION:
+ if (PrintOnTextbox(&uroom->textState, sText_RegistrationCanceled2))
{
- sub_8010FCC(0, 0, 0);
+ SetTradeBoardRegisteredMonInfo(TYPE_NORMAL, SPECIES_NONE, 0);
ResetUnionRoomTrade(&sUnionRoomTrade);
- sub_801818C(TRUE);
- data->state = 4;
+ HandleCancelActivity(TRUE);
+ uroom->state = UR_STATE_MAIN;
}
break;
- case 45:
- if (PrintOnTextbox(&data->textState, sText_XCheckedTradingBoard))
- data->state = 46;
+ case UR_STATE_CHECK_TRADING_BOARD:
+ if (PrintOnTextbox(&uroom->textState, sText_XCheckedTradingBoard))
+ uroom->state = UR_STATE_TRADING_BOARD_LOAD;
break;
- case 46:
- sub_80173B0();
- data->state = 48;
+ case UR_STATE_TRADING_BOARD_LOAD:
+ UR_ClearBg0();
+ uroom->state = UR_STATE_TRADING_BOARD_HANDLE_INPUT;
break;
- case 48:
- var5 = sub_80172A0(&data->textState, &data->field_1D, &data->field_4A, &data->field_1E, &gUnknown_082F034C, &gUnknown_082F03A4, data->field_0);
- if (var5 != -1)
+ case UR_STATE_TRADING_BOARD_HANDLE_INPUT:
+ input = TradeBoardMenuHandler(&uroom->textState, &uroom->tradeBoardSelectWindowId, &uroom->tradeBoardListMenuId, &uroom->tradeBoardDetailsWindowId, &gUnknown_082F034C, &sTradeBoardListMenuTemplate, uroom->field_0);
+ if (input != -1)
{
- switch (var5)
+ switch (input)
{
case -2:
- case 8:
- sub_801818C(TRUE);
- data->state = 4;
+ case 8: // EXIT
+ HandleCancelActivity(TRUE);
+ uroom->state = UR_STATE_MAIN;
break;
default:
- sub_80173B0();
- switch (sub_8017D04(data->field_0->arr[var5].unk.field_0.type, data->field_0->arr[var5].unk.field_0.species))
+ UR_ClearBg0();
+ switch (IsRequestedTypeOrEggInPlayerParty(uroom->field_0->arr[input].gname_uname.gname.type, uroom->field_0->arr[input].gname_uname.gname.species))
{
- case 0:
- sub_8018404(gStringVar1, &data->field_0->arr[var5]);
- sub_8015664(49, sText_AskTrainerToMakeTrade);
- taskData[1] = var5;
+ case UR_TRADE_MATCH:
+ IntlConvPartnerUname7(gStringVar1, &uroom->field_0->arr[input]);
+ ScheduleFieldMessageWithFollowupState(UR_STATE_TRADE_PROMPT, sText_AskTrainerToMakeTrade);
+ taskData[1] = input;
break;
- case 1:
- sub_8018404(gStringVar1, &data->field_0->arr[var5]);
- StringCopy(gStringVar2, gTypeNames[data->field_0->arr[var5].unk.field_0.type]);
- sub_8015664(46, sText_DontHaveTypeTrainerWants);
+ case UR_TRADE_NOTYPE:
+ IntlConvPartnerUname7(gStringVar1, &uroom->field_0->arr[input]);
+ StringCopy(gStringVar2, gTypeNames[uroom->field_0->arr[input].gname_uname.gname.type]);
+ ScheduleFieldMessageWithFollowupState(UR_STATE_TRADING_BOARD_LOAD, sText_DontHaveTypeTrainerWants);
break;
- case 2:
- sub_8018404(gStringVar1, &data->field_0->arr[var5]);
- StringCopy(gStringVar2, gTypeNames[data->field_0->arr[var5].unk.field_0.type]);
- sub_8015664(46, sText_DontHaveEggTrainerWants);
+ case UR_TRADE_NOEGG:
+ IntlConvPartnerUname7(gStringVar1, &uroom->field_0->arr[input]);
+ StringCopy(gStringVar2, gTypeNames[uroom->field_0->arr[input].gname_uname.gname.type]);
+ ScheduleFieldMessageWithFollowupState(UR_STATE_TRADING_BOARD_LOAD, sText_DontHaveEggTrainerWants);
break;
}
break;
}
}
break;
- case 49:
- switch (sub_80170B8(&data->textState, FALSE))
+ case UR_STATE_TRADE_PROMPT:
+ switch (UnionRoomHandleYesNo(&uroom->textState, FALSE))
{
- case 0:
- data->state = 50;
+ case 0: // YES
+ uroom->state = UR_STATE_TRADE_SELECT_MON;
break;
- case -1:
+ case -1: // NO
case 1:
- sub_801818C(TRUE);
- data->state = 4;
+ HandleCancelActivity(TRUE);
+ uroom->state = UR_STATE_MAIN;
break;
}
break;
- case 50:
- if (PrintOnTextbox(&data->textState, sText_WhichMonWillYouOffer))
+ case UR_STATE_TRADE_SELECT_MON:
+ if (PrintOnTextbox(&uroom->textState, sText_WhichMonWillYouOffer))
{
- sUnionRoomTrade.field_0 = 2;
- memcpy(&gUnknown_02022C38, &data->field_0->arr[taskData[1]].unk.field_0.unk_00, sizeof(gUnknown_02022C38));
- gUnionRoomRequestedMonType = data->field_0->arr[taskData[1]].unk.field_0.type;
- gUnionRoomOfferedSpecies = data->field_0->arr[taskData[1]].unk.field_0.species;
+ sUnionRoomTrade.state = URTRADE_STATE_OFFERING;
+ memcpy(&gPartnerTgtGnameSub, &uroom->field_0->arr[taskData[1]].gname_uname.gname.unk_00, sizeof(gPartnerTgtGnameSub));
+ gUnionRoomRequestedMonType = uroom->field_0->arr[taskData[1]].gname_uname.gname.type;
+ gUnionRoomOfferedSpecies = uroom->field_0->arr[taskData[1]].gname_uname.gname.species;
gFieldCallback = FieldCB_ContinueScriptUnionRoom;
ChooseMonForTradingBoard(PARTY_MENU_TYPE_UNION_ROOM_TRADE, CB2_ReturnToField);
- sub_80156B0(data);
- sUnionRoomTrade.field_8 = taskData[1];
+ sub_80156B0(uroom);
+ sUnionRoomTrade.offerPlayerId = taskData[1];
}
break;
- case 51:
- gUnknown_02022C2C = 0x44;
- sub_8012188(data->field_0->arr[taskData[1]].unk.playerName, &data->field_0->arr[taskData[1]].unk.field_0, 0x44);
- sub_8018404(gStringVar1, &data->field_0->arr[taskData[1]]);
- sub_8017020(sCommunicatingWaitTexts[2]);
- data->state = 25;
+ case UR_STATE_TRADE_OFFER_MON:
+ gPlayerCurrActivity = ACTIVITY_TRADE | IN_UNION_ROOM;
+ sub_8012188(uroom->field_0->arr[taskData[1]].gname_uname.playerName, &uroom->field_0->arr[taskData[1]].gname_uname.gname, gPlayerCurrActivity);
+ IntlConvPartnerUname7(gStringVar1, &uroom->field_0->arr[taskData[1]]);
+ UR_PrintFieldMessage(sCommunicatingWaitTexts[2]);
+ uroom->state = UR_STATE_TRY_COMMUNICATING;
break;
- case 26:
- if (PrintOnTextbox(&data->textState, gStringVar4))
+ case UR_STATE_PRINT_AND_EXIT:
+ if (PrintOnTextbox(&uroom->textState, gStringVar4))
{
- sub_801818C(TRUE);
- sub_801A3D0(taskData[0], taskData[1], data->field_0);
- data->state = 4;
+ HandleCancelActivity(TRUE);
+ UpdateUnionRoomMemberFacing(taskData[0], taskData[1], uroom->field_0);
+ uroom->state = UR_STATE_MAIN;
}
break;
- case 8:
- if (PrintOnTextbox(&data->textState, gStringVar4))
- data->state = data->stateAfterPrint;
+ case UR_STATE_PRINT_MSG:
+ if (PrintOnTextbox(&uroom->textState, gStringVar4))
+ uroom->state = uroom->stateAfterPrint;
break;
}
}
-void var_800D_set_xB(void)
+void SetUsingUnionRoomStartMenu(void)
{
if (InUnionRoom() == TRUE)
- gSpecialVar_Result = 11;
+ gSpecialVar_Result = UR_INTERACT_START_MENU;
}
-void sub_801689C(struct UnkStruct_URoom *arg0)
+static void ReceiveUnionRoomActivityPacket(struct WirelessLink_URoom *data)
{
if (gRecvCmds[1][1] != 0 && (gRecvCmds[1][0] & 0xFF00) == 0x2F00)
{
- arg0->field_9A[0] = gRecvCmds[1][1];
- if (gRecvCmds[1][1] == 0x44)
+ data->recvActivityRequest[0] = gRecvCmds[1][1];
+ if (gRecvCmds[1][1] == (ACTIVITY_TRADE | IN_UNION_ROOM))
{
- arg0->field_9A[1] = gRecvCmds[1][2];
- arg0->field_9A[2] = gRecvCmds[1][3];
+ data->recvActivityRequest[1] = gRecvCmds[1][2];
+ data->recvActivityRequest[2] = gRecvCmds[1][3];
}
}
}
-bool32 sub_80168DC(struct UnkStruct_URoom *arg0)
+static bool32 UnionRoom_HandleContactFromOtherPlayer(struct WirelessLink_URoom *uroom)
{
- if (arg0->field_9A[0] != 0)
+ if (uroom->recvActivityRequest[0] != 0)
{
- s32 var = sub_8017EA0(gStringVar4, gLinkPlayers[1].gender, &arg0->field_9A[0], arg0);
- if (var == 0)
+ s32 id = GetChatLeaderActionRequestMessage(gStringVar4, gLinkPlayers[1].gender, &uroom->recvActivityRequest[0], uroom);
+ if (id == 0) // Error
{
return TRUE;
}
- else if (var == 1)
+ else if (id == 1) // Recieve activity request
{
- arg0->state = 35;
- gUnknown_02022C2C = arg0->field_9A[0];
+ uroom->state = UR_STATE_RECV_ACTIVITY_REQUEST;
+ gPlayerCurrActivity = uroom->recvActivityRequest[0];
return FALSE;
}
- else if (var == 2)
+ else if (id == 2) // No activity
{
- arg0->state = 36;
+ uroom->state = UR_STATE_CANCEL_REQUEST_PRINT_MSG;
sub_800AC34();
return FALSE;
}
@@ -3062,53 +3241,53 @@ bool32 sub_80168DC(struct UnkStruct_URoom *arg0)
void InitUnionRoom(void)
{
- struct UnkStruct_URoom *ptr;
+ struct WirelessLink_URoom *data;
sUnionRoomPlayerName[0] = EOS;
- CreateTask(sub_801697C, 0);
- gUnknown_02022C30.uRoom = gUnknown_02022C30.uRoom; // Needed to match.
- gUnknown_02022C30.uRoom = ptr = AllocZeroed(sizeof(struct UnkStruct_URoom));
- gUnknown_03000DA8 = gUnknown_02022C30.uRoom;
- ptr->state = 0;
- ptr->textState = 0;
- ptr->field_10 = 0;
- ptr->field_12 = 0;
+ CreateTask(Task_InitUnionRoom, 0);
+ sWirelessLinkMain.uRoom = sWirelessLinkMain.uRoom; // Needed to match.
+ sWirelessLinkMain.uRoom = data = AllocZeroed(sizeof(struct WirelessLink_URoom));
+ sURoom = sWirelessLinkMain.uRoom;
+ data->state = 0;
+ data->textState = 0;
+ data->unknown = 0;
+ data->field_12 = 0;
sUnionRoomPlayerName[0] = EOS;
}
-void sub_801697C(u8 taskId)
+static void Task_InitUnionRoom(u8 taskId)
{
s32 i;
u8 text[32];
- struct UnkStruct_URoom *structPtr = gUnknown_02022C30.uRoom;
+ struct WirelessLink_URoom *data = sWirelessLinkMain.uRoom;
- switch (structPtr->state)
+ switch (data->state)
{
case 0:
- structPtr->state = 1;
+ data->state = 1;
break;
case 1:
- sub_8010F84(0xC, 0, 0);
- sub_800B488();
+ SetHostRFUtgtGname(ACTIVITY_SEARCH, 0, 0);
+ SetWirelessCommType1();
OpenLink();
- sub_8011C84();
- sub_80111B0(1);
- structPtr->state = 2;
+ InitializeRfuLinkManager_EnterUnionRoom();
+ sub_80111B0(TRUE);
+ data->state = 2;
break;
case 2:
- structPtr->field_4 = AllocZeroed(0x70);
- sub_80175EC(structPtr->field_4, 4);
- structPtr->field_C = AllocZeroed(0x70);
- sub_80175EC(structPtr->field_C, 4);
- structPtr->field_0 = AllocZeroed(0x100);
- sub_8017580(structPtr->field_0->arr, 8);
- structPtr->field_8 = AllocZeroed(0x20);
- sub_8017580(&structPtr->field_8->arr[0], 1);
- structPtr->field_20 = sub_8016DF0(structPtr->field_C, structPtr->field_4, 10);
- structPtr->state = 3;
+ data->field_4 = AllocZeroed(4 * sizeof(struct UnkStruct_x1C));
+ ClearUnkStruct_x1CArray(data->field_4, 4);
+ data->field_C = AllocZeroed(4 * sizeof(struct UnkStruct_x1C));
+ ClearUnkStruct_x1CArray(data->field_C, 4);
+ data->field_0 = AllocZeroed(8 * sizeof(struct UnkStruct_x20));
+ ClearUnkStruct_x20Array(data->field_0->arr, 8);
+ data->field_8 = AllocZeroed(sizeof(struct UnkStruct_x20));
+ ClearUnkStruct_x20Array(&data->field_8->arr[0], 1);
+ data->searchTaskId = CreateTask_SearchForChildOrParent(data->field_C, data->field_4, 10);
+ data->state = 3;
break;
case 3:
- switch (sub_8016B00())
+ switch (HandlePlayerListUpdate())
{
case 1:
case 2:
@@ -3116,10 +3295,10 @@ void sub_801697C(u8 taskId)
{
for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++)
{
- if (structPtr->field_0->arr[i].field_1A_0 == 1)
+ if (data->field_0->arr[i].groupScheduledAnim == UNION_ROOM_SPAWN_IN)
{
- sub_8018404(text, &structPtr->field_0->arr[i]);
- if (sub_800E540(ReadAsU16(structPtr->field_0->arr[i].unk.field_0.unk_00.playerTrainerId), text))
+ IntlConvPartnerUname7(text, &data->field_0->arr[i]);
+ if (PlayerHasMetTrainerBefore(ReadAsU16(data->field_0->arr[i].gname_uname.gname.unk_00.playerTrainerId), text))
{
StringCopy(sUnionRoomPlayerName, text);
break;
@@ -3133,13 +3312,13 @@ void sub_801697C(u8 taskId)
}
break;
case 4:
- free(structPtr->field_8);
- free(structPtr->field_0);
- free(structPtr->field_C);
- free(structPtr->field_4);
- DestroyTask(structPtr->field_20);
- free(gUnknown_02022C30.uRoom);
- sub_800EDD4();
+ free(data->field_8);
+ free(data->field_0);
+ free(data->field_C);
+ free(data->field_4);
+ DestroyTask(data->searchTaskId);
+ free(sWirelessLinkMain.uRoom);
+ LinkRfu_Shutdown();
DestroyTask(taskId);
break;
}
@@ -3159,176 +3338,168 @@ bool16 BufferUnionRoomPlayerName(void)
}
}
-u8 sub_8016B00(void)
+static u8 HandlePlayerListUpdate(void)
{
s32 i;
u8 j;
- struct UnkStruct_URoom *structPtr = gUnknown_02022C30.uRoom;
+ struct WirelessLink_URoom *data = sWirelessLinkMain.uRoom;
s32 r7 = 0;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- if (sub_8017630(&structPtr->field_C->arr[i].unk0, &gUnknown_082F045C) == TRUE)
+ if (AreGnameUnameDifferent(&data->field_C->arr[i].gname_uname, &sWirelessGnameUnamePair_Dummy) == TRUE)
{
- structPtr->field_8->arr[0].unk = structPtr->field_C->arr[i].unk0;
- structPtr->field_8->arr[0].field_18 = 0;
- structPtr->field_8->arr[0].field_1A_0 = 1;
- structPtr->field_8->arr[0].field_1B = 1;
+ data->field_8->arr[0].gname_uname = data->field_C->arr[i].gname_uname;
+ data->field_8->arr[0].timeoutCounter = 0;
+ data->field_8->arr[0].groupScheduledAnim = UNION_ROOM_SPAWN_IN;
+ data->field_8->arr[0].field_1B = 1;
return 4;
}
}
- for (j = 0; j < 8; j++)
+ for (j = 0; j < ARRAY_COUNT(data->field_0->arr); j++)
{
- if (structPtr->field_0->arr[j].field_1A_0 != 0)
+ if (data->field_0->arr[j].groupScheduledAnim != UNION_ROOM_SPAWN_NONE)
{
- i = sub_80176E4(&structPtr->field_0->arr[j], &structPtr->field_4->arr[0]);
+ i = Findx20Inx1CArray(&data->field_0->arr[j], &data->field_4->arr[0]);
if (i != 0xFF)
{
- if (structPtr->field_0->arr[j].field_1A_0 == 1)
+ if (data->field_0->arr[j].groupScheduledAnim == UNION_ROOM_SPAWN_IN)
{
- if (sub_8017678(&structPtr->field_0->arr[j].unk, &structPtr->field_4->arr[i].unk0))
+ if (AreUnionRoomPlayerGnamesDifferent(&data->field_0->arr[j].gname_uname, &data->field_4->arr[i].gname_uname))
{
- structPtr->field_0->arr[j].unk = structPtr->field_4->arr[i].unk0;
- structPtr->field_0->arr[j].field_1B = 0x40;
+ data->field_0->arr[j].gname_uname = data->field_4->arr[i].gname_uname;
+ data->field_0->arr[j].field_1B = 64;
r7 = 1;
}
- else if (structPtr->field_0->arr[j].field_1B != 0)
+ else if (data->field_0->arr[j].field_1B != 0)
{
- structPtr->field_0->arr[j].field_1B--;
- if (structPtr->field_0->arr[j].field_1B == 0)
+ data->field_0->arr[j].field_1B--;
+ if (data->field_0->arr[j].field_1B == 0)
r7 = 2;
}
}
else
{
- structPtr->field_0->arr[j].field_1A_0 = 1;
- structPtr->field_0->arr[j].field_1B = 0;
+ data->field_0->arr[j].groupScheduledAnim = UNION_ROOM_SPAWN_IN;
+ data->field_0->arr[j].field_1B = 0;
r7 = 2;
}
- structPtr->field_0->arr[j].field_18 = 0;
+ data->field_0->arr[j].timeoutCounter = 0;
}
- else if (structPtr->field_0->arr[j].field_1A_0 != 2)
+ else if (data->field_0->arr[j].groupScheduledAnim != UNION_ROOM_SPAWN_OUT)
{
- structPtr->field_0->arr[j].field_18++;
- if (structPtr->field_0->arr[j].field_18 >= 600)
+ data->field_0->arr[j].timeoutCounter++;
+ if (data->field_0->arr[j].timeoutCounter >= 600)
{
- structPtr->field_0->arr[j].field_1A_0 = 2;
+ data->field_0->arr[j].groupScheduledAnim = UNION_ROOM_SPAWN_OUT;
r7 = 2;
}
}
- else if (structPtr->field_0->arr[j].field_1A_0 == 2)
+ else if (data->field_0->arr[j].groupScheduledAnim == UNION_ROOM_SPAWN_OUT)
{
- structPtr->field_0->arr[j].field_18++;
- if (structPtr->field_0->arr[j].field_18 >= 900)
+ data->field_0->arr[j].timeoutCounter++;
+ if (data->field_0->arr[j].timeoutCounter >= 900)
{
- sub_8017580(&structPtr->field_0->arr[j], 1);
+ ClearUnkStruct_x20Array(&data->field_0->arr[j], 1);
}
}
}
}
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- if (sub_8017734(&structPtr->field_0->arr[0], &structPtr->field_4->arr[i], 8) != 0xFF)
+ if (Appendx1Ctox20(&data->field_0->arr[0], &data->field_4->arr[i], MAX_UNION_ROOM_PLAYERS) != 0xFF)
r7 = 1;
}
return r7;
}
-void sub_8016CA0(u8 taskId)
+static void Task_SearchForChildOrParent(u8 taskId)
{
s32 i, j;
- struct UnkStruct_Shared sp0;
+ struct WirelessGnameUnamePair gname_uname;
struct UnkStruct_Main4 **ptr = (void*) gTasks[taskId].data;
- bool8 r4;
+ bool8 isParent;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- r4 = sub_800DE7C(&sp0.field_0, sp0.playerName, i);
- if (!sub_8013D88(sp0.field_0.activity, gTasks[taskId].data[4]))
+ isParent = LinkRfu_GetNameIfCompatible(&gname_uname.gname, gname_uname.playerName, i);
+ if (!IsPartnerActivityAcceptable(gname_uname.gname.activity, gTasks[taskId].data[4]))
{
- sp0 = gUnknown_082F045C;
+ gname_uname = sWirelessGnameUnamePair_Dummy;
}
- if (sp0.field_0.unk_00.language == 1)
+ if (gname_uname.gname.unk_00.language == LANGUAGE_JAPANESE)
{
- sp0 = gUnknown_082F045C;
+ gname_uname = sWirelessGnameUnamePair_Dummy;
}
- if (!r4)
+ if (!isParent)
{
for (j = 0; j < i; j++)
{
- if (!sub_8017630(&ptr[1]->arr[j].unk0, &sp0))
+ if (!AreGnameUnameDifferent(&ptr[1]->arr[j].gname_uname, &gname_uname))
{
- sp0 = gUnknown_082F045C;
+ gname_uname = sWirelessGnameUnamePair_Dummy;
}
}
- ptr[1]->arr[i].unk0 = sp0;
- ptr[1]->arr[i].unk18 = sub_8017630(&ptr[1]->arr[i].unk0, &gUnknown_082F045C);
+ ptr[1]->arr[i].gname_uname = gname_uname;
+ ptr[1]->arr[i].active = AreGnameUnameDifferent(&ptr[1]->arr[i].gname_uname, &sWirelessGnameUnamePair_Dummy);
}
else
{
- ptr[0]->arr[i].unk0 = sp0;
- ptr[0]->arr[i].unk18 = sub_8017630(&ptr[0]->arr[i].unk0, &gUnknown_082F045C);
+ ptr[0]->arr[i].gname_uname = gname_uname;
+ ptr[0]->arr[i].active = AreGnameUnameDifferent(&ptr[0]->arr[i].gname_uname, &sWirelessGnameUnamePair_Dummy);
}
}
}
-u8 sub_8016DF0(struct UnkStruct_Main4 * a0, struct UnkStruct_Main4 * a1, u32 a2)
+static u8 CreateTask_SearchForChildOrParent(struct UnkStruct_Main4 * main4_parent, struct UnkStruct_Main4 * main4_child, u32 linkGroup)
{
- u8 taskId = CreateTask(sub_8016CA0, 0);
+ u8 taskId = CreateTask(Task_SearchForChildOrParent, 0);
struct UnkStruct_Main4 ** data = (void *)gTasks[taskId].data;
- data[0] = a0;
- data[1] = a1;
- gTasks[taskId].data[4] = a2;
+ data[0] = main4_parent;
+ data[1] = main4_child;
+ gTasks[taskId].data[4] = linkGroup;
return taskId;
}
-void sub_8016E24(u8 taskId)
+static void Task_ListenForPartnersWithCompatibleSerialNos(u8 taskId)
{
s32 i, j;
struct UnkStruct_Main4 **ptr = (void*) gTasks[taskId].data;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- sub_800DE7C(&ptr[0]->arr[i].unk0.field_0, ptr[0]->arr[i].unk0.playerName, i);
- if (!sub_8013D88(ptr[0]->arr[i].unk0.field_0.activity, gTasks[taskId].data[2]))
+ LinkRfu_GetNameIfCompatible(&ptr[0]->arr[i].gname_uname.gname, ptr[0]->arr[i].gname_uname.playerName, i);
+ if (!IsPartnerActivityAcceptable(ptr[0]->arr[i].gname_uname.gname.activity, gTasks[taskId].data[2]))
{
- ptr[0]->arr[i].unk0 = gUnknown_082F045C;
+ ptr[0]->arr[i].gname_uname = sWirelessGnameUnamePair_Dummy;
}
for (j = 0; j < i; j++)
{
- if (!sub_8017630(&ptr[0]->arr[j].unk0, &ptr[0]->arr[i].unk0))
+ if (!AreGnameUnameDifferent(&ptr[0]->arr[j].gname_uname, &ptr[0]->arr[i].gname_uname))
{
- ptr[0]->arr[i].unk0 = gUnknown_082F045C;
+ ptr[0]->arr[i].gname_uname = sWirelessGnameUnamePair_Dummy;
}
}
- ptr[0]->arr[i].unk18 = sub_8017630(&ptr[0]->arr[i].unk0, &gUnknown_082F045C);
+ ptr[0]->arr[i].active = AreGnameUnameDifferent(&ptr[0]->arr[i].gname_uname, &sWirelessGnameUnamePair_Dummy);
}
}
-bool32 sub_8016F1C(struct GFtgtGname *arg0, s16 arg1)
+static bool32 HasWonderCardOrNewsByLinkGroup(struct GFtgtGname *gname, s16 linkGroup)
{
- if (arg1 == 7)
+ if (linkGroup == LINK_GROUP_WONDER_CARD)
{
- if (!arg0->unk_00.hasCard)
- {
+ if (!gname->unk_00.hasCard)
return FALSE;
- }
else
- {
return TRUE;
- }
}
- else if (arg1 == 8)
+ else if (linkGroup == LINK_GROUP_WONDER_NEWS)
{
- if (!arg0->unk_00.hasNews)
- {
+ if (!gname->unk_00.hasNews)
return FALSE;
- }
else
- {
return TRUE;
- }
}
else
{
@@ -3336,40 +3507,40 @@ bool32 sub_8016F1C(struct GFtgtGname *arg0, s16 arg1)
}
}
-void sub_8016F44(u8 taskId)
+static void Task_ListenForPartnersWithSerial7F7D(u8 taskId)
{
s32 i;
struct UnkStruct_Main4 **ptr = (void*) gTasks[taskId].data;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- if (sub_800DF34(&ptr[0]->arr[i].unk0.field_0, ptr[0]->arr[i].unk0.playerName, i))
+ if (LinkRfu_GetNameIfSerial7F7D(&ptr[0]->arr[i].gname_uname.gname, ptr[0]->arr[i].gname_uname.playerName, i))
{
- sub_8016F1C(&ptr[0]->arr[i].unk0.field_0, gTasks[taskId].data[2]);
+ HasWonderCardOrNewsByLinkGroup(&ptr[0]->arr[i].gname_uname.gname, gTasks[taskId].data[2]);
}
- ptr[0]->arr[i].unk18 = sub_8017630(&ptr[0]->arr[i].unk0, &gUnknown_082F045C);
+ ptr[0]->arr[i].active = AreGnameUnameDifferent(&ptr[0]->arr[i].gname_uname, &sWirelessGnameUnamePair_Dummy);
}
}
-u8 sub_8016FC0(struct UnkStruct_Main4 * a0, u32 a1)
+static u8 CreateTask_ListenForPartnersWithCompatibleSerialNos(struct UnkStruct_Main4 * main4, u32 linkGroup)
{
- u8 taskId = CreateTask(sub_8016E24, 0);
+ u8 taskId = CreateTask(Task_ListenForPartnersWithCompatibleSerialNos, 0);
struct UnkStruct_Main4 **ptr = (void*) gTasks[taskId].data;
- ptr[0] = a0;
- gTasks[taskId].data[2] = a1;
+ ptr[0] = main4;
+ gTasks[taskId].data[2] = linkGroup;
return taskId;
}
-u8 sub_8016FF0(struct UnkStruct_Main4 * a0, u32 a1)
+static u8 CreateTask_ListenForPartnersWithSerial7F7D(struct UnkStruct_Main4 * main4, u32 linkGroup)
{
- u8 taskId = CreateTask(sub_8016F44, 0);
+ u8 taskId = CreateTask(Task_ListenForPartnersWithSerial7F7D, 0);
struct UnkStruct_Main4 **ptr = (void*) gTasks[taskId].data;
- ptr[0] = a0;
- gTasks[taskId].data[2] = a1;
+ ptr[0] = main4;
+ gTasks[taskId].data[2] = linkGroup;
return taskId;
}
-bool32 sub_8017020(const u8 *src)
+static bool32 UR_PrintFieldMessage(const u8 *src)
{
LoadMessageBoxAndBorderGfx();
DrawDialogueFrame(0, 1);
@@ -3378,19 +3549,15 @@ bool32 sub_8017020(const u8 *src)
return FALSE;
}
-bool32 sub_801704C(void)
+static bool32 UR_RunTextPrinters_CheckPrinter0Active(void)
{
if (!RunTextPrintersAndIsPrinter0Active())
- {
return TRUE;
- }
else
- {
return FALSE;
- }
}
-bool8 PrintOnTextbox(u8 *textState, const u8 *str)
+static bool8 PrintOnTextbox(u8 *textState, const u8 *str)
{
switch (*textState)
{
@@ -3412,96 +3579,96 @@ bool8 PrintOnTextbox(u8 *textState, const u8 *str)
return FALSE;
}
-s8 sub_80170B8(u8 *arg0, bool32 arg1)
+static s8 UnionRoomHandleYesNo(u8 *state, bool32 noDraw)
{
- s8 r1;
+ s8 input;
- switch (*arg0)
+ switch (*state)
{
case 0:
- if (arg1)
+ if (noDraw)
{
return -3;
}
DisplayYesNoMenuDefaultYes();
- (*arg0)++;
+ (*state)++;
break;
case 1:
- if (arg1)
+ if (noDraw)
{
sub_8198C78();
- *arg0 = 0;
+ *state = 0;
return -3;
}
- r1 = Menu_ProcessInputNoWrapClearOnChoose();
- if (r1 == -1 || r1 == 0 || r1 == 1)
+ input = Menu_ProcessInputNoWrapClearOnChoose();
+ if (input == -1 || input == 0 || input == 1)
{
- *arg0 = 0;
- return r1;
+ *state = 0;
+ return input;
}
break;
}
return -2;
}
-u8 sub_8017118(const struct WindowTemplate * template)
+static u8 CreateTradeBoardWindow(const struct WindowTemplate * template)
{
u8 windowId = AddWindow(template);
DrawStdWindowFrame(windowId, FALSE);
- FillWindowPixelBuffer(windowId, 0xFF);
- sub_80173E0(windowId, 1, sText_NameWantedOfferLv, 8, 1, 6);
+ FillWindowPixelBuffer(windowId, PIXEL_FILL(15));
+ UR_AddTextPrinterParameterized(windowId, 1, sText_NameWantedOfferLv, 8, 1, 6);
CopyWindowToVram(windowId, 2);
PutWindowTilemap(windowId);
return windowId;
}
-void sub_8017168(u8 windowId)
+static void DeleteTradeBoardWindow(u8 windowId)
{
RemoveWindow(windowId);
}
-s32 sub_8017178(u8 *arg0, u8 *arg1, u8 *arg2, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate)
+static s32 ListMenuHandler_AllItemsAvailable(u8 *state, u8 *windowId, u8 *listMenuId, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate)
{
- s32 r1, r8;
+ s32 maxWidth, input;
struct WindowTemplate winTemplateCopy;
- switch (*arg0)
+ switch (*state)
{
case 0:
winTemplateCopy = *winTemplate;
- r1 = Intl_GetListMenuWidth(menuTemplate);
- if (winTemplateCopy.width > r1)
+ maxWidth = Intl_GetListMenuWidth(menuTemplate);
+ if (winTemplateCopy.width > maxWidth)
{
- winTemplateCopy.width = r1;
+ winTemplateCopy.width = maxWidth;
}
if (winTemplateCopy.tilemapLeft + winTemplateCopy.width > 29)
{
winTemplateCopy.tilemapLeft = max(29 - winTemplateCopy.width, 0);
}
- *arg1 = AddWindow(&winTemplateCopy);
- DrawStdWindowFrame(*arg1, FALSE);
+ *windowId = AddWindow(&winTemplateCopy);
+ DrawStdWindowFrame(*windowId, FALSE);
gMultiuseListMenuTemplate = *menuTemplate;
- gMultiuseListMenuTemplate.windowId = *arg1;
- *arg2 = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0);
- CopyWindowToVram(*arg1, TRUE);
- (*arg0)++;
+ gMultiuseListMenuTemplate.windowId = *windowId;
+ *listMenuId = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0);
+ CopyWindowToVram(*windowId, TRUE);
+ (*state)++;
break;
case 1:
- r8 = ListMenu_ProcessInput(*arg2);
- if (({gMain.newKeys & A_BUTTON;}))
+ input = ListMenu_ProcessInput(*listMenuId);
+ if (JOY_NEW(A_BUTTON))
{
- DestroyListMenuTask(*arg2, NULL, NULL);
- ClearStdWindowAndFrame(*arg1, TRUE);
- RemoveWindow(*arg1);
- *arg0 = 0;
- return r8;
+ DestroyListMenuTask(*listMenuId, NULL, NULL);
+ ClearStdWindowAndFrame(*windowId, TRUE);
+ RemoveWindow(*windowId);
+ *state = 0;
+ return input;
}
- else if (({gMain.newKeys & B_BUTTON;}))
+ else if (JOY_NEW(B_BUTTON))
{
- DestroyListMenuTask(*arg2, NULL, NULL);
- ClearStdWindowAndFrame(*arg1, TRUE);
- RemoveWindow(*arg1);
- *arg0 = 0;
+ DestroyListMenuTask(*listMenuId, NULL, NULL);
+ ClearStdWindowAndFrame(*windowId, TRUE);
+ RemoveWindow(*windowId);
+ *state = 0;
return -2;
}
break;
@@ -3510,49 +3677,48 @@ s32 sub_8017178(u8 *arg0, u8 *arg1, u8 *arg2, const struct WindowTemplate *winTe
return -1;
}
-s32 sub_80172A0(u8 *arg0, u8 *arg1, u8 *arg2, u8 *arg3, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate, struct UnkStruct_Main0 *arg6)
+static s32 TradeBoardMenuHandler(u8 *state, u8 *windowId, u8 *listMenuId, u8 *tradeBoardWindowId, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate, struct UnkStruct_Main0 *traders)
{
s32 input;
- s32 r4;
+ s32 idx;
- switch (*arg0)
+ switch (*state)
{
case 0:
- *arg3 = sub_8017118(&gUnknown_082F0344);
- *arg1 = AddWindow(winTemplate);
- DrawStdWindowFrame(*arg1, FALSE);
+ *tradeBoardWindowId = CreateTradeBoardWindow(&sWindowTemplate_TradingBoard);
+ *windowId = AddWindow(winTemplate);
+ DrawStdWindowFrame(*windowId, FALSE);
gMultiuseListMenuTemplate = *menuTemplate;
- gMultiuseListMenuTemplate.windowId = *arg1;
- *arg2 = ListMenuInit(&gMultiuseListMenuTemplate, 0, 1);
- (*arg0)++;
+ gMultiuseListMenuTemplate.windowId = *windowId;
+ *listMenuId = ListMenuInit(&gMultiuseListMenuTemplate, 0, 1);
+ (*state)++;
break;
case 1:
- CopyWindowToVram(*arg1, TRUE);
- (*arg0)++;
+ CopyWindowToVram(*windowId, TRUE);
+ (*state)++;
break;
case 2:
- // Register swap r1 <---> r2
- input = ListMenu_ProcessInput(*arg2);
- if (({gMain.newKeys & (A_BUTTON | B_BUTTON);}))
+ input = ListMenu_ProcessInput(*listMenuId);
+ if (JOY_NEW(A_BUTTON | B_BUTTON))
{
- if (input == 8 || ({gMain.newKeys & B_BUTTON;}))
+ if (input == 8 || JOY_NEW(B_BUTTON))
{
- DestroyListMenuTask(*arg2, NULL, NULL);
- RemoveWindow(*arg1);
- sub_8017168(*arg3);
- *arg0 = 0;
+ DestroyListMenuTask(*listMenuId, NULL, NULL);
+ RemoveWindow(*windowId);
+ DeleteTradeBoardWindow(*tradeBoardWindowId);
+ *state = 0;
return -2;
}
else
{
- r4 = sub_8017CB0(arg6->arr, input);
- if (r4 >= 0)
+ idx = GetIndexOfNthTradeBoardOffer(traders->arr, input);
+ if (idx >= 0)
{
- DestroyListMenuTask(*arg2, NULL, NULL);
- RemoveWindow(*arg1);
- sub_8017168(*arg3);
- *arg0 = 0;
- return r4;
+ DestroyListMenuTask(*listMenuId, NULL, NULL);
+ RemoveWindow(*windowId);
+ DeleteTradeBoardWindow(*tradeBoardWindowId);
+ *state = 0;
+ return idx;
}
else
{
@@ -3565,127 +3731,128 @@ s32 sub_80172A0(u8 *arg0, u8 *arg1, u8 *arg2, u8 *arg3, const struct WindowTempl
return -1;
}
-void sub_80173B0(void)
+
+static void UR_ClearBg0(void)
{
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 0);
CopyBgTilemapBufferToVram(0);
}
-void sub_80173D4(void)
+static void JoinGroup_EnableScriptContexts(void)
{
EnableBothScriptContexts();
}
-void sub_80173E0(u8 windowId, u8 arg1, const u8 *str, u8 arg3, u8 arg4, u8 arg5)
+static void UR_AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 colorIdx)
{
- struct TextPrinterTemplate sp0;
+ struct TextPrinterTemplate printerTemplate;
- sp0.currentChar = str;
- sp0.windowId = windowId;
- sp0.fontId = arg1;
- sp0.x = arg3;
- sp0.y = arg4;
- sp0.currentX = arg3;
- sp0.currentY = arg4;
- sp0.unk = 0;
+ printerTemplate.currentChar = str;
+ printerTemplate.windowId = windowId;
+ printerTemplate.fontId = fontId;
+ printerTemplate.x = x;
+ printerTemplate.y = y;
+ printerTemplate.currentX = x;
+ printerTemplate.currentY = y;
+ printerTemplate.unk = 0;
gTextFlags.useAlternateDownArrow = FALSE;
- switch (arg5)
+ switch (colorIdx)
{
- case 0:
- sp0.letterSpacing = 0;
- sp0.lineSpacing = 0;
- sp0.fgColor = 2;
- sp0.bgColor = 1;
- sp0.shadowColor = 3;
- break;
- case 1:
- sp0.letterSpacing = 0;
- sp0.lineSpacing = 0;
- sp0.fgColor = 4;
- sp0.bgColor = 1;
- sp0.shadowColor = 5;
- break;
- case 2:
- sp0.letterSpacing = 0;
- sp0.lineSpacing = 0;
- sp0.fgColor = 6;
- sp0.bgColor = 1;
- sp0.shadowColor = 7;
- break;
- case 3:
- sp0.letterSpacing = 0;
- sp0.lineSpacing = 0;
- sp0.fgColor = 1;
- sp0.bgColor = 1;
- sp0.shadowColor = 3;
- break;
- case 4:
- sp0.letterSpacing = 0;
- sp0.lineSpacing = 0;
- sp0.fgColor = 1;
- sp0.bgColor = 2;
- sp0.shadowColor = 3;
- break;
- case 5:
- sp0.letterSpacing = 0;
- sp0.lineSpacing = 0;
- sp0.fgColor = 7;
- sp0.bgColor = 15;
- sp0.shadowColor = 9;
- break;
- case 6:
- sp0.letterSpacing = 0;
- sp0.lineSpacing = 0;
- sp0.fgColor = 14;
- sp0.bgColor = 15;
- sp0.shadowColor = 9;
+ case UR_COLOR_DKE_WHT_LTE:
+ printerTemplate.letterSpacing = 0;
+ printerTemplate.lineSpacing = 0;
+ printerTemplate.fgColor = TEXT_COLOR_DARK_GREY;
+ printerTemplate.bgColor = TEXT_COLOR_WHITE;
+ printerTemplate.shadowColor = TEXT_COLOR_LIGHT_GREY;
+ break;
+ case UR_COLOR_RED_WHT_LTR:
+ printerTemplate.letterSpacing = 0;
+ printerTemplate.lineSpacing = 0;
+ printerTemplate.fgColor = TEXT_COLOR_RED;
+ printerTemplate.bgColor = TEXT_COLOR_WHITE;
+ printerTemplate.shadowColor = TEXT_COLOR_LIGHT_RED;
+ break;
+ case UR_COLOR_GRN_WHT_LTG:
+ printerTemplate.letterSpacing = 0;
+ printerTemplate.lineSpacing = 0;
+ printerTemplate.fgColor = TEXT_COLOR_GREEN;
+ printerTemplate.bgColor = TEXT_COLOR_WHITE;
+ printerTemplate.shadowColor = TEXT_COLOR_LIGHT_GREEN;
+ break;
+ case UR_COLOR_WHT_WHT_LTE:
+ printerTemplate.letterSpacing = 0;
+ printerTemplate.lineSpacing = 0;
+ printerTemplate.fgColor = TEXT_COLOR_WHITE;
+ printerTemplate.bgColor = TEXT_COLOR_WHITE;
+ printerTemplate.shadowColor = TEXT_COLOR_LIGHT_GREY;
+ break;
+ case UR_COLOR_WHT_DKE_LTE:
+ printerTemplate.letterSpacing = 0;
+ printerTemplate.lineSpacing = 0;
+ printerTemplate.fgColor = TEXT_COLOR_WHITE;
+ printerTemplate.bgColor = TEXT_COLOR_DARK_GREY;
+ printerTemplate.shadowColor = TEXT_COLOR_LIGHT_GREY;
+ break;
+ case UR_COLOR_GRN_DN6_LTB:
+ printerTemplate.letterSpacing = 0;
+ printerTemplate.lineSpacing = 0;
+ printerTemplate.fgColor = TEXT_COLOR_LIGHT_GREEN;
+ printerTemplate.bgColor = TEXT_DYNAMIC_COLOR_6;
+ printerTemplate.shadowColor = TEXT_COLOR_LIGHT_BLUE;
+ break;
+ case UR_COLOR_DN5_DN6_LTB:
+ printerTemplate.letterSpacing = 0;
+ printerTemplate.lineSpacing = 0;
+ printerTemplate.fgColor = TEXT_DYNAMIC_COLOR_5;
+ printerTemplate.bgColor = TEXT_DYNAMIC_COLOR_6;
+ printerTemplate.shadowColor = TEXT_COLOR_LIGHT_BLUE;
break;
}
- AddTextPrinter(&sp0, 0xFF, NULL);
+ AddTextPrinter(&printerTemplate, 0xFF, NULL);
}
-void sub_8017580(struct UnkStruct_x20 *arg0, u8 count)
+static void ClearUnkStruct_x20Array(struct UnkStruct_x20 *arr, u8 count)
{
s32 i;
for (i = 0; i < count; i++)
{
- arg0[i].unk = gUnknown_082F045C;
- arg0[i].field_18 = 0xFF;
- arg0[i].field_1A_0 = 0;
- arg0[i].field_1A_1 = 0;
- arg0[i].field_1B = 0;
+ arr[i].gname_uname = sWirelessGnameUnamePair_Dummy;
+ arr[i].timeoutCounter = 255;
+ arr[i].groupScheduledAnim = UNION_ROOM_SPAWN_NONE;
+ arr[i].useRedText = FALSE;
+ arr[i].field_1B = 0;
}
}
-void sub_80175EC(struct UnkStruct_Main4 *arg0, u8 count)
+static void ClearUnkStruct_x1CArray(struct UnkStruct_Main4 *main4, u8 count)
{
s32 i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- arg0->arr[i].unk0 = gUnknown_082F045C;
- arg0->arr[i].unk18 = 0;
+ main4->arr[i].gname_uname = sWirelessGnameUnamePair_Dummy;
+ main4->arr[i].active = FALSE;
}
}
-bool8 sub_8017630(struct UnkStruct_Shared* arg0, const struct UnkStruct_Shared* arg1)
+static bool8 AreGnameUnameDifferent(struct WirelessGnameUnamePair* pair1, const struct WirelessGnameUnamePair* pair2)
{
s32 i;
for (i = 0; i < 2; i++)
{
- if (arg0->field_0.unk_00.playerTrainerId[i] != arg1->field_0.unk_00.playerTrainerId[i])
+ if (pair1->gname.unk_00.playerTrainerId[i] != pair2->gname.unk_00.playerTrainerId[i])
{
return TRUE;
}
}
- for (i = 0; i < 8; i++)
+ for (i = 0; i < PLAYER_NAME_LENGTH + 1; i++)
{
- if (arg0->playerName[i] != arg1->playerName[i])
+ if (pair1->playerName[i] != pair2->playerName[i])
{
return TRUE;
}
@@ -3694,34 +3861,34 @@ bool8 sub_8017630(struct UnkStruct_Shared* arg0, const struct UnkStruct_Shared*
return FALSE;
}
-bool32 sub_8017678(struct UnkStruct_Shared *arg0, struct UnkStruct_Shared *arg1)
+static bool32 AreUnionRoomPlayerGnamesDifferent(struct WirelessGnameUnamePair *pair1, struct WirelessGnameUnamePair *pair2)
{
s32 i;
- if (arg0->field_0.activity != arg1->field_0.activity)
+ if (pair1->gname.activity != pair2->gname.activity)
{
return TRUE;
}
- if (arg0->field_0.started != arg1->field_0.started)
+ if (pair1->gname.started != pair2->gname.started)
{
return TRUE;
}
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- if (arg0->field_0.child_sprite_gender[i] != arg1->field_0.child_sprite_gender[i])
+ if (pair1->gname.child_sprite_gender[i] != pair2->gname.child_sprite_gender[i])
{
return TRUE;
}
}
- if (arg0->field_0.species != arg1->field_0.species)
+ if (pair1->gname.species != pair2->gname.species)
{
return TRUE;
}
- if (arg0->field_0.type != arg1->field_0.type)
+ if (pair1->gname.type != pair2->gname.type)
{
return TRUE;
}
@@ -3729,38 +3896,38 @@ bool32 sub_8017678(struct UnkStruct_Shared *arg0, struct UnkStruct_Shared *arg1)
return FALSE;
}
-u32 sub_80176E4(struct UnkStruct_x20 *arg0, struct UnkStruct_x1C *arg1)
+static u32 Findx20Inx1CArray(struct UnkStruct_x20 *arg0, struct UnkStruct_x1C *arg1)
{
u8 result = 0xFF;
s32 i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- if (arg1[i].unk18 && !sub_8017630(&arg0->unk, &arg1[i].unk0))
+ if (arg1[i].active && !AreGnameUnameDifferent(&arg0->gname_uname, &arg1[i].gname_uname))
{
result = i;
- arg1[i].unk18 = FALSE;
+ arg1[i].active = FALSE;
}
}
return result;
}
-u8 sub_8017734(struct UnkStruct_x20 *arg0, struct UnkStruct_x1C *arg1, u8 arg2)
+static u8 Appendx1Ctox20(struct UnkStruct_x20 *arg0, struct UnkStruct_x1C *arg1, u8 max)
{
s32 i;
- if (arg1->unk18)
+ if (arg1->active)
{
- for (i = 0; i < arg2; i++)
+ for (i = 0; i < max; i++)
{
- if (arg0[i].field_1A_0 == 0)
+ if (arg0[i].groupScheduledAnim == UNION_ROOM_SPAWN_NONE)
{
- arg0[i].unk = arg1->unk0;
- arg0[i].field_18 = 0;
- arg0[i].field_1A_0 = 1;
+ arg0[i].gname_uname = arg1->gname_uname;
+ arg0[i].timeoutCounter = 0;
+ arg0[i].groupScheduledAnim = UNION_ROOM_SPAWN_IN;
arg0[i].field_1B = 64;
- arg1->unk18 = FALSE;
+ arg1->active = FALSE;
return i;
}
}
@@ -3769,126 +3936,123 @@ u8 sub_8017734(struct UnkStruct_x20 *arg0, struct UnkStruct_x1C *arg1, u8 arg2)
return 0xFF;
}
-void sub_80177B8(u8 arg0, u8 arg1, u8 arg2, struct UnkStruct_x20 *arg3, u8 arg4, u8 id)
+static void PrintUnionRoomGroupOnWindow(u8 windowId, u8 x, u8 y, struct UnkStruct_x20 *group, u8 colorIdx, u8 id)
{
- u8 r2;
- u8 sp0[6];
+ u8 activity;
+ u8 trainerId[6];
ConvertIntToDecimalStringN(gStringVar4, id + 1, STR_CONV_MODE_LEADING_ZEROS, 2);
StringAppend(gStringVar4, sText_Colon);
- sub_80173E0(arg0, 1, gStringVar4, arg1, arg2, 0);
- arg1 += 18;
- r2 = arg3->unk.field_0.activity;
- if (arg3->field_1A_0 == 1 && !(r2 & 0x40))
+ UR_AddTextPrinterParameterized(windowId, 1, gStringVar4, x, y, 0);
+ x += 18;
+ activity = group->gname_uname.gname.activity;
+ if (group->groupScheduledAnim == UNION_ROOM_SPAWN_IN && !(activity & IN_UNION_ROOM))
{
- sub_8018404(gStringVar4, arg3);
- sub_80173E0(arg0, 1, gStringVar4, arg1, arg2, arg4);
- ConvertIntToDecimalStringN(sp0, arg3->unk.field_0.unk_00.playerTrainerId[0] | (arg3->unk.field_0.unk_00.playerTrainerId[1] << 8), STR_CONV_MODE_LEADING_ZEROS, 5);
+ IntlConvPartnerUname7(gStringVar4, group);
+ UR_AddTextPrinterParameterized(windowId, 1, gStringVar4, x, y, colorIdx);
+ ConvertIntToDecimalStringN(trainerId, group->gname_uname.gname.unk_00.playerTrainerId[0] | (group->gname_uname.gname.unk_00.playerTrainerId[1] << 8), STR_CONV_MODE_LEADING_ZEROS, 5);
StringCopy(gStringVar4, sText_ID);
- StringAppend(gStringVar4, sp0);
- sub_80173E0(arg0, 1, gStringVar4, GetStringRightAlignXOffset(1, gStringVar4, 0x88), arg2, arg4);
+ StringAppend(gStringVar4, trainerId);
+ UR_AddTextPrinterParameterized(windowId, 1, gStringVar4, GetStringRightAlignXOffset(1, gStringVar4, 0x88), y, colorIdx);
}
}
-void sub_80178A0(u8 arg0, u8 arg1, u8 arg2, struct UnkStruct_x20 *arg3, u8 arg4, u8 id)
+static void PrintGroupMemberCandidateOnWindowWithColor(u8 windowId, u8 x, u8 y, struct UnkStruct_x20 *group, u8 colorIdx, u8 id)
{
- u8 sp0[6];
+ u8 trainerId[6];
- if (arg3->field_1A_0 == 1)
+ if (group->groupScheduledAnim == UNION_ROOM_SPAWN_IN)
{
- sub_8018404(gStringVar4, arg3);
- sub_80173E0(arg0, 1, gStringVar4, arg1, arg2, arg4);
- ConvertIntToDecimalStringN(sp0, arg3->unk.field_0.unk_00.playerTrainerId[0] | (arg3->unk.field_0.unk_00.playerTrainerId[1] << 8), STR_CONV_MODE_LEADING_ZEROS, 5);
+ IntlConvPartnerUname7(gStringVar4, group);
+ UR_AddTextPrinterParameterized(windowId, 1, gStringVar4, x, y, colorIdx);
+ ConvertIntToDecimalStringN(trainerId, group->gname_uname.gname.unk_00.playerTrainerId[0] | (group->gname_uname.gname.unk_00.playerTrainerId[1] << 8), STR_CONV_MODE_LEADING_ZEROS, 5);
StringCopy(gStringVar4, sText_ID);
- StringAppend(gStringVar4, sp0);
- sub_80173E0(arg0, 1, gStringVar4, GetStringRightAlignXOffset(1, gStringVar4, 0x68), arg2, arg4);
+ StringAppend(gStringVar4, trainerId);
+ UR_AddTextPrinterParameterized(windowId, 1, gStringVar4, GetStringRightAlignXOffset(1, gStringVar4, 0x68), y, colorIdx);
}
}
-bool32 sub_8017940(void)
+static bool32 IsPlayerFacingTradingBoard(void)
{
s16 x, y;
GetXYCoordsOneStepInFrontOfPlayer(&x, &y);
- if (x != 9)
- {
+
+ if (x != 2 + 7)
return FALSE;
- }
- if (y != 8)
- {
+
+ if (y != 1 + 7)
return FALSE;
- }
- if (gPlayerAvatar.tileTransitionState == 2 || gPlayerAvatar.tileTransitionState == 0)
- {
+
+ if (gPlayerAvatar.tileTransitionState == T_TILE_CENTER || gPlayerAvatar.tileTransitionState == T_NOT_MOVING)
return TRUE;
- }
return FALSE;
}
-u32 sub_8017984(s32 arg0)
+static u32 GetResponseIdx_InviteToURoomActivity(s32 activity)
{
- switch (arg0)
+ switch (activity)
{
- case 5:
+ case ACTIVITY_CHAT:
return 1;
- case 4:
+ case ACTIVITY_TRADE:
return 2;
- case 8:
+ case ACTIVITY_CARD:
return 3;
- case 3:
+ case ACTIVITY_BATTLE_MULTI:
default:
return 0;
}
}
-u32 sub_80179AC(struct UnkStruct_x20 *arg0)
+static u32 ConvPartnerUnameAndGetWhetherMetAlready(struct UnkStruct_x20 *arg0)
{
- u8 sp0[30];
- sub_8018404(sp0, arg0);
- return sub_800E540(ReadAsU16(arg0->unk.field_0.unk_00.playerTrainerId), sp0);
+ u8 name[30];
+ IntlConvPartnerUname7(name, arg0);
+ return PlayerHasMetTrainerBefore(ReadAsU16(arg0->gname_uname.gname.unk_00.playerTrainerId), name);
}
-s32 sub_80179D4(struct UnkStruct_Main0 *arg0, u8 arg1, u8 arg2, u32 playerGender)
+static s32 UnionRoomGetPlayerInteractionResponse(struct UnkStruct_Main0 *main0, bool8 overrideGender, u8 playerIdx, u32 playerGender)
{
- bool32 r2;
+ bool32 metBefore;
- struct UnkStruct_x20 * r5 = &arg0->arr[arg2];
+ struct UnkStruct_x20 * r5 = &main0->arr[playerIdx];
- if (!r5->unk.field_0.started && arg1 == 0)
+ if (!r5->gname_uname.gname.started && !overrideGender)
{
- sub_8018404(gStringVar1, r5);
- r2 = sub_800E540(ReadAsU16(r5->unk.field_0.unk_00.playerTrainerId), gStringVar1);
- if (r5->unk.field_0.activity == 0x45)
+ IntlConvPartnerUname7(gStringVar1, r5);
+ metBefore = PlayerHasMetTrainerBefore(ReadAsU16(r5->gname_uname.gname.unk_00.playerTrainerId), gStringVar1);
+ if (r5->gname_uname.gname.activity == (ACTIVITY_CHAT | IN_UNION_ROOM))
{
- StringExpandPlaceholders(gStringVar4, sJoinChatTexts[r2][playerGender]);
+ StringExpandPlaceholders(gStringVar4, sJoinChatTexts[metBefore][playerGender]);
return 2;
}
else
{
- sub_8017020(sCommunicatingWaitTexts[r2]);
+ UR_PrintFieldMessage(sCommunicatingWaitTexts[metBefore]);
return 1;
}
}
else
{
- sub_8018404(gStringVar1, r5);
- if (arg1 != 0)
+ IntlConvPartnerUname7(gStringVar1, r5);
+ if (overrideGender)
{
- playerGender = (r5->unk.field_0.unk_00.playerTrainerId[arg1 + 1] >> 3) & 1;
+ playerGender = (r5->gname_uname.gname.unk_00.playerTrainerId[overrideGender + 1] >> 3) & 1;
}
- switch (r5->unk.field_0.activity & 0x3F)
+ switch (r5->gname_uname.gname.activity & 0x3F)
{
- case 1:
- StringExpandPlaceholders(gStringVar4, sBattleReactionTexts[playerGender][Random() % 4]);
+ case ACTIVITY_BATTLE_SINGLE:
+ StringExpandPlaceholders(gStringVar4, sBattleReactionTexts[playerGender][Random() % ARRAY_COUNT(sBattleReactionTexts[0])]);
break;
- case 4:
+ case ACTIVITY_TRADE:
StringExpandPlaceholders(gStringVar4, sTradeReactionTexts[playerGender][Random() % 2]);
break;
- case 5:
- StringExpandPlaceholders(gStringVar4, sChatReactionTexts[playerGender][Random() % 4]);
+ case ACTIVITY_CHAT:
+ StringExpandPlaceholders(gStringVar4, sChatReactionTexts[playerGender][Random() % ARRAY_COUNT(sChatReactionTexts[0])]);
break;
- case 8:
- StringExpandPlaceholders(gStringVar4, sTrainerCardReactionTexts[playerGender][Random() % 2]);
+ case ACTIVITY_CARD:
+ StringExpandPlaceholders(gStringVar4, sTrainerCardReactionTexts[playerGender][Random() % ARRAY_COUNT(sTrainerCardReactionTexts[0])]);
break;
default:
StringExpandPlaceholders(gStringVar4, sText_TrainerAppearsBusy);
@@ -3903,73 +4067,73 @@ void nullsub_14(u8 windowId, s32 itemId, u8 y)
}
-void sub_8017B3C(u8 arg0, u8 arg1, struct GFtgtGname * arg2, const u8 * str, u8 arg4)
+static void TradeBoardPrintItemInfo(u8 windowId, u8 y, struct GFtgtGname * gname, const u8 * uname, u8 colorIdx)
{
- u8 sp8[4];
- u16 r8 = arg2->species;
- u8 r7 = arg2->type;
- u8 r9 = arg2->level;
+ u8 levelStr[4];
+ u16 species = gname->species;
+ u8 type = gname->type;
+ u8 level = gname->level;
- sub_80173E0(arg0, 1, str, 8, arg1, arg4);
- if (r8 == SPECIES_EGG)
+ UR_AddTextPrinterParameterized(windowId, 1, uname, 8, y, colorIdx);
+ if (species == SPECIES_EGG)
{
- sub_80173E0(arg0, 1, sText_EggTrade, 0x44, arg1, arg4);
+ UR_AddTextPrinterParameterized(windowId, 1, sText_EggTrade, 0x44, y, colorIdx);
}
else
{
- blit_move_info_icon(arg0, r7 + 1, 0x44, arg1);
- sub_80173E0(arg0, 1, gSpeciesNames[r8], 0x76, arg1, arg4);
- ConvertIntToDecimalStringN(sp8, r9, STR_CONV_MODE_RIGHT_ALIGN, 3);
- sub_80173E0(arg0, 1, sp8, 0xC6, arg1, arg4);
+ blit_move_info_icon(windowId, type + 1, 0x44, y);
+ UR_AddTextPrinterParameterized(windowId, 1, gSpeciesNames[species], 0x76, y, colorIdx);
+ ConvertIntToDecimalStringN(levelStr, level, STR_CONV_MODE_RIGHT_ALIGN, 3);
+ UR_AddTextPrinterParameterized(windowId, 1, levelStr, 0xC6, y, colorIdx);
}
}
-void sub_8017BE8(u8 windowId, s32 itemId, u8 y)
+static void TradeBoardListMenuItemPrintFunc(u8 windowId, s32 itemId, u8 y)
{
- struct UnkStruct_Leader *leader = gUnknown_02022C30.leader;
+ struct WirelessLink_Leader *data = sWirelessLinkMain.leader;
struct GFtgtGname *rfu;
s32 i, j;
- u8 sp4[11];
+ u8 playerName[11];
- if (itemId == -3 && y == gUnknown_082F03A4.upText_Y)
+ if (itemId == -3 && y == sTradeBoardListMenuTemplate.upText_Y)
{
- rfu = sub_800F7DC();
+ rfu = GetHostRFUtgtGname();
if (rfu->species != SPECIES_NONE)
{
- sub_8017B3C(windowId, y, rfu, gSaveBlock2Ptr->playerName, 5);
+ TradeBoardPrintItemInfo(windowId, y, rfu, gSaveBlock2Ptr->playerName, 5);
}
}
else
{
j = 0;
- for (i = 0; i < 8; i++)
+ for (i = 0; i < (int)ARRAY_COUNT(data->field_0->arr); i++)
{
- if (leader->field_0->arr[i].field_1A_0 == 1 && leader->field_0->arr[i].unk.field_0.species != SPECIES_NONE)
+ if (data->field_0->arr[i].groupScheduledAnim == UNION_ROOM_SPAWN_IN && data->field_0->arr[i].gname_uname.gname.species != SPECIES_NONE)
{
j++;
}
if (j == itemId + 1)
{
- sub_8018404(sp4, &leader->field_0->arr[i]);
- sub_8017B3C(windowId, y, &leader->field_0->arr[i].unk.field_0, sp4, 6);
+ IntlConvPartnerUname7(playerName, &data->field_0->arr[i]);
+ TradeBoardPrintItemInfo(windowId, y, &data->field_0->arr[i].gname_uname.gname, playerName, 6);
break;
}
}
}
}
-s32 sub_8017CB0(struct UnkStruct_x20 * arg, s32 arg1)
+static s32 GetIndexOfNthTradeBoardOffer(struct UnkStruct_x20 * arg, s32 n)
{
s32 i;
s32 j = 0;
for (i = 0; i < 8; i++)
{
- if (arg[i].field_1A_0 == 1 && arg[i].unk.field_0.species != SPECIES_NONE)
+ if (arg[i].groupScheduledAnim == UNION_ROOM_SPAWN_IN && arg[i].gname_uname.gname.species != SPECIES_NONE)
{
j++;
}
- if (j == arg1 + 1)
+ if (j == n + 1)
{
return i;
}
@@ -3978,12 +4142,12 @@ s32 sub_8017CB0(struct UnkStruct_x20 * arg, s32 arg1)
return -1;
}
-s32 sub_8017CF8(s32 arg1, struct UnkStruct_Main0 *arg0)
+static s32 GetUnionRoomPlayerGender(s32 playerIdx, struct UnkStruct_Main0 *main0)
{
- return arg0->arr[arg1].unk.field_0.playerGender;
+ return main0->arr[playerIdx].gname_uname.gname.playerGender;
}
-s32 sub_8017D04(u32 type, u32 species)
+static s32 IsRequestedTypeOrEggInPlayerParty(u32 type, u32 species)
{
s32 i;
@@ -3994,10 +4158,10 @@ s32 sub_8017D04(u32 type, u32 species)
species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
if (species == SPECIES_EGG)
{
- return 0;
+ return UR_TRADE_MATCH;
}
}
- return 2;
+ return UR_TRADE_NOEGG;
}
else
{
@@ -4006,77 +4170,77 @@ s32 sub_8017D04(u32 type, u32 species)
species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
if (gBaseStats[species].type1 == type || gBaseStats[species].type2 == type)
{
- return 0;
+ return UR_TRADE_MATCH;
}
}
- return 1;
+ return UR_TRADE_NOTYPE;
}
}
-void sub_8017D9C(u8 *dst, s32 arg1, u32 playerGender)
+static void GetURoomActivityRejectMsg(u8 *dst, s32 acitivty, u32 playerGender)
{
- switch (arg1)
+ switch (acitivty)
{
- case 0x41:
+ case ACTIVITY_BATTLE_SINGLE | IN_UNION_ROOM:
StringExpandPlaceholders(dst, sBattleDeclinedTexts[playerGender]);
break;
- case 0x45:
+ case ACTIVITY_CHAT | IN_UNION_ROOM:
StringExpandPlaceholders(dst, sChatDeclinedTexts[playerGender]);
break;
- case 0x44:
+ case ACTIVITY_TRADE | IN_UNION_ROOM:
StringExpandPlaceholders(dst, sText_TradeOfferRejected);
break;
- case 0x48:
+ case ACTIVITY_CARD | IN_UNION_ROOM:
StringExpandPlaceholders(dst, sShowTrainerCardDeclinedTexts[playerGender]);
break;
}
}
-void sub_8017E00(u8 *dst, u8 arg1)
+static void GetURoomActivityStartMsg(u8 *dst, u8 acitivty)
{
u8 mpId = GetMultiplayerId();
u8 gender = gLinkPlayers[mpId ^ 1].gender;
- switch (arg1)
+ switch (acitivty)
{
- case 0x41:
+ case ACTIVITY_BATTLE_SINGLE | IN_UNION_ROOM:
StringCopy(dst, sStartActivityTexts[mpId][gender][0]);
break;
- case 0x44:
+ case ACTIVITY_TRADE | IN_UNION_ROOM:
StringCopy(dst, sStartActivityTexts[mpId][gender][2]);
break;
- case 0x45:
+ case ACTIVITY_CHAT | IN_UNION_ROOM:
StringCopy(dst, sStartActivityTexts[mpId][gender][1]);
break;
}
}
-s32 sub_8017EA0(u8 *dst, u32 gender, u16 *arg2, struct UnkStruct_URoom *arg3)
+static s32 GetChatLeaderActionRequestMessage(u8 *dst, u32 gender, u16 *activityData, struct WirelessLink_URoom *uroom)
{
s32 result = 0;
u16 species = SPECIES_NONE;
s32 i;
- switch (arg2[0])
+ switch (activityData[0])
{
- case 0x41:
+ case ACTIVITY_BATTLE_SINGLE | IN_UNION_ROOM:
StringExpandPlaceholders(dst, sText_BattleChallenge);
result = 1;
break;
- case 0x45:
+ case ACTIVITY_CHAT | IN_UNION_ROOM:
StringExpandPlaceholders(dst, sText_ChatInvitation);
result = 1;
break;
- case 0x44:
- ConvertIntToDecimalStringN(arg3->field_58 + 0x00, sUnionRoomTrade.playerLevel, STR_CONV_MODE_LEFT_ALIGN, 3);
- StringCopy(arg3->field_58 + 0x10, gSpeciesNames[sUnionRoomTrade.playerSpecies]);
- for (i = 0; i < 4; i++)
+ case ACTIVITY_TRADE | IN_UNION_ROOM:
+ ConvertIntToDecimalStringN(uroom->activityRequestStrbufs[0], sUnionRoomTrade.playerLevel, STR_CONV_MODE_LEFT_ALIGN, 3);
+ StringCopy(uroom->activityRequestStrbufs[1], gSpeciesNames[sUnionRoomTrade.playerSpecies]);
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
if (gRfuLinkStatus->partner[i].serialNo == 2)
{
- ConvertIntToDecimalStringN(arg3->field_58 + 0x20, arg2[2], STR_CONV_MODE_LEFT_ALIGN, 3);
- StringCopy(arg3->field_58 + 0x30, gSpeciesNames[arg2[1]]);
- species = arg2[1];
+ ConvertIntToDecimalStringN(uroom->activityRequestStrbufs[2], activityData[2], STR_CONV_MODE_LEFT_ALIGN, 3);
+ StringCopy(uroom->activityRequestStrbufs[3], gSpeciesNames[activityData[1]]);
+ species = activityData[1];
break;
}
}
@@ -4086,19 +4250,19 @@ s32 sub_8017EA0(u8 *dst, u32 gender, u16 *arg2, struct UnkStruct_URoom *arg3)
}
else
{
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(i, arg3->field_58 + 0x10 * i);
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(i, uroom->activityRequestStrbufs[i]);
}
DynamicPlaceholderTextUtil_ExpandPlaceholders(dst, sText_OfferToTradeMon);
}
result = 1;
break;
- case 0x48:
+ case ACTIVITY_CARD | IN_UNION_ROOM:
StringExpandPlaceholders(dst, sText_ShowTrainerCard);
result = 1;
break;
- case 0x40:
+ case ACTIVITY_NONE | IN_UNION_ROOM:
StringExpandPlaceholders(dst, sText_ChatDropped);
result = 2;
break;
@@ -4107,18 +4271,18 @@ s32 sub_8017EA0(u8 *dst, u32 gender, u16 *arg2, struct UnkStruct_URoom *arg3)
return result;
}
-bool32 sub_8017FD8(struct UnkStruct_URoom *arg0)
+static bool32 PollPartnerYesNoResponse(struct WirelessLink_URoom *data)
{
if (gRecvCmds[0][1] != 0)
{
- if (gRecvCmds[0][1] == 0x51)
+ if (gRecvCmds[0][1] == (ACTIVITY_ACCEPT | IN_UNION_ROOM))
{
- arg0->field_98 = 0x51;
+ data->partnerYesNoResponse = ACTIVITY_ACCEPT | IN_UNION_ROOM;
return TRUE;
}
- else if (gRecvCmds[0][1] == 0x52)
+ else if (gRecvCmds[0][1] == (ACTIVITY_DECLINE | IN_UNION_ROOM))
{
- arg0->field_98 = 0x52;
+ data->partnerYesNoResponse = ACTIVITY_DECLINE | IN_UNION_ROOM;
return TRUE;
}
}
@@ -4132,7 +4296,7 @@ bool32 InUnionRoom(void)
? TRUE : FALSE;
}
-bool32 HasAtLeastTwoMonsOfLevel30OrLower(void)
+static bool32 HasAtLeastTwoMonsOfLevel30OrLower(void)
{
s32 i;
s32 count = 0;
@@ -4152,16 +4316,16 @@ bool32 HasAtLeastTwoMonsOfLevel30OrLower(void)
return FALSE;
}
-static void ResetUnionRoomTrade(struct UnionRoomTrade *arg0)
+static void ResetUnionRoomTrade(struct UnionRoomTrade *uroomTrade)
{
- arg0->field_0 = 0;
- arg0->type = 0;
- arg0->playerPersonality = 0;
- arg0->playerSpecies = 0;
- arg0->playerLevel = 0;
- arg0->species = 0;
- arg0->level = 0;
- arg0->personality = 0;
+ uroomTrade->state = URTRADE_STATE_NONE;
+ uroomTrade->type = 0;
+ uroomTrade->playerPersonality = 0;
+ uroomTrade->playerSpecies = 0;
+ uroomTrade->playerLevel = 0;
+ uroomTrade->species = 0;
+ uroomTrade->level = 0;
+ uroomTrade->personality = 0;
}
void Script_ResetUnionRoomTrade(void)
@@ -4228,36 +4392,36 @@ static u32 GetPartyPositionOfRegisteredMon(struct UnionRoomTrade *trade, u8 mult
return response;
}
-void sub_801818C(bool32 arg0)
+static void HandleCancelActivity(bool32 setData)
{
- sub_80173B0();
+ UR_ClearBg0();
ScriptContext2_Disable();
- sub_8098524();
- gUnknown_02022C2C = 0;
- if (arg0)
+ UnionRoom_UnlockPlayerAndChatPartner();
+ gPlayerCurrActivity = ACTIVITY_NONE;
+ if (setData)
{
- sub_8010FCC(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel);
- sub_8011090(0x40, 0, 0);
+ SetTradeBoardRegisteredMonInfo(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel);
+ UpdateGameData_SetActivity(ACTIVITY_NONE | IN_UNION_ROOM, 0, FALSE);
}
}
-void sub_80181CC(void)
+static void UR_EnableScriptContext2AndFreezeObjectEvents(void)
{
ScriptContext2_Enable();
ScriptFreezeObjectEvents();
}
-u8 sub_80181DC(struct UnkStruct_URoom *arg0)
+static u8 GetActivePartnerSpriteGenderParam(struct WirelessLink_URoom *data)
{
u8 retVal = 0x80;
u8 i;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < RFU_CHILD_MAX; i++)
{
- if (arg0->field_C->arr[i].unk18)
+ if (data->field_C->arr[i].active)
{
- retVal |= arg0->field_C->arr[i].unk0.field_0.playerGender << 3;
- retVal |= arg0->field_C->arr[i].unk0.field_0.unk_00.playerTrainerId[0] & 7;
+ retVal |= data->field_C->arr[i].gname_uname.gname.playerGender << 3;
+ retVal |= data->field_C->arr[i].gname_uname.gname.unk_00.playerTrainerId[0] & 7;
break;
}
}
@@ -4265,7 +4429,7 @@ u8 sub_80181DC(struct UnkStruct_URoom *arg0)
return retVal;
}
-void sub_8018220(u8 *unused, struct UnkStruct_URoom *arg1, bool8 arg2)
+static void ViewURoomPartnerTrainerCard(u8 *unused, struct WirelessLink_URoom *data, bool8 isParent)
{
struct TrainerCard *trainerCard = &gTrainerCards[GetMultiplayerId() ^ 1];
s32 i;
@@ -4273,67 +4437,67 @@ void sub_8018220(u8 *unused, struct UnkStruct_URoom *arg1, bool8 arg2)
DynamicPlaceholderTextUtil_Reset();
- StringCopy(arg1->field_C0[0], gTrainerClassNames[sub_8068BB0()]);
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, arg1->field_C0[0]);
+ StringCopy(data->trainerCardStrBuffer[0], gTrainerClassNames[GetUnionRoomTrainerClass()]);
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, data->trainerCardStrBuffer[0]);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, trainerCard->playerName);
- StringCopy(arg1->field_174, sCardColorTexts[trainerCard->stars]);
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, arg1->field_174);
+ StringCopy(data->trainerCardColorStrBuffer, sCardColorTexts[trainerCard->stars]);
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, data->trainerCardColorStrBuffer);
- ConvertIntToDecimalStringN(arg1->field_C0[2], trainerCard->caughtMonsCount, STR_CONV_MODE_LEFT_ALIGN, 3);
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, arg1->field_C0[2]);
+ ConvertIntToDecimalStringN(data->trainerCardStrBuffer[2], trainerCard->caughtMonsCount, STR_CONV_MODE_LEFT_ALIGN, 3);
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, data->trainerCardStrBuffer[2]);
- ConvertIntToDecimalStringN(arg1->field_C0[3], trainerCard->playTimeHours, STR_CONV_MODE_LEFT_ALIGN, 3);
- ConvertIntToDecimalStringN(arg1->field_C0[4], trainerCard->playTimeMinutes, STR_CONV_MODE_LEADING_ZEROS, 2);
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(4, arg1->field_C0[3]);
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(5, arg1->field_C0[4]);
+ ConvertIntToDecimalStringN(data->trainerCardStrBuffer[3], trainerCard->playTimeHours, STR_CONV_MODE_LEFT_ALIGN, 3);
+ ConvertIntToDecimalStringN(data->trainerCardStrBuffer[4], trainerCard->playTimeMinutes, STR_CONV_MODE_LEADING_ZEROS, 2);
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(4, data->trainerCardStrBuffer[3]);
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(5, data->trainerCardStrBuffer[4]);
- DynamicPlaceholderTextUtil_ExpandPlaceholders(arg1->field_1A4, sText_TrainerCardInfoPage1);
- StringCopy(gStringVar4, arg1->field_1A4);
+ DynamicPlaceholderTextUtil_ExpandPlaceholders(data->trainerCardMsgStrBuffer, sText_TrainerCardInfoPage1);
+ StringCopy(gStringVar4, data->trainerCardMsgStrBuffer);
n = trainerCard->linkBattleWins;
if (n > 9999)
{
n = 9999;
}
- ConvertIntToDecimalStringN(arg1->field_C0[0], n, STR_CONV_MODE_LEFT_ALIGN, 4);
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, arg1->field_C0[0]);
+ ConvertIntToDecimalStringN(data->trainerCardStrBuffer[0], n, STR_CONV_MODE_LEFT_ALIGN, 4);
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, data->trainerCardStrBuffer[0]);
n = trainerCard->linkBattleLosses;
if (n > 9999)
{
n = 9999;
}
- ConvertIntToDecimalStringN(arg1->field_C0[1], n, STR_CONV_MODE_LEFT_ALIGN, 4);
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, arg1->field_C0[1]);
+ ConvertIntToDecimalStringN(data->trainerCardStrBuffer[1], n, STR_CONV_MODE_LEFT_ALIGN, 4);
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, data->trainerCardStrBuffer[1]);
- ConvertIntToDecimalStringN(arg1->field_C0[2], trainerCard->pokemonTrades, STR_CONV_MODE_LEFT_ALIGN, 5);
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, arg1->field_C0[2]);
+ ConvertIntToDecimalStringN(data->trainerCardStrBuffer[2], trainerCard->pokemonTrades, STR_CONV_MODE_LEFT_ALIGN, 5);
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, data->trainerCardStrBuffer[2]);
for (i = 0; i < TRAINER_CARD_PROFILE_LENGTH; i++)
{
- CopyEasyChatWord(arg1->field_C0[i + 3], trainerCard->easyChatProfile[i]);
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(i + 4, arg1->field_C0[i + 3]);
+ CopyEasyChatWord(data->trainerCardStrBuffer[i + 3], trainerCard->easyChatProfile[i]);
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(i + 4, data->trainerCardStrBuffer[i + 3]);
}
- DynamicPlaceholderTextUtil_ExpandPlaceholders(arg1->field_1A4, sText_TrainerCardInfoPage2);
- StringAppend(gStringVar4, arg1->field_1A4);
+ DynamicPlaceholderTextUtil_ExpandPlaceholders(data->trainerCardMsgStrBuffer, sText_TrainerCardInfoPage2);
+ StringAppend(gStringVar4, data->trainerCardMsgStrBuffer);
- if (arg2 == TRUE)
+ if (isParent == TRUE)
{
- DynamicPlaceholderTextUtil_ExpandPlaceholders(arg1->field_1A4, sText_FinishedCheckingPlayersTrainerCard);
- StringAppend(gStringVar4, arg1->field_1A4);
+ DynamicPlaceholderTextUtil_ExpandPlaceholders(data->trainerCardMsgStrBuffer, sText_FinishedCheckingPlayersTrainerCard);
+ StringAppend(gStringVar4, data->trainerCardMsgStrBuffer);
}
- else if (arg2 == FALSE)
+ else if (isParent == FALSE)
{
- DynamicPlaceholderTextUtil_ExpandPlaceholders(arg1->field_1A4, sGladToMeetYouTexts[trainerCard->gender]);
- StringAppend(gStringVar4, arg1->field_1A4);
+ DynamicPlaceholderTextUtil_ExpandPlaceholders(data->trainerCardMsgStrBuffer, sGladToMeetYouTexts[trainerCard->gender]);
+ StringAppend(gStringVar4, data->trainerCardMsgStrBuffer);
}
}
-void sub_8018404(u8 *dest, struct UnkStruct_x20 *arg1)
+static void IntlConvPartnerUname7(u8 *dest, struct UnkStruct_x20 *arg1)
{
- StringCopy7(dest, arg1->unk.playerName);
- ConvertInternationalString(dest, arg1->unk.field_0.unk_00.language);
+ StringCopy7(dest, arg1->gname_uname.playerName);
+ ConvertInternationalString(dest, arg1->gname_uname.gname.unk_00.language);
}
diff --git a/src/union_room_battle.c b/src/union_room_battle.c
index d2c3a5cd0..4b2aa0bb1 100644
--- a/src/union_room_battle.c
+++ b/src/union_room_battle.c
@@ -11,134 +11,24 @@
#include "window.h"
#include "text_window.h"
#include "scanline_effect.h"
-#include "m4a.h"
-#include "dynamic_placeholder_text_util.h"
#include "overworld.h"
#include "strings.h"
-#include "string_util.h"
-#include "international_string_util.h"
-#include "sound.h"
-#include "constants/songs.h"
#include "party_menu.h"
#include "battle_setup.h"
#include "link.h"
#include "union_room.h"
#include "union_room_battle.h"
+#include "constants/rgb.h"
+#include "constants/trainers.h"
-struct UnkStruct_3000DAC
+struct UnionRoomBattle
{
- /*0x00*/ u32 unk00[4];
- /*0x10*/ u32 unk10[4];
- /*0x20*/ u32 unk20[16];
- /*0x60*/ u8 taskId;
- /*0x61*/ u8 unk61;
- /*0x62*/ u8 filler_62[10];
+ s16 textState;
};
-struct UnkStruct_2022C6C
-{
- s16 a0;
-};
-
-static struct UnkStruct_3000DAC * gUnknown_03000DAC;
-
-EWRAM_DATA struct UnkStruct_2022C6C * gUnknown_02022C6C = NULL;
-
-void sub_801A43C(void);
-void sub_801A6C0(u8 taskId);
-static void sub_801A8B0(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 mode);
-bool32 sub_801AA30(u32 * a0, u32 * a1, u32 * a2, u8 taskId);
-
-const u16 gWirelessInfoScreenPal[] = INCBIN_U16("graphics/interface/wireless_info_screen.gbapal");
-const u32 gWirelessInfoScreenGfx[] = INCBIN_U32("graphics/interface/wireless_info_screen.4bpp.lz");
-const u32 gWirelessInfoScreenTilemap[] = INCBIN_U32("graphics/interface/wireless_info_screen.bin.lz");
-
-const struct BgTemplate gUnknown_082F0D34[] = {
- {
- .bg = 0,
- .charBaseIndex = 2,
- .mapBaseIndex = 0x1F,
- .priority = 0
- }, {
- .bg = 1,
- .charBaseIndex = 0,
- .mapBaseIndex = 0x08,
- .priority = 1
- }
-};
-
-const struct WindowTemplate gUnknown_082F0D3C[] = {
- {
- .bg = 0x00,
- .tilemapLeft = 0x03,
- .tilemapTop = 0x00,
- .width = 0x18,
- .height = 0x03,
- .paletteNum = 0x0f,
- .baseBlock = 0x0001
- }, {
- .bg = 0x00,
- .tilemapLeft = 0x03,
- .tilemapTop = 0x04,
- .width = 0x15,
- .height = 0x0f,
- .paletteNum = 0x0f,
- .baseBlock = 0x0049
- }, {
- .bg = 0x00,
- .tilemapLeft = 0x18,
- .tilemapTop = 0x04,
- .width = 0x03,
- .height = 0x0f,
- .paletteNum = 0x0f,
- .baseBlock = 0x0184
- },
- { 0xFF }
-};
+static EWRAM_DATA struct UnionRoomBattle * sBattle = NULL;
-const u8 *const gUnknown_082F0D5C[] = {
- gText_WirelessCommStatus,
- gText_PeopleTrading,
- gText_PeopleBattling,
- gText_PeopleInUnionRoom,
- gText_PeopleCommunicating
-};
-
-const u8 gUnknown_082F0D70[][3] = {
- {0x01, 0x01, 0x02},
- {0x02, 0x01, 0x02},
- {0x03, 0x01, 0x04},
- {0x04, 0x00, 0x02},
- {0x06, 0x03, 0x02},
- {0x07, 0x03, 0x02},
- {0x09, 0x03, 0x00},
- {0x0a, 0x03, 0x00},
- {0x0b, 0x03, 0x00},
- {0x0c, 0xff, 0x00},
- {0x0d, 0x00, 0x00},
- {0x10, 0x03, 0x00},
- {0x0f, 0x03, 0x00},
- {0x40, 0x02, 0x01},
- {0x41, 0x02, 0x02},
- {0x44, 0x02, 0x02},
- {0x45, 0x02, 0x00},
- {0x48, 0x02, 0x02},
- {0x54, 0x02, 0x01},
- {0x53, 0x02, 0x02},
- {0x51, 0x02, 0x01},
- {0x52, 0x02, 0x01},
- {0x15, 0x03, 0x02},
- {0x16, 0x03, 0x02},
- {0x17, 0x03, 0x00},
- {0x18, 0x03, 0x00},
- {0x19, 0x03, 0x00},
- {0x1a, 0x03, 0x00},
- {0x1b, 0x03, 0x00},
- {0x1c, 0x01, 0x02},
- {0x0e, 0x01, 0x02}
-};
-
-const struct BgTemplate gUnknown_082F0DD0[] = {
+static const struct BgTemplate sBgTemplates[] = {
{
.bg = 0,
.charBaseIndex = 3,
@@ -146,7 +36,7 @@ const struct BgTemplate gUnknown_082F0DD0[] = {
}
};
-const struct WindowTemplate gUnknown_082F0DD4[] = {
+static const struct WindowTemplate sWindowTemplates[] = {
{
.bg = 0,
.tilemapLeft = 3,
@@ -156,301 +46,15 @@ const struct WindowTemplate gUnknown_082F0DD4[] = {
.paletteNum = 0xE,
.baseBlock = 0x014
},
- { 0xFF }
+ DUMMY_WIN_TEMPLATE
};
-const u8 gUnknown_082F0DE4[] = { 1, 2, 3 };
-
-void sub_801A3F4(void)
-{
- if (!IsDma3ManagerBusyWithBgCopy())
- {
- RunTasks();
- RunTextPrinters();
- AnimateSprites();
- BuildOamBuffer();
- UpdatePaletteFade();
- }
-}
-
-void sub_801A418(void)
-{
- LoadOam();
- ProcessSpriteCopyRequests();
- TransferPlttBuffer();
-}
-
-void sub_801A42C(void)
-{
- SetMainCallback2(sub_801A43C);
-}
-
-void sub_801A43C(void)
-{
- SetGpuReg(REG_OFFSET_DISPCNT, 0x0000);
- gUnknown_03000DAC = AllocZeroed(sizeof(struct UnkStruct_3000DAC));
- SetVBlankCallback(NULL);
- ResetBgsAndClearDma3BusyFlags(0);
- InitBgsFromTemplates(0, gUnknown_082F0D34, ARRAY_COUNT(gUnknown_082F0D34));
- SetBgTilemapBuffer(1, Alloc(0x800));
- SetBgTilemapBuffer(0, Alloc(0x800));
- DecompressAndLoadBgGfxUsingHeap(1, gWirelessInfoScreenGfx, 0, 0, 0);
- CopyToBgTilemapBuffer(1, gWirelessInfoScreenTilemap, 0, 0);
- InitWindows(gUnknown_082F0D3C);
- DeactivateAllTextPrinters();
- ResetPaletteFade();
- ResetSpriteData();
- ResetTasks();
- ScanlineEffect_Stop();
- m4aSoundVSyncOn();
- SetVBlankCallback(sub_801A418);
- gUnknown_03000DAC->taskId = CreateTask(sub_801A6C0, 0);
- gUnknown_03000DAC->unk61 = sub_8013C40();
- gUnknown_03000DAC->unk10[3] = 1;
- ChangeBgX(0, 0, 0);
- ChangeBgY(0, 0, 0);
- ChangeBgX(1, 0, 0);
- ChangeBgY(1, 0, 0);
- LoadPalette(gWirelessInfoScreenPal, 0x00, 0x20);
- Menu_LoadStdPalAt(0xF0);
- DynamicPlaceholderTextUtil_Reset();
- FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 0x0F);
- CopyBgTilemapBufferToVram(1);
- SetMainCallback2(sub_801A3F4);
- RunTasks();
- RunTextPrinters();
- AnimateSprites();
- BuildOamBuffer();
- UpdatePaletteFade();
-}
-
-void sub_801A584(void)
-{
- s32 i;
- FreeAllWindowBuffers();
- for (i = 0; i < 2; i++)
- {
- Free(GetBgTilemapBuffer(i));
- }
- Free(gUnknown_03000DAC);
- SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
-}
-
-void sub_801A5BC(s16 * a0, s16 * a1)
-{
- if (++(*a0) > 5)
- {
- if (++(*a1) == 14)
- {
- *a1 = 0;
- }
- *a0 = 0;
- }
- LoadPalette(gWirelessInfoScreenPal + 16 * (*a1 + 2), 0, 0x10);
-}
+static const u8 sTextColors[] = { TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY };
-void sub_801A600(void)
+static void CB2_SetUpPartiesAndStartBattle(void)
{
s32 i;
- FillWindowPixelBuffer(0, 0);
- FillWindowPixelBuffer(1, 0);
- FillWindowPixelBuffer(2, 0);
- sub_801A8B0(0, 1, gUnknown_082F0D5C[0], GetStringCenterAlignXOffset(1, gUnknown_082F0D5C[0], 0xC0), 6, 3);
- for (i = 0; i < 3; i++)
- {
- sub_801A8B0(1, 1, gUnknown_082F0D5C[i + 1], 0, 30 * i + 8, 1);
- }
- sub_801A8B0(1, 1, gUnknown_082F0D5C[i + 1], 0, 30 * i + 8, 2);
- PutWindowTilemap(0);
- CopyWindowToVram(0, 2);
- PutWindowTilemap(1);
- CopyWindowToVram(1, 2);
-}
-
-void sub_801A6C0(u8 taskId)
-{
- s32 i;
- switch (gTasks[taskId].data[0])
- {
- case 0:
- sub_801A600();
- gTasks[taskId].data[0]++;
- break;
- case 1:
- BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0);
- ShowBg(1);
- CopyBgTilemapBufferToVram(0);
- ShowBg(0);
- gTasks[taskId].data[0]++;
- break;
- case 2:
- if (!gPaletteFade.active)
- {
- gTasks[taskId].data[0]++;
- }
- break;
- case 3:
- if (sub_801AA30(gUnknown_03000DAC->unk00, gUnknown_03000DAC->unk10, gUnknown_03000DAC->unk20, gUnknown_03000DAC->unk61))
- {
- FillWindowPixelBuffer(2, 0);
- for (i = 0; i < 4; i++)
- {
- ConvertIntToDecimalStringN(gStringVar4, gUnknown_03000DAC->unk00[i], STR_CONV_MODE_RIGHT_ALIGN, 2);
- if (i != 3)
- {
- sub_801A8B0(2, 1, gStringVar4, 12, 30 * i + 8, 1);
- }
- else
- {
- sub_801A8B0(2, 1, gStringVar4, 12, 98, 2);
- }
- }
- PutWindowTilemap(2);
- CopyWindowToVram(2, 3);
- }
- if (({gMain.newKeys & A_BUTTON;}) || ({gMain.newKeys & B_BUTTON;}))
- {
- PlaySE(SE_SELECT);
- gTasks[gUnknown_03000DAC->unk61].data[15] = 0xFF;
- gTasks[taskId].data[0]++;
- }
- sub_801A5BC(&gTasks[taskId].data[7], &gTasks[taskId].data[8]);
- break;
- case 4:
- BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
- gTasks[taskId].data[0]++;
- break;
- case 5:
- if (!gPaletteFade.active)
- {
- SetMainCallback2(sub_801A584);
- DestroyTask(taskId);
- }
- break;
- }
-}
-
-static void sub_801A8B0(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 mode)
-{
- u8 color[3];
-
- switch (mode)
- {
- case 0:
- color[0] = 0;
- color[1] = 2;
- color[2] = 3;
- break;
- case 1:
- color[0] = 0;
- color[1] = 1;
- color[2] = 3;
- break;
- case 2:
- color[0] = 0;
- color[1] = 4;
- color[2] = 5;
- break;
- case 3:
- color[0] = 0;
- color[1] = 7;
- color[2] = 6;
- break;
- case 4:
- color[0] = 0;
- color[1] = 1;
- color[2] = 2;
- break;
- }
-
- AddTextPrinterParameterized4(windowId, fontId, x, y, 0, 0, color, -1, str);
-}
-
-u32 sub_801A960(struct UnkStruct_x20 * a0, u32 * a1)
-{
- s32 i, j, r2;
- u32 result = a0->unk.field_0.activity;
-
- for (i = 0; i < (unsigned)ARRAY_COUNT(gUnknown_082F0D70); i++)
- {
- if (result != gUnknown_082F0D70[i][0])
- {
- continue;
- }
- if (a0->field_1A_0 != 1)
- {
- continue;
- }
- if (gUnknown_082F0D70[i][2] == 0)
- {
- r2 = 0;
- for (j = 0; j < 4; j++)
- {
- if (a0->unk.field_0.child_sprite_gender[j] != 0)
- {
- r2++;
- }
- }
- r2++;
- a1[gUnknown_082F0D70[i][1]] += r2;
- }
- else
- {
- a1[gUnknown_082F0D70[i][1]] += gUnknown_082F0D70[i][2];
- }
- }
- return result;
-}
-
-bool32 sub_801AA08(u32 * a0, u32 * a1)
-{
- s32 i;
- for (i = 0; i < 4; i++)
- {
- if (a0[i] != a1[i])
- {
- return TRUE;
- }
- }
- return FALSE;
-}
-
-bool32 sub_801AA30(u32 * a0, u32 * a1, u32 * a2, u8 taskId)
-{
- bool32 r8 = FALSE;
- u32 sp0[4] = {0, 0, 0, 0};
- struct UnkStruct_x20 ** data = (void *)gTasks[taskId].data;
- s32 i;
-
- for (i = 0; i < 16; i++)
- {
- u32 r1 = sub_801A960(&(*data)[i], sp0);
- if (r1 != a2[i])
- {
- a2[i] = r1;
- r8 = TRUE;
- }
- }
- if (sub_801AA08(sp0, a1) == 0)
- {
- if (r8 != TRUE)
- {
- return FALSE;
- }
- }
- else
- {
- memcpy(a0, sp0, sizeof(sp0));
- memcpy(a1, sp0, sizeof(sp0));
- a0[3] = a0[0] + a0[1] + a0[2] + a0[3];
- }
- return TRUE;
-}
-
-void sub_801AAD4(void)
-{
- s32 i;
- sub_8014210(10);
+ StartUnionRoomBattle(BATTLE_TYPE_LINK | BATTLE_TYPE_TRAINER);
for (i = 0; i < UNION_ROOM_PARTY_SIZE; i++)
{
gEnemyParty[i] = gPlayerParty[gSelectedOrderFromParty[i] - 1];
@@ -465,25 +69,25 @@ void sub_801AAD4(void)
}
IncrementGameStat(GAME_STAT_NUM_UNION_ROOM_BATTLES);
CalculatePlayerPartyCount();
- gTrainerBattleOpponent_A = 0xC00;
+ gTrainerBattleOpponent_A = TRAINER_UNION_ROOM;
SetMainCallback2(CB2_InitBattle);
}
-void sub_801AB68(u8 windowId, const u8 * str, u8 x, u8 y, s32 speed)
+static void AddTextPrinterForUnionRoomBattle(u8 windowId, const u8 * str, u8 x, u8 y, s32 speed)
{
s32 letterSpacing = 0;
s32 lineSpacing = 1;
- FillWindowPixelBuffer(windowId, (gUnknown_082F0DE4[0] << 4) | gUnknown_082F0DE4[0]);
- AddTextPrinterParameterized4(windowId, 1, x, y, letterSpacing, lineSpacing, gUnknown_082F0DE4, speed, str);
+ FillWindowPixelBuffer(windowId, (sTextColors[0] << 4) | sTextColors[0]);
+ AddTextPrinterParameterized4(windowId, 1, x, y, letterSpacing, lineSpacing, sTextColors, speed, str);
}
-bool32 sub_801ABDC(s16 * state, const u8 * str, s32 speed)
+static bool32 PrintUnionRoomBattleMessage(s16 * state, const u8 * str, s32 speed)
{
switch (*state)
{
case 0:
DrawTextBorderOuter(0, 0x001, 0xD);
- sub_801AB68(0, str, 0, 1, speed);
+ AddTextPrinterForUnionRoomBattle(0, str, 0, 1, speed);
PutWindowTilemap(0);
CopyWindowToVram(0, 3);
(*state)++;
@@ -499,49 +103,47 @@ bool32 sub_801ABDC(s16 * state, const u8 * str, s32 speed)
return FALSE;
}
-void sub_801AC40(void)
+static void VBlankCB_UnionRoomBattle(void)
{
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
-void sub_801AC54(void)
+void CB2_UnionRoomBattle(void)
{
switch (gMain.state)
{
case 0:
SetGpuReg(REG_OFFSET_DISPCNT, 0x0000);
- gUnknown_02022C6C = AllocZeroed(4);
+ sBattle = AllocZeroed(sizeof(struct UnionRoomBattle));
ResetSpriteData();
FreeAllSpritePalettes();
ResetTasks();
ResetBgsAndClearDma3BusyFlags(0);
- InitBgsFromTemplates(0, gUnknown_082F0DD0, 1);
+ InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates));
ResetTempTileDataBuffers();
- if (!InitWindows(gUnknown_082F0DD4))
- {
+ if (!InitWindows(sWindowTemplates))
return;
- }
DeactivateAllTextPrinters();
ClearWindowTilemap(0);
- FillWindowPixelBuffer(0, 0x00);
- FillWindowPixelBuffer(0, 0x11);
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
+ FillWindowPixelBuffer(0, PIXEL_FILL(1));
FillBgTilemapBufferRect(0, 0, 0, 0, 30, 20, 0xF);
LoadUserWindowBorderGfx(0, 1, 0xD0);
LoadUserWindowBorderGfx_(0, 1, 0xD0);
sub_819789C();
- SetVBlankCallback(sub_801AC40);
+ SetVBlankCallback(VBlankCB_UnionRoomBattle);
gMain.state++;
break;
case 1:
- if (sub_801ABDC(&gUnknown_02022C6C->a0, gText_CommStandbyAwaitingOtherPlayer, 0))
+ if (PrintUnionRoomBattleMessage(&sBattle->textState, gText_CommStandbyAwaitingOtherPlayer, 0))
{
gMain.state++;
}
break;
case 2:
- BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0);
+ BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK);
ShowBg(0);
gMain.state++;
break;
@@ -551,11 +153,11 @@ void sub_801AC54(void)
memset(gBlockSendBuffer, 0, 0x20);
if (gSelectedOrderFromParty[0] == -gSelectedOrderFromParty[1])
{
- gBlockSendBuffer[0] = 0x52;
+ gBlockSendBuffer[0] = ACTIVITY_DECLINE | IN_UNION_ROOM;
}
else
{
- gBlockSendBuffer[0] = 0x51;
+ gBlockSendBuffer[0] = ACTIVITY_ACCEPT | IN_UNION_ROOM;
}
SendBlock(0, gBlockSendBuffer, 0x20);
gMain.state++;
@@ -564,15 +166,16 @@ void sub_801AC54(void)
case 4:
if (GetBlockReceivedStatus() == 3)
{
- if (gBlockRecvBuffer[0][0] == 0x51 && gBlockRecvBuffer[1][0] == 0x51)
+ if (gBlockRecvBuffer[0][0] == (ACTIVITY_ACCEPT | IN_UNION_ROOM)
+ && gBlockRecvBuffer[1][0] == (ACTIVITY_ACCEPT | IN_UNION_ROOM))
{
- BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
+ BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
gMain.state = 50;
}
else
{
sub_800AC34();
- if (gBlockRecvBuffer[GetMultiplayerId()][0] == 0x52)
+ if (gBlockRecvBuffer[GetMultiplayerId()][0] == (ACTIVITY_DECLINE | IN_UNION_ROOM))
{
gMain.state = 6;
}
@@ -594,29 +197,29 @@ void sub_801AC54(void)
case 51:
if (IsLinkTaskFinished())
{
- SetMainCallback2(sub_801AAD4);
+ SetMainCallback2(CB2_SetUpPartiesAndStartBattle);
}
break;
case 6:
- if (gReceivedRemoteLinkPlayers == 0)
+ if (!gReceivedRemoteLinkPlayers)
{
gMain.state++;
}
break;
case 7:
- if (sub_801ABDC(&gUnknown_02022C6C->a0, gText_RefusedBattle, 1))
+ if (PrintUnionRoomBattleMessage(&sBattle->textState, gText_RefusedBattle, 1))
{
SetMainCallback2(CB2_ReturnToField);
}
break;
case 8:
- if (gReceivedRemoteLinkPlayers == 0)
+ if (!gReceivedRemoteLinkPlayers)
{
gMain.state++;
}
break;
case 9:
- if (sub_801ABDC(&gUnknown_02022C6C->a0, gText_BattleWasRefused, 1))
+ if (PrintUnionRoomBattleMessage(&sBattle->textState, gText_BattleWasRefused, 1))
{
SetMainCallback2(CB2_ReturnToField);
}
diff --git a/src/union_room_chat.c b/src/union_room_chat.c
index 16d05d0ef..fefb285a8 100755
--- a/src/union_room_chat.c
+++ b/src/union_room_chat.c
@@ -27,256 +27,446 @@
#include "constants/rgb.h"
#include "constants/songs.h"
+enum
+{
+ UNION_ROOM_KB_PAGE_UPPER,
+ UNION_ROOM_KB_PAGE_LOWER,
+ UNION_ROOM_KB_PAGE_EMOJI,
+ UNION_ROOM_KB_PAGE_REGISTER,
+ UNION_ROOM_KB_PAGE_COUNT,
+};
+
+#define MAX_MESSAGE_LENGTH 15
+
+enum {
+ CHAT_MESSAGE_NONE,
+ CHAT_MESSAGE_CHAT,
+ CHAT_MESSAGE_JOIN,
+ CHAT_MESSAGE_LEAVE,
+ CHAT_MESSAGE_DROP,
+ CHAT_MESSAGE_DISBAND,
+};
+
+enum {
+ STDMESSAGE_QUIT_CHATTING,
+ STDMESSAGE_REGISTER_WHERE,
+ STDMESSAGE_REGISTER_HERE,
+ STDMESSAGE_INPUT_TEXT,
+ STDMESSAGE_EXITING_CHAT,
+ STDMESSAGE_LEADER_LEFT,
+ STDMESSAGE_ASK_SAVE,
+ STDMESSAGE_ASK_OVERWRITE,
+ STDMESSAGE_SAVING_NO_OFF,
+ STDMESSAGE_SAVED_THE_GAME,
+ STDMESSAGE_WARN_LEADER_LEAVE,
+};
+
+enum {
+ CHAT_FUNC_JOIN,
+ CHAT_FUNC_HANDLE_INPUT,
+ CHAT_FUNC_SWITCH,
+ CHAT_FUNC_ASK_QUIT,
+ CHAT_FUNC_SEND,
+ CHAT_FUNC_REGISTER,
+ CHAT_FUNC_EXIT,
+ CHAT_FUNC_DROP,
+ CHAT_FUNC_DISBANDED,
+ CHAT_FUNC_SAVE_AND_EXIT,
+};
+
+enum {
+ CHATDISPLAY_FUNC_LOAD_GFX,
+ CHATDISPLAY_FUNC_MOVE_KB_CURSOR,
+ CHATDISPLAY_FUNC_CURSOR_BLINK,
+ CHATDISPLAY_FUNC_SHOW_KB_SWAP_MENU,
+ CHATDISPLAY_FUNC_HIDE_KB_SWAP_MENU,
+ CHATDISPLAY_FUNC_SWITCH_PAGES,
+ CHATDISPLAY_FUNC_ASK_QUIT_CHATTING,
+ CHATDISPLAY_FUNC_DESTROY_YESNO,
+ CHATDISPLAY_FUNC_UPDATE_MSG,
+ CHATDISPLAY_FUNC_ASK_REGISTER_TEXT,
+ CHATDISPLAY_FUNC_CANCEL_REGISTER,
+ CHATDISPLAY_FUNC_RETURN_TO_KB,
+ CHATDISPLAY_FUNC_SCROLL_CHAT,
+ CHATDISPLAY_FUNC_PRINT_INPUT_TEXT,
+ CHATDISPLAY_FUNC_ASK_SAVE,
+ CHATDISPLAY_FUNC_ASK_OVERWRITE_SAVE,
+ CHATDISPLAY_FUNC_PRINT_SAVING,
+ CHATDISPLAY_FUNC_PRINT_SAVED_GAME,
+ CHATDISPLAY_FUNC_PRINT_EXITING_CHAT,
+ CHATDISPLAY_FUNC_PRINT_LEADER_LEFT,
+ CHATDISPLAY_FUNC_ASK_CONFIRM_LEADER_LEAVE,
+};
+
+enum {
+ CHAT_EXIT_NONE,
+ CHAT_EXIT_ONLY_LEADER,
+ CHAT_EXIT_DROPPED,
+ CHAT_EXIT_DISBANDED,
+};
+
struct UnionRoomChat
{
- u8 filler0[0x4];
- u16 unk4;
- u16 unk6;
- u8 filler8[0x2];
- u16 unkA;
- u8 fillerC[0x1];
- u8 unkD;
- u8 unkE;
- u8 unkF;
+ u32 filler1;
+ u16 funcId;
+ u16 funcState;
+ u16 filler2;
+ u16 exitDelayTimer;
+ u8 filler3;
+ u8 linkPlayerCount;
+ u8 handleInputTask;
+ u8 receiveMessagesTask;
u8 currentPage;
- u8 unk11;
+ u8 currentCol;
u8 currentRow;
- u8 unk13;
- u8 unk14;
- u8 unk15;
- u8 unk16;
- u8 unk17;
- u8 unk18;
- u8 unk19;
- u8 unk1A[0x1F];
- u8 unk39[0x40];
- u8 unk79[0x40];
- u8 unkB9[UNION_ROOM_KB_ROW_COUNT][21];
- u8 filler18B[0x5];
- u8 unk190[0x28];
- u16 unk1B8;
+ u8 multiplayerId;
+ u8 lastBufferCursorPos;
+ u8 bufferCursorPos;
+ u8 receivedPlayerIndex;
+ u8 exitType;
+ bool8 changedRegisteredTexts;
+ u8 afterSaveTimer;
+ u8 messageEntryBuffer[2 * MAX_MESSAGE_LENGTH + 1];
+ u8 receivedMessage[64];
+ u8 hostName[64];
+ u8 registeredTexts[UNION_ROOM_KB_ROW_COUNT][21];
+ u8 filler4[5];
+ u8 sendMessageBuffer[40];
+ u16 tryQuitAgainTimer;
};
-struct UnionRoomChat2_Unk0
+struct UnionRoomChatDisplay_Subtask
{
- bool32 (* unk0)(u8 *);
- u8 unk4;
- u8 unk5;
+ bool32 (* callback)(u8 *);
+ bool8 active;
+ u8 state;
};
-struct UnionRoomChat2
-{
- struct UnionRoomChat2_Unk0 unk0[3];
- u16 unk18;
- u16 unk1A;
- u16 unk1C;
- u16 unk1E;
- s16 unk20;
- u8 unk22[0x106];
- u8 unk128[BG_SCREEN_SIZE];
- u8 unk928[BG_SCREEN_SIZE];
- u8 unk1128[BG_SCREEN_SIZE];
- u8 unk1928[BG_SCREEN_SIZE];
+struct UnionRoomChatDisplay
+{
+ struct UnionRoomChatDisplay_Subtask subtasks[3];
+ u16 yesNoMenuWindowId;
+ u16 currLine;
+ u16 scrollCount;
+ u16 messageWindowId;
+ s16 bg1hofs;
+ u8 expandedPlaceholdersBuffer[0x106];
+ u8 bg0Buffer[BG_SCREEN_SIZE];
+ u8 bg1Buffer[BG_SCREEN_SIZE];
+ u8 bg3Buffer[BG_SCREEN_SIZE];
+ u8 bg2Buffer[BG_SCREEN_SIZE];
u8 unk2128[0x20];
u8 unk2148[0x20];
};
-struct UnionRoomChat3
+struct UnionRoomChatSprites
{
- struct Sprite *unk0;
- struct Sprite *unk4;
- struct Sprite *unk8;
- struct Sprite *unkC;
- struct Sprite *unk10;
- u16 unk14;
+ struct Sprite *keyboardCursor;
+ struct Sprite *textEntryArrow;
+ struct Sprite *textEntryCursor;
+ struct Sprite *rButtonIcon;
+ struct Sprite *rButtonLabel;
+ u16 cursorBlinkTimer;
};
-struct Unk82F2C98
+struct SubtaskInfo
{
- u16 unk0;
- bool32 (* unk4)(u8 *);
+ u16 idx;
+ bool32 (* callback)(u8 *);
};
-struct Unk82F2D40
+struct MessageWindowInfo
{
- const u8 *unk0;
- u8 unk4;
- u8 unk5;
- u8 unk6;
- u8 unk7;
- u8 unk8;
- u8 unk9;
- u8 unkA;
+ const u8 *text;
+ u8 boxType;
+ u8 x;
+ u8 y;
+ u8 letterSpacing;
+ u8 lineSpacing;
+ bool8 hasPlaceholders;
+ bool8 useWiderBox;
};
-static void sub_801DDD0(struct UnionRoomChat *);
-static void c2_081284E0(void);
-static void sub_801DF20(void);
-static void sub_801DF38(void);
-static void sub_801DF54(u8 taskId);
-static void sub_801DFAC(void);
-static void sub_801E030(void);
-static void sub_801E120(void);
-static void sub_801E240(void);
-static void sub_801E460(void);
-static void sub_801E5C4(void);
-static void sub_801E668(void);
-static void sub_801E764(void);
-static void sub_801E838(void);
-static void sub_801E978(void);
-static void sub_801EBD4(u16);
-static bool32 sub_801EBE4(void);
-static void sub_801EC94(void);
-static void sub_801ED68(void);
-static void sub_801ED94(void);
-static bool32 sub_801EDC4(void);
-static void sub_801EDE0(void);
-static void sub_801EE10(void);
-static void sub_801EE2C(void);
-static u8 *sub_801EE84(void);
-static u8 *sub_801EEA8(void);
-static void sub_801EF1C(u8 *);
-static void sub_801EF24(u8 *);
-static void sub_801EF4C(u8 *);
-static void sub_801EF7C(u8 *);
-static void sub_801EFA8(u8 *);
-static void sub_801EFD0(u8 *);
-static u8 *sub_801F114(void);
-static void sub_801F2B4(u8 taskId);
-static bool8 sub_801F4D0(void);
-static bool32 sub_801F534(void);
-static void sub_801F544(void);
-static void sub_801F5B8(void);
-static void sub_801F5EC(u16, u8);
-static bool8 sub_801F644(u8);
-static s8 sub_801FF08(void);
-static bool32 sub_8020890(void);
-static void sub_8020770(void);
-static void sub_801F574(struct UnionRoomChat2 *);
-static void sub_801F580(void);
-static void sub_80208D0(void);
-static bool32 sub_801FDD8(u8 *);
-static void sub_8020480(void);
-static void sub_8020538(void);
-static void sub_8020584(void);
-static void sub_80205B4(void);
-static void sub_8020604(void);
+static void InitUnionRoomChat(struct UnionRoomChat *);
+static void CB2_LoadInterface(void);
+static void VBlankCB_UnionRoomChatMain(void);
+static void CB2_UnionRoomChatMain(void);
+static void Task_HandlePlayerInput(u8 taskId);
+static void Chat_Join(void);
+static void Chat_HandleInput(void);
+static void Chat_Switch(void);
+static void Chat_AskQuitChatting(void);
+static void Chat_Exit(void);
+static void Chat_Drop(void);
+static void Chat_Disbanded(void);
+static void Chat_SendMessage(void);
+static void Chat_Register(void);
+static void Chat_SaveAndExit(void);
+static void SetChatFunction(u16);
+static bool32 HandleDPadInput(void);
+static void AppendTextToMessage(void);
+static void DeleteLastMessageCharacter(void);
+static void SwitchCaseOfLastMessageCharacter(void);
+static bool32 ChatMessageIsNotEmpty(void);
+static void RegisterTextAtRow(void);
+static void ResetMessageEntryBuffer(void);
+static void SaveRegisteredTexts(void);
+static u8 *GetEndOfMessagePtr(void);
+static u8 *GetLastCharOfMessagePtr(void);
+static void PrepareSendBuffer_Null(u8 *);
+static void PrepareSendBuffer_Join(u8 *);
+static void PrepareSendBuffer_Chat(u8 *);
+static void PrepareSendBuffer_Leave(u8 *);
+static void PrepareSendBuffer_Drop(u8 *);
+static void PrepareSendBuffer_Disband(u8 *);
+static u8 *GetLimitedMessageStartPtr(void);
+static void Task_ReceiveChatMessage(u8 taskId);
+static bool8 TryAllocDisplay(void);
+static bool32 IsDisplaySubtask0Active(void);
+static void FreeDisplay(void);
+static void RunDisplaySubtasks(void);
+static void StartDisplaySubtask(u16, u8);
+static bool8 IsDisplaySubtaskActive(u8);
+static s8 ProcessMenuInput(void);
+static bool32 TryAllocSprites(void);
+static void InitScanlineEffect(void);
+static void InitDisplay(struct UnionRoomChatDisplay *);
+static void ResetDisplaySubtasks(void);
+static void FreeSprites(void);
+static void ResetGpuBgState(void);
+static void SetBgTilemapBuffers(void);
+static void ClearBg0(void);
+static void LoadChatWindowBorderGfx(void);
+static void LoadChatWindowGfx(void);
static void sub_8020680(void);
-static void sub_80206A4(void);
-static void sub_80206D0(void);
-static void sub_8020740(void);
-static void sub_80206E8(void);
-static void sub_80208E8(void);
-static void sub_8020A68(void);
-static void sub_8020B20(void);
-static void sub_80203B0(void);
-static void sub_802040C(void);
-static void sub_802091C(bool32);
+static void LoadChatMessagesWindow(void);
+static void LoadKeyboardWindow(void);
+static void LoadKeyboardSwapWindow(void);
+static void LoadTextEntryWindow(void);
+static void CreateKeyboardCursorSprite(void);
+static void CreateTextEntrySprites(void);
+static void CreateRButtonSprites(void);
+static void ShowKeyboardSwapMenu(void);
+static void HideKeyboardSwapMenu(void);
+static void SetKeyboardCursorInvisibility(bool32);
static bool32 sub_8020320(void);
-static void sub_80201A4(void);
+static void PrintCurrentKeyboardPage(void);
static bool32 sub_8020368(void);
-static void sub_802093C(void);
-static void sub_8020B80(void);
-static void sub_801FF18(int, u16);
-static void sub_801FDDC(u8, u8, u8);
-static void sub_8020094(void);
-static void sub_801FEBC(void);
-static void sub_80200C8(void);
-static void sub_801FEE4(void);
-static void sub_80200EC(u16, u16, u8);
-static void sub_8020118(u16, u8 *, u8, u8, u8);
-static void sub_80209AC(int);
-static void sub_8020420(u16, u8 *, u8);
-static void sub_80209E0(void);
-static bool32 sub_8020A1C(void);
+static void MoveKeyboardCursor(void);
+static void UpdateRButtonLabel(void);
+static void AddStdMessageWindow(int, u16);
+static void AddYesNoMenuAt(u8, u8, u8);
+static void HideStdMessageWindow(void);
+static void HideYesNoMenuWindow(void);
+static void DestroyStdMessageWindow(void);
+static void DestroyYesNoMenuWindow(void);
+static void FillTextEntryWindow(u16, u16, u8);
+static void DrawTextEntryMessage(u16, u8 *, u8, u8, u8);
+static void SetRegisteredTextPalette(bool32);
+static void PrintChatMessage(u16, u8 *, u8);
+static void StartKeyboardCursorAnim(void);
+static bool32 TryKeyboardCursorReopen(void);
static void sub_80207C0(s16);
static void sub_8020818(s16);
-static bool32 sub_801F658(u8 *state);
-static bool32 sub_801F6F8(u8 *state);
-static bool32 sub_801F730(u8 *state);
-static bool32 sub_801F768(u8 *state);
-static bool32 sub_801F7D4(u8 *state);
-static bool32 sub_801F7E0(u8 *state);
-static bool32 sub_801F82C(u8 *state);
-static bool32 sub_801F870(u8 *state);
-static bool32 sub_801F8DC(u8 *state);
-static bool32 sub_801F984(u8 *state);
-static bool32 sub_801FA2C(u8 *state);
-static bool32 sub_801FA68(u8 *state);
-static bool32 sub_801FB44(u8 *state);
-static bool32 sub_801FB70(u8 *state);
-static bool32 sub_801FBB4(u8 *state);
-static bool32 sub_801FBF8(u8 *state);
-static bool32 sub_801FC4C(u8 *state);
-static bool32 sub_801FC9C(u8 *state);
-static bool32 sub_801FCEC(u8 *state);
-static bool32 sub_801FD30(u8 *state);
-static bool32 sub_801FD88(u8 *state);
-static void sub_8020ABC(struct Sprite *sprite);
-static void sub_8020AF4(struct Sprite *sprite);
-
-EWRAM_DATA struct UnionRoomChat *gUnknown_02022C84 = NULL;
-EWRAM_DATA struct UnionRoomChat2 *gUnknown_02022C88 = NULL;
-EWRAM_DATA struct UnionRoomChat3 *gUnknown_02022C8C = NULL;
-
-void (*const gUnknown_082F2A7C[])(void) =
- {
- sub_801DFAC,
- sub_801E030,
- sub_801E120,
- sub_801E240,
- sub_801E764,
- sub_801E838,
- sub_801E460,
- sub_801E5C4,
- sub_801E668,
- sub_801E978,
- };
-
-static const u8 sKeyboardPageMaxRow[] =
-{
- [UNION_ROOM_KB_PAGE_UPPER] = 9,
- [UNION_ROOM_KB_PAGE_LOWER] = 9,
- [UNION_ROOM_KB_PAGE_EMOJI] = 9,
- 9
+static bool32 Display_Dummy(u8 *);
+static bool32 Display_LoadGfx(u8 *state);
+static bool32 Display_ShowKeyboardSwapMenu(u8 *state);
+static bool32 Display_HideKeyboardSwapMenu(u8 *state);
+static bool32 Display_SwitchPages(u8 *state);
+static bool32 Display_MoveKeyboardCursor(u8 *state);
+static bool32 Display_AskQuitChatting(u8 *state);
+static bool32 Display_DestroyYesNoDialog(u8 *state);
+static bool32 Display_UpdateMessageBuffer(u8 *state);
+static bool32 Display_AskRegisterText(u8 *state);
+static bool32 Display_CancelRegister(u8 *state);
+static bool32 Display_ReturnToKeyboard(u8 *state);
+static bool32 Display_ScrollChat(u8 *state);
+static bool32 Display_AnimateKeyboardCursor(u8 *state);
+static bool32 Display_PrintInputText(u8 *state);
+static bool32 Display_PrintExitingChat(u8 *state);
+static bool32 Display_PrintLeaderLeft(u8 *state);
+static bool32 Display_AskSave(u8 *state);
+static bool32 Display_AskOverwriteSave(u8 *state);
+static bool32 Display_PrintSavingDontTurnOff(u8 *state);
+static bool32 Display_PrintSavedTheGame(u8 *state);
+static bool32 Display_AskConfirmLeaderLeave(u8 *state);
+static void SpriteCB_TextEntryCursor(struct Sprite *sprite);
+static void SpriteCB_TextEntryArrow(struct Sprite *sprite);
+
+static EWRAM_DATA struct UnionRoomChat *sChat = NULL;
+static EWRAM_DATA struct UnionRoomChatDisplay *sDisplay = NULL;
+static EWRAM_DATA struct UnionRoomChatSprites *sSprites = NULL;
+
+static void (*const sChatMainFunctions[])(void) = {
+ [CHAT_FUNC_JOIN] = Chat_Join,
+ [CHAT_FUNC_HANDLE_INPUT] = Chat_HandleInput,
+ [CHAT_FUNC_SWITCH] = Chat_Switch,
+ [CHAT_FUNC_ASK_QUIT] = Chat_AskQuitChatting,
+ [CHAT_FUNC_SEND] = Chat_SendMessage,
+ [CHAT_FUNC_REGISTER] = Chat_Register,
+ [CHAT_FUNC_EXIT] = Chat_Exit,
+ [CHAT_FUNC_DROP] = Chat_Drop,
+ [CHAT_FUNC_DISBANDED] = Chat_Disbanded,
+ [CHAT_FUNC_SAVE_AND_EXIT] = Chat_SaveAndExit
+};
+
+static const u8 sKeyboardPageMaxRow[UNION_ROOM_KB_PAGE_COUNT] =
+{
+ [UNION_ROOM_KB_PAGE_UPPER] = 9,
+ [UNION_ROOM_KB_PAGE_LOWER] = 9,
+ [UNION_ROOM_KB_PAGE_EMOJI] = 9,
+ [UNION_ROOM_KB_PAGE_REGISTER] = 9
};
-static const u8 gUnknown_082F2AA8[] = {
- CHAR_SPACE, 0x16, 0x17, 0x68, 0x19, 0x1A, 0x1B, 0x1C,
- 0x1D, 0x1E, CHAR_SPACE, 0x20, 0x21, 0x22, 0x23, 0x24,
- 0x25, 0x26, 0x27, 0x28, 0x29, 0x15, 0x01, 0x02,
- CHAR_SPACE, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, CHAR_SPACE,
- 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12,
- 0x13, 0x14, 0x2A, 0x2B, 0x2C, 0x2D, CHAR_SPACE, CHAR_SPACE,
- CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, 0x35, 0x36, CHAR_SPACE,
- CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE,
- CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE,
- CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE,
- CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, 0x53, 0x54, 0x55, 0x56, CHAR_SPACE,
- CHAR_SPACE, CHAR_SPACE, 0x6F, 0x5B, 0x5C, 0x5D, CHAR_SPACE, CHAR_SPACE,
- CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE,
- 0x03, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, 0x5A,
- CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE,
- CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE,
- CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, 0x84, 0x85, 0x86, CHAR_SPACE,
- CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE,
- CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE,
- CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE,
- 0xA0, CHAR_0, CHAR_1, CHAR_2, CHAR_3, CHAR_4, CHAR_5, CHAR_6,
- CHAR_7, CHAR_8, CHAR_9, CHAR_EXCL_MARK, CHAR_QUESTION_MARK, CHAR_PERIOD, CHAR_HYPHEN, 0xAF,
- CHAR_ELLIPSIS, CHAR_DBL_QUOT_LEFT, CHAR_DBL_QUOT_RIGHT, CHAR_SGL_QUOT_LEFT, CHAR_SGL_QUOT_RIGHT, CHAR_MALE, CHAR_FEMALE, CHAR_CURRENCY,
- CHAR_COMMA, CHAR_MULT_SIGN, CHAR_SLASH, CHAR_a, CHAR_b, CHAR_c, CHAR_d, CHAR_e,
- CHAR_f, CHAR_g, CHAR_h, CHAR_i, CHAR_j, CHAR_k, CHAR_l, CHAR_m,
- CHAR_n, CHAR_o, CHAR_p, CHAR_q, CHAR_r, CHAR_s, CHAR_t, CHAR_u,
- CHAR_v, CHAR_w, CHAR_x, CHAR_y, CHAR_z, CHAR_A, CHAR_B, CHAR_C,
- CHAR_D, CHAR_E, CHAR_F, CHAR_G, CHAR_H, CHAR_I, CHAR_J, CHAR_K,
- CHAR_L, CHAR_M, CHAR_N, CHAR_O, CHAR_P, CHAR_Q, CHAR_R, CHAR_S,
- CHAR_T, CHAR_U, CHAR_V, CHAR_W, CHAR_X, CHAR_Y, CHAR_Z, 0xEF,
- CHAR_COLON, 0xF4, 0xF5, 0xF6, 0xF1, 0xF2, 0xF3, CHAR_SPACE,
- CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE
+static const u8 sCaseToggleTable[256] = {
+ [CHAR_A] = CHAR_a,
+ [CHAR_B] = CHAR_b,
+ [CHAR_C] = CHAR_c,
+ [CHAR_D] = CHAR_d,
+ [CHAR_E] = CHAR_e,
+ [CHAR_F] = CHAR_f,
+ [CHAR_G] = CHAR_g,
+ [CHAR_H] = CHAR_h,
+ [CHAR_I] = CHAR_i,
+ [CHAR_J] = CHAR_j,
+ [CHAR_K] = CHAR_k,
+ [CHAR_L] = CHAR_l,
+ [CHAR_M] = CHAR_m,
+ [CHAR_N] = CHAR_n,
+ [CHAR_O] = CHAR_o,
+ [CHAR_P] = CHAR_p,
+ [CHAR_Q] = CHAR_q,
+ [CHAR_R] = CHAR_r,
+ [CHAR_S] = CHAR_s,
+ [CHAR_T] = CHAR_t,
+ [CHAR_U] = CHAR_u,
+ [CHAR_V] = CHAR_v,
+ [CHAR_W] = CHAR_w,
+ [CHAR_X] = CHAR_x,
+ [CHAR_Y] = CHAR_y,
+ [CHAR_Z] = CHAR_z,
+ [CHAR_a] = CHAR_A,
+ [CHAR_b] = CHAR_B,
+ [CHAR_c] = CHAR_C,
+ [CHAR_d] = CHAR_D,
+ [CHAR_e] = CHAR_E,
+ [CHAR_f] = CHAR_F,
+ [CHAR_g] = CHAR_G,
+ [CHAR_h] = CHAR_H,
+ [CHAR_i] = CHAR_I,
+ [CHAR_j] = CHAR_J,
+ [CHAR_k] = CHAR_K,
+ [CHAR_l] = CHAR_L,
+ [CHAR_m] = CHAR_M,
+ [CHAR_n] = CHAR_N,
+ [CHAR_o] = CHAR_O,
+ [CHAR_p] = CHAR_P,
+ [CHAR_q] = CHAR_Q,
+ [CHAR_r] = CHAR_R,
+ [CHAR_s] = CHAR_S,
+ [CHAR_t] = CHAR_T,
+ [CHAR_u] = CHAR_U,
+ [CHAR_v] = CHAR_V,
+ [CHAR_w] = CHAR_W,
+ [CHAR_x] = CHAR_X,
+ [CHAR_y] = CHAR_Y,
+ [CHAR_z] = CHAR_Z,
+ [CHAR_A_GRAVE] = CHAR_a_GRAVE,
+ [CHAR_A_ACUTE] = CHAR_a_ACUTE,
+ [CHAR_A_CIRCUMFLEX] = CHAR_a_CIRCUMFLEX,
+ [CHAR_A_DIAERESIS] = CHAR_a_DIAERESIS,
+ [CHAR_C_CEDILLA] = CHAR_c_CEDILLA,
+ [CHAR_E_GRAVE] = CHAR_e_GRAVE,
+ [CHAR_E_ACUTE] = CHAR_e_ACUTE,
+ [CHAR_E_CIRCUMFLEX] = CHAR_e_CIRCUMFLEX,
+ [CHAR_E_DIAERESIS] = CHAR_e_DIAERESIS,
+ [CHAR_I_GRAVE] = CHAR_i_GRAVE,
+ [CHAR_I_ACUTE] = CHAR_i_ACUTE,
+ [CHAR_I_CIRCUMFLEX] = CHAR_i_CIRCUMFLEX,
+ [CHAR_I_DIAERESIS] = CHAR_i_DIAERESIS,
+ [CHAR_O_GRAVE] = CHAR_o_GRAVE,
+ [CHAR_O_ACUTE] = CHAR_o_ACUTE,
+ [CHAR_O_CIRCUMFLEX] = CHAR_o_CIRCUMFLEX,
+ [CHAR_O_DIAERESIS] = CHAR_o_DIAERESIS,
+ [CHAR_OE] = CHAR_oe,
+ [CHAR_U_GRAVE] = CHAR_u_GRAVE,
+ [CHAR_U_ACUTE] = CHAR_u_ACUTE,
+ [CHAR_U_CIRCUMFLEX] = CHAR_u_CIRCUMFLEX,
+ [CHAR_U_DIAERESIS] = CHAR_u_DIAERESIS,
+ [CHAR_N_TILDE] = CHAR_n_TILDE,
+ [CHAR_ESZETT] = CHAR_ESZETT,
+ [CHAR_a_GRAVE] = CHAR_A_GRAVE,
+ [CHAR_a_ACUTE] = CHAR_A_ACUTE,
+ [CHAR_a_CIRCUMFLEX] = CHAR_A_CIRCUMFLEX,
+ [CHAR_a_DIAERESIS] = CHAR_A_DIAERESIS,
+ [CHAR_c_CEDILLA] = CHAR_C_CEDILLA,
+ [CHAR_e_GRAVE] = CHAR_E_GRAVE,
+ [CHAR_e_ACUTE] = CHAR_E_ACUTE,
+ [CHAR_e_CIRCUMFLEX] = CHAR_E_CIRCUMFLEX,
+ [CHAR_e_DIAERESIS] = CHAR_E_DIAERESIS,
+ [CHAR_i_GRAVE] = CHAR_I_GRAVE,
+ [CHAR_i_ACUTE] = CHAR_I_ACUTE,
+ [CHAR_i_CIRCUMFLEX] = CHAR_I_CIRCUMFLEX,
+ [CHAR_i_DIAERESIS] = CHAR_I_DIAERESIS,
+ [CHAR_o_GRAVE] = CHAR_O_GRAVE,
+ [CHAR_o_ACUTE] = CHAR_O_ACUTE,
+ [CHAR_o_CIRCUMFLEX] = CHAR_O_CIRCUMFLEX,
+ [CHAR_o_DIAERESIS] = CHAR_O_DIAERESIS,
+ [CHAR_oe] = CHAR_OE,
+ [CHAR_u_GRAVE] = CHAR_U_GRAVE,
+ [CHAR_u_ACUTE] = CHAR_U_ACUTE,
+ [CHAR_u_CIRCUMFLEX] = CHAR_U_CIRCUMFLEX,
+ [CHAR_u_DIAERESIS] = CHAR_U_DIAERESIS,
+ [CHAR_n_TILDE] = CHAR_N_TILDE,
+ [CHAR_0] = CHAR_0,
+ [CHAR_1] = CHAR_1,
+ [CHAR_2] = CHAR_2,
+ [CHAR_3] = CHAR_3,
+ [CHAR_4] = CHAR_4,
+ [CHAR_5] = CHAR_5,
+ [CHAR_6] = CHAR_6,
+ [CHAR_7] = CHAR_7,
+ [CHAR_8] = CHAR_8,
+ [CHAR_9] = CHAR_9,
+ [CHAR_PK] = CHAR_PK,
+ [CHAR_MN] = CHAR_MN,
+ [CHAR_PO] = CHAR_PO,
+ [CHAR_KE] = CHAR_KE,
+ [CHAR_SUPER_E] = CHAR_SUPER_E,
+ [CHAR_SUPER_ER] = CHAR_SUPER_ER,
+ [CHAR_SUPER_RE] = CHAR_SUPER_RE,
+ [CHAR_PERIOD] = CHAR_PERIOD,
+ [CHAR_COMMA] = CHAR_COMMA,
+ [CHAR_COLON] = CHAR_COLON,
+ [CHAR_SEMICOLON] = CHAR_SEMICOLON,
+ [CHAR_EXCL_MARK] = CHAR_EXCL_MARK,
+ [CHAR_QUESTION_MARK] = CHAR_QUESTION_MARK,
+ [CHAR_HYPHEN] = CHAR_HYPHEN,
+ [CHAR_SLASH] = CHAR_SLASH,
+ [CHAR_ELLIPSIS] = CHAR_ELLIPSIS,
+ [CHAR_LEFT_PAREN] = CHAR_LEFT_PAREN,
+ [CHAR_RIGHT_PAREN] = CHAR_RIGHT_PAREN,
+ [CHAR_AMPERSAND] = CHAR_AMPERSAND,
+ [CHAR_DBL_QUOT_LEFT] = CHAR_DBL_QUOT_LEFT,
+ [CHAR_DBL_QUOT_RIGHT] = CHAR_DBL_QUOT_RIGHT,
+ [CHAR_SGL_QUOT_LEFT] = CHAR_SGL_QUOT_LEFT,
+ [CHAR_SGL_QUOT_RIGHT] = CHAR_SGL_QUOT_RIGHT,
+ [CHAR_MASCULINE_ORDINAL] = CHAR_MASCULINE_ORDINAL,
+ [CHAR_FEMININE_ORDINAL] = CHAR_FEMININE_ORDINAL,
+ [CHAR_BULLET] = CHAR_BULLET,
+ [CHAR_EQUALS] = CHAR_EQUALS,
+ [CHAR_MULT_SIGN] = CHAR_MULT_SIGN,
+ [CHAR_PERCENT] = CHAR_PERCENT,
+ [CHAR_LESS_THAN] = CHAR_LESS_THAN,
+ [CHAR_GREATER_THAN] = CHAR_GREATER_THAN,
+ [CHAR_MALE] = CHAR_MALE,
+ [CHAR_FEMALE] = CHAR_FEMALE,
+ [CHAR_CURRENCY] = CHAR_CURRENCY,
+ [CHAR_BLACK_TRIANGLE] = CHAR_BLACK_TRIANGLE,
};
-static const u8 *const sUnionRoomKeyboardText[UNION_ROOM_KB_PAGE_COUNT][UNION_ROOM_KB_ROW_COUNT] =
+// Excludes UNION_ROOM_KB_PAGE_REGISTER, the text for which is chosen by the player
+static const u8 *const sUnionRoomKeyboardText[UNION_ROOM_KB_PAGE_COUNT - 1][UNION_ROOM_KB_ROW_COUNT] =
{
[UNION_ROOM_KB_PAGE_UPPER] =
{
@@ -319,10 +509,10 @@ static const u8 *const sUnionRoomKeyboardText[UNION_ROOM_KB_PAGE_COUNT][UNION_RO
}
};
-const u16 gUnknown_082F2C20[] = INCBIN_U16("graphics/interface/unk_palette1.gbapal");
-const u16 gUnknown_082F2C40[] = INCBIN_U16("graphics/interface/unk_palette2.gbapal");
+static const u16 sUnk_Palette1[] = INCBIN_U16("graphics/union_room_chat/unk_palette1.gbapal");
+static const u16 sUnk_Palette2[] = INCBIN_U16("graphics/union_room_chat/unk_palette2.gbapal");
-const struct BgTemplate gUnknown_082F2C60[] = {
+static const struct BgTemplate sBgTemplates[] = {
{
.bg = 0,
.charBaseIndex = 0,
@@ -358,7 +548,7 @@ const struct BgTemplate gUnknown_082F2C60[] = {
}
};
-const struct WindowTemplate gUnknown_082F2C70[] = {
+static const struct WindowTemplate sWinTemplates[] = {
{
.bg = 0x03,
.tilemapLeft = 0x08,
@@ -391,242 +581,341 @@ const struct WindowTemplate gUnknown_082F2C70[] = {
.height = 0x09,
.paletteNum = 0x0e,
.baseBlock = 0x0013,
- }, { 0xFF }
+ }, DUMMY_WIN_TEMPLATE
};
-const struct Unk82F2C98 gUnknown_082F2C98[] = {
- {0x00000000, sub_801F658},
- {0x00000003, sub_801F6F8},
- {0x00000004, sub_801F730},
- {0x00000005, sub_801F768},
- {0x00000001, sub_801F7D4},
- {0x00000006, sub_801F7E0},
- {0x00000007, sub_801F82C},
- {0x00000008, sub_801F870},
- {0x00000009, sub_801F8DC},
- {0x0000000a, sub_801F984},
- {0x0000000b, sub_801FA2C},
- {0x0000000c, sub_801FA68},
- {0x00000002, sub_801FB44},
- {0x0000000d, sub_801FB70},
- {0x00000012, sub_801FBB4},
- {0x00000013, sub_801FBF8},
- {0x0000000e, sub_801FC4C},
- {0x0000000f, sub_801FC9C},
- {0x00000010, sub_801FCEC},
- {0x00000011, sub_801FD30},
- {0x00000014, sub_801FD88}
+static const struct SubtaskInfo sDisplaySubtasks[] = {
+ {CHATDISPLAY_FUNC_LOAD_GFX, Display_LoadGfx},
+ {CHATDISPLAY_FUNC_SHOW_KB_SWAP_MENU, Display_ShowKeyboardSwapMenu},
+ {CHATDISPLAY_FUNC_HIDE_KB_SWAP_MENU, Display_HideKeyboardSwapMenu},
+ {CHATDISPLAY_FUNC_SWITCH_PAGES, Display_SwitchPages},
+ {CHATDISPLAY_FUNC_MOVE_KB_CURSOR, Display_MoveKeyboardCursor},
+ {CHATDISPLAY_FUNC_ASK_QUIT_CHATTING, Display_AskQuitChatting},
+ {CHATDISPLAY_FUNC_DESTROY_YESNO, Display_DestroyYesNoDialog},
+ {CHATDISPLAY_FUNC_UPDATE_MSG, Display_UpdateMessageBuffer},
+ {CHATDISPLAY_FUNC_ASK_REGISTER_TEXT, Display_AskRegisterText},
+ {CHATDISPLAY_FUNC_CANCEL_REGISTER, Display_CancelRegister},
+ {CHATDISPLAY_FUNC_RETURN_TO_KB, Display_ReturnToKeyboard},
+ {CHATDISPLAY_FUNC_SCROLL_CHAT, Display_ScrollChat},
+ {CHATDISPLAY_FUNC_CURSOR_BLINK, Display_AnimateKeyboardCursor},
+ {CHATDISPLAY_FUNC_PRINT_INPUT_TEXT, Display_PrintInputText},
+ {CHATDISPLAY_FUNC_PRINT_EXITING_CHAT, Display_PrintExitingChat},
+ {CHATDISPLAY_FUNC_PRINT_LEADER_LEFT, Display_PrintLeaderLeft},
+ {CHATDISPLAY_FUNC_ASK_SAVE, Display_AskSave},
+ {CHATDISPLAY_FUNC_ASK_OVERWRITE_SAVE, Display_AskOverwriteSave},
+ {CHATDISPLAY_FUNC_PRINT_SAVING, Display_PrintSavingDontTurnOff},
+ {CHATDISPLAY_FUNC_PRINT_SAVED_GAME, Display_PrintSavedTheGame},
+ {CHATDISPLAY_FUNC_ASK_CONFIRM_LEADER_LEAVE, Display_AskConfirmLeaderLeave}
};
-const struct Unk82F2D40 gUnknown_082F2D40[] = {
- {gText_QuitChatting, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00},
- {gText_RegisterTextWhere, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00},
- {gText_RegisterTextHere, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00},
- {gText_InputText, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00},
- {gText_ExitingChat, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00},
- {gText_LeaderLeftEndingChat, 0x02, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00},
- {gText_RegisteredTextChanged, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01},
- {gText_AlreadySavedFile_Unused, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01},
- {gText_SavingDontTurnOff_Unused, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01},
- {gText_PlayerSavedGame_Unused, 0x02, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01},
- {gText_IfLeaderLeavesChatEnds, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01}
+static const struct MessageWindowInfo sDisplayStdMessages[] = {
+ [STDMESSAGE_QUIT_CHATTING] = {
+ .text = gText_QuitChatting,
+ .boxType = 1,
+ .x = 0,
+ .y = 1,
+ .letterSpacing = 0,
+ .lineSpacing = 0,
+ .hasPlaceholders = FALSE,
+ .useWiderBox = FALSE
+ },
+ [STDMESSAGE_REGISTER_WHERE] = {
+ .text = gText_RegisterTextWhere,
+ .boxType = 1,
+ .x = 0,
+ .y = 1,
+ .letterSpacing = 0,
+ .lineSpacing = 0,
+ .hasPlaceholders = FALSE,
+ .useWiderBox = FALSE
+ },
+ [STDMESSAGE_REGISTER_HERE] = {
+ .text = gText_RegisterTextHere,
+ .boxType = 1,
+ .x = 0,
+ .y = 1,
+ .letterSpacing = 0,
+ .lineSpacing = 0,
+ .hasPlaceholders = FALSE,
+ .useWiderBox = FALSE
+ },
+ [STDMESSAGE_INPUT_TEXT] = {
+ .text = gText_InputText,
+ .boxType = 1,
+ .x = 0,
+ .y = 1,
+ .letterSpacing = 0,
+ .lineSpacing = 0,
+ .hasPlaceholders = FALSE,
+ .useWiderBox = FALSE
+ },
+ [STDMESSAGE_EXITING_CHAT] = {
+ .text = gText_ExitingChat,
+ .boxType = 2,
+ .x = 0,
+ .y = 1,
+ .letterSpacing = 0,
+ .lineSpacing = 0,
+ .hasPlaceholders = FALSE,
+ .useWiderBox = FALSE
+ },
+ [STDMESSAGE_LEADER_LEFT] = {
+ .text = gText_LeaderLeftEndingChat,
+ .boxType = 2,
+ .x = 0,
+ .y = 1,
+ .letterSpacing = 0,
+ .lineSpacing = 0,
+ .hasPlaceholders = TRUE,
+ .useWiderBox = FALSE
+ },
+ [STDMESSAGE_ASK_SAVE] = {
+ .text = gText_RegisteredTextChangedOKToSave,
+ .boxType = 2,
+ .x = 0,
+ .y = 1,
+ .letterSpacing = 0,
+ .lineSpacing = 0,
+ .hasPlaceholders = FALSE,
+ .useWiderBox = TRUE
+ },
+ [STDMESSAGE_ASK_OVERWRITE] = {
+ .text = gText_AlreadySavedFile_Chat,
+ .boxType = 2,
+ .x = 0,
+ .y = 1,
+ .letterSpacing = 0,
+ .lineSpacing = 0,
+ .hasPlaceholders = FALSE,
+ .useWiderBox = TRUE
+ },
+ [STDMESSAGE_SAVING_NO_OFF] = {
+ .text = gText_SavingDontTurnOff_Chat,
+ .boxType = 2,
+ .x = 0,
+ .y = 1,
+ .letterSpacing = 0,
+ .lineSpacing = 0,
+ .hasPlaceholders = FALSE,
+ .useWiderBox = TRUE
+ },
+ [STDMESSAGE_SAVED_THE_GAME] = {
+ .text = gText_PlayerSavedGame_Chat,
+ .boxType = 2,
+ .x = 0,
+ .y = 1,
+ .letterSpacing = 0,
+ .lineSpacing = 0,
+ .hasPlaceholders = TRUE,
+ .useWiderBox = TRUE
+ },
+ [STDMESSAGE_WARN_LEADER_LEAVE] = {
+ .text = gText_IfLeaderLeavesChatEnds,
+ .boxType = 2,
+ .x = 0,
+ .y = 1,
+ .letterSpacing = 0,
+ .lineSpacing = 0,
+ .hasPlaceholders = FALSE,
+ .useWiderBox = TRUE
+ }
};
-const u8 gText_Ellipsis[] = _("…");
+static const u8 sText_Ellipsis[] = _("…");
-const struct MenuAction gUnknown_082F2DC8[] = {
- {gText_Upper, NULL},
- {gText_Lower, NULL},
- {gText_Symbols, NULL},
- {gText_Register2, NULL},
- {gText_Exit2, NULL},
+static const struct MenuAction sKeyboardPageTitleTexts[UNION_ROOM_KB_PAGE_COUNT + 1] = {
+ [UNION_ROOM_KB_PAGE_UPPER] = {gText_Upper, NULL},
+ [UNION_ROOM_KB_PAGE_LOWER] = {gText_Lower, NULL},
+ [UNION_ROOM_KB_PAGE_EMOJI] = {gText_Symbols, NULL},
+ [UNION_ROOM_KB_PAGE_REGISTER] = {gText_Register2, NULL},
+ [UNION_ROOM_KB_PAGE_COUNT] = {gText_Exit2, NULL},
};
-const u16 gUnknown_082F2DF0[] = INCBIN_U16("graphics/interface/unk_palette3.gbapal");
-const u32 gUnknown_082F2E10[] = INCBIN_U32("graphics/interface/unk_cursor.4bpp.lz");
-const u32 gUnknown_082F3094[] = INCBIN_U32("graphics/interface/unk_dash.4bpp.lz");
-const u32 gUnknown_082F30B4[] = INCBIN_U32("graphics/interface/unk_cursor_arrow.4bpp.lz");
-const u32 gUnknown_082F30E0[] = INCBIN_U32("graphics/interface/unk_rbutton.4bpp.lz");
-
-const struct CompressedSpriteSheet gUnknown_082F3134[] = {
- {gUnknown_082F2E10, 0x1000, 0x0000},
- {gUnknown_082F30B4, 0x0040, 0x0001},
- {gUnknown_082F3094, 0x0040, 0x0002},
- {gUnknown_082F30E0, 0x0080, 0x0003},
- {gUnknown_08DD4CF8, 0x0400, 0x0004}
+static const u16 sUnionRoomChatInterfacePal[] = INCBIN_U16("graphics/union_room_chat/interface.gbapal");
+static const u32 sKeyboardCursorTiles[] = INCBIN_U32("graphics/union_room_chat/keyboard_cursor.4bpp.lz");
+static const u32 sTextEntryCursorTiles[] = INCBIN_U32("graphics/union_room_chat/text_entry_cursor.4bpp.lz");
+static const u32 sTextEntryArrowTiles[] = INCBIN_U32("graphics/union_room_chat/text_entry_arrow.4bpp.lz");
+static const u32 sRButtonGfxTiles[] = INCBIN_U32("graphics/union_room_chat/r_button.4bpp.lz");
+
+static const struct CompressedSpriteSheet sSpriteSheets[] = {
+ {sKeyboardCursorTiles, 0x1000, 0},
+ {sTextEntryArrowTiles, 0x0040, 1},
+ {sTextEntryCursorTiles, 0x0040, 2},
+ {sRButtonGfxTiles, 0x0080, 3},
+ {gUnionRoomChat_RButtonLabels, 0x0400, 4}
};
-const struct SpritePalette gUnknown_082F315C = {
- gUnknown_082F2DF0, 0x0000
+static const struct SpritePalette sSpritePalette = {
+ sUnionRoomChatInterfacePal, 0
};
-const struct OamData gUnknown_082F3164 = {
+static const struct OamData sOam_KeyboardCursor = {
.shape = SPRITE_SHAPE(64x32),
.size = SPRITE_SIZE(64x32),
.priority = 1
};
-const union AnimCmd gUnknown_082F316C[] = {
+static const union AnimCmd sAnim_KeyboardCursor_Open[] = {
ANIMCMD_FRAME(0x00, 30),
ANIMCMD_END
};
-const union AnimCmd gUnknown_082F3174[] = {
+static const union AnimCmd sAnim_KeyboardCursor_Closed[] = {
ANIMCMD_FRAME(0x20, 30),
ANIMCMD_END
};
-const union AnimCmd gUnknown_082F317C[] = {
+static const union AnimCmd sAnim_KeyboardCursorWide_Open[] = {
ANIMCMD_FRAME(0x40, 30),
ANIMCMD_END
};
-const union AnimCmd gUnknown_082F3184[] = {
+static const union AnimCmd sAnim_KeyboardCursorWide_Closed[] = {
ANIMCMD_FRAME(0x60, 30),
ANIMCMD_END
};
-const union AnimCmd *const gUnknown_082F318C[] = {
- gUnknown_082F316C,
- gUnknown_082F3174,
- gUnknown_082F317C,
- gUnknown_082F3184
+static const union AnimCmd *const sAnims_KeyboardCursor[] = {
+ sAnim_KeyboardCursor_Open,
+ sAnim_KeyboardCursor_Closed,
+ sAnim_KeyboardCursorWide_Open,
+ sAnim_KeyboardCursorWide_Closed
};
-const struct SpriteTemplate gUnknown_082F319C = {
+static const struct SpriteTemplate sSpriteTemplate_KeyboardCursor = {
.tileTag = 0x0000,
.paletteTag = 0x0000,
- .oam = &gUnknown_082F3164,
- .anims = gUnknown_082F318C,
+ .oam = &sOam_KeyboardCursor,
+ .anims = sAnims_KeyboardCursor,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
-const struct OamData gUnknown_082F31B4 = {
+static const struct OamData sOam_TextEntrySprite = {
.shape = SPRITE_SHAPE(8x16),
.size = SPRITE_SIZE(8x16),
.priority = 2
};
-const struct SpriteTemplate gUnknown_082F31BC = {
+static const struct SpriteTemplate sSpriteTemplate_TextEntryCursor = {
.tileTag = 0x0002,
.paletteTag = 0x0000,
- .oam = &gUnknown_082F31B4,
+ .oam = &sOam_TextEntrySprite,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_8020ABC
+ .callback = SpriteCB_TextEntryCursor
};
-const struct SpriteTemplate gUnknown_082F31D4 = {
+static const struct SpriteTemplate sSpriteTemplate_TextEntryArrow = {
.tileTag = 0x0001,
.paletteTag = 0x0000,
- .oam = &gUnknown_082F31B4,
+ .oam = &sOam_TextEntrySprite,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_8020AF4
+ .callback = SpriteCB_TextEntryArrow
};
-const struct OamData gUnknown_082F31EC = {
+static const struct OamData sOam_RButtonIcon = {
.shape = SPRITE_SHAPE(16x16),
.size = SPRITE_SIZE(16x16),
.priority = 2
};
-const struct OamData gUnknown_082F31F4 = {
+static const struct OamData sOam_RButtonLabel = {
.shape = SPRITE_SHAPE(32x16),
.size = SPRITE_SIZE(32x16),
.priority = 2
};
-const union AnimCmd gUnknown_082F31FC[] = {
+static const union AnimCmd sAnim_ToggleCaseIcon[] = {
ANIMCMD_FRAME(0x00, 2),
ANIMCMD_END
};
-const union AnimCmd gUnknown_082F3204[] = {
+static const union AnimCmd sAnim_ToggleCaseIcon_Duplicate1[] = {
ANIMCMD_FRAME(0x08, 2),
ANIMCMD_END
};
-const union AnimCmd gUnknown_082F320C[] = {
+static const union AnimCmd sAnim_ToggleCaseIcon_Duplicate2[] = {
ANIMCMD_FRAME(0x10, 2),
ANIMCMD_END
};
-const union AnimCmd gUnknown_082F3214[] = {
+static const union AnimCmd sAnim_RegisterIcon[] = {
ANIMCMD_FRAME(0x18, 2),
ANIMCMD_END
};
-const union AnimCmd *const gUnknown_082F321C[] = {
- gUnknown_082F31FC,
- gUnknown_082F3204,
- gUnknown_082F320C,
- gUnknown_082F3214
+static const union AnimCmd *const sAnims_RButtonLabels[] = {
+ sAnim_ToggleCaseIcon,
+ sAnim_ToggleCaseIcon_Duplicate1,
+ sAnim_ToggleCaseIcon_Duplicate2,
+ sAnim_RegisterIcon
};
-const struct SpriteTemplate gUnknown_082F322C = {
+static const struct SpriteTemplate sSpriteTemplate_RButtonIcon = {
.tileTag = 0x0003,
.paletteTag = 0x0000,
- .oam = &gUnknown_082F31EC,
+ .oam = &sOam_RButtonIcon,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
-const struct SpriteTemplate gUnknown_082F3244 = {
+static const struct SpriteTemplate sSpriteTemplate_RButtonLabels = {
.tileTag = 0x0004,
.paletteTag = 0x0000,
- .oam = &gUnknown_082F31F4,
- .anims = gUnknown_082F321C,
+ .oam = &sOam_RButtonLabel,
+ .anims = sAnims_RButtonLabels,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
-void sub_801DD98(void)
+void EnterUnionRoomChat(void)
{
- gUnknown_02022C84 = Alloc(sizeof(*gUnknown_02022C84));
- sub_801DDD0(gUnknown_02022C84);
+ sChat = Alloc(sizeof(struct UnionRoomChat));
+ InitUnionRoomChat(sChat);
gKeyRepeatStartDelay = 20;
SetVBlankCallback(NULL);
- SetMainCallback2(c2_081284E0);
+ SetMainCallback2(CB2_LoadInterface);
}
-static void sub_801DDD0(struct UnionRoomChat *unionRoomChat)
+static void InitUnionRoomChat(struct UnionRoomChat *chat)
{
int i;
- unionRoomChat->unk4 = 0;
- unionRoomChat->unk6 = 0;
- unionRoomChat->currentPage = 0;
- unionRoomChat->unk11 = 0;
- unionRoomChat->currentRow = 0;
- unionRoomChat->unk14 = 0;
- unionRoomChat->unk15 = 0;
- unionRoomChat->unk16 = 0;
- unionRoomChat->unk1A[0] = EOS;
- unionRoomChat->unkD = GetLinkPlayerCount();
- unionRoomChat->unk13 = GetMultiplayerId();
- unionRoomChat->unk17 = 0;
- unionRoomChat->unk18 = 0;
- sub_801EF1C(unionRoomChat->unk190);
+ chat->funcId = 0;
+ chat->funcState = 0;
+ chat->currentPage = 0;
+ chat->currentCol = 0;
+ chat->currentRow = 0;
+ chat->lastBufferCursorPos = 0;
+ chat->bufferCursorPos = 0;
+ chat->receivedPlayerIndex = 0;
+ chat->messageEntryBuffer[0] = EOS;
+ chat->linkPlayerCount = GetLinkPlayerCount();
+ chat->multiplayerId = GetMultiplayerId();
+ chat->exitType = 0;
+ chat->changedRegisteredTexts = FALSE;
+ PrepareSendBuffer_Null(chat->sendMessageBuffer);
for (i = 0; i < UNION_ROOM_KB_ROW_COUNT; i++)
- StringCopy(unionRoomChat->unkB9[i], gSaveBlock1Ptr->unk3C88[i]);
+ StringCopy(chat->registeredTexts[i], gSaveBlock1Ptr->registeredTexts[i]);
}
-void sub_801DE30(void)
+static void FreeUnionRoomChat(void)
{
- DestroyTask(gUnknown_02022C84->unkE);
- DestroyTask(gUnknown_02022C84->unkF);
- Free(gUnknown_02022C84);
+ DestroyTask(sChat->handleInputTask);
+ DestroyTask(sChat->receiveMessagesTask);
+ Free(sChat);
}
-static void c2_081284E0(void)
+static void CB2_LoadInterface(void)
{
switch (gMain.state)
{
@@ -634,16 +923,16 @@ static void c2_081284E0(void)
ResetTasks();
ResetSpriteData();
FreeAllSpritePalettes();
- sub_801F4D0();
+ TryAllocDisplay();
gMain.state++;
break;
case 1:
- sub_801F5B8();
- if (!sub_801F534())
+ RunDisplaySubtasks();
+ if (!IsDisplaySubtask0Active())
{
BlendPalettes(0xFFFFFFFF, 16, RGB_BLACK);
BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK);
- SetVBlankCallback(sub_801DF20);
+ SetVBlankCallback(VBlankCB_UnionRoomChatMain);
gMain.state++;
}
break;
@@ -651,9 +940,9 @@ static void c2_081284E0(void)
UpdatePaletteFade();
if (!gPaletteFade.active)
{
- SetMainCallback2(sub_801DF38);
- gUnknown_02022C84->unkE = CreateTask(sub_801DF54, 8);
- gUnknown_02022C84->unkF = CreateTask(sub_801F2B4, 7);
+ SetMainCallback2(CB2_UnionRoomChatMain);
+ sChat->handleInputTask = CreateTask(Task_HandlePlayerInput, 8);
+ sChat->receiveMessagesTask = CreateTask(Task_ReceiveChatMessage, 7);
LoadWirelessStatusIndicatorSpriteGfx();
CreateWirelessStatusIndicatorSprite(232, 150);
}
@@ -661,7 +950,7 @@ static void c2_081284E0(void)
}
}
-static void sub_801DF20(void)
+static void VBlankCB_UnionRoomChatMain(void)
{
TransferPlttBuffer();
LoadOam();
@@ -669,146 +958,146 @@ static void sub_801DF20(void)
ScanlineEffect_InitHBlankDmaTransfer();
}
-static void sub_801DF38(void)
+static void CB2_UnionRoomChatMain(void)
{
RunTasks();
- sub_801F5B8();
+ RunDisplaySubtasks();
AnimateSprites();
BuildOamBuffer();
UpdatePaletteFade();
}
-static void sub_801DF54(u8 taskId)
+static void Task_HandlePlayerInput(u8 taskId)
{
- switch (gUnknown_02022C84->unk17)
+ switch (sChat->exitType)
{
- case 1:
- sub_801EBD4(6);
- gUnknown_02022C84->unk17 = 0;
+ case CHAT_EXIT_ONLY_LEADER:
+ SetChatFunction(CHAT_FUNC_EXIT);
+ sChat->exitType = CHAT_EXIT_NONE;
break;
- case 2:
- sub_801EBD4(7);
- gUnknown_02022C84->unk17 = 0;
+ case CHAT_EXIT_DROPPED:
+ SetChatFunction(CHAT_FUNC_DROP);
+ sChat->exitType = CHAT_EXIT_NONE;
break;
- case 3:
- sub_801EBD4(8);
- gUnknown_02022C84->unk17 = 0;
+ case CHAT_EXIT_DISBANDED:
+ SetChatFunction(CHAT_FUNC_DISBANDED);
+ sChat->exitType = CHAT_EXIT_NONE;
break;
}
- gUnknown_082F2A7C[gUnknown_02022C84->unk4]();
+ sChatMainFunctions[sChat->funcId]();
}
-static void sub_801DFAC(void)
+static void Chat_Join(void)
{
- switch (gUnknown_02022C84->unk6)
+ switch (sChat->funcState)
{
case 0:
- sub_801EF24(gUnknown_02022C84->unk190);
- gUnknown_02022C84->unk6++;
+ PrepareSendBuffer_Join(sChat->sendMessageBuffer);
+ sChat->funcState++;
// fall through
case 1:
if (IsLinkTaskFinished() && !sub_8011A9C())
{
- if (SendBlock(0, gUnknown_02022C84->unk190, sizeof(gUnknown_02022C84->unk190)))
- gUnknown_02022C84->unk6++;
+ if (SendBlock(0, sChat->sendMessageBuffer, sizeof(sChat->sendMessageBuffer)))
+ sChat->funcState++;
}
break;
case 2:
if (IsLinkTaskFinished())
- sub_801EBD4(1);
+ SetChatFunction(CHAT_FUNC_HANDLE_INPUT);
break;
}
}
-static void sub_801E030(void)
+static void Chat_HandleInput(void)
{
- bool8 var0, var1;
+ bool8 updateMsgActive, cursorBlinkActive;
- switch (gUnknown_02022C84->unk6)
+ switch (sChat->funcState)
{
case 0:
if (gMain.newKeys & START_BUTTON)
{
- if (gUnknown_02022C84->unk15)
- sub_801EBD4(4);
+ if (sChat->bufferCursorPos)
+ SetChatFunction(CHAT_FUNC_SEND);
}
else if (gMain.newKeys & SELECT_BUTTON)
{
- sub_801EBD4(2);
+ SetChatFunction(CHAT_FUNC_SWITCH);
}
else if (gMain.newAndRepeatedKeys & B_BUTTON)
{
- if (gUnknown_02022C84->unk15)
+ if (sChat->bufferCursorPos)
{
- sub_801ED68();
- sub_801F5EC(8, 0);
- gUnknown_02022C84->unk6 = 1;
+ DeleteLastMessageCharacter();
+ StartDisplaySubtask(CHATDISPLAY_FUNC_UPDATE_MSG, 0);
+ sChat->funcState = 1;
}
else
{
- sub_801EBD4(3);
+ SetChatFunction(CHAT_FUNC_ASK_QUIT);
}
}
else if (gMain.newKeys & A_BUTTON)
{
- sub_801EC94();
- sub_801F5EC(8, 0);
- sub_801F5EC(2, 1);
- gUnknown_02022C84->unk6 = 1;
+ AppendTextToMessage();
+ StartDisplaySubtask(CHATDISPLAY_FUNC_UPDATE_MSG, 0);
+ StartDisplaySubtask(CHATDISPLAY_FUNC_CURSOR_BLINK, 1);
+ sChat->funcState = 1;
}
else if (gMain.newKeys & R_BUTTON)
{
- if (gUnknown_02022C84->currentPage != UNION_ROOM_KB_PAGE_COUNT)
+ if (sChat->currentPage != UNION_ROOM_KB_PAGE_REGISTER)
{
- sub_801ED94();
- sub_801F5EC(8, 0);
- gUnknown_02022C84->unk6 = 1;
+ SwitchCaseOfLastMessageCharacter();
+ StartDisplaySubtask(CHATDISPLAY_FUNC_UPDATE_MSG, 0);
+ sChat->funcState = 1;
}
else
{
- sub_801EBD4(5);
+ SetChatFunction(5);
}
}
- else if (sub_801EBE4())
+ else if (HandleDPadInput())
{
- sub_801F5EC(1, 0);
- gUnknown_02022C84->unk6 = 1;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_MOVE_KB_CURSOR, 0);
+ sChat->funcState = 1;
}
break;
case 1:
- var0 = sub_801F644(0);
- var1 = sub_801F644(1);
- if (!var0 && !var1)
- gUnknown_02022C84->unk6 = 0;
+ updateMsgActive = IsDisplaySubtaskActive(0);
+ cursorBlinkActive = IsDisplaySubtaskActive(1);
+ if (!updateMsgActive && !cursorBlinkActive)
+ sChat->funcState = 0;
break;
}
}
-static void sub_801E120(void)
+static void Chat_Switch(void)
{
s16 input;
- int var0;
+ bool32 shouldSwitchPages;
- switch (gUnknown_02022C84->unk6)
+ switch (sChat->funcState)
{
case 0:
- sub_801F5EC(3, 0);
- gUnknown_02022C84->unk6++;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_SHOW_KB_SWAP_MENU, 0);
+ sChat->funcState++;
break;
case 1:
- if (!sub_801F644(0))
- gUnknown_02022C84->unk6++;
+ if (!IsDisplaySubtaskActive(0))
+ sChat->funcState++;
break;
case 2:
input = Menu_ProcessInput();
switch (input)
{
default:
- sub_801F5EC(4, 0);
- var0 = 1;
- if (gUnknown_02022C84->currentPage == input || input > UNION_ROOM_KB_PAGE_COUNT)
- var0 = 0;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_HIDE_KB_SWAP_MENU, 0);
+ shouldSwitchPages = TRUE;
+ if (sChat->currentPage == input || input > UNION_ROOM_KB_PAGE_REGISTER)
+ shouldSwitchPages = FALSE;
break;
case MENU_NOTHING_CHOSEN:
if (gMain.newKeys & SELECT_BUTTON)
@@ -818,538 +1107,532 @@ static void sub_801E120(void)
}
return;
case MENU_B_PRESSED:
- sub_801F5EC(4, 0);
- gUnknown_02022C84->unk6 = 3;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_HIDE_KB_SWAP_MENU, 0);
+ sChat->funcState = 3;
return;
}
- if (!var0)
+ if (!shouldSwitchPages)
{
- gUnknown_02022C84->unk6 = 3;
+ sChat->funcState = 3;
return;
}
- gUnknown_02022C84->unk11 = 0;
- gUnknown_02022C84->currentRow = 0;
- sub_801F5EC(5, 1);
- gUnknown_02022C84->currentPage = input;
- gUnknown_02022C84->unk6 = 4;
+ sChat->currentCol = 0;
+ sChat->currentRow = 0;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_SWITCH_PAGES, 1);
+ sChat->currentPage = input;
+ sChat->funcState = 4;
break;
case 3:
- if (!sub_801F644(0))
- sub_801EBD4(1);
+ if (!IsDisplaySubtaskActive(0))
+ SetChatFunction(CHAT_FUNC_HANDLE_INPUT);
break;
case 4:
- if (!sub_801F644(0) && !sub_801F644(1))
- sub_801EBD4(1);
+ if (!IsDisplaySubtaskActive(0) && !IsDisplaySubtaskActive(1))
+ SetChatFunction(CHAT_FUNC_HANDLE_INPUT);
break;
}
}
-static void sub_801E240(void)
+static void Chat_AskQuitChatting(void)
{
s8 input;
- switch (gUnknown_02022C84->unk6)
+ switch (sChat->funcState)
{
case 0:
- sub_801F5EC(6, 0);
- gUnknown_02022C84->unk6 = 1;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_ASK_QUIT_CHATTING, 0);
+ sChat->funcState = 1;
break;
case 1:
- if (!sub_801F644(0))
- gUnknown_02022C84->unk6 = 2;
+ if (!IsDisplaySubtaskActive(0))
+ sChat->funcState = 2;
break;
case 2:
- input = sub_801FF08();
+ input = ProcessMenuInput();
switch (input)
{
case -1:
case 1:
- sub_801F5EC(7, 0);
- gUnknown_02022C84->unk6 = 3;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_DESTROY_YESNO, 0);
+ sChat->funcState = 3;
break;
case 0:
- if (gUnknown_02022C84->unk13 == 0)
+ if (sChat->multiplayerId == 0)
{
- sub_801EFD0(gUnknown_02022C84->unk190);
- sub_801F5EC(7, 0);
- gUnknown_02022C84->unk6 = 9;
+ PrepareSendBuffer_Disband(sChat->sendMessageBuffer);
+ StartDisplaySubtask(CHATDISPLAY_FUNC_DESTROY_YESNO, 0);
+ sChat->funcState = 9;
}
else
{
- sub_801EF7C(gUnknown_02022C84->unk190);
- gUnknown_02022C84->unk6 = 4;
+ PrepareSendBuffer_Leave(sChat->sendMessageBuffer);
+ sChat->funcState = 4;
}
break;
}
break;
case 3:
- if (!sub_801F644(0))
- sub_801EBD4(1);
+ if (!IsDisplaySubtaskActive(0))
+ SetChatFunction(CHAT_FUNC_HANDLE_INPUT);
break;
case 9:
- if (!sub_801F644(0))
+ if (!IsDisplaySubtaskActive(0))
{
- sub_801F5EC(20, 0);
- gUnknown_02022C84->unk6 = 10;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_ASK_CONFIRM_LEADER_LEAVE, 0);
+ sChat->funcState = 10;
}
break;
case 10:
- if (!sub_801F644(0))
- gUnknown_02022C84->unk6 = 8;
+ if (!IsDisplaySubtaskActive(0))
+ sChat->funcState = 8;
break;
case 8:
- input = sub_801FF08();
+ input = ProcessMenuInput();
switch (input)
{
case -1:
case 1:
- sub_801F5EC(7, 0);
- gUnknown_02022C84->unk6 = 3;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_DESTROY_YESNO, 0);
+ sChat->funcState = 3;
break;
case 0:
sub_80104B0();
- sub_801EFD0(gUnknown_02022C84->unk190);
- gUnknown_02022C84->unk6 = 4;
- gUnknown_02022C84->unk1B8 = 0;
+ PrepareSendBuffer_Disband(sChat->sendMessageBuffer);
+ sChat->funcState = 4;
+ sChat->tryQuitAgainTimer = 0;
break;
}
break;
case 4:
- if (IsLinkTaskFinished() && !sub_8011A9C() && SendBlock(0, gUnknown_02022C84->unk190, sizeof(gUnknown_02022C84->unk190)))
+ if (IsLinkTaskFinished() && !sub_8011A9C() && SendBlock(0, sChat->sendMessageBuffer, sizeof(sChat->sendMessageBuffer)))
{
- if (!gUnknown_02022C84->unk13)
- gUnknown_02022C84->unk6 = 6;
+ if (!sChat->multiplayerId)
+ sChat->funcState = 6;
else
- gUnknown_02022C84->unk6 = 5;
+ sChat->funcState = 5;
}
if (!gReceivedRemoteLinkPlayers)
- sub_801EBD4(9);
+ SetChatFunction(CHAT_FUNC_SAVE_AND_EXIT);
break;
case 5:
if (!gReceivedRemoteLinkPlayers)
{
- sub_801EBD4(9);
+ SetChatFunction(CHAT_FUNC_SAVE_AND_EXIT);
}
- else if (++gUnknown_02022C84->unk1B8 > 300)
+ else if (++sChat->tryQuitAgainTimer > 300)
{
- gUnknown_02022C84->unk1B8 = 0;
- gUnknown_02022C84->unk6 = 4;
+ sChat->tryQuitAgainTimer = 0;
+ sChat->funcState = 4;
}
break;
}
}
-static void sub_801E460(void)
+static void Chat_Exit(void)
{
- switch (gUnknown_02022C84->unk6)
+ switch (sChat->funcState)
{
case 0:
- if (!FuncIsActiveTask(sub_801F2B4))
+ if (!FuncIsActiveTask(Task_ReceiveChatMessage))
{
- sub_801F5EC(7, 0);
- gUnknown_02022C84->unk6++;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_DESTROY_YESNO, 0);
+ sChat->funcState++;
}
break;
case 1:
- if (!sub_801F644(0))
+ if (!IsDisplaySubtaskActive(0))
{
- sub_801F5EC(18, 0);
- gUnknown_02022C84->unk6++;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_PRINT_EXITING_CHAT, 0);
+ sChat->funcState++;
}
break;
case 2:
- if (!sub_801F644(0))
+ if (!IsDisplaySubtaskActive(0))
{
- sub_801EFA8(gUnknown_02022C84->unk190);
- gUnknown_02022C84->unk6++;
+ PrepareSendBuffer_Drop(sChat->sendMessageBuffer);
+ sChat->funcState++;
}
break;
case 3:
- if (IsLinkTaskFinished() && !sub_8011A9C() && SendBlock(0, gUnknown_02022C84->unk190, sizeof(gUnknown_02022C84->unk190)))
- gUnknown_02022C84->unk6++;
+ if (IsLinkTaskFinished() && !sub_8011A9C() && SendBlock(0, sChat->sendMessageBuffer, sizeof(sChat->sendMessageBuffer)))
+ sChat->funcState++;
break;
case 4:
if ((GetBlockReceivedStatus() & 1) && !sub_8011A9C())
- gUnknown_02022C84->unk6++;
+ sChat->funcState++;
break;
case 5:
if (IsLinkTaskFinished() && !sub_8011A9C())
{
sub_800AC34();
- gUnknown_02022C84->unkA = 0;
- gUnknown_02022C84->unk6++;
+ sChat->exitDelayTimer = 0;
+ sChat->funcState++;
}
break;
case 6:
- if (gUnknown_02022C84->unkA < 150)
- gUnknown_02022C84->unkA++;
+ if (sChat->exitDelayTimer < 150)
+ sChat->exitDelayTimer++;
if (!gReceivedRemoteLinkPlayers)
- gUnknown_02022C84->unk6++;
+ sChat->funcState++;
break;
case 7:
- if (gUnknown_02022C84->unkA >= 150)
- sub_801EBD4(9);
+ if (sChat->exitDelayTimer >= 150)
+ SetChatFunction(CHAT_FUNC_SAVE_AND_EXIT);
else
- gUnknown_02022C84->unkA++;
+ sChat->exitDelayTimer++;
break;
}
}
-static void sub_801E5C4(void)
+static void Chat_Drop(void)
{
- switch (gUnknown_02022C84->unk6)
+ switch (sChat->funcState)
{
case 0:
- if (!FuncIsActiveTask(sub_801F2B4))
+ if (!FuncIsActiveTask(Task_ReceiveChatMessage))
{
- sub_801F5EC(7, 0);
- gUnknown_02022C84->unk6++;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_DESTROY_YESNO, 0);
+ sChat->funcState++;
}
break;
case 1:
- if (!sub_801F644(0) && IsLinkTaskFinished() && !sub_8011A9C())
+ if (!IsDisplaySubtaskActive(0) && IsLinkTaskFinished() && !sub_8011A9C())
{
sub_800AC34();
- gUnknown_02022C84->unkA = 0;
- gUnknown_02022C84->unk6++;
+ sChat->exitDelayTimer = 0;
+ sChat->funcState++;
}
break;
case 2:
- if (gUnknown_02022C84->unkA < 150)
- gUnknown_02022C84->unkA++;
+ if (sChat->exitDelayTimer < 150)
+ sChat->exitDelayTimer++;
if (!gReceivedRemoteLinkPlayers)
- gUnknown_02022C84->unk6++;
+ sChat->funcState++;
break;
case 3:
- if (gUnknown_02022C84->unkA >= 150)
- sub_801EBD4(9);
+ if (sChat->exitDelayTimer >= 150)
+ SetChatFunction(CHAT_FUNC_SAVE_AND_EXIT);
else
- gUnknown_02022C84->unkA++;
+ sChat->exitDelayTimer++;
break;
}
}
-static void sub_801E668(void)
+static void Chat_Disbanded(void)
{
- switch (gUnknown_02022C84->unk6)
+ switch (sChat->funcState)
{
case 0:
- if (!FuncIsActiveTask(sub_801F2B4))
+ if (!FuncIsActiveTask(Task_ReceiveChatMessage))
{
- if (gUnknown_02022C84->unk13)
- sub_801F5EC(7, 0);
+ if (sChat->multiplayerId)
+ StartDisplaySubtask(CHATDISPLAY_FUNC_DESTROY_YESNO, 0);
- gUnknown_02022C84->unk6++;
+ sChat->funcState++;
}
break;
case 1:
- if (!sub_801F644(0))
+ if (!IsDisplaySubtaskActive(0))
{
- if (gUnknown_02022C84->unk13)
- sub_801F5EC(19, 0);
+ if (sChat->multiplayerId)
+ StartDisplaySubtask(CHATDISPLAY_FUNC_PRINT_LEADER_LEFT, 0);
- gUnknown_02022C84->unk6++;
+ sChat->funcState++;
}
break;
case 2:
- if (sub_801F644(0) != TRUE && IsLinkTaskFinished() && !sub_8011A9C())
+ if (IsDisplaySubtaskActive(0) != TRUE && IsLinkTaskFinished() && !sub_8011A9C())
{
sub_800AC34();
- gUnknown_02022C84->unkA = 0;
- gUnknown_02022C84->unk6++;
+ sChat->exitDelayTimer = 0;
+ sChat->funcState++;
}
break;
case 3:
- if (gUnknown_02022C84->unkA < 150)
- gUnknown_02022C84->unkA++;
+ if (sChat->exitDelayTimer < 150)
+ sChat->exitDelayTimer++;
if (!gReceivedRemoteLinkPlayers)
- gUnknown_02022C84->unk6++;
+ sChat->funcState++;
break;
case 4:
- if (gUnknown_02022C84->unkA >= 150)
- sub_801EBD4(9);
+ if (sChat->exitDelayTimer >= 150)
+ SetChatFunction(CHAT_FUNC_SAVE_AND_EXIT);
else
- gUnknown_02022C84->unkA++;
+ sChat->exitDelayTimer++;
break;
}
}
-static void sub_801E764(void)
+static void Chat_SendMessage(void)
{
- switch (gUnknown_02022C84->unk6)
+ switch (sChat->funcState)
{
case 0:
if (!gReceivedRemoteLinkPlayers)
{
- sub_801EBD4(1);
+ SetChatFunction(CHAT_FUNC_HANDLE_INPUT);
break;
}
- sub_801EF4C(gUnknown_02022C84->unk190);
- gUnknown_02022C84->unk6++;
+ PrepareSendBuffer_Chat(sChat->sendMessageBuffer);
+ sChat->funcState++;
// fall through
case 1:
- if (IsLinkTaskFinished() == TRUE && !sub_8011A9C() && SendBlock(0, gUnknown_02022C84->unk190, sizeof(gUnknown_02022C84->unk190)))
- gUnknown_02022C84->unk6++;
+ if (IsLinkTaskFinished() == TRUE && !sub_8011A9C() && SendBlock(0, sChat->sendMessageBuffer, sizeof(sChat->sendMessageBuffer)))
+ sChat->funcState++;
break;
case 2:
- sub_801EE10();
- sub_801F5EC(8, 0);
- gUnknown_02022C84->unk6++;
+ ResetMessageEntryBuffer();
+ StartDisplaySubtask(CHATDISPLAY_FUNC_UPDATE_MSG, 0);
+ sChat->funcState++;
break;
case 3:
- if (!sub_801F644(0))
- gUnknown_02022C84->unk6++;
+ if (!IsDisplaySubtaskActive(0))
+ sChat->funcState++;
break;
case 4:
if (IsLinkTaskFinished())
- sub_801EBD4(1);
+ SetChatFunction(CHAT_FUNC_HANDLE_INPUT);
break;
}
}
-static void sub_801E838(void)
+static void Chat_Register(void)
{
- switch (gUnknown_02022C84->unk6)
+ switch (sChat->funcState)
{
case 0:
- if (sub_801EDC4())
+ if (ChatMessageIsNotEmpty())
{
- sub_801F5EC(9, 0);
- gUnknown_02022C84->unk6 = 2;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_ASK_REGISTER_TEXT, 0);
+ sChat->funcState = 2;
}
else
{
- sub_801F5EC(13, 0);
- gUnknown_02022C84->unk6 = 5;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_PRINT_INPUT_TEXT, 0);
+ sChat->funcState = 5;
}
break;
case 1:
if (gMain.newKeys & A_BUTTON)
{
- sub_801EDE0();
- sub_801F5EC(11, 0);
- gUnknown_02022C84->unk6 = 3;
+ RegisterTextAtRow();
+ StartDisplaySubtask(CHATDISPLAY_FUNC_RETURN_TO_KB, 0);
+ sChat->funcState = 3;
}
else if (gMain.newKeys & B_BUTTON)
{
- sub_801F5EC(10, 0);
- gUnknown_02022C84->unk6 = 4;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_CANCEL_REGISTER, 0);
+ sChat->funcState = 4;
}
- else if (sub_801EBE4())
+ else if (HandleDPadInput())
{
- sub_801F5EC(1, 0);
- gUnknown_02022C84->unk6 = 2;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_MOVE_KB_CURSOR, 0);
+ sChat->funcState = 2;
}
break;
case 2:
- if (!sub_801F644(0))
- gUnknown_02022C84->unk6 = 1;
+ if (!IsDisplaySubtaskActive(0))
+ sChat->funcState = 1;
break;
case 3:
- if (!sub_801F644(0))
+ if (!IsDisplaySubtaskActive(0))
{
- sub_801F5EC(10, 0);
- gUnknown_02022C84->unk6 = 4;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_CANCEL_REGISTER, 0);
+ sChat->funcState = 4;
}
break;
case 4:
- if (!sub_801F644(0))
- sub_801EBD4(1);
+ if (!IsDisplaySubtaskActive(0))
+ SetChatFunction(CHAT_FUNC_HANDLE_INPUT);
break;
case 5:
- if (!sub_801F644(0))
- gUnknown_02022C84->unk6 = 6;
+ if (!IsDisplaySubtaskActive(0))
+ sChat->funcState = 6;
break;
case 6:
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
- sub_801F5EC(7, 0);
- gUnknown_02022C84->unk6 = 4;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_DESTROY_YESNO, 0);
+ sChat->funcState = 4;
}
break;
}
}
-static void sub_801E978(void)
+static void Chat_SaveAndExit(void)
{
s8 input;
- switch (gUnknown_02022C84->unk6)
+ switch (sChat->funcState)
{
case 0:
- if (!gUnknown_02022C84->unk18)
+ if (!sChat->changedRegisteredTexts)
{
- gUnknown_02022C84->unk6 = 12;
+ sChat->funcState = 12;
}
else
{
- sub_801F5EC(7, 0);
- gUnknown_02022C84->unk6 = 1;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_DESTROY_YESNO, 0);
+ sChat->funcState = 1;
}
break;
case 1:
- if (!sub_801F644(0))
+ if (!IsDisplaySubtaskActive(0))
{
- sub_801F5EC(14, 0);
- gUnknown_02022C84->unk6 = 2;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_ASK_SAVE, 0);
+ sChat->funcState = 2;
}
break;
case 2:
- input = sub_801FF08();
+ input = ProcessMenuInput();
switch (input)
{
case -1:
case 1:
- gUnknown_02022C84->unk6 = 12;
+ sChat->funcState = 12;
break;
case 0:
- sub_801F5EC(7, 0);
- gUnknown_02022C84->unk6 = 3;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_DESTROY_YESNO, 0);
+ sChat->funcState = 3;
break;
}
break;
case 3:
- if (!sub_801F644(0))
+ if (!IsDisplaySubtaskActive(0))
{
- sub_801F5EC(15, 0);
- gUnknown_02022C84->unk6 = 4;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_ASK_OVERWRITE_SAVE, 0);
+ sChat->funcState = 4;
}
break;
case 4:
- if (!sub_801F644(0))
- gUnknown_02022C84->unk6 = 5;
+ if (!IsDisplaySubtaskActive(0))
+ sChat->funcState = 5;
break;
case 5:
- input = sub_801FF08();
+ input = ProcessMenuInput();
switch (input)
{
case -1:
case 1:
- gUnknown_02022C84->unk6 = 12;
+ sChat->funcState = 12;
break;
case 0:
- sub_801F5EC(7, 0);
- gUnknown_02022C84->unk6 = 6;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_DESTROY_YESNO, 0);
+ sChat->funcState = 6;
break;
}
break;
case 6:
- if (!sub_801F644(0))
+ if (!IsDisplaySubtaskActive(0))
{
- sub_801F5EC(16, 0);
- sub_801EE2C();
- gUnknown_02022C84->unk6 = 7;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_PRINT_SAVING, 0);
+ SaveRegisteredTexts();
+ sChat->funcState = 7;
}
break;
case 7:
- if (!sub_801F644(0))
+ if (!IsDisplaySubtaskActive(0))
{
SetContinueGameWarpStatusToDynamicWarp();
TrySavingData(SAVE_NORMAL);
- gUnknown_02022C84->unk6 = 8;
+ sChat->funcState = 8;
}
break;
case 8:
- sub_801F5EC(17, 0);
- gUnknown_02022C84->unk6 = 9;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_PRINT_SAVED_GAME, 0);
+ sChat->funcState = 9;
break;
case 9:
- if (!sub_801F644(0))
+ if (!IsDisplaySubtaskActive(0))
{
PlaySE(SE_SAVE);
ClearContinueGameWarpStatus2();
- gUnknown_02022C84->unk6 = 10;
+ sChat->funcState = 10;
}
break;
case 10:
- gUnknown_02022C84->unk19 = 0;
- gUnknown_02022C84->unk6 = 11;
+ sChat->afterSaveTimer = 0;
+ sChat->funcState = 11;
break;
case 11:
- gUnknown_02022C84->unk19++;
- if (gUnknown_02022C84->unk19 > 120)
- gUnknown_02022C84->unk6 = 12;
+ sChat->afterSaveTimer++;
+ if (sChat->afterSaveTimer > 120)
+ sChat->funcState = 12;
break;
case 12:
BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 16, RGB_BLACK);
- gUnknown_02022C84->unk6 = 13;
+ sChat->funcState = 13;
break;
case 13:
if (!gPaletteFade.active)
{
- sub_801F544();
- sub_801DE30();
+ FreeDisplay();
+ FreeUnionRoomChat();
SetMainCallback2(CB2_ReturnToField);
}
break;
}
}
-static void sub_801EBD4(u16 arg0)
+static void SetChatFunction(u16 funcId)
{
- gUnknown_02022C84->unk4 = arg0;
- gUnknown_02022C84->unk6 = 0;
+ sChat->funcId = funcId;
+ sChat->funcState = 0;
}
-static bool32 sub_801EBE4(void)
+static bool32 HandleDPadInput(void)
{
- if (!(gMain.newAndRepeatedKeys & DPAD_UP))
+ do
{
+ if (gMain.newAndRepeatedKeys & DPAD_UP)
+ {
+ if (sChat->currentRow > 0)
+ sChat->currentRow--;
+ else
+ sChat->currentRow = sKeyboardPageMaxRow[sChat->currentPage];
+ break;
+ }
if (gMain.newAndRepeatedKeys & DPAD_DOWN)
{
- if (gUnknown_02022C84->currentRow < sKeyboardPageMaxRow[gUnknown_02022C84->currentPage])
- gUnknown_02022C84->currentRow++;
+ if (sChat->currentRow < sKeyboardPageMaxRow[sChat->currentPage])
+ sChat->currentRow++;
else
- gUnknown_02022C84->currentRow = 0;
-
- return TRUE;
+ sChat->currentRow = 0;
+ break;
}
-
- if (gUnknown_02022C84->currentPage != UNION_ROOM_KB_PAGE_COUNT)
+ if (sChat->currentPage != UNION_ROOM_KB_PAGE_REGISTER)
{
if (gMain.newAndRepeatedKeys & DPAD_LEFT)
{
- if (gUnknown_02022C84->unk11)
- gUnknown_02022C84->unk11--;
+ if (sChat->currentCol > 0)
+ sChat->currentCol--;
else
- gUnknown_02022C84->unk11 = 4;
+ sChat->currentCol = 4;
+ break;
}
else if (gMain.newAndRepeatedKeys & DPAD_RIGHT)
{
- if (gUnknown_02022C84->unk11 > 3)
- gUnknown_02022C84->unk11 = 0;
+ if (sChat->currentCol < 4)
+ sChat->currentCol++;
else
- gUnknown_02022C84->unk11++;
+ sChat->currentCol = 0;
+ break;
}
- else
- {
- return FALSE;
- }
-
- return TRUE;
}
-
return FALSE;
- }
- else
- {
- if (gUnknown_02022C84->currentRow)
- gUnknown_02022C84->currentRow--;
- else
- gUnknown_02022C84->currentRow = sKeyboardPageMaxRow[gUnknown_02022C84->currentPage];
+ } while (0);
- return TRUE;
- }
+ return TRUE;
}
-static void sub_801EC94(void)
+static void AppendTextToMessage(void)
{
int i;
const u8 *charsStr;
@@ -1357,10 +1640,11 @@ static void sub_801EC94(void)
u8 *str;
u8 buffer[21];
- if (gUnknown_02022C84->currentPage != UNION_ROOM_KB_PAGE_COUNT)
+ if (sChat->currentPage != UNION_ROOM_KB_PAGE_REGISTER)
{
- charsStr = sUnionRoomKeyboardText[gUnknown_02022C84->currentPage][gUnknown_02022C84->currentRow];
- for (i = 0; i < gUnknown_02022C84->unk11; i++)
+ // Going to append a single character
+ charsStr = sUnionRoomKeyboardText[sChat->currentPage][sChat->currentRow];
+ for (i = 0; i < sChat->currentCol; i++)
{
if (*charsStr == CHAR_SPECIAL_F9)
charsStr++;
@@ -1371,19 +1655,20 @@ static void sub_801EC94(void)
}
else
{
- u8 *tempStr = StringCopy(buffer, gUnknown_02022C84->unkB9[gUnknown_02022C84->currentRow]);
+ // Going to append registered text string
+ u8 *tempStr = StringCopy(buffer, sChat->registeredTexts[sChat->currentRow]);
tempStr[0] = CHAR_SPACE;
tempStr[1] = EOS;
charsStr = buffer;
strLength = StringLength_Multibyte(buffer);
}
- gUnknown_02022C84->unk14 = gUnknown_02022C84->unk15;
+ sChat->lastBufferCursorPos = sChat->bufferCursorPos;
if (!charsStr)
return;
- str = sub_801EE84();
- while (--strLength != -1 && gUnknown_02022C84->unk15 < 15)
+ str = GetEndOfMessagePtr();
+ while (--strLength != -1 && sChat->bufferCursorPos < MAX_MESSAGE_LENGTH)
{
if (*charsStr == CHAR_SPECIAL_F9)
{
@@ -1396,103 +1681,103 @@ static void sub_801EC94(void)
charsStr++;
str++;
- gUnknown_02022C84->unk15++;
+ sChat->bufferCursorPos++;
}
*str = EOS;
}
-static void sub_801ED68(void)
+static void DeleteLastMessageCharacter(void)
{
- gUnknown_02022C84->unk14 = gUnknown_02022C84->unk15;
- if (gUnknown_02022C84->unk15)
+ sChat->lastBufferCursorPos = sChat->bufferCursorPos;
+ if (sChat->bufferCursorPos)
{
- u8 *str = sub_801EEA8();
+ u8 *str = GetLastCharOfMessagePtr();
*str = EOS;
- gUnknown_02022C84->unk15--;
+ sChat->bufferCursorPos--;
}
}
-static void sub_801ED94(void)
+static void SwitchCaseOfLastMessageCharacter(void)
{
u8 *str;
u8 character;
- gUnknown_02022C84->unk14 = gUnknown_02022C84->unk15 - 1;
- str = sub_801EEA8();
+ sChat->lastBufferCursorPos = sChat->bufferCursorPos - 1;
+ str = GetLastCharOfMessagePtr();
if (*str != CHAR_SPECIAL_F9)
{
- character = gUnknown_082F2AA8[*str];
+ character = sCaseToggleTable[*str];
if (character)
*str = character;
}
}
-static bool32 sub_801EDC4(void)
+static bool32 ChatMessageIsNotEmpty(void)
{
- if (gUnknown_02022C84->unk15)
+ if (sChat->bufferCursorPos)
return TRUE;
else
return FALSE;
}
-static void sub_801EDE0(void)
+static void RegisterTextAtRow(void)
{
- u8 *src = sub_801F114();
- StringCopy(gUnknown_02022C84->unkB9[gUnknown_02022C84->currentRow], src);
- gUnknown_02022C84->unk18 = 1;
+ u8 *src = GetLimitedMessageStartPtr();
+ StringCopy(sChat->registeredTexts[sChat->currentRow], src);
+ sChat->changedRegisteredTexts = TRUE;
}
-static void sub_801EE10(void)
+static void ResetMessageEntryBuffer(void)
{
- gUnknown_02022C84->unk1A[0] = EOS;
- gUnknown_02022C84->unk14 = 15;
- gUnknown_02022C84->unk15 = 0;
+ sChat->messageEntryBuffer[0] = EOS;
+ sChat->lastBufferCursorPos = 15;
+ sChat->bufferCursorPos = 0;
}
-static void sub_801EE2C(void)
+static void SaveRegisteredTexts(void)
{
int i;
for (i = 0; i < UNION_ROOM_KB_ROW_COUNT; i++)
- StringCopy(gSaveBlock1Ptr->unk3C88[i], gUnknown_02022C84->unkB9[i]);
+ StringCopy(gSaveBlock1Ptr->registeredTexts[i], sChat->registeredTexts[i]);
}
-static u8 *sub_801EE6C(int arg0)
+static u8 *GetRegisteredTextByRow(int row)
{
- return gUnknown_02022C84->unkB9[arg0];
+ return sChat->registeredTexts[row];
}
-static u8 *sub_801EE84(void)
+static u8 *GetEndOfMessagePtr(void)
{
- u8 *str = gUnknown_02022C84->unk1A;
+ u8 *str = sChat->messageEntryBuffer;
while (*str != EOS)
str++;
return str;
}
-static u8 *sub_801EEA8(void)
+static u8 *GetLastCharOfMessagePtr(void)
{
- u8 *str = gUnknown_02022C84->unk1A;
- u8 *str2 = str;
- while (*str != EOS)
+ u8 *currChar = sChat->messageEntryBuffer;
+ u8 *lastChar = currChar;
+ while (*currChar != EOS)
{
- str2 = str;
- if (*str == CHAR_SPECIAL_F9)
- str++;
- str++;
+ lastChar = currChar;
+ if (*currChar == CHAR_SPECIAL_F9)
+ currChar++;
+ currChar++;
}
- return str2;
+ return lastChar;
}
-static u16 sub_801EED8(void)
+static u16 GetNumOverflowCharsInMessage(void)
{
u8 *str;
u32 i, numChars, strLength;
- strLength = StringLength_Multibyte(gUnknown_02022C84->unk1A);
- str = gUnknown_02022C84->unk1A;
+ strLength = StringLength_Multibyte(sChat->messageEntryBuffer);
+ str = sChat->messageEntryBuffer;
numChars = 0;
if (strLength > 10)
{
@@ -1510,83 +1795,83 @@ static u16 sub_801EED8(void)
return numChars;
}
-static void sub_801EF1C(u8 *arg0)
+static void PrepareSendBuffer_Null(u8 *buffer)
{
- arg0[0] = CHAR_SPACE;
+ buffer[0] = CHAT_MESSAGE_NONE;
}
-static void sub_801EF24(u8 *arg0)
+static void PrepareSendBuffer_Join(u8 *buffer)
{
- arg0[0] = 2;
- StringCopy(&arg0[1], gSaveBlock2Ptr->playerName);
- arg0[1 + (PLAYER_NAME_LENGTH + 1)] = gUnknown_02022C84->unk13;
+ buffer[0] = CHAT_MESSAGE_JOIN;
+ StringCopy(&buffer[1], gSaveBlock2Ptr->playerName);
+ buffer[1 + (PLAYER_NAME_LENGTH + 1)] = sChat->multiplayerId;
}
-static void sub_801EF4C(u8 *arg0)
+static void PrepareSendBuffer_Chat(u8 *buffer)
{
- arg0[0] = 1;
- StringCopy(&arg0[1], gSaveBlock2Ptr->playerName);
- StringCopy(&arg0[1 + (PLAYER_NAME_LENGTH + 1)], gUnknown_02022C84->unk1A);
+ buffer[0] = CHAT_MESSAGE_CHAT;
+ StringCopy(&buffer[1], gSaveBlock2Ptr->playerName);
+ StringCopy(&buffer[1 + (PLAYER_NAME_LENGTH + 1)], sChat->messageEntryBuffer);
}
-static void sub_801EF7C(u8 *arg0)
+static void PrepareSendBuffer_Leave(u8 *buffer)
{
- arg0[0] = 3;
- StringCopy(&arg0[1], gSaveBlock2Ptr->playerName);
- arg0[1 + (PLAYER_NAME_LENGTH + 1)] = gUnknown_02022C84->unk13;
+ buffer[0] = CHAT_MESSAGE_LEAVE;
+ StringCopy(&buffer[1], gSaveBlock2Ptr->playerName);
+ buffer[1 + (PLAYER_NAME_LENGTH + 1)] = sChat->multiplayerId;
sub_8011A50();
}
-static void sub_801EFA8(u8 *arg0)
+static void PrepareSendBuffer_Drop(u8 *buffer)
{
- arg0[0] = 4;
- StringCopy(&arg0[1], gSaveBlock2Ptr->playerName);
- arg0[1 + (PLAYER_NAME_LENGTH + 1)] = gUnknown_02022C84->unk13;
+ buffer[0] = CHAT_MESSAGE_DROP;
+ StringCopy(&buffer[1], gSaveBlock2Ptr->playerName);
+ buffer[1 + (PLAYER_NAME_LENGTH + 1)] = sChat->multiplayerId;
}
-static void sub_801EFD0(u8 *arg0)
+static void PrepareSendBuffer_Disband(u8 *buffer)
{
- arg0[0] = 5;
- StringCopy(&arg0[1], gSaveBlock2Ptr->playerName);
- arg0[1 + (PLAYER_NAME_LENGTH + 1)] = gUnknown_02022C84->unk13;
+ buffer[0] = CHAT_MESSAGE_DISBAND;
+ StringCopy(&buffer[1], gSaveBlock2Ptr->playerName);
+ buffer[1 + (PLAYER_NAME_LENGTH + 1)] = sChat->multiplayerId;
}
-static bool32 sub_801EFF8(u8 *arg0, u8 *arg1)
+static bool32 ProcessReceivedChatMessage(u8 *dest, u8 *recvMessage)
{
u8 *tempStr;
- u8 var0 = *arg1;
- u8 *str = arg1 + 1;
- arg1 = str;
- arg1 += 8;
+ u8 cmd = *recvMessage;
+ u8 *name = recvMessage + 1;
+ recvMessage = name;
+ recvMessage += PLAYER_NAME_LENGTH + 1;
- switch (var0)
+ switch (cmd)
{
- case 2:
- if (gUnknown_02022C84->unk13 != str[8])
+ case CHAT_MESSAGE_JOIN:
+ if (sChat->multiplayerId != name[PLAYER_NAME_LENGTH + 1])
{
DynamicPlaceholderTextUtil_Reset();
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, str);
- DynamicPlaceholderTextUtil_ExpandPlaceholders(arg0, gText_F700JoinedChat);
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, name);
+ DynamicPlaceholderTextUtil_ExpandPlaceholders(dest, gText_F700JoinedChat);
return TRUE;
}
break;
- case 1:
- tempStr = StringCopy(arg0, str);
+ case CHAT_MESSAGE_CHAT:
+ tempStr = StringCopy(dest, name);
*(tempStr++) = EXT_CTRL_CODE_BEGIN;
*(tempStr++) = EXT_CTRL_CODE_CLEAR_TO;
*(tempStr++) = 42;
*(tempStr++) = CHAR_COLON;
- StringCopy(tempStr, arg1);
+ StringCopy(tempStr, recvMessage);
return TRUE;
- case 5:
- StringCopy(gUnknown_02022C84->unk79, str);
+ case CHAT_MESSAGE_DISBAND:
+ StringCopy(sChat->hostName, name);
// fall through
- case 3:
- if (gUnknown_02022C84->unk13 != *arg1)
+ case CHAT_MESSAGE_LEAVE:
+ if (sChat->multiplayerId != *recvMessage)
{
DynamicPlaceholderTextUtil_Reset();
- DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, str);
- DynamicPlaceholderTextUtil_ExpandPlaceholders(arg0, gText_F700LeftChat);
+ DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, name);
+ DynamicPlaceholderTextUtil_ExpandPlaceholders(dest, gText_F700LeftChat);
return TRUE;
}
break;
@@ -1597,47 +1882,47 @@ static bool32 sub_801EFF8(u8 *arg0, u8 *arg1)
static u8 GetCurrentKeyboardPage(void)
{
- return gUnknown_02022C84->currentPage;
+ return sChat->currentPage;
}
-static void sub_801F0BC(u8 *arg0, u8 *arg1)
+static void GetCurrentKeyboardColAndRow(u8 *col, u8 *row)
{
- *arg0 = gUnknown_02022C84->unk11;
- *arg1 = gUnknown_02022C84->currentRow;
+ *col = sChat->currentCol;
+ *row = sChat->currentRow;
}
-static u8 *sub_801F0D0(void)
+static u8 *GetMessageEntryBuffer(void)
{
- return gUnknown_02022C84->unk1A;
+ return sChat->messageEntryBuffer;
}
-static int sub_801F0DC(void)
+static int GetLengthOfMessageEntry(void)
{
- u8 *str = sub_801F0D0();
+ u8 *str = GetMessageEntryBuffer();
return StringLength_Multibyte(str);
}
-static void sub_801F0EC(u32 *arg0, u32 *arg1)
+static void GetBufferSelectionRegion(u32 *x, u32 *width)
{
- int diff = gUnknown_02022C84->unk15 - gUnknown_02022C84->unk14;
+ int diff = sChat->bufferCursorPos - sChat->lastBufferCursorPos;
if (diff < 0)
{
diff *= -1;
- *arg0 = gUnknown_02022C84->unk15;
+ *x = sChat->bufferCursorPos;
}
else
{
- *arg0 = gUnknown_02022C84->unk14;
+ *x = sChat->lastBufferCursorPos;
}
- *arg1 = diff;
+ *width = diff;
}
-static u8 *sub_801F114(void)
+static u8 *GetLimitedMessageStartPtr(void)
{
int i;
- u16 numChars = sub_801EED8();
- u8 *str = gUnknown_02022C84->unk1A;
+ u16 numChars = GetNumOverflowCharsInMessage();
+ u8 *str = sChat->messageEntryBuffer;
for (i = 0; i < numChars; i++)
{
if (*str == CHAR_SPECIAL_F9)
@@ -1649,12 +1934,12 @@ static u8 *sub_801F114(void)
return str;
}
-static u16 sub_801F144(void)
+static u16 GetLimitedMessageStartPos(void)
{
u16 count;
u32 i;
- u16 numChars = sub_801EED8();
- u8 *str = gUnknown_02022C84->unk1A;
+ u16 numChars = GetNumOverflowCharsInMessage();
+ u8 *str = sChat->messageEntryBuffer;
for (count = 0, i = 0; i < numChars; count++, i++)
{
if (*str == CHAR_SPECIAL_F9)
@@ -1666,56 +1951,63 @@ static u16 sub_801F144(void)
return count;
}
-static u8 *sub_801F180(void)
+static u8 *GetLastReceivedMessage(void)
{
- return gUnknown_02022C84->unk39;
+ return sChat->receivedMessage;
}
-static u8 sub_801F18C(void)
+static u8 GetReceivedPlayerIndex(void)
{
- return gUnknown_02022C84->unk16;
+ return sChat->receivedPlayerIndex;
}
-static int sub_801F198(void)
+static int GetTextEntryCursorPosition(void)
{
- return gUnknown_02022C84->unk15;
+ return sChat->bufferCursorPos;
}
-static int sub_801F1A4(void)
+static int GetShouldShowCaseToggleIcon(void)
{
- u8 *str = sub_801EEA8();
+ u8 *str = GetLastCharOfMessagePtr();
u32 character = *str;
- if (character > 0xFF || gUnknown_082F2AA8[character] == character || gUnknown_082F2AA8[character] == 0)
+ if (character > 0xFF || sCaseToggleTable[character] == character || sCaseToggleTable[character] == 0)
return 3;
else
return 0;
}
-static u8 *sub_801F1D0(void)
+static u8 *GetChatHostName(void)
{
- return gUnknown_02022C84->unk79;
+ return sChat->hostName;
}
-void copy_strings_to_sav1(void)
+void InitUnionRoomChatRegisteredTexts(void)
{
- StringCopy(gSaveBlock1Ptr->unk3C88[0], gText_Hello);
- StringCopy(gSaveBlock1Ptr->unk3C88[1], gText_Pokemon2);
- StringCopy(gSaveBlock1Ptr->unk3C88[2], gText_Trade);
- StringCopy(gSaveBlock1Ptr->unk3C88[3], gText_Battle);
- StringCopy(gSaveBlock1Ptr->unk3C88[4], gText_Lets);
- StringCopy(gSaveBlock1Ptr->unk3C88[5], gText_Ok);
- StringCopy(gSaveBlock1Ptr->unk3C88[6], gText_Sorry);
- StringCopy(gSaveBlock1Ptr->unk3C88[7], gText_YaySmileEmoji);
- StringCopy(gSaveBlock1Ptr->unk3C88[8], gText_ThankYou);
- StringCopy(gSaveBlock1Ptr->unk3C88[9], gText_ByeBye);
+ StringCopy(gSaveBlock1Ptr->registeredTexts[0], gText_Hello);
+ StringCopy(gSaveBlock1Ptr->registeredTexts[1], gText_Pokemon2);
+ StringCopy(gSaveBlock1Ptr->registeredTexts[2], gText_Trade);
+ StringCopy(gSaveBlock1Ptr->registeredTexts[3], gText_Battle);
+ StringCopy(gSaveBlock1Ptr->registeredTexts[4], gText_Lets);
+ StringCopy(gSaveBlock1Ptr->registeredTexts[5], gText_Ok);
+ StringCopy(gSaveBlock1Ptr->registeredTexts[6], gText_Sorry);
+ StringCopy(gSaveBlock1Ptr->registeredTexts[7], gText_YaySmileEmoji);
+ StringCopy(gSaveBlock1Ptr->registeredTexts[8], gText_ThankYou);
+ StringCopy(gSaveBlock1Ptr->registeredTexts[9], gText_ByeBye);
}
-static void sub_801F2B4(u8 taskId)
+#define tState data[0]
+#define tI data[1]
+#define tCurrLinkPlayer data[2]
+#define tBlockReceivedStatus data[3]
+#define tLinkPlayerCount data[4]
+#define tNextState data[5]
+
+static void Task_ReceiveChatMessage(u8 taskId)
{
u8 *buffer;
s16 *data = gTasks[taskId].data;
- switch (data[0])
+ switch (tState)
{
case 0:
if (!gReceivedRemoteLinkPlayers)
@@ -1724,115 +2016,122 @@ static void sub_801F2B4(u8 taskId)
return;
}
- data[0] = 1;
+ tState = 1;
// fall through
case 1:
- data[4] = GetLinkPlayerCount();
- if (gUnknown_02022C84->unkD != data[4])
+ tLinkPlayerCount = GetLinkPlayerCount();
+ if (sChat->linkPlayerCount != tLinkPlayerCount)
{
- data[0] = 2;
- gUnknown_02022C84->unkD = data[4];
+ tState = 2;
+ sChat->linkPlayerCount = tLinkPlayerCount;
return;
}
- data[3] = GetBlockReceivedStatus();
- if (!data[3] && sub_8011A9C())
+ tBlockReceivedStatus = GetBlockReceivedStatus();
+ if (!tBlockReceivedStatus && sub_8011A9C())
return;
- data[1] = 0;
- data[0] = 3;
+ tI = 0;
+ tState = 3;
// fall through
case 3:
- for (; data[1] < 5 && ((data[3] >> data[1]) & 1) == 0; data[1]++)
+ for (; tI < 5 && ((tBlockReceivedStatus >> tI) & 1) == 0; tI++)
;
- if (data[1] == 5)
+ if (tI == 5)
{
- data[0] = 1;
+ tState = 1;
return;
}
- data[2] = data[1];
- ResetBlockReceivedFlag(data[2]);
- buffer = (u8 *)gBlockRecvBuffer[data[1]];
+ tCurrLinkPlayer = tI;
+ ResetBlockReceivedFlag(tCurrLinkPlayer);
+ buffer = (u8 *)gBlockRecvBuffer[tI];
switch (buffer[0])
{
default:
- case 1: data[5] = 3; break;
- case 2: data[5] = 3; break;
- case 3: data[5] = 4; break;
- case 4: data[5] = 5; break;
- case 5: data[5] = 6; break;
+ case CHAT_MESSAGE_CHAT: tNextState = 3; break;
+ case CHAT_MESSAGE_JOIN: tNextState = 3; break;
+ case CHAT_MESSAGE_LEAVE: tNextState = 4; break;
+ case CHAT_MESSAGE_DROP: tNextState = 5; break;
+ case CHAT_MESSAGE_DISBAND: tNextState = 6; break;
}
- if (sub_801EFF8(gUnknown_02022C84->unk39, (u8 *)gBlockRecvBuffer[data[1]]))
+ if (ProcessReceivedChatMessage(sChat->receivedMessage, (u8 *)gBlockRecvBuffer[tI]))
{
- gUnknown_02022C84->unk16 = data[1];
- sub_801F5EC(12, 2);
- data[0] = 7;
+ sChat->receivedPlayerIndex = tI;
+ StartDisplaySubtask(CHATDISPLAY_FUNC_SCROLL_CHAT, 2);
+ tState = 7;
}
else
{
- data[0] = data[5];
+ tState = tNextState;
}
- data[1]++;
+ tI++;
break;
case 7:
- if (!sub_801F644(2))
- data[0] = data[5];
+ if (!IsDisplaySubtaskActive(2))
+ tState = tNextState;
break;
case 4:
- if (!gUnknown_02022C84->unk13 && data[2])
+ if (!sChat->multiplayerId && tCurrLinkPlayer)
{
if (GetLinkPlayerCount() == 2)
{
sub_80104B0();
- gUnknown_02022C84->unk17 = 1;
+ sChat->exitType = 1;
DestroyTask(taskId);
return;
}
- sub_8011DE0(data[2]);
+ sub_8011DE0(tCurrLinkPlayer);
}
- data[0] = 3;
+ tState = 3;
break;
case 5:
- if (gUnknown_02022C84->unk13)
- gUnknown_02022C84->unk17 = 2;
+ if (sChat->multiplayerId)
+ sChat->exitType = 2;
DestroyTask(taskId);
break;
case 6:
- gUnknown_02022C84->unk17 = 3;
+ sChat->exitType = 3;
DestroyTask(taskId);
break;
case 2:
if (!sub_8011A9C())
{
- if (!gUnknown_02022C84->unk13)
- sub_80110B8(gUnknown_02022C84->unkD);
+ if (!sChat->multiplayerId)
+ sub_80110B8(sChat->linkPlayerCount);
- data[0] = 1;
+ tState = 1;
}
break;
}
}
-static bool8 sub_801F4D0(void)
+#undef tNextState
+#undef tLinkPlayerCount
+#undef tBlockReceivedStatus
+#undef tCurrLinkPlayer
+#undef tI
+#undef tState
+
+static bool8 TryAllocDisplay(void)
{
- gUnknown_02022C88 = Alloc(sizeof(*gUnknown_02022C88));
- if (gUnknown_02022C88 && sub_8020890())
+ sDisplay = Alloc(sizeof(*sDisplay));
+ if (sDisplay && TryAllocSprites())
{
ResetBgsAndClearDma3BusyFlags(0);
- InitBgsFromTemplates(0, gUnknown_082F2C60, ARRAY_COUNT(gUnknown_082F2C60));
- InitWindows(gUnknown_082F2C70);
+ InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates));
+ InitWindows(sWinTemplates);
ResetTempTileDataBuffers();
- sub_8020770();
- sub_801F574(gUnknown_02022C88);
- sub_801F580();
- sub_801F5EC(0, 0);
+ InitScanlineEffect();
+ InitDisplay(sDisplay);
+ ResetDisplaySubtasks();
+ StartDisplaySubtask(CHATDISPLAY_FUNC_LOAD_GFX, 0);
return TRUE;
}
else
@@ -1841,80 +2140,80 @@ static bool8 sub_801F4D0(void)
}
}
-static bool32 sub_801F534(void)
+static bool32 IsDisplaySubtask0Active(void)
{
- return sub_801F644(0);
+ return IsDisplaySubtaskActive(0);
}
-static void sub_801F544(void)
+static void FreeDisplay(void)
{
- sub_80208D0();
- if (gUnknown_02022C88)
- FREE_AND_SET_NULL(gUnknown_02022C88);
+ FreeSprites();
+ if (sDisplay)
+ FREE_AND_SET_NULL(sDisplay);
FreeAllWindowBuffers();
gScanlineEffect.state = 3;
}
-static void sub_801F574(struct UnionRoomChat2 *arg0)
+static void InitDisplay(struct UnionRoomChatDisplay *display)
{
- arg0->unk18 = 0xFF;
- arg0->unk1E = 0xFF;
- arg0->unk1A = 0;
+ display->yesNoMenuWindowId = 0xFF;
+ display->messageWindowId = 0xFF;
+ display->currLine = 0;
}
-static void sub_801F580(void)
+static void ResetDisplaySubtasks(void)
{
int i;
- if (!gUnknown_02022C88)
+ if (!sDisplay)
return;
- for (i = 0; i < 3; i++)
+ for (i = 0; i < (int)ARRAY_COUNT(sDisplay->subtasks); i++)
{
- gUnknown_02022C88->unk0[i].unk0 = sub_801FDD8;
- gUnknown_02022C88->unk0[i].unk4 = 0;
- gUnknown_02022C88->unk0[i].unk5 = 0;
+ sDisplay->subtasks[i].callback = Display_Dummy;
+ sDisplay->subtasks[i].active = FALSE;
+ sDisplay->subtasks[i].state = 0;
}
}
-static void sub_801F5B8(void)
+static void RunDisplaySubtasks(void)
{
int i;
- if (!gUnknown_02022C88)
+ if (!sDisplay)
return;
- for (i = 0; i < 3; i++)
+ for (i = 0; i < (int)ARRAY_COUNT(sDisplay->subtasks); i++)
{
- gUnknown_02022C88->unk0[i].unk4 =
- gUnknown_02022C88->unk0[i].unk0(&gUnknown_02022C88->unk0[i].unk5);
+ sDisplay->subtasks[i].active =
+ sDisplay->subtasks[i].callback(&sDisplay->subtasks[i].state);
}
}
-static void sub_801F5EC(u16 arg0, u8 arg1)
+static void StartDisplaySubtask(u16 subtaskId, u8 assignId)
{
u32 i;
- gUnknown_02022C88->unk0[arg1].unk0 = sub_801FDD8;
- for (i = 0; i < 21; i++)
+ sDisplay->subtasks[assignId].callback = Display_Dummy;
+ for (i = 0; i < ARRAY_COUNT(sDisplaySubtasks); i++)
{
- if (gUnknown_082F2C98[i].unk0 == arg0)
+ if (sDisplaySubtasks[i].idx == subtaskId)
{
- gUnknown_02022C88->unk0[arg1].unk0 = gUnknown_082F2C98[i].unk4;
- gUnknown_02022C88->unk0[arg1].unk4 = 1;
- gUnknown_02022C88->unk0[arg1].unk5 = 0;
+ sDisplay->subtasks[assignId].callback = sDisplaySubtasks[i].callback;
+ sDisplay->subtasks[assignId].active = TRUE;
+ sDisplay->subtasks[assignId].state = 0;
break;
}
}
}
-static bool8 sub_801F644(u8 arg0)
+static bool8 IsDisplaySubtaskActive(u8 id)
{
- return gUnknown_02022C88->unk0[arg0].unk4;
+ return sDisplay->subtasks[id].active;
}
-bool32 sub_801F658(u8 *state)
+static bool32 Display_LoadGfx(u8 *state)
{
if (FreeTempTileDataBuffersIfPossible() == TRUE)
return TRUE;
@@ -1922,33 +2221,33 @@ bool32 sub_801F658(u8 *state)
switch (*state)
{
case 0:
- sub_8020480();
- sub_8020538();
+ ResetGpuBgState();
+ SetBgTilemapBuffers();
break;
case 1:
- sub_8020584();
+ ClearBg0();
break;
case 2:
- sub_80205B4();
+ LoadChatWindowBorderGfx();
break;
case 3:
- sub_8020604();
+ LoadChatWindowGfx();
break;
case 4:
sub_8020680();
break;
case 5:
- sub_80206A4();
- sub_80206D0();
- sub_8020740();
- sub_80206E8();
+ LoadChatMessagesWindow();
+ LoadKeyboardWindow();
+ LoadKeyboardSwapWindow();
+ LoadTextEntryWindow();
break;
case 6:
if (!IsDma3ManagerBusyWithBgCopy())
{
- sub_80208E8();
- sub_8020A68();
- sub_8020B20();
+ CreateKeyboardCursorSprite();
+ CreateTextEntrySprites();
+ CreateRButtonSprites();
}
break;
default:
@@ -1959,12 +2258,12 @@ bool32 sub_801F658(u8 *state)
return TRUE;
}
-bool32 sub_801F6F8(u8 *state)
+static bool32 Display_ShowKeyboardSwapMenu(u8 *state)
{
switch (*state)
{
case 0:
- sub_80203B0();
+ ShowKeyboardSwapMenu();
CopyWindowToVram(3, 3);
break;
case 1:
@@ -1975,12 +2274,12 @@ bool32 sub_801F6F8(u8 *state)
return TRUE;
}
-bool32 sub_801F730(u8 *state)
+static bool32 Display_HideKeyboardSwapMenu(u8 *state)
{
switch (*state)
{
case 0:
- sub_802040C();
+ HideKeyboardSwapMenu();
CopyWindowToVram(3, 3);
break;
case 1:
@@ -1991,16 +2290,16 @@ bool32 sub_801F730(u8 *state)
return TRUE;
}
-bool32 sub_801F768(u8 *state)
+static bool32 Display_SwitchPages(u8 *state)
{
switch (*state)
{
case 0:
- sub_802091C(TRUE);
+ SetKeyboardCursorInvisibility(TRUE);
if (sub_8020320())
return TRUE;
- sub_80201A4();
+ PrintCurrentKeyboardPage();
CopyWindowToVram(2, 2);
break;
case 1:
@@ -2011,9 +2310,9 @@ bool32 sub_801F768(u8 *state)
if (sub_8020368())
return TRUE;
- sub_802093C();
- sub_802091C(FALSE);
- sub_8020B80();
+ MoveKeyboardCursor();
+ SetKeyboardCursorInvisibility(FALSE);
+ UpdateRButtonLabel();
return FALSE;
}
@@ -2021,20 +2320,20 @@ bool32 sub_801F768(u8 *state)
return TRUE;
}
-bool32 sub_801F7D4(u8 *state)
+static bool32 Display_MoveKeyboardCursor(u8 *state)
{
- sub_802093C();
+ MoveKeyboardCursor();
return FALSE;
}
-bool32 sub_801F7E0(u8 *state)
+static bool32 Display_AskQuitChatting(u8 *state)
{
switch (*state)
{
case 0:
- sub_801FF18(0, 0);
- sub_801FDDC(23, 11, 1);
- CopyWindowToVram(gUnknown_02022C88->unk1E, 3);
+ AddStdMessageWindow(STDMESSAGE_QUIT_CHATTING, 0);
+ AddYesNoMenuAt(23, 11, 1);
+ CopyWindowToVram(sDisplay->messageWindowId, 3);
break;
case 1:
return IsDma3ManagerBusyWithBgCopy();
@@ -2044,21 +2343,21 @@ bool32 sub_801F7E0(u8 *state)
return TRUE;
}
-bool32 sub_801F82C(u8 *state)
+static bool32 Display_DestroyYesNoDialog(u8 *state)
{
switch (*state)
{
case 0:
- sub_8020094();
- sub_801FEBC();
+ HideStdMessageWindow();
+ HideYesNoMenuWindow();
CopyBgTilemapBufferToVram(0);
break;
case 1:
if (IsDma3ManagerBusyWithBgCopy())
return TRUE;
- sub_80200C8();
- sub_801FEE4();
+ DestroyStdMessageWindow();
+ DestroyYesNoMenuWindow();
return FALSE;
}
@@ -2066,24 +2365,24 @@ bool32 sub_801F82C(u8 *state)
return TRUE;
}
-bool32 sub_801F870(u8 *state)
+static bool32 Display_UpdateMessageBuffer(u8 *state)
{
- u32 var0, var1;
+ u32 x, width;
u8 *str;
switch (*state)
{
case 0:
- sub_801F0EC(&var0, &var1);
- sub_80200EC(var0, var1, 0);
- str = sub_801F0D0();
- sub_8020118(0, str, 3, 1, 2);
+ GetBufferSelectionRegion(&x, &width);
+ FillTextEntryWindow(x, width, 0);
+ str = GetMessageEntryBuffer();
+ DrawTextEntryMessage(0, str, 3, 1, 2);
CopyWindowToVram(1, 2);
break;
case 1:
if (!IsDma3ManagerBusyWithBgCopy())
{
- sub_8020B80();
+ UpdateRButtonLabel();
return FALSE;
}
return TRUE;
@@ -2093,27 +2392,27 @@ bool32 sub_801F870(u8 *state)
return TRUE;
}
-bool32 sub_801F8DC(u8 *state)
+static bool32 Display_AskRegisterText(u8 *state)
{
- u16 var0;
+ u16 x;
u8 *str;
u16 length;
switch (*state)
{
case 0:
- var0 = sub_801F144();
- str = sub_801F114();
+ x = GetLimitedMessageStartPos();
+ str = GetLimitedMessageStartPtr();
length = StringLength_Multibyte(str);
- sub_80200EC(var0, length, PIXEL_FILL(6));
- sub_8020118(var0, str, 0, 4, 5);
+ FillTextEntryWindow(x, length, PIXEL_FILL(6));
+ DrawTextEntryMessage(x, str, 0, 4, 5);
CopyWindowToVram(1, 2);
break;
case 1:
if (!IsDma3ManagerBusyWithBgCopy())
{
- sub_801FF18(1, 16);
- CopyWindowToVram(gUnknown_02022C88->unk1E, 3);
+ AddStdMessageWindow(STDMESSAGE_REGISTER_WHERE, 16);
+ CopyWindowToVram(sDisplay->messageWindowId, 3);
}
else
{
@@ -2122,7 +2421,7 @@ bool32 sub_801F8DC(u8 *state)
break;
case 2:
if (!IsDma3ManagerBusyWithBgCopy())
- sub_80209AC(1);
+ SetRegisteredTextPalette(TRUE);
else
return TRUE;
break;
@@ -2134,27 +2433,27 @@ bool32 sub_801F8DC(u8 *state)
return TRUE;
}
-bool32 sub_801F984(u8 *state)
+static bool32 Display_CancelRegister(u8 *state)
{
- u16 var0;
+ u16 x;
u8 *str;
u16 length;
switch (*state)
{
case 0:
- var0 = sub_801F144();
- str = sub_801F114();
+ x = GetLimitedMessageStartPos();
+ str = GetLimitedMessageStartPtr();
length = StringLength_Multibyte(str);
- sub_80200EC(var0, length, PIXEL_FILL(0));
- sub_8020118(var0, str, 3, 1, 2);
+ FillTextEntryWindow(x, length, PIXEL_FILL(0));
+ DrawTextEntryMessage(x, str, 3, 1, 2);
CopyWindowToVram(1, 2);
break;
case 1:
if (!IsDma3ManagerBusyWithBgCopy())
{
- sub_8020094();
- CopyWindowToVram(gUnknown_02022C88->unk1E, 3);
+ HideStdMessageWindow();
+ CopyWindowToVram(sDisplay->messageWindowId, 3);
}
else
{
@@ -2164,8 +2463,8 @@ bool32 sub_801F984(u8 *state)
case 2:
if (!IsDma3ManagerBusyWithBgCopy())
{
- sub_80209AC(0);
- sub_80200C8();
+ SetRegisteredTextPalette(FALSE);
+ DestroyStdMessageWindow();
}
else
{
@@ -2180,12 +2479,12 @@ bool32 sub_801F984(u8 *state)
return TRUE;
}
-bool32 sub_801FA2C(u8 *state)
+static bool32 Display_ReturnToKeyboard(u8 *state)
{
switch (*state)
{
case 0:
- sub_80201A4();
+ PrintCurrentKeyboardPage();
CopyWindowToVram(2, 2);
(*state)++;
break;
@@ -2199,48 +2498,48 @@ bool32 sub_801FA2C(u8 *state)
return TRUE;
}
-bool32 sub_801FA68(u8 *state)
+static bool32 Display_ScrollChat(u8 *state)
{
- u16 var0;
+ u16 row;
u8 *str;
- u8 var1;
+ u8 colorIdx;
switch (*state)
{
case 0:
- var0 = gUnknown_02022C88->unk1A;
- str = sub_801F180();
- var1 = sub_801F18C();
- sub_8020420(var0, str, var1);
+ row = sDisplay->currLine;
+ str = GetLastReceivedMessage();
+ colorIdx = GetReceivedPlayerIndex();
+ PrintChatMessage(row, str, colorIdx);
CopyWindowToVram(0, 2);
break;
case 1:
if (IsDma3ManagerBusyWithBgCopy())
return TRUE;
- if (gUnknown_02022C88->unk1A < 9)
+ if (sDisplay->currLine < 9)
{
- gUnknown_02022C88->unk1A++;
+ sDisplay->currLine++;
*state = 4;
return FALSE;
}
else
{
- gUnknown_02022C88->unk1C = 0;
+ sDisplay->scrollCount = 0;
(*state)++;
}
// fall through
case 2:
ScrollWindow(0, 0, 5, PIXEL_FILL(1));
CopyWindowToVram(0, 2);
- gUnknown_02022C88->unk1C++;
+ sDisplay->scrollCount++;
(*state)++;
// fall through
case 3:
if (IsDma3ManagerBusyWithBgCopy())
return TRUE;
- if (gUnknown_02022C88->unk1C < 3)
+ if (sDisplay->scrollCount < 3)
{
(*state)--;
return TRUE;
@@ -2256,28 +2555,28 @@ bool32 sub_801FA68(u8 *state)
return TRUE;
}
-bool32 sub_801FB44(u8 *state)
+static bool32 Display_AnimateKeyboardCursor(u8 *state)
{
switch (*state)
{
case 0:
- sub_80209E0();
+ StartKeyboardCursorAnim();
(*state)++;
break;
case 1:
- return sub_8020A1C();
+ return TryKeyboardCursorReopen();
}
return TRUE;
}
-bool32 sub_801FB70(u8 *state)
+static bool32 Display_PrintInputText(u8 *state)
{
switch (*state)
{
case 0:
- sub_801FF18(3, 16);
- CopyWindowToVram(gUnknown_02022C88->unk1E, 3);
+ AddStdMessageWindow(STDMESSAGE_INPUT_TEXT, 16);
+ CopyWindowToVram(sDisplay->messageWindowId, 3);
(*state)++;
break;
case 1:
@@ -2287,13 +2586,13 @@ bool32 sub_801FB70(u8 *state)
return TRUE;
}
-bool32 sub_801FBB4(u8 *state)
+static bool32 Display_PrintExitingChat(u8 *state)
{
switch (*state)
{
case 0:
- sub_801FF18(4, 0);
- CopyWindowToVram(gUnknown_02022C88->unk1E, 3);
+ AddStdMessageWindow(STDMESSAGE_EXITING_CHAT, 0);
+ CopyWindowToVram(sDisplay->messageWindowId, 3);
(*state)++;
break;
case 1:
@@ -2303,7 +2602,7 @@ bool32 sub_801FBB4(u8 *state)
return TRUE;
}
-bool32 sub_801FBF8(u8 *state)
+static bool32 Display_PrintLeaderLeft(u8 *state)
{
u8 *str;
@@ -2311,10 +2610,10 @@ bool32 sub_801FBF8(u8 *state)
{
case 0:
DynamicPlaceholderTextUtil_Reset();
- str = sub_801F1D0();
+ str = GetChatHostName();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, str);
- sub_801FF18(5, 0);
- CopyWindowToVram(gUnknown_02022C88->unk1E, 3);
+ AddStdMessageWindow(STDMESSAGE_LEADER_LEFT, 0);
+ CopyWindowToVram(sDisplay->messageWindowId, 3);
(*state)++;
break;
case 1:
@@ -2324,14 +2623,14 @@ bool32 sub_801FBF8(u8 *state)
return TRUE;
}
-bool32 sub_801FC4C(u8 *state)
+static bool32 Display_AskSave(u8 *state)
{
switch (*state)
{
case 0:
- sub_801FF18(6, 0);
- sub_801FDDC(23, 10, 1);
- CopyWindowToVram(gUnknown_02022C88->unk1E, 3);
+ AddStdMessageWindow(STDMESSAGE_ASK_SAVE, 0);
+ AddYesNoMenuAt(23, 10, 1);
+ CopyWindowToVram(sDisplay->messageWindowId, 3);
(*state)++;
break;
case 1:
@@ -2341,14 +2640,14 @@ bool32 sub_801FC4C(u8 *state)
return TRUE;
}
-bool32 sub_801FC9C(u8 *state)
+static bool32 Display_AskOverwriteSave(u8 *state)
{
switch (*state)
{
case 0:
- sub_801FF18(7, 0);
- sub_801FDDC(23, 10, 1);
- CopyWindowToVram(gUnknown_02022C88->unk1E, 3);
+ AddStdMessageWindow(STDMESSAGE_ASK_OVERWRITE, 0);
+ AddYesNoMenuAt(23, 10, 1);
+ CopyWindowToVram(sDisplay->messageWindowId, 3);
(*state)++;
break;
case 1:
@@ -2358,13 +2657,13 @@ bool32 sub_801FC9C(u8 *state)
return TRUE;
}
-bool32 sub_801FCEC(u8 *state)
+static bool32 Display_PrintSavingDontTurnOff(u8 *state)
{
switch (*state)
{
case 0:
- sub_801FF18(8, 0);
- CopyWindowToVram(gUnknown_02022C88->unk1E, 3);
+ AddStdMessageWindow(STDMESSAGE_SAVING_NO_OFF, 0);
+ CopyWindowToVram(sDisplay->messageWindowId, 3);
(*state)++;
break;
case 1:
@@ -2374,15 +2673,15 @@ bool32 sub_801FCEC(u8 *state)
return TRUE;
}
-bool32 sub_801FD30(u8 *state)
+static bool32 Display_PrintSavedTheGame(u8 *state)
{
switch (*state)
{
case 0:
DynamicPlaceholderTextUtil_Reset();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gSaveBlock2Ptr->playerName);
- sub_801FF18(9, 0);
- CopyWindowToVram(gUnknown_02022C88->unk1E, 3);
+ AddStdMessageWindow(STDMESSAGE_SAVED_THE_GAME, 0);
+ CopyWindowToVram(sDisplay->messageWindowId, 3);
(*state)++;
break;
case 1:
@@ -2392,14 +2691,14 @@ bool32 sub_801FD30(u8 *state)
return TRUE;
}
-bool32 sub_801FD88(u8 *state)
+static bool32 Display_AskConfirmLeaderLeave(u8 *state)
{
switch (*state)
{
case 0:
- sub_801FF18(10, 0);
- sub_801FDDC(23, 10, 1);
- CopyWindowToVram(gUnknown_02022C88->unk1E, 3);
+ AddStdMessageWindow(STDMESSAGE_WARN_LEADER_LEAVE, 0);
+ AddYesNoMenuAt(23, 10, 1);
+ CopyWindowToVram(sDisplay->messageWindowId, 3);
(*state)++;
break;
case 1:
@@ -2409,12 +2708,12 @@ bool32 sub_801FD88(u8 *state)
return TRUE;
}
-static bool32 sub_801FDD8(u8 *arg0)
+static bool32 Display_Dummy(u8 *state)
{
return FALSE;
}
-static void sub_801FDDC(u8 left, u8 top, u8 initialCursorPos)
+static void AddYesNoMenuAt(u8 left, u8 top, u8 initialCursorPos)
{
struct WindowTemplate template;
template.bg = 0;
@@ -2424,42 +2723,42 @@ static void sub_801FDDC(u8 left, u8 top, u8 initialCursorPos)
template.height = 4;
template.paletteNum = 14;
template.baseBlock = 0x52;
- gUnknown_02022C88->unk18 = AddWindow(&template);
- if (gUnknown_02022C88->unk18 != 0xFF)
+ sDisplay->yesNoMenuWindowId = AddWindow(&template);
+ if (sDisplay->yesNoMenuWindowId != 0xFF)
{
- FillWindowPixelBuffer(gUnknown_02022C88->unk18, PIXEL_FILL(1));
- PutWindowTilemap(gUnknown_02022C88->unk18);
- AddTextPrinterParameterized(gUnknown_02022C88->unk18, 1, gText_Yes, 8, 1, TEXT_SPEED_FF, NULL);
- AddTextPrinterParameterized(gUnknown_02022C88->unk18, 1, gText_No, 8, 17, TEXT_SPEED_FF, NULL);
- DrawTextBorderOuter(gUnknown_02022C88->unk18, 1, 13);
- InitMenuInUpperLeftCornerPlaySoundWhenAPressed(gUnknown_02022C88->unk18, 2, initialCursorPos);
+ FillWindowPixelBuffer(sDisplay->yesNoMenuWindowId, PIXEL_FILL(1));
+ PutWindowTilemap(sDisplay->yesNoMenuWindowId);
+ AddTextPrinterParameterized(sDisplay->yesNoMenuWindowId, 1, gText_Yes, 8, 1, TEXT_SPEED_FF, NULL);
+ AddTextPrinterParameterized(sDisplay->yesNoMenuWindowId, 1, gText_No, 8, 17, TEXT_SPEED_FF, NULL);
+ DrawTextBorderOuter(sDisplay->yesNoMenuWindowId, 1, 13);
+ InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sDisplay->yesNoMenuWindowId, 2, initialCursorPos);
}
}
-static void sub_801FEBC(void)
+static void HideYesNoMenuWindow(void)
{
- if (gUnknown_02022C88->unk18 != 0xFF)
+ if (sDisplay->yesNoMenuWindowId != 0xFF)
{
- ClearStdWindowAndFrameToTransparent(gUnknown_02022C88->unk18, FALSE);
- ClearWindowTilemap(gUnknown_02022C88->unk18);
+ ClearStdWindowAndFrameToTransparent(sDisplay->yesNoMenuWindowId, FALSE);
+ ClearWindowTilemap(sDisplay->yesNoMenuWindowId);
}
}
-static void sub_801FEE4(void)
+static void DestroyYesNoMenuWindow(void)
{
- if (gUnknown_02022C88->unk18 != 0xFF)
+ if (sDisplay->yesNoMenuWindowId != 0xFF)
{
- RemoveWindow(gUnknown_02022C88->unk18);
- gUnknown_02022C88->unk18 = 0xFF;
+ RemoveWindow(sDisplay->yesNoMenuWindowId);
+ sDisplay->yesNoMenuWindowId = 0xFF;
}
}
-static s8 sub_801FF08(void)
+static s8 ProcessMenuInput(void)
{
return Menu_ProcessInput();
}
-static void sub_801FF18(int arg0, u16 arg1)
+static void AddStdMessageWindow(int msgId, u16 bg0vofs)
{
const u8 *str;
int windowId;
@@ -2471,43 +2770,43 @@ static void sub_801FF18(int arg0, u16 arg1)
template.height = 4;
template.paletteNum = 14;
template.baseBlock = 0x6A;
- if (gUnknown_082F2D40[arg0].unkA)
+ if (sDisplayStdMessages[msgId].useWiderBox)
{
template.tilemapLeft -= 7;
template.width += 7;
}
- gUnknown_02022C88->unk1E = AddWindow(&template);
- windowId = gUnknown_02022C88->unk1E;
- if (gUnknown_02022C88->unk1E == 0xFF)
+ sDisplay->messageWindowId = AddWindow(&template);
+ windowId = sDisplay->messageWindowId;
+ if (sDisplay->messageWindowId == 0xFF)
return;
- if (gUnknown_082F2D40[arg0].unk9)
+ if (sDisplayStdMessages[msgId].hasPlaceholders)
{
- DynamicPlaceholderTextUtil_ExpandPlaceholders(gUnknown_02022C88->unk22, gUnknown_082F2D40[arg0].unk0);
- str = gUnknown_02022C88->unk22;
+ DynamicPlaceholderTextUtil_ExpandPlaceholders(sDisplay->expandedPlaceholdersBuffer, sDisplayStdMessages[msgId].text);
+ str = sDisplay->expandedPlaceholdersBuffer;
}
else
{
- str = gUnknown_082F2D40[arg0].unk0;
+ str = sDisplayStdMessages[msgId].text;
}
- ChangeBgY(0, arg1 * 256, 0);
+ ChangeBgY(0, bg0vofs * 256, 0);
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
PutWindowTilemap(windowId);
- if (gUnknown_082F2D40[arg0].unk4 == 1)
+ if (sDisplayStdMessages[msgId].boxType == 1)
{
DrawTextBorderInner(windowId, 0xA, 2);
AddTextPrinterParameterized5(
windowId,
1,
str,
- gUnknown_082F2D40[arg0].unk5 + 8,
- gUnknown_082F2D40[arg0].unk6 + 8,
+ sDisplayStdMessages[msgId].x + 8,
+ sDisplayStdMessages[msgId].y + 8,
TEXT_SPEED_FF,
NULL,
- gUnknown_082F2D40[arg0].unk7,
- gUnknown_082F2D40[arg0].unk8);
+ sDisplayStdMessages[msgId].letterSpacing,
+ sDisplayStdMessages[msgId].lineSpacing);
}
else
{
@@ -2516,105 +2815,103 @@ static void sub_801FF18(int arg0, u16 arg1)
windowId,
1,
str,
- gUnknown_082F2D40[arg0].unk5,
- gUnknown_082F2D40[arg0].unk6,
+ sDisplayStdMessages[msgId].x,
+ sDisplayStdMessages[msgId].y,
TEXT_SPEED_FF,
NULL,
- gUnknown_082F2D40[arg0].unk7,
- gUnknown_082F2D40[arg0].unk8);
+ sDisplayStdMessages[msgId].letterSpacing,
+ sDisplayStdMessages[msgId].lineSpacing);
}
- gUnknown_02022C88->unk1E = windowId;
+ sDisplay->messageWindowId = windowId;
}
-static void sub_8020094(void)
+static void HideStdMessageWindow(void)
{
- if (gUnknown_02022C88->unk1E != 0xFF)
+ if (sDisplay->messageWindowId != 0xFF)
{
- ClearStdWindowAndFrameToTransparent(gUnknown_02022C88->unk1E, FALSE);
- ClearWindowTilemap(gUnknown_02022C88->unk1E);
+ ClearStdWindowAndFrameToTransparent(sDisplay->messageWindowId, FALSE);
+ ClearWindowTilemap(sDisplay->messageWindowId);
}
ChangeBgY(0, 0, 0);
}
-static void sub_80200C8(void)
+static void DestroyStdMessageWindow(void)
{
- if (gUnknown_02022C88->unk1E != 0xFF)
+ if (sDisplay->messageWindowId != 0xFF)
{
- RemoveWindow(gUnknown_02022C88->unk1E);
- gUnknown_02022C88->unk1E = 0xFF;
+ RemoveWindow(sDisplay->messageWindowId);
+ sDisplay->messageWindowId = 0xFF;
}
}
-static void sub_80200EC(u16 x, u16 width, u8 fillValue)
+static void FillTextEntryWindow(u16 x, u16 width, u8 fillValue)
{
FillWindowPixelRect(1, fillValue, x * 8, 1, width * 8, 14);
}
-static void sub_8020118(u16 x, u8 *str, u8 fillValue, u8 arg3, u8 arg4)
+static void DrawTextEntryMessage(u16 x, u8 *str, u8 bgColor, u8 fgColor, u8 shadowColor)
{
- u8 *str2;
- u8 sp[38];
- if (fillValue)
- sub_80200EC(x, sub_801F198() - x, fillValue);
+ u8 color[3];
+ u8 strBuffer[35];
+ if (bgColor != TEXT_COLOR_TRANSPARENT)
+ FillTextEntryWindow(x, GetTextEntryCursorPosition() - x, bgColor);
- sp[0] = fillValue;
- sp[1] = arg3;
- sp[2] = arg4;
- str2 = &sp[4];
- str2[0] = EXT_CTRL_CODE_BEGIN;
- str2[1] = EXT_CTRL_CODE_MIN_LETTER_SPACING;
- str2[2] = 8;
- StringCopy(&str2[3], str);
- AddTextPrinterParameterized3(1, 2, x * 8, 1, sp, TEXT_SPEED_FF, str2);
+ color[0] = bgColor;
+ color[1] = fgColor;
+ color[2] = shadowColor;
+ strBuffer[0] = EXT_CTRL_CODE_BEGIN;
+ strBuffer[1] = EXT_CTRL_CODE_MIN_LETTER_SPACING;
+ strBuffer[2] = 8;
+ StringCopy(&strBuffer[3], str);
+ AddTextPrinterParameterized3(1, 2, x * 8, 1, color, TEXT_SPEED_FF, strBuffer);
}
-static void sub_80201A4(void)
+static void PrintCurrentKeyboardPage(void)
{
u8 page;
int i;
- int var1;
u16 left;
u16 top;
- u8 sp[52];
- u8 *str;
+ u8 color[3];
+ u8 str[45];
u8 *str2;
FillWindowPixelBuffer(2, PIXEL_FILL(15));
page = GetCurrentKeyboardPage();
- sp[0] = TEXT_COLOR_TRANSPARENT;
- sp[1] = TEXT_DYNAMIC_COLOR_5;
- sp[2] = TEXT_DYNAMIC_COLOR_4;
- if (page != UNION_ROOM_KB_PAGE_COUNT)
+ color[0] = TEXT_COLOR_TRANSPARENT;
+ color[1] = TEXT_DYNAMIC_COLOR_5;
+ color[2] = TEXT_DYNAMIC_COLOR_4;
+ if (page != UNION_ROOM_KB_PAGE_REGISTER)
{
- str = &sp[4];
str[0] = EXT_CTRL_CODE_BEGIN;
str[1] = EXT_CTRL_CODE_MIN_LETTER_SPACING;
- var1 = 8;
- str[2] = var1;
- left = var1;
+ str[2] = 8;
+
if (page == UNION_ROOM_KB_PAGE_EMOJI)
left = 6;
+ else
+ left = 8;
for (i = 0, top = 0; i < UNION_ROOM_KB_ROW_COUNT; i++, top += 12)
{
if (!sUnionRoomKeyboardText[page][i])
return;
- StringCopy(&sp[7], sUnionRoomKeyboardText[page][i]);
- AddTextPrinterParameterized3(2, 0, left, top, sp, TEXT_SPEED_FF, &sp[4]);
+ StringCopy(&str[3], sUnionRoomKeyboardText[page][i]);
+ AddTextPrinterParameterized3(2, 0, left, top, color, TEXT_SPEED_FF, str);
}
}
else
{
left = 4;
- for (i = 0, top = 0; i < 10; i++, top += 12)
+ for (i = 0, top = 0; i < UNION_ROOM_KB_ROW_COUNT; i++, top += 12)
{
- str2 = sub_801EE6C(i);
+ str2 = GetRegisteredTextByRow(i);
if (GetStringWidth(0, str2, 0) <= 40)
{
- AddTextPrinterParameterized3(2, 0, left, top, sp, TEXT_SPEED_FF, str2);
+ AddTextPrinterParameterized3(2, 0, left, top, color, TEXT_SPEED_FF, str2);
}
else
{
@@ -2622,11 +2919,11 @@ static void sub_80201A4(void)
do
{
length--;
- StringCopyN_Multibyte(&sp[4], str2, length);
- } while (GetStringWidth(0, &sp[4], 0) > 35);
+ StringCopyN_Multibyte(str, str2, length);
+ } while (GetStringWidth(0, str, 0) > 35);
- AddTextPrinterParameterized3(2, 0, left, top, sp, TEXT_SPEED_FF, &sp[4]);
- AddTextPrinterParameterized3(2, 0, left + 35, top, sp, TEXT_SPEED_FF, gText_Ellipsis);
+ AddTextPrinterParameterized3(2, 0, left, top, color, TEXT_SPEED_FF, str);
+ AddTextPrinterParameterized3(2, 0, left + 35, top, color, TEXT_SPEED_FF, sText_Ellipsis);
}
}
}
@@ -2634,68 +2931,69 @@ static void sub_80201A4(void)
static bool32 sub_8020320(void)
{
- if (gUnknown_02022C88->unk20 < 56)
+ if (sDisplay->bg1hofs < 56)
{
- gUnknown_02022C88->unk20 += 12;
- if (gUnknown_02022C88->unk20 >= 56)
- gUnknown_02022C88->unk20 = 56;
+ sDisplay->bg1hofs += 12;
+ if (sDisplay->bg1hofs >= 56)
+ sDisplay->bg1hofs = 56;
- if (gUnknown_02022C88->unk20 < 56)
+ if (sDisplay->bg1hofs < 56)
{
- sub_80207C0(gUnknown_02022C88->unk20);
+ sub_80207C0(sDisplay->bg1hofs);
return TRUE;
}
}
- sub_8020818(gUnknown_02022C88->unk20);
+ sub_8020818(sDisplay->bg1hofs);
return FALSE;
}
static bool32 sub_8020368(void)
{
- if (gUnknown_02022C88->unk20 > 0)
+ if (sDisplay->bg1hofs > 0)
{
- gUnknown_02022C88->unk20 -= 12;
- if (gUnknown_02022C88->unk20 <= 0)
- gUnknown_02022C88->unk20 = 0;
+ sDisplay->bg1hofs -= 12;
+ if (sDisplay->bg1hofs <= 0)
+ sDisplay->bg1hofs = 0;
- if (gUnknown_02022C88->unk20 > 0)
+ if (sDisplay->bg1hofs > 0)
{
- sub_80207C0(gUnknown_02022C88->unk20);
+ sub_80207C0(sDisplay->bg1hofs);
return TRUE;
}
}
- sub_8020818(gUnknown_02022C88->unk20);
+ sub_8020818(sDisplay->bg1hofs);
return FALSE;
}
-static void sub_80203B0(void)
+static void ShowKeyboardSwapMenu(void)
{
FillWindowPixelBuffer(3, PIXEL_FILL(1));
DrawTextBorderOuter(3, 1, 13);
- PrintTextArray(3, 2, 8, 1, 14, 5, gUnknown_082F2DC8);
+ PrintTextArray(3, 2, 8, 1, 14, 5, sKeyboardPageTitleTexts);
sub_81983AC(3, 2, 0, 1, 14, 5, GetCurrentKeyboardPage());
PutWindowTilemap(3);
}
-static void sub_802040C(void)
+static void HideKeyboardSwapMenu(void)
{
ClearStdWindowAndFrameToTransparent(3, FALSE);
ClearWindowTilemap(3);
}
-static void sub_8020420(u16 row, u8 *str, u8 arg2)
+static void PrintChatMessage(u16 row, u8 *str, u8 colorIdx)
{
+ // colorIdx: 0 = grey, 1 = red, 2 = green, 3 = blue
u8 color[3];
color[0] = TEXT_COLOR_WHITE;
- color[1] = arg2 * 2 + 2;
- color[2] = arg2 * 2 + 3;
+ color[1] = colorIdx * 2 + 2;
+ color[2] = colorIdx * 2 + 3;
FillWindowPixelRect(0, PIXEL_FILL(1), 0, row * 15, 168, 15);
AddTextPrinterParameterized3(0, 2, 0, row * 15 + 1, color, TEXT_SPEED_FF, str);
}
-static void sub_8020480(void)
+static void ResetGpuBgState(void)
{
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
@@ -2720,83 +3018,83 @@ static void sub_8020480(void)
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR);
}
-static void sub_8020538(void)
+static void SetBgTilemapBuffers(void)
{
- SetBgTilemapBuffer(0, gUnknown_02022C88->unk128);
- SetBgTilemapBuffer(1, gUnknown_02022C88->unk928);
- SetBgTilemapBuffer(3, gUnknown_02022C88->unk1128);
- SetBgTilemapBuffer(2, gUnknown_02022C88->unk1928);
+ SetBgTilemapBuffer(0, sDisplay->bg0Buffer);
+ SetBgTilemapBuffer(1, sDisplay->bg1Buffer);
+ SetBgTilemapBuffer(3, sDisplay->bg3Buffer);
+ SetBgTilemapBuffer(2, sDisplay->bg2Buffer);
}
-static void sub_8020584(void)
+static void ClearBg0(void)
{
RequestDma3Fill(0, (void *)BG_CHAR_ADDR(0), 0x20, 1);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32);
CopyBgTilemapBufferToVram(0);
}
-static void sub_80205B4(void)
+static void LoadChatWindowBorderGfx(void)
{
- LoadPalette(gUnknown_08DD4BD0, 0x70, 0x20);
- LoadPalette(gUnknown_08DD4BB0, 0xC0, 0x20);
- DecompressAndCopyTileDataToVram(1, gUnknown_08DD4BF0, 0, 0, 0);
- CopyToBgTilemapBuffer(1, gUnknown_08DD4C4C, 0, 0);
+ LoadPalette(gUnionRoomChat_Window_Pal2, 0x70, 0x20);
+ LoadPalette(gUnionRoomChat_Window_Pal1, 0xC0, 0x20);
+ DecompressAndCopyTileDataToVram(1, gUnionRoomChat_Border_Gfx, 0, 0, 0);
+ CopyToBgTilemapBuffer(1, gUnionRoomChat_Border_Tilemap, 0, 0);
CopyBgTilemapBufferToVram(1);
}
-static void sub_8020604(void)
+static void LoadChatWindowGfx(void)
{
u8 *ptr;
- LoadPalette(gLinkMiscMenu_Pal, 0, 0x20);
- ptr = DecompressAndCopyTileDataToVram(2, gLinkMiscMenu_Gfx, 0, 0, 0);
+ LoadPalette(gUnionRoomChat_Background_Pal, 0, 0x20);
+ ptr = DecompressAndCopyTileDataToVram(2, gUnionRoomChat_Background_Gfx, 0, 0, 0);
if (ptr)
{
- CpuFastCopy(&ptr[0x220], gUnknown_02022C88->unk2128, 0x20);
- CpuFastCopy(&ptr[0x420], gUnknown_02022C88->unk2148, 0x20);
+ CpuFastCopy(&ptr[0x220], sDisplay->unk2128, 0x20);
+ CpuFastCopy(&ptr[0x420], sDisplay->unk2148, 0x20);
}
- CopyToBgTilemapBuffer(2, gLinkMiscMenu_Tilemap, 0, 0);
+ CopyToBgTilemapBuffer(2, gUnionRoomChat_Background_Tilemap, 0, 0);
CopyBgTilemapBufferToVram(2);
}
static void sub_8020680(void)
{
- LoadPalette(gUnknown_082F2C20, 0x80, 0x20);
+ LoadPalette(sUnk_Palette1, 0x80, 0x20);
RequestDma3Fill(0, (void *)BG_CHAR_ADDR(1) + 0x20, 0x20, 1);
}
-static void sub_80206A4(void)
+static void LoadChatMessagesWindow(void)
{
- LoadPalette(gUnknown_082F2C40, 0xF0, 0x20);
+ LoadPalette(sUnk_Palette2, 0xF0, 0x20);
PutWindowTilemap(0);
FillWindowPixelBuffer(0, PIXEL_FILL(1));
CopyWindowToVram(0, 3);
}
-static void sub_80206D0(void)
+static void LoadKeyboardWindow(void)
{
PutWindowTilemap(2);
- sub_80201A4();
+ PrintCurrentKeyboardPage();
CopyWindowToVram(2, 3);
}
-static void sub_80206E8(void)
+static void LoadTextEntryWindow(void)
{
int i;
- u8 var0[2];
- var0[0] = 0;
- var0[1] = 0xFF;
+ u8 unused[2];
+ unused[0] = 0;
+ unused[1] = 0xFF;
- for (i = 0; i < 15; i++)
- BlitBitmapToWindow(1, gUnknown_02022C88->unk2128, i * 8, 0, 8, 16);
+ for (i = 0; i < MAX_MESSAGE_LENGTH; i++)
+ BlitBitmapToWindow(1, sDisplay->unk2128, i * 8, 0, 8, 16);
FillWindowPixelBuffer(1, PIXEL_FILL(0));
PutWindowTilemap(1);
CopyWindowToVram(1, 3);
}
-static void sub_8020740(void)
+static void LoadKeyboardSwapWindow(void)
{
FillWindowPixelBuffer(3, PIXEL_FILL(1));
LoadUserWindowBorderGfx(3, 1, 0xD0);
@@ -2804,110 +3102,110 @@ static void sub_8020740(void)
LoadPalette(gUnknown_0860F074, 0xE0, 0x20);
}
-static void sub_8020770(void)
+static void InitScanlineEffect(void)
{
struct ScanlineEffectParams params;
params.dmaControl = SCANLINE_EFFECT_DMACNT_16BIT;
params.dmaDest = &REG_BG1HOFS;
params.initState = 1;
params.unused9 = 0;
- gUnknown_02022C88->unk20 = 0;
+ sDisplay->bg1hofs = 0;
CpuFastFill(0, gScanlineEffectRegBuffers, sizeof(gScanlineEffectRegBuffers));
ScanlineEffect_SetParams(params);
}
-static void sub_80207C0(s16 arg0)
+static void sub_80207C0(s16 bg1hofs)
{
- CpuFill16(arg0, gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer], 0x120);
- CpuFill16(0, gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer] + 0x90, 0x20);
+ CpuFill16(bg1hofs, gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer], 0x120);
+ CpuFill16(0, gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer] + 0x90, 0x20);
}
-static void sub_8020818(s16 arg0)
+static void sub_8020818(s16 bg1hofs)
{
- CpuFill16(arg0, gScanlineEffectRegBuffers[0], 0x120);
- CpuFill16(0, gScanlineEffectRegBuffers[0] + 0x90, 0x20);
- CpuFill16(arg0, gScanlineEffectRegBuffers[0] + 0x3C0, 0x120);
- CpuFill16(0, gScanlineEffectRegBuffers[0] + 0x450, 0x20);
+ CpuFill16(bg1hofs, gScanlineEffectRegBuffers[0], 0x120);
+ CpuFill16(0, gScanlineEffectRegBuffers[0] + 0x90, 0x20);
+ CpuFill16(bg1hofs, gScanlineEffectRegBuffers[0] + 0x3C0, 0x120);
+ CpuFill16(0, gScanlineEffectRegBuffers[0] + 0x450, 0x20);
}
-static bool32 sub_8020890(void)
+static bool32 TryAllocSprites(void)
{
u32 i;
- for (i = 0; i < 5; i++)
- LoadCompressedSpriteSheet(&gUnknown_082F3134[i]);
+ for (i = 0; i < ARRAY_COUNT(sSpriteSheets); i++)
+ LoadCompressedSpriteSheet(&sSpriteSheets[i]);
- LoadSpritePalette(&gUnknown_082F315C);
- gUnknown_02022C8C = Alloc(0x18);
- if (!gUnknown_02022C8C)
+ LoadSpritePalette(&sSpritePalette);
+ sSprites = Alloc(sizeof(struct UnionRoomChatSprites));
+ if (!sSprites)
return FALSE;
return TRUE;
}
-static void sub_80208D0(void)
+static void FreeSprites(void)
{
- if (gUnknown_02022C8C)
- Free(gUnknown_02022C8C);
+ if (sSprites)
+ Free(sSprites);
}
-static void sub_80208E8(void)
+static void CreateKeyboardCursorSprite(void)
{
- u8 spriteId = CreateSprite(&gUnknown_082F319C, 10, 24, 0);
- gUnknown_02022C8C->unk0 = &gSprites[spriteId];
+ u8 spriteId = CreateSprite(&sSpriteTemplate_KeyboardCursor, 10, 24, 0);
+ sSprites->keyboardCursor = &gSprites[spriteId];
}
-static void sub_802091C(bool32 invisible)
+static void SetKeyboardCursorInvisibility(bool32 invisible)
{
- gUnknown_02022C8C->unk0->invisible = invisible;
+ sSprites->keyboardCursor->invisible = invisible;
}
-static void sub_802093C(void)
+static void MoveKeyboardCursor(void)
{
u8 x, y;
u8 page = GetCurrentKeyboardPage();
- sub_801F0BC(&x, &y);
- if (page != UNION_ROOM_KB_PAGE_COUNT)
+ GetCurrentKeyboardColAndRow(&x, &y);
+ if (page != UNION_ROOM_KB_PAGE_REGISTER)
{
- StartSpriteAnim(gUnknown_02022C8C->unk0, 0);
- gUnknown_02022C8C->unk0->pos1.x = x * 8 + 10;
- gUnknown_02022C8C->unk0->pos1.y = y * 12 + 24;
+ StartSpriteAnim(sSprites->keyboardCursor, 0);
+ sSprites->keyboardCursor->pos1.x = x * 8 + 10;
+ sSprites->keyboardCursor->pos1.y = y * 12 + 24;
}
else
{
- StartSpriteAnim(gUnknown_02022C8C->unk0, 2);
- gUnknown_02022C8C->unk0->pos1.x = 24;
- gUnknown_02022C8C->unk0->pos1.y = y * 12 + 24;
+ StartSpriteAnim(sSprites->keyboardCursor, 2);
+ sSprites->keyboardCursor->pos1.x = 24;
+ sSprites->keyboardCursor->pos1.y = y * 12 + 24;
}
}
-static void sub_80209AC(int arg0)
+static void SetRegisteredTextPalette(bool32 registering)
{
- const u16 *palette = &gUnknown_082F2DF0[arg0 * 2 + 1];
+ const u16 *palette = &sUnionRoomChatInterfacePal[registering * 2 + 1];
u8 index = IndexOfSpritePaletteTag(0);
LoadPalette(palette, index * 16 + 0x101, 4);
}
-static void sub_80209E0(void)
+static void StartKeyboardCursorAnim(void)
{
- if (GetCurrentKeyboardPage() != UNION_ROOM_KB_PAGE_COUNT)
- StartSpriteAnim(gUnknown_02022C8C->unk0, 1);
+ if (GetCurrentKeyboardPage() != UNION_ROOM_KB_PAGE_REGISTER)
+ StartSpriteAnim(sSprites->keyboardCursor, 1);
else
- StartSpriteAnim(gUnknown_02022C8C->unk0, 3);
+ StartSpriteAnim(sSprites->keyboardCursor, 3);
- gUnknown_02022C8C->unk14 = 0;
+ sSprites->cursorBlinkTimer = 0;
}
-static bool32 sub_8020A1C(void)
+static bool32 TryKeyboardCursorReopen(void)
{
- if (gUnknown_02022C8C->unk14 > 3)
+ if (sSprites->cursorBlinkTimer > 3)
return FALSE;
- if (++gUnknown_02022C8C->unk14 > 3)
+ if (++sSprites->cursorBlinkTimer > 3)
{
- if (GetCurrentKeyboardPage() != UNION_ROOM_KB_PAGE_COUNT)
- StartSpriteAnim(gUnknown_02022C8C->unk0, 0);
+ if (GetCurrentKeyboardPage() != UNION_ROOM_KB_PAGE_REGISTER)
+ StartSpriteAnim(sSprites->keyboardCursor, 0);
else
- StartSpriteAnim(gUnknown_02022C8C->unk0, 2);
+ StartSpriteAnim(sSprites->keyboardCursor, 2);
return FALSE;
}
@@ -2915,29 +3213,29 @@ static bool32 sub_8020A1C(void)
return TRUE;
}
-static void sub_8020A68(void)
+static void CreateTextEntrySprites(void)
{
- u8 spriteId = CreateSprite(&gUnknown_082F31BC, 76, 152, 2);
- gUnknown_02022C8C->unk8 = &gSprites[spriteId];
- spriteId = CreateSprite(&gUnknown_082F31D4, 64, 152, 1);
- gUnknown_02022C8C->unk4 = &gSprites[spriteId];
+ u8 spriteId = CreateSprite(&sSpriteTemplate_TextEntryCursor, 76, 152, 2);
+ sSprites->textEntryCursor = &gSprites[spriteId];
+ spriteId = CreateSprite(&sSpriteTemplate_TextEntryArrow, 64, 152, 1);
+ sSprites->textEntryArrow = &gSprites[spriteId];
}
-static void sub_8020ABC(struct Sprite *sprite)
+static void SpriteCB_TextEntryCursor(struct Sprite *sprite)
{
- int var0 = sub_801F198();
- if (var0 == 15)
+ int pos = GetTextEntryCursorPosition();
+ if (pos == MAX_MESSAGE_LENGTH)
{
- sprite->invisible = 1;
+ sprite->invisible = TRUE;
}
else
{
- sprite->invisible = 0;
- sprite->pos1.x = var0 * 8 + 76;
+ sprite->invisible = FALSE;
+ sprite->pos1.x = pos * 8 + 76;
}
}
-static void sub_8020AF4(struct Sprite *sprite)
+static void SpriteCB_TextEntryArrow(struct Sprite *sprite)
{
if (++sprite->data[0] > 4)
{
@@ -2947,40 +3245,42 @@ static void sub_8020AF4(struct Sprite *sprite)
}
}
-static void sub_8020B20(void)
+static void CreateRButtonSprites(void)
{
- u8 spriteId = CreateSprite(&gUnknown_082F322C, 8, 152, 3);
- gUnknown_02022C8C->unkC = &gSprites[spriteId];
- spriteId = CreateSprite(&gUnknown_082F3244, 32, 152, 4);
- gUnknown_02022C8C->unk10 = &gSprites[spriteId];
- gUnknown_02022C8C->unk10->invisible = 1;
+ u8 spriteId = CreateSprite(&sSpriteTemplate_RButtonIcon, 8, 152, 3);
+ sSprites->rButtonIcon = &gSprites[spriteId];
+ spriteId = CreateSprite(&sSpriteTemplate_RButtonLabels, 32, 152, 4);
+ sSprites->rButtonLabel = &gSprites[spriteId];
+ sSprites->rButtonLabel->invisible = TRUE;
}
-static void sub_8020B80(void)
+static void UpdateRButtonLabel(void)
{
- if (GetCurrentKeyboardPage() == UNION_ROOM_KB_PAGE_COUNT)
+ if (GetCurrentKeyboardPage() == UNION_ROOM_KB_PAGE_REGISTER)
{
- if (sub_801F0DC() != 0)
+ if (GetLengthOfMessageEntry() != 0)
{
- gUnknown_02022C8C->unk10->invisible = 0;
- StartSpriteAnim(gUnknown_02022C8C->unk10, 3);
+ // REGISTER
+ sSprites->rButtonLabel->invisible = FALSE;
+ StartSpriteAnim(sSprites->rButtonLabel, 3);
}
else
{
- gUnknown_02022C8C->unk10->invisible = 1;
+ sSprites->rButtonLabel->invisible = TRUE;
}
}
else
{
- int anim = sub_801F1A4();
+ int anim = GetShouldShowCaseToggleIcon();
if (anim == 3)
{
- gUnknown_02022C8C->unk10->invisible = 1;
+ sSprites->rButtonLabel->invisible = TRUE;
}
else
{
- gUnknown_02022C8C->unk10->invisible = 0;
- StartSpriteAnim(gUnknown_02022C8C->unk10, anim);
+ // A <--> a (toggle case)
+ sSprites->rButtonLabel->invisible = FALSE;
+ StartSpriteAnim(sSprites->rButtonLabel, anim);
}
}
diff --git a/src/union_room_player_avatar.c b/src/union_room_player_avatar.c
index 8a09306c0..c012fd84d 100644
--- a/src/union_room_player_avatar.c
+++ b/src/union_room_player_avatar.c
@@ -8,100 +8,125 @@
#include "union_room.h"
#include "constants/event_objects.h"
#include "constants/event_object_movement.h"
-#include "constants/flags.h"
-EWRAM_DATA struct UnkStruct_8019BA8 * gUnknown_02022C64 = NULL;
-EWRAM_DATA u32 gUnknown_02022C68 = 0;
-
-static u8 sub_8019DF4(void);
-static u32 sub_8019F8C(u32 playerIdx, u32 arg1);
-static void sub_801A3B0(s32 arg0, s32 arg1, u8 arg2);
-
-ALIGNED(4) const u8 gUnknown_082F072C[][10] = {
- {0x21, 0x2c, 0x1f, 0x23, 0x25, 0x24, 0x41, 0x42},
- {0x22, 0x28, 0x20, 0x2f, 0x2f, 0x0e, 0x14, 0x2d}
+#define UR_SPRITE_START_ID (MAX_SPRITES - MAX_UNION_ROOM_PLAYERS)
+#define UR_PLAYER_SPRITE_ID(playerIdx, facingDir)(5 * playerIdx + facingDir)
+
+static EWRAM_DATA struct UnionRoomObject * sUnionObjWork = NULL;
+static EWRAM_DATA u32 sUnionObjRefreshTimer = 0;
+
+static u8 CreateTask_AnimateUnionRoomPlayers(void);
+static u32 IsUnionRoomPlayerInvisible(u32, u32);
+static void SetUnionRoomObjectFacingDirection(s32, s32, u8);
+
+static const u8 sUnionRoomObjGfxIds[GENDER_COUNT][MAX_UNION_ROOM_PLAYERS + 2] = {
+ [MALE] = {
+ OBJ_EVENT_GFX_MAN_3,
+ OBJ_EVENT_GFX_BLACK_BELT,
+ OBJ_EVENT_GFX_CAMPER,
+ OBJ_EVENT_GFX_YOUNGSTER,
+ OBJ_EVENT_GFX_PSYCHIC_M,
+ OBJ_EVENT_GFX_BUG_CATCHER,
+ OBJ_EVENT_GFX_MAN_4,
+ OBJ_EVENT_GFX_MAN_5
+ },
+ [FEMALE] = {
+ OBJ_EVENT_GFX_WOMAN_5,
+ OBJ_EVENT_GFX_HEX_MANIAC,
+ OBJ_EVENT_GFX_PICNICKER,
+ OBJ_EVENT_GFX_LASS,
+ OBJ_EVENT_GFX_LASS,
+ OBJ_EVENT_GFX_GIRL_3,
+ OBJ_EVENT_GFX_WOMAN_2,
+ OBJ_EVENT_GFX_BEAUTY
+ }
};
-static const s16 gUnknown_082F0740[][2] = {
- {0x4, 0x6},
- {0xd, 0x8},
- {0xa, 0x6},
- {0x1, 0x8},
- {0xd, 0x4},
- {0x7, 0x4},
- {0x1, 0x4},
- {0x7, 0x8}
+static const s16 sUnionRoomPlayerCoords[MAX_UNION_ROOM_PLAYERS][2] = {
+ { 4, 6},
+ {13, 8},
+ {10, 6},
+ { 1, 8},
+ {13, 4},
+ { 7, 4},
+ { 1, 4},
+ { 7, 8}
};
-static const s8 gUnknown_082F0760[][2] = {
- { 0, 0},
- { 1, 0},
- { 0, -1},
- {-1, 0},
- { 0, 1}
+static const s8 sFacingDirectionOffsets[][2] = {
+ [DIR_NONE] = { 0, 0},
+ [DIR_SOUTH] = { 1, 0},
+ [DIR_NORTH] = { 0, -1},
+ [DIR_WEST] = {-1, 0},
+ [DIR_EAST] = { 0, 1}
};
-static const u8 gUnknown_082F076A[] = {
- 0x00, 0x02, 0x01, 0x04, 0x03
+static const u8 sOppositeFacingDirection[] = {
+ [DIR_NONE] = DIR_NONE,
+ [DIR_SOUTH] = DIR_NORTH,
+ [DIR_NORTH] = DIR_SOUTH,
+ [DIR_WEST] = DIR_EAST,
+ [DIR_EAST] = DIR_WEST
};
-static const u8 gUnknown_082F076F[] = {
- 0x01, 0x03, 0x01, 0x04, 0x02
+static const u8 sNextFacingDirection[] = {
+ [DIR_NONE] = DIR_SOUTH,
+ [DIR_SOUTH] = DIR_WEST,
+ [DIR_NORTH] = DIR_SOUTH,
+ [DIR_WEST] = DIR_EAST,
+ [DIR_EAST] = DIR_NORTH
};
-static const u8 gUnknown_082F0774[] = {
- 0x09, 0x08, 0x07, 0x02, 0x06, 0x05, 0x04, 0x03,
- 0xbf, 0x02, 0xc0, 0x02, 0xc1, 0x02, 0xc2, 0x02,
- 0xc3, 0x02, 0xc4, 0x02, 0xc5, 0x02, 0xc6, 0x02
+// Local id 1 is the Nurse/Attendant, 2-9 are link players
+static const u8 sUnionRoomLocalIds[] = { 9, 8, 7, 2, 6, 5, 4, 3 };
+
+static const u16 sUnknown[] = {
+ 0x2BF,
+ 0x2C0,
+ 0x2C1,
+ 0x2C2,
+ 0x2C3,
+ 0x2C4,
+ 0x2C5,
+ 0x2C6
};
-static const u8 gUnknown_082F078C[2] = {
+static const u8 sMovement_UnionPlayerExit[2] = {
MOVEMENT_ACTION_FLY_UP,
MOVEMENT_ACTION_STEP_END
};
-static const u8 gUnknown_082F078E[2] = {
+static const u8 sMovement_UnionPlayerEnter[2] = {
MOVEMENT_ACTION_FLY_DOWN,
MOVEMENT_ACTION_STEP_END
};
-static bool32 is_walking_or_running(void)
+static bool32 IsPlayerStandingStill(void)
{
- if (gPlayerAvatar.tileTransitionState == 2 || gPlayerAvatar.tileTransitionState == 0)
- {
+ if (gPlayerAvatar.tileTransitionState == T_TILE_CENTER || gPlayerAvatar.tileTransitionState == T_NOT_MOVING)
return TRUE;
- }
else
- {
return FALSE;
- }
}
-static u8 sub_8019978(u32 a0, u32 a1)
+static u8 GetUnionRoomPlayerGraphicsId(u32 gender, u32 id)
{
- return gUnknown_082F072C[a0][a1 % 8];
+ return sUnionRoomObjGfxIds[gender][id % MAX_UNION_ROOM_PLAYERS];
}
-static void sub_8019990(u32 a0, u32 a1, s32 * a2, s32 * a3)
+static void GetUnionRoomPlayerFacingCoords(u32 playerIdx, u32 direction, s32 * x, s32 * y)
{
- *a2 = gUnknown_082F0740[a0][0] + gUnknown_082F0760[a1][0] + 7;
- *a3 = gUnknown_082F0740[a0][1] + gUnknown_082F0760[a1][1] + 7;
+ *x = sUnionRoomPlayerCoords[playerIdx][0] + sFacingDirectionOffsets[direction][0] + 7;
+ *y = sUnionRoomPlayerCoords[playerIdx][1] + sFacingDirectionOffsets[direction][1] + 7;
}
-static bool32 sub_80199E0(u32 a0, u32 a1, s32 a2, s32 a3)
+static bool32 IsUnionRoomPlayerFacingTileAt(u32 playerIdx, u32 direction, s32 x, s32 y)
{
- if (gUnknown_082F0740[a0][0] + gUnknown_082F0760[a1][0] + 7 != a2)
- {
- return FALSE;
- }
- else if (gUnknown_082F0740[a0][1] + gUnknown_082F0760[a1][1] + 7 != a3)
- {
- return FALSE;
- }
- else
- {
+ if ((sUnionRoomPlayerCoords[playerIdx][0] + sFacingDirectionOffsets[direction][0] + 7 == x)
+ && (sUnionRoomPlayerCoords[playerIdx][1] + sFacingDirectionOffsets[direction][1] + 7 == y))
return TRUE;
- }
+ else
+ return FALSE;
}
static bool32 IsUnionRoomPlayerHidden(u32 player_idx)
@@ -126,19 +151,19 @@ static void SetUnionRoomPlayerGfx(u32 playerIdx, u32 gfxId)
static void CreateUnionRoomPlayerObjectEvent(u32 playerIdx)
{
- TrySpawnObjectEvent(gUnknown_082F0774[playerIdx], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
+ TrySpawnObjectEvent(sUnionRoomLocalIds[playerIdx], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
}
static void RemoveUnionRoomPlayerObjectEvent(u32 playerIdx)
{
- RemoveObjectEventByLocalIdAndMap(gUnknown_082F0774[playerIdx], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
+ RemoveObjectEventByLocalIdAndMap(sUnionRoomLocalIds[playerIdx], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
}
static bool32 SetUnionRoomPlayerEnterExitMovement(u32 playerIdx, const u8 * movement)
{
u8 objectId;
struct ObjectEvent * object;
- if (TryGetObjectEventIdByLocalIdAndMap(gUnknown_082F0774[playerIdx], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objectId))
+ if (TryGetObjectEventIdByLocalIdAndMap(sUnionRoomLocalIds[playerIdx], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objectId))
{
return FALSE;
}
@@ -154,11 +179,11 @@ static bool32 SetUnionRoomPlayerEnterExitMovement(u32 playerIdx, const u8 * move
return TRUE;
}
-static bool32 sub_8019B3C(u32 playerIdx)
+static bool32 TryReleaseUnionRoomPlayerObjectEvent(u32 playerIdx)
{
u8 objectId;
struct ObjectEvent * object;
- if (TryGetObjectEventIdByLocalIdAndMap(gUnknown_082F0774[playerIdx], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objectId))
+ if (TryGetObjectEventIdByLocalIdAndMap(sUnionRoomLocalIds[playerIdx], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objectId))
{
return TRUE;
}
@@ -178,39 +203,39 @@ static bool32 sub_8019B3C(u32 playerIdx)
return TRUE;
}
-u8 sub_8019BA8(struct UnkStruct_8019BA8 * ptr)
+u8 InitUnionRoomPlayerObjects(struct UnionRoomObject * players)
{
s32 i;
- gUnknown_02022C68 = 0;
- gUnknown_02022C64 = ptr;
- for (i = 0; i < 8; i++)
+ sUnionObjRefreshTimer = 0;
+ sUnionObjWork = players;
+ for (i = 0; i < MAX_UNION_ROOM_PLAYERS; i++)
{
- ptr[i].field_0 = 0;
- ptr[i].field_1 = 0;
- ptr[i].field_2 = 0;
- ptr[i].field_3 = 0;
+ players[i].state = 0;
+ players[i].gfxId = 0;
+ players[i].animState = 0;
+ players[i].schedAnim = UNION_ROOM_SPAWN_NONE;
}
- return sub_8019DF4();
+ return CreateTask_AnimateUnionRoomPlayers();
}
-static bool32 sub_8019BDC(s8 * a0, u32 playerIdx, struct UnkStruct_8019BA8 * ptr)
+static bool32 AnimateUnionRoomPlayerDespawn(s8 * state, u32 playerIdx, struct UnionRoomObject * ptr)
{
- switch (*a0)
+ switch (*state)
{
case 0:
- if (SetUnionRoomPlayerEnterExitMovement(playerIdx, gUnknown_082F078C) == TRUE)
+ if (SetUnionRoomPlayerEnterExitMovement(playerIdx, sMovement_UnionPlayerExit) == TRUE)
{
HideUnionRoomPlayer(playerIdx);
- (*a0)++;
+ (*state)++;
}
break;
case 1:
- if (sub_8019B3C(playerIdx))
+ if (TryReleaseUnionRoomPlayerObjectEvent(playerIdx))
{
RemoveUnionRoomPlayerObjectEvent(playerIdx);
HideUnionRoomPlayer(playerIdx);
- *a0 = 0;
+ *state = 0;
return TRUE;
}
break;
@@ -218,42 +243,42 @@ static bool32 sub_8019BDC(s8 * a0, u32 playerIdx, struct UnkStruct_8019BA8 * ptr
return FALSE;
}
-static bool32 sub_8019C38(s8 * a0, u32 playerIdx, struct UnkStruct_8019BA8 * ptr)
+static bool32 AnimateUnionRoomPlayerSpawn(s8 * state, u32 playerIdx, struct UnionRoomObject * ptr)
{
s16 x, y;
- switch (*a0)
+ switch (*state)
{
case 0:
- if (!is_walking_or_running())
+ if (!IsPlayerStandingStill())
{
break;
}
PlayerGetDestCoords(&x, &y);
- if (sub_80199E0(playerIdx, 0, x, y) == 1)
+ if (IsUnionRoomPlayerFacingTileAt(playerIdx, 0, x, y) == TRUE)
{
break;
}
player_get_pos_including_state_based_drift(&x, &y);
- if (sub_80199E0(playerIdx, 0, x, y) == 1)
+ if (IsUnionRoomPlayerFacingTileAt(playerIdx, 0, x, y) == TRUE)
{
break;
}
- SetUnionRoomPlayerGfx(playerIdx, ptr->field_1);
+ SetUnionRoomPlayerGfx(playerIdx, ptr->gfxId);
CreateUnionRoomPlayerObjectEvent(playerIdx);
ShowUnionRoomPlayer(playerIdx);
- (*a0)++;
+ (*state)++;
// fallthrough
case 3: // incorrect?
- if (SetUnionRoomPlayerEnterExitMovement(playerIdx, gUnknown_082F078E) == 1)
+ if (SetUnionRoomPlayerEnterExitMovement(playerIdx, sMovement_UnionPlayerEnter) == TRUE)
{
- (*a0)++;
+ (*state)++;
}
break;
case 2:
- if (sub_8019B3C(playerIdx))
+ if (TryReleaseUnionRoomPlayerObjectEvent(playerIdx))
{
- *a0 = 0;
+ *state = 0;
return TRUE;
}
break;
@@ -261,44 +286,38 @@ static bool32 sub_8019C38(s8 * a0, u32 playerIdx, struct UnkStruct_8019BA8 * ptr
return FALSE;
}
-static bool32 sub_8019CF0(u32 playerIdx, u32 a1, u32 a2)
+static bool32 SpawnGroupLeader(u32 playerIdx, u32 gender, u32 id)
{
- struct UnkStruct_8019BA8 * ptr = &gUnknown_02022C64[playerIdx];
- ptr->field_3 = 1;
- ptr->field_1 = sub_8019978(a1, a2);
- if (ptr->field_0 == 0)
- {
+ struct UnionRoomObject * ptr = &sUnionObjWork[playerIdx];
+ ptr->schedAnim = UNION_ROOM_SPAWN_IN;
+ ptr->gfxId = GetUnionRoomPlayerGraphicsId(gender, id);
+
+ if (ptr->state == 0)
return TRUE;
- }
else
- {
return FALSE;
- }
}
-static bool32 sub_8019D20(u32 playerIdx)
+static bool32 DespawnGroupLeader(u32 playerIdx)
{
- struct UnkStruct_8019BA8 * ptr = &gUnknown_02022C64[playerIdx];
- ptr->field_3 = 2;
- if (ptr->field_0 == 1)
- {
+ struct UnionRoomObject * ptr = &sUnionObjWork[playerIdx];
+ ptr->schedAnim = UNION_ROOM_SPAWN_OUT;
+
+ if (ptr->state == 1)
return TRUE;
- }
else
- {
return FALSE;
- }
}
-static void sub_8019D44(u32 playerIdx, struct UnkStruct_8019BA8 * ptr)
+static void AnimateUnionRoomPlayer(u32 playerIdx, struct UnionRoomObject * ptr)
{
- switch (ptr->field_0)
+ switch (ptr->state)
{
case 0:
- if (ptr->field_3 == 1)
+ if (ptr->schedAnim == UNION_ROOM_SPAWN_IN)
{
- ptr->field_0 = 2;
- ptr->field_2 = 0;
+ ptr->state = 2;
+ ptr->animState = 0;
}
else
{
@@ -306,23 +325,23 @@ static void sub_8019D44(u32 playerIdx, struct UnkStruct_8019BA8 * ptr)
}
// fallthrough
case 2:
- if (!sub_8019F8C(playerIdx, 0) && ptr->field_3 == 2)
+ if (!IsUnionRoomPlayerInvisible(playerIdx, 0) && ptr->schedAnim == UNION_ROOM_SPAWN_OUT)
{
- ptr->field_0 = 0;
- ptr->field_2 = 0;
+ ptr->state = 0;
+ ptr->animState = 0;
RemoveUnionRoomPlayerObjectEvent(playerIdx);
HideUnionRoomPlayer(playerIdx);
}
- else if (sub_8019C38(&ptr->field_2, playerIdx, ptr) == 1)
+ else if (AnimateUnionRoomPlayerSpawn(&ptr->animState, playerIdx, ptr) == TRUE)
{
- ptr->field_0 = 1;
+ ptr->state = 1;
}
break;
case 1:
- if (ptr->field_3 == 2)
+ if (ptr->schedAnim == UNION_ROOM_SPAWN_OUT)
{
- ptr->field_0 = 3;
- ptr->field_2 = 0;
+ ptr->state = 3;
+ ptr->animState = 0;
}
else
{
@@ -330,49 +349,43 @@ static void sub_8019D44(u32 playerIdx, struct UnkStruct_8019BA8 * ptr)
}
// fallthrough
case 3:
- if (sub_8019BDC(&ptr->field_2, playerIdx, ptr) == 1)
+ if (AnimateUnionRoomPlayerDespawn(&ptr->animState, playerIdx, ptr) == 1)
{
- ptr->field_0 = 0;
+ ptr->state = 0;
}
break;
}
- ptr->field_3 = 0;
+ ptr->schedAnim = UNION_ROOM_SPAWN_NONE;
}
-static void sub_8019DD0(u8 taskId)
+static void Task_AnimateUnionRoomPlayers(u8 taskId)
{
s32 i;
- for (i = 0; i < 8; i++)
- {
- sub_8019D44(i, &gUnknown_02022C64[i]);
- }
+ for (i = 0; i < MAX_UNION_ROOM_PLAYERS; i++)
+ AnimateUnionRoomPlayer(i, &sUnionObjWork[i]);
}
-static u8 sub_8019DF4(void)
+static u8 CreateTask_AnimateUnionRoomPlayers(void)
{
- if (FuncIsActiveTask(sub_8019DD0) == 1)
- {
+ if (FuncIsActiveTask(Task_AnimateUnionRoomPlayers) == TRUE)
return NUM_TASKS;
- }
else
- {
- return CreateTask(sub_8019DD0, 5);
- }
+ return CreateTask(Task_AnimateUnionRoomPlayers, 5);
}
-static void sub_8019E20(void)
+static void DestroyTask_AnimateUnionRoomPlayers(void)
{
- u8 taskId = FindTaskIdByFunc(sub_8019DD0);
+ u8 taskId = FindTaskIdByFunc(Task_AnimateUnionRoomPlayers);
if (taskId < NUM_TASKS)
{
DestroyTask(taskId);
}
}
-void sub_8019E3C(void)
+void DestroyUnionRoomPlayerObjects(void)
{
s32 i;
- for (i = 0; i < 8; i++)
+ for (i = 0; i < MAX_UNION_ROOM_PLAYERS; i++)
{
if (!IsUnionRoomPlayerHidden(i))
{
@@ -380,233 +393,232 @@ void sub_8019E3C(void)
HideUnionRoomPlayer(i);
}
}
- gUnknown_02022C64 = NULL;
- sub_8019E20();
+ sUnionObjWork = NULL;
+ DestroyTask_AnimateUnionRoomPlayers();
}
-void sub_8019E70(u8 * sp8, s32 r9)
+void CreateGroupMemberSpritesInvisible(u8 * spriteIds, s32 playerIdx)
{
- s32 r7;
+ s32 direction;
- for (r7 = 0; r7 < 5; r7++)
+ for (direction = DIR_NONE; direction <= DIR_EAST; direction++)
{
- s32 r5 = 5 * r9 + r7;
- sp8[r5] = sprite_new(OBJ_EVENT_GFX_MAN_4, r5 - 0x38, gUnknown_082F0740[r9][0] + gUnknown_082F0760[r7][0], gUnknown_082F0740[r9][1] + gUnknown_082F0760[r7][1], 3, 1);
- sub_8097C44(r5 - 0x38, TRUE);
+ s32 id = UR_PLAYER_SPRITE_ID(playerIdx, direction);
+ spriteIds[id] = CreateObjectSprite(OBJ_EVENT_GFX_MAN_4,
+ id - UR_SPRITE_START_ID,
+ sUnionRoomPlayerCoords[playerIdx][0] + sFacingDirectionOffsets[direction][0],
+ sUnionRoomPlayerCoords[playerIdx][1] + sFacingDirectionOffsets[direction][1],
+ 3, 1);
+ SetObjectEventSpriteInvisibility(id - UR_SPRITE_START_ID, TRUE);
}
}
-void sub_8019F04(u8 * r5)
+void DestroyGroupMemberSprites(u8 * spriteIds)
{
s32 i;
- for (i = 0; i < 40; i++)
- {
- DestroySprite(&gSprites[r5[i]]);
- }
+ for (i = 0; i < UR_PLAYER_SPRITE_ID(MAX_UNION_ROOM_PLAYERS, 0); i++)
+ DestroySprite(&gSprites[spriteIds[i]]);
}
-void sub_8019F2C(void)
+void SetTilesAroundUnionRoomPlayersPassable(void)
{
- s32 i, j, x, y;
- for (i = 0; i < 8; i++)
+ s32 i, direction, x, y;
+ for (i = 0; i < MAX_UNION_ROOM_PLAYERS; i++)
{
- for (j = 0; j < 5; j++)
+ for (direction = DIR_NONE; direction <= DIR_EAST; direction++)
{
- sub_8019990(i, j, &x, &y);
- sub_8088B94(x, y, 0);
+ GetUnionRoomPlayerFacingCoords(i, direction, &x, &y);
+ MapGridSetMetatileImpassabilityAt(x, y, FALSE);
}
}
}
-static u8 sub_8019F64(u32 r1, u32 unused, struct GFtgtGname * r2)
+static u8 GetNewFacingDirectionForUnionRoomPlayer(u32 direction, u32 playerIdx, struct GFtgtGname * gname)
{
- if (r1 != 0)
- {
- return gUnknown_082F076F[r1];
- }
- else if (r2->activity == 0x45)
- {
- return 1;
- }
+ if (direction != DIR_NONE)
+ return sNextFacingDirection[direction];
+ else if (gname->activity == (ACTIVITY_CHAT | IN_UNION_ROOM))
+ return DIR_SOUTH;
else
- {
- return 4;
- }
+ return DIR_EAST;
}
-static u32 sub_8019F8C(u32 a0, u32 a1)
+static bool32 IsUnionRoomPlayerInvisible(u32 playerIdx, u32 direction)
{
- return sub_8097C8C(5 * a0 + a1 - 0x38);
+ return IsObjectEventSpriteInvisible(UR_PLAYER_SPRITE_ID(playerIdx, direction) - UR_SPRITE_START_ID);
}
-static void sub_8019FA4(u32 r5, u32 r6, u8 r8, struct GFtgtGname * r9)
+static void SpawnGroupMember(u32 playerIdx, u32 direction, u8 graphicsId, struct GFtgtGname * gname)
{
s32 x, y;
- s32 r7 = 5 * r5 + r6;
- if (sub_8019F8C(r5, r6) == 1)
+ s32 id = UR_PLAYER_SPRITE_ID(playerIdx, direction);
+ if (IsUnionRoomPlayerInvisible(playerIdx, direction) == TRUE)
{
- sub_8097C44(r7 - 0x38, FALSE);
- sub_8097CC4(r7 - 0x38, 1);
+ SetObjectEventSpriteInvisibility(id - UR_SPRITE_START_ID, FALSE);
+ SetObjectEventSpriteAnim(id - UR_SPRITE_START_ID, UNION_ROOM_SPAWN_IN);
}
- sub_8097BB4(r7 - 0x38, r8);
- sub_801A3B0(r6, r5, sub_8019F64(r6, r5, r9));
- sub_8019990(r5, r6, &x, &y);
- sub_8088B94(x, y, 1);
+ SetObjectEventSpriteGraphics(id - UR_SPRITE_START_ID, graphicsId);
+ SetUnionRoomObjectFacingDirection(direction, playerIdx, GetNewFacingDirectionForUnionRoomPlayer(direction, playerIdx, gname));
+ GetUnionRoomPlayerFacingCoords(playerIdx, direction, &x, &y);
+ MapGridSetMetatileImpassabilityAt(x, y, TRUE);
}
-static void sub_801A02C(u32 a0, u32 a1)
+static void DespawnGroupMember(u32 playerIdx, u32 direction)
{
s32 x, y;
- sub_8097CC4(5 * a0 + a1 - 0x38, 2);
- sub_8019990(a0, a1, &x, &y);
- sub_8088B94(x, y, 0);
+ SetObjectEventSpriteAnim(UR_PLAYER_SPRITE_ID(playerIdx, direction) - UR_SPRITE_START_ID, UNION_ROOM_SPAWN_OUT);
+ GetUnionRoomPlayerFacingCoords(playerIdx, direction, &x, &y);
+ MapGridSetMetatileImpassabilityAt(x, y, FALSE);
}
-static void sub_801A064(u32 r7, struct GFtgtGname * r8)
+static void AssembleGroup(u32 playerIdx, struct GFtgtGname * gname)
{
s16 x, y, x2, y2;
s32 i;
PlayerGetDestCoords(&x, &y);
player_get_pos_including_state_based_drift(&x2, &y2);
- if (sub_8097C8C(5 * r7 - 0x38) == 1)
+ if (IsObjectEventSpriteInvisible(UR_PLAYER_SPRITE_ID(playerIdx, 0) - UR_SPRITE_START_ID) == TRUE)
{
- if (sub_80199E0(r7, 0, x, y) == 1 || sub_80199E0(r7, 0, x2, y2) == 1)
+ if (IsUnionRoomPlayerFacingTileAt(playerIdx, 0, x, y) == TRUE || IsUnionRoomPlayerFacingTileAt(playerIdx, 0, x2, y2) == TRUE)
{
return;
}
- sub_8019FA4(r7, 0, sub_8019978(r8->playerGender, r8->unk_00.playerTrainerId[0]), r8);
+ SpawnGroupMember(playerIdx, 0, GetUnionRoomPlayerGraphicsId(gname->playerGender, gname->unk_00.playerTrainerId[0]), gname);
}
for (i = 1; i < 5; i++)
{
- if (r8->child_sprite_gender[i - 1] == 0)
+ if (gname->child_sprite_gender[i - 1] == 0)
{
- sub_801A02C(r7, i);
+ DespawnGroupMember(playerIdx, i);
}
- else if (sub_80199E0(r7, i, x, y) == 0 && sub_80199E0(r7, i, x2, y2) == 0)
+ else if (IsUnionRoomPlayerFacingTileAt(playerIdx, i, x, y) == FALSE && IsUnionRoomPlayerFacingTileAt(playerIdx, i, x2, y2) == FALSE)
{
- sub_8019FA4(r7, i, sub_8019978((r8->child_sprite_gender[i - 1] >> 3) & 1, r8->child_sprite_gender[i - 1] & 7), r8);
+ SpawnGroupMember(playerIdx, i, GetUnionRoomPlayerGraphicsId((gname->child_sprite_gender[i - 1] >> 3) & 1, gname->child_sprite_gender[i - 1] & 7), gname);
}
}
}
-static void sub_801A16C(u32 r5, struct GFtgtGname * r4)
+static void SpawnGroupLeaderAndMembers(u32 playerIdx, struct GFtgtGname * gname)
{
u32 i;
- switch (r4->activity)
+ switch (gname->activity)
{
- case 0x40:
- case 0x54:
- sub_8019CF0(r5, r4->playerGender, r4->unk_00.playerTrainerId[0]);
+ case ACTIVITY_NONE | IN_UNION_ROOM:
+ case ACTIVITY_PLYRTALK | IN_UNION_ROOM:
+ SpawnGroupLeader(playerIdx, gname->playerGender, gname->unk_00.playerTrainerId[0]);
for (i = 0; i < 5; i++)
{
- sub_801A02C(r5, i);
+ DespawnGroupMember(playerIdx, i);
}
break;
- case 0x41:
- case 0x44:
- case 0x45:
- case 0x48:
- case 0x51:
- case 0x52:
- case 0x53:
- sub_8019D20(r5);
- sub_801A064(r5, r4);
+ case ACTIVITY_BATTLE_SINGLE | IN_UNION_ROOM:
+ case ACTIVITY_TRADE | IN_UNION_ROOM:
+ case ACTIVITY_CHAT | IN_UNION_ROOM:
+ case ACTIVITY_CARD | IN_UNION_ROOM:
+ case ACTIVITY_ACCEPT | IN_UNION_ROOM:
+ case ACTIVITY_DECLINE | IN_UNION_ROOM:
+ case ACTIVITY_NPCTALK | IN_UNION_ROOM:
+ DespawnGroupLeader(playerIdx);
+ AssembleGroup(playerIdx, gname);
break;
}
}
-static void sub_801A214(u32 r5, struct GFtgtGname * unused)
+static void DespawnGroupLeaderAndMembers(u32 r5, struct GFtgtGname *gname)
{
s32 i;
- sub_8019D20(r5);
+ DespawnGroupLeader(r5);
for (i = 0; i < 5; i++)
{
- sub_801A02C(r5, i);
+ DespawnGroupMember(r5, i);
}
}
-static void sub_801A234(struct UnkStruct_URoom *r0)
+static void UpdateUnionRoomPlayerSprites(struct WirelessLink_URoom *uroom)
{
s32 i;
struct UnkStruct_x20 * r4;
- gUnknown_02022C68 = 0;
- for (i = 0, r4 = r0->field_0->arr; i < 8; i++)
+ sUnionObjRefreshTimer = 0;
+ for (i = 0, r4 = uroom->field_0->arr; i < MAX_UNION_ROOM_PLAYERS; i++)
{
- if (r4[i].field_1A_0 == 1)
+ if (r4[i].groupScheduledAnim == UNION_ROOM_SPAWN_IN)
{
- sub_801A16C(i, &r4[i].unk.field_0);
+ SpawnGroupLeaderAndMembers(i, &r4[i].gname_uname.gname);
}
- else if (r4[i].field_1A_0 == 2)
+ else if (r4[i].groupScheduledAnim == UNION_ROOM_SPAWN_OUT)
{
- sub_801A214(i, &r4[i].unk.field_0);
+ DespawnGroupLeaderAndMembers(i, &r4[i].gname_uname.gname);
}
}
}
-void sub_801A274(struct UnkStruct_URoom *unused)
+void ScheduleUnionRoomPlayerRefresh(struct WirelessLink_URoom *uroom)
{
- gUnknown_02022C68 = 300;
+ sUnionObjRefreshTimer = 300;
}
-void sub_801A284(struct UnkStruct_URoom *r2)
+void HandleUnionRoomPlayerRefresh(struct WirelessLink_URoom *uroom)
{
- if (++gUnknown_02022C68 > 300)
+ if (++sUnionObjRefreshTimer > 300)
{
- sub_801A234(r2);
+ UpdateUnionRoomPlayerSprites(uroom);
}
}
-bool32 sub_801A2A8(struct UnkStruct_Main0 *arg0, s16 *arg1, s16 *arg2, u8 *arg3)
+bool32 TryInteractWithUnionRoomMember(struct UnkStruct_Main0 *main0, s16 *directionPtr, s16 *playerIdxPtr, u8 *spriteIds)
{
s16 x, y;
- s32 i, j;
+ s32 i, direction;
struct UnkStruct_x20 * r4;
- if (!is_walking_or_running())
+ if (!IsPlayerStandingStill())
{
return FALSE;
}
GetXYCoordsOneStepInFrontOfPlayer(&x, &y);
- for (i = 0, r4 = arg0->arr; i < 8; i++)
+ for (i = 0, r4 = main0->arr; i < MAX_UNION_ROOM_PLAYERS; i++)
{
- for (j = 0; j < 5; j++)
+ for (direction = DIR_NONE; direction <= DIR_EAST; direction++)
{
- s32 r3 = 5 * i + j;
- if (x != gUnknown_082F0740[i][0] + gUnknown_082F0760[j][0] + 7)
+ s32 id = UR_PLAYER_SPRITE_ID(i, direction);
+ if (x != sUnionRoomPlayerCoords[i][0] + sFacingDirectionOffsets[direction][0] + 7)
{
continue;
}
- if (y != gUnknown_082F0740[i][1] + gUnknown_082F0760[j][1] + 7)
+ if (y != sUnionRoomPlayerCoords[i][1] + sFacingDirectionOffsets[direction][1] + 7)
{
continue;
}
- if (sub_8097C8C(r3 - 0x38) != 0)
+ if (IsObjectEventSpriteInvisible(id - UR_SPRITE_START_ID))
{
continue;
}
- if (sub_8097D9C(r3 - 0x38) != 0)
+ if (IsObjectEventSpriteAnimating(id - UR_SPRITE_START_ID))
{
continue;
}
- if (r4[i].field_1A_0 != 1)
+ if (r4[i].groupScheduledAnim != UNION_ROOM_SPAWN_IN)
{
continue;
}
- sub_801A3B0(j, i, gUnknown_082F076A[GetPlayerFacingDirection()]);
- *arg1 = j;
- *arg2 = i;
+ // Face player
+ SetUnionRoomObjectFacingDirection(direction, i, sOppositeFacingDirection[GetPlayerFacingDirection()]);
+ *directionPtr = direction;
+ *playerIdxPtr = i;
return TRUE;
}
}
return FALSE;
}
-static void sub_801A3B0(s32 arg0, s32 arg1, u8 arg2)
+static void SetUnionRoomObjectFacingDirection(s32 currDirection, s32 playerIdx, u8 newDirection)
{
- sub_8097B78(5 * arg1 - 0x38 + arg0, arg2);
+ TurnObjectEventSprite(5 * playerIdx - UR_SPRITE_START_ID + currDirection, newDirection);
+ // should be line below, but order is swapped here
+ // TurnObjectEventSprite(UR_PLAYER_SPRITE_ID(playerIdx, currDirection) - UR_SPRITE_START_ID, newDirection);
}
-void sub_801A3D0(u32 arg0, u32 arg1, struct UnkStruct_Main0 *arg2)
+void UpdateUnionRoomMemberFacing(u32 currDirection, u32 playerIdx, struct UnkStruct_Main0 *main0)
{
- return sub_801A3B0(arg0, arg1, sub_8019F64(arg0, arg1, &arg2->arr[arg1].unk.field_0));
+ return SetUnionRoomObjectFacingDirection(currDirection, playerIdx, GetNewFacingDirectionForUnionRoomPlayer(currDirection, playerIdx, &main0->arr[playerIdx].gname_uname.gname));
}
diff --git a/src/wild_encounter.c b/src/wild_encounter.c
index 7d20b2476..1c4fd24fd 100644
--- a/src/wild_encounter.c
+++ b/src/wild_encounter.c
@@ -303,29 +303,27 @@ static u8 PickWildMonNature(void)
u8 i;
u8 j;
struct Pokeblock *safariPokeblock;
- u8 natures[25];
+ u8 natures[NUM_NATURES];
if (GetSafariZoneFlag() == TRUE && Random() % 100 < 80)
{
safariPokeblock = SafariZoneGetActivePokeblock();
if (safariPokeblock != NULL)
{
- for (i = 0; i < 25; i++)
+ for (i = 0; i < NUM_NATURES; i++)
natures[i] = i;
- for (i = 0; i < 24; i++)
+ for (i = 0; i < NUM_NATURES - 1; i++)
{
- for (j = i + 1; j < 25; j++)
+ for (j = i + 1; j < NUM_NATURES; j++)
{
if (Random() & 1)
{
- u8 temp = natures[i];
-
- natures[i] = natures[j];
- natures[j] = temp;
+ u8 temp;
+ SWAP(natures[i], natures[j], temp);
}
}
}
- for (i = 0; i < 25; i++)
+ for (i = 0; i < NUM_NATURES; i++)
{
if (PokeblockGetGain(natures[i], safariPokeblock) > 0)
return natures[i];
@@ -337,11 +335,11 @@ static u8 PickWildMonNature(void)
&& GetMonAbility(&gPlayerParty[0]) == ABILITY_SYNCHRONIZE
&& Random() % 2 == 0)
{
- return GetMonData(&gPlayerParty[0], MON_DATA_PERSONALITY) % 25;
+ return GetMonData(&gPlayerParty[0], MON_DATA_PERSONALITY) % NUM_NATURES;
}
// random nature
- return Random() % 25;
+ return Random() % NUM_NATURES;
}
static void CreateWildMon(u16 species, u8 level)
diff --git a/src/wireless_communication_status_screen.c b/src/wireless_communication_status_screen.c
new file mode 100644
index 000000000..87b200f14
--- /dev/null
+++ b/src/wireless_communication_status_screen.c
@@ -0,0 +1,432 @@
+#include "global.h"
+#include "task.h"
+#include "bg.h"
+#include "palette.h"
+#include "gpu_regs.h"
+#include "malloc.h"
+#include "scanline_effect.h"
+#include "m4a.h"
+#include "dynamic_placeholder_text_util.h"
+#include "overworld.h"
+#include "strings.h"
+#include "string_util.h"
+#include "international_string_util.h"
+#include "sound.h"
+#include "menu.h"
+#include "librfu.h"
+#include "link_rfu.h"
+#include "union_room.h"
+#include "constants/songs.h"
+#include "constants/union_room.h"
+
+enum {
+ COLORMODE_NORMAL,
+ COLORMODE_WHITE_LGRAY,
+ COLORMODE_RED,
+ COLORMODE_GREEN,
+ COLORMODE_WHITE_DGRAY,
+};
+
+#define GROUPTYPE_TRADE 0
+#define GROUPTYPE_BATTLE 1
+#define GROUPTYPE_UNION 2
+#define GROUPTYPE_TOTAL 3
+#define GROUPTYPE_NONE -1
+#define NUM_GROUPTYPES 4
+
+struct WirelessCommunicationStatusScreen
+{
+ u32 groupCounts[NUM_GROUPTYPES];
+ u32 prevGroupCounts[NUM_GROUPTYPES];
+ u32 activities[NUM_TASK_DATA];
+ u8 taskId;
+ u8 rfuTaskId;
+ u8 filler[10];
+};
+
+static struct WirelessCommunicationStatusScreen * sStatusScreen;
+
+static void CB2_InitWirelessCommunicationScreen(void);
+static void Task_WirelessCommunicationScreen(u8);
+static void WCSS_AddTextPrinterParameterized(u8, u8, const u8 *, u8, u8, u8);
+static bool32 UpdateCommunicationCounts(u32 *, u32 *, u32 *, u8);
+
+static const u16 sBgTiles_Pal[] = INCBIN_U16("graphics/interface/wireless_info_screen.gbapal");
+static const u32 sBgTiles_Gfx[] = INCBIN_U32("graphics/interface/wireless_info_screen.4bpp.lz");
+static const u32 sBgTiles_Tilemap[] = INCBIN_U32("graphics/interface/wireless_info_screen.bin.lz");
+
+static const struct BgTemplate sBgTemplates[] = {
+ {
+ .bg = 0,
+ .charBaseIndex = 2,
+ .mapBaseIndex = 31,
+ .priority = 0
+ }, {
+ .bg = 1,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 8,
+ .priority = 1
+ }
+};
+
+static const struct WindowTemplate sWindowTemplates[] = {
+ {
+ .bg = 0,
+ .tilemapLeft = 3,
+ .tilemapTop = 0,
+ .width = 24,
+ .height = 3,
+ .paletteNum = 15,
+ .baseBlock = 0x0001
+ }, {
+ .bg = 0,
+ .tilemapLeft = 3,
+ .tilemapTop = 4,
+ .width = 21,
+ .height = 15,
+ .paletteNum = 15,
+ .baseBlock = 0x0049
+ }, {
+ .bg = 0,
+ .tilemapLeft = 24,
+ .tilemapTop = 4,
+ .width = 3,
+ .height = 15,
+ .paletteNum = 15,
+ .baseBlock = 0x0184
+ }, DUMMY_WIN_TEMPLATE
+};
+
+static const u8 *const sHeaderTexts[NUM_GROUPTYPES + 1] = {
+ [0] = gText_WirelessCommStatus,
+ [GROUPTYPE_TRADE + 1] = gText_PeopleTrading,
+ [GROUPTYPE_BATTLE + 1] = gText_PeopleBattling,
+ [GROUPTYPE_UNION + 1] = gText_PeopleInUnionRoom,
+ [GROUPTYPE_TOTAL + 1] = gText_PeopleCommunicating
+};
+
+// Activity, group type, number of players
+// 0 players means the number of players can change and should be counted dynamically
+// GROUPTYPE_TOTAL have no unique group and are simply counted in the total of "people communicating"
+// UB: GROUPTYPE_NONE (-1) can potentially be used as an index into a u8[4] in CountPlayersInGroupAndGetActivity
+static const u8 sActivityGroupInfo[][3] = {
+ {ACTIVITY_BATTLE_SINGLE, GROUPTYPE_BATTLE, 2},
+ {ACTIVITY_BATTLE_DOUBLE, GROUPTYPE_BATTLE, 2},
+ {ACTIVITY_BATTLE_MULTI, GROUPTYPE_BATTLE, 4},
+ {ACTIVITY_TRADE, GROUPTYPE_TRADE, 2},
+ {ACTIVITY_WONDER_CARD, GROUPTYPE_TOTAL, 2},
+ {ACTIVITY_WONDER_NEWS, GROUPTYPE_TOTAL, 2},
+ {ACTIVITY_POKEMON_JUMP, GROUPTYPE_TOTAL, 0},
+ {ACTIVITY_BERRY_CRUSH, GROUPTYPE_TOTAL, 0},
+ {ACTIVITY_BERRY_PICK, GROUPTYPE_TOTAL, 0},
+ {ACTIVITY_SEARCH, GROUPTYPE_NONE, 0},
+ {ACTIVITY_SPIN_TRADE, GROUPTYPE_TRADE, 0},
+ {ACTIVITY_BERRY_BLENDER, GROUPTYPE_TOTAL, 0},
+ {ACTIVITY_RECORD_CORNER, GROUPTYPE_TOTAL, 0},
+ {ACTIVITY_NONE | IN_UNION_ROOM, GROUPTYPE_UNION, 1},
+ {ACTIVITY_BATTLE_SINGLE | IN_UNION_ROOM, GROUPTYPE_UNION, 2},
+ {ACTIVITY_TRADE | IN_UNION_ROOM, GROUPTYPE_UNION, 2},
+ {ACTIVITY_CHAT | IN_UNION_ROOM, GROUPTYPE_UNION, 0},
+ {ACTIVITY_CARD | IN_UNION_ROOM, GROUPTYPE_UNION, 2},
+ {ACTIVITY_PLYRTALK | IN_UNION_ROOM, GROUPTYPE_UNION, 1},
+ {ACTIVITY_NPCTALK | IN_UNION_ROOM, GROUPTYPE_UNION, 2},
+ {ACTIVITY_ACCEPT | IN_UNION_ROOM, GROUPTYPE_UNION, 1},
+ {ACTIVITY_DECLINE | IN_UNION_ROOM, GROUPTYPE_UNION, 1},
+ {ACTIVITY_WONDER_CARD2, GROUPTYPE_TOTAL, 2},
+ {ACTIVITY_WONDER_NEWS2, GROUPTYPE_TOTAL, 2},
+ {ACTIVITY_CONTEST_COOL, GROUPTYPE_TOTAL, 0},
+ {ACTIVITY_CONTEST_BEAUTY, GROUPTYPE_TOTAL, 0},
+ {ACTIVITY_CONTEST_CUTE, GROUPTYPE_TOTAL, 0},
+ {ACTIVITY_CONTEST_SMART, GROUPTYPE_TOTAL, 0},
+ {ACTIVITY_CONTEST_TOUGH, GROUPTYPE_TOTAL, 0},
+ {ACTIVITY_BATTLE_TOWER, GROUPTYPE_BATTLE, 2},
+ {ACTIVITY_BATTLE_TOWER_OPEN, GROUPTYPE_BATTLE, 2}
+};
+
+static void CB2_RunWirelessCommunicationScreen(void)
+{
+ if (!IsDma3ManagerBusyWithBgCopy())
+ {
+ RunTasks();
+ RunTextPrinters();
+ AnimateSprites();
+ BuildOamBuffer();
+ UpdatePaletteFade();
+ }
+}
+
+static void VBlankCB_WirelessCommunicationScreen(void)
+{
+ LoadOam();
+ ProcessSpriteCopyRequests();
+ TransferPlttBuffer();
+}
+
+void ShowWirelessCommunicationScreen(void)
+{
+ SetMainCallback2(CB2_InitWirelessCommunicationScreen);
+}
+
+static void CB2_InitWirelessCommunicationScreen(void)
+{
+ SetGpuReg(REG_OFFSET_DISPCNT, 0);
+ sStatusScreen = AllocZeroed(sizeof(struct WirelessCommunicationStatusScreen));
+ SetVBlankCallback(NULL);
+ ResetBgsAndClearDma3BusyFlags(0);
+ InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates));
+ SetBgTilemapBuffer(1, Alloc(0x800));
+ SetBgTilemapBuffer(0, Alloc(0x800));
+ DecompressAndLoadBgGfxUsingHeap(1, sBgTiles_Gfx, 0, 0, 0);
+ CopyToBgTilemapBuffer(1, sBgTiles_Tilemap, 0, 0);
+ InitWindows(sWindowTemplates);
+ DeactivateAllTextPrinters();
+ ResetPaletteFade();
+ ResetSpriteData();
+ ResetTasks();
+ ScanlineEffect_Stop();
+ m4aSoundVSyncOn();
+ SetVBlankCallback(VBlankCB_WirelessCommunicationScreen);
+ sStatusScreen->taskId = CreateTask(Task_WirelessCommunicationScreen, 0);
+ sStatusScreen->rfuTaskId = CreateTask_ListenToWireless();
+ sStatusScreen->prevGroupCounts[GROUPTYPE_TOTAL] = 1;
+ ChangeBgX(0, 0, 0);
+ ChangeBgY(0, 0, 0);
+ ChangeBgX(1, 0, 0);
+ ChangeBgY(1, 0, 0);
+ LoadPalette(sBgTiles_Pal, 0x00, 0x20);
+ Menu_LoadStdPalAt(0xF0);
+ DynamicPlaceholderTextUtil_Reset();
+ FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 0x0F);
+ CopyBgTilemapBufferToVram(1);
+ SetMainCallback2(CB2_RunWirelessCommunicationScreen);
+ RunTasks();
+ RunTextPrinters();
+ AnimateSprites();
+ BuildOamBuffer();
+ UpdatePaletteFade();
+}
+
+static void CB2_ExitWirelessCommunicationStatusScreen(void)
+{
+ s32 i;
+ FreeAllWindowBuffers();
+ for (i = 0; i < (int)ARRAY_COUNT(sBgTemplates); i++)
+ {
+ Free(GetBgTilemapBuffer(i));
+ }
+ Free(sStatusScreen);
+ SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
+}
+
+static void WCSS_CyclePalette(s16 * counter, s16 * palIdx)
+{
+ if (++(*counter) > 5)
+ {
+ if (++(*palIdx) == 14)
+ *palIdx = 0;
+
+ *counter = 0;
+ }
+ LoadPalette(sBgTiles_Pal + 16 * (*palIdx + 2), 0, 0x10);
+}
+
+static void PrintHeaderTexts(void)
+{
+ s32 i;
+ FillWindowPixelBuffer(0, PIXEL_FILL(0));
+ FillWindowPixelBuffer(1, PIXEL_FILL(0));
+ FillWindowPixelBuffer(2, PIXEL_FILL(0));
+ WCSS_AddTextPrinterParameterized(0, 1, sHeaderTexts[0], GetStringCenterAlignXOffset(1, sHeaderTexts[0], 0xC0), 6, COLORMODE_GREEN);
+ for (i = 0; i < (int)ARRAY_COUNT(*sHeaderTexts) - 1; i++)
+ {
+ WCSS_AddTextPrinterParameterized(1, 1, sHeaderTexts[i + 1], 0, 30 * i + 8, COLORMODE_WHITE_LGRAY);
+ }
+ WCSS_AddTextPrinterParameterized(1, 1, sHeaderTexts[i + 1], 0, 30 * i + 8, COLORMODE_RED);
+ PutWindowTilemap(0);
+ CopyWindowToVram(0, 2);
+ PutWindowTilemap(1);
+ CopyWindowToVram(1, 2);
+}
+
+#define tState data[0]
+
+static void Task_WirelessCommunicationScreen(u8 taskId)
+{
+ s32 i;
+ switch (gTasks[taskId].tState)
+ {
+ case 0:
+ PrintHeaderTexts();
+ gTasks[taskId].tState++;
+ break;
+ case 1:
+ BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0);
+ ShowBg(1);
+ CopyBgTilemapBufferToVram(0);
+ ShowBg(0);
+ gTasks[taskId].tState++;
+ break;
+ case 2:
+ if (!gPaletteFade.active)
+ {
+ gTasks[taskId].tState++;
+ }
+ break;
+ case 3:
+ if (UpdateCommunicationCounts(sStatusScreen->groupCounts, sStatusScreen->prevGroupCounts, sStatusScreen->activities, sStatusScreen->rfuTaskId))
+ {
+ FillWindowPixelBuffer(2, PIXEL_FILL(0));
+ for (i = 0; i < NUM_GROUPTYPES; i++)
+ {
+ ConvertIntToDecimalStringN(gStringVar4, sStatusScreen->groupCounts[i], STR_CONV_MODE_RIGHT_ALIGN, 2);
+ if (i != GROUPTYPE_TOTAL)
+ WCSS_AddTextPrinterParameterized(2, 1, gStringVar4, 12, 30 * i + 8, COLORMODE_WHITE_LGRAY);
+ else
+ WCSS_AddTextPrinterParameterized(2, 1, gStringVar4, 12, 98, COLORMODE_RED);
+ }
+ PutWindowTilemap(2);
+ CopyWindowToVram(2, 3);
+ }
+ if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
+ {
+ PlaySE(SE_SELECT);
+ gTasks[sStatusScreen->rfuTaskId].data[15] = 0xFF;
+ gTasks[taskId].tState++;
+ }
+ WCSS_CyclePalette(&gTasks[taskId].data[7], &gTasks[taskId].data[8]);
+ break;
+ case 4:
+ BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
+ gTasks[taskId].tState++;
+ break;
+ case 5:
+ if (!gPaletteFade.active)
+ {
+ SetMainCallback2(CB2_ExitWirelessCommunicationStatusScreen);
+ DestroyTask(taskId);
+ }
+ break;
+ }
+}
+
+#undef tState
+
+static void WCSS_AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 mode)
+{
+ u8 color[3];
+
+ switch (mode)
+ {
+ case COLORMODE_NORMAL:
+ color[0] = TEXT_COLOR_TRANSPARENT;
+ color[1] = TEXT_COLOR_DARK_GREY;
+ color[2] = TEXT_COLOR_LIGHT_GREY;
+ break;
+ case COLORMODE_WHITE_LGRAY:
+ color[0] = TEXT_COLOR_TRANSPARENT;
+ color[1] = TEXT_COLOR_WHITE;
+ color[2] = TEXT_COLOR_LIGHT_GREY;
+ break;
+ case COLORMODE_RED:
+ color[0] = TEXT_COLOR_TRANSPARENT;
+ color[1] = TEXT_COLOR_RED;
+ color[2] = TEXT_COLOR_LIGHT_RED;
+ break;
+ case COLORMODE_GREEN:
+ color[0] = TEXT_COLOR_TRANSPARENT;
+ color[1] = TEXT_COLOR_LIGHT_GREEN;
+ color[2] = TEXT_COLOR_GREEN;
+ break;
+ case COLORMODE_WHITE_DGRAY:
+ color[0] = TEXT_COLOR_TRANSPARENT;
+ color[1] = TEXT_COLOR_WHITE;
+ color[2] = TEXT_COLOR_DARK_GREY;
+ break;
+ }
+
+ AddTextPrinterParameterized4(windowId, fontId, x, y, 0, 0, color, -1, str);
+}
+
+static u32 CountPlayersInGroupAndGetActivity(struct UnkStruct_x20 * unk20, u32 * groupCounts)
+{
+ int i, j, k;
+ u32 activity = unk20->gname_uname.gname.activity;
+
+ #define group_activity(i) (sActivityGroupInfo[(i)][0])
+ #define group_type(i) (sActivityGroupInfo[(i)][1])
+ #define group_players(i) (sActivityGroupInfo[(i)][2])
+
+ for (i = 0; i < ARRAY_COUNT(sActivityGroupInfo); i++)
+ {
+ if (activity == group_activity(i) && unk20->groupScheduledAnim == UNION_ROOM_SPAWN_IN)
+ {
+ if (group_players(i) == 0)
+ {
+ k = 0;
+ for (j = 0; j < RFU_CHILD_MAX; j++)
+ {
+ if (unk20->gname_uname.gname.child_sprite_gender[j] != 0) k++;
+ }
+ k++;
+ groupCounts[group_type(i)] += k;
+ }
+ else
+ {
+ groupCounts[group_type(i)] += group_players(i);
+ }
+ }
+ }
+ return activity;
+
+ #undef group_activity
+ #undef group_type
+ #undef group_players
+}
+
+static bool32 HaveCountsChanged(u32 * currCounts, u32 * prevCounts)
+{
+ s32 i;
+ for (i = 0; i < NUM_GROUPTYPES; i++)
+ {
+ if (currCounts[i] != prevCounts[i])
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static bool32 UpdateCommunicationCounts(u32 * groupCounts, u32 * prevGroupCounts, u32 * activities, u8 taskId)
+{
+ bool32 activitiesChanged = FALSE;
+ u32 groupCountBuffer[NUM_GROUPTYPES] = {0, 0, 0, 0};
+ struct UnkStruct_x20 ** data = (void *)gTasks[taskId].data;
+ s32 i;
+
+ for (i = 0; i < NUM_TASK_DATA; i++)
+ {
+ u32 activity = CountPlayersInGroupAndGetActivity(&(*data)[i], groupCountBuffer);
+ if (activity != activities[i])
+ {
+ activities[i] = activity;
+ activitiesChanged = TRUE;
+ }
+ }
+
+ if (!HaveCountsChanged(groupCountBuffer, prevGroupCounts))
+ {
+ if (activitiesChanged == TRUE)
+ return TRUE;
+ else
+ return FALSE;
+ }
+ else
+ {
+ memcpy(groupCounts, groupCountBuffer, sizeof(groupCountBuffer));
+ memcpy(prevGroupCounts, groupCountBuffer, sizeof(groupCountBuffer));
+
+ groupCounts[GROUPTYPE_TOTAL] = groupCounts[GROUPTYPE_TRADE]
+ + groupCounts[GROUPTYPE_BATTLE]
+ + groupCounts[GROUPTYPE_UNION]
+ + groupCounts[GROUPTYPE_TOTAL];
+ return TRUE;
+ }
+}
diff --git a/sym_bss.txt b/sym_bss.txt
index aad8c8f14..3166aee45 100644
--- a/sym_bss.txt
+++ b/sym_bss.txt
@@ -10,6 +10,7 @@
.include "src/link_rfu_3.o"
.include "src/link_rfu_2.o"
.include "src/union_room.o"
+ .include "src/wireless_communication_status_screen.o"
.include "src/union_room_battle.o"
.include "src/dodrio_berry_picking.o"
.include "src/rtc.o"
diff --git a/sym_ewram.txt b/sym_ewram.txt
index d00f7953c..88c4461cb 100644
--- a/sym_ewram.txt
+++ b/sym_ewram.txt
@@ -11,6 +11,7 @@
.include "src/union_room.o"
.include "src/mystery_gift.o"
.include "src/union_room_player_avatar.o"
+ .include "src/wireless_communication_status_screen.o"
.include "src/union_room_battle.o"
.include "src/mevent2.o"
.include "src/mevent_801BAAC.o"
@@ -74,7 +75,7 @@
.include "src/record_mixing.o"
.include "src/secret_base.o"
.include "src/tv.o"
- .include "src/contest_link_80F57C4.o"
+ .include "src/contest_util.o"
.include "src/rotating_gate.o"
.include "src/safari_zone.o"
.include "src/item_use.o"
@@ -103,7 +104,7 @@
.include "src/battle_transition.o"
.include "src/battle_message.o"
.include "src/cable_car.o"
- .include "src/rom_81520A8.o"
+ .include "src/confetti_util.o"
.include "src/save.o"
.include "src/mystery_event_script.o"
.include "src/move_relearner.o"
diff --git a/tools/gbagfx/main.c b/tools/gbagfx/main.c
index 61e93ea45..cf3031696 100644
--- a/tools/gbagfx/main.c
+++ b/tools/gbagfx/main.c
@@ -92,6 +92,7 @@ void HandleGbaToPngCommand(char *inputPath, char *outputPath, int argc, char **a
options.width = 1;
options.metatileWidth = 1;
options.metatileHeight = 1;
+ options.tilemapFilePath = NULL;
options.isAffineMap = false;
for (int i = 3; i < argc; i++)