Advertisement
TheBlad768

Cybernetic Colony (Boss)

Sep 3rd, 2018
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; ===========================================================================
  2. ; Boss for GHZ.
  3. ; Version 2.3
  4. ; By TheBlad768 (2016).
  5. ; ===========================================================================
  6.  
  7. ; Universal object variables
  8. obRender:       equ 1   ; .b
  9. obGfx:          equ 2   ; .w
  10. obMap:          equ 4   ; .l
  11. obX:            equ 8   ; .w.l
  12. obScreenY:      equ $A  ; .w
  13. obY:                equ $C  ; .w.l
  14. obVelX:         equ $10 ; .w
  15. obVelY:         equ $12 ; .w
  16. obInertia:      equ $14 ; .w
  17. obHeight:       equ $16 ; .b
  18. obWidth:        equ $17 ; .b
  19. obPriority:     equ $18 ; .b
  20. obActWid:       equ $19 ; .b
  21. obFrame:        equ $1A ; .b
  22. obAnim:         equ $1C ; .b
  23. obColType:      equ $20 ; .b
  24. obColProp:      equ $21 ; .b
  25. obStatus:       equ $22 ; .b
  26. obRoutine:      equ $24 ; .b
  27. ob2ndRout:      equ $25 ; .b
  28. obAngle:            equ $26 ; .b.w
  29. obSubtype:      equ $28 ; .b.w
  30.  
  31. ; Dynamic object variables
  32. ;obNull         equ $2A ; .w
  33. ;obNull         equ $2C ; .w
  34. ;obNull         equ $2E ; .w
  35. obXNext:        equ $30 ; .w
  36. ;obNull         equ $32 ; .w
  37. obParent:       equ $34 ; .w
  38. ;obNull         equ $36 ; .w
  39. obYNext:        equ $38 ; .w
  40. ;obNull         equ $3A ; .w
  41. obTimer:            equ $3C ; .w
  42. obFlash:            equ $3E ; .b
  43. ;obNull         equ $3F ; .b
  44.  
  45. ; =============== S U B R O U T I N E =======================================
  46.  
  47. BossGreenHill:
  48.         lea BossGreenHill_Index(pc),a1
  49.         bra.w   ObjectsRoutine
  50. ; ---------------------------------------------------------------------------
  51.  
  52. BossGreenHill_Index:
  53.         offsetEntry.w BossGreenHill_Init
  54. BossGreenHill_RobotnikShip_Index
  55.         offsetEntry.w BossGreenHill_ShipMain
  56. BossGreenHill_RobotnikFace_Index
  57.         offsetEntry.w ObjBossGreenHill_RobotnikFace
  58. BossGreenHill_RobotnikFlame_Index
  59.         offsetEntry.w ObjBossGreenHill_RobotnikFlame
  60. BossGreenHill_RobotnikGlass_Index
  61.         offsetEntry.w ObjBossGreenHill_RobotnikGlass
  62. BossGreenHill_CircularRing_Index
  63.         offsetEntry.w BossCircularRing
  64. BossGreenHill_ChaseBall_Index
  65.         offsetEntry.w BossChaseBall
  66. BossGreenHill_EggmanLives_Index
  67.         offsetEntry.w Robotnik_HudLives
  68. BossGreenHill_Targetting_Sensor_Index
  69.         offsetEntry.w Targetting_Sensor
  70. BossGreenHill_RobotnikShipCrane_Index
  71.         offsetEntry.w Robotnik_ShipCrane
  72. BossGreenHill_RobotnikRun_Index
  73.         offsetEntry.w Robotnik_Run
  74. ; ---------------------------------------------------------------------------
  75.  
  76. BossGreenHill_Init:
  77.         addq.b  #2,obRoutine(a0)
  78.         lea ObjDat3_BossGreenHill_Robotnik(pc),a1
  79.         bsr.w   LoadObjects_Data
  80.         move.w  obX(a0),obXNext(a0)
  81.         move.w  obY(a0),obYNext(a0)
  82.         move.b  #$18,obHeight(a0)
  83.         move.b  #16,obColProp(a0)
  84.         lea ChildObjDat_RobotnikGlassFaceAndFlame(pc),a2
  85.         bsr.w   Create_ChildObject
  86.  
  87. BossGreenHill_Hud:
  88.         lea ChildObjDat_RobotnikHud(pc),a2
  89.         bsr.w   Create_ChildObject
  90.         bne.s   @2
  91.         move.b  #2,obFrame(a1)
  92.         locVRAM $D120,$2A(a1)
  93. @2      rts
  94.  
  95. ; =============== S U B R O U T I N E =======================================
  96.  
  97. BossGreenHill_ShipMain:
  98.         jsr (BossMove).l
  99.         cmpi.b  #(BossGreenHill_EndSecond_ShipIndex-BossGreenHill_ShipIndex),ob2ndRout(a0)
  100.         bcc.s   @1
  101.         cmpi.b  #(BossGreenHill_ShipIndex_Simples_Fall-BossGreenHill_ShipIndex),ob2ndRout(a0)
  102.         beq.s   @1
  103.         move.b  obAngle(a0),d0
  104.         addq.b  #2,obAngle(a0)
  105.         jsr (CalcSine).l
  106.         asr.w   #6,d0
  107.         add.w   obYNext(a0),d0
  108.         move.w  d0,obY(a0)
  109.         move.w  obXNext(a0),obX(a0)
  110. @1      lea BossGreenHill_ShipIndex(pc),a1
  111.         bsr.w   ChildObjectsRoutine
  112.         bsr.w   BossGreenHill_Hurt
  113.         bra.w   BossGreenHill_Display2
  114. ; ---------------------------------------------------------------------------
  115.  
  116. BossGreenHill_ShipIndex:
  117.         offsetEntry.w BossGreenHill_Move_Circular_LeftRight
  118.         offsetEntry.w BossGreenHill_Move_Circular_Move
  119.         offsetEntry.w BossGreenHill_Move_Circular_LeftRight
  120.         offsetEntry.w BossGreenHill_Move_Circular_Create
  121.         offsetEntry.w BossGreenHill_Move_Jump
  122.         offsetEntry.w BossGreenHill_Move_Locret
  123. BossGreenHill_ShipIndex_Simples_Fall
  124.         offsetEntry.w BossGreenHill_Move_Simples_Fall
  125.         offsetEntry.w BossGreenHill_Move_Simples_Jump
  126. BossGreenHill_ShipIndex_RevengeMode
  127.         offsetEntry.w BossGreenHill_RevengeMode_Start
  128. BossGreenHill_ShipIndex_RevengeMode_Move
  129.         offsetEntry.w BossGreenHill_RevengeMode_Move
  130. BossGreenHill_ShipIndex_RevengeMode_Wait
  131.         offsetEntry.w BossGreenHill_RevengeMode_Wait
  132.         offsetEntry.w BossGreenHill_RevengeMode_LeftRight
  133. BossGreenHill_ShipIndex_RevengeMode_CheckReturn
  134.         offsetEntry.w BossGreenHill_RevengeMode_CheckReturn
  135.         offsetEntry.w BossGreenHill_RevengeMode_Return
  136. BossGreenHill_EndFirst_ShipIndex
  137.         offsetEntry.w BossGreenHill_EndFirst
  138. BossGreenHill_EndSecond_ShipIndex
  139.         offsetEntry.w BossGreenHill_EndSecond
  140.         offsetEntry.w BossGreenHill_EndSecond_Fall
  141. BossGreenHill_EndThird_ShipIndex
  142.         offsetEntry.w BossGreenHill_EndThird
  143.  
  144. ; =============== S U B R O U T I N E =======================================
  145.  
  146. BossGreenHill_Move_Circular_LeftRight:
  147.         move.w  (v_screenposx).w,d0
  148.         move.w  #-$200,obVelX(a0)
  149.         btst    #0,obStatus(a0)
  150.         beq.s   @1
  151.         neg.w   obVelX(a0)
  152.         addi.w  #$1A0,d0
  153.         cmp.w   obX(a0),d0
  154.         bge.s   @3
  155.         bra.s   @2
  156. @1      subi.w  #$60,d0
  157.         cmp.w   obX(a0),d0
  158.         ble.s       @3
  159. @2      addq.b  #2,ob2ndRout(a0)
  160.         move.w  (v_screenposy).w,d0
  161.         addi.w  #$26,d0
  162.         move.w  d0,obYNext(a0)
  163.         move.w  #$300,obTimer(a0)
  164.         bchg    #0,obStatus(a0)
  165. @3      rts
  166. ; ---------------------------------------------------------------------------
  167.  
  168. BossGreenHill_Move_Circular_Move:
  169.         subq.w  #1,obTimer(a0)
  170.         bne.s   @1
  171.         addq.b  #2,ob2ndRout(a0)
  172. @1      move.w  (v_framecount).w,d0
  173.         andi.w  #$1F,d0
  174.         bne.s   BossGreenHill_Move_Circular_FindSonic
  175.         lea ChildObjDat_RobotnikRingFall(pc),a2
  176.         bsr.w   Create_ChildObject
  177.         bne.s   BossGreenHill_Move_Circular_FindSonic
  178.         move.w  #-$400,obVelY(a1)
  179.         jsr (RandomNumber).l
  180.         andi.w  #$FF,d0
  181.         move.w  d0,obVelX(a1)
  182.         btst    #0,obStatus(a0)
  183.         beq.s   BossGreenHill_Move_Circular_FindSonic
  184.         neg.w   obVelX(a1)
  185.  
  186. BossGreenHill_Move_Circular_FindSonic:
  187.         bsr.w   Find_SonicObject
  188.         addi.w  #$10,d2
  189.         cmpi.w  #$40,d2
  190.         bcs.s   @3
  191.         move.w  #$100,d1
  192.         tst.w   d0
  193.         bne.s   @2
  194.         neg.w   d1
  195. @2      move.w  d1,obVelX(a0)
  196. @3      bra.w   Change_FlipXWithVelocity
  197. ; ---------------------------------------------------------------------------
  198.  
  199. SpikeBall_XPos:
  200.         dc.w 0
  201.         dc.w $10
  202.         dc.w $20
  203.         dc.w $30
  204.         dc.w $40
  205.         dc.w $50
  206.         dc.w $60
  207.         dc.w $70
  208.         dc.w $80
  209. SpikeBall_XPos_End
  210. ; ---------------------------------------------------------------------------
  211.  
  212. BossGreenHill_Move_Circular_Create:
  213.         addq.b  #2,ob2ndRout(a0)
  214.         move.w  #$288,obTimer(a0)
  215.         lea ChildObjDat_RobotnikCircularRing(pc),a2
  216.         bsr.w   Create_ChildObject2
  217.         move.w  (v_screenposy).w,d0
  218.         addi.w  #$50,d0
  219.         move.w  d0,obYNext(a0)
  220.  
  221. BossGreenHill_Move_Jump:
  222.         subq.w  #1,obTimer(a0)
  223.         beq.s   BossGreenHill_Move_Simples_Jump_Next
  224.         move.w  (v_framecount).w,d0
  225.         andi.w  #$F,d0
  226.         bne.s   @2
  227.         lea ChildObjDat_RobotnikRingFall(pc),a2
  228.         bsr.w   Create_ChildObject
  229.         bne.s   @2
  230.         move.w  #-$500,obVelY(a1)
  231.         moveq   #0,d0
  232.         move.b  $2A(a0),d0
  233.         move.w  SpikeBall_XPos(pc,d0.w),obVelX(a1)
  234.         btst    #0,obStatus(a0)
  235.         beq.s   @4
  236.         neg.w   obVelX(a1)
  237. @4      addq.b  #2,$2A(a0)
  238.         cmpi.b  #(SpikeBall_XPos_End-SpikeBall_XPos),$2A(a0)
  239.         bne.s   @2
  240.         move.b  #0,$2A(a0)
  241. @2      move.w  (v_screenposx).w,d0
  242.         move.w  #-$200,obVelX(a0)
  243.         btst    #0,obStatus(a0)
  244.         beq.s   @5
  245.         neg.w   obVelX(a0)
  246.         addi.w  #$1A0,d0
  247.         cmp.w   obX(a0),d0
  248.         bge.s   @7
  249.         bra.s   @6
  250. @5      subi.w  #$60,d0
  251.         cmp.w   obX(a0),d0
  252.         ble.s       @7
  253. @6      bchg    #0,obStatus(a0)
  254. @7      rts
  255. ; ---------------------------------------------------------------------------
  256.  
  257. BossGreenHill_Move_Simples_Jump_Next:
  258.         addq.b  #2,ob2ndRout(a0)
  259.         clr.w   obVelX(a0)
  260.         rts
  261. ; ---------------------------------------------------------------------------
  262.  
  263. BossGreenHill_Move_Simples_Fall:
  264.         subq.w  #1,obTimer(a0)
  265.         bmi.s   BossGreenHill_Move_Simples_Jump_Return
  266.         move.w  (v_framecount).w,d0
  267.         andi.w  #$1F,d0
  268.         bne.s   @1
  269.         lea ChildObjDat_RobotnikRingFall(pc),a2
  270.         bsr.w   Create_ChildObject
  271.         bne.s   @1
  272.         move.w  #-$500,obVelY(a1)
  273. @1      jsr (ObjectFall).l
  274.         tst.w obVelY(a0)
  275.         bmi.s   BossGreenHill_Move_Locret
  276.         jsr (ObjHitFloor).l
  277.         tst.w   d1
  278.         bpl.s   BossGreenHill_Move_Locret
  279.         add.w   d1,obY(a0)
  280.         addq.b  #2,ob2ndRout(a0)
  281.         clr.l   obVelX(a0)
  282.         move.w  #$10,(Screen_Shaking_Flag).w
  283.     if Snd_Driver_Version=0
  284.         moveq   #$FFFFFFBD,d0
  285.     else
  286.         moveq   #4,d0
  287.     endif
  288.         jmp (PlaySound_Special).l
  289. ; ---------------------------------------------------------------------------
  290.  
  291. BossGreenHill_Move_Simples_Jump_Return:
  292.         move.b  #(BossGreenHill_ShipIndex-BossGreenHill_ShipIndex),ob2ndRout(a0)
  293.         clr.w   obVelY(a0)
  294.  
  295. BossGreenHill_Move_Locret:
  296.         rts
  297. ; ---------------------------------------------------------------------------
  298.  
  299. BossGreenHill_Move_Simples_Jump:
  300.         subq.b  #2,ob2ndRout(a0)
  301.         move.w  #-$750,obVelY(a0)
  302.         bsr.w   Find_SonicObject
  303.         addi.w  #$10,d2
  304.         cmpi.w  #$20,d2
  305.         bcs.s   @2
  306.         move.w  #$200,d1
  307.         tst.w   d0
  308.         bne.s   @1
  309.         neg.w   d1
  310. @1      move.w  d1,obVelX(a0)
  311. @2      bra.w   Change_FlipXWithVelocity
  312.  
  313. ; =============== S U B R O U T I N E =======================================
  314.  
  315. BossGreenHill_RevengeMode_Start:
  316.         jsr (BossDefeated).l
  317.         move.w  (v_screenposx).w,d0
  318.         move.w  #-$200,obVelX(a0)
  319.         btst    #0,obStatus(a0)
  320.         beq.s   @1
  321.         neg.w   obVelX(a0)
  322.         addi.w  #$260,d0
  323.         cmp.w   obX(a0),d0
  324.         bge.s   @3
  325.         bra.s   @2
  326. @1      subi.w  #$120,d0
  327.         cmp.w   obX(a0),d0
  328.         ble.s       @3
  329. @2      addq.b  #2,ob2ndRout(a0)
  330.         lea ChildObjDat_RobotnikChaseBall(pc),a2
  331.         bsr.w   Create_ChildObject
  332.         lea ChildObjDat_RobotnikShipCrane(pc),a2
  333.         bsr.w   Create_ChildObject5
  334.         move.w  (v_screenposy).w,d0
  335.         addi.w  #$26,d0
  336.         move.w  d0,$38(a0)
  337.         bchg    #0,obStatus(a0)
  338. @3      rts
  339. ; ---------------------------------------------------------------------------
  340.  
  341. BossGreenHill_RevengeMode_Move:
  342.         move.w  (v_screenposx).w,d0
  343.         move.w  #-$200,obVelX(a0)
  344.         btst    #0,obStatus(a0)
  345.         beq.s   @1
  346.         neg.w   obVelX(a0)
  347.         addi.w  #$A0,d0
  348.         cmp.w   obX(a0),d0
  349.         bge.s   @3
  350.         bra.s   @2
  351. @1      addi.w  #$A0,d0
  352.         cmp.w   obX(a0),d0
  353.         ble.s       @3
  354. @2      movea.w obParent(a0),a1
  355.         addq.b  #2,ob2ndRout(a0)
  356.         addq.b  #2,ob2ndRout(a1)
  357.         clr.w   obVelX(a0)
  358. @3      rts
  359. ; ---------------------------------------------------------------------------
  360.  
  361. BossGreenHill_RevengeMode_LeftRight:
  362.         move.w  (v_screenposx).w,d0
  363.         move.w  #-$200,obVelX(a0)
  364.         btst    #0,obStatus(a0)
  365.         beq.s   @1
  366.         neg.w   obVelX(a0)
  367.         addi.w  #$1A0,d0
  368.         cmp.w   obX(a0),d0
  369.         bge.s   BossGreenHill_RevengeMode_Wait
  370.         bra.s   @2
  371. @1      subi.w  #$60,d0
  372.         cmp.w   obX(a0),d0
  373.         ble.s       BossGreenHill_RevengeMode_Wait
  374. @2      addq.b  #2,ob2ndRout(a0)
  375.         clr.w   obVelX(a0)
  376.         bchg    #0,obStatus(a0)
  377.  
  378. BossGreenHill_RevengeMode_Wait:
  379.         rts
  380. ; ---------------------------------------------------------------------------
  381.  
  382. BossGreenHill_RevengeMode_CheckReturn:
  383.         movea.w obParent(a0),a1
  384.         tst.w obParent(a1)
  385.         bne.s   BossGreenHill_RevengeMode_Wait
  386.         addq.b  #2,ob2ndRout(a0)
  387.         move.w  (v_screenposy).w,d0
  388.         addi.w  #$30,d0
  389.         move.w  d0,$38(a0)
  390.         bsr.w   BossGreenHill_Hud
  391.  
  392. BossGreenHill_RevengeMode_Return:
  393.         move.w  (v_framecount).w,d0
  394.         andi.w  #$1F,d0
  395.         bne.s   @0
  396.         lea ChildObjDat_RobotnikChaseBallClone(pc),a2
  397.         bsr.w   Create_ChildObject
  398.         bne.s   @0
  399.         move.w  #-$400,obVelY(a1)
  400. @0      move.w  (v_screenposx).w,d0
  401.         move.w  #-$200,obVelX(a0)
  402.         btst    #0,obStatus(a0)
  403.         beq.s   @1
  404.         neg.w   obVelX(a0)
  405.         addi.w  #$1A0,d0
  406.         cmp.w   obX(a0),d0
  407.         bge.s   @3
  408.         bra.s   @2
  409. @1      subi.w  #$60,d0
  410.         cmp.w   obX(a0),d0
  411.         ble.s       @3
  412. @2      bchg    #0,obStatus(a0)
  413. @3      rts
  414.  
  415. ; =============== S U B R O U T I N E =======================================
  416.  
  417. BossGreenHill_Hurt:
  418.         cmpi.b  #(BossGreenHill_EndFirst_ShipIndex-BossGreenHill_ShipIndex),ob2ndRout(a0)
  419.         bcc.w   BossGreenHill_Locret
  420.         tst.b obColType(a0)
  421.         bne.s   BossGreenHill_Locret
  422.         move.b  obColProp(a0),d0
  423.         beq.w   BossGreenHill_ShipGone
  424.         tst.b   obFlash(a0)
  425.         bne.s   BossGreenHill_ShipFlash
  426.         move.b  #$40,obFlash(a0)
  427.         cmpi.b  #8,d0
  428.         bne.s   @1
  429.     if Snd_Driver_Version=1
  430.         addq.b  #2,(v_dle_routine).w
  431.     endif
  432.         move.b  #(BossGreenHill_ShipIndex_RevengeMode-BossGreenHill_ShipIndex),ob2ndRout(a0)
  433.         move.b  #$E0,obFlash(a0)
  434.         clr.w   obVelY(a0)
  435.         bchg #4,obStatus(a0)
  436. @1  if Snd_Driver_Version=0
  437.         moveq   #$FFFFFFAC,d0
  438.     else
  439.         moveq   #10,d0
  440.     endif
  441.         jsr (PlaySound_Special).l
  442.         bsr.w   Load_SimpleRing
  443.  
  444. BossGreenHill_ShipFlash:
  445.         moveq   #0,d0
  446.         btst    #0,obFlash(a0)
  447.         bne.s   @3
  448.         addi.w  #$A,d0
  449. @3      lea LoadBossGreenHill_PalRAM(pc),a1
  450.         lea LoadBossGreenHill_PalCycle(pc,d0.w),a2
  451.     rept 5
  452.         movea.w (a1)+,a3
  453.         move.w  (a2)+,(a3)+
  454.     endr
  455.         subq.b  #1,obFlash(a0)
  456.         bne.s   BossGreenHill_Locret
  457.         move.b  #$F,obColType(a0)
  458.  
  459. BossGreenHill_Locret:
  460.         rts
  461. ; ---------------------------------------------------------------------------
  462.  
  463. LoadBossGreenHill_PalRAM:
  464.         dc.w $FB34
  465.         dc.w $FB36
  466.         dc.w $FB38
  467.         dc.w $FB3A
  468.         dc.w $FB3C
  469. LoadBossGreenHill_PalCycle:
  470.         dc.w $ECC
  471.         dc.w $CAA
  472.         dc.w $A88
  473.         dc.w $866
  474.         dc.w $644
  475.         dc.w $E
  476.         dc.w $C
  477.         dc.w $A
  478.         dc.w 8
  479.         dc.w 6
  480. ; ---------------------------------------------------------------------------
  481.  
  482. BossGreenHill_ShipGone:
  483.         move.b  #(BossGreenHill_EndFirst_ShipIndex-BossGreenHill_ShipIndex),ob2ndRout(a0)
  484.         move.b  #$AE,obTimer(a0)
  485.         bchg #4,obStatus(a0)
  486.         clr.w obVelX(a0)
  487.         clr.b (f_timecount).w
  488.         moveq   #100,d0
  489.         jmp (AddPoints).l
  490. ; ---------------------------------------------------------------------------
  491.  
  492. BossGreenHill_EndFirst:
  493.         jsr (BossDefeated).l
  494.         subq.b  #1,obTimer(a0)
  495.         bne.s   @1
  496.         addq.b  #2,ob2ndRout(a0)
  497.         bclr    #7,obStatus(a0)
  498.         tst.b   (v_bossstatus).w
  499.         bne.s   @1
  500.         move.b  #1,(v_bossstatus).w
  501. @1      rts
  502. ; ---------------------------------------------------------------------------
  503.  
  504. BossGreenHill_EndSecond:
  505.         jsr (BossDefeated).l
  506.         jsr (ObjectFall).l
  507.         tst.w obVelY(a0)
  508.         bmi.s   BossGreenHill_End_Locret
  509.         jsr (ObjHitFloor).l
  510.         tst.w   d1
  511.         bpl.s   BossGreenHill_End_Locret
  512.         add.w   d1,obY(a0)
  513.         addq.b  #2,ob2ndRout(a0)
  514.         move.w  #$10,(Screen_Shaking_Flag).w
  515.     if Snd_Driver_Version=0
  516.         moveq   #$FFFFFFBD,d0
  517.     else
  518.         moveq   #4,d0
  519.     endif
  520.         jmp (PlaySound_Special).l
  521. ; ---------------------------------------------------------------------------
  522.  
  523. BossGreenHill_EndSecond_Fall:
  524.         subq.b  #2,ob2ndRout(a0)
  525.         move.w  obVelY(a0),d0
  526.         asr.w   d0
  527.         neg.w   d0
  528.         move.w  d0,obVelY(a0)
  529.         cmpi.w  #-$480,obVelY(a0)
  530.         blo.s       BossGreenHill_End_Locret
  531.         addq.b  #4,ob2ndRout(a0)
  532.         st  (Screen_Shaking_Flag).w
  533.  
  534. BossGreenHill_End_Locret:
  535.         rts
  536. ; ---------------------------------------------------------------------------
  537.  
  538. BossGreenHill_EndThird:
  539.         jsr (BossDefeated).l
  540.         jsr (ObjectFall).l
  541.         tst.b obRender(a0)
  542.         bmi.s   BossGreenHill_End_Locret
  543.         lea ChildObjDat_RobotnikRun(pc),a2
  544.         bsr.w   Create_ChildObject
  545.         jmp (DeleteObject).l
  546.  
  547. ; =============== S U B R O U T I N E =======================================
  548.  
  549. ObjBossGreenHill_RobotnikFace:
  550.         lea BossGreenHill_RobotnikFace_ShipIndex(pc),a1
  551.         bra.w   ChildObjectsRoutine
  552. ; ---------------------------------------------------------------------------
  553.  
  554. BossGreenHill_RobotnikFace_ShipIndex:
  555.         offsetEntry.w BossGreenHill_RobotnikFace_Init
  556.         offsetEntry.w BossGreenHill_RobotnikFace_Main
  557. ; ---------------------------------------------------------------------------
  558.  
  559. BossGreenHill_RobotnikFace_Init:
  560.         addq.b  #2,ob2ndRout(a0)
  561.         lea ObjDat3_BossGreenHill_RobotnikFace(pc),a1
  562.         bra.w   LoadObjects_ExtraData
  563. ; ---------------------------------------------------------------------------
  564.  
  565. BossGreenHill_RobotnikFace_Main:
  566.         movea.w obParent(a0),a1
  567.         moveq   #1,d0
  568.         tst.w obVelX(a1)
  569.         beq.s   @1
  570.         cmpi.b  #4,(v_player+obRoutine).w
  571.         bcs.s   @2
  572. @1      moveq   #4,d0
  573. @2      tst.b obColType(a1)
  574.         bne.s   @3
  575.         moveq   #5,d0
  576. @3      cmpi.b  #(BossGreenHill_EndFirst_ShipIndex-BossGreenHill_ShipIndex),ob2ndRout(a1)
  577.         bmi.s   @4
  578.         moveq   #$A,d0
  579. @4      cmpi.b  #(BossGreenHill_EndThird_ShipIndex-BossGreenHill_ShipIndex),ob2ndRout(a1)
  580.         bne.s   @5
  581.         moveq   #$A,d0
  582.         tst.b obRender(a0)
  583.         bpl.w   BossGreenHill_Del
  584. @5      move.b  d0,obAnim(a0)
  585.         bra.s   BossGreenHill_Display
  586.  
  587. ; =============== S U B R O U T I N E =======================================
  588.  
  589. ObjBossGreenHill_RobotnikFlame:
  590.         lea BossGreenHill_RobotnikFlame_ShipIndex(pc),a1
  591.         bra.w   ChildObjectsRoutine
  592. ; ---------------------------------------------------------------------------
  593.  
  594. BossGreenHill_RobotnikFlame_ShipIndex:
  595.         offsetEntry.w BossGreenHill_RobotnikFlame_Init
  596.         offsetEntry.w BossGreenHill_RobotnikFlame_Main
  597. ; ---------------------------------------------------------------------------
  598.  
  599. BossGreenHill_RobotnikFlame_Init:
  600.         addq.b  #2,ob2ndRout(a0)
  601.         lea ObjDat3_BossGreenHill_RobotnikFlame(pc),a1
  602.         moveq   #0,d0
  603.         move.b  obSubtype(a0),d0
  604.         cmpi.b  #4,d0
  605.         bne.s   @1
  606.         lea ObjDat3_BossGreenHill_RobotnikFlame2(pc),a1
  607. @1      bra.w   LoadObjects_ExtraData
  608. ; ---------------------------------------------------------------------------
  609.  
  610. BossGreenHill_RobotnikFlame_Main:
  611.         movea.w obParent(a0),a1
  612.         moveq   #8,d0
  613.         moveq   #0,d1
  614.         move.b  obSubtype(a0),d1
  615.         cmpi.b  #4,d1
  616.         bne.s   @1
  617.         moveq   #9,d0
  618. @1      move.b  d0,obAnim(a0)
  619.         cmpi.b  #(BossGreenHill_EndSecond_ShipIndex-BossGreenHill_ShipIndex),ob2ndRout(a1)
  620.         beq.s   BossGreenHill_Del
  621.  
  622. BossGreenHill_Display:
  623.         move.w  obX(a1),obX(a0)
  624.         move.w  obY(a1),obY(a0)
  625.         move.b  obStatus(a1),obStatus(a0)
  626.  
  627. BossGreenHill_Display2:
  628.         lea (Ani_Eggman).l,a1
  629.         jsr (AnimateSprite).l
  630.         move.b  obStatus(a0),d0
  631.         andi.b  #3,d0
  632.         andi.b  #$FC,obRender(a0)
  633.         or.b    d0,obRender(a0)
  634.  
  635. BossGreenHill_Display3:
  636.         jmp (DisplaySprite).l
  637. ; ---------------------------------------------------------------------------
  638.  
  639. BossGreenHill_Del:
  640.         jmp (DeleteObject).l
  641.  
  642. ; =============== S U B R O U T I N E =======================================
  643.  
  644. ObjBossGreenHill_RobotnikGlass:
  645.         lea BossGreenHill_RobotnikGlass_ShipIndex(pc),a1
  646.         bra.w   ChildObjectsRoutine
  647. ; ---------------------------------------------------------------------------
  648.  
  649. BossGreenHill_RobotnikGlass_ShipIndex:
  650.         offsetEntry.w BossGreenHill_RobotnikGlass_Init
  651.         offsetEntry.w BossGreenHill_RobotnikGlass_Main
  652. ; ---------------------------------------------------------------------------
  653.  
  654. BossGreenHill_RobotnikGlass_Init:
  655.         addq.b  #2,ob2ndRout(a0)
  656.         lea ObjDat3_BossGreenHill_RobotnikGlass(pc),a1
  657.         bra.w   LoadObjects_ExtraData
  658. ; ---------------------------------------------------------------------------
  659.  
  660. BossGreenHill_RobotnikGlass_Main:
  661.         movea.w obParent(a0),a1
  662.         move.w  obX(a1),d0
  663.         move.b  obXNext(a0),d1
  664.         ext.w   d1
  665.         bclr    #0,obRender(a0)
  666.         btst    #0,obStatus(a1)
  667.         beq.s   @1
  668.         neg.w   d1
  669.         bset    #0,obRender(a0)
  670. @1      add.w   d1,d0
  671.         move.w  d0,obX(a0)
  672.         move.w  obY(a1),d0
  673.         move.b  obYNext(a0),d1
  674.         ext.w   d1
  675.         bclr    #1,obRender(a0)
  676.         btst    #1,obStatus(a1)
  677.         beq.s   @2
  678.         neg.w   d1
  679.         bset    #1,obRender(a0)
  680. @2      add.w   d1,d0
  681.         move.w  d0,obY(a0)
  682.         bra.s   BossGreenHill_Display3
  683.  
  684. ; =============== S U B R O U T I N E =======================================
  685.  
  686. BossCircularRing:
  687.         movea.w obParent(a0),a1
  688.         btst    #4,obStatus(a1)
  689.         bne.w   BossCircularRing_Explode_Status
  690.         lea BossCircularRing_Index(pc),a1
  691.         bsr.w   ChildObjectsRoutine
  692.         moveq   #2,d0
  693.         btst    #0,(v_vbla_count+3).w
  694.         beq.s   @1
  695.         moveq   #3,d0
  696. @1      move.b  d0,obFrame(a0)
  697.         jmp (DisplaySprite).l
  698. ; ---------------------------------------------------------------------------
  699.  
  700. BossCircularRing_Index:
  701.         offsetEntry.w BossCircularRing_Main
  702.         offsetEntry.w BossCircularRing_Circular
  703.         offsetEntry.w BossCircularRing_Shot
  704.         offsetEntry.w BossCircularRing_Render
  705. BossCircularRing_Index_SetUpAttributes
  706.         offsetEntry.w BossCircularRing_SetUpAttributes
  707.         offsetEntry.w BossCircularRing_Fall
  708. BossCircularRing_Index_SetUpAttributes2
  709.         offsetEntry.w BossCircularRing_Main2
  710.         offsetEntry.w BossCircularRing_Wait
  711.         offsetEntry.w BossCircularRing_Wait2
  712.         offsetEntry.w BossCircularRing_Circular2
  713.         offsetEntry.w BossCircularRing_Shot_Time
  714.         offsetEntry.w BossCircularRing_Shot_Wait
  715.         offsetEntry.w BossCircularRing_RenderSpeed
  716. BossCircularRing_Index_SetUpAttributes3
  717.         offsetEntry.w BossCircularRing_Main
  718.         offsetEntry.w BossCircularRing_ShotUp_ResetCollision
  719.         offsetEntry.w BossCircularRing_ShotUp_Timer
  720.         offsetEntry.w BossCircularRing_ShotUp
  721.         offsetEntry.w BossCircularRing_ShotWait
  722.         offsetEntry.w BossCircularRing_ShotFall
  723.         offsetEntry.w BossCircularRing_RenderFall_Time
  724.         offsetEntry.w BossCircularRing_RenderFall
  725. BossCircularRing_Index_SetUpAttributes4
  726.         offsetEntry.w BossCircularRing_Main
  727.         offsetEntry.w BossCircularRing_CircularAddRadius
  728.         offsetEntry.w BossCircularRing_ShotAttack
  729.         offsetEntry.w BossCircularRing_RenderSpeedCheck
  730. ; ---------------------------------------------------------------------------
  731.  
  732. BossCircularRing_Main:
  733.         moveq   #0,d0
  734.         move.b  obSubtype(a0),d0
  735.         lsl.b   #3,d0
  736.         move.b  d0,obAngle(a0)
  737.         lsl.w #2,d0
  738.         tst.b ob2ndRout(a0)
  739.         beq.s   @1
  740.         lsr.w d0
  741. @1      cmpi.b  #(BossCircularRing_Index_SetUpAttributes4-BossCircularRing_Index),ob2ndRout(a0)
  742.         bne.s   @2
  743.         move.w  #$20,obTimer(a0)
  744. @2      tst.b ob2ndRout(a0)
  745.         bne.s   @3
  746.         move.w  #$390,obTimer(a0)
  747. @3      add.w   d0,obTimer(a0)
  748.         move.w  #$100,$2A(a0)
  749.  
  750. BossCircularRing_SetUpAttributes:
  751.         lea ObjDat3_BossGreenHill_RobotnikSpike(pc),a1
  752.         tst.b ob2ndRout(a0)
  753.         bne.s   @1
  754.         lea ObjDat3_BossGreenHill_RobotnikSphere(pc),a1
  755. @1      addq.b  #2,ob2ndRout(a0)
  756.         bra.w   LoadObjects_Data
  757. ; ---------------------------------------------------------------------------
  758.  
  759. BossCircularRing_Main2:
  760.         moveq   #0,d0
  761.         move.b  obSubtype(a0),d0
  762.         lsl.b   #4,d0
  763.         add.b   d0,obTimer(a0)
  764.         movea.w obParent(a0),a1
  765.         move.w  #$200,d0
  766.         btst    #0,obStatus(a1)
  767.         bne.s   @1
  768.         neg.w   d0
  769. @1      move.w  d0,obVelX(a0)
  770.         move.w  a0,obParent(a1)
  771.         bra.s   BossCircularRing_SetUpAttributes
  772. ; ---------------------------------------------------------------------------
  773.  
  774. BossCircularRing_ShotUp_ResetCollision:
  775.         addq.b  #2,ob2ndRout(a0)
  776.         move.b  #0,obColType(a0)
  777.  
  778. BossCircularRing_ShotUp_Timer:
  779.         subq.w  #1,obTimer(a0)
  780.         bpl.w   BossCircularRing_Locret2
  781.         moveq   #0,d0
  782.         move.b  obSubtype(a0),d0
  783.         lsl.w   #3,d0
  784.         move.w  #$150,obTimer(a0)
  785.         add.w   d0,obTimer(a0)
  786.         move.w  #-$600,obVelY(a0)
  787.         move.b  #$8B,obColType(a0)
  788.         addq.b  #2,ob2ndRout(a0)
  789.     if Snd_Driver_Version=0
  790.         moveq   #$FFFFFFA5,d0
  791.     else
  792.         moveq   #26,d0
  793.     endif
  794.         jsr (PlaySound_Special).l
  795.  
  796. BossCircularRing_ShotUp:
  797.         jsr (SpeedToPos).l
  798.         move.w  (v_screenposy).w,d0
  799.         subi.w  #$20,d0
  800.         cmp.w   obY(a0),d0
  801.         bcs.s   BossCircularRing_Locret2
  802.         addq.b  #2,ob2ndRout(a0)
  803.  
  804. BossCircularRing_ShotWait:
  805.         subq.w  #1,obTimer(a0)
  806.         bne.s   BossCircularRing_Locret2
  807.         addq.b  #2,ob2ndRout(a0)
  808.         move.w  (v_screenposx).w,d0
  809.         add.w   $38(a0),d0
  810.         move.w  d0,8(a0)
  811.         lea ChildObjDat_Targetting_Sensor2(pc),a2
  812.         bsr.w   Create_ChildObject2
  813.         bne.s   BossCircularRing_ShotFall
  814.         move.w  (v_screenposy).w,d0
  815.         addi.w  #$C0,d0
  816.         move.w  d0,obY(a1)
  817.         move.b  #1,obAnim(a1)
  818.  
  819. BossCircularRing_ShotFall:
  820.         jsr (ObjectFall).l
  821.         tst.b obRender(a0)
  822.         bpl.s   BossCircularRing_Locret2
  823.         addq.b  #2,ob2ndRout(a0)
  824.  
  825. BossCircularRing_Locret2:
  826.         rts
  827. ; ---------------------------------------------------------------------------
  828.  
  829. BossCircularRing_Wait:
  830.         subq.b  #1,obTimer(a0)
  831.         bne.s   BossCircularRing_Locret2
  832.         addq.b  #2,ob2ndRout(a0)
  833.         move.b  #$20,obTimer(a0)
  834.         move.b  obAngle(a0),d0
  835.         move.b  #$40,d0
  836.         tst.w   obVelX(a0)
  837.         bpl.s   @1
  838.         neg.w   d0
  839. @1      move.b  d0,obAngle(a0)
  840.         move.b  d0,$3F(a0)
  841.     if Snd_Driver_Version=0
  842.         moveq   #$FFFFFFA5,d0
  843.     else
  844.         moveq   #26,d0
  845.     endif
  846.         jsr (PlaySound_Special).l
  847.  
  848. BossCircularRing_Wait2:
  849.         jsr (SpeedToPos).l
  850.         subq.b  #1,obTimer(a0)
  851.         bne.s   BossCircularRing_CircularSimple_Locret
  852.         addq.b  #2,ob2ndRout(a0)
  853.  
  854. BossCircularRing_Circular2:
  855.         movea.w obParent(a0),a1
  856.         cmpi.b  #(BossChaseBall_Locret3_Index-BossChaseBall_Index),ob2ndRout(a1)
  857.         bne.s   BossCircularRing_CircularSimpleOffset
  858.         addq.b  #2,ob2ndRout(a0)
  859.         clr.l   obVelX(a0)
  860.  
  861. BossCircularRing_CircularSimpleOffset:
  862.         subq.b  #1,obAngle(a0)
  863.         moveq   #2,d2
  864.         bra.w   BossCircularRing_CircularSimple
  865. ; ---------------------------------------------------------------------------
  866.  
  867. BossCircularRing_Shot_Data:
  868.         dc.w -$300, 0
  869.         dc.w -$300, $200
  870.         dc.w -$100, $300
  871.         dc.w $100, $300
  872.         dc.w $300, $100
  873.         dc.w $300, -$250
  874.         dc.w 0, -$300
  875.         dc.w -$300, -$300
  876. ; ---------------------------------------------------------------------------
  877.  
  878. BossCircularRing_Shot_Time:
  879.         addq.b  #2,ob2ndRout(a0)
  880.         moveq   #0,d0
  881.         move.b  obSubtype(a0),d0
  882.         add.w   d0,d0
  883.         move.l  BossCircularRing_Shot_Data(pc,d0.w),obVelX(a0)
  884.         tst.b $3F(a0)
  885.         bpl.s   BossCircularRing_CircularSimple_Locret
  886.         neg.l   obVelX(a0)
  887.  
  888. BossCircularRing_CircularSimple_Locret:
  889.         rts
  890. ; ---------------------------------------------------------------------------
  891.  
  892. BossCircularRing_Shot_Wait:
  893.         addq.b  #2,ob2ndRout(a0)
  894.         movea.w obParent(a0),a1
  895.         move.b  #(BossChaseBall_Bouncing3_Index-BossChaseBall_Index),ob2ndRout(a1)
  896.         move.b  #$16,obHeight(a1)
  897.         move.b  #0,obAnim(a1)
  898.         move.w  #-$400,$3A(a1)
  899.         move.w  #3,obTimer(a1)
  900.     if Snd_Driver_Version=0
  901.         moveq   #$FFFFFFA5,d0
  902.     else
  903.         moveq   #26,d0
  904.     endif
  905.         jmp (PlaySound_Special).l
  906. ; ---------------------------------------------------------------------------
  907.  
  908. BossCircularRing_Circular:
  909.         subq.w  #1,obTimer(a0)
  910.         bpl.s   @1
  911.         addq.b  #2,ob2ndRout(a0)
  912. @1      subq.b  #3,obAngle(a0)
  913.         moveq   #2,d2
  914.  
  915. BossCircularRing_CircularSimple:
  916.         move.b  obAngle(a0),d0
  917.         jsr (CalcSine).l
  918.         swap    d0
  919.         clr.w   d0
  920.         swap    d1
  921.         clr.w   d1
  922.         asr.l   d2,d0
  923.         asr.l   d2,d1
  924.         movea.w obParent(a0),a1
  925.         move.l  obX(a1),d2
  926.         move.l  obY(a1),d3
  927.         add.l   d0,d2
  928.         add.l   d1,d3
  929.         move.l  d2,obX(a0)
  930.         move.l  d3,obY(a0)
  931.         rts
  932. ; ---------------------------------------------------------------------------
  933.  
  934. BossCircularRing_CircularAddRadius:
  935.         moveq   #0,d0
  936.         move.b  $2C(a0),d0
  937.         addq.b  #1,d0
  938.         moveq   #$50,d1
  939.         btst    #2,obStatus(a0)
  940.         beq.s   @1
  941.         subq.b  #2,d0
  942.         moveq   #0,d1
  943. @1      cmpi.b  #$10,d0
  944.         bge.s   BossCircularRing_CircularCheckRadius
  945.         subq.w  #1,obTimer(a0)
  946.         bpl.s   BossCircularRing_CircularCheckRadius
  947.         addq.b  #2,ob2ndRout(a0)
  948.     if Snd_Driver_Version=0
  949.         moveq   #$FFFFFFA5,d0
  950.     else
  951.         moveq   #26,d0
  952.     endif
  953.         jmp (PlaySound_Special).l
  954. ; ---------------------------------------------------------------------------
  955.  
  956. BossCircularRing_CircularCheckRadius:
  957.         cmp.b   d0,d1
  958.         bne.s   @1
  959.         bchg    #2,obStatus(a0)
  960. @1      move.b  d0,$2C(a0)
  961.         move.w  $2A(a0),d0
  962.         add.w   d0,obAngle(a0)
  963.         move.b  obAngle(a0),d0
  964.         jsr (CalcSine).l
  965.         moveq   #0,d4
  966.         move.b  $2C(a0),d4
  967.         move.l  d4,d5
  968.         muls.w  d0,d4
  969.         asr.l   #8,d4
  970.         muls.w  d1,d5
  971.         asr.l   #8,d5
  972.         movea.w obParent(a0),a1
  973.         move.w  obX(a1),d2
  974.         move.w  obY(a1),d3
  975.         add.w   d2,d4
  976.         add.w   d3,d5
  977.         move.w  d4,obX(a0)
  978.         move.w  d5,obY(a0)
  979.         rts
  980. ; ---------------------------------------------------------------------------
  981.  
  982. BossCircularRing_Shot:
  983.         moveq   #0,d0
  984.         move.b  obSubtype(a0),d0
  985.         cmpi.b  #$1E,d0
  986.         bne.s   BossCircularRing_ShotAttack
  987.         movea.w obParent(a0),a1
  988.         move.b  #(BossGreenHill_ShipIndex_Simples_Fall-BossGreenHill_ShipIndex),ob2ndRout(a1)
  989.         move.w  #$260,obTimer(a1)
  990.  
  991. BossCircularRing_ShotAttack:
  992.         addq.b  #2,ob2ndRout(a0)
  993.     if Snd_Driver_Version=0
  994.         moveq   #$FFFFFFA5,d0
  995.     else
  996.         moveq   #26,d0
  997.     endif
  998.         jsr (PlaySound_Special).l
  999.         moveq   #3,d5
  1000.         lea (v_player).w,a1
  1001.         moveq   #0,d0
  1002.         move.w  obX(a1),d0
  1003.         moveq   #0,d1
  1004.         move.w  obY(a1),d1
  1005.  
  1006. Shot_Object:
  1007.         sub.w   obX(a0),d0
  1008.         smi d2
  1009.         bpl.s   @1
  1010.         neg.w   d0
  1011. @1      sub.w   obY(a0),d1
  1012.         smi d3
  1013.         bpl.s   @2
  1014.         neg.w   d1
  1015. @2      cmp.w   d1,d0
  1016.         scs d4
  1017.         beq.s   BossCircularRing_Shot2
  1018.         bcc.s   @3
  1019.         exg d0,d1
  1020. @3      swap    d1
  1021.         divu.w  d0,d1
  1022.  
  1023. BossCircularRing_Return2:
  1024.         move.w  #$100,d0
  1025.         lsl.w   d5,d0
  1026.         moveq   #8,d6
  1027.         sub.w   d5,d6
  1028.         lsr.w   d6,d1
  1029.  
  1030. BossCircularRing_Return:
  1031.         tst.b   d4
  1032.         beq.s   @4
  1033.         exg d0,d1
  1034. @4      tst.b   d2
  1035.         beq.s   @5
  1036.         neg.w   d0
  1037. @5      tst.b   d3
  1038.         beq.s   @6
  1039.         neg.w   d1
  1040. @6      move.w  d0,obVelX(a0)
  1041.         move.w  d1,obVelY(a0)
  1042.  
  1043. BossCircularRing_Locret:
  1044.         rts
  1045. ; ---------------------------------------------------------------------------
  1046.  
  1047. BossCircularRing_Shot2:
  1048.         tst.w   d0
  1049.         beq.s   BossCircularRing_Return2
  1050.         move.w  #$100,d0
  1051.         lsl.w   d5,d0
  1052.         move.w  #$100,d1
  1053.         lsl.w   d5,d1
  1054.         bra.s   BossCircularRing_Return
  1055. ; ---------------------------------------------------------------------------
  1056.  
  1057. BossCircularRing_Render:
  1058.         bsr.w   BossCircularRing_Fall_Extra
  1059.         bra.s   BossCircularRing_RenderSpeed
  1060. ; ---------------------------------------------------------------------------
  1061.  
  1062. BossCircularRing_RenderFall_Time:
  1063.         moveq   #0,d0
  1064.         move.b  obSubtype(a0),d0
  1065.         cmpi.b  #$12,d0
  1066.         bne.s   BossCircularRing_RenderFall
  1067.         movea.w obParent(a0),a1
  1068.         move.b  #(BossChaseBall_LDL_Index-BossChaseBall_Index),ob2ndRout(a1)
  1069.         move.w  #$30,obTimer(a1)
  1070.         move.b  #0,obAnim(a1)
  1071.         move.w  #-$400,$3A(a1)
  1072.         move.w  #3,obYNext(a1)
  1073.         addq.b  #2,ob2ndRout(a0)
  1074.  
  1075. BossCircularRing_RenderFall:
  1076.         bsr.s   BossCircularRing_Fall_Extra
  1077.         jsr (ObjectFall).l
  1078.         bra.s   BossCircularRing_Render_Delete
  1079. ; ---------------------------------------------------------------------------
  1080.  
  1081. BossCircularRing_RenderSpeedCheck:
  1082.         moveq   #0,d0
  1083.         move.b  obSubtype(a0),d0
  1084.         cmpi.b  #$1E,d0
  1085.         bne.s   BossCircularRing_RenderSpeed
  1086.         tst.b obRender(a0)
  1087.         bmi.s   BossCircularRing_RenderSpeed
  1088.         movea.w obParent(a0),a1
  1089.         addq.b  #2,ob2ndRout(a1)
  1090.         move.w  #$30,obTimer(a1)
  1091.         move.b  #0,obAnim(a1)
  1092.  
  1093. BossCircularRing_RenderSpeed:
  1094.         jsr (SpeedToPos).l
  1095.  
  1096. BossCircularRing_Render_Delete:
  1097.         tst.b obRender(a0)
  1098.         bmi.w   BossCircularRing_Locret
  1099.         jmp (DeleteObject).l
  1100. ; ---------------------------------------------------------------------------
  1101.  
  1102. BossCircularRing_Explode_Status:
  1103.         bchg #4,obStatus(a0)
  1104.         bra.s   BossCircularRing_Explode
  1105. ; ---------------------------------------------------------------------------
  1106.  
  1107. BossCircularRing_Fall:
  1108.         jsr (ObjectFall).l
  1109.         tst.w obVelY(a0)
  1110.         bmi.w   BossCircularRing_Locret
  1111.  
  1112. BossCircularRing_Fall_Extra:
  1113.         jsr (ObjHitFloor).l
  1114.         tst.w   d1
  1115.         bpl.w   BossCircularRing_Locret
  1116.         add.w   d1,obY(a0)
  1117.         clr.w obVelY(a0)
  1118.  
  1119. BossCircularRing_Explode:
  1120.         move.w  #$10,(Screen_Shaking_Flag).w
  1121.         jmp (Obj7B_Explode).l
  1122.  
  1123. ; =============== S U B R O U T I N E =======================================
  1124.  
  1125. BossChaseBall:
  1126.         lea BossChaseBall_Index(pc),a1
  1127.         bsr.w   ChildObjectsRoutine
  1128.         cmpi.b  #(BossChaseBall_Clone_Index_SetUpAttributes-BossChaseBall_Index),ob2ndRout(a0)
  1129.         bcc.s   @0
  1130.         cmpi.b  #(BossChaseBall_JumpShot_Index-BossChaseBall_Index),ob2ndRout(a0)
  1131.         bcs.s   @0
  1132.         bsr.w   BossChaseBall_Hurt
  1133.         bsr.w   BossChaseBall_Collision
  1134. @0      cmpi.b  #(BossChaseBall_Bouncing4_Index-BossChaseBall_Index),ob2ndRout(a0)
  1135.         bcc.s   @1
  1136.         lea (Ani_obj48).l,a1
  1137.         jsr (AnimateSprite).l
  1138. @1      jmp (DisplaySprite).l
  1139. ; ---------------------------------------------------------------------------
  1140.  
  1141. BossChaseBall_Index:
  1142.         offsetEntry.w BossChaseBall_InitHud
  1143.         offsetEntry.w BossChaseBall_Move
  1144.         offsetEntry.w BossChaseBall_Fall
  1145.         offsetEntry.w BossChaseBall_Bouncing
  1146.         offsetEntry.w BossChaseBall_Load_Dynamic_Location
  1147. BossChaseBall_JumpShot_Index
  1148.         offsetEntry.w BossChaseBall_Wait
  1149.         offsetEntry.w BossChaseBall_Check
  1150.         offsetEntry.w BossChaseBall_CheckJump
  1151.         offsetEntry.w BossChaseBall_Wait
  1152.         offsetEntry.w BossChaseBall_Shot
  1153.         offsetEntry.w BossChaseBall_Fall
  1154.         offsetEntry.w BossChaseBall_CreateRing
  1155. BossChaseBall_Circular_Index
  1156.         offsetEntry.w BossChaseBall_Circular
  1157.         offsetEntry.w BossChaseBall_Fall
  1158.         offsetEntry.w BossChaseBall_Bouncing2
  1159.         offsetEntry.w BossChaseBall_Load_Dynamic_Location
  1160. BossChaseBall_JumpCircular_Index
  1161.         offsetEntry.w BossChaseBall_Wait
  1162.         offsetEntry.w BossChaseBall_Circular_Create
  1163.         offsetEntry.w BossChaseBall_Circular_CreateJump
  1164.         offsetEntry.w BossChaseBall_Wait
  1165.         offsetEntry.w BossChaseBall_Circular_Fall_Time
  1166.         offsetEntry.w BossChaseBall_Circular_Fall
  1167.         offsetEntry.w BossChaseBall_Circular_Jump
  1168. BossChaseBall_Locret3_Index
  1169.         offsetEntry.w BossChaseBall_Locret3
  1170. BossChaseBall_Bouncing3_Index
  1171.         offsetEntry.w BossChaseBall_Fall
  1172.         offsetEntry.w BossChaseBall_Bouncing3
  1173.         offsetEntry.w BossChaseBall_Load_Dynamic_Location
  1174. BossChaseBall_ShotVertical_Index
  1175.         offsetEntry.w BossChaseBall_Wait
  1176.         offsetEntry.w BossChaseBall_Create_ShotVertical
  1177. BossChaseBall_Wait3_Index
  1178.         offsetEntry.w BossChaseBall_Wait
  1179.         offsetEntry.w BossChaseBall_MoveLeftRightStart
  1180.         offsetEntry.w BossChaseBall_Wait
  1181.         offsetEntry.w BossChaseBall_MoveLeftRight
  1182. BossChaseBall_LDL_Index
  1183.         offsetEntry.w BossChaseBall_Load_Dynamic_Location
  1184. BossChaseBall_CreateClone_Index
  1185.         offsetEntry.w BossChaseBall_Wait
  1186.         offsetEntry.w BossChaseBall_Check
  1187.         offsetEntry.w BossChaseBall_CheckJump
  1188.         offsetEntry.w BossChaseBall_Wait
  1189.         offsetEntry.w BossChaseBall_MoveLeftRightCreateClone_Time
  1190.         offsetEntry.w BossChaseBall_MoveLeftRightCreateClone
  1191.         offsetEntry.w BossChaseBall_MoveFallDestroy
  1192.         offsetEntry.w BossChaseBall_Shot
  1193.         offsetEntry.w BossChaseBall_Fall
  1194.         offsetEntry.w BossChaseBall_JumpWait
  1195.         offsetEntry.w BossChaseBall_Load_Dynamic_Location
  1196. BossChaseBall_RadiusCircular_Index
  1197.         offsetEntry.w BossChaseBall_Wait
  1198.         offsetEntry.w BossChaseBall_CreateRadiusCircular
  1199.         offsetEntry.w BossChaseBall_MoveRadiusCircular
  1200.         offsetEntry.w BossChaseBall_Load_Dynamic_Location
  1201. BossChaseBall_Defeated_Index
  1202.         offsetEntry.w BossChaseBall_Defeated
  1203. BossChaseBall_Clone_Index_SetUpAttributes
  1204.         offsetEntry.w BossChaseBall_InitExtra
  1205.         offsetEntry.w BossChaseBall_Fall
  1206. BossChaseBall_Bouncing4_Index
  1207.         offsetEntry.w BossChaseBall_Bouncing4
  1208. BossChaseBall_Bouncing4_Remove_Index
  1209.         offsetEntry.w BossChaseBall_Remove
  1210. ; ---------------------------------------------------------------------------
  1211.  
  1212. BossChaseBall_InitHud:
  1213.         lea ChildObjDat_RobotnikHud(pc),a2
  1214.         bsr.w   Create_ChildObject
  1215.         bne.s   BossChaseBall_Init
  1216.         move.b  #3,obFrame(a1)
  1217.         locVRAM $D2A0,$2A(a1)
  1218.         bra.s   BossChaseBall_Init
  1219. ; ---------------------------------------------------------------------------
  1220.  
  1221. BossChaseBall_InitExtra:
  1222.         movea.w obParent(a0),a1
  1223.         move.b  obStatus(a1),obStatus(a0)
  1224.         move.b  #1,obAnim(a0)
  1225.  
  1226. BossChaseBall_Init:
  1227.         addq.b  #2,ob2ndRout(a0)
  1228.         lea ObjDat3_BossGreenHill_RobotnikBall(pc),a1
  1229.         bsr.w   LoadObjects_Data
  1230.         move.b  #$46,obYNext(a0)
  1231.         move.w  #-$400,$3A(a0)
  1232.         move.w  #3,obTimer(a0)
  1233.         move.b  #3,$3F(a0)
  1234.         movea.w obParent(a0),a1
  1235.         move.b  obColProp(a1),d0
  1236.         subq.b  #2,d0
  1237.         add.b   d0,d0
  1238.         move.b  d0,obColProp(a0)
  1239.         move.w  a0,obParent(a1)
  1240.  
  1241. BossChaseBall_Locret:
  1242.         rts
  1243. ; ---------------------------------------------------------------------------
  1244.  
  1245. BossChaseBall_Move:
  1246.         movea.w obParent(a0),a1
  1247.         move.w  obX(a1),d0
  1248.         move.b  obXNext(a0),d1
  1249.         ext.w   d1
  1250.         add.w   d1,d0
  1251.         move.w  d0,obX(a0)
  1252.         move.w  obY(a1),d0
  1253.         move.b  obYNext(a0),d1
  1254.         ext.w   d1
  1255.         add.w   d1,d0
  1256.         move.w  d0,obY(a0)
  1257.         rts
  1258. ; ---------------------------------------------------------------------------
  1259.  
  1260. BossChaseBall_Fall:
  1261.         jsr (ObjectFall).l
  1262.         tst.w obVelY(a0)
  1263.         bmi.s   BossChaseBall_Locret
  1264.         jsr (ObjHitFloor).l
  1265.         tst.w   d1
  1266.         bpl.s   BossChaseBall_Locret
  1267.         add.w   d1,obY(a0)
  1268.         addq.b  #2,ob2ndRout(a0)
  1269.         clr.l   obVelX(a0)
  1270.         move.w  #$10,(Screen_Shaking_Flag).w
  1271.     if Snd_Driver_Version=0
  1272.         moveq   #$FFFFFFBD,d0
  1273.     else
  1274.         moveq   #4,d0
  1275.     endif
  1276.         jmp (PlaySound_Special).l
  1277. ; ---------------------------------------------------------------------------
  1278.  
  1279. BossChaseBall_Bouncing:
  1280.         move.w  $3A(a0),d0
  1281.         move.w  d0,obVelY(a0)
  1282.         asr.w   d0
  1283.         move.w  d0,$3A(a0)
  1284.         subq.b  #2,ob2ndRout(a0)
  1285.         subq.w  #1,obTimer(a0)
  1286.         bpl.s   BossChaseBall_Locret
  1287.         addq.b  #4,ob2ndRout(a0)
  1288.         movea.w obParent(a0),a1
  1289.         addq.b  #2,ob2ndRout(a1)
  1290.         move.w  #-$400,$3A(a0)
  1291.         move.w  #$30,obTimer(a0)
  1292.         clr.w   obVelY(a0)
  1293.         bsr.w   Find_SonicObject
  1294.         bra.w   Change_FlipX
  1295. ; ---------------------------------------------------------------------------
  1296.  
  1297. BossChaseBall_Wait:
  1298.         subq.w  #1,obTimer(a0)
  1299.         bpl.s   @1
  1300.         addq.b  #2,ob2ndRout(a0)
  1301.         clr.l obVelX(a0)
  1302. @1      rts
  1303.  
  1304. ; =============== S U B R O U T I N E =======================================
  1305.  
  1306. BossChaseBall_Check:
  1307.         addq.b  #2,ob2ndRout(a0)
  1308.         move.w  #-$500,obVelY(a0)
  1309.         move.b  #1,obAnim(a0)
  1310.         move.w  #$30,obTimer(a0)
  1311.  
  1312. BossChaseBall_CheckJump:
  1313.         jsr (SpeedToPos).l
  1314.         move.w  (v_screenposy).w,d0
  1315.         addi.w  #$30,d0
  1316.         cmp.w   obY(a0),d0
  1317.         bcs.w   BossChaseBall_Locret
  1318.         addq.b  #2,ob2ndRout(a0)
  1319.         bsr.w   Find_SonicObject
  1320.         bsr.w   Change_FlipX
  1321.         move.w  #0,obVelY(a0)
  1322.     if Snd_Driver_Version=0
  1323.         moveq   #$FFFFFFBE,d0
  1324.     else
  1325.         moveq   #20,d0
  1326.     endif
  1327.         jmp (PlaySound_Special).l
  1328. ; ---------------------------------------------------------------------------
  1329.  
  1330. BossChaseBall_Shot:
  1331.         addq.b  #2,ob2ndRout(a0)
  1332.         moveq   #4,d5
  1333.         lea (v_player).w,a1
  1334.         moveq   #0,d0
  1335.         move.w  obX(a1),d0
  1336.         moveq   #0,d1
  1337.         move.w  (v_screenposy).w,d1
  1338.         addi.w  #$B0,d1
  1339.         bra.w   Shot_Object
  1340. ; ---------------------------------------------------------------------------
  1341.  
  1342. BossChaseBall_CreateRing:
  1343.         move.b  #(BossChaseBall_JumpShot_Index-BossChaseBall_Index),ob2ndRout(a0)
  1344.         subq.b  #1,$3F(a0)
  1345.         bne.s   @0
  1346.         move.b  #(BossChaseBall_Circular_Index-BossChaseBall_Index),ob2ndRout(a0)
  1347.         move.w  #-$400,$3A(a0)
  1348.         move.w  #3,obTimer(a0)
  1349.         move.b  #3,$3F(a0)
  1350. @0      lea ChildObjDat_RobotnikChaseBallRing(pc),a2
  1351.         bsr.w   Create_ChildObject3
  1352.  
  1353. BossChaseBall_Locret2:
  1354.         rts
  1355.  
  1356. ; =============== S U B R O U T I N E =======================================
  1357.  
  1358. BossChaseBall_Circular:
  1359.         addq.b  #2,ob2ndRout(a0)
  1360.         move.w  #-$600,obVelY(a0)
  1361.         jmp (SpeedToPos).l
  1362. ; ---------------------------------------------------------------------------
  1363.  
  1364. BossChaseBall_Bouncing2:
  1365.         move.w  $3A(a0),d0
  1366.         move.w  d0,obVelY(a0)
  1367.         asr.w   d0
  1368.         move.w  d0,$3A(a0)
  1369.         subq.b  #2,ob2ndRout(a0)
  1370.         subq.w  #1,obTimer(a0)
  1371.         bpl.s   BossChaseBall_Locret2
  1372.         addq.b  #4,ob2ndRout(a0)
  1373.         move.w  #$40,obTimer(a0)
  1374.         move.b  #0,obAnim(a0)
  1375.         rts
  1376. ; ---------------------------------------------------------------------------
  1377.  
  1378. BossChaseBall_Circular_Create:
  1379.         addq.b  #2,ob2ndRout(a0)
  1380.         move.w  #-$600,obVelY(a0)
  1381.         move.w  #$150,obTimer(a0)
  1382.         move.b  #1,obAnim(a0)
  1383.  
  1384. BossChaseBall_Circular_CreateJump:
  1385.         jsr (SpeedToPos).l
  1386.         move.w  (v_screenposy).w,d0
  1387.         addi.w  #$50,d0
  1388.         cmp.w   obY(a0),d0
  1389.         bcs.s   BossChaseBall_Locret3
  1390.         addq.b  #2,ob2ndRout(a0)
  1391.         bsr.w   Find_SonicObject
  1392.         bsr.w   Change_FlipX
  1393.         clr.w   obVelY(a0)
  1394.         move.b  #$48,obHeight(a0)
  1395.     if Snd_Driver_Version=0
  1396.         moveq   #$FFFFFFBE,d0
  1397.     else
  1398.         moveq   #20,d0
  1399.     endif
  1400.         jsr (PlaySound_Special).l
  1401.         lea ChildObjDat_RobotnikChaseBallCircularRing(pc),a2
  1402.         bsr.w   Create_ChildObject2
  1403.  
  1404. BossChaseBall_Locret3:
  1405.         rts
  1406. ; ---------------------------------------------------------------------------
  1407.  
  1408. BossChaseBall_Circular_Fall_Time:
  1409.         addq.b  #2,ob2ndRout(a0)
  1410.         move.w  #$140,obTimer(a0)
  1411.  
  1412. BossChaseBall_Circular_Fall:
  1413.         jsr (ObjectFall).l
  1414.         tst.w obVelY(a0)
  1415.         bmi.s   BossChaseBall_Locret3
  1416.         subq.w  #1,obTimer(a0)
  1417.         bmi.s   @1
  1418.         jsr (ObjHitFloor).l
  1419.         tst.w   d1
  1420.         bpl.s   BossChaseBall_Locret3
  1421.         add.w   d1,obY(a0)
  1422.         addq.b  #2,ob2ndRout(a0)
  1423.         clr.l   obVelX(a0)
  1424.         move.w  #$10,(Screen_Shaking_Flag).w
  1425.     if Snd_Driver_Version=0
  1426.         moveq   #$FFFFFFBD,d0
  1427.     else
  1428.         moveq   #4,d0
  1429.     endif
  1430.         jmp (PlaySound_Special).l
  1431. ; ---------------------------------------------------------------------------
  1432. @1      move.b  #(BossChaseBall_Locret3_Index-BossChaseBall_Index),ob2ndRout(a0)
  1433.         clr.l   obVelX(a0)
  1434.         rts
  1435. ; ---------------------------------------------------------------------------
  1436.  
  1437. BossChaseBall_Circular_Jump:
  1438.         subq.b  #2,ob2ndRout(a0)
  1439.         move.w  #-$500,obVelY(a0)
  1440.         bsr.w   BossGreenHill_Move_Circular_FindSonic
  1441.         jmp (SpeedToPos).l
  1442. ; ---------------------------------------------------------------------------
  1443.  
  1444. BossChaseBall_Bouncing3:
  1445.         move.w  $3A(a0),d0
  1446.         move.w  d0,obVelY(a0)
  1447.         asr.w   d0
  1448.         move.w  d0,$3A(a0)
  1449.         subq.b  #2,ob2ndRout(a0)
  1450.         subq.w  #1,obTimer(a0)
  1451.         bne.s   BossChaseBall_Locret3
  1452.         addq.b  #4,ob2ndRout(a0)
  1453.         move.w  #$40,obTimer(a0)
  1454.         bsr.w   Find_SonicObject
  1455.         bra.w   Change_FlipX
  1456. ; ---------------------------------------------------------------------------
  1457.  
  1458. BossChaseBall_Create_ShotVertical:
  1459.         addq.b  #2,ob2ndRout(a0)
  1460.         bsr.w   Find_SonicObject
  1461.         bsr.w   Change_FlipX
  1462.         move.w  #$180,obTimer(a0)
  1463.         lea ChildObjDat_RobotnikShotRing(pc),a2
  1464.         bsr.w   Create_ChildObject4
  1465.  
  1466. BossChaseBall_Locret4:
  1467.         rts
  1468. ; ---------------------------------------------------------------------------
  1469.  
  1470. BossChaseBall_MoveLeftRightStart:
  1471.         addq.b  #2,ob2ndRout(a0)
  1472.         move.w  #$40,obTimer(a0)
  1473.         tst.b obAnim(a0)
  1474.         bne.s   @1
  1475.         bsr.w   Find_SonicObject
  1476.         bsr.w   Change_FlipX
  1477.         move.b  #1,obAnim(a0)
  1478. @1      clr.l   obVelX(a0)
  1479.     if Snd_Driver_Version=0
  1480.         moveq   #$FFFFFFBE,d0
  1481.     else
  1482.         moveq   #20,d0
  1483.     endif
  1484.         jmp (PlaySound_Special).l
  1485. ; ---------------------------------------------------------------------------
  1486.  
  1487. BossChaseBall_MoveLeftRight:
  1488.         move.w  (v_screenposx).w,d0
  1489.         move.w  #-$600,obVelX(a0)
  1490.         btst    #0,obStatus(a0)
  1491.         beq.s   @1
  1492.         neg.w   obVelX(a0)
  1493.         addi.w  #$120,d0
  1494.         cmp.w   obX(a0),d0
  1495.         bge.s   @3
  1496.         bra.s   @2
  1497. @1      addi.w  #$20,d0
  1498.         cmp.w   obX(a0),d0
  1499.         ble.s       @3
  1500. @2      move.b  #(BossChaseBall_Wait3_Index-BossChaseBall_Index),ob2ndRout(a0)
  1501.         clr.w   obVelX(a0)
  1502.         bchg    #0,obStatus(a0)
  1503. @3      jmp (SpeedToPos).l
  1504. ; ---------------------------------------------------------------------------
  1505.  
  1506. BossChaseBall_MoveLeftRightCreateClone_Time:
  1507.         addq.b  #2,ob2ndRout(a0)
  1508.         move.w  #$248,obTimer(a0)
  1509.  
  1510. BossChaseBall_MoveLeftRightCreateClone:
  1511.         subq.w  #1,obTimer(a0)
  1512.         bpl.s   @0
  1513.         addq.b  #2,ob2ndRout(a0)
  1514.         move.w  #$20,obTimer(a0)
  1515.         bsr.w   Find_SonicObject
  1516.         bsr.w   Change_FlipX
  1517.     if Snd_Driver_Version=0
  1518.         moveq   #$FFFFFFBE,d0
  1519.     else
  1520.         moveq   #20,d0
  1521.     endif
  1522.         jsr (PlaySound_Special).l
  1523. @0      move.w  (v_framecount).w,d0
  1524.         andi.w  #$1F,d0
  1525.         bne.s   BossChaseBall_MoveLeftRightClone
  1526.         lea ChildObjDat_RobotnikChaseBallClone(pc),a2
  1527.         bsr.w   Create_ChildObject
  1528.  
  1529. BossChaseBall_MoveLeftRightClone:
  1530.         move.w  (v_screenposx).w,d0
  1531.         move.w  #-$200,obVelX(a0)
  1532.         move.w  #0,obVelY(a0)
  1533.         btst    #0,obStatus(a0)
  1534.         beq.s   @1
  1535.         neg.w   obVelX(a0)
  1536.         addi.w  #$120,d0
  1537.         cmp.w   obX(a0),d0
  1538.         bge.s   @3
  1539.         bra.s   @2
  1540. @1      addi.w  #$20,d0
  1541.         cmp.w   obX(a0),d0
  1542.         ble.s       @3
  1543. @2      bchg    #0,obStatus(a0)
  1544. @3      jmp (SpeedToPos).l
  1545. ; ---------------------------------------------------------------------------
  1546.  
  1547. BossChaseBall_MoveFallDestroy:
  1548.         subq.w  #1,obTimer(a0)
  1549.         bne.s   BossChaseBall_Locret5
  1550.         addq.b  #2,ob2ndRout(a0)
  1551.         move.w  #-$400,$3A(a0)
  1552.         move.w  #3,obTimer(a0)
  1553.         move.b  #0,obAnim(a0)
  1554.  
  1555. BossChaseBall_Locret5:
  1556.         rts
  1557. ; ---------------------------------------------------------------------------
  1558.  
  1559. BossChaseBall_JumpWait:
  1560.         move.w  $3A(a0),d0
  1561.         move.w  d0,obVelY(a0)
  1562.         asr.w   d0
  1563.         move.w  d0,$3A(a0)
  1564.         subq.b  #2,ob2ndRout(a0)
  1565.         subq.w  #1,obTimer(a0)
  1566.         bne.s   BossChaseBall_Locret5
  1567.         addq.b  #4,ob2ndRout(a0)
  1568.         move.w  #$30,obTimer(a0)
  1569.         clr.l   obVelX(a0)
  1570.         rts
  1571.  
  1572. ; =============== S U B R O U T I N E =======================================
  1573.  
  1574. BossChaseBall_CreateRadiusCircular:
  1575.         addq.b  #2,ob2ndRout(a0)
  1576.         bsr.w   Find_SonicObject
  1577.         bsr.w   Change_FlipX
  1578.         move.b  #1,obAnim(a0)
  1579.         lea ChildObjDat_RobotnikChaseBallCircularRadius(pc),a2
  1580.         bsr.w   Create_ChildObject2
  1581.         move.w  #-$200,obVelX(a0)
  1582.         btst    #0,obStatus(a0)
  1583.         beq.s   @1
  1584.         neg.w   obVelX(a0)
  1585. @1  if Snd_Driver_Version=0
  1586.         moveq   #$FFFFFFBE,d0
  1587.     else
  1588.         moveq   #20,d0
  1589.     endif
  1590.         jmp (PlaySound_Special).l
  1591. ; ---------------------------------------------------------------------------
  1592.  
  1593. BossChaseBall_MoveRadiusCircular:
  1594.         bsr.w   Find_SonicObject
  1595.         addi.w  #$10,d2
  1596.         cmpi.w  #$80,d2
  1597.         bcs.s   @2
  1598.         move.w  #$200,d1
  1599.         tst.w   d0
  1600.         bne.s   @1
  1601.         neg.w   d1
  1602. @1      move.w  d1,obVelX(a0)
  1603. @2      bsr.w   Change_FlipXWithVelocity
  1604.         jmp (SpeedToPos).l
  1605.  
  1606. ; =============== S U B R O U T I N E =======================================
  1607.  
  1608. BossChaseBall_Bouncing4:
  1609.         lea Obj8DCheseBall_Speed(pc),a4
  1610.         lea Obj8DCheseBall_Pos(pc),a5
  1611.         moveq   #5,d4
  1612.         moveq   #3,d1
  1613.         moveq   #$38,d2
  1614.         move.b  #(BossChaseBall_Bouncing4_Remove_Index-BossChaseBall_Index),ob2ndRout(a0)
  1615.         move.b  #$10,obActWid(a0)
  1616.         move.b  #$16,obHeight(a0)
  1617.         move.b  #0,obColType(a0)
  1618.         bclr #0,obRender(a0)
  1619.         lea (a0),a1
  1620.         bra.s   @1
  1621. @2      jsr (SingleObjLoad2).l
  1622.         bne.s   @4
  1623. @1      lea (a0),a2
  1624.         lea (a1),a3
  1625.         moveq   #3,d3
  1626. @3  rept 4
  1627.         move.l  (a2)+,(a3)+
  1628.     endr
  1629.         dbf d3,@3
  1630.         move.w  (a4)+,obVelX(a1)
  1631.         move.w  (a4)+,obVelY(a1)
  1632.         move.w  (a5)+,d3
  1633.         add.w   d3,obX(a1)
  1634.         move.w  (a5)+,d3
  1635.         add.w   d3,obY(a1)
  1636.         move.b  d4,obFrame(a1)
  1637.         addq.w  #1,d4
  1638.         dbf d1,@2
  1639. @4  if Snd_Driver_Version=0
  1640.         moveq   #$FFFFFFCB,d0
  1641.     else
  1642.         moveq   #1,d0
  1643.     endif
  1644.         jmp (PlaySound_Special).l
  1645. ; ---------------------------------------------------------------------------
  1646.  
  1647. BossChaseBall_Remove:
  1648.         jsr (ObjectFall).l
  1649.         tst.b obRender(a0)
  1650.         bmi.w   BossChaseBallHurt_Locret
  1651.         jmp (DeleteObject).l
  1652.  
  1653. ; =============== S U B R O U T I N E =======================================
  1654.  
  1655. BossChaseBall_Hurt:
  1656.         cmpi.b  #(BossChaseBall_Defeated_Index-BossChaseBall_Index),ob2ndRout(a0)
  1657.         bcc.s   BossChaseBallHurt_Locret
  1658.         tst.b obColType(a0)
  1659.         bne.s   BossChaseBallHurt_Locret
  1660.         tst.b obColProp(a0)
  1661.         beq.w   BossChaseBall_ShipGone
  1662.         tst.b   obFlash(a0)
  1663.         bne.s   @2
  1664.         move.b  #$90,obFlash(a0)
  1665.     if Snd_Driver_Version=0
  1666.         moveq   #$FFFFFFAC,d0
  1667.     else
  1668.         moveq   #10,d0
  1669.     endif
  1670.         jsr (PlaySound_Special).l
  1671.         bset    #6,obStatus(a0)
  1672.         lea (v_player).w,a1
  1673.         move.w  #$600,d0
  1674.         btst    #0,obRender(a1)
  1675.         bne.s   @1
  1676.         neg.w   d0
  1677. @1      move.w  d0,obVelX(a1)
  1678.         bsr.w   Load_SimpleRing
  1679. @2      moveq   #0,d0
  1680.         btst    #0,obFlash(a0)
  1681.         bne.s   @3
  1682.         addi.w  #$C,d0
  1683. @3      lea LoadBossChaseBall_PalRAM(pc),a1
  1684.         lea LoadBossChaseBall_PalCycle(pc,d0.w),a2
  1685.     rept 6
  1686.         movea.w (a1)+,a3
  1687.         move.w  (a2)+,(a3)+
  1688.     endr
  1689.         subq.b  #1,obFlash(a0)
  1690.         bne.s   BossChaseBallHurt_Locret
  1691.         bclr    #6,obStatus(a0)
  1692.  
  1693. BossChaseBallHurt_Locret:
  1694.         rts
  1695. ; ---------------------------------------------------------------------------
  1696.  
  1697. LoadBossChaseBall_PalRAM:
  1698.         dc.w $FB74
  1699.         dc.w $FB76
  1700.         dc.w $FB78
  1701.         dc.w $FB7A
  1702.         dc.w $FB7C
  1703.         dc.w $FB7E
  1704. LoadBossChaseBall_PalCycle:
  1705.         dc.w $ECC
  1706.         dc.w $CAA
  1707.         dc.w $A88
  1708.         dc.w $866
  1709.         dc.w $644
  1710.         dc.w $222
  1711.         dc.w $E
  1712.         dc.w $C
  1713.         dc.w $A
  1714.         dc.w 8
  1715.         dc.w 6
  1716.         dc.w 8
  1717. ; ---------------------------------------------------------------------------
  1718.  
  1719. BossChaseBall_ShipGone:
  1720.         move.b  #(BossChaseBall_Defeated_Index-BossChaseBall_Index),ob2ndRout(a0)
  1721.         move.b  #$AE,$2E(a0)
  1722.         bchg #4,obStatus(a0)
  1723.         bset    #6,obStatus(a0)
  1724.         rts
  1725. ; ---------------------------------------------------------------------------
  1726.  
  1727. BossChaseBall_Defeated:
  1728.         subq.b  #1,$2E(a0)
  1729.         bne.s   @1
  1730.         move.b  #(BossChaseBall_Bouncing4_Index-BossChaseBall_Index),ob2ndRout(a0)
  1731. @1      move.b  (v_vbla_count+3).w,d0
  1732.         andi.b  #7,d0
  1733.         bne.s   @2
  1734.         jsr (SingleObjLoad).l
  1735.         bne.s   @2
  1736.         move.b  #$3F,(a1)
  1737.         move.w  obX(a0),obX(a1)
  1738.         move.w  obY(a0),obY(a1)
  1739.         jsr (RandomNumber).l
  1740.         move.w  d0,d1
  1741.         andi.w  #$1F,d1
  1742.         subi.w  #$10,d1
  1743.         add.w   d1,obX(a1)
  1744.         neg.w   d0
  1745.         andi.w  #$1F,d0
  1746.         subi.w  #$10,d0
  1747.         add.w   d0,obY(a1)
  1748. @2      rts
  1749.  
  1750. ; =============== S U B R O U T I N E =======================================
  1751.  
  1752. BossChaseBall_Collision:
  1753.         btst    #6,obStatus(a0)
  1754.         bne.s   @1
  1755.         moveq   #0,d0
  1756.         move.b  obAnim(a0),d0
  1757.         move.b  @Data_Collision(pc,d0.w),d1
  1758.         move.b  d1,obColType(a0)
  1759. @1      rts
  1760. ; ---------------------------------------------------------------------------
  1761.  
  1762. @Data_Collision:
  1763.         dc.b $F
  1764.         dc.b $81
  1765.  
  1766. ; =============== S U B R O U T I N E =======================================
  1767.  
  1768. BossChaseBall_Load_Dynamic_Location:
  1769.         moveq   #0,d0
  1770.         move.b  $2B(a0),d0
  1771.         addq.b  #1,$2B(a0)
  1772.         cmpi.b  #(@Load_DCL-@Load_DNL)-1,d0
  1773.         bne.s   @1
  1774.         move.b  #0,$2B(a0)
  1775. @1      moveq   #0,d1
  1776.         move.b  @Load_DNL(pc,d0.w),d1
  1777.         move.b  @Load_DCL(pc,d1.w),ob2ndRout(a0)
  1778.         lea ChildObjDat_Targetting_Sensor(pc),a2
  1779.         bra.w   Create_ChildObject2
  1780. ; ---------------------------------------------------------------------------
  1781.  
  1782. @Load_DNL:
  1783.         dc.b 0
  1784.         dc.b 1
  1785.         dc.b 3
  1786.         dc.b 2
  1787.         dc.b 3
  1788.         dc.b 0
  1789.         dc.b 1
  1790.         dc.b 4
  1791.         dc.b 0
  1792.         dc.b 3
  1793.         dc.b 2
  1794.         dc.b 0
  1795.         dc.b 3
  1796. @Load_DCL:
  1797.         dc.b (BossChaseBall_JumpShot_Index-BossChaseBall_Index)
  1798.         dc.b (BossChaseBall_JumpCircular_Index-BossChaseBall_Index)
  1799.         dc.b (BossChaseBall_ShotVertical_Index-BossChaseBall_Index)
  1800.         dc.b (BossChaseBall_CreateClone_Index-BossChaseBall_Index)
  1801.         dc.b (BossChaseBall_RadiusCircular_Index-BossChaseBall_Index)
  1802.  
  1803. ; =============== S U B R O U T I N E =======================================
  1804.  
  1805. Targetting_Sensor:
  1806.         lea Targetting_Sensor_ShipIndex(pc),a1
  1807.         bra.w   ChildObjectsRoutine
  1808. ; ---------------------------------------------------------------------------
  1809.  
  1810. Targetting_Sensor_ShipIndex:
  1811.         offsetEntry.w Targetting_Sensor_Init
  1812.         offsetEntry.w Targetting_Sensor_Show
  1813.         offsetEntry.w Robotnik_HudLives_MoveRemove
  1814. Targetting_Sensor2_Init
  1815.         offsetEntry.w Targetting_Sensor_Init
  1816.         offsetEntry.w Targetting_Sensor2_Create
  1817.         offsetEntry.w Targetting_Sensor2_Show
  1818.         offsetEntry.w Robotnik_HudLives_MoveRemove
  1819. Targetting_Sensor3_Init
  1820.         offsetEntry.w Targetting_Sensor_Init
  1821.         offsetEntry.w Targetting_Sensor3_Create
  1822.         offsetEntry.w Targetting_Sensor3_Check
  1823.         offsetEntry.w Targetting_Sensor3_Return
  1824. Targetting_Sensor3_Remove
  1825.         offsetEntry.w Robotnik_HudLives_MoveRemove
  1826. ; ---------------------------------------------------------------------------
  1827.  
  1828. Targetting_Sensor_Init:
  1829.         addq.b  #2,ob2ndRout(a0)
  1830.         lea ObjDat3_Targetting_Sensor(pc),a1
  1831.         bra.w   LoadObjects_Data
  1832. ; ---------------------------------------------------------------------------
  1833.  
  1834. Targetting_Sensor3_Create:
  1835.         addq.b  #2,ob2ndRout(a0)
  1836.         movea.w obParent(a0),a1
  1837.         move.b  #2,obAnim(a1)
  1838.         move.w  obX(a0),obXNext(a0)
  1839.         move.w  obY(a0),obYNext(a0)
  1840.         moveq   #0,d0
  1841.         move.b  obSubtype(a0),d0
  1842.         move.w  d0,d1
  1843.         lsr.w   #1,d0
  1844.         move.b  RawAni_7917E(pc,d0.w),obFrame(a0)
  1845.         add.w   d1,d1
  1846.         move.l  dword_79182(pc,d1.w),obVelX(a0)
  1847.         move.w  #$B,obTimer(a0)
  1848.         rts
  1849. ; ---------------------------------------------------------------------------
  1850.  
  1851. RawAni_7917E:
  1852.         dc.b 8, 9, $A, $B
  1853. dword_79182:
  1854.         dc.w $100
  1855.         dc.w 0
  1856.         dc.w -$100
  1857.         dc.w 0
  1858.         dc.w 0
  1859.         dc.w $100
  1860.         dc.w 0
  1861.         dc.w -$100
  1862. ; ---------------------------------------------------------------------------
  1863.  
  1864. Targetting_Sensor3_Check:
  1865.         movea.w obParent(a0),a1
  1866.         tst.b obRender(a1)
  1867.         bmi.s   Targetting_Sensor3_Move
  1868.         move.b  #(Targetting_Sensor3_Remove-Targetting_Sensor_ShipIndex),ob2ndRout(a0)
  1869.  
  1870. Targetting_Sensor3_Move:
  1871.         jsr (SpeedToPos).l
  1872.         subq.w  #1,obTimer(a0)
  1873.         bpl.w   Targetting_Sensor_Draw
  1874.         addq.b  #2,ob2ndRout(a0)
  1875.         move.w  #$F,obTimer(a0)
  1876.  
  1877. Targetting_Sensor3_Return:
  1878.         subq.w  #1,obTimer(a0)
  1879.         bpl.s   Targetting_Sensor_Draw
  1880.         subq.b  #2,ob2ndRout(a0)
  1881.         move.w  obXNext(a0),obX(a0)
  1882.         move.w  obYNext(a0),obY(a0)
  1883.         move.w  #$B,obTimer(a0)
  1884.         rts
  1885. ; ---------------------------------------------------------------------------
  1886.  
  1887. Targetting_Sensor2_Create:
  1888.         addq.b  #2,ob2ndRout(a0)
  1889. ;       lea ChildObjDat_Targetting_Sensor3(pc),a2
  1890. ;       bsr.w   Create_ChildObject5
  1891.  
  1892. Targetting_Sensor2_Show:
  1893.         movea.w obParent(a0),a1
  1894.         tst.b obRender(a1)
  1895.         bpl.s   Targetting_Sensor_Animate
  1896.         bra.s   Targetting_Sensor_Remove
  1897. ; ---------------------------------------------------------------------------
  1898.  
  1899. Targetting_Sensor_Show:
  1900.         movea.w obParent(a0),a1
  1901.         move.w  obX(a1),obX(a0)
  1902.         move.w  obY(a1),obY(a0)
  1903.         btst    #4,obStatus(a1)
  1904.         bne.s   Targetting_Sensor_Remove
  1905.         tst.b   obFlash(a1)
  1906.         bne.s   Targetting_Sensor_Locret
  1907.         tst.b   obAnim(a1)
  1908.         beq.s   Targetting_Sensor_Count
  1909.  
  1910. Targetting_Sensor_Remove:
  1911.         addq.b  #2,ob2ndRout(a0)
  1912.  
  1913. Targetting_Sensor_Locret:
  1914.         rts
  1915. ; ---------------------------------------------------------------------------
  1916.  
  1917. Targetting_Sensor_Count:
  1918.         move.w  (v_framecount).w,d0
  1919.         andi.w  #7,d0
  1920.         bne.s   Targetting_Sensor_Animate
  1921.     if Snd_Driver_Version=0
  1922.         moveq   #$FFFFFFCD,d0
  1923.     else
  1924.         moveq   #41,d0
  1925.     endif
  1926.         jsr (PlaySound_Special).l
  1927.  
  1928. Targetting_Sensor_Animate:
  1929.         lea (Ani_obj8D).l,a1
  1930.         jsr (AnimateSprite).l
  1931.  
  1932. Targetting_Sensor_Draw:
  1933.         jmp (DisplaySprite).l
  1934.  
  1935. ; =============== S U B R O U T I N E =======================================
  1936.  
  1937. Robotnik_ShipCrane:
  1938.         lea Robotnik_ShipCrane_ShipIndex(pc),a1
  1939.         bsr.w   ChildObjectsRoutine
  1940.         jmp (DisplaySprite).l
  1941. ; ---------------------------------------------------------------------------
  1942.  
  1943. Robotnik_ShipCrane_ShipIndex:
  1944.         offsetEntry.w Robotnik_ShipCrane_Init
  1945.         offsetEntry.w Robotnik_ShipCrane_Check
  1946.         offsetEntry.w Robotnik_ShipCrane_CheckRemove
  1947.         offsetEntry.w Robotnik_HudLives_MoveRemove
  1948. ; ---------------------------------------------------------------------------
  1949.  
  1950. Robotnik_ShipCrane_Init:
  1951.         addq.b  #2,ob2ndRout(a0)
  1952.         lea ObjDat3_RobotnikShipCrane(pc),a1
  1953.         bsr.w   LoadObjects_Data
  1954.         tst.w   obSubtype(a0)
  1955.         beq.s   Robotnik_ShipCrane_Check
  1956.         move.b  #3,obFrame(a0)
  1957.         move.b  #5,obPriority(a0)
  1958.  
  1959. Robotnik_ShipCrane_Check:
  1960.         movea.w obParent(a0),a1
  1961.         cmpi.b  #(BossGreenHill_ShipIndex_RevengeMode_Wait-BossGreenHill_ShipIndex),ob2ndRout(a1)
  1962.         bne.s   Robotnik_ShipCrane_CheckRemove
  1963.         addq.b  #2,ob2ndRout(a0)
  1964.         move.b  #0,obFrame(a0)
  1965.         tst.w   obSubtype(a0)
  1966.         beq.s   Robotnik_ShipCrane_CheckRemove
  1967.         move.b  #1,obFrame(a0)
  1968.  
  1969. Robotnik_ShipCrane_CheckRemove:
  1970.         movea.w obParent(a0),a1
  1971.         cmpi.b  #(BossGreenHill_ShipIndex_RevengeMode_CheckReturn-BossGreenHill_ShipIndex),ob2ndRout(a1)
  1972.         bne.s   Robotnik_ShipCrane_Move
  1973.         addq.b  #2,ob2ndRout(a0)
  1974.  
  1975. Robotnik_ShipCrane_Move:
  1976.         movea.w obParent(a0),a1
  1977.         move.w  obX(a1),d0
  1978.         move.b  obXNext(a0),d1
  1979.         ext.w   d1
  1980.         bclr    #0,obRender(a0)
  1981.         btst    #0,obStatus(a1)
  1982.         beq.s   @1
  1983.         neg.w   d1
  1984.         bset    #0,obRender(a0)
  1985. @1      add.w   d1,d0
  1986.         move.w  d0,obX(a0)
  1987.         move.w  obY(a1),d0
  1988.         move.b  obYNext(a0),d1
  1989.         ext.w   d1
  1990.         bclr    #1,obRender(a0)
  1991.         btst    #1,obStatus(a1)
  1992.         beq.s   @2
  1993.         neg.w   d1
  1994.         bset    #1,obRender(a0)
  1995. @2      add.w   d1,d0
  1996.         move.w  d0,obY(a0)
  1997.         rts
  1998.  
  1999. ; =============== S U B R O U T I N E =======================================
  2000.  
  2001. Robotnik_Run:
  2002.         lea Robotnik_Run_ShipIndex(pc),a1
  2003.         bsr.w   ChildObjectsRoutine
  2004.         bsr.w   Level_Defeated
  2005.         jmp (DisplaySprite).l
  2006. ; ---------------------------------------------------------------------------
  2007.  
  2008. Robotnik_Run_ShipIndex:
  2009.         offsetEntry.w Robotnik_Run_Init
  2010.         offsetEntry.w Robotnik_Run_Jump
  2011.         offsetEntry.w Robotnik_Run_Move
  2012. ; ---------------------------------------------------------------------------
  2013.  
  2014. Robotnik_Run_Init:
  2015.         addq.b  #2,ob2ndRout(a0)
  2016.         lea ObjDat3_RobotnikRun(pc),a1
  2017.         bsr.w   LoadObjects_Data
  2018.         move.b  #$1E,obHeight(a0)
  2019.         bset    #0,obRender(a0)
  2020.         bset    #0,obStatus(a0)
  2021.         move.w  #$100,obVelX(a0)
  2022.         move.w  #-$800,obVelY(a0)
  2023.  
  2024. Robotnik_Run_Jump:
  2025.         jsr (ObjectFall).l
  2026.         tst.w obVelY(a0)
  2027.         bmi.s   Robotnik_Run_Locret
  2028.         jsr (ObjHitFloor).l
  2029.         tst.w   d1
  2030.         bpl.s   Robotnik_Run_Locret
  2031.         add.w   d1,obY(a0)
  2032.         addq.b  #2,ob2ndRout(a0)
  2033.         move.b  #$A,(v_dle_routine).w
  2034.         move.w  #$300,obVelX(a0)
  2035.         move.w  #0,obVelY(a0)
  2036.  
  2037. Robotnik_Run_Locret:
  2038.         rts
  2039. ; ---------------------------------------------------------------------------
  2040.  
  2041. Robotnik_Run_Move:
  2042.         bsr.w   Find_SonicObject
  2043.         addi.w  #$50,d2
  2044.         cmpi.w  #$A0,d2
  2045.         bhs.s   Robotnik_Run_Animate
  2046.         move.w  obX(a1),d0
  2047.         addi.w  #$50,d0
  2048.         move.w  d0,obX(a0)
  2049.  
  2050. Robotnik_Run_Animate:
  2051.         jsr (SpeedToPos).l
  2052.         lea (Ani_RobotnikRun).l,a1
  2053.         jmp (AnimateSprite).l
  2054. ; ---------------------------------------------------------------------------
  2055.  
  2056. Level_Defeated:
  2057.         moveq   #0,d0
  2058.         move.b  (v_vbla_count+3).w,d0
  2059.         andi.b  #6,d0
  2060.         bne.s   @1
  2061.         jsr (SingleObjLoad2).l
  2062.         bne.s   @1
  2063.         move.b  #$3F,(a1)
  2064.         move.w  obX(a0),obX(a1)
  2065.         move.w  obY(a0),obY(a1)
  2066.         jsr (RandomNumber).l
  2067.         moveq   #0,d1
  2068.         move.b  #$80,d1
  2069.         move.w  d1,d2
  2070.         add.w   d2,d2
  2071.         subq.w  #1,d2
  2072.         and.w   d2,d0
  2073.         sub.w   d1,d0
  2074.         add.w   d0,obX(a1)
  2075.         swap    d0
  2076.         moveq   #0,d1
  2077.         move.b  #$80,d1
  2078.         move.w  d1,d2
  2079.         add.w   d2,d2
  2080.         subq.w  #1,d2
  2081.         and.w   d2,d0
  2082.         sub.w   d1,d0
  2083.         add.w   d0,obY(a1)
  2084. @1      rts
  2085.  
  2086. ; =============== S U B R O U T I N E =======================================
  2087.  
  2088. Robotnik_HudLives:
  2089.         lea Robotnik_HudLives_ShipIndex(pc),a1
  2090.         bra.w   ChildObjectsRoutine
  2091. ; ---------------------------------------------------------------------------
  2092.  
  2093. Robotnik_HudLives_ShipIndex:
  2094.         offsetEntry.w Robotnik_HudLives_Init
  2095.         offsetEntry.w Robotnik_HudLives_MoveUp
  2096.         offsetEntry.w Robotnik_HudLives_MoveDown
  2097.         offsetEntry.w Robotnik_HudLives_MoveRemove
  2098. ; ---------------------------------------------------------------------------
  2099.  
  2100. Robotnik_HudLives_Init:
  2101.         addq.b  #2,ob2ndRout(a0)
  2102.         move.l  #Map_obj21,obMap(a0)
  2103.         move.w  #$A680,obGfx(a0)
  2104.         move.w  #$170,obX(a0)
  2105.         move.w  #$28,obScreenY(a0)
  2106.         move.l  #Hud_10,$36(a0)
  2107.         move.l  #Art_LivesNums,$30(a0)
  2108.  
  2109. Robotnik_HudLives_MoveUp:
  2110.         addq.w  #1,obScreenY(a0)
  2111.         cmpi.w  #$48,obScreenY(a0)
  2112.         bne.s   Robotnik_HudLives_MoveDisplay
  2113.         addq.b  #2,ob2ndRout(a0)
  2114.  
  2115. Robotnik_HudLives_MoveDown:
  2116.         movea.w obParent(a0),a1
  2117.         cmpi.b  #(BossGreenHill_RobotnikShip_Index-BossGreenHill_Index),obRoutine(a1)
  2118.         bne.s   Robotnik_HudLives_Check
  2119.         cmpi.b  #(BossGreenHill_ShipIndex_RevengeMode-BossGreenHill_ShipIndex),ob2ndRout(a1)
  2120.         bne.s   Robotnik_HudLives_Check
  2121.         bra.s   Robotnik_HudLives_Move2Down
  2122. ; ---------------------------------------------------------------------------
  2123.  
  2124. Robotnik_HudLives_Check:
  2125.         tst.b obColProp(a1)
  2126.         bne.s   Robotnik_HudLives_MoveDisplay
  2127.  
  2128. Robotnik_HudLives_Move2Down:
  2129.         subq.w  #1,obScreenY(a0)
  2130.         cmpi.w  #$28,obScreenY(a0)
  2131.         bne.s   Robotnik_HudLives_MoveDisplay
  2132.         addq.b  #2,ob2ndRout(a0)
  2133.  
  2134. Robotnik_HudLives_MoveDisplay:
  2135.         move    #$2700,sr
  2136.         bsr.s   Robotnik_HudLives_DPLC
  2137.         move    #$2300,sr
  2138.         jmp (DisplaySprite).l
  2139. ; ---------------------------------------------------------------------------
  2140.  
  2141. Robotnik_HudLives_MoveRemove:
  2142.         jmp (DeleteObject).l
  2143. ; ---------------------------------------------------------------------------
  2144.  
  2145. Robotnik_HudLives_DPLC:
  2146.         lea (VDP_data_port).l,a6
  2147.         move.l  $2A(a0),d0
  2148.         moveq   #0,d1
  2149.         movea.w obParent(a0),a1
  2150.         move.b  obColProp(a1),d1
  2151.         movea.l $36(a0),a2
  2152.         moveq   #1,d6
  2153.         moveq   #0,d4
  2154.         movea.l $30(a0),a1
  2155. @0      move.l  d0,VDP_control_port-VDP_data_port(a6)
  2156.         moveq   #0,d2
  2157.         move.l  (a2)+,d3
  2158. @1      sub.l   d3,d1
  2159.         bcs.s   @2
  2160.         addq.w  #1,d2
  2161.         bra.s   @1
  2162. @2      add.l   d3,d1
  2163.         tst.w   d2
  2164.         beq.s   @3
  2165.         move.w  #1,d4
  2166. @3      tst.w   d4
  2167.         beq.s   @6
  2168. @4      lsl.w   #5,d2
  2169.         lea (a1,d2.w),a3
  2170.         move.l  (a3)+,(a6)
  2171.         move.l  (a3)+,(a6)
  2172.         move.l  (a3)+,(a6)
  2173.         move.l  (a3)+,(a6)
  2174.         move.l  (a3)+,(a6)
  2175.         move.l  (a3)+,(a6)
  2176.         move.l  (a3)+,(a6)
  2177.         move.l  (a3)+,(a6)
  2178. @5      addi.l  #$400000,d0
  2179.         dbf d6,@0
  2180.         rts
  2181. ; ---------------------------------------------------------------------------
  2182. @6      tst.w   d6
  2183.         beq.s   @4
  2184.         moveq   #7,d5
  2185. @7      move.l  #0,(a6)
  2186.         dbf d5,@7
  2187.         bra.s   @5
  2188.  
  2189. ; =============== S U B R O U T I N E =======================================
  2190.  
  2191. ObjectsRoutine:
  2192.         moveq   #0,d0
  2193.         move.b  obRoutine(a0),d0
  2194.         adda.w  (a1,d0.w),a1
  2195.         jmp (a1,d0.w)
  2196. ; ---------------------------------------------------------------------------
  2197.  
  2198. ChildObjectsRoutine:
  2199.         moveq   #0,d0
  2200.         move.b  ob2ndRout(a0),d0
  2201.         adda.w  (a1,d0.w),a1
  2202.         jmp (a1,d0.w)
  2203. ; ---------------------------------------------------------------------------
  2204.  
  2205. LoadObjects_Data:
  2206.         move.l  (a1)+,obMap(a0)
  2207.         move.w  (a1)+,obGfx(a0)
  2208.  
  2209. LoadObjects_ExtraData:
  2210.         move.b  (a1)+,obPriority(a0)
  2211.         move.b  (a1)+,obWidth(a0)
  2212.         move.b  (a1)+,obHeight(a0)
  2213.         move.b  (a1)+,obActWid(a0)
  2214.         move.b  (a1)+,obFrame(a0)
  2215.         move.b  (a1)+,obColType(a0)
  2216.         bset    #2,obRender(a0)
  2217.         rts
  2218. ; ---------------------------------------------------------------------------
  2219.  
  2220. Create_ChildObject:
  2221.         moveq   #0,d2
  2222.         move.w  (a2)+,d6
  2223. @1      jsr (SingleObjLoad2).l
  2224.         bne.s   @2
  2225.         move.w  a0,obParent(a1)
  2226.         move.l  obMap(a0),obMap(a1)
  2227.         move.w  obGfx(a0),obGfx(a1)
  2228.         move.b  (a2)+,(a1)
  2229.         move.b  d2,obSubtype(a1)
  2230.         move.w  obX(a0),obX(a1)
  2231.         move.w  obY(a0),obY(a1)
  2232.         move.b  (a2)+,obRoutine(a1)
  2233.         move.b  (a2)+,ob2ndRout(a1)
  2234.         addq.w  #2,d2
  2235.         dbf d6,@1
  2236.         moveq   #0,d0
  2237. @2      rts
  2238. ; ---------------------------------------------------------------------------
  2239.  
  2240. Create_ChildObject2:
  2241.         moveq   #0,d2
  2242.         move.w  (a2)+,d6
  2243.         move.w  (a2)+,d3
  2244. @1      jsr (SingleObjLoad2).l
  2245.         bne.s   @2
  2246.         move.w  a0,obParent(a1)
  2247.         move.b  (a2),(a1)
  2248.         move.b  d2,obSubtype(a1)
  2249.         move.w  obX(a0),obX(a1)
  2250.         move.w  obY(a0),obY(a1)
  2251.         move.w  d3,obRoutine(a1)
  2252.         addq.w  #2,d2
  2253.         dbf d6,@1
  2254.         moveq   #0,d0
  2255. @2      rts
  2256. ; ---------------------------------------------------------------------------
  2257.  
  2258. Create_ChildObject3:
  2259.         moveq   #0,d2
  2260.         move.w  (a2)+,d6
  2261.         move.w  (a2)+,d3
  2262. @1      jsr (SingleObjLoad2).l
  2263.         bne.s   @2
  2264.         move.w  a0,obParent(a1)
  2265.         move.b  d3,(a1)
  2266.         move.b  d2,obSubtype(a1)
  2267.         move.w  obX(a0),obX(a1)
  2268.         move.w  obY(a0),obY(a1)
  2269.         move.w  (a2)+,obVelX(a1)
  2270.         move.w  (a2)+,obVelY(a1)
  2271.         move.b  (a2)+,obRoutine(a1)
  2272.         move.b  (a2)+,ob2ndRout(a1)
  2273.         addq.w  #2,d2
  2274.         dbf d6,@1
  2275.         moveq   #0,d0
  2276. @2      rts
  2277. ; ---------------------------------------------------------------------------
  2278.  
  2279. Create_ChildObject4:
  2280.         moveq   #0,d2
  2281.         move.w  (a2)+,d6
  2282.         move.w  (a2)+,d3
  2283. @1      jsr (SingleObjLoad2).l
  2284.         bne.s   @2
  2285.         move.w  a0,obParent(a1)
  2286.         move.b  (a2),(a1)
  2287.         move.b  d2,obSubtype(a1)
  2288.         move.w  obX(a0),obX(a1)
  2289.         move.w  obY(a0),obY(a1)
  2290.         move.w  d3,obRoutine(a1)
  2291.         jsr (RandomNumber).l
  2292.         andi.w  #$FF,d0
  2293.         addi.w  #$20,d0
  2294.         move.w  d0,$38(a1)
  2295.         addq.w  #2,d2
  2296.         dbf d6,@1
  2297.         moveq   #0,d0
  2298. @2      rts
  2299. ; ---------------------------------------------------------------------------
  2300.  
  2301. Create_ChildObject5:
  2302.         moveq   #0,d2
  2303.         move.w  (a2)+,d6
  2304.         move.w  (a2)+,d3
  2305. @1      jsr (SingleObjLoad2).l
  2306.         bne.s   @2
  2307.         move.w  a0,obParent(a1)
  2308.         move.b  (a2)+,(a1)
  2309.         move.b  d2,obSubtype(a1)
  2310.         move.w  obX(a0),d0
  2311.         move.b  (a2)+,d1
  2312.         move.b  d1,obXNext(a1)
  2313.         ext.w   d1
  2314.         add.w   d1,d0
  2315.         move.w  d0,obX(a1)
  2316.         move.w  obY(a0),d0
  2317.         move.b  (a2)+,d1
  2318.         move.b  d1,obYNext(a1)
  2319.         ext.w   d1
  2320.         add.w   d1,d0
  2321.         move.w  d0,obY(a1)
  2322.         move.w  d3,obRoutine(a1)
  2323.         addq.w  #2,d2
  2324.         dbf d6,@1
  2325.         moveq   #0,d0
  2326. @2      rts
  2327. ; ---------------------------------------------------------------------------
  2328.  
  2329. Find_SonicObject:
  2330.         lea (v_player).w,a1
  2331.  
  2332. Find_OtherObject:
  2333.         moveq   #0,d0
  2334.         move.w  obX(a0),d2
  2335.         sub.w   obX(a1),d2
  2336.         bpl.s   @1
  2337.         neg.w   d2
  2338.         addq.w  #2,d0
  2339. @1      moveq   #0,d1
  2340.         move.w  obY(a0),d3
  2341.         sub.w   obY(a1),d3
  2342.         bpl.s   @2
  2343.         neg.w   d3
  2344.         addq.w  #2,d1
  2345. @2      rts
  2346. ; ---------------------------------------------------------------------------
  2347.  
  2348. Change_FlipX:
  2349.         bclr    #0,obStatus(a0)
  2350.         tst.w   d0
  2351.         beq.s   @1
  2352.         bset    #0,obStatus(a0)
  2353. @1      rts
  2354. ; ---------------------------------------------------------------------------
  2355.  
  2356. Change_FlipXWithVelocity:
  2357.         bclr    #0,obStatus(a0)
  2358.         tst.w   obVelX(a0)
  2359.         bmi.s   @1
  2360.         bset    #0,obStatus(a0)
  2361. @1      rts
  2362.  
  2363. ; =============== S U B R O U T I N E =======================================
  2364.  
  2365. Load_SimpleRing:
  2366.         cmpi.b  #2,(Rings_mode_count).w
  2367.         bne.s   @1
  2368.         jsr (SingleObjLoad2).l
  2369.         bne.s   @1
  2370.         move.b  #$37,(a1)
  2371.         move.w  obX(a0),obX(a1)
  2372.         move.w  obY(a0),obY(a1)
  2373.         move.b  #2,obRoutine(a1)
  2374.         move.b  #8,obHeight(a1)
  2375.         move.b  #8,obWidth(a1)
  2376.         move.l  #Map_obj25,obMap(a1)
  2377.         move.w  #$26CA,obGfx(a1)
  2378.         move.b  #4,obRender(a1)
  2379.         move.b  #3,obPriority(a1)
  2380.         move.b  #$47,obColType(a1)
  2381.         move.b  #8,obActWid(a1)
  2382.         move.b  #-1,($FFFFFEC6).w
  2383.         move.w  #0,obVelX(a1)
  2384.         move.w  #-$300,obVelY(a1)
  2385. @1      rts
  2386.  
  2387. ; =============== S U B R O U T I N E =======================================
  2388.  
  2389. ObjDat3_BossGreenHill_Robotnik:
  2390.         dc.l Map_Eggman
  2391.         dc.w $400
  2392.         dc.b 3
  2393.         dc.b $40
  2394.         dc.b $40
  2395.         dc.b $40
  2396.         dc.b 0
  2397.         dc.b $F
  2398. ObjDat3_BossGreenHill_RobotnikFace:
  2399.         dc.b 3
  2400.         dc.b $10
  2401.         dc.b $10
  2402.         dc.b $10
  2403.         dc.b 1
  2404.         dc.b 0
  2405. ObjDat3_BossGreenHill_RobotnikFlame:
  2406.         dc.b 2
  2407.         dc.b $20
  2408.         dc.b $20
  2409.         dc.b $20
  2410.         dc.b 3
  2411.         dc.b 0
  2412. ObjDat3_BossGreenHill_RobotnikFlame2:
  2413.         dc.b 4
  2414.         dc.b $20
  2415.         dc.b $20
  2416.         dc.b $20
  2417.         dc.b 3
  2418.         dc.b 0
  2419. ObjDat3_BossGreenHill_RobotnikGlass:
  2420.         dc.b 2
  2421.         dc.b $20
  2422.         dc.b $20
  2423.         dc.b $20
  2424.         dc.b $F
  2425.         dc.b 0
  2426. ObjDat3_BossGreenHill_RobotnikSpike:
  2427.         dc.l Map_obj5Ea
  2428.         dc.w $2518
  2429.         dc.b 5
  2430.         dc.b $C
  2431.         dc.b 4
  2432.         dc.b $C
  2433.         dc.b 1
  2434.         dc.b $9A
  2435. ObjDat3_BossGreenHill_RobotnikSphere:
  2436.         dc.l Map_obj45
  2437.         dc.w $480
  2438.         dc.b 5
  2439.         dc.b 8
  2440.         dc.b 0
  2441.         dc.b 8
  2442.         dc.b 3
  2443.         dc.b $87
  2444. ObjDat3_BossGreenHill_RobotnikBall:
  2445.         dc.l Map_obj48
  2446.         dc.w $63AA
  2447.         dc.b 4
  2448.         dc.b $10
  2449.         dc.b $16
  2450.         dc.b $20
  2451.         dc.b 0
  2452.         dc.b $81
  2453. ObjDat3_Targetting_Sensor:
  2454.         dc.l Map_obj8D
  2455.         dc.w $86A0
  2456.         dc.b 1
  2457.         dc.b $10
  2458.         dc.b $10
  2459.         dc.b $10
  2460.         dc.b 0
  2461.         dc.b 0
  2462. ObjDat3_RobotnikShipCrane:
  2463.         dc.l Map_RobotnikShipCrane
  2464.         dc.w $380
  2465.         dc.b 3
  2466.         dc.b $30
  2467.         dc.b $30
  2468.         dc.b $30
  2469.         dc.b 2
  2470.         dc.b 0
  2471. ObjDat3_RobotnikRun:
  2472.         dc.l Map_RobotnikRun
  2473.         dc.w $4C0
  2474.         dc.b 3
  2475.         dc.b $30
  2476.         dc.b $30
  2477.         dc.b $30
  2478.         dc.b 0
  2479.         dc.b 0
  2480. Obj8DCheseBall_Speed:
  2481.         dc.w -$180, -$200
  2482.         dc.w $180, -$200
  2483.         dc.w -$100, -$100
  2484.         dc.w $100, -$100
  2485. Obj8DCheseBall_Pos:
  2486.         dc.w -1, -1
  2487.         dc.w $19, 2
  2488.         dc.w 1, $1A
  2489.         dc.w $19, $1A
  2490. ChildObjDat_RobotnikGlassFaceAndFlame:
  2491.         dc.w 3
  2492.         dc.b $8D
  2493.         dc.b (BossGreenHill_RobotnikFace_Index-BossGreenHill_Index),0
  2494.         dc.b $8D
  2495.         dc.b (BossGreenHill_RobotnikFlame_Index-BossGreenHill_Index),0
  2496.         dc.b $8D
  2497.         dc.b (BossGreenHill_RobotnikFlame_Index-BossGreenHill_Index),0
  2498.         dc.b $8D
  2499.         dc.b (BossGreenHill_RobotnikGlass_Index-BossGreenHill_Index),0
  2500. ChildObjDat_RobotnikHud:
  2501.         dc.w 0
  2502.         dc.b $8D
  2503.         dc.b (BossGreenHill_EggmanLives_Index-BossGreenHill_Index),0,0
  2504. ChildObjDat_Targetting_Sensor:
  2505.         dc.w 0
  2506.         dc.b (BossGreenHill_Targetting_Sensor_Index-BossGreenHill_Index),0
  2507.         dc.b $8D,0
  2508. ChildObjDat_Targetting_Sensor2:
  2509.         dc.w 0
  2510.         dc.b (BossGreenHill_Targetting_Sensor_Index-BossGreenHill_Index),(Targetting_Sensor2_Init-Targetting_Sensor_ShipIndex)
  2511.         dc.b $8D,0
  2512. ChildObjDat_RobotnikRingFall:
  2513.         dc.w 0
  2514.         dc.b $8D
  2515.         dc.b (BossGreenHill_CircularRing_Index-BossGreenHill_Index),(BossCircularRing_Index_SetUpAttributes-BossCircularRing_Index),0
  2516. ChildObjDat_RobotnikCircularRing:
  2517.         dc.w $F
  2518.         dc.b (BossGreenHill_CircularRing_Index-BossGreenHill_Index),0
  2519.         dc.b $8D,0
  2520. ChildObjDat_RobotnikChaseBall:
  2521.         dc.w 0
  2522.         dc.b $8D
  2523.         dc.b (BossGreenHill_ChaseBall_Index-BossGreenHill_Index),0,0
  2524. ChildObjDat_RobotnikChaseBallClone:
  2525.         dc.w 0
  2526.         dc.b $8D
  2527.         dc.b (BossGreenHill_ChaseBall_Index-BossGreenHill_Index),(BossChaseBall_Clone_Index_SetUpAttributes-BossChaseBall_Index),0
  2528. ChildObjDat_RobotnikChaseBallRing:
  2529.         dc.w 2
  2530.         dc.w $8D
  2531.         dc.w -$200
  2532.         dc.w -$600
  2533.         dc.b (BossGreenHill_CircularRing_Index-BossGreenHill_Index),(BossCircularRing_Index_SetUpAttributes-BossCircularRing_Index)
  2534.         dc.w 0
  2535.         dc.w -$600
  2536.         dc.b (BossGreenHill_CircularRing_Index-BossGreenHill_Index),(BossCircularRing_Index_SetUpAttributes-BossCircularRing_Index)
  2537.         dc.w $200
  2538.         dc.w -$600
  2539.         dc.b (BossGreenHill_CircularRing_Index-BossGreenHill_Index),(BossCircularRing_Index_SetUpAttributes-BossCircularRing_Index)
  2540. ChildObjDat_RobotnikChaseBallRing2:
  2541.         dc.w 4
  2542.         dc.w $8D
  2543.         dc.w -$400
  2544.         dc.w -$600
  2545.         dc.b (BossGreenHill_CircularRing_Index-BossGreenHill_Index),(BossCircularRing_Index_SetUpAttributes-BossCircularRing_Index)
  2546.         dc.w -$200
  2547.         dc.w -$600
  2548.         dc.b (BossGreenHill_CircularRing_Index-BossGreenHill_Index),(BossCircularRing_Index_SetUpAttributes-BossCircularRing_Index)
  2549.         dc.w 0
  2550.         dc.w -$600
  2551.         dc.b (BossGreenHill_CircularRing_Index-BossGreenHill_Index),(BossCircularRing_Index_SetUpAttributes-BossCircularRing_Index)
  2552.         dc.w $200
  2553.         dc.w -$600
  2554.         dc.b (BossGreenHill_CircularRing_Index-BossGreenHill_Index),(BossCircularRing_Index_SetUpAttributes-BossCircularRing_Index)
  2555.         dc.w $400
  2556.         dc.w -$600
  2557.         dc.b (BossGreenHill_CircularRing_Index-BossGreenHill_Index),(BossCircularRing_Index_SetUpAttributes-BossCircularRing_Index)
  2558. ChildObjDat_RobotnikChaseBallCircularRing:
  2559.         dc.w 7
  2560.         dc.b (BossGreenHill_CircularRing_Index-BossGreenHill_Index),(BossCircularRing_Index_SetUpAttributes2-BossCircularRing_Index)
  2561.         dc.b $8D,0
  2562. ChildObjDat_RobotnikShotRing:
  2563.         dc.w 9
  2564.         dc.b (BossGreenHill_CircularRing_Index-BossGreenHill_Index),(BossCircularRing_Index_SetUpAttributes3-BossCircularRing_Index)
  2565.         dc.b $8D,0
  2566. ChildObjDat_RobotnikChaseBallCircularRadius:
  2567.         dc.w $F
  2568.         dc.b (BossGreenHill_CircularRing_Index-BossGreenHill_Index),(BossCircularRing_Index_SetUpAttributes4-BossCircularRing_Index)
  2569.         dc.b $8D,0
  2570. ChildObjDat_Targetting_Sensor3:
  2571.         dc.w 3
  2572.         dc.b (BossGreenHill_Targetting_Sensor_Index-BossGreenHill_Index),(Targetting_Sensor3_Init-Targetting_Sensor_ShipIndex)
  2573.         dc.b $8D
  2574.         dc.w $F000
  2575.         dc.b $8D
  2576.         dc.w $1000
  2577.         dc.b $8D
  2578.         dc.w $F0
  2579.         dc.b $8D
  2580.         dc.w $10
  2581. ChildObjDat_RobotnikShipCrane:
  2582.         dc.w 1
  2583.         dc.b (BossGreenHill_RobotnikShipCrane_Index-BossGreenHill_Index),0
  2584.         dc.b $8D
  2585.         dc.w $FF2C
  2586.         dc.b $8D
  2587.         dc.w $FF2C
  2588. ChildObjDat_RobotnikRun:
  2589.         dc.w 0
  2590.         dc.b $8D
  2591.         dc.b (BossGreenHill_RobotnikRun_Index-BossGreenHill_Index),0,0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement