Move minecart ram, macros, update formatting and comments
This commit is contained in:
@@ -38,25 +38,6 @@
|
|||||||
|
|
||||||
; Link is in cart
|
; Link is in cart
|
||||||
!LinkInCart = $35
|
!LinkInCart = $35
|
||||||
|
|
||||||
Sprite_Minecart_Long:
|
|
||||||
{
|
|
||||||
PHB : PHK : PLB
|
|
||||||
|
|
||||||
JSR Sprite_Minecart_DrawTop ; Draws the top half behind Link
|
|
||||||
JSR Sprite_Minecart_DrawBottom ; Draw the bottom half in front of Link
|
|
||||||
JSL Sprite_CheckActive ; Check if game is not paused
|
|
||||||
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
|
|
||||||
|
|
||||||
JSR Sprite_Minecart_Main ; Call the main sprite code
|
|
||||||
|
|
||||||
.SpriteIsNotActive
|
|
||||||
PLB ; Get back the databank we stored previously
|
|
||||||
RTL ; Go back to original code
|
|
||||||
}
|
|
||||||
|
|
||||||
; =========================================================
|
|
||||||
|
|
||||||
!MinecartSpeed = 20
|
!MinecartSpeed = 20
|
||||||
!DoubleSpeed = 30
|
!DoubleSpeed = 30
|
||||||
|
|
||||||
@@ -81,6 +62,26 @@ Sprite_Minecart_Long:
|
|||||||
; l - lifting object
|
; l - lifting object
|
||||||
!LinkCarryOrToss = $0309
|
!LinkCarryOrToss = $0309
|
||||||
|
|
||||||
|
; =========================================================
|
||||||
|
|
||||||
|
Sprite_Minecart_Long:
|
||||||
|
{
|
||||||
|
PHB : PHK : PLB
|
||||||
|
|
||||||
|
JSR Sprite_Minecart_DrawTop ; Draws the top half behind Link
|
||||||
|
JSR Sprite_Minecart_DrawBottom ; Draw the bottom half in front of Link
|
||||||
|
JSL Sprite_CheckActive ; Check if game is not paused
|
||||||
|
BCC .SpriteIsNotActive ; Skip Main code is sprite is innactive
|
||||||
|
|
||||||
|
JSR Sprite_Minecart_Main ; Call the main sprite code
|
||||||
|
|
||||||
|
.SpriteIsNotActive
|
||||||
|
PLB ; Get back the databank we stored previously
|
||||||
|
RTL ; Go back to original code
|
||||||
|
}
|
||||||
|
|
||||||
|
; =========================================================
|
||||||
|
|
||||||
Sprite_Minecart_Prep:
|
Sprite_Minecart_Prep:
|
||||||
{
|
{
|
||||||
PHB : PHK : PLB
|
PHB : PHK : PLB
|
||||||
@@ -98,6 +99,7 @@ Sprite_Minecart_Prep:
|
|||||||
|
|
||||||
.continue
|
.continue
|
||||||
|
|
||||||
|
; Unused dummy cart code
|
||||||
; LDA.w !LinkInCart : AND.b #$FF : BEQ .dummy_continue
|
; LDA.w !LinkInCart : AND.b #$FF : BEQ .dummy_continue
|
||||||
; JMP .clear_cart
|
; JMP .clear_cart
|
||||||
|
|
||||||
@@ -132,7 +134,6 @@ Sprite_Minecart_Prep:
|
|||||||
JMP .done
|
JMP .done
|
||||||
.south
|
.south
|
||||||
LDA #$02 : STA !MinecartDirection
|
LDA #$02 : STA !MinecartDirection
|
||||||
; LDA SprX, X : CLC : ADC.b #$01 : STA SprX, X
|
|
||||||
%GotoAction(1) ; Minecart_WaitVert
|
%GotoAction(1) ; Minecart_WaitVert
|
||||||
JMP .done
|
JMP .done
|
||||||
.west
|
.west
|
||||||
@@ -172,6 +173,13 @@ macro MoveCart()
|
|||||||
LDA #$35 : STA $012E ; Cart SFX
|
LDA #$35 : STA $012E ; Cart SFX
|
||||||
endmacro
|
endmacro
|
||||||
|
|
||||||
|
macro StopCart()
|
||||||
|
STZ $02F5
|
||||||
|
STZ.w SprYSpeed, X
|
||||||
|
STZ.w SprXSpeed, X
|
||||||
|
STZ.w !LinkInCart
|
||||||
|
endmacro
|
||||||
|
|
||||||
macro HandleLiftAndToss()
|
macro HandleLiftAndToss()
|
||||||
LDA.w !LinkCarryOrToss : AND #$02 : BNE .not_tossing
|
LDA.w !LinkCarryOrToss : AND #$02 : BNE .not_tossing
|
||||||
; Velocities for cart tossing
|
; Velocities for cart tossing
|
||||||
@@ -266,7 +274,6 @@ Sprite_Minecart_Main:
|
|||||||
.not_ready
|
.not_ready
|
||||||
.lifting
|
.lifting
|
||||||
%HandleLiftAndToss()
|
%HandleLiftAndToss()
|
||||||
|
|
||||||
RTS
|
RTS
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,12 +370,6 @@ Sprite_Minecart_Main:
|
|||||||
RTS
|
RTS
|
||||||
}
|
}
|
||||||
|
|
||||||
macro StopCart()
|
|
||||||
STZ $02F5
|
|
||||||
STZ.w SprYSpeed, X
|
|
||||||
STZ.w SprXSpeed, X
|
|
||||||
STZ.w !LinkInCart
|
|
||||||
endmacro
|
|
||||||
|
|
||||||
; -------------------------------------------------------
|
; -------------------------------------------------------
|
||||||
; 0x06
|
; 0x06
|
||||||
@@ -390,7 +391,6 @@ SetTileLookupPosBasedOnDirection:
|
|||||||
{
|
{
|
||||||
; Based on the direction of the Minecart, adjust the lookup position
|
; Based on the direction of the Minecart, adjust the lookup position
|
||||||
; to be in front of the sprite
|
; to be in front of the sprite
|
||||||
|
|
||||||
LDA.w !MinecartDirection : CMP.b #$00 : BEQ .north
|
LDA.w !MinecartDirection : CMP.b #$00 : BEQ .north
|
||||||
CMP.b #$01 : BEQ .east
|
CMP.b #$01 : BEQ .east
|
||||||
CMP.b #$02 : BEQ .south
|
CMP.b #$02 : BEQ .south
|
||||||
@@ -531,8 +531,7 @@ HandleTileDirections:
|
|||||||
}
|
}
|
||||||
|
|
||||||
.check_direction
|
.check_direction
|
||||||
LDA SprSubtype, X
|
LDA SprSubtype, X : BNE .not_zero
|
||||||
BNE .not_zero
|
|
||||||
|
|
||||||
.not_zero
|
.not_zero
|
||||||
ASL #2 ; Multiply by 4 (shifting left by 2 bits) to offset rows in the lookup table
|
ASL #2 ; Multiply by 4 (shifting left by 2 bits) to offset rows in the lookup table
|
||||||
@@ -597,7 +596,6 @@ ClampSpritePositionToGrid:
|
|||||||
LDA.w SprX, X : AND #$0F : BEQ .x_aligned
|
LDA.w SprX, X : AND #$0F : BEQ .x_aligned
|
||||||
LDA.w SprX, X : LSR : ASL : STA.w SprX, X
|
LDA.w SprX, X : LSR : ASL : STA.w SprX, X
|
||||||
.x_aligned
|
.x_aligned
|
||||||
|
|
||||||
; Check if SprY is already a multiple of 16
|
; Check if SprY is already a multiple of 16
|
||||||
LDA.w SprY, X : AND #$0F : BEQ .y_aligned
|
LDA.w SprY, X : AND #$0F : BEQ .y_aligned
|
||||||
LDA.w SprY, X : LSR : ASL : STA.w SprY, X
|
LDA.w SprY, X : LSR : ASL : STA.w SprY, X
|
||||||
@@ -651,7 +649,6 @@ HandleDynamicSwitchTileDirections:
|
|||||||
RTS
|
RTS
|
||||||
|
|
||||||
.no_b0
|
.no_b0
|
||||||
|
|
||||||
RTS
|
RTS
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -660,9 +657,7 @@ CheckSpritePresence:
|
|||||||
{
|
{
|
||||||
PHX
|
PHX
|
||||||
CLC ; Assume sprite ID $B0 is not present
|
CLC ; Assume sprite ID $B0 is not present
|
||||||
|
|
||||||
LDX.b #$10
|
LDX.b #$10
|
||||||
|
|
||||||
.x_loop
|
.x_loop
|
||||||
DEX
|
DEX
|
||||||
|
|
||||||
@@ -747,6 +742,7 @@ DragPlayer:
|
|||||||
.drag_y_high
|
.drag_y_high
|
||||||
db -1, 0, 0, 0
|
db -1, 0, 0, 0
|
||||||
|
|
||||||
|
; Alternate drag values provided by Zarby
|
||||||
; .drag_x_high
|
; .drag_x_high
|
||||||
; db 0, 0, -1, 0, -1
|
; db 0, 0, -1, 0, -1
|
||||||
; .drag_x_low
|
; .drag_x_low
|
||||||
@@ -1006,6 +1002,9 @@ Sprite_Minecart_DrawBottom:
|
|||||||
|
|
||||||
PLX
|
PLX
|
||||||
|
|
||||||
|
; Debug box which draws in the location of the hitbox from
|
||||||
|
; the code in HandleTileDirections / SetTileLookupPosBasedOnDirection
|
||||||
|
; The latter of which is an experimental function
|
||||||
; {
|
; {
|
||||||
; LDA $0FD8 : STA $00
|
; LDA $0FD8 : STA $00
|
||||||
; LDA $0FDA : STA $02
|
; LDA $0FDA : STA $02
|
||||||
|
|||||||
Reference in New Issue
Block a user