This commit is contained in:
dannye 2022-12-28 17:38:38 -06:00
commit 3f691fcb21
970 changed files with 15106 additions and 11361 deletions

View file

@ -66,7 +66,7 @@ MainMenu:
ld a, [wSaveFileStatus]
ld [wMaxMenuItem], a
call HandleMenuInput
bit 1, a ; pressed B?
bit BIT_B_BUTTON, a
jp nz, DisplayTitleScreen ; if so, go back to the title screen
ld c, 20
call DelayFrames
@ -125,9 +125,9 @@ MainMenu:
jp SpecialEnterMap
InitOptions:
ld a, 1 ; no delay
ld a, TEXT_DELAY_FAST
ld [wLetterPrintingDelayFlags], a
ld a, 3 ; medium speed
ld a, TEXT_DELAY_MEDIUM
ld [wOptions], a
ret
@ -184,13 +184,13 @@ LinkMenu:
ld b, a
and $f0
cp $d0
jr z, .asm_5c7d
jr z, .checkEnemyMenuSelection
ld a, [wLinkMenuSelectionReceiveBuffer + 1]
ld b, a
and $f0
cp $d0
jr nz, .exchangeMenuSelectionLoop
.asm_5c7d
.checkEnemyMenuSelection
ld a, b
and $c ; did the enemy press A or B?
jr nz, .enemyPressedAOrB
@ -284,9 +284,11 @@ LinkMenu:
.choseCancel
xor a
ld [wMenuJoypadPollCount], a
vc_hook Wireless_net_stop
call Delay3
call CloseLinkConnection
ld hl, LinkCanceledText
vc_hook Wireless_net_end
call PrintText
ld hl, wd72e
res 6, [hl]
@ -477,11 +479,11 @@ DisplayOptionMenu:
ld b, a
and A_BUTTON | B_BUTTON | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ; any key besides select pressed?
jr z, .getJoypadStateLoop
bit 1, b ; B button pressed?
bit BIT_B_BUTTON, b
jr nz, .exitMenu
bit 3, b ; Start button pressed?
bit BIT_START, b
jr nz, .exitMenu
bit 0, b ; A button pressed?
bit BIT_A_BUTTON, b
jr z, .checkDirectionKeys
ld a, [wTopMenuItemY]
cp 16 ; is the cursor on Cancel?
@ -496,9 +498,9 @@ DisplayOptionMenu:
jp .loop
.checkDirectionKeys
ld a, [wTopMenuItemY]
bit 7, b ; Down pressed?
bit BIT_D_DOWN, b
jr nz, .downPressed
bit 6, b ; Up pressed?
bit BIT_D_UP, b
jr nz, .upPressed
cp 8 ; cursor in Battle Animation section?
jr z, .cursorInBattleAnimation
@ -507,7 +509,7 @@ DisplayOptionMenu:
cp 16 ; cursor on Cancel?
jr z, .loop
.cursorInTextSpeed
bit 5, b ; Left pressed?
bit BIT_D_LEFT, b
jp nz, .pressedLeftInTextSpeed
jp .pressedRightInTextSpeed
.downPressed
@ -678,11 +680,10 @@ SetCursorPositionsFromOptions:
; 00: X coordinate of menu cursor
; 01: delay after printing a letter (in frames)
TextSpeedOptionData:
db 14, 5 ; Slow
db 7, 3 ; Medium
db 1, 1 ; Fast
db 7 ; default X coordinate (Medium)
db -1 ; end
db 14, TEXT_DELAY_SLOW
db 7, TEXT_DELAY_MEDIUM
db 1, TEXT_DELAY_FAST
db 7, -1 ; end (default X coordinate)
CheckForPlayerNameInSRAM:
; Check if the player name data in SRAM has a string terminator character

View file

@ -39,7 +39,7 @@ AskName:
pop hl
pop af
ld [wUpdateSpritesEnabled], a
ld a, [wcf4b]
ld a, [wStringBuffer]
cp "@"
ret nz
.declinedNickname
@ -63,7 +63,7 @@ DisplayNameRaterScreen::
call GBPalWhiteOutWithDelay3
call RestoreScreenTilesAndReloadTilePatterns
call LoadGBPal
ld a, [wcf4b]
ld a, [wStringBuffer]
cp "@"
jr z, .playerCancelled
ld hl, wPartyMonNicks
@ -109,7 +109,7 @@ DisplayNamingScreen:
ld a, 7
ld [wMaxMenuItem], a
ld a, "@"
ld [wcf4b], a
ld [wStringBuffer], a
xor a
ld hl, wNamingScreenSubmitName
ld [hli], a
@ -157,7 +157,7 @@ DisplayNamingScreen:
.submitNickname
pop de
ld hl, wcf4b
ld hl, wStringBuffer
ld bc, NAME_LENGTH
call CopyData
call GBPalWhiteOutWithDelay3
@ -375,7 +375,7 @@ PrintNicknameAndUnderscores:
lb bc, 1, 10
call ClearScreenArea
hlcoord 10, 2
ld de, wcf4b
ld de, wStringBuffer
call PlaceString
hlcoord 10, 3
ld a, [wNamingScreenType]
@ -437,9 +437,9 @@ DakutensAndHandakutens:
INCLUDE "data/text/dakutens.asm"
; calculates the length of the string at wcf4b and stores it in c
; calculates the length of the string at wStringBuffer and stores it in c
CalcStringLength:
ld hl, wcf4b
ld hl, wStringBuffer
ld c, $0
.loop
ld a, [hl]

View file

@ -131,7 +131,7 @@ RedrawPartyMenu_::
ld l, a
ld de, wEvosMoves
ld a, BANK(EvosMovesPointerTable)
ld bc, wEvosMoves.end - wEvosMoves
ld bc, wEvosMovesEnd - wEvosMoves
call FarCopyData
ld hl, wEvosMoves
ld de, .notAbleToEvolveText

View file

@ -14,7 +14,7 @@ PCMainMenu:
ld hl, wFlags_0xcd60
set 5, [hl]
call HandleMenuInput
bit 1, a ;if player pressed B
bit BIT_B_BUTTON, a
jp nz, LogOff
ld a, [wMaxMenuItem]
cp 2

View file

@ -95,7 +95,7 @@ HandlePokedexSideMenu:
ld [wMenuWatchMovingOutOfBounds], a
.handleMenuInput
call HandleMenuInput
bit 1, a ; was the B button pressed?
bit BIT_B_BUTTON, a
ld b, 2
jr nz, .buttonBPressed
ld a, [wCurrentMenuItem]
@ -288,10 +288,10 @@ HandlePokedexListMenu:
call Delay3
call GBPalNormal
call HandleMenuInput
bit 1, a ; was the B button pressed?
bit BIT_B_BUTTON, a
jp nz, .buttonBPressed
.checkIfUpPressed
bit 6, a ; was Up pressed?
bit BIT_D_UP, a
jr z, .checkIfDownPressed
.upPressed ; scroll up one row
ld a, [wListScrollOffset]
@ -301,7 +301,7 @@ HandlePokedexListMenu:
ld [wListScrollOffset], a
jp .loop
.checkIfDownPressed
bit 7, a ; was Down pressed?
bit BIT_D_DOWN, a
jr z, .checkIfRightPressed
.downPressed ; scroll down one row
ld a, [wDexMaxSeenMon]
@ -316,7 +316,7 @@ HandlePokedexListMenu:
ld [wListScrollOffset], a
jp .loop
.checkIfRightPressed
bit 4, a ; was Right pressed?
bit BIT_D_RIGHT, a
jr z, .checkIfLeftPressed
.rightPressed ; scroll down 7 rows
ld a, [wDexMaxSeenMon]
@ -334,7 +334,7 @@ HandlePokedexListMenu:
ld [wListScrollOffset], a
jp .loop
.checkIfLeftPressed ; scroll up 7 rows
bit 5, a ; was Left pressed?
bit BIT_D_LEFT, a
jr z, .buttonAPressed
.leftPressed
ld a, [wListScrollOffset]

View file

@ -37,20 +37,23 @@ LoadSAV0:
ld a, $1
ld [MBC1SRamBankingMode], a
ld [MBC1SRamBank], a
ld hl, sPlayerName ; hero name located in SRAM
ld bc, sMainDataCheckSum - sPlayerName ; but here checks the full SAV
; This vc_hook does not have to be in any particular location.
; It is defined here because it refers to the same labels as the two lines below.
vc_hook Unknown_save_limit
ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld c, a
ld a, [sMainDataCheckSum] ; SAV's checksum
ld a, [sMainDataCheckSum]
cp c
jp z, .checkSumsMatched
; If the computed checksum didn't match the saved on, try again.
ld hl, sPlayerName
ld bc, sMainDataCheckSum - sPlayerName
ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld c, a
ld a, [sMainDataCheckSum] ; SAV's checksum
ld a, [sMainDataCheckSum]
cp c
jp nz, SAVBadCheckSum
@ -84,11 +87,11 @@ LoadSAV1:
ld a, $1
ld [MBC1SRamBankingMode], a
ld [MBC1SRamBank], a
ld hl, sPlayerName ; hero name located in SRAM
ld bc, sMainDataCheckSum - sPlayerName ; but here checks the full SAV
ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld c, a
ld a, [sMainDataCheckSum] ; SAV's checksum
ld a, [sMainDataCheckSum]
cp c
jr nz, SAVBadCheckSum
ld hl, sCurBoxData
@ -104,11 +107,11 @@ LoadSAV2:
ld a, $1
ld [MBC1SRamBankingMode], a
ld [MBC1SRamBank], a
ld hl, sPlayerName ; hero name located in SRAM
ld bc, sMainDataCheckSum - sPlayerName ; but here checks the full SAV
ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld c, a
ld a, [sMainDataCheckSum] ; SAV's checksum
ld a, [sMainDataCheckSum]
cp c
jp nz, SAVBadCheckSum
ld hl, sPartyData
@ -219,8 +222,8 @@ SaveSAVtoSRAM0:
call CopyData
ldh a, [hTileAnimations]
ld [sTileAnimations], a
ld hl, sPlayerName
ld bc, sMainDataCheckSum - sPlayerName
ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld [sMainDataCheckSum], a
xor a
@ -239,8 +242,8 @@ SaveSAVtoSRAM1:
ld de, sCurBoxData
ld bc, wBoxDataEnd - wBoxDataStart
call CopyData
ld hl, sPlayerName
ld bc, sMainDataCheckSum - sPlayerName
ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld [sMainDataCheckSum], a
xor a
@ -262,8 +265,8 @@ SaveSAVtoSRAM2:
ld de, sMainData
ld bc, wPokedexSeenEnd - wPokedexOwned
call CopyData
ld hl, sPlayerName
ld bc, sMainDataCheckSum - sPlayerName
ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld [sMainDataCheckSum], a
xor a
@ -356,7 +359,7 @@ ChangeBox::
call HandleMenuInput
ld hl, hUILayoutFlags
res 1, [hl]
bit 1, a ; pressed b
bit BIT_B_BUTTON, a
ret nz
call GetBoxSRAMLocation
ld e, l
@ -580,7 +583,7 @@ GetMonCountsForAllBoxes:
ld c, a
ld b, 0
add hl, bc
ld a, [wNumInBox]
ld a, [wBoxCount]
ld [hl], a
ret
@ -612,8 +615,8 @@ SAVCheckRandomID:
ld a, [sPlayerName]
and a
jr z, .next
ld hl, sPlayerName
ld bc, sMainDataCheckSum - sPlayerName
ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call SAVCheckSum
ld c, a
ld a, [sMainDataCheckSum]

View file

@ -65,7 +65,7 @@ StartMenu_Pokemon::
push af
call LoadScreenTilesFromBuffer1 ; restore saved screen
pop af
bit 1, a ; was the B button pressed?
bit BIT_B_BUTTON, a
jp nz, .loop
; if the B button wasn't pressed
ld a, [wMaxMenuItem]
@ -360,14 +360,14 @@ StartMenu_Item::
ld [hl], a ; old menu item id
call HandleMenuInput
call PlaceUnfilledArrowMenuCursor
bit 1, a ; was the B button pressed?
bit BIT_B_BUTTON, a
jr z, .useOrTossItem
jp ItemMenuLoop
.useOrTossItem ; if the player made the choice to use or toss the item
ld a, [wcf91]
ld [wd11e], a
call GetItemName
call CopyStringToCF4B ; copy name to wcf4b
call CopyToStringBuffer
ld a, [wcf91]
cp BICYCLE
jr nz, .notBicycle2
@ -677,7 +677,7 @@ SwitchPartyMon_ClearGfx:
dec c
jr nz, .clearMonBGLoop
pop af
ld hl, wOAMBuffer
ld hl, wShadowOAM
ld bc, $10
call AddNTimes
ld de, $4

View file

@ -174,9 +174,9 @@ DoBuySellQuitMenu:
ld [wd730], a
call HandleMenuInput
call PlaceUnfilledArrowMenuCursor
bit 0, a ; was A pressed?
bit BIT_A_BUTTON, a
jr nz, .pressedA
bit 1, a ; was B pressed? (always true since only A/B are watched)
bit BIT_B_BUTTON, a ; always true since only A/B are watched
jr z, .pressedA
ld a, CANCELLED_MENU
ld [wMenuExitMethod], a
@ -296,8 +296,8 @@ DisplayTwoOptionMenu:
pop hl
.noYesMenuInputLoop
call HandleMenuInput
bit 1, a ; A button pressed?
jr nz, .noYesMenuInputLoop ; try again if A was not pressed
bit BIT_B_BUTTON, a
jr nz, .noYesMenuInputLoop ; try again if B was not pressed
pop af
pop hl
ld [wFlags_0xcd60], a
@ -309,7 +309,7 @@ DisplayTwoOptionMenu:
ld [wTwoOptionMenuID], a
call HandleMenuInput
pop hl
bit 1, a ; A button pressed?
bit BIT_B_BUTTON, a
jr nz, .choseSecondMenuItem ; automatically choose the second option if B is pressed
.pressedAButton
ld a, [wCurrentMenuItem]