mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-22 07:02:17 +13:00
sync home
This commit is contained in:
parent
3a6a300da4
commit
3ab3f4273b
7 changed files with 150 additions and 131 deletions
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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)
|
||||
|
|
@ -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
|
||||
|
|
@ -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]
|
||||
|
|
@ -1791,10 +1811,10 @@ DrawTileBlock::
|
|||
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]
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue