;;; CHECK FOR SOLID TILE, which is tile type 1 in this module.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; In this module, we have
;; 1 = solid
;; 7 = one way platform
;; 9 = prize block, which behaves as a solid
;; 10 (0A) = ladder, whose top behaves like a solid.
;; Here is where we handle the "landing" scenario for all of those possibilities.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;edit pt1;;;;;;;;;;;;;;;;;;;;;;;
; GetCollisionPoint temp, temp1, tempA ;; is it a solid?
; CMP #$01
; BNE +isNotSolid
; JMP +isSolid
; +isNotSolid
GetCollisionPoint temp, temp1, tempA
CMP #$09 ;; is it a conveyor?
BNE +
JMP +isConveyor
+
CMP #$01 ;; is it a solid?
BNE +isNotSolid
JMP +isSolid
+isNotSolid
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;edit pt1;;;;;;;;;;;;;;;;;;;;;
CMP #$07
BNE +isNotOneWaySolid
JMP +isOneWaySolid
+isNotOneWaySolid
CMP #$01
BNE +isNotSolid
JMP +isSolid
+isNotSolid
; CMP #$0A
;BEQ +isLadderSolid
; BNE +isNotSolid
; JMP +isSolid
; +isNotSolid
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;edit pt 2;;;;;;;;;;;;;
; GetCollisionPoint temp3, temp1, tempA ;; is it a solid?
; CMP #$01
; BNE +isNotSolid
; JMP +isSolid
; +isNotSolid
GetCollisionPoint temp, temp1, tempA
CMP #$09 ;; is it a conveyor?
BNE +
JMP +isConveyor
+
CMP #$01 ;; is it a solid?
BNE +isNotSolid
JMP +isSolid
+isNotSolid
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;edit pt 2;;;;;;;;;;;;
CMP #$07
BNE +isNotSolid
JMP +isOneWaySolid
+isNotSolid
CMP #$01;;;;;;;;;;;
BNE +isNotSolid
JMP +isSolid
+isNotSolid
CMP #$0A
BEQ +isLadderSolid
JMP +notSolid
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;edit pt3;;;;;;;;;;;;;;;;
+isConveyor:
LDA Object_v_speed_hi,x
BPL +
JMP +notSolid ;; a conveyor belt is not solid if moving up through it.
+
TYA
AND #%11110000
CLC
ADC Object_v_speed_hi,x
CMP temp1
BEQ +doConvey
BCS +doConvey
JMP +notSolid
+doConvey:
LDA xHold_lo
CLC
ADC #$40 ;; this is the conveyor belt's subpixel speed - adjust to your liking
STA xHold_lo
STA Object_x_lo,x
LDA xHold_hi
ADC #$01 ;; this is the conveyor belt's pixel speed - adjust to your liking
STA xHold_hi
STA Object_x_hi,x
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;edit pt 3;;;;;;;;;;;;;;;;;;;;;;;
+isLadderSolid
LDA Object_v_speed_hi,x
BEQ +checkSolid
BPL +checkSolid
JMP +notSolid
+checkSolid
LDA temp1
SEC
SBC #$02
SEC
SBC Object_v_speed_hi,x
STA tempy
GetCollisionPoint temp, tempy, tempA ;; is it a solid
BEQ +checkForSecondPoint
CMP #$0A
BEQ +notSolid
GetCollisionPoint temp3, tempy, tempA ;; is it a solid?
BEQ +checkForFirstPoint
CMP #$0A
BEQ +notSolid
JMP +isSolid
+checkForSecondPoint
GetCollisionPoint temp3, tempy, tempA ;; is it a solid?
BEQ +isSolid
JMP +notSolid
+checkForFirstPoint
GetCollisionPoint temp, tempy, tempA ;; is it a solid?
BEQ +isSolid
JMP +notSolid
+isOneWaySolid
;; a special kind of solid
LDA Object_v_speed_hi,x
BMI +notSolid ;; a jumpthrough platform is definitely not solid if moving up through it.
;;; however, it is not solid if we haven't cleared it yet.
TYA
AND #%11110000
CLC
ADC Object_v_speed_hi,x
CMP temp1
BEQ +isSolid
BCS +isSolid
JMP +notSolid
+isSolid
JMP isSolidSoLand
+notSolid:
;; is not solid, don't land.
LDA Object_y_lo,x
CLC
ADC Object_v_speed_lo,x
STA yHold_lo
LDA Object_y_hi,x
ADC Object_v_speed_hi,x
STA Object_y_hi,x
STA yHold_hi
LDA Object_v_speed_lo,x
CLC
ADC #GRAVITY_LO
STA Object_v_speed_lo,x
LDA Object_v_speed_hi,x
ADC #GRAVITY_HI
STA Object_v_speed_hi,x
LDA Object_v_speed_hi,x
CMP #MAX_FALL_SPEED
BNE notOverFallSpeed
;; is at least max fall speed.
LDA #$00
STA Object_v_speed_lo,x
notOverFallSpeed:
JMP doneWithGravity
isSolidSoLand:
;; move to position
;;; load the top of the tile that is being run into.
;; force y to tile boundary.
; LDA tileY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;edit;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; AND #%11000000;;edit
; SEC
; SBC self_bottom
; SEC
; SBC #$01
; STA Object_y_hi,x
; STA yHold_hi;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;edit;;;;;;;;;;;;;;;;;;;;;;;;;;
LDA #$00
STA Object_v_speed_lo,x
STA Object_v_speed_hi,x
doneWithGravity:
skipPhysics:speed_hi,x
STA Object_h_speed_lo,x
skipDoHdec:
LDA directionByte
AND #%00001111
STA directionByte
LDA Object_h_speed_lo,x
STA tempA
LDA Object_h_speed_hi,x
STA tempB
LDA Object_direction,x
AND #%01000000
BNE isMovingRight
;isMovingLeft
;;; set to check points 0 and 3 (top left and bottom left.)
LDA collisionsToCheck
ORA #%00001111
STA collisionsToCheck
LDA tempA
CLC
ADC tempB