Advertisement
TheBlad768

Boss (Startup)

May 2nd, 2018
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; ===========================================================================
  2. ; The initial code boss.
  3. ; Version 1.0
  4. ; By TheBlad768 (2018).
  5. ; ===========================================================================
  6.  
  7. ; Object variables
  8. obSlot_RobotnikBoss:        = 0                     ; Set current object slot in object pointers
  9. objHits_RobotnikBoss:       = 8                     ; Set number of hits
  10. obVRAM_RobotnikHud: = (1<<15+($D000/$20))   ; Set VRAM address with priority
  11.  
  12. ; Universal object variables
  13. obRender:       equ 1   ; .b
  14. obGfx:          equ 2   ; .w
  15. obMap:          equ 4   ; .l
  16. obX:            equ 8   ; .w.l
  17. obScreenY:      equ $A  ; .w
  18. obY:                equ $C  ; .w.l
  19. obVelX:         equ $10 ; .w
  20. obVelY:         equ $12 ; .w
  21. obHeight:       equ $16 ; .b
  22. obWidth:        equ $17 ; .b
  23. obPriority:     equ $18 ; .b
  24. obActWid:       equ $19 ; .b
  25. obFrame:        equ $1A ; .b
  26. obAnim:         equ $1C ; .b
  27. obColType:      equ $20 ; .b
  28. obColProp:      equ $21 ; .b
  29. obStatus:       equ $22 ; .b
  30. obRoutine:      equ $24 ; .b
  31. ob2ndRout:      equ $25 ; .b
  32. obAngle:            equ $26 ; .b.w
  33. obSubtype:      equ $28 ; .b.w
  34.  
  35. ; Dynamic object variables
  36. obDefeated:     equ $14 ; .b
  37. obFlash:            equ $15 ; .b
  38. ;obNull         equ $2A ; .w
  39. ;obNull         equ $2C ; .w
  40. ;obNull         equ $2E ; .w
  41. ;obNull         equ $30 ; .w
  42. ;obNull         equ $32 ; .w
  43. ;obNull         equ $34 ; .w
  44. ;obNull         equ $36 ; .w
  45. ;obNull         equ $38 ; .w
  46. ;obNull         equ $3A ; .w
  47. obTimer:            equ $3C ; .w
  48. obParent:       equ $3E ; .w
  49.  
  50. ; Colours
  51. cBlack:         equ $000        ; colour black
  52. cWhite:         equ $EEE        ; colour white
  53.  
  54. ; RAM
  55. v_player:           equ $FFFFD000   ; Main character
  56. v_plc_buffer:       equ $FFFFF680   ; Pattern load cues buffer
  57. v_screenposx:   equ $FFFFF700   ; Screen position X
  58. v_screenposy:       equ $FFFFF704   ; Screen position Y
  59. v_bossstatus:       equ $FFFFF7A7   ; Status of boss and prison capsule
  60. v_framecount:   equ $FFFFFE04   ; Frame counter
  61. v_vbla_count:   equ $FFFFFE0C   ; Vertical interrupt counter
  62. f_timecount:        equ $FFFFFE1E   ; Time counter update flag
  63. v_pal_dry:      equ $FFFFFB00   ; Main palette
  64.  
  65. ; Macros
  66. offsetEntry macro ptr
  67.     dc.\0 ptr-*
  68.     endm
  69.  
  70. ; ---------------------------------------------------------------------------
  71. ; Object Robotnik boss.
  72. ; ---------------------------------------------------------------------------
  73.  
  74. ; =============== S U B R O U T I N E =======================================
  75.  
  76. Obj_RobotnikBoss:
  77.         lea RobotnikBoss_Index(pc),a1
  78.         bra.w   ObjectsRoutine
  79. ; ---------------------------------------------------------------------------
  80.  
  81. RobotnikBoss_Index:
  82.         offsetEntry.w RobotnikBoss_Init                             ; 0
  83. RobotnikBoss_RobotnikShip_Index
  84.         offsetEntry.w RobotnikBoss_ShipMain                     ; 2
  85. RobotnikBoss_RobotnikFace_Index
  86.         offsetEntry.w Obj_RobotnikBoss_RobotnikFace             ; 4
  87. RobotnikBoss_RobotnikFlame_Index
  88.         offsetEntry.w Obj_RobotnikBoss_RobotnikFlame                ; 6
  89. RobotnikBoss_EggmanLives_Index
  90.         offsetEntry.w Obj_Robotnik_HudLives                     ; A
  91. ; ---------------------------------------------------------------------------
  92.  
  93. RobotnikBoss_Init:
  94.         addq.b  #2,obRoutine(a0)                                    ; Jump to next routine
  95.         lea ObjDat3_RobotnikBoss_Robotnik(pc),a1                    ; Load current object attributes
  96.         bsr.w   LoadObjects_Data                                    ; Set current object attributes
  97.         move.b  #objHits_RobotnikBoss,obColProp(a0)             ; Set number of hits
  98.         lea ChildObjDat_RobotnikFaceAndFlame(pc),a2
  99.         bsr.w   Create_ChildObject
  100.  
  101. RobotnikBoss_Hud:
  102.         lea ChildObjDat_RobotnikHud(pc),a2                      ; Create object
  103.         bra.w   Create_ChildObject
  104. ; ---------------------------------------------------------------------------
  105.  
  106. RobotnikBoss_ShipMain:
  107.         bsr.w   RobotnikBoss_MoveSprite2
  108.         lea RobotnikBoss_ShipIndex(pc),a1
  109.         bsr.w   ChildObjectsRoutine
  110.         bsr.w   RobotnikBoss_Hurt
  111.         bra.w   RobotnikBoss_Display2
  112. ; ---------------------------------------------------------------------------
  113.  
  114. RobotnikBoss_ShipIndex:
  115.         offsetEntry.w RobotnikBoss_Move                         ; 0
  116. RobotnikBossEnd_First_ShipIndex
  117.         offsetEntry.w RobotnikBossEnd_First
  118. RobotnikBossEnd_Second_ShipIndex
  119.         offsetEntry.w RobotnikBossEnd_Second
  120. RobotnikBossEnd_Third_ShipIndex
  121.         offsetEntry.w RobotnikBossEnd_Third
  122. ; ---------------------------------------------------------------------------
  123.  
  124. RobotnikBoss_Move:
  125.  
  126. ; Put your code here.
  127.         rts
  128.  
  129. ; =============== S U B R O U T I N E =======================================
  130.  
  131. RobotnikBoss_Hurt:
  132.         tst.b obDefeated(a0)                                        ; Boss was defeated?
  133.         bne.s   RobotnikBoss_Locret                             ; If yes, branch
  134.         tst.b obColType(a0)                                     ; If collision is on, don't do anything
  135.         bne.s   RobotnikBoss_Locret
  136.         tst.b obColProp(a0)
  137.         beq.s   RobotnikBoss_ShipGone
  138.         tst.b   obFlash(a0)
  139.         bne.s   RobotnikBoss_ShipFlash
  140.         move.b  #$40,obFlash(a0)                                    ; Set number of times for ship to flash
  141.         moveq   #$FFFFFFAC,d0
  142.         jsr (PlaySound_Special).l                                   ; Play hit sound
  143.  
  144. RobotnikBoss_ShipFlash:
  145.         lea (v_pal_dry+$22).w,a1
  146.         moveq   #cBlack,d0
  147.         btst    #0,obFlash(a0)
  148.         bne.s   @1
  149.         move.w  #cWhite,d0
  150. @1      move.w  d0,(a1)
  151.         subq.b  #1,obFlash(a0)
  152.         bne.s   RobotnikBoss_Locret
  153.         move.b  #$F,obColType(a0)
  154.  
  155. RobotnikBoss_Locret:
  156.         rts
  157. ; ---------------------------------------------------------------------------
  158.  
  159. RobotnikBoss_ShipGone:
  160.         move.b  #(RobotnikBossEnd_First_ShipIndex-RobotnikBoss_ShipIndex),ob2ndRout(a0)
  161.         move.b  #-$18,obTimer(a0)                               ; Set timer to 3 seconds
  162.         clr.l obVelX(a0)                                            ; Clean object XY speed
  163.         st  obDefeated(a0)                                      ; Set defeated flag
  164.         clr.b (f_timecount).w                                       ; Stop game timer
  165.         moveq   #100,d0
  166.         jmp (AddPoints).l                                           ; Add 1000 points
  167. ; ---------------------------------------------------------------------------
  168.  
  169. RobotnikBossEnd_First:
  170.         jsr (BossDefeated).l
  171.         subq.b  #1,obTimer(a0)
  172.         bne.s   @1
  173.         addq.b  #2,ob2ndRout(a0)                                    ; Jump to next routine
  174.         bset    #0,obStatus(a0)
  175.         bclr    #7,obStatus(a0)
  176.         move.b  #-$18,obTimer(a0)
  177.         tst.b   (v_bossstatus).w
  178.         bne.s   @1
  179.         move.b  #1,(v_bossstatus).w                             ; Set boss status
  180. @1      rts
  181. ; ---------------------------------------------------------------------------
  182.  
  183. RobotnikBossEnd_Second:
  184.         addq.b  #1,obTimer(a0)
  185.         beq.s   @4
  186.         bpl.s   @2
  187.         addi.w  #$18,obVelY(a0)
  188.         rts
  189. @2      cmpi.b  #$20,obTimer(a0)
  190.         bcs.s   @3
  191.         beq.s   @4
  192.         cmpi.b  #$2A,obTimer(a0)
  193.         bcs.s   @5
  194.         addq.b  #2,ob2ndRout(a0)
  195. @5      rts
  196. @3      subq.w  #8,obVelY(a0)
  197.         rts
  198. @4      clr.w   obVelY(a0)
  199.  
  200. RobotnikBossEnd_Locret:
  201.         rts
  202. ; ---------------------------------------------------------------------------
  203.  
  204. RobotnikBossEnd_Third:
  205.         move.w  #$400,obVelX(a0)
  206.         move.w  #-$40,obVelY(a0)
  207.         tst.b obRender(a0)
  208.         bmi.s   RobotnikBossEnd_Locret
  209.         addq.w  #4,sp                                           ; Skip
  210.         bra.w   RobotnikBoss_Del
  211. ; ---------------------------------------------------------------------------
  212. ; Object Robotnik boss face.
  213. ; ---------------------------------------------------------------------------
  214.  
  215. ; =============== S U B R O U T I N E =======================================
  216.  
  217. Obj_RobotnikBoss_RobotnikFace:
  218.         lea RobotnikBoss_RobotnikFace_ShipIndex(pc),a1
  219.         bra.w   ChildObjectsRoutine
  220. ; ---------------------------------------------------------------------------
  221.  
  222. RobotnikBoss_RobotnikFace_ShipIndex:
  223.         offsetEntry.w RobotnikBoss_RobotnikFace_Init                ; 0
  224.         offsetEntry.w RobotnikBoss_RobotnikFace_Main                ; 2
  225. ; ---------------------------------------------------------------------------
  226.  
  227. RobotnikBoss_RobotnikFace_Init:
  228.         addq.b  #2,ob2ndRout(a0)                                    ; Jump to next routine
  229.         lea ObjDat3_RobotnikBoss_RobotnikFace(pc),a1                ; Load current object attributes
  230.         bra.w   LoadObjects_ExtraData                           ; Set current object attributes
  231. ; ---------------------------------------------------------------------------
  232.  
  233. RobotnikBoss_RobotnikFace_Main:
  234.         movea.w obParent(a0),a1                                 ; Load parent RAM address
  235.         moveq   #1,d0
  236.         tst.w obVelX(a1)
  237.         beq.s   @1
  238.         cmpi.b  #4,(Player_1+obRoutine).w
  239.         bcs.s   @2
  240. @1      moveq   #4,d0
  241. @2      tst.b obColType(a1)
  242.         bne.s   @3
  243.         moveq   #5,d0
  244. @3      cmpi.b  #(RobotnikBossEnd_First_ShipIndex-RobotnikBoss_ShipIndex),ob2ndRout(a1)
  245.         bmi.s   @4
  246.         moveq   #$A,d0
  247. @4      cmpi.b  #(RobotnikBossEnd_Third_ShipIndex-RobotnikBoss_ShipIndex),ob2ndRout(a1)
  248.         bne.s   @5
  249.         moveq   #6,d0
  250.         tst.b obRender(a0)
  251.         bpl.s   RobotnikBoss_Del
  252. @5      move.b  d0,obAnim(a0)
  253.         bra.s   RobotnikBoss_Display
  254. ; ---------------------------------------------------------------------------
  255. ; Object Robotnik boss flame.
  256. ; ---------------------------------------------------------------------------
  257.  
  258. ; =============== S U B R O U T I N E =======================================
  259.  
  260. Obj_RobotnikBoss_RobotnikFlame:
  261.         lea RobotnikBoss_RobotnikFlame_ShipIndex(pc),a1
  262.         bra.w   ChildObjectsRoutine
  263. ; ---------------------------------------------------------------------------
  264.  
  265. RobotnikBoss_RobotnikFlame_ShipIndex:
  266.         offsetEntry.w RobotnikBoss_RobotnikFlame_Init               ; 0
  267.         offsetEntry.w RobotnikBoss_RobotnikFlame_Main               ; 2
  268. ; ---------------------------------------------------------------------------
  269.  
  270. RobotnikBoss_RobotnikFlame_Init:
  271.         addq.b  #2,ob2ndRout(a0)                                    ; Jump to next routine
  272.         lea ObjDat3_RobotnikBoss_RobotnikFace(pc),a1
  273.         bra.w   LoadObjects_ExtraData
  274. ; ---------------------------------------------------------------------------
  275.  
  276. RobotnikBoss_RobotnikFlame_Main:
  277.         movea.w obParent(a0),a1                                 ; Load parent RAM address
  278.         moveq   #7,d0
  279.         tst.w obVelX(a1)
  280.         beq.s   @0
  281.         moveq   #8,d0
  282. @0      cmpi.b  #(RobotnikBossEnd_Third_ShipIndex-RobotnikBoss_ShipIndex),ob2ndRout(a1)
  283.         bne.s   @1
  284.         moveq   #$B,d0
  285.         tst.b obRender(a0)
  286.         bpl.s   RobotnikBoss_Del
  287. @1      move.b  d0,obAnim(a0)
  288.  
  289. RobotnikBoss_Display:
  290.         move.w  obX(a1),obX(a0)
  291.         move.w  obY(a1),obY(a0)
  292.         move.b  obStatus(a1),obStatus(a0)
  293.  
  294. RobotnikBoss_Display2:
  295.         lea (Ani_Eggman).l,a1
  296.         jsr (AnimateSprite).l
  297.         move.b  obStatus(a0),d0
  298.         andi.b  #3,d0
  299.         andi.b  #$FC,obRender(a0)
  300.         or.b    d0,obRender(a0)
  301.         jmp (DisplaySprite).l
  302. ; ---------------------------------------------------------------------------
  303.  
  304. RobotnikBoss_Del:
  305.         jmp (DeleteObject).l
  306. ; ---------------------------------------------------------------------------
  307. ; Object Robotnik hud lives.
  308. ; ---------------------------------------------------------------------------
  309.  
  310. ; Dynamic object variables
  311. obVRAM:     equ $2A ; .l
  312. obPointer:      equ $2E ; .l
  313.  
  314. ; =============== S U B R O U T I N E =======================================
  315.  
  316. Obj_Robotnik_HudLives:
  317.         movea.w obParent(a0),a2                                 ; Load parent RAM address
  318.         lea Robotnik_HudLives_ShipIndex(pc),a1
  319.         bra.w   ChildObjectsRoutine
  320. ; ---------------------------------------------------------------------------
  321.  
  322. Robotnik_HudLives_ShipIndex:
  323.         offsetEntry.w Robotnik_HudLives_Init                        ; 0
  324.         offsetEntry.w Robotnik_HudLives_CheckPLC                    ; 2
  325.         offsetEntry.w Robotnik_HudLives_MoveDown                    ; 4
  326.         offsetEntry.w Robotnik_HudLives_AddHits                 ; 6
  327.         offsetEntry.w Robotnik_HudLives_MoveUp                  ; 8
  328.         offsetEntry.w Robotnik_HudLives_MoveRemove              ; A
  329. ; ---------------------------------------------------------------------------
  330.  
  331. Robotnik_HudLives_Init:
  332.         addq.b  #2,ob2ndRout(a0)                                    ; Jump to next routine
  333.         move.l  #Map_RobotnikHud,obMap(a0)                      ; Load object mapping
  334.         move.w  #(obVRAM_RobotnikHud),obGfx(a0)             ; Current VRAM address
  335.         move.w  #$170,obX(a0)                                   ; Set Xpos
  336.         move.w  #$28,obScreenY(a0)                              ; Set Ypos
  337.         locVRAM $D120,obVRAM(a0)                            ; Set VRAM address
  338.         move.l  #Art_LivesNums,obPointer(a0)                        ; Load uncompressed HUD art
  339.  
  340. Robotnik_HudLives_CheckPLC:
  341.         tst.l   (v_plc_buffer).w                                        ; PLC has been loaded?
  342.         bne.s   Robotnik_HudLives_MoveDisplay                   ; If not, branch
  343.         addq.b  #2,ob2ndRout(a0)                                    ; Jump to next routine
  344.  
  345. Robotnik_HudLives_MoveDown:
  346.         addq.w  #1,obScreenY(a0)                                    ; Downward movement
  347.         cmpi.w  #$48,obScreenY(a0)                              ; Ypos is the same?
  348.         bne.s   Robotnik_HudLives_MoveDisplay                   ; If not, branch
  349.         addq.b  #2,ob2ndRout(a0)                                    ; Jump to next routine
  350.  
  351. Robotnik_HudLives_AddHits:
  352.         move.b  obColProp(a2),d0                                    ; Copy current object hits into d0
  353.         subq.w  #1,obTimer(a0)                                  ; Timer was ended?
  354.         bpl.s   Robotnik_HudLives_AddHitsCheck                  ; If not, branch
  355.         addq.b  #1,obColProp(a0)                                    ; Add hits in HUD object
  356.         move.w  #3,obTimer(a0)                                  ; Set timer
  357.         moveq   #$FFFFFFCD,d0
  358.         jsr (PlaySound_Special).l                                   ; Play sound
  359.  
  360. Robotnik_HudLives_AddHitsCheck:
  361.         cmp.b   obColProp(a0),d0                                    ; Number of hits is the same?
  362.         bne.s   Robotnik_HudLives_MoveDisplay                   ; If not, branch
  363.         addq.b  #2,ob2ndRout(a0)                                    ; Jump to next routine
  364.         moveq   #$FFFFFFC5,d0
  365.         jsr (PlaySound_Special).l                                   ; Play sound
  366.  
  367. Robotnik_HudLives_MoveUp:
  368.         move.b  obColProp(a2),obColProp(a0)
  369.         tst.b (v_bossstatus).w                                      ; Boss status is empty?
  370.         beq.s   Robotnik_HudLives_MoveDisplay                   ; If yes, branch
  371.         subq.w  #1,obScreenY(a0)                                    ; Upward movement
  372.         cmpi.w  #$28,obScreenY(a0)                              ; Ypos is the same?
  373.         bne.s   Robotnik_HudLives_MoveDisplay                   ; If not, branch
  374.         addq.b  #2,ob2ndRout(a0)                                    ; Jump to next routine
  375.  
  376. Robotnik_HudLives_MoveDisplay:
  377.         move    #$2700,sr                                       ; Disable interrupts
  378.         bsr.s   Robotnik_HudLives_DynamicVRAM
  379.         move    #$2300,sr                                       ; Enable interrupts
  380.         jmp (DisplaySprite).l
  381. ; ---------------------------------------------------------------------------
  382.  
  383. Robotnik_HudLives_MoveRemove:
  384.         jmp (DeleteObject).l
  385. ; ---------------------------------------------------------------------------
  386.  
  387. Robotnik_HudLives_DynamicVRAM:
  388.         lea ($C00000).l,a6
  389.         moveq   #0,d1                                           ; Clear d1
  390.         moveq   #0,d6                                           ; Clear d6
  391.         move.b  obColProp(a0),d1                                    ; Load number of hits
  392.         move.l  obVRAM(a0),d0                                   ; Load VRAM address
  393.         lea ObData_HudLives_10(pc),a1
  394.         cmpi.b  #100,d1                                         ; Number 100 or more?
  395.         blo.s       Robotnik_HudLives_LoadData                      ; If not, branch
  396.         lea ObData_HudLives_100(pc),a1
  397.  
  398. Robotnik_HudLives_LoadData:
  399.         move.b  (a1)+,obFrame(a0)                               ; Set current frame
  400.         move.b  (a1)+,d6                                            ; Set time repeats
  401.         move.l  (a1)+,a2                                            ; Load address size numbers '00/000'
  402.  
  403. Robotnik_HudLives_LoadArt:
  404.         moveq   #0,d4                                           ; Clear d4
  405.         movea.l obPointer(a0),a1                                    ; Load address of uncompressed HUD art
  406.  
  407. Robotnik_HudLives_Loop:
  408.         moveq   #0,d2                                           ; Clear d2
  409.         move.l  d0,4(a6)                                            ; Store VPD address
  410.         move.l  (a2)+,d3
  411.  
  412. Robotnik_HudLives_FindDigit:
  413.         sub.l   d3,d1
  414.         bcs.s   Robotnik_HudLives_LivesWrite
  415.         addq.w  #1,d2                                           ; Add 1 to digit
  416.         bra.s   Robotnik_HudLives_FindDigit
  417. ; ---------------------------------------------------------------------------
  418.  
  419. Robotnik_HudLives_LivesWrite:
  420.         add.l   d3,d1
  421.         tst.w   d2                                              ; Is digit zero?
  422.         beq.s   Robotnik_HudLives_CheckZero                     ; If yes, branch
  423.         move.w  #1,d4
  424.  
  425. Robotnik_HudLives_CheckZero:
  426.         tst.w   d4                                              ; This digit is not used?
  427.         beq.s   Robotnik_HudLives_ClrLives                      ; If yes, branch
  428.  
  429. Robotnik_HudLives_GetTile:
  430.         lsl.w   #5,d2                                               ; Logical shift
  431.         lea (a1,d2.w),a3                                            ; Get tile to load
  432.     rept 8                                                      ; Tile size 8x8
  433.         move.l  (a3)+,(a6)                                      ; Copy tile 8x1 to VRAM
  434.     endr
  435.  
  436. Robotnik_HudLives_LivesNext:
  437.         addi.l  #$400000,d0
  438.         dbf d6,Robotnik_HudLives_Loop
  439.         rts
  440. ; ---------------------------------------------------------------------------
  441.  
  442. Robotnik_HudLives_ClrLives:
  443.         tst.w   d6
  444.         beq.s   Robotnik_HudLives_GetTile
  445.         moveq   #8-1,d5
  446.  
  447. Robotnik_HudLives_WriteTile:
  448.         move.l  #0,(a6)                                         ; Fill VRAM with #0
  449.         dbf d5,Robotnik_HudLives_WriteTile                      ; Repeat 8 more times
  450.         bra.s   Robotnik_HudLives_LivesNext
  451.  
  452. ; =============== S U B R O U T I N E =======================================
  453.  
  454. LoadObjects_Data:
  455.         move.l  (a1)+,obMap(a0)                                 ; Mappings location
  456.         move.w  (a1)+,obGfx(a0)                                 ; VRAM offset
  457.  
  458. LoadObjects_ExtraData:
  459.         move.b  (a1)+,obPriority(a0)                                ; Priority
  460.         move.b  (a1)+,obWidth(a0)                               ; Width
  461.         move.b  (a1)+,obHeight(a0)                              ; Height
  462.         move.b  (a1)+,obActWid(a0)                              ; Action width
  463.         move.b  (a1)+,obFrame(a0)                               ; Mappings frame
  464.         move.b  (a1)+,obColType(a0)                             ; Collision Number
  465.         bset    #2,obRender(a0)                                     ; Object uses world coordinates
  466.         rts
  467. ; ---------------------------------------------------------------------------
  468.  
  469. ObjectsRoutine:
  470.         moveq   #0,d0                                           ; Clear d0
  471.         move.b  obRoutine(a0),d0
  472.         adda.w  (a1,d0.w),a1
  473.         jmp (a1,d0.w)
  474. ; ---------------------------------------------------------------------------
  475.  
  476. ChildObjectsRoutine:
  477.         moveq   #0,d0                                           ; Clear d0
  478.         move.b  ob2ndRout(a0),d0
  479.         adda.w  (a1,d0.w),a1
  480.         jmp (a1,d0.w)
  481. ; ---------------------------------------------------------------------------
  482.  
  483. Create_ChildObject:
  484.         moveq   #0,d2                                           ; Clear d2
  485.         move.w  (a2)+,d6                                            ; Creates x number of the object at the parent's position
  486. @1      jsr (SingleObjLoad2).l
  487.         bne.s   @2
  488.         move.w  a0,obParent(a1)                                 ; Parent RAM address into another parent RAM address
  489.         move.l  obMap(a0),obMap(a1)
  490.         move.w  obGfx(a0),obGfx(a1)                             ; Mappings and VRAM offset copied from parent object
  491.         move.w  (a2)+,d3
  492.         move.b  d3,(a1)                                         ; Object address
  493.         move.b  d2,obSubtype(a1)
  494.         move.w  obX(a0),obX(a1)                                 ; Copy object Xpos into another object Xpos
  495.         move.w  obY(a0),obY(a1)                                 ; Copy object Ypos into another object Ypos
  496.         move.w  (a2)+,obRoutine(a1)
  497.         addq.w  #2,d2
  498.         dbf d6,@1
  499.         moveq   #0,d0                                           ; Clear d0
  500. @2      rts
  501. ; ---------------------------------------------------------------------------
  502.  
  503. Create_ChildObject2:
  504.         moveq   #0,d2                                           ; Clear d2
  505.         move.w  (a2)+,d6                                            ; Creates x number of the same object at the parent's position
  506. @1      jsr (SingleObjLoad2).l
  507.         bne.s   @2
  508.         move.w  a0,obParent(a1)                                 ; Parent RAM address into another parent RAM address
  509.         move.l  obMap(a0),obMap(a1)
  510.         move.w  obGfx(a0),obGfx(a1)                             ; Mappings and VRAM offset copied from parent object
  511.         move.b  (a0),(a1)                                           ; Object address
  512.         move.b  d2,obSubtype(a1)
  513.         move.w  obX(a0),obX(a1)                                 ; Copy object Xpos into another object Xpos
  514.         move.w  obY(a0),obY(a1)                                 ; Copy object Ypos into another object Ypos
  515.         move.w  (a2),obRoutine(a1)
  516.         addq.w  #2,d2
  517.         dbf d6,@1
  518.         moveq   #0,d0                                           ; Clear d0
  519. @2      rts
  520. ; ---------------------------------------------------------------------------
  521.  
  522. Object_Wait:
  523.         tst.w obTimer(a0)
  524.         beq.s   @1
  525.         subq.w  #1,obTimer(a0)
  526.         addq.w  #4,sp                                           ; Skip
  527. @1      rts
  528. ; ---------------------------------------------------------------------------
  529.  
  530. RobotnikBoss_MoveSprite:
  531.         bsr.s   RobotnikBoss_MoveSprite2
  532.         addi.w  #$38,obVelY(a0)                                 ; Increase vertical speed (apply gravity)
  533.         rts
  534. ; ---------------------------------------------------------------------------
  535.  
  536. RobotnikBoss_MoveSprite2:
  537.         move.w  obVelX(a0),d0                                   ; Load horizontal speed
  538.         ext.l   d0                                                  ; Extend a sign
  539.         asl.l   #8,d0                                               ; Shift velocity to line up with the middle 16 bits of the 32-bit position
  540.         add.l   d0,obX(a0)                                      ; Add to x-axis position
  541.         move.w  obVelY(a0),d0                                   ; Load vertical speed
  542.         ext.l   d0                                                  ; Extend a sign
  543.         asl.l   #8,d0                                               ; Shift velocity to line up with the middle 16 bits of the 32-bit position
  544.         add.l   d0,obY(a0)                                      ; Add to y-axis position
  545.         rts
  546. ; ---------------------------------------------------------------------------
  547.  
  548. RobotnikBoss_SwingUpAndDown:
  549.         moveq   #0,d0                                           ; Clear d0
  550.         move.b  obAngle(a0),d0                                  ; Copy object angle to d0
  551.         addq.b  #2,d0                                           ; Add 2 to the angle
  552.         move.b  d0,obAngle(a0)                                  ; Set current object angle
  553.         jsr (CalcSine).l                                            ; Calculates the sine and cosine
  554.         asr.w   #2,d0                                           ; Arithmetic shift
  555.         move.w  d0,obVelY(a0)                                   ; Set object Y speed
  556.         rts
  557.  
  558. ; =============== S U B R O U T I N E =======================================
  559.  
  560. ObjDat3_RobotnikBoss_Robotnik:
  561.         dc.l Map_Eggman
  562.         dc.w $400
  563.         dc.b 3
  564.         dc.b $20
  565.         dc.b $20
  566.         dc.b $20
  567.         dc.b 0
  568.         dc.b $F
  569. ObjDat3_RobotnikBoss_RobotnikFace:
  570.         dc.b 3
  571.         dc.b $20
  572.         dc.b $20
  573.         dc.b $20
  574.         dc.b 1
  575.         dc.b 0
  576. ObjDat3_RobotnikBoss_RobotnikFire:
  577.         dc.b 3
  578.         dc.b $20
  579.         dc.b $20
  580.         dc.b $20
  581.         dc.b 3
  582.         dc.b 0
  583. ObData_HudLives_10:
  584.         dc.b 0                                                  ; Frame
  585.         dc.b 2-1                                                    ; Time repeats
  586.         dc.l Hud_10                                             ; Load size numbers '00'
  587. ObData_HudLives_100:
  588.         dc.b 1                                                  ; Frame
  589.         dc.b 3-1                                                    ; Time repeats
  590.         dc.l Hud_100                                                ; Load size numbers '000'
  591. ChildObjDat_RobotnikFaceAndFlame:
  592.         dc.w 2-1
  593.         dc.w (obSlot_RobotnikBoss)
  594.         dc.b (RobotnikBoss_RobotnikFace_Index-RobotnikBoss_Index),(RobotnikBoss_RobotnikFace_ShipIndex-RobotnikBoss_RobotnikFace_ShipIndex)
  595.         dc.w (obSlot_RobotnikBoss)
  596.         dc.b (RobotnikBoss_RobotnikFlame_Index-RobotnikBoss_Index),(RobotnikBoss_RobotnikFlame_ShipIndex-RobotnikBoss_RobotnikFlame_ShipIndex)
  597. ChildObjDat_RobotnikHud:
  598.         dc.w 1-1
  599.         dc.w (obSlot_RobotnikBoss)
  600.         dc.b (RobotnikBoss_EggmanLives_Index-RobotnikBoss_Index),(Robotnik_HudLives_ShipIndex-Robotnik_HudLives_ShipIndex)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement