Advertisement
Guest User

Untitled

a guest
Feb 15th, 2009
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.38 KB | None | 0 0
  1. ; ----------------------------------------------------------------------------
  2. ; Object C5 - WFZ boss
  3. ; ----------------------------------------------------------------------------
  4. ; Sprite_3C442:
  5. ObjC5:
  6. moveq #0,d0
  7. move.b routine(a0),d0
  8. move.w ObjC5_Index(pc,d0.w),d1
  9. jmp ObjC5_Index(pc,d1.w)
  10. ; ===========================================================================
  11. ObjC5_Index:
  12. dc.w ObjC5_Init-ObjC5_Index ; 0 Main loading sequence
  13. dc.w ObjC5_LaserCase-ObjC5_Index ; 2 Laser case (inside is laser)
  14. dc.w ObjC5_LaserWall-ObjC5_Index ; 4 Laser wall
  15. dc.w ObjC5_PlatformReleaser-ObjC5_Index ; 6 Platform releaser
  16. dc.w ObjC5_Platform-ObjC5_Index ; 8 Platform
  17. dc.w ObjC5_PlatformHurt-ObjC5_Index ; A Invisible object that gets the platform's spikes to hurt sonic
  18. dc.w ObjC5_LaserShooter-ObjC5_Index ; C Laser shooter
  19. dc.w ObjC5_Laser-ObjC5_Index ; E Laser
  20. dc.w ObjC5_Robotnik-ObjC5_Index ; 10 Robotnik
  21. dc.w ObjC5_RobotnikPlatform-ObjC5_Index ; 12 Platform Robotnik's on
  22. ; ===========================================================================
  23.  
  24. ObjC5_Init:
  25. bsr.w LoadSubObject
  26. move.b subtype(a0),d0
  27. subi.b #$90,d0
  28. move.b d0,routine(a0)
  29. rts
  30. ; ===========================================================================
  31.  
  32. ObjC5_LaserCase: ; also the "mother" object
  33. moveq #0,d0
  34. move.b routine_secondary(a0),d0
  35. move.w ObjC5_CaseIndex(pc,d0.w),d1
  36. jsr ObjC5_CaseIndex(pc,d1.w)
  37. bra.w ObjC5_HandleHits
  38. ; ===========================================================================
  39. ObjC5_CaseIndex:
  40. dc.w ObjC5_CaseBoundary - ObjC5_CaseIndex ; 0 Sets up boundaries for movement and basic things
  41. dc.w ObjC5_CaseWaitStart - ObjC5_CaseIndex ; 2 Waits for sonic to start
  42. dc.w ObjC5_CaseWaitDown - ObjC5_CaseIndex ; 4 Waits to make the laser go down
  43. dc.w ObjC5_CaseDown - ObjC5_CaseIndex ; 6 Moves the case down
  44. dc.w ObjC5_CaseXSpeed - ObjC5_CaseIndex ; 8 Sets an X speed for the case
  45. dc.w ObjC5_CaseBoundaryChk - ObjC5_CaseIndex ; A Checks to make sure the case doesn't go through the boundaries
  46. dc.w ObjC5_CaseAnimate - ObjC5_CaseIndex ; C Animates the case (opening and closing)
  47. dc.w ObjC5_CaseLSLoad - ObjC5_CaseIndex ; E Laser shooter loading
  48. dc.w ObjC5_CaseLSDown - ObjC5_CaseIndex ; 10 Moves the laser shooter down
  49. dc.w ObjC5_CaseWaitLoadLaser - ObjC5_CaseIndex ; 12 Waits to load the laser
  50. dc.w ObjC5_CaseWaitMove - ObjC5_CaseIndex ; 14 Waits to move (checks if laser is completely loaded (as big as it gets))
  51. dc.w ObjC5_CaseBoundaryLaserChk - ObjC5_CaseIndex ; 16 Checks boundaries when moving with the laser
  52. dc.w ObjC5_CaseLSUp - ObjC5_CaseIndex ; 18 wait for laser shooter to go back up
  53. dc.w ObjC5_CaseAnimate - ObjC5_CaseIndex ; 1A Animates the case (opening and closing)
  54. dc.w ObjC5_CaseStartOver - ObjC5_CaseIndex ; 1C Sets secondary routine to 8
  55. dc.w ObjC5_CaseDefeated - ObjC5_CaseIndex ; 1E When defeated goes here (explosions and stuff)
  56. ; ===========================================================================
  57.  
  58. ObjC5_CaseBoundary:
  59. addq.b #2,routine_secondary(a0)
  60. move.b #0,collision_flags(a0)
  61. move.b #8,collision_property(a0) ; Hit points
  62. move.w #$442,d0
  63. move.w d0,(Camera_Max_Y_pos_now).w
  64. move.w d0,(Camera_Max_Y_pos).w
  65. move.w x_pos(a0),d0
  66. subi.w #$60,d0 ; Max Left position
  67. move.w d0,objoff_34(a0)
  68. addi.w #$C0,d0 ; Max Right Position
  69. move.w d0,objoff_36(a0)
  70. bra.w JmpTo45_DisplaySprite
  71. ; ===========================================================================
  72.  
  73. ObjC5_CaseWaitStart:
  74. bsr.w loc_366D6
  75. addi.w #$20,d2
  76. cmpi.w #$40,d2 ; How far away sonic is to start the boss
  77. blo.s ObjC5_CaseStart
  78. bra.w JmpTo45_DisplaySprite
  79. ; ===========================================================================
  80.  
  81. ObjC5_CaseStart:
  82. addq.b #2,routine_secondary(a0)
  83. move.w #$40,y_vel(a0) ; Speed at which the laser carrier goes down
  84. lea (ObjC5_LaserWallData).l,a2
  85. bsr.w loc_367D0
  86. subi.w #$88,x_pos(a1) ; where to load the left laser wall (x)
  87. addi.w #$60,y_pos(a1) ; left laser wall (y)
  88. lea (ObjC5_LaserWallData).l,a2
  89. bsr.w loc_367D0
  90. addi.w #$88,x_pos(a1) ; right laser wall (x)
  91. addi.w #$60,y_pos(a1) ; right laser wall (y)
  92. lea (ObjC5_LaserShooterData).l,a2
  93. bsr.w loc_367D0
  94. lea (ObjC5_PlatformReleaserData).l,a2
  95. bsr.w loc_367D0
  96. lea (ObjC5_RobotnikData).l,a2
  97. bsr.w loc_367D0
  98. move.w #$5A,objoff_2A(a0) ; How long for the boss music to start playing and the boss to start
  99. moveq #MusID_FadeOut,d0
  100. bsr.w JmpTo12_PlaySound
  101. bra.w JmpTo45_DisplaySprite
  102. ; ===========================================================================
  103.  
  104. ObjC5_CaseWaitDown:
  105. subq.w #1,objoff_2A(a0)
  106. bmi.s ObjC5_CaseSpeedDown
  107. bra.w JmpTo45_DisplaySprite
  108. ; ===========================================================================
  109.  
  110. ObjC5_CaseSpeedDown:
  111. addq.b #2,routine_secondary(a0)
  112. move.w #$60,objoff_2A(a0) ; How long the laser carrier goes down
  113. moveq #MusID_Boss,d0
  114. bsr.w JmpTo5_PlayMusic
  115. bra.w JmpTo45_DisplaySprite
  116. ; ===========================================================================
  117.  
  118. ObjC5_CaseDown:
  119. subq.w #1,objoff_2A(a0)
  120. beq.s ObjC5_CaseStopDown
  121. bsr.w JmpTo26_ObjectMove
  122. bra.w JmpTo45_DisplaySprite
  123. ; ===========================================================================
  124.  
  125. ObjC5_CaseStopDown:
  126. addq.b #2,routine_secondary(a0)
  127. clr.w y_vel(a0) ; stop the laser carrier from going down
  128. bra.w JmpTo45_DisplaySprite
  129. ; ===========================================================================
  130.  
  131. ObjC5_CaseXSpeed:
  132. addq.b #2,routine_secondary(a0)
  133. bsr.w loc_366D6
  134. move.w #$100,d1 ; Speed of carrier (when going back and forth before sending out laser)
  135. tst.w d0
  136. bne.s ObjC5_CasePMLoader
  137. neg.w d1
  138.  
  139. ObjC5_CasePMLoader:
  140. move.w d1,x_vel(a0)
  141. bset #2,status(a0) ; makes the platform maker load
  142. move.w #$70,objoff_2A(a0) ; how long to go back and forth before letting out laser
  143. bra.w JmpTo45_DisplaySprite
  144. ; ===========================================================================
  145.  
  146. ObjC5_CaseBoundaryChk: ; waits and makes sure the carrier does not go beyond the limit
  147. subq.w #1,objoff_2A(a0)
  148. bmi.s ObjC5_CaseOpeningAnim
  149. move.w x_pos(a0),d0
  150. tst.w x_vel(a0)
  151. bmi.s ObjC5_CaseBoundaryChk2
  152. cmp.w objoff_36(a0),d0
  153. bhs.s ObjC5_CaseNegSpeed
  154. bra.w ObjC5_CaseMoveDisplay
  155. ; ===========================================================================
  156.  
  157. ObjC5_CaseBoundaryChk2:
  158. cmp.w objoff_34(a0),d0
  159. bhs.s ObjC5_CaseMoveDisplay
  160.  
  161. ObjC5_CaseNegSpeed:
  162. neg.w x_vel(a0)
  163.  
  164. ObjC5_CaseMoveDisplay:
  165. bsr.w JmpTo26_ObjectMove
  166. bra.w JmpTo45_DisplaySprite
  167. ; ===========================================================================
  168.  
  169. ObjC5_CaseOpeningAnim:
  170. addq.b #2,routine_secondary(a0)
  171. clr.b anim(a0)
  172. bra.w JmpTo45_DisplaySprite
  173. ; ===========================================================================
  174.  
  175. ObjC5_CaseAnimate:
  176. lea (Ani_objC5).l,a1
  177. bsr.w JmpTo25_AnimateSprite
  178. bra.w JmpTo45_DisplaySprite
  179. ; ===========================================================================
  180.  
  181. ObjC5_CaseLSLoad: ; loads up the laser shooter (LS)
  182. addq.b #2,routine_secondary(a0)
  183. move.w #$E,objoff_2A(a0) ; Time the laser shooter moves down
  184. movea.w objoff_3C(a0),a1 ; a1=object (laser shooter)
  185. move.b #4,routine_secondary(a1)
  186. bra.w JmpTo45_DisplaySprite
  187. ; ===========================================================================
  188.  
  189. ObjC5_CaseLSDown:
  190. subq.w #1,objoff_2A(a0)
  191. beq.s ObjC5_CaseAddCollision
  192. movea.w objoff_3C(a0),a1 ; a1=object (laser shooter)
  193. addq.w #1,y_pos(a1) ; laser shooter down speed
  194. bra.w JmpTo45_DisplaySprite
  195. ; ===========================================================================
  196.  
  197. ObjC5_CaseAddCollision:
  198. addq.b #2,routine_secondary(a0)
  199. move.w #$40,objoff_2A(a0) ; Length before shooting laser
  200. bset #4,status(a0) ; makes the hit sound and flashes happen only once when you hit it
  201. bset #6,status(a0) ; makes sure collision gets restored
  202. move.b #6,collision_flags(a0)
  203. bra.w JmpTo45_DisplaySprite
  204. ; ===========================================================================
  205.  
  206. ObjC5_CaseWaitLoadLaser:
  207. subq.w #1,objoff_2A(a0)
  208. bmi.s ObjC5_CaseLoadLaser
  209. bra.w JmpTo45_DisplaySprite
  210. ; ===========================================================================
  211.  
  212. ObjC5_CaseLoadLaser:
  213. addq.b #2,routine_secondary(a0)
  214. lea (ObjC5_LaserData).l,a2
  215. bsr.w loc_367D0 ; loads laser
  216. bra.w JmpTo45_DisplaySprite
  217. ; ===========================================================================
  218.  
  219. ObjC5_CaseWaitMove:
  220. movea.w parent(a0),a1 ; a1=object
  221. btst #2,status(a1) ; waits to check if laser fired
  222. bne.s ObjC5_CaseLaserSpeed
  223. bra.w JmpTo45_DisplaySprite
  224. ; ===========================================================================
  225.  
  226. ObjC5_CaseLaserSpeed:
  227. addq.b #2,routine_secondary(a0)
  228. move.w #$80,objoff_2A(a0) ; how long to move the laser
  229. bsr.w loc_366D6 ; tests if sonic is to the right or left
  230. move.w #$80,d1 ; Speed when moving with laser
  231. tst.w d0
  232. bne.s ObjC5_CaseLaserSpeedSet
  233. neg.w d1
  234.  
  235. ObjC5_CaseLaserSpeedSet:
  236. move.w d1,x_vel(a0)
  237. bra.w JmpTo45_DisplaySprite
  238. ; ===========================================================================
  239.  
  240. ObjC5_CaseBoundaryLaserChk: ; make sure you stay in range when firing laser
  241. subq.w #1,objoff_2A(a0)
  242. bmi.s ObjC5_CaseStopLaserDelete
  243. move.w x_pos(a0),d0
  244. tst.w x_vel(a0)
  245. bmi.s ObjC5_CaseBoundaryLaserChk2
  246. cmp.w objoff_36(a0),d0
  247. bhs.s ObjC5_CaseLaserStopMove
  248. bra.w ObjC5_CaseLaserMoveDisplay
  249. ; ===========================================================================
  250.  
  251. ObjC5_CaseBoundaryLaserChk2:
  252. cmp.w objoff_34(a0),d0
  253. bhs.s ObjC5_CaseLaserMoveDisplay
  254.  
  255. ObjC5_CaseLaserStopMove:
  256. clr.w x_vel(a0) ; stop moving
  257.  
  258. ObjC5_CaseLaserMoveDisplay:
  259. bsr.w JmpTo26_ObjectMove
  260. bra.w JmpTo45_DisplaySprite
  261. ; ===========================================================================
  262.  
  263. ObjC5_CaseStopLaserDelete: ; stops collision and deletes laser
  264. addq.b #2,routine_secondary(a0)
  265. move.w #$E,objoff_2A(a0) ; time for laser shooter to move back up
  266. bclr #3,status(a0)
  267. bclr #4,status(a0)
  268. bclr #6,status(a0)
  269. clr.b collision_flags(a0) ; no more collision
  270. movea.w parent(a0),a1 ; a1=object (laser)
  271. bsr.w JmpTo6_DeleteObject2 ; delete the laser
  272. bra.w JmpTo45_DisplaySprite
  273. ; ===========================================================================
  274.  
  275. ObjC5_CaseLSUp:
  276. subq.w #1,objoff_2A(a0)
  277. beq.s ObjC5_CaseClosingAnim
  278. movea.w objoff_3C(a0),a1 ; a1=object (laser shooter)
  279. subq.w #1,y_pos(a1)
  280. bra.w JmpTo45_DisplaySprite
  281. ; ===========================================================================
  282.  
  283. ObjC5_CaseClosingAnim: ;sets which animation to do
  284. addq.b #2,routine_secondary(a0)
  285. move.b #1,anim(a0)
  286. bra.w JmpTo45_DisplaySprite
  287. ; ===========================================================================
  288.  
  289. ObjC5_CaseStartOver:
  290. move.b #8,routine_secondary(a0)
  291. bsr.w ObjC5_CaseXSpeed
  292. bra.w JmpTo45_DisplaySprite
  293. ; ===========================================================================
  294.  
  295. ObjC5_CaseDefeated:
  296. clr.b collision_flags(a0)
  297. st collision_property(a0)
  298. bclr #6,status(a0)
  299. subq.w #1,objoff_30(a0) ; timer
  300. bmi.s ObjC5_End
  301. bsr.w JmpTo_Boss_LoadExplosion
  302. bra.w JmpTo45_DisplaySprite
  303. ; ===========================================================================
  304.  
  305. ObjC5_End: ; play music and change camera speed
  306. moveq #MusID_WFZ,d0
  307. bsr.w JmpTo5_PlayMusic
  308. move.w #$720,d0
  309. move.w d0,(Camera_Max_Y_pos_now).w
  310. move.w d0,(Camera_Max_Y_pos).w
  311. bsr.w JmpTo65_DeleteObject
  312. addq.w #4,sp
  313. rts
  314. ; ===========================================================================
  315.  
  316. ObjC5_LaserWall:
  317. moveq #0,d0
  318. move.b routine_secondary(a0),d0
  319. move.w ObjC5_LaserWallIndex(pc,d0.w),d1
  320. jsr ObjC5_LaserWallIndex(pc,d1.w)
  321. tst.b (a0)
  322. beq.w return_37A48
  323. move.w x_pos(a0),-(sp)
  324. move.w #$13,d1
  325. move.w #$40,d2
  326. move.w #$80,d3
  327. move.w (sp)+,d4
  328. bra.w JmpTo27_SolidObject
  329. ; ===========================================================================
  330. ObjC5_LaserWallIndex:
  331. dc.w ObjC5_LaserWallMappings - ObjC5_LaserWallIndex ; 0 selects the mappings
  332. dc.w ObjC5_LaserWallWaitDelete - ObjC5_LaserWallIndex ; 2 Waits till set to delete (when the boss is defeated)
  333. dc.w ObjC5_LaserWallDelete - ObjC5_LaserWallIndex ; 4 After a little time it deletes
  334. ; ===========================================================================
  335.  
  336. ObjC5_LaserWallMappings:
  337. addq.b #2,routine_secondary(a0)
  338. move.b #$C,mapping_frame(a0) ; loads the laser wall from the WFZ boss art
  339. bra.w JmpTo45_DisplaySprite
  340. ; ===========================================================================
  341.  
  342. ObjC5_LaserWallWaitDelete:
  343. movea.w objoff_2C(a0),a1 ; a1=object
  344. btst #5,status(a1)
  345. bne.s ObjC5_LaserWallTimerSet
  346. bchg #0,objoff_2F(a0) ; makes it "flash" if set it won't flash
  347. bne.w return_37A48
  348. bra.w JmpTo45_DisplaySprite
  349. ; ===========================================================================
  350.  
  351. ObjC5_LaserWallTimerSet: ; sets a small timer
  352. addq.b #2,routine_secondary(a0)
  353. move.b #4,objoff_30(a0)
  354. bra.w JmpTo45_DisplaySprite
  355. ; ===========================================================================
  356.  
  357. ObjC5_LaserWallDelete:
  358. subq.b #1,anim_frame_duration(a0)
  359. bpl.w return_37A48
  360. move.b anim_frame_duration(a0),d0
  361. move.b anim_frame(a0),d1
  362. addq.b #2,d0
  363. bpl.s ObjC5_LaserWallDisplay
  364. move.b d1,anim_frame_duration(a0)
  365. subq.b #1,objoff_30(a0)
  366. bpl.s ObjC5_LaserWallDisplay
  367. move.b #$10,objoff_30(a0)
  368. addq.b #1,d1
  369. cmpi.b #5,d1
  370. bhs.w JmpTo65_DeleteObject
  371. move.b d1,anim_frame(a0)
  372. move.b d1,anim_frame_duration(a0)
  373.  
  374. ObjC5_LaserWallDisplay:
  375. bclr #0,objoff_2F(a0)
  376. bra.w JmpTo45_DisplaySprite
  377. ; ===========================================================================
  378.  
  379. ObjC5_PlatformReleaser:
  380. moveq #0,d0
  381. move.b routine_secondary(a0),d0
  382. move.w ObjC5_PlatformReleaserIndex(pc,d0.w),d1
  383. jmp ObjC5_PlatformReleaserIndex(pc,d1.w)
  384. ; ===========================================================================
  385. ObjC5_PlatformReleaserIndex:
  386. dc.w ObjC5_PlatformReleaserInit - ObjC5_PlatformReleaserIndex ; 0 Load mappings and position
  387. dc.w ObjC5_PlatformReleaserWaitDown - ObjC5_PlatformReleaserIndex ; 2 Waits for laser case to move down
  388. dc.w ObjC5_PlatformReleaserDown - ObjC5_PlatformReleaserIndex ; 4 Goes down until time limit is up
  389. dc.w ObjC5_PlatformReleaserLoadWait - ObjC5_PlatformReleaserIndex ; 6 Waits to load the platforms (the interval of time between each is from this) and makes sure only 3 are loaded
  390. dc.w ObjC5_PlatformReleaserDelete - ObjC5_PlatformReleaserIndex ; 8 Explodes then deletes
  391. ; ===========================================================================
  392.  
  393. ObjC5_PlatformReleaserInit:
  394. addq.b #2,routine_secondary(a0)
  395. move.b #5,mapping_frame(a0)
  396. addq.w #8,y_pos(a0) ; Move down a little
  397. bra.w JmpTo45_DisplaySprite
  398. ; ===========================================================================
  399.  
  400. ObjC5_PlatformReleaserWaitDown:
  401. movea.w objoff_2C(a0),a1 ; a1=object laser case
  402. btst #2,status(a1) ; checks if laser case is done moving down (so it starts loading the platforms)
  403. bne.s ObjC5_PlatformReleaserSetDown
  404. bra.w JmpTo45_DisplaySprite
  405. ; ===========================================================================
  406.  
  407. ObjC5_PlatformReleaserSetDown:
  408. addq.b #2,routine_secondary(a0)
  409. move.w #$40,objoff_2A(a0) ; time to go down
  410. move.w #$40,y_vel(a0) ; speed to go down
  411. bra.w JmpTo45_DisplaySprite
  412. ; ===========================================================================
  413.  
  414. ObjC5_PlatformReleaserDown:
  415. subq.w #1,objoff_2A(a0)
  416. beq.s ObjC5_PlatformReleaserStop
  417. bsr.w JmpTo26_ObjectMove
  418. bra.w JmpTo45_DisplaySprite
  419. ; ===========================================================================
  420.  
  421. ObjC5_PlatformReleaserStop:
  422. addq.b #2,routine_secondary(a0)
  423. clr.w y_vel(a0)
  424. move.w #$10,objoff_2A(a0)
  425. bra.w JmpTo45_DisplaySprite
  426. ; ===========================================================================
  427.  
  428. ObjC5_PlatformReleaserLoadWait:
  429. movea.w objoff_2C(a0),a1 ; a1=object
  430. btst #5,status(a1)
  431. bne.s ObjC5_PlatformReleaserDestroyP
  432. subq.w #1,objoff_2A(a0)
  433. bne.s BranchTo8_JmpTo45_DisplaySprite
  434. move.w #$80,objoff_2A(a0) ; Time between loading platforms
  435. moveq #0,d0
  436. move.b objoff_2E(a0),d0
  437. addq.b #1,d0
  438. cmpi.b #3,d0 ; How many platforms to load
  439. blo.s ObjC5_PlatformReleaserLoadP
  440. moveq #0,d0
  441.  
  442. ObjC5_PlatformReleaserLoadP: ; P=Platforms
  443. move.b d0,objoff_2E(a0)
  444. tst.b $30(a0,d0.w)
  445. bne.s BranchTo8_JmpTo45_DisplaySprite
  446. st $30(a0,d0.w)
  447. lea (ObjC5_PlatformData).l,a2
  448. bsr.w loc_367D0
  449. move.b objoff_2E(a0),objoff_2E(a1)
  450.  
  451. BranchTo8_JmpTo45_DisplaySprite:
  452. bra.w JmpTo45_DisplaySprite
  453. ; ===========================================================================
  454.  
  455. ObjC5_PlatformReleaserDestroyP: ; P=Platforms
  456. addq.b #2,routine_secondary(a0)
  457. bset #5,status(a0) ; destroy platforms
  458. bra.w JmpTo45_DisplaySprite
  459. ; ===========================================================================
  460.  
  461. ObjC5_PlatformReleaserDelete:
  462. movea.w objoff_2C(a0),a1 ; a1=object
  463. cmpi.b #$C5,(a1)
  464. bne.w JmpTo65_DeleteObject
  465. bsr.w JmpTo_Boss_LoadExplosion
  466. bra.w JmpTo45_DisplaySprite
  467. ; ===========================================================================
  468.  
  469. ObjC5_Platform:
  470. moveq #0,d0
  471. move.b routine_secondary(a0),d0
  472. move.w ObjC5_PlatformIndex(pc,d0.w),d1
  473. jsr ObjC5_PlatformIndex(pc,d1.w)
  474. lea (Ani_objC5).l,a1
  475. bsr.w JmpTo25_AnimateSprite
  476. tst.b (a0)
  477. beq.w return_37A48
  478. bra.w JmpTo45_DisplaySprite
  479. ; ===========================================================================
  480. ObjC5_PlatformIndex:
  481. dc.w ObjC5_PlatformInit - ObjC5_PlatformIndex ; 0 Selects mappings, anim ation, y speed and loads the object that hurts sonic (by spiky area)
  482. dc.w ObjC5_PlatformDownWait - ObjC5_PlatformIndex ; 2 Wait till the platform goes down some
  483. dc.w ObjC5_PlatformTestChangeDirection - ObjC5_PlatformIndex ; 4 checks if time limit is over and if so to change direction
  484. ; ===========================================================================
  485.  
  486. ObjC5_PlatformInit:
  487. addq.b #2,routine_secondary(a0)
  488. move.b #3,anim(a0)
  489. move.b #7,mapping_frame(a0)
  490. move.w #$100,y_vel(a0) ; Y speed
  491. move.w #$60,objoff_2A(a0)
  492. lea (ObjC5_PlatformHurtData).l,a2 ; loads the invisible object that hurts sonic
  493. bra.w loc_367D0
  494. ; ===========================================================================
  495.  
  496. ObjC5_PlatformDownWait: ; waits for it to go down some
  497. bsr.w ObjC5_PlatformCheckExplode
  498. subq.w #1,objoff_2A(a0)
  499. beq.s ObjC5_PlatformLeft
  500. bra.w ObjC5_PlatformMakeSolid
  501. ; ===========================================================================
  502.  
  503. ObjC5_PlatformLeft: ; goes left and makes a time limit (for going left)
  504. addq.b #2,routine_secondary(a0)
  505. move.w #$60,objoff_2A(a0)
  506. move.w #-$100,x_vel(a0) ; X speed
  507. move.w y_pos(a0),objoff_34(a0)
  508. bra.w ObjC5_PlatformMakeSolid
  509. ; ===========================================================================
  510.  
  511. ObjC5_PlatformTestChangeDirection:
  512. bsr.w ObjC5_PlatformCheckExplode
  513. subq.w #1,objoff_2A(a0)
  514. bne.s ObjC5_PlatformTestLeftRight
  515. move.w #$C0,objoff_2A(a0)
  516. neg.w x_vel(a0)
  517.  
  518. ObjC5_PlatformTestLeftRight: ; tests to see if a value should be added to go left or right
  519. moveq #4,d0
  520. move.w y_pos(a0),d1
  521. cmp.w objoff_34(a0),d1
  522. blo.s ObjC5_PlatformChangeY
  523. neg.w d0
  524.  
  525. ObjC5_PlatformChangeY: ; give it that curving feel
  526. add.w d0,y_vel(a0)
  527. bra.w ObjC5_PlatformMakeSolid
  528.  
  529. ObjC5_PlatformMakeSolid: ; makes into a platform and moves
  530. move.w x_pos(a0),-(sp)
  531. bsr.w JmpTo26_ObjectMove
  532. move.w #$10,d1
  533. move.w #8,d2
  534. move.w #8,d3
  535. move.w (sp)+,d4
  536. bra.w JmpTo9_PlatformObject
  537. ; ===========================================================================
  538.  
  539. ObjC5_PlatformCheckExplode: ; checks to see if platforms should explode
  540. movea.w objoff_2C(a0),a1 ; a1=object
  541. btst #5,status(a1)
  542. bne.w ObjC5_PlatformExplode
  543. rts
  544. ; ===========================================================================
  545.  
  546. ObjC5_PlatformExplode:
  547. bsr.w loc_3B7BC
  548. move.b #$58,(a0) ; load 0bj58 (explosion)
  549. clr.b routine(a0)
  550. movea.w objoff_3C(a0),a1 ; a1=object (invisible hurting thing)
  551. bsr.w JmpTo6_DeleteObject2
  552. addq.w #4,sp
  553. rts
  554. ; ===========================================================================
  555.  
  556. ObjC5_PlatformHurt:
  557. moveq #0,d0
  558. move.b routine_secondary(a0),d0
  559. move.w ObjC5_PlatformHurtIndex(pc,d0.w),d1
  560. jmp ObjC5_PlatformHurtIndex(pc,d1.w)
  561. ; ===========================================================================
  562. ObjC5_PlatformHurtIndex:
  563. dc.w ObjC5_PlatformHurtCollision - ObjC5_PlatformHurtIndex ; 0 Gives collision that hurts sonic
  564. dc.w ObjC5_PlatformHurtFollowPlatform - ObjC5_PlatformHurtIndex ; 2 Follows around the platform and waits to be deleted
  565. ; ===========================================================================
  566.  
  567. ObjC5_PlatformHurtCollision:
  568. addq.b #2,routine_secondary(a0)
  569. move.b #$98,collision_flags(a0)
  570. rts
  571. ; ===========================================================================
  572.  
  573. ObjC5_PlatformHurtFollowPlatform:
  574. movea.w objoff_2C(a0),a1 ; a1=object (platform)
  575. btst #5,status(a1)
  576. bne.w JmpTo65_DeleteObject
  577. move.w x_pos(a1),x_pos(a0)
  578. move.w y_pos(a1),d0
  579. addi.w #$C,d0
  580. move.w d0,y_pos(a0)
  581. rts
  582. ; ===========================================================================
  583.  
  584. ObjC5_LaserShooter:
  585. movea.w objoff_2C(a0),a1 ; a1=object (laser case)
  586. btst #5,status(a1)
  587. bne.w JmpTo65_DeleteObject
  588. moveq #0,d0
  589. move.b routine_secondary(a0),d0
  590. move.w ObjC5_LaserShooterIndex(pc,d0.w),d1
  591. jmp ObjC5_LaserShooterIndex(pc,d1.w)
  592. ; ===========================================================================
  593. ObjC5_LaserShooterIndex:
  594. dc.w ObjC5_LaserShooterInit - ObjC5_LaserShooterIndex ; 0 Loads up mappings
  595. dc.w ObjC5_LaserShooterFollow - ObjC5_LaserShooterIndex ; 2 Goes back and forth with the laser case
  596. dc.w ObjC5_LaserShooterDown - ObjC5_LaserShooterIndex ; 4 Laser case sets it to this routine which then makes it go down
  597. ; ===========================================================================
  598.  
  599. ObjC5_LaserShooterInit:
  600. addq.b #2,routine_secondary(a0)
  601. move.b #4,mapping_frame(a0)
  602. bra.w JmpTo45_DisplaySprite
  603. ; ===========================================================================
  604.  
  605. ObjC5_LaserShooterFollow:
  606. movea.w objoff_2C(a0),a1 ; a1=object (laser case)
  607. move.w x_pos(a1),x_pos(a0)
  608. move.w y_pos(a1),y_pos(a0)
  609. bra.w JmpTo45_DisplaySprite
  610. ; ===========================================================================
  611.  
  612. ObjC5_LaserShooterDown:
  613. movea.w objoff_2C(a0),a1 ; a1=object (laser case)
  614. move.w x_pos(a1),x_pos(a0)
  615. bra.w JmpTo45_DisplaySprite
  616. ; ===========================================================================
  617.  
  618. ObjC5_Laser:
  619. movea.w objoff_2C(a0),a1 ; a1=object
  620. btst #5,status(a1)
  621. bne.w JmpTo65_DeleteObject
  622. moveq #0,d0
  623. move.b routine_secondary(a0),d0
  624. move.w ObjC5_LaserIndex(pc,d0.w),d1
  625. jsr ObjC5_LaserIndex(pc,d1.w)
  626. bchg #0,objoff_2F(a0)
  627. bne.w return_37A48
  628. bra.w JmpTo45_DisplaySprite
  629. ; ===========================================================================
  630. ObjC5_LaserIndex:
  631. dc.w ObjC5_LaserInit - ObjC5_LaserIndex ; 0 Loads mappings and collision and such
  632. dc.w ObjC5_LaserFlash - ObjC5_LaserIndex ; 2 Makes the laser flash (gives the charging up effect)
  633. dc.w ObjC5_LaseWaitShoot - ObjC5_LaserIndex ; 4 Waits a little to launch the laser when it's done flickering (charging)
  634. dc.w ObjC5_LaserShoot - ObjC5_LaserIndex ; 6 Shoots down the laser untill it's fully shot out
  635. dc.w ObjC5_LaserMove - ObjC5_LaserIndex ; 8 Moves with laser case and shooter
  636. ; ===========================================================================
  637.  
  638. ObjC5_LaserInit:
  639. addq.b #2,routine_secondary(a0)
  640. move.b #$D,mapping_frame(a0)
  641. move.b #4,priority(a0)
  642. move.b #0,collision_flags(a0)
  643. addi.w #$10,y_pos(a0)
  644. move.b #$C,anim_frame(a0)
  645. subq.w #3,y_pos(a0)
  646. rts
  647. ; ===========================================================================
  648.  
  649. ObjC5_LaserFlash:
  650. bset #0,objoff_2F(a0)
  651. subq.b #1,anim_frame_duration(a0)
  652. bpl.s ObjC5_LaserNoLaser
  653. move.b anim_frame_duration(a0),d0
  654. addq.b #2,d0
  655. bpl.s ObjC5_LaserFlicker
  656. move.b anim_frame(a0),d0
  657. subq.b #1,d0
  658. beq.s ObjC5_LaseNext
  659. move.b d0,anim_frame(a0)
  660. move.b d0,anim_frame_duration(a0)
  661.  
  662. ObjC5_LaserFlicker: ; this is what makes the laser flicker before being fully loaded (covering laser shooter)
  663. bclr #0,objoff_2F(a0)
  664.  
  665. ObjC5_LaserNoLaser: ; without this the laser would just stay on the shooter not going down
  666. rts
  667. ; ===========================================================================
  668.  
  669. ObjC5_LaseNext: ; just sets up a time to wait for the laser to shoot when it's loaded and done flickering
  670. addq.b #2,routine_secondary(a0)
  671. move.w #$40,objoff_2A(a0)
  672. rts
  673. ; ===========================================================================
  674.  
  675. ObjC5_LaseWaitShoot:
  676. subq.w #1,objoff_2A(a0)
  677. bmi.s ObjC5_LaseStartShooting
  678. rts
  679. ; ===========================================================================
  680.  
  681. ObjC5_LaseStartShooting:
  682. addq.b #2,routine_secondary(a0)
  683. addi.w #$10,y_pos(a0)
  684. rts
  685. ; ===========================================================================
  686.  
  687. ObjC5_LaserShoot:
  688. moveq #0,d0
  689. move.b objoff_2E(a0),d0
  690. addq.b #1,d0
  691. cmpi.b #5,d0
  692. bhs.s ObjC5_LaseShotOut
  693. addi.w #$10,y_pos(a0)
  694. move.b d0,objoff_2E(a0)
  695. move.b ObjC5_LaserMappingsData(pc,d0.w),mapping_frame(a0)
  696. move.b ObjC5_LaserCollisionData(pc,d0.w),collision_flags(a0)
  697. rts
  698. ; ===========================================================================
  699.  
  700. ObjC5_LaseShotOut: ; laser is fully shot out and lets the laser case know so it moves
  701. addq.b #2,routine_secondary(a0)
  702. move.w #$80,objoff_2A(a0)
  703. bset #2,status(a0)
  704. movea.w objoff_2C(a0),a1 ; a1=object (laser case)
  705. bset #3,status(a1)
  706. rts
  707. ; ===========================================================================
  708. ObjC5_LaserMappingsData:
  709. dc.b $E
  710. dc.b $F ; 1
  711. dc.b $10 ; 2
  712. dc.b $11 ; 3
  713. dc.b $12 ; 4
  714. dc.b 0 ; 5
  715. ObjC5_LaserCollisionData:
  716. dc.b $86
  717. dc.b $AB ; 1
  718. dc.b $AC ; 2
  719. dc.b $AD ; 3
  720. dc.b $AE ; 4
  721. dc.b 0 ; 5
  722. ; ===========================================================================
  723.  
  724. ObjC5_LaserMove:
  725. movea.w objoff_2C(a0),a1 ; a1=object
  726. move.w x_pos(a1),x_pos(a0)
  727. rts
  728. ; ===========================================================================
  729.  
  730. ObjC5_Robotnik:
  731. moveq #0,d0
  732. move.b routine_secondary(a0),d0
  733. move.w ObjC5_RobotnikIndex(pc,d0.w),d1
  734. jmp ObjC5_RobotnikIndex(pc,d1.w)
  735. ; ===========================================================================
  736. ObjC5_RobotnikIndex:
  737. dc.w ObjC5_RobotnikInit - ObjC5_RobotnikIndex ; 0 Loads art, animation and position
  738. dc.w ObjC5_RobotnikAnimate - ObjC5_RobotnikIndex ; 2 Animates Robotnik and waits till the case is defeated
  739. dc.w ObjC5_RobotnikDown - ObjC5_RobotnikIndex ; 4 Goes down until timer is up
  740. ; ===========================================================================
  741.  
  742. ObjC5_RobotnikInit:
  743. addq.b #2,routine_secondary(a0)
  744. move.b #0,mapping_frame(a0)
  745. move.b #1,anim(a0)
  746. move.w #$2C60,x_pos(a0)
  747. move.w #$4E6,y_pos(a0)
  748. lea (ObjC5_RobotnikPlatformData).l,a2
  749. bsr.w loc_367D0
  750. bra.w JmpTo45_DisplaySprite
  751. ; ===========================================================================
  752.  
  753. ObjC5_RobotnikAnimate:
  754. movea.w objoff_2C(a0),a1 ; a1=object (laser case)
  755. btst #5,status(a1)
  756. bne.s ObjC5_RobotnikTimer
  757. lea (Ani_objC5_objC6).l,a1
  758. bsr.w JmpTo25_AnimateSprite
  759. bra.w JmpTo45_DisplaySprite
  760. ; ===========================================================================
  761.  
  762. ObjC5_RobotnikTimer: ; Increase routine and set timer
  763. addq.b #2,routine_secondary(a0)
  764. move.w #$C0,objoff_2A(a0)
  765. bra.w JmpTo45_DisplaySprite
  766. ; ===========================================================================
  767.  
  768. ObjC5_RobotnikDown:
  769. subq.w #1,objoff_2A(a0)
  770. bmi.s ObjC5_RobotnikDelete
  771. addq.w #1,y_pos(a0)
  772. bra.w JmpTo45_DisplaySprite
  773. ; ===========================================================================
  774.  
  775. ObjC5_RobotnikDelete: ; Deletes robotnik and the platform he's on
  776. movea.w parent(a0),a1 ; a1=object (Robotnik Platform)
  777. bsr.w JmpTo6_DeleteObject2
  778. bra.w JmpTo65_DeleteObject
  779. ; ===========================================================================
  780.  
  781. ObjC5_RobotnikPlatform: ; Just displays the platform and move accordingly to the robotnik object
  782. movea.w objoff_2C(a0),a1 ; a1=object (robotnik)
  783. move.w y_pos(a1),d0
  784. addi.w #$26,d0
  785. move.w d0,y_pos(a0)
  786. bra.w JmpTo45_DisplaySprite
  787. ; ===========================================================================
  788. ; some unused/dead code, At one point it appears a section of the platform was solid
  789. move.w x_pos(a0),-(sp)
  790. bsr.w JmpTo26_ObjectMove
  791. move.w #$F,d1
  792. move.w #8,d2
  793. move.w #8,d3
  794. move.w (sp)+,d4
  795. bra.w JmpTo9_PlatformObject
  796. ; ===========================================================================
  797.  
  798. ObjC5_HandleHits:
  799. tst.b collision_property(a0)
  800. beq.s ObjC5_NoHitPointsLeft
  801. tst.b collision_flags(a0)
  802. bne.s return_3CC3A
  803. tst.b objoff_30(a0)
  804. bne.s ObjC5_FlashSetUp
  805. btst #6,status(a0)
  806. beq.s return_3CC3A
  807. move.b #$20,objoff_30(a0)
  808. move.w #SndID_BossHit,d0
  809. jsr (PlaySound).l
  810.  
  811. ObjC5_FlashSetUp:
  812. lea (Normal_palette_line2+2).w,a1
  813. moveq #0,d0
  814. tst.w (a1)
  815. bne.s ObjC5_FlashCollisionRestore
  816. move.w #$EEE,d0
  817.  
  818. ObjC5_FlashCollisionRestore:
  819. move.w d0,(a1)
  820. subq.b #1,objoff_30(a0)
  821. bne.s return_3CC3A
  822. btst #4,status(a0) ; makes sure the boss doesn't need collision
  823. beq.s return_3CC3A
  824. move.b #6,collision_flags(a0) ; restore collision
  825.  
  826. return_3CC3A:
  827. rts
  828. ; ===========================================================================
  829.  
  830. ObjC5_NoHitPointsLeft: ; when the boss is defeated this tells it what to do
  831. moveq #$64,d0
  832. bsr.w AddPoints
  833. clr.b collision_flags(a0)
  834. move.w #$EF,objoff_30(a0)
  835. move.b #$1E,routine_secondary(a0)
  836. bset #5,status(a0)
  837. bclr #6,status(a0)
  838. rts
  839. ; ===========================================================================
  840. ObjC5_LaserWallData:
  841. dc.w $2A
  842. dc.b ObjID_WFZBoss
  843. dc.b $94
  844. ObjC5_PlatformData:
  845. dc.w $3E
  846. dc.b ObjID_WFZBoss
  847. dc.b $98
  848. ObjC5_PlatformHurtData:
  849. dc.w $3C
  850. dc.b ObjID_WFZBoss
  851. dc.b $9A
  852. ObjC5_LaserShooterData:
  853. dc.w $3C
  854. dc.b ObjID_WFZBoss
  855. dc.b $9C
  856. ObjC5_PlatformReleaserData:
  857. dc.w $3A
  858. dc.b ObjID_WFZBoss
  859. dc.b $96
  860. ObjC5_LaserData:
  861. dc.w $3E
  862. dc.b ObjID_WFZBoss
  863. dc.b $9E
  864. ObjC5_RobotnikData:
  865. dc.w $38
  866. dc.b ObjID_WFZBoss
  867. dc.b $A0
  868. ObjC5_RobotnikPlatformData:
  869. dc.w $3E
  870. dc.b ObjID_WFZBoss
  871. dc.b $A2
  872.  
  873. ; off_3CC80:
  874. ObjC5_SubObjData: ; Laser Case
  875. dc.l ObjC5_MapUnc_3CCD8
  876. dc.w $379
  877. dc.b 4,4,$20,0
  878. ; off_3CC8A:
  879. ObjC5_SubObjData2: ; Laser Walls
  880. dc.l ObjC5_MapUnc_3CCD8
  881. dc.w $379
  882. dc.b 4,1,8,0
  883. ; off_3CC94:
  884. ObjC5_SubObjData3: ; Platforms, platform releaser, laser and laser shooter
  885. dc.l ObjC5_MapUnc_3CCD8
  886. dc.w $379
  887. dc.b 4,5,$10,0
  888. ; off_3CC9E:
  889. ObjC6_SubObjData2: ; Robotnik
  890. dc.l ObjC6_MapUnc_3D0EE
  891. dc.w 0
  892. dc.b 4,5,$20,0
  893. ; off_3CCA8:
  894. ObjC5_SubObjData4: ; Robotnik platform
  895. dc.l ObjC5_MapUnc_3CEBC
  896. dc.w $A46D
  897. dc.b 4,5,$20,0
  898.  
  899. ; animation script
  900. ; off_3CCB2:
  901. Ani_objC5:
  902. dc.w byte_3CCBA - Ani_objC5
  903. dc.w byte_3CCC4 - Ani_objC5
  904. dc.w byte_3CCCC - Ani_objC5
  905. dc.w byte_3CCD0 - Ani_objC5
  906. byte_3CCBA:
  907. dc.b 5, 0, 1, 2, 3, 3, 3, 3,$FA, 0
  908. byte_3CCC4:
  909. dc.b 3, 3, 2, 1, 0, 0,$FA, 0
  910. byte_3CCCC:
  911. dc.b 3, 5, 6,$FF
  912. byte_3CCD0:
  913. dc.b 3, 7, 8, 9, $A, $B,$FF
  914. even
  915. ; ----------------------------------------------------------------------------
  916. ; sprite mappings
  917. ; ----------------------------------------------------------------------------
  918. ObjC5_MapUnc_3CCD8: BINCLUDE "mappings/sprite/objC5_a.bin"
  919. ; ----------------------------------------------------------------------------
  920. ; sprite mappings
  921. ; ----------------------------------------------------------------------------
  922. ObjC5_MapUnc_3CEBC: BINCLUDE "mappings/sprite/objC5_b.bin"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement