Adjust sensitivity of ice block push

This commit is contained in:
scawful
2025-01-25 11:23:56 -05:00
parent 2303a450dc
commit af0d0e5b5e

View File

@@ -1,7 +1,7 @@
; Pushable Ice Block ; Pushable Ice Block
!SPRID = $D5; The sprite ID you are overwriting (HEX) !SPRID = $D5
!NbrTiles = 03 ; Number of tiles used in a frame !NbrTiles = 02
!Harmless = 01 ; 00 = Sprite is Harmful, 01 = Sprite is Harmless !Harmless = 01 ; 00 = Sprite is Harmful, 01 = Sprite is Harmless
!HVelocity = 00 ; Is your sprite going super fast? put 01 if it is !HVelocity = 00 ; Is your sprite going super fast? put 01 if it is
!Health = 00 ; Number of Health the sprite have !Health = 00 ; Number of Health the sprite have
@@ -11,7 +11,7 @@
!SmallShadow = 00 ; 01 = small shadow, 00 = no shadow !SmallShadow = 00 ; 01 = small shadow, 00 = no shadow
!Shadow = 00 ; 00 = don't draw shadow, 01 = draw a shadow !Shadow = 00 ; 00 = don't draw shadow, 01 = draw a shadow
!Palette = 00 ; Unused in this template (can be 0 to 7) !Palette = 00 ; Unused in this template (can be 0 to 7)
!Hitbox = 00 ; 00 to 31, can be viewed in sprite draw tool !Hitbox = 09 ; 00 to 31, can be viewed in sprite draw tool
!Persist = 00 ; 01 = your sprite continue to live offscreen !Persist = 00 ; 01 = your sprite continue to live offscreen
!Statis = 00 ; 00 = is sprite is alive?, (kill all enemies room) !Statis = 00 ; 00 = is sprite is alive?, (kill all enemies room)
!CollisionLayer = 00 ; 01 = will check both layer for collision !CollisionLayer = 00 ; 01 = will check both layer for collision
@@ -33,11 +33,13 @@
Sprite_IceBlock_Long: Sprite_IceBlock_Long:
{ {
PHB : PHK : PLB PHB : PHK : PLB
LDA.w SprMiscC, X : BEQ .not_being_pushed LDA.w SprMiscC, X : BEQ .not_being_pushed
STZ.w SprMiscC, X STZ.w SprMiscC, X
STZ.b LinkSpeedTbl STZ.b LinkSpeedTbl
STZ.b $48 ; Clear push actions bitfield STZ.b $48 ; Clear push actions bitfield
.not_being_pushed .not_being_pushed
LDA.w SprTimerA, X : BEQ .retain_momentum LDA.w SprTimerA, X : BEQ .retain_momentum
LDA.b #$01 : STA.w SprMiscC, X LDA.b #$01 : STA.w SprMiscC, X
LDA.b #$84 : STA.b $48 ; Set statue and push block actions LDA.b #$84 : STA.b $48 ; Set statue and push block actions
@@ -61,99 +63,93 @@ Sprite_IceBlock_Prep:
LDA.w SprXH, X : STA.w SprMiscF, X LDA.w SprXH, X : STA.w SprMiscF, X
LDA.w SprYH, X : STA.w SprMiscG, X LDA.w SprYH, X : STA.w SprMiscG, X
STZ.w SprDefl, X STZ.w SprDefl, X
LDA.w SprHitbox, X : ORA.b #$09 : STA.w SprHitbox, X
PLB PLB
RTL RTL
} }
Sprite_IceBlock_Main: Sprite_IceBlock_Main:
{ {
LDA.w SprAction, X %PlayAnimation(0, 0, 1)
JSL JumpTableLocal
dw MovementHandler
MovementHandler: JSR Statue_BlockSprites
{ JSL Sprite_CheckDamageFromPlayer : BCC .no_damage
%PlayAnimation(0, 0, 1) LDA.w SprMiscD, X : STA.w SprX, X
LDA.w SprMiscE, X : STA.w SprY, X
LDA.w SprMiscF, X : STA.w SprXH, X
LDA.w SprMiscG, X : STA.w SprYH, X
STZ.w SprXSpeed, X : STZ.w SprYSpeed, X
STZ.w SprTimerA, X : STZ.w SprMiscA, X
.no_damage
JSR Statue_BlockSprites STZ.w $0642
JSL Sprite_CheckDamageFromPlayer : BCC .no_damage JSR Sprite_IceBlock_CheckForSwitch : BCC .no_switch
LDA.w SprMiscD, X : STA.w SprX, X STZ.w SprXSpeed, X : STZ.w SprYSpeed, X
LDA.w SprMiscE, X : STA.w SprY, X LDA.b #$01 : STA.w $0642
LDA.w SprMiscF, X : STA.w SprXH, X .no_switch
LDA.w SprMiscG, X : STA.w SprYH, X
STZ.w SprXSpeed, X : STZ.w SprYSpeed, X
.no_damage
STZ.w $0642 JSL Sprite_Move
JSR Sprite_IceBlock_CheckForSwitch : BCC .no_switch JSL Sprite_Get_16_bit_Coords
STZ.w SprXSpeed, X : STZ.w SprYSpeed, X JSL Sprite_CheckTileCollision
LDA.b #$01 : STA.w $0642 ; ----udlr , u = up, d = down, l = left, r = right
.no_switch LDA.w SprCollision, X : AND.b #$0F : BEQ +
STZ.w SprMiscA, X
+
JSL Sprite_Move ; Sprite MoveXY ; If link is in contact, register a push with the sprite
JSL Sprite_Get_16_bit_Coords ; Get 16bit coords ; Run a timer briefly, and confirm the facing direction
JSL Sprite_CheckTileCollision ; Check Tile collision ; matches the push direction (cached) and then initiate
; ----udlr , u = up, d = down, l = left, r = right ; the speed changes if they agree
LDA.w SprCollision, X : AND.b #$0F : BEQ + JSL Sprite_CheckDamageToPlayerSameLayer : BCC .NotInContact
STZ.w SprMiscA, X LDA.w SprMiscA, X : BNE .push_cached
+ LDA.b $26 : STA.w SprMiscA, X
JSR Sprite_ApplyPush
.push_cached
; TODO: Update Link push collision reaction LDA.b #$07 : STA.w SprTimerA, X
; If link is in contact, register a push with the sprite STZ.b $5E
; Run a timer briefly, and confirm the facing direction JSL Sprite_RepelDash
; matches the push direction (cached) and then initiate LDA.w SprTimerB, X : BNE .CancelHookshot
; the speed changes if they agree LDA.w SprX, X : AND #$F8 : STA.w SprX, X
LDA.w SprY, X : AND #$F8 : STA.w SprY, X
JSL Sprite_CheckDamageToPlayerSameLayer : BCC .NotInContact
LDA.w SprMiscA, X : BNE .push_cached
LDA.b $26 : STA.w SprMiscA, X
JSR ApplyPush
.push_cached
LDA.b #$07 : STA.w SprTimerA, X
STZ.b $5E
JSL Sprite_RepelDash
LDA.w SprTimerB, X : BNE .CancelHookshot
LDA.w SprX, X : AND #$F8 : STA.w SprX, X
LDA.w SprY, X : AND #$F8 : STA.w SprY, X
RTS
.CancelHookshot:
JSL $0FF540
RTS RTS
.NotInContact: .CancelHookshot:
LDA.w SprTimerA, X : BNE .delay_timer JSL Sprite_CancelHookshot
LDA.b #$0D : STA.w SprTimerB, X
.delay_timer
RTS RTS
} .NotInContact:
ApplyPush: LDA.w SprTimerA, X : BNE .delay_timer
{ LDA.b #$0D : STA.w SprTimerB, X
; Only apply the push if the facing direction .delay_timer
; and pushing direction agree with each other RTS
LDA $26 : CMP.b #$01 : BEQ .push_right }
CMP.b #$02 : BEQ .push_left
CMP.b #$04 : BEQ .push_down
CMP.b #$08 : BEQ .push_up
.push_right Sprite_ApplyPush:
LDA #16 : STA.w SprXSpeed, X {
STZ.w SprYSpeed, X ; Only apply the push if the facing direction
JMP + ; and pushing direction agree with each other
.push_left LDA.w SprMiscA, X : CMP.b $26 : BEQ .push
LDA #-16 : STA.w SprXSpeed, X
STZ.w SprYSpeed, X
JMP +
.push_down
STZ.w SprXSpeed, X
LDA #16 : STA.w SprYSpeed, X
JMP +
.push_up
STZ.w SprXSpeed, X
LDA #-16 : STA.w SprYSpeed, X
+
RTS RTS
} .push
LDA $26 : CMP.b #$01 : BEQ .push_right
CMP.b #$02 : BEQ .push_left
CMP.b #$04 : BEQ .push_down
CMP.b #$08 : BEQ .push_up
.push_right
LDA #16 : STA.w SprXSpeed, X : STZ.w SprYSpeed, X
JMP +
.push_left
LDA #-16 : STA.w SprXSpeed, X : STZ.w SprYSpeed, X
JMP +
.push_down
LDA #16 : STA.w SprYSpeed, X : STZ.w SprXSpeed, X
JMP +
.push_up
LDA #-16 : STA.w SprYSpeed, X : STZ.w SprXSpeed, X
+
RTS
} }
; Check if the tile beneath the sprite is the sliding ice ; Check if the tile beneath the sprite is the sliding ice
@@ -164,9 +160,9 @@ IceBlock_CheckForGround:
LDA.w SprYH, X : ADC.b #$00 : STA.b $01 LDA.w SprYH, X : ADC.b #$00 : STA.b $01
LDA.w SprX, X : STA.b $02 LDA.w SprX, X : STA.b $02
LDA.w SprXH, X : ADC.b #$00 : STA.b $03 LDA.w SprXH, X : ADC.b #$00 : STA.b $03
LDA.w $0F20, X LDA.w SprFloor, X
PHY PHY
JSL $06E87B ; GetTileType_long JSL Sprite_GetTileAttr
PLY PLY
LDA.w $0FA5 : CMP.b #$0E : BNE .stop LDA.w $0FA5 : CMP.b #$0E : BNE .stop
@@ -188,10 +184,10 @@ Sprite_IceBlock_CheckForSwitch:
LDA.w SprYH, X : ADC.b #$00 : STA.b $01 LDA.w SprYH, X : ADC.b #$00 : STA.b $01
LDA.w SprX, X : CLC : ADC.w .offset_x, Y : STA.b $02 LDA.w SprX, X : CLC : ADC.w .offset_x, Y : STA.b $02
LDA.w SprXH, X : ADC.b #$00 : STA.b $03 LDA.w SprXH, X : ADC.b #$00 : STA.b $03
LDA.w $0F20, X LDA.w SprFloor, X
PHY PHY
JSL $06E87B ; GetTileType_long JSL Sprite_GetTileAttr
PLY PLY
LDA.w $0FA5 LDA.w $0FA5
@@ -227,8 +223,8 @@ Statue_BlockSprites:
.next .next
; SPRITE 1C ; SPRITE 1C
LDA.w $0E20, Y : CMP.b #$1C : BEQ .skip LDA.w SprType, Y : CMP.b #$1C : BEQ .skip
CPY.w $0FA0 : BEQ .skip CPY.w SprSlot : BEQ .skip
TYA : EOR.b $1A : AND.b #$01 : BNE .skip TYA : EOR.b $1A : AND.b #$01 : BNE .skip
LDA.w SprState, Y : CMP.b #$09 : BCC .skip LDA.w SprState, Y : CMP.b #$09 : BCC .skip
@@ -239,11 +235,13 @@ Statue_BlockSprites:
REP #$20 REP #$20
LDA.w SprCachedX : SEC : SBC.b $04 : CLC : ADC.w #$000C LDA.w SprCachedX
CMP.w #$0018 : BCS .skip SEC : SBC.b $04
CLC : ADC.w #$000C : CMP.w #$0018 : BCS .skip
LDA.w SprCachedY : SEC : SBC.b $06 : CLC : ADC.w #$000C LDA.w SprCachedY
CMP.w #$0024 : BCS .skip SEC : SBC.b $06
CLC : ADC.w #$000C : CMP.w #$0024 : BCS .skip
SEP #$20 SEP #$20