Conflicts:
	engine/town_map.asm
This commit is contained in:
dannye 2015-07-14 00:58:09 -05:00
commit e25a7148d0
43 changed files with 1136 additions and 847 deletions

View file

@ -12,3 +12,9 @@ ITEM_NAME EQU 4
PLAYEROT_NAME EQU 5 PLAYEROT_NAME EQU 5
ENEMYOT_NAME EQU 6 ENEMYOT_NAME EQU 6
TRAINER_NAME EQU 7 TRAINER_NAME EQU 7
INIT_ENEMYOT_LIST EQU 1
INIT_BAG_ITEM_LIST EQU 2
INIT_OTHER_ITEM_LIST EQU 3
INIT_PLAYEROT_LIST EQU 4
INIT_MON_LIST EQU 5

View file

@ -58,6 +58,57 @@ TRADE_CANCEL_MENU EQU 5
HEAL_CANCEL_MENU EQU 6 HEAL_CANCEL_MENU EQU 6
NO_YES_MENU EQU 7 NO_YES_MENU EQU 7
; menu exit method constants for list menus and the buy/sell/quit menu
CHOSE_MENU_ITEM EQU 1 ; pressed A
CANCELLED_MENU EQU 2 ; pressed B
; menu exit method constants for two-option menus
CHOSE_FIRST_ITEM EQU 1
CHOSE_SECOND_ITEM EQU 2
; move mon constants
BOX_TO_PARTY EQU 0
PARTY_TO_BOX EQU 1
DAYCARE_TO_PARTY EQU 2
PARTY_TO_DAYCARE EQU 3
; emotion bubbles
EXCLAMATION_BUBBLE EQU 0
QUESTION_BUBBLE EQU 1
SMILE_BUBBLE EQU 2
; slot symbols
SLOTS7 EQU $0200
SLOTSBAR EQU $0604
SLOTSCHERRY EQU $0A08
SLOTSFISH EQU $0E0C
SLOTSBIRD EQU $1210
SLOTSMOUSE EQU $1614
; party menu types
NORMAL_PARTY_MENU EQU 0
USE_ITEM_PARTY_MENU EQU 1
BATTLE_PARTY_MENU EQU 2
TMHM_PARTY_MENU EQU 3
SWAP_MONS_PARTY_MENU EQU 4
EVO_STONE_PARTY_MENU EQU 5
; party memu message IDs
ANTIDOTE_MSG EQU $F0
BURN_HEAL_MSG EQU $F1
ICE_HEAL_MSG EQU $F2
AWAKENING_MSG EQU $F3
PARALYZ_HEAL_MSG EQU $F4
POTION_MSG EQU $F5
FULL_HEAL_MSG EQU $F6
REVIVE_MSG EQU $F7
RARE_CANDY_MSG EQU $F8
; naming screen types
NAME_PLAYER_SCREEN EQU 0
NAME_RIVAL_SCREEN EQU 1
NAME_MON_SCREEN EQU 2
; serial ; serial
ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01 ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01

View file

@ -77,7 +77,7 @@ DisplayCreditsMon: ; 740cb (1d:40cb)
call Func_74164 call Func_74164
call FillMiddleOfScreenWithWhite call FillMiddleOfScreenWithWhite
ld a,$FC ld a,$FC
ld [$FF47],a ld [rBGP],a
ld bc,7 ld bc,7
.next .next
call Func_74140 call Func_74140
@ -94,7 +94,7 @@ DisplayCreditsMon: ; 740cb (1d:40cb)
xor a xor a
ld [hWY],a ld [hWY],a
ld a,$C0 ld a,$C0
ld [$FF47],a ld [rBGP],a
ret ret
INCLUDE "data/credit_mons.asm" INCLUDE "data/credit_mons.asm"
@ -133,7 +133,7 @@ Func_74164: ; 74164 (1d:4164)
ld a, l ld a, l
ld [H_AUTOBGTRANSFERDEST], a ld [H_AUTOBGTRANSFERDEST], a
ld a, h ld a, h
ld [$ffbd], a ld [H_AUTOBGTRANSFERDEST + 1], a
ld a, $1 ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a ld [H_AUTOBGTRANSFERENABLED], a
jp Delay3 jp Delay3

View file

@ -336,14 +336,14 @@ LoadAnimationTileset: ; 781d2 (1e:41d2)
ld d,0 ld d,0
add hl,de add hl,de
ld a,[hli] ld a,[hli]
ld [wd07d],a ; number of tiles ld [wTempTilesetNumTiles],a ; number of tiles
ld a,[hli] ld a,[hli]
ld e,a ld e,a
ld a,[hl] ld a,[hl]
ld d,a ; de = address of tileset ld d,a ; de = address of tileset
ld hl,vSprites + $310 ld hl,vSprites + $310
ld b, BANK(AnimationTileset1) ; ROM bank ld b, BANK(AnimationTileset1) ; ROM bank
ld a,[wd07d] ld a,[wTempTilesetNumTiles]
ld c,a ; number of tiles ld c,a ; number of tiles
jp CopyVideoData ; load tileset jp CopyVideoData ; load tileset
@ -835,9 +835,9 @@ DoRockSlideSpecialEffects: ; 78fd9 (1e:4fd9)
; if the subaninmation counter is between 8 and 11, shake the screen horizontally and vertically ; if the subaninmation counter is between 8 and 11, shake the screen horizontally and vertically
.shakeScreen .shakeScreen
ld b,1 ld b,1
predef Func_48125 ; shake horizontally predef PredefShakeScreenHorizontally ; shake horizontally
ld b,1 ld b,1
predef_jump Func_480ff ; shake vertically predef_jump PredefShakeScreenVertically ; shake vertically
FlashScreenEveryEightFrameBlocks: ; 78ff7 (1e:4ff7) FlashScreenEveryEightFrameBlocks: ; 78ff7 (1e:4ff7)
ld a,[W_SUBANIMCOUNTER] ld a,[W_SUBANIMCOUNTER]
@ -1225,14 +1225,14 @@ SetAnimationBGPalette: ; 791fc (1e:51fc)
ld b, $5 ld b, $5
AnimationShakeScreenVertically: ; 79209 (1e:5209) AnimationShakeScreenVertically: ; 79209 (1e:5209)
predef_jump Func_480ff predef_jump PredefShakeScreenVertically
AnimationShakeScreen: ; 7920e (1e:520e) AnimationShakeScreen: ; 7920e (1e:520e)
; Shakes the screen for a while. Used in Earthquake/Fissure/etc. animations. ; Shakes the screen for a while. Used in Earthquake/Fissure/etc. animations.
ld b, $8 ld b, $8
AnimationShakeScreenHorizontallyFast: ; 79210 (1e:5210) AnimationShakeScreenHorizontallyFast: ; 79210 (1e:5210)
predef_jump Func_48125 predef_jump PredefShakeScreenHorizontally
AnimationWaterDropletsEverywhere: ; 79215 (1e:5215) AnimationWaterDropletsEverywhere: ; 79215 (1e:5215)
; Draws water droplets all over the screen and makes them ; Draws water droplets all over the screen and makes them
@ -1292,12 +1292,12 @@ AnimationSlideMonUp: ; 7927a (1e:527a)
ld c, $7 ld c, $7
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
ld hl, wTileMap + $79 hlCoord 1, 6
ld de, wTileMap + $65 deCoord 1, 5
ld a, $30 ld a, $30
jr z, .asm_79291 jr z, .asm_79291
ld hl, wTileMap + $20 hlCoord 12, 1
ld de, wTileMap + $c deCoord 12, 0
ld a, $ff ld a, $ff
.asm_79291 .asm_79291
ld [wd09f], a ld [wd09f], a
@ -1345,16 +1345,16 @@ _AnimationSlideMonUp: ; 792bf (1e:52bf)
call CopyData call CopyData
pop de pop de
pop hl pop hl
ld bc, $0028 ld bc, SCREEN_WIDTH * 2
add hl, bc add hl, bc
pop bc pop bc
dec b dec b
jr nz, .asm_792c4 jr nz, .asm_792c4
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
ld hl, wTileMap + $dd hlCoord 1, 11
jr z, .asm_792e2 jr z, .asm_792e2
ld hl, wTileMap + $84 hlCoord 12, 6
.asm_792e2 .asm_792e2
ld a, [wd09f] ld a, [wd09f]
inc a inc a
@ -1513,11 +1513,11 @@ AnimationShakeBackAndForth: ; 793b1 (1e:53b1)
; The mon's sprite disappears after this animation. ; The mon's sprite disappears after this animation.
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
ld hl, wTileMap + $64 hlCoord 0, 5
ld de, wTileMap + $66 deCoord 2, 5
jr z, .asm_793c2 jr z, .asm_793c2
ld hl, wTileMap + $b hlCoord 11, 0
ld de, wTileMap + $d deCoord 13, 0
.asm_793c2 .asm_793c2
xor a xor a
@ -2061,23 +2061,24 @@ CopySlowbroSpriteData: ; 7973f (1e:573f)
ld a, BANK(SlowbroSprite) ld a, BANK(SlowbroSprite)
jp FarCopyData2 jp FarCopyData2
Func_79747: ; 79747 (1e:5747) HideSubstituteShowMonAnim: ; 79747 (1e:5747)
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
ld hl, wccf7 ld hl, wPlayerMonMinimized
ld a, [W_PLAYERBATTSTATUS2] ld a, [W_PLAYERBATTSTATUS2]
jr z, .asm_79758 jr z, .next1
ld hl, wccf3 ld hl, wEnemyMonMinimized
ld a, [W_ENEMYBATTSTATUS2] ld a, [W_ENEMYBATTSTATUS2]
.asm_79758 .next1
push hl push hl
bit 4, a ; if the substitute broke, slide it down, else slide it offscreen horizontally
jr nz, .asm_79762 bit HasSubstituteUp, a
jr nz, .substituteStillUp
call AnimationSlideMonDown call AnimationSlideMonDown
jr .asm_79765 jr .next2
.asm_79762 .substituteStillUp
call AnimationSlideMonOut call AnimationSlideMonOut
.asm_79765 .next2
pop hl pop hl
ld a, [hl] ld a, [hl]
and a and a
@ -2085,7 +2086,7 @@ Func_79747: ; 79747 (1e:5747)
call AnimationFlashMonPic call AnimationFlashMonPic
jp AnimationShowMonPic jp AnimationShowMonPic
Func_79771: ; 79771 (1e:5771) ReshowSubstituteAnim: ; 79771 (1e:5771)
call AnimationSlideMonOut call AnimationSlideMonOut
call AnimationSubstitute call AnimationSubstitute
jp AnimationShowMonPic jp AnimationShowMonPic
@ -2644,16 +2645,16 @@ Unknown_79c50: ; 79c50 (1e:5c50)
AnimationLeavesFalling: ; 79c74 (1e:5c74) AnimationLeavesFalling: ; 79c74 (1e:5c74)
; Makes leaves float down from the top of the screen. This is used ; Makes leaves float down from the top of the screen. This is used
; in Razor Leaf's animation. ; in Razor Leaf's animation.
ld a, [$ff48] ld a, [rOBP0]
push af push af
ld a, [wcc79] ld a, [wcc79]
ld [$ff48], a ld [rOBP0], a
ld d, $37 ld d, $37
ld a, $3 ld a, $3
ld [W_SUBANIMTRANSFORM], a ld [W_SUBANIMTRANSFORM], a
call Func_79c97 call Func_79c97
pop af pop af
ld [$ff48], a ld [rOBP0], a
ret ret
AnimationPetalsFalling: ; 79c8a (1e:5c8a) AnimationPetalsFalling: ; 79c8a (1e:5c8a)
@ -2870,7 +2871,7 @@ Func_79de9: ; 79de9 (1e:5de9)
Func_79e0d: ; 79e0d (1e:5e0d) Func_79e0d: ; 79e0d (1e:5e0d)
ld a, h ld a, h
ld [$ffbd], a ld [H_AUTOBGTRANSFERDEST + 1], a
ld a, l ld a, l
ld [H_AUTOBGTRANSFERDEST], a ld [H_AUTOBGTRANSFERDEST], a
jp Delay3 jp Delay3

View file

@ -53,29 +53,29 @@ FormatMovesString: ; 39b87 (e:5b87)
; XXX this is called in a few places, but it doesn't appear to do anything useful ; XXX this is called in a few places, but it doesn't appear to do anything useful
InitList: ; 39bd5 (e:5bd5) InitList: ; 39bd5 (e:5bd5)
ld a, [wd11b] ld a, [wInitListType]
cp $1 cp INIT_ENEMYOT_LIST
jr nz, .notEnemy jr nz, .notEnemy
ld hl, wEnemyPartyCount ld hl, wEnemyPartyCount
ld de, wEnemyMonOT ld de, wEnemyMonOT
ld a, ENEMYOT_NAME ld a, ENEMYOT_NAME
jr .done jr .done
.notEnemy .notEnemy
cp $4 cp INIT_PLAYEROT_LIST
jr nz, .notPlayer jr nz, .notPlayer
ld hl, wPartyCount ld hl, wPartyCount
ld de, wPartyMonOT ld de, wPartyMonOT
ld a, PLAYEROT_NAME ld a, PLAYEROT_NAME
jr .done jr .done
.notPlayer .notPlayer
cp $5 cp INIT_MON_LIST
jr nz, .notMonster jr nz, .notMonster
ld hl, wStringBuffer2 + 11 ld hl, wStringBuffer2 + 11
ld de, MonsterNames ld de, MonsterNames
ld a, MONSTER_NAME ld a, MONSTER_NAME
jr .done jr .done
.notMonster .notMonster
cp $2 cp INIT_BAG_ITEM_LIST
jr nz, .notBag jr nz, .notBag
ld hl, wNumBagItems ld hl, wNumBagItems
ld de, ItemNames ld de, ItemNames

View file

@ -848,7 +848,7 @@ FaintEnemyPokemon: ; 0x3c567
ld [hl], a ld [hl], a
ld [W_ENEMYDISABLEDMOVE], a ld [W_ENEMYDISABLEDMOVE], a
ld [wEnemyDisabledMoveNumber], a ld [wEnemyDisabledMoveNumber], a
ld [wccf3], a ld [wEnemyMonMinimized], a
ld hl, wPlayerUsedMove ld hl, wPlayerUsedMove
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
@ -1142,8 +1142,8 @@ DoUseNextMonDialogue: ; 3c79b (f:479b)
ld a, TWO_OPTION_MENU ld a, TWO_OPTION_MENU
ld [wTextBoxID], a ld [wTextBoxID], a
call DisplayTextBoxID call DisplayTextBoxID
ld a, [wd12e] ld a, [wMenuExitMethod]
cp $2 ; did the player choose NO? cp CHOSE_SECOND_ITEM ; did the player choose NO?
jr z, .tryRunning ; if the player chose NO, try running jr z, .tryRunning ; if the player chose NO, try running
and a ; reset carry and a ; reset carry
ret ret
@ -1162,8 +1162,8 @@ UseNextMonText: ; 3c7d3 (f:47d3)
; choose next player mon to send out ; choose next player mon to send out
; stores whether enemy mon has no HP left in Z flag ; stores whether enemy mon has no HP left in Z flag
ChooseNextMon: ; 3c7d8 (f:47d8) ChooseNextMon: ; 3c7d8 (f:47d8)
ld a, $2 ld a, BATTLE_PARTY_MENU
ld [wd07d], a ld [wPartyMenuTypeOrMessageID], a
call DisplayPartyMenu call DisplayPartyMenu
.checkIfMonChosen .checkIfMonChosen
jr nc, .monChosen jr nc, .monChosen
@ -1376,7 +1376,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a)
ld [hl],a ld [hl],a
ld [W_ENEMYDISABLEDMOVE],a ld [W_ENEMYDISABLEDMOVE],a
ld [wEnemyDisabledMoveNumber],a ld [wEnemyDisabledMoveNumber],a
ld [wccf3],a ld [wEnemyMonMinimized],a
ld hl,wPlayerUsedMove ld hl,wPlayerUsedMove
ld [hli],a ld [hli],a
ld [hl],a ld [hl],a
@ -1462,8 +1462,8 @@ EnemySendOutFirstMon: ; 3c92a (f:492a)
ld a,[wCurrentMenuItem] ld a,[wCurrentMenuItem]
and a and a
jr nz,.next4 jr nz,.next4
ld a,2 ld a,BATTLE_PARTY_MENU
ld [wd07d],a ld [wPartyMenuTypeOrMessageID],a
call DisplayPartyMenu call DisplayPartyMenu
.next9 .next9
ld a,1 ld a,1
@ -1826,7 +1826,7 @@ SendOutMon: ; 3cc91 (f:4c91)
ld [hl], a ld [hl], a
ld [W_PLAYERDISABLEDMOVE], a ld [W_PLAYERDISABLEDMOVE], a
ld [wPlayerDisabledMoveNumber], a ld [wPlayerDisabledMoveNumber], a
ld [wccf7], a ld [wPlayerMonMinimized], a
ld b, $1 ld b, $1
call GoPAL_SET call GoPAL_SET
ld hl, W_ENEMYBATTSTATUS1 ld hl, W_ENEMYBATTSTATUS1
@ -2296,7 +2296,7 @@ DisplayPlayerBag:
DisplayBagMenu: DisplayBagMenu:
xor a xor a
ld [wcf93], a ld [wPrintItemPrices], a
ld a, ITEMLISTMENU ld a, ITEMLISTMENU
ld [wListMenuID], a ld [wListMenuID], a
ld a, [wcc2c] ld a, [wcc2c]
@ -2305,7 +2305,7 @@ DisplayBagMenu:
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
ld [wcc2c], a ld [wcc2c], a
ld a, $0 ld a, $0
ld [wcc37], a ld [wMenuWatchMovingOutOfBounds], a
ld [wMenuItemToSwap], a ld [wMenuItemToSwap], a
jp c, DisplayBattleMenu ; go back to battle menu if an item was not selected jp c, DisplayBattleMenu ; go back to battle menu if an item was not selected
@ -2384,8 +2384,8 @@ PartyMenuOrRockOrRun:
jp UseBagItem jp UseBagItem
.partyMenuWasSelected .partyMenuWasSelected
call LoadScreenTilesFromBuffer1 call LoadScreenTilesFromBuffer1
xor a xor a ; NORMAL_PARTY_MENU
ld [wd07d], a ld [wPartyMenuTypeOrMessageID], a
ld [wMenuItemToSwap], a ld [wMenuItemToSwap], a
call DisplayPartyMenu call DisplayPartyMenu
.checkIfPartyMonWasSelected .checkIfPartyMonWasSelected
@ -2403,8 +2403,8 @@ PartyMenuOrRockOrRun:
ld bc, $81 ld bc, $81
ld a, $7f ld a, $7f
call FillMemory call FillMemory
xor a xor a ; NORMAL_PARTY_MENU
ld [wd07d], a ld [wPartyMenuTypeOrMessageID], a
call GoBackToPartyMenu call GoBackToPartyMenu
jr .checkIfPartyMonWasSelected jr .checkIfPartyMonWasSelected
.partyMonWasSelected .partyMonWasSelected
@ -2448,7 +2448,7 @@ PartyMenuOrRockOrRun:
ld hl, AnimationSubstitute ld hl, AnimationSubstitute
jr nz, .doEnemyMonAnimation jr nz, .doEnemyMonAnimation
; enemy mon doesn't have substitute ; enemy mon doesn't have substitute
ld a, [wccf3] ld a, [wEnemyMonMinimized]
and a ; has the enemy mon used Minimise? and a ; has the enemy mon used Minimise?
ld hl, AnimationMinimizeMon ld hl, AnimationMinimizeMon
jr nz, .doEnemyMonAnimation jr nz, .doEnemyMonAnimation
@ -3215,9 +3215,9 @@ getPlayerAnimationType
playPlayerMoveAnimation playPlayerMoveAnimation
push af push af
ld a,[W_PLAYERBATTSTATUS2] ld a,[W_PLAYERBATTSTATUS2]
bit 4,a bit HasSubstituteUp,a
ld hl,Func_79747 ld hl,HideSubstituteShowMonAnim
ld b,BANK(Func_79747) ld b,BANK(HideSubstituteShowMonAnim)
call nz,Bankswitch call nz,Bankswitch
pop af pop af
ld [wAnimationType],a ld [wAnimationType],a
@ -3226,9 +3226,9 @@ playPlayerMoveAnimation
call HandleExplodingAnimation call HandleExplodingAnimation
call DrawPlayerHUDAndHPBar call DrawPlayerHUDAndHPBar
ld a,[W_PLAYERBATTSTATUS2] ld a,[W_PLAYERBATTSTATUS2]
bit 4,a bit HasSubstituteUp,a
ld hl,Func_79771 ld hl,ReshowSubstituteAnim
ld b,BANK(Func_79771) ld b,BANK(ReshowSubstituteAnim)
call nz,Bankswitch call nz,Bankswitch
jr MirrorMoveCheck jr MirrorMoveCheck
playerCheckIfFlyOrChargeEffect playerCheckIfFlyOrChargeEffect
@ -3958,7 +3958,7 @@ PrintMoveFailureText: ; 3dbe2 (f:5be2)
ld hl, KeptGoingAndCrashedText ld hl, KeptGoingAndCrashedText
call PrintText call PrintText
ld b, $4 ld b, $4
predef Func_48125 predef PredefShakeScreenHorizontally
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
jr nz, .enemyTurn jr nz, .enemyTurn
@ -5089,7 +5089,7 @@ AttackSubstitute: ; 3e25e (f:625e)
ld a,[H_WHOSETURN] ld a,[H_WHOSETURN]
xor a,$01 xor a,$01
ld [H_WHOSETURN],a ld [H_WHOSETURN],a
callab Func_79747 ; animate the substitute breaking callab HideSubstituteShowMonAnim ; animate the substitute breaking
; flip the turn back to the way it was ; flip the turn back to the way it was
ld a,[H_WHOSETURN] ld a,[H_WHOSETURN]
xor a,$01 xor a,$01
@ -5767,8 +5767,8 @@ playEnemyMoveAnimation: ; 3e7a4 (f:67a4)
push af push af
ld a, [W_ENEMYBATTSTATUS2] ld a, [W_ENEMYBATTSTATUS2]
bit HasSubstituteUp, a ; does mon have a substitute? bit HasSubstituteUp, a ; does mon have a substitute?
ld hl, Func_79747 ld hl, HideSubstituteShowMonAnim
ld b, BANK(Func_79747) ld b, BANK(HideSubstituteShowMonAnim)
call nz, Bankswitch call nz, Bankswitch
pop af pop af
ld [wAnimationType], a ld [wAnimationType], a
@ -5778,8 +5778,8 @@ playEnemyMoveAnimation: ; 3e7a4 (f:67a4)
call DrawEnemyHUDAndHPBar call DrawEnemyHUDAndHPBar
ld a, [W_ENEMYBATTSTATUS2] ld a, [W_ENEMYBATTSTATUS2]
bit HasSubstituteUp, a ; does mon have a substitute? bit HasSubstituteUp, a ; does mon have a substitute?
ld hl, Func_79771 ld hl, ReshowSubstituteAnim
ld b, BANK(Func_79771) ld b, BANK(ReshowSubstituteAnim)
call nz, Bankswitch ; slide the substitute's sprite out call nz, Bankswitch ; slide the substitute's sprite out
jr EnemyCheckIfMirrorMoveEffect jr EnemyCheckIfMirrorMoveEffect
@ -6943,12 +6943,12 @@ InitBattle_Common: ; 3efeb (f:6feb)
call SaveScreenTilesToBuffer1 call SaveScreenTilesToBuffer1
call ClearScreen call ClearScreen
ld a, $98 ld a, $98
ld [$ffbd], a ld [H_AUTOBGTRANSFERDEST + 1], a
ld a, $1 ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a ld [H_AUTOBGTRANSFERENABLED], a
call Delay3 call Delay3
ld a, $9c ld a, $9c
ld [$ffbd], a ld [H_AUTOBGTRANSFERDEST + 1], a
call LoadScreenTilesFromBuffer1 call LoadScreenTilesFromBuffer1
hlCoord 9, 7 hlCoord 9, 7
ld bc, $50a ld bc, $50a
@ -7657,24 +7657,26 @@ UpdateStatDone: ; 3f4ca (f:74ca)
call PrintStatText call PrintStatText
ld hl, W_PLAYERBATTSTATUS2 ld hl, W_PLAYERBATTSTATUS2
ld de, W_PLAYERMOVENUM ld de, W_PLAYERMOVENUM
ld bc, wccf7 ld bc, wPlayerMonMinimized
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
jr z, .asm_3f4e6 jr z, .asm_3f4e6
ld hl, W_ENEMYBATTSTATUS2 ld hl, W_ENEMYBATTSTATUS2
ld de, W_ENEMYMOVENUM ld de, W_ENEMYMOVENUM
ld bc, wccf3 ld bc, wEnemyMonMinimized
.asm_3f4e6 .asm_3f4e6
ld a, [de] ld a, [de]
cp MINIMIZE cp MINIMIZE
jr nz, .asm_3f4f9 jr nz, .asm_3f4f9
bit HasSubstituteUp, [hl] ; substitute ; if a substitute is up, slide off the substitute and show the mon pic before
; playing the minimize animation
bit HasSubstituteUp, [hl]
push af push af
push bc push bc
ld hl, Func_79747 ld hl, HideSubstituteShowMonAnim
ld b, BANK(Func_79747) ld b, BANK(HideSubstituteShowMonAnim)
push de push de
call nz, Bankswitch ; play Minimize animation unless there's Substitute involved call nz, Bankswitch
pop de pop de
.asm_3f4f9 .asm_3f4f9
call PlayCurrentMoveAnimation call PlayCurrentMoveAnimation
@ -7684,8 +7686,8 @@ UpdateStatDone: ; 3f4ca (f:74ca)
pop bc pop bc
ld a, $1 ld a, $1
ld [bc], a ld [bc], a
ld hl, Func_79771 ld hl, ReshowSubstituteAnim
ld b, BANK(Func_79771) ld b, BANK(ReshowSubstituteAnim)
pop af pop af
call nz, Bankswitch call nz, Bankswitch
.applyBadgeBoostsAndStatusPenalties .applyBadgeBoostsAndStatusPenalties

View file

@ -26,8 +26,8 @@ TransformEffect_: ; 3bab1 (e:7ab1)
; animation(s) played are different if target has Substitute up ; animation(s) played are different if target has Substitute up
bit HasSubstituteUp, [hl] bit HasSubstituteUp, [hl]
push af push af
ld hl, Func_79747 ld hl, HideSubstituteShowMonAnim
ld b, BANK(Func_79747) ld b, BANK(HideSubstituteShowMonAnim)
call nz, Bankswitch call nz, Bankswitch
ld a, [W_OPTIONS] ld a, [W_OPTIONS]
add a add a
@ -38,8 +38,8 @@ TransformEffect_: ; 3bab1 (e:7ab1)
ld b, BANK(AnimationTransformMon) ld b, BANK(AnimationTransformMon)
.gotAnimToPlay .gotAnimToPlay
call Bankswitch call Bankswitch
ld hl, Func_79771 ld hl, ReshowSubstituteAnim
ld b, BANK(Func_79771) ld b, BANK(ReshowSubstituteAnim)
pop af pop af
call nz, Bankswitch call nz, Bankswitch
pop bc pop bc

View file

@ -317,7 +317,7 @@ TradeCenter_SelectMon:
ld [hli], a ld [hli], a
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
ld [wcc37], a ld [wMenuWatchMovingOutOfBounds], a
ld [wCurrentMenuItem], a ld [wCurrentMenuItem], a
ld [wLastMenuItem], a ld [wLastMenuItem], a
ld [wMenuJoypadPollCount], a ld [wMenuJoypadPollCount], a
@ -326,7 +326,7 @@ TradeCenter_SelectMon:
jp .playerMonMenu jp .playerMonMenu
.enemyMonMenu .enemyMonMenu
xor a xor a
ld [wcc37], a ld [wMenuWatchMovingOutOfBounds], a
inc a inc a
ld [wWhichTradeMonSelectionMenu], a ld [wWhichTradeMonSelectionMenu], a
ld a, D_DOWN | D_LEFT | A_BUTTON ld a, D_DOWN | D_LEFT | A_BUTTON
@ -357,9 +357,9 @@ TradeCenter_SelectMon:
dec a dec a
ld [wCurrentMenuItem], a ld [wCurrentMenuItem], a
.displayEnemyMonStats .displayEnemyMonStats
ld a, $1 ld a, INIT_ENEMYOT_LIST
ld [wd11b], a ld [wInitListType], a
callab InitList callab InitList ; the list isn't used
ld hl, wEnemyMons ld hl, wEnemyMons
call TradeCenter_DisplayStats call TradeCenter_DisplayStats
jp .getNewInput jp .getNewInput
@ -390,7 +390,7 @@ TradeCenter_SelectMon:
.playerMonMenu .playerMonMenu
xor a ; player mon menu xor a ; player mon menu
ld [wWhichTradeMonSelectionMenu], a ld [wWhichTradeMonSelectionMenu], a
ld [wcc37], a ld [wMenuWatchMovingOutOfBounds], a
ld a, D_DOWN | D_RIGHT | A_BUTTON ld a, D_DOWN | D_RIGHT | A_BUTTON
ld [wMenuWatchedKeys], a ld [wMenuWatchedKeys], a
ld a, [wPartyCount] ld a, [wPartyCount]
@ -416,9 +416,9 @@ TradeCenter_SelectMon:
jr z, .playerMonMenu_ANotPressed jr z, .playerMonMenu_ANotPressed
jp .chosePlayerMon ; jump if A button pressed jp .chosePlayerMon ; jump if A button pressed
; unreachable code ; unreachable code
ld a, $4 ld a, INIT_PLAYEROT_LIST
ld [wd11b], a ld [wInitListType], a
callab InitList callab InitList ; the list isn't used
call TradeCenter_DisplayStats call TradeCenter_DisplayStats
jp .getNewInput jp .getNewInput
.playerMonMenu_ANotPressed .playerMonMenu_ANotPressed
@ -511,9 +511,9 @@ TradeCenter_SelectMon:
.displayPlayerMonStats .displayPlayerMonStats
pop af pop af
ld [wCurrentMenuItem], a ld [wCurrentMenuItem], a
ld a, $4 ld a, INIT_PLAYEROT_LIST
ld [wd11b], a ld [wInitListType], a
callab InitList callab InitList ; the list isn't used
call TradeCenter_DisplayStats call TradeCenter_DisplayStats
call LoadScreenTilesFromBuffer1 call LoadScreenTilesFromBuffer1
jp .playerMonMenu jp .playerMonMenu
@ -682,7 +682,7 @@ TradeCenter_Trade:
xor a xor a
ld [wSerialExchangeNybbleSendData + 1], a ; unnecessary ld [wSerialExchangeNybbleSendData + 1], a ; unnecessary
ld [wSerialExchangeNybbleReceiveData], a ld [wSerialExchangeNybbleReceiveData], a
ld [wcc37], a ld [wMenuWatchMovingOutOfBounds], a
ld [wMenuJoypadPollCount], a ld [wMenuJoypadPollCount], a
hlCoord 0, 12 hlCoord 0, 12
ld b, 4 ld b, 4
@ -793,7 +793,7 @@ TradeCenter_Trade:
ld a, [hl] ld a, [hl]
ld [wTradedPlayerMonSpecies], a ld [wTradedPlayerMonSpecies], a
xor a xor a
ld [wcf95], a ld [wRemoveMonFromBox], a
call RemovePokemon call RemovePokemon
ld a, [wTradingWhichEnemyMon] ld a, [wTradingWhichEnemyMon]
ld c, a ld c, a

View file

@ -1,5 +1,5 @@
StartSlotMachine: ; 37e2d (d:7e2d) StartSlotMachine: ; 37e2d (d:7e2d)
ld a, [wTrainerSpriteOffset] ld a, [wHiddenObjectFunctionArgument]
cp $fd cp $fd
jr z, .printOutOfOrder jr z, .printOutOfOrder
cp $fe cp $fe
@ -7,23 +7,23 @@ StartSlotMachine: ; 37e2d (d:7e2d)
cp $ff cp $ff
jr z, .printSomeonesKeys jr z, .printSomeonesKeys
callba AbleToPlaySlotsCheck callba AbleToPlaySlotsCheck
ld a, [wTrainerSpriteOffset] ld a, [wHiddenObjectFunctionArgument]
and a and a
ret z ret z
ld a, [wUnknownSlotVar] ld a, [wLuckySlotHiddenObjectIndex]
ld b, a ld b, a
ld a, [wTrainerFacingDirection] ld a, [wHiddenObjectIndex]
inc a inc a
cp b cp b
jr z, .asm_37e58 jr z, .match
ld a, $fd ld a, 253
jr .asm_37e5a jr .next
.asm_37e58 .match
ld a, $fa ld a, 250
.asm_37e5a .next
ld [wcc5b], a ld [wSlotMachineSevenAndBarModeChance], a
ld a, [H_LOADEDROMBANK] ld a, [H_LOADEDROMBANK]
ld [wcc5e], a ld [wSlotMachineSavedROMBank], a
call PromptUserToPlaySlots call PromptUserToPlaySlots
ret ret
.printOutOfOrder .printOutOfOrder

View file

@ -87,8 +87,8 @@ InGameTrade_GetMonName: ; 71b6a (1c:5b6a)
INCLUDE "data/trades.asm" INCLUDE "data/trades.asm"
InGameTrade_DoTrade: ; 71c07 (1c:5c07) InGameTrade_DoTrade: ; 71c07 (1c:5c07)
xor a xor a ; NORMAL_PARTY_MENU
ld [wd07d],a ld [wPartyMenuTypeOrMessageID],a
dec a dec a
ld [wUpdateSpritesEnabled],a ld [wUpdateSpritesEnabled],a
call DisplayPartyMenu call DisplayPartyMenu
@ -131,7 +131,7 @@ InGameTrade_DoTrade: ; 71c07 (1c:5c07)
ld [wcf91],a ld [wcf91],a
xor a xor a
ld [wcc49],a ld [wcc49],a
ld [wcf95],a ld [wRemoveMonFromBox],a
call RemovePokemon call RemovePokemon
ld a,$80 ld a,$80
ld [wcc49],a ld [wcc49],a

View file

@ -450,7 +450,7 @@ ItemUseBall: ; d687 (3:5687)
ret nz ret nz
ld hl,wNumBagItems ld hl,wNumBagItems
inc a inc a
ld [wcf96],a ld [wItemQuantity],a
jp RemoveItemFromInventory jp RemoveItemFromInventory
ItemUseBallText00: ; d937 (3:5937) ItemUseBallText00: ; d937 (3:5937)
;"It dodged the thrown ball!" ;"It dodged the thrown ball!"
@ -633,8 +633,8 @@ ItemUseEvoStone: ; da5b (3:5a5b)
ld a,[wcf91] ld a,[wcf91]
ld [wd156],a ld [wd156],a
push af push af
ld a,$05 ; evolution stone party menu ld a,EVO_STONE_PARTY_MENU
ld [wd07d],a ld [wPartyMenuTypeOrMessageID],a
ld a,$ff ld a,$ff
ld [wUpdateSpritesEnabled],a ld [wUpdateSpritesEnabled],a
call DisplayPartyMenu call DisplayPartyMenu
@ -655,7 +655,7 @@ ItemUseEvoStone: ; da5b (3:5a5b)
ld [wWhichPokemon],a ld [wWhichPokemon],a
ld hl,wNumBagItems ld hl,wNumBagItems
ld a,1 ; remove 1 stone ld a,1 ; remove 1 stone
ld [wcf96],a ld [wItemQuantity],a
jp RemoveItemFromInventory jp RemoveItemFromInventory
.noEffect .noEffect
call ItemUseNoEffect call ItemUseNoEffect
@ -678,8 +678,8 @@ ItemUseMedicine: ; dabb (3:5abb)
push af push af
ld a,[wcf91] ld a,[wcf91]
push af push af
ld a,$01 ld a,USE_ITEM_PARTY_MENU
ld [wd07d],a ; item use party menu ld [wPartyMenuTypeOrMessageID],a
ld a,$ff ld a,$ff
ld [wUpdateSpritesEnabled],a ld [wUpdateSpritesEnabled],a
ld a,[wd152] ld a,[wd152]
@ -737,22 +737,22 @@ ItemUseMedicine: ; dabb (3:5abb)
ld bc,4 ld bc,4
add hl,bc ; hl now points to status add hl,bc ; hl now points to status
ld a,[wcf91] ld a,[wcf91]
ld bc,$f008 ld bc, (ANTIDOTE_MSG << 8) | (1 << PSN)
cp a,ANTIDOTE cp a,ANTIDOTE
jr z,.checkMonStatus jr z,.checkMonStatus
ld bc,$f110 ld bc, (BURN_HEAL_MSG << 8) | (1 << BRN)
cp a,BURN_HEAL cp a,BURN_HEAL
jr z,.checkMonStatus jr z,.checkMonStatus
ld bc,$f220 ld bc, (ICE_HEAL_MSG << 8) | (1 << FRZ)
cp a,ICE_HEAL cp a,ICE_HEAL
jr z,.checkMonStatus jr z,.checkMonStatus
ld bc,$f307 ld bc, (AWAKENING_MSG << 8) | SLP
cp a,AWAKENING cp a,AWAKENING
jr z,.checkMonStatus jr z,.checkMonStatus
ld bc,$f440 ld bc, (PARALYZ_HEAL_MSG << 8) | (1 << PAR)
cp a,PARLYZ_HEAL cp a,PARLYZ_HEAL
jr z,.checkMonStatus jr z,.checkMonStatus
ld bc,$f6ff ; Full Heal ld bc, (FULL_HEAL_MSG << 8) | $ff ; Full Heal
.checkMonStatus .checkMonStatus
ld a,[hl] ; pokemon's status ld a,[hl] ; pokemon's status
and c ; does the pokemon have a status ailment the item can cure? and c ; does the pokemon have a status ailment the item can cure?
@ -761,7 +761,7 @@ ItemUseMedicine: ; dabb (3:5abb)
xor a xor a
ld [hl],a ; remove the status ailment in the party data ld [hl],a ; remove the status ailment in the party data
ld a,b ld a,b
ld [wd07d],a ; the message to display for the item used ld [wPartyMenuTypeOrMessageID],a ; the message to display for the item used
ld a,[wPlayerMonNumber] ld a,[wPlayerMonNumber]
cp d ; is pokemon the item was used on active in battle? cp d ; is pokemon the item was used on active in battle?
jp nz,.doneHealing jp nz,.doneHealing
@ -1078,15 +1078,15 @@ ItemUseMedicine: ; dabb (3:5abb)
ld a,[hFlags_0xFFF6] ld a,[hFlags_0xFFF6]
res 0,a res 0,a
ld [hFlags_0xFFF6],a ld [hFlags_0xFFF6],a
ld a,$f7 ; revived message ld a,REVIVE_MSG
ld [wd07d],a ld [wPartyMenuTypeOrMessageID],a
ld a,[wcf91] ld a,[wcf91]
cp a,REVIVE cp a,REVIVE
jr z,.showHealingItemMessage jr z,.showHealingItemMessage
cp a,MAX_REVIVE cp a,MAX_REVIVE
jr z,.showHealingItemMessage jr z,.showHealingItemMessage
ld a,$f5 ; standard HP healed message ld a,POTION_MSG
ld [wd07d],a ld [wPartyMenuTypeOrMessageID],a
jr .showHealingItemMessage jr .showHealingItemMessage
.playStatusAilmentCuringSound .playStatusAilmentCuringSound
ld a,(SFX_02_3e - SFX_Headers_02) / 3 ; status ailment curing sound ld a,(SFX_02_3e - SFX_Headers_02) / 3 ; status ailment curing sound
@ -1257,8 +1257,8 @@ ItemUseMedicine: ; dabb (3:5abb)
ld a,[hl] ld a,[hl]
adc b adc b
ld [hl],a ld [hl],a
ld a,$f8 ; level up message ld a,RARE_CANDY_MSG
ld [wd07d],a ld [wPartyMenuTypeOrMessageID],a
call RedrawPartyMenu call RedrawPartyMenu
pop de pop de
ld a,d ld a,d
@ -1878,8 +1878,8 @@ ItemUsePPRestore: ; e31e (3:631e)
.chooseMon .chooseMon
xor a xor a
ld [wUpdateSpritesEnabled],a ld [wUpdateSpritesEnabled],a
ld a,$01 ; item use party menu ld a,USE_ITEM_PARTY_MENU
ld [wd07d],a ld [wPartyMenuTypeOrMessageID],a
call DisplayPartyMenu call DisplayPartyMenu
jr nc,.chooseMove jr nc,.chooseMove
jp .itemNotUsed jp .itemNotUsed
@ -2118,8 +2118,8 @@ ItemUseTMHM: ; e479 (3:6479)
call CopyData call CopyData
ld a,$ff ld a,$ff
ld [wUpdateSpritesEnabled],a ld [wUpdateSpritesEnabled],a
ld a,$03 ; teach TM/HM party menu ld a,TMHM_PARTY_MENU
ld [wd07d],a ld [wPartyMenuTypeOrMessageID],a
call DisplayPartyMenu call DisplayPartyMenu
push af push af
ld hl,wd036 ld hl,wd036
@ -2193,7 +2193,7 @@ PrintItemUseTextAndRemoveItem: ; e563 (3:6563)
RemoveUsedItem: ; e571 (3:6571) RemoveUsedItem: ; e571 (3:6571)
ld hl,wNumBagItems ld hl,wNumBagItems
ld a,1 ; one item ld a,1 ; one item
ld [wcf96],a ; store quantity ld [wItemQuantity],a
jp RemoveItemFromInventory jp RemoveItemFromInventory
ItemUseNoEffect: ; e57c (3:657c) ItemUseNoEffect: ; e57c (3:657c)
@ -2464,7 +2464,7 @@ GetSelectedMoveOffset2: ; e6e9 (3:66e9)
; hl = address of inventory (either wNumBagItems or wNumBoxItems) ; hl = address of inventory (either wNumBagItems or wNumBoxItems)
; [wcf91] = item ID ; [wcf91] = item ID
; [wWhichPokemon] = index of item within inventory ; [wWhichPokemon] = index of item within inventory
; [wcf96] = quantity to toss ; [wItemQuantity] = quantity to toss
; OUTPUT: ; OUTPUT:
; clears carry flag if the item is tossed, sets carry flag if not ; clears carry flag if the item is tossed, sets carry flag if not
TossItem_: ; e6f1 (3:66f1) TossItem_: ; e6f1 (3:66f1)
@ -2475,7 +2475,7 @@ TossItem_: ; e6f1 (3:66f1)
jr c,.tooImportantToToss jr c,.tooImportantToToss
push hl push hl
call IsKeyItem_ call IsKeyItem_
ld a,[wd124] ld a,[wIsKeyItem]
pop hl pop hl
and a and a
jr nz,.tooImportantToToss jr nz,.tooImportantToToss
@ -2491,11 +2491,11 @@ TossItem_: ; e6f1 (3:66f1)
ld a,TWO_OPTION_MENU ld a,TWO_OPTION_MENU
ld [wTextBoxID],a ld [wTextBoxID],a
call DisplayTextBoxID ; yes/no menu call DisplayTextBoxID ; yes/no menu
ld a,[wd12e] ld a,[wMenuExitMethod]
cp a,2 cp a,CHOSE_SECOND_ITEM
pop hl pop hl
scf scf
ret z ret z ; return if the player chose No
; if the player chose Yes ; if the player chose Yes
push hl push hl
ld a,[wWhichPokemon] ld a,[wWhichPokemon]
@ -2533,12 +2533,12 @@ TooImportantToTossText: ; e75f (3:675f)
; INPUT: ; INPUT:
; [wcf91] = item ID ; [wcf91] = item ID
; OUTPUT: ; OUTPUT:
; [wd124] = result ; [wIsKeyItem] = result
; 00: item is not key item ; 00: item is not key item
; 01: item is key item ; 01: item is key item
IsKeyItem_: ; e764 (3:6764) IsKeyItem_: ; e764 (3:6764)
ld a,$01 ld a,$01
ld [wd124],a ld [wIsKeyItem],a
ld a,[wcf91] ld a,[wcf91]
cp a,HM_01 ; is the item an HM or TM? cp a,HM_01 ; is the item an HM or TM?
jr nc,.checkIfItemIsHM jr nc,.checkIfItemIsHM
@ -2562,7 +2562,7 @@ IsKeyItem_: ; e764 (3:6764)
call IsItemHM call IsItemHM
ret c ret c
xor a xor a
ld [wd124],a ld [wIsKeyItem],a
ret ret
INCLUDE "data/key_items.asm" INCLUDE "data/key_items.asm"
@ -2650,8 +2650,8 @@ SendNewMonToBox: ; e7a4 (3:67a4)
jr nz, .asm_e817 jr nz, .asm_e817
.asm_e82a .asm_e82a
ld hl, wBoxMonNicks ld hl, wBoxMonNicks
ld a, $2 ld a, NAME_MON_SCREEN
ld [wd07d], a ld [wNamingScreenType], a
predef AskName predef AskName
ld a, [W_NUMINBOX] ld a, [W_NUMINBOX]
dec a dec a

View file

@ -229,11 +229,11 @@ BillsPCDeposit:
ld a, [wcf91] ld a, [wcf91]
call GetCryData call GetCryData
call PlaySoundWaitForCurrent call PlaySoundWaitForCurrent
ld a, $1 ld a, PARTY_TO_BOX
ld [wcf95], a ld [wMoveMonType], a
call Func_3a68 call MoveMon
xor a xor a
ld [wcf95], a ld [wRemoveMonFromBox], a
call RemovePokemon call RemovePokemon
call WaitForSoundToFinish call WaitForSoundToFinish
ld hl, wWhichTrade ld hl, wWhichTrade
@ -281,11 +281,11 @@ Func_21618: ; 21618 (8:5618)
ld a, [wcf91] ld a, [wcf91]
call GetCryData call GetCryData
call PlaySoundWaitForCurrent call PlaySoundWaitForCurrent
xor a xor a ; BOX_TO_PARTY
ld [wcf95], a ld [wMoveMonType], a
call Func_3a68 call MoveMon
ld a, $1 ld a, 1
ld [wcf95], a ld [wRemoveMonFromBox], a
call RemovePokemon call RemovePokemon
call WaitForSoundToFinish call WaitForSoundToFinish
ld hl, MonIsTakenOutText ld hl, MonIsTakenOutText
@ -310,7 +310,7 @@ Func_21673: ; 21673 (8:5673)
and a and a
jr nz, .asm_21682 jr nz, .asm_21682
inc a inc a
ld [wcf95], a ld [wRemoveMonFromBox], a
call RemovePokemon call RemovePokemon
call WaitForSoundToFinish call WaitForSoundToFinish
ld a, [wcf91] ld a, [wcf91]
@ -329,7 +329,7 @@ Func_216be: ; 216be (8:56be)
ld a, h ld a, h
ld [wList + 1], a ld [wList + 1], a
xor a xor a
ld [wcf93], a ld [wPrintItemPrices], a
ld [wListMenuID], a ld [wListMenuID], a
inc a ; MONSTER_NAME inc a ; MONSTER_NAME
ld [wNameListType], a ld [wNameListType], a

View file

@ -56,7 +56,7 @@ DisplayDiploma: ; 566e2 (15:66e2)
call Delay3 call Delay3
call GBPalNormal call GBPalNormal
ld a, $90 ld a, $90
ld [$ff48], a ld [rOBP0], a
call WaitForTextScrollButtonPress call WaitForTextScrollButtonPress
ld hl, wd730 ld hl, wd730
res 6, [hl] res 6, [hl]

View file

@ -27,8 +27,8 @@ AskName: ; 64eb (1:64eb)
xor a xor a
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
push hl push hl
ld a, $2 ld a, NAME_MON_SCREEN
ld [wd07d], a ld [wNamingScreenType], a
call DisplayNamingScreen call DisplayNamingScreen
ld a, [W_ISINBATTLE] ld a, [W_ISINBATTLE]
and a and a
@ -53,12 +53,12 @@ DoYouWantToNicknameText: ; 0x6557
TX_FAR _DoYouWantToNicknameText TX_FAR _DoYouWantToNicknameText
db "@" db "@"
Func_655c: ; 655c (1:655c) DisplayNameRaterScreen: ; 655c (1:655c)
ld hl, wHPBarMaxHP ld hl, wHPBarMaxHP
xor a xor a
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
ld a, $2 ld a, NAME_MON_SCREEN
ld [wd07d], a ld [wNamingScreenType], a
call DisplayNamingScreen call DisplayNamingScreen
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3
call RestoreScreenTilesAndReloadTilePatterns call RestoreScreenTilesAndReloadTilePatterns
@ -114,7 +114,7 @@ DisplayNamingScreen: ; 6596 (1:6596)
ld hl, wHPBarMaxHP + 1 ld hl, wHPBarMaxHP + 1
ld [hli], a ld [hli], a
ld [hli], a ld [hli], a
ld [wPartyMonAnimCounter], a ld [wAnimCounter], a
.asm_65ed .asm_65ed
call PrintAlphabet call PrintAlphabet
call GBPalNormal call GBPalNormal
@ -236,8 +236,8 @@ DisplayNamingScreen: ; 6596 (1:6596)
cp $e4 cp $e4
ld de, Handakutens ld de, Handakutens
jr z, .asm_66e3 jr z, .asm_66e3
ld a, [wd07d] ld a, [wNamingScreenType]
cp $2 cp NAME_MON_SCREEN
jr nc, .checkMonNameLength jr nc, .checkMonNameLength
ld a, [wHPBarMaxHP] ld a, [wHPBarMaxHP]
cp $7 ; max length of player/rival names cp $7 ; max length of player/rival names
@ -377,8 +377,8 @@ Func_680e: ; 680e (1:680e)
ld de, wcf4b ld de, wcf4b
call PlaceString call PlaceString
hlCoord 10, 3 hlCoord 10, 3
ld a, [wd07d] ld a, [wNamingScreenType]
cp $2 cp NAME_MON_SCREEN
jr nc, .asm_6835 jr nc, .asm_6835
ld b, $7 ld b, $7
jr .asm_6837 jr .asm_6837
@ -390,8 +390,8 @@ Func_680e: ; 680e (1:680e)
ld [hli], a ld [hli], a
dec b dec b
jr nz, .asm_6839 jr nz, .asm_6839
ld a, [wd07d] ld a, [wNamingScreenType]
cp $2 cp NAME_MON_SCREEN
ld a, [wHPBarMaxHP] ld a, [wHPBarMaxHP]
jr nc, .asm_684b jr nc, .asm_684b
cp $7 cp $7
@ -405,8 +405,8 @@ Func_680e: ; 680e (1:680e)
ld [wTopMenuItemX], a ld [wTopMenuItemX], a
ld a, $5 ld a, $5
ld [wCurrentMenuItem], a ld [wCurrentMenuItem], a
ld a, [wd07d] ld a, [wNamingScreenType]
cp $2 cp NAME_MON_SCREEN
ld a, $9 ld a, $9
jr nc, .asm_6867 jr nc, .asm_6867
ld a, $6 ld a, $6
@ -462,7 +462,7 @@ CalcStringLength: ; 68eb (1:68eb)
PrintNamingText: ; 68f8 (1:68f8) PrintNamingText: ; 68f8 (1:68f8)
hlCoord 0, 1 hlCoord 0, 1
ld a, [wd07d] ld a, [wNamingScreenType]
ld de, YourTextString ld de, YourTextString
and a and a
jr z, .notNickname jr z, .notNickname

View file

@ -1,4 +1,4 @@
; [wd07d] = menu type / message ID ; [wPartyMenuTypeOrMessageID] = menu type / message ID
; if less than $F0, it is a menu type ; if less than $F0, it is a menu type
; menu types: ; menu types:
; 00: normal pokemon menu (e.g. Start menu) ; 00: normal pokemon menu (e.g. Start menu)
@ -25,11 +25,11 @@ DrawPartyMenu_: ; 12cd2 (4:6cd2)
callba LoadMonPartySpriteGfxWithLCDDisabled ; load pokemon icon graphics callba LoadMonPartySpriteGfxWithLCDDisabled ; load pokemon icon graphics
RedrawPartyMenu_: ; 12ce3 (4:6ce3) RedrawPartyMenu_: ; 12ce3 (4:6ce3)
ld a,[wd07d] ld a,[wPartyMenuTypeOrMessageID]
cp a,$04 cp a,SWAP_MONS_PARTY_MENU
jp z,.printMessage jp z,.printMessage
call ErasePartyMenuCursors call ErasePartyMenuCursors
callba SendBlkPacket_PartyMenu ; loads some data to wcf2e callba SendBlkPacket_PartyMenu
hlCoord 3, 0 hlCoord 3, 0
ld de,wPartySpecies ld de,wPartySpecies
xor a xor a
@ -75,10 +75,10 @@ RedrawPartyMenu_: ; 12ce3 (4:6ce3)
inc hl inc hl
inc hl inc hl
.skipUnfilledRightArrow .skipUnfilledRightArrow
ld a,[wd07d] ; menu type ld a,[wPartyMenuTypeOrMessageID] ; menu type
cp a,$03 cp a,TMHM_PARTY_MENU
jr z,.teachMoveMenu jr z,.teachMoveMenu
cp a,$05 cp a,EVO_STONE_PARTY_MENU
jr z,.evolutionStoneMenu jr z,.evolutionStoneMenu
push hl push hl
ld bc,14 ; 14 columns to the right ld bc,14 ; 14 columns to the right
@ -196,7 +196,7 @@ RedrawPartyMenu_: ; 12ce3 (4:6ce3)
push af push af
push hl push hl
set 6,[hl] ; turn off letter printing delay set 6,[hl] ; turn off letter printing delay
ld a,[wd07d] ; message ID ld a,[wPartyMenuTypeOrMessageID] ; message ID
cp a,$F0 cp a,$F0
jr nc,.printItemUseMessage jr nc,.printItemUseMessage
add a add a

View file

@ -135,7 +135,7 @@ RemoveItemByID: ; 17f37 (5:7f37)
jr .asm_17f40 jr .asm_17f40
.asm_17f4f .asm_17f4f
ld a, $1 ld a, $1
ld [wcf96], a ld [wItemQuantity], a
ld a, [$ffdc] ld a, [$ffdc]
ld [wWhichPokemon], a ld [wWhichPokemon], a
ld hl, wNumBagItems ld hl, wNumBagItems

View file

@ -101,15 +101,15 @@ Func_79ab: ; 79ab (1:79ab)
ld a, h ld a, h
ld [wList + 1], a ld [wList + 1], a
xor a xor a
ld [wcf93], a ld [wPrintItemPrices], a
ld a, $3 ld a, $3
ld [wListMenuID], a ld [wListMenuID], a
call DisplayListMenuID call DisplayListMenuID
jp c, Func_790c jp c, Func_790c
call IsKeyItem call IsKeyItem
ld a, $1 ld a, $1
ld [wcf96], a ld [wItemQuantity], a
ld a, [wd124] ld a, [wIsKeyItem]
and a and a
jr nz, .asm_79e7 jr nz, .asm_79e7
ld hl, DepositHowManyText ld hl, DepositHowManyText
@ -155,15 +155,15 @@ Func_7a28: ; 7a28 (1:7a28)
ld a, h ld a, h
ld [wList + 1], a ld [wList + 1], a
xor a xor a
ld [wcf93], a ld [wPrintItemPrices], a
ld a, $3 ld a, $3
ld [wListMenuID], a ld [wListMenuID], a
call DisplayListMenuID call DisplayListMenuID
jp c, Func_790c jp c, Func_790c
call IsKeyItem call IsKeyItem
ld a, $1 ld a, $1
ld [wcf96], a ld [wItemQuantity], a
ld a, [wd124] ld a, [wIsKeyItem]
and a and a
jr nz, .asm_7a64 jr nz, .asm_7a64
ld hl, WithdrawHowManyText ld hl, WithdrawHowManyText
@ -209,7 +209,7 @@ Func_7aa5: ; 7aa5 (1:7aa5)
ld a, h ld a, h
ld [wList + 1], a ld [wList + 1], a
xor a xor a
ld [wcf93], a ld [wPrintItemPrices], a
ld a, $3 ld a, $3
ld [wListMenuID], a ld [wListMenuID], a
push hl push hl
@ -220,8 +220,8 @@ Func_7aa5: ; 7aa5 (1:7aa5)
call IsKeyItem call IsKeyItem
pop hl pop hl
ld a, $1 ld a, $1
ld [wcf96], a ld [wItemQuantity], a
ld a, [wd124] ld a, [wIsKeyItem]
and a and a
jr nz, .asm_7aef jr nz, .asm_7aef
ld a, [wcf91] ld a, [wcf91]

View file

@ -22,7 +22,7 @@ ShowPokedexMenu: ; 40000 (10:4000)
xor a xor a
ld [hli],a ; top menu item X ld [hli],a ; top menu item X
inc a inc a
ld [wcc37],a ld [wMenuWatchMovingOutOfBounds],a
inc hl inc hl
inc hl inc hl
ld a,6 ld a,6
@ -32,7 +32,7 @@ ShowPokedexMenu: ; 40000 (10:4000)
jr c,.goToSideMenu ; if the player chose a pokemon from the list jr c,.goToSideMenu ; if the player chose a pokemon from the list
.exitPokedex .exitPokedex
xor a xor a
ld [wcc37],a ld [wMenuWatchMovingOutOfBounds],a
ld [wCurrentMenuItem],a ld [wCurrentMenuItem],a
ld [wLastMenuItem],a ld [wLastMenuItem],a
ld [hJoy7],a ld [hJoy7],a
@ -91,7 +91,7 @@ HandlePokedexSideMenu: ; 4006d (10:406d)
ld [hli],a ; menu watched keys (A button and B button) ld [hli],a ; menu watched keys (A button and B button)
xor a xor a
ld [hli],a ; old menu item ID ld [hli],a ; old menu item ID
ld [wcc37],a ld [wMenuWatchMovingOutOfBounds],a
.handleMenuInput .handleMenuInput
call HandleMenuInput call HandleMenuInput
bit 1,a ; was the B button pressed? bit 1,a ; was the B button pressed?

View file

@ -12,14 +12,14 @@ StartMenu_Pokemon: ; 130a9 (4:70a9)
jp z,RedisplayStartMenu jp z,RedisplayStartMenu
xor a xor a
ld [wMenuItemToSwap],a ld [wMenuItemToSwap],a
ld [wd07d],a ld [wPartyMenuTypeOrMessageID],a
ld [wUpdateSpritesEnabled],a ld [wUpdateSpritesEnabled],a
call DisplayPartyMenu call DisplayPartyMenu
jr .checkIfPokemonChosen jr .checkIfPokemonChosen
.loop .loop
xor a xor a
ld [wMenuItemToSwap],a ld [wMenuItemToSwap],a
ld [wd07d],a ld [wPartyMenuTypeOrMessageID],a
call GoBackToPartyMenu call GoBackToPartyMenu
.checkIfPokemonChosen .checkIfPokemonChosen
jr nc,.chosePokemon jr nc,.chosePokemon
@ -89,8 +89,8 @@ StartMenu_Pokemon: ; 130a9 (4:70a9)
cp a,2 ; is there more than one pokemon in the party? cp a,2 ; is there more than one pokemon in the party?
jp c,StartMenu_Pokemon ; if not, no switching jp c,StartMenu_Pokemon ; if not, no switching
call SwitchPartyMon_Stats call SwitchPartyMon_Stats
ld a,$04 ; swap pokemon positions menu ld a,SWAP_MONS_PARTY_MENU
ld [wd07d],a ld [wPartyMenuTypeOrMessageID],a
call GoBackToPartyMenu call GoBackToPartyMenu
jp .checkIfPokemonChosen jp .checkIfPokemonChosen
.choseStats .choseStats
@ -313,7 +313,7 @@ StartMenu_Item: ; 13302 (4:7302)
ld [hli],a ld [hli],a
ld [hl],b ; store item bag pointer at wList (for DisplayListMenuID) ld [hl],b ; store item bag pointer at wList (for DisplayListMenuID)
xor a xor a
ld [wcf93],a ld [wPrintItemPrices],a
ld a,ITEMLISTMENU ld a,ITEMLISTMENU
ld [wListMenuID],a ld [wListMenuID],a
ld a,[wcc2c] ld a,[wcc2c]
@ -423,7 +423,7 @@ StartMenu_Item: ; 13302 (4:7302)
jp ItemMenuLoop jp ItemMenuLoop
.tossItem .tossItem
call IsKeyItem call IsKeyItem
ld a,[wd124] ld a,[wIsKeyItem]
and a and a
jr nz,.skipAskingQuantity jr nz,.skipAskingQuantity
ld a,[wcf91] ld a,[wcf91]
@ -747,7 +747,7 @@ SwitchPartyMon_Stats: ; 13653 (4:7653)
ret ret
.asm_13661 .asm_13661
xor a xor a
ld [wd07d], a ld [wPartyMenuTypeOrMessageID], a
ld a, [wMenuItemToSwap] ld a, [wMenuItemToSwap]
dec a dec a
ld b, a ld b, a
@ -757,7 +757,7 @@ SwitchPartyMon_Stats: ; 13653 (4:7653)
jr nz, .asm_1367b jr nz, .asm_1367b
xor a xor a
ld [wMenuItemToSwap], a ld [wMenuItemToSwap], a
ld [wd07d], a ld [wPartyMenuTypeOrMessageID], a
ret ret
.asm_1367b .asm_1367b
ld a, b ld a, b
@ -845,7 +845,7 @@ SwitchPartyMon_Stats: ; 13653 (4:7653)
ld [wWhichTrade], a ld [wWhichTrade], a
xor a xor a
ld [wMenuItemToSwap], a ld [wMenuItemToSwap], a
ld [wd07d], a ld [wPartyMenuTypeOrMessageID], a
pop de pop de
pop hl pop hl
ret ret

View file

@ -27,7 +27,7 @@ GetAnimationSpeed: ; 7170a (1c:570a)
ld c, a ld c, a
add a add a
ld b, a ld b, a
ld a, [wPartyMonAnimCounter] ld a, [wAnimCounter]
and a and a
jr z, .resetSprites jr z, .resetSprites
cp c cp c
@ -38,7 +38,7 @@ GetAnimationSpeed: ; 7170a (1c:570a)
jr nz, .skipResetTimer jr nz, .skipResetTimer
xor a ; reset timer xor a ; reset timer
.skipResetTimer .skipResetTimer
ld [wPartyMonAnimCounter], a ld [wAnimCounter], a
jp DelayFrame jp DelayFrame
.resetSprites .resetSprites
push bc push bc
@ -315,7 +315,7 @@ WriteMonPartySpriteOAMByPartyIndex: ; 71868 (1c:5868)
add hl, de add hl, de
ld a, [hl] ld a, [hl]
call GetPartyMonSpriteID call GetPartyMonSpriteID
ld [wcd5b], a ld [wOAMBaseTile], a
call WriteMonPartySpriteOAM call WriteMonPartySpriteOAM
pop bc pop bc
pop de pop de
@ -329,7 +329,7 @@ WriteMonPartySpriteOAMBySpecies: ; 71882 (1c:5882)
ld [hPartyMonIndex], a ld [hPartyMonIndex], a
ld a, [wMonPartySpriteSpecies] ld a, [wMonPartySpriteSpecies]
call GetPartyMonSpriteID call GetPartyMonSpriteID
ld [wcd5b], a ld [wOAMBaseTile], a
jr WriteMonPartySpriteOAM jr WriteMonPartySpriteOAM
UnusedPartyMonSpriteFunction: ; 71890 (1c:5890) UnusedPartyMonSpriteFunction: ; 71890 (1c:5890)

View file

@ -46,7 +46,7 @@ OakSpeech: ; 6115 (1:6115)
ld a,POTION ld a,POTION
ld [wcf91],a ld [wcf91],a
ld a,1 ld a,1
ld [wcf96],a ld [wItemQuantity],a
call AddItemToInventory ; give one potion call AddItemToInventory ; give one potion
ld a,[W_ANIMATIONID] ld a,[W_ANIMATIONID]
ld [wDestinationMap],a ld [wDestinationMap],a

View file

@ -12,8 +12,8 @@ LoadDefaultNamesPlayer: ; 695d (1:695d)
jr .asm_6999 jr .asm_6999
.asm_697a .asm_697a
ld hl, wPlayerName ld hl, wPlayerName
xor a xor a ; NAME_PLAYER_SCREEN
ld [wd07d], a ld [wNamingScreenType], a
call DisplayNamingScreen call DisplayNamingScreen
ld a, [wcf4b] ld a, [wcf4b]
cp $50 cp $50
@ -45,8 +45,8 @@ LoadDefaultNamesRival: ; 69a4 (1:69a4)
jr .asm_69e1 jr .asm_69e1
.asm_69c1 .asm_69c1
ld hl, W_RIVALNAME ld hl, W_RIVALNAME
ld a, $1 ld a, NAME_RIVAL_SCREEN
ld [wd07d], a ld [wNamingScreenType], a
call DisplayNamingScreen call DisplayNamingScreen
ld a, [wcf4b] ld a, [wcf4b]
cp $50 cp $50

View file

@ -1,30 +1,34 @@
DisplayPokemartDialogue_: ; 6c20 (1:6c20) DisplayPokemartDialogue_: ; 6c20 (1:6c20)
ld a,[wListScrollOffset] ld a,[wListScrollOffset]
ld [wd07e],a ld [wSavedListScrollOffset],a
call UpdateSprites call UpdateSprites
xor a xor a
ld [wcf0a],a ; flag that is set if something is sold or bought ld [wBoughtOrSoldItemInMart],a
.loop .loop
xor a xor a
ld [wListScrollOffset],a ld [wListScrollOffset],a
ld [wCurrentMenuItem],a ld [wCurrentMenuItem],a
ld [wPlayerMonNumber],a ld [wPlayerMonNumber],a
inc a inc a
ld [wcf93],a ld [wPrintItemPrices],a
ld a,MONEY_BOX ld a,MONEY_BOX
ld [wTextBoxID],a ld [wTextBoxID],a
call DisplayTextBoxID ; draw money text box call DisplayTextBoxID
ld a,BUY_SELL_QUIT_MENU ld a,BUY_SELL_QUIT_MENU
ld [wTextBoxID],a ld [wTextBoxID],a
call DisplayTextBoxID ; do buy/sell/quit menu call DisplayTextBoxID
ld hl,wd128 ; pointer to this pokemart's inventory
; This code is useless. It copies the address of the pokemart's inventory to hl,
; but the address is never used.
ld hl,wItemListPointer
ld a,[hli] ld a,[hli]
ld l,[hl] ld l,[hl]
ld h,a ; hl = address of inventory ld h,a
ld a,[wd12e]
cp a,$02 ld a,[wMenuExitMethod]
cp a,CANCELLED_MENU
jp z,.done jp z,.done
ld a,[wd12d] ; ID of the chosen menu item ld a,[wChosenMenuItem]
and a ; buying? and a ; buying?
jp z,.buyMenu jp z,.buyMenu
dec a ; selling? dec a ; selling?
@ -32,11 +36,14 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
dec a ; quitting? dec a ; quitting?
jp z,.done jp z,.done
.sellMenu .sellMenu
; the same variables are set again below, so this code has no effect
xor a xor a
ld [wcf93],a ld [wPrintItemPrices],a
ld a,$02 ld a,INIT_BAG_ITEM_LIST
ld [wd11b],a ld [wInitListType],a
callab InitList callab InitList
ld a,[wNumBagItems] ld a,[wNumBagItems]
and a and a
jp z,.bagEmpty jp z,.bagEmpty
@ -54,15 +61,15 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
ld a,h ld a,h
ld [wList + 1],a ld [wList + 1],a
xor a xor a
ld [wcf93],a ld [wPrintItemPrices],a
ld [wCurrentMenuItem],a ld [wCurrentMenuItem],a
ld a,ITEMLISTMENU ld a,ITEMLISTMENU
ld [wListMenuID],a ld [wListMenuID],a
call DisplayListMenuID call DisplayListMenuID
jp c,.returnToMainPokemartMenu ; if the player closed the menu jp c,.returnToMainPokemartMenu ; if the player closed the menu
.confirmItemSale ; if the player is trying to sell a specific item .confirmItemSale ; if the player is trying to sell a specific item
call IsKeyItem ; check if item is unsellable call IsKeyItem
ld a,[wd124] ld a,[wIsKeyItem]
and a and a
jr nz,.unsellableItem jr nz,.unsellableItem
ld a,[wcf91] ld a,[wcf91]
@ -70,7 +77,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
jr c,.unsellableItem jr c,.unsellableItem
ld a,PRICEDITEMLISTMENU ld a,PRICEDITEMLISTMENU
ld [wListMenuID],a ld [wListMenuID],a
ld [$ff8e],a ; halve prices when selling ld [hHalveItemPrices],a ; halve prices when selling
call DisplayChooseQuantityMenu call DisplayChooseQuantityMenu
inc a inc a
jr z,.sellMenuLoop ; if the player closed the choose quantity menu with the B button jr z,.sellMenuLoop ; if the player closed the choose quantity menu with the B button
@ -82,18 +89,22 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
ld a,TWO_OPTION_MENU ld a,TWO_OPTION_MENU
ld [wTextBoxID],a ld [wTextBoxID],a
call DisplayTextBoxID ; yes/no menu call DisplayTextBoxID ; yes/no menu
ld a,[wd12e] ld a,[wMenuExitMethod]
cp a,$02 cp a,CHOSE_SECOND_ITEM
jr z,.sellMenuLoop ; if the player pressed the B button jr z,.sellMenuLoop ; if the player chose No or pressed the B button
ld a,[wd12d] ; ID of the chosen menu item
; The following code is supposed to check if the player chose No, but the above
; check already catches it.
ld a,[wChosenMenuItem]
dec a dec a
jr z,.sellMenuLoop ; if the player chose No jr z,.sellMenuLoop
.sellItem .sellItem
ld a,[wcf0a] ; flag that is set if something is sold or bought ld a,[wBoughtOrSoldItemInMart]
and a and a
jr nz,.skipSettingFlag1 jr nz,.skipSettingFlag1
inc a inc a
ld [wcf0a],a ld [wBoughtOrSoldItemInMart],a
.skipSettingFlag1 .skipSettingFlag1
call AddAmountSoldToMoney call AddAmountSoldToMoney
ld hl,wNumBagItems ld hl,wNumBagItems
@ -106,22 +117,25 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
.bagEmpty .bagEmpty
ld hl,PokemartItemBagEmptyText ld hl,PokemartItemBagEmptyText
call PrintText call PrintText
call SaveScreenTilesToBuffer1 ; save screen call SaveScreenTilesToBuffer1
jp .returnToMainPokemartMenu jp .returnToMainPokemartMenu
.buyMenu .buyMenu
ld a,$01
ld [wcf93],a ; the same variables are set again below, so this code has no effect
ld a,$03 ld a,1
ld [wd11b],a ld [wPrintItemPrices],a
ld a,INIT_OTHER_ITEM_LIST
ld [wInitListType],a
callab InitList callab InitList
ld hl,PokemartBuyingGreetingText ld hl,PokemartBuyingGreetingText
call PrintText call PrintText
call SaveScreenTilesToBuffer1 ; save screen call SaveScreenTilesToBuffer1
.buyMenuLoop .buyMenuLoop
call LoadScreenTilesFromBuffer1 ; restore saved screen call LoadScreenTilesFromBuffer1
ld a,MONEY_BOX ld a,MONEY_BOX
ld [wTextBoxID],a ld [wTextBoxID],a
call DisplayTextBoxID ; draw money text box call DisplayTextBoxID
ld hl,wStringBuffer2 + 11 ld hl,wStringBuffer2 + 11
ld a,l ld a,l
ld [wList],a ld [wList],a
@ -130,15 +144,15 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
xor a xor a
ld [wCurrentMenuItem],a ld [wCurrentMenuItem],a
inc a inc a
ld [wcf93],a ld [wPrintItemPrices],a
inc a ; a = 2 (PRICEDITEMLISTMENU) inc a ; a = 2 (PRICEDITEMLISTMENU)
ld [wListMenuID],a ld [wListMenuID],a
call DisplayListMenuID call DisplayListMenuID
jr c,.returnToMainPokemartMenu ; if the player closed the menu jr c,.returnToMainPokemartMenu ; if the player closed the menu
ld a,$63 ld a,99
ld [wcf97],a ld [wMaxItemQuantity],a
xor a xor a
ld [$ff8e],a ld [hHalveItemPrices],a ; don't halve item prices when buying
call DisplayChooseQuantityMenu call DisplayChooseQuantityMenu
inc a inc a
jr z,.buyMenuLoop ; if the player closed the choose quantity menu with the B button jr z,.buyMenuLoop ; if the player closed the choose quantity menu with the B button
@ -153,12 +167,16 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
ld a,TWO_OPTION_MENU ld a,TWO_OPTION_MENU
ld [wTextBoxID],a ld [wTextBoxID],a
call DisplayTextBoxID ; yes/no menu call DisplayTextBoxID ; yes/no menu
ld a,[wd12e] ld a,[wMenuExitMethod]
cp a,$02 cp a,CHOSE_SECOND_ITEM
jp z,.buyMenuLoop ; if the player pressed the B button jp z,.buyMenuLoop ; if the player chose No or pressed the B button
ld a,[wd12d] ; ID of the chosen menu item
; The following code is supposed to check if the player chose No, but the above
; check already catches it.
ld a,[wChosenMenuItem]
dec a dec a
jr z,.buyMenuLoop ; if the player chose No jr z,.buyMenuLoop
.buyItem .buyItem
call .isThereEnoughMoney call .isThereEnoughMoney
jr c,.notEnoughMoney jr c,.notEnoughMoney
@ -166,11 +184,11 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
call AddItemToInventory call AddItemToInventory
jr nc,.bagFull jr nc,.bagFull
call SubtractAmountPaidFromMoney call SubtractAmountPaidFromMoney
ld a,[wcf0a] ; flag that is set if something is sold or bought ld a,[wBoughtOrSoldItemInMart]
and a and a
jr nz,.skipSettingFlag2 jr nz,.skipSettingFlag2
ld a,$01 ld a,1
ld [wcf0a],a ld [wBoughtOrSoldItemInMart],a
.skipSettingFlag2 .skipSettingFlag2
ld a,(SFX_02_5a - SFX_Headers_02) / 3 ld a,(SFX_02_5a - SFX_Headers_02) / 3
call PlaySoundWaitForCurrent call PlaySoundWaitForCurrent
@ -182,7 +200,7 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
call LoadScreenTilesFromBuffer1 call LoadScreenTilesFromBuffer1
ld a,MONEY_BOX ld a,MONEY_BOX
ld [wTextBoxID],a ld [wTextBoxID],a
call DisplayTextBoxID ; draw money text box call DisplayTextBoxID
ld hl,PokemartAnythingElseText ld hl,PokemartAnythingElseText
call PrintText call PrintText
jp .loop jp .loop
@ -202,10 +220,10 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
.done .done
ld hl,PokemartThankYouText ld hl,PokemartThankYouText
call PrintText call PrintText
ld a,$01 ld a,1
ld [wUpdateSpritesEnabled],a ld [wUpdateSpritesEnabled],a
call UpdateSprites call UpdateSprites
ld a,[wd07e] ld a,[wSavedListScrollOffset]
ld [wListScrollOffset],a ld [wListScrollOffset],a
ret ret

View file

@ -85,10 +85,10 @@ PredefPointers:: ; 4fe79 (13:7e79)
dbw $03,GiveItem dbw $03,GiveItem
add_predef ChangeBGPalColor0_4Frames add_predef ChangeBGPalColor0_4Frames
add_predef FindPathToPlayer add_predef FindPathToPlayer
add_predef Func_480ff add_predef PredefShakeScreenVertically
add_predef CalcPositionOfPlayerRelativeToNPC add_predef CalcPositionOfPlayerRelativeToNPC
add_predef ConvertNPCMovementDirectionsToJoypadMasks add_predef ConvertNPCMovementDirectionsToJoypadMasks
add_predef Func_48125 add_predef PredefShakeScreenHorizontally
add_predef UpdateHPBar add_predef UpdateHPBar
add_predef HPBarLength add_predef HPBarLength
add_predef Diploma_TextBoxBorder add_predef Diploma_TextBoxBorder

View file

@ -11,55 +11,61 @@ ChangeBGPalColor0_4Frames: ; 480eb (12:40eb)
ld [rBGP], a ld [rBGP], a
ret ret
Func_480ff: ; 480ff (12:40ff) PredefShakeScreenVertically: ; 480ff (12:40ff)
; Moves the window down and then back in a sequence of progressively smaller
; numbers of pixels, starting at b.
call GetPredefRegisters call GetPredefRegisters
ld a, $1 ld a, 1
ld [wd0a0], a ld [wDisableVBlankWYUpdate], a
xor a xor a
.asm_48108 .loop
ld [H_NUMTOPRINT], a ; (aliases: H_MULTIPLICAND) ld [$ff96], a
call Func_48119 call .MutateWY
call Func_48119 call .MutateWY
dec b dec b
ld a, b ld a, b
jr nz, .asm_48108 jr nz, .loop
xor a xor a
ld [wd0a0], a ld [wDisableVBlankWYUpdate], a
ret ret
Func_48119: ; 48119 (12:4119) .MutateWY ; 48119 (12:4119)
ld a, [H_NUMTOPRINT] ; (aliases: H_MULTIPLICAND) ld a, [$ff96]
xor b xor b
ld [H_NUMTOPRINT], a ; (aliases: H_MULTIPLICAND) ld [$ff96], a
ld [rWY], a ld [rWY], a
ld c, 3 ld c, 3
jp DelayFrames jp DelayFrames
Func_48125: ; 48125 (12:4125) PredefShakeScreenHorizontally: ; 48125 (12:4125)
; Moves the window right and then back in a sequence of progressively smaller
; numbers of pixels, starting at b.
call GetPredefRegisters call GetPredefRegisters
xor a xor a
.asm_48129 .loop
ld [$ff97], a ld [$ff97], a
call Func_4813f call .MutateWX
ld c, 1 ld c, 1
call DelayFrames call DelayFrames
call Func_4813f call .MutateWX
dec b dec b
ld a, b ld a, b
jr nz, .asm_48129 jr nz, .loop
ld a, $7
; restore normal WX
ld a, 7
ld [rWX], a ld [rWX], a
ret ret
Func_4813f: ; 4813f (12:413f) .MutateWX ; 4813f (12:413f)
ld a, [$ff97] ld a, [$ff97]
xor b xor b
ld [$ff97], a ld [$ff97], a
bit 7, a bit 7, a
jr z, .asm_48149 jr z, .skipZeroing
xor a xor a ; zero a if it's negative
.asm_48149 .skipZeroing
add $7 add 7
ld [rWX], a ld [rWX], a
ld c, 4 ld c, 4
jp DelayFrames jp DelayFrames

View file

@ -11,7 +11,7 @@ Func_1c9c6: ; 1c9c6 (7:49c6)
xor a xor a
ld [wCurrentMenuItem], a ld [wCurrentMenuItem], a
ld [wListScrollOffset], a ld [wListScrollOffset], a
ld [wcf93], a ld [wPrintItemPrices], a
ld a, $4 ld a, $4
ld [wListMenuID], a ld [wListMenuID], a
call DisplayListMenuID call DisplayListMenuID

View file

@ -421,7 +421,7 @@ Func_7393f: ; 7393f (1c:793f)
ld a, $c ld a, $c
ld [wTopMenuItemX], a ld [wTopMenuItemX], a
xor a xor a
ld [wcc37], a ld [wMenuWatchMovingOutOfBounds], a
ld a, [wd5a0] ld a, [wd5a0]
and $7f and $7f
ld [wCurrentMenuItem], a ld [wCurrentMenuItem], a

View file

@ -10,13 +10,13 @@ PromptUserToPlaySlots: ; 3730e (d:730e)
call YesNoChoice call YesNoChoice
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
and a and a
jr nz, .skip jr nz, .done ; if player chose No
dec a dec a
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
ld hl, wcd4f ld hl, wSlotMachineRerollCounter
xor a xor a
ld [hli], a ld [hli], a
ld [hl], $2 ld [hl], SMILE_BUBBLE
predef EmotionBubble predef EmotionBubble
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3
call LoadSlotMachineTiles call LoadSlotMachineTiles
@ -25,30 +25,30 @@ PromptUserToPlaySlots: ; 3730e (d:730e)
call GoPAL_SET call GoPAL_SET
call GBPalNormal call GBPalNormal
ld a, $e4 ld a, $e4
ld [$ff48], a ld [rOBP0], a
ld hl, wd730 ld hl, wd730
set 6, [hl] set 6, [hl]
xor a xor a
ld [W_SUBANIMSUBENTRYADDR], a ld [wSlotMachineAllowMatchesCounter], a
ld hl, wTrainerSpriteOffset ld hl, wStoppingWhichSlotMachineWheel
ld bc, $0014 ld bc, $0014
call FillMemory call FillMemory
call MainSlotMachineLoop call MainSlotMachineLoop
ld hl, wd730 ld hl, wd730
res 6, [hl] res 6, [hl]
xor a xor a
ld [W_SUBANIMSUBENTRYADDR], a ld [wSlotMachineAllowMatchesCounter], a
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3
ld a, $1 ld a, $1
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
call GoPAL_SET_CF1C call GoPAL_SET_CF1C
call ReloadMapSpriteTilePatterns call ReloadMapSpriteTilePatterns
call ReloadTilesetTilePatterns call ReloadTilesetTilePatterns
.skip .done
call LoadScreenTilesFromBuffer2 call LoadScreenTilesFromBuffer2
call Delay3 call Delay3
call GBPalNormal call GBPalNormal
ld a, [wcc5e] ld a, [wSlotMachineSavedROMBank]
push af push af
jp CloseTextDisplay jp CloseTextDisplay
@ -57,43 +57,43 @@ PlaySlotMachineText: ; 37390 (d:7390)
db "@" db "@"
MainSlotMachineLoop: ; 37395 (d:7395) MainSlotMachineLoop: ; 37395 (d:7395)
call SlotMachine_37754 call SlotMachine_PrintCreditCoins
xor a xor a
ld hl, wcd4a ld hl, wPayoutCoins
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
call SlotMachine_3775f call SlotMachine_PrintPayoutCoins
ld hl, BetHowManySlotMachineText ld hl, BetHowManySlotMachineText
call PrintText call PrintText
call SaveScreenTilesToBuffer1 call SaveScreenTilesToBuffer1
.loop .loop
ld a, $3 ld a, A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a ld [wMenuWatchedKeys], a
ld a, $2 ld a, 2
ld [wMaxMenuItem], a ld [wMaxMenuItem], a
ld a, $c ld a, 12
ld [wTopMenuItemY], a ld [wTopMenuItemY], a
ld a, $f ld a, 15
ld [wTopMenuItemX], a ld [wTopMenuItemX], a
xor a xor a
ld [wCurrentMenuItem], a ld [wCurrentMenuItem], a
ld [wLastMenuItem], a ld [wLastMenuItem], a
ld [wcc37], a ld [wMenuWatchMovingOutOfBounds], a
ld hl, wTileMap + $ea hlCoord 14, 11
ld b, $5 ld b, 5
ld c, $4 ld c, 4
call TextBoxBorder call TextBoxBorder
ld hl, wTileMap + $100 hlCoord 16, 12
ld de, CoinMultiplierSlotMachineText ld de, CoinMultiplierSlotMachineText
call PlaceString call PlaceString
call HandleMenuInput call HandleMenuInput
and $2 and B_BUTTON
jp nz, LoadScreenTilesFromBuffer1 jp nz, LoadScreenTilesFromBuffer1
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
ld b, a ld b, a
ld a, $3 ld a, 3
sub b sub b
ld [wcd50], a ld [wSlotMachineBet], a
ld hl, wPlayerCoins ld hl, wPlayerCoins
ld c, a ld c, a
ld a, [hli] ld a, [hli]
@ -107,11 +107,11 @@ MainSlotMachineLoop: ; 37395 (d:7395)
jr .loop jr .loop
.skip1 .skip1
call LoadScreenTilesFromBuffer1 call LoadScreenTilesFromBuffer1
call SlotMachine_37741 call SlotMachine_SubtractBetFromPlayerCoins
call SlotMachine_377d5 call SlotMachine_LightBalls
call SlotMachine_37480 call SlotMachine_SetFlags
ld a, $4 ld a, 4
ld hl, wcd4d ld hl, wSlotMachineWheel1SlipCounter
ld [hli], a ld [hli], a
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
@ -120,8 +120,8 @@ MainSlotMachineLoop: ; 37395 (d:7395)
call PlaySound call PlaySound
ld hl, StartSlotMachineText ld hl, StartSlotMachineText
call PrintText call PrintText
call SlotMachine_374ad call SlotMachine_SpinWheels
call SlotMachine_37588 call SlotMachine_CheckForMatches
ld hl, wPlayerCoins ld hl, wPlayerCoins
ld a, [hli] ld a, [hli]
or [hl] or [hl]
@ -143,7 +143,7 @@ MainSlotMachineLoop: ; 37395 (d:7395)
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
and a and a
ret nz ret nz
call SlotMachine_377ce call SlotMachine_PutOutLitBalls
jp MainSlotMachineLoop jp MainSlotMachineLoop
CoinMultiplierSlotMachineText: ; 3745e (d:745e) CoinMultiplierSlotMachineText: ; 3745e (d:745e)
@ -171,55 +171,55 @@ OneMoreGoSlotMachineText: ; 3747b (d:747b)
TX_FAR _OneMoreGoSlotMachineText TX_FAR _OneMoreGoSlotMachineText
db "@" db "@"
SlotMachine_37480: ; 37480 (d:7480) SlotMachine_SetFlags: ; 37480 (d:7480)
ld hl, wcd4c ld hl, wSlotMachineFlags
bit 7, [hl] bit 7, [hl]
ret nz ret nz
ld a, [W_SUBANIMSUBENTRYADDR] ld a, [wSlotMachineAllowMatchesCounter]
and a and a
jr nz, .skip1 jr nz, .allowMatches
call Random call Random
and a and a
jr z, .skip2 jr z, .setAllowMatchesCounter ; 1/256 (~0.4%) chance
ld b, a ld b, a
ld a, [wcc5b] ld a, [wSlotMachineSevenAndBarModeChance]
cp b cp b
jr c, .skip3 jr c, .allowSevenAndBarMatches
ld a, $d2 ld a, 210
cp b cp b
jr c, .skip1 jr c, .allowMatches ; 55/256 (~21.5%) chance
ld [hl], $0 ld [hl], 0
ret ret
.skip1 .allowMatches
set 6, [hl] set 6, [hl]
ret ret
.skip2 .setAllowMatchesCounter
ld a, $3c ld a, 60
ld [W_SUBANIMSUBENTRYADDR], a ld [wSlotMachineAllowMatchesCounter], a
ret ret
.skip3 .allowSevenAndBarMatches
set 7, [hl] set 7, [hl]
ret ret
SlotMachine_374ad: ; 374ad (d:74ad) SlotMachine_SpinWheels: ; 374ad (d:74ad)
ld c, 20 ld c, 20
.loop1 .loop1
push bc push bc
call SlotMachine_37813 call SlotMachine_AnimWheel1
call SlotMachine_37823 call SlotMachine_AnimWheel2
call SlotMachine_37833 call SlotMachine_AnimWheel3
ld c, 2 ld c, 2
call DelayFrames call DelayFrames
pop bc pop bc
dec c dec c
jr nz, .loop1 jr nz, .loop1
xor a xor a
ld [wTrainerSpriteOffset], a ld [wStoppingWhichSlotMachineWheel], a
.loop2 .loop2
call SlotMachine_37882 call SlotMachine_HandleInputWhileWheelsSpin
call SlotMachine_374df call SlotMachine_StopOrAnimWheel1
call SlotMachine_374fb call SlotMachine_StopOrAnimWheel2
call SlotMachine_37517 call SlotMachine_StopOrAnimWheel3
ret c ret c
ld a, [wOnSGB] ld a, [wOnSGB]
xor $1 xor $1
@ -228,194 +228,214 @@ SlotMachine_374ad: ; 374ad (d:74ad)
call DelayFrames call DelayFrames
jr .loop2 jr .loop2
SlotMachine_374df: ; 374df (d:74df) ; Note that the wheels can only stop when a symbol is centred in the wheel
ld a, [wTrainerSpriteOffset] ; and thus 3 full symbols rather than 2 full symbols and 2 half symbols are
cp $1 ; visible. The 3 functions below ensure this by checking if the wheel offset
jr c, .skip ; is even before stopping the wheel.
ld de, wTrainerEngageDistance
SlotMachine_StopOrAnimWheel1: ; 374df (d:74df)
ld a, [wStoppingWhichSlotMachineWheel]
cp 1
jr c, .animWheel
ld de, wSlotMachineWheel1Offset
ld a, [de] ld a, [de]
rra rra
jr nc, .skip jr nc, .animWheel ; check that a symbol is centred in the wheel
ld hl, wcd4d ld hl, wSlotMachineWheel1SlipCounter
ld a, [hl] ld a, [hl]
and a and a
ret z ret z
dec [hl] dec [hl]
call SlotMachine_3752c call SlotMachine_StopWheel1Early
ret nz ret nz
.skip .animWheel
jp SlotMachine_37813 jp SlotMachine_AnimWheel1
SlotMachine_374fb: ; 374fb (d:74fb) SlotMachine_StopOrAnimWheel2: ; 374fb (d:74fb)
ld a, [wTrainerSpriteOffset] ld a, [wStoppingWhichSlotMachineWheel]
cp $2 cp 2
jr c, .skip jr c, .animWheel
ld de, wTrainerFacingDirection ld de, wSlotMachineWheel2Offset
ld a, [de] ld a, [de]
rra rra
jr nc, .skip jr nc, .animWheel ; check that a symbol is centred in the wheel
ld hl, wcd4e ld hl, wSlotMachineWheel2SlipCounter
ld a, [hl] ld a, [hl]
and a and a
ret z ret z
dec [hl] dec [hl]
call SlotMachine_37552 call SlotMachine_StopWheel2Early
ret z ret z
.skip .animWheel
jp SlotMachine_37823 jp SlotMachine_AnimWheel2
SlotMachine_37517: ; 37517 (d:7517) SlotMachine_StopOrAnimWheel3: ; 37517 (d:7517)
ld a, [wTrainerSpriteOffset] ld a, [wStoppingWhichSlotMachineWheel]
cp $3 cp 3
jr c, .skip jr c, .animWheel
ld de, wTrainerScreenY ld de, wSlotMachineWheel3Offset
ld a, [de] ld a, [de]
rra rra
jr nc, .skip jr nc, .animWheel ; check that a symbol is centred in the wheel
; wheel 3 stops as soon as possible
scf scf
ret ret
.skip .animWheel
call SlotMachine_37833 call SlotMachine_AnimWheel3
and a and a
ret ret
SlotMachine_3752c: ; 3752c (d:752c) SlotMachine_StopWheel1Early: ; 3752c (d:752c)
call SlotMachine_GetWheelOneTile call SlotMachine_GetWheel1Tiles
ld hl, wTrainerScreenX ld hl, wSlotMachineWheel1BottomTile
ld a, [wcd4c] ld a, [wSlotMachineFlags]
and $80 and $80
jr nz, .skip1 jr nz, .sevenAndBarMode
; Stop early if the middle symbol is not a cherry.
inc hl inc hl
ld a, [hl] ld a, [hl]
cp $a cp SLOTSCHERRY >> 8
jr nz, .skip2 jr nz, .stopWheel
ret ret
.skip1 ; It looks like this was intended to make the wheel stop when a 7 symbol was
; visible, but it has a bug and so the wheel stops randomly.
.sevenAndBarMode
ld c, $3 ld c, $3
.loop .loop
ld a, [hli] ld a, [hli]
cp $2 cp SLOTS7 >> 8
jr c, .skip2 jr c, .stopWheel ; condition never true
dec c dec c
jr nz, .loop jr nz, .loop
ret ret
.skip2 .stopWheel
inc a inc a
ld hl, wcd4d ld hl, wSlotMachineWheel1SlipCounter
ld [hl], $0 ld [hl], 0
ret ret
SlotMachine_37552: ; 37552 (d:7552) SlotMachine_StopWheel2Early: ; 37552 (d:7552)
call SlotMachine_GetWheelTwoTile call SlotMachine_GetWheel2Tiles
ld a, [wcd4c] ld a, [wSlotMachineFlags]
and $80 and $80
jr nz, .skip1 jr nz, .sevenAndBarMode
call SlotMachine_3756e ; Stop early if any symbols are lined up in the first two wheels.
call SlotMachine_FindWheel1Wheel2Matches
ret nz ret nz
jr .skip2 jr .stopWheel
.skip1 ; Stop early if two 7 symbols or two bar symbols are lined up in the first two
call SlotMachine_3756e ; wheels OR if no symbols are lined up and the bottom symbol in wheel 2 is a
; 7 symbol or bar symbol. The second part could be a bug or a way to reduce the
; player's odds.
.sevenAndBarMode
call SlotMachine_FindWheel1Wheel2Matches
ld a, [de] ld a, [de]
cp $7 cp (SLOTSBAR >> 8) + 1
ret nc ret nc
.skip2 .stopWheel
xor a xor a
ld [wcd4e], a ld [wSlotMachineWheel2SlipCounter], a
ret ret
SlotMachine_3756e: ; 3756e (d:756e) SlotMachine_FindWheel1Wheel2Matches: ; 3756e (d:756e)
ld hl, wTrainerScreenX ; return whether wheel 1 and wheel 2's current positions allow a match (given
ld de, wcd44 ; that wheel 3 stops in a good position) in Z
ld hl, wSlotMachineWheel1BottomTile
ld de, wSlotMachineWheel2BottomTile
ld a, [de] ld a, [de]
cp [hl] cp [hl] ; wheel 1 bottom, wheel 2 bottom
ret z ret z
inc de inc de
ld a, [de] ld a, [de]
cp [hl] cp [hl] ; wheel 1 bottom, wheel 2 middle
ret z ret z
inc hl inc hl
cp [hl] cp [hl] ; wheel 1 middle, wheel 2 middle
ret z ret z
inc hl inc hl
cp [hl] cp [hl] ; wheel 1 top, wheel 2 middle
ret z ret z
inc de inc de
ld a, [de] ld a, [de]
cp [hl] cp [hl] ; wheel 1 top, wheel 2 top
ret z ret z
dec de dec de
dec de dec de
ret ret
SlotMachine_37588: ; 37588 (d:7588) SlotMachine_CheckForMatches: ; 37588 (d:7588)
call SlotMachine_GetWheelThreeTile call SlotMachine_GetWheel3Tiles
ld a, [wcd50] ld a, [wSlotMachineBet]
cp $2 cp 2
jr z, .skip1 jr z, .checkMatchesFor2CoinBet
cp $1 cp 1
jr z, .skip2 jr z, .checkMatchFor1CoinBet
ld hl, wTrainerScreenX ; 3 coin bet allows diagonal matches (plus the matches for 1/2 coin bets)
ld de, wcd45 ld hl, wSlotMachineWheel1BottomTile
ld bc, wcd49 ld de, wSlotMachineWheel2MiddleTile
ld bc, wSlotMachineWheel3TopTile
call SlotMachine_CheckForMatch call SlotMachine_CheckForMatch
jp z, .skip5 jp z, .foundMatch
ld hl, wcd43 ld hl, wSlotMachineWheel1TopTile
ld de, wcd45 ld de, wSlotMachineWheel2MiddleTile
ld bc, wcd47 ld bc, wSlotMachineWheel3BottomTile
call SlotMachine_CheckForMatch call SlotMachine_CheckForMatch
jr z, .skip5 jr z, .foundMatch
.skip1 ; 2 coin bet allows top/bottom horizontal matches (plus the match for a 1 coin bet)
ld hl, wcd43 .checkMatchesFor2CoinBet
ld de, wcd46 ld hl, wSlotMachineWheel1TopTile
ld bc, wcd49 ld de, wSlotMachineWheel2TopTile
ld bc, wSlotMachineWheel3TopTile
call SlotMachine_CheckForMatch call SlotMachine_CheckForMatch
jr z, .skip5 jr z, .foundMatch
ld hl, wTrainerScreenX ld hl, wSlotMachineWheel1BottomTile
ld de, wcd44 ld de, wSlotMachineWheel2BottomTile
ld bc, wcd47 ld bc, wSlotMachineWheel3BottomTile
call SlotMachine_CheckForMatch call SlotMachine_CheckForMatch
jr z, .skip5 jr z, .foundMatch
.skip2 ; 1 coin bet only allows a middle horizontal match
ld hl, wcd42 .checkMatchFor1CoinBet
ld de, wcd45 ld hl, wSlotMachineWheel1MiddleTile
ld bc, wcd48 ld de, wSlotMachineWheel2MiddleTile
ld bc, wSlotMachineWheel3MiddleTile
call SlotMachine_CheckForMatch call SlotMachine_CheckForMatch
jr z, .skip5 jr z, .foundMatch
ld a, [wcd4c] ld a, [wSlotMachineFlags]
and $c0 and $c0
jr z, .skip3 jr z, .noMatch
ld hl, wcd4f ld hl, wSlotMachineRerollCounter
dec [hl] dec [hl]
jr nz, .skip4 jr nz, .rollWheel3DownByOneSymbol
.skip3 .noMatch
ld hl, NotThisTimeText ld hl, NotThisTimeText
call PrintText call PrintText
.loop .done
xor a xor a
ld [wc002], a ld [wc002], a
ret ret
.skip4 .rollWheel3DownByOneSymbol
call SlotMachine_37833 call SlotMachine_AnimWheel3
call DelayFrame call DelayFrame
call SlotMachine_37833 call SlotMachine_AnimWheel3
call DelayFrame call DelayFrame
jp SlotMachine_37588 jp SlotMachine_CheckForMatches
.skip5 .foundMatch
ld a, [wcd4c] ld a, [wSlotMachineFlags]
and $c0 and $c0
jr z, .skip4 jr z, .rollWheel3DownByOneSymbol ; roll wheel if player isn't allowed to win
and $80 and $80
jr nz, .skip6 jr nz, .acceptMatch
; if 7/bar matches aren't enabled and the match was a 7/bar symbol, roll wheel
ld a, [hl] ld a, [hl]
cp $7 cp (SLOTSBAR >> 8) + 1
jr c, .skip4 jr c, .rollWheel3DownByOneSymbol
.skip6 .acceptMatch
ld a, [hl] ld a, [hl]
sub $2 sub $2
ld [wTrainerScreenX], a ld [wSlotMachineWinningSymbol], a
ld hl, SlotRewardPointers ld hl, SlotRewardPointers
ld c, a ld c, a
ld b, $0 ld b, 0
add hl, bc add hl, bc
ld a, [hli] ld a, [hli]
ld e, a ld e, a
@ -426,39 +446,39 @@ SlotMachine_37588: ; 37588 (d:7588)
ld h, [hl] ld h, [hl]
ld l, a ld l, a
ld de, wcf4b ld de, wcf4b
ld bc, $0004 ld bc, 4
call CopyData call CopyData
pop hl pop hl
ld de, .asm_37638 ld de, .flashScreenLoop
push de push de
jp [hl] jp [hl]
.asm_37638 .flashScreenLoop
ld a, [$ff47] ld a, [rBGP]
xor $40 xor $40
ld [$ff47], a ld [rBGP], a
ld c, 5 ld c, 5
call DelayFrames call DelayFrames
dec b dec b
jr nz, .asm_37638 jr nz, .flashScreenLoop
ld hl, wcd4a ld hl, wPayoutCoins
ld [hl], d ld [hl], d
inc hl inc hl
ld [hl], e ld [hl], e
call SlotMachine_3775f call SlotMachine_PrintPayoutCoins
ld hl, SlotsMachineText_37665 ld hl, SymbolLinedUpSlotMachineText
call PrintText call PrintText
call WaitForTextScrollButtonPress call WaitForTextScrollButtonPress
call SlotMachine_3776b call SlotMachine_PayCoinsToPlayer
call SlotMachine_3775f call SlotMachine_PrintPayoutCoins
ld a, $e4 ld a, $e4
ld [$ff48], a ld [rOBP0], a
jp .loop jp .done
SlotsMachineText_37665: ; 37665 (d:7665) SymbolLinedUpSlotMachineText: ; 37665 (d:7665)
TX_ASM TX_ASM
push bc push bc
call SlotMachine_37728 call SlotMachine_PrintWinningSymbol
ld hl, LinedUpText ld hl, LinedUpText
pop bc pop bc
inc bc inc bc
@ -510,28 +530,28 @@ SlotMachine_CheckForMatch: ; 376a2 (d:76a2)
cp [hl] cp [hl]
ret ret
SlotMachine_GetWheelThreeTile: ; 376a8 (d:76a8) SlotMachine_GetWheel3Tiles: ; 376a8 (d:76a8)
ld de, wcd47 ld de, wSlotMachineWheel3BottomTile
ld hl, SlotMachineWheel3 ld hl, SlotMachineWheel3
ld a, [wTrainerScreenY] ld a, [wSlotMachineWheel3Offset]
call SlotMachine_GetWheelTile call SlotMachine_GetWheelTiles
SlotMachine_GetWheelTwoTile: ; 376b4 (d:76b4) SlotMachine_GetWheel2Tiles: ; 376b4 (d:76b4)
ld de, wcd44 ld de, wSlotMachineWheel2BottomTile
ld hl, SlotMachineWheel2 ld hl, SlotMachineWheel2
ld a, [wTrainerFacingDirection] ld a, [wSlotMachineWheel2Offset]
call SlotMachine_GetWheelTile call SlotMachine_GetWheelTiles
SlotMachine_GetWheelOneTile: ; 376c0 (d:76c0) SlotMachine_GetWheel1Tiles: ; 376c0 (d:76c0)
ld de, wTrainerScreenX ld de, wSlotMachineWheel1BottomTile
ld hl, SlotMachineWheel1 ld hl, SlotMachineWheel1
ld a, [wTrainerEngageDistance] ld a, [wSlotMachineWheel1Offset]
SlotMachine_GetWheelTile: ; 376c9 (d:76c9) SlotMachine_GetWheelTiles: ; 376c9 (d:76c9)
ld c, a ld c, a
ld b, $0 ld b, 0
add hl, bc add hl, bc
ld c, $3 ld c, 3
.loop .loop
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
@ -542,7 +562,7 @@ SlotMachine_GetWheelTile: ; 376c9 (d:76c9)
ret ret
SlotReward8Func: ; 376d7 (d:76d7) SlotReward8Func: ; 376d7 (d:76d7)
ld hl, W_SUBANIMSUBENTRYADDR ld hl, wSlotMachineAllowMatchesCounter
ld a, [hl] ld a, [hl]
and a and a
jr z, .skip jr z, .skip
@ -553,7 +573,7 @@ SlotReward8Func: ; 376d7 (d:76d7)
ret ret
SlotReward15Func: ; 376e5 (d:76e5) SlotReward15Func: ; 376e5 (d:76e5)
ld hl, W_SUBANIMSUBENTRYADDR ld hl, wSlotMachineAllowMatchesCounter
ld a, [hl] ld a, [hl]
and a and a
jr z, .skip jr z, .skip
@ -567,7 +587,7 @@ SlotReward100Func: ; 376f3 (d:76f3)
ld a, (SFX_1f_42 - SFX_Headers_1f) / 3 ld a, (SFX_1f_42 - SFX_Headers_1f) / 3
call PlaySound call PlaySound
xor a xor a
ld [wcd4c], a ld [wSlotMachineFlags], a
ld b, $8 ld b, $8
ld de, 100 ld de, 100
ret ret
@ -581,9 +601,9 @@ SlotReward300Func: ; 37702 (d:7702)
cp $80 cp $80
ld a, $0 ld a, $0
jr c, .skip jr c, .skip
ld [wcd4c], a ld [wSlotMachineFlags], a
.skip .skip
ld [W_SUBANIMSUBENTRYADDR], a ld [wSlotMachineAllowMatchesCounter], a
ld b, $14 ld b, $14
ld de, 300 ld de, 300
ret ret
@ -592,26 +612,27 @@ YeahText: ; 37722 (d:7722)
TX_FAR _YeahText TX_FAR _YeahText
db $0a, "@" db $0a, "@"
SlotMachine_37728: ; 37728 (d:7728) SlotMachine_PrintWinningSymbol: ; 37728 (d:7728)
ld hl, wTileMap + $11a ; prints winning symbol and down arrow in text box
ld a, [wTrainerScreenX] hlCoord 2, 14
ld a, [wSlotMachineWinningSymbol]
add $25 add $25
ld [hli], a ld [hli], a
inc a inc a
ld [hld], a ld [hld], a
inc a inc a
ld de, $ffec ld de, -SCREEN_WIDTH
add hl, de add hl, de
ld [hli], a ld [hli], a
inc a inc a
ld [hl], a ld [hl], a
ld hl, wTileMap + $152 hlCoord 18, 16
ld [hl], $ee ld [hl], $ee ; down arrow
ret ret
SlotMachine_37741: ; 37741 (d:7741) SlotMachine_SubtractBetFromPlayerCoins: ; 37741 (d:7741)
ld hl, wcd4b ld hl, wTempCoins2 + 1
ld a, [wcd50] ld a, [wSlotMachineBet]
ld [hld], a ld [hld], a
xor a xor a
ld [hli], a ld [hli], a
@ -619,136 +640,143 @@ SlotMachine_37741: ; 37741 (d:7741)
ld c, $2 ld c, $2
predef SubBCDPredef predef SubBCDPredef
SlotMachine_37754: ; 37754 (d:7754) SlotMachine_PrintCreditCoins: ; 37754 (d:7754)
ld hl, wTileMap + $19 hlCoord 5, 1
ld de, wPlayerCoins ld de, wPlayerCoins
ld c, $2 ld c, $2
jp PrintBCDNumber jp PrintBCDNumber
SlotMachine_3775f: ; 3775f (d:775f) SlotMachine_PrintPayoutCoins: ; 3775f (d:775f)
ld hl, wTileMap + $1f hlCoord 11, 1
ld de, wcd4a ld de, wPayoutCoins
ld bc, $8204 ld bc, $8204 ; 2 bytes, 4 digits, leading zeroes
jp PrintNumber jp PrintNumber
SlotMachine_3776b: ; 3776b (d:776b) SlotMachine_PayCoinsToPlayer: ; 3776b (d:776b)
ld a, $1 ld a, $1
ld [wc002], a ld [wc002], a
call WaitForSoundToFinish call WaitForSoundToFinish
ld hl, wcd46
; Put 1 in the temp coins variable. This value is added to the player's coins
; repeatedly so the player can watch the value go up 1 coin at a time.
ld hl, wTempCoins1
xor a xor a
ld [hli], a ld [hli], a
inc a inc a
ld [hl], a ld [hl], a
ld a, $5
ld [W_SUBANIMTRANSFORM], a ld a, 5
ld [wAnimCounter], a
; Subtract 1 from the payout amount and add 1 to the player's coins each
; iteration until the payout amount reaches 0.
.loop .loop
ld a, [wcd4b] ld a, [wPayoutCoins + 1]
ld l, a ld l, a
ld a, [wcd4a] ld a, [wPayoutCoins]
ld h, a ld h, a
or l or l
ret z ret z
ld de, $ffff ld de, -1
add hl, de add hl, de
ld a, l ld a, l
ld [wcd4b], a ld [wPayoutCoins + 1], a
ld a, h ld a, h
ld [wcd4a], a ld [wPayoutCoins], a
ld hl, wcd47 ld hl, wTempCoins1 + 1
ld de, wPlayerCoins + 1 ld de, wPlayerCoins + 1
ld c, $2 ld c, $2
predef AddBCDPredef predef AddBCDPredef
call SlotMachine_37754 call SlotMachine_PrintCreditCoins
call SlotMachine_3775f call SlotMachine_PrintPayoutCoins
ld a, (SFX_1f_65 - SFX_Headers_1f) / 3 ld a, (SFX_1f_65 - SFX_Headers_1f) / 3
call PlaySound call PlaySound
ld a, [W_SUBANIMTRANSFORM] ld a, [wAnimCounter]
dec a dec a
jr nz, .skip1 jr nz, .skip1
ld a, [$ff48] ld a, [rOBP0]
xor $40 xor $40 ; make the slot wheel symbols flash
ld [$ff48], a ld [rOBP0], a
ld a, $5 ld a, 5
.skip1 .skip1
ld [W_SUBANIMTRANSFORM], a ld [wAnimCounter], a
ld a, [wTrainerScreenX] ld a, [wSlotMachineWinningSymbol]
cp $7 cp (SLOTSBAR >> 8) + 1
ld c, 8 ld c, 8
jr nc, .skip2 jr nc, .skip2
srl c srl c ; c = 4 (make the the coins transfer faster if the symbol was 7 or bar)
.skip2 .skip2
call DelayFrames call DelayFrames
jr .loop jr .loop
SlotMachine_377ce: ; 377ce (d:77ce) SlotMachine_PutOutLitBalls: ; 377ce (d:77ce)
ld a, $23 ld a, $23
ld [wd08a], a ld [wd08a], a
jr SlotMachine_377e3 jr SlotMachine_UpdateThreeCoinBallTiles
SlotMachine_377d5: ; 377d5 (d:77d5) SlotMachine_LightBalls: ; 377d5 (d:77d5)
ld a, $14 ld a, $14
ld [wd08a], a ld [wd08a], a
ld a, [wcd50] ld a, [wSlotMachineBet]
dec a dec a
jr z, SlotMachine_377fb jr z, SlotMachine_UpdateOneCoinBallTiles
dec a dec a
jr z, SlotMachine_377ef jr z, SlotMachine_UpdateTwoCoinBallTiles
SlotMachine_377e3: ; 377e3 (d:77e3) SlotMachine_UpdateThreeCoinBallTiles: ; 377e3 (d:77e3)
ld hl, wTileMap + $2b hlCoord 3, 2
call SlotMachine_377fe call SlotMachine_UpdateBallTiles
ld hl, wTileMap + $cb hlCoord 3, 10
call SlotMachine_377fe call SlotMachine_UpdateBallTiles
SlotMachine_377ef: ; 377ef (d:77ef) SlotMachine_UpdateTwoCoinBallTiles: ; 377ef (d:77ef)
ld hl, wTileMap + $53 hlCoord 3, 4
call SlotMachine_377fe call SlotMachine_UpdateBallTiles
ld hl, wTileMap + $a3 hlCoord 3, 8
call SlotMachine_377fe call SlotMachine_UpdateBallTiles
SlotMachine_377fb: ; 377fb (d:77fb) SlotMachine_UpdateOneCoinBallTiles: ; 377fb (d:77fb)
ld hl, wTileMap + $7b hlCoord 3, 6
SlotMachine_377fe: ; 377fe (d:77fe) SlotMachine_UpdateBallTiles: ; 377fe (d:77fe)
ld a, [wd08a] ld a, [wd08a]
ld [hl], a ld [hl], a
ld bc, $000d ld bc, 13
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ld bc, $0007 ld bc, 7
add hl, bc add hl, bc
inc a inc a
ld [hl], a ld [hl], a
ld bc, $000d ld bc, 13
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ret ret
SlotMachine_37813: ; 37813 (d:7813) SlotMachine_AnimWheel1: ; 37813 (d:7813)
ld bc, SlotMachineWheel1 ld bc, SlotMachineWheel1
ld de, wTrainerEngageDistance ld de, wSlotMachineWheel1Offset
ld hl, wOAMBuffer ld hl, wOAMBuffer
ld a, $30 ld a, $30
ld [W_BASECOORDX], a ld [W_BASECOORDX], a
jr SlotMachine_37841 jr SlotMachine_AnimWheel
SlotMachine_37823: ; 37823 (d:7823) SlotMachine_AnimWheel2: ; 37823 (d:7823)
ld bc, SlotMachineWheel2 ld bc, SlotMachineWheel2
ld de, wTrainerFacingDirection ld de, wSlotMachineWheel2Offset
ld hl, wOAMBuffer + $30 ld hl, wOAMBuffer + $30
ld a, $50 ld a, $50
ld [W_BASECOORDX], a ld [W_BASECOORDX], a
jr SlotMachine_37841 jr SlotMachine_AnimWheel
SlotMachine_37833: ; 37833 (d:7833) SlotMachine_AnimWheel3: ; 37833 (d:7833)
ld bc, SlotMachineWheel3 ld bc, SlotMachineWheel3
ld de, wTrainerScreenY ld de, wSlotMachineWheel3Offset
ld hl, wOAMBuffer + $60 ld hl, wOAMBuffer + $60
ld a, $70 ld a, $70
ld [W_BASECOORDX], a ld [W_BASECOORDX], a
SlotMachine_37841: ; 37841 (d:7841) SlotMachine_AnimWheel: ; 37841 (d:7841)
ld a, $58 ld a, $58
ld [W_BASECOORDY], a ld [W_BASECOORDY], a
push de push de
@ -756,10 +784,9 @@ SlotMachine_37841: ; 37841 (d:7841)
ld d, b ld d, b
add c add c
ld e, a ld e, a
jr nc, SlotMachine_3784e jr nc, .loop
inc d inc d
.loop
SlotMachine_3784e: ; 3784e (d:784e)
ld a, [W_BASECOORDY] ld a, [W_BASECOORDY]
ld [hli], a ld [hli], a
ld a, [W_BASECOORDX] ld a, [W_BASECOORDX]
@ -783,30 +810,30 @@ SlotMachine_3784e: ; 3784e (d:784e)
sub $8 sub $8
ld [W_BASECOORDY], a ld [W_BASECOORDY], a
cp $28 cp $28
jr nz, SlotMachine_3784e jr nz, .loop
pop de pop de
ld a, [de] ld a, [de]
inc a inc a ; advance the offset so that the wheel animates
cp $1e cp 30
jr nz, .skip jr nz, .skip
xor a xor a ; wrap around to 0 when the offset reaches 30
.skip .skip
ld [de], a ld [de], a
ret ret
SlotMachine_37882: ; 37882 (d:7882) SlotMachine_HandleInputWhileWheelsSpin: ; 37882 (d:7882)
call DelayFrame call DelayFrame
call JoypadLowSensitivity call JoypadLowSensitivity
ld a, [hJoy5] ld a, [hJoy5]
and $1 and A_BUTTON
ret z ret z
ld hl, wTrainerSpriteOffset ld hl, wStoppingWhichSlotMachineWheel
ld a, [hl] ld a, [hl]
dec a dec a
ld de, wcd4d ld de, wSlotMachineWheel1SlipCounter
jr z, .skip jr z, .skip
dec a dec a
ld de, wcd4e ld de, wSlotMachineWheel2SlipCounter
jr z, .skip jr z, .skip
.loop .loop
inc [hl] inc [hl]
@ -845,20 +872,13 @@ LoadSlotMachineTiles: ; 378a8 (d:78a8)
ld [hli], a ld [hli], a
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
call SlotMachine_37813 call SlotMachine_AnimWheel1
call SlotMachine_37823 call SlotMachine_AnimWheel2
jp SlotMachine_37833 jp SlotMachine_AnimWheel3
SlotMachineMap: ; 378f5 (d:78f5) SlotMachineMap: ; 378f5 (d:78f5)
INCBIN "gfx/tilemaps/slotmachine.map" INCBIN "gfx/tilemaps/slotmachine.map"
SLOTS7 EQU $0200
SLOTSBAR EQU $0604
SLOTSCHERRY EQU $0A08
SLOTSFISH EQU $0E0C
SLOTSBIRD EQU $1210
SLOTSMOUSE EQU $1614
INCLUDE "data/slot_machine_wheels.asm" INCLUDE "data/slot_machine_wheels.asm"
SlotMachineTiles1: ; 37a51 (d:7a51) SlotMachineTiles1: ; 37a51 (d:7a51)

View file

@ -348,7 +348,7 @@ Func_4524: ; 4524 (1:4524)
jp LoadFrontSpriteByMonIndex jp LoadFrontSpriteByMonIndex
Func_4533: ; 4533 (1:4533) Func_4533: ; 4533 (1:4533)
ld [$ffbd], a ld [H_AUTOBGTRANSFERDEST + 1], a
jp Delay3 jp Delay3
LoadCopyrightAndTextBoxTiles: ; 4538 (1:4538) LoadCopyrightAndTextBoxTiles: ; 4538 (1:4538)

View file

@ -10,7 +10,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e)
ld a, [W_CURMAP] ld a, [W_CURMAP]
push af push af
ld b, $0 ld b, $0
call Func_711c4 call DrawPlayerOrBirdSprite ; player sprite
hlCoord 1, 0 hlCoord 1, 0
ld de, wcd6d ld de, wcd6d
call PlaceString call PlaceString
@ -23,7 +23,7 @@ DisplayTownMap: ; 70e3e (1c:4e3e)
ld bc, (BANK(TownMapCursor) << 8) + $04 ld bc, (BANK(TownMapCursor) << 8) + $04
call CopyVideoDataDouble call CopyVideoDataDouble
xor a xor a
ld [wWhichTrade], a ld [wWhichTownMapLocation], a
pop af pop af
jr .enterLoop jr .enterLoop
@ -32,29 +32,29 @@ DisplayTownMap: ; 70e3e (1c:4e3e)
ld bc, $114 ld bc, $114
call ClearScreenArea call ClearScreenArea
ld hl, TownMapOrder ld hl, TownMapOrder
ld a, [wWhichTrade] ld a, [wWhichTownMapLocation]
ld c, a ld c, a
ld b, $0 ld b, 0
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
.enterLoop .enterLoop
ld de, wHPBarMaxHP ld de, wTownMapCoords
call FindTownMapCoords call LoadTownMapEntry
ld a, [de] ld a, [de]
push hl push hl
call SetTownMapOAMCoords call TownMapCoordsToOAMCoords
ld a, $4 ld a, $4
ld [wcd5b], a ld [wOAMBaseTile], a
ld hl, wOAMBuffer + $10 ld hl, wOAMBuffer + $10
call Func_71279 call WriteTownMapSpriteOAM ; town map cursor sprite
pop hl pop hl
ld de, wcd6d ld de, wcd6d
.asm_70eac .copyMapName
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
inc de inc de
cp $50 cp $50
jr nz, .asm_70eac jr nz, .copyMapName
hlCoord 1, 0 hlCoord 1, 0
ld de, wcd6d ld de, wcd6d
call PlaceString call PlaceString
@ -72,35 +72,35 @@ DisplayTownMap: ; 70e3e (1c:4e3e)
ld a, (SFX_02_3c - SFX_Headers_02) / 3 ld a, (SFX_02_3c - SFX_Headers_02) / 3
call PlaySound call PlaySound
bit 6, b bit 6, b
jr nz, .upPressed jr nz, .pressedUp
bit 7, b bit 7, b
jr nz, .downPressed jr nz, .pressedDown
xor a xor a
ld [wTownMapSpriteBlinkingEnabled], a ld [wTownMapSpriteBlinkingEnabled], a
ld [hJoy7], a ld [hJoy7], a
ld [wTownMapSpriteBlinkingCounter], a ld [wAnimCounter], a
call ExitTownMap call ExitTownMap
pop hl pop hl
pop af pop af
ld [hl], a ld [hl], a
ret ret
.upPressed .pressedUp
ld a, [wWhichTrade] ld a, [wWhichTownMapLocation]
inc a inc a
cp TownMapOrderEnd - TownMapOrder ; number of list items + 1 cp TownMapOrderEnd - TownMapOrder ; number of list items + 1
jr nz, .noOverflow jr nz, .noOverflow
xor a xor a
.noOverflow .noOverflow
ld [wWhichTrade], a ld [wWhichTownMapLocation], a
jp .townMapLoop jp .townMapLoop
.downPressed .pressedDown
ld a, [wWhichTrade] ld a, [wWhichTownMapLocation]
dec a dec a
cp $ff cp -1
jr nz, .noUnderflow jr nz, .noUnderflow
ld a, TownMapOrderEnd - TownMapOrder - 1 ; number of list items ld a, TownMapOrderEnd - TownMapOrder - 1 ; number of list items
.noUnderflow .noUnderflow
ld [wWhichTrade], a ld [wWhichTownMapLocation], a
jp .townMapLoop jp .townMapLoop
INCLUDE "data/town_map_order.asm" INCLUDE "data/town_map_order.asm"
@ -146,7 +146,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90)
ld hl, vChars1 + $6d0 ld hl, vChars1 + $6d0
ld bc, (BANK(TownMapUpArrow) << 8) + $01 ld bc, (BANK(TownMapUpArrow) << 8) + $01
call CopyVideoDataDouble call CopyVideoDataDouble
call SetupVisitedTownsList call BuildFlyLocationsList
ld hl, wUpdateSpritesEnabled ld hl, wUpdateSpritesEnabled
ld a, [hl] ld a, [hl]
push af push af
@ -157,10 +157,9 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90)
call PlaceString call PlaceString
ld a, [W_CURMAP] ld a, [W_CURMAP]
ld b, $0 ld b, $0
call Func_711c4 call DrawPlayerOrBirdSprite
ld hl, wTrainerEngageDistance ld hl, wFlyLocationsList
deCoord 18, 0 deCoord 18, 0
.townMapFlyLoop .townMapFlyLoop
ld a, $7f ld a, $7f
ld [de], a ld [de], a
@ -172,7 +171,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90)
pop hl pop hl
ld a, [hl] ld a, [hl]
ld b, $4 ld b, $4
call Func_711c4 call DrawPlayerOrBirdSprite ; draw bird sprite
hlCoord 3, 0 hlCoord 3, 0
ld de, wcd6d ld de, wcd6d
call PlaceString call PlaceString
@ -193,15 +192,15 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90)
and A_BUTTON | B_BUTTON | D_UP | D_DOWN and A_BUTTON | B_BUTTON | D_UP | D_DOWN
jr z, .inputLoop jr z, .inputLoop
bit 0, b bit 0, b
jr nz, .aButtonPressed jr nz, .pressedA
ld a, (SFX_02_3c - SFX_Headers_02) / 3 ld a, (SFX_02_3c - SFX_Headers_02) / 3
call PlaySound call PlaySound
bit 6, b bit 6, b
jr nz, .upPressed jr nz, .pressedUp
bit 7, b bit 7, b
jr nz, .downPressed jr nz, .pressedDown
jr .bButtonPressed jr .pressedB
.aButtonPressed .pressedA
ld a, (SFX_02_3e - SFX_Headers_02) / 3 ld a, (SFX_02_3e - SFX_Headers_02) / 3
call PlaySound call PlaySound
ld a, [hl] ld a, [hl]
@ -210,7 +209,7 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90)
set 3, [hl] set 3, [hl]
inc hl inc hl
set 7, [hl] set 7, [hl]
.bButtonPressed .pressedB
xor a xor a
ld [wTownMapSpriteBlinkingEnabled], a ld [wTownMapSpriteBlinkingEnabled], a
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3
@ -218,36 +217,36 @@ LoadTownMap_Fly: ; 70f90 (1c:4f90)
pop af pop af
ld [hl], a ld [hl], a
ret ret
.upPressed .pressedUp
deCoord 18, 0 deCoord 18, 0
inc hl inc hl
ld a, [hl] ld a, [hl]
cp $ff cp $ff
jr z, .asm_71052 jr z, .wrapToStartOfList
cp $fe cp $fe
jr z, .upPressed jr z, .pressedUp ; skip past unvisited towns
jp .townMapFlyLoop jp .townMapFlyLoop
.asm_71052 .wrapToStartOfList
ld hl, wTrainerEngageDistance ld hl, wFlyLocationsList
jp .townMapFlyLoop jp .townMapFlyLoop
.downPressed .pressedDown
deCoord 19, 0 deCoord 19, 0
dec hl dec hl
ld a, [hl] ld a, [hl]
cp $ff cp $ff
jr z, .asm_71068 jr z, .wrapToEndOfList
cp $fe cp $fe
jr z, .downPressed jr z, .pressedDown ; skip past unvisited towns
jp .townMapFlyLoop jp .townMapFlyLoop
.asm_71068 .wrapToEndOfList
ld hl, wcd49 ld hl, wFlyLocationsList + 11
jr .downPressed jr .pressedDown
ToText: ; 7106d (1c:506d) ToText: ; 7106d (1c:506d)
db "To@" db "To@"
SetupVisitedTownsList: ; 71070 (1c:5070) BuildFlyLocationsList: ; 71070 (1c:5070)
ld hl, wWhichTrade ld hl, wFlyLocationsList - 1
ld [hl], $ff ld [hl], $ff
inc hl inc hl
ld a, [W_TOWNVISITEDFLAG] ld a, [W_TOWNVISITEDFLAG]
@ -258,9 +257,9 @@ SetupVisitedTownsList: ; 71070 (1c:5070)
.loop .loop
srl d srl d
rr e rr e
ld a, $fe ld a, $fe ; store $fe if the town hasn't been visited
jr nc, .notVisited jr nc, .notVisited
ld a, b ld a, b ; store the map number of the town if it has been visited
.notVisited .notVisited
ld [hl], a ld [hl], a
inc hl inc hl
@ -305,10 +304,10 @@ LoadTownMap: ; 7109b (1c:509b)
swap a swap a
and $f and $f
add $60 add $60
.uncompressTile .writeRunLoop
ld [hli], a ld [hli], a
dec c dec c
jr nz, .uncompressTile jr nz, .writeRunLoop
inc de inc de
jr .nextTile jr .nextTile
.done .done
@ -318,7 +317,7 @@ LoadTownMap: ; 7109b (1c:509b)
call Delay3 call Delay3
call GBPalNormal call GBPalNormal
xor a xor a
ld [wTownMapSpriteBlinkingCounter], a ld [wAnimCounter], a
inc a inc a
ld [wTownMapSpriteBlinkingEnabled], a ld [wTownMapSpriteBlinkingEnabled], a
ret ret
@ -328,6 +327,7 @@ CompressedMap: ; 71100 (1c:5100)
INCBIN "gfx/town_map.rle" INCBIN "gfx/town_map.rle"
ExitTownMap: ; 711ab (1c:51ab) ExitTownMap: ; 711ab (1c:51ab)
; clear town map graphics data and load usual graphics data
xor a xor a
ld [wTownMapSpriteBlinkingEnabled], a ld [wTownMapSpriteBlinkingEnabled], a
call GBPalWhiteOut call GBPalWhiteOut
@ -338,17 +338,19 @@ ExitTownMap: ; 711ab (1c:51ab)
call UpdateSprites call UpdateSprites
jp GoPAL_SET_CF1C jp GoPAL_SET_CF1C
Func_711c4: ; 711c4 (1c:51c4) DrawPlayerOrBirdSprite: ; 711c4 (1c:51c4)
; a = map number
; b = OAM base tile
push af push af
ld a, b ld a, b
ld [wcd5b], a ld [wOAMBaseTile], a
pop af pop af
ld de, wHPBarMaxHP ld de, wTownMapCoords
call FindTownMapCoords call LoadTownMapEntry
ld a, [de] ld a, [de]
push hl push hl
call SetTownMapOAMCoords call TownMapCoordsToOAMCoords
call Func_7126d call WritePlayerOrBirdSpriteOAM
pop hl pop hl
ld de, wcd6d ld de, wcd6d
.asm_711dc .asm_711dc
@ -364,33 +366,34 @@ Func_711c4: ; 711c4 (1c:51c4)
DisplayWildLocations: ; 711ef (1c:51ef) DisplayWildLocations: ; 711ef (1c:51ef)
callba FindWildLocationsOfMon callba FindWildLocationsOfMon
call Func_712d9 call ZeroOutDuplicatesInList
ld hl, wOAMBuffer ld hl, wOAMBuffer
ld de, wBuffer ld de, wTownMapCoords
.loop .loop
ld a, [de] ld a, [de]
cp $ff cp $ff
jr z, .exitLoop jr z, .exitLoop
and a and a
jr z, .next jr z, .nextEntry
push hl push hl
call FindTownMapCoords call LoadTownMapEntry
pop hl pop hl
ld a, [de] ld a, [de]
cp $19 cp $19 ; Cerulean Cave's coordinates
jr z, .next jr z, .nextEntry ; skip Cerulean Cave
call SetTownMapOAMCoords call TownMapCoordsToOAMCoords
ld a, $4 ; nest icon tile no. ld a, $4 ; nest icon tile no.
ld [hli], a ld [hli], a
xor a xor a
ld [hli], a ld [hli], a
.next .nextEntry
inc de inc de
jr .loop jr .loop
.exitLoop .exitLoop
ld a, l ld a, l
and a and a ; were any OAM entries written?
jr nz, .locationKnown jr nz, .drawPlayerSprite
; if no OAM entries were written, print area unknown text
hlCoord 1, 7 hlCoord 1, 7
ld b, $2 ld b, $2
ld c, $f ld c, $f
@ -399,10 +402,10 @@ DisplayWildLocations: ; 711ef (1c:51ef)
ld de, AreaUnknownText ld de, AreaUnknownText
call PlaceString call PlaceString
jr .done jr .done
.locationKnown .drawPlayerSprite
ld a, [W_CURMAP] ld a, [W_CURMAP]
ld b, $0 ld b, $0
call Func_711c4 call DrawPlayerOrBirdSprite
.done .done
ld hl, wOAMBuffer ld hl, wOAMBuffer
ld de, wTileMapBackup ld de, wTileMapBackup
@ -412,39 +415,41 @@ DisplayWildLocations: ; 711ef (1c:51ef)
AreaUnknownText: ; 7124a (1c:524a) AreaUnknownText: ; 7124a (1c:524a)
db " AREA UNKNOWN@" db " AREA UNKNOWN@"
SetTownMapOAMCoords: ; 71258 (1c:5258) TownMapCoordsToOAMCoords: ; 71258 (1c:5258)
; in: lower nybble of a = x, upper nybble of a = y
; out: b and [hl] = (y * 8) + 24, c and [hl+1] = (x * 8) + 24
push af push af
and $f0 and $f0
srl a srl a
add $18 add 24
ld b, a ld b, a
ld [hli], a ld [hli], a
pop af pop af
and $f and $f
swap a swap a
srl a srl a
add $18 add 24
ld c, a ld c, a
ld [hli], a ld [hli], a
ret ret
Func_7126d: ; 7126d (1c:526d) WritePlayerOrBirdSpriteOAM: ; 7126d (1c:526d)
ld a, [wcd5b] ld a, [wOAMBaseTile]
and a and a
ld hl, wOAMBuffer + $90 ld hl, wOAMBuffer + $90 ; for player sprite
jr z, Func_71279 jr z, WriteTownMapSpriteOAM
ld hl, wOAMBuffer + $80 ld hl, wOAMBuffer + $80 ; for bird sprite
Func_71279: ; 71279 (1c:5279) WriteTownMapSpriteOAM: ; 71279 (1c:5279)
push hl push hl
ld hl, $fcfc ld hl, $fcfc
add hl, bc add hl, bc ; subtract 4 from c (X coord) and 3 from b (Y coord)
ld b, h ld b, h
ld c, l ld c, l
pop hl pop hl
WriteAsymmetricMonPartySpriteOAM: ; 71281 (1c:5281) WriteAsymmetricMonPartySpriteOAM: ; 71281 (1c:5281)
; Writes 4 OAM blocks for a helix mon party sprite, since is does not have ; Writes 4 OAM blocks for a helix mon party sprite, since it does not have
; a vertical line of symmetry. ; a vertical line of symmetry.
ld de, $202 ld de, $202
.loop .loop
@ -455,10 +460,10 @@ WriteAsymmetricMonPartySpriteOAM: ; 71281 (1c:5281)
ld [hli], a ld [hli], a
ld a, c ld a, c
ld [hli], a ld [hli], a
ld a, [wcd5b] ld a, [wOAMBaseTile]
ld [hli], a ld [hli], a
inc a inc a
ld [wcd5b], a ld [wOAMBaseTile], a
xor a xor a
ld [hli], a ld [hli], a
inc d inc d
@ -492,7 +497,7 @@ WriteSymmetricMonPartySpriteOAM: ; 712a6 (1c:52a6)
ld [hli], a ld [hli], a
ld a, c ld a, c
ld [hli], a ld [hli], a
ld a, [wcd5b] ld a, [wOAMBaseTile]
ld [hli], a ld [hli], a
ld a, [wcd5c] ld a, [wcd5c]
ld [hli], a ld [hli], a
@ -507,7 +512,7 @@ WriteSymmetricMonPartySpriteOAM: ; 712a6 (1c:52a6)
pop bc pop bc
pop de pop de
push hl push hl
ld hl, wcd5b ld hl, wOAMBaseTile
inc [hl] inc [hl]
inc [hl] inc [hl]
pop hl pop hl
@ -518,9 +523,10 @@ WriteSymmetricMonPartySpriteOAM: ; 712a6 (1c:52a6)
jr nz, .loop jr nz, .loop
ret ret
Func_712d9: ; 712d9 (1c:52d9) ZeroOutDuplicatesInList: ; 712d9 (1c:52d9)
ld de, wHPBarMaxHP ; replace duplicate bytes in the list of wild pokemon locations with 0
.asm_712dc ld de, wBuffer
.loop
ld a, [de] ld a, [de]
inc de inc de
cp $ff cp $ff
@ -528,39 +534,41 @@ Func_712d9: ; 712d9 (1c:52d9)
ld c, a ld c, a
ld l, e ld l, e
ld h, d ld h, d
.asm_712e4 .zeroDuplicatesLoop
ld a, [hl] ld a, [hl]
cp $ff cp $ff
jr z, .asm_712dc jr z, .loop
cp c cp c
jr nz, .asm_712ee jr nz, .skipZeroing
xor a xor a
ld [hl], a ld [hl], a
.asm_712ee .skipZeroing
inc hl inc hl
jr .asm_712e4 jr .zeroDuplicatesLoop
FindTownMapCoords: ; 712f1 (1c:52f1) LoadTownMapEntry: ; 712f1 (1c:52f1)
; in: a = map number
; out: lower nybble of [de] = x, upper nybble of [de] = y, hl = address of name
cp REDS_HOUSE_1F cp REDS_HOUSE_1F
jr c, .townOrRoute jr c, .external
ld bc, $4 ld bc, 4
ld hl, InternalMapEntries ld hl, InternalMapEntries
.loop .loop
cp [hl] cp [hl]
jr c, .match jr c, .foundEntry
add hl, bc add hl, bc
jr .loop jr .loop
.match .foundEntry
inc hl inc hl
jr .done jr .readEntry
.townOrRoute .external
ld hl, ExternalMapEntries ld hl, ExternalMapEntries
ld c, a ld c, a
ld b, $0 ld b, 0
add hl, bc add hl, bc
add hl, bc add hl, bc
add hl, bc add hl, bc
.done .readEntry
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
ld a, [hli] ld a, [hli]
@ -576,7 +584,7 @@ MonNestIcon: ; 716be (1c:56be)
INCBIN "gfx/mon_nest_icon.1bpp" INCBIN "gfx/mon_nest_icon.1bpp"
TownMapSpriteBlinkingAnimation: ; 716c6 (1c:56c6) TownMapSpriteBlinkingAnimation: ; 716c6 (1c:56c6)
ld a, [wTownMapSpriteBlinkingCounter] ld a, [wAnimCounter]
inc a inc a
cp 25 cp 25
jr z, .hideSprites jr z, .hideSprites
@ -600,5 +608,5 @@ TownMapSpriteBlinkingAnimation: ; 716c6 (1c:56c6)
jr nz, .hideSpritesLoop jr nz, .hideSpritesLoop
ld a, 25 ld a, 25
.done .done
ld [wTownMapSpriteBlinkingCounter], a ld [wAnimCounter], a
jp DelayFrame jp DelayFrame

View file

@ -13,7 +13,7 @@ ExternalClockTradeAnim: ; 410f3 (10:50f3)
; Externally clocked link cable trades use this. ; Externally clocked link cable trades use this.
ld a, [wTradedEnemyMonSpecies] ld a, [wTradedEnemyMonSpecies]
ld [wLeftGBMonSpecies], a ld [wLeftGBMonSpecies], a
ld a, [wTrainerSpriteOffset] ld a, [wTradedPlayerMonSpecies]
ld [wRightGBMonSpecies], a ld [wRightGBMonSpecies], a
ld de, ExternalClockTradeFuncSequence ld de, ExternalClockTradeFuncSequence
@ -259,7 +259,7 @@ Trade_ShowPlayerMon: ; 41245 (10:5245)
ld a, TRADE_BALL_POOF_ANIM ld a, TRADE_BALL_POOF_ANIM
call Trade_ShowAnimation call Trade_ShowAnimation
ld a, TRADE_BALL_DROP_ANIM ld a, TRADE_BALL_DROP_ANIM
call Trade_ShowAnimation call Trade_ShowAnimation ; clears mon pic
ld a, [wTradedPlayerMonSpecies] ld a, [wTradedPlayerMonSpecies]
call PlayCry call PlayCry
xor a xor a
@ -272,8 +272,12 @@ Trade_DrawOpenEndOfLinkCable: ; 41298 (10:5298)
call CopyScreenTileBufferToVRAM call CopyScreenTileBufferToVRAM
ld b, $8 ld b, $8
call GoPAL_SET call GoPAL_SET
; This function call is pointless. It just copies blank tiles to VRAM that was
; already filled with blank tiles.
ld hl, vBGMap1 + $8c ld hl, vBGMap1 + $8c
call Trade_CopyCableTilesOffScreen call Trade_CopyCableTilesOffScreen
ld a, $a0 ld a, $a0
ld [hSCX], a ld [hSCX], a
call DelayFrame call DelayFrame
@ -754,7 +758,10 @@ Trade_ShowClearedWindow: ; 415c8 (10:55c8)
ret ret
Trade_SlideTextBoxOffScreen: ; 415df (10:55df) Trade_SlideTextBoxOffScreen: ; 415df (10:55df)
; Slides the window right until it's off screen. ; Slides the window right until it's off screen. The window usually just has
; a text box at the bottom when this is called. However, when this is called
; after Trade_ShowEnemyMon in the external clock sequence, there is a mon pic
; above the text box and it is also scrolled off the screen.
ld c, 50 ld c, 50
call DelayFrames call DelayFrames
.loop .loop

View file

@ -378,7 +378,7 @@ PartyMenuInit:: ; 1420 (0:1420)
set 6, [hl] ; turn off letter printing delay set 6, [hl] ; turn off letter printing delay
xor a xor a
ld [wcc49], a ld [wcc49], a
ld [wcc37], a ld [wMenuWatchMovingOutOfBounds], a
ld hl, wTopMenuItemY ld hl, wTopMenuItemY
inc a inc a
ld [hli], a ; top menu item Y ld [hli], a ; top menu item Y
@ -456,7 +456,7 @@ HandlePartyMenuInput:: ; 145a (0:145a)
callba ErasePartyMenuCursors callba ErasePartyMenuCursors
xor a xor a
ld [wMenuItemToSwap],a ld [wMenuItemToSwap],a
ld [wd07d],a ld [wPartyMenuTypeOrMessageID],a
call RedrawPartyMenu call RedrawPartyMenu
jr HandlePartyMenuInput jr HandlePartyMenuInput
.handleSwap .handleSwap
@ -1201,8 +1201,8 @@ DisplayPokemartDialogue:: ; 2a2e (0:2a2e)
pop hl pop hl
inc hl inc hl
call LoadItemList call LoadItemList
ld a,$02 ld a,PRICEDITEMLISTMENU
ld [wListMenuID],a ; selects between subtypes of menus ld [wListMenuID],a
ld a,[H_LOADEDROMBANK] ld a,[H_LOADEDROMBANK]
push af push af
ld a,Bank(DisplayPokemartDialogue_) ld a,Bank(DisplayPokemartDialogue_)
@ -1219,12 +1219,12 @@ PokemartGreetingText:: ; 2a55 (0:2a55)
db "@" db "@"
LoadItemList:: ; 2a5a (0:2a5a) LoadItemList:: ; 2a5a (0:2a5a)
ld a,$01 ld a,1
ld [wUpdateSpritesEnabled],a ld [wUpdateSpritesEnabled],a
ld a,h ld a,h
ld [wd128],a ld [wItemListPointer],a
ld a,l ld a,l
ld [wd129],a ld [wItemListPointer + 1],a
ld de,wStringBuffer2 + 11 ld de,wStringBuffer2 + 11
.loop .loop
ld a,[hli] ld a,[hli]
@ -1336,7 +1336,7 @@ AddAmountSoldToMoney:: ; 2b9e (0:2b9e)
; INPUT: ; INPUT:
; HL = address of inventory (either wNumBagItems or wNumBoxItems) ; HL = address of inventory (either wNumBagItems or wNumBoxItems)
; [wWhichPokemon] = index (within the inventory) of the item to remove ; [wWhichPokemon] = index (within the inventory) of the item to remove
; [wcf96] = quantity to remove ; [wItemQuantity] = quantity to remove
RemoveItemFromInventory:: ; 2bbb (0:2bbb) RemoveItemFromInventory:: ; 2bbb (0:2bbb)
ld a,[H_LOADEDROMBANK] ld a,[H_LOADEDROMBANK]
push af push af
@ -1353,7 +1353,7 @@ RemoveItemFromInventory:: ; 2bbb (0:2bbb)
; INPUT: ; INPUT:
; HL = address of inventory (either wNumBagItems or wNumBoxItems) ; HL = address of inventory (either wNumBagItems or wNumBoxItems)
; [wcf91] = item ID ; [wcf91] = item ID
; [wcf96] = item quantity ; [wItemQuantity] = item quantity
; sets carry flag if successful, unsets carry flag if unsuccessful ; sets carry flag if successful, unsets carry flag if unsuccessful
AddItemToInventory:: ; 2bcf (0:2bcf) AddItemToInventory:: ; 2bcf (0:2bcf)
push bc push bc
@ -1391,13 +1391,13 @@ DisplayListMenuID:: ; 2be6 (0:2be6)
set 6,[hl] ; turn off letter printing delay set 6,[hl] ; turn off letter printing delay
xor a xor a
ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped ld [wMenuItemToSwap],a ; 0 means no item is currently being swapped
ld [wd12a],a ld [wListCount],a
ld a,[wList] ld a,[wList]
ld l,a ld l,a
ld a,[wList + 1] ld a,[wList + 1]
ld h,a ; hl = address of the list ld h,a ; hl = address of the list
ld a,[hl] ld a,[hl] ; the first byte is the number of entries in the list
ld [wd12a],a ; [wd12a] = number of list entries ld [wListCount],a
ld a,LIST_MENU_BOX ld a,LIST_MENU_BOX
ld [wTextBoxID],a ld [wTextBoxID],a
call DisplayTextBoxID ; draw the menu text box call DisplayTextBoxID ; draw the menu text box
@ -1411,8 +1411,8 @@ DisplayListMenuID:: ; 2be6 (0:2be6)
call UpdateSprites call UpdateSprites
.skipMovingSprites .skipMovingSprites
ld a,1 ; max menu item ID is 1 if the list has less than 2 entries ld a,1 ; max menu item ID is 1 if the list has less than 2 entries
ld [wcc37],a ld [wMenuWatchMovingOutOfBounds],a
ld a,[wd12a] ld a,[wListCount]
cp a,2 ; does the list have less than 2 entries? cp a,2 ; does the list have less than 2 entries?
jr c,.setMenuVariables jr c,.setMenuVariables
ld a,2 ; max menu item ID is 2 if the list has at least 2 entries ld a,2 ; max menu item ID is 2 if the list has at least 2 entries
@ -1461,17 +1461,20 @@ DisplayListMenuIDLoop:: ; 2c53 (0:2c53)
.buttonAPressed .buttonAPressed
ld a,[wCurrentMenuItem] ld a,[wCurrentMenuItem]
call PlaceUnfilledArrowMenuCursor call PlaceUnfilledArrowMenuCursor
; pointless because both values are overwritten before they are read
ld a,$01 ld a,$01
ld [wd12e],a ld [wMenuExitMethod],a
ld [wd12d],a ld [wChosenMenuItem],a
xor a xor a
ld [wcc37],a ld [wMenuWatchMovingOutOfBounds],a
ld a,[wCurrentMenuItem] ld a,[wCurrentMenuItem]
ld c,a ld c,a
ld a,[wListScrollOffset] ld a,[wListScrollOffset]
add c add c
ld c,a ld c,a
ld a,[wd12a] ; number of list entries ld a,[wListCount]
and a ; is the list empty? and a ; is the list empty?
jp z,ExitListMenu ; if so, exit the menu jp z,ExitListMenu ; if so, exit the menu
dec a dec a
@ -1506,7 +1509,7 @@ DisplayListMenuIDLoop:: ; 2c53 (0:2c53)
; if it's an item menu ; if it's an item menu
inc hl inc hl
ld a,[hl] ; a = item quantity ld a,[hl] ; a = item quantity
ld [wcf97],a ld [wMaxItemQuantity],a
.skipGettingQuantity .skipGettingQuantity
ld a,[wcf91] ld a,[wcf91]
ld [wd0b5],a ld [wd0b5],a
@ -1527,10 +1530,10 @@ DisplayListMenuIDLoop:: ; 2c53 (0:2c53)
.storeChosenEntry ; store the menu entry that the player chose and return .storeChosenEntry ; store the menu entry that the player chose and return
ld de,wcd6d ld de,wcd6d
call CopyStringToCF4B ; copy name to wcf4b call CopyStringToCF4B ; copy name to wcf4b
ld a,$01 ld a,CHOSE_MENU_ITEM
ld [wd12e],a ld [wMenuExitMethod],a
ld a,[wCurrentMenuItem] ld a,[wCurrentMenuItem]
ld [wd12d],a ld [wChosenMenuItem],a
xor a xor a
ld [hJoy7],a ; joypad state update flag ld [hJoy7],a ; joypad state update flag
ld hl,wd730 ld hl,wd730
@ -1549,7 +1552,7 @@ DisplayListMenuIDLoop:: ; 2c53 (0:2c53)
ld a,[hl] ld a,[hl]
add a,3 add a,3
ld b,a ld b,a
ld a,[wd12a] ; number of list entries ld a,[wListCount]
cp b ; will going down scroll past the Cancel button? cp b ; will going down scroll past the Cancel button?
jp c,DisplayListMenuIDLoop jp c,DisplayListMenuIDLoop
inc [hl] ; if not, go down inc [hl] ; if not, go down
@ -1584,7 +1587,7 @@ DisplayChooseQuantityMenu:: ; 2d57 (0:2d57)
ld de,InitialQuantityText ld de,InitialQuantityText
call PlaceString call PlaceString
xor a xor a
ld [wcf96],a ; initialize current quantity to 0 ld [wItemQuantity],a ; initialize current quantity to 0
jp .incrementQuantity jp .incrementQuantity
.waitForKeyPressLoop .waitForKeyPressLoop
call JoypadLowSensitivity call JoypadLowSensitivity
@ -1599,10 +1602,10 @@ DisplayChooseQuantityMenu:: ; 2d57 (0:2d57)
jr nz,.decrementQuantity jr nz,.decrementQuantity
jr .waitForKeyPressLoop jr .waitForKeyPressLoop
.incrementQuantity .incrementQuantity
ld a,[wcf97] ; max quantity ld a,[wMaxItemQuantity]
inc a inc a
ld b,a ld b,a
ld hl,wcf96 ; current quantity ld hl,wItemQuantity ; current quantity
inc [hl] inc [hl]
ld a,[hl] ld a,[hl]
cp b cp b
@ -1612,11 +1615,11 @@ DisplayChooseQuantityMenu:: ; 2d57 (0:2d57)
ld [hl],a ld [hl],a
jr .handleNewQuantity jr .handleNewQuantity
.decrementQuantity .decrementQuantity
ld hl,wcf96 ; current quantity ld hl,wItemQuantity ; current quantity
dec [hl] dec [hl]
jr nz,.handleNewQuantity jr nz,.handleNewQuantity
; wrap to the max quantity if the player goes below 1 ; wrap to the max quantity if the player goes below 1
ld a,[wcf97] ; max quantity ld a,[wMaxItemQuantity]
ld [hl],a ld [hl],a
.handleNewQuantity .handleNewQuantity
hlCoord 17, 10 hlCoord 17, 10
@ -1625,7 +1628,7 @@ DisplayChooseQuantityMenu:: ; 2d57 (0:2d57)
jr nz,.printQuantity jr nz,.printQuantity
.printPrice .printPrice
ld c,$03 ld c,$03
ld a,[wcf96] ld a,[wItemQuantity]
ld b,a ld b,a
ld hl,$ff9f ; total price ld hl,$ff9f ; total price
; initialize total price to 0 ; initialize total price to 0
@ -1641,7 +1644,7 @@ DisplayChooseQuantityMenu:: ; 2d57 (0:2d57)
pop bc pop bc
dec b dec b
jr nz,.addLoop jr nz,.addLoop
ld a,[$ff8e] ld a,[hHalveItemPrices]
and a ; should the price be halved (for selling items)? and a ; should the price be halved (for selling items)?
jr z,.skipHalvingPrice jr z,.skipHalvingPrice
xor a xor a
@ -1666,7 +1669,7 @@ DisplayChooseQuantityMenu:: ; 2d57 (0:2d57)
call PrintBCDNumber call PrintBCDNumber
hlCoord 9, 10 hlCoord 9, 10
.printQuantity .printQuantity
ld de,wcf96 ; current quantity ld de,wItemQuantity ; current quantity
ld bc,$8102 ; print leading zeroes, 1 byte, 2 digits ld bc,$8102 ; print leading zeroes, 1 byte, 2 digits
call PrintNumber call PrintNumber
jp .waitForKeyPressLoop jp .waitForKeyPressLoop
@ -1688,10 +1691,10 @@ SpacesBetweenQuantityAndPriceText:: ; 2e34 (0:2e34)
ExitListMenu:: ; 2e3b (0:2e3b) ExitListMenu:: ; 2e3b (0:2e3b)
ld a,[wCurrentMenuItem] ld a,[wCurrentMenuItem]
ld [wd12d],a ld [wChosenMenuItem],a
ld a,$02 ld a,CANCELLED_MENU
ld [wd12e],a ld [wMenuExitMethod],a
ld [wcc37],a ld [wMenuWatchMovingOutOfBounds],a
xor a xor a
ld [hJoy7],a ld [hJoy7],a
ld hl,wd730 ld hl,wd730
@ -1775,7 +1778,7 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a)
call PlaceString call PlaceString
pop de pop de
pop hl pop hl
ld a,[wcf93] ld a,[wPrintItemPrices]
and a ; should prices be printed? and a ; should prices be printed?
jr z,.skipPrintingItemPrice jr z,.skipPrintingItemPrice
.printItemPrice .printItemPrice
@ -1839,7 +1842,7 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a)
ld a,[wd11e] ld a,[wd11e]
ld [wcf91],a ld [wcf91],a
call IsKeyItem ; check if item is unsellable call IsKeyItem ; check if item is unsellable
ld a,[wd124] ld a,[wIsKeyItem]
and a ; is the item unsellable? and a ; is the item unsellable?
jr nz,.skipPrintingItemQuantity ; if so, don't print the quantity jr nz,.skipPrintingItemQuantity ; if so, don't print the quantity
push hl push hl
@ -1850,7 +1853,7 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a)
ld a,[wd11e] ld a,[wd11e]
push af push af
ld a,[de] ld a,[de]
ld [wcf97],a ld [wMaxItemQuantity],a
push de push de
ld de,wd11e ld de,wd11e
ld [de],a ld [de],a
@ -2101,7 +2104,7 @@ UseItem:: ; 30bc (0:30bc)
; hl = address of inventory (either wNumBagItems or wNumBoxItems) ; hl = address of inventory (either wNumBagItems or wNumBoxItems)
; [wcf91] = item ID ; [wcf91] = item ID
; [wWhichPokemon] = index of item within inventory ; [wWhichPokemon] = index of item within inventory
; [wcf96] = quantity to toss ; [wItemQuantity] = quantity to toss
; OUTPUT: ; OUTPUT:
; clears carry flag if the item is tossed, sets carry flag if not ; clears carry flag if the item is tossed, sets carry flag if not
TossItem:: ; 30c4 (0:30c4) TossItem:: ; 30c4 (0:30c4)
@ -2121,7 +2124,7 @@ TossItem:: ; 30c4 (0:30c4)
; INPUT: ; INPUT:
; [wcf91] = item ID ; [wcf91] = item ID
; OUTPUT: ; OUTPUT:
; [wd124] = result ; [wIsKeyItem] = result
; 00: item is not key item ; 00: item is not key item
; 01: item is key item ; 01: item is key item
IsKeyItem:: ; 30d9 (0:30d9) IsKeyItem:: ; 30d9 (0:30d9)
@ -3596,8 +3599,8 @@ CopyDataUntil:: ; 3913 (0:3913)
; Function to remove a pokemon from the party or the current box. ; Function to remove a pokemon from the party or the current box.
; wWhichPokemon determines the pokemon. ; wWhichPokemon determines the pokemon.
; [wcf95] == 0 specifies the party. ; [wRemoveMonFromBox] == 0 specifies the party.
; [wcf95] != 0 specifies the current box. ; [wRemoveMonFromBox] != 0 specifies the current box.
RemovePokemon:: ; 391f (0:391f) RemovePokemon:: ; 391f (0:391f)
ld hl, _RemovePokemon ld hl, _RemovePokemon
ld b, BANK(_RemovePokemon) ld b, BANK(_RemovePokemon)
@ -3826,13 +3829,13 @@ AddEnemyMonToPlayerParty:: ; 3a53 (0:3a53)
ld [MBC1RomBank], a ld [MBC1RomBank], a
ret ret
Func_3a68:: ; 3a68 (0:3a68) MoveMon:: ; 3a68 (0:3a68)
ld a, [H_LOADEDROMBANK] ld a, [H_LOADEDROMBANK]
push af push af
ld a, BANK(MoveMon) ld a, BANK(_MoveMon)
ld [H_LOADEDROMBANK], a ld [H_LOADEDROMBANK], a
ld [MBC1RomBank], a ld [MBC1RomBank], a
call MoveMon call _MoveMon
pop bc pop bc
ld a, b ld a, b
ld [H_LOADEDROMBANK], a ld [H_LOADEDROMBANK], a
@ -3925,7 +3928,7 @@ HandleMenuInputPokemonSelection:: ; 3ac2 (0:3ac2)
ld [H_DOWNARROWBLINKCNT2],a ; blinking down arrow timing value 2 ld [H_DOWNARROWBLINKCNT2],a ; blinking down arrow timing value 2
.loop1 .loop1
xor a xor a
ld [wPartyMonAnimCounter],a ; counter for pokemon shaking animation ld [wAnimCounter],a ; counter for pokemon shaking animation
call PlaceMenuCursor call PlaceMenuCursor
call Delay3 call Delay3
.loop2 .loop2
@ -4023,7 +4026,7 @@ HandleMenuInputPokemonSelection:: ; 3ac2 (0:3ac2)
ld a,[hJoy5] ld a,[hJoy5]
ret ret
.noWrappingAround .noWrappingAround
ld a,[wcc37] ld a,[wMenuWatchMovingOutOfBounds]
and a ; should we return if the user tried to go past the top or bottom? and a ; should we return if the user tried to go past the top or bottom?
jr z,.checkOtherKeys jr z,.checkOtherKeys
jr .checkIfAButtonOrBButtonPressed jr .checkIfAButtonOrBButtonPressed
@ -4568,7 +4571,7 @@ GiveItem::
ld [wd11e], a ld [wd11e], a
ld [wcf91], a ld [wcf91], a
ld a, c ld a, c
ld [wcf96], a ld [wItemQuantity], a
ld hl,wNumBagItems ld hl,wNumBagItems
call AddItemToInventory call AddItemToInventory
ret nc ret nc

View file

@ -31,8 +31,8 @@ rLCDC_DEFAULT EQU %11100011
ld [$ff4a], a ld [$ff4a], a
ld [$ff06], a ld [$ff06], a
ld [$ff07], a ld [$ff07], a
ld [$ff47], a ld [rBGP], a
ld [$ff48], a ld [rOBP0], a
ld [$ff49], a ld [$ff49], a
ld a, rLCDC_ENABLE_MASK ld a, rLCDC_ENABLE_MASK
@ -101,9 +101,9 @@ rLCDC_DEFAULT EQU %11100011
ld [wc0ef], a ld [wc0ef], a
ld [wc0f0], a ld [wc0f0], a
ld a, $9c ld a, $9c
ld [$ffbd], a ld [H_AUTOBGTRANSFERDEST + 1], a
xor a xor a
ld [$ffbc], a ld [H_AUTOBGTRANSFERDEST], a
dec a dec a
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a

View file

@ -301,7 +301,7 @@ OverworldLoopLessDelay::
and a and a
jp nz,CheckWarpsNoCollision jp nz,CheckWarpsNoCollision
predef ApplyOutOfBattlePoisonDamage ; also increment daycare mon exp predef ApplyOutOfBattlePoisonDamage ; also increment daycare mon exp
ld a,[wd12d] ld a,[wOutOfBattleBlackout]
and a and a
jp nz,HandleBlackOut ; if all pokemon fainted jp nz,HandleBlackOut ; if all pokemon fainted
.newBattle .newBattle

View file

@ -13,7 +13,7 @@ VBlank::
ld a, [hSCY] ld a, [hSCY]
ld [rSCY], a ld [rSCY], a
ld a, [wd0a0] ld a, [wDisableVBlankWYUpdate]
and a and a
jr nz, .ok jr nz, .ok
ld a, [hWY] ld a, [hWY]

View file

@ -26,6 +26,8 @@ hSpriteIndexOrTextID EQU $FF8C
hPartyMonIndex EQU $FF8C hPartyMonIndex EQU $FF8C
hHalveItemPrices EQU $FF8E
; Multiplcation and division variables are meant ; Multiplcation and division variables are meant
; to overlap for back-to-back usage. Big endian. ; to overlap for back-to-back usage. Big endian.

135
main.asm
View file

@ -922,7 +922,7 @@ HandleItemListSwapping: ; 6b44 (1:6b44)
ld l,a ld l,a
dec [hl] ; decrease the number of items dec [hl] ; decrease the number of items
ld a,[hl] ld a,[hl]
ld [wd12a],a ; update number of items variable ld [wListCount],a ; update number of items variable
cp a,1 cp a,1
jr nz,.skipSettingMaxMenuItemID jr nz,.skipSettingMaxMenuItemID
ld [wMaxMenuItem],a ; if the number of items is only one now, update the max menu item ID ld [wMaxMenuItem],a ; if the number of items is only one now, update the max menu item ID
@ -1094,7 +1094,7 @@ DrawStartMenu: ; 710b (1:710b)
ld [wCurrentMenuItem],a ld [wCurrentMenuItem],a
ld [wLastMenuItem],a ld [wLastMenuItem],a
xor a xor a
ld [wcc37],a ld [wMenuWatchMovingOutOfBounds],a
ld hl,wd730 ld hl,wd730
set 6,[hl] ; no pauses between printing each letter set 6,[hl] ; no pauses between printing each letter
hlCoord 12, 2 hlCoord 12, 2
@ -1457,7 +1457,7 @@ DoBuySellQuitMenu: ; 74ea (1:74ea)
set 6, a ; no printing delay set 6, a ; no printing delay
ld [wd730], a ld [wd730], a
xor a xor a
ld [wd12d], a ld [wChosenMenuItem], a
ld a, BUY_SELL_QUIT_MENU_TEMPLATE ld a, BUY_SELL_QUIT_MENU_TEMPLATE
ld [wTextBoxID], a ld [wTextBoxID], a
call DisplayTextBoxID call DisplayTextBoxID
@ -1472,7 +1472,7 @@ DoBuySellQuitMenu: ; 74ea (1:74ea)
xor a xor a
ld [wCurrentMenuItem], a ld [wCurrentMenuItem], a
ld [wLastMenuItem], a ld [wLastMenuItem], a
ld [wcc37], a ld [wMenuWatchMovingOutOfBounds], a
ld a, [wd730] ld a, [wd730]
res 6, a ; turn on the printing delay res 6, a ; turn on the printing delay
ld [wd730], a ld [wd730], a
@ -1482,24 +1482,24 @@ DoBuySellQuitMenu: ; 74ea (1:74ea)
jr nz, .pressedA jr nz, .pressedA
bit 1, a ; was B pressed? (always true since only A/B are watched) bit 1, a ; was B pressed? (always true since only A/B are watched)
jr z, .pressedA jr z, .pressedA
ld a, $2 ld a, CANCELLED_MENU
ld [wd12e], a ld [wMenuExitMethod], a
jr .quit jr .quit
.pressedA .pressedA
ld a, $1 ld a, CHOSE_MENU_ITEM
ld [wd12e], a ld [wMenuExitMethod], a
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
ld [wd12d], a ld [wChosenMenuItem], a
ld b, a ld b, a
ld a, [wMaxMenuItem] ld a, [wMaxMenuItem]
cp b cp b
jr z, .quit jr z, .quit
ret ret
.quit .quit
ld a, $2 ld a, CANCELLED_MENU
ld [wd12e], a ld [wMenuExitMethod], a
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
ld [wd12d], a ld [wChosenMenuItem], a
scf scf
ret ret
@ -1512,9 +1512,12 @@ DisplayTwoOptionMenu: ; 7559 (1:7559)
ld a, [wd730] ld a, [wd730]
set 6, a ; no printing delay set 6, a ; no printing delay
ld [wd730], a ld [wd730], a
; pointless because both values are overwritten before they are read
xor a xor a
ld [wd12d], a ld [wChosenMenuItem], a
ld [wd12e], a ld [wMenuExitMethod], a
ld a, A_BUTTON | B_BUTTON ld a, A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a ld [wMenuWatchedKeys], a
ld a, $1 ld a, $1
@ -1525,7 +1528,7 @@ DisplayTwoOptionMenu: ; 7559 (1:7559)
ld [wTopMenuItemX], a ld [wTopMenuItemX], a
xor a xor a
ld [wLastMenuItem], a ld [wLastMenuItem], a
ld [wcc37], a ld [wMenuWatchMovingOutOfBounds], a
push hl push hl
ld hl, wTwoOptionMenuID ld hl, wTwoOptionMenuID
bit 7, [hl] ; select second menu item by default? bit 7, [hl] ; select second menu item by default?
@ -1614,23 +1617,23 @@ DisplayTwoOptionMenu: ; 7559 (1:7559)
jr nz, .choseSecondMenuItem ; automatically choose the second option if B is pressed jr nz, .choseSecondMenuItem ; automatically choose the second option if B is pressed
.pressedAButton .pressedAButton
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
ld [wd12d], a ld [wChosenMenuItem], a
and a and a
jr nz, .choseSecondMenuItem jr nz, .choseSecondMenuItem
; chose first menu item ; chose first menu item
ld a, $1 ld a, CHOSE_FIRST_ITEM
ld [wd12e], a ld [wMenuExitMethod], a
ld c, 15 ld c, 15
call DelayFrames call DelayFrames
call TwoOptionMenu_RestoreScreenTiles call TwoOptionMenu_RestoreScreenTiles
and a and a
ret ret
.choseSecondMenuItem .choseSecondMenuItem
ld a, $1 ld a, 1
ld [wCurrentMenuItem], a ld [wCurrentMenuItem], a
ld [wd12d], a ld [wChosenMenuItem], a
ld a, $2 ld a, CHOSE_SECOND_ITEM
ld [wd12e], a ld [wMenuExitMethod], a
ld c, 15 ld c, 15
call DelayFrames call DelayFrames
call TwoOptionMenu_RestoreScreenTiles call TwoOptionMenu_RestoreScreenTiles
@ -1913,7 +1916,7 @@ INCLUDE "engine/menu/players_pc.asm"
_RemovePokemon: ; 7b68 (1:7b68) _RemovePokemon: ; 7b68 (1:7b68)
ld hl, wPartyCount ld hl, wPartyCount
ld a, [wcf95] ld a, [wRemoveMonFromBox]
and a and a
jr z, .asm_7b74 jr z, .asm_7b74
ld hl, W_NUMINBOX ld hl, W_NUMINBOX
@ -1936,7 +1939,7 @@ _RemovePokemon: ; 7b68 (1:7b68)
jr nz, .asm_7b81 jr nz, .asm_7b81
ld hl, wPartyMonOT ld hl, wPartyMonOT
ld d, $5 ld d, $5
ld a, [wcf95] ld a, [wRemoveMonFromBox]
and a and a
jr z, .asm_7b97 jr z, .asm_7b97
ld hl, wBoxMonOT ld hl, wBoxMonOT
@ -1955,7 +1958,7 @@ _RemovePokemon: ; 7b68 (1:7b68)
ld bc, $b ld bc, $b
add hl, bc add hl, bc
ld bc, wPartyMonNicks ld bc, wPartyMonNicks
ld a, [wcf95] ld a, [wRemoveMonFromBox]
and a and a
jr z, .asm_7bb8 jr z, .asm_7bb8
ld bc, wBoxMonNicks ld bc, wBoxMonNicks
@ -1963,7 +1966,7 @@ _RemovePokemon: ; 7b68 (1:7b68)
call CopyDataUntil call CopyDataUntil
ld hl, wPartyMons ld hl, wPartyMons
ld bc, wPartyMon2 - wPartyMon1 ld bc, wPartyMon2 - wPartyMon1
ld a, [wcf95] ld a, [wRemoveMonFromBox]
and a and a
jr z, .asm_7bcd jr z, .asm_7bcd
ld hl, wBoxMons ld hl, wBoxMons
@ -1973,7 +1976,7 @@ _RemovePokemon: ; 7b68 (1:7b68)
call AddNTimes call AddNTimes
ld d, h ld d, h
ld e, l ld e, l
ld a, [wcf95] ld a, [wRemoveMonFromBox]
and a and a
jr z, .asm_7be4 jr z, .asm_7be4
ld bc, wBoxMon2 - wBoxMon1 ld bc, wBoxMon2 - wBoxMon1
@ -1987,7 +1990,7 @@ _RemovePokemon: ; 7b68 (1:7b68)
.asm_7beb .asm_7beb
call CopyDataUntil call CopyDataUntil
ld hl, wPartyMonNicks ld hl, wPartyMonNicks
ld a, [wcf95] ld a, [wRemoveMonFromBox]
and a and a
jr z, .asm_7bfa jr z, .asm_7bfa
ld hl, wBoxMonNicks ld hl, wBoxMonNicks
@ -2000,7 +2003,7 @@ _RemovePokemon: ; 7b68 (1:7b68)
ld bc, $b ld bc, $b
add hl, bc add hl, bc
ld bc, wPokedexOwned ld bc, wPokedexOwned
ld a, [wcf95] ld a, [wRemoveMonFromBox]
and a and a
jr z, .asm_7c15 jr z, .asm_7c15
ld bc, wBoxMonNicksEnd ld bc, wBoxMonNicksEnd
@ -2631,7 +2634,7 @@ ApplyOutOfBattlePoisonDamage: ; c69c (3:469c)
.noBlackOut .noBlackOut
xor a xor a
.done .done
ld [wd12d], a ld [wOutOfBattleBlackout], a
ret ret
LoadTilesetHeader: ; c754 (3:4754) LoadTilesetHeader: ; c754 (3:4754)
@ -2777,10 +2780,10 @@ CyclingIsFunText: ; cdff (3:4dff)
; INPUT: ; INPUT:
; hl = address of inventory (either wNumBagItems or wNumBoxItems) ; hl = address of inventory (either wNumBagItems or wNumBoxItems)
; [wcf91] = item ID ; [wcf91] = item ID
; [wcf96] = item quantity ; [wItemQuantity] = item quantity
; sets carry flag if successful, unsets carry flag if unsuccessful ; sets carry flag if successful, unsets carry flag if unsuccessful
AddItemToInventory_: ; ce04 (3:4e04) AddItemToInventory_: ; ce04 (3:4e04)
ld a,[wcf96] ; a = item quantity ld a,[wItemQuantity] ; a = item quantity
push af push af
push bc push bc
push de push de
@ -2827,12 +2830,12 @@ AddItemToInventory_: ; ce04 (3:4e04)
add hl,bc ; hl = address to store the item add hl,bc ; hl = address to store the item
ld a,[wcf91] ld a,[wcf91]
ld [hli],a ; store item ID ld [hli],a ; store item ID
ld a,[wcf96] ld a,[wItemQuantity]
ld [hli],a ; store item quantity ld [hli],a ; store item quantity
ld [hl],$ff ; store terminator ld [hl],$ff ; store terminator
jp .success jp .success
.increaseItemQuantity ; increase the quantity of an item already in the inventory .increaseItemQuantity ; increase the quantity of an item already in the inventory
ld a,[wcf96] ld a,[wItemQuantity]
ld b,a ; b = quantity to add ld b,a ; b = quantity to add
ld a,[hl] ; a = existing item quantity ld a,[hl] ; a = existing item quantity
add b ; a = new item quantity add b ; a = new item quantity
@ -2841,7 +2844,7 @@ AddItemToInventory_: ; ce04 (3:4e04)
; if the new quantity is greater than or equal to 100, ; 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 ; try to max out the current slot and add the rest in a new slot
sub a,99 sub a,99
ld [wcf96],a ; a = amount left over (to put in the new slot) ld [wItemQuantity],a ; a = amount left over (to put in the new slot)
ld a,d ld a,d
and a ; is there room for a new item slot? and a ; is there room for a new item slot?
jr z,.increaseItemQuantityFailed jr z,.increaseItemQuantityFailed
@ -2864,14 +2867,14 @@ AddItemToInventory_: ; ce04 (3:4e04)
pop bc pop bc
pop bc pop bc
ld a,b ld a,b
ld [wcf96],a ; restore the initial value from when the function was called ld [wItemQuantity],a ; restore the initial value from when the function was called
ret ret
; function to remove an item (in varying quantities) from the player's bag or PC box ; function to remove an item (in varying quantities) from the player's bag or PC box
; INPUT: ; INPUT:
; hl = address of inventory (either wNumBagItems or wNumBoxItems) ; hl = address of inventory (either wNumBagItems or wNumBoxItems)
; [wWhichPokemon] = index (within the inventory) of the item to remove ; [wWhichPokemon] = index (within the inventory) of the item to remove
; [wcf96] = quantity to remove ; [wItemQuantity] = quantity to remove
RemoveItemFromInventory_: ; ce74 (3:4e74) RemoveItemFromInventory_: ; ce74 (3:4e74)
push hl push hl
inc hl inc hl
@ -2883,12 +2886,12 @@ RemoveItemFromInventory_: ; ce74 (3:4e74)
inc h inc h
.noCarry .noCarry
inc hl inc hl
ld a,[wcf96] ; quantity being removed ld a,[wItemQuantity] ; quantity being removed
ld e,a ld e,a
ld a,[hl] ; a = current quantity ld a,[hl] ; a = current quantity
sub e sub e
ld [hld],a ; store new quantity ld [hld],a ; store new quantity
ld [wcf97],a ld [wMaxItemQuantity],a
and a and a
jr nz,.skipMovingUpSlots jr nz,.skipMovingUpSlots
; if the remaining quantity is 0, ; if the remaining quantity is 0,
@ -2909,12 +2912,12 @@ RemoveItemFromInventory_: ; ce74 (3:4e74)
ld [wListScrollOffset],a ld [wListScrollOffset],a
ld [wCurrentMenuItem],a ld [wCurrentMenuItem],a
ld [wcc2c],a ld [wcc2c],a
ld [wd07e],a ld [wSavedListScrollOffset],a
pop hl 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 dec a ; decrement the number of items
ld [hl],a ; store new number of items ld [hl],a ; store new number of items
ld [wd12a],a ld [wListCount],a
cp a,2 cp a,2
jr c,.done jr c,.done
ld [wMaxMenuItem],a ld [wMaxMenuItem],a
@ -3579,8 +3582,8 @@ _AddPartyMon: ; f2e5 (3:72e5)
ld a, [$ffe4] ld a, [$ffe4]
dec a dec a
call SkipFixedLengthTextEntries call SkipFixedLengthTextEntries
ld a, $2 ld a, NAME_MON_SCREEN
ld [wd07d], a ld [wNamingScreenType], a
predef AskName predef AskName
.asm_f33f .asm_f33f
ld hl, wPartyMons ld hl, wPartyMons
@ -3863,13 +3866,13 @@ _AddEnemyMonToPlayerParty: ; f49d (3:749d)
and a and a
ret ; return success ret ; return success
MoveMon: ; f51e (3:751e) _MoveMon: ; f51e (3:751e)
ld a, [wcf95] ld a, [wMoveMonType]
and a and a
jr z, .checkPartyMonSlots jr z, .checkPartyMonSlots
cp $2 cp DAYCARE_TO_PARTY
jr z, .checkPartyMonSlots jr z, .checkPartyMonSlots
cp $3 cp PARTY_TO_DAYCARE
ld hl, wDayCareMon ld hl, wDayCareMon
jr z, .asm_f575 jr z, .asm_f575
ld hl, W_NUMINBOX ld hl, W_NUMINBOX
@ -3889,17 +3892,17 @@ MoveMon: ; f51e (3:751e)
inc a inc a
ld [hl], a ; increment number of mons in party/box ld [hl], a ; increment number of mons in party/box
ld c, a ld c, a
ld b, $0 ld b, 0
add hl, bc add hl, bc
ld a, [wcf95] ld a, [wMoveMonType]
cp $2 cp DAYCARE_TO_PARTY
ld a, [wDayCareMon] ld a, [wDayCareMon]
jr z, .asm_f556 jr z, .asm_f556
ld a, [wcf91] ld a, [wcf91]
.asm_f556 .asm_f556
ld [hli], a ; write new mon ID ld [hli], a ; write new mon ID
ld [hl], $ff ; write new sentinel ld [hl], $ff ; write new sentinel
ld a, [wcf95] ld a, [wMoveMonType]
dec a dec a
ld hl, wPartyMons ld hl, wPartyMons
ld bc, wPartyMon2 - wPartyMon1 ; $2c ld bc, wPartyMon2 - wPartyMon1 ; $2c
@ -3915,12 +3918,12 @@ MoveMon: ; f51e (3:751e)
push hl push hl
ld e, l ld e, l
ld d, h ld d, h
ld a, [wcf95] ld a, [wMoveMonType]
and a and a
ld hl, wBoxMons ld hl, wBoxMons
ld bc, wBoxMon2 - wBoxMon1 ; $21 ld bc, wBoxMon2 - wBoxMon1 ; $21
jr z, .asm_f591 jr z, .asm_f591
cp $2 cp DAYCARE_TO_PARTY
ld hl, wDayCareMon ld hl, wDayCareMon
jr z, .asm_f597 jr z, .asm_f597
ld hl, wPartyMons ld hl, wPartyMons
@ -3935,10 +3938,10 @@ MoveMon: ; f51e (3:751e)
call CopyData call CopyData
pop de pop de
pop hl pop hl
ld a, [wcf95] ld a, [wMoveMonType]
and a and a
jr z, .asm_f5b4 jr z, .asm_f5b4
cp $2 cp DAYCARE_TO_PARTY
jr z, .asm_f5b4 jr z, .asm_f5b4
ld bc, wBoxMon2 - wBoxMon1 ld bc, wBoxMon2 - wBoxMon1
add hl, bc add hl, bc
@ -3948,8 +3951,8 @@ MoveMon: ; f51e (3:751e)
inc de inc de
ld [de], a ld [de], a
.asm_f5b4 .asm_f5b4
ld a, [wcf95] ld a, [wMoveMonType]
cp $3 cp PARTY_TO_DAYCARE
ld de, W_DAYCAREMONOT ld de, W_DAYCAREMONOT
jr z, .asm_f5d3 jr z, .asm_f5d3
dec a dec a
@ -3965,11 +3968,11 @@ MoveMon: ; f51e (3:751e)
ld e, l ld e, l
.asm_f5d3 .asm_f5d3
ld hl, wBoxMonOT ld hl, wBoxMonOT
ld a, [wcf95] ld a, [wMoveMonType]
and a and a
jr z, .asm_f5e6 jr z, .asm_f5e6
ld hl, W_DAYCAREMONOT ld hl, W_DAYCAREMONOT
cp $2 cp DAYCARE_TO_PARTY
jr z, .asm_f5ec jr z, .asm_f5ec
ld hl, wPartyMonOT ld hl, wPartyMonOT
.asm_f5e6 .asm_f5e6
@ -3978,8 +3981,8 @@ MoveMon: ; f51e (3:751e)
.asm_f5ec .asm_f5ec
ld bc, $b ld bc, $b
call CopyData call CopyData
ld a, [wcf95] ld a, [wMoveMonType]
cp $3 cp PARTY_TO_DAYCARE
ld de, W_DAYCAREMONNAME ld de, W_DAYCAREMONNAME
jr z, .asm_f611 jr z, .asm_f611
dec a dec a
@ -3995,11 +3998,11 @@ MoveMon: ; f51e (3:751e)
ld e, l ld e, l
.asm_f611 .asm_f611
ld hl, wBoxMonNicks ld hl, wBoxMonNicks
ld a, [wcf95] ld a, [wMoveMonType]
and a and a
jr z, .asm_f624 jr z, .asm_f624
ld hl, W_DAYCAREMONNAME ld hl, W_DAYCAREMONNAME
cp $2 cp DAYCARE_TO_PARTY
jr z, .asm_f62a jr z, .asm_f62a
ld hl, wPartyMonNicks ld hl, wPartyMonNicks
.asm_f624 .asm_f624
@ -4009,10 +4012,10 @@ MoveMon: ; f51e (3:751e)
ld bc, $b ld bc, $b
call CopyData call CopyData
pop hl pop hl
ld a, [wcf95] ld a, [wMoveMonType]
cp $1 cp PARTY_TO_BOX
jr z, .asm_f664 jr z, .asm_f664
cp $3 cp PARTY_TO_DAYCARE
jr z, .asm_f664 jr z, .asm_f664
push hl push hl
srl a srl a

View file

@ -12,7 +12,7 @@ CeladonGameCornerScript_48bcf: ; 48bcf (12:4bcf)
res 6, [hl] res 6, [hl]
ret z ret z
call Random call Random
ld a, [$ffd3] ld a, [hRandomAdd]
cp $7 cp $7
jr nc, .asm_48be2 jr nc, .asm_48be2
ld a, $8 ld a, $8
@ -20,7 +20,7 @@ CeladonGameCornerScript_48bcf: ; 48bcf (12:4bcf)
srl a srl a
srl a srl a
srl a srl a
ld [wUnknownSlotVar], a ld [wLuckySlotHiddenObjectIndex], a
ret ret
CeladonGameCornerScript_48bec: ; 48bec (12:4bec) CeladonGameCornerScript_48bec: ; 48bec (12:4bec)

View file

@ -26,7 +26,7 @@ CeruleanHouse2Text1: ; 74e15 (1d:4e15)
ld a, h ld a, h
ld [wList + 1], a ld [wList + 1], a
xor a xor a
ld [wcf93], a ld [wPrintItemPrices], a
ld [wMenuItemToSwap], a ld [wMenuItemToSwap], a
ld a, SPECIALLISTMENU ld a, SPECIALLISTMENU
ld [wListMenuID], a ld [wListMenuID], a

View file

@ -25,7 +25,7 @@ DayCareMText1: ; 56254 (15:6254)
call PrintText call PrintText
xor a xor a
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
ld [wd07d], a ld [wPartyMenuTypeOrMessageID], a
ld [wMenuItemToSwap], a ld [wMenuItemToSwap], a
call DisplayPartyMenu call DisplayPartyMenu
push af push af
@ -45,13 +45,13 @@ DayCareMText1: ; 56254 (15:6254)
call GetPartyMonName call GetPartyMonName
ld hl, DayCareMText_56419 ld hl, DayCareMText_56419
call PrintText call PrintText
ld a, $1 ld a, 1
ld [W_DAYCARE_IN_USE], a ld [W_DAYCARE_IN_USE], a
ld a, $3 ld a, PARTY_TO_DAYCARE
ld [wcf95], a ld [wMoveMonType], a
call Func_3a68 call MoveMon
xor a xor a
ld [wcf95], a ld [wRemoveMonFromBox], a
call RemovePokemon call RemovePokemon
ld a, [wcf91] ld a, [wcf91]
call PlayCry call PlayCry
@ -158,26 +158,26 @@ DayCareMScript_562e1: ; 562e1 (15:62e1)
predef SubBCDPredef predef SubBCDPredef
ld a, (SFX_02_5a - SFX_Headers_02) / 3 ld a, (SFX_02_5a - SFX_Headers_02) / 3
call PlaySoundWaitForCurrent call PlaySoundWaitForCurrent
ld a, $13 ld a, MONEY_BOX
ld [wTextBoxID], a ld [wTextBoxID], a
call DisplayTextBoxID call DisplayTextBoxID
ld hl, DayCareMText_5644f ld hl, DayCareMText_5644f
call PrintText call PrintText
ld a, $2 ld a, DAYCARE_TO_PARTY
ld [wcf95], a ld [wMoveMonType], a
call Func_3a68 call MoveMon
ld a, [wDayCareMonSpecies] ld a, [wDayCareMonSpecies]
ld [wcf91], a ld [wcf91], a
ld a, [wPartyCount] ld a, [wPartyCount]
dec a dec a
push af push af
ld bc, $002c ld bc, wPartyMon2 - wPartyMon1
push bc push bc
ld hl, wPartyMon1Moves ld hl, wPartyMon1Moves
call AddNTimes call AddNTimes
ld d, h ld d, h
ld e, l ld e, l
ld a, $1 ld a, 1
ld [wHPBarMaxHP], a ld [wHPBarMaxHP], a
predef WriteMonMoves predef WriteMonMoves
pop bc pop bc
@ -186,7 +186,7 @@ DayCareMScript_562e1: ; 562e1 (15:62e1)
call AddNTimes call AddNTimes
ld d, h ld d, h
ld e, l ld e, l
ld bc, $0021 ld bc, wPartyMon1MaxHP - wPartyMon1HP
add hl, bc add hl, bc
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a

View file

@ -49,7 +49,7 @@ NameRaterText1: ; 1da56 (7:5a56)
ld hl, NameRaterText_1dab8 ld hl, NameRaterText_1dab8
call PrintText call PrintText
xor a xor a
ld [wd07d], a ld [wPartyMenuTypeOrMessageID], a
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
ld [wMenuItemToSwap], a ld [wMenuItemToSwap], a
call DisplayPartyMenu call DisplayPartyMenu
@ -68,7 +68,7 @@ NameRaterText1: ; 1da56 (7:5a56)
jr nz, .asm_1daae jr nz, .asm_1daae
ld hl, NameRaterText_1dac2 ld hl, NameRaterText_1dac2
call PrintText call PrintText
callba Func_655c callba DisplayNameRaterScreen
jr c, .asm_1daae jr c, .asm_1daae
ld hl, NameRaterText_1dac7 ld hl, NameRaterText_1dac7
.asm_1daa8 .asm_1daa8

View file

@ -641,7 +641,7 @@ OaksLabScript_1d00a: ; 1d00a (7:500a)
ld a, c ld a, c
ld [wWhichPokemon], a ld [wWhichPokemon], a
ld a, $1 ld a, $1
ld [wcf96], a ld [wItemQuantity], a
jp RemoveItemFromInventory jp RemoveItemFromInventory
OaksLabScript_1d02b: ; 1d02b (7:502b) OaksLabScript_1d02b: ; 1d02b (7:502b)

222
wram.asm
View file

@ -266,7 +266,12 @@ wListScrollOffset:: ; cc36
; keeps track of what section of the list is on screen ; keeps track of what section of the list is on screen
ds 1 ds 1
wcc37:: ds 1 ; menu related thing, used in pokedex and dialog boxes wMenuWatchMovingOutOfBounds:: ; cc37
; If non-zero, then when wrapping is disabled and the player tries to go past
; the top or bottom of the menu, return from HandleMenuInput. This is useful for
; menus that have too many items to display at once on the screen because it
; allows the caller to scroll the entire menu up or down when this happens.
ds 1
wTradeCenterPointerTableIndex:: ; cc38 wTradeCenterPointerTableIndex:: ; cc38
ds 1 ds 1
@ -352,6 +357,13 @@ wNPCMovementScriptBank:: ; cc58
ds 2 ds 2
wSlotMachineSevenAndBarModeChance:: ; cc5b
; If a random number greater than this value is generated, then the player is
; allowed to have three 7 symbols or bar symbols line up.
; So, this value is actually the chance of NOT entering that mode.
; If the slot is lucky, it equals 250, giving a 5/256 (~2%) chance.
; Otherwise, it equals 253, giving a 2/256 (~0.8%) chance.
wHallOfFame:: ; cc5b wHallOfFame:: ; cc5b
wBoostExpByExpAll:: ; cc5b wBoostExpByExpAll:: ; cc5b
wAnimationType:: ; cc5b wAnimationType:: ; cc5b
@ -360,7 +372,12 @@ wAnimationType:: ; cc5b
wcc5b:: ds 1 ; these upcoming values below are miscellaneous storage values wcc5b:: ds 1 ; these upcoming values below are miscellaneous storage values
wcc5c:: ds 1 ; used in pokedex evaluation as well wcc5c:: ds 1 ; used in pokedex evaluation as well
wcc5d:: ds 1 ; used in pokedex evaluation wcc5d:: ds 1 ; used in pokedex evaluation
wcc5e:: ds 13 ; as well as used as miscellaneous storage value, this is also used for the game corner slots
wSlotMachineSavedROMBank:: ; cc5e
; ROM back to return to when the player is done with the slot machine
ds 1
ds 12
wcc6b:: ds 14 ; doesn't seem to be used for anything, probably just more storage wcc6b:: ds 14 ; doesn't seem to be used for anything, probably just more storage
wcc79:: ds 30 ; used in battle animations wcc79:: ds 30 ; used in battle animations
@ -445,7 +462,7 @@ wccf0:: ds 1 ; used as a check if a mon fainted
wPlayerUsedMove:: ds 1 ; ccf1 wPlayerUsedMove:: ds 1 ; ccf1
wEnemyUsedMove:: ds 1 ; ccf2 wEnemyUsedMove:: ds 1 ; ccf2
wccf3:: ds 1 ; used with the move minimize wEnemyMonMinimized:: ds 1 ; ccf3
wMoveDidntMiss:: ds 1 ; ccf4 wMoveDidntMiss:: ds 1 ; ccf4
@ -454,9 +471,11 @@ wPartyFoughtCurrentEnemyFlags:: ; ccf5
flag_array 6 flag_array 6
wccf6:: ds 1 ; used in some hp bar thing wccf6:: ds 1 ; used in some hp bar thing
wccf7:: ds 14 ; used with substitute move sliding thing? (not sure) wPlayerMonMinimized:: ds 1 ; ccf7
wUnknownSlotVar:: ; cd05 ds 13
wLuckySlotHiddenObjectIndex:: ; cd05
wEnemyNumHits:: ; cd05 wEnemyNumHits:: ; cd05
; number of hits by enemy in attacks like Double Slap, etc. ; number of hits by enemy in attacks like Double Slap, etc.
@ -581,6 +600,12 @@ wOverrideSimulatedJoypadStatesMask:: ; cd3b
ds 1 ds 1
wWhichTownMapLocation:: ; cd3d
wStoppingWhichSlotMachineWheel:: ; cd3d
; which wheel the player is trying to stop
; 0 = none, 1 = wheel 1, 2 = wheel 2, 3 or greater = wheel 3
wTradedPlayerMonSpecies:: ; cd3d wTradedPlayerMonSpecies:: ; cd3d
wTradingWhichPlayerMon:: ; cd3d wTradingWhichPlayerMon:: ; cd3d
@ -604,6 +629,11 @@ wWhichTrade:: ; cd3d
wTrainerSpriteOffset:: ; cd3d wTrainerSpriteOffset:: ; cd3d
ds 1 ds 1
wFlyLocationsList:: ; cd3e
; 11 bytes plus $ff sentinel values at each end
wSlotMachineWheel1Offset:: ; cd3e
wTradedEnemyMonSpecies:: ; cd3e wTradedEnemyMonSpecies:: ; cd3e
wTradingWhichEnemyMon:: ; cd3e wTradingWhichEnemyMon:: ; cd3e
@ -619,6 +649,8 @@ wHiddenObjectFunctionRomBank:: ; cd3e
wTrainerEngageDistance:: ; cd3e wTrainerEngageDistance:: ; cd3e
ds 1 ds 1
wSlotMachineWheel2Offset:: ; cd3f
wNameOfPlayerMonToBeTraded:: ; cd3f wNameOfPlayerMonToBeTraded:: ; cd3f
wFlyAnimBirdSpriteImageIndex:: ; cd3f wFlyAnimBirdSpriteImageIndex:: ; cd3f
@ -633,6 +665,8 @@ wTrainerFacingDirection:: ; cd3f
wcd3f:: ; used with daycare text for money amount wcd3f:: ; used with daycare text for money amount
ds 1 ds 1
wSlotMachineWheel3Offset:: ; cd40
wPlayerSpinInPlaceAnimSoundID:: ; cd40 wPlayerSpinInPlaceAnimSoundID:: ; cd40
wHiddenObjectY:: ; cd40 wHiddenObjectY:: ; cd40
@ -644,35 +678,96 @@ wTradedPlayerMonOT:: ; cd41
wHiddenObjectX:: ; cd41 wHiddenObjectX:: ; cd41
wSlotMachineWinningSymbol:: ; cd42
; the OAM tile number of the upper left corner of the winning symbol minus 2
wSlotMachineWheel1BottomTile:: ; cd41
wTrainerScreenX:: ; cd41 wTrainerScreenX:: ; cd41
ds 1 ds 1
; a lot of the uses for these values use more than the said address ; a lot of the uses for these values use more than the said address
wSlotMachineWheel1MiddleTile:: ; cd42
wcd42:: ds 1 ; used in pewter center script, printing field mon moves, slot machines and HoF PC wcd42:: ds 1 ; used in pewter center script, printing field mon moves, slot machines and HoF PC
wSlotMachineWheel1TopTile:: ; cd43
wcd43:: ds 1 ; slot machine stuff and GetMonFieldMoves wcd43:: ds 1 ; slot machine stuff and GetMonFieldMoves
wcd44:: ds 1 ; just slot machine
wcd45:: ds 1 ; slot machine... wSlotMachineWheel2BottomTile:: ; cd44
wcd46:: ds 1 ; slot machine... ds 1
wSlotMachineWheel2MiddleTile:: ; cd45
ds 1
wTempCoins1:: ; cd46
; 2 bytes
; temporary variable used to add payout amount to the player's coins
wSlotMachineWheel2TopTile:: ; cd46
ds 1
wSlotMachineWheel3BottomTile:: ; cd47
wcd47:: ds 1 ; used in slot machine and spinning player sprite wcd47:: ds 1 ; used in slot machine and spinning player sprite
wSlotMachineWheel3MiddleTile:: ; cd48
wcd48:: ds 1 ; same as above wcd48:: ds 1 ; same as above
wSlotMachineWheel3TopTile:: ; cd49
wcd49:: ds 1 ; used in slot machine, displaying the gym leaders/badges on the trainer card, and displaying the town map wcd49:: ds 1 ; used in slot machine, displaying the gym leaders/badges on the trainer card, and displaying the town map
wcd4a:: ds 1 ; probably used in one of the above mentioned functions
wcd4b:: ds 1 ; same as above wTempCoins2:: ; cd4a
; 2 bytes
; temporary variable used to subtract the bet amount from the player's coins
wPayoutCoins:: ; cd4a
; 2 bytes
ds 1
wcd4b:: ; cd4b
; used in player animations
ds 1
wTradedPlayerMonOTID:: ; cd4c wTradedPlayerMonOTID:: ; cd4c
wcd4c:: ds 1 ; slot machine and probably other above stuff wSlotMachineFlags:: ; cd4c
; These flags are set randomly and control when the wheels stop.
; bit 6: allow the player to win in general
; bit 7: allow the player to win with 7 or bar (plus the effect of bit 6)
ds 1
wSlotMachineWheel1SlipCounter:: ; cd4d
; wheel 1 can "slip" while this is non-zero
wcd4d:: ds 1 ; used with cut and slot machine wcd4d:: ds 1 ; used with cut and slot machine
wSlotMachineWheel2SlipCounter:: ; cd4e
; wheel 2 can "slip" while this is non-zero
wTradedEnemyMonOT:: ; cd4e wTradedEnemyMonOT:: ; cd4e
wcd4e:: ds 1 ; used with in-game trades and slot machine wcd4e:: ds 1 ; used with in-game trades and slot machine
wSlotMachineRerollCounter:: ; cd4f
; The remaining number of times wheel 3 will roll down a symbol until a match is
; found, when winning is enabled. It's initialized to 4 each bet.
wcd4f:: ds 1 ; used with in-game trades, emotion bubbles, and player animations wcd4f:: ds 1 ; used with in-game trades, emotion bubbles, and player animations
wSlotMachineBet:: ; cd50
; how many coins the player bet on the slot machine (1 to 3)
wcd50:: ds 9 ; used with in-game trades, emotion bubbles, and player and miscellaneous sprite animations wcd50:: ds 9 ; used with in-game trades, emotion bubbles, and player and miscellaneous sprite animations
wTradedEnemyMonOTID:: ; cd59 wTradedEnemyMonOTID:: ; cd59
ds 2 ds 2
wOAMBaseTile:: ; cd5b
wcd5b:: ds 1 ; used in some sprite stuff, town map and surge gym trash cans wcd5b:: ds 1 ; used in some sprite stuff, town map and surge gym trash cans
wcd5c:: ds 1 ; used in town map wcd5c:: ds 1 ; used in town map
@ -719,6 +814,10 @@ wTileMapBackup2:: ; cd81
wBuffer:: ; cee9 wBuffer:: ; cee9
; Temporary storage area of 30 bytes. ; Temporary storage area of 30 bytes.
wTownMapCoords:: ; cee9
; lower nybble is x, upper nybble is y
wHPBarMaxHP:: ; cee9 wHPBarMaxHP:: ; cee9
ds 2 ds 2
wHPBarOldHP:: ; ceeb wHPBarOldHP:: ; ceeb
@ -744,7 +843,13 @@ wAnimSoundID:: ; cf07
wcf08:: ds 1 ; used as a storage value for the bank to return to after a BankswitchHome (bankswitch in homebank) wcf08:: ds 1 ; used as a storage value for the bank to return to after a BankswitchHome (bankswitch in homebank)
wcf09:: ds 1 ; used as a temp storage value for the bank to switch to wcf09:: ds 1 ; used as a temp storage value for the bank to switch to
wcf0a:: ds 1 ; used as flags for Poke Mart
wBoughtOrSoldItemInMart:: ; cf0a
; 0 = nothing bought or sold in pokemart
; 1 = bought or sold something in pokemart
; this value is not used for anything
ds 1
wBattleResult:: ; cf0b wBattleResult:: ; cf0b
; $00 - win ; $00 - win
; $01 - lose ; $01 - lose
@ -829,7 +934,9 @@ wWhichPokemon:: ; cf92
; which pokemon you selected ; which pokemon you selected
ds 1 ds 1
wcf93:: ds 1 ; used with lists wPrintItemPrices:: ; cf93
; if non-zero, then print item prices when displaying lists
ds 1
wHPBarType:: ; cf94 wHPBarType:: ; cf94
; type of HP bar ; type of HP bar
@ -841,9 +948,22 @@ wListMenuID:: ; cf94
; ID used by DisplayListMenuID ; ID used by DisplayListMenuID
ds 1 ds 1
wcf95:: ds 1 ; used with RemovePokemon (BoxMons, Daycare, Trades, etc.) wRemoveMonFromBox:: ; cf95
wcf96:: ds 1 ; used with removing items ; if non-zero, RemovePokemon will remove the mon from the current box,
wcf97:: ds 1 ; used with printing item quantities? ; else it will remove the mon from the party
wMoveMonType:: ; cf95
; 0 = move from box to party
; 1 = move from party to box
; 2 = move from daycare to party
; 3 = move from party to daycare
ds 1
wItemQuantity:: ; cf96
ds 1
wMaxItemQuantity:: ; cf97
ds 1
; LoadMonData copies mon data here ; LoadMonData copies mon data here
wLoadedMon:: party_struct wLoadedMon ; cf98 wLoadedMon:: party_struct wLoadedMon ; cf98
@ -1123,8 +1243,20 @@ W_ANIMATIONID:: ; d07c
; ID number of the current battle animation ; ID number of the current battle animation
ds 1 ds 1
wd07d:: ds 1 ; used with naming functions and party display type wNamingScreenType:: ; d07d
wd07e:: ds 3 ; used with mart and inventory
wPartyMenuTypeOrMessageID:: ; d07d
wTempTilesetNumTiles:: ; d07d
; temporary storage for the number of tiles in a tileset
ds 1
wSavedListScrollOffset:: ; d07e
; used by the pokemart code to save the existing value of wListScrollOffset
; so that it can be restored when the player is done with the pokemart NPC
ds 1
ds 2
; base coordinates of frame block ; base coordinates of frame block
W_BASECOORDX:: ; d081 W_BASECOORDX:: ; d081
@ -1160,9 +1292,8 @@ wTradedMonMovingRight:: ; d08a
wd08a:: ds 1 ; used with sprites and displaying the option menu on the main menu screen? wd08a:: ds 1 ; used with sprites and displaying the option menu on the main menu screen?
wTownMapSpriteBlinkingCounter:: ; d08b wAnimCounter:: ; d08b
; generic counter variable for various animations
wPartyMonAnimCounter:: ; d08b
W_SUBANIMTRANSFORM:: ; d08b W_SUBANIMTRANSFORM:: ; d08b
; controls what transformations are applied to the subanimation ; controls what transformations are applied to the subanimation
@ -1188,6 +1319,13 @@ wEndBattleTextRomBank:: ; d092
W_SUBANIMADDRPTR:: ; d094 W_SUBANIMADDRPTR:: ; d094
; the address _of the address_ of the current subanimation entry ; the address _of the address_ of the current subanimation entry
ds 2 ds 2
wSlotMachineAllowMatchesCounter:: ; d096
; If non-zero, the allow matches flag is always set.
; There is a 1/256 (~0.4%) chance that this value will be set to 60, which is
; the only way it can increase. Winning certain payout amounts will decrement it
; or zero it.
W_SUBANIMSUBENTRYADDR:: ; d096 W_SUBANIMSUBENTRYADDR:: ; d096
; the address of the current subentry of the current subanimation ; the address of the current subentry of the current subanimation
ds 2 ds 2
@ -1221,7 +1359,7 @@ W_FBMODE:: ; d09e
wNewTileBlockID:: ; d09f wNewTileBlockID:: ; d09f
wd09f:: ds 1 ; used with predef ReplaceTileBlock wd09f:: ds 1 ; used with predef ReplaceTileBlock
wd0a0:: ds 1 ; used in VBlank and ChangeBGPalColor0_4Frames wDisableVBlankWYUpdate:: ds 1 ; if non-zero, don't update WY during V-blank
W_SPRITECURPOSX:: ; d0a1 W_SPRITECURPOSX:: ; d0a1
ds 1 ds 1
@ -1351,7 +1489,10 @@ wWalkBikeSurfStateCopy:: ; d11a
; wWalkBikeSurfState is sometimes copied here, but it doesn't seem to be used for anything ; wWalkBikeSurfState is sometimes copied here, but it doesn't seem to be used for anything
ds 1 ds 1
wd11b:: ds 1 ; used with mart text box and cable club wInitListType:: ; d11b
; the type of list for InitList to init
ds 1
wd11c:: ds 1 ; temp storage value for catching pokemon wd11c:: ds 1 ; temp storage value for catching pokemon
wd11d:: ds 1 ; used with battle switchout and testing if the enemy mon fainted wd11d:: ds 1 ; used with battle switchout and testing if the enemy mon fainted
wd11e:: ds 1 ; used as a Pokemon and Item storage value. Also used as an output value for CountSetBits wd11e:: ds 1 ; used as a Pokemon and Item storage value. Also used as an output value for CountSetBits
@ -1363,7 +1504,7 @@ wNumRunAttempts::
wd121:: ds 1 ; used with evolving pokemon wd121:: ds 1 ; used with evolving pokemon
wd122:: ds 2 ; saved ROM bank number for vblank wd122:: ds 2 ; saved ROM bank number for vblank
wd124:: ds 1 ; used as an output value when determining if an item is a key item wIsKeyItem:: ds 1 ; d124
wTextBoxID:: ; d125 wTextBoxID:: ; d125
ds 1 ds 1
@ -1373,16 +1514,37 @@ wd126:: ds 1 ; not exactly sure what this is used for, but it seems to be used a
W_CURENEMYLVL:: ; d127 W_CURENEMYLVL:: ; d127
ds 1 ds 1
wd128:: ds 1 ; used as a pointer to displaying Poke Mart inventory, also used to store the pointer of LoadItemList (pointer to item list initially in hl) wItemListPointer:: ; d128
wd129:: ds 1 ; second half of above mentioned pointer ; pointer to list of items terminated by $FF
wd12a:: ds 1 ; Number of list entries for displaying a list ds 2
wListCount::
; number of entries in a list
ds 1
wLinkState:: ; d12b wLinkState:: ; d12b
ds 1 ds 1
wTwoOptionMenuID:: ds 1 wTwoOptionMenuID:: ; d12c
wd12d:: ds 1 ; used with item menus and pokemart menu, also used with testing if all Pokemon Fainted? ds 1
wd12e:: ds 1 ; used as an output value to determine if A or B was pressed in a yes/no box
wChosenMenuItem:: ; d12d
; the id of the menu item the player ultimately chose
wOutOfBattleBlackout:: ; d12d
; non-zero when the whole party has fainted due to out-of-battle poison damage
ds 1
wMenuExitMethod:: ; d12e
; the way the user exited a menu
; for list menus and the buy/sell/quit menu:
; $01 = the user pressed A to choose a menu item
; $02 = the user pressed B to cancel
; for two-option menus:
; $01 = the user pressed A with the first menu item selected
; $02 = the user pressed B or pressed A with the second menu item selected
ds 1
wd12f:: ds 1 ; used in some coordinatestuff, npc pathstuff, and game corner prize stuff wd12f:: ds 1 ; used in some coordinatestuff, npc pathstuff, and game corner prize stuff
wd130:: ds 1 ; saved value of screen Y coord of trainer sprite wd130:: ds 1 ; saved value of screen Y coord of trainer sprite
wd131:: ds 1 ; saved value of screen X coord of trainer sprite wd131:: ds 1 ; saved value of screen X coord of trainer sprite