mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-06 15:45:24 +13:00
Merge branch 'master' of https://github.com/pret/pokered
This commit is contained in:
commit
3f691fcb21
970 changed files with 15106 additions and 11361 deletions
|
|
@ -1,7 +1,7 @@
|
|||
ClearSprites::
|
||||
xor a
|
||||
ld hl, wOAMBuffer
|
||||
ld b, wOAMBufferEnd - wOAMBuffer
|
||||
ld hl, wShadowOAM
|
||||
ld b, wShadowOAMEnd - wShadowOAM
|
||||
.loop
|
||||
ld [hli], a
|
||||
dec b
|
||||
|
|
@ -10,7 +10,7 @@ ClearSprites::
|
|||
|
||||
HideSprites::
|
||||
ld a, 160
|
||||
ld hl, wOAMBuffer
|
||||
ld hl, wShadowOAM
|
||||
ld de, 4
|
||||
ld b, 40
|
||||
.loop
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
; copies a string from [de] to [wcf4b]
|
||||
CopyStringToCF4B::
|
||||
ld hl, wcf4b
|
||||
; copies a string from de to wStringBuffer
|
||||
CopyToStringBuffer::
|
||||
ld hl, wStringBuffer
|
||||
; fall through
|
||||
|
||||
; copies a string from [de] to [hl]
|
||||
; copies a string from de to hl
|
||||
CopyString::
|
||||
ld a, [de]
|
||||
inc de
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
GiveItem::
|
||||
; Give player quantity c of item b,
|
||||
; and copy the item's name to wcf4b.
|
||||
; and copy the item's name to wStringBuffer.
|
||||
; Return carry on success.
|
||||
ld a, b
|
||||
ld [wd11e], a
|
||||
|
|
@ -11,7 +11,7 @@ GiveItem::
|
|||
call AddItemToInventory
|
||||
ret nc
|
||||
call GetItemName
|
||||
call CopyStringToCF4B
|
||||
call CopyToStringBuffer
|
||||
scf
|
||||
ret
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor::
|
|||
ldh a, [hLoadedROMBank]
|
||||
push af
|
||||
ldh a, [hJoyHeld]
|
||||
bit 0, a ; A button
|
||||
bit BIT_A_BUTTON, a
|
||||
jr z, .nothingFound
|
||||
; A button is pressed
|
||||
ld a, BANK(CheckForHiddenObject)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ SoftReset::
|
|||
Init::
|
||||
; Program init.
|
||||
|
||||
rLCDC_DEFAULT EQU %11100011
|
||||
DEF rLCDC_DEFAULT EQU %11100011
|
||||
; * LCD enabled
|
||||
; * Window tile map at $9C00
|
||||
; * Window display enabled
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ DisableLCD::
|
|||
jr nz, .wait
|
||||
|
||||
ldh a, [rLCDC]
|
||||
and $ff ^ rLCDC_ENABLE_MASK
|
||||
and ~rLCDC_ENABLE_MASK
|
||||
ldh [rLCDC], a
|
||||
ld a, b
|
||||
ldh [rIE], a
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ DisplayListMenuIDLoop::
|
|||
push af
|
||||
call PlaceMenuCursor
|
||||
pop af
|
||||
bit 0, a ; was the A button pressed?
|
||||
bit BIT_A_BUTTON, a
|
||||
jp z, .checkOtherKeys
|
||||
.buttonAPressed
|
||||
ld a, [wCurrentMenuItem]
|
||||
|
|
@ -157,7 +157,7 @@ DisplayListMenuIDLoop::
|
|||
call GetPartyMonName
|
||||
.storeChosenEntry ; store the menu entry that the player chose and return
|
||||
ld de, wcd6d
|
||||
call CopyStringToCF4B ; copy name to wcf4b
|
||||
call CopyToStringBuffer
|
||||
ld a, CHOSE_MENU_ITEM
|
||||
ld [wMenuExitMethod], a
|
||||
ld a, [wCurrentMenuItem]
|
||||
|
|
@ -168,12 +168,12 @@ DisplayListMenuIDLoop::
|
|||
res 6, [hl] ; turn on letter printing delay
|
||||
jp BankswitchBack
|
||||
.checkOtherKeys ; check B, SELECT, Up, and Down keys
|
||||
bit 1, a ; was the B button pressed?
|
||||
bit BIT_B_BUTTON, a
|
||||
jp nz, ExitListMenu ; if so, exit the menu
|
||||
bit 2, a ; was the select button pressed?
|
||||
bit BIT_SELECT, a
|
||||
jp nz, HandleItemListSwapping ; if so, allow the player to swap menu entries
|
||||
ld b, a
|
||||
bit 7, b ; was Down pressed?
|
||||
bit BIT_D_DOWN, b
|
||||
ld hl, wListScrollOffset
|
||||
jr z, .upPressed
|
||||
.downPressed
|
||||
|
|
@ -220,13 +220,13 @@ DisplayChooseQuantityMenu::
|
|||
.waitForKeyPressLoop
|
||||
call JoypadLowSensitivity
|
||||
ldh a, [hJoyPressed] ; newly pressed buttons
|
||||
bit 0, a ; was the A button pressed?
|
||||
bit BIT_A_BUTTON, a
|
||||
jp nz, .buttonAPressed
|
||||
bit 1, a ; was the B button pressed?
|
||||
bit BIT_B_BUTTON, a
|
||||
jp nz, .buttonBPressed
|
||||
bit 6, a ; was Up pressed?
|
||||
bit BIT_D_UP, a
|
||||
jr nz, .incrementQuantity
|
||||
bit 7, a ; was Down pressed?
|
||||
bit BIT_D_DOWN, a
|
||||
jr nz, .decrementQuantity
|
||||
jr .waitForKeyPressLoop
|
||||
.incrementQuantity
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@ GetName::
|
|||
|
||||
; TM names are separate from item names.
|
||||
; BUG: This applies to all names instead of just items.
|
||||
ASSERT NUM_POKEMON_INDEXES < HM01, \
|
||||
"A bug in GetName will get TM/HM names for Pokémon above ${x:HM01}."
|
||||
ASSERT NUM_ATTACKS < HM01, \
|
||||
"A bug in GetName will get TM/HM names for moves above ${x:HM01}."
|
||||
ASSERT NUM_TRAINERS < HM01, \
|
||||
"A bug in GetName will get TM/HM names for trainers above ${x:HM01}."
|
||||
cp HM01
|
||||
jp nc, GetMachineName
|
||||
|
||||
|
|
@ -28,10 +34,10 @@ GetName::
|
|||
push hl
|
||||
push bc
|
||||
push de
|
||||
ld a, [wNameListType] ;List3759_entrySelector
|
||||
ld a, [wNameListType]
|
||||
dec a
|
||||
jr nz, .otherEntries
|
||||
;1 = MON_NAMES
|
||||
; 1 = MONSTER_NAME
|
||||
call GetMonName
|
||||
ld hl, NAME_LENGTH
|
||||
add hl, de
|
||||
|
|
@ -39,11 +45,11 @@ GetName::
|
|||
ld d, h
|
||||
jr .gotPtr
|
||||
.otherEntries
|
||||
;2-7 = OTHER ENTRIES
|
||||
; 2-7 = other names
|
||||
ld a, [wPredefBank]
|
||||
ldh [hLoadedROMBank], a
|
||||
ld [MBC1RomBank], a
|
||||
ld a, [wNameListType] ;VariousNames' entryID
|
||||
ld a, [wNameListType]
|
||||
dec a
|
||||
add a
|
||||
ld d, 0
|
||||
|
|
@ -62,8 +68,8 @@ GetName::
|
|||
ldh a, [hSwapTemp + 1]
|
||||
ld l, a
|
||||
ld a, [wd0b5]
|
||||
ld b, a
|
||||
ld c, 0
|
||||
ld b, a ; wanted entry
|
||||
ld c, 0 ; entry counter
|
||||
.nextName
|
||||
ld d, h
|
||||
ld e, l
|
||||
|
|
@ -71,14 +77,14 @@ GetName::
|
|||
ld a, [hli]
|
||||
cp "@"
|
||||
jr nz, .nextChar
|
||||
inc c ;entry counter
|
||||
ld a, b ;wanted entry
|
||||
inc c
|
||||
ld a, b
|
||||
cp c
|
||||
jr nz, .nextName
|
||||
ld h, d
|
||||
ld l, e
|
||||
ld de, wcd6d
|
||||
ld bc, $14
|
||||
ld bc, NAME_BUFFER_LENGTH
|
||||
call CopyData
|
||||
.gotPtr
|
||||
ld a, e
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
; c = X coordinate of upper left corner of sprite
|
||||
; de = base address of 4 tile number and attribute pairs
|
||||
WriteOAMBlock::
|
||||
ld h, HIGH(wOAMBuffer)
|
||||
ld h, HIGH(wShadowOAM)
|
||||
swap a ; multiply by 16
|
||||
ld l, a
|
||||
call .writeOneEntry ; upper left
|
||||
|
|
|
|||
|
|
@ -72,14 +72,14 @@ OverworldLoopLessDelay::
|
|||
.notSimulating
|
||||
ldh a, [hJoyPressed]
|
||||
.checkIfStartIsPressed
|
||||
bit 3, a ; start button
|
||||
bit BIT_START, a
|
||||
jr z, .startButtonNotPressed
|
||||
; if START is pressed
|
||||
xor a ; TEXT_START_MENU
|
||||
ldh [hSpriteIndexOrTextID], a
|
||||
jp .displayDialogue
|
||||
.startButtonNotPressed
|
||||
bit 0, a ; A button
|
||||
bit BIT_A_BUTTON, a
|
||||
jp z, .checkIfDownButtonIsPressed
|
||||
; if A is pressed
|
||||
ld a, [wd730]
|
||||
|
|
@ -146,7 +146,7 @@ OverworldLoopLessDelay::
|
|||
|
||||
.checkIfDownButtonIsPressed
|
||||
ldh a, [hJoyHeld] ; current joypad state
|
||||
bit 7, a ; down button
|
||||
bit BIT_D_DOWN, a
|
||||
jr z, .checkIfUpButtonIsPressed
|
||||
ld a, 1
|
||||
ld [wSpritePlayerStateData1YStepVector], a
|
||||
|
|
@ -154,7 +154,7 @@ OverworldLoopLessDelay::
|
|||
jr .handleDirectionButtonPress
|
||||
|
||||
.checkIfUpButtonIsPressed
|
||||
bit 6, a ; up button
|
||||
bit BIT_D_UP, a
|
||||
jr z, .checkIfLeftButtonIsPressed
|
||||
ld a, -1
|
||||
ld [wSpritePlayerStateData1YStepVector], a
|
||||
|
|
@ -162,7 +162,7 @@ OverworldLoopLessDelay::
|
|||
jr .handleDirectionButtonPress
|
||||
|
||||
.checkIfLeftButtonIsPressed
|
||||
bit 5, a ; left button
|
||||
bit BIT_D_LEFT, a
|
||||
jr z, .checkIfRightButtonIsPressed
|
||||
ld a, -1
|
||||
ld [wSpritePlayerStateData1XStepVector], a
|
||||
|
|
@ -170,7 +170,7 @@ OverworldLoopLessDelay::
|
|||
jr .handleDirectionButtonPress
|
||||
|
||||
.checkIfRightButtonIsPressed
|
||||
bit 4, a ; right button
|
||||
bit BIT_D_RIGHT, a
|
||||
jr z, .noDirectionButtonsPressed
|
||||
ld a, 1
|
||||
ld [wSpritePlayerStateData1XStepVector], a
|
||||
|
|
@ -550,7 +550,7 @@ CheckMapConnections::
|
|||
ld a, [wXCoord]
|
||||
cp $ff
|
||||
jr nz, .checkEastMap
|
||||
ld a, [wMapConn3Ptr]
|
||||
ld a, [wWestConnectedMap]
|
||||
ld [wCurMap], a
|
||||
ld a, [wWestConnectedMapXAlignment] ; new X coordinate upon entering west map
|
||||
ld [wXCoord], a
|
||||
|
|
@ -587,7 +587,7 @@ CheckMapConnections::
|
|||
ld a, [wCurrentMapWidth2] ; map width
|
||||
cp b
|
||||
jr nz, .checkNorthMap
|
||||
ld a, [wMapConn4Ptr]
|
||||
ld a, [wEastConnectedMap]
|
||||
ld [wCurMap], a
|
||||
ld a, [wEastConnectedMapXAlignment] ; new X coordinate upon entering east map
|
||||
ld [wXCoord], a
|
||||
|
|
@ -623,7 +623,7 @@ CheckMapConnections::
|
|||
ld a, [wYCoord]
|
||||
cp $ff
|
||||
jr nz, .checkSouthMap
|
||||
ld a, [wMapConn1Ptr]
|
||||
ld a, [wNorthConnectedMap]
|
||||
ld [wCurMap], a
|
||||
ld a, [wNorthConnectedMapYAlignment] ; new Y coordinate upon entering north map
|
||||
ld [wYCoord], a
|
||||
|
|
@ -651,7 +651,7 @@ CheckMapConnections::
|
|||
ld a, [wCurrentMapHeight2]
|
||||
cp b
|
||||
jr nz, .didNotEnterConnectedMap
|
||||
ld a, [wMapConn2Ptr]
|
||||
ld a, [wSouthConnectedMap]
|
||||
ld [wCurMap], a
|
||||
ld a, [wSouthConnectedMapYAlignment] ; new Y coordinate upon entering south map
|
||||
ld [wYCoord], a
|
||||
|
|
@ -936,7 +936,7 @@ LoadTileBlockMap::
|
|||
dec b
|
||||
jr nz, .rowLoop
|
||||
.northConnection
|
||||
ld a, [wMapConn1Ptr]
|
||||
ld a, [wNorthConnectedMap]
|
||||
cp $ff
|
||||
jr z, .southConnection
|
||||
call SwitchToMapRomBank
|
||||
|
|
@ -948,13 +948,13 @@ LoadTileBlockMap::
|
|||
ld e, a
|
||||
ld a, [wNorthConnectionStripDest + 1]
|
||||
ld d, a
|
||||
ld a, [wNorthConnectionStripWidth]
|
||||
ld a, [wNorthConnectionStripLength]
|
||||
ldh [hNorthSouthConnectionStripWidth], a
|
||||
ld a, [wNorthConnectedMapWidth]
|
||||
ldh [hNorthSouthConnectedMapWidth], a
|
||||
call LoadNorthSouthConnectionsTileMap
|
||||
.southConnection
|
||||
ld a, [wMapConn2Ptr]
|
||||
ld a, [wSouthConnectedMap]
|
||||
cp $ff
|
||||
jr z, .westConnection
|
||||
call SwitchToMapRomBank
|
||||
|
|
@ -966,13 +966,13 @@ LoadTileBlockMap::
|
|||
ld e, a
|
||||
ld a, [wSouthConnectionStripDest + 1]
|
||||
ld d, a
|
||||
ld a, [wSouthConnectionStripWidth]
|
||||
ld a, [wSouthConnectionStripLength]
|
||||
ldh [hNorthSouthConnectionStripWidth], a
|
||||
ld a, [wSouthConnectedMapWidth]
|
||||
ldh [hNorthSouthConnectedMapWidth], a
|
||||
call LoadNorthSouthConnectionsTileMap
|
||||
.westConnection
|
||||
ld a, [wMapConn3Ptr]
|
||||
ld a, [wWestConnectedMap]
|
||||
cp $ff
|
||||
jr z, .eastConnection
|
||||
call SwitchToMapRomBank
|
||||
|
|
@ -984,13 +984,13 @@ LoadTileBlockMap::
|
|||
ld e, a
|
||||
ld a, [wWestConnectionStripDest + 1]
|
||||
ld d, a
|
||||
ld a, [wWestConnectionStripHeight]
|
||||
ld a, [wWestConnectionStripLength]
|
||||
ld b, a
|
||||
ld a, [wWestConnectedMapWidth]
|
||||
ldh [hEastWestConnectedMapWidth], a
|
||||
call LoadEastWestConnectionsTileMap
|
||||
.eastConnection
|
||||
ld a, [wMapConn4Ptr]
|
||||
ld a, [wEastConnectedMap]
|
||||
cp $ff
|
||||
jr z, .done
|
||||
call SwitchToMapRomBank
|
||||
|
|
@ -1002,7 +1002,7 @@ LoadTileBlockMap::
|
|||
ld e, a
|
||||
ld a, [wEastConnectionStripDest + 1]
|
||||
ld d, a
|
||||
ld a, [wEastConnectionStripHeight]
|
||||
ld a, [wEastConnectionStripLength]
|
||||
ld b, a
|
||||
ld a, [wEastConnectedMapWidth]
|
||||
ldh [hEastWestConnectedMapWidth], a
|
||||
|
|
@ -1244,7 +1244,7 @@ CollisionCheckOnLand::
|
|||
jr nc, .noCollision
|
||||
.collision
|
||||
|
||||
; ld a, [wChannelSoundIDs + Ch5]
|
||||
; ld a, [wChannelSoundIDs + CHAN5]
|
||||
; cp SFX_COLLISION ; check if collision sound is already playing
|
||||
; jr z, .setCarry
|
||||
|
||||
|
|
@ -1932,7 +1932,7 @@ CollisionCheckOnWater::
|
|||
jr .loop
|
||||
.collision
|
||||
|
||||
; ld a, [wChannelSoundIDs + Ch5]
|
||||
; ld a, [wChannelSoundIDs + CHAN5]
|
||||
; cp SFX_COLLISION ; check if collision sound is already playing
|
||||
; jr z, .setCarry
|
||||
|
||||
|
|
@ -2059,32 +2059,32 @@ LoadMapHeader::
|
|||
jr nz, .copyFixedHeaderLoop
|
||||
; initialize all the connected maps to disabled at first, before loading the actual values
|
||||
ld a, $ff
|
||||
ld [wMapConn1Ptr], a
|
||||
ld [wMapConn2Ptr], a
|
||||
ld [wMapConn3Ptr], a
|
||||
ld [wMapConn4Ptr], a
|
||||
ld [wNorthConnectedMap], a
|
||||
ld [wSouthConnectedMap], a
|
||||
ld [wWestConnectedMap], a
|
||||
ld [wEastConnectedMap], a
|
||||
; copy connection data (if any) to WRAM
|
||||
ld a, [wMapConnections]
|
||||
ld b, a
|
||||
.checkNorth
|
||||
bit 3, b
|
||||
jr z, .checkSouth
|
||||
ld de, wMapConn1Ptr
|
||||
ld de, wNorthConnectionHeader
|
||||
call CopyMapConnectionHeader
|
||||
.checkSouth
|
||||
bit 2, b
|
||||
jr z, .checkWest
|
||||
ld de, wMapConn2Ptr
|
||||
ld de, wSouthConnectionHeader
|
||||
call CopyMapConnectionHeader
|
||||
.checkWest
|
||||
bit 1, b
|
||||
jr z, .checkEast
|
||||
ld de, wMapConn3Ptr
|
||||
ld de, wWestConnectionHeader
|
||||
call CopyMapConnectionHeader
|
||||
.checkEast
|
||||
bit 0, b
|
||||
jr z, .getObjectDataPointer
|
||||
ld de, wMapConn4Ptr
|
||||
ld de, wEastConnectionHeader
|
||||
call CopyMapConnectionHeader
|
||||
.getObjectDataPointer
|
||||
ld a, [hli]
|
||||
|
|
@ -2107,7 +2107,7 @@ LoadMapHeader::
|
|||
ld c, a
|
||||
ld de, wWarpEntries
|
||||
.warpLoop ; one warp per loop iteration
|
||||
ld b, $04
|
||||
ld b, 4
|
||||
.warpInnerLoop
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
|
|
|
|||
|
|
@ -9,14 +9,14 @@ UncompressMonSprite::
|
|||
ld a, [hl]
|
||||
ld [wSpriteInputPtr+1], a
|
||||
; define (by index number) the bank that a pokemon's image is in
|
||||
; index = Mew, bank 1
|
||||
; index = Kabutops fossil, bank $B
|
||||
; index < $1F, bank 9
|
||||
; $1F ≤ index < $4A, bank $A
|
||||
; $4A ≤ index < $74, bank $B
|
||||
; $74 ≤ index < $99, bank $C
|
||||
; $99 ≤ index, bank $D
|
||||
ld a, [wcf91] ; XXX name for this ram location
|
||||
; index = MEW: bank $1
|
||||
; index = FOSSIL_KABUTOPS: bank $B
|
||||
; index < $1F: bank $9 ("Pics 1")
|
||||
; $1F ≤ index < $4A: bank $A ("Pics 2")
|
||||
; $4A ≤ index < $74: bank $B ("Pics 3")
|
||||
; $74 ≤ index < $99: bank $C ("Pics 4")
|
||||
; $99 ≤ index: bank $D ("Pics 5")
|
||||
ld a, [wcf91]
|
||||
ld b, a
|
||||
cp MEW
|
||||
ld a, BANK(MewPicFront)
|
||||
|
|
@ -27,21 +27,21 @@ UncompressMonSprite::
|
|||
jr z, .GotBank
|
||||
ld a, b
|
||||
cp TANGELA + 1
|
||||
ld a, BANK(TangelaPicFront)
|
||||
ld a, BANK("Pics 1")
|
||||
jr c, .GotBank
|
||||
ld a, b
|
||||
cp MOLTRES + 1
|
||||
ld a, BANK(MoltresPicFront)
|
||||
ld a, BANK("Pics 2")
|
||||
jr c, .GotBank
|
||||
ld a, b
|
||||
cp BEEDRILL + 2
|
||||
ld a, BANK(BeedrillPicFront)
|
||||
ld a, BANK("Pics 3")
|
||||
jr c, .GotBank
|
||||
ld a, b
|
||||
cp STARMIE + 1
|
||||
ld a, BANK(StarmiePicFront)
|
||||
ld a, BANK("Pics 4")
|
||||
jr c, .GotBank
|
||||
ld a, BANK(VictreebelPicFront)
|
||||
ld a, BANK("Pics 5")
|
||||
.GotBank
|
||||
jp UncompressSpriteData
|
||||
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ HandlePartyMenuInput::
|
|||
scf
|
||||
ret
|
||||
.swappingPokemon
|
||||
bit 1, b ; was the B button pressed?
|
||||
bit BIT_B_BUTTON, b
|
||||
jr z, .handleSwap ; if not, handle swapping the pokemon
|
||||
.cancelSwap ; if the B button was pressed
|
||||
farcall ErasePartyMenuCursors
|
||||
|
|
|
|||
|
|
@ -35,16 +35,16 @@ Predef::
|
|||
GetPredefRegisters::
|
||||
; Restore the contents of register pairs
|
||||
; when GetPredefPointer was called.
|
||||
ld a, [wPredefRegisters + 0]
|
||||
ld a, [wPredefHL]
|
||||
ld h, a
|
||||
ld a, [wPredefRegisters + 1]
|
||||
ld a, [wPredefHL + 1]
|
||||
ld l, a
|
||||
ld a, [wPredefRegisters + 2]
|
||||
ld a, [wPredefDE]
|
||||
ld d, a
|
||||
ld a, [wPredefRegisters + 3]
|
||||
ld a, [wPredefDE + 1]
|
||||
ld e, a
|
||||
ld a, [wPredefRegisters + 4]
|
||||
ld a, [wPredefBC]
|
||||
ld b, a
|
||||
ld a, [wPredefRegisters + 5]
|
||||
ld a, [wPredefBC + 1]
|
||||
ld c, a
|
||||
ret
|
||||
|
|
|
|||
|
|
@ -59,20 +59,20 @@ PrintNumber::
|
|||
cp 6
|
||||
jr z, .hundred_thousands
|
||||
|
||||
print_digit: MACRO
|
||||
MACRO print_digit
|
||||
|
||||
IF (\1) / $10000
|
||||
ld a, \1 / $10000 % $100
|
||||
ELSE
|
||||
xor a
|
||||
ENDC
|
||||
IF (\1) / $10000
|
||||
ld a, \1 / $10000 % $100
|
||||
ELSE
|
||||
xor a
|
||||
ENDC
|
||||
ldh [hPowerOf10 + 0], a
|
||||
|
||||
IF (\1) / $100
|
||||
ld a, \1 / $100 % $100
|
||||
ELSE
|
||||
xor a
|
||||
ENDC
|
||||
IF (\1) / $100
|
||||
ld a, \1 / $100 % $100
|
||||
ELSE
|
||||
xor a
|
||||
ENDC
|
||||
ldh [hPowerOf10 + 1], a
|
||||
|
||||
ld a, \1 / $1 % $100
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ PrintLetterDelay::
|
|||
call Joypad
|
||||
ldh a, [hJoyHeld]
|
||||
.checkAButton
|
||||
bit 0, a ; is the A button pressed?
|
||||
bit BIT_A_BUTTON, a
|
||||
jr z, .checkBButton
|
||||
jr .endWait
|
||||
.checkBButton
|
||||
bit 1, a ; is the B button pressed?
|
||||
bit BIT_B_BUTTON, a
|
||||
jr z, .buttonsNotPressed
|
||||
.endWait
|
||||
call DelayFrame
|
||||
|
|
|
|||
|
|
@ -230,6 +230,7 @@ Serial_PrintWaitingTextAndSyncAndExchangeNybble::
|
|||
jp LoadScreenTilesFromBuffer1
|
||||
|
||||
Serial_SyncAndExchangeNybble::
|
||||
vc_hook Wireless_WaitLinkTransfer
|
||||
ld a, $ff
|
||||
ld [wSerialExchangeNybbleReceiveData], a
|
||||
.loop1
|
||||
|
|
@ -253,13 +254,25 @@ Serial_SyncAndExchangeNybble::
|
|||
ld a, [wSerialExchangeNybbleReceiveData]
|
||||
inc a
|
||||
jr z, .loop1
|
||||
vc_patch Wireless_net_delay_3
|
||||
IF DEF(_RED_VC) || DEF(_BLUE_VC)
|
||||
ld b, 26
|
||||
ELSE
|
||||
ld b, 10
|
||||
ENDC
|
||||
vc_patch_end
|
||||
.loop2
|
||||
call DelayFrame
|
||||
call Serial_ExchangeNybble
|
||||
dec b
|
||||
jr nz, .loop2
|
||||
vc_patch Wireless_net_delay_4
|
||||
IF DEF(_RED_VC) || DEF(_BLUE_VC)
|
||||
ld b, 26
|
||||
ELSE
|
||||
ld b, 10
|
||||
ENDC
|
||||
vc_patch_end
|
||||
.loop3
|
||||
call DelayFrame
|
||||
call Serial_SendZeroByte
|
||||
|
|
@ -267,6 +280,7 @@ Serial_SyncAndExchangeNybble::
|
|||
jr nz, .loop3
|
||||
ld a, [wSerialExchangeNybbleReceiveData]
|
||||
ld [wSerialSyncAndExchangeNybbleReceiveData], a
|
||||
vc_hook Wireless_WaitLinkTransfer_ret
|
||||
ret
|
||||
|
||||
Serial_ExchangeNybble::
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ RedisplayStartMenu::
|
|||
call HandleMenuInput
|
||||
ld b, a
|
||||
.checkIfUpPressed
|
||||
bit 6, a ; was Up pressed?
|
||||
bit BIT_D_UP, a
|
||||
jr z, .checkIfDownPressed
|
||||
ld a, [wCurrentMenuItem] ; menu selection
|
||||
and a
|
||||
|
|
@ -33,7 +33,7 @@ RedisplayStartMenu::
|
|||
call EraseMenuCursor
|
||||
jr .loop
|
||||
.checkIfDownPressed
|
||||
bit 7, a
|
||||
bit BIT_D_DOWN, a
|
||||
jr z, .buttonPressed
|
||||
; if the player pressed tried to go past the bottom item, wrap around to the top
|
||||
CheckEvent EVENT_GOT_POKEDEX
|
||||
|
|
@ -54,7 +54,7 @@ RedisplayStartMenu::
|
|||
ld a, [wCurrentMenuItem]
|
||||
ld [wBattleAndStartSavedMenuItem], a ; save current menu selection
|
||||
ld a, b
|
||||
and %00001010 ; was the Start button or B button pressed?
|
||||
and B_BUTTON | START ; was the Start button or B button pressed?
|
||||
jp nz, CloseStartMenu
|
||||
call SaveScreenTilesToBuffer2 ; copy background from wTileMap to wTileMapBackup2
|
||||
CheckEvent EVENT_GOT_POKEDEX
|
||||
|
|
@ -79,7 +79,7 @@ RedisplayStartMenu::
|
|||
CloseStartMenu::
|
||||
call Joypad
|
||||
ldh a, [hJoyPressed]
|
||||
bit 0, a ; was A button newly pressed?
|
||||
bit BIT_A_BUTTON, a
|
||||
jr nz, CloseStartMenu
|
||||
call LoadTextBoxTilePatterns
|
||||
jp CloseTextDisplay
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ TextIDErrorText:: ; "[hSpriteIndexOrTextID] ERROR."
|
|||
text_far _TextIDErrorText
|
||||
text_end
|
||||
|
||||
print_name: MACRO
|
||||
MACRO print_name
|
||||
push de
|
||||
ld de, \1
|
||||
jr PlaceCommandCharacter
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ DisplayTextID::
|
|||
|
||||
; check first byte of text for special cases
|
||||
|
||||
dict2: MACRO
|
||||
MACRO dict2
|
||||
cp \1
|
||||
jr nz, .not\@
|
||||
\2
|
||||
|
|
@ -98,7 +98,7 @@ AfterDisplayingTextID::
|
|||
HoldTextDisplayOpen::
|
||||
call Joypad
|
||||
ldh a, [hJoyHeld]
|
||||
bit 0, a ; is the A button being pressed?
|
||||
bit BIT_A_BUTTON, a
|
||||
jr nz, HoldTextDisplayOpen
|
||||
|
||||
CloseTextDisplay::
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ DelayFrame::
|
|||
; Wait for the next vblank interrupt.
|
||||
; As a bonus, this saves battery.
|
||||
|
||||
NOT_VBLANKED EQU 1
|
||||
DEF NOT_VBLANKED EQU 1
|
||||
|
||||
ld a, NOT_VBLANKED
|
||||
ldh [hVBlankOccurred], a
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ ClearBgMap::
|
|||
jr .next
|
||||
ld a, l
|
||||
.next
|
||||
ld de, $400 ; size of VRAM background map
|
||||
ld de, BG_MAP_WIDTH * BG_MAP_HEIGHT
|
||||
ld l, e
|
||||
.loop
|
||||
ld [hli], a
|
||||
|
|
@ -69,7 +69,7 @@ RedrawRowOrColumn::
|
|||
.noCarry
|
||||
; the following 4 lines wrap us from bottom to top if necessary
|
||||
ld a, d
|
||||
and $03
|
||||
and $3
|
||||
or $98
|
||||
ld d, a
|
||||
dec c
|
||||
|
|
@ -127,7 +127,7 @@ AutoBgMapTransfer::
|
|||
ld a, h
|
||||
ldh [hSPTemp], a
|
||||
ld a, l
|
||||
ldh [hSPTemp + 1], a ; save stack pinter
|
||||
ldh [hSPTemp + 1], a ; save stack pointer
|
||||
ldh a, [hAutoBGTransferPortion]
|
||||
and a
|
||||
jr z, .transferTopThird
|
||||
|
|
@ -169,21 +169,19 @@ AutoBgMapTransfer::
|
|||
|
||||
TransferBgRows::
|
||||
; unrolled loop and using pop for speed
|
||||
|
||||
REPT 20 / 2 - 1
|
||||
REPT SCREEN_WIDTH / 2 - 1
|
||||
pop de
|
||||
ld [hl], e
|
||||
inc l
|
||||
ld [hl], d
|
||||
inc l
|
||||
ENDR
|
||||
|
||||
ENDR
|
||||
pop de
|
||||
ld [hl], e
|
||||
inc l
|
||||
ld [hl], d
|
||||
|
||||
ld a, 32 - (20 - 1)
|
||||
ld a, BG_MAP_WIDTH - (SCREEN_WIDTH - 1)
|
||||
add l
|
||||
ld l, a
|
||||
jr nc, .ok
|
||||
|
|
@ -261,7 +259,7 @@ VBlankCopyDouble::
|
|||
ldh [hVBlankCopyDoubleSize], a
|
||||
|
||||
.loop
|
||||
REPT 3
|
||||
REPT LEN_2BPP_TILE / 4 - 1
|
||||
pop de
|
||||
ld [hl], e
|
||||
inc l
|
||||
|
|
@ -271,8 +269,7 @@ VBlankCopyDouble::
|
|||
inc l
|
||||
ld [hl], d
|
||||
inc l
|
||||
ENDR
|
||||
|
||||
ENDR
|
||||
pop de
|
||||
ld [hl], e
|
||||
inc l
|
||||
|
|
@ -339,14 +336,13 @@ VBlankCopy::
|
|||
ldh [hVBlankCopySize], a
|
||||
|
||||
.loop
|
||||
REPT 7
|
||||
REPT LEN_2BPP_TILE / 2 - 1
|
||||
pop de
|
||||
ld [hl], e
|
||||
inc l
|
||||
ld [hl], d
|
||||
inc l
|
||||
ENDR
|
||||
|
||||
ENDR
|
||||
pop de
|
||||
ld [hl], e
|
||||
inc l
|
||||
|
|
@ -381,7 +377,7 @@ UpdateMovingBgTiles::
|
|||
|
||||
ldh a, [hTileAnimations]
|
||||
and a
|
||||
ret z ; no animations if indoors (or if a menu set this to 0)
|
||||
ret z
|
||||
|
||||
ldh a, [hMovingBGTilesCounter1]
|
||||
inc a
|
||||
|
|
@ -420,7 +416,7 @@ UpdateMovingBgTiles::
|
|||
ldh a, [hTileAnimations]
|
||||
rrca
|
||||
ret nc
|
||||
; if in a cave, no flower animations
|
||||
|
||||
xor a
|
||||
ldh [hMovingBGTilesCounter1], a
|
||||
ret
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ HandleMenuInput_::
|
|||
ld [wCheckFor180DegreeTurn], a
|
||||
ldh a, [hJoy5]
|
||||
ld b, a
|
||||
bit 6, a ; pressed Up key?
|
||||
bit BIT_D_UP, a
|
||||
jr z, .checkIfDownPressed
|
||||
.upPressed
|
||||
ld a, [wCurrentMenuItem] ; selected menu item
|
||||
|
|
@ -68,7 +68,7 @@ HandleMenuInput_::
|
|||
ld [wCurrentMenuItem], a ; wrap to the bottom of the menu
|
||||
jr .checkOtherKeys
|
||||
.checkIfDownPressed
|
||||
bit 7, a
|
||||
bit BIT_D_DOWN, a
|
||||
jr z, .checkOtherKeys
|
||||
.downPressed
|
||||
ld a, [wCurrentMenuItem]
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ YesNoChoice::
|
|||
call InitYesNoTextBoxParameters
|
||||
jr DisplayYesNoChoice
|
||||
|
||||
Func_35f4::
|
||||
TwoOptionMenu:: ; unreferenced
|
||||
ld a, TWO_OPTION_MENU
|
||||
ld [wTextBoxID], a
|
||||
call InitYesNoTextBoxParameters
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue