diff --git a/battle/core.asm b/battle/core.asm index 0d2f5f6d7..7c16f5934 100644 --- a/battle/core.asm +++ b/battle/core.asm @@ -2452,7 +2452,7 @@ Function3cfa4: ; 3cfa4 and a ld a, b call z, Function3d0ea - callab Function39939 + callab Battle_GetTrainerName ld hl, BattleText_0x809da call StdBattleTextBox call IsMobileBattle @@ -2493,7 +2493,7 @@ Function3cfa4: ; 3cfa4 call DelayFrames call EmptyBattleTextBox ld c, $3 - callba Function11c000 + callba StoreText call Functiona80 ld hl, wPayDayMoney ld a, [hli] @@ -2903,7 +2903,7 @@ Function3d227: ; 3d227 call ClearPalettes call DelayFrame call Function3eda6 - call Function1c17 + call WriteBackup call ClearSGB call Function32f9 call Function3f26d @@ -3100,7 +3100,7 @@ LostBattle: ; 3d38e call EmptyBattleTextBox ld c, 2 - callba Function11c000 + callba StoreText call Functiona80 call ClearTileMap call WhiteBGMap @@ -3644,7 +3644,7 @@ Function3d714: ; 3d714 Function3d74b: ; 3d74b ld a, [CurPartyMon] push af - callab Function39939 + callab Battle_GetTrainerName ld hl, BattleText_0x80aca call StdBattleTextBox lb bc, 1, 7 @@ -3695,7 +3695,7 @@ Function3d7a0: ; 3d7a0 ; 3d7b8 Function3d7b8: ; 3d7b8 - callab Function39939 + callab Battle_GetTrainerName ld hl, BattleText_0x80af8 call StdBattleTextBox jp WaitBGMap @@ -5312,7 +5312,7 @@ Function3e299: call ClearPalettes call DelayFrame call Function3eda6 - call Function1c17 + call WriteBackup call Function309d call ClearSGB call Function32f9 @@ -5395,7 +5395,7 @@ Function3e358: ; 3e358 call DelayFrame call ClearSprites call Function3eda6 - call Function1c17 + call WriteBackup call ClearSGB call Function32f9 ld a, [CurPartyMon] @@ -5411,7 +5411,7 @@ Function3e3ad: ; 3e3ad jr z, .asm_3e3c1 call Function1d6e call Function3e8e4 - call Function1c17 + call WriteBackup .asm_3e3c1 call Function3e7c1 @@ -9455,7 +9455,7 @@ BattleStartMessage: ; 3fc8b ld c, 20 call DelayFrames - callba Function39939 + callba Battle_GetTrainerName ld hl, WantsToBattleText jr .asm_3fd0e diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 7c1fa738a..30376ea98 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -9710,7 +9710,7 @@ BattleCommand67: ; 379c9 ; Return to battle scene call ClearPalettes callba Function3ed9f - call Function1c17 + call WriteBackup call ClearSprites hlcoord 1, 0 lb bc, 4, 10 @@ -9779,7 +9779,7 @@ BatonPass_LinkPlayerSwitch: ; 37a67 call Function1d6e ld hl, Function3e8e4 call CallBattleCore - call Function1c17 + call WriteBackup xor a ld [wd0ec], a @@ -9810,7 +9810,7 @@ BatonPass_LinkEnemySwitch: ; 37a82 add NUM_MOVES ld [wBattleAction], a .asm_37aa8 - jp Function1c17 + jp WriteBackup ; 37aab diff --git a/constants.asm b/constants.asm index 1876c591b..430ff4c97 100644 --- a/constants.asm +++ b/constants.asm @@ -19,6 +19,7 @@ INCLUDE "constants/engine_flags.asm" INCLUDE "constants/music_constants.asm" INCLUDE "constants/sfx_constants.asm" INCLUDE "constants/animation_constants.asm" +INCLUDE "constants/phone_constants.asm" INCLUDE "constants/gfx_constants.asm" INCLUDE "constants/pokemon_data_constants.asm" INCLUDE "constants/misc_constants.asm" diff --git a/constants/engine_flags.asm b/constants/engine_flags.asm index b0933e860..a2291e3c6 100644 --- a/constants/engine_flags.asm +++ b/constants/engine_flags.asm @@ -81,7 +81,7 @@ const ENGINE_LUCKY_NUMBER_SHOW const ENGINE_4F const ENGINE_KURT_MAKING_BALLS - const ENGINE_51 + const ENGINE_DAILY_BUG_CONTEST const ENGINE_SPECIAL_WILDDATA const ENGINE_TIME_CAPSULE const ENGINE_ALL_FRUIT_TREES diff --git a/constants/event_flags.asm b/constants/event_flags.asm index f94194abe..c158a5278 100644 --- a/constants/event_flags.asm +++ b/constants/event_flags.asm @@ -777,7 +777,7 @@ const EVENT_WAREHOUSE_LAYOUT_2 const EVENT_WAREHOUSE_LAYOUT_3 const EVENT_WAREHOUSE_BLOCKED_OFF - const EVENT_308 + const EVENT_LEFT_MONS_WITH_CONTEST_OFFICER const EVENT_309 const EVENT_WILLS_ROOM_EXIT_OPEN const EVENT_WILLS_ROOM_ENTRANCE_CLOSED @@ -788,10 +788,10 @@ const EVENT_KARENS_ROOM_EXIT_OPEN const EVENT_LANCES_ROOM_ENTRANCE_CLOSED const EVENT_312 - const EVENT_313 - const EVENT_314 - const EVENT_315 - const EVENT_316 + const EVENT_CONTEST_OFFICER_HAS_SUN_STONE + const EVENT_CONTEST_OFFICER_HAS_EVERSTONE + const EVENT_CONTEST_OFFICER_HAS_GOLD_BERRY + const EVENT_CONTEST_OFFICER_HAS_BERRY const EVENT_FOUGHT_HO_OH const EVENT_FOUGHT_LUGIA const EVENT_BEAT_RIVAL_IN_MT_MOON @@ -1848,8 +1848,8 @@ const EVENT_734 const EVENT_735 const EVENT_736 - const EVENT_737 - const EVENT_738 + const EVENT_OLIVINE_PORT_SPRITES_BEFORE_HALL_OF_FAME + const EVENT_OLIVINE_PORT_SPRITES_AFTER_HALL_OF_FAME const EVENT_739 const EVENT_73A const EVENT_73B diff --git a/constants/item_constants.asm b/constants/item_constants.asm index b891a2c3e..a14856d3c 100644 --- a/constants/item_constants.asm +++ b/constants/item_constants.asm @@ -266,6 +266,7 @@ SAFARI_BALL EQU 8 ; MOON_STONE MOON_STONE_RED EQU 10 ; BURN_HEAL FULL_HEAL_RED EQU 52 ; X_SPEED +MAIL_MAX_LENGTH EQU $20 ; pockets ITEM EQU 1 diff --git a/constants/map_constants.asm b/constants/map_constants.asm index 0067ca9ed..75b9b5e76 100644 --- a/constants/map_constants.asm +++ b/constants/map_constants.asm @@ -473,110 +473,112 @@ MAP_N_A EQU -1 ; sprites const_def - const SPRITE_NONE - const SPRITE_CHRIS - const SPRITE_CHRIS_BIKE - const SPRITE_GAMEBOY_KID - const SPRITE_SILVER - const SPRITE_OAK - const SPRITE_RED - const SPRITE_BLUE - const SPRITE_BILL - const SPRITE_ELDER - const SPRITE_JANINE - const SPRITE_KURT - const SPRITE_MOM - const SPRITE_BLAINE - const SPRITE_REDS_MOM - const SPRITE_DAISY - const SPRITE_ELM - const SPRITE_WILL - const SPRITE_FALKNER - const SPRITE_WHITNEY - const SPRITE_BUGSY - const SPRITE_MORTY - const SPRITE_CHUCK - const SPRITE_JASMINE - const SPRITE_PRYCE - const SPRITE_CLAIR - const SPRITE_BROCK - const SPRITE_KAREN - const SPRITE_BRUNO - const SPRITE_MISTY - const SPRITE_LANCE - const SPRITE_SURGE - const SPRITE_ERIKA - const SPRITE_KOGA - const SPRITE_SABRINA - const SPRITE_COOLTRAINER_M - const SPRITE_COOLTRAINER_F - const SPRITE_BUG_CATCHER - const SPRITE_TWIN - const SPRITE_YOUNGSTER - const SPRITE_LASS - const SPRITE_TEACHER - const SPRITE_BUENA - const SPRITE_SUPER_NERD - const SPRITE_ROCKER - const SPRITE_POKEFAN_M - const SPRITE_POKEFAN_F - const SPRITE_GRAMPS - const SPRITE_GRANNY - const SPRITE_SWIMMER_GUY - const SPRITE_SWIMMER_GIRL - const SPRITE_BIG_SNORLAX - const SPRITE_SURFING_PIKACHU - const SPRITE_ROCKET - const SPRITE_ROCKET_GIRL - const SPRITE_NURSE - const SPRITE_LINK_RECEPTIONIST - const SPRITE_CLERK - const SPRITE_FISHER - const SPRITE_FISHING_GURU - const SPRITE_SCIENTIST - const SPRITE_KIMONO_GIRL - const SPRITE_SAGE - const SPRITE_UNUSED_GUY - const SPRITE_GENTLEMAN - const SPRITE_BLACK_BELT - const SPRITE_RECEPTIONIST - const SPRITE_OFFICER - const SPRITE_CAL - const SPRITE_SLOWPOKE - const SPRITE_CAPTAIN - const SPRITE_BIG_LAPRAS - const SPRITE_GYM_GUY - const SPRITE_SAILOR - const SPRITE_BIKER - const SPRITE_PHARMACIST - const SPRITE_MONSTER - const SPRITE_FAIRY - const SPRITE_BIRD - const SPRITE_DRAGON - const SPRITE_BIG_ONIX - const SPRITE_N64 - const SPRITE_SUDOWOODO - const SPRITE_SURF - const SPRITE_POKE_BALL - const SPRITE_POKEDEX - const SPRITE_PAPER - const SPRITE_VIRTUAL_BOY - const SPRITE_OLD_LINK_RECEPTIONIST - const SPRITE_ROCK - const SPRITE_BOULDER - const SPRITE_SNES - const SPRITE_FAMICOM - const SPRITE_FRUIT_TREE - const SPRITE_GOLD_TROPHY - const SPRITE_SILVER_TROPHY - const SPRITE_KRIS - const SPRITE_KRIS_BIKE - const SPRITE_KURT_OUTSIDE - const SPRITE_SUICUNE - const SPRITE_ENTEI - const SPRITE_RAIKOU - const SPRITE_STANDING_YOUNGSTER + const SPRITE_NONE ; 00 + const SPRITE_CHRIS ; 01 + const SPRITE_CHRIS_BIKE ; 02 + const SPRITE_GAMEBOY_KID ; 03 + const SPRITE_SILVER ; 04 + const SPRITE_OAK ; 05 + const SPRITE_RED ; 06 + const SPRITE_BLUE ; 07 + const SPRITE_BILL ; 08 + const SPRITE_ELDER ; 09 + const SPRITE_JANINE ; 0a + const SPRITE_KURT ; 0b + const SPRITE_MOM ; 0c + const SPRITE_BLAINE ; 0d + const SPRITE_REDS_MOM ; 0e + const SPRITE_DAISY ; 0f + const SPRITE_ELM ; 10 + const SPRITE_WILL ; 11 + const SPRITE_FALKNER ; 12 + const SPRITE_WHITNEY ; 13 + const SPRITE_BUGSY ; 14 + const SPRITE_MORTY ; 15 + const SPRITE_CHUCK ; 16 + const SPRITE_JASMINE ; 17 + const SPRITE_PRYCE ; 18 + const SPRITE_CLAIR ; 19 + const SPRITE_BROCK ; 1a + const SPRITE_KAREN ; 1b + const SPRITE_BRUNO ; 1c + const SPRITE_MISTY ; 1d + const SPRITE_LANCE ; 1e + const SPRITE_SURGE ; 1f + const SPRITE_ERIKA ; 20 + const SPRITE_KOGA ; 21 + const SPRITE_SABRINA ; 22 + const SPRITE_COOLTRAINER_M ; 23 + const SPRITE_COOLTRAINER_F ; 24 + const SPRITE_BUG_CATCHER ; 25 + const SPRITE_TWIN ; 26 + const SPRITE_YOUNGSTER ; 27 + const SPRITE_LASS ; 28 + const SPRITE_TEACHER ; 29 + const SPRITE_BUENA ; 2a + const SPRITE_SUPER_NERD ; 2b + const SPRITE_ROCKER ; 2c + const SPRITE_POKEFAN_M ; 2d + const SPRITE_POKEFAN_F ; 2e + const SPRITE_GRAMPS ; 2f + const SPRITE_GRANNY ; 30 + const SPRITE_SWIMMER_GUY ; 31 + const SPRITE_SWIMMER_GIRL ; 32 + const SPRITE_BIG_SNORLAX ; 33 + const SPRITE_SURFING_PIKACHU ; 34 + const SPRITE_ROCKET ; 35 + const SPRITE_ROCKET_GIRL ; 36 + const SPRITE_NURSE ; 37 + const SPRITE_LINK_RECEPTIONIST ; 38 + const SPRITE_CLERK ; 39 + const SPRITE_FISHER ; 3a + const SPRITE_FISHING_GURU ; 3b + const SPRITE_SCIENTIST ; 3c + const SPRITE_KIMONO_GIRL ; 3d + const SPRITE_SAGE ; 3e + const SPRITE_UNUSED_GUY ; 3f + const SPRITE_GENTLEMAN ; 40 + const SPRITE_BLACK_BELT ; 41 + const SPRITE_RECEPTIONIST ; 42 + const SPRITE_OFFICER ; 43 + const SPRITE_CAL ; 44 + const SPRITE_SLOWPOKE ; 45 + const SPRITE_CAPTAIN ; 46 + const SPRITE_BIG_LAPRAS ; 47 + const SPRITE_GYM_GUY ; 48 + const SPRITE_SAILOR ; 49 + const SPRITE_BIKER ; 4a + const SPRITE_PHARMACIST ; 4b + const SPRITE_MONSTER ; 4c + const SPRITE_FAIRY ; 4d + const SPRITE_BIRD ; 4e + const SPRITE_DRAGON ; 4f + const SPRITE_BIG_ONIX ; 50 + const SPRITE_N64 ; 51 + const SPRITE_SUDOWOODO ; 52 + const SPRITE_SURF ; 53 + const SPRITE_POKE_BALL ; 54 + const SPRITE_POKEDEX ; 55 + const SPRITE_PAPER ; 56 + const SPRITE_VIRTUAL_BOY ; 57 + const SPRITE_OLD_LINK_RECEPTIONIST ; 58 + const SPRITE_ROCK ; 59 + const SPRITE_BOULDER ; 5a + const SPRITE_SNES ; 5b + const SPRITE_FAMICOM ; 5c + const SPRITE_FRUIT_TREE ; 5d + const SPRITE_GOLD_TROPHY ; 5e + const SPRITE_SILVER_TROPHY ; 5f + const SPRITE_KRIS ; 60 + const SPRITE_KRIS_BIKE ; 61 + const SPRITE_KURT_OUTSIDE ; 62 + const SPRITE_SUICUNE ; 63 + const SPRITE_ENTEI ; 64 + const SPRITE_RAIKOU ; 65 + const SPRITE_STANDING_YOUNGSTER ; 66 + const_value SET $80 + SPRITE_POKEMON EQU const_value const SPRITE_UNOWN const SPRITE_GEODUDE @@ -663,20 +665,20 @@ const_value SET 1 ; object struct const_def - const OBJECT_00 - const OBJECT_01 const OBJECT_SPRITE + const OBJECT_MAP_OBJECT_INDEX + const OBJECT_SPRITE_TILE const OBJECT_03 const OBJECT_04 const OBJECT_FLAGS const OBJECT_PALETTE - const OBJECT_07 - const OBJECT_08 + const OBJECT_DIRECTION_WALKING + const OBJECT_FACING const OBJECT_09 const OBJECT_STEP_DURATION const OBJECT_11 const OBJECT_12 - const OBJECT_FACING + const OBJECT_FACING_STEP const OBJECT_STANDING_TILE const OBJECT_NEXT_TILE const OBJECT_MAP_X @@ -697,3 +699,43 @@ const_value SET 1 const OBJECT_31 const OBJECT_32 ; 33-39 are not used + + + const_def + const MAPOBJECT_VRAM_ID ; 0 + const MAPOBJECT_SPRITE ; 1 + const MAPOBJECT_Y_COORD ; 2 + const MAPOBJECT_X_COORD ; 3 + const MAPOBJECT_FACING ; 4 + const MAPOBJECT_MOVEMENT ; 5 + const MAPOBJECT_HOUR ; 6 + const MAPOBJECT_TIMEOFDAY ; 7 + const MAPOBJECT_COLOR ; 8 + const MAPOBJECT_RANGE ; 9 + const MAPOBJECT_POINTER_LO ; a + const MAPOBJECT_POINTER_HI ; b + const MAPOBJECT_FLAG_LO ; c + const MAPOBJECT_FLAG_HI ; d + const MAPOBJECT_E + const MAPOBJECT_F + +MAPOBJECT_NOT_VISIBLE EQU -1 +MAPOBJECT_SCREEN_HEIGHT EQU 11 +MAPOBJECT_SCREEN_WIDTH EQU 12 +OBJECT_STRUCT_3_DATA_WIDTH EQU 6 +OBJECT_STRUCT_3_DATA_HEIGHT EQU 37 + + + const_def + const EMOTE_SHOCK ; 0 + const EMOTE_QUESTION ; 1 + const EMOTE_HAPPY ; 2 + const EMOTE_SAD ; 3 + const EMOTE_HEART ; 4 + const EMOTE_BOLT ; 5 + const EMOTE_SLEEP ; 6 + const EMOTE_FISH ; 7 + const EMOTE_ROD_DOWN ; 8 + const EMOTE_ROD_UP ; 9 + const EMOTE_ROD_LEFT ; a + const EMOTE_ROD_RIGHT ; b diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index 31f2ad561..6b69713e1 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -96,3 +96,4 @@ ALWAYS_USE EQU 1 << ALWAYS_USE_F SWITCH_SOMETIMES EQU 1 << SWITCH_SOMETIMES_F SWITCH_RARELY EQU 1 << SWITCH_RARELY_F SWITCH_OFTEN EQU 1 << SWITCH_OFTEN_F +SPRITE_GFX_LIST_CAPACITY EQU $20 diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm index baed9fc56..e5430b431 100644 --- a/constants/wram_constants.asm +++ b/constants/wram_constants.asm @@ -68,3 +68,8 @@ PLAYER_BIKE EQU 1 PLAYER_SLIP EQU 2 PLAYER_SURF EQU 4 PLAYER_SURF_PIKA EQU 8 + +OBJECT_STRUCT_LENGTH EQU 40 +NUM_OBJECT_STRUCTS EQU 13 + +PARTYMON_STRUCT_LENGTH EQU 48 diff --git a/engine/buena_phone_scripts.asm b/engine/buena_phone_scripts.asm index 4d0c79b61..0a278ca03 100644 --- a/engine/buena_phone_scripts.asm +++ b/engine/buena_phone_scripts.asm @@ -2,7 +2,7 @@ UnknownScript_0xa0b14: checkflag ENGINE_ROCKETS_IN_RADIO_TOWER iftrue UnknownScript_0xa0b73 checkcode VAR_HOUR - if_greater_than $11, UnknownScript_0xa0b4b + if_greater_than 17, UnknownScript_0xa0b4b scall UnknownScript_0xa0b32 jump UnknownScript_0xa0c0e @@ -37,7 +37,7 @@ UnknownScript_0xa0b4b: UnknownScript_0xa0b4f: checkcode VAR_HOUR - if_greater_than $11, UnknownScript_0xa0b6e + if_greater_than 17, UnknownScript_0xa0b6e checkmorn iftrue UnknownScript_0xa0b64 checkday @@ -68,27 +68,27 @@ UnknownScript_0xa0b73: UnknownScript_0xa0b77: checkevent EVENT_BEAT_ELITE_FOUR iftrue UnknownScript_0xa0b82 - random $b + random 11 jump UnknownScript_0xa0b84 UnknownScript_0xa0b82: - random $e + random 14 UnknownScript_0xa0b84: - if_equal $0, UnknownScript_0xa0bbc - if_equal $1, UnknownScript_0xa0bc2 - if_equal $2, UnknownScript_0xa0bc8 - if_equal $3, UnknownScript_0xa0bce - if_equal $4, UnknownScript_0xa0bd4 - if_equal $5, UnknownScript_0xa0bda - if_equal $6, UnknownScript_0xa0be0 - if_equal $7, UnknownScript_0xa0be6 - if_equal $8, UnknownScript_0xa0bec - if_equal $9, UnknownScript_0xa0bf2 - if_equal $a, UnknownScript_0xa0bf8 - if_equal $b, UnknownScript_0xa0bfe - if_equal $c, UnknownScript_0xa0c04 - if_equal $d, UnknownScript_0xa0c0a + if_equal 0, UnknownScript_0xa0bbc + if_equal 1, UnknownScript_0xa0bc2 + if_equal 2, UnknownScript_0xa0bc8 + if_equal 3, UnknownScript_0xa0bce + if_equal 4, UnknownScript_0xa0bd4 + if_equal 5, UnknownScript_0xa0bda + if_equal 6, UnknownScript_0xa0be0 + if_equal 7, UnknownScript_0xa0be6 + if_equal 8, UnknownScript_0xa0bec + if_equal 9, UnknownScript_0xa0bf2 + if_equal 10, UnknownScript_0xa0bf8 + if_equal 11, UnknownScript_0xa0bfe + if_equal 12, UnknownScript_0xa0c04 + if_equal 13, UnknownScript_0xa0c0a UnknownScript_0xa0bbc: writetext UnknownText_0xa0efb @@ -149,10 +149,10 @@ UnknownScript_0xa0c0d: end UnknownScript_0xa0c0e: - random $3 - if_equal $0, UnknownScript_0xa0c1c - if_equal $1, UnknownScript_0xa0c20 - if_equal $2, UnknownScript_0xa0c24 + random 3 + if_equal 0, UnknownScript_0xa0c1c + if_equal 1, UnknownScript_0xa0c20 + if_equal 2, UnknownScript_0xa0c24 UnknownScript_0xa0c1c: writetext UnknownText_0xa1c88 diff --git a/engine/color.asm b/engine/color.asm index 314bf2981..e922b8849 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -806,8 +806,7 @@ Function9764: ; 9764 Function976b: ; 976b ld l, a ld h, 0 - add hl, hl - add hl, hl + add_n_times hl, hl, 2 ld bc, TrainerPalettes add hl, bc ret @@ -1975,9 +1974,7 @@ Functionb1de: ; b1de push hl ld l, a ld h, 0 - add hl, hl - add hl, hl - add hl, hl + add_n_times hl, hl, 3 ld de, TilesetBGPalette add hl, de ld e, l @@ -2017,9 +2014,7 @@ Functionb1de: ; b1de ld a, [MapGroup] ld l, a ld h, 0 - add hl, hl - add hl, hl - add hl, hl + add_n_times hl, hl, 3 ld de, RoofPals add hl, de ld a, [TimeOfDayPal] diff --git a/engine/events.asm b/engine/events.asm index cf2d4f3e4..b37f53d39 100644 --- a/engine/events.asm +++ b/engine/events.asm @@ -24,91 +24,91 @@ OverworldLoop:: ; 966b0 ; 966cb -Function966cb: ; 966cb +ClearAllScriptFlags3: ; 966cb xor a ld [ScriptFlags3], a ret ; 966d0 -Function966d0:: ; 966d0 +SetAll_ScriptFlags3:: ; 966d0 ld a, $ff ld [ScriptFlags3], a ret ; 966d6 -Function966d6: ; 966d6 +CheckBit5_ScriptFlags3: ; 966d6 ld hl, ScriptFlags3 bit 5, [hl] ret ; 966dc -Function966dc: ; 966dc +ResetBit2_ScriptFlags3: ; 966dc ld hl, ScriptFlags3 res 2, [hl] ret ; 966e2 -Function966e2: ; 966e2 +ResetBit1_ScriptFlags3: ; 966e2 ld hl, ScriptFlags3 res 1, [hl] ret ; 966e8 -Function966e8: ; 966e8 +ResetBit0_ScriptFlags3: ; 966e8 ld hl, ScriptFlags3 res 0, [hl] ret ; 966ee -Function966ee: ; 966ee +ResetBit4_ScriptFlags3: ; 966ee ld hl, ScriptFlags3 res 4, [hl] ret ; 966f4 -Function966f4: ; 966f4 +SetBit2_ScriptFlags3: ; 966f4 ld hl, ScriptFlags3 set 2, [hl] ret ; 966fa -Function966fa: ; 966fa +SetBit1_ScriptFlags3: ; 966fa ld hl, ScriptFlags3 set 1, [hl] ret ; 96700 -Function96700: ; 96700 +SetBit0_ScriptFlags3: ; 96700 ld hl, ScriptFlags3 set 0, [hl] ret ; 96706 -Function96706: ; 96706 +SetBit4_ScriptFlags3: ; 96706 ld hl, ScriptFlags3 set 4, [hl] ret ; 9670c -Function9670c: ; 9670c +CheckBit2_ScriptFlags3: ; 9670c ld hl, ScriptFlags3 bit 2, [hl] ret ; 96712 -Function96712: ; 96712 +CheckBit1_ScriptFlags3: ; 96712 ld hl, ScriptFlags3 bit 1, [hl] ret ; 96718 -Function96718: ; 96718 +CheckBit0_ScriptFlags3: ; 96718 ld hl, ScriptFlags3 bit 0, [hl] ret ; 9671e -Function9671e: ; 9671e +CheckBit4_ScriptFlags3: ; 9671e ld hl, ScriptFlags3 bit 4, [hl] ret @@ -135,20 +135,20 @@ EnterMap: ; 9673e ld [wd454], a call Function968d1 callba RunMapSetupScript - call Function966cb + call ClearAllScriptFlags3 ld a, [$ff9f] cp $f7 - jr nz, .asm_9675a - call Function966d0 -.asm_9675a + jr nz, .dontset + call SetAll_ScriptFlags3 +.dontset ld a, [$ff9f] cp $f3 - jr nz, .asm_96764 + jr nz, .dontresetpoison xor a ld [PoisonStepCount], a -.asm_96764 +.dontresetpoison xor a ld [$ff9f], a @@ -197,7 +197,7 @@ MapEvents: ; 96795 .events ; 967a1 call PlayerEvents - call Function966cb + call ClearAllScriptFlags3 callba ScriptEvents ret ; 967ae @@ -254,19 +254,19 @@ Function967e1: ; 967e1 Function967f4: ; 967f4 ld a, [wd150] bit 5, a - jr z, .asm_96806 + jr z, .events bit 6, a - jr z, .asm_9680c + jr z, .noevents bit 4, a - jr nz, .asm_9680c - call Function966d0 + jr nz, .noevents + call SetAll_ScriptFlags3 -.asm_96806 +.events ld a, 0 ; events ld [MapEventStatus], a ret -.asm_9680c +.noevents ld a, 1 ; no events ld [MapEventStatus], a ret @@ -293,44 +293,44 @@ PlayerEvents: ; 9681f call Function968e4 call CheckTrainerBattle3 - jr c, .asm_96848 + jr c, .ok call CheckTileEvent - jr c, .asm_96848 + jr c, .ok call Function97c30 - jr c, .asm_96848 + jr c, .ok call Function968ec - jr c, .asm_96848 + jr c, .ok call Function9693a - jr c, .asm_96848 + jr c, .ok call OWPlayerInput - jr c, .asm_96848 + jr c, .ok xor a ret -.asm_96848 +.ok push af - callba Function96c56 + callba EnableScriptMode pop af ld [ScriptRunning], a call Function96beb ld a, [ScriptRunning] cp 4 - jr z, .asm_96865 + jr z, .ok2 cp 9 - jr z, .asm_96865 + jr z, .ok2 xor a ld [wc2da], a -.asm_96865 +.ok2 scf ret ; 96867 @@ -340,13 +340,13 @@ CheckTrainerBattle3: ; 96867 nop nop call CheckTrainerBattle2 - jr nc, .asm_96872 + jr nc, .nope ld a, 1 scf ret -.asm_96872 +.nope xor a ret ; 96874 @@ -355,47 +355,47 @@ CheckTrainerBattle3: ; 96867 CheckTileEvent: ; 96874 ; Check for warps, tile triggers or wild battles. - call Function9670c - jr z, .asm_96886 + call CheckBit2_ScriptFlags3 + jr z, .bit2 callba Function104820 - jr c, .asm_968a6 + jr c, .return4 call Function2238 - jr c, .asm_968aa + jr c, .return6 -.asm_96886 - call Function96712 - jr z, .asm_96890 +.bit2 + call CheckBit1_ScriptFlags3 + jr z, .bit1 call Function2ad4 - jr c, .asm_968ba + jr c, .movement -.asm_96890 - call Function96718 - jr z, .asm_96899 +.bit1 + call CheckBit0_ScriptFlags3 + jr z, .bit0 call CountStep ret c -.asm_96899 - call Function9671e - jr z, .asm_968a4 +.bit0 + call CheckBit4_ScriptFlags3 + jr z, .ok call Function97cc0 ret c - jr .asm_968a4 + jr .ok -.asm_968a4 +.ok xor a ret -.asm_968a6 +.return4 ld a, 4 scf ret -.asm_968aa +.return6 ld a, [StandingTile] call CheckPitTile jr nz, .asm_968b6 @@ -408,7 +408,7 @@ CheckTileEvent: ; 96874 scf ret -.asm_968ba +.movement ld hl, MovementAnimation ld a, [hli] ld h, [hl] @@ -450,7 +450,7 @@ Function968d8: ; 968d8 ; 968e4 Function968e4: ; 968e4 - call Function966d6 + call CheckBit5_ScriptFlags3 ret z call Function2f3e ret @@ -459,12 +459,12 @@ Function968e4: ; 968e4 Function968ec: ; 968ec ld a, [wdc07] and a - jr z, .asm_96938 + jr z, .nope ld c, a - call Function211b + call CheckTriggers cp c - jr nc, .asm_96938 + jr nc, .nope ld e, a ld d, 0 @@ -472,11 +472,8 @@ Function968ec: ; 968ec ld a, [hli] ld h, [hl] ld l, a - add hl, de - add hl, de - add hl, de - add hl, de - + add_n_times hl, de, 4 + call GetMapScriptHeaderBank call GetFarHalfword call GetMapScriptHeaderBank @@ -485,12 +482,12 @@ Function968ec: ; 968ec ld hl, ScriptFlags res 3, [hl] - callba Function96c56 + callba EnableScriptMode callba ScriptEvents ld hl, ScriptFlags bit 3, [hl] - jr z, .asm_96938 + jr z, .nope ld hl, ScriptDelay + 2 ld a, [hli] @@ -501,7 +498,7 @@ Function968ec: ; 968ec scf ret -.asm_96938 +.nope xor a ret ; 9693a @@ -608,25 +605,25 @@ TryObjectEvent: ; 969b5 .IsObject call PlayTalkObject ld a, [hConnectedMapWidth] - call Function1ae5 - ld hl, $0001 + call GetObjectStruct + ld hl, OBJECT_MAP_OBJECT_INDEX add hl, bc ld a, [hl] ld [$ffe0], a ld a, [$ffe0] call GetMapObject - ld hl, $0008 + ld hl, MAPOBJECT_COLOR add hl, bc ld a, [hl] - and $f + and %00001111 ; Bug: If IsInArray returns nc, data at bc will be executed as code. push bc ld de, 3 - ld hl, .data_969ee + ld hl, .pointers call IsInArray - jr nc, .asm_969ec + jr nc, .nope_bugged pop bc inc hl @@ -635,11 +632,11 @@ TryObjectEvent: ; 969b5 ld l, a jp [hl] -.asm_969ec +.nope_bugged xor a ret -.data_969ee +.pointers dbw 0, .zero dbw 1, .one dbw 2, .two @@ -647,11 +644,11 @@ TryObjectEvent: ; 969b5 dbw 4, .four dbw 5, .five dbw 6, .six - db $ff + db -1 ; 96a04 .zero ; 96a04 - ld hl, $000a + ld hl, MAPOBJECT_POINTER_LO add hl, bc ld a, [hli] ld h, [hl] @@ -663,7 +660,7 @@ TryObjectEvent: ; 969b5 ; 96a12 .one ; 96a12 - ld hl, $000a + ld hl, MAPOBJECT_POINTER_LO add hl, bc ld a, [hli] ld h, [hl] @@ -712,7 +709,7 @@ TryReadSign: ; 96a38 ret .IsSign - ld a, [MartPointer] + ld a, [wd040] ld hl, .signs rst JumpTable ret @@ -726,7 +723,7 @@ TryReadSign: ; 96a38 dw .ifset dw .ifnotset dw .itemifset - dw .asm_96aa2 + dw .copy ; 96a59 .up @@ -773,7 +770,7 @@ TryReadSign: ; 96a38 scf ret -.asm_96aa2 +.copy call CheckSignFlag jr nz, .dontread call GetMapScriptHeaderBank @@ -785,13 +782,13 @@ TryReadSign: ; 96a38 .ifset call CheckSignFlag jr z, .dontread - jr .asm_96ac1 + jr .thenread .ifnotset call CheckSignFlag jr nz, .dontread -.asm_96ac1 +.thenread push hl call PlayTalkObject pop hl @@ -878,8 +875,8 @@ PlayerMovement: ; 96af0 .three ; 96b20 ; force the player to move in some direction - ld a, BANK(UnknownScript_0x1253d) - ld hl, UnknownScript_0x1253d + ld a, BANK(Script_ForcedMovement) + ld hl, Script_ForcedMovement call CallScript ; ld a, -1 ld c, a @@ -941,8 +938,8 @@ SelectMenuScript: ; 96b5f StartMenuCallback: SelectMenuCallback: ; 96b66 copybytetovar $ffa0 - if_equal $80, .Script - if_equal $ff, .Asm + if_equal %10000000, .Script + if_equal -1, .Asm end ; 96b72 @@ -959,13 +956,13 @@ SelectMenuCallback: ; 96b66 CountStep: ; 96b79 ld a, [InLinkBattle] and a - jr nz, .asm_96bc9 + jr nz, .done callba Function90136 - jr c, .asm_96bcb + jr c, .setminus1 call Function96bd7 - jr c, .asm_96bcb + jr c, .setminus1 ld hl, PoisonStepCount inc [hl] @@ -981,7 +978,7 @@ CountStep: ; 96b79 jr nz, .asm_96bab callba Function16f3e - jr nz, .asm_96bcf + jr nz, .set8 .asm_96bab callba DaycareStep @@ -989,25 +986,25 @@ CountStep: ; 96b79 ld hl, PoisonStepCount ld a, [hl] cp 4 - jr c, .asm_96bc3 + jr c, .poisoned ld [hl], 0 callba Function505da - jr c, .asm_96bcb + jr c, .setminus1 -.asm_96bc3 +.poisoned callba Function97db3 -.asm_96bc9 +.done xor a ret -.asm_96bcb +.setminus1 ld a, -1 scf ret -.asm_96bcf +.set8 ld a, 8 scf ret @@ -1015,7 +1012,7 @@ CountStep: ; 96b79 Function96bd3: ; 96bd3 - ld a, $7 + ld a, 7 scf ret ; 96bd7 @@ -1038,17 +1035,15 @@ Function96beb: ; 96beb ld a, [ScriptRunning] and a ret z - cp $ff + cp -1 ret z - cp $a + cp 10 ret nc ld c, a ld b, 0 ld hl, ScriptPointers96c0c - add hl, bc - add hl, bc - add hl, bc + add_n_times hl, bc, 3 ld a, [hli] ld [ScriptBank], a ld a, [hli] @@ -1059,20 +1054,20 @@ Function96beb: ; 96beb ; 96c0c ScriptPointers96c0c: ; 96c0c - dbw BANK(UnknownScript_0x96c2d), UnknownScript_0x96c2d - dbw BANK(UnknownScript_0xbe675), UnknownScript_0xbe675 - dbw BANK(UnknownScript_0xbe66a), UnknownScript_0xbe66a - dbw BANK(UnknownScript_0x122ce), UnknownScript_0x122ce + dbw BANK(Invalid_0x96c2d), Invalid_0x96c2d + dbw BANK(SeenByTrainerScript), SeenByTrainerScript + dbw BANK(TalkToTrainerScript), TalkToTrainerScript + dbw BANK(FindItemInBallScript), FindItemInBallScript dbw BANK(UnknownScript_0x96c4d), UnknownScript_0x96c4d - dbw BANK(UnknownScript_0x96c34), UnknownScript_0x96c34 + dbw BANK(WarpToNewMapScript), WarpToNewMapScript dbw BANK(FallIntoMapScript), FallIntoMapScript dbw BANK(UnknownScript_0x124c8), UnknownScript_0x124c8 - dbw BANK(UnknownScript_0x96c2f), UnknownScript_0x96c2f + dbw BANK(HatchEggScript), HatchEggScript dbw BANK(UnknownScript_0x96c4f), UnknownScript_0x96c4f - dbw BANK(UnknownScript_0x96c2d), UnknownScript_0x96c2d + dbw BANK(Invalid_0x96c2d), Invalid_0x96c2d ; 96c2d -UnknownScript_0x96c2d: ; 96c2d +Invalid_0x96c2d: ; 96c2d end ; 96c2e @@ -1080,12 +1075,12 @@ UnknownScript_0x96c2e: ; 96c2e end ; 96c2f -UnknownScript_0x96c2f: ; 96c2f - callasm Function16f5e +HatchEggScript: ; 96c2f + callasm OverworldHatchEgg end ; 96c34 -UnknownScript_0x96c34: ; 96c34 +WarpToNewMapScript: ; 96c34 warpsound newloadmap $f5 end @@ -1116,7 +1111,7 @@ UnknownScript_0x96c4d: ; 96c4d UnknownScript_0x96c4f: ; 96c4f deactivatefacing $3 - callasm Function96706 + callasm SetBit4_ScriptFlags3 end ; 96c56 diff --git a/engine/events_2.asm b/engine/events_2.asm index 433c7caea..506075c52 100644 --- a/engine/events_2.asm +++ b/engine/events_2.asm @@ -125,8 +125,8 @@ Function97cc0:: ; 97cc0 jr .asm_97cf4 .asm_97ced - ld a, BANK(UnknownScript_0x135eb) - ld hl, UnknownScript_0x135eb + ld a, BANK(BugCatchingContestBattleScript) + ld hl, BugCatchingContestBattleScript jr .asm_97cf4 .asm_97cf4 diff --git a/engine/map_objects.asm b/engine/map_objects.asm index d7c1b6581..c44d40df7 100644 --- a/engine/map_objects.asm +++ b/engine/map_objects.asm @@ -1,7 +1,7 @@ INCLUDE "engine/facings.asm" -Data4273:: ; 4273 +ObjectStruct3_Data:: ; 4273 db $00, $00, $01, $02, $00, $00 db $06, $00, $01, $0c, $00, $00 db $03, $00, $01, $00, $00, $00 @@ -45,26 +45,26 @@ Data4273:: ; 4273 Function4357:: ; 4357 push bc - ld hl, OBJECT_01 + ld hl, OBJECT_MAP_OBJECT_INDEX add hl, bc ld a, [hl] push af ld h, b ld l, c - ld bc, ObjectStruct2 - ObjectStruct1 + ld bc, OBJECT_STRUCT_LENGTH xor a call ByteFill pop af - cp $ff - jr z, .asm_4379 + cp -1 + jr z, .ok bit 7, a - jr nz, .asm_4379 + jr nz, .ok call GetMapObject - ld hl, OBJECT_00 + ld hl, OBJECT_SPRITE add hl, bc - ld [hl], $ff + ld [hl], -1 -.asm_4379 +.ok pop bc ret ; 437b @@ -86,24 +86,24 @@ Function4386: ; 4386 ld hl, OBJECT_MAP_X add hl, bc ld a, [hl] - add $1 + add 1 sub e - jr c, .asm_43b2 - cp $c - jr nc, .asm_43b2 + jr c, .ok + cp MAPOBJECT_SCREEN_WIDTH + jr nc, .ok ld a, [YCoord] ld e, a ld hl, OBJECT_MAP_Y add hl, bc ld a, [hl] - add $1 + add 1 sub e - jr c, .asm_43b2 - cp $b - jr nc, .asm_43b2 - jr .asm_43dc + jr c, .ok + cp MAPOBJECT_SCREEN_HEIGHT + jr nc, .ok + jr .yes -.asm_43b2 +.ok ld hl, OBJECT_FLAGS add hl, bc set 6, [hl] @@ -112,36 +112,36 @@ Function4386: ; 4386 ld hl, OBJECT_20 add hl, bc ld a, [hl] - add $1 + add 1 sub e - jr c, .asm_43de - cp $c - jr nc, .asm_43de + jr c, .ok2 + cp MAPOBJECT_SCREEN_WIDTH + jr nc, .ok2 ld a, [YCoord] ld e, a ld hl, OBJECT_21 add hl, bc ld a, [hl] - add $1 + add 1 sub e - jr c, .asm_43de - cp $b - jr nc, .asm_43de + jr c, .ok2 + cp MAPOBJECT_SCREEN_HEIGHT + jr nc, .ok2 -.asm_43dc +.yes and a ret -.asm_43de +.ok2 ld hl, OBJECT_04 add hl, bc bit 1, [hl] - jr nz, .asm_43eb + jr nz, .yes2 call Function4357 scf ret -.asm_43eb +.yes2 ld hl, OBJECT_FLAGS add hl, bc set 6, [hl] @@ -154,38 +154,38 @@ Function43f3: ; 43f3 add hl, bc ld a, [hl] and a - jr z, .asm_4409 + jr z, .zero ld hl, OBJECT_FLAGS add hl, bc bit 5, [hl] - jr nz, .asm_4426 - cp $1 - jr z, .asm_4414 - jr .asm_4421 + jr nz, .not_bit5 + cp 1 + jr z, .one + jr .ok -.asm_4409 +.zero call Function47bc ld hl, OBJECT_FLAGS add hl, bc bit 5, [hl] - jr nz, .asm_4426 + jr nz, .not_bit5 -.asm_4414 +.one call Function47dd ld hl, OBJECT_09 add hl, bc ld a, [hl] and a ret z - cp $1 + cp 1 ret z -.asm_4421 +.ok ld hl, Pointers4b45 rst JumpTable ret -.asm_4426 +.not_bit5 ret ; 4427 @@ -226,8 +226,7 @@ Function444d: ; 444d ld a, [hl] ld l, a ld h, 0 - add hl, hl - add hl, hl + add_n_times hl, hl, 2 add hl, de ld a, [hli] ld h, [hl] @@ -274,26 +273,26 @@ Pointers445f: ; 445f ; 44a3 Function44a3: ; 44a3 - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, bc - ld [hl], $ff + ld [hl], -1 ret ; 44aa Function44aa: ; 44aa call GetSpriteDirection - or $0 - ld hl, OBJECT_FACING + or 0 + ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], a ret ; 44b5 Function44b5: ; 44b5 - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, bc ld a, [hl] - and $1 + and 1 jr nz, Function44c1 jp Function44aa ; 44c1 @@ -307,16 +306,16 @@ Function44c1: ; 44c1 add hl, bc ld a, [hl] inc a - and $f + and %00001111 ld [hl], a rrca rrca - and $3 + and %00000011 ld d, a call GetSpriteDirection - or $0 + or 0 or d - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], a ret @@ -330,17 +329,17 @@ Function44e4: ; 44e4 ld hl, OBJECT_12 add hl, bc ld a, [hl] - add $2 - and $f + add 2 + and %00001111 ld [hl], a rrca rrca - and $3 + and %00000011 ld d, a call GetSpriteDirection - or $0 + or 0 or d - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], a ret @@ -358,12 +357,12 @@ Function4508: ; 4508 rrca rrca rrca - and $3 + and %00000011 ld d, a call GetSpriteDirection - or $0 + or 0 or d - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], a ret @@ -371,11 +370,11 @@ Function4508: ; 4508 Function4529: ; 4529 call Function453f - ld hl, OBJECT_08 + ld hl, OBJECT_FACING add hl, bc ld a, [hl] - or $0 - ld hl, OBJECT_FACING + or 0 + ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], a ret @@ -390,21 +389,21 @@ Function453f: ; 453f ld hl, OBJECT_12 add hl, bc ld a, [hl] - and $f0 + and %11110000 ld e, a ld a, [hl] inc a - and $f + and %00001111 ld d, a - cp $4 - jr c, .asm_4558 + cp 4 + jr c, .ok ld d, 0 ld a, e add $10 - and $30 + and %00110000 ld e, a -.asm_4558 +.ok ld a, d or e ld [hl], a @@ -413,14 +412,14 @@ Function453f: ; 453f ld hl, .Directions add hl, de ld a, [hl] - ld hl, OBJECT_08 + ld hl, OBJECT_FACING add hl, bc ld [hl], a ret ; 456a .Directions ; 456a - db $00, $0c, $04, $08 + db DOWN << 2, RIGHT << 2, UP << 2, LEFT << 2 ; 456e Function456e: ; 456e @@ -428,28 +427,28 @@ Function456e: ; 456e rrca rrca add $10 - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], a ret ; 457b Function457b: ; 457b - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], $15 ret ; 4582 Function4582: ; 4582 - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], $14 ret ; 4589 Function4589: ; 4589 - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], $17 ret @@ -460,20 +459,20 @@ Function4590: ; 4590 add hl, bc ld a, [hl] inc a - and $f + and %00001111 ld [hl], a - and $8 + and %00001000 jr z, Function45a4 - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], $4 ret ; 45a4 Function45a4: ; 45a4 - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, bc - ld [hl], $0 + ld [hl], 0 ret ; 45ab @@ -483,34 +482,34 @@ Function45ab: ; 45ab ld a, [hl] inc a ld [hl], a - and $c + and %00001100 rrca rrca add $18 - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], a ret ; 45be Function45be: ; 45be - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], $16 ret ; 45c5 Function45c5: ; 45c5 - ld a, [VariableSprites + 3] + ld a, [VariableSprites + SPRITE_BIG_DOLL - SPRITE_VARS] ld d, $17 - cp $33 - jr z, .asm_45d4 - cp $47 - jr z, .asm_45d4 + cp SPRITE_BIG_SNORLAX + jr z, .ok + cp SPRITE_BIG_LAPRAS + jr z, .ok ld d, $16 -.asm_45d4 - ld hl, OBJECT_FACING +.ok + ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], d ret @@ -522,13 +521,13 @@ Function45da: ; 45da inc [hl] ld a, [hl] - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, bc and 2 ld a, $1c - jr z, .asm_45eb + jr z, .ok inc a -.asm_45eb +.ok ld [hl], a ret ; 45ed @@ -538,14 +537,14 @@ Function45ed: ; 45ed add hl, bc inc [hl] ld a, [hl] - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, bc and 4 ld a, $1e - jr z, .asm_45fe + jr z, .ok inc a -.asm_45fe +.ok ld [hl], a ret ; 4600 @@ -605,13 +604,13 @@ Function463f: ; 463f ld hl, OBJECT_FLAGS add hl, bc bit 3, [hl] - jr z, .asm_464f + jr z, .ok ld hl, OBJECT_STANDING_TILE add hl, bc ld a, [hl] call Function4661 -.asm_464f +.ok ld hl, OBJECT_STANDING_TILE add hl, bc ld a, [hl] @@ -626,17 +625,17 @@ Function463f: ; 463f Function4661: ; 4661 call Function188e - jr z, .asm_466b + jr z, .set call Function1875 - jr c, .asm_4672 + jr c, .reset -.asm_466b +.set ld hl, OBJECT_FLAGS add hl, bc set 3, [hl] ret -.asm_4672 +.reset ld hl, OBJECT_FLAGS add hl, bc res 3, [hl] @@ -659,29 +658,29 @@ Function467b: ; 467b ld [hli], a ld [hli], a ld [hl], a - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc - ld [hl], $ff + ld [hl], STANDING ret ; 4690 Function4690: ; 4690 - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld [hl], a ld hl, OBJECT_04 add hl, bc bit 2, [hl] - jr nz, .asm_46a6 + jr nz, .ok add a add a - and $c - ld hl, OBJECT_08 + and %00001100 + ld hl, OBJECT_FACING add hl, bc ld [hl], a -.asm_46a6 +.ok ; fallthrough ; 46a6 @@ -745,10 +744,10 @@ Function46d7: ; 46d7 GetStepVector: ; 46e9 ; Return (x, y, duration, speed) in (d, e, a, h). - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld a, [hl] - and $f + and %00001111 add a add a ld l, a @@ -793,10 +792,10 @@ Function4730: ; 4730 ; 4738 Function4738: ; 4738 - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld a, [hl] - and $3 + and %00000011 ld [wd151], a call Function46d7 ld a, [wd14e] @@ -814,7 +813,7 @@ Function4759: ; 4759 push bc ld e, a ld d, 0 - ld hl, OBJECT_01 + ld hl, OBJECT_MAP_OBJECT_INDEX add hl, bc ld a, [hl] call GetMapObject @@ -825,46 +824,46 @@ Function4759: ; 4759 ; 4769 Function4769: ; 4769 - ld hl, OBJECT_01 + ld hl, OBJECT_MAP_OBJECT_INDEX add hl, bc ld a, [hl] - cp $ff - jr z, .asm_477d + cp -1 + jr z, .ok push bc call GetMapObject - ld hl, $0004 + ld hl, MAPOBJECT_FACING add hl, bc ld a, [hl] pop bc ret -.asm_477d - ld a, $6 +.ok + ld a, 6 ret ; 4780 -Function4780: ; 4780 +ClearObjectStructField27: ; 4780 ld hl, OBJECT_27 add hl, bc - ld [hl], $0 + ld [hl], 0 ret ; 4787 -Function4787: ; 4787 +IncrementObjectStructField27: ; 4787 ld hl, OBJECT_27 add hl, bc inc [hl] ret ; 478d -Function478d: ; 478d +DecrementObjectStructField27: ; 478d ld hl, OBJECT_27 add hl, bc dec [hl] ret ; 4793 -Function4793: ; 4793 +JumptoObjectStructField27: ; 4793 ld hl, OBJECT_27 add hl, bc ld a, [hl] @@ -873,21 +872,21 @@ Function4793: ; 4793 ret ; 479b -Function479b: ; 479b +ClearObjectStructField28: ; 479b ld hl, OBJECT_28 add hl, bc - ld [hl], $0 + ld [hl], 0 ret ; 47a2 -Function47a2: ; 47a2 +IncrementObjectStructField28: ; 47a2 ld hl, OBJECT_28 add hl, bc inc [hl] ret ; 47a8 -Function47a8: ; 47a8 +JumptoObjectStructField28: ; 47a8 ld hl, OBJECT_28 add hl, bc ld a, [hl] @@ -896,14 +895,14 @@ Function47a8: ; 47a8 ret ; 47b0 -Function47b0: ; 47b0 +GetValueObjectStructField28: ; 47b0 ld hl, OBJECT_28 add hl, bc ld a, [hl] ret ; 47b6 -Function47b6: ; 47b6 +SetValueObjectStructField28: ; 47b6 ld hl, OBJECT_28 add hl, bc ld [hl], a @@ -927,12 +926,12 @@ Function47bc: ; 47bc call Function467b ld hl, OBJECT_09 add hl, bc - ld [hl], $1 + ld [hl], 1 ret ; 47dd Function47dd: ; 47dd - call Function479b + call ClearObjectStructField28 call Function1a2f ld a, [hl] ld hl, .Pointers @@ -978,49 +977,49 @@ Function4821: ; 4821 Function4822: ; 4822 call Random ld a, [hRandomAdd] - and 1 + and %00000001 jp Function4af0 ; 482c Function482c: ; 482c call Random ld a, [hRandomAdd] - and 1 - or 2 + and %00000001 + or %00000010 jp Function4af0 ; 4838 Function4838: ; 4838 call Random ld a, [hRandomAdd] - and 3 + and %00000011 jp Function4af0 ; 4842 Function4842: ; 4842 call Random ld a, [hRandomAdd] - and $c - ld hl, OBJECT_08 + and %00001100 + ld hl, OBJECT_FACING add hl, bc ld [hl], a jp Function4b1d ; 4851 Function4851: ; 4851 - ld hl, OBJECT_08 + ld hl, OBJECT_FACING add hl, bc ld a, [hl] - and $c + and %00001100 ld d, a call Random ld a, [hRandomAdd] - and $c + and %00001100 cp d - jr nz, .asm_4865 - xor $c + jr nz, .keep + xor %00001100 -.asm_4865 +.keep ld [hl], a jp Function4b26 ; 4869 @@ -1030,10 +1029,10 @@ Function4869: ; 4869 call Function467b ld hl, OBJECT_11 add hl, bc - ld [hl], $1 + ld [hl], 1 ld hl, OBJECT_09 add hl, bc - ld [hl], $5 + ld [hl], 5 ret ; 487c @@ -1084,7 +1083,7 @@ Function48a6: ; 48a6 ; 48ac Function48ac: ; 48ac - call Function4793 + call JumptoObjectStructField27 dw Function48b3 dw Function48f8 ; 48b3 @@ -1094,20 +1093,20 @@ Function48b3: ; 48b3 add hl, bc ld a, [hl] call CheckPitTile - jr z, .asm_48f5 + jr z, .on_pit ld hl, OBJECT_FLAGS add hl, bc bit 2, [hl] res 2, [hl] - jr z, .asm_48ee + jr z, .ok ld hl, OBJECT_32 add hl, bc ld a, [hl] - and $3 - or $0 + and %00000011 + or 0 call Function4690 call Function6ec1 - jr c, .asm_48eb + jr c, .ok2 ld de, SFX_STRENGTH call PlaySFX call Function5538 @@ -1117,24 +1116,24 @@ Function48b3: ; 48b3 ld [hl], $f ret -.asm_48eb +.ok2 call Function462a -.asm_48ee - ld hl, OBJECT_07 +.ok + ld hl, OBJECT_DIRECTION_WALKING add hl, bc - ld [hl], $ff + ld [hl], STANDING ret -.asm_48f5 - call Function4787 +.on_pit + call IncrementObjectStructField27 ; fallthrough ; 48f8 Function48f8: ; 48f8 - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc - ld [hl], $ff + ld [hl], STANDING ret ; 48ff @@ -1149,96 +1148,96 @@ Function48ff: ; 48ff add hl, bc ld a, [hl] push bc - call Function1ae5 - ld hl, OBJECT_07 + call GetObjectStruct + ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld a, [hl] - cp $ff - jr z, .asm_494a + cp STANDING + jr z, .standing ld hl, OBJECT_NEXT_MAP_X add hl, bc ld a, [hl] cp d - jr z, .asm_492d - jr c, .asm_4929 - ld a, $3 - jr .asm_493d + jr z, .equal + jr c, .less + ld a, 3 + jr .done -.asm_4929 - ld a, $2 - jr .asm_493d +.less + ld a, 2 + jr .done -.asm_492d +.equal ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld a, [hl] cp e - jr z, .asm_494a - jr c, .asm_493b - ld a, $0 - jr .asm_493d + jr z, .standing + jr c, .less2 + ld a, 0 + jr .done -.asm_493b - ld a, $1 +.less2 + ld a, 1 -.asm_493d +.done ld d, a - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld a, [hl] - and $c + and %00001100 or d pop bc jp Function5412 -.asm_494a +.standing pop bc - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc - ld [hl], $ff + ld [hl], STANDING ld hl, OBJECT_11 add hl, bc - ld [hl], $1 + ld [hl], 1 ret ; 4958 Function4958: ; 4958 call Function467b - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc - ld [hl], $ff + ld [hl], STANDING ld hl, OBJECT_11 add hl, bc - ld [hl], $9 + ld [hl], 9 ld hl, OBJECT_09 add hl, bc - ld [hl], $4 + ld [hl], 4 ret ; 496e Function496e: ; 496e call Function467b - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc - ld [hl], $ff + ld [hl], STANDING ld hl, OBJECT_11 add hl, bc - ld [hl], $a + ld [hl], 10 ld hl, OBJECT_09 add hl, bc - ld [hl], $4 + ld [hl], 4 ret ; 4984 Function4984: ; 4984 - call Function4793 + call JumptoObjectStructField27 dw Function4996 dw Function499c dw Function49b8 ; 498d Function498d: ; 498d - call Function4793 + call JumptoObjectStructField27 dw Function4996 dw Function499c dw Function49c4 @@ -1246,14 +1245,14 @@ Function498d: ; 498d Function4996: ; 4996 call Function467b - call Function4787 + call IncrementObjectStructField27 ; fallthrough ; 499c Function499c: ; 499c ld hl, OBJECT_11 add hl, bc - ld [hl], $1 + ld [hl], 1 ld hl, OBJECT_32 add hl, bc ld a, [hl] @@ -1263,46 +1262,46 @@ Function499c: ; 499c ld [hl], a ld hl, OBJECT_09 add hl, bc - ld [hl], $3 - call Function4787 + ld [hl], 3 + call IncrementObjectStructField27 ret ; 49b8 Function49b8: ; 49b8 - ld de, .data_49c0 + ld de, .DirectionData_49c0 call Function49d0 jr Function4984 ; 49c0 -.data_49c0 ; 49c0 - db $0c, $08, $00, $04 +.DirectionData_49c0 ; 49c0 + db RIGHT << 2, LEFT << 2, DOWN << 2, UP << 2 ; 49c4 Function49c4: ; 49c4 - ld de, .data_49cc + ld de, .DirectionData_49cc call Function49d0 jr Function498d ; 49cc -.data_49cc ; 49cc - db $08, $0c, $04, $00 +.DirectionData_49cc ; 49cc + db LEFT << 2, RIGHT << 2, UP << 2, DOWN << 2 ; 49d0 Function49d0: ; 49d0 - ld hl, OBJECT_08 + ld hl, OBJECT_FACING add hl, bc ld a, [hl] - and $c + and %00001100 rrca rrca push hl ld l, a - ld h, $0 + ld h, 0 add hl, de ld a, [hl] pop hl ld [hl], a - call Function478d + call DecrementObjectStructField27 ret ; 49e5 @@ -1316,28 +1315,28 @@ Function49e5: ; 49e5 ld a, [hl] inc a add a - add $0 + add 0 ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], a - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, de ld a, [hl] and 3 ld d, $e - cp 0 - jr z, .asm_4a0f - cp 1 - jr z, .asm_4a0f + cp DOWN + jr z, .ok + cp UP + jr z, .ok ld d, $c -.asm_4a0f +.ok ld hl, OBJECT_SPRITE_Y_OFFSET add hl, bc ld [hl], d ld hl, OBJECT_SPRITE_X_OFFSET add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_09 add hl, bc ld [hl], $13 @@ -1349,16 +1348,16 @@ Function4a21: ; 4a21 call Function4aa8 ld hl, OBJECT_11 add hl, bc - ld [hl], $8 + ld [hl], 8 ld hl, OBJECT_STEP_DURATION add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_SPRITE_Y_OFFSET add hl, bc ld [hl], $f0 ld hl, OBJECT_SPRITE_X_OFFSET add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_09 add hl, bc ld [hl], $13 @@ -1379,15 +1378,14 @@ Function4a46: ; 4a46 ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], a - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, de ld a, [hl] - and 3 + and %00000011 ld e, a ld d, 0 ld hl, .data_4a81 - add hl, de - add hl, de + add_n_times hl, de, 2 ld d, [hl] inc hl ld e, [hl] @@ -1420,7 +1418,7 @@ Function4a89: ; 4a89 ld hl, OBJECT_STEP_DURATION add hl, de ld a, [hl] - add $ff + add -1 ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], a @@ -1435,7 +1433,7 @@ Function4aa8: ; 4aa8 add hl, bc ld a, [hl] push bc - call Function1ae5 + call GetObjectStruct ld d, b ld e, c pop bc @@ -1451,7 +1449,7 @@ Function4abc: ; 4abc call Function467b ld hl, OBJECT_11 add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_32 add hl, bc ld a, [hl] @@ -1470,20 +1468,20 @@ Function4abc: ; 4abc Function4ade: ; 4ade ld d, a - and $3f + and %00111111 ld e, a ld a, d rlca rlca - and $3 + and %00000011 ld d, a inc d - ld a, $1 -.asm_4aeb + ld a, 1 +.loop dec d ret z add a - jr .asm_4aeb + jr .loop ; 4af0 Function4af0: ; 4af0 @@ -1493,20 +1491,20 @@ Function4af0: ; 4af0 call Function463f ld hl, OBJECT_11 add hl, bc - ld [hl], $2 + ld [hl], 2 ld hl, wd4cf ld a, [$ffaf] cp [hl] - jr z, .asm_4b10 + jr z, .ok ld hl, OBJECT_09 add hl, bc ld [hl], $7 ret -.asm_4b10 +.ok ld hl, OBJECT_09 add hl, bc - ld [hl], $6 + ld [hl], 6 ret Function4b17: ; 4b17 @@ -1518,14 +1516,14 @@ Function4b17: ; 4b17 Function4b1d: ; 4b1d call Random ld a, [hRandomAdd] - and $7f + and %01111111 jr Function4b2d ; 4b26 Function4b26: ; 4b26 call Random ld a, [hRandomAdd] - and $1f + and %00011111 ; fallthrough ; 4b2d @@ -1533,15 +1531,15 @@ Function4b2d: ; 4b2d ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], a - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc - ld [hl], $ff + ld [hl], STANDING ld hl, OBJECT_11 add hl, bc - ld [hl], $1 + ld [hl], 1 ld hl, OBJECT_09 add hl, bc - ld [hl], $3 + ld [hl], 3 ret ; 4b45 @@ -1581,12 +1579,12 @@ Function4b79: ; 4b79 ret nz ld hl, OBJECT_09 add hl, bc - ld [hl], $1 + ld [hl], 1 ret ; 4b86 Function4b86: ; 4b86 - call Function47a8 + call JumptoObjectStructField28 dw Function4b8d dw Function4ba9 ; 4b8d @@ -1603,7 +1601,7 @@ Function4b8d: ; 4b8d ld hl, OBJECT_FLAGS add hl, bc res 3, [hl] - call Function47a2 + call IncrementObjectStructField28 ret ; 4ba9 @@ -1617,12 +1615,12 @@ Function4ba9: ; 4ba9 call Function4600 ld hl, OBJECT_09 add hl, bc - ld [hl], $1 + ld [hl], 1 ret ; 4bbf Function4bbf: ; 4bbf - call Function47a8 + call JumptoObjectStructField28 dw Function4bca dw Function4bd2 dw Function4bf2 @@ -1632,7 +1630,7 @@ Function4bbf: ; 4bbf Function4bca: ; 4bca ld hl, wd150 set 7, [hl] - call Function47a2 + call IncrementObjectStructField28 ; fallthrough ; 4bd2 @@ -1650,7 +1648,7 @@ Function4bd2: ; 4bd2 ld hl, wd150 set 6, [hl] set 4, [hl] - call Function47a2 + call IncrementObjectStructField28 ret ; 4bf2 @@ -1658,7 +1656,7 @@ Function4bf2: ; 4bf2 call Function46a6 ld hl, wd150 set 7, [hl] - call Function47a2 + call IncrementObjectStructField28 ; fallthrough ; 4bfd @@ -1674,12 +1672,12 @@ Function4bfd: ; 4bfd call Function4600 ld hl, OBJECT_09 add hl, bc - ld [hl], $1 + ld [hl], 1 ret ; 4c18 Function4c18: ; 4c18 - call Function47a8 + call JumptoObjectStructField28 dw Function4c23 dw Function4c32 dw Function4c42 @@ -1689,30 +1687,30 @@ Function4c18: ; 4c18 Function4c23: ; 4c23 ld hl, OBJECT_12 add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], $10 - call Function47a2 + call IncrementObjectStructField28 ; fallthrough ; 4c32 Function4c32: ; 4c32 ld hl, OBJECT_11 add hl, bc - ld [hl], $4 + ld [hl], 4 ld hl, OBJECT_STEP_DURATION add hl, bc dec [hl] ret nz - call Function47a2 + call IncrementObjectStructField28 ret ; 4c42 Function4c42: ; 4c42 ld hl, OBJECT_12 add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_31 add hl, bc ld [hl], $10 @@ -1722,14 +1720,14 @@ Function4c42: ; 4c42 ld hl, OBJECT_FLAGS add hl, bc res 3, [hl] - call Function47a2 + call IncrementObjectStructField28 ; fallthrough ; 4c5d Function4c5d: ; 4c5d ld hl, OBJECT_11 add hl, bc - ld [hl], $4 + ld [hl], 4 ld hl, OBJECT_31 add hl, bc inc [hl] @@ -1747,15 +1745,15 @@ Function4c5d: ; 4c5d ret nz ld hl, OBJECT_12 add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_09 add hl, bc - ld [hl], $1 + ld [hl], 1 ret ; 4c89 Function4c89: ; 4c89 - call Function47a8 + call JumptoObjectStructField28 dw Function4c9a dw Function4caa dw Function4cb3 @@ -1768,11 +1766,11 @@ Function4c89: ; 4c89 Function4c9a: ; 4c9a ld hl, OBJECT_11 add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], $10 - call Function47a2 + call IncrementObjectStructField28 ret ; 4caa @@ -1781,28 +1779,28 @@ Function4caa: ; 4caa add hl, bc dec [hl] ret nz - call Function47a2 + call IncrementObjectStructField28 ; fallthrough ; 4cb3 Function4cb3: ; 4cb3 ld hl, OBJECT_12 add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_31 add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], $10 - call Function47a2 + call IncrementObjectStructField28 ret ; 4cc9 Function4cc9: ; 4cc9 ld hl, OBJECT_11 add hl, bc - ld [hl], $4 + ld [hl], 4 ld hl, OBJECT_31 add hl, bc inc [hl] @@ -1818,7 +1816,7 @@ Function4cc9: ; 4cc9 add hl, bc dec [hl] ret nz - call Function47a2 + call IncrementObjectStructField28 ; fallthrough ; 4ceb @@ -1826,14 +1824,14 @@ Function4ceb: ; 4ceb ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], $10 - call Function47a2 + call IncrementObjectStructField28 ret ; 4cf5 Function4cf5: ; 4cf5 ld hl, OBJECT_11 add hl, bc - ld [hl], $4 + ld [hl], 4 ld hl, OBJECT_STEP_DURATION add hl, bc dec [hl] @@ -1843,18 +1841,18 @@ Function4cf5: ; 4cf5 Function4d01: ; 4d01 ld hl, OBJECT_12 add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_SPRITE_Y_OFFSET add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_09 add hl, bc - ld [hl], $1 + ld [hl], 1 ret ; 4d14 Function4d14: ; 4d14 - call Function47a8 + call JumptoObjectStructField28 dw Function4d1f dw Function4d2e dw Function4d4f @@ -1864,11 +1862,11 @@ Function4d14: ; 4d14 Function4d1f: ; 4d1f ld hl, OBJECT_11 add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], $10 - call Function47a2 + call IncrementObjectStructField28 ; fallthrough ; 4d2e @@ -1879,17 +1877,17 @@ Function4d2e: ; 4d2e ret nz ld hl, OBJECT_11 add hl, bc - ld [hl], $2 + ld [hl], 2 ld hl, OBJECT_12 add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_31 add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], $10 - call Function47a2 + call IncrementObjectStructField28 ; fallthrough ; 4d4f @@ -1909,25 +1907,25 @@ Function4d4f: ; 4d4f add hl, bc dec [hl] ret nz - call Function47a2 + call IncrementObjectStructField28 ; fallthrough ; 4d6b Function4d6b: ; 4d6b ld hl, OBJECT_12 add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_SPRITE_Y_OFFSET add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_09 add hl, bc - ld [hl], $1 + ld [hl], 1 ret ; 4d7e Function4d7e: ; 4d7e - call Function47a8 + call JumptoObjectStructField28 dw Function4d85 dw Function4d94 ; 4d85 @@ -1935,11 +1933,11 @@ Function4d7e: ; 4d7e Function4d85: ; 4d85 ld hl, OBJECT_STEP_DURATION add hl, bc - ld [hl], $8 + ld [hl], 8 ld hl, OBJECT_SPRITE_Y_OFFSET add hl, bc - ld [hl], $0 - call Function47a2 + ld [hl], 0 + call IncrementObjectStructField28 ; fallthrough ; 4d94 @@ -1955,10 +1953,10 @@ Function4d94: ; 4d94 ret nz ld hl, OBJECT_SPRITE_Y_OFFSET add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_09 add hl, bc - ld [hl], $1 + ld [hl], 1 ret ; 4daf @@ -1971,12 +1969,12 @@ Function4db5: ; 4db5 ld hl, OBJECT_STEP_DURATION add hl, bc ld a, [hl] - and $1 - ld a, $1 - jr z, .asm_4dc2 - ld a, $0 + and %00000001 + ld a, 1 + jr z, .yes + ld a, 0 -.asm_4dc2 +.yes ld hl, OBJECT_11 add hl, bc ld [hl], a @@ -1987,12 +1985,12 @@ Function4dc8: ; 4dc8 ld hl, OBJECT_STEP_DURATION add hl, bc ld a, [hl] - and $1 - ld a, $4 - jr z, .asm_4dd5 - ld a, $5 + and %00000001 + ld a, 4 + jr z, .yes + ld a, 5 -.asm_4dd5 +.yes ld hl, OBJECT_11 add hl, bc ld [hl], a @@ -2000,23 +1998,23 @@ Function4dc8: ; 4dc8 ; 4ddd Function4ddd: ; 4ddd - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc - ld [hl], $ff + ld [hl], STANDING ld hl, OBJECT_STEP_DURATION add hl, bc dec [hl] ret nz ld hl, OBJECT_09 add hl, bc - ld [hl], $1 + ld [hl], 1 ret ; 4df0 Function4df0: ; 4df0 - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc - ld [hl], $ff + ld [hl], STANDING ld hl, OBJECT_STEP_DURATION add hl, bc dec [hl] @@ -2031,12 +2029,12 @@ Function4dff: ; 4dff ret nz ld hl, OBJECT_09 add hl, bc - ld [hl], $1 + ld [hl], 1 ret ; 4e0c Function4e0c: ; 4e0c - call Function47a8 + call JumptoObjectStructField28 dw Function4e13 dw Function4e21 ; 4e13 @@ -2044,18 +2042,18 @@ Function4e0c: ; 4e0c Function4e13: ; 4e13 call Function4769 call Function1a47 - ld hl, OBJECT_08 + ld hl, OBJECT_FACING add hl, bc ld [hl], a - call Function47a2 + call IncrementObjectStructField28 ; fallthrough ; 4e21 Function4e21: ; 4e21 call Function4fb2 - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc - ld [hl], $ff + ld [hl], STANDING ret ; 4e2b @@ -2067,12 +2065,12 @@ Function4e2b: ; 4e2b dec [hl] ret nz call Function4600 - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc - ld [hl], $ff + ld [hl], STANDING ld hl, OBJECT_09 add hl, bc - ld [hl], $1 + ld [hl], 1 ret ; 4e47 @@ -2088,7 +2086,7 @@ Function4e47: ; 4e47 Function4e56: ; 4e56 ; AnimateStep? - call Function47a8 + call JumptoObjectStructField28 dw Function4e5d dw Function4e65 ; 4e5d @@ -2096,7 +2094,7 @@ Function4e56: ; 4e56 Function4e5d: ; 4e5d ld hl, wd150 set 7, [hl] - call Function47a2 + call IncrementObjectStructField28 ; fallthrough ; 4e65 @@ -2109,17 +2107,17 @@ Function4e65: ; 4e65 ld hl, wd150 set 6, [hl] call Function4600 - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc - ld [hl], $ff + ld [hl], STANDING ld hl, OBJECT_09 add hl, bc - ld [hl], $1 + ld [hl], 1 ret ; 4e83 Function4e83: ; 4e83 - call Function47a8 + call JumptoObjectStructField28 dw Function4e8e dw Function4ea4 dw Function4ead @@ -2127,17 +2125,17 @@ Function4e83: ; 4e83 ; 4e8e Function4e8e: ; 4e8e - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc - ld [hl], $ff + ld [hl], STANDING ld hl, OBJECT_12 add hl, bc ld a, [hl] - ld [hl], $2 + ld [hl], 2 ld hl, OBJECT_STEP_DURATION add hl, bc - ld [hl], $2 - call Function47a2 + ld [hl], 2 + call IncrementObjectStructField28 ; fallthrough ; 4ea4 @@ -2146,7 +2144,7 @@ Function4ea4: ; 4ea4 add hl, bc dec [hl] ret nz - call Function47a2 + call IncrementObjectStructField28 ; fallthrough ; 4ead @@ -2154,13 +2152,13 @@ Function4ead: ; 4ead ld hl, OBJECT_29 add hl, bc ld a, [hl] - ld hl, OBJECT_08 + ld hl, OBJECT_FACING add hl, bc ld [hl], a ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], $2 - call Function47a2 + call IncrementObjectStructField28 ; fallthrough ; 4ec0 @@ -2171,7 +2169,7 @@ Function4ec0: ; 4ec0 ret nz ld hl, OBJECT_09 add hl, bc - ld [hl], $1 + ld [hl], 1 ret ; 4ecd @@ -2188,7 +2186,7 @@ Function4ecd: ; 4ecd ld hl, OBJECT_MAP_Y add hl, bc ld e, [hl] - ld hl, OBJECT_01 + ld hl, OBJECT_MAP_OBJECT_INDEX add hl, bc ld a, [hl] ld b, a @@ -2198,12 +2196,12 @@ Function4ecd: ; 4ecd add hl, bc res 2, [hl] call Function4600 - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc - ld [hl], $ff + ld [hl], STANDING ld hl, OBJECT_09 add hl, bc - ld [hl], $1 + ld [hl], 1 ret ; 4f04 @@ -2213,11 +2211,11 @@ Function4f04: ; 4f04 ld e, [hl] inc hl ld d, [hl] - ld hl, OBJECT_00 + ld hl, OBJECT_SPRITE add hl, de ld a, [hl] and a - jr z, .asm_4f30 + jr z, .nope ld hl, OBJECT_SPRITE_X add hl, de ld a, [hl] @@ -2238,12 +2236,12 @@ Function4f04: ; 4f04 dec [hl] ret nz -.asm_4f30 +.nope jp Function4357 ; 4f33 Function4f33: ; 4f33 - call Function47a8 + call JumptoObjectStructField28 dw Function4f3a dw Function4f43 ; 4f3a @@ -2253,7 +2251,7 @@ Function4f3a: ; 4f3a ld hl, OBJECT_29 add hl, bc ld [hl], a - call Function47a2 + call IncrementObjectStructField28 ; fallthrough ; 4f43 @@ -2267,7 +2265,7 @@ Function4f43: ; 4f43 ld hl, OBJECT_STEP_DURATION add hl, bc dec [hl] - jr z, .asm_4f68 + jr z, .ok ld a, [hl] call Function4f6c ld hl, OBJECT_29 @@ -2279,7 +2277,7 @@ Function4f43: ; 4f43 ld [wd14f], a ret -.asm_4f68 +.ok call Function4357 ret ; 4f6c @@ -2296,18 +2294,18 @@ Function4f6c: ; 4f6c ; 4f77 Function4f77: ; 4f77 - call Function47a8 ; ???? + call JumptoObjectStructField28 ; ???? ; 4f7a Function4f7a: ; 4f7a - call Function47a8 + call JumptoObjectStructField28 dw Function4f83 dw Function4f83 dw Function4f83 ; 4f83 Function4f83: ; 4f83 - call Function47a8 + call JumptoObjectStructField28 dw Function4f8a dw Function4f99 ; 4f8a @@ -2319,7 +2317,7 @@ Function4f8a: ; 4f8a ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], $10 - call Function47a2 + call IncrementObjectStructField28 ; 4f99 Function4f99: ; 4f99 @@ -2332,10 +2330,10 @@ Function4f99: ; 4f99 ld [hl], $60 ld hl, OBJECT_12 add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, OBJECT_09 add hl, bc - ld [hl], $1 + ld [hl], 1 ret ; 4fb2 @@ -2350,7 +2348,7 @@ Function4fb3: ; 4fb3 ld a, [hl] srl a srl a - and 7 + and %00000111 ld l, a ld h, 0 ld de, .y @@ -2449,14 +2447,14 @@ Function503d: ; 503d Function5041: ; 5041 call Function5055 -.asm_5044 +.loop xor a ld [wc2ea], a call Function505e call Function506b ld a, [wc2ea] and a - jr nz, .asm_5044 + jr nz, .loop ret ; 5055 @@ -2477,7 +2475,7 @@ Function505e: ; 505e ; 5065 Function5065: ; 5065 - ld a, $1 + ld a, 1 ld [wc2ea], a ret ; 506b @@ -2500,7 +2498,7 @@ INCLUDE "engine/movement.asm" Function54b8: ; 54b8 ld e, a ld a, [wd4ce] - cp $ff + cp -1 ret z ld a, [wd4cd] ld d, a @@ -2534,25 +2532,25 @@ Function54e6: ; 54e6 ld hl, wd4d0 ld a, [hl] and a - jr z, .asm_5503 - cp $ff - jr z, .asm_5503 + jr z, .done + cp -1 + jr z, .done dec [hl] ld e, a ld d, 0 ld hl, wd4d1 add hl, de inc e - ld a, $ff -.asm_54fc + ld a, -1 +.loop ld d, [hl] ld [hld], a ld a, d dec e - jr nz, .asm_54fc + jr nz, .loop ret -.asm_5503 +.done call Function550a ret c ld a, $3e @@ -2561,20 +2559,20 @@ Function54e6: ; 54e6 Function550a: ; 550a ld a, [wd4cd] - cp $ff - jr z, .asm_5520 + cp -1 + jr z, .nope push bc - call Function1ae5 - ld hl, OBJECT_00 + call GetObjectStruct + ld hl, OBJECT_SPRITE add hl, bc ld a, [hl] pop bc and a - jr z, .asm_5520 + jr z, .nope and a ret -.asm_5520 +.nope ld a, $ff ld [wd4ce], a ld a, $47 @@ -2657,31 +2655,31 @@ Function5579: ; 5579 Function5582: ; 5582 ld de, ObjectStructs ld a, $d -.asm_5587 +.loop push af ld hl, OBJECT_04 add hl, de bit 7, [hl] - jr z, .asm_55a1 - ld hl, OBJECT_00 + jr z, .next + ld hl, OBJECT_SPRITE add hl, de ld a, [hl] and a - jr z, .asm_55a1 + jr z, .next push bc xor a - ld bc, ObjectStruct2 - ObjectStruct1 + ld bc, OBJECT_STRUCT_LENGTH call ByteFill pop bc -.asm_55a1 - ld hl, ObjectStruct2 - ObjectStruct1 +.next + ld hl, OBJECT_STRUCT_LENGTH add hl, de ld d, h ld e, l pop af dec a - jr nz, .asm_5587 + jr nz, .loop ret ; 55ac @@ -2696,9 +2694,9 @@ Function55ac: ; 55ac Function55b9: ; 55b9 ld hl, wc2f0 - ld [hl], $ff + ld [hl], -1 inc hl - ld [hl], $ff + ld [hl], -1 inc hl ld a, [de] inc de @@ -2722,7 +2720,7 @@ Function55b9: ; 55b9 inc hl ld [hl], e inc hl - ld [hl], $ff + ld [hl], -1 ret ; 55e0 @@ -2732,44 +2730,44 @@ Function55e0:: ; 55e0 ret z ld bc, ObjectStructs xor a -.asm_55ea +.loop ld [$ffaf], a - call Function1af1 - jr z, .asm_55f4 + call GetObjectSprite + jr z, .ok call Function565c -.asm_55f4 - ld hl, ObjectStruct2 - ObjectStruct1 +.ok + ld hl, OBJECT_STRUCT_LENGTH add hl, bc ld b, h ld c, l ld a, [$ffaf] inc a - cp $d - jr nz, .asm_55ea + cp NUM_OBJECT_STRUCTS + jr nz, .loop ret ; 5602 Function5602: ; 5602 call Function5645 - ld a, $0 + ld a, 0 call Function5629 ld a, [wd459] bit 7, a - jr z, .asm_5619 + jr z, .ok ld a, [$ffe0] and a - jr z, .asm_5619 + jr z, .ok call Function5629 -.asm_5619 +.ok call Function5920 ret ; 561d Function561d: ; 561d call Function5645 - ld a, $0 + ld a, 0 call Function5629 call Function5920 ret @@ -2779,15 +2777,15 @@ Function5629: ; 5629 cp $10 ret nc call GetMapObject - ld hl, $0000 + ld hl, MAPOBJECT_VRAM_ID add hl, bc ld a, [hl] - cp $ff + cp MAPOBJECT_NOT_VISIBLE ret z cp $d ret nc - call Function1ae5 - call Function1af1 + call GetObjectStruct + call GetObjectSprite ret z call Function5673 ret @@ -2796,17 +2794,17 @@ Function5629: ; 5629 Function5645: ; 5645 xor a ld bc, ObjectStructs -.asm_5649 +.loop ld [$ffaf], a call Function5680 - ld hl, ObjectStruct2 - ObjectStruct1 + ld hl, OBJECT_STRUCT_LENGTH add hl, bc ld b, h ld c, l ld a, [$ffaf] inc a - cp $d - jr nz, .asm_5649 + cp NUM_OBJECT_STRUCTS + jr nz, .loop ret ; 565c @@ -2832,9 +2830,9 @@ Function5673: ; 5673 ; 5680 Function5680: ; 5680 - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, bc - ld [hl], $ff + ld [hl], STANDING scf ret ; 5688 @@ -2867,26 +2865,26 @@ Function56a3: ; 56a3 inc e ld a, [XCoord] cp d - jr z, .asm_56bc - jr nc, .asm_56cb + jr z, .equal_x + jr nc, .nope add $b cp d - jr c, .asm_56cb + jr c, .nope -.asm_56bc +.equal_x ld a, [YCoord] cp e - jr z, .asm_56c9 - jr nc, .asm_56cb + jr z, .equal_y + jr nc, .nope add $a cp e - jr c, .asm_56cb + jr c, .nope -.asm_56c9 +.equal_y xor a ret -.asm_56cb +.nope scf ret ; 56cd @@ -2902,27 +2900,27 @@ Function56cd: ; 56cd add [hl] add d cp $f0 - jr nc, .asm_56e5 + jr nc, .ok1 cp $a0 - jp nc, .asm_5768 + jp nc, .nope -.asm_56e5 - and $7 - ld d, $2 - cp $4 - jr c, .asm_56ef - ld d, $3 +.ok1 + and %00000111 + ld d, 2 + cp 4 + jr c, .ok2 + ld d, 3 -.asm_56ef +.ok2 ld a, [hl] srl a srl a srl a cp $14 - jr c, .asm_56fc + jr c, .ok3 sub $20 -.asm_56fc +.ok3 ld [$ffbd], a ld a, [wd14d] ld e, a @@ -2934,76 +2932,76 @@ Function56cd: ; 56cd add [hl] add e cp $f0 - jr nc, .asm_5715 + jr nc, .ok4 cp $90 - jr nc, .asm_5768 + jr nc, .nope -.asm_5715 - and $7 - ld e, $2 - cp $4 - jr c, .asm_571f - ld e, $3 +.ok4 + and %00000111 + ld e, 2 + cp 4 + jr c, .ok5 + ld e, 3 -.asm_571f +.ok5 ld a, [hl] srl a srl a srl a cp $12 - jr c, .asm_572c + jr c, .ok6 sub $20 -.asm_572c +.ok6 ld [$ffbe], a ld hl, OBJECT_PALETTE add hl, bc bit 7, [hl] - jr z, .asm_573e + jr z, .ok7 ld a, d - add $2 + add 2 ld d, a ld a, e - add $2 + add 2 ld e, a -.asm_573e +.ok7 ld a, d ld [$ffbf], a -.asm_5741 +.loop ld a, [$ffbf] ld d, a ld a, [$ffbe] add e dec a cp $12 - jr nc, .asm_5763 + jr nc, .ok9 ld b, a -.asm_574d +.next ld a, [$ffbd] add d dec a cp $14 - jr nc, .asm_5760 + jr nc, .ok8 ld c, a push bc call GetTileCoord pop bc ld a, [hl] cp $60 - jr nc, .asm_5768 + jr nc, .nope -.asm_5760 +.ok8 dec d - jr nz, .asm_574d + jr nz, .next -.asm_5763 +.ok9 dec e - jr nz, .asm_5741 + jr nz, .loop and a ret -.asm_5768 +.nope scf ret ; 576a @@ -3019,7 +3017,7 @@ Function5771: ; 5771 ld [wd14e], a ld [wd14f], a ld [wd150], a - ld a, $ff + ld a, -1 ld [wd151], a ret ; 5781 @@ -3027,21 +3025,21 @@ Function5771: ; 5771 Function5781: ; 5781 ld bc, ObjectStructs xor a -.asm_5785 +.loop ld [$ffaf], a - call Function1af1 - jr z, .asm_578f + call GetObjectSprite + jr z, .next call Function437b -.asm_578f - ld hl, ObjectStruct2 - ObjectStruct1 +.next + ld hl, OBJECT_STRUCT_LENGTH add hl, bc ld b, h ld c, l ld a, [$ffaf] inc a - cp $d - jr nz, .asm_5785 + cp NUM_OBJECT_STRUCTS + jr nz, .loop ret ; 579d @@ -3062,11 +3060,11 @@ Function579d: ; 579d Function57bc: ; 57bc ld hl, wd45b bit 7, [hl] - jr nz, .asm_57c4 + jr nz, .ok ret -.asm_57c4 - ld a, $0 +.ok + ld a, 0 ld [PlayerAction], a ret ; 57ca @@ -3076,20 +3074,20 @@ Function57ca: ; 57ca bit 5, [hl] ret z ld a, [wd45b] - and $3 + and 3 add a add a jr Function57db ; 57d9 Function57d9: ; 57d9 - ld a, $0 + ld a, 0 ; fallthrough ; 57db Function57db: ; 57db ld bc, PlayerStruct - call Function1af8 + call SetSpriteDirection ret ; 57e2 @@ -3098,20 +3096,20 @@ Function57e2: ; 57e2 and $80 ret z ld bc, $0000 ; debug? - ld hl, OBJECT_08 + ld hl, OBJECT_FACING add hl, bc ld a, [hl] or d ld [hl], a ld a, d swap a - and $7 + and %00000111 ld d, a ld bc, PlayerStruct ld hl, OBJECT_PALETTE add hl, bc ld a, [hl] - and $f8 + and %11111000 or d ld [hl], a ret @@ -3144,7 +3142,7 @@ Function581f:: ; 581f ; 5826 Function5826: ; 5826 - ld a, $ff + ld a, -1 ld [wd4cd], a ret ; 582c @@ -3160,7 +3158,7 @@ Function582c: ; 582c ld [hl], $13 ld hl, OBJECT_09 add hl, bc - ld [hl], $0 + ld [hl], 0 ld a, [$ffb0] ld [wd4ce], a ret @@ -3168,16 +3166,16 @@ Function582c: ; 582c Function5847: ; 5847 ld a, [wd4ce] - cp $ff + cp -1 ret z - call Function1ae5 + call GetObjectStruct callba Function58e3 - ld a, $ff + ld a, -1 ld [wd4ce], a ret ; 585c -Function585c:: ; 585c +SetFlagsForMovement_1:: ; 585c ld a, c call Function18de ret c @@ -3204,42 +3202,42 @@ Function586e: ; 586e Function587a: ; 587a ld bc, ObjectStructs xor a -.asm_587e +.loop push af - call Function1af1 - jr z, .asm_588a + call GetObjectSprite + jr z, .next ld hl, OBJECT_FLAGS add hl, bc set 5, [hl] -.asm_588a - ld hl, ObjectStruct2 - ObjectStruct1 +.next + ld hl, OBJECT_STRUCT_LENGTH add hl, bc ld b, h ld c, l pop af inc a - cp $d - jr nz, .asm_587e + cp NUM_OBJECT_STRUCTS + jr nz, .loop ret ; 5897 -Function5897:: ; 5897 +_SetFlagsForMovement_2:: ; 5897 ld a, [wd4cd] - cp $ff + cp -1 ret z push bc - call Function1ae5 - ld hl, OBJECT_01 + call GetObjectStruct + ld hl, OBJECT_MAP_OBJECT_INDEX add hl, bc ld a, [hl] pop bc cp c ret nz ld a, [wd4ce] - cp $ff + cp -1 ret z - call Function1ae5 + call GetObjectStruct ld hl, OBJECT_FLAGS add hl, bc res 5, [hl] @@ -3250,23 +3248,23 @@ Function58b9:: ; 58b9 push bc ld bc, ObjectStructs xor a -.asm_58be +.loop push af - call Function1af1 - jr z, .asm_58ca + call GetObjectSprite + jr z, .next ld hl, OBJECT_FLAGS add hl, bc res 5, [hl] -.asm_58ca - ld hl, ObjectStruct2 - ObjectStruct1 +.next + ld hl, OBJECT_STRUCT_LENGTH add hl, bc ld b, h ld c, l pop af inc a - cp $d - jr nz, .asm_58be + cp NUM_OBJECT_STRUCTS + jr nz, .loop pop bc ret ; 58d8 @@ -3281,14 +3279,14 @@ Function58d8: ; 58d8 ; 58e3 Function58e3: ; 58e3 - ld hl, OBJECT_01 + ld hl, OBJECT_MAP_OBJECT_INDEX add hl, bc ld a, [hl] - cp $ff + cp -1 jp z, Function5903 push bc call GetMapObject - ld hl, $0004 + ld hl, MAPOBJECT_FACING add hl, bc ld a, [hl] pop bc @@ -3297,7 +3295,7 @@ Function58e3: ; 58e3 ld [hl], a ld hl, OBJECT_09 add hl, bc - ld [hl], $0 + ld [hl], 0 ret ; 5903 @@ -3315,7 +3313,7 @@ Function5903: ; 5903 ld [hl], a ld hl, OBJECT_09 add hl, bc - ld [hl], $0 + ld [hl], 0 ret .data_591c @@ -3330,7 +3328,7 @@ Function5920:: ; 5920 ld [$ffbd], a ld a, [hOAMUpdate] push af - ld a, $1 + ld a, 1 ld [hOAMUpdate], a call Function5991 call Function593a @@ -3343,10 +3341,10 @@ Function593a: ; 593a ld a, [VramState] bit 1, a ld b, $a0 - jr z, .asm_5945 + jr z, .ok ld b, $70 -.asm_5945 +.ok ld a, [$ffbd] cp b ret nc @@ -3355,11 +3353,11 @@ Function593a: ; 593a ld de, OBJECT_04 ld a, b ld c, $a0 -.asm_5952 +.loop ld [hl], c add hl, de cp l - jr nz, .asm_5952 + jr nz, .loop ret ; 5958 @@ -3372,12 +3370,12 @@ Function5958: ; 5958 ld a, [wd14d] ld e, a ld bc, ObjectStructs - ld a, $d + ld a, NUM_OBJECT_STRUCTS -.asm_5968 +.loop push af - call Function1af1 - jr z, .asm_597c + call GetObjectSprite + jr z, .skip ld hl, OBJECT_SPRITE_X add hl, bc @@ -3391,14 +3389,14 @@ Function5958: ; 5958 add e ld [hl], a -.asm_597c - ld hl, ObjectStruct2 - ObjectStruct1 +.skip + ld hl, OBJECT_STRUCT_LENGTH add hl, bc ld b, h ld c, l pop af dec a - jr nz, .asm_5968 + jr nz, .loop xor a ld [wd14c], a @@ -3431,10 +3429,10 @@ Function59a4: ; 59a4 ld hl, wc2eb .loop push hl - call Function1af1 + call GetObjectSprite jr z, .skip - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, bc ld a, [hl] cp -1 @@ -3453,7 +3451,7 @@ Function59a4: ; 59a4 jr .add .skip - ld hl, ObjectStruct2 - ObjectStruct1 + ld hl, OBJECT_STRUCT_LENGTH add hl, bc ld b, h ld c, l @@ -3461,7 +3459,7 @@ Function59a4: ; 59a4 jr .next .add - ld hl, ObjectStruct2 - ObjectStruct1 + ld hl, OBJECT_STRUCT_LENGTH add hl, bc ld b, h ld c, l @@ -3473,7 +3471,7 @@ Function59a4: ; 59a4 .next inc d ld a, d - cp $d + cp NUM_OBJECT_STRUCTS jr nz, .loop ret ; 59f3 @@ -3483,7 +3481,7 @@ Function59f3: ; 59f3 .next ld a, [hli] ld d, a - and $f0 + and %11110000 ret z cp c jr nz, .next @@ -3491,7 +3489,7 @@ Function59f3: ; 59f3 push bc push hl ld a, d - and $f + and %00001111 call Function5ac2 call Function5a0d pop hl @@ -3500,44 +3498,44 @@ Function59f3: ; 59f3 ; 5a0d Function5a0d: ; 5a0d - ld hl, OBJECT_SPRITE + ld hl, OBJECT_SPRITE_TILE add hl, bc ld a, [hl] - and $7f + and %01111111 ld [$ffc1], a xor a bit 7, [hl] - jr nz, .asm_5a1d - or 8 -.asm_5a1d + jr nz, .skip1 + or %00001000 +.skip1 ld hl, OBJECT_FLAGS add hl, bc ld e, [hl] bit 7, e - jr z, .asm_5a28 - or $80 -.asm_5a28 + jr z, .skip2 + or %10000000 +.skip2 bit 4, e - jr z, .asm_5a2e - or $10 -.asm_5a2e + jr z, .skip3 + or %00010000 +.skip3 ld hl, OBJECT_PALETTE add hl, bc ld d, a ld a, [hl] - and 7 + and %00000111 or d ld d, a xor a bit 3, e - jr z, .asm_5a3f - or $80 -.asm_5a3f + jr z, .skip4 + or %10000000 +.skip4 ld [$ffc2], a ld hl, OBJECT_SPRITE_X @@ -3570,7 +3568,7 @@ Function5a0d: ; 5a0d add e ld [$ffc0], a - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, bc ld a, [hl] cp -1 @@ -3616,9 +3614,9 @@ Function5a0d: ; 5a0d ld a, [$ffc1] bit 2, e - jr z, .asm_5aa3 + jr z, .nope1 xor a -.asm_5aa3 +.nope1 add [hl] inc hl @@ -3627,11 +3625,11 @@ Function5a0d: ; 5a0d ld a, e bit 1, a - jr z, .asm_5aaf + jr z, .nope2 ld a, [$ffc2] or e -.asm_5aaf - and $f0 +.nope2 + and %11110000 or d ld [bc], a inc c @@ -3657,8 +3655,7 @@ Function5ac2: ; 5ac2 ld c, a ld b, 0 ld hl, .Addresses - add hl, bc - add hl, bc + add_n_times hl, bc, 2 ld c, [hl] inc hl ld b, [hl] diff --git a/engine/map_setup.asm b/engine/map_setup.asm index 8c10954b3..f1a5db01a 100644 --- a/engine/map_setup.asm +++ b/engine/map_setup.asm @@ -306,7 +306,7 @@ MapSetupCommands: ; 15440 dbw BANK(Function24cd), Function24cd dbw BANK(Function28e3), Function28e3 dbw BANK(Function289d), Function289d - dbw BANK(Function2879), Function2879 + dbw BANK(BufferScreen), BufferScreen dbw BANK(Function1047cf), Function1047cf dbw BANK(LoadTilesetHeader), LoadTilesetHeader dbw BANK(Function104750), Function104750 diff --git a/engine/pack.asm b/engine/pack.asm index e765bab7e..79794098a 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -62,7 +62,7 @@ Function10056: ; 10056 (4:4056) Function10067: ; 10067 (4:4067) ld hl, MenuDataHeader_0x10a4f - call Function1d3c + call CopyMenuDataHeader ld a, [wd0d9] ld [wcf88], a ld a, [wd0df] @@ -90,7 +90,7 @@ Function10094: ; 10094 (4:4094) Function100a6: ; 100a6 (4:40a6) ld hl, MenuDataHeader_0x10a7f - call Function1d3c + call CopyMenuDataHeader ld a, [wd0da] ld [wcf88], a ld a, [wd0e0] @@ -137,7 +137,7 @@ Function100e8: ; 100e8 (4:40e8) .asm_10110 push de call LoadMenuDataHeader - call Function1d81 + call InterpretMenu2 call Function1c07 pop hl ret c @@ -220,7 +220,7 @@ Function10186: ; 10186 (4:4186) Function10198: ; 10198 (4:4198) ld hl, MenuDataHeader_0x10aaf - call Function1d3c + call CopyMenuDataHeader ld a, [wd0db] ld [wcf88], a ld a, [wd0e1] @@ -289,7 +289,7 @@ Function101c5: ; 101c5 (4:41c5) .asm_10235 push de call LoadMenuDataHeader - call Function1d81 + call InterpretMenu2 call Function1c07 pop hl ret c @@ -709,7 +709,7 @@ Function104e9: ; 104e9 (4:44e9) Function104fa: ; 104fa (4:44fa) ld hl, MenuDataHeader_0x10a4f - call Function1d3c + call CopyMenuDataHeader ld a, [wd0d9] ld [wcf88], a ld a, [wd0df] @@ -737,7 +737,7 @@ Function10527: ; 10527 (4:4527) Function10539: ; 10539 (4:4539) ld hl, MenuDataHeader_0x10a7f - call Function1d3c + call CopyMenuDataHeader ld a, [wd0da] ld [wcf88], a ld a, [wd0e0] @@ -788,7 +788,7 @@ Function10594: ; 10594 (4:4594) Function105a6: ; 105a6 (4:45a6) ld hl, MenuDataHeader_0x10aaf - call Function1d3c + call CopyMenuDataHeader ld a, [wd0db] ld [wcf88], a ld a, [wd0e1] @@ -821,7 +821,7 @@ Function105dc: ; 105dc (4:45dc) .asm_105ed push de call LoadMenuDataHeader - call Function1d81 + call InterpretMenu2 call Function1c07 pop hl ret c @@ -992,7 +992,7 @@ Function106d9: ; 106d9 (4:46d9) xor a call Function10762 ld hl, MenuDataHeader_0x10a67 - call Function1d3c + call CopyMenuDataHeader ld a, [wd0d9] ld [wcf88], a ld a, [wd0df] @@ -1008,7 +1008,7 @@ Function106ff: ; 106ff (4:46ff) ld a, $2 call Function10762 ld hl, MenuDataHeader_0x10a97 - call Function1d3c + call CopyMenuDataHeader ld a, [wd0da] ld [wcf88], a ld a, [wd0e0] @@ -1033,7 +1033,7 @@ Function1073b: ; 1073b (4:473b) ld a, $1 call Function10762 ld hl, MenuDataHeader_0x10ac7 - call Function1d3c + call CopyMenuDataHeader ld a, [wd0db] ld [wcf88], a ld a, [wd0e1] @@ -1223,7 +1223,7 @@ Function1085a: ; 1085a (4:485a) push hl call Function10762 pop hl - call Function1d3c + call CopyMenuDataHeader call Function350c ret diff --git a/engine/phone_scripts.asm b/engine/phone_scripts.asm index c712e4d7a..f68e1166e 100644 --- a/engine/phone_scripts.asm +++ b/engine/phone_scripts.asm @@ -654,7 +654,7 @@ UnknownScript_0xbd3d1: UnknownScript_0xbd3f6: farscall UnknownScript_0xbde3f if_equal $0, UnknownScript_0xbd412 - checkflag ENGINE_51 + checkflag ENGINE_DAILY_BUG_CONTEST iftrue UnknownScript_0xbd412 checkcode VAR_WEEKDAY if_equal $2, UnknownScript_0xbd416 @@ -680,7 +680,7 @@ UnknownScript_0xbd428: farscall UnknownScript_0xbe1b6 farscall UnknownScript_0xbde3f if_equal $0, UnknownScript_0xbd44c - checkflag ENGINE_51 + checkflag ENGINE_DAILY_BUG_CONTEST iftrue UnknownScript_0xbd44c checkcode VAR_WEEKDAY if_equal $2, UnknownScript_0xbd480 @@ -1381,7 +1381,7 @@ UnknownScript_0xbda35: iftrue UnknownScript_0xbda67 farscall UnknownScript_0xbde3f if_equal $0, UnknownScript_0xbda5f - checkflag ENGINE_51 + checkflag ENGINE_DAILY_BUG_CONTEST iftrue UnknownScript_0xbda5f checkcode VAR_WEEKDAY if_equal $2, UnknownScript_0xbda63 @@ -1403,7 +1403,7 @@ UnknownScript_0xbda6e: farscall UnknownScript_0xbe1b6 farscall UnknownScript_0xbde3f if_equal $0, UnknownScript_0xbda92 - checkflag ENGINE_51 + checkflag ENGINE_DAILY_BUG_CONTEST iftrue UnknownScript_0xbda92 checkcode VAR_WEEKDAY if_equal $2, UnknownScript_0xbda9e @@ -3104,27 +3104,27 @@ String_be65b: db "Sister@" String_be662: db "Brother@" -UnknownScript_0xbe66a:: ; 0xbe66a +TalkToTrainerScript:: ; 0xbe66a faceplayer trainerstatus $2 - iftrue UnknownScript_0xbe698 + iftrue AlreadyBeatenTrainerScript loadtrainerdata playrammusic - jump UnknownScript_0xbe68a + jump StartBattleWithMapTrainerScript ; 0xbe675 -UnknownScript_0xbe675:: ; 0xbe675 +SeenByTrainerScript:: ; 0xbe675 loadtrainerdata playrammusic - showemote $0, $fe, 30 + showemote EMOTE_SHOCK, $fe, 30 callasm Function831e applymovement2 MovementBuffer writepersonxy $fe faceperson $0, $fe - jump UnknownScript_0xbe68a + jump StartBattleWithMapTrainerScript ; 0xbe68a -UnknownScript_0xbe68a: ; 0xbe68a +StartBattleWithMapTrainerScript: ; 0xbe68a loadfont trainertext $0 closetext @@ -3135,6 +3135,6 @@ UnknownScript_0xbe68a: ; 0xbe68a trainerstatus $1 loadvar wd04d, $ff -UnknownScript_0xbe698: +AlreadyBeatenTrainerScript: scripttalkafter ; 0xbe699 diff --git a/engine/scripting.asm b/engine/scripting.asm index 3012d14b3..6fd683fb7 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -1,9 +1,9 @@ ; Event scripting commands. -Function96c56:: ; 96c56 +EnableScriptMode:: ; 96c56 push af - ld a, 1 + ld a, SCRIPT_READ ld [ScriptMode], a pop af ret @@ -346,7 +346,7 @@ JumpTextFacePlayerScript: ; 0x96e79 faceplayer JumpTextScript: ; 0x96e7a loadfont - repeattext $ff, $ff + repeattext -1, -1 closetext loadmovesprites end @@ -385,7 +385,7 @@ Script_2writetext: ; 0x96e9b ld h, a ld a, [ScriptBank] ld b, a - call Function269a + call MapTextbox ret ; 0x96eab @@ -400,7 +400,7 @@ Script_3writetext: ; 0x96eab ld l, a call GetScriptByte ld h, a - call Function269a + call MapTextbox ret ; 0x96ebb @@ -414,27 +414,27 @@ Script_repeattext: ; 0x96ebb ld l, a call GetScriptByte ld h, a - cp $ff - jr nz, .asm_96ed8 ; 0x96ec5 $11 + cp -1 + jr nz, .done ; 0x96ec5 $11 ld a, l - cp $ff - jr nz, .asm_96ed8 ; 0x96eca $c + cp -1 + jr nz, .done ; 0x96eca $c ld hl, wd44e ld a, [hli] ld b, a ld a, [hli] ld h, [hl] ld l, a - call Function269a + call MapTextbox ret -.asm_96ed8 +.done ret ; 0x96ed9 Script_closetext: ; 0x96ed9 ; script command 0x54 - jp Functiona46 + jp CloseText ; 0x96edc Script_keeptextopen: ; 0x96edc @@ -445,7 +445,7 @@ Script_keeptextopen: ; 0x96edc ld a, $1 ld [$ffd8], a call WaitBGMap - call Functionaaf + call KeepTextOpen pop af ld [$ffd8], a ret @@ -456,9 +456,9 @@ Script_yesorno: ; 0x96eed call YesNoBox ld a, 0 - jr c, .asm_96ef6 ; 0x96ef2 $2 + jr c, .no ; 0x96ef2 $2 ld a, 1 -.asm_96ef6 +.no ld [ScriptVar], a ret ; 0x96efa @@ -474,16 +474,16 @@ Script_loadmenudata: ; 0x96efa ld h, a ld de, LoadMenuDataHeader ld a, [ScriptBank] - call Function26b7 - call Function1ad2 + call Call_a_de + call DrawOnMap ret ; 0x96f0f Script_writebackup: ; 0x96f0f ; script command 0x50 - call Function1c17 - call Function1ad2 + call WriteBackup + call DrawOnMap ret ; 0x96f16 @@ -498,14 +498,14 @@ Script_pokepic: ; 0x96f16 ld a, [ScriptVar] .ok ld [CurPartySpecies], a - callba Function244e3 + callba Pokepic ret ; 0x96f29 Script_pokepicyesorno: ; 0x96f29 ; script command 0x57 - callba Function24528 + callba PokepicYesOrNo ret ; 0x96f30 @@ -513,7 +513,7 @@ Script_interpretmenu2: ; 0x96f30 ; script command 0x59 ld a, [ScriptBank] - ld hl, Function1d81 + ld hl, InterpretMenu2 rst FarCall ld a, [wcfa9] jr nc, .ok @@ -527,7 +527,7 @@ Script_interpretmenu: ; 0x96f41 ; script command 0x58 ld a, [ScriptBank] - ld hl, Function202a + ld hl, InterpretMenu rst FarCall ld a, [wcf88] jr nc, .ok @@ -543,10 +543,10 @@ Script_storetext: ; 0x96f52 ; pointer (PointerLabelBeforeBank) ; memory (SingleByteParam) - call Function106c + call SetUpTextBox call GetScriptByte ld c, a - callba Function11c000 + callba StoreText ret ; 0x96f60 @@ -559,8 +559,8 @@ Script_verbosegiveitem: ; 0x96f60 call Script_giveitem call CurItemName ld de, StringBuffer1 - ld a, $1 - call Function976c8 + ld a, 1 + call CopyConvertedText ld b, BANK(GiveItemScript) ld de, GiveItemScript jp ScriptCall @@ -600,26 +600,26 @@ Script_verbosegiveitem2: ; 0x96f8e ; var (SingleByteParam) call GetScriptByte - cp $ff + cp -1 jr nz, .ok ld a, [ScriptVar] .ok ld [CurItem], a call GetScriptByte - call Function9769e + call GetVarAction ld a, [de] ld [wd10c], a ld hl, NumItems call ReceiveItem - ld a, $1 + ld a, 1 jr c, .ok2 xor a .ok2 ld [ScriptVar], a call CurItemName ld de, StringBuffer1 - ld a, $1 - call Function976c8 + ld a, 1 + call CopyConvertedText ld b, BANK(GiveItemScript) ld de, GiveItemScript jp ScriptCall @@ -632,7 +632,7 @@ Script_itemnotify: ; 0x96fc6 call CurItemName ld b, BANK(PutItemInPocketText) ld hl, PutItemInPocketText - call Function269a + call MapTextbox ret ; 0x96fd5 @@ -643,7 +643,7 @@ Script_pocketisfull: ; 0x96fd5 call CurItemName ld b, BANK(PocketIsFullText) ld hl, PocketIsFullText - call Function269a + call MapTextbox ret ; 0x96fe4 @@ -746,7 +746,7 @@ Script_elevator: ; 0x9707c ld d, a ld a, [ScriptBank] ld b, a - callba Function1342d + callba Elevator ret c ld a, $1 ld [ScriptVar], a @@ -775,14 +775,14 @@ Script_phonecall: ; 0x970a4 ld d, a ld a, [ScriptBank] ld b, a - callba Function9029a + callba PhoneCall ret ; 0x970b7 Script_hangup: ; 0x970b7 ; script command 0x99 - callba Function902eb + callba HangUp ret ; 0x970be @@ -792,20 +792,20 @@ Script_askforphonenumber: ; 0x970be ; number (SingleByteParam) call YesNoBox - jr c, .asm_970d6 ; 0x970c1 $13 + jr c, .refused ; 0x970c1 $13 call GetScriptByte ld c, a - callba Function90000 - jr c, .asm_970d2 ; 0x970cd $3 + callba AddPhoneNumber + jr c, .phonefull ; 0x970cd $3 xor a - jr .asm_970db ; 0x970d0 $9 -.asm_970d2 - ld a, $1 - jr .asm_970db ; 0x970d4 $5 -.asm_970d6 + jr .done ; 0x970d0 $9 +.phonefull + ld a, 1 + jr .done ; 0x970d4 $5 +.refused call GetScriptByte - ld a, $2 -.asm_970db + ld a, 2 +.done ld [ScriptVar], a ret ; 0x970df @@ -817,7 +817,7 @@ Script_describedecoration: ; 0x970df call GetScriptByte ld b, a - callba Function26f59 + callba DescribeDecoration ld h, d ld l, e jp ScriptJump @@ -848,7 +848,7 @@ Script_loadwilddata: ; 0x970fc ld d, a call GetScriptByte ld e, a - callba Functionc403 + callba LoadWildData ret ; 0x9710f @@ -859,7 +859,7 @@ Script_trainertext: ; 0x9710f call GetScriptByte ld c, a - ld b, $0 + ld b, 0 ld hl, WalkingX add hl, bc add hl, bc @@ -868,7 +868,7 @@ Script_trainertext: ; 0x9710f ld l, a ld a, [EngineBuffer1] ld b, a - call Function269a + call MapTextbox ret ; 0x97125 @@ -901,7 +901,7 @@ Script_trainerstatus: ; 0x97132 ld a, c and a ret z - ld a, $1 + ld a, 1 ld [ScriptVar], a ret ; 0x9714c @@ -937,7 +937,7 @@ Script_talkaftercancel: ; 0x97163 Script_talkaftercheck: ; 0x9716b ; script command 0x67 - ld a, $1 + ld a, 1 ld [ScriptVar], a ld a, [wd04d] and a @@ -1042,7 +1042,7 @@ Script_cry: ; 0x971d1 ret ; 0x971e3 -Function971e3: ; 0x971e3 +GetScriptPerson: ; 0x971e3 and a ret z cp $fe @@ -1057,7 +1057,7 @@ Script_setlasttalked: ; 0x971ea ; person (SingleByteParam) call GetScriptByte - call Function971e3 + call GetScriptPerson ld [$ffe0], a ret ; 0x971f3 @@ -1069,17 +1069,17 @@ Script_applymovement: ; 0x971f3 ; data (MovementPointerLabelParam) call GetScriptByte - call Function971e3 + call GetScriptPerson ld c, a ; 971fa -Function971fa: ; 971fa +ApplyMovement: ; 971fa push bc ld a, c - callba Function585c + callba SetFlagsForMovement_1 pop bc push bc - call Function97221 + call SetFlagsForMovement_2 pop bc call GetScriptByte ld l, a @@ -1087,7 +1087,7 @@ Function971fa: ; 971fa ld h, a ld a, [ScriptBank] ld b, a - call Function26c7 + call GetMovementData ret c ld a, SCRIPT_WAIT_MOVEMENT ld [ScriptMode], a @@ -1095,8 +1095,8 @@ Function971fa: ; 971fa ret ; 0x97221 -Function97221: ; 0x97221 - callba Function5897 +SetFlagsForMovement_2: ; 0x97221 + callba _SetFlagsForMovement_2 ret ; 0x97228 @@ -1107,7 +1107,7 @@ Script_applymovement2: ; 0x97228 ld a, [$ffe0] ld c, a - jp Function971fa + jp ApplyMovement ; 0x9722e Script_faceplayer: ; 0x9722e @@ -1119,14 +1119,14 @@ Script_faceplayer: ; 0x9722e ld d, $0 ld a, [$ffe0] ld e, a - callba Function8417 + callba GetRelativeFacing ld a, d add a add a ld e, a ld a, [$ffe0] ld d, a - call Function9728b + call ApplyPersonFacing ret ; 0x97248 @@ -1137,21 +1137,21 @@ Script_faceperson: ; 0x97248 ; person2 (SingleByteParam) call GetScriptByte - call Function971e3 + call GetScriptPerson cp $fe jr c, .asm_97254 ; 0x97250 $2 ld a, [$ffe0] .asm_97254 ld e, a call GetScriptByte - call Function971e3 + call GetScriptPerson cp $fe jr nz, .asm_97261 ; 0x9725d $2 ld a, [$ffe0] .asm_97261 ld d, a push de - callba Function8417 + callba GetRelativeFacing pop bc ret c ld a, d @@ -1159,7 +1159,7 @@ Script_faceperson: ; 0x97248 add a ld e, a ld d, c - call Function9728b + call ApplyPersonFacing ret ; 0x97274 @@ -1170,7 +1170,7 @@ Script_spriteface: ; 0x97274 ; facing (SingleByteParam) call GetScriptByte - call Function971e3 + call GetScriptPerson cp $fe jr nz, .asm_97280 ; 0x9727c $2 ld a, [$ffe0] @@ -1180,37 +1180,37 @@ Script_spriteface: ; 0x97274 add a add a ld e, a - call Function9728b + call ApplyPersonFacing ret ; 0x9728b -Function9728b: ; 0x9728b +ApplyPersonFacing: ; 0x9728b ld a, d push de call Function18de - jr c, .asm_972b9 ; 0x97290 $27 - ld hl, $0000 + jr c, .not_visible ; 0x97290 $27 + ld hl, OBJECT_SPRITE add hl, bc ld a, [hl] push bc call Function1836 pop bc - jr c, .asm_972b9 ; 0x9729c $1b - ld hl, $0004 + jr c, .not_visible ; 0x9729c $1b + ld hl, OBJECT_04 add hl, bc bit 2, [hl] - jr nz, .asm_972b9 ; 0x972a4 $13 + jr nz, .not_visible ; 0x972a4 $13 pop de ld a, e - call Function1af8 + call SetSpriteDirection ld hl, VramState bit 6, [hl] jr nz, .asm_972b5 ; 0x972b0 $3 call Function972bc .asm_972b5 - call Function1ad2 + call DrawOnMap ret -.asm_972b9 +.not_visible pop de scf ret @@ -1252,7 +1252,7 @@ Script_appear: ; 0x972dd ; person (SingleByteParam) call GetScriptByte - call Function971e3 + call GetScriptPerson call Function1956 ld a, [$ffaf] ld b, $0 @@ -1266,7 +1266,7 @@ Script_disappear: ; 0x972ee ; person (SingleByteParam) call GetScriptByte - call Function971e3 + call GetScriptPerson cp $fe jr nz, .asm_972fa ; 0x972f6 $2 ld a, [$ffe0] @@ -1307,10 +1307,10 @@ Script_follow: ; 0x97325 ; person1 (SingleByteParam) call GetScriptByte - call Function971e3 + call GetScriptPerson ld b, a call GetScriptByte - call Function971e3 + call GetScriptPerson ld c, a callba Function5803 ret @@ -1331,7 +1331,7 @@ Script_moveperson: ; 0x97341 ; y (SingleByteParam) call GetScriptByte - call Function971e3 + call GetScriptPerson ld b, a call GetScriptByte add $4 @@ -1349,7 +1349,7 @@ Script_writepersonxy: ; 0x9735b ; person (SingleByteParam) call GetScriptByte - call Function971e3 + call GetScriptPerson cp $fe jr nz, .asm_97367 ; 0x97363 $2 ld a, [$ffe0] @@ -1366,10 +1366,10 @@ Script_follownotexact: ; 0x9736f ; person1 (SingleByteParam) call GetScriptByte - call Function971e3 + call GetScriptPerson ld b, a call GetScriptByte - call Function971e3 + call GetScriptPerson ld c, a callba Function839e ret @@ -1400,7 +1400,7 @@ Script_showemote: ; 0x97396 call GetScriptByte ld [ScriptVar], a call GetScriptByte - call Function971e3 + call GetScriptPerson cp $fe jr z, .asm_973a8 ; 0x973a4 $2 ld [$ffe0], a @@ -1525,7 +1525,7 @@ Script_loadtrainer: ; 0x97424 Script_startbattle: ; 0x97436 ; script command 0x5f - call Function2879 + call BufferScreen predef StartBattle ld a, [wd0ee] and $3f @@ -1540,7 +1540,7 @@ Script_catchtutorial: ; 0x97447 call GetScriptByte ld [BattleType], a - call Function2879 + call BufferScreen callba Function4e554 jp Script_reloadmap ; 0x97459 @@ -1582,7 +1582,7 @@ Script_reloadmap: ; 0x97491 ld a, $f3 ld [$ff9f], a ld a, $1 - call Function261b + call LoadMapStatus call StopScript ret ; 0x974a2 @@ -1858,7 +1858,7 @@ Script_priorityjump: ; 0x975aa Script_checktriggers: ; 0x975c2 ; script command 0x13 - call Function211b + call CheckTriggers jr z, .asm_975cb ; 0x975c5 $4 ld [ScriptVar], a ret @@ -2051,7 +2051,7 @@ Script_checkcode: ; 0x9767d ; variable_id (SingleByteParam) call GetScriptByte - call Function9769e + call GetVarAction ld a, [de] ld [ScriptVar], a ret @@ -2063,7 +2063,7 @@ Script_writevarcode: ; 0x97688 ; variable_id (SingleByteParam) call GetScriptByte - call Function9769e + call GetVarAction ld a, [ScriptVar] ld [de], a ret @@ -2076,15 +2076,15 @@ Script_writecode: ; 0x97693 ; value (SingleByteParam) call GetScriptByte - call Function9769e + call GetVarAction call GetScriptByte ld [de], a ret ; 0x9769e -Function9769e: ; 0x9769e +GetVarAction: ; 0x9769e ld c, a - callba Function80648 + callba _GetVarAction ret ; 0x976a6 @@ -2103,26 +2103,26 @@ Version: ; 976ad Script_pokenamemem: ; 0x976ae ; script command 0x40 ; parameters: -; pokemon (PokemonParam) +; pokemon (PokemonParam); leave $0 to draw from script var ; memory (SingleByteParam) call GetScriptByte and a - jr nz, .asm_976b7 ; 0x976b2 $3 + jr nz, .gotit ; 0x976b2 $3 ld a, [ScriptVar] -.asm_976b7 +.gotit ld [wd265], a call GetPokemonName ld de, StringBuffer1 -Unknown_976c0: ; 0x976c0 +ConvertMemToText: ; 0x976c0 call GetScriptByte cp 3 jr c, .ok xor a .ok -Function976c8: ; 976c8 +CopyConvertedText: ; 976c8 ld hl, StringBuffer3 ld bc, 19 call AddNTimes @@ -2138,13 +2138,13 @@ Script_itemtotext: ; 0x976d5 call GetScriptByte and a - jr nz, .asm_976de ; 0x976d9 $3 + jr nz, .ok ; 0x976d9 $3 ld a, [ScriptVar] -.asm_976de +.ok ld [wd265], a call GetItemName ld de, StringBuffer1 - jr Unknown_976c0 ; 0x976e7 $d7 + jr ConvertMemToText ; 0x976e7 $d7 ; 0x976e9 Script_mapnametotext: ; 0x976e9 @@ -2158,11 +2158,11 @@ Script_mapnametotext: ; 0x976e9 ld c, a call GetWorldMapLocation -Unknown_976f4: ; 0x976f4 +ConvertLandmarkToText: ; 0x976f4 ld e, a callba GetLandmarkName ld de, StringBuffer1 - jp Unknown_976c0 + jp ConvertMemToText ; 0x97701 Script_displaylocation: ; 0x97701 @@ -2172,7 +2172,7 @@ Script_displaylocation: ; 0x97701 ; memory (SingleByteParam) call GetScriptByte - jr Unknown_976f4 ; 0x97704 $ee + jr ConvertLandmarkToText ; 0x97704 $ee ; 0x97706 Script_trainertotext: ; 0x97706 @@ -2186,8 +2186,8 @@ Script_trainertotext: ; 0x97706 ld c, a call GetScriptByte ld b, a - callba Function3994c - jr Unknown_976c0 ; 0x97714 $aa + callba GetTrainerName + jr ConvertMemToText ; 0x97714 $aa ; 0x97716 Script_name: ; 0x97716 @@ -2205,7 +2205,7 @@ Unknown_9771c: ; 0x9771c ld [CurSpecies], a call GetName ld de, StringBuffer1 - jp Unknown_976c0 + jp ConvertMemToText ; 0x9772b Script_trainerclassname: ; 0x9772b @@ -2225,13 +2225,13 @@ Script_readmoney: ; 0x97732 ; account (SingleByteParam) ; memory (SingleByteParam) - call Function97771 - call Function97861 + call ResetStringBuffer1 + call GetMoneyAccount ld hl, StringBuffer1 ld bc, $4306 call PrintNum ld de, StringBuffer1 - jp Unknown_976c0 + jp ConvertMemToText ; 0x97747 Script_readcoins: ; 0x97747 @@ -2239,13 +2239,13 @@ Script_readcoins: ; 0x97747 ; parameters: ; memory (SingleByteParam) - call Function97771 + call ResetStringBuffer1 ld hl, StringBuffer1 ld de, Coins ld bc, $4206 call PrintNum ld de, StringBuffer1 - jp Unknown_976c0 + jp ConvertMemToText ; 0x9775c Script_RAM2MEM: ; 0x9775c @@ -2253,18 +2253,18 @@ Script_RAM2MEM: ; 0x9775c ; parameters: ; memory (SingleByteParam) - call Function97771 + call ResetStringBuffer1 ld de, ScriptVar ld hl, StringBuffer1 ld bc, $4103 call PrintNum ld de, StringBuffer1 - jp Unknown_976c0 + jp ConvertMemToText ; 0x97771 -Function97771: ; 0x97771 +ResetStringBuffer1: ; 0x97771 ld hl, StringBuffer1 - ld bc, $000b + ld bc, NAME_LENGTH ld a, "@" call ByteFill ret @@ -2284,7 +2284,7 @@ Script_stringtotext: ; 0x9777d ld hl, CopyName1 rst FarCall ld de, StringBuffer2 - jp Unknown_976c0 + jp ConvertMemToText ; 0x97792 Script_givepokeitem: ; 0x97792 @@ -2301,12 +2301,12 @@ Script_givepokeitem: ; 0x97792 ld b, a push bc inc hl - ld bc, $0020 + ld bc, MAIL_MAX_LENGTH ld de, wd002 ld a, [ScriptBank] call FarCopyBytes pop bc - callba Function446cc + callba GivePokeItem ret ; 0x977b7 @@ -2332,20 +2332,20 @@ Script_giveitem: ; 0x977ca ; quantity (SingleByteParam) call GetScriptByte - cp $ff - jr nz, .asm_977d4 ; 0x977cf $3 + cp -1 + jr nz, .ok ; 0x977cf $3 ld a, [ScriptVar] -.asm_977d4 +.ok ld [CurItem], a call GetScriptByte ld [wd10c], a ld hl, NumItems call ReceiveItem - jr nc, .asm_977eb ; 0x977e3 $6 + jr nc, .full ; 0x977e3 $6 ld a, $1 ld [ScriptVar], a ret -.asm_977eb +.full xor a ld [ScriptVar], a ret @@ -2396,9 +2396,9 @@ Script_givemoney: ; 0x97829 ; account (SingleByteParam) ; money (MoneyByteParam) - call Function97861 - call Function9786d - callba Function15fd7 + call GetMoneyAccount + call LoadMoneyAmountToMem + callba GiveMoney ret ; 0x97836 @@ -2408,9 +2408,9 @@ Script_takemoney: ; 0x97836 ; account (SingleByteParam) ; money (MoneyByteParam) - call Function97861 - call Function9786d - callba Function15ffa + call GetMoneyAccount + call LoadMoneyAmountToMem + callba TakeMoney ret ; 0x97843 @@ -2420,12 +2420,12 @@ Script_checkmoney: ; 0x97843 ; account (SingleByteParam) ; money (MoneyByteParam) - call Function97861 - call Function9786d - callba Function1600b + call GetMoneyAccount + call LoadMoneyAmountToMem + callba CheckMoney ; 0x9784f -Unknown_9784f: ; 0x9784f +CheckMoneyAction: ; 0x9784f jr c, .two jr z, .one ld a, 0 @@ -2440,7 +2440,7 @@ Unknown_9784f: ; 0x9784f ret ; 0x97861 -Function97861: ; 0x97861 +GetMoneyAccount: ; 0x97861 call GetScriptByte and a ld de, Money @@ -2449,7 +2449,7 @@ Function97861: ; 0x97861 ret ; 0x9786d -Function9786d: ; 0x9786d +LoadMoneyAmountToMem: ; 0x9786d ld bc, $ffc3 push bc call GetScriptByte @@ -2469,8 +2469,8 @@ Script_givecoins: ; 0x97881 ; parameters: ; coins (CoinByteParam) - call Function978a0 - callba Function1606f + call LoadCoinAmountToMem + callba GiveCoins ret ; 0x9788b @@ -2479,8 +2479,8 @@ Script_takecoins: ; 0x9788b ; parameters: ; coins (CoinByteParam) - call Function978a0 - callba Function1608f + call LoadCoinAmountToMem + callba TakeCoins ret ; 0x97895 @@ -2489,12 +2489,12 @@ Script_checkcoins: ; 0x97895 ; parameters: ; coins (CoinByteParam) - call Function978a0 - callba Function160a1 - jr Unknown_9784f + call LoadCoinAmountToMem + callba CheckCoins + jr CheckMoneyAction ; 978a0 -Function978a0: ; 978a0 +LoadCoinAmountToMem: ; 978a0 call GetScriptByte ld [$ffc4], a call GetScriptByte @@ -2510,7 +2510,7 @@ Script_checktime: ; 0x978ae xor a ld [ScriptVar], a - callba Functionc000 + callba CheckTime call GetScriptByte and c ret z @@ -2545,7 +2545,7 @@ Script_addcellnum: ; 0x978da ld [ScriptVar], a call GetScriptByte ld c, a - callba Function90000 + callba AddPhoneNumber ret nc ld a, $1 ld [ScriptVar], a @@ -2561,7 +2561,7 @@ Script_delcellnum: ; 0x978ef ld [ScriptVar], a call GetScriptByte ld c, a - callba Function9000f + callba DelCellNum ret nc ld a, $1 ld [ScriptVar], a @@ -2577,7 +2577,7 @@ Script_checkcellnum: ; 0x97904 ld [ScriptVar], a call GetScriptByte ld c, a - callba Function90019 + callba CheckCellNum ret nc ld a, $1 ld [ScriptVar], a @@ -2637,7 +2637,7 @@ Script_givepoke: ; 0x97932 call GetScriptByte call GetScriptByte .ok - callba Functione277 + callba GivePoke ld a, b ld [ScriptVar], a ret @@ -2721,7 +2721,7 @@ Script_setflag: ; 0x979bb call GetScriptByte ld d, a ld b, $1 - call Function979ee + call _EngineFlagAction ret ; 0x979c9 @@ -2735,7 +2735,7 @@ Script_clearflag: ; 0x979c9 call GetScriptByte ld d, a ld b, $0 - call Function979ee + call _EngineFlagAction ret ; 0x979d7 @@ -2749,7 +2749,7 @@ Script_checkflag: ; 0x979d7 call GetScriptByte ld d, a ld b, $2 - call Function979ee + call _EngineFlagAction ld a, c and a jr z, .asm_979ea ; 0x979e6 $2 @@ -2759,7 +2759,7 @@ Script_checkflag: ; 0x979d7 ret ; 0x979ee -Function979ee: ; 0x979ee +_EngineFlagAction: ; 0x979ee callba EngineFlagAction ret ; 0x979f5 @@ -2820,7 +2820,7 @@ Script_warp: ; 0x97a1d call GetScriptByte and a - jr z, .asm_97a4a ; 0x97a21 $27 + jr z, .not_ok ; 0x97a21 $27 ld [MapGroup], a call GetScriptByte ld [MapNumber], a @@ -2833,10 +2833,10 @@ Script_warp: ; 0x97a1d ld a, $f1 ld [$ff9f], a ld a, $1 - call Function261b + call LoadMapStatus call StopScript ret -.asm_97a4a +.not_ok call GetScriptByte call GetScriptByte call GetScriptByte @@ -2845,7 +2845,7 @@ Script_warp: ; 0x97a1d ld a, $fb ld [$ff9f], a ld a, $1 - call Function261b + call LoadMapStatus call StopScript ret ; 0x97a65 @@ -2929,8 +2929,8 @@ Script_changemap: ; 0x97ab3 ld [MapBlockDataPointer], a call GetScriptByte ld [MapBlockDataPointer + 1], a - call Function24e4 - call Function2879 + call ChangeMap + call BufferScreen ret ; 0x97acc @@ -2947,10 +2947,10 @@ Script_changeblock: ; 0x97acc call GetScriptByte add $4 ld e, a - call Function2a66 + call GetBlockLocation call GetScriptByte ld [hl], a - call Function2879 + call BufferScreen ret ; 0x97ae3 @@ -2962,7 +2962,7 @@ Script_reloadmappart:: ; 0x97ae3 call Function2173 call Function2914 callba Function104061 - call Function1ad2 + call DrawOnMap ret ; 0x97af6 @@ -2971,12 +2971,12 @@ Script_warpcheck: ; 0x97af6 call Function224a ret nc - callba Function966d0 + callba SetAll_ScriptFlags3 ret ; 0x97b01 Function97b01: ; 0x97b01 - callba Function966d0 + callba SetAll_ScriptFlags3 ret ; 0x97b08 @@ -2988,7 +2988,7 @@ Script_newloadmap: ; 0x97b08 call GetScriptByte ld [$ff9f], a ld a, $1 - call Function261b + call LoadMapStatus call StopScript ret ; 0x97b16 @@ -3196,7 +3196,7 @@ Script_credits: ; 0x97bf3 DisplayCredits: call Script_resetfuncs ld a, $3 - call Function261b + call LoadMapStatus call StopScript ret ; 0x97c051 diff --git a/engine/spawn_points.asm b/engine/spawn_points.asm index 874faabd7..dba86c582 100644 --- a/engine/spawn_points.asm +++ b/engine/spawn_points.asm @@ -41,22 +41,22 @@ ENDM spawn BLACKTHORN, BLACKTHORN_CITY, 21, 30 spawn MT_SILVER, SILVER_CAVE_OUTSIDE, 23, 20 spawn FAST_SHIP, FAST_SHIP_CABINS_SW_SSW_NW, 6, 2 +const_value = -1 + spawn N_A, N_A, -1, -1 - db -1, -1, -1, -1 - - const NUM_SPAWNS +NUM_SPAWNS EQU const_value LoadSpawnPoint: ; 1531f + ; loads the spawn point in wd001 push hl push de ld a, [wd001] - cp -1 - jr z, .asm_15341 + cp SPAWN_N_A + jr z, .spawn_n_a ld l, a ld h, 0 - add hl, hl - add hl, hl + add_n_times hl, hl, 2 ; multiply hl by 4 ld de, SpawnPoints add hl, de ld a, [hli] @@ -67,7 +67,7 @@ LoadSpawnPoint: ; 1531f ld [XCoord], a ld a, [hli] ld [YCoord], a -.asm_15341 +.spawn_n_a pop de pop hl ret @@ -75,32 +75,33 @@ LoadSpawnPoint: ; 1531f IsSpawnPoint: ; 15344 +; Checks if the map loaded in de is a spawn point. Returns carry if it's a spawn point. ld hl, SpawnPoints ld c, 0 -.asm_15349 +.loop ld a, [hl] - cp -1 - jr z, .asm_1535f + cp SPAWN_N_A + jr z, .nope cp d - jr nz, .asm_15356 + jr nz, .next inc hl ld a, [hld] cp e - jr z, .asm_15361 + jr z, .yes -.asm_15356 +.next push bc ld bc, 4 add hl, bc pop bc inc c - jr .asm_15349 + jr .loop -.asm_1535f +.nope and a ret -.asm_15361 +.yes scf ret ; 15363 diff --git a/engine/specials.asm b/engine/specials.asm index 35af3160d..949cf8b1b 100644 --- a/engine/specials.asm +++ b/engine/specials.asm @@ -36,10 +36,10 @@ SpecialsPointers:: ; c029 add_special Functionc2f6 add_special Functionc309 add_special Function1050b9 - add_special Functionc34a - add_special Function4d9e5 + add_special BugContestJudging + add_special CheckPartyFullAfterContest add_special Function13a12 - add_special Function13a31 + add_special ContestReturnMons add_special Function135db add_special Functionfbb32 add_special Functionfbcd2 @@ -71,7 +71,7 @@ SpecialsPointers:: ; c029 add_special WhiteBGMap add_special UpdateTimePals add_special ClearTileMap - add_special Function1ad2 + add_special DrawOnMap add_special Functione4a add_special Functionc230 add_special SpecialSeenMon @@ -105,7 +105,7 @@ SpecialsPointers:: ; c029 add_special Function88018 add_special SpecialNameRater add_special Functionc2da - add_special Function718d + add_special GetFirstPokemonHappiness add_special Function71ac add_special Function2a4ab add_special Function2a51f @@ -173,7 +173,7 @@ SpecialsPointers:: ; c029 add_special Function10366e add_special Function1037eb add_special Function10383c - add_special Function1060a2 + add_special Mobile_HealParty add_special Function14168 add_special Function1037c2 add_special Function10630f @@ -358,8 +358,8 @@ UnknownText_0xc345: ; 0xc345 db "@" ; 0xc34a -Functionc34a: ; c34a - callba Function1369d +BugContestJudging: ; c34a + callba _BugContestJudging ld a, b ld [ScriptVar], a ret @@ -463,7 +463,7 @@ UnknownText_0xc3d6: ; 0xc3d6 Functionc3db: ; c3db call WhiteBGMap - call Function2879 + call BufferScreen ret ; c3e2 @@ -492,17 +492,18 @@ Functionc3fc: ; c3fc ; c403 -Functionc403:: ; c403 +LoadWildData:: ; c403 ld a, c and a - jr nz, .asm_c410 + jr nz, .swarm_route35 +; swarm dark cave violet entrance ld a, d ld [wdfcc], a ld a, e ld [wdfcd], a ret -.asm_c410 +.swarm_route35 ld a, d ld [wdc5a], a ld a, e diff --git a/engine/std_scripts.asm b/engine/std_scripts.asm index 4315a07f1..885bde7e9 100644 --- a/engine/std_scripts.asm +++ b/engine/std_scripts.asm @@ -46,10 +46,10 @@ StdScripts:: dbw BANK(RematchGiftFScript), RematchGiftFScript dbw BANK(GymStatue1Script), GymStatue1Script dbw BANK(GymStatue2Script), GymStatue2Script - dbw BANK(UnknownScript_0xbcdb9), UnknownScript_0xbcdb9 - dbw BANK(UnknownScript_0xbcdc3), UnknownScript_0xbcdc3 + dbw BANK(ReceiveItemScript), ReceiveItemScript + dbw BANK(ReceiveTogepiEggScript), ReceiveTogepiEggScript dbw BANK(PCScript), PCScript - dbw BANK(UnknownScript_0xbcdcd), UnknownScript_0xbcdcd + dbw BANK(GameCornerCoinVendorScript), GameCornerCoinVendorScript dbw BANK(HappinessCheckScript), HappinessCheckScript PokeCenterNurseScript: @@ -107,12 +107,12 @@ PokeCenterNurseScript: farwritetext UnknownText_0x1b01bd pause 20 - special Function1060a2 + special Mobile_HealParty spriteface $fe, LEFT pause 10 special HealParty playmusic MUSIC_NONE - writebyte 0 + writebyte 0 ; Machine is at a Pokemon Center special HealMachineAnim pause 30 special RestartMapMusic @@ -303,57 +303,57 @@ RadioTowerRocketsScript: BugContestResultsWarpScript: special WhiteBGMap - scall UnknownScript_0xbc380 + scall BugContestResults_EnsureNoDuplicateSprites setevent EVENT_747 clearevent EVENT_748 setevent EVENT_2D2 warp GROUP_ROUTE_36_NATIONAL_PARK_GATE, MAP_ROUTE_36_NATIONAL_PARK_GATE, $0, $4 - applymovement $0, MovementData_0xbcea1 + applymovement $0, Movement_ContestResults_WalkAfterWarp BugContestResultsScript: clearflag ENGINE_BUG_CONTEST_TIMER clearevent EVENT_2D2 - clearevent EVENT_313 - clearevent EVENT_314 - clearevent EVENT_315 - clearevent EVENT_316 + clearevent EVENT_CONTEST_OFFICER_HAS_SUN_STONE + clearevent EVENT_CONTEST_OFFICER_HAS_EVERSTONE + clearevent EVENT_CONTEST_OFFICER_HAS_GOLD_BERRY + clearevent EVENT_CONTEST_OFFICER_HAS_BERRY loadfont - farwritetext UnknownText_0x1b05bf + farwritetext ContestResults_ReadyToJudgeText closetext - special Functionc34a + special BugContestJudging RAM2MEM $0 - if_equal $1, UnknownScript_0xbc31e - if_equal $2, UnknownScript_0xbc332 - if_equal $3, UnknownScript_0xbc343 - farwritetext UnknownText_0x1b0681 + if_equal 1, BugContestResults_FirstPlace + if_equal 2, BugContestResults_SecondPlace + if_equal 3, BugContestResults_ThirdPlace + farwritetext ContestResults_ConsolationPrizeText keeptextopen waitbutton verbosegiveitem BERRY, 1 - iffalse UnknownScript_0xbc375 + iffalse BugContestResults_NoRoomForBerry -UnknownScript_0xbc2a9: - farwritetext UnknownText_0x1b06b7 +BugContestResults_DidNotWin + farwritetext ContestResults_DidNotWinText keeptextopen - jump UnknownScript_0xbc2b6 + jump BugContestResults_FinishUp ; 0xbc2b1 -UnknownScript_0xbc2b1: ; 0xbc2b1 - farwritetext UnknownText_0x1b065b +BugContestResults_ReturnAfterWinnersPrize ; 0xbc2b1 + farwritetext ContestResults_JoinUsNextTimeText keeptextopen -UnknownScript_0xbc2b6: - checkevent EVENT_308 - iffalse UnknownScript_0xbc2c4 - farwritetext UnknownText_0x1b06d9 +BugContestResults_FinishUp + checkevent EVENT_LEFT_MONS_WITH_CONTEST_OFFICER + iffalse BugContestResults_DidNotLeaveMons + farwritetext ContestResults_ReturnPartyText closetext - special Function13a31 -UnknownScript_0xbc2c4: - special Function4d9e5 - if_equal $0, UnknownScript_0xbc2d4 - if_equal $2, UnknownScript_0xbc2d4 - farwritetext UnknownText_0x1b070d + special ContestReturnMons +BugContestResults_DidNotLeaveMons + special CheckPartyFullAfterContest + if_equal $0, BugContestResults_CleanUp + if_equal $2, BugContestResults_CleanUp + farwritetext ContestResults_PartyFullText closetext -UnknownScript_0xbc2d4: +BugContestResults_CleanUp loadmovesprites dotrigger $0 domaptrigger GROUP_ROUTE_35_NATIONAL_PARK_GATE, MAP_ROUTE_35_NATIONAL_PARK_GATE, $0 @@ -377,68 +377,68 @@ UnknownScript_0xbc2d4: setevent EVENT_727 setevent EVENT_728 setevent EVENT_729 - setflag ENGINE_51 + setflag ENGINE_DAILY_BUG_CONTEST special PlayMapMusic end ; 0xbc31e -UnknownScript_0xbc31e: ; 0xbc31e +BugContestResults_FirstPlace ; 0xbc31e setevent EVENT_000 itemtotext SUN_STONE, $1 - farwritetext UnknownText_0x1b0621 + farwritetext ContestResults_PlayerWonAPrizeText closetext verbosegiveitem SUN_STONE, 1 - iffalse UnknownScript_0xbc354 - jump UnknownScript_0xbc2b1 + iffalse BugContestResults_NoRoomForSunStone + jump BugContestResults_ReturnAfterWinnersPrize ; 0xbc332 -UnknownScript_0xbc332: ; 0xbc332 +BugContestResults_SecondPlace ; 0xbc332 itemtotext EVERSTONE, $1 - farwritetext UnknownText_0x1b0621 + farwritetext ContestResults_PlayerWonAPrizeText closetext verbosegiveitem EVERSTONE, 1 - iffalse UnknownScript_0xbc35f - jump UnknownScript_0xbc2b1 + iffalse BugContestResults_NoRoomForEverstone + jump BugContestResults_ReturnAfterWinnersPrize ; 0xbc343 -UnknownScript_0xbc343: ; 0xbc343 +BugContestResults_ThirdPlace ; 0xbc343 itemtotext GOLD_BERRY, $1 - farwritetext UnknownText_0x1b0621 + farwritetext ContestResults_PlayerWonAPrizeText closetext verbosegiveitem GOLD_BERRY, 1 - iffalse UnknownScript_0xbc36a - jump UnknownScript_0xbc2b1 + iffalse BugContestResults_NoRoomForGoldBerry + jump BugContestResults_ReturnAfterWinnersPrize ; 0xbc354 -UnknownScript_0xbc354: ; 0xbc354 +BugContestResults_NoRoomForSunStone ; 0xbc354 farwritetext UnknownText_0x1b08cc keeptextopen - setevent EVENT_313 - jump UnknownScript_0xbc2b1 + setevent EVENT_CONTEST_OFFICER_HAS_SUN_STONE + jump BugContestResults_ReturnAfterWinnersPrize ; 0xbc35f -UnknownScript_0xbc35f: ; 0xbc35f +BugContestResults_NoRoomForEverstone ; 0xbc35f farwritetext UnknownText_0x1b08cc keeptextopen - setevent EVENT_314 - jump UnknownScript_0xbc2b1 + setevent EVENT_CONTEST_OFFICER_HAS_EVERSTONE + jump BugContestResults_ReturnAfterWinnersPrize ; 0xbc36a -UnknownScript_0xbc36a: ; 0xbc36a +BugContestResults_NoRoomForGoldBerry ; 0xbc36a farwritetext UnknownText_0x1b08cc keeptextopen - setevent EVENT_315 - jump UnknownScript_0xbc2b1 + setevent EVENT_CONTEST_OFFICER_HAS_GOLD_BERRY + jump BugContestResults_ReturnAfterWinnersPrize ; 0xbc375 -UnknownScript_0xbc375: ; 0xbc375 +BugContestResults_NoRoomForBerry ; 0xbc375 farwritetext UnknownText_0x1b08cc keeptextopen - setevent EVENT_316 - jump UnknownScript_0xbc2a9 + setevent EVENT_CONTEST_OFFICER_HAS_BERRY + jump BugContestResults_DidNotWin ; 0xbc380 -UnknownScript_0xbc380: ; 0xbc380 +BugContestResults_EnsureNoDuplicateSprites ; 0xbc380 checkevent EVENT_716 iftrue .skip1 clearevent EVENT_720 @@ -561,7 +561,7 @@ InitializeEventsScript: setevent EVENT_731 setevent EVENT_74A setevent EVENT_RED_IN_MT_SILVER - setevent EVENT_738 + setevent EVENT_OLIVINE_PORT_SPRITES_AFTER_HALL_OF_FAME setevent EVENT_73A setevent EVENT_73B setevent EVENT_733 @@ -623,26 +623,26 @@ InitializeEventsScript: AskNumber1MScript: special RandomPhoneMon checkcode VAR_CALLERID - if_equal $5, .Jack - if_equal $7, .Huey - if_equal $b, .Gaven - if_equal $d, .Jose - if_equal $f, .Joey - if_equal $10, .Wade - if_equal $11, .Ralph - if_equal $13, .Anthony - if_equal $14, .Todd - if_equal $16, .Irwin - if_equal $17, .Arnie - if_equal $18, .Alan - if_equal $1b, .Chad - if_equal $1c, .Derek - if_equal $1d, .Tully - if_equal $1e, .Brent - if_equal $20, .Vance - if_equal $21, .Wilton - if_equal $22, .Kenji - if_equal $23, .Parry + if_equal PHONE_SCHOOLBOY_JACK, .Jack + if_equal PHONE_SAILOR_HUEY, .Huey + if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven + if_equal PHONE_BIRDKEEPER_JOSE, .Jose + if_equal PHONE_YOUNGSTER_JOEY, .Joey + if_equal PHONE_BUG_CATCHER_WADE, .Wade + if_equal PHONE_FISHER_RALPH, .Ralph + if_equal PHONE_HIKER_ANTHONY, .Anthony + if_equal PHONE_CAMPER_TODD, .Todd + if_equal PHONE_JUGGLER_IRWIN, .Irwin + if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie + if_equal PHONE_SCHOOLBOY_ALAN, .Alan + if_equal PHONE_SCHOOLBOY_CHAD, .Chad + if_equal PHONE_POKEFANM_DEREK, .Derek + if_equal PHONE_FISHER_TULLY, .Tully + if_equal PHONE_POKEMANIAC_BRENT, .Brent + if_equal PHONE_BIRDKEEPER_VANCE, .Vance + if_equal PHONE_FISHER_WILTON, .Wilton + if_equal PHONE_BLACKBELT_KENJI, .Kenji + if_equal PHONE_HIKER_PARRY, .Parry .Jack farwritetext JackAskNumber1Text @@ -708,26 +708,26 @@ AskNumber1MScript: AskNumber2MScript: special RandomPhoneMon checkcode VAR_CALLERID - if_equal $5, .Jack - if_equal $7, .Huey - if_equal $b, .Gaven - if_equal $d, .Jose - if_equal $f, .Joey - if_equal $10, .Wade - if_equal $11, .Ralph - if_equal $13, .Anthony - if_equal $14, .Todd - if_equal $16, .Irwin - if_equal $17, .Arnie - if_equal $18, .Alan - if_equal $1b, .Chad - if_equal $1c, .Derek - if_equal $1d, .Tully - if_equal $1e, .Brent - if_equal $20, .Vance - if_equal $21, .Wilton - if_equal $22, .Kenji - if_equal $23, .Parry + if_equal PHONE_SCHOOLBOY_JACK, .Jack + if_equal PHONE_SAILOR_HUEY, .Huey + if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven + if_equal PHONE_BIRDKEEPER_JOSE, .Jose + if_equal PHONE_YOUNGSTER_JOEY, .Joey + if_equal PHONE_BUG_CATCHER_WADE, .Wade + if_equal PHONE_FISHER_RALPH, .Ralph + if_equal PHONE_HIKER_ANTHONY, .Anthony + if_equal PHONE_CAMPER_TODD, .Todd + if_equal PHONE_JUGGLER_IRWIN, .Irwin + if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie + if_equal PHONE_SCHOOLBOY_ALAN, .Alan + if_equal PHONE_SCHOOLBOY_CHAD, .Chad + if_equal PHONE_POKEFANM_DEREK, .Derek + if_equal PHONE_FISHER_TULLY, .Tully + if_equal PHONE_POKEMANIAC_BRENT, .Brent + if_equal PHONE_BIRDKEEPER_VANCE, .Vance + if_equal PHONE_FISHER_WILTON, .Wilton + if_equal PHONE_BLACKBELT_KENJI, .Kenji + if_equal PHONE_HIKER_PARRY, .Parry .Jack farwritetext JackAskNumber2Text @@ -799,26 +799,26 @@ RegisteredNumberMScript: NumberAcceptedMScript: checkcode VAR_CALLERID - if_equal $5, .Jack - if_equal $7, .Huey - if_equal $b, .Gaven - if_equal $d, .Jose - if_equal $f, .Joey - if_equal $10, .Wade - if_equal $11, .Ralph - if_equal $13, .Anthony - if_equal $14, .Todd - if_equal $16, .Irwin - if_equal $17, .Arnie - if_equal $18, .Alan - if_equal $1b, .Chad - if_equal $1c, .Derek - if_equal $1d, .Tully - if_equal $1e, .Brent - if_equal $20, .Vance - if_equal $21, .Wilton - if_equal $22, .Kenji - if_equal $23, .Parry + if_equal PHONE_SCHOOLBOY_JACK, .Jack + if_equal PHONE_SAILOR_HUEY, .Huey + if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven + if_equal PHONE_BIRDKEEPER_JOSE, .Jose + if_equal PHONE_YOUNGSTER_JOEY, .Joey + if_equal PHONE_BUG_CATCHER_WADE, .Wade + if_equal PHONE_FISHER_RALPH, .Ralph + if_equal PHONE_HIKER_ANTHONY, .Anthony + if_equal PHONE_CAMPER_TODD, .Todd + if_equal PHONE_JUGGLER_IRWIN, .Irwin + if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie + if_equal PHONE_SCHOOLBOY_ALAN, .Alan + if_equal PHONE_SCHOOLBOY_CHAD, .Chad + if_equal PHONE_POKEFANM_DEREK, .Derek + if_equal PHONE_FISHER_TULLY, .Tully + if_equal PHONE_POKEMANIAC_BRENT, .Brent + if_equal PHONE_BIRDKEEPER_VANCE, .Vance + if_equal PHONE_FISHER_WILTON, .Wilton + if_equal PHONE_BLACKBELT_KENJI, .Kenji + if_equal PHONE_HIKER_PARRY, .Parry .Jack farwritetext JackNumberAcceptedText @@ -923,26 +923,26 @@ NumberAcceptedMScript: NumberDeclinedMScript: checkcode VAR_CALLERID - if_equal $5, .Jack - if_equal $7, .Huey - if_equal $b, .Gaven - if_equal $d, .Jose - if_equal $f, .Joey - if_equal $10, .Wade - if_equal $11, .Ralph - if_equal $13, .Anthony - if_equal $14, .Todd - if_equal $16, .Irwin - if_equal $17, .Arnie - if_equal $18, .Alan - if_equal $1b, .Chad - if_equal $1c, .Derek - if_equal $1d, .Tully - if_equal $1e, .Brent - if_equal $20, .Vance - if_equal $21, .Wilton - if_equal $22, .Kenji - if_equal $23, .Parry + if_equal PHONE_SCHOOLBOY_JACK, .Jack + if_equal PHONE_SAILOR_HUEY, .Huey + if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven + if_equal PHONE_BIRDKEEPER_JOSE, .Jose + if_equal PHONE_YOUNGSTER_JOEY, .Joey + if_equal PHONE_BUG_CATCHER_WADE, .Wade + if_equal PHONE_FISHER_RALPH, .Ralph + if_equal PHONE_HIKER_ANTHONY, .Anthony + if_equal PHONE_CAMPER_TODD, .Todd + if_equal PHONE_JUGGLER_IRWIN, .Irwin + if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie + if_equal PHONE_SCHOOLBOY_ALAN, .Alan + if_equal PHONE_SCHOOLBOY_CHAD, .Chad + if_equal PHONE_POKEFANM_DEREK, .Derek + if_equal PHONE_FISHER_TULLY, .Tully + if_equal PHONE_POKEMANIAC_BRENT, .Brent + if_equal PHONE_BIRDKEEPER_VANCE, .Vance + if_equal PHONE_FISHER_WILTON, .Wilton + if_equal PHONE_BLACKBELT_KENJI, .Kenji + if_equal PHONE_HIKER_PARRY, .Parry .Jack farwritetext JackNumberDeclinedText @@ -1047,26 +1047,26 @@ NumberDeclinedMScript: PhoneFullMScript: checkcode VAR_CALLERID - if_equal $5, .Jack - if_equal $7, .Huey - if_equal $b, .Gaven - if_equal $d, .Jose - if_equal $f, .Joey - if_equal $10, .Wade - if_equal $11, .Ralph - if_equal $13, .Anthony - if_equal $14, .Todd - if_equal $16, .Irwin - if_equal $17, .Arnie - if_equal $18, .Alan - if_equal $1b, .Chad - if_equal $1c, .Derek - if_equal $1d, .Tully - if_equal $1e, .Brent - if_equal $20, .Vance - if_equal $21, .Wilton - if_equal $22, .Kenji - if_equal $23, .Parry + if_equal PHONE_SCHOOLBOY_JACK, .Jack + if_equal PHONE_SAILOR_HUEY, .Huey + if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven + if_equal PHONE_BIRDKEEPER_JOSE, .Jose + if_equal PHONE_YOUNGSTER_JOEY, .Joey + if_equal PHONE_BUG_CATCHER_WADE, .Wade + if_equal PHONE_FISHER_RALPH, .Ralph + if_equal PHONE_HIKER_ANTHONY, .Anthony + if_equal PHONE_CAMPER_TODD, .Todd + if_equal PHONE_JUGGLER_IRWIN, .Irwin + if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie + if_equal PHONE_SCHOOLBOY_ALAN, .Alan + if_equal PHONE_SCHOOLBOY_CHAD, .Chad + if_equal PHONE_POKEFANM_DEREK, .Derek + if_equal PHONE_FISHER_TULLY, .Tully + if_equal PHONE_POKEMANIAC_BRENT, .Brent + if_equal PHONE_BIRDKEEPER_VANCE, .Vance + if_equal PHONE_FISHER_WILTON, .Wilton + if_equal PHONE_BLACKBELT_KENJI, .Kenji + if_equal PHONE_HIKER_PARRY, .Parry .Jack farwritetext JackPhoneFullText @@ -1171,23 +1171,23 @@ PhoneFullMScript: RematchMScript: checkcode VAR_CALLERID - if_equal $5, .Jack - if_equal $7, .Huey - if_equal $b, .Gaven - if_equal $d, .Jose - if_equal $f, .Joey - if_equal $10, .Wade - if_equal $11, .Ralph - if_equal $13, .Anthony - if_equal $14, .Todd - if_equal $17, .Arnie - if_equal $18, .Alan - if_equal $1b, .Chad - if_equal $1d, .Tully - if_equal $1e, .Brent - if_equal $20, .Vance - if_equal $21, .Wilton - if_equal $23, .Parry + if_equal PHONE_SCHOOLBOY_JACK, .Jack + if_equal PHONE_SAILOR_HUEY, .Huey + if_equal PHONE_COOLTRAINERM_GAVEN, .Gaven + if_equal PHONE_BIRDKEEPER_JOSE, .Jose + if_equal PHONE_YOUNGSTER_JOEY, .Joey + if_equal PHONE_BUG_CATCHER_WADE, .Wade + if_equal PHONE_FISHER_RALPH, .Ralph + if_equal PHONE_HIKER_ANTHONY, .Anthony + if_equal PHONE_CAMPER_TODD, .Todd + if_equal PHONE_BUG_CATCHER_ARNIE, .Arnie + if_equal PHONE_SCHOOLBOY_ALAN, .Alan + if_equal PHONE_SCHOOLBOY_CHAD, .Chad + if_equal PHONE_FISHER_TULLY, .Tully + if_equal PHONE_POKEMANIAC_BRENT, .Brent + if_equal PHONE_BIRDKEEPER_VANCE, .Vance + if_equal PHONE_FISHER_WILTON, .Wilton + if_equal PHONE_HIKER_PARRY, .Parry .Jack farwritetext JackRematchText @@ -1277,13 +1277,13 @@ RematchMScript: GiftMScript: checkcode VAR_CALLERID - if_equal $d, .Jose - if_equal $10, .Wade - if_equal $18, .Alan - if_equal $1c, .Derek - if_equal $1d, .Tully - if_equal $21, .Wilton - if_equal $22, .Kenji + if_equal PHONE_BIRDKEEPER_JOSE, .Jose + if_equal PHONE_BUG_CATCHER_WADE, .Wade + if_equal PHONE_SCHOOLBOY_ALAN, .Alan + if_equal PHONE_POKEFANM_DEREK, .Derek + if_equal PHONE_FISHER_TULLY, .Tully + if_equal PHONE_FISHER_WILTON, .Wilton + if_equal PHONE_BLACKBELT_KENJI, .Kenji .Jose farwritetext JoseGiftText @@ -1316,17 +1316,17 @@ GiftMScript: PackFullMScript: checkcode VAR_CALLERID - if_equal $7, .Huey - if_equal $d, .Jose - if_equal $f, .Joey - if_equal $10, .Wade - if_equal $18, .Alan - if_equal $1c, .Derek - if_equal $1d, .Tully - if_equal $20, .Vance - if_equal $21, .Wilton - if_equal $22, .Kenji - if_equal $23, .Parry + if_equal PHONE_SAILOR_HUEY, .Huey + if_equal PHONE_BIRDKEEPER_JOSE, .Jose + if_equal PHONE_YOUNGSTER_JOEY, .Joey + if_equal PHONE_BUG_CATCHER_WADE, .Wade + if_equal PHONE_SCHOOLBOY_ALAN, .Alan + if_equal PHONE_POKEFANM_DEREK, .Derek + if_equal PHONE_FISHER_TULLY, .Tully + if_equal PHONE_BIRDKEEPER_VANCE, .Vance + if_equal PHONE_FISHER_WILTON, .Wilton + if_equal PHONE_BLACKBELT_KENJI, .Kenji + if_equal PHONE_HIKER_PARRY, .Parry .Huey farwritetext HueyPackFullText @@ -1387,10 +1387,10 @@ PackFullMScript: RematchGiftMScript: loadfont checkcode VAR_CALLERID - if_equal $7, .Huey - if_equal $f, .Joey - if_equal $20, .Vance - if_equal $23, .Parry + if_equal PHONE_SAILOR_HUEY, .Huey + if_equal PHONE_YOUNGSTER_JOEY, .Joey + if_equal PHONE_BIRDKEEPER_VANCE, .Vance + if_equal PHONE_HIKER_PARRY, .Parry .Huey farwritetext HueyRematchGiftText @@ -1411,14 +1411,14 @@ RematchGiftMScript: AskNumber1FScript: checkcode VAR_CALLERID - if_equal $6, .Beverly - if_equal $c, .Beth - if_equal $e, .Reena - if_equal $12, .Liz - if_equal $15, .Gina - if_equal $1a, .Dana - if_equal $1f, .Tiffany - if_equal $24, .Erin + if_equal PHONE_POKEFAN_BEVERLY, .Beverly + if_equal PHONE_COOLTRAINERF_BETH, .Beth + if_equal PHONE_COOLTRAINERF_REENA, .Reena + if_equal PHONE_PICNICKER_LIZ, .Liz + if_equal PHONE_PICNICKER_GINA, .Gina + if_equal PHONE_LASS_DANA, .Dana + if_equal PHONE_PICNICKER_TIFFANY, .Tiffany + if_equal PHONE_PICNICKER_ERIN, .Erin .Beverly farwritetext BeverlyAskNumber1Text @@ -1447,14 +1447,14 @@ AskNumber1FScript: AskNumber2FScript: checkcode VAR_CALLERID - if_equal $6, .Beverly - if_equal $c, .Beth - if_equal $e, .Reena - if_equal $12, .Liz - if_equal $15, .Gina - if_equal $1a, .Dana - if_equal $1f, .Tiffany - if_equal $24, .Erin + if_equal PHONE_POKEFAN_BEVERLY, .Beverly + if_equal PHONE_COOLTRAINERF_BETH, .Beth + if_equal PHONE_COOLTRAINERF_REENA, .Reena + if_equal PHONE_PICNICKER_LIZ, .Liz + if_equal PHONE_PICNICKER_GINA, .Gina + if_equal PHONE_LASS_DANA, .Dana + if_equal PHONE_PICNICKER_TIFFANY, .Tiffany + if_equal PHONE_PICNICKER_ERIN, .Erin .Beverly farwritetext BeverlyAskNumber2Text @@ -1490,14 +1490,14 @@ RegisteredNumberFScript: NumberAcceptedFScript: ; 0xbcbd3 checkcode VAR_CALLERID - if_equal $6, .Beverly - if_equal $c, .Beth - if_equal $e, .Reena - if_equal $12, .Liz - if_equal $15, .Gina - if_equal $1a, .Dana - if_equal $1f, .Tiffany - if_equal $24, .Erin + if_equal PHONE_POKEFAN_BEVERLY, .Beverly + if_equal PHONE_COOLTRAINERF_BETH, .Beth + if_equal PHONE_COOLTRAINERF_REENA, .Reena + if_equal PHONE_PICNICKER_LIZ, .Liz + if_equal PHONE_PICNICKER_GINA, .Gina + if_equal PHONE_LASS_DANA, .Dana + if_equal PHONE_PICNICKER_TIFFANY, .Tiffany + if_equal PHONE_PICNICKER_ERIN, .Erin .Beverly farwritetext BeverlyNumberAcceptedText @@ -1542,14 +1542,14 @@ NumberAcceptedFScript: ; 0xbcbd3 NumberDeclinedFScript: checkcode VAR_CALLERID - if_equal $6, .Beverly - if_equal $c, .Beth - if_equal $e, .Reena - if_equal $12, .Liz - if_equal $15, .Gina - if_equal $1a, .Dana - if_equal $1f, .Tiffany - if_equal $24, .Erin + if_equal PHONE_POKEFAN_BEVERLY, .Beverly + if_equal PHONE_COOLTRAINERF_BETH, .Beth + if_equal PHONE_COOLTRAINERF_REENA, .Reena + if_equal PHONE_PICNICKER_LIZ, .Liz + if_equal PHONE_PICNICKER_GINA, .Gina + if_equal PHONE_LASS_DANA, .Dana + if_equal PHONE_PICNICKER_TIFFANY, .Tiffany + if_equal PHONE_PICNICKER_ERIN, .Erin .Beverly farwritetext BeverlyNumberDeclinedText @@ -1594,14 +1594,14 @@ NumberDeclinedFScript: PhoneFullFScript: checkcode VAR_CALLERID - if_equal $6, .Beverly - if_equal $c, .Beth - if_equal $e, .Reena - if_equal $12, .Liz - if_equal $15, .Gina - if_equal $1a, .Dana - if_equal $1f, .Tiffany - if_equal $24, .Erin + if_equal PHONE_POKEFAN_BEVERLY, .Beverly + if_equal PHONE_COOLTRAINERF_BETH, .Beth + if_equal PHONE_COOLTRAINERF_REENA, .Reena + if_equal PHONE_PICNICKER_LIZ, .Liz + if_equal PHONE_PICNICKER_GINA, .Gina + if_equal PHONE_LASS_DANA, .Dana + if_equal PHONE_PICNICKER_TIFFANY, .Tiffany + if_equal PHONE_PICNICKER_ERIN, .Erin .Beverly farwritetext BeverlyPhoneFullText @@ -1646,13 +1646,13 @@ PhoneFullFScript: RematchFScript: checkcode VAR_CALLERID - if_equal $c, .Beth - if_equal $e, .Reena - if_equal $12, .Liz - if_equal $15, .Gina - if_equal $1a, .Dana - if_equal $1f, .Tiffany - if_equal $24, .Erin + if_equal PHONE_COOLTRAINERF_BETH, .Beth + if_equal PHONE_COOLTRAINERF_REENA, .Reena + if_equal PHONE_PICNICKER_LIZ, .Liz + if_equal PHONE_PICNICKER_GINA, .Gina + if_equal PHONE_LASS_DANA, .Dana + if_equal PHONE_PICNICKER_TIFFANY, .Tiffany + if_equal PHONE_PICNICKER_ERIN, .Erin .Beth farwritetext BethRematchText @@ -1692,10 +1692,10 @@ RematchFScript: GiftFScript: checkcode VAR_CALLERID - if_equal $6, .Beverly - if_equal $15, .Gina - if_equal $1a, .Dana - if_equal $1f, .Tiffany + if_equal PHONE_POKEFAN_BEVERLY, .Beverly + if_equal PHONE_PICNICKER_GINA, .Gina + if_equal PHONE_LASS_DANA, .Dana + if_equal PHONE_PICNICKER_TIFFANY, .Tiffany .Beverly farwritetext BeverlyGiftText @@ -1716,11 +1716,11 @@ GiftFScript: PackFullFScript: checkcode VAR_CALLERID - if_equal $6, .Beverly - if_equal $15, .Gina - if_equal $1a, .Dana - if_equal $1f, .Tiffany - if_equal $24, .Erin + if_equal PHONE_POKEFAN_BEVERLY, .Beverly + if_equal PHONE_PICNICKER_GINA, .Gina + if_equal PHONE_LASS_DANA, .Dana + if_equal PHONE_PICNICKER_TIFFANY, .Tiffany + if_equal PHONE_PICNICKER_ERIN, .Erin .Beverly farwritetext BeverlyPackFullText @@ -1750,7 +1750,7 @@ PackFullFScript: RematchGiftFScript: checkcode VAR_CALLERID - if_equal $24, .Erin + if_equal PHONE_PICNICKER_ERIN, .Erin .Erin loadfont @@ -1761,7 +1761,7 @@ RematchGiftFScript: GymStatue1Script: mapnametotext $0 loadfont - farwritetext UnknownText_0x1b074e + farwritetext GymStatue_CityGymText closetext loadmovesprites end @@ -1769,114 +1769,114 @@ GymStatue1Script: GymStatue2Script: mapnametotext $0 loadfont - farwritetext UnknownText_0x1b074e + farwritetext GymStatue_CityGymText keeptextopen - farwritetext UnknownText_0x1b075c + farwritetext GymStatue_WinningTrainersText closetext loadmovesprites end -UnknownScript_0xbcdb9: ; 0xbcdb9 +ReceiveItemScript: ; 0xbcdb9 waitbutton - farwritetext UnknownText_0x1b0648 + farwritetext ReceivedItemText playsound SFX_ITEM waitbutton end ; 0xbcdc3 -UnknownScript_0xbcdc3: ; 0xbcdc3 +ReceiveTogepiEggScript: ; 0xbcdc3 waitbutton - farwritetext UnknownText_0x1b0648 + farwritetext ReceivedItemText playsound SFX_GET_EGG_FROM_DAYCARE_LADY waitbutton end ; 0xbcdcd -UnknownScript_0xbcdcd: ; 0xbcdcd +GameCornerCoinVendorScript: ; 0xbcdcd faceplayer loadfont - farwritetext UnknownText_0x1b077f + farwritetext CoinVendor_WelcomeText keeptextopen checkitem COIN_CASE - iftrue UnknownScript_0xbcde0 - farwritetext UnknownText_0x1b079c + iftrue CoinVendor_IntroScript + farwritetext CoinVendor_NoCoinCaseText closetext loadmovesprites end ; 0xbcde0 -UnknownScript_0xbcde0: ; 0xbcde0 - farwritetext UnknownText_0x1b07e3 +CoinVendor_IntroScript: ; 0xbcde0 + farwritetext CoinVendor_IntroText -UnknownScript_0xbcde4: ; 0xbcde4 +CoinVendor_SellCoinsMenuScript: ; 0xbcde4 special Function24b4e - loadmenudata MenuDataHeader_0xbce54 + loadmenudata CoinVendor_MenuDataHeader interpretmenu2 writebackup - if_equal $1, UnknownScript_0xbcdf7 - if_equal $2, UnknownScript_0xbce1b - jump UnknownScript_0xbce4d + if_equal $1, CoinVendor_Buy50CoinsScript + if_equal $2, CoinVendor_Buy500CoinsScript + jump CoinVendor_CancelScript ; 0xbcdf7 -UnknownScript_0xbcdf7: ; 0xbcdf7 +CoinVendor_Buy50CoinsScript: ; 0xbcdf7 checkcoins 9949 - if_equal $0, UnknownScript_0xbce46 + if_equal $0, CoinVendor_CoinCaseFullScript checkmoney $0, 1000 - if_equal $2, UnknownScript_0xbce3f + if_equal $2, CoinVendor_NotEnoughMoneyScript givecoins 50 takemoney $0, 1000 waitbutton playsound SFX_TRANSACTION - farwritetext UnknownText_0x1b0830 + farwritetext CoinVendor_Buy50CoinsText closetext - jump UnknownScript_0xbcde4 + jump CoinVendor_SellCoinsMenuScript ; 0xbce1b -UnknownScript_0xbce1b: ; 0xbce1b +CoinVendor_Buy500CoinsScript: ; 0xbce1b checkcoins 9499 - if_equal $0, UnknownScript_0xbce46 + if_equal $0, CoinVendor_CoinCaseFullScript checkmoney $0, 10000 - if_equal $2, UnknownScript_0xbce3f + if_equal $2, CoinVendor_NotEnoughMoneyScript givecoins 500 takemoney $0, 10000 waitbutton playsound SFX_TRANSACTION - farwritetext UnknownText_0x1b084f + farwritetext CoinVendor_Buy500CoinsText closetext - jump UnknownScript_0xbcde4 + jump CoinVendor_SellCoinsMenuScript ; 0xbce3f -UnknownScript_0xbce3f: ; 0xbce3f - farwritetext UnknownText_0x1b086f +CoinVendor_NotEnoughMoneyScript: ; 0xbce3f + farwritetext CoinVendor_NotEnoughMoneyText closetext loadmovesprites end ; 0xbce46 -UnknownScript_0xbce46: ; 0xbce46 - farwritetext UnknownText_0x1b088c +CoinVendor_CoinCaseFullScript: ; 0xbce46 + farwritetext CoinVendor_CoinCaseFullText closetext loadmovesprites end ; 0xbce4d -UnknownScript_0xbce4d: ; 0xbce4d - farwritetext UnknownText_0x1b08ad +CoinVendor_CancelScript: ; 0xbce4d + farwritetext CoinVendor_CancelText closetext loadmovesprites end ; 0xbce54 -MenuDataHeader_0xbce54: ; 0xbce54 +CoinVendor_MenuDataHeader: ; 0xbce54 db $40 ; flags db 04, 00 ; start coords db 11, 15 ; end coords - dw MenuData2_0xbce5c + dw CoinVendor_MenuData2 db 1 ; default option ; 0xbce5c -MenuData2_0xbce5c: ; 0xbce5c +CoinVendor_MenuData2: ; 0xbce5c db $80 ; flags db 3 ; items db " 50 : ¥1000@" @@ -1888,7 +1888,7 @@ MenuData2_0xbce5c: ; 0xbce5c HappinessCheckScript: faceplayer loadfont - special Function718d + special GetFirstPokemonHappiness if_less_than 50, .Unhappy if_less_than 150, .KindaHappy farwritetext HappinessText3 @@ -1908,7 +1908,7 @@ HappinessCheckScript: loadmovesprites end -MovementData_0xbcea1: ; bcea1 +Movement_ContestResults_WalkAfterWarp: ; bcea1 step_right step_down turn_head_up diff --git a/home.asm b/home.asm index 9f8dd4fd1..a8f74dffe 100644 --- a/home.asm +++ b/home.asm @@ -1235,7 +1235,7 @@ Function3574:: ; 3574 call Function35de jr nc, .asm_3597 call Function2631 - callba Function96c56 + callba EnableScriptMode scf ret @@ -1402,7 +1402,7 @@ CheckTrainerBattle:: ; 360d jr z, .next ; Is facing the player... - call Function1ae5 + call GetObjectStruct call FacingPlayerDistance_bc jr nc, .next diff --git a/home/battle.asm b/home/battle.asm index 758c15ae1..fa72d75a0 100644 --- a/home/battle.asm +++ b/home/battle.asm @@ -310,7 +310,7 @@ BattleTextBox:: ; 3ac3 push hl call SpeechTextBox call MobileTextBorder - call Function1ad2 + call DrawOnMap call Function321c pop hl call PrintTextBoxText diff --git a/home/joypad.asm b/home/joypad.asm index 5a161fb14..42a61cd5d 100644 --- a/home/joypad.asm +++ b/home/joypad.asm @@ -312,7 +312,7 @@ Functiona36:: ; a36 jr Functiona36 ; a46 -Functiona46:: ; a46 +CloseText:: ; a46 ld a, [hOAMUpdate] push af ld a, 1 @@ -387,7 +387,7 @@ Functionaa5:: ; aa5 ret ; aaf -Functionaaf:: ; aaf +KeepTextOpen:: ; aaf ld a, [InLinkBattle] and a jr nz, .asm_ac1 diff --git a/home/map.asm b/home/map.asm index 259ed9503..e800a8d12 100644 --- a/home/map.asm +++ b/home/map.asm @@ -8,7 +8,7 @@ Function210f:: ; 210f ret ; 211b -Function211b:: ; 211b +CheckTriggers:: ; 211b push hl ld hl, BikeFlags + 2 ld a, [hli] @@ -17,7 +17,7 @@ Function211b:: ; 211b or h ld a, [hl] jr nz, .asm_2128 - ld a, $ff + ld a, -1 .asm_2128 pop hl @@ -702,7 +702,7 @@ Function24cd:: ; 24cd ld bc, OverworldMapEnd - OverworldMap ld a, 0 call ByteFill - call Function24e4 + call ChangeMap call FillMapConnections ld a, $1 call Function263b @@ -711,7 +711,7 @@ Function24cd:: ; 24cd -Function24e4:: ; 24e4 +ChangeMap:: ; 24e4 ld a, [hROMBank] push af @@ -938,7 +938,7 @@ FillEastConnectionStrip:: ; 25f6 ret ; 261b -Function261b:: ; 261b +LoadMapStatus:: ; 261b ld [MapStatus], a ret ; 261f @@ -1027,7 +1027,7 @@ Function2674:: ; 2674 ld a, [hl] push af set 1, [hl] - callba Function96c56 + callba EnableScriptMode callba ScriptEvents pop af ld [ScriptFlags], a @@ -1036,7 +1036,7 @@ Function2674:: ; 2674 ret ; 269a -Function269a:: ; 269a +MapTextbox:: ; 269a ld a, [hROMBank] push af @@ -1059,7 +1059,7 @@ Function269a:: ; 269a ret ; 26b7 -Function26b7:: ; 26b7 +Call_a_de:: ; 26b7 ; Call a:de. ld [hBuffer], a @@ -1079,7 +1079,7 @@ Function26b7:: ; 26b7 ret ; 26c7 -Function26c7:: ; 26c7 +GetMovementData:: ; 26c7 ld a, [hROMBank] push af ld a, b @@ -1412,7 +1412,7 @@ Function2821:: ; 2821 ret ; 2879 -Function2879:: ; 2879 +BufferScreen:: ; 2879 ld hl, wd194 ld a, [hli] ld h, [hl] @@ -1733,7 +1733,7 @@ GetFacingTileCoord:: ; 2a07 Function2a3c:: ; 2a3c - call Function2a66 + call GetBlockLocation ld a, [hl] and a jr z, .asm_2a63 @@ -1766,7 +1766,7 @@ Function2a3c:: ; 2a3c ret ; 2a66 -Function2a66:: ; 2a66 +GetBlockLocation:: ; 2a66 ld a, [MapWidth] add $6 ld c, a @@ -1878,7 +1878,7 @@ Function2ae7:: ; 2ae7 ld a, [hli] ld h, [hl] ld l, a - call Function211b + call CheckTriggers ld b, a ld a, [MapX] sub $4 @@ -1941,7 +1941,7 @@ FadeToMenu:: ; 2b29 Function2b3c:: ; 2b3c call WhiteBGMap call Function2bae - call Function1ad2 + call DrawOnMap call Function1d7d call Functiond90 jr Function2b5c @@ -1951,7 +1951,7 @@ Function2b4d:: ; 2b4d call WhiteBGMap call Function1d7d call Function2bae - call Function1ad2 + call DrawOnMap call Functiond90 ; 2b5c @@ -1978,7 +1978,7 @@ Function2b74:: ; 0x2b74 call TextBox ld hl, VramState set 0, [hl] - call Function1ad2 + call DrawOnMap call Function3200 ld b, $9 call GetSGBLayout diff --git a/home/map_objects.asm b/home/map_objects.asm index 4a2b58712..509492033 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -19,33 +19,33 @@ Function180e:: ; 180e push hl push bc ld hl, UsedSprites + 2 - ld c, $1f + ld c, SPRITE_GFX_LIST_CAPACITY - 1 ld b, a ld a, [hConnectionStripLength] cp $0 - jr z, .asm_182b + jr z, .nope ld a, b -.asm_181d +.loop cp [hl] - jr z, .asm_1830 + jr z, .found inc hl inc hl dec c - jr nz, .asm_181d + jr nz, .loop ld a, [UsedSprites + 1] scf - jr .asm_1833 + jr .done -.asm_182b +.nope ld a, [UsedSprites + 1] - jr .asm_1833 + jr .done -.asm_1830 +.found inc hl xor a ld a, [hl] -.asm_1833 +.done pop bc pop hl ret @@ -125,20 +125,20 @@ Function1875:: ; 1875 ld d, a and $f0 cp $10 - jr z, .asm_1882 + jr z, .ok_10 cp $20 - jr z, .asm_1888 + jr z, .ok_20 scf ret -.asm_1882 +.ok_10 ld a, d and 7 ret z scf ret -.asm_1888 +.ok_20 ld a, d and 7 ret z @@ -223,7 +223,7 @@ CheckStandingOnEntrance:: ; 18c3 GetMapObject:: ; 18d2 ; Return the location of map object a in bc. ld hl, MapObjects - ld bc, $10 + ld bc, OBJECT_LENGTH call AddNTimes ld b, h ld c, l @@ -232,93 +232,94 @@ GetMapObject:: ; 18d2 Function18de:: ; 18de +; Sets carry if the object is not visible on the screen. ld [hConnectionStripLength], a call GetMapObject - ld hl, $0000 + ld hl, MAPOBJECT_VRAM_ID add hl, bc ld a, [hl] - cp $ff - jr z, .asm_18f3 + cp MAPOBJECT_NOT_VISIBLE + jr z, .not_visible ld [hConnectedMapWidth], a - call Function1ae5 + call GetObjectStruct and a ret -.asm_18f3 +.not_visible scf ret ; 18f5 Function18f5:: ; 18f5 - ld hl, $0006 + ld hl, MAPOBJECT_HOUR add hl, bc ld a, [hl] - cp $ff - jr nz, .asm_1921 - ld hl, $0007 + cp -1 + jr nz, .check_hour + ld hl, MAPOBJECT_TIMEOFDAY add hl, bc ld a, [hl] - cp $ff - jr z, .asm_191c - ld hl, .data_191e + cp -1 + jr z, .timeofday_always + ld hl, .TimeOfDayValues_191e ld a, [TimeOfDay] add l ld l, a - jr nc, .asm_1912 + jr nc, .ok inc h -.asm_1912 +.ok ld a, [hl] - ld hl, $0007 + ld hl, MAPOBJECT_TIMEOFDAY add hl, bc and [hl] - jr nz, .asm_191c + jr nz, .timeofday_always scf ret -.asm_191c +.timeofday_always and a ret -.data_191e - db $1 - db $2 - db $4 +.TimeOfDayValues_191e + db 1 << MORN ; 1 + db 1 << DAY ; 2 + db 1 << NITE ; 4 -.asm_1921 - ld hl, $0006 +.check_hour + ld hl, MAPOBJECT_HOUR add hl, bc ld d, [hl] - ld hl, $0007 + ld hl, MAPOBJECT_TIMEOFDAY add hl, bc ld e, [hl] ld hl, hHours ld a, d cp e - jr z, .asm_1949 - jr c, .asm_193f + jr z, .yes + jr c, .check_timeofday ld a, [hl] cp d - jr nc, .asm_1949 + jr nc, .yes cp e - jr c, .asm_1949 - jr z, .asm_1949 - jr .asm_194b + jr c, .yes + jr z, .yes + jr .no -.asm_193f +.check_timeofday ld a, e cp [hl] - jr c, .asm_194b + jr c, .no ld a, [hl] cp d - jr nc, .asm_1949 - jr .asm_194b + jr nc, .yes + jr .no -.asm_1949 +.yes and a ret -.asm_194b +.no scf ret ; 194d @@ -344,16 +345,16 @@ Function1956:: ; 1956 Function1967:: ; 1967 ld [hConnectionStripLength], a call GetMapObject - ld hl, $0000 + ld hl, MAPOBJECT_VRAM_ID add hl, bc ld a, [hl] - cp $ff + cp MAPOBJECT_NOT_VISIBLE ret z - ld [hl], $ff + ld [hl], MAPOBJECT_NOT_VISIBLE push af call Function1985 pop af - call Function1ae5 + call GetObjectStruct callba Function4357 ret ; 1985 @@ -361,14 +362,14 @@ Function1967:: ; 1967 Function1985:: ; 1985 ld hl, wd4cd cp [hl] - jr z, .asm_1990 + jr z, .ok ld hl, wd4ce cp [hl] ret nz -.asm_1990 +.ok callba Function581f - ld a, $ff + ld a, -1 ld [wd4cd], a ld [wd4ce], a ret @@ -385,41 +386,41 @@ Function19a6:: ; 19a6 call GetMapObject ld d, b ld e, c - ld a, $ff + ld a, MAPOBJECT_NOT_VISIBLE ld [de], a inc de pop hl - ld bc, $000f + ld bc, OBJECT_LENGTH - 1 call CopyBytes ret ; 19b8 Function19b8:: ; 19b8 call GetMapObject - ld hl, $0000 + ld hl, MAPOBJECT_VRAM_ID add hl, bc ld a, [hl] push af - ld [hl], $ff + ld [hl], MAPOBJECT_NOT_VISIBLE inc hl - ld bc, $000f + ld bc, OBJECT_LENGTH - 1 xor a call ByteFill pop af - cp $ff + cp MAPOBJECT_NOT_VISIBLE ret z cp $d ret nc ld b, a ld a, [wd4cd] cp b - jr nz, .asm_19de - ld a, $ff + jr nz, .ok + ld a, -1 ld [wd4cd], a -.asm_19de +.ok ld a, b - call Function1ae5 + call GetObjectStruct callba Function4357 ret ; 19e9 @@ -437,12 +438,12 @@ Function19e9:: ; 19e9 ld a, [wc2e2] call Function18de ret c - ld hl, $0003 + ld hl, OBJECT_03 add hl, bc ld [hl], $14 - ld hl, $0009 + ld hl, OBJECT_09 add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, VramState set 7, [hl] and a @@ -455,24 +456,24 @@ Function1a13:: ; 1a13 push bc push de ld hl, ObjectStructs - ld de, $0028 - ld c, $d -.asm_1a1d + ld de, OBJECT_STRUCT_LENGTH + ld c, NUM_OBJECT_STRUCTS +.loop ld a, [hl] and a - jr z, .asm_1a28 + jr z, .empty add hl, de dec c - jr nz, .asm_1a1d + jr nz, .loop xor a - jr .asm_1a2c + jr .done -.asm_1a28 +.empty ld a, $d sub c scf -.asm_1a2c +.done pop de pop bc ret @@ -481,23 +482,18 @@ Function1a13:: ; 1a13 Function1a2f:: ; 1a2f - ld hl, $0003 + ld hl, OBJECT_03 add hl, bc ld a, [hl] - cp $25 - jr c, .asm_1a39 + cp OBJECT_STRUCT_3_DATA_HEIGHT + jr c, .ok xor a -.asm_1a39 - ld hl, Data4273 +.ok + ld hl, ObjectStruct3_Data ld e, a ld d, 0 - add hl, de - add hl, de - add hl, de - add hl, de - add hl, de - add hl, de + add_n_times hl, de, OBJECT_STRUCT_3_DATA_WIDTH ld a, [hl] ret ; 1a47 @@ -507,14 +503,9 @@ Function1a47:: ; 1a47 push de ld e, a ld d, 0 - ld hl, Data4273 + 1 - add hl, de - add hl, de - add hl, de - add hl, de - add hl, de - add hl, de - ld a, BANK(Data4273) + ld hl, ObjectStruct3_Data + 1 + add_n_times hl, de, OBJECT_STRUCT_3_DATA_WIDTH + ld a, BANK(ObjectStruct3_Data) call GetFarByte add a add a @@ -529,7 +520,7 @@ Function1a61:: ; 1a61 ld l, a ld a, [hROMBank] push af - ld a, BANK(Data4273) + ld a, BANK(ObjectStruct3_Data) rst Bankswitch ld a, l push bc @@ -544,19 +535,14 @@ Function1a61:: ; 1a61 ; 1a71 Function1a71:: ; 1a71 - ld hl, $0003 + ld hl, OBJECT_03 add hl, de ld [hl], a push de ld e, a ld d, 0 - ld hl, Data4273 + 1 - add hl, de - add hl, de - add hl, de - add hl, de - add hl, de - add hl, de + ld hl, ObjectStruct3_Data + 1 + add_n_times hl, de, OBJECT_STRUCT_3_DATA_WIDTH ld b, h ld c, l pop de @@ -565,27 +551,27 @@ Function1a71:: ; 1a71 rlca rlca and $c - ld hl, $0008 + ld hl, OBJECT_FACING add hl, de ld [hl], a ld a, [bc] inc bc - ld hl, $000b + ld hl, OBJECT_11 add hl, de ld [hl], a ld a, [bc] inc bc - ld hl, $0004 + ld hl, OBJECT_04 add hl, de ld [hl], a ld a, [bc] inc bc - ld hl, $0005 + ld hl, OBJECT_FLAGS add hl, de ld [hl], a ld a, [bc] inc bc - ld hl, $0006 + ld hl, OBJECT_PALETTE add hl, de ld [hl], a ret @@ -599,12 +585,12 @@ Function1aae:: ; 1aae ld a, [hli] ld d, [hl] - ld hl, $001b + ld hl, OBJECT_27 add hl, bc add [hl] ld e, a ld a, d - adc $0 + adc 0 ld d, a inc [hl] ld a, [de] @@ -616,20 +602,20 @@ Function1aae:: ; 1aae ret ; 1ac6 -Function1ac6:: ; 1ac6 +SetVramState_Bit0:: ; 1ac6 ld hl, VramState set 0, [hl] ret ; 1acc -Function1acc:: ; 1acc +ResetVramState_Bit0:: ; 1acc ld hl, VramState res 0, [hl] ret ; 1ad2 -Function1ad2:: ; 1ad2 +DrawOnMap:: ; 1ad2 ld a, [VramState] bit 0, a ret z @@ -639,8 +625,8 @@ Function1ad2:: ; 1ad2 ; 1ae5 -Function1ae5:: ; 1ae5 - ld bc, $0028 +GetObjectStruct:: ; 1ae5 + ld bc, OBJECT_STRUCT_LENGTH ld hl, ObjectStructs call AddNTimes ld b, h @@ -648,23 +634,23 @@ Function1ae5:: ; 1ae5 ret ; 1af1 -Function1af1:: ; 1af1 - ld hl, $0000 +GetObjectSprite:: ; 1af1 + ld hl, OBJECT_SPRITE add hl, bc ld a, [hl] and a ret ; 1af8 -Function1af8:: ; 1af8 +SetSpriteDirection:: ; 1af8 push af - ld hl, $0008 + ld hl, OBJECT_FACING add hl, bc ld a, [hl] - and $f3 + and %11110011 ld e, a pop af - and $c + and %00001100 or e ld [hl], a ret @@ -672,9 +658,9 @@ Function1af8:: ; 1af8 GetSpriteDirection:: ; 1b07 - ld hl, $0008 + ld hl, OBJECT_FACING add hl, bc ld a, [hl] - and $c + and %00001100 ret ; 1b0f diff --git a/home/menu.asm b/home/menu.asm index 21ce9c515..3c28b95e5 100644 --- a/home/menu.asm +++ b/home/menu.asm @@ -2,11 +2,11 @@ LoadMenuDataHeader:: ; 0x1d35 - call Function1d3c + call CopyMenuDataHeader call Function1c00 ret -Function1d3c:: ; 0x1d3c +CopyMenuDataHeader:: ; 0x1d3c ld de, wcf81 ld bc, $0010 call CopyBytes @@ -48,7 +48,7 @@ MenuDataHeader_0x1d5f:: ; 1d5f Function1d67:: ; 1d67 call Function1d4f - call Function1c17 + call WriteBackup ret ; 1d6e @@ -71,11 +71,11 @@ Function1d7d:: ; 1d7d ret ; 1d81 -Function1d81:: ; 0x1d81 +InterpretMenu2:: ; 0x1d81 xor a ld [hBGMapMode], a call Function1cbb - call Function1ad2 + call DrawOnMap call Function1c89 call Function321c call Function1c66 @@ -97,8 +97,8 @@ Function1d81:: ; 0x1d81 Function1dab:: ; 1dab call LoadMenuDataHeader - call Function1d81 - call Function1c17 + call InterpretMenu2 + call WriteBackup ld a, [wcfa9] ret ; 1db8 @@ -138,7 +138,7 @@ _YesNoBox:: ; 1dd9 ; Return nc (yes) or c (no). push bc ld hl, YesNoMenuDataHeader - call Function1d3c + call CopyMenuDataHeader pop bc ld a, b cp $e @@ -158,11 +158,11 @@ _YesNoBox:: ; 1dd9 call Function1c00 Function1dfe:: ; 1dfe - call Function1d81 + call InterpretMenu2 push af ld c, $f call DelayFrames - call Function1c17 + call WriteBackup pop af jr c, .asm_1e16 ld a, [wcfa9] @@ -201,7 +201,7 @@ Function1e2e:: ; 1e2e Function1e35:: ; 1e35 push de - call Function1d3c + call CopyMenuDataHeader pop de ld a, [wcf83] ld h, a @@ -540,7 +540,7 @@ PlayClickSFX:: ; 2009 Function2012:: ; 2012 call Function1d4f - call Functiona46 + call CloseText call Function1c07 ret ; 201c @@ -559,7 +559,7 @@ Function201c:: ; 201c ret ; 202a -Function202a:: ; 202a +InterpretMenu:: ; 202a ld a, [hROMBank] ld [wcf94], a callba Function2400e diff --git a/home/movement.asm b/home/movement.asm index f0869aa99..0cbb14f5d 100644 --- a/home/movement.asm +++ b/home/movement.asm @@ -203,11 +203,11 @@ Function1c10:: ; 0x1c10 callab Function2446d ret -Function1c17:: ; 0x1c17 +WriteBackup:: ; 0x1c17 push af call Function1c07 call Function321c - call Function1ad2 + call DrawOnMap pop af ret diff --git a/home/text.asm b/home/text.asm index feb3eb734..4cb581bcb 100644 --- a/home/text.asm +++ b/home/text.asm @@ -169,7 +169,7 @@ Function1052:: ; 1052 PrintText:: ; 1057 - call Function106c + call SetUpTextBox Function105a:: ; 105a push hl hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY @@ -183,10 +183,10 @@ PrintTextBoxText:: ; 1065 ret ; 106c -Function106c:: ; 106c +SetUpTextBox:: ; 106c push hl call SpeechTextBox - call Function1ad2 + call DrawOnMap call Function321c pop hl ret @@ -385,7 +385,7 @@ Char3F:: ; 121b ld de, String12a2 call PlaceString push bc - callab Function39939 + callab Battle_GetTrainerName pop hl ld de, StringBuffer1 jr Function126a @@ -517,7 +517,7 @@ Paragraph:: ; 12f2 .asm_1301 call Function13b6 - call Functionaaf + call KeepTextOpen hlcoord TEXTBOX_INNERX, TEXTBOX_INNERY lb bc, TEXTBOX_INNERH - 1, TEXTBOX_INNERW call ClearBox @@ -540,7 +540,7 @@ Char4B:: ; 131f call Function13b6 push de - call Functionaaf + call KeepTextOpen pop de ld a, [InLinkBattle] @@ -590,7 +590,7 @@ PromptText:: ; 135a .ok call Function13b6 - call Functionaaf + call KeepTextOpen ld a, [InLinkBattle] cp $3 jr z, DoneText @@ -904,7 +904,7 @@ Text_06:: ; 149f push hl call Function13c7 push bc - call Functionaaf + call KeepTextOpen pop bc call Function13cd pop hl @@ -1066,7 +1066,7 @@ Text_0D:: ; 1562 ; display arrow push hl push bc - call Functionaaf + call KeepTextOpen pop bc pop hl ret diff --git a/home/window.asm b/home/window.asm index 8c1e95134..31e299827 100644 --- a/home/window.asm +++ b/home/window.asm @@ -83,7 +83,7 @@ Function2e31:: ; 2e31 ld [hBGMapMode], a ld a, $1 ld [hOAMUpdate], a - call Function1ad2 + call DrawOnMap xor a ld [hOAMUpdate], a call DelayFrame diff --git a/macros.asm b/macros.asm index cbd071b8f..ccbc4ed22 100644 --- a/macros.asm +++ b/macros.asm @@ -136,3 +136,9 @@ bcd: MACRO shift endr ENDM + +add_n_times: MACRO + rept \3 + add \1, \2 + endr +ENDM diff --git a/macros/map.asm b/macros/map.asm index 54b543c6d..570205517 100644 --- a/macros/map.asm +++ b/macros/map.asm @@ -164,6 +164,7 @@ endc ENDM mapgroup: MACRO +; map id, height, width \1\@ EQUS "GROUP_\1" \1\@2 EQUS "MAP_\1" \1\@ EQU const_value diff --git a/macros/movement.asm b/macros/movement.asm index 1d556f922..71eb01339 100644 --- a/macros/movement.asm +++ b/macros/movement.asm @@ -1,285 +1,370 @@ + enum_start + + enum movement_turn_head_down turn_head_down: macro - db $00 + db movement_turn_head_down ; $00 endm + enum movement_turn_head_up turn_head_up: macro - db $01 + db movement_turn_head_up ; $01 endm + enum movement_turn_head_left turn_head_left: macro - db $02 + db movement_turn_head_left ; $02 endm + enum movement_turn_head_right turn_head_right: macro - db $03 + db movement_turn_head_right ; $03 endm + enum movement_half_step_down half_step_down: macro - db $04 + db movement_half_step_down ; $04 endm + enum movement_half_step_up half_step_up: macro - db $05 + db movement_half_step_up ; $05 endm + enum movement_half_step_left half_step_left: macro - db $06 + db movement_half_step_left ; $06 endm + enum movement_half_step_right half_step_right: macro - db $07 + db movement_half_step_right ; $07 endm + enum movement_slow_step_down slow_step_down: macro - db $08 + db movement_slow_step_down ; $08 endm + enum movement_slow_step_up slow_step_up: macro - db $09 + db movement_slow_step_up ; $09 endm + enum movement_slow_step_left slow_step_left: macro - db $0a + db movement_slow_step_left ; $0a endm + enum movement_slow_step_right slow_step_right: macro - db $0b + db movement_slow_step_right ; $0b endm + enum movement_step_down step_down: macro - db $0c + db movement_step_down ; $0c endm + enum movement_step_up step_up: macro - db $0d + db movement_step_up ; $0d endm + enum movement_step_left step_left: macro - db $0e + db movement_step_left ; $0e endm + enum movement_step_right step_right: macro - db $0f + db movement_step_right ; $0f endm + enum movement_big_step_down big_step_down: macro - db $10 + db movement_big_step_down ; $10 endm + enum movement_big_step_up big_step_up: macro - db $11 + db movement_big_step_up ; $11 endm + enum movement_big_step_left big_step_left: macro - db $12 + db movement_big_step_left ; $12 endm + enum movement_big_step_right big_step_right: macro - db $13 + db movement_big_step_right ; $13 endm + enum movement_slow_slide_step_down slow_slide_step_down: macro - db $14 + db movement_slow_slide_step_down ; $14 endm + enum movement_slow_slide_step_up slow_slide_step_up: macro - db $15 + db movement_slow_slide_step_up ; $15 endm + enum movement_slow_slide_step_left slow_slide_step_left: macro - db $16 + db movement_slow_slide_step_left ; $16 endm + enum movement_slow_slide_step_right slow_slide_step_right: macro - db $17 + db movement_slow_slide_step_right ; $17 endm + enum movement_slide_step_down slide_step_down: macro - db $18 + db movement_slide_step_down ; $18 endm + enum movement_slide_step_up slide_step_up: macro - db $19 + db movement_slide_step_up ; $19 endm + enum movement_slide_step_left slide_step_left: macro - db $1a + db movement_slide_step_left ; $1a endm + enum movement_slide_step_right slide_step_right: macro - db $1b + db movement_slide_step_right ; $1b endm + enum movement_fast_slide_step_down fast_slide_step_down: macro - db $1c + db movement_fast_slide_step_down ; $1c endm + enum movement_fast_slide_step_up fast_slide_step_up: macro - db $1d + db movement_fast_slide_step_up ; $1d endm + enum movement_fast_slide_step_left fast_slide_step_left: macro - db $1e + db movement_fast_slide_step_left ; $1e endm + enum movement_fast_slide_step_right fast_slide_step_right: macro - db $1f + db movement_fast_slide_step_right ; $1f endm + enum movement_turn_away_down turn_away_down: macro - db $20 + db movement_turn_away_down ; $20 endm + enum movement_turn_away_up turn_away_up: macro - db $21 + db movement_turn_away_up ; $21 endm + enum movement_turn_away_left turn_away_left: macro - db $22 + db movement_turn_away_left ; $22 endm + enum movement_turn_away_right turn_away_right: macro - db $23 + db movement_turn_away_right ; $23 endm + enum movement_turn_in_down turn_in_down: macro - db $24 + db movement_turn_in_down ; $24 endm + enum movement_turn_in_up turn_in_up: macro - db $25 + db movement_turn_in_up ; $25 endm + enum movement_turn_in_left turn_in_left: macro - db $26 + db movement_turn_in_left ; $26 endm + enum movement_turn_in_right turn_in_right: macro - db $27 + db movement_turn_in_right ; $27 endm + enum movement_turn_waterfall_down turn_waterfall_down: macro - db $28 + db movement_turn_waterfall_down ; $28 endm + enum movement_turn_waterfall_up turn_waterfall_up: macro - db $29 + db movement_turn_waterfall_up ; $29 endm + enum movement_turn_waterfall_left turn_waterfall_left: macro - db $2a + db movement_turn_waterfall_left ; $2a endm + enum movement_turn_waterfall_right turn_waterfall_right: macro - db $2b + db movement_turn_waterfall_right ; $2b endm + enum movement_slow_jump_step_down slow_jump_step_down: macro - db $2c + db movement_slow_jump_step_down ; $2c endm + enum movement_slow_jump_step_up slow_jump_step_up: macro - db $2d + db movement_slow_jump_step_up ; $2d endm + enum movement_slow_jump_step_left slow_jump_step_left: macro - db $2e + db movement_slow_jump_step_left ; $2e endm + enum movement_slow_jump_step_right slow_jump_step_right: macro - db $2f + db movement_slow_jump_step_right ; $2f endm + enum movement_jump_step_down jump_step_down: macro - db $30 + db movement_jump_step_down ; $30 endm + enum movement_jump_step_up jump_step_up: macro - db $31 + db movement_jump_step_up ; $31 endm + enum movement_jump_step_left jump_step_left: macro - db $32 + db movement_jump_step_left ; $32 endm + enum movement_jump_step_right jump_step_right: macro - db $33 + db movement_jump_step_right ; $33 endm + enum movement_fast_jump_step_down fast_jump_step_down: macro - db $34 + db movement_fast_jump_step_down ; $34 endm + enum movement_fast_jump_step_up fast_jump_step_up: macro - db $35 + db movement_fast_jump_step_up ; $35 endm + enum movement_fast_jump_step_left fast_jump_step_left: macro - db $36 + db movement_fast_jump_step_left ; $36 endm + enum movement_fast_jump_step_right fast_jump_step_right: macro - db $37 + db movement_fast_jump_step_right ; $37 endm +__enum__ = $3a + + enum movement_remove_fixed_facing remove_fixed_facing: macro - db $3a + db movement_remove_fixed_facing ; $3a endm + enum movement_fix_facing fix_facing: macro - db $3b + db movement_fix_facing ; $3b endm +__enum__ = $3d + + enum movement_hide_person hide_person: macro - db $3d + db movement_hide_person ; $3d endm + enum movement_show_person show_person: macro - db $3e + db movement_show_person ; $3e endm +__enum__ = $45 + + enum movement_accelerate_last accelerate_last: macro - db $45 + db movement_accelerate_last ; $45 endm + enum movement_step_sleep step_sleep: macro - db $46 + db movement_step_sleep ; $46 db \1 ; duration endm + enum movement_step_end step_end: macro - db $47 + db movement_step_end ; $47 endm +__enum__ = $49 + + enum movement_remove_person remove_person: macro - db $49 + db movement_remove_person ; $49 endm +__enum__ = $4c + + enum movement_teleport_from teleport_from: macro - db $4c + db movement_teleport_from ; $4c endm + enum movement_teleport_to teleport_to: macro - db $4d + db movement_teleport_to ; $4d endm + enum movement_skyfall skyfall: macro - db $4e + db movement_skyfall ; $4e endm + enum movement_step_wait5 step_wait5: macro - db $4f + db movement_step_wait5 ; $4f endm +__enum__ = $53 + + enum movement_hide_emote hide_emote: macro - db $53 + db movement_hide_emote ; $53 endm + enum movement_show_emote show_emote: macro - db $54 + db movement_show_emote ; $54 endm + enum movement_step_shake step_shake: macro - db $55 + db movement_step_shake ; $55 db \1 ; displacement endm diff --git a/main.asm b/main.asm index 2f3b9db0d..42ea98d34 100644 --- a/main.asm +++ b/main.asm @@ -118,7 +118,7 @@ Function5b44: ; 5b44 MysteryGift: ; 5b54 call UpdateTime callba Function11548 - callba Function1048ba + callba DoMysteryGift ret ; 5b64 @@ -134,7 +134,7 @@ NewGame: ; 5b6b call Function5b44 call Function5b8f call OakSpeech - call Function5d23 + call InitializeWorld ld a, $1 ld [wc2d8], a @@ -376,7 +376,7 @@ Function5ce9: ; 5ce9 .Mom db "MOM@" ; 5d23 -Function5d23: ; 5d23 +InitializeWorld: ; 5d23 call Function610f callba Function8029 callba Function113d6 @@ -422,13 +422,13 @@ Continue: ; 5d65 call DelayFrames call Function5e34 jr nc, .asm_5d8c - call Function1c17 + call WriteBackup jr .asm_5dd6 .asm_5d8c call Function5e48 jr nc, .asm_5d96 - call Function1c17 + call WriteBackup jr .asm_5dd6 .asm_5d96 @@ -440,7 +440,7 @@ Continue: ; 5d65 ld [MusicFadeIDHi], a call WhiteBGMap call Function5df0 - call Function1c17 + call WriteBackup call ClearTileMap ld c, $14 call DelayFrames @@ -582,7 +582,7 @@ Function5e9f: ; 5e9f call Function5f1c call Function5f40 call Functione5f - call Function1ad2 + call DrawOnMap ret ; 5eaf @@ -591,7 +591,7 @@ Function5eaf: ; 5eaf call Function5f1c call Function5f48 call Functione5f - call Function1ad2 + call DrawOnMap ret ; 5ebf @@ -884,11 +884,11 @@ NamePlayer: ; 0x6074 Function60e9: ; 60e9 call LoadMenuDataHeader - call Function1d81 + call InterpretMenu2 ld a, [wcfa9] dec a call Function1db8 - call Function1c17 + call WriteBackup ret ; 60fa @@ -2201,7 +2201,7 @@ Function6f3e: ; 6f3e call Function6f7f ret nc push af - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld a, [hl] and 3 @@ -2227,7 +2227,7 @@ Function6f5f: ; 6f5f call Function6f7f ret nc push af - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc and 3 ld e, a @@ -2273,7 +2273,7 @@ Function6f7f: ; 6f7f ; 6fa1 Function6fa1: ; 6fa1 - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld a, [hl] and 3 @@ -2353,7 +2353,7 @@ CheckFacingObject:: ; 6fd9 ld [$ffaf], a call Function7041 ret nc - ld hl, OBJECT_07 + ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld a, [hl] cp $ff @@ -2379,7 +2379,7 @@ Function7009: ; 7009 Function7015: ; 7015 ld a, [$ffaf] - call Function1ae5 + call GetObjectStruct call Function7021 call Function7041 ret @@ -2419,7 +2419,7 @@ Function7041: ; 7041 xor a .asm_7045 ld [$ffb0], a - call Function1af1 + call GetObjectSprite jr z, .asm_7093 ld hl, OBJECT_04 add hl, bc @@ -2586,7 +2586,7 @@ Function7113: ; 7113 xor a .asm_711f ld [$ffb0], a - call Function1af1 + call GetObjectSprite jr z, .asm_7160 ld hl, OBJECT_03 add hl, bc @@ -2667,24 +2667,24 @@ Function7171: ; 7171 ret ; 718d -Function718d: ; 718d +GetFirstPokemonHappiness: ; 718d ld hl, PartyMon1Happiness ld bc, PartyMon2 - PartyMon1 ld de, PartySpecies -.asm_7196 +.loop ld a, [de] cp EGG - jr nz, .asm_719f + jr nz, .done inc de add hl, bc - jr .asm_7196 + jr .loop -.asm_719f +.done ld [wd265], a ld a, [hl] ld [ScriptVar], a call GetPokemonName - jp Function746e + jp CopyPokemonName_Buffer1_Buffer3 ; 71ac Function71ac: ; 71ac @@ -2692,13 +2692,13 @@ Function71ac: ; 71ac ld [wd265], a cp EGG ld a, $1 - jr z, .asm_71b9 + jr z, .egg xor a -.asm_71b9 +.egg ld [ScriptVar], a call GetPokemonName - jp Function746e + jp CopyPokemonName_Buffer1_Buffer3 ; 71c2 @@ -3069,7 +3069,7 @@ Function73f7: ; 73f7 ld [ScriptVar], a ld [wd265], a call GetPokemonName - jp Function746e + jp CopyPokemonName_Buffer1_Buffer3 .asm_740e xor a @@ -3098,7 +3098,7 @@ Function7420: ; 7420 jr z, .asm_7453 push hl call GetCurNick - call Function746e + call CopyPokemonName_Buffer1_Buffer3 pop hl call Random .next @@ -3142,10 +3142,10 @@ Data746b: ; 746b db $ff, $02, $12 ; 746e -Function746e: ; 746e +CopyPokemonName_Buffer1_Buffer3: ; 746e ld hl, StringBuffer1 ld de, StringBuffer3 - ld bc, $000b + ld bc, PKMN_NAME_LENGTH jp CopyBytes ; 747a @@ -3187,7 +3187,7 @@ Function8029: ; 8029 call Function808f ld a, $0 call GetMapObject - ld hl, $0008 + ld hl, MAPOBJECT_COLOR add hl, bc ld e, $80 ld a, [wd45b] @@ -3216,7 +3216,8 @@ PlayerObjectTemplate: ; 8071 ; A dummy map object used to initialize the player object. ; Shorter than the actual amount copied by two bytes. ; Said bytes seem to be unused. - db $01, $00, $00, $0b, $ff, $ff, $ff, $00, $00, $00, $00, $ff, $ff + person_event SPRITE_CHRIS, 0, 0, LEFT << 2 | $3, $ff, -1, -1, PAL_OW_RED << 4 | $0, 0, $0000, -1 + ; db $01, $00, $00, $0b, $ff, $ff, $ff, $00, $00, $00, $00, $ff, $ff ; 807e Function807e:: ; 807e @@ -3224,10 +3225,10 @@ Function807e:: ; 807e ld a, b call GetMapObject pop de - ld hl, $0003 + ld hl, MAPOBJECT_X_COORD add hl, bc ld [hl], d - ld hl, $0002 + ld hl, MAPOBJECT_Y_COORD add hl, bc ld [hl], e ret @@ -3298,23 +3299,23 @@ Function80e7:: ; 80e7 call Function2707 and a ret nz - ld hl, ObjectStructs + (ObjectStruct2 - ObjectStruct1) * 1 + ld hl, ObjectStructs + OBJECT_STRUCT_LENGTH * 1 ld a, 1 - ld de, ObjectStruct2 - ObjectStruct1 -.asm_80f4 + ld de, OBJECT_STRUCT_LENGTH +.loop ld [$ffb0], a ld a, [hl] and a - jr z, .asm_8104 + jr z, .done add hl, de ld a, [$ffb0] inc a - cp $d - jr nz, .asm_80f4 + cp NUM_OBJECT_STRUCTS + jr nz, .loop scf ret -.asm_8104 +.done ld d, h ld e, l call Function8116 @@ -3335,12 +3336,12 @@ Function8116: ; 8116 Function811d: ; 811d ld a, [$ffb0] - ld hl, OBJECT_00 + ld hl, MAPOBJECT_VRAM_ID add hl, bc ld [hl], a ld a, [$ffaf] ld [wc2f0], a - ld hl, OBJECT_01 + ld hl, MAPOBJECT_SPRITE add hl, bc ld a, [hl] ld [wc2f1], a @@ -3349,7 +3350,7 @@ Function811d: ; 811d ld a, [hl] call GetSpritePalette ld [wc2f3], a - ld hl, OBJECT_08 + ld hl, MAPOBJECT_COLOR add hl, bc ld a, [hl] and $f0 @@ -3359,23 +3360,23 @@ Function811d: ; 811d ld [wc2f3], a .asm_814e - ld hl, OBJECT_04 + ld hl, MAPOBJECT_FACING add hl, bc ld a, [hl] ld [wc2f4], a - ld hl, OBJECT_09 + ld hl, MAPOBJECT_RANGE add hl, bc ld a, [hl] ld [wc2f5], a - ld hl, OBJECT_03 + ld hl, MAPOBJECT_X_COORD add hl, bc ld a, [hl] ld [wc2f6], a - ld hl, OBJECT_SPRITE + ld hl, MAPOBJECT_Y_COORD add hl, bc ld a, [hl] ld [wc2f7], a - ld hl, OBJECT_FLAGS + ld hl, MAPOBJECT_MOVEMENT add hl, bc ld a, [hl] ld [wc2f8], a @@ -3384,53 +3385,53 @@ Function811d: ; 811d Function8177: ; 8177 ld bc, MapObjects + OBJECT_LENGTH - ld a, $1 -.asm_817c + ld a, 1 +.loop ld [$ffaf], a - ld hl, $0001 + ld hl, MAPOBJECT_SPRITE add hl, bc ld a, [hl] and a - jr z, .asm_81bb - ld hl, $0000 + jr z, .next + ld hl, MAPOBJECT_VRAM_ID add hl, bc ld a, [hl] - cp $ff - jr nz, .asm_81bb + cp MAPOBJECT_NOT_VISIBLE + jr nz, .next ld a, [XCoord] ld d, a ld a, [YCoord] ld e, a - ld hl, $0003 + ld hl, MAPOBJECT_X_COORD add hl, bc ld a, [hl] - add $1 + add 1 sub d - jr c, .asm_81bb - cp $c - jr nc, .asm_81bb - ld hl, $0002 + jr c, .next + cp MAPOBJECT_SCREEN_WIDTH + jr nc, .next + ld hl, MAPOBJECT_Y_COORD add hl, bc ld a, [hl] - add $1 + add 1 sub e - jr c, .asm_81bb - cp $b - jr nc, .asm_81bb + jr c, .next + cp MAPOBJECT_SCREEN_HEIGHT + jr nc, .next push bc call Function80e7 pop bc jp c, Function81c9 -.asm_81bb +.next ld hl, OBJECT_LENGTH add hl, bc ld b, h ld c, l ld a, [$ffaf] inc a - cp $10 - jr nz, .asm_817c + cp NUM_OBJECTS + jr nz, .loop ret ; 81c9 @@ -3469,53 +3470,53 @@ Function81ea: ; 81ea ld a, [XCoord] ld e, a ld bc, MapObjects + OBJECT_LENGTH - ld a, $1 -.asm_81f4 + ld a, 1 +.loop ld [$ffaf], a - ld hl, $0001 + ld hl, MAPOBJECT_SPRITE add hl, bc ld a, [hl] and a - jr z, .asm_8224 - ld hl, $0002 + jr z, .next + ld hl, MAPOBJECT_Y_COORD add hl, bc ld a, d cp [hl] - jr nz, .asm_8224 - ld hl, $0000 + jr nz, .next + ld hl, MAPOBJECT_VRAM_ID add hl, bc ld a, [hl] - cp $ff - jr nz, .asm_8224 - ld hl, $0003 + cp MAPOBJECT_NOT_VISIBLE + jr nz, .next + ld hl, MAPOBJECT_X_COORD add hl, bc ld a, [hl] - add $1 + add 1 sub e - jr c, .asm_8224 - cp $c - jr nc, .asm_8224 + jr c, .next + cp MAPOBJECT_SCREEN_WIDTH + jr nc, .next push de push bc call Function80e7 pop bc pop de -.asm_8224 +.next ld hl, OBJECT_LENGTH add hl, bc ld b, h ld c, l ld a, [$ffaf] inc a - cp $10 - jr nz, .asm_81f4 + cp NUM_OBJECTS + jr nz, .loop ret ; 8232 Function8232: ; 8232 ld a, [XCoord] - sub $1 + sub 1 jr Function823e Function8239: ; 8239 @@ -3527,54 +3528,54 @@ Function823e: ; 823e ld a, [YCoord] ld d, a ld bc, MapObjects + OBJECT_LENGTH - ld a, $1 -.asm_8248 + ld a, 1 +.loop ld [$ffaf], a - ld hl, $0001 + ld hl, MAPOBJECT_SPRITE add hl, bc ld a, [hl] and a - jr z, .asm_8278 - ld hl, $0003 + jr z, .next + ld hl, MAPOBJECT_X_COORD add hl, bc ld a, e cp [hl] - jr nz, .asm_8278 - ld hl, $0000 + jr nz, .next + ld hl, MAPOBJECT_VRAM_ID add hl, bc ld a, [hl] - cp $ff - jr nz, .asm_8278 - ld hl, $0002 + cp MAPOBJECT_NOT_VISIBLE + jr nz, .next + ld hl, MAPOBJECT_Y_COORD add hl, bc ld a, [hl] - add $1 + add 1 sub d - jr c, .asm_8278 - cp $b - jr nc, .asm_8278 + jr c, .next + cp MAPOBJECT_SCREEN_HEIGHT + jr nc, .next push de push bc call Function80e7 pop bc pop de -.asm_8278 +.next ld hl, OBJECT_LENGTH add hl, bc ld b, h ld c, l ld a, [$ffaf] inc a - cp $10 - jr nz, .asm_8248 + cp NUM_OBJECTS + jr nz, .loop ret ; 8286 Function8286: ; 8286 ld a, [wc2f0] - ld hl, OBJECT_01 + ld hl, OBJECT_MAP_OBJECT_INDEX add hl, de ld [hl], a ld a, [wc2f4] @@ -3589,17 +3590,17 @@ Function8286: ; 8286 ld a, [wc2f6] call Function82f1 ld a, [wc2f1] - ld hl, OBJECT_00 + ld hl, OBJECT_SPRITE add hl, de ld [hl], a ld a, [wc2f2] - ld hl, OBJECT_SPRITE + ld hl, OBJECT_SPRITE_TILE add hl, de ld [hl], a ld hl, OBJECT_09 add hl, de ld [hl], $0 - ld hl, OBJECT_FACING + ld hl, OBJECT_FACING_STEP add hl, de ld [hl], $ff ld a, [wc2f8] @@ -3675,8 +3676,8 @@ Function831e: ; 831e jr z, Function833b ld a, [$ffe0] ld b, a - ld c, $0 - ld d, $1 + ld c, 0 + ld d, 1 call Function8341 call Function1b35 @@ -3691,19 +3692,19 @@ Function8341: ; 8341 push bc ld a, c call GetMapObject - ld hl, $0000 + ld hl, MAPOBJECT_VRAM_ID add hl, bc ld a, [hl] - call Function1ae5 + call GetObjectStruct ld d, b ld e, c pop bc ld a, b call GetMapObject - ld hl, $0000 + ld hl, MAPOBJECT_VRAM_ID add hl, bc ld a, [hl] - call Function1ae5 + call GetObjectStruct ld hl, OBJECT_MAP_X add hl, bc ld a, [hl] @@ -3834,10 +3835,10 @@ Function839e:: ; 839e ret ; 8417 -Function8417:: ; 8417 +GetRelativeFacing:: ; 8417 ld a, d call GetMapObject - ld hl, $0000 + ld hl, OBJECT_SPRITE add hl, bc ld a, [hl] cp $d @@ -3845,7 +3846,7 @@ Function8417:: ; 8417 ld d, a ld a, e call GetMapObject - ld hl, $0000 + ld hl, OBJECT_SPRITE add hl, bc ld a, [hl] cp $d @@ -3861,7 +3862,7 @@ Function8417:: ; 8417 Function8439: ; 8439 ld a, d - call Function1ae5 + call GetObjectStruct ld hl, OBJECT_MAP_X add hl, bc ld a, [hl] @@ -3871,7 +3872,7 @@ Function8439: ; 8439 ld b, a push bc ld a, e - call Function1ae5 + call GetObjectStruct ld hl, OBJECT_MAP_X add hl, bc ld d, [hl] @@ -3948,7 +3949,7 @@ Function848a: ; 848a Function849d: ; 849d ld a, [wd4cd] - call Function1ae5 + call GetObjectStruct ld hl, OBJECT_MAP_X add hl, bc ld d, [hl] @@ -3956,7 +3957,7 @@ Function849d: ; 849d add hl, bc ld e, [hl] ld a, [wd4ce] - call Function1ae5 + call GetObjectStruct ld hl, OBJECT_MAP_X add hl, bc ld a, d @@ -4163,9 +4164,9 @@ INCLUDE "engine/color.asm" SECTION "bank3", ROMX, BANK[$3] -Functionc000:: ; c000 +CheckTime:: ; c000 ld a, [TimeOfDay] - ld hl, Datac012 + ld hl, TimeOfDayTable ld de, 2 call IsInArray inc hl @@ -4177,7 +4178,7 @@ Functionc000:: ; c000 ret ; c012 -Datac012: ; c012 +TimeOfDayTable: ; c012 db MORN, 1 db DAY, 2 db NITE, 4 @@ -4800,7 +4801,7 @@ Functionc7ce: ; c7ce callba Function149f5 pop de jr nc, .asm_c7fc - call Function2a66 + call GetBlockLocation ld c, [hl] push hl ld hl, Unknown_c862 @@ -4846,14 +4847,14 @@ Functionc810: ; c810 xor a ld [hBGMapMode], a call Function2173 - call Function1ad2 + call DrawOnMap call DelayFrame ld a, [wd1ef] ld e, a callba Function8c940 - call Function2879 + call BufferScreen call Function2914 - call Function1ad2 + call DrawOnMap call DelayFrame call Functione51 ret @@ -5280,7 +5281,7 @@ Functionca52: ; ca52 jr nc, .asm_ca8b ld [wd001], a - call Function1c17 + call WriteBackup ld a, $1 ret @@ -5293,7 +5294,7 @@ Functionca52: ; ca52 ret .asm_ca8b - call Function1c17 + call WriteBackup call WaitBGMap ld a, $80 ret @@ -5544,7 +5545,7 @@ Functioncc06: ; cc06 ld hl, UnknownText_0xcc26 call Function1d4f call Functiona80 - call Function1c17 + call WriteBackup .asm_cc19 ld a, $80 @@ -5628,22 +5629,22 @@ Tablecc72: ; cc72 Functioncc78: ; cc78 call GetMapPermission call CheckOutdoorMap - jr z, .asm_cc82 - jr .asm_cc99 + jr z, .CheckIfSpawnPoint + jr .nope -.asm_cc82 +.CheckIfSpawnPoint ld a, [wdcb2] ld d, a ld a, [wdcb3] ld e, a callba IsSpawnPoint - jr nc, .asm_cc99 + jr nc, .nope ld a, c ld [wd001], a ld a, $1 ret -.asm_cc99 +.nope ld a, $2 ret ; cc9c @@ -5917,7 +5918,7 @@ Functioncdde: ; cdde call CheckWhirlpoolTile pop de jr c, .asm_ce09 - call Function2a66 + call GetBlockLocation ld c, [hl] push hl ld hl, Unknown_c8a4 @@ -5966,7 +5967,7 @@ Functionce1d: ; ce1d ld a, [wd1ef] ld e, a callba Function8c7d4 - call Function2879 + call BufferScreen call Function2914 ret ; ce3e @@ -6141,7 +6142,7 @@ Functioncf0d: ; cf0d jr nc, .asm_cf2c ld a, [$ffb0] - call Function1ae5 + call GetObjectStruct ld hl, $0001 add hl, bc ld a, [hl] @@ -6431,7 +6432,7 @@ Functiond095: ; d095 ld [hBGMapMode], a ld a, $1 ld [PlayerAction], a - call Function1ad2 + call DrawOnMap call Functione4a ret ; d0a4 @@ -7364,7 +7365,7 @@ Functiond4e5: ; d4e5 (3:54e5) Jumptable_d4f2: ; d4f2 (3:54f2) dw Function2914 - dw Function2879 + dw BufferScreen dw Functiond509 dw Functiond510 dw Functiond508 @@ -9529,7 +9530,7 @@ Functione17b: ; e17b ret ; e277 -Functione277:: ; e277 +GivePoke:: ; e277 push de push bc xor a @@ -9810,7 +9811,7 @@ Functione443: ; e443 (3:6443) ld a, b jr nc, .asm_e44b .asm_e46b - call Function1c17 + call WriteBackup ret ; e46f (3:646f) @@ -9876,7 +9877,7 @@ Functione4cd: ; e4cd call ClearPCItemScreen .asm_e4f4 - call Function1c17 + call WriteBackup and a ret ; e4f9 @@ -9892,7 +9893,7 @@ Functione4fe: ; e4fe (3:64fe) callba Functione2391 call Function222a call ClearPCItemScreen - call Function1c17 + call WriteBackup and a ret ; e512 (3:6512) @@ -9968,7 +9969,7 @@ Functione559: ; e559 (3:6559) callba Functione2583 call Function222a call ClearPCItemScreen - call Function1c17 + call WriteBackup and a ret ; e56d (3:656d) @@ -12386,15 +12387,15 @@ String_1224f: ; 1224f UnknownScript_0x122c1: ; 0x122c1 checkflag ENGINE_BUG_CONTEST_TIMER iffalse .script_122cd - setflag ENGINE_51 - special Function13a31 + setflag ENGINE_DAILY_BUG_CONTEST + special ContestReturnMons .script_122cd end ; 0x122ce -UnknownScript_0x122ce:: ; 0x122ce +FindItemInBallScript:: ; 0x122ce callasm Function122f8 - iffalse UnknownScript_0x122e3 + iffalse NoRoomForItemInBallScript disappear $fe loadfont writetext UnknownText_0x122ee @@ -12405,7 +12406,7 @@ UnknownScript_0x122ce:: ; 0x122ce end ; 0x122e3 -UnknownScript_0x122e3: ; 0x122e3 +NoRoomForItemInBallScript: ; 0x122e3 loadfont writetext UnknownText_0x122ee closetext @@ -12448,9 +12449,14 @@ Function122f8: ; 122f8 ; 12324 HealMachineAnim: ; 12324 + ; If you have no Pokemon, don't change the buffer. This can lead to some glitchy effects if you have no Pokemon. ld a, [PartyCount] and a ret z + ; The location of the healing machine relative to the player is stored in ScriptVar. + ; 0: Up and left (Pokemon Center) + ; 1: Left (Elm's Lab) + ; 2: Up (Hall of Fame) ld a, [ScriptVar] ld [Buffer1], a ld a, [rOBP1] @@ -12783,20 +12789,20 @@ Function12527: ; 12527 ld e, a callba IsSpawnPoint ld a, c - jr c, .asm_12539 + jr c, .yes xor a -.asm_12539 +.yes ld [wd001], a ret ; 1253d -UnknownScript_0x1253d:: ; 0x1253d +Script_ForcedMovement:: ; 0x1253d checkcode VAR_FACING - if_equal $0, UnknownScript_0x12555 - if_equal $1, UnknownScript_0x12550 - if_equal $2, UnknownScript_0x1255f - if_equal $3, UnknownScript_0x1255a + if_equal DOWN, UnknownScript_0x12555 + if_equal UP, UnknownScript_0x12550 + if_equal LEFT, UnknownScript_0x1255f + if_equal RIGHT, UnknownScript_0x1255a end ; 0x12550 @@ -12952,7 +12958,7 @@ StartMenu:: ; 125cd jr .Select .Reopen - call Function1ad2 + call DrawOnMap call UpdateTimePals call .SetUpMenuItems ld a, [wd0d2] @@ -13067,7 +13073,7 @@ StartMenu:: ; 125cd call .DrawMenuAccount_ call MenuFunc_1e7f call .DrawBugContestStatus - call Function1ad2 + call DrawOnMap call Functiond90 call Function2b5c ret @@ -13367,7 +13373,7 @@ StartMenu_Quit: ; 128f0 StartMenu_Save: ; 1290b ; Save the game. - call Function2879 + call BufferScreen callba Function14a1a jr nc, .asm_12919 ld a, 0 @@ -13503,7 +13509,7 @@ Function129d5: ; 129d5 and a ret nz ld hl, TMsHMs - ld b, $39 + ld b, NUM_TMS + NUM_HMS .asm_129e9 ld a, [hli] and a @@ -13527,7 +13533,7 @@ Function129f4: ; 129f4 call Function1d4f callba Function24fbf push af - call Function1c17 + call WriteBackup call Function1c07 pop af jr c, .asm_12a42 @@ -13722,7 +13728,7 @@ GiveTakePartyMonItem: ; 12b60 ld hl, GiveTakeItemMenuData call LoadMenuDataHeader - call Function1d81 + call InterpretMenu2 call Function1c07 jr c, .asm_12ba6 @@ -14027,7 +14033,7 @@ Function12d45: ; 12d45 jr z, .asm_12d6d ld hl, MenuDataHeader_0x12dc9 call LoadMenuDataHeader - call Function1d81 + call InterpretMenu2 call Function1c07 jp c, .asm_12dc6 ld a, [wcfa9] @@ -14889,8 +14895,8 @@ SelectMenu:: ; 13327 call Function2e08 ld b, BANK(ItemMayBeRegisteredText) ld hl, ItemMayBeRegisteredText - call Function269a - call Functiona46 + call MapTextbox + call CloseText jp Function2dcf ; 13340 @@ -15070,7 +15076,7 @@ UseRegisteredItem: ; 133c3 ; 1342d -Function1342d:: ; 1342d +Elevator:: ; 1342d call Function1344a call Function1347d jr c, .asm_13448 @@ -15193,17 +15199,17 @@ Function134c0: ; 134c0 Function134dd: ; 134dd call Function1d6e - ld hl, UnknownText_0x1350d + ld hl, Elevator_WhichFloorText call PrintText - call Function13512 - ld hl, MenuDataHeader_0x13550 - call Function1d3c + call Elevator_GetCurrentFloorText + ld hl, Elevator_MenuDataHeader + call CopyMenuDataHeader call Function352f - call Function1ad2 + call DrawOnMap xor a ld [wd0e4], a call Function350c - call Function1c17 + call WriteBackup ld a, [wcf73] cp $2 jr z, .asm_1350b @@ -15216,14 +15222,14 @@ Function134dd: ; 134dd ret ; 1350d -UnknownText_0x1350d: ; 0x1350d +Elevator_WhichFloorText: ; 0x1350d ; Which floor? text_jump UnknownText_0x1bd2bc db "@" ; 0x13512 -Function13512: ; 13512 +Elevator_GetCurrentFloorText: ; 13512 ld hl, Options ld a, [hl] push af @@ -15233,21 +15239,21 @@ Function13512: ; 13512 ld c, $8 call TextBox hlcoord 1, 2 - ld de, String_13537 + ld de, Elevator_CurrentFloorText call PlaceString hlcoord 4, 4 - call Function1353f + call Elevator_GetCurrentFloorString pop af ld [Options], a ret ; 13537 -String_13537: ; 13537 +Elevator_CurrentFloorText: ; 13537 db "Now on:@" ; 1353f -Function1353f: ; 1353f +Elevator_GetCurrentFloorString: ; 1353f push hl ld a, [wd041] ld e, a @@ -15256,41 +15262,41 @@ Function1353f: ; 1353f add hl, de ld a, [hl] pop de - call Function1356b + call GetFloorString ret ; 13550 -MenuDataHeader_0x13550: ; 0x13550 +Elevator_MenuDataHeader: ; 0x13550 db $40 ; flags db 01, 12 ; start coords db 09, 18 ; end coords - dw MenuData2_0x13558 + dw Elevator_MenuData2 db 1 ; default option ; 0x13558 -MenuData2_0x13558: ; 0x13558 +Elevator_MenuData2: ; 0x13558 db $10 ; flags db 4, 0 ; rows, columns db 1 ; horizontal spacing dbw 0, OBPals + 8 * 6 - dbw BANK(Function13568), Function13568 + dbw BANK(GetElevatorFlorStrings), GetElevatorFlorStrings dbw BANK(NULL), NULL dbw BANK(NULL), NULL ; 13568 -Function13568: ; 13568 +GetElevatorFlorStrings: ; 13568 ld a, [MenuSelection] -Function1356b: ; 1356b +GetFloorString: ; 1356b push de - call Function13575 + call FloorToString ld d, h ld e, l pop hl jp PlaceString ; 13575 -Function13575: ; 13575 +FloorToString: ; 13575 push de ld e, a ld d, 0 @@ -15366,7 +15372,7 @@ Function135db: ; 135db ret ; 135eb -UnknownScript_0x135eb:: ; 0x135eb +BugCatchingContestBattleScript:: ; 0x135eb writecode VAR_BATTLETYPE, BATTLETYPE_CONTEST battlecheck startbattle @@ -15471,7 +15477,7 @@ Function1365b:: ; 1365b ld de, .table2 - .table1 ld hl, .table1 call IsInArray - jr nc, .asm_1367f + jr nc, .notintable ld a, jumpstd_command ld [wd03f], a @@ -15480,13 +15486,13 @@ Function1365b:: ; 1365b ld [wd03f + 1], a ld a, [hli] ld [wd03f + 2], a - ld a, BANK(UnknownScript_0x1369a) - ld hl, UnknownScript_0x1369a + ld a, BANK(Script_JumpStdFromRAM) + ld hl, Script_JumpStdFromRAM call CallScript scf ret -.asm_1367f +.notintable xor a ret ; 13681 @@ -15494,7 +15500,7 @@ Function1365b:: ; 1365b .table1 dbw $91, magazinebookshelf .table2 - dbw $93, $0031 ; pc + dbw $93, pcscript dbw $94, radio1 dbw $95, townmap dbw $96, merchandiseshelf @@ -15504,104 +15510,104 @@ Function1365b:: ; 1365b db $ff ; end ; 1369a -UnknownScript_0x1369a: ; 0x1369a +Script_JumpStdFromRAM: ; 0x1369a jump wd03f ; 0x1369d -Function1369d: ; 1369d +_BugContestJudging: ; 1369d call ContestScore callba Function105f79 call Function13819 ld a, [wd00a] - call Function13730 + call LoadContestantData ld a, [wd00b] ld [wd265], a call GetPokemonName - ld hl, UnknownText_0x13719 + ld hl, BugContest_ThirdPlaceText call PrintText ld a, [EndFlypoint] - call Function13730 + call LoadContestantData ld a, [MovementBuffer] ld [wd265], a call GetPokemonName - ld hl, UnknownText_0x13702 + ld hl, BugContest_SecondPlaceText call PrintText ld a, [DefaultFlypoint] - call Function13730 + call LoadContestantData ld a, [wd003] ld [wd265], a call GetPokemonName - ld hl, UnknownText_0x136eb + ld hl, BugContest_FirstPlaceText call PrintText jp Function13807 ; 136eb -UnknownText_0x136eb: ; 0x136eb - text_jump UnknownText_0x1c10fa +BugContest_FirstPlaceText: ; 0x136eb + text_jump ContestJudging_FirstPlaceText start_asm ; 0x136f0 -Function136f0: ; 136f0 +BugContest_FirstPlace: ; 136f0 ld de, SFX_1ST_PLACE call PlaySFX call WaitSFX - ld hl, UnknownText_0x136fd + ld hl, BugContest_FirstPlaceScoreText ret ; 136fd -UnknownText_0x136fd: ; 0x136fd +BugContest_FirstPlaceScoreText: ; 0x136fd ; The winning score was @ points! - text_jump UnknownText_0x1c113f + text_jump ContestJudging_FirstPlaceScoreText db "@" ; 0x13702 -UnknownText_0x13702: ; 0x13702 +BugContest_SecondPlaceText: ; 0x13702 ; Placing second was @ , who caught a @ !@ @ - text_jump UnknownText_0x1c1166 + text_jump ContestJudging_SecondPlaceText start_asm ; 0x13707 -Function13707: ; 13707 +BugContest_SecondPlace: ; 13707 ld de, SFX_2ND_PLACE call PlaySFX call WaitSFX - ld hl, UnknownText_0x13714 + ld hl, BugContest_SecondPlaceScoreText ret ; 13714 -UnknownText_0x13714: ; 0x13714 +BugContest_SecondPlaceScoreText: ; 0x13714 ; The score was @ points! - text_jump UnknownText_0x1c1196 + text_jump ContestJudging_SecondPlaceScoreText db "@" ; 0x13719 -UnknownText_0x13719: ; 0x13719 +BugContest_ThirdPlaceText: ; 0x13719 ; Placing third was @ , who caught a @ !@ @ - text_jump UnknownText_0x1c11b5 + text_jump ContestJudging_ThirdPlaceText start_asm ; 0x1371e -Function1371e: ; 1371e +BugContest_ThirdPlace: ; 1371e ld de, SFX_3RD_PLACE call PlaySFX call WaitSFX - ld hl, UnknownText_0x1372b + ld hl, BugContest_ThirdPlaceScoreText ret ; 1372b -UnknownText_0x1372b: ; 0x1372b +BugContest_ThirdPlaceScoreText: ; 0x1372b ; The score was @ points! - text_jump UnknownText_0x1c11e4 + text_jump ContestJudging_ThirdPlaceScoreText db "@" ; 0x13730 -Function13730: ; 13730 +LoadContestantData: ; 13730 dec a jr z, .asm_13777 ld c, a ld b, 0 - ld hl, Unknown_13783 + ld hl, BugContestantPointers add hl, bc add hl, bc ld a, [hli] @@ -15631,7 +15637,7 @@ Function13730: ; 13730 push de ld a, [hl] ld b, a - callab Function3994c + callab GetTrainerName ld hl, StringBuffer1 pop de ld bc, $000a @@ -15644,75 +15650,75 @@ Function13730: ; 13730 jp CopyBytes ; 13783 -Unknown_13783: ; 13783 - dw Unknown_13799 - dw Unknown_13799 - dw Unknown_137a4 - dw Unknown_137af - dw Unknown_137ba - dw Unknown_137c5 - dw Unknown_137d0 - dw Unknown_137db - dw Unknown_137e6 - dw Unknown_137f1 - dw Unknown_137fc +BugContestantPointers: ; 13783 + dw BugContestant_BugCatcherDon + dw BugContestant_BugCatcherDon + dw BugContestant_BugCatcherEd + dw BugContestant_CooltrainerMNick + dw BugContestant_PokefanMWilliam + dw BugContestant_BugCatcherBenny + dw BugContestant_CamperBarry + dw BugContestant_PicnickerCindy + dw BugContestant_BugCatcherJosh + dw BugContestant_YoungsterSamuel + dw BugContestant_SchoolboyKipp ; 13799 -Unknown_13799: +BugContestant_BugCatcherDon: db BUG_CATCHER, DON dbw KAKUNA, 300 dbw METAPOD, 285 dbw CATERPIE, 226 -Unknown_137a4: +BugContestant_BugCatcherEd: db BUG_CATCHER, ED dbw BUTTERFREE, 286 dbw BUTTERFREE, 251 dbw CATERPIE, 237 -Unknown_137af: +BugContestant_CooltrainerMNick: db COOLTRAINERM, NICK dbw SCYTHER, 357 dbw BUTTERFREE, 349 dbw PINSIR, 368 -Unknown_137ba: +BugContestant_PokefanMWilliam: db POKEFANM, WILLIAM dbw PINSIR, 332 dbw BUTTERFREE, 324 dbw VENONAT, 321 -Unknown_137c5: +BugContestant_BugCatcherBenny: db BUG_CATCHER, BUG_CATCHER_BENNY dbw BUTTERFREE, 318 dbw WEEDLE, 295 dbw CATERPIE, 285 -Unknown_137d0: +BugContestant_CamperBarry: db CAMPER, BARRY dbw PINSIR, 366 dbw VENONAT, 329 dbw KAKUNA, 314 -Unknown_137db: +BugContestant_PicnickerCindy: db PICNICKER, CINDY dbw BUTTERFREE, 341 dbw METAPOD, 301 dbw CATERPIE, 264 -Unknown_137e6: +BugContestant_BugCatcherJosh: db BUG_CATCHER, JOSH dbw SCYTHER, 326 dbw BUTTERFREE, 292 dbw METAPOD, 282 -Unknown_137f1: +BugContestant_YoungsterSamuel: db YOUNGSTER, SAMUEL dbw WEEDLE, 270 dbw PINSIR, 282 dbw CATERPIE, 251 -Unknown_137fc: +BugContestant_SchoolboyKipp: db SCHOOLBOY, KIPP dbw VENONAT, 267 dbw PARAS, 254 @@ -15838,7 +15844,7 @@ Function138b0: ; 138b0 dec a ld c, a ld b, 0 - ld hl, Unknown_13783 + ld hl, BugContestantPointers add hl, bc add hl, bc ld a, [hli] @@ -16105,7 +16111,7 @@ Function13a12: ; 13a12 ret ; 13a31 -Function13a31: ; 13a31 +ContestReturnMons: ; 13a31 ld hl, PartySpecies + 1 ld a, [wdf9b] ld [hl], a @@ -16808,21 +16814,25 @@ GetSprite: ; 1423c call GetMonSprite ret c - ld hl, SpriteHeaders + ld hl, SpriteHeaders ; address dec a ld c, a ld b, 0 ld a, 6 call AddNTimes + ; load the address into de ld a, [hli] ld e, a ld a, [hli] ld d, a + ; load the length into c ld a, [hli] swap a ld c, a + ; load the sprite bank into both b and h ld b, [hl] ld a, [hli] + ; load the sprite type into l ld l, [hl] ld h, a ret @@ -16865,7 +16875,7 @@ GetMonSprite: ; 14259 .Mon ld e, a and a - jr z, .asm_1429f + jr z, .NoBreedmon callba Function8e82b @@ -16884,7 +16894,7 @@ GetMonSprite: ; 14259 and a jp nz, GetMonSprite -.asm_1429f +.NoBreedmon ld a, 1 ld l, 1 ld h, 0 @@ -16895,11 +16905,11 @@ GetMonSprite: ; 14259 Function142a7:: ; 142a7 cp SPRITE_POKEMON - jr nc, .asm_142c2 + jr nc, .is_pokemon push hl push bc - ld hl, SpriteHeaders + 4 + ld hl, SpriteHeaders + 4 ; type dec a ld c, a ld b, 0 @@ -16909,11 +16919,11 @@ Function142a7:: ; 142a7 pop bc pop hl cp 3 - jr nz, .asm_142c2 + jr nz, .is_pokemon scf ret -.asm_142c2 +.is_pokemon and a ret ; 142c4 @@ -16922,7 +16932,7 @@ Function142a7:: ; 142a7 _GetSpritePalette:: ; 142c4 ld a, c call GetMonSprite - jr c, .asm_142d8 + jr c, .is_pokemon ld hl, SpriteHeaders + 5 ; palette dec a @@ -16933,7 +16943,7 @@ _GetSpritePalette:: ; 142c4 ld c, [hl] ret -.asm_142d8 +.is_pokemon xor a ld c, a ret @@ -16956,7 +16966,7 @@ AddSpriteGFX: ; 142e5 push bc ld b, a ld hl, UsedSprites + 2 - ld c, $1f + ld c, SPRITE_GFX_LIST_CAPACITY - 1 .loop ld a, [hl] cp b @@ -16993,7 +17003,7 @@ LoadSpriteGFX: ; 14306 ; it's useless as a loop count. ld hl, UsedSprites - ld b, $20 + ld b, SPRITE_GFX_LIST_CAPACITY .loop ld a, [hli] and a @@ -17020,8 +17030,8 @@ SortUsedSprites: ; 1431e ; Run backwards through UsedSprites to find the last one. - ld c, $20 - ld de, UsedSprites + ($20 - 1) * 2 + ld c, SPRITE_GFX_LIST_CAPACITY + ld de, UsedSprites + (SPRITE_GFX_LIST_CAPACITY - 1) * 2 .FindLastSprite ld a, [de] and a @@ -17092,7 +17102,7 @@ ArrangeUsedSprites: ; 14355 ; Crystal introduces a second table in VRAM bank 0. ld hl, UsedSprites - ld c, $20 + ld c, SPRITE_GFX_LIST_CAPACITY ld b, 0 .FirstTableLength ; Keep going until the end of the list. @@ -17172,7 +17182,7 @@ GetSpriteLength: ; 14386 Function1439b: ; 1439b ld hl, UsedSprites - ld c, $20 + ld c, SPRITE_GFX_LIST_CAPACITY .asm_143a0 ld a, [wd13e] res 5, a @@ -18212,7 +18222,7 @@ Function14a1a: ; 14a1a call Function1d6e callba Function5e9a call SpeechTextBox - call Function1ad2 + call DrawOnMap callba Function4cf45 ld hl, UnknownText_0x15283 call Function14baf @@ -18418,13 +18428,13 @@ Function14b89: ; 14b89 Function14baf: ; 14baf ld b, BANK(UnknownText_0x15283) - call Function269a + call MapTextbox call Function1d58 lb bc, 0, 7 call PlaceYesNoBox ld a, [wcfa9] dec a - call Function1c17 + call WriteBackup push af call Functiond90 pop af @@ -19401,7 +19411,7 @@ Function1559a: ; 1559a .asm_155cc call Function156b8 call Function1c07 - call Function1c17 + call WriteBackup ret ; 155d6 @@ -19559,7 +19569,7 @@ Function156d9: ; 156d9 jr nz, .asm_156f9 call Function2173 call Function321c - call Function1ad2 + call DrawOnMap call Function156b8 ld c, $0 ret @@ -19951,7 +19961,7 @@ Function15985: ; 0x15985 ld a, $0 ld [wc2ce], a ld hl, MenuData15a08 - call Function1d3c + call CopyMenuDataHeader hlcoord 0, 0 ld b, $a ld c, $12 @@ -20239,8 +20249,8 @@ Function15b62: ; 15b62 Function15b6e: ; 15b6e ld hl, MenuDataHeader_0x15f88 - call Function1d3c - call Function1d81 + call CopyMenuDataHeader + call InterpretMenu2 jr c, .asm_15b84 ld a, [wcfa9] cp $1 @@ -20508,9 +20518,9 @@ Unknown_15ce3: ; 15ce3 Function15cef: ; 15cef callba Function24ae8 - call Function1ad2 + call DrawOnMap ld hl, MenuDataHeader_0x15e18 - call Function1d3c + call CopyMenuDataHeader ld a, [WalkingX] ld [wcf88], a ld a, [WalkingY] @@ -20535,7 +20545,7 @@ Function15cef: ; 15cef ld de, Money ld bc, $ffc3 ld a, $3 - call Function1600b + call CheckMoney jr c, .asm_15d79 ld hl, NumItems call ReceiveItem @@ -20549,7 +20559,7 @@ Function15cef: ; 15cef call Function15fc3 ld de, Money ld bc, $ffc3 - call Function15ffa + call TakeMoney ld a, $4 call Function15c7d call Functiona36 @@ -20925,7 +20935,7 @@ Function15efd: ; 15efd jr c, .asm_15f6e ld de, Money ld bc, $ffc3 - call Function15fd7 + call GiveMoney ld a, [wd107] ld hl, NumItems call TossItem @@ -21036,15 +21046,15 @@ Function15fcd: ; 15fcd ret ; 15fd7 -Function15fd7:: ; 15fd7 +GiveMoney:: ; 15fd7 ld a, $3 call Function16053 - ld bc, Unknown_15ff7 + ld bc, MaxMoney ld a, $3 - call Function1600b + call CheckMoney jr z, .asm_15ff5 jr c, .asm_15ff5 - ld hl, Unknown_15ff7 + ld hl, MaxMoney ld a, [hli] ld [de], a inc de @@ -21061,12 +21071,12 @@ Function15fd7:: ; 15fd7 ret ; 15ff7 -Unknown_15ff7: ; 15ff7 +MaxMoney: ; 15ff7 dt 999999 ; 15ffa -Function15ffa:: ; 15ffa +TakeMoney:: ; 15ffa ld a, $3 call Function16035 jr nc, .asm_16009 @@ -21084,9 +21094,9 @@ Function15ffa:: ; 15ffa ret ; 1600b -Function1600b:: ; 1600b +CheckMoney:: ; 1600b ld a, $3 -Function1600d: ; 1600d +CheckFunds: ; 1600d push hl push de push bc @@ -21196,13 +21206,13 @@ Function16055: ; 16055 ret ; 1606f -Function1606f:: ; 1606f +GiveCoins:: ; 1606f ld a, $2 ld de, Coins call Function16055 ld a, $2 ld bc, Unknown_1608d - call Function1600d + call CheckFunds jr c, .asm_1608b ld hl, Unknown_1608d ld a, [hli] @@ -21223,7 +21233,7 @@ Unknown_1608d: ; 1608d ; 1608f -Function1608f:: ; 1608f +TakeCoins:: ; 1608f ld a, $2 ld de, Coins call Function16037 @@ -21240,10 +21250,10 @@ Function1608f:: ; 1608f ret ; 160a1 -Function160a1:: ; 160a1 +CheckCoins:: ; 160a1 ld a, $2 ld de, Coins - jp Function1600d + jp CheckFunds ; 160a9 @@ -21356,9 +21366,9 @@ Function162a8: ; 162a8 call PrintText call Function1d6e ld hl, MenuDataHeader_0x166b5 - call Function1d3c - call Function1d81 - call Function1c17 + call CopyMenuDataHeader + call InterpretMenu2 + call WriteBackup jr c, .asm_162ce ld a, [wcfa9] cp $1 @@ -21402,7 +21412,7 @@ Function162e0: ; 162e0 call Function16517 call Function1656b call Function16571 - call Function1c17 + call WriteBackup jr c, .asm_1636d ld hl, StringBuffer2 ld a, [hli] @@ -21412,7 +21422,7 @@ Function162e0: ; 162e0 jr z, .asm_1636d ld de, Money ld bc, StringBuffer2 - callba Function1600b + callba CheckMoney jr c, .asm_1635f ld hl, StringBuffer2 ld de, StringBuffer2 + 3 @@ -21420,11 +21430,11 @@ Function162e0: ; 162e0 call CopyBytes ld bc, wd851 ld de, StringBuffer2 - callba Function15fd7 + callba GiveMoney jr c, .asm_16366 ld bc, StringBuffer2 + 3 ld de, Money - callba Function15ffa + callba TakeMoney ld hl, StringBuffer2 ld de, wd851 ld bc, $0003 @@ -21469,7 +21479,7 @@ Function16373: ; 16373 call Function16512 call Function1656b call Function16571 - call Function1c17 + call WriteBackup jr c, .asm_16400 ld hl, StringBuffer2 ld a, [hli] @@ -21483,15 +21493,15 @@ Function16373: ; 16373 call CopyBytes ld de, wd851 ld bc, StringBuffer2 - callba Function1600b + callba CheckMoney jr c, .asm_163f2 ld bc, Money ld de, StringBuffer2 - callba Function15fd7 + callba GiveMoney jr c, .asm_163f9 ld bc, StringBuffer2 + 3 ld de, wd851 - callba Function15ffa + callba TakeMoney ld hl, StringBuffer2 ld de, Money ld bc, $0003 @@ -21727,7 +21737,7 @@ Function1651a: ; 1651a ld de, StringBuffer2 ld bc, $a306 call PrintNum - call Function1ad2 + call DrawOnMap call Function3238 ret ; 1656b @@ -21821,7 +21831,7 @@ Function165b9: ; 165b9 ld c, l ld b, h ld de, StringBuffer2 - callba Function15fd7 + callba GiveMoney ret .asm_165f5 @@ -21830,7 +21840,7 @@ Function165b9: ; 165b9 ld c, l ld b, h ld de, StringBuffer2 - callba Function15ffa + callba TakeMoney ret ; 16607 @@ -22188,7 +22198,7 @@ Function16807: ; 16807 .asm_1682d ld de, Money ld bc, StringBuffer2 + 2 - callba Function1600b + callba CheckMoney jr c, .asm_16848 ld a, [PartyCount] cp $6 @@ -22215,7 +22225,7 @@ Function16807: ; 16807 Function16850: ; 16850 ld bc, StringBuffer2 + 2 ld de, Money - callba Function15ffa + callba TakeMoney ld a, $d call Function1689b ld a, [CurPartySpecies] @@ -23234,7 +23244,7 @@ Function16f3e:: ; 16f3e .loop ld a, [de] inc de - cp $ff + cp -1 ret z cp EGG jr nz, .next @@ -23252,7 +23262,7 @@ Function16f3e:: ; 16f3e jr .loop ; 16f5e -Function16f5e:: ; 16f5e +OverworldHatchEgg:: ; 16f5e call ResetWindow call Function1d6e call Function16f70 @@ -23270,7 +23280,7 @@ Function16f70: ; 16f70 (5:6f70) Function16f7a: ; 16f7a (5:6f7a) ld a, [de] inc de - cp $ff + cp -1 jp z, Function1708a push de push hl @@ -23296,11 +23306,12 @@ Function16f7a: ; 16f7a (5:6f7a) ld a, [CurPartySpecies] cp TOGEPI - jr nz, .asm_16fbf - ld de, $54 + jr nz, .nottogepi + ; set the event flag for hatching togepi + ld de, EVENT_TOGEPI_HATCHED ld b, $1 call EventFlagAction -.asm_16fbf +.nottogepi pop de @@ -23361,7 +23372,7 @@ Function16f7a: ; 16f7a (5:6f7a) ld [hl], a ld a, [CurPartyMon] ld hl, PartyMonOT ; wddff (aliases: PartyMonOT) - ld bc, $b + ld bc, NAME_LENGTH call AddNTimes ld d, h ld e, l @@ -23380,7 +23391,7 @@ Function16f7a: ; 16f7a (5:6f7a) call PrintText call YesNoBox pop de - jr c, .asm_17074 + jr c, .nonickname ld a, $1 ld [wd26b], a xor a @@ -23392,9 +23403,9 @@ Function16f7a: ; 16f7a (5:6f7a) ld de, StringBuffer1 call InitName jr Function1707d -.asm_17074 +.nonickname ld hl, StringBuffer1 - ld bc, $b + ld bc, PKMN_NAME_LENGTH call CopyBytes Function1707d: ; 1707d (5:707d) @@ -23459,29 +23470,29 @@ Function170bf: ; 170bf ld d, h ld e, l ld b, NUM_MOVES -.asm_170c6 +.loop ld a, [de] and a - jr z, .asm_170e3 + jr z, .done ld hl, wEggMonMoves ld c, NUM_MOVES -.asm_170cf +.next ld a, [de] cp [hl] - jr z, .asm_170df + jr z, .skip inc hl dec c - jr nz, .asm_170cf + jr nz, .next call Function170e4 - jr nc, .asm_170df + jr nc, .skip call Function17169 -.asm_170df +.skip inc de dec b - jr nz, .asm_170c6 + jr nz, .loop -.asm_170e3 +.done ret ; 170e4 @@ -23498,31 +23509,31 @@ GLOBAL EggMoves add hl, bc ld a, BANK(EggMovePointers) call GetFarHalfword -.asm_170f6 +.loop ld a, BANK(EggMoves) call GetFarByte - cp $ff - jr z, .asm_17107 + cp -1 + jr z, .found_mon ld b, a ld a, [de] cp b - jr z, .asm_17163 + jr z, .done_carry inc hl - jr .asm_170f6 + jr .loop -.asm_17107 +.found_mon call Function1720b ld b, NUM_MOVES -.asm_1710c +.loop2 ld a, [de] cp [hl] - jr z, .asm_17116 + jr z, .found_eggmove inc hl dec b - jr z, .asm_17146 - jr .asm_1710c + jr z, .inherit_tmhm + jr .loop2 -.asm_17116 +.found_eggmove ld a, [wEggMonSpecies] dec a ld c, a @@ -23532,51 +23543,51 @@ GLOBAL EggMoves add hl, bc ld a, BANK(EvosAttacksPointers) call GetFarHalfword -.asm_17127 +.loop3 ld a, BANK(EvosAttacks) call GetFarByte inc hl and a - jr nz, .asm_17127 -.asm_17130 + jr nz, .loop3 +.loop4 ld a, BANK(EvosAttacks) call GetFarByte and a - jr z, .asm_17146 + jr z, .inherit_tmhm inc hl ld a, BANK(EvosAttacks) call GetFarByte ld b, a ld a, [de] cp b - jr z, .asm_17163 + jr z, .done_carry inc hl - jr .asm_17130 + jr .loop4 -.asm_17146 +.inherit_tmhm ld hl, TMHMMoves -.asm_17149 +.loop5 ld a, BANK(TMHMMoves) call GetFarByte inc hl and a - jr z, .asm_17166 + jr z, .done ld b, a ld a, [de] cp b - jr nz, .asm_17149 + jr nz, .loop5 ld [wd262], a predef CanLearnTMHMMove ld a, c and a - jr z, .asm_17166 + jr z, .done -.asm_17163 +.done_carry pop bc scf ret -.asm_17166 +.done pop bc and a ret @@ -23589,12 +23600,12 @@ Function17169: ; 17169 ld b, a ld hl, wEggMonMoves ld c, NUM_MOVES -.asm_17172 +.loop ld a, [hli] and a - jr z, .asm_17187 + jr z, .done dec c - jr nz, .asm_17172 + jr nz, .loop ld de, wEggMonMoves ld hl, wEggMonMoves + 1 ld a, [hli] @@ -23606,7 +23617,7 @@ Function17169: ; 17169 ld a, [hli] ld [de], a -.asm_17187 +.done dec hl ld [hl], b ld hl, wEggMonMoves @@ -23621,17 +23632,17 @@ Function17197: ; 17197 ld hl, wBreedMon2Moves ld a, [wBreedMon1Species] cp DITTO - jr z, .asm_171b1 + jr z, .ditto1 ld a, [wBreedMon2Species] cp DITTO - jr z, .asm_171d7 + jr z, .ditto2 ld a, [wDittoInDaycare] and a ret z ld hl, wBreedMon1Moves ret -.asm_171b1 +.ditto1 ld a, [CurPartySpecies] push af ld a, [wBreedMon2Species] @@ -23643,11 +23654,11 @@ Function17197: ; 17197 ld a, $3 ld [MonType], a predef GetGender - jr c, .asm_171fb - jr nz, .asm_171fb - jr .asm_17203 + jr c, .inherit_mon2_moves + jr nz, .inherit_mon2_moves + jr .inherit_mon1_moves -.asm_171d7 +.ditto2 ld a, [CurPartySpecies] push af ld a, [wBreedMon1Species] @@ -23659,16 +23670,16 @@ Function17197: ; 17197 ld a, $3 ld [MonType], a predef GetGender - jr c, .asm_17203 - jr nz, .asm_17203 + jr c, .inherit_mon1_moves + jr nz, .inherit_mon1_moves -.asm_171fb +.inherit_mon2_moves ld hl, wBreedMon2Moves pop af ld [CurPartySpecies], a ret -.asm_17203 +.inherit_mon1_moves ld hl, wBreedMon1Moves pop af ld [CurPartySpecies], a @@ -23682,12 +23693,12 @@ Function1720b: ; 1720b ret z ld a, [wBreedMon2Species] cp DITTO - jr z, .asm_17220 + jr z, .ditto ld a, [wDittoInDaycare] and a ret z -.asm_17220 +.ditto ld hl, wBreedMon2Moves ret ; 17224 @@ -23936,7 +23947,7 @@ Function17421: ; 17421 ld a, [wDaycareLady] bit 0, a jr z, Function1745f - call Functionaaf + call KeepTextOpen ld hl, wBreedMon2Nick call Function1746c jp PrintText @@ -23949,7 +23960,7 @@ Function17440: ; 17440 ld a, [wDaycareMan] bit 0, a jr z, Function1745f - call Functionaaf + call KeepTextOpen ld hl, wBreedMon1Nick call Function1746c jp PrintText @@ -24320,7 +24331,7 @@ Function2400e:: ; 2400e ld a, [wcf94] rst FarCall call Function24085 - call Function1ad2 + call DrawOnMap call Function321c call Function2408f ret @@ -24332,7 +24343,7 @@ Function24022:: ; 24022 rst FarCall call Function24085 callba MobileTextBorder - call Function1ad2 + call DrawOnMap call Function321c call Function2408f ret @@ -24344,7 +24355,7 @@ Function2403c:: ; 2403c rst FarCall call Function24085 callba MobileTextBorder - call Function1ad2 + call DrawOnMap call Function321c call Function2411a ld hl, wcfa5 @@ -25160,11 +25171,11 @@ Function244c3: ; 0x244c3 ret ; 0x244e3 -Function244e3:: ; 244e3 +Pokepic:: ; 244e3 ld hl, MenuDataHeader_0x24547 - call Function1d3c + call CopyMenuDataHeader call Function1cbb - call Function1ad2 + call DrawOnMap call Function321c ld b, $12 call GetSGBLayout @@ -25190,9 +25201,9 @@ Function244e3:: ; 244e3 ret ; 24528 -Function24528:: ; 24528 +PokepicYesOrNo:: ; 24528 ld hl, MenuDataHeader_0x24547 - call Function1d3c + call CopyMenuDataHeader call Function1ce1 call WaitBGMap call ClearSGB @@ -25200,7 +25211,7 @@ Function24528:: ; 24528 ld [hBGMapMode], a call Function2173 call Function321c - call Function1ad2 + call DrawOnMap call Functione51 ret ; 24547 @@ -26130,12 +26141,12 @@ Function24ac3: ; 0x24ac3 Function24ae8: ; 24ae8 ld hl, MenuDataHeader_0x24b15 - call Function1d3c + call CopyMenuDataHeader jr Function24b01 Function24af0: ; 24af0 ld hl, MenuDataHeader_0x24b1d - call Function1d3c + call CopyMenuDataHeader jr Function24b01 Function24af8: ; 24af8 @@ -26674,11 +26685,11 @@ Function24e83: ; 24e83 Function24e99: ; 24e99 ; BattleMonMenu ld hl, MenuDataHeader_0x24ed4 - call Function1d3c + call CopyMenuDataHeader xor a ld [hBGMapMode], a call Function1cbb - call Function1ad2 + call DrawOnMap call Function1c89 call WaitBGMap call Function1c66 @@ -26750,7 +26761,7 @@ ContestBattleMenu: ; 24f13 Function24f19: ; 24f19 ld a, [wd0d2] ld [wcf88], a - call Function202a + call InterpretMenu ld a, [wcf88] ld [wd0d2], a call Function1c07 @@ -28326,7 +28337,7 @@ Function2695b: ; 2695b ld [hl], $ff call Function1d6e ld hl, MenuDataHeader_0x269c5 - call Function1d3c + call CopyMenuDataHeader xor a ld [hBGMapMode], a call Function352f @@ -29079,33 +29090,33 @@ Unknown_26f2b: ; 26f2b db $ff ; 26f59 -Function26f59:: ; 26f59 +DescribeDecoration:: ; 26f59 ld a, b - ld hl, Table26f5f + ld hl, JumpTable_DecorationDesc rst JumpTable ret ; 26f5f -Table26f5f: ; 26f5f - dw Function26f69 - dw Function26fb9 - dw Function26fbe - dw Function26fdd - dw Function26fc3 +JumpTable_DecorationDesc: ; 26f5f + dw DecorationDesc_Poster + dw DecorationDesc_LeftOrnament + dw DecorationDesc_RightOrnament + dw DecorationDesc_GiantDoll + dw DecorationDesc_Console ; 26f69 -Function26f69: ; 26f69 +DecorationDesc_Poster: ; 26f69 ld a, [Poster] - ld hl, Unknown_26f84 + ld hl, DecorationDesc_PosterPointers ld de, 3 call IsInArray jr c, .asm_26f7d - ld de, UnknownScript_0x26fb8 - ld b, BANK(UnknownScript_0x26fb8) + ld de, DecorationDesc_NullPoster + ld b, BANK(DecorationDesc_NullPoster) ret .asm_26f7d - ld b, BANK(UnknownScript_0x26f91) + ld b, BANK(DecorationDesc_TownMapPoster) inc hl ld a, [hli] ld d, [hl] @@ -29113,15 +29124,15 @@ Function26f69: ; 26f69 ret ; 26f84 -Unknown_26f84: ; 26f84 - dbw $10, UnknownScript_0x26f91 - dbw $11, UnknownScript_0x26fa0 - dbw $12, UnknownScript_0x26fa8 - dbw $13, UnknownScript_0x26fb0 +DecorationDesc_PosterPointers: ; 26f84 + dbw $10, DecorationDesc_TownMapPoster + dbw $11, DecorationDesc_PikachuPoster + dbw $12, DecorationDesc_ClefairyPoster + dbw $13, DecorationDesc_JigglypuffPoster db $ff ; 26f91 -UnknownScript_0x26f91: ; 0x26f91 +DecorationDesc_TownMapPoster: ; 0x26f91 loadfont writetext UnknownText_0x26f9b closetext @@ -29136,7 +29147,7 @@ UnknownText_0x26f9b: ; 0x26f9b db "@" ; 0x26fa0 -UnknownScript_0x26fa0: ; 0x26fa0 +DecorationDesc_PikachuPoster: ; 0x26fa0 jumptext UnknownText_0x26fa3 ; 0x26fa3 @@ -29146,7 +29157,7 @@ UnknownText_0x26fa3: ; 0x26fa3 db "@" ; 0x26fa8 -UnknownScript_0x26fa8: ; 0x26fa8 +DecorationDesc_ClefairyPoster: ; 0x26fa8 jumptext UnknownText_0x26fab ; 0x26fab @@ -29156,7 +29167,7 @@ UnknownText_0x26fab: ; 0x26fab db "@" ; 0x26fb0 -UnknownScript_0x26fb0: ; 0x26fb0 +DecorationDesc_JigglypuffPoster: ; 0x26fb0 jumptext UnknownText_0x26fb3 ; 0x26fb3 @@ -29166,23 +29177,23 @@ UnknownText_0x26fb3: ; 0x26fb3 db "@" ; 0x26fb8 -UnknownScript_0x26fb8: ; 26fb8 +DecorationDesc_NullPoster: ; 26fb8 end ; 26fb9 -Function26fb9: ; 26fb9 +DecorationDesc_LeftOrnament: ; 26fb9 ld a, [LeftOrnament] - jr Function26fc8 + jr DecorationDesc_OrnamentOrConsole -Function26fbe: ; 26fbe +DecorationDesc_RightOrnament: ; 26fbe ld a, [RightOrnament] - jr Function26fc8 + jr DecorationDesc_OrnamentOrConsole -Function26fc3: ; 26fc3 +DecorationDesc_Console: ; 26fc3 ld a, [Console] - jr Function26fc8 + jr DecorationDesc_OrnamentOrConsole -Function26fc8: ; 26fc8 +DecorationDesc_OrnamentOrConsole: ; 26fc8 ld c, a ld de, StringBuffer3 call Function26eea @@ -29201,7 +29212,7 @@ UnknownText_0x26fd8: ; 0x26fd8 db "@" ; 0x26fdd -Function26fdd: ; 26fdd +DecorationDesc_GiantDoll: ; 26fdd ld b, BANK(Unknown_26fe3) ld de, Unknown_26fe3 ret @@ -29322,7 +29333,7 @@ Function27092: ; 27092 ld a, e add $4 ld e, a - call Function2a66 + call GetBlockLocation ret ; 2709e @@ -29367,7 +29378,7 @@ Function2715c: ; 2715c callba Function3f47c callba Function3ed9f call ClearSGB - call Function1c17 + call WriteBackup call Function1d6e call WaitBGMap jp Function32f9 @@ -29477,14 +29488,14 @@ Function28000: ; 28000 call DelayFrames call ClearScreen call ClearSprites - call Function1ad2 + call DrawOnMap xor a ld [hSCX], a ld [hSCY], a ld c, $50 call DelayFrames call ClearScreen - call Function1ad2 + call DrawOnMap call Functione51 call Functione58 callba Function16d69a @@ -36947,36 +36958,36 @@ Function3991b: ; 3991b (e:591b) ret -Function39939:: ; 39939 +Battle_GetTrainerName:: ; 39939 ld a, [wcfc0] bit 0, a ld hl, wd26b - jp nz, Function39984 + jp nz, CopyTrainerName ld a, [OtherTrainerID] ld b, a ld a, [OtherTrainerClass] ld c, a -Function3994c:: ; 3994c +GetTrainerName:: ; 3994c ld a, c cp CAL - jr nz, .asm_3996d + jr nz, .not_cal2 ld a, $0 call GetSRAMBank ld a, [$abfd] and a call CloseSRAM - jr z, .asm_3996d + jr z, .not_cal2 ld a, $0 call GetSRAMBank ld hl, $abfe - call Function39984 + call CopyTrainerName jp CloseSRAM -.asm_3996d +.not_cal2 dec c push bc ld b, 0 @@ -36988,29 +36999,30 @@ Function3994c:: ; 3994c ld l, a pop bc -.asm_3997a +.loop dec b - jr z, Function39984 + jr z, CopyTrainerName -.asm_3997d +.skip ld a, [hli] cp $ff - jr nz, .asm_3997d - jr .asm_3997a + jr nz, .skip + jr .loop -Function39984: ; 39984 +CopyTrainerName: ; 39984 ld de, StringBuffer1 push de - ld bc, $000b + ld bc, NAME_LENGTH call CopyBytes pop de ret ; 39990 Function39990: ; 39990 +; This function is useless. ld de, StringBuffer1 push de - ld bc, $000b + ld bc, NAME_LENGTH pop de ret ; 39999 @@ -38488,7 +38500,7 @@ Function44654:: ; 44654 ret ; 446cc -Function446cc:: ; 446cc +GivePokeItem:: ; 446cc ld a, [PartyCount] dec a push af @@ -38608,7 +38620,7 @@ _KrisMailBoxMenu: ; 0x447a0 jr z, .nomail call Function1d6e call Function44806 - jp Function1c17 + jp WriteBackup .nomail ld hl, .EmptyMailboxText @@ -38682,11 +38694,11 @@ Function44806: ; 0x44806 .asm_4480f call InitMail ld hl, MenuData4494c - call Function1d3c + call CopyMenuDataHeader xor a ld [hBGMapMode], a call Function352f - call Function1ad2 + call DrawOnMap ld a, [wd0f1] ld [wcf88], a ld a, [OBPals + 8 * 6] @@ -38710,7 +38722,7 @@ Function44806: ; 0x44806 Function4484a: ; 0x4484a ld hl, MenuData44964 call LoadMenuDataHeader - call Function1d81 + call InterpretMenu2 call Function1c07 jr c, .asm_44860 ld a, [wcfa9] @@ -40742,8 +40754,8 @@ Function48dcb: ; 48dcb (12:4dcb) ld hl, MenuDataHeader_0x48dfc call LoadMenuDataHeader call Function3200 - call Function1d81 - call Function1c17 + call InterpretMenu2 + call WriteBackup ld a, [wcfa9] dec a ld [PlayerGender], a @@ -41957,7 +41969,7 @@ MainMenu: ; 49cdc ld hl, MenuDataHeader_0x49d14 call LoadMenuDataHeader call Function49de4 - call Function1c17 + call WriteBackup jr c, .quit call ClearTileMap ld a, [MenuSelection] @@ -42736,7 +42748,7 @@ Function4a28a: ; 4a28a (12:628a) callba Function104148 ld hl, MenuDataHeader_0x4a362 call LoadMenuDataHeader - call Function1d81 + call InterpretMenu2 bit 1, a jr nz, .asm_4a338 ld a, [wcfa9] @@ -43297,7 +43309,7 @@ CheckOwnMonAnywhere: ; 0x4a721 jr z, .nextbox ; Load the box. - ld hl, Unknown_4a810 + ld hl, BoxAddressTable1 ld b, 0 add hl, bc add hl, bc @@ -43430,7 +43442,7 @@ CheckOwnMon: ; 0x4a7ba ret ; 0x4a810 -Unknown_4a810: ; 4a810 +BoxAddressTable1: ; 4a810 ; bank, address dbw $02, $a000 dbw $02, $a450 @@ -43459,7 +43471,7 @@ UpdateOTPointer: ; 0x4a83a ; 0x4a843 -Function4a843: ; 4a843 +MobileCheckOwnMonAnywhere: ; 4a843 ; Like CheckOwnMonAnywhere, but only check for species. ; OT/ID don't matter. @@ -43512,7 +43524,7 @@ Function4a843: ; 4a843 and $f cp c jr z, .asm_4a8d1 - ld hl, Unknown_4a8f4 + ld hl, BoxAddressTable2 ld b, 0 add hl, bc add hl, bc @@ -43593,7 +43605,7 @@ Function4a8dc: ; 4a8dc ret ; 4a8f4 -Unknown_4a8f4: ; 4a8f4 +BoxAddressTable2: ; 4a8f4 ; bank, address dbw $02, $a000 dbw $02, $a450 @@ -44413,7 +44425,7 @@ Function4ae1f: ; 4ae1f ld bc, $0e07 push bc ld hl, YesNoMenuDataHeader - call Function1d3c + call CopyMenuDataHeader pop bc ld a, b ld [wcf83], a @@ -44424,7 +44436,7 @@ Function4ae1f: ; 4ae1f add $4 ld [wcf84], a call Function1c00 - call Function1d81 + call InterpretMenu2 push af ld c, $f call DelayFrames @@ -44448,7 +44460,7 @@ Function4ae5e: ; 4ae5e ld a, [hOAMUpdate] push af call Function1c07 - call Function1ad2 + call DrawOnMap xor a ld [hOAMUpdate], a call DelayFrame @@ -45107,8 +45119,8 @@ Function4d3b1: ; 4d3b1 ld hl, UnknownText_0x4d408 call PrintText ld hl, MenuDataHeader_0x4d40d - call Function1d3c - call Function1d81 + call CopyMenuDataHeader + call InterpretMenu2 ret c ld a, [wcfa9] cp $1 @@ -45385,8 +45397,8 @@ Function4d54c: ; 4d54c ld hl, UnknownText_0x4d580 call PrintText ld hl, MenuDataHeader_0x4d585 - call Function1d3c - call Function1d81 + call CopyMenuDataHeader + call InterpretMenu2 ret c ld a, [wcfa9] cp $1 @@ -45794,7 +45806,7 @@ Function4d9d3: ; 4d9d3 ret ; 4d9e5 -Function4d9e5: ; 4d9e5 +CheckPartyFullAfterContest: ; 4d9e5 ld a, [wdf9c] and a jp z, Function4db35 @@ -46226,7 +46238,7 @@ StatsScreenInit_gotaddress: ; 4dc94 push hl call WhiteBGMap call ClearTileMap - call Function1ad2 + call DrawOnMap callba Functionfb53e pop hl call _hl_ @@ -49276,7 +49288,7 @@ UnknownScript_0x506c8: ; 0x506c8 ; 0x506e5 UnknownScript_0x506e5: ; 0x506e5 - farjump UnknownScript_0x135eb + farjump BugCatchingContestBattleScript ; 0x506e9 UnknownScript_0x506e9: ; 0x506e9 @@ -52277,7 +52289,7 @@ INCLUDE "engine/engine_flags.asm" -Function80648:: ; 80648 (20:4648) +_GetVarAction:: ; 80648 (20:4648) ld a, c cp NUM_VARS jr c, .asm_8064e @@ -52285,7 +52297,7 @@ Function80648:: ; 80648 (20:4648) .asm_8064e ld c, a ld b, 0 - ld hl, Unknown_80671 + ld hl, VarActionTable add hl, bc add hl, bc add hl, bc @@ -52312,7 +52324,7 @@ Function8066c: ; 8066c (20:466c) ret ; 80671 (20:4671) -Unknown_80671: ; 80671 +VarActionTable: ; 80671 ; $00: return address ; $40: return at StringBuffer2 ; $80: return function result at StringBuffer2 @@ -53689,14 +53701,14 @@ Function82236: ; 82236 ld hl, $ffa9 ld a, [hl] and $4 - jr nz, .asm_82247 + jr nz, .next7 ld a, [hl] and $2 jr nz, .asm_82299 call Function822f0 ret -.asm_82247 +.next7 ld hl, wcf64 ld a, [hl] inc a @@ -56118,13 +56130,13 @@ Function88055: ; 88055 callba Function24c64 jr c, .asm_88083 ld hl, MenuDataHeader_0x88086 - call Function1d3c + call CopyMenuDataHeader ld a, [MenuSelection] ld [wcf88], a xor a ld [hBGMapMode], a call Function352f - call Function1ad2 + call DrawOnMap call Function350c ld a, [wcf73] cp $2 @@ -56194,7 +56206,7 @@ Function880c2: ; 880c2 xor a ld [hBGMapMode], a call Function1cbb - call Function1ad2 + call DrawOnMap call Function88116 call Function88126 call Function321c @@ -56211,7 +56223,7 @@ Function880c2: ; 880c2 scf .asm_88109 - call Function1c17 + call WriteBackup ret ; 8810d @@ -56524,11 +56536,11 @@ ShowPlayerNamingChoices: ; 88297 ld hl, KrisNameMenuHeader .GotGender call LoadMenuDataHeader - call Function1d81 + call InterpretMenu2 ld a, [wcfa9] dec a call Function1db8 - call Function1c17 + call WriteBackup ret ; 882b5 @@ -56981,7 +56993,7 @@ Function89261: ; 89261 push af push bc ld hl, MenuDataHeader_0x892a3 - call Function1d3c + call CopyMenuDataHeader pop bc ld hl, wcf82 ld a, c @@ -56999,11 +57011,11 @@ Function89261: ; 89261 call Function1c00 call Function8923c call Function89209 - call Function1d81 + call InterpretMenu2 push af ld c, $a call DelayFrames - call Function1c17 + call WriteBackup call Function8920f pop af jr c, .asm_892a1 @@ -58929,7 +58941,7 @@ Palette_89d56: ; 89d56 Function89d5e: ; 89d5e (22:5d5e) push af - call Function1d3c + call CopyMenuDataHeader pop af ld [wcf88], a call Function8923c @@ -59551,7 +59563,7 @@ Function8a116: ; 8a116 (22:6116) ret .asm_8a16b call Function89209 - call Function1c17 + call WriteBackup call Function8920f scf ret @@ -59734,7 +59746,7 @@ Function8a2aa: ; 8a2aa (22:62aa) and a ret .asm_8a2ea - call Function1c17 + call WriteBackup .asm_8a2ed scf ret @@ -59870,7 +59882,7 @@ Function8a3b2: ; 8a3b2 (22:63b2) call Function89b3b ld hl, MenuDataHeader_0x8a40f .asm_8a3db - call Function1d3c + call CopyMenuDataHeader ret Function8a3df: ; 8a3df (22:63df) @@ -60634,7 +60646,7 @@ Function8a999: ; 8a999 (22:6999) jr .asm_8a9a1 .asm_8a9bb call Function89209 - call Function1c17 + call WriteBackup call Function8920f ret @@ -61295,7 +61307,7 @@ Function8ae68: ; 8ae68 xor a ld [hBGMapMode], a call Function1cbb - call Function1ad2 + call DrawOnMap call Function321c call Function1cfd inc hl @@ -61324,7 +61336,7 @@ Function8ae68: ; 8ae68 call Function3200 call Functiona36 call PlayClickSFX - call Function1c17 + call WriteBackup ret ; 8aebc @@ -61472,7 +61484,7 @@ SpecialBuenasPassword: ; 8af6b xor a ld [wcf76], a ld hl, MenuDataHeader_0x8afa9 - call Function1d3c + call CopyMenuDataHeader ld a, [wdc4a] ld c, a callba Functionb8f8f @@ -61550,7 +61562,7 @@ SpecialBuenaPrize: ; 8afd4 .asm_8aff1 call DelayFrame - call Function1ad2 + call DrawOnMap call Function8b097 call Function8b0e2 jr z, .asm_8b05f @@ -61606,8 +61618,8 @@ SpecialBuenaPrize: ; 8afd4 jr .asm_8afeb .asm_8b05f - call Function1c17 - call Function1c17 + call WriteBackup + call WriteBackup ld hl, UnknownText_0x8b08b call PrintText call Functiona36 @@ -61668,9 +61680,9 @@ Function8b09e: ; 8b09e xor a ld [hBGMapMode], a ld hl, MenuDataHeader_0x8b0d1 - call Function1d3c + call CopyMenuDataHeader call Function1cbb - call Function1ad2 + call DrawOnMap call Function1cfd ld bc, $0015 add hl, bc @@ -61712,14 +61724,14 @@ MenuDataHeader_0x8b0dd: ; 0x8b0dd Function8b0e2: ; 8b0e2 ld hl, MenuDataHeader_0x8b113 - call Function1d3c + call CopyMenuDataHeader ld a, [MenuSelection] ld [wcf88], a xor a ld [wcf76], a ld [hBGMapMode], a call Function352f - call Function1ad2 + call DrawOnMap call Function350c ld a, [MenuSelection] ld c, a @@ -62948,7 +62960,7 @@ Function8b79e: ; 8b79e Function8b7bd: ; 8b7bd call Function8b855 ld hl, MenuDataHeader_0x8b867 - call Function1d3c + call CopyMenuDataHeader ld a, [wd030] ld [wcf88], a ld a, [wd031] @@ -62973,7 +62985,7 @@ Function8b7bd: ; 8b7bd ld c, $12 call Function8b703 call Function8b75d - call Function1ad2 + call DrawOnMap call Function89209 call Function350c call Function8920f @@ -63776,7 +63788,7 @@ Function8c26d: ; 8c26d cp $4 jr z, .asm_8c288 callba Function6454 - call Function1ad2 + call DrawOnMap call DelayFrame call Function8c2a0 call Function8cf4f @@ -68782,8 +68794,8 @@ INCLUDE "menu/mon_icons.asm" SECTION "bank24", ROMX, BANK[$24] -Function90000:: ; 90000 - call Function9001c +AddPhoneNumber:: ; 90000 + call _CheckCellNum jr c, .asm_9000d call Function9002d jr nc, .asm_9000d @@ -68797,8 +68809,8 @@ Function90000:: ; 90000 ; 9000f -Function9000f:: ; 9000f - call Function9001c +DelCellNum:: ; 9000f + call _CheckCellNum jr nc, .asm_90017 xor a ld [hl], a @@ -68809,11 +68821,11 @@ Function9000f:: ; 9000f ret ; 90019 -Function90019:: ; 90019 - jp Function9001c +CheckCellNum:: ; 90019 + jp _CheckCellNum ; 9001c -Function9001c: ; 9001c +_CheckCellNum: ; 9001c ld hl, wdc7c ld b, $a .asm_90021 @@ -68863,7 +68875,7 @@ Function90040: ; 90040 push bc push hl ld c, a - call Function9001c + call _CheckCellNum jr c, .asm_9005b ld hl, Buffer1 inc [hl] @@ -68946,7 +68958,7 @@ Function900ad: ; 900ad (24:40ad) push bc push de push af - callba Functionc000 + callba CheckTime pop af and $7 and c @@ -68977,7 +68989,7 @@ Function900bf: ; 900bf (24:40bf) ret Function900de: ; 900de (24:40de) - callba Functionc000 + callba CheckTime ld a, c ld [EngineBuffer1], a ; wd03e (aliases: MenuItemsList, CurFruitTree, CurInput) ld hl, wd040 @@ -69208,7 +69220,7 @@ UnknownScript_0x90241: ; 0x90241 callasm Function9026f ptcall wd048 closetext - callasm Function902eb + callasm HangUp loadmovesprites callasm Function113e5 end @@ -69243,84 +69255,84 @@ Function9026f: ; 9026f ; 9027c Function9027c: ; 9027c (24:427c) - call Function9033f - call Function90357 - call Function90292 - call Function90357 - call Function90375 - call Function90357 - call Function90292 + call Phone_StartRinging + call Phone_Wait20Frames + call Phone_CallerTextboxWithName + call Phone_Wait20Frames + call Phone_CallerTextbox + call Phone_Wait20Frames + call Phone_CallerTextboxWithName ret -Function90292: ; 90292 (24:4292) +Phone_CallerTextboxWithName: ; 90292 (24:4292) ld a, [wdbf9] ld b, a call Function90363 ret -Function9029a:: ; 9029a +PhoneCall:: ; 9029a ld a, b - ld [DefaultFlypoint], a + ld [PhoneScriptBank], a ld a, e - ld [wd003], a + ld [PhoneCallerLo], a ld a, d - ld [wd004], a - call Function902b3 - call Function902b3 + ld [PhoneCallerHi], a + call Phone_FirstOfTwoRings + call Phone_FirstOfTwoRings callba Function1060d3 ret ; 902b3 -Function902b3: ; 902b3 - call Function9033f - call Function90357 - call Function902c9 - call Function90357 - call Function90375 - call Function90357 - call Function902c9 +Phone_FirstOfTwoRings: ; 902b3 + call Phone_StartRinging + call Phone_Wait20Frames + call Phone_CallerTextboxWithName2 + call Phone_Wait20Frames + call Phone_CallerTextbox + call Phone_Wait20Frames + call Phone_CallerTextboxWithName2 ret ; 902c9 -Function902c9: ; 902c9 - call Function90375 +Phone_CallerTextboxWithName2: ; 902c9 + call Phone_CallerTextbox hlcoord 1, 2 ld [hl], $62 inc hl inc hl - ld a, [wd002] + ld a, [PhoneScriptBank] ld b, a - ld a, [wd003] + ld a, [PhoneCallerLo] ld e, a - ld a, [wd004] + ld a, [PhoneCallerHi] ld d, a call Function90069 ret ; 902e3 -Function902e3: ; 902e3 (24:42e3) +Phone_NoSignal: ; 902e3 (24:42e3) ld de, SFX_NO_SIGNAL call PlaySFX - jr Function902f1 + jr Phone_CallEnd -Function902eb:: ; 902eb - call Function9031d - call Function90355 -Function902f1: - call Function9032f - call Function90355 - call Function9033b - call Function90355 - call Function9032f - call Function90355 - call Function9033b - call Function90355 - call Function9032f - call Function90355 - call Function9033b - call Function90355 +HangUp:: ; 902eb + call HangUp_Beep + call HangUp_Wait20Frames +Phone_CallEnd: + call HangUp_BoopOn + call HangUp_Wait20Frames + call HangUp_BoopOff + call HangUp_Wait20Frames + call HangUp_BoopOn + call HangUp_Wait20Frames + call HangUp_BoopOff + call HangUp_Wait20Frames + call HangUp_BoopOn + call HangUp_Wait20Frames + call HangUp_BoopOff + call HangUp_Wait20Frames ret ; 90316 @@ -69330,7 +69342,7 @@ Function90316: ; 90316 ret ; 9031d -Function9031d: ; 9031d +HangUp_Beep: ; 9031d ld hl, UnknownText_0x9032a call PrintText ld de, SFX_HANG_UP @@ -69344,7 +69356,7 @@ UnknownText_0x9032a: ; 9032a ; 9032f -Function9032f: ; 9032f +HangUp_BoopOn: ; 9032f ld hl, UnknownText_0x90336 call PrintText ret @@ -69356,25 +69368,25 @@ UnknownText_0x90336: ; 0x90336 ; 0x9033b -Function9033b: ; 9033b +HangUp_BoopOff: ; 9033b call SpeechTextBox ret ; 9033f -Function9033f: ; 9033f +Phone_StartRinging: ; 9033f call WaitSFX ld de, SFX_CALL call PlaySFX - call Function90375 - call Function1ad2 + call Phone_CallerTextbox + call DrawOnMap callba Function4d188 ret ; 90355 -Function90355: ; 90355 - jr Function90357 +HangUp_Wait20Frames: ; 90355 + jr Phone_Wait20Frames -Function90357 +Phone_Wait20Frames ld c, 20 call DelayFrames callba Function4d188 @@ -69384,7 +69396,7 @@ Function90357 Function90363: ; 90363 (24:4363) push bc - call Function90375 + call Phone_CallerTextbox hlcoord 1, 1 ld [hl], $62 inc hl @@ -69396,7 +69408,7 @@ Function90363: ; 90363 (24:4363) ret -Function90375: ; 90375 +Phone_CallerTextbox: ; 90375 ld hl, TileMap ld b, $2 ld c, $12 @@ -69492,7 +69504,7 @@ String_9040d: db "BUENA:", $22, " DISC JOCKEY@" Function90423: ; 90423 (24:4423) push hl push bc - callba Function3994c + callba GetTrainerName pop bc pop hl ret @@ -70080,7 +70092,7 @@ Function90913: ; 90913 call Function90993 jr nc, .asm_9096a call Function1c07 - call Function1ad2 + call DrawOnMap ld hl, UnknownText_0x90a44 call PrintText call YesNoBox @@ -71343,7 +71355,7 @@ Function911eb: ; 911eb (24:51eb) inc [hl] ret .asm_91234 - callba Function902e3 + callba Phone_NoSignal ld hl, OutOfServiceAreaText call PrintText ld a, $8 @@ -71369,7 +71381,7 @@ Function91256: ; 91256 (24:5256) ld a, [hJoyPressed] ; $ff00+$a7 and $3 ret z - callba Function902eb + callba HangUp ld a, $8 ld [wcf63], a ld hl, UnknownText_0x914ce @@ -75194,8 +75206,8 @@ Function9307c: ; 9307c (24:707c) call PrintText ld hl, MenuDataHeader_0x930d6 call LoadMenuDataHeader - call Function1d81 - call Function1c17 + call InterpretMenu2 + call WriteBackup ret c ld a, [wcfa9] ld b, a @@ -75282,7 +75294,7 @@ Function930e9: ; 930e9 (24:70e9) call PlaceYesNoBox ld a, [wcfa9] dec a - call Function1c17 + call WriteBackup and a jr nz, .asm_93118 and a @@ -77809,7 +77821,7 @@ Functionb8cf2: ; b8cf2 (2e:4cf2) call CopyName1 pop bc ld b, $1 - callab Function3994c + callab GetTrainerName ld hl, UnknownText_0xb8d51 ld a, $2f jp Functionb9221 @@ -83389,10 +83401,10 @@ Functione245d: ; e245d (38:645d) Functione247d: ; e247d (38:647d) ld hl, BillsPCDepositMenuDataHeader - call Function1d3c + call CopyMenuDataHeader ld a, [wcfa9] call Function1d4b - call Function1d81 + call InterpretMenu2 jp c, BillsPCDepositFuncCancel ld a, [wcfa9] dec a @@ -83653,10 +83665,10 @@ Functione2655: ; e2655 (38:6655) Functione2675: ; e2675 (38:6675) ld hl, BillsPCWithdrawMenuDataHeader - call Function1d3c + call CopyMenuDataHeader ld a, [wcfa9] call Function1d4b - call Function1d81 + call InterpretMenu2 jp c, BillsPCWithdrawFuncCancel ld a, [wcfa9] dec a @@ -83914,10 +83926,10 @@ Functione283d: ; e283d Functione285d: ; e285d ld hl, MenuDataHeader_0xe28c3 - call Function1d3c + call CopyMenuDataHeader ld a, [wcfa9] call Function1d4b - call Function1d81 + call InterpretMenu2 jp c, Functione28bd ld a, [wcfa9] dec a @@ -85591,7 +85603,7 @@ Functione35aa: ; e35aa (38:75aa) call Functione36cf call Functione379c ld hl, MenuDataHeader_0xe35f1 - call Function1d3c + call CopyMenuDataHeader xor a ld [wd0e4], a hlcoord 0, 4 @@ -85605,7 +85617,7 @@ Functione35aa: ; e35aa (38:75aa) call Functione36f9 jr .asm_e35b0 .asm_e35de - call Function1c17 + call WriteBackup ret Functione35e2: ; e35e2 (38:75e2) @@ -85774,7 +85786,7 @@ String_e36f1: ; e36f1 Functione36f9: ; e36f9 (38:76f9) ld hl, MenuDataHeader_0xe377b call LoadMenuDataHeader - call Function1d81 + call InterpretMenu2 call Function1c07 ret c ld a, [wcfa9] @@ -89575,7 +89587,7 @@ Functionfb877: ; fb877 call LowVolume call WhiteBGMap call ClearTileMap - call Function1ad2 + call DrawOnMap call ClearSprites ld a, [wPokedexStatus] push af @@ -91087,7 +91099,7 @@ Functionfd044: ; fd044 ld [$ffc5], a ld de, wd851 ld bc, $ffc3 - callba Function1600b + callba CheckMoney jr nc, .asm_fd067 .asm_fd065 @@ -91107,7 +91119,7 @@ Functionfd044: ; fd044 .asm_fd074 ld de, wdc19 ld bc, wd851 - callba Function1600b + callba CheckMoney jr z, .asm_fd08b jr nc, .asm_fd089 call Functionfd099 @@ -91147,7 +91159,7 @@ Functionfd0a6: ; fd0a6 (3f:50a6) ld [$ffc5], a ld de, wd851 ld bc, $ffc3 - callba Function15ffa + callba TakeMoney ret @@ -92313,7 +92325,7 @@ Function10486d:: ; 10486d ; 1048ba -Function1048ba: ; 1048ba (41:48ba) +DoMysteryGift: ; 1048ba (41:48ba) call ClearTileMap call ClearSprites call WaitBGMap @@ -92417,7 +92429,7 @@ Function1049af: ; 1049af (41:49af) Function1049b4: ; 1049b4 (41:49b4) ld hl, UnknownText_0x104a02 call PrintText - jp Function1048ba + jp DoMysteryGift Function1049bd: ; 1049bd (41:49bd) ld hl, UnknownText_0x104a07 @@ -94660,7 +94672,7 @@ Function10609b: mobile ; 10609b ld hl, $a036 jp Function10611d -Function1060a2: mobile ; 1060a2 +Mobile_HealParty: mobile ; 1060a2 ld hl, $a039 jp Function10611d diff --git a/maps/AzaleaTown.asm b/maps/AzaleaTown.asm index 788c9bb9a..97a104ba5 100644 --- a/maps/AzaleaTown.asm +++ b/maps/AzaleaTown.asm @@ -29,7 +29,7 @@ AzaleaTown_MapScriptHeader: UnknownScript_0x198018: moveperson $b, $b, $b spriteface $0, RIGHT - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 special Functionc48f pause 15 appear $b @@ -39,7 +39,7 @@ UnknownScript_0x198018: UnknownScript_0x198034: spriteface $0, RIGHT - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 special Functionc48f pause 15 appear $b diff --git a/maps/BurnedTower1F.asm b/maps/BurnedTower1F.asm index b6a447a11..1d5765bd6 100644 --- a/maps/BurnedTower1F.asm +++ b/maps/BurnedTower1F.asm @@ -37,7 +37,7 @@ UnknownScript_0x185bf8: UnknownScript_0x185c0d: spriteface $3, DOWN - showemote $0, $3, 15 + showemote EMOTE_SHOCK, $3, 15 applymovement $3, MovementData_0x185cd3 loadfont writetext UnknownText_0x185ecc @@ -48,7 +48,7 @@ UnknownScript_0x185c0d: end UnknownScript_0x185c25: - showemote $0, $4, 15 + showemote EMOTE_SHOCK, $4, 15 special Functionc48f pause 15 spriteface $4, RIGHT @@ -101,7 +101,7 @@ UnknownScript_0x185c80: special Functionc48f pause 15 earthquake 50 - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 playsound SFX_ENTER_DOOR waitbutton changeblock $a, $8, $25 @@ -109,7 +109,7 @@ UnknownScript_0x185c80: pause 15 applymovement $0, MovementData_0x185cd1 playsound SFX_KINESIS - showemote $0, $4, 20 + showemote EMOTE_SHOCK, $4, 20 loadfont writetext UnknownText_0x185e75 closetext diff --git a/maps/CeruleanCity.asm b/maps/CeruleanCity.asm index 8c00721ec..24d67e23e 100644 --- a/maps/CeruleanCity.asm +++ b/maps/CeruleanCity.asm @@ -108,7 +108,7 @@ UnknownScript_0x184072: waitbutton playsound SFX_TRANSACTION waitbutton - showemote $0, $7, 15 + showemote EMOTE_SHOCK, $7, 15 spriteface $7, LEFT loadfont writetext UnknownText_0x1842ee diff --git a/maps/CeruleanGym.asm b/maps/CeruleanGym.asm index aaada87fb..912d49b7f 100644 --- a/maps/CeruleanGym.asm +++ b/maps/CeruleanGym.asm @@ -25,7 +25,7 @@ UnknownScript_0x1883de: writetext UnknownText_0x1884fb closetext loadmovesprites - showemote $0, $2, 15 + showemote EMOTE_SHOCK, $2, 15 applymovement $2, MovementData_0x1884f7 loadfont writetext UnknownText_0x188574 diff --git a/maps/CherrygroveCity.asm b/maps/CherrygroveCity.asm index d10dbabea..1c0d24386 100644 --- a/maps/CherrygroveCity.asm +++ b/maps/CherrygroveCity.asm @@ -102,7 +102,7 @@ UnknownScript_0x19c0aa: UnknownScript_0x19c0ae: spriteface $0, RIGHT - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 special Functionc48f pause 15 appear $3 diff --git a/maps/CianwoodCity.asm b/maps/CianwoodCity.asm index 4a75fdb8a..f9d444f9b 100644 --- a/maps/CianwoodCity.asm +++ b/maps/CianwoodCity.asm @@ -29,7 +29,7 @@ UnknownScript_0x1a001d: UnknownScript_0x1a001e: spriteface $0, UP - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 pause 15 playsound SFX_WARP_FROM applymovement $d, MovementData_0x1a00da diff --git a/maps/DragonShrine.asm b/maps/DragonShrine.asm index 5cde05b25..12b61b4ee 100644 --- a/maps/DragonShrine.asm +++ b/maps/DragonShrine.asm @@ -116,7 +116,7 @@ UnknownScript_0x18d100: closetext loadmovesprites playsound SFX_ENTER_DOOR - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 playmusic MUSIC_CLAIR appear $5 waitbutton @@ -147,7 +147,7 @@ UnknownScript_0x18d100: writetext UnknownText_0x18d520 closetext loadmovesprites - showemote $0, $5, 15 + showemote EMOTE_SHOCK, $5, 15 loadfont writetext UnknownText_0x18d9ae closetext diff --git a/maps/DragonsDenB1F.asm b/maps/DragonsDenB1F.asm index 4261c1f97..fbbbdfb37 100644 --- a/maps/DragonsDenB1F.asm +++ b/maps/DragonsDenB1F.asm @@ -42,7 +42,7 @@ UnknownScript_0x18c8b8: writetext UnknownText_0x18c9b8 pause 30 loadmovesprites - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 spriteface $0, LEFT playmusic MUSIC_CLAIR applymovement $3, MovementData_0x18c9ae diff --git a/maps/ElmsLab.asm b/maps/ElmsLab.asm index e2368ab0d..4760b403d 100644 --- a/maps/ElmsLab.asm +++ b/maps/ElmsLab.asm @@ -15,10 +15,10 @@ ElmsLab_MapScriptHeader: ; callbacks - dbw 2, UnknownScript_0x78b83 + dbw 2, ElmsLab_PutElmAtLaptop UnknownScript_0x78b7a: - priorityjump UnknownScript_0x78b8c + priorityjump ElmsLab_AutowalkUpToElm end UnknownScript_0x78b7e: @@ -36,50 +36,50 @@ UnknownScript_0x78b81: UnknownScript_0x78b82: end -UnknownScript_0x78b83: +ElmsLab_PutElmAtLaptop: checktriggers - iftrue UnknownScript_0x78b8b + iftrue .Skip moveperson $2, $3, $4 -UnknownScript_0x78b8b: +.Skip: return -UnknownScript_0x78b8c: - applymovement $0, MovementData_0x78f67 - showemote $0, $2, 15 +ElmsLab_AutowalkUpToElm: + applymovement $0, ElmsLab_WalkUpToElmMovement + showemote EMOTE_SHOCK, $2, 15 spriteface $2, RIGHT loadfont - writetext UnknownText_0x78fb6 -UnknownScript_0x78b9b: + writetext ElmText_Intro +ElmsLab_RefuseLoop: yesorno - iftrue UnknownScript_0x78ba5 - writetext UnknownText_0x7911a - jump UnknownScript_0x78b9b + iftrue ElmsLab_ElmGetsEmail + writetext ElmText_Refused + jump ElmsLab_RefuseLoop -UnknownScript_0x78ba5: - writetext UnknownText_0x790fa +ElmsLab_ElmGetsEmail: + writetext ElmText_Accepted keeptextopen - writetext UnknownText_0x7913a + writetext ElmText_ResearchAmbitions closetext loadmovesprites playsound SFX_GLASS_TING pause 30 - showemote $0, $2, 10 + showemote EMOTE_SHOCK, $2, 10 spriteface $2, DOWN loadfont - writetext UnknownText_0x791ae + writetext ElmText_GotAnEmail closetext loadmovesprites loadfont spriteface $2, RIGHT - writetext UnknownText_0x791df + writetext ElmText_MissionFromMrPokemon closetext loadmovesprites - applymovement $2, MovementData_0x78fa0 + applymovement $2, ElmsLab_ElmToDefaultPositionMovement1 spriteface $0, UP - applymovement $2, MovementData_0x78fa2 + applymovement $2, ElmsLab_ElmToDefaultPositionMovement2 spriteface $0, RIGHT loadfont - writetext UnknownText_0x792ff + writetext ElmText_ChooseAPokemon closetext dotrigger $1 loadmovesprites @@ -89,21 +89,21 @@ ProfElmScript: faceplayer loadfont checkevent EVENT_GOT_SS_TICKET_FROM_ELM - iftrue UnknownScript_0x78bee + iftrue ElmCheckMasterBall checkevent EVENT_BEAT_ELITE_FOUR iftrue ElmGiveTicketScript -UnknownScript_0x78bee: +ElmCheckMasterBall: checkevent EVENT_GOT_MASTER_BALL_FROM_ELM - iftrue UnknownScript_0x78bfa + iftrue ElmCheckEverstone checkflag ENGINE_RISINGBADGE iftrue ElmGiveMasterBallScript -UnknownScript_0x78bfa: +ElmCheckEverstone: checkevent EVENT_GOT_EVERSTONE_FROM_ELM - iftrue UnknownScript_0x78e16 + iftrue ElmScript_CallYou checkevent EVENT_SHOWED_TOGEPI_TO_ELM - iftrue UnknownScript_0x78e03 + iftrue ElmGiveEverstoneScript checkevent EVENT_TOLD_ELM_ABOUT_TOGEPI_OVER_THE_PHONE - iffalse UnknownScript_0x78c35 + iffalse ElmCheckTogepiEgg writebyte TOGEPI special Functionc284 iftrue ShowElmTogepiScript @@ -115,21 +115,21 @@ UnknownScript_0x78bfa: loadmovesprites end -UnknownScript_0x78c22: +ElmEggHatchedScript: writebyte TOGEPI special Functionc284 iftrue ShowElmTogepiScript writebyte TOGETIC special Functionc284 iftrue ShowElmTogepiScript - jump UnknownScript_0x78c41 + jump ElmCheckGotEggAgain -UnknownScript_0x78c35: +ElmCheckTogepiEgg: checkevent EVENT_GOT_TOGEPI_EGG_FROM_ELMS_AIDE - iffalse UnknownScript_0x78c41 + iffalse ElmCheckGotEggAgain checkevent EVENT_TOGEPI_HATCHED - iftrue UnknownScript_0x78c22 -UnknownScript_0x78c41: + iftrue ElmEggHatchedScript +ElmCheckGotEggAgain: checkevent EVENT_GOT_TOGEPI_EGG_FROM_ELMS_AIDE ; why are we checking it again? iftrue ElmWaitingEggHatchScript checkflag ENGINE_ZEPHYRBADGE @@ -140,7 +140,7 @@ UnknownScript_0x78c41: iftrue ElmAfterTheftScript checkevent EVENT_GOT_A_POKEMON_FROM_ELM iftrue ElmDescribesMrPokemonScript - writetext UnknownText_0x79375 + writetext ElmText_LetYourMonBattleIt closetext loadmovesprites end @@ -300,15 +300,15 @@ ElmsLabHealingMachine: .CanHeal writetext ElmsLabHealingMachineText2 yesorno - iftrue UnknownScript_0x78d8a + iftrue ElmsLabHealingMachine_HealParty loadmovesprites end -UnknownScript_0x78d8a: - special Function1060a2 +ElmsLabHealingMachine_HealParty: + special Mobile_HealParty special HealParty playmusic MUSIC_NONE - writebyte $1 + writebyte 1 ; Machine is in Elm's Lab special HealMachineAnim pause 30 special RestartMapMusic @@ -369,28 +369,28 @@ ShowElmTogepiScript: writetext ShowElmTogepiText1 closetext loadmovesprites - showemote $0, $2, 15 + showemote EMOTE_SHOCK, $2, 15 setevent EVENT_SHOWED_TOGEPI_TO_ELM loadfont writetext ShowElmTogepiText2 keeptextopen writetext ShowElmTogepiText3 keeptextopen -UnknownScript_0x78e03: +ElmGiveEverstoneScript: writetext ElmGiveEverstoneText1 keeptextopen verbosegiveitem EVERSTONE, 1 - iffalse UnknownScript_0x78e1a + iffalse ElmScript_NoRoomForEverstone writetext ElmGiveEverstoneText2 closetext loadmovesprites setevent EVENT_GOT_EVERSTONE_FROM_ELM end -UnknownScript_0x78e16: - writetext UnknownText_0x79c37 +ElmScript_CallYou: + writetext ElmText_CallYou closetext -UnknownScript_0x78e1a: +ElmScript_NoRoomForEverstone: loadmovesprites end @@ -419,95 +419,95 @@ ElmGiveTicketScript: ElmJumpBackScript1: loadmovesprites checkcode VAR_FACING - if_equal $0, UnknownScript_0x78e6d - if_equal $1, UnknownScript_0x78e67 - if_equal $2, UnknownScript_0x78e73 - if_equal $3, UnknownScript_0x78e79 + if_equal DOWN, ElmJumpDownScript + if_equal UP, ElmJumpUpScript + if_equal LEFT, ElmJumpLeftScript + if_equal RIGHT, ElmJumpRightScript end ElmJumpBackScript2: loadmovesprites checkcode VAR_FACING - if_equal $0, UnknownScript_0x78e67 - if_equal $1, UnknownScript_0x78e6d - if_equal $2, UnknownScript_0x78e79 - if_equal $3, UnknownScript_0x78e73 + if_equal DOWN, ElmJumpUpScript + if_equal UP, ElmJumpDownScript + if_equal LEFT, ElmJumpRightScript + if_equal RIGHT, ElmJumpLeftScript end -UnknownScript_0x78e67: - applymovement $2, MovementData_0x78f90 +ElmJumpUpScript: + applymovement $2, ElmJumpUpMovement loadfont end -UnknownScript_0x78e6d: - applymovement $2, MovementData_0x78f94 +ElmJumpDownScript: + applymovement $2, ElmJumpDownMovement loadfont end -UnknownScript_0x78e73: - applymovement $2, MovementData_0x78f98 +ElmJumpLeftScript: + applymovement $2, ElmJumpLeftMovement loadfont end -UnknownScript_0x78e79: - applymovement $2, MovementData_0x78f9c +ElmJumpRightScript: + applymovement $2, ElmJumpRightMovement loadfont end -UnknownScript_0x78e7f: - applymovement $3, MovementData_0x78f7e +AideScript_WalkPotions1: + applymovement $3, AideWalksRight1 spriteface $0, DOWN - scall UnknownScript_0x78e9d - applymovement $3, MovementData_0x78f87 + scall AideScript_GivePotions + applymovement $3, AideWalksLeft1 end -UnknownScript_0x78e8e: - applymovement $3, MovementData_0x78f82 +AideScript_WalkPotions2: + applymovement $3, AideWalksRight2 spriteface $0, DOWN - scall UnknownScript_0x78e9d - applymovement $3, MovementData_0x78f8b + scall AideScript_GivePotions + applymovement $3, AideWalksLeft2 end -UnknownScript_0x78e9d: +AideScript_GivePotions: loadfont - writetext UnknownText_0x79f38 + writetext AideText_GiveYouPotions keeptextopen verbosegiveitem POTION, 1 - writetext UnknownText_0x79f65 + writetext AideText_AlwaysBusy closetext loadmovesprites dotrigger $2 end -UnknownScript_0x78ead: - applymovement $3, MovementData_0x78f7e +AideScript_WalkBalls1: + applymovement $3, AideWalksRight1 spriteface $0, DOWN - scall UnknownScript_0x78ecb - applymovement $3, MovementData_0x78f87 + scall AideScript_GiveYouBalls + applymovement $3, AideWalksLeft1 end -UnknownScript_0x78ebc: - applymovement $3, MovementData_0x78f82 +AideScript_WalkBalls2: + applymovement $3, AideWalksRight2 spriteface $0, DOWN - scall UnknownScript_0x78ecb - applymovement $3, MovementData_0x78f8b + scall AideScript_GiveYouBalls + applymovement $3, AideWalksLeft2 end -UnknownScript_0x78ecb: +AideScript_GiveYouBalls: loadfont - writetext UnknownText_0x7a078 + writetext AideText_GiveYouBalls keeptextopen itemtotext POKE_BALL, $1 - scall UnknownScript_0x78ee2 + scall AideScript_ReceiveTheBalls giveitem POKE_BALL, $5 - writetext UnknownText_0x7a09a + writetext AideText_ExplainBalls keeptextopen itemnotify loadmovesprites dotrigger $2 end -UnknownScript_0x78ee2: +AideScript_ReceiveTheBalls: jumpstd receiveitem end @@ -515,49 +515,49 @@ ElmsAideScript: faceplayer loadfont checkevent EVENT_GOT_TOGEPI_EGG_FROM_ELMS_AIDE - iftrue UnknownScript_0x78f0c + iftrue AideScript_AfterTheft checkevent EVENT_GAVE_MYSTERY_EGG_TO_ELM - iftrue UnknownScript_0x78f06 + iftrue AideScript_ExplainBalls checkevent EVENT_GOT_MYSTERY_EGG_FROM_MR_POKEMON - iftrue UnknownScript_0x78f00 - writetext UnknownText_0x79f65 + iftrue AideScript_TheftTestimony + writetext AideText_AlwaysBusy closetext loadmovesprites end -UnknownScript_0x78f00: - writetext UnknownText_0x79f95 +AideScript_TheftTestimony: + writetext AideText_TheftTestimony closetext loadmovesprites end -UnknownScript_0x78f06: - writetext UnknownText_0x7a09a +AideScript_ExplainBalls: + writetext AideText_ExplainBalls closetext loadmovesprites end -UnknownScript_0x78f0c: - writetext UnknownText_0x79c65 +AideScript_AfterTheft: + writetext AideText_AfterTheft closetext loadmovesprites end -UnknownScript_0x78f12: - applymovement $0, MovementData_0x78f72 +MeetCopScript2: + applymovement $0, MeetCopScript2_StepLeft MeetCopScript: - applymovement $0, MovementData_0x78f74 + applymovement $0, MeetCopScript_WalkUp CopScript: spriteface $7, LEFT loadfont - writetext UnknownText_0x7a0f0 + writetext ElmsLabOfficerText1 keeptextopen special SpecialNameRival - writetext UnknownText_0x7a1c0 + writetext ElmsLabOfficerText2 closetext loadmovesprites - applymovement $7, MovementData_0x78f78 + applymovement $7, OfficerLeavesMovement disappear $7 dotrigger $2 end @@ -607,7 +607,7 @@ ElmsLabTrashcan2: ElmsLabBookshelf: jumpstd difficultbookshelf -MovementData_0x78f67: +ElmsLab_WalkUpToElmMovement: step_up step_up step_up @@ -622,17 +622,17 @@ MovementData_0x78f70: step_up step_end -MovementData_0x78f72: +MeetCopScript2_StepLeft: step_left step_end -MovementData_0x78f74: +MeetCopScript_WalkUp: step_up step_up turn_head_right step_end -MovementData_0x78f78: +OfficerLeavesMovement: step_down step_down step_down @@ -640,61 +640,61 @@ MovementData_0x78f78: step_down step_end -MovementData_0x78f7e: +AideWalksRight1: step_right step_right turn_head_up step_end -MovementData_0x78f82: +AideWalksRight2: step_right step_right step_right turn_head_up step_end -MovementData_0x78f87: +AideWalksLeft1: step_left step_left turn_head_down step_end -MovementData_0x78f8b: +AideWalksLeft2: step_left step_left step_left turn_head_down step_end -MovementData_0x78f90: +ElmJumpUpMovement: fix_facing big_step_up remove_fixed_facing step_end -MovementData_0x78f94: +ElmJumpDownMovement: fix_facing big_step_down remove_fixed_facing step_end -MovementData_0x78f98: +ElmJumpLeftMovement: fix_facing big_step_left remove_fixed_facing step_end -MovementData_0x78f9c: +ElmJumpRightMovement: fix_facing big_step_right remove_fixed_facing step_end -MovementData_0x78fa0: +ElmsLab_ElmToDefaultPositionMovement1: step_up step_end -MovementData_0x78fa2: +ElmsLab_ElmToDefaultPositionMovement2: step_right step_right step_up @@ -722,7 +722,7 @@ AfterChikoritaMovement: turn_head_up step_end -UnknownText_0x78fb6: +ElmText_Intro: text "ELM: !" line "There you are!" @@ -761,19 +761,19 @@ UnknownText_0x78fb6: line "caught." done -UnknownText_0x790fa: +ElmText_Accepted: text "Thanks, !" para "You're a great" line "help!" done -UnknownText_0x7911a: +ElmText_Refused: text "But… Please, I" line "need your help!" done -UnknownText_0x7913a: +ElmText_ResearchAmbitions: text "When I announce my" line "findings, I'm sure" @@ -787,7 +787,7 @@ UnknownText_0x7913a: line "it!" done -UnknownText_0x791ae: +ElmText_GotAnEmail: text "Oh, hey! I got an" line "e-mail!" @@ -797,7 +797,7 @@ UnknownText_0x791ae: para "Okay…" done -UnknownText_0x791df: +ElmText_MissionFromMrPokemon: text "Hey, listen." para "I have an acquain-" @@ -830,7 +830,7 @@ UnknownText_0x791df: line "go in our place?" done -UnknownText_0x792ff: +ElmText_ChooseAPokemon: text "I want you to" line "raise one of the" @@ -844,7 +844,7 @@ UnknownText_0x792ff: para "Go on. Pick one!" done -UnknownText_0x79375: +ElmText_LetYourMonBattleIt: text "If a wild #MON" line "appears, let your" cont "#MON battle it!" @@ -1125,13 +1125,13 @@ ElmGiveEverstoneText2: cont "to evolve." done -UnknownText_0x79c37: +ElmText_CallYou: text "ELM: , I'll" line "call you if any-" cont "thing comes up." done -UnknownText_0x79c65: +AideText_AfterTheft: text "…sigh… That" line "stolen #MON." @@ -1208,25 +1208,25 @@ ElmGiveTicketText2: line "PROF.OAK in KANTO!" done -UnknownText_0x79f0b: +ElmsLabSignpostText_Egg: text "It's the #MON" line "EGG being studied" cont "by PROF.ELM." done -UnknownText_0x79f38: +AideText_GiveYouPotions: text ", I want" line "you to have this" cont "for your errand." done -UnknownText_0x79f65: +AideText_AlwaysBusy: text "There are only two" line "of us, so we're" cont "always busy." done -UnknownText_0x79f95: +AideText_TheftTestimony: text "There was a loud" line "noise outside…" @@ -1251,14 +1251,14 @@ UnknownText_0x79f95: line "itself." done -UnknownText_0x7a078: +AideText_GiveYouBalls: text "!" para "Use these on your" line "#DEX quest!" done -UnknownText_0x7a09a: +AideText_ExplainBalls: text "To add to your" line "#DEX, you have" cont "to catch #MON." @@ -1268,7 +1268,7 @@ UnknownText_0x7a09a: cont "to get them." done -UnknownText_0x7a0f0: +ElmsLabOfficerText1: text "I heard a #MON" line "was stolen here…" @@ -1289,7 +1289,7 @@ UnknownText_0x7a0f0: line "get his name?" done -UnknownText_0x7a1c0: +ElmsLabOfficerText2: text "OK! So " line "was his name." @@ -1381,11 +1381,11 @@ ElmsLab_MapEventHeader: xy_trigger 1, $6, $4, $0, LabTryToLeaveScript, $0, $0 xy_trigger 1, $6, $5, $0, LabTryToLeaveScript, $0, $0 xy_trigger 3, $5, $4, $0, MeetCopScript, $0, $0 - xy_trigger 3, $5, $5, $0, UnknownScript_0x78f12, $0, $0 - xy_trigger 5, $8, $4, $0, UnknownScript_0x78e7f, $0, $0 - xy_trigger 5, $8, $5, $0, UnknownScript_0x78e8e, $0, $0 - xy_trigger 6, $8, $4, $0, UnknownScript_0x78ead, $0, $0 - xy_trigger 6, $8, $5, $0, UnknownScript_0x78ebc, $0, $0 + xy_trigger 3, $5, $5, $0, MeetCopScript2, $0, $0 + xy_trigger 5, $8, $4, $0, AideScript_WalkPotions1, $0, $0 + xy_trigger 5, $8, $5, $0, AideScript_WalkPotions2, $0, $0 + xy_trigger 6, $8, $4, $0, AideScript_WalkBalls1, $0, $0 + xy_trigger 6, $8, $5, $0, AideScript_WalkBalls2, $0, $0 ; signposts db 16 diff --git a/maps/FastShipCabins_SE_SSE_CaptainsCabin.asm b/maps/FastShipCabins_SE_SSE_CaptainsCabin.asm index 5e9eb09d9..562917910 100644 --- a/maps/FastShipCabins_SE_SSE_CaptainsCabin.asm +++ b/maps/FastShipCabins_SE_SSE_CaptainsCabin.asm @@ -45,7 +45,7 @@ TwinScript_0x75ebb: spriteface $4, UP special Function8c0ab spriteface $3, DOWN - showemote $0, $3, 15 + showemote EMOTE_SHOCK, $3, 15 applymovement $4, MovementData_0x7600c spriteface $3, RIGHT checkflag ENGINE_PLAYER_IS_FEMALE diff --git a/maps/FastShipCabins_SW_SSW_NW.asm b/maps/FastShipCabins_SW_SSW_NW.asm index 5c3b58a4a..08c1d8fda 100644 --- a/maps/FastShipCabins_SW_SSW_NW.asm +++ b/maps/FastShipCabins_SW_SSW_NW.asm @@ -129,7 +129,7 @@ FastShipBed: loadmovesprites special Function8c0b6 special Functiond91 - special Function1060a2 + special Mobile_HealParty special HealParty playmusic MUSIC_HEAL pause 60 diff --git a/maps/GoldenrodDeptStore5F.asm b/maps/GoldenrodDeptStore5F.asm index a551e86ad..fde98406a 100644 --- a/maps/GoldenrodDeptStore5F.asm +++ b/maps/GoldenrodDeptStore5F.asm @@ -60,7 +60,7 @@ ReceptionistScript_0x560ce: if_not_equal SUNDAY, UnknownScript_0x56112 checkflag ENGINE_GOLDENROD_MALL_5F_HAPPINESS_EVENT iftrue UnknownScript_0x56112 - special Function718d + special GetFirstPokemonHappiness writetext UnknownText_0x56143 keeptextopen if_greater_than $95, UnknownScript_0x560ee diff --git a/maps/GoldenrodGym.asm b/maps/GoldenrodGym.asm index 6195a7c5f..462e899c2 100644 --- a/maps/GoldenrodGym.asm +++ b/maps/GoldenrodGym.asm @@ -114,7 +114,7 @@ LassCarrieScript: end WhitneyCriesScript: - showemote $0, $4, 15 + showemote EMOTE_SHOCK, $4, 15 applymovement $4, BridgetWalksUpMovement spriteface $0, DOWN loadfont diff --git a/maps/GoldenrodHappinessRater.asm b/maps/GoldenrodHappinessRater.asm index 4a8b442bb..492345d55 100644 --- a/maps/GoldenrodHappinessRater.asm +++ b/maps/GoldenrodHappinessRater.asm @@ -8,7 +8,7 @@ GoldenrodHappinessRater_MapScriptHeader: TeacherScript_0x54953: faceplayer loadfont - special Function718d + special GetFirstPokemonHappiness writetext UnknownText_0x549a3 keeptextopen if_greater_than $f9, UnknownScript_0x54973 diff --git a/maps/HallOfFame.asm b/maps/HallOfFame.asm index 6050cef09..a50361a17 100644 --- a/maps/HallOfFame.asm +++ b/maps/HallOfFame.asm @@ -3,50 +3,50 @@ HallOfFame_MapScriptHeader: db 2 ; triggers - dw UnknownScript_0x18144f, $0000 - dw UnknownScript_0x181453, $0000 + dw .Trigger1, $0000 + dw .Trigger2, $0000 ; callback count db 0 -UnknownScript_0x18144f: - priorityjump UnknownScript_0x181454 +.Trigger1: + priorityjump HallOfFameScript end -UnknownScript_0x181453: +.Trigger2: end -UnknownScript_0x181454: +HallOfFameScript: follow $2, $0 - applymovement $2, MovementData_0x181499 + applymovement $2, HallOfFame_WalkUpWithLance stopfollow spriteface $0, RIGHT loadfont - writetext UnknownText_0x1814a6 + writetext HallOfFame_LanceText closetext loadmovesprites spriteface $2, UP - applymovement $0, MovementData_0x1814a4 + applymovement $0, HallOfFame_SlowlyApproachMachine dotrigger $1 pause 15 - writebyte $2 + writebyte 2 ; Machine is in the Hall of Fame special HealMachineAnim setevent EVENT_BEAT_ELITE_FOUR setevent EVENT_TELEPORT_GUY setevent EVENT_RIVAL_SPROUT_TOWER clearevent EVENT_RED_IN_MT_SILVER - setevent EVENT_737 - clearevent EVENT_738 + setevent EVENT_OLIVINE_PORT_SPRITES_BEFORE_HALL_OF_FAME + clearevent EVENT_OLIVINE_PORT_SPRITES_AFTER_HALL_OF_FAME domaptrigger GROUP_SPROUT_TOWER_3F, MAP_SPROUT_TOWER_3F, $1 special HealParty checkevent EVENT_GOT_SS_TICKET_FROM_ELM - iftrue UnknownScript_0x181497 + iftrue HallOfFame_SkipPhoneCall specialphonecall $5 -UnknownScript_0x181497: +HallOfFame_SkipPhoneCall: halloffame end -MovementData_0x181499: +HallOfFame_WalkUpWithLance: step_up step_up step_up @@ -59,11 +59,11 @@ MovementData_0x181499: turn_head_left step_end -MovementData_0x1814a4: +HallOfFame_SlowlyApproachMachine: slow_step_up step_end -UnknownText_0x1814a6: +HallOfFame_LanceText: text "LANCE: It's been a" line "long time since I" cont "last came here." @@ -126,4 +126,4 @@ HallOfFame_MapEventHeader: ; people-events db 1 - person_event SPRITE_LANCE, 16, 8, $7, $0, 255, 255, $0, 0, ObjectEvent, -1 + person_event SPRITE_LANCE, 16, 8, UP << 2 | $3, $0, -1, -1, PAL_OW_RED << 4 | $0, 0, ObjectEvent, -1 diff --git a/maps/IlexForest.asm b/maps/IlexForest.asm index 79d8f55b8..409291535 100644 --- a/maps/IlexForest.asm +++ b/maps/IlexForest.asm @@ -467,7 +467,7 @@ UnknownScript_0x6ee42: closetext loadmovesprites pause 20 - showemote $0, $0, 20 + showemote EMOTE_SHOCK, $0, 20 special Functionc48f applymovement $0, MovementData_0x6ef58 pause 30 diff --git a/maps/IndigoPlateauPokeCenter1F.asm b/maps/IndigoPlateauPokeCenter1F.asm index 03013b174..f1ff2f719 100644 --- a/maps/IndigoPlateauPokeCenter1F.asm +++ b/maps/IndigoPlateauPokeCenter1F.asm @@ -54,7 +54,7 @@ UnknownScript_0x180053: moveperson $5, $11, $9 appear $5 spriteface $0, DOWN - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 special Functionc48f pause 15 applymovement $5, MovementData_0x180164 @@ -75,7 +75,7 @@ UnknownScript_0x180094: if_equal SATURDAY, UnknownScript_0x18012b appear $5 spriteface $0, DOWN - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 special Functionc48f pause 15 applymovement $5, MovementData_0x18016b diff --git a/maps/KrissHouse1F.asm b/maps/KrissHouse1F.asm index eb0e121fb..31ee9737b 100644 --- a/maps/KrissHouse1F.asm +++ b/maps/KrissHouse1F.asm @@ -20,7 +20,7 @@ UnknownScript_0x7a4d8: UnknownScript_0x7a4db: playmusic MUSIC_MOM - showemote $0, $2, 15 + showemote EMOTE_SHOCK, $2, 15 spriteface $0, LEFT checkevent EVENT_000 iffalse UnknownScript_0x7a4f2 diff --git a/maps/KurtsHouse.asm b/maps/KurtsHouse.asm index 43479f6e4..3f5ca6fba 100644 --- a/maps/KurtsHouse.asm +++ b/maps/KurtsHouse.asm @@ -295,7 +295,7 @@ UnknownScript_0x18e378: clearevent EVENT_GAVE_GS_BALL_TO_KURT special Functionc48f pause 20 - showemote $0, $2, 30 + showemote EMOTE_SHOCK, $2, 30 checkcode VAR_FACING if_equal $1, UnknownScript_0x18e3a2 spriteface $0, DOWN diff --git a/maps/LancesRoom.asm b/maps/LancesRoom.asm index b489a60d4..ce2043ea0 100644 --- a/maps/LancesRoom.asm +++ b/maps/LancesRoom.asm @@ -75,7 +75,7 @@ LanceScript_0x180e7b: setevent EVENT_LANCES_ROOM_ENTRANCE_CLOSED musicfadeout MUSIC_BEAUTY_ENCOUNTER, $10 pause 30 - showemote $0, $2, 15 + showemote EMOTE_SHOCK, $2, 15 spriteface $2, DOWN pause 10 spriteface $0, DOWN @@ -119,7 +119,7 @@ LanceScript_0x180e7b: playsound SFX_EXIT_BUILDING disappear $0 applymovement $3, MovementData_0x180f57 - showemote $0, $3, 15 + showemote EMOTE_SHOCK, $3, 15 loadfont writetext UnknownText_0x1813c5 pause 30 diff --git a/maps/MahoganyMart1F.asm b/maps/MahoganyMart1F.asm index e74d77437..9a186ad19 100644 --- a/maps/MahoganyMart1F.asm +++ b/maps/MahoganyMart1F.asm @@ -85,7 +85,7 @@ UnknownScript_0x6c38f: loadfont writetext UnknownText_0x6c59e closetext - showemote $0, $2, 10 + showemote EMOTE_SHOCK, $2, 10 playsound SFX_UNKNOWN_2A changeblock $6, $2, $1e reloadmappart diff --git a/maps/MahoganyTown.asm b/maps/MahoganyTown.asm index f3d9f7457..9f271af91 100644 --- a/maps/MahoganyTown.asm +++ b/maps/MahoganyTown.asm @@ -23,7 +23,7 @@ MahoganyTown_MapScriptHeader: return UnknownScript_0x190013: - showemote $0, $2, 15 + showemote EMOTE_SHOCK, $2, 15 applymovement $2, MovementData_0x1900a9 follow $0, $2 applymovement $0, MovementData_0x1900a7 diff --git a/maps/MobileBattleRoom.asm b/maps/MobileBattleRoom.asm index b0ef957be..bace21c16 100644 --- a/maps/MobileBattleRoom.asm +++ b/maps/MobileBattleRoom.asm @@ -43,7 +43,7 @@ UnknownScript_0x1935f4: special RestartMapMusic refreshscreen $0 UnknownScript_0x19360d: - special Function1060a2 + special Mobile_HealParty special HealParty special Function10383c iftrue UnknownScript_0x193624 diff --git a/maps/MountMoon.asm b/maps/MountMoon.asm index 4e1701e17..e2be9902a 100644 --- a/maps/MountMoon.asm +++ b/maps/MountMoon.asm @@ -18,7 +18,7 @@ UnknownScript_0x7408d: UnknownScript_0x7408e: spriteface $0, RIGHT - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 special Functionc48f pause 15 applymovement $2, MovementData_0x740f9 diff --git a/maps/MountMoonSquare.asm b/maps/MountMoonSquare.asm index cd424a320..64c49f749 100644 --- a/maps/MountMoonSquare.asm +++ b/maps/MountMoonSquare.asm @@ -59,7 +59,7 @@ UnknownScript_0x7709a: stopfollow spriteface $2, DOWN pause 10 - showemote $0, $2, 15 + showemote EMOTE_SHOCK, $2, 15 spriteface $2, DOWN cry CLEFAIRY pause 15 diff --git a/maps/MrPokemonsHouse.asm b/maps/MrPokemonsHouse.asm index f8a758907..779783a5c 100644 --- a/maps/MrPokemonsHouse.asm +++ b/maps/MrPokemonsHouse.asm @@ -17,7 +17,7 @@ UnknownScript_0x196e55: end UnknownScript_0x196e56: - showemote $0, $2, 15 + showemote EMOTE_SHOCK, $2, 15 spriteface $2, DOWN loadfont writetext UnknownText_0x196f66 @@ -111,7 +111,7 @@ UnknownScript_0x196ec9: special Function8c0b6 special Functiond91 playmusic MUSIC_HEAL - special Function1060a2 + special Mobile_HealParty special HealParty pause 60 special Function8c0ab diff --git a/maps/OlivineCity.asm b/maps/OlivineCity.asm index a6b03a426..932bd1a3f 100644 --- a/maps/OlivineCity.asm +++ b/maps/OlivineCity.asm @@ -24,7 +24,7 @@ OlivineCity_MapScriptHeader: UnknownScript_0x1a8833: spriteface $0, LEFT - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 special Functionc48f pause 15 playsound SFX_ENTER_DOOR @@ -48,7 +48,7 @@ UnknownScript_0x1a8833: UnknownScript_0x1a886b: spriteface $0, LEFT - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 special Functionc48f pause 15 playsound SFX_ENTER_DOOR diff --git a/maps/OlivinePort.asm b/maps/OlivinePort.asm index aac3ba7c4..ea0edc48e 100644 --- a/maps/OlivinePort.asm +++ b/maps/OlivinePort.asm @@ -399,9 +399,9 @@ OlivinePort_MapEventHeader: ; people-events db 7 person_event SPRITE_SAILOR, 27, 11, $7, $0, 255, 255, $0, 0, SailorScript_0x748c0, EVENT_72A - person_event SPRITE_SAILOR, 19, 11, $7, $0, 255, 255, $0, 0, SailorScript_0x749fe, EVENT_737 - person_event SPRITE_SAILOR, 19, 10, $9, $0, 255, 255, $0, 0, SailorScript_0x7499c, EVENT_738 - person_event SPRITE_FISHING_GURU, 18, 8, $7, $0, 255, 255, $0, 0, FishingGuruScript_0x74a01, EVENT_737 - person_event SPRITE_FISHING_GURU, 18, 17, $7, $0, 255, 255, $0, 0, FishingGuruScript_0x74a0c, EVENT_737 - person_event SPRITE_YOUNGSTER, 19, 8, $6, $0, 255, 255, $0, 0, YoungsterScript_0x74a17, EVENT_738 - person_event SPRITE_COOLTRAINER_F, 19, 15, $6, $0, 255, 255, $0, 0, CooltrainerFScript_0x74a22, EVENT_738 + person_event SPRITE_SAILOR, 19, 11, $7, $0, 255, 255, $0, 0, SailorScript_0x749fe, EVENT_OLIVINE_PORT_SPRITES_BEFORE_HALL_OF_FAME + person_event SPRITE_SAILOR, 19, 10, $9, $0, 255, 255, $0, 0, SailorScript_0x7499c, EVENT_OLIVINE_PORT_SPRITES_AFTER_HALL_OF_FAME + person_event SPRITE_FISHING_GURU, 18, 8, $7, $0, 255, 255, $0, 0, FishingGuruScript_0x74a01, EVENT_OLIVINE_PORT_SPRITES_BEFORE_HALL_OF_FAME + person_event SPRITE_FISHING_GURU, 18, 17, $7, $0, 255, 255, $0, 0, FishingGuruScript_0x74a0c, EVENT_OLIVINE_PORT_SPRITES_BEFORE_HALL_OF_FAME + person_event SPRITE_YOUNGSTER, 19, 8, $6, $0, 255, 255, $0, 0, YoungsterScript_0x74a17, EVENT_OLIVINE_PORT_SPRITES_AFTER_HALL_OF_FAME + person_event SPRITE_COOLTRAINER_F, 19, 15, $6, $0, 255, 255, $0, 0, CooltrainerFScript_0x74a22, EVENT_OLIVINE_PORT_SPRITES_AFTER_HALL_OF_FAME diff --git a/maps/PokeCenter2F.asm b/maps/PokeCenter2F.asm index 60f7310b0..59a9acf8f 100644 --- a/maps/PokeCenter2F.asm +++ b/maps/PokeCenter2F.asm @@ -440,7 +440,7 @@ UnknownScript_0x192b12: writetext UnknownText_0x19329a closetext loadmovesprites - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 applymovement $0, MovementData_0x192ce5 end @@ -549,7 +549,7 @@ UnknownScript_0x192c20: writetext UnknownText_0x19329a closetext loadmovesprites - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 applymovement $0, MovementData_0x192d2d end diff --git a/maps/PowerPlant.asm b/maps/PowerPlant.asm index 0ee68c71d..b534b7fb3 100644 --- a/maps/PowerPlant.asm +++ b/maps/PowerPlant.asm @@ -17,7 +17,7 @@ UnknownScript_0x188dc4: UnknownScript_0x188dc5: playsound SFX_CALL - showemote $0, $2, 15 + showemote EMOTE_SHOCK, $2, 15 waitbutton pause 30 applymovement $2, MovementData_0x188ed5 diff --git a/maps/RadioTower2F.asm b/maps/RadioTower2F.asm index f0933aae1..1942202d0 100644 --- a/maps/RadioTower2F.asm +++ b/maps/RadioTower2F.asm @@ -320,7 +320,7 @@ UnknownScript_0x5d8a4: pause 15 checkevent EVENT_BUENA_OFFERED_HER_PHONE_NUMBER_NO_BLUE_CARD iftrue UnknownScript_0x5d8cc - showemote $0, $b, 15 + showemote EMOTE_SHOCK, $b, 15 setevent EVENT_BUENA_OFFERED_HER_PHONE_NUMBER_NO_BLUE_CARD setevent EVENT_BUENA_OFFERED_HER_PHONE_NUMBER loadfont diff --git a/maps/RadioTower5F.asm b/maps/RadioTower5F.asm index 1811692a5..e4a130ef0 100644 --- a/maps/RadioTower5F.asm +++ b/maps/RadioTower5F.asm @@ -21,7 +21,7 @@ UnknownScript_0x60010: UnknownScript_0x60011: spriteface $2, UP - showemote $0, $2, 15 + showemote EMOTE_SHOCK, $2, 15 loadfont writetext UnknownText_0x60128 closetext diff --git a/maps/Route16Gate.asm b/maps/Route16Gate.asm index 98ba1ccf5..2b62fee86 100644 --- a/maps/Route16Gate.asm +++ b/maps/Route16Gate.asm @@ -20,7 +20,7 @@ UnknownScript_0x733ed: end UnknownScript_0x733f3: - showemote $0, $2, 15 + showemote EMOTE_SHOCK, $2, 15 spriteface $0, UP loadfont writetext UnknownText_0x73496 diff --git a/maps/Route1718Gate.asm b/maps/Route1718Gate.asm index 1a89d8951..46daed8b1 100644 --- a/maps/Route1718Gate.asm +++ b/maps/Route1718Gate.asm @@ -20,7 +20,7 @@ UnknownScript_0x73611: end UnknownScript_0x73617: - showemote $0, $2, 15 + showemote EMOTE_SHOCK, $2, 15 spriteface $0, UP loadfont writetext UnknownText_0x7364d diff --git a/maps/Route25.asm b/maps/Route25.asm index 662dbb7e0..f5867764c 100644 --- a/maps/Route25.asm +++ b/maps/Route25.asm @@ -18,7 +18,7 @@ UnknownScript_0x19ee9f: UnknownScript_0x19eea0: showemote $4, $2, 15 pause 30 - showemote $0, $3, 10 + showemote EMOTE_SHOCK, $3, 10 spriteface $2, DOWN applymovement $3, MovementData_0x19efe8 disappear $3 @@ -44,7 +44,7 @@ UnknownScript_0x19eea0: UnknownScript_0x19eee0: showemote $4, $2, 15 pause 30 - showemote $0, $3, 10 + showemote EMOTE_SHOCK, $3, 10 spriteface $2, DOWN applymovement $3, MovementData_0x19efea disappear $3 diff --git a/maps/Route26HealSpeechHouse.asm b/maps/Route26HealSpeechHouse.asm index ac31d6055..62814fd28 100644 --- a/maps/Route26HealSpeechHouse.asm +++ b/maps/Route26HealSpeechHouse.asm @@ -13,7 +13,7 @@ TeacherScript_0x7b125: loadmovesprites special Function8c0b6 special Functiond91 - special Function1060a2 + special Mobile_HealParty playmusic MUSIC_HEAL special HealParty pause 60 diff --git a/maps/Route27.asm b/maps/Route27.asm index 7ccdb3625..a1302d70c 100644 --- a/maps/Route27.asm +++ b/maps/Route27.asm @@ -17,13 +17,13 @@ UnknownScript_0x1a0872: UnknownScript_0x1a0873: spriteface $a, LEFT - showemote $0, $a, 15 + showemote EMOTE_SHOCK, $a, 15 applymovement $a, MovementData_0x1a0a66 jump UnknownScript_0x1a088c UnknownScript_0x1a0881: spriteface $a, LEFT - showemote $0, $a, 15 + showemote EMOTE_SHOCK, $a, 15 applymovement $a, MovementData_0x1a0a69 UnknownScript_0x1a088c: spriteface $0, RIGHT diff --git a/maps/Route27SandstormHouse.asm b/maps/Route27SandstormHouse.asm index 6e2bec168..a6994be7a 100644 --- a/maps/Route27SandstormHouse.asm +++ b/maps/Route27SandstormHouse.asm @@ -10,7 +10,7 @@ SandstormHouseWoman: loadfont checkevent EVENT_GOT_TM37_SANDSTORM iftrue .AlreadyGotItem - special Function718d + special GetFirstPokemonHappiness writetext SandstormHouseWomanText1 keeptextopen if_greater_than $95, .Loyal diff --git a/maps/Route29.asm b/maps/Route29.asm index 2b5879136..984dce1f6 100644 --- a/maps/Route29.asm +++ b/maps/Route29.asm @@ -35,7 +35,7 @@ TuscanyCallback: UnknownScript_0x1a0f6d: spriteface $2, UP - showemote $0, $2, 15 + showemote EMOTE_SHOCK, $2, 15 applymovement $2, MovementData_0x1a108d spriteface $0, LEFT setevent EVENT_DUDE_TALKED_TO_YOU @@ -60,7 +60,7 @@ UnknownScript_0x1a0f6d: UnknownScript_0x1a0fa3: spriteface $2, UP - showemote $0, $2, 15 + showemote EMOTE_SHOCK, $2, 15 applymovement $2, MovementData_0x1a1094 spriteface $0, LEFT setevent EVENT_DUDE_TALKED_TO_YOU diff --git a/maps/Route34IlexForestGate.asm b/maps/Route34IlexForestGate.asm index 51e160e08..29fba0540 100644 --- a/maps/Route34IlexForestGate.asm +++ b/maps/Route34IlexForestGate.asm @@ -24,7 +24,7 @@ UnknownScript_0x62d38: UnknownScript_0x62d3d: checkevent EVENT_FOREST_IS_RESTLESS iffalse UnknownScript_0x62d62 - showemote $0, $5, 20 + showemote EMOTE_SHOCK, $5, 20 spriteface $5, LEFT spriteface $0, RIGHT follow $0, $5 diff --git a/maps/Route35NationalParkgate.asm b/maps/Route35NationalParkgate.asm index 0f454c405..dc1f0c437 100644 --- a/maps/Route35NationalParkgate.asm +++ b/maps/Route35NationalParkgate.asm @@ -88,7 +88,7 @@ OfficerScript_0x6a204: if_equal FRIDAY, UnknownScript_0x6a2c7 faceplayer loadfont - checkflag ENGINE_51 + checkflag ENGINE_DAILY_BUG_CONTEST iftrue UnknownScript_0x6a2c1 scall UnknownScript_0x6a2de writetext UnknownText_0x6a2eb @@ -97,7 +97,7 @@ OfficerScript_0x6a204: checkcode VAR_PARTYCOUNT if_greater_than $1, UnknownScript_0x6a271 special Function13a12 - clearevent EVENT_308 + clearevent EVENT_LEFT_MONS_WITH_CONTEST_OFFICER UnknownScript_0x6a234: setflag ENGINE_BUG_CONTEST_TIMER special PlayMapMusic @@ -142,7 +142,7 @@ UnknownScript_0x6a27d: ; 6a27d iffalse UnknownScript_0x6a2a9 special Function13a12 iftrue UnknownScript_0x6a2af - setevent EVENT_308 + setevent EVENT_LEFT_MONS_WITH_CONTEST_OFFICER writetext UnknownText_0x6a537 keeptextopen writetext UnknownText_0x6a56b @@ -193,7 +193,7 @@ UnknownScript_0x6a2c7: OfficerScript_0x6a2ca: faceplayer loadfont - checkflag ENGINE_51 + checkflag ENGINE_DAILY_BUG_CONTEST iftrue UnknownScript_0x6a2c1 writetext UnknownText_0x6a894 closetext diff --git a/maps/Route36.asm b/maps/Route36.asm index f63cad50a..3a5c1f0d3 100644 --- a/maps/Route36.asm +++ b/maps/Route36.asm @@ -30,7 +30,7 @@ ArthurCallback: return UnknownScript_0x19401b: - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 pause 15 playsound SFX_WARP_FROM spriteface $0, UP diff --git a/maps/Route36NationalParkgate.asm b/maps/Route36NationalParkgate.asm index d7fe698a7..145f4067f 100644 --- a/maps/Route36NationalParkgate.asm +++ b/maps/Route36NationalParkgate.asm @@ -129,7 +129,7 @@ UnknownScript_0x6abd4: iftrue UnknownScript_0x6abdc appear $c UnknownScript_0x6abdc: - special Function1ad2 + special DrawOnMap end OfficerScript_0x6abe0: @@ -140,7 +140,7 @@ OfficerScript_0x6abe0: if_equal FRIDAY, UnknownScript_0x6acf1 faceplayer loadfont - checkflag ENGINE_51 + checkflag ENGINE_DAILY_BUG_CONTEST iftrue UnknownScript_0x6ac91 scall UnknownScript_0x6ad02 writetext UnknownText_0x6add5 @@ -149,7 +149,7 @@ OfficerScript_0x6abe0: checkcode VAR_PARTYCOUNT if_greater_than $1, UnknownScript_0x6ac41 special Function13a12 - clearevent EVENT_308 + clearevent EVENT_LEFT_MONS_WITH_CONTEST_OFFICER UnknownScript_0x6ac10: setflag ENGINE_BUG_CONTEST_TIMER special PlayMapMusic @@ -185,7 +185,7 @@ UnknownScript_0x6ac4d: iffalse UnknownScript_0x6ac79 special Function13a12 iftrue UnknownScript_0x6ac7f - setevent EVENT_308 + setevent EVENT_LEFT_MONS_WITH_CONTEST_OFFICER writetext UnknownText_0x6b021 keeptextopen writetext UnknownText_0x6b055 @@ -225,13 +225,13 @@ UnknownScript_0x6ac8b: end UnknownScript_0x6ac91: - checkevent EVENT_313 + checkevent EVENT_CONTEST_OFFICER_HAS_SUN_STONE iftrue UnknownScript_0x6acaf - checkevent EVENT_314 + checkevent EVENT_CONTEST_OFFICER_HAS_EVERSTONE iftrue UnknownScript_0x6acbe - checkevent EVENT_315 + checkevent EVENT_CONTEST_OFFICER_HAS_GOLD_BERRY iftrue UnknownScript_0x6accd - checkevent EVENT_316 + checkevent EVENT_CONTEST_OFFICER_HAS_BERRY iftrue UnknownScript_0x6acdc writetext UnknownText_0x6b32b closetext @@ -243,7 +243,7 @@ UnknownScript_0x6acaf: keeptextopen verbosegiveitem SUN_STONE, 1 iffalse UnknownScript_0x6aceb - clearevent EVENT_313 + clearevent EVENT_CONTEST_OFFICER_HAS_SUN_STONE loadmovesprites end @@ -252,7 +252,7 @@ UnknownScript_0x6acbe: keeptextopen verbosegiveitem EVERSTONE, 1 iffalse UnknownScript_0x6aceb - clearevent EVENT_314 + clearevent EVENT_CONTEST_OFFICER_HAS_EVERSTONE loadmovesprites end @@ -261,7 +261,7 @@ UnknownScript_0x6accd: keeptextopen verbosegiveitem GOLD_BERRY, 1 iffalse UnknownScript_0x6aceb - clearevent EVENT_315 + clearevent EVENT_CONTEST_OFFICER_HAS_GOLD_BERRY loadmovesprites end @@ -270,7 +270,7 @@ UnknownScript_0x6acdc: keeptextopen verbosegiveitem BERRY, 1 iffalse UnknownScript_0x6aceb - clearevent EVENT_316 + clearevent EVENT_CONTEST_OFFICER_HAS_BERRY loadmovesprites end @@ -286,7 +286,7 @@ UnknownScript_0x6acf1: OfficerScript_0x6acf4: faceplayer loadfont - checkflag ENGINE_51 + checkflag ENGINE_DAILY_BUG_CONTEST iftrue UnknownScript_0x6ac91 writetext UnknownText_0x6b370 closetext diff --git a/maps/Route42.asm b/maps/Route42.asm index 0e8aa15b5..3c6cf7528 100644 --- a/maps/Route42.asm +++ b/maps/Route42.asm @@ -16,7 +16,7 @@ UnknownScript_0x1a9217: end UnknownScript_0x1a9218: - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 pause 15 playsound SFX_WARP_FROM applymovement $a, MovementData_0x1a9356 diff --git a/maps/Route43Gate.asm b/maps/Route43Gate.asm index 9067119ce..61eda0bad 100644 --- a/maps/Route43Gate.asm +++ b/maps/Route43Gate.asm @@ -40,10 +40,10 @@ UnknownScript_0x19abda: UnknownScript_0x19abea: applymovement $0, MovementData_0x19aca2 - showemote $0, $4, 15 + showemote EMOTE_SHOCK, $4, 15 applymovement $4, MovementData_0x19acbb spriteface $3, UP - showemote $0, $3, 15 + showemote EMOTE_SHOCK, $3, 15 applymovement $3, MovementData_0x19aca4 loadfont writetext UnknownText_0x19acd2 @@ -72,10 +72,10 @@ UnknownScript_0x19ac28: end UnknownScript_0x19ac38: - showemote $0, $3, 15 + showemote EMOTE_SHOCK, $3, 15 applymovement $3, MovementData_0x19acaf spriteface $4, DOWN - showemote $0, $4, 15 + showemote EMOTE_SHOCK, $4, 15 applymovement $4, MovementData_0x19acc7 loadfont writetext UnknownText_0x19acd2 diff --git a/maps/RuinsofAlphAerodactylChamber.asm b/maps/RuinsofAlphAerodactylChamber.asm index d9fd82bd4..102f9540d 100644 --- a/maps/RuinsofAlphAerodactylChamber.asm +++ b/maps/RuinsofAlphAerodactylChamber.asm @@ -42,7 +42,7 @@ UnknownScript_0x58dca: UnknownScript_0x58dd3: pause 30 earthquake 30 - showemote $0, $0, 20 + showemote EMOTE_SHOCK, $0, 20 pause 30 playsound SFX_STRENGTH changeblock $4, $0, $30 @@ -66,7 +66,7 @@ UnknownScript_0x58df7: setflag ENGINE_UNLOCKED_UNOWNS_3 domaptrigger GROUP_RUINS_OF_ALPH_INNER_CHAMBER, MAP_RUINS_OF_ALPH_INNER_CHAMBER, $1 earthquake 30 - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 changeblock $2, $2, $18 changeblock $4, $2, $19 reloadmappart diff --git a/maps/RuinsofAlphHoOhChamber.asm b/maps/RuinsofAlphHoOhChamber.asm index ec375ecb6..9ab9517be 100644 --- a/maps/RuinsofAlphHoOhChamber.asm +++ b/maps/RuinsofAlphHoOhChamber.asm @@ -43,7 +43,7 @@ UnknownScript_0x5858d: UnknownScript_0x58596: pause 30 earthquake 30 - showemote $0, $0, 20 + showemote EMOTE_SHOCK, $0, 20 pause 30 playsound SFX_STRENGTH changeblock $4, $0, $30 @@ -67,7 +67,7 @@ UnknownScript_0x585ba: setflag ENGINE_UNLOCKED_UNOWNS_4 domaptrigger GROUP_RUINS_OF_ALPH_INNER_CHAMBER, MAP_RUINS_OF_ALPH_INNER_CHAMBER, $1 earthquake 30 - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 changeblock $2, $2, $18 changeblock $4, $2, $19 reloadmappart diff --git a/maps/RuinsofAlphKabutoChamber.asm b/maps/RuinsofAlphKabutoChamber.asm index 0c46a3b21..808ba0a4a 100644 --- a/maps/RuinsofAlphKabutoChamber.asm +++ b/maps/RuinsofAlphKabutoChamber.asm @@ -44,7 +44,7 @@ UnknownScript_0x58748: UnknownScript_0x58751: pause 30 earthquake 30 - showemote $0, $0, 20 + showemote EMOTE_SHOCK, $0, 20 pause 30 playsound SFX_STRENGTH changeblock $4, $0, $30 @@ -72,7 +72,7 @@ UnknownScript_0x58778: setevent EVENT_74E domaptrigger GROUP_RUINS_OF_ALPH_INNER_CHAMBER, MAP_RUINS_OF_ALPH_INNER_CHAMBER, $1 earthquake 30 - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 changeblock $2, $2, $18 changeblock $4, $2, $19 reloadmappart diff --git a/maps/RuinsofAlphOmanyteChamber.asm b/maps/RuinsofAlphOmanyteChamber.asm index 8f5cae4d8..917c8e2eb 100644 --- a/maps/RuinsofAlphOmanyteChamber.asm +++ b/maps/RuinsofAlphOmanyteChamber.asm @@ -43,7 +43,7 @@ UnknownScript_0x58c09: UnknownScript_0x58c12: pause 30 earthquake 30 - showemote $0, $0, 20 + showemote EMOTE_SHOCK, $0, 20 pause 30 playsound SFX_STRENGTH changeblock $4, $0, $30 @@ -67,7 +67,7 @@ UnknownScript_0x58c36: setflag ENGINE_UNLOCKED_UNOWNS_2 domaptrigger GROUP_RUINS_OF_ALPH_INNER_CHAMBER, MAP_RUINS_OF_ALPH_INNER_CHAMBER, $1 earthquake 30 - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 changeblock $2, $2, $18 changeblock $4, $2, $19 reloadmappart diff --git a/maps/SproutTower3F.asm b/maps/SproutTower3F.asm index c7de575fd..05c6ec486 100644 --- a/maps/SproutTower3F.asm +++ b/maps/SproutTower3F.asm @@ -17,7 +17,7 @@ UnknownScript_0x184946: UnknownScript_0x184947: spriteface $0, UP - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 special Functionc48f playsound SFX_TACKLE playsound SFX_ELEVATOR @@ -32,7 +32,7 @@ UnknownScript_0x184947: writetext UnknownText_0x184a27 closetext loadmovesprites - showemote $0, $8, 15 + showemote EMOTE_SHOCK, $8, 15 spriteface $8, DOWN pause 15 applymovement $8, MovementData_0x184a24 diff --git a/maps/TeamRocketBaseB1F.asm b/maps/TeamRocketBaseB1F.asm index 21881ef03..e658be5d3 100644 --- a/maps/TeamRocketBaseB1F.asm +++ b/maps/TeamRocketBaseB1F.asm @@ -25,7 +25,7 @@ SecurityCamera1a: scall PlaySecurityCameraSounds checkevent EVENT_6DA iftrue NoSecurityCamera - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 playmusic MUSIC_ROCKET_ENCOUNTER moveperson $2, $13, $2 appear $2 @@ -34,7 +34,7 @@ SecurityCamera1a: scall TrainerCameraGrunt1 if_equal $1, NoSecurityCamera scall PlaySecurityCameraSounds - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 playmusic MUSIC_ROCKET_ENCOUNTER moveperson $2, $13, $2 appear $2 @@ -50,7 +50,7 @@ SecurityCamera1b: scall PlaySecurityCameraSounds checkevent EVENT_6DA iftrue NoSecurityCamera - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 playmusic MUSIC_ROCKET_ENCOUNTER moveperson $2, $13, $3 appear $2 @@ -59,7 +59,7 @@ SecurityCamera1b: scall TrainerCameraGrunt1 if_equal $1, NoSecurityCamera scall PlaySecurityCameraSounds - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 playmusic MUSIC_ROCKET_ENCOUNTER moveperson $2, $13, $3 appear $2 @@ -75,7 +75,7 @@ SecurityCamera2a: scall PlaySecurityCameraSounds checkevent EVENT_6DA iftrue NoSecurityCamera - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 playmusic MUSIC_ROCKET_ENCOUNTER moveperson $2, $4, $7 appear $2 @@ -84,7 +84,7 @@ SecurityCamera2a: scall TrainerCameraGrunt1 if_equal $1, NoSecurityCamera scall PlaySecurityCameraSounds - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 playmusic MUSIC_ROCKET_ENCOUNTER spriteface $0, RIGHT moveperson $2, $c, $5 @@ -101,7 +101,7 @@ SecurityCamera2b: scall PlaySecurityCameraSounds checkevent EVENT_6DA iftrue NoSecurityCamera - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 playmusic MUSIC_ROCKET_ENCOUNTER moveperson $2, $4, $8 appear $2 @@ -110,7 +110,7 @@ SecurityCamera2b: scall TrainerCameraGrunt1 if_equal $1, NoSecurityCamera scall PlaySecurityCameraSounds - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 playmusic MUSIC_ROCKET_ENCOUNTER spriteface $0, RIGHT moveperson $2, $c, $5 @@ -127,7 +127,7 @@ SecurityCamera3a: scall PlaySecurityCameraSounds checkevent EVENT_6DA iftrue NoSecurityCamera - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 playmusic MUSIC_ROCKET_ENCOUNTER moveperson $2, $13, $6 appear $2 @@ -136,7 +136,7 @@ SecurityCamera3a: scall TrainerCameraGrunt1 if_equal $1, NoSecurityCamera scall PlaySecurityCameraSounds - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 playmusic MUSIC_ROCKET_ENCOUNTER spriteface $0, RIGHT moveperson $2, $19, $b @@ -153,7 +153,7 @@ SecurityCamera3b: scall PlaySecurityCameraSounds checkevent EVENT_6DA iftrue NoSecurityCamera - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 playmusic MUSIC_ROCKET_ENCOUNTER moveperson $2, $13, $7 appear $2 @@ -162,7 +162,7 @@ SecurityCamera3b: scall TrainerCameraGrunt1 if_equal $1, NoSecurityCamera scall PlaySecurityCameraSounds - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 playmusic MUSIC_ROCKET_ENCOUNTER spriteface $0, RIGHT moveperson $2, $19, $c @@ -179,7 +179,7 @@ SecurityCamera4: scall PlaySecurityCameraSounds checkevent EVENT_6DA iftrue NoSecurityCamera - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 playmusic MUSIC_ROCKET_ENCOUNTER moveperson $2, $11, $10 appear $2 @@ -188,7 +188,7 @@ SecurityCamera4: scall TrainerCameraGrunt1 if_equal $1, NoSecurityCamera scall PlaySecurityCameraSounds - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 playmusic MUSIC_ROCKET_ENCOUNTER spriteface $0, RIGHT moveperson $2, $19, $b @@ -205,7 +205,7 @@ SecurityCamera5: scall PlaySecurityCameraSounds checkevent EVENT_6DA iftrue NoSecurityCamera - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 playmusic MUSIC_ROCKET_ENCOUNTER moveperson $2, $3, $10 appear $2 @@ -214,7 +214,7 @@ SecurityCamera5: scall TrainerCameraGrunt1 if_equal $1, NoSecurityCamera scall PlaySecurityCameraSounds - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 playmusic MUSIC_ROCKET_ENCOUNTER spriteface $0, RIGHT moveperson $2, $e, $10 diff --git a/maps/TeamRocketBaseB2F.asm b/maps/TeamRocketBaseB2F.asm index 7b0b7bb39..7b503ecaf 100644 --- a/maps/TeamRocketBaseB2F.asm +++ b/maps/TeamRocketBaseB2F.asm @@ -53,7 +53,7 @@ UnknownScript_0x6cfac: closetext loadmovesprites spriteface $0, DOWN - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 applymovement $0, MovementData_0x6d21f playmusic MUSIC_ROCKET_ENCOUNTER applymovement $3, MovementData_0x6d224 @@ -156,7 +156,7 @@ UnknownScript_0x6d091: closetext loadmovesprites special Function8c084 - special Function1060a2 + special Mobile_HealParty playsound SFX_FULL_HEAL special HealParty special Function8c079 diff --git a/maps/TeamRocketBaseB3F.asm b/maps/TeamRocketBaseB3F.asm index 71b883128..4725368c0 100644 --- a/maps/TeamRocketBaseB3F.asm +++ b/maps/TeamRocketBaseB3F.asm @@ -54,7 +54,7 @@ LanceScript_0x6dffc: UnknownScript_0x6e019: spriteface $0, LEFT - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 special Functionc48f appear $a applymovement $a, MovementData_0x6e164 @@ -83,7 +83,7 @@ UnknownScript_0x6e052: applymovement $0, MovementData_0x6e13a UnknownScript_0x6e056: pause 30 - showemote $0, $3, 15 + showemote EMOTE_SHOCK, $3, 15 playmusic MUSIC_ROCKET_ENCOUNTER spriteface $3, DOWN loadfont diff --git a/maps/UndergroundPathSwitchRoomEntrances.asm b/maps/UndergroundPathSwitchRoomEntrances.asm index f5e8b439e..24d9c01e4 100644 --- a/maps/UndergroundPathSwitchRoomEntrances.asm +++ b/maps/UndergroundPathSwitchRoomEntrances.asm @@ -79,7 +79,7 @@ TeacherScript_0x7ca7d: UnknownScript_0x7ca80: spriteface $0, RIGHT - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 special Functionc48f pause 15 playsound SFX_EXIT_BUILDING @@ -98,7 +98,7 @@ UnknownScript_0x7ca80: UnknownScript_0x7caaa: spriteface $0, RIGHT - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 special Functionc48f pause 15 playsound SFX_EXIT_BUILDING diff --git a/maps/VictoryRoad.asm b/maps/VictoryRoad.asm index c858b1192..103e511dc 100644 --- a/maps/VictoryRoad.asm +++ b/maps/VictoryRoad.asm @@ -18,7 +18,7 @@ UnknownScript_0x74491: UnknownScript_0x74492: moveperson $2, $12, $b spriteface $0, DOWN - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 special Functionc48f pause 15 appear $2 @@ -32,7 +32,7 @@ UnknownScript_0x74492: UnknownScript_0x744b5: spriteface $0, DOWN - showemote $0, $0, 15 + showemote EMOTE_SHOCK, $0, 15 special Functionc48f pause 15 appear $2 diff --git a/maps/WiseTriosRoom.asm b/maps/WiseTriosRoom.asm index e8dafe2d1..d23619947 100644 --- a/maps/WiseTriosRoom.asm +++ b/maps/WiseTriosRoom.asm @@ -52,7 +52,7 @@ SageScript_0x985a0: UnknownScript_0x985a3: spriteface $4, UP spriteface $0, DOWN - showemote $0, $4, 20 + showemote EMOTE_SHOCK, $4, 20 follow $0, $4 applymovement $0, MovementData_0x98622 stopfollow @@ -140,7 +140,7 @@ SageKojiScript: checkevent EVENT_KOJI_ALLOWS_YOU_PASSAGE_TO_TIN_TOWER iftrue UnknownScript_0x9861b pause 10 - showemote $0, $7, 20 + showemote EMOTE_SHOCK, $7, 20 loadfont writetext UnknownText_0x98c6c keeptextopen diff --git a/misc/mobile_40.asm b/misc/mobile_40.asm index 84c86c8ee..c2548e867 100644 --- a/misc/mobile_40.asm +++ b/misc/mobile_40.asm @@ -326,7 +326,7 @@ Function100232: ; 100232 push de callba Function106464 call Function3f20 - call Function1ad2 + call DrawOnMap hlcoord 1, 2 pop de call PlaceString @@ -796,7 +796,7 @@ Function1004f4: ; 1004f4 Function100504: ; 100504 push de call Function3f20 - call Function1ad2 + call DrawOnMap pop de hlcoord 4, 2 call PlaceString @@ -829,7 +829,7 @@ Jumptable_10052a: ; 10052a Function100534: ; 100534 call Function100513 - call Function1ad2 + call DrawOnMap call Function321c ld a, [wcd28] inc a @@ -1828,7 +1828,7 @@ Function100b7a: ; 100b7a rst FarCall callba Function24085 callba MobileTextBorder - call Function1ad2 + call DrawOnMap call Function321c callba Function2411a ld hl, wcfa5 @@ -2078,11 +2078,11 @@ Function100d22: ; 100d22 Function100d67: ; 100d67 ld hl, MenuDataHeader_100d88 - call Function1d3c + call CopyMenuDataHeader xor a ld [hBGMapMode], a call Function1cbb - call Function1ad2 + call DrawOnMap call Function1c89 call WaitBGMap call Function1c66 @@ -2809,7 +2809,7 @@ Jumptable_101247: ; 101247 ; 101251 Function101251: ; 101251 - call Function1ad2 + call DrawOnMap call ResetWindow ld hl, UnknownText_0x1021f4 call Function1021e0 @@ -2826,7 +2826,7 @@ Function101265: ; 101265 ; 10126c Function10126c: ; 10126c - call Function1ad2 + call DrawOnMap callba Script_reloadmappart ld hl, UnknownText_0x1021f4 call Function1021e0 @@ -3015,7 +3015,7 @@ Function1013aa: ; 1013aa call Function1d7d call Function2bae callba Function106464 - call Function1ad2 + call DrawOnMap call Function2b5c ret ; 1013c0 @@ -4171,7 +4171,7 @@ Function101b70: ; 101b70 call Function101ee4 ld hl, wcd29 set 5, [hl] - call Function1ad2 + call DrawOnMap ld a, [wcd25] inc a ld [wcd25], a @@ -7316,7 +7316,7 @@ Function103309: ; 103309 ld a, [hl] ld [wd1ee], a call Function1034be - call Function1ad2 + call DrawOnMap callba Function104000 ld a, $1 ld [wd1f0], a @@ -7685,8 +7685,8 @@ Function103612: ; 103612 ld [wcf88], a .asm_103622 - call Function1d81 - call Function1c17 + call InterpretMenu2 + call WriteBackup jr c, .asm_10363b ld a, [wcfa9] ld [ScriptVar], a @@ -7773,7 +7773,7 @@ Function10366e: ; 10366e jr c, .asm_1036f4 ld hl, MenuDataHeader_103747 call LoadMenuDataHeader - call Function1d81 + call InterpretMenu2 call Function1c07 jr c, .asm_1036f4 ld a, [wcfa9] diff --git a/misc/mobile_45.asm b/misc/mobile_45.asm index c894f3610..1b83268d1 100644 --- a/misc/mobile_45.asm +++ b/misc/mobile_45.asm @@ -5919,7 +5919,7 @@ Function11636e: ; 11636e call ByteFill ld a, $90 ld [hWY], a - call Function1ad2 + call DrawOnMap pop af ld [rSVBK], a callba Function104061 @@ -5962,7 +5962,7 @@ Function1163c0: ; 1163c0 call DelayFrame ld a, $90 ld [hWY], a - call Function1ad2 + call DrawOnMap callba Function14157 pop af ld [rSVBK], a @@ -9861,7 +9861,7 @@ Function118982: push af ld a, $1 ld [rSVBK], a - call Function1c17 + call WriteBackup pop af ld [rSVBK], a ld a, [wcd38] @@ -9885,7 +9885,7 @@ Function118982: push af ld a, $1 ld [rSVBK], a - call Function1c17 + call WriteBackup pop af ld [rSVBK], a ld a, $7 @@ -13714,7 +13714,7 @@ Function11a5b9: ; 11a5b9 ld c, $12 call Function3eea callba Function104061 - call Function1ad2 + call DrawOnMap ld c, $0 callba Function115e18 ld a, $1 @@ -14130,7 +14130,7 @@ Function11a9ce: ; 11a9ce callba Function106464 call Functiond90 callba Function2b5c - call Function1ad2 + call DrawOnMap ret ; 11a9f0 @@ -16469,7 +16469,7 @@ Unknown_11bb7d: SECTION "bank47", ROMX, BANK[$47] -Function11c000:: ; 11c000 +StoreText:: ; 11c000 ld a, [rSVBK] push af ld a, $3 @@ -22777,7 +22777,7 @@ Function17024d: ; 17024d ld [wcfc0], a xor a ld [InLinkBattle], a - callba Function1060a2 + callba Mobile_HealParty callba HealParty call Function1702b7 call Function170bf7 diff --git a/misc/mobile_5f.asm b/misc/mobile_5f.asm index 74a50eb62..8bf27e378 100644 --- a/misc/mobile_5f.asm +++ b/misc/mobile_5f.asm @@ -442,12 +442,12 @@ Function17d224: ; 17d224 .asm_17d23c call LoadMenuDataHeader call Function17d246 - call Function1c17 + call WriteBackup ret ; 17d246 Function17d246: ; 17d246 - call Function1d81 + call InterpretMenu2 jr c, .asm_17d264 ld a, [ScriptVar] cp $5 @@ -1909,13 +1909,13 @@ Function17dc1f: ; 17dc1f ld [wc70f], a ld hl, wc708 call LoadMenuDataHeader - call Function1d81 + call InterpretMenu2 jr nc, .asm_17dc6e ld a, $2 ld [wcfa9], a .asm_17dc6e - call Function1c17 + call WriteBackup pop af ld [rSVBK], a ld a, [wcfa9] @@ -2701,7 +2701,7 @@ Function17e133: ; 17e133 ld a, [hli] ld [ScriptVar], a push hl - callba Function4a843 + callba MobileCheckOwnMonAnywhere pop hl jr c, .asm_17e159 inc hl diff --git a/text/common.asm b/text/common.asm index 74e143b13..896fdfe24 100644 --- a/text/common.asm +++ b/text/common.asm @@ -230,7 +230,7 @@ MartSignText: para "#MON MART" done -UnknownText_0x1b05bf: ; 0x1b05bf +ContestResults_ReadyToJudgeText: ; 0x1b05bf text "We will now judge" line "the #MON you've" cont "caught." @@ -246,7 +246,7 @@ UnknownText_0x1b05bf: ; 0x1b05bf done ; 0x1b0621 -UnknownText_0x1b0621: ; 0x1b0621 +ContestResults_PlayerWonAPrizeText: ; 0x1b0621 text ", the No.@" text_from_ram StringBuffer3 text "" @@ -257,7 +257,7 @@ UnknownText_0x1b0621: ; 0x1b0621 done ; 0x1b0648 -UnknownText_0x1b0648: ; 0x1b0648 +ReceivedItemText: ; 0x1b0648 text " received" line "@" text_from_ram StringBuffer4 @@ -265,26 +265,26 @@ UnknownText_0x1b0648: ; 0x1b0648 done ; 0x1b065b -UnknownText_0x1b065b: ; 0x1b065b +ContestResults_JoinUsNextTimeText: ; 0x1b065b text "Please join us for" line "the next Contest!" done ; 0x1b0681 -UnknownText_0x1b0681: ; 0x1b0681 +ContestResults_ConsolationPrizeText: ; 0x1b0681 text "Everyone else gets" line "a BERRY as a con-" cont "solation prize!" done ; 0x1b06b7 -UnknownText_0x1b06b7: ; 0x1b06b7 +ContestResults_DidNotWinText: ; 0x1b06b7 text "We hope you do" line "better next time." done ; 0x1b06d9 -UnknownText_0x1b06d9: ; 0x1b06d9 +ContestResults_ReturnPartyText: ; 0x1b06d9 text "We'll return the" line "#MON we kept" @@ -293,7 +293,7 @@ UnknownText_0x1b06d9: ; 0x1b06d9 done ; 0x1b070d -UnknownText_0x1b070d: ; 0x1b070d +ContestResults_PartyFullText: ; 0x1b070d text "Your party's full," line "so the #MON was" @@ -302,14 +302,14 @@ UnknownText_0x1b070d: ; 0x1b070d done ; 0x1b074e -UnknownText_0x1b074e: ; 0x1b074e +GymStatue_CityGymText: ; 0x1b074e text_from_ram StringBuffer3 text "" line "#MON GYM" done ; 0x1b075c -UnknownText_0x1b075c: ; 0x1b075c +GymStatue_WinningTrainersText: ; 0x1b075c text "LEADER: @" text_from_ram StringBuffer4 text "" @@ -318,13 +318,13 @@ UnknownText_0x1b075c: ; 0x1b075c done ; 0x1b077f -UnknownText_0x1b077f: ; 0x1b077f +CoinVendor_WelcomeText: ; 0x1b077f text "Welcome to the" line "GAME CORNER." done ; 0x1b079c -UnknownText_0x1b079c: ; 0x1b079c +CoinVendor_NoCoinCaseText: ; 0x1b079c text "Do you need game" line "coins?" @@ -334,7 +334,7 @@ UnknownText_0x1b079c: ; 0x1b079c done ; 0x1b07e3 -UnknownText_0x1b07e3: ; 0x1b07e3 +CoinVendor_IntroText: ; 0x1b07e3 text "Do you need some" line "game coins?" @@ -344,31 +344,31 @@ UnknownText_0x1b07e3: ; 0x1b07e3 done ; 0x1b0830 -UnknownText_0x1b0830: ; 0x1b0830 +CoinVendor_Buy50CoinsText: ; 0x1b0830 text "Thank you!" line "Here are 50 coins." done ; 0x1b084f -UnknownText_0x1b084f: ; 0x1b084f +CoinVendor_Buy500CoinsText: ; 0x1b084f text "Thank you! Here" line "are 500 coins." done ; 0x1b086f -UnknownText_0x1b086f: ; 0x1b086f +CoinVendor_NotEnoughMoneyText: ; 0x1b086f text "You don't have" line "enough money." done ; 0x1b088c -UnknownText_0x1b088c: ; 0x1b088c +CoinVendor_CoinCaseFullText: ; 0x1b088c text "Whoops! Your COIN" line "CASE is full." done ; 0x1b08ad -UnknownText_0x1b08ad: ; 0x1b08ad +CoinVendor_CancelText: ; 0x1b08ad text "No coins for you?" line "Come again!" done diff --git a/text/common_3.asm b/text/common_3.asm index 7b15baf5e..c73e91d74 100644 --- a/text/common_3.asm +++ b/text/common_3.asm @@ -1139,7 +1139,7 @@ UnknownText_0x1c10dd: ; 1c10dd prompt ; 1c10fa -UnknownText_0x1c10fa: ; 1c10fa +ContestJudging_FirstPlaceText: ; 1c10fa text "This Bug-Catching" line "Contest winner is@" interpret_data @@ -1154,7 +1154,7 @@ UnknownText_0x1c10fa: ; 1c10fa db "@" ; 1c113f -UnknownText_0x1c113f: ; 1c113f +ContestJudging_FirstPlaceScoreText: ; 1c113f text "" para "The winning score" line "was @" @@ -1163,7 +1163,7 @@ UnknownText_0x1c113f: ; 1c113f prompt ; 1c1166 -UnknownText_0x1c1166: ; 1c1166 +ContestJudging_SecondPlaceText: ; 1c1166 text "Placing second was" line "@" text_from_ram wd016 @@ -1175,7 +1175,7 @@ UnknownText_0x1c1166: ; 1c1166 db "@" ; 1c1196 -UnknownText_0x1c1196: ; 1c1196 +ContestJudging_SecondPlaceScoreText: ; 1c1196 text "" para "The score was" line "@" @@ -1184,7 +1184,7 @@ UnknownText_0x1c1196: ; 1c1196 prompt ; 1c11b5 -UnknownText_0x1c11b5: ; 1c11b5 +ContestJudging_ThirdPlaceText: ; 1c11b5 text "Placing third was" line "@" text_from_ram wd016 @@ -1196,7 +1196,7 @@ UnknownText_0x1c11b5: ; 1c11b5 db "@" ; 1c11e4 -UnknownText_0x1c11e4: ; 1c11e4 +ContestJudging_ThirdPlaceScoreText: ; 1c11e4 text "" para "The score was" line "@" diff --git a/wram.asm b/wram.asm index 9bec48548..188233bc8 100644 --- a/wram.asm +++ b/wram.asm @@ -1320,10 +1320,15 @@ SECTION "WRAM 1", WRAMX, BANK [1] wd000:: ds 1 wd001:: ds 1 wd002:: +PhoneScriptBank:: DefaultFlypoint:: ; d002 ds 1 -wd003:: ds 1 -wd004:: ds 1 +wd003:: +PhoneCallerLo:: + ds 1 +wd004:: +PhoneCallerHi:: + ds 1 wd005:: StartFlypoint:: ; d005 ds 1 @@ -1952,7 +1957,6 @@ wd4cf:: ds 1 wd4d0:: ds 1 wd4d1:: ds 5 - ObjectStructs:: PlayerStruct:: ; d4d6 @@ -2002,29 +2006,29 @@ PlayerSpriteY:: ; d4ee ds 15 ObjectStruct1:: ; d4fe - ds 40 + ds OBJECT_STRUCT_LENGTH ObjectStruct2:: ; d526 - ds 40 + ds OBJECT_STRUCT_LENGTH ObjectStruct3:: ; d54e - ds 40 + ds OBJECT_STRUCT_LENGTH ObjectStruct4:: ; d576 - ds 40 + ds OBJECT_STRUCT_LENGTH ObjectStruct5:: ; d59e - ds 40 + ds OBJECT_STRUCT_LENGTH ObjectStruct6:: ; d5c6 - ds 40 + ds OBJECT_STRUCT_LENGTH ObjectStruct7:: ; d5ee - ds 40 + ds OBJECT_STRUCT_LENGTH ObjectStruct8:: ; d616 - ds 40 + ds OBJECT_STRUCT_LENGTH ObjectStruct9:: ; d63e - ds 40 + ds OBJECT_STRUCT_LENGTH ObjectStruct10:: ; d666 - ds 40 + ds OBJECT_STRUCT_LENGTH ObjectStruct11:: ; d68e - ds 40 + ds OBJECT_STRUCT_LENGTH ObjectStruct12:: ; d6b6 - ds 40 + ds OBJECT_STRUCT_LENGTH ; d6de wd6de::