Move UpdateCachedCoords, RoundCoords to sprite_functions
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -154,10 +154,8 @@ Right = $03
|
||||
Sprite_Minecart_Long:
|
||||
{
|
||||
PHB : PHK : PLB
|
||||
|
||||
JSR Sprite_Minecart_DrawTop ; Draw behind Link
|
||||
JSR Sprite_Minecart_DrawBottom ; Draw in front of Link
|
||||
|
||||
JSL Sprite_CheckActive : BCC .SpriteIsNotActive
|
||||
JSR Sprite_Minecart_Main
|
||||
.SpriteIsNotActive
|
||||
@@ -275,7 +273,6 @@ Sprite_Minecart_Prep:
|
||||
.active2
|
||||
|
||||
STZ.w SprTimerB, X
|
||||
|
||||
LDA.w SprMiscB, X : CMP.b #$00 : BEQ .north
|
||||
CMP.b #$01 : BEQ .east
|
||||
CMP.b #$02 : BEQ .south
|
||||
@@ -1116,33 +1113,6 @@ CheckForTrackTiles:
|
||||
|
||||
; =========================================================
|
||||
|
||||
; NOTE TO SCAWFUL: This function could really go in a generic sprite
|
||||
; functions file but I'll leave that up to you.
|
||||
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
|
||||
}
|
||||
|
||||
; NOTE TO SCAWFUL: This function could really go in a generic sprite
|
||||
; functions file but I'll leave that up to you.
|
||||
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
|
||||
}
|
||||
|
||||
; $04 = sprite index of sprite ID $B0
|
||||
; SEC if sprite is present.
|
||||
CheckTrackSpritePresence:
|
||||
|
||||
Reference in New Issue
Block a user