summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rw-r--r--engine/bank3c.asm133
-rw-r--r--engine/bank3d.asm594
-rw-r--r--engine/bank3f.asm8
-rw-r--r--engine/battle/bank3d_battle.asm4
-rwxr-xr-xengine/items/items.asm2
-rw-r--r--engine/menu/bills_pc.asm2
-rwxr-xr-xengine/menu/party_menu.asm2
-rwxr-xr-xengine/overworld/cable_club_npc.asm2
-rw-r--r--engine/overworld/item.asm2
-rw-r--r--engine/overworld/missable_objects.asm8
-rwxr-xr-xengine/overworld/pokecenter.asm8
-rw-r--r--engine/overworld/try_pushing_boulder.asm1
-rwxr-xr-xengine/pikachu_pic_animation.asm26
-rwxr-xr-xengine/predefs.asm273
14 files changed, 488 insertions, 577 deletions
diff --git a/engine/bank3c.asm b/engine/bank3c.asm
index d176511c..e7ac2a4e 100644
--- a/engine/bank3c.asm
+++ b/engine/bank3c.asm
@@ -330,7 +330,7 @@ Pic_f0cf4: ; f0cf4 (3c:4cf4)
GFX_f0d82: ; f0d82 (3c:4d82)
dr $f0d82, $f0f12
-Func_f0f12:
+PokecenterChanseyText:
ld hl, NurseChanseyText
call PrintText
ld a, CHANSEY
@@ -367,125 +367,26 @@ PikachuMovementData_f1e2b:
db $38
db $3f
-Func_f1e30
- CheckEvent EVENT_GOT_TM18
- jr nz, .asm_f1e54
- ld hl, CeladonMart3Text_f1e5b
- call PrintText
- lb bc, TM_18, 1
- call GiveItem
- jr nc, .asm_f1e4f
- SetEvent EVENT_GOT_TM18
- ld hl, CeladonMart3Text_f1e60
- jr .asm_f1e57
-
-.asm_f1e4f
- ld hl, CeladonMart3Text_f1e6b
- jr .asm_f1e57
-
-.asm_f1e54
- ld hl, CeladonMart3Text_f1e66
-.asm_f1e57
- call PrintText
- ret
-
-CeladonMart3Text_f1e5b:
- TX_FAR _TM18PreReceiveText
- db "@"
-
-CeladonMart3Text_f1e60:
- TX_FAR _ReceivedTM18Text
- TX_SFX_ITEM
- db "@"
-
-CeladonMart3Text_f1e66:
- TX_FAR _TM18ExplanationText
- db "@"
+INCLUDE "scripts/celadonmart3_2.asm"
+INCLUDE "scripts/celadonmansion1_2.asm"
+INCLUDE "scripts/celadonmansion3_2.asm"
-CeladonMart3Text_f1e6b:
- TX_FAR _TM18NoRoomText
- db "@"
-
-Func_f1e70:
- ld a, $1
- ld [wDoNotWaitForButtonPressAfterDisplayingText], a
- ld hl, CeladonMansion1Text_f1e96
- call PrintText
- callab IsStarterPikachuInOurParty
- ret nc
- ld hl, CeladonMansionText_f1e9c
- call PrintText
- ld a, $0
- ld [wDoNotWaitForButtonPressAfterDisplayingText], a
- call Func_f1ea2
- call PrintText
- ret
-
-CeladonMansion1Text_f1e96:
- TX_FAR _CeladonMansion1Text2
- TX_WAIT_BUTTON
- db "@"
-
-CeladonMansionText_f1e9c:
- TX_FAR _CeladonMansion1Text6
- TX_BUTTON_SOUND
- db "@"
-
-Func_f1ea2:
- ld hl, PikachuHappinessThresholds_f1eb9
-.asm_f1ea5
- ld a, [hli]
- inc hl
- and a
- jr z, .asm_f1eb5
- ld b, a
- ld a, [wPikachuHappiness]
- cp b
- jr c, .asm_f1eb5
- inc hl
- inc hl
- jr .asm_f1ea5
-
-.asm_f1eb5
- ld a, [hli]
- ld h, [hl]
- ld l, a
+Func_f1f23:
+ ld hl, PikachuMovementData_f1f2c
+ ld b, SPRITE_FACING_DOWN
+ call Func_f0a82
ret
-PikachuHappinessThresholds_f1eb9
- dw 51, CeladonMansion1Text_f1ed5
- dw 101, CeladonMansion1Text_f1eda
- dw 131, CeladonMansion1Text_f1edf
- dw 161, CeladonMansion1Text_f1ee4
- dw 201, CeladonMansion1Text_f1ee9
- dw 255, CeladonMansion1Text_f1eee
- dbbw 0, $ff, CeladonMansion1Text_f1eee
-
-CeladonMansion1Text_f1ed5:
- TX_FAR _CeladonMansion1Text7
- db "@"
-
-CeladonMansion1Text_f1eda:
- TX_FAR _CeladonMansion1Text8
- db "@"
-
-CeladonMansion1Text_f1edf:
- TX_FAR _CeladonMansion1Text9
- db "@"
-
-CeladonMansion1Text_f1ee4:
- TX_FAR _CeladonMansion1Text10
- db "@"
-
-CeladonMansion1Text_f1ee9:
- TX_FAR _CeladonMansion1Text11
- db "@"
-
-CeladonMansion1Text_f1eee:
- TX_FAR _CeladonMansion1Text12
- db "@"
+PikachuMovementData_f1f2c:
+ db $00
+ db $20
+ db $1e
+ db $35
+ db $3f
- dr $f1ef3, $f218c
+INCLUDE "scripts/celadondiner2.asm"
+INCLUDE "scripts/safarizoneentrance2.asm"
+INCLUDE "scripts/cinnabargym2.asm"
INCLUDE "scripts/mtmoonpokecenter2.asm"
diff --git a/engine/bank3d.asm b/engine/bank3d.asm
index 61fc8ed1..f86bcf21 100644
--- a/engine/bank3d.asm
+++ b/engine/bank3d.asm
@@ -4,53 +4,53 @@ INCLUDE "engine/battle/unused_stats_functions.asm"
INCLUDE "engine/battle/scroll_draw_trainer_pic.asm"
Func_f429f:: ; f429f (3d:429f)
- coord hl, 0,5
- ld c,$0
+ coord hl, 0, 5
+ ld c, $0
.asm_f42a4
inc c
- ld a,c
+ ld a, c
cp $9
ret z
- ld d,$5b
+ ld d, $5b
push bc
push hl
.asm_f42ad
call Func_f42c2
dec hl
- ld a,d
+ ld a, d
sub $7
- ld d,a
+ ld d, a
dec c
- jr nz,.asm_f42ad
- ld c,$2
+ jr nz, .asm_f42ad
+ ld c, $2
call DelayFrames
pop hl
pop bc
inc hl
jr .asm_f42a4
-
+
Func_f42c2:: ; f42c2 (3d:f42c2)
push hl
push de
push bc
- ld e,$7
+ ld e, $7
.loop
- ld a,d
+ ld a, d
cp $31
- jr nc,.asm_f42ce
- ld a,$7f
+ jr nc, .asm_f42ce
+ ld a, $7f
.asm_f42ce
- ld [hl],a
- ld bc,$14
- add hl,bc
+ ld [hl], a
+ ld bc, $14
+ add hl, bc
inc d
dec e
- jr nz,.loop
+ jr nz, .loop
pop bc
pop de
pop hl
ret
-
+
INCLUDE "engine/battle/decrement_pp.asm"
ModifyPikachuHappiness:: ; f430a (3d:430a)
@@ -111,7 +111,7 @@ ModifyPikachuHappiness:: ; f430a (3d:430a)
xor a
.okay
ld [wPikachuHappiness], a
-
+
; Restore d and get the d'th entry in PikachuMoods.
pop de
dec d
@@ -141,20 +141,20 @@ ModifyPikachuHappiness:: ; f430a (3d:430a)
ld [wPikachuMood], a
.done
ret
-
+
HappinessChangeTable: ; f4385 (3d:4385)
; Increase
- db 5, 3, 2 ; Gained a level
- db 5, 3, 2 ; HP restore
- db 1, 1, 0 ; Used X item
- db 3, 2, 1 ; Challenged Gym Leader
- db 1, 1, 0 ; Teach TM/HM
- db 2, 1, 1 ; Walking around
+ db 5, 3, 2 ; Gained a level
+ db 5, 3, 2 ; HP restore
+ db 1, 1, 0 ; Used X item
+ db 3, 2, 1 ; Challenged Gym Leader
+ db 1, 1, 0 ; Teach TM/HM
+ db 2, 1, 1 ; Walking around
; Decrease
- db -3, -3, -5 ; Deposited
- db -1, -1, -1 ; Fainted in battle
- db -5, -5, -10 ; Fainted due to Poison outside of battle
- db -5, -5, -10 ; Unknown (d = 10)
+ db -3, -3, -5 ; Deposited
+ db -1, -1, -1 ; Fainted in battle
+ db -5, -5, -10 ; Fainted due to Poison outside of battle
+ db -5, -5, -10 ; Unknown (d = 10)
db -10, -10, -20 ; Unknown (d = 11)
PikachuMoods: ; f43a6 (3d:43a6)
@@ -177,125 +177,125 @@ OldManPic:: INCBIN "pic/trainer/oldman.pic"
ProfOakPicBack:: INCBIN "pic/ytrainer/prof.oakb.pic"
Func_f453f:: ; f453f (3d:453f)
- ld hl,PokemonLogoGraphics
- ld de,vChars2
- ld bc,$730
- ld a,BANK(PokemonLogoGraphics) ; redundant because this function is in bank3d
+ ld hl, PokemonLogoGraphics
+ ld de, vChars2
+ ld bc, $730
+ ld a, BANK(PokemonLogoGraphics) ; redundant because this function is in bank3d
call FarCopyData
- ld hl,YellowLogoGraphics+$230
- ld de,vChars0+$fd0
- ld bc,$30
- ld a,BANK(YellowLogoGraphics)
+ ld hl, YellowLogoGraphics+$230
+ ld de, vChars0+$fd0
+ ld bc, $30
+ ld a, BANK(YellowLogoGraphics)
call FarCopyData
- ld hl,YellowLogoGraphics+$260
- ld de,vChars1
- ld bc,$400
- ld a,BANK(YellowLogoGraphics)
+ ld hl, YellowLogoGraphics+$260
+ ld de, vChars1
+ ld bc, $400
+ ld a, BANK(YellowLogoGraphics)
call FarCopyData
- ld hl,YellowLogoGraphics+$660
- ld de,vChars0+$f00
- ld bc,$c0
- ld a,BANK(YellowLogoGraphics)
+ ld hl, YellowLogoGraphics+$660
+ ld de, vChars0+$f00
+ ld bc, $c0
+ ld a, BANK(YellowLogoGraphics)
call FarCopyData
ret
-
+
Func_f4578:: ; f4578 (3d:4578)
- coord hl, 2,1
- ld de,Pointer_f45f9
- ld bc,7 << 8 | 16 ; 16x7 (xy)
+ coord hl, 2, 1
+ ld de, Pointer_f45f9
+ ld bc, 7 << 8 | 16 ; 16x7 (xy)
call CopyScreenArea
ret
-
+
Func_f4585:: ; f4585 (3d:4585)
- coord hl, 6,4
- ld de,Pointer_f4673
- ld bc,4 << 8 | 7 ; 7x4 (xy)
+ coord hl, 6, 4
+ ld de, Pointer_f4673
+ ld bc, 4 << 8 | 7 ; 7x4 (xy)
call CopyScreenArea
- coord hl, 9,8
- ld [hl],$64
+ coord hl, 9, 8
+ ld [hl], $64
inc hl
- ld [hl],$65
+ ld [hl], $65
ret
-
+
Func_f459a:: ; f459a (3d:459a)
- coord hl, 4,8
- ld de,Pointer_f468f
- ld bc,9 << 8 | 12 ; 12x9 (xy)
+ coord hl, 4, 8
+ ld de, Pointer_f468f
+ ld bc, 9 << 8 | 12 ; 12x9 (xy)
call CopyScreenArea
- coord hl, 16,10
- ld [hl],$96
- coord hl, 16,11
- ld [hl],$9d
- coord hl, 16,12
- ld [hl],$a7
- coord hl, 16,13
- ld [hl],$b1
- ld hl,Pointer_f45c7
- ld de,wOAMBuffer
- ld bc,$20
+ coord hl, 16, 10
+ ld [hl], $96
+ coord hl, 16, 11
+ ld [hl], $9d
+ coord hl, 16, 12
+ ld [hl], $a7
+ coord hl, 16, 13
+ ld [hl], $b1
+ ld hl, Pointer_f45c7
+ ld de, wOAMBuffer
+ ld bc, $20
call CopyData
ret
-
+
Pointer_f45c7: ; f45c7 (3d:45c7)
- db $60,$40,$f1,$22
- db $60,$48,$f0,$22
- db $68,$40,$f3,$22
- db $68,$48,$f2,$22
- db $60,$60,$f0,$02
- db $60,$68,$f1,$02
- db $68,$60,$f2,$02
- db $68,$68,$f3,$02
-
+ db $60, $40, $f1, $22
+ db $60, $48, $f0, $22
+ db $68, $40, $f3, $22
+ db $68, $48, $f2, $22
+ db $60, $60, $f0, $02
+ db $60, $68, $f1, $02
+ db $68, $60, $f2, $02
+ db $68, $68, $f3, $02
+
CopyScreenArea:: ; f45e7 (3d:45e7)
; copy cxb (xy) screen area from de to hl
push bc
push hl
.loop
- ld a,[de]
+ ld a, [de]
inc de
- ld [hli],a
+ ld [hli], a
dec c
- jr nz,.loop
+ jr nz, .loop
pop hl
- ld bc,$14
- add hl,bc
+ ld bc, $14
+ add hl, bc
pop bc
dec b
- jr nz,CopyScreenArea
+ jr nz, CopyScreenArea
ret
-
+
Pointer_f45f9: ; f45f9 (3d:45f9)
; 16x7 (xy)
- db $f4,$f4,$f4,$f4,$f4,$f4,$49,$f4,$72,$30,$f4,$f4,$f4,$f4,$f4,$f4
- db $fd,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0a,$0b,$f4,$0d,$0e,$0f
- db $10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1a,$1b,$1c,$1d,$1e,$1f
- db $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2a,$2b,$2c,$2d,$2e,$2f
- db $f4,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3a,$3b,$3c,$3d,$3e,$3f
- db $f4,$41,$42,$43,$44,$45,$46,$47,$48,$f4,$4a,$4b,$4c,$4d,$4e,$4f
- db $f4,$6a,$6b,$6c,$6d,$f4,$f4,$f4,$f4,$f4,$f4,$6e,$6f,$70,$71,$f4
+ db $f4, $f4, $f4, $f4, $f4, $f4, $49, $f4, $72, $30, $f4, $f4, $f4, $f4, $f4, $f4
+ db $fd, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b, $f4, $0d, $0e, $0f
+ db $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $1a, $1b, $1c, $1d, $1e, $1f
+ db $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $2a, $2b, $2c, $2d, $2e, $2f
+ db $f4, $31, $32, $33, $34, $35, $36, $37, $38, $39, $3a, $3b, $3c, $3d, $3e, $3f
+ db $f4, $41, $42, $43, $44, $45, $46, $47, $48, $f4, $4a, $4b, $4c, $4d, $4e, $4f
+ db $f4, $6a, $6b, $6c, $6d, $f4, $f4, $f4, $f4, $f4, $f4, $6e, $6f, $70, $71, $f4
Pointer_f4669:: ; f4669 (3d:4669)
- db $47,$48,$49,$4a,$4b,$4c,$4d,$4e,$4f,$5f
-
+ db $47, $48, $49, $4a, $4b, $4c, $4d, $4e, $4f, $5f
+
Pointer_f4673:: ; f4673 (3d:4673)
; 7x4 (xy)
- db $24,$25,$66,$67,$68,$69,$2a
- db $50,$51,$52,$53,$54,$55,$56
- db $57,$58,$59,$5a,$5b,$5c,$5d
- db $6d,$5e,$5f,$60,$61,$62,$63
-
+ db $24, $25, $66, $67, $68, $69, $2a
+ db $50, $51, $52, $53, $54, $55, $56
+ db $57, $58, $59, $5a, $5b, $5c, $5d
+ db $6d, $5e, $5f, $60, $61, $62, $63
+
Pointer_f468f:: ; f468f (3d:468f)
; 12x9 (xy)
- db $80,$81,$82,$83,$00,$00,$00,$00,$84,$85,$86,$87
- db $88,$89,$8a,$8b,$8c,$8d,$8d,$8e,$8f,$8a,$90,$91
- db $00,$92,$93,$8a,$8a,$8a,$8a,$8a,$8a,$94,$95,$00
- db $00,$00,$97,$8a,$8a,$98,$99,$8a,$8a,$9a,$9b,$9c
- db $00,$00,$9e,$9f,$a0,$a1,$a2,$a3,$a4,$a5,$a6,$8a
- db $00,$a8,$a9,$aa,$8a,$ab,$ac,$8a,$ad,$ae,$af,$b0
- db $00,$b2,$b3,$b4,$8a,$8a,$8a,$8a,$b5,$b6,$b7,$b8
- db $00,$b9,$ba,$8a,$8a,$8a,$8a,$8a,$8a,$bb,$bc,$00
- db $00,$00,$bd,$8a,$8a,$8a,$8a,$8a,$8a,$be,$bf,$00
-
+ db $80, $81, $82, $83, $00, $00, $00, $00, $84, $85, $86, $87
+ db $88, $89, $8a, $8b, $8c, $8d, $8d, $8e, $8f, $8a, $90, $91
+ db $00, $92, $93, $8a, $8a, $8a, $8a, $8a, $8a, $94, $95, $00
+ db $00, $00, $97, $8a, $8a, $98, $99, $8a, $8a, $9a, $9b, $9c
+ db $00, $00, $9e, $9f, $a0, $a1, $a2, $a3, $a4, $a5, $a6, $8a
+ db $00, $a8, $a9, $aa, $8a, $ab, $ac, $8a, $ad, $ae, $af, $b0
+ db $00, $b2, $b3, $b4, $8a, $8a, $8a, $8a, $b5, $b6, $b7, $b8
+ db $00, $b9, $ba, $8a, $8a, $8a, $8a, $8a, $8a, $bb, $bc, $00
+ db $00, $00, $bd, $8a, $8a, $8a, $8a, $8a, $8a, $be, $bf, $00
+
; f46f9 (3d:46f9)
PokemonLogoGraphics: INCBIN "gfx/pokemon_logo.2bpp"
YellowLogoGraphics: INCBIN "gfx/yellow_titlescreen.2bpp"
@@ -304,267 +304,267 @@ INCLUDE "engine/menu/link_menu.asm"
HandleMenuInputDouble:: ; f5a40 (3d:5a40)
xor a
- ld [wPartyMenuAnimMonEnabled],a
+ ld [wPartyMenuAnimMonEnabled], a
HandleMenuInputPokemonSelectionDouble:: ; f5a44 (3d:5a44)
- ld a,[H_DOWNARROWBLINKCNT1]
+ ld a, [H_DOWNARROWBLINKCNT1]
push af
- ld a,[H_DOWNARROWBLINKCNT2]
+ ld a, [H_DOWNARROWBLINKCNT2]
push af ; save existing values on stack
xor a
- ld [H_DOWNARROWBLINKCNT1],a ; blinking down arrow timing value 1
- ld a,$06
- ld [H_DOWNARROWBLINKCNT2],a ; blinking down arrow timing value 2
+ ld [H_DOWNARROWBLINKCNT1], a ; blinking down arrow timing value 1
+ ld a, $06
+ ld [H_DOWNARROWBLINKCNT2], a ; blinking down arrow timing value 2
.loop1
xor a
- ld [wAnimCounter],a ; counter for pokemon shaking animation
+ ld [wAnimCounter], a ; counter for pokemon shaking animation
call Func_f5ab0
call JoypadLowSensitivity
- ld a,[hJoy5]
+ ld a, [hJoy5]
and a ; was a key pressed?
- jr nz,.keyPressed
+ jr nz, .keyPressed
pop af
- ld [H_DOWNARROWBLINKCNT2],a
+ ld [H_DOWNARROWBLINKCNT2], a
pop af
- ld [H_DOWNARROWBLINKCNT1],a ; restore previous values
+ ld [H_DOWNARROWBLINKCNT1], a ; restore previous values
xor a
- ld [wMenuWrappingEnabled],a ; disable menu wrapping
+ ld [wMenuWrappingEnabled], a ; disable menu wrapping
ret
.keyPressed
xor a
- ld [wCheckFor180DegreeTurn],a
- ld a,[hJoy5]
- ld b,a
- bit 6,a ; pressed Up key?
- jr z,.checkIfDownPressed
+ ld [wCheckFor180DegreeTurn], a
+ ld a, [hJoy5]
+ ld b, a
+ bit 6, a ; pressed Up key?
+ jr z, .checkIfDownPressed
.upPressed
- ld a,[wCurrentMenuItem] ; selected menu item
+ ld a, [wCurrentMenuItem] ; selected menu item
and a ; already at the top of the menu?
- jr z,.checkOtherKeys
+ jr z, .checkOtherKeys
.notAtTop
dec a
- ld [wCurrentMenuItem],a ; move selected menu item up one space
+ ld [wCurrentMenuItem], a ; move selected menu item up one space
jr .checkOtherKeys
.checkIfDownPressed
- bit 7,a
- jr z,.checkOtherKeys
+ bit 7, a
+ jr z, .checkOtherKeys
.downPressed
- ld a,[wCurrentMenuItem]
+ ld a, [wCurrentMenuItem]
inc a
- ld c,a
- ld a,[wMaxMenuItem]
+ ld c, a
+ ld a, [wMaxMenuItem]
cp c
- jr c,.checkOtherKeys
- ld a,c
- ld [wCurrentMenuItem],a
+ jr c, .checkOtherKeys
+ ld a, c
+ ld [wCurrentMenuItem], a
.checkOtherKeys
- ld a,[wMenuWatchedKeys]
+ ld a, [wMenuWatchedKeys]
and b ; does the menu care about any of the pressed keys?
- jp z,.loop1
+ jp z, .loop1
.checkIfAButtonOrBButtonPressed
- ld a,[hJoy5]
+ ld a, [hJoy5]
and A_BUTTON | B_BUTTON
- jr z,.skipPlayingSound
+ jr z, .skipPlayingSound
.AButtonOrBButtonPressed
- ld a, $90 ; (SFX_02_40 - SFX_Headers_02) / 3
+ ld a, SFX_PRESS_AB
call PlaySound ; play sound
.skipPlayingSound
pop af
- ld [H_DOWNARROWBLINKCNT2],a
+ ld [H_DOWNARROWBLINKCNT2], a
pop af
- ld [H_DOWNARROWBLINKCNT1],a ; restore previous values
- ld a,[hJoy5]
+ ld [H_DOWNARROWBLINKCNT1], a ; restore previous values
+ ld a, [hJoy5]
ret
-
+
Func_f5ab0:: ; f5ab0 (3d:5ab0)
- ld a,[wTopMenuItemY]
+ ld a, [wTopMenuItemY]
and a
- jr z,.asm_f5ac0
- coord hl, 0,0
- ld bc,$14
+ jr z, .asm_f5ac0
+ coord hl, 0, 0
+ ld bc, SCREEN_WIDTH
.loop
- add hl,bc
+ add hl, bc
dec a
- jr nz,.loop
+ jr nz, .loop
.asm_f5ac0
- ld a,[wTopMenuItemX]
- ld b,$0
- ld c,a
- add hl,bc
+ ld a, [wTopMenuItemX]
+ ld b, $0
+ ld c, a
+ add hl, bc
push hl
- ld a,[wLastMenuItem]
+ ld a, [wLastMenuItem]
and a
- jr z,.asm_f5ad5
- ld bc,$28
+ jr z, .asm_f5ad5
+ ld bc, $28
.loop2
- add hl,bc
+ add hl, bc
dec a
- jr nz,.loop2
+ jr nz, .loop2
.asm_f5ad5
- ld a,[hl]
+ ld a, [hl]
cp "▶"
- jr nz,.asm_f5ade
- ld a,[wTileBehindCursor]
- ld [hl],a
+ jr nz, .asm_f5ade
+ ld a, [wTileBehindCursor]
+ ld [hl], a
.asm_f5ade
pop hl
- ld a,[wCurrentMenuItem]
+ ld a, [wCurrentMenuItem]
and a
- jr z,.asm_f5aec
- ld bc,$28
+ jr z, .asm_f5aec
+ ld bc, $28
.loop3
- add hl,bc
+ add hl, bc
dec a
- jr nz,.loop3
+ jr nz, .loop3
.asm_f5aec
- ld a,[hl]
+ ld a, [hl]
cp "▶"
- jr z,.asm_f5af4
- ld [wTileBehindCursor],a
+ jr z, .asm_f5af4
+ ld [wTileBehindCursor], a
.asm_f5af4
- ld a,"▶"
- ld [hl],a
- ld a,l
- ld [wMenuCursorLocation],a
- ld a,h
- ld [wMenuCursorLocation+1],a
- ld a,[wCurrentMenuItem]
- ld [wLastMenuItem],a
+ ld a, "▶"
+ ld [hl], a
+ ld a, l
+ ld [wMenuCursorLocation], a
+ ld a, h
+ ld [wMenuCursorLocation+1], a
+ ld a, [wCurrentMenuItem]
+ ld [wLastMenuItem], a
ret
-
-Func_f5b06:: ; f5b06 (3d:5b06)
- ld hl,wd728
- set 0,[hl]
- ld hl,Text_f5b17
+
+PrintStrengthTxt:: ; f5b06 (3d:5b06)
+ ld hl, wd728
+ set 0, [hl]
+ ld hl, Text_f5b17
call PrintText
- ld hl,Text_f5b28
+ ld hl, Text_f5b28
jp PrintText
-
+
Text_f5b17:: ; f5b17 (3d:5b17)
TX_FAR _UsedStrengthText ; 2d:417e
- db $08 ; asm
- ld a,[wcf91]
+ TX_ASM
+ ld a, [wcf91]
call PlayCry
call Delay3
jp TextScriptEnd
-
+
Text_f5b28:: ; f5b28 (3d:5b28)
TX_FAR _CanMoveBouldersText ; 2d:4193
db "@"
-
+
CheckForForcedBikeSurf:: ; f5b2d (3d:5b2d)
- ld hl,wd728
- set 1,[hl]
- ld a,[wd732]
- bit 5,a
- jr nz,.asm_f5b59
- ld a,[wCurMap]
+ ld hl, wd728
+ set 1, [hl]
+ ld a, [wd732]
+ bit 5, a
+ jr nz, .asm_f5b59
+ ld a, [wCurMap]
cp SEAFOAM_ISLANDS_5
ret nz
CheckBothEventsSet EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE
ret z
- ld hl,CoordsData_f5b64
+ ld hl, CoordsData_f5b64
call ArePlayerCoordsInArray
ret nc
- ld hl,wd728
- res 1,[hl]
- ld hl,CurrentTooFastText
+ ld hl, wd728
+ res 1, [hl]
+ ld hl, CurrentTooFastText
jp PrintText
.asm_f5b59
- ld hl,wd728
- res 1,[hl]
- ld hl,CyclingIsFunText
+ ld hl, wd728
+ res 1, [hl]
+ ld hl, CyclingIsFunText
jp PrintText
-
+
CoordsData_f5b64:: ; f5b64 (3d:5b64)
- db 11,07
+ db 11, 07
db $ff
-
+
CurrentTooFastText:: ; f5b67 (3d:5b67)
TX_FAR _CurrentTooFastText ; 2d:41ab
db "@"
-
+
CyclingIsFunText:: ; f5b6c (3d:5b6c)
TX_FAR _CyclingIsFunText ; 2d:41ca
db "@"
-
+
AddItemToInventory_:: ; f5b70 (3d:5b70)
- ld a,[wItemQuantity] ; a = item quantity
+ ld a, [wItemQuantity] ; a = item quantity
push af
push bc
push de
push hl
push hl
- ld d,50 ; PC box can hold 50 items
- ld a,wNumBagItems & $FF
+ ld d, 50 ; PC box can hold 50 items
+ ld a, wNumBagItems & $FF
cp l
- jr nz,.checkIfInventoryFull
- ld a,wNumBagItems >> 8
+ jr nz, .checkIfInventoryFull
+ ld a, wNumBagItems >> 8
cp h
- jr nz,.checkIfInventoryFull
+ jr nz, .checkIfInventoryFull
; if the destination is the bag
- ld d,20 ; bag can hold 20 items
+ ld d, 20 ; bag can hold 20 items
.checkIfInventoryFull
- ld a,[hl]
+ ld a, [hl]
sub d
- ld d,a
- ld a,[hli]
+ ld d, a
+ ld a, [hli]
and a
- jr z,.addNewItem
+ jr z, .addNewItem
.notAtEndOfInventory
- ld a,[hli]
- ld b,a ; b = ID of current item in table
- ld a,[wcf91] ; a = ID of item being added
+ ld a, [hli]
+ ld b, a ; b = ID of current item in table
+ ld a, [wcf91] ; a = ID of item being added
cp b ; does the current item in the table match the item being added?
- jp z,.increaseItemQuantity ; if so, increase the item's quantity
+ jp z, .increaseItemQuantity ; if so, increase the item's quantity
inc hl
.loop
- ld a,[hl]
- cp a,$ff ; is it the end of the table?
+ ld a, [hl]
+ cp a, $ff ; is it the end of the table?
jr nz, .notAtEndOfInventory
.addNewItem ; add an item not yet in the inventory
pop hl
- ld a,d
+ ld a, d
and a ; is there room for a new item slot?
- jr z,.done
+ jr z, .done
; if there is room
inc [hl] ; increment the number of items in the inventory
- ld a,[hl] ; the number of items will be the index of the new item
+ ld a, [hl] ; the number of items will be the index of the new item
add a
dec a
- ld c,a
- ld b,0
- add hl,bc ; hl = address to store the item
- ld a,[wcf91]
- ld [hli],a ; store item ID
- ld a,[wItemQuantity]
- ld [hli],a ; store item quantity
- ld [hl],$ff ; store terminator
+ ld c, a
+ ld b, 0
+ add hl, bc ; hl = address to store the item
+ ld a, [wcf91]
+ ld [hli], a ; store item ID
+ ld a, [wItemQuantity]
+ ld [hli], a ; store item quantity
+ ld [hl], $ff ; store terminator
jp .success
.increaseItemQuantity ; increase the quantity of an item already in the inventory
- ld a,[wItemQuantity]
- ld b,a ; b = quantity to add
- ld a,[hl] ; a = existing item quantity
+ ld a, [wItemQuantity]
+ ld b, a ; b = quantity to add
+ ld a, [hl] ; a = existing item quantity
add b ; a = new item quantity
- cp a,100
- jp c,.storeNewQuantity ; if the new quantity is less than 100, store it
+ cp a, 100
+ jp c, .storeNewQuantity ; if the new quantity is less than 100, store it
; if the new quantity is greater than or equal to 100,
; try to max out the current slot and add the rest in a new slot
- sub a,99
- ld [wItemQuantity],a ; a = amount left over (to put in the new slot)
- ld a,d
+ sub a, 99
+ ld [wItemQuantity], a ; a = amount left over (to put in the new slot)
+ ld a, d
and a ; is there room for a new item slot?
- jr z,.increaseItemQuantityFailed
+ jr z, .increaseItemQuantityFailed
; if so, store 99 in the current slot and store the rest in a new slot
- ld a,99
- ld [hli],a
+ ld a, 99
+ ld [hli], a
jp .loop
.increaseItemQuantityFailed
pop hl
and a
jr .done
.storeNewQuantity
- ld [hl],a
+ ld [hl], a
pop hl
.success
scf
@@ -573,8 +573,8 @@ AddItemToInventory_:: ; f5b70 (3d:5b70)
pop de
pop bc
pop bc
- ld a,b
- ld [wItemQuantity],a ; restore the initial value from when the function was called
+ ld a, b
+ ld [wItemQuantity], a ; restore the initial value from when the function was called
ret
; function to remove an item (in varying quantities) from the player's bag or PC box
@@ -585,49 +585,49 @@ AddItemToInventory_:: ; f5b70 (3d:5b70)
RemoveItemFromInventory_: ; f5be1 (3d:5be1)
push hl
inc hl
- ld a,[wWhichPokemon] ; index (within the inventory) of the item being removed
+ ld a, [wWhichPokemon] ; index (within the inventory) of the item being removed
add a
add l
- ld l,a
- jr nc,.noCarry
+ ld l, a
+ jr nc, .noCarry
inc h
.noCarry
inc hl
- ld a,[wItemQuantity] ; quantity being removed
- ld e,a
- ld a,[hl] ; a = current quantity
+ ld a, [wItemQuantity] ; quantity being removed
+ ld e, a
+ ld a, [hl] ; a = current quantity
sub e
- ld [hld],a ; store new quantity
- ld [wMaxItemQuantity],a
+ ld [hld], a ; store new quantity
+ ld [wMaxItemQuantity], a
and a
- jr nz,.skipMovingUpSlots
+ jr nz, .skipMovingUpSlots
; if the remaining quantity is 0,
; remove the emptied item slot and move up all the following item slots
.moveSlotsUp
- ld e,l
- ld d,h
+ ld e, l
+ ld d, h
inc de
inc de ; de = address of the slot following the emptied one
.loop ; loop to move up the following slots
- ld a,[de]
+ ld a, [de]
inc de
- ld [hli],a
- cp a,$ff
- jr nz,.loop
+ ld [hli], a
+ cp a, $ff
+ jr nz, .loop
; update menu info
xor a
- ld [wListScrollOffset],a
- ld [wCurrentMenuItem],a
- ld [wBagSavedMenuItem],a
- ld [wSavedListScrollOffset],a
+ ld [wListScrollOffset], a
+ ld [wCurrentMenuItem], a
+ ld [wBagSavedMenuItem], a
+ ld [wSavedListScrollOffset], a
pop hl
- ld a,[hl] ; a = number of items in inventory
+ ld a, [hl] ; a = number of items in inventory
dec a ; decrement the number of items
- ld [hl],a ; store new number of items
- ld [wListCount],a
- cp a,2
- jr c,.done
- ld [wMaxMenuItem],a
+ ld [hl], a ; store new number of items
+ ld [wListCount], a
+ cp a, 2
+ jr c, .done
+ ld [wMaxMenuItem], a
jr .done
.skipMovingUpSlots
pop hl
@@ -641,45 +641,45 @@ CircleTile: INCBIN "gfx/circle_tile.2bpp"
BadgeNumbersTileGraphics: INCBIN "gfx/badge_numbers.2bpp"
ReadSuperRodData:: ; f5ea4 (3d:5ea4)
- ld a,[wCurMap]
- ld c,a
- ld hl,FishingSlots
+ ld a, [wCurMap]
+ ld c, a
+ ld hl, FishingSlots
.loop
- ld a,[hli]
+ ld a, [hli]
cp $ff
- jr z,.notfound
+ jr z, .notfound
cp c
- jr z,.found
- ld de,$8
- add hl,de
+ jr z, .found
+ ld de, $8
+ add hl, de
jr .loop
.found
call GenerateRandomFishingEncounter
ret
.notfound
- ld de,$0
+ ld de, $0
ret
-
+
GenerateRandomFishingEncounter: ; f5ec1 (3d:5ec1)
call Random
cp $66
- jr c,.asm_f5ed6
+ jr c, .asm_f5ed6
inc hl
inc hl
cp $b2
- jr c,.asm_f5ed6
+ jr c, .asm_f5ed6
inc hl
inc hl
cp $e5
- jr c,.asm_f5ed6
+ jr c, .asm_f5ed6
inc hl
inc hl
.asm_f5ed6
- ld e,[hl]
+ ld e, [hl]
inc hl
- ld d,[hl]
+ ld d, [hl]
ret
-
+
INCLUDE "data/super_rod.asm"
INCLUDE "engine/battle/bank3d_battle.asm"
INCLUDE "engine/items/tm_prices.asm"
diff --git a/engine/bank3f.asm b/engine/bank3f.asm
index c31fc986..85674ec4 100644
--- a/engine/bank3f.asm
+++ b/engine/bank3f.asm
@@ -27,7 +27,7 @@ Func_fc4fa:: ; fc4fa (3f:44fa)
bit 4, [hl]
res 4, [hl]
jr nz, .asm_fc515
- call ResetPikachuAsleep
+ call EnablePikachuFollowingPlayer
call Func_fc523
ld a, $ff
ld [wSpriteStateData1 + $f2], a
@@ -344,7 +344,7 @@ Func_fc6d5:: ; fc6d5 (3f:46d5)
ld a, [wFontLoaded]
bit 0, a
jp nz, asm_fc76a
- call CheckPikachuAsleep
+ call CheckPikachuFollowingPlayer
jp nz, asm_fc76a
ld a, [hl]
and $7f
@@ -408,7 +408,7 @@ asm_fc745: ; fc745 (3f:4745)
ld hl, wSpriteStateData2 - wSpriteStateData1
add hl, bc
ld [hl], a
- call CheckPikachuAsleep
+ call CheckPikachuFollowingPlayer
jr nz, .asm_fc75f
ld a, [wSpriteStateData1 + $9]
xor $4
@@ -1679,7 +1679,7 @@ Func_fce5a:: ; fce5a (3f:4e5a)
ret
Func_fce73:: ; fce73 (3f:4e73)
-; function to test if a pokemon is alive?
+; function to test if Pikachu is alive?
xor a
ld [wWhichPokemon], a
ld hl, wPartyCount
diff --git a/engine/battle/bank3d_battle.asm b/engine/battle/bank3d_battle.asm
index 7f8854a4..4fd37bc4 100644
--- a/engine/battle/bank3d_battle.asm
+++ b/engine/battle/bank3d_battle.asm
@@ -187,7 +187,7 @@ LoadMonBackPic: ; f6178 (3d:6178)
ld b, a
jp CopyVideoData
-Func_f61a6: ; f61a6 (3d:f61a6)
+AnimateSendingOutMon: ; f61a6 (3d:f61a6)
ld a, [wPredefRegisters]
ld h, a
ld a, [wPredefRegisters + 1]
@@ -227,7 +227,7 @@ Func_f61a6: ; f61a6 (3d:f61a6)
add $31
jr CopyUncompressedPicToHL
-Func_f61f9: ; f61f9 (3d:61f9)
+CopyUncompressedPicToTilemap: ; f61f9 (3d:61f9)
ld a, [wPredefRegisters]
ld h, a
ld a, [wPredefRegisters + 1]
diff --git a/engine/items/items.asm b/engine/items/items.asm
index eca9eaef..f37f9f47 100755
--- a/engine/items/items.asm
+++ b/engine/items/items.asm
@@ -1765,7 +1765,7 @@ ItemUsePokeflute: ; dfbd (3:5fbd)
.notRoute16
cp a,PEWTER_POKECENTER
jr nz,.noSnorlaxOrPikachuToWakeUp
- call CheckPikachuAsleep
+ call CheckPikachuFollowingPlayer
jr z,.noSnorlaxOrPikachuToWakeUp
callab Func_fcb01
jr nc,.noSnorlaxOrPikachuToWakeUp
diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm
index 97a65517..a3f6f7fc 100644
--- a/engine/menu/bills_pc.asm
+++ b/engine/menu/bills_pc.asm
@@ -227,7 +227,7 @@ BillsPCDeposit: ; 2156d (8:556d)
jp c, BillsPCMenu
callab IsThisPartymonStarterPikachu_Party
jr nc, .asm_215ad
- call CheckPikachuAsleep
+ call CheckPikachuFollowingPlayer
jr z, .asm_215ad
ld hl, SleepingPikachuText2
call PrintText
diff --git a/engine/menu/party_menu.asm b/engine/menu/party_menu.asm
index 8683d3cb..16bea473 100755
--- a/engine/menu/party_menu.asm
+++ b/engine/menu/party_menu.asm
@@ -53,7 +53,7 @@ RedrawPartyMenu_: ; 11886 (4:5886)
ld [wWhichPokemon],a
callab IsThisPartymonStarterPikachu_Party
jr nc, .regularMon
- call CheckPikachuAsleep
+ call CheckPikachuFollowingPlayer
jr z, .regularMon
ld a, $ff
ld [hPartyMonIndex], a
diff --git a/engine/overworld/cable_club_npc.asm b/engine/overworld/cable_club_npc.asm
index 4170a936..f60042de 100755
--- a/engine/overworld/cable_club_npc.asm
+++ b/engine/overworld/cable_club_npc.asm
@@ -1,7 +1,7 @@
CableClubNPC: ; 7035 (1:7035)
ld hl, CableClubNPCWelcomeText
call PrintText
- call CheckPikachuAsleep
+ call CheckPikachuFollowingPlayer
jr nz, .asm_7048
CheckEvent EVENT_GOT_POKEDEX
jp nz, .receivedPokedex
diff --git a/engine/overworld/item.asm b/engine/overworld/item.asm
index f4f46535..e421a946 100644
--- a/engine/overworld/item.asm
+++ b/engine/overworld/item.asm
@@ -51,4 +51,4 @@ FoundItemText: ; 4d9a (1:4d9a)
NoMoreRoomForItemText: ; 4da0 (1:4da0)
TX_FAR _NoMoreRoomForItemText
- db "@" \ No newline at end of file
+ db "@"
diff --git a/engine/overworld/missable_objects.asm b/engine/overworld/missable_objects.asm
index 65305d30..1cc15be5 100644
--- a/engine/overworld/missable_objects.asm
+++ b/engine/overworld/missable_objects.asm
@@ -30,17 +30,17 @@ MarkTownVisitedAndLoadMissableObjects: ; ef93 (3:6f93)
ld a, h
ld [H_DIVIDEND], a
ld a, l
- ld [H_DIVIDEND+1], a
+ ld [H_DIVIDEND + 1], a
xor a
- ld [H_DIVIDEND+2], a
- ld [H_DIVIDEND+3], a
+ ld [H_DIVIDEND + 2], a
+ ld [H_DIVIDEND + 3], a
ld a, $3
ld [H_DIVISOR], a
ld b, $2
call Divide ; divide difference by 3, resulting in the global offset (number of missable items before ours)
ld a, [wCurMap]
ld b, a
- ld a, [H_DIVIDEND+3]
+ ld a, [H_DIVIDEND + 3]
ld c, a ; store global offset in c
ld de, wMissableObjectList
pop hl
diff --git a/engine/overworld/pokecenter.asm b/engine/overworld/pokecenter.asm
index 3024ff7b..b9307517 100755
--- a/engine/overworld/pokecenter.asm
+++ b/engine/overworld/pokecenter.asm
@@ -2,7 +2,7 @@ DisplayPokemonCenterDialogue_: ; 6d97 (1:6d97)
ld a, [wCurMap]
cp PEWTER_POKECENTER
jr nz, .regularCenter
- call CheckPikachuAsleep
+ call CheckPikachuFollowingPlayer
jr z, .regularCenter
ld hl, LooksContentText ; if pikachu is sleeping, don't heal
call PrintText
@@ -27,7 +27,7 @@ DisplayPokemonCenterDialogue_: ; 6d97 (1:6d97)
call SetLastBlackoutMap
callab IsStarterPikachuInOurParty
jr nc, .notHealingPlayerPikachu
- call CheckPikachuAsleep
+ call CheckPikachuFollowingPlayer
jr nz, .notHealingPlayerPikachu
call LoadCurrentMapView
call Delay3
@@ -38,7 +38,7 @@ DisplayPokemonCenterDialogue_: ; 6d97 (1:6d97)
call PrintText
ld c, 64
call DelayFrames
- call CheckPikachuAsleep
+ call CheckPikachuFollowingPlayer
jr nz, .playerPikachuNotOnScreen
call Func_152d
callab IsStarterPikachuInOurParty
@@ -58,7 +58,7 @@ DisplayPokemonCenterDialogue_: ; 6d97 (1:6d97)
ld [wLastMusicSoundID], a
ld [wNewSoundID], a
call PlaySound
- call CheckPikachuAsleep
+ call CheckPikachuFollowingPlayer
jr nz, .doNotReturnPikachu
callab IsStarterPikachuInOurParty
call c, Func_6eaa
diff --git a/engine/overworld/try_pushing_boulder.asm b/engine/overworld/try_pushing_boulder.asm
index d978a083..89e83ff9 100644
--- a/engine/overworld/try_pushing_boulder.asm
+++ b/engine/overworld/try_pushing_boulder.asm
@@ -2,6 +2,7 @@ TryPushingBoulder: ; f0a1 (3:70a1)
ld a, [wd728]
bit 0, a ; using Strength?
ret z
+Func_f0a7: ; f0a7 (3:70a7)
; where LoadMissableObjects predef points to now
ld a, [wFlags_0xcd60]
bit 1, a ; has boulder dust animation from previous push played yet?
diff --git a/engine/pikachu_pic_animation.asm b/engine/pikachu_pic_animation.asm
index c16e3e5f..bfac6962 100755
--- a/engine/pikachu_pic_animation.asm
+++ b/engine/pikachu_pic_animation.asm
@@ -247,7 +247,7 @@ Func_fd05e: ; fd05e (3f:505e)
bit 7, [hl]
ld a, $1d
jr z, .asm_fd0c9
- call CheckPikachuAsleep
+ call CheckPikachuFollowingPlayer
ld a, $1e
jr nz, .asm_fd0c9
jr .asm_fd096
@@ -255,7 +255,7 @@ Func_fd05e: ; fd05e (3f:505e)
ld a, [wCurMap]
cp PEWTER_POKECENTER
jr nz, .notPewterPokecenter
- call CheckPikachuAsleep
+ call CheckPikachuFollowingPlayer
ld a, $1a
jr nz, .asm_fd0c9
jr .asm_fd096
@@ -863,10 +863,10 @@ Data_fd3b0:
db $04, $80, $07, $80 ; $1a
db $05, $80, $07, $80 ; $1b
db $06, $80, $07, $80 ; $1c
- db $0b, $27, $02, $00 ; $1d
- db $0c, $27, $02, $00 ; $1e
- db $0d, $27, $02, $00 ; $1f
- db $0e, $27, $02, $00 ; $20
+ db $0b, $27, $02, $00 ; $1d step down
+ db $0c, $27, $02, $00 ; $1e step up
+ db $0d, $27, $02, $00 ; $1f step left
+ db $0e, $27, $02, $00 ; $20 step right
db $0f, $27, $02, $00 ; $21
db $10, $27, $02, $00 ; $22
db $11, $27, $02, $00 ; $23
@@ -887,10 +887,10 @@ Data_fd3b0:
db $10, $0f, $08, $17 ; $32
db $11, $0f, $08, $17 ; $33
db $12, $0f, $08, $17 ; $34
- db $13, $0f, $06, $00 ; $35
- db $14, $0f, $06, $00 ; $36
- db $15, $0f, $06, $00 ; $37
- db $16, $0f, $06, $00 ; $38
+ db $13, $0f, $06, $00 ; $35 look down
+ db $14, $0f, $06, $00 ; $36 look up
+ db $15, $0f, $06, $00 ; $37 look left
+ db $16, $0f, $06, $00 ; $38 look right
db $02, $80, $04, $00 ; $39
db $02, $80, $05, $00 ; $3a
db $02, $80, $03, $80 ; $3b
@@ -1636,7 +1636,7 @@ PikachuPewterPokecenterCheck: ; fd8d4 (3f:58d4)
ld a, [wCurMap]
cp PEWTER_POKECENTER
ret nz
- call ResetPikachuAsleep
+ call EnablePikachuFollowingPlayer
call Func_fcff2
ret
@@ -1644,7 +1644,7 @@ PikachuFanClubCheck: ; fd8e1 (3f:58e1)
ld a, [wCurMap]
cp POKEMON_FAN_CLUB
ret nz
- call ResetPikachuAsleep
+ call EnablePikachuFollowingPlayer
call Func_fcff2
ret
@@ -1652,7 +1652,7 @@ PikachuBillsHouseCheck: ; fd8ee (3f:58ee)
ld a, [wCurMap]
cp BILLS_HOUSE
ret nz
- call ResetPikachuAsleep
+ call EnablePikachuFollowingPlayer
ret
Pikachu_LoadCurrentMapViewUpdateSpritesAndDelay3: ; fd8f8 (3f:58f8)
diff --git a/engine/predefs.asm b/engine/predefs.asm
index 3ec98577..9a97fe95 100755
--- a/engine/predefs.asm
+++ b/engine/predefs.asm
@@ -1,153 +1,162 @@
GetPredefPointer: ; f67ed (3d:67ed)
-; Store the contents of the register
-; pairs (hl, de, bc) at wPredefRegisters.
-; Then put the bank and address of predef
-; wPredefID in [wPredefBank] and hl.
+ ; Store the contents of the register
+ ; pairs (hl, de, bc) at wPredefRegisters.
+ ; Then put the bank and address of predef
+ ; wPredefID in [wPredefBank] and hl.
- ld a,h
- ld [wPredefRegisters],a
- ld a,l
- ld [wPredefRegisters + 1],a
+ ld a, h
+ ld [wPredefRegisters], a
+ ld a, l
+ ld [wPredefRegisters + 1], a
- ld hl,wPredefRegisters + 2
- ld a,d
- ld [hli],a
- ld a,e
- ld [hli],a
+ ld hl, wPredefRegisters + 2
+ ld a, d
+ ld [hli], a
+ ld a, e
+ ld [hli], a
- ld a,b
- ld [hli],a
- ld [hl],c
+ ld a, b
+ ld [hli], a
+ ld [hl], c
- ld hl,PredefPointers
- ld de,0
+ ld hl, PredefPointers
+ ld de, 0
- ld a,[wPredefID]
- ld e,a
+ ld a, [wPredefID]
+ ld e, a
add a
add e
- ld e,a
- jr nc,.nocarry
+ ld e, a
+ jr nc, .nocarry
inc d
.nocarry
- add hl,de
- ld d,h
- ld e,l
+ add hl, de
+ ld d, h
+ ld e, l
; get bank of predef routine
- ld a,[de]
- ld [wPredefBank],a
+ ld a, [de]
+ ld [wPredefBank], a
; get pointer
inc de
- ld a,[de]
- ld l,a
+ ld a, [de]
+ ld l, a
inc de
- ld a,[de]
- ld h,a
+ ld a, [de]
+ ld h, a
ret
PredefPointers:: ; f681d (3d:681d)
-; these are pointers to ASM routines.
-; they appear to be used in overworld map scripts.
- dbw BANK(DrawPlayerHUDAndHPBar), DrawPlayerHUDAndHPBar ; add_predef DrawPlayerHUDAndHPBar
- dbw $3d, $61f9 ; add_predef CopyUncompressedPicToTilemap
- dbw $3d, $61a6 ; add_predef Func_3f073
- dbw $0b, $7d79 ; add_predef ScaleSpriteByTwo
- dbw $3d, $6178 ; add_predef LoadMonBackPic
- dbw $1e, $5c16 ; add_predef CopyDownscaledMonTiles
- dbw $03, $70a7 ; add_predef LoadMissableObjects
- dbw $03, $752b ; add_predef HealParty
- dbw $1e, $4d97 ; add_predef MoveAnimation; 08 play move animation
- dbw $03, $75a4 ; add_predef DivideBCDPredef
- dbw $03, $75a4 ; add_predef DivideBCDPredef2
- dbw $03, $76a3 ; add_predef AddBCDPredef
- dbw $03, $76bc ; add_predef SubBCDPredef
- dbw $03, $75a4 ; add_predef DivideBCDPredef3
- dbw $03, $75a4 ; add_predef DivideBCDPredef4
- dbw $03, $76d6 ; add_predef InitPlayerData
- dbw $03, $74ec ; add_predef FlagActionPredef
- dbw $03, $7053 ; add_predef HideObject
- dbw $03, $7022 ; add_predef IsObjectHidden
- dbw $03, $43de ; add_predef ApplyOutOfBattlePoisonDamage
- dbw $0f, $4ae8 ; add_predef AnyPartyAlive
- dbw $03, $7044 ; add_predef ShowObject
- dbw $03, $7044 ; add_predef ShowObject2
- dbw $03, $6d1b ; add_predef ReplaceTileBlock
- dbw $03, $76d6 ; add_predef InitPlayerData2
- dbw $03, $44f4 ; add_predef LoadTilesetHeader
- dbw $0e, $700c ; add_predef LearnMoveFromLevelUp
- dbw $01, $6bc8 ; add_predef LearnMove
- dbw $03, $7735 ; add_predef IsItemInBag_
- dbw $03, $3ef9 ; dbw $03,CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; for these two, the ba
- dbw $03, $3e3f ; dbw $03,GiveItem
- dbw $0a, $7d4c ; add_predef InvertBGPal_4Frames
- dbw $03, $774a ; add_predef FindPathToPlayer
- dbw $0a, $7d67 ; add_predef Func_480ff
- dbw $03, $77b9 ; add_predef CalcPositionOfPlayerRelativeToNPC
- dbw $03, $7830 ; add_predef ConvertNPCMovementDirectionsToJoypadMasks
- dbw $0a, $7d8d ; add_predef Func_48125
- dbw $03, $78ad ; add_predef UpdateHPBar
- dbw $03, $786c ; add_predef HPBarLength
- dbw $01, $5b64 ; add_predef Diploma_TextBoxBorder
- dbw $0f, $6e8e ; add_predef DoubleOrHalveSelectedStats
- dbw $10, $4000 ; add_predef ShowPokedexMenu
- dbw $0e, $6dc6 ; add_predef EvolutionAfterBattle
- dbw $1c, $7ae5 ; add_predef SaveSAVtoSRAM0
- dbw $3d, $5ff8 ; add_predef InitOpponent
- dbw $01, $5b13 ; add_predef CableClub_Run
- dbw $03, $6880 ; add_predef DrawBadges
- dbw $10, $53f6 ; add_predef ExternalClockTradeAnim
- dbw $1c, $49d7 ; add_predef BattleTransition
- dbw $1e, $5f7b ; add_predef CopyTileIDsFromList
- dbw $10, $5997 ; add_predef PlayIntro
- dbw $1e, $59c5 ; add_predef Func_79869
- dbw $1c, $4bd0 ; add_predef FlashScreen
- dbw $03, $42d1 ; add_predef GetTileAndCoordsInFrontOfPlayer
- dbw $04, $54cc ; add_predef StatusScreen
- dbw $04, $56fb ; add_predef StatusScreen2
- dbw $10, $53e5 ; add_predef InternalClockTradeAnim
- dbw $15, $685b ; add_predef TrainerEngage
- dbw $10, $509d ; add_predef IndexToPokedex
- dbw $01, $600d ; add_predef DisplayPicCenteredOrUpperRight; 3B display pic?
- dbw $03, $6dd1 ; add_predef UsedCut
- dbw $10, $4312 ; add_predef ShowPokedexData
- dbw $0e, $713f ; add_predef WriteMonMoves
- dbw $1c, $7a67 ; add_predef SaveSAV
- dbw $1c, $61f8 ; add_predef LoadSGB
- dbw $03, $6f93 ; add_predef MarkTownVisitedAndLoadMissableObjects
- dbw $17, $5b93 ; add_predef SetPartyMonTypes
- dbw $04, $62f0 ; add_predef CanLearnTM
- dbw $04, $631d ; add_predef TMToMove
- dbw $1c, $5eb3 ; add_predef Func_71ddf
- dbw $17, $40d4 ; add_predef StarterDex ; 46
- dbw $03, $7161 ; add_predef _AddPartyMon
- dbw $03, $78ad ; add_predef UpdateHPBar2
- dbw $0f, $4eb1 ; add_predef DrawEnemyHUDAndHPBar
- dbw $1c, $4fe4 ; add_predef LoadTownMap_Nest
- dbw $09, $7d20 ; add_predef PrintMonType
- dbw $10, $516f ; add_predef EmotionBubble; 4C player exclamation
- dbw $01, $5b63 ; add_predef EmptyFunc3; return immediately
- dbw $01, $625d ; add_predef AskName
- dbw $06, $66e5 ; add_predef PewterGuys
- dbw $1c, $7b56 ; add_predef SaveSAVtoSRAM2
- dbw $1c, $7a24 ; add_predef LoadSAVCheckSum2
- dbw $1c, $7959 ; add_predef LoadSAV
- dbw $1c, $7b32 ; add_predef SaveSAVtoSRAM1
- dbw $1c, $5b86 ; add_predef DoInGameTradeDialogue ; 54 initiate trade
- dbw $3c, $4f26 ; add_predef HallOfFamePC
- dbw $11, $4169 ; add_predef DisplayDexRating
- dbw $1e, $4615 ; dbw $1E, _LeaveMapAnim ; wrong bank
- dbw $1e, $4567 ; dbw $1E, EnterMapAnim ; wrong bank
- dbw $03, $4309 ; add_predef GetTileTwoStepsInFrontOfPlayer
- dbw $03, $4356 ; add_predef CheckForCollisionWhenPushingBoulder
- dbw $3d, $5b06 ; add_predef PrintStrengthTxt
- dbw $01, $4d55 ; add_predef PickupItem
- dbw $09, $7d4d ; add_predef PrintMoveType
- dbw $03, $72f9 ; add_predef LoadMovePPs
- dbw $04, $5468 ; add_predef DrawHP ; 5F
- dbw $04, $546f ; add_predef DrawHP2
- dbw $07, $4264 ; add_predef Func_1c9c6
- dbw $16, $4ecc ; add_predef OaksAideScript
+ ; these are pointers to ASM routines.
+ ; they appear to be used in overworld map scripts.
+ const_def
+ add_predef DrawPlayerHUDAndHPBar
+ add_predef CopyUncompressedPicToTilemap
+ add_predef AnimateSendingOutMon
+ add_predef ScaleSpriteByTwo
+ add_predef LoadMonBackPic
+ add_predef CopyDownscaledMonTiles
+ add_predef Func_f0a7
+ add_predef HealParty
+ add_predef MoveAnimation ; 08 play move animation (1e:4d97)
+ add_predef DivideBCDPredef
+ add_predef DivideBCDPredef2
+ add_predef AddBCDPredef
+ add_predef SubBCDPredef
+ add_predef DivideBCDPredef3
+ add_predef DivideBCDPredef4
+ add_predef InitPlayerData
+ add_predef FlagActionPredef
+ add_predef HideObject
+ add_predef IsObjectHidden
+ add_predef ApplyOutOfBattlePoisonDamage
+ add_predef AnyPartyAlive
+ add_predef ShowObject
+ add_predef ShowObject2
+ add_predef ReplaceTileBlock
+ add_predef InitPlayerData2
+ add_predef LoadTilesetHeader
+ add_predef LearnMoveFromLevelUp
+ add_predef LearnMove
+ add_predef GetQuantityOfItemInBag
+
+ predef_const CheckForHiddenObjectOrBookshelfOrCardKeyDoor
+ predef_const GiveItem
+ dbw $03, CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; home bank
+ dbw $03, GiveItem ; home bank
+
+ add_predef InvertBGPal_4Frames
+ add_predef FindPathToPlayer
+ add_predef PredefShakeScreenVertically
+ add_predef CalcPositionOfPlayerRelativeToNPC
+ add_predef ConvertNPCMovementDirectionsToJoypadMasks
+ add_predef PredefShakeScreenHorizontally
+ add_predef UpdateHPBar
+ add_predef HPBarLength
+ add_predef Diploma_TextBoxBorder
+ add_predef DoubleOrHalveSelectedStats
+ add_predef ShowPokedexMenu
+ add_predef EvolutionAfterBattle
+ add_predef SaveSAVtoSRAM0
+ add_predef InitOpponent
+ add_predef CableClub_Run
+ add_predef DrawBadges
+ add_predef ExternalClockTradeAnim
+ add_predef BattleTransition
+ add_predef CopyTileIDsFromList
+ add_predef PlayIntro
+ add_predef GetMoveSoundB
+ add_predef FlashScreen
+ add_predef GetTileAndCoordsInFrontOfPlayer
+ add_predef StatusScreen
+ add_predef StatusScreen2
+ add_predef InternalClockTradeAnim
+ add_predef TrainerEngage
+ add_predef IndexToPokedex
+ add_predef DisplayPicCenteredOrUpperRight ; 3B display pic? (01:600d)
+ add_predef UsedCut
+ add_predef ShowPokedexData
+ add_predef WriteMonMoves
+ add_predef SaveSAV
+ add_predef LoadSGB
+ add_predef MarkTownVisitedAndLoadMissableObjects
+ add_predef SetPartyMonTypes
+ add_predef CanLearnTM
+ add_predef TMToMove
+ add_predef _RunPaletteCommand
+ add_predef StarterDex ; 46 (17:40d4)
+ add_predef _AddPartyMon
+ add_predef UpdateHPBar2
+ add_predef DrawEnemyHUDAndHPBar
+ add_predef LoadTownMap_Nest
+ add_predef PrintMonType
+ add_predef EmotionBubble ; 4C player exclamation (10:516f)
+ add_predef EmptyFunc3 ; return immediately (01:5b63)
+ add_predef AskName
+ add_predef PewterGuys
+ add_predef SaveSAVtoSRAM2
+ add_predef LoadSAV2
+ add_predef LoadSAV
+ add_predef SaveSAVtoSRAM1
+ add_predef DoInGameTradeDialogue ; 54 initiate trade (1c:5b86)
+ add_predef HallOfFamePC
+ add_predef DisplayDexRating
+
+ predef_const _LeaveMapAnim
+ predef_const EnterMapAnim
+ dbw $1E, _LeaveMapAnim ; wrong bank
+ dbw $1E, EnterMapAnim ; wrong bank
+
+ add_predef GetTileTwoStepsInFrontOfPlayer
+ add_predef CheckForCollisionWhenPushingBoulder
+ add_predef PrintStrengthTxt
+ add_predef PickUpItem
+ add_predef PrintMoveType
+ add_predef LoadMovePPs
+ add_predef DrawHP ; 5F (04:5468)
+ add_predef DrawHP2
+ add_predef DisplayElevatorFloorMenu
+ add_predef OaksAideScript