File tree Expand file tree Collapse file tree 1 file changed +111
-2
lines changed
Expand file tree Collapse file tree 1 file changed +111
-2
lines changed Original file line number Diff line number Diff line change @@ -3747,6 +3747,8 @@ advancedTraceDisabled:
37473747
37483748 ; collided. the retain timer needs to be decremented
37493749 dec retain_timer
3750+
3751+ @return:
37503752 rts
37513753
37523754@noCollision:
@@ -3758,6 +3760,110 @@ advancedTraceDisabled:
37583760 bmi @return
37593761
37603762 ; they do
3763+ ; check if there is any collision in that direction
3764+ ; note: this is kinda slow but screw it
3765+ lda player_x
3766+ clc
3767+ adc #plr_x_wj_left
3768+ adc retain_vl_x
3769+ clc
3770+ adc camera_x
3771+ sta x_crd_temp ; x_crd_temp = low bit of check position
3772+ lda camera_x_pg
3773+ adc #0
3774+ ror ; rotate it into carry
3775+ lda x_crd_temp
3776+ ror ; rotate it into the low position
3777+ lsr
3778+ lsr ; finish dividing by the tile size
3779+
3780+ ; store the left X coordinate
3781+ sta temp1
3782+
3783+ lda player_x
3784+ clc
3785+ adc #plr_x_wj_right
3786+ adc retain_vl_x
3787+ clc
3788+ adc camera_x
3789+ sta x_crd_temp
3790+ lda camera_x_pg
3791+ adc #0
3792+ ror
3793+ lda x_crd_temp
3794+ ror
3795+ lsr
3796+ lsr
3797+ ; store the right X coordinate
3798+ sta temp2
3799+
3800+ lda player_y
3801+ clc
3802+ adc #plr_y_top
3803+ lsr
3804+ lsr
3805+ lsr
3806+ ; top Y coordinate
3807+ sta temp3
3808+
3809+ lda player_y
3810+ clc
3811+ adc #plr_y_bot
3812+ lsr
3813+ lsr
3814+ lsr
3815+ ; bottom Y coordinate
3816+ sta temp4
3817+
3818+ lda player_y
3819+ clc
3820+ adc #plr_y_mid
3821+ lsr
3822+ lsr
3823+ lsr
3824+ ; middle Y coordinate
3825+ sta temp5
3826+
3827+ lda gamectrl4
3828+ pha
3829+ ora #g4_nodeath
3830+ sta gamectrl4
3831+
3832+ ; TODO: maybe you can remove some of these depending on the direction
3833+ ; TODO: this seems kinda slow...
3834+
3835+ ldx temp1
3836+ ldy temp3
3837+ jsr xt_collide
3838+ bne @hadcoll
3839+
3840+ ldx temp1
3841+ ldy temp4
3842+ jsr xt_collide
3843+ bne @hadcoll
3844+
3845+ ldx temp1
3846+ ldy temp5
3847+ jsr xt_collide
3848+ bne @hadcoll
3849+
3850+ ldx temp2
3851+ ldy temp3
3852+ jsr xt_collide
3853+ bne @hadcoll
3854+
3855+ ldx temp2
3856+ ldy temp4
3857+ jsr xt_collide
3858+ bne @hadcoll
3859+
3860+ ldx temp2
3861+ ldy temp5
3862+ jsr xt_collide
3863+ bne @hadcoll
3864+
3865+ pla
3866+ sta gamectrl4
37613867 lda retain_vl_x
37623868 sta player_vl_x
37633869 lda retain_vs_x
@@ -3766,8 +3872,11 @@ advancedTraceDisabled:
37663872@clearTimer:
37673873 lda #0
37683874 sta retain_timer
3769-
3770- @return:
3875+ rts
3876+
3877+ @hadcoll:
3878+ pla
3879+ sta gamectrl4
37713880 rts
37723881.endproc
37733882
You can’t perform that action at this time.
0 commit comments