diff --git a/Masks/mask_routines.asm b/Masks/mask_routines.asm index dae20eb..6f4cf4f 100644 --- a/Masks/mask_routines.asm +++ b/Masks/mask_routines.asm @@ -378,28 +378,28 @@ HandleMovement: { LDA $F0 : AND #$08 : BEQ .not_up LDA $20 : CLC : ADC #-1 : STA $20 - LDY #$00 : JSR DragPlayer_AltEntry + LDY #$00 : JSL DragPlayer LDA #$01 : STA $031C LDA #$05 : STA $3D STZ $2F .not_up LDA $F0 : AND #$04 : BEQ .not_down LDA $20 : CLC : ADC #1 : STA $20 - LDY #$01 : JSR DragPlayer_AltEntry + LDY #$01 : JSL DragPlayer LDA #$02 : STA $031C LDA #$05 : STA $3D LDA #$02 : STA $2F .not_down LDA $F0 : AND #$02 : BEQ .not_left LDA $22 : CLC : ADC #-1 : STA $22 - LDY #$02 : JSR DragPlayer_AltEntry + LDY #$02 : JSL DragPlayer LDA #$03 : STA $031C LDA #$05 : STA $3D LDA #$04 : STA $2F .not_left LDA $F0 : AND #$01 : BEQ .not_right LDA $22 : CLC : ADC #1 : STA $22 - LDY #$03 : JSR DragPlayer_AltEntry + LDY #$03 : JSL DragPlayer LDA #$04 : STA $031C LDA #$05 : STA $3D LDA #$06 : STA $2F diff --git a/Sprites/Objects/minecart.asm b/Sprites/Objects/minecart.asm index b08893f..f2b733c 100644 --- a/Sprites/Objects/minecart.asm +++ b/Sprites/Objects/minecart.asm @@ -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 diff --git a/Sprites/ZSpriteLib/sprite_new_functions.asm b/Sprites/ZSpriteLib/sprite_new_functions.asm index 708f522..d3163a5 100644 --- a/Sprites/ZSpriteLib/sprite_new_functions.asm +++ b/Sprites/ZSpriteLib/sprite_new_functions.asm @@ -154,6 +154,77 @@ Sprite_BounceFromTileCollision: ++ RTL } +; ========================================================= +DragYL = $0B7C +DragYH = $0B7D + +; Parameters: Y index contains direction to drag player +DragPlayer: +{ + 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 + + RTL + + .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 +} + +; ========================================================= + Intro_Dungeon_Main: { ;test to see if we are at a place where a guardian is present @@ -299,7 +370,7 @@ SetupMovieEffect: RTS } -; ; ============================================================================== +; ========================================================= MovieEffect: {