mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-06 15:45:24 +13:00
naming
This commit is contained in:
parent
e607199397
commit
1d86932cc9
29 changed files with 225 additions and 174 deletions
|
|
@ -134,52 +134,52 @@ OverworldLoopLessDelay::
|
|||
call UpdateSprites
|
||||
ld a,$01
|
||||
ld [wcc4b],a
|
||||
ld a,[wd528] ; the direction that was pressed last time
|
||||
ld a,[wPlayerMovingDirection] ; the direction that was pressed last time
|
||||
and a
|
||||
jp z,OverworldLoop
|
||||
; if a direction was pressed last time
|
||||
ld [wd529],a ; save the last direction
|
||||
ld [wPlayerLastStopDirection],a ; save the last direction
|
||||
xor a
|
||||
ld [wd528],a ; zero the direction
|
||||
ld [wPlayerMovingDirection],a ; zero the direction
|
||||
jp OverworldLoop
|
||||
.checkIfDownButtonIsPressed
|
||||
ld a,[hJoyHeld] ; current joypad state
|
||||
bit 7,a ; down button
|
||||
jr z,.checkIfUpButtonIsPressed
|
||||
ld a,$01
|
||||
ld [wSpriteStateData1 + 3],a
|
||||
ld a,$04
|
||||
ld a,1
|
||||
ld [wSpriteStateData1 + 3],a ; delta Y
|
||||
ld a,PLAYER_DIR_DOWN
|
||||
jr .handleDirectionButtonPress
|
||||
.checkIfUpButtonIsPressed
|
||||
bit 6,a ; up button
|
||||
jr z,.checkIfLeftButtonIsPressed
|
||||
ld a,$ff
|
||||
ld [wSpriteStateData1 + 3],a
|
||||
ld a,$08
|
||||
ld a,-1
|
||||
ld [wSpriteStateData1 + 3],a ; delta Y
|
||||
ld a,PLAYER_DIR_UP
|
||||
jr .handleDirectionButtonPress
|
||||
.checkIfLeftButtonIsPressed
|
||||
bit 5,a ; left button
|
||||
jr z,.checkIfRightButtonIsPressed
|
||||
ld a,$ff
|
||||
ld [wSpriteStateData1 + 5],a
|
||||
ld a,$02
|
||||
ld a,-1
|
||||
ld [wSpriteStateData1 + 5],a ; delta X
|
||||
ld a,PLAYER_DIR_LEFT
|
||||
jr .handleDirectionButtonPress
|
||||
.checkIfRightButtonIsPressed
|
||||
bit 4,a ; right button
|
||||
jr z,.noDirectionButtonsPressed
|
||||
ld a,$01
|
||||
ld [wSpriteStateData1 + 5],a
|
||||
ld a,1 ; PLAYER_DIR_RIGHT
|
||||
ld [wSpriteStateData1 + 5],a ; delta X
|
||||
.handleDirectionButtonPress
|
||||
ld [wd52a],a ; new direction
|
||||
ld [wPlayerDirection],a ; new direction
|
||||
ld a,[wd730]
|
||||
bit 7,a ; are we simulating button presses?
|
||||
jr nz,.noDirectionChange ; ignore direction changes if we are
|
||||
ld a,[wcc4b]
|
||||
and a
|
||||
jr z,.noDirectionChange
|
||||
ld a,[wd52a] ; new direction
|
||||
ld a,[wPlayerDirection] ; new direction
|
||||
ld b,a
|
||||
ld a,[wd529] ; old direction
|
||||
ld a,[wPlayerLastStopDirection] ; old direction
|
||||
cp b
|
||||
jr z,.noDirectionChange
|
||||
; the code below is strange
|
||||
|
|
@ -187,42 +187,42 @@ OverworldLoopLessDelay::
|
|||
; also, it does a seemingly pointless loop afterwards
|
||||
swap a ; put old direction in upper half
|
||||
or b ; put new direction in lower half
|
||||
cp a,$48 ; change dir from down to up
|
||||
cp a,(PLAYER_DIR_DOWN << 4) | PLAYER_DIR_UP ; change dir from down to up
|
||||
jr nz,.notDownToUp
|
||||
ld a,$02
|
||||
ld [wd528],a
|
||||
ld a,PLAYER_DIR_LEFT
|
||||
ld [wPlayerMovingDirection],a
|
||||
jr .oddLoop
|
||||
.notDownToUp
|
||||
cp a,$84 ; change dir from up to down
|
||||
cp a,(PLAYER_DIR_UP << 4) | PLAYER_DIR_DOWN ; change dir from up to down
|
||||
jr nz,.notUpToDown
|
||||
ld a,$01
|
||||
ld [wd528],a
|
||||
ld a,PLAYER_DIR_RIGHT
|
||||
ld [wPlayerMovingDirection],a
|
||||
jr .oddLoop
|
||||
.notUpToDown
|
||||
cp a,$12 ; change dir from right to left
|
||||
cp a,(PLAYER_DIR_RIGHT << 4) | PLAYER_DIR_LEFT ; change dir from right to left
|
||||
jr nz,.notRightToLeft
|
||||
ld a,$04
|
||||
ld [wd528],a
|
||||
ld a,PLAYER_DIR_DOWN
|
||||
ld [wPlayerMovingDirection],a
|
||||
jr .oddLoop
|
||||
.notRightToLeft
|
||||
cp a,$21 ; change dir from left to right
|
||||
cp a,(PLAYER_DIR_LEFT << 4) | PLAYER_DIR_RIGHT ; change dir from left to right
|
||||
jr nz,.oddLoop
|
||||
ld a,$08
|
||||
ld [wd528],a
|
||||
ld a,PLAYER_DIR_UP
|
||||
ld [wPlayerMovingDirection],a
|
||||
.oddLoop
|
||||
ld hl,wFlags_0xcd60
|
||||
set 2,[hl]
|
||||
ld hl,wcc4b
|
||||
dec [hl]
|
||||
jr nz,.oddLoop
|
||||
ld a,[wd52a]
|
||||
ld [wd528],a
|
||||
ld a,[wPlayerDirection]
|
||||
ld [wPlayerMovingDirection],a
|
||||
call NewBattle
|
||||
jp c,.battleOccurred
|
||||
jp OverworldLoop
|
||||
.noDirectionChange
|
||||
ld a,[wd52a] ; current direction
|
||||
ld [wd528],a ; save direction
|
||||
ld a,[wPlayerDirection] ; current direction
|
||||
ld [wPlayerMovingDirection],a ; save direction
|
||||
call UpdateSprites
|
||||
ld a,[wWalkBikeSurfState]
|
||||
cp a,$02 ; surfing
|
||||
|
|
@ -566,7 +566,7 @@ CheckMapConnections:: ; 07ba (0:07ba)
|
|||
jp .loadNewMap
|
||||
.checkEastMap
|
||||
ld b,a
|
||||
ld a,[wd525] ; map width
|
||||
ld a,[wCurrentMapWidth2] ; map width
|
||||
cp b
|
||||
jr nz,.checkNorthMap
|
||||
ld a,[W_MAPCONN4PTR]
|
||||
|
|
@ -628,7 +628,7 @@ CheckMapConnections:: ; 07ba (0:07ba)
|
|||
jp .loadNewMap
|
||||
.checkSouthMap
|
||||
ld b,a
|
||||
ld a,[wd524]
|
||||
ld a,[wCurrentMapHeight2]
|
||||
cp b
|
||||
jr nz,.didNotEnterConnectedMap
|
||||
ld a,[W_MAPCONN2PTR]
|
||||
|
|
@ -864,7 +864,7 @@ LoadTilesetTilePatternData:: ; 09e8 (0:09e8)
|
|||
LoadTileBlockMap:: ; 09fc (0:09fc)
|
||||
; fill C6E8-CBFB with the background tile
|
||||
ld hl,wOverworldMap
|
||||
ld a,[wd3ad] ; background tile number
|
||||
ld a,[wMapBackgroundTile]
|
||||
ld d,a
|
||||
ld bc,$0514
|
||||
.backgroundTileLoop
|
||||
|
|
@ -1057,15 +1057,15 @@ LoadEastWestConnectionsTileMap:: ; 0b02 (0:0b02)
|
|||
IsSpriteOrSignInFrontOfPlayer:: ; 0b23 (0:0b23)
|
||||
xor a
|
||||
ld [hSpriteIndexOrTextID],a
|
||||
ld a,[wd4b0] ; number of signs in the map
|
||||
ld a,[wNumSigns]
|
||||
and a
|
||||
jr z,.extendRangeOverCounter
|
||||
; if there are signs
|
||||
predef GetTileAndCoordsInFrontOfPlayer ; get the coordinates in front of the player in de
|
||||
ld hl,wd4b1 ; start of sign coordinates
|
||||
ld a,[wd4b0] ; number of signs in the map
|
||||
ld hl,wSignCoords
|
||||
ld a,[wNumSigns]
|
||||
ld b,a
|
||||
ld c,$00
|
||||
ld c,0
|
||||
.signLoop
|
||||
inc c
|
||||
ld a,[hli] ; sign Y
|
||||
|
|
@ -1081,8 +1081,8 @@ IsSpriteOrSignInFrontOfPlayer:: ; 0b23 (0:0b23)
|
|||
; found sign
|
||||
push hl
|
||||
push bc
|
||||
ld hl,wd4d1 ; start of sign text ID's
|
||||
ld b,$00
|
||||
ld hl,wSignTextIDs
|
||||
ld b,0
|
||||
dec c
|
||||
add hl,bc
|
||||
ld a,[hl]
|
||||
|
|
@ -1097,7 +1097,7 @@ IsSpriteOrSignInFrontOfPlayer:: ; 0b23 (0:0b23)
|
|||
.extendRangeOverCounter
|
||||
predef GetTileAndCoordsInFrontOfPlayer ; get the tile in front of the player in c
|
||||
ld hl,W_TILESETTALKINGOVERTILES ; list of tiles that extend talking range (counter tiles)
|
||||
ld b,$03
|
||||
ld b,3
|
||||
ld d,$20 ; talking range in pixels (long range)
|
||||
.counterTilesLoop
|
||||
ld a,[hli]
|
||||
|
|
@ -1111,7 +1111,7 @@ IsSpriteOrSignInFrontOfPlayer:: ; 0b23 (0:0b23)
|
|||
IsSpriteInFrontOfPlayer:: ; 0b6b (0:0b6b)
|
||||
ld d,$10 ; talking range in pixels (normal range)
|
||||
IsSpriteInFrontOfPlayer2:: ; 0b6d (0:0b6d)
|
||||
ld bc,$3c40 ; Y and X position of player sprite
|
||||
lb bc, $3c, $40 ; Y and X position of player sprite
|
||||
ld a,[wSpriteStateData1 + 9] ; direction the player is facing
|
||||
.checkIfPlayerFacingUp
|
||||
cp SPRITE_FACING_UP
|
||||
|
|
@ -1120,7 +1120,7 @@ IsSpriteInFrontOfPlayer2:: ; 0b6d (0:0b6d)
|
|||
ld a,b
|
||||
sub d
|
||||
ld b,a
|
||||
ld a,$08
|
||||
ld a,PLAYER_DIR_UP
|
||||
jr .doneCheckingDirection
|
||||
.checkIfPlayerFacingDown
|
||||
cp SPRITE_FACING_DOWN
|
||||
|
|
@ -1129,7 +1129,7 @@ IsSpriteInFrontOfPlayer2:: ; 0b6d (0:0b6d)
|
|||
ld a,b
|
||||
add d
|
||||
ld b,a
|
||||
ld a,$04
|
||||
ld a,PLAYER_DIR_DOWN
|
||||
jr .doneCheckingDirection
|
||||
.checkIfPlayerFacingRight
|
||||
cp SPRITE_FACING_RIGHT
|
||||
|
|
@ -1138,16 +1138,16 @@ IsSpriteInFrontOfPlayer2:: ; 0b6d (0:0b6d)
|
|||
ld a,c
|
||||
add d
|
||||
ld c,a
|
||||
ld a,$01
|
||||
ld a,PLAYER_DIR_RIGHT
|
||||
jr .doneCheckingDirection
|
||||
.playerFacingLeft
|
||||
; facing left
|
||||
ld a,c
|
||||
sub d
|
||||
ld c,a
|
||||
ld a,$02
|
||||
ld a,PLAYER_DIR_LEFT
|
||||
.doneCheckingDirection
|
||||
ld [wd52a],a
|
||||
ld [wPlayerDirection],a
|
||||
ld a,[W_NUMSPRITES] ; number of sprites
|
||||
and a
|
||||
ret z
|
||||
|
|
@ -1202,7 +1202,7 @@ CollisionCheckOnLand:: ; 0bd1 (0:0bd1)
|
|||
ld a,[wSimulatedJoypadStatesIndex]
|
||||
and a
|
||||
jr nz,.noCollision ; no collisions when the player's movements are being controlled by the game
|
||||
ld a,[wd52a] ; the direction that the player is trying to go in
|
||||
ld a,[wPlayerDirection] ; the direction that the player is trying to go in
|
||||
ld d,a
|
||||
ld a,[wSpriteStateData1 + 12] ; the player sprite's collision data (bit field) (set in the sprite movement code)
|
||||
and d ; check if a sprite is in the direction the player is trying to go
|
||||
|
|
@ -1893,7 +1893,7 @@ CollisionCheckOnWater:: ; 0fb7 (0:0fb7)
|
|||
ld a,[wd730]
|
||||
bit 7,a
|
||||
jp nz,.noCollision ; return and clear carry if button presses are being simulated
|
||||
ld a,[wd52a] ; the direction that the player is trying to go in
|
||||
ld a,[wPlayerDirection] ; the direction that the player is trying to go in
|
||||
ld d,a
|
||||
ld a,[wSpriteStateData1 + 12] ; the player sprite's collision data (bit field) (set in the sprite movement code)
|
||||
and d ; check if a sprite is in the direction the player is trying to go
|
||||
|
|
@ -2073,17 +2073,17 @@ LoadMapHeader:: ; 107c (0:107c)
|
|||
call CopyMapConnectionHeader
|
||||
.getObjectDataPointer
|
||||
ld a,[hli]
|
||||
ld [wd3a9],a
|
||||
ld [wObjectDataPointerTemp],a
|
||||
ld a,[hli]
|
||||
ld [wd3aa],a
|
||||
ld [wObjectDataPointerTemp + 1],a
|
||||
push hl
|
||||
ld a,[wd3a9]
|
||||
ld a,[wObjectDataPointerTemp]
|
||||
ld l,a
|
||||
ld a,[wd3aa]
|
||||
ld a,[wObjectDataPointerTemp + 1]
|
||||
ld h,a ; hl = base of object data
|
||||
ld de,wd3ad ; background tile ID
|
||||
ld de,wMapBackgroundTile
|
||||
ld a,[hli]
|
||||
ld [de],a ; save background tile ID
|
||||
ld [de],a
|
||||
.loadWarpData
|
||||
ld a,[hli]
|
||||
ld [wNumberOfWarps],a
|
||||
|
|
@ -2103,16 +2103,16 @@ LoadMapHeader:: ; 107c (0:107c)
|
|||
jr nz,.warpLoop
|
||||
.loadSignData
|
||||
ld a,[hli] ; number of signs
|
||||
ld [wd4b0],a ; save the number of signs
|
||||
ld [wNumSigns],a
|
||||
and a ; are there any signs?
|
||||
jr z,.loadSpriteData ; if not, skip this
|
||||
ld c,a
|
||||
ld de,wd4d1 ; base address of sign text IDs
|
||||
ld de,wSignTextIDs
|
||||
ld a,d
|
||||
ld [$ff95],a
|
||||
ld [hSignCoordPointer],a
|
||||
ld a,e
|
||||
ld [$ff96],a
|
||||
ld de,wd4b1 ; base address of sign coordinates
|
||||
ld [hSignCoordPointer + 1],a
|
||||
ld de,wSignCoords
|
||||
.signLoop
|
||||
ld a,[hli]
|
||||
ld [de],a
|
||||
|
|
@ -2121,17 +2121,17 @@ LoadMapHeader:: ; 107c (0:107c)
|
|||
ld [de],a
|
||||
inc de
|
||||
push de
|
||||
ld a,[$ff95]
|
||||
ld a,[hSignCoordPointer]
|
||||
ld d,a
|
||||
ld a,[$ff96]
|
||||
ld a,[hSignCoordPointer + 1]
|
||||
ld e,a
|
||||
ld a,[hli]
|
||||
ld [de],a
|
||||
inc de
|
||||
ld a,d
|
||||
ld [$ff95],a
|
||||
ld [hSignCoordPointer],a
|
||||
ld a,e
|
||||
ld [$ff96],a
|
||||
ld [hSignCoordPointer + 1],a
|
||||
pop de
|
||||
dec c
|
||||
jr nz,.signLoop
|
||||
|
|
@ -2259,10 +2259,10 @@ LoadMapHeader:: ; 107c (0:107c)
|
|||
pop hl ; restore hl from before going to the warp/sign/sprite data (this value was saved for seemingly no purpose)
|
||||
ld a,[W_CURMAPHEIGHT] ; map height in 4x4 tile blocks
|
||||
add a ; double it
|
||||
ld [wd524],a ; store map height in 2x2 tile blocks
|
||||
ld [wCurrentMapHeight2],a ; store map height in 2x2 tile blocks
|
||||
ld a,[W_CURMAPWIDTH] ; map width in 4x4 tile blocks
|
||||
add a ; double it
|
||||
ld [wd525],a ; map width in 2x2 tile blocks
|
||||
ld [wCurrentMapWidth2],a ; map width in 2x2 tile blocks
|
||||
ld a,[W_CURMAP]
|
||||
ld c,a
|
||||
ld b,$00
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue