Move minecart ram, macros, update formatting and comments
This commit is contained in:
@@ -38,25 +38,6 @@
|
||||
|
||||
; Link is in cart
|
||||
!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
|
||||
!DoubleSpeed = 30
|
||||
|
||||
@@ -81,6 +62,26 @@ Sprite_Minecart_Long:
|
||||
; l - lifting object
|
||||
!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:
|
||||
{
|
||||
PHB : PHK : PLB
|
||||
@@ -98,6 +99,7 @@ Sprite_Minecart_Prep:
|
||||
|
||||
.continue
|
||||
|
||||
; Unused dummy cart code
|
||||
; LDA.w !LinkInCart : AND.b #$FF : BEQ .dummy_continue
|
||||
; JMP .clear_cart
|
||||
|
||||
@@ -132,7 +134,6 @@ Sprite_Minecart_Prep:
|
||||
JMP .done
|
||||
.south
|
||||
LDA #$02 : STA !MinecartDirection
|
||||
; LDA SprX, X : CLC : ADC.b #$01 : STA SprX, X
|
||||
%GotoAction(1) ; Minecart_WaitVert
|
||||
JMP .done
|
||||
.west
|
||||
@@ -172,6 +173,13 @@ macro MoveCart()
|
||||
LDA #$35 : STA $012E ; Cart SFX
|
||||
endmacro
|
||||
|
||||
macro StopCart()
|
||||
STZ $02F5
|
||||
STZ.w SprYSpeed, X
|
||||
STZ.w SprXSpeed, X
|
||||
STZ.w !LinkInCart
|
||||
endmacro
|
||||
|
||||
macro HandleLiftAndToss()
|
||||
LDA.w !LinkCarryOrToss : AND #$02 : BNE .not_tossing
|
||||
; Velocities for cart tossing
|
||||
@@ -266,7 +274,6 @@ Sprite_Minecart_Main:
|
||||
.not_ready
|
||||
.lifting
|
||||
%HandleLiftAndToss()
|
||||
|
||||
RTS
|
||||
}
|
||||
|
||||
@@ -363,12 +370,6 @@ Sprite_Minecart_Main:
|
||||
RTS
|
||||
}
|
||||
|
||||
macro StopCart()
|
||||
STZ $02F5
|
||||
STZ.w SprYSpeed, X
|
||||
STZ.w SprXSpeed, X
|
||||
STZ.w !LinkInCart
|
||||
endmacro
|
||||
|
||||
; -------------------------------------------------------
|
||||
; 0x06
|
||||
@@ -390,7 +391,6 @@ SetTileLookupPosBasedOnDirection:
|
||||
{
|
||||
; Based on the direction of the Minecart, adjust the lookup position
|
||||
; to be in front of the sprite
|
||||
|
||||
LDA.w !MinecartDirection : CMP.b #$00 : BEQ .north
|
||||
CMP.b #$01 : BEQ .east
|
||||
CMP.b #$02 : BEQ .south
|
||||
@@ -531,8 +531,7 @@ HandleTileDirections:
|
||||
}
|
||||
|
||||
.check_direction
|
||||
LDA SprSubtype, X
|
||||
BNE .not_zero
|
||||
LDA SprSubtype, X : BNE .not_zero
|
||||
|
||||
.not_zero
|
||||
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 : LSR : ASL : STA.w SprX, X
|
||||
.x_aligned
|
||||
|
||||
; Check if SprY is already a multiple of 16
|
||||
LDA.w SprY, X : AND #$0F : BEQ .y_aligned
|
||||
LDA.w SprY, X : LSR : ASL : STA.w SprY, X
|
||||
@@ -651,7 +649,6 @@ HandleDynamicSwitchTileDirections:
|
||||
RTS
|
||||
|
||||
.no_b0
|
||||
|
||||
RTS
|
||||
}
|
||||
|
||||
@@ -660,9 +657,7 @@ CheckSpritePresence:
|
||||
{
|
||||
PHX
|
||||
CLC ; Assume sprite ID $B0 is not present
|
||||
|
||||
LDX.b #$10
|
||||
|
||||
.x_loop
|
||||
DEX
|
||||
|
||||
@@ -747,6 +742,7 @@ DragPlayer:
|
||||
.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
|
||||
@@ -1006,6 +1002,9 @@ Sprite_Minecart_DrawBottom:
|
||||
|
||||
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 $0FDA : STA $02
|
||||
|
||||
Reference in New Issue
Block a user