Obj3C:
moveq #0,d0
move.b $24(a0),d0
move.w Obj3C_Index(pc,d0.w),d1
jsr Obj3C_Index(pc,d1.w)
jmp (MarkObjGone).l
; ===========================================================================
Obj3C_Index: dc.w Obj3C_Main-Obj3C_Index
dc.w Obj3C_Solid-Obj3C_Index
dc.w Obj3C_FragMove-Obj3C_Index
; ===========================================================================
Obj3C_Main:
addq.b #2,$24(a0)
move.l #Map_Obj3C,4(a0)
move.w #$450F,2(a0)
move.b #4,1(a0)
move.b #$10,$19(a0)
move.b #4,$18(a0)
move.b $28(a0),$1A(a0)
Obj3C_Solid:
move.w ($FFFFD010).w,$30(a0) ; Load Sonic"s horizontal speed
move.w #$1B,d1
move.w #$20,d2
move.w #$20,d3
move.w 8(a0),d4
cmp.b #3,Current_Character
beq.s Obj3C_SUPER
cmp.b #4,Current_Character
beq.s Obj3C_SUPEr
cmp.b #1,Super_Tails
beq.s Obj3C_SUPER
cmp.b #2,($FFFFFE2C).w
beq.s Obj3C_FireShield
- jsr (SolidObject).l
btst #5,$22(a0)
bne.s Obj3C_ChkROLL
return_D180:
rts
Obj3C_FireShield:
cmp.b #1,($FFFFD180+$1C).w
beq.s Obj3C_Super
bra.s -
; ===========================================================================
Obj3C_Super:
lea ($FFFFD000).w,a1 ;Load Sonic's SST
move.w 8(a1),d0 ; get Sonic's X position
sub.w 8(a0),d0 ;subtract Object's X position for distance
add.w d1,d0 ;add combined width To get distance From left edge
bmi.w return_D180 ;branch if negative (IE Sonic is left of left edge)
move.w d1,d3 ;copy width To d3
add.w d3,d3 ;double d3 for Total width of Object
cmp.w d3,d0 ;compare Total width To distance,To see if Sonic is past right edge
bhi.s return_D180
move.b $16(a1),d3 ;get Sonic's height/2
ext.w d3 ;make 16 bit
add.w d3,d2 ;add To Object height for combined height
move.w $C(a1),d3 ;get Sonic's Y position
sub.w $C(a0),d3 ;subtract Object's Y position for distance
addq.w #4,d3 ;add 4
add.w d2,d3 ;add combined height To get distance From Top edge
bmi.s return_D180 ;branch if negative (IE Sonic is above Object)
move.w d2,d4 ;copy combined height To d4
add.w d4,d4 ;double d4 for Total Sonic + Object height
cmp.w d4,d3 ;compare Total height To distance,To see if Sonic is below botTom edge
bcc.s return_D180 ;branch if he is.
tst.b ($FFFFF7C8).w ;Test "Sonic freeze" byte
bmi.s return_D180 ;branch if Sonic is frozen
cmp.b #6,($FFFFD024).w ;is Sonic dying,or resetting the Level?
bcc.s return_D180 ;branch if he is
tst.w ($FFFFFE08).w ;Is Sonic in debug,item placement,mode?
bne.s return_D180 ;branch if he is
bra.s Obj3C_NoRollChk
Obj3C_ChkRoll:
cmp.b #2,$1C(a1) ; is Sonic rolling?
bne.s return_D180
Obj3C_NoRollChk
move.w $30(a0),d0
bpl.s Obj3C_ChkSpeed
neg.w d0
Obj3C_ChkSpeed:
cmp.b #3,Current_Character
beq.s Obj3C_BREAK
cmp.b #4,Current_Character
beq.s Obj3C_BREAK
cmp.b #1,Super_Tails
beq.s Obj3C_BREAK
cmp.w #$480,d0 ; is Sonic"s speed $480 or higher?
bcs.w return_D180
Obj3C_Break:
move.w $30(a0),$10(a1)
addq.w #4,8(a1)
lea (Obj3C_FragSpd1).l,a4 ; use fragments that move right
move.w 8(a0),d0
cmp.w 8(a1),d0 ; is Sonic To the right of the block?
bcs.s Obj3C_Smash ; if yes,branch
subq.w #8,8(a1)
lea (Obj3C_FragSpd2).l,a4 ; use fragments that move left
Obj3C_Smash:
move.w $10(a1),$14(a1)
bclr #5,$22(a0)
bclr #5,$22(a1)
moveq #7,d1 ; Load 8 fragments
move.w #$70,d2
bsr.s SMASHObject
Obj3C_FragMove:
jsr (SpeedToPos).l
add.w #$70,$12(a0) ; make fragment fall faster
bsr.w DisplaySprite
tst.b 1(a0)
bpl.w DeleteObject
rts