named wram variables

This commit is contained in:
YamaArashi 2015-07-14 23:16:06 -07:00
parent 07dd705637
commit 994c2cbf28
21 changed files with 246 additions and 204 deletions

View file

@ -2500,27 +2500,29 @@ CopyPicTiles: ; 79aae (1e:5aae)
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
ld a, $31 ; base tile ID of player mon sprite ld a, $31 ; base tile ID of player mon sprite
jr z, .asm_79ab6 jr z, .next
; enemy turn ; enemy turn
xor a ; base tile ID of enemy mon sprite xor a ; base tile ID of enemy mon sprite
.asm_79ab6 .next
ld [hBaseTileID], a ld [hBaseTileID], a
jr asm_79acb jr CopyTileIDs_NoBGTransfer
; copy the tiles used when a mon is being sent out ; copy the tiles used when a mon is being sent out of or into a pokeball
; and "growing" out of the pokeball CopyDownscaledMonTiles: ; 79aba (1e:5aba)
CopyGrowingMonTiles: ; 79aba (1e:5aba)
call GetPredefRegisters call GetPredefRegisters
ld a, [wcd6c] ld a, [wDownscaledMonSize]
and a and a
jr nz, .asm_79ac8 jr nz, .smallerSize
ld de, Unknown_79b02 ; 5x5 ld de, DownscaledMonTiles_5x5
jr asm_79acb jr CopyTileIDs_NoBGTransfer
.asm_79ac8 .smallerSize
ld de, Unknown_79b1b ; 3x3 ld de, DownscaledMonTiles_3x3
asm_79acb: ; 79acb (1e:5acb) ; fall through
CopyTileIDs_NoBGTransfer: ; 79acb (1e:5acb)
xor a xor a
ld [H_AUTOBGTRANSFERENABLED], a ld [H_AUTOBGTRANSFERENABLED], a
; fall through
; b = number of rows ; b = number of rows
; c = number of columns ; c = number of columns
@ -2567,14 +2569,14 @@ TileIDListPointerTable: ; 79aea (1e:5aea)
dw Unknown_79c50 dw Unknown_79c50
db $3C db $3C
Unknown_79b02: ; 79b02 (1e:5b02) DownscaledMonTiles_5x5: ; 79b02 (1e:5b02)
db $31,$38,$46,$54,$5B db $31,$38,$46,$54,$5B
db $32,$39,$47,$55,$5C db $32,$39,$47,$55,$5C
db $34,$3B,$49,$57,$5E db $34,$3B,$49,$57,$5E
db $36,$3D,$4B,$59,$60 db $36,$3D,$4B,$59,$60
db $37,$3E,$4C,$5A,$61 db $37,$3E,$4C,$5A,$61
Unknown_79b1b: ; 79b1b (1e:5b1b) DownscaledMonTiles_3x3: ; 79b1b (1e:5b1b)
db $31,$46,$5B db $31,$46,$5B
db $34,$49,$5E db $34,$49,$5E
db $37,$4C,$61 db $37,$4C,$61

View file

@ -24,7 +24,7 @@ FormatMovesString: ; 39b87 (e:5b87)
jr .copyNameLoop jr .copyNameLoop
.doneCopyingName .doneCopyingName
ld a, b ld a, b
ld [wcd6c], a ld [wNumMovesMinusOne], a
inc b inc b
ld a, $4e ; line break ld a, $4e ; line break
ld [de], a ld [de], a
@ -70,7 +70,7 @@ InitList: ; 39bd5 (e:5bd5)
.notPlayer .notPlayer
cp INIT_MON_LIST cp INIT_MON_LIST
jr nz, .notMonster jr nz, .notMonster
ld hl, wStringBuffer2 + 11 ld hl, wItemList
ld de, MonsterNames ld de, MonsterNames
ld a, MONSTER_NAME ld a, MONSTER_NAME
jr .done jr .done
@ -82,15 +82,15 @@ InitList: ; 39bd5 (e:5bd5)
ld a, ITEM_NAME ld a, ITEM_NAME
jr .done jr .done
.notBag .notBag
ld hl, wStringBuffer2 + 11 ld hl, wItemList
ld de, ItemNames ld de, ItemNames
ld a, ITEM_NAME ld a, ITEM_NAME
.done .done
ld [wNameListType], a ld [wNameListType], a
ld a, l ld a, l
ld [wList], a ld [wListPointer], a
ld a, h ld a, h
ld [wList + 1], a ld [wListPointer + 1], a
ld a, e ld a, e
ld [wcf8d], a ld [wcf8d], a
ld a, d ld a, d

View file

@ -225,7 +225,7 @@ StartBattle: ; 3c11e (f:411e)
xor a xor a
ld [wPartyGainExpFlags], a ld [wPartyGainExpFlags], a
ld [wPartyFoughtCurrentEnemyFlags], a ld [wPartyFoughtCurrentEnemyFlags], a
ld [wcd6a], a ld [wActionResultOrTookBattleTurn], a
inc a inc a
ld [wd11d], a ld [wd11d], a
ld hl, wEnemyMon1HP ld hl, wEnemyMon1HP
@ -260,7 +260,7 @@ StartBattle: ; 3c11e (f:411e)
.displaySafariZoneBattleMenu .displaySafariZoneBattleMenu
call DisplayBattleMenu call DisplayBattleMenu
ret c ; return if the player ran from battle ret c ; return if the player ran from battle
ld a, [wcd6a] ld a, [wActionResultOrTookBattleTurn]
and a ; was the item used successfully? and a ; was the item used successfully?
jr z, .displaySafariZoneBattleMenu ; if not, display the menu again; XXX does this ever jump? jr z, .displaySafariZoneBattleMenu ; if not, display the menu again; XXX does this ever jump?
ld a, [W_NUMSAFARIBALLS] ld a, [W_NUMSAFARIBALLS]
@ -415,8 +415,8 @@ MainInBattleLoop: ; 3c233 (f:4233)
ld [wPlayerSelectedMove], a ld [wPlayerSelectedMove], a
jr .selectEnemyMove jr .selectEnemyMove
.selectPlayerMove .selectPlayerMove
ld a, [wcd6a] ld a, [wActionResultOrTookBattleTurn]
and a and a ; has the player already used the turn (e.g. by using an item, trying to run or switching pokemon)
jr nz, .selectEnemyMove jr nz, .selectEnemyMove
ld [wMoveMenuType], a ld [wMoveMenuType], a
inc a inc a
@ -816,11 +816,11 @@ HandleEnemyMonFainted: ; 3c525 (f:4525)
call ChooseNextMon call ChooseNextMon
.skipReplacingBattleMon .skipReplacingBattleMon
ld a, $1 ld a, $1
ld [wcd6a], a ld [wActionResultOrTookBattleTurn], a
call ReplaceFaintedEnemyMon call ReplaceFaintedEnemyMon
jp z, EnemyRan jp z, EnemyRan
xor a xor a
ld [wcd6a], a ld [wActionResultOrTookBattleTurn], a
jp MainInBattleLoop jp MainInBattleLoop
FaintEnemyPokemon: ; 0x3c567 FaintEnemyPokemon: ; 0x3c567
@ -990,7 +990,7 @@ ReplaceFaintedEnemyMon: ; 3c664 (f:4664)
call EnemySendOut call EnemySendOut
xor a xor a
ld [W_ENEMYMOVENUM], a ld [W_ENEMYMOVENUM], a
ld [wcd6a], a ld [wActionResultOrTookBattleTurn], a
ld [wAILayer2Encouragement], a ld [wAILayer2Encouragement], a
inc a ; reset Z flag inc a ; reset Z flag
ret ret
@ -1075,11 +1075,11 @@ HandlePlayerMonFainted: ; 3c700 (f:4700)
jp nz, MainInBattleLoop ; if the enemy mon has more than 0 HP, go back to battle loop jp nz, MainInBattleLoop ; if the enemy mon has more than 0 HP, go back to battle loop
; the enemy mon has 0 HP ; the enemy mon has 0 HP
ld a, $1 ld a, $1
ld [wcd6a], a ld [wActionResultOrTookBattleTurn], a
call ReplaceFaintedEnemyMon call ReplaceFaintedEnemyMon
jp z, EnemyRan ; if enemy ran from battle rather than sending out another mon, jump jp z, EnemyRan ; if enemy ran from battle rather than sending out another mon, jump
xor a xor a
ld [wcd6a], a ld [wActionResultOrTookBattleTurn], a
jp MainInBattleLoop jp MainInBattleLoop
; resets flags, slides mon's pic down, plays cry, and prints fainted message ; resets flags, slides mon's pic down, plays cry, and prints fainted message
@ -1177,11 +1177,11 @@ ChooseNextMon: ; 3c7d8 (f:47d8)
cp LINK_STATE_BATTLING cp LINK_STATE_BATTLING
jr nz, .notLinkBattle jr nz, .notLinkBattle
inc a inc a
ld [wcd6a], a ld [wActionResultOrTookBattleTurn], a
call LinkBattleExchangeData call LinkBattleExchangeData
.notLinkBattle .notLinkBattle
xor a xor a
ld [wcd6a], a ld [wActionResultOrTookBattleTurn], a
call ClearSprites call ClearSprites
ld a, [wWhichPokemon] ld a, [wWhichPokemon]
ld [wPlayerMonNumber], a ld [wPlayerMonNumber], a
@ -1646,7 +1646,7 @@ TryRunningFromBattle: ; 3cab9 (f:4ab9)
; plus 30 times the number of attempts, the player can escape ; plus 30 times the number of attempts, the player can escape
; can't escape ; can't escape
ld a, $1 ld a, $1
ld [wcd6a], a ld [wActionResultOrTookBattleTurn], a ; you lose your turn when you can't escape
ld hl, CantEscapeText ld hl, CantEscapeText
jr .printCantEscapeOrNoRunningText jr .printCantEscapeOrNoRunningText
.trainerBattle .trainerBattle
@ -1666,7 +1666,7 @@ TryRunningFromBattle: ; 3cab9 (f:4ab9)
; link battle ; link battle
call SaveScreenTilesToBuffer1 call SaveScreenTilesToBuffer1
xor a xor a
ld [wcd6a], a ld [wActionResultOrTookBattleTurn], a
ld a, $f ld a, $f
ld [wPlayerMoveListIndex], a ld [wPlayerMoveListIndex], a
call LinkBattleExchangeData call LinkBattleExchangeData
@ -1842,7 +1842,7 @@ SendOutMon: ; 3cc91 (f:4c91)
call PrintEmptyString call PrintEmptyString
jp SaveScreenTilesToBuffer1 jp SaveScreenTilesToBuffer1
; show 2 stages of the player getting smaller before disappearing ; show 2 stages of the player mon getting smaller before disappearing
AnimateRetreatingPlayerMon: ; 3ccfa (f:4cfa) AnimateRetreatingPlayerMon: ; 3ccfa (f:4cfa)
hlCoord 1, 5 hlCoord 1, 5
ld bc, $707 ld bc, $707
@ -1850,19 +1850,19 @@ AnimateRetreatingPlayerMon: ; 3ccfa (f:4cfa)
hlCoord 3, 7 hlCoord 3, 7
ld bc, $505 ld bc, $505
xor a xor a
ld [wcd6c], a ld [wDownscaledMonSize], a
ld [H_DOWNARROWBLINKCNT1], a ld [H_DOWNARROWBLINKCNT1], a
predef CopyGrowingMonTiles predef CopyDownscaledMonTiles
ld c, 4 ld c, 4
call DelayFrames call DelayFrames
call .clearScreenArea call .clearScreenArea
hlCoord 4, 9 hlCoord 4, 9
ld bc, $303 ld bc, $303
ld a, $1 ld a, $1
ld [wcd6c], a ld [wDownscaledMonSize], a
xor a xor a
ld [H_DOWNARROWBLINKCNT1], a ld [H_DOWNARROWBLINKCNT1], a
predef CopyGrowingMonTiles predef CopyDownscaledMonTiles
call Delay3 call Delay3
call .clearScreenArea call .clearScreenArea
ld a, $4c ld a, $4c
@ -2276,9 +2276,9 @@ BagWasSelected:
jr nz, DisplayPlayerBag ; no, it is a normal battle jr nz, DisplayPlayerBag ; no, it is a normal battle
ld hl, OldManItemList ld hl, OldManItemList
ld a, l ld a, l
ld [wList], a ld [wListPointer], a
ld a, h ld a, h
ld [wList + 1], a ld [wListPointer + 1], a
jr DisplayBagMenu jr DisplayBagMenu
OldManItemList: OldManItemList:
@ -2290,9 +2290,9 @@ DisplayPlayerBag:
; get the pointer to player's bag when in a normal battle ; get the pointer to player's bag when in a normal battle
ld hl, wNumBagItems ld hl, wNumBagItems
ld a, l ld a, l
ld [wList], a ld [wListPointer], a
ld a, h ld a, h
ld [wList + 1], a ld [wListPointer + 1], a
DisplayBagMenu: DisplayBagMenu:
xor a xor a
@ -2326,7 +2326,7 @@ UseBagItem:
cp $2 ; is it a safari battle? cp $2 ; is it a safari battle?
jr z, .checkIfMonCaptured jr z, .checkIfMonCaptured
ld a, [wcd6a] ld a, [wActionResultOrTookBattleTurn]
and a ; was the item used successfully? and a ; was the item used successfully?
jp z, BagWasSelected ; if not, go back to the bag menu jp z, BagWasSelected ; if not, go back to the bag menu
@ -2479,7 +2479,7 @@ PartyMenuOrRockOrRun:
call HasMonFainted call HasMonFainted
jp z, .partyMonDeselected ; can't switch to fainted mon jp z, .partyMonDeselected ; can't switch to fainted mon
ld a, $1 ld a, $1
ld [wcd6a], a ld [wActionResultOrTookBattleTurn], a
call GBPalWhiteOut call GBPalWhiteOut
call ClearSprites call ClearSprites
call LoadHudTilePatterns call LoadHudTilePatterns
@ -2525,9 +2525,9 @@ BattleMenu_RunWasSelected: ; 3d1fa (f:51fa)
ld a, $0 ld a, $0
ld [wd11f], a ld [wd11f], a
ret c ret c
ld a, [wcd6a] ld a, [wActionResultOrTookBattleTurn]
and a and a
ret nz ret nz ; return if the player couldn't escape
jp DisplayBattleMenu jp DisplayBattleMenu
MoveSelectionMenu: ; 3d219 (f:5219) MoveSelectionMenu: ; 3d219 (f:5219)
@ -2604,9 +2604,9 @@ MoveSelectionMenu: ; 3d219 (f:5219)
ld a, $7 ld a, $7
.menuset .menuset
ld hl, wTopMenuItemY ld hl, wTopMenuItemY
ld [hli], a ld [hli], a ; wTopMenuItemY
ld a, b ld a, b
ld [hli], a ld [hli], a ; wTopMenuItemX
ld a, [wMoveMenuType] ld a, [wMoveMenuType]
cp $1 cp $1
jr z, .selectedmoveknown jr z, .selectedmoveknown
@ -2615,30 +2615,30 @@ MoveSelectionMenu: ; 3d219 (f:5219)
ld a, [wPlayerMoveListIndex] ld a, [wPlayerMoveListIndex]
inc a inc a
.selectedmoveknown .selectedmoveknown
ld [hli], a ld [hli], a ; wCurrentMenuItem
inc hl ; wTileBehindCursor untouched inc hl ; wTileBehindCursor untouched
ld a, [wcd6c] ld a, [wNumMovesMinusOne]
inc a inc a
inc a inc a
ld [hli], a ld [hli], a ; wMaxMenuItem
ld a, [wMoveMenuType] ld a, [wMoveMenuType]
dec a dec a
ld b, $c1 ; can't use B ld b, D_UP | D_DOWN | A_BUTTON
jr z, .matchedkeyspicked jr z, .matchedkeyspicked
dec a dec a
ld b, $c3 ld b, D_UP | D_DOWN | A_BUTTON | B_BUTTON
jr z, .matchedkeyspicked jr z, .matchedkeyspicked
ld a, [wLinkState] ld a, [wLinkState]
cp LINK_STATE_BATTLING cp LINK_STATE_BATTLING
jr z, .matchedkeyspicked jr z, .matchedkeyspicked
ld a, [W_FLAGS_D733] ld a, [W_FLAGS_D733]
bit 0, a bit 0, a
ld b, $c7 ld b, D_UP | D_DOWN | A_BUTTON | B_BUTTON | SELECT
jr z, .matchedkeyspicked jr z, .matchedkeyspicked
ld b, $ff ld b, $ff
.matchedkeyspicked .matchedkeyspicked
ld a, b ld a, b
ld [hli], a ld [hli], a ; wMenuWatchedKeys
ld a, [wMoveMenuType] ld a, [wMoveMenuType]
cp $1 cp $1
jr z, .movelistindex1 jr z, .movelistindex1
@ -2759,7 +2759,7 @@ CursorUp: ; 3d3c9 (f:53c9)
and a and a
jp nz, SelectMenuItem jp nz, SelectMenuItem
call EraseMenuCursor call EraseMenuCursor
ld a, [wcd6c] ld a, [wNumMovesMinusOne]
inc a inc a
ld [wCurrentMenuItem], a ld [wCurrentMenuItem], a
jp SelectMenuItem jp SelectMenuItem
@ -2767,7 +2767,7 @@ CursorUp: ; 3d3c9 (f:53c9)
CursorDown: ; 3d3dd (f:53dd) CursorDown: ; 3d3dd (f:53dd)
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
ld b, a ld b, a
ld a, [wcd6c] ld a, [wNumMovesMinusOne]
inc a inc a
inc a inc a
cp b cp b
@ -2983,7 +2983,7 @@ TypeText: ; 3d55f (f:555f)
SelectEnemyMove: ; 3d564 (f:5564) SelectEnemyMove: ; 3d564 (f:5564)
ld a, [wLinkState] ld a, [wLinkState]
sub $4 sub LINK_STATE_BATTLING
jr nz, .noLinkBattle jr nz, .noLinkBattle
; link battle ; link battle
call SaveScreenTilesToBuffer1 call SaveScreenTilesToBuffer1
@ -3079,46 +3079,47 @@ LinkBattleExchangeData: ; 3d605 (f:5605)
ld [wSerialExchangeNybbleReceiveData], a ld [wSerialExchangeNybbleReceiveData], a
ld a, [wPlayerMoveListIndex] ld a, [wPlayerMoveListIndex]
cp $f ; is the player running from battle? cp $f ; is the player running from battle?
jr z, .asm_3d630 jr z, .doExchange
ld a, [wcd6a] ld a, [wActionResultOrTookBattleTurn]
and a and a ; is the player switching in another mon?
jr nz, .asm_3d629 jr nz, .switching
; the player used a move
ld a, [wPlayerSelectedMove] ld a, [wPlayerSelectedMove]
cp STRUGGLE cp STRUGGLE
ld b, $e ld b, $e
jr z, .asm_3d62f jr z, .next
dec b dec b
inc a inc a
jr z, .asm_3d62f jr z, .next
ld a, [wPlayerMoveListIndex] ld a, [wPlayerMoveListIndex]
jr .asm_3d630 jr .doExchange
.asm_3d629 .switching
ld a, [wWhichPokemon] ld a, [wWhichPokemon]
add $4 add 4
ld b, a ld b, a
.asm_3d62f .next
ld a, b ld a, b
.asm_3d630 .doExchange
ld [wSerialExchangeNybbleSendData], a ld [wSerialExchangeNybbleSendData], a
callab PrintWaitingText callab PrintWaitingText
.asm_3d63b .syncLoop1
call Serial_ExchangeNybble call Serial_ExchangeNybble
call DelayFrame call DelayFrame
ld a, [wSerialExchangeNybbleReceiveData] ld a, [wSerialExchangeNybbleReceiveData]
inc a inc a
jr z, .asm_3d63b jr z, .syncLoop1
ld b, $a ld b, 10
.asm_3d649 .syncLoop2
call DelayFrame call DelayFrame
call Serial_ExchangeNybble call Serial_ExchangeNybble
dec b dec b
jr nz, .asm_3d649 jr nz, .syncLoop2
ld b, $a ld b, 10
.asm_3d654 .syncLoop3
call DelayFrame call DelayFrame
call Serial_SendZeroByte call Serial_SendZeroByte
dec b dec b
jr nz, .asm_3d654 jr nz, .syncLoop3
ret ret
ExecutePlayerMove: ; 3d65e (f:565e) ExecutePlayerMove: ; 3d65e (f:565e)
@ -3133,8 +3134,8 @@ ExecutePlayerMove: ; 3d65e (f:565e)
ld [wMoveDidntMiss], a ld [wMoveDidntMiss], a
ld a, $a ld a, $a
ld [wDamageMultipliers], a ld [wDamageMultipliers], a
ld a, [wcd6a] ld a, [wActionResultOrTookBattleTurn]
and a and a ; has the player already used the turn (e.g. by using an item, trying to run or switching pokemon)
jp nz, ExecutePlayerMoveDone jp nz, ExecutePlayerMoveDone
call PrintGhostText call PrintGhostText
jp z, ExecutePlayerMoveDone jp z, ExecutePlayerMoveDone
@ -3324,7 +3325,7 @@ MultiHitText: ; 3d805 (f:5805)
ExecutePlayerMoveDone: ; 3d80a (f:580a) ExecutePlayerMoveDone: ; 3d80a (f:580a)
xor a xor a
ld [wcd6a],a ld [wActionResultOrTookBattleTurn],a
ld b,1 ld b,1
ret ret
@ -6998,7 +6999,7 @@ ResetCryModifiers: ; 3f069 (f:7069)
ld [wc0f2], a ld [wc0f2], a
jp PlaySound jp PlaySound
; animtes the mon "growing" out of the pokeball ; animates the mon "growing" out of the pokeball
AnimateSendingOutMon: ; 3f073 (f:7073) AnimateSendingOutMon: ; 3f073 (f:7073)
ld a, [wPredefRegisters] ld a, [wPredefRegisters]
ld h, a ld h, a
@ -7016,17 +7017,17 @@ AnimateSendingOutMon: ; 3f073 (f:7073)
ld bc, -41 ld bc, -41
add hl, bc add hl, bc
ld a, $1 ld a, $1
ld [wcd6c], a ld [wDownscaledMonSize], a
ld bc, $303 ld bc, $303
predef CopyGrowingMonTiles predef CopyDownscaledMonTiles
ld c, 4 ld c, 4
call DelayFrames call DelayFrames
ld bc, -41 ld bc, -41
add hl, bc add hl, bc
xor a xor a
ld [wcd6c], a ld [wDownscaledMonSize], a
ld bc, $505 ld bc, $505
predef CopyGrowingMonTiles predef CopyDownscaledMonTiles
ld c, 5 ld c, 5
call DelayFrames call DelayFrames
ld bc, -41 ld bc, -41

View file

@ -2,7 +2,7 @@ InitBattleVariables: ; 525af (14:65af)
ld a, [hTilesetType] ld a, [hTilesetType]
ld [wd0d4], a ld [wd0d4], a
xor a xor a
ld [wcd6a], a ld [wActionResultOrTookBattleTurn], a
ld [wBattleResult], a ld [wBattleResult], a
ld hl, wcc2b ld hl, wcc2b
ld [hli], a ld [hli], a

View file

@ -559,7 +559,7 @@ AIPlayRestoringSFX: ; 3a69b (e:669b)
AIUseFullRestore: ; 3a6a0 (e:66a0) AIUseFullRestore: ; 3a6a0 (e:66a0)
call AICureStatus call AICureStatus
ld a,FULL_RESTORE ld a,FULL_RESTORE
ld [wcf05],a ld [wAIItem],a
ld de,wHPBarOldHP ld de,wHPBarOldHP
ld hl,wEnemyMonHP + 1 ld hl,wEnemyMonHP + 1
ld a,[hld] ld a,[hld]
@ -600,7 +600,7 @@ AIUseHyperPotion: ; 3a6d6 (e:66d6)
AIRecoverHP: ; 3a6da (e:66da) AIRecoverHP: ; 3a6da (e:66da)
; heal b HP and print "trainer used $(a) on pokemon!" ; heal b HP and print "trainer used $(a) on pokemon!"
ld [wcf05],a ld [wAIItem],a
ld hl,wEnemyMonHP + 1 ld hl,wEnemyMonHP + 1
ld a,[hl] ld a,[hl]
ld [wHPBarOldHP],a ld [wHPBarOldHP],a
@ -797,7 +797,7 @@ AIUseXSpecial: ; 3a804 (e:6804)
; fallthrough ; fallthrough
AIIncreaseStat: ; 3a808 (e:6808) AIIncreaseStat: ; 3a808 (e:6808)
ld [wcf05],a ld [wAIItem],a
push bc push bc
call AIPrintItemUse_ call AIPrintItemUse_
pop bc pop bc
@ -819,13 +819,13 @@ AIIncreaseStat: ; 3a808 (e:6808)
jp DecrementAICount jp DecrementAICount
AIPrintItemUse: ; 3a82c (e:682c) AIPrintItemUse: ; 3a82c (e:682c)
ld [wcf05],a ld [wAIItem],a
call AIPrintItemUse_ call AIPrintItemUse_
jp DecrementAICount jp DecrementAICount
AIPrintItemUse_: ; 3a835 (e:6835) AIPrintItemUse_: ; 3a835 (e:6835)
; print "x used [wcf05] on z!" ; print "x used [wAIItem] on z!"
ld a,[wcf05] ld a,[wAIItem]
ld [wd11e],a ld [wd11e],a
call GetItemName call GetItemName
ld hl, AIBattleUseItemText ld hl, AIBattleUseItemText

View file

@ -1,6 +1,6 @@
UseItem_: ; d5c7 (3:55c7) UseItem_: ; d5c7 (3:55c7)
ld a,1 ld a,1
ld [wcd6a],a ld [wActionResultOrTookBattleTurn],a ; initialise to success value
ld a,[wcf91] ;contains item_ID ld a,[wcf91] ;contains item_ID
cp a,HM_01 cp a,HM_01
jp nc,ItemUseTMHM jp nc,ItemUseTMHM
@ -661,7 +661,7 @@ ItemUseEvoStone: ; da5b (3:5a5b)
call ItemUseNoEffect call ItemUseNoEffect
.canceledItemUse .canceledItemUse
xor a xor a
ld [wcd6a],a ld [wActionResultOrTookBattleTurn],a ; item not used
pop af pop af
ret ret
@ -691,7 +691,7 @@ ItemUseMedicine: ; dabb (3:5abb)
.emptyParty .emptyParty
ld hl,.emptyPartyText ld hl,.emptyPartyText
xor a xor a
ld [wcd6a],a ; item use failed ld [wActionResultOrTookBattleTurn],a ; item use failed
jp PrintText jp PrintText
.emptyPartyText .emptyPartyText
text "You don't have" text "You don't have"
@ -706,7 +706,7 @@ ItemUseMedicine: ; dabb (3:5abb)
ld a,[wWhichPokemon] ld a,[wWhichPokemon]
call AddNTimes call AddNTimes
ld a,[wWhichPokemon] ld a,[wWhichPokemon]
ld [wcf06],a ld [wUsedItemOnWhichPokemon],a
ld d,a ld d,a
ld a,[wcf91] ld a,[wcf91]
ld e,a ld e,a
@ -803,7 +803,7 @@ ItemUseMedicine: ; dabb (3:5abb)
push hl push hl
push de push de
push bc push bc
ld a,[wcf06] ld a,[wUsedItemOnWhichPokemon]
ld c,a ld c,a
ld hl,wPartyFoughtCurrentEnemyFlags ld hl,wPartyFoughtCurrentEnemyFlags
ld b,$02 ld b,$02
@ -811,7 +811,7 @@ ItemUseMedicine: ; dabb (3:5abb)
ld a,c ld a,c
and a and a
jr z,.next jr z,.next
ld a,[wcf06] ld a,[wUsedItemOnWhichPokemon]
ld c,a ld c,a
ld hl,wPartyGainExpFlags ld hl,wPartyGainExpFlags
ld b,$01 ld b,$01
@ -1106,7 +1106,7 @@ ItemUseMedicine: ; dabb (3:5abb)
jr .done jr .done
.canceledItemUse .canceledItemUse
xor a xor a
ld [wcd6a],a ; item use failed ld [wActionResultOrTookBattleTurn],a ; item use failed
pop af pop af
pop af pop af
.done .done
@ -1384,7 +1384,7 @@ ItemUseEscapeRope: ; dfaf (3:5faf)
ld [W_SAFARIZONEENTRANCECURSCRIPT],a ld [W_SAFARIZONEENTRANCECURSCRIPT],a
inc a inc a
ld [wEscapedFromBattle],a ld [wEscapedFromBattle],a
ld [wcd6a],a ; item used ld [wActionResultOrTookBattleTurn],a ; item used
ld a,[wd152] ld a,[wd152]
and a ; using Dig? and a ; using Dig?
ret nz ; if so, return ret nz ; if so, return
@ -1550,7 +1550,7 @@ ItemUseXStat: ; e104 (3:6104)
jr nz,.inBattle jr nz,.inBattle
call ItemUseNotTime call ItemUseNotTime
ld a,2 ld a,2
ld [wcd6a],a ; item not used ld [wActionResultOrTookBattleTurn],a ; item not used
ret ret
.inBattle .inBattle
ld hl,W_PLAYERMOVENUM ld hl,W_PLAYERMOVENUM
@ -2043,7 +2043,7 @@ ItemUsePPRestore: ; e31e (3:631e)
call GoPAL_SET_CF1C call GoPAL_SET_CF1C
pop af pop af
xor a xor a
ld [wcd6a],a ; item use failed ld [wActionResultOrTookBattleTurn],a ; item use failed
ret ret
RaisePPWhichTechniqueText: ; e45d (3:645d) RaisePPWhichTechniqueText: ; e45d (3:645d)
@ -2104,7 +2104,7 @@ ItemUseTMHM: ; e479 (3:6479)
and a and a
jr z,.useMachine jr z,.useMachine
ld a,2 ld a,2
ld [wcd6a],a ; item not used ld [wActionResultOrTookBattleTurn],a ; item not used
ret ret
.useMachine .useMachine
ld a,[wWhichPokemon] ld a,[wWhichPokemon]
@ -2234,7 +2234,7 @@ SurfingAttemptFailed: ; e5b6 (3:65b6)
ItemUseFailed: ; e5b9 (3:65b9) ItemUseFailed: ; e5b9 (3:65b9)
xor a xor a
ld [wcd6a],a ; item use failed ld [wActionResultOrTookBattleTurn],a ; item use failed
jp PrintText jp PrintText
ItemUseNotTimeText: ; e5c0 (3:65c0) ItemUseNotTimeText: ; e5c0 (3:65c0)
@ -2301,13 +2301,13 @@ RestoreBonusPP: ; e606 (3:6606)
ld a,[wWhichPokemon] ld a,[wWhichPokemon]
call AddNTimes call AddNTimes
push hl push hl
ld de,wcd78 - 1 ld de,wNormalMaxPPList - 1
predef LoadMovePPs ; loads the normal max PP of each of the pokemon's moves to wcd78 predef LoadMovePPs ; loads the normal max PP of each of the pokemon's moves to wNormalMaxPPList
pop hl pop hl
ld c,21 ld c,21
ld b,0 ld b,0
add hl,bc ; hl now points to move 1 PP add hl,bc ; hl now points to move 1 PP
ld de,wcd78 ld de,wNormalMaxPPList
ld b,0 ; initialize move counter to zero ld b,0 ; initialize move counter to zero
; loop through the pokemon's moves ; loop through the pokemon's moves
.loop .loop
@ -2420,7 +2420,7 @@ GetMaxPP: ; e677 (3:6677)
ld de,wcd6d ld de,wcd6d
ld a,BANK(Moves) ld a,BANK(Moves)
call FarCopyData call FarCopyData
ld de,wcd72 ld de,wcd6d + 5 ; PP is byte 5 of move data
ld a,[de] ld a,[de]
ld b,a ; b = normal max PP ld b,a ; b = normal max PP
pop hl pop hl

View file

@ -134,18 +134,18 @@ TryingToLearn: ; 6f07 (1:6f07)
res 2, a res 2, a
ld [hFlags_0xFFF6], a ld [hFlags_0xFFF6], a
ld hl, wTopMenuItemY ld hl, wTopMenuItemY
ld a, $8 ld a, 8
ld [hli], a ld [hli], a ; wTopMenuItemY
ld a, $5 ld a, 5
ld [hli], a ld [hli], a ; wTopMenuItemX
xor a xor a
ld [hli], a ld [hli], a ; wCurrentMenuItem
inc hl inc hl
ld a, [wcd6c] ld a, [wNumMovesMinusOne]
ld [hli], a ld [hli], a ; wMaxMenuItem
ld a, $3 ld a, A_BUTTON | B_BUTTON
ld [hli], a ld [hli], a ; wMenuWatchedKeys
ld [hl], $0 ld [hl], 0 ; wLastMenuItem
ld hl, hFlags_0xFFF6 ld hl, hFlags_0xFFF6
set 1, [hl] set 1, [hl]
call HandleMenuInput call HandleMenuInput

View file

@ -325,9 +325,9 @@ Func_216b3: ; 216b3 (8:56b3)
Func_216be: ; 216be (8:56be) Func_216be: ; 216be (8:56be)
ld a, l ld a, l
ld [wList], a ld [wListPointer], a
ld a, h ld a, h
ld [wList + 1], a ld [wListPointer + 1], a
xor a xor a
ld [wPrintItemPrices], a ld [wPrintItemPrices], a
ld [wListMenuID], a ld [wListMenuID], a

View file

@ -227,7 +227,7 @@ RedrawPartyMenu_: ; 12ce3 (4:6ce3)
ld h,[hl] ld h,[hl]
ld l,a ld l,a
push hl push hl
ld a,[wcf06] ld a,[wUsedItemOnWhichPokemon]
ld hl,wPartyMonNicks ld hl,wPartyMonNicks
call GetPartyMonName call GetPartyMonName
pop hl pop hl

View file

@ -97,9 +97,9 @@ Func_79ab: ; 79ab (1:79ab)
call PrintText call PrintText
ld hl, wNumBagItems ld hl, wNumBagItems
ld a, l ld a, l
ld [wList], a ld [wListPointer], a
ld a, h ld a, h
ld [wList + 1], a ld [wListPointer + 1], a
xor a xor a
ld [wPrintItemPrices], a ld [wPrintItemPrices], a
ld a, $3 ld a, $3
@ -151,9 +151,9 @@ Func_7a28: ; 7a28 (1:7a28)
call PrintText call PrintText
ld hl, wNumBoxItems ld hl, wNumBoxItems
ld a, l ld a, l
ld [wList], a ld [wListPointer], a
ld a, h ld a, h
ld [wList + 1], a ld [wListPointer + 1], a
xor a xor a
ld [wPrintItemPrices], a ld [wPrintItemPrices], a
ld a, $3 ld a, $3
@ -205,9 +205,9 @@ Func_7aa5: ; 7aa5 (1:7aa5)
call PrintText call PrintText
ld hl, wNumBoxItems ld hl, wNumBoxItems
ld a, l ld a, l
ld [wList], a ld [wListPointer], a
ld a, h ld a, h
ld [wList + 1], a ld [wListPointer + 1], a
xor a xor a
ld [wPrintItemPrices], a ld [wPrintItemPrices], a
ld a, $3 ld a, $3

View file

@ -153,7 +153,7 @@ StartMenu_Pokemon: ; 130a9 (4:70a9)
bit 1,a ; does the player have the Cascade Badge? bit 1,a ; does the player have the Cascade Badge?
jp z,.newBadgeRequired jp z,.newBadgeRequired
predef UsedCut predef UsedCut
ld a,[wcd6a] ld a,[wActionResultOrTookBattleTurn]
and a and a
jp z,.loop jp z,.loop
jp CloseTextDisplay jp CloseTextDisplay
@ -169,7 +169,7 @@ StartMenu_Pokemon: ; 130a9 (4:70a9)
ld [wcf91],a ld [wcf91],a
ld [wd152],a ld [wd152],a
call UseItem call UseItem
ld a,[wcd6a] ld a,[wActionResultOrTookBattleTurn]
and a and a
jp z,.loop jp z,.loop
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3
@ -197,7 +197,7 @@ StartMenu_Pokemon: ; 130a9 (4:70a9)
ld [wcf91],a ld [wcf91],a
ld [wd152],a ld [wd152],a
call UseItem call UseItem
ld a,[wcd6a] ld a,[wActionResultOrTookBattleTurn]
and a and a
jp z,.loop jp z,.loop
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3
@ -308,10 +308,10 @@ StartMenu_Item: ; 13302 (4:7302)
jr .exitMenu jr .exitMenu
.notInCableClubRoom .notInCableClubRoom
ld bc,wNumBagItems ld bc,wNumBagItems
ld hl,wList ld hl,wListPointer
ld a,c ld a,c
ld [hli],a ld [hli],a
ld [hl],b ; store item bag pointer at wList (for DisplayListMenuID) ld [hl],b ; store item bag pointer in wListPointer (for DisplayListMenuID)
xor a xor a
ld [wPrintItemPrices],a ld [wPrintItemPrices],a
ld a,ITEMLISTMENU ld a,ITEMLISTMENU
@ -401,7 +401,7 @@ StartMenu_Item: ; 13302 (4:7302)
xor a xor a
ld [wd152],a ld [wd152],a
call UseItem call UseItem
ld a,[wcd6a] ld a,[wActionResultOrTookBattleTurn]
and a and a
jp z,ItemMenuLoop jp z,ItemMenuLoop
jp CloseStartMenu jp CloseStartMenu
@ -409,7 +409,7 @@ StartMenu_Item: ; 13302 (4:7302)
ld a,[wUpdateSpritesEnabled] ld a,[wUpdateSpritesEnabled]
push af push af
call UseItem call UseItem
ld a,[wcd6a] ld a,[wActionResultOrTookBattleTurn]
cp a,$02 cp a,$02
jp z,.partyMenuNotDisplayed jp z,.partyMenuNotDisplayed
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3

View file

@ -316,7 +316,7 @@ StatusScreen2: ; 12b57 (4:6b57)
hlCoord 2, 9 hlCoord 2, 9
ld de, wMovesString ld de, wMovesString
call PlaceString ; Print moves call PlaceString ; Print moves
ld a, [wcd6c] ld a, [wNumMovesMinusOne]
inc a inc a
ld c, a ld c, a
ld a, $4 ld a, $4
@ -335,7 +335,7 @@ StatusScreen2: ; 12b57 (4:6b57)
.InitPP ; 12bbb .InitPP ; 12bbb
ld hl, wLoadedMonMoves ld hl, wLoadedMonMoves
deCoord 14, 10 deCoord 14, 10
ld b, $0 ld b, 0
.PrintPP ; 12bc3 .PrintPP ; 12bc3
ld a, [hli] ld a, [hli]
and a and a
@ -356,15 +356,15 @@ StatusScreen2: ; 12b57 (4:6b57)
pop de pop de
pop hl pop hl
push hl push hl
ld bc, $0014 ld bc, wPartyMon1PP - wPartyMon1Moves - 1
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
and $3f and $3f
ld [wcd71], a ld [wStatusScreenCurrentPP], a
ld h, d ld h, d
ld l, e ld l, e
push hl push hl
ld de, wcd71 ld de, wStatusScreenCurrentPP
ld bc, $0102 ld bc, $0102
call PrintNumber call PrintNumber
ld a, "/" ld a, "/"

View file

@ -1,6 +1,6 @@
UsedCut: ; ef54 (3:6f54) UsedCut: ; ef54 (3:6f54)
xor a xor a
ld [wcd6a], a ld [wActionResultOrTookBattleTurn], a ; initialise to failure value
ld a, [W_CURMAPTILESET] ld a, [W_CURMAPTILESET]
and a ; OVERWORLD and a ; OVERWORLD
jr z, .asm_ef6b jr z, .asm_ef6b
@ -28,7 +28,7 @@ UsedCut: ; ef54 (3:6f54)
.asm_ef82 .asm_ef82
ld [wCutTile], a ld [wCutTile], a
ld a, $1 ld a, $1
ld [wcd6a], a ld [wActionResultOrTookBattleTurn], a ; used cut
ld a, [wWhichPokemon] ld a, [wWhichPokemon]
ld hl, wPartyMonNicks ld hl, wPartyMonNicks
call GetPartyMonName call GetPartyMonName

View file

@ -57,9 +57,9 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
call DisplayTextBoxID ; draw money text box call DisplayTextBoxID ; draw money text box
ld hl,wNumBagItems ld hl,wNumBagItems
ld a,l ld a,l
ld [wList],a ld [wListPointer],a
ld a,h ld a,h
ld [wList + 1],a ld [wListPointer + 1],a
xor a xor a
ld [wPrintItemPrices],a ld [wPrintItemPrices],a
ld [wCurrentMenuItem],a ld [wCurrentMenuItem],a
@ -136,11 +136,11 @@ DisplayPokemartDialogue_: ; 6c20 (1:6c20)
ld a,MONEY_BOX ld a,MONEY_BOX
ld [wTextBoxID],a ld [wTextBoxID],a
call DisplayTextBoxID call DisplayTextBoxID
ld hl,wStringBuffer2 + 11 ld hl,wItemList
ld a,l ld a,l
ld [wList],a ld [wListPointer],a
ld a,h ld a,h
ld [wList + 1],a ld [wListPointer + 1],a
xor a xor a
ld [wCurrentMenuItem],a ld [wCurrentMenuItem],a
inc a inc a

View file

@ -57,7 +57,7 @@ PredefPointers:: ; 4fe79 (13:7e79)
add_predef AnimateSendingOutMon add_predef AnimateSendingOutMon
add_predef ScaleSpriteByTwo add_predef ScaleSpriteByTwo
add_predef LoadMonBackPic add_predef LoadMonBackPic
add_predef CopyGrowingMonTiles add_predef CopyDownscaledMonTiles
add_predef LoadMissableObjects add_predef LoadMissableObjects
add_predef HealParty add_predef HealParty
add_predef MoveAnimation; 08 play move animation add_predef MoveAnimation; 08 play move animation

View file

@ -1,11 +1,11 @@
Func_1c9c6: ; 1c9c6 (7:49c6) Func_1c9c6: ; 1c9c6 (7:49c6)
ld hl, WhichFloorText ld hl, WhichFloorText
call PrintText call PrintText
ld hl, wStringBuffer2 + 11 ld hl, wItemList
ld a, l ld a, l
ld [wList], a ld [wListPointer], a
ld a, h ld a, h
ld [wList + 1], a ld [wListPointer + 1], a
ld a, [wListScrollOffset] ld a, [wListScrollOffset]
push af push af
xor a xor a

View file

@ -1055,7 +1055,7 @@ DisplayTextID:: ; 2920 (0:2920)
ld a,[H_LOADEDROMBANK] ld a,[H_LOADEDROMBANK]
push af push af
callba DisplayTextIDInit ; initialization callba DisplayTextIDInit ; initialization
ld hl,wcf11 ld hl,wTextPredefFlag
bit 0,[hl] bit 0,[hl]
res 0,[hl] res 0,[hl]
jr nz,.skipSwitchToMapBank jr nz,.skipSwitchToMapBank
@ -1225,7 +1225,7 @@ LoadItemList:: ; 2a5a (0:2a5a)
ld [wItemListPointer],a ld [wItemListPointer],a
ld a,l ld a,l
ld [wItemListPointer + 1],a ld [wItemListPointer + 1],a
ld de,wStringBuffer2 + 11 ld de,wItemList
.loop .loop
ld a,[hli] ld a,[hli]
ld [de],a ld [de],a
@ -1372,7 +1372,7 @@ AddItemToInventory:: ; 2bcf (0:2bcf)
; INPUT: ; INPUT:
; [wListMenuID] = list menu ID ; [wListMenuID] = list menu ID
; [wList] = address of the list (2 bytes) ; [wListPointer] = address of the list (2 bytes)
DisplayListMenuID:: ; 2be6 (0:2be6) DisplayListMenuID:: ; 2be6 (0:2be6)
xor a xor a
ld [H_AUTOBGTRANSFERENABLED],a ; disable auto-transfer ld [H_AUTOBGTRANSFERENABLED],a ; disable auto-transfer
@ -1392,9 +1392,9 @@ DisplayListMenuID:: ; 2be6 (0:2be6)
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 [wListCount],a ld [wListCount],a
ld a,[wList] ld a,[wListPointer]
ld l,a ld l,a
ld a,[wList + 1] ld a,[wListPointer + 1]
ld h,a ; hl = address of the list ld h,a ; hl = address of the list
ld a,[hl] ; the first byte is the number of entries in the list ld a,[hl] ; the first byte is the number of entries in the list
ld [wListCount],a ld [wListCount],a
@ -1488,9 +1488,9 @@ DisplayListMenuIDLoop:: ; 2c53 (0:2c53)
; if it's an item menu ; if it's an item menu
sla c ; item entries are 2 bytes long, so multiply by 2 sla c ; item entries are 2 bytes long, so multiply by 2
.skipMultiplying .skipMultiplying
ld a,[wList] ld a,[wListPointer]
ld l,a ld l,a
ld a,[wList + 1] ld a,[wListPointer + 1]
ld h,a ld h,a
inc hl ; hl = beginning of list entries inc hl ; hl = beginning of list entries
ld b,0 ld b,0
@ -1519,7 +1519,7 @@ DisplayListMenuIDLoop:: ; 2c53 (0:2c53)
jr .storeChosenEntry jr .storeChosenEntry
.pokemonList .pokemonList
ld hl,wPartyCount ld hl,wPartyCount
ld a,[wList] ld a,[wListPointer]
cp l ; is it a list of party pokemon or box pokemon? cp l ; is it a list of party pokemon or box pokemon?
ld hl,wPartyMonNicks ld hl,wPartyMonNicks
jr z,.getPokemonName jr z,.getPokemonName
@ -1710,9 +1710,9 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a)
ld b,$09 ld b,$09
ld c,$0e ld c,$0e
call ClearScreenArea call ClearScreenArea
ld a,[wList] ld a,[wListPointer]
ld e,a ld e,a
ld a,[wList + 1] ld a,[wListPointer + 1]
ld d,a ld d,a
inc de ; de = beginning of list entries inc de ; de = beginning of list entries
ld a,[wListScrollOffset] ld a,[wListScrollOffset]
@ -1756,7 +1756,7 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a)
.pokemonPCMenu .pokemonPCMenu
push hl push hl
ld hl,wPartyCount ld hl,wPartyCount
ld a,[wList] ld a,[wListPointer]
cp l ; is it a list of party pokemon or box pokemon? cp l ; is it a list of party pokemon or box pokemon?
ld hl,wPartyMonNicks ld hl,wPartyMonNicks
jr z,.getPokemonName jr z,.getPokemonName
@ -1801,7 +1801,7 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a)
push af push af
push hl push hl
ld hl,wPartyCount ld hl,wPartyCount
ld a,[wList] ld a,[wListPointer]
cp l ; is it a list of party pokemon or box pokemon? cp l ; is it a list of party pokemon or box pokemon?
ld a,$00 ld a,$00
jr z,.next jr z,.next
@ -1914,7 +1914,7 @@ GetMonName:: ; 2f9e (0:2f9e)
push de push de
ld bc,10 ld bc,10
call CopyData call CopyData
ld hl,wcd77 ld hl,wcd6d + 10
ld [hl], "@" ld [hl], "@"
pop de pop de
pop af pop af
@ -2090,7 +2090,7 @@ DisableWaitingAfterTextDisplay:: ; 30b6 (0:30b6)
; INPUT: ; INPUT:
; [wcf91] = item ID ; [wcf91] = item ID
; OUTPUT: ; OUTPUT:
; [wcd6a] = success ; [wActionResultOrTookBattleTurn] = success
; 00: unsucessful ; 00: unsucessful
; 01: successful ; 01: successful
; 02: not able to be used right now, no extra menu displayed (only certain items use this) ; 02: not able to be used right now, no extra menu displayed (only certain items use this)
@ -2960,17 +2960,17 @@ HasEnoughCoins::
BankswitchHome:: ; 35bc (0:35bc) BankswitchHome:: ; 35bc (0:35bc)
; switches to bank # in a ; switches to bank # in a
; Only use this when in the home bank! ; Only use this when in the home bank!
ld [wcf09],a ld [wBankswitchHomeTemp],a
ld a,[H_LOADEDROMBANK] ld a,[H_LOADEDROMBANK]
ld [wcf08],a ld [wBankswitchHomeSavedROMBank],a
ld a,[wcf09] ld a,[wBankswitchHomeTemp]
ld [H_LOADEDROMBANK],a ld [H_LOADEDROMBANK],a
ld [MBC1RomBank],a ld [MBC1RomBank],a
ret ret
BankswitchBack:: ; 35cd (0:35cd) BankswitchBack:: ; 35cd (0:35cd)
; returns from BankswitchHome ; returns from BankswitchHome
ld a,[wcf08] ld a,[wBankswitchHomeSavedROMBank]
ld [H_LOADEDROMBANK],a ld [H_LOADEDROMBANK],a
ld [MBC1RomBank],a ld [MBC1RomBank],a
ret ret
@ -4656,7 +4656,7 @@ PrintPredefTextID:: ; 3ef5 (0:3ef5)
ld [H_DOWNARROWBLINKCNT2], a ld [H_DOWNARROWBLINKCNT2], a
ld hl, TextPredefs ld hl, TextPredefs
call SetMapTextPointer call SetMapTextPointer
ld hl, wcf11 ld hl, wTextPredefFlag
set 0, [hl] set 0, [hl]
call DisplayTextID call DisplayTextID

View file

@ -106,7 +106,7 @@ OverworldLoopLessDelay::
bit 0,a bit 0,a
jr nz,.checkForOpponent jr nz,.checkForOpponent
aCoord 8, 9 aCoord 8, 9
ld [wcf0e],a ld [wTilePlayerStandingOn],a ; unused?
call DisplayTextID ; display either the start menu or the NPC/sign text call DisplayTextID ; display either the start menu or the NPC/sign text
ld a,[wcc47] ld a,[wcc47]
and a and a
@ -1280,7 +1280,7 @@ CheckForJumpingAndTilePairCollisions:: ; 0c2a (0:0c2a)
CheckForTilePairCollisions2:: ; 0c44 (0:0c44) CheckForTilePairCollisions2:: ; 0c44 (0:0c44)
aCoord 8, 9 ; tile the player is on aCoord 8, 9 ; tile the player is on
ld [wcf0e],a ld [wTilePlayerStandingOn],a
CheckForTilePairCollisions:: ; 0c4a (0:0c4a) CheckForTilePairCollisions:: ; 0c4a (0:0c4a)
ld a,[wTileInFrontOfPlayer] ld a,[wTileInFrontOfPlayer]
@ -1298,7 +1298,7 @@ CheckForTilePairCollisions:: ; 0c4a (0:0c4a)
inc hl inc hl
jr .tilePairCollisionLoop jr .tilePairCollisionLoop
.tilesetMatches .tilesetMatches
ld a,[wcf0e] ; tile the player is on ld a,[wTilePlayerStandingOn] ; tile the player is on
ld b,a ld b,a
ld a,[hl] ld a,[hl]
cp b cp b

View file

@ -808,7 +808,7 @@ HandleItemListSwapping: ; 6b44 (1:6b44)
cp a,ITEMLISTMENU cp a,ITEMLISTMENU
jp nz,DisplayListMenuIDLoop ; only rearrange item list menus jp nz,DisplayListMenuIDLoop ; only rearrange item list menus
push hl push hl
ld hl,wList ld hl,wListPointer
ld a,[hli] ld a,[hli]
ld h,[hl] ld h,[hl]
ld l,a ld l,a
@ -854,7 +854,7 @@ HandleItemListSwapping: ; 6b44 (1:6b44)
call DelayFrames call DelayFrames
push hl push hl
push de push de
ld hl,wList ld hl,wListPointer
ld a,[hli] ld a,[hli]
ld h,[hl] ld h,[hl]
ld l,a ld l,a
@ -916,7 +916,7 @@ HandleItemListSwapping: ; 6b44 (1:6b44)
jr .done jr .done
.combineItemSlots .combineItemSlots
ld [hl],a ; put the sum in the second item slot ld [hl],a ; put the sum in the second item slot
ld hl,wList ld hl,wListPointer
ld a,[hli] ld a,[hli]
ld h,[hl] ld h,[hl]
ld l,a ld l,a
@ -2065,7 +2065,7 @@ ClearVariablesAfterLoadingMapData: ; c335 (3:4335)
ld [hJoyPressed], a ld [hJoyPressed], a
ld [hJoyReleased], a ld [hJoyReleased], a
ld [hJoyHeld], a ld [hJoyHeld], a
ld [wcd6a], a ld [wActionResultOrTookBattleTurn], a
ld [wd5a3], a ld [wd5a3], a
ld hl, wCardKeyDoorY ld hl, wCardKeyDoorY
ld [hli], a ld [hli], a
@ -3810,7 +3810,7 @@ AddPartyMon_WriteMovePP: ; f476 (3:7476)
pop bc pop bc
pop de pop de
pop hl pop hl
ld a, [wcd72] ; sixth move byte = pp ld a, [wcd6d + 5] ; PP is byte 5 of move data
.empty .empty
inc de inc de
ld [de], a ld [de], a
@ -4167,12 +4167,12 @@ HealParty:
push bc push bc
ld hl, Moves ld hl, Moves
ld bc, $0006 ld bc, 6
call AddNTimes call AddNTimes
ld de, wcd6d ld de, wcd6d
ld a, BANK(Moves) ld a, BANK(Moves)
call FarCopyData call FarCopyData
ld a, [wcd72] ; default pp ld a, [wcd6d + 5] ; PP is byte 5 of move data
pop bc pop bc
pop de pop de

View file

@ -20,11 +20,11 @@ CeruleanHouse2Text1: ; 74e15 (1d:4e15)
call PrintText call PrintText
ld hl, BadgeItemList ld hl, BadgeItemList
call LoadItemList call LoadItemList
ld hl, wStringBuffer2 + 11 ld hl, wItemList
ld a, l ld a, l
ld [wList], a ld [wListPointer], a
ld a, h ld a, h
ld [wList + 1], a ld [wListPointer + 1], a
xor a xor a
ld [wPrintItemPrices], a ld [wPrintItemPrices], a
ld [wMenuItemToSwap], a ld [wMenuItemToSwap], a

View file

@ -852,19 +852,42 @@ wFlags_0xcd60:: ; cd60
ds 9 ds 9
wcd6a:: ds 1 ; used as the output of the outcome of an item (successful, unsuccessful, can't be used now, etc.) wActionResultOrTookBattleTurn:: ; cd6a
; This has overlapping related uses.
; When the player tries to use an item or use certain field moves, 0 is stored
; when the attempt fails and 1 is stored when the attempt succeeds.
; In addition, some items store 2 for certain types of failures, but this
; cannot happen in battle.
; In battle, a non-zero value indicates the player has taken their turn using
; something other than a move (e.g. using an item or switching pokemon).
; So, when an item is successfully used in battle, this value becomes non-zero
; and the player is not allowed to make a move and the two uses are compatible.
ds 1
wJoyIgnore:: ; cd6b wJoyIgnore:: ; cd6b
; Set buttons are ignored. ; Set buttons are ignored.
ds 1 ds 1
; as well as the said function, these values are used as a buffer for PlaceString wDownscaledMonSize:: ; cd6c
wcd6c:: ds 1 ; used in pokemon status screen and battle stuff ; size of downscaled mon pic used in pokeball entering/exiting animation
wcd6d:: ds 4 ; used solely for PlaceString ; $00 = 5×5
wcd71:: ds 1 ; used with pokemon status screen ; $01 = 3×3
wcd72:: ds 5 ; used with restoring PP
wcd77:: ds 1 ; used as an end terminator for GetMonName: (@ is written to this location) wNumMovesMinusOne:: ; cd6c
wcd78:: ds 9 ; also used with restoring PP ; FormatMovesString stores the number of moves minus one here
ds 1
wcd6d:: ds 4 ; buffer for various data
wStatusScreenCurrentPP:: ; cd71
; temp variable used to print a move's current PP on the status screen
ds 1
ds 6
wNormalMaxPPList:: ; cd78
; list of normal max PP (without PP up) values
ds 9
wSerialOtherGameboyRandomNumberListBlock:: ; cd81 wSerialOtherGameboyRandomNumberListBlock:: ; cd81
; buffer for transferring the random number list generated by the other gameboy ; buffer for transferring the random number list generated by the other gameboy
@ -895,15 +918,24 @@ wHPBarHPDifference:: ; cefd
ds 1 ds 1
ds 7 ds 7
wcf05:: ds 1 ; used with enemy using healing moves wAIItem:: ; cf05
wcf06:: ds 1 ; used with healing items as a storage value to store wWhichPokemon ; the item that the AI used
ds 1
wUsedItemOnWhichPokemon:: ; cf05
ds 1
wAnimSoundID:: ; cf07 wAnimSoundID:: ; cf07
; sound ID during battle animations ; sound ID during battle animations
ds 1 ds 1
wcf08:: ds 1 ; used as a storage value for the bank to return to after a BankswitchHome (bankswitch in homebank) wBankswitchHomeSavedROMBank:: ; cf08
wcf09:: ds 1 ; used as a temp storage value for the bank to switch to ; used as a storage value for the bank to return to after a BankswitchHome (bankswitch in homebank)
ds 1
wBankswitchHomeTemp:: ; cf09
; used as a temp storage value for the bank to switch to
ds 1
wBoughtOrSoldItemInMart:: ; cf0a wBoughtOrSoldItemInMart:: ; cf0a
; 0 = nothing bought or sold in pokemart ; 0 = nothing bought or sold in pokemart
@ -922,7 +954,11 @@ wAutoTextBoxDrawingControl:: ; cf0c
ds 1 ds 1
wcf0d:: ds 1 ; used with some overworld scripts (not exactly sure what it's used for) wcf0d:: ds 1 ; used with some overworld scripts (not exactly sure what it's used for)
wcf0e:: ds 1 ; used with some overworld collison check
wTilePlayerStandingOn:: ; cf0e
; used in CheckForTilePairCollisions2 to store the tile the player is on
ds 1
wcf0f:: ds 1 ; used with moving overworld sprites wcf0f:: ds 1 ; used with moving overworld sprites
wNPCMovementScriptFunctionNum:: ; cf10 wNPCMovementScriptFunctionNum:: ; cf10
@ -930,7 +966,10 @@ wNPCMovementScriptFunctionNum:: ; cf10
; wNPCMovementScriptPointerTableNum ; wNPCMovementScriptPointerTableNum
ds 1 ds 1
wcf11:: ds 1 ; used as a flag if the game needs to switch to the bank which the map is in when displaying a text id (flag is set during predefs) wTextPredefFlag:: ; cf11
; bit 0: set when printing a text predef so that DisplayTextID doesn't switch
; to the current map's bank
ds 1
wPredefParentBank:: ; cf12 wPredefParentBank:: ; cf12
ds 1 ds 1
@ -972,15 +1011,15 @@ wGainBoostedExp:: ; cf4d
ds 17 ds 17
wGymCityName:: ; cf5f wGymCityName:: ; cf5f
wStringBuffer1:: ; cf5f ds 17
ds 16 + 1
wGymLeaderName:: ; cf70
wStringBuffer2:: ; cf70
ds 16 + 1
wStringBuffer3:: ; cf81
ds 9 + 1
wList:: ; cf8b wGymLeaderName:: ; cf70
ds 11
wItemList:: ; cf7b
ds 16
wListPointer:: ; cf8b
ds 2 ds 2
wcf8d:: ds 1 ; used in GetMonName wcf8d:: ds 1 ; used in GetMonName