minecart check for input from pit collision track tile type

This commit is contained in:
scawful
2024-07-04 13:43:41 -04:00
parent e139f2a8d5
commit f993f48376

View File

@@ -725,6 +725,7 @@ CheckSpritePresence:
} }
; ========================================================= ; =========================================================
; Check for input from the user (u,d,l,r) on tile B6, BD
CheckForPlayerInput: CheckForPlayerInput:
{ {
@@ -736,54 +737,42 @@ CheckForPlayerInput:
LDA.b #$00 : JSL Sprite_GetTileAttr LDA.b #$00 : JSL Sprite_GetTileAttr
; Load the tile index ; Load the tile index
LDA $0FA5 : CLC : CMP.b #$B6 : BNE .cant_input LDA $0FA5 : CLC : CMP.b #$B6 : BEQ .can_input
CMP.b #$BD : BEQ .can_input
BRA .cant_input
.can_input
; Check for input from the user (u,d,l,r)
LDY !SpriteDirection, X LDY !SpriteDirection, X
LDA $F0 : AND .d_pad_press, Y : STA $00 : AND.b #$08 : BEQ .not_pressing_up LDA $F0 : AND .d_pad_press, Y : STA $00 : AND.b #$08 : BEQ .not_pressing_up
LDA.b #$00 : STA !SpriteDirection, X ; Moving Up LDA.b #$00 : STA !SpriteDirection, X ; Moving Up
LDA.b #North : STA !MinecartDirection LDA.b #North : STA !MinecartDirection
STA SprSubtype, X STA SprSubtype, X
%GotoAction(2) ; Minecart_MoveNorth %GotoAction(2) ; Minecart_MoveNorth
BRA .return BRA .return
.not_pressing_up: .not_pressing_up
LDA $00 : AND.b #$04 : BEQ .not_pressing_down LDA.b $00 : AND.b #$04 : BEQ .not_pressing_down
LDA.b #$01 : STA !SpriteDirection, X LDA.b #$01 : STA !SpriteDirection, X
LDA.b #South : STA !MinecartDirection LDA.b #South : STA !MinecartDirection
STA.w SprSubtype, X STA.w SprSubtype, X
%GotoAction(4) ; Minecart_MoveSouth %GotoAction(4) ; Minecart_MoveSouth
BRA .return BRA .return
.not_pressing_down .not_pressing_down
LDA $00 : AND.b #$02 : BEQ .not_pressing_left LDA.b $00 : AND.b #$02 : BEQ .not_pressing_left
LDA.b #$02 : STA !SpriteDirection, X LDA.b #$02 : STA !SpriteDirection, X
LDA.b #West : STA !MinecartDirection LDA.b #West : STA !MinecartDirection
STA.w SprSubtype, X STA.w SprSubtype, X
%GotoAction(5) ; Minecart_MoveWest %GotoAction(5) ; Minecart_MoveWest
BRA .return BRA .return
.not_pressing_left .not_pressing_left
LDA $00 : AND.b #$01 : BEQ .always LDA.b $00 : AND.b #$01 : BEQ .return
LDA.b #$03 : STA !SpriteDirection, X LDA.b #$03 : STA !SpriteDirection, X
LDA.b #East : STA !MinecartDirection LDA.b #East : STA !MinecartDirection
STA SprSubtype, X STA SprSubtype, X
%GotoAction(3) ; Minecart_MoveEast %GotoAction(3) ; Minecart_MoveEast
.always
; LDA !SpriteDirection, X : CMP.b #$03 : BNE .not_going_right
; ; Default heading in reaction to this tile is going up.
; ; LDA.b #$00 : STA !SpriteDirection, X
; .not_going_right
; ;STZ $0D80, X
.return .return
.cant_input .cant_input
RTS RTS