From 0fcef5fc087dc30817410d7692d53e2c382828d5 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 17 Jul 2015 17:17:10 -0400 Subject: [PATCH] More annotations and interpretations of functions and scripts --- constants/event_flags.asm | 11 +- constants/map_constants.asm | 104 +- constants/misc_constants.asm | 68 ++ engine/events_2.asm | 34 +- engine/more_phone_scripts.asm | 2 +- engine/phone_scripts.asm | 16 +- engine/scripting.asm | 100 +- engine/std_scripts.asm | 8 +- hram.asm | 2 + items/item_effects.asm | 2 +- main.asm | 1641 ++++++++++++++---------------- maps/BillsHouse.asm | 10 +- maps/Colosseum.asm | 4 +- maps/DragonShrine.asm | 116 +-- maps/DragonsDenB1F.asm | 4 +- maps/EcruteakHouse.asm | 4 +- maps/GoldenrodDeptStoreRoof.asm | 36 +- maps/HallOfFame.asm | 6 +- maps/KrissHouse1F.asm | 10 +- maps/KurtsHouse.asm | 14 +- maps/MrPokemonsHouse.asm | 2 +- maps/OlivinePort.asm | 14 +- maps/PokeCenter2F.asm | 4 +- maps/Route31.asm | 2 +- maps/Route36NationalParkgate.asm | 20 +- maps/TimeCapsule.asm | 4 +- maps/TradeCenter.asm | 4 +- maps/VermilionPort.asm | 14 +- maps/VioletGym.asm | 10 +- maps/WarehouseEntrance.asm | 32 +- text/common_4.asm | 12 +- wram.asm | 4 +- 32 files changed, 1157 insertions(+), 1157 deletions(-) diff --git a/constants/event_flags.asm b/constants/event_flags.asm index 3df321a82..873769ef4 100644 --- a/constants/event_flags.asm +++ b/constants/event_flags.asm @@ -1,8 +1,8 @@ const_def - const EVENT_CHRIS1_IN_CABLE_CLUB - const EVENT_CHRIS2_IN_CABLE_CLUB + const EVENT_000 + const EVENT_001 const EVENT_002 const EVENT_003 const EVENT_004 @@ -1648,6 +1648,9 @@ const EVENT_63D const EVENT_63E const EVENT_63F +; Sprite visibility: When these events are cleared, the sprite becomes visible; when set, the sprite is hidden. +; The map script command macros `disappear` and `appear` set/clear these flags and immediately apply the effect on visibility. +; The map script command macros `setevent` and `clearevent` set/clear these flags, and their effects will be seen when the map is reloaded. const EVENT_CYNDAQUIL_POKEBALL_IN_ELMS_LAB const EVENT_TOTODILE_POKEBALL_IN_ELMS_LAB const EVENT_CHIKORITA_POKEBALL_IN_ELMS_LAB @@ -1824,8 +1827,8 @@ const EVENT_6ED const EVENT_6EE const EVENT_6EF - const EVENT_6F0 - const EVENT_6F1 + const EVENT_GOLDENROD_SALE_OFF + const EVENT_GOLDENROD_SALE_ON const EVENT_6F2 const EVENT_6F3 const EVENT_6F4 diff --git a/constants/map_constants.asm b/constants/map_constants.asm index 6e793ef6a..ed4a781f5 100644 --- a/constants/map_constants.asm +++ b/constants/map_constants.asm @@ -580,61 +580,61 @@ MAP_N_A EQU -1 const_value SET $80 SPRITE_POKEMON EQU const_value - const SPRITE_UNOWN - const SPRITE_GEODUDE - const SPRITE_GROWLITHE - const SPRITE_WEEDLE - const SPRITE_SHELLDER - const SPRITE_ODDISH - const SPRITE_GENGAR - const SPRITE_ZUBAT - const SPRITE_MAGIKARP - const SPRITE_SQUIRTLE - const SPRITE_TOGEPI - const SPRITE_BUTTERFREE - const SPRITE_DIGLETT - const SPRITE_POLIWAG - const SPRITE_PIKACHU - const SPRITE_CLEFAIRY - const SPRITE_CHARMANDER - const SPRITE_JYNX - const SPRITE_STARMIE - const SPRITE_BULBASAUR - const SPRITE_JIGGLYPUFF - const SPRITE_GRIMER - const SPRITE_EKANS - const SPRITE_PARAS - const SPRITE_TENTACOOL - const SPRITE_TAUROS - const SPRITE_MACHOP - const SPRITE_VOLTORB - const SPRITE_LAPRAS - const SPRITE_RHYDON - const SPRITE_MOLTRES - const SPRITE_SNORLAX - const SPRITE_GYARADOS - const SPRITE_LUGIA - const SPRITE_HO_OH + const SPRITE_UNOWN ; 80 + const SPRITE_GEODUDE ; 81 + const SPRITE_GROWLITHE ; 82 + const SPRITE_WEEDLE ; 83 + const SPRITE_SHELLDER ; 84 + const SPRITE_ODDISH ; 85 + const SPRITE_GENGAR ; 86 + const SPRITE_ZUBAT ; 87 + const SPRITE_MAGIKARP ; 88 + const SPRITE_SQUIRTLE ; 89 + const SPRITE_TOGEPI ; 8a + const SPRITE_BUTTERFREE ; 8b + const SPRITE_DIGLETT ; 8c + const SPRITE_POLIWAG ; 8d + const SPRITE_PIKACHU ; 8e + const SPRITE_CLEFAIRY ; 8f + const SPRITE_CHARMANDER ; 90 + const SPRITE_JYNX ; 91 + const SPRITE_STARMIE ; 92 + const SPRITE_BULBASAUR ; 93 + const SPRITE_JIGGLYPUFF ; 94 + const SPRITE_GRIMER ; 95 + const SPRITE_EKANS ; 96 + const SPRITE_PARAS ; 97 + const SPRITE_TENTACOOL ; 98 + const SPRITE_TAUROS ; 99 + const SPRITE_MACHOP ; 9a + const SPRITE_VOLTORB ; 9b + const SPRITE_LAPRAS ; 9c + const SPRITE_RHYDON ; 9d + const SPRITE_MOLTRES ; 9e + const SPRITE_SNORLAX ; 9f + const SPRITE_GYARADOS ; a0 + const SPRITE_LUGIA ; a1 + const SPRITE_HO_OH ; a2 const_value SET $e0 - const SPRITE_DAYCARE_MON_1 - const SPRITE_DAYCARE_MON_2 + const SPRITE_DAYCARE_MON_1 ; e0 + const SPRITE_DAYCARE_MON_2 ; e1 const_value SET $f0 SPRITE_VARS EQU const_value - const SPRITE_CONSOLE - const SPRITE_DOLL_1 - const SPRITE_DOLL_2 - const SPRITE_BIG_DOLL - const SPRITE_WEIRD_TREE - const SPRITE_OLIVINE_RIVAL - const SPRITE_AZALEA_ROCKET - const SPRITE_FUCHSIA_GYM_1 - const SPRITE_FUCHSIA_GYM_2 - const SPRITE_FUCHSIA_GYM_3 - const SPRITE_FUCHSIA_GYM_4 - const SPRITE_COPYCAT - const SPRITE_JANINE_IMPERSONATOR + const SPRITE_CONSOLE ; f0 + const SPRITE_DOLL_1 ; f1 + const SPRITE_DOLL_2 ; f2 + const SPRITE_BIG_DOLL ; f3 + const SPRITE_WEIRD_TREE ; f4 + const SPRITE_OLIVINE_RIVAL ; f5 + const SPRITE_AZALEA_ROCKET ; f6 + const SPRITE_FUCHSIA_GYM_1 ; f7 + const SPRITE_FUCHSIA_GYM_2 ; f8 + const SPRITE_FUCHSIA_GYM_3 ; f9 + const SPRITE_FUCHSIA_GYM_4 ; fa + const SPRITE_COPYCAT ; fb + const SPRITE_JANINE_IMPERSONATOR ; fc ; sprite types const_value SET 1 @@ -716,8 +716,8 @@ const_value SET 1 const MAPOBJECT_POINTER_HI ; b const MAPOBJECT_FLAG_LO ; c const MAPOBJECT_FLAG_HI ; d - const MAPOBJECT_E - const MAPOBJECT_F + const MAPOBJECT_E ; unused + const MAPOBJECT_F ; unused MAPOBJECT_NOT_VISIBLE EQU -1 MAPOBJECT_SCREEN_HEIGHT EQU 11 diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index 9346ae0e6..32447e579 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -98,3 +98,71 @@ 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 + +const_value = 1 + const MOM_ITEM + const MOM_DOLL + + const_def + const DECO_BED + const DECO_CARPET + const DECO_PLANT + const DECO_POSTER + const DECO_CONSOLE + const DECO_ORNAMENT + const DECO_BIGDOLL + + const_def + const CARPET_00 + const CARPET_01 + const PLANT_02 + const PLANT_03 + const PLANT_04 + const PLANT_05 + const CARPET_06 + const POSTER_07 + const POSTER_08 + const POSTER_09 + const POSTER_0A + const CARPET_0B + const CARPET_0C + const CARPET_0D + const CARPET_0E + const CARPET_0F + const CARPET_10 + const CONSOLE_11 + const CONSOLE_12 + const CONSOLE_13 + const CARPET_14 + const CARPET_FAMICOM + const CONSTENT_SNES + const CARPET_N64 + const CARPET_VIRTUAL_BOY + const CARPET_19 + const BIGDOLL_SNORLAX + const BIGDOLL_ONIX + const BIGDOLL_LAPRAS + const CARPET_1D + const DOLL_PIKACHU + const DOLL_SURFING_PIKACHU + const DOLL_CLEFAIRY + const DOLL_JIGGLYPUFF + const DOLL_BULBASAUR + const DOLL_CHARMANDER + const DOLL_SQUIRTLE + const DOLL_POLIWAG + const DOLL_DIGLETT + const DOLL_STARMIE + const DOLL_MAGIKARP + const DOLL_ODDISH + const DOLL_GENGAR + const DOLL_SHELLDER + const DOLL_GRIMER + const DOLL_VOLTORM + const DOLL_WEEDLE + const DOLL_UNOWN + const DOLL_GEODUDE + const DOLL_MACHOP + const DOLL_TENTACOOL + const CARPET_GOLD_TROPHY + const CARPET_SILVER_TROPHY diff --git a/engine/events_2.asm b/engine/events_2.asm index bbc883b56..a73b24d20 100644 --- a/engine/events_2.asm +++ b/engine/events_2.asm @@ -271,21 +271,21 @@ Function97db3:: ; 97db3 Function97db5: ; 97db5 ld hl, StatusFlags2 bit 4, [hl] - jr z, .asm_97df7 + jr z, .NoCall ld a, [PlayerState] - cp $1 - jr nz, .asm_97df7 + cp 1 + jr nz, .NoCall call Function2d05 and a - jr nz, .asm_97df7 + jr nz, .NoCall ld hl, wdca1 + 1 ld a, [hli] ld d, a ld e, [hl] - cp $ff + cp -1 jr nz, .asm_97dd8 ld a, e - cp $ff + cp -1 jr z, .asm_97ddc .asm_97dd8 @@ -297,34 +297,34 @@ Function97db5: ; 97db5 .asm_97ddc ld a, d cp $4 - jr c, .asm_97df7 - ld a, [wdc31] + jr c, .NoCall + ld a, [wSpecialPhoneCallID] and a - jr nz, .asm_97df7 - ld a, $6 - ld [wdc31], a + jr nz, .NoCall + ld a, 6 + ld [wSpecialPhoneCallID], a xor a - ld [wdc31 + 1], a + ld [wSpecialPhoneCallID + 1], a ld hl, StatusFlags2 res 4, [hl] scf ret -.asm_97df7 +.NoCall xor a ret ; 97df9 Function97df9:: ; 97df9 ld hl, wd6de - ld de, $0006 - ld c, $4 + ld de, 6 + ld c, 4 xor a -.asm_97e02 +.loop ld [hl], a add hl, de dec c - jr nz, .asm_97e02 + jr nz, .loop ret ; 97e08 diff --git a/engine/more_phone_scripts.asm b/engine/more_phone_scripts.asm index 9c742df00..605e1a9cf 100644 --- a/engine/more_phone_scripts.asm +++ b/engine/more_phone_scripts.asm @@ -1656,5 +1656,5 @@ UnknownScript_0xa0b04: UnknownScript_0xa0b09: farwritetext UnknownText_0x174000 clearflag ENGINE_BIKE_SHOP_CALL_ENABLED - specialphonecall $0000 + specialphonecall ELMCALL_NONE end diff --git a/engine/phone_scripts.asm b/engine/phone_scripts.asm index f68e1166e..ae6eefe9b 100644 --- a/engine/phone_scripts.asm +++ b/engine/phone_scripts.asm @@ -139,7 +139,7 @@ MomPhoneNoGymQuestScript: ; 0xbcfac MomPhoneLectureScript: ; 0xbcfb1 setevent EVENT_TALKED_TO_MOM_AFTER_MYSTERY_EGG_QUEST setflag ENGINE_DST - specialphonecall $0000 + specialphonecall ELMCALL_NONE farwritetext MomPhoneLectureText yesorno iftrue MomPhoneSaveMoneyScript @@ -247,7 +247,7 @@ ElmPhoneScript1: ; 0xbd00d .pokerus ; 0xbd079 farwritetext ElmPhonePokerusText - specialphonecall $0000 + specialphonecall ELMCALL_NONE end ElmPhoneScript2: ; 0xbd081 @@ -258,35 +258,35 @@ ElmPhoneScript2: ; 0xbd081 if_equal $5, .gift if_equal $8, .gift farwritetext ElmPhonePokerusText - specialphonecall $0000 + specialphonecall ELMCALL_NONE end .disaster ; 0xbd09f farwritetext ElmPhoneDisasterText - specialphonecall $0000 + specialphonecall ELMCALL_NONE setevent EVENT_ELM_CALLED_ABOUT_STOLEN_POKEMON end .assistant ; 0xbd0aa farwritetext ElmPhoneEggAssistantText - specialphonecall $0000 + specialphonecall ELMCALL_NONE clearevent EVENT_ELMS_AIDE_IN_VIOLET_POKEMON_CENTER setevent EVENT_ELMS_AIDE_IN_LAB end .rocket ; 0xbd0b8 farwritetext ElmPhoneRocketText - specialphonecall $0000 + specialphonecall ELMCALL_NONE end .gift ; 0xbd0c0 farwritetext ElmPhoneGiftText - specialphonecall $0000 + specialphonecall ELMCALL_NONE end .unused ; 0xbd0c8 farwritetext ElmPhoneUnusedText - specialphonecall $0000 + specialphonecall ELMCALL_NONE end ; bd0d0 diff --git a/engine/scripting.asm b/engine/scripting.asm index 6fd683fb7..ea620e6f8 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -2450,7 +2450,7 @@ GetMoneyAccount: ; 0x97861 ; 0x9786d LoadMoneyAmountToMem: ; 0x9786d - ld bc, $ffc3 + ld bc, hMoneyTemp push bc call GetScriptByte ld [bc], a @@ -2498,8 +2498,8 @@ LoadCoinAmountToMem: ; 978a0 call GetScriptByte ld [$ffc4], a call GetScriptByte - ld [$ffc3], a - ld bc, $ffc3 + ld [hMoneyTemp], a + ld bc, hMoneyTemp ret ; 0x978ae @@ -2572,6 +2572,7 @@ Script_checkcellnum: ; 0x97904 ; script command 0x2a ; parameters: ; person (SingleByteParam) +; returns false if the cell number is not in your phone xor a ld [ScriptVar], a @@ -2590,16 +2591,17 @@ Script_specialphonecall: ; 0x97919 ; call_id (MultiByteParam) call GetScriptByte - ld [wdc31], a + ld [wSpecialPhoneCallID], a call GetScriptByte - ld [wdc31 + 1], a + ld [wSpecialPhoneCallID + 1], a ret ; 0x97926 Script_checkphonecall: ; 0x97926 ; script command 0x9d +; returns false if no special phone call is stored - ld a, [wdc31] + ld a, [wSpecialPhoneCallID] and a jr z, .ok ld a, 1 @@ -2648,6 +2650,7 @@ Script_giveegg: ; 0x97968 ; parameters: ; pkmn (PokemonParam) ; level (DecimalParam) +; if no room in the party, return 0 in ScriptVar; else, return 2 xor a ld [ScriptVar], a @@ -2658,7 +2661,7 @@ Script_giveegg: ; 0x97968 ld [CurPartyLevel], a callba GiveEgg ret nc - ld a, $2 + ld a, 2 ld [ScriptVar], a ret ; 0x97988 @@ -2672,7 +2675,7 @@ Script_setevent: ; 0x97988 ld e, a call GetScriptByte ld d, a - ld b, $1 + ld b, 1 ; set call EventFlagAction ret ; 0x97996 @@ -2686,7 +2689,7 @@ Script_clearevent: ; 0x97996 ld e, a call GetScriptByte ld d, a - ld b, $0 + ld b, 0 ; clear call EventFlagAction ret ; 0x979a4 @@ -2700,13 +2703,13 @@ Script_checkevent: ; 0x979a4 ld e, a call GetScriptByte ld d, a - ld b, $2 + ld b, 2 ; check call EventFlagAction ld a, c and a - jr z, .asm_979b7 ; 0x979b3 $2 - ld a, $1 -.asm_979b7 + jr z, .false ; 0x979b3 $2 + ld a, 1 +.false ld [ScriptVar], a ret ; 0x979bb @@ -2720,7 +2723,7 @@ Script_setflag: ; 0x979bb ld e, a call GetScriptByte ld d, a - ld b, $1 + ld b, 1 ; set call _EngineFlagAction ret ; 0x979c9 @@ -2734,7 +2737,7 @@ Script_clearflag: ; 0x979c9 ld e, a call GetScriptByte ld d, a - ld b, $0 + ld b, 0 ; clear call _EngineFlagAction ret ; 0x979d7 @@ -2748,13 +2751,13 @@ Script_checkflag: ; 0x979d7 ld e, a call GetScriptByte ld d, a - ld b, $2 + ld b, 2 ; check call _EngineFlagAction ld a, c and a - jr z, .asm_979ea ; 0x979e6 $2 - ld a, $1 -.asm_979ea + jr z, .false ; 0x979e6 $2 + ld a, 1 +.false ld [ScriptVar], a ret ; 0x979ee @@ -2808,7 +2811,7 @@ Script_warpfacing: ; 0x97a0e set 5, a or c ld [wd45b], a -; 0x97a1d +; fall through Script_warp: ; 0x97a1d ; script command 0x3c @@ -2818,6 +2821,7 @@ Script_warp: ; 0x97a1d ; x (SingleByteParam) ; y (SingleByteParam) +; This seems to be some sort of error handling case. call GetScriptByte and a jr z, .not_ok ; 0x97a21 $27 @@ -2828,11 +2832,11 @@ Script_warp: ; 0x97a1d ld [XCoord], a call GetScriptByte ld [YCoord], a - ld a, $ff + ld a, -1 ld [wd001], a - ld a, $f1 + ld a, -15 ld [$ff9f], a - ld a, $1 + ld a, 1 call LoadMapStatus call StopScript ret @@ -2840,11 +2844,11 @@ Script_warp: ; 0x97a1d call GetScriptByte call GetScriptByte call GetScriptByte - ld a, $ff + ld a, -1 ld [wd001], a - ld a, $fb + ld a, -5 ld [$ff9f], a - ld a, $1 + ld a, 1 call LoadMapStatus call StopScript ret @@ -2882,7 +2886,7 @@ Script_blackoutmod: ; 0x97a78 Script_reloadmapmusic: ; 0x97a85 ; script command 0x83 - ld a, $1 + ld a, 1 ld [wc2c1], a ret ; 0x97a8b @@ -2913,7 +2917,7 @@ Script_delcmdqueue: ; 0x97a9e ld b, a callba Function97e5c ret c - ld a, $1 + ld a, 1 ld [ScriptVar], a ret ; 0x97ab3 @@ -2942,10 +2946,10 @@ Script_changeblock: ; 0x97acc ; block (SingleByteParam) call GetScriptByte - add $4 + add 4 ld d, a call GetScriptByte - add $4 + add 4 ld e, a call GetBlockLocation call GetScriptByte @@ -2987,7 +2991,7 @@ Script_newloadmap: ; 0x97b08 call GetScriptByte ld [$ff9f], a - ld a, $1 + ld a, 1 call LoadMapStatus call StopScript ret @@ -3064,14 +3068,14 @@ Script_pause: ; 0x97b47 call GetScriptByte and a - jr z, .asm_97b50 ; 0x97b4b $3 + jr z, .loop ; 0x97b4b $3 ld [ScriptDelay], a -.asm_97b50 +.loop ld c, 2 call DelayFrames ld hl, ScriptDelay dec [hl] - jr nz, .asm_97b50 ; 0x97b59 $f5 + jr nz, .loop ; 0x97b59 $f5 ret ; 0x97b5c @@ -3082,9 +3086,9 @@ Script_deactivatefacing: ; 0x97b5c call GetScriptByte and a - jr z, .asm_97b65 ; 0x97b60 $3 + jr z, .no_time ; 0x97b60 $3 ld [ScriptDelay], a -.asm_97b65 +.no_time ld a, SCRIPT_WAIT ld [ScriptMode], a call StopScript @@ -3104,9 +3108,9 @@ Script_end: ; 0x97b74 ; script command 0x91 call ExitScriptSubroutine - jr c, .asm_97b7a + jr c, .resume ret -.asm_97b7a +.resume xor a ld [ScriptRunning], a ld a, SCRIPT_OFF @@ -3121,8 +3125,8 @@ Script_return: ; 0x97b8c ; script command 0x90 call ExitScriptSubroutine - jr c, .asm_97b91 -.asm_97b91 + jr c, .dummy +.dummy ld hl, ScriptFlags res 0, [hl] call StopScript @@ -3135,17 +3139,15 @@ ExitScriptSubroutine: ; 0x97b9a ld hl, wd43c ld a, [hl] and a - jr z, .asm_97bbe ; 0x97b9f $1d + jr z, .done ; 0x97b9f $1d dec [hl] ld e, [hl] ld d, $0 ld hl, wd43d - add hl, de - add hl, de - add hl, de + add_n_times hl, de, 3 ld a, [hli] ld b, a - and $7f + and " " ld [ScriptBank], a ld a, [hli] ld e, a @@ -3155,7 +3157,7 @@ ExitScriptSubroutine: ; 0x97b9a ld [ScriptPos + 1], a and a ret -.asm_97bbe +.done scf ret ; 0x97bc0 @@ -3208,13 +3210,13 @@ Script_wait: ; 0x97c05 push bc call GetScriptByte -.asm_97c09 +.loop push af ld c, 6 call DelayFrames pop af dec a - jr nz, .asm_97c09 ; 0x97c11 $f6 + jr nz, .loop ; 0x97c11 $f6 pop bc ret ; 0x97c15 @@ -3229,7 +3231,7 @@ Script_unknown0xa9: ; 0x97c15 ; 0x97c20 -Function97c20: ; 97c20 +Function97c20: ; 97c20 unreferenced ld a, [.byte] ld [ScriptVar], a ret diff --git a/engine/std_scripts.asm b/engine/std_scripts.asm index 108579fa1..d367ab956 100644 --- a/engine/std_scripts.asm +++ b/engine/std_scripts.asm @@ -159,7 +159,7 @@ PokeCenterNurseScript: .pokerus_done setflag ENGINE_POKERUS - specialphonecall 1 ; elm calls about pokerus + specialphonecall ELMCALL_POKERUS end DifficultBookshelfScript: @@ -297,7 +297,7 @@ RadioTowerRocketsScript: clearevent EVENT_6CE clearevent EVENT_USED_THE_CARD_KEY_IN_THE_RADIO_TOWER setevent EVENT_756 - specialphonecall $0004 + specialphonecall ELMCALL_WEIRDBROADCAST domaptrigger GROUP_MAHOGANY_TOWN, MAP_MAHOGANY_TOWN, $1 end @@ -383,7 +383,7 @@ BugContestResults_CleanUp ; 0xbc31e BugContestResults_FirstPlace ; 0xbc31e - setevent EVENT_CHRIS1_IN_CABLE_CLUB + setevent EVENT_000 itemtotext SUN_STONE, $1 farwritetext ContestResults_PlayerWonAPrizeText closetext @@ -581,7 +581,7 @@ InitializeEventsScript: setevent EVENT_7A5 setevent EVENT_6EC setevent EVENT_6ED - setevent EVENT_6F0 + setevent EVENT_GOLDENROD_SALE_OFF setevent EVENT_7A9 setevent EVENT_EUSINE_IN_BURNED_TOWER setevent EVENT_6C8 diff --git a/hram.asm b/hram.asm index 9ab83d737..eb9cc06f9 100644 --- a/hram.asm +++ b/hram.asm @@ -41,6 +41,8 @@ hProduct EQU $ffb3 hMathBuffer EQU $ffb8 +hMoneyTemp EQU $ffc3 + hLCDStatCustom EQU $ffc6 hSerialSend EQU $ffcd diff --git a/items/item_effects.asm b/items/item_effects.asm index 377bd46da..3dde48169 100644 --- a/items/item_effects.asm +++ b/items/item_effects.asm @@ -2810,7 +2810,7 @@ GorgeousBox: ; f767 ; f769 Function_0xf769: ; f769 - callba Function26f02 + callba SetSpecificDecorationFlag ld hl, UnknownText_0xf778 call PrintText diff --git a/main.asm b/main.asm index 08f453fc3..ec7f623b2 100644 --- a/main.asm +++ b/main.asm @@ -11,15 +11,15 @@ Function4000:: ; 4000 ld a, [IsInBattle] and a - jr z, .asm_4012 + jr z, .notinbattle call TextBox - jr .asm_4017 + jr .continue -.asm_4012 +.notinbattle predef Function28eef -.asm_4017 +.continue hlcoord 4, 11 ld de, .Waiting call PlaceString @@ -130,12 +130,12 @@ OptionsMenu: ; 5b64 NewGame: ; 5b6b xor a ld [wc2cc], a - call Function5ba7 + call ResetWRAM call Function5b44 call Function5b8f call OakSpeech call InitializeWorld - ld a, $1 + ld a, 1 ld [wc2d8], a ld a, 0 ; SPAWN_HOME @@ -148,24 +148,24 @@ NewGame: ; 5b6b Function5b8f: ; 5b8f callba Function10632f - jr c, .asm_5b9e + jr c, .ok callba Function48dcb ret -.asm_5b9e - ld c, $0 +.ok + ld c, 0 callba Function4802f ret ; 5ba7 -Function5ba7: ; 5ba7 +ResetWRAM: ; 5ba7 xor a ld [hBGMapMode], a - call Function5bae + call _ResetWRAM ret ; 5bae -Function5bae: ; 5bae +_ResetWRAM: ; 5bae ld hl, Sprites ld bc, Options - Sprites @@ -986,14 +986,14 @@ Function6182: ; 6182 call DelayFrame ld a, $e4 call DmgToCgbBGPals -.asm_618e +.loop call DelayFrame ld a, [hWX] sub $8 cp $ff ret z ld [hWX], a - jr .asm_618e + jr .loop ; 619c Function619c: ; 619c @@ -1002,7 +1002,7 @@ Function619c: ; 619c xor a ld [$ffad], a hlcoord 6, 4 - ld bc, $0707 + lb bc, 7, 7 predef FillBox ret ; 61b4 @@ -1014,7 +1014,7 @@ Function61b4: ; 61b4 xor a ld [$ffad], a hlcoord 6, 4 - ld bc, $0707 + lb bc, 7, 7 predef FillBox ret ; 61cd @@ -1032,7 +1032,7 @@ Function61cd: ; 61cd inc de ld c, a -.asm_61e4 +.loop ld a, [de] inc de ld [hli], a @@ -1046,14 +1046,14 @@ Function61cd: ; 61cd ld b, 0 ld a, [PlayerGender] bit 0, a - jr z, .asm_61f8 + jr z, .male ld b, 1 -.asm_61f8 +.male ld a, b ld [hli], a dec c - jr nz, .asm_61e4 + jr nz, .loop ret ; 61fe @@ -1078,9 +1078,9 @@ Function6219: ; 6219 ld [rSVBK], a call TitleScreen call DelayFrame -.asm_6226 +.loop call Function627b - jr nc, .asm_6226 + jr nc, .loop call ClearSprites call WhiteBGMap pop af @@ -1102,21 +1102,20 @@ Function6219: ; 6219 call UpdateTimePals ld a, [wcf64] cp $5 - jr c, .asm_625e + jr c, .ok xor a -.asm_625e +.ok ld e, a ld d, 0 - ld hl, .data_626a - add hl, de - add hl, de + ld hl, .jumptable_626a + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a jp [hl] ; 626a -.data_626a +.jumptable_626a dw Function5ae8 dw Function6389 dw Function620b @@ -1133,14 +1132,14 @@ TitleScreen: ; 6274 Function627b: ; 627b ld a, [wcf63] bit 7, a - jr nz, .asm_6290 + jr nz, .true call TitleScreenScene callba Function10eea7 call DelayFrame and a ret -.asm_6290 +.true scf ret ; 6292 @@ -1161,8 +1160,7 @@ TitleScreenScene: ; 62a3 ld e, a ld d, 0 ld hl, .scenes - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -1202,7 +1200,7 @@ TitleScreenEntrance: ; 62bc ; Reversed signage for every other line's position. ; This is responsible for the interlaced effect. ld a, e - xor $ff + xor -1 inc a ld b, 8 * 10 / 2 ; logo height / 2 @@ -1389,8 +1387,7 @@ Function639b: ; 639b add hl, bc ld l, [hl] ld h, 0 - add hl, hl - add hl, hl + add_n_times hl, hl, 2 ld de, Data63ca add hl, de ld a, [wcf65] @@ -1399,8 +1396,7 @@ Function639b: ; 639b srl a ld e, a ld d, 0 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] and a ret z @@ -3163,11 +3159,11 @@ Function8000: ; 8000 ld [hBGMapMode], a call WhiteBGMap call ClearSprites - ld hl, TileMap + hlcoord 0, 0 ld bc, TileMapEnd - TileMap ld a, " " call ByteFill - ld hl, AttrMap + hlcoord 0, 0, AttrMap ld bc, AttrMapEnd - AttrMap ld a, $7 call ByteFill @@ -4022,8 +4018,7 @@ Function84ef: ; 84ef ld a, d ld d, 0 ld hl, SineWave - add hl, de - add hl, de + add_n_times hl, de, 2 ld e, [hl] inc hl ld d, [hl] @@ -4063,9 +4058,7 @@ GetPredefPointer:: ; 854b ld e, a ld d, 0 ld hl, PredefPointers - add hl, de - add hl, de - add hl, de + add_n_times hl, de, 3 pop de ld a, [hli] @@ -4498,7 +4491,7 @@ HealParty: ; c658 ld hl, PartySpecies .loop ld a, [hli] - cp $ff + cp -1 jr z, .done cp EGG jr z, .next @@ -10005,8 +9998,8 @@ ClearPCItemScreen: ; e58b ld [hBGMapMode], a call WhiteBGMap call ClearSprites - ld hl, TileMap - ld bc, 18 * 20 + hlcoord 0, 0 + ld bc, SCREEN_HEIGHT * SCREEN_WIDTH ld a, " " call ByteFill hlcoord 0,0 @@ -11001,8 +10994,7 @@ Function1171d: ; 1171d ld e, a ld d, 0 ld hl, Jumptable_1172e - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -11210,8 +11202,8 @@ Function1189c: ; 1189c Function118a8: ; 118a8 call WaitTop - ld hl, TileMap - ld bc, $0168 + hlcoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $60 call ByteFill hlcoord 1, 1 @@ -11322,8 +11314,7 @@ Function11968: ; 11968 ld e, a ld d, $0 ld hl, Jumptable_11977 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -11783,7 +11774,7 @@ Function11c11: ; 11c11 (4:5c11) srl a srl a ld d, a - ld hl, TileMap + hlcoord 0, 0 ld bc, $14 .asm_11c43 ld a, d @@ -11975,7 +11966,7 @@ String_11f7a: ; 11f7a Function11f84: ; 11f84 (4:5f84) call WaitTop - ld hl, TileMap + hlcoord 0, 0 ld bc, $78 ld a, $60 call ByteFill @@ -12474,8 +12465,7 @@ Function1233e: ; 1233e ld e, a ld d, 0 ld hl, Unknown_12365 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -12978,8 +12968,7 @@ StartMenu:: ; 125cd ld hl, .MenuReturns ld e, a ld d, 0 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -14926,8 +14915,7 @@ CheckRegisteredItem: ; 13345 inc hl ld e, a ld d, 0 - add hl, de - add hl, de + add_n_times hl, de, 2 call .IsSameItem jr c, .NoRegisteredItem and a @@ -14951,8 +14939,7 @@ CheckRegisteredItem: ; 13345 inc hl ld e, a ld d, 0 - add hl, de - add hl, de + add_n_times hl, de, 2 call .IsSameItem jr c, .NoRegisteredItem ret @@ -15228,7 +15215,7 @@ Elevator_GetCurrentFloorText: ; 13512 ld a, [hl] push af set 4, [hl] - ld hl, TileMap + hlcoord 0, 0 ld b, $4 ld c, $8 call TextBox @@ -15295,8 +15282,7 @@ FloorToString: ; 13575 ld e, a ld d, 0 ld hl, .floors - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -17240,10 +17226,7 @@ Function143c8: ; 143c8 pop bc ld l, c ld h, $0 - add hl, hl - add hl, hl - add hl, hl - add hl, hl + add_n_times hl, hl, 4 pop de add hl, de ld d, h @@ -17270,10 +17253,7 @@ Function14406: ; 14406 and $7f ld l, a ld h, $0 - add hl, hl - add hl, hl - add hl, hl - add hl, hl + add_n_times hl, hl, 4 ld a, l add $0 ld l, a @@ -19128,11 +19108,7 @@ Function150d8: ; 150d8 ld e, a ld d, 0 ld hl, Unknown_1522d - add hl, de - add hl, de - add hl, de - add hl, de - add hl, de + add_n_times hl, de, 5 ld a, [hli] push af ld a, [hli] @@ -20099,7 +20075,7 @@ OpenMartDialog:: ; 15a45 call GetMart ld a, c ld [EngineBuffer1], a - call Function15b10 + call LoadMartPointer ld a, [EngineBuffer1] ld hl, .dialogs rst JumpTable @@ -20111,7 +20087,7 @@ OpenMartDialog:: ; 15a45 dw HerbShop dw BargainShop dw Pharmacist - dw VendingMachine + dw RooftopSale ; 15a61 MartDialog: ; 15a61 @@ -20135,9 +20111,9 @@ HerbShop: ; 15a6e ; 15a84 BargainShop: ; 15a84 - ld b, BANK(Unknown_15c51) - ld de, Unknown_15c51 - call Function15b10 + ld b, BANK(BargainShopData) + ld de, BargainShopData + call LoadMartPointer call Function15c25 call Function1d6e ld hl, UnknownText_0x15e6d @@ -20167,17 +20143,17 @@ Pharmacist: ; 15aae ret ; 15ac4 -VendingMachine: ; 15ac4 - ld b, BANK(Unknown_15aee) - ld de, Unknown_15aee +RooftopSale: ; 15ac4 + ld b, BANK(RooftopSaleData1) + ld de, RooftopSaleData1 ld hl, StatusFlags - bit 6, [hl] - jr z, .asm_15ad5 - ld b, BANK(Unknown_15aff) - ld de, Unknown_15aff + bit 6, [hl] ; hall of fame + jr z, .ok + ld b, BANK(RooftopSaleData2) + ld de, RooftopSaleData2 -.asm_15ad5 - call Function15b10 +.ok + call LoadMartPointer call Function15c25 call Function1d6e ld hl, UnknownText_0x15f83 @@ -20188,15 +20164,27 @@ VendingMachine: ; 15ac4 ret ; 15aee -Unknown_15aee: ; 15aee - db $05, $05, $96, $00, $04, $f4, $01, $11, $f4, $01, $26, $f4, $01, $27, $b0, $04, $ff -Unknown_15aff: ; 15aff - db $05, $10, $e8, $03, $0e, $d0, $07, $26, $f4, $01, $02, $e8, $03, $1b, $78, $1e, $ff +RooftopSaleData1: ; 15aee + db 5 + dbw POKE_BALL, 150 + dbw GREAT_BALL, 500 + dbw SUPER_POTION, 500 + dbw FULL_HEAL, 500 + dbw REVIVE, 1200 + db -1 +RooftopSaleData2: ; 15aff + db 5 + dbw HYPER_POTION, 1000 + dbw FULL_RESTORE, 2000 + dbw FULL_HEAL, 500 + dbw ULTRA_BALL, 1000 + dbw PROTEIN, 7800 + db -1 ; 15b10 -Function15b10: ; 15b10 +LoadMartPointer: ; 15b10 ld a, b - ld [wd03f], a + ld [MartPointerBank], a ld a, e ld [MartPointer], a ld a, d @@ -20222,8 +20210,7 @@ GetMart: ; 15b31 .IsAMart ld hl, Marts - add hl, de - add hl, de + add_n_times hl, de, 2 ld e, [hl] inc hl ld d, [hl] @@ -20323,7 +20310,7 @@ ReadMart: ; 15bbb ld [de], a inc hl inc de - cp $ff + cp -1 jr nz, .CopyMart ld hl, DefaultFlypoint ld de, CurMart + 1 @@ -20357,13 +20344,13 @@ GetMartPrice: ; 15bf0 ld [StringBuffer2 + 1], a ld hl, StringBuffer1 ld de, StringBuffer2 - ld bc, $82 << 8 + 6 ; 6 digits + lb bc, $82, 6 ; 6 digits call PrintNum pop hl ld de, StringBuffer1 ld c, 6 / 2 ; 6 digits -.asm_15c0b +.loop call .TileToNum swap a ld b, a @@ -20371,7 +20358,7 @@ GetMartPrice: ; 15bf0 or b ld [hli], a dec c - jr nz, .asm_15c0b + jr nz, .loop ret ; 15c1a @@ -20396,12 +20383,12 @@ Function15c25: ; 15c25 inc hl ld bc, wd002 ld de, CurMart + 1 -.asm_15c33 +.loop ld a, [hli] ld [de], a inc de - cp $ff - jr z, .asm_15c4b + cp -1 + jr z, .done push de ld a, [hli] @@ -20416,17 +20403,23 @@ Function15c25: ; 15c25 ld c, l pop hl pop de - jr .asm_15c33 + jr .loop -.asm_15c4b +.done pop hl ld a, [hl] ld [CurMart], a ret ; 15c51 -Unknown_15c51: ; 15c51 - db $05, $24, $94, $11, $6e, $8a, $02, $6f, $ac, $0d, $83, $84, $03, $84, $f8, $11, $ff +BargainShopData: ; 15c51 + db 5 + dbw NUGGET, 4500 + dbw PEARL, 650 + dbw BIG_PEARL, 3500 + dbw STARDUST, 900 + dbw STAR_PIECE, 4600 + db -1 ; 15c62 @@ -20453,8 +20446,7 @@ Function15c7d: ; 15c7d pop af ld e, a ld d, 0 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -20479,9 +20471,7 @@ Function15ca3: ; 15ca3 ld e, a ld d, 0 ld hl, .data_15cb0 - add hl, de - add hl, de - add hl, de + add_n_times hl, de, 3 ret ; 15cb0 @@ -20554,7 +20544,7 @@ Function15cef: ; 15cef call Function15d97 jr c, .asm_15d68 ld de, Money - ld bc, $ffc3 + ld bc, hMoneyTemp ld a, $3 call CheckMoney jr c, .asm_15d79 @@ -20569,7 +20559,7 @@ Function15cef: ; 15cef call FlagAction call Function15fc3 ld de, Money - ld bc, $ffc3 + ld bc, hMoneyTemp call TakeMoney ld a, $4 call Function15c7d @@ -20637,16 +20627,14 @@ Function15da5: ; 15da5 ld h, [hl] ld l, a inc hl - add hl, de - add hl, de - add hl, de + add_n_times hl, de, 3 inc hl ld a, [hli] ld [$ffc5], a ld a, [hl] ld [$ffc4], a xor a - ld [$ffc3], a + ld [hMoneyTemp], a and a ret @@ -20678,9 +20666,7 @@ Function15df9: ; 15df9 ld h, [hl] ld l, a inc hl - add hl, de - add hl, de - add hl, de + add_n_times hl, de, 3 inc hl ld e, [hl] inc hl @@ -20945,7 +20931,7 @@ Function15efd: ; 15efd call YesNoBox jr c, .asm_15f6e ld de, Money - ld bc, $ffc3 + ld bc, hMoneyTemp call GiveMoney ld a, [wd107] ld hl, NumItems @@ -21296,8 +21282,7 @@ Function16233: ; 16233 ld e, a ld d, 0 ld hl, Jumptable_16242 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -21724,7 +21709,7 @@ Function1651a: ; 1651a push de xor a ld [hBGMapMode], a - ld hl, TileMap + hlcoord 0, 0 ld bc, $0612 call TextBox hlcoord 1, 2 @@ -21860,9 +21845,7 @@ Function16607: ; 16607 push de ld e, a ld d, 0 - add hl, de - add hl, de - add hl, de + add_n_times hl, de, 3 pop de ret ; 16613 @@ -22273,8 +22256,7 @@ Function1689b: ; 1689b ld e, a ld d, 0 ld hl, TextTable_168aa - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -22812,12 +22794,12 @@ Function16be4: ; 16be4 lb bc, BANK(UnownDexBTile), 1 call Request1bpp - ld hl, TileMap + hlcoord 0, 0 ld bc, $0312 call TextBox hlcoord 0, 5 - ld bc, $0707 + lb bc, 7, 7 call TextBox hlcoord 0, 14 @@ -22935,7 +22917,7 @@ Function16cc8: ; 16cc8 hlcoord 1, 6 xor a ld [$ffad], a - ld bc, $0707 + lb bc, 7, 7 predef FillBox ld de, $9310 callba Functione0000 @@ -22963,7 +22945,7 @@ Function16cff: ; 16cff Function16d20: ; 16d20 hlcoord 1, 6 - ld bc, $0707 + lb bc, 7, 7 call ClearBox hlcoord 1, 9 ld de, UnownDexVacantString @@ -23009,14 +22991,14 @@ INCBIN "gfx/unknown/016da4.1bpp" ; 16dac Function16dac: ; 16dac - ld hl, TileMap - ld bc, $0168 + hlcoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $7f call ByteFill hlcoord 7, 11 ld a, $31 ld [$ffad], a - ld bc, $0707 + lb bc, 7, 7 predef FillBox ret ; 16dc7 @@ -23740,7 +23722,7 @@ Function17254: ; 17254 (5:7254) call WaitTop push hl push bc - ld hl, TileMap + hlcoord 0, 0 ld bc, $168 ld a, $7f call ByteFill @@ -24083,10 +24065,7 @@ Function20000: ; 20000 (8:4000) ld e, a ld d, 0 ld hl, Unknown_20015 - add hl, de - add hl, de - add hl, de - add hl, de + add_n_times hl, de, 4 ld e, [hl] inc hl ld d, [hl] @@ -25002,7 +24981,7 @@ Function243cd: ; 243cd dec c jr nz, .asm_243d7 pop hl - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc pop bc dec b @@ -25059,17 +25038,17 @@ Function24423: ; 24423 ret z xor a call GetSRAMBank - ld hl, TileMap + hlcoord 0, 0 ld de, $a000 - ld bc, $0168 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call CopyBytes call CloseSRAM call Function2173 xor a call GetSRAMBank ld hl, $a000 - ld de, TileMap - ld bc, $0168 + decoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT .asm_2444c ld a, [hl] cp $61 @@ -25206,7 +25185,7 @@ Pokepic:: ; 244e3 call GetTileCoord ld a, $80 ld [$ffad], a - ld bc, $0707 + lb bc, 7, 7 predef FillBox call WaitBGMap ret @@ -26245,7 +26224,7 @@ Function24b8f: ; 24b8f ld a, [hl] push af set 4, [hl] - ld hl, TileMap + hlcoord 0, 0 ld b, $3 ld c, $7 call TextBox @@ -26275,7 +26254,7 @@ String24bd4: ; 24bd4 ; 24bdc Function24bdc: ; 24bdc - ld hl, TileMap + hlcoord 0, 0 ld b, $5 ld c, $11 call TextBox @@ -27069,7 +27048,7 @@ Function250c1: ; 250c1 Function250d1: ; 250d1 push hl - ld hl, $ffc3 + ld hl, hMoneyTemp ld a, [hMultiplicand] ld [hli], a ld a, [$ffb5] @@ -27078,7 +27057,7 @@ Function250d1: ; 250d1 ld [hl], a pop hl inc hl - ld de, $ffc3 + ld de, hMoneyTemp ld bc, $2306 call PrintNum call WaitBGMap @@ -27177,8 +27156,7 @@ Function2518e: ; 2518e (9:518e) ld e, a ld d, $0 ld hl, Jumptable_2519d - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -27328,7 +27306,7 @@ Function25279: ; 25279 (9:5279) ret Function25299: ; 25299 (9:5299) - ld hl, TileMap + hlcoord 0, 0 ld d, $5 call Function253b0 hlcoord 2, 2 @@ -27389,7 +27367,7 @@ Function2530a: ; 2530a (9:530a) hlcoord 2, 8 ld de, Tilemap_25366 call Function253a8 - ld a, [StatusFlags] + ld a, [StatusFlags] ; pokedex bit 0, a ret nz hlcoord 1, 9 @@ -28103,25 +28081,25 @@ Function26830: ; 26830 (9:6830) Function2683a: ; 2683a (9:683a) ld hl, Jumptable_26855 -.asm_2683d +.loop ld a, [hli] ld e, a ld a, [hli] ld d, a or e - jr z, .asm_26854 + jr z, .done push hl call _de_ pop hl - jr nc, .asm_26851 + jr nc, .next ld a, [hl] push hl call Function26830 pop hl -.asm_26851 +.next inc hl - jr .asm_2683d -.asm_26854 + jr .loop +.done ret ; 26855 (9:6855) @@ -28140,30 +28118,30 @@ Function2686c: ; 2686c xor a ld hl, DefaultFlypoint ld [hli], a - ld a, $ff + ld a, -1 ld bc, $0010 call ByteFill ret ; 2687a -Function2687a: ; 2687a -.asm_2687a +CheckAllDecorationFlags: ; 2687a +.loop ld a, [hli] - cp $ff - jr z, .asm_26890 + cp -1 + jr z, .done push hl push af - ld b, $2 - call Function26a3b + ld b, 2 ; check + call DecorationFlagAction ld a, c and a pop bc ld a, b call nz, Function26891 pop hl - jr .asm_2687a + jr .loop -.asm_26890 +.done ret ; 26891 @@ -28182,7 +28160,7 @@ Function2689b: ; 2689b push hl call Function2686c pop hl - call Function2687a + call CheckAllDecorationFlags pop bc ld a, [DefaultFlypoint] and a @@ -28296,7 +28274,7 @@ Function26925: ; 26925 Unknown_2692d: ; 2692d db 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 db 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 - db 50, 51, 52, $ff + db 50, 51, 52, -1 ; 26945 Function26945: ; 26945 @@ -28313,7 +28291,7 @@ Function2694d: ; 2694d ; 26955 Unknown_26955: ; 26955 - db 26, 27, 28, $ff + db 26, 27, 28, -1 ; 26959 Function26959: ; 26959 @@ -28324,28 +28302,28 @@ Function26959: ; 26959 Function2695b: ; 2695b ld a, [DefaultFlypoint] and a - jr z, .asm_269a9 - cp $8 - jr nc, .asm_2697b + jr z, .empty + cp 8 + jr nc, .beyond_eight xor a ld [wcf76], a ld hl, MenuDataHeader_0x269b5 call LoadMenuDataHeader call Function1e5d - jr c, .asm_26977 - call Function26a02 + jr c, .no_action_1 + call DoDecorationAction2 -.asm_26977 +.no_action_1 call Function1c07 ret -.asm_2697b +.beyond_eight ld hl, DefaultFlypoint ld e, [hl] dec [hl] - ld d, $0 + ld d, 0 add hl, de - ld [hl], $ff + ld [hl], -1 call Function1d6e ld hl, MenuDataHeader_0x269c5 call CopyMenuDataHeader @@ -28356,15 +28334,15 @@ Function2695b: ; 2695b ld [wd0e4], a call Function350c ld a, [wcf73] - cp $2 - jr z, .asm_269a5 - call Function26a02 + cp 2 + jr z, .no_action_2 + call DoDecorationAction2 -.asm_269a5 +.no_action_2 call Function1c07 ret -.asm_269a9 +.empty ld hl, UnknownText_0x269b0 call Function1d67 ret @@ -28411,17 +28389,17 @@ MenuData2_0x269cd: ; 0x269cd ; 269dd -Function269dd: ; 269dd +GetDecorationData: ; 269dd ld hl, DecorationAttributes - ld bc, $0006 + ld bc, 6 call AddNTimes ret ; 269e7 Function269e7: ; 269e7 push hl - call Function269dd - call Function26c72 + call GetDecorationData + call GetDecorationType pop hl call CopyName2 ret @@ -28430,17 +28408,17 @@ Function269e7: ; 269e7 Function269f3: ; 269f3 ld a, [MenuSelection] push de - call Function269dd - call Function26c72 + call GetDecorationData + call GetDecorationType pop hl call PlaceString ret ; 26a02 -Function26a02: ; 26a02 +DoDecorationAction2: ; 26a02 ld a, [MenuSelection] - call Function269dd - ld de, $0002 + call GetDecorationData + ld de, 2 add hl, de ld a, [hl] ld hl, Jumptable_26a12 @@ -28467,9 +28445,9 @@ Jumptable_26a12: ; 26a12 ; 26a30 -Function26a30: ; 26a30 - call Function269dd - ld de, $0003 +GetDecorationFlag: ; 26a30 + call GetDecorationData + ld de, 3 add hl, de ld a, [hli] ld d, [hl] @@ -28477,9 +28455,9 @@ Function26a30: ; 26a30 ret ; 26a3b -Function26a3b: ; 26a3b +DecorationFlagAction: ; 26a3b push bc - call Function26a30 + call GetDecorationFlag pop bc call EventFlagAction ret @@ -28487,68 +28465,75 @@ Function26a3b: ; 26a3b Function26a44: ; 26a44 ld a, c - call Function269dd - ld de, $0005 + call GetDecorationData + ld de, 5 add hl, de ld a, [hl] ld c, a ret ; 26a4f +decoration: MACRO + ; type, ??, event flag, sprite + db \1, \2, \3 + dw \4 + db \5 +ENDM + DecorationAttributes: ; 26a4f - db $01, $00, $00, $00, $00, $00 - db $01, $01, $02, $00, $00, $00 - db $02, $12, $01, $a4, $02, $1b - db $02, $14, $01, $a5, $02, $1c - db $02, $15, $01, $a6, $02, $1d - db $02, $13, $01, $a7, $02, $1e - db $01, $01, $04, $00, $00, $00 - db $03, $16, $03, $a8, $02, $08 - db $03, $17, $03, $a9, $02, $0b - db $03, $18, $03, $aa, $02, $0e - db $03, $19, $03, $ab, $02, $11 - db $01, $01, $06, $00, $00, $00 - db $01, $02, $05, $ac, $02, $20 - db $01, $03, $05, $ad, $02, $21 - db $01, $04, $05, $ae, $02, $22 - db $01, $01, $08, $00, $00, $00 - db $01, $05, $07, $af, $02, $1f - db $04, $19, $07, $b0, $02, $23 - db $04, $23, $07, $b1, $02, $24 - db $04, $27, $07, $b2, $02, $25 - db $01, $01, $0a, $00, $00, $00 - db $01, $06, $09, $b3, $02, $5c - db $01, $07, $09, $b4, $02, $5b - db $01, $08, $09, $b5, $02, $51 - db $01, $09, $09, $b6, $02, $57 - db $01, $01, $0c, $00, $00, $00 - db $06, $8f, $0b, $cf, $02, $33 - db $06, $5f, $0b, $d0, $02, $50 - db $06, $83, $0b, $d1, $02, $47 - db $01, $01, $0e, $00, $00, $00 - db $05, $19, $0d, $b7, $02, $8e - db $01, $0c, $0d, $b8, $02, $34 - db $05, $23, $0d, $b9, $02, $8f - db $05, $27, $0d, $ba, $02, $94 - db $05, $01, $0d, $bb, $02, $93 - db $05, $04, $0d, $bc, $02, $90 - db $05, $07, $0d, $bd, $02, $89 - db $05, $3c, $0d, $be, $02, $8d - db $05, $32, $0d, $bf, $02, $8c - db $05, $78, $0d, $c0, $02, $92 - db $05, $81, $0d, $c1, $02, $88 - db $05, $2b, $0d, $c2, $02, $85 - db $05, $5e, $0d, $c3, $02, $86 - db $05, $5a, $0d, $c4, $02, $84 - db $05, $58, $0d, $c5, $02, $95 - db $05, $64, $0d, $c6, $02, $9b - db $05, $0d, $0d, $c7, $02, $83 - db $05, $c9, $0d, $c8, $02, $80 - db $05, $4a, $0d, $c9, $02, $81 - db $05, $42, $0d, $ca, $02, $9a - db $05, $48, $0d, $cb, $02, $98 - db $01, $0a, $0d, $cd, $02, $5e - db $01, $0b, $0d, $ce, $02, $5f + decoration DECO_CARPET, $00, 0, EVENT_000, SPRITE_NONE ; 00 + decoration DECO_CARPET, $01, 2, EVENT_000, SPRITE_NONE ; 01 + decoration DECO_PLANT, $12, 1, EVENT_2A4, $1b ; 02 + decoration DECO_PLANT, $14, 1, EVENT_2A5, $1c ; 03 + decoration DECO_PLANT, $15, 1, EVENT_2A6, $1d ; 04 + decoration DECO_PLANT, $13, 1, EVENT_2A7, $1e ; 05 + decoration DECO_CARPET, $01, 4, EVENT_000, SPRITE_NONE ; 06 + decoration DECO_POSTER, $16, 3, EVENT_2A8, $08 ; 07 + decoration DECO_POSTER, $17, 3, EVENT_2A9, $0b ; 08 + decoration DECO_POSTER, $18, 3, EVENT_2AA, $0e ; 09 + decoration DECO_POSTER, $19, 3, EVENT_2AB, $11 ; 0a + decoration DECO_CARPET, $01, 6, EVENT_000, SPRITE_NONE ; 0b + decoration DECO_CARPET, $02, 5, EVENT_2AC, SPRITE_ERIKA ; 0c + decoration DECO_CARPET, $03, 5, EVENT_2AD, SPRITE_KOGA ; 0d + decoration DECO_CARPET, $04, 5, EVENT_2AE, SPRITE_SABRINA ; 0e + decoration DECO_CARPET, $01, 8, EVENT_000, SPRITE_NONE ; 0f + decoration DECO_CARPET, $05, 7, EVENT_2AF, SPRITE_SURGE ; 10 + decoration DECO_CONSOLE, $19, 7, EVENT_2B0, SPRITE_COOLTRAINER_M ; 11 + decoration DECO_CONSOLE, $23, 7, EVENT_2B1, SPRITE_COOLTRAINER_F ; 12 + decoration DECO_CONSOLE, $27, 7, EVENT_2B2, SPRITE_BUG_CATCHER ; 13 + decoration DECO_CARPET, $01, 10, EVENT_000, SPRITE_NONE ; 14 + decoration DECO_CARPET, $06, 9, EVENT_2B3, SPRITE_FAMICOM ; 15 + decoration DECO_CARPET, $07, 9, EVENT_2B4, SPRITE_SNES ; 16 + decoration DECO_CARPET, $08, 9, EVENT_2B5, SPRITE_N64 ; 17 + decoration DECO_CARPET, $09, 9, EVENT_2B6, SPRITE_VIRTUAL_BOY ; 18 + decoration DECO_CARPET, $01, 12, EVENT_000, SPRITE_NONE ; 19 + decoration DECO_BIGDOLL, $8f, 11, EVENT_2CF, SPRITE_BIG_SNORLAX ; 1a + decoration DECO_BIGDOLL, $5f, 11, EVENT_2D0, SPRITE_BIG_ONIX ; 1b + decoration DECO_BIGDOLL, $83, 11, EVENT_2D1, SPRITE_BIG_LAPRAS ; 1c + decoration DECO_CARPET, $01, 14, EVENT_000, SPRITE_NONE ; 1d + decoration DECO_ORNAMENT, $19, 13, EVENT_2B7, SPRITE_PIKACHU ; 1e + decoration DECO_CARPET, $0c, 13, EVENT_2B8, SPRITE_SURFING_PIKACHU ; 1f + decoration DECO_ORNAMENT, $23, 13, EVENT_2B9, SPRITE_CLEFAIRY ; 20 + decoration DECO_ORNAMENT, $27, 13, EVENT_2BA, SPRITE_JIGGLYPUFF ; 21 + decoration DECO_ORNAMENT, $01, 13, EVENT_2BB, SPRITE_BULBASAUR ; 22 + decoration DECO_ORNAMENT, $04, 13, EVENT_2BC, SPRITE_CHARMANDER ; 23 + decoration DECO_ORNAMENT, $07, 13, EVENT_2BD, SPRITE_SQUIRTLE ; 24 + decoration DECO_ORNAMENT, $3c, 13, EVENT_2BE, SPRITE_POLIWAG ; 25 + decoration DECO_ORNAMENT, $32, 13, EVENT_2BF, SPRITE_DIGLETT ; 26 + decoration DECO_ORNAMENT, $78, 13, EVENT_2C0, SPRITE_STARMIE ; 27 + decoration DECO_ORNAMENT, $81, 13, EVENT_2C1, SPRITE_MAGIKARP ; 28 + decoration DECO_ORNAMENT, $2b, 13, EVENT_2C2, SPRITE_ODDISH ; 29 + decoration DECO_ORNAMENT, $5e, 13, EVENT_2C3, SPRITE_GENGAR ; 2a + decoration DECO_ORNAMENT, $5a, 13, EVENT_2C4, SPRITE_SHELLDER ; 2b + decoration DECO_ORNAMENT, $58, 13, EVENT_2C5, SPRITE_GRIMER ; 2c + decoration DECO_ORNAMENT, $64, 13, EVENT_2C6, SPRITE_VOLTORB ; 2d + decoration DECO_ORNAMENT, $0d, 13, EVENT_2C7, SPRITE_WEEDLE ; 2e + decoration DECO_ORNAMENT, $c9, 13, EVENT_2C8, SPRITE_UNOWN ; 2f + decoration DECO_ORNAMENT, $4a, 13, EVENT_2C9, SPRITE_GEODUDE ; 30 + decoration DECO_ORNAMENT, $42, 13, EVENT_2CA, SPRITE_MACHOP; 31 + decoration DECO_ORNAMENT, $48, 13, EVENT_2CB, SPRITE_TENTACOOL; 32 + decoration DECO_CARPET, $0a, 13, EVENT_2CD, SPRITE_GOLD_TROPHY; 33 + decoration DECO_CARPET, $0b, 13, EVENT_2CE, SPRITE_SILVER_TROPHY; 34 ; 26b8d @@ -28581,7 +28566,7 @@ DecorationNames: ; 26b8d db "GREEN@" ; 26c72 -Function26c72: ; 26c72 +GetDecorationType: ; 26c72 ld a, [hli] ld e, [hl] ld bc, StringBuffer2 @@ -28656,10 +28641,10 @@ Function26cc0: ; 26cc0 jr Function26cda Function26cca: ; 26cca - call Function26ccf + call GetDecorationName jr Function26cda -Function26ccf: ; 26ccf +GetDecorationName: ; 26ccf push bc ld hl, DecorationNames call GetNthString @@ -29037,13 +29022,13 @@ Function26eea: ; 26eea Function26ef1: ; 26ef1 ld a, c - jp Function26a3b + jp DecorationFlagAction ; 26ef5 Function26ef5: ; 26ef5 (9:6ef5) ld a, c - call Function26f0c + call GetDecorationID ld hl, StringBuffer1 push hl call Function269e7 @@ -29051,20 +29036,20 @@ Function26ef5: ; 26ef5 (9:6ef5) ret -Function26f02: ; 26f02 +SetSpecificDecorationFlag: ; 26f02 ld a, c - call Function26f0c - ld b, $1 - call Function26a3b + call GetDecorationID + ld b, 1 ; set + call DecorationFlagAction ret ; 26f0c -Function26f0c: ; 26f0c +GetDecorationID: ; 26f0c push hl push de ld e, a ld d, 0 - ld hl, Unknown_26f2b + ld hl, DecorationIDs add hl, de ld a, [hl] pop de @@ -29072,33 +29057,69 @@ Function26f0c: ; 26f0c ret ; 26f19 -Function26f19: ; 26f19 - ld hl, Unknown_26f2b -.asm_26f1c +SetAllDecorationFlags: ; 26f19 + ld hl, DecorationIDs +.loop ld a, [hli] - cp $ff - jr z, .asm_26f2a + cp -1 + jr z, .done push hl - ld b, $1 - call Function26a3b + ld b, 1 ; set + call DecorationFlagAction pop hl - jr .asm_26f1c + jr .loop -.asm_26f2a +.done ret ; 26f2b -Unknown_26f2b: ; 26f2b - db $02, $03, $04, $05, $07 - db $08, $09, $0a, $0c, $0d - db $0e, $10, $11, $12, $13 - db $15, $16, $17, $18, $1e - db $1f, $20, $21, $22, $23 - db $24, $25, $26, $27, $28 - db $29, $2a, $2b, $2c, $2d - db $2e, $2f, $30, $31, $32 - db $1a, $1b, $1c, $33, $34 - db $ff +DecorationIDs: ; 26f2b + db $02 + db $03 + db $04 + db $05 + db $07 + db $08 + db $09 + db $0a + db $0c + db $0d + db $0e + db $10 + db $11 + db $12 + db $13 + db $15 + db $16 + db $17 + db $18 + db $1e + db $1f + db $20 + db $21 + db $22 + db $23 + db $24 + db $25 + db $26 + db $27 + db $28 + db $29 + db $2a + db $2b + db $2c + db $2d + db $2e + db $2f + db $30 + db $31 + db $32 + db $1a + db $1b + db $1c + db $33 + db $34 + db -1 ; 26f59 DescribeDecoration:: ; 26f59 @@ -31100,7 +31121,7 @@ Function28b42: ; 28b42 call ByteFill hlcoord 1, 16 ld a, $7f - ld bc, $0012 + ld bc, SCREEN_HEIGHT call ByteFill hlcoord 2, 16 ld de, String_28b61 @@ -31114,7 +31135,7 @@ String_28b61: ; 28b61 Function28b68: ; 28b68 ld a, [wcf51] hlcoord 6, 9 - ld bc, $0014 + ld bc, SCREEN_WIDTH call AddNTimes ld [hl], $ec ret @@ -31129,7 +31150,7 @@ Function28b77: ; 28b77 dec c jr nz, .asm_28b79 pop hl - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc pop bc dec b @@ -31752,8 +31773,7 @@ Function290a0: ; 290a0 ld e, a ld d, 0 ld hl, JumpTable290af - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -32041,8 +32061,7 @@ Function29281: ; 29281 ld e, a ld d, 0 ld hl, Jumptable_2928f - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -32072,7 +32091,7 @@ Function29297: ; 29297 Function292af: ; 292af call Function297cf hlcoord 0, 3 - ld bc, $0014 + ld bc, SCREEN_WIDTH ld a, $60 call ByteFill ret @@ -32088,7 +32107,7 @@ Function292be: ; 292be ld a, $5d ld [hl], a ld a, $61 - ld de, $0014 + ld de, SCREEN_WIDTH ld c, $3 .asm_292d9 add hl, de @@ -32119,8 +32138,8 @@ Function292f6: ; 292f6 ld a, $9c ld [$ffd7], a call ClearTileMap - ld hl, TileMap - ld bc, $0014 + hlcoord 0, 0 + ld bc, SCREEN_WIDTH ld a, $7a call ByteFill hlcoord 0, 1 @@ -32385,7 +32404,7 @@ Function294c3: ; 294c3 hlcoord 7, 2 xor a ld [$ffad], a - ld bc, $0707 + lb bc, 7, 7 predef FillBox call WaitBGMap ret @@ -32626,8 +32645,7 @@ Function29676: ; 29676 (a:5676) ld e, [hl] ld d, 0 ld hl, Jumptable_29686 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -32866,8 +32884,8 @@ Function297c9: ; 297c9 ; 297cf Function297cf: ; 297cf - ld hl, TileMap - ld bc, $0168 + hlcoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $7f call ByteFill ret @@ -32884,7 +32902,7 @@ Function297db: ; 297db dec c jr nz, .asm_297dd pop hl - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc pop bc dec b @@ -33645,14 +33663,14 @@ Function29ff8: ; 29ff8 ret Function2a01f: ; 2a01f - ld hl, TileMap - ld bc, $0168 + hlcoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT xor a call ByteFill ld a, e and a jr nz, .asm_2a043 - ld de, TileMap + decoord 0, 0 ld hl, WildMons1 call Function2a052 ld hl, WildMons2 @@ -33662,7 +33680,7 @@ Function2a01f: ; 2a01f ret .asm_2a043 - ld de, TileMap + decoord 0, 0 ld hl, WildMons3 call Function2a052 ld hl, WildMons4 @@ -33743,8 +33761,8 @@ Function2a09c: ; 2a09c push de call GetWorldMapLocation ld c, a - ld hl, TileMap - ld de, $0168 + hlcoord 0, 0 + ld de, SCREEN_WIDTH * SCREEN_HEIGHT .asm_2a0a7 ld a, [hli] cp c @@ -34999,7 +35017,7 @@ Function2c0c5: ; 2c0c5 Function2c0f1: ; 2c0f1 ld a, [wd004] ld [hl], a - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc ld a, [StartFlypoint] ld [hl], a @@ -37353,7 +37371,7 @@ Function421f5: ; 421f5 xor a ld [hBGMapMode], a - ld hl, TileMap + hlcoord 0, 0 lb bc, 12, 20 call ClearBox @@ -38261,8 +38279,7 @@ Function44333: ; 44333 dec a ld d, 0 ld e, a - add hl, de - add hl, de + add_n_times hl, de, 2 ld e, [hl] inc hl ld d, [hl] @@ -38986,7 +39003,7 @@ Function4802f: ; 4802f (12:402f) ld b, $1 call Function4930f call WhiteBGMap - ld hl, TileMap + hlcoord 0, 0 ld b, $2 ld c, $14 call ClearBox @@ -39604,7 +39621,7 @@ Function48689: ; 48689 (12:4689) ld b, $1 call Function4930f call WhiteBGMap - ld hl, TileMap + hlcoord 0, 0 ld b, $4 ld c, $14 call ClearBox @@ -40817,11 +40834,11 @@ Function48e14: ; 48e14 (12:4e14) call WhiteBGMap call Function48000 call Functione5f - ld hl, TileMap + hlcoord 0, 0 ld bc, $168 ld a, $0 call ByteFill - ld hl, AttrMap + hlcoord 0, 0, AttrMap ld bc, $168 xor a call ByteFill @@ -40858,8 +40875,7 @@ INCBIN "gfx/unknown/048e71.2bpp" Function48e81: ; 48e81 ld hl, PackFGFXPointers - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld e, a ld d, [hl] @@ -41029,7 +41045,7 @@ Function49336: ; 49336 dec c jr nz, .asm_49338 pop hl - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc pop bc dec b @@ -41039,7 +41055,7 @@ Function49336: ; 49336 Function49346: ; 49346 (12:5346) - ld hl, AttrMap + hlcoord 0, 0, AttrMap ld bc, $168 xor a call ByteFill @@ -41067,7 +41083,7 @@ Function4936e: ; 4936e (12:536e) ret Function49384: ; 49384 (12:5384) - ld hl, AttrMap + hlcoord 0, 0, AttrMap ld bc, $401 ld a, $1 call Function49336 @@ -41165,8 +41181,8 @@ Function4942f: ; 4942f ld a, $5 ; BANK(Unkn1Pals) call FarCopyWRAM call Function49346 - ld hl, AttrMap - ld bc, $0168 + hlcoord 0, 0, AttrMap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT xor a call ByteFill hlcoord 0, 14, AttrMap @@ -41198,7 +41214,7 @@ Palette_49478: ; 49478 ; 49480 Function49480: ; 49480 - ld hl, AttrMap + hlcoord 0, 0, AttrMap ld bc, $0414 ld a, $7 call Function49336 @@ -41211,7 +41227,7 @@ Function49480: ; 49480 ; 49496 Function49496: ; 49496 - ld hl, AttrMap + hlcoord 0, 0, AttrMap ld bc, $0214 ld a, $7 call Function49336 @@ -41508,13 +41524,13 @@ Palette_49757: ; 49757 ; 49797 Function49797: ; 49797 - ld hl, AttrMap + hlcoord 0, 0, AttrMap ld bc, $1002 ld a, $4 call Function49336 ld a, $3 - ld [AttrMap + 0 + 1 * SCREEN_WIDTH], a - ld [AttrMap + 0 + 14 * SCREEN_WIDTH], a + ld [AttrMap + 0 + 1 * SCREEN_WIDTH], a ; (0, 1) + ld [AttrMap + 0 + 14 * SCREEN_WIDTH], a ; (0, 14) hlcoord 2, 0, AttrMap ld bc, $0812 ld a, $5 @@ -41639,10 +41655,10 @@ Function4989a: ; 4989a ld a, $a0 ld [wcf64], a ld d, $0 -.asm_498ca +.loop ld a, [wcf63] bit 7, a - jr nz, .asm_498ee + jr nz, .done push bc call Function49bae inc d @@ -41655,9 +41671,9 @@ Function4989a: ; 4989a call DelayFrames pop de pop bc - jr .asm_498ca + jr .loop -.asm_498ee +.done pop af ld [VramState], a call Function498f9 @@ -41669,14 +41685,14 @@ Function498f9: ; 498f9 ld hl, Sprites + 2 xor a ld c, $4 -.asm_498ff +.loop ld [hli], a inc hl inc hl inc hl inc a dec c - jr nz, .asm_498ff + jr nz, .loop ld hl, Sprites + $10 ld bc, $0090 xor a @@ -41862,8 +41878,7 @@ Function49b52: ; 49b52 (12:5b52) ld a, d ld d, $0 ld hl, Unknown_49b6e - add hl, de - add hl, de + add_n_times hl, de, 2 ld e, [hl] inc hl ld d, [hl] @@ -42124,11 +42139,11 @@ Function49da4: ; 49da4 nop ld a, [wcfcd] and a - jr nz, .asm_49db0 + jr nz, .next ld a, $0 ret -.asm_49db0 +.next ld a, [hCGB] cp $1 ld a, $1 @@ -42138,30 +42153,30 @@ Function49da4: ; 49da4 ld a, [$abe5] cp $ff call CloseSRAM - jr nz, .asm_49dd6 + jr nz, .done ld a, [StatusFlags] bit 7, a ld a, $1 - jr z, .asm_49dd1 - jr .asm_49dd1 + jr z, .ok + jr .ok -.asm_49dd1 - jr .asm_49dd3 +.ok + jr .ok2 -.asm_49dd3 +.ok2 ld a, $1 ret -.asm_49dd6 +.done ld a, [StatusFlags] bit 7, a - jr z, .asm_49ddf - jr .asm_49ddf + jr z, .ok3 + jr .ok3 -.asm_49ddf - jr .asm_49de1 +.ok3 + jr .ok4 -.asm_49de1 +.ok4 ld a, $6 ret ; 49de4 @@ -42870,7 +42885,7 @@ Function4a39a: ; 4a39a Function4a3a7: ; 4a3a7 (12:63a7) call Function4a485 Function4a3aa: ; 4a3aa - ld hl, TileMap + hlcoord 0, 0 ld bc, $301 xor a call Function4a6d8 @@ -42936,7 +42951,7 @@ Function4a3aa: ; 4a3aa Function4a449: ; 4a449 ld bc, $003c ld a, $0 - ld hl, TileMap + hlcoord 0, 0 call ByteFill ld bc, $0028 ld a, $1 @@ -42947,13 +42962,13 @@ Function4a449: ; 4a449 ld bc, $0028 ld a, $1 call ByteFill - ld bc, $0014 + ld bc, SCREEN_WIDTH ld a, $2 call ByteFill - ld bc, $0014 + ld bc, SCREEN_WIDTH ld a, $3 call ByteFill - ld bc, $0014 + ld bc, SCREEN_WIDTH ld a, $7f call ByteFill ret @@ -44496,8 +44511,8 @@ Function4ae5e: ; 4ae5e SECTION "bank13", ROMX, BANK[$13] Function4c000:: ; 4c000 - ld hl, TileMap - ld de, AttrMap + hlcoord 0, 0 + decoord 0, 0, AttrMap ld b, $12 .asm_4c008 push bc @@ -44672,11 +44687,11 @@ Function4cf45: ; 4cf45 (13:4f45) di ld a, $1 ld [rVBK], a ; $ff00+$4f - ld hl, AttrMap + hlcoord 0, 0, AttrMap call Function4cf80 ld a, $0 ld [rVBK], a ; $ff00+$4f - ld hl, TileMap + hlcoord 0, 0 call Function4cf80 .asm_4cf72 ld a, [rLY] ; $ff00+$44 @@ -44846,7 +44861,7 @@ Function4d15b:: ; 4d15b inc hl .asm_4d170 - ld de, TileMap + decoord 0, 0 ld b, SCREEN_HEIGHT .asm_4d175 ld c, SCREEN_WIDTH @@ -44890,11 +44905,11 @@ Function4d188: ; 4d188 di ld a, $1 ld [rVBK], a - ld hl, AttrMap + hlcoord 0, 0, AttrMap call Function4d1cb ld a, $0 ld [rVBK], a - ld hl, TileMap + hlcoord 0, 0 call Function4d1cb .asm_4d1bd ld a, [rLY] @@ -45080,7 +45095,7 @@ Function4d35b: ; 4d35b dec c jr nz, .asm_4d370 pop hl - ld de, $0014 + ld de, SCREEN_WIDTH add hl, de pop bc dec b @@ -45097,7 +45112,7 @@ Function4d37e: ; 4d37e inc a ld [hl], a pop hl - ld de, $0014 + ld de, SCREEN_WIDTH add hl, de .asm_4d38d push hl @@ -45107,7 +45122,7 @@ Function4d37e: ; 4d37e call Function4d3ab ld [hl], $7a pop hl - ld de, $0014 + ld de, SCREEN_WIDTH add hl, de dec b jr nz, .asm_4d38d @@ -47036,13 +47051,13 @@ Function4e253: ; 4e253 (13:6253) ld a, [CurPartySpecies] cp UNOWN jr z, .asm_4e266 - ld hl, TileMap + hlcoord 0, 0 call Function3786 ret .asm_4e266 xor a ld [wc2c6], a - ld hl, TileMap + hlcoord 0, 0 call Function378b ret @@ -47067,7 +47082,7 @@ Function4e289: ; 4e289 (13:6289) call Function4e307 ld de, $9000 predef Function5108b - ld hl, TileMap + hlcoord 0, 0 ld d, $0 ld e, $2 predef Functiond00a3 @@ -47210,7 +47225,7 @@ EggStatsScreen: ; 4e33a set 5, [hl] call Function32f9 ; pals call DelayFrame - ld hl, TileMap + hlcoord 0, 0 call Function3786 callba Function10402d call Function4e497 @@ -47271,7 +47286,7 @@ Function4e497: ; 4e497 (13:6497) ld de, $9000 predef Function5108b pop de - ld hl, TileMap + hlcoord 0, 0 ld d, $0 predef Functiond00a3 ld hl, wcf64 @@ -47672,7 +47687,7 @@ Function4e755: ; 4e755 xor a ld [hBGMapMode], a hlcoord 7, 2 - ld bc, $0707 + lb bc, 7, 7 ld de, $000d .asm_4e762 push bc @@ -47836,8 +47851,8 @@ Function4e881: ; 4e881 ld bc, $400 ld a, $7f call ByteFill - ld hl, AttrMap - ld bc, $0168 + hlcoord 0, 0, AttrMap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT xor a call ByteFill xor a @@ -47869,8 +47884,8 @@ Function4e8c2: ; 4e8c2 ld bc, $400 ld a, $7f call ByteFill - ld hl, AttrMap - ld bc, $0168 + hlcoord 0, 0, AttrMap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT xor a call ByteFill ld hl, wd000 @@ -48250,8 +48265,8 @@ WritePartyMenuTilemap: ; 0x5005f set 4, [hl] ; Disable text delay xor a ld [hBGMapMode], a - ld hl, TileMap - ld bc, $0168 + hlcoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, " " call ByteFill ; blank the tilemap call Function50396 ; This reads from a pointer table??? @@ -48584,8 +48599,7 @@ Function5022f: ; 5022f ld e, a ld d, 0 ld hl, EvosAttacksPointers - add hl, de - add hl, de + add_n_times hl, de, 2 call Function50268 pop hl call PlaceString @@ -48803,8 +48817,7 @@ Function50396: ; 50396 ld e, a ld d, 0 ld hl, Unknown_503b2 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -48977,8 +48990,7 @@ PrintPartyMenuText: ; 5049a ld hl, PartyMenuStrings ld e, a ld d, $0 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld d, [hl] ld e, a @@ -49114,8 +49126,7 @@ UnknownText_0x505bc: ; 0x505bc Function505c1: ; 505c1 ld e, a ld d, 0 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -51837,8 +51848,7 @@ DoStep: ; 8025f ld e, a ld d, 0 ld hl, .Steps - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -52257,8 +52267,7 @@ EngineFlagAction:: ; 80430 .read ld hl, EngineFlags ; location - add hl, de - add hl, de + add_n_times hl, de, 2 ; bit add hl, de @@ -52368,7 +52377,7 @@ VarActionTable: ; 80671 dwb wd46c, $00 dwb XCoord, $00 dwb YCoord, $00 - dwb wdc31, $00 + dwb wSpecialPhoneCallID, $00 dwb wcf64, $00 dwb wdca4, $00 dwb wdbf9, $40 @@ -52580,12 +52589,12 @@ Function81948: ; 81948 ld bc, $2000 xor a call ByteFill - ld hl, AttrMap - ld bc, $0168 + hlcoord 0, 0, AttrMap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT xor a call ByteFill - ld hl, TileMap - ld bc, $0168 + hlcoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT xor a call ByteFill call ClearSprites @@ -52766,8 +52775,7 @@ Function81a74: ; 81a74 ld e, a ld d, 0 ld hl, Jumptable_81acf - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -52825,8 +52833,8 @@ Jumptable_81acf: ; 81acf Function81adb: ; 81adb xor a ld [hBGMapMode], a - ld hl, TileMap - ld bc, $0168 + hlcoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $6f call ByteFill hlcoord 1, 3 @@ -52900,7 +52908,7 @@ Function81adb: ; 81adb ld [TempEnemyMonSpecies], a ld [$ffad], a hlcoord 2, 3 - ld bc, $0707 + lb bc, 7, 7 predef FillBox .asm_81ba9 @@ -52947,8 +52955,7 @@ Function81bf4: ; 81bf4 inc a ld l, a ld h, $0 - add hl, hl - add hl, hl + add_n_times hl, hl, 2 ld de, OverworldMap add hl, de ld de, wc608 @@ -53072,8 +53079,7 @@ Function81cc2: ; 81cc2 ld e, a ld d, 0 ld hl, Jumptable_81d02 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -53399,8 +53405,7 @@ Function81eca: ; 81eca inc a ld l, a ld h, $0 - add hl, hl - add hl, hl + add_n_times hl, hl, 2 ld de, OverworldMap add hl, de ld e, l @@ -53446,7 +53451,7 @@ Function81efc: ; 81efc dec c jr nz, .asm_81efe pop hl - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc pop bc dec b @@ -53619,12 +53624,12 @@ TilesetColorTest: call Request2bpp ld a, $9c ld [$ffd7], a - ld hl, TileMap - ld bc, $0168 + hlcoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $6f call ByteFill - ld hl, AttrMap - ld bc, $0168 + hlcoord 0, 0, AttrMap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $7 call ByteFill ld de, $0015 @@ -53649,12 +53654,12 @@ TilesetColorTest: ; 821d2 Function821d2: ; 821d2 - ld hl, TileMap + hlcoord 0, 0 call Function821de Function821d8: ; 821d8 ld a, [wcf64] - ld hl, AttrMap + hlcoord 0, 0, AttrMap Function821de: ; 821de add hl, de @@ -53701,9 +53706,7 @@ Function8220f: ; 8220f ld a, [wcf64] ld l, a ld h, $0 - add hl, hl - add hl, hl - add hl, hl + add_n_times hl, hl, 3 ld de, Unkn1Pals add hl, de ld de, wc608 @@ -53816,8 +53819,7 @@ Function822f0: ; 822f0 ld e, a ld d, 0 ld hl, Jumptable_82301 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -53859,8 +53861,7 @@ Function82309: ; 82309 ld e, a ld d, $0 ld hl, wc608 - add hl, de - add hl, de + add_n_times hl, de, 2 ld e, l ld d, h call Function81ea5 @@ -53999,8 +54000,7 @@ Function84022: ; 84022 ld e, a ld d, 0 ld hl, Jumptable_84031 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -55021,17 +55021,17 @@ Function846f6: ; 846f6 ; 84728 Function84728: ; 84728 - ld hl, TileMap + hlcoord 0, 0 ld de, wca90 - ld bc, $0168 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call CopyBytes ret ; 84735 Function84735: ; 84735 ld hl, wca90 - ld de, TileMap - ld bc, $0168 + decoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call CopyBytes ret ; 84742 @@ -55105,8 +55105,7 @@ Function84785: ; 84785 ld e, a ld d, 0 ld hl, Unknown_84807 - add hl, de - add hl, de + add_n_times hl, de, 2 ld e, [hl] inc hl ld d, [hl] @@ -55137,8 +55136,7 @@ Function847bd: ; 847bd ld e, a ld d, 0 ld hl, Unknown_84807 - add hl, de - add hl, de + add_n_times hl, de, 2 ld e, [hl] inc hl ld d, [hl] @@ -55173,12 +55171,12 @@ Unknown_84807: ; 84807 Function84817: ; 84817 (21:4817) xor a ld [wd002], a - ld hl, TileMap + hlcoord 0, 0 ld bc, $168 ld a, $7f call ByteFill call Function84a0e - ld hl, TileMap + hlcoord 0, 0 ld bc, $b4 ld a, $7f call ByteFill @@ -55208,7 +55206,7 @@ String_84865: ; 8486f Function8486f: ; 8486f (21:486f) - ld hl, TileMap + hlcoord 0, 0 ld bc, $168 ld a, $7f call ByteFill @@ -55225,7 +55223,7 @@ Function8486f: ; 8486f (21:486f) ret Function84893: ; 84893 (21:4893) - ld hl, TileMap + hlcoord 0, 0 ld bc, $168 ld a, $7f call ByteFill @@ -55242,7 +55240,7 @@ Function84893: ; 84893 (21:4893) ret Function848b7: ; 848b7 (21:48b7) - ld hl, TileMap + hlcoord 0, 0 ld bc, $168 ld a, $7f call ByteFill @@ -55402,7 +55400,7 @@ Function849c6: ; 849c6 (21:49c6) ret Function849d7: ; 849d7 (21:49d7) - ld hl, TileMap + hlcoord 0, 0 ld a, $79 ld [hli], a ld a, $7a @@ -55416,7 +55414,7 @@ Function849d7: ; 849d7 (21:49d7) ret Function849e9: ; 849e9 (21:49e9) - ld hl, TileMap + hlcoord 0, 0 ld de, $13 ld c, $12 .asm_849f1 @@ -55472,23 +55470,23 @@ HallOfFame:: ; 0x8640e call Function8648e ld a, [StatusFlags] push af - ld a, $1 + ld a, 1 ld [wc2cd], a call Function2ed3 - ld a, $1 + ld a, 1 ld [wd4b5], a ; Enable the Pokégear map to cycle through all of Kanto ld hl, StatusFlags - set 6, [hl] + set 6, [hl] ; hall of fame callba Function14da0 ld hl, wd95e ld a, [hl] - cp $c8 - jr nc, .asm_86436 ; 0x86433 $1 + cp 200 + jr nc, .ok ; 0x86433 $1 inc [hl] -.asm_86436 +.ok callba Function14b85 call Function8653f callba Function14b5f @@ -55529,14 +55527,14 @@ Function8648e: ; 8648e ld [MusicFadeIDLo], a ld a, MUSIC_NONE / $100 ld [MusicFadeIDHi], a - ld a, $a + ld a, 10 ld [MusicFade], a callba Function8c084 xor a ld [VramState], a ld [$ffde], a callba Function4e881 - ld c, $64 + ld c, 100 jp DelayFrames ; 864b4 @@ -55554,31 +55552,31 @@ Function864c3: ; 864c3 xor a ld [wcf63], a call Function8671c - jr c, .asm_864fb - ld de, $0014 + jr c, .done + ld de, SCREEN_WIDTH call Function864b4 xor a ld [wcf64], a -.asm_864d6 +.loop ld a, [wcf64] - cp $6 - jr nc, .asm_864fb + cp 6 + jr nc, .done ld hl, wc608 + 1 ld bc, $0010 call AddNTimes ld a, [hl] - cp $ff - jr z, .asm_864fb + cp -1 + jr z, .done push hl call Function865b5 pop hl call Function8650c - jr c, .asm_864fb + jr c, .done ld hl, wcf64 inc [hl] - jr .asm_864d6 + jr .loop -.asm_864fb +.done call Function86810 ld a, $4 ld [MusicFade], a @@ -55704,8 +55702,8 @@ Function865b5: ; 865b5 ld [TempMonDVs + 1], a ld hl, TempMonDVs predef GetUnownLetter - ld hl, TileMap - ld bc, $0168 + hlcoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $7f call ByteFill ld de, $9310 @@ -55728,8 +55726,8 @@ Function865b5: ; 865b5 call Function86635 xor a ld [wc2c6], a - ld hl, TileMap - ld bc, $0168 + hlcoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $7f call ByteFill hlcoord 6, 5 @@ -55929,11 +55927,11 @@ Function86748: ; 86748 call CopyBytes ld a, $50 ld [StringBuffer2 + 10], a - ld hl, TileMap - ld bc, $0168 + hlcoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $7f call ByteFill - ld hl, TileMap + hlcoord 0, 0 ld bc, $0312 call TextBox hlcoord 0, 12 @@ -56002,8 +56000,8 @@ Function86810: ; 86810 ld de, FontExtra + $d0 lb bc, BANK(FontExtra), 1 call Request2bpp - ld hl, TileMap - ld bc, $0168 + hlcoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $7f call ByteFill callba GetPlayerBackpic @@ -56026,15 +56024,15 @@ Function86810: ; 86810 call Function86635 xor a ld [wc2c6], a - ld hl, TileMap - ld bc, $0168 + hlcoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $7f call ByteFill callba Function88840 xor a ld [$ffad], a hlcoord 12, 5 - ld bc, $0707 + lb bc, 7, 7 predef FillBox ld a, $c0 ld [hSCX], a @@ -56521,7 +56519,7 @@ MovePlayerPic: ; 88266 push de xor a ld [hBGMapMode], a - ld bc, $0707 + lb bc, 7, 7 predef FillBox xor a ld [hBGMapThird], a @@ -56541,7 +56539,7 @@ MovePlayerPic: ; 88266 ld a, h sbc d ld h, a - ld bc, $0707 + lb bc, 7, 7 call ClearBox pop bc pop hl @@ -56749,7 +56747,7 @@ DrawIntroPlayerPic: ; 88874 xor a ld [$ffad], a hlcoord 6, 4 - ld bc, $0707 + lb bc, 7, 7 predef FillBox ret ; 888a9 @@ -56883,9 +56881,9 @@ Function891ab: ; 891ab Function891b8: ; 891b8 call Function8923c - ld hl, TileMap + hlcoord 0, 0 ld a, $7f - ld bc, $0168 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call ByteFill call DelayFrame ret @@ -56910,13 +56908,13 @@ Function891d3: ; 891d3 (22:51d3) Function891de: ; 891de call Function8923c call ClearPalettes - ld hl, AttrMap + hlcoord 0, 0, AttrMap ld a, $7 - ld bc, $0168 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call ByteFill - ld hl, TileMap + hlcoord 0, 0 ld a, $7f - ld bc, $0168 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call ByteFill call Function891ab ret @@ -57617,8 +57615,8 @@ Palette_895de: ; 895de Function895e6: ; 895e6 ld a, 7 - ld hl, AttrMap - ld bc, $0168 + hlcoord 0, 0, AttrMap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call ByteFill ret ; 895f2 @@ -57626,8 +57624,8 @@ Function895e6: ; 895e6 Function895f2: ; 895f2 push bc xor a - ld hl, AttrMap - ld bc, $0168 + hlcoord 0, 0, AttrMap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call ByteFill call Function89605 call Function89655 @@ -57677,7 +57675,7 @@ Function8963d: ; 8963d hlcoord 12, 3, AttrMap ld a, 6 ld de, SCREEN_WIDTH - ld bc, $0707 + lb bc, 7, 7 .loop push hl ld c, 7 @@ -57732,7 +57730,7 @@ Function8967a: ; 8967a (22:567a) ret Function89688: ; 89688 - ld hl, TileMap + hlcoord 0, 0 ld a, 1 ld e, SCREEN_WIDTH call Function896e1 @@ -57867,7 +57865,7 @@ Function8971f: ; 8971f ld a, $2d ld [hld], a push hl - ld de, $0014 + ld de, SCREEN_WIDTH add hl, de ld a, $31 ld [hli], a @@ -57891,7 +57889,7 @@ Function89736: ; 89736 ld [hli], a ld a, $30 ld [hld], a - ld de, $0014 + ld de, SCREEN_WIDTH add hl, de ld a, $33 ld [hli], a @@ -57967,7 +57965,7 @@ Function89797: ; 89797 push bc ld a, $e ld [hl], a - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc ld a, $11 ld [hli], a @@ -58010,8 +58008,8 @@ Function897d5: ; 897d5 jr nc, .asm_897f3 hlcoord 12, 3, AttrMap xor a - ld de, $0014 - ld bc, $0707 + ld de, SCREEN_WIDTH + lb bc, 7, 7 .asm_897e5 push hl ld c, $7 @@ -58030,7 +58028,7 @@ Function897d5: ; 897d5 ld a, $37 ld [$ffad], a hlcoord 12, 3 - ld bc, $0707 + lb bc, 7, 7 predef FillBox call Function8963d pop bc @@ -58244,7 +58242,7 @@ Unknown_8994a: ; 8994a Function8994e: ; 8994e push hl push de - ld de, $0014 + ld de, SCREEN_WIDTH ld a, l sub e ld l, a @@ -59482,7 +59480,7 @@ Function8a0c1: ; 8a0c1 (22:60c1) Function8a0c9: ; 8a0c9 (22:60c9) push bc - ld hl, TileMap + hlcoord 0, 0 ld de, $14 ld a, b and a @@ -61338,8 +61336,7 @@ Function8ae68: ; 8ae68 inc hl ld d, $0 ld e, $14 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [ScriptVar] ld c, a ld de, Unknown_8aebc @@ -62821,7 +62818,7 @@ Palette_8b6d5: ; 8b6d5 ; 8b6ed Function8b6ed: ; 8b6ed - ld hl, AttrMap + hlcoord 0, 0, AttrMap ld bc, $012c xor a call ByteFill @@ -62844,7 +62841,7 @@ Function8b703: ; 8b703 pop hl push hl push bc - ld de, $0014 + ld de, SCREEN_WIDTH add hl, de .asm_8b717 push hl @@ -62855,7 +62852,7 @@ Function8b703: ; 8b703 ld a, $11 ld [hl], a pop hl - ld de, $0014 + ld de, SCREEN_WIDTH add hl, de dec b jr nz, .asm_8b717 @@ -62900,7 +62897,7 @@ Function8b744: ; 8b744 dec c jr nz, .asm_8b74f pop hl - ld de, $0014 + ld de, SCREEN_WIDTH add hl, de pop bc dec b @@ -62910,9 +62907,9 @@ Function8b744: ; 8b744 Function8b75d: ; 8b75d call Function8923c - ld hl, TileMap + hlcoord 0, 0 ld a, $1 - ld bc, $0014 + ld bc, SCREEN_WIDTH call ByteFill hlcoord 0, 1 ld a, $2 @@ -63588,8 +63585,7 @@ GetTimePalette: ; 8c117 ld e, a ld d, 0 ld hl, .TimePalettes - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -63898,8 +63894,7 @@ Function8c314: ; 8c314 ld e, a ld d, 0 ld hl, Jumptable_8c323 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -64108,13 +64103,9 @@ Function8c44f: ; 8c44f (23:444f) ld e, a ld d, 0 ld hl, Unknown_8c490 - add hl, de - add hl, de - add hl, de - add hl, de - add hl, de + add_n_times hl, de, 5 ld a, [hli] - cp $ff + cp -1 jr z, .asm_8c47a ld [wcf65], a call Function8c4f5 @@ -64296,7 +64287,7 @@ Function8c5dc: ; 8c5dc (23:45dc) jp z, Function8c673 xor a ld [hBGMapMode], a ; $ff00+$d4 - ld hl, AttrMap + hlcoord 0, 0, AttrMap ld bc, $168 inc b inc c @@ -64486,8 +64477,7 @@ Function8c70c: ; 8c70c (23:470c) ld a, d ld d, 0 ld hl, Unknown_8c728 - add hl, de - add hl, de + add_n_times hl, de, 2 ld e, [hl] inc hl ld d, [hl] @@ -64677,7 +64667,7 @@ Function8c913: ; 8c913 ld a, $5 ld [hli], a ld [hld], a - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc ld [hli], a ld [hld], a @@ -64743,8 +64733,7 @@ Function8ca0c: ; 8ca0c ld e, a ld d, 0 ld hl, Jumptable_8ca1b - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -64842,8 +64831,7 @@ Function8ca8e: ; 8ca8e (23:4a8e) add e ld e, a ld hl, Unknown_8cab3 - add hl, de - add hl, de + add_n_times hl, de, 2 ld e, [hl] inc hl ld d, [hl] @@ -65247,8 +65235,7 @@ GetMagnetTrainBGTiles: ; 8cd74 ld e, a ld d, 0 ld hl, MagnetTrainBGTiles - add hl, de - add hl, de + add_n_times hl, de, 2 ld e, [hl] inc hl ld d, [hl] @@ -65331,8 +65318,7 @@ Function8cdf7: ; 8cdf7 ld e, a ld d, 0 ld hl, Jumptable_8ce06 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -65645,9 +65631,7 @@ Function8cfd6:: ; 8cfd6 ld e, a ld d, 0 ld hl, Unknown_8d1c4 - add hl, de - add hl, de - add hl, de + add_n_times hl, de, 3 ld e, l ld d, h ld hl, $0000 @@ -65963,8 +65947,7 @@ Function8d189: ; 8d189 ld e, [hl] ld d, 0 ld hl, Unknown_8d6e6 - add hl, de - add hl, de + add_n_times hl, de, 2 ld e, [hl] inc hl ld d, [hl] @@ -65981,9 +65964,7 @@ Function8d1a2: ; 8d1a2 ld e, a ld d, 0 ld hl, Unknown_8d94d - add hl, de - add hl, de - add hl, de + add_n_times hl, de, 3 ret ; 8d1ac @@ -65991,8 +65972,7 @@ Function8d1ac: ; 8d1ac push hl ld l, a ld h, 0 - add hl, hl - add hl, hl + add_n_times hl, hl, 2 ld de, Unknown_8e706 add hl, de ld c, [hl] @@ -66064,8 +66044,7 @@ Function8d24b: ; 8d24b ld e, [hl] ld d, 0 ld hl, Jumptable_8d25b - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -68259,8 +68238,7 @@ Function8e741: ; 8e741 ld a, d ld d, 0 ld hl, Unknown_8e75d - add hl, de - add hl, de + add_n_times hl, de, 2 ld e, [hl] inc hl ld d, [hl] @@ -68399,8 +68377,7 @@ Function8e83f: ; 8e83f Function8e849: ; 8e849 ld d, 0 ld hl, Jumptable_8e854 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -68690,10 +68667,7 @@ GetIcon: ; 8ea1e ; Load icon graphics into VRAM starting from tile hl. ; One tile is 16 bytes long. - add hl, hl - add hl, hl - add hl, hl - add hl, hl + add_n_times hl, hl, 4 ld de, VTiles0 add hl, de @@ -69061,7 +69035,7 @@ Function900de: ; 900de (24:40de) ret Function90136:: ; 90136 (24:4136) - ld a, [wdc31] + ld a, [wSpecialPhoneCallID] and a jr z, .asm_90171 dec a @@ -69108,7 +69082,7 @@ UnknownScript_0x90173: ; 0x90173 ; 0x90178 Function90178: ; 90178 (24:4178) - ld a, [wdc31] + ld a, [wSpecialPhoneCallID] dec a ld c, a ld b, 0 @@ -69434,7 +69408,7 @@ Function90363: ; 90363 (24:4363) Phone_CallerTextbox: ; 90375 - ld hl, TileMap + hlcoord 0, 0 ld b, $2 ld c, $12 call TextBox @@ -69794,7 +69768,7 @@ Function90672: ; 90672 (24:4672) Function90783: ; 90783 (24:4783) xor a ld [hBGMapMode], a ; $ff00+$d4 - ld hl, TileMap + hlcoord 0, 0 ld bc, $168 xor a call ByteFill @@ -70193,8 +70167,7 @@ Function909de: ; 909de ld e, a ld d, 0 ld hl, Unknown_909f2 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld d, [hl] ld e, a @@ -70671,7 +70644,7 @@ Function90d9e: ; 90d9e (24:4d9e) Function90da8: ; 90da8 (24:4da8) xor a ld [hBGMapMode], a - ld hl, TileMap + hlcoord 0, 0 ld bc, TileMapEnd - TileMap ld a, $4f call ByteFill @@ -70821,7 +70794,7 @@ Function90e98: ; 90e98 (24:4e98) ret Function90eb0: ; 90eb0 (24:4eb0) - ld hl, TileMap + hlcoord 0, 0 ld bc, $8 ld a, $4f call ByteFill @@ -70839,7 +70812,7 @@ Function90eb0: ; 90eb0 (24:4eb0) ld a, [de] bit 1, a call nz, Function90ef2 - ld hl, TileMap + hlcoord 0, 0 ld a, $46 call Function90ef7 ret @@ -70875,8 +70848,7 @@ Function90f04: ; 90f04 (24:4f04) ld e, a ld d, 0 ld hl, Jumptable_90f13 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -71662,8 +71634,7 @@ Function91342: ; 91342 (24:5342) ld a, [wc6d4] ld e, a ld d, 0 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -71809,7 +71780,7 @@ Function914ab: ; 914ab (24:54ab) ret Function914bb: ; 914bb (24:54bb) - ld hl, TileMap + hlcoord 0, 0 .asm_914be ld a, [de] cp $ff @@ -72421,7 +72392,7 @@ Function91a04: ; 91a04 ld bc, $0006 hlcoord 1, 0 call ByteFill - ld hl, TileMap + hlcoord 0, 0 ld [hl], $6 hlcoord 7, 0 ld [hl], $17 @@ -72479,8 +72450,7 @@ Function91a87: ; 91a87 ld [EnemyTurnsTaken], a ld hl, Jumptable_91ab9 ld d, $0 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -72666,7 +72636,7 @@ TownMapBubble: ; 91bb5 ; Draw the bubble containing the location text in the town map HUD ; Top-left corner - ld hl, TileMap + 1 ; (1,0) + hlcoord 1, 0 ld a, $30 ld [hli], a @@ -72678,7 +72648,7 @@ TownMapBubble: ; 91bb5 ; Top-right corner ld a, $31 ld [hl], a - ld hl, TileMap + 1 + 20 ; (1,1) + hlcoord 1, 1 ; Middle row @@ -72688,7 +72658,7 @@ TownMapBubble: ; 91bb5 ; Bottom-left corner - ld hl, TileMap + 1 + 40 ; (1,2) + hlcoord 1, 2 ld a, $32 ld [hli], a @@ -72703,7 +72673,7 @@ TownMapBubble: ; 91bb5 ; Print "Where?" - ld hl, TileMap + 2 ; (2,0) + hlcoord 2, 0 ld de, .Where call PlaceString @@ -72711,7 +72681,7 @@ TownMapBubble: ; 91bb5 call .Name ; Up/down arrows - ld hl, TileMap + 18 + 20 ; (18,1) + hlcoord 18, 1 ld [hl], $34 ret @@ -72730,7 +72700,7 @@ TownMapBubble: ; 91bb5 callba GetLandmarkName - ld hl, TileMap + 2 + 20 ; (2,1) + hlcoord 2, 1 ld de, StringBuffer1 call PlaceString ret @@ -73066,7 +73036,7 @@ Function91dcd: ; 91dcd ret .asm_91ddc - ld hl, TileMap + hlcoord 0, 0 ld de, Sprites ld bc, $00a0 call CopyBytes @@ -73074,14 +73044,14 @@ Function91dcd: ; 91dcd ; 91de9 Function91de9: ; 91de9 - ld hl, TileMap - ld bc, $0014 + hlcoord 0, 0 + ld bc, SCREEN_WIDTH ld a, $7f call ByteFill hlcoord 0, 1 ld a, $6 ld [hli], a - ld bc, $0012 + ld bc, SCREEN_HEIGHT ld a, $7 call ByteFill ld [hl], $17 @@ -73103,7 +73073,7 @@ Function91e1e: ; 91e1e ld [wd003], a ld e, a callba Function2a01f - ld de, TileMap + decoord 0, 0 ld hl, Sprites .asm_91e2e ld a, [de] @@ -73130,7 +73100,7 @@ Function91e1e: ; 91e1e .asm_91e4d ld hl, Sprites - ld de, TileMap + decoord 0, 0 ld bc, $00a0 call CopyBytes ret @@ -73280,7 +73250,7 @@ FillKantoMap: ; 91f04 ld de, KantoMap FillTownMap: ; 91f07 - ld hl, TileMap + hlcoord 0, 0 .loop ld a, [de] cp $ff @@ -73294,8 +73264,8 @@ FillTownMap: ; 91f07 TownMapPals: ; 91f13 ; Assign palettes based on tile ids - ld hl, TileMap - ld de, AttrMap + hlcoord 0, 0 + decoord 0, 0, AttrMap ld bc, 360 .loop ; Current tile @@ -73651,7 +73621,7 @@ Function926f7: ; 926f7 (24:66f7) ld de, $9250 call Decompress ld hl, SlotsTilemap - ld de, TileMap + decoord 0, 0 ld bc, 20 * 12 call CopyBytes ld hl, rLCDC ; $ff40 @@ -73795,8 +73765,7 @@ Function92844: ; 92844 (24:6844) ld e, a ld d, 0 ld hl, Jumptable_92853 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -74373,8 +74342,7 @@ Function92bd4: ; 92bd4 (24:6bd4) ld e, [hl] ld d, 0 ld hl, Jumptable_92be4 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -74873,8 +74841,7 @@ Function92e94: ; 92e94 ld e, a ld d, 0 ld hl, Jumptable_92ebd - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -74975,8 +74942,7 @@ Function92f1d: ; 92f1d ld e, a ld d, 0 ld hl, Jumptable_92f48 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -75383,9 +75349,7 @@ Function93158: ; 93158 (24:7158) ld e, a ld d, 0 ld hl, Unknown_93195 - add hl, de - add hl, de - add hl, de + add_n_times hl, de, 3 ld de, StringBuffer2 ld bc, $4 call CopyBytes @@ -75496,8 +75460,7 @@ Function9321d: ; 9321d (24:721d) ld e, [hl] ld d, 0 ld hl, Jumptable_9322d - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -75593,8 +75556,7 @@ Function932ac: ; 932ac (24:72ac) ld e, [hl] ld d, 0 ld hl, Jumptable_932bc - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -75876,7 +75838,7 @@ Functionb80c6: ; b80c6 ; b80d3 Functionb80d3: ; b80d3 - ld hl, TileMap + hlcoord 0, 0 ld b, $2 ld c, $12 call Functionb8115 @@ -75934,7 +75896,7 @@ Functionb8115: ; b8115 dec c jr nz, .asm_b8121 pop hl - ld de, $0014 + ld de, SCREEN_WIDTH add hl, de pop bc dec b @@ -75943,7 +75905,7 @@ Functionb8115: ; b8115 ; b812f Functionb812f: ; b812f - ld hl, TileMap + hlcoord 0, 0 ld a, $61 ld [hli], a ld a, $62 @@ -76230,8 +76192,7 @@ GetTreeMons: ; b82d2 ld e, a ld d, 0 ld hl, TreeMons - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] @@ -76588,8 +76549,7 @@ PlayRadioShow: ; b8612 ld e, a ld d, 0 ld hl, Jumptable_b863a - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -76818,8 +76778,7 @@ Functionb8762: ; b8762 (2e:4762) jr nc, .loop2 ld e, a ld d, 0 - add hl, de - add hl, de + add_n_times hl, de, 2 inc hl ld a, BANK(WildMons1) call GetFarByte @@ -76932,8 +76891,7 @@ Functionb8854: ; b8854 (2e:4854) ld e, a ld d, 0 ld hl, Unknown_b8869 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -77062,8 +77020,7 @@ Functionb88d9: ; b88d9 (2e:48d9) ld e, a ld d, 0 ld hl, Unknown_b88fe - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -77826,13 +77783,13 @@ Functionb8cf2: ; b8cf2 (2e:4cf2) ld hl, Unknown_b8d3e ld a, [StatusFlags] bit 6, a - jr z, .asm_b8d14 + jr z, .NotMet ld hl, Unknown_b8d43 ld a, [KantoBadges] cp %11111111 - jr nz, .asm_b8d14 + jr nz, .NotMet ld hl, Unknown_b8d4b -.asm_b8d14 +.NotMet pop af ld c, a ld de, $1 @@ -77870,8 +77827,7 @@ Functionb8d56: ; b8d56 (2e:4d56) ld e, a ld d, 0 ld hl, Unknown_b8d7d - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -78047,8 +78003,7 @@ Functionb8e28: ; b8e28 (2e:4e28) ld e, a ld d, 0 ld hl, Unknown_b8e52 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -78287,8 +78242,7 @@ Functionb8f8f: ; b8f8f ld hl, Unknown_b8ff9 ld d, 0 ld e, a - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -78302,8 +78256,7 @@ Functionb8f8f: ; b8f8f push hl ld hl, Jumptable_b8fb8 ld e, b - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -78919,7 +78872,7 @@ Functionb93d2: ; b93d2 ld c, $8 call Functionb9915 ld a, $31 - ld hl, TileMap + hlcoord 0, 0 call Functionb98a8 hlcoord 1, 17 call Functionb98a8 @@ -79108,7 +79061,7 @@ Functionb9582: ; b9582 ld c, $8 call Functionb990c ld a, $31 - ld hl, TileMap + hlcoord 0, 0 call Functionb98dc hlcoord 0, 1 call Functionb98e3 @@ -79270,7 +79223,7 @@ Functionb9710: ; b9710 ld c, $8 call Functionb990c ld a, $31 - ld hl, TileMap + hlcoord 0, 0 call Functionb98a8 hlcoord 1, 17 call Functionb98a8 @@ -79410,7 +79363,7 @@ Functionb984e: ; b984e ; b9858 Functionb9858: ; b9858 - ld hl, TileMap + hlcoord 0, 0 ld a, $31 ld [hli], a inc a @@ -79432,7 +79385,7 @@ Functionb9858: ; b9858 ; b987b Functionb987b: ; b987b - ld hl, TileMap + hlcoord 0, 0 ld a, $31 ld [hli], a inc a @@ -79489,7 +79442,7 @@ Functionb98ba: ; b98ba Functionb98bd: ; b98bd ld [hl], a - ld de, $0014 + ld de, SCREEN_WIDTH add hl, de inc a ld [hl], a @@ -79530,7 +79483,7 @@ Functionb98de: ; b98de Functionb98e3: ; b98e3 ld b, $10 - ld de, $0014 + ld de, SCREEN_WIDTH .asm_b98e8 ld [hl], a add hl, de @@ -79560,7 +79513,7 @@ Functionb98fc: ; b98fc ld [hli], a inc a ld [hl], a - ld bc, $0012 + ld bc, SCREEN_HEIGHT add hl, bc inc a ld [hli], a @@ -80213,8 +80166,7 @@ Functione0191: ; e0191 (38:4191) ld e, a ld d, 0 ld hl, Jumptable_e01a0 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -80304,11 +80256,11 @@ UnknownText_0xe0212: ; 0xe0212 Functione0217: ; e0217 xor a ld [hBGMapMode], a - ld hl, TileMap + hlcoord 0, 0 ld bc, $0c09 call Functione04e5 hlcoord 9, 0 - ld bc, $0014 + ld bc, SCREEN_WIDTH ld a, [wc6e8] call AddNTimes ld [hl], $f5 @@ -80416,8 +80368,7 @@ Functione02da: ; e02da ld e, a ld d, $0 ld hl, wc6d0 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [wcf66] ld e, a add hl, de @@ -80578,8 +80529,7 @@ Functione03ec: ; e03ec ld e, a ld d, 0 ld hl, Unknown_e0459 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld e, a ld d, [hl] @@ -80587,10 +80537,10 @@ Functione03ec: ; e03ec ld bc, $0017 add hl, bc ld [hl], e - ld bc, $0012 + ld bc, SCREEN_HEIGHT add hl, bc ld a, d - ld de, $0014 + ld de, SCREEN_WIDTH ld b, $3 .asm_e0418 push hl @@ -80670,7 +80620,7 @@ String_e04bc: Functione04c1: ; e04c1 (38:44c1) xor a ld [hBGMapMode], a ; $ff00+$d4 - ld hl, TileMap + hlcoord 0, 0 ld bc, $168 ld a, $29 call ByteFill @@ -80799,7 +80749,7 @@ Functione055f: ; e055f add hl, bc add hl, bc ld [hl], $36 - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc ld [hl], $37 ret @@ -80809,7 +80759,7 @@ Functione055f: ; e055f add hl, bc add hl, bc ld [hl], $36 - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc ld [hl], $3d ret @@ -80825,7 +80775,7 @@ Functione0583: ; e0583 add hl, bc add hl, bc ld [hl], $3b - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc ld [hl], $3a ret @@ -80835,7 +80785,7 @@ Functione0583: ; e0583 add hl, bc add hl, bc ld [hl], $3d - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc ld [hl], $3a ret @@ -80851,7 +80801,7 @@ Functione05a7: ; e05a7 add hl, bc add hl, bc ld [hl], $36 - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc ld [hl], $38 ret @@ -80861,7 +80811,7 @@ Functione05a7: ; e05a7 add hl, bc add hl, bc ld [hl], $36 - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc ld [hl], $3d ret @@ -80877,7 +80827,7 @@ Functione05cb: ; e05cb add hl, bc add hl, bc ld [hl], $3c - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc ld [hl], $3a ret @@ -80887,7 +80837,7 @@ Functione05cb: ; e05cb add hl, bc add hl, bc ld [hl], $3d - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc ld [hl], $3a ret @@ -80903,7 +80853,7 @@ Functione05ef: ; e05ef add hl, bc add hl, bc ld [hl], $36 - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc ld [hl], $39 ret @@ -80913,7 +80863,7 @@ Functione05ef: ; e05ef add hl, bc add hl, bc ld [hl], $36 - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc ld [hl], $3d ret @@ -80929,7 +80879,7 @@ Functione0613: ; e0613 add hl, bc add hl, bc ld [hl], $3c - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc ld [hl], $3a ret @@ -80939,7 +80889,7 @@ Functione0613: ; e0613 add hl, bc add hl, bc ld [hl], $3d - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc ld [hl], $3a ret @@ -81500,8 +81450,7 @@ Functione0960: ; e0960 .asm_e096d call Functione0398 - add hl, hl - add hl, hl + add_n_times hl, hl, 2 ld de, Unknown_e0981 add hl, de ld a, [hli] @@ -81720,7 +81669,7 @@ Functione0c37: ; e0c37 (38:4c37) ld a, [hCGB] ; $ff00+$e6 and a ret z - ld hl, AttrMap + hlcoord 0, 0, AttrMap ld bc, $168 xor a call ByteFill @@ -81857,8 +81806,8 @@ Functione1190: ; e1190 ld de, $8ed0 call Decompress call Functione17a3 - ld hl, TileMap - ld bc, $0168 + hlcoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $ee call ByteFill hlcoord 4, 3 @@ -82002,8 +81951,7 @@ Functione12ca: ; e12ca ld e, a ld d, 0 ld hl, Jumptable_e12d9 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -82183,7 +82131,7 @@ Functione13e4: ; e13e4 ; e13ee Functione13ee: ; e13ee - ld de, $0014 + ld de, SCREEN_WIDTH .asm_e13f1 push bc push hl @@ -82233,7 +82181,7 @@ Functione141f: ; e141f push hl call Functione1481 pop hl - ld de, $0014 + ld de, SCREEN_WIDTH ld b, $3 .asm_e1431 ld c, $3 @@ -82262,7 +82210,7 @@ Functione1441: ; e1441 call Functione1463 ld a, [hl] pop hl - ld de, $0014 + ld de, SCREEN_WIDTH ld b, $3 .asm_e1456 ld c, $3 @@ -82285,12 +82233,8 @@ Functione1463: ; e1463 add hl, de ld a, [wcf65] ld e, a - add hl, de - add hl, de - add hl, de - add hl, de - add hl, de - add hl, de + add_n_times hl, de, 4 + add_n_times hl, de, 2 ret ; e1475 @@ -82650,8 +82594,7 @@ Functione17a3: ; e17a3 ld e, a ld d, 0 ld hl, Unknown_e17bd - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -82711,7 +82654,7 @@ Functione1e67: ; e1e67 (38:5e67) ld hl, wc300 ld [hli], a ld [hl], $0 - ld hl, TileMap + hlcoord 0, 0 ld bc, $168 xor a call ByteFill @@ -82748,8 +82691,7 @@ Functione1ed2: ; e1ed2 (38:5ed2) ld e, a ld d, 0 ld hl, Jumptable_e1ee1 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -83107,9 +83049,7 @@ Functione2101: ; e2101 dec a ld l, a ld h, 0 - add hl, hl - add hl, hl - add hl, hl + add_n_times hl, hl, 3 ld de, Unknown_e2110 add hl, de ret @@ -83130,7 +83070,7 @@ Functione2128: ; e2128 inc a ld [hld], a inc a - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc ld [hli], a inc a @@ -83144,7 +83084,7 @@ Functione2142: ; e2142 ld a, $1 ld [hli], a ld [hld], a - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc ld [hli], a ld [hl], a @@ -83154,11 +83094,11 @@ Functione2142: ; e2142 ; e2152 Functione2152: ; e2152 - ld hl, TileMap - ld bc, $0168 + hlcoord 0, 0 + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $1 call ByteFill - ld hl, TileMap + hlcoord 0, 0 ld de, String_e2177 call PlaceString hlcoord 15, 0 @@ -83437,8 +83377,7 @@ Functione247d: ; e247d (38:647d) ld e, a ld d, 0 ld hl, BillsPCDepositJumptable - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -83541,7 +83480,7 @@ BillsPCDepositMenuData: ; 0xe2545 (38:6545) ; 0xe2564 (38:6564) Functione2564: ; e2564 - ld hl, TileMap + hlcoord 0, 0 ld b, $4 ld c, $8 call ClearBox @@ -83701,8 +83640,7 @@ Functione2675: ; e2675 (38:6675) ld e, a ld d, 0 ld hl, BillsPCWithdrawJumptable - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -83962,8 +83900,7 @@ Functione285d: ; e285d ld e, a ld d, 0 ld hl, Jumptable_e2881 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -84450,9 +84387,7 @@ Functione2b6d: ; e2b6d (38:6b6d) ld e, a ld d, $0 ld hl, wc801 - add hl, de - add hl, de - add hl, de + add_n_times hl, de, 3 ld a, [hl] and a jr z, .asm_e2bc6 @@ -84559,9 +84494,7 @@ Functione2c2c: ; e2c2c (38:6c2c) ld e, a ld d, 0 ld hl, OverworldMap - add hl, de - add hl, de - add hl, de + add_n_times hl, de, 3 ld e, l ld d, h hlcoord 9, 4 @@ -84816,9 +84749,7 @@ Functione2def: ; e2def (38:6def) ld e, a ld d, $0 ld hl, OverworldMap - add hl, de - add hl, de - add hl, de + add_n_times hl, de, 3 ld a, [hl] ret @@ -84931,7 +84862,7 @@ Functione2ed5: ; e2ed5 dec c jr nz, .asm_e2ed7 pop hl - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc pop bc dec b @@ -85157,7 +85088,7 @@ Functione307c: ; e307c (38:707c) callba Functione039 ld a, [CurPartySpecies] call PlayCry - ld hl, TileMap + hlcoord 0, 0 ld bc, $f08 call ClearBox hlcoord 8, 14 @@ -85211,7 +85142,7 @@ Functione30fa: ; e30fa (38:70fa) callba Functione039 ld a, [CurPartySpecies] call PlayCry - ld hl, TileMap + hlcoord 0, 0 ld bc, $f08 call ClearBox hlcoord 8, 14 @@ -85246,7 +85177,7 @@ Functione30fa: ; e30fa (38:70fa) ret Functione3180: ; e3180 (38:7180) - ld hl, TileMap + hlcoord 0, 0 ld bc, $f08 call ClearBox hlcoord 8, 14 @@ -85569,8 +85500,7 @@ Functione33d0: ; e33d0 (38:73d0) Functione33df: ; e33df (38:73df) ld e, a ld d, $0 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -85648,7 +85578,7 @@ Functione35aa: ; e35aa (38:75aa) Functione35e2: ; e35e2 (38:75e2) xor a ld [hBGMapMode], a ; $ff00+$d4 - ld hl, TileMap + hlcoord 0, 0 ld bc, $168 ld a, $7f call ByteFill @@ -85789,7 +85719,7 @@ Unknown_e36a5: ; e36a5 ; e36cf Functione36cf: ; e36cf (38:76cf) - ld hl, TileMap + hlcoord 0, 0 ld b, $2 ld c, $12 call TextBox @@ -85953,7 +85883,7 @@ _OptionsMenu: ; e41d0 push af ld [hl], $1 call WhiteBGMap - ld hl, TileMap + hlcoord 0, 0 ld b, $10 ld c, $12 call TextBox @@ -86031,8 +85961,7 @@ GetOptionPointer: ; e42d6 ld e, a ;copy it to de ld d, 0 ld hl, .Pointers - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -86512,7 +86441,7 @@ OptionsControl: ; e452a Functione455c: ; e455c hlcoord 1, 1 - ld de, $0014 + ld de, SCREEN_WIDTH ld c, $10 .asm_e4564 ld [hl], $7f @@ -86644,8 +86573,7 @@ Functione4670: ; e4670 ld e, a ld d, 0 ld hl, Jumptable_e467f - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -86742,8 +86670,7 @@ Functione46ed: ; e46ed (39:46ed) ld e, [hl] ld d, 0 ld hl, Jumptable_e46fd - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -86839,8 +86766,7 @@ Functione4776: ; e4776 (39:4776) ld e, a ld d, $0 ld hl, Unknown_e47ac - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [rSVBK] ; $ff00+$70 push af ld a, $5 @@ -86954,8 +86880,7 @@ Functione490f: ; e490f ld e, a ld d, 0 ld hl, IntroScenes - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld h, [hl] ld l, a @@ -87324,7 +87249,7 @@ IntroScene9: ; e4c04 (39:4c04) xor a ld [hLCDStatCustom], a ; $ff00+$c6 call ClearSprites - ld hl, AttrMap + hlcoord 0, 0, AttrMap ld bc, $f0 ld a, $1 call ByteFill @@ -88386,7 +88311,7 @@ Functione541b: ; e541b (39:541b) ld a, $6 ld [rSVBK], a ; $ff00+$70 ld hl, Unkn1Pals - ld de, TileMap + decoord 0, 0 ld b, $12 .asm_e542a ld c, $14 @@ -88421,7 +88346,7 @@ Functione5441: ; e5441 (39:5441) ret Functione5451: ; e5451 (39:5451) - ld hl, TileMap + hlcoord 0, 0 ld bc, $168 .asm_e5457 ld a, [hl] @@ -89405,7 +89330,7 @@ Functionfb634: ; fb634 pop de inc de pop hl - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc pop bc inc c @@ -89986,8 +89911,7 @@ Functionfba2e: ; fba2e (3e:7a2e) ld e, a ld d, 0 ld hl, UnownWords - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [hli] ld e, a ld d, [hl] @@ -90759,8 +90683,7 @@ GetTradeAttribute: ; 0xfcdc2 ld e, a ld d, 0 ld hl, NPCTrades - add hl, de - add hl, de + add_n_times hl, de, 2 pop de add hl, de ret @@ -91079,7 +91002,7 @@ Functionfcfec:: ; fcfec ret nz xor a ld [wdc18], a - call Functionfd044 + call CheckBalance_MomItem2 ret nc call Functionfd0c3 ret nc @@ -91096,23 +91019,23 @@ UnknownScript_0xfd00f: ; 0xfd00f ; 0xfd017 Functionfd017: ; fd017 - call Functionfd0a6 + call MomBuysItem_DeductFunds call Functionfd0eb ld a, [wdc18] and a - jr nz, .asm_fd027 + jr nz, .ok ld hl, wdc17 inc [hl] -.asm_fd027 - ld a, $1 +.ok + ld a, 1 ld [wdbf9], a ld bc, wd03f - ld hl, $0 + ld hl, 0 add hl, bc - ld [hl], $0 + ld [hl], 0 inc hl - ld [hl], $1 - ld hl, $9 + ld [hl], 1 + ld hl, 9 add hl, bc ld a, $3f ld [hli], a @@ -91123,50 +91046,50 @@ Functionfd017: ; fd017 ret ; fd044 -Functionfd044: ; fd044 +CheckBalance_MomItem2: ; fd044 ld a, [wdc17] - cp $a - jr nc, .asm_fd065 - call Functionfd117 + cp 10 + jr nc, .nope + call GetItemFromMom ld a, [hli] - ld [$ffc3], a + ld [hMoneyTemp], a ld a, [hli] ld [$ffc4], a ld a, [hli] ld [$ffc5], a ld de, wd851 - ld bc, $ffc3 + ld bc, hMoneyTemp callba CheckMoney - jr nc, .asm_fd067 + jr nc, .have_enough_money -.asm_fd065 - jr .asm_fd069 +.nope + jr .check_have_2300 -.asm_fd067 +.have_enough_money scf ret -.asm_fd069 - ld hl, $ffc3 - ld [hl], $0 +.check_have_2300 + ld hl, hMoneyTemp + ld [hl], (2300 / $10000) ; $00 inc hl - ld [hl], $8 + ld [hl], ((2300 % $10000) / $100) ; $08 inc hl - ld [hl], $fc -.asm_fd074 + ld [hl], (2300 % $100) ; $fc +.loop ld de, wdc19 ld bc, wd851 callba CheckMoney - jr z, .asm_fd08b - jr nc, .asm_fd089 + jr z, .exact + jr nc, .less_than call Functionfd099 - jr .asm_fd074 + jr .loop -.asm_fd089 +.less_than xor a ret -.asm_fd08b +.exact call Functionfd099 ld a, 5 call RandomRange @@ -91178,43 +91101,43 @@ Functionfd044: ; fd044 Functionfd099: ; fd099 ld de, wdc19 - ld bc, $ffc3 + ld bc, hMoneyTemp callba Function16053 ret ; fd0a6 -Functionfd0a6: ; fd0a6 (3f:50a6) - call Functionfd117 - ld de, $3 +MomBuysItem_DeductFunds: ; fd0a6 (3f:50a6) + call GetItemFromMom + ld de, 3 add hl, de ld a, [hli] - ld [$ffc3], a + ld [hMoneyTemp], a ld a, [hli] ld [$ffc4], a ld a, [hli] ld [$ffc5], a ld de, wd851 - ld bc, $ffc3 + ld bc, hMoneyTemp callba TakeMoney ret Functionfd0c3: ; fd0c3 - call Functionfd117 - ld de, $0006 + call GetItemFromMom + ld de, 6 add hl, de ld a, [hli] - cp $1 - jr z, .asm_fd0db + cp 1 + jr z, .not_doll ld a, [hl] ld c, a - ld b, $1 + ld b, 1 callba Function26ef1 scf ret -.asm_fd0db +.not_doll ld a, [hl] ld [CurItem], a ld a, $1 @@ -91226,115 +91149,121 @@ Functionfd0c3: ; fd0c3 Functionfd0eb: ; fd0eb (3f:50eb) - call Functionfd117 - ld de, $6 + call GetItemFromMom + ld de, 6 ; field add hl, de ld a, [hli] - ld de, UnknownScript_0xfd0fd - cp $1 + ld de, Script_MomBoughtItem + cp 1 ret z - ld de, UnknownScript_0xfd10a + ld de, Script_MomBoughtDoll ret ; fd0fd (3f:50fd) -UnknownScript_0xfd0fd: ; 0xfd0fd - writetext UnknownText_0xfd1b1 - writetext UnknownText_0xfd1b6 - writetext UnknownText_0xfd1bb - writetext UnknownText_0xfd1c0 +Script_MomBoughtItem: ; 0xfd0fd + writetext _MomText_HiHowAreYou + writetext _MomText_FoundAnItem + writetext _MomText_BoughtWithYourMoney + writetext _MomText_ItsInPC end ; 0xfd10a -UnknownScript_0xfd10a: ; 0xfd10a - writetext UnknownText_0xfd1b1 - writetext UnknownText_0xfd1c5 - writetext UnknownText_0xfd1bb - writetext UnknownText_0xfd1ca +Script_MomBoughtDoll: ; 0xfd10a + writetext _MomText_HiHowAreYou + writetext _MomText_FoundADoll + writetext _MomText_BoughtWithYourMoney + writetext _MomText_ItsInRoom end ; 0xfd117 -Functionfd117: ; fd117 +GetItemFromMom: ; fd117 ld a, [wdc18] and a - jr z, .asm_fd123 + jr z, .zero dec a - ld de, Unknown_fd136 - jr .asm_fd12e + ld de, MomItems_1 + jr .continue -.asm_fd123 +.zero ld a, [wdc17] - cp $a - jr c, .asm_fd12b + cp 10 ; length of MomItems_2 + jr c, .ok xor a -.asm_fd12b - ld de, Unknown_fd15e +.ok + ld de, MomItems_2 -.asm_fd12e +.continue ld l, a ld h, 0 - add hl, hl - add hl, hl - add hl, hl + add_n_times hl, hl, 3 ; multiply hl by 8 add hl, de ret ; fd136 -Unknown_fd136: ; fd136 - db $00, $00, $00, $00, $02, $58, $01, SUPER_POTION - db $00, $00, $00, $00, $00, $5a, $01, ANTIDOTE - db $00, $00, $00, $00, $00, $b4, $01, POKE_BALL - db $00, $00, $00, $00, $01, $c2, $01, ESCAPE_ROPE - db $00, $00, $00, $00, $01, $f4, $01, GREAT_BALL +momitem: macro +; money to trigger, cost, kind, item + dt \1 + dt \2 + db \3, \4 +ENDM + + +MomItems_1: ; fd136 + momitem 0, 600, MOM_ITEM, SUPER_POTION + momitem 0, 90, MOM_ITEM, ANTIDOTE + momitem 0, 180, MOM_ITEM, POKE_BALL + momitem 0, 450, MOM_ITEM, ESCAPE_ROPE + momitem 0, 500, MOM_ITEM, GREAT_BALL ; fd15e -Unknown_fd15e: ; fd15e - db $00, $03, $84, $00, $02, $58, $01, SUPER_POTION - db $00, $0f, $a0, $00, $01, $0e, $01, REPEL - db $00, $1b, $58, $00, $02, $58, $01, SUPER_POTION - db $00, $27, $10, $00, $07, $08, $02, $23 ; CHARMANDER_DOLL - db $00, $3a, $98, $00, $0b, $b8, $01, MOON_STONE - db $00, $4a, $38, $00, $02, $58, $01, SUPER_POTION - db $00, $75, $30, $00, $12, $c0, $02, $20 ; CLEFAIRY_DOLL - db $00, $9c, $40, $00, $03, $84, $01, HYPER_POTION - db $00, $c3, $50, $00, $1f, $40, $02, $1e ; PIKACHU_DOLL - db $01, $86, $a0, $00, $59, $10, $02, $1a ; SNORLAX_DOLL +MomItems_2: ; fd15e + momitem 900, 600, MOM_ITEM, SUPER_POTION + momitem 4000, 270, MOM_ITEM, REPEL + momitem 7000, 600, MOM_ITEM, SUPER_POTION + momitem 10000, 1800, MOM_DOLL, DOLL_CHARMANDER + momitem 15000, 3000, MOM_ITEM, MOON_STONE + momitem 19000, 600, MOM_ITEM, SUPER_POTION + momitem 30000, 4800, MOM_DOLL, DOLL_CLEFAIRY + momitem 40000, 900, MOM_ITEM, HYPER_POTION + momitem 50000, 8000, MOM_DOLL, DOLL_PIKACHU + momitem 100000, 22800, MOM_DOLL, BIGDOLL_SNORLAX ; fd1ae db 0, 0, 0 ; XXX -UnknownText_0xfd1b1: ; 0xfd1b1 +_MomText_HiHowAreYou: ; 0xfd1b1 ; Hi, ! How are you? text_jump UnknownText_0x1bc615 db "@" ; 0xfd1b6 -UnknownText_0xfd1b6: ; 0xfd1b6 +_MomText_FoundAnItem: ; 0xfd1b6 ; I found a useful item shopping, so text_jump UnknownText_0x1bc62a db "@" ; 0xfd1bb -UnknownText_0xfd1bb: ; 0xfd1bb +_MomText_BoughtWithYourMoney: ; 0xfd1bb ; I bought it with your money. Sorry! text_jump UnknownText_0x1bc64e db "@" ; 0xfd1c0 -UnknownText_0xfd1c0: ; 0xfd1c0 +_MomText_ItsInPC: ; 0xfd1c0 ; It's in your PC. You'll like it! text_jump UnknownText_0x1bc673 db "@" ; 0xfd1c5 -UnknownText_0xfd1c5: ; 0xfd1c5 +_MomText_FoundADoll: ; 0xfd1c5 ; While shopping today, I saw this adorable doll, so text_jump UnknownText_0x1bc693 db "@" ; 0xfd1ca -UnknownText_0xfd1ca: ; 0xfd1ca +_MomText_ItsInRoom: ; 0xfd1ca ; It's in your room. You'll love it! text_jump UnknownText_0x1bc6c7 db "@" @@ -91360,10 +91289,10 @@ Function104000:: ; 104000 ; 104006 Function104006: ; 104006 - ld de, AttrMap + decoord 0, 0, AttrMap ld hl, w6_d000 + $400 call Function104263 - ld de, TileMap + decoord 0, 0 ld hl, w6_d000 call Function10425f ld a, $0 @@ -91383,7 +91312,7 @@ Function10402d:: ; 10402d ; 104033 Function104033: ; 104033 - ld de, TileMap + decoord 0, 0 ld hl, w6_d000 call Function10425f ld a, $0 @@ -91399,7 +91328,7 @@ Function104047: ; 104047 ; 10404d Function10404d: ; 10404d - ld de, AttrMap + decoord 0, 0, AttrMap ld hl, $d400 call Function104263 ld a, $1 @@ -91415,10 +91344,10 @@ Function104061:: ; 104061 ; 104067 Function104067: ; 104067 - ld de, AttrMap + decoord 0, 0, AttrMap ld hl, $d400 call Function104263 - ld de, TileMap + decoord 0, 0 ld hl, w6_d000 call Function10425f call DelayFrame @@ -91445,10 +91374,10 @@ Function104099: ; 104099 ; 1040a2 Function1040a2: ; 1040a2 - ld de, AttrMap + decoord 0, 0, AttrMap ld hl, $d400 call Function104263 - ld de, TileMap + decoord 0, 0 ld hl, w6_d000 call Function10425f call DelayFrame @@ -91515,10 +91444,10 @@ Function104110:: ; 104110 ; 104116 Function104116: ; 104116 - ld de, AttrMap + decoord 0, 0, AttrMap ld hl, $d400 call Function104263 - ld de, TileMap + decoord 0, 0 ld hl, w6_d000 call Function10425f call DelayFrame @@ -91545,11 +91474,11 @@ Function104148: ; 104148 (41:4148) ; 10414e (41:414e) Function10414e: ; 10414e - ld de, AttrMap + decoord 0, 0, AttrMap ld hl, $d400 call Function104263 ld c, $ff - ld de, TileMap + decoord 0, 0 ld hl, w6_d000 call Function104265 ld a, $1 @@ -91785,10 +91714,7 @@ Function104284:: ; 104284 ld a, b ld l, c ld h, $0 - add hl, hl - add hl, hl - add hl, hl - add hl, hl + add_n_times hl, hl, 4 ld b, h ld c, l ld h, d @@ -91845,9 +91771,7 @@ Function1042d6: ; 1042d6 ld a, b ld l, c ld h, $0 - add hl, hl - add hl, hl - add hl, hl + add_n_times hl, hl, 3 ld c, l ld b, h ld h, d @@ -91875,10 +91799,10 @@ Function104303: ; 104303 Function104309: ld hl, w6_d000 - ld de, TileMap + decoord 0, 0 call Function10433a ld hl, w6_d000 + $80 - ld de, AttrMap + decoord 0, 0, AttrMap call Function10433a ld a, $1 ld [rVBK], a ; $ff00+$4f @@ -92196,12 +92120,12 @@ Function104770: ; 104770 (41:4770) ret Function1047a3: ; 1047a3 (41:47a3) - ld de, TileMap + decoord 0, 0 call Function1047b4 ld a, [hCGB] ; $ff00+$e6 and a ret z - ld de, AttrMap + decoord 0, 0, AttrMap ld a, $1 ld [rVBK], a ; $ff00+$4f @@ -92572,8 +92496,7 @@ Function104a56: ; 104a56 (41:4a56) ld hl, $abe6 ld e, a ld d, $0 - add hl, de - add hl, de + add_n_times hl, de, 2 ld a, [wc901] ld [hli], a ld a, [wc902] @@ -93439,12 +93362,12 @@ Function105038: ; 105038 (41:5038) and $f or b ld c, a - ld a, [$ffc3] + ld a, [hMoneyTemp] xor c and c ld [$ffc4], a ld a, c - ld [$ffc3], a + ld [hMoneyTemp], a ld a, $30 ld [rJOYP], a ; $ff00+$0 ret @@ -93485,7 +93408,7 @@ Function105091: ; 105091 (41:5091) pop bc jr z, .asm_1050b0 push bc - callab Function26f02 + callab SetSpecificDecorationFlag pop bc .asm_1050b0 inc c @@ -93614,14 +93537,14 @@ Function105153: ; 105153 (41:5153) ld a, BANK(MysteryGiftGFX) ld bc, $430 call FarCopyBytes - ld hl, TileMap + hlcoord 0, 0 ld a, $42 ld bc, $168 call ByteFill hlcoord 3, 7 ld bc, $90f call ClearBox - ld hl, TileMap + hlcoord 0, 0 ld a, $0 ld [hli], a inc a @@ -93919,14 +93842,14 @@ Function1057d7: ; 1057d7 (41:57d7) ld a, BANK(MysteryGiftJP_GFX) ld bc, $80 call FarCopyBytes - ld hl, TileMap + hlcoord 0, 0 ld a, $3f ld bc, $168 call ByteFill hlcoord 3, 7 ld bc, $90f call ClearBox - ld hl, TileMap + hlcoord 0, 0 ld a, $0 ld [hli], a inc a @@ -95613,7 +95536,7 @@ INCBIN "gfx/misc/unown_font.2bpp" ; 1dc1b0 Function1dc1b0: ; 1dc1b0 - ld hl, TileMap + hlcoord 0, 0 ld de, wca90 ld bc, $0154 call CopyBytes @@ -95652,7 +95575,7 @@ Function1dc1b0: ; 1dc1b0 call nz, FarString ld hl, wcaa3 ld [hl], $35 - ld de, $0014 + ld de, SCREEN_WIDTH add hl, de ld b, $f .asm_1dc20a @@ -95681,11 +95604,11 @@ Function1dc213: ; 1dc213 ld [hl], $38 inc hl ld a, $39 - ld bc, $0012 + ld bc, SCREEN_HEIGHT call ByteFill ld [hl], $3a ld hl, wcb1c - ld bc, $0014 + ld bc, SCREEN_WIDTH ld a, $32 call ByteFill ld a, [wd265] @@ -95705,7 +95628,7 @@ Function1dc213: ; 1dc213 Function1dc26a: ; 1dc26a push de - ld de, $0014 + ld de, SCREEN_WIDTH .asm_1dc26e ld [hl], a add hl, de @@ -95837,7 +95760,7 @@ Function1dc381: ; 1dc381 inc [hl] .asm_1dc469 - ld hl, TileMap + hlcoord 0, 0 call Function378b call WaitBGMap ld b, $3 @@ -95856,12 +95779,12 @@ Function1dc47b: ; 1dc47b xor a ld [MonType], a callba Function5084a - ld hl, TileMap + hlcoord 0, 0 ld b, 15 ld c, 18 call TextBox ld bc, SCREEN_WIDTH - ld de, TileMap + decoord 0, 0 hlcoord 0, 1 call CopyBytes hlcoord 7, 0 @@ -96093,7 +96016,7 @@ Function1de171: ; 1de171 (77:6171) ld bc, $f0b call ClearBox ld a, $34 - ld hl, TileMap + hlcoord 0, 0 ld bc, $b call ByteFill ld a, $39 @@ -96128,7 +96051,7 @@ Function1de171: ; 1de171 (77:6171) Function1de1d1: ; 1de1d1 (77:61d1) ld a, $34 - ld hl, TileMap + hlcoord 0, 0 ld bc, $b call ByteFill ld a, $39 @@ -96213,7 +96136,7 @@ Function1de247: ; 1de247 Function1de27f: ; 1de27f push de - ld de, $0014 + ld de, SCREEN_WIDTH .asm_1de283 ld [hl], a add hl, de diff --git a/maps/BillsHouse.asm b/maps/BillsHouse.asm index 6445a439a..b4f7abf7d 100644 --- a/maps/BillsHouse.asm +++ b/maps/BillsHouse.asm @@ -8,7 +8,7 @@ BillsHouse_MapScriptHeader: GrampsScript_0x189538: faceplayer loadfont - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iftrue UnknownScript_0x1896ba checkevent EVENT_GOT_THUNDERSTONE_FROM_BILLS_GRANDPA iftrue UnknownScript_0x1896c0 @@ -120,7 +120,7 @@ UnknownScript_0x18963b: verbosegiveitem EVERSTONE, 1 iffalse UnknownScript_0x1896cc setevent EVENT_GOT_EVERSTONE_FROM_BILLS_GRANDPA - setevent EVENT_CHRIS1_IN_CABLE_CLUB + setevent EVENT_000 loadmovesprites end @@ -131,7 +131,7 @@ UnknownScript_0x189652: verbosegiveitem LEAF_STONE, 1 iffalse UnknownScript_0x1896cc setevent EVENT_GOT_LEAF_STONE_FROM_BILLS_GRANDPA - setevent EVENT_CHRIS1_IN_CABLE_CLUB + setevent EVENT_000 loadmovesprites end @@ -142,7 +142,7 @@ UnknownScript_0x189669: verbosegiveitem WATER_STONE, 1 iffalse UnknownScript_0x1896cc setevent EVENT_GOT_WATER_STONE_FROM_BILLS_GRANDPA - setevent EVENT_CHRIS1_IN_CABLE_CLUB + setevent EVENT_000 loadmovesprites end @@ -153,7 +153,7 @@ UnknownScript_0x189680: verbosegiveitem FIRE_STONE, 1 iffalse UnknownScript_0x1896cc setevent EVENT_GOT_FIRE_STONE_FROM_BILLS_GRANDPA - setevent EVENT_CHRIS1_IN_CABLE_CLUB + setevent EVENT_000 loadmovesprites end diff --git a/maps/Colosseum.asm b/maps/Colosseum.asm index 070bde484..b530d91c5 100644 --- a/maps/Colosseum.asm +++ b/maps/Colosseum.asm @@ -83,5 +83,5 @@ Colosseum_MapEventHeader: ; people-events db 2 - person_event SPRITE_CHRIS, 8, 7, LEFT << 2 | $1, $0, -1, -1, $0, 0, ChrisScript_0x193499, EVENT_CHRIS1_IN_CABLE_CLUB - person_event SPRITE_CHRIS, 8, 10, LEFT << 2 | $0, $0, -1, -1, $0, 0, ChrisScript_0x193499, EVENT_CHRIS2_IN_CABLE_CLUB + person_event SPRITE_CHRIS, 8, 7, LEFT << 2 | $1, $0, -1, -1, $0, 0, ChrisScript_0x193499, EVENT_000 + person_event SPRITE_CHRIS, 8, 10, LEFT << 2 | $0, $0, -1, -1, $0, 0, ChrisScript_0x193499, EVENT_001 diff --git a/maps/DragonShrine.asm b/maps/DragonShrine.asm index 6c6ac51c3..e8fdc5016 100644 --- a/maps/DragonShrine.asm +++ b/maps/DragonShrine.asm @@ -3,91 +3,91 @@ DragonShrine_MapScriptHeader: db 2 ; triggers - dw UnknownScript_0x18d01e, $0000 - dw UnknownScript_0x18d022, $0000 + dw .Trigger1, $0000 + dw .Trigger2, $0000 ; callback count db 0 -UnknownScript_0x18d01e: - priorityjump UnknownScript_0x18d023 +.Trigger1: + priorityjump DragonShrineTestScript end -UnknownScript_0x18d022: +.Trigger2: end -UnknownScript_0x18d023: +DragonShrineTestScript: applymovement $0, MovementData_0x18d2bf applymovement $2, MovementData_0x18d2c7 loadfont writetext UnknownText_0x18d2ea keeptextopen -UnknownScript_0x18d030: - setevent EVENT_CHRIS2_IN_CABLE_CLUB +.Question1: + setevent EVENT_001 writetext UnknownText_0x18d3bc keeptextopen loadmenudata MenuDataHeader_0x18d215 interpretmenu2 writebackup - if_equal $1, UnknownScript_0x18d0a9 - if_equal $2, UnknownScript_0x18d0cb - if_equal $3, UnknownScript_0x18d0a9 + if_equal $1, .RightAnswer + if_equal $2, .WrongAnswer + if_equal $3, .RightAnswer end -UnknownScript_0x18d049: +.Question2: setevent EVENT_002 writetext UnknownText_0x18d3d3 keeptextopen loadmenudata MenuDataHeader_0x18d234 interpretmenu2 writebackup - if_equal $1, UnknownScript_0x18d0a9 - if_equal $2, UnknownScript_0x18d0a9 - if_equal $3, UnknownScript_0x18d0cb -UnknownScript_0x18d061: + if_equal $1, .RightAnswer + if_equal $2, .RightAnswer + if_equal $3, .WrongAnswer +.Question3: setevent EVENT_003 writetext UnknownText_0x18d3f3 keeptextopen loadmenudata MenuDataHeader_0x18d258 interpretmenu2 writebackup - if_equal $1, UnknownScript_0x18d0cb - if_equal $2, UnknownScript_0x18d0a9 - if_equal $3, UnknownScript_0x18d0a9 -UnknownScript_0x18d079: + if_equal $1, .WrongAnswer + if_equal $2, .RightAnswer + if_equal $3, .RightAnswer +.Question4: setevent EVENT_004 writetext UnknownText_0x18d420 keeptextopen loadmenudata MenuDataHeader_0x18d283 interpretmenu2 writebackup - if_equal $1, UnknownScript_0x18d0a9 - if_equal $2, UnknownScript_0x18d0cb - if_equal $3, UnknownScript_0x18d0a9 -UnknownScript_0x18d091: + if_equal $1, .RightAnswer + if_equal $2, .WrongAnswer + if_equal $3, .RightAnswer +.Question5: setevent EVENT_005 writetext UnknownText_0x18d44a keeptextopen loadmenudata MenuDataHeader_0x18d2a5 interpretmenu2 writebackup - if_equal $1, UnknownScript_0x18d0cb - if_equal $2, UnknownScript_0x18d0a9 - if_equal $3, UnknownScript_0x18d0cb -UnknownScript_0x18d0a9: + if_equal $1, .WrongAnswer + if_equal $2, .RightAnswer + if_equal $3, .WrongAnswer +.RightAnswer: checkevent EVENT_005 - iftrue UnknownScript_0x18d100 + iftrue .PassedTheTest writetext UnknownText_0x18d82d keeptextopen checkevent EVENT_004 - iftrue UnknownScript_0x18d091 + iftrue .Question5 checkevent EVENT_003 - iftrue UnknownScript_0x18d079 + iftrue .Question4 checkevent EVENT_002 - iftrue UnknownScript_0x18d061 - checkevent EVENT_CHRIS2_IN_CABLE_CLUB - iftrue UnknownScript_0x18d049 -UnknownScript_0x18d0cb: + iftrue .Question3 + checkevent EVENT_001 + iftrue .Question2 +.WrongAnswer: loadmovesprites spriteface $2, LEFT loadfont @@ -102,16 +102,16 @@ UnknownScript_0x18d0cb: setevent EVENT_ANSWERED_DRAGON_MASTER_QUIZ_WRONG loadfont checkevent EVENT_005 - iftrue UnknownScript_0x18d091 + iftrue .Question5 checkevent EVENT_004 - iftrue UnknownScript_0x18d079 + iftrue .Question4 checkevent EVENT_003 - iftrue UnknownScript_0x18d061 + iftrue .Question3 checkevent EVENT_002 - iftrue UnknownScript_0x18d049 - checkevent EVENT_CHRIS2_IN_CABLE_CLUB - iftrue UnknownScript_0x18d030 -UnknownScript_0x18d100: + iftrue .Question2 + checkevent EVENT_001 + iftrue .Question1 +.PassedTheTest: writetext UnknownText_0x18d47c closetext loadmovesprites @@ -160,7 +160,7 @@ UnknownScript_0x18d100: playsound SFX_GET_BADGE waitbutton special RestartMapMusic - specialphonecall $8 + specialphonecall ELMCALL_MASTERBALL dotrigger $1 domaptrigger GROUP_DRAGONS_DEN_B1F, MAP_DRAGONS_DEN_B1F, $1 writetext UnknownText_0x18d9f2 @@ -184,30 +184,30 @@ UnknownScript_0x18d100: playsound SFX_ENTER_DOOR disappear $5 waitbutton - setevent EVENT_CHRIS1_IN_CABLE_CLUB + setevent EVENT_000 end ElderScript_0x18d1a5: faceplayer loadfont - checkevent EVENT_CHRIS1_IN_CABLE_CLUB - iftrue UnknownScript_0x18d1f9 + checkevent EVENT_000 + iftrue .DontGiveDratiniYet checkevent EVENT_006 - iftrue UnknownScript_0x18d1ff + iftrue .ReceivedDratini checkevent EVENT_GOT_DRATINI - iffalse UnknownScript_0x18d1c5 + iffalse .GiveDratini checkevent EVENT_BEAT_RIVAL_IN_MT_MOON - iftrue UnknownScript_0x18d1f3 + iftrue .BeatRivalInMtMoon writetext UnknownText_0x18d724 closetext loadmovesprites end -UnknownScript_0x18d1c5: +.GiveDratini: writetext UnknownText_0x18d604 closetext checkcode VAR_PARTYCOUNT - if_equal $6, UnknownScript_0x18d1ed + if_equal 6, .PartyFull writetext UnknownText_0x18d697 playsound SFX_CAUGHT_MON waitbutton @@ -221,25 +221,25 @@ UnknownScript_0x18d1c5: loadmovesprites end -UnknownScript_0x18d1ed: +.PartyFull: writetext UnknownText_0x18d6ac closetext loadmovesprites end -UnknownScript_0x18d1f3: +.BeatRivalInMtMoon: writetext UnknownText_0x18d782 closetext loadmovesprites end -UnknownScript_0x18d1f9: +.DontGiveDratiniYet: writetext UnknownText_0x18d5e5 closetext loadmovesprites end -UnknownScript_0x18d1ff: +.ReceivedDratini: writetext UnknownText_0x18d6ca closetext loadmovesprites @@ -681,7 +681,7 @@ DragonShrine_MapEventHeader: ; people-events db 4 - person_event SPRITE_ELDER, 5, 9, UP << 2 | $2, $0, -1, -1, $0, 0, ElderScript_0x18d1a5, EVENT_CHRIS1_IN_CABLE_CLUB - person_event SPRITE_ELDER, 8, 6, LEFT << 2 | $1, $0, -1, -1, $0, 0, ElderScript_0x18d205, EVENT_CHRIS1_IN_CABLE_CLUB - person_event SPRITE_ELDER, 8, 11, LEFT << 2 | $0, $0, -1, -1, $0, 0, ElderScript_0x18d20d, EVENT_CHRIS1_IN_CABLE_CLUB + person_event SPRITE_ELDER, 5, 9, UP << 2 | $2, $0, -1, -1, $0, 0, ElderScript_0x18d1a5, EVENT_000 + person_event SPRITE_ELDER, 8, 6, LEFT << 2 | $1, $0, -1, -1, $0, 0, ElderScript_0x18d205, EVENT_000 + person_event SPRITE_ELDER, 8, 11, LEFT << 2 | $0, $0, -1, -1, $0, 0, ElderScript_0x18d20d, EVENT_000 person_event SPRITE_CLAIR, 12, 8, UP << 2 | $3, $0, -1, -1, (PAL_OW_BLUE << 4) | $80, 0, ObjectEvent, EVENT_790 diff --git a/maps/DragonsDenB1F.asm b/maps/DragonsDenB1F.asm index 21bb85fe3..4481d3597 100644 --- a/maps/DragonsDenB1F.asm +++ b/maps/DragonsDenB1F.asm @@ -212,12 +212,12 @@ SilverScript_0x18c97e: playmusic MUSIC_RIVAL_ENCOUNTER faceplayer loadfont - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iftrue UnknownScript_0x18c995 writetext UnknownText_0x18cc83 closetext loadmovesprites - setevent EVENT_CHRIS1_IN_CABLE_CLUB + setevent EVENT_000 special RestartMapMusic end diff --git a/maps/EcruteakHouse.asm b/maps/EcruteakHouse.asm index 183a44a08..066b9125b 100644 --- a/maps/EcruteakHouse.asm +++ b/maps/EcruteakHouse.asm @@ -86,7 +86,7 @@ UnknownScript_0x98076: UnknownScript_0x9807c: checkevent EVENT_KOJI_ALLOWS_YOU_PASSAGE_TO_TIN_TOWER iftrue UnknownScript_0x980a4 - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iftrue UnknownScript_0x980aa checkitem CLEAR_BELL iftrue UnknownScript_0x98093 @@ -102,7 +102,7 @@ UnknownScript_0x98093: dotrigger $1 setevent EVENT_RANG_CLEAR_BELL clearevent EVENT_766 - setevent EVENT_CHRIS1_IN_CABLE_CLUB + setevent EVENT_000 end UnknownScript_0x980a4: diff --git a/maps/GoldenrodDeptStoreRoof.asm b/maps/GoldenrodDeptStoreRoof.asm index c04ded152..5aaf3b8e4 100644 --- a/maps/GoldenrodDeptStoreRoof.asm +++ b/maps/GoldenrodDeptStoreRoof.asm @@ -7,30 +7,30 @@ GoldenrodDeptStoreRoof_MapScriptHeader: ; callbacks - dbw 1, UnknownScript_0x5671b + dbw 1, .CheckSaleChangeBlock - dbw 2, UnknownScript_0x5672b + dbw 2, .CheckSaleChangeClerk -UnknownScript_0x5671b: +.CheckSaleChangeBlock: checkflag ENGINE_GOLDENROD_DEPT_STORE_SALE_IS_ON - iftrue UnknownScript_0x56722 + iftrue .ChangeBlock return -UnknownScript_0x56722: +.ChangeBlock: changeblock $0, $2, $3f changeblock $0, $4, $f return -UnknownScript_0x5672b: +.CheckSaleChangeClerk: checkflag ENGINE_GOLDENROD_DEPT_STORE_SALE_IS_ON - iftrue UnknownScript_0x56738 - setevent EVENT_6F0 - clearevent EVENT_6F1 + iftrue .ChangeClerk + setevent EVENT_GOLDENROD_SALE_OFF + clearevent EVENT_GOLDENROD_SALE_ON return -UnknownScript_0x56738: - clearevent EVENT_6F0 - setevent EVENT_6F1 +.ChangeClerk: + clearevent EVENT_GOLDENROD_SALE_OFF + setevent EVENT_GOLDENROD_SALE_ON return ClerkScript_0x5673f: @@ -225,11 +225,11 @@ GoldenrodDeptStoreRoof_MapEventHeader: ; people-events db 8 - person_event SPRITE_CLERK, 8, 5, LEFT << 2 | $1, $0, -1, -1, $0, 0, ClerkScript_0x5673f, EVENT_6F0 + person_event SPRITE_CLERK, 8, 5, LEFT << 2 | $1, $0, -1, -1, $0, 0, ClerkScript_0x5673f, EVENT_GOLDENROD_SALE_OFF person_event SPRITE_POKEFAN_F, 7, 14, UP << 2 | $1, $1, -1, -1, (PAL_OW_RED << 4) | $80, 0, PokefanFScript_0x56746, -1 person_event SPRITE_FISHER, 5, 6, UP << 2 | $3, $0, -1, -1, (PAL_OW_BLUE << 4) | $80, 0, FisherScript_0x56749, -1 - person_event SPRITE_TWIN, 8, 7, DOWN << 2 | $2, $11, -1, -1, (PAL_OW_GREEN << 4) | $80, 0, TwinScript_0x56754, EVENT_6F1 - person_event SPRITE_SUPER_NERD, 10, 18, LEFT << 2 | $1, $0, -1, -1, (PAL_OW_GREEN << 4) | $80, 0, SuperNerdScript_0x56757, EVENT_6F1 - person_event SPRITE_POKEFAN_M, 4, 11, UP << 2 | $1, $1, -1, -1, $0, 0, PokefanMScript_0x5676a, EVENT_6F0 - person_event SPRITE_TEACHER, 7, 9, DOWN << 2 | $2, $11, -1, -1, (PAL_OW_GREEN << 4) | $80, 0, TeacherScript_0x5676d, EVENT_6F0 - person_event SPRITE_BUG_CATCHER, 10, 5, UP << 2 | $3, $0, -1, -1, (PAL_OW_RED << 4) | $80, 0, BugCatcherScript_0x56770, EVENT_6F0 + person_event SPRITE_TWIN, 8, 7, DOWN << 2 | $2, $11, -1, -1, (PAL_OW_GREEN << 4) | $80, 0, TwinScript_0x56754, EVENT_GOLDENROD_SALE_ON + person_event SPRITE_SUPER_NERD, 10, 18, LEFT << 2 | $1, $0, -1, -1, (PAL_OW_GREEN << 4) | $80, 0, SuperNerdScript_0x56757, EVENT_GOLDENROD_SALE_ON + person_event SPRITE_POKEFAN_M, 4, 11, UP << 2 | $1, $1, -1, -1, $0, 0, PokefanMScript_0x5676a, EVENT_GOLDENROD_SALE_OFF + person_event SPRITE_TEACHER, 7, 9, DOWN << 2 | $2, $11, -1, -1, (PAL_OW_GREEN << 4) | $80, 0, TeacherScript_0x5676d, EVENT_GOLDENROD_SALE_OFF + person_event SPRITE_BUG_CATCHER, 10, 5, UP << 2 | $3, $0, -1, -1, (PAL_OW_RED << 4) | $80, 0, BugCatcherScript_0x56770, EVENT_GOLDENROD_SALE_OFF diff --git a/maps/HallOfFame.asm b/maps/HallOfFame.asm index a50361a17..ca4f1c948 100644 --- a/maps/HallOfFame.asm +++ b/maps/HallOfFame.asm @@ -40,9 +40,9 @@ HallOfFameScript: domaptrigger GROUP_SPROUT_TOWER_3F, MAP_SPROUT_TOWER_3F, $1 special HealParty checkevent EVENT_GOT_SS_TICKET_FROM_ELM - iftrue HallOfFame_SkipPhoneCall - specialphonecall $5 -HallOfFame_SkipPhoneCall: + iftrue .SkipPhoneCall + specialphonecall ELMCALL_SSTICKET +.SkipPhoneCall: halloffame end diff --git a/maps/KrissHouse1F.asm b/maps/KrissHouse1F.asm index 680ccfef5..5ad19236f 100644 --- a/maps/KrissHouse1F.asm +++ b/maps/KrissHouse1F.asm @@ -16,13 +16,13 @@ UnknownScript_0x7a4d7: end UnknownScript_0x7a4d8: - setevent EVENT_CHRIS1_IN_CABLE_CLUB + setevent EVENT_000 UnknownScript_0x7a4db: playmusic MUSIC_MOM showemote EMOTE_SHOCK, $2, 15 spriteface $0, LEFT - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iffalse UnknownScript_0x7a4f2 applymovement $2, MovementData_0x7a5fc jump UnknownScript_0x7a4f6 @@ -77,9 +77,9 @@ UnknownScript_0x7a549: writetext UnknownText_0x7a850 closetext loadmovesprites - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iftrue UnknownScript_0x7a55d - checkevent EVENT_CHRIS2_IN_CABLE_CLUB + checkevent EVENT_001 iffalse UnknownScript_0x7a564 jump UnknownScript_0x7a56b @@ -109,7 +109,7 @@ UnknownScript_0x7a57e: MomScript_0x7a582: faceplayer - setevent EVENT_CHRIS2_IN_CABLE_CLUB + setevent EVENT_001 checktriggers iffalse UnknownScript_0x7a572 loadfont diff --git a/maps/KurtsHouse.asm b/maps/KurtsHouse.asm index df36a7877..ae065d727 100644 --- a/maps/KurtsHouse.asm +++ b/maps/KurtsHouse.asm @@ -70,7 +70,7 @@ UnknownScript_0x18e1bf: iffalse UnknownScript_0x18e2b2 setevent EVENT_035 UnknownScript_0x18e1cc: - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iftrue UnknownScript_0x18e29f checkevent EVENT_258 iftrue UnknownScript_0x18e2b4 @@ -89,7 +89,7 @@ UnknownScript_0x18e1cc: checkevent EVENT_CAN_GIVE_GS_BALL_TO_KURT iftrue UnknownScript_0x18e34e UnknownScript_0x18e202: - checkevent EVENT_CHRIS2_IN_CABLE_CLUB + checkevent EVENT_001 iftrue UnknownScript_0x18e212 checkevent EVENT_002 iftrue UnknownScript_0x18e212 @@ -110,7 +110,7 @@ UnknownScript_0x18e212: iftrue UnknownScript_0x18e249 checkitem PNK_APRICORN iftrue UnknownScript_0x18e249 - checkevent EVENT_CHRIS2_IN_CABLE_CLUB + checkevent EVENT_001 iftrue UnknownScript_0x18e2ae checkevent EVENT_002 iftrue UnknownScript_0x18e243 @@ -163,7 +163,7 @@ UnknownScript_0x18e293: jump UnknownScript_0x18e299 UnknownScript_0x18e299: - setevent EVENT_CHRIS1_IN_CABLE_CLUB + setevent EVENT_000 setflag ENGINE_KURT_MAKING_BALLS UnknownScript_0x18e29f: writetext UnknownText_0x18e779 @@ -178,7 +178,7 @@ UnknownScript_0x18e2a5: end UnknownScript_0x18e2ab: - setevent EVENT_CHRIS2_IN_CABLE_CLUB + setevent EVENT_001 UnknownScript_0x18e2ae: writetext UnknownText_0x18e82a closetext @@ -349,9 +349,9 @@ UnknownScript_0x18e3e0: KurtsGranddaughter1: faceplayer - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iftrue KurtsGranddaughter2Subscript - checkevent EVENT_CHRIS2_IN_CABLE_CLUB + checkevent EVENT_001 iftrue KurtsGranddaughterFunScript checkevent EVENT_FOREST_IS_RESTLESS iftrue .Lonely diff --git a/maps/MrPokemonsHouse.asm b/maps/MrPokemonsHouse.asm index fa9ac1206..44a8d3a70 100644 --- a/maps/MrPokemonsHouse.asm +++ b/maps/MrPokemonsHouse.asm @@ -126,7 +126,7 @@ UnknownScript_0x196ec9: dotrigger $1 domaptrigger GROUP_CHERRYGROVE_CITY, MAP_CHERRYGROVE_CITY, $1 domaptrigger GROUP_ELMS_LAB, MAP_ELMS_LAB, $3 - specialphonecall $2 + specialphonecall ELMCALL_ROBBED clearevent EVENT_COP_IN_ELMS_LAB checkevent EVENT_GOT_TOTODILE_FROM_ELM iftrue UnknownScript_0x196f49 diff --git a/maps/OlivinePort.asm b/maps/OlivinePort.asm index 3d559e7ba..1c71aad5b 100644 --- a/maps/OlivinePort.asm +++ b/maps/OlivinePort.asm @@ -20,14 +20,14 @@ UnknownScript_0x748b1: applymovement $0, MovementData_0x74a32 appear $2 dotrigger $0 - setevent EVENT_CHRIS1_IN_CABLE_CLUB + setevent EVENT_000 blackoutmod GROUP_OLIVINE_CITY, MAP_OLIVINE_CITY end SailorScript_0x748c0: faceplayer loadfont - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iftrue UnknownScript_0x74919 writetext UnknownText_0x74a55 closetext @@ -69,9 +69,9 @@ UnknownScript_0x74919: UnknownScript_0x7491f: spriteface $4, RIGHT - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iftrue UnknownScript_0x7498b - checkevent EVENT_CHRIS2_IN_CABLE_CLUB + checkevent EVENT_001 iftrue UnknownScript_0x7498b spriteface $0, LEFT loadfont @@ -94,7 +94,7 @@ UnknownScript_0x7494e: writetext UnknownText_0x74b11 closetext loadmovesprites - setevent EVENT_CHRIS2_IN_CABLE_CLUB + setevent EVENT_001 applymovement $0, MovementData_0x74a37 jump SailorScript_0x748c0 @@ -138,7 +138,7 @@ UnknownScript_0x74992: SailorScript_0x7499c: faceplayer loadfont - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iftrue UnknownScript_0x74919 checkevent EVENT_030 iffalse UnknownScript_0x749c0 @@ -159,7 +159,7 @@ UnknownScript_0x749c0: writetext UnknownText_0x74b11 closetext loadmovesprites - setevent EVENT_CHRIS2_IN_CABLE_CLUB + setevent EVENT_001 checkcode VAR_FACING if_equal $3, UnknownScript_0x749e5 applymovement $0, MovementData_0x74a3f diff --git a/maps/PokeCenter2F.asm b/maps/PokeCenter2F.asm index 97fcc6c0e..09b16d6d5 100644 --- a/maps/PokeCenter2F.asm +++ b/maps/PokeCenter2F.asm @@ -17,7 +17,7 @@ PokeCenter2F_MapScriptHeader: special Special_CheckMysteryGift if_equal $0, .Trigger1Done clearevent EVENT_MYSTERY_GIFT_DELIVERY_GUY - checkevent EVENT_CHRIS2_IN_CABLE_CLUB + checkevent EVENT_001 iftrue .Trigger1Done priorityjump PokeCenter2F_AppearMysteryGiftDeliveryGuy @@ -46,7 +46,7 @@ PokeCenter2F_MapScriptHeader: PokeCenter2F_AppearMysteryGiftDeliveryGuy: appear $5 - setevent EVENT_CHRIS2_IN_CABLE_CLUB + setevent EVENT_001 end Script_TradeCenterClosed: diff --git a/maps/Route31.asm b/maps/Route31.asm index 8db796540..ddbc7cd8b 100644 --- a/maps/Route31.asm +++ b/maps/Route31.asm @@ -15,7 +15,7 @@ UnknownScript_0x1a543c: return UnknownScript_0x1a5443: - specialphonecall $7 + specialphonecall MOMCALL_WORRIED return TrainerBug_catcherWade1: diff --git a/maps/Route36NationalParkgate.asm b/maps/Route36NationalParkgate.asm index b80ab2635..d938228c3 100644 --- a/maps/Route36NationalParkgate.asm +++ b/maps/Route36NationalParkgate.asm @@ -300,7 +300,7 @@ UnknownScript_0x6ad02: YoungsterScript_0x6ad06: faceplayer loadfont - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iffalse UnknownScript_0x6ad14 writetext UnknownText_0x6b399 closetext @@ -316,7 +316,7 @@ UnknownScript_0x6ad14: YoungsterScript_0x6ad1a: faceplayer loadfont - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iffalse UnknownScript_0x6ad28 writetext UnknownText_0x6b40f closetext @@ -332,7 +332,7 @@ UnknownScript_0x6ad28: RockerScript_0x6ad2e: faceplayer loadfont - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iffalse UnknownScript_0x6ad3c writetext UnknownText_0x6b462 closetext @@ -348,7 +348,7 @@ UnknownScript_0x6ad3c: PokefanMScript_0x6ad42: faceplayer loadfont - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iffalse UnknownScript_0x6ad50 writetext UnknownText_0x6b4da closetext @@ -364,7 +364,7 @@ UnknownScript_0x6ad50: YoungsterScript_0x6ad56: faceplayer loadfont - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iffalse UnknownScript_0x6ad64 writetext UnknownText_0x6b54e closetext @@ -380,7 +380,7 @@ UnknownScript_0x6ad64: YoungsterScript_0x6ad6a: faceplayer loadfont - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iffalse UnknownScript_0x6ad78 writetext UnknownText_0x6b5b0 closetext @@ -396,7 +396,7 @@ UnknownScript_0x6ad78: LassScript_0x6ad7e: faceplayer loadfont - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iffalse UnknownScript_0x6ad8c writetext UnknownText_0x6b64b closetext @@ -412,7 +412,7 @@ UnknownScript_0x6ad8c: YoungsterScript_0x6ad92: faceplayer loadfont - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iffalse UnknownScript_0x6ada0 writetext UnknownText_0x6b6b8 closetext @@ -428,7 +428,7 @@ UnknownScript_0x6ada0: YoungsterScript_0x6ada6: faceplayer loadfont - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iffalse UnknownScript_0x6adb4 writetext UnknownText_0x6b71b closetext @@ -444,7 +444,7 @@ UnknownScript_0x6adb4: YoungsterScript_0x6adba: faceplayer loadfont - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iffalse UnknownScript_0x6adc8 writetext UnknownText_0x6b76f closetext diff --git a/maps/TimeCapsule.asm b/maps/TimeCapsule.asm index 5386ab633..2f85ad340 100644 --- a/maps/TimeCapsule.asm +++ b/maps/TimeCapsule.asm @@ -73,5 +73,5 @@ TimeCapsule_MapEventHeader: ; people-events db 2 - person_event SPRITE_CHRIS, 8, 7, LEFT << 2 | $1, $0, -1, -1, $0, 0, ChrisScript_0x19351a, EVENT_CHRIS1_IN_CABLE_CLUB - person_event SPRITE_CHRIS, 8, 10, LEFT << 2 | $0, $0, -1, -1, $0, 0, ChrisScript_0x19351a, EVENT_CHRIS2_IN_CABLE_CLUB + person_event SPRITE_CHRIS, 8, 7, LEFT << 2 | $1, $0, -1, -1, $0, 0, ChrisScript_0x19351a, EVENT_000 + person_event SPRITE_CHRIS, 8, 10, LEFT << 2 | $0, $0, -1, -1, $0, 0, ChrisScript_0x19351a, EVENT_001 diff --git a/maps/TradeCenter.asm b/maps/TradeCenter.asm index 98263f7af..e23068c7f 100644 --- a/maps/TradeCenter.asm +++ b/maps/TradeCenter.asm @@ -73,5 +73,5 @@ TradeCenter_MapEventHeader: ; people-events db 2 - person_event SPRITE_CHRIS, 8, 7, LEFT << 2 | $1, $0, -1, -1, $0, 0, ChrisScript_0x193499, EVENT_CHRIS1_IN_CABLE_CLUB - person_event SPRITE_CHRIS, 8, 10, LEFT << 2 | $0, $0, -1, -1, $0, 0, ChrisScript_0x193499, EVENT_CHRIS2_IN_CABLE_CLUB + person_event SPRITE_CHRIS, 8, 7, LEFT << 2 | $1, $0, -1, -1, $0, 0, ChrisScript_0x193499, EVENT_000 + person_event SPRITE_CHRIS, 8, 10, LEFT << 2 | $0, $0, -1, -1, $0, 0, ChrisScript_0x193499, EVENT_001 diff --git a/maps/VermilionPort.asm b/maps/VermilionPort.asm index a4cf151c2..8b031fc91 100644 --- a/maps/VermilionPort.asm +++ b/maps/VermilionPort.asm @@ -32,14 +32,14 @@ UnknownScript_0x74da6: setevent EVENT_739 clearevent EVENT_733 setevent EVENT_030 - setevent EVENT_CHRIS1_IN_CABLE_CLUB + setevent EVENT_000 blackoutmod GROUP_VERMILION_CITY, MAP_VERMILION_CITY end SailorScript_0x74dc4: faceplayer loadfont - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iftrue UnknownScript_0x74e1a writetext UnknownText_0x74f06 closetext @@ -79,9 +79,9 @@ UnknownScript_0x74e1a: UnknownScript_0x74e20: spriteface $3, RIGHT - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iftrue UnknownScript_0x74e86 - checkevent EVENT_CHRIS2_IN_CABLE_CLUB + checkevent EVENT_001 iftrue UnknownScript_0x74e86 spriteface $0, LEFT loadfont @@ -101,7 +101,7 @@ UnknownScript_0x74e20: writetext UnknownText_0x74fc2 closetext loadmovesprites - setevent EVENT_CHRIS2_IN_CABLE_CLUB + setevent EVENT_001 applymovement $0, MovementData_0x74ef8 jump SailorScript_0x74dc4 @@ -145,7 +145,7 @@ UnknownScript_0x74e8d: SailorScript_0x74e97: faceplayer loadfont - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iftrue UnknownScript_0x74e1a checkcode VAR_WEEKDAY if_equal MONDAY, UnknownScript_0x74eda @@ -163,7 +163,7 @@ SailorScript_0x74e97: writetext UnknownText_0x74fc2 closetext loadmovesprites - setevent EVENT_CHRIS2_IN_CABLE_CLUB + setevent EVENT_001 applymovement $0, MovementData_0x74efe jump SailorScript_0x74dc4 diff --git a/maps/VioletGym.asm b/maps/VioletGym.asm index aaab66e41..932c3b5c8 100644 --- a/maps/VioletGym.asm +++ b/maps/VioletGym.asm @@ -27,25 +27,25 @@ FalknerScript_0x683c2: scall VioletGymTriggerRockets .FightDone checkevent EVENT_GOT_TM31_MUD_SLAP - iftrue UnknownScript_0x68412 + iftrue .SpeechAfterTM setevent EVENT_BEAT_BIRD_KEEPER_ROD setevent EVENT_BEAT_BIRD_KEEPER_ABE domaptrigger GROUP_ELMS_LAB, MAP_ELMS_LAB, $2 - specialphonecall $3 + specialphonecall ELMCALL_ASSISTANT writetext UnknownText_0x685c8 keeptextopen verbosegiveitem TM_MUD_SLAP, 1 - iffalse UnknownScript_0x68416 + iffalse .NoRoomForMudSlap setevent EVENT_GOT_TM31_MUD_SLAP writetext UnknownText_0x68648 closetext loadmovesprites end -UnknownScript_0x68412: +.SpeechAfterTM: writetext UnknownText_0x68735 closetext -UnknownScript_0x68416: +.NoRoomForMudSlap: loadmovesprites end diff --git a/maps/WarehouseEntrance.asm b/maps/WarehouseEntrance.asm index 0d50aa8e3..4ee49c1a7 100644 --- a/maps/WarehouseEntrance.asm +++ b/maps/WarehouseEntrance.asm @@ -265,20 +265,20 @@ UnknownScript_0x7c173: jump UnknownScript_0x7c1c1 UnknownScript_0x7c1a9: - setevent EVENT_CHRIS1_IN_CABLE_CLUB - clearevent EVENT_CHRIS2_IN_CABLE_CLUB + setevent EVENT_000 + clearevent EVENT_001 clearevent EVENT_002 jump UnknownScript_0x7c1cd UnknownScript_0x7c1b5: - clearevent EVENT_CHRIS1_IN_CABLE_CLUB - setevent EVENT_CHRIS2_IN_CABLE_CLUB + clearevent EVENT_000 + setevent EVENT_001 clearevent EVENT_002 jump UnknownScript_0x7c1cd UnknownScript_0x7c1c1: - clearevent EVENT_CHRIS1_IN_CABLE_CLUB - clearevent EVENT_CHRIS2_IN_CABLE_CLUB + clearevent EVENT_000 + clearevent EVENT_001 setevent EVENT_002 jump UnknownScript_0x7c1cd @@ -296,9 +296,9 @@ UnknownScript_0x7c1cd: loadfont writetext UnknownText_0x7c6d8 closetext - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iftrue UnknownScript_0x7c2bb - checkevent EVENT_CHRIS2_IN_CABLE_CLUB + checkevent EVENT_001 iftrue UnknownScript_0x7c2c4 jump UnknownScript_0x7c2cd @@ -348,20 +348,20 @@ UnknownScript_0x7c220: jump UnknownScript_0x7c26e UnknownScript_0x7c256: - setevent EVENT_CHRIS1_IN_CABLE_CLUB - clearevent EVENT_CHRIS2_IN_CABLE_CLUB + setevent EVENT_000 + clearevent EVENT_001 clearevent EVENT_002 jump UnknownScript_0x7c27a UnknownScript_0x7c262: - clearevent EVENT_CHRIS1_IN_CABLE_CLUB - setevent EVENT_CHRIS2_IN_CABLE_CLUB + clearevent EVENT_000 + setevent EVENT_001 clearevent EVENT_002 jump UnknownScript_0x7c27a UnknownScript_0x7c26e: - clearevent EVENT_CHRIS1_IN_CABLE_CLUB - clearevent EVENT_CHRIS2_IN_CABLE_CLUB + clearevent EVENT_000 + clearevent EVENT_001 setevent EVENT_002 jump UnknownScript_0x7c27a @@ -379,9 +379,9 @@ UnknownScript_0x7c27a: loadfont writetext UnknownText_0x7c82a closetext - checkevent EVENT_CHRIS1_IN_CABLE_CLUB + checkevent EVENT_000 iftrue UnknownScript_0x7c2bb - checkevent EVENT_CHRIS2_IN_CABLE_CLUB + checkevent EVENT_001 iftrue UnknownScript_0x7c2c4 jump UnknownScript_0x7c2cd diff --git a/text/common_4.asm b/text/common_4.asm index 0278a20b9..09bfff312 100644 --- a/text/common_4.asm +++ b/text/common_4.asm @@ -542,7 +542,7 @@ UnknownText_0x1c4c08: ; 0x1c4c08 text_from_ram StringBuffer2 text "(S)" line "will be ¥@" - deciram $ffc3, $36 + deciram hMoneyTemp, $36 text "." done ; 0x1c4c28 @@ -574,7 +574,7 @@ UnknownText_0x1c4cae: ; 0x1c4cae text_from_ram StringBuffer2 text "(S)" line "will be ¥@" - deciram $ffc3, $36 + deciram hMoneyTemp, $36 text "." done ; 0x1c4cce @@ -619,7 +619,7 @@ UnknownText_0x1c4db0: ; 0x1c4db0 text_from_ram StringBuffer2 text " costs" line "¥@" - deciram $ffc3, $36 + deciram hMoneyTemp, $36 text ". Want it?" done ; 0x1c4dcd @@ -671,7 +671,7 @@ UnknownText_0x1c4e89: ; 0x1c4e89 text_from_ram StringBuffer2 text "(S)" line "will cost ¥@" - deciram $ffc3, $36 + deciram hMoneyTemp, $36 text "." done ; 0x1c4eab @@ -713,7 +713,7 @@ UnknownText_0x1c4f33: ; 0x1c4f33 UnknownText_0x1c4f3e: ; 0x1c4f3e text "I can pay you" line "¥@" - deciram $ffc3, $36 + deciram hMoneyTemp, $36 text "." para "Is that OK?" @@ -763,7 +763,7 @@ UnknownText_0x1c500d: ; 0x1c500d UnknownText_0x1c502e: ; 0x1c502e text "Got ¥@" - deciram $ffc3, $36 + deciram hMoneyTemp, $36 text " for" line "@" text_from_ram StringBuffer2 diff --git a/wram.asm b/wram.asm index b4349d638..e768df504 100644 --- a/wram.asm +++ b/wram.asm @@ -1381,6 +1381,7 @@ EngineBuffer1:: ; d03e ds 1 wd03f:: CurFruit:: ; d03f +MartPointerBank:: ds 1 wd040:: @@ -2346,7 +2347,8 @@ FruitTreeFlags:: ; dc27 ds 5 wdc2d:: ds 4 -wdc31:: ds 4 +wSpecialPhoneCallID:: ds 2 +wdc33:: ds 2 wdc35:: ds 4 wdc39:: ds 1 wdc3a:: ds 1