ref: fb0a630c062cbb18026abe2792339dea27fac4d8
parent: 4aedff021786dd5c0b81d3a35f505b7aa42adddc
author: dannye <corrnondacqb@yahoo.com>
date: Mon Aug 10 20:34:32 EDT 2015
More joypad constants
--- a/engine/hidden_object_functions17.asm
+++ b/engine/hidden_object_functions17.asm
@@ -98,7 +98,7 @@
ld [W_ANIMATIONID], a
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
- ld a, $3
+ ld a, A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
ld a, $3
ld [wMaxMenuItem], a
@@ -106,7 +106,7 @@
ld [wTopMenuItemY], a
ld a, $1
ld [wTopMenuItemX], a
-.asm_5c51
+.linkHelpLoop
ld hl, wd730
set 6, [hl]
coord hl, 0, 0
@@ -119,11 +119,11 @@
ld hl, LinkCableHelpText2
call PrintText
call HandleMenuInput
- bit 1, a
- jr nz, .asm_5dc93
+ bit 1, a ; pressed b
+ jr nz, .exit
ld a, [wCurrentMenuItem]
- cp $3
- jr z, .asm_5dc93
+ cp $3 ; pressed a on "STOP READING"
+ jr z, .exit
ld hl, wd730
res 6, [hl]
ld hl, LinkCableInfoTexts
@@ -135,8 +135,8 @@
ld h, [hl]
ld l, a
call PrintText
- jp .asm_5c51
-.asm_5dc93
+ jp .linkHelpLoop
+.exit
ld hl, wd730
res 6, [hl]
call LoadScreenTilesFromBuffer1
@@ -182,7 +182,7 @@
ld [W_ANIMATIONID], a
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
- ld a, $33
+ ld a, D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
ld a, $2
ld [wMaxMenuItem], a
@@ -190,7 +190,7 @@
ld [wTopMenuItemY], a
ld a, $1
ld [wTopMenuItemX], a
-.asm_5dd15
+.blackboardLoop
ld hl, wd730
set 6, [hl]
coord hl, 0, 0
@@ -204,11 +204,12 @@
call PlaceString
ld hl, ViridianSchoolBlackboardText2
call PrintText
- call HandleMenuInput
- bit 1, a
+ call HandleMenuInput ; pressing up and down is handled in here
+ bit 1, a ; pressed b
jr nz, .exitBlackboard
- bit 4, a
- jr z, .asm_5dd5c
+ bit 4, a ; pressed right
+ jr z, .didNotPressRight
+ ; move cursor to right column
ld a, $2
ld [wMaxMenuItem], a
ld a, $2
@@ -217,10 +218,11 @@
ld [wTopMenuItemX], a
ld a, $3
ld [W_ANIMATIONID], a
- jr .asm_5dd15
-.asm_5dd5c
- bit 5, a
- jr z, .asm_5dd75
+ jr .blackboardLoop
+.didNotPressRight
+ bit 5, a ; pressed left
+ jr z, .didNotPressLeftOrRight
+ ; move cursor to left column
ld a, $2
ld [wMaxMenuItem], a
ld a, $2
@@ -229,14 +231,16 @@
ld [wTopMenuItemX], a
xor a
ld [W_ANIMATIONID], a
- jr .asm_5dd15
-.asm_5dd75
+ jr .blackboardLoop
+.didNotPressLeftOrRight
ld a, [wCurrentMenuItem]
ld b, a
ld a, [W_ANIMATIONID]
add b
- cp $5
+ cp $5 ; cursor is pointing to "QUIT"
jr z, .exitBlackboard
+ ; we must have pressed a on a status condition
+ ; so print the text
ld hl, wd730
res 6, [hl]
ld hl, ViridianBlackboardStatusPointers
@@ -248,7 +252,7 @@
ld h, [hl]
ld l, a
call PrintText
- jp .asm_5dd15
+ jp .blackboardLoop
.exitBlackboard
ld hl, wd730
res 6, [hl]
--- a/engine/hidden_object_functions7.asm
+++ b/engine/hidden_object_functions7.asm
@@ -394,7 +394,7 @@
ld [W_ANIMATIONID], a
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
- ld a, $3
+ ld a, A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
ld a, $4
ld [wMaxMenuItem], a
@@ -402,7 +402,7 @@
ld [wTopMenuItemY], a
ld a, $1
ld [wTopMenuItemX], a
-.asm_1ec2d
+.billsPokemonLoop
ld hl, wd730
set 6, [hl]
coord hl, 0, 0
@@ -416,24 +416,24 @@
call PrintText
call SaveScreenTilesToBuffer2
call HandleMenuInput
- bit 1, a
- jr nz, .asm_1ec74
+ bit 1, a ; pressed b
+ jr nz, .cancel
ld a, [wCurrentMenuItem]
add EEVEE
cp EEVEE
- jr z, .asm_1ec6c
+ jr z, .displayPokedex
cp FLAREON
- jr z, .asm_1ec6c
+ jr z, .displayPokedex
cp JOLTEON
- jr z, .asm_1ec6c
+ jr z, .displayPokedex
cp VAPOREON
- jr z, .asm_1ec6c
- jr .asm_1ec74
-.asm_1ec6c
+ jr z, .displayPokedex
+ jr .cancel
+.displayPokedex
call DisplayPokedex
call LoadScreenTilesFromBuffer2
- jr .asm_1ec2d
-.asm_1ec74
+ jr .billsPokemonLoop
+.cancel
ld hl, wd730
res 6, [hl]
call LoadScreenTilesFromBuffer2
--- a/engine/learn_move.asm
+++ b/engine/learn_move.asm
@@ -116,7 +116,7 @@
call CopyData
callab FormatMovesString
pop hl
-.asm_6f39
+.loop
push hl
ld hl, WhichMoveToForgetText
call PrintText
@@ -155,8 +155,8 @@
call LoadScreenTilesFromBuffer1
pop af
pop hl
- bit 1, a
- jr nz, .asm_6fab
+ bit 1, a ; pressed b
+ jr nz, .cancel
push hl
ld a, [wCurrentMenuItem]
ld c, a
@@ -169,17 +169,17 @@
pop bc
pop de
ld a, d
- jr c, .asm_6fa2
+ jr c, .hm
pop hl
add hl, bc
and a
ret
-.asm_6fa2
+.hm
ld hl, HMCantDeleteText
call PrintText
pop hl
- jr .asm_6f39
-.asm_6fab
+ jr .loop
+.cancel
scf
ret
--- a/engine/menu/main_menu.asm
+++ b/engine/menu/main_menu.asm
@@ -61,7 +61,7 @@
ld [wTopMenuItemX],a
inc a
ld [wTopMenuItemY],a
- ld a,$B
+ ld a,A_BUTTON | B_BUTTON | START
ld [wMenuWatchedKeys],a
ld a,[wSaveFileStatus]
ld [wMaxMenuItem],a
@@ -163,7 +163,8 @@
ld a, $2
ld [hli], a
inc a
- ld [hli], a
+ ; ld a, A_BUTTON | B_BUTTON
+ ld [hli], a ; wMenuWatchedKeys
xor a
ld [hl], a
.waitForInputLoop
--- a/engine/menu/pokedex.asm
+++ b/engine/menu/pokedex.asm
@@ -27,7 +27,7 @@
inc hl
ld a,6
ld [hli],a ; max menu item ID
- ld [hl],%00110011 ; menu watched keys (Left, Right, B button, A button)
+ ld [hl],D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON
call HandlePokedexListMenu
jr c,.goToSideMenu ; if the player chose a pokemon from the list
.exitPokedex
@@ -88,6 +88,7 @@
inc hl
ld a,3
ld [hli],a ; max menu item ID
+ ;ld a, A_BUTTON | B_BUTTON
ld [hli],a ; menu watched keys (A button and B button)
xor a
ld [hli],a ; old menu item ID
--- a/engine/menu/prize_menu.asm
+++ b/engine/menu/prize_menu.asm
@@ -13,7 +13,7 @@
xor a
ld [wCurrentMenuItem],a
ld [wLastMenuItem],a
- ld a,$03
+ ld a,A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys],a
ld a,$03
ld [wMaxMenuItem],a
--- a/engine/menu/start_sub_menus.asm
+++ b/engine/menu/start_sub_menus.asm
@@ -57,7 +57,7 @@
inc hl
ld a,b
ld [hli],a ; max menu item ID
- ld a,%00000011 ; A button, B button
+ ld a,A_BUTTON | B_BUTTON
ld [hli],a ; menu watched keys
xor a
ld [hl],a
@@ -354,7 +354,7 @@
inc hl
inc a ; a = 1
ld [hli],a ; max menu item ID
- ld a,%00000011 ; A button, B button
+ ld a,A_BUTTON | B_BUTTON
ld [hli],a ; menu watched keys
xor a
ld [hl],a ; old menu item id
--- a/engine/oak_speech2.asm
+++ b/engine/oak_speech2.asm
@@ -177,7 +177,7 @@
ld [wLastMenuItem], a
inc a
ld [wTopMenuItemX], a
- ld [wMenuWatchedKeys], a
+ ld [wMenuWatchedKeys], a ; A_BUTTON
inc a
ld [wTopMenuItemY], a
inc a
--- a/engine/save.asm
+++ b/engine/save.asm
@@ -356,7 +356,7 @@
call HandleMenuInput
ld hl, hFlags_0xFFF6
res 1, [hl]
- bit 1, a
+ bit 1, a ; pressed b
ret nz
call GetBoxSRAMLocation
ld e, l
--- a/main.asm
+++ b/main.asm
@@ -1082,7 +1082,7 @@
ld c,$08
.drawTextBoxBorder
call TextBoxBorder
- ld a,%11001011 ; bit mask for down, up, start, B, and A buttons
+ ld a,D_DOWN | D_UP | START | B_BUTTON | A_BUTTON
ld [wMenuWatchedKeys],a
ld a,$02
ld [wTopMenuItemY],a ; Y position of first menu choice
--- a/scripts/bikeshop.asm
+++ b/scripts/bikeshop.asm
@@ -39,7 +39,7 @@
xor a
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
- ld a, $3
+ ld a, A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
ld a, $1
ld [wMaxMenuItem], a
@@ -64,16 +64,16 @@
call PrintText
call HandleMenuInput
bit 1, a
- jr nz, .asm_b7579
+ jr nz, .cancel
ld hl, wd730
res 6, [hl]
ld a, [wCurrentMenuItem]
and a
- jr nz, .asm_b7579
- ld hl, BikeShopText_1d81a
+ jr nz, .cancel
+ ld hl, BikeShopCantAffordText
call PrintText
-.asm_b7579
- ld hl, BikeShopText_1d82a
+.cancel
+ ld hl, BikeShopComeAgainText
call PrintText
.Done
jp TextScriptEnd
@@ -93,8 +93,8 @@
TX_FAR _BikeShopText_1d815
db "@"
-BikeShopText_1d81a: ; 1d81a (7:581a)
- TX_FAR _BikeShopText_1d81a
+BikeShopCantAffordText: ; 1d81a (7:581a)
+ TX_FAR _BikeShopCantAffordText
db "@"
BikeShopText_1d81f: ; 1d81f (7:581f)
@@ -105,8 +105,8 @@
TX_FAR _BikeShopText_1d824
db $11, "@"
-BikeShopText_1d82a: ; 1d82a (7:582a)
- TX_FAR _BikeShopText_1d82a
+BikeShopComeAgainText: ; 1d82a (7:582a)
+ TX_FAR _BikeShopComeAgainText
db "@"
BikeShopText_1d82f: ; 1d82f (7:582f)
--- a/scripts/celadonmartroof.asm
+++ b/scripts/celadonmartroof.asm
@@ -46,7 +46,7 @@
call PrintText
xor a
ld [wCurrentMenuItem], a
- ld a, $3
+ ld a, A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
ld a, [wcd37]
dec a
@@ -70,7 +70,7 @@
ld hl, wd730
res 6, [hl]
call HandleMenuInput
- bit 1, a
+ bit 1, a ; pressed b
ret nz
ld hl, wcc5b
ld a, [wCurrentMenuItem]
--- a/text/maps/bike_shop.asm
+++ b/text/maps/bike_shop.asm
@@ -11,7 +11,7 @@
line "Do you want it?"
done
-_BikeShopText_1d81a:: ; 98e67 (26:4e67)
+_BikeShopCantAffordText:: ; 98e67 (26:4e67)
text "Sorry! You can't"
line "afford it!"
prompt
@@ -29,7 +29,7 @@
line "the BIKE VOUCHER"
cont "for a BICYCLE.@@"
-_BikeShopText_1d82a:: ; 98ee0 (26:4ee0)
+_BikeShopComeAgainText:: ; 98ee0 (26:4ee0)
text "Come back again"
line "some time!"
done