Move UpdateCachedCoords, RoundCoords to sprite_functions

This commit is contained in:
scawful
2025-02-13 09:18:40 -05:00
parent 875a9b5e89
commit 5a192edf13
2 changed files with 23 additions and 32 deletions

View File

@@ -138,6 +138,27 @@ Sprite_InvertSpeed_Y:
STA.w SprYSpeed, X
RTL
UpdateCachedCoords:
{
LDA.w SprY, X : STA.w SprCachedY+0
LDA.w SprX, X : STA.w SprCachedX+0
LDA.w SprYH, X : STA.w SprCachedY+1
LDA.w SprXH, X : STA.w SprCachedX+1
RTS
}
RoundCoords:
{
; Clamp the Y coord to the nearest multiple of 8.
LDA.b $00 : CLC : ADC.b #$04 : AND.b #$F8 : STA.b $00 : STA.w SprY, X
; Clamp the X coord to the nearest multiple of 8.
LDA.b $02 : CLC : ADC.b #$04 : AND.b #$F8 : STA.b $02 : STA.w SprX, X
JSR UpdateCachedCoords
RTS
}
; =========================================================
Sprite_SelectNewDirection: