ref: 36d588a83c249e2df7a3177eb7aa22e2b09658e0
parent: 13e496cc90a3027b792a5330b404c3a8555e82a5
parent: 83d775e21a0ca6f126089715a63654c2bd9e7297
author: Marcus Huderle <huderlem@gmail.com>
date: Mon May 12 13:41:21 EDT 2014
Merged with yenatch
--- a/constants/move_constants.asm
+++ b/constants/move_constants.asm
@@ -1,3 +1,5 @@
+NUM_MOVES EQU $A4
+
POUND EQU $01
KARATE_CHOP EQU $02
DOUBLESLAP EQU $03
@@ -163,6 +165,7 @@
SLASH EQU $A3
SUBSTITUTE EQU $A4
STRUGGLE EQU $A5
+
; these do double duty as animation identifiers
SHOWPIC_ANIM EQU $A6 ; redraw monster pic
STATUS_AFFECTED_ANIM EQU $A7 ; effect when monster receives a status aliment
@@ -178,4 +181,4 @@
ULTRATOSS_ANIM EQU $C6 ; toss Ultra Ball or Master Ball
HIDEPIC_ANIM EQU $C8 ; monster disappears
ROCK_ANIM EQU $C9 ; throw rock
-BAIT_ANIM EQU $CA ; throw bait
\ No newline at end of file
+BAIT_ANIM EQU $CA ; throw bait
--- a/constants/move_effect_constants.asm
+++ b/constants/move_effect_constants.asm
@@ -13,7 +13,9 @@
MIRROR_MOVE_EFFECT EQU $09
ATTACK_UP1_EFFECT EQU $0A
DEFENSE_UP1_EFFECT EQU $0B
+SPEED_UP1_EFFECT EQU $0C
SPECIAL_UP1_EFFECT EQU $0D
+ACCURACY_UP1_EFFECT EQU $0E
EVASION_UP1_EFFECT EQU $0F
PAY_DAY_EFFECT EQU $10
SWIFT_EFFECT EQU $11
@@ -20,7 +22,9 @@
ATTACK_DOWN1_EFFECT EQU $12
DEFENSE_DOWN1_EFFECT EQU $13
SPEED_DOWN1_EFFECT EQU $14
+SPECIAL_DOWN1_EFFECT EQU $15
ACCURACY_DOWN1_EFFECT EQU $16
+EVASION_DOWN1_EFFECT EQU $17
CONVERSION_EFFECT EQU $18
HAZE_EFFECT EQU $19
BIDE_EFFECT EQU $1A
@@ -49,9 +53,16 @@
DEFENSE_UP2_EFFECT EQU $33
SPEED_UP2_EFFECT EQU $34
SPECIAL_UP2_EFFECT EQU $35
+ACCURACY_UP2_EFFECT EQU $36
+EVASION_UP2_EFFECT EQU $37
HEAL_EFFECT EQU $38 ; Recover, Softboiled, Rest
TRANSFORM_EFFECT EQU $39
+ATTACK_DOWN2_EFFECT EQU $3A
DEFENSE_DOWN2_EFFECT EQU $3B
+SPEED_DOWN2_EFFECT EQU $3C
+SPECIAL_DOWN2_EFFECT EQU $3D
+ACCURACY_DOWN2_EFFECT EQU $3E
+EVASION_DOWN2_EFFECT EQU $3F
LIGHT_SCREEN_EFFECT EQU $40
REFLECT_EFFECT EQU $41
POISON_EFFECT EQU $42
@@ -73,4 +84,4 @@
; fixed damage constants
SONICBOOM_DAMAGE EQU 20
-DRAGON_RAGE_DAMAGE EQU 40
\ No newline at end of file
+DRAGON_RAGE_DAMAGE EQU 40
--- a/constants/status_constants.asm
+++ b/constants/status_constants.asm
@@ -1,6 +1,6 @@
-; status ailments (masks)
-SLP EQU %00000111
-PSN EQU %00001000
-BRN EQU %00010000
-FRZ EQU %00100000
-PAR EQU %01000000
\ No newline at end of file
+; status ailments
+SLP EQU %111 ; mask
+PSN EQU 3
+BRN EQU 4
+FRZ EQU 5
+PAR EQU 6
--- a/constants/wram_constants.asm
+++ b/constants/wram_constants.asm
@@ -5,3 +5,6 @@
W_WATERRATE EQU $d8a4
W_WATERMONS EQU $d8a5
+; Overload enemy stat modifiers
+wTradeMonNick EQU $cd1e
+
--- a/macros.asm
+++ b/macros.asm
@@ -11,6 +11,18 @@
dex EQUS "db $5f, $50" ; End a Pokedex entry.
+callba: MACRO
+ ld b, BANK(\1)
+ ld hl, \1
+ call Bankswitch
+ ENDM
+
+callab: MACRO
+ ld hl, \1
+ ld b, BANK(\1)
+ call Bankswitch
+ ENDM
+
;\1 = X
;\2 = Y
FuncCoord: MACRO
--- a/main.asm
+++ b/main.asm
@@ -1,32 +1,32 @@
INCLUDE "constants.asm"
-; the rst vectors are unused
-SECTION "rst00",ROM0[0]
- db $FF
-SECTION "rst08",ROM0[8]
- db $FF
+; The rst vectors are unused.
+SECTION "rst00",ROM0[$00]
+ rst $38
+SECTION "rst08",ROM0[$08]
+ rst $38
SECTION "rst10",ROM0[$10]
- db $FF
+ rst $38
SECTION "rst18",ROM0[$18]
- db $FF
+ rst $38
SECTION "rst20",ROM0[$20]
- db $FF
+ rst $38
SECTION "rst28",ROM0[$28]
- db $FF
+ rst $38
SECTION "rst30",ROM0[$30]
- db $FF
+ rst $38
SECTION "rst38",ROM0[$38]
- db $FF
+ rst $38
; interrupts
SECTION "vblank",ROM0[$40]
- jp VBlankHandler
+ jp VBlank
SECTION "lcdc",ROM0[$48]
db $FF
SECTION "timer",ROM0[$50]
- jp TimerHandler
+ jp Timer
SECTION "serial",ROM0[$58]
- jp SerialInterruptHandler
+ jp Serial
SECTION "joypad",ROM0[$60]
reti
@@ -103,8 +103,8 @@
ret
SECTION "romheader",ROM0[$100]
-nop
-jp Start
+ nop
+ jp Start
SECTION "start",ROM0[$150]
Start:: ; 0150 (0:0150)
@@ -446,9 +446,7 @@
ld a,$ff
ld [wJoypadForbiddenButtonsMask],a
call LoadMapData ; load map data
- ld b,BANK(Func_c335)
- ld hl,Func_c335
- call Bankswitch ; initialize some variables
+ callba Func_c335 ; initialize some variables
ld hl,$d72c
bit 0,[hl]
jr z,.doNotCountSteps
@@ -465,14 +463,10 @@
and a,$18
jr z,.didNotFlyOrTeleportIn
res 3,[hl]
- ld b,BANK(Func_70510)
- ld hl,Func_70510
- call Bankswitch ; display fly/teleport in graphical effect
+ callba Func_70510 ; display fly/teleport in graphical effect
call UpdateSprites ; move sprites
.didNotFlyOrTeleportIn
- ld b,BANK(CheckForceBikeOrSurf)
- ld hl,CheckForceBikeOrSurf
- call Bankswitch ; handle currents in SF islands and forced bike riding in cycling road
+ callba CheckForceBikeOrSurf ; handle currents in SF islands and forced bike riding in cycling road
ld hl,$d72d
res 5,[hl]
call UpdateSprites ; move sprites
@@ -494,9 +488,7 @@
and a
jp nz,.moveAhead ; if the player sprite has not yet completed the walking animation
call GetJoypadStateOverworld ; get joypad state (which is possibly simulated)
- ld b, BANK(Func_1e988)
- ld hl, Func_1e988
- call Bankswitch
+ callba Func_1e988
ld a,[$da46]
and a
jp nz,WarpFound2
@@ -700,9 +692,7 @@
ld a,[$d736]
bit 7,a
jr z,.noSpinning
- ld b, BANK(Func_44fd7)
- ld hl, Func_44fd7
- call Bankswitch ; spin while moving
+ callba Func_44fd7 ; spin while moving
.noSpinning
call UpdateSprites ; move sprites
.moveAhead2
@@ -739,9 +729,7 @@
ld a,[$d790]
bit 7,a ; in the safari zone?
jr z,.notSafariZone
- ld b, BANK(Func_1e997)
- ld hl, Func_1e997
- call Bankswitch
+ callba Func_1e997
ld a,[$da46]
and a
jp nz,WarpFound2
@@ -780,9 +768,7 @@
ld a,[W_CURMAP]
cp a,OAKS_LAB
jp z,.noFaintCheck
- ld hl, AnyPokemonAliveCheck
- ld b, BANK(AnyPokemonAliveCheck)
- call Bankswitch ; check if all the player's pokemon fainted
+ callab AnyPokemonAliveCheck ; check if all the player's pokemon fainted
ld a,d
and a
jr z,.allPokemonFainted
@@ -853,9 +839,7 @@
push bc
ld hl,$d736
set 2,[hl]
- ld b, BANK(Func_c49d)
- ld hl, Func_c49d
- call Bankswitch ; check if the player sprite is standing on a "door" tile
+ callba Func_c49d ; check if the player sprite is standing on a "door" tile
pop bc
pop hl
jr c,WarpFound1 ; if it is, go to 0735
@@ -932,7 +916,7 @@
jr nz,.indoorMaps
; this is for handling "outside" maps that can't have the 0xFF destination map
ld a,[W_CURMAP]
- ld [$d365],a ; save current map as previous map
+ ld [wLastMap],a
ld a,[W_CURMAPWIDTH]
ld [$d366],a
ld a,[$ff8b] ; destination map number
@@ -952,9 +936,7 @@
jr z,.goBackOutside
; if not going back to the previous map
ld [W_CURMAP],a ; current map number
- ld b, BANK(Func_70787)
- ld hl, Func_70787
- call Bankswitch ; check if the warp was a Silph Co. teleporter
+ callba Func_70787 ; check if the warp was a Silph Co. teleporter
ld a,[$cd5b]
dec a
jr nz,.notTeleporter
@@ -971,7 +953,7 @@
res 1,[hl]
jr .done
.goBackOutside
- ld a,[$d365] ; previous map
+ ld a,[wLastMap]
ld [W_CURMAP],a
call PlayMapChangeSound
xor a
@@ -1119,9 +1101,7 @@
call GoPAL_SET
; Since the sprite set shouldn't change, this will just update VRAM slots at
; $C2XE without loading any tile patterns.
- ld b,BANK(InitMapSprites)
- ld hl,InitMapSprites
- call Bankswitch
+ callba InitMapSprites
call LoadTileBlockMap
jp OverworldLoopLessDelay
.didNotEnterConnectedMap
@@ -1189,9 +1169,7 @@
jp Bankswitch
MapEntryAfterBattle:: ; 091f (0:091f)
- ld b, BANK(Func_c35f)
- ld hl, Func_c35f
- call Bankswitch ; function that appears to disable warp testing after collisions if the player is standing on a warp
+ callba Func_c35f ; function that appears to disable warp testing after collisions if the player is standing on a warp
ld a,[$d35d]
and a
jp z,GBFadeIn2
@@ -1719,9 +1697,7 @@
call Predef ; get the tile in front of the player
push de
push bc
- ld b, BANK(Func_1a672)
- ld hl, Func_1a672
- call Bankswitch ; check if the player is trying to jump a ledge
+ callba Func_1a672 ; check if the player is trying to jump a ledge
pop bc
pop de
pop hl
@@ -2418,15 +2394,11 @@
push hl
push de
push bc
- ld b, BANK(Func_f225)
- ld hl, Func_f225
- call Bankswitch ; check if the player is pushing a boulder
+ callba Func_f225 ; check if the player is pushing a boulder
ld a,[wFlags_0xcd60]
bit 1,a ; is the player pushing a boulder?
jr z,.afterBoulderEffect
- ld b, BANK(Func_f2b5)
- ld hl, Func_f2b5
- call Bankswitch ; displays dust effect when pushing a boulder
+ callba Func_f2b5 ; displays dust effect when pushing a boulder
.afterBoulderEffect
pop bc
pop de
@@ -2477,9 +2449,7 @@
; function to load data from the map header
LoadMapHeader:: ; 107c (0:107c)
- ld b, BANK(Func_f113)
- ld hl, Func_f113
- call Bankswitch
+ callba Func_f113
ld a,[W_CURMAPTILESET]
ld [$d119],a
ld a,[W_CURMAP]
@@ -2728,9 +2698,7 @@
.finishUp
ld a,$19
call Predef ; load tileset data
- ld hl, LoadWildData
- ld b, BANK(LoadWildData)
- call Bankswitch ; load wild pokemon data
+ callab LoadWildData ; load wild pokemon data
pop hl ; restore hl from before going to the warp/sign/sprite data (this value was saved for seemingly no purpose)
ld a,[W_CURMAPHEIGHT] ; map height in 4x4 tile blocks
add a ; double it
@@ -2787,9 +2755,7 @@
ld [$d3a8],a
call LoadTextBoxTilePatterns
call LoadMapHeader
- ld b,BANK(InitMapSprites)
- ld hl,InitMapSprites
- call Bankswitch ; load tile pattern data for sprites
+ callba InitMapSprites ; load tile pattern data for sprites
call LoadTileBlockMap
call LoadTilesetTilePatternData
call LoadCurrentMapView
@@ -3031,7 +2997,7 @@
and a
pop hl
jr z, .invalidDexNumber ; dex #0 invalid
- cp $98
+ cp 151 + 1
jr c, .validDexNumber ; dex >#151 invalid
.invalidDexNumber
ld a, RHYDON ; $1
@@ -3195,9 +3161,7 @@
bit 1,b ; was the B button pressed?
jr z,.handleSwap ; if not, handle swapping the pokemon
.cancelSwap ; if the B button was pressed
- ld b,BANK(ErasePartyMenuCursors)
- ld hl,ErasePartyMenuCursors
- call Bankswitch
+ callba ErasePartyMenuCursors
xor a
ld [$cc35],a
ld [$d07d],a
@@ -3206,9 +3170,7 @@
.handleSwap
ld a,[wCurrentMenuItem]
ld [wWhichPokemon],a
- ld b, BANK(Func_13613)
- ld hl, Func_13613
- call Bankswitch
+ callba Func_13613
jr HandlePartyMenuInput
DrawPartyMenu:: ; 14d4 (0:14d4)
@@ -5281,7 +5243,7 @@
dec a
jp PlaySound
-VBlankHandler:: ; 2024 (0:2024)
+VBlank:: ; 2024 (0:2024)
push af
push bc
push de
@@ -5341,9 +5303,7 @@
.bank1F
call Func_7d177
.afterMusic
- ld b, BANK(Func_18dee)
- ld hl, Func_18dee
- call Bankswitch ; keep track of time played
+ callba Func_18dee ; keep track of time played
ld a,[$fff9]
and a
call z,ReadJoypadRegister
@@ -5468,7 +5428,7 @@
db %00000000
db %00000000
-SerialInterruptHandler:: ; 2125 (0:2125)
+Serial:: ; 2125 (0:2125)
push af
push bc
push de
@@ -5687,9 +5647,7 @@
Func_226e:: ; 226e (0:226e)
call SaveScreenTilesToBuffer1
- ld hl, Func_4c05
- ld b, BANK(Func_4c05)
- call Bankswitch
+ callab Func_4c05
call Func_227f
jp LoadScreenTilesFromBuffer1
@@ -5776,7 +5734,7 @@
ret
; timer interrupt is apparently not invoked anyway
-TimerHandler:: ; 2306 (0:2306)
+Timer:: ; 2306 (0:2306)
reti
Func_2307:: ; 2307 (0:2307)
@@ -6754,9 +6712,7 @@
DisplayTextID:: ; 2920 (0:2920)
ld a,[H_LOADEDROMBANK]
push af
- ld b,BANK(DisplayTextIDInit)
- ld hl,DisplayTextIDInit ; initialization
- call Bankswitch
+ callba DisplayTextIDInit ; initialization
ld hl,$cf11
bit 0,[hl]
res 0,[hl]
@@ -6794,9 +6750,7 @@
push hl
push de
push bc
- ld b, BANK(Func_13074)
- ld hl, Func_13074
- call Bankswitch ; update the graphics of the sprite the player is talking to (to face the right direction)
+ callba Func_13074 ; update the graphics of the sprite the player is talking to (to face the right direction)
pop bc
pop de
ld hl,W_MAPSPRITEDATA ; NPC text entries
@@ -6834,9 +6788,7 @@
jp z,FuncTX_PokemonCenterPC
cp a,$f5 ; Vending Machine
jr nz,.notVendingMachine
- ld b,BANK(VendingMachineMenu)
- ld hl,VendingMachineMenu
- call Bankswitch ; jump banks to vending machine routine
+ callba VendingMachineMenu ; jump banks to vending machine routine
jr AfterDisplayingTextID
.notVendingMachine
cp a,$f7 ; slot machine
@@ -6843,9 +6795,7 @@
jp z,FuncTX_SlotMachine
cp a,$f6 ; cable connection NPC in Pokemon Center
jr nz,.notSpecialCase
- ld hl, CableClubNPC
- ld b, BANK(CableClubNPC)
- call Bankswitch
+ callab CableClubNPC
jr AfterDisplayingTextID
.notSpecialCase
call Func_3c59 ; display the text
@@ -6960,9 +6910,7 @@
jp AfterDisplayingTextID
DisplaySafariGameOverText:: ; 2a90 (0:2a90)
- ld hl, Func_1e9ed
- ld b, BANK(Func_1e9ed)
- call Bankswitch
+ callab Func_1e9ed
jp AfterDisplayingTextID
DisplayPokemonFaintedText:: ; 2a9b (0:2a9b)
@@ -7005,12 +6953,8 @@
call PlaySound
RedisplayStartMenu:: ; 2adf (0:2adf)
- ld b,BANK(DrawStartMenu)
- ld hl,DrawStartMenu
- call Bankswitch
- ld b, BANK(Func_c52f)
- ld hl, Func_c52f
- call Bankswitch ; print Safari Zone info, if in Safari Zone
+ callba DrawStartMenu
+ callba Func_c52f ; print Safari Zone info, if in Safari Zone
call UpdateSprites ; move sprites
.loop
call HandleMenuInput
@@ -7942,9 +7886,7 @@
push hl
push de
push bc
- ld b,BANK(IsKeyItem_)
- ld hl,IsKeyItem_
- call Bankswitch
+ callba IsKeyItem_
pop bc
pop de
pop hl
@@ -8371,9 +8313,7 @@
ld [H_LOADEDROMBANK], a
ld [$2000], a
push hl
- ld b, BANK(SaveTrainerName)
- ld hl, SaveTrainerName
- call Bankswitch
+ callba SaveTrainerName
ld hl, UnnamedText_33cf
call PrintText
pop hl
@@ -8380,9 +8320,7 @@
pop af
ld [H_LOADEDROMBANK], a
ld [$2000], a
- ld b, BANK(Func_1a5e7)
- ld hl, Func_1a5e7
- call Bankswitch
+ callba Func_1a5e7
jp WaitForSoundToFinish
Func_33b7:: ; 33b7 (0:33b7)
@@ -9330,9 +9268,7 @@
Multiply:: ; 38ac (0:38ac)
push hl
push bc
- ld hl, _Multiply
- ld b, BANK(_Multiply)
- call Bankswitch
+ callab _Multiply
pop bc
pop hl
ret
@@ -9438,9 +9374,7 @@
push hl
push de
push bc
- ld b, BANK(_AddPokemonToParty)
- ld hl, _AddPokemonToParty
- call Bankswitch
+ callba _AddPokemonToParty
pop bc
pop de
pop hl
@@ -9766,9 +9700,7 @@
ld a,[$d09b]
and a ; is it a pokemon selection menu?
jr z,.getJoypadState
- ld b, BANK(Func_716ff)
- ld hl, Func_716ff ; shake mini sprite of selected pokemon
- call Bankswitch
+ callba Func_716ff ; shake mini sprite of selected pokemon
.getJoypadState
pop hl
call GetJoypadStateLowSensitivity
@@ -10391,9 +10323,7 @@
xor a
ld [W_SPRITESETID], a ; $d3a8
call DisableLCD
- ld b, BANK(InitMapSprites)
- ld hl, InitMapSprites
- call Bankswitch
+ callba InitMapSprites
call EnableLCD
pop hl
pop af
@@ -10434,9 +10364,7 @@
push hl
push de
push bc
- ld b,BANK(GenRandom_)
- ld hl,GenRandom_
- call Bankswitch
+ callba GenRandom_
ld a,[H_RAND1]
pop bc
pop de
@@ -10519,9 +10447,7 @@
xor a
jr .asm_3eec
.asm_3edd
- ld b, BANK(Func_fb50)
- ld hl, Func_fb50
- call Bankswitch
+ callba Func_fb50
ld a, [$ffdb]
and a
jr z, .asm_3eec
@@ -11031,9 +10957,7 @@
ld c, $1
call CheckForUserInterruption
jr c, .asm_4459
- ld b, BANK(Func_372ac)
- ld hl, Func_372ac
- call Bankswitch
+ callba Func_372ac
call Func_4496
jr .asm_443b
.asm_4459
@@ -11090,16 +11014,12 @@
ld a, $90
ld [$ffb0], a
ld d, 1 ; scroll out
- ld b, BANK(TitleScroll)
- ld hl, TitleScroll
- call Bankswitch ; indirect jump to TitleScroll (37258 (d:7258))
+ callba TitleScroll ; indirect jump to TitleScroll (37258 (d:7258))
ret
Func_44c1: ; 44c1 (1:44c1)
ld d, 0 ; scroll in
- ld b, BANK(TitleScroll)
- ld hl, TitleScroll
- call Bankswitch ; indirect jump to TitleScroll (37258 (d:7258))
+ callba TitleScroll ; indirect jump to TitleScroll (37258 (d:7258))
xor a
ld [$ffb0], a
ret
@@ -11296,9 +11216,7 @@
jr z,.GetMonHeader
ld a,[wWhichPokemon]
ld e,a
- ld hl, Func_39c37
- ld b, BANK(Func_39c37)
- call Bankswitch ; get pokemon ID
+ callab Func_39c37 ; get pokemon ID
.GetMonHeader
ld a,[$cf91]
ld [$d0b5],a ; input for GetMonHeader
@@ -13291,9 +13209,7 @@
.asm_559a
ld a, $1
ld [$d11b], a
- ld hl, Func_39bd5
- ld b, BANK(Func_39bd5)
- call Bankswitch
+ callab Func_39bd5
ld hl, wEnemyMons
call Func_57d6
jp .asm_565b
@@ -13350,9 +13266,7 @@
jp .asm_5665
ld a, $4
ld [$d11b], a
- ld hl, Func_39bd5
- ld b, BANK(Func_39bd5)
- call Bankswitch
+ callab Func_39bd5
call Func_57d6
jp .asm_565b
.asm_562e
@@ -13445,9 +13359,7 @@
ld [$cc26], a
ld a, $4
ld [$d11b], a
- ld hl, Func_39bd5
- ld b, BANK(Func_39bd5)
- call Bankswitch
+ callab Func_39bd5
call Func_57d6
call LoadScreenTilesFromBuffer1
jp .asm_55dc
@@ -13520,9 +13432,7 @@
dec a
ld [$d42f], a
call LoadMapData
- ld b, BANK(Func_c335)
- ld hl, Func_c335
- call Bankswitch
+ callba Func_c335
pop hl
pop af
ld [hl], a
@@ -13780,9 +13690,7 @@
ld a, $2f
call Predef
.asm_59de
- ld hl, Func_3ad0e
- ld b, Bank(Func_3ad0e)
- call Bankswitch ; Indirect jump to Func_3ad0e
+ callab Func_3ad0e
call ClearScreen
call Func_5ae6
call Func_226e
@@ -14948,7 +14856,7 @@
xor a
jr .asm_63b3
.asm_6346
- ld a, [$d365]
+ ld a, [wLastMap]
ld hl, $d732
bit 4, [hl]
jr nz, .asm_635b
@@ -14955,7 +14863,7 @@
bit 6, [hl]
res 6, [hl]
jr z, .asm_638e
- ld a, [$d719]
+ ld a, [wLastBlackoutMap]
jr .asm_6391
.asm_635b
ld hl, $d72d
@@ -15270,9 +15178,7 @@
call GoPAL_SET
call LoadHpBarAndStatusTilePatterns
call Func_675b
- ld b, BANK(Func_7176c)
- ld hl, Func_7176c
- call Bankswitch
+ callba Func_7176c
FuncCoord 0, 4 ; $c3f0
ld hl, Coord
ld b, $9
@@ -15309,9 +15215,7 @@
.asm_65ff
ld a, [wCurrentMenuItem] ; $cc26
push af
- ld b, BANK(Func_716f7)
- ld hl, Func_716f7
- call Bankswitch
+ callba Func_716f7
pop af
ld [wCurrentMenuItem], a ; $cc26
call GetJoypadStateLowSensitivity
@@ -15660,9 +15564,7 @@
ld a, [$cf91]
ld [$cd5d], a
push af
- ld b, BANK(Func_71882)
- ld hl, Func_71882
- call Bankswitch
+ callba Func_71882
pop af
ld [$d11e], a
call GetMonName
@@ -16159,9 +16061,7 @@
ld [$cf93],a
ld a,$02
ld [$d11b],a
- ld hl, Func_39bd5
- ld b, BANK(Func_39bd5)
- call Bankswitch
+ callab Func_39bd5
ld a,[wNumBagItems]
and a
jp z,.bagEmpty
@@ -16239,9 +16139,7 @@
ld [$cf93],a
ld a,$03
ld [$d11b],a
- ld hl, Func_39bd5
- ld b, BANK(Func_39bd5)
- call Bankswitch
+ callab Func_39bd5
ld hl,PokemartBuyingGreetingText
call PrintText
call SaveScreenTilesToBuffer1 ; save screen
@@ -16500,9 +16398,7 @@
ld de, $d0dc
ld bc, $4
call CopyData
- ld hl, Func_39b87
- ld b, BANK(Func_39b87)
- call Bankswitch
+ callab Func_39b87
pop hl
.asm_6f39
push hl
@@ -16629,7 +16525,7 @@
ld a, [wCurrentMenuItem]
and a
jr nz, .declinedHealing ; if the player chose No
- call Func_7078
+ call SetLastBlackoutMap
call LoadScreenTilesFromBuffer1 ; restore screen
ld hl, NeedYourPokemonText
call PrintText
@@ -16637,9 +16533,7 @@
ld [$c112], a ; make the nurse turn to face the machine
call Delay3
PREDEF HealPartyPredef
- ld b, BANK(Func_70433)
- ld hl, Func_70433
- call Bankswitch ; do the healing machine animation
+ callba Func_70433 ; do the healing machine animation
xor a
ld [wMusicHeaderPointer], a
ld a, [$c0f0]
@@ -16684,30 +16578,35 @@
TX_FAR _PokemonCenterFarewellText
db "@"
-Func_7078: ; 7078 (1:7078)
+SetLastBlackoutMap:
+; Set the map to return to when
+; blacking out or using Teleport or Dig.
+; Safari rest houses don't count.
+
push hl
ld hl, SafariZoneRestHouses
ld a, [W_CURMAP]
ld b, a
-.asm_7080
+.loop
ld a, [hli]
- cp $ff
- jr z, .asm_708a ; 0x7083 $5
+ cp -1
+ jr z, .notresthouse
cp b
- jr nz, .asm_7080 ; 0x7086 $f8
- jr .asm_7090 ; 0x7088 $6
-.asm_708a
- ld a, [$d365]
- ld [$d719], a
-.asm_7090
+ jr nz, .loop
+ jr .done
+
+.notresthouse
+ ld a, [wLastMap]
+ ld [wLastBlackoutMap], a
+.done
pop hl
ret
-SafariZoneRestHouses: ; 7092 (1:7092)
+SafariZoneRestHouses:
db SAFARI_ZONE_REST_HOUSE_2
db SAFARI_ZONE_REST_HOUSE_3
db SAFARI_ZONE_REST_HOUSE_4
- db $ff ; terminator
+ db -1
; function that performs initialization for DisplayTextID
DisplayTextIDInit: ; 7096 (1:7096)
@@ -16944,9 +16843,7 @@
ld a, [$cc26]
and a
jr nz, .asm_728f ; 0x723e $4f
- ld hl, SaveSAVtoSRAM
- ld b, BANK(SaveSAVtoSRAM)
- call Bankswitch
+ callab SaveSAVtoSRAM
call WaitForSoundToFinish
ld a, (SFX_02_5d - SFX_Headers_02) / 3
call PlaySoundWaitForCurrent
@@ -17866,9 +17763,7 @@
call Predef ; indirect jump to Func_3cd60 (3cd60 (f:4d60))
ld a, $49
call Predef ; indirect jump to Func_3cdec (3cdec (f:4dec))
- ld hl, ReadPlayerMonCurHPAndStatus
- ld b, BANK(ReadPlayerMonCurHPAndStatus)
- call Bankswitch
+ callab ReadPlayerMonCurHPAndStatus
ld hl, SuckedHealthText ; $78dc
ld a, [H_WHOSETURN] ; $fff3
and a
@@ -19107,9 +19002,7 @@
push hl
push de
push bc
- ld b, BANK(Func_1a609)
- ld hl, Func_1a609
- call Bankswitch
+ callba Func_1a609
jr c, .asm_c4c8
ld a, [W_CURMAPTILESET] ; $d367
add a
@@ -24433,9 +24326,7 @@
call LoadScreenTilesFromBuffer1 ;restore screenBuffer from Backup
ld hl,ItemUseText00
call PrintText
- ld hl, Func_3d83a
- ld b, BANK(Func_3d83a)
- call Bankswitch
+ callab Func_3d83a
ld b,$10
jp z,.next12
ld a,[W_BATTLETYPE]
@@ -24483,7 +24374,7 @@
ld a,[W_ENEMYMONSTATUS] ;status ailments
and a
jr z,.noAilments
- and a,(FRZ + SLP) ;is frozen and/or asleep?
+ and a, 1 << FRZ | SLP ;is frozen and/or asleep?
ld c,12
jr z,.notFrozenOrAsleep
ld c,25
@@ -24592,7 +24483,7 @@
ld a,[W_ENEMYMONSTATUS] ;status ailments
and a
jr z,.next13
- and a,(FRZ + SLP)
+ and a, 1 << FRZ | SLP
ld b,5
jr z,.next14
ld b,10
@@ -24679,9 +24570,7 @@
ld [$cf91],a
ld a,[$cff3]
ld [$d127],a
- ld hl, Func_3eb01
- ld b, BANK(Func_3eb01)
- call Bankswitch
+ callab Func_3eb01
pop af
ld [$cf91],a
pop hl
@@ -24957,9 +24846,7 @@
ld a,(SFX_02_3e - SFX_Headers_02) / 3
call PlaySoundWaitForCurrent ; play sound
call WaitForSoundToFinish ; wait for sound to end
- ld hl, Func_3ad0e
- ld b, BANK(Func_3ad0e)
- call Bankswitch ; try to evolve pokemon
+ callab Func_3ad0e ; try to evolve pokemon
ld a,[$d121]
and a
jr z,.noEffect
@@ -25528,9 +25415,7 @@
push hl
push de
ld d,a
- ld hl, CalcExperience
- ld b, BANK(CalcExperience)
- call Bankswitch ; calculate experience for next level and store it at $ff96
+ callab CalcExperience ; calculate experience for next level and store it at $ff96
pop de
pop hl
ld bc,-19
@@ -25589,9 +25474,7 @@
ld [$cc49],a ; load from player's party
call LoadMonData
ld d,$01
- ld hl, PrintStatsBox
- ld b, BANK(PrintStatsBox)
- call Bankswitch ; display new stats text box
+ callab PrintStatsBox ; display new stats text box
call WaitForTextScrollButtonPress ; wait for button press
xor a
ld [$cc49],a
@@ -25599,9 +25482,7 @@
call Predef ; learn level up move, if any
xor a
ld [$ccd4],a
- ld hl, Func_3ad0e
- ld b, BANK(Func_3ad0e)
- call Bankswitch ; evolve pokemon, if appropriate
+ callab Func_3ad0e ; evolve pokemon, if appropriate
ld a,$01
ld [$cfcb],a
pop af
@@ -25895,9 +25776,7 @@
call Delay3
xor a
ld [H_WHOSETURN],a ; set turn to player's turn
- ld b, BANK(Func_3f428)
- ld hl, Func_3f428
- call Bankswitch ; do stat increase move
+ callba Func_3f428 ; do stat increase move
pop hl
pop af
ld [hld],a ; restore [W_PLAYERMOVEEFFECT]
@@ -25977,9 +25856,7 @@
and a,$80
jr nz,.skipMusic
call WaitForSoundToFinish ; wait for sound to end
- ld b, BANK(Music_PokeFluteInBattle)
- ld hl, Music_PokeFluteInBattle
- call Bankswitch ; play in-battle pokeflute music
+ callba Music_PokeFluteInBattle ; play in-battle pokeflute music
.musicWaitLoop ; wait for music to finish playing
ld a,[$c02c]
and a ; music off?
@@ -26133,9 +26010,7 @@
push af
push hl
ld [hl], 0
- ld b, BANK(Func_707b6)
- ld hl, Func_707b6
- call Bankswitch
+ callba Func_707b6
pop hl
pop af
ld [hl], a
@@ -26176,9 +26051,7 @@
and a
jp nz,ItemUseNotTime
call ItemUseReloadOverworldData
- ld b,BANK(HiddenItemNear)
- ld hl,HiddenItemNear
- call Bankswitch ; check for hidden items
+ callba HiddenItemNear ; check for hidden items
ld hl,ItemfinderFoundNothingText
jr nc,.printText ; if no hidden items
ld c,4
@@ -26234,9 +26107,7 @@
call PrintText
xor a
ld [$cc2e],a
- ld hl, MoveSelectionMenu
- ld b, BANK(MoveSelectionMenu)
- call Bankswitch ; move selection menu
+ callab MoveSelectionMenu ; move selection menu
ld a,0
ld [$cc2e],a
jr nz,.chooseMon
@@ -26493,9 +26364,7 @@
call PrintText
jr .chooseMon
.checkIfAlreadyLearnedMove
- ld hl, Func_2fe18
- ld b, BANK(Func_2fe18)
- call Bankswitch ; check if the pokemon already knows the move
+ callab Func_2fe18 ; check if the pokemon already knows the move
jr c,.chooseMon
ld a,$1b
call Predef ; teach move
@@ -27059,9 +26928,7 @@
push de
ld a, [W_CURENEMYLVL] ; $d127
ld d, a
- ld hl, CalcExperience
- ld b, BANK(CalcExperience)
- call Bankswitch
+ callab CalcExperience
pop de
ld a, [H_NUMTOPRINT] ; $ff96 (aliases: H_MULTIPLICAND)
ld [de], a
@@ -27631,9 +27498,7 @@
ld de, CutTreeBlockSwaps ; $7100
call Func_f09f
call Func_eedc
- ld b, BANK(Func_79e96)
- ld hl, Func_79e96
- call Bankswitch
+ callba Func_79e96
ld a, $1
ld [$cfcb], a
ld a, (SFX_02_56 - SFX_Headers_02) / 3
@@ -28129,9 +27994,7 @@
ld a, [$d730]
bit 0, a
ret nz
- ld hl, Func_79f54
- ld b, BANK(Func_79f54)
- call Bankswitch
+ callab Func_79f54
call DiscardButtonPresses
ld [wJoypadForbiddenButtonsMask], a
call Func_f2dd
@@ -28344,9 +28207,7 @@
push de
ld a, [W_CURENEMYLVL]
ld d, a
- ld hl, CalcExperience
- ld b, BANK(CalcExperience)
- call Bankswitch
+ callab CalcExperience
pop de
inc de
ld a, [H_MULTIPLICAND] ; write experience
@@ -28640,9 +28501,7 @@
add $2
ld [$cc49], a
call LoadMonData
- ld b, BANK(Func_58f43)
- ld hl, Func_58f43
- call Bankswitch
+ callba Func_58f43
ld a, d
ld [W_CURENEMYLVL], a ; $d127
pop hl
@@ -29662,9 +29521,7 @@
inc a
ld [H_AUTOBGTRANSFERENABLED], a
call LoadFontTilePatterns
- ld b, BANK(DisplayTownMap)
- ld hl, DisplayTownMap
- call Bankswitch
+ callba DisplayTownMap
ld hl, $d730
res 6, [hl]
ld de, TextScriptEnd
@@ -30113,9 +29970,7 @@
ld de, $d0dc
ld bc, $0004
call CopyData
- ld hl, Func_39b87
- ld b, BANK(Func_39b87)
- call Bankswitch
+ callab Func_39b87
FuncCoord 9,2
ld hl, Coord
ld bc, $050a
@@ -30167,9 +30022,7 @@
ld a, b
ld [hl], a
push hl
- ld hl, GetMaxPP
- ld b, BANK(GetMaxPP)
- call Bankswitch
+ callab GetMaxPP
pop hl
pop af
ld [hl], a
@@ -30264,9 +30117,7 @@
jr z, .asm_12ca7 ; 0x12c8b $1a ; If 100
inc a
ld d, a
- ld hl, CalcExperience
- ld b, BANK(CalcExperience)
- call Bankswitch
+ callab CalcExperience
ld hl, $cfa8
ld a, [$ff98]
sub [hl]
@@ -30329,9 +30180,7 @@
ld [H_AUTOBGTRANSFERENABLED],a
call ClearScreen
call UpdateSprites ; move sprites
- ld b, BANK(Func_71791)
- ld hl, Func_71791
- call Bankswitch ; load pokemon icon graphics
+ callba Func_71791 ; load pokemon icon graphics
RedrawPartyMenu_: ; 12ce3 (4:6ce3)
ld a,[$D07D]
@@ -30338,9 +30187,7 @@
cp a,$04
jp z,.printMessage
call ErasePartyMenuCursors
- ld b, BANK(Func_71fb6)
- ld hl, Func_71fb6
- call Bankswitch ; loads some data to $cf2e
+ callba Func_71fb6 ; loads some data to $cf2e
FuncCoord 3,0
ld hl,Coord
ld de,W_PARTYMON1
@@ -30361,9 +30208,7 @@
call GetPartyMonName
pop hl
call PlaceString ; print the pokemon's name
- ld b, BANK(Func_71868)
- ld hl, Func_71868
- call Bankswitch ; place the appropriate pokemon icon
+ callba Func_71868 ; place the appropriate pokemon icon
ld a,[$FF8C] ; loop counter
ld [wWhichPokemon],a
inc a
@@ -30839,9 +30684,7 @@
.surf
bit 4,a ; does the player have the Soul Badge?
jp z,.newBadgeRequired
- ld b, BANK(Func_cdc0)
- ld hl, Func_cdc0
- call Bankswitch
+ callba Func_cdc0
ld hl,$d728
bit 1,[hl]
res 1,[hl]
@@ -31398,9 +31241,7 @@
ld [H_AUTOBGTRANSFERENABLED],a
call ClearScreen
call UpdateSprites
- ld hl,DisplayOptionMenu
- ld b,BANK(DisplayOptionMenu)
- call Bankswitch
+ callab DisplayOptionMenu
call LoadScreenTilesFromBuffer2 ; restore saved screen
call LoadTextBoxTilePatterns
call UpdateSprites
@@ -31657,9 +31498,7 @@
ld a, [W_ENEMYMONSTATUS] ; $cfe9
ld [hl], a
call ClearScreen
- ld hl, Func_372d6
- ld b, BANK(Func_372d6)
- call Bankswitch
+ callab Func_372d6
ld a, [$cf0b]
cp $1
ld de, YouWinText ; $7853
@@ -31746,9 +31585,7 @@
ld a, [$d736]
and a
ret nz
- ld hl, Func_c49d
- ld b, BANK(Func_c49d)
- call Bankswitch
+ callab Func_c49d
jr nc, .asm_13888
.asm_13884
ld a, $1
@@ -31755,9 +31592,7 @@
and a
ret
.asm_13888
- ld hl, Func_128d8
- ld b, BANK(Func_128d8)
- call Bankswitch
+ callab Func_128d8
jr z, .asm_13884
ld a, [$d0db]
and a
@@ -31865,12 +31700,12 @@
ld d, a
ld a, [W_DAMAGE] ; $d0d7
ld b, a
- ld a, [$d0d8]
+ ld a, [W_DAMAGE + 1]
ld c, a
srl b
rr c
ld a, d
- cp $a5
+ cp STRUGGLE
jr z, .asm_13953
srl b
rr c
@@ -33232,16 +33067,39 @@
EmotionBubbles: ; 17cbd (5:7cbd)
INCBIN "gfx/emotion_bubbles.w16.2bpp"
-Func_17d7d: ; 17d7d (5:7d7d)
- ld a, [wPlayerMonAccuracyMod] ; $cd1e
- cp $86
- jr z, .asm_17d8d
- cp $92
+EvolveTradeMon: ; 17d7d (5:7d7d)
+; Verify the TradeMon's species name before
+; attempting to initiate a trade evolution.
+
+; The names of the trade evolutions in Blue (JP)
+; are checked. In that version, TradeMons that
+; can evolve are Graveler and Haunter.
+
+; In localization, this check was translated
+; before monster names were finalized.
+; Then, Haunter's name was "Spectre".
+; Since its name no longer starts with
+; "SP", it is prevented from evolving.
+
+; This may have been why Red/Green's trades
+; were used instead, where none can evolve.
+
+; This was fixed in Yellow.
+
+ ld a, [wTradeMonNick]
+
+ ; GRAVELER
+ cp "G"
+ jr z, .ok
+
+ ; "SPECTRE" (HAUNTER)
+ cp "S"
ret nz
- ld a, [wPlayerMonEvasionMod] ; $cd1f
- cp $8f
+ ld a, [wTradeMonNick + 1]
+ cp "P"
ret nz
-.asm_17d8d
+
+.ok
ld a, [W_NUMINPARTY] ; $d163
dec a
ld [wWhichPokemon], a ; $cf92
@@ -33249,9 +33107,7 @@
ld [$ccd4], a
ld a, $32
ld [W_ISLINKBATTLE], a ; $d12b
- ld hl, Func_3ad0e
- ld b, BANK(Func_3ad0e)
- call Bankswitch
+ callab Func_3ad0e
xor a
ld [W_ISLINKBATTLE], a ; $d12b
jp Func_2307
@@ -33346,9 +33202,7 @@
call LoadScreenTilesFromBuffer2 ;XXX: restore saved screen
call Delay3
PCMainMenu: ; 17e48 (5:7e48)
- ld b, BANK(Func_213c8)
- ld hl, Func_213c8
- call Bankswitch
+ callba Func_213c8
ld hl, wFlags_0xcd60
set 5, [hl]
call HandleMenuInput
@@ -33394,25 +33248,19 @@
call WaitForSoundToFinish ;XXX: wait for sound to be done
ld hl, UnnamedText_17f32 ;accessed players pc
call PrintText
- ld b, BANK(Func_78e6)
- ld hl, Func_78e6
- call Bankswitch
+ callba Func_78e6
jr ReloadMainMenu
OaksPC: ; 17ec0 (5:7ec0)
ld a, (SFX_02_47 - SFX_Headers_02) / 3
call PlaySound ;XXX: play sound or stop music
call WaitForSoundToFinish ;XXX: wait for sound to be done
- ld b, BANK(Func_1e915)
- ld hl, Func_1e915
- call Bankswitch
+ callba Func_1e915
jr ReloadMainMenu
PKMNLeague: ; 17ed2 (5:7ed2)
ld a, (SFX_02_47 - SFX_Headers_02) / 3
call PlaySound ;XXX: play sound or stop music
call WaitForSoundToFinish ;XXX: wait for sound to be done
- ld b, BANK(Func_7657e)
- ld hl, Func_7657e
- call Bankswitch
+ callba Func_7657e
jr ReloadMainMenu
BillsPC: ; 17ee4 (5:7ee4)
ld a, (SFX_02_47 - SFX_Headers_02) / 3
@@ -33427,9 +33275,7 @@
ld hl, UnnamedText_17f28 ;accessed bill's pc
.printText
call PrintText
- ld b, BANK(BillsPC_)
- ld hl, BillsPC_
- call Bankswitch
+ callba BillsPC_
ReloadMainMenu: ; 17f06 (5:7f06)
xor a
ld [$CC3C], a
@@ -34998,9 +34844,7 @@
ld a, $ff
ld [$c0ee], a
call PlaySound
- ld b, BANK(Music_RivalAlternateStart)
- ld hl, Music_RivalAlternateStart
- call Bankswitch
+ callba Music_RivalAlternateStart
ld a, $1
ld [$ff8c], a
call SetSpriteMovementBytesToFF
@@ -35125,9 +34969,7 @@
ld [$cc3c], a
ld hl, ReceivedTM28Text
call PrintText
- ld b, BANK(Func_74872)
- ld hl, Func_74872
- call Bankswitch
+ callba Func_74872
.Done
jp TextScriptEnd
@@ -37633,9 +37475,7 @@
ld a, [wCurrentMenuItem] ; $cc26
and a
jp z, InitGame
- ld b, BANK(Func_73b6a)
- ld hl, Func_73b6a
- call Bankswitch
+ callba Func_73b6a
jp InitGame
UnnamedText_1c9c1: ; 1c9c1 (7:49c1)
@@ -38267,9 +38107,7 @@
ld a, $10
ld [$ff8c], a
call DisplayTextID
- ld b, BANK(Music_RivalAlternateStart)
- ld hl, Music_RivalAlternateStart
- call Bankswitch
+ callba Music_RivalAlternateStart
ld a, $1
ld [$ff8c], a
ld de, .RivalExitMovement
@@ -38335,9 +38173,7 @@
ld a, $ff
ld [$c0ee], a
call PlaySound
- ld b, BANK(Music_RivalAlternateStart)
- ld hl, Music_RivalAlternateStart
- call Bankswitch
+ callba Music_RivalAlternateStart
ld a, $15
ld [$ff8c], a
call DisplayTextID
@@ -38445,9 +38281,7 @@
ld a, $ff
ld [$c0ee], a
call PlaySound
- ld b, BANK(Music_RivalAlternateStart)
- ld hl, Music_RivalAlternateStart
- call Bankswitch
+ callba Music_RivalAlternateStart
ld a, $1
ld [$ff8c], a
ld de, $cc97
@@ -39569,9 +39403,7 @@
jr nc, .BagFull
ld a, BIKE_VOUCHER
ldh [$db], a
- ld b, BANK(RemoveItemByID)
- ld hl, RemoveItemByID
- call Bankswitch
+ callba RemoveItemByID
ld hl, $d75f
set 0, [hl]
ld hl, UnnamedText_1d824
@@ -40000,9 +39832,7 @@
jr nz, .asm_1daae ; 0x1da93 $19
ld hl, UnnamedText_1dac2
call PrintText
- ld b, BANK(Func_655c)
- ld hl, Func_655c
- call Bankswitch
+ callba Func_655c
jr c, .asm_1daae ; 0x1daa3 $9
ld hl, UnnamedText_1dac7
.asm_1daa8
@@ -40161,9 +39991,7 @@
ld c, BANK(Music_Surfing)
ld a, MUSIC_SURFING
call PlayMusic
- ld b, BANK(Func_79fc0)
- ld hl, Func_79fc0
- call Bankswitch
+ callba Func_79fc0
xor a
ld [$c102], a
ld c, $78
@@ -40565,8 +40393,8 @@
dw DiglettsCaveRoute2Object ; objects
DiglettsCaveRoute2Script: ; 1deb0 (7:5eb0)
- ld a, $d
- ld [$d365], a
+ ld a, ROUTE_2
+ ld [wLastMap], a
jp EnableAutoTextBoxDrawing
DiglettsCaveRoute2TextPointers: ; 1deb8 (7:5eb8)
@@ -40672,9 +40500,7 @@
ld [$d528], a
xor a
ld [H_CURRENTPRESSEDBUTTONS], a
- ld b, BANK(RemoveGuardDrink)
- ld hl, RemoveGuardDrink
- call Bankswitch
+ callba RemoveGuardDrink
ld a, [$ffdb]
and a
jr nz, .asm_1df82 ; 0x1df70 $10
@@ -40721,9 +40547,7 @@
ld a, [$d728]
bit 6, a
jr nz, .asm_88856 ; 0x1dfb0 $2c
- ld b, BANK(RemoveGuardDrink)
- ld hl, RemoveGuardDrink
- call Bankswitch
+ callba RemoveGuardDrink
ld a, [$ffdb]
and a
jr nz, .asm_768a2 ; 0x1dfbd $11
@@ -40818,9 +40642,7 @@
ld [$d528], a
xor a
ld [H_CURRENTPRESSEDBUTTONS], a
- ld b, BANK(RemoveGuardDrink)
- ld hl, RemoveGuardDrink
- call Bankswitch
+ callba RemoveGuardDrink
ld a, [$ffdb]
and a
jr nz, .asm_1e080 ; 0x1e06e $10
@@ -40933,9 +40755,7 @@
ld [$d528], a
xor a
ld [H_CURRENTPRESSEDBUTTONS], a
- ld b, BANK(RemoveGuardDrink)
- ld hl, RemoveGuardDrink
- call Bankswitch
+ callba RemoveGuardDrink
ld a, [$ffdb]
and a
jr nz, .asm_1e15a ; 0x1e148 $10
@@ -41038,9 +40858,7 @@
ld [$d528], a
xor a
ld [H_CURRENTPRESSEDBUTTONS], a
- ld b, BANK(RemoveGuardDrink)
- ld hl, RemoveGuardDrink
- call Bankswitch
+ callba RemoveGuardDrink
ld a, [$ffdb]
and a
jr nz, .asm_1e220 ; 0x1e20e $10
@@ -41109,8 +40927,8 @@
dw UndergroundPathEntranceRoute8Object ; objects
UndergroundPathEntranceRoute8Script: ; 1e289 (7:6289)
- ld a, $13
- ld [$d365], a
+ ld a, ROUTE_8
+ ld [wLastMap], a
jp EnableAutoTextBoxDrawing
UndergroundPathEntranceRoute8TextPointers: ; 1e291 (7:6291)
@@ -41365,8 +41183,8 @@
DiglettsCaveEntranceRoute11Script: ; 1e5ba (7:65ba)
call EnableAutoTextBoxDrawing
- ld a, $16
- ld [$d365], a
+ ld a, ROUTE_11
+ ld [wLastMap], a
ret
DiglettsCaveEntranceRoute11TextPointers: ; 1e5c3 (7:65c3)
@@ -41489,11 +41307,11 @@
call CallFunctionInTable
ld a, [$d361]
cp $4
- ld a, $22
+ ld a, ROUTE_23
jr c, .asm_1e69a ; 0x1e696 $2
- ld a, $21
+ ld a, ROUTE_22
.asm_1e69a
- ld [$d365], a
+ ld [wLastMap], a
ret
Route22GateScriptPointers: ; 1e69e (7:669e)
@@ -42687,9 +42505,7 @@
bit 2, [hl]
jr nz, .asm_27fa5
set 2, [hl]
- ld hl, Func_3fba8
- ld b, BANK(Func_3fba8)
- call Bankswitch
+ callab Func_3fba8
ld hl, UnnamedText_27fb3 ; $7fb2
jp PrintText
.asm_27fa5
@@ -42835,9 +42651,7 @@
INCBIN "pic/monback/moltresb.pic"
Func_2bea9: ; 2bea9 (a:7ea9)
- ld hl, MoveHitTest
- ld b, BANK(MoveHitTest)
- call Bankswitch
+ callab MoveHitTest
ld a, [W_MOVEMISSED] ; $d05f
and a
jr nz, .asm_2bee7
@@ -42859,9 +42673,7 @@
bit 7, [hl]
jr nz, .asm_2bee7
set 7, [hl]
- ld hl, Func_3fba8
- ld b, BANK(Func_3fba8)
- call Bankswitch
+ callab Func_3fba8
ld hl, UnnamedText_2bef2 ; $7ef2
jp PrintText
.asm_2bee7
@@ -43371,9 +43183,7 @@
bit 1, [hl]
jr nz, .asm_33f4a
set 1, [hl]
- ld hl, Func_3fba8
- ld b, BANK(Func_3fba8)
- call Bankswitch
+ callab Func_3fba8
ld hl, UnnamedText_33f52
jp PrintText
.asm_33f4a
@@ -43676,9 +43486,7 @@
ld [hl], $6a
xor a
ld [$cfcb], a
- ld hl, Func_3a948
- ld b, BANK(Func_3a948)
- call Bankswitch
+ callab Func_3a948
ld c, $96
jp DelayFrames
@@ -44868,9 +44676,7 @@
jr z, .asm_37e6a
cp $ff
jr z, .asm_37e6e
- ld b, BANK(Func_2ff09)
- ld hl, Func_2ff09
- call Bankswitch
+ callba Func_2ff09
ld a, [wTrainerSpriteOffset]
and a
ret z
@@ -50899,9 +50705,7 @@
ld [W_ENEMYMONID], a
ld b, $1
call GoPAL_SET
- ld hl, _LoadTrainerPic
- ld b, BANK(_LoadTrainerPic)
- call Bankswitch
+ callab _LoadTrainerPic
FuncCoord 19, 0 ; $c3b3
ld hl, Coord
ld c, $0
@@ -51147,9 +50951,7 @@
push hl
push bc
push de
- ld hl, AIGetTypeEffectiveness
- ld b, BANK(AIGetTypeEffectiveness)
- call Bankswitch
+ callab AIGetTypeEffectiveness
pop de
pop bc
pop hl
@@ -52898,9 +52700,7 @@
ld a,1
ld [$D11D],a
- ld hl,EnemySendOut
- ld b,BANK(EnemySendOut)
- call Bankswitch
+ callab EnemySendOut
xor a
ld [$D11D],a
@@ -53013,9 +52813,7 @@
ld a,$AF
ld [hli],a
ld [hl],b
- ld hl, Func_3f428
- ld b, BANK(Func_3f428)
- call Bankswitch
+ callab Func_3f428
pop hl
pop af
ld [hli],a
@@ -53370,9 +53168,7 @@
ld a, $ff
ld [$cfcb], a
call CleanLCD_OAM
- ld hl, Func_7bde9
- ld b, BANK(Func_7bde9)
- call Bankswitch
+ callab Func_7bde9
jp c, Func_3af2e
ld hl, UnnamedText_3af3e ; $6f3e
call PrintText
@@ -55932,7 +55728,7 @@
sbc [hl]
jp z, Func_3ba97
ld a, b
- cp $9c
+ cp REST
jr nz, .asm_3ba37
push hl
push de
@@ -55947,7 +55743,7 @@
.asm_3ba25
ld a, [hl]
and a
- ld [hl], $2
+ ld [hl], 2 ; Number of turns from Rest
ld hl, UnnamedText_3baa2 ; $7aa2
jr z, .asm_3ba31
ld hl, UnnamedText_3baa7 ; $7aa7
@@ -56240,31 +56036,29 @@
db MIMIC_EFFECT
db LEECH_SEED_EFFECT
db SPLASH_EFFECT
- db $FF
-
+ db -1
EffectsArray2: ; 3c011 (f:4011)
; moves that do damage but not through normal calculations
; e.g., Super Fang, Psywave
db SUPER_FANG_EFFECT
db SPECIAL_DAMAGE_EFFECT
- db $FF
-
+ db -1
EffectsArray3: ; 3c014 (f:4014)
; non-damaging, stat‐affecting or status‐causing moves?
; e.g., Meditate, Bide, Hypnosis
- db $01 ; unused move effect?
+ db $01
db ATTACK_UP1_EFFECT
db DEFENSE_UP1_EFFECT
- db $0C ; unused move effect?
+ db SPEED_UP1_EFFECT
db SPECIAL_UP1_EFFECT
- db $0E ; unused move effect?
+ db ACCURACY_UP1_EFFECT
db EVASION_UP1_EFFECT
db ATTACK_DOWN1_EFFECT
db DEFENSE_DOWN1_EFFECT
db SPEED_DOWN1_EFFECT
- db $15 ; unused move effect?
+ db SPECIAL_DOWN1_EFFECT
db ACCURACY_DOWN1_EFFECT
- db $17 ; unused move effect?
+ db EVASION_DOWN1_EFFECT
db BIDE_EFFECT
db SLEEP_EFFECT
db ATTACK_UP2_EFFECT
@@ -56271,17 +56065,17 @@
db DEFENSE_UP2_EFFECT
db SPEED_UP2_EFFECT
db SPECIAL_UP2_EFFECT
- db $36 ; unused move effect?
- db $37 ; unused move effect?
- db $3A ; unused move effect?
+ db ACCURACY_UP2_EFFECT
+ db EVASION_UP2_EFFECT
+ db ATTACK_DOWN2_EFFECT
db DEFENSE_DOWN2_EFFECT
- db $3C ; unused move effect?
- db $3D ; unused move effect?
- db $3E ; unused move effect?
- db $3F ; unused move effect?
- db $FF
-
+ db SPEED_DOWN2_EFFECT
+ db SPECIAL_DOWN2_EFFECT
+ db ACCURACY_DOWN2_EFFECT
+ db EVASION_DOWN2_EFFECT
+ db -1
EffectsArray4: ; 3c030 (f:4030)
+; Attacks that aren't finished after they faint the opponent.
db DRAIN_HP_EFFECT
db EXPLODE_EFFECT
db DREAM_EATER_EFFECT
@@ -56292,8 +56086,7 @@
db RECOIL_EFFECT
db TWINEEDLE_EFFECT
db RAGE_EFFECT
- db $FF
-
+ db -1
EffectsArray5: ; 3c03b (f:403b)
db DRAIN_HP_EFFECT
db EXPLODE_EFFECT
@@ -56308,13 +56101,13 @@
db FLY_EFFECT
db ATTACK_TWICE_EFFECT
db JUMP_KICK_EFFECT
- db RECOIL_EFFECT
- ; fallthru to Next EffectsArray
+ db RECOIL_EFFECT
+ ; fallthrough to Next EffectsArray
EffectsArray5B: ; 3c049 (f:4049)
; moves that prevent the player from switching moves?
db THRASH_PETAL_DANCE_EFFECT
db TRAPPING_EFFECT
- db $FF
+ db -1
Func_3c04c: ; 3c04c (f:404c)
call Func_3ec92
@@ -56487,9 +56280,7 @@
ld hl, UnnamedText_3c1a8 ; $41a8
jp PrintText
.asm_3c17a
- ld hl, Func_4277
- ld b, BANK(Func_4277)
- call Bankswitch
+ callab Func_4277
ld a, [$cffb]
add a
ld b, a
@@ -56666,9 +56457,7 @@
jr nz, .asm_3c2dd ; 0x3c2d8 $3
ld [wPlayerSelectedMove], a
.asm_3c2dd
- ld hl, Func_3a74b
- ld b, BANK(Func_3a74b)
- call Bankswitch
+ callab Func_3a74b
.noLinkBattle
ld a, [wPlayerSelectedMove]
cp QUICK_ATTACK
@@ -56716,9 +56505,7 @@
.enemyMovesFirst
ld a, $1
ld [H_WHOSETURN], a
- ld hl, TrainerAI
- ld b, BANK(TrainerAI)
- call Bankswitch
+ callab TrainerAI
jr c, .AIActionUsedEnemyFirst
call Func_3e6bc ; execute enemy move
ld a, [$d078]
@@ -56756,9 +56543,7 @@
call Func_3cd5a
ld a, $1
ld [H_WHOSETURN], a
- ld hl, TrainerAI
- ld b, BANK(TrainerAI)
- call Bankswitch
+ callab TrainerAI
jr c, .AIActionUsedPlayerFirst
call Func_3e6bc ; execute enemy move
ld a, [$d078]
@@ -56784,12 +56569,12 @@
ld de, W_ENEMYMONSTATUS ; $cfe9
.playersTurn
ld a, [de]
- and BRN | PSN
+ and (1 << BRN) | (1 << PSN)
jr z, .notBurnedOrPoisoned
push hl
ld hl, HurtByPoisonText
ld a, [de]
- and BRN
+ and 1 << BRN
jr z, .poisoned
ld hl, HurtByBurnText
.poisoned
@@ -57127,9 +56912,7 @@
.no_exp_all
xor a
ld [$cc5b], a
- ld hl, Func_5524f
- ld b, BANK(Func_5524f)
- call Bankswitch
+ callab Func_5524f
pop af
ret z
ld a, $1
@@ -57180,9 +56963,7 @@
ld hl, $cf1e
ld e, $30
call Func_3ce90
- ld hl, DrawEnemyPokeballs
- ld b, BANK(DrawEnemyPokeballs)
- call Bankswitch
+ callab DrawEnemyPokeballs
ld a, [W_ISLINKBATTLE] ; $d12b
cp $4
jr nz, .asm_3c687
@@ -57987,9 +57768,7 @@
ret
Func_3cc91: ; 3cc91 (f:4c91)
- ld hl, Func_58e59
- ld b, BANK(Func_58e59)
- call Bankswitch
+ callab Func_58e59
ld hl, W_ENEMYMONCURHP ; $cfe6
ld a, [hli]
or [hl]
@@ -58097,9 +57876,7 @@
ld hl, Coord
ld bc, $50b
call ClearScreenArea
- ld hl, Func_3a902
- ld b, BANK(Func_3a902)
- call Bankswitch
+ callab Func_3a902
FuncCoord 18, 9 ; $c466
ld hl, Coord
ld [hl], $73
@@ -58165,9 +57942,7 @@
ld hl, wTileMap
ld bc, $40c
call ClearScreenArea
- ld hl, Func_3a919
- ld b, BANK(Func_3a919)
- call Bankswitch
+ callab Func_3a919
ld de, W_ENEMYMONNAME
FuncCoord 1, 0 ; $c3a1
ld hl, Coord
@@ -58673,9 +58448,7 @@
call GBPalNormal
Func_3d1ba: ; 3d1ba (f:51ba)
- ld hl, Func_58ed1
- ld b, BANK(Func_58ed1)
- call Bankswitch
+ callab Func_58ed1
ld c, $32
call DelayFrames
call Func_3ccfa
@@ -58730,9 +58503,7 @@
ld de, $d0dc
ld bc, $4
call CopyData
- ld hl, Func_39b87
- ld b, BANK(Func_39b87)
- call Bankswitch
+ callab Func_39b87
ret
.writemoves
@@ -59136,9 +58907,7 @@
ld [wWhichPokemon], a ; $cf92
ld a, $4
ld [$cc49], a
- ld hl, GetMaxPP
- ld b, BANK(GetMaxPP)
- call Bankswitch
+ callab GetMaxPP
ld hl, wCurrentMenuItem ; $cc26
ld c, [hl]
inc [hl]
@@ -59214,7 +58983,7 @@
and $12 ; using multi-turn move or bide
ret nz
ld a, [W_ENEMYMONSTATUS]
- and SLP | FRZ ; sleeping or frozen
+ and SLP | 1 << FRZ ; sleeping or frozen
ret nz
ld a, [W_ENEMYBATTSTATUS1]
and $21 ; using fly/dig or thrash/petal dance
@@ -59238,9 +59007,7 @@
ld a, [W_ISINBATTLE]
dec a
jr z, .chooseRandomMove ; wild encounter
- ld hl, AIEnemyTrainerChooseMoves
- ld b, BANK(AIEnemyTrainerChooseMoves)
- call Bankswitch
+ callab AIEnemyTrainerChooseMoves
.chooseRandomMove
push hl
call GenRandomInBattle ; get random
@@ -59303,9 +59070,7 @@
ld a, b
.asm_3d630
ld [$cc42], a
- ld hl, Func_4c05
- ld b, BANK(Func_4c05)
- call Bankswitch
+ callab Func_4c05
.asm_3d63b
call Func_22c3
call DelayFrame
@@ -59477,9 +59242,7 @@
.next8
call ApplyAttackToEnemyPokemon
call Func_3dc5c
- ld hl, DisplayEffectiveness ; MyFunction
- ld b, BANK(DisplayEffectiveness) ; BANK(MyFunction)
- call Bankswitch
+ callab DisplayEffectiveness
ld a,1
ld [$CCF4],a
.next9
@@ -59536,7 +59299,7 @@
and a
jr nz,.Ghost
ld a,[W_PLAYERMONSTATUS] ; player’s turn
- and a,SLP | FRZ
+ and a,SLP | (1 << FRZ)
ret nz
ld hl,ScaredText
call PrintText
@@ -59601,7 +59364,7 @@
jp Func_3da37
.FrozenCheck
- bit 5,[hl] ; frozen?
+ bit FRZ,[hl] ; frozen?
jr z,.HeldInPlaceCheck ; to 5898
ld hl,FrozenText
call PrintText
@@ -59675,7 +59438,7 @@
jr c,.next3
ld hl,W_PLAYERBATTSTATUS1
ld a,[hl]
- and a,$80
+ and a,$80 ; confused
ld [hl],a
call Func_3daad
jr .next5 ; 5952
@@ -59691,7 +59454,7 @@
jp Func_3da37
.ParalysisCheck
ld hl,W_PLAYERMONSTATUS
- bit 6,[hl]
+ bit PAR,[hl]
jr z,.next7 ; 5975
call GenRandomInBattle ; random number
cp a,$3F
@@ -59762,7 +59525,7 @@
xor a
ld [hli],a
ld [hl],a
- ld a,$75
+ ld a,BIDE
ld [W_PLAYERMOVENUM],a
ld hl,asm_3d705 ; $5705
jp Func_3da37
@@ -59769,7 +59532,7 @@
.next10
bit 1,[hl]
jr z,.next13 ; 59FF
- ld a,$25
+ ld a,THRASH
ld [W_PLAYERMOVENUM],a
ld hl,ThrashingAboutText
call PrintText
@@ -59804,7 +59567,7 @@
ld a, [W_PLAYERBATTSTATUS2] ; $d063
bit 6, a
jp z, Func_3da39
- ld a, $63
+ ld a, RAGE
ld [$d11e], a
call GetMoveName
call CopyStringToCF4B
@@ -59970,7 +59733,7 @@
ld hl, UnnamedText_3db34 ; $5b34
ret nz
ld a, [$d11e]
- cp $3
+ cp DOUBLESLAP
ld hl, UnnamedText_3db34 ; $5b34
ret c
ld hl, UnnamedText_3db2d ; $5b2d
@@ -61211,9 +60974,7 @@
ld a,[H_WHOSETURN]
xor a,$01
ld [H_WHOSETURN],a
- ld hl, Func_79747
- ld b, BANK(Func_79747) ; animate the substitute breaking
- call Bankswitch ; substitute
+ callab Func_79747 ; animate the substitute breaking
; flip the turn back to the way it was
ld a,[H_WHOSETURN]
xor a,$01
@@ -61350,7 +61111,7 @@
call GenRandomInBattle ; random number
and a
jr z,.pickMoveLoop
- cp a,$a5 ; max normal move number + 1 (this is Struggle's move number)
+ cp a,NUM_MOVES + 1 ; max normal move number + 1 (this is Struggle's move number)
jr nc,.pickMoveLoop
cp a,METRONOME
jr z,.pickMoveLoop
@@ -62027,9 +61788,7 @@
.asm_3e82b
call ApplyAttackToPlayerPokemon
call Func_3dc5c
- ld hl, DisplayEffectiveness
- ld b, BANK(DisplayEffectiveness)
- call Bankswitch
+ callab DisplayEffectiveness
ld a, $1
ld [$ccf4], a
.asm_3e83e
@@ -62553,9 +62312,7 @@
jr nz, .asm_3ec4d
xor a
ld [wMenuJoypadPollCount], a ; $cc34
- ld hl, Func_372d6
- ld b, BANK(Func_372d6)
- call Bankswitch
+ callab Func_372d6
ld a, $1
ld [$cfcb], a
call ClearScreen
@@ -62563,9 +62320,7 @@
call DelayFrame
ld a, $30
call Predef ; indirect jump to Func_7096d (7096d (1c:496d))
- ld hl, Func_3ee58
- ld b, BANK(Func_3ee58)
- call Bankswitch
+ callab Func_3ee58
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a ; $ffba
ld a, $ff
@@ -62661,9 +62416,7 @@
jp Predef ; indirect jump to Func_3f0c6 (3f0c6 (f:70c6))
Func_3ed02: ; 3ed02 (f:6d02)
- ld hl, Func_39680
- ld b, BANK(Func_39680)
- call Bankswitch
+ callab Func_39680
ld hl, Func_396a7
ld b, BANK(Func_396a7)
jp Bankswitch
@@ -62984,24 +62737,24 @@
ld de, W_ENEMYBATTSTATUS1 ; $d067
ld a, [W_ENEMYMOVENUM] ; $cfcc
.asm_3eeea
- cp $78
+ cp SELFDESTRUCT
jr z, .asm_3eef1
- cp $99
+ cp EXPLOSION
ret nz
.asm_3eef1
ld a, [de]
- bit 6, a
+ bit 6, a ; fly/dig
ret nz
ld a, [hli]
- cp $8
+ cp GHOST
ret z
ld a, [hl]
- cp $8
+ cp GHOST
ret z
ld a, [W_MOVEMISSED] ; $d05f
and a
ret nz
- ld a, $5
+ ld a, MEGA_PUNCH
ld [$cc5b], a
PlayMoveAnimation: ; 3ef07 (f:6f07)
@@ -63030,9 +62783,7 @@
ld a, [$d13c]
and a
ret nz
- ld hl, Func_13870
- ld b, BANK(Func_13870)
- call Bankswitch
+ callab Func_13870
ret nz
asm_3ef3d: ; 3ef3d (f:6f3d)
ld a, [$d35d]
@@ -63041,17 +62792,13 @@
ld a, [hl]
push af
res 1, [hl]
- ld hl, Func_525af
- ld b, BANK(Func_525af)
- call Bankswitch
+ callab Func_525af
ld a, [W_ENEMYMONID]
sub $c8
jp c, Func_3ef8b
ld [W_TRAINERCLASS], a ; $d031
call Func_3566
- ld hl, ReadTrainer
- ld b, BANK(ReadTrainer)
- call Bankswitch
+ callab ReadTrainer
call Func_3ec32
call _LoadTrainerPic
xor a
@@ -63151,9 +62898,7 @@
dec a
call z, Func_3cdec
call Func_3c11e
- ld hl, Func_137aa
- ld b, BANK(Func_137aa)
- call Bankswitch
+ callab Func_137aa
pop af
ld [$d358], a
pop af
@@ -63624,7 +63369,7 @@
jr z, .burn
cp a, FREEZE_SIDE_EFFECT
jr z, .freeze
- ld a, PAR
+ ld a, 1 << PAR
ld [W_ENEMYMONSTATUS], a
call Func_3ed27 ;quarter speed of affected monster
ld a, $a9
@@ -63631,7 +63376,7 @@
call Func_3fbb9 ;animation
jp Func_3fb6e ;print paralysis text
.burn
- ld a, BRN
+ ld a, 1 << BRN
ld [W_ENEMYMONSTATUS], a
call Func_3ed64
ld a, $a9
@@ -63640,7 +63385,7 @@
jp PrintText
.freeze
call Func_3f9cf ;resets bit 5 of the D063/D068 flags
- ld a, FRZ
+ ld a, 1 << FRZ
ld [W_ENEMYMONSTATUS], a
ld a, $a9
call Func_3fbb9 ;animation
@@ -63675,18 +63420,18 @@
jr z, .burn
cp a, FREEZE_SIDE_EFFECT
jr z, .freeze
- ld a, PAR
+ ld a, 1 << PAR
ld [W_PLAYERMONSTATUS], a
call Func_3ed27
jp Func_3fb6e
.burn
- ld a, BRN
+ ld a, 1 << BRN
ld [W_PLAYERMONSTATUS], a
call Func_3ed64
ld hl, UnnamedText_3f3d8
jp PrintText
.freeze
- ld a, FRZ
+ ld a, 1 << FRZ
ld [W_PLAYERMONSTATUS], a
ld hl, UnnamedText_3f3dd
jp PrintText
@@ -63700,7 +63445,7 @@
db "@"
CheckDefrost: ; 3f3e2 (f:73e2)
- and a, FRZ ;are they frozen?
+ and a, 1 << FRZ ;are they frozen?
ret z ;return if so
;not frozen
ld a, [$fff3] ;whose turn?
@@ -63722,7 +63467,7 @@
jr .common
.opponent
ld a, [W_ENEMYMOVETYPE] ;same as above with addresses swapped
- sub a, $14
+ sub a, FIRE
ret nz
ld [W_PLAYERMONSTATUS], a
ld hl, $d16f
@@ -63831,9 +63576,9 @@
ld a, [$ff97]
sbc $3
jp c, Func_3f4c3
- ld a, $3
+ ld a, 999 / $100
ld [$ff97], a
- ld a, $e7
+ ld a, 999 % $100
ld [$ff98], a
Func_3f4c3: ; 3f4c3 (f:74c3)
@@ -63857,7 +63602,7 @@
ld bc, $ccf3
.asm_3f4e6
ld a, [de]
- cp $6b
+ cp MINIMIZE
jr nz, .asm_3f4f9
bit 4, [hl]
push af
@@ -63870,7 +63615,7 @@
.asm_3f4f9
call Func_3fba8
ld a, [de]
- cp $6b
+ cp MINIMIZE
jr nz, .asm_3f50e
pop bc
ld a, $1
@@ -63906,7 +63651,7 @@
jr z, .asm_3f53b
ld a, [W_ENEMYMOVEEFFECT] ; $cfcd
.asm_3f53b
- cp $12
+ cp ATTACK_DOWN1_EFFECT
ret nc
ld hl, UnnamedText_3f547 ; $7547
ret
@@ -64270,7 +64015,7 @@
ld c, $32
call DelayFrames
ld a, [W_ENEMYMOVENUM] ; $cfcc
- cp $64
+ cp TELEPORT
jp nz, Func_3fb5e
jp PrintButItFailedText_
.asm_3f7c1
@@ -64286,7 +64031,7 @@
call DelayFrames
ld hl, UnnamedText_3fb69 ; $7b69
ld a, [W_ENEMYMOVENUM] ; $cfcc
- cp $64
+ cp TELEPORT
jp nz, PrintText
jp Func_3fb4e
.asm_3f7e4
@@ -64296,10 +64041,10 @@
call DelayFrames
pop af
ld hl, UnnamedText_3f802 ; $7802
- cp $64
+ cp TELEPORT
jr z, .asm_3f7ff
ld hl, UnnamedText_3f807 ; $7807
- cp $2e
+ cp ROAR
jr z, .asm_3f7ff
ld hl, UnnamedText_3f80c ; $780c
.asm_3f7ff
@@ -64338,9 +64083,9 @@
ld hl, W_ENEMYMOVEEFFECT ; $cfcd
.asm_3f838
ld a, [hl]
- cp $4d
+ cp TWINEEDLE_EFFECT
jr z, .asm_3f856
- cp $2c
+ cp ATTACK_TWICE_EFFECT
ld a, $2
jr z, .asm_3f853
call GenRandomInBattle
@@ -64428,22 +64173,22 @@
TX_FAR _UnnamedText_3f8c8
db $08 ; asm
ld a, [wWhichTrade] ; $cd3d
- cp $d
+ cp RAZOR_WIND
ld hl, UnnamedText_3f8f9 ; $78f9
jr z, .asm_3f8f8
- cp $4c
+ cp SOLARBEAM
ld hl, UnnamedText_3f8fe ; $78fe
jr z, .asm_3f8f8
- cp $82
+ cp SKULL_BASH
ld hl, UnnamedText_3f903 ; $7903
jr z, .asm_3f8f8
- cp $8f
+ cp SKY_ATTACK
ld hl, UnnamedText_3f908 ; $7908
jr z, .asm_3f8f8
- cp $13
+ cp FLY
ld hl, UnnamedText_3f90d ; $790d
jr z, .asm_3f8f8
- cp $5b
+ cp DIG
ld hl, UnnamedText_3f912 ; $7912
.asm_3f8f8
ret
@@ -64546,7 +64291,7 @@
inc a
ld [bc], a
pop af
- cp $4c
+ cp CONFUSION_SIDE_EFFECT
call nz, Func_3fb89
ld hl, UnnamedText_3f9a1 ; $79a1
jp PrintText
@@ -64556,7 +64301,7 @@
db "@"
Func_3f9a6: ; 3f9a6 (f:79a6)
- cp $4c
+ cp CONFUSION_SIDE_EFFECT
ret z
ld c, $32
call DelayFrames
@@ -64925,9 +64670,7 @@
.setUpGraphics
ld b,$08
call GoPAL_SET
- ld hl,LoadPokedexTilePatterns
- ld b,BANK(LoadPokedexTilePatterns)
- call Bankswitch
+ callab LoadPokedexTilePatterns
.doPokemonListMenu
ld hl,wTopMenuItemY
ld a,3
@@ -65316,9 +65059,7 @@
call GBPalWhiteOutWithDelay3
call ClearScreen
call UpdateSprites
- ld hl, LoadPokedexTilePatterns
- ld b, BANK(LoadPokedexTilePatterns)
- call Bankswitch ; load pokedex tiles
+ callab LoadPokedexTilePatterns ; load pokedex tiles
; function to display pokedex data from inside the pokedex
ShowPokedexDataInternal: ; 402e2 (10:42e2)
@@ -67587,9 +67328,7 @@
ret
Func_41505: ; 41505 (10:5505)
- ld b, BANK(Func_71882)
- ld hl, Func_71882
- call Bankswitch
+ callba Func_71882
call Func_41558
Func_41510: ; 41510 (10:5510)
@@ -68111,9 +67850,7 @@
Func_4188a: ; 4188a (10:588a)
ld b, $c
call GoPAL_SET
- ld b, BANK(Func_4538)
- ld hl, Func_4538
- call Bankswitch
+ callba Func_4538
ld a, $e4
ld [rBGP], a ; $ff47
ld c, $b4
@@ -68130,9 +67867,7 @@
set 3, [hl]
ld c, $40
call DelayFrames
- ld b, BANK(Func_70044)
- ld hl, Func_70044
- call Bankswitch
+ callba Func_70044
push af
pop af
jr c, .asm_418d0
@@ -68482,9 +68217,7 @@
call PrintText
pop hl
call PrintText
- ld b, BANK(Func_7d13b)
- ld hl, Func_7d13b
- call Bankswitch
+ callba Func_7d13b
jp WaitForTextScrollButtonPress ; wait for button press
.label3
ld de, $CC5B
@@ -70814,9 +70547,7 @@
Func_4575f: ; 4575f (11:575f)
call Delay3
- ld b, BANK(Func_7bf15)
- ld hl, Func_7bf15
- call Bankswitch
+ callba Func_7bf15
ret
RocketHideoutElevatorTextPointers: ; 4576b (11:576b)
@@ -70933,9 +70664,7 @@
Func_45827: ; 45827 (11:5827)
call Delay3
- ld b, BANK(Func_7bf15)
- ld hl, Func_7bf15
- call Bankswitch
+ callba Func_7bf15
ret
SilphCoElevatorTextPointers: ; 45833 (11:5833)
@@ -74221,9 +73950,7 @@
TX_FAR _CompletedDexText ; 0x9d0ad
db $6
db $8 ; asm
- ld hl, DisplayDiploma
- ld b, BANK(DisplayDiploma)
- call Bankswitch
+ callab DisplayDiploma
ld a, $1
ld [$cc3c], a
jp TextScriptEnd
@@ -77694,13 +77421,9 @@
ld [W_ENEMYBATTSTATUS3], a ; $d069
ld a, [$cf91]
ld [W_ENEMYMONID], a
- ld hl, Func_3eb01
- ld b, BANK(Func_3eb01)
- call Bankswitch
+ callab Func_3eb01
call Func_4fe11
- ld hl, Func_e7a4
- ld b, BANK(Func_e7a4)
- call Bankswitch
+ callab Func_e7a4
ld hl, $cf4b
ld a, [$d5a0]
and $7f
@@ -78862,9 +78585,7 @@
ld a, $ff
ld [$c0ee], a
call PlaySound
- ld b, BANK(Music_RivalAlternateStart)
- ld hl, Music_RivalAlternateStart
- call Bankswitch
+ callba Music_RivalAlternateStart
ld a, [$cf0d]
cp $1
jr nz, .asm_50fff ; 0x50ff8 $5
@@ -78929,9 +78650,7 @@
ld a, $ff
ld [$c0ee], a
call PlaySound
- ld b, BANK(Music_RivalAlternateTempo)
- ld hl, Music_RivalAlternateTempo
- call Bankswitch
+ callba Music_RivalAlternateTempo
ld a, $2
ld [H_DOWNARROWBLINKCNT2], a ; $ff8c
call Func_50ee6
@@ -79013,9 +78732,7 @@
ld a, $ff
ld [$c0ee], a
call PlaySound
- ld b, BANK(Music_RivalAlternateStartAndTempo)
- ld hl, Music_RivalAlternateStartAndTempo
- call Bankswitch
+ callba Music_RivalAlternateStartAndTempo
ld a, [$cf0d]
cp $1
jr nz, .asm_51134
@@ -80590,9 +80307,7 @@
ld a, $ff
ld [$c0ee], a
call PlaySound
- ld b, BANK(Music_RivalAlternateStart)
- ld hl, Music_RivalAlternateStart
- call Bankswitch
+ callba Music_RivalAlternateStart
ld de, MovementData_51d1d
ld a, [$cf0d]
cp $1
@@ -81528,22 +81243,16 @@
jr z, .asm_52666
.asm_5262a
push hl
- ld hl, MoveHitTest
- ld b, BANK(MoveHitTest)
- call Bankswitch
+ callab MoveHitTest
pop hl
ld a, [W_MOVEMISSED] ; $d05f
and a
jr nz, .asm_52659
set 6, [hl]
- ld hl, Func_3ed27
- ld b, BANK(Func_3ed27)
- call Bankswitch
+ callab Func_3ed27
ld c, $1e
call DelayFrames
- ld hl, Func_3fba8
- ld b, BANK(Func_3fba8)
- call Bankswitch
+ callab Func_3fba8
ld hl, Func_3fb6e
ld b, BANK(Func_3fb6e)
jp Bankswitch
@@ -82648,9 +82357,7 @@
ld [$d0b5], a
call GetMonHeader
ld d, $64
- ld hl, CalcExperience
- ld b, BANK(CalcExperience)
- call Bankswitch
+ callab CalcExperience
ld a, [H_NUMTOPRINT] ; $ff96 (aliases: H_MULTIPLICAND)
ld b, a
ld a, [$ff97]
@@ -82686,9 +82393,7 @@
ld bc, $13
add hl, bc
push hl
- ld b, BANK(Func_58f43)
- ld hl, Func_58f43
- call Bankswitch
+ callba Func_58f43
pop hl
ld a, [hl]
cp d
@@ -82761,21 +82466,11 @@
.asm_553c8
xor a
ld [$d11e], a
- ld hl, Func_3ed99
- ld b, BANK(Func_3ed99)
- call Bankswitch
- ld hl, Func_3ed1a
- ld b, BANK(Func_3ed1a)
- call Bankswitch
- ld hl, Func_3ee19
- ld b, BANK(Func_3ee19)
- call Bankswitch
- ld hl, Func_3cd60
- ld b, BANK(Func_3cd60)
- call Bankswitch
- ld hl, Func_3ee94
- ld b, BANK(Func_3ee94)
- call Bankswitch
+ callab Func_3ed99
+ callab Func_3ed1a
+ callab Func_3ee19
+ callab Func_3cd60
+ callab Func_3ee94
call SaveScreenTilesToBuffer1
.asm_553f7
ld hl, UnnamedText_554dd ; $54dd
@@ -82784,9 +82479,7 @@
ld [$cc49], a
call LoadMonData
ld d, $1
- ld hl, PrintStatsBox
- ld b, BANK(PrintStatsBox)
- call Bankswitch
+ callab PrintStatsBox
call WaitForTextScrollButtonPress
call LoadScreenTilesFromBuffer1
xor a
@@ -85329,9 +85022,7 @@
pop af
ld hl, UnnamedText_56437
jp c, Func_56409
- ld hl, Func_2171b
- ld b, BANK(Func_2171b)
- call Bankswitch
+ callab Func_2171b
ld hl, UnnamedText_5644a
jp c, Func_56409
xor a
@@ -85361,16 +85052,12 @@
ld a, $3
ld [$cc49], a
call LoadMonData
- ld hl, Func_58f43
- ld b, BANK(Func_58f43)
- call Bankswitch
+ callab Func_58f43
ld a, d
cp $64
jr c, .asm_56315
ld d, $64
- ld hl, CalcExperience
- ld b, BANK(CalcExperience)
- call Bankswitch
+ callab CalcExperience
ld hl, $da6d
ld a, [H_NUMTOPRINT]
ld [hli], a
@@ -85931,9 +85618,7 @@
ld hl, Coord
ld de, W_PLAYERNAME
call PlaceString
- ld b, BANK(Func_44dd)
- ld hl, Func_44dd
- call Bankswitch
+ callba Func_44dd
ld hl, $c301
ld bc, $8028
.asm_5673e
@@ -85947,9 +85632,7 @@
dec c
jr nz, .asm_5673e ; 0x56747 $f5
call EnableLCD
- ld b, BANK(Func_5ae6)
- ld hl, Func_5ae6
- call Bankswitch
+ callba Func_5ae6
ld b, $8
call GoPAL_SET
call Delay3
@@ -86722,9 +86405,7 @@
ld hl, UnnamedText_58e4a ; $4e4a
.asm_58dc9
push hl
- ld hl, Func_3a849
- ld b, BANK(Func_3a849)
- call Bankswitch
+ callab Func_3a849
pop hl
call PrintText
jr asm_58e3a
@@ -86738,9 +86419,7 @@
ld a, b
and a
jr z, .asm_58df5
- ld hl, Func_3eb01
- ld b, BANK(Func_3eb01)
- call Bankswitch
+ callab Func_3eb01
jr .asm_58daa
.asm_58df5
ld hl, UnnamedText_58e45 ; $4e45
@@ -86756,12 +86435,8 @@
call PrintText
ld hl, UnnamedText_58e4f ; $4e4f
call PrintText
- ld hl, Func_3eb01
- ld b, BANK(Func_3eb01)
- call Bankswitch
- ld hl, Func_708ca
- ld b, BANK(Func_708ca)
- call Bankswitch
+ callab Func_3eb01
+ callab Func_708ca
ld hl, UnnamedText_58e3b ; $4e3b
call PrintText
@@ -90214,14 +89889,12 @@
ld [hl], a
xor a
ld [W_HALLOFFAMEROOMCURSCRIPT], a
- ld a, $0
- ld [$d719], a
- ld b, BANK(SaveSAVtoSRAM)
- ld hl, SaveSAVtoSRAM
- call Bankswitch
- ld b, $5
+ ld a, PALLET_TOWN
+ ld [wLastBlackoutMap], a
+ callba SaveSAVtoSRAM
+ ld b, 5
.asm_5a4ff
- ld c, $78
+ ld c, 600 / 5
call DelayFrames
dec b
jr nz, .asm_5a4ff ; 0x5a505 $f8
@@ -92025,9 +91698,7 @@
call PrintText
ld a, $33
ldh [$db], a
- ld b, BANK(RemoveItemByID)
- ld hl, RemoveItemByID
- call Bankswitch
+ callba RemoveItemByID
ld hl, $d7af
set 0, [hl]
jr .asm_62ecd ; 0x5ccc1
@@ -93258,8 +92929,8 @@
dw UndergroundTunnelEntranceRoute5Object ; objects
UndergroundTunnelEntranceRoute5Script: ; 5d6a9 (17:56a9)
- ld a, $10
- ld [$d365], a
+ ld a, ROUTE_5
+ ld [wLastMap], a
ret
UndergroundTunnelEntranceRoute5_5d6af: ; 5d6af (17:56af)
@@ -93303,8 +92974,8 @@
dw UndergroundTunnelEntranceRoute6Object ; objects
UndergroundTunnelEntranceRoute6Script: ; 5d6ef (17:56ef)
- ld a, $11
- ld [$d365], a
+ ld a, ROUTE_6
+ ld [wLastMap], a
jp EnableAutoTextBoxDrawing
UndergroundTunnelEntranceRoute6TextPointers: ; 5d6f7 (17:56f7)
@@ -93340,8 +93011,8 @@
dw UndergroundPathEntranceRoute7Object ; objects
UndergroundPathEntranceRoute7Script: ; 5d72c (17:572c)
- ld a, $12
- ld [$d365], a
+ ld a, ROUTE_7
+ ld [wLastMap], a
jp EnableAutoTextBoxDrawing
UndergroundPathEntranceRoute7TextPointers: ; 5d734 (17:5734)
@@ -93377,8 +93048,8 @@
dw UndergroundPathEntranceRoute7CopyObject ; objects
UndergroundPathEntranceRoute7CopyScript: ; 5d769 (17:5769)
- ld a, $12
- ld [$d365], a
+ ld a, ROUTE_7
+ ld [wLastMap], a
ret
UndergroundPathEntranceRoute7CopyTextPointers: ; 5d76f (17:576f)
@@ -94502,9 +94173,7 @@
ld a, $ff
ld [$c0ee], a
call PlaySound
- ld b, BANK(Music_RivalAlternateStart)
- ld hl, Music_RivalAlternateStart
- call Bankswitch
+ callba Music_RivalAlternateStart
ld a, $2
ld [W_POKEMONTOWER2CURSCRIPT], a
ld [W_CURMAPSCRIPT], a
@@ -95434,8 +95103,8 @@
ld [H_DOWNARROWBLINKCNT1], a ; $ff8b
ld a, $1
ld [$d42f], a
- ld a, $4
- ld [$d365], a
+ ld a, LAVENDER_TOWN
+ ld [wLastMap], a
ld hl, $d72d
set 3, [hl]
ld a, $0
@@ -95778,9 +95447,7 @@
call PrintText
ld a, [W_FOSSILITEM]
ld [$ffdb], a
- ld b, BANK(RemoveItemByID)
- ld hl, RemoveItemByID
- call Bankswitch
+ callba RemoveItemByID
ld hl, UnnamedText_610b8
call PrintText
ld hl, $d7a3
@@ -96246,9 +95913,7 @@
ld a, $ff
ld [$c0ee], a
call PlaySound
- ld b, BANK(Music_RivalAlternateStart)
- ld hl, Music_RivalAlternateStart
- call Bankswitch
+ callba Music_RivalAlternateStart
ld a, $3
ld [W_SSANNE2CURSCRIPT], a
ret
@@ -99460,9 +99125,7 @@
ld [$cee9], a
ld a, $1
ld [H_WHOSETURN], a ; $fff3
- ld hl, Func_79793
- ld b, BANK(Func_79793)
- call Bankswitch
+ callab Func_79793
ld d, $80
call Func_704f3
.asm_708f6
@@ -100782,9 +100445,7 @@
jp CopyData
Func_711ef: ; 711ef (1c:51ef)
- ld b, BANK(Func_e9cb)
- ld hl, Func_e9cb
- call Bankswitch
+ callba Func_e9cb
call Func_712d9
ld hl, wOAMBuffer
ld de, $cee9
@@ -101849,14 +101510,10 @@
ld [$cc49],a
call AddPokemonToParty
call Func_71d19
- ld hl, Func_17d7d
- ld b, BANK(Func_17d7d)
- call Bankswitch
+ callab EvolveTradeMon
call ClearScreen
call Func_71ca2
- ld b, BANK(Func_eedc)
- ld hl, Func_eedc
- call Bankswitch
+ callba Func_eedc
and a
ld a,$3
jr .asm_ee803 ; 0x71c9b $1
@@ -102197,7 +101854,7 @@
cp BRUNOS_ROOM
jr z, .caveOrBruno
.normalDungeonOrBuilding
- ld a, [$d365] ; town or route that current dungeon or building is located
+ ld a, [wLastMap] ; town or route that current dungeon or building is located
.townOrRoute
cp SAFFRON_CITY + 1
jr c, .town
@@ -103322,9 +102979,7 @@
jp LoadSAVCheckSum2
SaveSAV: ;$770a
- ld b,1
- ld hl,Func_5def ; LoadGameMenuInGame
- call Bankswitch
+ callba Func_5def ; LoadGameMenuInGame
ld hl,WouldYouLikeToSaveText
call SaveSAVConfirm
and a ;|0 = Yes|1 = No|
@@ -103906,9 +103561,7 @@
INCBIN "maps/ceruleanhouse2.blk"
Func_7405c: ; 7405c (1d:405c)
- ld b, BANK(Func_701a0)
- ld hl, Func_701a0
- call Bankswitch
+ callba Func_701a0
call ClearScreen
ld c, $64
call DelayFrames
@@ -104152,9 +103805,7 @@
jr .asm_74192
.asm_741f4
push de
- ld b, BANK(Func_4541)
- ld hl, Func_4541
- call Bankswitch
+ callba Func_4541
pop de
pop de
jr .asm_7419b
@@ -104427,15 +104078,15 @@
PrintStatusAilment: ; 747de (1d:47de)
ld a, [de]
- bit 3, a
+ bit PSN, a
jr nz, .psn
- bit 4, a
+ bit BRN, a
jr nz, .brn
- bit 5, a
+ bit FRZ, a
jr nz, .frz
- bit 6, a
+ bit PAR, a
jr nz, .par
- and $7 ; slp
+ and SLP
ret z
ld a, "S"
ld [hli], a
@@ -105615,9 +105266,7 @@
call PrintText
ld a, $40
ldh [$db], a
- ld b, BANK(RemoveItemByID)
- ld hl, RemoveItemByID
- call Bankswitch
+ callba RemoveItemByID
ld hl, $d78e
set 1, [hl]
.asm_60cba ; 0x75109
@@ -107269,9 +106918,7 @@
ld a, [$cd37]
and a
jr z, .asm_75d8d ; 0x75d81 $a
- ld b, BANK(GiveFossilToCinnabarLab)
- ld hl, GiveFossilToCinnabarLab
- call Bankswitch
+ callba GiveFossilToCinnabarLab
jr .asm_75d93 ; 0x75d8b $6
.asm_75d8d
ld hl, UnnamedText_75dcb
@@ -107609,9 +107256,7 @@
ret
GaryScript4: ; 75fe4 (1d:5fe4)
- ld b, BANK(Music_Cities1AlternateTempo)
- ld hl, Music_Cities1AlternateTempo
- call Bankswitch
+ callba Music_Cities1AlternateTempo
ld a, $2
ld [$ff8c], a
call GaryScript_760c8
@@ -108406,9 +108051,7 @@
push bc
ld a, [$CD41]
ld [$CD3D], a
- ld b, BANK(Func_73b3f)
- ld hl, Func_73b3f
- call Bankswitch
+ callba Func_73b3f
call Func_765e5
pop bc
jr c, .second
@@ -111753,9 +111396,7 @@
ld a, $e4
ld [rOBP1], a ; $ff49
call Func_79fc0
- ld b, BANK(asm_f055)
- ld hl, asm_f055
- call Bankswitch
+ callba asm_f055
ld c, $8
.asm_79f73
push bc
--- a/menu/pc.asm
+++ b/menu/pc.asm
@@ -346,9 +346,7 @@
jp Func_214e8
Func_216b3: ; 216b3 (8:56b3)
- ld b, BANK(Func_738a1)
- ld hl, Func_738a1
- call Bankswitch ; indirect jump to Func_738a1 (738a1 (1c:78a1))
+ callba Func_738a1
jp Func_214e8
Func_216be: ; 216be (8:56be)
--- a/wram.asm
+++ b/wram.asm
@@ -964,8 +964,13 @@
ds 1
W_XBLOCKCOORD:: ; d364
- ds 3
+ ds 1
+wLastMap:: ; d365
+ ds 1
+
+ ds 1
+
W_CURMAPTILESET:: ; d367
ds 1
@@ -1323,7 +1328,12 @@
W_PLAYERSTARTER:: ; d717
ds 1
- ds 27
+ ds 1
+
+wLastBlackoutMap:: ; d719
+ ds 1
+
+ ds 25
W_FLAGS_D733:: ; d733