Identify wSpriteStateData1 and wSpriteStateData2 offsets, like pokeyellow

This commit is contained in:
Rangi 2020-07-05 17:29:11 -04:00
parent 7ab43f4d17
commit 2b2ed54bbf
62 changed files with 182 additions and 179 deletions

View file

@ -10,7 +10,7 @@ BattleTransition:
; Determine which OAM block is being used by the enemy trainer sprite (if there ; Determine which OAM block is being used by the enemy trainer sprite (if there
; is one). ; is one).
ld hl, wSpriteStateData1 + 2 ld hl, wSpritePlayerStateData1ImageIndex
ld a, [hSpriteIndexOrTextID] ; enemy trainer sprite index (0 if wild battle) ld a, [hSpriteIndexOrTextID] ; enemy trainer sprite index (0 if wild battle)
ld c, a ld c, a
ld b, 0 ld b, 0

View file

@ -88,7 +88,7 @@ GetCoordsInFrontOfPlayer:
ld d, a ld d, a
ld a, [wXCoord] ld a, [wXCoord]
ld e, a ld e, a
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction ld a, [wSpritePlayerStateData1FacingDirection]
and a and a
jr nz, .notFacingDown jr nz, .notFacingDown
; facing down ; facing down

View file

@ -15,7 +15,7 @@ PrintBenchGuyText:
.match .match
ld a, [hli] ld a, [hli]
ld b, a ld b, a
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
cp b cp b
jr nz, .loop ; player isn't facing left at the bench guy jr nz, .loop ; player isn't facing left at the bench guy
ld a, [hl] ld a, [hl]

View file

@ -1,6 +1,6 @@
BillsHousePC: BillsHousePC:
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
ret nz ret nz
CheckEvent EVENT_LEFT_BILLS_HOUSE_AFTER_HELPING CheckEvent EVENT_LEFT_BILLS_HOUSE_AFTER_HELPING

View file

@ -1,6 +1,6 @@
; prints text for bookshelves in buildings without sign events ; prints text for bookshelves in buildings without sign events
PrintBookshelfText:: PrintBookshelfText::
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
jr nz, .noMatch jr nz, .noMatch
; facing up ; facing up

View file

@ -1,5 +1,5 @@
PrintCinnabarQuiz: PrintCinnabarQuiz:
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
ret nz ret nz
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing

View file

@ -3,7 +3,7 @@ GymStatues:
; if in a gym and dont have the corresponding badge, a = GymStatueText1_id and jp PrintPredefTextID ; if in a gym and dont have the corresponding badge, a = GymStatueText1_id and jp PrintPredefTextID
; else ret ; else ret
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
ret nz ret nz
ld hl, .BadgeFlags ld hl, .BadgeFlags

View file

@ -1,5 +1,5 @@
PrintIndigoPlateauHQText: PrintIndigoPlateauHQText:
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
ret nz ret nz
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing

View file

@ -1,5 +1,5 @@
DisplayOakLabEmailText: DisplayOakLabEmailText:
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
ret nz ret nz
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing

View file

@ -1,6 +1,6 @@
OpenPokemonCenterPC: OpenPokemonCenterPC:
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP ; check to see if player is facing up cp SPRITE_FACING_UP
ret nz ret nz
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld a, $1 ld a, $1

View file

@ -1,5 +1,5 @@
Route15GateLeftBinoculars: Route15GateLeftBinoculars:
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
ret nz ret nz
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing

View file

@ -19,7 +19,7 @@ DisplayPokemonCenterDialogue_::
ld hl, NeedYourPokemonText ld hl, NeedYourPokemonText
call PrintText call PrintText
ld a, $18 ld a, $18
ld [wSpriteStateData1 + $12], a ; make the nurse turn to face the machine ld [wSprite01StateData1ImageIndex], a ; make the nurse turn to face the machine
call Delay3 call Delay3
predef HealParty predef HealParty
callba AnimateHealingMachine ; do the healing machine animation callba AnimateHealingMachine ; do the healing machine animation
@ -34,7 +34,7 @@ DisplayPokemonCenterDialogue_::
ld hl, PokemonFightingFitText ld hl, PokemonFightingFitText
call PrintText call PrintText
ld a, $14 ld a, $14
ld [wSpriteStateData1 + $12], a ; make the nurse bow ld [wSprite01StateData1ImageIndex], a ; make the nurse bow
ld c, a ld c, a
call DelayFrames call DelayFrames
jr .done jr .done

View file

@ -41,7 +41,7 @@ DisplayTextIDInit::
; loop to copy C1X9 (direction the sprite is facing) to C2X9 for each sprite ; loop to copy C1X9 (direction the sprite is facing) to C2X9 for each sprite
; this is done because when you talk to an NPC, they turn to look your way ; this is done because when you talk to an NPC, they turn to look your way
; the original direction they were facing must be restored after the dialogue is over ; the original direction they were facing must be restored after the dialogue is over
ld hl, wSpriteStateData1 + $19 ld hl, wSprite01StateData1FacingDirection
ld c, $0f ld c, $0f
ld de, $10 ld de, $10
.spriteFacingDirectionCopyLoop .spriteFacingDirectionCopyLoop
@ -54,7 +54,7 @@ DisplayTextIDInit::
jr nz, .spriteFacingDirectionCopyLoop jr nz, .spriteFacingDirectionCopyLoop
; loop to force all the sprites in the middle of animation to stand still ; loop to force all the sprites in the middle of animation to stand still
; (so that they don't like they're frozen mid-step during the dialogue) ; (so that they don't like they're frozen mid-step during the dialogue)
ld hl, wSpriteStateData1 + 2 ld hl, wSpritePlayerStateData1ImageIndex
ld de, $10 ld de, $10
ld c, e ld c, e
.spriteStandStillLoop .spriteStandStillLoop

View file

@ -9,8 +9,8 @@ SetDefaultNames:
ld bc, wBoxDataEnd - wPlayerName ld bc, wBoxDataEnd - wPlayerName
xor a xor a
call FillMemory call FillMemory
ld hl, wSpriteStateData1 ld hl, wSpriteDataStart
ld bc, $200 ld bc, wSpriteDataEnd - wSpriteDataStart
xor a xor a
call FillMemory call FillMemory
pop af pop af

View file

@ -12,7 +12,7 @@ PlayerStepOutFromDoor::
ld a, D_DOWN ld a, D_DOWN
ld [wSimulatedJoypadStatesEnd], a ld [wSimulatedJoypadStatesEnd], a
xor a xor a
ld [wSpriteStateData1 + 2], a ld [wSpritePlayerStateData1ImageIndex], a
call StartSimulatingJoypadStates call StartSimulatingJoypadStates
ret ret
.notStandingOnDoor .notStandingOnDoor
@ -110,7 +110,7 @@ PalletMovementScript_WalkToLab:
swap a swap a
ld [wNPCMovementScriptSpriteOffset], a ld [wNPCMovementScriptSpriteOffset], a
xor a xor a
ld [wSpriteStateData2 + $06], a ld [wSpritePlayerStateData2MovementByte1], a
ld hl, wSimulatedJoypadStatesEnd ld hl, wSimulatedJoypadStatesEnd
ld de, RLEList_PlayerWalkToLab ld de, RLEList_PlayerWalkToLab
call DecodeRLEList call DecodeRLEList
@ -228,7 +228,7 @@ PewterMovementScript_WalkToGym:
swap a swap a
ld [wNPCMovementScriptSpriteOffset], a ld [wNPCMovementScriptSpriteOffset], a
xor a xor a
ld [wSpriteStateData2 + $06], a ld [wSpritePlayerStateData2MovementByte1], a
ld hl, wSimulatedJoypadStatesEnd ld hl, wSimulatedJoypadStatesEnd
ld de, RLEList_PewterGymPlayer ld de, RLEList_PewterGymPlayer
call DecodeRLEList call DecodeRLEList

View file

@ -127,7 +127,7 @@ CutOrBoulderDustAnimationTilesAndAttributes:
db $FE,$10,$FF,$10 db $FE,$10,$FF,$10
GetCutOrBoulderDustAnimationOffsets: GetCutOrBoulderDustAnimationOffsets:
ld hl, wSpriteStateData1 + 4 ld hl, wSpritePlayerStateData1YPixels
ld a, [hli] ; player's sprite screen Y position ld a, [hli] ; player's sprite screen Y position
ld b, a ld b, a
inc hl inc hl
@ -187,7 +187,7 @@ ReplaceTreeTileBlock:
ld h, [hl] ld h, [hl]
ld l, a ld l, a
add hl, bc add hl, bc
ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction ld a, [wSpritePlayerStateData1FacingDirection]
and a and a
jr z, .down jr z, .down
cp SPRITE_FACING_UP cp SPRITE_FACING_UP

View file

@ -30,7 +30,7 @@ AnimateBoulderDust:
jp LoadPlayerSpriteGraphics jp LoadPlayerSpriteGraphics
GetMoveBoulderDustFunctionPointer: GetMoveBoulderDustFunctionPointer:
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction ld a, [wSpritePlayerStateData1FacingDirection]
ld hl, MoveBoulderDustFunctionPointerTable ld hl, MoveBoulderDustFunctionPointerTable
ld c, a ld c, a
ld b, $0 ld b, $0

View file

@ -38,7 +38,7 @@ EmotionBubble:
jr nz, .loop jr nz, .loop
; get the screen coordinates of the sprite the bubble is to be displayed above ; get the screen coordinates of the sprite the bubble is to be displayed above
ld hl, wSpriteStateData1 + 4 ld hl, wSpritePlayerStateData1YPixels
ld a, [wEmotionBubbleSpriteIndex] ld a, [wEmotionBubbleSpriteIndex]
swap a swap a
ld c, a ld c, a

View file

@ -87,7 +87,7 @@ CheckForHiddenObject::
; checks if the coordinates in front of the player's sprite match Y in b and X in c ; checks if the coordinates in front of the player's sprite match Y in b and X in c
; [hCoordsInFrontOfPlayerMatch] = $00 if they match, $ff if they don't match ; [hCoordsInFrontOfPlayerMatch] = $00 if they match, $ff if they don't match
CheckIfCoordsInFrontOfPlayerMatch: CheckIfCoordsInFrontOfPlayerMatch:
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
jr z, .facingUp jr z, .facingUp
cp SPRITE_FACING_LEFT cp SPRITE_FACING_LEFT

View file

@ -6,7 +6,7 @@ HandleLedges::
and a ; OVERWORLD and a ; OVERWORLD
ret nz ret nz
predef GetTileAndCoordsInFrontOfPlayer predef GetTileAndCoordsInFrontOfPlayer
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
ld b, a ld b, a
aCoord 8, 9 aCoord 8, 9
ld c, a ld c, a

View file

@ -12,8 +12,8 @@ InitMapSprites::
call InitOutsideMapSprites call InitOutsideMapSprites
ret c ; return if the map is an outside map (already handled by above call) ret c ; return if the map is an outside map (already handled by above call)
; if the map is an inside map (i.e. mapID >= $25) ; if the map is an inside map (i.e. mapID >= $25)
ld hl, wSpriteStateData1 ld hl, wSpritePlayerStateData1PictureID
ld de, wSpriteStateData2 + $0d ld de, wSpritePlayerStateData2PictureID
; Loop to copy picture ID's from $C1X0 to $C2XD for LoadMapSpriteTilePatterns. ; Loop to copy picture ID's from $C1X0 to $C2XD for LoadMapSpriteTilePatterns.
.copyPictureIDLoop .copyPictureIDLoop
ld a, [hl] ; $C1X0 (picture ID) ld a, [hl] ; $C1X0 (picture ID)
@ -37,7 +37,7 @@ LoadMapSpriteTilePatterns:
.spritesExist .spritesExist
ld c, a ; c = [wNumSprites] ld c, a ; c = [wNumSprites]
ld b, $10 ; number of sprite slots ld b, $10 ; number of sprite slots
ld hl, wSpriteStateData2 + $0d ld hl, wSpritePlayerStateData2PictureID
xor a xor a
ld [hFourTileSpriteCount], a ld [hFourTileSpriteCount], a
.copyPictureIDLoop ; loop to copy picture ID from $C2XD to $C2XE .copyPictureIDLoop ; loop to copy picture ID from $C2XD to $C2XE
@ -48,9 +48,9 @@ LoadMapSpriteTilePatterns:
ld l, a ld l, a
dec b dec b
jr nz, .copyPictureIDLoop jr nz, .copyPictureIDLoop
ld hl, wSpriteStateData2 + $1e ld hl, wSprite01StateData2ImageBaseOffset
.loadTilePatternLoop .loadTilePatternLoop
ld de, wSpriteStateData2 + $1d ld de, wSprite01StateData2PictureID
; Check if the current picture ID has already had its tile patterns loaded. ; Check if the current picture ID has already had its tile patterns loaded.
; This done by looping through the previous sprite slots and seeing if any of ; This done by looping through the previous sprite slots and seeing if any of
; their picture ID's match that of the current sprite slot. ; their picture ID's match that of the current sprite slot.
@ -70,7 +70,7 @@ LoadMapSpriteTilePatterns:
ld e, a ld e, a
jr .checkIfAlreadyLoadedLoop jr .checkIfAlreadyLoadedLoop
.notAlreadyLoaded .notAlreadyLoaded
ld de, wSpriteStateData2 + $0e ld de, wSpritePlayerStateData2ImageBaseOffset
ld b, $01 ld b, $01
; loop to find the highest tile pattern VRAM slot (among the first 10 slots) used by a previous sprite slot ; loop to find the highest tile pattern VRAM slot (among the first 10 slots) used by a previous sprite slot
; this is done in order to find the first free VRAM slot available ; this is done in order to find the first free VRAM slot available
@ -215,7 +215,7 @@ LoadMapSpriteTilePatterns:
ld l, a ld l, a
dec c dec c
jp nz, .loadTilePatternLoop jp nz, .loadTilePatternLoop
ld hl, wSpriteStateData2 + $0d ld hl, wSpritePlayerStateData2PictureID
ld b, $10 ld b, $10
; the pictures ID's stored at $C2XD are no longer needed, so zero them ; the pictures ID's stored at $C2XD are no longer needed, so zero them
.zeroStoredPictureIDLoop .zeroStoredPictureIDLoop
@ -287,7 +287,7 @@ InitOutsideMapSprites:
jr nc, .noCarry2 jr nc, .noCarry2
inc d inc d
.noCarry2 .noCarry2
ld hl, wSpriteStateData2 + $0d ld hl, wSpritePlayerStateData2PictureID
ld a, SPRITE_RED ld a, SPRITE_RED
ld [hl], a ld [hl], a
ld bc, wSpriteSet ld bc, wSpriteSet
@ -323,7 +323,7 @@ InitOutsideMapSprites:
call LoadMapSpriteTilePatterns call LoadMapSpriteTilePatterns
pop af pop af
ld [wNumSprites], a ; restore number of sprites ld [wNumSprites], a ; restore number of sprites
ld hl, wSpriteStateData2 + $1e ld hl, wSprite01StateData2ImageBaseOffset
ld b, $0f ld b, $0f
; The VRAM tile pattern slots that LoadMapSpriteTilePatterns set are in the ; The VRAM tile pattern slots that LoadMapSpriteTilePatterns set are in the
; order of the map's sprite set, not the order of the actual sprites loaded ; order of the map's sprite set, not the order of the actual sprites loaded
@ -337,7 +337,7 @@ InitOutsideMapSprites:
dec b dec b
jr nz, .zeroVRAMSlotsLoop jr nz, .zeroVRAMSlotsLoop
.skipLoadingSpriteSet .skipLoadingSpriteSet
ld hl, wSpriteStateData1 + $10 ld hl, wSprite01StateData1
; This loop stores the correct VRAM tile pattern slots according the sprite ; This loop stores the correct VRAM tile pattern slots according the sprite
; data from the map's header. Since the VRAM tile pattern slots are filled in ; data from the map's header. Since the VRAM tile pattern slots are filled in
; the order of the sprite set, in order to find the VRAM tile pattern slot ; the order of the sprite set, in order to find the VRAM tile pattern slot

View file

@ -1,13 +1,13 @@
MAP_TILESET_SIZE EQU $60 MAP_TILESET_SIZE EQU $60
UpdatePlayerSprite: UpdatePlayerSprite:
ld a, [wSpriteStateData2] ld a, [wSpritePlayerStateData2WalkAnimationCounter]
and a and a
jr z, .checkIfTextBoxInFrontOfSprite jr z, .checkIfTextBoxInFrontOfSprite
cp $ff cp $ff
jr z, .disableSprite jr z, .disableSprite
dec a dec a
ld [wSpriteStateData2], a ld [wSpritePlayerStateData2WalkAnimationCounter], a
jr .disableSprite jr .disableSprite
; check if a text box is in front of the sprite by checking if the lower left ; check if a text box is in front of the sprite by checking if the lower left
; background tile the sprite is standing on is greater than $5F, which is ; background tile the sprite is standing on is greater than $5F, which is
@ -19,7 +19,7 @@ UpdatePlayerSprite:
jr c, .lowerLeftTileIsMapTile jr c, .lowerLeftTileIsMapTile
.disableSprite .disableSprite
ld a, $ff ld a, $ff
ld [wSpriteStateData1 + 2], a ld [wSpritePlayerStateData1ImageIndex], a
ret ret
.lowerLeftTileIsMapTile .lowerLeftTileIsMapTile
call DetectCollisionBetweenSprites call DetectCollisionBetweenSprites
@ -51,11 +51,11 @@ UpdatePlayerSprite:
.notMoving .notMoving
; zero the animation counters ; zero the animation counters
xor a xor a
ld [wSpriteStateData1 + 7], a ld [wSpritePlayerStateData1IntraAnimFrameCounter], a
ld [wSpriteStateData1 + 8], a ld [wSpritePlayerStateData1AnimFrameCounter], a
jr .calcImageIndex jr .calcImageIndex
.next .next
ld [wSpriteStateData1 + 9], a ; facing direction ld [wSpritePlayerStateData1FacingDirection], a
ld a, [wFontLoaded] ld a, [wFontLoaded]
bit 0, a bit 0, a
jr nz, .notMoving jr nz, .notMoving
@ -79,11 +79,11 @@ UpdatePlayerSprite:
and $3 and $3
ld [hl], a ld [hl], a
.calcImageIndex .calcImageIndex
ld a, [wSpriteStateData1 + 8] ld a, [wSpritePlayerStateData1AnimFrameCounter]
ld b, a ld b, a
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
add b add b
ld [wSpriteStateData1 + 2], a ld [wSpritePlayerStateData1ImageIndex], a
.skipSpriteAnim .skipSpriteAnim
; If the player is standing on a grass tile, make the player's sprite have ; If the player is standing on a grass tile, make the player's sprite have
; lower priority than the background so that it's partially obscured by the ; lower priority than the background so that it's partially obscured by the
@ -97,7 +97,7 @@ UpdatePlayerSprite:
jr nz, .next2 jr nz, .next2
ld a, $80 ld a, $80
.next2 .next2
ld [wSpriteStateData2 + 7], a ld [wSpritePlayerStateData2GrassPriority], a
ret ret
UnusedReadSpriteDataFunction: UnusedReadSpriteDataFunction:
@ -397,7 +397,7 @@ UpdateSpriteMovementDelay:
notYetMoving: notYetMoving:
ld h, wSpriteStateData1 / $100 ld h, wSpriteStateData1 / $100
ld a, [hCurrentSpriteOffset] ld a, [hCurrentSpriteOffset]
add $8 add wSpritePlayerStateData1AnimFrameCounter - wSpritePlayerStateData1
ld l, a ld l, a
ld [hl], $0 ; c1x8 = 0 (walk animation frame) ld [hl], $0 ; c1x8 = 0 (walk animation frame)
jp UpdateSpriteImage jp UpdateSpriteImage
@ -452,7 +452,7 @@ InitializeSpriteStatus:
InitializeSpriteScreenPosition: InitializeSpriteScreenPosition:
ld h, wSpriteStateData2 / $100 ld h, wSpriteStateData2 / $100
ld a, [hCurrentSpriteOffset] ld a, [hCurrentSpriteOffset]
add $4 add wSpritePlayerStateData2MapY - wSpritePlayerStateData2
ld l, a ld l, a
ld a, [wYCoord] ld a, [wYCoord]
ld b, a ld b, a
@ -480,13 +480,13 @@ CheckSpriteAvailability:
jp nz, .spriteInvisible jp nz, .spriteInvisible
ld h, wSpriteStateData2 / $100 ld h, wSpriteStateData2 / $100
ld a, [hCurrentSpriteOffset] ld a, [hCurrentSpriteOffset]
add $6 add wSpritePlayerStateData2MovementByte1 - wSpritePlayerStateData2
ld l, a ld l, a
ld a, [hl] ; c2x6: movement byte 1 ld a, [hl] ; c2x6: movement byte 1
cp $fe cp $fe
jr c, .skipXVisibilityTest ; movement byte 1 < $fe (i.e. the sprite's movement is scripted) jr c, .skipXVisibilityTest ; movement byte 1 < $fe (i.e. the sprite's movement is scripted)
ld a, [hCurrentSpriteOffset] ld a, [hCurrentSpriteOffset]
add $4 add wSpritePlayerStateData2MapY - wSpritePlayerStateData2
ld l, a ld l, a
ld b, [hl] ; c2x4: Y pos (+4) ld b, [hl] ; c2x4: Y pos (+4)
ld a, [wYCoord] ld a, [wYCoord]
@ -528,7 +528,7 @@ CheckSpriteAvailability:
.spriteInvisible .spriteInvisible
ld h, wSpriteStateData1 / $100 ld h, wSpriteStateData1 / $100
ld a, [hCurrentSpriteOffset] ld a, [hCurrentSpriteOffset]
add $2 add wSpritePlayerStateData1ImageIndex - wSpritePlayerStateData1
ld l, a ld l, a
ld [hl], $ff ; c1x2 ld [hl], $ff ; c1x2
scf scf
@ -582,7 +582,7 @@ UpdateSpriteImage:
CanWalkOntoTile: CanWalkOntoTile:
ld h, wSpriteStateData2 / $100 ld h, wSpriteStateData2 / $100
ld a, [hCurrentSpriteOffset] ld a, [hCurrentSpriteOffset]
add $6 add wSpritePlayerStateData2MovementByte1 - wSpritePlayerStateData2
ld l, a ld l, a
ld a, [hl] ; c2x6 (movement byte 1) ld a, [hl] ; c2x6 (movement byte 1)
cp $fe cp $fe
@ -610,7 +610,7 @@ CanWalkOntoTile:
jr z, .impassable ; if $ff, no movement allowed (however, changing direction is) jr z, .impassable ; if $ff, no movement allowed (however, changing direction is)
ld h, wSpriteStateData1 / $100 ld h, wSpriteStateData1 / $100
ld a, [hCurrentSpriteOffset] ld a, [hCurrentSpriteOffset]
add $4 add wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld l, a ld l, a
ld a, [hli] ; c1x4 (screen Y pos) ld a, [hli] ; c1x4 (screen Y pos)
add $4 ; align to blocks (Y pos is always 4 pixels off) add $4 ; align to blocks (Y pos is always 4 pixels off)
@ -636,7 +636,7 @@ CanWalkOntoTile:
jr nz, .impassable ; collision between sprites, don't go there jr nz, .impassable ; collision between sprites, don't go there
ld h, wSpriteStateData2 / $100 ld h, wSpriteStateData2 / $100
ld a, [hCurrentSpriteOffset] ld a, [hCurrentSpriteOffset]
add $2 add wSpritePlayerStateData2YDisplacement - wSpritePlayerStateData2
ld l, a ld l, a
ld a, [hli] ; c2x2 (sprite Y displacement, initialized at $8, keep track of where a sprite did go) ld a, [hli] ; c2x2 (sprite Y displacement, initialized at $8, keep track of where a sprite did go)
bit 7, d ; check if going upwards (d=$ff) bit 7, d ; check if going upwards (d=$ff)
@ -665,7 +665,7 @@ CanWalkOntoTile:
and a ; clear carry (marking success) and a ; clear carry (marking success)
ret ret
.impassable .impassable
ld h, $c1 ld h, wSpriteStateData1 / $100
ld a, [hCurrentSpriteOffset] ld a, [hCurrentSpriteOffset]
inc a inc a
ld l, a ld l, a
@ -693,7 +693,7 @@ CanWalkOntoTile:
GetTileSpriteStandsOn: GetTileSpriteStandsOn:
ld h, wSpriteStateData1 / $100 ld h, wSpriteStateData1 / $100
ld a, [hCurrentSpriteOffset] ld a, [hCurrentSpriteOffset]
add $4 add wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld l, a ld l, a
ld a, [hli] ; c1x4: screen Y position ld a, [hli] ; c1x4: screen Y position
add $4 ; align to 2*2 tile blocks (Y position is always off 4 pixels to the top) add $4 ; align to 2*2 tile blocks (Y position is always off 4 pixels to the top)
@ -807,12 +807,12 @@ InitScriptedNPCMovement:
jp AnimScriptedNPCMovement jp AnimScriptedNPCMovement
GetSpriteScreenYPointer: GetSpriteScreenYPointer:
ld a, $4 ld a, wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld b, a ld b, a
jr GetSpriteScreenXYPointerCommon jr GetSpriteScreenXYPointerCommon
GetSpriteScreenXPointer: GetSpriteScreenXPointer:
ld a, $6 ld a, wSpritePlayerStateData1XPixels - wSpritePlayerStateData1
ld b, a ld b, a
GetSpriteScreenXYPointerCommon: GetSpriteScreenXYPointerCommon:
@ -826,7 +826,7 @@ GetSpriteScreenXYPointerCommon:
AnimScriptedNPCMovement: AnimScriptedNPCMovement:
ld hl, wSpriteStateData2 ld hl, wSpriteStateData2
ld a, [hCurrentSpriteOffset] ld a, [hCurrentSpriteOffset]
add $e add wSpritePlayerStateData2ImageBaseOffset - wSpritePlayerStateData2
ld l, a ld l, a
ld a, [hl] ; VRAM slot ld a, [hl] ; VRAM slot
dec a dec a
@ -834,7 +834,7 @@ AnimScriptedNPCMovement:
ld b, a ld b, a
ld hl, wSpriteStateData1 ld hl, wSpriteStateData1
ld a, [hCurrentSpriteOffset] ld a, [hCurrentSpriteOffset]
add $9 add wSpritePlayerStateData1FacingDirection - wSpritePlayerStateData1
ld l, a ld l, a
ld a, [hl] ; facing direction ld a, [hl] ; facing direction
cp SPRITE_FACING_DOWN cp SPRITE_FACING_DOWN
@ -853,7 +853,7 @@ AnimScriptedNPCMovement:
call AdvanceScriptedNPCAnimFrameCounter call AdvanceScriptedNPCAnimFrameCounter
ld hl, wSpriteStateData1 ld hl, wSpriteStateData1
ld a, [hCurrentSpriteOffset] ld a, [hCurrentSpriteOffset]
add $2 add wSpritePlayerStateData1ImageIndex - wSpritePlayerStateData1
ld l, a ld l, a
ld a, [hSpriteVRAMSlotAndFacing] ld a, [hSpriteVRAMSlotAndFacing]
ld b, a ld b, a

View file

@ -77,14 +77,14 @@ FindPathToPlayer:
CalcPositionOfPlayerRelativeToNPC: CalcPositionOfPlayerRelativeToNPC:
xor a xor a
ld [hNPCPlayerRelativePosFlags], a ld [hNPCPlayerRelativePosFlags], a
ld a, [wSpriteStateData1 + 4] ; player's sprite screen Y position in pixels ld a, [wSpritePlayerStateData1YPixels]
ld d, a ld d, a
ld a, [wSpriteStateData1 + 6] ; player's sprite screen X position in pixels ld a, [wSpritePlayerStateData1XPixels]
ld e, a ld e, a
ld hl, wSpriteStateData1 ld hl, wSpriteStateData1
ld a, [hNPCSpriteOffset] ld a, [hNPCSpriteOffset]
add l add l
add $4 add wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld l, a ld l, a
jr nc, .noCarry jr nc, .noCarry
inc h inc h

View file

@ -1,7 +1,7 @@
EnterMapAnim:: EnterMapAnim::
call InitFacingDirectionList call InitFacingDirectionList
ld a, $ec ld a, $ec
ld [wSpriteStateData1 + 4], a ; player's sprite Y screen position ld [wSpritePlayerStateData1YPixels], a
call Delay3 call Delay3
push hl push hl
call GBFadeInFromWhite call GBFadeInFromWhite
@ -227,19 +227,19 @@ DoFlyAnimation:
ld a, [wFlyAnimBirdSpriteImageIndex] ld a, [wFlyAnimBirdSpriteImageIndex]
xor $1 ; make the bird flap its wings xor $1 ; make the bird flap its wings
ld [wFlyAnimBirdSpriteImageIndex], a ld [wFlyAnimBirdSpriteImageIndex], a
ld [wSpriteStateData1 + 2], a ld [wSpritePlayerStateData1ImageIndex], a
call Delay3 call Delay3
ld a, [wFlyAnimUsingCoordList] ld a, [wFlyAnimUsingCoordList]
cp $ff cp $ff
jr z, .skipCopyingCoords ; if the bird is flapping its wings in place jr z, .skipCopyingCoords ; if the bird is flapping its wings in place
ld hl, wSpriteStateData1 + 4 ld hl, wSpritePlayerStateData1YPixels
ld a, [de] ld a, [de]
inc de inc de
ld [hli], a ld [hli], a ; y
inc hl inc hl
ld a, [de] ld a, [de]
inc de inc de
ld [hl], a ld [hl], a ; x
.skipCopyingCoords .skipCopyingCoords
ld a, [wFlyAnimCounter] ld a, [wFlyAnimCounter]
dec a dec a
@ -258,15 +258,15 @@ LoadBirdSpriteGraphics:
jp CopyVideoData jp CopyVideoData
InitFacingDirectionList: InitFacingDirectionList:
ld a, [wSpriteStateData1 + 2] ; player's sprite facing direction (image index is locked to standing images) ld a, [wSpritePlayerStateData1ImageIndex] ; (image index is locked to standing images)
ld [wSavedPlayerFacingDirection], a ld [wSavedPlayerFacingDirection], a
ld a, [wSpriteStateData1 + 4] ; player's sprite Y screen position ld a, [wSpritePlayerStateData1YPixels]
ld [wSavedPlayerScreenY], a ld [wSavedPlayerScreenY], a
ld hl, PlayerSpinningFacingOrder ld hl, PlayerSpinningFacingOrder
ld de, wFacingDirectionList ld de, wFacingDirectionList
ld bc, 4 ld bc, 4
call CopyData call CopyData
ld a, [wSpriteStateData1 + 2] ; player's sprite facing direction (image index is locked to standing images) ld a, [wSpritePlayerStateData1ImageIndex] ; (image index is locked to standing images)
ld hl, wFacingDirectionList ld hl, wFacingDirectionList
; find the place in the list that matches the current facing direction ; find the place in the list that matches the current facing direction
.loop .loop
@ -284,7 +284,7 @@ PlayerSpinningFacingOrder:
SpinPlayerSprite: SpinPlayerSprite:
; copy the current value from the list into the sprite data and rotate the list ; copy the current value from the list into the sprite data and rotate the list
ld a, [hl] ld a, [hl]
ld [wSpriteStateData1 + 2], a ; player's sprite facing direction (image index is locked to standing images) ld [wSpritePlayerStateData1ImageIndex], a ; (image index is locked to standing images)
push hl push hl
ld hl, wFacingDirectionList ld hl, wFacingDirectionList
ld de, wFacingDirectionList - 1 ld de, wFacingDirectionList - 1
@ -320,9 +320,9 @@ PlayerSpinWhileMovingUpOrDown:
call SpinPlayerSprite call SpinPlayerSprite
ld a, [wPlayerSpinWhileMovingUpOrDownAnimDeltaY] ld a, [wPlayerSpinWhileMovingUpOrDownAnimDeltaY]
ld c, a ld c, a
ld a, [wSpriteStateData1 + 4] ; player's sprite Y screen position ld a, [wSpritePlayerStateData1YPixels]
add c add c
ld [wSpriteStateData1 + 4], a ld [wSpritePlayerStateData1YPixels], a
ld c, a ld c, a
ld a, [wPlayerSpinWhileMovingUpOrDownAnimMaxY] ld a, [wPlayerSpinWhileMovingUpOrDownAnimMaxY]
cp c cp c
@ -334,9 +334,9 @@ PlayerSpinWhileMovingUpOrDown:
RestoreFacingDirectionAndYScreenPos: RestoreFacingDirectionAndYScreenPos:
ld a, [wSavedPlayerScreenY] ld a, [wSavedPlayerScreenY]
ld [wSpriteStateData1 + 4], a ld [wSpritePlayerStateData1YPixels], a
ld a, [wSavedPlayerFacingDirection] ld a, [wSavedPlayerFacingDirection]
ld [wSpriteStateData1 + 2], a ld [wSpritePlayerStateData1ImageIndex], a ; (image index is locked to standing images)
ret ret
; if SGB, 2 frames, else 3 frames ; if SGB, 2 frames, else 3 frames
@ -387,7 +387,7 @@ FishingAnim:
ld a, $4 ld a, $4
ld hl, RedFishingTiles ld hl, RedFishingTiles
call LoadAnimSpriteGfx call LoadAnimSpriteGfx
ld a, [wSpriteStateData1 + 2] ld a, [wSpritePlayerStateData1ImageIndex]
ld c, a ld c, a
ld b, $0 ld b, $0
ld hl, FishingRodOAM ld hl, FishingRodOAM
@ -410,7 +410,7 @@ FishingAnim:
; shake the player's sprite vertically ; shake the player's sprite vertically
ld b, 10 ld b, 10
.loop .loop
ld hl, wSpriteStateData1 + 4 ; player's sprite Y screen position ld hl, wSpritePlayerStateData1YPixels
call .ShakePlayerSprite call .ShakePlayerSprite
ld hl, wOAMBuffer + $9c ld hl, wOAMBuffer + $9c
call .ShakePlayerSprite call .ShakePlayerSprite
@ -420,7 +420,7 @@ FishingAnim:
; If the player is facing up, hide the fishing rod so it doesn't overlap with ; If the player is facing up, hide the fishing rod so it doesn't overlap with
; the exclamation bubble that will be shown next. ; the exclamation bubble that will be shown next.
ld a, [wSpriteStateData1 + 2] ; player's sprite facing direction ld a, [wSpritePlayerStateData1ImageIndex] ; (image index is locked to standing images)
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
jr nz, .skipHidingFishingRod jr nz, .skipHidingFishingRod
ld a, $a0 ld a, $a0
@ -434,7 +434,7 @@ FishingAnim:
predef EmotionBubble predef EmotionBubble
; If the player is facing up, unhide the fishing rod. ; If the player is facing up, unhide the fishing rod.
ld a, [wSpriteStateData1 + 2] ; player's sprite facing direction ld a, [wSpritePlayerStateData1ImageIndex] ; (image index is locked to standing images)
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
jr nz, .skipUnhidingFishingRod jr nz, .skipUnhidingFishingRod
ld a, $44 ld a, $44
@ -507,7 +507,7 @@ _HandleMidJump::
ld hl, PlayerJumpingYScreenCoords ld hl, PlayerJumpingYScreenCoords
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
ld [wSpriteStateData1 + 4], a ; player's sprite y coordinate ld [wSpritePlayerStateData1YPixels], a
ret ret
.finishedJump .finishedJump
ld a, [wWalkCounter] ld a, [wWalkCounter]

View file

@ -88,7 +88,7 @@ IsPlayerFacingEdgeOfMap::
push hl push hl
push de push de
push bc push bc
ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction ld a, [wSpritePlayerStateData1FacingDirection]
srl a srl a
ld c, a ld c, a
ld b, $0 ld b, $0
@ -158,7 +158,7 @@ IsWarpTileInFrontOfPlayer::
ld a, [wCurMap] ld a, [wCurMap]
cp SS_ANNE_BOW cp SS_ANNE_BOW
jr z, IsSSAnneBowWarpTileInFrontOfPlayer jr z, IsSSAnneBowWarpTileInFrontOfPlayer
ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction ld a, [wSpritePlayerStateData1FacingDirection]
srl a srl a
ld c, a ld c, a
ld b, 0 ld b, 0
@ -263,7 +263,7 @@ _GetTileAndCoordsInFrontOfPlayer:
ld d, a ld d, a
ld a, [wXCoord] ld a, [wXCoord]
ld e, a ld e, a
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction ld a, [wSpritePlayerStateData1FacingDirection]
and a ; cp SPRITE_FACING_DOWN and a ; cp SPRITE_FACING_DOWN
jr nz, .notFacingDown jr nz, .notFacingDown
; facing down ; facing down
@ -302,7 +302,7 @@ GetTileTwoStepsInFrontOfPlayer:
ld a, [hli] ld a, [hli]
ld d, a ld d, a
ld e, [hl] ld e, [hl]
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction ld a, [wSpritePlayerStateData1FacingDirection]
and a ; cp SPRITE_FACING_DOWN and a ; cp SPRITE_FACING_DOWN
jr nz, .notFacingDown jr nz, .notFacingDown
; facing down ; facing down
@ -375,7 +375,7 @@ CheckForBoulderCollisionWithSprites:
swap a swap a
ld d, 0 ld d, 0
ld e, a ld e, a
ld hl, wSpriteStateData2 + $14 ld hl, wSprite01StateData2MapY
add hl, de add hl, de
ld a, [hli] ; map Y position ld a, [hli] ; map Y position
ld [hPlayerYCoord], a ld [hPlayerYCoord], a
@ -384,7 +384,7 @@ CheckForBoulderCollisionWithSprites:
ld a, [wNumSprites] ld a, [wNumSprites]
ld c, a ld c, a
ld de, $f ld de, $f
ld hl, wSpriteStateData2 + $14 ld hl, wSprite01StateData2MapY
ld a, [hPlayerFacing] ld a, [hPlayerFacing]
and $3 ; facing up or down? and $3 ; facing up or down?
jr z, .pushingHorizontallyLoop jr z, .pushingHorizontallyLoop

View file

@ -12,7 +12,7 @@ TryPushingBoulder::
ld [wBoulderSpriteIndex], a ld [wBoulderSpriteIndex], a
and a and a
jp z, ResetBoulderPushFlags jp z, ResetBoulderPushFlags
ld hl, wSpriteStateData1 + 1 ld hl, wSpritePlayerStateData1MovementStatus
ld d, $0 ld d, $0
ld a, [hSpriteIndexOrTextID] ld a, [hSpriteIndexOrTextID]
swap a swap a
@ -36,7 +36,7 @@ TryPushingBoulder::
jp nz, ResetBoulderPushFlags jp nz, ResetBoulderPushFlags
ld a, [hJoyHeld] ld a, [hJoyHeld]
ld b, a ld b, a
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
jr z, .pushBoulderUp jr z, .pushBoulderUp
cp SPRITE_FACING_LEFT cp SPRITE_FACING_LEFT

View file

@ -1,10 +1,10 @@
_UpdateSprites:: _UpdateSprites::
ld h, $c1 ld h, $c1
inc h inc h
ld a, $e ; wSpriteStateData2 + $0e ld a, wSpritePlayerStateData2ImageBaseOffset - wSpritePlayerStateData2
.spriteLoop .spriteLoop
ld l, a ld l, a
sub $e sub wSpritePlayerStateData2ImageBaseOffset - wSpritePlayerStateData2
ld c, a ld c, a
ld [hCurrentSpriteOffset], a ld [hCurrentSpriteOffset], a
ld a, [hl] ld a, [hl]
@ -20,7 +20,7 @@ _UpdateSprites::
.skipSprite .skipSprite
ld a, l ld a, l
add $10 ; move to next sprite add $10 ; move to next sprite
cp $e ; test for overflow (back at $0e) cp wSpritePlayerStateData2ImageBaseOffset - wSpritePlayerStateData2 ; test for overflow (back at beginning)
jr nz, .spriteLoop jr nz, .spriteLoop
ret ret
.updateCurrentSprite .updateCurrentSprite

View file

@ -1,6 +1,6 @@
_GetSpritePosition1:: _GetSpritePosition1::
ld hl, wSpriteStateData1 ld hl, wSpriteStateData1
ld de, $4 ld de, wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld a, [wSpriteIndex] ld a, [wSpriteIndex]
ld [hSpriteIndex], a ld [hSpriteIndex], a
call GetSpriteDataPointer call GetSpriteDataPointer
@ -9,7 +9,7 @@ _GetSpritePosition1::
inc hl inc hl
ld a, [hl] ; c1x6 (screen X pos) ld a, [hl] ; c1x6 (screen X pos)
ld [hSpriteScreenXCoord], a ld [hSpriteScreenXCoord], a
ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) ld de, wSpritePlayerStateData2MapY - wSpritePlayerStateData1XPixels
add hl, de add hl, de
ld a, [hli] ; c2x4 (map Y pos) ld a, [hli] ; c2x4 (map Y pos)
ld [hSpriteMapYCoord], a ld [hSpriteMapYCoord], a
@ -19,7 +19,7 @@ _GetSpritePosition1::
_GetSpritePosition2:: _GetSpritePosition2::
ld hl, wSpriteStateData1 ld hl, wSpriteStateData1
ld de, $4 ld de, wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld a, [wSpriteIndex] ld a, [wSpriteIndex]
ld [hSpriteIndex], a ld [hSpriteIndex], a
call GetSpriteDataPointer call GetSpriteDataPointer
@ -28,7 +28,7 @@ _GetSpritePosition2::
inc hl inc hl
ld a, [hl] ; c1x6 (screen X pos) ld a, [hl] ; c1x6 (screen X pos)
ld [wSavedSpriteScreenX], a ld [wSavedSpriteScreenX], a
ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) ld de, wSpritePlayerStateData2MapY - wSpritePlayerStateData1XPixels
add hl, de add hl, de
ld a, [hli] ; c2x4 (map Y pos) ld a, [hli] ; c2x4 (map Y pos)
ld [wSavedSpriteMapY], a ld [wSavedSpriteMapY], a
@ -38,7 +38,7 @@ _GetSpritePosition2::
_SetSpritePosition1:: _SetSpritePosition1::
ld hl, wSpriteStateData1 ld hl, wSpriteStateData1
ld de, $4 ld de, wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld a, [wSpriteIndex] ld a, [wSpriteIndex]
ld [hSpriteIndex], a ld [hSpriteIndex], a
call GetSpriteDataPointer call GetSpriteDataPointer
@ -47,7 +47,7 @@ _SetSpritePosition1::
inc hl inc hl
ld a, [hSpriteScreenXCoord] ; c1x6 (screen X pos) ld a, [hSpriteScreenXCoord] ; c1x6 (screen X pos)
ld [hl], a ld [hl], a
ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) ld de, wSpritePlayerStateData2MapY - wSpritePlayerStateData1XPixels
add hl, de add hl, de
ld a, [hSpriteMapYCoord] ; c2x4 (map Y pos) ld a, [hSpriteMapYCoord] ; c2x4 (map Y pos)
ld [hli], a ld [hli], a
@ -57,7 +57,7 @@ _SetSpritePosition1::
_SetSpritePosition2:: _SetSpritePosition2::
ld hl, wSpriteStateData1 ld hl, wSpriteStateData1
ld de, 4 ld de, wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld a, [wSpriteIndex] ld a, [wSpriteIndex]
ld [hSpriteIndex], a ld [hSpriteIndex], a
call GetSpriteDataPointer call GetSpriteDataPointer
@ -66,7 +66,7 @@ _SetSpritePosition2::
inc hl inc hl
ld a, [wSavedSpriteScreenX] ld a, [wSavedSpriteScreenX]
ld [hl], a ; c1x6 (screen X pos) ld [hl], a ; c1x6 (screen X pos)
ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) ld de, wSpritePlayerStateData2MapY - wSpritePlayerStateData1XPixels
add hl, de add hl, de
ld a, [wSavedSpriteMapY] ld a, [wSavedSpriteMapY]
ld [hli], a ; c2x4 (map Y pos) ld [hli], a ; c2x4 (map Y pos)
@ -165,7 +165,7 @@ TrainerEngage:
push hl push hl
push de push de
ld a, [wTrainerSpriteOffset] ld a, [wTrainerSpriteOffset]
add $2 add wSpritePlayerStateData1ImageIndex - wSpritePlayerStateData1
ld d, $0 ld d, $0
ld e, a ld e, a
ld hl, wSpriteStateData1 ld hl, wSpriteStateData1
@ -176,7 +176,7 @@ TrainerEngage:
jp .noEngage jp .noEngage
.spriteOnScreen .spriteOnScreen
ld a, [wTrainerSpriteOffset] ld a, [wTrainerSpriteOffset]
add $9 add wSpritePlayerStateData1FacingDirection - wSpritePlayerStateData1
ld d, $0 ld d, $0
ld e, a ld e, a
ld hl, wSpriteStateData1 ld hl, wSpriteStateData1
@ -234,7 +234,7 @@ TrainerEngage:
; reads trainer's Y position to wTrainerScreenY and X position to wTrainerScreenX ; reads trainer's Y position to wTrainerScreenY and X position to wTrainerScreenX
ReadTrainerScreenPosition: ReadTrainerScreenPosition:
ld a, [wTrainerSpriteOffset] ld a, [wTrainerSpriteOffset]
add $4 add wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld d, $0 ld d, $0
ld e, a ld e, a
ld hl, wSpriteStateData1 ld hl, wSpriteStateData1
@ -242,7 +242,7 @@ ReadTrainerScreenPosition:
ld a, [hl] ; c1x4 (sprite Y pos) ld a, [hl] ; c1x4 (sprite Y pos)
ld [wTrainerScreenY], a ld [wTrainerScreenY], a
ld a, [wTrainerSpriteOffset] ld a, [wTrainerSpriteOffset]
add $6 add wSpritePlayerStateData1XPixels - wSpritePlayerStateData1
ld d, $0 ld d, $0
ld e, a ld e, a
ld hl, wSpriteStateData1 ld hl, wSpriteStateData1
@ -295,7 +295,7 @@ CheckPlayerIsInFrontOfSprite:
cp POWER_PLANT cp POWER_PLANT
jp z, .engage ; bypass this for power plant to get voltorb fake items to work jp z, .engage ; bypass this for power plant to get voltorb fake items to work
ld a, [wTrainerSpriteOffset] ld a, [wTrainerSpriteOffset]
add $4 add wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld d, $0 ld d, $0
ld e, a ld e, a
ld hl, wSpriteStateData1 ld hl, wSpriteStateData1
@ -307,7 +307,7 @@ CheckPlayerIsInFrontOfSprite:
.notOnTopmostTile .notOnTopmostTile
ld [wTrainerScreenY], a ld [wTrainerScreenY], a
ld a, [wTrainerSpriteOffset] ld a, [wTrainerSpriteOffset]
add $6 add wSpritePlayerStateData1XPixels - wSpritePlayerStateData1
ld d, $0 ld d, $0
ld e, a ld e, a
ld hl, wSpriteStateData1 ld hl, wSpriteStateData1

View file

@ -504,7 +504,7 @@ CableClubLeftGameboy::
ld a, [hSerialConnectionStatus] ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK cp USING_EXTERNAL_CLOCK
ret z ret z
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_RIGHT cp SPRITE_FACING_RIGHT
ret nz ret nz
ld a, [wCurMap] ld a, [wCurMap]
@ -521,7 +521,7 @@ CableClubRightGameboy::
ld a, [hSerialConnectionStatus] ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK cp USING_INTERNAL_CLOCK
ret z ret z
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_LEFT cp SPRITE_FACING_LEFT
ret nz ret nz
ld a, [wCurMap] ld a, [wCurMap]
@ -538,7 +538,7 @@ JustAMomentText::
text_far _JustAMomentText text_far _JustAMomentText
text_end text_end
ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
ret nz ret nz
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing

View file

@ -1,5 +1,5 @@
AbleToPlaySlotsCheck: AbleToPlaySlotsCheck:
ld a, [wSpriteStateData1 + 2] ld a, [wSpritePlayerStateData1ImageIndex]
and $8 and $8
jr z, .done ; not able jr z, .done ; not able
ld b, COIN_CASE ld b, COIN_CASE

View file

@ -111,9 +111,9 @@ ResetPlayerSpriteData::
ld hl, wSpriteStateData2 ld hl, wSpriteStateData2
call ResetPlayerSpriteData_ClearSpriteData call ResetPlayerSpriteData_ClearSpriteData
ld a, $1 ld a, $1
ld [wSpriteStateData1], a ld [wSpritePlayerStateData1PictureID], a
ld [wSpriteStateData2 + $0e], a ld [wSpritePlayerStateData2ImageBaseOffset], a
ld hl, wSpriteStateData1 + 4 ld hl, wSpritePlayerStateData1YPixels
ld [hl], $3c ; set Y screen pos ld [hl], $3c ; set Y screen pos
inc hl inc hl
inc hl inc hl
@ -485,7 +485,7 @@ TextScript_PokemonCenterPC::
StartSimulatingJoypadStates:: StartSimulatingJoypadStates::
xor a xor a
ld [wOverrideSimulatedJoypadStatesMask], a ld [wOverrideSimulatedJoypadStatesMask], a
ld [wSpriteStateData2 + $06], a ; player's sprite movement byte 1 ld [wSpritePlayerStateData2MovementByte1], a
ld hl, wd730 ld hl, wd730
set 7, [hl] set 7, [hl]
ret ret
@ -572,7 +572,7 @@ CheckCoords::
; sets carry if the coordinates are in the array, clears carry if not ; sets carry if the coordinates are in the array, clears carry if not
CheckBoulderCoords:: CheckBoulderCoords::
push hl push hl
ld hl, wSpriteStateData2 + $04 ld hl, wSpritePlayerStateData2MapY
ld a, [hSpriteIndex] ld a, [hSpriteIndex]
swap a swap a
ld d, $0 ld d, $0

View file

@ -149,7 +149,7 @@ OverworldLoopLessDelay::
bit 7, a ; down button bit 7, a ; down button
jr z, .checkIfUpButtonIsPressed jr z, .checkIfUpButtonIsPressed
ld a, 1 ld a, 1
ld [wSpriteStateData1 + 3], a ; delta Y ld [wSpritePlayerStateData1YStepVector], a
ld a, PLAYER_DIR_DOWN ld a, PLAYER_DIR_DOWN
jr .handleDirectionButtonPress jr .handleDirectionButtonPress
@ -157,7 +157,7 @@ OverworldLoopLessDelay::
bit 6, a ; up button bit 6, a ; up button
jr z, .checkIfLeftButtonIsPressed jr z, .checkIfLeftButtonIsPressed
ld a, -1 ld a, -1
ld [wSpriteStateData1 + 3], a ; delta Y ld [wSpritePlayerStateData1YStepVector], a
ld a, PLAYER_DIR_UP ld a, PLAYER_DIR_UP
jr .handleDirectionButtonPress jr .handleDirectionButtonPress
@ -165,7 +165,7 @@ OverworldLoopLessDelay::
bit 5, a ; left button bit 5, a ; left button
jr z, .checkIfRightButtonIsPressed jr z, .checkIfRightButtonIsPressed
ld a, -1 ld a, -1
ld [wSpriteStateData1 + 5], a ; delta X ld [wSpritePlayerStateData1XStepVector], a
ld a, PLAYER_DIR_LEFT ld a, PLAYER_DIR_LEFT
jr .handleDirectionButtonPress jr .handleDirectionButtonPress
@ -173,7 +173,7 @@ OverworldLoopLessDelay::
bit 4, a ; right button bit 4, a ; right button
jr z, .noDirectionButtonsPressed jr z, .noDirectionButtonsPressed
ld a, 1 ld a, 1
ld [wSpriteStateData1 + 5], a ; delta X ld [wSpritePlayerStateData1XStepVector], a
.handleDirectionButtonPress .handleDirectionButtonPress
@ -1133,7 +1133,7 @@ IsSpriteInFrontOfPlayer::
ld d, $10 ; talking range in pixels (normal range) ld d, $10 ; talking range in pixels (normal range)
IsSpriteInFrontOfPlayer2:: IsSpriteInFrontOfPlayer2::
lb bc, $3c, $40 ; 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 ld a, [wSpritePlayerStateData1FacingDirection]
.checkIfPlayerFacingUp .checkIfPlayerFacingUp
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
jr nz, .checkIfPlayerFacingDown jr nz, .checkIfPlayerFacingDown
@ -1176,7 +1176,7 @@ IsSpriteInFrontOfPlayer2::
and a and a
ret z ret z
; if there are sprites ; if there are sprites
ld hl, wSpriteStateData1 + $10 ld hl, wSprite01StateData1
ld d, a ld d, a
ld e, $01 ld e, $01
.spriteLoop .spriteLoop
@ -1228,7 +1228,7 @@ CollisionCheckOnLand::
jr nz, .noCollision ; no collisions when the player's movements are being controlled by the game jr nz, .noCollision ; no collisions when the player's movements are being controlled by the game
ld a, [wPlayerDirection] ; 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 d, a
ld a, [wSpriteStateData1 + 12] ; the player sprite's collision data (bit field) (set in the sprite movement code) ld a, [wSpritePlayerStateData1CollisionData]
and d ; check if a sprite is in the direction the player is trying to go and d ; check if a sprite is in the direction the player is trying to go
jr nz, .collision jr nz, .collision
xor a xor a
@ -1462,9 +1462,9 @@ LoadCurrentMapView::
ret ret
AdvancePlayerSprite:: AdvancePlayerSprite::
ld a, [wSpriteStateData1 + 3] ; delta Y ld a, [wSpritePlayerStateData1YStepVector]
ld b, a ld b, a
ld a, [wSpriteStateData1 + 5] ; delta X ld a, [wSpritePlayerStateData1XStepVector]
ld c, a ld c, a
ld hl, wWalkCounter ; walking animation counter ld hl, wWalkCounter ; walking animation counter
dec [hl] dec [hl]
@ -1596,7 +1596,7 @@ AdvancePlayerSprite::
call MoveTileBlockMapPointerNorth call MoveTileBlockMapPointerNorth
.updateMapView .updateMapView
call LoadCurrentMapView call LoadCurrentMapView
ld a, [wSpriteStateData1 + 3] ; delta Y ld a, [wSpritePlayerStateData1YStepVector]
cp $01 cp $01
jr nz, .checkIfMovingNorth2 jr nz, .checkIfMovingNorth2
; if moving south ; if moving south
@ -1609,7 +1609,7 @@ AdvancePlayerSprite::
call ScheduleNorthRowRedraw call ScheduleNorthRowRedraw
jr .scrollBackgroundAndSprites jr .scrollBackgroundAndSprites
.checkIfMovingEast2 .checkIfMovingEast2
ld a, [wSpriteStateData1 + 5] ; delta X ld a, [wSpritePlayerStateData1XStepVector]
cp $01 cp $01
jr nz, .checkIfMovingWest2 jr nz, .checkIfMovingWest2
; if moving east ; if moving east
@ -1621,9 +1621,9 @@ AdvancePlayerSprite::
; if moving west ; if moving west
call ScheduleWestColumnRedraw call ScheduleWestColumnRedraw
.scrollBackgroundAndSprites .scrollBackgroundAndSprites
ld a, [wSpriteStateData1 + 3] ; delta Y ld a, [wSpritePlayerStateData1YStepVector]
ld b, a ld b, a
ld a, [wSpriteStateData1 + 5] ; delta X ld a, [wSpritePlayerStateData1XStepVector]
ld c, a ld c, a
sla b sla b
sla c sla c
@ -1635,7 +1635,7 @@ AdvancePlayerSprite::
ld [hSCX], a ; update background scroll X ld [hSCX], a ; update background scroll X
; shift all the sprites in the direction opposite of the player's motion ; shift all the sprites in the direction opposite of the player's motion
; so that the player appears to move relative to them ; so that the player appears to move relative to them
ld hl, wSpriteStateData1 + $14 ld hl, wSprite01StateData1YPixels
ld a, [wNumSprites] ; number of sprites ld a, [wNumSprites] ; number of sprites
and a ; are there any sprites? and a ; are there any sprites?
jr z, .done jr z, .done
@ -1845,8 +1845,8 @@ DrawTileBlock::
; function to update joypad state and simulate button presses ; function to update joypad state and simulate button presses
JoypadOverworld:: JoypadOverworld::
xor a xor a
ld [wSpriteStateData1 + 3], a ld [wSpritePlayerStateData1YStepVector], a
ld [wSpriteStateData1 + 5], a ld [wSpritePlayerStateData1XStepVector], a
call RunMapScript call RunMapScript
call Joypad call Joypad
ld a, [wFlags_D733] ld a, [wFlags_D733]
@ -1920,7 +1920,7 @@ CollisionCheckOnWater::
jp nz, .noCollision ; return and clear carry if button presses are being simulated jp nz, .noCollision ; return and clear carry if button presses are being simulated
ld a, [wPlayerDirection] ; 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 d, a
ld a, [wSpriteStateData1 + 12] ; the player sprite's collision data (bit field) (set in the sprite movement code) ld a, [wSpritePlayerStateData1CollisionData]
and d ; check if a sprite is in the direction the player is trying to go and d ; check if a sprite is in the direction the player is trying to go
jr nz, .checkIfNextTileIsPassable ; bug? jr nz, .checkIfNextTileIsPassable ; bug?
ld hl, TilePairCollisionsWater ld hl, TilePairCollisionsWater
@ -2168,8 +2168,8 @@ LoadMapHeader::
ld [wNumSprites], a ; save the number of sprites ld [wNumSprites], a ; save the number of sprites
push hl push hl
; zero C110-C1FF and C210-C2FF ; zero C110-C1FF and C210-C2FF
ld hl, wSpriteStateData1 + $10 ld hl, wSprite01StateData1
ld de, wSpriteStateData2 + $10 ld de, wSprite01StateData2
xor a xor a
ld b, $f0 ld b, $f0
.zeroSpriteDataLoop .zeroSpriteDataLoop
@ -2179,7 +2179,7 @@ LoadMapHeader::
dec b dec b
jr nz, .zeroSpriteDataLoop jr nz, .zeroSpriteDataLoop
; initialize all C100-C1FF sprite entries to disabled (other than player's) ; initialize all C100-C1FF sprite entries to disabled (other than player's)
ld hl, wSpriteStateData1 + $12 ld hl, wSprite01StateData1ImageIndex
ld de, $10 ld de, $10
ld c, $0f ld c, $0f
.disableSpriteEntriesLoop .disableSpriteEntriesLoop
@ -2188,7 +2188,7 @@ LoadMapHeader::
dec c dec c
jr nz, .disableSpriteEntriesLoop jr nz, .disableSpriteEntriesLoop
pop hl pop hl
ld de, wSpriteStateData1 + $10 ld de, wSprite01StateData1
ld a, [wNumSprites] ; number of sprites ld a, [wNumSprites] ; number of sprites
and a ; are there any sprites? and a ; are there any sprites?
jp z, .finishUp ; if there are no sprites, skip the rest jp z, .finishUp ; if there are no sprites, skip the rest

View file

@ -111,7 +111,7 @@ CloseTextDisplay::
xor a xor a
ld [hAutoBGTransferEnabled], a ; disable continuous WRAM to VRAM transfer each V-blank ld [hAutoBGTransferEnabled], a ; disable continuous WRAM to VRAM transfer each V-blank
; loop to make sprites face the directions they originally faced before the dialogue ; loop to make sprites face the directions they originally faced before the dialogue
ld hl, wSpriteStateData2 + $19 ld hl, wSprite01StateData2 + 9 ; should be wSprite01StateData1FacingDirection?
ld c, $0f ld c, $0f
ld de, $10 ld de, $10
.restoreSpriteFacingDirectionLoop .restoreSpriteFacingDirectionLoop

View file

@ -71,7 +71,9 @@ spritestatedata1: MACRO
\1IntraAnimFrameCounter:: db \1IntraAnimFrameCounter:: db
\1AnimFrameCounter:: db \1AnimFrameCounter:: db
\1FacingDirection:: db \1FacingDirection:: db
ds 6 ds 2
\1CollisionData:: db
ds 3
\1End:: \1End::
ENDM ENDM
@ -85,7 +87,8 @@ spritestatedata2: MACRO
\1MovementByte1:: db \1MovementByte1:: db
\1GrassPriority:: db \1GrassPriority:: db
\1MovementDelay:: db \1MovementDelay:: db
ds 5 ds 4
\1PictureID:: db
\1ImageBaseOffset:: db \1ImageBaseOffset:: db
ds 1 ds 1
\1End:: \1End::

View file

@ -16,7 +16,7 @@ BillsHouseScript0:
ret ret
BillsHouseScript1: BillsHouseScript1:
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
and a ; cp SPRITE_FACING_DOWN and a ; cp SPRITE_FACING_DOWN
ld de, MovementData_1e79c ld de, MovementData_1e79c
jr nz, .notDown jr nz, .notDown

View file

@ -50,7 +50,7 @@ CeruleanCityScript0:
.asm_194e6 .asm_194e6
ld [wPlayerMovingDirection], a ld [wPlayerMovingDirection], a
ld a, b ld a, b
ld [wSpriteStateData1 + 2 * $10 + $9], a ld [wSprite02StateData1FacingDirection], a
call Delay3 call Delay3
ld a, $2 ld a, $2
ld [hSpriteIndexOrTextID], a ld [hSpriteIndexOrTextID], a

View file

@ -35,7 +35,7 @@ CinnabarIslandScript0:
ld [wSimulatedJoypadStatesEnd], a ld [wSimulatedJoypadStatesEnd], a
call StartSimulatingJoypadStates call StartSimulatingJoypadStates
xor a xor a
ld [wSpriteStateData1 + 9], a ld [wSpritePlayerStateData1FacingDirection], a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld a, $1 ld a, $1
ld [wCinnabarIslandCurScript], a ld [wCinnabarIslandCurScript], a

View file

@ -84,7 +84,7 @@ CopycatsHouse2FText6:
CopycatsHouse2FText7: CopycatsHouse2FText7:
text_asm text_asm
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
ld hl, CopycatsHouse2FText_5cd1c ld hl, CopycatsHouse2FText_5cd1c
jr nz, .notUp jr nz, .notUp

View file

@ -492,17 +492,17 @@ OaksLabScript14:
cp $4 cp $4
jr nz, .turnPlayerLeft jr nz, .turnPlayerLeft
ld a, SPRITE_FACING_RIGHT ld a, SPRITE_FACING_RIGHT
ld [wSpriteStateData1 + 9], a ld [wSpritePlayerStateData1FacingDirection], a
jr .done jr .done
.turnPlayerLeft .turnPlayerLeft
ld a, SPRITE_FACING_LEFT ld a, SPRITE_FACING_LEFT
ld [wSpriteStateData1 + 9], a ld [wSpritePlayerStateData1FacingDirection], a
jr .done jr .done
.turnPlayerDown .turnPlayerDown
cp $4 cp $4
ret nz ret nz
xor a ; ld a, SPRITE_FACING_DOWN xor a ; ld a, SPRITE_FACING_DOWN
ld [wSpriteStateData1 + 9], a ld [wSpritePlayerStateData1FacingDirection], a
.done .done
ret ret

View file

@ -94,7 +94,7 @@ PalletTownScript3:
bit 0, a bit 0, a
ret nz ret nz
xor a ; ld a, SPRITE_FACING_DOWN xor a ; ld a, SPRITE_FACING_DOWN
ld [wSpriteStateData1 + 9], a ld [wSpritePlayerStateData1FacingDirection], a
ld a, 1 ld a, 1
ld [wcf0d], a ld [wcf0d], a
ld a, $FC ld a, $FC

View file

@ -46,7 +46,7 @@ Mansion1ReplaceBlock:
ret ret
Mansion1Script_Switches:: Mansion1Script_Switches::
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
ret nz ret nz
xor a xor a

View file

@ -42,7 +42,7 @@ Mansion2Script_5202f:
predef_jump ReplaceTileBlock predef_jump ReplaceTileBlock
Mansion2Script_Switches:: Mansion2Script_Switches::
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
ret nz ret nz
xor a xor a

View file

@ -73,7 +73,7 @@ Mansion3Script_5225b:
ret ret
Mansion3Script_Switches:: Mansion3Script_Switches::
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
ret nz ret nz
xor a xor a

View file

@ -44,7 +44,7 @@ Mansion4Script_523cf:
ret ret
Mansion4Script_Switches:: Mansion4Script_Switches::
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
ret nz ret nz
xor a xor a

View file

@ -75,7 +75,7 @@ PokemonTower6Script4:
ld a, $10 ld a, $10
ld [wSimulatedJoypadStatesEnd], a ld [wSimulatedJoypadStatesEnd], a
xor a xor a
ld [wSpriteStateData2 + $06], a ld [wSpritePlayerStateData2MovementByte1], a
ld [wOverrideSimulatedJoypadStatesMask], a ld [wOverrideSimulatedJoypadStatesMask], a
ld hl, wd730 ld hl, wd730
set 7, [hl] set 7, [hl]

View file

@ -70,7 +70,7 @@ PokemonTower7Script4:
ld [wMissableObjectIndex], a ld [wMissableObjectIndex], a
predef HideObject predef HideObject
ld a, SPRITE_FACING_UP ld a, SPRITE_FACING_UP
ld [wSpriteStateData1 + 9], a ld [wSpritePlayerStateData1FacingDirection], a
ld a, MR_FUJIS_HOUSE ld a, MR_FUJIS_HOUSE
ld [hWarpDestinationMap], a ld [hWarpDestinationMap], a
ld a, $1 ld a, $1

View file

@ -51,7 +51,7 @@ MomHealText2:
RedsHouse1FText2: ; TV RedsHouse1FText2: ; TV
text_asm text_asm
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
ld hl, TVWrongSideText ld hl, TVWrongSideText
jr nz, .notUp jr nz, .notUp

View file

@ -314,7 +314,7 @@ RocketHideout2Script3:
ret ret
LoadSpinnerArrowTiles:: LoadSpinnerArrowTiles::
ld a, [wSpriteStateData1 + 2] ld a, [wSpritePlayerStateData1ImageIndex]
srl a srl a
srl a srl a
ld hl, SpinnerPlayerFacingDirections ld hl, SpinnerPlayerFacingDirections
@ -322,7 +322,7 @@ LoadSpinnerArrowTiles::
ld b, $0 ld b, $0
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
ld [wSpriteStateData1 + 2], a ld [wSpritePlayerStateData1ImageIndex], a
ld a, [wCurMapTileset] ld a, [wCurMapTileset]
cp FACILITY cp FACILITY
ld hl, FacilitySpinnerArrows ld hl, FacilitySpinnerArrows

View file

@ -47,7 +47,7 @@ Route11GateUpstairsText_494a3:
Route11GateUpstairsText3: Route11GateUpstairsText3:
text_asm text_asm
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
jp nz, GateUpstairsScript_PrintIfFacingUp jp nz, GateUpstairsScript_PrintIfFacingUp
CheckEvent EVENT_BEAT_ROUTE12_SNORLAX CheckEvent EVENT_BEAT_ROUTE12_SNORLAX

View file

@ -65,7 +65,7 @@ Route12GateUpstairsText_495c4:
text_end text_end
GateUpstairsScript_PrintIfFacingUp: GateUpstairsScript_PrintIfFacingUp:
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
jr z, .up jr z, .up
ld a, $1 ld a, $1

View file

@ -149,7 +149,7 @@ Route22Script2:
ld a, [wIsInBattle] ld a, [wIsInBattle]
cp $ff cp $ff
jp z, Route22Script_50ece jp z, Route22Script_50ece
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
and a ; cp SPRITE_FACING_DOWN and a ; cp SPRITE_FACING_DOWN
jr nz, .notDown jr nz, .notDown
ld a, SPRITE_FACING_UP ld a, SPRITE_FACING_UP

View file

@ -37,7 +37,7 @@ Route22GateScript_1e6ba:
ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a
ld a, D_DOWN ld a, D_DOWN
ld [wSimulatedJoypadStatesEnd], a ld [wSimulatedJoypadStatesEnd], a
ld [wSpriteStateData1 + 9], a ld [wSpritePlayerStateData1FacingDirection], a
ld [wJoyIgnore], a ld [wJoyIgnore], a
jp StartSimulatingJoypadStates jp StartSimulatingJoypadStates

View file

@ -118,7 +118,7 @@ Route23Script_512d8:
ld a, D_DOWN ld a, D_DOWN
ld [wSimulatedJoypadStatesEnd], a ld [wSimulatedJoypadStatesEnd], a
xor a xor a
ld [wSpriteStateData1 + 9], a ld [wSpritePlayerStateData1FacingDirection], a
ld [wJoyIgnore], a ld [wJoyIgnore], a
jp StartSimulatingJoypadStates jp StartSimulatingJoypadStates

View file

@ -60,7 +60,7 @@ Route6GateScript_1e0a1:
ld a, $1 ld a, $1
ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a
xor a xor a
ld [wSpriteStateData2 + $06], a ld [wSpritePlayerStateData2MovementByte1], a
ld [wOverrideSimulatedJoypadStatesMask], a ld [wOverrideSimulatedJoypadStatesMask], a
ret ret

View file

@ -17,7 +17,7 @@ Route7GateScript_1e111:
ld a, $1 ld a, $1
ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a
xor a xor a
ld [wSpriteStateData2 + $06], a ld [wSpritePlayerStateData2MovementByte1], a
ld [wOverrideSimulatedJoypadStatesMask], a ld [wOverrideSimulatedJoypadStatesMask], a
ret ret

View file

@ -16,7 +16,7 @@ Route8GateScript_1e1d7:
ld a, $1 ld a, $1
ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a
xor a xor a
ld [wSpriteStateData2 + $06], a ld [wSpritePlayerStateData2MovementByte1], a
ld [wOverrideSimulatedJoypadStatesMask], a ld [wOverrideSimulatedJoypadStatesMask], a
ret ret

View file

@ -25,7 +25,7 @@ SafariZoneGate_ScriptPointers:
xor a xor a
ld [hJoyHeld], a ld [hJoyHeld], a
ld a, SPRITE_FACING_RIGHT ld a, SPRITE_FACING_RIGHT
ld [wSpriteStateData1 + 9], a ld [wSpritePlayerStateData1FacingDirection], a
ld a, [wCoordIndex] ld a, [wCoordIndex]
cp $1 cp $1
jr z, .asm_7520f jr z, .asm_7520f
@ -231,7 +231,7 @@ SafariZoneGate_TextPointers:
ld hl, .SafariZoneEntranceText_753bb ld hl, .SafariZoneEntranceText_753bb
call PrintText call PrintText
xor a xor a
ld [wSpriteStateData1 + 9], a ld [wSpritePlayerStateData1FacingDirection], a
ld a, D_DOWN ld a, D_DOWN
ld c, $3 ld c, $3
call SafariZoneEntranceAutoWalk call SafariZoneEntranceAutoWalk
@ -243,7 +243,7 @@ SafariZoneGate_TextPointers:
ld hl, .SafariZoneEntranceText_753c0 ld hl, .SafariZoneEntranceText_753c0
call PrintText call PrintText
ld a, SPRITE_FACING_UP ld a, SPRITE_FACING_UP
ld [wSpriteStateData1 + 9], a ld [wSpritePlayerStateData1FacingDirection], a
ld a, D_UP ld a, D_UP
ld c, $1 ld c, $1
call SafariZoneEntranceAutoWalk call SafariZoneEntranceAutoWalk

View file

@ -109,7 +109,7 @@ SeafoamIslands4Script2:
dec a dec a
ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a
xor a xor a
ld [wSpriteStateData2 + $06], a ld [wSpritePlayerStateData2MovementByte1], a
ld hl, wd730 ld hl, wd730
set 7, [hl] set 7, [hl]
ld hl, wFlags_D733 ld hl, wFlags_D733

View file

@ -14,20 +14,20 @@ TradeCenter_Script:
bit 0, [hl] bit 0, [hl]
set 0, [hl] set 0, [hl]
ret nz ret nz
ld hl, wSpriteStateData2 + $14 ld hl, wSprite01StateData2MapY
ld a, $8 ld a, $8
ld [hli], a ld [hli], a
ld a, $a ld a, $a
ld [hl], a ld [hl], a
ld a, SPRITE_FACING_LEFT ld a, SPRITE_FACING_LEFT
ld [wSpriteStateData1 + $19], a ld [wSprite01StateData1FacingDirection], a
ld a, [hSerialConnectionStatus] ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK cp USING_INTERNAL_CLOCK
ret z ret z
ld a, $7 ld a, $7
ld [wSpriteStateData2 + $15], a ld [wSprite01StateData2MapX], a
ld a, SPRITE_FACING_RIGHT ld a, SPRITE_FACING_RIGHT
ld [wSpriteStateData1 + $19], a ld [wSprite01StateData1FacingDirection], a
ret ret
TradeCenter_TextPointers: TradeCenter_TextPointers:

View file

@ -38,7 +38,7 @@ VermilionCity_ScriptPointers:
dw VermilionCityScript4 dw VermilionCityScript4
VermilionCityScript0: VermilionCityScript0:
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
and a ; cp SPRITE_FACING_DOWN and a ; cp SPRITE_FACING_DOWN
ret nz ret nz
ld hl, SSAnneTicketCheckCoords ld hl, SSAnneTicketCheckCoords
@ -157,7 +157,7 @@ VermilionCityText3:
text_asm text_asm
CheckEvent EVENT_SS_ANNE_LEFT CheckEvent EVENT_SS_ANNE_LEFT
jr nz, .shipHasDeparted jr nz, .shipHasDeparted
ld a, [wSpriteStateData1 + 9] ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_RIGHT cp SPRITE_FACING_RIGHT
jr z, .greetPlayer jr z, .greetPlayer
ld hl, .inFrontOfOrBehindGuardCoords ld hl, .inFrontOfOrBehindGuardCoords

View file

@ -21,7 +21,7 @@ VermilionDock_Script:
ld a, $3 ld a, $3
ld [wSimulatedJoypadStatesIndex], a ld [wSimulatedJoypadStatesIndex], a
xor a xor a
ld [wSpriteStateData2 + $06], a ld [wSpritePlayerStateData2MovementByte1], a
ld [wOverrideSimulatedJoypadStatesMask], a ld [wOverrideSimulatedJoypadStatesMask], a
dec a dec a
ld [wJoyIgnore], a ld [wJoyIgnore], a
@ -47,7 +47,7 @@ VermilionDock_1db9b:
call PlayMusic call PlayMusic
callba LoadSmokeTileFourTimes callba LoadSmokeTileFourTimes
xor a xor a
ld [wSpriteStateData1 + 2], a ld [wSpritePlayerStateData1ImageIndex], a
ld c, 120 ld c, 120
call DelayFrames call DelayFrames
ld b, $9c ld b, $9c

View file

@ -120,7 +120,7 @@ ViridianCityScript_190cf:
ld a, D_DOWN ld a, D_DOWN
ld [wSimulatedJoypadStatesEnd], a ld [wSimulatedJoypadStatesEnd], a
xor a xor a
ld [wSpriteStateData1 + 9], a ld [wSpritePlayerStateData1FacingDirection], a
ld [wJoyIgnore], a ld [wJoyIgnore], a
ret ret