mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-10-19 21:46:25 +13:00
naming
This commit is contained in:
parent
e607199397
commit
1d86932cc9
|
@ -121,6 +121,18 @@ BOX_DATA EQU 2
|
|||
DAYCARE_DATA EQU 3
|
||||
BATTLE_MON_DATA EQU 4
|
||||
|
||||
; player direction constants
|
||||
|
||||
PLAYER_DIR_BIT_RIGHT EQU 0
|
||||
PLAYER_DIR_BIT_LEFT EQU 1
|
||||
PLAYER_DIR_BIT_DOWN EQU 2
|
||||
PLAYER_DIR_BIT_UP EQU 3
|
||||
|
||||
PLAYER_DIR_RIGHT EQU (1 << PLAYER_DIR_BIT_RIGHT)
|
||||
PLAYER_DIR_LEFT EQU (1 << PLAYER_DIR_BIT_LEFT)
|
||||
PLAYER_DIR_DOWN EQU (1 << PLAYER_DIR_BIT_DOWN)
|
||||
PLAYER_DIR_UP EQU (1 << PLAYER_DIR_BIT_UP)
|
||||
|
||||
; serial
|
||||
|
||||
ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01
|
||||
|
|
|
@ -6296,7 +6296,7 @@ LoadEnemyMonData: ; 3eb01 (f:6b01)
|
|||
predef WriteMonMoves ; get moves based on current level
|
||||
.loadMovePPs
|
||||
ld hl, wEnemyMonMoves
|
||||
ld de, wEnemyMonSpecial + 1
|
||||
ld de, wEnemyMonPP - 1
|
||||
predef LoadMovePPs
|
||||
ld hl, W_MONHBASESTATS
|
||||
ld de, wEnemyMonBaseStats
|
||||
|
@ -6957,7 +6957,7 @@ InitBattle_Common: ; 3efeb (f:6feb)
|
|||
ld [wLetterPrintingDelayFlags], a
|
||||
pop af
|
||||
ld [wMapPalOffset], a
|
||||
ld a, [wd0d4]
|
||||
ld a, [wSavedTilesetType]
|
||||
ld [hTilesetType], a
|
||||
scf
|
||||
ret
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
InitBattleVariables: ; 525af (14:65af)
|
||||
ld a, [hTilesetType]
|
||||
ld [wd0d4], a
|
||||
ld [wSavedTilesetType], a
|
||||
xor a
|
||||
ld [wActionResultOrTookBattleTurn], a
|
||||
ld [wBattleResult], a
|
||||
|
|
|
@ -78,7 +78,7 @@ SafariZoneGameOver: ; 1e9b0 (7:69b0)
|
|||
ld [H_DOWNARROWBLINKCNT2], a
|
||||
call DisplayTextID
|
||||
xor a
|
||||
ld [wd528], a
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, SAFARI_ZONE_ENTRANCE
|
||||
ld [H_DOWNARROWBLINKCNT1], a
|
||||
ld a, $3
|
||||
|
|
|
@ -591,14 +591,14 @@ ItemUseSurfboard: ; d9b4 (3:59b4)
|
|||
jp LoadWalkingPlayerSpriteGraphics
|
||||
; uses a simulated button press to make the player move forward
|
||||
.makePlayerMoveForward
|
||||
ld a,[wd52a] ; direction the player is going
|
||||
bit 3,a
|
||||
ld a,[wPlayerDirection] ; direction the player is going
|
||||
bit PLAYER_DIR_BIT_UP,a
|
||||
ld b,D_UP
|
||||
jr nz,.storeSimulatedButtonPress
|
||||
bit 2,a
|
||||
bit PLAYER_DIR_BIT_DOWN,a
|
||||
ld b,D_DOWN
|
||||
jr nz,.storeSimulatedButtonPress
|
||||
bit 1,a
|
||||
bit PLAYER_DIR_BIT_LEFT,a
|
||||
ld b,D_LEFT
|
||||
jr nz,.storeSimulatedButtonPress
|
||||
ld b,D_RIGHT
|
||||
|
|
|
@ -107,8 +107,8 @@ MainMenu: ; 5af2 (1:5af2)
|
|||
.pressedA
|
||||
call GBPalWhiteOutWithDelay3
|
||||
call ClearScreen
|
||||
ld a,4
|
||||
ld [wd52a],a
|
||||
ld a,PLAYER_DIR_DOWN
|
||||
ld [wPlayerDirection],a
|
||||
ld c,10
|
||||
call DelayFrames
|
||||
ld a,[wNumHoFTeams]
|
||||
|
|
|
@ -25,24 +25,24 @@ UpdatePlayerSprite: ; 4e31 (1:4e31)
|
|||
ld a, [wWalkCounter]
|
||||
and a
|
||||
jr nz, .moving
|
||||
ld a, [wd528]
|
||||
ld a, [wPlayerMovingDirection]
|
||||
; check if down
|
||||
bit 2, a
|
||||
bit PLAYER_DIR_BIT_DOWN, a
|
||||
jr z, .checkIfUp
|
||||
xor a ; ld a, SPRITE_FACING_DOWN
|
||||
jr .next
|
||||
.checkIfUp
|
||||
bit 3, a
|
||||
bit PLAYER_DIR_BIT_UP, a
|
||||
jr z, .checkIfLeft
|
||||
ld a, SPRITE_FACING_UP
|
||||
jr .next
|
||||
.checkIfLeft
|
||||
bit 1, a
|
||||
bit PLAYER_DIR_BIT_LEFT, a
|
||||
jr z, .checkIfRight
|
||||
ld a, SPRITE_FACING_LEFT
|
||||
jr .next
|
||||
.checkIfRight
|
||||
bit 0, a
|
||||
bit PLAYER_DIR_BIT_RIGHT, a
|
||||
jr z, .notMoving
|
||||
ld a, SPRITE_FACING_RIGHT
|
||||
jr .next
|
||||
|
@ -405,23 +405,23 @@ InitializeSpriteFacingDirection: ; 507f (1:507f)
|
|||
bit 5, a
|
||||
jr nz, notYetMoving
|
||||
res 7, [hl]
|
||||
ld a, [wd52a]
|
||||
bit 3, a
|
||||
ld a, [wPlayerDirection]
|
||||
bit PLAYER_DIR_BIT_UP, a
|
||||
jr z, .notFacingDown
|
||||
ld c, $0 ; make sprite face down
|
||||
ld c, SPRITE_FACING_DOWN
|
||||
jr .facingDirectionDetermined
|
||||
.notFacingDown
|
||||
bit 2, a
|
||||
bit PLAYER_DIR_BIT_DOWN, a
|
||||
jr z, .notFacingUp
|
||||
ld c, $4 ; make sprite face up
|
||||
ld c, SPRITE_FACING_UP
|
||||
jr .facingDirectionDetermined
|
||||
.notFacingUp
|
||||
bit 1, a
|
||||
bit PLAYER_DIR_BIT_LEFT, a
|
||||
jr z, .notFacingRight
|
||||
ld c, $c ; make sprite face right
|
||||
ld c, SPRITE_FACING_RIGHT
|
||||
jr .facingDirectionDetermined
|
||||
.notFacingRight
|
||||
ld c, $8 ; make sprite face left
|
||||
ld c, SPRITE_FACING_LEFT
|
||||
.facingDirectionDetermined
|
||||
ld a, [H_CURRENTSPRITEOFFSET]
|
||||
add $9
|
||||
|
|
|
@ -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
|
||||
|
|
3
hram.asm
3
hram.asm
|
@ -82,6 +82,9 @@ hTilePlayerStandingOn EQU $FF93
|
|||
|
||||
hSpritePriority EQU $FF94
|
||||
|
||||
; 2 bytes
|
||||
hSignCoordPointer EQU $FF95
|
||||
|
||||
hNPCMovementDirections2Index EQU $FF95
|
||||
|
||||
; CalcPositionOfPlayerRelativeToNPC
|
||||
|
|
|
@ -44,15 +44,15 @@ CeruleanCityScript0: ; 194c8 (6:54c8)
|
|||
jr nc, .asm_194f7
|
||||
ld a, [wCoordIndex]
|
||||
cp $1
|
||||
ld a, $8
|
||||
ld a, PLAYER_DIR_UP
|
||||
ld b, SPRITE_FACING_DOWN
|
||||
jr nz, .asm_194e6
|
||||
ld a, $4
|
||||
ld a, PLAYER_DIR_DOWN
|
||||
ld b, SPRITE_FACING_UP
|
||||
.asm_194e6
|
||||
ld [wd528], a
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, b
|
||||
ld [wSpriteStateData1 + $29], a
|
||||
ld [wSpriteStateData1 + 2 * $10 + $9], a
|
||||
call Delay3
|
||||
ld a, $2
|
||||
ld [hSpriteIndexOrTextID], a
|
||||
|
|
|
@ -54,14 +54,14 @@ CinnabarGymScript0: ; 757ae (1d:57ae)
|
|||
ld [H_SPRITEINDEX], a
|
||||
cp $4
|
||||
jr nz, .asm_757c3
|
||||
ld a, $4
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_DOWN
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld de, MovementData_757d7
|
||||
jr .asm_757cb
|
||||
.asm_757c3
|
||||
ld de, MovementData_757da
|
||||
ld a, $1
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_RIGHT
|
||||
ld [wPlayerMovingDirection], a
|
||||
.asm_757cb
|
||||
call MoveSprite
|
||||
ld a, $1
|
||||
|
|
|
@ -24,8 +24,8 @@ CinnabarIslandScript0: ; 1ca38 (7:4a38)
|
|||
ld a, [W_XCOORD]
|
||||
cp $12
|
||||
ret nz
|
||||
ld a, $8
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_UP
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, $8
|
||||
ld [hSpriteIndexOrTextID], a
|
||||
call DisplayTextID
|
||||
|
|
|
@ -42,8 +42,8 @@ FightingDojoScript1: ; 5cd83 (17:4d83)
|
|||
ret nz
|
||||
ld a, $1
|
||||
ld [wcf0d], a
|
||||
ld a, $1
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_RIGHT
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, $1
|
||||
ld [H_SPRITEINDEX], a
|
||||
ld a, SPRITE_FACING_LEFT
|
||||
|
@ -61,8 +61,8 @@ FightingDojoScript3: ; 5cdc6 (17:4dc6)
|
|||
ld a, [wcf0d]
|
||||
and a
|
||||
jr z, .asm_5cde4
|
||||
ld a, $1
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_RIGHT
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, $1
|
||||
ld [H_SPRITEINDEX], a
|
||||
ld a, SPRITE_FACING_LEFT
|
||||
|
|
|
@ -139,8 +139,8 @@ GaryScript5: ; 7601a (1d:601a)
|
|||
ld a, [wd730]
|
||||
bit 0, a
|
||||
ret nz
|
||||
ld a, $2
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_LEFT
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, $1
|
||||
ld [H_SPRITEINDEX], a
|
||||
ld a, SPRITE_FACING_LEFT
|
||||
|
|
|
@ -80,19 +80,19 @@ HallofFameRoomScript1: ; 5a52b (16:652b)
|
|||
ld a, [wSimulatedJoypadStatesIndex]
|
||||
and a
|
||||
ret nz
|
||||
ld a, $1
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_RIGHT
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, $1
|
||||
ld [H_SPRITEINDEX], a
|
||||
call SetSpriteMovementBytesToFF
|
||||
ld a, $8
|
||||
ld a, SPRITE_FACING_LEFT
|
||||
ld [hSpriteFacingDirection], a
|
||||
call SetSpriteFacingDirectionAndDelay
|
||||
call Delay3
|
||||
xor a
|
||||
ld [wJoyIgnore], a
|
||||
inc a
|
||||
ld [wd528], a
|
||||
inc a ; PLAYER_DIR_RIGHT
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, $1
|
||||
ld [hSpriteIndexOrTextID], a
|
||||
call DisplayTextID
|
||||
|
|
|
@ -178,8 +178,8 @@ OaksLabScript6: ; 1cc36 (7:4c36)
|
|||
ld a, D_UP
|
||||
ld [wSimulatedJoypadStatesEnd], a
|
||||
call StartSimulatingJoypadStates
|
||||
ld a, $8
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_UP
|
||||
ld [wPlayerMovingDirection], a
|
||||
|
||||
ld a, $7
|
||||
ld [W_OAKSLABCURSCRIPT], a
|
||||
|
@ -354,8 +354,8 @@ OaksLabScript10: ; 1cd6d (7:4d6d)
|
|||
xor a ; SPRITE_FACING_DOWN
|
||||
ld [hSpriteFacingDirection], a
|
||||
call SetSpriteFacingDirectionAndDelay
|
||||
ld a, $8
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_UP
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld c, BANK(Music_MeetRival)
|
||||
ld a, MUSIC_MEET_RIVAL
|
||||
call PlayMusic
|
||||
|
@ -414,8 +414,8 @@ OaksLabScript11: ; 1cdb9 (7:4db9)
|
|||
set 7, [hl]
|
||||
xor a
|
||||
ld [wJoyIgnore], a
|
||||
ld a, $8
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_UP
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, $c
|
||||
ld [W_OAKSLABCURSCRIPT], a
|
||||
ret
|
||||
|
@ -423,8 +423,8 @@ OaksLabScript11: ; 1cdb9 (7:4db9)
|
|||
OaksLabScript12: ; 1ce03 (7:4e03)
|
||||
ld a, $f0
|
||||
ld [wJoyIgnore], a
|
||||
ld a, $8
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_UP
|
||||
ld [wPlayerMovingDirection], a
|
||||
call UpdateSprites
|
||||
ld a, $1
|
||||
ld [wSpriteIndex], a
|
||||
|
|
|
@ -28,8 +28,8 @@ PalletTownScript0: ; 18e81 (6:4e81)
|
|||
ret nz
|
||||
xor a
|
||||
ld [hJoyHeld],a
|
||||
ld a,4
|
||||
ld [wd528],a
|
||||
ld a,PLAYER_DIR_DOWN
|
||||
ld [wPlayerMovingDirection],a
|
||||
ld a,$FF
|
||||
call PlaySound ; stop music
|
||||
ld a, BANK(Music_MeetProfOak)
|
||||
|
@ -190,8 +190,8 @@ OakAppearsText: ; 18fb0 (6:4fb0)
|
|||
ld [wEmotionBubbleSpriteIndex],a ; player's sprite
|
||||
ld [wWhichEmotionBubble],a ; EXCLAMATION_BUBBLE
|
||||
predef EmotionBubble
|
||||
ld a,4
|
||||
ld [wd528],a
|
||||
ld a,PLAYER_DIR_DOWN
|
||||
ld [wPlayerMovingDirection],a
|
||||
jp TextScriptEnd
|
||||
|
||||
OakWalksUpText: ; 18fce (6:4fce)
|
||||
|
|
|
@ -33,15 +33,15 @@ PokemonTower2Script0: ; 6050f (18:450f)
|
|||
res 6, [hl]
|
||||
ld a, [wCoordIndex]
|
||||
cp $1
|
||||
ld a, $8
|
||||
ld a, PLAYER_DIR_UP
|
||||
ld b, SPRITE_FACING_DOWN
|
||||
jr nz, .asm_60544
|
||||
ld hl, wd764
|
||||
set 6, [hl]
|
||||
ld a, $2
|
||||
ld a, PLAYER_DIR_LEFT
|
||||
ld b, SPRITE_FACING_RIGHT
|
||||
.asm_60544
|
||||
ld [wd528], a
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, $1
|
||||
ld [H_SPRITEINDEX], a
|
||||
ld a, b
|
||||
|
|
|
@ -11,8 +11,8 @@ RedsHouse2FScriptPointers: ; 5c0bc (17:40bc)
|
|||
RedsHouse2FScript0: ; 5c0c0 (17:40c0)
|
||||
xor a
|
||||
ld [hJoyHeld],a
|
||||
ld a,8
|
||||
ld [wd528],a
|
||||
ld a,PLAYER_DIR_UP
|
||||
ld [wPlayerMovingDirection],a
|
||||
ld a,1
|
||||
ld [W_REDSHOUSE2CURSCRIPT],a
|
||||
ret
|
||||
|
|
|
@ -67,8 +67,8 @@ Route22Script0: ; 50f00 (14:4f00)
|
|||
ld [hJoyHeld], a
|
||||
ld a, $f0
|
||||
ld [wJoyIgnore], a
|
||||
ld a, $2
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_LEFT
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, [wd7eb]
|
||||
bit 0, a ; is this the rival battle at the beginning of the game?
|
||||
jr nz, .firstRivalBattle
|
||||
|
@ -111,8 +111,8 @@ Route22Script1: ; 50f62 (14:4f62)
|
|||
ld a, [wcf0d]
|
||||
cp $1
|
||||
jr nz, .asm_50f78
|
||||
ld a, $4
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_DOWN
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, SPRITE_FACING_UP
|
||||
jr .asm_50f7a
|
||||
.asm_50f78
|
||||
|
@ -270,13 +270,13 @@ Route22Script4: ; 51087 (14:5087)
|
|||
ld a, [wcf0d]
|
||||
cp $1
|
||||
jr nz, .asm_510a1
|
||||
ld a, $4
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_DOWN
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, SPRITE_FACING_UP
|
||||
jr .asm_510a8
|
||||
.asm_510a1
|
||||
ld a, $2
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_LEFT
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, SPRITE_FACING_RIGHT
|
||||
.asm_510a8
|
||||
ld [hSpriteFacingDirection], a
|
||||
|
@ -314,13 +314,13 @@ Route22Script5: ; 510df (14:50df)
|
|||
ld a, [wcf0d]
|
||||
cp $1
|
||||
jr nz, .asm_510fb
|
||||
ld a, $4
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_DOWN
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, SPRITE_FACING_UP
|
||||
jr .asm_51102
|
||||
.asm_510fb
|
||||
ld a, $2
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_LEFT
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, SPRITE_FACING_RIGHT
|
||||
.asm_51102
|
||||
ld [hSpriteFacingDirection], a
|
||||
|
|
|
@ -22,8 +22,8 @@ Route5GateScript0: ; 1df50 (7:5f50)
|
|||
ld hl, CoordsData_1df8f
|
||||
call ArePlayerCoordsInArray
|
||||
ret nc
|
||||
ld a, $2
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_LEFT
|
||||
ld [wPlayerMovingDirection], a
|
||||
xor a
|
||||
ld [hJoyHeld], a
|
||||
callba RemoveGuardDrink
|
||||
|
|
|
@ -16,8 +16,8 @@ Route6GateScript0: ; 1e04e (7:604e)
|
|||
ld hl, CoordsData_1e08c
|
||||
call ArePlayerCoordsInArray
|
||||
ret nc
|
||||
ld a, $1
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_RIGHT
|
||||
ld [wPlayerMovingDirection], a
|
||||
xor a
|
||||
ld [hJoyHeld], a
|
||||
callba RemoveGuardDrink
|
||||
|
|
|
@ -28,8 +28,8 @@ Route7GateScript0: ; 1e128 (7:6128)
|
|||
ld hl, CoordsData_1e167
|
||||
call ArePlayerCoordsInArray
|
||||
ret nc
|
||||
ld a, $8
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_UP
|
||||
ld [wPlayerMovingDirection], a
|
||||
xor a
|
||||
ld [hJoyHeld], a
|
||||
callba RemoveGuardDrink
|
||||
|
|
|
@ -27,8 +27,8 @@ Route8GateScript0: ; 1e1ee (7:61ee)
|
|||
ld hl, CoordsData_1e22c
|
||||
call ArePlayerCoordsInArray
|
||||
ret nc
|
||||
ld a, $2
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_LEFT
|
||||
ld [wPlayerMovingDirection], a
|
||||
xor a
|
||||
ld [hJoyHeld], a
|
||||
callba RemoveGuardDrink
|
||||
|
|
|
@ -72,8 +72,8 @@ SafariZoneEntranceScriptPointers: ; 751d9 (1d:51d9)
|
|||
ret
|
||||
|
||||
.SafariZoneEntranceScript5
|
||||
ld a, $4
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_DOWN
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld hl, wd790
|
||||
bit 6, [hl]
|
||||
res 6, [hl]
|
||||
|
|
|
@ -199,7 +199,7 @@ MovementData_62216: ; 62216 (18:6216)
|
|||
db $FF
|
||||
|
||||
SilphCo11Script_6221a: ; 6221a (18:621a)
|
||||
ld [wd528], a
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, $3
|
||||
ld [H_SPRITEINDEX], a
|
||||
ld a, b
|
||||
|
@ -213,11 +213,11 @@ SilphCo11Script5: ; 62227 (18:6227)
|
|||
ld a, [wcf0d]
|
||||
cp $1
|
||||
jr z, .asm_6223c
|
||||
ld a, $2
|
||||
ld a, PLAYER_DIR_LEFT
|
||||
ld b, SPRITE_FACING_RIGHT
|
||||
jr .asm_62240
|
||||
.asm_6223c
|
||||
ld a, $8
|
||||
ld a, PLAYER_DIR_UP
|
||||
ld b, SPRITE_FACING_DOWN
|
||||
.asm_62240
|
||||
call SilphCo11Script_6221a
|
||||
|
@ -247,11 +247,11 @@ SilphCo11Script3: ; 6226a (18:626a)
|
|||
ld a, [wcf0d]
|
||||
cp $1
|
||||
jr z, .asm_62284
|
||||
ld a, $2
|
||||
ld a, PLAYER_DIR_LEFT
|
||||
ld b, SPRITE_FACING_RIGHT
|
||||
jr .asm_62288
|
||||
.asm_62284
|
||||
ld a, $8
|
||||
ld a, PLAYER_DIR_UP
|
||||
ld b, SPRITE_FACING_DOWN
|
||||
.asm_62288
|
||||
call SilphCo11Script_6221a
|
||||
|
|
|
@ -127,8 +127,8 @@ SilphCo7Script0: ; 51c23 (14:5c23)
|
|||
ld [hJoyHeld], a
|
||||
ld a, $f0
|
||||
ld [wJoyIgnore], a
|
||||
ld a, $4
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_DOWN
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, $ff
|
||||
ld [wc0ee], a
|
||||
call PlaySound
|
||||
|
@ -209,8 +209,8 @@ SilphCo7Script4: ; 51cc8 (14:5cc8)
|
|||
ld [wJoyIgnore], a
|
||||
ld hl, wd82f
|
||||
set 0, [hl]
|
||||
ld a, $4
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_DOWN
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, $9
|
||||
ld [H_SPRITEINDEX], a
|
||||
ld a, SPRITE_FACING_UP
|
||||
|
|
|
@ -74,8 +74,8 @@ SSAnne2Script_61416: ; 61416 (18:5416)
|
|||
ld a, [W_XCOORD]
|
||||
cp $25
|
||||
jr nz, .asm_61426
|
||||
ld a, $2
|
||||
ld [wd528], a
|
||||
ld a, PLAYER_DIR_LEFT
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, SPRITE_FACING_RIGHT
|
||||
jr .asm_61427
|
||||
.asm_61426
|
||||
|
|
60
wram.asm
60
wram.asm
|
@ -1701,7 +1701,11 @@ W_MONHLEARNSET:: ; d0cc
|
|||
flag_array 50 + 5
|
||||
ds 1
|
||||
|
||||
wd0d4:: ds 3 ; temp storage for hTilesetType
|
||||
wSavedTilesetType:: ; d0d4
|
||||
; saved at the start of a battle and then written back at the end of the battle
|
||||
ds 1
|
||||
|
||||
ds 2
|
||||
|
||||
W_MONHPADDING:: ; d0d7
|
||||
|
||||
|
@ -2066,9 +2070,14 @@ W_SPRITESETID:: ; d3a8
|
|||
; sprite set ID for the current map
|
||||
ds 1
|
||||
|
||||
wd3a9:: ds 1 ; used when getting the object data pointer
|
||||
wd3aa:: ds 3 ; second part of the pointer
|
||||
wd3ad:: ds 1 ; used as the beginning value for copying warp data
|
||||
wObjectDataPointerTemp:: ; d3a9
|
||||
ds 2
|
||||
|
||||
ds 2
|
||||
|
||||
wMapBackgroundTile:: ; d3ad
|
||||
; the tile shown outside the boundaries of the map
|
||||
ds 1
|
||||
|
||||
wNumberOfWarps:: ; d3ae
|
||||
; number of warps in current map
|
||||
|
@ -2084,9 +2093,17 @@ wDestinationWarpID:: ; d42f
|
|||
|
||||
ds 128
|
||||
|
||||
wd4b0:: ds 1 ; number of signs on the map
|
||||
wd4b1:: ds 32 ; starting address for sign coords
|
||||
wd4d1:: ds 16 ; starting address for sign text IDs
|
||||
wNumSigns:: ; d4b0
|
||||
; number of signs in the current map (up to 16)
|
||||
ds 1
|
||||
|
||||
wSignCoords:: ; d4b1
|
||||
; 2 bytes each
|
||||
; Y, X
|
||||
ds 32
|
||||
|
||||
wSignTextIDs:: ; d4d1
|
||||
ds 16
|
||||
|
||||
W_NUMSPRITES:: ; d4e1
|
||||
; number of sprites on the current map
|
||||
|
@ -2107,16 +2124,35 @@ W_MAPSPRITEEXTRADATA:: ; d504
|
|||
; two bytes per sprite (trainer class/item ID, trainer set ID)
|
||||
ds 32
|
||||
|
||||
wd524:: ds 1 ; map height in 2x2 metatiles, also used with checking connections
|
||||
wd525:: ds 1 ; map width in 2x2 metatiles, also used with checking connections
|
||||
wCurrentMapHeight2:: ; d524
|
||||
; map height in 2x2 meta-tiles
|
||||
ds 1
|
||||
|
||||
wCurrentMapWidth2:: ; d525
|
||||
; map width in 2x2 meta-tiles
|
||||
ds 1
|
||||
|
||||
wMapViewVRAMPointer:: ; d526
|
||||
; the address of the upper left corner of the visible portion of the BG tile map in VRAM
|
||||
ds 2
|
||||
|
||||
wd528:: ds 1 ; additional storage for directions
|
||||
wd529:: ds 1 ; same case as above, but used differently
|
||||
wd52a:: ds 1 ; same case as above
|
||||
; In the comments for the player direction variables below, "moving" refers to
|
||||
; both walking and changing facing direction without taking a step.
|
||||
|
||||
wPlayerMovingDirection:: ; d528
|
||||
; if the player is moving, the current direction
|
||||
; if the player is not moving, zero
|
||||
; map scripts write to this in order to change the player's facing direction
|
||||
ds 1
|
||||
|
||||
wPlayerLastStopDirection:: ; d529
|
||||
; the direction in which the player was moving before the player last stopped
|
||||
ds 1
|
||||
|
||||
wPlayerDirection:: ; d52a
|
||||
; if the player is moving, the current direction
|
||||
; if the player is not moving, the last the direction in which the player moved
|
||||
ds 1
|
||||
|
||||
W_TILESETBANK:: ; d52b
|
||||
ds 1
|
||||
|
|
Loading…
Reference in a new issue