Add DragPlayer for Minecart and DekuHover, uses Y index as parameter for drag direction

This commit is contained in:
scawful
2024-05-12 10:43:46 -04:00
parent 8f9bc12e3c
commit f98a83559a
3 changed files with 106 additions and 81 deletions

View File

@@ -328,7 +328,9 @@ Sprite_Minecart_Main:
JSL Sprite_MoveVert
JSL Sprite_BounceFromTileCollision
JSR DragPlayer
; Get direction of the cart (0 to 3)
LDY.w !SpriteDirection, X
JSL DragPlayer
JSR CheckForPlayerInput
%HandlePlayerCamera()
%MoveCart()
@@ -351,7 +353,9 @@ Sprite_Minecart_Main:
JSL Sprite_MoveHoriz
JSL Sprite_BounceFromTileCollision
JSR DragPlayer
; Get direction of the cart (0 to 3)
LDY.w !SpriteDirection, X
JSL DragPlayer
JSR CheckForPlayerInput
%HandlePlayerCamera()
%MoveCart()
@@ -374,7 +378,9 @@ Sprite_Minecart_Main:
JSL Sprite_MoveVert
JSL Sprite_BounceFromTileCollision
JSR DragPlayer
; Get direction of the cart (0 to 3)
LDY.w !SpriteDirection, X
JSL DragPlayer
JSR CheckForPlayerInput
%HandlePlayerCamera()
%MoveCart()
@@ -397,7 +403,9 @@ Sprite_Minecart_Main:
JSL Sprite_MoveHoriz
JSL Sprite_BounceFromTileCollision
JSR DragPlayer
; Get direction of the cart (0 to 3)
LDY.w !SpriteDirection, X
JSL DragPlayer
JSR CheckForPlayerInput
%HandlePlayerCamera()
%MoveCart()
@@ -730,78 +738,6 @@ CheckSpritePresence:
; =========================================================
DragYL = $0B7C
DragYH = $0B7D
DragPlayer:
{
; Get direction of the cart (0 to 3)
LDY.w !SpriteDirection, X
LDA.w .drag_x_low, Y : CLC : ADC.w DragYL : STA.w DragYL
LDA.w .drag_x_high, Y : ADC.w DragYH : STA DragYH
LDA.w .drag_y_low, Y : CLC : ADC.w $0B7E : STA.w $0B7E
LDA.w .drag_y_high, Y : ADC.w $0B7F : STA.w $0B7F
.SomariaPlatform_DragLink
REP #$20
LDA $0FD8 : SEC : SBC.w #$0002
CMP $22 : BEQ .x_done : BPL .x_too_low
DEC $0B7C
BRA .x_done
.x_too_low
INC $0B7C
.x_done
; Changing the modifier adjusts links position in the cart
LDA $0FDA : SEC : SBC.w #$0008
CMP $20 : BEQ .y_done : BPL .y_too_low
DEC $0B7E
BRA .y_done
.y_too_low
INC $0B7E
.y_done
SEP #$30
RTS
.drag_x_high
db 0, 0, -1, 0
.drag_x_low
db 0, 0, -1, 1
.drag_y_low
db -1, 1, 0, 0
.drag_y_high
db -1, 0, 0, 0
; Alternate drag values provided by Zarby
; .drag_x_high
; db 0, 0, -1, 0, -1
; .drag_x_low
; db 0, 0, -1, 1, -1, 1, 1
; .drag_y_low
; db -1, 1, 0, 0, -1, 1, -1, 1
; .drag_y_high
; db -1, 0, 0, 0, -1, 0, -1, 0
}
; =========================================================
CheckForPlayerInput:
{
LDA $5D : CMP #$02 : BEQ .release
@@ -891,6 +827,24 @@ CheckIfPlayerIsOn:
CLC : RTS ; Return with carry cleared
}
; FollowerDraw_Minecart:
; {
; JSL Minecart_DrawTop
; JSL Minecart_DrawBottom
; RTL
; }
; pushpc
; org $09A41F
; Follower_Minecart:
; {
; }
; pullpc
; =========================================================
; Draw the portion of the cart which is behind the player