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