Identify more uses of wBuffer1-6

This commit is contained in:
Rangi 2020-11-03 19:53:07 -05:00
parent 826e070f04
commit c88c4a8340
29 changed files with 327 additions and 264 deletions

View File

@ -1,5 +1,5 @@
AIChooseMove: AIChooseMove:
; Score each move in wEnemyMonMoves starting from wBuffer1. Lower is better. ; Score each move of wEnemyMonMoves in wEnemyAIMoveScores. Lower is better.
; Pick the move with the lowest score. ; Pick the move with the lowest score.
; Wildmons attack at random. ; Wildmons attack at random.
@ -17,7 +17,7 @@ AIChooseMove:
; The default score is 20. Unusable moves are given a score of 80. ; The default score is 20. Unusable moves are given a score of 80.
ld a, 20 ld a, 20
ld hl, wBuffer1 ld hl, wEnemyAIMoveScores
ld [hli], a ld [hli], a
ld [hli], a ld [hli], a
ld [hli], a ld [hli], a
@ -37,14 +37,14 @@ AIChooseMove:
inc hl inc hl
jr .CheckDisabledMove jr .CheckDisabledMove
.ScoreDisabledMove: .ScoreDisabledMove:
ld hl, wBuffer1 ld hl, wEnemyAIMoveScores
ld b, 0 ld b, 0
add hl, bc add hl, bc
ld [hl], 80 ld [hl], 80
; Don't pick moves with 0 PP. ; Don't pick moves with 0 PP.
.CheckPP: .CheckPP:
ld hl, wBuffer1 - 1 ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonPP ld de, wEnemyMonPP
ld b, 0 ld b, 0
.CheckMovePP: .CheckMovePP:
@ -117,7 +117,7 @@ AIChooseMove:
; Decrement the scores of all moves one by one until one reaches 0. ; Decrement the scores of all moves one by one until one reaches 0.
.DecrementScores: .DecrementScores:
ld hl, wBuffer1 ld hl, wEnemyAIMoveScores
ld de, wEnemyMonMoves ld de, wEnemyMonMoves
ld c, NUM_MOVES ld c, NUM_MOVES
@ -152,7 +152,7 @@ AIChooseMove:
cp NUM_MOVES + 1 cp NUM_MOVES + 1
jr nz, .move_loop jr nz, .move_loop
ld hl, wBuffer1 ld hl, wEnemyAIMoveScores
ld de, wEnemyMonMoves ld de, wEnemyMonMoves
ld c, NUM_MOVES ld c, NUM_MOVES
@ -182,7 +182,7 @@ AIChooseMove:
; Randomly choose one of the moves with a score of 1 ; Randomly choose one of the moves with a score of 1
.ChooseMove: .ChooseMove:
ld hl, wBuffer1 ld hl, wEnemyAIMoveScores
call Random call Random
maskbits NUM_MOVES maskbits NUM_MOVES
ld c, a ld c, a

View File

@ -6,7 +6,7 @@ AI_Basic:
; -Using status-only moves if the player can't be statused ; -Using status-only moves if the player can't be statused
; -Using moves that fail if they've already been used ; -Using moves that fail if they've already been used
ld hl, wBuffer1 - 1 ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves ld de, wEnemyMonMoves
ld b, NUM_MOVES + 1 ld b, NUM_MOVES + 1
.checkmove .checkmove
@ -73,7 +73,7 @@ AI_Setup:
; 50% chance to greatly encourage stat-down moves during the first turn of player's Pokemon. ; 50% chance to greatly encourage stat-down moves during the first turn of player's Pokemon.
; Almost 90% chance to greatly discourage stat-modifying moves otherwise. ; Almost 90% chance to greatly discourage stat-modifying moves otherwise.
ld hl, wBuffer1 - 1 ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves ld de, wEnemyMonMoves
ld b, NUM_MOVES + 1 ld b, NUM_MOVES + 1
.checkmove .checkmove
@ -147,7 +147,7 @@ AI_Types:
; Discourage not very effective moves unless ; Discourage not very effective moves unless
; all damaging moves are of the same type. ; all damaging moves are of the same type.
ld hl, wBuffer1 - 1 ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves ld de, wEnemyMonMoves
ld b, NUM_MOVES + 1 ld b, NUM_MOVES + 1
.checkmove .checkmove
@ -234,7 +234,7 @@ AI_Types:
AI_Offensive: AI_Offensive:
; Greatly discourage non-damaging moves. ; Greatly discourage non-damaging moves.
ld hl, wBuffer1 - 1 ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves ld de, wEnemyMonMoves
ld b, NUM_MOVES + 1 ld b, NUM_MOVES + 1
.checkmove .checkmove
@ -261,7 +261,7 @@ AI_Offensive:
AI_Smart: AI_Smart:
; Context-specific scoring. ; Context-specific scoring.
ld hl, wBuffer1 ld hl, wEnemyAIMoveScores
ld de, wEnemyMonMoves ld de, wEnemyMonMoves
ld b, NUM_MOVES + 1 ld b, NUM_MOVES + 1
.checkmove .checkmove
@ -518,7 +518,7 @@ AI_Smart_LockOn:
.player_locked_on .player_locked_on
push hl push hl
ld hl, wBuffer1 - 1 ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves ld de, wEnemyMonMoves
ld c, NUM_MOVES + 1 ld c, NUM_MOVES + 1
@ -2893,7 +2893,7 @@ AI_Opportunist:
ret c ret c
.lowhp .lowhp
ld hl, wBuffer1 - 1 ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves ld de, wEnemyMonMoves
ld c, NUM_MOVES + 1 ld c, NUM_MOVES + 1
.checkmove .checkmove
@ -2987,7 +2987,7 @@ AI_Aggressive:
jr z, .done jr z, .done
; Discourage moves that do less damage unless they're reckless too. ; Discourage moves that do less damage unless they're reckless too.
ld hl, wBuffer1 - 1 ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves ld de, wEnemyMonMoves
ld b, 0 ld b, 0
.checkmove2 .checkmove2
@ -3060,7 +3060,7 @@ AI_Cautious:
and a and a
ret z ret z
ld hl, wBuffer1 - 1 ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves ld de, wEnemyMonMoves
ld c, NUM_MOVES + 1 ld c, NUM_MOVES + 1
.loop .loop
@ -3098,7 +3098,7 @@ INCLUDE "data/battle/ai/residual_moves.asm"
AI_Status: AI_Status:
; Dismiss status moves that don't affect the player. ; Dismiss status moves that don't affect the player.
ld hl, wBuffer1 - 1 ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves ld de, wEnemyMonMoves
ld b, NUM_MOVES + 1 ld b, NUM_MOVES + 1
.checkmove .checkmove
@ -3161,7 +3161,7 @@ AI_Risky:
; Use any move that will KO the target. ; Use any move that will KO the target.
; Risky moves will often be an exception (see below). ; Risky moves will often be an exception (see below).
ld hl, wBuffer1 - 1 ld hl, wEnemyAIMoveScores - 1
ld de, wEnemyMonMoves ld de, wEnemyMonMoves
ld c, NUM_MOVES + 1 ld c, NUM_MOVES + 1
.checkmove .checkmove

View File

@ -5358,7 +5358,7 @@ MoveSelectionScreen:
hlcoord 6, 17 - NUM_MOVES - 4 hlcoord 6, 17 - NUM_MOVES - 4
.got_start_coord .got_start_coord
ld a, SCREEN_WIDTH ld a, SCREEN_WIDTH
ld [wBuffer1], a ld [wListMovesLineSpacing], a
predef ListMoves predef ListMoves
ld b, 5 ld b, 5
@ -6334,8 +6334,7 @@ LoadEnemyMon:
ld [hli], a ld [hli], a
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
; Make sure the predef knows this isn't a partymon ld [wSkipMovesBeforeLevelUp], a
ld [wEvolutionOldSpecies], a
; Fill moves based on level ; Fill moves based on level
predef FillMoves predef FillMoves
@ -7616,9 +7615,10 @@ SendOutMonText:
and a and a
jr z, .not_linked jr z, .not_linked
ld hl, GoMonText ; If we're in a LinkBattle print just "Go <PlayerMon>" ; If we're in a LinkBattle print just "Go <PlayerMon>"
; unless DoBattle already set [wBattleHasJustStarted]
ld a, [wBattleHasJustStarted] ; unless this (unidentified) variable is set ld hl, GoMonText
ld a, [wBattleHasJustStarted]
and a and a
jr nz, .skip_to_textbox jr nz, .skip_to_textbox

View File

@ -47,7 +47,7 @@ ShowOTTrainerMonsRemaining:
StageBallTilesData: StageBallTilesData:
ld a, [de] ld a, [de]
push af push af
ld de, wBuffer1 ld de, wBattleHUDTiles
ld c, PARTY_LENGTH ld c, PARTY_LENGTH
ld a, $34 ; empty slot ld a, $34 ; empty slot
.loop1 .loop1
@ -56,7 +56,8 @@ StageBallTilesData:
dec c dec c
jr nz, .loop1 jr nz, .loop1
pop af pop af
ld de, wBuffer1
ld de, wBattleHUDTiles
.loop2 .loop2
push af push af
call .GetHUDTile call .GetHUDTile
@ -200,7 +201,7 @@ LinkBattle_TrainerHuds:
jp LoadTrainerHudOAM jp LoadTrainerHudOAM
LoadTrainerHudOAM: LoadTrainerHudOAM:
ld de, wBuffer1 ld de, wBattleHUDTiles
ld c, PARTY_LENGTH ld c, PARTY_LENGTH
.loop .loop
ld a, [wPlaceBallsY] ld a, [wPlaceBallsY]

View File

@ -616,8 +616,8 @@ DayCare_InitBreeding:
xor a xor a
ld [wEggMonItem], a ld [wEggMonItem], a
ld de, wEggMonMoves ld de, wEggMonMoves
xor a xor a ; FALSE
ld [wBuffer1], a ld [wSkipMovesBeforeLevelUp], a
predef FillMoves predef FillMoves
farcall InitEggMoves farcall InitEggMoves
ld hl, wEggMonID ld hl, wEggMonID

View File

@ -17,19 +17,19 @@ HealMachineAnim:
; 1: Left (Elm's Lab) ; 1: Left (Elm's Lab)
; 2: Up (Hall of Fame) ; 2: Up (Hall of Fame)
ld a, [wScriptVar] ld a, [wScriptVar]
ld [wBuffer1], a ld [wHealMachineAnimType], a
ldh a, [rOBP1] ldh a, [rOBP1]
ld [wBuffer2], a ld [wHealMachineTempOBP1], a
call .DoJumptableFunctions call .DoJumptableFunctions
ld a, [wBuffer2] ld a, [wHealMachineTempOBP1]
call DmgToCgbObjPal1 call DmgToCgbObjPal1
ret ret
.DoJumptableFunctions: .DoJumptableFunctions:
xor a xor a
ld [wBuffer3], a ld [wHealMachineAnimState], a
.jumpable_loop .jumptable_loop
ld a, [wBuffer1] ld a, [wHealMachineAnimType]
ld e, a ld e, a
ld d, 0 ld d, 0
ld hl, .Pointers ld hl, .Pointers
@ -38,17 +38,17 @@ HealMachineAnim:
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
ld a, [wBuffer3] ld a, [wHealMachineAnimState]
ld e, a ld e, a
inc a inc a
ld [wBuffer3], a ld [wHealMachineAnimState], a
add hl, de add hl, de
ld a, [hl] ld a, [hl]
cp HEALMACHINESTATE_FINISH cp HEALMACHINESTATE_FINISH
jr z, .finish jr z, .finish
ld hl, .Jumptable ld hl, .Jumptable
rst JumpTable rst JumpTable
jr .jumpable_loop jr .jumptable_loop
.finish .finish
ret ret
@ -237,7 +237,7 @@ INCLUDE "gfx/overworld/heal_machine.pal"
.PlaceHealingMachineTile: .PlaceHealingMachineTile:
push bc push bc
ld a, [wBuffer1] ld a, [wHealMachineAnimType]
bcpixel 2, 4 bcpixel 2, 4
cp HEALMACHINE_ELMS_LAB cp HEALMACHINE_ELMS_LAB
jr z, .okay jr z, .okay

View File

@ -125,7 +125,7 @@ CheckForLuckyNumberWinners:
push hl push hl
ld d, h ld d, h
ld e, l ld e, l
ld hl, wBuffer1 ld hl, wMonIDDigitsBuffer
lb bc, PRINTNUM_LEADINGZEROS | 2, 5 lb bc, PRINTNUM_LEADINGZEROS | 2, 5
call PrintNum call PrintNum
ld hl, wLuckyNumberDigitsBuffer ld hl, wLuckyNumberDigitsBuffer
@ -135,7 +135,7 @@ CheckForLuckyNumberWinners:
ld b, 5 ld b, 5
ld c, 0 ld c, 0
ld hl, wLuckyNumberDigitsBuffer + 4 ld hl, wLuckyNumberDigitsBuffer + 4
ld de, wBuffer1 + 4 ld de, wMonIDDigitsBuffer + 4
.loop .loop
ld a, [de] ld a, [de]
cp [hl] cp [hl]

View File

@ -361,15 +361,15 @@ PlayerWithdrawItemMenu:
.withdraw .withdraw
ld a, [wItemQuantityChangeBuffer] ld a, [wItemQuantityChangeBuffer]
ld [wBuffer1], a ; quantity ld [wPCItemQuantityChangeBuffer], a
ld a, [wCurItemQuantity] ld a, [wCurItemQuantity]
ld [wBuffer2], a ld [wPCItemQuantity], a
ld hl, wNumItems ld hl, wNumItems
call ReceiveItem call ReceiveItem
jr nc, .PackFull jr nc, .PackFull
ld a, [wBuffer1] ld a, [wPCItemQuantityChangeBuffer]
ld [wItemQuantityChangeBuffer], a ld [wItemQuantityChangeBuffer], a
ld a, [wBuffer2] ld a, [wPCItemQuantity]
ld [wCurItemQuantity], a ld [wCurItemQuantity], a
ld hl, wNumPCItems ld hl, wNumPCItems
call TossItem call TossItem
@ -490,15 +490,15 @@ PlayerDepositItemMenu:
ret ret
.tossable .tossable
ld a, [wBuffer1] ld a, [wPCItemQuantityChangeBuffer]
push af push af
ld a, [wBuffer2] ld a, [wPCItemQuantity]
push af push af
call .DepositItem call .DepositItem
pop af pop af
ld [wBuffer2], a ld [wPCItemQuantity], a
pop af pop af
ld [wBuffer1], a ld [wPCItemQuantityChangeBuffer], a
ret ret
.DepositItem: .DepositItem:
@ -522,15 +522,15 @@ PlayerDepositItemMenu:
.ContinueDeposit: .ContinueDeposit:
ld a, [wItemQuantityChangeBuffer] ld a, [wItemQuantityChangeBuffer]
ld [wBuffer1], a ld [wPCItemQuantityChangeBuffer], a
ld a, [wCurItemQuantity] ld a, [wCurItemQuantity]
ld [wBuffer2], a ld [wPCItemQuantity], a
ld hl, wNumPCItems ld hl, wNumPCItems
call ReceiveItem call ReceiveItem
jr nc, .NoRoomInPC jr nc, .NoRoomInPC
ld a, [wBuffer1] ld a, [wPCItemQuantityChangeBuffer]
ld [wItemQuantityChangeBuffer], a ld [wItemQuantityChangeBuffer], a
ld a, [wBuffer2] ld a, [wPCItemQuantity]
ld [wCurItemQuantity], a ld [wCurItemQuantity], a
ld hl, wNumItems ld hl, wNumItems
call TossItem call TossItem

View File

@ -197,11 +197,11 @@ NoTreeMon:
GetTreeScore: GetTreeScore:
call .CoordScore call .CoordScore
ld [wBuffer1], a ld [wTreeMonCoordScore], a
call .OTIDScore call .OTIDScore
ld [wBuffer2], a ld [wTreeMonOTIDScore], a
ld c, a ld c, a
ld a, [wBuffer1] ld a, [wTreeMonCoordScore]
sub c sub c
jr z, .rare jr z, .rare
jr nc, .ok jr nc, .ok

View File

@ -8,9 +8,9 @@ SelectQuantityToBuy:
farcall GetItemPrice farcall GetItemPrice
RooftopSale_SelectQuantityToBuy: RooftopSale_SelectQuantityToBuy:
ld a, d ld a, d
ld [wBuffer1], a ld [wBuySellItemPrice + 0], a
ld a, e ld a, e
ld [wBuffer2], a ld [wBuySellItemPrice + 1], a
ld hl, BuyItem_MenuHeader ld hl, BuyItem_MenuHeader
call LoadMenuHeader call LoadMenuHeader
call Toss_Sell_Loop call Toss_Sell_Loop
@ -19,9 +19,9 @@ RooftopSale_SelectQuantityToBuy:
SelectQuantityToSell: SelectQuantityToSell:
farcall GetItemPrice farcall GetItemPrice
ld a, d ld a, d
ld [wBuffer1], a ld [wBuySellItemPrice + 0], a
ld a, e ld a, e
ld [wBuffer2], a ld [wBuySellItemPrice + 1], a
ld hl, SellItem_MenuHeader ld hl, SellItem_MenuHeader
call LoadMenuHeader call LoadMenuHeader
call Toss_Sell_Loop call Toss_Sell_Loop
@ -159,9 +159,9 @@ DisplaySellingPrice:
BuySell_MultiplyPrice: BuySell_MultiplyPrice:
xor a xor a
ldh [hMultiplicand + 0], a ldh [hMultiplicand + 0], a
ld a, [wBuffer1] ld a, [wBuySellItemPrice + 0]
ldh [hMultiplicand + 1], a ldh [hMultiplicand + 1], a
ld a, [wBuffer2] ld a, [wBuySellItemPrice + 1]
ldh [hMultiplicand + 2], a ldh [hMultiplicand + 2], a
ld a, [wItemQuantityChangeBuffer] ld a, [wItemQuantityChangeBuffer]
ldh [hMultiplier], a ldh [hMultiplier], a

View File

@ -449,6 +449,7 @@ Gen2ToGen2LinkComms:
ld [wOtherTrainerClass], a ld [wOtherTrainerClass], a
call ClearScreen call ClearScreen
farcall Link_WaitBGMap farcall Link_WaitBGMap
ld hl, wOptions ld hl, wOptions
ld a, [hl] ld a, [hl]
push af push af
@ -460,8 +461,6 @@ Gen2ToGen2LinkComms:
ld bc, NAME_LENGTH ld bc, NAME_LENGTH
call CopyBytes call CopyBytes
call ReturnToMapFromSubmenu call ReturnToMapFromSubmenu
; LET'S DO THIS
ld a, [wDisableTextAcceleration] ld a, [wDisableTextAcceleration]
push af push af
ld a, 1 ld a, 1
@ -478,6 +477,7 @@ Gen2ToGen2LinkComms:
pop af pop af
ldh [rIF], a ldh [rIF], a
; LET'S DO THIS
predef StartBattle predef StartBattle
ldh a, [rIF] ldh a, [rIF]
@ -492,6 +492,7 @@ Gen2ToGen2LinkComms:
ld [wDisableTextAcceleration], a ld [wDisableTextAcceleration], a
pop af pop af
ld [wOptions], a ld [wOptions], a
farcall LoadPokemonData farcall LoadPokemonData
jp ExitLinkCommunications jp ExitLinkCommunications

View File

@ -206,9 +206,10 @@ StartMenu_PrintBugContestStatus:
FindApricornsInBag: FindApricornsInBag:
; Checks the bag for Apricorns. ; Checks the bag for Apricorns.
ld hl, wBuffer1 ld hl, wKurtApricornCount
xor a xor a
ld [hli], a ld [hli], a
assert wKurtApricornCount + 1 == wKurtApricornItems
dec a dec a
ld bc, 10 ld bc, 10
call ByteFill call ByteFill
@ -232,15 +233,15 @@ FindApricornsInBag:
jr .loop jr .loop
.done .done
ld a, [wBuffer1] ld a, [wKurtApricornCount]
and a and a
ret nz ret nz
scf scf
ret ret
.addtobuffer .addtobuffer:
push hl push hl
ld hl, wBuffer1 ld hl, wKurtApricornCount
inc [hl] inc [hl]
ld e, [hl] ld e, [hl]
ld d, 0 ld d, 0

View File

@ -10,17 +10,17 @@ _PlayerDecorationMenu:
push af push af
ld hl, .MenuHeader ld hl, .MenuHeader
call LoadMenuHeader call LoadMenuHeader
xor a xor a ; FALSE
ld [wBuffer5], a ld [wChangedDecorations], a
ld a, $1 ld a, $1 ; bed
ld [wBuffer6], a ld [wCurDecorationCategory], a
.top_loop .top_loop
ld a, [wBuffer6] ld a, [wCurDecorationCategory]
ld [wMenuCursorBuffer], a ld [wMenuCursorBuffer], a
call .FindCategoriesWithOwnedDecos call .FindCategoriesWithOwnedDecos
call DoNthMenu call DoNthMenu
ld a, [wMenuCursorY] ld a, [wMenuCursorY]
ld [wBuffer6], a ld [wCurDecorationCategory], a
jr c, .exit_menu jr c, .exit_menu
ld a, [wMenuSelection] ld a, [wMenuSelection]
ld hl, .pointers ld hl, .pointers
@ -31,7 +31,7 @@ _PlayerDecorationMenu:
call ExitMenu call ExitMenu
pop af pop af
ld [wWhichIndexSet], a ld [wWhichIndexSet], a
ld a, [wBuffer5] ld a, [wChangedDecorations]
ld c, a ld c, a
ret ret
@ -71,7 +71,7 @@ _PlayerDecorationMenu:
xor a xor a
ld [wWhichIndexSet], a ld [wWhichIndexSet], a
call .ClearStringBuffer2 call .ClearStringBuffer2
call .FindOwndDecos call .FindOwnedDecos
ld a, 7 ld a, 7
call .AppendToStringBuffer2 call .AppendToStringBuffer2
ld hl, wStringBuffer2 ld hl, wStringBuffer2
@ -98,7 +98,7 @@ _PlayerDecorationMenu:
ld [hl], a ld [hl], a
ret ret
.FindOwndDecos: .FindOwnedDecos:
ld hl, .dw ld hl, .dw
.loop .loop
ld a, [hli] ld a, [hli]
@ -642,12 +642,12 @@ DecoAction_putawaybigdoll:
DecoAction_TrySetItUp: DecoAction_TrySetItUp:
ld a, [hl] ld a, [hl]
ld [wBuffer1], a ld [wCurDecoration], a
push hl push hl
call DecoAction_SetItUp call DecoAction_SetItUp
jr c, .failed jr c, .failed
ld a, 1 ld a, TRUE
ld [wBuffer5], a ld [wChangedDecorations], a
pop hl pop hl
ld a, [wMenuSelection] ld a, [wMenuSelection]
ld [hl], a ld [hl], a
@ -661,7 +661,7 @@ DecoAction_TrySetItUp:
DecoAction_SetItUp: DecoAction_SetItUp:
; See if there's anything of the same type already out ; See if there's anything of the same type already out
ld a, [wBuffer1] ld a, [wCurDecoration]
and a and a
jr z, .nothingthere jr z, .nothingthere
; See if that item is already out ; See if that item is already out
@ -673,7 +673,7 @@ DecoAction_SetItUp:
ld a, [wMenuSelection] ld a, [wMenuSelection]
ld hl, wStringBuffer4 ld hl, wStringBuffer4
call GetDecorationName call GetDecorationName
ld a, [wBuffer1] ld a, [wCurDecoration]
ld hl, wStringBuffer3 ld hl, wStringBuffer3
call GetDecorationName call GetDecorationName
ld hl, PutAwayAndSetUpText ld hl, PutAwayAndSetUpText
@ -699,16 +699,16 @@ DecoAction_SetItUp:
DecoAction_TryPutItAway: DecoAction_TryPutItAway:
; If there is no item of that type already set, there is nothing to put away. ; If there is no item of that type already set, there is nothing to put away.
ld a, [hl] ld a, [hl]
ld [wBuffer1], a ld [wCurDecoration], a
xor a xor a
ld [hl], a ld [hl], a
ld a, [wBuffer1] ld a, [wCurDecoration]
and a and a
jr z, .nothingthere jr z, .nothingthere
; Put it away. ; Put it away.
ld a, $1 ld a, TRUE
ld [wBuffer5], a ld [wChangedDecorations], a
ld a, [wBuffer1] ld a, [wCurDecoration]
ld [wMenuSelection], a ld [wMenuSelection], a
ld hl, wStringBuffer3 ld hl, wStringBuffer3
call GetDecorationName call GetDecorationName
@ -729,8 +729,8 @@ DecoAction_setupornament:
jr c, .cancel jr c, .cancel
call DecoAction_SetItUp_Ornament call DecoAction_SetItUp_Ornament
jr c, .cancel jr c, .cancel
ld a, $1 ld a, TRUE
ld [wBuffer5], a ld [wChangedDecorations], a
jr DecoAction_FinishUp_Ornament jr DecoAction_FinishUp_Ornament
.cancel .cancel
@ -816,8 +816,8 @@ DecoAction_PutItAway_Ornament:
jr z, .nothingthere jr z, .nothingthere
ld hl, wStringBuffer3 ld hl, wStringBuffer3
call GetDecorationName call GetDecorationName
ld a, $1 ld a, TRUE
ld [wBuffer5], a ld [wChangedDecorations], a
xor a xor a
ld [wSelectedDecoration], a ld [wSelectedDecoration], a
ld hl, PutAwayTheDecoText ld hl, PutAwayTheDecoText
@ -843,9 +843,9 @@ DecoAction_AskWhichSide:
call CopyMenuData call CopyMenuData
jr c, .nope jr c, .nope
ld a, [wMenuCursorY] ld a, [wMenuCursorY]
cp 3 cp 3 ; cancel
jr z, .nope jr z, .nope
ld [wBuffer2], a ld [wSelectedDecorationSide], a
call QueryWhichSide call QueryWhichSide
ld a, [hl] ld a, [hl]
ld [wSelectedDecoration], a ld [wSelectedDecoration], a
@ -861,9 +861,10 @@ DecoAction_AskWhichSide:
QueryWhichSide: QueryWhichSide:
ld hl, wDecoRightOrnament ld hl, wDecoRightOrnament
ld de, wDecoLeftOrnament ld de, wDecoLeftOrnament
ld a, [wBuffer2] ld a, [wSelectedDecorationSide]
cp 1 cp 1 ; right side
ret z ret z
; left side, swap hl and de
push hl push hl
ld h, d ld h, d
ld l, e ld l, e

View File

@ -261,15 +261,15 @@ DoMysteryGiftIfDayHasPassed:
call OpenSRAM call OpenSRAM
ld hl, sMysteryGiftTimer ld hl, sMysteryGiftTimer
ld a, [hli] ld a, [hli]
ld [wBuffer1], a ld [wTempMysteryGiftTimer], a
ld a, [hl] ld a, [hl]
ld [wBuffer2], a ld [wTempMysteryGiftTimer + 1], a
call CloseSRAM call CloseSRAM
ld hl, wBuffer1 ld hl, wTempMysteryGiftTimer
call CheckDayDependentEventHL call CheckDayDependentEventHL
jr nc, .not_timed_out jr nc, .not_timed_out
ld hl, wBuffer1 ld hl, wTempMysteryGiftTimer
call InitOneDayCountdown call InitOneDayCountdown
call CloseSRAM call CloseSRAM
farcall ResetDailyMysteryGiftLimitIfUnlocked farcall ResetDailyMysteryGiftLimitIfUnlocked
@ -277,7 +277,7 @@ DoMysteryGiftIfDayHasPassed:
.not_timed_out .not_timed_out
ld a, BANK(sMysteryGiftTimer) ld a, BANK(sMysteryGiftTimer)
call OpenSRAM call OpenSRAM
ld hl, wBuffer1 ld hl, wTempMysteryGiftTimer
ld a, [hli] ld a, [hli]
ld [sMysteryGiftTimer], a ld [sMysteryGiftTimer], a
ld a, [hl] ld a, [hl]

View File

@ -62,7 +62,7 @@ Phone_FindOpenSlot:
GetRemainingSpaceInPhoneList: GetRemainingSpaceInPhoneList:
xor a xor a
ld [wBuffer1], a ld [wRegisteredPhoneNumbers], a
ld hl, PermanentNumbers ld hl, PermanentNumbers
.loop .loop
ld a, [hli] ld a, [hli]
@ -76,7 +76,7 @@ GetRemainingSpaceInPhoneList:
ld c, a ld c, a
call _CheckCellNum call _CheckCellNum
jr c, .permanent jr c, .permanent
ld hl, wBuffer1 ld hl, wRegisteredPhoneNumbers
inc [hl] inc [hl]
.permanent .permanent
pop hl pop hl
@ -87,7 +87,7 @@ GetRemainingSpaceInPhoneList:
.done .done
ld a, CONTACT_LIST_SIZE ld a, CONTACT_LIST_SIZE
ld hl, wBuffer1 ld hl, wRegisteredPhoneNumbers
sub [hl] sub [hl]
ret ret

View File

@ -509,7 +509,7 @@ FillMoves:
ld a, [wCurPartyLevel] ld a, [wCurPartyLevel]
cp b cp b
jp c, .done jp c, .done
ld a, [wEvolutionOldSpecies] ld a, [wSkipMovesBeforeLevelUp]
and a and a
jr z, .CheckMove jr z, .CheckMove
ld a, [wPrevPartyLevel] ld a, [wPrevPartyLevel]

View File

@ -142,7 +142,7 @@ ForgetMove:
call Textbox call Textbox
hlcoord 5 + 2, 2 + 2 hlcoord 5 + 2, 2 + 2
ld a, SCREEN_WIDTH * 2 ld a, SCREEN_WIDTH * 2
ld [wBuffer1], a ld [wListMovesLineSpacing], a
predef ListMoves predef ListMoves
; w2DMenuData ; w2DMenuData
ld a, $4 ld a, $4

View File

@ -322,7 +322,8 @@ InitMail:
; initialize wMailboxCount from sMailboxCount ; initialize wMailboxCount from sMailboxCount
ld hl, wMailboxCount ld hl, wMailboxCount
ld [hli], a ; now hl = wMailboxItems ld [hli], a
assert wMailboxCount + 1 == wMailboxItems
and a and a
jr z, .done ; if no mail, we're done jr z, .done ; if no mail, we're done

View File

@ -1,3 +1,17 @@
; MailGFXPointers indexes
; LoadMailPalettes.MailPals indexes (see gfx/mail/mail.pal)
const_def
const FLOWER_MAIL_INDEX ; 0
const SURF_MAIL_INDEX ; 1
const LITEBLUEMAIL_INDEX ; 2
const PORTRAITMAIL_INDEX ; 3
const LOVELY_MAIL_INDEX ; 4
const EON_MAIL_INDEX ; 5
const MORPH_MAIL_INDEX ; 6
const BLUESKY_MAIL_INDEX ; 7
const MUSIC_MAIL_INDEX ; 8
const MIRAGE_MAIL_INDEX ; 9
ReadPartyMonMail: ReadPartyMonMail:
ld a, [wCurPartyMon] ld a, [wCurPartyMon]
ld hl, sPartyMail ld hl, sPartyMail
@ -35,7 +49,7 @@ ReadAnyMail:
call .LoadGFX call .LoadGFX
call EnableLCD call EnableLCD
call WaitBGMap call WaitBGMap
ld a, [wBuffer3] ld a, [wCurMailIndex]
ld e, a ld e, a
farcall LoadMailPalettes farcall LoadMailPalettes
call SetPalettes call SetPalettes
@ -72,13 +86,13 @@ ReadAnyMail:
call OpenSRAM call OpenSRAM
ld de, sPartyMon1MailAuthorID - sPartyMon1Mail ld de, sPartyMon1MailAuthorID - sPartyMon1Mail
add hl, de add hl, de
ld a, [hli] ; author id
ld [wCurMailAuthorID], a
ld a, [hli] ld a, [hli]
ld [wBuffer1], a ld [wCurMailAuthorID + 1], a
ld a, [hli] ld a, [hli] ; species
ld [wBuffer2], a
ld a, [hli]
ld [wCurPartySpecies], a ld [wCurPartySpecies], a
ld b, [hl] ld b, [hl] ; type
call CloseSRAM call CloseSRAM
ld hl, MailGFXPointers ld hl, MailGFXPointers
ld c, 0 ld c, 0
@ -99,7 +113,7 @@ ReadAnyMail:
.got_pointer .got_pointer
ld a, c ld a, c
ld [wBuffer3], a ld [wCurMailIndex], a
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
@ -111,6 +125,7 @@ ReadAnyMail:
ret ret
MailGFXPointers: MailGFXPointers:
; entries correspond to *MAIL_INDEX constants
dbw FLOWER_MAIL, LoadFlowerMailGFX dbw FLOWER_MAIL, LoadFlowerMailGFX
dbw SURF_MAIL, LoadSurfMailGFX dbw SURF_MAIL, LoadSurfMailGFX
dbw LITEBLUEMAIL, LoadLiteBlueMailGFX dbw LITEBLUEMAIL, LoadLiteBlueMailGFX
@ -121,7 +136,7 @@ MailGFXPointers:
dbw BLUESKY_MAIL, LoadBlueSkyMailGFX dbw BLUESKY_MAIL, LoadBlueSkyMailGFX
dbw MUSIC_MAIL, LoadMusicMailGFX dbw MUSIC_MAIL, LoadMusicMailGFX
dbw MIRAGE_MAIL, LoadMirageMailGFX dbw MIRAGE_MAIL, LoadMirageMailGFX
db -1 db -1 ; end
LoadSurfMailGFX: LoadSurfMailGFX:
push bc push bc
@ -697,12 +712,12 @@ MailGFX_PlaceMessage:
ld a, [de] ld a, [de]
and a and a
ret z ret z
ld a, [wBuffer3] ld a, [wCurMailIndex]
hlcoord 8, 14 hlcoord 8, 14
cp $3 ; PORTRAITMAIL cp PORTRAITMAIL_INDEX
jr z, .place_author jr z, .place_author
hlcoord 6, 14 hlcoord 6, 14
cp $6 ; MORPH_MAIL cp MORPH_MAIL_INDEX
jr z, .place_author jr z, .place_author
hlcoord 5, 14 hlcoord 5, 14

View File

@ -1145,7 +1145,7 @@ SetUpMoveList:
ld bc, NUM_MOVES ld bc, NUM_MOVES
call CopyBytes call CopyBytes
ld a, SCREEN_WIDTH * 2 ld a, SCREEN_WIDTH * 2
ld [wBuffer1], a ld [wListMovesLineSpacing], a
hlcoord 2, 3 hlcoord 2, 3
predef ListMoves predef ListMoves
hlcoord 10, 4 hlcoord 10, 4

View File

@ -242,9 +242,9 @@ ListMovePP:
sub c sub c
ld b, a ld b, a
push hl push hl
ld a, [wBuffer1] ld a, [wListMovesLineSpacing]
ld e, a ld e, a
ld d, $0 ld d, 0
ld a, $3e ; P ld a, $3e ; P
call .load_loop call .load_loop
ld a, b ld a, b
@ -299,7 +299,7 @@ ListMovePP:
lb bc, 1, 2 lb bc, 1, 2
call PrintNum call PrintNum
pop hl pop hl
ld a, [wBuffer1] ld a, [wListMovesLineSpacing]
ld e, a ld e, a
ld d, 0 ld d, 0
add hl, de add hl, de
@ -354,7 +354,7 @@ Unused_PlaceEnemyHPLevel:
push hl push hl
ld bc, -12 ld bc, -12
add hl, bc add hl, bc
ld b, $0 ld b, 0
call DrawEnemyHP call DrawEnemyHP
pop hl pop hl
ld bc, 5 ld bc, 5
@ -367,6 +367,7 @@ Unused_PlaceEnemyHPLevel:
ret ret
PlaceStatusString: PlaceStatusString:
; Return nz if the status is not OK
push de push de
inc de inc de
inc de inc de
@ -381,7 +382,7 @@ PlaceStatusString:
ld de, FntString ld de, FntString
call CopyStatusString call CopyStatusString
pop de pop de
ld a, $1 ld a, TRUE
and a and a
ret ret
@ -420,7 +421,7 @@ PlaceNonFaintStatus:
.place .place
call CopyStatusString call CopyStatusString
ld a, $1 ld a, TRUE
and a and a
.no_status .no_status
@ -434,9 +435,9 @@ FrzString: db "FRZ@"
ParString: db "PAR@" ParString: db "PAR@"
ListMoves: ListMoves:
; List moves at hl, spaced every [wBuffer1] tiles. ; List moves at hl, spaced every [wListMovesLineSpacing] tiles.
ld de, wListMoves_MoveIndicesBuffer ld de, wListMoves_MoveIndicesBuffer
ld b, $0 ld b, 0
.moves_loop .moves_loop
ld a, [de] ld a, [de]
inc de inc de
@ -459,7 +460,7 @@ ListMoves:
inc b inc b
pop hl pop hl
push bc push bc
ld a, [wBuffer1] ld a, [wListMovesLineSpacing]
ld c, a ld c, a
ld b, 0 ld b, 0
add hl, bc add hl, bc
@ -475,7 +476,7 @@ ListMoves:
.nonmove_loop .nonmove_loop
push af push af
ld [hl], "-" ld [hl], "-"
ld a, [wBuffer1] ld a, [wListMovesLineSpacing]
ld c, a ld c, a
ld b, 0 ld b, 0
add hl, bc add hl, bc

View File

@ -25,8 +25,8 @@ MonSubmenu:
db 1 ; default option db 1 ; default option
.GetTopCoord: .GetTopCoord:
; TopCoord = 1 + BottomCoord - 2 * (NumSubmenuItems + 1) ; [wMenuBorderTopCoord] = 1 + [wMenuBorderBottomCoord] - 2 * ([wMonSubmenuCount] + 1)
ld a, [wBuffer1] ld a, [wMonSubmenuCount]
inc a inc a
add a add a
ld b, a ld b, a
@ -41,7 +41,7 @@ MonMenuLoop:
.loop .loop
ld a, MENU_UNUSED_3 | MENU_BACKUP_TILES_2 ; flags ld a, MENU_UNUSED_3 | MENU_BACKUP_TILES_2 ; flags
ld [wMenuDataFlags], a ld [wMenuDataFlags], a
ld a, [wBuffer1] ; items ld a, [wMonSubmenuCount] ; items
ld [wMenuDataItems], a ld [wMenuDataItems], a
call InitVerticalMenuCursor call InitVerticalMenuCursor
ld hl, w2DMenuFlags1 ld hl, w2DMenuFlags1
@ -65,7 +65,7 @@ MonMenuLoop:
dec a dec a
ld c, a ld c, a
ld b, 0 ld b, 0
ld hl, wBuffer2 ld hl, wMonSubmenuItems
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
ret ret
@ -74,7 +74,7 @@ PopulateMonMenu:
call MenuBoxCoord2Tile call MenuBoxCoord2Tile
ld bc, 2 * SCREEN_WIDTH + 2 ld bc, 2 * SCREEN_WIDTH + 2
add hl, bc add hl, bc
ld de, wBuffer2 ld de, wMonSubmenuItems
.loop .loop
ld a, [de] ld a, [de]
inc de inc de
@ -170,7 +170,7 @@ GetMonSubmenuItems:
call AddMonMenuItem call AddMonMenuItem
.skip2 .skip2
ld a, [wBuffer1] ld a, [wMonSubmenuCount]
cp NUM_MONMENU_ITEMS cp NUM_MONMENU_ITEMS
jr z, .ok2 jr z, .ok2
ld a, MONMENUITEM_CANCEL ld a, MONMENUITEM_CANCEL
@ -212,17 +212,17 @@ IsFieldMove:
ResetMonSubmenu: ResetMonSubmenu:
xor a xor a
ld [wBuffer1], a ld [wMonSubmenuCount], a
ld hl, wBuffer2 ld hl, wMonSubmenuItems
ld bc, NUM_MONMENU_ITEMS + 1 ld bc, NUM_MONMENU_ITEMS + 1
call ByteFill call ByteFill
ret ret
TerminateMonSubmenu: TerminateMonSubmenu:
ld a, [wBuffer1] ld a, [wMonSubmenuCount]
ld e, a ld e, a
ld d, 0 ld d, 0
ld hl, wBuffer2 ld hl, wMonSubmenuItems
add hl, de add hl, de
ld [hl], -1 ld [hl], -1
ret ret
@ -231,12 +231,12 @@ AddMonMenuItem:
push hl push hl
push de push de
push af push af
ld a, [wBuffer1] ld a, [wMonSubmenuCount]
ld e, a ld e, a
inc a inc a
ld [wBuffer1], a ld [wMonSubmenuCount], a
ld d, 0 ld d, 0
ld hl, wBuffer2 ld hl, wMonSubmenuItems
add hl, de add hl, de
pop af pop af
ld [hl], a ld [hl], a

View File

@ -132,7 +132,7 @@ rept NUM_MOVES - 1
ld [hli], a ld [hli], a
endr endr
ld [hl], a ld [hl], a
ld [wEvolutionOldSpecies], a ld [wSkipMovesBeforeLevelUp], a
predef FillMoves predef FillMoves
.next .next
@ -876,8 +876,8 @@ RetrieveBreedmon:
call AddNTimes call AddNTimes
ld d, h ld d, h
ld e, l ld e, l
ld a, $1 ld a, TRUE
ld [wBuffer1], a ld [wSkipMovesBeforeLevelUp], a
predef FillMoves predef FillMoves
ld a, [wPartyCount] ld a, [wPartyCount]
dec a dec a

View File

@ -635,7 +635,7 @@ LoadPinkPage:
call .CalcExpToNextLevel call .CalcExpToNextLevel
hlcoord 13, 13 hlcoord 13, 13
lb bc, 3, 7 lb bc, 3, 7
ld de, wBuffer1 ld de, wExpToNextLevel
call PrintNum call PrintNum
ld de, .LevelUpStr ld de, .LevelUpStr
hlcoord 10, 12 hlcoord 10, 12
@ -679,18 +679,18 @@ LoadPinkPage:
ldh a, [hQuotient + 3] ldh a, [hQuotient + 3]
sub [hl] sub [hl]
dec hl dec hl
ld [wBuffer3], a ld [wExpToNextLevel + 2], a
ldh a, [hQuotient + 2] ldh a, [hQuotient + 2]
sbc [hl] sbc [hl]
dec hl dec hl
ld [wBuffer2], a ld [wExpToNextLevel + 1], a
ldh a, [hQuotient + 1] ldh a, [hQuotient + 1]
sbc [hl] sbc [hl]
ld [wBuffer1], a ld [wExpToNextLevel], a
ret ret
.AlreadyAtMaxLevel: .AlreadyAtMaxLevel:
ld hl, wBuffer1 ld hl, wExpToNextLevel
xor a xor a
ld [hli], a ld [hli], a
ld [hli], a ld [hli], a
@ -732,11 +732,11 @@ LoadGreenPage:
call CopyBytes call CopyBytes
hlcoord 8, 10 hlcoord 8, 10
ld a, SCREEN_WIDTH * 2 ld a, SCREEN_WIDTH * 2
ld [wBuffer1], a ld [wListMovesLineSpacing], a
predef ListMoves predef ListMoves
hlcoord 12, 11 hlcoord 12, 11
ld a, SCREEN_WIDTH * 2 ld a, SCREEN_WIDTH * 2
ld [wBuffer1], a ld [wListMovesLineSpacing], a
predef ListMovePP predef ListMovePP
ret ret

View File

@ -1,17 +1,17 @@
_SwitchPartyMons: _SwitchPartyMons:
ld a, [wSwitchMon] ld a, [wSwitchMon]
dec a dec a
ld [wBuffer3], a ld [wSwitchMonFrom], a
ld b, a ld b, a
ld a, [wMenuCursorY] ld a, [wMenuCursorY]
dec a dec a
ld [wBuffer2], a ld [wSwitchMonTo], a
cp b cp b
jr z, .skip jr z, .skip
call .SwapMonAndMail call .SwapMonAndMail
ld a, [wBuffer3] ld a, [wSwitchMonFrom]
call .ClearSprite call .ClearSprite
ld a, [wBuffer2] ld a, [wSwitchMonTo]
call .ClearSprite call .ClearSprite
.skip .skip
ret ret
@ -44,13 +44,13 @@ _SwitchPartyMons:
push de push de
push bc push bc
ld bc, wPartySpecies ld bc, wPartySpecies
ld a, [wBuffer2] ld a, [wSwitchMonTo]
ld l, a ld l, a
ld h, $0 ld h, $0
add hl, bc add hl, bc
ld d, h ld d, h
ld e, l ld e, l
ld a, [wBuffer3] ld a, [wSwitchMonFrom]
ld l, a ld l, a
ld h, $0 ld h, $0
add hl, bc add hl, bc
@ -60,7 +60,7 @@ _SwitchPartyMons:
ld [hl], a ld [hl], a
pop af pop af
ld [de], a ld [de], a
ld a, [wBuffer2] ld a, [wSwitchMonTo]
ld hl, wPartyMon1Species ld hl, wPartyMon1Species
ld bc, PARTYMON_STRUCT_LENGTH ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes call AddNTimes
@ -68,7 +68,7 @@ _SwitchPartyMons:
ld de, wSwitchMonBuffer ld de, wSwitchMonBuffer
ld bc, PARTYMON_STRUCT_LENGTH ld bc, PARTYMON_STRUCT_LENGTH
call CopyBytes call CopyBytes
ld a, [wBuffer3] ld a, [wSwitchMonFrom]
ld hl, wPartyMon1 ld hl, wPartyMon1
ld bc, PARTYMON_STRUCT_LENGTH ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes call AddNTimes
@ -80,12 +80,12 @@ _SwitchPartyMons:
ld hl, wSwitchMonBuffer ld hl, wSwitchMonBuffer
ld bc, PARTYMON_STRUCT_LENGTH ld bc, PARTYMON_STRUCT_LENGTH
call CopyBytes call CopyBytes
ld a, [wBuffer2] ld a, [wSwitchMonTo]
ld hl, wPartyMonOT ld hl, wPartyMonOT
call SkipNames call SkipNames
push hl push hl
call .CopyNameToSwitchMonBuffer call .CopyNameToSwitchMonBuffer
ld a, [wBuffer3] ld a, [wSwitchMonFrom]
ld hl, wPartyMonOT ld hl, wPartyMonOT
call SkipNames call SkipNames
pop de pop de
@ -95,12 +95,12 @@ _SwitchPartyMons:
ld hl, wSwitchMonBuffer ld hl, wSwitchMonBuffer
call .CopyName call .CopyName
ld hl, wPartyMonNicknames ld hl, wPartyMonNicknames
ld a, [wBuffer2] ld a, [wSwitchMonTo]
call SkipNames call SkipNames
push hl push hl
call .CopyNameToSwitchMonBuffer call .CopyNameToSwitchMonBuffer
ld hl, wPartyMonNicknames ld hl, wPartyMonNicknames
ld a, [wBuffer3] ld a, [wSwitchMonFrom]
call SkipNames call SkipNames
pop de pop de
push hl push hl
@ -109,7 +109,7 @@ _SwitchPartyMons:
ld hl, wSwitchMonBuffer ld hl, wSwitchMonBuffer
call .CopyName call .CopyName
ld hl, sPartyMail ld hl, sPartyMail
ld a, [wBuffer2] ld a, [wSwitchMonTo]
ld bc, MAIL_STRUCT_LENGTH ld bc, MAIL_STRUCT_LENGTH
call AddNTimes call AddNTimes
push hl push hl
@ -119,7 +119,7 @@ _SwitchPartyMons:
call OpenSRAM call OpenSRAM
call CopyBytes call CopyBytes
ld hl, sPartyMail ld hl, sPartyMail
ld a, [wBuffer3] ld a, [wSwitchMonFrom]
ld bc, MAIL_STRUCT_LENGTH ld bc, MAIL_STRUCT_LENGTH
call AddNTimes call AddNTimes
pop de pop de

View File

@ -1,3 +1,10 @@
; RestartClock_GetWraparoundTime.WrapAroundTimes indexes
const_def 1
const RESTART_CLOCK_DAY
const RESTART_CLOCK_HOUR
const RESTART_CLOCK_MIN
NUM_RESTART_CLOCK_DIVISIONS EQU const_value - 1
RestartClock_GetWraparoundTime: RestartClock_GetWraparoundTime:
push hl push hl
dec a dec a
@ -18,14 +25,15 @@ endr
ret ret
.WrapAroundTimes: .WrapAroundTimes:
dw wBuffer4 ; entries correspond to RESTART_CLOCK_* constants
db 7, 4 wraparound_time: MACRO
dw \1 ; value pointer
dw wBuffer5 db \2 ; maximum value
db 24, 12 db \3 ; up/down arrow x coord (pairs with wRestartClockUpArrowYCoord)
ENDM
dw wBuffer6 wraparound_time wRestartClockDay, 7, 4
db 60, 15 wraparound_time wRestartClockHour, 24, 12
wraparound_time wRestartClockMin, 60, 15
RestartClock: RestartClock:
; If we're here, we had an RTC overflow. ; If we're here, we had an RTC overflow.
@ -56,18 +64,18 @@ RestartClock:
text_end text_end
.SetClock: .SetClock:
ld a, 1 ld a, RESTART_CLOCK_DAY
ld [wBuffer1], a ; which digit ld [wRestartClockCurDivision], a
ld [wBuffer2], a ld [wRestartClockPrevDivision], a
ld a, 8 ld a, 8
ld [wBuffer3], a ld [wRestartClockUpArrowYCoord], a
call UpdateTime call UpdateTime
call GetWeekday call GetWeekday
ld [wBuffer4], a ld [wRestartClockDay], a
ldh a, [hHours] ldh a, [hHours]
ld [wBuffer5], a ld [wRestartClockHour], a
ldh a, [hMinutes] ldh a, [hMinutes]
ld [wBuffer6], a ld [wRestartClockMin], a
.loop .loop
call .joy_loop call .joy_loop
@ -79,11 +87,11 @@ RestartClock:
call PrintText call PrintText
call YesNoBox call YesNoBox
jr c, .cancel jr c, .cancel
ld a, [wBuffer4] ld a, [wRestartClockDay]
ld [wStringBuffer2], a ld [wStringBuffer2], a
ld a, [wBuffer5] ld a, [wRestartClockHour]
ld [wStringBuffer2 + 1], a ld [wStringBuffer2 + 1], a
ld a, [wBuffer6] ld a, [wRestartClockMin]
ld [wStringBuffer2 + 2], a ld [wStringBuffer2 + 2], a
xor a xor a
ld [wStringBuffer2 + 3], a ld [wStringBuffer2 + 3], a
@ -92,11 +100,11 @@ RestartClock:
ld hl, .ClockHasResetText ld hl, .ClockHasResetText
call PrintText call PrintText
call WaitPressAorB_BlinkCursor call WaitPressAorB_BlinkCursor
xor a xor a ; FALSE
ret ret
.cancel .cancel
ld a, $1 ld a, TRUE
ret ret
.ClockIsThisOKText: .ClockIsThisOKText:
@ -128,29 +136,29 @@ RestartClock:
jr .joy_loop jr .joy_loop
.press_A .press_A
ld a, $0 ld a, FALSE
scf scf
ret ret
.press_B .press_B
ld a, $1 ld a, TRUE
scf scf
ret ret
.pressed_up .pressed_up
ld a, [wBuffer1] ld a, [wRestartClockCurDivision]
call RestartClock_GetWraparoundTime call RestartClock_GetWraparoundTime
ld a, [de] ld a, [de]
inc a inc a
ld [de], a ld [de], a
cp b cp b
jr c, .done_scroll jr c, .done_scroll
ld a, $0 ld a, 0
ld [de], a ld [de], a
jr .done_scroll jr .done_scroll
.pressed_down .pressed_down
ld a, [wBuffer1] ld a, [wRestartClockCurDivision]
call RestartClock_GetWraparoundTime call RestartClock_GetWraparoundTime
ld a, [de] ld a, [de]
dec a dec a
@ -163,22 +171,22 @@ RestartClock:
jr .done_scroll jr .done_scroll
.pressed_left .pressed_left
ld hl, wBuffer1 ld hl, wRestartClockCurDivision
dec [hl] dec [hl]
jr nz, .done_scroll jr nz, .done_scroll
ld [hl], $3 ld [hl], RESTART_CLOCK_MIN
jr .done_scroll jr .done_scroll
.pressed_right .pressed_right
ld hl, wBuffer1 ld hl, wRestartClockCurDivision
inc [hl] inc [hl]
ld a, [hl] ld a, [hl]
cp $4 cp NUM_RESTART_CLOCK_DIVISIONS + 1
jr c, .done_scroll jr c, .done_scroll
ld [hl], $1 ld [hl], RESTART_CLOCK_DAY
.done_scroll .done_scroll
xor a xor a ; FALSE
ret ret
.PrintTime: .PrintTime:
@ -187,27 +195,27 @@ RestartClock:
ld c, 18 ld c, 18
call Textbox call Textbox
decoord 1, 8 decoord 1, 8
ld a, [wBuffer4] ld a, [wRestartClockDay]
ld b, a ld b, a
farcall PrintDayOfWeek farcall PrintDayOfWeek
ld a, [wBuffer5] ld a, [wRestartClockHour]
ld b, a ld b, a
ld a, [wBuffer6] ld a, [wRestartClockMin]
ld c, a ld c, a
decoord 11, 8 decoord 11, 8
farcall PrintHoursMins farcall PrintHoursMins
ld a, [wBuffer2] ld a, [wRestartClockPrevDivision]
lb de, " ", " " lb de, " ", " "
call .PlaceChars call .PlaceChars
ld a, [wBuffer1] ld a, [wRestartClockCurDivision]
lb de, "▲", "▼" lb de, "▲", "▼"
call .PlaceChars call .PlaceChars
ld a, [wBuffer1] ld a, [wRestartClockCurDivision]
ld [wBuffer2], a ld [wRestartClockPrevDivision], a
ret ret
.UnusedPlaceCharsFragment: ; unreferenced .UnusedPlaceCharsFragment: ; unreferenced
ld a, [wBuffer3] ld a, [wRestartClockUpArrowYCoord]
ld b, a ld b, a
call Coord2Tile call Coord2Tile
ret ret
@ -215,7 +223,7 @@ RestartClock:
.PlaceChars: .PlaceChars:
push de push de
call RestartClock_GetWraparoundTime call RestartClock_GetWraparoundTime
ld a, [wBuffer3] ld a, [wRestartClockUpArrowYCoord]
dec a dec a
ld b, a ld b, a
call Coord2Tile call Coord2Tile

View File

@ -1,49 +1,10 @@
RGB 20, 31, 11 RGB 20,31,11, 31,19,00, 31,10,09, 00,00,00 ; FLOWER_MAIL
RGB 31, 19, 00 RGB 15,20,31, 30,26,00, 31,12,00, 00,00,00 ; SURF_MAIL
RGB 31, 10, 09 RGB 24,17,31, 30,26,00, 08,11,31, 00,00,00 ; LITEBLUEMAIL
RGB 00, 00, 00 RGB 31,25,17, 31,18,04, 28,12,05, 00,00,00 ; PORTRAITMAIL
RGB 19,26,31, 31,05,08, 31,09,31, 00,00,00 ; LOVELY_MAIL
RGB 15, 20, 31 RGB 31,19,28, 31,21,00, 12,22,00, 00,00,00 ; EON_MAIL
RGB 30, 26, 00 RGB 19,17,23, 30,26,00, 31,12,00, 00,00,00 ; MORPH_MAIL
RGB 31, 12, 00 RGB 07,26,31, 26,26,27, 31,11,11, 00,00,00 ; BLUESKY_MAIL
RGB 00, 00, 00 RGB 21,31,21, 30,26,00, 31,12,00, 00,00,00 ; MUSIC_MAIL
RGB 07,26,31, 31,31,00, 00,21,00, 00,00,00 ; MIRAGE_MAIL
RGB 24, 17, 31
RGB 30, 26, 00
RGB 08, 11, 31
RGB 00, 00, 00
RGB 31, 25, 17
RGB 31, 18, 04
RGB 28, 12, 05
RGB 00, 00, 00
RGB 19, 26, 31
RGB 31, 05, 08
RGB 31, 09, 31
RGB 00, 00, 00
RGB 31, 19, 28
RGB 31, 21, 00
RGB 12, 22, 00
RGB 00, 00, 00
RGB 19, 17, 23
RGB 30, 26, 00
RGB 31, 12, 00
RGB 00, 00, 00
RGB 07, 26, 31
RGB 26, 26, 27
RGB 31, 11, 11
RGB 00, 00, 00
RGB 21, 31, 21
RGB 30, 26, 00
RGB 31, 12, 00
RGB 00, 00, 00
RGB 07, 26, 31
RGB 31, 31, 00
RGB 00, 21, 00
RGB 00, 00, 00

View File

@ -29,7 +29,7 @@ PlayersHouse2F_MapScripts:
special ToggleMaptileDecorations special ToggleMaptileDecorations
endcallback endcallback
db 0, 0, 0 ; filler db 0, 0, 0 ; unused
Doll1Script:: Doll1Script::
describedecoration DECODESC_LEFT_DOLL describedecoration DECODESC_LEFT_DOLL

View File

@ -2227,7 +2227,7 @@ wEvolvableFlags:: flag_array PARTY_LENGTH
wForceEvolution:: db wForceEvolution:: db
UNION UNION
; general-purpose buffers ; unidentified
wBuffer1:: db wBuffer1:: db
wBuffer2:: db wBuffer2:: db
wBuffer3:: db wBuffer3:: db
@ -2247,12 +2247,77 @@ wCurHPAnimDeltaHP:: dw
wCurHPAnimLowHP:: db wCurHPAnimLowHP:: db
wCurHPAnimHighHP:: db wCurHPAnimHighHP:: db
NEXTU
; battle AI
wEnemyAIMoveScores:: ds NUM_MOVES
NEXTU
; battle HUD
wBattleHUDTiles:: ds PARTY_LENGTH
NEXTU NEXTU
; evolution data ; evolution data
wEvolutionOldSpecies:: db wEvolutionOldSpecies:: db
wEvolutionNewSpecies:: db wEvolutionNewSpecies:: db
wEvolutionPicOffset:: db wEvolutionPicOffset:: db
wEvolutionCanceled:: db wEvolutionCanceled:: db
NEXTU
; experience
wExpToNextLevel:: ds 3
NEXTU
; lucky number show
wMonIDDigitsBuffer:: ds 5
NEXTU
; mon submenu
wMonSubmenuCount:: db
wMonSubmenuItems:: ds NUM_MONMENU_ITEMS + 1
NEXTU
; heal machine anim
wHealMachineAnimType:: db
wHealMachineTempOBP1:: db
wHealMachineAnimState:: db
NEXTU
; decorations
wCurDecoration:: db
wSelectedDecorationSide:: db
wSelectedDecoration:: db
wOtherDecoration:: db
wChangedDecorations:: db
wCurDecorationCategory:: db
NEXTU
; withdraw/deposit items
wPCItemQuantityChangeBuffer:: db
wPCItemQuantity:: db
NEXTU
; mail
wCurMailAuthorID:: dw
wCurMailIndex:: db
NEXTU
; kurt
wKurtApricornCount:: db
wKurtApricornItems:: ds 10
NEXTU
; tree mons
wTreeMonCoordScore:: db
wTreeMonOTIDScore:: db
NEXTU
; restart clock
wRestartClockCurDivision:: db
wRestartClockPrevDivision:: db
wRestartClockUpArrowYCoord:: db
wRestartClockDay:: db
wRestartClockHour:: db
wRestartClockMin:: db
NEXTU NEXTU
; link ; link
@ -2273,12 +2338,20 @@ wd1f2:: ds 1
wd1f3:: ds 1 wd1f3:: ds 1
NEXTU NEXTU
; miscellaneous ; miscellaneous bytes
wMagikarpLength:: dw wSkipMovesBeforeLevelUp::
wSelectedDecoration:: db wRegisteredPhoneNumbers::
wOtherDecoration:: db wListMovesLineSpacing:: db
ds 3 wSwitchMonTo:: db
wSwitchMonFrom:: db
ds 4
wCurEnemyItem:: db wCurEnemyItem:: db
NEXTU
; miscellaneous words
wBuySellItemPrice::
wTempMysteryGiftTimer::
wMagikarpLength:: dw
ENDU ENDU
wTempEnemyMonSpecies:: db wTempEnemyMonSpecies:: db
@ -3254,7 +3327,7 @@ wBattleAnimTempPalette:: db
ENDU ENDU
UNION UNION
ds $32 ds 50
wBattleAnimEnd:: wBattleAnimEnd::
NEXTU NEXTU