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
7c01509b6b
75 changed files with 983 additions and 868 deletions
|
|
@ -1,7 +1,7 @@
|
|||
; These routines manage gradual fading
|
||||
; (e.g., entering a doorway)
|
||||
LoadGBPal::
|
||||
ld a, [wMapPalOffset] ;tells if cur.map is dark (requires HM5_FLASH?)
|
||||
ld a, [wMapPalOffset] ;tells if wCurMap is dark (requires HM5_FLASH?)
|
||||
ld b, a
|
||||
ld hl, FadePal4
|
||||
ld a, l
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ OverworldLoopLessDelay::
|
|||
res 3,[hl]
|
||||
jp nz,WarpFound2
|
||||
ld a,[wd732]
|
||||
and a,1 << 4 | 1 << 3 ; fly warp or dungeon warp
|
||||
and 1 << 4 | 1 << 3 ; fly warp or dungeon warp
|
||||
jp nz,HandleFlyWarpOrDungeonWarp
|
||||
ld a,[wCurOpponent]
|
||||
and a
|
||||
|
|
@ -133,7 +133,7 @@ OverworldLoopLessDelay::
|
|||
ld hl,wFlags_0xcd60
|
||||
res 2,[hl]
|
||||
call UpdateSprites
|
||||
ld a,1
|
||||
ld a, 1
|
||||
ld [wCheckFor180DegreeTurn],a
|
||||
ld a,[wPlayerMovingDirection] ; the direction that was pressed last time
|
||||
and a
|
||||
|
|
@ -143,6 +143,7 @@ OverworldLoopLessDelay::
|
|||
xor a
|
||||
ld [wPlayerMovingDirection],a ; zero the direction
|
||||
jp OverworldLoop
|
||||
|
||||
.checkIfDownButtonIsPressed
|
||||
ld a,[hJoyHeld] ; current joypad state
|
||||
bit 7,a ; down button
|
||||
|
|
@ -151,6 +152,7 @@ OverworldLoopLessDelay::
|
|||
ld [wSpriteStateData1 + 3],a ; delta Y
|
||||
ld a,PLAYER_DIR_DOWN
|
||||
jr .handleDirectionButtonPress
|
||||
|
||||
.checkIfUpButtonIsPressed
|
||||
bit 6,a ; up button
|
||||
jr z,.checkIfLeftButtonIsPressed
|
||||
|
|
@ -158,6 +160,7 @@ OverworldLoopLessDelay::
|
|||
ld [wSpriteStateData1 + 3],a ; delta Y
|
||||
ld a,PLAYER_DIR_UP
|
||||
jr .handleDirectionButtonPress
|
||||
|
||||
.checkIfLeftButtonIsPressed
|
||||
bit 5,a ; left button
|
||||
jr z,.checkIfRightButtonIsPressed
|
||||
|
|
@ -165,11 +168,14 @@ OverworldLoopLessDelay::
|
|||
ld [wSpriteStateData1 + 5],a ; delta X
|
||||
ld a,PLAYER_DIR_LEFT
|
||||
jr .handleDirectionButtonPress
|
||||
|
||||
.checkIfRightButtonIsPressed
|
||||
bit 4,a ; right button
|
||||
jr z,.noDirectionButtonsPressed
|
||||
ld a,1 ; PLAYER_DIR_RIGHT
|
||||
ld a, 1
|
||||
ld [wSpriteStateData1 + 5],a ; delta X
|
||||
|
||||
|
||||
.handleDirectionButtonPress
|
||||
ld [wPlayerDirection],a ; new direction
|
||||
ld a,[wd730]
|
||||
|
|
@ -226,12 +232,13 @@ OverworldLoopLessDelay::
|
|||
call NewBattle
|
||||
jp c,.battleOccurred
|
||||
jp OverworldLoop
|
||||
|
||||
.noDirectionChange
|
||||
ld a,[wPlayerDirection] ; current direction
|
||||
ld [wPlayerMovingDirection],a ; save direction
|
||||
call UpdateSprites
|
||||
ld a,[wWalkBikeSurfState]
|
||||
cp a,$02 ; surfing
|
||||
cp $02 ; surfing
|
||||
jr z,.surfing
|
||||
; not surfing
|
||||
call CollisionCheckOnLand
|
||||
|
|
@ -248,20 +255,24 @@ OverworldLoopLessDelay::
|
|||
pop hl
|
||||
jp c,CheckWarpsCollision
|
||||
jp OverworldLoop
|
||||
|
||||
.surfing
|
||||
call CollisionCheckOnWater
|
||||
jp c,OverworldLoop
|
||||
|
||||
.noCollision
|
||||
ld a,$08
|
||||
ld [wWalkCounter],a
|
||||
jr .moveAhead2
|
||||
|
||||
.moveAhead
|
||||
ld a,[wd736]
|
||||
bit 7,a
|
||||
jr z,.noSpinning
|
||||
callba LoadSpinnerArrowTiles ; spin while moving
|
||||
callba LoadSpinnerArrowTiles
|
||||
.noSpinning
|
||||
call UpdateSprites
|
||||
|
||||
.moveAhead2
|
||||
ld hl,wFlags_0xcd60
|
||||
res 2,[hl]
|
||||
|
|
@ -271,7 +282,7 @@ OverworldLoopLessDelay::
|
|||
ld a,[wd736]
|
||||
bit 6,a ; jumping a ledge?
|
||||
jr nz,.normalPlayerSpriteAdvancement
|
||||
call BikeSpeedup ; if riding a bike and not jumping a ledge
|
||||
call DoBikeSpeedup
|
||||
.normalPlayerSpriteAdvancement
|
||||
call AdvancePlayerSprite
|
||||
ld a,[wWalkCounter]
|
||||
|
|
@ -323,14 +334,14 @@ OverworldLoopLessDelay::
|
|||
xor a
|
||||
ld [hJoyHeld],a
|
||||
ld a,[wCurMap]
|
||||
cp a,CINNABAR_GYM
|
||||
cp CINNABAR_GYM
|
||||
jr nz,.notCinnabarGym
|
||||
SetEvent EVENT_2A7
|
||||
.notCinnabarGym
|
||||
ld hl,wd72e
|
||||
set 5,[hl]
|
||||
ld a,[wCurMap]
|
||||
cp a,OAKS_LAB
|
||||
cp OAKS_LAB
|
||||
jp z,.noFaintCheck ; no blacking out if the player lost to the rival in Oak's lab
|
||||
callab AnyPartyAlive
|
||||
ld a,d
|
||||
|
|
@ -363,15 +374,15 @@ NewBattle::
|
|||
ret
|
||||
|
||||
; function to make bikes twice as fast as walking
|
||||
BikeSpeedup::
|
||||
DoBikeSpeedup::
|
||||
ld a,[wNPCMovementScriptPointerTableNum]
|
||||
and a
|
||||
ret nz
|
||||
ld a,[wCurMap]
|
||||
cp a,ROUTE_17 ; Cycling Road
|
||||
cp ROUTE_17 ; Cycling Road
|
||||
jr nz,.goFaster
|
||||
ld a,[hJoyHeld]
|
||||
and a,D_UP | D_LEFT | D_RIGHT
|
||||
and D_UP | D_LEFT | D_RIGHT
|
||||
ret nz
|
||||
.goFaster
|
||||
jp AdvancePlayerSprite
|
||||
|
|
@ -421,7 +432,7 @@ CheckWarpsNoCollisionLoop::
|
|||
pop bc
|
||||
pop de
|
||||
ld a,[hJoyHeld]
|
||||
and a,D_DOWN | D_UP | D_LEFT | D_RIGHT
|
||||
and D_DOWN | D_UP | D_LEFT | D_RIGHT
|
||||
jr z,CheckWarpsNoCollisionRetry2 ; if directional buttons aren't being pressed, do not pass through the warp
|
||||
jr WarpFound1
|
||||
|
||||
|
|
@ -483,7 +494,7 @@ WarpFound2::
|
|||
ld [wUnusedD366],a ; not read
|
||||
ld a,[hWarpDestinationMap]
|
||||
ld [wCurMap],a
|
||||
cp a,ROCK_TUNNEL_1
|
||||
cp ROCK_TUNNEL_1
|
||||
jr nz,.notRockTunnel
|
||||
ld a,$06
|
||||
ld [wMapPalOffset],a
|
||||
|
|
@ -491,10 +502,12 @@ WarpFound2::
|
|||
.notRockTunnel
|
||||
call PlayMapChangeSound
|
||||
jr .done
|
||||
; for maps that can have the 0xFF destination map, which means to return to the outside map; not all these maps are necessarily indoors, though
|
||||
|
||||
; for maps that can have the 0xFF destination map, which means to return to the outside map
|
||||
; not all these maps are necessarily indoors, though
|
||||
.indoorMaps
|
||||
ld a,[hWarpDestinationMap] ; destination map
|
||||
cp a,$ff
|
||||
cp $ff
|
||||
jr z,.goBackOutside
|
||||
; if not going back to the previous map
|
||||
ld [wCurMap],a
|
||||
|
|
@ -535,7 +548,7 @@ ContinueCheckWarpsNoCollisionLoop::
|
|||
CheckMapConnections::
|
||||
.checkWestMap
|
||||
ld a,[wXCoord]
|
||||
cp a,$ff
|
||||
cp $ff
|
||||
jr nz,.checkEastMap
|
||||
ld a,[wMapConn3Ptr]
|
||||
ld [wCurMap],a
|
||||
|
|
@ -555,7 +568,7 @@ CheckMapConnections::
|
|||
jr z,.savePointer1
|
||||
.pointerAdjustmentLoop1
|
||||
ld a,[wWestConnectedMapWidth] ; width of connected map
|
||||
add a,MAP_BORDER * 2
|
||||
add MAP_BORDER * 2
|
||||
ld e,a
|
||||
ld d,0
|
||||
ld b,0
|
||||
|
|
@ -568,6 +581,7 @@ CheckMapConnections::
|
|||
ld a,h
|
||||
ld [wCurrentTileBlockMapViewPointer + 1],a
|
||||
jp .loadNewMap
|
||||
|
||||
.checkEastMap
|
||||
ld b,a
|
||||
ld a,[wCurrentMapWidth2] ; map width
|
||||
|
|
@ -591,7 +605,7 @@ CheckMapConnections::
|
|||
jr z,.savePointer2
|
||||
.pointerAdjustmentLoop2
|
||||
ld a,[wEastConnectedMapWidth]
|
||||
add a,MAP_BORDER * 2
|
||||
add MAP_BORDER * 2
|
||||
ld e,a
|
||||
ld d,0
|
||||
ld b,0
|
||||
|
|
@ -604,9 +618,10 @@ CheckMapConnections::
|
|||
ld a,h
|
||||
ld [wCurrentTileBlockMapViewPointer + 1],a
|
||||
jp .loadNewMap
|
||||
|
||||
.checkNorthMap
|
||||
ld a,[wYCoord]
|
||||
cp a,$ff
|
||||
cp $ff
|
||||
jr nz,.checkSouthMap
|
||||
ld a,[wMapConn1Ptr]
|
||||
ld [wCurMap],a
|
||||
|
|
@ -630,6 +645,7 @@ CheckMapConnections::
|
|||
ld a,h
|
||||
ld [wCurrentTileBlockMapViewPointer + 1],a
|
||||
jp .loadNewMap
|
||||
|
||||
.checkSouthMap
|
||||
ld b,a
|
||||
ld a,[wCurrentMapHeight2]
|
||||
|
|
@ -666,13 +682,14 @@ CheckMapConnections::
|
|||
callba InitMapSprites
|
||||
call LoadTileBlockMap
|
||||
jp OverworldLoopLessDelay
|
||||
|
||||
.didNotEnterConnectedMap
|
||||
jp OverworldLoop
|
||||
|
||||
; function to play a sound when changing maps
|
||||
PlayMapChangeSound::
|
||||
aCoord 8, 8 ; upper left tile of the 4x4 square the player's sprite is standing on
|
||||
cp a,$0b ; door tile in tileset 0
|
||||
cp $0b ; door tile in tileset 0
|
||||
jr nz,.didNotGoThroughDoor
|
||||
ld a,SFX_GO_INSIDE
|
||||
jr .playSound
|
||||
|
|
@ -854,13 +871,13 @@ INCLUDE "data/bike_riding_tilesets.asm"
|
|||
|
||||
; load the tile pattern data of the current tileset into VRAM
|
||||
LoadTilesetTilePatternData::
|
||||
ld a,[wTileSetGFXPtr]
|
||||
ld a,[wTilesetGfxPtr]
|
||||
ld l,a
|
||||
ld a,[wTileSetGFXPtr + 1]
|
||||
ld a,[wTilesetGfxPtr + 1]
|
||||
ld h,a
|
||||
ld de,vTileset
|
||||
ld bc,$600
|
||||
ld a,[wTileSetBank]
|
||||
ld a,[wTilesetBank]
|
||||
jp FarCopyData2
|
||||
|
||||
; this loads the current maps complete tile map (which references blocks, not individual tiles) to C6E8
|
||||
|
|
@ -883,7 +900,7 @@ LoadTileBlockMap::
|
|||
ld hl,wOverworldMap
|
||||
ld a,[wCurMapWidth]
|
||||
ld [hMapWidth],a
|
||||
add a,MAP_BORDER * 2 ; east and west
|
||||
add MAP_BORDER * 2 ; east and west
|
||||
ld [hMapStride],a ; map width + border
|
||||
ld b,0
|
||||
ld c,a
|
||||
|
|
@ -921,7 +938,7 @@ LoadTileBlockMap::
|
|||
jr nz,.rowLoop
|
||||
.northConnection
|
||||
ld a,[wMapConn1Ptr]
|
||||
cp a,$ff
|
||||
cp $ff
|
||||
jr z,.southConnection
|
||||
call SwitchToMapRomBank
|
||||
ld a,[wNorthConnectionStripSrc]
|
||||
|
|
@ -939,7 +956,7 @@ LoadTileBlockMap::
|
|||
call LoadNorthSouthConnectionsTileMap
|
||||
.southConnection
|
||||
ld a,[wMapConn2Ptr]
|
||||
cp a,$ff
|
||||
cp $ff
|
||||
jr z,.westConnection
|
||||
call SwitchToMapRomBank
|
||||
ld a,[wSouthConnectionStripSrc]
|
||||
|
|
@ -957,7 +974,7 @@ LoadTileBlockMap::
|
|||
call LoadNorthSouthConnectionsTileMap
|
||||
.westConnection
|
||||
ld a,[wMapConn3Ptr]
|
||||
cp a,$ff
|
||||
cp $ff
|
||||
jr z,.eastConnection
|
||||
call SwitchToMapRomBank
|
||||
ld a,[wWestConnectionStripSrc]
|
||||
|
|
@ -975,7 +992,7 @@ LoadTileBlockMap::
|
|||
call LoadEastWestConnectionsTileMap
|
||||
.eastConnection
|
||||
ld a,[wMapConn4Ptr]
|
||||
cp a,$ff
|
||||
cp $ff
|
||||
jr z,.done
|
||||
call SwitchToMapRomBank
|
||||
ld a,[wEastConnectionStripSrc]
|
||||
|
|
@ -1016,7 +1033,7 @@ LoadNorthSouthConnectionsTileMap::
|
|||
inc h
|
||||
.noCarry1
|
||||
ld a,[wCurMapWidth]
|
||||
add a,MAP_BORDER * 2
|
||||
add MAP_BORDER * 2
|
||||
add e
|
||||
ld e,a
|
||||
jr nc,.noCarry2
|
||||
|
|
@ -1045,7 +1062,7 @@ LoadEastWestConnectionsTileMap::
|
|||
inc h
|
||||
.noCarry1
|
||||
ld a,[wCurMapWidth]
|
||||
add a,MAP_BORDER * 2
|
||||
add MAP_BORDER * 2
|
||||
add e
|
||||
ld e,a
|
||||
jr nc,.noCarry2
|
||||
|
|
@ -1100,7 +1117,7 @@ IsSpriteOrSignInFrontOfPlayer::
|
|||
; check if the player is front of a counter in a pokemon center, pokemart, etc. and if so, extend the range at which he can talk to the NPC
|
||||
.extendRangeOverCounter
|
||||
predef GetTileAndCoordsInFrontOfPlayer ; get the tile in front of the player in c
|
||||
ld hl,wTileSetTalkingOverTiles ; list of tiles that extend talking range (counter tiles)
|
||||
ld hl,wTilesetTalkingOverTiles ; list of tiles that extend talking range (counter tiles)
|
||||
ld b,3
|
||||
ld d,$20 ; talking range in pixels (long range)
|
||||
.counterTilesLoop
|
||||
|
|
@ -1126,6 +1143,7 @@ IsSpriteInFrontOfPlayer2::
|
|||
ld b,a
|
||||
ld a,PLAYER_DIR_UP
|
||||
jr .doneCheckingDirection
|
||||
|
||||
.checkIfPlayerFacingDown
|
||||
cp SPRITE_FACING_DOWN
|
||||
jr nz,.checkIfPlayerFacingRight
|
||||
|
|
@ -1135,6 +1153,7 @@ IsSpriteInFrontOfPlayer2::
|
|||
ld b,a
|
||||
ld a,PLAYER_DIR_DOWN
|
||||
jr .doneCheckingDirection
|
||||
|
||||
.checkIfPlayerFacingRight
|
||||
cp SPRITE_FACING_RIGHT
|
||||
jr nz,.playerFacingLeft
|
||||
|
|
@ -1144,6 +1163,7 @@ IsSpriteInFrontOfPlayer2::
|
|||
ld c,a
|
||||
ld a,PLAYER_DIR_RIGHT
|
||||
jr .doneCheckingDirection
|
||||
|
||||
.playerFacingLeft
|
||||
; facing left
|
||||
ld a,c
|
||||
|
|
@ -1225,7 +1245,7 @@ CollisionCheckOnLand::
|
|||
jr nc,.noCollision
|
||||
.collision
|
||||
ld a,[wChannelSoundIDs + CH4]
|
||||
cp a,SFX_COLLISION ; check if collision sound is already playing
|
||||
cp SFX_COLLISION ; check if collision sound is already playing
|
||||
jr z,.setCarry
|
||||
ld a,SFX_COLLISION
|
||||
call PlaySound ; play collision sound (if it's not already playing)
|
||||
|
|
@ -1242,7 +1262,7 @@ CheckTilePassable::
|
|||
predef GetTileAndCoordsInFrontOfPlayer ; get tile in front of player
|
||||
ld a,[wTileInFrontOfPlayer] ; tile in front of player
|
||||
ld c,a
|
||||
ld hl,wTileSetCollisionPtr ; pointer to list of passable tiles
|
||||
ld hl,wTilesetCollisionPtr ; pointer to list of passable tiles
|
||||
ld a,[hli]
|
||||
ld h,[hl]
|
||||
ld l,a ; hl now points to passable tiles
|
||||
|
|
@ -1287,7 +1307,7 @@ CheckForTilePairCollisions::
|
|||
ld a,[wCurMapTileset] ; tileset number
|
||||
ld b,a
|
||||
ld a,[hli]
|
||||
cp a,$ff
|
||||
cp $ff
|
||||
jr z,.noMatch
|
||||
cp b
|
||||
jr z,.tilesetMatches
|
||||
|
|
@ -1354,7 +1374,7 @@ TilePairCollisionsWater::
|
|||
LoadCurrentMapView::
|
||||
ld a,[H_LOADEDROMBANK]
|
||||
push af
|
||||
ld a,[wTileSetBank] ; tile data ROM bank
|
||||
ld a,[wTilesetBank] ; tile data ROM bank
|
||||
ld [H_LOADEDROMBANK],a
|
||||
ld [MBC1RomBank],a ; switch to ROM bank that contains tile data
|
||||
ld a,[wCurrentTileBlockMapViewPointer] ; address of upper left corner of current map view
|
||||
|
|
@ -1387,7 +1407,7 @@ LoadCurrentMapView::
|
|||
; update tile block map pointer to next row's address
|
||||
pop de
|
||||
ld a,[wCurMapWidth]
|
||||
add a,MAP_BORDER * 2
|
||||
add MAP_BORDER * 2
|
||||
add e
|
||||
ld e,a
|
||||
jr nc,.noCarry
|
||||
|
|
@ -1722,8 +1742,8 @@ ScheduleSouthRowRedraw::
|
|||
ld bc,$0200
|
||||
add hl,bc
|
||||
ld a,h
|
||||
and a,$03
|
||||
or a,$98
|
||||
and $03
|
||||
or $98
|
||||
ld [hRedrawRowOrColumnDest + 1],a
|
||||
ld a,l
|
||||
ld [hRedrawRowOrColumnDest],a
|
||||
|
|
@ -1736,11 +1756,11 @@ ScheduleEastColumnRedraw::
|
|||
call ScheduleColumnRedrawHelper
|
||||
ld a,[wMapViewVRAMPointer]
|
||||
ld c,a
|
||||
and a,$e0
|
||||
and $e0
|
||||
ld b,a
|
||||
ld a,c
|
||||
add a,18
|
||||
and a,$1f
|
||||
add 18
|
||||
and $1f
|
||||
or b
|
||||
ld [hRedrawRowOrColumnDest],a
|
||||
ld a,[wMapViewVRAMPointer + 1]
|
||||
|
|
@ -1784,17 +1804,17 @@ ScheduleWestColumnRedraw::
|
|||
; Input: c = tile block ID, hl = destination address
|
||||
DrawTileBlock::
|
||||
push hl
|
||||
ld a,[wTileSetBlocksPtr] ; pointer to tiles
|
||||
ld a,[wTilesetBlocksPtr] ; pointer to tiles
|
||||
ld l,a
|
||||
ld a,[wTileSetBlocksPtr + 1]
|
||||
ld a,[wTilesetBlocksPtr + 1]
|
||||
ld h,a
|
||||
ld a,c
|
||||
swap a
|
||||
ld b,a
|
||||
and a,$f0
|
||||
and $f0
|
||||
ld c,a
|
||||
ld a,b
|
||||
and a,$0f
|
||||
and $0f
|
||||
ld b,a ; bc = tile block ID * 0x10
|
||||
add hl,bc
|
||||
ld d,h
|
||||
|
|
@ -1833,10 +1853,10 @@ JoypadOverworld::
|
|||
bit 3,a ; check if a trainer wants a challenge
|
||||
jr nz,.notForcedDownwards
|
||||
ld a,[wCurMap]
|
||||
cp a,ROUTE_17 ; Cycling Road
|
||||
cp ROUTE_17 ; Cycling Road
|
||||
jr nz,.notForcedDownwards
|
||||
ld a,[hJoyHeld]
|
||||
and a,D_DOWN | D_UP | D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON
|
||||
and D_DOWN | D_UP | D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON
|
||||
jr nz,.notForcedDownwards
|
||||
ld a,D_DOWN
|
||||
ld [hJoyHeld],a ; on the cycling road, if there isn't a trainer and the player isn't pressing buttons, simulate a down press
|
||||
|
|
@ -1868,6 +1888,7 @@ JoypadOverworld::
|
|||
ld [hJoyPressed],a
|
||||
ld [hJoyReleased],a
|
||||
ret
|
||||
|
||||
; if done simulating button presses
|
||||
.doneSimulating
|
||||
xor a
|
||||
|
|
@ -1878,7 +1899,7 @@ JoypadOverworld::
|
|||
ld [hJoyHeld],a
|
||||
ld hl,wd736
|
||||
ld a,[hl]
|
||||
and a,$f8
|
||||
and $f8
|
||||
ld [hl],a
|
||||
ld hl,wd730
|
||||
res 7,[hl]
|
||||
|
|
@ -1915,7 +1936,7 @@ CollisionCheckOnWater::
|
|||
jr z,.noCollision ; keep surfing
|
||||
; check if the [land] tile in front of the player is passable
|
||||
.checkIfNextTileIsPassable
|
||||
ld hl,wTileSetCollisionPtr ; pointer to list of passable tiles
|
||||
ld hl,wTilesetCollisionPtr ; pointer to list of passable tiles
|
||||
ld a,[hli]
|
||||
ld h,[hl]
|
||||
ld l,a
|
||||
|
|
@ -1928,7 +1949,7 @@ CollisionCheckOnWater::
|
|||
jr .loop
|
||||
.collision
|
||||
ld a,[wChannelSoundIDs + CH4]
|
||||
cp a,SFX_COLLISION ; check if collision sound is already playing
|
||||
cp SFX_COLLISION ; check if collision sound is already playing
|
||||
jr z,.setCarry
|
||||
ld a,SFX_COLLISION
|
||||
call PlaySound ; play collision sound (if it's not already playing)
|
||||
|
|
@ -2386,7 +2407,7 @@ IgnoreInputForHalfSecond:
|
|||
ld [wIgnoreInputCounter], a
|
||||
ld hl, wd730
|
||||
ld a, [hl]
|
||||
or $26
|
||||
or %00100110
|
||||
ld [hl], a ; set ignore input bit
|
||||
ret
|
||||
|
||||
|
|
|
|||
|
|
@ -531,9 +531,9 @@ ReverseNybble::
|
|||
ld de, NybbleReverseTable
|
||||
add e
|
||||
ld e, a
|
||||
jr nc, .asm_283f
|
||||
jr nc, .noCarry
|
||||
inc d
|
||||
.asm_283f
|
||||
.noCarry
|
||||
ld a, [de]
|
||||
ret
|
||||
|
||||
|
|
|
|||
|
|
@ -91,79 +91,79 @@ Serial_ExchangeByte::
|
|||
ld [hSerialReceivedNewData], a
|
||||
ld a, [hSerialConnectionStatus]
|
||||
cp USING_INTERNAL_CLOCK
|
||||
jr nz, .asm_21a7
|
||||
jr nz, .loop
|
||||
ld a, START_TRANSFER_INTERNAL_CLOCK
|
||||
ld [rSC], a
|
||||
.asm_21a7
|
||||
.loop
|
||||
ld a, [hSerialReceivedNewData]
|
||||
and a
|
||||
jr nz, .asm_21f1
|
||||
jr nz, .ok
|
||||
ld a, [hSerialConnectionStatus]
|
||||
cp USING_EXTERNAL_CLOCK
|
||||
jr nz, .asm_21cc
|
||||
jr nz, .doNotIncrementUnknownCounter
|
||||
call IsUnknownCounterZero
|
||||
jr z, .asm_21cc
|
||||
jr z, .doNotIncrementUnknownCounter
|
||||
call WaitLoop_15Iterations
|
||||
push hl
|
||||
ld hl, wUnknownSerialCounter + 1
|
||||
inc [hl]
|
||||
jr nz, .asm_21c3
|
||||
jr nz, .noCarry
|
||||
dec hl
|
||||
inc [hl]
|
||||
.asm_21c3
|
||||
.noCarry
|
||||
pop hl
|
||||
call IsUnknownCounterZero
|
||||
jr nz, .asm_21a7
|
||||
jr nz, .loop
|
||||
jp SetUnknownCounterToFFFF
|
||||
.asm_21cc
|
||||
.doNotIncrementUnknownCounter
|
||||
ld a, [rIE]
|
||||
and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
|
||||
cp (1 << SERIAL)
|
||||
jr nz, .asm_21a7
|
||||
jr nz, .loop
|
||||
ld a, [wUnknownSerialCounter2]
|
||||
dec a
|
||||
ld [wUnknownSerialCounter2], a
|
||||
jr nz, .asm_21a7
|
||||
jr nz, .loop
|
||||
ld a, [wUnknownSerialCounter2 + 1]
|
||||
dec a
|
||||
ld [wUnknownSerialCounter2 + 1], a
|
||||
jr nz, .asm_21a7
|
||||
jr nz, .loop
|
||||
ld a, [hSerialConnectionStatus]
|
||||
cp USING_EXTERNAL_CLOCK
|
||||
jr z, .asm_21f1
|
||||
jr z, .ok
|
||||
ld a, 255
|
||||
.waitLoop
|
||||
dec a
|
||||
jr nz, .waitLoop
|
||||
.asm_21f1
|
||||
.ok
|
||||
xor a
|
||||
ld [hSerialReceivedNewData], a
|
||||
ld a, [rIE]
|
||||
and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
|
||||
sub (1 << SERIAL)
|
||||
jr nz, .asm_2204
|
||||
jr nz, .skipReloadingUnknownCounter2
|
||||
ld [wUnknownSerialCounter2], a
|
||||
ld a, $50
|
||||
ld [wUnknownSerialCounter2 + 1], a
|
||||
.asm_2204
|
||||
.skipReloadingUnknownCounter2
|
||||
ld a, [hSerialReceiveData]
|
||||
cp SERIAL_NO_DATA_BYTE
|
||||
ret nz
|
||||
call IsUnknownCounterZero
|
||||
jr z, .asm_221f
|
||||
jr z, .done
|
||||
push hl
|
||||
ld hl, wUnknownSerialCounter + 1
|
||||
ld a, [hl]
|
||||
dec a
|
||||
ld [hld], a
|
||||
inc a
|
||||
jr nz, .asm_2219
|
||||
jr nz, .noBorrow
|
||||
dec [hl]
|
||||
.asm_2219
|
||||
.noBorrow
|
||||
pop hl
|
||||
call IsUnknownCounterZero
|
||||
jr z, SetUnknownCounterToFFFF
|
||||
.asm_221f
|
||||
.done
|
||||
ld a, [rIE]
|
||||
and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
|
||||
cp (1 << SERIAL)
|
||||
|
|
|
|||
161
home/text.asm
161
home/text.asm
|
|
@ -52,28 +52,28 @@ PlaceNextChar::
|
|||
ld a,[de]
|
||||
|
||||
cp "@"
|
||||
jr nz,.PlaceText
|
||||
jr nz, Char4ETest
|
||||
ld b,h
|
||||
ld c,l
|
||||
pop hl
|
||||
ret
|
||||
|
||||
.PlaceText
|
||||
cp $4E
|
||||
jr nz,.next
|
||||
ld bc,SCREEN_WIDTH * 2
|
||||
Char4ETest::
|
||||
cp $4E ; next
|
||||
jr nz, .char4FTest
|
||||
ld bc, 2 * SCREEN_WIDTH
|
||||
ld a,[hFlags_0xFFF6]
|
||||
bit 2,a
|
||||
jr z,.next2
|
||||
jr z,.ok
|
||||
ld bc,SCREEN_WIDTH
|
||||
.next2
|
||||
.ok
|
||||
pop hl
|
||||
add hl,bc
|
||||
push hl
|
||||
jp PlaceNextChar_inc
|
||||
|
||||
.next
|
||||
cp $4F
|
||||
.char4FTest
|
||||
cp $4F ; line
|
||||
jr nz,.next3
|
||||
pop hl
|
||||
coord hl, 1, 16
|
||||
|
|
@ -81,46 +81,36 @@ PlaceNextChar::
|
|||
jp PlaceNextChar_inc
|
||||
|
||||
.next3 ; Check against a dictionary
|
||||
dict: macro
|
||||
if \1 == 0
|
||||
and a
|
||||
jp z,Char00
|
||||
cp $4C
|
||||
jp z,Char4C
|
||||
cp $4B
|
||||
jp z,Char4B
|
||||
cp $51
|
||||
jp z,Char51
|
||||
cp $49
|
||||
jp z,Char49
|
||||
cp $52
|
||||
jp z,Char52
|
||||
cp $53
|
||||
jp z,Char53
|
||||
cp $54
|
||||
jp z,Char54
|
||||
cp $5B
|
||||
jp z,Char5B
|
||||
cp $5E
|
||||
jp z,Char5E
|
||||
cp $5C
|
||||
jp z,Char5C
|
||||
cp $5D
|
||||
jp z,Char5D
|
||||
cp $55
|
||||
jp z,Char55
|
||||
cp $56
|
||||
jp z,Char56
|
||||
cp $57
|
||||
jp z,Char57
|
||||
cp $58
|
||||
jp z,Char58
|
||||
cp $4A
|
||||
jp z,Char4A
|
||||
cp $5F
|
||||
jp z,Char5F
|
||||
cp $59
|
||||
jp z,Char59
|
||||
cp $5A
|
||||
jp z,Char5A
|
||||
else
|
||||
cp \1
|
||||
endc
|
||||
jp z, \2
|
||||
endm
|
||||
|
||||
dict $00, Char00 ; error
|
||||
dict $4C, Char4C ; autocont
|
||||
dict $4B, Char4B ; cont_
|
||||
dict $51, Char51 ; para
|
||||
dict $49, Char49 ; page
|
||||
dict $52, Char52 ; player
|
||||
dict $53, Char53 ; rival
|
||||
dict $54, Char54 ; POKé
|
||||
dict $5B, Char5B ; PC
|
||||
dict $5E, Char5E ; ROCKET
|
||||
dict $5C, Char5C ; TM
|
||||
dict $5D, Char5D ; TRAINER
|
||||
dict $55, Char55 ; cont
|
||||
dict $56, Char56 ; 6 dots
|
||||
dict $57, Char57 ; done
|
||||
dict $58, Char58 ; prompt
|
||||
dict $4A, Char4A ; PKMN
|
||||
dict $5F, Char5F ; dex
|
||||
dict $59, Char59 ; TARGET
|
||||
dict $5A, Char5A ; USER
|
||||
|
||||
ld [hli],a
|
||||
call PrintLetterDelay
|
||||
PlaceNextChar_inc::
|
||||
|
|
@ -211,7 +201,6 @@ MonsterNameCharsCommon::
|
|||
; print “Enemy ”
|
||||
ld de,Char5AText
|
||||
call PlaceString
|
||||
|
||||
ld h,b
|
||||
ld l,c
|
||||
ld de,wEnemyMonNick ; enemy active monster name
|
||||
|
|
@ -264,36 +253,36 @@ Char5F::
|
|||
pop hl
|
||||
ret
|
||||
|
||||
Char58::
|
||||
Char58:: ; prompt
|
||||
ld a,[wLinkState]
|
||||
cp LINK_STATE_BATTLING
|
||||
jp z,Next1AA2
|
||||
ld a,"▼"
|
||||
jp z, .ok
|
||||
ld a, "▼"
|
||||
Coorda 18, 16
|
||||
Next1AA2::
|
||||
.ok
|
||||
call ProtectedDelay3
|
||||
call ManualTextScroll
|
||||
ld a, " "
|
||||
Coorda 18, 16
|
||||
Char57::
|
||||
Char57:: ; done
|
||||
pop hl
|
||||
ld de,Char58Text
|
||||
ld de, Char58Text
|
||||
dec de
|
||||
ret
|
||||
|
||||
Char58Text::
|
||||
db "@"
|
||||
|
||||
Char51::
|
||||
Char51:: ; para
|
||||
push de
|
||||
ld a,"▼"
|
||||
ld a, "▼"
|
||||
Coorda 18, 16
|
||||
call ProtectedDelay3
|
||||
call ManualTextScroll
|
||||
coord hl, 1, 13
|
||||
lb bc, 4, 18
|
||||
call ClearScreenArea
|
||||
ld c,20
|
||||
ld c, 20
|
||||
call DelayFrames
|
||||
pop de
|
||||
coord hl, 1, 14
|
||||
|
|
@ -328,8 +317,8 @@ Char4B::
|
|||
;fall through
|
||||
Char4C::
|
||||
push de
|
||||
call ScrollTextUp
|
||||
call ScrollTextUp
|
||||
call ScrollTextUpOneLine
|
||||
call ScrollTextUpOneLine
|
||||
coord hl, 1, 16
|
||||
pop de
|
||||
jp PlaceNextChar_inc
|
||||
|
|
@ -338,7 +327,7 @@ Char4C::
|
|||
; always called twice in a row
|
||||
; first time, copy the two rows of text to the "in between" rows that are usually emtpy
|
||||
; second time, copy the bottom row of text into the top row of text
|
||||
ScrollTextUp::
|
||||
ScrollTextUpOneLine::
|
||||
coord hl, 0, 14 ; top row of text
|
||||
coord de, 0, 13 ; empty line above text
|
||||
ld b, SCREEN_WIDTH * 3
|
||||
|
|
@ -376,7 +365,7 @@ TextCommandProcessor::
|
|||
push af
|
||||
set 1,a
|
||||
ld e,a
|
||||
ld a,[$fff4]
|
||||
ld a, [$fff4]
|
||||
xor e
|
||||
ld [wLetterPrintingDelayFlags],a
|
||||
ld a,c
|
||||
|
|
@ -393,22 +382,22 @@ NextTextCommand::
|
|||
ret
|
||||
.doTextCommand
|
||||
push hl
|
||||
cp a,$17
|
||||
jp z,TextCommand17
|
||||
cp a,$0e
|
||||
cp a, $17
|
||||
jp z, TextCommand17
|
||||
cp a, $0e
|
||||
jp nc,TextCommand0B ; if a != 0x17 and a >= 0xE, go to command 0xB
|
||||
; if a < 0xE, use a jump table
|
||||
ld hl,TextCommandJumpTable
|
||||
push bc
|
||||
add a
|
||||
ld b,$00
|
||||
ld c,a
|
||||
add hl,bc
|
||||
ld b, 0
|
||||
ld c, a
|
||||
add hl, bc
|
||||
pop bc
|
||||
ld a,[hli]
|
||||
ld h,[hl]
|
||||
ld l,a
|
||||
jp [hl]
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
jp hl
|
||||
|
||||
; draw box
|
||||
; 04AAAABBCC
|
||||
|
|
@ -527,10 +516,10 @@ TextCommand06::
|
|||
; 07
|
||||
; (no arguments)
|
||||
TextCommand07::
|
||||
ld a," "
|
||||
ld a, " "
|
||||
Coorda 18, 16 ; place blank space in lower right corner of dialogue text box
|
||||
call ScrollTextUp
|
||||
call ScrollTextUp
|
||||
call ScrollTextUpOneLine
|
||||
call ScrollTextUpOneLine
|
||||
pop hl
|
||||
coord bc, 1, 16 ; address of second line of dialogue text box
|
||||
jp NextTextCommand
|
||||
|
|
@ -541,7 +530,7 @@ TextCommand08::
|
|||
pop hl
|
||||
ld de,NextTextCommand
|
||||
push de ; return address
|
||||
jp [hl]
|
||||
jp hl
|
||||
|
||||
; print decimal number (converted from binary number)
|
||||
; 09AAAABB
|
||||
|
|
@ -630,16 +619,16 @@ TextCommand0B::
|
|||
|
||||
; format: text command ID, sound ID or cry ID
|
||||
TextCommandSounds::
|
||||
db $0B,SFX_GET_ITEM_1 ; actually plays SFX_LEVEL_UP when the battle music engine is loaded
|
||||
db $12,SFX_CAUGHT_MON
|
||||
db $0E,SFX_POKEDEX_RATING ; unused?
|
||||
db $0F,SFX_GET_ITEM_1 ; unused?
|
||||
db $10,SFX_GET_ITEM_2
|
||||
db $11,SFX_GET_KEY_ITEM
|
||||
db $13,SFX_DEX_PAGE_ADDED
|
||||
db $14,NIDORINA ; used in OakSpeech
|
||||
db $15,PIDGEOT ; used in SaffronCityText12
|
||||
db $16,DEWGONG ; unused?
|
||||
db $0B, SFX_GET_ITEM_1 ; actually plays SFX_LEVEL_UP when the battle music engine is loaded
|
||||
db $12, SFX_CAUGHT_MON
|
||||
db $0E, SFX_POKEDEX_RATING ; unused?
|
||||
db $0F, SFX_GET_ITEM_1 ; unused?
|
||||
db $10, SFX_GET_ITEM_2
|
||||
db $11, SFX_GET_KEY_ITEM
|
||||
db $13, SFX_DEX_PAGE_ADDED
|
||||
db $14, NIDORINA ; used in OakSpeech
|
||||
db $15, PIDGEOT ; used in SaffronCityText12
|
||||
db $16, DEWGONG ; unused?
|
||||
|
||||
; draw ellipses
|
||||
; 0CAA
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ VBlank::
|
|||
call VBlankCopyDouble
|
||||
call UpdateMovingBgTiles
|
||||
call $ff80 ; hOAMDMA
|
||||
ld a, Bank(PrepareOAMData)
|
||||
ld a, BANK(PrepareOAMData)
|
||||
ld [H_LOADEDROMBANK], a
|
||||
ld [MBC1RomBank], a
|
||||
call PrepareOAMData
|
||||
|
|
|
|||
|
|
@ -33,13 +33,13 @@ ClearBgMap::
|
|||
jr nz,.loop
|
||||
ret
|
||||
|
||||
RedrawRowOrColumn::
|
||||
; This function redraws a BG row of height 2 or a BG column of width 2.
|
||||
; One of its main uses is redrawing the row or column that will be exposed upon
|
||||
; scrolling the BG when the player takes a step. Redrawing only the exposed
|
||||
; row or column is more efficient than redrawing the entire screen.
|
||||
; However, this function is also called repeatedly to redraw the whole screen
|
||||
; when necessary. It is also used in trade animation and elevator code.
|
||||
RedrawRowOrColumn::
|
||||
ld a,[hRedrawRowOrColumnMode]
|
||||
and a
|
||||
ret z
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue